diff --git a/packages/config-manager/reapit-config.example.json b/packages/config-manager/reapit-config.example.json index be73771883..5b4ba1c1b8 100644 --- a/packages/config-manager/reapit-config.example.json +++ b/packages/config-manager/reapit-config.example.json @@ -4,30 +4,12 @@ "PLATFORM_API_BASE_URL": "https://dev.platform.reapit.cloud", "MARKETPLACE_API_BASE_URL": "https://dev.platformmarketplace.reapit.cloud", "MARKET_PLACE_URL": "https://dev.marketplace.reapit.cloud", - "MARKETPLACE_API_KEY": "", - "MARKETPLACE_GOOGLE_ANALYTICS_KEY": "", "NODE_ENV": "development", "NPM_TOKEN": "", - "GOOGLE_MAPS_API_KEY": "", - "COGNITO_USERPOOL_ID": "", + "COGNITO_USERPOOL_ID": "eu-west-2_hbt0B7yys", "COGNITO_OAUTH_URL": "https://dev.connect.reapit.cloud", - "COGNITO_CLIENT_ID_MARKETPLACE": "", - "COGNITO_CLIENT_ID_GEO_DIARY": "", - "COGNITO_CLIENT_ID_AML_APP": "", - "COGNITO_CLIENT_ID_LTL_APP": "", + "COGNITO_CLIENT_ID": "", "SWAGGER_BASE_URL": "https://dev.platform.reapit.cloud/docs", - "DEVELOPER_ACCOUNT_EMAIL": "", - "DEVELOPER_ACCOUNT_PASSWORD": "", - "CLIENT_ACCOUNT_EMAIL": "", - "CLIENT_ACCOUNT_PASSWORD": "", - "ADMIN_ACCOUNT_EMAIL": "", - "ADMIN_ACCOUNT_PASSWORD": "", - "APPLICATION_URL": "http://localhost:8080", - "RETRIES": 0, - "CHATBOT_APP_ID": "", - "SENTRY_PROJECT_URL_MARKETPLACE": "", - "SENTRY_PROJECT_URL_GEO_DIARY": "", - "SENTRY_PROJECT_URL_AML_APP": "", - "SENTRY_PROJECT_URL_LTL_APP": "" + "APPLICATION_URL": "http://localhost:8080" } } diff --git a/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app-successfully.tsx.snap b/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app-successfully.tsx.snap index aa8ec8cf49..f21a2cddd4 100644 --- a/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app-successfully.tsx.snap +++ b/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app-successfully.tsx.snap @@ -39,7 +39,7 @@ exports[`DeveloperSubmitAppSuccessfully renders correctly 1`] = `


- You will be directed to the ‘My Apps’ page where you will be able to access the ‘Client ID’ of you App (required for authentication) and or make any changes to your App by clicking ‘Edit Details’. + You will be directed to the ‘My Apps’ page where you will be able to access the ‘Client ID’ of your App (required for authentication) and or make any changes to your App by clicking ‘Edit Details’.


@@ -53,7 +53,7 @@ exports[`DeveloperSubmitAppSuccessfully renders correctly 1`] = ` Please note: - Any changes you make now to your App (included making it ‘Listed’) will require approval. These are called ‘Revisions’. All revisions will be sent to our Admin department and whilst your App is being reviewed, you will not be able to make any further changes and the App will be marked as ‘Pending Revision’. + Any changes you make now to your App (including making it ‘Listed’) will require approval. These are called ‘Revisions’. All revisions will be sent to our Admin department and whilst your App is being reviewed, you will not be able to make any further changes and the App will be marked as ‘Pending Revision’.


