From 20000377aa316038bbcc39be8ecb6623b4c2c18d Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:44:03 +0800 Subject: [PATCH 1/3] feat(api-sdk): add redirectUri to getMultipleCredentialsGroupJoinUrl --- libs/api-sdk/src/apiSdk.ts | 7 +++++-- libs/api-sdk/src/groups.ts | 10 ++++++++-- libs/api-sdk/src/index.test.ts | 6 ++++-- 3 files changed, 17 insertions(+), 6 deletions(-) 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) }) From 039bba5d76ef76b9292072b7ed86318c593c1591 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:45:56 +0800 Subject: [PATCH 2/3] feat(client): add redirectUri to getMultipleCredentialsGroupJoinUrl --- apps/client/src/utils/api.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) From 21488ebb036f70d185519c93bf76b3f0b23d9336 Mon Sep 17 00:00:00 2001 From: Han <56923450+waddaboo@users.noreply.github.com> Date: Wed, 11 Dec 2024 23:46:41 +0800 Subject: [PATCH 3/3] docs: update docs to include redirectUri in getMultipleCredentialsGroupJoinUrl --- apps/docs/docs/api-sdk.md | 4 +++- apps/docs/docs/tutorials/api-sdk/groups.md | 4 +++- libs/api-sdk/README.md | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) 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 ) ```