@ketch-sdk/ketch-types 0.2.4 → 0.4.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 CHANGED
@@ -29,62 +29,53 @@ export declare type PreferenceExperienceParams = {
29
29
  dataSubjectTypeCodes?: string[];
30
30
  };
31
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
- }
32
+ * Plugin factory function signature
33
+ */
34
+ export declare type Plugin = (host: Ketch, config?: any) => Promise<void>;
48
35
  /**
49
36
  * Ketch host
50
37
  */
51
38
  export interface Ketch {
52
39
  getConfig(): Promise<Configuration>;
53
- registerPlugin(plugin: Plugin): Promise<void>;
54
- getProperty(p: string): string | null;
40
+ registerPlugin(plugin: Plugin, config?: any): Promise<void>;
55
41
  hasConsent(): boolean;
56
42
  getConsent(): Promise<Consent>;
57
43
  setConsent(c: Consent): Promise<Consent>;
58
44
  changeConsent(consent: Consent): Promise<void>;
59
45
  setProvisionalConsent(c: Consent): Promise<void>;
60
46
  onConsent(callback: Callback): Promise<void>;
61
- invokeRight(eventData: InvokeRightsEvent): Promise<void>;
62
- onInvokeRight(callback: Callback): Promise<void>;
63
- shouldShowConsent(c: Consent): boolean;
64
47
  setShowConsentExperience(): Promise<void>;
48
+ shouldShowConsent(c: Consent): boolean;
65
49
  showConsentExperience(): Promise<Consent>;
66
50
  onShowConsentExperience(callback: ShowConsentExperience): Promise<void>;
67
51
  showPreferenceExperience(params: PreferenceExperienceParams): Promise<Consent>;
68
52
  onShowPreferenceExperience(callback: ShowPreferenceExperience): Promise<void>;
69
- experienceClosed(reason: string): Promise<Consent>;
53
+ experienceClosed(reason: ExperienceClosedReason): Promise<Consent>;
70
54
  onHideExperience(callback: Callback): Promise<void>;
71
55
  onWillShowExperience(callback: Callback): Promise<void>;
72
- getEnvironment(): Promise<Environment>;
56
+ invokeRight(eventData: InvokeRightsEvent): Promise<void>;
57
+ onInvokeRight(callback: Callback): Promise<void>;
73
58
  setEnvironment(env: Environment): Promise<Environment>;
59
+ getEnvironment(): Promise<Environment>;
74
60
  onEnvironment(callback: Callback): Promise<void>;
75
- getGeoIP(): Promise<IPInfo>;
76
61
  setGeoIP(g: IPInfo): Promise<IPInfo>;
62
+ getGeoIP(): Promise<IPInfo>;
77
63
  onGeoIP(callback: Callback): Promise<void>;
78
- getIdentities(): Promise<Identities>;
79
64
  setIdentities(id: Identities): Promise<Identities>;
65
+ getIdentities(): Promise<Identities>;
80
66
  onIdentities(callback: Callback): Promise<void>;
81
- getJurisdiction(): Promise<string>;
82
67
  setJurisdiction(ps: string): Promise<string>;
68
+ getJurisdiction(): Promise<string>;
83
69
  onJurisdiction(callback: Callback): Promise<void>;
70
+ setRegionInfo(info: string): Promise<string>;
84
71
  getRegionInfo(): Promise<string>;
85
72
  onRegionInfo(callback: Callback): Promise<void>;
86
- setRegionInfo(info: string): Promise<string>;
87
- fireNativeEvent(name: string, args: any): Promise<void>;
73
+ emit(eventName: string | symbol, ...args: any[]): boolean;
74
+ addListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
75
+ removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this;
76
+ on(eventName: string | symbol, listener: (...args: any[]) => void): this;
77
+ once(eventName: string | symbol, listener: (...args: any[]) => void): this;
78
+ off(eventName: string | symbol, listener: (...args: any[]) => void): this;
88
79
  }
89
80
  /**
90
81
  * ShowPreferenceExperience
@@ -138,6 +129,14 @@ export interface AppDiv {
138
129
  id: string;
139
130
  zIndex: string;
140
131
  }
132
+ /**
133
+ * ExperienceClosedReason describes the reason the experience was closed.
134
+ *
135
+ * setConsent = consent was accepted/set
136
+ * invokeRight = the right was invoked
137
+ * close = the close/exit button was clicked
138
+ */
139
+ export declare type ExperienceClosedReason = 'setConsent' | 'invokeRight' | 'close';
141
140
  /**
142
141
  * ExperienceDefault
143
142
  */
