@microsoft/teams-js 2.36.0 → 2.37.0-beta.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.
@@ -18,12 +18,14 @@ import { AppEligibilityInformation } from '../../public/interfaces';
18
18
  */
19
19
  export declare function isSupported(): boolean;
20
20
  /**
21
+ *
22
+ * @param forceRefresh - boolean to represent whether to force refresh the eligibility information
23
+ * @returns the copilot eligibility information about the user
24
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
25
+ *
21
26
  * @hidden
22
27
  * @internal
23
28
  * Limited to Microsoft-internal use
24
29
  * @beta
25
- * @returns the copilot eligibility information about the user
26
- *
27
- * @throws Error if {@linkcode app.initialize} has not successfully completed
28
30
  */
29
- export declare function getEligibilityInfo(): Promise<AppEligibilityInformation>;
31
+ export declare function getEligibilityInfo(forceRefresh?: boolean): Promise<AppEligibilityInformation>;
@@ -4,7 +4,6 @@
4
4
  *
5
5
  * @throws Error if {@linkcode app.initialize} has not successfully completed
6
6
  *
7
- * @beta
8
7
  */
9
8
  export declare function isNAAChannelRecommended(): boolean;
10
9
  /**
@@ -1 +1 @@
1
- import{ensureInitialized as t}from"./internalAPIs.js";import{FrameContexts as e,errorNotSupportedOnPlatform as r,DialogDimension as o}from"../public/constants.js";import{runtime as s}from"../public/runtime.js";import{sendMessageToParent as i}from"./communication.js";import{GlobalVars as a}from"./globalVars.js";import{registerHandler as n,removeHandler as l}from"./handlers.js";import{getApiVersionTag as m}from"./telemetry.js";import{isSupported as u}from"../public/dialog/update.js";import{isSupported as c,getDialogInfoFromUrlDialogInfo as p,getDialogInfoFromBotUrlDialogInfo as f}from"../public/dialog/url/url.js";import{isSupported as g}from"../public/dialog/url/bot.js";const d="v2";function h(o,a){if(t(s,e.content,e.sidePanel,e.task,e.meetingStage),!u())throw r;i(o,"tasks.updateTask",[a])}function k(o,a,u,f){if(t(s,e.content,e.sidePanel,e.meetingStage),!c())throw r;f&&n(m(d,"dialog.url.registerMessageForParentHandler"),"messageForParent",f);const g=p(a);i(o,"tasks.startTask",[g],((t,e)=>{null==u||u({err:t,result:e}),l("messageForParent")}))}function j(o,a,u,c){if(t(s,e.content,e.sidePanel,e.meetingStage),!g())throw r;c&&n(m(d,"dialog.url.bot.registerMessageForParentHandler"),"messageForParent",c);const p=f(a);i(o,"tasks.startTask",[p],((t,e)=>{null==u||u({err:t,result:e}),l("messageForParent")}))}function P(o,a,n){if(t(s,e.task),!c())throw r;i(o,"tasks.completeTask",[a,n?Array.isArray(n)?n:[n]:[]])}function b(t){return{card:t.card,height:t.size?t.size.height:o.Small,width:t.size?t.size.width:o.Small,title:t.title}}function F(t){const e=b(t);return e.completionBotId=t.completionBotId,e}const S=[];function w(t){a.frameContext&&(a.frameContext===e.task?S.push(t):l("messageForChild"))}export{j as botUrlOpenHelper,d as dialogTelemetryVersionNumber,b as getDialogInfoFromAdaptiveCardDialogInfo,F as getDialogInfoFromBotAdaptiveCardDialogInfo,w as handleDialogMessage,S as storedMessages,h as updateResizeHelper,k as urlOpenHelper,P as urlSubmitHelper};
1
+ import{ensureInitialized as t}from"./internalAPIs.js";import{FrameContexts as e,errorNotSupportedOnPlatform as o,DialogDimension as r}from"../public/constants.js";import{runtime as s}from"../public/runtime.js";import{sendMessageToParent as i}from"./communication.js";import{GlobalVars as n}from"./globalVars.js";import{registerHandler as a,removeHandler as l}from"./handlers.js";import{getApiVersionTag as m}from"./telemetry.js";import{isSupported as c}from"../public/dialog/update.js";import{isSupported as u,getDialogInfoFromUrlDialogInfo as d,getDialogInfoFromBotUrlDialogInfo as g}from"../public/dialog/url/url.js";import{isSupported as f}from"../public/dialog/url/bot.js";const p="v2";function h(r,n){if(t(s,e.content,e.sidePanel,e.task,e.meetingStage),!c())throw o;i(r,"tasks.updateTask",[n])}function b(r,n,c,g){if(t(s,e.content,e.sidePanel,e.meetingStage),!u())throw o;g&&a(m(p,"dialog.url.registerMessageForParentHandler"),"messageForParent",g);const f=d(n);i(r,"tasks.startTask",[f],((t,e)=>{null==c||c({err:t,result:e}),l("messageForParent")}))}function k(r,n,c,u){if(t(s,e.content,e.sidePanel,e.meetingStage),!f())throw o;u&&a(m(p,"dialog.url.bot.registerMessageForParentHandler"),"messageForParent",u);const d=g(n);i(r,"tasks.startTask",[d],((t,e)=>{null==c||c({err:t,result:e}),l("messageForParent")}))}function j(r,a,l){if(t(s,e.content,e.task),!u())throw o;n.frameContext===e.content&&console.warn("dialog.submit should not be called from FrameContext.content.\nIf dialog.submit was called from inside the dialog, please disregard this message.\nThis issue occurs due to a bug in Teams mobile where the dialog is incorrectly identified as being in the content FrameContext.\nWe are working to resolve this."),i(r,"tasks.completeTask",[a,l?Array.isArray(l)?l:[l]:[]])}function w(t){return{card:t.card,height:t.size?t.size.height:r.Small,width:t.size?t.size.width:r.Small,title:t.title}}function P(t){const e=w(t);return e.completionBotId=t.completionBotId,e}const F=[];function S(t){n.frameContext&&(n.frameContext===e.task?F.push(t):l("messageForChild"))}export{k as botUrlOpenHelper,p as dialogTelemetryVersionNumber,w as getDialogInfoFromAdaptiveCardDialogInfo,P as getDialogInfoFromBotAdaptiveCardDialogInfo,S as handleDialogMessage,F as storedMessages,h as updateResizeHelper,b as urlOpenHelper,j as urlSubmitHelper};
@@ -1 +1 @@
1
- import{__awaiter as i}from"../../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{sendAndUnwrap as o}from"../../internal/communication.js";import{ensureInitialized as t}from"../../internal/internalAPIs.js";import{getLogger as r,getApiVersionTag as e}from"../../internal/telemetry.js";import{errorNotSupportedOnPlatform as n}from"../../public/constants.js";import{isSdkError as l}from"../../public/interfaces.js";import{runtime as s}from"../../public/runtime.js";const a=r("copilot");function p(){var i,o;return t(s)&&(!!(null===(i=s.hostVersionsInfo)||void 0===i?void 0:i.appEligibilityInformation)||!!(null===(o=s.supports.copilot)||void 0===o?void 0:o.eligibility))}function u(){var r,u;return i(this,void 0,void 0,(function*(){if(t(s),!p())throw new Error(`Error code: ${n.errorCode}, message: Not supported on platform`);if(null===(r=s.hostVersionsInfo)||void 0===r?void 0:r.appEligibilityInformation)return a("Eligibility information is already available on runtime."),s.hostVersionsInfo.appEligibilityInformation;a("Eligibility information is not available on runtime. Requesting from host.");const i=yield o(e("v2","copilot.eligibility.getEligibilityInfo"),"copilot.eligibility.getEligibilityInfo");if(l(i))throw new Error(`Error code: ${i.errorCode}, message: ${null!==(u=i.message)&&void 0!==u?u:"Failed to get eligibility information from the host."}`);if(!function(i){if(void 0===i.ageGroup||void 0===i.cohort||void 0===i.userClassification||void 0===i.isCopilotEligible||void 0===i.isCopilotEnabledRegion||void 0===i.isOptedOutByAdmin||i.featureSet&&(void 0===i.featureSet.serverFeatures||void 0===i.featureSet.uxFeatures))return!1;return!0}(i))throw new Error("Error deserializing eligibility information");return i}))}export{u as getEligibilityInfo,p as isSupported};
1
+ import{__awaiter as i}from"../../../../../node_modules/.pnpm/@rollup_plugin-typescript@11.1.6_rollup@4.24.4_tslib@2.6.3_typescript@4.9.5/node_modules/tslib/tslib.es6.js";import{sendAndUnwrap as o}from"../../internal/communication.js";import{ensureInitialized as t}from"../../internal/internalAPIs.js";import{getLogger as r,getApiVersionTag as e}from"../../internal/telemetry.js";import{errorNotSupportedOnPlatform as n}from"../../public/constants.js";import{isSdkError as l}from"../../public/interfaces.js";import{runtime as s}from"../../public/runtime.js";const a=r("copilot");function p(){var i,o;return t(s)&&(!!(null===(i=s.hostVersionsInfo)||void 0===i?void 0:i.appEligibilityInformation)||!!(null===(o=s.supports.copilot)||void 0===o?void 0:o.eligibility))}function u(r){var u,m;return i(this,void 0,void 0,(function*(){if(t(s),!p())throw new Error(`Error code: ${n.errorCode}, message: Not supported on platform`);if((null===(u=s.hostVersionsInfo)||void 0===u?void 0:u.appEligibilityInformation)&&!r)return a("Eligibility information is already available on runtime."),s.hostVersionsInfo.appEligibilityInformation;a("Eligibility information is not available on runtime. Requesting from host.");const i=yield o(e("v2","copilot.eligibility.getEligibilityInfo"),"copilot.eligibility.getEligibilityInfo",r);if(l(i))throw new Error(`Error code: ${i.errorCode}, message: ${null!==(m=i.message)&&void 0!==m?m:"Failed to get eligibility information from the host."}`);if(!function(i){if(void 0===i.ageGroup||void 0===i.cohort||void 0===i.userClassification||void 0===i.isCopilotEligible||void 0===i.isCopilotEnabledRegion||void 0===i.isOptedOutByAdmin||i.featureSet&&(void 0===i.featureSet.serverFeatures||void 0===i.featureSet.uxFeatures))return!1;return!0}(i))throw new Error("Error deserializing eligibility information");return i}))}export{u as getEligibilityInfo,p as isSupported};
@@ -1 +1 @@
1
- const o="2.36.0";export{o as version};
1
+ const t="2.37.0-beta.0";export{t as version};
@@ -4535,7 +4535,7 @@ function isSerializable(arg) {
4535
4535
  * @hidden
4536
4536
  * Package version.
4537
4537
  */
