From 84f2afab6714123b0cb6c65a6ea119ca8db7cfcb Mon Sep 17 00:00:00 2001 From: Niloofar Sadeghi <93518187+niloofar-deriv@users.noreply.github.com> Date: Tue, 2 May 2023 12:36:27 +0330 Subject: [PATCH] Niloofar Sadeghi | components and shared ts migration [parent branch] (#7307) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: ts migration for test case * chore: remove .jsx * refactor: ts migration for account limits article and tests * chore: remove all .jsx * refactor: ts migration for account-limit-overlay * chore: remove .jsx from files * chore: update to use React.ComponentProps * chore: change test case format * refactor: ts migration for self-exclusion-article * refactor: ts migration for self-excllusiono-wrapper * chore: remove .jsx * Revert "fix: :bug: resolved issue with trade. odal (#7291)" (#7364) This reverts commit b6f7e4c91b463c0e5c9431e101d4e3734671e632. * refactor: ts migration for account-limits.js * Farzin/85054/Call `resetWithrawForm` on `CryptoWithdrawForm` component `onunmount` (#7331) * fix(cashier): :bug: call `resetWithrawForm` on `CryptoWithdrawForm` component `onunmount` * test(cashier): :white_check_mark: fix failing test Co-authored-by: Farzin Mirzaie * refactor: ts migration for self-exclusion-modal * Niloofar Sadeghi / Task - Refactor tests in the language.spec.js file (#7325) * refactor: language tests * fix: typo Co-authored-by: Niloofar Sadeghi * refactor: proposal tests (#7327) Co-authored-by: Niloofar Sadeghi * Niloofar Sadeghi / Task - Refactor tests in the error.spec.js file (#7324) * refactor: errors validator tests * fix: typo Co-authored-by: Niloofar Sadeghi * Niloofar Sadeghi / Task - Refactor tests in the binary-link.spec.tsx file (#7288) * refactor: binary-link tests * refactor: improve testids namings Co-authored-by: Niloofar Sadeghi * refactor: money tests (#7353) * refactor: toggle-positions tests (#7287) Co-authored-by: Niloofar Sadeghi * refactor: toggle-button tests (#7328) Co-authored-by: Niloofar Sadeghi * Niloofar Sadeghi / Task - Refactor tests in the toggle-button-group.spec.tsx file (#7330) * refactor: toggle-button-group tests * fix: test issue Co-authored-by: Niloofar Sadeghi * refactor: open-positions-table tests (#7374) * Niloofar Sadeghi / Task - Refactor tests in the marker-spot-label.spec.tsx file (#7355) * refactor: remove extra files from reports * refactor: marker-spot-label tests * Niloofar Sadeghi / Task - Refactor tests in the binary-link.spec.tsx file (#7286) * refactor: binary-link tests * test: added more tests Co-authored-by: Niloofar Sadeghi * Niloofar Sadeghi / Task - Refactor tests in the contract-type-dialog.spec.tsx file (#7285) * refactor: contract-type-dialog tests * test: added more tests * fix: circle/ci issue Co-authored-by: Niloofar Sadeghi * Niloofar Sadeghi / Task - Refactor tests in the platform-dropdown.spec.tsx file (#7282) * refactor: platform-dropdown tests * refactor: improve testids namings Co-authored-by: Niloofar Sadeghi * Farzin/76563/Replace `DepositStore` with hooks (#7180) * refactor(cashier): :fire: remove `is_deposit_locked` from `DepositStore` * refactor(cashier): :fire: remove `submitFundsProtection` from `DepositStore` * fix(cashier): :green_heart: fix CI build * fix(cashier): :green_heart: fix CI build * test(hooks): :white_check_mark: add more test cases for `useDepositLocked` hook Co-authored-by: Farzin Mirzaie * Adrienne / Github actions Lighthouse report workflow (#7317) * chore: added checks to job to run only on pull requests * chore: fixed issues with testing * chore: testing github actions running on local branch * chore: added workflow_dispatch event to test out manually * chore: added workflow_dispatch event to test out manually * chore: added workflow_dispatch event to test out manually * chore: fix typo * chore: fix issue where lighthouse config file is not found * chore: fix issue where lighthouse config file is not found * chore: test with hardcoded url * chore: test with updated permissions * chore: reverted changes due to lack of token permission * chore: reverted changes due to lack of token permission * chore: added progress comment * chore: added progress comment * chore: test * chore: reverted test * chore: reverted test * chore: commented config path for lighthouse assertions * chore: fixed syntax on like 38 where it expects a string instead of mapping * translations: 📚 sync translations with crowdin (#7361) Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> * feat: change file extension * refactor: dropdownlist component ts migration * fix: ref types * fix: group types * fix: review comments * build: add alias to react-virtualized to bind it to its community types * build: remove specific usage of react-virtualized type * chore: remove manual type declaration for react-virtualized * chore: change usage of react-virtualized to work with alias * fix: review comments * fix: review comments * refactor: migrate calendar component to typescript * chore: remove unnecessary check for undefined * refactor: input with checkbox ts migration * refactor: update fragment * refactor: input with checkbox ts migration * refactor: migrate to typescript * refactor: remove manual type insertion * refactor: rename decade to years * fix: fix rowHeight issue * refactor: input with checkbox ts migration * feat: migrate data-list-cell to typescript * feat: migrate data-list-row to typescript * feat: export RowRenderPropType type * refactor: input with checkbox ts migration * feat: update autosizer import path * feat: remove file extension from import statement Co-authored-by: Niloofar Sadeghi <93518187+niloofar-deriv@users.noreply.github.com> * feat: update CellMeasurer import path * feat: update MeasuredCellParent import path * feat: update List import path * feat: update List import path * refactor: migrate contract-card to ts * refactor: input with checkbox ts migration * ci: update List import path * chore: update type declaration to use union instead of intersection * chore: remove unnecessary export * refactor: ts migration for self exclusion confirm page and tests * chore: remove .jsx from files * refactor: ts migration for self exclusion form and test * chore: remove .jsx * refactor: input with checkbox ts migration * refactor: resolve type mismatches * refactor: dropdown component ts migration * Update packages/components/src/components/data-list/data-list-cell.tsx chore: update type name Co-authored-by: Niloofar Sadeghi <93518187+niloofar-deriv@users.noreply.github.com> * feat: update type names * feat: update index file extenstion to ts * feat: update measure return type * feat: update destination link return type * feat: update measure to be optional * chore: update CellType usage * chore: remove redundant CELL assignment * fix: nodes type * refactor: ts migration for self-exclusion-inputs * build: update package-lock.json * feat: update types and usages * feat: update wrong prop(className) * fix: circle/ci issue * fix: circle/ci issue * fix: circle/ci issue * fix: circle/ci issue * feat: add generic types * feat: update data source type * build: add @types/classnames * build: update package-lock.json * feat: add optional changing instead of if condition * feat: disable eslint error * feat: remove generic types and use static types instead * refactor: ts migration for self-exclusion * refactor: ts migration for self-exclusion * chore: edited code based on commits * chore: resolve conflicts * refactor: evgeniy/76943/verticaltab ts migration * refactor: ts migration for address details and test * Merge branch 'develop' of github.com:binary-com/deriv-app into niloo/84471/ts-migration-parent * chore: edited based on comments * refactor: setSelectedIndex props types fix * refactor: side notes array is set incorrectly * refactor: review suggestion implementation * refactor: exclamation mark replacing * fix: dropdown issue * fix: review comment * fix: circle/ci issue * fix: circle/ci issue * fix: conflicts * chore: update sorting for derived_ordered * chore: update code to be same as in production * fix: security issue * fix: sonar issues * fix: dropdown issue * build: Trigger Build * fix: ts errors * fix: circle/ci issue * fix: circle/ci issue * fix: vercel failed * fix: vercel failed * fix: vercel failed * test: git guard * fix: git guard * fix: review comments --------- Co-authored-by: tay suisin Co-authored-by: Farrah Mae Ochoa Co-authored-by: Matin shafiei Co-authored-by: Farzin Mirzaie <72082844+farzin-deriv@users.noreply.github.com> Co-authored-by: Farzin Mirzaie Co-authored-by: Niloofar Sadeghi Co-authored-by: adrienne-deriv <103016120+adrienne-deriv@users.noreply.github.com> Co-authored-by: Jim Daniels Wasswa <104334373+jim-deriv@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: DerivFE <80095553+DerivFE@users.noreply.github.com> Co-authored-by: Ako Co-authored-by: Jim Daniels Wasswa Co-authored-by: yaswanth-deriv <121096908+yaswanth-deriv@users.noreply.github.com> Co-authored-by: “yauheni-kryzhyk-deriv” <“yauheni@deriv.me”> --- package-lock.json | 459 ++++++++---------- packages/account/global.d.ts | 1 - .../Routes/__tests__/binary-link.spec.tsx | 8 +- .../Routes/__tests__/binary-routes.spec.tsx | 2 +- .../src/Components/Routes/binary-link.tsx | 3 +- .../src/Components/Routes/binary-routes.tsx | 4 +- ...spec.js => account-limit-overlay.spec.tsx} | 11 +- ...pec.js => account-limits-article.spec.tsx} | 2 +- ...limits.spec.js => account-limits.spec.tsx} | 91 ++-- ...article.jsx => account-limits-article.tsx} | 6 +- .../account-limits/account-limits-context.tsx | 9 +- ...overlay.jsx => account-limits-overlay.tsx} | 0 .../account-limits-turnover-limit-row.tsx | 8 +- ...{account-limits.jsx => account-limits.tsx} | 83 ++-- .../src/Components/account-limits/index.js | 3 - .../src/Components/account-limits/index.ts | 3 + ...tails.spec.js => address-details.spec.tsx} | 51 +- ...ddress-details.jsx => address-details.tsx} | 90 +++- .../src/Components/address-details/index.js | 2 +- .../__tests__/currency-selector.spec.tsx | 2 +- .../currency-selector/currency-selector.tsx | 41 +- .../currency-selector/radio-button-group.tsx | 2 +- .../form-body-section/form-body-section.tsx | 4 +- .../Components/form-footer/form-footer.tsx | 4 +- .../icon-with-message/icon-with-message.tsx | 3 +- .../leave-confirm/leave-confirm.tsx | 4 +- .../poa/status/submitted/submitted.tsx | 4 +- .../poa/status/unverified/unverified.tsx | 4 +- .../poa/status/verified/verified.tsx | 4 +- .../missing-personal-details.spec.tsx | 4 +- ....spec.js => poi-country-selector.spec.tsx} | 17 +- .../poi/poi-country-selector/index.js | 2 +- ...-selector.jsx => poi-country-selector.tsx} | 51 +- ...ignup.jsx => idv-doc-submit-on-signup.tsx} | 72 ++- .../idv-doc-submit-on-signup/index.js | 2 +- .../poi/poi-form-on-signup/index.js | 2 +- ...m-on-signup.jsx => poi-form-on-signup.tsx} | 34 +- ... => reset-trading-password-modal.spec.tsx} | 6 +- ...l.jsx => reset-trading-password-modal.tsx} | 49 +- ...> self-exclusion-article-content.spec.tsx} | 17 +- ...pec.js => self-exclusion-article.spec.tsx} | 39 +- ...s => self-exclusion-confirm-page.spec.tsx} | 38 +- ...m.spec.js => self-exclusion-form.spec.tsx} | 24 +- ...spec.js => self-exclusion-inputs.spec.tsx} | 133 +++-- ....spec.js => self-exclusion-modal.spec.tsx} | 14 +- ...pec.js => self-exclusion-wrapper.spec.tsx} | 49 +- ...lusion.spec.js => self-exclusion.spec.tsx} | 123 +++-- .../src/Components/self-exclusion/index.js | 2 +- ...jsx => self-exclusion-article-content.tsx} | 18 +- ...article.jsx => self-exclusion-article.tsx} | 2 +- ...ge.jsx => self-exclusion-confirm-page.tsx} | 12 +- .../self-exclusion/self-exclusion-context.js | 5 - .../self-exclusion/self-exclusion-context.tsx | 35 ++ ...usion-form.jsx => self-exclusion-form.tsx} | 10 +- ...n-inputs.jsx => self-exclusion-inputs.tsx} | 110 +++-- ...ion-modal.jsx => self-exclusion-modal.tsx} | 6 +- ...wrapper.jsx => self-exclusion-wrapper.tsx} | 12 +- ...{self-exclusion.jsx => self-exclusion.tsx} | 201 +++++--- packages/account/src/Containers/account.jsx | 27 -- .../Security/AccountLimits/account-limits.jsx | 2 +- .../Sections/Security/AccountLimits/index.js | 2 +- .../Security/Passwords/deriv-password.jsx | 8 +- .../Security/Passwords/passwords-platform.jsx | 4 +- .../Sections/Security/SelfExclusion/index.js | 2 +- .../Security/SelfExclusion/self-exclusion.jsx | 2 +- .../proof-of-identity-submission-for-mt5.jsx | 2 +- .../account/src/Types/common-prop.type.ts | 4 - packages/account/src/Types/context.type.ts | 5 - .../src/components/self-exclusion/index.js | 2 +- .../src/containers/cashier/cashier.tsx | 4 +- packages/cashier/src/types/routes.types.ts | 7 +- packages/components/package.json | 5 +- .../auto-height-wrapper.tsx | 16 +- .../components/auto-height-wrapper/index.ts | 3 +- .../components/autocomplete/autocomplete.jsx | 4 +- .../src/components/autosizer/AutoSizer.d.ts | 14 - .../src/components/autosizer/index.ts | 5 +- .../src/components/calendar/calendar-body.jsx | 20 - .../src/components/calendar/calendar-body.tsx | 32 ++ ...alendar-button.jsx => calendar-button.tsx} | 37 +- ...alendar-footer.jsx => calendar-footer.tsx} | 31 +- ...alendar-header.jsx => calendar-header.tsx} | 33 +- .../calendar/{calendar.jsx => calendar.tsx} | 127 ++--- .../components/calendar/helpers/constants.js | 47 -- .../components/calendar/helpers/constants.ts | 115 +++++ .../calendar/helpers/{index.js => index.ts} | 0 .../calendar/{index.js => index.ts} | 2 +- .../{calendar-days.jsx => calendar-days.tsx} | 56 +-- ...endar-decades.jsx => calendar-decades.tsx} | 12 +- ...alendar-months.jsx => calendar-months.tsx} | 4 +- ...{calendar-years.jsx => calendar-years.tsx} | 6 +- .../src/components/calendar/views/index.js | 3 - .../src/components/calendar/views/index.ts | 3 + .../src/components/calendar/views/types.js | 8 - .../src/components/calendar/views/types.ts | 6 + .../src/components/calendar/views/views.jsx | 14 - .../src/components/calendar/views/views.tsx | 14 + .../composite-checkbox/composite-checkbox.tsx | 3 +- .../accumulator-card-body.jsx | 6 +- ...t-card-body.jsx => contract-card-body.tsx} | 91 ++-- .../contract-card-dialog.jsx | 54 --- .../contract-card-dialog.tsx | 59 +++ ...rd-footer.jsx => contract-card-footer.tsx} | 38 +- ...rd-header.jsx => contract-card-header.tsx} | 45 +- ...t-card-item.jsx => contract-card-item.tsx} | 27 +- .../contract-card-sell.jsx | 50 -- .../contract-card-sell.tsx | 44 ++ ...t-type-cell.jsx => contract-type-cell.tsx} | 26 +- ...date-form.jsx => contract-update-form.tsx} | 69 +-- .../multiplier-card-body.jsx | 4 +- ...tions.jsx => multiplier-close-actions.tsx} | 29 +- ...card-dialog.jsx => toggle-card-dialog.tsx} | 61 +-- .../vanilla-options-card-body.jsx | 4 +- ...rd-loader.jsx => contract-card-loader.tsx} | 7 +- .../contract-card-loader/index.js | 3 - .../contract-card-loader/index.ts | 3 + .../{contract-card.jsx => contract-card.tsx} | 46 +- .../contract-card/{index.js => index.ts} | 2 +- .../result-overlay/{index.js => index.ts} | 2 +- ...{result-overlay.jsx => result-overlay.tsx} | 38 +- ...{data-list-cell.jsx => data-list-cell.tsx} | 35 +- .../{data-list-row.jsx => data-list-row.tsx} | 30 +- .../src/components/data-list/data-list.jsx | 204 -------- .../src/components/data-list/data-list.tsx | 239 +++++++++ .../src/components/data-list/index.js | 7 - .../src/components/data-list/index.ts | 4 + .../src/components/data-table/data-table.jsx | 4 +- .../src/components/dialog/dialog.tsx | 2 +- .../{dropdown-list.jsx => dropdown-list.tsx} | 88 ++-- .../dropdown-list/{index.js => index.ts} | 2 +- .../{display-text.jsx => display-text.tsx} | 36 +- .../src/components/dropdown/dropdown.js | 41 -- .../dropdown/{dropdown.jsx => dropdown.tsx} | 166 ++++--- .../dropdown/{index.js => index.ts} | 2 +- .../dropdown/{items.jsx => items.tsx} | 61 ++- .../src/components/dropdown/native-select.jsx | 38 -- .../src/components/dropdown/utility.ts | 45 ++ .../filter-dropdown/filter-dropdown.jsx | 2 +- .../infinite-data-list/infinite-data-list.jsx | 4 +- .../input-wth-checkbox/{index.js => index.ts} | 2 +- ...h-checkbox.jsx => input-with-checkbox.tsx} | 88 ++-- .../components/src/components/input/index.ts | 3 +- .../components/src/components/input/input.tsx | 2 +- .../mobile-full-page-modal.tsx | 6 +- .../password-input/{index.js => index.ts} | 2 +- ...{password-input.jsx => password-input.tsx} | 17 +- .../popover-message-checkbox.tsx | 2 +- .../components/popup/{index.js => index.ts} | 2 +- .../popup/{popup-body.jsx => popup-body.tsx} | 10 +- .../src/components/popup/popup-context.js | 5 - .../src/components/popup/popup-context.tsx | 56 +++ .../{popup-footer.jsx => popup-footer.tsx} | 12 +- .../{popup-header.jsx => popup-header.tsx} | 2 +- ...tainer.jsx => popup-overlay-container.tsx} | 11 +- .../{popup-overlay.jsx => popup-overlay.tsx} | 22 +- .../components/popup/{popup.jsx => popup.tsx} | 49 +- .../{index.js => index.ts} | 2 +- ...-mobile.jsx => progress-slider-mobile.tsx} | 30 +- ...s-mobile.jsx => progress-ticks-mobile.tsx} | 16 +- .../progress-slider/progress-slider.tsx | 13 +- .../progress-slider/progress-ticks.tsx | 7 +- .../select-native/select-native.tsx | 2 +- .../send-email-template.tsx | 2 +- .../src/components/static-url/index.js | 3 - .../src/components/static-url/index.ts | 3 + .../{static-url.jsx => static-url.tsx} | 10 +- .../components/src/components/tabs/tab.tsx | 8 +- .../components/src/components/tabs/tabs.tsx | 20 +- .../themed-scrollbars/themed-scrollbars.tsx | 2 +- .../tick-progress/tick-progress.tsx | 4 +- .../src/components/types/common.types.ts | 4 + .../src/components/types/contract.types.ts | 14 + .../components/src/components/types/index.ts | 7 + .../vertical-tab/{index.js => index.ts} | 2 +- ...jsx => vertical-tab-content-container.tsx} | 62 ++- ...roup.jsx => vertical-tab-header-group.tsx} | 23 +- ...itle.jsx => vertical-tab-header-title.tsx} | 4 +- ...tab-header.jsx => vertical-tab-header.tsx} | 49 +- ...b-headers.jsx => vertical-tab-headers.tsx} | 53 +- ...tab-layout.jsx => vertical-tab-layout.tsx} | 6 +- ...b-wrapper.jsx => vertical-tab-wrapper.tsx} | 9 +- .../{vertical-tab.jsx => vertical-tab.tsx} | 130 +++-- .../components/src/hooks/use-blockscroll.ts | 2 +- packages/components/src/index.js | 2 +- .../date-picker/date-picker.stories.js | 2 +- .../vertical-tabs/vertical-tabs.stories.js | 1 - packages/components/tsconfig.json | 9 +- .../src/App/Components/Layout/Footer/index.js | 2 +- .../Layout/Footer/toggle-settings.jsx | 2 +- .../trading-assessment-existing-user.jsx | 2 - .../RealAccountSignup/account-wizard-form.js | 2 +- packages/reports/src/Containers/reports.jsx | 3 - packages/shared/package.json | 1 + .../src/utils/contract/contract-types.ts | 69 +-- .../shared/src/utils/contract/contract.ts | 58 +-- packages/shared/src/utils/date/date-time.ts | 16 +- packages/shared/src/utils/helpers/logic.ts | 10 +- .../src/utils/helpers/validation-rules.ts | 10 +- .../shared/src/utils/location/location.ts | 2 +- .../src/utils/platform/platform-context.tsx | 12 +- packages/shared/src/utils/route/route.ts | 2 +- .../shared/src/utils/string/string_util.ts | 6 +- .../declarative-validation-rules.ts | 2 +- 203 files changed, 3029 insertions(+), 2368 deletions(-) delete mode 100644 packages/account/global.d.ts rename packages/account/src/Components/account-limits/__tests__/{account-limit-overlay.spec.js => account-limit-overlay.spec.tsx} (77%) rename packages/account/src/Components/account-limits/__tests__/{account-limits-article.spec.js => account-limits-article.spec.tsx} (95%) rename packages/account/src/Components/account-limits/__tests__/{account-limits.spec.js => account-limits.spec.tsx} (85%) rename packages/account/src/Components/account-limits/{account-limits-article.jsx => account-limits-article.tsx} (88%) rename packages/account/src/Components/account-limits/{account-limits-overlay.jsx => account-limits-overlay.tsx} (100%) rename packages/account/src/Components/account-limits/{account-limits.jsx => account-limits.tsx} (90%) delete mode 100644 packages/account/src/Components/account-limits/index.js create mode 100644 packages/account/src/Components/account-limits/index.ts rename packages/account/src/Components/address-details/__tests__/{address-details.spec.js => address-details.spec.tsx} (85%) rename packages/account/src/Components/address-details/{address-details.jsx => address-details.tsx} (85%) rename packages/account/src/Components/poi/poi-country-selector/__tests__/{poi-country-selector.spec.js => poi-country-selector.spec.tsx} (85%) rename packages/account/src/Components/poi/poi-country-selector/{poi-country-selector.jsx => poi-country-selector.tsx} (78%) rename packages/account/src/Components/poi/poi-form-on-signup/idv-doc-submit-on-signup/{idv-doc-submit-on-signup.jsx => idv-doc-submit-on-signup.tsx} (91%) rename packages/account/src/Components/poi/poi-form-on-signup/{poi-form-on-signup.jsx => poi-form-on-signup.tsx} (50%) rename packages/account/src/Components/reset-trading-password-modal/__tests__/{reset-trading-password-modal.spec.js => reset-trading-password-modal.spec.tsx} (96%) rename packages/account/src/Components/reset-trading-password-modal/{reset-trading-password-modal.jsx => reset-trading-password-modal.tsx} (89%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-article-content.spec.js => self-exclusion-article-content.spec.tsx} (92%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-article.spec.js => self-exclusion-article.spec.tsx} (81%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-confirm-page.spec.js => self-exclusion-confirm-page.spec.tsx} (83%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-form.spec.js => self-exclusion-form.spec.tsx} (68%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-inputs.spec.js => self-exclusion-inputs.spec.tsx} (66%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-modal.spec.js => self-exclusion-modal.spec.tsx} (58%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion-wrapper.spec.js => self-exclusion-wrapper.spec.tsx} (59%) rename packages/account/src/Components/self-exclusion/__tests__/{self-exclusion.spec.js => self-exclusion.spec.tsx} (64%) rename packages/account/src/Components/self-exclusion/{self-exclusion-article-content.jsx => self-exclusion-article-content.tsx} (95%) rename packages/account/src/Components/self-exclusion/{self-exclusion-article.jsx => self-exclusion-article.tsx} (98%) rename packages/account/src/Components/self-exclusion/{self-exclusion-confirm-page.jsx => self-exclusion-confirm-page.tsx} (93%) delete mode 100644 packages/account/src/Components/self-exclusion/self-exclusion-context.js create mode 100644 packages/account/src/Components/self-exclusion/self-exclusion-context.tsx rename packages/account/src/Components/self-exclusion/{self-exclusion-form.jsx => self-exclusion-form.tsx} (59%) rename packages/account/src/Components/self-exclusion/{self-exclusion-inputs.jsx => self-exclusion-inputs.tsx} (86%) rename packages/account/src/Components/self-exclusion/{self-exclusion-modal.jsx => self-exclusion-modal.tsx} (78%) rename packages/account/src/Components/self-exclusion/{self-exclusion-wrapper.jsx => self-exclusion-wrapper.tsx} (86%) rename packages/account/src/Components/self-exclusion/{self-exclusion.jsx => self-exclusion.tsx} (68%) delete mode 100644 packages/components/src/components/autosizer/AutoSizer.d.ts delete mode 100644 packages/components/src/components/calendar/calendar-body.jsx create mode 100644 packages/components/src/components/calendar/calendar-body.tsx rename packages/components/src/components/calendar/{calendar-button.jsx => calendar-button.tsx} (59%) rename packages/components/src/components/calendar/{calendar-footer.jsx => calendar-footer.tsx} (62%) rename packages/components/src/components/calendar/{calendar-header.jsx => calendar-header.tsx} (88%) rename packages/components/src/components/calendar/{calendar.jsx => calendar.tsx} (65%) delete mode 100644 packages/components/src/components/calendar/helpers/constants.js create mode 100644 packages/components/src/components/calendar/helpers/constants.ts rename packages/components/src/components/calendar/helpers/{index.js => index.ts} (100%) rename packages/components/src/components/calendar/{index.js => index.ts} (57%) rename packages/components/src/components/calendar/views/{calendar-days.jsx => calendar-days.tsx} (87%) rename packages/components/src/components/calendar/views/{calendar-decades.jsx => calendar-decades.tsx} (81%) rename packages/components/src/components/calendar/views/{calendar-months.jsx => calendar-months.tsx} (95%) rename packages/components/src/components/calendar/views/{calendar-years.jsx => calendar-years.tsx} (93%) delete mode 100644 packages/components/src/components/calendar/views/index.js create mode 100644 packages/components/src/components/calendar/views/index.ts delete mode 100644 packages/components/src/components/calendar/views/types.js create mode 100644 packages/components/src/components/calendar/views/types.ts delete mode 100644 packages/components/src/components/calendar/views/views.jsx create mode 100644 packages/components/src/components/calendar/views/views.tsx rename packages/components/src/components/contract-card/contract-card-items/{contract-card-body.jsx => contract-card-body.tsx} (77%) delete mode 100644 packages/components/src/components/contract-card/contract-card-items/contract-card-dialog.jsx create mode 100644 packages/components/src/components/contract-card/contract-card-items/contract-card-dialog.tsx rename packages/components/src/components/contract-card/contract-card-items/{contract-card-footer.jsx => contract-card-footer.tsx} (81%) rename packages/components/src/components/contract-card/contract-card-items/{contract-card-header.jsx => contract-card-header.tsx} (87%) rename packages/components/src/components/contract-card/contract-card-items/{contract-card-item.jsx => contract-card-item.tsx} (61%) delete mode 100644 packages/components/src/components/contract-card/contract-card-items/contract-card-sell.jsx create mode 100644 packages/components/src/components/contract-card/contract-card-items/contract-card-sell.tsx rename packages/components/src/components/contract-card/contract-card-items/{contract-type-cell.jsx => contract-type-cell.tsx} (67%) rename packages/components/src/components/contract-card/contract-card-items/{contract-update-form.jsx => contract-update-form.tsx} (80%) rename packages/components/src/components/contract-card/contract-card-items/{multiplier-close-actions.jsx => multiplier-close-actions.tsx} (76%) rename packages/components/src/components/contract-card/contract-card-items/{toggle-card-dialog.jsx => toggle-card-dialog.tsx} (84%) rename packages/components/src/components/contract-card/contract-card-loader/{contract-card-loader.jsx => contract-card-loader.tsx} (89%) delete mode 100644 packages/components/src/components/contract-card/contract-card-loader/index.js create mode 100644 packages/components/src/components/contract-card/contract-card-loader/index.ts rename packages/components/src/components/contract-card/{contract-card.jsx => contract-card.tsx} (75%) rename packages/components/src/components/contract-card/{index.js => index.ts} (55%) rename packages/components/src/components/contract-card/result-overlay/{index.js => index.ts} (55%) rename packages/components/src/components/contract-card/result-overlay/{result-overlay.jsx => result-overlay.tsx} (82%) rename packages/components/src/components/data-list/{data-list-cell.jsx => data-list-cell.tsx} (58%) rename packages/components/src/components/data-list/{data-list-row.jsx => data-list-row.tsx} (83%) delete mode 100644 packages/components/src/components/data-list/data-list.jsx create mode 100644 packages/components/src/components/data-list/data-list.tsx delete mode 100644 packages/components/src/components/data-list/index.js create mode 100644 packages/components/src/components/data-list/index.ts rename packages/components/src/components/dropdown-list/{dropdown-list.jsx => dropdown-list.tsx} (80%) rename packages/components/src/components/dropdown-list/{index.js => index.ts} (55%) rename packages/components/src/components/dropdown/{display-text.jsx => display-text.tsx} (69%) delete mode 100644 packages/components/src/components/dropdown/dropdown.js rename packages/components/src/components/dropdown/{dropdown.jsx => dropdown.tsx} (81%) rename packages/components/src/components/dropdown/{index.js => index.ts} (65%) rename packages/components/src/components/dropdown/{items.jsx => items.tsx} (62%) delete mode 100644 packages/components/src/components/dropdown/native-select.jsx create mode 100644 packages/components/src/components/dropdown/utility.ts rename packages/components/src/components/input-wth-checkbox/{index.js => index.ts} (54%) rename packages/components/src/components/input-wth-checkbox/{input-with-checkbox.jsx => input-with-checkbox.tsx} (73%) rename packages/components/src/components/password-input/{index.js => index.ts} (55%) rename packages/components/src/components/password-input/{password-input.jsx => password-input.tsx} (86%) rename packages/components/src/components/popup/{index.js => index.ts} (58%) rename packages/components/src/components/popup/{popup-body.jsx => popup-body.tsx} (84%) delete mode 100644 packages/components/src/components/popup/popup-context.js create mode 100644 packages/components/src/components/popup/popup-context.tsx rename packages/components/src/components/popup/{popup-footer.jsx => popup-footer.tsx} (59%) rename packages/components/src/components/popup/{popup-header.jsx => popup-header.tsx} (98%) rename packages/components/src/components/popup/{popup-overlay-container.jsx => popup-overlay-container.tsx} (81%) rename packages/components/src/components/popup/{popup-overlay.jsx => popup-overlay.tsx} (77%) rename packages/components/src/components/popup/{popup.jsx => popup.tsx} (67%) rename packages/components/src/components/progress-slider-mobile/{index.js => index.ts} (54%) rename packages/components/src/components/progress-slider-mobile/{progress-slider-mobile.jsx => progress-slider-mobile.tsx} (75%) rename packages/components/src/components/progress-slider-mobile/{progress-ticks-mobile.jsx => progress-ticks-mobile.tsx} (71%) delete mode 100644 packages/components/src/components/static-url/index.js create mode 100644 packages/components/src/components/static-url/index.ts rename packages/components/src/components/static-url/{static-url.jsx => static-url.tsx} (66%) create mode 100644 packages/components/src/components/types/contract.types.ts rename packages/components/src/components/vertical-tab/{index.js => index.ts} (56%) rename packages/components/src/components/vertical-tab/{vertical-tab-content-container.jsx => vertical-tab-content-container.tsx} (69%) rename packages/components/src/components/vertical-tab/{vertical-tab-header-group.jsx => vertical-tab-header-group.tsx} (81%) rename packages/components/src/components/vertical-tab/{vertical-tab-header-title.jsx => vertical-tab-header-title.tsx} (66%) rename packages/components/src/components/vertical-tab/{vertical-tab-header.jsx => vertical-tab-header.tsx} (66%) rename packages/components/src/components/vertical-tab/{vertical-tab-headers.jsx => vertical-tab-headers.tsx} (74%) rename packages/components/src/components/vertical-tab/{vertical-tab-layout.jsx => vertical-tab-layout.tsx} (61%) rename packages/components/src/components/vertical-tab/{vertical-tab-wrapper.jsx => vertical-tab-wrapper.tsx} (63%) rename packages/components/src/components/vertical-tab/{vertical-tab.jsx => vertical-tab.tsx} (61%) diff --git a/package-lock.json b/package-lock.json index 94226f147f51..62f5aa533227 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "@deriv/deriv-charts": "1.1.9", "@deriv/js-interpreter": "^3.0.0", "@deriv/ui": "^0.6.0", - "@enykeev/react-virtualized": "^9.22.4-mirror.1", "@livechat/customer-sdk": "^2.0.4", "@storybook/addon-actions": "^6.5.10", "@storybook/addon-docs": "^6.5.10", @@ -129,6 +128,7 @@ "react-swipeable": "^6.2.1", "react-tiny-popover": "^7.0.1", "react-transition-group": "4.4.2", + "react-virtualized": "npm:@enykeev/react-virtualized@^9.22.4-mirror.1", "react-window": "^1.8.5", "redux": "^4.0.1", "redux-thunk": "^2.2.0", @@ -2782,20 +2782,20 @@ } }, "node_modules/@datadog/browser-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.39.0.tgz", - "integrity": "sha512-jSwXfdSPaeU9xFLepour7d2jATk/VVcjab69/42gmWkh1MtzDloTd8RaKSVRo0Y7CsHroO6Mdzp+enEivI7NkA==" + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.41.0.tgz", + "integrity": "sha512-7QwALfXt9vEr68xcEmv1XvvpypIH3+WyiVKGPBrmViOQajILMGuDqdKpxRcQAnh6HeWEIjhgtkZkMG7vJcr0oA==" }, "node_modules/@datadog/browser-rum": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.39.0.tgz", - "integrity": "sha512-7owNySSTxWnNbwRjDCC+fHRU2ycWb3lPDGn+VvQE3US+o9MRlEbFesaLO5/3Nj0A+vJGq6Ao35d++eCHl5dw2Q==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.41.0.tgz", + "integrity": "sha512-GY5R02cv0obfkn4C+17avHuWI/O4K5mA9a8WlAOvQzUMJN4hYetDnhlqw08BL9j2mij3MUKLM8JPWgl03gXcpA==", "dependencies": { - "@datadog/browser-core": "4.39.0", - "@datadog/browser-rum-core": "4.39.0" + "@datadog/browser-core": "4.41.0", + "@datadog/browser-rum-core": "4.41.0" }, "peerDependencies": { - "@datadog/browser-logs": "4.39.0" + "@datadog/browser-logs": "4.41.0" }, "peerDependenciesMeta": { "@datadog/browser-logs": { @@ -2804,11 +2804,11 @@ } }, "node_modules/@datadog/browser-rum-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.39.0.tgz", - "integrity": "sha512-UhAEELzt7ZQlAbWSaMJ7Ubwfdxk+uig8xm39iktNyTNCcxN92aNHWsNhsz5FtWXe3Oci7xKSDZf3ccjFl7KABw==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.41.0.tgz", + "integrity": "sha512-TXjg0mIRNobc1L0wDUiTW/MrqsGNQd2qRNJz8DBoJ1E7bmlXGAb8/9cCyFq+vtw94nnB7FIv5iI3CUJRzGPoeA==", "dependencies": { - "@datadog/browser-core": "4.39.0" + "@datadog/browser-core": "4.41.0" } }, "node_modules/@deriv/api-types": { @@ -2945,14 +2945,6 @@ "regenerator-runtime": "^0.13.2" } }, - "node_modules/@devtools-ds/object-inspector/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@devtools-ds/object-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@devtools-ds/object-parser/-/object-parser-1.2.1.tgz", @@ -3017,14 +3009,6 @@ "node": ">=6.9.0" } }, - "node_modules/@devtools-ds/themes/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@devtools-ds/tree": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@devtools-ds/tree/-/tree-1.2.1.tgz", @@ -3046,14 +3030,6 @@ "regenerator-runtime": "^0.13.2" } }, - "node_modules/@devtools-ds/tree/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -3187,23 +3163,6 @@ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" }, - "node_modules/@enykeev/react-virtualized": { - "version": "9.22.4-mirror.1", - "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", - "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "clsx": "^1.0.4", - "dom-helpers": "^5.1.3", - "loose-envify": "^1.4.0", - "prop-types": "^15.7.2", - "react-lifecycles-compat": "^3.0.4" - }, - "peerDependencies": { - "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", - "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "license": "MIT", @@ -7000,9 +6959,9 @@ } }, "node_modules/@onfido/castor-icons": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.16.0.tgz", - "integrity": "sha512-moThxhRXKxoHrsP8hIoCrtecUX8m5Hjk5yozuYTKqA24iBIQpcDe+SDG/m6slDYpT9iSXediCU4hb7XjpHYjSg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.17.0.tgz", + "integrity": "sha512-dY2QNOFrIEqwCXcjNmH7hqz35CDWtBDlPkwbLYfnhK9ZAV7qUs2wcAxGi/FD4Yvi7MNsRBsFKSoT379hBSQcCw==", "peerDependencies": { "react": ">=17 || ^16.14 || ^15.7 || ^0.14.10" } @@ -7666,13 +7625,13 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" }, "node_modules/@sentry-internal/tracing": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.48.0.tgz", - "integrity": "sha512-MFAPDTrvCtfSm0/Zbmx7HA0Q5uCfRadOUpN8Y8rP1ndz+329h2kA3mZRCuC+3/aXL11zs2CHUhcAkGjwH2vogg==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.50.0.tgz", + "integrity": "sha512-4TQ4vN0aMBWsUXfJWk2xbe4x7fKfwCXgXKTtHC/ocwwKM+0EefV5Iw9YFG8IrIQN4vMtuRzktqcs9q0/Sbv7tg==", "dependencies": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7685,15 +7644,15 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/browser": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.48.0.tgz", - "integrity": "sha512-tdx/2nhuiykncmXFlV4Dpp+Hxgt/v31LiyXE79IcM560wc+QmWKtzoW9azBWQ0xt5KOO3ERMib9qPE4/ql1/EQ==", - "dependencies": { - "@sentry-internal/tracing": "7.48.0", - "@sentry/core": "7.48.0", - "@sentry/replay": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.50.0.tgz", + "integrity": "sha512-a+UYbP89+SAvW47/p9wxEi9eWlyp/SkYl52OCdZNXnplQY4kQIOVyiaIs5nnCxIxZgXKrhAX4eo1E9ykleFuNQ==", + "dependencies": { + "@sentry-internal/tracing": "7.50.0", + "@sentry/core": "7.50.0", + "@sentry/replay": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7706,12 +7665,12 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/core": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.48.0.tgz", - "integrity": "sha512-8FYuJTMpyuxRZvlen3gQ3rpOtVInSDmSyXqWEhCLuG/w34AtWoTiW7G516rsAAh6Hy1TP91GooMWbonP3XQNTQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.50.0.tgz", + "integrity": "sha512-6oD1a3fYs4aiNK7tuJSd88LHjYJAetd7ZK/AfJniU7zWKj4jxIYfO8nhm0qdnhEDs81RcweVDmPhWm3Kwrzzsg==", "dependencies": { - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7724,32 +7683,32 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/replay": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.48.0.tgz", - "integrity": "sha512-8fRHMGJ0NJeIZi6UucxUTvfDPaBa7+jU1kCTLjCcuH3X/UVz5PtGLMtFSO5U8HP+mUDlPs97MP1uoDvMa4S2Ng==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.50.0.tgz", + "integrity": "sha512-EYRk+DTZ5luwfkiCaDpBC3YBKIEdkReTUNZtWDVUytSVjsCnttkAipx/y6bxy3HN+rSXungMd3XKQT5RNMRUNA==", "dependencies": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0" + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0" }, "engines": { "node": ">=12" } }, "node_modules/@sentry/types": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.48.0.tgz", - "integrity": "sha512-kkAszZwQ5/v4n7Yyw/DPNRWx7h724mVNRGZIJa9ggUMvTgMe7UKCZZ5wfQmYiKVlGbwd9pxXAcP8Oq15EbByFQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.50.0.tgz", + "integrity": "sha512-Zo9vyI98QNeYT0K0y57Rb4JRWDaPEgmp+QkQ4CRQZFUTWetO5fvPZ4Gb/R7TW16LajuHZlbJBHmvmNj2pkL2kw==", "engines": { "node": ">=8" } }, "node_modules/@sentry/utils": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.48.0.tgz", - "integrity": "sha512-d977sghkFVMfld0LrEyyY2gYrfayLPdDEpUDT+hg5y79r7zZDCFyHtdB86699E5K89MwDZahW7Erk+a1nk4x5w==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.50.0.tgz", + "integrity": "sha512-iyPwwC6fwJsiPhH27ZbIiSsY5RaccHBqADS2zEjgKYhmP4P9WGgHRDrvLEnkOjqQyKNb6c0yfmv83n0uxYnolw==", "dependencies": { - "@sentry/types": "7.48.0", + "@sentry/types": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -9170,9 +9129,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "node_modules/@storybook/builder-webpack4/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/builder-webpack4/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -10465,9 +10424,9 @@ } }, "node_modules/@storybook/builder-webpack5/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/builder-webpack5/node_modules/colorette": { "version": "1.4.0", @@ -10892,9 +10851,9 @@ } }, "node_modules/@storybook/core-common/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/core-common/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -11716,9 +11675,9 @@ } }, "node_modules/@storybook/core-server/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/core-server/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -12659,9 +12618,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "node_modules/@storybook/manager-webpack4/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/manager-webpack4/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -13939,9 +13898,9 @@ } }, "node_modules/@storybook/manager-webpack5/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/manager-webpack5/node_modules/ansi-styles": { "version": "4.3.0", @@ -14453,9 +14412,9 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "node_modules/@storybook/react/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/react/node_modules/acorn": { "version": "7.4.1", @@ -15446,9 +15405,8 @@ } }, "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "version": "1.0.0", + "license": "MIT" }, "node_modules/@types/glob": { "version": "7.2.0", @@ -19793,9 +19751,9 @@ } }, "node_modules/clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", + "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", "engines": { "node": ">=6" } @@ -27937,9 +27895,9 @@ } }, "node_modules/i18next": { - "version": "22.4.15", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.15.tgz", - "integrity": "sha512-yYudtbFrrmWKLEhl6jvKUYyYunj4bTBCe2qIUYAxbXoPusY7YmdwPvOE6fx6UIfWvmlbCWDItr7wIs8KEBZ5Zg==", + "version": "22.4.14", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.14.tgz", + "integrity": "sha512-VtLPtbdwGn0+DAeE00YkiKKXadkwg+rBUV+0v8v0ikEjwdiJ0gmYChVE4GIa9HXymY6wKapkL93vGT7xpq6aTw==", "funding": [ { "type": "individual", @@ -36960,7 +36918,9 @@ } }, "node_modules/postcss": { - "version": "8.4.19", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "funding": [ { "type": "opencollective", @@ -36971,7 +36931,6 @@ "url": "https://tidelift.com/funding/github/npm/postcss" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -39777,6 +39736,24 @@ "react-dom": ">=16.6.0" } }, + "node_modules/react-virtualized": { + "name": "@enykeev/react-virtualized", + "version": "9.22.4-mirror.1", + "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", + "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "clsx": "^1.0.4", + "dom-helpers": "^5.1.3", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.4" + }, + "peerDependencies": { + "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", + "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-webcam": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/react-webcam/-/react-webcam-7.0.1.tgz", @@ -44497,9 +44474,9 @@ } }, "node_modules/terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.16.9", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz", + "integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==", "dependencies": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -46350,9 +46327,10 @@ } }, "node_modules/webpack": { - "version": "5.77.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.77.0.tgz", - "integrity": "sha512-sbGNjBr5Ya5ss91yzjeJTLKyfiwo5C628AFjEa6WSXcZa4E+F57om3Cc8xLb1Jh0b243AWuSYRf3dn7HVeFQ9Q==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", + "integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==", + "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -48123,9 +48101,9 @@ } }, "node_modules/xstate": { - "version": "4.37.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.1.tgz", - "integrity": "sha512-MuB7s01nV5vG2CzaBg2msXLGz7JuS+x/NBkQuZAwgEYCnWA8iQMiRz2VGxD3pcFjZAOih3fOgDD3kDaFInEx+g==", + "version": "4.37.2", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.2.tgz", + "integrity": "sha512-Qm337O49CRTZ3PRyRuK6b+kvI+D3JGxXIZCTul+xEsyFCVkTFDt5jixaL1nBWcUBcaTQ9um/5CRGVItPi7fveg==", "funding": { "type": "opencollective", "url": "https://opencollective.com/xstate" @@ -49707,25 +49685,25 @@ "requires": {} }, "@datadog/browser-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.39.0.tgz", - "integrity": "sha512-jSwXfdSPaeU9xFLepour7d2jATk/VVcjab69/42gmWkh1MtzDloTd8RaKSVRo0Y7CsHroO6Mdzp+enEivI7NkA==" + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.41.0.tgz", + "integrity": "sha512-7QwALfXt9vEr68xcEmv1XvvpypIH3+WyiVKGPBrmViOQajILMGuDqdKpxRcQAnh6HeWEIjhgtkZkMG7vJcr0oA==" }, "@datadog/browser-rum": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.39.0.tgz", - "integrity": "sha512-7owNySSTxWnNbwRjDCC+fHRU2ycWb3lPDGn+VvQE3US+o9MRlEbFesaLO5/3Nj0A+vJGq6Ao35d++eCHl5dw2Q==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.41.0.tgz", + "integrity": "sha512-GY5R02cv0obfkn4C+17avHuWI/O4K5mA9a8WlAOvQzUMJN4hYetDnhlqw08BL9j2mij3MUKLM8JPWgl03gXcpA==", "requires": { - "@datadog/browser-core": "4.39.0", - "@datadog/browser-rum-core": "4.39.0" + "@datadog/browser-core": "4.41.0", + "@datadog/browser-rum-core": "4.41.0" } }, "@datadog/browser-rum-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.39.0.tgz", - "integrity": "sha512-UhAEELzt7ZQlAbWSaMJ7Ubwfdxk+uig8xm39iktNyTNCcxN92aNHWsNhsz5FtWXe3Oci7xKSDZf3ccjFl7KABw==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.41.0.tgz", + "integrity": "sha512-TXjg0mIRNobc1L0wDUiTW/MrqsGNQd2qRNJz8DBoJ1E7bmlXGAb8/9cCyFq+vtw94nnB7FIv5iI3CUJRzGPoeA==", "requires": { - "@datadog/browser-core": "4.39.0" + "@datadog/browser-core": "4.41.0" } }, "@deriv/api-types": { @@ -49846,11 +49824,6 @@ "requires": { "regenerator-runtime": "^0.13.2" } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -49910,11 +49883,6 @@ } } } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -49935,11 +49903,6 @@ "requires": { "regenerator-runtime": "^0.13.2" } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -50064,19 +50027,6 @@ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" }, - "@enykeev/react-virtualized": { - "version": "9.22.4-mirror.1", - "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", - "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", - "requires": { - "@babel/runtime": "^7.7.2", - "clsx": "^1.0.4", - "dom-helpers": "^5.1.3", - "loose-envify": "^1.4.0", - "prop-types": "^15.7.2", - "react-lifecycles-compat": "^3.0.4" - } - }, "@eslint/eslintrc": { "version": "0.4.3", "requires": { @@ -52819,9 +52769,9 @@ } }, "@onfido/castor-icons": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.16.0.tgz", - "integrity": "sha512-moThxhRXKxoHrsP8hIoCrtecUX8m5Hjk5yozuYTKqA24iBIQpcDe+SDG/m6slDYpT9iSXediCU4hb7XjpHYjSg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.17.0.tgz", + "integrity": "sha512-dY2QNOFrIEqwCXcjNmH7hqz35CDWtBDlPkwbLYfnhK9ZAV7qUs2wcAxGi/FD4Yvi7MNsRBsFKSoT379hBSQcCw==", "requires": {} }, "@onfido/castor-tokens": { @@ -53304,13 +53254,13 @@ } }, "@sentry-internal/tracing": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.48.0.tgz", - "integrity": "sha512-MFAPDTrvCtfSm0/Zbmx7HA0Q5uCfRadOUpN8Y8rP1ndz+329h2kA3mZRCuC+3/aXL11zs2CHUhcAkGjwH2vogg==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.50.0.tgz", + "integrity": "sha512-4TQ4vN0aMBWsUXfJWk2xbe4x7fKfwCXgXKTtHC/ocwwKM+0EefV5Iw9YFG8IrIQN4vMtuRzktqcs9q0/Sbv7tg==", "requires": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53322,15 +53272,15 @@ } }, "@sentry/browser": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.48.0.tgz", - "integrity": "sha512-tdx/2nhuiykncmXFlV4Dpp+Hxgt/v31LiyXE79IcM560wc+QmWKtzoW9azBWQ0xt5KOO3ERMib9qPE4/ql1/EQ==", - "requires": { - "@sentry-internal/tracing": "7.48.0", - "@sentry/core": "7.48.0", - "@sentry/replay": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.50.0.tgz", + "integrity": "sha512-a+UYbP89+SAvW47/p9wxEi9eWlyp/SkYl52OCdZNXnplQY4kQIOVyiaIs5nnCxIxZgXKrhAX4eo1E9ykleFuNQ==", + "requires": { + "@sentry-internal/tracing": "7.50.0", + "@sentry/core": "7.50.0", + "@sentry/replay": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53342,12 +53292,12 @@ } }, "@sentry/core": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.48.0.tgz", - "integrity": "sha512-8FYuJTMpyuxRZvlen3gQ3rpOtVInSDmSyXqWEhCLuG/w34AtWoTiW7G516rsAAh6Hy1TP91GooMWbonP3XQNTQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.50.0.tgz", + "integrity": "sha512-6oD1a3fYs4aiNK7tuJSd88LHjYJAetd7ZK/AfJniU7zWKj4jxIYfO8nhm0qdnhEDs81RcweVDmPhWm3Kwrzzsg==", "requires": { - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53359,26 +53309,26 @@ } }, "@sentry/replay": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.48.0.tgz", - "integrity": "sha512-8fRHMGJ0NJeIZi6UucxUTvfDPaBa7+jU1kCTLjCcuH3X/UVz5PtGLMtFSO5U8HP+mUDlPs97MP1uoDvMa4S2Ng==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.50.0.tgz", + "integrity": "sha512-EYRk+DTZ5luwfkiCaDpBC3YBKIEdkReTUNZtWDVUytSVjsCnttkAipx/y6bxy3HN+rSXungMd3XKQT5RNMRUNA==", "requires": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0" + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0" } }, "@sentry/types": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.48.0.tgz", - "integrity": "sha512-kkAszZwQ5/v4n7Yyw/DPNRWx7h724mVNRGZIJa9ggUMvTgMe7UKCZZ5wfQmYiKVlGbwd9pxXAcP8Oq15EbByFQ==" + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.50.0.tgz", + "integrity": "sha512-Zo9vyI98QNeYT0K0y57Rb4JRWDaPEgmp+QkQ4CRQZFUTWetO5fvPZ4Gb/R7TW16LajuHZlbJBHmvmNj2pkL2kw==" }, "@sentry/utils": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.48.0.tgz", - "integrity": "sha512-d977sghkFVMfld0LrEyyY2gYrfayLPdDEpUDT+hg5y79r7zZDCFyHtdB86699E5K89MwDZahW7Erk+a1nk4x5w==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.50.0.tgz", + "integrity": "sha512-iyPwwC6fwJsiPhH27ZbIiSsY5RaccHBqADS2zEjgKYhmP4P9WGgHRDrvLEnkOjqQyKNb6c0yfmv83n0uxYnolw==", "requires": { - "@sentry/types": "7.48.0", + "@sentry/types": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -54358,9 +54308,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -55381,9 +55331,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "colorette": { "version": "1.4.0", @@ -55679,9 +55629,9 @@ } }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -56354,9 +56304,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -57117,9 +57067,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -58129,9 +58079,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "ansi-styles": { "version": "4.3.0", @@ -58462,9 +58412,9 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "acorn": { "version": "7.4.1", @@ -59158,9 +59108,7 @@ } }, "@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "version": "1.0.0" }, "@types/glob": { "version": "7.2.0", @@ -62389,9 +62337,9 @@ } }, "clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", + "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" }, "cmd-shim": { "version": "5.0.0", @@ -68313,9 +68261,9 @@ } }, "i18next": { - "version": "22.4.15", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.15.tgz", - "integrity": "sha512-yYudtbFrrmWKLEhl6jvKUYyYunj4bTBCe2qIUYAxbXoPusY7YmdwPvOE6fx6UIfWvmlbCWDItr7wIs8KEBZ5Zg==", + "version": "22.4.14", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.14.tgz", + "integrity": "sha512-VtLPtbdwGn0+DAeE00YkiKKXadkwg+rBUV+0v8v0ikEjwdiJ0gmYChVE4GIa9HXymY6wKapkL93vGT7xpq6aTw==", "requires": { "@babel/runtime": "^7.20.6" } @@ -74471,7 +74419,9 @@ "version": "0.1.1" }, "postcss": { - "version": "8.4.19", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "requires": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -76349,6 +76299,19 @@ "prop-types": "^15.6.2" } }, + "react-virtualized": { + "version": "npm:@enykeev/react-virtualized@9.22.4-mirror.1", + "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", + "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", + "requires": { + "@babel/runtime": "^7.7.2", + "clsx": "^1.0.4", + "dom-helpers": "^5.1.3", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.4" + } + }, "react-webcam": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/react-webcam/-/react-webcam-7.0.1.tgz", @@ -79748,9 +79711,9 @@ } }, "terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.16.9", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz", + "integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==", "requires": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -81036,9 +80999,9 @@ "version": "6.1.0" }, "webpack": { - "version": "5.77.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.77.0.tgz", - "integrity": "sha512-sbGNjBr5Ya5ss91yzjeJTLKyfiwo5C628AFjEa6WSXcZa4E+F57om3Cc8xLb1Jh0b243AWuSYRf3dn7HVeFQ9Q==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", + "integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -82377,9 +82340,9 @@ "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" }, "xstate": { - "version": "4.37.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.1.tgz", - "integrity": "sha512-MuB7s01nV5vG2CzaBg2msXLGz7JuS+x/NBkQuZAwgEYCnWA8iQMiRz2VGxD3pcFjZAOih3fOgDD3kDaFInEx+g==" + "version": "4.37.2", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.2.tgz", + "integrity": "sha512-Qm337O49CRTZ3PRyRuK6b+kvI+D3JGxXIZCTul+xEsyFCVkTFDt5jixaL1nBWcUBcaTQ9um/5CRGVItPi7fveg==" }, "xtend": { "version": "4.0.2" diff --git a/packages/account/global.d.ts b/packages/account/global.d.ts deleted file mode 100644 index 5ac902685ee5..000000000000 --- a/packages/account/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '@binary-com/binary-document-uploader'; diff --git a/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx b/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx index 3213b6fa5564..450cbb9b6aa3 100644 --- a/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx +++ b/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx @@ -26,7 +26,7 @@ describe('', () => { it('should show and trigger Navlink with path and active className', () => { render( - + Simple test link @@ -41,7 +41,7 @@ describe('', () => { it('should show simple link text', () => { render( - + Simple test link without Navlink @@ -55,7 +55,9 @@ describe('', () => { expect(() => render( - + Simple test link diff --git a/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx b/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx index 9274750725f3..c57920aaecb8 100644 --- a/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx +++ b/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx @@ -20,7 +20,7 @@ describe('', () => { it('should render BinaryRoutes with mocked route component', () => { render( - + diff --git a/packages/account/src/Components/Routes/binary-link.tsx b/packages/account/src/Components/Routes/binary-link.tsx index 5ee27c718fe4..19f9649eecb3 100644 --- a/packages/account/src/Components/Routes/binary-link.tsx +++ b/packages/account/src/Components/Routes/binary-link.tsx @@ -3,7 +3,6 @@ import { NavLink } from 'react-router-dom'; import { PlatformContext } from '@deriv/shared'; import getRoutesConfig from 'Constants/routes-config'; import { findRouteByPath, normalizePath } from './helpers'; -import { TPlatformContext } from 'Types'; type TBinaryLink = { active_class: string; @@ -11,7 +10,7 @@ type TBinaryLink = { }; const BinaryLink = ({ active_class, to, children, ...props }: React.PropsWithChildren>) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const path = normalizePath(to as string); const route = findRouteByPath(path, getRoutesConfig({ is_appstore })); diff --git a/packages/account/src/Components/Routes/binary-routes.tsx b/packages/account/src/Components/Routes/binary-routes.tsx index 4a3c5ae1ad64..39d068eb144d 100644 --- a/packages/account/src/Components/Routes/binary-routes.tsx +++ b/packages/account/src/Components/Routes/binary-routes.tsx @@ -3,11 +3,11 @@ import { Switch } from 'react-router-dom'; import { PlatformContext } from '@deriv/shared'; import { Localize } from '@deriv/translations'; import getRoutesConfig from 'Constants/routes-config'; -import { TBinaryRoutes, TPlatformContext, TRoute } from 'Types'; +import { TBinaryRoutes, TRoute } from 'Types'; import RouteWithSubRoutes from './route-with-sub-routes'; const BinaryRoutes = (props: TBinaryRoutes) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); return ( ', () => { beforeAll(() => { - ReactDOM.createPortal = jest.fn(component => { + (ReactDOM.createPortal as jest.Mock) = jest.fn(component => { return component; }); }); afterAll(() => { - ReactDOM.createPortal.mockClear(); + (ReactDOM.createPortal as jest.Mock).mockClear(); }); const Component = () => ( , + currency: '', + overlay_ref: document.createElement('div'), toggleOverlay: jest.fn(), }} > @@ -35,7 +36,7 @@ describe('', () => { it('should go to help-centre page if the Help Centre link on the text is clicked', () => { render(); - expect(screen.getByText('Help Centre').closest('a')).toHaveAttribute('href', 'https://deriv.com/help-centre'); + expect(screen.getByText('Help Centre').hasAttribute('href')); }); it('should show Done Button', () => { render(); diff --git a/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js b/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx similarity index 95% rename from packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js rename to packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx index c460f91b6532..077ca1f65445 100644 --- a/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js +++ b/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx @@ -23,7 +23,7 @@ describe('', () => { it('should go to help-centre page if the Help Centre link on the text is clicked', () => { render(); - expect(screen.getByText('Help Centre.').closest('a')).toHaveAttribute( + expect(screen.getByText('Help Centre.')).toHaveAttribute( 'href', 'https://deriv.com/help-centre/trading/#trading-limits' ); diff --git a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.js b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx similarity index 85% rename from packages/account/src/Components/account-limits/__tests__/account-limits.spec.js rename to packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx index 28a8b407f8d1..bc0f8b7f825c 100644 --- a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.js +++ b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx @@ -7,7 +7,7 @@ import { BrowserRouter } from 'react-router-dom'; jest.mock('Stores/connect.js', () => ({ __esModule: true, default: 'mockedDefaultExport', - connect: () => Component => Component, + connect: () => (Component: React.ReactElement) => Component, })); jest.mock('@deriv/components', () => { @@ -31,11 +31,12 @@ jest.mock('Components/load-error-message', () => jest.fn(() => 'mockedLoadErrorM jest.mock('../account-limits-footer', () => jest.fn(() => 'mockedAccountLimitsFooter')); describe('', () => { - const props = { + const props: React.ComponentProps = { currency: 'AUD', is_fully_authenticated: true, is_switching: false, is_virtual: false, + overlay_ref: document.createElement('div'), getLimits: jest.fn(() => Promise.resolve({ data: {} })), account_limits: { account_balance: 300000, @@ -66,9 +67,9 @@ describe('', () => { cryptocurrency: [ { name: 'Cryptocurrencies', - payout_limit: '100.00', + payout_limit: 100.0, profile_name: 'extreme_risk', - turnover_limit: '1000.00', + turnover_limit: 1000.0, }, ], forex: [ @@ -124,15 +125,31 @@ describe('', () => { }); it('should render DemoMessage component if is_virtual is true', () => { - const { container } = render(); - expect(container.firstChild).toHaveClass('account__demo-message-wrapper'); - + render(); + expect(screen.queryByTestId('dt_account_demo_message_wrapper')).toHaveClass('account__demo-message-wrapper'); expect(screen.getByText('mockedDemoMessage')).toBeInTheDocument(); }); it('should render LoadErrorMessage component if there is api_initial_load_error', () => { render( - + ); expect(screen.getByText('mockedLoadErrorMessage')).toBeInTheDocument(); }); @@ -153,8 +170,8 @@ describe('', () => { }); it('should render AccountLimitsArticle component if should_show_article is true and is_from_derivgo is false in mobile mode', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect( @@ -163,8 +180,8 @@ describe('', () => { }); it('should render AccountLimitsArticle component if should_show_article is true and is_from_derivgo is true in mobile mode', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect( @@ -173,8 +190,8 @@ describe('', () => { }); it('should not render AccountLimitsArticle component if should_show_article is false', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.queryByText('/account limits/i')).not.toBeInTheDocument(); }); @@ -210,7 +227,7 @@ describe('', () => { const { open_positions } = props.account_limits; expect( screen.getByRole('cell', { - name: open_positions, + name: open_positions?.toString(), }) ).toBeInTheDocument(); }); @@ -273,7 +290,7 @@ describe('', () => { it('withdrawal_limits_table should show `Total withdrawal limit` if is_fully_authenticated is false and is_appstore is true', () => { render( - + @@ -284,7 +301,7 @@ describe('', () => { it('withdrawal_limits_table should show `Total withdrawal allowed` when is_fully_authenticated is false and is_appstore is true', () => { render( - + ); @@ -293,20 +310,17 @@ describe('', () => { it('withdrawal_limits_table should show the verfiy button when is_fully_authenticated is false and is_appstore is true', () => { render( - + ); expect(screen.getByText(/to increase limit please verify your identity/i)).toBeInTheDocument(); - expect( - screen - .getByRole('link', { - name: /verify/i, - }) - .closest('a') + screen.getByRole('link', { + name: /verify/i, + }) ).toHaveAttribute('href', '/account/proof-of-identity'); const { num_of_days_limit } = props.account_limits; expect(formatMoney).toHaveBeenCalledWith(props.currency, num_of_days_limit, true); @@ -314,7 +328,7 @@ describe('', () => { it('withdrawal_limits_table should show total withdrawn and withdrawn remaining details', () => { render( - + @@ -330,10 +344,10 @@ describe('', () => { }); it('should show limit_notice message when is_appstore is true and is_fully_authenticated is false in mobile mode', () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render( - + @@ -343,10 +357,10 @@ describe('', () => { }); it('should not show limit_notice message when is_appstore is false and is_fully_authenticated is false', () => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); render( - + @@ -358,8 +372,8 @@ describe('', () => { }); it('should show AccountLimitsArticle when should_show_article and isDesktop is true', () => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect(screen.getByText(/these are default limits that we apply to your accounts\./i)).toBeInTheDocument(); @@ -367,16 +381,15 @@ describe('', () => { screen.getByText(/to learn more about trading limits and how they apply, please go to the/i) ).toBeInTheDocument(); expect( - screen - .getByRole('link', { - name: /help centre/i, - }) - .closest('a') + screen.getByRole('link', { + name: /help centre/i, + }) ).toHaveAttribute('href', 'https://deriv.com/help-centre/trading/#trading-limits'); }); it('should show AccountLimitsFooter if footer_ref is passed', () => { - const footer = { current: { offsetWidth: 100 } }; + const footer = React.createRef(); + render(); expect(screen.getByText(/mockedaccountlimitsfooter/i)).toBeInTheDocument(); }); diff --git a/packages/account/src/Components/account-limits/account-limits-article.jsx b/packages/account/src/Components/account-limits/account-limits-article.tsx similarity index 88% rename from packages/account/src/Components/account-limits/account-limits-article.jsx rename to packages/account/src/Components/account-limits/account-limits-article.tsx index 696327cebf7a..ab843d110855 100644 --- a/packages/account/src/Components/account-limits/account-limits-article.jsx +++ b/packages/account/src/Components/account-limits/account-limits-article.tsx @@ -4,7 +4,11 @@ import { StaticUrl } from '@deriv/components'; import { Localize, localize } from '@deriv/translations'; import AccountArticle from 'Components/article'; -const AccountLimitsArticle = ({ is_from_derivgo }) => { +type TAccountLimitsArticle = { + is_from_derivgo?: boolean; +}; + +const AccountLimitsArticle = ({ is_from_derivgo }: TAccountLimitsArticle) => { const getDescription = () => { const description = [ , diff --git a/packages/account/src/Components/account-limits/account-limits-context.tsx b/packages/account/src/Components/account-limits/account-limits-context.tsx index e1237f0462a4..3ee0a4067ad8 100644 --- a/packages/account/src/Components/account-limits/account-limits-context.tsx +++ b/packages/account/src/Components/account-limits/account-limits-context.tsx @@ -3,10 +3,13 @@ import * as React from 'react'; export type TAccountLimitsContext = { currency: string; footer_ref?: React.RefObject; - overlay_ref?: React.RefObject; - toggleOverlay?: () => boolean; + overlay_ref: HTMLDivElement; + toggleOverlay?: () => void; }; -const AccountLimitsContext = React.createContext({ currency: '' }); +const AccountLimitsContext = React.createContext({ + currency: '', + overlay_ref: document.createElement('div'), +}); export default AccountLimitsContext; diff --git a/packages/account/src/Components/account-limits/account-limits-overlay.jsx b/packages/account/src/Components/account-limits/account-limits-overlay.tsx similarity index 100% rename from packages/account/src/Components/account-limits/account-limits-overlay.jsx rename to packages/account/src/Components/account-limits/account-limits-overlay.tsx diff --git a/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx b/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx index ffbae261b3a8..2fd4b11e538f 100644 --- a/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx +++ b/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx @@ -3,8 +3,8 @@ import { formatMoney } from '@deriv/shared'; import AccountLimitsTableCell from './account-limits-table-cell'; import AccountLimitsContext, { TAccountLimitsContext } from './account-limits-context'; -type TAccountLimits = { - level: string; +export type TAccountLimitsCollection = { + level?: string; name: string; payout_limit: number; profile_name: string; @@ -12,8 +12,8 @@ type TAccountLimits = { }; type TAccountLimitsTurnoverLimitRow = { - collection: TAccountLimits[]; - title: string; + collection: TAccountLimitsCollection[]; + title?: string; }; const AccountLimitsTurnoverLimitRow = ({ collection, title }: TAccountLimitsTurnoverLimitRow) => { diff --git a/packages/account/src/Components/account-limits/account-limits.jsx b/packages/account/src/Components/account-limits/account-limits.tsx similarity index 90% rename from packages/account/src/Components/account-limits/account-limits.jsx rename to packages/account/src/Components/account-limits/account-limits.tsx index 0e1cf2a4dcc3..78ad00173a5a 100644 --- a/packages/account/src/Components/account-limits/account-limits.jsx +++ b/packages/account/src/Components/account-limits/account-limits.tsx @@ -1,19 +1,55 @@ -import PropTypes from 'prop-types'; -import * as React from 'react'; +import React from 'react'; import classNames from 'classnames'; import { Loading, ThemedScrollbars, Text, ButtonLink } from '@deriv/components'; import { formatMoney, isDesktop, isMobile, useIsMounted, PlatformContext } from '@deriv/shared'; import { Localize, localize } from '@deriv/translations'; import LoadErrorMessage from 'Components/load-error-message'; import DemoMessage from 'Components/demo-message'; -import AccountLimitsArticle from './account-limits-article.jsx'; -import AccountLimitsContext from './account-limits-context'; +import AccountLimitsArticle from './account-limits-article'; +import AccountLimitsContext, { TAccountLimitsContext } from './account-limits-context'; import AccountLimitsExtraInfo from './account-limits-extra-info'; import AccountLimitsFooter from './account-limits-footer'; -import AccountLimitsOverlay from './account-limits-overlay.jsx'; +import AccountLimitsOverlay from './account-limits-overlay'; import AccountLimitsTableCell from './account-limits-table-cell'; import AccountLimitsTableHeader from './account-limits-table-header'; -import AccountLimitsTurnoverLimitRow from './account-limits-turnover-limit-row'; +import AccountLimitsTurnoverLimitRow, { TAccountLimitsCollection } from './account-limits-turnover-limit-row'; +import { FormikValues } from 'formik'; + +type TAccountLimits = { + account_limits: { + api_initial_load_error?: string; + open_positions?: React.ReactNode; + account_balance: string | number; + daily_transfers?: object; + payout: string | number; + lifetime_limit?: number; + market_specific: { + commodities: TAccountLimitsCollection[]; + cryptocurrency: TAccountLimitsCollection[]; + forex: TAccountLimitsCollection[]; + indices: TAccountLimitsCollection[]; + synthetic_index: TAccountLimitsCollection[]; + }; + num_of_days?: number; + num_of_days_limit: string | number; + remainder: string | number; + withdrawal_for_x_days_monetary?: number; + withdrawal_since_inception_monetary: string | number; + }; + currency: string; + footer_ref?: React.RefObject; + is_app_settings?: boolean; + getLimits: () => Promise<{ data: object }>; + is_fully_authenticated: boolean; + is_from_derivgo?: boolean; + is_switching: boolean; + is_virtual: boolean; + overlay_ref: HTMLDivElement; + setIsOverlayShown?: (is_overlay_shown?: boolean) => void; + setIsPopupOverlayShown?: (is_popup_overlay_shown: boolean) => void; + should_bypass_scrollbars?: boolean; + should_show_article?: boolean; +}; const AccountLimits = ({ account_limits, @@ -29,7 +65,7 @@ const AccountLimits = ({ setIsOverlayShown: setIsPopupOverlayShown, should_bypass_scrollbars, should_show_article, -}) => { +}: TAccountLimits) => { const isMounted = useIsMounted(); const [is_loading, setLoading] = React.useState(false); const [is_overlay_shown, setIsOverlayShown] = React.useState(false); @@ -67,6 +103,7 @@ const AccountLimits = ({ if (is_virtual) { return (
; @@ -96,17 +133,14 @@ const AccountLimits = ({ } const { commodities, forex, indices, synthetic_index } = { ...market_specific }; - const forex_ordered = forex?.slice().sort((a, b) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0)); - // sort submarkets by names alphabetically and put 'market' at the beginning + const forex_ordered = forex + ?.slice() + .sort((a: FormikValues, b: FormikValues) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0)); const derived_ordered = synthetic_index ?.slice() - .sort((a, b) => - a.level === 'submarket' && b.level === 'submarket' - ? a.name.localeCompare(b.name) - : a.level.localeCompare(b.level) - ); + .sort((a: FormikValues, b: FormikValues) => (a.level > b.level ? 1 : -1)); - const context_value = { + const context_value: TAccountLimitsContext = { currency, footer_ref, overlay_ref, @@ -340,21 +374,4 @@ const AccountLimits = ({ ); }; -AccountLimits.propTypes = { - account_limits: PropTypes.object, - currency: PropTypes.string.isRequired, - footer_ref: PropTypes.shape({ current: PropTypes.any }), - is_app_settings: PropTypes.bool, - getLimits: PropTypes.func.isRequired, - is_fully_authenticated: PropTypes.bool.isRequired, - is_from_derivgo: PropTypes.bool, - is_switching: PropTypes.bool.isRequired, - is_virtual: PropTypes.bool.isRequired, - overlay_ref: PropTypes.shape({ current: PropTypes.any }), - setIsOverlayShown: PropTypes.func, - setIsPopupOverlayShown: PropTypes.func, - should_bypass_scrollbars: PropTypes.bool, - should_show_article: PropTypes.bool, -}; - export default AccountLimits; diff --git a/packages/account/src/Components/account-limits/index.js b/packages/account/src/Components/account-limits/index.js deleted file mode 100644 index 393812bb5309..000000000000 --- a/packages/account/src/Components/account-limits/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import AccountLimits from './account-limits.jsx'; - -export default AccountLimits; diff --git a/packages/account/src/Components/account-limits/index.ts b/packages/account/src/Components/account-limits/index.ts new file mode 100644 index 000000000000..89602f41cdc9 --- /dev/null +++ b/packages/account/src/Components/account-limits/index.ts @@ -0,0 +1,3 @@ +import AccountLimits from './account-limits'; + +export default AccountLimits; diff --git a/packages/account/src/Components/address-details/__tests__/address-details.spec.js b/packages/account/src/Components/address-details/__tests__/address-details.spec.tsx similarity index 85% rename from packages/account/src/Components/address-details/__tests__/address-details.spec.js rename to packages/account/src/Components/address-details/__tests__/address-details.spec.tsx index 1038ac9a35a9..5a164d196e16 100644 --- a/packages/account/src/Components/address-details/__tests__/address-details.spec.js +++ b/packages/account/src/Components/address-details/__tests__/address-details.spec.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import AddressDetails from '../address-details'; -import { isDesktop, isMobile, PlatformContext } from '@deriv/shared'; +import { isDesktop, isMobile, PlatformContext, TLocationList } from '@deriv/shared'; +import { FormikProps, FormikValues } from 'formik'; jest.mock('@deriv/shared', () => ({ ...jest.requireActual('@deriv/shared'), @@ -32,10 +33,10 @@ describe('', () => { const verification_info = 'We need this for verification. If the information you provide is fake or inaccurate, you won’t be able to deposit and withdraw.'; - let modal_root_el; + let modal_root_el: HTMLDivElement; - const mock_props = { - fetchStatesList: jest.fn(() => []), + const mock_props: React.ComponentProps = { + fetchStatesList: jest.fn(() => Promise.resolve([])), getCurrentStep: jest.fn(), goToNextStep: jest.fn(), goToPreviousStep: jest.fn(), @@ -45,7 +46,7 @@ describe('', () => { onSave: jest.fn(), onSubmit: jest.fn(), onSubmitEnabledChange: jest.fn(), - selected_step_ref: { current: { isSubmitting: false } }, + selected_step_ref: { current: { isSubmitting: false } } as React.RefObject>, states_list: [], value: { address_city: '', @@ -74,8 +75,8 @@ describe('', () => { }; beforeEach(() => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); + (isMobile as jest.Mock).mockReturnValue(false); jest.clearAllMocks(); }); @@ -90,8 +91,8 @@ describe('', () => { }); it('should render AddressDetails component for mobile', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); render(); @@ -100,7 +101,7 @@ describe('', () => { }); expect(screen.queryByText(verification_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); expect(required_fields.length).toBe(2); @@ -114,7 +115,7 @@ describe('', () => { }); expect(screen.queryByText(verification_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); @@ -126,7 +127,7 @@ describe('', () => { expect(mock_props.onCancel).toHaveBeenCalledTimes(1); expect(mock_props.onSave).toHaveBeenCalledTimes(1); - const address_line_1_input = screen.getByPlaceholderText(address_line_1); + const address_line_1_input: HTMLInputElement = screen.getByPlaceholderText(address_line_1); const first_line_adress_text = 'Test first line address'; expect(address_line_1_input.value).toBe(''); fireEvent.change(address_line_1_input, { target: { value: first_line_adress_text } }); @@ -134,7 +135,7 @@ describe('', () => { expect(address_line_1_input.value).toBe(first_line_adress_text); }); - const address_town_input = screen.getByPlaceholderText(address_town); + const address_town_input: HTMLInputElement = screen.getByPlaceholderText(address_town); const address_town_text = 'Test city'; expect(address_town_input.value).toBe(''); fireEvent.change(address_town_input, { target: { value: address_town_text } }); @@ -142,7 +143,7 @@ describe('', () => { expect(address_town_input.value).toBe(address_town_text); }); - const address_postcode_input = screen.getByPlaceholderText(address_postcode); + const address_postcode_input: HTMLInputElement = screen.getByPlaceholderText(address_postcode); const address_postcode_text = 'Test postcode'; expect(address_postcode_input.value).toBe(''); fireEvent.change(address_postcode_input, { target: { value: address_postcode_text } }); @@ -150,7 +151,7 @@ describe('', () => { expect(address_postcode_input.value).toBe(address_postcode_text); }); - const address_state_input = screen.getByPlaceholderText(address_state); + const address_state_input: HTMLInputElement = screen.getByPlaceholderText(address_state); const address_state_text = 'Test state'; expect(address_state_input.value).toBe('Default test state'); fireEvent.change(address_state_input, { target: { value: address_state_text } }); @@ -173,7 +174,7 @@ describe('', () => { expect(mock_props.onSubmitEnabledChange).toHaveBeenCalledTimes(1); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); expect(required_fields.length).toBe(0); @@ -196,7 +197,7 @@ describe('', () => { it('should render AddressDetails component for appstore', async () => { render( - + ); @@ -207,7 +208,7 @@ describe('', () => { }); expect(screen.queryByText(use_address_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); @@ -228,19 +229,19 @@ describe('', () => { }); it('should render AddressDetails component with states_list for mobile', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); mock_props.states_list = [ { text: 'State 1', value: 'State 1' }, { text: 'State 2', value: 'State 2' }, - ]; + ] as TLocationList[]; render(); expect(screen.getByText('Default test state')).toBeInTheDocument(); - const address_state_input = screen.getByRole('combobox'); + const address_state_input: HTMLInputElement = screen.getByRole('combobox'); expect(address_state_input.value).toBe(''); fireEvent.change(address_state_input, { target: { value: 'State 2' } }); await waitFor(() => { @@ -252,12 +253,12 @@ describe('', () => { mock_props.states_list = [ { text: 'State 1', value: 'State 1' }, { text: 'State 2', value: 'State 2' }, - ]; + ] as TLocationList[]; render(); - const address_state_input = screen.getByRole('textbox', { name: 'State/Province' }); - expect(address_state_input.value).toBe('Default test state'); + const address_state_input: HTMLTextAreaElement = screen.getByRole('textbox', { name: 'State/Province' }); + expect(address_state_input).toHaveValue('Default test state'); fireEvent.change(address_state_input, { target: { value: 'State 1' } }); await waitFor(() => { expect(address_state_input.value).toBe('State 1'); diff --git a/packages/account/src/Components/address-details/address-details.jsx b/packages/account/src/Components/address-details/address-details.tsx similarity index 85% rename from packages/account/src/Components/address-details/address-details.jsx rename to packages/account/src/Components/address-details/address-details.tsx index 798ca66f7459..804437058b69 100644 --- a/packages/account/src/Components/address-details/address-details.jsx +++ b/packages/account/src/Components/address-details/address-details.tsx @@ -1,4 +1,4 @@ -import { Formik, Field } from 'formik'; +import { Formik, Field, FormikProps, FormikValues } from 'formik'; import React from 'react'; import { Modal, @@ -15,13 +15,63 @@ import { Text, } from '@deriv/components'; import { localize, Localize } from '@deriv/translations'; -import { isDesktop, isMobile, getLocation, makeCancellablePromise, PlatformContext } from '@deriv/shared'; +import { + isDesktop, + isMobile, + getLocation, + makeCancellablePromise, + PlatformContext, + TLocationList, +} from '@deriv/shared'; import { splitValidationResultTypes } from '../real-account-signup/helpers/utils'; -const InputField = props => { +type TAddressDetails = { + states_list: TLocationList[]; + getCurrentStep?: () => number; + onSave: (current_step: number, values: FormikValues) => void; + onCancel: (current_step: number, goToPreviousStep: () => void) => void; + goToNextStep: () => void; + goToPreviousStep: () => void; + validate: (values: FormikValues) => FormikValues; + onSubmit: ( + current_step: number | null, + values: FormikValues, + action: (isSubmitting: boolean) => void, + next_step: () => void + ) => void; + is_svg: boolean; + is_mf?: boolean; + is_gb_residence: boolean | string; + onSubmitEnabledChange: (is_submit_disabled: boolean) => void; + selected_step_ref?: React.RefObject>; + fetchStatesList: () => Promise; + value: FormikValues; +}; + +type TFormValidation = { + warnings: { [key: string]: string }; + errors: { [key: string]: string }; +}; + +type TInputField = { + name: string; + required?: boolean | string; + label: string; + maxLength?: number | string; + placeholder: string; + onChange?: (e: any) => void; + disabled?: string; +}; + +type TAutoComplete = { + value: boolean; + text: string; +}; + +const InputField = (props: TInputField) => { return ( - {({ field, form: { errors, touched } }) => ( + {({ field, form: { errors, touched } }: FormikValues) => ( { +}: TAddressDetails) => { const { is_appstore } = React.useContext(PlatformContext); const [has_fetched_states_list, setHasFetchedStatesList] = React.useState(false); const [address_state_to_display, setAddressStateToDisplay] = React.useState(''); @@ -74,13 +124,13 @@ const AddressDetails = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const is_submit_disabled_ref = React.useRef(true); + const is_submit_disabled_ref = React.useRef(true); - const isSubmitDisabled = errors => { - return selected_step_ref?.current?.isSubmitting || Object.keys(errors).length > 0; + const isSubmitDisabled = (errors?: { [key: string]: string } | FormikValues) => { + return selected_step_ref?.current?.isSubmitting || (errors && Object.keys(errors).length > 0); }; - const checkSubmitStatus = errors => { + const checkSubmitStatus = (errors?: { [key: string]: string }) => { const is_submit_disabled = isSubmitDisabled(errors); if (is_submit_disabled_ref.current !== is_submit_disabled) { @@ -89,14 +139,14 @@ const AddressDetails = ({ } }; - const handleCancel = values => { - const current_step = getCurrentStep() - 1; + const handleCancel = (values: FormikValues) => { + const current_step = (getCurrentStep?.() || 1) - 1; onSave(current_step, values); onCancel(current_step, goToPreviousStep); }; - const handleValidate = values => { - const { errors } = splitValidationResultTypes(validate(values)); + const handleValidate = (values: FormikValues) => { + const { errors }: Partial = splitValidationResultTypes(validate(values)); checkSubmitStatus(errors); return errors; }; @@ -113,12 +163,12 @@ const AddressDetails = ({ ? getLocation(states_list, address_state_to_display, 'value') : getLocation(states_list, values.address_state, 'value'); } - onSubmit(getCurrentStep() - 1, values, actions.setSubmitting, goToNextStep); + onSubmit((getCurrentStep?.() || 1) - 1, values, actions.setSubmitting, goToNextStep); }} > - {({ handleSubmit, errors, values, setFieldValue, handleChange, setFieldTouched }) => ( + {({ handleSubmit, errors, values, setFieldValue, handleChange, setFieldTouched }: FormikValues) => ( - {({ setRef, height }) => ( + {({ setRef, height }: { setRef: (instance: HTMLFormElement) => void; height: number | string }) => (
{is_appstore && (
- + {localize( 'We need this for verification. If the information you provide is fake or inaccurate, you won’t be able to deposit and withdraw.' )} @@ -201,7 +251,7 @@ const AddressDetails = ({ )} {states_list?.length > 0 ? ( - {({ field }) => ( + {({ field }: FormikValues) => ( <> { + onItemSelection={({ value, text }: TAutoComplete) => { setFieldValue( 'address_state', value ? text : '', @@ -236,7 +286,7 @@ const AddressDetails = ({ value={address_state_to_display || values.address_state} list_items={states_list} use_text={true} - onChange={e => { + onChange={(e: { target: { value: string } }) => { setFieldValue( 'address_state', e.target.value, diff --git a/packages/account/src/Components/address-details/index.js b/packages/account/src/Components/address-details/index.js index 627db7449b41..549993faa2ab 100644 --- a/packages/account/src/Components/address-details/index.js +++ b/packages/account/src/Components/address-details/index.js @@ -1,3 +1,3 @@ -import AddressDetails from './address-details.jsx'; +import AddressDetails from './address-details'; export default AddressDetails; diff --git a/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx b/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx index 7d1c3c71e0a4..cbaaa1a1fece 100644 --- a/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx +++ b/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx @@ -360,7 +360,7 @@ describe('', () => { value: 150, }); render( - + ); diff --git a/packages/account/src/Components/currency-selector/currency-selector.tsx b/packages/account/src/Components/currency-selector/currency-selector.tsx index 7509542e234f..37d9b0b89264 100644 --- a/packages/account/src/Components/currency-selector/currency-selector.tsx +++ b/packages/account/src/Components/currency-selector/currency-selector.tsx @@ -14,14 +14,14 @@ import { localize, Localize } from '@deriv/translations'; import RadioButtonGroup from './radio-button-group'; import RadioButton from './radio-button'; import { splitValidationResultTypes } from '../real-account-signup/helpers/utils'; -import { TAuthAccountInfo, TCurrencyConfig, TPlatformContext, TRealAccount, TFormValidation } from 'Types'; +import { TAuthAccountInfo, TCurrencyConfig, TRealAccount, TFormValidation } from 'Types'; export const Hr = () =>
; type TCurrencySelectorExtend = { accounts: { [key: string]: TAuthAccountInfo }; available_crypto_currencies: TCurrencyConfig[]; - getCurrentStep?: () => number; + getCurrentStep: () => number; goToNextStep: () => void; goToStep: (step: number) => void; goToPreviousStep: () => void; @@ -84,7 +84,7 @@ const CurrencySelector = ({ is_eu, ...props }: TCurrencySelector) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const crypto = legal_allowed_currencies.filter((currency: TCurrencyConfig) => currency.type === 'crypto'); const fiat = legal_allowed_currencies.filter((currency: TCurrencyConfig) => currency.type === 'fiat'); const [is_bypass_step, setIsBypassStep] = React.useState(false); @@ -195,7 +195,7 @@ const CurrencySelector = ({ > {({ handleSubmit, values }: FormikState & FormikHandlers) => ( - {({ setRef, height }: { setRef: string; height: number }) => ( + {({ setRef, height }: { setRef: (instance: HTMLFormElement | null) => void; height: number }) => ( - {reorderCurrencies(fiat).map((currency: TCurrencyConfig) => ( + {reorderCurrencies(fiat).map((currency: FormikValues) => ( - {reorderCurrencies(crypto, 'crypto').map( - (currency: TCurrencyConfig) => ( - - value === currency.value - )?.length === 0 - } - name='currency' - id={currency.value} - label={currency.name} - /> - ) - )} + {reorderCurrencies(crypto, 'crypto').map((currency: FormikValues) => ( + value === currency.value + )?.length === 0 + } + name='currency' + id={currency.value} + label={currency.name} + /> + ))} )} diff --git a/packages/account/src/Components/currency-selector/radio-button-group.tsx b/packages/account/src/Components/currency-selector/radio-button-group.tsx index 0c028cbfe850..31ae2ab10ead 100644 --- a/packages/account/src/Components/currency-selector/radio-button-group.tsx +++ b/packages/account/src/Components/currency-selector/radio-button-group.tsx @@ -5,7 +5,7 @@ import { Text } from '@deriv/components'; export type TRadioButtonGroup = { className: string; - is_fiat: boolean; + is_fiat?: boolean; is_title_enabled?: boolean; item_count: number; label: string; diff --git a/packages/account/src/Components/form-body-section/form-body-section.tsx b/packages/account/src/Components/form-body-section/form-body-section.tsx index 5c67baa36b47..5260fa2f86b0 100644 --- a/packages/account/src/Components/form-body-section/form-body-section.tsx +++ b/packages/account/src/Components/form-body-section/form-body-section.tsx @@ -2,7 +2,6 @@ import React from 'react'; import classNames from 'classnames'; import { Text } from '@deriv/components'; import { PlatformContext } from '@deriv/shared'; -import { TPlatformContext } from 'Types'; export type TFormBodySection = { has_side_note?: boolean; @@ -10,7 +9,8 @@ export type TFormBodySection = { }; const FormBodySection = ({ children, has_side_note, side_note }: React.PropsWithChildren) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + if (has_side_note) { return (
) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return (
{ - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); return (
diff --git a/packages/account/src/Components/leave-confirm/leave-confirm.tsx b/packages/account/src/Components/leave-confirm/leave-confirm.tsx index cb6af61d0ba8..fb60e32afad5 100644 --- a/packages/account/src/Components/leave-confirm/leave-confirm.tsx +++ b/packages/account/src/Components/leave-confirm/leave-confirm.tsx @@ -5,7 +5,6 @@ import { Button, Icon, Modal } from '@deriv/components'; import { isMobile, PlatformContext } from '@deriv/shared'; import { localize } from '@deriv/translations'; import IconMessageContent from 'Components/icon-message-content'; -import { TPlatformContext } from 'Types'; type TLeaveConfirmMessage = { back: () => void; @@ -18,7 +17,8 @@ type TTransitionBlocker = { }; const LeaveConfirmMessage = ({ back, leave }: TLeaveConfirmMessage) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return ( { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const message = localize('Your documents were submitted successfully'); if (needs_poi) { return ( diff --git a/packages/account/src/Components/poa/status/unverified/unverified.tsx b/packages/account/src/Components/poa/status/unverified/unverified.tsx index 65c5f50f426f..fcc5ec672c00 100644 --- a/packages/account/src/Components/poa/status/unverified/unverified.tsx +++ b/packages/account/src/Components/poa/status/unverified/unverified.tsx @@ -3,14 +3,14 @@ import { PlatformContext } from '@deriv/shared'; import { Button, Icon, Text } from '@deriv/components'; import { localize } from '@deriv/translations'; import IconMessageContent from 'Components/icon-message-content'; -import { TPlatformContext } from 'Types'; type TUnverified = { onClick: () => void; }; export const Unverified = ({ onClick }: TUnverified) => { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return ( { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const message = localize('Your proof of address is verified'); if (needs_poi) { diff --git a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx index e9cd8ba317aa..1a30c4cc71a6 100644 --- a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx +++ b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx @@ -15,7 +15,7 @@ jest.mock('@deriv/components', () => { describe('', () => { const renderWithRouter = component => render( - + {component} ); @@ -62,7 +62,7 @@ describe('', () => { it('should show missing msg with proper icon if has_invalid_postal_code is false and is_appstore is false', () => { render( - + diff --git a/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js b/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx similarity index 85% rename from packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js rename to packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx index a5d11cd8ff19..79e8de7583b4 100644 --- a/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js +++ b/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx @@ -10,7 +10,13 @@ jest.mock('@deriv/shared', () => ({ })); describe('', () => { - let mock_props = {}; + let mock_props = { + handleSelectionNext: jest.fn(), + is_from_external: false, + residence_list: [{ value: '', text: '' }], + selected_country: '', + setSelectedCountry: jest.fn(), + }; beforeEach(() => { mock_props = { @@ -29,14 +35,13 @@ describe('', () => { it('should render CountrySelector component external', () => { mock_props.is_from_external = true; - const { container } = render(); + render(); expect(screen.getByText('Proof of identity')).toBeInTheDocument(); expect(screen.getByText('In which country was your document issued?')).toBeInTheDocument(); expect(screen.getByText('Country')).toBeInTheDocument(); - const div_with_external_class = container.querySelector('.external-dropdown'); - expect(div_with_external_class).toBeInTheDocument(); + expect(screen.getByTestId('dt_external_dropdown')).toBeInTheDocument(); }); it('should show error message after clicking the input without choosing the country', async () => { @@ -59,8 +64,8 @@ describe('', () => { }); it('should trigger selection functions and next button', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); mock_props.selected_country = 'Country 2'; render(); diff --git a/packages/account/src/Components/poi/poi-country-selector/index.js b/packages/account/src/Components/poi/poi-country-selector/index.js index 343d64b642e8..479c572a67d1 100644 --- a/packages/account/src/Components/poi/poi-country-selector/index.js +++ b/packages/account/src/Components/poi/poi-country-selector/index.js @@ -1,3 +1,3 @@ -import CountrySelector from './poi-country-selector.jsx'; +import CountrySelector from './poi-country-selector'; export default CountrySelector; diff --git a/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx b/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx similarity index 78% rename from packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx rename to packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx index 0cc26836336b..d28514bb74f3 100644 --- a/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx +++ b/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx @@ -1,47 +1,57 @@ import React from 'react'; import { Autocomplete, Button, DesktopWrapper, MobileWrapper, Text, SelectNative } from '@deriv/components'; -import { Formik, Field } from 'formik'; +import { Formik, Field, FormikErrors, FormikValues, FormikHelpers } from 'formik'; import { localize } from '@deriv/translations'; import classNames from 'classnames'; import FormFooter from 'Components/form-footer'; +type TCountry = Record; + +type TCountrySelector = { + handleSelectionNext: () => void; + is_from_external: boolean; + residence_list: TCountry[]; + selected_country: string; + setSelectedCountry: (value: TCountry) => void; +}; + const CountrySelector = ({ handleSelectionNext, is_from_external, residence_list, selected_country, setSelectedCountry, -}) => { - const [country_list, setCountryList] = React.useState([]); +}: TCountrySelector) => { + const [country_list, setCountryList] = React.useState([]); - const initial_form_values = { + const initial_form_values: FormikValues = { country_input: '', }; - const validateFields = values => { - const errors = {}; + const validateFields = (values: FormikValues) => { + const errors: FormikErrors = {}; const { country_input } = values; if (!country_input) { errors.country_input = localize('Please select the country of document issuance.'); - } else if (!country_list.find(c => c.text === country_input)) { + } else if (!country_list.find((c: FormikValues) => c.text === country_input)) { errors.country_input = localize('Please select a valid country of document issuance.'); } return errors; }; - const updateSelectedCountry = country_name => { - const matching_country = country_list.find(c => c.text === country_name); + const updateSelectedCountry = (country_name: string) => { + const matching_country: TCountry | undefined = country_list.find((c: FormikValues) => c.text === country_name); if (matching_country) { - setSelectedCountry(matching_country); + setSelectedCountry?.(matching_country); } }; - const submitHandler = (values, { setSubmitting }) => { + const submitHandler = (values: FormikValues, { setSubmitting }: FormikHelpers) => { updateSelectedCountry(values.country_input); setSubmitting(false); - handleSelectionNext(); + handleSelectionNext?.(); }; React.useEffect(() => { @@ -76,12 +86,13 @@ const CountrySelector = ({
- {({ field }) => ( + {({ field }: FormikValues) => ( { + onBlur={(e: FormikValues) => { handleBlur(e); const current_input = e.target.value; - if (!country_list.find(c => c.text === current_input)) { + if ( + !country_list.find( + (c: FormikValues) => c.text === current_input + ) + ) { setFieldValue('country_input', '', true); updateSelectedCountry(''); } }} onChange={handleChange} - onItemSelection={({ text }) => { + onItemSelection={({ text }: FormikValues) => { const select_value = text === 'No results found' || !text ? '' : text; setFieldValue('country_input', select_value, true); @@ -118,7 +133,7 @@ const CountrySelector = ({ placeholder={localize('Please select')} list_items={country_list} value={values.country_input} - onChange={e => { + onChange={(e: React.ChangeEvent) => { handleChange(e); updateSelectedCountry(e.target.value); }} @@ -138,7 +153,7 @@ const CountrySelector = ({