Skip to content

Commit

Permalink
chore: fix-typings
Browse files Browse the repository at this point in the history
fixed action collector type to be more clear of intent
  • Loading branch information
ryanbas21 committed Dec 9, 2024
1 parent 91c82a5 commit 59605c2
Showing 1 changed file with 9 additions and 25 deletions.
34 changes: 9 additions & 25 deletions packages/davinci-client/src/lib/collector.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@ export type ActionCollectorTypes =
| 'SocialLoginCollector'
| 'ActionCollector';

export interface ActionCollectorNoUrl<T extends ActionCollectorTypes> {
category: 'ActionCollector';
error: string | null;
type: T;
id: string;
name: string;
output: {
key: string;
label: string;
type: string;
};
}

type ActionCollectorOutputTypes =
| {
key: string;
Expand All @@ -86,7 +73,8 @@ type ActionCollectorOutputTypes =
label: string;
type: string;
};
export interface ActionCollectorWithUrl<T extends ActionCollectorTypes> {

export interface ActionCollector<T extends ActionCollectorTypes> {
category: 'ActionCollector';
error: string | null;
type: T;
Expand All @@ -95,18 +83,14 @@ export interface ActionCollectorWithUrl<T extends ActionCollectorTypes> {
output: ActionCollectorOutputTypes;
}

export type ActionCollector<T extends ActionCollectorTypes> =
| ActionCollectorNoUrl<T>
| ActionCollectorWithUrl<T>;

export type ActionCollectors =
| ActionCollectorWithUrl<'SocialLoginCollector'>
| ActionCollectorNoUrl<'ActionCollector'>
| ActionCollectorNoUrl<'FlowCollector'>
| ActionCollectorNoUrl<'SubmitCollector'>;
| ActionCollector<'SocialLoginCollector'>
| ActionCollector<'ActionCollector'>
| ActionCollector<'FlowCollector'>
| ActionCollector<'SubmitCollector'>;

export type FlowCollector = ActionCollectorNoUrl<'FlowCollector'>;
export type FlowCollector = ActionCollector<'FlowCollector'>;
export type PasswordCollector = SingleValueCollectorNoValue<'PasswordCollector'>;
export type TextCollector = SingleValueCollectorWithValue<'TextCollector'>;
export type SocialLoginCollector = ActionCollectorWithUrl<'SocialLoginCollector'>;
export type SubmitCollector = ActionCollectorNoUrl<'SubmitCollector'>;
export type SocialLoginCollector = ActionCollector<'SocialLoginCollector'>;
export type SubmitCollector = ActionCollector<'SubmitCollector'>;

0 comments on commit 59605c2

Please sign in to comment.