From b63c258e833db1cb2df4d877e427825dd3e4b1b6 Mon Sep 17 00:00:00 2001 From: Khac Vy Date: Tue, 11 Feb 2020 16:57:57 +0700 Subject: [PATCH] feat: #208 Add sign out uri(s) field in app form (#222) * feat: #208 Add sign out uri field in app form * feat: #208 Update type definition --- .../types/marketplace-api-schema.ts | 22 +++++++++++-- .../types/platform-schema.ts | 4 +-- .../developer-submit-app.tsx.snap | 2 ++ .../components/pages/developer-submit-app.tsx | 32 +++++++++++++++++-- .../src/tests/badges/badge-branches.svg | 2 +- .../src/tests/badges/badge-functions.svg | 2 +- .../src/tests/badges/badge-statements.svg | 2 +- .../src/utils/form/__tests__/submit-app.ts | 29 +++++++++++++++++ .../marketplace/src/utils/form/submit-app.ts | 6 ++++ yarn.lock | 2 +- 10 files changed, 91 insertions(+), 12 deletions(-) diff --git a/packages/foundations-ts-definitions/types/marketplace-api-schema.ts b/packages/foundations-ts-definitions/types/marketplace-api-schema.ts index b2c695177a..a5685b03e5 100644 --- a/packages/foundations-ts-definitions/types/marketplace-api-schema.ts +++ b/packages/foundations-ts-definitions/types/marketplace-api-schema.ts @@ -71,6 +71,10 @@ export interface AppDetailModel { * Gets the app revisions redirect uri (or uris) where a user will be redirected to immediately after a successful authentication */ redirectUris?: string[] + /** + * Gets the app revisions signout uri (or uris) where a user will be redirected to immediately after a successful logout + */ + signoutUris?: string[] /** * Gets the date the app was installed for a specific client */ @@ -168,6 +172,10 @@ export interface AppRevisionModel { * Gets the app revisions redirect uri (or uris) where a user will be redirected to immediately after a successful authentication */ redirectUris?: string[] + /** + * Gets the app revisions signout uri (or uris) where a user will be redirected to immediately after a successful logout + */ + signoutUris?: string[] /** * Gets the listed status of the app revision */ @@ -387,10 +395,14 @@ export interface CreateAppModel { * Sets the apps launch uri */ launchUri?: string - /** - * Sets the apps uri where a user will be redirected to immediately after a successful authentication. Multiple URIs can be passed as a comma separated list + /** + * Sets the apps uri where a user will be redirected to immediately after a successful authentication. Multiple URIs can be passed in the array */ redirectUris?: string[] + /** + * Set the apps uri where a user will be redirected to immediately after a session is logged out. Multiple URIs can be passed in the array + */ + signoutUris?: string[] /** * Sets the unique identifer of the developer registering the app */ @@ -509,9 +521,13 @@ export interface CreateAppRevisionModel { */ launchUri?: string /** - * Sets the apps uri where a user will be redirected to immediately after a successful authentication. Multiple URIs can be passed as a comma separated list + * Sets the apps uri where a user will be redirected to immediately after a successful authentication. Multiple URIs can be passed in the array */ redirectUris?: string[] + /** + * Set the apps uri where a user will be redirected to immediately after a session is logged out. Multiple URIs can be passed in the array + */ + signoutUris?: string[] /** * Sets the listed status of the app * When false, the app will not be visible in marketplace app listings diff --git a/packages/foundations-ts-definitions/types/platform-schema.ts b/packages/foundations-ts-definitions/types/platform-schema.ts index 1c1066d2f5..f90dff4c33 100644 --- a/packages/foundations-ts-definitions/types/platform-schema.ts +++ b/packages/foundations-ts-definitions/types/platform-schema.ts @@ -1422,12 +1422,12 @@ export interface Contacts { NegotiatorId?: string[] OfficeId?: string[] Address?: string + IdentityCheck?: string Name?: string + MarketingConsent?: string Active?: boolean CreatedFrom?: string CreatedTo?: string - IdentityCheck?: ('pass' | 'fail' | 'pending' | 'warnings' | 'unchecked')[] - MarketingConsent?: ('grant' | 'deny' | 'notAsked')[] } /** * The details specific to applicants with a marketingMode of buying 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 93681a7f38..600dbe1c56 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 @@ -33,6 +33,7 @@ exports[`DeveloperSubmitApp should match a snapshot 1`] = ` "screen3ImageUrl": "", "screen4ImageUrl": "", "screen5ImageUrl": "", + "signoutUris": "", "summary": "", "supportEmail": "", "telephone": "", @@ -93,6 +94,7 @@ exports[`DeveloperSubmitApp should match submit revision form snapshot 1`] = ` ], "screen1ImageUrl": "https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/c4a36706-aa44-47f9-9fb6-9053eef4e581.png", "screen2ImageUrl": "https://reapit-app-store-app-media.s3.eu-west-2.amazonaws.com/65bd3b97-e78c-41cd-b75f-e06e1d2f00df.png", + "signoutUris": "", "summary": "vitae elementum curabitur vitae nunc sed velit eget gravida cum sociis natoque!!", "supportEmail": "support@reapit.com", "telephone": "0113 288 2900", diff --git a/packages/marketplace/src/components/pages/developer-submit-app.tsx b/packages/marketplace/src/components/pages/developer-submit-app.tsx index d26242e91a..4a2f6fdb90 100644 --- a/packages/marketplace/src/components/pages/developer-submit-app.tsx +++ b/packages/marketplace/src/components/pages/developer-submit-app.tsx @@ -43,7 +43,10 @@ import { selectCategories } from '../../selector/app-categories' import styles from '@/styles/pages/developer-submit-app.scss?mod' import { TermsAndConditionsModal } from '../ui/terms-and-conditions-modal' -export type CustomCreateAppModel = Omit & { redirectUris?: string } +export type CustomCreateAppModel = Omit & { + redirectUris?: string + signoutUris?: string +} export interface SubmitAppMappedActions { submitApp: ( @@ -102,6 +105,7 @@ export const generateInitialValues = (appDetail: AppDetailModel | null, develope isDirectApi, scopes: appScopes, redirectUris = [], + signoutUris = [], } = appDetail const icon = (media || []).filter(({ order }) => order === 0)[0] @@ -128,6 +132,7 @@ export const generateInitialValues = (appDetail: AppDetailModel | null, develope isDirectApi, scopes: appScopes ? appScopes.map(item => item.name) : [], redirectUris: redirectUris.join(','), + signoutUris: signoutUris.join(','), ...images, } } else { @@ -150,6 +155,7 @@ export const generateInitialValues = (appDetail: AppDetailModel | null, develope developerId, scopes: [], redirectUris: '', + signoutUris: '', } } @@ -170,7 +176,11 @@ export const handleSubmitApp = ({ } if (!appId) { submitApp( - { ...appModel, redirectUris: appModel.redirectUris ? appModel.redirectUris.split(',') : [] }, + { + ...appModel, + redirectUris: appModel.redirectUris ? appModel.redirectUris.split(',') : [], + signoutUris: appModel.signoutUris ? appModel.signoutUris.split(',') : [], + }, actions, setSubmitError, ) @@ -178,7 +188,11 @@ export const handleSubmitApp = ({ if (appModel.authFlow) { delete appModel.authFlow } - submitRevision(appId, { ...appModel, redirectUris: appModel.redirectUris ? appModel.redirectUris.split(',') : [] }) + submitRevision(appId, { + ...appModel, + redirectUris: appModel.redirectUris ? appModel.redirectUris.split(',') : [], + signoutUris: appModel.signoutUris ? appModel.signoutUris.split(',') : [], + }) } } @@ -387,6 +401,18 @@ export const SubmitApp: React.FC = ({ /> + + + + +