@@ -9,75 +9,51 @@ 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 ?. orderBy ) 
16- 
17-   const  splitedOrderBy  =  clientDetails ?. orderBy  ? clientDetails ?. orderBy ?. split ( ',' )  : [ ] ; 
18-   console . log ( 'splitedOrderBy' ,  splitedOrderBy ) 
1927
2028  const  componentsMap  =  { 
21-     APIKey : apiKeyDetails   &&   < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> , 
22-     AllowedOrigins : allowedOrigins   &&   < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> , 
23-     ImsOrgID : imsOrgID   &&   < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> , 
24-     OrganizationName : organizationDetails   &&   < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> , 
25-     ClientId : clientIdDetails   &&   < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> , 
26-     ClientSecret : clientSecretDetails   &&   < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> , 
27-     Scopes : scopesDetails   &&   < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> 
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 }  /> 
2836  } ; 
2937
30-   console . log ( ' Object.values(componentsMap) ' ,  Object . values ( componentsMap ) ) 
31-   
32- return  ( 
33-   < div  css = { css ` 
34-         display  :  flex; 
35-         flex-direction  :  column;   
36-         gap :  32px  ; 
37-       ` } > 
38- 
39-     < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading }  </ h4 > 
40-     { 
41-       splitedOrderBy ?. length  >  0  ?
42-         < > 
43-           { splitedOrderBy ?. map ( ( list )  =>  { 
44-             if  ( list  ===  "APIKey" )  { 
45-               return  apiKeyDetails  &&  < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> 
46-             } 
47-             if  ( list  ===  "AllowedOrigins" )  { 
48-               return  allowedOrigins  &&  < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> 
49-             } 
50-             if  ( list  ===  "ImsOrgID" )  { 
51-               return  imsOrgID  &&  < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> 
52-             } 
53-             if  ( list  ===  "OrganizationName" )  { 
54-               return  organizationDetails  &&  < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> 
55-             } 
56-             if  ( list  ===  "ClientId" )  { 
57-               return  clientIdDetails  &&  < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> 
58-             } 
59-             if  ( list  ===  "ClientSecret" )  { 
60-               return  clientSecretDetails  &&  < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> 
61-             } 
62-             if  ( list  ===  "Scopes" )  { 
63-               return  scopesDetails  &&  < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> 
64-             } 
65-           } ) } 
66-         </ >  :
67-         < > 
68-           { apiKeyDetails  &&  < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
69-           { allowedOrigins  &&  < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> } 
70-           { clientIdDetails  &&  < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
71-           { clientSecretDetails  &&  < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> } 
72-           { organizationDetails  &&  < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> } 
73-           { scopesDetails  &&  < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> } 
74-           { imsOrgID  &&  < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> } 
38+   console . log ( 'first' ,  Object . keys ( componentsMap ) ?. map ( ( sample ) => console . log ( 'sample' ,  sample ) ) ) 
7539
76-         </ > 
77-     } 
40+   const  splitedOrderBy  =  clientDetails ?. orderBy ?. split ( ',' )  ||  [ ] ; 
41+   const  orderedComponents  =  splitedOrderBy . length  >  0 
42+     ? splitedOrderBy . map ( key  =>  componentsMap [ key . trim ( ) ] ) 
43+     : [ ] 
7844
79-   </ div > 
80- ) 
81- } 
45+   return  ( 
46+     < div 
47+       css = { css ` 
48+         display :  flex; 
49+         flex-direction :  column; 
50+         gap :  32px  ; 
51+       ` } 
52+     > 
53+       < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading } </ h4 > 
54+       { orderedComponents } 
55+     </ div > 
56+   ) ; 
57+ } ; 
8258
8359export  {  ReturnCredentialDetails  } ; 
0 commit comments