Chore: Migrate REST API - editLivechat to Typescript (#3878)
This commit is contained in:
parent
58c9e98e49
commit
cfb10ada60
|
@ -0,0 +1,40 @@
|
||||||
|
import { TextInput } from 'react-native';
|
||||||
|
|
||||||
|
import { ILivechatVisitor } from './ILivechatVisitor';
|
||||||
|
import { ISubscription } from './ISubscription';
|
||||||
|
|
||||||
|
export interface ITitle {
|
||||||
|
title: string;
|
||||||
|
theme: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IInputs {
|
||||||
|
livechatData: {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
name: string;
|
||||||
|
email: string;
|
||||||
|
phone?: string;
|
||||||
|
topic: string;
|
||||||
|
tag: string[];
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TParams = ILivechatVisitor & IInputs;
|
||||||
|
|
||||||
|
export interface ILivechat extends ISubscription {
|
||||||
|
// Param dynamic depends on server
|
||||||
|
sms?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IInputsRefs {
|
||||||
|
[index: string]: TextInput | null;
|
||||||
|
name: TextInput | null;
|
||||||
|
phone: TextInput | null;
|
||||||
|
topic: TextInput | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICustomFields {
|
||||||
|
visitor?: { [key: string]: string };
|
||||||
|
livechat?: { [key: string]: string };
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
||||||
import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions';
|
import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions';
|
||||||
import { ISpotlight } from '../../../definitions/ISpotlight';
|
import { ISpotlight } from '../../../definitions/ISpotlight';
|
||||||
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
|
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
|
||||||
|
import { TParams } from '../../../definitions/ILivechatEditView';
|
||||||
|
|
||||||
export const createChannel = ({
|
export const createChannel = ({
|
||||||
name,
|
name,
|
||||||
|
@ -337,7 +338,7 @@ export const closeLivechat = (rid: string, comment: string) =>
|
||||||
// RC 0.29.0
|
// RC 0.29.0
|
||||||
sdk.methodCallWrapper('livechat:closeRoom', rid, comment, { clientAction: true });
|
sdk.methodCallWrapper('livechat:closeRoom', rid, comment, { clientAction: true });
|
||||||
|
|
||||||
export const editLivechat = (userData: any, roomData: any) =>
|
export const editLivechat = (userData: TParams, roomData: TParams): Promise<{ error?: string }> =>
|
||||||
// RC 0.55.0
|
// RC 0.55.0
|
||||||
sdk.methodCallWrapper('livechat:saveInfo', userData, roomData);
|
sdk.methodCallWrapper('livechat:saveInfo', userData, roomData);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackNavigationProp } from '@react-navigation/stack';
|
||||||
import { RouteProp } from '@react-navigation/native';
|
import { RouteProp } from '@react-navigation/native';
|
||||||
import { ScrollView, StyleSheet, Text, TextInput as RNTextInput } from 'react-native';
|
import { ScrollView, StyleSheet, Text } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
|
import { BLOCK_CONTEXT } from '@rocket.chat/ui-kit';
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@ import { getUserSelector } from '../selectors/login';
|
||||||
import Button from '../containers/Button';
|
import Button from '../containers/Button';
|
||||||
import SafeAreaView from '../containers/SafeAreaView';
|
import SafeAreaView from '../containers/SafeAreaView';
|
||||||
import { MultiSelect } from '../containers/UIKit/MultiSelect';
|
import { MultiSelect } from '../containers/UIKit/MultiSelect';
|
||||||
import { ILivechatVisitor } from '../definitions/ILivechatVisitor';
|
import { ICustomFields, IInputsRefs, TParams, ITitle, ILivechat } from '../definitions/ILivechatEditView';
|
||||||
import { IApplicationState, ISubscription } from '../definitions';
|
import { IApplicationState } from '../definitions';
|
||||||
import { ChatsStackParamList } from '../stacks/types';
|
import { ChatsStackParamList } from '../stacks/types';
|
||||||
import sharedStyles from './Styles';
|
import sharedStyles from './Styles';
|
||||||
|
|
||||||
|
@ -42,41 +42,6 @@ const styles = StyleSheet.create({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
interface ITitle {
|
|
||||||
title: string;
|
|
||||||
theme: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IInputs {
|
|
||||||
livechatData: {
|
|
||||||
[key: string]: any;
|
|
||||||
};
|
|
||||||
name: string;
|
|
||||||
email: string;
|
|
||||||
phone?: string;
|
|
||||||
topic: string;
|
|
||||||
tag: string[];
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
type TParams = ILivechatVisitor & IInputs;
|
|
||||||
|
|
||||||
interface ILivechat extends ISubscription {
|
|
||||||
// Param dynamic depends on server
|
|
||||||
sms?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IInputsRefs {
|
|
||||||
[index: string]: RNTextInput | null;
|
|
||||||
name: RNTextInput | null;
|
|
||||||
phone: RNTextInput | null;
|
|
||||||
topic: RNTextInput | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ICustomFields {
|
|
||||||
visitor?: { [key: string]: string };
|
|
||||||
livechat?: { [key: string]: string };
|
|
||||||
}
|
|
||||||
interface ILivechatEditViewProps {
|
interface ILivechatEditViewProps {
|
||||||
// TODO: Refactor when migrate models
|
// TODO: Refactor when migrate models
|
||||||
user: any;
|
user: any;
|
||||||
|
|
Loading…
Reference in New Issue