@microsoft/teams-js 2.0.0-beta.3-dev.8 → 2.0.0-beta.3-dev.12
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
|
@@ -2717,7 +2717,7 @@ export namespace app {
|
|
|
2717
2717
|
*
|
|
2718
2718
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
|
2719
2719
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
|
2720
|
-
* @returns Promise that will be fulfilled when initialization has completed
|
|
2720
|
+
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
|
2721
2721
|
*/
|
|
2722
2722
|
function initialize(validMessageOrigins?: string[]): Promise<void>;
|
|
2723
2723
|
/**
|
|
@@ -2853,6 +2853,16 @@ export namespace pages {
|
|
|
2853
2853
|
* @returns Promise that resolves when the navigation has completed.
|
|
2854
2854
|
*/
|
|
2855
2855
|
function navigateCrossDomain(url: string): Promise<void>;
|
|
2856
|
+
/**
|
|
2857
|
+
* Navigate to the given App ID and Page ID, with optional parameters for a WebURL (if the app cannot
|
|
2858
|
+
* be navigated to, such as if it is not installed), Channel ID (for apps installed as a channel tab), and
|
|
2859
|
+
* Sub-page ID (for navigating to specific content within the page). This is equivalent to navigating to
|
|
2860
|
+
* a deep link with the above data, but does not require the app to build a URL or worry about different
|
|
2861
|
+
* deep link formats for different hosts.
|
|
2862
|
+
* @param params Parameters for the navigation
|
|
2863
|
+
* @returns a promise that will resolve if the navigation was successful
|
|
2864
|
+
*/
|
|
2865
|
+
function navigateToApp(params: NavigateToAppParams): Promise<void>;
|
|
2856
2866
|
/**
|
|
2857
2867
|
* Registers a handler for changes from or to full-screen view for a tab.
|
|
2858
2868
|
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
|
|
@@ -2863,6 +2873,32 @@ export namespace pages {
|
|
|
2863
2873
|
* Checks if page capability is supported currently
|
|
2864
2874
|
*/
|
|
2865
2875
|
function isSupported(): boolean;
|
|
2876
|
+
/**
|
|
2877
|
+
* Parameters for the NavigateToApp API
|
|
2878
|
+
*/
|
|
2879
|
+
interface NavigateToAppParams {
|
|
2880
|
+
/**
|
|
2881
|
+
* ID of the App to navigate to
|
|
2882
|
+
*/
|
|
2883
|
+
appId: string;
|
|
2884
|
+
/**
|
|
2885
|
+
* Developer-defined ID of the Page to navigate to within the app (Formerly EntityID)
|
|
2886
|
+
*/
|
|
2887
|
+
pageId: string;
|
|
2888
|
+
/**
|
|
2889
|
+
* Optional URL to open if the navigation cannot be completed within the host
|
|
2890
|
+
*/
|
|
2891
|
+
webUrl?: string;
|
|
2892
|
+
/**
|
|
2893
|
+
* Optional developer-defined ID describing the content to navigate to within the Page. This will be passed
|
|
2894
|
+
* back to the App via the Context object.
|
|
2895
|
+
*/
|
|
2896
|
+
subPageId?: string;
|
|
2897
|
+
/**
|
|
2898
|
+
* Optional ID of the Teams Channel where the app should be opened
|
|
2899
|
+
*/
|
|
2900
|
+
channelId?: string;
|
|
2901
|
+
}
|
|
2866
2902
|
/**
|
|
2867
2903
|
* Namespace to interact with the teams specific part of the SDK.
|
|
2868
2904
|
*/
|
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.12';
|
|
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.
|
|
@@ -780,6 +780,44 @@ function callCallbackWithErrorOrResultOrNullFromPromiseAndReturnPromise(funcHelp
|
|
|
780
780
|
});
|
|
781
781
|
return p;
|
|
782
782
|
}
|
|
783
|
+
/**
|
|
784
|
+
* A helper function to add a timeout to an asynchronous operation.
|
|
785
|
+
*
|
|
786
|
+
* @param action Action to wrap the timeout around
|
|
787
|
+
* @param timeoutInMs Timeout period in milliseconds
|
|
788
|
+
* @param timeoutError Error to reject the promise with if timeout elapses before the action completed
|
|
789
|
+
* @returns A promise which resolves to the result of provided action or rejects with a provided timeout error
|
|
790
|
+
* if the initial action didn't complete within provided timeout.
|
|
791
|
+
*
|
|
792
|
+
* @internal
|
|
793
|
+
*/
|
|
794
|
+
function runWithTimeout(action, timeoutInMs, timeoutError) {
|
|
795
|
+
return new Promise(function (resolve, reject) {
|
|
796
|
+
var timeoutHandle = setTimeout(reject, timeoutInMs, timeoutError);
|
|
797
|
+
action()
|
|
798
|
+
.then(function (result) {
|
|
799
|
+
clearTimeout(timeoutHandle);
|
|
800
|
+
resolve(result);
|
|
801
|
+
})
|
|
802
|
+
.catch(function (error) {
|
|
803
|
+
clearTimeout(timeoutHandle);
|
|
804
|
+
reject(error);
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
function createTeamsAppLink(params) {
|
|
809
|
+
var url = new URL('https://teams.microsoft.com/l/entity/' +
|
|
810
|
+
encodeURIComponent(params.appId) +
|
|
811
|
+
'/' +
|
|
812
|
+
encodeURIComponent(params.pageId));
|
|
813
|
+
if (params.webUrl) {
|
|
814
|
+
url.searchParams.append('webUrl', params.webUrl);
|
|
815
|
+
}
|
|
816
|
+
if (params.channelId || params.subPageId) {
|
|
817
|
+
url.searchParams.append('context', JSON.stringify({ channelId: params.channelId, subEntityId: params.subPageId }));
|
|
818
|
+
}
|
|
819
|
+
return url.toString();
|
|
820
|
+
}
|
|
783
821
|
|
|
784
822
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
|
785
823
|
|
|
@@ -887,6 +925,7 @@ var runtime = {
|
|
|
887
925
|
};
|
|
888
926
|
var teamsRuntimeConfig = {
|
|
889
927
|
apiVersion: 1,
|
|
928
|
+
isLegacyTeams: true,
|
|
890
929
|
supports: {
|
|
891
930
|
appInstallDialog: {},
|
|
892
931
|
appEntity: {},
|
|
@@ -1794,6 +1833,10 @@ var app_app;
|
|
|
1794
1833
|
return GlobalVars.frameContext;
|
|
1795
1834
|
}
|
|
1796
1835
|
app.getFrameContext = getFrameContext;
|
|
1836
|
+
/**
|
|
1837
|
+
* Number of milliseconds we'll give the initialization call to return before timing it out
|
|
1838
|
+
*/
|
|
1839
|
+
var initializationTimeoutInMs = 5000;
|
|
1797
1840
|
/**
|
|
1798
1841
|
* Initializes the library.
|
|
1799
1842
|
*
|
|
@@ -1803,9 +1846,13 @@ var app_app;
|
|
|
1803
1846
|
*
|
|
1804
1847
|
* @param validMessageOrigins - Optionally specify a list of cross frame message origins. They must have
|
|
1805
1848
|
* https: protocol otherwise they will be ignored. Example: https:www.example.com
|
|
1806
|
-
* @returns Promise that will be fulfilled when initialization has completed
|
|
1849
|
+
* @returns Promise that will be fulfilled when initialization has completed, or rejected if the initialization fails or times out
|
|
1807
1850
|
*/
|
|
1808
1851
|
function initialize(validMessageOrigins) {
|
|
1852
|
+
return runWithTimeout(function () { return initializeHelper(validMessageOrigins); }, initializationTimeoutInMs, new Error('SDK initialization timed out.'));
|
|
1853
|
+
}
|
|
1854
|
+
app.initialize = initialize;
|
|
1855
|
+
function initializeHelper(validMessageOrigins) {
|
|
1809
1856
|
return new Promise(function (resolve) {
|
|
1810
1857
|
// Independent components might not know whether the SDK is initialized so might call it to be safe.
|
|
1811
1858
|
// Just no-op if that happens to make it easier to use.
|
|
@@ -1870,7 +1917,6 @@ var app_app;
|
|
|
1870
1917
|
resolve(GlobalVars.initializePromise);
|
|
1871
1918
|
});
|
|
1872
1919
|
}
|
|
1873
|
-
app.initialize = initialize;
|
|
1874
1920
|
/**
|
|
1875
1921
|
* @hidden
|
|
1876
1922
|
* Hide from docs.
|
|
@@ -2110,6 +2156,7 @@ function transformLegacyContextToAppContext(legacyContext) {
|
|
|
2110
2156
|
|
|
2111
2157
|
|
|
2112
2158
|
|
|
2159
|
+
|
|
2113
2160
|
/**
|
|
2114
2161
|
* Navigation specific part of the SDK.
|
|
2115
2162
|
*
|
|
@@ -2154,6 +2201,27 @@ var pages;
|
|
|
2154
2201
|
});
|
|
2155
2202
|
}
|
|
2156
2203
|
pages.navigateCrossDomain = navigateCrossDomain;
|
|
2204
|
+
/**
|
|
2205
|
+
* Navigate to the given App ID and Page ID, with optional parameters for a WebURL (if the app cannot
|
|
2206
|
+
* be navigated to, such as if it is not installed), Channel ID (for apps installed as a channel tab), and
|
|
2207
|
+
* Sub-page ID (for navigating to specific content within the page). This is equivalent to navigating to
|
|
2208
|
+
* a deep link with the above data, but does not require the app to build a URL or worry about different
|
|
2209
|
+
* deep link formats for different hosts.
|
|
2210
|
+
* @param params Parameters for the navigation
|
|
2211
|
+
* @returns a promise that will resolve if the navigation was successful
|
|
2212
|
+
*/
|
|
2213
|
+
function navigateToApp(params) {
|
|
2214
|
+
return new Promise(function (resolve) {
|
|
2215
|
+
ensureInitialized(FrameContexts.content, FrameContexts.sidePanel, FrameContexts.settings, FrameContexts.task, FrameContexts.stage, FrameContexts.meetingStage);
|
|
2216
|
+
if (runtime.isLegacyTeams) {
|
|
2217
|
+
resolve(sendAndHandleStatusAndReason('executeDeepLink', createTeamsAppLink(params)));
|
|
2218
|
+
}
|
|
2219
|
+
else {
|
|
2220
|
+
resolve(sendAndHandleStatusAndReason('pages.navigateToApp', params));
|
|
2221
|
+
}
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
pages.navigateToApp = navigateToApp;
|
|
2157
2225
|
/**
|
|
2158
2226
|
* Registers a handler for changes from or to full-screen view for a tab.
|
|
2159
2227
|
* Only one handler can be registered at a time. A subsequent registration replaces an existing registration.
|