@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
2 lines (1 loc) • 2.21 kB
JavaScript
import{__awaiter as e}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{callFunctionInHostAndHandleResponse as t}from"../../internal/communication.js";import{registerHandlerHelper as n}from"../../internal/handlers.js";import{ensureInitialized as o}from"../../internal/internalAPIs.js";import{ResponseHandler as r}from"../../internal/responseHandler.js";import{getApiVersionTag as s}from"../../internal/telemetry.js";import{FrameContexts as i}from"../../public/constants.js";import{isSdkError as l}from"../../public/interfaces.js";import{runtime as c}from"../../public/runtime.js";import{SidePanelErrorCode as u,SidePanelErrorImpl as p}from"./sidePanelInterfaces.js";const a="v2";function d(){var e;return o(c)&&!!(null===(e=c.supports.copilot)||void 0===e?void 0:e.sidePanel)}function m(e){if("object"!=typeof e||null===e)return!1;const t=e;return Object.values(u).includes(t.errorCode)&&(void 0===t.message||"string"==typeof t.message)||l(e)}function f(n){return e(this,void 0,void 0,(function*(){o(c);const e=n?[new b(n)]:[];return t("copilot.sidePanel.getContent",e,new C,s(a,"copilot.sidePanel.getContent"),m)}))}function j(n){return e(this,void 0,void 0,(function*(){o(c);const e=n?[new g(n)]:[];return t("copilot.sidePanel.preCheckUserConsent",e,new P,s(a,"copilot.sidePanel.preCheckUserConsent"),m)}))}function h(e){n(s(a,"copilot.sidePanel.registerUserActionContentSelect"),"copilot.sidePanel.userActionContentSelect",e,[i.content],(()=>{if(!d())throw v}))}const v=new p(u.NotSupportedOnPlatform,"This API is not supported on the current platform.");class C extends r{validate(e){return null!==e&&"object"==typeof e}deserialize(e){return e}}class P extends r{validate(e){return null!==e&&"object"==typeof e}deserialize(e){return e}}class b{constructor(e){this.contentRequest=e}serialize(){return this.contentRequest}}class g{constructor(e){this.userConsentRequest=e}serialize(){return this.userConsentRequest}}export{v as copilotSidePanelNotSupportedOnPlatformError,f as getContent,m as isResponseAReportableError,d as isSupported,j as preCheckUserConsent,h as registerUserActionContentSelect};