@microsoft/teams-js 2.0.0-beta.4-dev.21 → 2.0.0-beta.4-dev.24

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.
@@ -2703,72 +2703,62 @@ export namespace appInstallDialog {
2703
2703
  }
2704
2704
 
2705
2705
  /**
2706
+ * Describes information needed to start a chat
2706
2707
  *
2707
- * @internal
2708
+ * @beta
2708
2709
  */
2709
2710
  interface OpenChatRequest {
2710
2711
  /**
2711
- * @hidden
2712
- * The message to send when opening chat
2712
+ * An optional message used when initiating chat
2713
2713
  */
2714
2714
  message?: string;
2715
2715
  }
2716
2716
  /**
2717
- * @hidden
2718
- * Hide from docs.
2719
- * ------
2717
+ * Used when starting a chat with one person
2720
2718
  *
2721
- * @internal
2719
+ * @see OpenGroupChatRequest for use when a chat with more than one person
2720
+ *
2721
+ * @beta
2722
2722
  */
2723
2723
  export interface OpenSingleChatRequest extends OpenChatRequest {
2724
2724
  /**
2725
- * @hidden
2726
- * User's UPN to open chat with
2725
+ * The Azure Active Directory UPN (e-mail address) of the user to chat with
2727
2726
  */
2728
2727
  user: string;
2729
2728
  }
2730
2729
  /**
2731
- * @hidden
2732
- * Hide from docs.
2733
- * ------
2730
+ * Used when starting a chat with more than one person
2734
2731
  *
2735
- * @internal
2732
+ * @see OpenSingleChatRequest for use in a chat with only one person
2733
+ *
2734
+ * @beta
2736
2735
  */
2737
2736
  export interface OpenGroupChatRequest extends OpenChatRequest {
2738
2737
  /**
2739
- * @hidden
2740
- * Array containing UPNs of users to open chat with
2738
+ * Array containing Azure Active Directory UPNs (e-mail addresss) of users to open chat with
2741
2739
  */
2742
2740
  users: string[];
2743
2741
  /**
2744
- * @hidden
2745
- * The display name of a conversation for 3 or more users
2742
+ * The display name of a conversation for 3 or more users (chats with fewer than three users will ignore this field)
2746
2743
  */
2747
2744
  topic?: string;
2748
2745
  }
2749
2746
  /**
2750
- * @hidden
2751
- * Namespace to interact with the conversational subEntities inside the tab
2747
+ * Contains functionality to start chat with others
2752
2748
  *
2753
- * @alpha
2749
+ * @beta
2754
2750
  */
