@washingtonpost/subs-de-inputs 0.5.3-canary.0 → 0.5.3
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/CHANGELOG.md +57 -0
- package/dist/components/DEDisclosure/utils/checkCookie.d.ts +1 -0
- package/dist/constants/IngestDataTypes.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/subs-de-inputs.cjs.development.js +29 -28
- package/dist/subs-de-inputs.cjs.development.js.map +1 -1
- package/dist/subs-de-inputs.cjs.production.min.js +1 -1
- package/dist/subs-de-inputs.cjs.production.min.js.map +1 -1
- package/dist/subs-de-inputs.esm.js +29 -29
- package/dist/subs-de-inputs.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/DEDisclosure/utils/checkAlertBoxCookie.d.ts +0 -1
- package/dist/utils/checkConsentCookieForAllowTargeting.d.ts +0 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See
|
|
4
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
**[0.5.3 - 2024-07-09]**:
|
|
7
|
+
* Add `FirstPartyIngestDataTypes` constant
|
|
8
|
+
|
|
9
|
+
**[0.5.2 - 2024-07-05]**:
|
|
10
|
+
* Fix for cookie thing
|
|
11
|
+
|
|
12
|
+
**[0.5.1 - 2024-06-03]**:
|
|
13
|
+
* Fix for multi paragraph disclosures
|
|
14
|
+
* Support hydration for Privacy Policy link
|
|
15
|
+
|
|
16
|
+
**[0.5.0 - 2024-05-30]**:
|
|
17
|
+
* Added Disclosure component
|
|
18
|
+
|
|
19
|
+
**[0.4.2 - 2024-05-10]**:
|
|
20
|
+
* Fix exception from `<DESelect />` if `dataDictionaryConfig` prop is readonly (such as in redux toolkit)
|
|
21
|
+
* Don't submit data if wp_wv cookie and anonymous user (feedback from ERD)
|
|
22
|
+
|
|
23
|
+
**[0.4.1 - 2024-05-07]**:
|
|
24
|
+
* Set the correct `type` for ingest() API
|
|
25
|
+
|
|
26
|
+
**[0.4.0 - 2024-05-07]**:
|
|
27
|
+
* Support for `implicit` collection via GA
|
|
28
|
+
|
|
29
|
+
**[0.3.0 - 2024-05-06]**:
|
|
30
|
+
* Uses the native `<select />` element in smaller viewport sizes for better UX
|
|
31
|
+
|
|
32
|
+
**[0.2.2 - 2024-05-03]**:
|
|
33
|
+
* use `window.__twpdeu.push()` for submitting
|
|
34
|
+
* Better loading state when fetching config over the wire
|
|
35
|
+
* Prevent extra calls to `ingest` API if user changes value after clicking submit
|
|
36
|
+
* Fix `ingest()` function to send the right format (again)
|
|
37
|
+
|
|
38
|
+
**[0.2.1 - 2024-05-02]**:
|
|
39
|
+
* Revert "ESM build only"
|
|
40
|
+
* `ingest()` function throws error if `submitData.value` is not an array (required by BE)
|
|
41
|
+
|
|
42
|
+
**[0.2.0 - 2024-05-01]**:
|
|
43
|
+
* Adds `ingest()` function
|
|
44
|
+
* ESM build only
|
|
45
|
+
* Babel config to target recent browsers only
|
|
46
|
+
|
|
47
|
+
**[0.1.1 - 2024-04-30]**:
|
|
48
|
+
* Fix build by removing unused file
|
|
49
|
+
|
|
50
|
+
**[0.1.0 - 2024-04-25]**:
|
|
51
|
+
* Add initial `<DESelect />` component
|
|
52
|
+
|
|
53
|
+
**[0.0.2 - 2024-04-24]**:
|
|
54
|
+
* Fix build error
|
|
55
|
+
|
|
56
|
+
**[0.0.1 - 2024-04-09]**:
|
|
57
|
+
* Initial setup
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkCookie: () => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const FirstPartyIngestDataTypes: {
|
|
2
|
+
readonly JOB_LEVEL: "profile_job_level";
|
|
3
|
+
readonly JOB_INDUSTRY: "profile_job_industry";
|
|
4
|
+
readonly PERSONAL_GOALS: "personal_goals";
|
|
5
|
+
readonly HOBBIES: "hobbies";
|
|
6
|
+
readonly PROFESSIONAL_GOALS: "professional_goals";
|
|
7
|
+
readonly INDUSTRY: "industry";
|
|
8
|
+
readonly NEWS_LOCATION: "news_location";
|
|
9
|
+
readonly NY_PERSONAL_GOALS: "new_year_personal_goals";
|
|
10
|
+
readonly NY_HOBBIES: "new_year_hobbies";
|
|
11
|
+
readonly NY_PROFESSIONAL_GOALS: "new_year_professional_goals";
|
|
12
|
+
readonly NY_INDUSTRY: "new_year_industry";
|
|
13
|
+
readonly NY_NEWS_LOCATION: "new_year_news_location";
|
|
14
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -36,34 +36,11 @@ const IngestResponseState = {
|
|
|
36
36
|
DO_NOT_COLLECT: '110'
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
const COOKIE = 'OptanonConsent';
|
|
40
|
-
/**
|
|
41
|
-
* Checks the users OptanonConsent cookie to determine if the user has allowed targeting.
|
|
42
|
-
* Returns true or false if the flag is found in the cookie, null otherwise.
|
|
43
|
-
* @returns {boolean | null}
|
|
44
|
-
*/
|
|
45
|
-
const checkConsentCookieForAllowTargeting = () => {
|
|
46
|
-
const value = subsSdk.getCookie(COOKIE) || '';
|
|
47
|
-
return value.includes('C0004%3A1') ? true : value.includes('C0004%3A0') ? false : null;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const COOKIE$1 = 'OptanonAlertBoxClosed';
|
|
51
|
-
const checkAlertBoxCookie = () => {
|
|
52
|
-
const value = subsSdk.getCookie(COOKIE$1) || '';
|
|
53
|
-
// Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)
|
|
54
|
-
// "Invalid date" is 12 characters long
|
|
55
|
-
return value.length > 12;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
39
|
const hasRequiredPrivacyCookies = () => {
|
|
59
40
|
var _WPGeo;
|
|
60
41
|
if (typeof window === 'undefined') {
|
|
61
42
|
return false;
|
|
62
43
|
}
|
|
63
|
-
const gdprAllowTargarting = checkConsentCookieForAllowTargeting();
|
|
64
|
-
if (typeof gdprAllowTargarting === 'boolean' && checkAlertBoxCookie()) {
|
|
65
|
-
return gdprAllowTargarting;
|
|
66
|
-
}
|
|
67
44
|
const wp_usp = subsSdk.getCookie('wp_usp');
|
|
68
45
|
const countryCode = (_WPGeo = subsSdk.WPGeo()) === null || _WPGeo === void 0 ? void 0 : _WPGeo.country_code;
|
|
69
46
|
return !!(wp_usp && countryCode === 'US');
|
|
@@ -513,7 +490,15 @@ const hydrateLinks = str => {
|
|
|
513
490
|
return toReturn;
|
|
514
491
|
};
|
|
515
492
|
|
|
516
|
-
const COOKIE
|
|
493
|
+
const COOKIE = 'OptanonAlertBoxClosed';
|
|
494
|
+
const checkCookie = () => {
|
|
495
|
+
const value = subsSdk.getCookie(COOKIE) || '';
|
|
496
|
+
// Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)
|
|
497
|
+
// "Invalid date" is 12 characters long
|
|
498
|
+
return value.length > 12;
|
|
499
|
+
};
|
|
500
|
+
|
|
501
|
+
const COOKIE$1 = 'OptanonAlertBoxClosed';
|
|
517
502
|
const useOneTrustAlertBoxClosed = _ref => {
|
|
518
503
|
let {
|
|
519
504
|
allowCookieStore
|
|
@@ -523,7 +508,7 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
523
508
|
const [listenToTcfApi, setListenToTcfApi] = React.useState(false);
|
|
524
509
|
React.useEffect(() => {
|
|
525
510
|
var _window;
|
|
526
|
-
if (
|
|
511
|
+
if (checkCookie()) {
|
|
527
512
|
setAlertBoxClosed(true);
|
|
528
513
|
return;
|
|
529
514
|
}
|
|
@@ -541,8 +526,8 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
541
526
|
React.useEffect(() => {
|
|
542
527
|
let cleanupFn = () => {};
|
|
543
528
|
if (listenToCookieStore && window.cookieStore) {
|
|
544
|
-
cleanupFn = subsSdk.listenToCookieStore(COOKIE$
|
|
545
|
-
if (
|
|
529
|
+
cleanupFn = subsSdk.listenToCookieStore(COOKIE$1, () => {
|
|
530
|
+
if (checkCookie()) {
|
|
546
531
|
setAlertBoxClosed(true);
|
|
547
532
|
} else {
|
|
548
533
|
setAlertBoxClosed(false);
|
|
@@ -562,7 +547,7 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
562
547
|
// cmpuishown means the banner is shown
|
|
563
548
|
// useractioncomplete means the user has interacted with the banner
|
|
564
549
|
// but actually if the result for any of these is true, we just use the value of the cookie
|
|
565
|
-
if (
|
|
550
|
+
if (checkCookie()) {
|
|
566
551
|
setAlertBoxClosed(true);
|
|
567
552
|
}
|
|
568
553
|
}
|
|
@@ -644,10 +629,26 @@ const DEDisclosure = _ref => {
|
|
|
644
629
|
}, disclosureRendering);
|
|
645
630
|
};
|
|
646
631
|
|
|
632
|
+
const FirstPartyIngestDataTypes = {
|
|
633
|
+
JOB_LEVEL: 'profile_job_level',
|
|
634
|
+
JOB_INDUSTRY: 'profile_job_industry',
|
|
635
|
+
PERSONAL_GOALS: 'personal_goals',
|
|
636
|
+
HOBBIES: 'hobbies',
|
|
637
|
+
PROFESSIONAL_GOALS: 'professional_goals',
|
|
638
|
+
INDUSTRY: 'industry',
|
|
639
|
+
NEWS_LOCATION: 'news_location',
|
|
640
|
+
NY_PERSONAL_GOALS: 'new_year_personal_goals',
|
|
641
|
+
NY_HOBBIES: 'new_year_hobbies',
|
|
642
|
+
NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',
|
|
643
|
+
NY_INDUSTRY: 'new_year_industry',
|
|
644
|
+
NY_NEWS_LOCATION: 'new_year_news_location'
|
|
645
|
+
};
|
|
646
|
+
|
|
647
647
|
exports.AttributesState = AttributesState;
|
|
648
648
|
exports.CollectionBehaviors = CollectionBehaviors;
|
|
649
649
|
exports.DEDisclosure = DEDisclosure;
|
|
650
650
|
exports.DESelect = DESelect;
|
|
651
|
+
exports.FirstPartyIngestDataTypes = FirstPartyIngestDataTypes;
|
|
651
652
|
exports.IngestResponseState = IngestResponseState;
|
|
652
653
|
exports.IngestType = IngestType;
|
|
653
654
|
exports.getAttributes = getAttributes;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subs-de-inputs.cjs.development.js","sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxCookie.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/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/index.tsx"],"sourcesContent":["export 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\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","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 checkAlertBoxCookie = () => {\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 { checkAlertBoxCookie } from '../components/DEDisclosure/utils/checkAlertBoxCookie';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (typeof gdprAllowTargarting === 'boolean' && checkAlertBoxCookie()) {\n return gdprAllowTargarting;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\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\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\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","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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 = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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 { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxCookie } from '../utils/checkAlertBoxCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkAlertBoxCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkAlertBoxCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkAlertBoxCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","AttributesState","SUCCESS","IngestType","EXPLICIT","IMPLICIT","IngestResponseState","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","COOKIE","checkConsentCookieForAllowTargeting","value","getCookie","includes","checkAlertBoxCookie","length","hasRequiredPrivacyCookies","window","gdprAllowTargarting","wp_usp","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","_ref","fieldName","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","attributes","e","console","debug","sendGAEvent","props","process","env","NODE_ENV","warn","dataLayer","eventData","push","sendToGA","submitData","source","event","action","category","label","section","subsection","ingest","wapo_login_id","jucid","localStorage","getItem","ga","payload","type","metadata","response","method","body","JSON","stringify","isAnonymousWebview","wp_wv","isLoggedIn","Error","attributeInfo","name","collection_behavior","explicit","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","ScriptStatus","READY","submitSelected","_window2","result","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection","configSrc","getConfig","myConfig","undefined","remoteConfig","intl_region","Object","keys","forEach","configKey","split","toLowerCase","hydrateLinks","str","array","chunks","className","href","toReturn","reduce","prev","current","useOneTrustAlertBoxClosed","allowCookieStore","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","DEDisclosure","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","setMyConfig","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","isArray"],"mappings":";;;;;;;;;;;;;MAQaA,mBAAmB,GAAG;EACjCC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE;;MAeLC,eAAe,GAAG;EAC7BC,OAAO,EAAE;;MAGEC,UAAU,GAAG;EACxBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE;;MAGCC,mBAAmB,GAAG;EACjCJ,OAAO,EAAE,KAAK;EACdK,YAAY,EAAE,KAAK;EACnBC,YAAY,EAAE,KAAK;EACnBC,kBAAkB,EAAE,KAAK;EACzBC,YAAY,EAAE,KAAK;EACnBC,4BAA4B,EAAE,KAAK;EACnCC,uBAAuB,EAAE,KAAK;EAC9BC,eAAe,EAAE,KAAK;EACtBC,qBAAqB,EAAE,KAAK;EAC5BC,6BAA6B,EAAE,KAAK;EACpCf,cAAc,EAAE;;;AC3ClB,MAAMgB,MAAM,GAAG,gBAAgB;AAE/B;;;;;AAKA,AAAO,MAAMC,mCAAmC,GAAGA;EACjD,MAAMC,KAAK,GAAGC,iBAAS,CAACH,MAAM,CAAC,IAAI,EAAE;EACrC,OAAOE,KAAK,CAACE,QAAQ,CAAC,WAAW,CAAC,GAC9B,IAAI,GACJF,KAAK,CAACE,QAAQ,CAAC,WAAW,CAAC,GAC3B,KAAK,GACL,IAAI;AACV,CAAC;;ACdD,MAAMJ,QAAM,GAAG,uBAAuB;AAEtC,AAAO,MAAMK,mBAAmB,GAAGA;EACjC,MAAMH,KAAK,GAAGC,i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,sBAAsB,CAAC;SAC/C,MAAM;UACLL,aAAa,CAACtC,QAAQ,CAAC4C,uBAAuB,CAAC;;OAElD,MAAM,IAAI,YAAY,IAAI5C,QAAQ,EAAE;QACnCsC,aAAa,CAACtC,QAAQ,CAACqC,UAAU,CAAC;OACnC,MAAM;QACL7L,OAAO,CAACmI,KAAK,CAAC,gBAAgB,CAAC;;;GAGpC,EAAE,CAACqB,QAAQ,EAAEsB,cAAc,CAAC,CAAC;EAE9B3F,eAAS,CAAC;IACR,IAAI0G,UAAU,IAAIQ,KAAK,CAACC,OAAO,CAACT,UAAU,CAAC,EAAE;MAC3CG,sBAAsB,CACpBH,UAAU,CAACpB,MAAM,CAAC,CAACC,IAAI,EAAEC,OAAO;QAC9B,OACEnF,4DACGkF,IAAI,EACLlF,wCAAI0E,YAAY,CAACS,OAAO,CAAC,CAAK,CAC7B;OAEN,EAAEnF,2DAAK,CAAC,CACV;;MAGD+B,UAAU,CAAC;QACTmB,UAAU,EAAE,IAAI;QAChBD,OAAO,EAAE;OACV,CAAC;;GAEL,EAAE,CAACoD,UAAU,CAAC,CAAC;EAEhB,OAAOA,UAAU,KAAK,IAAI,GACxBrG;oBAAkB;IAA8B,GAEhDA;oBAAkB;KAAiBuG,mBAAmB,CACvD;AACH,CAAC;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"subs-de-inputs.cjs.development.js","sources":["../src/interfaces/index.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/checkCookie.ts","../src/components/DEDisclosure/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["export 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\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","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\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\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\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","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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 = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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 = 'OptanonAlertBoxClosed';\n\nexport const checkCookie = () => {\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 { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkCookie } from '../utils/checkCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\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} as const;"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","AttributesState","SUCCESS","IngestType","EXPLICIT","IMPLICIT","IngestResponseState","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","hasRequiredPrivacyCookies","window","wp_usp","getCookie","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","_ref","fieldName","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","attributes","e","console","debug","sendGAEvent","props","process","env","NODE_ENV","warn","dataLayer","eventData","push","sendToGA","submitData","value","source","event","action","category","label","section","subsection","ingest","wapo_login_id","jucid","localStorage","getItem","ga","payload","type","metadata","response","method","body","JSON","stringify","isAnonymousWebview","wp_wv","isLoggedIn","Error","attributeInfo","name","collection_behavior","explicit","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","ScriptStatus","READY","submitSelected","_window2","result","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection","configSrc","getConfig","myConfig","undefined","remoteConfig","intl_region","Object","keys","forEach","configKey","split","includes","toLowerCase","hydrateLinks","str","array","chunks","className","href","toReturn","reduce","prev","current","COOKIE","checkCookie","length","useOneTrustAlertBoxClosed","allowCookieStore","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","DEDisclosure","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","setMyConfig","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","isArray","FirstPartyIngestDataTypes","JOB_LEVEL","JOB_INDUSTRY","PERSONAL_GOALS","HOBBIES","PROFESSIONAL_GOALS","INDUSTRY","NEWS_LOCATION","NY_PERSONAL_GOALS","NY_HOBBIES","NY_PROFESSIONAL_GOALS","NY_INDUSTRY","NY_NEWS_LOCATION"],"mappings":";;;;;;;;;;;;;MAQaA,mBAAmB,GAAG;EACjCC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE;;MAeLC,eAAe,GAAG;EAC7BC,OAAO,EAAE;;MAGEC,UAAU,GAAG;EACxBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE;;MAGCC,mBA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AAE,UAAU;EACpBC,aAAa,EAAE,eAAe;EAC9BC,iBAAiB,EAAE,yBAAyB;EAC5CC,UAAU,EAAE,kBAAkB;EAC9BC,qBAAqB,EAAE,6BAA6B;EACpDC,WAAW,EAAE,mBAAmB;EAChCC,gBAAgB,EAAE;CACV;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@washingtonpost/subs-sdk"),o=require("react"),n=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@washingtonpost/subs-sdk"),o=require("react"),n=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,a=require("@washingtonpost/wpds-ui-kit"),i=require("@washingtonpost/subs-hooks"),s=require("@washingtonpost/wpds-assets");const r={COLLECT:"COLLECT",DO_NOT_COLLECT:"DO_NOT_COLLECT"},l={EXPLICIT:"explicit",IMPLICIT:"implicit"},c=()=>{var e;if("undefined"==typeof window)return!1;const o=t.getCookie("wp_usp"),n=null===(e=t.WPGeo())||void 0===e?void 0:e.country_code;return!(!o||"US"!==n)},d=t.ENDPOINTS.base+"/de/v1",u={},p=async e=>{let{fieldName:o}=e;if(u[o])return u[o];const n=[o];try{const e=new URL(d+"/attributes");e.searchParams.set("attributes",n.join(","));const a=await fetch(e.toString(),{credentials:"include",headers:t.JSON_HEADERS}),i=await a.json();if(a.ok&&i.status===t.ResponseStatus.SUCCESS){const e=i.attributes||[];return u[o]=e,e}return[]}catch(e){return console.debug(e),[]}},E=t.ENDPOINTS.base+"/de/v1",w=a.styled("select",{padding:"12px 16px 12px 6px",display:"flex",justifyContent:"space-between",width:"100%",backgroundColor:"$secondary",color:"$primary",fontFamily:"$meta",fontSize:"$100",fontWeight:"$light",lineHeight:"$125",paddingBlockRight:"$125",textOverflow:"ellipsis",position:"relative",borderColor:"transparent",borderRightWidth:"10px",borderRightColor:"transparent",appearance:"none","-webkit-appearance":"none","&:disabled":{backgroundColor:a.theme.colors.disabled,borderColor:a.theme.colors.disabled,color:a.theme.colors.onDisabled,cursor:"not-allowed"}}),f=a.styled("div",{width:"100%",maxWidth:"380px",borderRadius:"$012",borderColor:"$subtle",borderStyle:"solid",borderWidth:"1px",backgroundColor:"$secondary",position:"relative"}),_=a.styled("option",{fontFamily:"inherit",fontSize:"inherit",color:"inherit"}),g=e=>{let{id:t,label:r,values:l,required:c=!1,defaultValue:d,onChange:u=(()=>{}),disabled:p=!1}=e;const[E,g]=o.useState(),{isMobileSize:b}=i.useWindowSize();o.useEffect(()=>{E&&u(E)},[E]);const S=p?{disabled:!0}:{},h=E?{defaultValue:E}:d?{defaultValue:d}:{},m=e=>E?e===E?{selected:!0}:{}:e===d?{selected:!0}:{};return b?n.createElement(f,null,n.createElement(w,{id:"",required:c,onChange:e=>g(e.target.value),placeholder:r,...S},n.createElement("label",null,r),n.createElement(_,{value:"",disabled:!0,selected:!0,style:{color:"#666666"}},r),l.map(e=>n.createElement(_,{value:e,key:e,...m(e)},e))),n.createElement(a.Icon,{label:"",size:"100",fill:a.theme.colors.gray80,style:{pointerEvents:"none",position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)"}},n.createElement(s.ChevronDown,{style:{position:"absolute",right:"10px"}}))):n.createElement(a.Select.Root,{onValueChange:e=>g(e),required:c,...h,...S},n.createElement(a.Select.Trigger,{"data-test-id":t+"-select-trigger"},n.createElement(a.Select.Label,null,r),n.createElement(a.Select.Value,null)),n.createElement(a.Select.Content,{css:{zIndex:a.theme.zIndices.page},"data-test-id":t+"-select-content"},l.map(e=>n.createElement(a.Select.Item,{value:e,key:e},e))))},b=("https://subscribe.washingtonpost.com/static"===t.ENDPOINTS.staticAssets?"https://www.washingtonpost.com/subscribe/static/":t.ENDPOINTS.staticAssets)+"/de-utils/twpdeu.min.js",S=a.styled("div",{boxSizing:"border-box",display:"flex",marginBottom:"$100",flexDirection:"column","& button":{padding:"1px 6px"},"& *":{boxSizing:"border-box"}}),h=("https://subscribe.washingtonpost.com"===t.ENDPOINTS.base?"https://www.washingtonpost.com/subscribe":t.ENDPOINTS.base)+"/config/de/disclosure.json",m=()=>(t.getCookie("OptanonAlertBoxClosed")||"").length>12;exports.AttributesState={SUCCESS:"100"},exports.CollectionBehaviors=r,exports.DEDisclosure=e=>{let{onFinished:a=(()=>{}),allowCookieStore:i=!0}=e;const[s,r]=o.useState(null),[l,c]=o.useState(null),[d,u]=o.useState(),{alertBoxClosed:p}=(e=>{let{allowCookieStore:n}=e;const[a,i]=o.useState(),[s,r]=o.useState(!1),[l,c]=o.useState(!1);return o.useEffect(()=>{var e;m()?i(!0):(window.__tcfapi||console.warn("warning: __tcfapi not found"),null!==(e=window)&&void 0!==e&&e.cookieStore&&n?r(!0):window.__tcfapi?c(!0):console.warn("warning: neither cookieStore nor __tcfapi found"))},[]),o.useEffect(()=>{let e=()=>{};return s&&window.cookieStore&&(e=t.listenToCookieStore("OptanonAlertBoxClosed",()=>{m()?i(!0):i(!1)})),e||(()=>{})},[s]),o.useEffect(()=>{let e;return l&&window.__tcfapi&&window.__tcfapi("addEventListener",2,(t,o)=>{o&&(e=t.listenerId,m()&&i(!0))}),()=>{window.__tcfapi&&e&&window.__tcfapi("removeEventListener",2,e=>{console.debug(e)},e)}},[l]),{alertBoxClosed:a,listenToCookieStore:s,listenToTcfApi:l}})({allowCookieStore:i});return o.useEffect(()=>{(async()=>{const e=await(async()=>{let e=void 0;const o=await fetch(h),n=await o.json(),{country_code:a,intl_region:i}=t.WPGeo();return Object.keys(n).forEach(t=>{(a&&t.split("|").includes(a.toLowerCase())||"EEA"===i&&"eea"===t)&&(e=n[t])}),void 0===e&&n._&&(e=n._),e})();u(e),e||console.error("No config found")})()},[]),o.useEffect(()=>{d&&("checkBannerStatus"in d&&d.checkBannerStatus?r(p?d.disclosure_afterbanner:d.disclosure_beforebanner):"disclosure"in d?r(d.disclosure):console.error("Invalid config"))},[d,p]),o.useEffect(()=>{s&&Array.isArray(s)&&(c(s.reduce((e,t)=>n.createElement(n.Fragment,null,e,n.createElement("p",null,t.split(/({{PRIVACY_POLICY}})/g).map(e=>"{{PRIVACY_POLICY}}"===e?n.createElement("a",{target:"_blank",style:{color:"inherit"},className:"underline",href:"https://www.washingtonpost.com/privacy-policy/"},"Privacy Policy"):e).reduce((e,t)=>n.createElement(n.Fragment,null,e,t),n.createElement(n.Fragment,null)))),n.createElement(n.Fragment,null))),a({isFinished:!0,isError:!1}))},[s]),null===s?n.createElement("div",{"data-test-id":"de-disclosure-loading"}):n.createElement("div",{"data-test-id":"de-disclosure"},l)},exports.DESelect=e=>{let{source:s,fieldName:r,label:l,dataDictionaryConfig:c,defaultValue:d,disabled:u,submit:p,onChange:E=(()=>{}),onFinished:w=(()=>{}),valuesFilter:f=(()=>!0),children:_}=e;const[h,m]=o.useState(c),[I,C]=o.useState(""),y=i.useScript(b);o.useEffect(()=>{y!==i.ScriptStatus.READY||_||h||(async()=>{try{var e;const t=await(null===(e=window)||void 0===e||null===(e=e.__twpdeu)||void 0===e?void 0:e.getFieldConfigs({fieldName:r}));t?m(t[0]):console.error("unable to get config",r)}catch(e){console.warn("unable to get config",r,e)}})()},[y]),o.useEffect(()=>{y===i.ScriptStatus.READY&&p&&I&&(async()=>{try{var e;const o=await(null===(e=window)||void 0===e||null===(e=e.__twpdeu)||void 0===e?void 0:e.push({submitData:{fieldName:r,value:I},source:s}));w({isFinished:!0,isError:!0!==o&&(!o||o.status!==t.ResponseStatus.SUCCESS)})}catch(e){w({isFinished:!1,isError:!0})}})()},[y,p]);const N=d&&h?{defaultValue:d}:{},v=u||!_&&!h?{disabled:!0}:{},O=h?[...h.values].sort((e,t)=>e.order-t.order).filter(e=>!0!==e.archived).filter(f):[];return n.createElement(S,null,_&&n.createElement(a.Select.Root,{onValueChange:e=>{C(e),E({value:e})},...N,...v},_),!_&&!h&&n.createElement(g,{id:"loading",label:"Loading...",values:[],disabled:!0}),!_&&h&&n.createElement(g,{id:h.name,label:l||h.name,onChange:e=>{C(e),E({value:e})},values:O.map(e=>e.name),defaultValue:d,disabled:u}))},exports.FirstPartyIngestDataTypes={JOB_LEVEL:"profile_job_level",JOB_INDUSTRY:"profile_job_industry",PERSONAL_GOALS:"personal_goals",HOBBIES:"hobbies",PROFESSIONAL_GOALS:"professional_goals",INDUSTRY:"industry",NEWS_LOCATION:"news_location",NY_PERSONAL_GOALS:"new_year_personal_goals",NY_HOBBIES:"new_year_hobbies",NY_PROFESSIONAL_GOALS:"new_year_professional_goals",NY_INDUSTRY:"new_year_industry",NY_NEWS_LOCATION:"new_year_news_location"},exports.IngestResponseState={SUCCESS:"100",SYSTEM_ERROR:"101",INVALID_TYPE:"102",INVALID_IDENTIFIER:"103",INVALID_DATA:"104",INVALID_ATTRIBUTE_DEFINITION:"105",INVALID_META_DEFINITION:"106",UNAUTHENTICATED:"107",MISMATCHED_IDENTIFIER:"108",DISABLED_ATTRIBUTE_DEFINITION:"109",DO_NOT_COLLECT:"110"},exports.IngestType=l,exports.getAttributes=p,exports.hasRequiredPrivacyCookies=c,exports.push=async e=>{let{submitData:o,source:n}=e;if(!c())throw new Error("does not satisfy cookie check");if("undefined"!=typeof window&&t.getCookie("wp_wv")&&!t.isLoggedIn())throw new Error("does not satisfy cookie check");const{fieldName:a}=o,i=await p({fieldName:a});if(i[0]&&i[0].name===a&&i[0].collection_behavior===r.DO_NOT_COLLECT)throw new Error("do not collect");const s=i[0]&&!0===i[0].explicit?l.EXPLICIT:l.IMPLICIT;return i[0]||"production"===process.env.NODE_ENV||console.warn(`no attribute info found for ${a}, assuming implicit`),s===l.EXPLICIT?(async e=>{let{submitData:{fieldName:o,value:n},source:a}=e;const i=E+"/ingest",s=t.getCookie("wapo_login_id"),r={jucid:localStorage.getItem("uuid"),ga:t.getCookie("_ga"),type:l.EXPLICIT,wapo_login_id:s,data:{[o]:[n]},metadata:{source:a}};try{const e=await fetch(i,{method:"POST",credentials:"include",headers:t.JSON_HEADERS,body:JSON.stringify(r)});return await e.json()}catch(e){return console.debug(e),null}})({submitData:o,source:n}):(async e=>{let{submitData:{fieldName:t,value:o},source:n}=e;return(e=>{if("undefined"==typeof window)return void("production"!==process.env.NODE_ENV&&console.warn("NO WINDOW"));window.dataLayer=window.dataLayer||[];const t={...e};window.dataLayer.push(t)})({event:"site-onpage-click",action:"site-onpage-click",category:"profile",label:t,"de-label":t,[t]:o,section:"profile",subsection:n}),!0})({submitData:o,source:n})};
|
|
2
2
|
//# sourceMappingURL=subs-de-inputs.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subs-de-inputs.cjs.production.min.js","sources":["../src/interfaces/index.ts","../src/components/DEDisclosure/utils/checkAlertBoxCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/services/getAttributes.ts","../src/services/ingest.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/index.tsx","../src/components/DEDisclosure/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/utils/push.ts","../src/utils/isAnonymousWebview.ts","../src/services/sendToGA.ts"],"sourcesContent":["export 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\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","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxCookie = () => {\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 { checkAlertBoxCookie } from '../components/DEDisclosure/utils/checkAlertBoxCookie';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (typeof gdprAllowTargarting === 'boolean' && checkAlertBoxCookie()) {\n return gdprAllowTargarting;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\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 {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n","import { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxCookie } from '../utils/checkAlertBoxCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkAlertBoxCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkAlertBoxCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkAlertBoxCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React from 'react';\n\ntype hydrateLinksType = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\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","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\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\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"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","IngestType","EXPLICIT","IMPLICIT","checkAlertBoxCookie","getCookie","length","hasRequiredPrivacyCookies","window","gdprAllowTargarting","checkConsentCookieForAllowTargeting","value","includes","wp_usp","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","async","fieldName","_ref","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","SUCCESS","attributes","e","console","debug","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","-webkit-appearance","&:disabled","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","label","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","SelectWrapper","boxSizing","marginBottom","flexDirection","& button","& *","configSrc","onFinished","allowCookieStore","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","myConfig","setMyConfig","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","warn","_window","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","useOneTrustAlertBoxClosed","config","undefined","response","remoteConfig","intl_region","Object","keys","forEach","configKey","split","toLowerCase","getConfig","error","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","isArray","reduce","prev","current","str","className","href","isFinished","isError","source","dataDictionaryConfig","submit","valuesFilter","children","setConfig","setSelected","scriptStatus","useScript","ScriptStatus","READY","__twpdeu","getFieldConfigs","fetchConfig","_window2","result","push","submitData","submitSelected","sort","a","b","order","filter","archived","name","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","Error","isLoggedIn","attributeInfo","collection_behavior","type","explicit","process","env","NODE_ENV","wapo_login_id","payload","jucid","localStorage","getItem","ga","[object Object]","metadata","method","body","JSON","stringify","ingest","props","dataLayer","eventData","sendGAEvent","event","action","category","de-label","section","subsection","sendToGA"],"mappings":"0TAQaA,EAAsB,CACjCC,QAAS,UACTC,eAAgB,kBAmBLC,EAAa,CACxBC,SAAU,WACVC,SAAU,YC3BCC,EAAsBA,KACnBC,YAHD,0BAGsB,IAGtBC,OAAS,GCJXC,EAA4BA,WACvC,GAAsB,oBAAXC,OACT,OAAO,EAGT,MAAMC,ECA2CC,MACjD,MAAMC,EAAQN,YARD,mBAQsB,GACnC,QAAOM,EAAMC,SAAS,eAElBD,EAAMC,SAAS,cAEf,MDNwBF,GAC5B,GAAmC,kBAAxBD,GAAqCL,IAC9C,OAAOK,EAGT,MAAMI,EAASR,YAAU,UAEnBS,UAAWC,EAAGC,qBAAOD,SAAPA,EAASE,aAE7B,SAAUJ,GAA0B,OAAhBC,IEXhBI,EAAUC,YAAUD,cAEpBE,EAAuC,GAChCC,EAAmCC,MAAAA,QAAOC,UACrDA,GAGDC,EACC,GAAIJ,EAAgBG,GAClB,OAAOH,EAAgBG,GAGzB,MAAME,EAAa,CAACF,GAEpB,IACE,MAAMG,EAAM,IAAIC,IAAOT,iBACvBQ,EAAIE,aAAaC,IAAI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EhB6N,SAAU,CAAEnD,OAAAA,IAGd,IACE,MAAMxB,QAAiB7H,MAAMN,EAAK,CAChC+M,OAAQ,OACRvM,YAAa,UACbC,QAASC,eACTsM,KAAMC,KAAKC,UAAUV,KAKvB,aAFmBrE,EAASxH,OAG5B,MAAOM,GAEP,OADAC,QAAQC,MAAMF,GACP,OOAAkM,CAAO,CAAEvC,WAAAA,EAAYjB,OAAAA,IExBM/J,OAAAA,QACpCgL,YAAY/K,UAAEA,EAASZ,MAAEA,GAAO0K,OAChCA,GACD7J,EAcC,MAtCmBsN,CAAAA,IAQnB,GAAsB,oBAAXtO,OAET,2BADAsN,QAAAC,IAAAC,UAAapL,QAAQqG,KAAK,cAI5BzI,OAAOuO,UAAYvO,OAAOuO,WAAa,GAEvC,MAAMC,EAAiC,IAClCF,GAELtO,OAAOuO,UAAU1C,KAAK2C,IAOtBC,CAAY,CACVC,MAAO,oBACPC,OAAQ,oBACRC,SAAU,UAEVpK,MAAOzD,EACP8N,WAAY9N,EACZgN,CAAChN,GAAYZ,EAEb2O,QAAS,UACTC,WAAYlE,KAGP,GFSEmE,CAAS,CAAElD,WAAAA,EAAYjB,OAAAA"}
|
|
1
|
+
{"version":3,"file":"subs-de-inputs.cjs.production.min.js","sources":["../src/interfaces/index.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/ingest.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/checkCookie.ts","../src/components/DEDisclosure/index.tsx","../src/components/DEDisclosure/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/constants/IngestDataTypes.ts","../src/utils/push.ts","../src/utils/isAnonymousWebview.ts","../src/services/sendToGA.ts"],"sourcesContent":["export 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\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","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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 { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkCookie = () => {\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 React, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n","import { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkCookie } from '../utils/checkCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React from 'react';\n\ntype hydrateLinksType = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\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} as const;","import {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\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","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\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\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"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","IngestType","EXPLICIT","IMPLICIT","hasRequiredPrivacyCookies","window","wp_usp","getCookie","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","async","fieldName","_ref","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","SUCCESS","attributes","e","console","debug","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","-webkit-appearance","&:disabled","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","label","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","value","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","SelectWrapper","boxSizing","marginBottom","flexDirection","& button","& *","configSrc","checkCookie","length","onFinished","allowCookieStore","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","myConfig","setMyConfig","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","warn","_window","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","useOneTrustAlertBoxClosed","config","undefined","response","remoteConfig","intl_region","Object","keys","forEach","configKey","split","includes","toLowerCase","getConfig","error","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","isArray","reduce","prev","current","str","className","href","isFinished","isError","source","dataDictionaryConfig","submit","valuesFilter","children","setConfig","setSelected","scriptStatus","useScript","ScriptStatus","READY","__twpdeu","getFieldConfigs","fetchConfig","_window2","result","push","submitData","submitSelected","sort","a","b","order","filter","archived","name","JOB_LEVEL","JOB_INDUSTRY","PERSONAL_GOALS","HOBBIES","PROFESSIONAL_GOALS","INDUSTRY","NEWS_LOCATION","NY_PERSONAL_GOALS","NY_HOBBIES","NY_PROFESSIONAL_GOALS","NY_INDUSTRY","NY_NEWS_LOCATION","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","Error","isLoggedIn","attributeInfo","collection_behavior","type","explicit","process","env","NODE_ENV","wapo_login_id","payload","jucid","localStorage","getItem","ga","[object Object]","metadata","method","body","JSON","stringify","ingest","props","dataLayer","eventData","sendGAEvent","event","action","category","de-label","section","subsection","sendToGA"],"mappings":"0TAQaA,EAAsB,CACjCC,QAAS,UACTC,eAAgB,kBAmBLC,EAAa,CACxBC,SAAU,WACVC,SAAU,YC7BCC,EAA4BA,WACvC,GAAsB,oBAAXC,OACT,OAAO,EAGT,MAAMC,EAASC,YAAU,UAEnBC,UAAWC,EAAGC,qBAAOD,SAAPA,EAASE,aAE7B,SAAUL,GAA0B,OAAhBE,ICJhBI,EAAUC,YAAUD,cAEpBE,EAAuC,GAChCC,EAAmCC,MAAAA,QAAOC,UACrDA,GAGDC,EACC,GAAIJ,EAAgBG,GAClB,OAAOH,E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oCAAoC7H,wBAG1CqN,IAASrO,EAAWC,STlCQc,OAAAA,QAChCoL,YAAYnL,UAAEA,EAASuE,MAAEA,GAAO2F,OAChCA,GACDjK,EACC,MAAME,EAASR,YAET+N,EAAgBpO,YAAU,iBAK1BqO,EAAU,CACdC,MAJYC,aAAaC,QAAQ,QAKjCC,GAJSzO,YAAU,OAKnB+N,KAAMrO,EAAWC,SACjByO,cAAAA,EACAlN,KAAM,CACJwN,CAAChO,GAAY,CAACuE,IAEhB0J,SAAU,CAAE/D,OAAAA,IAGd,IACE,MAAMzB,QAAiBhI,MAAMN,EAAK,CAChC+N,OAAQ,OACRvN,YAAa,UACbC,QAASC,eACTsN,KAAMC,KAAKC,UAAUV,KAKvB,aAFmBlF,EAAS3H,OAG5B,MAAOM,GAEP,OADAC,QAAQC,MAAMF,GACP,OSAAkN,CAAO,CAAEnD,WAAAA,EAAYjB,OAAAA,IExBMnK,OAAAA,QACpCoL,YAAYnL,UAAEA,EAASuE,MAAEA,GAAO2F,OAChCA,GACDjK,EAcC,MAtCmBsO,CAAAA,IAQnB,GAAsB,oBAAXnP,OAET,2BADAmO,QAAAC,IAAAC,UAAapM,QAAQwG,KAAK,cAI5BzI,OAAOoP,UAAYpP,OAAOoP,WAAa,GAEvC,MAAMC,EAAiC,IAClCF,GAELnP,OAAOoP,UAAUtD,KAAKuD,IAOtBC,CAAY,CACVC,MAAO,oBACPC,OAAQ,oBACRC,SAAU,UAEVpL,MAAOzD,EACP8O,WAAY9O,EACZgO,CAAChO,GAAYuE,EAEbwK,QAAS,UACTC,WAAY9E,KAGP,GFSE+E,CAAS,CAAE9D,WAAAA,EAAYjB,OAAAA"}
|
|
@@ -29,34 +29,11 @@ const IngestResponseState = {
|
|
|
29
29
|
DO_NOT_COLLECT: '110'
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
const COOKIE = 'OptanonConsent';
|
|
33
|
-
/**
|
|
34
|
-
* Checks the users OptanonConsent cookie to determine if the user has allowed targeting.
|
|
35
|
-
* Returns true or false if the flag is found in the cookie, null otherwise.
|
|
36
|
-
* @returns {boolean | null}
|
|
37
|
-
*/
|
|
38
|
-
const checkConsentCookieForAllowTargeting = () => {
|
|
39
|
-
const value = getCookie(COOKIE) || '';
|
|
40
|
-
return value.includes('C0004%3A1') ? true : value.includes('C0004%3A0') ? false : null;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const COOKIE$1 = 'OptanonAlertBoxClosed';
|
|
44
|
-
const checkAlertBoxCookie = () => {
|
|
45
|
-
const value = getCookie(COOKIE$1) || '';
|
|
46
|
-
// Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)
|
|
47
|
-
// "Invalid date" is 12 characters long
|
|
48
|
-
return value.length > 12;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
32
|
const hasRequiredPrivacyCookies = () => {
|
|
52
33
|
var _WPGeo;
|
|
53
34
|
if (typeof window === 'undefined') {
|
|
54
35
|
return false;
|
|
55
36
|
}
|
|
56
|
-
const gdprAllowTargarting = checkConsentCookieForAllowTargeting();
|
|
57
|
-
if (typeof gdprAllowTargarting === 'boolean' && checkAlertBoxCookie()) {
|
|
58
|
-
return gdprAllowTargarting;
|
|
59
|
-
}
|
|
60
37
|
const wp_usp = getCookie('wp_usp');
|
|
61
38
|
const countryCode = (_WPGeo = WPGeo()) === null || _WPGeo === void 0 ? void 0 : _WPGeo.country_code;
|
|
62
39
|
return !!(wp_usp && countryCode === 'US');
|
|
@@ -506,7 +483,15 @@ const hydrateLinks = str => {
|
|
|
506
483
|
return toReturn;
|
|
507
484
|
};
|
|
508
485
|
|
|
509
|
-
const COOKIE
|
|
486
|
+
const COOKIE = 'OptanonAlertBoxClosed';
|
|
487
|
+
const checkCookie = () => {
|
|
488
|
+
const value = getCookie(COOKIE) || '';
|
|
489
|
+
// Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)
|
|
490
|
+
// "Invalid date" is 12 characters long
|
|
491
|
+
return value.length > 12;
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
const COOKIE$1 = 'OptanonAlertBoxClosed';
|
|
510
495
|
const useOneTrustAlertBoxClosed = _ref => {
|
|
511
496
|
let {
|
|
512
497
|
allowCookieStore
|
|
@@ -516,7 +501,7 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
516
501
|
const [listenToTcfApi, setListenToTcfApi] = useState(false);
|
|
517
502
|
useEffect(() => {
|
|
518
503
|
var _window;
|
|
519
|
-
if (
|
|
504
|
+
if (checkCookie()) {
|
|
520
505
|
setAlertBoxClosed(true);
|
|
521
506
|
return;
|
|
522
507
|
}
|
|
@@ -534,8 +519,8 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
534
519
|
useEffect(() => {
|
|
535
520
|
let cleanupFn = () => {};
|
|
536
521
|
if (listenToCookieStore$1 && window.cookieStore) {
|
|
537
|
-
cleanupFn = listenToCookieStore(COOKIE$
|
|
538
|
-
if (
|
|
522
|
+
cleanupFn = listenToCookieStore(COOKIE$1, () => {
|
|
523
|
+
if (checkCookie()) {
|
|
539
524
|
setAlertBoxClosed(true);
|
|
540
525
|
} else {
|
|
541
526
|
setAlertBoxClosed(false);
|
|
@@ -555,7 +540,7 @@ const useOneTrustAlertBoxClosed = _ref => {
|
|
|
555
540
|
// cmpuishown means the banner is shown
|
|
556
541
|
// useractioncomplete means the user has interacted with the banner
|
|
557
542
|
// but actually if the result for any of these is true, we just use the value of the cookie
|
|
558
|
-
if (
|
|
543
|
+
if (checkCookie()) {
|
|
559
544
|
setAlertBoxClosed(true);
|
|
560
545
|
}
|
|
561
546
|
}
|
|
@@ -637,5 +622,20 @@ const DEDisclosure = _ref => {
|
|
|
637
622
|
}, disclosureRendering);
|
|
638
623
|
};
|
|
639
624
|
|
|
640
|
-
|
|
625
|
+
const FirstPartyIngestDataTypes = {
|
|
626
|
+
JOB_LEVEL: 'profile_job_level',
|
|
627
|
+
JOB_INDUSTRY: 'profile_job_industry',
|
|
628
|
+
PERSONAL_GOALS: 'personal_goals',
|
|
629
|
+
HOBBIES: 'hobbies',
|
|
630
|
+
PROFESSIONAL_GOALS: 'professional_goals',
|
|
631
|
+
INDUSTRY: 'industry',
|
|
632
|
+
NEWS_LOCATION: 'news_location',
|
|
633
|
+
NY_PERSONAL_GOALS: 'new_year_personal_goals',
|
|
634
|
+
NY_HOBBIES: 'new_year_hobbies',
|
|
635
|
+
NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',
|
|
636
|
+
NY_INDUSTRY: 'new_year_industry',
|
|
637
|
+
NY_NEWS_LOCATION: 'new_year_news_location'
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
export { AttributesState, CollectionBehaviors, DEDisclosure, DESelect, FirstPartyIngestDataTypes, IngestResponseState, IngestType, getAttributes, hasRequiredPrivacyCookies, push };
|
|
641
641
|
//# sourceMappingURL=subs-de-inputs.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subs-de-inputs.esm.js","sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxCookie.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/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/index.tsx"],"sourcesContent":["export 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\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","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 checkAlertBoxCookie = () => {\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 { checkAlertBoxCookie } from '../components/DEDisclosure/utils/checkAlertBoxCookie';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (typeof gdprAllowTargarting === 'boolean' && checkAlertBoxCookie()) {\n return gdprAllowTargarting;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\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\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\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","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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 = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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 { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxCookie } from '../utils/checkAlertBoxCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkAlertBoxCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkAlertBoxCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkAlertBoxCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","AttributesState","SUCCESS","IngestType","EXPLICIT","IMPLICIT","IngestResponseState","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","COOKIE","checkConsentCookieForAllowTargeting","value","getCookie","includes","checkAlertBoxCookie","length","hasRequiredPrivacyCookies","window","gdprAllowTargarting","wp_usp","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","_ref","fieldName","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","attributes","e","console","debug","sendGAEvent","props","process","env","NODE_ENV","warn","dataLayer","eventData","push","sendToGA","submitData","source","event","action","category","label","section","subsection","ingest","wapo_login_id","jucid","localStorage","getItem","ga","payload","type","metadata","response","method","body","JSON","stringify","isAnonymousWebview","wp_wv","isLoggedIn","Error","attributeInfo","name","collection_behavior","explicit","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","ScriptStatus","READY","submitSelected","_window2","result","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection","configSrc","getConfig","myConfig","undefined","remoteConfig","intl_region","Object","keys","forEach","configKey","split","toLowerCase","hydrateLinks","str","array","chunks","className","href","toReturn","reduce","prev","current","useOneTrustAlertBoxClosed","allowCookieStore","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","DEDisclosure","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","setMyConfig","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","isArray"],"mappings":";;;;;;MAQaA,mBAAmB,GAAG;EACjCC,OAAO,EAAE,SAAS;EAClBC,cAAc,EAAE;;MAeLC,eAAe,GAAG;EAC7BC,OAAO,EAAE;;MAGEC,UAAU,GAAG;EACxBC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE;;MAGCC,mBAAmB,GAAG;EACjCJ,OAAO,EAAE,KAAK;EACdK,YAAY,EAAE,KAAK;EACnBC,YAAY,EAAE,KAAK;EACnBC,kBAAkB,EAAE,KAAK;EACzBC,YAAY,EAAE,KAAK;EACnBC,4BAA4B,EAAE,KAAK;EACnCC,uBAAuB,EAAE,KAAK;EAC9BC,eAAe,EAAE,KAAK;EACtBC,qBAAqB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version":3,"file":"subs-de-inputs.esm.js","sources":["../src/interfaces/index.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/checkCookie.ts","../src/components/DEDisclosure/hooks/useOnetrustAlertBoxClosedPromise.ts","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["export 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\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","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\n\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_usp = getCookie('wp_usp');\n\n const countryCode = WPGeo()?.country_code;\n\n return !!(wp_usp && countryCode === 'US');\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\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: JSON_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 } else {\n return [];\n }\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\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\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\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","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport { 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: JSON_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: ResponseStatus;\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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\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 } else {\n return sendToGA({ submitData, source });\n }\n};\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: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\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 defaultValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\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 defaultValue,\n onChange = () => {},\n disabled = false,\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 // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : defaultValue\n ? { defaultValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === defaultValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n placeholder={label}\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 { Attribute, AttributeValue } from '../../interfaces';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n defaultValue?: 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}\n\nconst scriptSrc = `${\n ENDPOINTS.staticAssets === 'https://subscribe.washingtonpost.com/static'\n ? 'https://www.washingtonpost.com/subscribe/static/'\n : ENDPOINTS.staticAssets\n}/de-utils/twpdeu.min.js`;\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n defaultValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState('');\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n const config = await window?.__twpdeu?.getFieldConfigs({ fieldName });\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 } 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 = defaultValue && config ? { defaultValue } : {};\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 defaultValue={defaultValue}\n disabled={disabled}\n />\n )}\n </SelectWrapper>\n );\n};\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","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport {\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 = 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 = (str: string) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str: string) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((str) => {\n if (str === '{{PRIVACY_POLICY}}') {\n return (\n <a\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n >\n Privacy Policy\n </a>\n );\n }\n return str;\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 = 'OptanonAlertBoxClosed';\n\nexport const checkCookie = () => {\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 { useState, useEffect } from 'react';\nimport {\n listenToCookieStore as listenToCookieStoreUtil,\n ICookieStore,\n} from '@washingtonpost/subs-sdk';\nimport { checkCookie } from '../utils/checkCookie';\n\nconst 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 useOneTrustAlertBoxClosed = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\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 (checkCookie()) {\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 let cleanupFn: (() => void) | null = () => {};\n if (listenToCookieStore && window.cookieStore) {\n cleanupFn = listenToCookieStoreUtil(COOKIE, () => {\n if (checkCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n }\n return cleanupFn || (() => {});\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 // 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 (checkCookie()) {\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 { alertBoxClosed, listenToCookieStore, listenToTcfApi };\n};\n","import React, { useState, useEffect } from 'react';\nimport { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOneTrustAlertBoxClosed } from './hooks/useOnetrustAlertBoxClosedPromise';\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 /** 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}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\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 if (alertBoxClosed) {\n setDisclosure(myConfig.disclosure_afterbanner);\n } else {\n setDisclosure(myConfig.disclosure_beforebanner);\n }\n } else if ('disclosure' in myConfig) {\n setDisclosure(myConfig.disclosure);\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig, alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce((prev, current) => {\n return (\n <>\n {prev}\n <p>{hydrateLinks(current)}</p>\n </>\n );\n }, <></>)\n );\n\n // Is it ok to fire `onFinished` if still waiting for onetrust to load on the page?\n onFinished({\n isFinished: true,\n isError: false,\n });\n }\n }, [disclosure]);\n\n return disclosure === null ? (\n <div data-test-id=\"de-disclosure-loading\"></div>\n ) : (\n <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>\n );\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\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} as const;"],"names":["CollectionBehaviors","COLLECT","DO_NOT_COLLECT","AttributesState","SUCCESS","IngestType","EXPLICIT","IMPLICIT","IngestResponseState","SYSTEM_ERROR","INVALID_TYPE","INVALID_IDENTIFIER","INVALID_DATA","INVALID_ATTRIBUTE_DEFINITION","INVALID_META_DEFINITION","UNAUTHENTICATED","MISMATCHED_IDENTIFIER","DISABLED_ATTRIBUTE_DEFINITION","hasRequiredPrivacyCookies","window","wp_usp","getCookie","countryCode","_WPGeo","WPGeo","country_code","base","ENDPOINTS","attributesCache","getAttributes","_ref","fieldName","fieldNames","url","URL","searchParams","set","join","data","fetch","toString","credentials","headers","JSON_HEADERS","json","ok","status","ResponseStatus","attributes","e","console","debug","sendGAEvent","props","process","env","NODE_ENV","warn","dataLayer","eventData","push","sendToGA","submitData","value","source","event","action","category","label","section","subsection","ingest","wapo_login_id","jucid","localStorage","getItem","ga","payload","type","metadata","response","method","body","JSON","stringify","isAnonymousWebview","wp_wv","isLoggedIn","Error","attributeInfo","name","collection_behavior","explicit","StyledMobileSelect","styled","padding","display","justifyContent","width","backgroundColor","color","fontFamily","fontSize","fontWeight","lineHeight","paddingBlockRight","textOverflow","position","borderColor","borderRightWidth","borderRightColor","appearance","theme","colors","disabled","onDisabled","cursor","StyledSelectWrapper","maxWidth","borderRadius","borderStyle","borderWidth","StyledMobileOption","Dropdown","id","values","required","defaultValue","onChange","answer","setAnswer","useState","isMobileSize","useWindowSize","useEffect","disabledProp","defaultValueProp","defaultValuePropMobile","selected","React","target","placeholder","style","map","key","Icon","size","fill","pointerEvents","right","top","transform","ChevronDown","Select","Root","onValueChange","Trigger","Label","Value","Content","css","zIndex","zIndices","page","Item","scriptSrc","staticAssets","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","ScriptStatus","READY","submitSelected","_window2","result","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection","configSrc","getConfig","myConfig","undefined","remoteConfig","intl_region","Object","keys","forEach","configKey","split","includes","toLowerCase","hydrateLinks","str","array","chunks","className","href","toReturn","reduce","prev","current","COOKIE","checkCookie","length","useOneTrustAlertBoxClosed","allowCookieStore","alertBoxClosed","setAlertBoxClosed","listenToCookieStore","setListenToCookieStore","listenToTcfApi","setListenToTcfApi","__tcfapi","cookieStore","cleanupFn","listenToCookieStoreUtil","listenerId","callback","_tcData","success","DEDisclosure","disclosure","setDisclosure","disclosureRendering","setDisclosureRendering","setMyConfig","checkBannerStatus","disclosure_afterbanner","disclosure_beforebanner","Array","is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;QAChBD,OAAO,EAAE;OACV,CAAC;;GAEL,EAAE,CAACwD,UAAU,CAAC,CAAC;EAEhB,OAAOA,UAAU,KAAK,IAAI,GACxBzG;oBAAkB;IAA8B,GAEhDA;oBAAkB;KAAiB2G,mBAAmB,CACvD;AACH,CAAC;;MCzFYQ,yBAAyB,GAAG;EACvCC,SAAS,EAAE,mBAAmB;EAC9BC,YAAY,EAAE,sBAAsB;EACpCC,cAAc,EAAE,gBAAgB;EAChCC,OAAO,EAAE,SAAS;EAClBC,kBAAkB,EAAE,oBAAoB;EACxCC,QAAQ,EAAE,UAAU;EACpBC,aAAa,EAAE,eAAe;EAC9BC,iBAAiB,EAAE,yBAAyB;EAC5CC,UAAU,EAAE,kBAAkB;EAC9BC,qBAAqB,EAAE,6BAA6B;EACpDC,WAAW,EAAE,mBAAmB;EAChCC,gBAAgB,EAAE;CACV;;;;"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const checkAlertBoxCookie: () => boolean;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks the users OptanonConsent cookie to determine if the user has allowed targeting.
|
|
3
|
-
* Returns true or false if the flag is found in the cookie, null otherwise.
|
|
4
|
-
* @returns {boolean | null}
|
|
5
|
-
*/
|
|
6
|
-
export declare const checkConsentCookieForAllowTargeting: () => boolean | null;
|