@microsoft/teamsfx 1.0.3-alpha.c580d88b2.0 → 1.0.3-alpha.dad1471c2.0

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.
@@ -325,6 +325,7 @@ function getUserInfoFromSsoToken(ssoToken) {
325
325
  const userInfo = {
326
326
  displayName: tokenObject.name,
327
327
  objectId: tokenObject.oid,
328
+ tenantId: tokenObject.tid,
328
329
  preferredUserName: "",
329
330
  };
330
331
  if (tokenObject.ver === "2.0") {
@@ -1880,6 +1881,32 @@ class TeamsFx {
1880
1881
 
1881
1882
  // Copyright (c) Microsoft Corporation.
1882
1883
  // Licensed under the MIT license.
1884
+ /**
1885
+ * The target type where the notification will be sent to.
1886
+ *
1887
+ * @remarks
1888
+ * - "Channel" means to a team channel. (By default, notification to a team will be sent to its "General" channel.)
1889
+ * - "Group" means to a group chat.
1890
+ * - "Person" means to a personal chat.
1891
+ */
1892
+ exports.NotificationTargetType = void 0;
1893
+ (function (NotificationTargetType) {
1894
+ /**
1895
+ * The notification will be sent to a team channel.
1896
+ * (By default, notification to a team will be sent to its "General" channel.)
1897
+ */
1898
+ NotificationTargetType["Channel"] = "Channel";
1899
+ /**
1900
+ * The notification will be sent to a group chat.
1901
+ */
1902
+ NotificationTargetType["Group"] = "Group";
1903
+ /**
1904
+ * The notification will be sent to a personal chat.
1905
+ */
1906
+ NotificationTargetType["Person"] = "Person";
1907
+ })(exports.NotificationTargetType || (exports.NotificationTargetType = {}));
1908
+
1909
+ // Copyright (c) Microsoft Corporation.
1883
1910
  /**
1884
1911
  * @internal
1885
1912
  */
@@ -1893,13 +1920,13 @@ function getTargetType(conversationReference) {
1893
1920
  var _a;
1894
1921
  const conversationType = (_a = conversationReference.conversation) === null || _a === void 0 ? void 0 : _a.conversationType;
1895
1922
  if (conversationType === "personal") {
1896
- return "Person";
1923
+ return exports.NotificationTargetType.Person;
1897
1924
  }
1898
1925
  else if (conversationType === "groupChat") {
1899
- return "Group";
1926
+ return exports.NotificationTargetType.Group;
1900
1927
  }
1901
1928
  else if (conversationType === "channel") {
1902
- return "Channel";
1929
+ return exports.NotificationTargetType.Channel;
1903
1930
  }
1904
1931
  else {
1905
1932
  return undefined;
@@ -2255,7 +2282,7 @@ class ConversationReferenceStore {
2255
2282
  *
2256
2283
  * @param target - the notification target.
2257
2284
  * @param text - the plain text message.
2258
- * @returns A `Promise` representing the asynchronous operation.
2285
+ * @returns the response of sending message.
2259
2286
  */
2260
2287
  function sendMessage(target, text) {
2261
2288
  return target.sendMessage(text);
@@ -2265,7 +2292,7 @@ function sendMessage(target, text) {
2265
2292
  *
2266
2293
  * @param target - the notification target.
2267
2294
  * @param card - the adaptive card raw JSON.
2268
- * @returns A `Promise` representing the asynchronous operation.
2295
+ * @returns the response of sending adaptive card message.
2269
2296
  */
2270
2297
  function sendAdaptiveCard(target, card) {
2271
2298
  return target.sendAdaptiveCard(card);
@@ -2290,7 +2317,7 @@ class Channel {
2290
2317
  /**
2291
2318
  * Notification target type. For channel it's always "Channel".
2292
2319
  */
2293
- this.type = "Channel";
2320
+ this.type = exports.NotificationTargetType.Channel;
2294
2321
  this.parent = parent;
2295
2322
  this.info = info;
2296
2323
  }
@@ -2298,32 +2325,40 @@ class Channel {
2298
2325
  * Send a plain text message.
2299
2326
  *
2300
2327
  * @param text - the plain text message.
2301
- * @returns A `Promise` representing the asynchronous operation.
2328
+ * @returns the response of sending message.
2302
2329
  */
2303
2330
  sendMessage(text) {
2304
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2305
- const conversation = yield this.newConversation(context);
2306
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2307
- yield ctx.sendActivity(text);
2331
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2332
+ const response = {};
2333
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2334
+ const conversation = yield this.newConversation(context);
2335
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2336
+ const res = yield ctx.sendActivity(text);
2337
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2338
+ }));
2308
2339
  }));
2309
- }));
2340
+ return response;
2341
+ });
2310
2342
  }
