From 15ccb6cdece6f298865aee89906197081b963cac Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 11 Aug 2025 18:23:46 -0400 Subject: [PATCH 1/6] Update useMsTeamsAuth hook --- .../react-core/src/modules/ms-teams/hooks/useMsTeamsAuth.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/react-core/src/modules/ms-teams/hooks/useMsTeamsAuth.ts b/packages/react-core/src/modules/ms-teams/hooks/useMsTeamsAuth.ts index 448bc74a5..d065f3a49 100644 --- a/packages/react-core/src/modules/ms-teams/hooks/useMsTeamsAuth.ts +++ b/packages/react-core/src/modules/ms-teams/hooks/useMsTeamsAuth.ts @@ -42,6 +42,7 @@ function useMsTeamsAuth( channel_id: knockMsTeamsChannelId, public_key: knock.apiKey, user_token: knock.userToken, + branch_slug: knock.branch, }), client_id: graphApiClientId, redirect_uri: authRedirectUri, @@ -53,6 +54,7 @@ function useMsTeamsAuth( knockMsTeamsChannelId, knock.apiKey, knock.userToken, + knock.branch, graphApiClientId, authRedirectUri, ]); From 7a7eb0d190e6e6e4601e6b6e14892d9c34f5f9d0 Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 11 Aug 2025 18:23:53 -0400 Subject: [PATCH 2/6] Update ms-teams-connect-example --- examples/ms-teams-connect-example/pages/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/ms-teams-connect-example/pages/index.tsx b/examples/ms-teams-connect-example/pages/index.tsx index 8b265140b..778a4b882 100644 --- a/examples/ms-teams-connect-example/pages/index.tsx +++ b/examples/ms-teams-connect-example/pages/index.tsx @@ -49,6 +49,7 @@ export default function Home() { user={{ id: user.id }} host={process.env.NEXT_PUBLIC_KNOCK_API_URL} userToken={localStorage.getItem("knock-user-token")!} + branch={process.env.NEXT_PUBLIC_KNOCK_BRANCH} > Date: Mon, 11 Aug 2025 18:24:48 -0400 Subject: [PATCH 3/6] Update .env.sample --- examples/ms-teams-connect-example/.env.sample | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/ms-teams-connect-example/.env.sample b/examples/ms-teams-connect-example/.env.sample index 67fceae59..5453045ac 100644 --- a/examples/ms-teams-connect-example/.env.sample +++ b/examples/ms-teams-connect-example/.env.sample @@ -16,3 +16,5 @@ NEXT_PUBLIC_GRAPH_API_CLIENT_ID= # the MS Teams channel you want to use and you'll find its ID on the page NEXT_PUBLIC_KNOCK_MS_TEAMS_CHANNEL_ID= NEXT_PUBLIC_REDIRECT_URL=http://localhost:3000/ + +NEXT_PUBLIC_KNOCK_BRANCH= From 87873ad81cb9f32ffdee4fe86a1fe0cd15093681 Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 11 Aug 2025 18:25:38 -0400 Subject: [PATCH 4/6] Add changeset --- .changeset/ready-swans-occur.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/ready-swans-occur.md diff --git a/.changeset/ready-swans-occur.md b/.changeset/ready-swans-occur.md new file mode 100644 index 000000000..c7c5a8dc5 --- /dev/null +++ b/.changeset/ready-swans-occur.md @@ -0,0 +1,5 @@ +--- +"ms-teams-connect-example": patch +--- + +Add `NEXT_PUBLIC_KNOCK_BRANCH` env var for specifying branch From 2432fde987e1205a3359d0e6285fa340c2fcb463 Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 11 Aug 2025 18:26:27 -0400 Subject: [PATCH 5/6] Update UTs --- packages/react-core/test/ms-teams/useMsTeamsAuth.test.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/react-core/test/ms-teams/useMsTeamsAuth.test.tsx b/packages/react-core/test/ms-teams/useMsTeamsAuth.test.tsx index d94da4a21..57d038e35 100644 --- a/packages/react-core/test/ms-teams/useMsTeamsAuth.test.tsx +++ b/packages/react-core/test/ms-teams/useMsTeamsAuth.test.tsx @@ -4,6 +4,8 @@ import { beforeAll, beforeEach, describe, expect, test, vi } from "vitest"; import type UseMsTeamsAuth from "../../src/modules/ms-teams/hooks/useMsTeamsAuth"; import { mockMsTeamsContext, mockTranslations } from "../test-utils/mocks"; +const TEST_BRANCH_SLUG = "lorem-ipsum-branch"; + // ----------------------------------------------------------------------------- // Stubs & Mocks // ----------------------------------------------------------------------------- @@ -29,6 +31,7 @@ vi.mock("../../src/modules/core", () => ({ apiKey: "test_api_key", userToken: "test_user_token", host: "https://example.com", + branch: TEST_BRANCH_SLUG, }), })); @@ -75,6 +78,7 @@ describe("useMsTeamsAuth", () => { channel_id: "test_channel_id", public_key: "test_api_key", user_token: "test_user_token", + branch_slug: TEST_BRANCH_SLUG, }); }); From fdf7502f9bd2fef08ce280533f1ad41008daae5f Mon Sep 17 00:00:00 2001 From: Matthew Mikolay Date: Mon, 11 Aug 2025 18:28:40 -0400 Subject: [PATCH 6/6] Add changeset --- .changeset/some-bats-lick.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .changeset/some-bats-lick.md diff --git a/.changeset/some-bats-lick.md b/.changeset/some-bats-lick.md new file mode 100644 index 000000000..79ba6629b --- /dev/null +++ b/.changeset/some-bats-lick.md @@ -0,0 +1,12 @@ +--- +"@knocklabs/react-core": patch +"@knocklabs/react": patch +--- + +Enable use of TeamsKit with branches + +The `useMsTeamsAuth` hook exported by `@knocklabs/react-core` has been updated +so that it works with branches. You can now use either this hook or the +`` component exported by `@knocklabs/react` to test +connecting Microsoft Teams organizations to Knock tenants while working on a +branch.