@microsoft/teams-js 2.16.0-beta.0 → 2.16.0-beta.1
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/MicrosoftTeams.d.ts
CHANGED
@@ -3630,9 +3630,9 @@ export interface DialogInfo {
|
|
3630
3630
|
export type TaskInfo = DialogInfo;
|
3631
3631
|
/**
|
3632
3632
|
* @beta
|
3633
|
-
* Data structure to be used with the {@link
|
3633
|
+
* Data structure to be used with the {@link app.lifecycle.registerOnResumeHandler app.lifecycle.registerOnResumeHandler(handler: (context: ResumeContext) => void): void} to pass the context to the app.
|
3634
3634
|
*/
|
3635
|
-
export interface
|
3635
|
+
export interface ResumeContext {
|
3636
3636
|
/**
|
3637
3637
|
* The entity that is requested to be loaded
|
3638
3638
|
*/
|
@@ -3642,6 +3642,11 @@ export interface LoadContext {
|
|
3642
3642
|
*/
|
3643
3643
|
contentUrl: string;
|
3644
3644
|
}
|
3645
|
+
/**
|
3646
|
+
* @deprecated
|
3647
|
+
* As of 2.14.1, please use ResumeContext instead.
|
3648
|
+
*/
|
3649
|
+
export type LoadContext = ResumeContext;
|
3645
3650
|
/** Represents information about a frame within a tab or dialog module. */
|
3646
3651
|
export interface FrameInfo {
|
3647
3652
|
/**
|
@@ -4285,6 +4290,56 @@ export namespace app {
|
|
4285
4290
|
* @returns Promise that will be fulfilled when the operation has completed
|
4286
4291
|
*/
|
4287
4292
|
export function openLink(deepLink: string): Promise<void>;
|
4293
|
+
/**
|
4294
|
+
* A namespace for enabling the suspension or delayed termination of an app when the user navigates away.
|
4295
|
+
* When an app registers for the registerBeforeSuspendOrTerminateHandler, it chooses to delay termination.
|
4296
|
+
* When an app registers for both registerBeforeSuspendOrTerminateHandler and registerOnResumeHandler, it chooses the suspension of the app .
|
4297
|
+
* Please note that selecting suspension doesn't guarantee prevention of background termination.
|
4298
|
+
* The outcome is influenced by factors such as available memory and the number of suspended apps.
|
4299
|
+
*
|
4300
|
+
* @beta
|
4301
|
+
*/
|
4302
|
+
export namespace lifecycle {
|
4303
|
+
/**
|
4304
|
+
* Register on resume handler function type
|
4305
|
+
*
|
4306
|
+
* @param context - Data structure to be used to pass the context to the app.
|
4307
|
+
*/
|
4308
|
+
type registerOnResumeHandlerFunctionType = (context: ResumeContext) => void;
|
4309
|
+
/**
|
4310
|
+
* Register before suspendOrTerminate handler function type
|
4311
|
+
*
|
4312
|
+
* @returns void
|
4313
|
+
*/
|
4314
|
+
type registerBeforeSuspendOrTerminateHandlerFunctionType = () => void;
|
4315
|
+
/**
|
4316
|
+
* Registers a handler to be called before the page is suspended or terminated. Once a user navigates away from an app,
|
4317
|
+
* the handler will be invoked. App developers can use this handler to save unsaved data, pause sync calls etc.
|
4318
|
+
*
|
4319
|
+
* @param handler - The handler to invoke before the page is suspended or terminated. When invoked, app can perform tasks like cleanups, logging etc.
|
4320
|
+
* Upon returning, the app will be suspended or terminated.
|
4321
|
+
*
|
4322
|
+
*/
|
4323
|
+
export function registerBeforeSuspendOrTerminateHandler(handler: registerBeforeSuspendOrTerminateHandlerFunctionType): void;
|
4324
|
+
/**
|
4325
|
+
* Registers a handler to be called when the page has been requested to resume from being suspended.
|
4326
|
+
*
|
4327
|
+
* @param handler - The handler to invoke when the page is requested to be resumed. The app is supposed to navigate to
|
4328
|
+
* the appropriate page using the ResumeContext. Once done, the app should then call {@link notifySuccess}.
|
4329
|
+
*
|
4330
|
+
* @beta
|
4331
|
+
*/
|
4332
|
+
export function registerOnResumeHandler(handler: registerOnResumeHandlerFunctionType): void;
|
4333
|
+
/**
|
4334
|
+
* Checks if app.lifecycle is supported by the host.
|
4335
|
+
* @returns boolean to represent whether the lifecycle capability is supported
|
4336
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
4337
|
+
*
|
4338
|
+
* @beta
|
4339
|
+
*/
|
4340
|
+
export function isSupported(): boolean;
|
4341
|
+
export {};
|
4342
|
+
}
|
4288
4343
|
export {};
|
4289
4344
|
}
|
4290
4345
|
|
@@ -6877,6 +6932,9 @@ export namespace teamsCore {
|
|
6877
6932
|
*
|
6878
6933
|
* @param handler - The handler to invoke when the page is loaded.
|
6879
6934
|
*
|
6935
|
+
* @deprecated
|
6936
|
+
* As of 2.14.1, please use {@link app.lifecycle.registerOnResumeHandler} instead.
|
6937
|
+
*
|
6880
6938
|
* @beta
|
6881
6939
|
*/
|
6882
6940
|
export function registerOnLoadHandler(handler: registerOnLoadHandlerFunctionType): void;
|
@@ -6889,6 +6947,8 @@ export namespace teamsCore {
|
|
6889
6947
|
*
|
6890
6948
|
* @param handler - The handler to invoke when the page is loaded.
|
6891
6949
|
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
6950
|
+
*
|
6951
|
+
* @deprecated
|
6892
6952
|
*/
|
6893
6953
|
export function registerOnLoadHandlerHelper(handler: registerOnLoadHandlerFunctionType, versionSpecificHelper?: () => void): void;
|
6894
6954
|
/**
|
@@ -6900,6 +6960,7 @@ export namespace teamsCore {
|
|
6900
6960
|
* @param handler - The handler to invoke before the page is unloaded. If this handler returns true the page should
|
6901
6961
|
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
|
6902
6962
|
*
|
6963
|
+
* @deprecated
|
6903
6964
|
* @beta
|
6904
6965
|
*/
|
6905
6966
|
export function registerBeforeUnloadHandler(handler: registerBeforeUnloadHandlerFunctionType): void;
|
@@ -6913,6 +6974,8 @@ export namespace teamsCore {
|
|
6913
6974
|
* @param handler - - The handler to invoke before the page is unloaded. If this handler returns true the page should
|
6914
6975
|
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
|
6915
6976
|
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
6977
|
+
*
|
6978
|
+
* @deprecated
|
6916
6979
|
*/
|
6917
6980
|
export function registerBeforeUnloadHandlerHelper(handler: registerBeforeUnloadHandlerFunctionType, versionSpecificHelper?: () => void): void;
|
6918
6981
|
/**
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -1976,6 +1976,11 @@ var teamsRuntimeConfig = {
|
|
1976
1976
|
hostVersionsInfo: teamsMinAdaptiveCardVersion,
|
1977
1977
|
isLegacyTeams: true,
|
1978
1978
|
supports: {
|
1979
|
+
app: {
|
1980
|
+
lifecycle: {
|
1981
|
+
caching: {},
|
1982
|
+
},
|
1983
|
+
},
|
1979
1984
|
appInstallDialog: {},
|
1980
1985
|
appEntity: {},
|
1981
1986
|
call: {},
|
@@ -2207,7 +2212,7 @@ var _minRuntimeConfigToUninitialize = {
|
|
2207
2212
|
* @hidden
|
2208
2213
|
* Package version.
|
2209
2214
|
*/
|
2210
|
-
var version = "2.16.0-beta.
|
2215
|
+
var version = "2.16.0-beta.1";
|
2211
2216
|
|
2212
2217
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
2213
2218
|
|
@@ -3674,6 +3679,66 @@ var app;
|
|
3674
3679
|
});
|
3675
3680
|
}
|
3676
3681
|
app.openLink = openLink;
|
3682
|
+
/**
|
3683
|
+
* A namespace for enabling the suspension or delayed termination of an app when the user navigates away.
|
3684
|
+
* When an app registers for the registerBeforeSuspendOrTerminateHandler, it chooses to delay termination.
|
3685
|
+
* When an app registers for both registerBeforeSuspendOrTerminateHandler and registerOnResumeHandler, it chooses the suspension of the app .
|
3686
|
+
* Please note that selecting suspension doesn't guarantee prevention of background termination.
|
3687
|
+
* The outcome is influenced by factors such as available memory and the number of suspended apps.
|
3688
|
+
*
|
3689
|
+
* @beta
|
3690
|
+
*/
|
3691
|
+
var lifecycle;
|
3692
|
+
(function (lifecycle) {
|
3693
|
+
/**
|
3694
|
+
* Registers a handler to be called before the page is suspended or terminated. Once a user navigates away from an app,
|
3695
|
+
* the handler will be invoked. App developers can use this handler to save unsaved data, pause sync calls etc.
|
3696
|
+
*
|
3697
|
+
* @param handler - The handler to invoke before the page is suspended or terminated. When invoked, app can perform tasks like cleanups, logging etc.
|
3698
|
+
* Upon returning, the app will be suspended or terminated.
|
3699
|
+
*
|
3700
|
+
*/
|
3701
|
+
function registerBeforeSuspendOrTerminateHandler(handler) {
|
3702
|
+
if (!handler) {
|
3703
|
+
throw new Error('[app.lifecycle.registerBeforeSuspendOrTerminateHandler] Handler cannot be null');
|
3704
|
+
}
|
3705
|
+
if (!isSupported()) {
|
3706
|
+
throw errorNotSupportedOnPlatform;
|
3707
|
+
}
|
3708
|
+
handlers_registerBeforeSuspendOrTerminateHandler(handler);
|
3709
|
+
}
|
3710
|
+
lifecycle.registerBeforeSuspendOrTerminateHandler = registerBeforeSuspendOrTerminateHandler;
|
3711
|
+
/**
|
3712
|
+
* Registers a handler to be called when the page has been requested to resume from being suspended.
|
3713
|
+
*
|
3714
|
+
* @param handler - The handler to invoke when the page is requested to be resumed. The app is supposed to navigate to
|
3715
|
+
* the appropriate page using the ResumeContext. Once done, the app should then call {@link notifySuccess}.
|
3716
|
+
*
|
3717
|
+
* @beta
|
3718
|
+
*/
|
3719
|
+
function registerOnResumeHandler(handler) {
|
3720
|
+
if (!handler) {
|
3721
|
+
throw new Error('[app.lifecycle.registerOnResumeHandler] Handler cannot be null');
|
3722
|
+
}
|
3723
|
+
if (!isSupported()) {
|
3724
|
+
throw errorNotSupportedOnPlatform;
|
3725
|
+
}
|
3726
|
+
handlers_registerOnResumeHandler(handler);
|
3727
|
+
}
|
3728
|
+
lifecycle.registerOnResumeHandler = registerOnResumeHandler;
|
3729
|
+
/**
|
3730
|
+
* Checks if app.lifecycle is supported by the host.
|
3731
|
+
* @returns boolean to represent whether the lifecycle capability is supported
|
3732
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
3733
|
+
*
|
3734
|
+
* @beta
|
3735
|
+
*/
|
3736
|
+
function isSupported() {
|
3737
|
+
var _a;
|
3738
|
+
return ensureInitialized(runtime) && !!((_a = runtime.supports.app) === null || _a === void 0 ? void 0 : _a.lifecycle);
|
3739
|
+
}
|
3740
|
+
lifecycle.isSupported = isSupported;
|
3741
|
+
})(lifecycle = app.lifecycle || (app.lifecycle = {}));
|
3677
3742
|
})(app || (app = {}));
|
3678
3743
|
/**
|
3679
3744
|
* @hidden
|
@@ -4545,6 +4610,8 @@ var HandlersPrivate = /** @class */ (function () {
|
|
4545
4610
|
HandlersPrivate.handlers['themeChange'] = handleThemeChange;
|
4546
4611
|
HandlersPrivate.handlers['load'] = handleLoad;
|
4547
4612
|
HandlersPrivate.handlers['beforeUnload'] = handleBeforeUnload;
|
4613
|
+
HandlersPrivate.handlers['beforeSuspendOrTerminate'] = handleBeforeSuspendOrTerminate;
|
4614
|
+
HandlersPrivate.handlers['resume'] = handleResume;
|
4548
4615
|
pages.backStack._initialize();
|
4549
4616
|
};
|
4550
4617
|
/**
|
@@ -4557,6 +4624,8 @@ var HandlersPrivate = /** @class */ (function () {
|
|
4557
4624
|
HandlersPrivate.themeChangeHandler = null;
|
4558
4625
|
HandlersPrivate.loadHandler = null;
|
4559
4626
|
HandlersPrivate.beforeUnloadHandler = null;
|
4627
|
+
HandlersPrivate.beforeSuspendOrTerminateHandler = null;
|
4628
|
+
HandlersPrivate.resumeHandler = null;
|
4560
4629
|
};
|
4561
4630
|
HandlersPrivate.handlers = {};
|
4562
4631
|
return HandlersPrivate;
|
@@ -4668,6 +4737,8 @@ function handleThemeChange(theme) {
|
|
4668
4737
|
/**
|
4669
4738
|
* @internal
|
4670
4739
|
* Limited to Microsoft-internal use
|
4740
|
+
*
|
4741
|
+
* @deprecated
|
4671
4742
|
*/
|
4672
4743
|
function handlers_registerOnLoadHandler(handler) {
|
4673
4744
|
HandlersPrivate.loadHandler = handler;
|
@@ -4676,6 +4747,8 @@ function handlers_registerOnLoadHandler(handler) {
|
|
4676
4747
|
/**
|
4677
4748
|
* @internal
|
4678
4749
|
* Limited to Microsoft-internal use
|
4750
|
+
*
|
4751
|
+
* @deprecated
|
4679
4752
|
*/
|
4680
4753
|
function handleLoad(context) {
|
4681
4754
|
if (HandlersPrivate.loadHandler) {
|
@@ -4688,6 +4761,8 @@ function handleLoad(context) {
|
|
4688
4761
|
/**
|
4689
4762
|
* @internal
|
4690
4763
|
* Limited to Microsoft-internal use
|
4764
|
+
*
|
4765
|
+
* @deprecated
|
4691
4766
|
*/
|
4692
4767
|
function handlers_registerBeforeUnloadHandler(handler) {
|
4693
4768
|
HandlersPrivate.beforeUnloadHandler = handler;
|
@@ -4696,6 +4771,8 @@ function handlers_registerBeforeUnloadHandler(handler) {
|
|
4696
4771
|
/**
|
4697
4772
|
* @internal
|
4698
4773
|
* Limited to Microsoft-internal use
|
4774
|
+
*
|
4775
|
+
* @deprecated
|
4699
4776
|
*/
|
4700
4777
|
function handleBeforeUnload() {
|
4701
4778
|
var readyToUnload = function () {
|
@@ -4710,6 +4787,52 @@ function handleBeforeUnload() {
|
|
4710
4787
|
}
|
4711
4788
|
}
|
4712
4789
|
}
|
4790
|
+
/**
|
4791
|
+
* @internal
|
4792
|
+
* Limited to Microsoft-internal use
|
4793
|
+
*/
|
4794
|
+
function handlers_registerBeforeSuspendOrTerminateHandler(handler) {
|
4795
|
+
HandlersPrivate.beforeSuspendOrTerminateHandler = handler;
|
4796
|
+
handler && sendMessageToParent('registerHandler', ['beforeSuspendOrTerminate']);
|
4797
|
+
}
|
4798
|
+
/**
|
4799
|
+
* @internal
|
4800
|
+
* Limited to Microsoft-internal use
|
4801
|
+
*/
|
4802
|
+
function handleBeforeSuspendOrTerminate() {
|
4803
|
+
var readyToSuspendOrTerminate = function () {
|
4804
|
+
sendMessageToParent('readyToSuspendOrTerminate', []);
|
4805
|
+
};
|
4806
|
+
if (HandlersPrivate.beforeSuspendOrTerminateHandler) {
|
4807
|
+
HandlersPrivate.beforeSuspendOrTerminateHandler();
|
4808
|
+
}
|
4809
|
+
if (Communication.childWindow) {
|
4810
|
+
sendMessageEventToChild('beforeSuspendOrTerminate');
|
4811
|
+
}
|
4812
|
+
else {
|
4813
|
+
readyToSuspendOrTerminate();
|
4814
|
+
}
|
4815
|
+
}
|
4816
|
+
/**
|
4817
|
+
* @internal
|
4818
|
+
* Limited to Microsoft-internal use
|
4819
|
+
*/
|
4820
|
+
function handlers_registerOnResumeHandler(handler) {
|
4821
|
+
HandlersPrivate.loadHandler = handler;
|
4822
|
+
handler && sendMessageToParent('registerHandler', ['resume']);
|
4823
|
+
}
|
4824
|
+
/**
|
4825
|
+
* @internal
|
4826
|
+
* Limited to Microsoft-internal use
|
4827
|
+
*/
|
4828
|
+
function handleResume(context) {
|
4829
|
+
if (HandlersPrivate.loadHandler) {
|
4830
|
+
HandlersPrivate.loadHandler(context);
|
4831
|
+
}
|
4832
|
+
if (Communication.childWindow) {
|
4833
|
+
sendMessageEventToChild('resume', [context]);
|
4834
|
+
}
|
4835
|
+
}
|
4713
4836
|
|
4714
4837
|
;// CONCATENATED MODULE: ./src/internal/communication.ts
|
4715
4838
|
/* eslint-disable @typescript-eslint/ban-types */
|
@@ -7881,6 +8004,9 @@ var teamsCore;
|
|
7881
8004
|
*
|
7882
8005
|
* @param handler - The handler to invoke when the page is loaded.
|
7883
8006
|
*
|
8007
|
+
* @deprecated
|
8008
|
+
* As of 2.14.1, please use {@link app.lifecycle.registerOnResumeHandler} instead.
|
8009
|
+
*
|
7884
8010
|
* @beta
|
7885
8011
|
*/
|
7886
8012
|
function registerOnLoadHandler(handler) {
|
@@ -7900,6 +8026,8 @@ var teamsCore;
|
|
7900
8026
|
*
|
7901
8027
|
* @param handler - The handler to invoke when the page is loaded.
|
7902
8028
|
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
8029
|
+
*
|
8030
|
+
* @deprecated
|
7903
8031
|
*/
|
7904
8032
|
function registerOnLoadHandlerHelper(handler, versionSpecificHelper) {
|
7905
8033
|
// allow for registration cleanup even when not finished initializing
|
@@ -7919,6 +8047,7 @@ var teamsCore;
|
|
7919
8047
|
* @param handler - The handler to invoke before the page is unloaded. If this handler returns true the page should
|
7920
8048
|
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
|
7921
8049
|
*
|
8050
|
+
* @deprecated
|
7922
8051
|
* @beta
|
7923
8052
|
*/
|
7924
8053
|
function registerBeforeUnloadHandler(handler) {
|
@@ -7939,6 +8068,8 @@ var teamsCore;
|
|
7939
8068
|
* @param handler - - The handler to invoke before the page is unloaded. If this handler returns true the page should
|
7940
8069
|
* invoke the readyToUnload function provided to it once it's ready to be unloaded.
|
7941
8070
|
* @param versionSpecificHelper - The helper function containing logic pertaining to a specific version of the API.
|
8071
|
+
*
|
8072
|
+
* @deprecated
|
7942
8073
|
*/
|
7943
8074
|
function registerBeforeUnloadHandlerHelper(handler, versionSpecificHelper) {
|
7944
8075
|
// allow for registration cleanup even when not finished initializing
|