4538
- const version = "2.36.0";
4538
+ const version = "2.37.0-beta.0";
4539
4539
 
4540
4540
  ;// ./src/public/featureFlags.ts
4541
4541
  // All build feature flags are defined inside this object. Any build feature flag must have its own unique getter and setter function. This pattern allows for client apps to treeshake unused code and avoid including code guarded by this feature flags in the final bundle. If this property isn't desired, use the below runtime feature flags object.
@@ -5753,6 +5753,10 @@ function getDialogInfoFromBotUrlDialogInfo(botUrlDialogInfo) {
5753
5753
  * v2 APIs telemetry file: All of APIs in this capability file should send out API version v2 ONLY
5754
5754
  */
5755
5755
  const dialogTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
5756
+ const dialogSubmitWarning = 'dialog.submit should not be called from FrameContext.content.' +
5757
+ '\nIf dialog.submit was called from inside the dialog, please disregard this message.' +
5758
+ '\nThis issue occurs due to a bug in Teams mobile where the dialog is incorrectly identified as being in the content FrameContext.' +
5759
+ '\nWe are working to resolve this.';
5756
5760
  function updateResizeHelper(apiVersionTag, dimensions) {
5757
5761
  ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.task, FrameContexts.meetingStage);
5758
5762
  if (!update_isSupported()) {
@@ -5789,10 +5793,17 @@ function botUrlOpenHelper(apiVersionTag, urlDialogInfo, submitHandler, messageFr
5789
5793
  });
5790
5794
  }
