@optable/web-sdk 0.21.4 → 0.22.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.
Files changed (75) hide show
  1. package/README.md +1 -7
  2. package/browser/dist/sdk.js +1 -1
  3. package/lib/dist/addons/paapi.d.ts +0 -1
  4. package/lib/dist/addons/paapi.js +1 -1
  5. package/lib/dist/build.json +1 -1
  6. package/lib/dist/config.d.ts +16 -5
  7. package/lib/dist/config.js +18 -3
  8. package/lib/dist/core/network.d.ts +3 -3
  9. package/lib/dist/core/network.js +14 -3
  10. package/lib/dist/core/regs/consent.d.ts +13 -0
  11. package/lib/dist/core/regs/consent.js +96 -0
  12. package/lib/dist/core/regs/gpp/cmpapi.d.ts +46 -0
  13. package/lib/dist/core/regs/gpp/cmpapi.js +1 -0
  14. package/lib/dist/core/regs/gpp/index.d.ts +2 -0
  15. package/lib/dist/core/regs/gpp/index.js +2 -0
  16. package/lib/dist/core/regs/gpp/primitives.d.ts +6 -0
  17. package/lib/dist/core/regs/gpp/primitives.js +1 -0
  18. package/lib/dist/core/regs/gpp/sections.d.ts +18 -0
  19. package/lib/dist/core/regs/gpp/sections.js +18 -0
  20. package/lib/dist/core/regs/gpp/tcfcav1.d.ts +36 -0
  21. package/lib/dist/core/regs/gpp/tcfcav1.js +3 -0
  22. package/lib/dist/core/regs/gpp/tcfeuv2.d.ts +39 -0
  23. package/lib/dist/core/regs/gpp/tcfeuv2.js +3 -0
  24. package/lib/dist/core/regs/gpp/usca.d.ts +19 -0
  25. package/lib/dist/core/regs/gpp/usca.js +3 -0
  26. package/lib/dist/core/regs/gpp/usco.d.ts +18 -0
  27. package/lib/dist/core/regs/gpp/usco.js +3 -0
  28. package/lib/dist/core/regs/gpp/usct.d.ts +18 -0
  29. package/lib/dist/core/regs/gpp/usct.js +3 -0
  30. package/lib/dist/core/regs/gpp/usde.d.ts +19 -0
  31. package/lib/dist/core/regs/gpp/usde.js +3 -0
  32. package/lib/dist/core/regs/gpp/usfl.d.ts +19 -0
  33. package/lib/dist/core/regs/gpp/usfl.js +3 -0
  34. package/lib/dist/core/regs/gpp/usia.d.ts +19 -0
  35. package/lib/dist/core/regs/gpp/usia.js +3 -0
  36. package/lib/dist/core/regs/gpp/usmt.d.ts +19 -0
  37. package/lib/dist/core/regs/gpp/usmt.js +3 -0
  38. package/lib/dist/core/regs/gpp/usnat.d.ts +23 -0
  39. package/lib/dist/core/regs/gpp/usnat.js +3 -0
  40. package/lib/dist/core/regs/gpp/usne.d.ts +19 -0
  41. package/lib/dist/core/regs/gpp/usne.js +3 -0
  42. package/lib/dist/core/regs/gpp/usnh.d.ts +19 -0
  43. package/lib/dist/core/regs/gpp/usnh.js +3 -0
  44. package/lib/dist/core/regs/gpp/usnj.d.ts +19 -0
  45. package/lib/dist/core/regs/gpp/usnj.js +3 -0
  46. package/lib/dist/core/regs/gpp/usor.d.ts +19 -0
  47. package/lib/dist/core/regs/gpp/usor.js +3 -0
  48. package/lib/dist/core/regs/gpp/ustn.d.ts +19 -0
  49. package/lib/dist/core/regs/gpp/ustn.js +3 -0
  50. package/lib/dist/core/regs/gpp/ustx.d.ts +19 -0
  51. package/lib/dist/core/regs/gpp/ustx.js +3 -0
  52. package/lib/dist/core/regs/gpp/usut.d.ts +18 -0
  53. package/lib/dist/core/regs/gpp/usut.js +3 -0
  54. package/lib/dist/core/regs/gpp/usva.d.ts +18 -0
  55. package/lib/dist/core/regs/gpp/usva.js +3 -0
  56. package/lib/dist/core/regs/regulations.d.ts +4 -0
  57. package/lib/dist/core/regs/regulations.js +67 -0
  58. package/lib/dist/core/regs/storage.d.ts +9 -0
  59. package/lib/dist/core/regs/storage.js +24 -0
  60. package/lib/dist/core/regs/tcf/cmpapi.d.ts +61 -0
  61. package/lib/dist/core/regs/tcf/cmpapi.js +1 -0
  62. package/lib/dist/core/regs/tcf/index.d.ts +1 -0
  63. package/lib/dist/core/regs/tcf/index.js +1 -0
  64. package/lib/dist/core/storage.d.ts +4 -3
  65. package/lib/dist/core/storage.js +15 -13
  66. package/lib/dist/edge/identify.d.ts +2 -2
  67. package/lib/dist/edge/profile.d.ts +2 -2
  68. package/lib/dist/edge/site.d.ts +3 -3
  69. package/lib/dist/edge/targeting.d.ts +4 -4
  70. package/lib/dist/edge/tokenize.d.ts +2 -2
  71. package/lib/dist/edge/uid2_token.d.ts +2 -2
  72. package/lib/dist/edge/witness.d.ts +2 -2
  73. package/lib/dist/sdk.d.ts +4 -4
  74. package/lib/dist/sdk.js +4 -4
  75. package/package.json +2 -2
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 17;
17
+ declare const APIPrefix = "usde";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 17;
2
+ const APIPrefix = "usde";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 13;
17
+ declare const APIPrefix = "usfl";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 13;
2
+ const APIPrefix = "usfl";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SensitiveDataOptOutNotice: number;
7
+ SaleOptOut: number;
8
+ TargetedAdvertisingOptOut: number;
9
+ SensitiveDataProcessing: number[];
10
+ KnownChildSensitiveDataConsents: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 18;
17
+ declare const APIPrefix = "usia";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 18;
2
+ const APIPrefix = "usia";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ SharingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 14;
17
+ declare const APIPrefix = "usmt";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 14;
2
+ const APIPrefix = "usmt";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,23 @@
1
+ type CoreSegment = {
2
+ Version: number;
3
+ SharingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ SharingOptOutNotice: number;
6
+ TargetedAdvertisingOptOutNotice: number;
7
+ SensitiveDataProcessingOptOutNotice: number;
8
+ SensitiveDataLimitUseNotice: number;
9
+ SaleOptOut: number;
10
+ SharingOptOut: number;
11
+ TargetedAdvertisingOptOut: number;
12
+ SensitiveDataProcessing: number[];
13
+ KnownChildSensitiveDataConsents: number[];
14
+ PersonalDataConsents: number;
15
+ MspaCoveredTransaction: number;
16
+ MspaOptOutOptionMode: number;
17
+ MspaServiceProviderMode: number;
18
+ };
19
+ declare const SectionID = 7;
20
+ declare const APIPrefix = "usnat";
21
+ type Section = Array<CoreSegment>;
22
+ export type { Section };
23
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 7;
2
+ const APIPrefix = "usnat";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 19;
17
+ declare const APIPrefix = "usne";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 19;
2
+ const APIPrefix = "usne";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 20;
17
+ declare const APIPrefix = "usnh";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 20;
2
+ const APIPrefix = "usnh";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 21;
17
+ declare const APIPrefix = "usnj";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 21;
2
+ const APIPrefix = "usnj";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 15;
17
+ declare const APIPrefix = "usor";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 15;
2
+ const APIPrefix = "usor";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 22;
17
+ declare const APIPrefix = "ustn";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 22;
2
+ const APIPrefix = "ustn";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,19 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ ProcessingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ AdditionalDataProcessingConsent: number;
11
+ MspaCoveredTransaction: number;
12
+ MspaOptOutOptionMode: number;
13
+ MspaServiceProviderMode: number;
14
+ };
15
+ type Section = Array<CoreSubsection>;
16
+ declare const SectionID = 16;
17
+ declare const APIPrefix = "ustx";
18
+ export type { Section };
19
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 16;
2
+ const APIPrefix = "ustx";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,18 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ SharingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ MspaCoveredTransaction: number;
11
+ MspaOptOutOptionMode: number;
12
+ MspaServiceProviderMode: number;
13
+ };
14
+ type Section = Array<CoreSubsection>;
15
+ declare const SectionID = 11;
16
+ declare const APIPrefix = "usut";
17
+ export type { Section };
18
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 11;
2
+ const APIPrefix = "usut";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,18 @@
1
+ type CoreSubsection = {
2
+ Version: number;
3
+ SharingNotice: number;
4
+ SaleOptOutNotice: number;
5
+ TargetedAdvertisingOptOutNotice: number;
6
+ SaleOptOut: number;
7
+ TargetedAdvertisingOptOut: number;
8
+ SensitiveDataProcessing: number[];
9
+ KnownChildSensitiveDataConsents: number;
10
+ MspaCoveredTransaction: number;
11
+ MspaOptOutOptionMode: number;
12
+ MspaServiceProviderMode: number;
13
+ };
14
+ type Section = Array<CoreSubsection>;
15
+ declare const SectionID = 9;
16
+ declare const APIPrefix = "usva";
17
+ export type { Section };
18
+ export { SectionID, APIPrefix };
@@ -0,0 +1,3 @@
1
+ const SectionID = 9;
2
+ const APIPrefix = "usva";
3
+ export { SectionID, APIPrefix };
@@ -0,0 +1,4 @@
1
+ type Regulation = "gdpr" | "us" | "can";
2
+ declare function inferRegulation(): Regulation | null;
3
+ export { inferRegulation };
4
+ export type { Regulation };
@@ -0,0 +1,67 @@
1
+ const zones = {
2
+ // EU
3
+ "Europe/Amsterdam": "gdpr",
4
+ "Europe/Athens": "gdpr",
5
+ "Europe/Berlin": "gdpr",
6
+ "Europe/Brussels": "gdpr",
7
+ "Europe/Bucharest": "gdpr",
8
+ "Europe/Budapest": "gdpr",
9
+ "Europe/Copenhagen": "gdpr",
10
+ "Europe/Dublin": "gdpr",
11
+ "Europe/Helsinki": "gdpr",
12
+ "Europe/Lisbon": "gdpr",
13
+ "Europe/London": "gdpr",
14
+ "Europe/Madrid": "gdpr",
15
+ "Europe/Oslo": "gdpr",
16
+ "Europe/Paris": "gdpr",
17
+ "Europe/Prague": "gdpr",
18
+ "Europe/Rome": "gdpr",
19
+ "Europe/Sofia": "gdpr",
20
+ "Europe/Stockholm": "gdpr",
21
+ "Europe/Vienna": "gdpr",
22
+ "Europe/Warsaw": "gdpr",
23
+ "Europe/Zurich": "gdpr",
24
+ // CA (QC only)
25
+ "America/Toronto": "can",
26
+ // US
27
+ "America/New_York": "us",
28
+ "America/Detroit": "us",
29
+ "America/Kentucky/Louisville": "us",
30
+ "America/Kentucky/Monticello": "us",
31
+ "America/Indiana/Indianapolis": "us",
32
+ "America/Indiana/Vincennes": "us",
33
+ "America/Indiana/Winamac": "us",
34
+ "America/Indiana/Marengo": "us",
35
+ "America/Indiana/Petersburg": "us",
36
+ "America/Indiana/Vevay": "us",
37
+ "America/Chicago": "us",
38
+ "America/Indiana/Tell_City": "us",
39
+ "America/Indiana/Knox": "us",
40
+ "America/Menominee": "us",
41
+ "America/North_Dakota/Center": "us",
42
+ "America/North_Dakota/New_Salem": "us",
43
+ "America/North_Dakota/Beulah": "us",
44
+ "America/Denver": "us",
45
+ "America/Boise": "us",
46
+ "America/Phoenix": "us",
47
+ "America/Los_Angeles": "us",
48
+ "America/Anchorage": "us",
49
+ "America/Juneau": "us",
50
+ "America/Sitka": "us",
51
+ "America/Metlakatla": "us",
52
+ "America/Yakutat": "us",
53
+ "America/Nome": "us",
54
+ "America/Adak": "us",
55
+ "Pacific/Honolulu": "us",
56
+ };
57
+ function inferRegulation() {
58
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
59
+ const regulation = zones[timeZone];
60
+ // Special handling, can currently only applies to quebec
61
+ if (regulation === "can") {
62
+ const inQC = ["fr", "fr-CA"].some((l) => navigator.languages.includes(l));
63
+ return inQC ? "can" : null;
64
+ }
65
+ return regulation !== null && regulation !== void 0 ? regulation : null;
66
+ }
67
+ export { inferRegulation };
@@ -0,0 +1,9 @@
1
+ import { Consent } from "./consent";
2
+ declare class LocalStorageProxy {
3
+ private consent;
4
+ constructor(consent: Consent);
5
+ getItem(key: string): string | null;
6
+ setItem(key: string, value: string): void;
7
+ removeItem(key: string): void;
8
+ }
9
+ export { LocalStorageProxy };
@@ -0,0 +1,24 @@
1
+ class LocalStorageProxy {
2
+ constructor(consent) {
3
+ this.consent = consent;
4
+ }
5
+ getItem(key) {
6
+ if (!this.consent.deviceAccess) {
7
+ return null;
8
+ }
9
+ return window.localStorage.getItem(key);
10
+ }
11
+ setItem(key, value) {
12
+ if (!this.consent.deviceAccess) {
13
+ return;
14
+ }
15
+ window.localStorage.setItem(key, value);
16
+ }
17
+ removeItem(key) {
18
+ if (!this.consent.deviceAccess) {
19
+ return;
20
+ }
21
+ window.localStorage.removeItem(key);
22
+ }
23
+ }
24
+ export { LocalStorageProxy };
@@ -0,0 +1,61 @@
1
+ declare global {
2
+ interface Window {
3
+ __tcfapi?(command: "addEventListener", version: number, cb: AddEventListenerCallback): void;
4
+ }
5
+ }
6
+ type TCData = {
7
+ tcString: string;
8
+ tcfPolicyVersion: number;
9
+ cmpId: number;
10
+ cmpVersion: number;
11
+ gdprApplies?: boolean;
12
+ eventStatus: "tcloaded" | "cmpuishown" | "useractioncomplete";
13
+ cmpStatus: "stub" | "loading" | "loaded" | "error";
14
+ listenerId?: number;
15
+ isServiceSpecific: boolean;
16
+ useNonStandardStacks: boolean;
17
+ publisherCC: string;
18
+ purposeOneTreatment: boolean;
19
+ purpose: {
20
+ consents: {
21
+ [purposeID: string]: boolean;
22
+ };
23
+ legitimateInterests: {
24
+ [purposeID: string]: boolean;
25
+ };
26
+ };
27
+ vendor: {
28
+ consents: {
29
+ [vendorID: string]: boolean;
30
+ };
31
+ legitimateInterests: {
32
+ [vendorID: string]: boolean;
33
+ };
34
+ };
35
+ specialFeatureOptins: {
36
+ [featureID: string]: boolean;
37
+ };
38
+ publisher: {
39
+ consents: {
40
+ [purposeID: string]: boolean;
41
+ };
42
+ legitimateInterests: {
43
+ [purposeID: string]: boolean;
44
+ };
45
+ customPurpose: {
46
+ consents: {
47
+ [purposeID: string]: boolean;
48
+ };
49
+ legitimateInterests: {
50
+ [purposeID: string]: boolean;
51
+ };
52
+ };
53
+ restrictions: {
54
+ [purposeID: string]: {
55
+ [vendorID: string]: 0 | 1 | 2;
56
+ };
57
+ };
58
+ };
59
+ };
60
+ type AddEventListenerCallback = (data: TCData, success: boolean) => void;
61
+ export { TCData };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * as cmpapi from "./cmpapi";
@@ -0,0 +1 @@
1
+ export * as cmpapi from "./cmpapi";
@@ -1,13 +1,14 @@
1
1
  import { SiteResponse } from "../edge/site";
