@washingtonpost/subs-de-inputs 1.0.0-react18.0 → 1.0.0-react18.1

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.
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ interface IDropdownProps {
3
+ id: string;
4
+ label: string;
5
+ values: Array<string>;
6
+ required?: boolean;
7
+ defaultValue?: string;
8
+ onChange?: (value: string) => void;
9
+ disabled?: boolean;
10
+ }
11
+ /**
12
+ * Dropdown component. Uses wpds-ui-kit on desktop and native select on mobile.
13
+ * @param {IDropdownProps} props The props.
14
+ * @returns {React.ReactElement} The dropdown.
15
+ */
16
+ export declare const Dropdown: ({ id, label, values, required, defaultValue, onChange, disabled, }: IDropdownProps) => React.JSX.Element;
17
+ export {};
@@ -1,10 +1,5 @@
1
1
  import React from 'react';
2
- import { SubsWindow } from '@washingtonpost/subs-sdk';
3
2
  import { Attribute, AttributeValue } from '../../interfaces';
4
- declare global {
5
- interface Window extends SubsWindow {
6
- }
7
- }
8
3
  interface DESelectProps {
9
4
  source: string;
10
5
  fieldName: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './interfaces/index';
2
+ export * from './interfaces/twpdeu';
2
3
  export * from './utils/hasRequiredPrivacyCookies';
3
4
  export * from './services/dataEnrichment';
4
5
  export * from './components/DESelect';
@@ -23,6 +23,10 @@ export type Attribute = {
23
23
  export declare const AttributesState: {
24
24
  readonly SUCCESS: "100";
25
25
  };
26
+ export declare const IngestType: {
27
+ readonly EXPLICIT: "explicit";
28
+ readonly IMPLICIT: "implicit";
29
+ };
26
30
  export declare const IngestResponseState: {
27
31
  readonly SUCCESS: "100";
28
32
  readonly SYSTEM_ERROR: "101";
@@ -31,4 +35,8 @@ export declare const IngestResponseState: {
31
35
  readonly INVALID_DATA: "104";
32
36
  readonly INVALID_ATTRIBUTE_DEFINITION: "105";
33
37
  readonly INVALID_META_DEFINITION: "106";
38
+ readonly UNAUTHENTICATED: "107";
39
+ readonly MISMATCHED_IDENTIFIER: "108";
40
+ readonly DISABLED_ATTRIBUTE_DEFINITION: "109";
41
+ readonly DO_NOT_COLLECT: "110";
34
42
  };
@@ -0,0 +1,11 @@
1
+ import { getAttributes, ingest } from '../services/dataEnrichment';
2
+ export type TWPDEU = {
3
+ getFieldConfigs: typeof getAttributes;
4
+ push: typeof ingest;
5
+ version?: string;
6
+ };
7
+ declare global {
8
+ interface Window {
9
+ __twpdeu?: TWPDEU;
10
+ }
11
+ }
@@ -1,3 +1,19 @@
1
- export declare const getAttributes: ({ fieldName }: {
1
+ import { ResponseStatus } from '@washingtonpost/subs-sdk';
2
+ import { Attribute, IngestResponseState, IngestType } from '../interfaces';
3
+ export declare const getAttributes: GetAttributesType;
4
+ type GetAttributesType = ({ fieldName, }: {
2
5
  fieldName: string;
3
- }) => Promise<any>;
6
+ }) => Promise<Attribute[]>;
7
+ export declare const ingest: IngestType;
8
+ type IngestType = ({ submitData: { fieldName, value }, source, }: {
9
+ submitData: {
10
+ fieldName: string;
11
+ value: string;
12
+ };
13
+ type?: (typeof IngestType)[keyof typeof IngestType];
14
+ source: string;
15
+ }) => Promise<{
16
+ status: ResponseStatus;
17
+ state: (typeof IngestResponseState)[keyof typeof IngestResponseState];
18
+ } | null>;
19
+ export {};