@microsoft/teams-js 2.26.0-beta.2 → 2.27.0-beta.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.25.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.26.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.25.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-6royw0i5cEmf/8pzbTX9dVy1pjjJA8PQOaQbGvoL/m39OdjrlcWluhQZxqy5KbJA"
48
+ src="https://res.cdn.office.net/teams-js/2.26.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-gqPg5qCjdUgTGRZ/stLskrnJllL5h5+f4kTqvxVqtl2FdT7PVRa9Q7zq4gFlZ7bO"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.25.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.26.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -488,6 +488,45 @@ export namespace conversations {
488
488
  function isSupported(): boolean;
489
489
  }
490
490
 
491
+ /**
492
+ * @beta
493
+ * @hidden
494
+ * Namespace to delegate copilot app specific APIs
495
+ * @internal
496
+ * Limited to Microsoft-internal use
497
+ */
498
+ export namespace copilot {
499
+ /**
500
+ * @beta
501
+ * @hidden
502
+ * User information required by specific apps
503
+ * @internal
504
+ * Limited to Microsoft-internal use
505
+ */
506
+ namespace eligibility {
507
+ /**
508
+ * @hidden
509
+ * @internal
510
+ * Limited to Microsoft-internal use
511
+ * @beta
512
+ * @returns boolean to represent whether copilot.eligibility capability is supported
513
+ *
514
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
515
+ */
516
+ function isSupported(): boolean;
517
+ /**
518
+ * @hidden
519
+ * @internal
520
+ * Limited to Microsoft-internal use
521
+ * @beta
522
+ * @returns the copilot eligibility information about the user
523
+ *
524
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
525
+ */
526
+ function getEligibilityInfo(): AppEligibilityInformation;
527
+ }
528
+ }
529
+
491
530
  /**
492
531
  * @hidden
493
532
  * Namespace to delegate authentication and message extension requests to the host
@@ -4501,6 +4540,7 @@ export enum DevicePermission {
4501
4540
  /** @hidden */
4502
4541
  export interface HostVersionsInfo {
4503
4542
  adaptiveCardSchemaVersion?: AdaptiveCardVersion;
4543
+ appEligibilityInformation?: AppEligibilityInformation;
4504
4544
  }
4505
4545
  /**
4506
4546
  * Represents the major and minor versions of the Adaptive Card schema in the current host
@@ -4511,6 +4551,146 @@ export interface AdaptiveCardVersion {
4511
4551
  /** Represents the minor version number. */
4512
4552
  minorVersion: number;
4513
4553
  }
