@@ -9,29 +9,49 @@ import { ReturnScopes } from './ReturnScopes';
99import  GetCredentialContext  from  '../GetCredentialContext' ; 
1010import  {  CardImsOrgID  }  from  '../Card/CardImsOrgID' ; 
1111
12- const  ReturnCredentialDetails  =  ( {  clientDetails,  clientIdDetails,  clientSecretDetails,  organizationDetails,  scopesDetails,  apiKeyDetails,  allowedOriginsDetails,  organizationName,  allowedOrigins,  response,  imsOrgID } )  =>  { 
12+ const  ReturnCredentialDetails  =  ( { 
13+   clientDetails, 
14+   clientIdDetails, 
15+   clientSecretDetails, 
16+   organizationDetails, 
17+   scopesDetails, 
18+   apiKeyDetails, 
19+   allowedOriginsDetails, 
20+   organizationName, 
21+   allowedOrigins, 
22+   response, 
23+   imsOrgID
24+ } )  =>  { 
1325
1426  const  {  selectedOrganization }  =  useContext ( GetCredentialContext ) ; 
15-   console . log ( 'clientDetails' ,  clientDetails ) 
1627
17-   return  ( 
18-     < div  css = { css ` 
19-         display  :  flex; 
20-         flex-direction  :  column;   
21-         gap :  32px  ; 
22-       ` } > 
28+   const  componentsMap  =  { 
29+     APIKey : < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> , 
30+     AllowedOrigins : < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> , 
31+     ImsOrgID : < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> , 
32+     OrganizationName : < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> , 
33+     ClientId : < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> , 
34+     ClientSecret : < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> , 
35+     Scopes : < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> 
36+   } ; 
2337
24-       < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading }  </ h4 > 
38+   const  splitedOrderBy  =  clientDetails ?. orderBy ?. split ( ',' )  ||  [ ] ; 
39+   const  orderedComponents  =  splitedOrderBy . length  >  0 
40+     ? splitedOrderBy . map ( key  =>  componentsMap [ key ] ) 
41+     : Object . values ( componentsMap ) ; 
2542
26-       { apiKeyDetails  &&  < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
27-       { allowedOrigins  &&  < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> } 
28-       { clientIdDetails  &&  < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
29-       { clientSecretDetails  &&  < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> } 
30-       { organizationDetails  &&  < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> } 
31-       { scopesDetails  &&  < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> } 
32-       { imsOrgID  &&  < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> } 
43+   return  ( 
44+     < div 
45+       css = { css ` 
46+         display :  flex; 
47+         flex-direction :  column; 
48+         gap :  32px  ; 
49+       ` } 
50+     > 
51+       < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading } </ h4 > 
52+       { orderedComponents } 
3353    </ div > 
34-   ) 
35- } 
54+   ) ; 
55+ } ; 
3656
3757export  {  ReturnCredentialDetails  } ; 
0 commit comments