whale-cmp 0.25.2 → 0.26.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/index.d.ts CHANGED
@@ -6,12 +6,29 @@ export interface OpenTouUIOptions {
6
6
  touCallback?: () => void;
7
7
  }
8
8
 
9
+ export interface OpenAgreementUIOptions {
10
+ /**
11
+ * Called after the user presses Consent or Do not consent and the page closes.
12
+ * Back and exit do not dismiss a page opened with openAgreementUI.
13
+ */
14
+ agreementCallback?: (result?: { consent: boolean }) => void;
15
+ }
16
+
17
+ export interface ConsentDataReady {
18
+ /** 0 Do not consent, 1 Consent, 2 Management options completed */
19
+ status: 0 | 1 | 2;
20
+ }
21
+
9
22
  export interface WhaleCMPOptions {
10
23
  ele?: Element;
11
24
  language?: SupportedLanguage;
12
25
  cpId?: string;
13
26
  /** @deprecated use cpId */
14
27
  cpid?: string;
28
+ /**
29
+ * Fired after Consent, Do not consent, or a completed QR management flow.
30
+ */
31
+ consentCallback?: (data: ConsentDataReady) => void;
15
32
  [key: string]: unknown;
16
33
  }
17
34
 
@@ -65,6 +82,12 @@ export declare class WhaleCMP {
65
82
  */
66
83
  openTouUI(options?: OpenTouUIOptions): void;
67
84
 
85
+ /**
86
+ * Open the personalized-ads consent page directly.
87
+ * Back and exit are ignored. Consent / Do not consent are reported through agreementCallback.
88
+ */
89
+ openAgreementUI(options?: OpenAgreementUIOptions): void;
90
+
68
91
  /**
69
92
  * Force-close TouchUI even when exit blocking is enabled.
70
93
  */
package/index.html CHANGED
@@ -20,6 +20,7 @@
20
20
  // cmp.openTouUI({touCallback: e=>{
21
21
  // console.log(e)
22
22
  // }})
23
+ // cmp.openAgreementUI({ agreementCallback: (result) => console.log(result) })
23
24
  cmp.open()
24
25
  document.addEventListener("keydown", e => {
25
26
  cmp.onKeydown(e)