From adc5e324a783398fb01589b237743555b920f892 Mon Sep 17 00:00:00 2001
From: Matiss Janis Aboltins <matiss@mja.lv>
Date: Tue, 20 Jun 2023 19:21:30 +0100
Subject: [PATCH] :sparkles: (nordigen) release the feature (#1135)

---
 .../e2e/page-models/navigation.js             |  7 ++++++-
 .../src/components/SidebarWithData.js         |  7 +------
 .../src/components/accounts/Account.js        | 19 +++----------------
 .../src/components/modals/CreateAccount.js    |  2 +-
 .../src/components/settings/Experimental.js   | 10 ----------
 .../src/hooks/useFeatureFlag.ts               |  1 -
 upcoming-release-notes/1135.md                |  6 ++++++
 7 files changed, 17 insertions(+), 35 deletions(-)
 create mode 100644 upcoming-release-notes/1135.md

diff --git a/packages/desktop-client/e2e/page-models/navigation.js b/packages/desktop-client/e2e/page-models/navigation.js
index 00a6d801d..248db6444 100644
--- a/packages/desktop-client/e2e/page-models/navigation.js
+++ b/packages/desktop-client/e2e/page-models/navigation.js
@@ -57,6 +57,9 @@ export class Navigation {
 
   async createAccount(data) {
     await this.page.getByRole('button', { name: 'Add account' }).click();
+    await this.page
+      .getByRole('button', { name: 'Create local account' })
+      .click();
 
     // Fill the form
     await this.page.getByLabel('Name:').fill(data.name);
@@ -66,7 +69,9 @@ export class Navigation {
       await this.page.getByLabel('Off-budget').click();
     }
 
-    await this.page.getByRole('button', { name: 'Create' }).click();
+    await this.page
+      .getByRole('button', { name: 'Create', exact: true })
+      .click();
     return new AccountPage(this.page);
   }
 
diff --git a/packages/desktop-client/src/components/SidebarWithData.js b/packages/desktop-client/src/components/SidebarWithData.js
index 909c12677..d38be20d0 100644
--- a/packages/desktop-client/src/components/SidebarWithData.js
+++ b/packages/desktop-client/src/components/SidebarWithData.js
@@ -10,7 +10,6 @@ import * as Platform from 'loot-core/src/client/platform';
 import * as queries from 'loot-core/src/client/queries';
 import { send } from 'loot-core/src/platform/client/fetch';
 
-import useFeatureFlag from '../hooks/useFeatureFlag';
 import ExpandArrow from '../icons/v0/ExpandArrow';
 import { styles, colors } from '../style';
 
@@ -119,8 +118,6 @@ function SidebarWithData({
   saveGlobalPrefs,
   getAccounts,
 }) {
-  const syncAccount = useFeatureFlag('syncAccount');
-
   useEffect(() => void getAccounts(), [getAccounts]);
 
   async function onReorder(id, dropPos, targetId) {
@@ -146,9 +143,7 @@ function SidebarWithData({
       getOffBudgetBalance={queries.offbudgetAccountBalance}
       onFloat={() => saveGlobalPrefs({ floatingSidebar: !floatingSidebar })}
       onReorder={onReorder}
-      onAddAccount={() =>
-        replaceModal(syncAccount ? 'add-account' : 'add-local-account')
-      }
+      onAddAccount={() => replaceModal('add-account')}
       showClosedAccounts={prefs['ui.showClosedAccounts']}
       onToggleClosedAccounts={() =>
         savePrefs({
diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js
index 7c25affc3..26c60b416 100644
--- a/packages/desktop-client/src/components/accounts/Account.js
+++ b/packages/desktop-client/src/components/accounts/Account.js
@@ -34,7 +34,6 @@ import {
   groupById,
 } from 'loot-core/src/shared/util';
 
-import useFeatureFlag from '../../hooks/useFeatureFlag';
 import {
   SelectedProviderWithItems,
   useSelectedItems,
@@ -264,7 +263,6 @@ function MenuTooltip({ onClose, children }) {
 function AccountMenu({
   account,
   canSync,
-  syncEnabled,
   showBalances,
   canShowBalances,
   showCleared,
@@ -302,8 +300,7 @@ function AccountMenu({
           },
           { name: 'export', text: 'Export' },
           { name: 'reconcile', text: 'Reconcile' },
-          syncEnabled &&
-            account &&
+          account &&
             !account.closed &&
             (canSync
               ? {
@@ -672,7 +669,6 @@ const AccountHeader = memo(
     accountsSyncing,
     accounts,
     transactions,
-    syncEnabled,
     showBalances,
     showExtraBalances,
     showCleared,
@@ -709,7 +705,7 @@ const AccountHeader = memo(
     let searchInput = useRef(null);
     let splitsExpanded = useSplitsExpanded();
 
-    let canSync = syncEnabled && account && account.account_id;
+    let canSync = account && account.account_id;
     if (!account) {
       // All accounts - check for any syncable account
       canSync = !!accounts.find(account => !!account.account_id);
@@ -976,7 +972,6 @@ const AccountHeader = memo(
                   <AccountMenu
                     account={account}
                     canSync={canSync}
-                    syncEnabled={syncEnabled}
                     canShowBalances={canCalculateBalance()}
                     showBalances={showBalances}
                     showCleared={showCleared}
@@ -1820,7 +1815,6 @@ class AccountInternal extends PureComponent {
       accounts,
       categoryGroups,
       payees,
-      syncEnabled,
       dateFormat,
       hideFraction,
       addNotification,
@@ -1890,7 +1884,6 @@ class AccountInternal extends PureComponent {
                   showCleared={showCleared}
                   showEmptyMessage={showEmptyMessage}
                   balanceQuery={balanceQuery}
-                  syncEnabled={syncEnabled}
                   canCalculateBalance={this.canCalculateBalance}
                   reconcileAmount={reconcileAmount}
                   search={this.state.search}
@@ -1958,11 +1951,7 @@ class AccountInternal extends PureComponent {
                     renderEmpty={() =>
                       showEmptyMessage ? (
                         <EmptyMessage
-                          onAdd={() =>
-                            replaceModal(
-                              syncEnabled ? 'add-account' : 'add-local-account',
-                            )
-                          }
+                          onAdd={() => replaceModal('add-account')}
                         />
                       ) : !loading ? (
                         <View
@@ -2011,7 +2000,6 @@ function AccountHack(props) {
 }
 
 export default function Account() {
-  const syncEnabled = useFeatureFlag('syncAccount');
   let params = useParams();
   let location = useLocation();
   let activeLocation = useActiveLocation();
@@ -2074,7 +2062,6 @@ export default function Account() {
         <AccountHack
           {...state}
           {...actionCreators}
-          syncEnabled={syncEnabled}
           modalShowing={
             state.modalShowing ||
             !!(activeLocation.state && activeLocation.state.locationPtr)
diff --git a/packages/desktop-client/src/components/modals/CreateAccount.js b/packages/desktop-client/src/components/modals/CreateAccount.js
index 152ef8008..46e15d269 100644
--- a/packages/desktop-client/src/components/modals/CreateAccount.js
+++ b/packages/desktop-client/src/components/modals/CreateAccount.js
@@ -106,7 +106,7 @@ export default function CreateAccount({ modalProps, syncServerStatus }) {
                 <P style={{ fontSize: 15 }}>
                   Connect to an Actual server to set up{' '}
                   <a
-                    href="https://actualbudget.org/docs/experimental/bank-sync"
+                    href="https://actualbudget.org/docs/advanced/bank-sync"
                     target="_blank"
                     rel="noopener noreferrer"
                   >
diff --git a/packages/desktop-client/src/components/settings/Experimental.js b/packages/desktop-client/src/components/settings/Experimental.js
index 61d0b9660..23a282119 100644
--- a/packages/desktop-client/src/components/settings/Experimental.js
+++ b/packages/desktop-client/src/components/settings/Experimental.js
@@ -41,16 +41,6 @@ export default function ExperimentalFeatures({ prefs, savePrefs }) {
               </View>
             </label>
 
-            <label style={{ display: 'flex' }}>
-              <Checkbox
-                id="sync-account-flag"
-                checked={flags.syncAccount}
-                onChange={() => {
-                  savePrefs({ 'flags.syncAccount': !flags.syncAccount });
-                }}
-              />{' '}
-              <View>Account syncing via Nordigen</View>
-            </label>
             <label style={{ display: 'flex' }}>
               <Checkbox
                 id="goal-templates-flag"
diff --git a/packages/desktop-client/src/hooks/useFeatureFlag.ts b/packages/desktop-client/src/hooks/useFeatureFlag.ts
index 7aa96bfb4..996bf328e 100644
--- a/packages/desktop-client/src/hooks/useFeatureFlag.ts
+++ b/packages/desktop-client/src/hooks/useFeatureFlag.ts
@@ -2,7 +2,6 @@ import { useSelector } from 'react-redux';
 
 const DEFAULT_FEATURE_FLAG_STATE: Record<string, boolean> = {
   reportBudget: false,
-  syncAccount: false,
   goalTemplatesEnabled: false,
 };
 
diff --git a/upcoming-release-notes/1135.md b/upcoming-release-notes/1135.md
new file mode 100644
index 000000000..dceedcf38
--- /dev/null
+++ b/upcoming-release-notes/1135.md
@@ -0,0 +1,6 @@
+---
+category: Features
+authors: [MatissJanis]
+---
+
+Nordigen: release as a first-party feature
-- 
GitLab