@microsoft/teams-js 2.1.0-beta.0 → 2.1.0-beta.3

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.
@@ -2313,6 +2313,9 @@ export interface BotUrlDialogInfo extends UrlDialogInfo {
2313
2313
  */
2314
2314
  completionBotId: string;
2315
2315
  }
2316
+ /**
2317
+ * Data structure to describe dialog information
2318
+ */
2316
2319
  export interface DialogInfo {
2317
2320
  /**
2318
2321
  * The url to be rendered in the webview/iframe.
@@ -4481,7 +4484,7 @@ export namespace meeting {
4481
4484
  function registerSpeakingStateChangeHandler(handler: (speakingState: ISpeakingState) => void): void;
4482
4485
  /**
4483
4486
  * Registers a handler for changes to the selfParticipant's (current user's) raiseHandState. If the selfParticipant raises their hand, isHandRaised
4484
- * will be true. By default and if the selfParticipant hand is lowered, isHandRaised will be false. This API will return {@link RaiseHandStateChangedEvent}
4487
+ * will be true. By default and if the selfParticipant hand is lowered, isHandRaised will be false. This API will return {@link RaiseHandStateChangedEventData}
4485
4488
  * that will have the raiseHandState or an error object. Only one handler can be registered at a time. A subsequent registration
4486
4489
  * replaces an existing registration.
4487
4490
  *
@@ -5401,7 +5404,7 @@ export namespace settings {
5401
5404
  function setValidityState(validityState: boolean): void;
5402
5405
  /**
5403
5406
  * @deprecated
5404
- * As of 2.0.0, please use {@link pages.config.getConfig pages.config.getConfig(): Promise\<Config\>} instead.
5407
+ * As of 2.0.0, please use {@link pages.getConfig pages.getConfig(): Promise\<InstanceConfig\>} instead.
5405
5408
  *
5406
5409
  * Gets the settings for the current instance.
5407
5410
  *
@@ -5455,8 +5458,9 @@ export namespace settings {
5455
5458
  export namespace tasks {
5456
5459
  /**
5457
5460
  * @deprecated
5458
- * As of 2.0.0, please use {@link dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): PostMessageChannel} for url based dialogs
5459
- * and {@link dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): PostMessageChannel} for bot based dialogs.
5461
+ * As of 2.0.0, please use {@link dialog.open dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
5462
+ * and {@link dialog.bot.open dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot based dialogs. In Teams,
5463
+ * this function can be used for adaptive card based dialogs. Support for adaptive card based dialogs is coming to other hosts in the future.
5460
5464
  *
5461
5465
  * Allows an app to open the task module.
5462
5466
  *
@@ -5475,7 +5479,7 @@ export namespace tasks {
5475
5479
  function updateTask(taskInfo: TaskInfo): void;
5476
5480
  /**
5477
5481
  * @deprecated
5478
- * As of 2.0.0, please use {@link dialog.submit dialog.submit(result?: string | object, appIds?: string | string[]): void} instead.
5482
+ * As of 2.0.0, please use {@link dialog.submit} instead.
5479
5483
  *
5480
5484
  * Submit the task module.
5481
5485
  *
@@ -5483,8 +5487,24 @@ export namespace tasks {
5483
5487
  * @param appIds - Helps to validate that the call originates from the same appId as the one that invoked the task module
5484
5488
  */
5485
5489
  function submitTask(result?: string | object, appIds?: string | string[]): void;
5490
+ /**
5491
+ * Converts {@link TaskInfo} to {@link UrlDialogInfo}
5492
+ * @param taskInfo - TaskInfo object to convert
5493
+ * @returns - Converted UrlDialogInfo object
5494
+ */
5486
5495
  function getUrlDialogInfoFromTaskInfo(taskInfo: TaskInfo): UrlDialogInfo;
5496
+ /**
5497
+ * Converts {@link TaskInfo} to {@link BotUrlDialogInfo}
5498
+ * @param taskInfo - TaskInfo object to convert
5499
+ * @returns - converted BotUrlDialogInfo object
5500
+ */
5487
5501
  function getBotUrlDialogInfoFromTaskInfo(taskInfo: TaskInfo): BotUrlDialogInfo;
5502
+ /**
5503
+ * Sets the height and width of the {@link TaskInfo} object to the original height and width, if initially specified,
5504
+ * otherwise uses the height and width values corresponding to {@link TaskModuleDimension.Small}
5505
+ * @param taskInfo TaskInfo object from which to extract size info, if specified
5506
+ * @returns TaskInfo with height and width specified
5507
+ */
5488
5508
  function getDefaultSizeIfNotProvided(taskInfo: TaskInfo): TaskInfo;
5489
5509
  }
