@microsoft/teams-js 2.47.2 → 2.48.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/dist/esm/packages/teams-js/dts/internal/appHelpers.d.ts +1 -0
- package/dist/esm/packages/teams-js/dts/internal/handlers.d.ts +6 -0
- package/dist/esm/packages/teams-js/dts/internal/telemetry.d.ts +12 -1
- package/dist/esm/packages/teams-js/dts/private/index.d.ts +2 -0
- package/dist/esm/packages/teams-js/dts/private/widgetHosting/widgetContext.d.ts +121 -0
- package/dist/esm/packages/teams-js/dts/private/widgetHosting/widgetHosting.d.ts +101 -0
- package/dist/esm/packages/teams-js/dts/public/app/app.d.ts +20 -1
- package/dist/esm/packages/teams-js/dts/public/interfaces.d.ts +8 -0
- package/dist/esm/packages/teams-js/dts/public/runtime.d.ts +1 -0
- package/dist/esm/packages/teams-js/src/artifactsForCDN/validDomains.json.js +1 -1
- package/dist/esm/packages/teams-js/src/index.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/appHelpers.js +1 -1
- package/dist/esm/packages/teams-js/src/internal/handlers.js +1 -1
- package/dist/esm/packages/teams-js/src/private/widgetHosting/widgetHosting.js +1 -0
- package/dist/esm/packages/teams-js/src/public/app/app.js +1 -1
- package/dist/esm/packages/teams-js/src/public/version.js +1 -1
- package/dist/umd/MicrosoftTeams.js +359 -5
- 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 -53
|
@@ -1107,7 +1107,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
1107
1107
|
videoEffects: () => (/* reexport */ videoEffects_namespaceObject),
|
|
1108
1108
|
videoEffectsEx: () => (/* reexport */ videoEffectsEx_namespaceObject),
|
|
1109
1109
|
visualMedia: () => (/* reexport */ visualMedia_namespaceObject),
|
|
1110
|
-
webStorage: () => (/* reexport */ webStorage_namespaceObject)
|
|
1110
|
+
webStorage: () => (/* reexport */ webStorage_namespaceObject),
|
|
1111
|
+
widgetHosting: () => (/* reexport */ widgetHosting_namespaceObject)
|
|
1111
1112
|
});
|
|
1112
1113
|
|
|
1113
1114
|
// NAMESPACE OBJECT: ./src/private/messageChannels/telemetry.ts
|
|
@@ -1156,6 +1157,7 @@ __webpack_require__.d(app_namespaceObject, {
|
|
|
1156
1157
|
notifySuccess: () => (notifySuccess),
|
|
1157
1158
|
openLink: () => (openLink),
|
|
1158
1159
|
registerHostToAppPerformanceMetricsHandler: () => (registerHostToAppPerformanceMetricsHandler),
|
|
1160
|
+
registerOnContextChangeHandler: () => (registerOnContextChangeHandler),
|
|
1159
1161
|
registerOnThemeChangeHandler: () => (registerOnThemeChangeHandler)
|
|
1160
1162
|
});
|
|
1161
1163
|
|
|
@@ -1672,6 +1674,22 @@ __webpack_require__.d(store_namespaceObject, {
|
|
|
1672
1674
|
openSpecificStore: () => (openSpecificStore)
|
|
1673
1675
|
});
|
|
1674
1676
|
|
|
1677
|
+
// NAMESPACE OBJECT: ./src/private/widgetHosting/widgetHosting.ts
|
|
1678
|
+
var widgetHosting_namespaceObject = {};
|
|
1679
|
+
__webpack_require__.r(widgetHosting_namespaceObject);
|
|
1680
|
+
__webpack_require__.d(widgetHosting_namespaceObject, {
|
|
1681
|
+
callTool: () => (callTool),
|
|
1682
|
+
contentSizeChanged: () => (contentSizeChanged),
|
|
1683
|
+
isSupported: () => (widgetHosting_isSupported),
|
|
1684
|
+
notifyIntrinsicHeight: () => (notifyIntrinsicHeight),
|
|
1685
|
+
openExternal: () => (openExternal),
|
|
1686
|
+
registerModalCloseHandler: () => (registerModalCloseHandler),
|
|
1687
|
+
requestDisplayMode: () => (requestDisplayMode),
|
|
1688
|
+
requestModal: () => (requestModal),
|
|
1689
|
+
sendFollowUpMessage: () => (sendFollowUpMessage),
|
|
1690
|
+
setWidgetState: () => (setWidgetState)
|
|
1691
|
+
});
|
|
1692
|
+
|
|
1675
1693
|
// NAMESPACE OBJECT: ./src/public/authentication.ts
|
|
1676
1694
|
var authentication_namespaceObject = {};
|
|
1677
1695
|
__webpack_require__.r(authentication_namespaceObject);
|
|
@@ -2268,7 +2286,7 @@ var ClipboardSupportedMimeType;
|
|
|
2268
2286
|
})(ClipboardSupportedMimeType || (ClipboardSupportedMimeType = {}));
|
|
2269
2287
|
|
|
2270
2288
|
;// ./src/artifactsForCDN/validDomains.json
|
|
2271
|
-
const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.office365.us","outlook-dod.office365.us","webmail.apps.mil","outlook.live.com","outlook-sdf.live.com","teams.live.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","devspaces.skype.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","work.bing.com","www.bing.com","www.staging-bing-int.com","*.cloud.microsoft","*.m365.cloud.microsoft","*.outlook.cloud.microsoft","chatuxmanager.svc.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net","fa000000136.resources.office.net","fa000000125.officeapps.live.com","fa000000129.officeapps.live.com","fa000000124.officeapps.live.com","fa000000128.officeapps.live.com"]}');
|
|
2289
|
+
const validDomains_namespaceObject = /*#__PURE__*/JSON.parse('{"validOrigins":["teams.microsoft.com","teams.microsoft.us","gov.teams.microsoft.us","dod.teams.microsoft.us","int.teams.microsoft.com","outlook.office.com","outlook-sdf.office.com","outlook.office365.com","outlook-sdf.office365.com","outlook.office365.us","outlook-dod.office365.us","webmail.apps.mil","outlook.live.com","outlook-sdf.live.com","teams.live.com","local.teams.live.com","local.teams.live.com:8080","local.teams.office.com","local.teams.office.com:8080","devspaces.skype.com","*.www.office.com","www.office.com","word.office.com","excel.office.com","powerpoint.office.com","www.officeppe.com","*.www.microsoft365.com","www.microsoft365.com","bing.com","edgeservices.bing.com","work.bing.com","www.bing.com","www.staging-bing-int.com","*.cloud.microsoft","*.m365.cloud.microsoft","*.outlook.cloud.microsoft","chatuxmanager.svc.cloud.microsoft","copilot.microsoft.com","windows.msn.com","fa000000125.resources.office.net","fa000000129.resources.office.net","fa000000124.resources.office.net","fa000000128.resources.office.net","fa000000136.resources.office.net","fa000000125.officeapps.live.com","fa000000129.officeapps.live.com","fa000000124.officeapps.live.com","fa000000128.officeapps.live.com","fa000000136.mro1cdnstorage.public.onecdn.static.microsoft","substrate-msb-bizchatvnext-service.sdf01.substrate-msb-bingatwork.eastus2-sdf.cosmic-ppe.office.net","office-home-m365copilotapp.wus2sdf1.office-home-m365copilotapp.westus2-sdf.cosmic-ppe.office.net","office-home-m365copilotapp.wus2test1.office-home-m365copilotapp.westus2-test.cosmic-int.office.net","m365copilotapp.svc.cloud.microsoft","m365copilotapp.svc.cloud.dev.microsoft","ffc-copilot.officeapps.live.com","m365.cloud.dev.microsoft","m365.cloud.dev.microsoft:3001"]}');
|
|
2272
2290
|
var artifactsForCDN_validDomains_namespaceObject = /*#__PURE__*/__webpack_require__.t(validDomains_namespaceObject, 2);
|
|
2273
2291
|
;// ./src/internal/constants.ts
|
|
2274
2292
|
|
|
@@ -4650,7 +4668,7 @@ function isSerializable(arg) {
|
|
|
4650
4668
|
* @hidden
|
|
4651
4669
|
* Package version.
|
|
4652
4670
|
*/
|
|
4653
|
-
const version = "2.
|
|
4671
|
+
const version = "2.48.0-beta.0";
|
|
4654
4672
|
|
|
4655
4673
|
;// ./src/public/featureFlags.ts
|
|
4656
4674
|
// 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.
|
|
@@ -5469,6 +5487,17 @@ function notifyExpectedFailure(expectedFailureRequest) {
|
|
|
5469
5487
|
function registerOnThemeChangeHandler(handler) {
|
|
5470
5488
|
registerOnThemeChangeHandlerHelper(getApiVersionTag(appTelemetryVersionNumber, "app.registerOnThemeChangeHandler" /* ApiName.App_RegisterOnThemeChangeHandler */), handler);
|
|
5471
5489
|
}
|
|
5490
|
+
/**
|
|
5491
|
+
* Registers a handler for content (context) changes.
|
|
5492
|
+
*
|
|
5493
|
+
* @remarks
|
|
5494
|
+
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
|
|
5495
|
+
*
|
|
5496
|
+
* @param handler - The handler to invoke when the app's content context changes.
|
|
5497
|
+
*/
|
|
5498
|
+
function registerOnContextChangeHandler(handler) {
|
|
5499
|
+
registerOnContextChangeHandlerHelper(getApiVersionTag(appTelemetryVersionNumber, "app.registerOnContextChangeHandler" /* ApiName.App_RegisterOnContextChangeHandler */), handler);
|
|
5500
|
+
}
|
|
5472
5501
|
/**
|
|
5473
5502
|
* Registers a function for handling data of host to app message delay.
|
|
5474
5503
|
*
|
|
@@ -5542,6 +5571,7 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
|
5542
5571
|
clientType: legacyContext.hostClientType ? legacyContext.hostClientType : HostClientType.web,
|
|
5543
5572
|
sessionId: legacyContext.sessionId ? legacyContext.sessionId : '',
|
|
5544
5573
|
ringId: legacyContext.ringId,
|
|
5574
|
+
ancestors: legacyContext.hostAncestors,
|
|
5545
5575
|
},
|
|
5546
5576
|
appLaunchId: legacyContext.appLaunchId,
|
|
5547
5577
|
appId: legacyContext.appId ? new AppId(legacyContext.appId) : undefined,
|
|
@@ -6687,6 +6717,10 @@ function registerOnThemeChangeHandlerHelper(apiVersionTag, handler) {
|
|
|
6687
6717
|
!isNullOrUndefined(handler) && ensureInitializeCalled();
|
|
6688
6718
|
handlers_registerOnThemeChangeHandler(apiVersionTag, handler);
|
|
6689
6719
|
}
|
|
6720
|
+
function registerOnContextChangeHandlerHelper(apiVersionTag, handler) {
|
|
6721
|
+
!isNullOrUndefined(handler) && ensureInitializeCalled();
|
|
6722
|
+
handlers_registerOnContextChangeHandler(apiVersionTag, handler);
|
|
6723
|
+
}
|
|
6690
6724
|
function openLinkHelper(apiVersionTag, deepLink) {
|
|
6691
6725
|
return new Promise((resolve) => {
|
|
6692
6726
|
ensureInitialized(runtime, FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
|
@@ -7576,15 +7610,15 @@ class HandlersPrivate {
|
|
|
7576
7610
|
/**
|
|
7577
7611
|
* @internal
|
|
7578
7612
|
* Limited to Microsoft-internal use
|
|
7579
|
-
*
|
|
7613
|
+
* Uninitialize the handlers.
|
|
7580
7614
|
*/
|
|
7581
7615
|
static uninitializeHandlers() {
|
|
7582
7616
|
HandlersPrivate.handlers = {};
|
|
7583
7617
|
HandlersPrivate.themeChangeHandler = null;
|
|
7584
|
-
HandlersPrivate.loadHandler = null;
|
|
7585
7618
|
HandlersPrivate.beforeUnloadHandler = null;
|
|
7586
7619
|
HandlersPrivate.beforeSuspendOrTerminateHandler = null;
|
|
7587
7620
|
HandlersPrivate.resumeHandler = null;
|
|
7621
|
+
HandlersPrivate.contextChangeHandler = null;
|
|
7588
7622
|
}
|
|
7589
7623
|
}
|
|
7590
7624
|
HandlersPrivate.handlers = {};
|
|
@@ -7600,6 +7634,7 @@ HandlersPrivate.beforeUnloadHandler = null;
|
|
|
7600
7634
|
HandlersPrivate.beforeSuspendOrTerminateHandler = null;
|
|
7601
7635
|
HandlersPrivate.resumeHandler = null;
|
|
7602
7636
|
HandlersPrivate.hostToAppPerformanceMetricsHandler = null;
|
|
7637
|
+
HandlersPrivate.contextChangeHandler = null;
|
|
7603
7638
|
/**
|
|
7604
7639
|
* @internal
|
|
7605
7640
|
* Limited to Microsoft-internal use
|
|
@@ -7691,6 +7726,14 @@ function handlers_registerOnThemeChangeHandler(apiVersionTag, handler) {
|
|
|
7691
7726
|
HandlersPrivate.themeChangeHandler = handler;
|
|
7692
7727
|
!isNullOrUndefined(handler) && sendMessageToParent(apiVersionTag, 'registerHandler', ['themeChange']);
|
|
7693
7728
|
}
|
|
7729
|
+
/**
|
|
7730
|
+
* @internal
|
|
7731
|
+
* Limited to Microsoft-internal use
|
|
7732
|
+
*/
|
|
7733
|
+
function handlers_registerOnContextChangeHandler(apiVersionTag, handler) {
|
|
7734
|
+
HandlersPrivate.contextChangeHandler = handler;
|
|
7735
|
+
!isNullOrUndefined(handler) && sendMessageToParent(apiVersionTag, 'registerHandler', ['contextChange']);
|
|
7736
|
+
}
|
|
7694
7737
|
/**
|
|
7695
7738
|
* @internal
|
|
7696
7739
|
* Limited to Microsoft-internal use
|
|
@@ -14133,6 +14176,315 @@ function serializeValidSize(size) {
|
|
|
14133
14176
|
return JSON.stringify(size);
|
|
14134
14177
|
}
|
|
14135
14178
|
|
|
14179
|
+
;// ./src/private/widgetHosting/widgetHosting.ts
|
|
14180
|
+
/**
|
|
14181
|
+
* @beta
|
|
14182
|
+
* @hidden
|
|
14183
|
+
* User information required by specific apps
|
|
14184
|
+
* @internal
|
|
14185
|
+
* Limited to Microsoft-internal use
|
|
14186
|
+
* @module
|
|
14187
|
+
*/
|
|
14188
|
+
var widgetHosting_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14189
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14190
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
14191
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
14192
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
14193
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
14194
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14195
|
+
});
|
|
14196
|
+
};
|
|
14197
|
+
|
|
14198
|
+
|
|
14199
|
+
|
|
14200
|
+
|
|
14201
|
+
|
|
14202
|
+
|
|
14203
|
+
|
|
14204
|
+
const widgetHostingVersionNumber = "v1" /* ApiVersionNumber.V_1 */; // TODO: Ask Kangxuan for this version number
|
|
14205
|
+
const widgetHostingLogger = getLogger('widgetHosting');
|
|
14206
|
+
/**
|
|
14207
|
+
* @hidden
|
|
14208
|
+
* @internal
|
|
14209
|
+
* Limited to Microsoft-internal use
|
|
14210
|
+
* @beta
|
|
14211
|
+
* @returns boolean to represent whether widgetHosting capability is supported
|
|
14212
|
+
*
|
|
14213
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
|
14214
|
+
*/
|
|
14215
|
+
function widgetHosting_isSupported() {
|
|
14216
|
+
return ensureInitialized(runtime) && !!runtime.supports.widgetHosting;
|
|
14217
|
+
}
|
|
14218
|
+
function callTool(widgetId, input) {
|
|
14219
|
+
return widgetHosting_awaiter(this, void 0, void 0, function* () {
|
|
14220
|
+
ensureInitializeCalled();
|
|
14221
|
+
widgetHostingLogger('Calling tool with widgetId and input: ', { widgetId, input });
|
|
14222
|
+
return callFunctionInHostAndHandleResponse("widgetHosting.callTool" /* ApiName.WidgetHosting_CallTool */, [new SerializableToolInput(widgetId, input)], new CallToolResponseHandler(), getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.callTool" /* ApiName.WidgetHosting_CallTool */), isSdkError);
|
|
14223
|
+
});
|
|
14224
|
+
}
|
|
14225
|
+
/**
|
|
14226
|
+
* @beta
|
|
14227
|
+
* @hidden
|
|
14228
|
+
* Sends a follow-up message to the host
|
|
14229
|
+
* @internal
|
|
14230
|
+
* Limited to Microsoft-internal use
|
|
14231
|
+
*/
|
|
14232
|
+
function sendFollowUpMessage(widgetId, args) {
|
|
14233
|
+
return widgetHosting_awaiter(this, void 0, void 0, function* () {
|
|
14234
|
+
ensureInitializeCalled();
|
|
14235
|
+
widgetHostingLogger('Sending follow-up message with widgetId and prompt: ', { widgetId, prompt: args.prompt });
|
|
14236
|
+
return callFunctionInHost("widgetHosting.sendFollowUpMessage" /* ApiName.WidgetHosting_SendFollowUpMessage */, [new SerializableFollowUpMessageArgs(widgetId, args)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.sendFollowUpMessage" /* ApiName.WidgetHosting_SendFollowUpMessage */));
|
|
14237
|
+
});
|
|
14238
|
+
}
|
|
14239
|
+
/**
|
|
14240
|
+
* @beta
|
|
14241
|
+
* @hidden
|
|
14242
|
+
* Requests a specific display mode for the widget
|
|
14243
|
+
* @internal
|
|
14244
|
+
* Limited to Microsoft-internal use
|
|
14245
|
+
*/
|
|
14246
|
+
function requestDisplayMode(widgetId, args) {
|
|
14247
|
+
return widgetHosting_awaiter(this, void 0, void 0, function* () {
|
|
14248
|
+
ensureInitializeCalled();
|
|
14249
|
+
widgetHostingLogger('Requesting display mode with widgetId: ', { widgetId, mode: args.mode });
|
|
14250
|
+
return callFunctionInHost("widgetHosting.requestDisplayMode" /* ApiName.WidgetHosting_RequestDisplayMode */, [new SerializableDisplayModeArgs(widgetId, args)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.requestDisplayMode" /* ApiName.WidgetHosting_RequestDisplayMode */));
|
|
14251
|
+
});
|
|
14252
|
+
}
|
|
14253
|
+
/**
|
|
14254
|
+
* @beta
|
|
14255
|
+
* @hidden
|
|
14256
|
+
* Requests a modal dialog to be displayed
|
|
14257
|
+
* @internal
|
|
14258
|
+
* Limited to Microsoft-internal use
|
|
14259
|
+
* @param widgetId - The unique identifier for the widget
|
|
14260
|
+
* @param options - Configuration options for the modal
|
|
14261
|
+
* @returns A DOM element representing the modal's root
|
|
14262
|
+
*/
|
|
14263
|
+
function requestModal(widgetId, options) {
|
|
14264
|
+
return widgetHosting_awaiter(this, void 0, void 0, function* () {
|
|
14265
|
+
ensureInitializeCalled();
|
|
14266
|
+
widgetHostingLogger('Requesting modal with widgetId and options: ', { widgetId, options });
|
|
14267
|
+
return callFunctionInHostAndHandleResponse("widgetHosting.requestModal" /* ApiName.WidgetHosting_RequestModal */, [new SerializableModalOptions(widgetId, options)], new RequestModalResponseHandler(), getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.requestModal" /* ApiName.WidgetHosting_RequestModal */), isSdkError);
|
|
14268
|
+
});
|
|
14269
|
+
}
|
|
14270
|
+
/**
|
|
14271
|
+
* @beta
|
|
14272
|
+
* @hidden
|
|
14273
|
+
* Notifies the host about the intrinsic height of the widget content
|
|
14274
|
+
* @internal
|
|
14275
|
+
* Limited to Microsoft-internal use
|
|
14276
|
+
*/
|
|
14277
|
+
function notifyIntrinsicHeight(widgetId, height) {
|
|
14278
|
+
ensureInitializeCalled();
|
|
14279
|
+
widgetHostingLogger('Notifying intrinsic height with widgetId: ', { widgetId, height });
|
|
14280
|
+
callFunctionInHost("widgetHosting.notifyIntrinsicHeight" /* ApiName.WidgetHosting_NotifyIntrinsicHeight */, [new SerializableIntrinsicHeightArgs(widgetId, height)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.notifyIntrinsicHeight" /* ApiName.WidgetHosting_NotifyIntrinsicHeight */));
|
|
14281
|
+
}
|
|
14282
|
+
/**
|
|
14283
|
+
* @beta
|
|
14284
|
+
* @hidden
|
|
14285
|
+
* Notifies the host about content size changes
|
|
14286
|
+
* @internal
|
|
14287
|
+
* Limited to Microsoft-internal use
|
|
14288
|
+
* @param widgetId - The unique identifier for the widget
|
|
14289
|
+
* @param width - The width of the content in pixels
|
|
14290
|
+
* @param height - The height of the content in pixels
|
|
14291
|
+
*/
|
|
14292
|
+
function contentSizeChanged(widgetId, width, height) {
|
|
14293
|
+
ensureInitializeCalled();
|
|
14294
|
+
widgetHostingLogger('Content size changed with widgetId: ', { widgetId, width, height });
|
|
14295
|
+
callFunctionInHost("widgetHosting.contentSizeChanged" /* ApiName.WidgetHosting_ContentSizeChanged */, [new SerializableContentSizeArgs(widgetId, width, height)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.contentSizeChanged" /* ApiName.WidgetHosting_ContentSizeChanged */));
|
|
14296
|
+
}
|
|
14297
|
+
/**
|
|
14298
|
+
* @beta
|
|
14299
|
+
* @hidden
|
|
14300
|
+
* Sets the widget state
|
|
14301
|
+
* @internal
|
|
14302
|
+
* Limited to Microsoft-internal use
|
|
14303
|
+
*/
|
|
14304
|
+
function setWidgetState(widgetId, state) {
|
|
14305
|
+
return widgetHosting_awaiter(this, void 0, void 0, function* () {
|
|
14306
|
+
ensureInitializeCalled();
|
|
14307
|
+
widgetHostingLogger('Setting widget state with widgetId: ', { widgetId, state });
|
|
14308
|
+
return callFunctionInHost("widgetHosting.setWidgetState" /* ApiName.WidgetHosting_SetWidgetState */, [new SerializableWidgetState(widgetId, state)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.setWidgetState" /* ApiName.WidgetHosting_SetWidgetState */));
|
|
14309
|
+
});
|
|
14310
|
+
}
|
|
14311
|
+
/**
|
|
14312
|
+
* @beta
|
|
14313
|
+
* @hidden
|
|
14314
|
+
* Opens an external URL
|
|
14315
|
+
* @internal
|
|
14316
|
+
* Limited to Microsoft-internal use
|
|
14317
|
+
*/
|
|
14318
|
+
function openExternal(widgetId, payload) {
|
|
14319
|
+
ensureInitializeCalled();
|
|
14320
|
+
widgetHostingLogger('Opening external URL with widgetId: ', { widgetId, href: payload.href });
|
|
14321
|
+
callFunctionInHost("widgetHosting.openExternal" /* ApiName.WidgetHosting_OpenExternal */, [new SerializableOpenExternalArgs(widgetId, payload)], getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.openExternal" /* ApiName.WidgetHosting_OpenExternal */));
|
|
14322
|
+
}
|
|
14323
|
+
/**
|
|
14324
|
+
* @hidden
|
|
14325
|
+
* @beta
|
|
14326
|
+
* Registers a handler to be called when a modal is closed.
|
|
14327
|
+
* This handler will be called when the user closes a modal or when .close() is invoked.
|
|
14328
|
+
* @param handler - The handler for modal close events.
|
|
14329
|
+
*
|
|
14330
|
+
* @internal
|
|
14331
|
+
* Limited to Microsoft-internal use
|
|
14332
|
+
*/
|
|
14333
|
+
function registerModalCloseHandler(handler) {
|
|
14334
|
+
registerHandlerHelper(getApiVersionTag(widgetHostingVersionNumber, "widgetHosting.registerModalCloseHandler" /* ApiName.WidgetHosting_RegisterModalCloseHandler */), 'widgetHosting.closeWidgetModal', handler, [], () => {
|
|
14335
|
+
if (!widgetHosting_isSupported()) {
|
|
14336
|
+
throw new Error('Widget Hosting is not supported on this platform');
|
|
14337
|
+
}
|
|
14338
|
+
});
|
|
14339
|
+
}
|
|
14340
|
+
class CallToolResponseHandler extends ResponseHandler {
|
|
14341
|
+
validate(response) {
|
|
14342
|
+
return response !== null && typeof response === 'object';
|
|
14343
|
+
}
|
|
14344
|
+
deserialize(response) {
|
|
14345
|
+
return response;
|
|
14346
|
+
}
|
|
14347
|
+
}
|
|
14348
|
+
class RequestModalResponseHandler extends ResponseHandler {
|
|
14349
|
+
validate(response) {
|
|
14350
|
+
return response !== null && typeof response === 'object';
|
|
14351
|
+
}
|
|
14352
|
+
deserialize(response) {
|
|
14353
|
+
return response;
|
|
14354
|
+
}
|
|
14355
|
+
}
|
|
14356
|
+
/**
|
|
14357
|
+
* Serializable wrapper for IToolInput to enable host communication
|
|
14358
|
+
*/
|
|
14359
|
+
class SerializableToolInput {
|
|
14360
|
+
constructor(widgetId, toolInput) {
|
|
14361
|
+
this.widgetId = widgetId;
|
|
14362
|
+
this.toolInput = toolInput;
|
|
14363
|
+
}
|
|
14364
|
+
/**
|
|
14365
|
+
* Serializes the tool input to a JSON-compliant format for host communication.
|
|
14366
|
+
* @returns JSON representation of the tool input.
|
|
14367
|
+
*/
|
|
14368
|
+
serialize() {
|
|
14369
|
+
return {
|
|
14370
|
+
widgetId: this.widgetId,
|
|
14371
|
+
name: this.toolInput.name,
|
|
14372
|
+
arguments: this.toolInput.arguments,
|
|
14373
|
+
};
|
|
14374
|
+
}
|
|
14375
|
+
}
|
|
14376
|
+
/**
|
|
14377
|
+
* Serializable wrapper for follow-up message arguments
|
|
14378
|
+
*/
|
|
14379
|
+
class SerializableFollowUpMessageArgs {
|
|
14380
|
+
constructor(widgetId, args) {
|
|
14381
|
+
this.widgetId = widgetId;
|
|
14382
|
+
this.args = args;
|
|
14383
|
+
}
|
|
14384
|
+
serialize() {
|
|
14385
|
+
return {
|
|
14386
|
+
widgetId: this.widgetId,
|
|
14387
|
+
prompt: this.args.prompt,
|
|
14388
|
+
};
|
|
14389
|
+
}
|
|
14390
|
+
}
|
|
14391
|
+
/**
|
|
14392
|
+
* Serializable wrapper for display mode arguments
|
|
14393
|
+
*/
|
|
14394
|
+
class SerializableDisplayModeArgs {
|
|
14395
|
+
constructor(widgetId, args) {
|
|
14396
|
+
this.widgetId = widgetId;
|
|
14397
|
+
this.args = args;
|
|
14398
|
+
}
|
|
14399
|
+
serialize() {
|
|
14400
|
+
return {
|
|
14401
|
+
widgetId: this.widgetId,
|
|
14402
|
+
mode: this.args.mode,
|
|
14403
|
+
};
|
|
14404
|
+
}
|
|
14405
|
+
}
|
|
14406
|
+
/**
|
|
14407
|
+
* Serializable wrapper for external URL arguments
|
|
14408
|
+
*/
|
|
14409
|
+
class SerializableOpenExternalArgs {
|
|
14410
|
+
constructor(widgetId, payload) {
|
|
14411
|
+
this.widgetId = widgetId;
|
|
14412
|
+
this.payload = payload;
|
|
14413
|
+
}
|
|
14414
|
+
serialize() {
|
|
14415
|
+
return {
|
|
14416
|
+
widgetId: this.widgetId,
|
|
14417
|
+
href: this.payload.href,
|
|
14418
|
+
};
|
|
14419
|
+
}
|
|
14420
|
+
}
|
|
14421
|
+
/**
|
|
14422
|
+
* Serializable wrapper for widget state
|
|
14423
|
+
*/
|
|
14424
|
+
class SerializableWidgetState {
|
|
14425
|
+
constructor(widgetId, state) {
|
|
14426
|
+
this.widgetId = widgetId;
|
|
14427
|
+
this.state = state;
|
|
14428
|
+
}
|
|
14429
|
+
serialize() {
|
|
14430
|
+
return {
|
|
14431
|
+
widgetId: this.widgetId,
|
|
14432
|
+
state: this.state,
|
|
14433
|
+
};
|
|
14434
|
+
}
|
|
14435
|
+
}
|
|
14436
|
+
/**
|
|
14437
|
+
* Serializable wrapper for intrinsic height arguments
|
|
14438
|
+
*/
|
|
14439
|
+
class SerializableIntrinsicHeightArgs {
|
|
14440
|
+
constructor(widgetId, height) {
|
|
14441
|
+
this.widgetId = widgetId;
|
|
14442
|
+
this.height = height;
|
|
14443
|
+
}
|
|
14444
|
+
serialize() {
|
|
14445
|
+
return {
|
|
14446
|
+
widgetId: this.widgetId,
|
|
14447
|
+
height: this.height,
|
|
14448
|
+
};
|
|
14449
|
+
}
|
|
14450
|
+
}
|
|
14451
|
+
/**
|
|
14452
|
+
* Serializable wrapper for modal options
|
|
14453
|
+
*/
|
|
14454
|
+
class SerializableModalOptions {
|
|
14455
|
+
constructor(widgetId, options) {
|
|
14456
|
+
this.widgetId = widgetId;
|
|
14457
|
+
this.options = options;
|
|
14458
|
+
}
|
|
14459
|
+
serialize() {
|
|
14460
|
+
return {
|
|
14461
|
+
widgetId: this.widgetId,
|
|
14462
|
+
id: this.options.id,
|
|
14463
|
+
title: this.options.title,
|
|
14464
|
+
content: this.options.content,
|
|
14465
|
+
width: this.options.width,
|
|
14466
|
+
height: this.options.height,
|
|
14467
|
+
};
|
|
14468
|
+
}
|
|
14469
|
+
}
|
|
14470
|
+
/**
|
|
14471
|
+
* Serializable wrapper for content size arguments
|
|
14472
|
+
*/
|
|
14473
|
+
class SerializableContentSizeArgs {
|
|
14474
|
+
constructor(widgetId, width, height) {
|
|
14475
|
+
this.widgetId = widgetId;
|
|
14476
|
+
this.width = width;
|
|
14477
|
+
this.height = height;
|
|
14478
|
+
}
|
|
14479
|
+
serialize() {
|
|
14480
|
+
return {
|
|
14481
|
+
widgetId: this.widgetId,
|
|
14482
|
+
width: this.width,
|
|
14483
|
+
height: this.height,
|
|
14484
|
+
};
|
|
14485
|
+
}
|
|
14486
|
+
}
|
|
14487
|
+
|
|
14136
14488
|
;// ./src/private/index.ts
|
|
14137
14489
|
|
|
14138
14490
|
|
|
@@ -14178,6 +14530,8 @@ function serializeValidSize(size) {
|
|
|
14178
14530
|
|
|
14179
14531
|
|
|
14180
14532
|
|
|
14533
|
+
|
|
14534
|
+
|
|
14181
14535
|
|
|
14182
14536
|
|
|
14183
14537
|
|