react-web-native-sketch
Version:
[TODO: We need an overview of how this can be used via npm vs as a local package]
82 lines (81 loc) • 2.38 kB
TypeScript
export declare enum TypeKeys {
POST_S3_DATA = "instacar/s3upload/POST_S3_DATA",
POST_S3_DATA_SUCCESS = "instacar/s3upload/POST_S3_DATA_SUCCESS",
POST_S3_DATA_FAIL = "instacar/s3upload/POST_S3_DATA_FAIL",
GET_S3_PHOTO_INFO = "instacar/s3upload/GET_S3_PHOTO_INFO",
GET_S3_PHOTO_INFO_SUCCESS = "instacar/s3upload/GET_S3_PHOTO_INFO_SUCCESS",
GET_S3_PHOTO_INFO_FAIL = "instacar/s3upload/GET_S3_PHOTO_INFO_FAIL",
REMOVE_PHOTO = "instacar/s3upload/REMOVE_PHOTO"
}
export interface IField {
field: string;
preview: string;
url: string;
s3ExtraData: {
file: any;
'Content-Type': string;
};
}
export interface PostS3DataAction {
type: TypeKeys.POST_S3_DATA;
field: IField;
}
export interface PostS3DataSuccessAction {
type: TypeKeys.POST_S3_DATA_SUCCESS;
field: IField;
s3Key: string;
preview: string;
}
export interface PostS3DataFailAction {
type: TypeKeys.POST_S3_DATA_FAIL;
field: IField;
s3Key: string;
preview: string;
}
export interface GetS3PhotoInfoAction {
type: TypeKeys.GET_S3_PHOTO_INFO;
field: IField;
}
export interface GetS3PhotoInfoSuccessAction {
type: TypeKeys.GET_S3_PHOTO_INFO_SUCCESS;
field: IField;
photo: string;
s3Key: string;
preview: string;
}
export interface GetS3PhotoInfoFailAction {
type: TypeKeys.GET_S3_PHOTO_INFO_FAIL;
field: IField;
}
export interface RemovePhotoAction {
type: TypeKeys.REMOVE_PHOTO;
field: string;
}
export declare type ActionTypes = PostS3DataAction | PostS3DataSuccessAction | PostS3DataFailAction | GetS3PhotoInfoAction | GetS3PhotoInfoSuccessAction | GetS3PhotoInfoFailAction | RemovePhotoAction;
export interface S3FieldData {
preview: string;
s3Key: string;
uploadSuccess?: boolean;
uploading?: boolean;
}
export interface S3UploadState {
[field: string]: S3FieldData;
}
export declare const s3upload: (state: S3UploadState | undefined, action: ActionTypes) => S3UploadState;
export declare function postPhotoToS3(field: IField): {
s3Upload: boolean;
method: string;
url: string;
field: IField;
fields: IField[];
requestPayload: {
field: IField;
};
failurePayload: {
field: IField;
};
successPayload: {
field: IField;
};
};
export declare function removePhoto(field: string): RemovePhotoAction;