@microsoft/teams-js 2.0.0-beta.4-dev.11 → 2.0.0-beta.4-dev.14

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.
@@ -2770,6 +2770,20 @@ export namespace dialog {
2770
2770
  * @param appIds - Helps to validate that the call originates from the same appId as the one that invoked the task module
2771
2771
  */
2772
2772
  function submit(result?: string | object, appIds?: string | string[]): void;
2773
+ /**
2774
+ * Send message to the parent from dialog
2775
+ *
2776
+ * @param message - The message to send
2777
+ * @param onComplete - The callback to know if the message to parent has been success/failed.
2778
+ */
2779
+ function sendMessageToParentFromDialog(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
2780
+ /**
2781
+ * Fucntion to call when an event is received from the Parent
2782
+ *
2783
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
2784
+ * @param listener - listener - The listener that will be called.
2785
+ */
2786
+ function registerOnMessageFromParent(listener: (message: any) => void): void;
2773
2787
  function isSupported(): boolean;
2774
2788
  }
2775
2789
 
@@ -3070,15 +3084,9 @@ export namespace pages {
3070
3084
  export interface IAppWindow {
3071
3085
  /**
3072
3086
  * Send a message to the AppWindow.
3087
+ *
3073
3088
  * @param message - The message to send
3074
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3075
- */
3076
- postMessage(message: any): Promise<void>;
3077
- /**
3078
- * @deprecated
3079
- * As of 2.0.0-beta.1, please use {@link IAppWindow.postMessage IAppWindow.postMessage(message: any): Promise\<void\>} instead.
3080
- * @param message - The message to send
3081
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3089
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3082
3090
  */
3083
3091
  postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3084
3092
  /**
@@ -3091,37 +3099,35 @@ export interface IAppWindow {
3091
3099
  }
3092
3100
  export class ChildAppWindow implements IAppWindow {
3093
3101
  /**
3094
- * Send a message to the AppWindow.
3102
+ * Send a message to the ChildAppWindow.
3103
+ *
3095
3104
  * @param message - The message to send
3096
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3105
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3097
3106
  */
3098
- postMessage(message: any): Promise<void>;
3107
+ postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3099
3108
  /**
3100
- * @deprecated
3101
- * As of 2.0.0-beta.1, please use {@link ChildAppWindow.postMessage ChildAppWindow.postMessage(message: any): Promise\<void\>} instead.
3102
- * @param message - The message to send
3103
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3109
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
3110
+ *
3111
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
3112
+ * @param listener - The listener that will be called
3104
3113
  */
3105
- postMessage(message: any, onComplete: (status: boolean, reason?: string) => void): void;
3106
- postMessageHelper(message: any): Promise<void>;
3107
3114
  addEventListener(type: string, listener: (message: any) => void): void;
3108
3115
  }
3109
3116
  export class ParentAppWindow implements IAppWindow {
3110
3117
  static get Instance(): IAppWindow;
3111
3118
  /**
3112
- * Send a message to the AppWindow.
3119
+ * Send a message to the ParentAppWindow.
3120
+ *
3113
3121
  * @param message - The message to send
3114
- * @returns Promise that will be fulfilled when the AppWindow posts back a response
3122
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
3115
3123
  */
3116
- postMessage(message: any): Promise<void>;
3124
+ postMessage(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
3117
3125
  /**
3118
- * @deprecated
3119
- * As of 2.0.0-beta.1, please use {@link ParentAppWindow.postMessage ParentAppWindow.postMessage(message: any): Promise\<void\>} instead.
3120
- * @param message - The message to send
3121
- * @param onComplete - The deprecated way of invoking a callback to know if the postMessage has been success/failed.
3126
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
3127
+ *
3128
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
3129
+ * @param listener - The listener that will be called
3122
3130
  */
3123
- postMessage(message: any, onComplete: (status: boolean, reason?: string) => void): void;
3124
- postMessageHelper(message: any): Promise<void>;
3125
3131
  addEventListener(type: string, listener: (message: any) => void): void;
3126
3132
  }
3127
3133
 
@@ -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.11";
1124
+ var version = "2.0.0-beta.4-dev.14";
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.
@@ -1220,6 +1220,8 @@ var validOrigins = [
1220
1220
  '*.sharepointonline.com',
1221
1221
  'outlook.office.com',
1222
1222
  'outlook-sdf.office.com',
1223
+ 'outlook.office365.com',
1224
+ 'outlook-sdf.office365.com',
1223
1225
  '*.teams.microsoft.com',
1224
1226
  'www.office.com',
1225
1227
  'word.office.com',
@@ -4253,30 +4255,26 @@ var appInstallDialog;
4253
4255
 
4254
4256
 
4255
4257
 
4258
+
4256
4259
  var ChildAppWindow = /** @class */ (function () {
4257
4260
  function ChildAppWindow() {
4258
4261
  }
4262
+ /**
4263
+ * Send a message to the ChildAppWindow.
4264
+ *
4265
+ * @param message - The message to send
4266
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
4267
+ */
4259
4268
  ChildAppWindow.prototype.postMessage = function (message, onComplete) {
4260
4269
  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
- });
4270
+ sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4279
4271
  };
4272
+ /**
4273
+ * Add a listener that will be called when an event is received from the ChildAppWindow.
4274
+ *
4275
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
4276
+ * @param listener - The listener that will be called
4277
+ */
4280
4278
  ChildAppWindow.prototype.addEventListener = function (type, listener) {
4281
4279
  if (type === 'message') {
4282
4280
  registerHandler('messageForParent', listener);
@@ -4296,27 +4294,22 @@ var ParentAppWindow = /** @class */ (function () {
4296
4294
  enumerable: false,
4297
4295
  configurable: true
4298
4296
  });
4297
+ /**
4298
+ * Send a message to the ParentAppWindow.
4299
+ *
4300
+ * @param message - The message to send
4301
+ * @param onComplete - The callback to know if the postMessage has been success/failed.
4302
+ */
4299
4303
  ParentAppWindow.prototype.postMessage = function (message, onComplete) {
4300
4304
  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
- });
4305
+ sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4319
4306
  };
4307
+ /**
4308
+ * Add a listener that will be called when an event is received from the ParentAppWindow.
4309
+ *
4310
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
4311
+ * @param listener - The listener that will be called
4312
+ */
4320
4313
  ParentAppWindow.prototype.addEventListener = function (type, listener) {
4321
4314
  if (type === 'message') {
4322
4315
  registerHandler('messageForChild', listener);
@@ -4327,6 +4320,7 @@ var ParentAppWindow = /** @class */ (function () {
4327
4320
 
4328
4321
 
4329
4322
  ;// CONCATENATED MODULE: ./src/public/dialog.ts
4323
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
4330
4324
  /* eslint-disable @typescript-eslint/ban-types */
4331
4325
  /* eslint-disable @typescript-eslint/no-unused-vars */
4332
4326
  var __rest = (undefined && undefined.__rest) || function (s, e) {
@@ -4345,6 +4339,8 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
4345
4339
 
4346
4340
 
4347
4341
 
4342
+
4343
+
4348
4344
  /**
4349
4345
  * Namespace to interact with the dialog module-specific part of the SDK.
4350
4346
  *
@@ -4395,6 +4391,31 @@ var dialog;
4395
4391
  sendMessageToParent('tasks.completeTask', [result, Array.isArray(appIds) ? appIds : [appIds]]);
4396
4392
  }
4397
4393
  dialog.submit = submit;
4394
+ /**
4395
+ * Send message to the parent from dialog
4396
+ *
4397
+ * @param message - The message to send
4398
+ * @param onComplete - The callback to know if the message to parent has been success/failed.
4399
+ */
4400
+ function sendMessageToParentFromDialog(
4401
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4402
+ message, onComplete) {
4403
+ ensureInitialized(FrameContexts.task);
4404
+ sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4405
+ }
4406
+ dialog.sendMessageToParentFromDialog = sendMessageToParentFromDialog;
4407
+ /**
4408
+ * Fucntion to call when an event is received from the Parent
4409
+ *
4410
+ * @param type - The event to listen to. Currently the only supported type is 'message'.
4411
+ * @param listener - listener - The listener that will be called.
4412
+ */
4413
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4414
+ function registerOnMessageFromParent(listener) {
4415
+ ensureInitialized();
4416
+ registerHandler('messageForChild', listener);
4417
+ }
4418
+ dialog.registerOnMessageFromParent = registerOnMessageFromParent;
4398
4419
  function isSupported() {
4399
4420
  return runtime.supports.dialog ? true : false;
4400
4421
  }