@duckduckgo/autoconsent 10.7.0 → 10.8.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.
@@ -498,6 +498,8 @@
498
498
  },
499
499
  EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(",").filter((s) => s.length > 0).length <= 1,
500
500
  EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === "0",
501
+ EVAL_TRUSTARC_FRAME_TEST: () => window && window.QueryString && window.QueryString.preferences === "0",
502
+ EVAL_TRUSTARC_FRAME_GTM: () => window && window.QueryString && window.QueryString.gtm === "1",
501
503
  // declarative rules
502
504
  EVAL_ADROLL_0: () => !document.cookie.includes("__adroll_fpc"),
503
505
  EVAL_ALMACMP_0: () => document.cookie.includes('"name":"Google","consent":false'),
@@ -1043,7 +1045,7 @@
1043
1045
  this._optInDone = false;
1044
1046
  }
1045
1047
  get hasSelfTest() {
1046
- return false;
1048
+ return true;
1047
1049
  }
1048
1050
  get isIntermediate() {
1049
1051
  if (this._optInDone) {
@@ -1090,6 +1092,7 @@
1090
1092
  return true;
1091
1093
  }
1092
1094
  async test() {
1095
+ await this.wait(500);
1093
1096
  return await this.mainWorldEval("EVAL_TRUSTARC_TOP");
1094
1097
  }
1095
1098
  };
@@ -1106,7 +1109,7 @@
1106
1109
  };
1107
1110
  }
1108
1111
  get hasSelfTest() {
1109
- return false;
1112
+ return true;
1110
1113
  }
1111
1114
  get isIntermediate() {
1112
1115
  return false;
@@ -1142,27 +1145,34 @@
1142
1145
  );
1143
1146
  }
1144
1147
  async optOut() {
1148
+ if (await this.mainWorldEval("EVAL_TRUSTARC_FRAME_TEST")) {
1149
+ return true;
1150
+ }
1151
+ let timeout = 3e3;
1152
+ if (await this.mainWorldEval("EVAL_TRUSTARC_FRAME_GTM")) {
1153
+ timeout = 1500;
1154
+ }
1145
1155
  await waitFor(() => document.readyState === "complete", 20, 100);
1146
- await this.waitForElement(".mainContent[aria-hidden=false]", 5e3);
1156
+ await this.waitForElement(".mainContent[aria-hidden=false]", timeout);
1147
1157
  if (this.click(".rejectAll")) {
1148
1158
  return true;
1149
1159
  }
1150
1160
  if (this.elementExists(".prefPanel")) {
1151
- await this.waitForElement('.prefPanel[style="visibility: visible;"]', 3e3);
1161
+ await this.waitForElement('.prefPanel[style="visibility: visible;"]', timeout);
1152
1162
  }
1153
1163
  if (this.click("#catDetails0")) {
1154
1164
  this.click(".submit");
1155
- this.waitForThenClick("#gwt-debug-close_id", 5e3);
1165
+ this.waitForThenClick("#gwt-debug-close_id", timeout);
1156
1166
  return true;
1157
1167
  }
1158
1168
  if (this.click(".required")) {
1159
- this.waitForThenClick("#gwt-debug-close_id", 5e3);
1169
+ this.waitForThenClick("#gwt-debug-close_id", timeout);
1160
1170
  return true;
1161
1171
  }
1162
1172
  await this.navigateToSettings();
1163
1173
  this.click(".switch span:nth-child(1):not(.active)", true);
1164
1174
  this.click(".submit");
1165
- this.waitForThenClick("#gwt-debug-close_id", 3e5);
1175
+ this.waitForThenClick("#gwt-debug-close_id", timeout * 10);
1166
1176
  return true;
1167
1177
  }
1168
1178
  async optIn() {
@@ -1177,6 +1187,10 @@
1177
1187
  });
1178
1188
  return true;
1179
1189
  }
1190
+ async test() {
1191
+ await this.wait(500);
1192
+ return await this.mainWorldEval("EVAL_TRUSTARC_FRAME_TEST");
1193
+ }
1180
1194
  };
1181
1195
 
1182
1196
  // lib/cmps/cookiebot.ts
@@ -5751,7 +5765,7 @@
5751
5765
  urlPattern: "^https://www\\.instagram\\.com/"
5752
5766
  },
5753
5767
  prehideSelectors: [
5754
- ".x78zum5.xdt5ytf.xg6iff7.x1n2onr6"
5768
+ ".x78zum5.xdt5ytf.xg6iff7.x1n2onr6:has(._a9--)"
5755
5769
  ],
