@washingtonpost/subs-de-inputs 1.10.2 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/DEDisclosure/DisclosureWithBannerStatus.d.ts +2 -3
- package/dist/components/DEDisclosure/DisclosureWithoutBannerStatus.d.ts +2 -3
- package/dist/components/DEDisclosure/hooks/useOnetrust.d.ts +1 -1
- package/dist/components/DEDisclosure/index.d.ts +1 -2
- package/dist/components/DEDisclosure/utils/getConfig.d.ts +1 -1
- package/dist/components/DEDisclosure/utils/hydrateLinks.d.ts +1 -1
- package/dist/components/DESelect/Dropdown.d.ts +1 -1
- package/dist/components/DESelect/index.d.ts +2 -2
- package/dist/index.cjs +699 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +664 -7
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +1 -1
- package/dist/interfaces/twpdeu.d.ts +2 -2
- package/dist/services/getAttributes.d.ts +1 -1
- package/dist/services/ingest.d.ts +2 -2
- package/dist/utils/push.d.ts +2 -2
- package/package.json +20 -17
- package/dist/subs-de-inputs.cjs.development.js +0 -783
- package/dist/subs-de-inputs.cjs.development.js.map +0 -1
- package/dist/subs-de-inputs.cjs.production.min.js +0 -2
- package/dist/subs-de-inputs.cjs.production.min.js.map +0 -1
- package/dist/subs-de-inputs.esm.js +0 -769
- package/dist/subs-de-inputs.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/interfaces/index.ts","../src/utils/checkConsentCookieForAllowTargeting.ts","../src/components/DEDisclosure/utils/checkAlertBoxClosedCookie.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/getAttributes.ts","../src/services/sendToGA.ts","../src/services/ingest.ts","../src/utils/isAnonymousWebview.ts","../src/utils/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/index.tsx","../src/components/DEDisclosure/utils/getConfig.ts","../src/components/DEDisclosure/utils/hydrateLinks.tsx","../src/components/DEDisclosure/utils/checkOptAnonConsentCookie.ts","../src/components/DEDisclosure/hooks/useOnetrust.ts","../src/components/DEDisclosure/DisclosureWithBannerStatus.tsx","../src/components/DEDisclosure/DisclosureWithoutBannerStatus.tsx","../src/components/DEDisclosure/index.tsx","../src/constants/IngestDataTypes.ts"],"sourcesContent":["import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\n\nexport type AttributeValue = {\n name: string;\n date_created: number;\n last_modified_date: number;\n archived: boolean;\n order: number;\n};\n\nexport const CollectionBehaviors = {\n COLLECT: 'COLLECT',\n DO_NOT_COLLECT: 'DO_NOT_COLLECT',\n} as const;\n\nexport type Attribute = {\n name: string;\n approved_for_use?: boolean;\n collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];\n datatype: string;\n explicit: boolean;\n multiple_value: boolean;\n last_modified_date: number;\n date_created: number;\n values: AttributeValue[] | Readonly<AttributeValue[]>;\n};\n\nexport const AttributesState = {\n SUCCESS: '100',\n} as const;\n\n// https://github.com/WashPost/subs-be-user-data-enrichment/blob/8e8f8460c59adbe9c83b50f368bff1d3300bfd6b/src/main/java/washpost/paywall/userdataenrichment/model/ResponseState.java#L19\nexport const DeleteAttributeState = {\n SUCCESS: '150',\n SYSTEM_ERROR: '151',\n INVALID_ATTRIBUTE_NAME: '152',\n INVALID_ATTRIBUTE_NOT_EXISTS: '153',\n} as const;\n\nexport const IngestType = {\n EXPLICIT: 'explicit',\n IMPLICIT: 'implicit',\n} as const;\n\nexport const IngestResponseState = {\n SUCCESS: '100',\n SYSTEM_ERROR: '101',\n INVALID_TYPE: '102',\n INVALID_IDENTIFIER: '103',\n INVALID_DATA: '104',\n INVALID_ATTRIBUTE_DEFINITION: '105',\n INVALID_META_DEFINITION: '106',\n UNAUTHENTICATED: '107',\n MISMATCHED_IDENTIFIER: '108',\n DISABLED_ATTRIBUTE_DEFINITION: '109',\n DO_NOT_COLLECT: '110',\n} as const;\n\nexport interface IProfileResponse {\n status: ResponseStatusType;\n state: (typeof AttributesState)[keyof typeof AttributesState];\n attributes: {\n [key: string]: {\n attribute_name: string;\n value: string | null;\n date_created: number;\n last_modified_date: number;\n };\n };\n}\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\n/**\n * Checks the users OptanonConsent cookie to determine if the user has allowed targeting.\n * Returns true or false if the flag is found in the cookie, null otherwise.\n * @returns {boolean | null}\n */\nexport const checkConsentCookieForAllowTargeting = () => {\n const value = getCookie(COOKIE) || '';\n return value.includes('C0004%3A1')\n ? true\n : value.includes('C0004%3A0')\n ? false\n : null;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonAlertBoxClosed';\n\nexport const checkAlertBoxClosedCookie = () => {\n const value = getCookie(COOKIE) || '';\n // Wed May 15 2024 06:29:23 GMT-0500 (Central Daylight Time)\n // \"Invalid date\" is 12 characters long\n return value.length > 12;\n};\n","import { WPGeo, getCookie } from '@washingtonpost/subs-sdk';\nimport { checkConsentCookieForAllowTargeting } from './checkConsentCookieForAllowTargeting';\nimport { checkAlertBoxClosedCookie } from '../components/DEDisclosure/utils/checkAlertBoxClosedCookie';\n\n/**\n * Checks privacy cookies to decide if we can send up 1pd\n * If US, checks that wp_usp exists\n * Else If OptAnonConsent cookie exists, checks the value of targeting cookies consent\n * Else If EEA, always returns true\n * Else, returns false\n * @returns {boolean}\n */\nexport const hasRequiredPrivacyCookies = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const { intl_region, country_code: countryCode } = WPGeo();\n\n if (countryCode === 'US') {\n return !!getCookie('wp_usp');\n }\n\n if (window.pageType === 'onboarding') {\n const gdprAllowTargarting = checkConsentCookieForAllowTargeting();\n if (\n typeof gdprAllowTargarting === 'boolean' &&\n checkAlertBoxClosedCookie()\n ) {\n return gdprAllowTargarting;\n }\n\n // Downstream systems\n // Checking for window.pageType === 'onboarding' to avoid being true on graphics articles etc for now -- MNI-710\n if (intl_region === 'EEA' && window.pageType === 'onboarding') {\n return true;\n }\n }\n\n return false;\n};\n","import {\n ENDPOINTS,\n ResponseStatus,\n DEFAULT_HEADERS,\n} from '@washingtonpost/subs-sdk';\nimport type { Attribute } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\ntype GetAttributesType = ({\n fieldName,\n}: {\n fieldName: string;\n}) => Promise<Attribute[]>;\n\nconst attributesCache: Record<string, any> = {};\nexport const getAttributes: GetAttributesType = async ({\n fieldName,\n}: {\n fieldName: string;\n}) => {\n if (attributesCache[fieldName]) {\n return attributesCache[fieldName];\n }\n\n const fieldNames = [fieldName];\n\n try {\n const url = new URL(`${base}/attributes`);\n url.searchParams.set('attributes', fieldNames.join(','));\n\n const data = await fetch(url.toString(), {\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n });\n const json = await data.json();\n\n if (data.ok && json.status === ResponseStatus.SUCCESS) {\n const attributes = json.attributes || [];\n attributesCache[fieldName] = attributes;\n return attributes;\n }\n return [];\n } catch (e) {\n console.debug(e);\n return [];\n }\n};\n","const sendGAEvent = (props: {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}): void => {\n if (typeof window === 'undefined') {\n if (__DEV__) console.warn('NO WINDOW');\n return;\n }\n // Initialize dataLayer if needed\n window.dataLayer = window.dataLayer || [];\n\n const eventData: Record<string, any> = {\n ...props,\n };\n window.dataLayer.push(eventData);\n};\n\ntype SendToGaType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<true>;\n\nexport const sendToGA: SendToGaType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n sendGAEvent({\n event: 'site-onpage-click',\n action: 'site-onpage-click',\n category: 'profile',\n\n label: fieldName,\n 'de-label': fieldName,\n [fieldName]: value,\n\n section: 'profile',\n subsection: source,\n });\n\n return true;\n};\n","import {\n ENDPOINTS,\n DEFAULT_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { type IngestResponseState, IngestType } from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n const jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type: IngestType.EXPLICIT,\n wapo_login_id, // TODO: move this to BE to read from cookie headers\n data: {\n [fieldName]: [value],\n },\n metadata: { source },\n };\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n credentials: 'include',\n headers: DEFAULT_HEADERS,\n body: JSON.stringify(payload),\n });\n\n const json = await response.json();\n\n return json;\n } catch (e) {\n console.debug(e);\n return null;\n }\n};\n\ntype IngestType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<{\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import { getCookie, isLoggedIn } from '@washingtonpost/subs-sdk';\n\nexport const isAnonymousWebview = () => {\n if (typeof window === 'undefined') {\n return false;\n }\n\n const wp_wv = getCookie('wp_wv');\n\n return !!(wp_wv && !isLoggedIn());\n};\n","import type { ResponseStatusType } from '@washingtonpost/subs-sdk';\nimport { CollectionBehaviors, IngestType } from '../interfaces';\nimport type { IngestResponseState } from '../interfaces';\nimport { getAttributes } from '../services/getAttributes';\nimport { sendToGA } from '../services/sendToGA';\nimport { hasRequiredPrivacyCookies } from './hasRequiredPrivacyCookies';\nimport { ingest } from '../services/ingest';\nimport { isAnonymousWebview } from './isAnonymousWebview';\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n source: string;\n}) => Promise<\n | {\n status: ResponseStatusType;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n\nexport const push: PushType = async ({ submitData, source }) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n if (isAnonymousWebview()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const { fieldName } = submitData;\n\n const attributeInfo = await getAttributes({\n fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n const type =\n attributeInfo[0] && attributeInfo[0].explicit === true\n ? IngestType.EXPLICIT\n : IngestType.IMPLICIT;\n\n if (!attributeInfo[0] && __DEV__) {\n console.warn(`no attribute info found for ${fieldName}, assuming implicit`);\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, source });\n }\n return sendToGA({ submitData, source });\n};\n","import React, { useEffect, useState } from 'react';\nimport { Icon, Select, styled, theme } from '@washingtonpost/wpds-ui-kit';\nimport { useWindowSize } from '@washingtonpost/subs-hooks';\nimport { ChevronDown } from '@washingtonpost/wpds-assets';\n\ninterface IDropdownProps {\n id: string;\n label: string;\n values: Array<string>;\n required?: boolean;\n existingValue?: string;\n onChange?: (value: string) => void;\n disabled?: boolean;\n valueSelectedByDefault?: string;\n}\n\nconst StyledMobileSelect = styled('select', {\n padding: '12px 16px 12px 6px',\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n backgroundColor: '$secondary',\n color: '$primary',\n fontFamily: '$meta',\n fontSize: '$100',\n fontWeight: '$light',\n lineHeight: '$125',\n paddingBlockRight: '$125',\n textOverflow: 'ellipsis',\n position: 'relative',\n borderColor: 'transparent',\n borderRightWidth: '10px',\n borderRightColor: 'transparent',\n appearance: 'none',\n '-webkit-appearance': 'none',\n '&:disabled': {\n backgroundColor: theme.colors.disabled,\n borderColor: theme.colors.disabled,\n color: theme.colors.onDisabled,\n cursor: 'not-allowed',\n },\n});\n\nconst StyledSelectWrapper = styled('div', {\n width: '100%',\n maxWidth: '380px',\n borderRadius: '$012',\n borderColor: '$subtle',\n borderStyle: 'solid',\n borderWidth: '1px',\n backgroundColor: '$secondary',\n position: 'relative',\n});\n\nconst StyledMobileOption = styled('option', {\n fontFamily: 'inherit',\n fontSize: 'inherit',\n color: 'inherit',\n});\n\n/**\n * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.\n * @param {IDropdownProps} props The props.\n * @returns {React.ReactElement} The dropdown.\n */\nexport const Dropdown = ({\n id,\n label,\n values,\n required = false,\n existingValue,\n onChange = () => {},\n disabled = false,\n valueSelectedByDefault,\n}: IDropdownProps) => {\n const [answer, setAnswer] = useState<string>();\n const { isMobileSize } = useWindowSize();\n\n useEffect(() => {\n if (answer) onChange(answer);\n }, [answer]);\n\n const disabledProp = disabled ? { disabled: true } : {};\n\n const presetDropdownValue = existingValue || valueSelectedByDefault;\n\n // helps maintain state between WPDS and native dropdowns\n const defaultValueProp = answer\n ? { defaultValue: answer }\n : presetDropdownValue\n ? { defaultValue: presetDropdownValue }\n : {};\n\n const defaultValuePropMobile = (value: string) => {\n if (answer) {\n return value === answer ? { selected: true } : {};\n }\n return value === presetDropdownValue ? { selected: true } : {};\n };\n\n return isMobileSize ? (\n <StyledSelectWrapper>\n <StyledMobileSelect\n id=\"\"\n required={required}\n onChange={(e) => setAnswer(e.target.value)}\n {...disabledProp}\n >\n <label>{label}</label>\n <StyledMobileOption\n value=\"\"\n disabled\n selected\n style={{ color: '#666666' }}\n >\n {label}\n </StyledMobileOption>\n {values.map((value) => (\n <StyledMobileOption\n value={value}\n key={value}\n {...defaultValuePropMobile(value)}\n >\n {value}\n </StyledMobileOption>\n ))}\n </StyledMobileSelect>\n <Icon\n label=\"\"\n size=\"100\"\n fill={theme.colors.gray80}\n style={{\n pointerEvents: 'none',\n position: 'absolute',\n right: '10px',\n top: '50%',\n transform: 'translateY(-50%)',\n }}\n >\n <ChevronDown style={{ position: 'absolute', right: '10px' }} />\n </Icon>\n </StyledSelectWrapper>\n ) : (\n <Select.Root\n onValueChange={(e) => setAnswer(e)}\n required={required}\n {...defaultValueProp}\n {...disabledProp}\n >\n <Select.Trigger data-test-id={`${id}-select-trigger`}>\n <Select.Label>{label}</Select.Label>\n <Select.Value />\n </Select.Trigger>\n <Select.Content\n css={{ zIndex: theme.zIndices.page }}\n data-test-id={`${id}-select-content`}\n >\n {values.map((value) => (\n <Select.Item value={value} key={value}>\n {value}\n </Select.Item>\n ))}\n </Select.Content>\n </Select.Root>\n );\n};\n","import React, { useState, useEffect } from 'react';\nimport { Select, styled } from '@washingtonpost/wpds-ui-kit';\nimport { ENDPOINTS, ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { useScript, ScriptStatus } from '@washingtonpost/subs-hooks';\nimport type { Attribute, AttributeValue } from '../../interfaces';\nimport { Dropdown } from './Dropdown';\n\ninterface DESelectProps {\n source: string;\n fieldName: string;\n label?: string;\n dataDictionaryConfig?: Attribute | Readonly<Attribute>;\n existingValue?: string;\n disabled?: boolean;\n submit: boolean;\n onChange?: ({ value }: { value: string }) => void;\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n valuesFilter?: (value: AttributeValue) => boolean;\n selectProps?: {\n root?: any;\n trigger?: any;\n label?: any;\n value?: any;\n content?: any;\n item?: any;\n };\n children?: React.ReactNode;\n valueSelectedByDefault?: string;\n defaultValue?: never;\n}\n\nconst scriptSrc = `${ENDPOINTS.base}/de-utils/twpdeu.min.js`;\n\nconst SelectWrapper = styled('div', {\n boxSizing: 'border-box',\n display: 'flex',\n marginBottom: '$100',\n flexDirection: 'column',\n '& button': {\n padding: '1px 6px',\n },\n '& *': { boxSizing: 'border-box' },\n});\n\nexport const DESelect: React.FC<DESelectProps> = ({\n source,\n fieldName,\n label,\n dataDictionaryConfig,\n existingValue,\n disabled,\n submit,\n onChange = () => {},\n onFinished = () => {},\n valuesFilter = () => true,\n children,\n valueSelectedByDefault,\n}) => {\n const [config, setConfig] = useState(dataDictionaryConfig);\n\n const [selected, setSelected] = useState(\n !existingValue && valueSelectedByDefault ? valueSelectedByDefault : ''\n );\n\n const scriptStatus = useScript(scriptSrc);\n\n useEffect(() => {\n const fetchConfig = async () => {\n try {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const config = await window?.__twpdeu?.getFieldConfigs({\n fieldName,\n });\n if (config) {\n setConfig(config[0]);\n } else {\n console.error('unable to get config', fieldName);\n }\n } catch (e) {\n console.warn('unable to get config', fieldName, e);\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && !(children || config)) {\n fetchConfig();\n }\n }, [scriptStatus]);\n\n useEffect(() => {\n const submitSelected = async () => {\n try {\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n source,\n });\n\n const isError =\n result === true\n ? false\n : result\n ? result.status !== ResponseStatus.SUCCESS\n : true;\n\n onFinished({\n isFinished: true,\n isError,\n });\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n onFinished({\n isFinished: false,\n isError: true,\n });\n }\n };\n\n if (scriptStatus === ScriptStatus.READY && submit && selected) {\n submitSelected();\n }\n }, [scriptStatus, submit]);\n\n const defaultValueProp =\n existingValue && config ? { defaultValue: existingValue } : {};\n\n const isLoading = !(children || config);\n\n const disabledProp = disabled || isLoading ? { disabled: true } : {};\n\n // sort and filter out archived values\n // Note: config.values may be readonly\n const values = config\n ? [...config.values]\n .sort((a, b) => a.order - b.order)\n .filter((value) => value.archived !== true)\n .filter(valuesFilter)\n : [];\n\n return (\n <SelectWrapper>\n {children && (\n <Select.Root\n onValueChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n {...defaultValueProp}\n {...disabledProp}\n >\n {children}\n </Select.Root>\n )}\n {!children && !config && (\n <Dropdown\n id={'loading'}\n label={'Loading...'}\n values={[]}\n disabled={true}\n />\n )}\n {!children && config && (\n <Dropdown\n id={config.name}\n label={label || config.name}\n onChange={(e) => {\n setSelected(e);\n onChange({ value: e });\n }}\n values={values.map((value) => value.name)}\n existingValue={existingValue}\n disabled={disabled}\n valueSelectedByDefault={valueSelectedByDefault}\n />\n )}\n </SelectWrapper>\n );\n};\n","import { ENDPOINTS, WPGeo } from '@washingtonpost/subs-sdk';\nimport type {\n DisclosureConfig,\n DisclosureConfigValue,\n} from '../../../interfaces/disclosure';\n\nconst configSrc = `${\n ENDPOINTS.base === 'https://subscribe.washingtonpost.com'\n ? 'https://www.washingtonpost.com/subscribe'\n : ENDPOINTS.base\n}/config/de/disclosure.json`;\n\nexport const getConfig = async () => {\n let myConfig: DisclosureConfigValue | undefined;\n\n // step 1: fetch config\n const response = await fetch(configSrc);\n const remoteConfig: DisclosureConfig = await response.json();\n\n // step 2: figure out which part of the config to use\n\n // if country- or region-specific config found, use that\n const { country_code, intl_region } = WPGeo();\n Object.keys(remoteConfig).forEach((configKey) => {\n if (\n country_code &&\n configKey.split('|').includes(country_code.toLowerCase())\n ) {\n myConfig = remoteConfig[configKey];\n } else if (intl_region === 'EEA' && configKey === 'eea') {\n myConfig = remoteConfig[configKey];\n }\n });\n\n // TODO: Check for billing country also\n\n // else if no country-specific config, use the default config\n if (typeof myConfig === 'undefined' && remoteConfig._) {\n myConfig = remoteConfig._;\n }\n\n return myConfig;\n};\n","import React from 'react';\n\ntype hydrateLinksType = (\n str: string,\n onLinkClick: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void\n) => string | JSX.Element;\n\nexport const hydrateLinks: hydrateLinksType = (str, onLinkClick = () => {}) => {\n const array = str.split(/({{PRIVACY_POLICY}})/g);\n const chunks = array.map((chunk, i) => {\n if (chunk === '{{PRIVACY_POLICY}}') {\n return (\n <a\n key={`privacy-link-${i}`}\n rel=\"noopener noreferrer\"\n target=\"_blank\"\n style={{ color: 'inherit' }}\n className=\"underline\"\n href=\"https://www.washingtonpost.com/privacy-policy/\"\n onClick={(e) => onLinkClick(e)}\n >\n Privacy Policy\n </a>\n );\n }\n return chunk;\n });\n\n const toReturn = chunks.reduce(\n (prev, current) => (\n <>\n {prev}\n {current}\n </>\n ),\n <></>\n );\n\n return toReturn;\n};\n","import { getCookie } from '@washingtonpost/subs-sdk';\n\nconst COOKIE = 'OptanonConsent';\n\nexport const checkOptanonConsentCookie = () => {\n const value = getCookie(COOKIE) || '';\n return value.length > 12;\n};\n","import { useState, useEffect } from 'react';\nimport type { ICookieStore } from '@washingtonpost/subs-sdk';\nimport { listenToCookieStore as listenToCookieStoreUtil } from '@washingtonpost/subs-sdk';\nimport { checkAlertBoxClosedCookie } from '../utils/checkAlertBoxClosedCookie';\nimport { checkOptanonConsentCookie } from '../utils/checkOptAnonConsentCookie';\n\nconst CONSENT_COOKIE = 'OptanonConsent';\n\nconst ALERT_BOX_COOKIE = 'OptanonAlertBoxClosed';\n\ninterface TCData {\n eventStatus: 'tcloaded' | 'cmpuishown' | 'useractioncomplete';\n listenerId: number;\n [key: string]: any;\n}\n\ntype TCFAPIAddListener = (\n command: 'addEventListener',\n version: number,\n callback: (tcData: TCData, success: boolean) => void\n) => void;\n\ntype TCFAPIRmListener = (\n command: 'removeEventListener',\n version: number,\n callback: (success: boolean) => void,\n listenerId: number\n) => void;\n\ntype TCFAPIPing = (\n command: 'ping',\n version: number,\n callback: (pingReturn: any, success: boolean) => void\n) => void;\n\ndeclare global {\n interface Window {\n cookieStore?: ICookieStore;\n __tcfapi?: TCFAPIAddListener & TCFAPIRmListener & TCFAPIPing;\n }\n}\n\nexport const useOnetrust = ({\n allowCookieStore,\n}: {\n allowCookieStore: boolean;\n}) => {\n const [consentCookieExists, setConsentCookieExists] = useState<\n boolean | undefined\n >();\n const [alertBoxClosed, setAlertBoxClosed] = useState<boolean | undefined>();\n\n const [listenToCookieStore, setListenToCookieStore] = useState(false);\n const [listenToTcfApi, setListenToTcfApi] = useState(false);\n\n useEffect(() => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n return;\n }\n\n if (!window.__tcfapi) {\n console.warn('warning: __tcfapi not found');\n }\n\n if (window?.cookieStore && allowCookieStore) {\n setListenToCookieStore(true);\n } else if (window.__tcfapi) {\n setListenToTcfApi(true);\n } else {\n console.warn('warning: neither cookieStore nor __tcfapi found');\n }\n }, []);\n\n useEffect(() => {\n const cleanupFns: ((() => void) | null)[] = [];\n if (listenToCookieStore && window.cookieStore) {\n const cleanupFn = listenToCookieStoreUtil(CONSENT_COOKIE, () => {\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n });\n cleanupFns.push(cleanupFn);\n\n const cleanupFn2 = listenToCookieStoreUtil(ALERT_BOX_COOKIE, () => {\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n } else {\n setAlertBoxClosed(false);\n }\n });\n cleanupFns.push(cleanupFn2);\n }\n return () => {\n cleanupFns.forEach((fn) => fn && fn());\n };\n }, [listenToCookieStore]);\n\n useEffect(() => {\n let listenerId: number;\n if (listenToTcfApi && window.__tcfapi) {\n const callback = (_tcData: TCData, success: boolean) => {\n if (success) {\n listenerId = _tcData.listenerId;\n\n if (checkOptanonConsentCookie()) {\n setConsentCookieExists(true);\n }\n\n // tcData.eventStatus can be:\n // tcloaded means user has made a choice and we’re ready to check it\n // cmpuishown means the banner is shown\n // useractioncomplete means the user has interacted with the banner\n\n // but actually if the result for any of these is true, we just use the value of the cookie\n if (checkAlertBoxClosedCookie()) {\n setAlertBoxClosed(true);\n }\n }\n };\n\n window.__tcfapi('addEventListener', 2, callback);\n }\n\n // cleanup fn\n return () => {\n if (window.__tcfapi && listenerId)\n window.__tcfapi(\n 'removeEventListener',\n 2,\n (success) => {\n console.debug(success);\n },\n listenerId\n );\n };\n }, [listenToTcfApi]);\n\n return {\n consentCookieExists,\n alertBoxClosed,\n listenToCookieStore,\n listenToTcfApi,\n };\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\nimport { useOnetrust } from './hooks/useOnetrust';\n\ninterface DEDisclosureWithBannerStatusProps {\n config: DisclosureConfigValue;\n allowCookieStore?: boolean;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithBannerStatus: React.FC<\n DEDisclosureWithBannerStatusProps\n> = ({\n config,\n onFinished,\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n const { alertBoxClosed, consentCookieExists } = useOnetrust({\n allowCookieStore,\n });\n\n useEffect(() => {\n if (config) {\n // step 3: set disclosure based on config\n\n if (alertBoxClosed) {\n setDisclosure(config.disclosure_afterbanner);\n } else {\n setDisclosure(config.disclosure_beforebanner);\n }\n }\n }, [alertBoxClosed]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering && consentCookieExists) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering, consentCookieExists]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { hydrateLinks } from './utils/hydrateLinks';\n\ninterface DEDisclosureWithoutBannerStatusProps {\n config: DisclosureConfigValue;\n onFinished: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n}\n\nexport const DEDisclosureWithoutBannerStatus: React.FC<\n DEDisclosureWithoutBannerStatusProps\n> = ({ config, onFinished, onPrivacyPolicyClick = () => {} }) => {\n const [disclosure, setDisclosure] = useState<string[] | null>(null);\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n\n useEffect(() => {\n if (config) {\n setDisclosure(config.disclosure);\n }\n }, [config]);\n\n useEffect(() => {\n if (disclosure && Array.isArray(disclosure)) {\n setDisclosureRendering(\n disclosure.reduce(\n (prev, current) => (\n <>\n {prev}\n <p>{hydrateLinks(current, onPrivacyPolicyClick)}</p>\n </>\n ),\n <></>\n )\n );\n }\n }, [disclosure]);\n\n useEffect(() => {\n if (disclosureRendering) {\n onFinished({ isFinished: true, isError: false });\n }\n }, [disclosureRendering]);\n\n return disclosureRendering;\n};\n","import type { ReactEventHandler } from 'react';\nimport React, { useState, useEffect } from 'react';\nimport type { DisclosureConfigValue } from '../../interfaces/disclosure';\nimport { getConfig } from './utils/getConfig';\nimport { DEDisclosureWithBannerStatus } from './DisclosureWithBannerStatus';\nimport { DEDisclosureWithoutBannerStatus } from './DisclosureWithoutBannerStatus';\n\ninterface DisclosureProps {\n /** callback function to be called when the disclosure is finished loading */\n onFinished?: ({\n isFinished,\n isError,\n }: {\n isFinished: boolean;\n isError: boolean;\n }) => void;\n\n onPrivacyPolicyClick?: ReactEventHandler<HTMLAnchorElement>;\n\n /** ability to turn off cookiestore listener, primarily for testing purposes */\n allowCookieStore?: boolean;\n}\n\nexport const DEDisclosure: React.FC<DisclosureProps> = ({\n onFinished = () => {},\n allowCookieStore = true,\n onPrivacyPolicyClick = () => {},\n}) => {\n const [disclosureRendering, setDisclosureRendering] =\n useState<JSX.Element | null>(null);\n const [myConfig, setMyConfig] = useState<DisclosureConfigValue>();\n // const { alertBoxClosed } = useOneTrustAlertBoxClosed({ allowCookieStore });\n\n useEffect(() => {\n (async () => {\n const config = await getConfig();\n setMyConfig(config);\n\n if (!config) {\n console.error('No config found');\n }\n })();\n }, []);\n\n useEffect(() => {\n if (myConfig) {\n // step 3: set disclosure based on config\n\n // if config says to check onetrust, check onetrust\n if ('checkBannerStatus' in myConfig && myConfig.checkBannerStatus) {\n // check if onetrust is closed\n // if it is, show the after banner disclosure\n // if it is not, show the before banner disclosure\n setDisclosureRendering(\n <DEDisclosureWithBannerStatus\n config={myConfig}\n allowCookieStore={allowCookieStore}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else if ('disclosure' in myConfig) {\n setDisclosureRendering(\n <DEDisclosureWithoutBannerStatus\n config={myConfig}\n onFinished={onFinished}\n onPrivacyPolicyClick={onPrivacyPolicyClick}\n />\n );\n } else {\n console.error('Invalid config');\n }\n }\n }, [myConfig]);\n\n if (disclosureRendering) {\n return <div data-test-id=\"de-disclosure\">{disclosureRendering}</div>;\n }\n\n return <div data-test-id=\"de-disclosure-loading\"></div>;\n};\n","export const FirstPartyIngestDataTypes = {\n JOB_LEVEL: 'profile_job_level',\n JOB_INDUSTRY: 'profile_job_industry',\n JOB_TITLE: 'profile_job_title',\n PERSONAL_GOALS: 'personal_goals',\n HOBBIES: 'hobbies',\n PROFESSIONAL_GOALS: 'professional_goals',\n INDUSTRY: 'industry',\n NEWS_LOCATION: 'news_location',\n NY_PERSONAL_GOALS: 'new_year_personal_goals',\n NY_HOBBIES: 'new_year_hobbies',\n NY_PROFESSIONAL_GOALS: 'new_year_professional_goals',\n NY_INDUSTRY: 'new_year_industry',\n NY_NEWS_LOCATION: 'new_year_news_location',\n EDU_ROLE: 'profile_edu_role',\n EDU_MAJOR: 'profile_edu_major',\n EDU_GRADUATION_YEAR: 'profile_edu_graduation_year',\n} as const;\n"],"mappings":";;;;;;;AAUA,IAAa,sBAAsB;CACjC,SAAS;CACT,gBAAgB;CACjB;AAcD,IAAa,kBAAkB,EAC7B,SAAS,OACV;AAGD,IAAa,uBAAuB;CAClC,SAAS;CACT,cAAc;CACd,wBAAwB;CACxB,8BAA8B;CAC/B;AAED,IAAa,aAAa;CACx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@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { getAttributes } from '../services/getAttributes';
|
|
2
|
+
import { push } from '../utils/push';
|
|
3
3
|
export type TWPDEU = {
|
|
4
4
|
getFieldConfigs: typeof getAttributes;
|
|
5
5
|
push: typeof push;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { ResponseStatusType } from '@washingtonpost/subs-sdk';
|
|
2
|
+
import { IngestResponseState, IngestType } from '../interfaces';
|
|
3
3
|
export declare const ingest: IngestType;
|
|
4
4
|
type IngestType = ({ submitData: { fieldName, value }, source, }: {
|
|
5
5
|
submitData: {
|
package/dist/utils/push.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ResponseStatusType } from '@washingtonpost/subs-sdk';
|
|
2
|
+
import { IngestResponseState } from '../interfaces';
|
|
3
3
|
type PushType = ({ submitData: { fieldName, value }, source, }: {
|
|
4
4
|
submitData: {
|
|
5
5
|
fieldName: string;
|
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.
|
|
2
|
+
"version": "1.11.0",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"main": "dist/index.
|
|
5
|
-
"
|
|
4
|
+
"main": "dist/index.cjs",
|
|
5
|
+
"module": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.cjs"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
6
14
|
"files": [
|
|
7
15
|
"dist",
|
|
8
16
|
"README.md"
|
|
9
17
|
],
|
|
10
18
|
"scripts": {
|
|
11
|
-
"start": "
|
|
12
|
-
"build": "
|
|
13
|
-
"test": "APP_ENV=test
|
|
14
|
-
"lint": "
|
|
19
|
+
"start": "vite build --watch",
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"test": "APP_ENV=test vitest run",
|
|
22
|
+
"lint": "eslint src",
|
|
15
23
|
"size": "NODE_OPTIONS=--openssl-legacy-provider size-limit",
|
|
16
24
|
"analyze": "size-limit --why",
|
|
17
25
|
"prettier-check": "prettier \"**/*.{js,jsx,tsx,ts}\" --list-different --write",
|
|
18
|
-
"prepublishOnly": "npm run build &&
|
|
26
|
+
"prepublishOnly": "npm run build && npm run size"
|
|
19
27
|
},
|
|
20
28
|
"peerDependencies": {
|
|
21
29
|
"@washingtonpost/subs-hooks": "^1.10.0",
|
|
@@ -26,26 +34,25 @@
|
|
|
26
34
|
},
|
|
27
35
|
"name": "@washingtonpost/subs-de-inputs",
|
|
28
36
|
"author": "Subs FE",
|
|
29
|
-
"module": "dist/subs-de-inputs.esm.js",
|
|
30
37
|
"sideEffects": false,
|
|
31
38
|
"size-limit": [
|
|
32
39
|
{
|
|
33
40
|
"name": "de-inputs: utils",
|
|
34
|
-
"path": "dist/
|
|
41
|
+
"path": "dist/index.js",
|
|
35
42
|
"import": "{ getAttributes, push }",
|
|
36
43
|
"limit": "1.5 KB"
|
|
37
44
|
},
|
|
38
45
|
{
|
|
39
46
|
"name": "de-inputs: DESelect",
|
|
40
|
-
"path": "dist/
|
|
47
|
+
"path": "dist/index.js",
|
|
41
48
|
"import": "{ DESelect }",
|
|
42
49
|
"limit": "2.5 KB"
|
|
43
50
|
},
|
|
44
51
|
{
|
|
45
52
|
"name": "de-inputs: DEDisclosure",
|
|
46
|
-
"path": "dist/
|
|
53
|
+
"path": "dist/index.js",
|
|
47
54
|
"import": "{ DEDisclosure }",
|
|
48
|
-
"limit": "1.
|
|
55
|
+
"limit": "1.8 KB"
|
|
49
56
|
}
|
|
50
57
|
],
|
|
51
58
|
"devDependencies": {
|
|
@@ -53,12 +60,8 @@
|
|
|
53
60
|
"@babel/plugin-transform-optional-chaining": "^7.24.1",
|
|
54
61
|
"@size-limit/preset-small-lib": "^11.0.2",
|
|
55
62
|
"@testing-library/react": "^14.1.2",
|
|
56
|
-
"@types/jest": "^29.5.11",
|
|
57
63
|
"@types/lodash": "^4.14.170",
|
|
58
64
|
"babel-loader": "^9.1.3",
|
|
59
|
-
"isomorphic-fetch": "^3.0.0",
|
|
60
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
61
|
-
"nock": "^13.0.5",
|
|
62
65
|
"tslib": "^2.6.2"
|
|
63
66
|
},
|
|
64
67
|
"browserslist": [
|