From b51001f740d2ea893d5bd28b7e98651e40888bcf Mon Sep 17 00:00:00 2001 From: Michael Dekker Date: Mon, 20 Jan 2020 22:22:25 +0100 Subject: [PATCH 01/26] refactor: Redux toolkit + TypeScript --- .babelrc | 41 --- babel.config.js | 58 ++++ package.json | 11 +- src/{react => }/Actions/filters.js | 0 .../Actions/master_card_action_info.js | 26 +- .../Actions/master_card_actions.js | 6 +- src/{react => }/Actions/modal.js | 0 src/{react => }/Actions/note_texts.js | 2 +- src/{react => }/Actions/oauth.js | 0 src/{react => }/Actions/options.js | 0 src/{react => }/Actions/pagination.js | 0 src/{react => }/Actions/pay.js | 14 +- src/{react => }/Actions/payment_info.js | 4 +- src/{react => }/Actions/payments.js | 6 +- src/{react => }/Actions/pending_payments.js | 0 src/{react => }/Actions/queue.js | 0 src/{react => }/Actions/registration.js | 75 +++-- src/{react => }/Actions/request_inquiries.js | 4 +- src/{react => }/Actions/request_inquiry.js | 13 +- .../Actions/request_inquiry_batches.js | 4 +- .../Actions/request_inquiry_info.js | 4 +- src/{react => }/Actions/request_response.js | 21 +- .../Actions/request_response_info.js | 4 +- src/{react => }/Actions/request_responses.js | 4 +- src/{react => }/Actions/savings_goals.js | 0 src/{react => }/Actions/scheduled_payments.js | 2 +- ...share_invite_monetary_account_inquiries.js | 2 +- .../share_invite_monetary_account_inquiry.js | 9 +- .../share_invite_monetary_account_response.js | 8 +- ...share_invite_monetary_account_responses.js | 2 +- src/{react => }/Actions/sidebar.js | 0 src/{react => }/Actions/user.js | 8 +- src/{react => }/Actions/users.js | 2 +- src/{react => }/Reducers/general_filter.js | 0 src/{react => }/Reducers/index.js | 4 +- .../Reducers/master_card_action_info.js | 0 .../Reducers/master_card_actions.js | 7 +- src/{react => }/Reducers/modal.js | 0 src/{react => }/Reducers/note_texts.js | 0 src/{react => }/Reducers/oauth.js | 2 +- src/{react => }/Reducers/options.js | 2 +- src/{react => }/Reducers/pagination.js | 0 src/{react => }/Reducers/pay.js | 0 src/{react => }/Reducers/payment_filter.js | 0 src/{react => }/Reducers/payment_info.js | 0 src/{react => }/Reducers/payments.js | 6 +- src/{react => }/Reducers/pending_payments.js | 6 +- src/{react => }/Reducers/queue.js | 0 src/{react => }/Reducers/registration.js | 0 src/{react => }/Reducers/request_filter.js | 0 src/{react => }/Reducers/request_inquiries.js | 6 +- src/{react => }/Reducers/request_inquiry.js | 0 .../Reducers/request_inquiry_batches.js | 6 +- .../Reducers/request_inquiry_info.js | 0 src/{react => }/Reducers/request_response.js | 0 .../Reducers/request_response_info.js | 0 src/{react => }/Reducers/request_responses.js | 6 +- src/{react => }/Reducers/savings_goals.js | 6 +- .../Reducers/scheduled_payments.js | 0 src/{react => }/Reducers/search_filter.js | 0 ...share_invite_monetary_account_inquiries.js | 4 +- .../share_invite_monetary_account_inquiry.js | 0 ...share_invite_monetary_account_responses.js | 4 +- src/{react => }/Reducers/sidebar.js | 0 src/{react => }/Reducers/user.js | 0 src/{react => }/Reducers/users.js | 0 src/app.js | 2 - src/app.ts | 5 + src/{background.js => background.ts} | 28 +- .../AccountCard.tsx} | 16 +- .../AccountAvatarCircularProgress.tsx} | 10 +- .../AccountList/AccountList.tsx} | 63 ++-- .../AccountList/AccountListItem.tsx} | 51 +-- .../AccountList/AccountListItemChip.tsx} | 2 +- .../AccountList/AddAccount.tsx} | 2 +- .../AliasList.tsx} | 6 +- src/{react/App.jsx => components/App.tsx} | 18 +- .../AttachmentImage/AttachmentImage.tsx} | 14 +- .../AttachmentImage/LazyAttachmentImage.tsx} | 4 +- .../BunqDesktopClient.ts | 10 +- .../BunqMeTabList.tsx} | 20 +- .../Categories/CategoryChip.tsx} | 3 +- .../Categories/CategoryChips.tsx} | 30 +- .../Categories/CategoryEditor.tsx} | 41 ++- .../Categories/CategoryHelper.ts} | 0 .../Categories/CategoryIcon.tsx} | 0 .../Categories/CategoryIcons.tsx} | 0 .../Categories/CategorySelector.tsx} | 24 +- .../Categories/CategorySelectorDialog.tsx} | 6 +- .../Categories/PrioritySorter.ts} | 0 .../CodeSplitting/ComponentLoader.tsx} | 0 .../CodeSplitting/Loading.tsx} | 4 +- .../CombinedList/CombinedList.tsx} | 29 +- .../CombinedList/EventData.tsx} | 2 +- .../CombinedList/ListControls.tsx} | 0 .../CombinedList/MapperFunctions.tsx} | 4 +- .../CopyToClipboardWrap.tsx} | 0 .../CustomIcon.tsx} | 0 .../CustomSVG/FileDownload.tsx} | 0 .../CustomSVG/FileUpload.tsx} | 0 .../CustomSVG/Maximize.tsx} | 0 .../CustomSVG/Minimize.tsx} | 0 .../CustomSVG/Restore.tsx} | 0 .../CustomSVG/Trophy.tsx} | 0 .../ErrorBoundary.tsx} | 10 +- .../ExportDialog.tsx} | 8 +- .../FileUpload/FilePicker.tsx} | 0 .../FileUpload/UploadFullscreen.tsx} | 7 +- .../FilterComponents/AccountSelection.tsx} | 6 +- .../FilterComponents/AmountFilter.tsx} | 6 +- .../FilterComponents/CardSelection.tsx} | 18 +- .../FilterComponents/CategorySelection.tsx} | 6 +- .../FilterComponents/ClearFilter.tsx} | 4 +- .../FilterComponents/FilterDrawer.tsx} | 8 +- .../FilterComponents/SearchFilter.tsx} | 2 +- .../FilterCreationDialog.tsx} | 2 +- .../FormFields/AccountSelectorDialog.tsx} | 6 +- .../FormFields/ColorPicker.tsx} | 0 .../FormFields/EmailSuggestions.tsx} | 0 .../FormFields/FilePicker.tsx} | 0 .../FormFields/GradientColorPicker.tsx} | 0 .../FormFields/IconPicker.tsx} | 29 +- .../FormFields/InputSuggestions.tsx} | 0 .../FormFields/MoneyFormatInput.tsx} | 2 +- .../FormFields/MoneyFormatInputDefault.tsx} | 2 +- .../FormFields/RedirectUrl.tsx} | 0 .../FormFields/SchedulePaymentForm.tsx} | 4 +- .../FormFields/TargetChip.tsx} | 0 .../FormFields/TargetChipList.tsx} | 0 .../FormFields/TargetSelection.tsx} | 27 +- .../GeoLocation/GeoLocationListItem.tsx} | 4 +- .../GeoLocation/GeoLocationMap.tsx} | 0 .../GeoLocation/GeoLocationView.tsx} | 2 +- .../Header.jsx => components/Header.tsx} | 20 +- .../ImportDialog.tsx | 0 .../Layout.jsx => components/Layout.tsx} | 56 ++-- .../LimitedPremiumListItem.tsx} | 2 +- .../LinearProgress.tsx} | 6 +- .../ListItemWrapper.tsx} | 0 .../ListItems/BunqMeTabListItem.tsx} | 2 +- .../ListItems/MasterCardActionListItem.tsx} | 8 +- .../ListItems/PaymentListItem.tsx} | 6 +- .../RequestInquiryBatchListItem.tsx} | 2 +- .../ListItems/RequestInquiryListItem.tsx} | 6 +- .../ListItems/RequestResponseListItem.tsx} | 8 +- .../ShareInviteBankTypes/DraftAccess.tsx} | 0 .../ShareInviteBankTypes/FullAccess.tsx} | 0 .../ShareInviteBankTypes/ShowOnly.tsx} | 0 ...eInviteMonetaryAccountInquiryListItem.tsx} | 6 +- ...InviteMonetaryAccountResponseListItem.tsx} | 6 +- .../MainDialog.tsx} | 2 +- .../MainSnackbar.tsx} | 11 +- .../MoneyAmountLabel.tsx} | 0 .../NetworkStatusChecker.tsx} | 12 +- .../NoteTexts/NoteTextForm.tsx} | 4 +- .../NoteTexts/NoteTextItem.tsx} | 4 +- .../PDFExportHelper/Base64BunqLogo.ts} | 0 .../PDFExportHelper/PDFExportHelper.tsx} | 40 +-- .../QR/AccountQRCode.tsx} | 0 .../QR/AccountQRFullscreen.tsx} | 18 +- .../QRCode.jsx => components/QR/QRCode.tsx} | 0 .../QR/QRSvg.jsx => components/QR/QRSvg.tsx} | 0 .../Queue/QueueHeaderIcon.tsx} | 9 +- .../Queue/QueueManager.tsx} | 78 +++-- .../Queue/QueueSidebarListItem.tsx} | 15 +- .../ReactJsonWrapper.tsx} | 0 .../Fields/renderAccountsPicker.tsx} | 0 .../ReduxForm/Fields/renderAmountField.tsx} | 0 .../Fields/renderColorPickerGradient.tsx} | 0 .../Fields/renderDateTimePicker.tsx} | 6 +- .../ReduxForm/Fields/renderTextField.tsx} | 0 .../ReduxForm/Validators.ts} | 2 +- .../Routes.jsx => components/Routes.tsx} | 70 ++-- .../Routing/NavLink.tsx} | 1 - .../Routing/PrivateRoute.tsx} | 0 .../Routing/PublicRoute.tsx} | 0 .../RuleCollectionChecker.tsx} | 35 +- .../SavingsGoals/Helpers.ts} | 6 +- .../SavingsGoals/SavingsGoalListItem.tsx} | 6 +- .../SavingsGoalListItemWrapper.tsx} | 2 +- .../SavingsGoalSmallListItem.tsx} | 0 .../SavingsGoals/SavingsGoalsList.tsx} | 0 .../Sidebar.jsx => components/Sidebar.tsx} | 8 +- .../SpeedDial.tsx} | 0 .../SwitchKeysMenu.tsx} | 6 +- .../TransactionHeader.tsx} | 2 +- .../TranslationHelpers/Button.tsx} | 0 .../TranslationHelpers/MenuItem.tsx} | 0 .../TranslationHelpers/Typography.tsx} | 0 src/{react/i18n.jsx => components/i18n.tsx} | 10 +- .../react-app.tsx} | 4 +- src/{env.js => env.ts} | 0 .../Analytics.js => functions/Analytics.ts} | 4 +- .../BunqErrorHandler.ts} | 41 ++- .../ConnectGetPermissions.ts} | 2 +- .../Crypto.js => functions/Crypto/Crypto.ts} | 0 .../Crypto/CryptoWorkerWrapper.ts} | 2 +- .../Crypto/CustomForge.ts} | 0 .../DataFilters.ts} | 2 +- .../DefaultImageHandlers.ts} | 0 .../EventStatusTexts.ts} | 0 .../FilterDisabledChecker.ts} | 0 .../IpChecker.js => functions/IpChecker.ts} | 0 .../IsDarwin.js => functions/IsDarwin.ts} | 2 +- .../Logger.js => functions/Logger.ts} | 0 .../MergeApiObjects.ts} | 0 .../NoteTextTypeParser.ts} | 0 .../NotificationHelper.ts} | 0 .../PhoneLib.js => functions/PhoneLib.ts} | 0 .../ScheduleTexts.ts} | 0 .../StatsFormattingTemplates.ts} | 0 .../Functions/Utils.js => functions/Utils.ts} | 0 .../VersionChecker.ts} | 0 .../{context_menu.js => context_menu.ts} | 0 src/helpers/{devtools.js => devtools.ts} | 0 .../{external_links.js => external_links.ts} | 0 src/helpers/{oauth.js => oauth.ts} | 0 .../{react_navigate.js => react_navigate.ts} | 0 src/helpers/{settings.js => settings.ts} | 0 src/helpers/{shortcuts.js => shortcuts.ts} | 0 src/helpers/{touchbar.js => touchbar.ts} | 0 src/helpers/{tray.js => tray.ts} | 0 src/helpers/{window.js => window.ts} | 0 ...{i18n-background.js => i18n-background.ts} | 0 .../README.md | 0 .../electronSettings.ts} | 0 .../fs.js => importwrappers/fs.ts} | 0 .../localforage.ts} | 0 .../os.js => importwrappers/os.ts} | 0 .../path.js => importwrappers/path.ts} | 0 .../Locales => locales}/Crowdin/.gitkeep | 0 src/{react/Locales => locales}/de.json | 0 src/{react/Locales => locales}/en.json | 0 src/{react/Locales => locales}/es.json | 0 src/{react/Locales => locales}/gr.json | 0 src/{react/Locales => locales}/it.json | 0 src/{react/Locales => locales}/nl.json | 0 ..._templates.js => darwin_menu_templates.ts} | 0 ..._menu_template.js => dev_menu_template.ts} | 0 ...menu_template.js => edit_menu_template.ts} | 0 ...menu_template.js => help_menu_template.ts} | 0 ...menu_template.js => view_menu_template.ts} | 0 ...nu_template.js => window_menu_template.ts} | 0 src/misc/consts.ts | 14 + src/{react/Models => models}/BunqMeTab.ts | 4 +- src/{react/Models => models}/Card.ts | 4 +- .../Models => models}/MasterCardAction.ts | 4 +- .../Models => models}/MonetaryAccount.ts | 4 +- src/{react/Models => models}/Payment.ts | 4 +- .../Models => models}/RequestInquiry.ts | 4 +- .../Models => models}/RequestInquiryBatch.ts | 4 +- .../Models => models}/RequestResponse.ts | 4 +- src/{react/Models => models}/SavingsGoal.ts | 4 +- .../AccountInfo.jsx => pages/AccountInfo.tsx} | 59 ++-- .../AddAccount.jsx => pages/AddAccount.tsx} | 18 +- .../ApplicationInfo.tsx} | 23 +- .../BunqMePersonal/BunqMePersonal.tsx} | 5 +- .../BunqMePersonal/LinkPreviewField.tsx} | 4 +- .../BunqMeTab/BunqMeTab.tsx} | 11 +- .../BunqMeTab/BunqMeTabForm.tsx} | 22 +- .../BunqMeTab/ConfirmationDialog.tsx} | 4 +- .../Cards/CardListItem.tsx} | 3 +- .../Cards/Cards.jsx => pages/Cards/Cards.tsx} | 29 +- .../Cards/CvcCodeListItem.tsx} | 10 +- .../Cards/VirtualAccountNumbersDialog.tsx} | 10 +- .../CategoryDashboard/CategoryDashboard.tsx} | 30 +- .../Connect/BudgetFields.tsx} | 8 +- .../Connect.jsx => pages/Connect/Connect.tsx} | 48 +-- .../Connect/ConnectListItem.tsx} | 12 +- .../Connect/ConnectSettingItem.tsx} | 0 .../Connect/TimeLimitFields.tsx} | 0 .../Contacts/ContactHeader.tsx} | 4 +- .../Contacts/Contacts.tsx} | 24 +- .../Dashboard/AddMoneyButton.tsx} | 2 +- .../Dashboard/Dashboard.tsx} | 16 +- .../DebugPage.jsx => pages/DebugPage.tsx} | 2 +- .../Disclaimer.jsx => pages/Disclaimer.tsx} | 6 +- .../Pages/Exports.jsx => pages/Exports.tsx} | 49 +-- .../Login/Login.jsx => pages/Login/Login.tsx} | 12 +- .../Login/OAuthManagement.tsx} | 23 +- .../Login/SideOptions.tsx} | 4 +- .../LoginPassword.tsx} | 8 +- .../MasterCardActionInfo.tsx} | 38 ++- .../Pages/NotFound.jsx => pages/NotFound.tsx} | 2 +- .../Pay/ConfirmationDialog.tsx} | 2 +- .../Pages/Pay/Pay.jsx => pages/Pay/Pay.tsx} | 46 +-- .../PaymentInfo.jsx => pages/PaymentInfo.tsx} | 48 +-- .../PendingPayments/ConfirmationDialog.tsx} | 0 .../PendingPayments/PendingPaymentRow.tsx} | 6 +- .../PendingPayments/PendingPayments.tsx} | 22 +- .../Address.jsx => pages/Profile/Address.tsx} | 4 +- .../Profile/BillingInfo.tsx} | 0 .../Profile/BusinessInfo.tsx} | 4 +- .../Profile/NotificationFilters.tsx} | 6 +- .../Profile.jsx => pages/Profile/Profile.tsx} | 27 +- .../Profile/ProfileDetailsForm.tsx} | 8 +- .../RequestInquiry/ConfirmationDialog.tsx} | 2 +- .../RequestInquiry/Options/AllowBunqMe.tsx} | 0 .../RequestInquiry/Options/MinimumAge.tsx} | 0 .../RequestInquiry/RequestInquiry.tsx} | 29 +- .../RequestInquiry/SplitAmountForm.tsx} | 2 +- .../RequestInquiry/SplitAmountItem.tsx} | 4 +- .../RequestInquiry/TotalSplitHelper.ts} | 0 .../RequestInquiryInfo.tsx} | 46 +-- .../RequestResponseInfo/AddressForm.tsx} | 0 .../RequestResponseInfo.tsx} | 61 ++-- .../RuleDashboard/RuleCollectionItem.tsx} | 8 +- .../RuleDashboard/RuleDashboard.tsx} | 52 +-- .../RulePage/NewRuleItemMenu.tsx | 4 +- .../RulePage/RuleCollectionMenu.tsx | 2 +- .../RulePage/RuleCollectionPreview.tsx | 8 +- .../RulePage/RuleCollectionPreviewItem.tsx | 14 +- .../Pages => pages}/RulePage/RuleCreator.tsx | 16 +- .../Pages => pages}/RulePage/RuleItemMenu.tsx | 2 +- .../RulePage/RulePage.tsx} | 19 +- .../RuleTypeItems/AccountRuleItem.tsx | 6 +- .../RuleTypeItems/ItemTypeRuleItem.tsx | 6 +- .../TransactionAmountRuleItem.tsx | 8 +- .../RulePage/RuleTypeItems/ValueRuleItem.tsx | 4 +- .../SavingsGoalPage/SavingsGoalForm.tsx} | 14 +- .../SavingsGoalPage/SavingsGoalPage.tsx} | 21 +- .../renderAmountFieldCustom.tsx} | 8 +- .../SavingsGoals/SavingsGoals.tsx} | 26 +- .../ScheduledPaymentItem.tsx} | 12 +- .../ScheduledPayments/ScheduledPayments.tsx} | 16 +- .../ScheduledPaymentsEditDialog.tsx} | 10 +- .../Settings/EditPasswordForm.tsx} | 6 +- .../Settings/Settings.tsx} | 70 ++-- .../Chart/PieChart/CategoryCountPieChart.tsx} | 1 + .../PieChart/CategoryTransactionPieChart.tsx} | 3 +- .../Chart/PieChart/EventCountPieChart.tsx} | 1 + .../PieChart/EventSplitCountPieChart.tsx} | 1 + .../EventSplitTransactionPieChart.tsx} | 3 +- .../PieChart/EventTransactionPieChart.tsx} | 3 +- .../Timeline/CategoryCountHistoryChart.tsx} | 2 +- .../CategoryTransactionHistoryChart.tsx} | 2 +- .../Chart/Timeline/EventTypeHistoryChart.tsx} | 2 +- .../Timeline/EventTypeSplitHistoryChart.tsx} | 2 +- ...EventTypeSplitTransactionHistoryChart.tsx} | 2 +- .../EventTypeTransactionHistoryChart.tsx} | 2 +- .../Stats/ChartTitle.tsx} | 0 .../Colors.jsx => pages/Stats/Colors.tsx} | 0 .../Stats/EventCountSection.tsx} | 0 .../Stats/EventCountSidebarSection.tsx} | 4 +- .../Stats/EventHistorySection.tsx} | 0 .../Stats/Stats.jsx => pages/Stats/Stats.tsx} | 14 +- .../SwitchApiKeys.tsx} | 4 +- src/react/Actions/accounts.js | 294 ----------------- src/react/Actions/application.js | 41 --- src/react/Actions/bunq_me_tab.js | 51 --- src/react/Actions/bunq_me_tabs.js | 76 ----- src/react/Actions/card_cvc2.js | 69 ---- src/react/Actions/cards.js | 71 ---- src/react/Actions/categories.js | 71 ---- src/react/Actions/category_rules.ts | 32 -- src/react/Actions/contacts.js | 307 ------------------ src/react/Actions/export_new.js | 37 --- src/react/Actions/exports.js | 52 --- src/react/Actions/snackbar.js | 14 - src/react/Reducers/account_id_filter.js | 47 --- src/react/Reducers/accounts.js | 144 -------- src/react/Reducers/amount_filter.js | 29 -- src/react/Reducers/application.js | 45 --- src/react/Reducers/bunq_me_tab.js | 20 -- src/react/Reducers/bunq_me_tab_filter.js | 28 -- src/react/Reducers/bunq_me_tabs.js | 93 ------ src/react/Reducers/card_cvc2.js | 40 --- src/react/Reducers/card_id_filter.js | 47 --- src/react/Reducers/cards.js | 65 ---- src/react/Reducers/category_filter.js | 42 --- src/react/Reducers/category_rules.ts | 127 -------- src/react/Reducers/contacts.js | 152 --------- src/react/Reducers/date_filter.js | 36 -- src/react/Reducers/export_new.js | 17 - src/react/Reducers/exports.js | 39 --- src/react/Reducers/snackbar.js | 24 -- src/react/Store.jsx | 19 -- .../CountryCodes.json | 0 .../StaticData => staticdata}/Icons.json | 0 src/store/accountIdFilter/index.ts | 50 +++ src/store/accounts/index.ts | 160 +++++++++ src/store/accounts/thunks.ts | 227 +++++++++++++ src/store/amountFilter/index.ts | 34 ++ src/store/application/index.ts | 52 +++ src/store/bunqMeTab/index.ts | 24 ++ src/store/bunqMeTab/thunks.ts | 60 ++++ src/store/bunqMeTabFilter/index.ts | 38 +++ src/store/bunqMeTabs/index.ts | 130 ++++++++ src/store/bunqMeTabs/thunks.ts | 60 ++++ src/store/cardCvc2/index.ts | 63 ++++ src/store/cardCvc2/thunks.ts | 50 +++ src/store/cardIdFilter/index.ts | 56 ++++ src/store/cards/index.ts | 89 +++++ src/store/cards/thunks.ts | 55 ++++ .../categories/index.ts} | 213 +++++++----- src/store/categoryFilter/index.ts | 45 +++ src/store/categoryRules/index.ts | 122 +++++++ src/store/contacts/index.ts | 188 +++++++++++ src/store/contacts/thunks.ts | 272 ++++++++++++++++ src/store/dateFilter/index.ts | 42 +++ src/store/exportNew/index.ts | 28 ++ src/store/exportNew/thunks.ts | 34 ++ src/store/exports/index.ts | 59 ++++ src/store/exports/thunks.ts | 33 ++ src/store/index.ts | 160 +++++++++ src/store/snackbar/index.ts | 39 +++ .../DarkTheme.jsx => themes/DarkTheme.ts} | 0 .../DefaultTheme.ts} | 0 src/types/Category.ts | 9 + src/{react/Types => types}/Event.ts | 0 src/{react/Types => types}/RuleCollection.ts | 4 +- .../Types => types}/Rules/AccountRule.ts | 0 src/{react/Types => types}/Rules/Rule.ts | 0 .../Rules/TransactionAmountRule.ts | 0 src/{react/Types => types}/Rules/TypeRule.ts | 0 src/{react/Types => types}/Rules/ValueRule.ts | 0 src/{react/Types => types}/Types.ts | 2 +- .../crypto.worker.js | 2 +- .../rule_collection_check.worker.js | 2 +- .../WebWorkers => webworkers}/stats.worker.js | 14 +- tasks/build_app.js | 4 +- tasks/bundle.js | 2 + tasks/generate_icons.js | 2 +- tasks/update_translations.js | 4 +- tsconfig.json | 28 +- webpack.config.js | 4 +- webpacktools.js | 66 ++++ yarn.lock | 189 ++++++++++- 428 files changed, 4061 insertions(+), 3482 deletions(-) delete mode 100644 .babelrc create mode 100644 babel.config.js rename src/{react => }/Actions/filters.js (100%) rename src/{react => }/Actions/master_card_action_info.js (93%) rename src/{react => }/Actions/master_card_actions.js (93%) rename src/{react => }/Actions/modal.js (100%) rename src/{react => }/Actions/note_texts.js (98%) rename src/{react => }/Actions/oauth.js (100%) rename src/{react => }/Actions/options.js (100%) rename src/{react => }/Actions/pagination.js (100%) rename src/{react => }/Actions/pay.js (90%) rename src/{react => }/Actions/payment_info.js (93%) rename src/{react => }/Actions/payments.js (93%) rename src/{react => }/Actions/pending_payments.js (100%) rename src/{react => }/Actions/queue.js (100%) rename src/{react => }/Actions/registration.js (84%) rename src/{react => }/Actions/request_inquiries.js (95%) rename src/{react => }/Actions/request_inquiry.js (82%) rename src/{react => }/Actions/request_inquiry_batches.js (95%) rename src/{react => }/Actions/request_inquiry_info.js (93%) rename src/{react => }/Actions/request_response.js (79%) rename src/{react => }/Actions/request_response_info.js (93%) rename src/{react => }/Actions/request_responses.js (95%) rename src/{react => }/Actions/savings_goals.js (100%) rename src/{react => }/Actions/scheduled_payments.js (97%) rename src/{react => }/Actions/share_invite_monetary_account_inquiries.js (97%) rename src/{react => }/Actions/share_invite_monetary_account_inquiry.js (89%) rename src/{react => }/Actions/share_invite_monetary_account_response.js (85%) rename src/{react => }/Actions/share_invite_monetary_account_responses.js (97%) rename src/{react => }/Actions/sidebar.js (100%) rename src/{react => }/Actions/user.js (89%) rename src/{react => }/Actions/users.js (94%) rename src/{react => }/Reducers/general_filter.js (100%) rename src/{react => }/Reducers/index.js (98%) rename src/{react => }/Reducers/master_card_action_info.js (100%) rename src/{react => }/Reducers/master_card_actions.js (90%) rename src/{react => }/Reducers/modal.js (100%) rename src/{react => }/Reducers/note_texts.js (100%) rename src/{react => }/Reducers/oauth.js (98%) rename src/{react => }/Reducers/options.js (99%) rename src/{react => }/Reducers/pagination.js (100%) rename src/{react => }/Reducers/pay.js (100%) rename src/{react => }/Reducers/payment_filter.js (100%) rename src/{react => }/Reducers/payment_info.js (100%) rename src/{react => }/Reducers/payments.js (92%) rename src/{react => }/Reducers/pending_payments.js (95%) rename src/{react => }/Reducers/queue.js (100%) rename src/{react => }/Reducers/registration.js (100%) rename src/{react => }/Reducers/request_filter.js (100%) rename src/{react => }/Reducers/request_inquiries.js (93%) rename src/{react => }/Reducers/request_inquiry.js (100%) rename src/{react => }/Reducers/request_inquiry_batches.js (93%) rename src/{react => }/Reducers/request_inquiry_info.js (100%) rename src/{react => }/Reducers/request_response.js (100%) rename src/{react => }/Reducers/request_response_info.js (100%) rename src/{react => }/Reducers/request_responses.js (93%) rename src/{react => }/Reducers/savings_goals.js (96%) rename src/{react => }/Reducers/scheduled_payments.js (100%) rename src/{react => }/Reducers/search_filter.js (100%) rename src/{react => }/Reducers/share_invite_monetary_account_inquiries.js (93%) rename src/{react => }/Reducers/share_invite_monetary_account_inquiry.js (100%) rename src/{react => }/Reducers/share_invite_monetary_account_responses.js (93%) rename src/{react => }/Reducers/sidebar.js (100%) rename src/{react => }/Reducers/user.js (100%) rename src/{react => }/Reducers/users.js (100%) delete mode 100644 src/app.js create mode 100644 src/app.ts rename src/{background.js => background.ts} (91%) rename src/{react/Components/AccountCard.jsx => components/AccountCard.tsx} (91%) rename src/{react/Components/AccountList/AccountAvatarCircularProgress.jsx => components/AccountList/AccountAvatarCircularProgress.tsx} (93%) rename src/{react/Components/AccountList/AccountList.jsx => components/AccountList/AccountList.tsx} (87%) rename src/{react/Components/AccountList/AccountListItem.jsx => components/AccountList/AccountListItem.tsx} (88%) rename src/{react/Components/AccountList/AccountListItemChip.jsx => components/AccountList/AccountListItemChip.tsx} (93%) rename src/{react/Components/AccountList/AddAccount.jsx => components/AccountList/AddAccount.tsx} (94%) rename src/{react/Components/AliasList.jsx => components/AliasList.tsx} (86%) rename src/{react/App.jsx => components/App.tsx} (70%) rename src/{react/Components/AttachmentImage/AttachmentImage.jsx => components/AttachmentImage/AttachmentImage.tsx} (89%) rename src/{react/Components/AttachmentImage/LazyAttachmentImage.jsx => components/AttachmentImage/LazyAttachmentImage.tsx} (92%) rename src/{react => components}/BunqDesktopClient.ts (98%) rename src/{react/Components/BunqMeTabList.jsx => components/BunqMeTabList.tsx} (92%) rename src/{react/Components/Categories/CategoryChip.jsx => components/Categories/CategoryChip.tsx} (97%) rename src/{react/Components/Categories/CategoryChips.jsx => components/Categories/CategoryChips.tsx} (79%) rename src/{react/Components/Categories/CategoryEditor.jsx => components/Categories/CategoryEditor.tsx} (89%) rename src/{react/Components/Categories/CategoryHelper.js => components/Categories/CategoryHelper.ts} (100%) rename src/{react/Components/Categories/CategoryIcon.jsx => components/Categories/CategoryIcon.tsx} (100%) rename src/{react/Components/Categories/CategoryIcons.jsx => components/Categories/CategoryIcons.tsx} (100%) rename src/{react/Components/Categories/CategorySelector.jsx => components/Categories/CategorySelector.tsx} (81%) rename src/{react/Components/Categories/CategorySelectorDialog.jsx => components/Categories/CategorySelectorDialog.tsx} (87%) rename src/{react/Components/Categories/PrioritySorter.js => components/Categories/PrioritySorter.ts} (100%) rename src/{react/Components/CodeSplitting/ComponentLoader.jsx => components/CodeSplitting/ComponentLoader.tsx} (100%) rename src/{react/Components/CodeSplitting/Loading.jsx => components/CodeSplitting/Loading.tsx} (81%) rename src/{react/Components/CombinedList/CombinedList.jsx => components/CombinedList/CombinedList.tsx} (96%) rename src/{react/Components/CombinedList/EventData.jsx => components/CombinedList/EventData.tsx} (98%) rename src/{react/Components/CombinedList/ListControls.jsx => components/CombinedList/ListControls.tsx} (100%) rename src/{react/Components/CombinedList/MapperFunctions.jsx => components/CombinedList/MapperFunctions.tsx} (99%) rename src/{react/Components/CopyToClipboardWrap.jsx => components/CopyToClipboardWrap.tsx} (100%) rename src/{react/Components/CustomIcon.jsx => components/CustomIcon.tsx} (100%) rename src/{react/Components/CustomSVG/FileDownload.jsx => components/CustomSVG/FileDownload.tsx} (100%) rename src/{react/Components/CustomSVG/FileUpload.jsx => components/CustomSVG/FileUpload.tsx} (100%) rename src/{react/Components/CustomSVG/Maximize.jsx => components/CustomSVG/Maximize.tsx} (100%) rename src/{react/Components/CustomSVG/Minimize.jsx => components/CustomSVG/Minimize.tsx} (100%) rename src/{react/Components/CustomSVG/Restore.jsx => components/CustomSVG/Restore.tsx} (100%) rename src/{react/Components/CustomSVG/Trophy.jsx => components/CustomSVG/Trophy.tsx} (100%) rename src/{react/Components/ErrorBoundary.jsx => components/ErrorBoundary.tsx} (87%) rename src/{react/Components/ExportDialog.jsx => components/ExportDialog.tsx} (92%) rename src/{react/Components/FileUpload/FilePicker.jsx => components/FileUpload/FilePicker.tsx} (100%) rename src/{react/Components/FileUpload/UploadFullscreen.jsx => components/FileUpload/UploadFullscreen.tsx} (95%) rename src/{react/Components/FilterComponents/AccountSelection.jsx => components/FilterComponents/AccountSelection.tsx} (98%) rename src/{react/Components/FilterComponents/AmountFilter.jsx => components/FilterComponents/AmountFilter.tsx} (95%) rename src/{react/Components/FilterComponents/CardSelection.jsx => components/FilterComponents/CardSelection.tsx} (94%) rename src/{react/Components/FilterComponents/CategorySelection.jsx => components/FilterComponents/CategorySelection.tsx} (98%) rename src/{react/Components/FilterComponents/ClearFilter.jsx => components/FilterComponents/ClearFilter.tsx} (95%) rename src/{react/Components/FilterComponents/FilterDrawer.jsx => components/FilterComponents/FilterDrawer.tsx} (99%) rename src/{react/Components/FilterComponents/SearchFilter.jsx => components/FilterComponents/SearchFilter.tsx} (95%) rename src/{react/Components/FilterCreationDialog.jsx => components/FilterCreationDialog.tsx} (98%) rename src/{react/Components/FormFields/AccountSelectorDialog.jsx => components/FormFields/AccountSelectorDialog.tsx} (96%) rename src/{react/Components/FormFields/ColorPicker.jsx => components/FormFields/ColorPicker.tsx} (100%) rename src/{react/Components/FormFields/EmailSuggestions.jsx => components/FormFields/EmailSuggestions.tsx} (100%) rename src/{react/Components/FormFields/FilePicker.jsx => components/FormFields/FilePicker.tsx} (100%) rename src/{react/Components/FormFields/GradientColorPicker.jsx => components/FormFields/GradientColorPicker.tsx} (100%) rename src/{react/Components/FormFields/IconPicker.jsx => components/FormFields/IconPicker.tsx} (90%) rename src/{react/Components/FormFields/InputSuggestions.jsx => components/FormFields/InputSuggestions.tsx} (100%) rename src/{react/Components/FormFields/MoneyFormatInput.jsx => components/FormFields/MoneyFormatInput.tsx} (97%) rename src/{react/Components/FormFields/MoneyFormatInputDefault.jsx => components/FormFields/MoneyFormatInputDefault.tsx} (97%) rename src/{react/Components/FormFields/RedirectUrl.jsx => components/FormFields/RedirectUrl.tsx} (100%) rename src/{react/Components/FormFields/SchedulePaymentForm.jsx => components/FormFields/SchedulePaymentForm.tsx} (97%) rename src/{react/Components/FormFields/TargetChip.jsx => components/FormFields/TargetChip.tsx} (100%) rename src/{react/Components/FormFields/TargetChipList.jsx => components/FormFields/TargetChipList.tsx} (100%) rename src/{react/Components/FormFields/TargetSelection.jsx => components/FormFields/TargetSelection.tsx} (95%) rename src/{react/Components/GeoLocation/GeoLocationListItem.jsx => components/GeoLocation/GeoLocationListItem.tsx} (94%) rename src/{react/Components/GeoLocation/GeoLocationMap.jsx => components/GeoLocation/GeoLocationMap.tsx} (100%) rename src/{react/Components/GeoLocation/GeoLocationView.jsx => components/GeoLocation/GeoLocationView.tsx} (95%) rename src/{react/Components/Header.jsx => components/Header.tsx} (95%) rename src/{react/Components => components}/ImportDialog.tsx (100%) rename src/{react/Components/Layout.jsx => components/Layout.tsx} (89%) rename src/{react/Components/LimitedPremiumListItem.jsx => components/LimitedPremiumListItem.tsx} (97%) rename src/{react/Components/LinearProgress.jsx => components/LinearProgress.tsx} (90%) rename src/{react/Components/ListItemWrapper.jsx => components/ListItemWrapper.tsx} (100%) rename src/{react/Components/ListItems/BunqMeTabListItem.jsx => components/ListItems/BunqMeTabListItem.tsx} (99%) rename src/{react/Components/ListItems/MasterCardActionListItem.jsx => components/ListItems/MasterCardActionListItem.tsx} (92%) rename src/{react/Components/ListItems/PaymentListItem.jsx => components/ListItems/PaymentListItem.tsx} (96%) rename src/{react/Components/ListItems/RequestInquiryBatchListItem.jsx => components/ListItems/RequestInquiryBatchListItem.tsx} (99%) rename src/{react/Components/ListItems/RequestInquiryListItem.jsx => components/ListItems/RequestInquiryListItem.tsx} (94%) rename src/{react/Components/ListItems/RequestResponseListItem.jsx => components/ListItems/RequestResponseListItem.tsx} (92%) rename src/{react/Components/ListItems/ShareInviteBankTypes/DraftAccess.jsx => components/ListItems/ShareInviteBankTypes/DraftAccess.tsx} (100%) rename src/{react/Components/ListItems/ShareInviteBankTypes/FullAccess.jsx => components/ListItems/ShareInviteBankTypes/FullAccess.tsx} (100%) rename src/{react/Components/ListItems/ShareInviteBankTypes/ShowOnly.jsx => components/ListItems/ShareInviteBankTypes/ShowOnly.tsx} (100%) rename src/{react/Components/ListItems/ShareInviteMonetaryAccountInquiryListItem.jsx => components/ListItems/ShareInviteMonetaryAccountInquiryListItem.tsx} (96%) rename src/{react/Components/ListItems/ShareInviteMonetaryAccountResponseListItem.jsx => components/ListItems/ShareInviteMonetaryAccountResponseListItem.tsx} (97%) rename src/{react/Components/MainDialog.jsx => components/MainDialog.tsx} (97%) rename src/{react/Components/MainSnackbar.jsx => components/MainSnackbar.tsx} (86%) rename src/{react/Components/MoneyAmountLabel.jsx => components/MoneyAmountLabel.tsx} (100%) rename src/{react/Components/NetworkStatusChecker.jsx => components/NetworkStatusChecker.tsx} (89%) rename src/{react/Components/NoteTexts/NoteTextForm.jsx => components/NoteTexts/NoteTextForm.tsx} (98%) rename src/{react/Components/NoteTexts/NoteTextItem.jsx => components/NoteTexts/NoteTextItem.tsx} (95%) rename src/{react/Components/PDFExportHelper/Base64BunqLogo.js => components/PDFExportHelper/Base64BunqLogo.ts} (100%) rename src/{react/Components/PDFExportHelper/PDFExportHelper.jsx => components/PDFExportHelper/PDFExportHelper.tsx} (87%) rename src/{react/Components/QR/AccountQRCode.jsx => components/QR/AccountQRCode.tsx} (100%) rename src/{react/Components/QR/AccountQRFullscreen.jsx => components/QR/AccountQRFullscreen.tsx} (93%) rename src/{react/Components/QR/QRCode.jsx => components/QR/QRCode.tsx} (100%) rename src/{react/Components/QR/QRSvg.jsx => components/QR/QRSvg.tsx} (100%) rename src/{react/Components/Queue/QueueHeaderIcon.jsx => components/Queue/QueueHeaderIcon.tsx} (91%) rename src/{react/Components/Queue/QueueManager.jsx => components/Queue/QueueManager.tsx} (93%) rename src/{react/Components/Queue/QueueSidebarListItem.jsx => components/Queue/QueueSidebarListItem.tsx} (92%) rename src/{react/Components/ReactJsonWrapper.jsx => components/ReactJsonWrapper.tsx} (100%) rename src/{react/Components/ReduxForm/Fields/renderAccountsPicker.jsx => components/ReduxForm/Fields/renderAccountsPicker.tsx} (100%) rename src/{react/Components/ReduxForm/Fields/renderAmountField.jsx => components/ReduxForm/Fields/renderAmountField.tsx} (100%) rename src/{react/Components/ReduxForm/Fields/renderColorPickerGradient.jsx => components/ReduxForm/Fields/renderColorPickerGradient.tsx} (100%) rename src/{react/Components/ReduxForm/Fields/renderDateTimePicker.jsx => components/ReduxForm/Fields/renderDateTimePicker.tsx} (92%) rename src/{react/Components/ReduxForm/Fields/renderTextField.jsx => components/ReduxForm/Fields/renderTextField.tsx} (100%) rename src/{react/Components/ReduxForm/Validators.js => components/ReduxForm/Validators.ts} (96%) rename src/{react/Routes.jsx => components/Routes.tsx} (80%) rename src/{react/Components/Routing/NavLink.jsx => components/Routing/NavLink.tsx} (91%) rename src/{react/Components/Routing/PrivateRoute.jsx => components/Routing/PrivateRoute.tsx} (100%) rename src/{react/Components/Routing/PublicRoute.jsx => components/Routing/PublicRoute.tsx} (100%) rename src/{react/Components/RuleCollectionChecker.jsx => components/RuleCollectionChecker.tsx} (78%) rename src/{react/Components/SavingsGoals/Helpers.js => components/SavingsGoals/Helpers.ts} (80%) rename src/{react/Components/SavingsGoals/SavingsGoalListItem.jsx => components/SavingsGoals/SavingsGoalListItem.tsx} (97%) rename src/{react/Components/SavingsGoals/SavingsGoalListItemWrapper.jsx => components/SavingsGoals/SavingsGoalListItemWrapper.tsx} (97%) rename src/{react/Components/SavingsGoals/SavingsGoalSmallListItem.jsx => components/SavingsGoals/SavingsGoalSmallListItem.tsx} (100%) rename src/{react/Components/SavingsGoals/SavingsGoalsList.jsx => components/SavingsGoals/SavingsGoalsList.tsx} (100%) rename src/{react/Components/Sidebar.jsx => components/Sidebar.tsx} (98%) rename src/{react/Components/SpeedDial.jsx => components/SpeedDial.tsx} (100%) rename src/{react/Components/SwitchKeysMenu.jsx => components/SwitchKeysMenu.tsx} (98%) rename src/{react/Components/TransactionHeader.jsx => components/TransactionHeader.tsx} (99%) rename src/{react/Components/TranslationHelpers/Button.jsx => components/TranslationHelpers/Button.tsx} (100%) rename src/{react/Components/TranslationHelpers/MenuItem.jsx => components/TranslationHelpers/MenuItem.tsx} (100%) rename src/{react/Components/TranslationHelpers/Typography.jsx => components/TranslationHelpers/Typography.tsx} (100%) rename src/{react/i18n.jsx => components/i18n.tsx} (89%) rename src/{react/react-app.jsx => components/react-app.tsx} (89%) rename src/{env.js => env.ts} (100%) rename src/{react/Functions/Analytics.js => functions/Analytics.ts} (93%) rename src/{react/Functions/BunqErrorHandler.js => functions/BunqErrorHandler.ts} (66%) rename src/{react/Functions/ConnectGetPermissions.js => functions/ConnectGetPermissions.ts} (98%) rename src/{react/Functions/Crypto/Crypto.js => functions/Crypto/Crypto.ts} (100%) rename src/{react/Functions/Crypto/CryptoWorkerWrapper.js => functions/Crypto/CryptoWorkerWrapper.ts} (97%) rename src/{react/Functions/Crypto/CustomForge.js => functions/Crypto/CustomForge.ts} (100%) rename src/{react/Functions/DataFilters.js => functions/DataFilters.ts} (99%) rename src/{react/Functions/DefaultImageHandlers.js => functions/DefaultImageHandlers.ts} (100%) rename src/{react/Functions/EventStatusTexts.js => functions/EventStatusTexts.ts} (100%) rename src/{react/Functions/FilterDisabledChecker.js => functions/FilterDisabledChecker.ts} (100%) rename src/{react/Functions/IpChecker.js => functions/IpChecker.ts} (100%) rename src/{react/Functions/IsDarwin.js => functions/IsDarwin.ts} (62%) rename src/{react/Functions/Logger.js => functions/Logger.ts} (100%) rename src/{react/Functions/MergeApiObjects.js => functions/MergeApiObjects.ts} (100%) rename src/{react/Functions/NoteTextTypeParser.js => functions/NoteTextTypeParser.ts} (100%) rename src/{react/Functions/NotificationHelper.js => functions/NotificationHelper.ts} (100%) rename src/{react/Functions/PhoneLib.js => functions/PhoneLib.ts} (100%) rename src/{react/Functions/ScheduleTexts.js => functions/ScheduleTexts.ts} (100%) rename src/{react/Functions/StatsFormattingTemplates.js => functions/StatsFormattingTemplates.ts} (100%) rename src/{react/Functions/Utils.js => functions/Utils.ts} (100%) rename src/{react/Functions/VersionChecker.js => functions/VersionChecker.ts} (100%) rename src/helpers/{context_menu.js => context_menu.ts} (100%) rename src/helpers/{devtools.js => devtools.ts} (100%) rename src/helpers/{external_links.js => external_links.ts} (100%) rename src/helpers/{oauth.js => oauth.ts} (100%) rename src/helpers/{react_navigate.js => react_navigate.ts} (100%) rename src/helpers/{settings.js => settings.ts} (100%) rename src/helpers/{shortcuts.js => shortcuts.ts} (100%) rename src/helpers/{touchbar.js => touchbar.ts} (100%) rename src/helpers/{tray.js => tray.ts} (100%) rename src/helpers/{window.js => window.ts} (100%) rename src/{i18n-background.js => i18n-background.ts} (100%) rename src/{react/ImportWrappers => importwrappers}/README.md (100%) rename src/{react/ImportWrappers/electronSettings.js => importwrappers/electronSettings.ts} (100%) rename src/{react/ImportWrappers/fs.js => importwrappers/fs.ts} (100%) rename src/{react/ImportWrappers/localforage.js => importwrappers/localforage.ts} (100%) rename src/{react/ImportWrappers/os.js => importwrappers/os.ts} (100%) rename src/{react/ImportWrappers/path.js => importwrappers/path.ts} (100%) rename src/{react/Locales => locales}/Crowdin/.gitkeep (100%) rename src/{react/Locales => locales}/de.json (100%) rename src/{react/Locales => locales}/en.json (100%) rename src/{react/Locales => locales}/es.json (100%) rename src/{react/Locales => locales}/gr.json (100%) rename src/{react/Locales => locales}/it.json (100%) rename src/{react/Locales => locales}/nl.json (100%) rename src/menu/{darwin_menu_templates.js => darwin_menu_templates.ts} (100%) rename src/menu/{dev_menu_template.js => dev_menu_template.ts} (100%) rename src/menu/{edit_menu_template.js => edit_menu_template.ts} (100%) rename src/menu/{help_menu_template.js => help_menu_template.ts} (100%) rename src/menu/{view_menu_template.js => view_menu_template.ts} (100%) rename src/menu/{window_menu_template.js => window_menu_template.ts} (100%) create mode 100644 src/misc/consts.ts rename src/{react/Models => models}/BunqMeTab.ts (97%) rename src/{react/Models => models}/Card.ts (98%) rename src/{react/Models => models}/MasterCardAction.ts (98%) rename src/{react/Models => models}/MonetaryAccount.ts (96%) rename src/{react/Models => models}/Payment.ts (98%) rename src/{react/Models => models}/RequestInquiry.ts (98%) rename src/{react/Models => models}/RequestInquiryBatch.ts (96%) rename src/{react/Models => models}/RequestResponse.ts (98%) rename src/{react/Models => models}/SavingsGoal.ts (97%) rename src/{react/Pages/AccountInfo.jsx => pages/AccountInfo.tsx} (93%) rename src/{react/Pages/AddAccount.jsx => pages/AddAccount.tsx} (94%) rename src/{react/Pages/ApplicationInfo.jsx => pages/ApplicationInfo.tsx} (91%) rename src/{react/Pages/BunqMePersonal/BunqMePersonal.jsx => pages/BunqMePersonal/BunqMePersonal.tsx} (98%) rename src/{react/Pages/BunqMePersonal/LinkPreviewField.jsx => pages/BunqMePersonal/LinkPreviewField.tsx} (95%) rename src/{react/Pages/BunqMeTab/BunqMeTab.jsx => pages/BunqMeTab/BunqMeTab.tsx} (93%) rename src/{react/Pages/BunqMeTab/BunqMeTabForm.jsx => pages/BunqMeTab/BunqMeTabForm.tsx} (91%) rename src/{react/Pages/BunqMeTab/ConfirmationDialog.jsx => pages/BunqMeTab/ConfirmationDialog.tsx} (93%) rename src/{react/Pages/Cards/CardListItem.jsx => pages/Cards/CardListItem.tsx} (94%) rename src/{react/Pages/Cards/Cards.jsx => pages/Cards/Cards.tsx} (96%) rename src/{react/Pages/Cards/CvcCodeListItem.jsx => pages/Cards/CvcCodeListItem.tsx} (93%) rename src/{react/Pages/Cards/VirtualAccountNumbersDialog.jsx => pages/Cards/VirtualAccountNumbersDialog.tsx} (92%) rename src/{react/Pages/CategoryDashboard/CategoryDashboard.jsx => pages/CategoryDashboard/CategoryDashboard.tsx} (88%) rename src/{react/Pages/Connect/BudgetFields.jsx => pages/Connect/BudgetFields.tsx} (92%) rename src/{react/Pages/Connect/Connect.jsx => pages/Connect/Connect.tsx} (94%) rename src/{react/Pages/Connect/ConnectListItem.jsx => pages/Connect/ConnectListItem.tsx} (95%) rename src/{react/Pages/Connect/ConnectSettingItem.jsx => pages/Connect/ConnectSettingItem.tsx} (100%) rename src/{react/Pages/Connect/TimeLimitFields.jsx => pages/Connect/TimeLimitFields.tsx} (100%) rename src/{react/Pages/Contacts/ContactHeader.jsx => pages/Contacts/ContactHeader.tsx} (96%) rename src/{react/Pages/Contacts/Contacts.jsx => pages/Contacts/Contacts.tsx} (92%) rename src/{react/Pages/Dashboard/AddMoneyButton.jsx => pages/Dashboard/AddMoneyButton.tsx} (97%) rename src/{react/Pages/Dashboard/Dashboard.jsx => pages/Dashboard/Dashboard.tsx} (94%) rename src/{react/Pages/DebugPage.jsx => pages/DebugPage.tsx} (96%) rename src/{react/Pages/Disclaimer.jsx => pages/Disclaimer.tsx} (96%) rename src/{react/Pages/Exports.jsx => pages/Exports.tsx} (95%) rename src/{react/Pages/Login/Login.jsx => pages/Login/Login.tsx} (98%) rename src/{react/Pages/Login/OAuthManagement.jsx => pages/Login/OAuthManagement.tsx} (95%) rename src/{react/Pages/Login/SideOptions.jsx => pages/Login/SideOptions.tsx} (96%) rename src/{react/Pages/LoginPassword.jsx => pages/LoginPassword.tsx} (98%) rename src/{react/Pages/MasterCardActionInfo.jsx => pages/MasterCardActionInfo.tsx} (91%) rename src/{react/Pages/NotFound.jsx => pages/NotFound.tsx} (89%) rename src/{react/Pages/Pay/ConfirmationDialog.jsx => pages/Pay/ConfirmationDialog.tsx} (98%) rename src/{react/Pages/Pay/Pay.jsx => pages/Pay/Pay.tsx} (96%) rename src/{react/Pages/PaymentInfo.jsx => pages/PaymentInfo.tsx} (89%) rename src/{react/Pages/PendingPayments/ConfirmationDialog.jsx => pages/PendingPayments/ConfirmationDialog.tsx} (100%) rename src/{react/Pages/PendingPayments/PendingPaymentRow.jsx => pages/PendingPayments/PendingPaymentRow.tsx} (92%) rename src/{react/Pages/PendingPayments/PendingPayments.jsx => pages/PendingPayments/PendingPayments.tsx} (96%) rename src/{react/Pages/Profile/Address.jsx => pages/Profile/Address.tsx} (93%) rename src/{react/Pages/Profile/BillingInfo.jsx => pages/Profile/BillingInfo.tsx} (100%) rename src/{react/Pages/Profile/BusinessInfo.jsx => pages/Profile/BusinessInfo.tsx} (96%) rename src/{react/Pages/Profile/NotificationFilters.jsx => pages/Profile/NotificationFilters.tsx} (98%) rename src/{react/Pages/Profile/Profile.jsx => pages/Profile/Profile.tsx} (94%) rename src/{react/Pages/Profile/ProfileDetailsForm.jsx => pages/Profile/ProfileDetailsForm.tsx} (85%) rename src/{react/Pages/RequestInquiry/ConfirmationDialog.jsx => pages/RequestInquiry/ConfirmationDialog.tsx} (98%) rename src/{react/Pages/RequestInquiry/Options/AllowBunqMe.jsx => pages/RequestInquiry/Options/AllowBunqMe.tsx} (100%) rename src/{react/Pages/RequestInquiry/Options/MinimumAge.jsx => pages/RequestInquiry/Options/MinimumAge.tsx} (100%) rename src/{react/Pages/RequestInquiry/RequestInquiry.jsx => pages/RequestInquiry/RequestInquiry.tsx} (96%) rename src/{react/Pages/RequestInquiry/SplitAmountForm.jsx => pages/RequestInquiry/SplitAmountForm.tsx} (97%) rename src/{react/Pages/RequestInquiry/SplitAmountItem.jsx => pages/RequestInquiry/SplitAmountItem.tsx} (96%) rename src/{react/Pages/RequestInquiry/TotalSplitHelper.js => pages/RequestInquiry/TotalSplitHelper.ts} (100%) rename src/{react/Pages/RequestInquiryInfo.jsx => pages/RequestInquiryInfo.tsx} (90%) rename src/{react/Pages/RequestResponseInfo/AddressForm.jsx => pages/RequestResponseInfo/AddressForm.tsx} (100%) rename src/{react/Pages/RequestResponseInfo/RequestResponseInfo.jsx => pages/RequestResponseInfo/RequestResponseInfo.tsx} (92%) rename src/{react/Pages/RuleDashboard/RuleCollectionItem.jsx => pages/RuleDashboard/RuleCollectionItem.tsx} (88%) rename src/{react/Pages/RuleDashboard/RuleDashboard.jsx => pages/RuleDashboard/RuleDashboard.tsx} (83%) rename src/{react/Pages => pages}/RulePage/NewRuleItemMenu.tsx (94%) rename src/{react/Pages => pages}/RulePage/RuleCollectionMenu.tsx (97%) rename src/{react/Pages => pages}/RulePage/RuleCollectionPreview.tsx (95%) rename src/{react/Pages => pages}/RulePage/RuleCollectionPreviewItem.tsx (93%) rename src/{react/Pages => pages}/RulePage/RuleCreator.tsx (97%) rename src/{react/Pages => pages}/RulePage/RuleItemMenu.tsx (97%) rename src/{react/Pages/RulePage/RulePage.jsx => pages/RulePage/RulePage.tsx} (91%) rename src/{react/Pages => pages}/RulePage/RuleTypeItems/AccountRuleItem.tsx (93%) rename src/{react/Pages => pages}/RulePage/RuleTypeItems/ItemTypeRuleItem.tsx (93%) rename src/{react/Pages => pages}/RulePage/RuleTypeItems/TransactionAmountRuleItem.tsx (91%) rename src/{react/Pages => pages}/RulePage/RuleTypeItems/ValueRuleItem.tsx (97%) rename src/{react/Pages/SavingsGoalPage/SavingsGoalForm.jsx => pages/SavingsGoalPage/SavingsGoalForm.tsx} (87%) rename src/{react/Pages/SavingsGoalPage/SavingsGoalPage.jsx => pages/SavingsGoalPage/SavingsGoalPage.tsx} (91%) rename src/{react/Pages/SavingsGoalPage/renderAmountFieldCustom.jsx => pages/SavingsGoalPage/renderAmountFieldCustom.tsx} (91%) rename src/{react/Pages/SavingsGoals/SavingsGoals.jsx => pages/SavingsGoals/SavingsGoals.tsx} (87%) rename src/{react/Pages/ScheduledPayments/ScheduledPaymentItem.jsx => pages/ScheduledPayments/ScheduledPaymentItem.tsx} (91%) rename src/{react/Pages/ScheduledPayments/ScheduledPayments.jsx => pages/ScheduledPayments/ScheduledPayments.tsx} (94%) rename src/{react/Pages/ScheduledPayments/ScheduledPaymentsEditDialog.jsx => pages/ScheduledPayments/ScheduledPaymentsEditDialog.tsx} (95%) rename src/{react/Pages/Settings/EditPasswordForm.jsx => pages/Settings/EditPasswordForm.tsx} (93%) rename src/{react/Pages/Settings/Settings.jsx => pages/Settings/Settings.tsx} (93%) rename src/{react/Pages/Stats/Chart/PieChart/CategoryCountPieChart.jsx => pages/Stats/Chart/PieChart/CategoryCountPieChart.tsx} (98%) rename src/{react/Pages/Stats/Chart/PieChart/CategoryTransactionPieChart.jsx => pages/Stats/Chart/PieChart/CategoryTransactionPieChart.tsx} (95%) rename src/{react/Pages/Stats/Chart/PieChart/EventCountPieChart.jsx => pages/Stats/Chart/PieChart/EventCountPieChart.tsx} (98%) rename src/{react/Pages/Stats/Chart/PieChart/EventSplitCountPieChart.jsx => pages/Stats/Chart/PieChart/EventSplitCountPieChart.tsx} (99%) rename src/{react/Pages/Stats/Chart/PieChart/EventSplitTransactionPieChart.jsx => pages/Stats/Chart/PieChart/EventSplitTransactionPieChart.tsx} (97%) rename src/{react/Pages/Stats/Chart/PieChart/EventTransactionPieChart.jsx => pages/Stats/Chart/PieChart/EventTransactionPieChart.tsx} (96%) rename src/{react/Pages/Stats/Chart/Timeline/CategoryCountHistoryChart.jsx => pages/Stats/Chart/Timeline/CategoryCountHistoryChart.tsx} (96%) rename src/{react/Pages/Stats/Chart/Timeline/CategoryTransactionHistoryChart.jsx => pages/Stats/Chart/Timeline/CategoryTransactionHistoryChart.tsx} (96%) rename src/{react/Pages/Stats/Chart/Timeline/EventTypeHistoryChart.jsx => pages/Stats/Chart/Timeline/EventTypeHistoryChart.tsx} (97%) rename src/{react/Pages/Stats/Chart/Timeline/EventTypeSplitHistoryChart.jsx => pages/Stats/Chart/Timeline/EventTypeSplitHistoryChart.tsx} (98%) rename src/{react/Pages/Stats/Chart/Timeline/EventTypeSplitTransactionHistoryChart.jsx => pages/Stats/Chart/Timeline/EventTypeSplitTransactionHistoryChart.tsx} (98%) rename src/{react/Pages/Stats/Chart/Timeline/EventTypeTransactionHistoryChart.jsx => pages/Stats/Chart/Timeline/EventTypeTransactionHistoryChart.tsx} (97%) rename src/{react/Pages/Stats/ChartTitle.jsx => pages/Stats/ChartTitle.tsx} (100%) rename src/{react/Pages/Stats/Colors.jsx => pages/Stats/Colors.tsx} (100%) rename src/{react/Pages/Stats/EventCountSection.jsx => pages/Stats/EventCountSection.tsx} (100%) rename src/{react/Pages/Stats/EventCountSidebarSection.jsx => pages/Stats/EventCountSidebarSection.tsx} (97%) rename src/{react/Pages/Stats/EventHistorySection.jsx => pages/Stats/EventHistorySection.tsx} (100%) rename src/{react/Pages/Stats/Stats.jsx => pages/Stats/Stats.tsx} (98%) rename src/{react/Pages/SwitchApiKeys.jsx => pages/SwitchApiKeys.tsx} (97%) delete mode 100644 src/react/Actions/accounts.js delete mode 100644 src/react/Actions/application.js delete mode 100644 src/react/Actions/bunq_me_tab.js delete mode 100644 src/react/Actions/bunq_me_tabs.js delete mode 100644 src/react/Actions/card_cvc2.js delete mode 100644 src/react/Actions/cards.js delete mode 100644 src/react/Actions/categories.js delete mode 100644 src/react/Actions/category_rules.ts delete mode 100644 src/react/Actions/contacts.js delete mode 100644 src/react/Actions/export_new.js delete mode 100644 src/react/Actions/exports.js delete mode 100644 src/react/Actions/snackbar.js delete mode 100644 src/react/Reducers/account_id_filter.js delete mode 100644 src/react/Reducers/accounts.js delete mode 100644 src/react/Reducers/amount_filter.js delete mode 100644 src/react/Reducers/application.js delete mode 100644 src/react/Reducers/bunq_me_tab.js delete mode 100644 src/react/Reducers/bunq_me_tab_filter.js delete mode 100644 src/react/Reducers/bunq_me_tabs.js delete mode 100644 src/react/Reducers/card_cvc2.js delete mode 100644 src/react/Reducers/card_id_filter.js delete mode 100644 src/react/Reducers/cards.js delete mode 100644 src/react/Reducers/category_filter.js delete mode 100644 src/react/Reducers/category_rules.ts delete mode 100644 src/react/Reducers/contacts.js delete mode 100644 src/react/Reducers/date_filter.js delete mode 100644 src/react/Reducers/export_new.js delete mode 100644 src/react/Reducers/exports.js delete mode 100644 src/react/Reducers/snackbar.js delete mode 100644 src/react/Store.jsx rename src/{react/StaticData => staticdata}/CountryCodes.json (100%) rename src/{react/StaticData => staticdata}/Icons.json (100%) create mode 100644 src/store/accountIdFilter/index.ts create mode 100644 src/store/accounts/index.ts create mode 100644 src/store/accounts/thunks.ts create mode 100644 src/store/amountFilter/index.ts create mode 100644 src/store/application/index.ts create mode 100644 src/store/bunqMeTab/index.ts create mode 100644 src/store/bunqMeTab/thunks.ts create mode 100644 src/store/bunqMeTabFilter/index.ts create mode 100644 src/store/bunqMeTabs/index.ts create mode 100644 src/store/bunqMeTabs/thunks.ts create mode 100644 src/store/cardCvc2/index.ts create mode 100644 src/store/cardCvc2/thunks.ts create mode 100644 src/store/cardIdFilter/index.ts create mode 100644 src/store/cards/index.ts create mode 100644 src/store/cards/thunks.ts rename src/{react/Reducers/categories.js => store/categories/index.ts} (50%) create mode 100644 src/store/categoryFilter/index.ts create mode 100644 src/store/categoryRules/index.ts create mode 100644 src/store/contacts/index.ts create mode 100644 src/store/contacts/thunks.ts create mode 100644 src/store/dateFilter/index.ts create mode 100644 src/store/exportNew/index.ts create mode 100644 src/store/exportNew/thunks.ts create mode 100644 src/store/exports/index.ts create mode 100644 src/store/exports/thunks.ts create mode 100644 src/store/index.ts create mode 100644 src/store/snackbar/index.ts rename src/{react/Themes/DarkTheme.jsx => themes/DarkTheme.ts} (100%) rename src/{react/Themes/DefaultTheme.jsx => themes/DefaultTheme.ts} (100%) create mode 100644 src/types/Category.ts rename src/{react/Types => types}/Event.ts (100%) rename src/{react/Types => types}/RuleCollection.ts (99%) rename src/{react/Types => types}/Rules/AccountRule.ts (100%) rename src/{react/Types => types}/Rules/Rule.ts (100%) rename src/{react/Types => types}/Rules/TransactionAmountRule.ts (100%) rename src/{react/Types => types}/Rules/TypeRule.ts (100%) rename src/{react/Types => types}/Rules/ValueRule.ts (100%) rename src/{react/Types => types}/Types.ts (99%) rename src/{react/WebWorkers => webworkers}/crypto.worker.js (93%) rename src/{react/WebWorkers => webworkers}/rule_collection_check.worker.js (95%) rename src/{react/WebWorkers => webworkers}/stats.worker.js (98%) create mode 100644 webpacktools.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 85a0c888..00000000 --- a/.babelrc +++ /dev/null @@ -1,41 +0,0 @@ -{ - "presets": [ - "@babel/preset-react", - [ - "@babel/preset-env", - { - "targets": { - "browsers": [ - "last 2 versions" - ] - } - } - ] - ], - "plugins": [ - "react-html-attrs", - "@babel/plugin-proposal-object-rest-spread", - [ - "@babel/plugin-transform-runtime", - { - "helpers": false, - "regenerator": true - } - ], - "@babel/plugin-proposal-class-properties", - "@babel/plugin-transform-react-constant-elements", - "@babel/plugin-transform-react-inline-elements", - "@babel/plugin-transform-react-jsx-source", - "@babel/plugin-syntax-dynamic-import" - ], - "env": { - "test": { - "plugins": [ - "babel-plugin-dynamic-import-node" - ] - }, - "development": { - "compact": false - } - } -} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 00000000..7871fc37 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,58 @@ +const { fixResolvePath, getResolverAlias } = require("./webpacktools"); + +module.exports = function (api) { + api.cache(true); + + return { + "presets": [ + "@babel/preset-react", + [ + "@babel/preset-env", + { + "targets": { + "browsers": [ + "last 2 versions" + ] + } + } + ] + ], + "plugins": [ + "react-html-attrs", + [ + "module-resolver", + { + root: ["./"], + alias: getResolverAlias(__dirname), + resolvePath: fixResolvePath(__dirname), + }, + ], + "@babel/plugin-proposal-object-rest-spread", + [ + "@babel/plugin-transform-runtime", + { + "helpers": false, + "regenerator": true + } + ], + "@babel/plugin-proposal-class-properties", + "@babel/plugin-proposal-nullish-coalescing-operator", + "@babel/plugin-proposal-optional-chaining", + "@babel/plugin-transform-react-constant-elements", + "@babel/plugin-transform-react-inline-elements", + "@babel/plugin-transform-react-jsx-source", + "@babel/plugin-syntax-dynamic-import" + ], + "env": { + "test": { + "plugins": [ + "babel-plugin-dynamic-import-node" + ] + }, + "development": { + "compact": false + } + } + }; +}; + diff --git a/package.json b/package.json index 2dc9458a..c7c715ed 100644 --- a/package.json +++ b/package.json @@ -129,6 +129,9 @@ ] }, "dependencies": { + "@manaflair/redux-batch": "^1.0.0", + "@reduxjs/toolkit": "^1.2.3", + "@types/lodash": "^4.14.149", "electron-localshortcut": "^3.2.1", "electron-log": "^2.2.9", "electron-settings": "^3.1.3", @@ -136,6 +139,8 @@ "glob": "^7.1.2", "i18next": "^10.6.0", "i18next-xhr-backend": "^1.5.1", + "lodash": "^4.17.15", + "redux-saga": "^1.1.3", "upath": "1.0.5" }, "devDependencies": { @@ -150,9 +155,9 @@ "@babel/plugin-proposal-function-sent": "^7.7.4", "@babel/plugin-proposal-json-strings": "^7.7.4", "@babel/plugin-proposal-logical-assignment-operators": "^7.7.4", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.7.4", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3", "@babel/plugin-proposal-numeric-separator": "^7.7.4", - "@babel/plugin-proposal-optional-chaining": "^7.7.4", + "@babel/plugin-proposal-optional-chaining": "^7.8.3", "@babel/plugin-proposal-pipeline-operator": "^7.7.4", "@babel/plugin-proposal-throw-expressions": "^7.7.4", "@babel/plugin-syntax-dynamic-import": "^7.7.4", @@ -169,6 +174,7 @@ "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.2", "@material-ui/lab": "^3.0.0-alpha.30", + "@rollup/plugin-typescript": "^2.1.0", "@types/jest": "^24.0.25", "@types/moxios": "^0.4.9", "@types/node": "^13.1.4", @@ -178,6 +184,7 @@ "axios": "0.18.1", "babel-loader": "^8.0.6", "babel-plugin-dynamic-import-node": "^2.3.0", + "babel-plugin-module-resolver": "^4.0.0", "babel-plugin-react-html-attrs": "^2.1.0", "babel-plugin-system-import-transformer": "^3.1.0", "chart.js": "^2.7.2", diff --git a/src/react/Actions/filters.js b/src/Actions/filters.js similarity index 100% rename from src/react/Actions/filters.js rename to src/Actions/filters.js diff --git a/src/react/Actions/master_card_action_info.js b/src/Actions/master_card_action_info.js similarity index 93% rename from src/react/Actions/master_card_action_info.js rename to src/Actions/master_card_action_info.js index b8104ddb..b9abea1c 100644 --- a/src/react/Actions/master_card_action_info.js +++ b/src/Actions/master_card_action_info.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import MasterCardAction from "../Models/MasterCardAction"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import MasterCardAction from "~models/MasterCardAction"; import { masterCardActionsSetInfo } from "./master_card_actions"; @@ -14,6 +14,18 @@ export function masterCardActionSetInfo(master_card_action_info, account_id, mas }; } +export function masterCardActionInfoLoading() { + return { type: "MASTER_CARD_ACTION_INFO_IS_LOADING" }; +} + +export function masterCardActionInfoNotLoading() { + return { type: "MASTER_CARD_ACTION_INFO_IS_NOT_LOADING" }; +} + +export function masterCardActionInfoClear() { + return { type: "MASTER_CARD_ACTION_INFO_CLEAR" }; +} + export function masterCardActionInfoUpdate(BunqJSClient, user_id, account_id, master_card_action_id) { const failedMessage = window.t("We failed to load the mastercard payment information"); @@ -37,14 +49,4 @@ export function masterCardActionInfoUpdate(BunqJSClient, user_id, account_id, ma }; } -export function masterCardActionInfoLoading() { - return { type: "MASTER_CARD_ACTION_INFO_IS_LOADING" }; -} -export function masterCardActionInfoNotLoading() { - return { type: "MASTER_CARD_ACTION_INFO_IS_NOT_LOADING" }; -} - -export function masterCardActionInfoClear() { - return { type: "MASTER_CARD_ACTION_INFO_CLEAR" }; -} diff --git a/src/react/Actions/master_card_actions.js b/src/Actions/master_card_actions.js similarity index 93% rename from src/react/Actions/master_card_actions.js rename to src/Actions/master_card_actions.js index 948cb9b4..be464cd3 100644 --- a/src/react/Actions/master_card_actions.js +++ b/src/Actions/master_card_actions.js @@ -1,5 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import MasterCardAction from "../Models/MasterCardAction"; +import MasterCardAction from "~models/MasterCardAction"; export const STORED_MASTER_CARD_ACTIONS = "BUNQDESKTOP_STORED_MASTER_CARD_ACTIONS"; @@ -60,7 +59,8 @@ export function masterCardActionsUpdate( }) .catch(error => { dispatch(masterCardActionsNotLoading()); - BunqErrorHandler(dispatch, error, failedMessage); + // FIXME + // BunqErrorHandler(dispatch, error, failedMessage); }); }; } diff --git a/src/react/Actions/modal.js b/src/Actions/modal.js similarity index 100% rename from src/react/Actions/modal.js rename to src/Actions/modal.js diff --git a/src/react/Actions/note_texts.js b/src/Actions/note_texts.js similarity index 98% rename from src/react/Actions/note_texts.js rename to src/Actions/note_texts.js index d10de06d..5804a177 100644 --- a/src/react/Actions/note_texts.js +++ b/src/Actions/note_texts.js @@ -1,4 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; export function noteTextsSetInfo(noteTexts, event_type, user_id, account_id, event_id) { return { diff --git a/src/react/Actions/oauth.js b/src/Actions/oauth.js similarity index 100% rename from src/react/Actions/oauth.js rename to src/Actions/oauth.js diff --git a/src/react/Actions/options.js b/src/Actions/options.js similarity index 100% rename from src/react/Actions/options.js rename to src/Actions/options.js diff --git a/src/react/Actions/pagination.js b/src/Actions/pagination.js similarity index 100% rename from src/react/Actions/pagination.js rename to src/Actions/pagination.js diff --git a/src/react/Actions/pay.js b/src/Actions/pay.js similarity index 90% rename from src/react/Actions/pay.js rename to src/Actions/pay.js index e45d4ab6..7b2163ad 100644 --- a/src/react/Actions/pay.js +++ b/src/Actions/pay.js @@ -1,9 +1,9 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { openSnackbar } from "./snackbar"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { paymentInfoUpdate } from "./payments"; -import { accountsUpdate } from "./accounts"; import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "./share_invite_monetary_account_inquiries"; import { shareInviteMonetaryAccountResponsesInfoUpdate } from "./share_invite_monetary_account_responses"; +import { actions as snackbarActions } from "~store/snackbar"; +import { accountsUpdate } from "~store/accounts/thunks"; export function paySend(BunqJSClient, userId, accountId, description, amount, targets, draft = false) { const failedMessage = window.t("We received the following error while sending your payment"); @@ -28,10 +28,10 @@ export function paySend(BunqJSClient, userId, accountId, description, amount, ta paymentHandler .post(userId, accountId, description, amount, targetData) - .then(result => { + .then(() => { const notification = draft ? successMessage1 : isMultiple ? successMessage2 : successMessage3; - dispatch(openSnackbar(notification)); + dispatch(snackbarActions.open({ message: notification })); // update the payments, accounts and share list dispatch(shareInviteMonetaryAccountResponsesInfoUpdate(BunqJSClient, userId)); @@ -73,9 +73,9 @@ export function paySchedule(BunqJSClient, userId, accountId, description, amount scheduleTypeHandler .post(userId, accountId, paymentData, schedule) - .then(result => { + .then(() => { const notification = isMultiple ? successMessage1 : successMessage2; - dispatch(openSnackbar(notification)); + dispatch(snackbarActions.open({ message: notification })); // update the payments, accounts and share list dispatch(paymentInfoUpdate(BunqJSClient, userId, accountId)); diff --git a/src/react/Actions/payment_info.js b/src/Actions/payment_info.js similarity index 93% rename from src/react/Actions/payment_info.js rename to src/Actions/payment_info.js index 4dad712f..ff63e8f5 100644 --- a/src/react/Actions/payment_info.js +++ b/src/Actions/payment_info.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import Payment from "../Models/Payment"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import Payment from "~models/Payment"; import { paymentsSetInfo } from "./payments"; diff --git a/src/react/Actions/payments.js b/src/Actions/payments.js similarity index 93% rename from src/react/Actions/payments.js rename to src/Actions/payments.js index d2ac50f0..3540231e 100644 --- a/src/react/Actions/payments.js +++ b/src/Actions/payments.js @@ -1,7 +1,7 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { paymentApiFilter } from "../Functions/DataFilters"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import { paymentApiFilter } from "~functions/DataFilters"; -import Payment from "../Models/Payment"; +import Payment from "~models/Payment"; export const STORED_PAYMENTS = "BUNQDESKTOP_STORED_PAYMENTS"; diff --git a/src/react/Actions/pending_payments.js b/src/Actions/pending_payments.js similarity index 100% rename from src/react/Actions/pending_payments.js rename to src/Actions/pending_payments.js diff --git a/src/react/Actions/queue.js b/src/Actions/queue.js similarity index 100% rename from src/react/Actions/queue.js rename to src/Actions/queue.js diff --git a/src/react/Actions/registration.js b/src/Actions/registration.js similarity index 84% rename from src/react/Actions/registration.js rename to src/Actions/registration.js index f93746ae..178d700f 100644 --- a/src/react/Actions/registration.js +++ b/src/Actions/registration.js @@ -1,18 +1,19 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { applicationSetStatus } from "./application"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { userSetInfo } from "./user"; import { loadStoredPayments } from "./payments"; -import { loadStoredAccounts } from "./accounts"; -import { loadStoredBunqMeTabs } from "./bunq_me_tabs"; +import { loadStoredAccounts } from "~store/accounts/thunks"; +import { loadStoredBunqMeTabs } from "~store/bunqMeTabs/thunks"; import { loadStoredMasterCardActions } from "./master_card_actions"; import { loadStoredRequestInquiries } from "./request_inquiries"; import { loadStoredrequestInquiryBatches } from "./request_inquiry_batches"; import { loadStoredRequestResponses } from "./request_responses"; -import { loadStoredContacts } from "./contacts"; +import { loadStoredContacts } from "~store/contacts/thunks"; import { loadStoredShareInviteMonetaryAccountResponses } from "./share_invite_monetary_account_responses"; import { loadStoredShareInviteBankInquiries } from "./share_invite_monetary_account_inquiries"; import { loadPendingPayments } from "./pending_payments"; -import { openSnackbar } from "./snackbar"; + +import { actions as applicationActions } from "~store/application"; +import { actions as snackbarActions } from "~store/snackbar"; /** * Logs out of current account and logs back in to the selected stored key @@ -50,28 +51,35 @@ export function registrationLogin(apiKey = false, deviceName = false, environmen dispatch(registrationLoading()); if (!apiKey) { - dispatch(applicationSetStatus(statusMessage)); + dispatch(applicationActions.setStatusMessage(statusMessage)); if (BunqDesktopClient.derivedPassword) { try { const hasStoredApiKey = await BunqDesktopClient.loadApiKey(); if (!hasStoredApiKey) { // no given key and no stored key - dispatch(registrationNotLoading()); - dispatch(registrationSetNotReady()); + dispatch([ + registrationNotLoading(), + registrationSetNotReady(), + ]); return; } apiKey = hasStoredApiKey; } catch (exception) { BunqDesktopClient.Logger.error(exception); - dispatch(openSnackbar(failedToDecryptDataMessage)); - dispatch(registrationLogOut(false)); - dispatch(registrationNotLoading()); - dispatch(registrationSetNotReady()); + dispatch([ + snackbarActions.open(failedToDecryptDataMessage), + registrationLogOut(false), + registrationNotLoading(), + registrationSetNotReady(), + ]); + return; } } else { - dispatch(registrationNotLoading()); - dispatch(registrationSetNotReady()); + dispatch([ + registrationNotLoading(), + registrationSetNotReady(), + ]); return; } @@ -83,13 +91,13 @@ export function registrationLogin(apiKey = false, deviceName = false, environmen try { await BunqDesktopClient.BunqJSClientRun(); - dispatch(applicationSetStatus(statusMessage2)); + dispatch(applicationActions.setStatusMessage(statusMessage2)); await BunqDesktopClient.BunqJSClientInstall(); - dispatch(applicationSetStatus(statusMessage3)); + dispatch(applicationActions.setStatusMessage(statusMessage3)); await BunqDesktopClient.BunqJSClientRegisterDevice(); - dispatch(applicationSetStatus(statusMessage4)); + dispatch(applicationActions.setStatusMessage(statusMessage4)); await BunqDesktopClient.BunqJSClientRegisterSession(); const users = await BunqDesktopClient.BunqJSClientGetUsers(); @@ -99,18 +107,23 @@ export function registrationLogin(apiKey = false, deviceName = false, environmen // load bunq api data and other data like contacts from storage dispatch(registrationLoadStoredData()); } catch (exception) { - BunqErrorHandler(dispatch, exception, false, BunqJSClient); - dispatch(registrationResetToApiScreen()); - dispatch(registrationNotLoading()); - dispatch(registrationSetNotReady()); + const batchedActions = []; + BunqErrorHandler(batchedActions, exception, false, BunqJSClient); + dispatch(batchedActions.concat([ + registrationResetToApiScreen(), + registrationNotLoading(), + registrationSetNotReady(), + ])); return; } setTimeout(() => { - dispatch(applicationSetStatus("")); - dispatch(registrationNotLoading()); - dispatch(registrationSetBunqDesktopClientData()); - dispatch(registrationSetReady()); + dispatch([ + applicationActions.setStatusMessage(""), + registrationNotLoading(), + registrationSetBunqDesktopClientData(), + registrationSetReady(), + ]); }, 500); }; } @@ -134,7 +147,7 @@ export const registrationSwitchStoredApiKey = keyIndex => { BunqDesktopClient.Logger.error("switchStoredApiKey"); BunqDesktopClient.Logger.error(error); dispatch(registrationNotLoading()); - dispatch(openSnackbar(failureMessage)); + dispatch(snackbarActions.open({ message: failureMessage })); }); }; }; @@ -159,7 +172,7 @@ export const registrationSetPassword = password => { BunqDesktopClient.Logger.error("setupPassword"); BunqDesktopClient.Logger.error(error); dispatch(registrationNotLoading()); - dispatch(openSnackbar(failureMessage)); + dispatch(snackbarActions.open({ message: failureMessage })); }); }; }; @@ -183,7 +196,7 @@ export const registrationSkipPassword = () => { BunqDesktopClient.Logger.error("skipPassword"); BunqDesktopClient.Logger.error(error); dispatch(registrationNotLoading()); - dispatch(openSnackbar(failureMessage)); + dispatch(snackbarActions.open({ message: failureMessage })); }); }; }; @@ -203,13 +216,13 @@ export const registrationChangePassword = newPassword => { .then(done => { dispatch(registrationNotLoading()); dispatch(registrationSetBunqDesktopClientData()); - dispatch(openSnackbar(successMessage)); + dispatch(snackbarActions.open({ message: successMessage })); }) .catch(error => { BunqDesktopClient.Logger.error("changePassword"); BunqDesktopClient.Logger.error(error); dispatch(registrationNotLoading()); - dispatch(openSnackbar(failureMessage)); + dispatch(snackbarActions.open({ message: failureMessage })); }); }; }; diff --git a/src/react/Actions/request_inquiries.js b/src/Actions/request_inquiries.js similarity index 95% rename from src/react/Actions/request_inquiries.js rename to src/Actions/request_inquiries.js index b1b7505e..d10fb924 100644 --- a/src/react/Actions/request_inquiries.js +++ b/src/Actions/request_inquiries.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import RequestInquiry from "../Models/RequestInquiry"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import RequestInquiry from "~models/RequestInquiry"; export const STORED_REQUEST_INQUIRIES = "BUNQDESKTOP_STORED_REQUEST_INQUIRIES"; diff --git a/src/react/Actions/request_inquiry.js b/src/Actions/request_inquiry.js similarity index 82% rename from src/react/Actions/request_inquiry.js rename to src/Actions/request_inquiry.js index b2b0802f..a062b19a 100644 --- a/src/react/Actions/request_inquiry.js +++ b/src/Actions/request_inquiry.js @@ -1,7 +1,7 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { openSnackbar } from "./snackbar"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { requestInquiryUpdate } from "./request_inquiry_info"; import { requestInquiryBatchesUpdate } from "./request_inquiry_batches"; +import { actions as snackbarActions } from "~store/snackbar"; export function requestInquirySend(BunqJSClient, userId, accountId, requestInquiries) { const failedMessage = window.t("We received the following error while sending your request"); @@ -12,12 +12,13 @@ export function requestInquirySend(BunqJSClient, userId, accountId, requestInqui BunqJSClient.api.requestInquiryBatch .post(userId, accountId, requestInquiries, false, {}) .then(result => { - dispatch(openSnackbar(successMessage)); + dispatch(snackbarActions.open({ message: successMessage })); dispatch(requestInquiryNotLoading()); }) .catch(error => { dispatch(requestInquiryNotLoading()); - BunqErrorHandler(dispatch, error, failedMessage); + // FIXME + // BunqErrorHandler(dispatch, error, failedMessage); }); }; } @@ -30,8 +31,8 @@ export function requestInquiryCancel(BunqJSClient, userId, accountId, requestInq dispatch(requestInquiryLoading()); BunqJSClient.api.requestInquiry .put(userId, accountId, requestInquiryId, "REVOKED") - .then(result => { - dispatch(openSnackbar(successMessage)); + .then(() => { + dispatch(snackbarActions.open({ message: successMessage })); dispatch(requestInquiryNotLoading()); // update the information page diff --git a/src/react/Actions/request_inquiry_batches.js b/src/Actions/request_inquiry_batches.js similarity index 95% rename from src/react/Actions/request_inquiry_batches.js rename to src/Actions/request_inquiry_batches.js index 8034d62d..856e7112 100644 --- a/src/react/Actions/request_inquiry_batches.js +++ b/src/Actions/request_inquiry_batches.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import RequestInquiryBatch from "../Models/RequestInquiryBatch"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import RequestInquiryBatch from "~models/RequestInquiryBatch"; export const STORED_REQUEST_INQUIRY_BATCHES = "BUNQDESKTOP_STORED_REQUEST_INQUIRY_BATCHES"; diff --git a/src/react/Actions/request_inquiry_info.js b/src/Actions/request_inquiry_info.js similarity index 93% rename from src/react/Actions/request_inquiry_info.js rename to src/Actions/request_inquiry_info.js index 9a075d14..6c1239e6 100644 --- a/src/react/Actions/request_inquiry_info.js +++ b/src/Actions/request_inquiry_info.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import RequestInquiry from "../Models/RequestInquiry"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import RequestInquiry from "~models/RequestInquiry"; import { requestInquiriesSetInfo } from "./request_inquiries"; diff --git a/src/react/Actions/request_response.js b/src/Actions/request_response.js similarity index 79% rename from src/react/Actions/request_response.js rename to src/Actions/request_response.js index 04461741..d6ca8c18 100644 --- a/src/react/Actions/request_response.js +++ b/src/Actions/request_response.js @@ -1,8 +1,9 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { openSnackbar } from "./snackbar"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { requestResponseUpdate } from "./request_response_info"; import { requestInquiryBatchesUpdate } from "./request_inquiry_batches"; +import { actions as snackbarActions } from "~store/snackbar"; + // Disabled until after 0.7 release export function requestResponseAccept( BunqJSClient, @@ -26,13 +27,13 @@ export function requestResponseAccept( address_shipping: options.address_shipping, amount_responded: amountResponded }) - .then(result => { - dispatch(openSnackbar(successMessage)); - dispatch(requestResponseNotLoading()); - - // update the information page - dispatch(requestResponseUpdate(BunqJSClient, userId, accountId, requestResponseId)); - dispatch(requestInquiryBatchesUpdate(BunqJSClient, userId, accountId)); + .then(() => { + dispatch([ + snackbarActions.open({ message: successMessage }), + requestResponseNotLoading(), + requestResponseUpdate(BunqJSClient, userId, accountId, requestResponseId), + requestInquiryBatchesUpdate(BunqJSClient, userId, accountId), + ]); }) .catch(error => { dispatch(requestResponseNotLoading()); @@ -58,7 +59,7 @@ export function requestResponseReject(BunqJSClient, userId, accountId, requestRe }) .catch(error => { dispatch(requestResponseNotLoading()); - BunqErrorHandler(dispatch, error, failedMessage); + // BunqErrorHandler(dispatch, error, failedMessage); }); }; } diff --git a/src/react/Actions/request_response_info.js b/src/Actions/request_response_info.js similarity index 93% rename from src/react/Actions/request_response_info.js rename to src/Actions/request_response_info.js index d4e13e5a..9d31e716 100644 --- a/src/react/Actions/request_response_info.js +++ b/src/Actions/request_response_info.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import RequestResponse from "../Models/RequestResponse"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import RequestResponse from "~models/RequestResponse"; import { requestResponsesSetInfo } from "./request_responses"; diff --git a/src/react/Actions/request_responses.js b/src/Actions/request_responses.js similarity index 95% rename from src/react/Actions/request_responses.js rename to src/Actions/request_responses.js index 49058d9e..f6eb1af2 100644 --- a/src/react/Actions/request_responses.js +++ b/src/Actions/request_responses.js @@ -1,5 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import RequestResponse from "../Models/RequestResponse"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import RequestResponse from "~models/RequestResponse"; export const STORED_REQUEST_RESPONSES = "BUNQDESKTOP_STORED_REQUEST_RESPONSES"; diff --git a/src/react/Actions/savings_goals.js b/src/Actions/savings_goals.js similarity index 100% rename from src/react/Actions/savings_goals.js rename to src/Actions/savings_goals.js diff --git a/src/react/Actions/scheduled_payments.js b/src/Actions/scheduled_payments.js similarity index 97% rename from src/react/Actions/scheduled_payments.js rename to src/Actions/scheduled_payments.js index 1fd0f226..3ff2bafe 100644 --- a/src/react/Actions/scheduled_payments.js +++ b/src/Actions/scheduled_payments.js @@ -1,4 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; export function scheduledPaymentsSetInfo(scheduled_payments, account_id) { return { diff --git a/src/react/Actions/share_invite_monetary_account_inquiries.js b/src/Actions/share_invite_monetary_account_inquiries.js similarity index 97% rename from src/react/Actions/share_invite_monetary_account_inquiries.js rename to src/Actions/share_invite_monetary_account_inquiries.js index 320116a9..25ebe7d0 100644 --- a/src/react/Actions/share_invite_monetary_account_inquiries.js +++ b/src/Actions/share_invite_monetary_account_inquiries.js @@ -1,4 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; export const STORED_SHARE_INVITE_MONETARY_ACCOUNT_INQUIRIES = "BUNQDESKTOP_SHARE_INVITE_MONETARY_ACCOUNT_INQUIRIES"; diff --git a/src/react/Actions/share_invite_monetary_account_inquiry.js b/src/Actions/share_invite_monetary_account_inquiry.js similarity index 89% rename from src/react/Actions/share_invite_monetary_account_inquiry.js rename to src/Actions/share_invite_monetary_account_inquiry.js index 8d512774..a5d19c06 100644 --- a/src/react/Actions/share_invite_monetary_account_inquiry.js +++ b/src/Actions/share_invite_monetary_account_inquiry.js @@ -1,6 +1,6 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { openSnackbar } from "./snackbar"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "./share_invite_monetary_account_inquiries"; +import { actions as snackbarActions } from "~store/snackbar"; export function shareInviteMonetaryAccountInquirySend( BunqJSClient, @@ -23,7 +23,7 @@ export function shareInviteMonetaryAccountInquirySend( ...shareOptions }) .then(result => { - dispatch(openSnackbar(successMessage)); + dispatch(snackbarActions.open({ message: successMessage })); // update the payments, accounts and share list dispatch(shareInviteMonetaryAccountInquiriesInfoUpdate(BunqJSClient, userId, accountId)); @@ -31,7 +31,8 @@ export function shareInviteMonetaryAccountInquirySend( }) .catch(error => { dispatch(shareInviteMonetaryAccountInquiryNotLoading()); - BunqErrorHandler(dispatch, error, failedMessage); + // FIXME + // BunqErrorHandler(dispatch, error, failedMessage); }); }; } diff --git a/src/react/Actions/share_invite_monetary_account_response.js b/src/Actions/share_invite_monetary_account_response.js similarity index 85% rename from src/react/Actions/share_invite_monetary_account_response.js rename to src/Actions/share_invite_monetary_account_response.js index 74b77df7..9bd90068 100644 --- a/src/react/Actions/share_invite_monetary_account_response.js +++ b/src/Actions/share_invite_monetary_account_response.js @@ -1,6 +1,5 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import { openSnackbar } from "./snackbar"; import { shareInviteMonetaryAccountResponsesInfoUpdate } from "./share_invite_monetary_account_responses"; +import { actions as snackbarActions } from "~store/snackbar"; export function shareInviteMonetaryAccountResponseChangeStatus( BunqJSClient, @@ -17,7 +16,7 @@ export function shareInviteMonetaryAccountResponseChangeStatus( BunqJSClient.api.shareInviteMonetaryAccountResponse .putStatus(userId, shareInviteMonetaryAccountResponseId, status) .then(result => { - dispatch(openSnackbar(successMessage)); + dispatch(snackbarActions.open({ message: successMessage })); // update the payments, accounts and share list dispatch(shareInviteMonetaryAccountResponsesInfoUpdate(BunqJSClient, userId, accountId)); @@ -25,7 +24,8 @@ export function shareInviteMonetaryAccountResponseChangeStatus( }) .catch(error => { dispatch(shareInviteMonetaryAccountResponseNotLoading()); - BunqErrorHandler(dispatch, error, failedMessage); + // FIXME + // BunqErrorHandler(dispatch, error, failedMessage); }); }; } diff --git a/src/react/Actions/share_invite_monetary_account_responses.js b/src/Actions/share_invite_monetary_account_responses.js similarity index 97% rename from src/react/Actions/share_invite_monetary_account_responses.js rename to src/Actions/share_invite_monetary_account_responses.js index 05e4f7d9..8cf86fa0 100644 --- a/src/react/Actions/share_invite_monetary_account_responses.js +++ b/src/Actions/share_invite_monetary_account_responses.js @@ -1,4 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; export const STORED_SHARE_INVITE_MONETARY_ACCOUNT_RESPONSES = "BUNQDESKTOP_SHARE_INVITE_MONETARY_ACCOUNT_RESPONSES"; diff --git a/src/react/Actions/sidebar.js b/src/Actions/sidebar.js similarity index 100% rename from src/react/Actions/sidebar.js rename to src/Actions/sidebar.js diff --git a/src/react/Actions/user.js b/src/Actions/user.js similarity index 89% rename from src/react/Actions/user.js rename to src/Actions/user.js index 291cad10..a36bf76c 100644 --- a/src/react/Actions/user.js +++ b/src/Actions/user.js @@ -1,8 +1,8 @@ import store from "store"; -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { registrationClearUserInfo } from "./registration"; -import { openSnackbar } from "./snackbar"; +import { actions as snackbarActions } from "~store/snackbar"; import { usersUpdate } from "./users"; const USER_ID_LOCATION = "BUNQDESKTOP_USER_ID"; @@ -53,8 +53,8 @@ export function userUpdateImage(BunqJSClient, userId, attachmentId, userType = " } apiPromise - .then(result => { - dispatch(openSnackbar(successMessage)); + .then(() => { + dispatch(snackbarActions.open({ message: successMessage })); dispatch(usersUpdate(BunqJSClient, true)); }) .catch(error => { diff --git a/src/react/Actions/users.js b/src/Actions/users.js similarity index 94% rename from src/react/Actions/users.js rename to src/Actions/users.js index 27fb3c79..d7809bb1 100644 --- a/src/react/Actions/users.js +++ b/src/Actions/users.js @@ -1,4 +1,4 @@ -import BunqErrorHandler from "../Functions/BunqErrorHandler"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; import { userSetInfo } from "./user"; export function usersUpdate(BunqJSClient, updated = false) { diff --git a/src/react/Reducers/general_filter.js b/src/Reducers/general_filter.js similarity index 100% rename from src/react/Reducers/general_filter.js rename to src/Reducers/general_filter.js diff --git a/src/react/Reducers/index.js b/src/Reducers/index.js similarity index 98% rename from src/react/Reducers/index.js rename to src/Reducers/index.js index be1e262b..951ae358 100644 --- a/src/react/Reducers/index.js +++ b/src/Reducers/index.js @@ -1,9 +1,9 @@ import { combineReducers } from "redux"; import { reducer as formReducer } from "redux-form"; -import amount_filter from "./amount_filter"; import account_id_filter from "./account_id_filter"; import accounts from "./accounts"; +import amount_filter from "./amount_filter"; import application from "./application"; import bunq_me_tabs from "./bunq_me_tabs"; import bunq_me_tab_filter from "./bunq_me_tab_filter"; @@ -13,7 +13,7 @@ import category_filter from "./category_filter"; import cards from "./cards"; import card_cvc2 from "./card_cvc2"; import card_id_filter from "./card_id_filter"; -import category_rules from "./category_rules.ts"; +import category_rules from "./category_rules"; import contacts from "./contacts"; import date_filter from "./date_filter"; import export_new from "./export_new"; diff --git a/src/react/Reducers/master_card_action_info.js b/src/Reducers/master_card_action_info.js similarity index 100% rename from src/react/Reducers/master_card_action_info.js rename to src/Reducers/master_card_action_info.js diff --git a/src/react/Reducers/master_card_actions.js b/src/Reducers/master_card_actions.js similarity index 90% rename from src/react/Reducers/master_card_actions.js rename to src/Reducers/master_card_actions.js index 2a5ff825..f478af3c 100644 --- a/src/react/Reducers/master_card_actions.js +++ b/src/Reducers/master_card_actions.js @@ -1,9 +1,6 @@ -import store from "store"; -import MergeApiObjects from "../Functions/MergeApiObjects"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import MergeApiObjects from "~functions/MergeApiObjects"; -import { STORED_MASTER_CARD_ACTIONS } from "../Actions/master_card_actions"; -import { STORED_BUNQ_ME_TABS } from "../Actions/bunq_me_tabs"; +import { STORED_MASTER_CARD_ACTIONS } from "~actions/master_card_actions"; export const defaultState = { master_card_actions: [], diff --git a/src/react/Reducers/modal.js b/src/Reducers/modal.js similarity index 100% rename from src/react/Reducers/modal.js rename to src/Reducers/modal.js diff --git a/src/react/Reducers/note_texts.js b/src/Reducers/note_texts.js similarity index 100% rename from src/react/Reducers/note_texts.js rename to src/Reducers/note_texts.js diff --git a/src/react/Reducers/oauth.js b/src/Reducers/oauth.js similarity index 98% rename from src/react/Reducers/oauth.js rename to src/Reducers/oauth.js index 277fef15..41a53209 100644 --- a/src/react/Reducers/oauth.js +++ b/src/Reducers/oauth.js @@ -5,7 +5,7 @@ import { OAUTH_CLIENT_DETAILS_SECRET, OAUTH_SANDBOX_CLIENT_DETAILS_ID, OAUTH_SANDBOX_CLIENT_DETAILS_SECRET -} from "../Actions/oauth"; +} from "~actions/oauth"; const storedClientId = store.get(OAUTH_CLIENT_DETAILS_ID); const storedClientSecret = store.get(OAUTH_CLIENT_DETAILS_SECRET); diff --git a/src/react/Reducers/options.js b/src/Reducers/options.js similarity index 99% rename from src/react/Reducers/options.js rename to src/Reducers/options.js index 217b4285..a717f5f1 100644 --- a/src/react/Reducers/options.js +++ b/src/Reducers/options.js @@ -1,6 +1,6 @@ import store from "store"; import { ipcRenderer } from "electron"; -import settings from "../ImportWrappers/electronSettings"; +import settings from "~importwrappers/electronSettings"; export const SYNC_ON_STARTUP_LOCATION = "BUNQDESKTOP_SYNC_ON_STARTUP"; export const THEME_LOCATION = "BUNQDESKTOP_THEME"; diff --git a/src/react/Reducers/pagination.js b/src/Reducers/pagination.js similarity index 100% rename from src/react/Reducers/pagination.js rename to src/Reducers/pagination.js diff --git a/src/react/Reducers/pay.js b/src/Reducers/pay.js similarity index 100% rename from src/react/Reducers/pay.js rename to src/Reducers/pay.js diff --git a/src/react/Reducers/payment_filter.js b/src/Reducers/payment_filter.js similarity index 100% rename from src/react/Reducers/payment_filter.js rename to src/Reducers/payment_filter.js diff --git a/src/react/Reducers/payment_info.js b/src/Reducers/payment_info.js similarity index 100% rename from src/react/Reducers/payment_info.js rename to src/Reducers/payment_info.js diff --git a/src/react/Reducers/payments.js b/src/Reducers/payments.js similarity index 92% rename from src/react/Reducers/payments.js rename to src/Reducers/payments.js index 6bb954d0..a1409dad 100644 --- a/src/react/Reducers/payments.js +++ b/src/Reducers/payments.js @@ -1,8 +1,8 @@ import store from "store"; -import MergeApiObjects from "../Functions/MergeApiObjects"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import MergeApiObjects from "~functions/MergeApiObjects"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; -import { STORED_PAYMENTS } from "../Actions/payments"; +import { STORED_PAYMENTS } from "~actions/payments"; export const defaultState = { payments: [], diff --git a/src/react/Reducers/pending_payments.js b/src/Reducers/pending_payments.js similarity index 95% rename from src/react/Reducers/pending_payments.js rename to src/Reducers/pending_payments.js index 25a67536..04b58f18 100644 --- a/src/react/Reducers/pending_payments.js +++ b/src/Reducers/pending_payments.js @@ -1,7 +1,7 @@ import store from "store"; -import { generateGUID } from "../Functions/Utils"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; -import { PENDING_PAYMENTS_LOCATION } from "../Actions/pending_payments"; +import { generateGUID } from "~functions/Utils"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; +import { PENDING_PAYMENTS_LOCATION } from "~actions/pending_payments"; export const defaultState = { last_updated: new Date(), diff --git a/src/react/Reducers/queue.js b/src/Reducers/queue.js similarity index 100% rename from src/react/Reducers/queue.js rename to src/Reducers/queue.js diff --git a/src/react/Reducers/registration.js b/src/Reducers/registration.js similarity index 100% rename from src/react/Reducers/registration.js rename to src/Reducers/registration.js diff --git a/src/react/Reducers/request_filter.js b/src/Reducers/request_filter.js similarity index 100% rename from src/react/Reducers/request_filter.js rename to src/Reducers/request_filter.js diff --git a/src/react/Reducers/request_inquiries.js b/src/Reducers/request_inquiries.js similarity index 93% rename from src/react/Reducers/request_inquiries.js rename to src/Reducers/request_inquiries.js index 4d5e8cb2..14421c54 100644 --- a/src/react/Reducers/request_inquiries.js +++ b/src/Reducers/request_inquiries.js @@ -1,8 +1,8 @@ import store from "store"; -import MergeApiObjects from "../Functions/MergeApiObjects"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import MergeApiObjects from "~functions/MergeApiObjects"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; -import { STORED_REQUEST_INQUIRIES } from "../Actions/request_inquiries"; +import { STORED_REQUEST_INQUIRIES } from "~actions/request_inquiries"; export const defaultState = { request_inquiries: [], diff --git a/src/react/Reducers/request_inquiry.js b/src/Reducers/request_inquiry.js similarity index 100% rename from src/react/Reducers/request_inquiry.js rename to src/Reducers/request_inquiry.js diff --git a/src/react/Reducers/request_inquiry_batches.js b/src/Reducers/request_inquiry_batches.js similarity index 93% rename from src/react/Reducers/request_inquiry_batches.js rename to src/Reducers/request_inquiry_batches.js index 4a2e6883..919bef4a 100644 --- a/src/react/Reducers/request_inquiry_batches.js +++ b/src/Reducers/request_inquiry_batches.js @@ -1,8 +1,8 @@ import store from "store"; -import MergeApiObjects from "../Functions/MergeApiObjects"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import MergeApiObjects from "~functions/MergeApiObjects"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; -import { STORED_REQUEST_INQUIRY_BATCHES } from "../Actions/request_inquiry_batches"; +import { STORED_REQUEST_INQUIRY_BATCHES } from "~actions/request_inquiry_batches"; export const defaultState = { request_inquiry_batches: [], diff --git a/src/react/Reducers/request_inquiry_info.js b/src/Reducers/request_inquiry_info.js similarity index 100% rename from src/react/Reducers/request_inquiry_info.js rename to src/Reducers/request_inquiry_info.js diff --git a/src/react/Reducers/request_response.js b/src/Reducers/request_response.js similarity index 100% rename from src/react/Reducers/request_response.js rename to src/Reducers/request_response.js diff --git a/src/react/Reducers/request_response_info.js b/src/Reducers/request_response_info.js similarity index 100% rename from src/react/Reducers/request_response_info.js rename to src/Reducers/request_response_info.js diff --git a/src/react/Reducers/request_responses.js b/src/Reducers/request_responses.js similarity index 93% rename from src/react/Reducers/request_responses.js rename to src/Reducers/request_responses.js index bae57e92..ba1f1e0f 100644 --- a/src/react/Reducers/request_responses.js +++ b/src/Reducers/request_responses.js @@ -1,8 +1,8 @@ import store from "store"; -import MergeApiObjects from "../Functions/MergeApiObjects"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import MergeApiObjects from "~functions/MergeApiObjects"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; -import { STORED_REQUEST_RESPONSES } from "../Actions/request_responses"; +import { STORED_REQUEST_RESPONSES } from "~actions/request_responses"; export const defaultState = { request_responses: [], diff --git a/src/react/Reducers/savings_goals.js b/src/Reducers/savings_goals.js similarity index 96% rename from src/react/Reducers/savings_goals.js rename to src/Reducers/savings_goals.js index 593468d7..dfc502c2 100644 --- a/src/react/Reducers/savings_goals.js +++ b/src/Reducers/savings_goals.js @@ -1,6 +1,6 @@ -import settings from "../ImportWrappers/electronSettings"; -import { generateGUID } from "../Functions/Utils"; -import SavingsGoal from "../Models/SavingsGoal"; +import settings from "~importwrappers/electronSettings"; +import { generateGUID } from "~functions/Utils"; +import SavingsGoal from "~models/SavingsGoal"; export const BUNQDESKTOP_SAVINGS_GOALS = "BUNQDESKTOP_SAVINGS_GOALS"; diff --git a/src/react/Reducers/scheduled_payments.js b/src/Reducers/scheduled_payments.js similarity index 100% rename from src/react/Reducers/scheduled_payments.js rename to src/Reducers/scheduled_payments.js diff --git a/src/react/Reducers/search_filter.js b/src/Reducers/search_filter.js similarity index 100% rename from src/react/Reducers/search_filter.js rename to src/Reducers/search_filter.js diff --git a/src/react/Reducers/share_invite_monetary_account_inquiries.js b/src/Reducers/share_invite_monetary_account_inquiries.js similarity index 93% rename from src/react/Reducers/share_invite_monetary_account_inquiries.js rename to src/Reducers/share_invite_monetary_account_inquiries.js index e09bd40a..c98f18f9 100644 --- a/src/react/Reducers/share_invite_monetary_account_inquiries.js +++ b/src/Reducers/share_invite_monetary_account_inquiries.js @@ -1,6 +1,6 @@ import store from "store"; -import { STORED_SHARE_INVITE_MONETARY_ACCOUNT_INQUIRIES } from "../Actions/share_invite_monetary_account_inquiries"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import { STORED_SHARE_INVITE_MONETARY_ACCOUNT_INQUIRIES } from "~actions/share_invite_monetary_account_inquiries"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; export const defaultState = { share_invite_monetary_account_inquiries: [], diff --git a/src/react/Reducers/share_invite_monetary_account_inquiry.js b/src/Reducers/share_invite_monetary_account_inquiry.js similarity index 100% rename from src/react/Reducers/share_invite_monetary_account_inquiry.js rename to src/Reducers/share_invite_monetary_account_inquiry.js diff --git a/src/react/Reducers/share_invite_monetary_account_responses.js b/src/Reducers/share_invite_monetary_account_responses.js similarity index 93% rename from src/react/Reducers/share_invite_monetary_account_responses.js rename to src/Reducers/share_invite_monetary_account_responses.js index f2f0a372..a0986cb3 100644 --- a/src/react/Reducers/share_invite_monetary_account_responses.js +++ b/src/Reducers/share_invite_monetary_account_responses.js @@ -1,6 +1,6 @@ import store from "store"; -import { STORED_SHARE_INVITE_MONETARY_ACCOUNT_RESPONSES } from "../Actions/share_invite_monetary_account_responses"; -import { storeEncryptString } from "../Functions/Crypto/CryptoWorkerWrapper"; +import { STORED_SHARE_INVITE_MONETARY_ACCOUNT_RESPONSES } from "~actions/share_invite_monetary_account_responses"; +import { storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; export const defaultState = { share_invite_monetary_account_responses: [], diff --git a/src/react/Reducers/sidebar.js b/src/Reducers/sidebar.js similarity index 100% rename from src/react/Reducers/sidebar.js rename to src/Reducers/sidebar.js diff --git a/src/react/Reducers/user.js b/src/Reducers/user.js similarity index 100% rename from src/react/Reducers/user.js rename to src/Reducers/user.js diff --git a/src/react/Reducers/users.js b/src/Reducers/users.js similarity index 100% rename from src/react/Reducers/users.js rename to src/Reducers/users.js diff --git a/src/app.js b/src/app.js deleted file mode 100644 index c376dfc5..00000000 --- a/src/app.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./helpers/context_menu.js"; -import "./helpers/external_links.js"; diff --git a/src/app.ts b/src/app.ts new file mode 100644 index 00000000..3f22bc3e --- /dev/null +++ b/src/app.ts @@ -0,0 +1,5 @@ +import "~helpers/context_menu"; +import "~helpers/external_links"; +import BunqDesktopClient from "~components/BunqDesktopClient"; + +export type AppWindow = Window & { BunqDesktopClient: BunqDesktopClient; t: Function }; diff --git a/src/background.js b/src/background.ts similarity index 91% rename from src/background.js rename to src/background.ts index 8f61173d..4ee03718 100644 --- a/src/background.js +++ b/src/background.ts @@ -5,19 +5,19 @@ import url from "url"; import path from "path"; import log from "electron-log"; import settings from "electron-settings"; -import { devMenuTemplate } from "./menu/dev_menu_template"; -import { editMenuTemplate } from "./menu/edit_menu_template"; -import { helpMenuTemplate } from "./menu/help_menu_template"; -import { viewMenuTemplate } from "./menu/view_menu_template"; -import { windowMenuTemplate } from "./menu/window_menu_template"; -import darwinMenuTemplates from "./menu/darwin_menu_templates"; -import createWindow from "./helpers/window"; -import registerShortcuts from "./helpers/shortcuts"; -import registerTouchBar from "./helpers/touchbar"; -import setupTrayIcon from "./helpers/tray"; -import settingsHelper from "./helpers/settings"; -import oauth from "./helpers/oauth"; -import devTools from "./helpers/devtools"; +import { devMenuTemplate } from "~menu/dev_menu_template"; +import { editMenuTemplate } from "~menu/edit_menu_template"; +import { helpMenuTemplate } from "~menu/help_menu_template"; +import { viewMenuTemplate } from "~menu/view_menu_template"; +import { windowMenuTemplate } from "~menu/window_menu_template"; +import darwinMenuTemplates from "~menu/darwin_menu_templates"; +import createWindow from "~helpers/window"; +import registerShortcuts from "~helpers/shortcuts"; +import registerTouchBar from "~helpers/touchbar"; +import setupTrayIcon from "~helpers/tray"; +import settingsHelper from "~helpers/settings"; +import oauth from "~helpers/oauth"; +import devTools from "~helpers/devtools"; import env from "./env"; // disable security warnings since we need cross-origin requests @@ -27,7 +27,7 @@ const platform = os.platform(); let userDataPath = app.getPath("userData"); const imagesDir = path.join(__dirname, `..${path.sep}app${path.sep}images${path.sep}`); -let trayIcon = ""; +let trayIcon; if (platform === "darwin") { trayIcon = nativeImage.createFromPath(`${imagesDir}logoTemplate@1x.png`); trayIcon.setTemplateImage(true); diff --git a/src/react/Components/AccountCard.jsx b/src/components/AccountCard.tsx similarity index 91% rename from src/react/Components/AccountCard.jsx rename to src/components/AccountCard.tsx index 735932ee..b5835d0c 100644 --- a/src/react/Components/AccountCard.jsx +++ b/src/components/AccountCard.tsx @@ -12,16 +12,20 @@ import DeleteIcon from "@material-ui/icons/Delete"; import EditIcon from "@material-ui/icons/Edit"; import LinkIcon from "@material-ui/icons/Link"; import PeopleIcon from "@material-ui/icons/People"; +import BunqDesktopClient from "~components/BunqDesktopClient"; import UploadFullscreen from "./FileUpload/UploadFullscreen"; import LazyAttachmentImage from "./AttachmentImage/LazyAttachmentImage"; import AccountQRFullscreen from "./QR/AccountQRFullscreen"; import AliasList from "./AliasList"; -import { formatMoney } from "../Functions/Utils"; -import { connectGetBudget } from "../Functions/ConnectGetPermissions"; -import { openSnackbar } from "../Actions/snackbar"; -import { accountsUpdateImage } from "../Actions/accounts"; +import { formatMoney } from "~functions/Utils"; +import { connectGetBudget } from "~functions/ConnectGetPermissions"; + +import { actions as snackbarActions } from "~store/snackbar"; +import { actions as accountsActions } from "~store/accounts"; + +declare let window: Window & { BunqDesktopClient: BunqDesktopClient; t: Function }; const styles = { avatar: { @@ -169,9 +173,9 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, props) => { const { BunqJSClient } = props; return { - openSnackbar: message => dispatch(openSnackbar(message)), + openSnackbar: message => dispatch(snackbarActions.open( { message })), accountsUpdateImage: (userId, accountId, attachmentId, accountType) => - dispatch(accountsUpdateImage(BunqJSClient, userId, accountId, attachmentId, accountType)) + dispatch(accountsActions.updateImage(BunqJSClient, userId, accountId, attachmentId, accountType)) }; }; diff --git a/src/react/Components/AccountList/AccountAvatarCircularProgress.jsx b/src/components/AccountList/AccountAvatarCircularProgress.tsx similarity index 93% rename from src/react/Components/AccountList/AccountAvatarCircularProgress.jsx rename to src/components/AccountList/AccountAvatarCircularProgress.tsx index 87697125..0569ba10 100644 --- a/src/react/Components/AccountList/AccountAvatarCircularProgress.jsx +++ b/src/components/AccountList/AccountAvatarCircularProgress.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import { connect } from "react-redux"; import CircularProgress from "@material-ui/core/CircularProgress"; @@ -25,7 +25,7 @@ const AccountAvatarCircularProgress = ({ account, theme, selected = false, style if (!isSavingsAccount) return null; return ( - + <>
-
+ ); }; diff --git a/src/react/Components/AccountList/AccountList.jsx b/src/components/AccountList/AccountList.tsx similarity index 87% rename from src/react/Components/AccountList/AccountList.jsx rename to src/components/AccountList/AccountList.tsx index 7e21abfa..c7bac120 100644 --- a/src/react/Components/AccountList/AccountList.jsx +++ b/src/components/AccountList/AccountList.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import { ipcRenderer } from "electron"; import { translate } from "react-i18next"; import { connect } from "react-redux"; @@ -14,28 +14,24 @@ import LinearProgress from "@material-ui/core/LinearProgress"; import RefreshIcon from "@material-ui/icons/Refresh"; import CheckBoxIcon from "@material-ui/icons/CheckBox"; import CheckBoxOutlinedIcon from "@material-ui/icons/CheckBoxOutlined"; +import { accountsUpdate } from "~store/accounts/thunks"; import LimitedPremiumListItem from "../LimitedPremiumListItem"; import AccountListItem from "./AccountListItem"; import AddAccount from "./AddAccount"; -import { formatMoney } from "../../Functions/Utils"; -import { connectGetBudget } from "../../Functions/ConnectGetPermissions"; -import { filterShareInviteMonetaryAccountResponses } from "../../Functions/DataFilters"; - -import { - accountsSelectAccount, - accountsUpdate, - accountExcludeFromTotal, - accountIncludeInTotal -} from "../../Actions/accounts"; -import { paymentInfoUpdate } from "../../Actions/payments"; -import { requestResponsesUpdate } from "../../Actions/request_responses"; -import { bunqMeTabsUpdate } from "../../Actions/bunq_me_tabs"; -import { masterCardActionsUpdate } from "../../Actions/master_card_actions"; -import { requestInquiriesUpdate } from "../../Actions/request_inquiries"; -import { updateStatisticsSavingsGoals } from "../../Actions/savings_goals"; -import { shareInviteMonetaryAccountResponsesInfoUpdate } from "../../Actions/share_invite_monetary_account_responses"; -import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "../../Actions/share_invite_monetary_account_inquiries"; +import { formatMoney } from "~functions/Utils"; +import { connectGetBudget } from "~functions/ConnectGetPermissions"; +import { filterShareInviteMonetaryAccountResponses } from "~functions/DataFilters"; + +import { paymentInfoUpdate } from "~actions/payments"; +import { requestResponsesUpdate } from "~actions/request_responses"; +import { masterCardActionsUpdate } from "~actions/master_card_actions"; +import { requestInquiriesUpdate } from "~actions/request_inquiries"; +import { updateStatisticsSavingsGoals } from "~actions/savings_goals"; +import { shareInviteMonetaryAccountResponsesInfoUpdate } from "~actions/share_invite_monetary_account_responses"; +import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "~actions/share_invite_monetary_account_inquiries"; +import { actions as accountsActions } from "~store/accounts"; +import { actions as bunqMeTabsActions } from "~store/bunqMeTabs"; const styles = { list: { @@ -46,7 +42,9 @@ const styles = { } }; -class AccountList extends React.Component { +class AccountList extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -63,7 +61,7 @@ class AccountList extends React.Component { componentDidUpdate(previousProps) { const { excludedAccountIds, shareInviteMonetaryAccountResponses, accounts } = this.props; - this.checkUpdateRequirement(this.props); + this.checkUpdateRequirement(); const accountsTrayItems = []; const totalBalance = accounts @@ -92,7 +90,7 @@ class AccountList extends React.Component { // get budget from this response if (filteredResponses.length > 0) { - const connectBudget = connectGetBudget(filteredResponses); + const connectBudget: any = connectGetBudget(filteredResponses); if (connectBudget) { accountTrayItem.balance = formatMoney(parseFloat(connectBudget)); @@ -222,7 +220,7 @@ class AccountList extends React.Component { } : false; - let secondaryAction = false; + let secondaryAction: false | React.ReactNode = false; if (accountTotalSelectionMode) { const excluded = excludedAccountIds.some(excludedAccountId => account.id === excludedAccountId); @@ -257,7 +255,7 @@ class AccountList extends React.Component { } return ( - + {isBunqPromoUser && ( - + <> - + )} {this.props.accountsLoading ? : } {accounts} {this.props.denseMode === false && this.props.limitedPermissions === false ? ( - + <> - + ) : null} ); } } +// @ts-ignore AccountList.defaultProps = { denseMode: false }; @@ -339,18 +338,18 @@ const mapDispatchToProps = (dispatch, ownProps) => { dispatch(requestResponsesUpdate(BunqJSClient, userId, accountId)), masterCardActionsUpdate: (userId, accountId) => dispatch(masterCardActionsUpdate(BunqJSClient, userId, accountId)), - bunqMeTabsUpdate: (userId, accountId) => dispatch(bunqMeTabsUpdate(BunqJSClient, userId, accountId)), + bunqMeTabsUpdate: (userId, accountId) => dispatch(bunqMeTabsActions.setInfo({ resetOldItems: false, BunqJSClient, user_id: userId, account_id: accountId })), accountsUpdate: userId => dispatch(accountsUpdate(BunqJSClient, userId)), - accountExcludeFromTotal: accountId => dispatch(accountExcludeFromTotal(accountId)), - accountIncludeInTotal: accountId => dispatch(accountIncludeInTotal(accountId)), + accountExcludeFromTotal: accountId => dispatch(accountsActions.excludeFromTotal(accountId)), + accountIncludeInTotal: accountId => dispatch(accountsActions.includeInTotal(accountId)), shareInviteMonetaryAccountResponsesInfoUpdate: userId => dispatch(shareInviteMonetaryAccountResponsesInfoUpdate(BunqJSClient, userId)), shareInviteMonetaryAccountInquiriesInfoUpdate: (userId, accountId) => dispatch(shareInviteMonetaryAccountInquiriesInfoUpdate(BunqJSClient, userId, accountId)), - selectAccount: acountId => dispatch(accountsSelectAccount(acountId)), + selectAccount: accountId => dispatch(accountsActions.selectAccount(accountId)), updateStatisticsSavingsGoals: (accounts, shareInviteMonetaryAccountResponses) => dispatch(updateStatisticsSavingsGoals(accounts, shareInviteMonetaryAccountResponses)) diff --git a/src/react/Components/AccountList/AccountListItem.jsx b/src/components/AccountList/AccountListItem.tsx similarity index 88% rename from src/react/Components/AccountList/AccountListItem.jsx rename to src/components/AccountList/AccountListItem.tsx index 2a1af2ef..9a4b9623 100644 --- a/src/react/Components/AccountList/AccountListItem.jsx +++ b/src/components/AccountList/AccountListItem.tsx @@ -1,25 +1,26 @@ -import React from "react"; -import { connect } from "react-redux"; +import React, { CSSProperties } from "react"; import { translate } from "react-i18next"; -import ListItem from "@material-ui/core/ListItem"; -import ListItemText from "@material-ui/core/ListItemText"; -import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import { connect } from "react-redux"; import Avatar from "@material-ui/core/Avatar"; import IconButton from "@material-ui/core/IconButton"; +import ListItem from "@material-ui/core/ListItem"; +import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; +import ListItemText from "@material-ui/core/ListItemText"; import InfoIcon from "@material-ui/icons/InfoOutlined"; import LinkIcon from "@material-ui/icons/Link"; import PeopleIcon from "@material-ui/icons/People"; -import LazyAttachmentImage from "../../Components/AttachmentImage/LazyAttachmentImage"; -import NavLink from "../../Components/Routing/NavLink"; -import AccountAvatarCircularProgress from "./AccountAvatarCircularProgress"; +import { addAccountIdFilter, removeAccountIdFilter, toggleAccountIdFilter } from "~actions/filters"; + +import LazyAttachmentImage from "~components/AttachmentImage/LazyAttachmentImage"; +import NavLink from "~components/Routing/NavLink"; +import { connectGetBudget } from "~functions/ConnectGetPermissions"; -import { formatMoney } from "../../Functions/Utils"; -import { connectGetBudget } from "../../Functions/ConnectGetPermissions"; +import { formatMoney } from "~functions/Utils"; +import AccountAvatarCircularProgress from "./AccountAvatarCircularProgress"; -import { accountsSelectAccount } from "../../Actions/accounts.js"; -import { addAccountIdFilter, removeAccountIdFilter, toggleAccountIdFilter } from "../../Actions/filters"; +import { actions as accountsActions } from "~store/accounts"; const styles = { bigAvatar: { @@ -40,7 +41,17 @@ const styles = { } }; -class AccountListItem extends React.Component { +class AccountListItem extends React.Component { + static defaultProps = { + clickable: true, + denseMode: false, + isJoint: false, + shareInviteMonetaryAccountResponses: [], + secondaryAction: false + }; + + state: any; + constructor(props, context) { super(props, context); this.state = {}; @@ -99,7 +110,7 @@ class AccountListItem extends React.Component { } // check if any of the selected account ids are for this account - let displayStyle = { + let displayStyle: CSSProperties = { height: 83, paddingLeft: 20 }; @@ -125,7 +136,7 @@ class AccountListItem extends React.Component { ? e => this.props.removeAccountIdFilter(account.id) : e => this.props.addAccountIdFilter(account.id); - const listItemProps = {}; + const listItemProps: any = {}; if (this.props.clickable) { listItemProps.button = true; listItemProps.onClick = this.props.onClick @@ -174,7 +185,7 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, ownProps) => { const { BunqJSClient } = ownProps; return { - selectAccount: acountId => dispatch(accountsSelectAccount(acountId)), + selectAccount: accountId => dispatch(accountsActions.selectAccount(accountId)), addAccountIdFilter: accountId => dispatch(addAccountIdFilter(accountId)), removeAccountIdFilter: index => dispatch(removeAccountIdFilter(index)), @@ -182,12 +193,4 @@ const mapDispatchToProps = (dispatch, ownProps) => { }; }; -AccountListItem.defaultProps = { - clickable: true, - denseMode: false, - isJoint: false, - shareInviteMonetaryAccountResponses: [], - secondaryAction: false -}; - export default connect(mapStateToProps, mapDispatchToProps)(translate("translations")(AccountListItem)); diff --git a/src/react/Components/AccountList/AccountListItemChip.jsx b/src/components/AccountList/AccountListItemChip.tsx similarity index 93% rename from src/react/Components/AccountList/AccountListItemChip.jsx rename to src/components/AccountList/AccountListItemChip.tsx index b1ea41a6..b25820b3 100644 --- a/src/react/Components/AccountList/AccountListItemChip.jsx +++ b/src/components/AccountList/AccountListItemChip.tsx @@ -2,7 +2,7 @@ import React from "react"; import Avatar from "@material-ui/core/Avatar"; import Chip from "@material-ui/core/Chip"; -import LazyAttachmentImage from "../../Components/AttachmentImage/LazyAttachmentImage"; +import LazyAttachmentImage from "~components/AttachmentImage/LazyAttachmentImage"; export default props => { const { diff --git a/src/react/Components/AccountList/AddAccount.jsx b/src/components/AccountList/AddAccount.tsx similarity index 94% rename from src/react/Components/AccountList/AddAccount.jsx rename to src/components/AccountList/AddAccount.tsx index 80c98f2a..fb613c56 100644 --- a/src/react/Components/AccountList/AddAccount.jsx +++ b/src/components/AccountList/AddAccount.tsx @@ -5,7 +5,7 @@ import ListItemText from "@material-ui/core/ListItemText"; import Avatar from "@material-ui/core/Avatar"; import AddBoxIcon from "@material-ui/icons/AddBox"; -import NavLink from "../../Components/Routing/NavLink"; +import NavLink from "~components/Routing/NavLink"; import { translate } from "react-i18next"; const styles = { diff --git a/src/react/Components/AliasList.jsx b/src/components/AliasList.tsx similarity index 86% rename from src/react/Components/AliasList.jsx rename to src/components/AliasList.tsx index 8daf8cf7..0429ef5e 100644 --- a/src/react/Components/AliasList.jsx +++ b/src/components/AliasList.tsx @@ -9,10 +9,10 @@ import EmailIcon from "@material-ui/icons/Email"; import PersonIcon from "@material-ui/icons/Person"; import UrlIcon from "@material-ui/icons/Link"; -import { formatIban } from "../Functions/Utils"; -import CopyToClipboardWrap from "../Components/CopyToClipboardWrap"; +import { formatIban } from "~functions/Utils"; +import CopyToClipboardWrap from "~components/CopyToClipboardWrap"; -export default ({ aliasses, copiedValue = () => {} }) => { +export default ({ aliasses, copiedValue = () => {} }: { aliasses: any[]; copiedValue: Function }) => { return aliasses.map(alias => { let value = alias.value; let icon = ; diff --git a/src/react/App.jsx b/src/components/App.tsx similarity index 70% rename from src/react/App.jsx rename to src/components/App.tsx index 29a03c60..b1b273da 100644 --- a/src/react/App.jsx +++ b/src/components/App.tsx @@ -1,18 +1,24 @@ +import BunqJSClient from "@bunq-community/bunq-js-client"; import React from "react"; import { Provider } from "react-redux"; import { HashRouter } from "react-router-dom"; import DateFnsUtils from "material-ui-pickers/utils/date-fns-utils"; import MuiPickersUtilsProvider from "material-ui-pickers/MuiPickersUtilsProvider"; -import Routes from "./Routes.jsx"; -import Layout from "./Components/Layout"; -import ErrorBoundary from "./Components/ErrorBoundary"; -import Store from "./Store.jsx"; +import Routes from "./Routes"; +import Layout from "~components/Layout"; +import ErrorBoundary from "~components/ErrorBoundary"; +import store from "~store/index"; // include translations setup import "./i18n"; -export default class App extends React.Component { +export interface IProps { + analytics: boolean; + BunqJSClient: BunqJSClient; +} + +export default class App extends React.Component { constructor(props, context) { super(props, context); this.state = {}; @@ -22,7 +28,7 @@ export default class App extends React.Component { return ( - + { + state: any; + _isMounted: boolean; + timeout: number; + imageUrl: false | string; -class AttachmentImage extends React.PureComponent { constructor(props, context) { super(props, context); this.state = { @@ -44,7 +52,7 @@ class AttachmentImage extends React.PureComponent { } // set a timeout as a fallback incase loading the image takes too long - this.timeout = setTimeout(() => { + this.timeout = +setTimeout(() => { if (this.state.imageUrl === false) { // still no image, fallback to temporary placeholder this.setState({ diff --git a/src/react/Components/AttachmentImage/LazyAttachmentImage.jsx b/src/components/AttachmentImage/LazyAttachmentImage.tsx similarity index 92% rename from src/react/Components/AttachmentImage/LazyAttachmentImage.jsx rename to src/components/AttachmentImage/LazyAttachmentImage.tsx index 46ed878d..bf695c19 100644 --- a/src/react/Components/AttachmentImage/LazyAttachmentImage.jsx +++ b/src/components/AttachmentImage/LazyAttachmentImage.tsx @@ -2,7 +2,9 @@ import React from "react"; import VisibilitySensor from "react-visibility-sensor"; import AttachmentImage from "./AttachmentImage"; -class LazyAttachmentImage extends React.PureComponent { +class LazyAttachmentImage extends React.PureComponent { + state: any; + constructor(props, context) { super(props, context); this.state = { diff --git a/src/react/BunqDesktopClient.ts b/src/components/BunqDesktopClient.ts similarity index 98% rename from src/react/BunqDesktopClient.ts rename to src/components/BunqDesktopClient.ts index e5fb0d5f..a20dcc73 100644 --- a/src/react/BunqDesktopClient.ts +++ b/src/components/BunqDesktopClient.ts @@ -1,12 +1,12 @@ import BunqJSClient from "@bunq-community/bunq-js-client"; import StorageInterface from "@bunq-community/bunq-js-client/dist/Interfaces/StorageInterface"; import awaiting from "awaiting"; -import { Environment, StoredApiKey } from "./Types/Types"; +import { Environment, StoredApiKey } from "~types/Types"; -import { decryptString, derivePasswordKey, encryptString } from "./Functions/Crypto/Crypto"; -import { storeDecryptString, storeEncryptString } from "./Functions/Crypto/CryptoWorkerWrapper"; -import Logger from "./Functions/Logger"; -import localforage from "./ImportWrappers/localforage"; +import { decryptString, derivePasswordKey, encryptString } from "~functions/Crypto/Crypto"; +import { storeDecryptString, storeEncryptString } from "~functions/Crypto/CryptoWorkerWrapper"; +import Logger from "~functions/Logger"; +import localforage from "~importwrappers/localforage"; import store from "store/dist/store.legacy"; export const SALT_LOCATION = "BUNQDESKTOP_PASSWORD_SALT"; diff --git a/src/react/Components/BunqMeTabList.jsx b/src/components/BunqMeTabList.tsx similarity index 92% rename from src/react/Components/BunqMeTabList.jsx rename to src/components/BunqMeTabList.tsx index 7c2e66d8..292b98e8 100644 --- a/src/react/Components/BunqMeTabList.jsx +++ b/src/components/BunqMeTabList.tsx @@ -16,10 +16,10 @@ import UrlIcon from "@material-ui/icons/Link"; import BunqMeTabListItem from "./ListItems/BunqMeTabListItem"; -import { openSnackbar } from "../Actions/snackbar"; -import { bunqMeTabPut } from "../Actions/bunq_me_tab"; +import { actions as snackbarActions } from "~store/snackbar"; +import { bunqMeTabPut } from "~store/bunqMeTab/thunks"; -const styles = { +const styles: any = { list: { textAlign: "left" }, @@ -29,7 +29,13 @@ const styles = { } }; -class BunqMeTabList extends React.Component { +class BunqMeTabList extends React.Component { + static defaultProps = { + secondaryActions: null + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -114,14 +120,10 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, props) => { const { BunqJSClient } = props; return { - openSnackbar: message => dispatch(openSnackbar(message)), + openSnackbar: message => dispatch(snackbarActions.open(message)), bunqMeTabPut: (userId, accountId, tabId, status) => dispatch(bunqMeTabPut(BunqJSClient, userId, accountId, tabId, status)) }; }; -BunqMeTabList.defaultProps = { - secondaryActions: null -}; - export default connect(mapStateToProps, mapDispatchToProps)(BunqMeTabList); diff --git a/src/react/Components/Categories/CategoryChip.jsx b/src/components/Categories/CategoryChip.tsx similarity index 97% rename from src/react/Components/Categories/CategoryChip.jsx rename to src/components/Categories/CategoryChip.tsx index d5197fab..e8165955 100644 --- a/src/react/Components/Categories/CategoryChip.jsx +++ b/src/components/Categories/CategoryChip.tsx @@ -1,6 +1,7 @@ import React from "react"; import Avatar from "@material-ui/core/Avatar"; import Chip from "@material-ui/core/Chip"; + import CustomIcon from "../CustomIcon"; export default props => { @@ -13,7 +14,7 @@ export default props => { onDelete } = props; - const chipProps = { + const chipProps: any = { style: style, label: category.label }; diff --git a/src/react/Components/Categories/CategoryChips.jsx b/src/components/Categories/CategoryChips.tsx similarity index 79% rename from src/react/Components/Categories/CategoryChips.jsx rename to src/components/Categories/CategoryChips.tsx index 03a73d6a..54601647 100644 --- a/src/react/Components/Categories/CategoryChips.jsx +++ b/src/components/Categories/CategoryChips.tsx @@ -11,7 +11,22 @@ const style = { justifyContent: "center" }; -class CategoryChips extends React.PureComponent { +class CategoryChips extends React.PureComponent { + static defaultProps = { + chipStyle: { + margin: 5 + }, + // when true this list will show all categories which do NOT match the item id + reverseChips: false, + onClick: false, + onDelete: false, + // overwrite the categories set in redux with a custom set + customCategories: false, + style: style + }; + + state: any; + constructor(props, context) { super(props, context); this.state = {}; @@ -48,19 +63,6 @@ class CategoryChips extends React.PureComponent { } } -CategoryChips.defaultProps = { - chipStyle: { - margin: 5 - }, - // when true this list will show all categories which do NOT match the item id - reverseChips: false, - onClick: false, - onDelete: false, - // overwrite the categories set in redux with a custom set - customCategories: false, - style: style -}; - const mapStateToProps = state => { return { categories: state.categories.categories, diff --git a/src/react/Components/Categories/CategoryEditor.jsx b/src/components/Categories/CategoryEditor.tsx similarity index 89% rename from src/react/Components/Categories/CategoryEditor.jsx rename to src/components/Categories/CategoryEditor.tsx index a166859d..8714b711 100644 --- a/src/react/Components/Categories/CategoryEditor.jsx +++ b/src/components/Categories/CategoryEditor.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import PropTypes from "prop-types"; import { connect } from "react-redux"; import { translate } from "react-i18next"; @@ -13,9 +13,9 @@ import ColorPicker from "../FormFields/ColorPicker"; import TranslateButton from "../TranslationHelpers/Button"; import TranslateTypography from "../TranslationHelpers/Typography"; -import { setCategory } from "../../Actions/categories"; +import { actions as categoriesActions } from "~store/categories"; -const styles = { +const styles: any = { titles: { textAlign: "center" }, iconPicker: { width: "100%" @@ -40,7 +40,22 @@ const styles = { } }; -class CategoryEditor extends React.Component { +export interface IProps { + style: CSSProperties; + deselectChip: Function; + setCategory: Function; + selectedCategoryId: boolean | string; + categories: any; + t: Function; +} + +class CategoryEditor extends React.Component { + static defaultProps = { + style: {}, + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -59,10 +74,10 @@ class CategoryEditor extends React.Component { componentDidUpdate() { if (this.state.categoryId !== this.props.selectedCategoryId) { - const stateChanges = { + const stateChanges: any = { categoryId: this.props.selectedCategoryId }; - if (this.props.selectedCategoryId && this.props.categories[this.props.selectedCategoryId]) { + if (typeof this.props.selectedCategoryId === 'string' && this.props.categories[this.props.selectedCategoryId]) { const categoryInfo = this.props.categories[this.props.selectedCategoryId]; stateChanges.label = categoryInfo.label; stateChanges.icon = categoryInfo.icon; @@ -85,7 +100,7 @@ class CategoryEditor extends React.Component { labelChange = event => { const labelValue = event.target.value; - const stateChanges = { + const stateChanges: any = { labelError: false }; if (labelValue.length <= 24) { @@ -212,16 +227,6 @@ class CategoryEditor extends React.Component { } } -CategoryEditor.defaultProps = { - style: {} -}; - -CategoryEditor.propTypes = { - style: PropTypes.object, - deselectChip: PropTypes.func, - selectedCategoryId: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]) -}; - const mapStateToProps = state => { return { categories: state.categories.categories, @@ -232,7 +237,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - setCategory: (...params) => dispatch(setCategory(...params)) + setCategory: (categoryId, label, color, icon, priority) => dispatch(categoriesActions.setCategory({ id: categoryId, label, color, icon, priority })), }; }; diff --git a/src/react/Components/Categories/CategoryHelper.js b/src/components/Categories/CategoryHelper.ts similarity index 100% rename from src/react/Components/Categories/CategoryHelper.js rename to src/components/Categories/CategoryHelper.ts diff --git a/src/react/Components/Categories/CategoryIcon.jsx b/src/components/Categories/CategoryIcon.tsx similarity index 100% rename from src/react/Components/Categories/CategoryIcon.jsx rename to src/components/Categories/CategoryIcon.tsx diff --git a/src/react/Components/Categories/CategoryIcons.jsx b/src/components/Categories/CategoryIcons.tsx similarity index 100% rename from src/react/Components/Categories/CategoryIcons.jsx rename to src/components/Categories/CategoryIcons.tsx diff --git a/src/react/Components/Categories/CategorySelector.jsx b/src/components/Categories/CategorySelector.tsx similarity index 81% rename from src/react/Components/Categories/CategorySelector.jsx rename to src/components/Categories/CategorySelector.tsx index 8417f7cd..d82d5f6a 100644 --- a/src/react/Components/Categories/CategorySelector.jsx +++ b/src/components/Categories/CategorySelector.tsx @@ -8,7 +8,7 @@ import Collapse from "@material-ui/core/Collapse"; import TranslateButton from "../TranslationHelpers/Button"; import CategoryChips from "./CategoryChips"; -import { removeCategoryConnection, setCategoryConnection } from "../../Actions/categories"; +import { actions as categoriesActions } from "~store/categories"; const styles = { title: { textAlign: "center" }, @@ -17,7 +17,14 @@ const styles = { } }; -class CategorySelector extends React.Component { +class CategorySelector extends React.Component { + static defaultProps = { + style: {}, + displayToggleButton: true + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -48,12 +55,12 @@ class CategorySelector extends React.Component { }; render() { - const { item, type, displayToggleButton, t } = this.props; + const { item, type, displayToggleButton } = this.props; if (!item[type]) return null; const itemInfo = item[type]; // don't allow the delete button by default - const categoryChipProps = { + const categoryChipProps: any = { type: type, id: itemInfo.id }; @@ -89,11 +96,6 @@ class CategorySelector extends React.Component { } } -CategorySelector.defaultProps = { - style: {}, - displayToggleButton: true -}; - const mapStateToProps = state => { return { categories: state.categories.categories, @@ -104,8 +106,8 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - setCategoryConnection: (...params) => dispatch(setCategoryConnection(...params)), - removeCategoryConnection: (...params) => dispatch(removeCategoryConnection(...params)) + setCategoryConnection: (id, type, itemInfo) => dispatch(categoriesActions.setCategoryConnection({ category_id: id, item_type: type, item_id: itemInfo })), + removeCategoryConnection: (id, type, itemInfo) => dispatch(categoriesActions.removeCategoryConnection({ category_id: id, item_type: type, item_id: itemInfo })) }; }; diff --git a/src/react/Components/Categories/CategorySelectorDialog.jsx b/src/components/Categories/CategorySelectorDialog.tsx similarity index 87% rename from src/react/Components/Categories/CategorySelectorDialog.jsx rename to src/components/Categories/CategorySelectorDialog.tsx index 8dd0dad0..ec53ceca 100644 --- a/src/react/Components/Categories/CategorySelectorDialog.jsx +++ b/src/components/Categories/CategorySelectorDialog.tsx @@ -4,11 +4,13 @@ import DialogContent from "@material-ui/core/DialogContent"; import DialogActions from "@material-ui/core/DialogActions"; import DialogTitle from "@material-ui/core/DialogTitle"; import Dialog from "@material-ui/core/Dialog"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import TranslateButton from "~components/TranslationHelpers/Button"; import CategorySelector from "./CategorySelector"; -class CategorySelectorDialog extends React.Component { +class CategorySelectorDialog extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = {}; diff --git a/src/react/Components/Categories/PrioritySorter.js b/src/components/Categories/PrioritySorter.ts similarity index 100% rename from src/react/Components/Categories/PrioritySorter.js rename to src/components/Categories/PrioritySorter.ts diff --git a/src/react/Components/CodeSplitting/ComponentLoader.jsx b/src/components/CodeSplitting/ComponentLoader.tsx similarity index 100% rename from src/react/Components/CodeSplitting/ComponentLoader.jsx rename to src/components/CodeSplitting/ComponentLoader.tsx diff --git a/src/react/Components/CodeSplitting/Loading.jsx b/src/components/CodeSplitting/Loading.tsx similarity index 81% rename from src/react/Components/CodeSplitting/Loading.jsx rename to src/components/CodeSplitting/Loading.tsx index 54da1773..f74a793f 100644 --- a/src/react/Components/CodeSplitting/Loading.jsx +++ b/src/components/CodeSplitting/Loading.tsx @@ -1,5 +1,5 @@ import React from "react"; -import Logger from "../../Functions/Logger"; +import Logger from "~functions/Logger"; export default ({ isLoading, pastDelay, error }) => { if (isLoading && pastDelay) { @@ -8,7 +8,7 @@ export default ({ isLoading, pastDelay, error }) => { } else if (error && !isLoading) { // failed to load the component console.error(error); - Logger.error("Failed to load", error); + Logger.error("Failed to load"); throw error; } else { // during loading diff --git a/src/react/Components/CombinedList/CombinedList.jsx b/src/components/CombinedList/CombinedList.tsx similarity index 96% rename from src/react/Components/CombinedList/CombinedList.jsx rename to src/components/CombinedList/CombinedList.tsx index 80ed5cf0..59404e30 100644 --- a/src/react/Components/CombinedList/CombinedList.jsx +++ b/src/components/CombinedList/CombinedList.tsx @@ -10,15 +10,14 @@ import ListSubheader from "@material-ui/core/ListSubheader"; import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import InfoIcon from "@material-ui/icons/Info"; +import { bunqMeTabPut } from "~store/bunqMeTab/thunks"; import ClearBtn from "../FilterComponents/ClearFilter"; import FilterDrawer from "../FilterComponents/FilterDrawer"; import ListControls from "./ListControls"; import EventData from "./EventData"; -import { openSnackbar } from "../../Actions/snackbar"; -import { bunqMeTabPut } from "../../Actions/bunq_me_tab"; -import { nextPage, previousPage, setPage, setPageSize, firstPage } from "../../Actions/pagination"; +import { nextPage, previousPage, setPage, setPageSize, firstPage } from "~actions/pagination"; import { paymentMapper, @@ -30,10 +29,12 @@ import { shareInviteMonetaryAccountInquiryMapper, shareInviteMonetaryAccountResponseMapper } from "./MapperFunctions"; -import { humanReadableDate } from "../../Functions/Utils"; -import FilterDisabledChecker from "../../Functions/FilterDisabledChecker"; +import { humanReadableDate } from "~functions/Utils"; +import FilterDisabledChecker from "~functions/FilterDisabledChecker"; -const styles = { +import { actions as snackbarActions } from "~store/snackbar"; + +const styles: any = { button: { width: "100%" }, @@ -59,7 +60,13 @@ const styles = { const STORED_SCROLL_POSITION = "STORED_SCROLL_POSITION"; -class CombinedList extends React.Component { +class CombinedList extends React.Component { + static defaultProps = { + hiddenTypes: [] + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -142,7 +149,7 @@ class CombinedList extends React.Component { ...shareInviteBankInquiries, ...payments ].sort(function(a, b) { - return new Date(b.filterDate) - new Date(a.filterDate); + return +new Date(b.filterDate) - +new Date(a.filterDate); }); this.setState( @@ -410,7 +417,7 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, ownProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: message => dispatch(openSnackbar(message)), + openSnackbar: message => dispatch(snackbarActions.open({ message })), bunqMeTabPut: (userId, accountId, tabId, status) => dispatch(bunqMeTabPut(BunqJSClient, userId, accountId, tabId, status)), firstPage: () => dispatch(firstPage()), @@ -421,8 +428,4 @@ const mapDispatchToProps = (dispatch, ownProps) => { }; }; -CombinedList.defaultProps = { - hiddenTypes: [] -}; - export default connect(mapStateToProps, mapDispatchToProps)(translate("translations")(CombinedList)); diff --git a/src/react/Components/CombinedList/EventData.jsx b/src/components/CombinedList/EventData.tsx similarity index 98% rename from src/react/Components/CombinedList/EventData.jsx rename to src/components/CombinedList/EventData.tsx index a5b6c1da..2057f580 100644 --- a/src/react/Components/CombinedList/EventData.jsx +++ b/src/components/CombinedList/EventData.tsx @@ -9,7 +9,7 @@ import IncomingIcon from "@material-ui/icons/KeyboardArrowDown"; import OutgoingIcon from "@material-ui/icons/KeyboardArrowUp"; import ChangeIcon from "@material-ui/icons/CompareArrows"; -import { formatMoney } from "../../Functions/Utils"; +import { formatMoney } from "~functions/Utils"; const styles = { gridContainer: { diff --git a/src/react/Components/CombinedList/ListControls.jsx b/src/components/CombinedList/ListControls.tsx similarity index 100% rename from src/react/Components/CombinedList/ListControls.jsx rename to src/components/CombinedList/ListControls.tsx diff --git a/src/react/Components/CombinedList/MapperFunctions.jsx b/src/components/CombinedList/MapperFunctions.tsx similarity index 99% rename from src/react/Components/CombinedList/MapperFunctions.jsx rename to src/components/CombinedList/MapperFunctions.tsx index b36542ce..52b9527a 100644 --- a/src/react/Components/CombinedList/MapperFunctions.jsx +++ b/src/components/CombinedList/MapperFunctions.tsx @@ -9,7 +9,7 @@ import RequestInquiryBatchListItem from "../ListItems/RequestInquiryBatchListIte import ShareInviteMonetaryAccountInquiryListItem from "../ListItems/ShareInviteMonetaryAccountInquiryListItem"; import ShareInviteMonetaryAccountResponseListItem from "../ListItems/ShareInviteMonetaryAccountResponseListItem"; -import { UTCDateToLocalDate } from "../../Functions/Utils"; +import { UTCDateToLocalDate } from "~functions/Utils"; import { paymentFilter, bunqMeTabsFilter, @@ -19,7 +19,7 @@ import { requestResponseFilter, shareInviteMonetaryAccountInquiryFilter, shareInviteMonetaryAccountResponseFilter -} from "../../Functions/DataFilters"; +} from "~functions/DataFilters"; export const paymentMapper = (settings, hiddenPaymentIds = []) => { if (settings.hiddenTypes.includes("Payment")) return []; diff --git a/src/react/Components/CopyToClipboardWrap.jsx b/src/components/CopyToClipboardWrap.tsx similarity index 100% rename from src/react/Components/CopyToClipboardWrap.jsx rename to src/components/CopyToClipboardWrap.tsx diff --git a/src/react/Components/CustomIcon.jsx b/src/components/CustomIcon.tsx similarity index 100% rename from src/react/Components/CustomIcon.jsx rename to src/components/CustomIcon.tsx diff --git a/src/react/Components/CustomSVG/FileDownload.jsx b/src/components/CustomSVG/FileDownload.tsx similarity index 100% rename from src/react/Components/CustomSVG/FileDownload.jsx rename to src/components/CustomSVG/FileDownload.tsx diff --git a/src/react/Components/CustomSVG/FileUpload.jsx b/src/components/CustomSVG/FileUpload.tsx similarity index 100% rename from src/react/Components/CustomSVG/FileUpload.jsx rename to src/components/CustomSVG/FileUpload.tsx diff --git a/src/react/Components/CustomSVG/Maximize.jsx b/src/components/CustomSVG/Maximize.tsx similarity index 100% rename from src/react/Components/CustomSVG/Maximize.jsx rename to src/components/CustomSVG/Maximize.tsx diff --git a/src/react/Components/CustomSVG/Minimize.jsx b/src/components/CustomSVG/Minimize.tsx similarity index 100% rename from src/react/Components/CustomSVG/Minimize.jsx rename to src/components/CustomSVG/Minimize.tsx diff --git a/src/react/Components/CustomSVG/Restore.jsx b/src/components/CustomSVG/Restore.tsx similarity index 100% rename from src/react/Components/CustomSVG/Restore.jsx rename to src/components/CustomSVG/Restore.tsx diff --git a/src/react/Components/CustomSVG/Trophy.jsx b/src/components/CustomSVG/Trophy.tsx similarity index 100% rename from src/react/Components/CustomSVG/Trophy.jsx rename to src/components/CustomSVG/Trophy.tsx diff --git a/src/react/Components/ErrorBoundary.jsx b/src/components/ErrorBoundary.tsx similarity index 87% rename from src/react/Components/ErrorBoundary.jsx rename to src/components/ErrorBoundary.tsx index 12f4d22c..b815d8d1 100644 --- a/src/react/Components/ErrorBoundary.jsx +++ b/src/components/ErrorBoundary.tsx @@ -1,11 +1,13 @@ import React from "react"; import Typography from "@material-ui/core/Typography"; -import Logger from "../Functions/Logger"; +import Logger from "~functions/Logger"; import TranslateButton from "./TranslationHelpers/Button"; import TranslateTypography from "./TranslationHelpers/Typography"; -export default class ErrorBoundary extends React.Component { +export default class ErrorBoundary extends React.Component { + state: any; + constructor(props) { super(props); this.state = { hasError: false, error: null, errorInfo: null }; @@ -33,11 +35,11 @@ export default class ErrorBoundary extends React.Component { {this.state.error.stack}
- {this.props.recoverableError === true ? ( + {!!this.props.recoverableError && ( Return to dashboard - ) : null} + )} ); } diff --git a/src/react/Components/ExportDialog.jsx b/src/components/ExportDialog.tsx similarity index 92% rename from src/react/Components/ExportDialog.jsx rename to src/components/ExportDialog.tsx index 58ae66c0..5d54339f 100644 --- a/src/react/Components/ExportDialog.jsx +++ b/src/components/ExportDialog.tsx @@ -7,8 +7,8 @@ import Slide from "@material-ui/core/Slide"; import TranslateButton from "./TranslationHelpers/Button"; import ReactJsonWrapper from "./ReactJsonWrapper"; -import { anonymizeObject } from "../Functions/Utils"; -import CopyToClipboardWrap from "../Components/CopyToClipboardWrap"; +import { anonymizeObject } from "~functions/Utils"; +import CopyToClipboardWrap from "~components/CopyToClipboardWrap"; const Transition = props => ; @@ -18,7 +18,9 @@ const styles = { } }; -export default class ExportDialog extends React.Component { +export default class ExportDialog extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { diff --git a/src/react/Components/FileUpload/FilePicker.jsx b/src/components/FileUpload/FilePicker.tsx similarity index 100% rename from src/react/Components/FileUpload/FilePicker.jsx rename to src/components/FileUpload/FilePicker.tsx diff --git a/src/react/Components/FileUpload/UploadFullscreen.jsx b/src/components/FileUpload/UploadFullscreen.tsx similarity index 95% rename from src/react/Components/FileUpload/UploadFullscreen.jsx rename to src/components/FileUpload/UploadFullscreen.tsx index 173e1905..d68b91db 100644 --- a/src/react/Components/FileUpload/UploadFullscreen.jsx +++ b/src/components/FileUpload/UploadFullscreen.tsx @@ -4,11 +4,12 @@ import { translate } from "react-i18next"; import Dialog from "@material-ui/core/Dialog"; import Typography from "@material-ui/core/Typography"; import Slide from "@material-ui/core/Slide"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import TranslateButton from "~components/TranslationHelpers/Button"; import FilePicker from "./FilePicker"; -import { openSnackbar } from "../../Actions/snackbar"; +import { actions as snackbarActions } from "~store/snackbar"; + const Transition = props => ; @@ -151,7 +152,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - openSnackbar: message => dispatch(openSnackbar(message)) + openSnackbar: message => dispatch(snackbarActions.open({ message })) }; }; diff --git a/src/react/Components/FilterComponents/AccountSelection.jsx b/src/components/FilterComponents/AccountSelection.tsx similarity index 98% rename from src/react/Components/FilterComponents/AccountSelection.jsx rename to src/components/FilterComponents/AccountSelection.tsx index 7df81f48..82e89dad 100644 --- a/src/react/Components/FilterComponents/AccountSelection.jsx +++ b/src/components/FilterComponents/AccountSelection.tsx @@ -15,7 +15,7 @@ import FilterListIcon from "@material-ui/icons/FilterList"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; -import { addAccountIdFilter, removeAccountIdFilter, toggleAccountIdFilter } from "../../Actions/filters"; +import { addAccountIdFilter, removeAccountIdFilter, toggleAccountIdFilter } from "~actions/filters"; const styles = { listItem: { @@ -110,7 +110,7 @@ class AccountSelection extends React.Component { }); return ( - + <> {t("Account filter")} @@ -133,7 +133,7 @@ class AccountSelection extends React.Component { {selectedAccountChipItems} - + ); } } diff --git a/src/react/Components/FilterComponents/AmountFilter.jsx b/src/components/FilterComponents/AmountFilter.tsx similarity index 95% rename from src/react/Components/FilterComponents/AmountFilter.jsx rename to src/components/FilterComponents/AmountFilter.tsx index 8c1de7f4..f3507447 100644 --- a/src/react/Components/FilterComponents/AmountFilter.jsx +++ b/src/components/FilterComponents/AmountFilter.tsx @@ -6,7 +6,7 @@ import TextField from "@material-ui/core/TextField"; import InputLabel from "@material-ui/core/InputLabel"; import FormControl from "@material-ui/core/FormControl"; -import { setAmountFilterAmount, setAmountFilterType, clearAmountFilter } from "../../Actions/filters"; +import { setAmountFilterAmount, setAmountFilterType, clearAmountFilter } from "~actions/filters"; class AmountFilter extends React.Component { constructor(props, context) { @@ -24,7 +24,7 @@ class AmountFilter extends React.Component { render() { const t = this.props.t; return ( - + <> {`>`} - + ); } } diff --git a/src/react/Components/FilterComponents/CardSelection.jsx b/src/components/FilterComponents/CardSelection.tsx similarity index 94% rename from src/react/Components/FilterComponents/CardSelection.jsx rename to src/components/FilterComponents/CardSelection.tsx index edd15551..a408029b 100644 --- a/src/react/Components/FilterComponents/CardSelection.jsx +++ b/src/components/FilterComponents/CardSelection.tsx @@ -14,12 +14,12 @@ import Tooltip from "@material-ui/core/Tooltip"; import AddIcon from "@material-ui/icons/Add"; import FilterListIcon from "@material-ui/icons/FilterList"; -import { cardsUpdate } from "../../Actions/cards"; -import { addCardIdFilter, removeCardIdFilter, toggleCardIdFilter } from "../../Actions/filters"; -import { getCardTypeImage } from "../../Pages/Cards/CardListItem"; -import { getCardDescription } from "../../Functions/Utils"; +import { addCardIdFilter, removeCardIdFilter, toggleCardIdFilter } from "~actions/filters"; +import { getCardTypeImage } from "~pages/Cards/CardListItem"; +import { getCardDescription } from "~functions/Utils"; +import { cardsUpdate } from "~store/cards/thunks"; -const styles = { +const styles: any = { listItem: { display: "flex", flexWrap: "wrap", @@ -46,7 +46,9 @@ const styles = { } }; -class CardSelection extends React.Component { +class CardSelection extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -133,7 +135,7 @@ class CardSelection extends React.Component { }); return ( - + <> {t("Card filter")} @@ -156,7 +158,7 @@ class CardSelection extends React.Component { {selectedCardChipItems} - + ); } } diff --git a/src/react/Components/FilterComponents/CategorySelection.jsx b/src/components/FilterComponents/CategorySelection.tsx similarity index 98% rename from src/react/Components/FilterComponents/CategorySelection.jsx rename to src/components/FilterComponents/CategorySelection.tsx index 2c76d2cd..00861661 100644 --- a/src/react/Components/FilterComponents/CategorySelection.jsx +++ b/src/components/FilterComponents/CategorySelection.tsx @@ -16,7 +16,7 @@ import CustomIcon from "../CustomIcon"; import CategoryIcon from "../Categories/CategoryIcon"; import CategoryChip from "../Categories/CategoryChip"; -import { addCategoryIdFilter, removeCategoryIdFilter, toggleCategoryIdFilter } from "../../Actions/filters"; +import { addCategoryIdFilter, removeCategoryIdFilter, toggleCategoryIdFilter } from "~actions/filters"; const styles = { listItem: { @@ -101,7 +101,7 @@ class CategorySelection extends React.Component { }); return ( - + <> {t("Category filter")} @@ -132,7 +132,7 @@ class CategorySelection extends React.Component { {categoryItems} - + ); } } diff --git a/src/react/Components/FilterComponents/ClearFilter.jsx b/src/components/FilterComponents/ClearFilter.tsx similarity index 95% rename from src/react/Components/FilterComponents/ClearFilter.jsx rename to src/components/FilterComponents/ClearFilter.tsx index ea625a9e..2ba49d89 100644 --- a/src/react/Components/FilterComponents/ClearFilter.jsx +++ b/src/components/FilterComponents/ClearFilter.tsx @@ -4,9 +4,9 @@ import Button from "@material-ui/core/Button"; import IconButton from "@material-ui/core/IconButton"; import ClearIcon from "@material-ui/icons/Clear"; -import FilterDisabledChecker from "../../Functions/FilterDisabledChecker"; +import FilterDisabledChecker from "~functions/FilterDisabledChecker"; -import { resetFilters } from "../../Actions/filters"; +import { resetFilters } from "~actions/filters"; class ClearFilter extends React.PureComponent { constructor(props, context) { diff --git a/src/react/Components/FilterComponents/FilterDrawer.jsx b/src/components/FilterComponents/FilterDrawer.tsx similarity index 99% rename from src/react/Components/FilterComponents/FilterDrawer.jsx rename to src/components/FilterComponents/FilterDrawer.tsx index 5d3cdec0..d4e9deed 100644 --- a/src/react/Components/FilterComponents/FilterDrawer.jsx +++ b/src/components/FilterComponents/FilterDrawer.tsx @@ -1,7 +1,7 @@ import React from "react"; import { connect } from "react-redux"; import { translate } from "react-i18next"; -import DatePicker from "material-ui-pickers/DatePicker/index.js"; +import DatePicker from "material-ui-pickers/DatePicker"; import { withTheme } from "@material-ui/core/styles"; import IconButton from "@material-ui/core/IconButton"; import Icon from "@material-ui/core/Icon"; @@ -41,7 +41,7 @@ import { clearFromDateFilter, clearToDateFilter, resetFilters -} from "../../Actions/filters"; +} from "~actions/filters"; import SearchFilter from "./SearchFilter"; import AccountSelection from "./AccountSelection"; @@ -349,7 +349,7 @@ class FilterDrawer extends React.Component { {displayDateFilters && ( - + <> - + )} diff --git a/src/react/Components/FilterComponents/SearchFilter.jsx b/src/components/FilterComponents/SearchFilter.tsx similarity index 95% rename from src/react/Components/FilterComponents/SearchFilter.jsx rename to src/components/FilterComponents/SearchFilter.tsx index 5bf5af31..a4e3ecac 100644 --- a/src/react/Components/FilterComponents/SearchFilter.jsx +++ b/src/components/FilterComponents/SearchFilter.tsx @@ -6,7 +6,7 @@ import InputAdornment from "@material-ui/core/InputAdornment"; import ClearIcon from "@material-ui/icons/Clear"; -import { setSearchFilter, clearSearchFilter } from "../../Actions/filters"; +import { setSearchFilter, clearSearchFilter } from "~actions/filters"; class SearchFilter extends React.Component { constructor(props, context) { diff --git a/src/react/Components/FilterCreationDialog.jsx b/src/components/FilterCreationDialog.tsx similarity index 98% rename from src/react/Components/FilterCreationDialog.jsx rename to src/components/FilterCreationDialog.tsx index 769e5c43..23050d01 100644 --- a/src/react/Components/FilterCreationDialog.jsx +++ b/src/components/FilterCreationDialog.tsx @@ -9,7 +9,7 @@ import ListItemText from "@material-ui/core/ListItemText"; import TranslateButton from "./TranslationHelpers/Button"; import NavLink from "./Routing/NavLink"; -import { formatIban } from "../Functions/Utils"; +import { formatIban } from "~functions/Utils"; export default props => { const { t, item, open, onClose } = props; diff --git a/src/react/Components/FormFields/AccountSelectorDialog.jsx b/src/components/FormFields/AccountSelectorDialog.tsx similarity index 96% rename from src/react/Components/FormFields/AccountSelectorDialog.jsx rename to src/components/FormFields/AccountSelectorDialog.tsx index 9506f081..8b96e13f 100644 --- a/src/react/Components/FormFields/AccountSelectorDialog.jsx +++ b/src/components/FormFields/AccountSelectorDialog.tsx @@ -13,9 +13,9 @@ import DialogTitle from "@material-ui/core/DialogTitle"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; -import { formatMoney } from "../../Functions/Utils"; -import { filterShareInviteMonetaryAccountResponses } from "../../Functions/DataFilters"; -import { connectGetBudget } from "../../Functions/ConnectGetPermissions"; +import { formatMoney } from "~functions/Utils"; +import { filterShareInviteMonetaryAccountResponses } from "~functions/DataFilters"; +import { connectGetBudget } from "~functions/ConnectGetPermissions"; const styles = { formControl: { diff --git a/src/react/Components/FormFields/ColorPicker.jsx b/src/components/FormFields/ColorPicker.tsx similarity index 100% rename from src/react/Components/FormFields/ColorPicker.jsx rename to src/components/FormFields/ColorPicker.tsx diff --git a/src/react/Components/FormFields/EmailSuggestions.jsx b/src/components/FormFields/EmailSuggestions.tsx similarity index 100% rename from src/react/Components/FormFields/EmailSuggestions.jsx rename to src/components/FormFields/EmailSuggestions.tsx diff --git a/src/react/Components/FormFields/FilePicker.jsx b/src/components/FormFields/FilePicker.tsx similarity index 100% rename from src/react/Components/FormFields/FilePicker.jsx rename to src/components/FormFields/FilePicker.tsx diff --git a/src/react/Components/FormFields/GradientColorPicker.jsx b/src/components/FormFields/GradientColorPicker.tsx similarity index 100% rename from src/react/Components/FormFields/GradientColorPicker.jsx rename to src/components/FormFields/GradientColorPicker.tsx diff --git a/src/react/Components/FormFields/IconPicker.jsx b/src/components/FormFields/IconPicker.tsx similarity index 90% rename from src/react/Components/FormFields/IconPicker.jsx rename to src/components/FormFields/IconPicker.tsx index 57633c4f..d77a35be 100644 --- a/src/react/Components/FormFields/IconPicker.jsx +++ b/src/components/FormFields/IconPicker.tsx @@ -1,5 +1,4 @@ import React from "react"; -import PropTypes from "prop-types"; import { translate } from "react-i18next"; import WindowedList from "react-windowed-list"; import Button from "@material-ui/core/Button"; @@ -8,10 +7,10 @@ import TextField from "@material-ui/core/TextField"; import Dialog from "@material-ui/core/Dialog"; import DialogTitle from "@material-ui/core/DialogTitle"; -import Icons from "../../StaticData/Icons"; +import Icons from "~staticdata/Icons.json"; import CustomIcon from "../CustomIcon"; -const styles = { +const styles: any = { iconContainer: { height: 500, width: 600, @@ -23,7 +22,16 @@ const styles = { } }; -class IconPicker extends React.Component { +class IconPicker extends React.Component { + static defaultProps = { + buttonLabel: "Pick an icon", + style: {}, + buttonStyle: {}, + buttonProps: {} + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -61,7 +69,7 @@ class IconPicker extends React.Component { } }; - selectIcon = icon => event => { + selectIcon = icon => () => { this.props.onClick(icon); this.handleClose(); }; @@ -110,15 +118,4 @@ class IconPicker extends React.Component { } } -IconPicker.defaultProps = { - buttonLabel: "Pick an icon", - style: {}, - buttonStyle: {}, - buttonProps: {} -}; - -IconPicker.propTypes = { - onClick: PropTypes.func.isRequired -}; - export default translate("translations")(IconPicker); diff --git a/src/react/Components/FormFields/InputSuggestions.jsx b/src/components/FormFields/InputSuggestions.tsx similarity index 100% rename from src/react/Components/FormFields/InputSuggestions.jsx rename to src/components/FormFields/InputSuggestions.tsx diff --git a/src/react/Components/FormFields/MoneyFormatInput.jsx b/src/components/FormFields/MoneyFormatInput.tsx similarity index 97% rename from src/react/Components/FormFields/MoneyFormatInput.jsx rename to src/components/FormFields/MoneyFormatInput.tsx index 41768d2b..4b91929a 100644 --- a/src/react/Components/FormFields/MoneyFormatInput.jsx +++ b/src/components/FormFields/MoneyFormatInput.tsx @@ -2,7 +2,7 @@ import React from "react"; import NumberFormat from "react-number-format"; import { withTheme } from "@material-ui/core/styles"; -import { preferedThousandSeparator, preferedDecimalSeparator } from "../../Functions/Utils"; +import { preferedThousandSeparator, preferedDecimalSeparator } from "~functions/Utils"; const MoneyFormatInput = props => { const { style, ...otherProps } = props; diff --git a/src/react/Components/FormFields/MoneyFormatInputDefault.jsx b/src/components/FormFields/MoneyFormatInputDefault.tsx similarity index 97% rename from src/react/Components/FormFields/MoneyFormatInputDefault.jsx rename to src/components/FormFields/MoneyFormatInputDefault.tsx index b059bfe8..0c3833a0 100644 --- a/src/react/Components/FormFields/MoneyFormatInputDefault.jsx +++ b/src/components/FormFields/MoneyFormatInputDefault.tsx @@ -2,7 +2,7 @@ import React from "react"; import NumberFormat from "react-number-format"; import Input from "@material-ui/core/Input"; import FormControl from "@material-ui/core/FormControl"; -import { preferedThousandSeparator, preferedDecimalSeparator } from "../../Functions/Utils"; +import { preferedThousandSeparator, preferedDecimalSeparator } from "~functions/Utils"; import { withTheme } from "@material-ui/core/styles"; diff --git a/src/react/Components/FormFields/RedirectUrl.jsx b/src/components/FormFields/RedirectUrl.tsx similarity index 100% rename from src/react/Components/FormFields/RedirectUrl.jsx rename to src/components/FormFields/RedirectUrl.tsx diff --git a/src/react/Components/FormFields/SchedulePaymentForm.jsx b/src/components/FormFields/SchedulePaymentForm.tsx similarity index 97% rename from src/react/Components/FormFields/SchedulePaymentForm.jsx rename to src/components/FormFields/SchedulePaymentForm.tsx index 560ccbc1..4b05fbc3 100644 --- a/src/react/Components/FormFields/SchedulePaymentForm.jsx +++ b/src/components/FormFields/SchedulePaymentForm.tsx @@ -11,8 +11,8 @@ import ListItem from "@material-ui/core/ListItem"; import ListItemText from "@material-ui/core/ListItemText"; import TranslateMenuItem from "../TranslationHelpers/MenuItem"; -import scheduleTexts from "../../Functions/ScheduleTexts"; -import { getUTCDate, UTCDateToLocalDate } from "../../Functions/Utils"; +import scheduleTexts from "~functions/ScheduleTexts"; +import { getUTCDate, UTCDateToLocalDate } from "~functions/Utils"; const styles = { textField: { diff --git a/src/react/Components/FormFields/TargetChip.jsx b/src/components/FormFields/TargetChip.tsx similarity index 100% rename from src/react/Components/FormFields/TargetChip.jsx rename to src/components/FormFields/TargetChip.tsx diff --git a/src/react/Components/FormFields/TargetChipList.jsx b/src/components/FormFields/TargetChipList.tsx similarity index 100% rename from src/react/Components/FormFields/TargetChipList.jsx rename to src/components/FormFields/TargetChipList.tsx diff --git a/src/react/Components/FormFields/TargetSelection.jsx b/src/components/FormFields/TargetSelection.tsx similarity index 95% rename from src/react/Components/FormFields/TargetSelection.jsx rename to src/components/FormFields/TargetSelection.tsx index e5a73728..a0d89d6f 100644 --- a/src/react/Components/FormFields/TargetSelection.jsx +++ b/src/components/FormFields/TargetSelection.tsx @@ -1,6 +1,5 @@ import React from "react"; import { connect } from "react-redux"; -import PropTypes from "prop-types"; import { translate } from "react-i18next"; import Grid from "@material-ui/core/Grid"; import Radio from "@material-ui/core/Radio"; @@ -15,9 +14,9 @@ import ContactsIcon from "@material-ui/icons/Contacts"; import NavLink from "../Routing/NavLink"; import InputSuggestions from "./InputSuggestions"; import AccountSelectorDialog from "./AccountSelectorDialog"; -import { openSnackbar } from "../../Actions/snackbar"; -import { formatIban } from "../../Functions/Utils"; +import { formatIban } from "~functions/Utils"; import TargetChipList from "./TargetChipList"; +import { actions as snackbarActions } from "~store/snackbar"; const styles = { button: { @@ -35,7 +34,13 @@ const styles = { } }; -class TargetSelection extends React.Component { +class TargetSelection extends React.Component { + static defaultProps = { + disabledTypes: [] + }; + + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -297,20 +302,8 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - openSnackbar: message => dispatch(openSnackbar(message)) + openSnackbar: message => dispatch(snackbarActions.open({ message })) }; }; -TargetSelection.propTypes = { - disabledTypes: PropTypes.array, - - addTarget: PropTypes.func.isRequired, - removeTarget: PropTypes.func.isRequired, - handleChange: PropTypes.func.isRequired, - handleChangeDirect: PropTypes.func.isRequired -}; -TargetSelection.defaultProps = { - disabledTypes: [] -}; - export default connect(mapStateToProps, mapDispatchToProps)(translate("translations")(TargetSelection)); diff --git a/src/react/Components/GeoLocation/GeoLocationListItem.jsx b/src/components/GeoLocation/GeoLocationListItem.tsx similarity index 94% rename from src/react/Components/GeoLocation/GeoLocationListItem.jsx rename to src/components/GeoLocation/GeoLocationListItem.tsx index a6b55cc3..16c8e27a 100644 --- a/src/react/Components/GeoLocation/GeoLocationListItem.jsx +++ b/src/components/GeoLocation/GeoLocationListItem.tsx @@ -29,12 +29,12 @@ class GeoLocationListItem extends React.Component { if (!geoLocation) return null; return ( - + <> - + ); } } diff --git a/src/react/Components/GeoLocation/GeoLocationMap.jsx b/src/components/GeoLocation/GeoLocationMap.tsx similarity index 100% rename from src/react/Components/GeoLocation/GeoLocationMap.jsx rename to src/components/GeoLocation/GeoLocationMap.tsx diff --git a/src/react/Components/GeoLocation/GeoLocationView.jsx b/src/components/GeoLocation/GeoLocationView.tsx similarity index 95% rename from src/react/Components/GeoLocation/GeoLocationView.jsx rename to src/components/GeoLocation/GeoLocationView.tsx index 4ea1e11c..8b8fd757 100644 --- a/src/react/Components/GeoLocation/GeoLocationView.jsx +++ b/src/components/GeoLocation/GeoLocationView.tsx @@ -2,7 +2,7 @@ import React from "react"; import Dialog from "@material-ui/core/Dialog"; import Slide from "@material-ui/core/Slide"; import GeoLocationMap from "./GeoLocationMap"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import TranslateButton from "~components/TranslationHelpers/Button"; const Transition = props => ; diff --git a/src/react/Components/Header.jsx b/src/components/Header.tsx similarity index 95% rename from src/react/Components/Header.jsx rename to src/components/Header.tsx index f0dde76b..f92c396a 100644 --- a/src/react/Components/Header.jsx +++ b/src/components/Header.tsx @@ -12,8 +12,8 @@ import MinimizeIcon from "./CustomSVG/Minimize"; import QueueHeaderIcon from "./Queue/QueueHeaderIcon"; import TranslateTypography from "./TranslationHelpers/Typography"; -import IsDarwin from "../Functions/IsDarwin"; -import { toggleSidebar } from "../Actions/sidebar"; +import IsDarwin from "~functions/IsDarwin"; +import { toggleSidebar } from "~actions/sidebar"; const remote = require("electron").remote; @@ -25,7 +25,7 @@ const buttonDefaultStyles = { zIndex: 1000 }; -const styles = { +const styles: any = { headerMenuBtn: { ...buttonDefaultStyles, left: 5 @@ -71,7 +71,11 @@ const styles = { } }; -class Header extends React.Component { +class Header extends React.Component { + state: any; + + mainWindow: any; + constructor(props, context) { super(props, context); this.state = { @@ -128,7 +132,7 @@ class Header extends React.Component { middleIcon = ; } const windowControls = displayButtons ? ( - + <> @@ -142,7 +146,7 @@ class Header extends React.Component { - + ) : null; const developmentEnvWarning = @@ -164,13 +168,13 @@ class Header extends React.Component {
{/* hide all buttons if pdf mode enabled */} {!pdfSaveModeEnabled && ( - + <> {wrappedButton} {wrappedQueueIcon} {developmentEnvWarning} {windowControls} - + )}
); diff --git a/src/react/Components/ImportDialog.tsx b/src/components/ImportDialog.tsx similarity index 100% rename from src/react/Components/ImportDialog.tsx rename to src/components/ImportDialog.tsx diff --git a/src/react/Components/Layout.jsx b/src/components/Layout.tsx similarity index 89% rename from src/react/Components/Layout.jsx rename to src/components/Layout.tsx index 6e91c4fb..56596073 100644 --- a/src/react/Components/Layout.jsx +++ b/src/components/Layout.tsx @@ -7,11 +7,12 @@ import Grid from "@material-ui/core/Grid"; import { withStyles } from "@material-ui/core/styles"; import MuiThemeProvider from "@material-ui/core/styles/MuiThemeProvider"; import createMuiTheme from "@material-ui/core/styles/createMuiTheme"; +import { AppWindow } from "~app"; // custom components -import BunqErrorHandler from "../Functions/BunqErrorHandler"; -import Logger from "../Functions/Logger"; -import VersionChecker from "../Functions/VersionChecker"; +import BunqErrorHandler from "~functions/BunqErrorHandler"; +import VersionChecker from "~functions/VersionChecker"; +import { AppDispatch, ReduxState } from "~store/index"; import NetworkStatusChecker from "./NetworkStatusChecker"; import RuleCollectionChecker from "./RuleCollectionChecker"; import QueueManager from "./Queue/QueueManager"; @@ -22,21 +23,25 @@ import Header from "./Header"; import ErrorBoundary from "./ErrorBoundary"; // themes -import DefaultThemeConfig from "../Themes/DefaultTheme"; -import DarkThemeConfig from "../Themes/DarkTheme"; -const DefaultTheme = createMuiTheme(DefaultThemeConfig); -const DarkTheme = createMuiTheme(DarkThemeConfig); +import DefaultThemeConfig from "~themes/DefaultTheme"; +import DarkThemeConfig from "~themes/DarkTheme"; +const DefaultTheme = createMuiTheme(DefaultThemeConfig as any); +const DarkTheme = createMuiTheme(DarkThemeConfig as any); const ThemeList = { DefaultTheme, DarkTheme }; // redux actions -import { openModal } from "../Actions/modal"; -import { openSnackbar } from "../Actions/snackbar"; -import { registrationClearUserInfo, registrationSetBunqDesktopClientData } from "../Actions/registration"; -import { setHideBalance, setTheme, setAutomaticThemeChange } from "../Actions/options"; -import { queueStartSync } from "../Actions/queue"; +import { openModal } from "~actions/modal"; +import { actions as snackbarActions } from "~store/snackbar"; +import { registrationClearUserInfo, registrationSetBunqDesktopClientData } from "~actions/registration"; +import { setHideBalance, setTheme, setAutomaticThemeChange } from "~actions/options"; +import { queueStartSync } from "~actions/queue"; + +const openSnackbar = snackbarActions.open; + +declare let window: AppWindow; const styles = theme => ({ contentContainer: { @@ -60,7 +65,18 @@ const styles = theme => ({ } }); -class Layout extends React.Component { +interface IProps { +} + +interface IState { +} + +class Layout extends React.Component & ReturnType & IProps> { + state: IState; + + minuteTimer: null | number; + activityTimer: null | number; + constructor(props, context) { super(props, context); this.state = { @@ -132,7 +148,7 @@ class Layout extends React.Component { // setup minute timer this.checkTime(); - this.minuteTimer = setInterval(this.checkTime, 5000); + this.minuteTimer = +setInterval(this.checkTime, 5000); } componentWillUpdate(nextProps) { @@ -217,7 +233,7 @@ class Layout extends React.Component { }; setActivityTimeout = () => { - this.activityTimer = setTimeout(() => { + this.activityTimer = +setTimeout(() => { // check if option is still enabled if (this.props.checkInactivity) { // reload the app @@ -301,7 +317,7 @@ class Layout extends React.Component { } } -const mapStateToProps = state => { +const mapStateToProps = (state: ReduxState) => { return { theme: state.options.theme, language: state.options.language, @@ -325,17 +341,17 @@ const mapStateToProps = state => { userLoading: state.user.loading, paymentsLoading: state.payments.loading, - bunqMeTabsLoading: state.bunq_me_tabs.loading, + bunqMeTabsLoading: state.bunqMeTabs.loading, masterCardActionsLoading: state.master_card_actions.loading, requestInquiriesLoading: state.request_inquiries.loading, requestResponsesLoading: state.request_responses.loading }; }; -const mapDispatchToProps = (dispatch, ownProps) => { +const mapDispatchToProps = (dispatch: AppDispatch, ownProps: IProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: (message, duration = 4000) => dispatch(openSnackbar(message, duration)), + openSnackbar: (message, duration = 4000) => dispatch(openSnackbar({ message, duration })), openModal: (message, title) => dispatch(openModal(message, title)), BunqErrorHandler: (error, customError = false) => BunqErrorHandler(dispatch, error, customError), @@ -353,6 +369,6 @@ const mapDispatchToProps = (dispatch, ownProps) => { }; }; -export default withStyles(styles, { withTheme: true })( +export default withStyles(styles as any, { withTheme: true })( withRouter(connect(mapStateToProps, mapDispatchToProps)(translate("translations")(Layout))) ); diff --git a/src/react/Components/LimitedPremiumListItem.jsx b/src/components/LimitedPremiumListItem.tsx similarity index 97% rename from src/react/Components/LimitedPremiumListItem.jsx rename to src/components/LimitedPremiumListItem.tsx index a476641d..0958a30f 100644 --- a/src/react/Components/LimitedPremiumListItem.jsx +++ b/src/components/LimitedPremiumListItem.tsx @@ -6,7 +6,7 @@ import ListItemText from "@material-ui/core/ListItemText"; import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import LinearProgress from "./LinearProgress"; -import { formatMoney } from "../Functions/Utils"; +import { formatMoney } from "~functions/Utils"; const styles = { iconButton: { diff --git a/src/react/Components/LinearProgress.jsx b/src/components/LinearProgress.tsx similarity index 90% rename from src/react/Components/LinearProgress.jsx rename to src/components/LinearProgress.tsx index 43d2c3e9..03e10561 100644 --- a/src/react/Components/LinearProgress.jsx +++ b/src/components/LinearProgress.tsx @@ -20,7 +20,7 @@ const defaultStyle = { }; const LinearProgress = props => { - const { theme, color = false, height = 8, backgroundColor = false, style = {}, valueStyle = {}, value } = props; + const { theme, color = "primary", height = 8, backgroundColor = false, style = {}, valueStyle = {}, value } = props; let backgroundProgressBarColor = theme.palette.primary.main; if (color && theme.palette[color] && theme.palette[color].main) { @@ -56,8 +56,4 @@ const LinearProgress = props => { ); }; -LinearProgress.defaultProps = { - color: "primary" -}; - export default withTheme()(LinearProgress); diff --git a/src/react/Components/ListItemWrapper.jsx b/src/components/ListItemWrapper.tsx similarity index 100% rename from src/react/Components/ListItemWrapper.jsx rename to src/components/ListItemWrapper.tsx diff --git a/src/react/Components/ListItems/BunqMeTabListItem.jsx b/src/components/ListItems/BunqMeTabListItem.tsx similarity index 99% rename from src/react/Components/ListItems/BunqMeTabListItem.jsx rename to src/components/ListItems/BunqMeTabListItem.tsx index 9d1ce9f0..8fc6a9f0 100644 --- a/src/react/Components/ListItems/BunqMeTabListItem.jsx +++ b/src/components/ListItems/BunqMeTabListItem.tsx @@ -22,7 +22,7 @@ import AccountQRFullscreen from "../QR/AccountQRFullscreen"; import TranslateButton from "../TranslationHelpers/Button"; import CopyToClipboardWrap from "../CopyToClipboardWrap"; -import { humanReadableDate, formatMoney } from "../../Functions/Utils"; +import { humanReadableDate, formatMoney } from "~functions/Utils"; const styles = { actionListItem: { diff --git a/src/react/Components/ListItems/MasterCardActionListItem.jsx b/src/components/ListItems/MasterCardActionListItem.tsx similarity index 92% rename from src/react/Components/ListItems/MasterCardActionListItem.jsx rename to src/components/ListItems/MasterCardActionListItem.tsx index 9fded25d..cc61046c 100644 --- a/src/react/Components/ListItems/MasterCardActionListItem.jsx +++ b/src/components/ListItems/MasterCardActionListItem.tsx @@ -7,14 +7,14 @@ import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import Avatar from "@material-ui/core/Avatar"; import Divider from "@material-ui/core/Divider"; -import NavLink from "../../Components/Routing/NavLink"; +import NavLink from "~components/Routing/NavLink"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; import CategoryIcons from "../Categories/CategoryIcons"; import MoneyAmountLabel from "../MoneyAmountLabel"; -import { masterCardActionParser } from "../../Functions/EventStatusTexts"; -import { formatMoney } from "../../Functions/Utils"; -import { defaultMastercardImage } from "../../Functions/DefaultImageHandlers"; +import { masterCardActionParser } from "~functions/EventStatusTexts"; +import { formatMoney } from "~functions/Utils"; +import { defaultMastercardImage } from "~functions/DefaultImageHandlers"; const styles = { listItemText: { diff --git a/src/react/Components/ListItems/PaymentListItem.jsx b/src/components/ListItems/PaymentListItem.tsx similarity index 96% rename from src/react/Components/ListItems/PaymentListItem.jsx rename to src/components/ListItems/PaymentListItem.tsx index 899981bf..3d0df3c8 100644 --- a/src/react/Components/ListItems/PaymentListItem.jsx +++ b/src/components/ListItems/PaymentListItem.tsx @@ -6,9 +6,9 @@ import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import Avatar from "@material-ui/core/Avatar"; import Divider from "@material-ui/core/Divider"; -import { formatMoney } from "../../Functions/Utils"; -import { paymentText } from "../../Functions/EventStatusTexts"; -import { defaultPaymentImage } from "../../Functions/DefaultImageHandlers"; +import { formatMoney } from "~functions/Utils"; +import { paymentText } from "~functions/EventStatusTexts"; +import { defaultPaymentImage } from "~functions/DefaultImageHandlers"; import NavLink from "../Routing/NavLink"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; diff --git a/src/react/Components/ListItems/RequestInquiryBatchListItem.jsx b/src/components/ListItems/RequestInquiryBatchListItem.tsx similarity index 99% rename from src/react/Components/ListItems/RequestInquiryBatchListItem.jsx rename to src/components/ListItems/RequestInquiryBatchListItem.tsx index 2fdf7f6d..000b7624 100644 --- a/src/react/Components/ListItems/RequestInquiryBatchListItem.jsx +++ b/src/components/ListItems/RequestInquiryBatchListItem.tsx @@ -19,7 +19,7 @@ import Share from "@material-ui/icons/Share"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; import RequestInquiryListItem from "./RequestInquiryListItem"; -import { formatMoney, humanReadableDate } from "../../Functions/Utils"; +import { formatMoney, humanReadableDate } from "~functions/Utils"; const styles = { listItemText: { diff --git a/src/react/Components/ListItems/RequestInquiryListItem.jsx b/src/components/ListItems/RequestInquiryListItem.tsx similarity index 94% rename from src/react/Components/ListItems/RequestInquiryListItem.jsx rename to src/components/ListItems/RequestInquiryListItem.tsx index 9425f94b..8f0960da 100644 --- a/src/react/Components/ListItems/RequestInquiryListItem.jsx +++ b/src/components/ListItems/RequestInquiryListItem.tsx @@ -6,9 +6,9 @@ import { translate } from "react-i18next"; import Avatar from "@material-ui/core/Avatar"; import Divider from "@material-ui/core/Divider"; -import { formatMoney } from "../../Functions/Utils"; -import { requestInquiryText } from "../../Functions/EventStatusTexts"; -import NavLink from "../../Components/Routing/NavLink"; +import { formatMoney } from "~functions/Utils"; +import { requestInquiryText } from "~functions/EventStatusTexts"; +import NavLink from "~components/Routing/NavLink"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; import CategoryIcons from "../Categories/CategoryIcons"; import MoneyAmountLabel from "../MoneyAmountLabel"; diff --git a/src/react/Components/ListItems/RequestResponseListItem.jsx b/src/components/ListItems/RequestResponseListItem.tsx similarity index 92% rename from src/react/Components/ListItems/RequestResponseListItem.jsx rename to src/components/ListItems/RequestResponseListItem.tsx index 46b04d0d..7255fead 100644 --- a/src/react/Components/ListItems/RequestResponseListItem.jsx +++ b/src/components/ListItems/RequestResponseListItem.tsx @@ -6,11 +6,11 @@ import { translate } from "react-i18next"; import Avatar from "@material-ui/core/Avatar"; import Divider from "@material-ui/core/Divider"; -import { formatMoney } from "../../Functions/Utils"; -import { requestResponseText } from "../../Functions/EventStatusTexts"; -import { defaultRequestResponseImage } from "../../Functions/DefaultImageHandlers"; +import { formatMoney } from "~functions/Utils"; +import { requestResponseText } from "~functions/EventStatusTexts"; +import { defaultRequestResponseImage } from "~functions/DefaultImageHandlers"; -import NavLink from "../../Components/Routing/NavLink"; +import NavLink from "~components/Routing/NavLink"; import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; import CategoryIcons from "../Categories/CategoryIcons"; import MoneyAmountLabel from "../MoneyAmountLabel"; diff --git a/src/react/Components/ListItems/ShareInviteBankTypes/DraftAccess.jsx b/src/components/ListItems/ShareInviteBankTypes/DraftAccess.tsx similarity index 100% rename from src/react/Components/ListItems/ShareInviteBankTypes/DraftAccess.jsx rename to src/components/ListItems/ShareInviteBankTypes/DraftAccess.tsx diff --git a/src/react/Components/ListItems/ShareInviteBankTypes/FullAccess.jsx b/src/components/ListItems/ShareInviteBankTypes/FullAccess.tsx similarity index 100% rename from src/react/Components/ListItems/ShareInviteBankTypes/FullAccess.jsx rename to src/components/ListItems/ShareInviteBankTypes/FullAccess.tsx diff --git a/src/react/Components/ListItems/ShareInviteBankTypes/ShowOnly.jsx b/src/components/ListItems/ShareInviteBankTypes/ShowOnly.tsx similarity index 100% rename from src/react/Components/ListItems/ShareInviteBankTypes/ShowOnly.jsx rename to src/components/ListItems/ShareInviteBankTypes/ShowOnly.tsx diff --git a/src/react/Components/ListItems/ShareInviteMonetaryAccountInquiryListItem.jsx b/src/components/ListItems/ShareInviteMonetaryAccountInquiryListItem.tsx similarity index 96% rename from src/react/Components/ListItems/ShareInviteMonetaryAccountInquiryListItem.jsx rename to src/components/ListItems/ShareInviteMonetaryAccountInquiryListItem.tsx index 2f3171f7..a11f7eb6 100644 --- a/src/react/Components/ListItems/ShareInviteMonetaryAccountInquiryListItem.jsx +++ b/src/components/ListItems/ShareInviteMonetaryAccountInquiryListItem.tsx @@ -14,7 +14,7 @@ import TranslateButton from "../TranslationHelpers/Button"; import ShowOnly from "./ShareInviteBankTypes/ShowOnly"; import FullAccess from "./ShareInviteBankTypes/FullAccess"; import DraftAccess from "./ShareInviteBankTypes/DraftAccess"; -import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "../../Actions/share_invite_monetary_account_inquiries"; +import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "~actions/share_invite_monetary_account_inquiries"; const styles = { listItemText: { @@ -87,7 +87,7 @@ class ShareInviteMonetaryAccountInquiryListItem extends React.Component { const displayName = aliasInfo.display_name; const connectActions = ( - + <> Cancel - + ); const shareDetailTypes = Object.keys(shareInviteMonetaryAccountInquiry.share_detail); diff --git a/src/react/Components/ListItems/ShareInviteMonetaryAccountResponseListItem.jsx b/src/components/ListItems/ShareInviteMonetaryAccountResponseListItem.tsx similarity index 97% rename from src/react/Components/ListItems/ShareInviteMonetaryAccountResponseListItem.jsx rename to src/components/ListItems/ShareInviteMonetaryAccountResponseListItem.tsx index 5f8d9776..8b0c1b36 100644 --- a/src/react/Components/ListItems/ShareInviteMonetaryAccountResponseListItem.jsx +++ b/src/components/ListItems/ShareInviteMonetaryAccountResponseListItem.tsx @@ -14,7 +14,7 @@ import TranslateButton from "../TranslationHelpers/Button"; import ShowOnly from "./ShareInviteBankTypes/ShowOnly"; import FullAccess from "./ShareInviteBankTypes/FullAccess"; import DraftAccess from "./ShareInviteBankTypes/DraftAccess"; -import { shareInviteMonetaryAccountResponsesInfoUpdate } from "../../Actions/share_invite_monetary_account_responses"; +import { shareInviteMonetaryAccountResponsesInfoUpdate } from "~actions/share_invite_monetary_account_responses"; const styles = { listItemText: { @@ -102,7 +102,7 @@ class ShareInviteMonetaryAccountResponseListItem extends React.Component { const displayName = aliasInfo.display_name; const connectActions = ( - + <> Reject - + ); const shareDetailTypes = Object.keys(shareInviteMonetaryAccountResponse.share_detail); diff --git a/src/react/Components/MainDialog.jsx b/src/components/MainDialog.tsx similarity index 97% rename from src/react/Components/MainDialog.jsx rename to src/components/MainDialog.tsx index 7ae945f1..c8efa25a 100644 --- a/src/react/Components/MainDialog.jsx +++ b/src/components/MainDialog.tsx @@ -12,7 +12,7 @@ import TranslateButton from "./TranslationHelpers/Button"; const Transition = props => ; // redux actions -import { closeModal } from "../Actions/modal"; +import { closeModal } from "~actions/modal"; class MainDialog extends React.Component { constructor(props, context) { diff --git a/src/react/Components/MainSnackbar.jsx b/src/components/MainSnackbar.tsx similarity index 86% rename from src/react/Components/MainSnackbar.jsx rename to src/components/MainSnackbar.tsx index ddd7202b..bcf03dee 100644 --- a/src/react/Components/MainSnackbar.jsx +++ b/src/components/MainSnackbar.tsx @@ -2,18 +2,21 @@ import React from "react"; import { connect } from "react-redux"; import Snackbar from "@material-ui/core/Snackbar"; import Slide from "@material-ui/core/Slide"; + const Transition = props => ; // redux actions -import { closeSnackbar } from "../Actions/snackbar.js"; +import { actions as snackbarActions } from "~store/snackbar"; -const styles = { +const styles: any = { snackbar: { marginTop: 50 } }; -class MainSnackbar extends React.PureComponent { +class MainSnackbar extends React.PureComponent { + state: any; + constructor(props, context) { super(props, context); this.state = {}; @@ -50,7 +53,7 @@ const mapStateToProps = store => { const mapDispatchToProps = dispatch => { return { - closeSnackbar: () => dispatch(closeSnackbar()) + closeSnackbar: () => dispatch(snackbarActions.close()) }; }; diff --git a/src/react/Components/MoneyAmountLabel.jsx b/src/components/MoneyAmountLabel.tsx similarity index 100% rename from src/react/Components/MoneyAmountLabel.jsx rename to src/components/MoneyAmountLabel.tsx diff --git a/src/react/Components/NetworkStatusChecker.jsx b/src/components/NetworkStatusChecker.tsx similarity index 89% rename from src/react/Components/NetworkStatusChecker.jsx rename to src/components/NetworkStatusChecker.tsx index c080e1ea..7c75822e 100644 --- a/src/react/Components/NetworkStatusChecker.jsx +++ b/src/components/NetworkStatusChecker.tsx @@ -8,17 +8,19 @@ import Slide from "@material-ui/core/Slide"; import RefreshIcon from "@material-ui/icons/Refresh"; -import { applicationSetOffline, applicationSetOnline } from "../Actions/application"; +import { actions as applicationActions } from "~store/application"; const Transition = props => ; -const styles = { +const styles: any = { snackbar: { marginTop: 50 } }; -class NetworkStatusChecker extends React.PureComponent { +class NetworkStatusChecker extends React.PureComponent { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -96,8 +98,8 @@ const mapStateToProps = store => { const mapDispatchToProps = dispatch => { return { - applicationSetOnline: () => dispatch(applicationSetOnline()), - applicationSetOffline: () => dispatch(applicationSetOffline()) + applicationSetOnline: () => dispatch(applicationActions.setOnline()), + applicationSetOffline: () => dispatch(applicationActions.setOffline()) }; }; diff --git a/src/react/Components/NoteTexts/NoteTextForm.jsx b/src/components/NoteTexts/NoteTextForm.tsx similarity index 98% rename from src/react/Components/NoteTexts/NoteTextForm.jsx rename to src/components/NoteTexts/NoteTextForm.tsx index cfd7c0f3..7db01d4e 100644 --- a/src/react/Components/NoteTexts/NoteTextForm.jsx +++ b/src/components/NoteTexts/NoteTextForm.tsx @@ -15,8 +15,8 @@ import { notesTextsAddNote, // notesTextsUpdateNote, notesTextsDeleteNote -} from "../../Actions/note_texts"; -import NoteTextTypeParser from "../../Functions/NoteTextTypeParser"; +} from "~actions/note_texts"; +import NoteTextTypeParser from "~functions/NoteTextTypeParser"; const styles = { paper: { diff --git a/src/react/Components/NoteTexts/NoteTextItem.jsx b/src/components/NoteTexts/NoteTextItem.tsx similarity index 95% rename from src/react/Components/NoteTexts/NoteTextItem.jsx rename to src/components/NoteTexts/NoteTextItem.tsx index 501d94ca..5267e55c 100644 --- a/src/react/Components/NoteTexts/NoteTextItem.jsx +++ b/src/components/NoteTexts/NoteTextItem.tsx @@ -6,8 +6,8 @@ import IconButton from "@material-ui/core/IconButton"; import DeleteIcon from "@material-ui/icons/Delete"; // import EditIcon from "@material-ui/icons/Edit"; -import { humanReadableDate } from "../../Functions/Utils"; -import NoteTextTypeParser from "../../Functions/NoteTextTypeParser"; +import { humanReadableDate } from "~functions/Utils"; +import NoteTextTypeParser from "~functions/NoteTextTypeParser"; const styles = {}; diff --git a/src/react/Components/PDFExportHelper/Base64BunqLogo.js b/src/components/PDFExportHelper/Base64BunqLogo.ts similarity index 100% rename from src/react/Components/PDFExportHelper/Base64BunqLogo.js rename to src/components/PDFExportHelper/Base64BunqLogo.ts diff --git a/src/react/Components/PDFExportHelper/PDFExportHelper.jsx b/src/components/PDFExportHelper/PDFExportHelper.tsx similarity index 87% rename from src/react/Components/PDFExportHelper/PDFExportHelper.jsx rename to src/components/PDFExportHelper/PDFExportHelper.tsx index 95373a3e..e7345bc4 100644 --- a/src/react/Components/PDFExportHelper/PDFExportHelper.jsx +++ b/src/components/PDFExportHelper/PDFExportHelper.tsx @@ -7,11 +7,11 @@ import ListItemText from "@material-ui/core/ListItemText"; import Divider from "@material-ui/core/Divider"; import bunqTransparantLogo from "./Base64BunqLogo"; -import { formatIban } from "../../Functions/Utils"; +import { formatIban } from "~functions/Utils"; -import { applicationSetPDFMode } from "../../Actions/application"; -import { openSnackbar } from "../../Actions/snackbar"; -import { setTheme } from "../../Actions/options"; +import { actions as applicationActions } from "~store/application"; +import { actions as snackbarActions } from "~store/snackbar"; +import { setTheme } from "~actions/options"; const styles = { bunqLogo: { @@ -23,7 +23,9 @@ const styles = { } }; -class PDFExportHelper extends React.PureComponent { +class PDFExportHelper extends React.PureComponent { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -87,7 +89,7 @@ class PDFExportHelper extends React.PureComponent { {personalAlias && ( - + <> @@ -100,7 +102,7 @@ class PDFExportHelper extends React.PureComponent { /> - + )} @@ -122,13 +124,13 @@ class PDFExportHelper extends React.PureComponent { {paymentDateUpdated && paymentDate !== paymentDateUpdated && ( - + <> - + )} @@ -136,7 +138,7 @@ class PDFExportHelper extends React.PureComponent { {counterPartyIban && ( - + <> @@ -145,31 +147,31 @@ class PDFExportHelper extends React.PureComponent { secondary={formatIban(counterPartyIban)} /> - + )} {payment.merchant_reference && ( - + <> - + )} {payment.mandate_identifier && ( - + <> - + )} {payment.credit_scheme_identifier && ( - + <> @@ -178,7 +180,7 @@ class PDFExportHelper extends React.PureComponent { secondary={payment.credit_scheme_identifier} /> - + )} @@ -197,9 +199,9 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, ownProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: message => dispatch(openSnackbar(message)), + openSnackbar: message => dispatch(snackbarActions.open({ message })), - applicationSetPDFMode: enabled => dispatch(applicationSetPDFMode(enabled)), + applicationSetPDFMode: enabled => dispatch(applicationActions.setPdfMode(enabled)), setTheme: theme => dispatch(setTheme(theme)) }; diff --git a/src/react/Components/QR/AccountQRCode.jsx b/src/components/QR/AccountQRCode.tsx similarity index 100% rename from src/react/Components/QR/AccountQRCode.jsx rename to src/components/QR/AccountQRCode.tsx diff --git a/src/react/Components/QR/AccountQRFullscreen.jsx b/src/components/QR/AccountQRFullscreen.tsx similarity index 93% rename from src/react/Components/QR/AccountQRFullscreen.jsx rename to src/components/QR/AccountQRFullscreen.tsx index 22ece6ac..e5bce148 100644 --- a/src/react/Components/QR/AccountQRFullscreen.jsx +++ b/src/components/QR/AccountQRFullscreen.tsx @@ -15,7 +15,7 @@ import LazyAttachmentImage from "../AttachmentImage/LazyAttachmentImage"; import QRSvg from "./QRSvg"; import QRCode from "./QRCode"; -import { formatIban } from "../../Functions/Utils"; +import { formatIban } from "~functions/Utils"; const styles = theme => ({ btnIcon: { @@ -83,7 +83,7 @@ class AccountQRFullscreen extends React.PureComponent { }); dialogContent = ( - + <> @@ -95,30 +95,30 @@ class AccountQRFullscreen extends React.PureComponent { - + ); break; case "TEXT": dialogContent = ( - + <> - + ); break; case "HIDDEN": dialogContent = ( - + <> - + ); break; } return ( - + <> @@ -134,7 +134,7 @@ class AccountQRFullscreen extends React.PureComponent {
{dialogContent}
-
+ ); } } diff --git a/src/react/Components/QR/QRCode.jsx b/src/components/QR/QRCode.tsx similarity index 100% rename from src/react/Components/QR/QRCode.jsx rename to src/components/QR/QRCode.tsx diff --git a/src/react/Components/QR/QRSvg.jsx b/src/components/QR/QRSvg.tsx similarity index 100% rename from src/react/Components/QR/QRSvg.jsx rename to src/components/QR/QRSvg.tsx diff --git a/src/react/Components/Queue/QueueHeaderIcon.jsx b/src/components/Queue/QueueHeaderIcon.tsx similarity index 91% rename from src/react/Components/Queue/QueueHeaderIcon.jsx rename to src/components/Queue/QueueHeaderIcon.tsx index 20f715e5..ee7ca8ea 100644 --- a/src/react/Components/Queue/QueueHeaderIcon.jsx +++ b/src/components/Queue/QueueHeaderIcon.tsx @@ -6,11 +6,14 @@ import IconButton from "@material-ui/core/IconButton"; import SyncIcon from "@material-ui/icons/Sync"; -import { queueStartSync } from "../../Actions/queue"; +import { queueStartSync } from "~actions/queue"; const styles = {}; -class QueueHeaderIcon extends React.Component { +class QueueHeaderIcon extends React.Component { + state: any; + updateDelay: null | number; + constructor(props, context) { super(props, context); this.state = { @@ -24,7 +27,7 @@ class QueueHeaderIcon extends React.Component { // throttle updates by 250ms to gather up rapid redux events if (nextProps.queueRequestCounter !== this.state.queueRequestCounter) { if (this.updateDelay) clearTimeout(this.updateDelay); - this.updateDelay = setTimeout(this.setQueueRequestCounter, 250); + this.updateDelay = +setTimeout(this.setQueueRequestCounter, 250); } if (nextProps.user !== this.props.user) return true; diff --git a/src/react/Components/Queue/QueueManager.jsx b/src/components/Queue/QueueManager.tsx similarity index 93% rename from src/react/Components/Queue/QueueManager.jsx rename to src/components/Queue/QueueManager.tsx index 63b81929..a574bd9b 100644 --- a/src/react/Components/Queue/QueueManager.jsx +++ b/src/components/Queue/QueueManager.tsx @@ -2,16 +2,16 @@ import React from "react"; import { ipcRenderer } from "electron"; import { translate } from "react-i18next"; import { connect } from "react-redux"; -import Payment from "../../Models/Payment"; -import BunqMeTab from "../../Models/BunqMeTab"; -import RequestResponse from "../../Models/RequestResponse"; -import RequestInquiry from "../../Models/RequestInquiry"; -import RequestInquiryBatch from "../../Models/RequestInquiryBatch"; -import MasterCardAction from "../../Models/MasterCardAction"; -import NotificationHelper from "../../Functions/NotificationHelper"; -import { connectGetPermissions } from "../../Functions/ConnectGetPermissions"; -import { paymentApiFilter } from "../../Functions/DataFilters"; +import Payment from "~models/Payment"; +import BunqMeTab from "~models/BunqMeTab"; +import RequestResponse from "~models/RequestResponse"; +import RequestInquiry from "~models/RequestInquiry"; +import RequestInquiryBatch from "~models/RequestInquiryBatch"; +import MasterCardAction from "~models/MasterCardAction"; +import NotificationHelper from "~functions/NotificationHelper"; +import { connectGetPermissions } from "~functions/ConnectGetPermissions"; +import { paymentApiFilter } from "~functions/DataFilters"; import { queueDecreaseRequestCounter, @@ -20,21 +20,34 @@ import { queueFinishedSync, queueResetSyncState, queueStartSync -} from "../../Actions/queue"; -import { paymentsSetInfo } from "../../Actions/payments"; -import { bunqMeTabsSetInfo } from "../../Actions/bunq_me_tabs"; -import { masterCardActionsSetInfo } from "../../Actions/master_card_actions"; -import { requestInquiriesSetInfo } from "../../Actions/request_inquiries"; -import { requestInquiryBatchesSetInfo } from "../../Actions/request_inquiry_batches"; -import { requestResponsesSetInfo } from "../../Actions/request_responses"; -import { shareInviteBankInquiriesSetInfo } from "../../Actions/share_invite_monetary_account_inquiries"; -import { shareInviteMonetaryAccountResponsesSetInfo } from "../../Actions/share_invite_monetary_account_responses"; -import { openSnackbar } from "../../Actions/snackbar"; +} from "~actions/queue"; +import { paymentsSetInfo } from "~actions/payments"; +import { masterCardActionsSetInfo } from "~actions/master_card_actions"; +import { requestInquiriesSetInfo } from "~actions/request_inquiries"; +import { requestInquiryBatchesSetInfo } from "~actions/request_inquiry_batches"; +import { requestResponsesSetInfo } from "~actions/request_responses"; +import { shareInviteBankInquiriesSetInfo } from "~actions/share_invite_monetary_account_inquiries"; +import { shareInviteMonetaryAccountResponsesSetInfo } from "~actions/share_invite_monetary_account_responses"; +import { actions as bunqMeTabsActions } from "~store/bunqMeTabs"; +import { AppDispatch, ReduxState } from "~store/index"; +import { actions as snackbarActions } from "~store/snackbar"; export const DEFAULT_EVENT_COUNT_LIMIT = 50; export const EVENT_TOTAL_LIMIT = 1000; -class QueueManager extends React.Component { +interface IProps { +} + +interface IState { +} + +class QueueManager extends React.Component & ReturnType & IProps> { + state: IState; + delayedQueue: null | number; + delayedSetState: null | number; + automaticUpdateTimer: null | number; + automaticUpdateTimerDuration: null | number; + constructor(props, context) { super(props, context); this.state = { @@ -90,14 +103,14 @@ class QueueManager extends React.Component { // clear existing timeout if it exists if (this.delayedQueue) clearTimeout(this.delayedQueue); // delay the queue update - this.delayedQueue = setTimeout(() => this.triggerQueueUpdate(eventCount), 100); + this.delayedQueue = +setTimeout(() => this.triggerQueueUpdate(eventCount), 100); } } else { if (!queueLoading && prevProps.queueLoading === true && queueRequestCounter === 0) { // clear existing timeout if it exists if (this.delayedSetState) clearTimeout(this.delayedSetState); // delay the queue update - this.delayedSetState = setTimeout(this.pushQueueData, 100); + this.delayedSetState = +setTimeout(this.pushQueueData, 100); } } } @@ -355,7 +368,7 @@ class QueueManager extends React.Component { // only set if not already set if (!this.automaticUpdateTimer) { - this.automaticUpdateTimer = setInterval(() => { + this.automaticUpdateTimer = +setInterval(() => { this.props.queueStartSync(); }, this.props.automaticUpdateDuration * 1000); @@ -710,7 +723,7 @@ class QueueManager extends React.Component { }); }; - shareInviteBankInquiriesUpdate = (user_id, account_id, olderId = false, eventCount = 200) => { + shareInviteBankInquiriesUpdate = (user_id, account_id, olderId: boolean | number = false, eventCount = 200) => { const { BunqJSClient } = this.props; if (olderId !== false) this.props.queueIncreaseRequestCounter(); @@ -789,7 +802,7 @@ class QueueManager extends React.Component { } } -const mapStateToProps = state => { +const mapStateToProps = (state: ReduxState) => { return { user: state.user.user, userLoading: state.user.loading, @@ -810,21 +823,21 @@ const mapStateToProps = state => { queueLoading: state.queue.loading, payments: state.payments.payments, - bunqMeTabs: state.bunq_me_tabs.bunq_me_tabs, + bunqMeTabs: state.bunqMeTabs.bunq_me_tabs, masterCardActions: state.master_card_actions.master_card_actions, requestInquiries: state.request_inquiries.request_inquiries, requestInquiryBatches: state.request_inquiry_batches.request_inquiry_batches, requestResponses: state.request_responses.request_responses, shareInviteBankInquiries: state.share_invite_monetary_account_inquiries.share_invite_monetary_account_inquiries, shareInviteMonetaryAccountResponses: - state.share_invite_monetary_account_responses.share_invite_monetary_account_responses + state.share_invite_monetary_account_responses.share_invite_monetary_account_responses }; }; -const mapDispatchToProps = (dispatch, ownProps) => { +const mapDispatchToProps = (dispatch: AppDispatch, ownProps: IProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: (message, duration = 4000) => dispatch(openSnackbar(message, duration)), + openSnackbar: (message, duration = 4000) => dispatch(snackbarActions.open({ message, duration })), queueDecreaseRequestCounter: () => dispatch(queueDecreaseRequestCounter()), queueIncreaseRequestCounter: () => dispatch(queueIncreaseRequestCounter()), @@ -835,7 +848,12 @@ const mapDispatchToProps = (dispatch, ownProps) => { paymentsSetInfo: (payments, accountId) => dispatch(paymentsSetInfo(payments, accountId, false, BunqJSClient)), bunqMeTabsSetInfo: (bunqMeTabs, accountId) => - dispatch(bunqMeTabsSetInfo(bunqMeTabs, accountId, false, BunqJSClient)), + dispatch(bunqMeTabsActions.setInfo({ + bunqMeTabs, + account_id: accountId, + resetOldItems: false, + BunqJSClient + })), masterCardActionsSetInfo: (masterCardActions, accountId) => dispatch(masterCardActionsSetInfo(masterCardActions, accountId, false, BunqJSClient)), requestInquiriesSetInfo: (requestInquiries, accountId) => diff --git a/src/react/Components/Queue/QueueSidebarListItem.jsx b/src/components/Queue/QueueSidebarListItem.tsx similarity index 92% rename from src/react/Components/Queue/QueueSidebarListItem.jsx rename to src/components/Queue/QueueSidebarListItem.tsx index 977d9fce..f0e80c24 100644 --- a/src/react/Components/Queue/QueueSidebarListItem.jsx +++ b/src/components/Queue/QueueSidebarListItem.tsx @@ -7,7 +7,7 @@ import LinearProgress from "@material-ui/core/LinearProgress"; import SyncIcon from "@material-ui/icons/Sync"; -import { queueStartSync } from "../../Actions/queue"; +import { queueStartSync } from "~actions/queue"; const styles = { listItemText: { @@ -15,7 +15,10 @@ const styles = { } }; -class QueueSidebarListItem extends React.Component { +class QueueSidebarListItem extends React.Component { + state: any; + updateDelay: null | number; + constructor(props, context) { super(props, context); this.state = { @@ -33,7 +36,7 @@ class QueueSidebarListItem extends React.Component { nextProps.queueMaxRequestCounter !== this.state.queueMaxRequestCounter ) { if (this.updateDelay) clearTimeout(this.updateDelay); - this.updateDelay = setTimeout(this.setQueueRequestCounter, 250); + this.updateDelay = +setTimeout(this.setQueueRequestCounter, 250); } if (nextProps.queueLoading !== this.props.queueLoading) return true; @@ -71,7 +74,7 @@ class QueueSidebarListItem extends React.Component { } const clickDisabled = queueLoading || queueTriggerSync; - const listItemProps = { + const listItemProps: any = { key: "listItem" }; @@ -81,7 +84,7 @@ class QueueSidebarListItem extends React.Component { } return ( - + <> @@ -94,7 +97,7 @@ class QueueSidebarListItem extends React.Component { /> {queueLoading && } - + ); } } diff --git a/src/react/Components/ReactJsonWrapper.jsx b/src/components/ReactJsonWrapper.tsx similarity index 100% rename from src/react/Components/ReactJsonWrapper.jsx rename to src/components/ReactJsonWrapper.tsx diff --git a/src/react/Components/ReduxForm/Fields/renderAccountsPicker.jsx b/src/components/ReduxForm/Fields/renderAccountsPicker.tsx similarity index 100% rename from src/react/Components/ReduxForm/Fields/renderAccountsPicker.jsx rename to src/components/ReduxForm/Fields/renderAccountsPicker.tsx diff --git a/src/react/Components/ReduxForm/Fields/renderAmountField.jsx b/src/components/ReduxForm/Fields/renderAmountField.tsx similarity index 100% rename from src/react/Components/ReduxForm/Fields/renderAmountField.jsx rename to src/components/ReduxForm/Fields/renderAmountField.tsx diff --git a/src/react/Components/ReduxForm/Fields/renderColorPickerGradient.jsx b/src/components/ReduxForm/Fields/renderColorPickerGradient.tsx similarity index 100% rename from src/react/Components/ReduxForm/Fields/renderColorPickerGradient.jsx rename to src/components/ReduxForm/Fields/renderColorPickerGradient.tsx diff --git a/src/react/Components/ReduxForm/Fields/renderDateTimePicker.jsx b/src/components/ReduxForm/Fields/renderDateTimePicker.tsx similarity index 92% rename from src/react/Components/ReduxForm/Fields/renderDateTimePicker.jsx rename to src/components/ReduxForm/Fields/renderDateTimePicker.tsx index 6339480b..97ed9171 100644 --- a/src/react/Components/ReduxForm/Fields/renderDateTimePicker.jsx +++ b/src/components/ReduxForm/Fields/renderDateTimePicker.tsx @@ -3,7 +3,7 @@ import { translate } from "react-i18next"; import DateTimePicker from "material-ui-pickers/DateTimePicker"; import Typography from "@material-ui/core/Typography"; -import { getUTCDate, UTCDateToLocalDate } from "../../../Functions/Utils"; +import { getUTCDate, UTCDateToLocalDate } from "~functions/Utils"; const styles = { dateTimePicker: {} @@ -35,7 +35,7 @@ const renderDateTimePicker = ({ t, i18n, tReady, input, label, meta: { touched, }; return ( - + <> {errorLabel} - + ); }; diff --git a/src/react/Components/ReduxForm/Fields/renderTextField.jsx b/src/components/ReduxForm/Fields/renderTextField.tsx similarity index 100% rename from src/react/Components/ReduxForm/Fields/renderTextField.jsx rename to src/components/ReduxForm/Fields/renderTextField.tsx diff --git a/src/react/Components/ReduxForm/Validators.js b/src/components/ReduxForm/Validators.ts similarity index 96% rename from src/react/Components/ReduxForm/Validators.js rename to src/components/ReduxForm/Validators.ts index 9fcc5222..b030b07a 100644 --- a/src/react/Components/ReduxForm/Validators.js +++ b/src/components/ReduxForm/Validators.ts @@ -1,5 +1,5 @@ import EmailValidator from "email-validator"; -import { isValidPhonenumber } from "../../Functions/PhoneLib"; +import { isValidPhonenumber } from "~functions/PhoneLib"; const t = window.t; diff --git a/src/react/Routes.jsx b/src/components/Routes.tsx similarity index 80% rename from src/react/Routes.jsx rename to src/components/Routes.tsx index d8c7b17f..5ee1966a 100644 --- a/src/react/Routes.jsx +++ b/src/components/Routes.tsx @@ -1,14 +1,14 @@ import React from "react"; import { Route, Switch } from "react-router-dom"; -import PrivateRoute from "./Components/Routing/PrivateRoute"; -import PublicRoute from "./Components/Routing/PublicRoute"; -import CL from "./Components/CodeSplitting/ComponentLoader"; +import PrivateRoute from "~components/Routing/PrivateRoute"; +import PublicRoute from "~components/Routing/PublicRoute"; +import CL from "~components/CodeSplitting/ComponentLoader"; -import Dashboard from "./Pages/Dashboard/Dashboard"; -import NotFound from "./Pages/NotFound"; -import LoginPassword from "./Pages/LoginPassword"; -import Login from "./Pages/Login/Login"; +import Dashboard from "~pages/Dashboard/Dashboard"; +import NotFound from "~pages/NotFound"; +import LoginPassword from "~pages/LoginPassword"; +import Login from "~pages/Login/Login"; const privateRoutes = [ /** @@ -21,28 +21,28 @@ const privateRoutes = [ }, { path: "/pay", - component: CL(() => import(/* webpackChunkName: "pay" */ "./Pages/Pay/Pay")) + component: CL(() => import(/* webpackChunkName: "pay" */ "~pages/Pay/Pay")) }, { path: "/request", - component: CL(() => import(/* webpackChunkName: "requestinquiry" */ "./Pages/RequestInquiry/RequestInquiry")) + component: CL(() => import(/* webpackChunkName: "requestinquiry" */ "~pages/RequestInquiry/RequestInquiry")) }, { path: "/bunqme-tab", - component: CL(() => import(/* webpackChunkName: "bunqmetab" */ "./Pages/BunqMeTab/BunqMeTab")) + component: CL(() => import(/* webpackChunkName: "bunqmetab" */ "~pages/BunqMeTab/BunqMeTab")) }, { path: "/bunqme-personal", - component: CL(() => import(/* webpackChunkName: "bunqmepersonal" */ "./Pages/BunqMePersonal/BunqMePersonal")) + component: CL(() => import(/* webpackChunkName: "bunqmepersonal" */ "~pages/BunqMePersonal/BunqMePersonal")) }, { path: "/cards", - component: CL(() => import(/* webpackChunkName: "cards" */ "./Pages/Cards/Cards")) + component: CL(() => import(/* webpackChunkName: "cards" */ "~pages/Cards/Cards")) }, { path: "/scheduled-payments", component: CL(() => - import(/* webpackChunkName: "scheduled_payments" */ "./Pages/ScheduledPayments/ScheduledPayments") + import(/* webpackChunkName: "scheduled_payments" */ "~pages/ScheduledPayments/ScheduledPayments") ) }, /** @@ -50,42 +50,42 @@ const privateRoutes = [ */ { path: "/exports", - component: CL(() => import(/* webpackChunkName: "exports" */ "./Pages/Exports")) + component: CL(() => import(/* webpackChunkName: "exports" */ "~pages/Exports")) }, { path: "/pending-payments", - component: CL(() => import(/* webpackChunkName: "pendingPayments" */ "./Pages/PendingPayments/PendingPayments")) + component: CL(() => import(/* webpackChunkName: "pendingPayments" */ "~pages/PendingPayments/PendingPayments")) }, { path: "/stats", - component: CL(() => import(/* webpackChunkName: "stats" */ "./Pages/Stats/Stats")) + component: CL(() => import(/* webpackChunkName: "stats" */ "~pages/Stats/Stats")) }, { path: "/contacts", - component: CL(() => import(/* webpackChunkName: "contacts" */ "./Pages/Contacts/Contacts")) + component: CL(() => import(/* webpackChunkName: "contacts" */ "~pages/Contacts/Contacts")) }, { path: "/category-dashboard", component: CL(() => - import(/* webpackChunkName: "category_dashboard" */ "./Pages/CategoryDashboard/CategoryDashboard") + import(/* webpackChunkName: "category_dashboard" */ "~pages/CategoryDashboard/CategoryDashboard") ) }, { path: "/rules-dashboard", - component: CL(() => import(/* webpackChunkName: "rules_dashboard" */ "./Pages/RuleDashboard/RuleDashboard")) + component: CL(() => import(/* webpackChunkName: "rules_dashboard" */ "~pages/RuleDashboard/RuleDashboard")) }, { path: "/rule-page/:ruleId", - component: CL(() => import(/* webpackChunkName: "rules_page" */ "./Pages/RulePage/RulePage")) + component: CL(() => import(/* webpackChunkName: "rules_page" */ "~pages/RulePage/RulePage")) }, { path: "/savings-goals", - component: CL(() => import(/* webpackChunkName: "savings_goals" */ "./Pages/SavingsGoals/SavingsGoals")) + component: CL(() => import(/* webpackChunkName: "savings_goals" */ "~pages/SavingsGoals/SavingsGoals")) }, { path: "/savings-goal-page/:savingsGoalId", component: CL(() => - import(/* webpackChunkName: "savings_goal_page" */ "./Pages/SavingsGoalPage/SavingsGoalPage") + import(/* webpackChunkName: "savings_goal_page" */ "~pages/SavingsGoalPage/SavingsGoalPage") ) }, /** @@ -93,40 +93,40 @@ const privateRoutes = [ */ { path: "/payment/:paymentId/:accountId?", - component: CL(() => import(/* webpackChunkName: "paymentinfo" */ "./Pages/PaymentInfo")) + component: CL(() => import(/* webpackChunkName: "paymentinfo" */ "~pages/PaymentInfo")) }, { path: "/request-response-info/:requestResponseId/:accountId?", component: CL(() => - import(/* webpackChunkName: "requestresponseinfo" */ "./Pages/RequestResponseInfo/RequestResponseInfo") + import(/* webpackChunkName: "requestresponseinfo" */ "~pages/RequestResponseInfo/RequestResponseInfo") ) }, { path: "/request-inquiry-info/:requestInquiryId/:accountId?", - component: CL(() => import(/* webpackChunkName: "requestinquiryinfo" */ "./Pages/RequestInquiryInfo")) + component: CL(() => import(/* webpackChunkName: "requestinquiryinfo" */ "~pages/RequestInquiryInfo")) }, { path: "/mastercard-action-info/:masterCardActionId/:accountId?", - component: CL(() => import(/* webpackChunkName: "mastercardactioninfo" */ "./Pages/MasterCardActionInfo")) + component: CL(() => import(/* webpackChunkName: "mastercardactioninfo" */ "~pages/MasterCardActionInfo")) }, /** * Monetary account info and settings pages */ { path: "/account-info/:accountId", - component: CL(() => import(/* webpackChunkName: "accountinfo" */ "./Pages/AccountInfo")) + component: CL(() => import(/* webpackChunkName: "accountinfo" */ "~pages/AccountInfo")) }, { path: "/new-account", - component: CL(() => import(/* webpackChunkName: "addaccount" */ "./Pages/AddAccount")) + component: CL(() => import(/* webpackChunkName: "addaccount" */ "~pages/AddAccount")) }, { path: "/connect/:accountId", - component: CL(() => import(/* webpackChunkName: "connect" */ "./Pages/Connect/Connect")) + component: CL(() => import(/* webpackChunkName: "connect" */ "~pages/Connect/Connect")) }, { path: "/profile", - component: CL(() => import(/* webpackChunkName: "profile" */ "./Pages/Profile/Profile")) + component: CL(() => import(/* webpackChunkName: "profile" */ "~pages/Profile/Profile")) } ]; @@ -134,19 +134,19 @@ const privateRoutes = [ const standardRoutes = [ { path: "/settings", - component: CL(() => import(/* webpackChunkName: "settings" */ "./Pages/Settings/Settings")) + component: CL(() => import(/* webpackChunkName: "settings" */ "~pages/Settings/Settings")) }, { path: "/application-info", - component: CL(() => import(/* webpackChunkName: "applicationinfo" */ "./Pages/ApplicationInfo")) + component: CL(() => import(/* webpackChunkName: "applicationinfo" */ "~pages/ApplicationInfo")) }, { path: "/debug-page", - component: CL(() => import(/* webpackChunkName: "debug" */ "./Pages/DebugPage")) + component: CL(() => import(/* webpackChunkName: "debug" */ "~pages/DebugPage")) }, { path: "/disclaimer", - component: CL(() => import(/* webpackChunkName: "disclaimer" */ "./Pages/Disclaimer")) + component: CL(() => import(/* webpackChunkName: "disclaimer" */ "~pages/Disclaimer")) }, { path: "/login", @@ -154,7 +154,7 @@ const standardRoutes = [ }, { path: "/switch-api-keys", - component: CL(() => import(/* webpackChunkName: "switch_api_keys" */ "./Pages/SwitchApiKeys")) + component: CL(() => import(/* webpackChunkName: "switch_api_keys" */ "~pages/SwitchApiKeys")) } ]; diff --git a/src/react/Components/Routing/NavLink.jsx b/src/components/Routing/NavLink.tsx similarity index 91% rename from src/react/Components/Routing/NavLink.jsx rename to src/components/Routing/NavLink.tsx index 07330642..52db9825 100644 --- a/src/react/Components/Routing/NavLink.jsx +++ b/src/components/Routing/NavLink.tsx @@ -1,4 +1,3 @@ -// modules/NavLink.js import React from "react"; import { NavLink } from "react-router-dom"; diff --git a/src/react/Components/Routing/PrivateRoute.jsx b/src/components/Routing/PrivateRoute.tsx similarity index 100% rename from src/react/Components/Routing/PrivateRoute.jsx rename to src/components/Routing/PrivateRoute.tsx diff --git a/src/react/Components/Routing/PublicRoute.jsx b/src/components/Routing/PublicRoute.tsx similarity index 100% rename from src/react/Components/Routing/PublicRoute.jsx rename to src/components/Routing/PublicRoute.tsx diff --git a/src/react/Components/RuleCollectionChecker.jsx b/src/components/RuleCollectionChecker.tsx similarity index 78% rename from src/react/Components/RuleCollectionChecker.jsx rename to src/components/RuleCollectionChecker.tsx index 8133e7f2..21dd6721 100644 --- a/src/react/Components/RuleCollectionChecker.jsx +++ b/src/components/RuleCollectionChecker.tsx @@ -1,14 +1,23 @@ import React from "react"; -import PropTypes from "prop-types"; import { connect } from "react-redux"; -import { setCategoryConnectionMultiple } from "../Actions/categories"; -import { setCategoryRule } from "../Actions/category_rules"; +import { actions as categoriesActions } from "~store/categories"; +import { actions as categoryRulesActions } from "~store/categoryRules"; +import { AppDispatch, ReduxState } from "~store/index"; // import typed worker -const RuleCollectionCheckWorker = require("worker-loader!../WebWorkers/rule_collection_check.worker.js"); +const RuleCollectionCheckWorker = require("worker-loader!../webworkers/rule_collection_check.worker.js"); + +interface IProps { +} + +interface IState { +} + +class RuleCollectionChecker extends React.Component & ReturnType & IProps> { + state: IState; + worker: any; -class RuleCollectionChecker extends React.Component { constructor(props, context) { super(props, context); this.state = {}; @@ -85,29 +94,25 @@ class RuleCollectionChecker extends React.Component { } } -RuleCollectionChecker.propTypes = { - updateToggle: PropTypes.bool.isRequired -}; - -const mapStateToProps = state => { +const mapStateToProps = (state: ReduxState) => { return { categories: state.categories.categories, - categoryRules: state.category_rules.category_rules, + categoryRules: state.categoryRules.category_rules, queueFinishedSync: state.queue.finished_queue, requestResponses: state.request_responses.request_responses, payments: state.payments.payments, - bunqMeTabs: state.bunq_me_tabs.bunq_me_tabs, + bunqMeTabs: state.bunqMeTabs.bunq_me_tabs, masterCardActions: state.master_card_actions.master_card_actions, requestInquiries: state.request_inquiries.request_inquiries }; }; -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch: AppDispatch) => { return { - setCategoryConnectionMultiple: (...params) => dispatch(setCategoryConnectionMultiple(...params)), - setCategoryRule: rule_collection => dispatch(setCategoryRule(rule_collection)) + setCategoryConnectionMultiple: (...params) => dispatch(categoriesActions.setCategoryConnectionMultiple(...params)), + setCategoryRule: rule_collection => dispatch(categoryRulesActions.setRule(rule_collection)) }; }; diff --git a/src/react/Components/SavingsGoals/Helpers.js b/src/components/SavingsGoals/Helpers.ts similarity index 80% rename from src/react/Components/SavingsGoals/Helpers.js rename to src/components/SavingsGoals/Helpers.ts index 835ad0b6..71560ff8 100644 --- a/src/react/Components/SavingsGoals/Helpers.js +++ b/src/components/SavingsGoals/Helpers.ts @@ -1,6 +1,6 @@ -import { connectGetBudget } from "../../Functions/ConnectGetPermissions"; -import { filterShareInviteMonetaryAccountResponses } from "../../Functions/DataFilters"; -import { formatMoney } from "../../Functions/Utils"; +import { connectGetBudget } from "~functions/ConnectGetPermissions"; +import { filterShareInviteMonetaryAccountResponses } from "~functions/DataFilters"; +import { formatMoney } from "~functions/Utils"; export const calculateTotalBalance = (accounts, accountIds, shareInviteMonetaryAccountResponses = []) => { return accounts.reduce((accumulator, account) => { diff --git a/src/react/Components/SavingsGoals/SavingsGoalListItem.jsx b/src/components/SavingsGoals/SavingsGoalListItem.tsx similarity index 97% rename from src/react/Components/SavingsGoals/SavingsGoalListItem.jsx rename to src/components/SavingsGoals/SavingsGoalListItem.tsx index 837a8dcc..43ee9a3f 100644 --- a/src/react/Components/SavingsGoals/SavingsGoalListItem.jsx +++ b/src/components/SavingsGoals/SavingsGoalListItem.tsx @@ -12,7 +12,7 @@ import ExpiredIcon from "@material-ui/icons/TimerOff"; import LinearProgressCustom from "../LinearProgress"; import NavLink from "../Routing/NavLink"; -import { formatMoney, humanReadableDate } from "../../Functions/Utils"; +import { formatMoney, humanReadableDate } from "~functions/Utils"; const styles = { listItem: { @@ -105,7 +105,7 @@ export default props => { {percentage < 100 && ( - + <>
@@ -113,7 +113,7 @@ export default props => {
-
+ )} diff --git a/src/react/Components/SavingsGoals/SavingsGoalListItemWrapper.jsx b/src/components/SavingsGoals/SavingsGoalListItemWrapper.tsx similarity index 97% rename from src/react/Components/SavingsGoals/SavingsGoalListItemWrapper.jsx rename to src/components/SavingsGoals/SavingsGoalListItemWrapper.tsx index e85eb035..b25a07fe 100644 --- a/src/react/Components/SavingsGoals/SavingsGoalListItemWrapper.jsx +++ b/src/components/SavingsGoals/SavingsGoalListItemWrapper.tsx @@ -5,7 +5,7 @@ import { connect } from "react-redux"; import SavingsGoalListItem from "./SavingsGoalListItem"; import SavingsGoalSmallListItem from "./SavingsGoalSmallListItem"; -import SavingsGoal from "../../Models/SavingsGoal"; +import SavingsGoal from "~models/SavingsGoal"; const SavingsGoalListItemWrapper = props => { const { diff --git a/src/react/Components/SavingsGoals/SavingsGoalSmallListItem.jsx b/src/components/SavingsGoals/SavingsGoalSmallListItem.tsx similarity index 100% rename from src/react/Components/SavingsGoals/SavingsGoalSmallListItem.jsx rename to src/components/SavingsGoals/SavingsGoalSmallListItem.tsx diff --git a/src/react/Components/SavingsGoals/SavingsGoalsList.jsx b/src/components/SavingsGoals/SavingsGoalsList.tsx similarity index 100% rename from src/react/Components/SavingsGoals/SavingsGoalsList.jsx rename to src/components/SavingsGoals/SavingsGoalsList.tsx diff --git a/src/react/Components/Sidebar.jsx b/src/components/Sidebar.tsx similarity index 98% rename from src/react/Components/Sidebar.jsx rename to src/components/Sidebar.tsx index 7173d2ba..43d772aa 100644 --- a/src/react/Components/Sidebar.jsx +++ b/src/components/Sidebar.tsx @@ -27,9 +27,9 @@ import TrophyIcon from "./CustomSVG/Trophy"; import QueueSidebarListItem from "./Queue/QueueSidebarListItem"; import NavLink from "./Routing/NavLink"; import ListItemWrapper from "./ListItemWrapper"; -import IsDarwin from "../Functions/IsDarwin"; +import IsDarwin from "~functions/IsDarwin"; -import { closeSidebar } from "../Actions/sidebar"; +import { closeSidebar } from "~actions/sidebar"; const styles = { list: { @@ -178,7 +178,7 @@ class Sidebar extends React.Component { if (this.props.stickyMenu) { // dynamic menu with a hidden menu on smaller screens return ( - + <> - + ); } else { // menu is always hidden by default diff --git a/src/react/Components/SpeedDial.jsx b/src/components/SpeedDial.tsx similarity index 100% rename from src/react/Components/SpeedDial.jsx rename to src/components/SpeedDial.tsx diff --git a/src/react/Components/SwitchKeysMenu.jsx b/src/components/SwitchKeysMenu.tsx similarity index 98% rename from src/react/Components/SwitchKeysMenu.jsx rename to src/components/SwitchKeysMenu.tsx index e38e4883..b8de3149 100644 --- a/src/react/Components/SwitchKeysMenu.jsx +++ b/src/components/SwitchKeysMenu.tsx @@ -21,7 +21,7 @@ import { registrationRemoveStoredApiKey, registrationSetStoredApiKeys, registrationSwitchKeys -} from "../Actions/registration"; +} from "~actions/registration"; const styles = { list: { @@ -156,7 +156,7 @@ class SwitchKeysMenu extends React.Component { }); return ( - + <> @@ -199,7 +199,7 @@ class SwitchKeysMenu extends React.Component {
- + ); } } diff --git a/src/react/Components/TransactionHeader.jsx b/src/components/TransactionHeader.tsx similarity index 99% rename from src/react/Components/TransactionHeader.jsx rename to src/components/TransactionHeader.tsx index 60de28ba..9763a56f 100644 --- a/src/react/Components/TransactionHeader.jsx +++ b/src/components/TransactionHeader.tsx @@ -14,7 +14,7 @@ import { defaultMastercardImage, defaultRequestResponseImage, defaultPaymentImage -} from "../Functions/DefaultImageHandlers"; +} from "~functions/DefaultImageHandlers"; const styles = { targetWrapper: { diff --git a/src/react/Components/TranslationHelpers/Button.jsx b/src/components/TranslationHelpers/Button.tsx similarity index 100% rename from src/react/Components/TranslationHelpers/Button.jsx rename to src/components/TranslationHelpers/Button.tsx diff --git a/src/react/Components/TranslationHelpers/MenuItem.jsx b/src/components/TranslationHelpers/MenuItem.tsx similarity index 100% rename from src/react/Components/TranslationHelpers/MenuItem.jsx rename to src/components/TranslationHelpers/MenuItem.tsx diff --git a/src/react/Components/TranslationHelpers/Typography.jsx b/src/components/TranslationHelpers/Typography.tsx similarity index 100% rename from src/react/Components/TranslationHelpers/Typography.jsx rename to src/components/TranslationHelpers/Typography.tsx diff --git a/src/react/i18n.jsx b/src/components/i18n.tsx similarity index 89% rename from src/react/i18n.jsx rename to src/components/i18n.tsx index 47b159ed..beb5a56c 100644 --- a/src/react/i18n.jsx +++ b/src/components/i18n.tsx @@ -2,8 +2,8 @@ import i18n from "i18next"; import Backend from "i18next-xhr-backend"; import { reactI18nextModule } from "react-i18next"; -import fs from "./ImportWrappers/fs"; -import path from "./ImportWrappers/path"; +import fs from "~importwrappers/fs"; +import path from "~importwrappers/path"; /** * Adds a new key to the reference locale data @@ -12,7 +12,7 @@ import path from "./ImportWrappers/path"; */ const addLocaleKey = async data => { // get the current localeData - const localeData = require("./Locales/en.json"); + const localeData = require("~locales/en.json"); // go through all the missing keys for this language Object.keys(data).forEach(missingKey => { @@ -33,7 +33,7 @@ const addLocaleKey = async data => { }); try { - const targetPath = path.join(__dirname, "../src/react/Locales/en.json"); + const targetPath = path.join(__dirname, "../locales/en.json"); // write the updated file back to the locale files fs.writeFileSync(targetPath, JSON.stringify(tempLocaleData, null, "\t")); @@ -52,7 +52,7 @@ const loadLocales = (url, options, callback, data) => { if (action === "LOAD") { try { - const locale = require("./Locales/" + language + ".json"); + const locale = require("~locales/" + language + ".json"); callback(locale, { status: "200" }); } catch (e) { console.error(e); diff --git a/src/react/react-app.jsx b/src/components/react-app.tsx similarity index 89% rename from src/react/react-app.jsx rename to src/components/react-app.tsx index 0589bc70..05a1c674 100644 --- a/src/react/react-app.jsx +++ b/src/components/react-app.tsx @@ -12,8 +12,8 @@ import "../scss/main.scss"; import "animate.css"; import "typeface-roboto"; -import Logger from "./Functions/Logger"; -import Analytics from "./Functions/Analytics"; +import Logger from "~functions/Logger"; +import Analytics from "~functions/Analytics"; Analytics(); diff --git a/src/env.js b/src/env.ts similarity index 100% rename from src/env.js rename to src/env.ts diff --git a/src/react/Functions/Analytics.js b/src/functions/Analytics.ts similarity index 93% rename from src/react/Functions/Analytics.js rename to src/functions/Analytics.ts index b25bb226..015f647b 100644 --- a/src/react/Functions/Analytics.js +++ b/src/functions/Analytics.ts @@ -1,8 +1,8 @@ import store from "store"; -import settings from "../ImportWrappers/electronSettings"; +import settings from "~importwrappers/electronSettings"; import { generateGUID } from "./Utils"; import Logger from "./Logger"; -import { ANALYTICS_ENABLED } from "../Reducers/options"; +import { ANALYTICS_ENABLED } from "~reducers/options"; export default (forceEnable = false) => { if (process.env.NODE_ENV === "development") { diff --git a/src/react/Functions/BunqErrorHandler.js b/src/functions/BunqErrorHandler.ts similarity index 66% rename from src/react/Functions/BunqErrorHandler.js rename to src/functions/BunqErrorHandler.ts index 4c09ed81..fc9dac9c 100644 --- a/src/react/Functions/BunqErrorHandler.js +++ b/src/functions/BunqErrorHandler.ts @@ -1,14 +1,18 @@ +import BunqDesktopClient from "~components/BunqDesktopClient"; +import { BatchedActions } from "~store/index"; import Logger from "./Logger"; -import { openModal } from "../Actions/modal"; -import { openSnackbar } from "../Actions/snackbar"; -import { applicationSetOffline } from "../Actions/application"; -import { registrationResetToApiScreen } from "../Actions/registration"; +import { openModal } from "~actions/modal"; +import { registrationResetToApiScreen } from "~actions/registration"; +import { actions as snackbarActions } from "~store/snackbar"; +import { actions as applicationActions } from "~store/application"; import ErrorCodes from "@bunq-community/bunq-js-client/dist/Helpers/ErrorCodes"; -const defaultErrorMessage = (dispatch, customError = false) => { - dispatch( +declare let window: Window & { BunqDesktopClient: BunqDesktopClient; t: Function }; + +const defaultErrorMessage = (batchedActions: BatchedActions, customError: boolean | string = false) => { + batchedActions.push( openModal( customError ? customError : "Something went wrong while trying to send a request", "Something went wrong" @@ -16,14 +20,7 @@ const defaultErrorMessage = (dispatch, customError = false) => { ); }; -/** - * @param dispatch - * @param error - * @param {boolean|string} customError - * @param {boolean|BunqJSClient} BunqJSClient - * @returns {*} - */ -export default (dispatch, error, customError = false, BunqJSClient = false) => { +export default (batchedActions: BatchedActions, error, customError: boolean | string = false, BunqJSClient = false) => { const response = error.response; const offlineError = window.t("We received a network error while trying to send a request! You might be offline"); @@ -39,10 +36,10 @@ export default (dispatch, error, customError = false, BunqJSClient = false) => { // check if a network error occured if (error.toString() === "Error: Network Error") { // show a less intrusive error using the snackbar - dispatch(openSnackbar(offlineError)); + batchedActions.push(snackbarActions.open(offlineError)); // enable offline mode - dispatch(applicationSetOffline()); + batchedActions.push(applicationActions.setOffline()); return; } @@ -50,13 +47,13 @@ export default (dispatch, error, customError = false, BunqJSClient = false) => { switch (error.errorCode) { // invalid response or it couldn't be verified case ErrorCodes.INVALID_RESPONSE_RECEIVED: - return defaultErrorMessage(dispatch, invalidResponseError); + return defaultErrorMessage(batchedActions, invalidResponseError); } } // fallback to a default message if (!response) { - return defaultErrorMessage(dispatch, customError); + return defaultErrorMessage(batchedActions, customError); } // check if we can display a bunq error @@ -86,13 +83,15 @@ export default (dispatch, error, customError = false, BunqJSClient = false) => { errorMessage = invalidAuthenticationError; // reset to api screen if possible - if (BunqJSClient) dispatch(registrationResetToApiScreen(BunqJSClient)); + if (BunqJSClient) { + batchedActions.push(registrationResetToApiScreen(BunqJSClient)); + } break; } - return dispatch(openModal(`${message}:\n ${errorMessage}${responseIdText}`, "Something went wrong")); + return batchedActions.push(openModal(`${message}:\n ${errorMessage}${responseIdText}`, "Something went wrong")); } } - return defaultErrorMessage(dispatch, customError); + return defaultErrorMessage(batchedActions, customError); }; diff --git a/src/react/Functions/ConnectGetPermissions.js b/src/functions/ConnectGetPermissions.ts similarity index 98% rename from src/react/Functions/ConnectGetPermissions.js rename to src/functions/ConnectGetPermissions.ts index d4f1afd9..4fd199fe 100644 --- a/src/react/Functions/ConnectGetPermissions.js +++ b/src/functions/ConnectGetPermissions.ts @@ -36,7 +36,7 @@ export const connectGetType = (shareInviteMonetaryAccountResponses, accountId) = return true; }; -export const connectGetBudget = (shareInviteMonetaryAccountResponses, accountId) => { +export const connectGetBudget = (shareInviteMonetaryAccountResponses, accountId = undefined) => { let inviteResponse = null; if (accountId) { inviteResponse = getInviteResponse(shareInviteMonetaryAccountResponses, accountId); diff --git a/src/react/Functions/Crypto/Crypto.js b/src/functions/Crypto/Crypto.ts similarity index 100% rename from src/react/Functions/Crypto/Crypto.js rename to src/functions/Crypto/Crypto.ts diff --git a/src/react/Functions/Crypto/CryptoWorkerWrapper.js b/src/functions/Crypto/CryptoWorkerWrapper.ts similarity index 97% rename from src/react/Functions/Crypto/CryptoWorkerWrapper.js rename to src/functions/Crypto/CryptoWorkerWrapper.ts index 475278f2..a02b6439 100644 --- a/src/react/Functions/Crypto/CryptoWorkerWrapper.js +++ b/src/functions/Crypto/CryptoWorkerWrapper.ts @@ -1,5 +1,5 @@ import store from "store"; -const CryptoWorker = require("worker-loader!../../WebWorkers/crypto.worker.js"); +const CryptoWorker = require("worker-loader!../../webworkers/crypto.worker.js"); class CryptoWorkerQueue { constructor() { diff --git a/src/react/Functions/Crypto/CustomForge.js b/src/functions/Crypto/CustomForge.ts similarity index 100% rename from src/react/Functions/Crypto/CustomForge.js rename to src/functions/Crypto/CustomForge.ts diff --git a/src/react/Functions/DataFilters.js b/src/functions/DataFilters.ts similarity index 99% rename from src/react/Functions/DataFilters.js rename to src/functions/DataFilters.ts index 4de4e519..1aa29342 100644 --- a/src/react/Functions/DataFilters.js +++ b/src/functions/DataFilters.ts @@ -1,4 +1,4 @@ -import CategoryHelper from "../Components/Categories/CategoryHelper"; +import CategoryHelper from "~components/Categories/CategoryHelper"; const checkDateRange = (fromDate, toDate, date) => { // nothing to check so always valid diff --git a/src/react/Functions/DefaultImageHandlers.js b/src/functions/DefaultImageHandlers.ts similarity index 100% rename from src/react/Functions/DefaultImageHandlers.js rename to src/functions/DefaultImageHandlers.ts diff --git a/src/react/Functions/EventStatusTexts.js b/src/functions/EventStatusTexts.ts similarity index 100% rename from src/react/Functions/EventStatusTexts.js rename to src/functions/EventStatusTexts.ts diff --git a/src/react/Functions/FilterDisabledChecker.js b/src/functions/FilterDisabledChecker.ts similarity index 100% rename from src/react/Functions/FilterDisabledChecker.js rename to src/functions/FilterDisabledChecker.ts diff --git a/src/react/Functions/IpChecker.js b/src/functions/IpChecker.ts similarity index 100% rename from src/react/Functions/IpChecker.js rename to src/functions/IpChecker.ts diff --git a/src/react/Functions/IsDarwin.js b/src/functions/IsDarwin.ts similarity index 62% rename from src/react/Functions/IsDarwin.js rename to src/functions/IsDarwin.ts index 99b0216b..508b5824 100644 --- a/src/react/Functions/IsDarwin.js +++ b/src/functions/IsDarwin.ts @@ -1,4 +1,4 @@ -import os from "../ImportWrappers/os"; +import os from "~importwrappers/os"; export default () => { return os.platform() === "darwin"; diff --git a/src/react/Functions/Logger.js b/src/functions/Logger.ts similarity index 100% rename from src/react/Functions/Logger.js rename to src/functions/Logger.ts diff --git a/src/react/Functions/MergeApiObjects.js b/src/functions/MergeApiObjects.ts similarity index 100% rename from src/react/Functions/MergeApiObjects.js rename to src/functions/MergeApiObjects.ts diff --git a/src/react/Functions/NoteTextTypeParser.js b/src/functions/NoteTextTypeParser.ts similarity index 100% rename from src/react/Functions/NoteTextTypeParser.js rename to src/functions/NoteTextTypeParser.ts diff --git a/src/react/Functions/NotificationHelper.js b/src/functions/NotificationHelper.ts similarity index 100% rename from src/react/Functions/NotificationHelper.js rename to src/functions/NotificationHelper.ts diff --git a/src/react/Functions/PhoneLib.js b/src/functions/PhoneLib.ts similarity index 100% rename from src/react/Functions/PhoneLib.js rename to src/functions/PhoneLib.ts diff --git a/src/react/Functions/ScheduleTexts.js b/src/functions/ScheduleTexts.ts similarity index 100% rename from src/react/Functions/ScheduleTexts.js rename to src/functions/ScheduleTexts.ts diff --git a/src/react/Functions/StatsFormattingTemplates.js b/src/functions/StatsFormattingTemplates.ts similarity index 100% rename from src/react/Functions/StatsFormattingTemplates.js rename to src/functions/StatsFormattingTemplates.ts diff --git a/src/react/Functions/Utils.js b/src/functions/Utils.ts similarity index 100% rename from src/react/Functions/Utils.js rename to src/functions/Utils.ts diff --git a/src/react/Functions/VersionChecker.js b/src/functions/VersionChecker.ts similarity index 100% rename from src/react/Functions/VersionChecker.js rename to src/functions/VersionChecker.ts diff --git a/src/helpers/context_menu.js b/src/helpers/context_menu.ts similarity index 100% rename from src/helpers/context_menu.js rename to src/helpers/context_menu.ts diff --git a/src/helpers/devtools.js b/src/helpers/devtools.ts similarity index 100% rename from src/helpers/devtools.js rename to src/helpers/devtools.ts diff --git a/src/helpers/external_links.js b/src/helpers/external_links.ts similarity index 100% rename from src/helpers/external_links.js rename to src/helpers/external_links.ts diff --git a/src/helpers/oauth.js b/src/helpers/oauth.ts similarity index 100% rename from src/helpers/oauth.js rename to src/helpers/oauth.ts diff --git a/src/helpers/react_navigate.js b/src/helpers/react_navigate.ts similarity index 100% rename from src/helpers/react_navigate.js rename to src/helpers/react_navigate.ts diff --git a/src/helpers/settings.js b/src/helpers/settings.ts similarity index 100% rename from src/helpers/settings.js rename to src/helpers/settings.ts diff --git a/src/helpers/shortcuts.js b/src/helpers/shortcuts.ts similarity index 100% rename from src/helpers/shortcuts.js rename to src/helpers/shortcuts.ts diff --git a/src/helpers/touchbar.js b/src/helpers/touchbar.ts similarity index 100% rename from src/helpers/touchbar.js rename to src/helpers/touchbar.ts diff --git a/src/helpers/tray.js b/src/helpers/tray.ts similarity index 100% rename from src/helpers/tray.js rename to src/helpers/tray.ts diff --git a/src/helpers/window.js b/src/helpers/window.ts similarity index 100% rename from src/helpers/window.js rename to src/helpers/window.ts diff --git a/src/i18n-background.js b/src/i18n-background.ts similarity index 100% rename from src/i18n-background.js rename to src/i18n-background.ts diff --git a/src/react/ImportWrappers/README.md b/src/importwrappers/README.md similarity index 100% rename from src/react/ImportWrappers/README.md rename to src/importwrappers/README.md diff --git a/src/react/ImportWrappers/electronSettings.js b/src/importwrappers/electronSettings.ts similarity index 100% rename from src/react/ImportWrappers/electronSettings.js rename to src/importwrappers/electronSettings.ts diff --git a/src/react/ImportWrappers/fs.js b/src/importwrappers/fs.ts similarity index 100% rename from src/react/ImportWrappers/fs.js rename to src/importwrappers/fs.ts diff --git a/src/react/ImportWrappers/localforage.js b/src/importwrappers/localforage.ts similarity index 100% rename from src/react/ImportWrappers/localforage.js rename to src/importwrappers/localforage.ts diff --git a/src/react/ImportWrappers/os.js b/src/importwrappers/os.ts similarity index 100% rename from src/react/ImportWrappers/os.js rename to src/importwrappers/os.ts diff --git a/src/react/ImportWrappers/path.js b/src/importwrappers/path.ts similarity index 100% rename from src/react/ImportWrappers/path.js rename to src/importwrappers/path.ts diff --git a/src/react/Locales/Crowdin/.gitkeep b/src/locales/Crowdin/.gitkeep similarity index 100% rename from src/react/Locales/Crowdin/.gitkeep rename to src/locales/Crowdin/.gitkeep diff --git a/src/react/Locales/de.json b/src/locales/de.json similarity index 100% rename from src/react/Locales/de.json rename to src/locales/de.json diff --git a/src/react/Locales/en.json b/src/locales/en.json similarity index 100% rename from src/react/Locales/en.json rename to src/locales/en.json diff --git a/src/react/Locales/es.json b/src/locales/es.json similarity index 100% rename from src/react/Locales/es.json rename to src/locales/es.json diff --git a/src/react/Locales/gr.json b/src/locales/gr.json similarity index 100% rename from src/react/Locales/gr.json rename to src/locales/gr.json diff --git a/src/react/Locales/it.json b/src/locales/it.json similarity index 100% rename from src/react/Locales/it.json rename to src/locales/it.json diff --git a/src/react/Locales/nl.json b/src/locales/nl.json similarity index 100% rename from src/react/Locales/nl.json rename to src/locales/nl.json diff --git a/src/menu/darwin_menu_templates.js b/src/menu/darwin_menu_templates.ts similarity index 100% rename from src/menu/darwin_menu_templates.js rename to src/menu/darwin_menu_templates.ts diff --git a/src/menu/dev_menu_template.js b/src/menu/dev_menu_template.ts similarity index 100% rename from src/menu/dev_menu_template.js rename to src/menu/dev_menu_template.ts diff --git a/src/menu/edit_menu_template.js b/src/menu/edit_menu_template.ts similarity index 100% rename from src/menu/edit_menu_template.js rename to src/menu/edit_menu_template.ts diff --git a/src/menu/help_menu_template.js b/src/menu/help_menu_template.ts similarity index 100% rename from src/menu/help_menu_template.js rename to src/menu/help_menu_template.ts diff --git a/src/menu/view_menu_template.js b/src/menu/view_menu_template.ts similarity index 100% rename from src/menu/view_menu_template.js rename to src/menu/view_menu_template.ts diff --git a/src/menu/window_menu_template.js b/src/menu/window_menu_template.ts similarity index 100% rename from src/menu/window_menu_template.js rename to src/menu/window_menu_template.ts diff --git a/src/misc/consts.ts b/src/misc/consts.ts new file mode 100644 index 00000000..5ddadd8a --- /dev/null +++ b/src/misc/consts.ts @@ -0,0 +1,14 @@ +export const STORED_ACCOUNTS = "BUNQDESKTOP_STORED_ACCOUNTS"; +export const SELECTED_ACCOUNT_LOCATION = "BUNQDESKTOP_SELECTED_ACCOUNT"; +export const EXCLUDED_ACCOUNT_IDS = "BUNQDESKTOP_EXCLUDED_ACCOUNT_IDS"; + +export const STORED_BUNQ_ME_TABS = "BUNQDESKTOP_STORED_BUNQ_ME_TABS"; + +export const CARD_ORDER_LOCATION = "BUNQDESKTOP_CARD_ORDER"; + +export const BUNQDESKTOP_CATEGORIES = "BUNQDESKTOP_CATEGORIES"; +export const BUNQDESKTOP_CATEGORY_CONNECTIONS = "BUNQDESKTOP_CATEGORY_CONNECTIONS"; + +export const STORED_CATEGORY_RULES = "BUNQDESKTOP_STORED_CATEGORY_RULES"; + +export const STORED_CONTACTS = "BUNQDESKTOP_STORED_CONTACTS"; diff --git a/src/react/Models/BunqMeTab.ts b/src/models/BunqMeTab.ts similarity index 97% rename from src/react/Models/BunqMeTab.ts rename to src/models/BunqMeTab.ts index 4b5cbbf6..6386b665 100644 --- a/src/react/Models/BunqMeTab.ts +++ b/src/models/BunqMeTab.ts @@ -1,5 +1,5 @@ -import { BunqMeTabEntry, BunqMeTabResultInquiry, BunqMeTabStatus } from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +import { BunqMeTabEntry, BunqMeTabResultInquiry, BunqMeTabStatus } from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; export default class BunqMeTab implements Event { // the original raw object diff --git a/src/react/Models/Card.ts b/src/models/Card.ts similarity index 98% rename from src/react/Models/Card.ts rename to src/models/Card.ts index 787ed51a..e43574e1 100644 --- a/src/react/Models/Card.ts +++ b/src/models/Card.ts @@ -1,4 +1,4 @@ -import { getObjectType } from "../Functions/Utils"; +import { getObjectType } from "~functions/Utils"; import { Alias, @@ -6,7 +6,7 @@ import { CountryPermissionCollection, PinCodeAssignmentCollection, PrimaryAccountNumberCollection -} from "../Types/Types"; +} from "~types/Types"; export default class Card { // the original raw object diff --git a/src/react/Models/MasterCardAction.ts b/src/models/MasterCardAction.ts similarity index 98% rename from src/react/Models/MasterCardAction.ts rename to src/models/MasterCardAction.ts index 077d4855..ea0482ae 100644 --- a/src/react/Models/MasterCardAction.ts +++ b/src/models/MasterCardAction.ts @@ -1,5 +1,5 @@ -import { Amount, LabelCard, PaymentAlias, RequestReferenceSplitTheBill } from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +import { Amount, LabelCard, PaymentAlias, RequestReferenceSplitTheBill } from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; export type PanEntryModeUser = "ATM" | "ICC" | "MAGNETIC_STRIPE" | "E_COMMERCE"; diff --git a/src/react/Models/MonetaryAccount.ts b/src/models/MonetaryAccount.ts similarity index 96% rename from src/react/Models/MonetaryAccount.ts rename to src/models/MonetaryAccount.ts index 2907bab7..7005a12e 100644 --- a/src/react/Models/MonetaryAccount.ts +++ b/src/models/MonetaryAccount.ts @@ -1,6 +1,6 @@ -import { AccountType, MonetaryAccountSetting, AllCoOwner, Alias, Avatar, Balance, Amount } from "../Types/Types"; +import { AccountType, MonetaryAccountSetting, AllCoOwner, Alias, Avatar, Balance, Amount } from "~types/Types"; -import NotificationFilter from "@bunq-community/bunq-js-client/src/Types/NotificationFilter"; +import NotificationFilter from "@bunq-community/bunq-js-client/dist/Types/NotificationFilter"; export default class MonetaryAccount { // the original raw object diff --git a/src/react/Models/Payment.ts b/src/models/Payment.ts similarity index 98% rename from src/react/Models/Payment.ts rename to src/models/Payment.ts index 3dae06ca..882413dc 100644 --- a/src/react/Models/Payment.ts +++ b/src/models/Payment.ts @@ -7,8 +7,8 @@ import { PaymentSubType, PaymentType, RequestReferenceSplitTheBill -} from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +} from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; export default class Payment implements Event { // the original raw object diff --git a/src/react/Models/RequestInquiry.ts b/src/models/RequestInquiry.ts similarity index 98% rename from src/react/Models/RequestInquiry.ts rename to src/models/RequestInquiry.ts index 67eff6b5..bfb96eff 100644 --- a/src/react/Models/RequestInquiry.ts +++ b/src/models/RequestInquiry.ts @@ -7,8 +7,8 @@ import { PaymentAlias, RequestStatus, RequestSplitTheBill -} from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +} from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; export default class RequestInquiry implements Event { // the original raw object diff --git a/src/react/Models/RequestInquiryBatch.ts b/src/models/RequestInquiryBatch.ts similarity index 96% rename from src/react/Models/RequestInquiryBatch.ts rename to src/models/RequestInquiryBatch.ts index fbd7d39a..f7b2476f 100644 --- a/src/react/Models/RequestInquiryBatch.ts +++ b/src/models/RequestInquiryBatch.ts @@ -1,5 +1,5 @@ -import { Amount, RequestSplitTheBill } from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +import { Amount, RequestSplitTheBill } from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; import RequestInquiry from "./RequestInquiry"; export default class RequestInquiryBatch implements Event { diff --git a/src/react/Models/RequestResponse.ts b/src/models/RequestResponse.ts similarity index 98% rename from src/react/Models/RequestResponse.ts rename to src/models/RequestResponse.ts index c1c6ef4e..1a839de8 100644 --- a/src/react/Models/RequestResponse.ts +++ b/src/models/RequestResponse.ts @@ -8,8 +8,8 @@ import { RequestSplitTheBill, RequestResponseType, RequestResponseSubType -} from "../Types/Types"; -import Event, { EventTypeValue } from "../Types/Event"; +} from "~types/Types"; +import Event, { EventTypeValue } from "~types/Event"; export default class RequestResponse implements Event { // the original raw object diff --git a/src/react/Models/SavingsGoal.ts b/src/models/SavingsGoal.ts similarity index 97% rename from src/react/Models/SavingsGoal.ts rename to src/models/SavingsGoal.ts index 4f423bfc..9f717061 100644 --- a/src/react/Models/SavingsGoal.ts +++ b/src/models/SavingsGoal.ts @@ -1,6 +1,6 @@ import MonetaryAccount from "./MonetaryAccount"; -import { generateGUID } from "../Functions/Utils"; -import { calculateTotalBalance } from "../Components/SavingsGoals/Helpers.js"; +import { generateGUID } from "~functions/Utils"; +import { calculateTotalBalance } from "~components/SavingsGoals/Helpers"; export type SavingsGoalSettings = { startAmount?: number; diff --git a/src/react/Pages/AccountInfo.jsx b/src/pages/AccountInfo.tsx similarity index 93% rename from src/react/Pages/AccountInfo.jsx rename to src/pages/AccountInfo.tsx index 3fb0e36d..5912a568 100644 --- a/src/react/Pages/AccountInfo.jsx +++ b/src/pages/AccountInfo.tsx @@ -1,6 +1,6 @@ import React from "react"; import { translate } from "react-i18next"; -import Redirect from "react-router-dom/Redirect"; +import { Redirect } from "react-router-dom"; import { connect } from "react-redux"; import Helmet from "react-helmet"; import CirclePicker from "react-color/lib/Circle"; @@ -20,32 +20,31 @@ import DialogTitle from "@material-ui/core/DialogTitle"; import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemText from "@material-ui/core/ListItemText"; - import ArrowBackIcon from "@material-ui/icons/ArrowBack"; -import TranslateTypography from "../Components/TranslationHelpers/Typography"; -import LazyAttachmentImage from "../Components/AttachmentImage/LazyAttachmentImage"; -import NavLink from "../Components/Routing/NavLink"; -import CombinedList from "../Components/CombinedList/CombinedList"; -import AccountCard from "../Components/AccountCard"; -import TranslateButton from "../Components/TranslationHelpers/Button"; -import MoneyFormatInput from "../Components/FormFields/MoneyFormatInput"; - -import { filterShareInviteMonetaryAccountResponses, filterShareInviteBankInquiries } from "../Functions/DataFilters"; - -import { openSnackbar } from "../Actions/snackbar"; -import { accountsUpdate, accountsUpdateSettings, accountsDeactivate } from "../Actions/accounts"; -import { paymentInfoUpdate } from "../Actions/payments"; -import { requestResponsesUpdate } from "../Actions/request_responses"; -import { bunqMeTabsUpdate } from "../Actions/bunq_me_tabs"; -import { masterCardActionsUpdate } from "../Actions/master_card_actions"; -import { requestInquiriesUpdate } from "../Actions/request_inquiries"; -import { requestInquiryBatchesUpdate } from "../Actions/request_inquiry_batches"; -import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "../Actions/share_invite_monetary_account_inquiries"; -import { shareInviteMonetaryAccountResponsesInfoUpdate } from "../Actions/share_invite_monetary_account_responses"; -import { shareInviteMonetaryAccountResponseChangeStatus } from "../Actions/share_invite_monetary_account_response"; -import { shareInviteMonetaryAccountInquiryChangeStatus } from "../Actions/share_invite_monetary_account_inquiry"; -import { connectGetPermissions } from "../Functions/ConnectGetPermissions"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; +import LazyAttachmentImage from "~components/AttachmentImage/LazyAttachmentImage"; +import NavLink from "~components/Routing/NavLink"; +import CombinedList from "~components/CombinedList/CombinedList"; +import AccountCard from "~components/AccountCard"; +import TranslateButton from "~components/TranslationHelpers/Button"; +import MoneyFormatInput from "~components/FormFields/MoneyFormatInput"; + +import { filterShareInviteMonetaryAccountResponses, filterShareInviteBankInquiries } from "~functions/DataFilters"; + +import { paymentInfoUpdate } from "~actions/payments"; +import { requestResponsesUpdate } from "~actions/request_responses"; +import { masterCardActionsUpdate } from "~actions/master_card_actions"; +import { requestInquiriesUpdate } from "~actions/request_inquiries"; +import { requestInquiryBatchesUpdate } from "~actions/request_inquiry_batches"; +import { shareInviteMonetaryAccountInquiriesInfoUpdate } from "~actions/share_invite_monetary_account_inquiries"; +import { shareInviteMonetaryAccountResponsesInfoUpdate } from "~actions/share_invite_monetary_account_responses"; +import { shareInviteMonetaryAccountResponseChangeStatus } from "~actions/share_invite_monetary_account_response"; +import { shareInviteMonetaryAccountInquiryChangeStatus } from "~actions/share_invite_monetary_account_inquiry"; +import { connectGetPermissions } from "~functions/ConnectGetPermissions"; +import { accountsDeactivate, accountsUpdate, accountsUpdateSettings } from "~store/accounts/thunks"; +import { bunqMeTabsUpdate } from "~store/bunqMeTabs/thunks"; +import { actions as snackbarActions } from "~store/snackbar"; const styles = { paper: { @@ -107,7 +106,9 @@ const PersonChip = ({ alias, BunqJSClient, ...otherProps }) => { ); }; -class AccountInfo extends React.Component { +class AccountInfo extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -416,7 +417,7 @@ class AccountInfo extends React.Component { }; content = ( - + <> {t("Cancel account")} @@ -543,7 +544,7 @@ class AccountInfo extends React.Component { displayAcceptedRequests={true} /> - + ); } else { content = ( @@ -601,7 +602,7 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, ownProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: message => dispatch(openSnackbar(message)), + openSnackbar: message => dispatch(snackbarActions.open({ message })), accountsUpdate: userId => dispatch(accountsUpdate(BunqJSClient, userId)), deactivateAccount: (userId, accountId, reason, accountType) => diff --git a/src/react/Pages/AddAccount.jsx b/src/pages/AddAccount.tsx similarity index 94% rename from src/react/Pages/AddAccount.jsx rename to src/pages/AddAccount.tsx index 8d648392..fac0f10f 100644 --- a/src/react/Pages/AddAccount.jsx +++ b/src/pages/AddAccount.tsx @@ -15,14 +15,14 @@ import RadioGroup from "@material-ui/core/RadioGroup"; import ArrowBackIcon from "@material-ui/icons/ArrowBack"; -import { openSnackbar } from "../Actions/snackbar"; -import { createAccount } from "../Actions/accounts"; +import MoneyFormatInput from "~components/FormFields/MoneyFormatInput"; +import TranslateButton from "~components/TranslationHelpers/Button"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; -import MoneyFormatInput from "../Components/FormFields/MoneyFormatInput"; -import TranslateButton from "../Components/TranslationHelpers/Button"; -import TranslateTypography from "../Components/TranslationHelpers/Typography"; +import { createAccount } from "~store/accounts/thunks"; +import { actions as snackbarActions } from "~store/snackbar"; -const styles = { +const styles: any = { bigAvatar: { width: 60, height: 60 @@ -46,7 +46,9 @@ const styles = { } }; -class AddAccount extends React.Component { +class AddAccount extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -263,7 +265,7 @@ const mapDispatchToProps = (dispatch, ownProps) => { dispatch( createAccount(BunqJSClient, userId, currency, description, dailyLimit, color, savingsGoal, accountType) ), - openSnackbar: message => dispatch(openSnackbar(message)) + openSnackbar: message => dispatch(snackbarActions.open({ message })), }; }; diff --git a/src/react/Pages/ApplicationInfo.jsx b/src/pages/ApplicationInfo.tsx similarity index 91% rename from src/react/Pages/ApplicationInfo.jsx rename to src/pages/ApplicationInfo.tsx index 1cbeb014..83a222bc 100644 --- a/src/react/Pages/ApplicationInfo.jsx +++ b/src/pages/ApplicationInfo.tsx @@ -18,16 +18,17 @@ const remote = require("electron").remote; const shell = require("electron").shell; const app = remote.app; -import NavLink from "../Components/Routing/NavLink"; -import TranslateButton from "../Components/TranslationHelpers/Button"; -import TranslateTypography from "../Components/TranslationHelpers/Typography"; +import NavLink from "~components/Routing/NavLink"; +import TranslateButton from "~components/TranslationHelpers/Button"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; -import { openSnackbar } from "../Actions/snackbar"; -import { allReleases } from "../Functions/VersionChecker"; -import { humanReadableDate } from "../Functions/Utils"; -import Logger from "../Functions/Logger"; +import { allReleases } from "~functions/VersionChecker"; +import { humanReadableDate } from "~functions/Utils"; +import Logger from "~functions/Logger"; -const styles = { +import { actions as snackbarActions } from "~store/snackbar"; + +const styles: any = { avatar: { width: 55, height: 55 @@ -37,7 +38,9 @@ const styles = { } }; -class ApplicationInfo extends React.Component { +class ApplicationInfo extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -169,7 +172,7 @@ const mapStateToProps = state => { const mapDispatchToProps = (dispatch, ownProps) => { const { BunqJSClient } = ownProps; return { - openSnackbar: message => dispatch(openSnackbar(message)) + openSnackbar: message => dispatch(snackbarActions.open({ message })), }; }; diff --git a/src/react/Pages/BunqMePersonal/BunqMePersonal.jsx b/src/pages/BunqMePersonal/BunqMePersonal.tsx similarity index 98% rename from src/react/Pages/BunqMePersonal/BunqMePersonal.jsx rename to src/pages/BunqMePersonal/BunqMePersonal.tsx index 6d544344..0fd3f1f0 100644 --- a/src/react/Pages/BunqMePersonal/BunqMePersonal.jsx +++ b/src/pages/BunqMePersonal/BunqMePersonal.tsx @@ -10,12 +10,11 @@ import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/core/ListItemText"; - import UrlIcon from "@material-ui/icons/Link"; import LinkPreviewField from "./LinkPreviewField"; -import QRCode from "../../Components/QR/QRCode"; -import MoneyFormatInput from "../../Components/FormFields/MoneyFormatInput"; +import QRCode from "~components/QR/QRCode"; +import MoneyFormatInput from "~components/FormFields/MoneyFormatInput"; const styles = { headerTypography: { diff --git a/src/react/Pages/BunqMePersonal/LinkPreviewField.jsx b/src/pages/BunqMePersonal/LinkPreviewField.tsx similarity index 95% rename from src/react/Pages/BunqMePersonal/LinkPreviewField.jsx rename to src/pages/BunqMePersonal/LinkPreviewField.tsx index 5a54b981..97cc25ad 100644 --- a/src/react/Pages/BunqMePersonal/LinkPreviewField.jsx +++ b/src/pages/BunqMePersonal/LinkPreviewField.tsx @@ -5,10 +5,10 @@ import Paper from "@material-ui/core/Paper"; import InputBase from "@material-ui/core/InputBase"; import Divider from "@material-ui/core/Divider"; import IconButton from "@material-ui/core/IconButton"; - import ClearIcon from "@material-ui/icons/Clear"; import CopyIcon from "@material-ui/icons/FileCopy"; -import CopyToClipboardWrap from "../../Components/CopyToClipboardWrap"; + +import CopyToClipboardWrap from "~components/CopyToClipboardWrap"; const styles = { root: { diff --git a/src/react/Pages/BunqMeTab/BunqMeTab.jsx b/src/pages/BunqMeTab/BunqMeTab.tsx similarity index 93% rename from src/react/Pages/BunqMeTab/BunqMeTab.jsx rename to src/pages/BunqMeTab/BunqMeTab.tsx index 9da44ef0..a895bbc8 100644 --- a/src/react/Pages/BunqMeTab/BunqMeTab.jsx +++ b/src/pages/BunqMeTab/BunqMeTab.tsx @@ -10,19 +10,20 @@ import IconButton from "@material-ui/core/IconButton"; import CloseIcon from "@material-ui/icons/Close"; import AddIcon from "@material-ui/icons/Add"; -import AccountList from "../../Components/AccountList/AccountList"; -import BunqMeTabList from "../../Components/BunqMeTabList"; +import AccountList from "~components/AccountList/AccountList"; +import BunqMeTabList from "~components/BunqMeTabList"; +import { bunqMeTabsUpdate } from "~store/bunqMeTabs/thunks"; import BunqMeTabForm from "./BunqMeTabForm"; -import { bunqMeTabsUpdate } from "../../Actions/bunq_me_tabs"; - const styles = { paper: { marginBottom: 20 } }; -class BunqMeTab extends React.Component { +class BunqMeTab extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { diff --git a/src/react/Pages/BunqMeTab/BunqMeTabForm.jsx b/src/pages/BunqMeTab/BunqMeTabForm.tsx similarity index 91% rename from src/react/Pages/BunqMeTab/BunqMeTabForm.jsx rename to src/pages/BunqMeTab/BunqMeTabForm.tsx index 9976c0fd..3d946627 100644 --- a/src/react/Pages/BunqMeTab/BunqMeTabForm.jsx +++ b/src/pages/BunqMeTab/BunqMeTabForm.tsx @@ -5,16 +5,18 @@ import { connect } from "react-redux"; import TextField from "@material-ui/core/TextField"; import FormControl from "@material-ui/core/FormControl"; -import AccountSelectorDialog from "../../Components/FormFields/AccountSelectorDialog"; -import MoneyFormatInput from "../../Components/FormFields/MoneyFormatInput"; -import TranslateTypography from "../../Components/TranslationHelpers/Typography"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import AccountSelectorDialog from "~components/FormFields/AccountSelectorDialog"; +import MoneyFormatInput from "~components/FormFields/MoneyFormatInput"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; +import TranslateButton from "~components/TranslationHelpers/Button"; +import { bunqMeTabSend } from "~store/bunqMeTab/thunks"; + +import { actions as snackbarActions } from "~store/snackbar"; +import { actions as bunqMeTabsActions } from "~store/bunqMeTabs"; -import { openSnackbar } from "../../Actions/snackbar"; -import { bunqMeTabSend } from "../../Actions/bunq_me_tab"; import ConfirmationDialog from "./ConfirmationDialog"; -const styles = { +const styles: any = { payButton: { width: "100%" }, @@ -27,7 +29,9 @@ const styles = { } }; -class BunqMeTabForm extends React.Component { +class BunqMeTabForm extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -227,7 +231,7 @@ const mapDispatchToProps = (dispatch, props) => { return { bunqMeTabSend: (userId, accountId, description, amount, options) => dispatch(bunqMeTabSend(BunqJSClient, userId, accountId, description, amount, options)), - openSnackbar: message => dispatch(openSnackbar(message)) + openSnackbar: message => dispatch(snackbarActions.open({ message })) }; }; diff --git a/src/react/Pages/BunqMeTab/ConfirmationDialog.jsx b/src/pages/BunqMeTab/ConfirmationDialog.tsx similarity index 93% rename from src/react/Pages/BunqMeTab/ConfirmationDialog.jsx rename to src/pages/BunqMeTab/ConfirmationDialog.tsx index fa1a5f58..8b139362 100644 --- a/src/react/Pages/BunqMeTab/ConfirmationDialog.jsx +++ b/src/pages/BunqMeTab/ConfirmationDialog.tsx @@ -8,9 +8,9 @@ import DialogContent from "@material-ui/core/DialogContent"; import DialogTitle from "@material-ui/core/DialogTitle"; import Dialog from "@material-ui/core/Dialog"; -import { formatMoney } from "../../Functions/Utils"; +import { formatMoney } from "~functions/Utils"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import TranslateButton from "~components/TranslationHelpers/Button"; class ConfirmationDialog extends React.Component { render() { diff --git a/src/react/Pages/Cards/CardListItem.jsx b/src/pages/Cards/CardListItem.tsx similarity index 94% rename from src/react/Pages/Cards/CardListItem.jsx rename to src/pages/Cards/CardListItem.tsx index bbfcf35a..88584ef9 100644 --- a/src/react/Pages/Cards/CardListItem.jsx +++ b/src/pages/Cards/CardListItem.tsx @@ -1,4 +1,5 @@ import React from "react"; +import Card from "~models/Card"; const styles = { cardWrapper: {}, @@ -47,7 +48,7 @@ export const getCardTypeImage = (type, apiType = "CardDebit") => { return { cardImage, cardType }; }; -class CardListItem extends React.Component { +class CardListItem extends React.Component<{ card: Card; onClick: any }> { constructor(props, context) { super(props, context); this.state = {}; diff --git a/src/react/Pages/Cards/Cards.jsx b/src/pages/Cards/Cards.tsx similarity index 96% rename from src/react/Pages/Cards/Cards.jsx rename to src/pages/Cards/Cards.tsx index a3986587..06f10d15 100644 --- a/src/react/Pages/Cards/Cards.jsx +++ b/src/pages/Cards/Cards.tsx @@ -20,12 +20,13 @@ import DeleteIcon from "@material-ui/icons/Delete"; import CardListItem from "./CardListItem"; import CvcCodeListItem from "./CvcCodeListItem"; import VirtualAccountNumbersDialog from "./VirtualAccountNumbersDialog"; -import TranslateTypography from "../../Components/TranslationHelpers/Typography"; -import AccountSelectorDialog from "../../Components/FormFields/AccountSelectorDialog"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; +import AccountSelectorDialog from "~components/FormFields/AccountSelectorDialog"; -import { getCardDescription } from "../../Functions/Utils"; -import { cardStatus, cardOrderStatus } from "../../Functions/EventStatusTexts"; -import { cardsUpdate, cardsSetCardOrder, cardsAssignAccounts } from "../../Actions/cards"; +import { getCardDescription } from "~functions/Utils"; +import { cardStatus, cardOrderStatus } from "~functions/EventStatusTexts"; +import { cardsUpdate, cardsAssignAccounts } from "~store/cards/thunks"; +import { actions as cardsActions } from "~store/cards"; const styles = { gridContainer: { @@ -50,7 +51,9 @@ const styles = { } }; -class Cards extends React.Component { +class Cards extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -310,7 +313,7 @@ class Cards extends React.Component { : ""; const secondaryAssignmentSelection = secondaryAccountIndex !== "" && ( - + <> {t("Secondary account")} @@ -328,11 +331,11 @@ class Cards extends React.Component { BunqJSClient={this.props.BunqJSClient} hiddenConnectTypes={["draftOnly", "showOnly"]} /> - + ); const lastDigitsComponent = cardInfo.primary_account_number_four_digit && ( - + <> - + ); const countryComponent = cardInfo.country && ( - + <> - + ); return ( @@ -450,7 +453,7 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { cardsUpdate: userId => dispatch(cardsUpdate(userId)), - cardsSetCardOrder: cardOrder => dispatch(cardsSetCardOrder(cardOrder)), + cardsSetCardOrder: cardOrder => dispatch(cardsActions.setOrder(cardOrder)), cardsAssignAccounts: (user_id, card_id, assignment) => dispatch(cardsAssignAccounts(user_id, card_id, assignment)) diff --git a/src/react/Pages/Cards/CvcCodeListItem.jsx b/src/pages/Cards/CvcCodeListItem.tsx similarity index 93% rename from src/react/Pages/Cards/CvcCodeListItem.jsx rename to src/pages/Cards/CvcCodeListItem.tsx index 960bdae8..a5923da1 100644 --- a/src/react/Pages/Cards/CvcCodeListItem.jsx +++ b/src/pages/Cards/CvcCodeListItem.tsx @@ -9,9 +9,11 @@ import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import RefreshIcon from "@material-ui/icons/Refresh"; import VisibilityIcon from "@material-ui/icons/Visibility"; -import { cardGenerateCvc2, cardUpdateCvc2Codes } from "../../Actions/card_cvc2"; +import { cardGenerateCvc2, cardUpdateCvc2Codes } from "~store/cardCvc2/thunks"; + +class CvcCodeListItem extends React.Component { + state: any; -class CvcCodeListItem extends React.Component { constructor(props, context) { super(props, context); this.state = {}; @@ -46,7 +48,7 @@ class CvcCodeListItem extends React.Component { } return ( - + <> @@ -60,7 +62,7 @@ class CvcCodeListItem extends React.Component { - + ); } } diff --git a/src/react/Pages/Cards/VirtualAccountNumbersDialog.jsx b/src/pages/Cards/VirtualAccountNumbersDialog.tsx similarity index 92% rename from src/react/Pages/Cards/VirtualAccountNumbersDialog.jsx rename to src/pages/Cards/VirtualAccountNumbersDialog.tsx index 3218324a..9493c013 100644 --- a/src/react/Pages/Cards/VirtualAccountNumbersDialog.jsx +++ b/src/pages/Cards/VirtualAccountNumbersDialog.tsx @@ -8,7 +8,7 @@ import List from "@material-ui/core/List"; import ListItem from "@material-ui/core/ListItem"; import ListItemText from "@material-ui/core/ListItemText"; -import AccountListItem from "../../Components/AccountList/AccountListItem"; +import AccountListItem from "~components/AccountList/AccountListItem"; const styles = { list: { @@ -41,7 +41,7 @@ class VirtualAccountNumbersDialog extends React.Component { }); return ( - + <> {accountInfo && } - + ); }) ) : ( @@ -59,7 +59,7 @@ class VirtualAccountNumbersDialog extends React.Component { ); return ( - + <> @@ -68,7 +68,7 @@ class VirtualAccountNumbersDialog extends React.Component { {virtualCardComponents} - + ); } } diff --git a/src/react/Pages/CategoryDashboard/CategoryDashboard.jsx b/src/pages/CategoryDashboard/CategoryDashboard.tsx similarity index 88% rename from src/react/Pages/CategoryDashboard/CategoryDashboard.jsx rename to src/pages/CategoryDashboard/CategoryDashboard.tsx index cb059734..827a6c26 100644 --- a/src/react/Pages/CategoryDashboard/CategoryDashboard.jsx +++ b/src/pages/CategoryDashboard/CategoryDashboard.tsx @@ -6,17 +6,17 @@ import { translate } from "react-i18next"; import Grid from "@material-ui/core/Grid"; import Paper from "@material-ui/core/Paper"; -import CategoryEditor from "../../Components/Categories/CategoryEditor"; -import CategoryChip from "../../Components/Categories/CategoryChip"; -import ImportDialog from "../../Components/ImportDialog"; -import ExportDialog from "../../Components/ExportDialog"; -import TranslateTypography from "../../Components/TranslationHelpers/Typography"; -import TranslateButton from "../../Components/TranslationHelpers/Button"; +import CategoryEditor from "~components/Categories/CategoryEditor"; +import CategoryChip from "~components/Categories/CategoryChip"; +import ImportDialog from "~components/ImportDialog"; +import ExportDialog from "~components/ExportDialog"; +import TranslateTypography from "~components/TranslationHelpers/Typography"; +import TranslateButton from "~components/TranslationHelpers/Button"; -import { removeCategory, removeCategoryConnection, setCategory } from "../../Actions/categories"; -import { openSnackbar } from "../../Actions/snackbar"; +import { actions as categoriesActions } from "~store/categories"; +import { actions as snackbarActions } from "~store/snackbar"; -const styles = { +const styles: any = { chipWrapper: { display: "flex", justifyContent: "center", @@ -28,7 +28,9 @@ const styles = { } }; -class CategoryDashboard extends React.Component { +class CategoryDashboard extends React.Component { + state: any; + constructor(props, context) { super(props, context); this.state = { @@ -227,10 +229,10 @@ const mapStateToProps = state => { const mapDispatchToProps = dispatch => { return { - openSnackbar: message => dispatch(openSnackbar(message)), - removeCategory: (...params) => dispatch(removeCategory(...params)), - removeCategoryConnection: (...params) => dispatch(removeCategoryConnection(...params)), - setCategory: (...params) => dispatch(setCategory(...params)) + openSnackbar: message => dispatch(snackbarActions.open({ message })), + removeCategory: (...params) => dispatch(categoriesActions.removeCategory(...params)), + removeCategoryConnection: (...params) => dispatch(categoriesActions.removeCategoryConnection(...params)), + setCategory: (...params) => dispatch(categoriesActions.setCategory(...params)) }; }; diff --git a/src/react/Pages/Connect/BudgetFields.jsx b/src/pages/Connect/BudgetFields.tsx similarity index 92% rename from src/react/Pages/Connect/BudgetFields.jsx rename to src/pages/Connect/BudgetFields.tsx index e9eec22f..3f919c7d 100644 --- a/src/react/Pages/Connect/BudgetFields.jsx +++ b/src/pages/Connect/BudgetFields.tsx @@ -7,8 +7,8 @@ import Switch from "@material-ui/core/Switch"; import FormControl from "@material-ui/core/FormControl"; import FormControlLabel from "@material-ui/core/FormControlLabel"; -import MoneyFormatInput from "../../Components/FormFields/MoneyFormatInput"; -import TranslateMenuItem from "../../Components/TranslationHelpers/MenuItem"; +import MoneyFormatInput from "~components/FormFields/MoneyFormatInput"; +import TranslateMenuItem from "~components/TranslationHelpers/MenuItem"; const styles = { formControl: { @@ -38,7 +38,7 @@ export default props => { {props.setBudget ? ( - + <> & ReturnType & IProps> { state: IState; + passwordInput: RefObject; + passwordRepeatInput: RefObject; constructor(props, context) { super(props, context); @@ -168,17 +172,23 @@ class LoginPassword extends React.Component & toggleShowPassword = event => { this.setState({ showPassword: !this.state.showPassword }); setTimeout(() => { - this.passwordInput.focus(); - this.passwordInput.selectionStart = 1000; - this.passwordInput.selectionEnd = 1000; + // @ts-ignore + this.passwordInput.current.focus(); + // @ts-ignore + this.passwordInput.current.selectionStart = 1000; + // @ts-ignore + this.passwordInput.current.selectionEnd = 1000; }, 300); }; toggleShowPasswordRepeat = event => { this.setState({ showPasswordRepeat: !this.state.showPasswordRepeat }); setTimeout(() => { - this.passwordRepeatInput.focus(); - this.passwordRepeatInput.selectionStart = 1000; - this.passwordRepeatInput.selectionEnd = 1000; + // @ts-ignore + this.passwordRepeatInput.current.focus(); + // @ts-ignore + this.passwordRepeatInput.current.selectionStart = 1000; + // @ts-ignore + this.passwordRepeatInput.current.selectionEnd = 1000; }, 300); }; @@ -229,7 +239,7 @@ class LoginPassword extends React.Component & registrationLoading === true; let cardContent = registrationLoading ? ( - + Loading @@ -239,7 +249,7 @@ class LoginPassword extends React.Component & ) : ( - + {isExistingInstallation ? t("Enter your password") : t("Enter a password")} @@ -398,7 +408,7 @@ class LoginPassword extends React.Component & const mapStateToProps = (state: ReduxState) => { return { statusMessage: state.application.status_message, - + // @ts-ignore analyticsEnabled: state.options.analytics_enabled, storedApiKeys: state.registration.stored_api_keys, @@ -415,9 +425,11 @@ const mapStateToProps = (state: ReduxState) => { const mapDispatchToProps = (dispatch: AppDispatch) => { return { // use no password + // @ts-ignore useNoPasswordLogin: () => dispatch(registrationSkipPassword()), // use password + // @ts-ignore usePasswordLogin: password => dispatch(registrationSetPassword(password)), // clear api key from bunqjsclient and bunqdesktop diff --git a/src/pages/MasterCardActionInfo.tsx b/src/pages/MasterCardActionInfo.tsx index 41633b69..7123d855 100644 --- a/src/pages/MasterCardActionInfo.tsx +++ b/src/pages/MasterCardActionInfo.tsx @@ -50,9 +50,11 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class MasterCardActionInfo extends React.Component & ReturnType & IProps> { diff --git a/src/pages/NotFound.tsx b/src/pages/NotFound.tsx index 37d0f62f..3aa7bbc1 100644 --- a/src/pages/NotFound.tsx +++ b/src/pages/NotFound.tsx @@ -4,7 +4,15 @@ import { translate } from "react-i18next"; import TranslateTypography from "~components/TranslationHelpers/Typography"; -class NotFound extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +class NotFound extends React.Component { constructor(props, context) { super(props, context); this.state = {}; diff --git a/src/pages/Pay/ConfirmationDialog.tsx b/src/pages/Pay/ConfirmationDialog.tsx index 6866be7b..f4f8efa9 100644 --- a/src/pages/Pay/ConfirmationDialog.tsx +++ b/src/pages/Pay/ConfirmationDialog.tsx @@ -18,9 +18,11 @@ import { ReduxState } from "~store/index"; const styles = {}; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class ConfirmationDialog extends React.Component & IProps> { diff --git a/src/pages/Pay/Pay.tsx b/src/pages/Pay/Pay.tsx index 4a0f6775..d96941e2 100644 --- a/src/pages/Pay/Pay.tsx +++ b/src/pages/Pay/Pay.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import { translate } from "react-i18next"; import { connect } from "react-redux"; import Helmet from "react-helmet"; @@ -12,7 +12,7 @@ import DateFnsUtils from "material-ui-pickers/utils/date-fns-utils"; import MuiPickersUtilsProvider from "material-ui-pickers/MuiPickersUtilsProvider"; import Grid from "@material-ui/core/Grid"; import Paper from "@material-ui/core/Paper"; -import Button from "@material-ui/core/Button"; +import OrigButton from "@material-ui/core/Button"; import Switch from "@material-ui/core/Switch"; import TextField from "@material-ui/core/TextField"; import InputLabel from "@material-ui/core/InputLabel"; @@ -47,6 +47,8 @@ import { filterShareInviteMonetaryAccountResponses } from "~functions/DataFilter import scheduleTexts from "~functions/ScheduleTexts"; import { connectGetBudget, connectGetType, connectGetPermissions } from "~functions/ConnectGetPermissions"; +const Button: any = OrigButton; + const styles = { payButton: { width: "100%", @@ -74,9 +76,16 @@ const styles = { }; interface IState { + target: any; + ibanName: any; + selectedAccount: any; + selectedTargetAccount: any; + targetType: any; + [key: string]: any; } interface IProps { + [key: string]: any; } class Pay extends React.Component & ReturnType & IProps> { @@ -566,6 +575,7 @@ class Pay extends React.Component & ReturnTyp }; if (scheduleEndDate) { + // @ts-ignore schedule.time_end = format(getUTCDate(scheduleEndDate), "yyyy-MM-dd HH:mm:ss"); } @@ -631,10 +641,12 @@ class Pay extends React.Component & ReturnTyp if (filteredInviteResponses.length > 0) { const connectBudget = connectGetBudget(filteredInviteResponses); if (connectBudget) { + // @ts-ignore accountBalance = connectBudget; } } } + // @ts-ignore accountBalance = formatMoney(accountBalance, true); let scheduledPaymentText = null; @@ -678,7 +690,7 @@ class Pay extends React.Component & ReturnTyp } return ( - + {`bunqDesktop - Pay`} @@ -718,7 +730,7 @@ class Pay extends React.Component & ReturnTyp - + {t("New Payment")} { accounts: state.accounts.accounts, selectedAccount: state.accounts.selectedAccount, + // @ts-ignore language: state.options.language, pendingPayments: state.pending_payments.pending_payments, @@ -885,6 +898,8 @@ const mapStateToProps = (state: ReduxState) => { state.share_invite_monetary_account_responses.share_invite_monetary_account_responses, user: state.user.user, + + // @ts-ignore limitedPermissions: state.user.limited_permissions }; }; diff --git a/src/pages/PaymentInfo.tsx b/src/pages/PaymentInfo.tsx index b502f0d7..3919d25b 100644 --- a/src/pages/PaymentInfo.tsx +++ b/src/pages/PaymentInfo.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { CSSProperties } from "react"; import { translate } from "react-i18next"; import { connect } from "react-redux"; import { ipcRenderer } from "electron"; @@ -52,9 +52,11 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class PaymentInfo extends React.Component & ReturnType & IProps> { @@ -181,12 +183,15 @@ class PaymentInfo extends React.Component & R ) }; if (paymentInfo.getDelta() < 0) { + // @ts-ignore transactionHeaderProps.onRequest = this.onRequest; } else { + // @ts-ignore transactionHeaderProps.onForward = this.onForward; } content = ( + // @ts-ignore @@ -198,7 +203,7 @@ class PaymentInfo extends React.Component & R /> - + @@ -236,7 +241,7 @@ class PaymentInfo extends React.Component & R ) : null} - + diff --git a/src/pages/PendingPayments/PendingPaymentRow.tsx b/src/pages/PendingPayments/PendingPaymentRow.tsx index a595ba2c..ad999b18 100644 --- a/src/pages/PendingPayments/PendingPaymentRow.tsx +++ b/src/pages/PendingPayments/PendingPaymentRow.tsx @@ -39,6 +39,7 @@ export default ({ pendingPayment, selectedCheckBoxes, accounts, togglePaymentChe if (paymentObject.counterparty_aliases) { targetComponents = ; } else { + // @ts-ignore targetComponents = ; } diff --git a/src/pages/PendingPayments/PendingPayments.tsx b/src/pages/PendingPayments/PendingPayments.tsx index 2fc68a13..ea816369 100644 --- a/src/pages/PendingPayments/PendingPayments.tsx +++ b/src/pages/PendingPayments/PendingPayments.tsx @@ -73,9 +73,11 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class PendingPayments extends React.Component & ReturnType & IProps> { diff --git a/src/pages/Profile/BillingInfo.tsx b/src/pages/Profile/BillingInfo.tsx index 00aba31c..46143545 100644 --- a/src/pages/Profile/BillingInfo.tsx +++ b/src/pages/Profile/BillingInfo.tsx @@ -17,7 +17,17 @@ const styles = { } }; -class BillingInfo extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +class BillingInfo extends React.Component { + state: IState; + constructor(props, context) { super(props, context); this.state = { diff --git a/src/pages/Profile/BusinessInfo.tsx b/src/pages/Profile/BusinessInfo.tsx index cee93cfa..3acb3c9b 100644 --- a/src/pages/Profile/BusinessInfo.tsx +++ b/src/pages/Profile/BusinessInfo.tsx @@ -76,6 +76,7 @@ const BusinessInfo = ({ t, userType, totalBalance, ...props }) => { { + state: IState; + constructor(props, context) { super(props, context); this.state = { diff --git a/src/pages/Profile/Profile.tsx b/src/pages/Profile/Profile.tsx index 639a084c..b95f770a 100644 --- a/src/pages/Profile/Profile.tsx +++ b/src/pages/Profile/Profile.tsx @@ -70,6 +70,7 @@ const styles: any = { }; interface IState { + [key: string]: any; } interface IProps { diff --git a/src/pages/RequestInquiry/ConfirmationDialog.tsx b/src/pages/RequestInquiry/ConfirmationDialog.tsx index 73cbdb69..ace678b6 100644 --- a/src/pages/RequestInquiry/ConfirmationDialog.tsx +++ b/src/pages/RequestInquiry/ConfirmationDialog.tsx @@ -10,7 +10,17 @@ import DialogContent from "@material-ui/core/DialogContent"; import DialogTitle from "@material-ui/core/DialogTitle"; import { formatMoney } from "~functions/Utils"; -export default class ConfirmationDialog extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +export default class ConfirmationDialog extends React.Component { + state: IState; + render() { const { confirmModalOpen, @@ -55,6 +65,7 @@ export default class ConfirmationDialog extends React.Component { }); return ( + // @ts-ignore Confirm the request diff --git a/src/pages/RequestInquiry/Options/AllowBunqMe.tsx b/src/pages/RequestInquiry/Options/AllowBunqMe.tsx index c4962de6..46c6471d 100644 --- a/src/pages/RequestInquiry/Options/AllowBunqMe.tsx +++ b/src/pages/RequestInquiry/Options/AllowBunqMe.tsx @@ -2,7 +2,17 @@ import React from "react"; import FormControlLabel from "@material-ui/core/FormControlLabel"; import Switch from "@material-ui/core/Switch"; -class AllowBunqMe extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +class AllowBunqMe extends React.Component { + state: IState; + render() { const { targetType, allowBunqMe, handleToggle, t } = this.props; diff --git a/src/pages/RequestInquiry/Options/MinimumAge.tsx b/src/pages/RequestInquiry/Options/MinimumAge.tsx index befd873e..682a94d2 100644 --- a/src/pages/RequestInquiry/Options/MinimumAge.tsx +++ b/src/pages/RequestInquiry/Options/MinimumAge.tsx @@ -19,7 +19,15 @@ const styles = theme => ({ } }); -class MinimumAge extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +class MinimumAge extends React.Component { render() { const { classes, diff --git a/src/pages/RequestInquiry/RequestInquiry.tsx b/src/pages/RequestInquiry/RequestInquiry.tsx index 893aa22f..8ce0350a 100644 --- a/src/pages/RequestInquiry/RequestInquiry.tsx +++ b/src/pages/RequestInquiry/RequestInquiry.tsx @@ -52,9 +52,11 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class RequestInquiry extends React.Component & ReturnType & IProps> { diff --git a/src/pages/RequestInquiry/SplitAmountForm.tsx b/src/pages/RequestInquiry/SplitAmountForm.tsx index be7bfc13..26693335 100644 --- a/src/pages/RequestInquiry/SplitAmountForm.tsx +++ b/src/pages/RequestInquiry/SplitAmountForm.tsx @@ -23,7 +23,17 @@ const styles = { titleGrid: { display: "flex", alignItems: "center" } }; -class SplitAmountForm extends React.Component { +interface IState { + [key: string]: any; +} + +interface IProps { + [key: string]: any; +} + +class SplitAmountForm extends React.Component { + state: IState; + constructor(props, context) { super(props, context); this.state = {}; @@ -40,6 +50,7 @@ class SplitAmountForm extends React.Component { const splitAmountItems = targets.map(target => { return ( @@ -63,6 +75,7 @@ class SplitAmountForm extends React.Component { { + state: IState; + constructor(props, context) { super(props, context); this.state = {}; diff --git a/src/pages/RequestInquiryInfo.tsx b/src/pages/RequestInquiryInfo.tsx index 379f4b65..7fa2d12f 100644 --- a/src/pages/RequestInquiryInfo.tsx +++ b/src/pages/RequestInquiryInfo.tsx @@ -56,9 +56,11 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class RequestInquiryInfo extends React.Component & ReturnType & IProps> { diff --git a/src/pages/RequestResponseInfo/RequestResponseInfo.tsx b/src/pages/RequestResponseInfo/RequestResponseInfo.tsx index 83038ac6..82c97dc2 100644 --- a/src/pages/RequestResponseInfo/RequestResponseInfo.tsx +++ b/src/pages/RequestResponseInfo/RequestResponseInfo.tsx @@ -16,7 +16,6 @@ import ArrowBackIcon from "@material-ui/icons/ArrowBack"; import HelpIcon from "@material-ui/icons/Help"; import SaveIcon from "@material-ui/icons/Save"; import FilterIcon from "@material-ui/icons/FilterList"; -import { shareInviteMonetaryAccountInquiryChangeStatus } from "~actions/share_invite_monetary_account_inquiry"; import FilterCreationDialog from "~components/FilterCreationDialog"; import AccountSelectorDialog from "~components/FormFields/AccountSelectorDialog"; @@ -56,9 +55,11 @@ const styles: any = { }; interface IState { + [key: string]: any; } interface IProps { + [key: string]: any; } class RequestResponseInfo extends React.Component & ReturnType & IProps> { @@ -218,7 +219,7 @@ class RequestResponseInfo extends React.Component - + ) : ( - + { return { user: state.user.user, + // @ts-ignore limitedPermissions: state.user.limited_permissions, pdfSaveModeEnabled: state.application.pdf_save_mode_enabled, diff --git a/src/pages/RuleDashboard/RuleCollectionItem.tsx b/src/pages/RuleDashboard/RuleCollectionItem.tsx index 29ba65dc..7e65fa5b 100644 --- a/src/pages/RuleDashboard/RuleCollectionItem.tsx +++ b/src/pages/RuleDashboard/RuleCollectionItem.tsx @@ -10,11 +10,13 @@ import CategoryIcon from "~components/Categories/CategoryIcon"; import RuleCollection from "~models/RuleCollection"; interface IState { + [key: string]: any; } interface IProps { ruleCollection: RuleCollection; t: AppWindow["t"]; + [key: string]: any; } class RuleCollectionItem extends React.Component { @@ -45,6 +47,7 @@ class RuleCollectionItem extends React.Component { const secondaryText = `${t(enabledText)} - ${ruleCollection.getRules().length} ${t("rules")}`; return [ + // @ts-ignore {categoryIcons} diff --git a/src/pages/RuleDashboard/RuleDashboard.tsx b/src/pages/RuleDashboard/RuleDashboard.tsx index 9fb3daa8..59bb6dd7 100644 --- a/src/pages/RuleDashboard/RuleDashboard.tsx +++ b/src/pages/RuleDashboard/RuleDashboard.tsx @@ -38,6 +38,7 @@ const styles = { }; interface IState { + [key: string]: any; } interface IProps { @@ -148,6 +149,7 @@ class RuleDashboard extends React.Component &