5756
5770
  detectCmp: [
5757
5771
  {
@@ -12,7 +12,7 @@ export default class TrustArcFrame extends AutoConsentCMPBase {
12
12
  }
13
13
 
14
14
  get hasSelfTest(): boolean {
15
- return false;
15
+ return true;
16
16
  }
17
17
 
18
18
  get isIntermediate(): boolean {
@@ -66,25 +66,37 @@ export default class TrustArcFrame extends AutoConsentCMPBase {
66
66
  }
67
67
 
68
68
  async optOut() {
69
+
70
+ // if the user has already opted out, let's not close the window
71
+ if (await this.mainWorldEval('EVAL_TRUSTARC_FRAME_TEST')){
72
+ return true;
73
+ }
74
+
75
+ //When Tags are being controlled through a tag managment system, the window will not call the vendors' opt-out
76
+ let timeout = 3000;
77
+ if (await this.mainWorldEval('EVAL_TRUSTARC_FRAME_GTM')) {
78
+ timeout = 1500;
79
+ }
80
+
69
81
  await waitFor(() => document.readyState === 'complete', 20, 100);
70
- await this.waitForElement(".mainContent[aria-hidden=false]", 5000);
82
+ await this.waitForElement(".mainContent[aria-hidden=false]", timeout);
71
83
 
72
84
  if (this.click(".rejectAll")) {
73
85
  return true;
74
86
  }
75
87
 
76
88
  if (this.elementExists('.prefPanel')) {
77
- await this.waitForElement('.prefPanel[style="visibility: visible;"]', 3000);
89
+ await this.waitForElement('.prefPanel[style="visibility: visible;"]', timeout);
78
90
  }
79
91
 
80
92
  if (this.click("#catDetails0")) {
81
93
  this.click(".submit");
82
- this.waitForThenClick("#gwt-debug-close_id", 5000);
94
+ this.waitForThenClick("#gwt-debug-close_id", timeout);
83
95
  return true;
84
96
  }
85
97
 
86
98
  if (this.click(".required")) {
87
- this.waitForThenClick("#gwt-debug-close_id", 5000);
99
+ this.waitForThenClick("#gwt-debug-close_id", timeout);
88
100
  return true;
89
101
  }
90
102
 
@@ -95,7 +107,7 @@ export default class TrustArcFrame extends AutoConsentCMPBase {
95
107
  this.click(".submit");
96
108
 
97
109
  // at this point, iframe usually closes. Sometimes we need to close manually, but we don't wait for it to report success
98
- this.waitForThenClick("#gwt-debug-close_id", 300000);
110
+ this.waitForThenClick("#gwt-debug-close_id", timeout*10);
99
111
 
100
112
  return true;
101
113
  }
@@ -116,4 +128,11 @@ export default class TrustArcFrame extends AutoConsentCMPBase {
116
128
 
117
129
  return true;
118
130
  }
131
+
132
+ async test() {
133
+ //Test JS variable to check the user's preference
134
+ //preferences = undefined means no consent is set, preferences = '0' means consent is set to required only
135
+ await this.wait(500);
136
+ return await this.mainWorldEval('EVAL_TRUSTARC_FRAME_TEST');
137
+ }
119
138
  }
@@ -31,7 +31,7 @@ export default class TrustArcTop extends AutoConsentCMPBase {
31
31
  }
32
32
 
33
33
  get hasSelfTest(): boolean {
34
- return false;
34
+ return true;
35
35
  }
36
36
 
37
37
  get isIntermediate(): boolean {
@@ -97,6 +97,7 @@ export default class TrustArcTop extends AutoConsentCMPBase {
97
97
  async test() {
98
98
  //Test JS variable to check the user's preference
99
99
  //PrefCookie = undefined means no consent is set, PrefCookie = '0' means consent is set to required only
100
+ await this.wait(500);
100
101
  return await this.mainWorldEval('EVAL_TRUSTARC_TOP');
101
102
  }
102
103
  }
@@ -49,6 +49,8 @@ export const snippets = {
49
49
  },
50
50
  EVAL_ONETRUST_1: () => window.OnetrustActiveGroups.split(',').filter(s => s.length > 0).length <= 1,
51
51
  EVAL_TRUSTARC_TOP: () => window && window.truste && window.truste.eu.bindMap.prefCookie === '0',
52
+ EVAL_TRUSTARC_FRAME_TEST: () => window && window.QueryString && window.QueryString.preferences === '0',
53
+ EVAL_TRUSTARC_FRAME_GTM: () => window && window.QueryString && window.QueryString.gtm === '1',
52
54
 
53
55
  // declarative rules
54
56
  EVAL_ADROLL_0: () => !document.cookie.includes('__adroll_fpc'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckduckgo/autoconsent",
3
- "version": "10.7.0",
3
+ "version": "10.8.0",
4
4
  "description": "",
5
5
  "main": "dist/autoconsent.cjs.js",
6
6
  "module": "dist/autoconsent.esm.js",
@@ -4,7 +4,7 @@
4
4
  "runContext": {
5
5
  "urlPattern": "^https://www\\.instagram\\.com/"
6
6
  },
7
- "prehideSelectors": [".x78zum5.xdt5ytf.xg6iff7.x1n2onr6"],
7
+ "prehideSelectors": [".x78zum5.xdt5ytf.xg6iff7.x1n2onr6:has(._a9--)"],
8
8
  "detectCmp": [
9
9
  {
10
10
  "exists": ".x1qjc9v5.x9f619.x78zum5.xdt5ytf.x1iyjqo2.xl56j7k"
package/rules/rules.json CHANGED
@@ -3376,7 +3376,7 @@
3376
3376
  "urlPattern": "^https://www\\.instagram\\.com/"
3377
3377
  },
3378
3378
  "prehideSelectors": [
3379
- ".x78zum5.xdt5ytf.xg6iff7.x1n2onr6"
3379
+ ".x78zum5.xdt5ytf.xg6iff7.x1n2onr6:has(._a9--)"
3380
3380
  ],
3381
3381
  "detectCmp": [
3382
3382
  {