diff --git a/apps/client/src/utils/api.ts b/apps/client/src/utils/api.ts index b7c36ff6..eda075c9 100644 --- a/apps/client/src/utils/api.ts +++ b/apps/client/src/utils/api.ts @@ -106,13 +106,15 @@ export function getCredentialGroupJoinUrl( export function getMultipleCredentialsGroupJoinUrl( dashboardUrl: DashboardUrl, groupId: string, - commitment: string + commitment: string, + redirectUri?: string ): string | null { try { return api.getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) } catch (error: any) { console.error(error) diff --git a/apps/docs/docs/api-sdk.md b/apps/docs/docs/api-sdk.md index 9bd13bdf..2c376931 100644 --- a/apps/docs/docs/api-sdk.md +++ b/apps/docs/docs/api-sdk.md @@ -494,10 +494,12 @@ import { DashboardUrl } from "@bandada/api-sdk" const dashboardUrl = DashboardUrl.DEV const groupId = "10402173435763029700781503965100" const commitment = "1" +const redirectUri = "http://localhost:3003" const url = apiSdk.getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) ``` \ No newline at end of file diff --git a/apps/docs/docs/tutorials/api-sdk/groups.md b/apps/docs/docs/tutorials/api-sdk/groups.md index 181b9384..b010aa05 100644 --- a/apps/docs/docs/tutorials/api-sdk/groups.md +++ b/apps/docs/docs/tutorials/api-sdk/groups.md @@ -273,11 +273,13 @@ import { DashboardUrl } from "@bandada/api-sdk" const dashboardUrl = DashboardUrl.DEV const groupId = "your-group-id" const commitment = "commitment-value" +const redirectUri = "http://localhost:3003" const url = apiSdk.getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) ``` diff --git a/libs/api-sdk/README.md b/libs/api-sdk/README.md index 21e01288..d74ad09d 100644 --- a/libs/api-sdk/README.md +++ b/libs/api-sdk/README.md @@ -517,10 +517,12 @@ import { DashboardUrl } from "@bandada/api-sdk" const dashboardUrl = DashboardUrl.DEV const groupId = "10402173435763029700781503965100" const commitment = "1" +const redirectUri = "http://localhost:3003" const url = apiSdk.getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) ``` diff --git a/libs/api-sdk/src/apiSdk.ts b/libs/api-sdk/src/apiSdk.ts index 822564dc..5685e299 100644 --- a/libs/api-sdk/src/apiSdk.ts +++ b/libs/api-sdk/src/apiSdk.ts @@ -421,17 +421,20 @@ export default class ApiSdk { * @param dashboardUrl Dashboard base url. * @param groupId Group id. * @param commitment Identity commitment. + * @param redirectUri Redirect uri. * @returns Url string. */ getMultipleCredentialsGroupJoinUrl( dashboardUrl: DashboardUrl, groupId: string, - commitment: string + commitment: string, + redirectUri?: string ): string { const url = getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) return url diff --git a/libs/api-sdk/src/groups.ts b/libs/api-sdk/src/groups.ts index 4cc9481f..f34e6aa7 100644 --- a/libs/api-sdk/src/groups.ts +++ b/libs/api-sdk/src/groups.ts @@ -458,14 +458,20 @@ export function getCredentialGroupJoinUrl( * @param dashboardUrl Dashboard url. * @param groupId Group id. * @param commitment Identity commitment. + * @param redirectUri Redirect uri. * @returns Url string. */ export function getMultipleCredentialsGroupJoinUrl( dashboardUrl: DashboardUrl, groupId: string, - commitment: string + commitment: string, + redirectUri?: string ): string { - const resultUrl = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple` + let resultUrl = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple` + + if (redirectUri) { + resultUrl += `&redirect_uri=${redirectUri}?redirect=true` + } return resultUrl } diff --git a/libs/api-sdk/src/index.test.ts b/libs/api-sdk/src/index.test.ts index 6d3203d8..c4370b0c 100644 --- a/libs/api-sdk/src/index.test.ts +++ b/libs/api-sdk/src/index.test.ts @@ -863,15 +863,17 @@ describe("Bandada API SDK", () => { const dashboardUrl = DashboardUrl.DEV const groupId = "10402173435763029700781503965100" const commitment = "1" + const redirectUri = "http://localhost:3003" const apiSdk: ApiSdk = new ApiSdk(SupportedUrl.DEV) const res = apiSdk.getMultipleCredentialsGroupJoinUrl( dashboardUrl, groupId, - commitment + commitment, + redirectUri ) - const url = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple` + const url = `${dashboardUrl}/credentials?group=${groupId}&member=${commitment}&type=multiple&redirect_uri=${redirectUri}?redirect=true` expect(res).toBe(url) })