@microsoft/teams-js 2.0.0-beta.4-dev.16 → 2.0.0-beta.4-dev.19

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.
@@ -351,6 +351,123 @@ export function registerCustomHandler(actionName: string, customHandler: (...arg
351
351
  */
352
352
  export function registerUserSettingsChangeHandler(settingTypes: UserSettingTypes[], handler: (settingType: UserSettingTypes, value: any) => void): void;
353
353
 
354
+ /**
355
+ *
356
+ * @internal
357
+ */
358
+ interface OpenChatRequest {
359
+ /**
360
+ * @hidden
361
+ * The message to send when opening chat
362
+ */
363
+ message?: string;
364
+ }
365
+ /**
366
+ * @hidden
367
+ * Hide from docs.
368
+ * ------
369
+ *
370
+ * @internal
371
+ */
372
+ export interface OpenSingleChatRequest extends OpenChatRequest {
373
+ /**
374
+ * @hidden
375
+ * User's UPN to open chat with
376
+ */
377
+ user: string;
378
+ }
379
+ /**
380
+ * @hidden
381
+ * Hide from docs.
382
+ * ------
383
+ *
384
+ * @internal
385
+ */
386
+ export interface OpenGroupChatRequest extends OpenChatRequest {
387
+ /**
388
+ * @hidden
389
+ * Array containing UPNs of users to open chat with
390
+ */
391
+ users: string[];
392
+ /**
393
+ * @hidden
394
+ * The display name of a conversation for 3 or more users
395
+ */
396
+ topic?: string;
397
+ }
398
+ /**
399
+ * @hidden
400
+ * Hide from docs.
401
+ * ------
402
+ *
403
+ * @internal
404
+ */
405
+ export interface OpenConversationRequest {
406
+ /**
407
+ * @hidden
408
+ * The Id of the subEntity where the conversation is taking place
409
+ */
410
+ subEntityId: string;
411
+ /**
412
+ * @hidden
413
+ * The title of the conversation
414
+ */
415
+ title: string;
416
+ /**
417
+ * @hidden
418
+ * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
419
+ */
420
+ conversationId?: string;
421
+ /**
422
+ * @hidden
423
+ * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
424
+ */
425
+ channelId?: string;
426
+ /**
427
+ * @hidden
428
+ * The entity Id of the tab
429
+ */
430
+ entityId: string;
431
+ /**
432
+ * @hidden
433
+ * A function that is called once the conversation Id has been created
434
+ */
435
+ onStartConversation?: (conversationResponse: ConversationResponse) => void;
436
+ /**
437
+ * @hidden
438
+ * A function that is called if the pane is closed
439
+ */
440
+ onCloseConversation?: (conversationResponse: ConversationResponse) => void;
441
+ }
442
+ /**
443
+ * @hidden
444
+ * Hide from docs.
445
+ * ------
446
+ *
447
+ * @internal
448
+ */
449
+ export interface ConversationResponse {
450
+ /**
451
+ * @hidden
452
+ * The Id of the subEntity where the conversation is taking place
453
+ */
454
+ subEntityId: string;
455
+ /**
456
+ * @hidden
457
+ * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
458
+ */
459
+ conversationId?: string;
460
+ /**
461
+ * @hidden
462
+ * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
463
+ */
464
+ channelId?: string;
465
+ /**
466
+ * @hidden
467
+ * The entity Id of the tab
468
+ */
469
+ entityId?: string;
470
+ }
354
471
  /**
355
472
  * @hidden
356
473
  * Namespace to interact with the conversational subEntities inside the tab
@@ -362,34 +479,62 @@ export namespace chat {
362
479
  * @hidden
363
480
  * Hide from docs
364
481
  * --------------
365
- * Allows the user to start or continue a conversation with each subentity inside the tab
482
+ * Allows the user to open a chat with a single user and allows
483
+ * for the user to specify the message they wish to send.
484
+ *
485
+ *@param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
366
486
  *
367
487
  * @returns Promise resolved upon completion
368
488
  */
369
- function openConversation(openConversationRequest: OpenConversationRequest): Promise<void>;
489
+ function openChat(openChatRequest: OpenSingleChatRequest): Promise<void>;
370
490
  /**
371
491
  * @hidden
372
492
  * Hide from docs
373
493
  * --------------
374
- * Allows the user to close the conversation in the right pane
494
+ * Allows the user to create a chat with multiple users (2+) and allows
495
+ * for the user to specify a message and name the topic of the conversation. If
496
+ * only 1 user is provided into users array default back to origin openChat.
497
+ *
498
+ * @param openChatRequest: {@link OpenGroupChatRequest} - a request object that contains a list of user emails as well as optional parameters for message and topic (display name for the group chat).
499
+ *
500
+ * @returns Promise resolved upon completion
375
501
  */
376
- function closeConversation(): void;
502
+ function openGroupChat(openChatRequest: OpenGroupChatRequest): Promise<void>;
377
503
  /**
378
504
  * @hidden
379
505
  * Hide from docs
380
506
  * ------
381
- * Allows an app to retrieve information of all chat members
382
- * Because a malicious party run your content in a browser, this value should
383
- * be used only as a hint as to who the members are and never as proof of membership.
507
+ * Allows retrieval of information for all chat members.
508
+ * NOTE: This value should be used only as a hint as to who the members are
509
+ * and never as proof of membership in case your app is being hosted by a malicious party.
384
510
  *
385
- * @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
386
511
  * @returns Promise resolved with information on all chat members
387
512
  *
388
513
  * @internal
389
514
  */
390
515
  function getChatMembers(): Promise<ChatMembersInformation>;
391
516
  function isSupported(): boolean;
517
+ namespace conversation {
518
+ /**
519
+ * @hidden
520
+ * Hide from docs
521
+ * --------------
522
+ * Allows the user to start or continue a conversation with each subentity inside the tab
523
+ *
524
+ * @returns Promise resolved upon completion
525
+ */
526
+ function openConversation(openConversationRequest: OpenConversationRequest): Promise<void>;
527
+ /**
528
+ * @hidden
529
+ * Hide from docs
530
+ * --------------
531
+ * Allows the user to close the conversation in the right pane
532
+ */
533
+ function closeConversation(): void;
534
+ function isSupported(): boolean;
535
+ }
392
536
  }
537
+ export {};
393
538
 
394
539
  /**
395
540
  * @hidden
@@ -2183,79 +2328,6 @@ export interface DialogSize {
2183
2328
  height: DialogDimension | number;
2184
2329
  width: DialogDimension | number;
2185
2330
  }
2186
- /**
2187
- * @hidden
2188
- * Hide from docs.
2189
- * ------
2190
- *
2191
- * @internal
2192
- */
2193
- export interface OpenConversationRequest {
2194
- /**
2195
- * @hidden
2196
- * The Id of the subEntity where the conversation is taking place
2197
- */
2198
- subEntityId: string;
2199
- /**
2200
- * @hidden
2201
- * The title of the conversation
2202
- */
2203
- title: string;
2204
- /**
2205
- * @hidden
2206
- * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
2207
- */
2208
- conversationId?: string;
2209
- /**
2210
- * @hidden
2211
- * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
2212
- */
2213
- channelId?: string;
2214
- /**
2215
- * @hidden
2216
- * The entity Id of the tab
2217
- */
2218
- entityId: string;
2219
- /**
2220
- * @hidden
2221
- * A function that is called once the conversation Id has been created
2222
- */
2223
- onStartConversation?: (conversationResponse: ConversationResponse) => void;
2224
- /**
2225
- * @hidden
2226
- * A function that is called if the pane is closed
2227
- */
2228
- onCloseConversation?: (conversationResponse: ConversationResponse) => void;
2229
- }
2230
- /**
2231
- * @hidden
2232
- * Hide from docs.
2233
- * ------
2234
- *
2235
- * @internal
2236
- */
2237
- export interface ConversationResponse {
2238
- /**
2239
- * @hidden
2240
- * The Id of the subEntity where the conversation is taking place
2241
- */
2242
- subEntityId: string;
2243
- /**
2244
- * @hidden
2245
- * The Id of the conversation. This is optional and should be specified whenever a previous conversation about a specific sub-entity has already been started before
2246
- */
2247
- conversationId?: string;
2248
- /**
2249
- * @hidden
2250
- * The Id of the channel. This is optional and should be specified whenever a conversation is started or opened in a personal app scope
2251
- */
2252
- channelId?: string;
2253
- /**
2254
- * @hidden
2255
- * The entity Id of the tab
2256
- */
2257
- entityId?: string;
2258
- }
2259
2331
  /**
2260
2332
  * @hidden
2261
2333
  * Hide from docs.
@@ -2787,11 +2859,11 @@ export namespace appInstallDialog {
2787
2859
  * @beta
2788
2860
  */
2789
2861
  export interface SdkResponse {
2790
- err: string;
2791
- result: string | object;
2862
+ err?: string;
2863
+ result?: string | object;
2792
2864
  }
2793
2865
  export namespace dialog {
2794
- type PostMessageChannel = (message: any, onComplete?: (status: boolean, reason?: string) => void) => void;
2866
+ type PostMessageChannel = (message: any) => void;
2795
2867
  type DialogSubmitHandler = (result: SdkResponse) => void;
2796
2868
  /**
2797
2869
  * Allows an app to open the dialog module.
@@ -2814,9 +2886,8 @@ export namespace dialog {
2814
2886
  * Send message to the parent from dialog
2815
2887
  *
2816
2888
  * @param message - The message to send
2817
- * @param onComplete - The callback to know if the message to parent has been success/failed.
2818
2889
  */
2819
- function sendMessageToParentFromDialog(message: any, onComplete?: (status: boolean, reason?: string) => void): void;
2890
+ function sendMessageToParentFromDialog(message: any): void;
2820
2891
  /**
2821
2892
  * Fucntion to call when an event is received from the Parent
2822
2893
  *
@@ -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.16";
1124
+ var version = "2.0.0-beta.4-dev.19";
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.
@@ -1819,7 +1819,9 @@ var runtime = {
1819
1819
  bot: undefined,
1820
1820
  calendar: undefined,
1821
1821
  call: undefined,
1822
- chat: undefined,
1822
+ chat: {
1823
+ conversation: undefined,
1824
+ },
1823
1825
  dialog: {
1824
1826
  bot: undefined,
1825
1827
  update: undefined,
@@ -1858,7 +1860,9 @@ var teamsRuntimeConfig = {
1858
1860
  appEntity: {},
1859
1861
  bot: {},
1860
1862
  call: {},
1861
- chat: {},
1863
+ chat: {
1864
+ conversation: {},
1865
+ },
1862
1866
  dialog: {
1863
1867
  bot: {},
1864
1868
  update: {},
@@ -4149,66 +4153,68 @@ var chat;
4149
4153
  * @hidden
4150
4154
  * Hide from docs
4151
4155
  * --------------
4152
- * Allows the user to start or continue a conversation with each subentity inside the tab
4156
+ * Allows the user to open a chat with a single user and allows
4157
+ * for the user to specify the message they wish to send.
4158
+ *
4159
+ *@param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
4153
4160
  *
4154
4161
  * @returns Promise resolved upon completion
4155
4162
  */
4156
- function openConversation(openConversationRequest) {
4163
+ function openChat(openChatRequest) {
4157
4164
  return new Promise(function (resolve) {
4158
4165
  ensureInitialized(FrameContexts.content);
4159
- var sendPromise = sendAndHandleStatusAndReason('conversations.openConversation', {
4160
- title: openConversationRequest.title,
4161
- subEntityId: openConversationRequest.subEntityId,
4162
- conversationId: openConversationRequest.conversationId,
4163
- channelId: openConversationRequest.channelId,
4164
- entityId: openConversationRequest.entityId,
4166
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4167
+ members: openChatRequest.user,
4168
+ message: openChatRequest.message,
4165
4169
  });
4166
- if (openConversationRequest.onStartConversation) {
4167
- registerHandler('startConversation', function (subEntityId, conversationId, channelId, entityId) {
4168
- return openConversationRequest.onStartConversation({
4169
- subEntityId: subEntityId,
4170
- conversationId: conversationId,
4171
- channelId: channelId,
4172
- entityId: entityId,
4173
- });
4174
- });
4175
- }
4176
- if (openConversationRequest.onCloseConversation) {
4177
- registerHandler('closeConversation', function (subEntityId, conversationId, channelId, entityId) {
4178
- return openConversationRequest.onCloseConversation({
4179
- subEntityId: subEntityId,
4180
- conversationId: conversationId,
4181
- channelId: channelId,
4182
- entityId: entityId,
4183
- });
4184
- });
4185
- }
4186
4170
  resolve(sendPromise);
4187
4171
  });
4188
4172
  }
4189
- chat.openConversation = openConversation;
4173
+ chat.openChat = openChat;
4190
4174
  /**
4191
4175
  * @hidden
4192
4176
  * Hide from docs
4193
4177
  * --------------
4194
- * Allows the user to close the conversation in the right pane
4178
+ * Allows the user to create a chat with multiple users (2+) and allows
4179
+ * for the user to specify a message and name the topic of the conversation. If
4180
+ * only 1 user is provided into users array default back to origin openChat.
4181
+ *
4182
+ * @param openChatRequest: {@link OpenGroupChatRequest} - a request object that contains a list of user emails as well as optional parameters for message and topic (display name for the group chat).
4183
+ *
4184
+ * @returns Promise resolved upon completion
4195
4185
  */
4196
- function closeConversation() {
4197
- ensureInitialized(FrameContexts.content);
4198
- sendMessageToParent('conversations.closeConversation');
4199
- removeHandler('startConversation');
4200
- removeHandler('closeConversation');
4186
+ function openGroupChat(openChatRequest) {
4187
+ return new Promise(function (resolve) {
4188
+ if (openChatRequest.users.length < 1) {
4189
+ throw Error('OpenGroupChat Failed: No users specified');
4190
+ }
4191
+ if (openChatRequest.users.length === 1) {
4192
+ var chatRequest = {
4193
+ user: openChatRequest.users[0],
4194
+ message: openChatRequest.message,
4195
+ };
4196
+ openChat(chatRequest);
4197
+ }
4198
+ else {
4199
+ ensureInitialized(FrameContexts.content);
4200
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4201
+ members: openChatRequest.users,
4202
+ message: openChatRequest.message,
4203
+ topic: openChatRequest.topic,
4204
+ });
4205
+ resolve(sendPromise);
4206
+ }
4207
+ });
4201
4208
  }
4202
- chat.closeConversation = closeConversation;
4209
+ chat.openGroupChat = openGroupChat;
4203
4210
  /**
4204
4211
  * @hidden
4205
4212
  * Hide from docs
4206
4213
  * ------
4207
- * Allows an app to retrieve information of all chat members
4208
- * Because a malicious party run your content in a browser, this value should
4209
- * be used only as a hint as to who the members are and never as proof of membership.
4214
+ * Allows retrieval of information for all chat members.
4215
+ * NOTE: This value should be used only as a hint as to who the members are
4216
+ * and never as proof of membership in case your app is being hosted by a malicious party.
4210
4217
  *
4211
- * @param callback The callback to invoke when the {@link ChatMembersInformation} object is retrieved.
4212
4218
  * @returns Promise resolved with information on all chat members
4213
4219
  *
4214
4220
  * @internal
@@ -4224,6 +4230,68 @@ var chat;
4224
4230
  return runtime.supports.chat ? true : false;
4225
4231
  }
4226
4232
  chat.isSupported = isSupported;
4233
+ var conversation;
4234
+ (function (conversation) {
4235
+ /**
4236
+ * @hidden
4237
+ * Hide from docs
4238
+ * --------------
4239
+ * Allows the user to start or continue a conversation with each subentity inside the tab
4240
+ *
4241
+ * @returns Promise resolved upon completion
4242
+ */
4243
+ function openConversation(openConversationRequest) {
4244
+ return new Promise(function (resolve) {
4245
+ ensureInitialized(FrameContexts.content);
4246
+ var sendPromise = sendAndHandleStatusAndReason('conversations.openConversation', {
4247
+ title: openConversationRequest.title,
4248
+ subEntityId: openConversationRequest.subEntityId,
4249
+ conversationId: openConversationRequest.conversationId,
4250
+ channelId: openConversationRequest.channelId,
4251
+ entityId: openConversationRequest.entityId,
4252
+ });
4253
+ if (openConversationRequest.onStartConversation) {
4254
+ registerHandler('startConversation', function (subEntityId, conversationId, channelId, entityId) {
4255
+ return openConversationRequest.onStartConversation({
4256
+ subEntityId: subEntityId,
4257
+ conversationId: conversationId,
4258
+ channelId: channelId,
4259
+ entityId: entityId,
4260
+ });
4261
+ });
4262
+ }
4263
+ if (openConversationRequest.onCloseConversation) {
4264
+ registerHandler('closeConversation', function (subEntityId, conversationId, channelId, entityId) {
4265
+ return openConversationRequest.onCloseConversation({
4266
+ subEntityId: subEntityId,
4267
+ conversationId: conversationId,
4268
+ channelId: channelId,
4269
+ entityId: entityId,
4270
+ });
4271
+ });
4272
+ }
4273
+ resolve(sendPromise);
4274
+ });
4275
+ }
4276
+ conversation.openConversation = openConversation;
4277
+ /**
4278
+ * @hidden
4279
+ * Hide from docs
4280
+ * --------------
4281
+ * Allows the user to close the conversation in the right pane
4282
+ */
4283
+ function closeConversation() {
4284
+ ensureInitialized(FrameContexts.content);
4285
+ sendMessageToParent('conversations.closeConversation');
4286
+ removeHandler('startConversation');
4287
+ removeHandler('closeConversation');
4288
+ }
4289
+ conversation.closeConversation = closeConversation;
4290
+ function isSupported() {
4291
+ return runtime.supports.chat.conversation ? true : false;
4292
+ }
4293
+ conversation.isSupported = isSupported;
4294
+ })(conversation = chat.conversation || (chat.conversation = {}));
4227
4295
  })(chat || (chat = {}));