5490
5510
 
@@ -1122,7 +1122,7 @@ __webpack_require__.d(__webpack_exports__, {
1122
1122
  });
1123
1123
 
1124
1124
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1125
- var version = "2.1.0-beta.0";
1125
+ var version = "2.1.0-beta.3";
1126
1126
  /**
1127
1127
  * @hidden
1128
1128
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -2581,7 +2581,7 @@ var dialog;
2581
2581
  }
2582
2582
  var dialogInfo = getDialogInfoFromUrlDialogInfo(urlDialogInfo);
2583
2583
  sendMessageToParent('tasks.startTask', [dialogInfo], function (err, result) {
2584
- submitHandler({ err: err, result: result });
2584
+ submitHandler === null || submitHandler === void 0 ? void 0 : submitHandler({ err: err, result: result });
2585
2585
  removeHandler('messageForParent');
2586
2586
  });
2587
2587
  }
@@ -2720,7 +2720,7 @@ var dialog;
2720
2720
  }
2721
2721
  var dialogInfo = getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo);
2722
2722
  sendMessageToParent('tasks.startTask', [dialogInfo], function (err, result) {
2723
- submitHandler({ err: err, result: result });
2723
+ submitHandler === null || submitHandler === void 0 ? void 0 : submitHandler({ err: err, result: result });
2724
2724
  removeHandler('messageForParent');
2725
2725
  });
2726
2726
  }
@@ -4052,6 +4052,10 @@ function removeHandler(name) {
4052
4052
  delete HandlersPrivate.handlers[name];
4053
4053
  }
4054
4054
  /** @internal */
4055
+ function doesHandlerExist(name) {
4056
+ return HandlersPrivate.handlers[name] != null;
4057
+ }
4058
+ /** @internal */
4055
4059
  function handlers_registerOnThemeChangeHandler(handler) {
4056
4060
  HandlersPrivate.themeChangeHandler = handler;
4057
4061
  handler && sendMessageToParent('registerHandler', ['themeChange']);
@@ -4788,7 +4792,7 @@ function createTeamsDeepLinkForAppInstallDialog(appId) {
4788
4792
  if (!appId) {
4789
4793
  throw new Error('App ID must be set when creating an app install dialog deep link');
4790
4794
  }
4791
- return teamsDeepLinkProtocol + "://" + teamsDeepLinkHost + teamsDeepLinkUrlPathForAppInstall + encodeURIComponent(appId) + "/";
4795
+ return teamsDeepLinkProtocol + "://" + teamsDeepLinkHost + teamsDeepLinkUrlPathForAppInstall + encodeURIComponent(appId);
4792
4796
  }
4793
4797
 
4794
4798
  ;// CONCATENATED MODULE: ./src/public/appInstallDialog.ts
@@ -5934,7 +5938,7 @@ var meeting;
5934
5938
  meeting.registerSpeakingStateChangeHandler = registerSpeakingStateChangeHandler;
5935
5939
  /**
5936
5940
  * Registers a handler for changes to the selfParticipant's (current user's) raiseHandState. If the selfParticipant raises their hand, isHandRaised
5937
- * will be true. By default and if the selfParticipant hand is lowered, isHandRaised will be false. This API will return {@link RaiseHandStateChangedEvent}
5941
+ * will be true. By default and if the selfParticipant hand is lowered, isHandRaised will be false. This API will return {@link RaiseHandStateChangedEventData}
5938
5942
  * that will have the raiseHandState or an error object. Only one handler can be registered at a time. A subsequent registration
5939
5943
  * replaces an existing registration.
5940
5944
  *
@@ -7090,7 +7094,7 @@ var settings;
7090
7094
  settings.setValidityState = setValidityState;
7091
7095
  /**
7092
7096
  * @deprecated
7093
- * As of 2.0.0, please use {@link pages.config.getConfig pages.config.getConfig(): Promise\<Config\>} instead.
7097
+ * As of 2.0.0, please use {@link pages.getConfig pages.getConfig(): Promise\<InstanceConfig\>} instead.
7094
7098
  *
7095
7099
  * Gets the settings for the current instance.
7096
7100
  *
@@ -7186,8 +7190,9 @@ var tasks;
7186
7190
  (function (tasks) {
7187
7191
  /**
7188
7192
  * @deprecated
7189
- * As of 2.0.0, please use {@link dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): PostMessageChannel} for url based dialogs
7190
- * and {@link dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): PostMessageChannel} for bot based dialogs.
7193
+ * As of 2.0.0, please use {@link dialog.open dialog.open(urlDialogInfo: UrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for url based dialogs
7194
+ * and {@link dialog.bot.open dialog.bot.open(botUrlDialogInfo: BotUrlDialogInfo, submitHandler?: DialogSubmitHandler, messageFromChildHandler?: PostMessageChannel): void} for bot based dialogs. In Teams,
7195
+ * this function can be used for adaptive card based dialogs. Support for adaptive card based dialogs is coming to other hosts in the future.
7191
7196
  *
7192
7197
  * Allows an app to open the task module.
7193
7198
  *
@@ -7195,19 +7200,18 @@ var tasks;
7195
7200
  * @param submitHandler - Handler to call when the task module is completed
7196
7201
  */
7197
7202
  function startTask(taskInfo, submitHandler) {
7203
+ var dialogSubmitHandler = submitHandler
7204
+ ? function (sdkResponse) { return submitHandler(sdkResponse.err, sdkResponse.result); }
7205
+ : undefined;
7198
7206
  if (taskInfo.card !== undefined || taskInfo.url === undefined) {
7199
7207
  ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.meetingStage);
7200
7208
  sendMessageToParent('tasks.startTask', [taskInfo], submitHandler);
7201
7209
  }
7202
7210
  else if (taskInfo.completionBotId !== undefined) {
7203
- dialog.bot.open(getBotUrlDialogInfoFromTaskInfo(taskInfo), function (sdkResponse) {
7204
- return submitHandler(sdkResponse.err, sdkResponse.result);
7205
- });
7211
+ dialog.bot.open(getBotUrlDialogInfoFromTaskInfo(taskInfo), dialogSubmitHandler);
7206
7212
  }
7207
7213
  else {
7208
- dialog.open(getUrlDialogInfoFromTaskInfo(taskInfo), function (sdkResponse) {
7209
- return submitHandler(sdkResponse.err, sdkResponse.result);
7210
- });
7214
+ dialog.open(getUrlDialogInfoFromTaskInfo(taskInfo), dialogSubmitHandler);
7211
7215
  }
7212
7216
  return new ChildAppWindow();
7213
7217
  }