4554
+ /**
4555
+ * @hidden
4556
+ * Eligibility Information for the app user.
4557
+ *
4558
+ * @beta
4559
+ */
4560
+ export interface AppEligibilityInformation {
4561
+ /**
4562
+ * Describes the user’s age group, which can have implications on which product they are able to use.
4563
+ */
4564
+ ageGroup: LegalAgeGroupClassification | null;
4565
+ /**
4566
+ * Describes the user’s chat experience based on their eligible licenses & their tenant’s eligible licenses.
4567
+ * A user will be in at most one cohort.
4568
+ */
4569
+ cohort: Cohort | null;
4570
+ /**
4571
+ * Indicates that the user is eligible for Microsoft Entra ID Authenticated Copilot experience.
4572
+ */
4573
+ isCopilotEligible: boolean;
4574
+ /**
4575
+ * Implementation may change to be based on tenant-home region rather than IP.
4576
+ */
4577
+ isCopilotEnabledRegion: boolean;
4578
+ /**
4579
+ * Indicates if the tenant admin has opted the user out of Copilot.
4580
+ */
4581
+ isOptedOutByAdmin: boolean;
4582
+ /**
4583
+ * Education Eligibility Information for the app user
4584
+ */
4585
+ userClassification: UserClassification;
4586
+ }
4587
+ /**
4588
+ * @hidden
4589
+ *
4590
+ * @beta
4591
+ */
4592
+ export interface UserClassificationWithEduType {
4593
+ /**
4594
+ * For EDU tenants only. Indicates if the tenant is higher ed or K12.
4595
+ */
4596
+ eduType: EduType;
4597
+ /**
4598
+ * Describes additional traits of the user that contribute to FRE experience, etc.
4599
+ */
4600
+ persona: Persona.Faculty | Persona.Student;
4601
+ }
4602
+ /**
4603
+ * @hidden
4604
+ *
4605
+ * @beta
4606
+ */
4607
+ export interface UserClassificationWithOtherType {
4608
+ persona: Persona.Other;
4609
+ }
4610
+ /**
4611
+ * @hidden
4612
+ *
4613
+ * @beta
4614
+ */
4615
+ export type UserClassification = UserClassificationWithEduType | UserClassificationWithOtherType;
4616
+ /**
4617
+ * @hidden
4618
+ *
4619
+ * @beta
4620
+ */
4621
+ export enum Cohort {
4622
+ BCAIS = "bcais",
4623
+ BCWAF = "bcwaf",
4624
+ BCWBF = "bcwbf"
4625
+ }
4626
+ /**
4627
+ * @hidden
4628
+ *
4629
+ * @beta
4630
+ */
4631
+ export enum Persona {
4632
+ /**
4633
+ * User has a faculty license
4634
+ */
4635
+ Faculty = "faculty",
4636
+ /**
4637
+ * User has a student license
4638
+ */
4639
+ Student = "student",
4640
+ /**
4641
+ * When user is not a faculty or student
4642
+ */
4643
+ Other = "other"
4644
+ }
4645
+ /**
4646
+ * @hidden
4647
+ *
4648
+ * @beta
4649
+ */
4650
+ export enum LegalAgeGroupClassification {
4651
+ /**
4652
+ * The user is considered an adult based on the age-related regulations of their country or region.
4653
+ */
4654
+ Adult = "adult",
4655
+ /**
4656
+ * The user is a minor but is from a country or region that has no age-related regulations.
4657
+ */
4658
+ MinorNoParentalConsentRequired = "minorNoParentalConsentRequired",
4659
+ /**
4660
+ * Reserved for future use
4661
+ */
4662
+ MinorWithoutParentalConsent = "minorWithoutParentalConsent",
4663
+ /**
4664
+ * The user is considered a minor based on the age-related regulations of their country or region, and the administrator
4665
+ * of the account obtained appropriate consent from a parent or guardian.
4666
+ */
4667
+ MinorWithParentalConsent = "minorWithParentalConsent",
4668
+ /**
4669
+ * The user is from a country or region that has additional age-related regulations, such as the United States,
4670
+ * United Kingdom, European Union, or South Korea, and the user's age is between a minor and an adult age
4671
+ * (as stipulated based on country or region). Generally, this means that teenagers are considered as notAdult in regulated countries.
4672
+ */
4673
+ NonAdult = "nonAdult"
4674
+ }
4675
+ /**
4676
+ * @hidden
4677
+ *
4678
+ * @beta
4679
+ */
4680
+ export enum EduType {
4681
+ /**
4682
+ * User is from a tenant labeled as “HigherEd”
4683
+ */
4684
+ HigherEducation = "higherEducation",
4685
+ /**
4686
+ * User is from a tenant labeled as “K12”
4687
+ */
4688
+ K12 = "k12",
4689
+ /**
4690
+ * User is from a tenant labeled as “Others” (e.g. research institutions)
4691
+ */
4692
+ Other = "other"
4693
+ }
4514
4694
  /**
4515
4695
  * Currently supported Mime type
4516
4696
  */
@@ -9111,6 +9291,7 @@ export namespace webStorage {
9111
9291
  */
9112
9292
  function isSupported(): boolean;
9113
9293
  }
9294
+ export function clearWebStorageCachedHostNameForTests(): void;
9114
9295
 
9115
9296
  /**
9116
9297
  * Used to interact with call functionality, including starting calls with other users.
@@ -1019,6 +1019,7 @@ __webpack_require__.d(__webpack_exports__, {
1019
1019
  chat: () => (/* reexport */ chat),
1020
1020
  clipboard: () => (/* reexport */ clipboard),
1021
1021
  conversations: () => (/* reexport */ conversations),
1022
+ copilot: () => (/* reexport */ copilot),
1022
1023
  dialog: () => (/* reexport */ dialog),
1023
1024
  enablePrintCapability: () => (/* reexport */ enablePrintCapability),
