@ketch-sdk/ketch-types 0.2.4 → 0.3.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,39 +29,23 @@ 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>;
@@ -69,21 +53,23 @@ export interface Ketch {
69
53
  experienceClosed(reason: string): 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
73
  fireNativeEvent(name: string, args: any): Promise<void>;
88
74
  }
89
75
  /**
@@ -906,45 +892,136 @@ export interface Stack {
906
892
  * Configuration
907
893
  */
908
894
  export interface Configuration {
909
- language?: string;
895
+ /**
896
+ * Organization this configuration belongs to
897
+ */
910
898
  organization: Organization;
899
+ /**
900
+ * Property this configuration belongs to
901
+ */
911
902
  property?: Property;
903
+ /**
904
+ * Language for all text
905
+ */
906
+ language?: string;
907
+ /**
908
+ * Available environments. Only available in the "boot" configuration.
909
+ */
912
910
  environments?: Environment[];
911
+ /**
912
+ * Environment for this configuration. Only available in the "full" configuration.
913
+ */
913
914
  environment?: Environment;
915
+ /**
916
+ * Applicable jurisdiction.
917
+ */
914
918
  jurisdiction?: JurisdictionInfo;
919
+ /**
920
+ * Identity spaces defined for this property
921
+ */
915
922
  identities?: {
916
923
  [key: string]: Identity;
917
924
  };
925
+ /**
926
+ * Deployment information. Only available in the "full" configuration.
927
+ */
918
928
  deployment?: Deployment;
929
+ /**
930
+ * Regulations enabled for this jurisdiction.
931
+ */
919
932
  regulations?: string[];
933
+ /**
934
+ * Rights available in this jurisdiction.
935
+ */
920
936
  rights?: Right[];
937
+ /**
938
+ * Purposes in this jurisdiction.
939
+ */
921
940
  purposes?: Purpose[];
941
+ /**
942
+ * Mapping of purposes to canonical purposes.
943
+ *
944
+ * @deprecated
945
+ */
922
946
  canonicalPurposes?: {
923
947
  [key: string]: CanonicalPurpose;
924
948
  };
949
+ /**
950
+ * Privacy policy document
951
+ */
952
+ privacyPolicy?: PolicyDocument;
953
+ /**
954
+ * Terms of Service (ToS) policy document
955
+ */
956
+ termsOfService?: PolicyDocument;
957
+ /**
958
+ * Theme
959
+ */
960
+ theme?: Theme;
961
+ /**
962
+ * Experience definitions
963
+ */
925
964
  experiences?: Experience;
965
+ /**
966
+ * Services
967
+ */
926
968
  services?: {
927
969
  [key: string]: string;
928
970
  };
971
+ /**
972
+ * Flexible options
973
+ */
929
974
  options?: {
930
975
  [key: string]: string;
931
976
  };
932
- privacyPolicy?: PolicyDocument;
933
- termsOfService?: PolicyDocument;
934
- theme?: Theme;
977
+ /**
978
+ * Scripts to load
979
+ */
935
980
  scripts?: string[];
981
+ /**
982
+ * Plugins configured for the configuration
983
+ */
984
+ plugins?: {
985
+ [key: string]: any;
986
+ };
987
+ /**
988
+ * Vendors (TCF)
989
+ */
936
990
  vendors?: Vendor[];
991
+ /**
992
+ * Data subject types relevant for this configuration
993
+ */
937
994
  dataSubjectTypes?: DataSubjectType[];
995
+ /**
996
+ * Stacks to be displayed in an experience
997
+ */
938
998
  stacks?: Stack[];
939
999
  }
940
- export declare type Pusher = {
1000
+ /**
1001
+ * Pusher interface defines a type that has a push function like an array
1002
+ */
1003
+ export interface Pusher {
1004
+ /**
1005
+ * Pushes the given arguments.
1006
+ *
1007
+ * @param args The arguments to push.
1008
+ */
941
1009
  push(args: any[]): void;
942
- };
943
- export declare type Loaded = {
944
- loaded?: boolean;
945
- };
1010
+ }
1011
+ /**
1012
+ * Loaded interface defines a type that has a loaded boolean property
1013
+ */
1014
+ export interface Loaded {
1015
+ /**
1016
+ * Loaded is set to true if the object has fully loaded
1017
+ */
1018
+ loaded: boolean;
1019
+ }
946
1020
  declare global {
947
1021
  interface Window {
1022
+ /**
1023
+ * Semaphore is the main entrypoint.
1024
+ */
948
1025
  semaphore: Pusher & Loaded;
949
1026
  }
950
1027
  }
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.3.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.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,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="1666666865838" clover="3.2.0">
3
+ <project timestamp="1666666865838" 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-25T03:01:05.835Z
90
90
  </div>
91
91
  <script src="prettify.js"></script>
92
92
  <script>