@@ -7232,7 +7236,7 @@ var tasks;
7232
7236
  tasks.updateTask = updateTask;
7233
7237
  /**
7234
7238
  * @deprecated
7235
- * As of 2.0.0, please use {@link dialog.submit dialog.submit(result?: string | object, appIds?: string | string[]): void} instead.
7239
+ * As of 2.0.0, please use {@link dialog.submit} instead.
7236
7240
  *
7237
7241
  * Submit the task module.
7238
7242
  *
@@ -7243,6 +7247,11 @@ var tasks;
7243
7247
  dialog.submit(result, appIds);
7244
7248
  }
7245
7249
  tasks.submitTask = submitTask;
7250
+ /**
7251
+ * Converts {@link TaskInfo} to {@link UrlDialogInfo}
7252
+ * @param taskInfo - TaskInfo object to convert
7253
+ * @returns - Converted UrlDialogInfo object
7254
+ */
7246
7255
  function getUrlDialogInfoFromTaskInfo(taskInfo) {
7247
7256
  var urldialogInfo = {
7248
7257
  url: taskInfo.url,
@@ -7256,6 +7265,11 @@ var tasks;
7256
7265
  return urldialogInfo;
7257
7266
  }
7258
7267
  tasks.getUrlDialogInfoFromTaskInfo = getUrlDialogInfoFromTaskInfo;
7268
+ /**
7269
+ * Converts {@link TaskInfo} to {@link BotUrlDialogInfo}
7270
+ * @param taskInfo - TaskInfo object to convert
7271
+ * @returns - converted BotUrlDialogInfo object
7272
+ */
7259
7273
  function getBotUrlDialogInfoFromTaskInfo(taskInfo) {
7260
7274
  var botUrldialogInfo = {
7261
7275
  url: taskInfo.url,
@@ -7270,6 +7284,12 @@ var tasks;
7270
7284
  return botUrldialogInfo;
7271
7285
  }
7272
7286
  tasks.getBotUrlDialogInfoFromTaskInfo = getBotUrlDialogInfoFromTaskInfo;
7287
+ /**
7288
+ * Sets the height and width of the {@link TaskInfo} object to the original height and width, if initially specified,
7289
+ * otherwise uses the height and width values corresponding to {@link TaskModuleDimension.Small}
7290
+ * @param taskInfo TaskInfo object from which to extract size info, if specified
7291
+ * @returns TaskInfo with height and width specified
7292
+ */
7273
7293
  function getDefaultSizeIfNotProvided(taskInfo) {
7274
7294
  taskInfo.height = taskInfo.height ? taskInfo.height : TaskModuleDimension.Small;
7275
7295
  taskInfo.width = taskInfo.width ? taskInfo.width : TaskModuleDimension.Small;