4228
4296
 
4229
4297
  ;// CONCATENATED MODULE: ./src/public/appInstallDialog.ts
@@ -4262,7 +4330,6 @@ var appInstallDialog;
4262
4330
 
4263
4331
 
4264
4332
 
4265
-
4266
4333
  var dialog;
4267
4334
  (function (dialog) {
4268
4335
  /**
@@ -4283,8 +4350,8 @@ var dialog;
4283
4350
  submitHandler({ err: err, result: result });
4284
4351
  });
4285
4352
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4286
- var sendMessageToDialog = function (message, onComplete) {
4287
- sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4353
+ var sendMessageToDialog = function (message) {
4354
+ sendMessageToParent('messageForChild', [message]);
4288
4355
  };
4289
4356
  return sendMessageToDialog;
4290
4357
  }
@@ -4305,13 +4372,12 @@ var dialog;
4305
4372
  * Send message to the parent from dialog
4306
4373
  *
4307
4374
  * @param message - The message to send
4308
- * @param onComplete - The callback to know if the message to parent has been success/failed.
4309
4375
  */
4310
4376
  function sendMessageToParentFromDialog(
4311
4377
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4312
- message, onComplete) {
4378
+ message) {
4313
4379
  ensureInitialized(FrameContexts.task);
4314
- sendMessageToParent('messageForParent', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4380
+ sendMessageToParent('messageForParent', [message]);
4315
4381
  }
4316
4382
  dialog.sendMessageToParentFromDialog = sendMessageToParentFromDialog;
4317
4383
  /**
@@ -4358,8 +4424,8 @@ var dialog;
4358
4424
  submitHandler({ err: err, result: result });
4359
4425
  });
4360
4426
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
4361
- var sendMessageToDialog = function (message, onComplete) {
4362
- sendMessageToParent('messageForChild', [message], onComplete ? onComplete : getGenericOnCompleteHandler());
4427
+ var sendMessageToDialog = function (message) {
4428
+ sendMessageToParent('messageForChild', [message]);
4363
4429
  };
4364
4430
  return sendMessageToDialog;
4365
4431
  }