@polyguard/sdk 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sdk.esm.js CHANGED
@@ -10980,7 +10980,7 @@ function handleWebSocketMessage(event, ctx) {
10980
10980
  return;
10981
10981
  }
10982
10982
  if (data.jwt) {
10983
- const redirectUrl = data.redirect_url;
10983
+ const redirectUrl = data.jwt.redirect_url;
10984
10984
  const { sidebarUrl, link_uuid } = ctx;
10985
10985
  if (sidebarUrl && redirectUrl) {
10986
10986
  const hasMsftSession = document.cookie.includes("pg_msft_session");
package/dist/sdk.js CHANGED
@@ -11013,7 +11013,7 @@ var Polyguard = (() => {
11013
11013
  return;
11014
11014
  }
11015
11015
  if (data.jwt) {
11016
- const redirectUrl = data.redirect_url;
11016
+ const redirectUrl = data.jwt.redirect_url;
11017
11017
  const { sidebarUrl, link_uuid } = ctx;
11018
11018
  if (sidebarUrl && redirectUrl) {
11019
11019
  const hasMsftSession = document.cookie.includes("pg_msft_session");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polyguard/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "main": "dist/sdk.esm.js",
6
6
  "module": "dist/sdk.esm.js",
@@ -159,9 +159,9 @@ describe('sidebarUrl feature', () => {
159
159
  link_uuid: 'link-abc',
160
160
  });
161
161
  document.body.innerHTML = '<div id="test-target"></div>';
162
- const fakeJwt = buildFakeJwt({ redirect_url: 'https://teams.microsoft.com/meet/123' });
162
+ const jwtClaims = { redirect_url: 'https://teams.microsoft.com/meet/123' };
163
163
  const { promise, ws } = await startVerifyAndGetWs(client, 'test-target');
164
- ws.simulateMessage({ jwt: fakeJwt, redirect_url: 'https://teams.microsoft.com/meet/123' });
164
+ ws.simulateMessage({ jwt: jwtClaims });
165
165
  await promise;
166
166
  expect(window.location.assign).toHaveBeenCalledWith('https://teams.microsoft.com/meet/123');
167
167
  });
@@ -174,9 +174,9 @@ describe('sidebarUrl feature', () => {
174
174
  link_uuid: 'link-abc',
175
175
  });
176
176
  document.body.innerHTML = '<div id="test-target"></div>';
177
- const fakeJwt = buildFakeJwt({ redirect_url: 'https://teams.microsoft.com/meet/123' });
177
+ const jwtClaims = { redirect_url: 'https://teams.microsoft.com/meet/123' };
178
178
  const { promise, ws } = await startVerifyAndGetWs(client, 'test-target');
179
- ws.simulateMessage({ jwt: fakeJwt, redirect_url: 'https://teams.microsoft.com/meet/123' });
179
+ ws.simulateMessage({ jwt: jwtClaims });
180
180
  await promise;
181
181
  expect(document.querySelector('#polyguard-join-meeting')).toBeNull();
182
182
  });
@@ -191,9 +191,9 @@ describe('sidebarUrl feature', () => {
191
191
  link_uuid: 'link-abc',
192
192
  });
193
193
  document.body.innerHTML = '<div id="test-target"></div>';
194
- const fakeJwt = buildFakeJwt({ redirect_url: 'https://teams.microsoft.com/meet/123' });
194
+ const jwtClaims = { redirect_url: 'https://teams.microsoft.com/meet/123' };
195
195
  const { promise, ws } = await startVerifyAndGetWs(client, 'test-target');
196
- ws.simulateMessage({ jwt: fakeJwt, redirect_url: 'https://teams.microsoft.com/meet/123' });
196
+ ws.simulateMessage({ jwt: jwtClaims });
197
197
  // Should not have redirected yet
198
198
  expect(window.location.assign).not.toHaveBeenCalled();
199
199
  // Should show join button
@@ -214,9 +214,9 @@ describe('sidebarUrl feature', () => {
214
214
  link_uuid: 'link-abc',
215
215
  });
216
216
  document.body.innerHTML = '<div id="test-target"></div>';
217
- const fakeJwt = buildFakeJwt({ redirect_url: 'https://teams.microsoft.com/meet/123' });
217
+ const jwtClaims = { redirect_url: 'https://teams.microsoft.com/meet/123' };
218
218
  const { promise, ws } = await startVerifyAndGetWs(client, 'test-target');
219
- ws.simulateMessage({ jwt: fakeJwt, redirect_url: 'https://teams.microsoft.com/meet/123' });
219
+ ws.simulateMessage({ jwt: jwtClaims });
220
220
  const btn = document.querySelector('#polyguard-join-meeting');
221
221
  btn.click();
222
222
  await promise;
@@ -236,9 +236,9 @@ describe('sidebarUrl feature', () => {
236
236
  link_uuid: 'link-abc',
237
237
  });
238
238
  document.body.innerHTML = '<div id="test-target"></div>';
239
- const fakeJwt = buildFakeJwt({ redirect_url: 'https://teams.microsoft.com/meet/123' });
239
+ const jwtClaims = { redirect_url: 'https://teams.microsoft.com/meet/123' };
240
240
  const { promise, ws } = await startVerifyAndGetWs(client, 'test-target');
241
- ws.simulateMessage({ jwt: fakeJwt, redirect_url: 'https://teams.microsoft.com/meet/123' });
241
+ ws.simulateMessage({ jwt: jwtClaims });
242
242
  document.querySelector('#polyguard-join-meeting').click();
243
243
  await promise;
244
244
  expect(window.location.assign).toHaveBeenCalledWith('https://teams.microsoft.com/meet/123');
@@ -253,12 +253,12 @@ describe('sidebarUrl feature', () => {
253
253
  sidebarUrl: 'https://teams.polyguard.ai/ms-teams/sidebar-standalone',
254
254
  link_uuid: 'link-abc',
255
255
  });
256
- const fakeJwt = buildFakeJwt({ confirmation_code: 'ABC123' });
256
+ const jwtClaims = { confirmation_code: 'ABC123' };
257
257
  const { promise, ws } = await startVerifyAndGetWs(client);
258
- // No redirect_url in the message data
259
- ws.simulateMessage({ jwt: fakeJwt });
258
+ // No redirect_url in the JWT claims
259
+ ws.simulateMessage({ jwt: jwtClaims });
260
260
  const result = await promise;
261
- expect(result).toBe(fakeJwt);
261
+ expect(result).toEqual(jwtClaims);
262
262
  expect(window.location.assign).not.toHaveBeenCalled();
263
263
  });
264
264
  });
@@ -54,7 +54,7 @@ export function handleWebSocketMessage(event, ctx) {
54
54
  }
55
55
 
56
56
  if (data.jwt) {
57
- const redirectUrl = data.redirect_url;
57
+ const redirectUrl = data.jwt.redirect_url;
58
58
  const { sidebarUrl, link_uuid } = ctx;
59
59
 
60
60
  // When sidebarUrl is configured and the server provides a redirect_url,