@@ -61,7 +61,13 @@ exports[`DeveloperSubmitAppSuccessfully renders correctly 1`] = `


- For any issues or support, please visit the ‘Help’ page. + For any issues or support, please visit the + + ‘Help’ + + page.


diff --git a/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app.tsx.snap b/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app.tsx.snap index 8927c0fd3a..c35d3ca660 100644 --- a/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app.tsx.snap +++ b/packages/marketplace/src/components/pages/__tests__/__snapshots__/developer-submit-app.tsx.snap @@ -50,7 +50,7 @@ exports[`DeveloperSubmitApp should match a snapshot 1`] = ` `; @@ -119,7 +119,7 @@ exports[`DeveloperSubmitApp should match submit revision form snapshot 1`] = ` `; diff --git a/packages/marketplace/src/components/pages/__tests__/developer-submit-app.tsx b/packages/marketplace/src/components/pages/__tests__/developer-submit-app.tsx index c21b52b4f1..408e5c1978 100644 --- a/packages/marketplace/src/components/pages/__tests__/developer-submit-app.tsx +++ b/packages/marketplace/src/components/pages/__tests__/developer-submit-app.tsx @@ -590,9 +590,9 @@ describe('handleSubmitModalViewDocs', () => { window.location = location }) it('should call window.location.assign', () => { - const spy = jest.spyOn(window.location, 'assign') + const spy = jest.spyOn(window, 'open') handleSubmitModalViewDocs() - expect(spy).toHaveBeenCalledWith(DOCS_LINKS.DEVELOPER_PORTAL) + expect(spy).toHaveBeenCalledWith(DOCS_LINKS.DEVELOPER_PORTAL, '_blank') }) }) diff --git a/packages/marketplace/src/components/pages/developer-submit-app-successfully.tsx b/packages/marketplace/src/components/pages/developer-submit-app-successfully.tsx index df859d8152..7db654c930 100644 --- a/packages/marketplace/src/components/pages/developer-submit-app-successfully.tsx +++ b/packages/marketplace/src/components/pages/developer-submit-app-successfully.tsx @@ -2,6 +2,8 @@ import * as React from 'react' import { FlexContainerResponsive, Button } from '@reapit/elements' import CallToAction from '../ui/call-to-action' import styles from '@/styles/pages/developer-submit-app-successfully.scss?mod' +import { Link } from 'react-router-dom' +import Routes from '@/constants/routes' export interface DeveloperSubmitAppSuccessfullyProps { onGoBackToApps: () => void @@ -32,8 +34,8 @@ export const DeveloperSubmitAppSuccessfully: React.FC

You will be directed to the ‘My Apps’ page where you will be able to access the ‘Client - ID’ of you App (required for authentication) and or make any changes to your App by clicking ‘Edit - Details’. + ID’ of your App (required for authentication) and or make any changes to your App by clicking + ‘Edit Details’.


@@ -43,7 +45,7 @@ export const DeveloperSubmitAppSuccessfully: React.FC

- Please note: Any changes you make now to your App (included making it ‘Listed’) + Please note: Any changes you make now to your App (including making it ‘Listed’) will require approval. These are called ‘Revisions’. All revisions will be sent to our Admin department and whilst your App is being reviewed, you will not be able to make any further changes and the App will be marked as ‘Pending Revision’. @@ -54,7 +56,9 @@ export const DeveloperSubmitAppSuccessfully: React.FC
-

For any issues or support, please visit the ‘Help’ page.

+

+ For any issues or support, please visit the ‘Help’ page. +


diff --git a/packages/marketplace/src/components/pages/developer-submit-app.tsx b/packages/marketplace/src/components/pages/developer-submit-app.tsx index 1a6971abde..ff01765142 100644 --- a/packages/marketplace/src/components/pages/developer-submit-app.tsx +++ b/packages/marketplace/src/components/pages/developer-submit-app.tsx @@ -244,7 +244,11 @@ export const handleSubmitModalContinue = setIsSubmitModalOpen => () => { } export const handleSubmitModalViewDocs = () => { - window.location.assign(DOCS_LINKS.DEVELOPER_PORTAL) + const newTab = window.open(DOCS_LINKS.DEVELOPER_PORTAL, '_blank') + + if (newTab) { + newTab.focus() + } } const getGoBackToAppsFunc = ({ history }: Pick) => @@ -274,7 +278,7 @@ export const SubmitApp: React.FC = ({ // const handleOnChangeAgree = setIsAgreedTerms.bind(null, prev => !prev) // submit modal state - const [isSubmitModalOpen, setIsSubmitModalOpen] = React.useState(false) + const [isSubmitModalOpen, setIsSubmitModalOpen] = React.useState(!getCookieString(COOKIE_FIRST_SUBMIT)) const [submitError, setSubmitError] = React.useState() const goBackToApps = getGoBackToAppsFunc({ history }) @@ -367,14 +371,14 @@ export const SubmitApp: React.FC = ({
- For more information on how to complete this form, please view our "Step-by-step" guide + For more information on how to complete this form, please view our "Step-by-step" + guide  - {' '} here @@ -440,7 +444,7 @@ export const SubmitApp: React.FC = ({ labelText="Launch URI" id="launch Url" name="launchUri" - placeholder="The launch page for your app. HTTP:// or HTTPS://" + placeholder="The launch page for your app. HTTPS only other than for http://localhost" /> diff --git a/packages/marketplace/src/components/ui/__tests__/__snapshots__/app-authentication-detail.tsx.snap b/packages/marketplace/src/components/ui/__tests__/__snapshots__/app-authentication-detail.tsx.snap index c119e2c375..d9e782f663 100644 --- a/packages/marketplace/src/components/ui/__tests__/__snapshots__/app-authentication-detail.tsx.snap +++ b/packages/marketplace/src/components/ui/__tests__/__snapshots__/app-authentication-detail.tsx.snap @@ -10,7 +10,7 @@ exports[`AppAuthenticationDetail should match a snapshot 1`] = ` href="#" onClick={[Function]} > - Show Client Credentials + Show Secret diff --git a/packages/marketplace/src/components/ui/__tests__/__snapshots__/sandbox-pop-up.tsx.snap b/packages/marketplace/src/components/ui/__tests__/__snapshots__/sandbox-pop-up.tsx.snap index 212a998f9a..454714694f 100644 --- a/packages/marketplace/src/components/ui/__tests__/__snapshots__/sandbox-pop-up.tsx.snap +++ b/packages/marketplace/src/components/ui/__tests__/__snapshots__/sandbox-pop-up.tsx.snap @@ -3,8 +3,7 @@ exports[`SandboxPopUp should match snapshot with default 1`] = `
- Before continuing with registering your app, we strongly advise that you read the step to step guide on how best to complete the following form. Please confirm if have read the documentation? + Before continuing with registering your app, we strongly advise that you read the "Step-by-step" guide on how best to complete the following form. Please confirm if have read the documentation? `; @@ -50,6 +50,6 @@ exports[`SubmitAppReadDocModal should match snapshot with some additional props title="title" visible={true} > - Before continuing with registering your app, we strongly advise that you read the step to step guide on how best to complete the following form. Please confirm if have read the documentation? + Before continuing with registering your app, we strongly advise that you read the "Step-by-step" guide on how best to complete the following form. Please confirm if have read the documentation? `; diff --git a/packages/marketplace/src/components/ui/app-authentication-detail.tsx b/packages/marketplace/src/components/ui/app-authentication-detail.tsx index b5926f02b7..2abdadae45 100644 --- a/packages/marketplace/src/components/ui/app-authentication-detail.tsx +++ b/packages/marketplace/src/components/ui/app-authentication-detail.tsx @@ -66,7 +66,7 @@ export const AppAuthenticationDetail: React.FunctionComponent

Authentication:

- Show Client Credentials + Show Secret
{loading && } diff --git a/packages/marketplace/src/components/ui/sandbox-pop-up.tsx b/packages/marketplace/src/components/ui/sandbox-pop-up.tsx index ac053ffaf3..0c93e3629e 100644 --- a/packages/marketplace/src/components/ui/sandbox-pop-up.tsx +++ b/packages/marketplace/src/components/ui/sandbox-pop-up.tsx @@ -10,8 +10,7 @@ export const popUp = (setOpen, loading) => () => { export const SandboxPopUp = ({ loading = false, - message = `Data in the dev portal APIs is sandbox and is regularly refreshed. You should not - use these feeds for production apps, they are for development purposes only.`, + message = 'This is a sandbox environment, with anonymised test data and isolated from production', }) => { const [isOpen, setIsOpen] = React.useState(false) const setOpen = React.useCallback(setIsOpen.bind(null, true), [setIsOpen]) diff --git a/packages/marketplace/src/components/ui/submit-app-read-doc-modal.tsx b/packages/marketplace/src/components/ui/submit-app-read-doc-modal.tsx index cf2c266e5a..4c1b5d14c4 100644 --- a/packages/marketplace/src/components/ui/submit-app-read-doc-modal.tsx +++ b/packages/marketplace/src/components/ui/submit-app-read-doc-modal.tsx @@ -31,8 +31,8 @@ export const SubmitAppReadDocModal: React.FC = ({ } {...rest} > - Before continuing with registering your app, we strongly advise that you read the step to step guide on how best - to complete the following form. Please confirm if have read the documentation? + Before continuing with registering your app, we strongly advise that you read the "Step-by-step" guide + on how best to complete the following form. Please confirm if have read the documentation? ) } diff --git a/packages/marketplace/src/sagas/__tests__/auth.ts b/packages/marketplace/src/sagas/__tests__/auth.ts index e9b1259ae9..6bcc9a2d4b 100644 --- a/packages/marketplace/src/sagas/__tests__/auth.ts +++ b/packages/marketplace/src/sagas/__tests__/auth.ts @@ -201,7 +201,9 @@ describe('auth thunks', () => { const TIME_OFFSET = 0 MockDate.set('2019-12-18T16:30:00', TIME_OFFSET) const gen = cloneableGenerator(setFirstTimeLogin)() - expect(gen.next().value).toEqual(call(setCookieString, COOKIE_FIRST_TIME_LOGIN, new Date())) + expect(gen.next().value).toEqual( + call(setCookieString, COOKIE_FIRST_TIME_LOGIN, new Date(), COOKIE_MAX_AGE_INFINITY), + ) expect(gen.next().value).toEqual(put(toggleFirstLogin(false))) expect(gen.next().done).toBe(true) MockDate.reset() diff --git a/packages/marketplace/src/sagas/auth.ts b/packages/marketplace/src/sagas/auth.ts index 17aaad6405..dbd5fe4de1 100644 --- a/packages/marketplace/src/sagas/auth.ts +++ b/packages/marketplace/src/sagas/auth.ts @@ -70,7 +70,7 @@ export const checkFirstTimeLogin = function*() { } export const setFirstTimeLogin = function*() { - yield call(setCookieString, COOKIE_FIRST_TIME_LOGIN, new Date()) + yield call(setCookieString, COOKIE_FIRST_TIME_LOGIN, new Date(), COOKIE_MAX_AGE_INFINITY) yield put(toggleFirstLogin(false)) } diff --git a/packages/marketplace/src/styles/vendor/swagger.scss b/packages/marketplace/src/styles/vendor/swagger.scss index 39ebc9cc61..0474908f42 100644 --- a/packages/marketplace/src/styles/vendor/swagger.scss +++ b/packages/marketplace/src/styles/vendor/swagger.scss @@ -40,7 +40,7 @@ } hgroup.main { - pre.base-url, a { + pre.base-url { display: none; } } diff --git a/packages/marketplace/src/tests/badges/badge-branches.svg b/packages/marketplace/src/tests/badges/badge-branches.svg index 4bd1387371..c7945ec46f 100644 --- a/packages/marketplace/src/tests/badges/badge-branches.svg +++ b/packages/marketplace/src/tests/badges/badge-branches.svg @@ -1 +1 @@ - Coverage:branchesCoverage:branches70.72%70.72% \ No newline at end of file + Coverage:branchesCoverage:branches70.71%70.71% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-functions.svg b/packages/marketplace/src/tests/badges/badge-functions.svg index e3f63912d5..6d34470a06 100644 --- a/packages/marketplace/src/tests/badges/badge-functions.svg +++ b/packages/marketplace/src/tests/badges/badge-functions.svg @@ -1 +1 @@ - Coverage:functionsCoverage:functions73.77%73.77% \ No newline at end of file + Coverage:functionsCoverage:functions73.81%73.81% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-lines.svg b/packages/marketplace/src/tests/badges/badge-lines.svg index 408ba25be3..1dd20ea274 100644 --- a/packages/marketplace/src/tests/badges/badge-lines.svg +++ b/packages/marketplace/src/tests/badges/badge-lines.svg @@ -1 +1 @@ - Coverage:linesCoverage:lines90.34%90.34% \ No newline at end of file + Coverage:linesCoverage:lines90.33%90.33% \ No newline at end of file diff --git a/packages/marketplace/src/tests/badges/badge-statements.svg b/packages/marketplace/src/tests/badges/badge-statements.svg index 7e1340271b..61b3d7e116 100644 --- a/packages/marketplace/src/tests/badges/badge-statements.svg +++ b/packages/marketplace/src/tests/badges/badge-statements.svg @@ -1 +1 @@ - Coverage:statementsCoverage:statements89.53%89.53% \ No newline at end of file + Coverage:statementsCoverage:statements89.52%89.52% \ No newline at end of file diff --git a/packages/marketplace/src/utils/__tests__/validate.ts b/packages/marketplace/src/utils/__tests__/validate.ts index 8b1626762c..6ca7e83fdf 100644 --- a/packages/marketplace/src/utils/__tests__/validate.ts +++ b/packages/marketplace/src/utils/__tests__/validate.ts @@ -1,4 +1,10 @@ -import { isEmail, isValidHttpsUrl, isValidRedirectUrls, whiteListLocalhostAndIsValidUrl } from '../validate' +import { + isEmail, + isValidHttpsUrl, + isValidRedirectUrls, + whiteListLocalhostAndIsValidUrl, + isValidHttpUrl, +} from '../validate' describe('isEmail', () => { it('valid email test', () => { @@ -42,6 +48,16 @@ describe('isValidHttpsUrl', () => { }) }) +describe('isValidHttpUrl', () => { + it('valid http url test', () => { + ;['http://www.google.com', 'http://www.googlee.com'].forEach(url => expect(isValidHttpUrl(url)).toBeTruthy()) + }) + + it('invalid https url test', () => { + ;['htt://google.com', 'http://www'].forEach(url => expect(isValidHttpUrl(url)).toBeFalsy()) + }) +}) + describe('isValidRedirectUrls', () => { it('valid redirect url test', () => { ;['https://www.google.com,http://localhost:8080', 'https://www.googlee.com,https://www.facebook.com'].forEach(url => diff --git a/packages/marketplace/src/utils/form/submit-app.ts b/packages/marketplace/src/utils/form/submit-app.ts index a8468d70d7..f8ad94c3dd 100644 --- a/packages/marketplace/src/utils/form/submit-app.ts +++ b/packages/marketplace/src/utils/form/submit-app.ts @@ -1,6 +1,6 @@ import { validateRequire, validateEmail } from '@reapit/elements' import { CustomCreateAppModel } from '@/components/pages/developer-submit-app' -import { isValidRedirectUrls, whiteListLocalhostAndIsValidUrl } from '@/utils/validate' +import { isValidRedirectUrls, whiteListLocalhostAndIsValidUrl, isValidHttpUrl } from '@/utils/validate' export type SubmitAppFormErrorKeys = | 'name' @@ -62,7 +62,7 @@ export const validate = (values: CustomCreateAppModel) => { errors.signoutUris = 'Invalid sign out uri(s)' } - if (values.homePage && !whiteListLocalhostAndIsValidUrl(values.homePage)) { + if (values.homePage && !whiteListLocalhostAndIsValidUrl(values.homePage) && !isValidHttpUrl(values.homePage)) { errors.homePage = 'Invalid Home Page URL' } diff --git a/packages/marketplace/src/utils/validate.ts b/packages/marketplace/src/utils/validate.ts index 1c3c60c60e..d769f32bb1 100644 --- a/packages/marketplace/src/utils/validate.ts +++ b/packages/marketplace/src/utils/validate.ts @@ -8,6 +8,10 @@ export function isValidHttpsUrl(url: string) { return /^\s*(https:\/\/)([a-z\d-]{1,63}\.)*[a-z\d-]{1,255}\.[a-z]{2,6}\s*/.test(url) } +export function isValidHttpUrl(url: string) { + return /^\s*(http:\/\/)([a-z\d-]{1,63}\.)*[a-z\d-]{1,255}\.[a-z]{2,6}\s*/.test(url) +} + export function whiteListLocalhostAndIsValidUrl(url: string) { return isValidHttpsUrl(url) || /http?:\/\/localhost/.test(url) }