1024
1025
  executeDeepLink: () => (/* reexport */ executeDeepLink),
@@ -2376,6 +2377,89 @@ var DevicePermission;
2376
2377
  DevicePermission["GeoLocation"] = "geolocation";
2377
2378
  DevicePermission["Media"] = "media";
2378
2379
  })(DevicePermission || (DevicePermission = {}));
2380
+ /**
2381
+ * @hidden
2382
+ *
2383
+ * @beta
2384
+ */
2385
+ var Cohort;
2386
+ (function (Cohort) {
2387
+ Cohort["BCAIS"] = "bcais";
2388
+ Cohort["BCWAF"] = "bcwaf";
2389
+ Cohort["BCWBF"] = "bcwbf";
2390
+ })(Cohort || (Cohort = {}));
2391
+ /**
2392
+ * @hidden
2393
+ *
2394
+ * @beta
2395
+ */
2396
+ var Persona;
2397
+ (function (Persona) {
2398
+ /**
2399
+ * User has a faculty license
2400
+ */
2401
+ Persona["Faculty"] = "faculty";
2402
+ /**
2403
+ * User has a student license
2404
+ */
2405
+ Persona["Student"] = "student";
2406
+ /**
2407
+ * When user is not a faculty or student
2408
+ */
2409
+ Persona["Other"] = "other";
2410
+ })(Persona || (Persona = {}));
2411
+ /**
2412
+ * @hidden
2413
+ *
2414
+ * @beta
2415
+ */
2416
+ // https://learn.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#legalagegroupclassification-values
2417
+ var LegalAgeGroupClassification;
2418
+ (function (LegalAgeGroupClassification) {
2419
+ /**
2420
+ * The user is considered an adult based on the age-related regulations of their country or region.
2421
+ */
2422
+ LegalAgeGroupClassification["Adult"] = "adult";
2423
+ /**
2424
+ * The user is a minor but is from a country or region that has no age-related regulations.
2425
+ */
2426
+ LegalAgeGroupClassification["MinorNoParentalConsentRequired"] = "minorNoParentalConsentRequired";
2427
+ /**
2428
+ * Reserved for future use
2429
+ */
2430
+ LegalAgeGroupClassification["MinorWithoutParentalConsent"] = "minorWithoutParentalConsent";
2431
+ /**
2432
+ * The user is considered a minor based on the age-related regulations of their country or region, and the administrator
2433
+ * of the account obtained appropriate consent from a parent or guardian.
2434
+ */
2435
+ LegalAgeGroupClassification["MinorWithParentalConsent"] = "minorWithParentalConsent";
2436
+ /**
2437
+ * The user is from a country or region that has additional age-related regulations, such as the United States,
2438
+ * United Kingdom, European Union, or South Korea, and the user's age is between a minor and an adult age
2439
+ * (as stipulated based on country or region). Generally, this means that teenagers are considered as notAdult in regulated countries.
2440
+ */
2441
+ LegalAgeGroupClassification["NonAdult"] = "nonAdult";
2442
+ })(LegalAgeGroupClassification || (LegalAgeGroupClassification = {}));
2443
+ /**
2444
+ * @hidden
2445
+ *
2446
+ * @beta
2447
+ */
2448
+ var EduType;
2449
+ (function (EduType) {
2450
+ /**
2451
+ * User is from a tenant labeled as “HigherEd”
2452
+ */
2453
+ EduType["HigherEducation"] = "higherEducation";
2454
+ /**
2455
+ * User is from a tenant labeled as “K12”
2456
+ */
2457
+ EduType["K12"] = "k12";
2458
+ /**
2459
+ * User is from a tenant labeled as “Others” (e.g. research institutions)
2460
+ */
2461
+ EduType["Other"] = "other";
2462
+ })(EduType || (EduType = {}));
2379
2463
  /**
2380
2464
  * Currently supported Mime type
2381
2465
  */
@@ -3087,6 +3171,26 @@ function isRuntimeInitialized(runtime) {
3087
3171
  }
3088
3172
  }
3089
3173
  let runtime = _uninitializedRuntime;
