@ketch-sdk/ketch-types 1.4.5 → 1.5.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/dist/index.d.ts +95 -58
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
/**
|
|
3
2
|
* Callback
|
|
4
3
|
*/
|
|
5
|
-
import { EventEmitter } from 'events';
|
|
6
4
|
export declare type Callback = (arg0: any) => void;
|
|
7
5
|
/**
|
|
8
6
|
* Status
|
|
@@ -94,8 +92,7 @@ export interface StorageProvider {
|
|
|
94
92
|
*/
|
|
95
93
|
removeItem(key: string): Promise<void>;
|
|
96
94
|
}
|
|
97
|
-
export interface Ketch
|
|
98
|
-
getConfig(): Promise<Configuration>;
|
|
95
|
+
export interface Ketch {
|
|
99
96
|
/**
|
|
100
97
|
* Register a plugin with the given configuration
|
|
101
98
|
*
|
|
@@ -119,76 +116,113 @@ export interface Ketch extends EventEmitter {
|
|
|
119
116
|
hasConsent(): boolean;
|
|
120
117
|
getConsent(): Promise<Consent>;
|
|
121
118
|
setConsent(c: Consent): Promise<Consent>;
|
|
122
|
-
/**
|
|
123
|
-
* @deprecated use on('consent', callback)
|
|
124
|
-
* @param callback
|
|
125
|
-
*/
|
|
126
|
-
onConsent(callback: Callback): Promise<void>;
|
|
127
119
|
setShowConsentExperience(): Promise<void>;
|
|
128
120
|
showConsentExperience(): Promise<Consent>;
|
|
129
|
-
/**
|
|
130
|
-
* @deprecated use on('showConsentExperience', callback)
|
|
131
|
-
* @param callback
|
|
132
|
-
*/
|
|
133
|
-
onShowConsentExperience(callback: (consents: Consent, options?: ShowConsentOptions) => void): Promise<void>;
|
|
134
121
|
showPreferenceExperience(params: ShowPreferenceOptions): Promise<Consent>;
|
|
122
|
+
experienceClosed(reason: ExperienceClosedReason): Promise<Consent>;
|
|
123
|
+
invokeRight(eventData: InvokeRightEvent): Promise<void>;
|
|
124
|
+
getConfig(): Promise<Configuration>;
|
|
125
|
+
getEnvironment(): Promise<Environment>;
|
|
126
|
+
getGeoIP(): Promise<IPInfo>;
|
|
127
|
+
getIdentities(): Promise<Identities>;
|
|
128
|
+
getJurisdiction(): Promise<string>;
|
|
129
|
+
getRegionInfo(): Promise<string>;
|
|
135
130
|
/**
|
|
136
|
-
*
|
|
137
|
-
* @param callback
|
|
131
|
+
* Alias for `emitter.on(eventName, listener)`.
|
|
138
132
|
*/
|
|
139
|
-
|
|
140
|
-
experienceClosed(reason: ExperienceClosedReason): Promise<Consent>;
|
|
133
|
+
addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
141
134
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
135
|
+
* Adds the `listener` function to the end of the listeners array for the
|
|
136
|
+
* event named `eventName`. No checks are made to see if the `listener` has
|
|
137
|
+
* already been added. Multiple calls passing the same combination of `eventName`
|
|
138
|
+
* and `listener` will result in the `listener` being added, and called, multiple
|
|
139
|
+
* times.
|
|
140
|
+
*
|
|
141
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
142
|
+
*
|
|
143
|
+
* By default, event listeners are invoked in the order they are added. The
|
|
144
|
+
* `emitter.prependListener()` method can be used as an alternative to add the
|
|
145
|
+
* event listener to the beginning of the listeners array.
|
|
146
|
+
*
|
|
147
|
+
* @param eventName The name of the event.
|
|
148
|
+
* @param listener The callback function
|
|
144
149
|
*/
|
|
145
|
-
|
|
150
|
+
on(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
146
151
|
/**
|
|
147
|
-
*
|
|
148
|
-
*
|
|
152
|
+
* Adds a **one-time**`listener` function for the event named `eventName`. The
|
|
153
|
+
* next time `eventName` is triggered, this listener is removed and then invoked.
|
|
154
|
+
*
|
|
155
|
+
* By default, event listeners are invoked in the order they are added. The
|
|
156
|
+
* `emitter.prependOnceListener()` method can be used as an alternative to add the
|
|
157
|
+
* event listener to the beginning of the listeners array.
|
|
158
|
+
*
|
|
159
|
+
* @param eventName The name of the event.
|
|
160
|
+
* @param listener The callback function
|
|
149
161
|
*/
|
|
150
|
-
|
|
151
|
-
invokeRight(eventData: InvokeRightEvent): Promise<void>;
|
|
162
|
+
once(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
152
163
|
/**
|
|
153
|
-
*
|
|
154
|
-
*
|
|
164
|
+
* Removes the specified `listener` from the listener array for the event
|
|
165
|
+
* named `eventName`.
|
|
166
|
+
*
|
|
167
|
+
* `removeListener()` will remove, at most, one instance of a listener from the
|
|
168
|
+
* listener array. If any single listener has been added multiple times to the
|
|
169
|
+
* listener array for the specified `eventName`, then `removeListener()` must be
|
|
170
|
+
* called multiple times to remove each instance.
|
|
171
|
+
*
|
|
172
|
+
* Once an event is emitted, all listeners attached to it at the
|
|
173
|
+
* time of emitting are called in order. This implies that any`removeListener()`
|
|
174
|
+
* or `removeAllListeners()` calls _after_ emitting and _before_ the last listener
|
|
175
|
+
* finishes execution will not remove them from`emit()` in progress. Subsequent
|
|
176
|
+
* events behave as expected.
|
|
177
|
+
*
|
|
178
|
+
* Because listeners are managed using an internal array, calling this will
|
|
179
|
+
* change the position indices of any listener registered _after_ the listener
|
|
180
|
+
* being removed. This will not impact the order in which listeners are called,
|
|
181
|
+
* but it means that any copies of the listener array as returned by
|
|
182
|
+
* the `emitter.listeners()` method will need to be recreated.
|
|
183
|
+
*
|
|
184
|
+
* When a single function has been added as a handler multiple times for a single
|
|
185
|
+
* event (as in the example below), `removeListener()` will remove the most
|
|
186
|
+
* recently added instance. In the example the `once('ping')`listener is removed:
|
|
155
187
|
*/
|
|
156
|
-
|
|
157
|
-
setEnvironment(env: Environment): Promise<Environment>;
|
|
158
|
-
getEnvironment(): Promise<Environment>;
|
|
188
|
+
removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
159
189
|
/**
|
|
160
|
-
*
|
|
161
|
-
* @param callback
|
|
190
|
+
* Alias for `emitter.removeListener()`.
|
|
162
191
|
*/
|
|
163
|
-
|
|
164
|
-
setGeoIP(g: IPInfo): Promise<IPInfo>;
|
|
165
|
-
getGeoIP(): Promise<IPInfo>;
|
|
192
|
+
off(eventName: string | symbol, listener: (...args: any[]) => void): this;
|
|
166
193
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
194
|
+
* Removes all listeners, or those of the specified `eventName`.
|
|
195
|
+
*
|
|
196
|
+
* It is bad practice to remove listeners added elsewhere in the code,
|
|
197
|
+
* particularly when the `EventEmitter` instance was created by some other
|
|
198
|
+
* component or module (e.g. sockets or file streams).
|
|
199
|
+
*
|
|
200
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
169
201
|
*/
|
|
170
|
-
|
|
171
|
-
setIdentities(id: Identities): Promise<Identities>;
|
|
172
|
-
getIdentities(): Promise<Identities>;
|
|
202
|
+
removeAllListeners(event?: string | symbol): this;
|
|
173
203
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
204
|
+
* By default `EventEmitter`s will print a warning if more than `10` listeners are
|
|
205
|
+
* added for a particular event. This is a useful default that helps finding
|
|
206
|
+
* memory leaks. The `emitter.setMaxListeners()` method allows the limit to be
|
|
207
|
+
* modified for this specific `EventEmitter` instance. The value can be set to
|
|
208
|
+
* `Infinity` (or `0`) to indicate an unlimited number of listeners.
|
|
209
|
+
*
|
|
210
|
+
* Returns a reference to the `EventEmitter`, so that calls can be chained.
|
|
176
211
|
*/
|
|
177
|
-
|
|
178
|
-
setJurisdiction(ps: string): Promise<string>;
|
|
179
|
-
getJurisdiction(): Promise<string>;
|
|
212
|
+
setMaxListeners(n: number): this;
|
|
180
213
|
/**
|
|
181
|
-
*
|
|
182
|
-
* @
|
|
214
|
+
* Returns the current max listener value for the `EventEmitter` which is either
|
|
215
|
+
* set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}.
|
|
183
216
|
*/
|
|
184
|
-
|
|
185
|
-
setRegionInfo(info: string): Promise<string>;
|
|
186
|
-
getRegionInfo(): Promise<string>;
|
|
217
|
+
getMaxListeners(): number;
|
|
187
218
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
219
|
+
* Synchronously calls each of the listeners registered for the event named
|
|
220
|
+
* `eventName`, in the order they were registered, passing the supplied arguments
|
|
221
|
+
* to each.
|
|
222
|
+
*
|
|
223
|
+
* @returns `true` if the event had listeners, `false` otherwise.
|
|
190
224
|
*/
|
|
191
|
-
|
|
225
|
+
emit(eventName: string | symbol, ...args: any[]): boolean;
|
|
192
226
|
}
|
|
193
227
|
/**
|
|
194
228
|
* ShowPreferenceOptions
|
|
@@ -196,19 +230,23 @@ export interface Ketch extends EventEmitter {
|
|
|
196
230
|
export type ShowPreferenceOptions = {
|
|
197
231
|
tab?: Tab;
|
|
198
232
|
/**
|
|
199
|
-
* dataSubjectTypeCodes is the list of data subjects to display. If undefined,
|
|
233
|
+
* dataSubjectTypeCodes is the list of data subjects to display. If undefined,
|
|
234
|
+
* all data subjects are displayed.
|
|
200
235
|
*/
|
|
201
236
|
dataSubjectTypeCodes?: string[];
|
|
202
237
|
/**
|
|
203
|
-
* showRightsTab determines whether the rights tab will show. If undefined,
|
|
238
|
+
* showRightsTab determines whether the rights tab will show. If undefined,
|
|
239
|
+
* the rights tab is displayed.
|
|
204
240
|
*/
|
|
205
241
|
showRightsTab?: boolean;
|
|
206
242
|
/**
|
|
207
|
-
* supportedCountries is the list of supported ISO 3166 ALPHA-2 country codes
|
|
243
|
+
* supportedCountries is the list of supported ISO 3166 ALPHA-2 country codes
|
|
244
|
+
* to show in the rights form
|
|
208
245
|
*/
|
|
209
246
|
supportedCountries?: string[];
|
|
210
247
|
/**
|
|
211
|
-
* showConsentsTab determines whether the consents tab will show. If
|
|
248
|
+
* showConsentsTab determines whether the consents tab will show. If
|
|
249
|
+
* undefined, the consents tab is displayed
|
|
212
250
|
*/
|
|
213
251
|
showConsentsTab?: boolean;
|
|
214
252
|
};
|
|
@@ -461,7 +499,6 @@ export interface SetConsentRequest {
|
|
|
461
499
|
[key: string]: string;
|
|
462
500
|
};
|
|
463
501
|
collectedAt?: number;
|
|
464
|
-
migrationOption?: MigrationOption;
|
|
465
502
|
purposes: {
|
|
466
503
|
[key: string]: PurposeAllowedLegalBasis;
|
|
467
504
|
};
|
package/dist/index.js
CHANGED
|
@@ -204,4 +204,4 @@ var ModalPosition;
|
|
|
204
204
|
ModalPosition[ModalPosition["LEFT_FULL_HEIGHT"] = 2] = "LEFT_FULL_HEIGHT";
|
|
205
205
|
ModalPosition[ModalPosition["RIGHT_FULL_HEIGHT"] = 3] = "RIGHT_FULL_HEIGHT";
|
|
206
206
|
})(ModalPosition = exports.ModalPosition || (exports.ModalPosition = {}));
|
|
207
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
207
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBdUJBOztHQUVHO0FBQ1UsUUFBQSxRQUFRLEdBQUcsQ0FBQyxhQUFhLEVBQUUsV0FBVyxFQUFFLGFBQWEsQ0FBVSxDQUFBO0FBWTVFOzs7O0dBSUc7QUFDSCxTQUFnQixLQUFLLENBQUMsS0FBYTtJQUNqQyxPQUFPLGdCQUFRLENBQUMsUUFBUSxDQUFDLEtBQVksQ0FBQyxDQUFBO0FBQ3hDLENBQUM7QUFGRCxzQkFFQztBQTBQRDs7OztHQUlHO0FBQ0gsSUFBWSxjQUdYO0FBSEQsV0FBWSxjQUFjO0lBQ3hCLGlEQUErQixDQUFBO0lBQy9CLHVEQUFxQyxDQUFBO0FBQ3ZDLENBQUMsRUFIVyxjQUFjLEdBQWQsc0JBQWMsS0FBZCxzQkFBYyxRQUd6QjtBQUVEOzs7O0dBSUc7QUFDSCxJQUFZLHFCQUlYO0FBSkQsV0F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ch-sdk/ketch-types", "version": "1.5.1", "description": "Ketch Types", "main": "./dist/index.js", "types": "./dist/index.d.ts", "type": "commonjs", "scripts": {"all": "npm run lint && npm run format-check && npm run test && npm run build && npm run docs", "build": "tsc -p .", "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.4.1", "@types/events": "^3.0.0", "@types/jest": "^29.4.0", "@typescript-eslint/eslint-plugin": "^5.49.0", "@typescript-eslint/parser": "^5.49.0", "eslint": "^8.33.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", "eslint-plugin-jest": "^27.2.1", "eslint-plugin-prettier": "^4.2.1", "jest": "^29.4.1", "jest-environment-jsdom": "^29.4.1", "jest-junit": "^15.0.0", "prettier": "^2.8.3", "ts-jest": "^29.0.5", "typedoc": "^0.23.24", "typescript": "^4.9.4"}, "files": ["./dist"]}
|