2
- import type { OptableConfig } from "../config";
2
+ import type { ResolvedConfig } from "../config";
3
3
  import type { TargetingResponse } from "../edge/targeting";
4
4
  declare class LocalStorage {
5
- private Config;
5
+ private config;
6
6
  private passportKey;
7
7
  private targetingV1Key;
8
8
  private targetingKey;
9
9
  private siteKey;
10
- constructor(Config: OptableConfig);
10
+ private storage;
11
+ constructor(config: ResolvedConfig);
11
12
  getPassport(): string | null;
12
13
  getV1Targeting(): TargetingResponse | null;
13
14
  getTargeting(): TargetingResponse | null;
@@ -1,3 +1,4 @@
1
+ import { LocalStorageProxy } from "./regs/storage";
1
2
  function toBinary(str) {
2
3
  const codeUnits = new Uint16Array(str.length);
3
4
  for (let i = 0; i < codeUnits.length; i++) {
@@ -6,20 +7,21 @@ function toBinary(str) {
6
7
  return String.fromCharCode(...new Uint8Array(codeUnits.buffer));
7
8
  }
8
9
  class LocalStorage {
9
- constructor(Config) {
10
- this.Config = Config;
11
- const sfx = btoa(toBinary(`${this.Config.host}/${this.Config.site}`));
10
+ constructor(config) {
11
+ this.config = config;
12
+ const sfx = btoa(toBinary(`${this.config.host}/${this.config.site}`));
12
13
  // Legacy targeting key
13
14
  this.targetingV1Key = "OPTABLE_TGT_" + sfx;
14
15
  this.passportKey = "OPTABLE_PASS_" + sfx;
15
16
  this.targetingKey = "OPTABLE_V2_TGT_" + sfx;
16
17
  this.siteKey = "OPTABLE_SITE_" + sfx;
18
+ this.storage = new LocalStorageProxy(this.config.consent);
17
19
  }
18
20
  getPassport() {
19
- return window.localStorage.getItem(this.passportKey);
21
+ return this.storage.getItem(this.passportKey);
20
22
  }
21
23
  getV1Targeting() {
22
- const raw = window.localStorage.getItem(this.targetingV1Key);
24
+ const raw = this.storage.getItem(this.targetingV1Key);
23
25
  const parsed = raw ? JSON.parse(raw) : null;
24
26
  if (!parsed) {
25
27
  return null;
@@ -42,40 +44,40 @@ class LocalStorage {
42
44
  };
43
45
  }
44
46
  getTargeting() {
45
- const raw = window.localStorage.getItem(this.targetingKey);
47
+ const raw = this.storage.getItem(this.targetingKey);
46
48
  const parsed = raw ? JSON.parse(raw) : null;
47
49
  return parsed ? parsed : this.getV1Targeting();
48
50
  }
49
51
  setPassport(passport) {
50
52
  if (passport && passport.length > 0) {
51
- window.localStorage.setItem(this.passportKey, passport);
53
+ this.storage.setItem(this.passportKey, passport);
52
54
  }
53
55
  }
54
56
  setTargeting(targeting) {
55
57
  if (!targeting) {
56
58
  return;
57
59
  }
58
- window.localStorage.setItem(this.targetingKey, JSON.stringify(targeting));
60
+ this.storage.setItem(this.targetingKey, JSON.stringify(targeting));
59
61
  }
60
62
  setSite(site) {
61
63
  if (!site) {
62
64
  return;
63
65
  }
64
- window.localStorage.setItem(this.siteKey, JSON.stringify(site));
66
+ this.storage.setItem(this.siteKey, JSON.stringify(site));
65
67
  }
66
68
  getSite() {
67
- const raw = window.localStorage.getItem(this.siteKey);
69
+ const raw = this.storage.getItem(this.siteKey);
68
70
  const parsed = raw ? JSON.parse(raw) : null;
69
71
  return parsed;
70
72
  }
71
73
  clearPassport() {
72
- window.localStorage.removeItem(this.passportKey);
74
+ this.storage.removeItem(this.passportKey);
73
75
  }
74
76
  clearTargeting() {
75
- window.localStorage.removeItem(this.targetingKey);
77
+ this.storage.removeItem(this.targetingKey);
76
78
  }
77
79
  clearSite() {
78
- window.localStorage.removeItem(this.siteKey);
80
+ this.storage.removeItem(this.siteKey);
79
81
  }
80
82
  }
81
83
  export { LocalStorage };
@@ -1,4 +1,4 @@
1
- import type { OptableConfig } from "../config";
2
- declare function Identify(config: Required<OptableConfig>, ids: string[]): Promise<void>;
1
+ import type { ResolvedConfig } from "../config";
2
+ declare function Identify(config: ResolvedConfig, ids: string[]): Promise<void>;
3
3
  export { Identify };
4
4
  export default Identify;
@@ -1,7 +1,7 @@
1
- import type { OptableConfig } from "../config";
1
+ import type { ResolvedConfig } from "../config";
2
2
  type ProfileTraits = {
3
3
  [key: string]: string | number | boolean;
4
4
  };
5
- declare function Profile(config: Required<OptableConfig>, traits: ProfileTraits): Promise<void>;
5
+ declare function Profile(config: ResolvedConfig, traits: ProfileTraits): Promise<void>;
6
6
  export { Profile, ProfileTraits };
7
7
  export default Profile;
@@ -1,4 +1,4 @@
1
- import type { OptableConfig } from "../config";
1
+ import type { ResolvedConfig } from "../config";
2
2
  type Size = {
3
3
  width: string;
4
4
  height: string;
@@ -16,7 +16,7 @@ type SiteResponse = {
16
16
  auctionConfig?: AuctionConfig | null;
17
17
  getTopicsURL: string;
18
18
  };
19
- declare function Site(config: Required<OptableConfig>): Promise<SiteResponse>;
20
- declare function SiteFromCache(config: Required<OptableConfig>): SiteResponse | null;
19
+ declare function Site(config: ResolvedConfig): Promise<SiteResponse>;
20
+ declare function SiteFromCache(config: ResolvedConfig): SiteResponse | null;
21
21
  export { Site, SiteResponse, SiteFromCache, Size, AuctionConfig };
22
22
  export default Site;