2755
2751
  export namespace chat {
2756
2752
  /**
2757
- * @hidden
2758
- * Hide from docs
2759
- * --------------
2760
2753
  * Allows the user to open a chat with a single user and allows
2761
2754
  * for the user to specify the message they wish to send.
2762
2755
  *
2763
- *@param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
2756
+ * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
2764
2757
  *
2765
2758
  * @returns Promise resolved upon completion
2766
2759
  */
2767
2760
  function openChat(openChatRequest: OpenSingleChatRequest): Promise<void>;
2768
2761
  /**
2769
- * @hidden
2770
- * Hide from docs
2771
- * --------------
2772
2762
  * Allows the user to create a chat with multiple users (2+) and allows
2773
2763
  * for the user to specify a message and name the topic of the conversation. If
2774
2764
  * only 1 user is provided into users array default back to origin openChat.
@@ -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.21";
1124
+ var version = "2.0.0-beta.4-dev.24";
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.
@@ -1237,6 +1237,20 @@ var validOrigins = [
1237
1237
  * @internal
1238
1238
  */
1239
1239
  var userOriginUrlValidationRegExp = /^https:\/\//;
1240
+ /**
1241
+ * @hidden
1242
+ * The protocol used for deep links into Teams
1243
+ *
1244
+ * @internal
1245
+ */
1246
+ var teamsDeepLinkProtocol = 'https';
1247
+ /**
1248
+ * @hidden
1249
+ * The host used for deep links into Teams
1250
+ *
1251
+ * @internal
1252
+ */
1253
+ var teamsDeepLinkHost = 'teams.microsoft.com';
1240
1254
 
1241
1255
  ;// CONCATENATED MODULE: ./src/internal/globalVars.ts
1242
1256
  var GlobalVars = /** @class */ (function () {
@@ -4248,45 +4262,63 @@ var appInstallDialog;
4248
4262
  appInstallDialog.isSupported = isSupported;
4249
4263
  })(appInstallDialog || (appInstallDialog = {}));
4250
4264
 
4265
+ ;// CONCATENATED MODULE: ./src/internal/chatConstants.ts
4266
+ var teamsDeepLinkUrlPathForChat = '/l/chat/0/0';
4267
+ var teamsDeepLinkUsersUrlParameterName = 'users';
4268
+ var teamsDeepLinkTopicUrlParameterName = 'topic';
4269
+ var teamsDeepLinkMessageUrlParameterName = 'message';
4270
+
4271
+ ;// CONCATENATED MODULE: ./src/internal/chatUtilities.ts
4272
+
4273
+
4274
+ function createTeamsDeepLinkForChat(users, topic, message) {
4275
+ if (users.length === 0) {
4276
+ throw new Error('Must have at least one user when creating a chat deep link');
4277
+ }
4278
+ var usersSearchParameter = teamsDeepLinkUsersUrlParameterName + "=" + users.map(function (user) { return encodeURIComponent(user); }).join(',');
4279
+ var topicSearchParameter = topic === undefined ? '' : "&" + teamsDeepLinkTopicUrlParameterName + "=" + encodeURIComponent(topic);
4280
+ var messageSearchParameter = message === undefined ? '' : "&" + teamsDeepLinkMessageUrlParameterName + "=" + encodeURIComponent(message);
4281
+ return teamsDeepLinkProtocol + "://" + teamsDeepLinkHost + teamsDeepLinkUrlPathForChat + "?" + usersSearchParameter + topicSearchParameter + messageSearchParameter;
4282
+ }
4283
+
4251
4284
  ;// CONCATENATED MODULE: ./src/public/chat.ts
4252
4285
 
4253
4286
 
4254
4287
 
4255
4288
 
4289
+
4256
4290
  /**
4257
- * @hidden
4258
- * Namespace to interact with the conversational subEntities inside the tab
4291
+ * Contains functionality to start chat with others
4259
4292
  *
4260
- * @alpha
4293
+ * @beta
4261
4294
  */
4262
4295
  var chat;
4263
4296
  (function (chat) {
4264
4297
  /**
4265
- * @hidden
4266
- * Hide from docs
4267
- * --------------
4268
4298
  * Allows the user to open a chat with a single user and allows
4269
4299
  * for the user to specify the message they wish to send.
4270
4300
  *
4271
- *@param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
4301
+ * @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
4272
4302
  *
4273
4303
  * @returns Promise resolved upon completion
4274
4304
  */
4275
4305
  function openChat(openChatRequest) {
4276
4306
  return new Promise(function (resolve) {
4277
4307
  ensureInitialized(FrameContexts.content);
4278
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4279
- members: openChatRequest.user,
4280
- message: openChatRequest.message,
4281
- });
4282
- resolve(sendPromise);
4308
+ if (runtime.isLegacyTeams) {
4309
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat([openChatRequest.user], undefined /*topic*/, openChatRequest.message)));
4310
+ }
4311
+ else {
4312
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4313
+ members: openChatRequest.user,
4314
+ message: openChatRequest.message,
4315
+ });
4316
+ resolve(sendPromise);
4317
+ }
4283
4318
  });
4284
4319
  }
4285
4320
  chat.openChat = openChat;
4286
4321
  /**
4287
- * @hidden
4288
- * Hide from docs
4289
- * --------------
4290
4322
  * Allows the user to create a chat with multiple users (2+) and allows
4291
4323
  * for the user to specify a message and name the topic of the conversation. If
4292
4324
  * only 1 user is provided into users array default back to origin openChat.
@@ -4309,12 +4341,17 @@ var chat;
4309
4341
  }
4310
4342
  else {
4311
4343
  ensureInitialized(FrameContexts.content);
4312
- var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4313
- members: openChatRequest.users,
4314
- message: openChatRequest.message,
4315
- topic: openChatRequest.topic,
4316
- });
4317
- resolve(sendPromise);
4344
+ if (runtime.isLegacyTeams) {
4345
+ resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsDeepLinkForChat(openChatRequest.users, openChatRequest.topic, openChatRequest.message)));
4346
+ }
4347
+ else {
4348
+ var sendPromise = sendAndHandleStatusAndReason('chat.openChat', {
4349
+ members: openChatRequest.users,
4350
+ message: openChatRequest.message,
4351
+ topic: openChatRequest.topic,
4352
+ });
4353
+ resolve(sendPromise);
4354
+ }
4318
4355
  }
4319
4356
  });
4320
4357
  }