@@ -906,45 +905,136 @@ export interface Stack {
906
905
  * Configuration
907
906
  */
908
907
  export interface Configuration {
909
- language?: string;
908
+ /**
909
+ * Organization this configuration belongs to
910
+ */
910
911
  organization: Organization;
912
+ /**
913
+ * Property this configuration belongs to
914
+ */
911
915
  property?: Property;
916
+ /**
917
+ * Language for all text
918
+ */
919
+ language?: string;
920
+ /**
921
+ * Available environments. Only available in the "boot" configuration.
922
+ */
912
923
  environments?: Environment[];
924
+ /**
925
+ * Environment for this configuration. Only available in the "full" configuration.
926
+ */
913
927
  environment?: Environment;
928
+ /**
929
+ * Applicable jurisdiction.
930
+ */
914
931
  jurisdiction?: JurisdictionInfo;
932
+ /**
933
+ * Identity spaces defined for this property
934
+ */
915
935
  identities?: {
916
936
  [key: string]: Identity;
917
937
  };
938
+ /**
939
+ * Deployment information. Only available in the "full" configuration.
940
+ */
918
941
  deployment?: Deployment;
942
+ /**
943
+ * Regulations enabled for this jurisdiction.
944
+ */
919
945
  regulations?: string[];
946
+ /**
947
+ * Rights available in this jurisdiction.
948
+ */
920
949
  rights?: Right[];
950
+ /**
951
+ * Purposes in this jurisdiction.
952
+ */
921
953
  purposes?: Purpose[];
954
+ /**
955
+ * Mapping of purposes to canonical purposes.
956
+ *
957
+ * @deprecated
958
+ */
922
959
  canonicalPurposes?: {
923
960
  [key: string]: CanonicalPurpose;
924
961
  };
962
+ /**
963
+ * Privacy policy document
964
+ */
965
+ privacyPolicy?: PolicyDocument;
966
+ /**
967
+ * Terms of Service (ToS) policy document
968
+ */
969
+ termsOfService?: PolicyDocument;
970
+ /**
971
+ * Theme
972
+ */
973
+ theme?: Theme;
974
+ /**
975
+ * Experience definitions
976
+ */
925
977
  experiences?: Experience;
978
+ /**
979
+ * Services
980
+ */
926
981
  services?: {
927
982
  [key: string]: string;
928
983
  };
984
+ /**
985
+ * Flexible options
986
+ */
929
987
  options?: {
930
988
  [key: string]: string;
931
989
  };
932
- privacyPolicy?: PolicyDocument;
933
- termsOfService?: PolicyDocument;
934
- theme?: Theme;
990
+ /**
991
+ * Scripts to load
992
+ */
935
993
  scripts?: string[];
994
+ /**
995
+ * Plugins configured for the configuration
996
+ */
997
+ plugins?: {
998
+ [key: string]: any;
999
+ };
1000
+ /**
1001
+ * Vendors (TCF)
1002
+ */
936
1003
  vendors?: Vendor[];
1004
+ /**
1005
+ * Data subject types relevant for this configuration
1006
+ */
937
1007
  dataSubjectTypes?: DataSubjectType[];
1008
+ /**
1009
+ * Stacks to be displayed in an experience
1010
+ */
938
1011
  stacks?: Stack[];
939
1012
  }
940
- export declare type Pusher = {
1013
+ /**
1014
+ * Pusher interface defines a type that has a push function like an array
1015
+ */
1016
+ export interface Pusher {
1017
+ /**
1018
+ * Pushes the given arguments.
1019
+ *
1020
+ * @param args The arguments to push.
1021
+ */
941
1022
  push(args: any[]): void;
942
- };
943
- export declare type Loaded = {
944
- loaded?: boolean;
945
- };
1023
+ }
1024
+ /**
1025
+ * Loaded interface defines a type that has a loaded boolean property
1026
+ */
1027
+ export interface Loaded {
1028
+ /**
1029
+ * Loaded is set to true if the object has fully loaded
1030
+ */
1031
+ loaded: boolean;
1032
+ }
946
1033
  declare global {
947
1034
  interface Window {
1035
+ /**
1036
+ * Semaphore is the main entrypoint.
1037
+ */
948
1038
  semaphore: Pusher & Loaded;
949
1039
  }
950
1040
  }
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@ketch-sdk/ketch-types", "version": "0.2.4", "description": "Ketch Types", "main": "./dist/index.js", "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"}}
1
+ {"name": "@ketch-sdk/ketch-types", "version": "0.4.0", "description": "Ketch Types", "main": "./dist/index.js", "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.2", "@types/jest": "^29.2.0", "@typescript-eslint/eslint-plugin": "^5.41.0", "@typescript-eslint/parser": "^5.41.0", "@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.2", "jest-environment-jsdom": "^29.2.2", "jest-junit": "^14.0.1", "prettier": "^2.7.1", "ts-jest": "^29.0.3", "typedoc": "^0.23.19", "typescript": "^4.8.4"}}
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1666569121799" clover="3.2.0">
3
- <project timestamp="1666569121799" name="All files">
2
+ <coverage generated="1667182055910" clover="3.2.0">
3
+ <project timestamp="1667182055910" name="All files">
4
4
  <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
5
  </project>
6
6
  </coverage>
@@ -86,7 +86,7 @@
86
86
  <div class='footer quiet pad2 space-top1 center small'>
87
87
  Code coverage generated by
88
88
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
89
- at 2022-10-23T23:52:01.796Z
89
+ at 2022-10-31T02:07:35.907Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>
@@ -1,3 +1,3 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <testsuites name="jest tests" tests="0" failures="0" errors="0" time="0.002">
2
+ <testsuites name="jest tests" tests="0" failures="0" errors="0" time="0.003">
3
3
  </testsuites>