@washingtonpost/subs-de-inputs 0.0.1 → 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,14 @@
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
+
7
+ **[0.1.0 - 2024-04-25]**:
8
+ * Add initial `<DESelect />` component
9
+
10
+ **[0.0.2 - 2024-04-24]**:
11
+ * Fix build error
12
+
13
+ **[0.0.1 - 2024-04-09]**:
14
+ * Initial setup
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { Attribute, AttributeValue } from '../../interfaces';
3
+ import { SubsWindow } from '@washingtonpost/subs-sdk';
4
+ declare global {
5
+ interface Window extends SubsWindow {
6
+ }
7
+ }
8
+ interface DESelectProps {
9
+ source: string;
10
+ fieldName: string;
11
+ label?: string;
12
+ dataDictionaryConfig?: Attribute;
13
+ defaultValue?: string;
14
+ disabled?: boolean;
15
+ submit: boolean;
16
+ onChange?: ({ value }: {
17
+ value: string;
18
+ }) => void;
19
+ onFinished?: ({ isFinished, isError, }: {
20
+ isFinished: boolean;
21
+ isError: boolean;
22
+ }) => void;
23
+ valuesFilter?: (value: AttributeValue) => boolean;
24
+ selectProps?: {
25
+ root?: any;
26
+ trigger?: any;
27
+ label?: any;
28
+ value?: any;
29
+ content?: any;
30
+ item?: any;
31
+ };
32
+ children?: React.ReactNode;
33
+ }
34
+ export declare const DESelect: React.FC<DESelectProps>;
35
+ export {};
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- export * from './components/DataEnrichmentForm/index';
2
1
  export * from './interfaces/index';
3
2
  export * from './utils/hasRequiredPrivacyCookies';
4
3
  export * from './services/dataEnrichment';
5
- export * from './services/sendToGA';
4
+ export * from './components/DESelect';
@@ -1,64 +1,34 @@
1
- import { FormEventHandler } from 'react';
2
- export declare enum I1pDataInputTypes {
3
- DROPDOWN = "dropdown"
4
- }
5
- export declare enum I1pIngestDataTypes {
6
- JOB_LEVEL = "profile_job_level",
7
- JOB_INDUSTRY = "profile_job_industry",
8
- NY_PERSONAL_GOALS = "new_year_personal_goals",
9
- NY_HOBBIES = "new_year_hobbies",
10
- NY_PROFESSIONAL_GOALS = "new_year_professional_goals",
11
- NY_INDUSTRY = "new_year_industry",
12
- NY_NEWS_LOCATION = "new_year_news_location"
13
- }
14
- export interface I1pDataInputValue {
15
- archived: boolean;
1
+ export declare type AttributeValue = {
16
2
  name: string;
3
+ date_created: Number;
4
+ last_modified_date: Number;
5
+ archived: boolean;
17
6
  order: number;
18
- date_created?: string;
19
- last_modified_date?: string;
20
- }
21
- export interface I1pDataInputProps {
22
- id: I1pIngestDataTypes;
23
- input_label: string;
24
- input_prompt?: string;
25
- input_type: I1pDataInputTypes;
26
- required: boolean;
27
- default_value?: string;
28
- values?: Array<I1pDataInputValue>;
29
- }
30
- export interface I1pDataFormSubmitData {
31
- [key: string]: string[];
32
- }
33
- export declare enum I1pDataIngestTypes {
34
- EXPLICIT = "explicit",
35
- IMPLICIT = "implicit"
36
- }
37
- export interface I1pDataFormProps {
38
- source: string;
39
- submit?: boolean;
40
- ingestType: I1pDataIngestTypes;
41
- onChange?: (submitData: I1pDataFormSubmitData, requiredFieldsReady: boolean) => void;
42
- onFinished?: (isFinished: boolean, isError: boolean) => void;
43
- formOptions?: Array<I1pDataInputProps>;
44
- handleSubmit?: FormEventHandler<HTMLFormElement>;
45
- disabled?: boolean;
46
- }
47
- export declare type I1pIngestPropsData = {
48
- [key in I1pIngestDataTypes]?: string[];
49
7
  };
50
- export interface I1pIngestProps {
51
- type: 'implicit' | 'explicit';
52
- data: I1pIngestPropsData;
53
- metadata?: Record<string, string | null | undefined>;
54
- [key: string]: any;
55
- }
56
- export declare enum IngestResponseState {
57
- SUCCESS = "100",
58
- SYSTEM_ERROR = "101",
59
- INVALID_TYPE = "102",
60
- INVALID_IDENTIFIER = "103",
61
- INVALID_DATA = "104",
62
- INVALID_ATTRIBUTE_DEFINITION = "105",
63
- INVALID_META_DEFINITION = "106"
64
- }
8
+ export declare const CollectionBehaviors: {
9
+ readonly COLLECT: "COLLECT";
10
+ readonly DO_NOT_COLLECT: "DO_NOT_COLLECT";
11
+ };
12
+ export declare type Attribute = {
13
+ name: string;
14
+ approved_for_use?: boolean;
15
+ collection_behavior?: (typeof CollectionBehaviors)[keyof typeof CollectionBehaviors];
16
+ datatype: 'string';
17
+ explicit: boolean;
18
+ multiple_value: boolean;
19
+ last_modified_date: Number;
20
+ date_created: Number;
21
+ values: Array<AttributeValue>;
22
+ };
23
+ export declare const AttributesState: {
24
+ readonly SUCCESS: "100";
25
+ };
26
+ export declare const IngestResponseState: {
27
+ readonly SUCCESS: "100";
28
+ readonly SYSTEM_ERROR: "101";
29
+ readonly INVALID_TYPE: "102";
30
+ readonly INVALID_IDENTIFIER: "103";
31
+ readonly INVALID_DATA: "104";
32
+ readonly INVALID_ATTRIBUTE_DEFINITION: "105";
33
+ readonly INVALID_META_DEFINITION: "106";
34
+ };
@@ -1,4 +1,3 @@
1
- import { I1pIngestPropsData } from '../interfaces';
2
- export declare const ingest: (submitData: I1pIngestPropsData, metadata: {
3
- [key: string]: string;
1
+ export declare const getAttributes: ({ fieldName }: {
2
+ fieldName: string;
4
3
  }) => Promise<any>;