@microsoft/teams-js 2.32.0-beta.3 → 2.33.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.
- package/README.md +4 -4
- package/dist/esm/packages/teams-js/dts/internal/hostToAppTelemetry.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/internal/messageObjects.d.ts +1 -1
- package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +2 -1
- package/dist/esm/packages/teams-js/dts/private/copilot/copilot.d.ts +2 -1
- package/dist/esm/packages/teams-js/dts/private/copilot/customTelemetry.d.ts +23 -0
- package/dist/esm/packages/teams-js/dts/public/index.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/public/uuidObject.d.ts +24 -0
- package/dist/esm/packages/teams-js/src/index.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/communication.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/messageObjects.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/telemetry.js +1 -1
- package/dist/esm/packages/teams-js/src/private/copilot/copilot.js +1 -1
- package/dist/esm/packages/teams-js/src/private/copilot/customTelemetry.js +1 -0
- package/dist/esm/packages/teams-js/src/public/uuidObject.js +1 -0
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +80 -8
- package/dist/umd/MicrosoftTeams.js.map +1 -1
- package/dist/umd/MicrosoftTeams.min.js +1 -1
- package/dist/umd/MicrosoftTeams.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/packages/teams-js/dts/internal/uuidObject.d.ts +0 -11
- package/dist/esm/packages/teams-js/src/internal/uuidObject.js +0 -1
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.
|
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.33.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.
|
|
49
|
-
integrity="sha384-
|
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.33.0/js/MicrosoftTeams.min.js"
|
|
49
|
+
integrity="sha384-hCfPVLNt9JPTceReb/qZGZR7IbUaPeoExYnER2H//kiykKfhcVEMVQiCR0eAtCCs"
|
|
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.
|
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.33.0/dist/MicrosoftTeams.min.js"></script>
|
|
55
55
|
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Debugger } from 'debug';
|
|
2
|
+
import { UUID as MessageUUID } from '../public/uuidObject';
|
|
2
3
|
import { CallbackInformation } from './interfaces';
|
|
3
4
|
import { MessageRequest, MessageResponse } from './messageObjects';
|
|
4
|
-
import { UUID as MessageUUID } from './uuidObject';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
* Limited to Microsoft-internal use
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Debugger } from 'debug/src/browser';
|
|
2
|
-
import { UUID } from '
|
|
2
|
+
import { UUID } from '../public/uuidObject';
|
|
3
3
|
export declare const teamsJsInstanceIdentifier: UUID;
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -82,6 +82,7 @@ export declare const enum ApiName {
|
|
|
82
82
|
Conversations_OpenConversation = "conversations.openConversation",
|
|
83
83
|
Conversations_RegisterCloseConversationHandler = "conversations.registerCloseConversationHandler",
|
|
84
84
|
Conversations_RegisterStartConversationHandler = "conversations.registerStartConversationHandler",
|
|
85
|
+
Copilot_CustomTelemetry_SendCustomTelemetryData = "copilot.customTelemetry.sendCustomTelemetryData",
|
|
85
86
|
Copilot_Eligibility_GetEligibilityInfo = "copilot.eligibility.getEligibilityInfo",
|
|
86
87
|
Dialog_AdaptiveCard_Bot_Open = "dialog.adaptiveCard.bot.open",
|
|
87
88
|
Dialog_AdaptiveCard_Open = "dialog.adaptiveCard.open",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @beta
|
|
3
|
+
* @hidden
|
|
4
|
+
* User information required by specific apps
|
|
5
|
+
* @internal
|
|
6
|
+
* Limited to Microsoft-internal use
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { UUID } from '../../public/uuidObject';
|
|
10
|
+
/**
|
|
11
|
+
* Sends custom telemetry data to the host.
|
|
12
|
+
*
|
|
13
|
+
* @param { UUID } stageNameIdentifier - The stageName UUID identifier for the telemetry data.
|
|
14
|
+
* @param { number } [timestamp=getCurrentTimestamp() ?? Date.now()] - The timestamp of the telemetry data. Defaults to the current timestamp.
|
|
15
|
+
* @returns { Promise<void> } - promise resolves when the host SDK acknowledges that it has received the message.
|
|
16
|
+
* @throws { Error } - Throws an error if the app has not been successfully initialized or the host SDK returns an error as a response to this call
|
|
17
|
+
*
|
|
18
|
+
* @hidden
|
|
19
|
+
* @internal
|
|
20
|
+
* Limited to Microsoft-internal use
|
|
21
|
+
* @beta
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendCustomTelemetryData(stageNameIdentifier: UUID, timestamp?: number): Promise<void>;
|
|
@@ -38,6 +38,7 @@ export * as appInitialization from './appInitialization';
|
|
|
38
38
|
export * as thirdPartyCloudStorage from './thirdPartyCloudStorage';
|
|
39
39
|
export { callbackFunctionType, enablePrintCapability, executeDeepLink, executeDeepLinkOnCompleteFunctionType, getContext, getContextCallbackFunctionType, getMruTabInstances, getTabInstances, getTabInstancesCallbackFunctionType, initialize, initializeWithFrameContext, print, registerAppButtonClickHandler, registerAppButtonHoverEnterHandler, registerAppButtonHoverLeaveHandler, registerBackButtonHandler, registerBackButtonHandlerFunctionType, registerBeforeUnloadHandler, registerChangeSettingsHandler, registerFocusEnterHandler, registerFullScreenHandler, registerFullScreenHandlerFunctionType, registerOnLoadHandler, registerOnThemeChangeHandler, registerOnThemeChangeHandlerFunctionType, setFrameContext, shareDeepLink, } from './publicAPIs';
|
|
40
40
|
export { navigateBack, navigateCrossDomain, navigateToTab, onCompleteHandlerFunctionType, returnFocus, } from './navigation';
|
|
41
|
+
export { UUID } from './uuidObject';
|
|
41
42
|
export * as settings from './settings';
|
|
42
43
|
export * as tasks from './tasks';
|
|
43
44
|
export * as liveShare from './liveShareHost';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
* Limited to Microsoft-internal use
|
|
4
|
+
*
|
|
5
|
+
* Represents a UUID (Universally Unique Identifier) object.
|
|
6
|
+
* This class provides a way to generate, validate, and represent UUIDs as strings.
|
|
7
|
+
*/
|
|
8
|
+
export declare class UUID {
|
|
9
|
+
private readonly uuid;
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of the UUID class.
|
|
12
|
+
* If no UUID string is provided, a new UUID is generated.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} [uuid=generateGUID()] - The UUID string. Defaults to a newly generated UUID.
|
|
15
|
+
* @throws {Error} - Throws an error if the provided UUID is invalid.
|
|
16
|
+
*/
|
|
17
|
+
constructor(uuid?: string);
|
|
18
|
+
/**
|
|
19
|
+
* Returns the UUID as a string.
|
|
20
|
+
*
|
|
21
|
+
* @returns {string} - The UUID string.
|
|
22
|
+
*/
|
|
23
|
+
toString(): string;
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{NotificationTypes,UserSettingTypes,ViewerActionTypes}from"./private/interfaces.js";export{openFilePreview,registerCustomHandler,registerUserSettingsChangeHandler,sendCustomEvent,sendCustomMessage,uploadCustomApp}from"./private/privateAPIs.js";import*as r from"./private/logs.js";export{r as logs};import*as e from"./private/conversations.js";export{e as conversations};import*as o from"./private/copilot/copilot.js";export{o as copilot};import*as t from"./private/externalAppAuthentication.js";export{t as externalAppAuthentication};import*as p from"./private/externalAppAuthenticationForCEA.js";export{p as externalAppAuthenticationForCEA};import*as i from"./private/externalAppCardActions.js";export{i as externalAppCardActions};import*as s from"./private/externalAppCardActionsForCEA.js";export{s as externalAppCardActionsForCEA};import*as a from"./private/externalAppCommands.js";export{a as externalAppCommands};import*as m from"./private/files.js";export{m as files};import*as n from"./private/meetingRoom.js";export{n as meetingRoom};import*as l from"./private/messageChannels/messageChannels.js";export{l as messageChannels};import*as c from"./private/notifications.js";export{c as notifications};import*as f from"./private/otherAppStateChange.js";export{f as otherAppStateChange};import*as x from"./private/remoteCamera.js";export{x as remoteCamera};import*as u from"./private/appEntity.js";export{u as appEntity};import*as j from"./private/teams/teams.js";export{j as teams};import*as b from"./private/videoEffectsEx.js";export{b as videoEffectsEx};import*as d from"./private/hostEntity/hostEntity.js";export{d as hostEntity};import*as g from"./private/store.js";export{g as store};export{ChannelType,DialogDimension,FrameContexts,HostClientType,HostName,DialogDimension as TaskModuleDimension,TeamType,UserTeamRole}from"./public/constants.js";export{ActionObjectType,EduType,ErrorCode,FileOpenPreference,SecondaryM365ContentIdName}from"./public/interfaces.js";export{AppId}from"./public/appId.js";export{EmailAddress}from"./public/emailAddress.js";export{getAdaptiveCardSchemaVersion}from"./public/adaptiveCards.js";export{ChildAppWindow,ParentAppWindow}from"./public/appWindow.js";export{version}from"./public/version.js";export{enablePrintCapability,executeDeepLink,getContext,getMruTabInstances,getTabInstances,initialize,initializeWithFrameContext,print,registerAppButtonClickHandler,registerAppButtonHoverEnterHandler,registerAppButtonHoverLeaveHandler,registerBackButtonHandler,registerBeforeUnloadHandler,registerChangeSettingsHandler,registerFocusEnterHandler,registerFullScreenHandler,registerOnLoadHandler,registerOnThemeChangeHandler,setFrameContext,shareDeepLink}from"./public/publicAPIs.js";export{navigateBack,navigateCrossDomain,navigateToTab,returnFocus}from"./public/navigation.js";import*as v from"./public/liveShareHost.js";export{v as liveShare};export{LiveShareHost}from"./public/liveShareHost.js";import*as C from"./public/authentication.js";export{C as authentication};import*as A from"./public/app/app.js";export{A as app};import*as h from"./public/appInstallDialog.js";export{h as appInstallDialog};import*as H from"./public/barCode.js";export{H as barCode};import*as T from"./public/chat.js";export{T as chat};import*as y from"./public/clipboard.js";export{y as clipboard};import*as E from"./public/dialog/dialog.js";export{E as dialog};import*as S from"./public/nestedAppAuth.js";export{S as nestedAppAuth};import*as
|
|
1
|
+
export{NotificationTypes,UserSettingTypes,ViewerActionTypes}from"./private/interfaces.js";export{openFilePreview,registerCustomHandler,registerUserSettingsChangeHandler,sendCustomEvent,sendCustomMessage,uploadCustomApp}from"./private/privateAPIs.js";import*as r from"./private/logs.js";export{r as logs};import*as e from"./private/conversations.js";export{e as conversations};import*as o from"./private/copilot/copilot.js";export{o as copilot};import*as t from"./private/externalAppAuthentication.js";export{t as externalAppAuthentication};import*as p from"./private/externalAppAuthenticationForCEA.js";export{p as externalAppAuthenticationForCEA};import*as i from"./private/externalAppCardActions.js";export{i as externalAppCardActions};import*as s from"./private/externalAppCardActionsForCEA.js";export{s as externalAppCardActionsForCEA};import*as a from"./private/externalAppCommands.js";export{a as externalAppCommands};import*as m from"./private/files.js";export{m as files};import*as n from"./private/meetingRoom.js";export{n as meetingRoom};import*as l from"./private/messageChannels/messageChannels.js";export{l as messageChannels};import*as c from"./private/notifications.js";export{c as notifications};import*as f from"./private/otherAppStateChange.js";export{f as otherAppStateChange};import*as x from"./private/remoteCamera.js";export{x as remoteCamera};import*as u from"./private/appEntity.js";export{u as appEntity};import*as j from"./private/teams/teams.js";export{j as teams};import*as b from"./private/videoEffectsEx.js";export{b as videoEffectsEx};import*as d from"./private/hostEntity/hostEntity.js";export{d as hostEntity};import*as g from"./private/store.js";export{g as store};export{ChannelType,DialogDimension,FrameContexts,HostClientType,HostName,DialogDimension as TaskModuleDimension,TeamType,UserTeamRole}from"./public/constants.js";export{ActionObjectType,EduType,ErrorCode,FileOpenPreference,SecondaryM365ContentIdName}from"./public/interfaces.js";export{AppId}from"./public/appId.js";export{EmailAddress}from"./public/emailAddress.js";export{getAdaptiveCardSchemaVersion}from"./public/adaptiveCards.js";export{ChildAppWindow,ParentAppWindow}from"./public/appWindow.js";export{version}from"./public/version.js";export{enablePrintCapability,executeDeepLink,getContext,getMruTabInstances,getTabInstances,initialize,initializeWithFrameContext,print,registerAppButtonClickHandler,registerAppButtonHoverEnterHandler,registerAppButtonHoverLeaveHandler,registerBackButtonHandler,registerBeforeUnloadHandler,registerChangeSettingsHandler,registerFocusEnterHandler,registerFullScreenHandler,registerOnLoadHandler,registerOnThemeChangeHandler,setFrameContext,shareDeepLink}from"./public/publicAPIs.js";export{navigateBack,navigateCrossDomain,navigateToTab,returnFocus}from"./public/navigation.js";export{UUID}from"./public/uuidObject.js";import*as v from"./public/liveShareHost.js";export{v as liveShare};export{LiveShareHost}from"./public/liveShareHost.js";import*as C from"./public/authentication.js";export{C as authentication};import*as A from"./public/app/app.js";export{A as app};import*as h from"./public/appInstallDialog.js";export{h as appInstallDialog};import*as H from"./public/barCode.js";export{H as barCode};import*as T from"./public/chat.js";export{T as chat};import*as y from"./public/clipboard.js";export{y as clipboard};import*as E from"./public/dialog/dialog.js";export{E as dialog};import*as S from"./public/nestedAppAuth.js";export{S as nestedAppAuth};import*as I from"./public/geoLocation/geoLocation.js";export{I as geoLocation};import*as D from"./public/pages/pages.js";export{D as pages};import*as F from"./public/menus.js";export{F as menus};import*as w from"./public/media.js";export{w as media};import*as k from"./public/secondaryBrowser.js";export{k as secondaryBrowser};import*as B from"./public/location.js";export{B as location};import*as P from"./public/meeting/meeting.js";export{P as meeting};import*as L from"./public/monetization.js";export{L as monetization};import*as M from"./public/calendar.js";export{M as calendar};import*as U from"./public/mail.js";export{U as mail};import*as O from"./public/teamsAPIs.js";export{O as teamsCore};import*as z from"./public/people.js";export{z as people};import*as V from"./public/profile.js";export{V as profile};import*as W from"./public/videoEffects.js";export{W as videoEffects};import*as N from"./public/search.js";export{N as search};import*as R from"./public/sharing/sharing.js";export{R as sharing};import*as q from"./public/stageView/stageView.js";export{q as stageView};import*as G from"./public/visualMedia/visualMedia.js";export{G as visualMedia};import*as J from"./public/webStorage.js";export{J as webStorage};import*as K from"./public/call.js";export{K as call};import*as Q from"./public/appInitialization.js";export{Q as appInitialization};import*as X from"./public/thirdPartyCloudStorage.js";export{X as thirdPartyCloudStorage};import*as Y from"./public/settings.js";export{Y as settings};import*as Z from"./public/tasks.js";export{Z as tasks};import*as $ from"./public/marketplace.js";export{$ as marketplace};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
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{getLogger as n,isFollowingApiVersionTagFormat as i,getApiVersionTag as t}from"./telemetry.js";import{isSdkError as o,ErrorCode as s}from"../public/interfaces.js";import{latestRuntimeApiVersion as r}from"../public/runtime.js";import{isSerializable as a}from"../public/serializable.interface.js";import{version as d}from"../public/version.js";import{GlobalVars as c}from"./globalVars.js";import{callHandler as u}from"./handlers.js";import l from"./hostToAppTelemetry.js";import{serializeMessageRequest as g,deserializeMessageResponse as p,deserializeMessageRequest as f,serializeMessageResponse as m}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as w}from"./nestedAppAuthUtils.js";import{getCurrentTimestamp as h,ssrSafeWindow as W}from"./utils.js";import{UUID as v}from"./uuidObject.js";import{validateOrigin as M}from"./validOrigins.js";const b=n("communication");class y{}class k{}function I(n,i){if(k.messageListener=n=>function(n){return e(this,void 0,void 0,(function*(){if(!n||!n.data||"object"!=typeof n.data)return void _("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,i=n.origin||n.originalEvent&&n.originalEvent.origin;return H(e,i).then((o=>{o?(function(e,n){c.isFramelessWindow||y.parentWindow&&!y.parentWindow.closed&&e!==y.parentWindow?y.childWindow&&!y.childWindow.closed&&e!==y.childWindow||(y.childWindow=e,y.childOrigin=n):(y.parentWindow=e,y.parentOrigin=n);y.parentWindow&&y.parentWindow.closed&&(y.parentWindow=null,y.parentOrigin=null);y.childWindow&&y.childWindow.closed&&(y.childWindow=null,y.childOrigin=null);te(y.parentWindow),te(y.childWindow)}(e,i),e===y.parentWindow?G(n):e===y.childWindow&&function(e){if("id"in e.data&&"func"in e.data){const n=f(e.data),[i,o]=u(n.func,n.args);i&&void 0!==o?(X("Returning message %s from child back to child, action: %s.",ae(n),n.func),se(n.id,n.uuid,Array.isArray(o)?o:[o])):(X("Relaying message %s from child to parent, action: %s. Relayed message will have a new id.",ae(n),n.func),N(t("v2","tasks.startTask"),n.func,n.args,((...e)=>{if(y.childWindow){const i=e.pop();X("Message from parent being relayed to child, id: %s",ae(n)),se(n.id,n.uuid,e,i)}})))}}(n)):_("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,i)}))}))}(n),y.currentWindow=y.currentWindow||W(),y.parentWindow=y.currentWindow.parent!==y.currentWindow.self?y.currentWindow.parent:y.currentWindow.opener,y.topWindow=y.currentWindow.top,(y.parentWindow||n)&&y.currentWindow.addEventListener("message",k.messageListener,!1),!y.parentWindow){const e=y.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));c.isFramelessWindow=!0,e.onNativeMessage=G}try{return y.parentOrigin="*",S(i,"initialize",[d,r,n]).then((([e,n,i,t])=>(w(t,y.currentWindow,{onMessage:q,sendPostMessage:U}),{context:e,clientType:n,runtimeConfig:i,clientSupportedSDKVersion:t})))}finally{y.parentOrigin=null}}function T(){y.currentWindow&&y.currentWindow.removeEventListener("message",k.messageListener,!1),y.currentWindow=null,y.parentWindow=null,y.parentOrigin=null,y.childWindow=null,y.childOrigin=null,k.parentMessageQueue=[],k.childMessageQueue=[],k.nextMessageId=0,k.callbacks.clear(),k.promiseCallbacks.clear(),k.portCallbacks.clear(),k.legacyMessageIdsToUuidMap={},l.clearMessages()}function R(e,n,...i){return S(e,n,i).then((([e])=>e))}function E(e,n,...i){return S(e,n,i).then((([e,n])=>{if(!e)throw new Error(n)}))}function O(e,n,i,...t){return S(e,n,t).then((([e,n])=>{if(!e)throw new Error(n||i)}))}function j(e,n,...i){return S(e,n,i).then((([e,n])=>{if(e)throw e;return n}))}function S(e,n,t=void 0){if(!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise((i=>{const o=L(e,n,t);var s;i((s=o.uuid,new Promise((e=>{k.promiseCallbacks.set(s,e)}))))}))}function A(e){return e.map((e=>a(e)?e.serialize():e))}function P(n,i,t,r,a){var d;return e(this,void 0,void 0,(function*(){const e=A(i),[c]=yield S(r,n,e);if(a&&a(c)||!a&&o(c))throw new Error(`${c.errorCode}, message: ${null!==(d=c.message)&&void 0!==d?d:"None"}`);if(t.validate(c))return t.deserialize(c);throw new Error(`${s.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(c)}`)}))}function C(n,i,t,r){var a;return e(this,void 0,void 0,(function*(){const e=A(i),[d]=yield S(t,n,e);if(r&&r(d)||!r&&o(d))throw new Error(`${d.errorCode}, message: ${null!==(a=d.message)&&void 0!==a?a:"None"}`);if(void 0!==d)throw new Error(`${s.INTERNAL_ERROR}, message: Invalid response from host`)}))}function x(e,n,t=void 0){if(!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=L(e,n,t);return s=o.uuid,new Promise(((e,n)=>{k.portCallbacks.set(s,((i,t)=>{i instanceof MessagePort?e(i):n(t&&t.length>0?t[0]:new Error("Host responded without port or error details."))}))}));var s}function N(e,n,t,o){let s;if(t instanceof Function?o=t:t instanceof Array&&(s=t),!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const r=L(e,n,s);o&&k.callbacks.set(r.uuid,o)}k.parentMessageQueue=[],k.childMessageQueue=[],k.topMessageQueue=[],k.nextMessageId=0,k.callbacks=new Map,k.promiseCallbacks=new Map,k.portCallbacks=new Map,k.legacyMessageIdsToUuidMap={};const $=b.extend("sendNestedAuthRequestToTopWindow");function U(e){const n=$,i=y.topWindow,t=function(e){const n=k.nextMessageId++,i=new v;return k.legacyMessageIdsToUuidMap[n]=i,{id:n,uuid:i,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:h(),args:[],data:e}}(e);return n("Message %s information: %o",ae(t),{actionName:t.func}),z(i,t)}const Q=b.extend("sendRequestToTargetWindowHelper");function z(e,n){const i=Q,t=ne(e),o=g(n);if(c.isFramelessWindow)y.currentWindow&&y.currentWindow.nativeInterface&&(i("Sending message %s to %s via framelessPostMessage interface",ae(o),t),y.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(o)));else{const s=ee(e);e&&s?(i("Sending message %s to %s via postMessage",ae(o),t),e.postMessage(o,s)):(i("Adding message %s to %s message queue",ae(o),t),Z(e).push(n))}return n}const F=b.extend("sendMessageToParentHelper");function L(e,n,i){const t=F,o=y.parentWindow,s=function(e,n,i){const t=k.nextMessageId++,o=new v;return k.legacyMessageIdsToUuidMap[t]=o,{id:t,uuid:o,func:n,timestamp:Date.now(),monotonicTimestamp:h(),args:i||[],apiVersionTag:e}}(e,n,i);return l.storeCallbackInformation(s.uuid,{name:n,calledAt:s.timestamp}),t("Message %s information: %o",ae(s),{actionName:n,args:i}),z(o,s)}const _=b.extend("processIncomingMessage");const V=b.extend("processAuthBridgeMessage");function q(e,n){var i,t;const o=V;if(!e||!e.data||"object"!=typeof e.data)return void o("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:s}=e.data,[,r]=null!=s?s:[],a=(()=>{try{return JSON.parse(r)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void o("Unrecognized data format received by app, message being ignored. Message: %o",e);const d=e.source||(null===(i=null==e?void 0:e.originalEvent)||void 0===i?void 0:i.source),c=e.origin||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.origin);d?H(d,c)?(y.topWindow&&!y.topWindow.closed&&d!==y.topWindow||(y.topWindow=d,y.topOrigin=c),y.topWindow&&y.topWindow.closed&&(y.topWindow=null,y.topOrigin=null),te(y.topWindow),n(r)):o("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin"):o("Message being ignored by app because it is coming for a target that is null")}const D=b.extend("shouldProcessIncomingMessage");function H(n,i){return e(this,void 0,void 0,(function*(){if(y.currentWindow&&n===y.currentWindow)return D("Should not process message because it is coming from the current window"),!1;if(y.currentWindow&&y.currentWindow.location&&i&&i===y.currentWindow.location.origin)return!0;{let e;try{e=new URL(i)}catch(e){return D("Message has an invalid origin of %s",i),!1}const n=yield M(e);return n||D("Message has an invalid origin of %s",i),n}}))}const J=b.extend("handleIncomingMessageFromParent");function B(e,n){if(n){const i=[...e].find((([e,i])=>e.toString()===n.toString()));if(i)return i[0]}}function K(e,n){const i=B(n,e.uuid);i&&n.delete(i),e.uuid?k.legacyMessageIdsToUuidMap={}:delete k.legacyMessageIdsToUuidMap[e.id]}function G(e){const n=J,i=h();if("id"in e.data&&"number"==typeof e.data.id){const t=e.data,o=p(t),s=function(e){const n=J;if(!e.uuid)return k.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,i=B(k.callbacks,n);if(i)return i;const t=B(k.promiseCallbacks,n);if(t)return t;const o=B(k.portCallbacks,n);if(o)return o}n("Received message %s that failed to produce a callbackId",ae(e))}(o);if(s){const t=k.callbacks.get(s);n("Received a response from parent for message %s",s.toString()),l.handlePerformanceMetrics(s,o,n,i),t&&(n("Invoking the registered callback for message %s with arguments %o",s.toString(),o.args),t.apply(null,[...o.args,o.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",s.toString()),K(o,k.callbacks)));const r=k.promiseCallbacks.get(s);r&&(n("Invoking the registered promise callback for message %s with arguments %o",s.toString(),o.args),r(o.args),n("Removing registered promise callback for message %s",s.toString()),K(o,k.promiseCallbacks));const a=k.portCallbacks.get(s);if(a){let i;n("Invoking the registered port callback for message %s with arguments %o",s.toString(),o.args),e.ports&&e.ports[0]instanceof MessagePort&&(i=e.ports[0]),a(i,o.args),n("Removing registered port callback for message %s",s.toString()),K(o,k.portCallbacks)}o.uuid&&(k.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const t=e.data;l.handleOneWayPerformanceMetrics(t,n,i),n('Received a message from parent %s, action: "%s"',ae(t),t.func),u(t.func,t.args)}else n("Received an unknown message: %O",e)}const X=b.extend("handleIncomingMessageFromChild");function Y(){return y.topWindow!==y.parentWindow}function Z(e){return e===y.topWindow&&Y()?k.topMessageQueue:e===y.parentWindow?k.parentMessageQueue:e===y.childWindow?k.childMessageQueue:[]}function ee(e){return e===y.topWindow&&Y()?y.topOrigin:e===y.parentWindow?y.parentOrigin:e===y.childWindow?y.childOrigin:null}function ne(e){return e===y.topWindow&&Y()?"top":e===y.parentWindow?"parent":e===y.childWindow?"child":null}const ie=b.extend("flushMessageQueue");function te(e){const n=ee(e),i=Z(e),t=ne(e);for(;e&&n&&i.length>0;){const o=i.shift();if(o){const i=g(o);ie("Flushing message %s from %s message queue via postMessage.",ae(i),t),e.postMessage(i,n)}}}function oe(e,n){let i;i=y.currentWindow.setInterval((()=>{0===Z(e).length&&(clearInterval(i),n())}),100)}function se(e,n,i,t){const o=y.childWindow,s=function(e,n,i,t){return{id:e,uuid:n,args:i||[],isPartialResponse:t}}(e,n,i,t),r=m(s),a=ee(o);o&&a&&o.postMessage(r,a)}function re(e,n){const i=y.childWindow,t=function(e,n){return{func:e,args:n||[]}}(e,n),o=ee(i);i&&o?i.postMessage(t,o):Z(i).push(t)}function ae(e){return"uuidAsString"in e?`${e.uuidAsString} (legacy id: ${e.id})`:"uuid"in e&&void 0!==e.uuid?`${e.uuid.toString()} (legacy id: ${e.id})`:`legacy id: ${e.id} (no uuid)`}export{y as Communication,C as callFunctionInHost,P as callFunctionInHostAndHandleResponse,I as initializeCommunication,x as requestPortFromParentWithVersion,j as sendAndHandleSdkError,E as sendAndHandleStatusAndReason,O as sendAndHandleStatusAndReasonWithDefaultError,R as sendAndUnwrap,re as sendMessageEventToChild,N as sendMessageToParent,S as sendMessageToParentAsync,U as sendNestedAuthRequestToTopWindow,T as uninitializeCommunication,oe as waitForMessageQueue};
|
|
1
|
+
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{getLogger as n,isFollowingApiVersionTagFormat as i,getApiVersionTag as t}from"./telemetry.js";import{isSdkError as o,ErrorCode as s}from"../public/interfaces.js";import{latestRuntimeApiVersion as r}from"../public/runtime.js";import{isSerializable as a}from"../public/serializable.interface.js";import{UUID as d}from"../public/uuidObject.js";import{version as c}from"../public/version.js";import{GlobalVars as u}from"./globalVars.js";import{callHandler as l}from"./handlers.js";import g from"./hostToAppTelemetry.js";import{serializeMessageRequest as p,deserializeMessageResponse as f,deserializeMessageRequest as m,serializeMessageResponse as w}from"./messageObjects.js";import{tryPolyfillWithNestedAppAuthBridge as h}from"./nestedAppAuthUtils.js";import{getCurrentTimestamp as W,ssrSafeWindow as v}from"./utils.js";import{validateOrigin as M}from"./validOrigins.js";const b=n("communication");class y{}class k{}function I(n,i){if(k.messageListener=n=>function(n){return e(this,void 0,void 0,(function*(){if(!n||!n.data||"object"!=typeof n.data)return void _("Unrecognized message format received by app, message being ignored. Message: %o",n);const e=n.source||n.originalEvent&&n.originalEvent.source,i=n.origin||n.originalEvent&&n.originalEvent.origin;return H(e,i).then((o=>{o?(function(e,n){u.isFramelessWindow||y.parentWindow&&!y.parentWindow.closed&&e!==y.parentWindow?y.childWindow&&!y.childWindow.closed&&e!==y.childWindow||(y.childWindow=e,y.childOrigin=n):(y.parentWindow=e,y.parentOrigin=n);y.parentWindow&&y.parentWindow.closed&&(y.parentWindow=null,y.parentOrigin=null);y.childWindow&&y.childWindow.closed&&(y.childWindow=null,y.childOrigin=null);te(y.parentWindow),te(y.childWindow)}(e,i),e===y.parentWindow?G(n):e===y.childWindow&&function(e){if("id"in e.data&&"func"in e.data){const n=m(e.data),[i,o]=l(n.func,n.args);i&&void 0!==o?(X("Returning message %s from child back to child, action: %s.",ae(n),n.func),se(n.id,n.uuid,Array.isArray(o)?o:[o])):(X("Relaying message %s from child to parent, action: %s. Relayed message will have a new id.",ae(n),n.func),N(t("v2","tasks.startTask"),n.func,n.args,((...e)=>{if(y.childWindow){const i=e.pop();X("Message from parent being relayed to child, id: %s",ae(n)),se(n.id,n.uuid,e,i)}})))}}(n)):_("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin, message: %o, source: %o, origin: %o",n,e,i)}))}))}(n),y.currentWindow=y.currentWindow||v(),y.parentWindow=y.currentWindow.parent!==y.currentWindow.self?y.currentWindow.parent:y.currentWindow.opener,y.topWindow=y.currentWindow.top,(y.parentWindow||n)&&y.currentWindow.addEventListener("message",k.messageListener,!1),!y.parentWindow){const e=y.currentWindow;if(!e.nativeInterface)return Promise.reject(new Error("Initialization Failed. No Parent window found."));u.isFramelessWindow=!0,e.onNativeMessage=G}try{return y.parentOrigin="*",S(i,"initialize",[c,r,n]).then((([e,n,i,t])=>(h(t,y.currentWindow,{onMessage:q,sendPostMessage:U}),{context:e,clientType:n,runtimeConfig:i,clientSupportedSDKVersion:t})))}finally{y.parentOrigin=null}}function T(){y.currentWindow&&y.currentWindow.removeEventListener("message",k.messageListener,!1),y.currentWindow=null,y.parentWindow=null,y.parentOrigin=null,y.childWindow=null,y.childOrigin=null,k.parentMessageQueue=[],k.childMessageQueue=[],k.nextMessageId=0,k.callbacks.clear(),k.promiseCallbacks.clear(),k.portCallbacks.clear(),k.legacyMessageIdsToUuidMap={},g.clearMessages()}function R(e,n,...i){return S(e,n,i).then((([e])=>e))}function E(e,n,...i){return S(e,n,i).then((([e,n])=>{if(!e)throw new Error(n)}))}function O(e,n,i,...t){return S(e,n,t).then((([e,n])=>{if(!e)throw new Error(n||i)}))}function j(e,n,...i){return S(e,n,i).then((([e,n])=>{if(e)throw e;return n}))}function S(e,n,t=void 0){if(!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);return new Promise((i=>{const o=L(e,n,t);var s;i((s=o.uuid,new Promise((e=>{k.promiseCallbacks.set(s,e)}))))}))}function A(e){return e.map((e=>a(e)?e.serialize():e))}function P(n,i,t,r,a){var d;return e(this,void 0,void 0,(function*(){const e=A(i),[c]=yield S(r,n,e);if(a&&a(c)||!a&&o(c))throw new Error(`${c.errorCode}, message: ${null!==(d=c.message)&&void 0!==d?d:"None"}`);if(t.validate(c))return t.deserialize(c);throw new Error(`${s.INTERNAL_ERROR}, message: Invalid response from host - ${JSON.stringify(c)}`)}))}function C(n,i,t,r){var a;return e(this,void 0,void 0,(function*(){const e=A(i),[d]=yield S(t,n,e);if(r&&r(d)||!r&&o(d))throw new Error(`${d.errorCode}, message: ${null!==(a=d.message)&&void 0!==a?a:"None"}`);if(void 0!==d)throw new Error(`${s.INTERNAL_ERROR}, message: Invalid response from host`)}))}function x(e,n,t=void 0){if(!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const o=L(e,n,t);return s=o.uuid,new Promise(((e,n)=>{k.portCallbacks.set(s,((i,t)=>{i instanceof MessagePort?e(i):n(t&&t.length>0?t[0]:new Error("Host responded without port or error details."))}))}));var s}function N(e,n,t,o){let s;if(t instanceof Function?o=t:t instanceof Array&&(s=t),!i(e))throw Error(`apiVersionTag: ${e} passed in doesn't follow the pattern starting with 'v' followed by digits, then underscore with words, please check.`);const r=L(e,n,s);o&&k.callbacks.set(r.uuid,o)}k.parentMessageQueue=[],k.childMessageQueue=[],k.topMessageQueue=[],k.nextMessageId=0,k.callbacks=new Map,k.promiseCallbacks=new Map,k.portCallbacks=new Map,k.legacyMessageIdsToUuidMap={};const $=b.extend("sendNestedAuthRequestToTopWindow");function U(e){const n=$,i=y.topWindow,t=function(e){const n=k.nextMessageId++,i=new d;return k.legacyMessageIdsToUuidMap[n]=i,{id:n,uuid:i,func:"nestedAppAuth.execute",timestamp:Date.now(),monotonicTimestamp:W(),args:[],data:e}}(e);return n("Message %s information: %o",ae(t),{actionName:t.func}),z(i,t)}const Q=b.extend("sendRequestToTargetWindowHelper");function z(e,n){const i=Q,t=ne(e),o=p(n);if(u.isFramelessWindow)y.currentWindow&&y.currentWindow.nativeInterface&&(i("Sending message %s to %s via framelessPostMessage interface",ae(o),t),y.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(o)));else{const s=ee(e);e&&s?(i("Sending message %s to %s via postMessage",ae(o),t),e.postMessage(o,s)):(i("Adding message %s to %s message queue",ae(o),t),Z(e).push(n))}return n}const F=b.extend("sendMessageToParentHelper");function L(e,n,i){const t=F,o=y.parentWindow,s=function(e,n,i){const t=k.nextMessageId++,o=new d;return k.legacyMessageIdsToUuidMap[t]=o,{id:t,uuid:o,func:n,timestamp:Date.now(),monotonicTimestamp:W(),args:i||[],apiVersionTag:e}}(e,n,i);return g.storeCallbackInformation(s.uuid,{name:n,calledAt:s.timestamp}),t("Message %s information: %o",ae(s),{actionName:n,args:i}),z(o,s)}const _=b.extend("processIncomingMessage");const V=b.extend("processAuthBridgeMessage");function q(e,n){var i,t;const o=V;if(!e||!e.data||"object"!=typeof e.data)return void o("Unrecognized message format received by app, message being ignored. Message: %o",e);const{args:s}=e.data,[,r]=null!=s?s:[],a=(()=>{try{return JSON.parse(r)}catch(e){return null}})();if(!a||"object"!=typeof a||"NestedAppAuthResponse"!==a.messageType)return void o("Unrecognized data format received by app, message being ignored. Message: %o",e);const d=e.source||(null===(i=null==e?void 0:e.originalEvent)||void 0===i?void 0:i.source),c=e.origin||(null===(t=null==e?void 0:e.originalEvent)||void 0===t?void 0:t.origin);d?H(d,c)?(y.topWindow&&!y.topWindow.closed&&d!==y.topWindow||(y.topWindow=d,y.topOrigin=c),y.topWindow&&y.topWindow.closed&&(y.topWindow=null,y.topOrigin=null),te(y.topWindow),n(r)):o("Message being ignored by app because it is either coming from the current window or a different window with an invalid origin"):o("Message being ignored by app because it is coming for a target that is null")}const D=b.extend("shouldProcessIncomingMessage");function H(n,i){return e(this,void 0,void 0,(function*(){if(y.currentWindow&&n===y.currentWindow)return D("Should not process message because it is coming from the current window"),!1;if(y.currentWindow&&y.currentWindow.location&&i&&i===y.currentWindow.location.origin)return!0;{let e;try{e=new URL(i)}catch(e){return D("Message has an invalid origin of %s",i),!1}const n=yield M(e);return n||D("Message has an invalid origin of %s",i),n}}))}const J=b.extend("handleIncomingMessageFromParent");function B(e,n){if(n){const i=[...e].find((([e,i])=>e.toString()===n.toString()));if(i)return i[0]}}function K(e,n){const i=B(n,e.uuid);i&&n.delete(i),e.uuid?k.legacyMessageIdsToUuidMap={}:delete k.legacyMessageIdsToUuidMap[e.id]}function G(e){const n=J,i=W();if("id"in e.data&&"number"==typeof e.data.id){const t=e.data,o=f(t),s=function(e){const n=J;if(!e.uuid)return k.legacyMessageIdsToUuidMap[e.id];{const n=e.uuid,i=B(k.callbacks,n);if(i)return i;const t=B(k.promiseCallbacks,n);if(t)return t;const o=B(k.portCallbacks,n);if(o)return o}n("Received message %s that failed to produce a callbackId",ae(e))}(o);if(s){const t=k.callbacks.get(s);n("Received a response from parent for message %s",s.toString()),g.handlePerformanceMetrics(s,o,n,i),t&&(n("Invoking the registered callback for message %s with arguments %o",s.toString(),o.args),t.apply(null,[...o.args,o.isPartialResponse]),function(e){return!0===e.data.isPartialResponse}(e)||(n("Removing registered callback for message %s",s.toString()),K(o,k.callbacks)));const r=k.promiseCallbacks.get(s);r&&(n("Invoking the registered promise callback for message %s with arguments %o",s.toString(),o.args),r(o.args),n("Removing registered promise callback for message %s",s.toString()),K(o,k.promiseCallbacks));const a=k.portCallbacks.get(s);if(a){let i;n("Invoking the registered port callback for message %s with arguments %o",s.toString(),o.args),e.ports&&e.ports[0]instanceof MessagePort&&(i=e.ports[0]),a(i,o.args),n("Removing registered port callback for message %s",s.toString()),K(o,k.portCallbacks)}o.uuid&&(k.legacyMessageIdsToUuidMap={})}}else if("func"in e.data&&"string"==typeof e.data.func){const t=e.data;g.handleOneWayPerformanceMetrics(t,n,i),n('Received a message from parent %s, action: "%s"',ae(t),t.func),l(t.func,t.args)}else n("Received an unknown message: %O",e)}const X=b.extend("handleIncomingMessageFromChild");function Y(){return y.topWindow!==y.parentWindow}function Z(e){return e===y.topWindow&&Y()?k.topMessageQueue:e===y.parentWindow?k.parentMessageQueue:e===y.childWindow?k.childMessageQueue:[]}function ee(e){return e===y.topWindow&&Y()?y.topOrigin:e===y.parentWindow?y.parentOrigin:e===y.childWindow?y.childOrigin:null}function ne(e){return e===y.topWindow&&Y()?"top":e===y.parentWindow?"parent":e===y.childWindow?"child":null}const ie=b.extend("flushMessageQueue");function te(e){const n=ee(e),i=Z(e),t=ne(e);for(;e&&n&&i.length>0;){const o=i.shift();if(o){const i=p(o);ie("Flushing message %s from %s message queue via postMessage.",ae(i),t),e.postMessage(i,n)}}}function oe(e,n){let i;i=y.currentWindow.setInterval((()=>{0===Z(e).length&&(clearInterval(i),n())}),100)}function se(e,n,i,t){const o=y.childWindow,s=function(e,n,i,t){return{id:e,uuid:n,args:i||[],isPartialResponse:t}}(e,n,i,t),r=w(s),a=ee(o);o&&a&&o.postMessage(r,a)}function re(e,n){const i=y.childWindow,t=function(e,n){return{func:e,args:n||[]}}(e,n),o=ee(i);i&&o?i.postMessage(t,o):Z(i).push(t)}function ae(e){return"uuidAsString"in e?`${e.uuidAsString} (legacy id: ${e.id})`:"uuid"in e&&void 0!==e.uuid?`${e.uuid.toString()} (legacy id: ${e.id})`:`legacy id: ${e.id} (no uuid)`}export{y as Communication,C as callFunctionInHost,P as callFunctionInHostAndHandleResponse,I as initializeCommunication,x as requestPortFromParentWithVersion,j as sendAndHandleSdkError,E as sendAndHandleStatusAndReason,O as sendAndHandleStatusAndReasonWithDefaultError,R as sendAndUnwrap,re as sendMessageEventToChild,N as sendMessageToParent,S as sendMessageToParentAsync,U as sendNestedAuthRequestToTopWindow,T as uninitializeCommunication,oe as waitForMessageQueue};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest 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{UUID as t}from"
|
|
1
|
+
import{__rest 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{UUID as t}from"../public/uuidObject.js";const u=t=>{const{uuid:u}=t,s=i(t,["uuid"]),n=null==u?void 0:u.toString();return Object.assign(Object.assign({},s),{uuidAsString:n})},s=u=>{const{uuidAsString:s}=u,n=i(u,["uuidAsString"]);return Object.assign(Object.assign({},n),{uuid:s?new t(s):void 0})},n=u=>{const{uuidAsString:s}=u,n=i(u,["uuidAsString"]);return Object.assign(Object.assign({},n),{uuid:s?new t(s):void 0})},r=t=>{const{uuid:u}=t,s=i(t,["uuid"]),n=null==u?void 0:u.toString();return Object.assign(Object.assign({},s),{uuidAsString:n})};export{s as deserializeMessageRequest,n as deserializeMessageResponse,u as serializeMessageRequest,r as serializeMessageResponse};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as t}from"../../../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js";import{UUID as e}from"
|
|
1
|
+
import{b as t}from"../../../../node_modules/.pnpm/debug@4.3.5/node_modules/debug/src/browser.js";import{UUID as e}from"../public/uuidObject.js";const n=new e,o=t.debug.formatArgs;t.debug.formatArgs=function(t){t[0]=`(${(new Date).toISOString()}): ${t[0]} [${n.toString()}]`,o.call(this,t)};const r=t.debug("teamsJs");function u(t){return r.extend(t)}function s(t,e){return`${t}_${e}`}function d(t){return/^v\d+_[\w.]+$/.test(t)}export{s as getApiVersionTag,u as getLogger,d as isFollowingApiVersionTagFormat,n as teamsJsInstanceIdentifier};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as o from"./customTelemetry.js";export{o as customTelemetry};import*as r from"./eligibility.js";export{r as eligibility};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__awaiter as t}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{callFunctionInHost as o}from"../../internal/communication.js";import{ensureInitialized as e}from"../../internal/internalAPIs.js";import{getLogger as r,getApiVersionTag as i}from"../../internal/telemetry.js";import{getCurrentTimestamp as m}from"../../internal/utils.js";import{runtime as n}from"../../public/runtime.js";const s=r("copilot");function l(r,l){var p;return void 0===l&&(l=null!==(p=m())&&void 0!==p?p:Date.now()),t(this,void 0,void 0,(function*(){return e(n),s("Sending custom telemetry data to host for stage: %s to record timestamp: %s",r,l),o("copilot.customTelemetry.sendCustomTelemetryData",[r.toString(),l],i("v2","copilot.customTelemetry.sendCustomTelemetryData"))}))}export{l as sendCustomTelemetryData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{validateUuid as t,generateGUID as r}from"../internal/utils.js";class i{constructor(i=r()){this.uuid=i,t(i)}toString(){return this.uuid}}export{i as UUID};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t="2.
|
|
1
|
+
const t="2.33.0-beta.0";export{t as version};
|
|
@@ -1008,6 +1008,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1008
1008
|
SecondaryM365ContentIdName: () => (/* reexport */ SecondaryM365ContentIdName),
|
|
1009
1009
|
TaskModuleDimension: () => (/* reexport */ DialogDimension),
|
|
1010
1010
|
TeamType: () => (/* reexport */ TeamType),
|
|
1011
|
+
UUID: () => (/* reexport */ UUID),
|
|
1011
1012
|
UserSettingTypes: () => (/* reexport */ UserSettingTypes),
|
|
1012
1013
|
UserTeamRole: () => (/* reexport */ UserTeamRole),
|
|
1013
1014
|
ViewerActionTypes: () => (/* reexport */ ViewerActionTypes),
|
|
@@ -1348,6 +1349,13 @@ __webpack_require__.d(conversations_namespaceObject, {
|
|
|
1348
1349
|
openConversation: () => (openConversation)
|
|
1349
1350
|
});
|
|
1350
1351
|
|
|
1352
|
+
// NAMESPACE OBJECT: ./src/private/copilot/customTelemetry.ts
|
|
1353
|
+
var customTelemetry_namespaceObject = {};
|
|
1354
|
+
__webpack_require__.r(customTelemetry_namespaceObject);
|
|
1355
|
+
__webpack_require__.d(customTelemetry_namespaceObject, {
|
|
1356
|
+
sendCustomTelemetryData: () => (sendCustomTelemetryData)
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1351
1359
|
// NAMESPACE OBJECT: ./src/private/copilot/eligibility.ts
|
|
1352
1360
|
var eligibility_namespaceObject = {};
|
|
1353
1361
|
__webpack_require__.r(eligibility_namespaceObject);
|
|
@@ -1360,6 +1368,7 @@ __webpack_require__.d(eligibility_namespaceObject, {
|
|
|
1360
1368
|
var copilot_namespaceObject = {};
|
|
1361
1369
|
__webpack_require__.r(copilot_namespaceObject);
|
|
1362
1370
|
__webpack_require__.d(copilot_namespaceObject, {
|
|
1371
|
+
customTelemetry: () => (customTelemetry_namespaceObject),
|
|
1363
1372
|
eligibility: () => (eligibility_namespaceObject)
|
|
1364
1373
|
});
|
|
1365
1374
|
|
|
@@ -3798,19 +3807,32 @@ function isPrimitiveOrPlainObject(value, depth = 0) {
|
|
|
3798
3807
|
return Object.keys(value).every((key) => isPrimitiveOrPlainObject(value[key], depth + 1));
|
|
3799
3808
|
}
|
|
3800
3809
|
|
|
3801
|
-
;// ./src/
|
|
3810
|
+
;// ./src/public/uuidObject.ts
|
|
3802
3811
|
|
|
3803
3812
|
/**
|
|
3804
3813
|
* @internal
|
|
3805
3814
|
* Limited to Microsoft-internal use
|
|
3806
3815
|
*
|
|
3807
|
-
* UUID object
|
|
3816
|
+
* Represents a UUID (Universally Unique Identifier) object.
|
|
3817
|
+
* This class provides a way to generate, validate, and represent UUIDs as strings.
|
|
3808
3818
|
*/
|
|
3809
3819
|
class UUID {
|
|
3820
|
+
/**
|
|
3821
|
+
* Creates an instance of the UUID class.
|
|
3822
|
+
* If no UUID string is provided, a new UUID is generated.
|
|
3823
|
+
*
|
|
3824
|
+
* @param {string} [uuid=generateGUID()] - The UUID string. Defaults to a newly generated UUID.
|
|
3825
|
+
* @throws {Error} - Throws an error if the provided UUID is invalid.
|
|
3826
|
+
*/
|
|
3810
3827
|
constructor(uuid = generateGUID()) {
|
|
3811
3828
|
this.uuid = uuid;
|
|
3812
3829
|
validateUuid(uuid);
|
|
3813
3830
|
}
|
|
3831
|
+
/**
|
|
3832
|
+
* Returns the UUID as a string.
|
|
3833
|
+
*
|
|
3834
|
+
* @returns {string} - The UUID string.
|
|
3835
|
+
*/
|
|
3814
3836
|
toString() {
|
|
3815
3837
|
return this.uuid;
|
|
3816
3838
|
}
|
|
@@ -4439,7 +4461,7 @@ function isSerializable(arg) {
|
|
|
4439
4461
|
* @hidden
|
|
4440
4462
|
* Package version.
|
|
4441
4463
|
*/
|
|
4442
|
-
const version = "2.
|
|
4464
|
+
const version = "2.33.0-beta.0";
|
|
4443
4465
|
|
|
4444
4466
|
;// ./src/internal/internalAPIs.ts
|
|
4445
4467
|
|
|
@@ -9242,6 +9264,54 @@ function conversations_isSupported() {
|
|
|
9242
9264
|
return ensureInitialized(runtime) && runtime.supports.conversations ? true : false;
|
|
9243
9265
|
}
|
|
9244
9266
|
|
|
9267
|
+
;// ./src/private/copilot/customTelemetry.ts
|
|
9268
|
+
/**
|
|
9269
|
+
* @beta
|
|
9270
|
+
* @hidden
|
|
9271
|
+
* User information required by specific apps
|
|
9272
|
+
* @internal
|
|
9273
|
+
* Limited to Microsoft-internal use
|
|
9274
|
+
* @module
|
|
9275
|
+
*/
|
|
9276
|
+
var customTelemetry_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
9277
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9278
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9279
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9280
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9281
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9282
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9283
|
+
});
|
|
9284
|
+
};
|
|
9285
|
+
|
|
9286
|
+
|
|
9287
|
+
|
|
9288
|
+
|
|
9289
|
+
|
|
9290
|
+
const copilotTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
|
9291
|
+
const copilotLogger = getLogger('copilot');
|
|
9292
|
+
/**
|
|
9293
|
+
* Sends custom telemetry data to the host.
|
|
9294
|
+
*
|
|
9295
|
+
* @param { UUID } stageNameIdentifier - The stageName UUID identifier for the telemetry data.
|
|
9296
|
+
* @param { number } [timestamp=getCurrentTimestamp() ?? Date.now()] - The timestamp of the telemetry data. Defaults to the current timestamp.
|
|
9297
|
+
* @returns { Promise<void> } - promise resolves when the host SDK acknowledges that it has received the message.
|
|
9298
|
+
* @throws { Error } - Throws an error if the app has not been successfully initialized or the host SDK returns an error as a response to this call
|
|
9299
|
+
*
|
|
9300
|
+
* @hidden
|
|
9301
|
+
* @internal
|
|
9302
|
+
* Limited to Microsoft-internal use
|
|
9303
|
+
* @beta
|
|
9304
|
+
*/
|
|
9305
|
+
function sendCustomTelemetryData(stageNameIdentifier, timestamp) {
|
|
9306
|
+
var _a;
|
|
9307
|
+
if (timestamp === void 0) { timestamp = (_a = getCurrentTimestamp()) !== null && _a !== void 0 ? _a : Date.now(); }
|
|
9308
|
+
return customTelemetry_awaiter(this, void 0, void 0, function* () {
|
|
9309
|
+
ensureInitialized(runtime);
|
|
9310
|
+
copilotLogger('Sending custom telemetry data to host for stage: %s to record timestamp: %s', stageNameIdentifier, timestamp);
|
|
9311
|
+
return callFunctionInHost("copilot.customTelemetry.sendCustomTelemetryData" /* ApiName.Copilot_CustomTelemetry_SendCustomTelemetryData */, [stageNameIdentifier.toString(), timestamp], getApiVersionTag(copilotTelemetryVersionNumber, "copilot.customTelemetry.sendCustomTelemetryData" /* ApiName.Copilot_CustomTelemetry_SendCustomTelemetryData */));
|
|
9312
|
+
});
|
|
9313
|
+
}
|
|
9314
|
+
|
|
9245
9315
|
;// ./src/private/copilot/eligibility.ts
|
|
9246
9316
|
/**
|
|
9247
9317
|
* @beta
|
|
@@ -9266,8 +9336,8 @@ var eligibility_awaiter = (undefined && undefined.__awaiter) || function (thisAr
|
|
|
9266
9336
|
|
|
9267
9337
|
|
|
9268
9338
|
|
|
9269
|
-
const
|
|
9270
|
-
const
|
|
9339
|
+
const eligibility_copilotTelemetryVersionNumber = "v2" /* ApiVersionNumber.V_2 */;
|
|
9340
|
+
const eligibility_copilotLogger = getLogger('copilot');
|
|
9271
9341
|
/**
|
|
9272
9342
|
* @hidden
|
|
9273
9343
|
* @internal
|
|
@@ -9300,12 +9370,12 @@ function getEligibilityInfo() {
|
|
|
9300
9370
|
}
|
|
9301
9371
|
// Return the eligibility information if it is already available
|
|
9302
9372
|
if ((_a = runtime.hostVersionsInfo) === null || _a === void 0 ? void 0 : _a.appEligibilityInformation) {
|
|
9303
|
-
|
|
9373
|
+
eligibility_copilotLogger('Eligibility information is already available on runtime.');
|
|
9304
9374
|
return runtime.hostVersionsInfo.appEligibilityInformation;
|
|
9305
9375
|
}
|
|
9306
|
-
|
|
9376
|
+
eligibility_copilotLogger('Eligibility information is not available on runtime. Requesting from host.');
|
|
9307
9377
|
// Send message to host SDK to get eligibility information
|
|
9308
|
-
const response = yield sendAndUnwrap(getApiVersionTag(
|
|
9378
|
+
const response = yield sendAndUnwrap(getApiVersionTag(eligibility_copilotTelemetryVersionNumber, "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */), "copilot.eligibility.getEligibilityInfo" /* ApiName.Copilot_Eligibility_GetEligibilityInfo */);
|
|
9309
9379
|
if (isSdkError(response)) {
|
|
9310
9380
|
throw new Error(`Error code: ${response.errorCode}, message: ${(_b = response.message) !== null && _b !== void 0 ? _b : 'Failed to get eligibility information from the host.'}`);
|
|
9311
9381
|
}
|
|
@@ -9333,6 +9403,7 @@ function isEligibilityInfoValid(eligibilityInfo) {
|
|
|
9333
9403
|
;// ./src/private/copilot/copilot.ts
|
|
9334
9404
|
|
|
9335
9405
|
|
|
9406
|
+
|
|
9336
9407
|
|
|
9337
9408
|
;// ./src/private/externalAppAuthentication.ts
|
|
9338
9409
|
/**
|
|
@@ -18162,6 +18233,7 @@ function marketplace_isSupported() {
|
|
|
18162
18233
|
|
|
18163
18234
|
|
|
18164
18235
|
|
|
18236
|
+
|
|
18165
18237
|
|
|
18166
18238
|
|
|
18167
18239
|
//It is necessary to export the LiveShareHost class from liveShareHost.ts individually as well
|