3174
+ /**
3175
+ * This object is used as the default runtime for versions of Teams which don't pass a runtime object during
3176
+ * initialization. If the host DOES pass a runtime object during init, then this object is not used.
3177
+ *
3178
+ * In practice, this is used in Teams V1 and ALL versions of Teams mobile since they are the only hosts
3179
+ * that don't pass a runtime object during initialization (since they don't use the host SDK).
3180
+ *
3181
+ * If there are certain versions of Teams V1 or Teams mobile which support a capability but not ALL
3182
+ * versions, then you should modify the mapTeamsVersionToSupportedCapabilities structure for that purpose. That
3183
+ * structure allows you to specify particular versions on particular platforms that support certain capabilities.
3184
+ * This structure is version agnostic.
3185
+ *
3186
+ * In practice, if you are adding a new capability, you are likely only to need to update mapTeamsVersionToSupportedCapabilities
3187
+ * and NOT this structure, as this structure is effectively only used for capabilities that have existed "forever."
3188
+ *
3189
+ * Remember that everything here all still ONLY applies to versions of Teams that don't pass a runtime object during
3190
+ * initialization -- if they do, then neither this object nor the mapTeamsVersionToSupportedCapabilities structure is
3191
+ * used -- all runtime capabilities are dynamically discovered at runtime in the case where the runtime object is passed
3192
+ * during initialization.
3193
+ */
3090
3194
  const versionAndPlatformAgnosticTeamsRuntimeConfig = {
3091
3195
  apiVersion: 4,
3092
3196
  isNAAChannelRecommended: false,
@@ -3225,6 +3329,11 @@ const upgradeChain = [
3225
3329
  },
3226
3330
  },
3227
3331
  ];
3332
+ /**
3333
+ * This structure is used for versions of Teams that don't pass a runtime object during initialization.
3334
+ * Please see the extensive comments in versionAndPlatformAgnosticTeamsRuntimeConfig for more information
3335
+ * on when and how to use this structure.
3336
+ */
3228
3337
  const mapTeamsVersionToSupportedCapabilities = {
3229
3338
  // 1.0.0 just signifies "these capabilities have practically always been supported." For some of these
3230
3339
  // we don't know what the real first version that supported them was -- but it was long enough ago that
@@ -3395,7 +3504,7 @@ const _minRuntimeConfigToUninitialize = {
3395
3504
  * @hidden
3396
3505
  * Package version.
3397
3506
  */
3398
- const version = "2.26.0-beta.2";
3507
+ const version = "2.27.0-beta.0";
3399
3508
 
3400
3509
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
3401
3510
 
@@ -7818,6 +7927,62 @@ var conversations;
7818
7927
  conversations.isSupported = isSupported;
7819
7928
  })(conversations || (conversations = {}));
7820
7929
 
7930
+ ;// CONCATENATED MODULE: ./src/private/copilot.ts
7931
+
7932
+
7933
+
7934
+ /**
7935
+ * @beta
7936
+ * @hidden
7937
+ * Namespace to delegate copilot app specific APIs
7938
+ * @internal
7939
+ * Limited to Microsoft-internal use
7940
+ */
7941
+ var copilot;
7942
+ (function (copilot) {
7943
+ /**
7944
+ * @beta
7945
+ * @hidden
7946
+ * User information required by specific apps
7947
+ * @internal
7948
+ * Limited to Microsoft-internal use
7949
+ */
7950
+ let eligibility;
7951
+ (function (eligibility) {
7952
+ /**
7953
+ * @hidden
7954
+ * @internal
7955
+ * Limited to Microsoft-internal use
7956
+ * @beta
7957
+ * @returns boolean to represent whether copilot.eligibility capability is supported
7958
+ *
7959
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
7960
+ */
7961
+ function isSupported() {
7962
+ var _a;
7963
+ return ensureInitialized(runtime) && !!((_a = runtime.hostVersionsInfo) === null || _a === void 0 ? void 0 : _a.appEligibilityInformation);
7964
+ }
7965
+ eligibility.isSupported = isSupported;
7966
+ /**
7967
+ * @hidden
7968
+ * @internal
7969
+ * Limited to Microsoft-internal use
7970
+ * @beta
7971
+ * @returns the copilot eligibility information about the user
7972
+ *
7973
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
7974
+ */
7975
+ function getEligibilityInfo() {
7976
+ ensureInitialized(runtime);
7977
+ if (!isSupported()) {
7978
+ throw errorNotSupportedOnPlatform;
7979
+ }
7980
+ return runtime.hostVersionsInfo.appEligibilityInformation;
7981
+ }
7982
+ eligibility.getEligibilityInfo = getEligibilityInfo;
7983
+ })(eligibility = copilot.eligibility || (copilot.eligibility = {}));
7984
+ })(copilot || (copilot = {}));
7985
+
7821
7986
  ;// CONCATENATED MODULE: ./src/private/externalAppAuthentication.ts
