@blotoutio/providers-bing-sdk 1.14.0 → 1.16.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.cjs.js +398 -4
- package/index.js +398 -4
- package/index.mjs +398 -4
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2,12 +2,405 @@
|
|
|
2
2
|
|
|
3
3
|
const packageName = 'bing';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const isBool = (v) => typeof v == 'boolean';
|
|
6
|
+
const isRecord = (v) => !!v && typeof v == 'object' && !Array.isArray(v);
|
|
7
|
+
/**
|
|
8
|
+
* This function validates user consent for a given provider type, not based on tagName.
|
|
9
|
+
*/
|
|
10
|
+
const hasUserConsentForProvider = (consent, provider) => {
|
|
11
|
+
if (!isRecord(consent)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
let allowed = isBool(consent.all) ? consent.all : false;
|
|
15
|
+
if (provider in consent) {
|
|
16
|
+
const providerSpecific = consent[provider];
|
|
17
|
+
if (isBool(providerSpecific)) {
|
|
18
|
+
allowed = providerSpecific;
|
|
19
|
+
}
|
|
20
|
+
else if (isRecord(providerSpecific)) {
|
|
21
|
+
return Object.keys(providerSpecific).some((instance) => providerSpecific[instance] === true);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return allowed;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
28
|
+
if (!entry.includes('-')) {
|
|
29
|
+
return entry;
|
|
30
|
+
}
|
|
31
|
+
const result = [];
|
|
32
|
+
const [start, end] = entry.split('-').map(Number);
|
|
33
|
+
for (let i = start; i <= end; i++) {
|
|
34
|
+
result.push(i.toString());
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Exported from https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes
|
|
40
|
+
*
|
|
41
|
+
* In Dev Tools, select the `tbody` element containing the area codes and run the following code,
|
|
42
|
+
* replacing the emdash character with a simple endash:
|
|
43
|
+
*
|
|
44
|
+
* ```ts
|
|
45
|
+
* [...$0.querySelectorAll('td:first-child')]
|
|
46
|
+
* .filter(cell => cell.firstChild.nodeName != 'A')
|
|
47
|
+
* .map(cell => cell.textContent.trim()).join(',')
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
new Set([
|
|
51
|
+
...expand('200,211,221,222,230,232,233,235,237-238,241,243,244,245,247,255,257,258-259,261,265,266,271,273,274,275,277,278,280,282,283,285-287,288,290-299'),
|
|
52
|
+
...expand('300,311,322,324,327,328,333,335,338,342,344,348-349,353,355,356,357-359,362,366,369,370-379,381,382,383-384,387,388,389,390-399'),
|
|
53
|
+
...expand('400,411,420,421-422,426-427,428,429,433,439,444,446,449,451-454,455,456,457,459,460,461-462,465,466,467,471,476,477,481-483,485-486,487,488,489,490-499'),
|
|
54
|
+
...expand('511,532,535,536,537,538,542-543,545-547,549-550,552-554,555,556,558,560,565,568,569,576,578,583,589,590-599'),
|
|
55
|
+
...expand('611,621,624,625,627,632,633,634-635,637-638,642-643,644,648,652-654,655,663,665,666,668,673-676,677,679,685,686,687,688,690-699'),
|
|
56
|
+
...expand('711,722,723,729,733,735-736,739,741,744,745-746,748,749-751,752,755,756,759,761,764,766,768,776,777,783,788,789,790-799'),
|
|
57
|
+
...expand('811,821,822,823-824,827,834,836,841-842,846,851,852-853,871,874-875,879,880-887,889,890-899'),
|
|
58
|
+
...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* ISO-3166 2-leter country codes and their names
|
|
63
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
64
|
+
*/
|
|
65
|
+
const isoCountries = new Map([
|
|
66
|
+
['AD', 'Andorra'],
|
|
67
|
+
['AE', 'United Arab Emirates'],
|
|
68
|
+
['AF', 'Afghanistan'],
|
|
69
|
+
['AG', 'Antigua and Barbuda'],
|
|
70
|
+
['AI', 'Anguilla'],
|
|
71
|
+
['AL', 'Albania'],
|
|
72
|
+
['AM', 'Armenia'],
|
|
73
|
+
['AO', 'Angola'],
|
|
74
|
+
['AQ', 'Antarctica'],
|
|
75
|
+
['AR', 'Argentina'],
|
|
76
|
+
['AS', 'American Samoa'],
|
|
77
|
+
['AT', 'Austria'],
|
|
78
|
+
['AU', 'Australia'],
|
|
79
|
+
['AW', 'Aruba'],
|
|
80
|
+
['AX', 'Åland Islands'],
|
|
81
|
+
['AZ', 'Azerbaijan'],
|
|
82
|
+
['BA', 'Bosnia and Herzegovina'],
|
|
83
|
+
['BB', 'Barbados'],
|
|
84
|
+
['BD', 'Bangladesh'],
|
|
85
|
+
['BE', 'Belgium'],
|
|
86
|
+
['BF', 'Burkina Faso'],
|
|
87
|
+
['BG', 'Bulgaria'],
|
|
88
|
+
['BH', 'Bahrain'],
|
|
89
|
+
['BI', 'Burundi'],
|
|
90
|
+
['BJ', 'Benin'],
|
|
91
|
+
['BL', 'Saint Barthélemy'],
|
|
92
|
+
['BM', 'Bermuda'],
|
|
93
|
+
['BN', 'Brunei Darussalam'],
|
|
94
|
+
['BO', 'Bolivia, Plurinational State of'],
|
|
95
|
+
['BQ', 'Bonaire, Sint Eustatius and Saba'],
|
|
96
|
+
['BR', 'Brazil'],
|
|
97
|
+
['BS', 'Bahamas'],
|
|
98
|
+
['BT', 'Bhutan'],
|
|
99
|
+
['BV', 'Bouvet Island'],
|
|
100
|
+
['BW', 'Botswana'],
|
|
101
|
+
['BY', 'Belarus'],
|
|
102
|
+
['BZ', 'Belize'],
|
|
103
|
+
['CA', 'Canada'],
|
|
104
|
+
['CC', 'Cocos (Keeling) Islands'],
|
|
105
|
+
['CD', 'Congo, Democratic Republic of the'],
|
|
106
|
+
['CF', 'Central African Republic'],
|
|
107
|
+
['CG', 'Congo'],
|
|
108
|
+
['CH', 'Switzerland'],
|
|
109
|
+
['CI', "Côte d'Ivoire"],
|
|
110
|
+
['CK', 'Cook Islands'],
|
|
111
|
+
['CL', 'Chile'],
|
|
112
|
+
['CM', 'Cameroon'],
|
|
113
|
+
['CN', 'China'],
|
|
114
|
+
['CO', 'Colombia'],
|
|
115
|
+
['CR', 'Costa Rica'],
|
|
116
|
+
['CU', 'Cuba'],
|
|
117
|
+
['CV', 'Cabo Verde'],
|
|
118
|
+
['CW', 'Curaçao'],
|
|
119
|
+
['CX', 'Christmas Island'],
|
|
120
|
+
['CY', 'Cyprus'],
|
|
121
|
+
['CZ', 'Czechia'],
|
|
122
|
+
['DE', 'Germany'],
|
|
123
|
+
['DJ', 'Djibouti'],
|
|
124
|
+
['DK', 'Denmark'],
|
|
125
|
+
['DM', 'Dominica'],
|
|
126
|
+
['DO', 'Dominican Republic'],
|
|
127
|
+
['DZ', 'Algeria'],
|
|
128
|
+
['EC', 'Ecuador'],
|
|
129
|
+
['EE', 'Estonia'],
|
|
130
|
+
['EG', 'Egypt'],
|
|
131
|
+
['EH', 'Western Sahara'],
|
|
132
|
+
['ER', 'Eritrea'],
|
|
133
|
+
['ES', 'Spain'],
|
|
134
|
+
['ET', 'Ethiopia'],
|
|
135
|
+
['EU', 'European Union'],
|
|
136
|
+
['FI', 'Finland'],
|
|
137
|
+
['FJ', 'Fiji'],
|
|
138
|
+
['FK', 'Falkland Islands (Malvinas)'],
|
|
139
|
+
['FM', 'Micronesia, Federated States of'],
|
|
140
|
+
['FO', 'Faroe Islands'],
|
|
141
|
+
['FR', 'France'],
|
|
142
|
+
['GA', 'Gabon'],
|
|
143
|
+
['GB', 'United Kingdom of Great Britain and Northern Ireland'],
|
|
144
|
+
['GD', 'Grenada'],
|
|
145
|
+
['GE', 'Georgia'],
|
|
146
|
+
['GF', 'French Guiana'],
|
|
147
|
+
['GG', 'Guernsey'],
|
|
148
|
+
['GH', 'Ghana'],
|
|
149
|
+
['GI', 'Gibraltar'],
|
|
150
|
+
['GL', 'Greenland'],
|
|
151
|
+
['GM', 'Gambia'],
|
|
152
|
+
['GN', 'Guinea'],
|
|
153
|
+
['GP', 'Guadeloupe'],
|
|
154
|
+
['GQ', 'Equatorial Guinea'],
|
|
155
|
+
['GR', 'Greece'],
|
|
156
|
+
['GS', 'South Georgia and the South Sandwich Islands'],
|
|
157
|
+
['GT', 'Guatemala'],
|
|
158
|
+
['GU', 'Guam'],
|
|
159
|
+
['GW', 'Guinea-Bissau'],
|
|
160
|
+
['GY', 'Guyana'],
|
|
161
|
+
['HK', 'Hong Kong'],
|
|
162
|
+
['HM', 'Heard Island and McDonald Islands'],
|
|
163
|
+
['HN', 'Honduras'],
|
|
164
|
+
['HR', 'Croatia'],
|
|
165
|
+
['HT', 'Haiti'],
|
|
166
|
+
['HU', 'Hungary'],
|
|
167
|
+
['ID', 'Indonesia'],
|
|
168
|
+
['IE', 'Ireland'],
|
|
169
|
+
['IL', 'Israel'],
|
|
170
|
+
['IM', 'Isle of Man'],
|
|
171
|
+
['IN', 'India'],
|
|
172
|
+
['IO', 'British Indian Ocean Territory'],
|
|
173
|
+
['IQ', 'Iraq'],
|
|
174
|
+
['IR', 'Iran, Islamic Republic of'],
|
|
175
|
+
['IS', 'Iceland'],
|
|
176
|
+
['IT', 'Italy'],
|
|
177
|
+
['JE', 'Jersey'],
|
|
178
|
+
['JM', 'Jamaica'],
|
|
179
|
+
['JO', 'Jordan'],
|
|
180
|
+
['JP', 'Japan'],
|
|
181
|
+
['KE', 'Kenya'],
|
|
182
|
+
['KG', 'Kyrgyzstan'],
|
|
183
|
+
['KH', 'Cambodia'],
|
|
184
|
+
['KI', 'Kiribati'],
|
|
185
|
+
['KM', 'Comoros'],
|
|
186
|
+
['KN', 'Saint Kitts and Nevis'],
|
|
187
|
+
['KP', "Korea, Democratic People's Republic of"],
|
|
188
|
+
['KR', 'Korea, Republic of'],
|
|
189
|
+
['KW', 'Kuwait'],
|
|
190
|
+
['KY', 'Cayman Islands'],
|
|
191
|
+
['KZ', 'Kazakhstan'],
|
|
192
|
+
['LA', "Lao People's Democratic Republic"],
|
|
193
|
+
['LB', 'Lebanon'],
|
|
194
|
+
['LC', 'Saint Lucia'],
|
|
195
|
+
['LI', 'Liechtenstein'],
|
|
196
|
+
['LK', 'Sri Lanka'],
|
|
197
|
+
['LR', 'Liberia'],
|
|
198
|
+
['LS', 'Lesotho'],
|
|
199
|
+
['LT', 'Lithuania'],
|
|
200
|
+
['LU', 'Luxembourg'],
|
|
201
|
+
['LV', 'Latvia'],
|
|
202
|
+
['LY', 'Libya'],
|
|
203
|
+
['MA', 'Morocco'],
|
|
204
|
+
['MC', 'Monaco'],
|
|
205
|
+
['MD', 'Moldova, Republic of'],
|
|
206
|
+
['ME', 'Montenegro'],
|
|
207
|
+
['MF', 'Saint Martin (French part)'],
|
|
208
|
+
['MG', 'Madagascar'],
|
|
209
|
+
['MH', 'Marshall Islands'],
|
|
210
|
+
['MK', 'North Macedonia'],
|
|
211
|
+
['ML', 'Mali'],
|
|
212
|
+
['MM', 'Myanmar'],
|
|
213
|
+
['MN', 'Mongolia'],
|
|
214
|
+
['MO', 'Macao'],
|
|
215
|
+
['MP', 'Northern Mariana Islands'],
|
|
216
|
+
['MQ', 'Martinique'],
|
|
217
|
+
['MR', 'Mauritania'],
|
|
218
|
+
['MS', 'Montserrat'],
|
|
219
|
+
['MT', 'Malta'],
|
|
220
|
+
['MU', 'Mauritius'],
|
|
221
|
+
['MV', 'Maldives'],
|
|
222
|
+
['MW', 'Malawi'],
|
|
223
|
+
['MX', 'Mexico'],
|
|
224
|
+
['MY', 'Malaysia'],
|
|
225
|
+
['MZ', 'Mozambique'],
|
|
226
|
+
['NA', 'Namibia'],
|
|
227
|
+
['NC', 'New Caledonia'],
|
|
228
|
+
['NE', 'Niger'],
|
|
229
|
+
['NF', 'Norfolk Island'],
|
|
230
|
+
['NG', 'Nigeria'],
|
|
231
|
+
['NI', 'Nicaragua'],
|
|
232
|
+
['NL', 'Netherlands, Kingdom of the'],
|
|
233
|
+
['NO', 'Norway'],
|
|
234
|
+
['NP', 'Nepal'],
|
|
235
|
+
['NR', 'Nauru'],
|
|
236
|
+
['NU', 'Niue'],
|
|
237
|
+
['NZ', 'New Zealand'],
|
|
238
|
+
['OM', 'Oman'],
|
|
239
|
+
['PA', 'Panama'],
|
|
240
|
+
['PE', 'Peru'],
|
|
241
|
+
['PF', 'French Polynesia'],
|
|
242
|
+
['PG', 'Papua New Guinea'],
|
|
243
|
+
['PH', 'Philippines'],
|
|
244
|
+
['PK', 'Pakistan'],
|
|
245
|
+
['PL', 'Poland'],
|
|
246
|
+
['PM', 'Saint Pierre and Miquelon'],
|
|
247
|
+
['PN', 'Pitcairn'],
|
|
248
|
+
['PR', 'Puerto Rico'],
|
|
249
|
+
['PS', 'Palestine, State of'],
|
|
250
|
+
['PT', 'Portugal'],
|
|
251
|
+
['PW', 'Palau'],
|
|
252
|
+
['PY', 'Paraguay'],
|
|
253
|
+
['QA', 'Qatar'],
|
|
254
|
+
['RE', 'Réunion'],
|
|
255
|
+
['RO', 'Romania'],
|
|
256
|
+
['RS', 'Serbia'],
|
|
257
|
+
['RU', 'Russian Federation'],
|
|
258
|
+
['RW', 'Rwanda'],
|
|
259
|
+
['SA', 'Saudi Arabia'],
|
|
260
|
+
['SB', 'Solomon Islands'],
|
|
261
|
+
['SC', 'Seychelles'],
|
|
262
|
+
['SD', 'Sudan'],
|
|
263
|
+
['SE', 'Sweden'],
|
|
264
|
+
['SG', 'Singapore'],
|
|
265
|
+
['SH', 'Saint Helena, Ascension and Tristan da Cunha'],
|
|
266
|
+
['SI', 'Slovenia'],
|
|
267
|
+
['SJ', 'Svalbard and Jan Mayen'],
|
|
268
|
+
['SK', 'Slovakia'],
|
|
269
|
+
['SL', 'Sierra Leone'],
|
|
270
|
+
['SM', 'San Marino'],
|
|
271
|
+
['SN', 'Senegal'],
|
|
272
|
+
['SO', 'Somalia'],
|
|
273
|
+
['SR', 'Suriname'],
|
|
274
|
+
['SS', 'South Sudan'],
|
|
275
|
+
['ST', 'Sao Tome and Principe'],
|
|
276
|
+
['SV', 'El Salvador'],
|
|
277
|
+
['SX', 'Sint Maarten (Dutch part)'],
|
|
278
|
+
['SY', 'Syrian Arab Republic'],
|
|
279
|
+
['SZ', 'Eswatini'],
|
|
280
|
+
['TC', 'Turks and Caicos Islands'],
|
|
281
|
+
['TD', 'Chad'],
|
|
282
|
+
['TF', 'French Southern Territories'],
|
|
283
|
+
['TG', 'Togo'],
|
|
284
|
+
['TH', 'Thailand'],
|
|
285
|
+
['TJ', 'Tajikistan'],
|
|
286
|
+
['TK', 'Tokelau'],
|
|
287
|
+
['TL', 'Timor-Leste'],
|
|
288
|
+
['TM', 'Turkmenistan'],
|
|
289
|
+
['TN', 'Tunisia'],
|
|
290
|
+
['TO', 'Tonga'],
|
|
291
|
+
['TR', 'Türkiye'],
|
|
292
|
+
['TT', 'Trinidad and Tobago'],
|
|
293
|
+
['TV', 'Tuvalu'],
|
|
294
|
+
['TW', 'Taiwan, Province of China'],
|
|
295
|
+
['TZ', 'Tanzania, United Republic of'],
|
|
296
|
+
['UA', 'Ukraine'],
|
|
297
|
+
['UG', 'Uganda'],
|
|
298
|
+
['UK', 'United Kingdom'],
|
|
299
|
+
['UM', 'United States Minor Outlying Islands'],
|
|
300
|
+
['US', 'United States of America'],
|
|
301
|
+
['UY', 'Uruguay'],
|
|
302
|
+
['UZ', 'Uzbekistan'],
|
|
303
|
+
['VA', 'Holy See'],
|
|
304
|
+
['VC', 'Saint Vincent and the Grenadines'],
|
|
305
|
+
['VE', 'Venezuela, Bolivarian Republic of'],
|
|
306
|
+
['VG', 'Virgin Islands (British)'],
|
|
307
|
+
['VI', 'Virgin Islands (U.S.)'],
|
|
308
|
+
['VN', 'Viet Nam'],
|
|
309
|
+
['VU', 'Vanuatu'],
|
|
310
|
+
['WF', 'Wallis and Futuna'],
|
|
311
|
+
['WS', 'Samoa'],
|
|
312
|
+
['YE', 'Yemen'],
|
|
313
|
+
['YT', 'Mayotte'],
|
|
314
|
+
['ZA', 'South Africa'],
|
|
315
|
+
['ZM', 'Zambia'],
|
|
316
|
+
['ZW', 'Zimbabwe'],
|
|
317
|
+
]);
|
|
318
|
+
/**
|
|
319
|
+
* ISO-3166 US state ISO codes
|
|
320
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-2:US
|
|
321
|
+
* */
|
|
322
|
+
const usStates = new Map([
|
|
323
|
+
['US-AL', 'Alabama'],
|
|
324
|
+
['US-AK', 'Alaska'],
|
|
325
|
+
['US-AZ', 'Arizona'],
|
|
326
|
+
['US-AR', 'Arkansas'],
|
|
327
|
+
['US-CA', 'California'],
|
|
328
|
+
['US-CO', 'Colorado'],
|
|
329
|
+
['US-CT', 'Connecticut'],
|
|
330
|
+
['US-DE', 'Delaware'],
|
|
331
|
+
['US-FL', 'Florida'],
|
|
332
|
+
['US-GA', 'Georgia'],
|
|
333
|
+
['US-HI', 'Hawaii'],
|
|
334
|
+
['US-ID', 'Idaho'],
|
|
335
|
+
['US-IL', 'Illinois'],
|
|
336
|
+
['US-IN', 'Indiana'],
|
|
337
|
+
['US-IA', 'Iowa'],
|
|
338
|
+
['US-KS', 'Kansas'],
|
|
339
|
+
['US-KY', 'Kentucky'],
|
|
340
|
+
['US-LA', 'Louisiana'],
|
|
341
|
+
['US-ME', 'Maine'],
|
|
342
|
+
['US-MD', 'Maryland'],
|
|
343
|
+
['US-MA', 'Massachusetts'],
|
|
344
|
+
['US-MI', 'Michigan'],
|
|
345
|
+
['US-MN', 'Minnesota'],
|
|
346
|
+
['US-MS', 'Mississippi'],
|
|
347
|
+
['US-MO', 'Missouri'],
|
|
348
|
+
['US-MT', 'Montana'],
|
|
349
|
+
['US-NE', 'Nebraska'],
|
|
350
|
+
['US-NV', 'Nevada'],
|
|
351
|
+
['US-NH', 'New Hampshire'],
|
|
352
|
+
['US-NJ', 'New Jersey'],
|
|
353
|
+
['US-NM', 'New Mexico'],
|
|
354
|
+
['US-NY', 'New York'],
|
|
355
|
+
['US-NC', 'North Carolina'],
|
|
356
|
+
['US-ND', 'North Dakota'],
|
|
357
|
+
['US-OH', 'Ohio'],
|
|
358
|
+
['US-OK', 'Oklahoma'],
|
|
359
|
+
['US-OR', 'Oregon'],
|
|
360
|
+
['US-PA', 'Pennsylvania'],
|
|
361
|
+
['US-RI', 'Rhode Island'],
|
|
362
|
+
['US-SC', 'South Carolina'],
|
|
363
|
+
['US-SD', 'South Dakota'],
|
|
364
|
+
['US-TN', 'Tennessee'],
|
|
365
|
+
['US-TX', 'Texas'],
|
|
366
|
+
['US-UT', 'Utah'],
|
|
367
|
+
['US-VT', 'Vermont'],
|
|
368
|
+
['US-VA', 'Virginia'],
|
|
369
|
+
['US-WA', 'Washington'],
|
|
370
|
+
['US-WV', 'West Virginia'],
|
|
371
|
+
['US-WI', 'Wisconsin'],
|
|
372
|
+
['US-WY', 'Wyoming'],
|
|
373
|
+
['US-DC', 'District of Columbia'],
|
|
374
|
+
['US-AS', 'American Samoa'],
|
|
375
|
+
['US-GU', 'Guam'],
|
|
376
|
+
['US-MP', 'Northern Mariana Islands'],
|
|
377
|
+
['US-PR', 'Puerto Rico'],
|
|
378
|
+
['US-UM', 'United States Minor Outlying Islands'],
|
|
379
|
+
['US-VI', 'Virgin Islands, U.S.'],
|
|
380
|
+
]);
|
|
381
|
+
new Set([...isoCountries.keys(), ...usStates.keys()]);
|
|
382
|
+
|
|
383
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
384
|
+
const isConsentEnabled = (consent) => hasUserConsentForProvider(consent.consent, packageName);
|
|
385
|
+
const consent = ({ consentData }) => {
|
|
386
|
+
if (!(window === null || window === void 0 ? void 0 : window.edgeUET)) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
window.edgeUET.push('consent', 'update', {
|
|
390
|
+
ad_storage: isConsentEnabled(consentData) ? 'granted' : 'denied',
|
|
391
|
+
});
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
const initBing = (ID, consent) => {
|
|
6
395
|
var _a;
|
|
7
396
|
if (!window || !document || window.edgeUET) {
|
|
8
397
|
return;
|
|
9
398
|
}
|
|
10
399
|
window.edgeUET = window.edgeUET || [];
|
|
400
|
+
// Push consent data to Bing SDK
|
|
401
|
+
window.edgeUET.push('consent', 'default', {
|
|
402
|
+
ad_storage: isConsentEnabled(consent) ? 'granted' : 'denied',
|
|
403
|
+
});
|
|
11
404
|
const n = document.createElement('script');
|
|
12
405
|
n.src = '//bat.bing.com/bat.js';
|
|
13
406
|
n.async = true;
|
|
@@ -38,14 +431,14 @@ const initBing = (ID) => {
|
|
|
38
431
|
const i = document.getElementsByTagName('script')[0];
|
|
39
432
|
(_a = i.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(n, i);
|
|
40
433
|
};
|
|
41
|
-
const init = ({ manifest }) => {
|
|
434
|
+
const init = ({ manifest, consentData }) => {
|
|
42
435
|
if (!window ||
|
|
43
436
|
!manifest.variables ||
|
|
44
437
|
manifest.variables['enableBrowser'] !== '1' ||
|
|
45
438
|
!manifest.variables['tagId']) {
|
|
46
439
|
return;
|
|
47
440
|
}
|
|
48
|
-
initBing(manifest.variables['tagId']);
|
|
441
|
+
initBing(manifest.variables['tagId'], consentData);
|
|
49
442
|
};
|
|
50
443
|
|
|
51
444
|
const canLog = () => {
|
|
@@ -133,7 +526,7 @@ const handleTag = ({ data, eventName, manifestVariables, }) => {
|
|
|
133
526
|
|
|
134
527
|
const tag = ({ data, eventName, manifestVariables }) => {
|
|
135
528
|
const payload = {
|
|
136
|
-
sdkVersion: "1.
|
|
529
|
+
sdkVersion: "1.16.0" ,
|
|
137
530
|
};
|
|
138
531
|
if (window.edgeUET && manifestVariables['enableBrowser'] === '1') {
|
|
139
532
|
handleTag({ data, eventName, manifestVariables });
|
|
@@ -163,6 +556,7 @@ const data = {
|
|
|
163
556
|
init,
|
|
164
557
|
tag,
|
|
165
558
|
user,
|
|
559
|
+
consent,
|
|
166
560
|
};
|
|
167
561
|
try {
|
|
168
562
|
if (window) {
|
package/index.js
CHANGED
|
@@ -3,12 +3,405 @@ var ProvidersBingSdk = (function () {
|
|
|
3
3
|
|
|
4
4
|
const packageName = 'bing';
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const isBool = (v) => typeof v == 'boolean';
|
|
7
|
+
const isRecord = (v) => !!v && typeof v == 'object' && !Array.isArray(v);
|
|
8
|
+
/**
|
|
9
|
+
* This function validates user consent for a given provider type, not based on tagName.
|
|
10
|
+
*/
|
|
11
|
+
const hasUserConsentForProvider = (consent, provider) => {
|
|
12
|
+
if (!isRecord(consent)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
let allowed = isBool(consent.all) ? consent.all : false;
|
|
16
|
+
if (provider in consent) {
|
|
17
|
+
const providerSpecific = consent[provider];
|
|
18
|
+
if (isBool(providerSpecific)) {
|
|
19
|
+
allowed = providerSpecific;
|
|
20
|
+
}
|
|
21
|
+
else if (isRecord(providerSpecific)) {
|
|
22
|
+
return Object.keys(providerSpecific).some((instance) => providerSpecific[instance] === true);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return allowed;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
29
|
+
if (!entry.includes('-')) {
|
|
30
|
+
return entry;
|
|
31
|
+
}
|
|
32
|
+
const result = [];
|
|
33
|
+
const [start, end] = entry.split('-').map(Number);
|
|
34
|
+
for (let i = start; i <= end; i++) {
|
|
35
|
+
result.push(i.toString());
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Exported from https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes
|
|
41
|
+
*
|
|
42
|
+
* In Dev Tools, select the `tbody` element containing the area codes and run the following code,
|
|
43
|
+
* replacing the emdash character with a simple endash:
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* [...$0.querySelectorAll('td:first-child')]
|
|
47
|
+
* .filter(cell => cell.firstChild.nodeName != 'A')
|
|
48
|
+
* .map(cell => cell.textContent.trim()).join(',')
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
new Set([
|
|
52
|
+
...expand('200,211,221,222,230,232,233,235,237-238,241,243,244,245,247,255,257,258-259,261,265,266,271,273,274,275,277,278,280,282,283,285-287,288,290-299'),
|
|
53
|
+
...expand('300,311,322,324,327,328,333,335,338,342,344,348-349,353,355,356,357-359,362,366,369,370-379,381,382,383-384,387,388,389,390-399'),
|
|
54
|
+
...expand('400,411,420,421-422,426-427,428,429,433,439,444,446,449,451-454,455,456,457,459,460,461-462,465,466,467,471,476,477,481-483,485-486,487,488,489,490-499'),
|
|
55
|
+
...expand('511,532,535,536,537,538,542-543,545-547,549-550,552-554,555,556,558,560,565,568,569,576,578,583,589,590-599'),
|
|
56
|
+
...expand('611,621,624,625,627,632,633,634-635,637-638,642-643,644,648,652-654,655,663,665,666,668,673-676,677,679,685,686,687,688,690-699'),
|
|
57
|
+
...expand('711,722,723,729,733,735-736,739,741,744,745-746,748,749-751,752,755,756,759,761,764,766,768,776,777,783,788,789,790-799'),
|
|
58
|
+
...expand('811,821,822,823-824,827,834,836,841-842,846,851,852-853,871,874-875,879,880-887,889,890-899'),
|
|
59
|
+
...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
|
|
60
|
+
]);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* ISO-3166 2-leter country codes and their names
|
|
64
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
65
|
+
*/
|
|
66
|
+
const isoCountries = new Map([
|
|
67
|
+
['AD', 'Andorra'],
|
|
68
|
+
['AE', 'United Arab Emirates'],
|
|
69
|
+
['AF', 'Afghanistan'],
|
|
70
|
+
['AG', 'Antigua and Barbuda'],
|
|
71
|
+
['AI', 'Anguilla'],
|
|
72
|
+
['AL', 'Albania'],
|
|
73
|
+
['AM', 'Armenia'],
|
|
74
|
+
['AO', 'Angola'],
|
|
75
|
+
['AQ', 'Antarctica'],
|
|
76
|
+
['AR', 'Argentina'],
|
|
77
|
+
['AS', 'American Samoa'],
|
|
78
|
+
['AT', 'Austria'],
|
|
79
|
+
['AU', 'Australia'],
|
|
80
|
+
['AW', 'Aruba'],
|
|
81
|
+
['AX', 'Åland Islands'],
|
|
82
|
+
['AZ', 'Azerbaijan'],
|
|
83
|
+
['BA', 'Bosnia and Herzegovina'],
|
|
84
|
+
['BB', 'Barbados'],
|
|
85
|
+
['BD', 'Bangladesh'],
|
|
86
|
+
['BE', 'Belgium'],
|
|
87
|
+
['BF', 'Burkina Faso'],
|
|
88
|
+
['BG', 'Bulgaria'],
|
|
89
|
+
['BH', 'Bahrain'],
|
|
90
|
+
['BI', 'Burundi'],
|
|
91
|
+
['BJ', 'Benin'],
|
|
92
|
+
['BL', 'Saint Barthélemy'],
|
|
93
|
+
['BM', 'Bermuda'],
|
|
94
|
+
['BN', 'Brunei Darussalam'],
|
|
95
|
+
['BO', 'Bolivia, Plurinational State of'],
|
|
96
|
+
['BQ', 'Bonaire, Sint Eustatius and Saba'],
|
|
97
|
+
['BR', 'Brazil'],
|
|
98
|
+
['BS', 'Bahamas'],
|
|
99
|
+
['BT', 'Bhutan'],
|
|
100
|
+
['BV', 'Bouvet Island'],
|
|
101
|
+
['BW', 'Botswana'],
|
|
102
|
+
['BY', 'Belarus'],
|
|
103
|
+
['BZ', 'Belize'],
|
|
104
|
+
['CA', 'Canada'],
|
|
105
|
+
['CC', 'Cocos (Keeling) Islands'],
|
|
106
|
+
['CD', 'Congo, Democratic Republic of the'],
|
|
107
|
+
['CF', 'Central African Republic'],
|
|
108
|
+
['CG', 'Congo'],
|
|
109
|
+
['CH', 'Switzerland'],
|
|
110
|
+
['CI', "Côte d'Ivoire"],
|
|
111
|
+
['CK', 'Cook Islands'],
|
|
112
|
+
['CL', 'Chile'],
|
|
113
|
+
['CM', 'Cameroon'],
|
|
114
|
+
['CN', 'China'],
|
|
115
|
+
['CO', 'Colombia'],
|
|
116
|
+
['CR', 'Costa Rica'],
|
|
117
|
+
['CU', 'Cuba'],
|
|
118
|
+
['CV', 'Cabo Verde'],
|
|
119
|
+
['CW', 'Curaçao'],
|
|
120
|
+
['CX', 'Christmas Island'],
|
|
121
|
+
['CY', 'Cyprus'],
|
|
122
|
+
['CZ', 'Czechia'],
|
|
123
|
+
['DE', 'Germany'],
|
|
124
|
+
['DJ', 'Djibouti'],
|
|
125
|
+
['DK', 'Denmark'],
|
|
126
|
+
['DM', 'Dominica'],
|
|
127
|
+
['DO', 'Dominican Republic'],
|
|
128
|
+
['DZ', 'Algeria'],
|
|
129
|
+
['EC', 'Ecuador'],
|
|
130
|
+
['EE', 'Estonia'],
|
|
131
|
+
['EG', 'Egypt'],
|
|
132
|
+
['EH', 'Western Sahara'],
|
|
133
|
+
['ER', 'Eritrea'],
|
|
134
|
+
['ES', 'Spain'],
|
|
135
|
+
['ET', 'Ethiopia'],
|
|
136
|
+
['EU', 'European Union'],
|
|
137
|
+
['FI', 'Finland'],
|
|
138
|
+
['FJ', 'Fiji'],
|
|
139
|
+
['FK', 'Falkland Islands (Malvinas)'],
|
|
140
|
+
['FM', 'Micronesia, Federated States of'],
|
|
141
|
+
['FO', 'Faroe Islands'],
|
|
142
|
+
['FR', 'France'],
|
|
143
|
+
['GA', 'Gabon'],
|
|
144
|
+
['GB', 'United Kingdom of Great Britain and Northern Ireland'],
|
|
145
|
+
['GD', 'Grenada'],
|
|
146
|
+
['GE', 'Georgia'],
|
|
147
|
+
['GF', 'French Guiana'],
|
|
148
|
+
['GG', 'Guernsey'],
|
|
149
|
+
['GH', 'Ghana'],
|
|
150
|
+
['GI', 'Gibraltar'],
|
|
151
|
+
['GL', 'Greenland'],
|
|
152
|
+
['GM', 'Gambia'],
|
|
153
|
+
['GN', 'Guinea'],
|
|
154
|
+
['GP', 'Guadeloupe'],
|
|
155
|
+
['GQ', 'Equatorial Guinea'],
|
|
156
|
+
['GR', 'Greece'],
|
|
157
|
+
['GS', 'South Georgia and the South Sandwich Islands'],
|
|
158
|
+
['GT', 'Guatemala'],
|
|
159
|
+
['GU', 'Guam'],
|
|
160
|
+
['GW', 'Guinea-Bissau'],
|
|
161
|
+
['GY', 'Guyana'],
|
|
162
|
+
['HK', 'Hong Kong'],
|
|
163
|
+
['HM', 'Heard Island and McDonald Islands'],
|
|
164
|
+
['HN', 'Honduras'],
|
|
165
|
+
['HR', 'Croatia'],
|
|
166
|
+
['HT', 'Haiti'],
|
|
167
|
+
['HU', 'Hungary'],
|
|
168
|
+
['ID', 'Indonesia'],
|
|
169
|
+
['IE', 'Ireland'],
|
|
170
|
+
['IL', 'Israel'],
|
|
171
|
+
['IM', 'Isle of Man'],
|
|
172
|
+
['IN', 'India'],
|
|
173
|
+
['IO', 'British Indian Ocean Territory'],
|
|
174
|
+
['IQ', 'Iraq'],
|
|
175
|
+
['IR', 'Iran, Islamic Republic of'],
|
|
176
|
+
['IS', 'Iceland'],
|
|
177
|
+
['IT', 'Italy'],
|
|
178
|
+
['JE', 'Jersey'],
|
|
179
|
+
['JM', 'Jamaica'],
|
|
180
|
+
['JO', 'Jordan'],
|
|
181
|
+
['JP', 'Japan'],
|
|
182
|
+
['KE', 'Kenya'],
|
|
183
|
+
['KG', 'Kyrgyzstan'],
|
|
184
|
+
['KH', 'Cambodia'],
|
|
185
|
+
['KI', 'Kiribati'],
|
|
186
|
+
['KM', 'Comoros'],
|
|
187
|
+
['KN', 'Saint Kitts and Nevis'],
|
|
188
|
+
['KP', "Korea, Democratic People's Republic of"],
|
|
189
|
+
['KR', 'Korea, Republic of'],
|
|
190
|
+
['KW', 'Kuwait'],
|
|
191
|
+
['KY', 'Cayman Islands'],
|
|
192
|
+
['KZ', 'Kazakhstan'],
|
|
193
|
+
['LA', "Lao People's Democratic Republic"],
|
|
194
|
+
['LB', 'Lebanon'],
|
|
195
|
+
['LC', 'Saint Lucia'],
|
|
196
|
+
['LI', 'Liechtenstein'],
|
|
197
|
+
['LK', 'Sri Lanka'],
|
|
198
|
+
['LR', 'Liberia'],
|
|
199
|
+
['LS', 'Lesotho'],
|
|
200
|
+
['LT', 'Lithuania'],
|
|
201
|
+
['LU', 'Luxembourg'],
|
|
202
|
+
['LV', 'Latvia'],
|
|
203
|
+
['LY', 'Libya'],
|
|
204
|
+
['MA', 'Morocco'],
|
|
205
|
+
['MC', 'Monaco'],
|
|
206
|
+
['MD', 'Moldova, Republic of'],
|
|
207
|
+
['ME', 'Montenegro'],
|
|
208
|
+
['MF', 'Saint Martin (French part)'],
|
|
209
|
+
['MG', 'Madagascar'],
|
|
210
|
+
['MH', 'Marshall Islands'],
|
|
211
|
+
['MK', 'North Macedonia'],
|
|
212
|
+
['ML', 'Mali'],
|
|
213
|
+
['MM', 'Myanmar'],
|
|
214
|
+
['MN', 'Mongolia'],
|
|
215
|
+
['MO', 'Macao'],
|
|
216
|
+
['MP', 'Northern Mariana Islands'],
|
|
217
|
+
['MQ', 'Martinique'],
|
|
218
|
+
['MR', 'Mauritania'],
|
|
219
|
+
['MS', 'Montserrat'],
|
|
220
|
+
['MT', 'Malta'],
|
|
221
|
+
['MU', 'Mauritius'],
|
|
222
|
+
['MV', 'Maldives'],
|
|
223
|
+
['MW', 'Malawi'],
|
|
224
|
+
['MX', 'Mexico'],
|
|
225
|
+
['MY', 'Malaysia'],
|
|
226
|
+
['MZ', 'Mozambique'],
|
|
227
|
+
['NA', 'Namibia'],
|
|
228
|
+
['NC', 'New Caledonia'],
|
|
229
|
+
['NE', 'Niger'],
|
|
230
|
+
['NF', 'Norfolk Island'],
|
|
231
|
+
['NG', 'Nigeria'],
|
|
232
|
+
['NI', 'Nicaragua'],
|
|
233
|
+
['NL', 'Netherlands, Kingdom of the'],
|
|
234
|
+
['NO', 'Norway'],
|
|
235
|
+
['NP', 'Nepal'],
|
|
236
|
+
['NR', 'Nauru'],
|
|
237
|
+
['NU', 'Niue'],
|
|
238
|
+
['NZ', 'New Zealand'],
|
|
239
|
+
['OM', 'Oman'],
|
|
240
|
+
['PA', 'Panama'],
|
|
241
|
+
['PE', 'Peru'],
|
|
242
|
+
['PF', 'French Polynesia'],
|
|
243
|
+
['PG', 'Papua New Guinea'],
|
|
244
|
+
['PH', 'Philippines'],
|
|
245
|
+
['PK', 'Pakistan'],
|
|
246
|
+
['PL', 'Poland'],
|
|
247
|
+
['PM', 'Saint Pierre and Miquelon'],
|
|
248
|
+
['PN', 'Pitcairn'],
|
|
249
|
+
['PR', 'Puerto Rico'],
|
|
250
|
+
['PS', 'Palestine, State of'],
|
|
251
|
+
['PT', 'Portugal'],
|
|
252
|
+
['PW', 'Palau'],
|
|
253
|
+
['PY', 'Paraguay'],
|
|
254
|
+
['QA', 'Qatar'],
|
|
255
|
+
['RE', 'Réunion'],
|
|
256
|
+
['RO', 'Romania'],
|
|
257
|
+
['RS', 'Serbia'],
|
|
258
|
+
['RU', 'Russian Federation'],
|
|
259
|
+
['RW', 'Rwanda'],
|
|
260
|
+
['SA', 'Saudi Arabia'],
|
|
261
|
+
['SB', 'Solomon Islands'],
|
|
262
|
+
['SC', 'Seychelles'],
|
|
263
|
+
['SD', 'Sudan'],
|
|
264
|
+
['SE', 'Sweden'],
|
|
265
|
+
['SG', 'Singapore'],
|
|
266
|
+
['SH', 'Saint Helena, Ascension and Tristan da Cunha'],
|
|
267
|
+
['SI', 'Slovenia'],
|
|
268
|
+
['SJ', 'Svalbard and Jan Mayen'],
|
|
269
|
+
['SK', 'Slovakia'],
|
|
270
|
+
['SL', 'Sierra Leone'],
|
|
271
|
+
['SM', 'San Marino'],
|
|
272
|
+
['SN', 'Senegal'],
|
|
273
|
+
['SO', 'Somalia'],
|
|
274
|
+
['SR', 'Suriname'],
|
|
275
|
+
['SS', 'South Sudan'],
|
|
276
|
+
['ST', 'Sao Tome and Principe'],
|
|
277
|
+
['SV', 'El Salvador'],
|
|
278
|
+
['SX', 'Sint Maarten (Dutch part)'],
|
|
279
|
+
['SY', 'Syrian Arab Republic'],
|
|
280
|
+
['SZ', 'Eswatini'],
|
|
281
|
+
['TC', 'Turks and Caicos Islands'],
|
|
282
|
+
['TD', 'Chad'],
|
|
283
|
+
['TF', 'French Southern Territories'],
|
|
284
|
+
['TG', 'Togo'],
|
|
285
|
+
['TH', 'Thailand'],
|
|
286
|
+
['TJ', 'Tajikistan'],
|
|
287
|
+
['TK', 'Tokelau'],
|
|
288
|
+
['TL', 'Timor-Leste'],
|
|
289
|
+
['TM', 'Turkmenistan'],
|
|
290
|
+
['TN', 'Tunisia'],
|
|
291
|
+
['TO', 'Tonga'],
|
|
292
|
+
['TR', 'Türkiye'],
|
|
293
|
+
['TT', 'Trinidad and Tobago'],
|
|
294
|
+
['TV', 'Tuvalu'],
|
|
295
|
+
['TW', 'Taiwan, Province of China'],
|
|
296
|
+
['TZ', 'Tanzania, United Republic of'],
|
|
297
|
+
['UA', 'Ukraine'],
|
|
298
|
+
['UG', 'Uganda'],
|
|
299
|
+
['UK', 'United Kingdom'],
|
|
300
|
+
['UM', 'United States Minor Outlying Islands'],
|
|
301
|
+
['US', 'United States of America'],
|
|
302
|
+
['UY', 'Uruguay'],
|
|
303
|
+
['UZ', 'Uzbekistan'],
|
|
304
|
+
['VA', 'Holy See'],
|
|
305
|
+
['VC', 'Saint Vincent and the Grenadines'],
|
|
306
|
+
['VE', 'Venezuela, Bolivarian Republic of'],
|
|
307
|
+
['VG', 'Virgin Islands (British)'],
|
|
308
|
+
['VI', 'Virgin Islands (U.S.)'],
|
|
309
|
+
['VN', 'Viet Nam'],
|
|
310
|
+
['VU', 'Vanuatu'],
|
|
311
|
+
['WF', 'Wallis and Futuna'],
|
|
312
|
+
['WS', 'Samoa'],
|
|
313
|
+
['YE', 'Yemen'],
|
|
314
|
+
['YT', 'Mayotte'],
|
|
315
|
+
['ZA', 'South Africa'],
|
|
316
|
+
['ZM', 'Zambia'],
|
|
317
|
+
['ZW', 'Zimbabwe'],
|
|
318
|
+
]);
|
|
319
|
+
/**
|
|
320
|
+
* ISO-3166 US state ISO codes
|
|
321
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-2:US
|
|
322
|
+
* */
|
|
323
|
+
const usStates = new Map([
|
|
324
|
+
['US-AL', 'Alabama'],
|
|
325
|
+
['US-AK', 'Alaska'],
|
|
326
|
+
['US-AZ', 'Arizona'],
|
|
327
|
+
['US-AR', 'Arkansas'],
|
|
328
|
+
['US-CA', 'California'],
|
|
329
|
+
['US-CO', 'Colorado'],
|
|
330
|
+
['US-CT', 'Connecticut'],
|
|
331
|
+
['US-DE', 'Delaware'],
|
|
332
|
+
['US-FL', 'Florida'],
|
|
333
|
+
['US-GA', 'Georgia'],
|
|
334
|
+
['US-HI', 'Hawaii'],
|
|
335
|
+
['US-ID', 'Idaho'],
|
|
336
|
+
['US-IL', 'Illinois'],
|
|
337
|
+
['US-IN', 'Indiana'],
|
|
338
|
+
['US-IA', 'Iowa'],
|
|
339
|
+
['US-KS', 'Kansas'],
|
|
340
|
+
['US-KY', 'Kentucky'],
|
|
341
|
+
['US-LA', 'Louisiana'],
|
|
342
|
+
['US-ME', 'Maine'],
|
|
343
|
+
['US-MD', 'Maryland'],
|
|
344
|
+
['US-MA', 'Massachusetts'],
|
|
345
|
+
['US-MI', 'Michigan'],
|
|
346
|
+
['US-MN', 'Minnesota'],
|
|
347
|
+
['US-MS', 'Mississippi'],
|
|
348
|
+
['US-MO', 'Missouri'],
|
|
349
|
+
['US-MT', 'Montana'],
|
|
350
|
+
['US-NE', 'Nebraska'],
|
|
351
|
+
['US-NV', 'Nevada'],
|
|
352
|
+
['US-NH', 'New Hampshire'],
|
|
353
|
+
['US-NJ', 'New Jersey'],
|
|
354
|
+
['US-NM', 'New Mexico'],
|
|
355
|
+
['US-NY', 'New York'],
|
|
356
|
+
['US-NC', 'North Carolina'],
|
|
357
|
+
['US-ND', 'North Dakota'],
|
|
358
|
+
['US-OH', 'Ohio'],
|
|
359
|
+
['US-OK', 'Oklahoma'],
|
|
360
|
+
['US-OR', 'Oregon'],
|
|
361
|
+
['US-PA', 'Pennsylvania'],
|
|
362
|
+
['US-RI', 'Rhode Island'],
|
|
363
|
+
['US-SC', 'South Carolina'],
|
|
364
|
+
['US-SD', 'South Dakota'],
|
|
365
|
+
['US-TN', 'Tennessee'],
|
|
366
|
+
['US-TX', 'Texas'],
|
|
367
|
+
['US-UT', 'Utah'],
|
|
368
|
+
['US-VT', 'Vermont'],
|
|
369
|
+
['US-VA', 'Virginia'],
|
|
370
|
+
['US-WA', 'Washington'],
|
|
371
|
+
['US-WV', 'West Virginia'],
|
|
372
|
+
['US-WI', 'Wisconsin'],
|
|
373
|
+
['US-WY', 'Wyoming'],
|
|
374
|
+
['US-DC', 'District of Columbia'],
|
|
375
|
+
['US-AS', 'American Samoa'],
|
|
376
|
+
['US-GU', 'Guam'],
|
|
377
|
+
['US-MP', 'Northern Mariana Islands'],
|
|
378
|
+
['US-PR', 'Puerto Rico'],
|
|
379
|
+
['US-UM', 'United States Minor Outlying Islands'],
|
|
380
|
+
['US-VI', 'Virgin Islands, U.S.'],
|
|
381
|
+
]);
|
|
382
|
+
new Set([...isoCountries.keys(), ...usStates.keys()]);
|
|
383
|
+
|
|
384
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
385
|
+
const isConsentEnabled = (consent) => hasUserConsentForProvider(consent.consent, packageName);
|
|
386
|
+
const consent = ({ consentData }) => {
|
|
387
|
+
if (!(window === null || window === void 0 ? void 0 : window.edgeUET)) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
window.edgeUET.push('consent', 'update', {
|
|
391
|
+
ad_storage: isConsentEnabled(consentData) ? 'granted' : 'denied',
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
const initBing = (ID, consent) => {
|
|
7
396
|
var _a;
|
|
8
397
|
if (!window || !document || window.edgeUET) {
|
|
9
398
|
return;
|
|
10
399
|
}
|
|
11
400
|
window.edgeUET = window.edgeUET || [];
|
|
401
|
+
// Push consent data to Bing SDK
|
|
402
|
+
window.edgeUET.push('consent', 'default', {
|
|
403
|
+
ad_storage: isConsentEnabled(consent) ? 'granted' : 'denied',
|
|
404
|
+
});
|
|
12
405
|
const n = document.createElement('script');
|
|
13
406
|
n.src = '//bat.bing.com/bat.js';
|
|
14
407
|
n.async = true;
|
|
@@ -39,14 +432,14 @@ var ProvidersBingSdk = (function () {
|
|
|
39
432
|
const i = document.getElementsByTagName('script')[0];
|
|
40
433
|
(_a = i.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(n, i);
|
|
41
434
|
};
|
|
42
|
-
const init = ({ manifest }) => {
|
|
435
|
+
const init = ({ manifest, consentData }) => {
|
|
43
436
|
if (!window ||
|
|
44
437
|
!manifest.variables ||
|
|
45
438
|
manifest.variables['enableBrowser'] !== '1' ||
|
|
46
439
|
!manifest.variables['tagId']) {
|
|
47
440
|
return;
|
|
48
441
|
}
|
|
49
|
-
initBing(manifest.variables['tagId']);
|
|
442
|
+
initBing(manifest.variables['tagId'], consentData);
|
|
50
443
|
};
|
|
51
444
|
|
|
52
445
|
const canLog = () => {
|
|
@@ -134,7 +527,7 @@ var ProvidersBingSdk = (function () {
|
|
|
134
527
|
|
|
135
528
|
const tag = ({ data, eventName, manifestVariables }) => {
|
|
136
529
|
const payload = {
|
|
137
|
-
sdkVersion: "1.
|
|
530
|
+
sdkVersion: "1.16.0" ,
|
|
138
531
|
};
|
|
139
532
|
if (window.edgeUET && manifestVariables['enableBrowser'] === '1') {
|
|
140
533
|
handleTag({ data, eventName, manifestVariables });
|
|
@@ -164,6 +557,7 @@ var ProvidersBingSdk = (function () {
|
|
|
164
557
|
init,
|
|
165
558
|
tag,
|
|
166
559
|
user,
|
|
560
|
+
consent,
|
|
167
561
|
};
|
|
168
562
|
try {
|
|
169
563
|
if (window) {
|
package/index.mjs
CHANGED
|
@@ -1,11 +1,404 @@
|
|
|
1
1
|
const packageName = 'bing';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const isBool = (v) => typeof v == 'boolean';
|
|
4
|
+
const isRecord = (v) => !!v && typeof v == 'object' && !Array.isArray(v);
|
|
5
|
+
/**
|
|
6
|
+
* This function validates user consent for a given provider type, not based on tagName.
|
|
7
|
+
*/
|
|
8
|
+
const hasUserConsentForProvider = (consent, provider) => {
|
|
9
|
+
if (!isRecord(consent)) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
let allowed = isBool(consent.all) ? consent.all : false;
|
|
13
|
+
if (provider in consent) {
|
|
14
|
+
const providerSpecific = consent[provider];
|
|
15
|
+
if (isBool(providerSpecific)) {
|
|
16
|
+
allowed = providerSpecific;
|
|
17
|
+
}
|
|
18
|
+
else if (isRecord(providerSpecific)) {
|
|
19
|
+
return Object.keys(providerSpecific).some((instance) => providerSpecific[instance] === true);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return allowed;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const expand = (str) => str.split(',').flatMap((entry) => {
|
|
26
|
+
if (!entry.includes('-')) {
|
|
27
|
+
return entry;
|
|
28
|
+
}
|
|
29
|
+
const result = [];
|
|
30
|
+
const [start, end] = entry.split('-').map(Number);
|
|
31
|
+
for (let i = start; i <= end; i++) {
|
|
32
|
+
result.push(i.toString());
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* Exported from https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes
|
|
38
|
+
*
|
|
39
|
+
* In Dev Tools, select the `tbody` element containing the area codes and run the following code,
|
|
40
|
+
* replacing the emdash character with a simple endash:
|
|
41
|
+
*
|
|
42
|
+
* ```ts
|
|
43
|
+
* [...$0.querySelectorAll('td:first-child')]
|
|
44
|
+
* .filter(cell => cell.firstChild.nodeName != 'A')
|
|
45
|
+
* .map(cell => cell.textContent.trim()).join(',')
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
new Set([
|
|
49
|
+
...expand('200,211,221,222,230,232,233,235,237-238,241,243,244,245,247,255,257,258-259,261,265,266,271,273,274,275,277,278,280,282,283,285-287,288,290-299'),
|
|
50
|
+
...expand('300,311,322,324,327,328,333,335,338,342,344,348-349,353,355,356,357-359,362,366,369,370-379,381,382,383-384,387,388,389,390-399'),
|
|
51
|
+
...expand('400,411,420,421-422,426-427,428,429,433,439,444,446,449,451-454,455,456,457,459,460,461-462,465,466,467,471,476,477,481-483,485-486,487,488,489,490-499'),
|
|
52
|
+
...expand('511,532,535,536,537,538,542-543,545-547,549-550,552-554,555,556,558,560,565,568,569,576,578,583,589,590-599'),
|
|
53
|
+
...expand('611,621,624,625,627,632,633,634-635,637-638,642-643,644,648,652-654,655,663,665,666,668,673-676,677,679,685,686,687,688,690-699'),
|
|
54
|
+
...expand('711,722,723,729,733,735-736,739,741,744,745-746,748,749-751,752,755,756,759,761,764,766,768,776,777,783,788,789,790-799'),
|
|
55
|
+
...expand('811,821,822,823-824,827,834,836,841-842,846,851,852-853,871,874-875,879,880-887,889,890-899'),
|
|
56
|
+
...expand('911,921,922,923,924,926,927,932,933,935,942,944,946,950,953,955,957-958,960-969,974,975,976,977,981-982,987,988,990-999'),
|
|
57
|
+
]);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* ISO-3166 2-leter country codes and their names
|
|
61
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
|
62
|
+
*/
|
|
63
|
+
const isoCountries = new Map([
|
|
64
|
+
['AD', 'Andorra'],
|
|
65
|
+
['AE', 'United Arab Emirates'],
|
|
66
|
+
['AF', 'Afghanistan'],
|
|
67
|
+
['AG', 'Antigua and Barbuda'],
|
|
68
|
+
['AI', 'Anguilla'],
|
|
69
|
+
['AL', 'Albania'],
|
|
70
|
+
['AM', 'Armenia'],
|
|
71
|
+
['AO', 'Angola'],
|
|
72
|
+
['AQ', 'Antarctica'],
|
|
73
|
+
['AR', 'Argentina'],
|
|
74
|
+
['AS', 'American Samoa'],
|
|
75
|
+
['AT', 'Austria'],
|
|
76
|
+
['AU', 'Australia'],
|
|
77
|
+
['AW', 'Aruba'],
|
|
78
|
+
['AX', 'Åland Islands'],
|
|
79
|
+
['AZ', 'Azerbaijan'],
|
|
80
|
+
['BA', 'Bosnia and Herzegovina'],
|
|
81
|
+
['BB', 'Barbados'],
|
|
82
|
+
['BD', 'Bangladesh'],
|
|
83
|
+
['BE', 'Belgium'],
|
|
84
|
+
['BF', 'Burkina Faso'],
|
|
85
|
+
['BG', 'Bulgaria'],
|
|
86
|
+
['BH', 'Bahrain'],
|
|
87
|
+
['BI', 'Burundi'],
|
|
88
|
+
['BJ', 'Benin'],
|
|
89
|
+
['BL', 'Saint Barthélemy'],
|
|
90
|
+
['BM', 'Bermuda'],
|
|
91
|
+
['BN', 'Brunei Darussalam'],
|
|
92
|
+
['BO', 'Bolivia, Plurinational State of'],
|
|
93
|
+
['BQ', 'Bonaire, Sint Eustatius and Saba'],
|
|
94
|
+
['BR', 'Brazil'],
|
|
95
|
+
['BS', 'Bahamas'],
|
|
96
|
+
['BT', 'Bhutan'],
|
|
97
|
+
['BV', 'Bouvet Island'],
|
|
98
|
+
['BW', 'Botswana'],
|
|
99
|
+
['BY', 'Belarus'],
|
|
100
|
+
['BZ', 'Belize'],
|
|
101
|
+
['CA', 'Canada'],
|
|
102
|
+
['CC', 'Cocos (Keeling) Islands'],
|
|
103
|
+
['CD', 'Congo, Democratic Republic of the'],
|
|
104
|
+
['CF', 'Central African Republic'],
|
|
105
|
+
['CG', 'Congo'],
|
|
106
|
+
['CH', 'Switzerland'],
|
|
107
|
+
['CI', "Côte d'Ivoire"],
|
|
108
|
+
['CK', 'Cook Islands'],
|
|
109
|
+
['CL', 'Chile'],
|
|
110
|
+
['CM', 'Cameroon'],
|
|
111
|
+
['CN', 'China'],
|
|
112
|
+
['CO', 'Colombia'],
|
|
113
|
+
['CR', 'Costa Rica'],
|
|
114
|
+
['CU', 'Cuba'],
|
|
115
|
+
['CV', 'Cabo Verde'],
|
|
116
|
+
['CW', 'Curaçao'],
|
|
117
|
+
['CX', 'Christmas Island'],
|
|
118
|
+
['CY', 'Cyprus'],
|
|
119
|
+
['CZ', 'Czechia'],
|
|
120
|
+
['DE', 'Germany'],
|
|
121
|
+
['DJ', 'Djibouti'],
|
|
122
|
+
['DK', 'Denmark'],
|
|
123
|
+
['DM', 'Dominica'],
|
|
124
|
+
['DO', 'Dominican Republic'],
|
|
125
|
+
['DZ', 'Algeria'],
|
|
126
|
+
['EC', 'Ecuador'],
|
|
127
|
+
['EE', 'Estonia'],
|
|
128
|
+
['EG', 'Egypt'],
|
|
129
|
+
['EH', 'Western Sahara'],
|
|
130
|
+
['ER', 'Eritrea'],
|
|
131
|
+
['ES', 'Spain'],
|
|
132
|
+
['ET', 'Ethiopia'],
|
|
133
|
+
['EU', 'European Union'],
|
|
134
|
+
['FI', 'Finland'],
|
|
135
|
+
['FJ', 'Fiji'],
|
|
136
|
+
['FK', 'Falkland Islands (Malvinas)'],
|
|
137
|
+
['FM', 'Micronesia, Federated States of'],
|
|
138
|
+
['FO', 'Faroe Islands'],
|
|
139
|
+
['FR', 'France'],
|
|
140
|
+
['GA', 'Gabon'],
|
|
141
|
+
['GB', 'United Kingdom of Great Britain and Northern Ireland'],
|
|
142
|
+
['GD', 'Grenada'],
|
|
143
|
+
['GE', 'Georgia'],
|
|
144
|
+
['GF', 'French Guiana'],
|
|
145
|
+
['GG', 'Guernsey'],
|
|
146
|
+
['GH', 'Ghana'],
|
|
147
|
+
['GI', 'Gibraltar'],
|
|
148
|
+
['GL', 'Greenland'],
|
|
149
|
+
['GM', 'Gambia'],
|
|
150
|
+
['GN', 'Guinea'],
|
|
151
|
+
['GP', 'Guadeloupe'],
|
|
152
|
+
['GQ', 'Equatorial Guinea'],
|
|
153
|
+
['GR', 'Greece'],
|
|
154
|
+
['GS', 'South Georgia and the South Sandwich Islands'],
|
|
155
|
+
['GT', 'Guatemala'],
|
|
156
|
+
['GU', 'Guam'],
|
|
157
|
+
['GW', 'Guinea-Bissau'],
|
|
158
|
+
['GY', 'Guyana'],
|
|
159
|
+
['HK', 'Hong Kong'],
|
|
160
|
+
['HM', 'Heard Island and McDonald Islands'],
|
|
161
|
+
['HN', 'Honduras'],
|
|
162
|
+
['HR', 'Croatia'],
|
|
163
|
+
['HT', 'Haiti'],
|
|
164
|
+
['HU', 'Hungary'],
|
|
165
|
+
['ID', 'Indonesia'],
|
|
166
|
+
['IE', 'Ireland'],
|
|
167
|
+
['IL', 'Israel'],
|
|
168
|
+
['IM', 'Isle of Man'],
|
|
169
|
+
['IN', 'India'],
|
|
170
|
+
['IO', 'British Indian Ocean Territory'],
|
|
171
|
+
['IQ', 'Iraq'],
|
|
172
|
+
['IR', 'Iran, Islamic Republic of'],
|
|
173
|
+
['IS', 'Iceland'],
|
|
174
|
+
['IT', 'Italy'],
|
|
175
|
+
['JE', 'Jersey'],
|
|
176
|
+
['JM', 'Jamaica'],
|
|
177
|
+
['JO', 'Jordan'],
|
|
178
|
+
['JP', 'Japan'],
|
|
179
|
+
['KE', 'Kenya'],
|
|
180
|
+
['KG', 'Kyrgyzstan'],
|
|
181
|
+
['KH', 'Cambodia'],
|
|
182
|
+
['KI', 'Kiribati'],
|
|
183
|
+
['KM', 'Comoros'],
|
|
184
|
+
['KN', 'Saint Kitts and Nevis'],
|
|
185
|
+
['KP', "Korea, Democratic People's Republic of"],
|
|
186
|
+
['KR', 'Korea, Republic of'],
|
|
187
|
+
['KW', 'Kuwait'],
|
|
188
|
+
['KY', 'Cayman Islands'],
|
|
189
|
+
['KZ', 'Kazakhstan'],
|
|
190
|
+
['LA', "Lao People's Democratic Republic"],
|
|
191
|
+
['LB', 'Lebanon'],
|
|
192
|
+
['LC', 'Saint Lucia'],
|
|
193
|
+
['LI', 'Liechtenstein'],
|
|
194
|
+
['LK', 'Sri Lanka'],
|
|
195
|
+
['LR', 'Liberia'],
|
|
196
|
+
['LS', 'Lesotho'],
|
|
197
|
+
['LT', 'Lithuania'],
|
|
198
|
+
['LU', 'Luxembourg'],
|
|
199
|
+
['LV', 'Latvia'],
|
|
200
|
+
['LY', 'Libya'],
|
|
201
|
+
['MA', 'Morocco'],
|
|
202
|
+
['MC', 'Monaco'],
|
|
203
|
+
['MD', 'Moldova, Republic of'],
|
|
204
|
+
['ME', 'Montenegro'],
|
|
205
|
+
['MF', 'Saint Martin (French part)'],
|
|
206
|
+
['MG', 'Madagascar'],
|
|
207
|
+
['MH', 'Marshall Islands'],
|
|
208
|
+
['MK', 'North Macedonia'],
|
|
209
|
+
['ML', 'Mali'],
|
|
210
|
+
['MM', 'Myanmar'],
|
|
211
|
+
['MN', 'Mongolia'],
|
|
212
|
+
['MO', 'Macao'],
|
|
213
|
+
['MP', 'Northern Mariana Islands'],
|
|
214
|
+
['MQ', 'Martinique'],
|
|
215
|
+
['MR', 'Mauritania'],
|
|
216
|
+
['MS', 'Montserrat'],
|
|
217
|
+
['MT', 'Malta'],
|
|
218
|
+
['MU', 'Mauritius'],
|
|
219
|
+
['MV', 'Maldives'],
|
|
220
|
+
['MW', 'Malawi'],
|
|
221
|
+
['MX', 'Mexico'],
|
|
222
|
+
['MY', 'Malaysia'],
|
|
223
|
+
['MZ', 'Mozambique'],
|
|
224
|
+
['NA', 'Namibia'],
|
|
225
|
+
['NC', 'New Caledonia'],
|
|
226
|
+
['NE', 'Niger'],
|
|
227
|
+
['NF', 'Norfolk Island'],
|
|
228
|
+
['NG', 'Nigeria'],
|
|
229
|
+
['NI', 'Nicaragua'],
|
|
230
|
+
['NL', 'Netherlands, Kingdom of the'],
|
|
231
|
+
['NO', 'Norway'],
|
|
232
|
+
['NP', 'Nepal'],
|
|
233
|
+
['NR', 'Nauru'],
|
|
234
|
+
['NU', 'Niue'],
|
|
235
|
+
['NZ', 'New Zealand'],
|
|
236
|
+
['OM', 'Oman'],
|
|
237
|
+
['PA', 'Panama'],
|
|
238
|
+
['PE', 'Peru'],
|
|
239
|
+
['PF', 'French Polynesia'],
|
|
240
|
+
['PG', 'Papua New Guinea'],
|
|
241
|
+
['PH', 'Philippines'],
|
|
242
|
+
['PK', 'Pakistan'],
|
|
243
|
+
['PL', 'Poland'],
|
|
244
|
+
['PM', 'Saint Pierre and Miquelon'],
|
|
245
|
+
['PN', 'Pitcairn'],
|
|
246
|
+
['PR', 'Puerto Rico'],
|
|
247
|
+
['PS', 'Palestine, State of'],
|
|
248
|
+
['PT', 'Portugal'],
|
|
249
|
+
['PW', 'Palau'],
|
|
250
|
+
['PY', 'Paraguay'],
|
|
251
|
+
['QA', 'Qatar'],
|
|
252
|
+
['RE', 'Réunion'],
|
|
253
|
+
['RO', 'Romania'],
|
|
254
|
+
['RS', 'Serbia'],
|
|
255
|
+
['RU', 'Russian Federation'],
|
|
256
|
+
['RW', 'Rwanda'],
|
|
257
|
+
['SA', 'Saudi Arabia'],
|
|
258
|
+
['SB', 'Solomon Islands'],
|
|
259
|
+
['SC', 'Seychelles'],
|
|
260
|
+
['SD', 'Sudan'],
|
|
261
|
+
['SE', 'Sweden'],
|
|
262
|
+
['SG', 'Singapore'],
|
|
263
|
+
['SH', 'Saint Helena, Ascension and Tristan da Cunha'],
|
|
264
|
+
['SI', 'Slovenia'],
|
|
265
|
+
['SJ', 'Svalbard and Jan Mayen'],
|
|
266
|
+
['SK', 'Slovakia'],
|
|
267
|
+
['SL', 'Sierra Leone'],
|
|
268
|
+
['SM', 'San Marino'],
|
|
269
|
+
['SN', 'Senegal'],
|
|
270
|
+
['SO', 'Somalia'],
|
|
271
|
+
['SR', 'Suriname'],
|
|
272
|
+
['SS', 'South Sudan'],
|
|
273
|
+
['ST', 'Sao Tome and Principe'],
|
|
274
|
+
['SV', 'El Salvador'],
|
|
275
|
+
['SX', 'Sint Maarten (Dutch part)'],
|
|
276
|
+
['SY', 'Syrian Arab Republic'],
|
|
277
|
+
['SZ', 'Eswatini'],
|
|
278
|
+
['TC', 'Turks and Caicos Islands'],
|
|
279
|
+
['TD', 'Chad'],
|
|
280
|
+
['TF', 'French Southern Territories'],
|
|
281
|
+
['TG', 'Togo'],
|
|
282
|
+
['TH', 'Thailand'],
|
|
283
|
+
['TJ', 'Tajikistan'],
|
|
284
|
+
['TK', 'Tokelau'],
|
|
285
|
+
['TL', 'Timor-Leste'],
|
|
286
|
+
['TM', 'Turkmenistan'],
|
|
287
|
+
['TN', 'Tunisia'],
|
|
288
|
+
['TO', 'Tonga'],
|
|
289
|
+
['TR', 'Türkiye'],
|
|
290
|
+
['TT', 'Trinidad and Tobago'],
|
|
291
|
+
['TV', 'Tuvalu'],
|
|
292
|
+
['TW', 'Taiwan, Province of China'],
|
|
293
|
+
['TZ', 'Tanzania, United Republic of'],
|
|
294
|
+
['UA', 'Ukraine'],
|
|
295
|
+
['UG', 'Uganda'],
|
|
296
|
+
['UK', 'United Kingdom'],
|
|
297
|
+
['UM', 'United States Minor Outlying Islands'],
|
|
298
|
+
['US', 'United States of America'],
|
|
299
|
+
['UY', 'Uruguay'],
|
|
300
|
+
['UZ', 'Uzbekistan'],
|
|
301
|
+
['VA', 'Holy See'],
|
|
302
|
+
['VC', 'Saint Vincent and the Grenadines'],
|
|
303
|
+
['VE', 'Venezuela, Bolivarian Republic of'],
|
|
304
|
+
['VG', 'Virgin Islands (British)'],
|
|
305
|
+
['VI', 'Virgin Islands (U.S.)'],
|
|
306
|
+
['VN', 'Viet Nam'],
|
|
307
|
+
['VU', 'Vanuatu'],
|
|
308
|
+
['WF', 'Wallis and Futuna'],
|
|
309
|
+
['WS', 'Samoa'],
|
|
310
|
+
['YE', 'Yemen'],
|
|
311
|
+
['YT', 'Mayotte'],
|
|
312
|
+
['ZA', 'South Africa'],
|
|
313
|
+
['ZM', 'Zambia'],
|
|
314
|
+
['ZW', 'Zimbabwe'],
|
|
315
|
+
]);
|
|
316
|
+
/**
|
|
317
|
+
* ISO-3166 US state ISO codes
|
|
318
|
+
* @see https://en.wikipedia.org/wiki/ISO_3166-2:US
|
|
319
|
+
* */
|
|
320
|
+
const usStates = new Map([
|
|
321
|
+
['US-AL', 'Alabama'],
|
|
322
|
+
['US-AK', 'Alaska'],
|
|
323
|
+
['US-AZ', 'Arizona'],
|
|
324
|
+
['US-AR', 'Arkansas'],
|
|
325
|
+
['US-CA', 'California'],
|
|
326
|
+
['US-CO', 'Colorado'],
|
|
327
|
+
['US-CT', 'Connecticut'],
|
|
328
|
+
['US-DE', 'Delaware'],
|
|
329
|
+
['US-FL', 'Florida'],
|
|
330
|
+
['US-GA', 'Georgia'],
|
|
331
|
+
['US-HI', 'Hawaii'],
|
|
332
|
+
['US-ID', 'Idaho'],
|
|
333
|
+
['US-IL', 'Illinois'],
|
|
334
|
+
['US-IN', 'Indiana'],
|
|
335
|
+
['US-IA', 'Iowa'],
|
|
336
|
+
['US-KS', 'Kansas'],
|
|
337
|
+
['US-KY', 'Kentucky'],
|
|
338
|
+
['US-LA', 'Louisiana'],
|
|
339
|
+
['US-ME', 'Maine'],
|
|
340
|
+
['US-MD', 'Maryland'],
|
|
341
|
+
['US-MA', 'Massachusetts'],
|
|
342
|
+
['US-MI', 'Michigan'],
|
|
343
|
+
['US-MN', 'Minnesota'],
|
|
344
|
+
['US-MS', 'Mississippi'],
|
|
345
|
+
['US-MO', 'Missouri'],
|
|
346
|
+
['US-MT', 'Montana'],
|
|
347
|
+
['US-NE', 'Nebraska'],
|
|
348
|
+
['US-NV', 'Nevada'],
|
|
349
|
+
['US-NH', 'New Hampshire'],
|
|
350
|
+
['US-NJ', 'New Jersey'],
|
|
351
|
+
['US-NM', 'New Mexico'],
|
|
352
|
+
['US-NY', 'New York'],
|
|
353
|
+
['US-NC', 'North Carolina'],
|
|
354
|
+
['US-ND', 'North Dakota'],
|
|
355
|
+
['US-OH', 'Ohio'],
|
|
356
|
+
['US-OK', 'Oklahoma'],
|
|
357
|
+
['US-OR', 'Oregon'],
|
|
358
|
+
['US-PA', 'Pennsylvania'],
|
|
359
|
+
['US-RI', 'Rhode Island'],
|
|
360
|
+
['US-SC', 'South Carolina'],
|
|
361
|
+
['US-SD', 'South Dakota'],
|
|
362
|
+
['US-TN', 'Tennessee'],
|
|
363
|
+
['US-TX', 'Texas'],
|
|
364
|
+
['US-UT', 'Utah'],
|
|
365
|
+
['US-VT', 'Vermont'],
|
|
366
|
+
['US-VA', 'Virginia'],
|
|
367
|
+
['US-WA', 'Washington'],
|
|
368
|
+
['US-WV', 'West Virginia'],
|
|
369
|
+
['US-WI', 'Wisconsin'],
|
|
370
|
+
['US-WY', 'Wyoming'],
|
|
371
|
+
['US-DC', 'District of Columbia'],
|
|
372
|
+
['US-AS', 'American Samoa'],
|
|
373
|
+
['US-GU', 'Guam'],
|
|
374
|
+
['US-MP', 'Northern Mariana Islands'],
|
|
375
|
+
['US-PR', 'Puerto Rico'],
|
|
376
|
+
['US-UM', 'United States Minor Outlying Islands'],
|
|
377
|
+
['US-VI', 'Virgin Islands, U.S.'],
|
|
378
|
+
]);
|
|
379
|
+
new Set([...isoCountries.keys(), ...usStates.keys()]);
|
|
380
|
+
|
|
381
|
+
// eslint-disable-next-line @nx/enforce-module-boundaries
|
|
382
|
+
const isConsentEnabled = (consent) => hasUserConsentForProvider(consent.consent, packageName);
|
|
383
|
+
const consent = ({ consentData }) => {
|
|
384
|
+
if (!(window === null || window === void 0 ? void 0 : window.edgeUET)) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
window.edgeUET.push('consent', 'update', {
|
|
388
|
+
ad_storage: isConsentEnabled(consentData) ? 'granted' : 'denied',
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const initBing = (ID, consent) => {
|
|
4
393
|
var _a;
|
|
5
394
|
if (!window || !document || window.edgeUET) {
|
|
6
395
|
return;
|
|
7
396
|
}
|
|
8
397
|
window.edgeUET = window.edgeUET || [];
|
|
398
|
+
// Push consent data to Bing SDK
|
|
399
|
+
window.edgeUET.push('consent', 'default', {
|
|
400
|
+
ad_storage: isConsentEnabled(consent) ? 'granted' : 'denied',
|
|
401
|
+
});
|
|
9
402
|
const n = document.createElement('script');
|
|
10
403
|
n.src = '//bat.bing.com/bat.js';
|
|
11
404
|
n.async = true;
|
|
@@ -36,14 +429,14 @@ const initBing = (ID) => {
|
|
|
36
429
|
const i = document.getElementsByTagName('script')[0];
|
|
37
430
|
(_a = i.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(n, i);
|
|
38
431
|
};
|
|
39
|
-
const init = ({ manifest }) => {
|
|
432
|
+
const init = ({ manifest, consentData }) => {
|
|
40
433
|
if (!window ||
|
|
41
434
|
!manifest.variables ||
|
|
42
435
|
manifest.variables['enableBrowser'] !== '1' ||
|
|
43
436
|
!manifest.variables['tagId']) {
|
|
44
437
|
return;
|
|
45
438
|
}
|
|
46
|
-
initBing(manifest.variables['tagId']);
|
|
439
|
+
initBing(manifest.variables['tagId'], consentData);
|
|
47
440
|
};
|
|
48
441
|
|
|
49
442
|
const canLog = () => {
|
|
@@ -131,7 +524,7 @@ const handleTag = ({ data, eventName, manifestVariables, }) => {
|
|
|
131
524
|
|
|
132
525
|
const tag = ({ data, eventName, manifestVariables }) => {
|
|
133
526
|
const payload = {
|
|
134
|
-
sdkVersion: "1.
|
|
527
|
+
sdkVersion: "1.16.0" ,
|
|
135
528
|
};
|
|
136
529
|
if (window.edgeUET && manifestVariables['enableBrowser'] === '1') {
|
|
137
530
|
handleTag({ data, eventName, manifestVariables });
|
|
@@ -161,6 +554,7 @@ const data = {
|
|
|
161
554
|
init,
|
|
162
555
|
tag,
|
|
163
556
|
user,
|
|
557
|
+
consent,
|
|
164
558
|
};
|
|
165
559
|
try {
|
|
166
560
|
if (window) {
|