5791
5795
  function urlSubmitHelper(apiVersionTag, result, appIds) {
5792
- ensureInitialized(runtime, FrameContexts.task);
5796
+ // FrameContext content should not be here because dialog.submit can be called only from inside of a dialog (FrameContext task)
5797
+ // but it's here because Teams mobile incorrectly returns FrameContext.content when calling app.getFrameContext().
5798
+ // FrameContexts.content will be removed once the bug is fixed.
5799
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
5793
5800
  if (!url_isSupported()) {
5794
5801
  throw errorNotSupportedOnPlatform;
5795
5802
  }
5803
+ // If dialog.submit is called from frameContext.content, warn the user, so they don't take dependency on this behavior
5804
+ if (GlobalVars.frameContext === FrameContexts.content) {
5805
+ console.warn(dialogSubmitWarning);
5806
+ }
5796
5807
  // Send tasks.completeTask instead of tasks.submitTask message for backward compatibility with Mobile clients
5797
5808
  sendMessageToParent(apiVersionTag, 'tasks.completeTask', [
5798
5809
  result,
@@ -9307,15 +9318,17 @@ function eligibility_isSupported() {
9307
9318
  (!!((_a = runtime.hostVersionsInfo) === null || _a === void 0 ? void 0 : _a.appEligibilityInformation) || !!((_b = runtime.supports.copilot) === null || _b === void 0 ? void 0 : _b.eligibility)));
9308
9319
  }
9309
9320
  /**
9321
+ *
9322
+ * @param forceRefresh - boolean to represent whether to force refresh the eligibility information
9323
+ * @returns the copilot eligibility information about the user
9324
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
9325
+ *
9310
9326
  * @hidden
9311
9327
  * @internal
9312
9328
  * Limited to Microsoft-internal use
9313
9329
  * @beta
9314
- * @returns the copilot eligibility information about the user
9315
- *
9316
- * @throws Error if {@linkcode app.initialize} has not successfully completed
9317
9330
  */
9318
- function getEligibilityInfo() {
9331
+ function getEligibilityInfo(forceRefresh) {
9319
9332
  var _a, _b;
9320
9333
  return eligibility_awaiter(this, void 0, void 0, function* () {
9321
9334
  ensureInitialized(runtime);
@@ -9323,13 +9336,13 @@ function getEligibilityInfo() {
9323
9336
  throw new Error(`Error code: ${errorNotSupportedOnPlatform.errorCode}, message: Not supported on platform`);
9324
9337
  }
9325
9338
  // Return the eligibility information if it is already available
9326
- if ((_a = runtime.hostVersionsInfo) === null || _a === void 0 ? void 0 : _a.appEligibilityInformation) {
9339
+ if (((_a = runtime.hostVersionsInfo) === null || _a === void 0 ? void 0 : _a.appEligibilityInformation) && !forceRefresh) {
9327
9340
  eligibility_copilotLogger('Eligibility information is already available on runtime.');
9328
9341
  return runtime.hostVersionsInfo.appEligibilityInformation;
9329
9342
  }
9330
9343
  eligibility_copilotLogger('Eligibility information is not available on runtime. Requesting from host.');
9331
9344
  // Send message to host SDK to get eligibility information
9332
- const response = yield sendAndUnwrap(getApiVersionTag(eligibility_copilotTelemetryVersionNumber, "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */), "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */);
9345
+ const response = yield sendAndUnwrap(getApiVersionTag(eligibility_copilotTelemetryVersionNumber, "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */), "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */, forceRefresh);
9333
9346
  if (isSdkError(response)) {
9334
9347
  throw new Error(`Error code: ${response.errorCode}, message: ${(_b = response.message) !== null && _b !== void 0 ? _b : 'Failed to get eligibility information from the host.'}`);
9335
9348
  }
@@ -14907,7 +14920,6 @@ var TrustedOriginAction;
14907
14920
  *
14908
14921
  * @throws Error if {@linkcode app.initialize} has not successfully completed
14909
14922
  *
14910
- * @beta
14911
14923
  */
14912
14924
  function isNAAChannelRecommended() {
14913
14925
  var _a;