@washingtonpost/subs-de-inputs 0.5.6 → 1.0.0-react18.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/components/DESelect/index.d.ts +35 -30
- package/dist/index.d.ts +4 -8
- package/dist/interfaces/index.d.ts +34 -55
- package/dist/services/dataEnrichment.d.ts +3 -0
- package/dist/subs-de-inputs.cjs.development.js +480 -578
- package/dist/subs-de-inputs.cjs.development.js.map +1 -1
- package/dist/subs-de-inputs.cjs.production.min.js +1 -1
- package/dist/subs-de-inputs.cjs.production.min.js.map +1 -1
- package/dist/subs-de-inputs.esm.js +483 -574
- package/dist/subs-de-inputs.esm.js.map +1 -1
- package/dist/utils/hasRequiredPrivacyCookies.d.ts +1 -1
- package/package.json +27 -51
- package/CHANGELOG.md +0 -66
- package/dist/components/DEDisclosure/hooks/useOnetrustAlertBoxClosedPromise.d.ts +0 -23
- package/dist/components/DEDisclosure/index.d.ts +0 -12
- package/dist/components/DEDisclosure/utils/checkCookie.d.ts +0 -1
- package/dist/components/DEDisclosure/utils/getConfig.d.ts +0 -2
- package/dist/components/DEDisclosure/utils/hydrateLinks.d.ts +0 -3
- package/dist/components/DESelect/Dropdown.d.ts +0 -16
- package/dist/constants/IngestDataTypes.d.ts +0 -15
- package/dist/interfaces/disclosure.d.ts +0 -8
- package/dist/interfaces/twpdeu.d.ts +0 -12
- package/dist/services/getAttributes.d.ts +0 -6
- package/dist/services/ingest.d.ts +0 -14
- package/dist/services/sendToGA.d.ts +0 -9
- package/dist/utils/isAnonymousWebview.d.ts +0 -1
- package/dist/utils/push.d.ts +0 -14
|
@@ -1,430 +1,540 @@
|
|
|
1
|
-
import { getCookie, WPGeo, JSON_HEADERS,
|
|
1
|
+
import { getCookie, WPGeo, JSON_HEADERS, ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';
|
|
2
2
|
import React, { useState, useEffect } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { useWindowSize, useScript, ScriptStatus } from '@washingtonpost/subs-hooks';
|
|
5
|
-
import { ChevronDown } from '@washingtonpost/wpds-assets';
|
|
3
|
+
import { Select, theme, styled } from '@washingtonpost/wpds-ui-kit';
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
var CollectionBehaviors = {
|
|
8
6
|
COLLECT: 'COLLECT',
|
|
9
7
|
DO_NOT_COLLECT: 'DO_NOT_COLLECT'
|
|
10
8
|
};
|
|
11
|
-
|
|
9
|
+
var AttributesState = {
|
|
12
10
|
SUCCESS: '100'
|
|
13
11
|
};
|
|
14
|
-
|
|
15
|
-
EXPLICIT: 'explicit',
|
|
16
|
-
IMPLICIT: 'implicit'
|
|
17
|
-
};
|
|
18
|
-
const IngestResponseState = {
|
|
12
|
+
var IngestResponseState = {
|
|
19
13
|
SUCCESS: '100',
|
|
20
14
|
SYSTEM_ERROR: '101',
|
|
21
15
|
INVALID_TYPE: '102',
|
|
22
16
|
INVALID_IDENTIFIER: '103',
|
|
23
17
|
INVALID_DATA: '104',
|
|
24
18
|
INVALID_ATTRIBUTE_DEFINITION: '105',
|
|
25
|
-
INVALID_META_DEFINITION: '106'
|
|
26
|
-
UNAUTHENTICATED: '107',
|
|
27
|
-
MISMATCHED_IDENTIFIER: '108',
|
|
28
|
-
DISABLED_ATTRIBUTE_DEFINITION: '109',
|
|
29
|
-
DO_NOT_COLLECT: '110'
|
|
19
|
+
INVALID_META_DEFINITION: '106'
|
|
30
20
|
};
|
|
31
21
|
|
|
32
|
-
|
|
22
|
+
var hasRequiredPrivacyCookies = function hasRequiredPrivacyCookies() {
|
|
33
23
|
var _WPGeo;
|
|
34
24
|
if (typeof window === 'undefined') {
|
|
35
25
|
return false;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
var wp_usp = getCookie('wp_usp');
|
|
28
|
+
var countryCode = (_WPGeo = WPGeo()) == null ? void 0 : _WPGeo.country_code;
|
|
39
29
|
return !!(wp_usp && countryCode === 'US');
|
|
40
30
|
};
|
|
41
31
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
32
|
+
function _regeneratorRuntime() {
|
|
33
|
+
_regeneratorRuntime = function () {
|
|
34
|
+
return e;
|
|
35
|
+
};
|
|
36
|
+
var t,
|
|
37
|
+
e = {},
|
|
38
|
+
r = Object.prototype,
|
|
39
|
+
n = r.hasOwnProperty,
|
|
40
|
+
o = Object.defineProperty || function (t, e, r) {
|
|
41
|
+
t[e] = r.value;
|
|
42
|
+
},
|
|
43
|
+
i = "function" == typeof Symbol ? Symbol : {},
|
|
44
|
+
a = i.iterator || "@@iterator",
|
|
45
|
+
c = i.asyncIterator || "@@asyncIterator",
|
|
46
|
+
u = i.toStringTag || "@@toStringTag";
|
|
47
|
+
function define(t, e, r) {
|
|
48
|
+
return Object.defineProperty(t, e, {
|
|
49
|
+
value: r,
|
|
50
|
+
enumerable: !0,
|
|
51
|
+
configurable: !0,
|
|
52
|
+
writable: !0
|
|
53
|
+
}), t[e];
|
|
50
54
|
}
|
|
51
|
-
const fieldNames = [fieldName];
|
|
52
55
|
try {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
59
|
-
const json = await data.json();
|
|
60
|
-
if (data.ok && json.status === ResponseStatus.SUCCESS) {
|
|
61
|
-
const attributes = json.attributes || [];
|
|
62
|
-
attributesCache[fieldName] = attributes;
|
|
63
|
-
return attributes;
|
|
64
|
-
} else {
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
} catch (e) {
|
|
68
|
-
console.debug(e);
|
|
69
|
-
return [];
|
|
56
|
+
define({}, "");
|
|
57
|
+
} catch (t) {
|
|
58
|
+
define = function (t, e, r) {
|
|
59
|
+
return t[e] = r;
|
|
60
|
+
};
|
|
70
61
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
function wrap(t, e, r, n) {
|
|
63
|
+
var i = e && e.prototype instanceof Generator ? e : Generator,
|
|
64
|
+
a = Object.create(i.prototype),
|
|
65
|
+
c = new Context(n || []);
|
|
66
|
+
return o(a, "_invoke", {
|
|
67
|
+
value: makeInvokeMethod(t, r, c)
|
|
68
|
+
}), a;
|
|
77
69
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
70
|
+
function tryCatch(t, e, r) {
|
|
71
|
+
try {
|
|
72
|
+
return {
|
|
73
|
+
type: "normal",
|
|
74
|
+
arg: t.call(e, r)
|
|
75
|
+
};
|
|
76
|
+
} catch (t) {
|
|
77
|
+
return {
|
|
78
|
+
type: "throw",
|
|
79
|
+
arg: t
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
e.wrap = wrap;
|
|
84
|
+
var h = "suspendedStart",
|
|
85
|
+
l = "suspendedYield",
|
|
86
|
+
f = "executing",
|
|
87
|
+
s = "completed",
|
|
88
|
+
y = {};
|
|
89
|
+
function Generator() {}
|
|
90
|
+
function GeneratorFunction() {}
|
|
91
|
+
function GeneratorFunctionPrototype() {}
|
|
92
|
+
var p = {};
|
|
93
|
+
define(p, a, function () {
|
|
94
|
+
return this;
|
|
102
95
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
96
|
+
var d = Object.getPrototypeOf,
|
|
97
|
+
v = d && d(d(values([])));
|
|
98
|
+
v && v !== r && n.call(v, a) && (p = v);
|
|
99
|
+
var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
|
|
100
|
+
function defineIteratorMethods(t) {
|
|
101
|
+
["next", "throw", "return"].forEach(function (e) {
|
|
102
|
+
define(t, e, function (t) {
|
|
103
|
+
return this._invoke(e, t);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function AsyncIterator(t, e) {
|
|
108
|
+
function invoke(r, o, i, a) {
|
|
109
|
+
var c = tryCatch(t[r], t, o);
|
|
110
|
+
if ("throw" !== c.type) {
|
|
111
|
+
var u = c.arg,
|
|
112
|
+
h = u.value;
|
|
113
|
+
return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
|
|
114
|
+
invoke("next", t, i, a);
|
|
115
|
+
}, function (t) {
|
|
116
|
+
invoke("throw", t, i, a);
|
|
117
|
+
}) : e.resolve(h).then(function (t) {
|
|
118
|
+
u.value = t, i(u);
|
|
119
|
+
}, function (t) {
|
|
120
|
+
return invoke("throw", t, i, a);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
a(c.arg);
|
|
129
124
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
var r;
|
|
126
|
+
o(this, "_invoke", {
|
|
127
|
+
value: function (t, n) {
|
|
128
|
+
function callInvokeWithMethodAndArg() {
|
|
129
|
+
return new e(function (e, r) {
|
|
130
|
+
invoke(t, n, e, r);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
134
|
+
}
|
|
137
135
|
});
|
|
138
|
-
const json = await response.json();
|
|
139
|
-
return json;
|
|
140
|
-
} catch (e) {
|
|
141
|
-
console.debug(e);
|
|
142
|
-
return null;
|
|
143
136
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
137
|
+
function makeInvokeMethod(e, r, n) {
|
|
138
|
+
var o = h;
|
|
139
|
+
return function (i, a) {
|
|
140
|
+
if (o === f) throw Error("Generator is already running");
|
|
141
|
+
if (o === s) {
|
|
142
|
+
if ("throw" === i) throw a;
|
|
143
|
+
return {
|
|
144
|
+
value: t,
|
|
145
|
+
done: !0
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
for (n.method = i, n.arg = a;;) {
|
|
149
|
+
var c = n.delegate;
|
|
150
|
+
if (c) {
|
|
151
|
+
var u = maybeInvokeDelegate(c, n);
|
|
152
|
+
if (u) {
|
|
153
|
+
if (u === y) continue;
|
|
154
|
+
return u;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
|
|
158
|
+
if (o === h) throw o = s, n.arg;
|
|
159
|
+
n.dispatchException(n.arg);
|
|
160
|
+
} else "return" === n.method && n.abrupt("return", n.arg);
|
|
161
|
+
o = f;
|
|
162
|
+
var p = tryCatch(e, r, n);
|
|
163
|
+
if ("normal" === p.type) {
|
|
164
|
+
if (o = n.done ? s : l, p.arg === y) continue;
|
|
165
|
+
return {
|
|
166
|
+
value: p.arg,
|
|
167
|
+
done: n.done
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
"throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
149
173
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
} = _ref;
|
|
159
|
-
if (!hasRequiredPrivacyCookies()) {
|
|
160
|
-
throw new Error('does not satisfy cookie check');
|
|
174
|
+
function maybeInvokeDelegate(e, r) {
|
|
175
|
+
var n = r.method,
|
|
176
|
+
o = e.iterator[n];
|
|
177
|
+
if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
|
|
178
|
+
var i = tryCatch(o, e.iterator, r.arg);
|
|
179
|
+
if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
|
|
180
|
+
var a = i.arg;
|
|
181
|
+
return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
|
|
161
182
|
}
|
|
162
|
-
|
|
163
|
-
|
|
183
|
+
function pushTryEntry(t) {
|
|
184
|
+
var e = {
|
|
185
|
+
tryLoc: t[0]
|
|
186
|
+
};
|
|
187
|
+
1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
|
|
164
188
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
const attributeInfo = await getAttributes({
|
|
169
|
-
fieldName
|
|
170
|
-
});
|
|
171
|
-
if (attributeInfo[0] && attributeInfo[0].name === fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT) {
|
|
172
|
-
throw new Error('do not collect');
|
|
189
|
+
function resetTryEntry(t) {
|
|
190
|
+
var e = t.completion || {};
|
|
191
|
+
e.type = "normal", delete e.arg, t.completion = e;
|
|
173
192
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
193
|
+
function Context(t) {
|
|
194
|
+
this.tryEntries = [{
|
|
195
|
+
tryLoc: "root"
|
|
196
|
+
}], t.forEach(pushTryEntry, this), this.reset(!0);
|
|
177
197
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
198
|
+
function values(e) {
|
|
199
|
+
if (e || "" === e) {
|
|
200
|
+
var r = e[a];
|
|
201
|
+
if (r) return r.call(e);
|
|
202
|
+
if ("function" == typeof e.next) return e;
|
|
203
|
+
if (!isNaN(e.length)) {
|
|
204
|
+
var o = -1,
|
|
205
|
+
i = function next() {
|
|
206
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
|
|
207
|
+
return next.value = t, next.done = !0, next;
|
|
208
|
+
};
|
|
209
|
+
return i.next = i;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
throw new TypeError(typeof e + " is not iterable");
|
|
213
|
+
}
|
|
214
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
215
|
+
value: GeneratorFunctionPrototype,
|
|
216
|
+
configurable: !0
|
|
217
|
+
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
218
|
+
value: GeneratorFunction,
|
|
219
|
+
configurable: !0
|
|
220
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
221
|
+
var e = "function" == typeof t && t.constructor;
|
|
222
|
+
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
223
|
+
}, e.mark = function (t) {
|
|
224
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
|
|
225
|
+
}, e.awrap = function (t) {
|
|
226
|
+
return {
|
|
227
|
+
__await: t
|
|
228
|
+
};
|
|
229
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
|
|
230
|
+
return this;
|
|
231
|
+
}), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
|
|
232
|
+
void 0 === i && (i = Promise);
|
|
233
|
+
var a = new AsyncIterator(wrap(t, r, n, o), i);
|
|
234
|
+
return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
|
|
235
|
+
return t.done ? t.value : a.next();
|
|
187
236
|
});
|
|
237
|
+
}, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
|
|
238
|
+
return this;
|
|
239
|
+
}), define(g, "toString", function () {
|
|
240
|
+
return "[object Generator]";
|
|
241
|
+
}), e.keys = function (t) {
|
|
242
|
+
var e = Object(t),
|
|
243
|
+
r = [];
|
|
244
|
+
for (var n in e) r.push(n);
|
|
245
|
+
return r.reverse(), function next() {
|
|
246
|
+
for (; r.length;) {
|
|
247
|
+
var t = r.pop();
|
|
248
|
+
if (t in e) return next.value = t, next.done = !1, next;
|
|
249
|
+
}
|
|
250
|
+
return next.done = !0, next;
|
|
251
|
+
};
|
|
252
|
+
}, e.values = values, Context.prototype = {
|
|
253
|
+
constructor: Context,
|
|
254
|
+
reset: function (e) {
|
|
255
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
256
|
+
},
|
|
257
|
+
stop: function () {
|
|
258
|
+
this.done = !0;
|
|
259
|
+
var t = this.tryEntries[0].completion;
|
|
260
|
+
if ("throw" === t.type) throw t.arg;
|
|
261
|
+
return this.rval;
|
|
262
|
+
},
|
|
263
|
+
dispatchException: function (e) {
|
|
264
|
+
if (this.done) throw e;
|
|
265
|
+
var r = this;
|
|
266
|
+
function handle(n, o) {
|
|
267
|
+
return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
|
|
268
|
+
}
|
|
269
|
+
for (var o = this.tryEntries.length - 1; o >= 0; --o) {
|
|
270
|
+
var i = this.tryEntries[o],
|
|
271
|
+
a = i.completion;
|
|
272
|
+
if ("root" === i.tryLoc) return handle("end");
|
|
273
|
+
if (i.tryLoc <= this.prev) {
|
|
274
|
+
var c = n.call(i, "catchLoc"),
|
|
275
|
+
u = n.call(i, "finallyLoc");
|
|
276
|
+
if (c && u) {
|
|
277
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
278
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
279
|
+
} else if (c) {
|
|
280
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
|
|
281
|
+
} else {
|
|
282
|
+
if (!u) throw Error("try statement without catch or finally");
|
|
283
|
+
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
abrupt: function (t, e) {
|
|
289
|
+
for (var r = this.tryEntries.length - 1; r >= 0; --r) {
|
|
290
|
+
var o = this.tryEntries[r];
|
|
291
|
+
if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
|
|
292
|
+
var i = o;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
|
|
297
|
+
var a = i ? i.completion : {};
|
|
298
|
+
return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
|
|
299
|
+
},
|
|
300
|
+
complete: function (t, e) {
|
|
301
|
+
if ("throw" === t.type) throw t.arg;
|
|
302
|
+
return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
|
|
303
|
+
},
|
|
304
|
+
finish: function (t) {
|
|
305
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
306
|
+
var r = this.tryEntries[e];
|
|
307
|
+
if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
catch: function (t) {
|
|
311
|
+
for (var e = this.tryEntries.length - 1; e >= 0; --e) {
|
|
312
|
+
var r = this.tryEntries[e];
|
|
313
|
+
if (r.tryLoc === t) {
|
|
314
|
+
var n = r.completion;
|
|
315
|
+
if ("throw" === n.type) {
|
|
316
|
+
var o = n.arg;
|
|
317
|
+
resetTryEntry(r);
|
|
318
|
+
}
|
|
319
|
+
return o;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
throw Error("illegal catch attempt");
|
|
323
|
+
},
|
|
324
|
+
delegateYield: function (e, r, n) {
|
|
325
|
+
return this.delegate = {
|
|
326
|
+
iterator: values(e),
|
|
327
|
+
resultName: r,
|
|
328
|
+
nextLoc: n
|
|
329
|
+
}, "next" === this.method && (this.arg = t), y;
|
|
330
|
+
}
|
|
331
|
+
}, e;
|
|
332
|
+
}
|
|
333
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
334
|
+
try {
|
|
335
|
+
var info = gen[key](arg);
|
|
336
|
+
var value = info.value;
|
|
337
|
+
} catch (error) {
|
|
338
|
+
reject(error);
|
|
339
|
+
return;
|
|
188
340
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
display: 'flex',
|
|
194
|
-
justifyContent: 'space-between',
|
|
195
|
-
width: '100%',
|
|
196
|
-
backgroundColor: '$secondary',
|
|
197
|
-
color: '$primary',
|
|
198
|
-
fontFamily: '$meta',
|
|
199
|
-
fontSize: '$100',
|
|
200
|
-
fontWeight: '$light',
|
|
201
|
-
lineHeight: '$125',
|
|
202
|
-
paddingBlockRight: '$125',
|
|
203
|
-
textOverflow: 'ellipsis',
|
|
204
|
-
position: 'relative',
|
|
205
|
-
borderColor: 'transparent',
|
|
206
|
-
borderRightWidth: '10px',
|
|
207
|
-
borderRightColor: 'transparent',
|
|
208
|
-
appearance: 'none',
|
|
209
|
-
'-webkit-appearance': 'none',
|
|
210
|
-
'&:disabled': {
|
|
211
|
-
backgroundColor: theme.colors.disabled,
|
|
212
|
-
borderColor: theme.colors.disabled,
|
|
213
|
-
color: theme.colors.onDisabled,
|
|
214
|
-
cursor: 'not-allowed'
|
|
341
|
+
if (info.done) {
|
|
342
|
+
resolve(value);
|
|
343
|
+
} else {
|
|
344
|
+
Promise.resolve(value).then(_next, _throw);
|
|
215
345
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
});
|
|
232
|
-
/**
|
|
233
|
-
* Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.
|
|
234
|
-
* @param {IDropdownProps} props The props.
|
|
235
|
-
* @returns {React.ReactElement} The dropdown.
|
|
236
|
-
*/
|
|
237
|
-
const Dropdown = _ref => {
|
|
238
|
-
let {
|
|
239
|
-
id,
|
|
240
|
-
label,
|
|
241
|
-
values,
|
|
242
|
-
required = false,
|
|
243
|
-
defaultValue,
|
|
244
|
-
onChange = () => {},
|
|
245
|
-
disabled = false
|
|
246
|
-
} = _ref;
|
|
247
|
-
const [answer, setAnswer] = useState();
|
|
248
|
-
const {
|
|
249
|
-
isMobileSize
|
|
250
|
-
} = useWindowSize();
|
|
251
|
-
useEffect(() => {
|
|
252
|
-
if (answer) onChange(answer);
|
|
253
|
-
}, [answer]);
|
|
254
|
-
const disabledProp = disabled ? {
|
|
255
|
-
disabled: true
|
|
256
|
-
} : {};
|
|
257
|
-
// helps maintain state between WPDS and native dropdowns
|
|
258
|
-
const defaultValueProp = answer ? {
|
|
259
|
-
defaultValue: answer
|
|
260
|
-
} : defaultValue ? {
|
|
261
|
-
defaultValue
|
|
262
|
-
} : {};
|
|
263
|
-
const defaultValuePropMobile = value => {
|
|
264
|
-
if (answer) {
|
|
265
|
-
return value === answer ? {
|
|
266
|
-
selected: true
|
|
267
|
-
} : {};
|
|
268
|
-
}
|
|
269
|
-
return value === defaultValue ? {
|
|
270
|
-
selected: true
|
|
271
|
-
} : {};
|
|
346
|
+
}
|
|
347
|
+
function _asyncToGenerator(fn) {
|
|
348
|
+
return function () {
|
|
349
|
+
var self = this,
|
|
350
|
+
args = arguments;
|
|
351
|
+
return new Promise(function (resolve, reject) {
|
|
352
|
+
var gen = fn.apply(self, args);
|
|
353
|
+
function _next(value) {
|
|
354
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
355
|
+
}
|
|
356
|
+
function _throw(err) {
|
|
357
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
358
|
+
}
|
|
359
|
+
_next(undefined);
|
|
360
|
+
});
|
|
272
361
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
style: {
|
|
284
|
-
color: '#666666'
|
|
285
|
-
}
|
|
286
|
-
}, label), values.map(value => React.createElement(StyledMobileOption, {
|
|
287
|
-
value: value,
|
|
288
|
-
key: value,
|
|
289
|
-
...defaultValuePropMobile(value)
|
|
290
|
-
}, value))), React.createElement(Icon, {
|
|
291
|
-
label: "",
|
|
292
|
-
size: "100",
|
|
293
|
-
fill: theme.colors['gray80'],
|
|
294
|
-
style: {
|
|
295
|
-
pointerEvents: 'none',
|
|
296
|
-
position: 'absolute',
|
|
297
|
-
right: '10px',
|
|
298
|
-
top: '50%',
|
|
299
|
-
transform: 'translateY(-50%)'
|
|
300
|
-
}
|
|
301
|
-
}, React.createElement(ChevronDown, {
|
|
302
|
-
style: {
|
|
303
|
-
position: 'absolute',
|
|
304
|
-
right: '10px'
|
|
362
|
+
}
|
|
363
|
+
function _extends() {
|
|
364
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
365
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
366
|
+
var source = arguments[i];
|
|
367
|
+
for (var key in source) {
|
|
368
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
369
|
+
target[key] = source[key];
|
|
370
|
+
}
|
|
371
|
+
}
|
|
305
372
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
...disabledProp
|
|
311
|
-
}, React.createElement(Select.Trigger, {
|
|
312
|
-
"data-test-id": `${id}-select-trigger`
|
|
313
|
-
}, React.createElement(Select.Label, null, label), React.createElement(Select.Value, null)), React.createElement(Select.Content, {
|
|
314
|
-
css: {
|
|
315
|
-
zIndex: theme.zIndices.page
|
|
316
|
-
},
|
|
317
|
-
"data-test-id": `${id}-select-content`
|
|
318
|
-
}, values.map(value => React.createElement(Select.Item, {
|
|
319
|
-
value: value,
|
|
320
|
-
key: value
|
|
321
|
-
}, value))));
|
|
322
|
-
};
|
|
373
|
+
return target;
|
|
374
|
+
};
|
|
375
|
+
return _extends.apply(this, arguments);
|
|
376
|
+
}
|
|
323
377
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
fieldName,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
378
|
+
var base = ENDPOINTS.base + "/de/v1";
|
|
379
|
+
var attributesCache = {};
|
|
380
|
+
var getAttributes = /*#__PURE__*/function () {
|
|
381
|
+
var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
382
|
+
var fieldName, fieldNames, url, data, json, attributes;
|
|
383
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
384
|
+
while (1) switch (_context.prev = _context.next) {
|
|
385
|
+
case 0:
|
|
386
|
+
fieldName = _ref.fieldName;
|
|
387
|
+
if (!attributesCache[fieldName]) {
|
|
388
|
+
_context.next = 3;
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
return _context.abrupt("return", attributesCache[fieldName]);
|
|
392
|
+
case 3:
|
|
393
|
+
fieldNames = [fieldName];
|
|
394
|
+
_context.prev = 4;
|
|
395
|
+
url = new URL(base + "/attributes");
|
|
396
|
+
url.searchParams.set('attributes', fieldNames.join(','));
|
|
397
|
+
_context.next = 9;
|
|
398
|
+
return fetch(url.toString(), {
|
|
399
|
+
credentials: 'include',
|
|
400
|
+
headers: JSON_HEADERS
|
|
401
|
+
});
|
|
402
|
+
case 9:
|
|
403
|
+
data = _context.sent;
|
|
404
|
+
_context.next = 12;
|
|
405
|
+
return data.json();
|
|
406
|
+
case 12:
|
|
407
|
+
json = _context.sent;
|
|
408
|
+
if (!(data.ok && json.status === ResponseStatus.SUCCESS)) {
|
|
409
|
+
_context.next = 19;
|
|
410
|
+
break;
|
|
411
|
+
}
|
|
412
|
+
attributes = json.attributes || [];
|
|
413
|
+
attributesCache[fieldName] = attributes;
|
|
414
|
+
return _context.abrupt("return", attributes);
|
|
415
|
+
case 19:
|
|
416
|
+
return _context.abrupt("return", []);
|
|
417
|
+
case 20:
|
|
418
|
+
_context.next = 26;
|
|
419
|
+
break;
|
|
420
|
+
case 22:
|
|
421
|
+
_context.prev = 22;
|
|
422
|
+
_context.t0 = _context["catch"](4);
|
|
423
|
+
console.debug(_context.t0);
|
|
424
|
+
return _context.abrupt("return", []);
|
|
425
|
+
case 26:
|
|
426
|
+
case "end":
|
|
427
|
+
return _context.stop();
|
|
356
428
|
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
|
|
429
|
+
}, _callee, null, [[4, 22]]);
|
|
430
|
+
}));
|
|
431
|
+
return function getAttributes(_x) {
|
|
432
|
+
return _ref2.apply(this, arguments);
|
|
433
|
+
};
|
|
434
|
+
}();
|
|
435
|
+
|
|
436
|
+
var DESelect = function DESelect(_ref) {
|
|
437
|
+
var source = _ref.source,
|
|
438
|
+
fieldName = _ref.fieldName,
|
|
439
|
+
label = _ref.label,
|
|
440
|
+
dataDictionaryConfig = _ref.dataDictionaryConfig,
|
|
441
|
+
defaultValue = _ref.defaultValue,
|
|
442
|
+
disabled = _ref.disabled,
|
|
443
|
+
submit = _ref.submit,
|
|
444
|
+
_ref$onChange = _ref.onChange,
|
|
445
|
+
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
446
|
+
_ref$onFinished = _ref.onFinished,
|
|
447
|
+
onFinished = _ref$onFinished === void 0 ? function () {} : _ref$onFinished,
|
|
448
|
+
_ref$valuesFilter = _ref.valuesFilter,
|
|
449
|
+
valuesFilter = _ref$valuesFilter === void 0 ? function () {
|
|
450
|
+
return true;
|
|
451
|
+
} : _ref$valuesFilter,
|
|
452
|
+
children = _ref.children;
|
|
453
|
+
var _useState = useState(dataDictionaryConfig),
|
|
454
|
+
config = _useState[0],
|
|
455
|
+
setConfig = _useState[1];
|
|
456
|
+
var _useState2 = useState(''),
|
|
457
|
+
selected = _useState2[0],
|
|
458
|
+
setSelected = _useState2[1];
|
|
459
|
+
useEffect(function () {
|
|
460
|
+
if (children) {
|
|
461
|
+
if (process.env.NODE_ENV !== "production") {
|
|
462
|
+
console.debug('childen props', children);
|
|
463
|
+
}
|
|
464
|
+
return;
|
|
360
465
|
}
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
466
|
+
if (!config) {
|
|
467
|
+
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
468
|
+
var config;
|
|
469
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
470
|
+
while (1) switch (_context.prev = _context.next) {
|
|
471
|
+
case 0:
|
|
472
|
+
_context.next = 2;
|
|
473
|
+
return getAttributes({
|
|
474
|
+
fieldName: fieldName
|
|
475
|
+
});
|
|
476
|
+
case 2:
|
|
477
|
+
config = _context.sent;
|
|
478
|
+
if (process.env.NODE_ENV !== "production") {
|
|
479
|
+
console.debug('config from API', config);
|
|
480
|
+
}
|
|
481
|
+
setConfig(config[0]);
|
|
482
|
+
case 5:
|
|
483
|
+
case "end":
|
|
484
|
+
return _context.stop();
|
|
485
|
+
}
|
|
486
|
+
}, _callee);
|
|
487
|
+
}))();
|
|
488
|
+
}
|
|
489
|
+
}, []);
|
|
490
|
+
useEffect(function () {
|
|
491
|
+
if (submit && selected) {
|
|
492
|
+
if (process.env.NODE_ENV !== "production") {
|
|
493
|
+
console.error('push not implemented', selected, source);
|
|
383
494
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
495
|
+
onFinished({
|
|
496
|
+
isFinished: true,
|
|
497
|
+
isError: false
|
|
498
|
+
});
|
|
387
499
|
}
|
|
388
|
-
}, [
|
|
389
|
-
|
|
390
|
-
|
|
500
|
+
}, [submit, selected]);
|
|
501
|
+
if (!(children || config)) {
|
|
502
|
+
return React.createElement("span", null, "loading");
|
|
503
|
+
}
|
|
504
|
+
var defaultValueProp = defaultValue ? {
|
|
505
|
+
defaultValue: defaultValue
|
|
391
506
|
} : {};
|
|
392
|
-
|
|
393
|
-
const disabledProp = disabled || isLoading ? {
|
|
507
|
+
var disabledProp = disabled ? {
|
|
394
508
|
disabled: true
|
|
395
509
|
} : {};
|
|
396
510
|
// sort and filter out archived values
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
511
|
+
var values = config ? config.values.sort(function (a, b) {
|
|
512
|
+
return a.order - b.order;
|
|
513
|
+
}).filter(function (value) {
|
|
514
|
+
return value.archived !== true;
|
|
515
|
+
}).filter(valuesFilter) : [];
|
|
516
|
+
return React.createElement(SelectWrapper, null, React.createElement(Select.Root, _extends({
|
|
517
|
+
onValueChange: function onValueChange(e) {
|
|
402
518
|
onChange({
|
|
403
519
|
value: e
|
|
404
520
|
});
|
|
405
|
-
},
|
|
406
|
-
...defaultValueProp,
|
|
407
|
-
...disabledProp
|
|
408
|
-
}, children), !children && !config && React.createElement(Dropdown, {
|
|
409
|
-
id: 'loading',
|
|
410
|
-
label: 'Loading...',
|
|
411
|
-
values: [],
|
|
412
|
-
disabled: true
|
|
413
|
-
}), !children && config && React.createElement(Dropdown, {
|
|
414
|
-
id: config.name,
|
|
415
|
-
label: label || config.name,
|
|
416
|
-
onChange: e => {
|
|
417
521
|
setSelected(e);
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
522
|
+
}
|
|
523
|
+
}, defaultValueProp, disabledProp), children || null, !children && config && React.createElement(React.Fragment, null, React.createElement(Select.Trigger, {
|
|
524
|
+
"data-test-id": config.name + "-select-trigger"
|
|
525
|
+
}, React.createElement(Select.Label, null, label || config.name), React.createElement(Select.Value, null)), React.createElement(Select.Content, {
|
|
526
|
+
css: {
|
|
527
|
+
zIndex: theme.zIndices.page
|
|
421
528
|
},
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
529
|
+
"data-test-id": config.name + "-select-content"
|
|
530
|
+
}, values.map(function (value) {
|
|
531
|
+
return React.createElement(Select.Item, {
|
|
532
|
+
value: value.name,
|
|
533
|
+
key: value.name
|
|
534
|
+
}, value.name);
|
|
535
|
+
})))));
|
|
426
536
|
};
|
|
427
|
-
|
|
537
|
+
var SelectWrapper = /*#__PURE__*/styled('div', {
|
|
428
538
|
boxSizing: 'border-box',
|
|
429
539
|
display: 'flex',
|
|
430
540
|
marginBottom: '$100',
|
|
@@ -437,206 +547,5 @@ const SelectWrapper = /*#__PURE__*/styled('div', {
|
|
|
437
547
|
}
|
|
438
548
|
});
|
|
439
549
|
|
|
440
|
-
|
|
441
|
-
const getConfig = async () => {
|
|
442
|
-
let myConfig = undefined;
|
|
443
|
-
// step 1: fetch config
|
|
444
|
-
const response = await fetch(configSrc);
|
|
445
|
-
const remoteConfig = await response.json();
|
|
446
|
-
// step 2: figure out which part of the config to use
|
|
447
|
-
// if country- or region-specific config found, use that
|
|
448
|
-
const {
|
|
449
|
-
country_code,
|
|
450
|
-
intl_region
|
|
451
|
-
} = WPGeo();
|
|
452
|
-
Object.keys(remoteConfig).forEach(configKey => {
|
|
453
|
-
if (country_code && configKey.split('|').includes(country_code.toLowerCase())) {
|
|
454
|
-
myConfig = remoteConfig[configKey];
|
|
455
|
-
} else if (intl_region === 'EEA' && configKey === 'eea') {
|
|
456
|
-
myConfig = remoteConfig[configKey];
|
|
457
|
-
}
|
|
458
|
-
});
|
|
459
|
-
// TODO: Check for billing country also
|
|
460
|
-
// else if no country-specific config, use the default config
|
|
461
|
-
if (typeof myConfig === 'undefined' && remoteConfig['_']) {
|
|
462
|
-
myConfig = remoteConfig['_'];
|
|
463
|
-
}
|
|
464
|
-
return myConfig;
|
|
465
|
-
};
|
|
466
|
-
|
|
467
|
-
const hydrateLinks = str => {
|
|
468
|
-
const array = str.split(/({{PRIVACY_POLICY}})/g);
|
|
469
|
-
const chunks = array.map(str => {
|
|
470
|
-
if (str === '{{PRIVACY_POLICY}}') {
|
|
471
|
-
return React.createElement("a", {
|
|
472
|
-
target: "_blank",
|
|
473
|
-
style: {
|
|
474
|
-
color: 'inherit'
|
|
475
|
-
},
|
|
476
|
-
className: "underline",
|
|
477
|
-
href: "https://www.washingtonpost.com/privacy-policy/"
|
|
478
|
-
}, "Privacy Policy");
|
|
479
|
-
}
|
|
480
|
-
return str;
|
|
481
|
-
});
|
|
482
|
-
const toReturn = chunks.reduce((prev, current) => React.createElement(React.Fragment, null, prev, current), React.createElement(React.Fragment, null));
|
|
483
|
-
return toReturn;
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
const COOKIE = 'OptanonAlertBoxClosed';
|
|
487
|
-
const checkCookie = () => {
|
|
488
|
-
const value = getCookie(COOKIE) || '';
|
|
489
|
-
// Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)
|
|
490
|
-
// "Invalid date" is 12 characters long
|
|
491
|
-
return value.length > 12;
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
const COOKIE$1 = 'OptanonAlertBoxClosed';
|
|
495
|
-
const useOneTrustAlertBoxClosed = _ref => {
|
|
496
|
-
let {
|
|
497
|
-
allowCookieStore
|
|
498
|
-
} = _ref;
|
|
499
|
-
const [alertBoxClosed, setAlertBoxClosed] = useState();
|
|
500
|
-
const [listenToCookieStore$1, setListenToCookieStore] = useState(false);
|
|
501
|
-
const [listenToTcfApi, setListenToTcfApi] = useState(false);
|
|
502
|
-
useEffect(() => {
|
|
503
|
-
var _window;
|
|
504
|
-
if (checkCookie()) {
|
|
505
|
-
setAlertBoxClosed(true);
|
|
506
|
-
return;
|
|
507
|
-
}
|
|
508
|
-
if (!window.__tcfapi) {
|
|
509
|
-
console.warn('warning: __tcfapi not found');
|
|
510
|
-
}
|
|
511
|
-
if ((_window = window) !== null && _window !== void 0 && _window.cookieStore && allowCookieStore) {
|
|
512
|
-
setListenToCookieStore(true);
|
|
513
|
-
} else if (window.__tcfapi) {
|
|
514
|
-
setListenToTcfApi(true);
|
|
515
|
-
} else {
|
|
516
|
-
console.warn('warning: neither cookieStore nor __tcfapi found');
|
|
517
|
-
}
|
|
518
|
-
}, []);
|
|
519
|
-
useEffect(() => {
|
|
520
|
-
let cleanupFn = () => {};
|
|
521
|
-
if (listenToCookieStore$1 && window.cookieStore) {
|
|
522
|
-
cleanupFn = listenToCookieStore(COOKIE$1, () => {
|
|
523
|
-
if (checkCookie()) {
|
|
524
|
-
setAlertBoxClosed(true);
|
|
525
|
-
} else {
|
|
526
|
-
setAlertBoxClosed(false);
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
}
|
|
530
|
-
return cleanupFn || (() => {});
|
|
531
|
-
}, [listenToCookieStore$1]);
|
|
532
|
-
useEffect(() => {
|
|
533
|
-
let listenerId;
|
|
534
|
-
if (listenToTcfApi && window.__tcfapi) {
|
|
535
|
-
const callback = (_tcData, success) => {
|
|
536
|
-
if (success) {
|
|
537
|
-
listenerId = _tcData.listenerId;
|
|
538
|
-
// tcData.eventStatus can be:
|
|
539
|
-
// tcloaded means user has made a choice and we’re ready to check it
|
|
540
|
-
// cmpuishown means the banner is shown
|
|
541
|
-
// useractioncomplete means the user has interacted with the banner
|
|
542
|
-
// but actually if the result for any of these is true, we just use the value of the cookie
|
|
543
|
-
if (checkCookie()) {
|
|
544
|
-
setAlertBoxClosed(true);
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
};
|
|
548
|
-
window.__tcfapi('addEventListener', 2, callback);
|
|
549
|
-
}
|
|
550
|
-
// cleanup fn
|
|
551
|
-
return () => {
|
|
552
|
-
if (window.__tcfapi && listenerId) window.__tcfapi('removeEventListener', 2, success => {
|
|
553
|
-
console.debug(success);
|
|
554
|
-
}, listenerId);
|
|
555
|
-
};
|
|
556
|
-
}, [listenToTcfApi]);
|
|
557
|
-
return {
|
|
558
|
-
alertBoxClosed,
|
|
559
|
-
listenToCookieStore: listenToCookieStore$1,
|
|
560
|
-
listenToTcfApi
|
|
561
|
-
};
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
const DEDisclosure = _ref => {
|
|
565
|
-
let {
|
|
566
|
-
onFinished = () => {},
|
|
567
|
-
allowCookieStore = true
|
|
568
|
-
} = _ref;
|
|
569
|
-
const [disclosure, setDisclosure] = useState(null);
|
|
570
|
-
const [disclosureRendering, setDisclosureRendering] = useState(null);
|
|
571
|
-
const [myConfig, setMyConfig] = useState();
|
|
572
|
-
const {
|
|
573
|
-
alertBoxClosed
|
|
574
|
-
} = useOneTrustAlertBoxClosed({
|
|
575
|
-
allowCookieStore
|
|
576
|
-
});
|
|
577
|
-
useEffect(() => {
|
|
578
|
-
(async () => {
|
|
579
|
-
const config = await getConfig();
|
|
580
|
-
setMyConfig(config);
|
|
581
|
-
if (!config) {
|
|
582
|
-
console.error('No config found');
|
|
583
|
-
}
|
|
584
|
-
})();
|
|
585
|
-
}, []);
|
|
586
|
-
useEffect(() => {
|
|
587
|
-
if (myConfig) {
|
|
588
|
-
// step 3: set disclosure based on config
|
|
589
|
-
// if config says to check onetrust, check onetrust
|
|
590
|
-
if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {
|
|
591
|
-
// check if onetrust is closed
|
|
592
|
-
// if it is, show the after banner disclosure
|
|
593
|
-
// if it is not, show the before banner disclosure
|
|
594
|
-
if (alertBoxClosed) {
|
|
595
|
-
setDisclosure(myConfig.disclosure_afterbanner);
|
|
596
|
-
} else {
|
|
597
|
-
setDisclosure(myConfig.disclosure_beforebanner);
|
|
598
|
-
}
|
|
599
|
-
} else if ('disclosure' in myConfig) {
|
|
600
|
-
setDisclosure(myConfig.disclosure);
|
|
601
|
-
} else {
|
|
602
|
-
console.error('Invalid config');
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}, [myConfig, alertBoxClosed]);
|
|
606
|
-
useEffect(() => {
|
|
607
|
-
if (disclosure && Array.isArray(disclosure)) {
|
|
608
|
-
setDisclosureRendering(disclosure.reduce((prev, current) => {
|
|
609
|
-
return React.createElement(React.Fragment, null, prev, React.createElement("p", null, hydrateLinks(current)));
|
|
610
|
-
}, React.createElement(React.Fragment, null)));
|
|
611
|
-
// Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?
|
|
612
|
-
onFinished({
|
|
613
|
-
isFinished: true,
|
|
614
|
-
isError: false
|
|
615
|
-
});
|
|
616
|
-
}
|
|
617
|
-
}, [disclosure]);
|
|
618
|
-
return disclosure === null ? React.createElement("div", {
|
|
619
|
-
"data-test-id": "de-disclosure-loading"
|
|
620
|
-
}) : React.createElement("div", {
|
|
621
|
-
"data-test-id": "de-disclosure"
|
|
622
|
-
}, disclosureRendering);
|
|
623
|
-
};
|
|
624
|
-
|
|
625
|
-
const FirstPartyIngestDataTypes = {
|
|
626
|
-
JOB_LEVEL: 'profile_job_level',
|
|
627
|
-
JOB_INDUSTRY: 'profile_job_industry',
|
|
628
|
-
JOB_TITLE: 'profile_job_title',
|
|
629
|
-
PERSONAL_GOALS: 'personal_goals',
|
|
630
|
-
HOBBIES: 'hobbies',
|
|
631
|
-
PROFESSIONAL_GOALS: 'professional_goals',
|
|
632
|
-
INDUSTRY: 'industry',
|
|
633
|
-
NEWS_LOCATION: 'news_location',
|
|
634
|
-
NY_PERSONAL_GOALS: 'new_year_personal_goals',
|
|
635
|
-
NY_HOBBIES: 'new_year_hobbies',
|
|
636
|
-
NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',
|
|
637
|
-
NY_INDUSTRY: 'new_year_industry',
|
|
638
|
-
NY_NEWS_LOCATION: 'new_year_news_location'
|
|
639
|
-
};
|
|
640
|
-
|
|
641
|
-
export { AttributesState, CollectionBehaviors, DEDisclosure, DESelect, FirstPartyIngestDataTypes, IngestResponseState, IngestType, getAttributes, hasRequiredPrivacyCookies, push };
|
|
550
|
+
export { AttributesState, CollectionBehaviors, DESelect, IngestResponseState, getAttributes, hasRequiredPrivacyCookies };
|
|
642
551
|
//# sourceMappingURL=subs-de-inputs.esm.js.map
|