2311
2343
  /**
2312
2344
  * Send an adaptive card message.
2313
2345
  *
2314
2346
  * @param card - the adaptive card raw JSON.
2315
- * @returns A `Promise` representing the asynchronous operation.
2347
+ * @returns the response of sending adaptive card message.
2316
2348
  */
2317
2349
  sendAdaptiveCard(card) {
2318
2350
  return tslib.__awaiter(this, void 0, void 0, function* () {
2319
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2351
+ const response = {};
2352
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2320
2353
  const conversation = yield this.newConversation(context);
2321
2354
  yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2322
- yield ctx.sendActivity({
2355
+ const res = yield ctx.sendActivity({
2323
2356
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2324
2357
  });
2358
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2325
2359
  }));
2326
2360
  }));
2361
+ return response;
2327
2362
  });
2328
2363
  }
2329
2364
  /**
@@ -2358,7 +2393,7 @@ class Member {
2358
2393
  /**
2359
2394
  * Notification target type. For member it's always "Person".
2360
2395
  */
2361
- this.type = "Person";
2396
+ this.type = exports.NotificationTargetType.Person;
2362
2397
  this.parent = parent;
2363
2398
  this.account = account;
2364
2399
  }
@@ -2366,32 +2401,40 @@ class Member {
2366
2401
  * Send a plain text message.
2367
2402
  *
2368
2403
  * @param text - the plain text message.
2369
- * @returns A `Promise` representing the asynchronous operation.
2404
+ * @returns the response of sending message.
2370
2405
  */
2371
2406
  sendMessage(text) {
2372
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2373
- const conversation = yield this.newConversation(context);
2374
- yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2375
- yield ctx.sendActivity(text);
2407
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2408
+ const response = {};
2409
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2410
+ const conversation = yield this.newConversation(context);
2411
+ yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2412
+ const res = yield ctx.sendActivity(text);
2413
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2414
+ }));
2376
2415
  }));
2377
- }));
2416
+ return response;
2417
+ });
2378
2418
  }
2379
2419
  /**
2380
2420
  * Send an adaptive card message.
2381
2421
  *
2382
2422
  * @param card - the adaptive card raw JSON.
2383
- * @returns A `Promise` representing the asynchronous operation.
2423
+ * @returns the response of sending adaptive card message.
2384
2424
  */
2385
2425
  sendAdaptiveCard(card) {
2386
2426
  return tslib.__awaiter(this, void 0, void 0, function* () {
2387
- return this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2427
+ const response = {};
2428
+ yield this.parent.adapter.continueConversation(this.parent.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2388
2429
  const conversation = yield this.newConversation(context);
2389
2430
  yield this.parent.adapter.continueConversation(conversation, (ctx) => tslib.__awaiter(this, void 0, void 0, function* () {
2390
- yield ctx.sendActivity({
2431
+ const res = yield ctx.sendActivity({
2391
2432
  attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2392
2433
  });
2434
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2393
2435
  }));
2394
2436
  }));
2437
+ return response;
2395
2438
  });
2396
2439
  }
2397
2440
  /**
@@ -2442,25 +2485,35 @@ class TeamsBotInstallation {
2442
2485
  * Send a plain text message.
2443
2486
  *
2444
2487
  * @param text - the plain text message.
2445
- * @returns A `Promise` representing the asynchronous operation.
2488
+ * @returns the response of sending message.
2446
2489
  */
2447
2490
  sendMessage(text) {
2448
- return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2449
- yield context.sendActivity(text);
2450
- }));
2491
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2492
+ const response = {};
2493
+ yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2494
+ const res = yield context.sendActivity(text);
2495
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2496
+ }));
2497
+ return response;
2498
+ });
2451
2499
  }
2452
2500
  /**
2453
2501
  * Send an adaptive card message.
2454
2502
  *
2455
2503
  * @param card - the adaptive card raw JSON.
2456
- * @returns A `Promise` representing the asynchronous operation.
2504
+ * @returns the response of sending adaptive card message.
2457
2505
  */
2458
2506
  sendAdaptiveCard(card) {
2459
- return this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2460
- yield context.sendActivity({
2461
- attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2462
- });
2463
- }));
2507
+ return tslib.__awaiter(this, void 0, void 0, function* () {
2508
+ const response = {};
2509
+ yield this.adapter.continueConversation(this.conversationReference, (context) => tslib.__awaiter(this, void 0, void 0, function* () {
2510
+ const res = yield context.sendActivity({
2511
+ attachments: [botbuilder.CardFactory.adaptiveCard(card)],
2512
+ });
2513
+ response.id = res === null || res === void 0 ? void 0 : res.id;
2514
+ }));
2515
+ return response;
2516
+ });
2464
2517
  }
2465
2518
  /**
2466
2519
  * Get channels from this bot installation.