@microsoft/teams-js 2.0.0-beta.3-dev.12 → 2.0.0-beta.3-dev.16
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/MicrosoftTeams.d.ts +30 -1
- package/dist/MicrosoftTeams.js +97 -107
- package/dist/MicrosoftTeams.js.map +1 -1
- package/dist/MicrosoftTeams.min.js +1 -1
- package/dist/MicrosoftTeams.min.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Microsoft Teams JavaScript client SDK
|
|
2
2
|
|
|
3
|
-
Welcome to the Teams client SDK monorepo! For breaking changes, please refer to our changelog in the monorepo root.
|
|
3
|
+
Welcome to the Teams client SDK monorepo! For breaking changes, please refer to our changelog in the monorepo root of the `2.0-preview` branch.
|
|
4
4
|
|
|
5
5
|
This JavaScript library is part of the [Microsoft Teams developer platform](https://developer.microsoft.com/microsoft-teams/). See full [SDK reference documentation](https://docs.microsoft.com/en-us/javascript/api/overview/msteams-client).
|
|
6
6
|
|
|
@@ -11,8 +11,8 @@ This JavaScript library is part of the [Microsoft Teams developer platform](http
|
|
|
11
11
|
|
|
12
12
|
1. Clone the repo
|
|
13
13
|
2. Navigate to the repo root and run `yarn install`
|
|
14
|
-
3. `yarn build` from repo root
|
|
15
|
-
4.
|
|
14
|
+
3. Run `yarn build` from repo root
|
|
15
|
+
4. To run Unit tests, run `yarn test`
|
|
16
16
|
|
|
17
17
|
TIP: whenever building or testing the Teams client SDK, you can run `yarn build` or `yarn test` from the packages/teams-js directory.
|
|
18
18
|
|
|
@@ -52,7 +52,7 @@ Reference the SDK inside of your `.html` page using:
|
|
|
52
52
|
<!-- Microsoft Teams JavaScript API (via CDN) -->
|
|
53
53
|
<script
|
|
54
54
|
src="https://res.cdn.office.net/teams-js/2.0.0-beta.2/js/MicrosoftTeams.min.js"
|
|
55
|
-
integrity="sha384-
|
|
55
|
+
integrity="sha384-RhShpWwRxSnc+keX0WZxCsf8olaKOOw416Jky+StW6qhctsNR3GMwav/hMB1Snas"
|
|
56
56
|
crossorigin="anonymous"
|
|
57
57
|
></script>
|
|
58
58
|
|
package/dist/MicrosoftTeams.d.ts
CHANGED
|
@@ -3970,6 +3970,21 @@ export namespace monetization {
|
|
|
3970
3970
|
term: string;
|
|
3971
3971
|
}
|
|
3972
3972
|
/**
|
|
3973
|
+
* @hidden
|
|
3974
|
+
* Hide from docs
|
|
3975
|
+
* Open dialog to start user's purchase experience
|
|
3976
|
+
*
|
|
3977
|
+
* @param planInfo optional parameter. It contains info of the subscription plan pushed to users.
|
|
3978
|
+
* error can either contain an error of type SdkError, incase of an error, or null when get is successful
|
|
3979
|
+
* @returns Promise that will be resolved when the operation has completed or rejected with SdkError value
|
|
3980
|
+
*
|
|
3981
|
+
* @internal
|
|
3982
|
+
*/
|
|
3983
|
+
function openPurchaseExperience(planInfo?: PlanInfo): Promise<void>;
|
|
3984
|
+
/**
|
|
3985
|
+
* @deprecated
|
|
3986
|
+
* As of 2.0.0-beta.3, please use {@link monetization.openPurchaseExperience monetization.openPurchaseExperience(planInfo?: PlanInfo): Promise\<void\>} instead.
|
|
3987
|
+
*
|
|
3973
3988
|
* @hidden
|
|
3974
3989
|
* Hide from docs
|
|
3975
3990
|
* Open dialog to start user's purchase experience
|
|
@@ -4280,6 +4295,20 @@ export namespace sharing {
|
|
|
4280
4295
|
preview?: boolean;
|
|
4281
4296
|
}
|
|
4282
4297
|
/**
|
|
4298
|
+
* @hidden
|
|
4299
|
+
* Feature is under development
|
|
4300
|
+
* Opens a share dialog for web content
|
|
4301
|
+
*
|
|
4302
|
+
* @param shareWebContentRequest - web content info
|
|
4303
|
+
* @returns Promise that will be fulfilled when the operation has completed
|
|
4304
|
+
*
|
|
4305
|
+
* @internal
|
|
4306
|
+
*/
|
|
4307
|
+
export function shareWebContent(shareWebContentRequest: IShareRequest<IShareRequestContentType>): Promise<void>;
|
|
4308
|
+
/**
|
|
4309
|
+
* @deprecated
|
|
4310
|
+
* As of 2.0.0-beta.3, please use {@link sharing.shareWebContent sharing.shareWebContent(shareWebContentRequest: IShareRequest\<IShareRequestContentType\>): Promise\<void\>} instead.
|
|
4311
|
+
*
|
|
4283
4312
|
* @hidden
|
|
4284
4313
|
* Feature is under development
|
|
4285
4314
|
* Opens a share dialog for web content
|
|
@@ -4289,7 +4318,7 @@ export namespace sharing {
|
|
|
4289
4318
|
*
|
|
4290
4319
|
* @internal
|
|
4291
4320
|
*/
|
|
4292
|
-
export function shareWebContent(shareWebContentRequest: IShareRequest<IShareRequestContentType>, callback
|
|
4321
|
+
export function shareWebContent(shareWebContentRequest: IShareRequest<IShareRequestContentType>, callback: (err?: SdkError) => void): void;
|
|
4293
4322
|
export function isSupported(): boolean;
|
|
4294
4323
|
export {};
|
|
4295
4324
|
}
|
package/dist/MicrosoftTeams.js
CHANGED
|
@@ -395,7 +395,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
395
395
|
});
|
|
396
396
|
|
|
397
397
|
;// CONCATENATED MODULE: ./src/internal/constants.ts
|
|
398
|
-
var version = '2.0.0-beta.3-dev.
|
|
398
|
+
var version = '2.0.0-beta.3-dev.16';
|
|
399
399
|
/**
|
|
400
400
|
* @hidden
|
|
401
401
|
* The SDK version when all SDK APIs started to check platform compatibility for the APIs was 1.6.0.
|
|
@@ -2726,10 +2726,15 @@ function initializeCommunication(validMessageOrigins) {
|
|
|
2726
2726
|
Communication.currentWindow.addEventListener('message', CommunicationPrivate.messageListener, false);
|
|
2727
2727
|
}
|
|
2728
2728
|
if (!Communication.parentWindow) {
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2729
|
+
var extendedWindow = Communication.currentWindow;
|
|
2730
|
+
if (extendedWindow.nativeInterface) {
|
|
2731
|
+
GlobalVars.isFramelessWindow = true;
|
|
2732
|
+
extendedWindow.onNativeMessage = handleParentMessage;
|
|
2733
|
+
}
|
|
2734
|
+
else {
|
|
2735
|
+
// at this point we weren't able to find a parent to talk to, no way initialization will succeed
|
|
2736
|
+
return Promise.reject(new Error('Initialization Failed. No Parent window found.'));
|
|
2737
|
+
}
|
|
2733
2738
|
}
|
|
2734
2739
|
try {
|
|
2735
2740
|
// Send the initialized message to any origin, because at this point we most likely don't know the origin
|
|
@@ -4293,6 +4298,7 @@ var meeting;
|
|
|
4293
4298
|
|
|
4294
4299
|
|
|
4295
4300
|
|
|
4301
|
+
|
|
4296
4302
|
/**
|
|
4297
4303
|
* @alpha
|
|
4298
4304
|
*/
|
|
@@ -4300,21 +4306,30 @@ var monetization;
|
|
|
4300
4306
|
(function (monetization) {
|
|
4301
4307
|
/**
|
|
4302
4308
|
* @hidden
|
|
4303
|
-
*
|
|
4304
|
-
*
|
|
4305
|
-
*
|
|
4306
|
-
* @param
|
|
4307
|
-
* @param
|
|
4308
|
-
*
|
|
4309
|
-
*
|
|
4310
|
-
* @internal
|
|
4309
|
+
* This function is the overloaded implementation of openPurchaseExperience.
|
|
4310
|
+
* Since the method signatures of the v1 callback and v2 promise differ in the type of the first parameter,
|
|
4311
|
+
* we need to do an extra check to know the typeof the @param1 to set the proper arguments of the utility function.
|
|
4312
|
+
* @param param1
|
|
4313
|
+
* @param param2
|
|
4314
|
+
* @returns Promise that will be resolved when the operation has completed or rejected with SdkError value
|
|
4311
4315
|
*/
|
|
4312
|
-
function openPurchaseExperience(
|
|
4313
|
-
|
|
4314
|
-
|
|
4316
|
+
function openPurchaseExperience(param1, param2) {
|
|
4317
|
+
var callback;
|
|
4318
|
+
var planInfo;
|
|
4319
|
+
if (typeof param1 === 'function') {
|
|
4320
|
+
callback = param1;
|
|
4321
|
+
planInfo = param2;
|
|
4322
|
+
}
|
|
4323
|
+
else {
|
|
4324
|
+
planInfo = param1;
|
|
4315
4325
|
}
|
|
4326
|
+
var wrappedFunction = function () {
|
|
4327
|
+
return new Promise(function (resolve) {
|
|
4328
|
+
resolve(sendAndHandleSdkError('monetization.openPurchaseExperience', planInfo));
|
|
4329
|
+
});
|
|
4330
|
+
};
|
|
4316
4331
|
ensureInitialized(FrameContexts.content);
|
|
4317
|
-
|
|
4332
|
+
return callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(wrappedFunction, callback);
|
|
4318
4333
|
}
|
|
4319
4334
|
monetization.openPurchaseExperience = openPurchaseExperience;
|
|
4320
4335
|
function isSupported() {
|
|
@@ -4550,6 +4565,7 @@ var video;
|
|
|
4550
4565
|
|
|
4551
4566
|
|
|
4552
4567
|
|
|
4568
|
+
|
|
4553
4569
|
/**
|
|
4554
4570
|
* @alpha
|
|
4555
4571
|
*/
|
|
@@ -4558,88 +4574,74 @@ var sharing;
|
|
|
4558
4574
|
sharing.SharingAPIMessages = {
|
|
4559
4575
|
shareWebContent: 'sharing.shareWebContent',
|
|
4560
4576
|
};
|
|
4561
|
-
/**
|
|
4562
|
-
* @hidden
|
|
4563
|
-
* Feature is under development
|
|
4564
|
-
* Opens a share dialog for web content
|
|
4565
|
-
*
|
|
4566
|
-
* @param shareWebContentRequest - web content info
|
|
4567
|
-
* @param callback - optional callback
|
|
4568
|
-
*
|
|
4569
|
-
* @internal
|
|
4570
|
-
*/
|
|
4571
4577
|
function shareWebContent(shareWebContentRequest, callback) {
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4578
|
+
// validate the given input (synchronous check)
|
|
4579
|
+
try {
|
|
4580
|
+
validateNonEmptyContent(shareWebContentRequest);
|
|
4581
|
+
validateTypeConsistency(shareWebContentRequest);
|
|
4582
|
+
validateContentForSupportedTypes(shareWebContentRequest);
|
|
4577
4583
|
}
|
|
4578
|
-
|
|
4579
|
-
return
|
|
4584
|
+
catch (err) {
|
|
4585
|
+
//return the error via callback(v1) or rejected promise(v2)
|
|
4586
|
+
var wrappedFunction = function () { return Promise.reject(err); };
|
|
4587
|
+
return callCallbackWithSdkErrorFromPromiseAndReturnPromise(wrappedFunction, callback);
|
|
4580
4588
|
}
|
|
4581
4589
|
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
|
4582
|
-
|
|
4590
|
+
return callCallbackWithSdkErrorFromPromiseAndReturnPromise(shareWebContentHelper, callback, shareWebContentRequest);
|
|
4583
4591
|
}
|
|
4584
4592
|
sharing.shareWebContent = shareWebContent;
|
|
4593
|
+
function shareWebContentHelper(shareWebContentRequest) {
|
|
4594
|
+
return new Promise(function (resolve) {
|
|
4595
|
+
resolve(sendAndHandleSdkError(sharing.SharingAPIMessages.shareWebContent, shareWebContentRequest));
|
|
4596
|
+
});
|
|
4597
|
+
}
|
|
4585
4598
|
/**
|
|
4586
|
-
*
|
|
4599
|
+
* Functions for validating the shareRequest input parameter
|
|
4587
4600
|
*/
|
|
4588
|
-
function validateNonEmptyContent(shareRequest
|
|
4601
|
+
function validateNonEmptyContent(shareRequest) {
|
|
4589
4602
|
if (!(shareRequest && shareRequest.content && shareRequest.content.length)) {
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
}
|
|
4596
|
-
return false;
|
|
4603
|
+
var err = {
|
|
4604
|
+
errorCode: ErrorCode.INVALID_ARGUMENTS,
|
|
4605
|
+
message: 'Shared content is missing',
|
|
4606
|
+
};
|
|
4607
|
+
throw err;
|
|
4597
4608
|
}
|
|
4598
|
-
return true;
|
|
4599
4609
|
}
|
|
4600
|
-
function validateTypeConsistency(shareRequest
|
|
4610
|
+
function validateTypeConsistency(shareRequest) {
|
|
4611
|
+
var err;
|
|
4601
4612
|
if (shareRequest.content.some(function (item) { return !item.type; })) {
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
}
|
|
4608
|
-
return false;
|
|
4613
|
+
err = {
|
|
4614
|
+
errorCode: ErrorCode.INVALID_ARGUMENTS,
|
|
4615
|
+
message: 'Shared content type cannot be undefined',
|
|
4616
|
+
};
|
|
4617
|
+
throw err;
|
|
4609
4618
|
}
|
|
4610
4619
|
if (shareRequest.content.some(function (item) { return item.type !== shareRequest.content[0].type; })) {
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
}
|
|
4617
|
-
return false;
|
|
4620
|
+
err = {
|
|
4621
|
+
errorCode: ErrorCode.INVALID_ARGUMENTS,
|
|
4622
|
+
message: 'Shared content must be of the same type',
|
|
4623
|
+
};
|
|
4624
|
+
throw err;
|
|
4618
4625
|
}
|
|
4619
|
-
return true;
|
|
4620
4626
|
}
|
|
4621
|
-
function validateContentForSupportedTypes(shareRequest
|
|
4627
|
+
function validateContentForSupportedTypes(shareRequest) {
|
|
4628
|
+
var err;
|
|
4622
4629
|
if (shareRequest.content[0].type === 'URL') {
|
|
4623
4630
|
if (shareRequest.content.some(function (item) { return !item.url; })) {
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
}
|
|
4630
|
-
return false;
|
|
4631
|
+
err = {
|
|
4632
|
+
errorCode: ErrorCode.INVALID_ARGUMENTS,
|
|
4633
|
+
message: 'URLs are required for URL content types',
|
|
4634
|
+
};
|
|
4635
|
+
throw err;
|
|
4631
4636
|
}
|
|
4632
4637
|
}
|
|
4633
4638
|
else {
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
}
|
|
4640
|
-
return false;
|
|
4639
|
+
err = {
|
|
4640
|
+
errorCode: ErrorCode.INVALID_ARGUMENTS,
|
|
4641
|
+
message: 'Content type is unsupported',
|
|
4642
|
+
};
|
|
4643
|
+
throw err;
|
|
4641
4644
|
}
|
|
4642
|
-
return true;
|
|
4643
4645
|
}
|
|
4644
4646
|
function isSupported() {
|
|
4645
4647
|
return runtime.supports.sharing ? true : false;
|
|
@@ -4757,6 +4759,7 @@ var appInitialization;
|
|
|
4757
4759
|
|
|
4758
4760
|
|
|
4759
4761
|
|
|
4762
|
+
|
|
4760
4763
|
/**
|
|
4761
4764
|
* @deprecated
|
|
4762
4765
|
* As of 2.0.0-beta.1, please use {@link app.initialize app.initialize(validMessageOrigins?: string[]): Promise\<void\>} instead.
|
|
@@ -5011,16 +5014,13 @@ function shareDeepLink(deepLinkParameters) {
|
|
|
5011
5014
|
*/
|
|
5012
5015
|
function executeDeepLink(deepLink, onComplete) {
|
|
5013
5016
|
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
|
5017
|
+
onComplete = onComplete ? onComplete : getGenericOnCompleteHandler();
|
|
5014
5018
|
core.executeDeepLink(deepLink)
|
|
5015
5019
|
.then(function () {
|
|
5016
|
-
|
|
5017
|
-
onComplete(true);
|
|
5018
|
-
}
|
|
5020
|
+
onComplete(true);
|
|
5019
5021
|
})
|
|
5020
5022
|
.catch(function (err) {
|
|
5021
|
-
|
|
5022
|
-
onComplete(false, err.message);
|
|
5023
|
-
}
|
|
5023
|
+
onComplete(false, err.message);
|
|
5024
5024
|
});
|
|
5025
5025
|
}
|
|
5026
5026
|
/**
|
|
@@ -5127,6 +5127,7 @@ function transformAppContextToLegacyContext(appContext) {
|
|
|
5127
5127
|
|
|
5128
5128
|
|
|
5129
5129
|
|
|
5130
|
+
|
|
5130
5131
|
/**
|
|
5131
5132
|
* Navigation specific part of the SDK.
|
|
5132
5133
|
*/
|
|
@@ -5152,16 +5153,13 @@ function returnFocus(navigateForward) {
|
|
|
5152
5153
|
*/
|
|
5153
5154
|
function navigateToTab(tabInstance, onComplete) {
|
|
5154
5155
|
ensureInitialized();
|
|
5156
|
+
onComplete = onComplete ? onComplete : getGenericOnCompleteHandler();
|
|
5155
5157
|
pages.tabs.navigateToTab(tabInstance)
|
|
5156
5158
|
.then(function () {
|
|
5157
|
-
|
|
5158
|
-
onComplete(true);
|
|
5159
|
-
}
|
|
5159
|
+
onComplete(true);
|
|
5160
5160
|
})
|
|
5161
5161
|
.catch(function (error) {
|
|
5162
|
-
|
|
5163
|
-
onComplete(false, error.message);
|
|
5164
|
-
}
|
|
5162
|
+
onComplete(false, error.message);
|
|
5165
5163
|
});
|
|
5166
5164
|
}
|
|
5167
5165
|
/**
|
|
@@ -5179,16 +5177,13 @@ function navigateToTab(tabInstance, onComplete) {
|
|
|
5179
5177
|
*/
|
|
5180
5178
|
function navigateCrossDomain(url, onComplete) {
|
|
5181
5179
|
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.remove, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
|
5180
|
+
onComplete = onComplete ? onComplete : getGenericOnCompleteHandler();
|
|
5182
5181
|
pages.navigateCrossDomain(url)
|
|
5183
5182
|
.then(function () {
|
|
5184
|
-
|
|
5185
|
-
onComplete(true);
|
|
5186
|
-
}
|
|
5183
|
+
onComplete(true);
|
|
5187
5184
|
})
|
|
5188
5185
|
.catch(function (error) {
|
|
5189
|
-
|
|
5190
|
-
onComplete(false, error.message);
|
|
5191
|
-
}
|
|
5186
|
+
onComplete(false, error.message);
|
|
5192
5187
|
});
|
|
5193
5188
|
}
|
|
5194
5189
|
/**
|
|
@@ -5202,16 +5197,13 @@ function navigateCrossDomain(url, onComplete) {
|
|
|
5202
5197
|
*/
|
|
5203
5198
|
function navigateBack(onComplete) {
|
|
5204
5199
|
ensureInitialized();
|
|
5200
|
+
onComplete = onComplete ? onComplete : getGenericOnCompleteHandler();
|
|
5205
5201
|
pages.backStack.navigateBack()
|
|
5206
5202
|
.then(function () {
|
|
5207
|
-
|
|
5208
|
-
onComplete(true);
|
|
5209
|
-
}
|
|
5203
|
+
onComplete(true);
|
|
5210
5204
|
})
|
|
5211
5205
|
.catch(function (error) {
|
|
5212
|
-
|
|
5213
|
-
onComplete(false, error.message);
|
|
5214
|
-
}
|
|
5206
|
+
onComplete(false, error.message);
|
|
5215
5207
|
});
|
|
5216
5208
|
}
|
|
5217
5209
|
|
|
@@ -5219,6 +5211,7 @@ function navigateBack(onComplete) {
|
|
|
5219
5211
|
|
|
5220
5212
|
|
|
5221
5213
|
|
|
5214
|
+
|
|
5222
5215
|
/**
|
|
5223
5216
|
* @deprecated
|
|
5224
5217
|
* As of 2.0.0-beta.1, please use {@link pages.config} namespace instead.
|
|
@@ -5267,16 +5260,13 @@ var settings;
|
|
|
5267
5260
|
*/
|
|
5268
5261
|
function setSettings(instanceSettings, onComplete) {
|
|
5269
5262
|
ensureInitialized(FrameContexts.content, FrameContexts.settings, FrameContexts.sidePanel);
|
|
5263
|
+
onComplete = onComplete ? onComplete : getGenericOnCompleteHandler();
|
|
5270
5264
|
pages.config.setConfig(instanceSettings)
|
|
5271
5265
|
.then(function () {
|
|
5272
|
-
|
|
5273
|
-
onComplete(true);
|
|
5274
|
-
}
|
|
5266
|
+
onComplete(true);
|
|
5275
5267
|
})
|
|
5276
5268
|
.catch(function (error) {
|
|
5277
|
-
|
|
5278
|
-
onComplete(false, error.message);
|
|
5279
|
-
}
|
|
5269
|
+
onComplete(false, error.message);
|
|
5280
5270
|
});
|
|
5281
5271
|
}
|
|
5282
5272
|
settings.setSettings = setSettings;
|