@microsoft/teams-js 2.0.0-beta.4-dev.9 → 2.0.0-beta.4-dev.12

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.
@@ -751,6 +751,17 @@ export namespace files {
751
751
  * Gets list of downloads for current user
752
752
  * @param callback Callback that will be triggered post downloads load
753
753
  */
754
+ export function getFileDownloads(): Promise<IFileItem[]>;
755
+ /**
756
+ * @hidden
757
+ * Hide from docs
758
+ * ------
759
+ *
760
+ * @deprecated
761
+ * As of 2.0.0-beta.4, please use {@link file.getFileDownloads file.getFileDownloads(): Promise\<IFileItem[]\>} instead.
762
+ * Gets list of downloads for current user
763
+ * @param callback Callback that will be triggered post downloads load
764
+ */
754
765
  export function getFileDownloads(callback: (error?: SdkError, files?: IFileItem[]) => void): void;
755
766
  /**
756
767
  * @hidden
@@ -3059,15 +3070,9 @@ export namespace pages {
3059
3070
  export interface IAppWindow {
3060
3071
  /**
3061
3072
  * Send a message to the AppWindow.
3073
+ *
3062
3074
  * @param message - The message to send
3063
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3064
- */
3065
- postMessage(message: any): Promise<void>;
3066
- /**
3067
- * @deprecated
3068
- * As of 2.0.0-beta.1, please use {@link IAppWindow.postMessage IAppWindow.postMessage(message: any): Promise\<void\>} instead.
3069
- * @param message - The message to send
3070
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3075
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3071
3076
  */
3072
3077
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3073
3078
  /**
@@ -3080,37 +3085,35 @@ export interface IAppWindow {
3080
3085
  }
3081
3086
  export class ChildAppWindow implements IAppWindow {
3082
3087
  /**
3083
- * Send a message to the AppWindow.
3088
+ * Send a message to the ChildAppWindow.
3089
+ *
3084
3090
  * @param message - The message to send
3085
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3091
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3086
3092
  */
3087
- postMessage(message: any): Promise<void>;
3093
+ postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3088
3094
  /**
3089
- * @deprecated
3090
- * As of 2.0.0-beta.1, please use {@link ChildAppWindow.postMessage ChildAppWindow.postMessage(message: any): Promise\<void\>} instead.
3091
- * @param message - The message to send
3092
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3095
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
3096
+ *
3097
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
3098
+ * @param listener - The listener that will be called
3093
3099
  */
3094
- postMessage(message: any, onComplete: (status: boolean, reason?: string) => void): void;
3095
- postMessageHelper(message: any): Promise<void>;
3096
3100
  addEventListener(type: string, listener: (message: any) => void): void;
3097
3101
  }
3098
3102
  export class ParentAppWindow implements IAppWindow {
3099
3103
  static get Instance(): IAppWindow;
3100
3104
  /**
3101
- * Send a message to the AppWindow.
3105
+ * Send a message to the ParentAppWindow.
3106
+ *
3102
3107
  * @param message - The message to send
3103
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3108
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3104
3109
  */
3105
- postMessage(message: any): Promise<void>;
3110
+ postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3106
3111
  /**
3107
- * @deprecated
3108
- * As of 2.0.0-beta.1, please use {@link ParentAppWindow.postMessage ParentAppWindow.postMessage(message: any): Promise\<void\>} instead.
3109
- * @param message - The message to send
3110
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3112
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
3113
+ *
3114
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
3115
+ * @param listener - The listener that will be called
3111
3116
  */
3112
- postMessage(message: any, onComplete: (status: boolean, reason?: string) => void): void;
3113
- postMessageHelper(message: any): Promise<void>;
3114
3117
  addEventListener(type: string, listener: (message: any) => void): void;
3115
3118
  }
3116
3119
 
