Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with master to get latest update #9750

Merged
merged 41 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
440be0a
translations: 📚 sync translations with crowdin (#9672)
github-actions[bot] Aug 15, 2023
cfacd85
chore: translation workflow trigger (#9684)
prince-deriv Aug 15, 2023
bd70a37
Revert "chore: translation workflow trigger (#9684)" (#9686)
sandeep-deriv Aug 15, 2023
3196e06
Kate / WEBREL-51 / Test coverage: ProgressSliderStream in Trader pack…
kate-deriv Aug 15, 2023
c31777a
Kate / Test coverage: ChartLoader + Loading in Trader package (#8398)
kate-deriv Aug 15, 2023
62fc7ee
likhith/fix: :bug: display onfido error message (#9401)
likhith-deriv Aug 15, 2023
ba2e6fd
Henry/fix: test coverage and ts migration for asset/trading/categorie…
henry-deriv Aug 15, 2023
8b90802
Matin/WALL-1308/Adding Korean language (#9426)
matin-deriv Aug 15, 2023
3133e6f
Amina/fix: disable account when proof failed (#9555)
amina-deriv Aug 15, 2023
ea0d9cc
fix: duplicate_types (#9691)
amina-deriv Aug 15, 2023
9d4ba1d
likhith/fix: :bug: translation of IDV documents dropdown option (#9336)
likhith-deriv Aug 15, 2023
62b9ac2
maryia/DTRA-350/feat: handle displayed positions locally in TogglePos…
maryia-deriv Aug 15, 2023
84b6778
FarhanNurzi/P2PS-1417/2FA order confirm modal is not showing up on mo…
farhan-nurzi-deriv Aug 15, 2023
f024924
Adrienne / Implemented new navigation flow for filtering payment meth…
adrienne-deriv Aug 15, 2023
b86a254
Amina/wall 575/maintenance notifications for site and cashier (#9064)
amina-deriv Aug 15, 2023
44319aa
Shaheer/wall 1229 (#9240)
shaheer-deriv Aug 15, 2023
f85083c
Kate / OPT-306 / Update Accumulator to Accumulators (#9577)
kate-deriv Aug 15, 2023
ea42eda
Kate / Add video for Vanillas description (#9622)
kate-deriv Aug 15, 2023
0107135
likhith/chore: incorporated the API response to save the opt-out user…
likhith-deriv Aug 15, 2023
2fbc0af
translations: 📚 sync translations with crowdin (#9702)
github-actions[bot] Aug 15, 2023
2a67dbd
Matin / Remove ESLint Ignore (#9707)
matin-deriv Aug 16, 2023
aba9a9f
translations: 📚 sync translations with crowdin (#9709)
github-actions[bot] Aug 16, 2023
858661c
fix: set dbot as external in platform config for authorize logout iss…
shafin-deriv Aug 16, 2023
13426cc
feat: transaction details modal (#9032)
shafin-deriv Aug 16, 2023
a4b0926
fix: gtm issue (#9551)
shafin-deriv Aug 16, 2023
d1ec19f
fix: registration flow in buy/sell tab (#9573)
nada-deriv Aug 16, 2023
0377e58
Farzin/WALL-460/DepositCrypto module (#8867)
farzin-deriv Aug 16, 2023
3d48bec
fix: fix quick add modal's height bug (#8574)
farhan-nurzi-deriv Aug 16, 2023
c5d47d9
Farabi/bot 296/update responsive of tour in light mode (#9315)
farabi-deriv Aug 16, 2023
c71ffd0
Maryia/Bot-303/feat: add crash/boom to markets list (#9098)
maryia-matskevich-deriv Aug 16, 2023
53e6215
Kate / DTRA-166 / Implement Contract pages for Ends/ Stays contracts …
kate-deriv Aug 16, 2023
72aa799
Henry/dtra 282/rewrite contract type info component (#9352)
henry-deriv Aug 16, 2023
06fa325
farabi/bot-228/fix-step-5-modal-alignment (#9377)
farabi-deriv Aug 16, 2023
339b676
Niloofar Sadeghi / useP2PAdvertList custom hook (#9704)
niloofar-deriv Aug 16, 2023
baae193
chore: test case for dbot-providers (#9583)
shafin-deriv Aug 16, 2023
ea8565a
henry/test: add test coverage and ts migration for successdialog (#8432)
henry-deriv Aug 16, 2023
2a72c07
test: :white_check_mark: add test case for Audio component (#9572)
vinu-deriv Aug 16, 2023
736c061
translations: 📚 sync translations with crowdin (#9730)
github-actions[bot] Aug 16, 2023
7885480
chore: fixed orders failing test case (#9735)
ameerul-deriv Aug 17, 2023
ae067f2
translations: 📚 sync translations with crowdin (#9741)
github-actions[bot] Aug 17, 2023
810081f
chore: update code owners (#9678)
maryia-deriv Aug 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
# deriv-app/account
# ==============================================================

/packages/account/**/* @matin-deriv @amina-deriv
/packages/account/**/* @matin-deriv @amina-deriv @maryia-deriv


# ==============================================================
Expand Down Expand Up @@ -118,13 +118,13 @@
# ==============================================================

/packages/api/**/* @ali-hosseini-deriv @matin-deriv
/packages/core/**/* @ali-hosseini-deriv @matin-deriv
/packages/shared/**/* @ali-hosseini-deriv @matin-deriv
/packages/components/**/* @ali-hosseini-deriv @matin-deriv
/packages/translations/**/* @ali-hosseini-deriv @matin-deriv
/packages/utils/**/* @ali-hosseini-deriv @matin-deriv
/packages/core/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv
/packages/shared/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv
/packages/components/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv
/packages/translations/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv
/packages/utils/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv
/packages/hooks/**/* @ali-hosseini-deriv @matin-deriv
/packages/stores/**/* @ali-hosseini-deriv @matin-deriv
/packages/stores/**/* @ali-hosseini-deriv @matin-deriv @maryia-deriv


# ==============================================================
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
},
"dependencies": {
"@binary-com/binary-document-uploader": "^2.4.8",
"@deriv/api-types": "^1.0.94",
"@deriv/api-types": "^1.0.116",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@deriv/shared": "^1.0.0",
"@deriv/stores":"^1.0.0",
"@deriv/stores": "^1.0.0",
"@deriv/translations": "^1.0.0",
"bowser": "^2.9.0",
"classnames": "^2.2.6",
Expand Down
3 changes: 3 additions & 0 deletions packages/account/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ const App = ({ passthrough }: TAppProps) => {
const { root_store, WS } = passthrough;
setWebsocket(WS);

const { notification_messages_ui: Notifications } = root_store.ui;

return (
<StoreProvider store={root_store}>
{Notifications && <Notifications />}
<Routes />
<ResetTradingPassword />
</StoreProvider>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from 'prop-types';
import * as React from 'react';
import { StaticUrl } from '@deriv/components';
import { Localize, localize } from '@deriv/translations';
Expand Down Expand Up @@ -29,8 +28,4 @@ const AccountLimitsArticle = ({ is_from_derivgo }: TAccountLimitsArticle) => {
return <AccountArticle title={localize('Account limits')} descriptions={getDescription()} />;
};

AccountLimitsArticle.propTypes = {
is_from_derivgo: PropTypes.bool,
};

export default AccountLimitsArticle;
40 changes: 9 additions & 31 deletions packages/account/src/Components/forms/idv-form.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
import React from 'react';
import classNames from 'classnames';
import { Field, FormikProps, FormikHandlers, FieldProps } from 'formik';
import { ResidenceList } from '@deriv/api-types';
import { Field, FieldProps } from 'formik';
import { localize } from '@deriv/translations';
import { formatInput, IDV_NOT_APPLICABLE_OPTION } from '@deriv/shared';
import { formatInput, getIDVNotApplicableOption } from '@deriv/shared';
import { Autocomplete, DesktopWrapper, Input, MobileWrapper, SelectNative, Text } from '@deriv/components';
import { getDocumentData, preventEmptyClipboardPaste, generatePlaceholderText, getExampleFormat } from 'Helpers/utils';

type TDocumentList = Array<{
id: string;
text: string;
value?: string;
sample_image?: string;
example_format?: string;
additional?: any;
}>;

type TFormProps = {
document_type: TDocumentList[0];
document_number: string;
document_additional?: string;
error_message?: string;
};

type TIDVForm = {
selected_country: ResidenceList[0];
hide_hint?: boolean;
class_name?: string;
can_skip_document_verification: boolean;
} & Partial<FormikHandlers> &
FormikProps<TFormProps>;
import { TDocumentList, TIDVForm } from 'Types';

const IDVForm = ({
errors,
Expand All @@ -43,7 +19,7 @@ const IDVForm = ({
hide_hint,
can_skip_document_verification = false,
}: TIDVForm) => {
const [document_list, setDocumentList] = React.useState<TDocumentList>([]);
const [document_list, setDocumentList] = React.useState<TDocumentList[]>([]);
const [document_image, setDocumentImage] = React.useState<string | null>(null);
const [selected_doc, setSelectedDoc] = React.useState('');

Expand All @@ -57,6 +33,8 @@ const IDVForm = ({
sample_image: '',
};

const IDV_NOT_APPLICABLE_OPTION = React.useMemo(() => getIDVNotApplicableOption(), []);

React.useEffect(() => {
if (document_data && selected_country && selected_country.value) {
const document_types = Object.keys(document_data);
Expand Down Expand Up @@ -100,7 +78,7 @@ const IDVForm = ({
setDocumentList([...new_document_list]);
}
}
}, [document_data, selected_country, can_skip_document_verification]);
}, [document_data, selected_country, can_skip_document_verification, IDV_NOT_APPLICABLE_OPTION]);

const resetDocumentItemSelected = () => {
setFieldValue('document_type', default_document, true);
Expand All @@ -120,7 +98,7 @@ const IDVForm = ({
setFieldValue(document_name, current_input, true);
};

const bindDocumentData = (item: TDocumentList[0]) => {
const bindDocumentData = (item: TDocumentList) => {
setFieldValue('document_type', item, true);
setSelectedDoc(item?.id);
if (item?.id === IDV_NOT_APPLICABLE_OPTION.id) {
Expand Down Expand Up @@ -171,7 +149,7 @@ const IDVForm = ({
}
}}
onChange={handleChange}
onItemSelection={(item: TDocumentList[0]) => {
onItemSelection={(item: TDocumentList) => {
if (
item.text === 'No results found' ||
!item.text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
isDesktop,
isMobile,
PlatformContext,
IDV_NOT_APPLICABLE_OPTION,
getIDVNotApplicableOption,
removeEmptyPropertiesFromObject,
} from '@deriv/shared';
import { localize, Localize } from '@deriv/translations';
Expand Down Expand Up @@ -83,6 +83,7 @@ const PersonalDetails = ({
residence_list,
real_account_signup_target,
});
const IDV_NOT_APPLICABLE_OPTION = React.useMemo(() => getIDVNotApplicableOption(), []);

const validateIDV = values => {
const errors = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Button } from '@deriv/components';
import { Formik } from 'formik';
import { localize } from '@deriv/translations';
import {
WS,
IDV_NOT_APPLICABLE_OPTION,
getIDVNotApplicableOption,
toMoment,
filterObjProperties,
isDesktop,
removeEmptyPropertiesFromObject,
formatIDVFormValues,
} from '@deriv/shared';
import { documentAdditionalError, getRegex, validate, makeSettingsRequest, validateName } from 'Helpers/utils';
import FormFooter from 'Components/form-footer';
import BackButtonIcon from 'Assets/ic-poi-back-btn.svg';
import IDVForm from 'Components/forms/idv-form';
import PersonalDetailsForm from 'Components/forms/personal-details-form';
import FormSubHeader from 'Components/form-sub-header';
import { GetSettings, IdentityVerificationAddDocumentResponse, ResidenceList } from '@deriv/api-types';
import { TIDVFormValues, TInputFieldValues, TDocumentList } from 'Types';

type TIDVDocumentSubmitProps = {
account_settings: GetSettings;
getChangeableFields: () => Array<string>;
handleBack: React.MouseEventHandler;
handleViewComplete: () => void;
is_from_external: boolean;
selected_country: ResidenceList[0];
};

const IdvDocumentSubmit = ({
handleBack,
Expand All @@ -26,7 +37,7 @@ const IdvDocumentSubmit = ({
is_from_external,
account_settings,
getChangeableFields,
}) => {
}: TIDVDocumentSubmitProps) => {
const visible_settings = ['first_name', 'last_name', 'date_of_birth'];
const form_initial_values = filterObjProperties(account_settings, visible_settings) || {};

Expand All @@ -48,28 +59,29 @@ const IdvDocumentSubmit = ({
...form_initial_values,
};

const getExampleFormat = example_format => {
const getExampleFormat = (example_format: string) => {
return example_format ? localize('Example: ') + example_format : '';
};
const IDV_NOT_APPLICABLE_OPTION = React.useMemo(() => getIDVNotApplicableOption(), []);

const shouldHideHelperImage = document_id => document_id === IDV_NOT_APPLICABLE_OPTION.id;
const shouldHideHelperImage = (document_id: string) => document_id === IDV_NOT_APPLICABLE_OPTION.id;

const isDocumentTypeValid = document_type => {
const isDocumentTypeValid = (document_type: TDocumentList) => {
if (!document_type?.text) {
return localize('Please select a document type.');
}
return undefined;
};

const isAdditionalDocumentValid = (document_type, document_additional) => {
const isAdditionalDocumentValid = (document_type: TDocumentList, document_additional: string) => {
const error_message = documentAdditionalError(document_additional, document_type.additional?.format);
if (error_message) {
return localize(error_message) + getExampleFormat(document_type.additional?.example_format);
}
return undefined;
};

const isDocumentNumberValid = (document_number, document_type) => {
const isDocumentNumberValid = (document_number: string, document_type: Required<TDocumentList>) => {
const is_document_number_invalid = document_number === document_type.example_format;
if (!document_number) {
return localize('Please enter your document number. ') + getExampleFormat(document_type.example_format);
Expand All @@ -83,8 +95,8 @@ const IdvDocumentSubmit = ({
return undefined;
};

const validateFields = values => {
const errors = {};
const validateFields = (values: TIDVFormValues) => {
const errors: Partial<TInputFieldValues> = {};
const { document_type, document_number, document_additional } = values;
const needs_additional_document = !!document_type.additional;

Expand Down Expand Up @@ -127,25 +139,22 @@ const IdvDocumentSubmit = ({
setSubmitting(false);
return;
}

const submit_data = {
identity_verification_document_add: 1,
document_number: values.document_number,
document_additional: values.document_additional || '',
document_type: values.document_type.id,
issuing_country: selected_country.value,
...formatIDVFormValues(values, selected_country.value),
};

if (submit_data.document_type === IDV_NOT_APPLICABLE_OPTION.id) {
return;
}
WS.send(submit_data).then(response => {
setSubmitting(false);
if (response.error) {
setErrors({ error_message: response.error.message });
return;
WS.send(submit_data).then(
(response: IdentityVerificationAddDocumentResponse & { error: { message: string } }) => {
setSubmitting(false);
if (response.error) {
setErrors({ error_message: response.error.message });
return;
}
handleViewComplete();
}
handleViewComplete();
});
);
};

return (
Expand Down Expand Up @@ -225,13 +234,4 @@ const IdvDocumentSubmit = ({
);
};

IdvDocumentSubmit.propTypes = {
account_settings: PropTypes.object,
getChangeableFields: PropTypes.func,
handleBack: PropTypes.func,
handleViewComplete: PropTypes.func,
is_from_external: PropTypes.bool,
selected_country: PropTypes.object,
};

export default IdvDocumentSubmit;
Loading
Loading