Skip to content

Commit

Permalink
Merge pull request #7391 from sahandilshan/ai-features2
Browse files Browse the repository at this point in the history
Enable AI features for Product-IS
  • Loading branch information
sahandilshan authored Jan 24, 2025
2 parents 767a726 + 501827b commit fb65f7e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
7 changes: 7 additions & 0 deletions .changeset/violet-brooms-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@wso2is/admin.login-flow.ai.v1": minor
"@wso2is/admin.branding.ai.v1": minor
"@wso2is/console": minor
---

Add LoginFlow AI and Branding AI to the Identity Server
2 changes: 0 additions & 2 deletions apps/console/src/public/deployment.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@
},
"applications": {
"disabledFeatures": [
"applications.loginFlow.ai",
"applications.loginFlow.legacyEditor"
],
"enabled": true,
Expand Down Expand Up @@ -430,7 +429,6 @@
},
"branding": {
"disabledFeatures": [
"branding.ai",
"branding.hostnameUrlBranding"
],
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ const httpClient: HttpClientInstance = AsgardeoSPAClient.getInstance()
* @returns generated branding API response.
*/
const generateBrandingPreference = (
websiteUrl: string,
tenantDomain: string
websiteUrl: string
): Promise<GenerateBrandingAPIResponseInterface> => {

const requestConfig: AxiosRequestConfig = {
data: {
tenant_domain: tenantDomain,
website_url: websiteUrl
},
headers: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
* under the License.
*/

import { AppConstants } from "@wso2is/admin.core.v1";
import { store } from "@wso2is/admin.core.v1/store";
import { OrganizationType } from "@wso2is/admin.organizations.v1/constants/organization-constants";
import { useGetCurrentOrganizationType } from "@wso2is/admin.organizations.v1/hooks/use-get-organization-type";
import { IdentityAppsApiException } from "@wso2is/core/exceptions";
import { AlertInterface, AlertLevels } from "@wso2is/core/models";
import { addAlert } from "@wso2is/core/store";
Expand All @@ -37,17 +33,11 @@ const useGenerateAIBrandingPreference = (): GenerateAIBrandingPreferenceFunc =>
const dispatch: Dispatch = useDispatch();
const { t } = useTranslation();

const { organizationType } = useGetCurrentOrganizationType();

const {
setGeneratingBranding,
setOperationId
} = useAIBrandingPreference();

const tenantDomain: string = organizationType === OrganizationType.SUBORGANIZATION
? store.getState().organization.organization.id
: AppConstants.getTenant();

/**
* Generate AI branding preference API call function.
*
Expand All @@ -58,7 +48,7 @@ const useGenerateAIBrandingPreference = (): GenerateAIBrandingPreferenceFunc =>
websiteUrl: string
): Promise<void> => {

return generateBrandingPreference(websiteUrl, tenantDomain)
return generateBrandingPreference(websiteUrl)
.then(
(data: GenerateBrandingAPIResponseInterface) => {
setOperationId(data.operation_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const generateLoginFlow = (

return httpClient(requestConfig)
.then((response: AxiosResponse<GenerateLoginFlowAPIResponseInterface>) => {
if (response.status !== 200) {
if (response.status !== 200 && response.status !== 202) {
throw new Error(`Failed to generate login flow: ${response.statusText}`);
}

Expand Down

0 comments on commit fb65f7e

Please sign in to comment.