@washingtonpost/subs-de-inputs 1.11.1 → 1.11.2
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/index.cjs +38 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -140
- package/dist/index.js.map +1 -1
- package/package.json +14 -15
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ react = __toESM(react);
|
|
|
30
30
|
let _washingtonpost_wpds_ui_kit = require("@washingtonpost/wpds-ui-kit");
|
|
31
31
|
let _washingtonpost_subs_hooks = require("@washingtonpost/subs-hooks");
|
|
32
32
|
let _washingtonpost_wpds_assets = require("@washingtonpost/wpds-assets");
|
|
33
|
-
let
|
|
33
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
34
34
|
//#region src/interfaces/index.ts
|
|
35
35
|
var CollectionBehaviors = {
|
|
36
36
|
COLLECT: "COLLECT",
|
|
@@ -199,7 +199,6 @@ var push = async ({ submitData, source }) => {
|
|
|
199
199
|
};
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/components/DESelect/Dropdown.tsx
|
|
202
|
-
var _jsxFileName$5 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DESelect/Dropdown.tsx";
|
|
203
202
|
var StyledMobileSelect = (0, _washingtonpost_wpds_ui_kit.styled)("select", {
|
|
204
203
|
padding: "12px 16px 12px 6px",
|
|
205
204
|
display: "flex",
|
|
@@ -259,43 +258,27 @@ var Dropdown = ({ id, label, values, required = false, existingValue, onChange =
|
|
|
259
258
|
if (answer) return value === answer ? { selected: true } : {};
|
|
260
259
|
return value === presetDropdownValue ? { selected: true } : {};
|
|
261
260
|
};
|
|
262
|
-
return isMobileSize ? /* @__PURE__ */ (0,
|
|
261
|
+
return isMobileSize ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledSelectWrapper, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledMobileSelect, {
|
|
263
262
|
id: "",
|
|
264
263
|
required,
|
|
265
264
|
onChange: (e) => setAnswer(e.target.value),
|
|
266
265
|
...disabledProp,
|
|
267
266
|
children: [
|
|
268
|
-
/* @__PURE__ */ (0,
|
|
269
|
-
|
|
270
|
-
lineNumber: 109,
|
|
271
|
-
columnNumber: 9
|
|
272
|
-
}, void 0),
|
|
273
|
-
/* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(StyledMobileOption, {
|
|
267
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", { children: label }),
|
|
268
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMobileOption, {
|
|
274
269
|
value: "",
|
|
275
270
|
disabled: true,
|
|
276
271
|
selected: true,
|
|
277
272
|
style: { color: "#666666" },
|
|
278
273
|
children: label
|
|
279
|
-
},
|
|
280
|
-
|
|
281
|
-
lineNumber: 110,
|
|
282
|
-
columnNumber: 9
|
|
283
|
-
}, void 0),
|
|
284
|
-
values.map((value) => /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(StyledMobileOption, {
|
|
274
|
+
}),
|
|
275
|
+
values.map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StyledMobileOption, {
|
|
285
276
|
value,
|
|
286
277
|
...defaultValuePropMobile(value),
|
|
287
278
|
children: value
|
|
288
|
-
}, value
|
|
289
|
-
fileName: _jsxFileName$5,
|
|
290
|
-
lineNumber: 119,
|
|
291
|
-
columnNumber: 11
|
|
292
|
-
}, void 0))
|
|
279
|
+
}, value))
|
|
293
280
|
]
|
|
294
|
-
},
|
|
295
|
-
fileName: _jsxFileName$5,
|
|
296
|
-
lineNumber: 103,
|
|
297
|
-
columnNumber: 7
|
|
298
|
-
}, void 0), /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(_washingtonpost_wpds_ui_kit.Icon, {
|
|
281
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Icon, {
|
|
299
282
|
label: "",
|
|
300
283
|
size: "100",
|
|
301
284
|
fill: _washingtonpost_wpds_ui_kit.theme.colors.gray80,
|
|
@@ -306,67 +289,30 @@ var Dropdown = ({ id, label, values, required = false, existingValue, onChange =
|
|
|
306
289
|
top: "50%",
|
|
307
290
|
transform: "translateY(-50%)"
|
|
308
291
|
},
|
|
309
|
-
children: /* @__PURE__ */ (0,
|
|
292
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_assets.ChevronDown, { style: {
|
|
310
293
|
position: "absolute",
|
|
311
294
|
right: "10px"
|
|
312
|
-
} }
|
|
313
|
-
|
|
314
|
-
lineNumber: 140,
|
|
315
|
-
columnNumber: 9
|
|
316
|
-
}, void 0)
|
|
317
|
-
}, void 0, false, {
|
|
318
|
-
fileName: _jsxFileName$5,
|
|
319
|
-
lineNumber: 128,
|
|
320
|
-
columnNumber: 7
|
|
321
|
-
}, void 0)] }, void 0, true, {
|
|
322
|
-
fileName: _jsxFileName$5,
|
|
323
|
-
lineNumber: 102,
|
|
324
|
-
columnNumber: 5
|
|
325
|
-
}, void 0) : /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(_washingtonpost_wpds_ui_kit.Select.Root, {
|
|
295
|
+
} })
|
|
296
|
+
})] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_washingtonpost_wpds_ui_kit.Select.Root, {
|
|
326
297
|
onValueChange: (e) => setAnswer(e),
|
|
327
298
|
required,
|
|
328
299
|
...defaultValueProp,
|
|
329
300
|
...disabledProp,
|
|
330
|
-
children: [/* @__PURE__ */ (0,
|
|
301
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_washingtonpost_wpds_ui_kit.Select.Trigger, {
|
|
331
302
|
"data-test-id": `${id}-select-trigger`,
|
|
332
|
-
children: [/* @__PURE__ */ (0,
|
|
333
|
-
|
|
334
|
-
lineNumber: 151,
|
|
335
|
-
columnNumber: 9
|
|
336
|
-
}, void 0), /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(_washingtonpost_wpds_ui_kit.Select.Value, {}, void 0, false, {
|
|
337
|
-
fileName: _jsxFileName$5,
|
|
338
|
-
lineNumber: 152,
|
|
339
|
-
columnNumber: 9
|
|
340
|
-
}, void 0)]
|
|
341
|
-
}, void 0, true, {
|
|
342
|
-
fileName: _jsxFileName$5,
|
|
343
|
-
lineNumber: 150,
|
|
344
|
-
columnNumber: 7
|
|
345
|
-
}, void 0), /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(_washingtonpost_wpds_ui_kit.Select.Content, {
|
|
303
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Select.Label, { children: label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Select.Value, {})]
|
|
304
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Select.Content, {
|
|
346
305
|
css: { zIndex: _washingtonpost_wpds_ui_kit.theme.zIndices.page },
|
|
347
306
|
"data-test-id": `${id}-select-content`,
|
|
348
|
-
children: values.map((value) => /* @__PURE__ */ (0,
|
|
307
|
+
children: values.map((value) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Select.Item, {
|
|
349
308
|
value,
|
|
350
309
|
children: value
|
|
351
|
-
}, value
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
columnNumber: 11
|
|
355
|
-
}, void 0))
|
|
356
|
-
}, void 0, false, {
|
|
357
|
-
fileName: _jsxFileName$5,
|
|
358
|
-
lineNumber: 154,
|
|
359
|
-
columnNumber: 7
|
|
360
|
-
}, void 0)]
|
|
361
|
-
}, void 0, true, {
|
|
362
|
-
fileName: _jsxFileName$5,
|
|
363
|
-
lineNumber: 144,
|
|
364
|
-
columnNumber: 5
|
|
365
|
-
}, void 0);
|
|
310
|
+
}, value))
|
|
311
|
+
})]
|
|
312
|
+
});
|
|
366
313
|
};
|
|
367
314
|
//#endregion
|
|
368
315
|
//#region src/components/DESelect/index.tsx
|
|
369
|
-
var _jsxFileName$4 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DESelect/index.tsx";
|
|
370
316
|
var scriptSrc = `${_washingtonpost_subs_sdk.ENDPOINTS.base}/de-utils/twpdeu.min.js`;
|
|
371
317
|
var SelectWrapper = (0, _washingtonpost_wpds_ui_kit.styled)("div", {
|
|
372
318
|
boxSizing: "border-box",
|
|
@@ -418,8 +364,8 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
418
364
|
const defaultValueProp = existingValue && config ? { defaultValue: existingValue } : {};
|
|
419
365
|
const disabledProp = disabled || !(children || config) ? { disabled: true } : {};
|
|
420
366
|
const values = config ? [...config.values].sort((a, b) => a.order - b.order).filter((value) => value.archived !== true).filter(valuesFilter) : [];
|
|
421
|
-
return /* @__PURE__ */ (0,
|
|
422
|
-
children && /* @__PURE__ */ (0,
|
|
367
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(SelectWrapper, { children: [
|
|
368
|
+
children && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_washingtonpost_wpds_ui_kit.Select.Root, {
|
|
423
369
|
onValueChange: (e) => {
|
|
424
370
|
setSelected(e);
|
|
425
371
|
onChange({ value: e });
|
|
@@ -427,22 +373,14 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
427
373
|
...defaultValueProp,
|
|
428
374
|
...disabledProp,
|
|
429
375
|
children
|
|
430
|
-
},
|
|
431
|
-
|
|
432
|
-
lineNumber: 147,
|
|
433
|
-
columnNumber: 9
|
|
434
|
-
}, void 0),
|
|
435
|
-
!children && !config && /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(Dropdown, {
|
|
376
|
+
}),
|
|
377
|
+
!children && !config && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dropdown, {
|
|
436
378
|
id: "loading",
|
|
437
379
|
label: "Loading...",
|
|
438
380
|
values: [],
|
|
439
381
|
disabled: true
|
|
440
|
-
},
|
|
441
|
-
|
|
442
|
-
lineNumber: 159,
|
|
443
|
-
columnNumber: 9
|
|
444
|
-
}, void 0),
|
|
445
|
-
!children && config && /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(Dropdown, {
|
|
382
|
+
}),
|
|
383
|
+
!children && config && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Dropdown, {
|
|
446
384
|
id: config.name,
|
|
447
385
|
label: label || config.name,
|
|
448
386
|
onChange: (e) => {
|
|
@@ -453,16 +391,8 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
453
391
|
existingValue,
|
|
454
392
|
disabled,
|
|
455
393
|
valueSelectedByDefault
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
lineNumber: 167,
|
|
459
|
-
columnNumber: 9
|
|
460
|
-
}, void 0)
|
|
461
|
-
] }, void 0, true, {
|
|
462
|
-
fileName: _jsxFileName$4,
|
|
463
|
-
lineNumber: 145,
|
|
464
|
-
columnNumber: 5
|
|
465
|
-
}, void 0);
|
|
394
|
+
})
|
|
395
|
+
] });
|
|
466
396
|
};
|
|
467
397
|
//#endregion
|
|
468
398
|
//#region src/components/DEDisclosure/utils/getConfig.ts
|
|
@@ -480,10 +410,9 @@ var getConfig = async () => {
|
|
|
480
410
|
};
|
|
481
411
|
//#endregion
|
|
482
412
|
//#region src/components/DEDisclosure/utils/hydrateLinks.tsx
|
|
483
|
-
var _jsxFileName$3 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/utils/hydrateLinks.tsx";
|
|
484
413
|
var hydrateLinks = (str, onLinkClick = () => {}) => {
|
|
485
414
|
return str.split(/({{PRIVACY_POLICY}})/g).map((chunk, i) => {
|
|
486
|
-
if (chunk === "{{PRIVACY_POLICY}}") return /* @__PURE__ */ (0,
|
|
415
|
+
if (chunk === "{{PRIVACY_POLICY}}") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
487
416
|
rel: "noopener noreferrer",
|
|
488
417
|
target: "_blank",
|
|
489
418
|
style: { color: "inherit" },
|
|
@@ -491,13 +420,9 @@ var hydrateLinks = (str, onLinkClick = () => {}) => {
|
|
|
491
420
|
href: "https://www.washingtonpost.com/privacy-policy/",
|
|
492
421
|
onClick: (e) => onLinkClick(e),
|
|
493
422
|
children: "Privacy Policy"
|
|
494
|
-
}, `privacy-link-${i}
|
|
495
|
-
fileName: _jsxFileName$3,
|
|
496
|
-
lineNumber: 13,
|
|
497
|
-
columnNumber: 9
|
|
498
|
-
}, void 0);
|
|
423
|
+
}, `privacy-link-${i}`);
|
|
499
424
|
return chunk;
|
|
500
|
-
}).reduce((prev, current) => /* @__PURE__ */ (0,
|
|
425
|
+
}).reduce((prev, current) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [prev, current] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {}));
|
|
501
426
|
};
|
|
502
427
|
//#endregion
|
|
503
428
|
//#region src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts
|
|
@@ -569,7 +494,6 @@ var useOnetrust = ({ allowCookieStore }) => {
|
|
|
569
494
|
};
|
|
570
495
|
//#endregion
|
|
571
496
|
//#region src/components/DEDisclosure/DisclosureWithBannerStatus.tsx
|
|
572
|
-
var _jsxFileName$2 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/DisclosureWithBannerStatus.tsx";
|
|
573
497
|
var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = true, onPrivacyPolicyClick = () => {} }) => {
|
|
574
498
|
const [disclosure, setDisclosure] = (0, react.useState)(null);
|
|
575
499
|
const [disclosureRendering, setDisclosureRendering] = (0, react.useState)(null);
|
|
@@ -579,11 +503,7 @@ var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = tru
|
|
|
579
503
|
else setDisclosure(config.disclosure_beforebanner);
|
|
580
504
|
}, [alertBoxClosed]);
|
|
581
505
|
(0, react.useEffect)(() => {
|
|
582
|
-
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ (0,
|
|
583
|
-
fileName: _jsxFileName$2,
|
|
584
|
-
lineNumber: 55,
|
|
585
|
-
columnNumber: 15
|
|
586
|
-
}, void 0)] }, void 0, true), /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(react_jsx_dev_runtime.Fragment, {}, void 0, false)));
|
|
506
|
+
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [prev, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: hydrateLinks(current, onPrivacyPolicyClick) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})));
|
|
587
507
|
}, [disclosure]);
|
|
588
508
|
(0, react.useEffect)(() => {
|
|
589
509
|
if (disclosureRendering && consentCookieExists) onFinished({
|
|
@@ -595,7 +515,6 @@ var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = tru
|
|
|
595
515
|
};
|
|
596
516
|
//#endregion
|
|
597
517
|
//#region src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx
|
|
598
|
-
var _jsxFileName$1 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx";
|
|
599
518
|
var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {
|
|
600
519
|
const [disclosure, setDisclosure] = (0, react.useState)(null);
|
|
601
520
|
const [disclosureRendering, setDisclosureRendering] = (0, react.useState)(null);
|
|
@@ -603,11 +522,7 @@ var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClic
|
|
|
603
522
|
if (config) setDisclosure(config.disclosure);
|
|
604
523
|
}, [config]);
|
|
605
524
|
(0, react.useEffect)(() => {
|
|
606
|
-
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ (0,
|
|
607
|
-
fileName: _jsxFileName$1,
|
|
608
|
-
lineNumber: 38,
|
|
609
|
-
columnNumber: 15
|
|
610
|
-
}, void 0)] }, void 0, true), /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(react_jsx_dev_runtime.Fragment, {}, void 0, false)));
|
|
525
|
+
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [prev, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: hydrateLinks(current, onPrivacyPolicyClick) })] }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {})));
|
|
611
526
|
}, [disclosure]);
|
|
612
527
|
(0, react.useEffect)(() => {
|
|
613
528
|
if (disclosureRendering) onFinished({
|
|
@@ -619,7 +534,6 @@ var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClic
|
|
|
619
534
|
};
|
|
620
535
|
//#endregion
|
|
621
536
|
//#region src/components/DEDisclosure/index.tsx
|
|
622
|
-
var _jsxFileName = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/index.tsx";
|
|
623
537
|
var DEDisclosure = ({ onFinished = () => {}, allowCookieStore = true, onPrivacyPolicyClick = () => {} }) => {
|
|
624
538
|
const [disclosureRendering, setDisclosureRendering] = (0, react.useState)(null);
|
|
625
539
|
const [myConfig, setMyConfig] = (0, react.useState)();
|
|
@@ -631,40 +545,24 @@ var DEDisclosure = ({ onFinished = () => {}, allowCookieStore = true, onPrivacyP
|
|
|
631
545
|
})();
|
|
632
546
|
}, []);
|
|
633
547
|
(0, react.useEffect)(() => {
|
|
634
|
-
if (myConfig) if ("checkBannerStatus" in myConfig && myConfig.checkBannerStatus) setDisclosureRendering(/* @__PURE__ */ (0,
|
|
548
|
+
if (myConfig) if ("checkBannerStatus" in myConfig && myConfig.checkBannerStatus) setDisclosureRendering(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DEDisclosureWithBannerStatus, {
|
|
635
549
|
config: myConfig,
|
|
636
550
|
allowCookieStore,
|
|
637
551
|
onFinished,
|
|
638
552
|
onPrivacyPolicyClick
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
lineNumber: 55,
|
|
642
|
-
columnNumber: 11
|
|
643
|
-
}, void 0));
|
|
644
|
-
else if ("disclosure" in myConfig) setDisclosureRendering(/* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)(DEDisclosureWithoutBannerStatus, {
|
|
553
|
+
}));
|
|
554
|
+
else if ("disclosure" in myConfig) setDisclosureRendering(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(DEDisclosureWithoutBannerStatus, {
|
|
645
555
|
config: myConfig,
|
|
646
556
|
onFinished,
|
|
647
557
|
onPrivacyPolicyClick
|
|
648
|
-
}
|
|
649
|
-
fileName: _jsxFileName,
|
|
650
|
-
lineNumber: 64,
|
|
651
|
-
columnNumber: 11
|
|
652
|
-
}, void 0));
|
|
558
|
+
}));
|
|
653
559
|
else console.error("Invalid config");
|
|
654
560
|
}, [myConfig]);
|
|
655
|
-
if (disclosureRendering) return /* @__PURE__ */ (0,
|
|
561
|
+
if (disclosureRendering) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
656
562
|
"data-test-id": "de-disclosure",
|
|
657
563
|
children: disclosureRendering
|
|
658
|
-
}
|
|
659
|
-
|
|
660
|
-
lineNumber: 77,
|
|
661
|
-
columnNumber: 12
|
|
662
|
-
}, void 0);
|
|
663
|
-
return /* @__PURE__ */ (0, react_jsx_dev_runtime.jsxDEV)("div", { "data-test-id": "de-disclosure-loading" }, void 0, false, {
|
|
664
|
-
fileName: _jsxFileName,
|
|
665
|
-
lineNumber: 80,
|
|
666
|
-
columnNumber: 10
|
|
667
|
-
}, void 0);
|
|
564
|
+
});
|
|
565
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { "data-test-id": "de-disclosure-loading" });
|
|
668
566
|
};
|
|
669
567
|
//#endregion
|
|
670
568
|
//#region src/constants/IngestDataTypes.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxClosedCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/sendToGA.ts","../src/services/ingest.ts","../src/utils/isAnonymousWebview.ts","../src/utils/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts","../src/components/DEDisclosure/hooks/useOnetrust.ts","../src/components/DEDisclosure/DisclosureWithBannerStatus.tsx","../src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\n\nexport type AttributeValue = {\n name: string;\n date_created: number;\n last_modified_date: number;\n archived: boolean;\n order: number;\n};\n\nexport const CollectionBehaviors = {\n COLLECT: 'COLLECT',\n DO_NOT_COLLECT: 'DO_NOT_COLLECT',\n} as const;\n\nexport type Attribute = {\n name: string;\n approved_for_use?: boolean;\n collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];\n datatype: string;\n explicit: boolean;\n multiple_value: boolean;\n last_modified_date: number;\n date_created: number;\n values: AttributeValue[] | Readonly<AttributeValue[]>;\n};\n\nexport const AttributesState = {\n SUCCESS: '100',\n} as const;\n\n// https://github.com/WashPost/subs-be-user-data-enrichment/blob/8e8f8460c59adbe9c83b50f368bff1d3300bfd6b/src/main/java/washpost/paywall/userdataenrichment/model/ResponseState.java#L19\nexport const DeleteAttributeState = {\n SUCCESS: '150',\n SYSTEM_ERROR: '151',\n INVALID_ATTRIBUTE_NAME: '152',\n INVALID_ATTRIBUTE_NOT_EXISTS: '153',\n} as const;\n\nexport const IngestType = {\n EXPLICIT: 'explicit',\n IMPLICIT: 'implicit',\n} as const;\n\nexport const IngestResponseState = {\n SUCCESS: '100',\n SYSTEM_ERROR: '101',\n INVALID_TYPE: '102',\n INVALID_IDENTIFIER: '103',\n INVALID_DATA: '104',\n INVALID_ATTRIBUTE_DEFINITION: '105',\n INVALID_META_DEFINITION: '106',\n UNAUTHENTICATED: '107',\n MISMATCHED_IDENTIFIER: '108',\n DISABLED_ATTRIBUTE_DEFINITION: '109',\n DO_NOT_COLLECT: '110',\n} as const;\n\nexport interface IProfileResponse {\n status: ResponseStatusType;\n state: (typeof AttributesState)[keyof typeof AttributesState];\n attributes: {\n [key: string]: {\n attribute_name: string;\n value: string | null;\n date_created: number;\n last_modified_date: number;\n };\n };\n}\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\n/**\n * Checks the users OptanonConsent cookie to determine if the user has allowed targeting.\n * Returns true or false if the flag is found in the cookie, null otherwise.\n * @returns {boolean | null}\n */\nexport const checkConsentCookieForAllowTargeting = () => {\n const value = getCookie(COOKIE) || '';\n return value.includes('C0004%3A1')\n ? true\n : value.includes('C0004%3A0')\n ? false\n : null;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxClosedCookie = () => {\n const value = getCookie(COOKIE) || '';\n // Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)\n // \"Invalid date\" is 12 characters long\n return value.length > 12;\n};\n","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\nimport { checkConsentCookieForAllowTargeting } from './checkConsentCookieForAllowTargeting';\nimport { checkAlertBoxClosedCookie } from '../components/DEDisclosure/utils/checkAlertBoxClosedCookie';\n\n/**\n * Checks privacy cookies to decide if we can send up 1pd\n * If US, checks that wp_usp exists\n * Else If OptAnonConsent cookie exists, checks the value of targeting cookies consent\n * Else If EEA, always returns true\n * Else, returns false\n * @returns {boolean}\n */\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const { intl_region, country_code: countryCode } = WPGeo();\n\n if (countryCode === 'US') {\n return !!getCookie('wp_usp');\n }\n\n if (window.pageType === 'onboarding') {\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (\n typeof gdprAllowTargarting === 'boolean' &&\n checkAlertBoxClosedCookie()\n ) {\n return gdprAllowTargarting;\n }\n\n // Downstream systems\n // Checking for window.pageType === 'onboarding' to avoid being true on graphics articles etc for now -- MNI-710\n if (intl_region === 'EEA' && window.pageType === 'onboarding') {\n return true;\n }\n }\n\n return false;\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n DEFAULT_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport type { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n\nconst attributesCache: Record<string, any> = {};\nexport const getAttributes: GetAttributesType = async ({\n fieldName,\n}: {\n fieldName: string;\n}) => {\n if (attributesCache[fieldName]) {\n return attributesCache[fieldName];\n }\n\n const fieldNames = [fieldName];\n\n try {\n const url = new URL(`${base}/attributes`);\n url.searchParams.set('attributes', fieldNames.join(','));\n\n const data = await fetch(url.toString(), {\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n });\n const json = await data.json();\n\n if (data.ok && json.status === ResponseStatus.SUCCESS) {\n const attributes = json.attributes || [];\n attributesCache[fieldName] = attributes;\n return attributes;\n }\n return [];\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n","const sendGAEvent = (props: {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}): void => {\n if (typeof window === 'undefined') {\n if (__DEV__) console.warn('NO WINDOW');\n return;\n }\n // Initialize dataLayer if needed\n window.dataLayer = window.dataLayer || [];\n\n const eventData: Record<string, any> = {\n ...props,\n };\n window.dataLayer.push(eventData);\n};\n\ntype SendToGaType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<true>;\n\nexport const sendToGA: SendToGaType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n sendGAEvent({\n event: 'site-onpage-click',\n action: 'site-onpage-click',\n category: 'profile',\n\n label: fieldName,\n 'de-label': fieldName,\n [fieldName]: value,\n\n section: 'profile',\n subsection: source,\n });\n\n return true;\n};\n","import {\n ENDPOINTS,\n DEFAULT_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { type IngestResponseState, IngestType } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n const jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type: IngestType.EXPLICIT,\n wapo_login_id, // TODO: move this to BE to read from cookie headers\n data: {\n [fieldName]: [value],\n },\n metadata: { source },\n };\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n body: JSON.stringify(payload),\n });\n\n const json = await response.json();\n\n return json;\n } catch (e) {\n console.debug(e);\n return null;\n }\n};\n\ntype IngestType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<{\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import { getCookie, isLoggedIn } from '@washingtonpost/subs-sdk';\n\nexport const isAnonymousWebview = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_wv = getCookie('wp_wv');\n\n return !!(wp_wv && !isLoggedIn());\n};\n","import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { CollectionBehaviors, IngestType } from '../interfaces';\nimport type { IngestResponseState } from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<\n | {\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n\nexport const push: PushType = async ({ submitData, source }) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n if (isAnonymousWebview()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const { fieldName } = submitData;\n\n const attributeInfo = await getAttributes({\n fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n const type =\n attributeInfo[0] && attributeInfo[0].explicit === true\n ? IngestType.EXPLICIT\n : IngestType.IMPLICIT;\n\n if (!attributeInfo[0] && __DEV__) {\n console.warn(`no attribute info found for ${fieldName}, assuming implicit`);\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, source });\n }\n return sendToGA({ submitData, source });\n};\n","import React, { useEffect, useState } from 'react';\nimport { Icon, Select, styled, theme } from '@washingtonpost/wpds-ui-kit';\nimport { useWindowSize } from '@washingtonpost/subs-hooks';\nimport { ChevronDown } from '@washingtonpost/wpds-assets';\n\ninterface IDropdownProps {\n id: string;\n label: string;\n values: Array<string>;\n required?: boolean;\n existingValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n valueSelectedByDefault?: string;\n}\n\nconst StyledMobileSelect = styled('select', {\n padding: '12px 16px 12px 6px',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n backgroundColor: '$secondary',\n color: '$primary',\n fontFamily: '$meta',\n fontSize: '$100',\n fontWeight: '$light',\n lineHeight: '$125',\n paddingBlockRight: '$125',\n textOverflow: 'ellipsis',\n position: 'relative',\n borderColor: 'transparent',\n borderRightWidth: '10px',\n borderRightColor: 'transparent',\n appearance: 'none',\n '-webkit-appearance': 'none',\n '&:disabled': {\n backgroundColor: theme.colors.disabled,\n borderColor: theme.colors.disabled,\n color: theme.colors.onDisabled,\n cursor: 'not-allowed',\n },\n});\n\nconst StyledSelectWrapper = styled('div', {\n width: '100%',\n maxWidth: '380px',\n borderRadius: '$012',\n borderColor: '$subtle',\n borderStyle: 'solid',\n borderWidth: '1px',\n backgroundColor: '$secondary',\n position: 'relative',\n});\n\nconst StyledMobileOption = styled('option', {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n color: 'inherit',\n});\n\n/**\n * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.\n * @param {IDropdownProps} props The props.\n * @returns {React.ReactElement} The dropdown.\n */\nexport const Dropdown = ({\n id,\n label,\n values,\n required = false,\n existingValue,\n onChange = () => {},\n disabled = false,\n valueSelectedByDefault,\n}: IDropdownProps) => {\n const [answer, setAnswer] = useState<string>();\n const { isMobileSize } = useWindowSize();\n\n useEffect(() => {\n if (answer) onChange(answer);\n }, [answer]);\n\n const disabledProp = disabled ? { disabled: true } : {};\n\n const presetDropdownValue = existingValue || valueSelectedByDefault;\n\n // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : presetDropdownValue\n ? { defaultValue: presetDropdownValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === presetDropdownValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n {...disabledProp}\n >\n <label>{label}</label>\n <StyledMobileOption\n value=\"\"\n disabled\n selected\n style={{ color: '#666666' }}\n >\n {label}\n </StyledMobileOption>\n {values.map((value) => (\n <StyledMobileOption\n value={value}\n key={value}\n {...defaultValuePropMobile(value)}\n >\n {value}\n </StyledMobileOption>\n ))}\n </StyledMobileSelect>\n <Icon\n label=\"\"\n size=\"100\"\n fill={theme.colors.gray80}\n style={{\n pointerEvents: 'none',\n position: 'absolute',\n right: '10px',\n top: '50%',\n transform: 'translateY(-50%)',\n }}\n >\n <ChevronDown style={{ position: 'absolute', right: '10px' }} />\n </Icon>\n </StyledSelectWrapper>\n ) : (\n <Select.Root\n onValueChange={(e) => setAnswer(e)}\n required={required}\n {...defaultValueProp}\n {...disabledProp}\n >\n <Select.Trigger data-test-id={`${id}-select-trigger`}>\n <Select.Label>{label}</Select.Label>\n <Select.Value />\n </Select.Trigger>\n <Select.Content\n css={{ zIndex: theme.zIndices.page }}\n data-test-id={`${id}-select-content`}\n >\n {values.map((value) => (\n <Select.Item value={value} key={value}>\n {value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Select, styled } from '@washingtonpost/wpds-ui-kit';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport type { Attribute, AttributeValue } from '../../interfaces';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n existingValue?: string;\n disabled?: boolean;\n submit: boolean;\n onChange?: ({ value }: { value: string }) => void;\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n valuesFilter?: (value: AttributeValue) => boolean;\n selectProps?: {\n root?: any;\n trigger?: any;\n label?: any;\n value?: any;\n content?: any;\n item?: any;\n };\n children?: React.ReactNode;\n valueSelectedByDefault?: string;\n defaultValue?: never;\n}\n\nconst scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;\n\nconst SelectWrapper = styled('div', {\n boxSizing: 'border-box',\n display: 'flex',\n marginBottom: '$100',\n flexDirection: 'column',\n '& button': {\n padding: '1px 6px',\n },\n '& *': { boxSizing: 'border-box' },\n});\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n existingValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n valueSelectedByDefault,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState(\n !existingValue && valueSelectedByDefault ? valueSelectedByDefault : ''\n );\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const config = await window?.__twpdeu?.getFieldConfigs({\n fieldName,\n });\n if (config) {\n setConfig(config[0]);\n } else {\n console.error('unable to get config', fieldName);\n }\n } catch (e) {\n console.warn('unable to get config', fieldName, e);\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && !(children || config)) {\n fetchConfig();\n }\n }, [scriptStatus]);\n\n useEffect(() => {\n const submitSelected = async () => {\n try {\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n source,\n });\n\n const isError =\n result === true\n ? false\n : result\n ? result.status !== ResponseStatus.SUCCESS\n : true;\n\n onFinished({\n isFinished: true,\n isError,\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n onFinished({\n isFinished: false,\n isError: true,\n });\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && submit && selected) {\n submitSelected();\n }\n }, [scriptStatus, submit]);\n\n const defaultValueProp =\n existingValue && config ? { defaultValue: existingValue } : {};\n\n const isLoading = !(children || config);\n\n const disabledProp = disabled || isLoading ? { disabled: true } : {};\n\n // sort and filter out archived values\n // Note: config.values may be readonly\n const values = config\n ? [...config.values]\n .sort((a, b) => a.order - b.order)\n .filter((value) => value.archived !== true)\n .filter(valuesFilter)\n : [];\n\n return (\n <SelectWrapper>\n {children && (\n <Select.Root\n onValueChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n {...defaultValueProp}\n {...disabledProp}\n >\n {children}\n </Select.Root>\n )}\n {!children && !config && (\n <Dropdown\n id={'loading'}\n label={'Loading...'}\n values={[]}\n disabled={true}\n />\n )}\n {!children && config && (\n <Dropdown\n id={config.name}\n label={label || config.name}\n onChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n values={values.map((value) => value.name)}\n existingValue={existingValue}\n disabled={disabled}\n valueSelectedByDefault={valueSelectedByDefault}\n />\n )}\n </SelectWrapper>\n );\n};\n","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport type {\n DisclosureConfig,\n DisclosureConfigValue,\n} from '../../../interfaces/disclosure';\n\nconst configSrc = `${\n ENDPOINTS.base === 'https://subscribe.washingtonpost.com'\n ? 'https://www.washingtonpost.com/subscribe'\n : ENDPOINTS.base\n}/config/de/disclosure.json`;\n\nexport const getConfig = async () => {\n let myConfig: DisclosureConfigValue | undefined;\n\n // step 1: fetch config\n const response = await fetch(configSrc);\n const remoteConfig: DisclosureConfig = await response.json();\n\n // step 2: figure out which part of the config to use\n\n // if country- or region-specific config found, use that\n const { country_code, intl_region } = WPGeo();\n Object.keys(remoteConfig).forEach((configKey) => {\n if (\n country_code &&\n configKey.split('|').includes(country_code.toLowerCase())\n ) {\n myConfig = remoteConfig[configKey];\n } else if (intl_region === 'EEA' && configKey === 'eea') {\n myConfig = remoteConfig[configKey];\n }\n });\n\n // TODO: Check for billing country also\n\n // else if no country-specific config, use the default config\n if (typeof myConfig === 'undefined' && remoteConfig._) {\n myConfig = remoteConfig._;\n }\n\n return myConfig;\n};\n","import React from 'react';\n\ntype hydrateLinksType = (\n str: string,\n onLinkClick: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str, onLinkClick = () => {}) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((chunk, i) => {\n if (chunk === '{{PRIVACY_POLICY}}') {\n return (\n <a\n key={`privacy-link-${i}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n onClick={(e) => onLinkClick(e)}\n >\n Privacy Policy\n </a>\n );\n }\n return chunk;\n });\n\n const toReturn = chunks.reduce(\n (prev, current) => (\n <>\n {prev}\n {current}\n </>\n ),\n <></>\n );\n\n return toReturn;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\nexport const checkOptanonConsentCookie = () => {\n const value = getCookie(COOKIE) || '';\n return value.length > 12;\n};\n","import { useState, useEffect } from 'react';\nimport type { ICookieStore } from '@washingtonpost/subs-sdk';\nimport { listenToCookieStore as listenToCookieStoreUtil } from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxClosedCookie } from '../utils/checkAlertBoxClosedCookie';\nimport { checkOptanonConsentCookie } from '../utils/checkOptAnonConsentCookie';\n\nconst CONSENT_COOKIE = 'OptanonConsent';\n\nconst ALERT_BOX_COOKIE = 'OptanonAlertBoxClosed';\n\ninterface TCData {\n eventStatus: 'tcloaded' | 'cmpuishown' | 'useractioncomplete';\n listenerId: number;\n [key: string]: any;\n}\n\ntype TCFAPIAddListener = (\n command: 'addEventListener',\n version: number,\n callback: (tcData: TCData, success: boolean) => void\n) => void;\n\ntype TCFAPIRmListener = (\n command: 'removeEventListener',\n version: number,\n callback: (success: boolean) => void,\n listenerId: number\n) => void;\n\ntype TCFAPIPing = (\n command: 'ping',\n version: number,\n callback: (pingReturn: any, success: boolean) => void\n) => void;\n\ndeclare global {\n interface Window {\n cookieStore?: ICookieStore;\n __tcfapi?: TCFAPIAddListener & TCFAPIRmListener & TCFAPIPing;\n }\n}\n\nexport const useOnetrust = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\n}) => {\n const [consentCookieExists, setConsentCookieExists] = useState<\n boolean | undefined\n >();\n const [alertBoxClosed, setAlertBoxClosed] = useState<boolean | undefined>();\n\n const [listenToCookieStore, setListenToCookieStore] = useState(false);\n const [listenToTcfApi, setListenToTcfApi] = useState(false);\n\n useEffect(() => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n return;\n }\n\n if (!window.__tcfapi) {\n console.warn('warning: __tcfapi not found');\n }\n\n if (window?.cookieStore && allowCookieStore) {\n setListenToCookieStore(true);\n } else if (window.__tcfapi) {\n setListenToTcfApi(true);\n } else {\n console.warn('warning: neither cookieStore nor __tcfapi found');\n }\n }, []);\n\n useEffect(() => {\n const cleanupFns: ((() => void) | null)[] = [];\n if (listenToCookieStore && window.cookieStore) {\n const cleanupFn = listenToCookieStoreUtil(CONSENT_COOKIE, () => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n });\n cleanupFns.push(cleanupFn);\n\n const cleanupFn2 = listenToCookieStoreUtil(ALERT_BOX_COOKIE, () => {\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n cleanupFns.push(cleanupFn2);\n }\n return () => {\n cleanupFns.forEach((fn) => fn && fn());\n };\n }, [listenToCookieStore]);\n\n useEffect(() => {\n let listenerId: number;\n if (listenToTcfApi && window.__tcfapi) {\n const callback = (_tcData: TCData, success: boolean) => {\n if (success) {\n listenerId = _tcData.listenerId;\n\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n // tcData.eventStatus can be:\n // tcloaded means user has made a choice and we’re ready to check it\n // cmpuishown means the banner is shown\n // useractioncomplete means the user has interacted with the banner\n\n // but actually if the result for any of these is true, we just use the value of the cookie\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n }\n }\n };\n\n window.__tcfapi('addEventListener', 2, callback);\n }\n\n // cleanup fn\n return () => {\n if (window.__tcfapi && listenerId)\n window.__tcfapi(\n 'removeEventListener',\n 2,\n (success) => {\n console.debug(success);\n },\n listenerId\n );\n };\n }, [listenToTcfApi]);\n\n return {\n consentCookieExists,\n alertBoxClosed,\n listenToCookieStore,\n listenToTcfApi,\n };\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOnetrust } from './hooks/useOnetrust';\n\ninterface DEDisclosureWithBannerStatusProps {\n config: DisclosureConfigValue;\n allowCookieStore?: boolean;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithBannerStatus: React.FC<\n DEDisclosureWithBannerStatusProps\n> = ({\n config,\n onFinished,\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n const { alertBoxClosed, consentCookieExists } = useOnetrust({\n allowCookieStore,\n });\n\n useEffect(() => {\n if (config) {\n // step 3: set disclosure based on config\n\n if (alertBoxClosed) {\n setDisclosure(config.disclosure_afterbanner);\n } else {\n setDisclosure(config.disclosure_beforebanner);\n }\n }\n }, [alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering && consentCookieExists) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering, consentCookieExists]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\n\ninterface DEDisclosureWithoutBannerStatusProps {\n config: DisclosureConfigValue;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithoutBannerStatus: React.FC<\n DEDisclosureWithoutBannerStatusProps\n> = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n useEffect(() => {\n if (config) {\n setDisclosure(config.disclosure);\n }\n }, [config]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { DEDisclosureWithBannerStatus } from './DisclosureWithBannerStatus';\nimport { DEDisclosureWithoutBannerStatus } from './DisclosureWithoutBannerStatus';\n\ninterface DisclosureProps {\n /** callback function to be called when the disclosure is finished loading */\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n\n /** ability to turn off cookiestore listener, primarily for testing purposes */\n allowCookieStore?: boolean;\n}\n\nexport const DEDisclosure: React.FC<DisclosureProps> = ({\n onFinished = () => {},\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n const [myConfig, setMyConfig] = useState<DisclosureConfigValue>();\n // const { alertBoxClosed } = useOneTrustAlertBoxClosed({ allowCookieStore });\n\n useEffect(() => {\n (async () => {\n const config = await getConfig();\n setMyConfig(config);\n\n if (!config) {\n console.error('No config found');\n }\n })();\n }, []);\n\n useEffect(() => {\n if (myConfig) {\n // step 3: set disclosure based on config\n\n // if config says to check onetrust, check onetrust\n if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {\n // check if onetrust is closed\n // if it is, show the after banner disclosure\n // if it is not, show the before banner disclosure\n setDisclosureRendering(\n <DEDisclosureWithBannerStatus\n config={myConfig}\n allowCookieStore={allowCookieStore}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else if ('disclosure' in myConfig) {\n setDisclosureRendering(\n <DEDisclosureWithoutBannerStatus\n config={myConfig}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig]);\n\n if (disclosureRendering) {\n return <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>;\n }\n\n return <div data-test-id=\"de-disclosure-loading\"></div>;\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\n JOB_TITLE: 'profile_job_title',\n PERSONAL_GOALS: 'personal_goals',\n HOBBIES: 'hobbies',\n PROFESSIONAL_GOALS: 'professional_goals',\n INDUSTRY: 'industry',\n NEWS_LOCATION: 'news_location',\n NY_PERSONAL_GOALS: 'new_year_personal_goals',\n NY_HOBBIES: 'new_year_hobbies',\n NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',\n NY_INDUSTRY: 'new_year_industry',\n NY_NEWS_LOCATION: 'new_year_news_location',\n EDU_ROLE: 'profile_edu_role',\n EDU_MAJOR: 'profile_edu_major',\n EDU_GRADUATION_YEAR: 'profile_edu_graduation_year',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAa,sBAAsB;CACjC,SAAS;CACT,gBAAgB;CACjB;AAcD,IAAa,kBAAkB,EAC7B,SAAS,OACV;AAGD,IAAa,uBAAuB;CAClC,SAAS;CACT,cAAc;CACd,wBAAwB;CACxB,8BAA8B;CAC/B;AAED,IAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACX;AAED,IAAa,sBAAsB;CACjC,SAAS;CACT,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,cAAc;CACd,8BAA8B;CAC9B,yBAAyB;CACzB,iBAAiB;CACjB,uBAAuB;CACvB,+BAA+B;CAC/B,gBAAgB;CACjB;;;ACtDD,IAAM,WAAS;;;;;;AAOf,IAAa,4CAA4C;CACvD,MAAM,SAAA,GAAA,yBAAA,WAAkB,SAAO,IAAI;AACnC,QAAO,MAAM,SAAS,YAAY,GAC9B,OACA,MAAM,SAAS,YAAY,GACzB,QACA;;;;ACbR,IAAM,WAAS;AAEf,IAAa,kCAAkC;AAI7C,UAAA,GAAA,yBAAA,WAHwB,SAAO,IAAI,IAGtB,SAAS;;;;;;;;;;;;ACIxB,IAAa,kCAAkC;AAC7C,KAAI,OAAO,WAAW,YACpB,QAAO;CAGT,MAAM,E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,OAAO;AAEnB,OAAI,CAAC,OACH,SAAQ,MAAM,kBAAkB;MAEhC;IACH,EAAE,CAAC;AAEN,EAAA,GAAA,MAAA,iBAAgB;AACd,MAAI,SAIF,KAAI,uBAAuB,YAAY,SAAS,kBAI9C,wBACE,iBAAA,GAAA,sBAAA,QAAC,8BAAD;GACE,QAAQ;GACU;GACN;GACU;GACtB,EAAA,KAAA,GAAA,OAAA;;;;aACH;WACQ,gBAAgB,SACzB,wBACE,iBAAA,GAAA,sBAAA,QAAC,iCAAD;GACE,QAAQ;GACI;GACU;GACtB,EAAA,KAAA,GAAA,OAAA;;;;aACH;MAED,SAAQ,MAAM,iBAAiB;IAGlC,CAAC,SAAS,CAAC;AAEd,KAAI,oBACF,QAAO,iBAAA,GAAA,sBAAA,QAAC,OAAD;EAAK,gBAAa;YAAiB;EAA0B,EAAA,KAAA,GAAA,OAAA;;;;;AAGtE,QAAO,iBAAA,GAAA,sBAAA,QAAC,OAAD,EAAK,gBAAa,yBAA8B,EAAA,KAAA,GAAA,OAAA;;;;;;;;AC/EzD,IAAa,4BAA4B;CACvC,WAAW;CACX,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,eAAe;CACf,mBAAmB;CACnB,YAAY;CACZ,uBAAuB;CACvB,aAAa;CACb,kBAAkB;CAClB,UAAU;CACV,WAAW;CACX,qBAAqB;CACtB"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxClosedCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/sendToGA.ts","../src/services/ingest.ts","../src/utils/isAnonymousWebview.ts","../src/utils/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts","../src/components/DEDisclosure/hooks/useOnetrust.ts","../src/components/DEDisclosure/DisclosureWithBannerStatus.tsx","../src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\n\nexport type AttributeValue = {\n name: string;\n date_created: number;\n last_modified_date: number;\n archived: boolean;\n order: number;\n};\n\nexport const CollectionBehaviors = {\n COLLECT: 'COLLECT',\n DO_NOT_COLLECT: 'DO_NOT_COLLECT',\n} as const;\n\nexport type Attribute = {\n name: string;\n approved_for_use?: boolean;\n collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];\n datatype: string;\n explicit: boolean;\n multiple_value: boolean;\n last_modified_date: number;\n date_created: number;\n values: AttributeValue[] | Readonly<AttributeValue[]>;\n};\n\nexport const AttributesState = {\n SUCCESS: '100',\n} as const;\n\n// https://github.com/WashPost/subs-be-user-data-enrichment/blob/8e8f8460c59adbe9c83b50f368bff1d3300bfd6b/src/main/java/washpost/paywall/userdataenrichment/model/ResponseState.java#L19\nexport const DeleteAttributeState = {\n SUCCESS: '150',\n SYSTEM_ERROR: '151',\n INVALID_ATTRIBUTE_NAME: '152',\n INVALID_ATTRIBUTE_NOT_EXISTS: '153',\n} as const;\n\nexport const IngestType = {\n EXPLICIT: 'explicit',\n IMPLICIT: 'implicit',\n} as const;\n\nexport const IngestResponseState = {\n SUCCESS: '100',\n SYSTEM_ERROR: '101',\n INVALID_TYPE: '102',\n INVALID_IDENTIFIER: '103',\n INVALID_DATA: '104',\n INVALID_ATTRIBUTE_DEFINITION: '105',\n INVALID_META_DEFINITION: '106',\n UNAUTHENTICATED: '107',\n MISMATCHED_IDENTIFIER: '108',\n DISABLED_ATTRIBUTE_DEFINITION: '109',\n DO_NOT_COLLECT: '110',\n} as const;\n\nexport interface IProfileResponse {\n status: ResponseStatusType;\n state: (typeof AttributesState)[keyof typeof AttributesState];\n attributes: {\n [key: string]: {\n attribute_name: string;\n value: string | null;\n date_created: number;\n last_modified_date: number;\n };\n };\n}\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\n/**\n * Checks the users OptanonConsent cookie to determine if the user has allowed targeting.\n * Returns true or false if the flag is found in the cookie, null otherwise.\n * @returns {boolean | null}\n */\nexport const checkConsentCookieForAllowTargeting = () => {\n const value = getCookie(COOKIE) || '';\n return value.includes('C0004%3A1')\n ? true\n : value.includes('C0004%3A0')\n ? false\n : null;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxClosedCookie = () => {\n const value = getCookie(COOKIE) || '';\n // Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)\n // \"Invalid date\" is 12 characters long\n return value.length > 12;\n};\n","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\nimport { checkConsentCookieForAllowTargeting } from './checkConsentCookieForAllowTargeting';\nimport { checkAlertBoxClosedCookie } from '../components/DEDisclosure/utils/checkAlertBoxClosedCookie';\n\n/**\n * Checks privacy cookies to decide if we can send up 1pd\n * If US, checks that wp_usp exists\n * Else If OptAnonConsent cookie exists, checks the value of targeting cookies consent\n * Else If EEA, always returns true\n * Else, returns false\n * @returns {boolean}\n */\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const { intl_region, country_code: countryCode } = WPGeo();\n\n if (countryCode === 'US') {\n return !!getCookie('wp_usp');\n }\n\n if (window.pageType === 'onboarding') {\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (\n typeof gdprAllowTargarting === 'boolean' &&\n checkAlertBoxClosedCookie()\n ) {\n return gdprAllowTargarting;\n }\n\n // Downstream systems\n // Checking for window.pageType === 'onboarding' to avoid being true on graphics articles etc for now -- MNI-710\n if (intl_region === 'EEA' && window.pageType === 'onboarding') {\n return true;\n }\n }\n\n return false;\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n DEFAULT_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport type { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n\nconst attributesCache: Record<string, any> = {};\nexport const getAttributes: GetAttributesType = async ({\n fieldName,\n}: {\n fieldName: string;\n}) => {\n if (attributesCache[fieldName]) {\n return attributesCache[fieldName];\n }\n\n const fieldNames = [fieldName];\n\n try {\n const url = new URL(`${base}/attributes`);\n url.searchParams.set('attributes', fieldNames.join(','));\n\n const data = await fetch(url.toString(), {\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n });\n const json = await data.json();\n\n if (data.ok && json.status === ResponseStatus.SUCCESS) {\n const attributes = json.attributes || [];\n attributesCache[fieldName] = attributes;\n return attributes;\n }\n return [];\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n","const sendGAEvent = (props: {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}): void => {\n if (typeof window === 'undefined') {\n if (__DEV__) console.warn('NO WINDOW');\n return;\n }\n // Initialize dataLayer if needed\n window.dataLayer = window.dataLayer || [];\n\n const eventData: Record<string, any> = {\n ...props,\n };\n window.dataLayer.push(eventData);\n};\n\ntype SendToGaType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<true>;\n\nexport const sendToGA: SendToGaType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n sendGAEvent({\n event: 'site-onpage-click',\n action: 'site-onpage-click',\n category: 'profile',\n\n label: fieldName,\n 'de-label': fieldName,\n [fieldName]: value,\n\n section: 'profile',\n subsection: source,\n });\n\n return true;\n};\n","import {\n ENDPOINTS,\n DEFAULT_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { type IngestResponseState, IngestType } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n const jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type: IngestType.EXPLICIT,\n wapo_login_id, // TODO: move this to BE to read from cookie headers\n data: {\n [fieldName]: [value],\n },\n metadata: { source },\n };\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n body: JSON.stringify(payload),\n });\n\n const json = await response.json();\n\n return json;\n } catch (e) {\n console.debug(e);\n return null;\n }\n};\n\ntype IngestType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<{\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import { getCookie, isLoggedIn } from '@washingtonpost/subs-sdk';\n\nexport const isAnonymousWebview = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_wv = getCookie('wp_wv');\n\n return !!(wp_wv && !isLoggedIn());\n};\n","import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { CollectionBehaviors, IngestType } from '../interfaces';\nimport type { IngestResponseState } from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<\n | {\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n\nexport const push: PushType = async ({ submitData, source }) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n if (isAnonymousWebview()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const { fieldName } = submitData;\n\n const attributeInfo = await getAttributes({\n fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n const type =\n attributeInfo[0] && attributeInfo[0].explicit === true\n ? IngestType.EXPLICIT\n : IngestType.IMPLICIT;\n\n if (!attributeInfo[0] && __DEV__) {\n console.warn(`no attribute info found for ${fieldName}, assuming implicit`);\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, source });\n }\n return sendToGA({ submitData, source });\n};\n","import React, { useEffect, useState } from 'react';\nimport { Icon, Select, styled, theme } from '@washingtonpost/wpds-ui-kit';\nimport { useWindowSize } from '@washingtonpost/subs-hooks';\nimport { ChevronDown } from '@washingtonpost/wpds-assets';\n\ninterface IDropdownProps {\n id: string;\n label: string;\n values: Array<string>;\n required?: boolean;\n existingValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n valueSelectedByDefault?: string;\n}\n\nconst StyledMobileSelect = styled('select', {\n padding: '12px 16px 12px 6px',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n backgroundColor: '$secondary',\n color: '$primary',\n fontFamily: '$meta',\n fontSize: '$100',\n fontWeight: '$light',\n lineHeight: '$125',\n paddingBlockRight: '$125',\n textOverflow: 'ellipsis',\n position: 'relative',\n borderColor: 'transparent',\n borderRightWidth: '10px',\n borderRightColor: 'transparent',\n appearance: 'none',\n '-webkit-appearance': 'none',\n '&:disabled': {\n backgroundColor: theme.colors.disabled,\n borderColor: theme.colors.disabled,\n color: theme.colors.onDisabled,\n cursor: 'not-allowed',\n },\n});\n\nconst StyledSelectWrapper = styled('div', {\n width: '100%',\n maxWidth: '380px',\n borderRadius: '$012',\n borderColor: '$subtle',\n borderStyle: 'solid',\n borderWidth: '1px',\n backgroundColor: '$secondary',\n position: 'relative',\n});\n\nconst StyledMobileOption = styled('option', {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n color: 'inherit',\n});\n\n/**\n * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.\n * @param {IDropdownProps} props The props.\n * @returns {React.ReactElement} The dropdown.\n */\nexport const Dropdown = ({\n id,\n label,\n values,\n required = false,\n existingValue,\n onChange = () => {},\n disabled = false,\n valueSelectedByDefault,\n}: IDropdownProps) => {\n const [answer, setAnswer] = useState<string>();\n const { isMobileSize } = useWindowSize();\n\n useEffect(() => {\n if (answer) onChange(answer);\n }, [answer]);\n\n const disabledProp = disabled ? { disabled: true } : {};\n\n const presetDropdownValue = existingValue || valueSelectedByDefault;\n\n // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : presetDropdownValue\n ? { defaultValue: presetDropdownValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === presetDropdownValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n {...disabledProp}\n >\n <label>{label}</label>\n <StyledMobileOption\n value=\"\"\n disabled\n selected\n style={{ color: '#666666' }}\n >\n {label}\n </StyledMobileOption>\n {values.map((value) => (\n <StyledMobileOption\n value={value}\n key={value}\n {...defaultValuePropMobile(value)}\n >\n {value}\n </StyledMobileOption>\n ))}\n </StyledMobileSelect>\n <Icon\n label=\"\"\n size=\"100\"\n fill={theme.colors.gray80}\n style={{\n pointerEvents: 'none',\n position: 'absolute',\n right: '10px',\n top: '50%',\n transform: 'translateY(-50%)',\n }}\n >\n <ChevronDown style={{ position: 'absolute', right: '10px' }} />\n </Icon>\n </StyledSelectWrapper>\n ) : (\n <Select.Root\n onValueChange={(e) => setAnswer(e)}\n required={required}\n {...defaultValueProp}\n {...disabledProp}\n >\n <Select.Trigger data-test-id={`${id}-select-trigger`}>\n <Select.Label>{label}</Select.Label>\n <Select.Value />\n </Select.Trigger>\n <Select.Content\n css={{ zIndex: theme.zIndices.page }}\n data-test-id={`${id}-select-content`}\n >\n {values.map((value) => (\n <Select.Item value={value} key={value}>\n {value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Select, styled } from '@washingtonpost/wpds-ui-kit';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport type { Attribute, AttributeValue } from '../../interfaces';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n existingValue?: string;\n disabled?: boolean;\n submit: boolean;\n onChange?: ({ value }: { value: string }) => void;\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n valuesFilter?: (value: AttributeValue) => boolean;\n selectProps?: {\n root?: any;\n trigger?: any;\n label?: any;\n value?: any;\n content?: any;\n item?: any;\n };\n children?: React.ReactNode;\n valueSelectedByDefault?: string;\n defaultValue?: never;\n}\n\nconst scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;\n\nconst SelectWrapper = styled('div', {\n boxSizing: 'border-box',\n display: 'flex',\n marginBottom: '$100',\n flexDirection: 'column',\n '& button': {\n padding: '1px 6px',\n },\n '& *': { boxSizing: 'border-box' },\n});\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n existingValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n valueSelectedByDefault,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState(\n !existingValue && valueSelectedByDefault ? valueSelectedByDefault : ''\n );\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const config = await window?.__twpdeu?.getFieldConfigs({\n fieldName,\n });\n if (config) {\n setConfig(config[0]);\n } else {\n console.error('unable to get config', fieldName);\n }\n } catch (e) {\n console.warn('unable to get config', fieldName, e);\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && !(children || config)) {\n fetchConfig();\n }\n }, [scriptStatus]);\n\n useEffect(() => {\n const submitSelected = async () => {\n try {\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n source,\n });\n\n const isError =\n result === true\n ? false\n : result\n ? result.status !== ResponseStatus.SUCCESS\n : true;\n\n onFinished({\n isFinished: true,\n isError,\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n onFinished({\n isFinished: false,\n isError: true,\n });\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && submit && selected) {\n submitSelected();\n }\n }, [scriptStatus, submit]);\n\n const defaultValueProp =\n existingValue && config ? { defaultValue: existingValue } : {};\n\n const isLoading = !(children || config);\n\n const disabledProp = disabled || isLoading ? { disabled: true } : {};\n\n // sort and filter out archived values\n // Note: config.values may be readonly\n const values = config\n ? [...config.values]\n .sort((a, b) => a.order - b.order)\n .filter((value) => value.archived !== true)\n .filter(valuesFilter)\n : [];\n\n return (\n <SelectWrapper>\n {children && (\n <Select.Root\n onValueChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n {...defaultValueProp}\n {...disabledProp}\n >\n {children}\n </Select.Root>\n )}\n {!children && !config && (\n <Dropdown\n id={'loading'}\n label={'Loading...'}\n values={[]}\n disabled={true}\n />\n )}\n {!children && config && (\n <Dropdown\n id={config.name}\n label={label || config.name}\n onChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n values={values.map((value) => value.name)}\n existingValue={existingValue}\n disabled={disabled}\n valueSelectedByDefault={valueSelectedByDefault}\n />\n )}\n </SelectWrapper>\n );\n};\n","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport type {\n DisclosureConfig,\n DisclosureConfigValue,\n} from '../../../interfaces/disclosure';\n\nconst configSrc = `${\n ENDPOINTS.base === 'https://subscribe.washingtonpost.com'\n ? 'https://www.washingtonpost.com/subscribe'\n : ENDPOINTS.base\n}/config/de/disclosure.json`;\n\nexport const getConfig = async () => {\n let myConfig: DisclosureConfigValue | undefined;\n\n // step 1: fetch config\n const response = await fetch(configSrc);\n const remoteConfig: DisclosureConfig = await response.json();\n\n // step 2: figure out which part of the config to use\n\n // if country- or region-specific config found, use that\n const { country_code, intl_region } = WPGeo();\n Object.keys(remoteConfig).forEach((configKey) => {\n if (\n country_code &&\n configKey.split('|').includes(country_code.toLowerCase())\n ) {\n myConfig = remoteConfig[configKey];\n } else if (intl_region === 'EEA' && configKey === 'eea') {\n myConfig = remoteConfig[configKey];\n }\n });\n\n // TODO: Check for billing country also\n\n // else if no country-specific config, use the default config\n if (typeof myConfig === 'undefined' && remoteConfig._) {\n myConfig = remoteConfig._;\n }\n\n return myConfig;\n};\n","import React from 'react';\n\ntype hydrateLinksType = (\n str: string,\n onLinkClick: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str, onLinkClick = () => {}) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((chunk, i) => {\n if (chunk === '{{PRIVACY_POLICY}}') {\n return (\n <a\n key={`privacy-link-${i}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n onClick={(e) => onLinkClick(e)}\n >\n Privacy Policy\n </a>\n );\n }\n return chunk;\n });\n\n const toReturn = chunks.reduce(\n (prev, current) => (\n <>\n {prev}\n {current}\n </>\n ),\n <></>\n );\n\n return toReturn;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\nexport const checkOptanonConsentCookie = () => {\n const value = getCookie(COOKIE) || '';\n return value.length > 12;\n};\n","import { useState, useEffect } from 'react';\nimport type { ICookieStore } from '@washingtonpost/subs-sdk';\nimport { listenToCookieStore as listenToCookieStoreUtil } from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxClosedCookie } from '../utils/checkAlertBoxClosedCookie';\nimport { checkOptanonConsentCookie } from '../utils/checkOptAnonConsentCookie';\n\nconst CONSENT_COOKIE = 'OptanonConsent';\n\nconst ALERT_BOX_COOKIE = 'OptanonAlertBoxClosed';\n\ninterface TCData {\n eventStatus: 'tcloaded' | 'cmpuishown' | 'useractioncomplete';\n listenerId: number;\n [key: string]: any;\n}\n\ntype TCFAPIAddListener = (\n command: 'addEventListener',\n version: number,\n callback: (tcData: TCData, success: boolean) => void\n) => void;\n\ntype TCFAPIRmListener = (\n command: 'removeEventListener',\n version: number,\n callback: (success: boolean) => void,\n listenerId: number\n) => void;\n\ntype TCFAPIPing = (\n command: 'ping',\n version: number,\n callback: (pingReturn: any, success: boolean) => void\n) => void;\n\ndeclare global {\n interface Window {\n cookieStore?: ICookieStore;\n __tcfapi?: TCFAPIAddListener & TCFAPIRmListener & TCFAPIPing;\n }\n}\n\nexport const useOnetrust = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\n}) => {\n const [consentCookieExists, setConsentCookieExists] = useState<\n boolean | undefined\n >();\n const [alertBoxClosed, setAlertBoxClosed] = useState<boolean | undefined>();\n\n const [listenToCookieStore, setListenToCookieStore] = useState(false);\n const [listenToTcfApi, setListenToTcfApi] = useState(false);\n\n useEffect(() => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n return;\n }\n\n if (!window.__tcfapi) {\n console.warn('warning: __tcfapi not found');\n }\n\n if (window?.cookieStore && allowCookieStore) {\n setListenToCookieStore(true);\n } else if (window.__tcfapi) {\n setListenToTcfApi(true);\n } else {\n console.warn('warning: neither cookieStore nor __tcfapi found');\n }\n }, []);\n\n useEffect(() => {\n const cleanupFns: ((() => void) | null)[] = [];\n if (listenToCookieStore && window.cookieStore) {\n const cleanupFn = listenToCookieStoreUtil(CONSENT_COOKIE, () => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n });\n cleanupFns.push(cleanupFn);\n\n const cleanupFn2 = listenToCookieStoreUtil(ALERT_BOX_COOKIE, () => {\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n cleanupFns.push(cleanupFn2);\n }\n return () => {\n cleanupFns.forEach((fn) => fn && fn());\n };\n }, [listenToCookieStore]);\n\n useEffect(() => {\n let listenerId: number;\n if (listenToTcfApi && window.__tcfapi) {\n const callback = (_tcData: TCData, success: boolean) => {\n if (success) {\n listenerId = _tcData.listenerId;\n\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n // tcData.eventStatus can be:\n // tcloaded means user has made a choice and we’re ready to check it\n // cmpuishown means the banner is shown\n // useractioncomplete means the user has interacted with the banner\n\n // but actually if the result for any of these is true, we just use the value of the cookie\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n }\n }\n };\n\n window.__tcfapi('addEventListener', 2, callback);\n }\n\n // cleanup fn\n return () => {\n if (window.__tcfapi && listenerId)\n window.__tcfapi(\n 'removeEventListener',\n 2,\n (success) => {\n console.debug(success);\n },\n listenerId\n );\n };\n }, [listenToTcfApi]);\n\n return {\n consentCookieExists,\n alertBoxClosed,\n listenToCookieStore,\n listenToTcfApi,\n };\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOnetrust } from './hooks/useOnetrust';\n\ninterface DEDisclosureWithBannerStatusProps {\n config: DisclosureConfigValue;\n allowCookieStore?: boolean;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithBannerStatus: React.FC<\n DEDisclosureWithBannerStatusProps\n> = ({\n config,\n onFinished,\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n const { alertBoxClosed, consentCookieExists } = useOnetrust({\n allowCookieStore,\n });\n\n useEffect(() => {\n if (config) {\n // step 3: set disclosure based on config\n\n if (alertBoxClosed) {\n setDisclosure(config.disclosure_afterbanner);\n } else {\n setDisclosure(config.disclosure_beforebanner);\n }\n }\n }, [alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering && consentCookieExists) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering, consentCookieExists]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\n\ninterface DEDisclosureWithoutBannerStatusProps {\n config: DisclosureConfigValue;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithoutBannerStatus: React.FC<\n DEDisclosureWithoutBannerStatusProps\n> = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n useEffect(() => {\n if (config) {\n setDisclosure(config.disclosure);\n }\n }, [config]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { DEDisclosureWithBannerStatus } from './DisclosureWithBannerStatus';\nimport { DEDisclosureWithoutBannerStatus } from './DisclosureWithoutBannerStatus';\n\ninterface DisclosureProps {\n /** callback function to be called when the disclosure is finished loading */\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n\n /** ability to turn off cookiestore listener, primarily for testing purposes */\n allowCookieStore?: boolean;\n}\n\nexport const DEDisclosure: React.FC<DisclosureProps> = ({\n onFinished = () => {},\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n const [myConfig, setMyConfig] = useState<DisclosureConfigValue>();\n // const { alertBoxClosed } = useOneTrustAlertBoxClosed({ allowCookieStore });\n\n useEffect(() => {\n (async () => {\n const config = await getConfig();\n setMyConfig(config);\n\n if (!config) {\n console.error('No config found');\n }\n })();\n }, []);\n\n useEffect(() => {\n if (myConfig) {\n // step 3: set disclosure based on config\n\n // if config says to check onetrust, check onetrust\n if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {\n // check if onetrust is closed\n // if it is, show the after banner disclosure\n // if it is not, show the before banner disclosure\n setDisclosureRendering(\n <DEDisclosureWithBannerStatus\n config={myConfig}\n allowCookieStore={allowCookieStore}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else if ('disclosure' in myConfig) {\n setDisclosureRendering(\n <DEDisclosureWithoutBannerStatus\n config={myConfig}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig]);\n\n if (disclosureRendering) {\n return <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>;\n }\n\n return <div data-test-id=\"de-disclosure-loading\"></div>;\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\n JOB_TITLE: 'profile_job_title',\n PERSONAL_GOALS: 'personal_goals',\n HOBBIES: 'hobbies',\n PROFESSIONAL_GOALS: 'professional_goals',\n INDUSTRY: 'industry',\n NEWS_LOCATION: 'news_location',\n NY_PERSONAL_GOALS: 'new_year_personal_goals',\n NY_HOBBIES: 'new_year_hobbies',\n NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',\n NY_INDUSTRY: 'new_year_industry',\n NY_NEWS_LOCATION: 'new_year_news_location',\n EDU_ROLE: 'profile_edu_role',\n EDU_MAJOR: 'profile_edu_major',\n EDU_GRADUATION_YEAR: 'profile_edu_graduation_year',\n} as const;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAa,sBAAsB;CACjC,SAAS;CACT,gBAAgB;CACjB;AAcD,IAAa,kBAAkB,EAC7B,SAAS,OACV;AAGD,IAAa,uBAAuB;CAClC,SAAS;CACT,cAAc;CACd,wBAAwB;CACxB,8BAA8B;CAC/B;AAED,IAAa,aAAa;CACx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B;AACd,GAAC,YAAY;GACX,MAAM,SAAS,MAAM,WAAW;AAChC,eAAY,OAAO;AAEnB,OAAI,CAAC,OACH,SAAQ,MAAM,kBAAkB;MAEhC;IACH,EAAE,CAAC;AAEN,EAAA,GAAA,MAAA,iBAAgB;AACd,MAAI,SAIF,KAAI,uBAAuB,YAAY,SAAS,kBAI9C,wBACE,iBAAA,GAAA,kBAAA,KAAC,8BAAD;GACE,QAAQ;GACU;GACN;GACU;GACtB,CAAA,CACH;WACQ,gBAAgB,SACzB,wBACE,iBAAA,GAAA,kBAAA,KAAC,iCAAD;GACE,QAAQ;GACI;GACU;GACtB,CAAA,CACH;MAED,SAAQ,MAAM,iBAAiB;IAGlC,CAAC,SAAS,CAAC;AAEd,KAAI,oBACF,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD;EAAK,gBAAa;YAAiB;EAA0B,CAAA;AAGtE,QAAO,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,gBAAa,yBAA8B,CAAA;;;;AC/EzD,IAAa,4BAA4B;CACvC,WAAW;CACX,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,eAAe;CACf,mBAAmB;CACnB,YAAY;CACZ,uBAAuB;CACvB,aAAa;CACb,kBAAkB;CAClB,UAAU;CACV,WAAW;CACX,qBAAqB;CACtB"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { useEffect, useState } from "react";
|
|
|
3
3
|
import { Icon, Select, styled, theme } from "@washingtonpost/wpds-ui-kit";
|
|
4
4
|
import { ScriptStatus, useScript, useWindowSize } from "@washingtonpost/subs-hooks";
|
|
5
5
|
import { ChevronDown } from "@washingtonpost/wpds-assets";
|
|
6
|
-
import { Fragment,
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/interfaces/index.ts
|
|
8
8
|
var CollectionBehaviors = {
|
|
9
9
|
COLLECT: "COLLECT",
|
|
@@ -172,7 +172,6 @@ var push = async ({ submitData, source }) => {
|
|
|
172
172
|
};
|
|
173
173
|
//#endregion
|
|
174
174
|
//#region src/components/DESelect/Dropdown.tsx
|
|
175
|
-
var _jsxFileName$5 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DESelect/Dropdown.tsx";
|
|
176
175
|
var StyledMobileSelect = styled("select", {
|
|
177
176
|
padding: "12px 16px 12px 6px",
|
|
178
177
|
display: "flex",
|
|
@@ -232,43 +231,27 @@ var Dropdown = ({ id, label, values, required = false, existingValue, onChange =
|
|
|
232
231
|
if (answer) return value === answer ? { selected: true } : {};
|
|
233
232
|
return value === presetDropdownValue ? { selected: true } : {};
|
|
234
233
|
};
|
|
235
|
-
return isMobileSize ? /* @__PURE__ */
|
|
234
|
+
return isMobileSize ? /* @__PURE__ */ jsxs(StyledSelectWrapper, { children: [/* @__PURE__ */ jsxs(StyledMobileSelect, {
|
|
236
235
|
id: "",
|
|
237
236
|
required,
|
|
238
237
|
onChange: (e) => setAnswer(e.target.value),
|
|
239
238
|
...disabledProp,
|
|
240
239
|
children: [
|
|
241
|
-
/* @__PURE__ */
|
|
242
|
-
|
|
243
|
-
lineNumber: 109,
|
|
244
|
-
columnNumber: 9
|
|
245
|
-
}, void 0),
|
|
246
|
-
/* @__PURE__ */ jsxDEV(StyledMobileOption, {
|
|
240
|
+
/* @__PURE__ */ jsx("label", { children: label }),
|
|
241
|
+
/* @__PURE__ */ jsx(StyledMobileOption, {
|
|
247
242
|
value: "",
|
|
248
243
|
disabled: true,
|
|
249
244
|
selected: true,
|
|
250
245
|
style: { color: "#666666" },
|
|
251
246
|
children: label
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
lineNumber: 110,
|
|
255
|
-
columnNumber: 9
|
|
256
|
-
}, void 0),
|
|
257
|
-
values.map((value) => /* @__PURE__ */ jsxDEV(StyledMobileOption, {
|
|
247
|
+
}),
|
|
248
|
+
values.map((value) => /* @__PURE__ */ jsx(StyledMobileOption, {
|
|
258
249
|
value,
|
|
259
250
|
...defaultValuePropMobile(value),
|
|
260
251
|
children: value
|
|
261
|
-
}, value
|
|
262
|
-
fileName: _jsxFileName$5,
|
|
263
|
-
lineNumber: 119,
|
|
264
|
-
columnNumber: 11
|
|
265
|
-
}, void 0))
|
|
252
|
+
}, value))
|
|
266
253
|
]
|
|
267
|
-
},
|
|
268
|
-
fileName: _jsxFileName$5,
|
|
269
|
-
lineNumber: 103,
|
|
270
|
-
columnNumber: 7
|
|
271
|
-
}, void 0), /* @__PURE__ */ jsxDEV(Icon, {
|
|
254
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
272
255
|
label: "",
|
|
273
256
|
size: "100",
|
|
274
257
|
fill: theme.colors.gray80,
|
|
@@ -279,67 +262,30 @@ var Dropdown = ({ id, label, values, required = false, existingValue, onChange =
|
|
|
279
262
|
top: "50%",
|
|
280
263
|
transform: "translateY(-50%)"
|
|
281
264
|
},
|
|
282
|
-
children: /* @__PURE__ */
|
|
265
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { style: {
|
|
283
266
|
position: "absolute",
|
|
284
267
|
right: "10px"
|
|
285
|
-
} }
|
|
286
|
-
|
|
287
|
-
lineNumber: 140,
|
|
288
|
-
columnNumber: 9
|
|
289
|
-
}, void 0)
|
|
290
|
-
}, void 0, false, {
|
|
291
|
-
fileName: _jsxFileName$5,
|
|
292
|
-
lineNumber: 128,
|
|
293
|
-
columnNumber: 7
|
|
294
|
-
}, void 0)] }, void 0, true, {
|
|
295
|
-
fileName: _jsxFileName$5,
|
|
296
|
-
lineNumber: 102,
|
|
297
|
-
columnNumber: 5
|
|
298
|
-
}, void 0) : /* @__PURE__ */ jsxDEV(Select.Root, {
|
|
268
|
+
} })
|
|
269
|
+
})] }) : /* @__PURE__ */ jsxs(Select.Root, {
|
|
299
270
|
onValueChange: (e) => setAnswer(e),
|
|
300
271
|
required,
|
|
301
272
|
...defaultValueProp,
|
|
302
273
|
...disabledProp,
|
|
303
|
-
children: [/* @__PURE__ */
|
|
274
|
+
children: [/* @__PURE__ */ jsxs(Select.Trigger, {
|
|
304
275
|
"data-test-id": `${id}-select-trigger`,
|
|
305
|
-
children: [/* @__PURE__ */
|
|
306
|
-
|
|
307
|
-
lineNumber: 151,
|
|
308
|
-
columnNumber: 9
|
|
309
|
-
}, void 0), /* @__PURE__ */ jsxDEV(Select.Value, {}, void 0, false, {
|
|
310
|
-
fileName: _jsxFileName$5,
|
|
311
|
-
lineNumber: 152,
|
|
312
|
-
columnNumber: 9
|
|
313
|
-
}, void 0)]
|
|
314
|
-
}, void 0, true, {
|
|
315
|
-
fileName: _jsxFileName$5,
|
|
316
|
-
lineNumber: 150,
|
|
317
|
-
columnNumber: 7
|
|
318
|
-
}, void 0), /* @__PURE__ */ jsxDEV(Select.Content, {
|
|
276
|
+
children: [/* @__PURE__ */ jsx(Select.Label, { children: label }), /* @__PURE__ */ jsx(Select.Value, {})]
|
|
277
|
+
}), /* @__PURE__ */ jsx(Select.Content, {
|
|
319
278
|
css: { zIndex: theme.zIndices.page },
|
|
320
279
|
"data-test-id": `${id}-select-content`,
|
|
321
|
-
children: values.map((value) => /* @__PURE__ */
|
|
280
|
+
children: values.map((value) => /* @__PURE__ */ jsx(Select.Item, {
|
|
322
281
|
value,
|
|
323
282
|
children: value
|
|
324
|
-
}, value
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
columnNumber: 11
|
|
328
|
-
}, void 0))
|
|
329
|
-
}, void 0, false, {
|
|
330
|
-
fileName: _jsxFileName$5,
|
|
331
|
-
lineNumber: 154,
|
|
332
|
-
columnNumber: 7
|
|
333
|
-
}, void 0)]
|
|
334
|
-
}, void 0, true, {
|
|
335
|
-
fileName: _jsxFileName$5,
|
|
336
|
-
lineNumber: 144,
|
|
337
|
-
columnNumber: 5
|
|
338
|
-
}, void 0);
|
|
283
|
+
}, value))
|
|
284
|
+
})]
|
|
285
|
+
});
|
|
339
286
|
};
|
|
340
287
|
//#endregion
|
|
341
288
|
//#region src/components/DESelect/index.tsx
|
|
342
|
-
var _jsxFileName$4 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DESelect/index.tsx";
|
|
343
289
|
var scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;
|
|
344
290
|
var SelectWrapper = styled("div", {
|
|
345
291
|
boxSizing: "border-box",
|
|
@@ -391,8 +337,8 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
391
337
|
const defaultValueProp = existingValue && config ? { defaultValue: existingValue } : {};
|
|
392
338
|
const disabledProp = disabled || !(children || config) ? { disabled: true } : {};
|
|
393
339
|
const values = config ? [...config.values].sort((a, b) => a.order - b.order).filter((value) => value.archived !== true).filter(valuesFilter) : [];
|
|
394
|
-
return /* @__PURE__ */
|
|
395
|
-
children && /* @__PURE__ */
|
|
340
|
+
return /* @__PURE__ */ jsxs(SelectWrapper, { children: [
|
|
341
|
+
children && /* @__PURE__ */ jsx(Select.Root, {
|
|
396
342
|
onValueChange: (e) => {
|
|
397
343
|
setSelected(e);
|
|
398
344
|
onChange({ value: e });
|
|
@@ -400,22 +346,14 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
400
346
|
...defaultValueProp,
|
|
401
347
|
...disabledProp,
|
|
402
348
|
children
|
|
403
|
-
},
|
|
404
|
-
|
|
405
|
-
lineNumber: 147,
|
|
406
|
-
columnNumber: 9
|
|
407
|
-
}, void 0),
|
|
408
|
-
!children && !config && /* @__PURE__ */ jsxDEV(Dropdown, {
|
|
349
|
+
}),
|
|
350
|
+
!children && !config && /* @__PURE__ */ jsx(Dropdown, {
|
|
409
351
|
id: "loading",
|
|
410
352
|
label: "Loading...",
|
|
411
353
|
values: [],
|
|
412
354
|
disabled: true
|
|
413
|
-
},
|
|
414
|
-
|
|
415
|
-
lineNumber: 159,
|
|
416
|
-
columnNumber: 9
|
|
417
|
-
}, void 0),
|
|
418
|
-
!children && config && /* @__PURE__ */ jsxDEV(Dropdown, {
|
|
355
|
+
}),
|
|
356
|
+
!children && config && /* @__PURE__ */ jsx(Dropdown, {
|
|
419
357
|
id: config.name,
|
|
420
358
|
label: label || config.name,
|
|
421
359
|
onChange: (e) => {
|
|
@@ -426,16 +364,8 @@ var DESelect = ({ source, fieldName, label, dataDictionaryConfig, existingValue,
|
|
|
426
364
|
existingValue,
|
|
427
365
|
disabled,
|
|
428
366
|
valueSelectedByDefault
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
lineNumber: 167,
|
|
432
|
-
columnNumber: 9
|
|
433
|
-
}, void 0)
|
|
434
|
-
] }, void 0, true, {
|
|
435
|
-
fileName: _jsxFileName$4,
|
|
436
|
-
lineNumber: 145,
|
|
437
|
-
columnNumber: 5
|
|
438
|
-
}, void 0);
|
|
367
|
+
})
|
|
368
|
+
] });
|
|
439
369
|
};
|
|
440
370
|
//#endregion
|
|
441
371
|
//#region src/components/DEDisclosure/utils/getConfig.ts
|
|
@@ -453,10 +383,9 @@ var getConfig = async () => {
|
|
|
453
383
|
};
|
|
454
384
|
//#endregion
|
|
455
385
|
//#region src/components/DEDisclosure/utils/hydrateLinks.tsx
|
|
456
|
-
var _jsxFileName$3 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/utils/hydrateLinks.tsx";
|
|
457
386
|
var hydrateLinks = (str, onLinkClick = () => {}) => {
|
|
458
387
|
return str.split(/({{PRIVACY_POLICY}})/g).map((chunk, i) => {
|
|
459
|
-
if (chunk === "{{PRIVACY_POLICY}}") return /* @__PURE__ */
|
|
388
|
+
if (chunk === "{{PRIVACY_POLICY}}") return /* @__PURE__ */ jsx("a", {
|
|
460
389
|
rel: "noopener noreferrer",
|
|
461
390
|
target: "_blank",
|
|
462
391
|
style: { color: "inherit" },
|
|
@@ -464,13 +393,9 @@ var hydrateLinks = (str, onLinkClick = () => {}) => {
|
|
|
464
393
|
href: "https://www.washingtonpost.com/privacy-policy/",
|
|
465
394
|
onClick: (e) => onLinkClick(e),
|
|
466
395
|
children: "Privacy Policy"
|
|
467
|
-
}, `privacy-link-${i}
|
|
468
|
-
fileName: _jsxFileName$3,
|
|
469
|
-
lineNumber: 13,
|
|
470
|
-
columnNumber: 9
|
|
471
|
-
}, void 0);
|
|
396
|
+
}, `privacy-link-${i}`);
|
|
472
397
|
return chunk;
|
|
473
|
-
}).reduce((prev, current) => /* @__PURE__ */
|
|
398
|
+
}).reduce((prev, current) => /* @__PURE__ */ jsxs(Fragment, { children: [prev, current] }), /* @__PURE__ */ jsx(Fragment, {}));
|
|
474
399
|
};
|
|
475
400
|
//#endregion
|
|
476
401
|
//#region src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts
|
|
@@ -542,7 +467,6 @@ var useOnetrust = ({ allowCookieStore }) => {
|
|
|
542
467
|
};
|
|
543
468
|
//#endregion
|
|
544
469
|
//#region src/components/DEDisclosure/DisclosureWithBannerStatus.tsx
|
|
545
|
-
var _jsxFileName$2 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/DisclosureWithBannerStatus.tsx";
|
|
546
470
|
var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = true, onPrivacyPolicyClick = () => {} }) => {
|
|
547
471
|
const [disclosure, setDisclosure] = useState(null);
|
|
548
472
|
const [disclosureRendering, setDisclosureRendering] = useState(null);
|
|
@@ -552,11 +476,7 @@ var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = tru
|
|
|
552
476
|
else setDisclosure(config.disclosure_beforebanner);
|
|
553
477
|
}, [alertBoxClosed]);
|
|
554
478
|
useEffect(() => {
|
|
555
|
-
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */
|
|
556
|
-
fileName: _jsxFileName$2,
|
|
557
|
-
lineNumber: 55,
|
|
558
|
-
columnNumber: 15
|
|
559
|
-
}, void 0)] }, void 0, true), /* @__PURE__ */ jsxDEV(Fragment, {}, void 0, false)));
|
|
479
|
+
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ jsxs(Fragment, { children: [prev, /* @__PURE__ */ jsx("p", { children: hydrateLinks(current, onPrivacyPolicyClick) })] }), /* @__PURE__ */ jsx(Fragment, {})));
|
|
560
480
|
}, [disclosure]);
|
|
561
481
|
useEffect(() => {
|
|
562
482
|
if (disclosureRendering && consentCookieExists) onFinished({
|
|
@@ -568,7 +488,6 @@ var DEDisclosureWithBannerStatus = ({ config, onFinished, allowCookieStore = tru
|
|
|
568
488
|
};
|
|
569
489
|
//#endregion
|
|
570
490
|
//#region src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx
|
|
571
|
-
var _jsxFileName$1 = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx";
|
|
572
491
|
var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {
|
|
573
492
|
const [disclosure, setDisclosure] = useState(null);
|
|
574
493
|
const [disclosureRendering, setDisclosureRendering] = useState(null);
|
|
@@ -576,11 +495,7 @@ var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClic
|
|
|
576
495
|
if (config) setDisclosure(config.disclosure);
|
|
577
496
|
}, [config]);
|
|
578
497
|
useEffect(() => {
|
|
579
|
-
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */
|
|
580
|
-
fileName: _jsxFileName$1,
|
|
581
|
-
lineNumber: 38,
|
|
582
|
-
columnNumber: 15
|
|
583
|
-
}, void 0)] }, void 0, true), /* @__PURE__ */ jsxDEV(Fragment, {}, void 0, false)));
|
|
498
|
+
if (disclosure && Array.isArray(disclosure)) setDisclosureRendering(disclosure.reduce((prev, current) => /* @__PURE__ */ jsxs(Fragment, { children: [prev, /* @__PURE__ */ jsx("p", { children: hydrateLinks(current, onPrivacyPolicyClick) })] }), /* @__PURE__ */ jsx(Fragment, {})));
|
|
584
499
|
}, [disclosure]);
|
|
585
500
|
useEffect(() => {
|
|
586
501
|
if (disclosureRendering) onFinished({
|
|
@@ -592,7 +507,6 @@ var DEDisclosureWithoutBannerStatus = ({ config, onFinished, onPrivacyPolicyClic
|
|
|
592
507
|
};
|
|
593
508
|
//#endregion
|
|
594
509
|
//#region src/components/DEDisclosure/index.tsx
|
|
595
|
-
var _jsxFileName = "/var/jenkins/workspace/Subs-FE-Components_production/packages/de-inputs/src/components/DEDisclosure/index.tsx";
|
|
596
510
|
var DEDisclosure = ({ onFinished = () => {}, allowCookieStore = true, onPrivacyPolicyClick = () => {} }) => {
|
|
597
511
|
const [disclosureRendering, setDisclosureRendering] = useState(null);
|
|
598
512
|
const [myConfig, setMyConfig] = useState();
|
|
@@ -604,40 +518,24 @@ var DEDisclosure = ({ onFinished = () => {}, allowCookieStore = true, onPrivacyP
|
|
|
604
518
|
})();
|
|
605
519
|
}, []);
|
|
606
520
|
useEffect(() => {
|
|
607
|
-
if (myConfig) if ("checkBannerStatus" in myConfig && myConfig.checkBannerStatus) setDisclosureRendering(/* @__PURE__ */
|
|
521
|
+
if (myConfig) if ("checkBannerStatus" in myConfig && myConfig.checkBannerStatus) setDisclosureRendering(/* @__PURE__ */ jsx(DEDisclosureWithBannerStatus, {
|
|
608
522
|
config: myConfig,
|
|
609
523
|
allowCookieStore,
|
|
610
524
|
onFinished,
|
|
611
525
|
onPrivacyPolicyClick
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
lineNumber: 55,
|
|
615
|
-
columnNumber: 11
|
|
616
|
-
}, void 0));
|
|
617
|
-
else if ("disclosure" in myConfig) setDisclosureRendering(/* @__PURE__ */ jsxDEV(DEDisclosureWithoutBannerStatus, {
|
|
526
|
+
}));
|
|
527
|
+
else if ("disclosure" in myConfig) setDisclosureRendering(/* @__PURE__ */ jsx(DEDisclosureWithoutBannerStatus, {
|
|
618
528
|
config: myConfig,
|
|
619
529
|
onFinished,
|
|
620
530
|
onPrivacyPolicyClick
|
|
621
|
-
}
|
|
622
|
-
fileName: _jsxFileName,
|
|
623
|
-
lineNumber: 64,
|
|
624
|
-
columnNumber: 11
|
|
625
|
-
}, void 0));
|
|
531
|
+
}));
|
|
626
532
|
else console.error("Invalid config");
|
|
627
533
|
}, [myConfig]);
|
|
628
|
-
if (disclosureRendering) return /* @__PURE__ */
|
|
534
|
+
if (disclosureRendering) return /* @__PURE__ */ jsx("div", {
|
|
629
535
|
"data-test-id": "de-disclosure",
|
|
630
536
|
children: disclosureRendering
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
lineNumber: 77,
|
|
634
|
-
columnNumber: 12
|
|
635
|
-
}, void 0);
|
|
636
|
-
return /* @__PURE__ */ jsxDEV("div", { "data-test-id": "de-disclosure-loading" }, void 0, false, {
|
|
637
|
-
fileName: _jsxFileName,
|
|
638
|
-
lineNumber: 80,
|
|
639
|
-
columnNumber: 10
|
|
640
|
-
}, void 0);
|
|
537
|
+
});
|
|
538
|
+
return /* @__PURE__ */ jsx("div", { "data-test-id": "de-disclosure-loading" });
|
|
641
539
|
};
|
|
642
540
|
//#endregion
|
|
643
541
|
//#region src/constants/IngestDataTypes.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxClosedCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/sendToGA.ts","../src/services/ingest.ts","../src/utils/isAnonymousWebview.ts","../src/utils/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts","../src/components/DEDisclosure/hooks/useOnetrust.ts","../src/components/DEDisclosure/DisclosureWithBannerStatus.tsx","../src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\n\nexport type AttributeValue = {\n name: string;\n date_created: number;\n last_modified_date: number;\n archived: boolean;\n order: number;\n};\n\nexport const CollectionBehaviors = {\n COLLECT: 'COLLECT',\n DO_NOT_COLLECT: 'DO_NOT_COLLECT',\n} as const;\n\nexport type Attribute = {\n name: string;\n approved_for_use?: boolean;\n collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];\n datatype: string;\n explicit: boolean;\n multiple_value: boolean;\n last_modified_date: number;\n date_created: number;\n values: AttributeValue[] | Readonly<AttributeValue[]>;\n};\n\nexport const AttributesState = {\n SUCCESS: '100',\n} as const;\n\n// https://github.com/WashPost/subs-be-user-data-enrichment/blob/8e8f8460c59adbe9c83b50f368bff1d3300bfd6b/src/main/java/washpost/paywall/userdataenrichment/model/ResponseState.java#L19\nexport const DeleteAttributeState = {\n SUCCESS: '150',\n SYSTEM_ERROR: '151',\n INVALID_ATTRIBUTE_NAME: '152',\n INVALID_ATTRIBUTE_NOT_EXISTS: '153',\n} as const;\n\nexport const IngestType = {\n EXPLICIT: 'explicit',\n IMPLICIT: 'implicit',\n} as const;\n\nexport const IngestResponseState = {\n SUCCESS: '100',\n SYSTEM_ERROR: '101',\n INVALID_TYPE: '102',\n INVALID_IDENTIFIER: '103',\n INVALID_DATA: '104',\n INVALID_ATTRIBUTE_DEFINITION: '105',\n INVALID_META_DEFINITION: '106',\n UNAUTHENTICATED: '107',\n MISMATCHED_IDENTIFIER: '108',\n DISABLED_ATTRIBUTE_DEFINITION: '109',\n DO_NOT_COLLECT: '110',\n} as const;\n\nexport interface IProfileResponse {\n status: ResponseStatusType;\n state: (typeof AttributesState)[keyof typeof AttributesState];\n attributes: {\n [key: string]: {\n attribute_name: string;\n value: string | null;\n date_created: number;\n last_modified_date: number;\n };\n };\n}\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\n/**\n * Checks the users OptanonConsent cookie to determine if the user has allowed targeting.\n * Returns true or false if the flag is found in the cookie, null otherwise.\n * @returns {boolean | null}\n */\nexport const checkConsentCookieForAllowTargeting = () => {\n const value = getCookie(COOKIE) || '';\n return value.includes('C0004%3A1')\n ? true\n : value.includes('C0004%3A0')\n ? false\n : null;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxClosedCookie = () => {\n const value = getCookie(COOKIE) || '';\n // Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)\n // \"Invalid date\" is 12 characters long\n return value.length > 12;\n};\n","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\nimport { checkConsentCookieForAllowTargeting } from './checkConsentCookieForAllowTargeting';\nimport { checkAlertBoxClosedCookie } from '../components/DEDisclosure/utils/checkAlertBoxClosedCookie';\n\n/**\n * Checks privacy cookies to decide if we can send up 1pd\n * If US, checks that wp_usp exists\n * Else If OptAnonConsent cookie exists, checks the value of targeting cookies consent\n * Else If EEA, always returns true\n * Else, returns false\n * @returns {boolean}\n */\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const { intl_region, country_code: countryCode } = WPGeo();\n\n if (countryCode === 'US') {\n return !!getCookie('wp_usp');\n }\n\n if (window.pageType === 'onboarding') {\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (\n typeof gdprAllowTargarting === 'boolean' &&\n checkAlertBoxClosedCookie()\n ) {\n return gdprAllowTargarting;\n }\n\n // Downstream systems\n // Checking for window.pageType === 'onboarding' to avoid being true on graphics articles etc for now -- MNI-710\n if (intl_region === 'EEA' && window.pageType === 'onboarding') {\n return true;\n }\n }\n\n return false;\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n DEFAULT_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport type { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n\nconst attributesCache: Record<string, any> = {};\nexport const getAttributes: GetAttributesType = async ({\n fieldName,\n}: {\n fieldName: string;\n}) => {\n if (attributesCache[fieldName]) {\n return attributesCache[fieldName];\n }\n\n const fieldNames = [fieldName];\n\n try {\n const url = new URL(`${base}/attributes`);\n url.searchParams.set('attributes', fieldNames.join(','));\n\n const data = await fetch(url.toString(), {\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n });\n const json = await data.json();\n\n if (data.ok && json.status === ResponseStatus.SUCCESS) {\n const attributes = json.attributes || [];\n attributesCache[fieldName] = attributes;\n return attributes;\n }\n return [];\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n","const sendGAEvent = (props: {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}): void => {\n if (typeof window === 'undefined') {\n if (__DEV__) console.warn('NO WINDOW');\n return;\n }\n // Initialize dataLayer if needed\n window.dataLayer = window.dataLayer || [];\n\n const eventData: Record<string, any> = {\n ...props,\n };\n window.dataLayer.push(eventData);\n};\n\ntype SendToGaType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<true>;\n\nexport const sendToGA: SendToGaType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n sendGAEvent({\n event: 'site-onpage-click',\n action: 'site-onpage-click',\n category: 'profile',\n\n label: fieldName,\n 'de-label': fieldName,\n [fieldName]: value,\n\n section: 'profile',\n subsection: source,\n });\n\n return true;\n};\n","import {\n ENDPOINTS,\n DEFAULT_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { type IngestResponseState, IngestType } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n const jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type: IngestType.EXPLICIT,\n wapo_login_id, // TODO: move this to BE to read from cookie headers\n data: {\n [fieldName]: [value],\n },\n metadata: { source },\n };\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n body: JSON.stringify(payload),\n });\n\n const json = await response.json();\n\n return json;\n } catch (e) {\n console.debug(e);\n return null;\n }\n};\n\ntype IngestType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<{\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import { getCookie, isLoggedIn } from '@washingtonpost/subs-sdk';\n\nexport const isAnonymousWebview = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_wv = getCookie('wp_wv');\n\n return !!(wp_wv && !isLoggedIn());\n};\n","import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { CollectionBehaviors, IngestType } from '../interfaces';\nimport type { IngestResponseState } from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<\n | {\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n\nexport const push: PushType = async ({ submitData, source }) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n if (isAnonymousWebview()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const { fieldName } = submitData;\n\n const attributeInfo = await getAttributes({\n fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n const type =\n attributeInfo[0] && attributeInfo[0].explicit === true\n ? IngestType.EXPLICIT\n : IngestType.IMPLICIT;\n\n if (!attributeInfo[0] && __DEV__) {\n console.warn(`no attribute info found for ${fieldName}, assuming implicit`);\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, source });\n }\n return sendToGA({ submitData, source });\n};\n","import React, { useEffect, useState } from 'react';\nimport { Icon, Select, styled, theme } from '@washingtonpost/wpds-ui-kit';\nimport { useWindowSize } from '@washingtonpost/subs-hooks';\nimport { ChevronDown } from '@washingtonpost/wpds-assets';\n\ninterface IDropdownProps {\n id: string;\n label: string;\n values: Array<string>;\n required?: boolean;\n existingValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n valueSelectedByDefault?: string;\n}\n\nconst StyledMobileSelect = styled('select', {\n padding: '12px 16px 12px 6px',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n backgroundColor: '$secondary',\n color: '$primary',\n fontFamily: '$meta',\n fontSize: '$100',\n fontWeight: '$light',\n lineHeight: '$125',\n paddingBlockRight: '$125',\n textOverflow: 'ellipsis',\n position: 'relative',\n borderColor: 'transparent',\n borderRightWidth: '10px',\n borderRightColor: 'transparent',\n appearance: 'none',\n '-webkit-appearance': 'none',\n '&:disabled': {\n backgroundColor: theme.colors.disabled,\n borderColor: theme.colors.disabled,\n color: theme.colors.onDisabled,\n cursor: 'not-allowed',\n },\n});\n\nconst StyledSelectWrapper = styled('div', {\n width: '100%',\n maxWidth: '380px',\n borderRadius: '$012',\n borderColor: '$subtle',\n borderStyle: 'solid',\n borderWidth: '1px',\n backgroundColor: '$secondary',\n position: 'relative',\n});\n\nconst StyledMobileOption = styled('option', {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n color: 'inherit',\n});\n\n/**\n * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.\n * @param {IDropdownProps} props The props.\n * @returns {React.ReactElement} The dropdown.\n */\nexport const Dropdown = ({\n id,\n label,\n values,\n required = false,\n existingValue,\n onChange = () => {},\n disabled = false,\n valueSelectedByDefault,\n}: IDropdownProps) => {\n const [answer, setAnswer] = useState<string>();\n const { isMobileSize } = useWindowSize();\n\n useEffect(() => {\n if (answer) onChange(answer);\n }, [answer]);\n\n const disabledProp = disabled ? { disabled: true } : {};\n\n const presetDropdownValue = existingValue || valueSelectedByDefault;\n\n // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : presetDropdownValue\n ? { defaultValue: presetDropdownValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === presetDropdownValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n {...disabledProp}\n >\n <label>{label}</label>\n <StyledMobileOption\n value=\"\"\n disabled\n selected\n style={{ color: '#666666' }}\n >\n {label}\n </StyledMobileOption>\n {values.map((value) => (\n <StyledMobileOption\n value={value}\n key={value}\n {...defaultValuePropMobile(value)}\n >\n {value}\n </StyledMobileOption>\n ))}\n </StyledMobileSelect>\n <Icon\n label=\"\"\n size=\"100\"\n fill={theme.colors.gray80}\n style={{\n pointerEvents: 'none',\n position: 'absolute',\n right: '10px',\n top: '50%',\n transform: 'translateY(-50%)',\n }}\n >\n <ChevronDown style={{ position: 'absolute', right: '10px' }} />\n </Icon>\n </StyledSelectWrapper>\n ) : (\n <Select.Root\n onValueChange={(e) => setAnswer(e)}\n required={required}\n {...defaultValueProp}\n {...disabledProp}\n >\n <Select.Trigger data-test-id={`${id}-select-trigger`}>\n <Select.Label>{label}</Select.Label>\n <Select.Value />\n </Select.Trigger>\n <Select.Content\n css={{ zIndex: theme.zIndices.page }}\n data-test-id={`${id}-select-content`}\n >\n {values.map((value) => (\n <Select.Item value={value} key={value}>\n {value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Select, styled } from '@washingtonpost/wpds-ui-kit';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport type { Attribute, AttributeValue } from '../../interfaces';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n existingValue?: string;\n disabled?: boolean;\n submit: boolean;\n onChange?: ({ value }: { value: string }) => void;\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n valuesFilter?: (value: AttributeValue) => boolean;\n selectProps?: {\n root?: any;\n trigger?: any;\n label?: any;\n value?: any;\n content?: any;\n item?: any;\n };\n children?: React.ReactNode;\n valueSelectedByDefault?: string;\n defaultValue?: never;\n}\n\nconst scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;\n\nconst SelectWrapper = styled('div', {\n boxSizing: 'border-box',\n display: 'flex',\n marginBottom: '$100',\n flexDirection: 'column',\n '& button': {\n padding: '1px 6px',\n },\n '& *': { boxSizing: 'border-box' },\n});\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n existingValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n valueSelectedByDefault,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState(\n !existingValue && valueSelectedByDefault ? valueSelectedByDefault : ''\n );\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const config = await window?.__twpdeu?.getFieldConfigs({\n fieldName,\n });\n if (config) {\n setConfig(config[0]);\n } else {\n console.error('unable to get config', fieldName);\n }\n } catch (e) {\n console.warn('unable to get config', fieldName, e);\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && !(children || config)) {\n fetchConfig();\n }\n }, [scriptStatus]);\n\n useEffect(() => {\n const submitSelected = async () => {\n try {\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n source,\n });\n\n const isError =\n result === true\n ? false\n : result\n ? result.status !== ResponseStatus.SUCCESS\n : true;\n\n onFinished({\n isFinished: true,\n isError,\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n onFinished({\n isFinished: false,\n isError: true,\n });\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && submit && selected) {\n submitSelected();\n }\n }, [scriptStatus, submit]);\n\n const defaultValueProp =\n existingValue && config ? { defaultValue: existingValue } : {};\n\n const isLoading = !(children || config);\n\n const disabledProp = disabled || isLoading ? { disabled: true } : {};\n\n // sort and filter out archived values\n // Note: config.values may be readonly\n const values = config\n ? [...config.values]\n .sort((a, b) => a.order - b.order)\n .filter((value) => value.archived !== true)\n .filter(valuesFilter)\n : [];\n\n return (\n <SelectWrapper>\n {children && (\n <Select.Root\n onValueChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n {...defaultValueProp}\n {...disabledProp}\n >\n {children}\n </Select.Root>\n )}\n {!children && !config && (\n <Dropdown\n id={'loading'}\n label={'Loading...'}\n values={[]}\n disabled={true}\n />\n )}\n {!children && config && (\n <Dropdown\n id={config.name}\n label={label || config.name}\n onChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n values={values.map((value) => value.name)}\n existingValue={existingValue}\n disabled={disabled}\n valueSelectedByDefault={valueSelectedByDefault}\n />\n )}\n </SelectWrapper>\n );\n};\n","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport type {\n DisclosureConfig,\n DisclosureConfigValue,\n} from '../../../interfaces/disclosure';\n\nconst configSrc = `${\n ENDPOINTS.base === 'https://subscribe.washingtonpost.com'\n ? 'https://www.washingtonpost.com/subscribe'\n : ENDPOINTS.base\n}/config/de/disclosure.json`;\n\nexport const getConfig = async () => {\n let myConfig: DisclosureConfigValue | undefined;\n\n // step 1: fetch config\n const response = await fetch(configSrc);\n const remoteConfig: DisclosureConfig = await response.json();\n\n // step 2: figure out which part of the config to use\n\n // if country- or region-specific config found, use that\n const { country_code, intl_region } = WPGeo();\n Object.keys(remoteConfig).forEach((configKey) => {\n if (\n country_code &&\n configKey.split('|').includes(country_code.toLowerCase())\n ) {\n myConfig = remoteConfig[configKey];\n } else if (intl_region === 'EEA' && configKey === 'eea') {\n myConfig = remoteConfig[configKey];\n }\n });\n\n // TODO: Check for billing country also\n\n // else if no country-specific config, use the default config\n if (typeof myConfig === 'undefined' && remoteConfig._) {\n myConfig = remoteConfig._;\n }\n\n return myConfig;\n};\n","import React from 'react';\n\ntype hydrateLinksType = (\n str: string,\n onLinkClick: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str, onLinkClick = () => {}) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((chunk, i) => {\n if (chunk === '{{PRIVACY_POLICY}}') {\n return (\n <a\n key={`privacy-link-${i}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n onClick={(e) => onLinkClick(e)}\n >\n Privacy Policy\n </a>\n );\n }\n return chunk;\n });\n\n const toReturn = chunks.reduce(\n (prev, current) => (\n <>\n {prev}\n {current}\n </>\n ),\n <></>\n );\n\n return toReturn;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\nexport const checkOptanonConsentCookie = () => {\n const value = getCookie(COOKIE) || '';\n return value.length > 12;\n};\n","import { useState, useEffect } from 'react';\nimport type { ICookieStore } from '@washingtonpost/subs-sdk';\nimport { listenToCookieStore as listenToCookieStoreUtil } from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxClosedCookie } from '../utils/checkAlertBoxClosedCookie';\nimport { checkOptanonConsentCookie } from '../utils/checkOptAnonConsentCookie';\n\nconst CONSENT_COOKIE = 'OptanonConsent';\n\nconst ALERT_BOX_COOKIE = 'OptanonAlertBoxClosed';\n\ninterface TCData {\n eventStatus: 'tcloaded' | 'cmpuishown' | 'useractioncomplete';\n listenerId: number;\n [key: string]: any;\n}\n\ntype TCFAPIAddListener = (\n command: 'addEventListener',\n version: number,\n callback: (tcData: TCData, success: boolean) => void\n) => void;\n\ntype TCFAPIRmListener = (\n command: 'removeEventListener',\n version: number,\n callback: (success: boolean) => void,\n listenerId: number\n) => void;\n\ntype TCFAPIPing = (\n command: 'ping',\n version: number,\n callback: (pingReturn: any, success: boolean) => void\n) => void;\n\ndeclare global {\n interface Window {\n cookieStore?: ICookieStore;\n __tcfapi?: TCFAPIAddListener & TCFAPIRmListener & TCFAPIPing;\n }\n}\n\nexport const useOnetrust = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\n}) => {\n const [consentCookieExists, setConsentCookieExists] = useState<\n boolean | undefined\n >();\n const [alertBoxClosed, setAlertBoxClosed] = useState<boolean | undefined>();\n\n const [listenToCookieStore, setListenToCookieStore] = useState(false);\n const [listenToTcfApi, setListenToTcfApi] = useState(false);\n\n useEffect(() => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n return;\n }\n\n if (!window.__tcfapi) {\n console.warn('warning: __tcfapi not found');\n }\n\n if (window?.cookieStore && allowCookieStore) {\n setListenToCookieStore(true);\n } else if (window.__tcfapi) {\n setListenToTcfApi(true);\n } else {\n console.warn('warning: neither cookieStore nor __tcfapi found');\n }\n }, []);\n\n useEffect(() => {\n const cleanupFns: ((() => void) | null)[] = [];\n if (listenToCookieStore && window.cookieStore) {\n const cleanupFn = listenToCookieStoreUtil(CONSENT_COOKIE, () => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n });\n cleanupFns.push(cleanupFn);\n\n const cleanupFn2 = listenToCookieStoreUtil(ALERT_BOX_COOKIE, () => {\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n cleanupFns.push(cleanupFn2);\n }\n return () => {\n cleanupFns.forEach((fn) => fn && fn());\n };\n }, [listenToCookieStore]);\n\n useEffect(() => {\n let listenerId: number;\n if (listenToTcfApi && window.__tcfapi) {\n const callback = (_tcData: TCData, success: boolean) => {\n if (success) {\n listenerId = _tcData.listenerId;\n\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n // tcData.eventStatus can be:\n // tcloaded means user has made a choice and we’re ready to check it\n // cmpuishown means the banner is shown\n // useractioncomplete means the user has interacted with the banner\n\n // but actually if the result for any of these is true, we just use the value of the cookie\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n }\n }\n };\n\n window.__tcfapi('addEventListener', 2, callback);\n }\n\n // cleanup fn\n return () => {\n if (window.__tcfapi && listenerId)\n window.__tcfapi(\n 'removeEventListener',\n 2,\n (success) => {\n console.debug(success);\n },\n listenerId\n );\n };\n }, [listenToTcfApi]);\n\n return {\n consentCookieExists,\n alertBoxClosed,\n listenToCookieStore,\n listenToTcfApi,\n };\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOnetrust } from './hooks/useOnetrust';\n\ninterface DEDisclosureWithBannerStatusProps {\n config: DisclosureConfigValue;\n allowCookieStore?: boolean;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithBannerStatus: React.FC<\n DEDisclosureWithBannerStatusProps\n> = ({\n config,\n onFinished,\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n const { alertBoxClosed, consentCookieExists } = useOnetrust({\n allowCookieStore,\n });\n\n useEffect(() => {\n if (config) {\n // step 3: set disclosure based on config\n\n if (alertBoxClosed) {\n setDisclosure(config.disclosure_afterbanner);\n } else {\n setDisclosure(config.disclosure_beforebanner);\n }\n }\n }, [alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering && consentCookieExists) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering, consentCookieExists]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\n\ninterface DEDisclosureWithoutBannerStatusProps {\n config: DisclosureConfigValue;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithoutBannerStatus: React.FC<\n DEDisclosureWithoutBannerStatusProps\n> = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n useEffect(() => {\n if (config) {\n setDisclosure(config.disclosure);\n }\n }, [config]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { DEDisclosureWithBannerStatus } from './DisclosureWithBannerStatus';\nimport { DEDisclosureWithoutBannerStatus } from './DisclosureWithoutBannerStatus';\n\ninterface DisclosureProps {\n /** callback function to be called when the disclosure is finished loading */\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n\n /** ability to turn off cookiestore listener, primarily for testing purposes */\n allowCookieStore?: boolean;\n}\n\nexport const DEDisclosure: React.FC<DisclosureProps> = ({\n onFinished = () => {},\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n const [myConfig, setMyConfig] = useState<DisclosureConfigValue>();\n // const { alertBoxClosed } = useOneTrustAlertBoxClosed({ allowCookieStore });\n\n useEffect(() => {\n (async () => {\n const config = await getConfig();\n setMyConfig(config);\n\n if (!config) {\n console.error('No config found');\n }\n })();\n }, []);\n\n useEffect(() => {\n if (myConfig) {\n // step 3: set disclosure based on config\n\n // if config says to check onetrust, check onetrust\n if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {\n // check if onetrust is closed\n // if it is, show the after banner disclosure\n // if it is not, show the before banner disclosure\n setDisclosureRendering(\n <DEDisclosureWithBannerStatus\n config={myConfig}\n allowCookieStore={allowCookieStore}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else if ('disclosure' in myConfig) {\n setDisclosureRendering(\n <DEDisclosureWithoutBannerStatus\n config={myConfig}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig]);\n\n if (disclosureRendering) {\n return <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>;\n }\n\n return <div data-test-id=\"de-disclosure-loading\"></div>;\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\n JOB_TITLE: 'profile_job_title',\n PERSONAL_GOALS: 'personal_goals',\n HOBBIES: 'hobbies',\n PROFESSIONAL_GOALS: 'professional_goals',\n INDUSTRY: 'industry',\n NEWS_LOCATION: 'news_location',\n NY_PERSONAL_GOALS: 'new_year_personal_goals',\n NY_HOBBIES: 'new_year_hobbies',\n NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',\n NY_INDUSTRY: 'new_year_industry',\n NY_NEWS_LOCATION: 'new_year_news_location',\n EDU_ROLE: 'profile_edu_role',\n EDU_MAJOR: 'profile_edu_major',\n EDU_GRADUATION_YEAR: 'profile_edu_graduation_year',\n} as const;\n"],"mappings":";;;;;;;AAUA,IAAa,sBAAsB;CACjC,SAAS;CACT,gBAAgB;CACjB;AAcD,IAAa,kBAAkB,EAC7B,SAAS,OACV;AAGD,IAAa,uBAAuB;CAClC,SAAS;CACT,cAAc;CACd,wBAAwB;CACxB,8BAA8B;CAC/B;AAED,IAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACX;AAED,IAAa,sBAAsB;CACjC,SAAS;CACT,cAAc;CACd,cAAc;CACd,oBAAoB;CACpB,cAAc;CACd,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gB;AACd,MAAI,oBACF,YAAW;GAAE,YAAY;GAAM,SAAS;GAAO,CAAC;IAEjD,CAAC,oBAAoB,CAAC;AAEzB,QAAO;;;;;AC7BT,IAAa,gBAA2C,EACtD,mBAAmB,IACnB,mBAAmB,MACnB,6BAA6B,SACzB;CACJ,MAAM,CAAC,qBAAqB,0BAC1B,SAA6B,KAAK;CACpC,MAAM,CAAC,UAAU,eAAe,UAAiC;AAGjE,iBAAgB;AACd,GAAC,YAAY;GACX,MAAM,SAAS,MAAM,WAAW;AAChC,eAAY,OAAO;AAEnB,OAAI,CAAC,OACH,SAAQ,MAAM,kBAAkB;MAEhC;IACH,EAAE,CAAC;AAEN,iBAAgB;AACd,MAAI,SAIF,KAAI,uBAAuB,YAAY,SAAS,kBAI9C,wBACE,uBAAC,8BAAD;GACE,QAAQ;GACU;GACN;GACU;GACtB,EAAA,KAAA,GAAA,OAAA;;;;aACH;WACQ,gBAAgB,SACzB,wBACE,uBAAC,iCAAD;GACE,QAAQ;GACI;GACU;GACtB,EAAA,KAAA,GAAA,OAAA;;;;aACH;MAED,SAAQ,MAAM,iBAAiB;IAGlC,CAAC,SAAS,CAAC;AAEd,KAAI,oBACF,QAAO,uBAAC,OAAD;EAAK,gBAAa;YAAiB;EAA0B,EAAA,KAAA,GAAA,OAAA;;;;;AAGtE,QAAO,uBAAC,OAAD,EAAK,gBAAa,yBAA8B,EAAA,KAAA,GAAA,OAAA;;;;;;;;AC/EzD,IAAa,4BAA4B;CACvC,WAAW;CACX,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,eAAe;CACf,mBAAmB;CACnB,YAAY;CACZ,uBAAuB;CACvB,aAAa;CACb,kBAAkB;CAClB,UAAU;CACV,WAAW;CACX,qBAAqB;CACtB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxClosedCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/sendToGA.ts","../src/services/ingest.ts","../src/utils/isAnonymousWebview.ts","../src/utils/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts","../src/components/DEDisclosure/hooks/useOnetrust.ts","../src/components/DEDisclosure/DisclosureWithBannerStatus.tsx","../src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\n\nexport type AttributeValue = {\n name: string;\n date_created: number;\n last_modified_date: number;\n archived: boolean;\n order: number;\n};\n\nexport const CollectionBehaviors = {\n COLLECT: 'COLLECT',\n DO_NOT_COLLECT: 'DO_NOT_COLLECT',\n} as const;\n\nexport type Attribute = {\n name: string;\n approved_for_use?: boolean;\n collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];\n datatype: string;\n explicit: boolean;\n multiple_value: boolean;\n last_modified_date: number;\n date_created: number;\n values: AttributeValue[] | Readonly<AttributeValue[]>;\n};\n\nexport const AttributesState = {\n SUCCESS: '100',\n} as const;\n\n// https://github.com/WashPost/subs-be-user-data-enrichment/blob/8e8f8460c59adbe9c83b50f368bff1d3300bfd6b/src/main/java/washpost/paywall/userdataenrichment/model/ResponseState.java#L19\nexport const DeleteAttributeState = {\n SUCCESS: '150',\n SYSTEM_ERROR: '151',\n INVALID_ATTRIBUTE_NAME: '152',\n INVALID_ATTRIBUTE_NOT_EXISTS: '153',\n} as const;\n\nexport const IngestType = {\n EXPLICIT: 'explicit',\n IMPLICIT: 'implicit',\n} as const;\n\nexport const IngestResponseState = {\n SUCCESS: '100',\n SYSTEM_ERROR: '101',\n INVALID_TYPE: '102',\n INVALID_IDENTIFIER: '103',\n INVALID_DATA: '104',\n INVALID_ATTRIBUTE_DEFINITION: '105',\n INVALID_META_DEFINITION: '106',\n UNAUTHENTICATED: '107',\n MISMATCHED_IDENTIFIER: '108',\n DISABLED_ATTRIBUTE_DEFINITION: '109',\n DO_NOT_COLLECT: '110',\n} as const;\n\nexport interface IProfileResponse {\n status: ResponseStatusType;\n state: (typeof AttributesState)[keyof typeof AttributesState];\n attributes: {\n [key: string]: {\n attribute_name: string;\n value: string | null;\n date_created: number;\n last_modified_date: number;\n };\n };\n}\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\n/**\n * Checks the users OptanonConsent cookie to determine if the user has allowed targeting.\n * Returns true or false if the flag is found in the cookie, null otherwise.\n * @returns {boolean | null}\n */\nexport const checkConsentCookieForAllowTargeting = () => {\n const value = getCookie(COOKIE) || '';\n return value.includes('C0004%3A1')\n ? true\n : value.includes('C0004%3A0')\n ? false\n : null;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxClosedCookie = () => {\n const value = getCookie(COOKIE) || '';\n // Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)\n // \"Invalid date\" is 12 characters long\n return value.length > 12;\n};\n","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\nimport { checkConsentCookieForAllowTargeting } from './checkConsentCookieForAllowTargeting';\nimport { checkAlertBoxClosedCookie } from '../components/DEDisclosure/utils/checkAlertBoxClosedCookie';\n\n/**\n * Checks privacy cookies to decide if we can send up 1pd\n * If US, checks that wp_usp exists\n * Else If OptAnonConsent cookie exists, checks the value of targeting cookies consent\n * Else If EEA, always returns true\n * Else, returns false\n * @returns {boolean}\n */\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const { intl_region, country_code: countryCode } = WPGeo();\n\n if (countryCode === 'US') {\n return !!getCookie('wp_usp');\n }\n\n if (window.pageType === 'onboarding') {\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (\n typeof gdprAllowTargarting === 'boolean' &&\n checkAlertBoxClosedCookie()\n ) {\n return gdprAllowTargarting;\n }\n\n // Downstream systems\n // Checking for window.pageType === 'onboarding' to avoid being true on graphics articles etc for now -- MNI-710\n if (intl_region === 'EEA' && window.pageType === 'onboarding') {\n return true;\n }\n }\n\n return false;\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n DEFAULT_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport type { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n\nconst attributesCache: Record<string, any> = {};\nexport const getAttributes: GetAttributesType = async ({\n fieldName,\n}: {\n fieldName: string;\n}) => {\n if (attributesCache[fieldName]) {\n return attributesCache[fieldName];\n }\n\n const fieldNames = [fieldName];\n\n try {\n const url = new URL(`${base}/attributes`);\n url.searchParams.set('attributes', fieldNames.join(','));\n\n const data = await fetch(url.toString(), {\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n });\n const json = await data.json();\n\n if (data.ok && json.status === ResponseStatus.SUCCESS) {\n const attributes = json.attributes || [];\n attributesCache[fieldName] = attributes;\n return attributes;\n }\n return [];\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n","const sendGAEvent = (props: {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}): void => {\n if (typeof window === 'undefined') {\n if (__DEV__) console.warn('NO WINDOW');\n return;\n }\n // Initialize dataLayer if needed\n window.dataLayer = window.dataLayer || [];\n\n const eventData: Record<string, any> = {\n ...props,\n };\n window.dataLayer.push(eventData);\n};\n\ntype SendToGaType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<true>;\n\nexport const sendToGA: SendToGaType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n sendGAEvent({\n event: 'site-onpage-click',\n action: 'site-onpage-click',\n category: 'profile',\n\n label: fieldName,\n 'de-label': fieldName,\n [fieldName]: value,\n\n section: 'profile',\n subsection: source,\n });\n\n return true;\n};\n","import {\n ENDPOINTS,\n DEFAULT_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { type IngestResponseState, IngestType } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n const jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type: IngestType.EXPLICIT,\n wapo_login_id, // TODO: move this to BE to read from cookie headers\n data: {\n [fieldName]: [value],\n },\n metadata: { source },\n };\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n body: JSON.stringify(payload),\n });\n\n const json = await response.json();\n\n return json;\n } catch (e) {\n console.debug(e);\n return null;\n }\n};\n\ntype IngestType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<{\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import { getCookie, isLoggedIn } from '@washingtonpost/subs-sdk';\n\nexport const isAnonymousWebview = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_wv = getCookie('wp_wv');\n\n return !!(wp_wv && !isLoggedIn());\n};\n","import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { CollectionBehaviors, IngestType } from '../interfaces';\nimport type { IngestResponseState } from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<\n | {\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n\nexport const push: PushType = async ({ submitData, source }) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n if (isAnonymousWebview()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const { fieldName } = submitData;\n\n const attributeInfo = await getAttributes({\n fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n const type =\n attributeInfo[0] && attributeInfo[0].explicit === true\n ? IngestType.EXPLICIT\n : IngestType.IMPLICIT;\n\n if (!attributeInfo[0] && __DEV__) {\n console.warn(`no attribute info found for ${fieldName}, assuming implicit`);\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, source });\n }\n return sendToGA({ submitData, source });\n};\n","import React, { useEffect, useState } from 'react';\nimport { Icon, Select, styled, theme } from '@washingtonpost/wpds-ui-kit';\nimport { useWindowSize } from '@washingtonpost/subs-hooks';\nimport { ChevronDown } from '@washingtonpost/wpds-assets';\n\ninterface IDropdownProps {\n id: string;\n label: string;\n values: Array<string>;\n required?: boolean;\n existingValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n valueSelectedByDefault?: string;\n}\n\nconst StyledMobileSelect = styled('select', {\n padding: '12px 16px 12px 6px',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n backgroundColor: '$secondary',\n color: '$primary',\n fontFamily: '$meta',\n fontSize: '$100',\n fontWeight: '$light',\n lineHeight: '$125',\n paddingBlockRight: '$125',\n textOverflow: 'ellipsis',\n position: 'relative',\n borderColor: 'transparent',\n borderRightWidth: '10px',\n borderRightColor: 'transparent',\n appearance: 'none',\n '-webkit-appearance': 'none',\n '&:disabled': {\n backgroundColor: theme.colors.disabled,\n borderColor: theme.colors.disabled,\n color: theme.colors.onDisabled,\n cursor: 'not-allowed',\n },\n});\n\nconst StyledSelectWrapper = styled('div', {\n width: '100%',\n maxWidth: '380px',\n borderRadius: '$012',\n borderColor: '$subtle',\n borderStyle: 'solid',\n borderWidth: '1px',\n backgroundColor: '$secondary',\n position: 'relative',\n});\n\nconst StyledMobileOption = styled('option', {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n color: 'inherit',\n});\n\n/**\n * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.\n * @param {IDropdownProps} props The props.\n * @returns {React.ReactElement} The dropdown.\n */\nexport const Dropdown = ({\n id,\n label,\n values,\n required = false,\n existingValue,\n onChange = () => {},\n disabled = false,\n valueSelectedByDefault,\n}: IDropdownProps) => {\n const [answer, setAnswer] = useState<string>();\n const { isMobileSize } = useWindowSize();\n\n useEffect(() => {\n if (answer) onChange(answer);\n }, [answer]);\n\n const disabledProp = disabled ? { disabled: true } : {};\n\n const presetDropdownValue = existingValue || valueSelectedByDefault;\n\n // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : presetDropdownValue\n ? { defaultValue: presetDropdownValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === presetDropdownValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n {...disabledProp}\n >\n <label>{label}</label>\n <StyledMobileOption\n value=\"\"\n disabled\n selected\n style={{ color: '#666666' }}\n >\n {label}\n </StyledMobileOption>\n {values.map((value) => (\n <StyledMobileOption\n value={value}\n key={value}\n {...defaultValuePropMobile(value)}\n >\n {value}\n </StyledMobileOption>\n ))}\n </StyledMobileSelect>\n <Icon\n label=\"\"\n size=\"100\"\n fill={theme.colors.gray80}\n style={{\n pointerEvents: 'none',\n position: 'absolute',\n right: '10px',\n top: '50%',\n transform: 'translateY(-50%)',\n }}\n >\n <ChevronDown style={{ position: 'absolute', right: '10px' }} />\n </Icon>\n </StyledSelectWrapper>\n ) : (\n <Select.Root\n onValueChange={(e) => setAnswer(e)}\n required={required}\n {...defaultValueProp}\n {...disabledProp}\n >\n <Select.Trigger data-test-id={`${id}-select-trigger`}>\n <Select.Label>{label}</Select.Label>\n <Select.Value />\n </Select.Trigger>\n <Select.Content\n css={{ zIndex: theme.zIndices.page }}\n data-test-id={`${id}-select-content`}\n >\n {values.map((value) => (\n <Select.Item value={value} key={value}>\n {value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Select, styled } from '@washingtonpost/wpds-ui-kit';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport type { Attribute, AttributeValue } from '../../interfaces';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n existingValue?: string;\n disabled?: boolean;\n submit: boolean;\n onChange?: ({ value }: { value: string }) => void;\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n valuesFilter?: (value: AttributeValue) => boolean;\n selectProps?: {\n root?: any;\n trigger?: any;\n label?: any;\n value?: any;\n content?: any;\n item?: any;\n };\n children?: React.ReactNode;\n valueSelectedByDefault?: string;\n defaultValue?: never;\n}\n\nconst scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;\n\nconst SelectWrapper = styled('div', {\n boxSizing: 'border-box',\n display: 'flex',\n marginBottom: '$100',\n flexDirection: 'column',\n '& button': {\n padding: '1px 6px',\n },\n '& *': { boxSizing: 'border-box' },\n});\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n existingValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n valueSelectedByDefault,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState(\n !existingValue && valueSelectedByDefault ? valueSelectedByDefault : ''\n );\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const config = await window?.__twpdeu?.getFieldConfigs({\n fieldName,\n });\n if (config) {\n setConfig(config[0]);\n } else {\n console.error('unable to get config', fieldName);\n }\n } catch (e) {\n console.warn('unable to get config', fieldName, e);\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && !(children || config)) {\n fetchConfig();\n }\n }, [scriptStatus]);\n\n useEffect(() => {\n const submitSelected = async () => {\n try {\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n source,\n });\n\n const isError =\n result === true\n ? false\n : result\n ? result.status !== ResponseStatus.SUCCESS\n : true;\n\n onFinished({\n isFinished: true,\n isError,\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n onFinished({\n isFinished: false,\n isError: true,\n });\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && submit && selected) {\n submitSelected();\n }\n }, [scriptStatus, submit]);\n\n const defaultValueProp =\n existingValue && config ? { defaultValue: existingValue } : {};\n\n const isLoading = !(children || config);\n\n const disabledProp = disabled || isLoading ? { disabled: true } : {};\n\n // sort and filter out archived values\n // Note: config.values may be readonly\n const values = config\n ? [...config.values]\n .sort((a, b) => a.order - b.order)\n .filter((value) => value.archived !== true)\n .filter(valuesFilter)\n : [];\n\n return (\n <SelectWrapper>\n {children && (\n <Select.Root\n onValueChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n {...defaultValueProp}\n {...disabledProp}\n >\n {children}\n </Select.Root>\n )}\n {!children && !config && (\n <Dropdown\n id={'loading'}\n label={'Loading...'}\n values={[]}\n disabled={true}\n />\n )}\n {!children && config && (\n <Dropdown\n id={config.name}\n label={label || config.name}\n onChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n values={values.map((value) => value.name)}\n existingValue={existingValue}\n disabled={disabled}\n valueSelectedByDefault={valueSelectedByDefault}\n />\n )}\n </SelectWrapper>\n );\n};\n","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport type {\n DisclosureConfig,\n DisclosureConfigValue,\n} from '../../../interfaces/disclosure';\n\nconst configSrc = `${\n ENDPOINTS.base === 'https://subscribe.washingtonpost.com'\n ? 'https://www.washingtonpost.com/subscribe'\n : ENDPOINTS.base\n}/config/de/disclosure.json`;\n\nexport const getConfig = async () => {\n let myConfig: DisclosureConfigValue | undefined;\n\n // step 1: fetch config\n const response = await fetch(configSrc);\n const remoteConfig: DisclosureConfig = await response.json();\n\n // step 2: figure out which part of the config to use\n\n // if country- or region-specific config found, use that\n const { country_code, intl_region } = WPGeo();\n Object.keys(remoteConfig).forEach((configKey) => {\n if (\n country_code &&\n configKey.split('|').includes(country_code.toLowerCase())\n ) {\n myConfig = remoteConfig[configKey];\n } else if (intl_region === 'EEA' && configKey === 'eea') {\n myConfig = remoteConfig[configKey];\n }\n });\n\n // TODO: Check for billing country also\n\n // else if no country-specific config, use the default config\n if (typeof myConfig === 'undefined' && remoteConfig._) {\n myConfig = remoteConfig._;\n }\n\n return myConfig;\n};\n","import React from 'react';\n\ntype hydrateLinksType = (\n str: string,\n onLinkClick: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str, onLinkClick = () => {}) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((chunk, i) => {\n if (chunk === '{{PRIVACY_POLICY}}') {\n return (\n <a\n key={`privacy-link-${i}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n onClick={(e) => onLinkClick(e)}\n >\n Privacy Policy\n </a>\n );\n }\n return chunk;\n });\n\n const toReturn = chunks.reduce(\n (prev, current) => (\n <>\n {prev}\n {current}\n </>\n ),\n <></>\n );\n\n return toReturn;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\nexport const checkOptanonConsentCookie = () => {\n const value = getCookie(COOKIE) || '';\n return value.length > 12;\n};\n","import { useState, useEffect } from 'react';\nimport type { ICookieStore } from '@washingtonpost/subs-sdk';\nimport { listenToCookieStore as listenToCookieStoreUtil } from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxClosedCookie } from '../utils/checkAlertBoxClosedCookie';\nimport { checkOptanonConsentCookie } from '../utils/checkOptAnonConsentCookie';\n\nconst CONSENT_COOKIE = 'OptanonConsent';\n\nconst ALERT_BOX_COOKIE = 'OptanonAlertBoxClosed';\n\ninterface TCData {\n eventStatus: 'tcloaded' | 'cmpuishown' | 'useractioncomplete';\n listenerId: number;\n [key: string]: any;\n}\n\ntype TCFAPIAddListener = (\n command: 'addEventListener',\n version: number,\n callback: (tcData: TCData, success: boolean) => void\n) => void;\n\ntype TCFAPIRmListener = (\n command: 'removeEventListener',\n version: number,\n callback: (success: boolean) => void,\n listenerId: number\n) => void;\n\ntype TCFAPIPing = (\n command: 'ping',\n version: number,\n callback: (pingReturn: any, success: boolean) => void\n) => void;\n\ndeclare global {\n interface Window {\n cookieStore?: ICookieStore;\n __tcfapi?: TCFAPIAddListener & TCFAPIRmListener & TCFAPIPing;\n }\n}\n\nexport const useOnetrust = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\n}) => {\n const [consentCookieExists, setConsentCookieExists] = useState<\n boolean | undefined\n >();\n const [alertBoxClosed, setAlertBoxClosed] = useState<boolean | undefined>();\n\n const [listenToCookieStore, setListenToCookieStore] = useState(false);\n const [listenToTcfApi, setListenToTcfApi] = useState(false);\n\n useEffect(() => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n return;\n }\n\n if (!window.__tcfapi) {\n console.warn('warning: __tcfapi not found');\n }\n\n if (window?.cookieStore && allowCookieStore) {\n setListenToCookieStore(true);\n } else if (window.__tcfapi) {\n setListenToTcfApi(true);\n } else {\n console.warn('warning: neither cookieStore nor __tcfapi found');\n }\n }, []);\n\n useEffect(() => {\n const cleanupFns: ((() => void) | null)[] = [];\n if (listenToCookieStore && window.cookieStore) {\n const cleanupFn = listenToCookieStoreUtil(CONSENT_COOKIE, () => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n });\n cleanupFns.push(cleanupFn);\n\n const cleanupFn2 = listenToCookieStoreUtil(ALERT_BOX_COOKIE, () => {\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n cleanupFns.push(cleanupFn2);\n }\n return () => {\n cleanupFns.forEach((fn) => fn && fn());\n };\n }, [listenToCookieStore]);\n\n useEffect(() => {\n let listenerId: number;\n if (listenToTcfApi && window.__tcfapi) {\n const callback = (_tcData: TCData, success: boolean) => {\n if (success) {\n listenerId = _tcData.listenerId;\n\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n // tcData.eventStatus can be:\n // tcloaded means user has made a choice and we’re ready to check it\n // cmpuishown means the banner is shown\n // useractioncomplete means the user has interacted with the banner\n\n // but actually if the result for any of these is true, we just use the value of the cookie\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n }\n }\n };\n\n window.__tcfapi('addEventListener', 2, callback);\n }\n\n // cleanup fn\n return () => {\n if (window.__tcfapi && listenerId)\n window.__tcfapi(\n 'removeEventListener',\n 2,\n (success) => {\n console.debug(success);\n },\n listenerId\n );\n };\n }, [listenToTcfApi]);\n\n return {\n consentCookieExists,\n alertBoxClosed,\n listenToCookieStore,\n listenToTcfApi,\n };\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOnetrust } from './hooks/useOnetrust';\n\ninterface DEDisclosureWithBannerStatusProps {\n config: DisclosureConfigValue;\n allowCookieStore?: boolean;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithBannerStatus: React.FC<\n DEDisclosureWithBannerStatusProps\n> = ({\n config,\n onFinished,\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n const { alertBoxClosed, consentCookieExists } = useOnetrust({\n allowCookieStore,\n });\n\n useEffect(() => {\n if (config) {\n // step 3: set disclosure based on config\n\n if (alertBoxClosed) {\n setDisclosure(config.disclosure_afterbanner);\n } else {\n setDisclosure(config.disclosure_beforebanner);\n }\n }\n }, [alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering && consentCookieExists) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering, consentCookieExists]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\n\ninterface DEDisclosureWithoutBannerStatusProps {\n config: DisclosureConfigValue;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithoutBannerStatus: React.FC<\n DEDisclosureWithoutBannerStatusProps\n> = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n useEffect(() => {\n if (config) {\n setDisclosure(config.disclosure);\n }\n }, [config]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { DEDisclosureWithBannerStatus } from './DisclosureWithBannerStatus';\nimport { DEDisclosureWithoutBannerStatus } from './DisclosureWithoutBannerStatus';\n\ninterface DisclosureProps {\n /** callback function to be called when the disclosure is finished loading */\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n\n /** ability to turn off cookiestore listener, primarily for testing purposes */\n allowCookieStore?: boolean;\n}\n\nexport const DEDisclosure: React.FC<DisclosureProps> = ({\n onFinished = () => {},\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n const [myConfig, setMyConfig] = useState<DisclosureConfigValue>();\n // const { alertBoxClosed } = useOneTrustAlertBoxClosed({ allowCookieStore });\n\n useEffect(() => {\n (async () => {\n const config = await getConfig();\n setMyConfig(config);\n\n if (!config) {\n console.error('No config found');\n }\n })();\n }, []);\n\n useEffect(() => {\n if (myConfig) {\n // step 3: set disclosure based on config\n\n // if config says to check onetrust, check onetrust\n if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {\n // check if onetrust is closed\n // if it is, show the after banner disclosure\n // if it is not, show the before banner disclosure\n setDisclosureRendering(\n <DEDisclosureWithBannerStatus\n config={myConfig}\n allowCookieStore={allowCookieStore}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else if ('disclosure' in myConfig) {\n setDisclosureRendering(\n <DEDisclosureWithoutBannerStatus\n config={myConfig}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig]);\n\n if (disclosureRendering) {\n return <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>;\n }\n\n return <div data-test-id=\"de-disclosure-loading\"></div>;\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\n JOB_TITLE: 'profile_job_title',\n PERSONAL_GOALS: 'personal_goals',\n HOBBIES: 'hobbies',\n PROFESSIONAL_GOALS: 'professional_goals',\n INDUSTRY: 'industry',\n NEWS_LOCATION: 'news_location',\n NY_PERSONAL_GOALS: 'new_year_personal_goals',\n NY_HOBBIES: 'new_year_hobbies',\n NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',\n NY_INDUSTRY: 'new_year_industry',\n NY_NEWS_LOCATION: 'new_year_news_location',\n EDU_ROLE: 'profile_edu_role',\n EDU_MAJOR: 'profile_edu_major',\n EDU_GRADUATION_YEAR: 'profile_edu_graduation_year',\n} as const;\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CACJ,MAAM,CAAC,qBAAqB,0BAC1B,SAA6B,KAAK;CACpC,MAAM,CAAC,UAAU,eAAe,UAAiC;AAGjE,iBAAgB;AACd,GAAC,YAAY;GACX,MAAM,SAAS,MAAM,WAAW;AAChC,eAAY,OAAO;AAEnB,OAAI,CAAC,OACH,SAAQ,MAAM,kBAAkB;MAEhC;IACH,EAAE,CAAC;AAEN,iBAAgB;AACd,MAAI,SAIF,KAAI,uBAAuB,YAAY,SAAS,kBAI9C,wBACE,oBAAC,8BAAD;GACE,QAAQ;GACU;GACN;GACU;GACtB,CAAA,CACH;WACQ,gBAAgB,SACzB,wBACE,oBAAC,iCAAD;GACE,QAAQ;GACI;GACU;GACtB,CAAA,CACH;MAED,SAAQ,MAAM,iBAAiB;IAGlC,CAAC,SAAS,CAAC;AAEd,KAAI,oBACF,QAAO,oBAAC,OAAD;EAAK,gBAAa;YAAiB;EAA0B,CAAA;AAGtE,QAAO,oBAAC,OAAD,EAAK,gBAAa,yBAA8B,CAAA;;;;AC/EzD,IAAa,4BAA4B;CACvC,WAAW;CACX,cAAc;CACd,WAAW;CACX,gBAAgB;CAChB,SAAS;CACT,oBAAoB;CACpB,UAAU;CACV,eAAe;CACf,mBAAmB;CACnB,YAAY;CACZ,uBAAuB;CACvB,aAAa;CACb,kBAAkB;CAClB,UAAU;CACV,WAAW;CACX,qBAAqB;CACtB"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.11.
|
|
2
|
+
"version": "1.11.2",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
4
|
"main": "dist/index.cjs",
|
|
5
5
|
"module": "dist/index.js",
|
|
@@ -8,22 +8,12 @@
|
|
|
8
8
|
"dist",
|
|
9
9
|
"README.md"
|
|
10
10
|
],
|
|
11
|
-
"scripts": {
|
|
12
|
-
"start": "vite build --watch",
|
|
13
|
-
"build": "vite build",
|
|
14
|
-
"test": "APP_ENV=test vitest run",
|
|
15
|
-
"lint": "eslint src",
|
|
16
|
-
"size": "NODE_OPTIONS=--openssl-legacy-provider size-limit",
|
|
17
|
-
"analyze": "size-limit --why",
|
|
18
|
-
"prettier-check": "prettier \"**/*.{js,jsx,tsx,ts}\" --list-different --write",
|
|
19
|
-
"prepublishOnly": "npm run build && npm run size"
|
|
20
|
-
},
|
|
21
11
|
"peerDependencies": {
|
|
22
|
-
"@washingtonpost/subs-hooks": "^1.10.0",
|
|
23
|
-
"@washingtonpost/subs-sdk": "^2.13.0",
|
|
24
12
|
"@washingtonpost/wpds-ui-kit": "^2.3.1",
|
|
25
13
|
"react": ">=18.2.0",
|
|
26
|
-
"react-dom": ">=18.2.0"
|
|
14
|
+
"react-dom": ">=18.2.0",
|
|
15
|
+
"@washingtonpost/subs-hooks": "^1.14.2",
|
|
16
|
+
"@washingtonpost/subs-sdk": "^2.18.1"
|
|
27
17
|
},
|
|
28
18
|
"name": "@washingtonpost/subs-de-inputs",
|
|
29
19
|
"author": "Subs FE",
|
|
@@ -65,5 +55,14 @@
|
|
|
65
55
|
],
|
|
66
56
|
"dependencies": {
|
|
67
57
|
"@washingtonpost/wpds-assets": "^2.14.0"
|
|
58
|
+
},
|
|
59
|
+
"scripts": {
|
|
60
|
+
"start": "vite build --watch",
|
|
61
|
+
"build": "vite build",
|
|
62
|
+
"test": "APP_ENV=test vitest run",
|
|
63
|
+
"lint": "oxlint src e2e",
|
|
64
|
+
"size": "NODE_OPTIONS=--openssl-legacy-provider size-limit",
|
|
65
|
+
"analyze": "size-limit --why",
|
|
66
|
+
"prettier-check": "prettier \"**/*.{js,jsx,tsx,ts}\" --list-different --write"
|
|
68
67
|
}
|
|
69
|
-
}
|
|
68
|
+
}
|