7822
7987
 
7823
7988
 
@@ -10812,6 +10977,7 @@ var videoEffectsEx;
10812
10977
 
10813
10978
 
10814
10979
 
10980
+
10815
10981
 
10816
10982
  ;// CONCATENATED MODULE: ./src/internal/deepLinkConstants.ts
10817
10983
  /**
@@ -14251,6 +14417,8 @@ var webStorage_awaiter = (undefined && undefined.__awaiter) || function (thisArg
14251
14417
 
14252
14418
 
14253
14419
 
14420
+
14421
+
14254
14422
  /**
14255
14423
  * Contains functionality enabling apps to query properties about how the host manages web storage (`Window.LocalStorage`)
14256
14424
  *
@@ -14273,10 +14441,33 @@ var webStorage;
14273
14441
  if (!isSupported()) {
14274
14442
  throw errorNotSupportedOnPlatform;
14275
14443
  }
14444
+ if (runtime.isLegacyTeams &&
14445
+ (GlobalVars.hostClientType === HostClientType.android ||
14446
+ GlobalVars.hostClientType === HostClientType.ios ||
14447
+ GlobalVars.hostClientType === HostClientType.ipados) &&
14448
+ (yield getHostName()) === HostName.teams) {
14449
+ // On Teams Mobile, they haven't yet implemented this capability. However, for compatibility reasons, we need
14450
+ // to act as if they do. If they did implement it, they would return true, so that's what we do here.
14451
+ // Getting Teams Mobile to implement this is a work-in-progress. Once they do implement it, we can remove this
14452
+ // whole if-block. Until then, we cannot send the message to them because they will not understand it.
14453
+ // Once they do implement it, this if-block will automatically not apply because runtime.isLegacyTeams will no
14454
+ // longer be true. So, we don't need to worry about removing this if block "at the right time". We can
14455
+ // just keep it here until Teams Mobile implements this capability and uses the host SDK everywhere, at which
14456
+ // point we can remove this whole if-block at our leisure.
14457
+ return true;
14458
+ }
14276
14459
  return yield sendAndUnwrap(getApiVersionTag("v2" /* ApiVersionNumber.V_2 */, "webStorage.isWebStorageClearedOnUserLogOut" /* ApiName.WebStorage_IsWebStorageClearedOnUserLogOut */), "webStorage.isWebStorageClearedOnUserLogOut" /* ApiName.WebStorage_IsWebStorageClearedOnUserLogOut */);
14277
14460
  });
14278
14461
  }
14279
14462
  webStorage.isWebStorageClearedOnUserLogOut = isWebStorageClearedOnUserLogOut;
14463
+ function getHostName() {
14464
+ return webStorage_awaiter(this, void 0, void 0, function* () {
14465
+ if (cachedHostName === null) {
14466
+ cachedHostName = (yield app.getContext()).app.host.name;
14467
+ }
14468
+ return cachedHostName;
14469
+ });
14470
+ }
14280
14471
  /**
14281
14472
  * Checks if webStorage capability is supported by the host
14282
14473
  * @returns boolean to represent whether the webStorage capability is supported
@@ -14290,6 +14481,12 @@ var webStorage;
14290
14481
  }
14291
14482
  webStorage.isSupported = isSupported;
14292
14483
  })(webStorage || (webStorage = {}));
14484
+ // It is safe to cache the host name because the host cannot change at runtime
14485
+ let cachedHostName = null;
14486
+ // ...except during unit tests, where we will change it at runtime regularly for testing purposes
14487
+ function clearWebStorageCachedHostNameForTests() {
14488
+ cachedHostName = null;
14489
+ }
14293
14490
 
14294
14491
  ;// CONCATENATED MODULE: ./src/public/call.ts
14295
14492