diff --git a/features/admin.core.v1/configs/app.ts b/features/admin.core.v1/configs/app.ts index ccb7c08d18e..3590685c17c 100644 --- a/features/admin.core.v1/configs/app.ts +++ b/features/admin.core.v1/configs/app.ts @@ -39,6 +39,7 @@ import { getRemoteFetchConfigResourceEndpoints } from "@wso2is/admin.remote-repo import { getRolesResourceEndpoints } from "@wso2is/admin.roles.v2/configs/endpoints"; import { getSecretsManagementEndpoints } from "@wso2is/admin.secrets.v1/configs/endpoints"; import { getServerConfigurationsResourceEndpoints } from "@wso2is/admin.server-configurations.v1"; +import { getSMSProvidersResourceEndpoints } from "@wso2is/admin.sms-providers.v1/configs/endpoints"; import { getExtensionTemplatesEndpoints } from "@wso2is/admin.template-core.v1/configs/endpoints"; import { getTenantResourceEndpoints } from "@wso2is/admin.tenants.v1/configs/endpoints"; import { getUsersResourceEndpoints } from "@wso2is/admin.users.v1/configs/endpoints"; @@ -266,6 +267,7 @@ export class Config { ...getExtensionTemplatesEndpoints(this.resolveServerHost()), ...getApplicationTemplatesResourcesEndpoints(this.resolveServerHost()), ...getActionsResourceEndpoints(this.resolveServerHost()), + ...getSMSProvidersResourceEndpoints(this.resolveServerHost()), CORSOrigins: `${ this.getDeploymentConfig()?.serverHost }/api/server/v1/cors/origins`, // TODO: Remove this endpoint and use ID token to get the details me: `${ this.getDeploymentConfig()?.serverHost }/scim2/Me`, diff --git a/features/admin.core.v1/models/config.ts b/features/admin.core.v1/models/config.ts index 4f2bb5ce693..f6b68a2ebf0 100644 --- a/features/admin.core.v1/models/config.ts +++ b/features/admin.core.v1/models/config.ts @@ -34,6 +34,7 @@ import { OrganizationResourceEndpointsInterface } from "@wso2is/admin.organizati import { RolesResourceEndpointsInterface } from "@wso2is/admin.roles.v2/models/endpoints"; import { SecretsManagementEndpoints } from "@wso2is/admin.secrets.v1/models/endpoints"; import { ServerConfigurationsResourceEndpointsInterface } from "@wso2is/admin.server-configurations.v1"; +import { SMSProvidersResourceEndpointsInterface } from "@wso2is/admin.sms-providers.v1/models/endpoints"; import { ExtensionTemplatesEndpointsInterface } from "@wso2is/admin.template-core.v1/models/endpoints"; import { TenantResourceEndpointsInterface } from "@wso2is/admin.tenants.v1/models/endpoints"; import { UsersResourceEndpointsInterface } from "@wso2is/admin.users.v1/models/endpoints"; @@ -541,7 +542,8 @@ export interface ServiceResourceEndpointsInterface extends ClaimResourceEndpoint ConsoleSettingsResourceEndpointsInterface, ExtensionTemplatesEndpointsInterface, ApplicationsTemplatesEndpointsInterface, - ActionsResourceEndpointsInterface { + ActionsResourceEndpointsInterface, + SMSProvidersResourceEndpointsInterface { CORSOrigins: string; // TODO: Remove this endpoint and use ID token to get the details diff --git a/features/admin.core.v1/store/reducers/config.ts b/features/admin.core.v1/store/reducers/config.ts index d87ee6379a3..eb0e4494efb 100644 --- a/features/admin.core.v1/store/reducers/config.ts +++ b/features/admin.core.v1/store/reducers/config.ts @@ -152,6 +152,8 @@ export const commonConfigReducerInitialState: CommonConfigReducerStateInterface< selfSignUp: "", serverConfigurations: "", serverSupportedSchemas: "", + smsPublisher: "", + smsSender: "", tenantAssociationApi: "", tenantManagementApi: "", tenantSubscriptionApi: "", diff --git a/features/admin.extensions.v1/configs/endpoints.ts b/features/admin.extensions.v1/configs/endpoints.ts index 4e7a78df406..7d51a3eac82 100644 --- a/features/admin.extensions.v1/configs/endpoints.ts +++ b/features/admin.extensions.v1/configs/endpoints.ts @@ -41,11 +41,9 @@ export const getExtendedFeatureResourceEndpoints = (serverHost: string, eventsEndpoint: `${ serverHost }/api/event-configurations/v1/events`, inviteEndpoint: `${ serverHost }/api/asgardeo-guest/v1/users/invite`, inviteLinkEndpoint: "/api/users/v1/offline-invite-link", - notificationSendersEndPoint: `${ serverHost }/api/server/v1/notification-senders`, organizationEndpoint: `${ serverHost }/api/asgardeo-enterprise-login/v1/business-user-login/{organization}`, organizationPatchEndpoint: `${ serverHost }/api/asgardeo-enterprise-login/v1/business-user-login`, resendEndpoint: `${ serverHost }/api/asgardeo-guest/v1/users/invite/{}/resend`, - smsProviderEndpoint: `${ serverHost }/api/server/v1/notification-senders/sms`, userEndpoint: `${ serverHost }/api/asgardeo-guest/v1/users`, userStoreAgentConnection: `${ serverHost }/api/onprem-userstore/v1/connection`, userStoreAgentToken: `${ serverHost }/api/onprem-userstore/v1/token` diff --git a/features/admin.extensions.v1/configs/models/endpoints.ts b/features/admin.extensions.v1/configs/models/endpoints.ts index 91084a0150b..b96fa9e492a 100644 --- a/features/admin.extensions.v1/configs/models/endpoints.ts +++ b/features/admin.extensions.v1/configs/models/endpoints.ts @@ -54,11 +54,6 @@ export interface ExtendedFeatureResourceEndpointsInterface { */ emailProviderEndpoint : string; - /** - * SMS Publishing API endpoint. - */ - smsProviderEndpoint : string; - /** * Event Publishing API endpoint. */ @@ -69,11 +64,6 @@ export interface ExtendedFeatureResourceEndpointsInterface { */ choreoEventingEndpoint : string; - /** - * Notification senders API endpoint. - */ - notificationSendersEndPoint: string; - /** * Authorization Service API endpoint. */ diff --git a/features/admin.sms-providers.v1/api/add-sms-publisher.ts b/features/admin.sms-providers.v1/api/add-sms-publisher.ts index fc1bbc5af6a..10869514f9d 100644 --- a/features/admin.sms-providers.v1/api/add-sms-publisher.ts +++ b/features/admin.sms-providers.v1/api/add-sms-publisher.ts @@ -56,7 +56,7 @@ const addSMSPublisher = (): Promise => { "Content-Type": "application/json" }, method: HttpMethods.POST, - url: store.getState().config.endpoints.notificationSendersEndPoint + "/sms" + url: store.getState().config.endpoints.smsSender }; return httpClient(requestConfig) diff --git a/features/admin.sms-providers.v1/api/delete-sms-publisher.ts b/features/admin.sms-providers.v1/api/delete-sms-publisher.ts index d5f5d5dc78a..5ea79b87c97 100644 --- a/features/admin.sms-providers.v1/api/delete-sms-publisher.ts +++ b/features/admin.sms-providers.v1/api/delete-sms-publisher.ts @@ -40,7 +40,7 @@ const deleteSMSPublisher = (): Promise => { "Content-Type": "application/json" }, method: HttpMethods.DELETE, - url: store.getState().config.endpoints.notificationSendersEndPoint + "/sms/SMSPublisher" + url: store.getState().config.endpoints.smsPublisher }; return httpClient(requestConfig) diff --git a/features/admin.sms-providers.v1/api/sms-provider.ts b/features/admin.sms-providers.v1/api/sms-provider.ts index 55bd4f70296..31e5ca0ea35 100644 --- a/features/admin.sms-providers.v1/api/sms-provider.ts +++ b/features/admin.sms-providers.v1/api/sms-provider.ts @@ -49,7 +49,7 @@ export const useSMSProviders = (requestConfig); @@ -74,7 +74,7 @@ export const createSMSProvider = ( "Content-Type": "application/json" }, method: HttpMethods.POST, - url: store.getState().config.endpoints.smsProviderEndpoint + url: store.getState().config.endpoints.smsSender }; return httpClient(requestConfig) @@ -113,7 +113,7 @@ export const updateSMSProvider = ( "Content-Type": "application/json" }, method: HttpMethods.PUT, - url: store.getState().config.endpoints.smsProviderEndpoint + "/SMSPublisher" + url: store.getState().config.endpoints.smsPublisher }; return httpClient(requestConfig) @@ -148,7 +148,7 @@ export const deleteSMSProviders = (): Promise = "Content-Type": "application/json" }, method: HttpMethods.DELETE, - url: store.getState().config.endpoints.smsProviderEndpoint + "/SMSPublisher" + url: store.getState().config.endpoints.smsPublisher }; return httpClient(requestConfig) diff --git a/features/admin.sms-providers.v1/configs/endpoints.ts b/features/admin.sms-providers.v1/configs/endpoints.ts new file mode 100644 index 00000000000..8ce9526f2bc --- /dev/null +++ b/features/admin.sms-providers.v1/configs/endpoints.ts @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { SMSProvidersResourceEndpointsInterface } from "../models/endpoints"; + +/** + * Get the resource endpoints for the SMS Providers feature. + * + * @param serverHost - Server Host. + * @returns Endpoint URLs. + */ +export const getSMSProvidersResourceEndpoints = (serverHost: string): SMSProvidersResourceEndpointsInterface => { + return { + smsPublisher: `${ serverHost }/api/server/v1/notification-senders/sms/SMSPublisher`, + smsSender: `${ serverHost }/api/server/v1/notification-senders/sms` + }; +}; diff --git a/features/admin.sms-providers.v1/models/endpoints.ts b/features/admin.sms-providers.v1/models/endpoints.ts new file mode 100644 index 00000000000..9524325c944 --- /dev/null +++ b/features/admin.sms-providers.v1/models/endpoints.ts @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2022-2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * Interface for the SMS Providers feature resource endpoints. + */ +export interface SMSProvidersResourceEndpointsInterface { + /** + * Endpoint for the SMS Publisher. + */ + smsPublisher: string; + /** + * Endpoint for the SMS Sender. + */ + smsSender: string; +}