@@ -4563,7 +4566,19 @@ export namespace stageView {
4563
4566
  *
4564
4567
  * Opens a stage view to display a Teams app
4565
4568
  * @param stageViewParams The parameters to pass into the stage view.
4566
- * @param callback Callback that will be triggered once the stage view is closed.
4569
+ *
4570
+ */
4571
+ function open(stageViewParams: StageViewParams): Promise<void>;
4572
+ /**
4573
+ * @hidden
4574
+ * Feature is under development
4575
+ *
4576
+ * @deprecated
4577
+ * As of 2.0.0-beta.3, please use {@link stageView.open stageView.open(): Promise\<void\>} instead.
4578
+ *
4579
+ * Opens a stage view to display a Teams app
4580
+ * @param stageViewParams The parameters to pass into the stage view.
4581
+ * Optional; @param callback Callback that will be triggered once the stage view is closed.
4567
4582
  * The callback takes as an argument an SdkError in case something happened (i.e.
4568
4583
  * no permissions to execute the API)
4569
4584
  */
@@ -1121,7 +1121,7 @@ __webpack_require__.d(__webpack_exports__, {
1121
1121
  });
1122
1122
 
1123
1123
  ;// CONCATENATED MODULE: ./src/internal/constants.ts
1124
- var version = "2.0.0-beta.4-dev.9";
1124
+ var version = "2.0.0-beta.4-dev.12";
1125
1125
  /**
1126
1126
  * @hidden
1127
1127
  * The client version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
@@ -4253,30 +4253,26 @@ var appInstallDialog;
4253
4253
 
4254
4254
 
4255
4255
 
4256
+
4256
4257
  var ChildAppWindow = /** @class */ (function () {
4257
4258
  function ChildAppWindow() {
4258
4259
  }
4260
+ /**
4261
+ * Send a message to the ChildAppWindow.
4262
+ *
4263
+ * @param message - The message to send
4264
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
4265
+ */
4259
4266
  ChildAppWindow.prototype.postMessage = function (message, onComplete) {
4260
4267
  ensureInitialized();
4261
- return this.postMessageHelper(message)
4262
- .then(function () {
4263
- if (onComplete) {
4264
- onComplete(true);
4265
- }
4266
- })
4267
- .catch(function (err) {
4268
- if (onComplete) {
4269
- onComplete(false, err.message);
4270
- return;
4271
- }
4272
- throw err;
4273
- });
4274
- };
4275
- ChildAppWindow.prototype.postMessageHelper = function (message) {
4276
- return new Promise(function (resolve) {
4277
- resolve(sendAndHandleStatusAndReason('messageForChild', message));
4278
- });
4268
+ sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4279
4269
  };
4270
+ /**
4271
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
4272
+ *
4273
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
4274
+ * @param listener - The listener that will be called
4275
+ */
4280
4276
  ChildAppWindow.prototype.addEventListener = function (type, listener) {
4281
4277
  if (type === 'message') {
4282
4278
  registerHandler('messageForParent', listener);
@@ -4296,27 +4292,22 @@ var ParentAppWindow = /** @class */ (function () {
4296
4292
  enumerable: false,
4297
4293
  configurable: true
4298
4294
  });
4295
+ /**
4296
+ * Send a message to the ParentAppWindow.
4297
+ *
4298
+ * @param message - The message to send
4299
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
4300
+ */
4299
4301
  ParentAppWindow.prototype.postMessage = function (message, onComplete) {
4300
4302
  ensureInitialized(FrameContexts.task);
4301
- return this.postMessageHelper(message)
4302
- .then(function () {
4303
- if (onComplete) {
4304
- onComplete(true);
4305
- }
4306
- })
4307
- .catch(function (err) {
4308
- if (onComplete) {
4309
- onComplete(false, err.message);
4310
- return;
4311
- }
4312
- throw err;
4313
- });
4314
- };
4315
- ParentAppWindow.prototype.postMessageHelper = function (message) {
4316
- return new Promise(function (resolve) {
4317
- resolve(sendAndHandleStatusAndReason('messageForParent', message));
4318
- });
4303
+ sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4319
4304
  };
4305
+ /**
4306
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
4307
+ *
4308
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
4309
+ * @param listener - The listener that will be called
4310
+ */
4320
4311
  ParentAppWindow.prototype.addEventListener = function (type, listener) {
4321
4312
  if (type === 'message') {
4322
4313
  registerHandler('messageForChild', listener);
@@ -5625,27 +5616,21 @@ var sharing;
5625
5616
 
5626
5617
 
5627
5618
 
5619
+
5628
5620
  /**
5629
5621
  * Namespace to interact with the stage view specific part of the SDK.
5630
5622
  */
5631
5623
  var stageView;
5632
5624
  (function (stageView) {
5633
- /**
5634
- * @hidden
5635
- * Feature is under development
5636
- *
5637
- * Opens a stage view to display a Teams app
5638
- * @param stageViewParams The parameters to pass into the stage view.
5639
- * @param callback Callback that will be triggered once the stage view is closed.
5640
- * The callback takes as an argument an SdkError in case something happened (i.e.
5641
- * no permissions to execute the API)
5642
- */
5643
5625
  function open(stageViewParams, callback) {
5644
5626
  ensureInitialized(FrameContexts.content);
5645
5627
  if (!stageViewParams) {
5646
5628
  throw new Error('[stageView.open] Stage view params cannot be null');
5647
5629
  }
5648
- sendMessageToParent('stageView.open', [stageViewParams], callback);
5630
+ var wrappedFunction = function () {
5631
+ return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('stageView.open', stageViewParams)); });
5632
+ };
5633
+ return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
5649
5634
  }
5650
5635
  stageView.open = open;
5651
5636
  })(stageView || (stageView = {}));
@@ -6421,6 +6406,7 @@ var tasks;
6421
6406
 
6422
6407
 
6423
6408
 
6409
+
6424
6410
  /**
6425
6411
  * @hidden
6426
6412
  * Hide from docs
@@ -6677,19 +6663,12 @@ var files;
6677
6663
  return runtime.supports.files ? true : false;
6678
6664
  }
6679
6665
  files_1.isSupported = isSupported;
6680
- /**
6681
- * @hidden
6682
- * Hide from docs
6683
- * ------
6684
- * Gets list of downloads for current user
6685
- * @param callback Callback that will be triggered post downloads load
6686
- */
6687
6666
  function getFileDownloads(callback) {
6688
6667
  ensureInitialized(FrameContexts.content);
6689
- if (!callback) {
6690
- throw new Error('[files.getFileDownloads] Callback cannot be null');
6691
- }
6692
- sendMessageToParent('files.getFileDownloads', [], callback);
6668
+ var wrappedFunction = function () {
6669
+ return new Promise(function (resolve) { return resolve(sendAndHandleSdkError('files.getFileDownloads', [])); });
6670
+ };
6671
+ return callCallbackWithErrorOrResultFromPromiseAndReturnPromise(wrappedFunction, callback);
6693
6672
  }
6694
6673
  files_1.getFileDownloads = getFileDownloads;
6695
6674
  /**