From fe04256019d4e3f3f2c0c1155f9a07ca16199b53 Mon Sep 17 00:00:00 2001 From: BaskarMitrah Date: Mon, 12 Aug 2024 10:40:27 +0530 Subject: [PATCH 1/2] --Added Ims Org ID in the credential card --- .../pages/credential/GetCredentialApiKey.js | 2 + .../pages/credential/GetCredentialOAuthS2s.js | 2 + .../GetCredential/Card/CardClientDetails.js | 78 +++++++++++++++---- .../GetCredential/Card/CardImsOrgID.js | 8 ++ .../GetCredential/CredentialDetailsCard.js | 7 +- .../GetCredential/PreviousProject.js | 2 +- .../Return/ReturnCredentialDetails.js | 13 +++- .../GetCredential/Return/ReturnImsOrgID.js | 8 ++ .../src/components/GetCredential/index.js | 4 + 9 files changed, 104 insertions(+), 20 deletions(-) create mode 100644 packages/gatsby-theme-aio/src/components/GetCredential/Card/CardImsOrgID.js create mode 100644 packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js diff --git a/example/src/pages/credential/GetCredentialApiKey.js b/example/src/pages/credential/GetCredentialApiKey.js index c967a41b77..0c4e1b1eb0 100644 --- a/example/src/pages/credential/GetCredentialApiKey.js +++ b/example/src/pages/credential/GetCredentialApiKey.js @@ -63,6 +63,7 @@ const GetCredentialApiKey = () => { + @@ -83,6 +84,7 @@ const GetCredentialApiKey = () => { + diff --git a/example/src/pages/credential/GetCredentialOAuthS2s.js b/example/src/pages/credential/GetCredentialOAuthS2s.js index 78fbc5af11..47b190015f 100644 --- a/example/src/pages/credential/GetCredentialOAuthS2s.js +++ b/example/src/pages/credential/GetCredentialOAuthS2s.js @@ -110,6 +110,7 @@ const GetCredentialOAuthS2s = () => { + @@ -130,6 +131,7 @@ const GetCredentialOAuthS2s = () => { + diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardClientDetails.js b/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardClientDetails.js index 3e18880a72..f7b47b2b5c 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardClientDetails.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardClientDetails.js @@ -1,4 +1,4 @@ -import React from 'react' +import React, { useContext } from 'react'; import { css } from "@emotion/react"; import { CardAPIKey } from './CardAPIKey'; import { CardClientId } from './CardClientId'; @@ -6,24 +6,74 @@ import { CardAllowedOrigins } from './CardAllowedOrigins'; import { CardClientSecret } from './CardClientSecret'; import { CardOrganizationName } from './CardOrganizationName'; import { CardScopes } from './CardScopes'; +import { CardImsOrgID } from './CardImsOrgID'; +import GetCredentialContext from '../GetCredentialContext'; -const CardClientDetails = ({ clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOriginsDetails, organizationName, allowedOrigins, response }) => { +const CardClientDetails = ({ + clientDetails, + clientIdDetails, + clientSecretDetails, + organizationDetails, + scopesDetails, + apiKeyDetails, + allowedOriginsDetails, + organizationName, + allowedOrigins, + response, + imsOrgID, +}) => { + + const { selectedOrganization } = useContext(GetCredentialContext); return ( -
+

{clientDetails?.heading}

- {apiKeyDetails && } - {clientIdDetails && } - {allowedOrigins && } - {clientSecretDetails && } - {organizationDetails && } + {apiKeyDetails && ( + + )} + {clientIdDetails && ( + + )} + {allowedOrigins && ( + + )} + {clientSecretDetails && ( + + )} + {organizationDetails && ( + + )} {scopesDetails && } + {imsOrgID && ( + + )}
- ) -} + ); +}; export { CardClientDetails }; diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardImsOrgID.js b/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardImsOrgID.js new file mode 100644 index 0000000000..7b42d88442 --- /dev/null +++ b/packages/gatsby-theme-aio/src/components/GetCredential/Card/CardImsOrgID.js @@ -0,0 +1,8 @@ +import React from 'react'; +import ShowCard from './ShowCard'; + +const CardImsOrgID = ({ cardImsOrgID, imsOrgId }) => { + return ; +}; + +export { CardImsOrgID }; diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js b/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js index 7b07e22ae5..1c21b71ba6 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js @@ -20,6 +20,8 @@ import { ReturnAPIKey } from './Return/ReturnAPIKey'; import { ReturnAllowedOrigins } from './Return/ReturnAllowedOrigins'; import { ReturnOrganizationName } from './Return/ReturnOrganizationName'; import { KeyIcon, LinkOut } from './Icons'; +import { CardImsOrgID } from './Card/CardImsOrgID'; +import { ReturnImsOrgID } from './Return/ReturnImsOrgID'; export const CredentialDetailsCard = ({ credentialName, @@ -39,7 +41,7 @@ export const CredentialDetailsCard = ({ returnFields }) => { - let accessToken, devConsoleLinkHeading, clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOrigins + let accessToken, devConsoleLinkHeading, clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOrigins , imsOrgID; if (myCredentialFields) { accessToken = myCredentialFields[AccessToken]; devConsoleLinkHeading = myCredentialFields[DevConsoleLink]?.heading; @@ -50,6 +52,7 @@ export const CredentialDetailsCard = ({ scopesDetails = myCredentialFields[CardScopes]; apiKeyDetails = myCredentialFields[CardAPIKey]; allowedOrigins = myCredentialFields[CardAllowedOrigins]; + imsOrgID = myCredentialFields?.[CardImsOrgID]; } else if (returnFields) { accessToken = returnFields?.[ReturnAccessToken]; @@ -61,6 +64,7 @@ export const CredentialDetailsCard = ({ apiKeyDetails = returnFields?.[ReturnAPIKey]; organizationDetails = returnFields?.[ReturnOrganizationName]; allowedOrigins = returnFields?.[ReturnAllowedOrigins]; + imsOrgID = returnFields?.[ReturnImsOrgID]; } return ( @@ -144,6 +148,7 @@ export const CredentialDetailsCard = ({ organizationName={organizationName} allowedOrigins={allowedOrigins} response={response} + imsOrgID={imsOrgID} /> )} diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/PreviousProject.js b/packages/gatsby-theme-aio/src/components/GetCredential/PreviousProject.js index 60ccb5c118..02d676635d 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/PreviousProject.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/PreviousProject.js @@ -27,7 +27,7 @@ const PreviousProject = ({ returnFields, productList }) => { const projectDetails = previousProjectsDetails?.[selectedIndex]; const manageProps = returnProps[PreviousProject]; - const allowedDomains = projectDetails?.workspaces[0]?.credentials[0]?.metadata?.["adobeid.domain"]; + const allowedDomains = projectDetails?.workspaces[0]?.credentials[0]?.metadata?.["adobeid.domain"]; return ( <> diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js index a077629426..1216cdcb99 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useContext } from 'react'; import { css } from '@emotion/react'; import { ReturnAPIKey } from './ReturnAPIKey'; import { ReturnAllowedOrigins } from './ReturnAllowedOrigins'; @@ -6,13 +6,17 @@ import { ReturnClientId } from './ReturnClientId'; import { ReturnClientSecret } from './ReturnClientSecret'; import { ReturnOrganizationName } from './ReturnOrganizationName'; import { ReturnScopes } from './ReturnScopes'; +import { ReturnImsOrgID } from './ReturnImsOrgID'; +import GetCredentialContext from '../GetCredentialContext'; + +const ReturnCredentialDetails = ({ clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOriginsDetails, organizationName, allowedOrigins, response, imsOrgID }) => { + + const { selectedOrganization } = useContext(GetCredentialContext) -const ReturnCredentialDetails = ({ clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOriginsDetails, organizationName, allowedOrigins, response }) => { - return (

{clientDetails?.heading}

@@ -22,6 +26,7 @@ const ReturnCredentialDetails = ({ clientDetails, clientIdDetails, clientSecretD {clientSecretDetails && } {organizationDetails && } {scopesDetails && } + {imsOrgID && }
) } diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js new file mode 100644 index 0000000000..185f7288ca --- /dev/null +++ b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js @@ -0,0 +1,8 @@ +import React from 'react'; +import ShowCard from '../Card/ShowCard'; + +const ReturnImsOrgID = ({ returnImsOrgID , imsOrgId , value}) => { + return ; +}; + +export { ReturnImsOrgID }; diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/index.js b/packages/gatsby-theme-aio/src/components/GetCredential/index.js index 521b9fdf52..e17e81ba65 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/index.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/index.js @@ -53,6 +53,8 @@ import { OrganizationAccessDetailsType1User } from './RequestAccess/Organization import { OrganizationAccessDetailsNotMember } from './RequestAccess/OrganizationAccessDetailsNotMember'; import { OrganizationAccessDetailsNotSignUp } from './RequestAccess/OrganizationAccessDetailsNotSignUp'; import { getOrganizations } from './Service'; +import { CardImsOrgID } from './Card/CardImsOrgID'; +import { ReturnImsOrgID } from './Return/ReturnImsOrgID'; const LocalStorageKey = 'OrgInfo'; @@ -373,6 +375,7 @@ GetCredential.Card.CredentialDetails.OrganizationName = CardOrganizationName; GetCredential.Card.CredentialDetails.Scopes = CardScopes; GetCredential.Card.CredentialDetails.AllowedOrigins = CardAllowedOrigins; GetCredential.Card.CredentialDetails.APIKey = CardAPIKey; +GetCredential.Card.CredentialDetails.ImsOrgID = CardImsOrgID; GetCredential.NoBetaAccessError = JoinBetaProgram; GetCredential.Return = PreviousProject; GetCredential.Return.AccessToken = ReturnAccessToken; @@ -391,6 +394,7 @@ GetCredential.Return.CredentialDetails.OrganizationName = ReturnOrganizationName GetCredential.Return.CredentialDetails.Scopes = ReturnScopes; GetCredential.Return.CredentialDetails.AllowedOrigins = ReturnAllowedOrigins; GetCredential.Return.CredentialDetails.APIKey = ReturnAPIKey; +GetCredential.Return.CredentialDetails.ImsOrgID = ReturnImsOrgID; GetCredential.RequestAccess = RequestAccess; GetCredential.RequestAccess.RestrictedAccess = RestrictedAccess; GetCredential.RequestAccess.EdgeCase = OrganizationAccessDetailsEdgeCase; From 87cf2d4c9340e42c964e2b754e97bbf97b3e8533 Mon Sep 17 00:00:00 2001 From: BaskarMitrah Date: Tue, 13 Aug 2024 11:51:43 +0530 Subject: [PATCH 2/2] --Added test case for the Ims Org ID & Removed Duplicate file --- cypress/e2e/get-credentials.cy.js | 5 +++++ .../src/components/GetCredential/CredentialDetailsCard.js | 3 +-- .../GetCredential/Return/ReturnCredentialDetails.js | 6 +++--- .../src/components/GetCredential/Return/ReturnImsOrgID.js | 8 -------- .../src/components/GetCredential/index.js | 3 +-- 5 files changed, 10 insertions(+), 15 deletions(-) delete mode 100644 packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js diff --git a/cypress/e2e/get-credentials.cy.js b/cypress/e2e/get-credentials.cy.js index bc95759237..8827889868 100644 --- a/cypress/e2e/get-credentials.cy.js +++ b/cypress/e2e/get-credentials.cy.js @@ -65,6 +65,10 @@ function checkAPIKey() { // verify allowed domains copy button is clickable cy.get('[data-cy="Allowed domains-copyIcon"]').should('be.visible'); + + // verify IMS Organization ID copy button is clickable + cy.get('[data-cy="IMS Organization ID-copyIcon"]').should('exist'); + } function checkOAuthS2S() { @@ -75,6 +79,7 @@ function checkOAuthS2S() { cy.get('[data-cy="retrieve-client-secret"]').should('be.visible'); // cy.get('button[data-cy="copy-client-secret"]').should('exist'); cy.get('[data-cy="Scopes-copyIcon"]').should('exist'); + cy.get('[data-cy="IMS Organization ID-copyIcon"]').should('exist'); cy.contains('openid, AdobeID, read_organizations, firefly_api, ff_apis').should('exist'); } diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js b/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js index 1c21b71ba6..0474813cbf 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/CredentialDetailsCard.js @@ -21,7 +21,6 @@ import { ReturnAllowedOrigins } from './Return/ReturnAllowedOrigins'; import { ReturnOrganizationName } from './Return/ReturnOrganizationName'; import { KeyIcon, LinkOut } from './Icons'; import { CardImsOrgID } from './Card/CardImsOrgID'; -import { ReturnImsOrgID } from './Return/ReturnImsOrgID'; export const CredentialDetailsCard = ({ credentialName, @@ -64,7 +63,7 @@ export const CredentialDetailsCard = ({ apiKeyDetails = returnFields?.[ReturnAPIKey]; organizationDetails = returnFields?.[ReturnOrganizationName]; allowedOrigins = returnFields?.[ReturnAllowedOrigins]; - imsOrgID = returnFields?.[ReturnImsOrgID]; + imsOrgID = returnFields?.[CardImsOrgID]; } return ( diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js index 1216cdcb99..28d1fa6f33 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnCredentialDetails.js @@ -6,12 +6,12 @@ import { ReturnClientId } from './ReturnClientId'; import { ReturnClientSecret } from './ReturnClientSecret'; import { ReturnOrganizationName } from './ReturnOrganizationName'; import { ReturnScopes } from './ReturnScopes'; -import { ReturnImsOrgID } from './ReturnImsOrgID'; import GetCredentialContext from '../GetCredentialContext'; +import { CardImsOrgID } from '../Card/CardImsOrgID'; const ReturnCredentialDetails = ({ clientDetails, clientIdDetails, clientSecretDetails, organizationDetails, scopesDetails, apiKeyDetails, allowedOriginsDetails, organizationName, allowedOrigins, response, imsOrgID }) => { - const { selectedOrganization } = useContext(GetCredentialContext) + const { selectedOrganization } = useContext(GetCredentialContext); return (
} {organizationDetails && } {scopesDetails && } - {imsOrgID && } + {imsOrgID && }
) } diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js b/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js deleted file mode 100644 index 185f7288ca..0000000000 --- a/packages/gatsby-theme-aio/src/components/GetCredential/Return/ReturnImsOrgID.js +++ /dev/null @@ -1,8 +0,0 @@ -import React from 'react'; -import ShowCard from '../Card/ShowCard'; - -const ReturnImsOrgID = ({ returnImsOrgID , imsOrgId , value}) => { - return ; -}; - -export { ReturnImsOrgID }; diff --git a/packages/gatsby-theme-aio/src/components/GetCredential/index.js b/packages/gatsby-theme-aio/src/components/GetCredential/index.js index e17e81ba65..997f8d1fa1 100644 --- a/packages/gatsby-theme-aio/src/components/GetCredential/index.js +++ b/packages/gatsby-theme-aio/src/components/GetCredential/index.js @@ -54,7 +54,6 @@ import { OrganizationAccessDetailsNotMember } from './RequestAccess/Organization import { OrganizationAccessDetailsNotSignUp } from './RequestAccess/OrganizationAccessDetailsNotSignUp'; import { getOrganizations } from './Service'; import { CardImsOrgID } from './Card/CardImsOrgID'; -import { ReturnImsOrgID } from './Return/ReturnImsOrgID'; const LocalStorageKey = 'OrgInfo'; @@ -394,7 +393,7 @@ GetCredential.Return.CredentialDetails.OrganizationName = ReturnOrganizationName GetCredential.Return.CredentialDetails.Scopes = ReturnScopes; GetCredential.Return.CredentialDetails.AllowedOrigins = ReturnAllowedOrigins; GetCredential.Return.CredentialDetails.APIKey = ReturnAPIKey; -GetCredential.Return.CredentialDetails.ImsOrgID = ReturnImsOrgID; +GetCredential.Return.CredentialDetails.ImsOrgID = CardImsOrgID; GetCredential.RequestAccess = RequestAccess; GetCredential.RequestAccess.RestrictedAccess = RestrictedAccess; GetCredential.RequestAccess.EdgeCase = OrganizationAccessDetailsEdgeCase;