diff --git a/packages/marketplace/src/components/pages/app-detail/client/__tests__/__snapshots__/client-web-component-config.test.tsx.snap b/packages/marketplace/src/components/pages/app-detail/client/__tests__/__snapshots__/client-web-component-config.test.tsx.snap index e44d66dd78..5240a1c2cc 100644 --- a/packages/marketplace/src/components/pages/app-detail/client/__tests__/__snapshots__/client-web-component-config.test.tsx.snap +++ b/packages/marketplace/src/components/pages/app-detail/client/__tests__/__snapshots__/client-web-component-config.test.tsx.snap @@ -17,7 +17,7 @@ exports[`WebComponentConfig Should match snapshot 1`] = ` initialEntries={ Array [ Object { - "key": "registerRoute", + "key": "appDetailsRoute", "pathname": "/client/apps/:appid", }, ] @@ -33,7 +33,7 @@ exports[`WebComponentConfig Should match snapshot 1`] = ` "entries": Array [ Object { "hash": "", - "key": "registerRoute", + "key": "appDetailsRoute", "pathname": "/client/apps/:appid", "search": "", }, @@ -46,7 +46,7 @@ exports[`WebComponentConfig Should match snapshot 1`] = ` "listen": [Function], "location": Object { "hash": "", - "key": "registerRoute", + "key": "appDetailsRoute", "pathname": "/client/apps/:appid", "search": "", }, diff --git a/packages/marketplace/src/components/pages/app-detail/client/client-web-component-config.tsx b/packages/marketplace/src/components/pages/app-detail/client/client-web-component-config.tsx index eb218a2f07..29b47ab3b7 100644 --- a/packages/marketplace/src/components/pages/app-detail/client/client-web-component-config.tsx +++ b/packages/marketplace/src/components/pages/app-detail/client/client-web-component-config.tsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react' import { Button } from '@reapit/elements' import { useDispatch, useSelector } from 'react-redux' -import { selectIsWebComponentData } from '@/selector/client' +import { selectWebComponentData } from '@/selector/client' import { clientFetchWebComponentConfig } from '@/actions/client' import { Dispatch } from 'redux' import WebComponentModal from '@/components/ui/web-component-config-modal' @@ -26,7 +26,7 @@ export const WebComponentConfig: React.FC = () => { const [isOpenConfigModal, setIsOpenConfigModal] = useState(false) const clientId = useSelector(selectClientId) || '' - const webComponentData = useSelector(selectIsWebComponentData) + const webComponentData = useSelector(selectWebComponentData) const { appid: applicationId } = useParams() const handleToggleWebComponentModal = toggleWebComponentModal(setIsOpenConfigModal, true) diff --git a/packages/marketplace/src/components/ui/web-component-config-modal/config-modal-inner.tsx b/packages/marketplace/src/components/ui/web-component-config-modal/config-modal-inner.tsx index 0a4c15b09d..e20e177c72 100644 --- a/packages/marketplace/src/components/ui/web-component-config-modal/config-modal-inner.tsx +++ b/packages/marketplace/src/components/ui/web-component-config-modal/config-modal-inner.tsx @@ -17,10 +17,10 @@ import styles from '@/styles/elements/radioselect.scss?mod' import { useDispatch, useSelector } from 'react-redux' import { clientUpdateWebComponentConfig } from '@/actions/client' import { - selectIsWebComponentData, - selectIsWebComponentLoading, - selectIsWebComponentUpdating, - selectIsWebComponentNegotiators, + selectWebComponentData, + selectWebComponentLoading, + selectWebComponentUpdating, + selectWebComponentNegotiators, } from '@/selector/client' import { UpdateWebComponentConfigParams } from '@/services/web-component' import { Dispatch } from 'redux' @@ -47,7 +47,7 @@ export type WebComponentConfigModalBodyProps = { } export const WebComponentConfigModalBody = ({ subtext, formikProps }: WebComponentConfigModalBodyProps) => { const { values, setFieldValue } = formikProps - const negotiators = useSelector(selectIsWebComponentNegotiators) + const negotiators = useSelector(selectWebComponentNegotiators) const negotiatorOptions = genarateNegotiatorOptions(negotiators) return ( @@ -118,7 +118,7 @@ export type WebComponentConfigModalFooterProps = { } export const WebComponentConfigModalFooter = ({ closeModal, formikProps }: WebComponentConfigModalFooterProps) => { - const updating = useSelector(selectIsWebComponentUpdating) + const updating = useSelector(selectWebComponentUpdating) const { handleSubmit } = formikProps return ( <> @@ -139,8 +139,8 @@ export type WebComponentConfigModalInnerProps = { export const WebComponentConfigModalInner = ({ closeModal }: WebComponentConfigModalInnerProps) => { const dispatch = useDispatch() - const webComponentData = useSelector(selectIsWebComponentData) - const loading = useSelector(selectIsWebComponentLoading) + const webComponentData = useSelector(selectWebComponentData) + const loading = useSelector(selectWebComponentLoading) const appDetails = useSelector(selectAppDetailData) const { name, id = '' } = appDetails diff --git a/packages/marketplace/src/selector/__tests__/client.ts b/packages/marketplace/src/selector/__tests__/client.ts index 650e56b391..9db91f2aee 100644 --- a/packages/marketplace/src/selector/__tests__/client.ts +++ b/packages/marketplace/src/selector/__tests__/client.ts @@ -3,11 +3,11 @@ import { selectClientId, selectLoggedUserEmail, selectFeaturedApps, - selectIsWebComponentOpen, - selectIsWebComponentData, - selectIsWebComponentLoading, - selectIsWebComponentUpdating, - selectIsWebComponentNegotiators, + selectWebComponentOpen, + selectWebComponentData, + selectWebComponentLoading, + selectWebComponentUpdating, + selectWebComponentNegotiators, selectAppDetail, selectMyApps, selectInstalledApps, @@ -103,7 +103,7 @@ describe('selectFeaturedApps', () => { }, }, } as ReduxState - const result = selectIsWebComponentOpen(input) + const result = selectWebComponentOpen(input) expect(result).toEqual(true) }) @@ -115,7 +115,7 @@ describe('selectFeaturedApps', () => { }, }, } as ReduxState - const result = selectIsWebComponentData(input) + const result = selectWebComponentData(input) expect(result).toEqual({}) }) @@ -127,7 +127,7 @@ describe('selectFeaturedApps', () => { }, }, } as ReduxState - const result = selectIsWebComponentLoading(input) + const result = selectWebComponentLoading(input) expect(result).toEqual(true) }) @@ -139,7 +139,7 @@ describe('selectFeaturedApps', () => { }, }, } as ReduxState - const result = selectIsWebComponentUpdating(input) + const result = selectWebComponentUpdating(input) expect(result).toEqual(true) }) @@ -152,7 +152,7 @@ describe('selectFeaturedApps', () => { }, }, } as ReduxState - const result = selectIsWebComponentNegotiators(input) + const result = selectWebComponentNegotiators(input) expect(result).toEqual([]) }) it('should run correctly and return {}', () => { diff --git a/packages/marketplace/src/selector/client.ts b/packages/marketplace/src/selector/client.ts index c613686216..8c59453484 100644 --- a/packages/marketplace/src/selector/client.ts +++ b/packages/marketplace/src/selector/client.ts @@ -21,23 +21,23 @@ export const selectInstalledApps = (state: ReduxState) => { return state?.installedApps } -export const selectIsWebComponentOpen = (state: ReduxState) => { +export const selectWebComponentOpen = (state: ReduxState) => { return state?.client.webComponent?.isShowModal } -export const selectIsWebComponentData = (state: ReduxState) => { +export const selectWebComponentData = (state: ReduxState) => { return state?.client.webComponent?.data } -export const selectIsWebComponentLoading = (state: ReduxState) => { +export const selectWebComponentLoading = (state: ReduxState) => { return state?.client.webComponent?.loading } -export const selectIsWebComponentUpdating = (state: ReduxState) => { +export const selectWebComponentUpdating = (state: ReduxState) => { return state?.client.webComponent?.updating } -export const selectIsWebComponentNegotiators = (state: ReduxState) => { +export const selectWebComponentNegotiators = (state: ReduxState) => { return state?.client.webComponent?.negotiators?._embedded || [] }