Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/APIDOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,45 @@ xee
</details>

---

#### authPersonInitiate(phoneNumber)

<details>
<summary>Initiates authentication for a person</summary>

##### Parameters

> | name | type | data type | description |
> | ------------- | -------- | --------- | ---------------------------------------------- |
> | `phoneNumber` | required | string | The phone number of the person to authenticate |

##### Responses

> | http code | content-type | response |
> | --------- | ------------------ | ------------------------------- |
> | `200` | `application/json` | `TBD` |
> | `40#` | `application/json` | `{"response": {"status": 40#}}` |

</details>

---

#### authPersonVerify(code)

<details>
<summary>Verifies authentication for a person</summary>

##### Parameters

> | name | type | data type | description |
> | ------ | -------- | --------- | ----------------------------------------------------- |
> | `code` | required | string | The verification code sent to the user's phone number |

##### Responses

> | http code | content-type | response |
> | --------- | ------------------ | ------------------------------- |
> | `200` | `application/json` | `TBD |
> | `40#` | `application/json` | `{"response": {"status": 40#}}` |

---
1 change: 1 addition & 0 deletions docs/USER_FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const userFeatures = [
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SHOW_CONNECT_GLOBAL_NAVIGATION_HEADER` | When enabled, adds a back button to the top of the widget and gets rid of any explicit back buttons | <pre><pre>{<br>&nbsp;feature_name: 'SHOW_CONNECT_GLOBAL_NAVIGATION_HEADER',<br>&nbsp;guid: 'FTR-123', <br>&nbsp;is_enabled: true <br>&nbsp;}</pre> |
| `CONNECT_COMBO_JOBS` | When enabled, the Connect widget will create COMBINATION jobs instead of individual jobs (aggregate, verification, reward, etc). | <pre>{<br>&nbsp;feature_name: 'CONNECT_COMBO_JOBS',<br>&nbsp;guid: 'FTR-123', <br>&nbsp;is_enabled: true <br>&nbsp;}</pre> |
| `CONNECT_RUX` | When enabled, the Connect widget will start by initializing the RUX authentication flow. | <pre>{<br>&nbsp;feature_name: 'CONNECT_RUX',<br>&nbsp;guid: 'FTR-123', <br>&nbsp;is_enabled: true <br>&nbsp;}</pre> |

</details>
<br />
Expand Down
1 change: 1 addition & 0 deletions src/const/Connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const STEPS = {
MFA: 'mfa',
MICRODEPOSITS: 'microdeposits',
OAUTH_ERROR: 'oauthError',
RETURNING_USER_EXPERIENCE: 'returningUserExperience',
SEARCH: 'search',
VERIFY_ERROR: 'verifyError',
VERIFY_EXISTING_MEMBER: 'verifyExistingMember',
Expand Down
1 change: 1 addition & 0 deletions src/const/UserFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

export const CONNECT_COMBO_JOBS = 'CONNECT_COMBO_JOBS'
export const CONNECT_CONSENT = 'CONNECT_CONSENT'
export const CONNECT_RUX = 'CONNECT_RUX'
3 changes: 3 additions & 0 deletions src/hooks/useLoadConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { __ } from 'src/utilities/Intl'
import type { RootState } from 'src/redux/Store'
import { instutionSupportRequestedProducts } from 'src/utilities/Institution'
import { getExperimentalFeatures } from 'src/redux/reducers/experimentalFeaturesSlice'
import { isConnectRuxEnabled } from 'src/redux/reducers/userFeaturesSlice'

export const getErrorResource = (err: { config: { url: string | string[] } }) => {
if (err.config?.url.includes('/institutions')) {
Expand Down Expand Up @@ -49,6 +50,7 @@ const useLoadConnect = () => {
const { api } = useApi()
const profiles = useSelector((state: RootState) => state.profiles)
const experimentalFeatures = useSelector(getExperimentalFeatures)
const isRuxEnabled = useSelector(isConnectRuxEnabled)
const clientLocale = useMemo(() => {
return document.querySelector('html')?.getAttribute('lang') || 'en'
}, [document.querySelector('html')?.getAttribute('lang')])
Expand Down Expand Up @@ -82,6 +84,7 @@ const useLoadConnect = () => {
experimentalFeatures,
members,
widgetProfile: profiles.widgetProfile,
isRuxEnabled,
...dependencies,
}),
),
Expand Down
25 changes: 25 additions & 0 deletions src/redux/reducers/__tests__/userFeaturesSlice-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import reducer, {
loadUserFeatures,
initialState,
getUserFeatures,
isConnectRuxEnabled,
} from 'src/redux/reducers/userFeaturesSlice'
import Store from 'src/redux/Store'

Expand All @@ -28,5 +29,29 @@ describe('UserFeatures slice', () => {
expect(getUserFeatures(state)).toEqual(state.userFeatures.items)
})
})

describe('isConnectRuxEnabled selector', () => {
it('should return true if the CONNECT_RUX feature is enabled', () => {
const userFeatures = [{ feature_name: 'CONNECT_RUX', is_enabled: true }]
const mockState = {
...state,
userFeatures: {
items: userFeatures,
},
}
expect(isConnectRuxEnabled(mockState)).toBe(true)
})

it('should return false if the CONNECT_RUX feature is not enabled', () => {
const userFeatures = [{ feature_name: 'CONNECT_RUX', is_enabled: false }]
const mockState = {
...state,
userFeatures: {
items: userFeatures,
},
}
expect(isConnectRuxEnabled(mockState)).toBe(false)
})
})
})
})
6 changes: 5 additions & 1 deletion src/redux/reducers/userFeaturesSlice.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createSlice, createSelector } from '@reduxjs/toolkit'
import * as UserFeatures from 'src/utilities/UserFeatures'
import { CONNECT_COMBO_JOBS, CONNECT_CONSENT } from 'src/const/UserFeatures'
import { CONNECT_COMBO_JOBS, CONNECT_CONSENT, CONNECT_RUX } from 'src/const/UserFeatures'
import { RootState } from 'src/redux/Store'

type UserFeaturesSlice = {
Expand Down Expand Up @@ -33,6 +33,10 @@ export const isConsentEnabled = createSelector(getUserFeatures, (userFeatures) =
return UserFeatures.isFeatureEnabled(userFeatures, CONNECT_CONSENT)
})

export const isConnectRuxEnabled = createSelector(getUserFeatures, (userFeatures) =>
UserFeatures.isFeatureEnabled(userFeatures, CONNECT_RUX),
)

export const { loadUserFeatures } = userFeaturesSlice.actions

export default userFeaturesSlice.reducer
Loading