@microsoft/teams-js 2.24.0-beta.1 → 2.24.0

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/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.23.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.24.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.23.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-08XJvrutoSVYTA8PQeUgetTKn8B7JE73C5BdAfWnHZ5WnSFFQO6g1FGmSqxsrAzb"
48
+ src="https://res.cdn.office.net/teams-js/2.24.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-79NK4sbfVpgLoDFqyfj18/S1Uj8jhLBeRGvKO1Cqw5634RznExQ90myY/qV/0gsN"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.23.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.24.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -4358,13 +4358,22 @@ export interface ResumeContext {
4358
4358
  /**
4359
4359
  * The content URL that is requested to be loaded
4360
4360
  */
4361
- contentUrl: string;
4361
+ contentUrl: URL;
4362
4362
  }
4363
4363
  /**
4364
4364
  * @deprecated
4365
4365
  * As of 2.14.1, please use {@link ResumeContext} instead.
4366
4366
  */
4367
- export type LoadContext = ResumeContext;
4367
+ export interface LoadContext {
4368
+ /**
4369
+ * The entity that is requested to be loaded
4370
+ */
4371
+ entityId: string;
4372
+ /**
4373
+ * The content URL that is requested to be loaded
4374
+ */
4375
+ contentUrl: string;
4376
+ }
4368
4377
  /** Represents information about a frame within a tab or dialog module. */
4369
4378
  export interface FrameInfo {
4370
4379
  /**
@@ -5074,7 +5083,7 @@ export namespace app {
5074
5083
  *
5075
5084
  * @returns void
5076
5085
  */
5077
- type registerBeforeSuspendOrTerminateHandlerFunctionType = () => void;
5086
+ type registerBeforeSuspendOrTerminateHandlerFunctionType = () => Promise<void>;
5078
5087
  /**
5079
5088
  * Registers a handler to be called before the page is suspended or terminated. Once a user navigates away from an app,
5080
5089
  * the handler will be invoked. App developers can use this handler to save unsaved data, pause sync calls etc.
@@ -3395,7 +3395,7 @@ const _minRuntimeConfigToUninitialize = {
3395
3395
  * @hidden
3396
3396
  * Package version.
3397
3397
  */
3398
- const version = "2.24.0-beta.1";
3398
+ const version = "2.24.0";
3399
3399
 
3400
3400
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3401
3401
 
@@ -6196,6 +6196,15 @@ var pages;
6196
6196
 
6197
6197
  ;// CONCATENATED MODULE: ./src/internal/handlers.ts
6198
6198
  /* eslint-disable @typescript-eslint/ban-types */
6199
+ var handlers_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
6200
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6201
+ return new (P || (P = Promise))(function (resolve, reject) {
6202
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6203
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6204
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
6205
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
6206
+ });
6207
+ };
6199
6208
 
6200
6209
 
6201
6210
 
@@ -6364,17 +6373,31 @@ function handlers_registerOnLoadHandler(apiVersionTag, handler) {
6364
6373
  * @internal
6365
6374
  * Limited to Microsoft-internal use
6366
6375
  */
6367
- function handleLoad(context) {
6376
+ function handleLoad(loadContext) {
6377
+ const resumeContext = convertToResumeContext(loadContext);
6368
6378
  if (HandlersPrivate.resumeHandler) {
6369
- HandlersPrivate.resumeHandler(context);
6379
+ HandlersPrivate.resumeHandler(resumeContext);
6380
+ if (Communication.childWindow) {
6381
+ sendMessageEventToChild('load', [resumeContext]);
6382
+ }
6370
6383
  }
6371
6384
  else if (HandlersPrivate.loadHandler) {
6372
- HandlersPrivate.loadHandler(context);
6373
- }
6374
- if (Communication.childWindow) {
6375
- sendMessageEventToChild('load', [context]);
6385
+ HandlersPrivate.loadHandler(loadContext);
6386
+ if (Communication.childWindow) {
6387
+ sendMessageEventToChild('load', [loadContext]);
6388
+ }
6376
6389
  }
6377
6390
  }
6391
+ /**
6392
+ * @internal
6393
+ * Limited to Microsoft-internal use
6394
+ */
6395
+ function convertToResumeContext(context) {
6396
+ return {
6397
+ entityId: context.entityId,
6398
+ contentUrl: new URL(context.contentUrl),
6399
+ };
6400
+ }
6378
6401
  /**
6379
6402
  * @internal
6380
6403
  * Limited to Microsoft-internal use
@@ -6390,26 +6413,28 @@ function handlers_registerBeforeUnloadHandler(apiVersionTag, handler) {
6390
6413
  * Limited to Microsoft-internal use
6391
6414
  */
6392
6415
  function handleBeforeUnload() {
6393
- const readyToUnload = () => {
6394
- sendMessageToParent(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "handleBeforeUnload" /* ApiName.HandleBeforeUnload */), 'readyToUnload', []);
6395
- };
6396
- if (HandlersPrivate.beforeSuspendOrTerminateHandler) {
6397
- HandlersPrivate.beforeSuspendOrTerminateHandler();
6398
- if (Communication.childWindow) {
6399
- sendMessageEventToChild('beforeUnload');
6400
- }
6401
- else {
6402
- readyToUnload();
6403
- }
6404
- }
6405
- else if (!HandlersPrivate.beforeUnloadHandler || !HandlersPrivate.beforeUnloadHandler(readyToUnload)) {
6406
- if (Communication.childWindow) {
6407
- sendMessageEventToChild('beforeUnload');
6416
+ return handlers_awaiter(this, void 0, void 0, function* () {
6417
+ const readyToUnload = () => {
6418
+ sendMessageToParent(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "handleBeforeUnload" /* ApiName.HandleBeforeUnload */), 'readyToUnload', []);
6419
+ };
6420
+ if (HandlersPrivate.beforeSuspendOrTerminateHandler) {
6421
+ yield HandlersPrivate.beforeSuspendOrTerminateHandler();
6422
+ if (Communication.childWindow) {
6423
+ sendMessageEventToChild('beforeUnload');
6424
+ }
6425
+ else {
6426
+ readyToUnload();
6427
+ }
6408
6428
  }
6409
- else {
6410
- readyToUnload();
6429
+ else if (!HandlersPrivate.beforeUnloadHandler || !HandlersPrivate.beforeUnloadHandler(readyToUnload)) {
6430
+ if (Communication.childWindow) {
6431
+ sendMessageEventToChild('beforeUnload');
6432
+ }
6433
+ else {
6434
+ readyToUnload();
6435
+ }
6411
6436
  }
6412
- }
6437
+ });
6413
6438
  }
6414
6439
  /**
6415
6440
  * @internal