@washingtonpost/subs-de-inputs 0.3.0 → 0.3.1-canary.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/index.d.ts +2 -1
- package/dist/interfaces/twpdeu.d.ts +3 -2
- package/dist/services/getAttributes.d.ts +6 -0
- package/dist/services/{dataEnrichment.d.ts → ingest.d.ts} +1 -5
- package/dist/services/push.d.ts +15 -0
- package/dist/services/sendToGA.d.ts +19 -0
- package/dist/subs-de-inputs.cjs.development.js +72 -17
- 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 +72 -17
- package/dist/subs-de-inputs.esm.js.map +1 -1
- package/package.json +2 -2
- package/CHANGELOG.md +0 -34
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from './interfaces/index';
|
|
2
2
|
export * from './interfaces/twpdeu';
|
|
3
3
|
export * from './utils/hasRequiredPrivacyCookies';
|
|
4
|
-
export * from './services/
|
|
4
|
+
export * from './services/getAttributes';
|
|
5
|
+
export * from './services/push';
|
|
5
6
|
export * from './components/DESelect';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { getAttributes
|
|
1
|
+
import { getAttributes } from '../services/getAttributes';
|
|
2
|
+
import { push } from '../services/push';
|
|
2
3
|
export declare type TWPDEU = {
|
|
3
4
|
getFieldConfigs: typeof getAttributes;
|
|
4
|
-
push: typeof
|
|
5
|
+
push: typeof push;
|
|
5
6
|
version?: string;
|
|
6
7
|
};
|
|
7
8
|
declare global {
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { ResponseStatus } from '@washingtonpost/subs-sdk';
|
|
2
|
-
import {
|
|
3
|
-
export declare const getAttributes: GetAttributesType;
|
|
4
|
-
declare type GetAttributesType = ({ fieldName, }: {
|
|
5
|
-
fieldName: string;
|
|
6
|
-
}) => Promise<Attribute[]>;
|
|
2
|
+
import { IngestResponseState, IngestType } from '../interfaces';
|
|
7
3
|
export declare const ingest: IngestType;
|
|
8
4
|
declare type IngestType = ({ submitData: { fieldName, value }, source, }: {
|
|
9
5
|
submitData: {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IngestResponseState, IngestType } from '../interfaces';
|
|
2
|
+
import { ResponseStatus } from '@washingtonpost/subs-sdk';
|
|
3
|
+
export declare const push: PushType;
|
|
4
|
+
declare type PushType = ({ submitData: { fieldName, value }, source, }: {
|
|
5
|
+
submitData: {
|
|
6
|
+
fieldName: string;
|
|
7
|
+
value: string;
|
|
8
|
+
};
|
|
9
|
+
type?: (typeof IngestType)[keyof typeof IngestType];
|
|
10
|
+
source: string;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
status: ResponseStatus;
|
|
13
|
+
state: (typeof IngestResponseState)[keyof typeof IngestResponseState];
|
|
14
|
+
} | null | true>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IngestType } from '../interfaces';
|
|
2
|
+
export interface ISendGAEvent {
|
|
3
|
+
event: string;
|
|
4
|
+
category: string;
|
|
5
|
+
action: string;
|
|
6
|
+
label: string;
|
|
7
|
+
'de-label': string;
|
|
8
|
+
[key: string]: undefined | string | string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const sendToGA: SendToGaType;
|
|
11
|
+
declare type SendToGaType = ({ submitData: { fieldName, value }, source, }: {
|
|
12
|
+
submitData: {
|
|
13
|
+
fieldName: string;
|
|
14
|
+
value: string;
|
|
15
|
+
};
|
|
16
|
+
type?: (typeof IngestType)[keyof typeof IngestType];
|
|
17
|
+
source: string;
|
|
18
|
+
}) => Promise<true>;
|
|
19
|
+
export {};
|
|
@@ -76,7 +76,42 @@ const getAttributes = async _ref => {
|
|
|
76
76
|
return [];
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
|
|
79
|
+
|
|
80
|
+
const sendGAEvent = props => {
|
|
81
|
+
if (typeof window === 'undefined') {
|
|
82
|
+
if (process.env.NODE_ENV !== "production") console.warn('NO WINDOW');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
// Initialize dataLayer if needed
|
|
86
|
+
window.dataLayer = window.dataLayer || [];
|
|
87
|
+
const eventData = {
|
|
88
|
+
...props
|
|
89
|
+
};
|
|
90
|
+
window.dataLayer.push(eventData);
|
|
91
|
+
};
|
|
92
|
+
const sendToGA = async _ref => {
|
|
93
|
+
let {
|
|
94
|
+
submitData: {
|
|
95
|
+
fieldName,
|
|
96
|
+
value
|
|
97
|
+
},
|
|
98
|
+
source
|
|
99
|
+
} = _ref;
|
|
100
|
+
sendGAEvent({
|
|
101
|
+
event: 'site-onpage-click',
|
|
102
|
+
action: 'site-onpage-click',
|
|
103
|
+
category: 'profile',
|
|
104
|
+
label: fieldName,
|
|
105
|
+
'de-label': fieldName,
|
|
106
|
+
[fieldName]: value,
|
|
107
|
+
section: 'profile',
|
|
108
|
+
subsection: source
|
|
109
|
+
});
|
|
110
|
+
return true;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const base$1 = `${subsSdk.ENDPOINTS.base}/de/v1`;
|
|
114
|
+
const ingest = async _ref => {
|
|
80
115
|
let {
|
|
81
116
|
submitData: {
|
|
82
117
|
fieldName,
|
|
@@ -84,21 +119,9 @@ const ingest = async _ref2 => {
|
|
|
84
119
|
},
|
|
85
120
|
type = IngestType.IMPLICIT,
|
|
86
121
|
source
|
|
87
|
-
} =
|
|
88
|
-
const url = `${base}/ingest`;
|
|
122
|
+
} = _ref;
|
|
123
|
+
const url = `${base$1}/ingest`;
|
|
89
124
|
const wapo_login_id = subsSdk.getCookie('wapo_login_id');
|
|
90
|
-
if (!hasRequiredPrivacyCookies()) {
|
|
91
|
-
throw new Error('does not satisfy cookie check');
|
|
92
|
-
}
|
|
93
|
-
let attributeInfo = attributesCache[fieldName];
|
|
94
|
-
if (!attributeInfo) {
|
|
95
|
-
attributeInfo = await getAttributes({
|
|
96
|
-
fieldName
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
if (attributeInfo[0] && attributeInfo[0].name === fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT) {
|
|
100
|
-
throw new Error('do not collect');
|
|
101
|
-
}
|
|
102
125
|
const jucid = localStorage.getItem('uuid');
|
|
103
126
|
const ga = subsSdk.getCookie('_ga');
|
|
104
127
|
const payload = {
|
|
@@ -128,6 +151,38 @@ const ingest = async _ref2 => {
|
|
|
128
151
|
}
|
|
129
152
|
};
|
|
130
153
|
|
|
154
|
+
const push = async _ref => {
|
|
155
|
+
let {
|
|
156
|
+
submitData,
|
|
157
|
+
type = IngestType.IMPLICIT,
|
|
158
|
+
source
|
|
159
|
+
} = _ref;
|
|
160
|
+
if (!hasRequiredPrivacyCookies()) {
|
|
161
|
+
throw new Error('does not satisfy cookie check');
|
|
162
|
+
}
|
|
163
|
+
const attributeInfo = await getAttributes({
|
|
164
|
+
fieldName: submitData.fieldName
|
|
165
|
+
});
|
|
166
|
+
if (attributeInfo[0] && attributeInfo[0].name === submitData.fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT) {
|
|
167
|
+
throw new Error('do not collect');
|
|
168
|
+
}
|
|
169
|
+
if (type === IngestType.EXPLICIT) {
|
|
170
|
+
return ingest({
|
|
171
|
+
submitData,
|
|
172
|
+
type,
|
|
173
|
+
source
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
// One reason we wanted to send everything through GA is to honor region/consent status
|
|
177
|
+
// GA will send to ingest so you don’t need to send separately
|
|
178
|
+
return sendToGA({
|
|
179
|
+
submitData,
|
|
180
|
+
type,
|
|
181
|
+
source
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
131
186
|
const StyledMobileSelect = /*#__PURE__*/wpdsUiKit.styled('select', {
|
|
132
187
|
padding: '12px 16px 12px 6px',
|
|
133
188
|
display: 'flex',
|
|
@@ -312,7 +367,7 @@ const DESelect = _ref => {
|
|
|
312
367
|
type: config !== null && config !== void 0 && config.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,
|
|
313
368
|
source
|
|
314
369
|
}));
|
|
315
|
-
const isError = result ? result.status !== subsSdk.ResponseStatus.SUCCESS : true;
|
|
370
|
+
const isError = result === true ? false : result ? result.status !== subsSdk.ResponseStatus.SUCCESS : true;
|
|
316
371
|
onFinished({
|
|
317
372
|
isFinished: true,
|
|
318
373
|
isError
|
|
@@ -385,5 +440,5 @@ exports.IngestResponseState = IngestResponseState;
|
|
|
385
440
|
exports.IngestType = IngestType;
|
|
386
441
|
exports.getAttributes = getAttributes;
|
|
387
442
|
exports.hasRequiredPrivacyCookies = hasRequiredPrivacyCookies;
|
|
388
|
-
exports.
|
|
443
|
+
exports.push = push;
|
|
389
444
|
//# sourceMappingURL=subs-de-inputs.cjs.development.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subs-de-inputs.cjs.development.js","sources":["../src/interfaces/index.ts","../src/utils/hasRequiredPrivacyCookies.ts","../src/services/dataEnrichment.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/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: Array<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 getCookie,\n} from '@washingtonpost/subs-sdk';\nimport {\n Attribute,\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\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\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n let attributeInfo = attributesCache[fieldName];\n if (!attributeInfo) {\n attributeInfo = await getAttributes({ 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 jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type,\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 type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\n source,\n });\n\n const isError = 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 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"],"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","ingest","_ref2","submitData","value","type","source","wapo_login_id","Error","attributeInfo","name","collection_behavior","jucid","localStorage","getItem","ga","payload","metadata","response","method","body","JSON","stringify","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","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","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","warn","ScriptStatus","READY","submitSelected","_window2","result","push","explicit","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection"],"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;;;MC3CLgB,yBAAyB,GAAGA;;EACvC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,KAAK;;EAGd,MAAMC,MAAM,GAAGC,iBAAS,CAAC,QAAQ,CAAC;EAElC,MAAMC,WAAW,IAAAC,MAAA,GAAGC,aAAK,EAAE,cAAAD,MAAA,uBAAPA,MAAA,CAASE,YAAY;EAEzC,OAAO,CAAC,EAAEL,MAAM,IAAIE,WAAW,KAAK,IAAI,CAAC;AAC3C,CAAC;;ACED,MAAMI,IAAI,MAAMC,iBAAS,CAACD,YAAY;AAEtC,MAAME,eAAe,GAAwB,EAAE;AAC/C,MAAaC,aAAa,GAAsB,MAAAC,IAAA;MAAO;IACrDC;GAGD,GAAAD,IAAA;EACC,IAAIF,eAAe,CAACG,SAAS,CAAC,EAAE;IAC9B,OAAOH,eAAe,CAACG,SAAS,CAAC;;EAGnC,MAAMC,UAAU,GAAG,CAACD,SAAS,CAAC;EAE9B,IAAI;IACF,MAAME,GAAG,GAAG,IAAIC,GAAG,IAAIR,i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AY;IACnBC,MAAM,EAAE,EAAE;IACVZ,QAAQ,EAAE;IAEb,EACA,CAAC2D,QAAQ,IAAIC,MAAM,IAClBlC,6BAACjB,QAAQ;IACPC,EAAE,EAAEkD,MAAM,CAAC9F,IAAI;IACf6C,KAAK,EAAEA,KAAK,IAAIiD,MAAM,CAAC9F,IAAI;IAC3BiD,QAAQ,EAAG7D,CAAC;MACV4G,WAAW,CAAC5G,CAAC,CAAC;MACd6D,QAAQ,CAAC;QAAEvD,KAAK,EAAEN;OAAG,CAAC;KACvB;IACD0D,MAAM,EAAEA,MAAM,CAACkB,GAAG,CAAEtE,KAAK,IAAKA,KAAK,CAACM,IAAI,CAAC;IACzCgD,YAAY,EAAEA,YAAY;IAC1Bd,QAAQ,EAAEA;IAEb,CACa;AAEpB,CAAC;AAED,MAAMuF,aAAa,gBAAG3G,gBAAM,CAAC,KAAK,EAAE;EAClC4G,SAAS,EAAE,YAAY;EACvB1G,OAAO,EAAE,MAAM;EACf2G,YAAY,EAAE,MAAM;EACpBC,aAAa,EAAE,QAAQ;EACvB,UAAU,EAAE;IACV7G,OAAO,EAAE;GACV;EACD,KAAK,EAAE;IAAE2G,SAAS,EAAE;;CACrB,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/services/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/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: Array<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 { IngestType } from '../interfaces';\n\nexport interface ISendGAEvent {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}\n\nconst sendGAEvent = (props: ISendGAEvent): 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 type?: (typeof IngestType)[keyof typeof IngestType];\n source: string;\n}) => Promise<true>;\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport {\n IngestResponseState,\n IngestType,\n} from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\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,\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 type?: (typeof IngestType)[keyof typeof IngestType];\n source: string;\n}) => Promise<{\n status: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from './getAttributes';\nimport { sendToGA } from './sendToGA';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from './ingest';\n\nexport const push: PushType = async ({\n submitData,\n type = IngestType.IMPLICIT,\n source,\n}) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const attributeInfo = await getAttributes({\n fieldName: submitData.fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === submitData.fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, type, source });\n } else {\n // One reason we wanted to send everything through GA is to honor region/consent status\n // GA will send to ingest so you don’t need to send separately\n return sendToGA({ submitData, type, source });\n }\n};\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\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 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"],"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","type","wapo_login_id","jucid","localStorage","getItem","ga","payload","metadata","response","method","body","JSON","stringify","Error","attributeInfo","name","collection_behavior","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","explicit","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection"],"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;;;MC3CLgB,yBAAyB,GAAGA;;EACvC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,KAAK;;EAGd,MAAMC,MAAM,GAAGC,iBAAS,CAAC,QAAQ,CAAC;EAElC,MAAMC,WAAW,IAAAC,MAAA,GAAGC,aAAK,EAAE,cAAAD,MAAA,uBAAPA,MAAA,CAASE,YAAY;EAEzC,OAAO,CAAC,EAAEL,MAAM,IAAIE,WAAW,KAAK,IAAI,CAAC;AAC3C,CAAC;;ACLD,MAAMI,IAAI,MAAMC,iBAAS,CAACD,YAAY;AAEtC,MAAME,eAAe,GAAwB,EA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CAAC;QAAE7D,KAAK,EAAEd;OAAG,CAAC;KACvB;OACGmF,gBAAgB;OAChBD;KAEHqC,QAAQ,CAEZ,EACA,CAACA,QAAQ,IAAI,CAACC,MAAM,IACnBlC,6BAAChB,QAAQ;IACPC,EAAE,EAAE,SAAS;IACbpD,KAAK,EAAE,YAAY;IACnBqD,MAAM,EAAE,EAAE;IACVX,QAAQ,EAAE;IAEb,EACA,CAAC0D,QAAQ,IAAIC,MAAM,IAClBlC,6BAAChB,QAAQ;IACPC,EAAE,EAAEiD,MAAM,CAAClF,IAAI;IACfnB,KAAK,EAAEA,KAAK,IAAIqG,MAAM,CAAClF,IAAI;IAC3BqC,QAAQ,EAAG3E,CAAC;MACV0H,WAAW,CAAC1H,CAAC,CAAC;MACd2E,QAAQ,CAAC;QAAE7D,KAAK,EAAEd;OAAG,CAAC;KACvB;IACDwE,MAAM,EAAEA,MAAM,CAACkB,GAAG,CAAE5E,KAAK,IAAKA,KAAK,CAACwB,IAAI,CAAC;IACzCoC,YAAY,EAAEA,YAAY;IAC1Bb,QAAQ,EAAEA;IAEb,CACa;AAEpB,CAAC;AAED,MAAMoF,aAAa,gBAAGxG,gBAAM,CAAC,KAAK,EAAE;EAClCyG,SAAS,EAAE,YAAY;EACvBvG,OAAO,EAAE,MAAM;EACfwG,YAAY,EAAE,MAAM;EACpBC,aAAa,EAAE,QAAQ;EACvB,UAAU,EAAE;IACV1G,OAAO,EAAE;GACV;EACD,KAAK,EAAE;IAAEwG,SAAS,EAAE;;CACrB,CAAC;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@washingtonpost/subs-sdk"),o=require("react"),a=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@washingtonpost/wpds-ui-kit"),s=require("@washingtonpost/subs-hooks"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@washingtonpost/subs-sdk"),o=require("react"),a=(e=o)&&"object"==typeof e&&"default"in e?e.default:e,i=require("@washingtonpost/wpds-ui-kit"),s=require("@washingtonpost/subs-hooks"),r=require("@washingtonpost/wpds-assets");const n={COLLECT:"COLLECT",DO_NOT_COLLECT:"DO_NOT_COLLECT"},l={EXPLICIT:"explicit",IMPLICIT:"implicit"},d=()=>{var e;if("undefined"==typeof window)return!1;const o=t.getCookie("wp_usp"),a=null===(e=t.WPGeo())||void 0===e?void 0:e.country_code;return!(!o||"US"!==a)},c=t.ENDPOINTS.base+"/de/v1",u={},p=async e=>{let{fieldName:o}=e;if(u[o])return u[o];const a=[o];try{const e=new URL(c+"/attributes");e.searchParams.set("attributes",a.join(","));const i=await fetch(e.toString(),{credentials:"include",headers:t.JSON_HEADERS}),s=await i.json();if(i.ok&&s.status===t.ResponseStatus.SUCCESS){const e=s.attributes||[];return u[o]=e,e}return[]}catch(e){return console.debug(e),[]}},b=t.ENDPOINTS.base+"/de/v1",E=i.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:i.theme.colors.disabled,borderColor:i.theme.colors.disabled,color:i.theme.colors.onDisabled,cursor:"not-allowed"}}),g=i.styled("div",{width:"100%",maxWidth:"380px",borderRadius:"$012",borderColor:"$subtle",borderStyle:"solid",borderWidth:"1px",backgroundColor:"$secondary",position:"relative"}),m=i.styled("option",{fontFamily:"inherit",fontSize:"inherit",color:"inherit"}),h=e=>{let{id:t,label:n,values:l,required:d=!1,defaultValue:c,onChange:u=(()=>{}),disabled:p=!1}=e;const[b,h]=o.useState(),{isMobileSize:I}=s.useWindowSize();o.useEffect(()=>{b&&u(b)},[b]);const f=p?{disabled:!0}:{},S=b?{defaultValue:b}:c?{defaultValue:c}:{},w=e=>b?e===b?{selected:!0}:{}:e===c?{selected:!0}:{};return I?a.createElement(g,null,a.createElement(E,{id:"",required:d,onChange:e=>h(e.target.value),placeholder:n,...f},a.createElement("label",null,n),a.createElement(m,{value:"",disabled:!0,selected:!0,style:{color:"#666666"}},n),l.map(e=>a.createElement(m,{value:e,key:e,...w(e)},e))),a.createElement(i.Icon,{label:"",size:"100",fill:i.theme.colors.gray80,style:{pointerEvents:"none",position:"absolute",right:"10px",top:"50%",transform:"translateY(-50%)"}},a.createElement(r.ChevronDown,{style:{position:"absolute",right:"10px"}}))):a.createElement(i.Select.Root,{onValueChange:e=>h(e),required:d,...S,...f},a.createElement(i.Select.Trigger,{"data-test-id":t+"-select-trigger"},a.createElement(i.Select.Label,null,n),a.createElement(i.Select.Value,null)),a.createElement(i.Select.Content,{css:{zIndex:i.theme.zIndices.page},"data-test-id":t+"-select-content"},l.map(e=>a.createElement(i.Select.Item,{value:e,key:e},e))))},I=("https://subscribe.washingtonpost.com/static"===t.ENDPOINTS.staticAssets?"https://www.washingtonpost.com/subscribe/static/":t.ENDPOINTS.staticAssets)+"/de-utils/twpdeu.min.js",f=i.styled("div",{boxSizing:"border-box",display:"flex",marginBottom:"$100",flexDirection:"column","& button":{padding:"1px 6px"},"& *":{boxSizing:"border-box"}});exports.AttributesState={SUCCESS:"100"},exports.CollectionBehaviors=n,exports.DESelect=e=>{let{source:r,fieldName:n,label:d,dataDictionaryConfig:c,defaultValue:u,disabled:p,submit:b,onChange:E=(()=>{}),onFinished:g=(()=>{}),valuesFilter:m=(()=>!0),children:S}=e;const[w,C]=o.useState(c),[y,v]=o.useState(""),N=s.useScript(I);o.useEffect(()=>{N!==s.ScriptStatus.READY||S||w||(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:n}));t?C(t[0]):console.error("unable to get config",n)}catch(e){console.warn("unable to get config",n,e)}})()},[N]),o.useEffect(()=>{N===s.ScriptStatus.READY&&b&&y&&(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:n,value:y},type:null!=w&&w.explicit?l.EXPLICIT:l.IMPLICIT,source:r}));g({isFinished:!0,isError:!0!==o&&(!o||o.status!==t.ResponseStatus.SUCCESS)})}catch(e){g({isFinished:!1,isError:!0})}})()},[N,b]);const T=u&&w?{defaultValue:u}:{},D=p||!S&&!w?{disabled:!0}:{},_=w?w.values.sort((e,t)=>e.order-t.order).filter(e=>!0!==e.archived).filter(m):[];return a.createElement(f,null,S&&a.createElement(i.Select.Root,{onValueChange:e=>{v(e),E({value:e})},...T,...D},S),!S&&!w&&a.createElement(h,{id:"loading",label:"Loading...",values:[],disabled:!0}),!S&&w&&a.createElement(h,{id:w.name,label:d||w.name,onChange:e=>{v(e),E({value:e})},values:_.map(e=>e.name),defaultValue:u,disabled:p}))},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=d,exports.push=async e=>{let{submitData:o,type:a=l.IMPLICIT,source:i}=e;if(!d())throw new Error("does not satisfy cookie check");const s=await p({fieldName:o.fieldName});if(s[0]&&s[0].name===o.fieldName&&s[0].collection_behavior===n.DO_NOT_COLLECT)throw new Error("do not collect");return a===l.EXPLICIT?(async e=>{let{submitData:{fieldName:o,value:a},type:i=l.IMPLICIT,source:s}=e;const r=b+"/ingest",n=t.getCookie("wapo_login_id"),d={jucid:localStorage.getItem("uuid"),ga:t.getCookie("_ga"),type:i,wapo_login_id:n,data:{[o]:[a]},metadata:{source:s}};try{const e=await fetch(r,{method:"POST",credentials:"include",headers:t.JSON_HEADERS,body:JSON.stringify(d)});return await e.json()}catch(e){return console.debug(e),null}})({submitData:o,type:a,source:i}):(async e=>{let{submitData:{fieldName:t,value:o},source:a}=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:a}),!0})({submitData:o,type:a,source:i})};
|
|
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/utils/hasRequiredPrivacyCookies.ts","../src/services/dataEnrichment.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/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: Array<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 getCookie,\n} from '@washingtonpost/subs-sdk';\nimport {\n Attribute,\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\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\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n let attributeInfo = attributesCache[fieldName];\n if (!attributeInfo) {\n attributeInfo = await getAttributes({ 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 jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type,\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 type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\n source,\n });\n\n const isError = 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 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"],"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","& *","source","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","ScriptStatus","READY","_window","__twpdeu","getFieldConfigs","error","warn","fetchConfig","_window2","result","push","submitData","type","explicit","isFinished","isError","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","_ref2","wapo_login_id","Error","attributeInfo","collection_behavior","payload","jucid","localStorage","getItem","ga","[object Object]","metadata","response","method","body","JSON","stringify"],"mappings":"0TAQaA,EAAsB,CACjCC,QAAS,UACTC,eAAgB,kBAmBLC,EAAa,CACxBC,SAAU,WACVC,SAAU,YC7BCC,EAA4B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AM,iCAGlB,IAAIC,EAAgB7J,EAAgBG,GAKpC,GAJK0J,IACHA,QAAsB5J,EAAc,CAAEE,UAAAA,KAItC0J,EAAc,IACdA,EAAc,GAAGb,OAAS7I,GAC1B0J,EAAc,GAAGC,sBAAwB9K,EAAoBE,eAE7D,MAAM,IAAI0K,MAAM,kBAGlB,MAGMG,EAAU,CACdC,MAJYC,aAAaC,QAAQ,QAKjCC,GAJS1K,YAAU,OAKnB4I,KAAAA,EACAsB,cAAAA,EACAhJ,KAAM,CACJyJ,CAACjK,GAAY,CAACuE,IAEhB2F,SAAU,CAAEvD,OAAAA,IAGd,IACE,MAAMwD,QAAiB1J,MAAMN,EAAK,CAChCiK,OAAQ,OACRzJ,YAAa,UACbC,QAASC,eACTwJ,KAAMC,KAAKC,UAAUX,KAKvB,aAFmBO,EAASrJ,OAG5B,MAAOM,GAEP,OADAC,QAAQC,MAAMF,GACP"}
|
|
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/services/push.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: Array<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 {\n IngestResponseState,\n IngestType,\n} from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\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,\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 type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\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 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 {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from './getAttributes';\nimport { sendToGA } from './sendToGA';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from './ingest';\n\nexport const push: PushType = async ({\n submitData,\n type = IngestType.IMPLICIT,\n source,\n}) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const attributeInfo = await getAttributes({\n fieldName: submitData.fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === submitData.fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, type, source });\n } else {\n // One reason we wanted to send everything through GA is to honor region/consent status\n // GA will send to ingest so you don’t need to send separately\n return sendToGA({ submitData, type, source });\n }\n};\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n type?: (typeof IngestType)[keyof typeof IngestType];\n source: string;\n}) => Promise<\n | {\n status: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n }\n | null\n | true\n>;\n","import { IngestType } from '../interfaces';\n\nexport interface ISendGAEvent {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}\n\nconst sendGAEvent = (props: ISendGAEvent): 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 type?: (typeof IngestType)[keyof typeof IngestType];\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","& *","source","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","ScriptStatus","READY","_window","__twpdeu","getFieldConfigs","error","warn","fetchConfig","_window2","result","push","submitData","type","explicit","isFinished","isError","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","attributeInfo","collection_behavior","wapo_login_id","payload","jucid","localStorage","getItem","ga","[object Object]","metadata","response","method","body","JSON","stringify","ingest","props","process","env","NODE_ENV","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,EAAgBG,GAGzB,MAAME,EAAa,CAACF,GAEpB,IACE,MAAMG,EAAM,IAAIC,IAAOT,iBACvBQ,EAAIE,aAAaC,IAAI,aAAcJ,EAAWK,KAAK,MAEnD,MAAMC,QAAaC,MAAMN,EAAIO,WAAY,CACvCC,YAAa,UACbC,QAASC,iBAELC,QAAaN,EAAKM,OAExB,GAAIN,EAAKO,IAAMD,EAAKE,SAAWC,iBAAeC,QAAS,CACrD,MAAMC,EAAaL,EAAKK,YAAc,GAEtC,OADAtB,EAAgBG,GAAamB,EACtBA,EAEP,MAAO,GAET,MAAOC,GAEP,OADAC,QAAQC,MAAMF,GACP,KC7BLzB,EAAUC,YAAUD,cCIpB4B,EAAqBC,SAAO,SAAU,CAC1CC,QAAS,qBACTC,QAAS,OACTC,eAAgB,gBAChBC,MAAO,OACPC,gBAAiB,aACjBC,MAAO,WACPC,WAAY,QACZC,SAAU,OACVC,WAAY,SACZC,WAAY,OACZC,kBAAmB,OACnBC,aAAc,WACdC,SAAU,WACVC,YAAa,cACbC,iBAAkB,OAClBC,iBAAkB,cAClBC,WAAY,OACZC,qBAAsB,OACtBC,aAAc,CACZd,gBAAiBe,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EvC,MAAMC,EAAiC,IAClCL,GAELpL,OAAOwL,UAAU5C,KAAK6C,IAOtBC,CAAY,CACVC,MAAO,oBACPC,OAAQ,oBACRC,SAAU,UAEVxH,MAAOzD,EACPkL,WAAYlL,EACZgK,CAAChK,GAAYuE,EAEb4G,QAAS,UACTC,WAAYzE,KAGP,GDLE0E,CAAS,CAAEpD,WAAAA,EAAYC,KAAAA,EAAMvB,OAAAA"}
|
|
@@ -69,7 +69,42 @@ const getAttributes = async _ref => {
|
|
|
69
69
|
return [];
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
const sendGAEvent = props => {
|
|
74
|
+
if (typeof window === 'undefined') {
|
|
75
|
+
if (process.env.NODE_ENV !== "production") console.warn('NO WINDOW');
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
// Initialize dataLayer if needed
|
|
79
|
+
window.dataLayer = window.dataLayer || [];
|
|
80
|
+
const eventData = {
|
|
81
|
+
...props
|
|
82
|
+
};
|
|
83
|
+
window.dataLayer.push(eventData);
|
|
84
|
+
};
|
|
85
|
+
const sendToGA = async _ref => {
|
|
86
|
+
let {
|
|
87
|
+
submitData: {
|
|
88
|
+
fieldName,
|
|
89
|
+
value
|
|
90
|
+
},
|
|
91
|
+
source
|
|
92
|
+
} = _ref;
|
|
93
|
+
sendGAEvent({
|
|
94
|
+
event: 'site-onpage-click',
|
|
95
|
+
action: 'site-onpage-click',
|
|
96
|
+
category: 'profile',
|
|
97
|
+
label: fieldName,
|
|
98
|
+
'de-label': fieldName,
|
|
99
|
+
[fieldName]: value,
|
|
100
|
+
section: 'profile',
|
|
101
|
+
subsection: source
|
|
102
|
+
});
|
|
103
|
+
return true;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const base$1 = `${ENDPOINTS.base}/de/v1`;
|
|
107
|
+
const ingest = async _ref => {
|
|
73
108
|
let {
|
|
74
109
|
submitData: {
|
|
75
110
|
fieldName,
|
|
@@ -77,21 +112,9 @@ const ingest = async _ref2 => {
|
|
|
77
112
|
},
|
|
78
113
|
type = IngestType.IMPLICIT,
|
|
79
114
|
source
|
|
80
|
-
} =
|
|
81
|
-
const url = `${base}/ingest`;
|
|
115
|
+
} = _ref;
|
|
116
|
+
const url = `${base$1}/ingest`;
|
|
82
117
|
const wapo_login_id = getCookie('wapo_login_id');
|
|
83
|
-
if (!hasRequiredPrivacyCookies()) {
|
|
84
|
-
throw new Error('does not satisfy cookie check');
|
|
85
|
-
}
|
|
86
|
-
let attributeInfo = attributesCache[fieldName];
|
|
87
|
-
if (!attributeInfo) {
|
|
88
|
-
attributeInfo = await getAttributes({
|
|
89
|
-
fieldName
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
if (attributeInfo[0] && attributeInfo[0].name === fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT) {
|
|
93
|
-
throw new Error('do not collect');
|
|
94
|
-
}
|
|
95
118
|
const jucid = localStorage.getItem('uuid');
|
|
96
119
|
const ga = getCookie('_ga');
|
|
97
120
|
const payload = {
|
|
@@ -121,6 +144,38 @@ const ingest = async _ref2 => {
|
|
|
121
144
|
}
|
|
122
145
|
};
|
|
123
146
|
|
|
147
|
+
const push = async _ref => {
|
|
148
|
+
let {
|
|
149
|
+
submitData,
|
|
150
|
+
type = IngestType.IMPLICIT,
|
|
151
|
+
source
|
|
152
|
+
} = _ref;
|
|
153
|
+
if (!hasRequiredPrivacyCookies()) {
|
|
154
|
+
throw new Error('does not satisfy cookie check');
|
|
155
|
+
}
|
|
156
|
+
const attributeInfo = await getAttributes({
|
|
157
|
+
fieldName: submitData.fieldName
|
|
158
|
+
});
|
|
159
|
+
if (attributeInfo[0] && attributeInfo[0].name === submitData.fieldName && attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT) {
|
|
160
|
+
throw new Error('do not collect');
|
|
161
|
+
}
|
|
162
|
+
if (type === IngestType.EXPLICIT) {
|
|
163
|
+
return ingest({
|
|
164
|
+
submitData,
|
|
165
|
+
type,
|
|
166
|
+
source
|
|
167
|
+
});
|
|
168
|
+
} else {
|
|
169
|
+
// One reason we wanted to send everything through GA is to honor region/consent status
|
|
170
|
+
// GA will send to ingest so you don’t need to send separately
|
|
171
|
+
return sendToGA({
|
|
172
|
+
submitData,
|
|
173
|
+
type,
|
|
174
|
+
source
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
124
179
|
const StyledMobileSelect = /*#__PURE__*/styled('select', {
|
|
125
180
|
padding: '12px 16px 12px 6px',
|
|
126
181
|
display: 'flex',
|
|
@@ -305,7 +360,7 @@ const DESelect = _ref => {
|
|
|
305
360
|
type: config !== null && config !== void 0 && config.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,
|
|
306
361
|
source
|
|
307
362
|
}));
|
|
308
|
-
const isError = result ? result.status !== ResponseStatus.SUCCESS : true;
|
|
363
|
+
const isError = result === true ? false : result ? result.status !== ResponseStatus.SUCCESS : true;
|
|
309
364
|
onFinished({
|
|
310
365
|
isFinished: true,
|
|
311
366
|
isError
|
|
@@ -371,5 +426,5 @@ const SelectWrapper = /*#__PURE__*/styled('div', {
|
|
|
371
426
|
}
|
|
372
427
|
});
|
|
373
428
|
|
|
374
|
-
export { AttributesState, CollectionBehaviors, DESelect, IngestResponseState, IngestType, getAttributes, hasRequiredPrivacyCookies,
|
|
429
|
+
export { AttributesState, CollectionBehaviors, DESelect, IngestResponseState, IngestType, getAttributes, hasRequiredPrivacyCookies, push };
|
|
375
430
|
//# 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/hasRequiredPrivacyCookies.ts","../src/services/dataEnrichment.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/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: Array<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 getCookie,\n} from '@washingtonpost/subs-sdk';\nimport {\n Attribute,\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\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\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\n source,\n}) => {\n const url = `${base}/ingest`;\n\n const wapo_login_id = getCookie('wapo_login_id');\n\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n let attributeInfo = attributesCache[fieldName];\n if (!attributeInfo) {\n attributeInfo = await getAttributes({ 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 jucid = localStorage.getItem('uuid');\n const ga = getCookie('_ga');\n\n const payload = {\n jucid,\n ga,\n type,\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 type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\n source,\n });\n\n const isError = 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 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"],"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","ingest","_ref2","submitData","value","type","source","wapo_login_id","Error","attributeInfo","name","collection_behavior","jucid","localStorage","getItem","ga","payload","metadata","response","method","body","JSON","stringify","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","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","DESelect","dataDictionaryConfig","submit","onFinished","valuesFilter","children","config","setConfig","setSelected","scriptStatus","useScript","fetchConfig","_window","__twpdeu","getFieldConfigs","error","warn","ScriptStatus","READY","submitSelected","_window2","result","push","explicit","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection"],"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;;;MC3CLgB,yBAAyB,GAAGA;;EACvC,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;IACjC,OAAO,KAAK;;EAGd,MAAMC,MAAM,GAAGC,SAAS,CAAC,QAAQ,CAAC;EAElC,MAAMC,WAAW,IAAAC,MAAA,GAAGC,KAAK,EAAE,cAAAD,MAAA,uBAAPA,MAAA,CAASE,YAAY;EAEzC,OAAO,CAAC,EAAEL,MAAM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,EAAE;EAEN,OACEhC,oBAAC6D,aAAa,QACX5B,QAAQ,IACPjC,oBAACc,MAAM,CAACC,IAAI;IACVC,aAAa,EAAGxF,CAAC;MACf4G,WAAW,CAAC5G,CAAC,CAAC;MACd6D,QAAQ,CAAC;QAAEvD,KAAK,EAAEN;OAAG,CAAC;KACvB;OACGqE,gBAAgB;OAChBD;KAEHqC,QAAQ,CAEZ,EACA,CAACA,QAAQ,IAAI,CAACC,MAAM,IACnBlC,oBAACjB,QAAQ;IACPC,EAAE,EAAE,SAAS;IACbC,KAAK,EAAE,YAAY;IACnBC,MAAM,EAAE,EAAE;IACVZ,QAAQ,EAAE;IAEb,EACA,CAAC2D,QAAQ,IAAIC,MAAM,IAClBlC,oBAACjB,QAAQ;IACPC,EAAE,EAAEkD,MAAM,CAAC9F,IAAI;IACf6C,KAAK,EAAEA,KAAK,IAAIiD,MAAM,CAAC9F,IAAI;IAC3BiD,QAAQ,EAAG7D,CAAC;MACV4G,WAAW,CAAC5G,CAAC,CAAC;MACd6D,QAAQ,CAAC;QAAEvD,KAAK,EAAEN;OAAG,CAAC;KACvB;IACD0D,MAAM,EAAEA,MAAM,CAACkB,GAAG,CAAEtE,KAAK,IAAKA,KAAK,CAACM,IAAI,CAAC;IACzCgD,YAAY,EAAEA,YAAY;IAC1Bd,QAAQ,EAAEA;IAEb,CACa;AAEpB,CAAC;AAED,MAAMuF,aAAa,gBAAG3G,MAAM,CAAC,KAAK,EAAE;EAClC4G,SAAS,EAAE,YAAY;EACvB1G,OAAO,EAAE,MAAM;EACf2G,YAAY,EAAE,MAAM;EACpBC,aAAa,EAAE,QAAQ;EACvB,UAAU,EAAE;IACV7G,OAAO,EAAE;GACV;EACD,KAAK,EAAE;IAAE2G,SAAS,EAAE;;CACrB,CAAC;;;;"}
|
|
1
|
+
{"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/services/push.ts","../src/components/DESelect/Dropdown.tsx","../src/components/DESelect/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: Array<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 { IngestType } from '../interfaces';\n\nexport interface ISendGAEvent {\n event: string;\n category: string;\n action: string;\n label: string;\n 'de-label': string;\n [key: string]: undefined | string | string[];\n}\n\nconst sendGAEvent = (props: ISendGAEvent): 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 type?: (typeof IngestType)[keyof typeof IngestType];\n source: string;\n}) => Promise<true>;\n","import {\n ENDPOINTS,\n ResponseStatus,\n JSON_HEADERS,\n getCookie,\n} from '@washingtonpost/subs-sdk';\nimport {\n IngestResponseState,\n IngestType,\n} from '../interfaces';\n\nconst base = `${ENDPOINTS.base}/de/v1`;\n\nexport const ingest: IngestType = async ({\n submitData: { fieldName, value },\n type = IngestType.IMPLICIT,\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,\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 type?: (typeof IngestType)[keyof typeof IngestType];\n source: string;\n}) => Promise<{\n status: ResponseStatus;\n state: (typeof IngestResponseState)[keyof typeof IngestResponseState];\n} | null>;\n","import {\n CollectionBehaviors,\n IngestResponseState,\n IngestType,\n} from '../interfaces';\nimport { getAttributes } from './getAttributes';\nimport { sendToGA } from './sendToGA';\nimport { hasRequiredPrivacyCookies } from '../utils/hasRequiredPrivacyCookies';\nimport { ResponseStatus } from '@washingtonpost/subs-sdk';\nimport { ingest } from './ingest';\n\nexport const push: PushType = async ({\n submitData,\n type = IngestType.IMPLICIT,\n source,\n}) => {\n if (!hasRequiredPrivacyCookies()) {\n throw new Error('does not satisfy cookie check');\n }\n\n const attributeInfo = await getAttributes({\n fieldName: submitData.fieldName,\n });\n\n if (\n attributeInfo[0] &&\n attributeInfo[0].name === submitData.fieldName &&\n attributeInfo[0].collection_behavior === CollectionBehaviors.DO_NOT_COLLECT\n ) {\n throw new Error('do not collect');\n }\n\n if (type === IngestType.EXPLICIT) {\n return ingest({ submitData, type, source });\n } else {\n // One reason we wanted to send everything through GA is to honor region/consent status\n // GA will send to ingest so you don’t need to send separately\n return sendToGA({ submitData, type, source });\n }\n};\n\ntype PushType = ({\n submitData: { fieldName, value },\n source,\n}: {\n submitData: {\n fieldName: string;\n value: string;\n };\n type?: (typeof IngestType)[keyof typeof IngestType];\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, IngestType } 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;\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 // TODO: Log to GA?\n\n const result = await window?.__twpdeu?.push({\n submitData: { fieldName, value: selected },\n type: config?.explicit ? IngestType.EXPLICIT : IngestType.IMPLICIT,\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 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"],"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","type","wapo_login_id","jucid","localStorage","getItem","ga","payload","metadata","response","method","body","JSON","stringify","Error","attributeInfo","name","collection_behavior","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","explicit","isError","isFinished","isLoading","sort","a","b","order","filter","archived","SelectWrapper","boxSizing","marginBottom","flexDirection"],"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;;;MC3CLgB,yBAAyB,GAAGA;;EACvC,IAAI,OAAOC,MAAM,KA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CACrB,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.3.0",
|
|
2
|
+
"version": "0.3.1-canary.0",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"name": "de-inputs: DESelect",
|
|
43
43
|
"path": "dist/subs-de-inputs.esm.js",
|
|
44
44
|
"import": "{ DESelect }",
|
|
45
|
-
"limit": "2 KB"
|
|
45
|
+
"limit": "2.5 KB"
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
48
|
"devDependencies": {
|
package/CHANGELOG.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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.3.0 - 2024-05-06]**:
|
|
7
|
-
* Uses the native `<select />` element in smaller viewport sizes for better UX
|
|
8
|
-
|
|
9
|
-
**[0.2.2 - 2024-05-03]**:
|
|
10
|
-
* use `window.__twpdeu.push()` for submitting
|
|
11
|
-
* Better loading state when fetching config over the wire
|
|
12
|
-
* Prevent extra calls to `ingest` API if user changes value after clicking submit
|
|
13
|
-
* Fix `ingest()` function to send the right format (again)
|
|
14
|
-
|
|
15
|
-
**[0.2.1 - 2024-05-02]**:
|
|
16
|
-
* Revert "ESM build only"
|
|
17
|
-
* `ingest()` function throws error if `submitData.value` is not an array (required by BE)
|
|
18
|
-
|
|
19
|
-
**[0.2.0 - 2024-05-01]**:
|
|
20
|
-
* Adds `ingest()` function
|
|
21
|
-
* ESM build only
|
|
22
|
-
* Babel config to target recent browsers only
|
|
23
|
-
|
|
24
|
-
**[0.1.1 - 2024-04-30]**:
|
|
25
|
-
* Fix build by removing unused file
|
|
26
|
-
|
|
27
|
-
**[0.1.0 - 2024-04-25]**:
|
|
28
|
-
* Add initial `<DESelect />` component
|
|
29
|
-
|
|
30
|
-
**[0.0.2 - 2024-04-24]**:
|
|
31
|
-
* Fix build error
|
|
32
|
-
|
|
33
|
-
**[0.0.1 - 2024-04-09]**:
|
|
34
|
-
* Initial setup
|