@@ -9,51 +9,65 @@ import { ReturnScopes } from './ReturnScopes';
99import  GetCredentialContext  from  '../GetCredentialContext' ; 
1010import  {  CardImsOrgID  }  from  '../Card/CardImsOrgID' ; 
1111
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- } )  =>  { 
12+ const  ReturnCredentialDetails  =  ( {  clientDetails,  clientIdDetails,  clientSecretDetails,  organizationDetails,  scopesDetails,  apiKeyDetails,  allowedOriginsDetails,  organizationName,  allowedOrigins,  response,  imsOrgID } )  =>  { 
2513
2614  const  {  selectedOrganization }  =  useContext ( GetCredentialContext ) ; 
15+   console . log ( 'clientDetails' ,  clientDetails ?. orderBy ) 
2716
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-   } ; 
37- 
38-   console . log ( 'first' ,  Object . keys ( componentsMap ) ?. map ( ( sample ) => console . log ( 'sample' ,  sample ) ) ) 
39- 
40-   const  splitedOrderBy  =  clientDetails ?. orderBy ?. split ( ',' )  ||  [ ] ; 
41-   const  orderedComponents  =  splitedOrderBy . length  >  0 
42-     ? splitedOrderBy . map ( key  =>  componentsMap [ key . trim ( ) ] ) 
43-     : [ ] 
44- 
45-   return  ( 
46-     < div 
47-       css = { css ` 
48-         display :  flex; 
49-         flex-direction :  column; 
17+   const  splitedOrderBy  =  clientDetails ?. orderBy  ? clientDetails ?. orderBy ?. split ( ',' )  : [ ] ; 
18+   console . log ( 'splitedOrderBy' ,  splitedOrderBy ) 
19+ 
20+   console . log ( 'splitedOrderBy?.length' ,  splitedOrderBy ?. length ) 
21+ 
22+ return  ( 
23+   < div  css = { css ` 
24+         display  :  flex; 
25+         flex-direction  :  column;   
5026        gap :  32px  ; 
51-       ` } 
52-     > 
53-       < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading } </ h4 > 
54-       { orderedComponents } 
55-     </ div > 
56-   ) ; 
57- } ; 
27+       ` } > 
28+ 
29+     < h4  className = "spectrum-Heading spectrum-Heading--sizeS" > { clientDetails ?. heading }  </ h4 > 
30+     { 
31+       splitedOrderBy ?. length  >  0  ?
32+         < > 
33+           { splitedOrderBy ?. map ( ( list )  =>  { 
34+             if  ( list  ===  "APIKey" )  { 
35+               return  apiKeyDetails  &&  < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> 
36+             } 
37+             if  ( list  ===  "AllowedOrigins" )  { 
38+               return  allowedOrigins  &&  < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> 
39+             } 
40+             if  ( list  ===  "ImsOrgID" )  { 
41+               return  imsOrgID  &&  < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> 
42+             } 
43+             if  ( list  ===  "OrganizationName" )  { 
44+               return  organizationDetails  &&  < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> 
45+             } 
46+             if  ( list  ===  "ClientId" )  { 
47+               return  clientIdDetails  &&  < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> 
48+             } 
49+             if  ( list  ===  "ClientSecret" )  { 
50+               return  clientSecretDetails  &&  < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> 
51+             } 
52+             if  ( list  ===  "Scopes" )  { 
53+               return  scopesDetails  &&  < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> 
54+             } 
55+           } ) } 
56+         </ >  :
57+         < > 
58+           { apiKeyDetails  &&  < ReturnAPIKey  returnCredentialDetails = { clientDetails }  returnAPIKey = { apiKeyDetails }  apiKey = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
59+           { allowedOrigins  &&  < ReturnAllowedOrigins  returnCredentialDetails = { clientDetails }  allowedOrigins = { allowedOriginsDetails }  returnAllowedOrigins = { allowedOrigins }  /> } 
60+           { clientIdDetails  &&  < ReturnClientId  returnCredentialDetails = { clientDetails }  returnClientId = { clientIdDetails }  clientId = { response ?. workspaces [ 0 ] ?. credentials [ 0 ] ?. clientId }  /> } 
61+           { clientSecretDetails  &&  < ReturnClientSecret  returnCredentialDetails = { clientDetails }  returnClientSecret = { clientSecretDetails }  response = { response }  /> } 
62+           { organizationDetails  &&  < ReturnOrganizationName  returnCredentialDetails = { clientDetails }  returnOrganizationName = { organizationDetails }  organization = { organizationName ?. name }  /> } 
63+           { scopesDetails  &&  < ReturnScopes  returnCredentialDetails = { clientDetails }  returnScopes = { scopesDetails }  /> } 
64+           { imsOrgID  &&  < CardImsOrgID  returnCredentialDetails = { clientDetails }  cardImsOrgID = { imsOrgID }  imsOrgId = { selectedOrganization ?. code }  /> } 
65+ 
66+         </ > 
67+     } 
68+ 
69+   </ div > 
70+ ) 
71+ } 
5872
5973export  {  ReturnCredentialDetails  } ; 
0 commit comments