@microsoft/teamsfx-react 3.0.0-alpha.46da7cd00.0 → 3.0.1-alpha.ru6q1vrv0.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/LICENSE +21 -21
- package/README.md +6 -0
- package/build/cjs/BaseDashboard.d.ts +54 -0
- package/build/cjs/BaseDashboard.d.ts.map +1 -0
- package/build/cjs/BaseDashboard.js +102 -0
- package/build/cjs/BaseWidget.d.ts +63 -0
- package/build/cjs/BaseWidget.d.ts.map +1 -0
- package/build/cjs/BaseWidget.js +149 -0
- package/build/cjs/index.d.ts +7 -5
- package/build/cjs/index.d.ts.map +1 -1
- package/build/cjs/index.js +20 -16
- package/build/cjs/useData.d.ts +33 -33
- package/build/cjs/useData.js +47 -47
- package/build/cjs/useGraph.d.ts +32 -32
- package/build/cjs/useGraph.js +151 -151
- package/build/cjs/useTeams.d.ts +30 -30
- package/build/cjs/useTeams.js +82 -82
- package/build/cjs/useTeamsFx.d.ts +41 -41
- package/build/cjs/useTeamsFx.js +34 -34
- package/build/cjs/useTeamsUserCredential.d.ts +41 -41
- package/build/cjs/useTeamsUserCredential.js +34 -34
- package/build/esm/BaseDashboard.d.ts +54 -0
- package/build/esm/BaseDashboard.d.ts.map +1 -0
- package/build/esm/BaseDashboard.js +99 -0
- package/build/esm/BaseWidget.d.ts +63 -0
- package/build/esm/BaseWidget.d.ts.map +1 -0
- package/build/esm/BaseWidget.js +146 -0
- package/build/esm/index.d.ts +7 -5
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +9 -7
- package/build/esm/useData.d.ts +33 -33
- package/build/esm/useData.js +43 -43
- package/build/esm/useGraph.d.ts +32 -32
- package/build/esm/useGraph.js +146 -146
- package/build/esm/useTeams.d.ts +30 -30
- package/build/esm/useTeams.js +78 -78
- package/build/esm/useTeamsFx.d.ts +41 -41
- package/build/esm/useTeamsFx.js +30 -30
- package/build/esm/useTeamsUserCredential.d.ts +41 -41
- package/build/esm/useTeamsUserCredential.js +30 -30
- package/package.json +6 -5
package/build/esm/useTeams.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { unstable_batchedUpdates as batchedUpdates } from "react-dom";
|
|
5
|
-
import { app, pages } from "@microsoft/teams-js";
|
|
6
|
-
import { teamsLightTheme, teamsDarkTheme, teamsHighContrastTheme, } from "@fluentui/react-components";
|
|
7
|
-
var getTheme = function () {
|
|
8
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
9
|
-
var theme = urlParams.get("theme");
|
|
10
|
-
return theme == null ? undefined : theme;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Microsoft Teams React hook
|
|
14
|
-
* @param options optional options
|
|
15
|
-
* @returns A tuple with properties and methods
|
|
16
|
-
* properties:
|
|
17
|
-
* - inTeams: boolean = true if inside Microsoft Teams
|
|
18
|
-
* - fullscreen: boolean = true if in full screen mode
|
|
19
|
-
* - theme: Fluent UI Theme
|
|
20
|
-
* - themeString: string - representation of the theme (default, dark or contrast)
|
|
21
|
-
* - context - the Microsoft Teams JS SDK context
|
|
22
|
-
* methods:
|
|
23
|
-
* - setTheme - manually set the theme
|
|
24
|
-
*/
|
|
25
|
-
export function useTeams(options) {
|
|
26
|
-
var _a = useState(undefined), inTeams = _a[0], setInTeams = _a[1];
|
|
27
|
-
var _b = useState(undefined), fullScreen = _b[0], setFullScreen = _b[1];
|
|
28
|
-
var _c = useState(teamsLightTheme), theme = _c[0], setTheme = _c[1];
|
|
29
|
-
var _d = useState("default"), themeString = _d[0], setThemeString = _d[1];
|
|
30
|
-
var initialTheme = useState(options && options.initialTheme ? options.initialTheme : getTheme())[0];
|
|
31
|
-
var _e = useState(undefined), context = _e[0], setContext = _e[1];
|
|
32
|
-
var themeChangeHandler = function (theme) {
|
|
33
|
-
setThemeString(theme || "default");
|
|
34
|
-
switch (theme) {
|
|
35
|
-
case "dark":
|
|
36
|
-
setTheme(teamsDarkTheme);
|
|
37
|
-
break;
|
|
38
|
-
case "contrast":
|
|
39
|
-
setTheme(teamsHighContrastTheme);
|
|
40
|
-
break;
|
|
41
|
-
case "default":
|
|
42
|
-
default:
|
|
43
|
-
setTheme(teamsLightTheme);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
var overrideThemeHandler = (options === null || options === void 0 ? void 0 : options.setThemeHandler)
|
|
47
|
-
? options.setThemeHandler
|
|
48
|
-
: themeChangeHandler;
|
|
49
|
-
useEffect(function () {
|
|
50
|
-
// set initial theme based on options or query string
|
|
51
|
-
overrideThemeHandler(initialTheme);
|
|
52
|
-
app
|
|
53
|
-
.initialize()
|
|
54
|
-
.then(function () {
|
|
55
|
-
app
|
|
56
|
-
.getContext()
|
|
57
|
-
.then(function (context) {
|
|
58
|
-
batchedUpdates(function () {
|
|
59
|
-
setInTeams(true);
|
|
60
|
-
setContext(context);
|
|
61
|
-
setFullScreen(context.page.isFullScreen);
|
|
62
|
-
});
|
|
63
|
-
overrideThemeHandler(context.app.theme);
|
|
64
|
-
app.registerOnThemeChangeHandler(overrideThemeHandler);
|
|
65
|
-
pages.registerFullScreenHandler(function (isFullScreen) {
|
|
66
|
-
setFullScreen(isFullScreen);
|
|
67
|
-
});
|
|
68
|
-
})
|
|
69
|
-
.catch(function () {
|
|
70
|
-
setInTeams(false);
|
|
71
|
-
});
|
|
72
|
-
})
|
|
73
|
-
.catch(function () {
|
|
74
|
-
setInTeams(false);
|
|
75
|
-
});
|
|
76
|
-
}, []);
|
|
77
|
-
return [{ inTeams: inTeams, fullScreen: fullScreen, theme: theme, context: context, themeString: themeString }, { setTheme: overrideThemeHandler }];
|
|
78
|
-
}
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { unstable_batchedUpdates as batchedUpdates } from "react-dom";
|
|
5
|
+
import { app, pages } from "@microsoft/teams-js";
|
|
6
|
+
import { teamsLightTheme, teamsDarkTheme, teamsHighContrastTheme, } from "@fluentui/react-components";
|
|
7
|
+
var getTheme = function () {
|
|
8
|
+
var urlParams = new URLSearchParams(window.location.search);
|
|
9
|
+
var theme = urlParams.get("theme");
|
|
10
|
+
return theme == null ? undefined : theme;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Microsoft Teams React hook
|
|
14
|
+
* @param options optional options
|
|
15
|
+
* @returns A tuple with properties and methods
|
|
16
|
+
* properties:
|
|
17
|
+
* - inTeams: boolean = true if inside Microsoft Teams
|
|
18
|
+
* - fullscreen: boolean = true if in full screen mode
|
|
19
|
+
* - theme: Fluent UI Theme
|
|
20
|
+
* - themeString: string - representation of the theme (default, dark or contrast)
|
|
21
|
+
* - context - the Microsoft Teams JS SDK context
|
|
22
|
+
* methods:
|
|
23
|
+
* - setTheme - manually set the theme
|
|
24
|
+
*/
|
|
25
|
+
export function useTeams(options) {
|
|
26
|
+
var _a = useState(undefined), inTeams = _a[0], setInTeams = _a[1];
|
|
27
|
+
var _b = useState(undefined), fullScreen = _b[0], setFullScreen = _b[1];
|
|
28
|
+
var _c = useState(teamsLightTheme), theme = _c[0], setTheme = _c[1];
|
|
29
|
+
var _d = useState("default"), themeString = _d[0], setThemeString = _d[1];
|
|
30
|
+
var initialTheme = useState(options && options.initialTheme ? options.initialTheme : getTheme())[0];
|
|
31
|
+
var _e = useState(undefined), context = _e[0], setContext = _e[1];
|
|
32
|
+
var themeChangeHandler = function (theme) {
|
|
33
|
+
setThemeString(theme || "default");
|
|
34
|
+
switch (theme) {
|
|
35
|
+
case "dark":
|
|
36
|
+
setTheme(teamsDarkTheme);
|
|
37
|
+
break;
|
|
38
|
+
case "contrast":
|
|
39
|
+
setTheme(teamsHighContrastTheme);
|
|
40
|
+
break;
|
|
41
|
+
case "default":
|
|
42
|
+
default:
|
|
43
|
+
setTheme(teamsLightTheme);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var overrideThemeHandler = (options === null || options === void 0 ? void 0 : options.setThemeHandler)
|
|
47
|
+
? options.setThemeHandler
|
|
48
|
+
: themeChangeHandler;
|
|
49
|
+
useEffect(function () {
|
|
50
|
+
// set initial theme based on options or query string
|
|
51
|
+
overrideThemeHandler(initialTheme);
|
|
52
|
+
app
|
|
53
|
+
.initialize()
|
|
54
|
+
.then(function () {
|
|
55
|
+
app
|
|
56
|
+
.getContext()
|
|
57
|
+
.then(function (context) {
|
|
58
|
+
batchedUpdates(function () {
|
|
59
|
+
setInTeams(true);
|
|
60
|
+
setContext(context);
|
|
61
|
+
setFullScreen(context.page.isFullScreen);
|
|
62
|
+
});
|
|
63
|
+
overrideThemeHandler(context.app.theme);
|
|
64
|
+
app.registerOnThemeChangeHandler(overrideThemeHandler);
|
|
65
|
+
pages.registerFullScreenHandler(function (isFullScreen) {
|
|
66
|
+
setFullScreen(isFullScreen);
|
|
67
|
+
});
|
|
68
|
+
})
|
|
69
|
+
.catch(function () {
|
|
70
|
+
setInTeams(false);
|
|
71
|
+
});
|
|
72
|
+
})
|
|
73
|
+
.catch(function () {
|
|
74
|
+
setInTeams(false);
|
|
75
|
+
});
|
|
76
|
+
}, []);
|
|
77
|
+
return [{ inTeams: inTeams, fullScreen: fullScreen, theme: theme, context: context, themeString: themeString }, { setTheme: overrideThemeHandler }];
|
|
78
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { TeamsFx } from "@microsoft/teamsfx";
|
|
2
|
-
import { Theme } from "@fluentui/react-components";
|
|
3
|
-
export type TeamsFxContext = {
|
|
4
|
-
/**
|
|
5
|
-
* Instance of TeamsFx.
|
|
6
|
-
*/
|
|
7
|
-
teamsfx?: TeamsFx;
|
|
8
|
-
/**
|
|
9
|
-
* Status of data loading.
|
|
10
|
-
*/
|
|
11
|
-
loading: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Error information.
|
|
14
|
-
*/
|
|
15
|
-
error: unknown;
|
|
16
|
-
/**
|
|
17
|
-
* Indicates that current environment is in Teams
|
|
18
|
-
*/
|
|
19
|
-
inTeams?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Teams theme.
|
|
22
|
-
*/
|
|
23
|
-
theme: Theme;
|
|
24
|
-
/**
|
|
25
|
-
* Teams theme string.
|
|
26
|
-
*/
|
|
27
|
-
themeString: string;
|
|
28
|
-
/**
|
|
29
|
-
* Teams context object.
|
|
30
|
-
*/
|
|
31
|
-
context?: any;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Initialize TeamsFx SDK with customized configuration.
|
|
35
|
-
*
|
|
36
|
-
* @param teamsfxConfig - custom configuration to override default ones.
|
|
37
|
-
* @returns TeamsFxContext object
|
|
38
|
-
*
|
|
39
|
-
* @beta
|
|
40
|
-
*/
|
|
41
|
-
export declare function useTeamsFx(teamsfxConfig?: Record<string, string>): TeamsFxContext;
|
|
1
|
+
import { TeamsFx } from "@microsoft/teamsfx";
|
|
2
|
+
import { Theme } from "@fluentui/react-components";
|
|
3
|
+
export type TeamsFxContext = {
|
|
4
|
+
/**
|
|
5
|
+
* Instance of TeamsFx.
|
|
6
|
+
*/
|
|
7
|
+
teamsfx?: TeamsFx;
|
|
8
|
+
/**
|
|
9
|
+
* Status of data loading.
|
|
10
|
+
*/
|
|
11
|
+
loading: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Error information.
|
|
14
|
+
*/
|
|
15
|
+
error: unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates that current environment is in Teams
|
|
18
|
+
*/
|
|
19
|
+
inTeams?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Teams theme.
|
|
22
|
+
*/
|
|
23
|
+
theme: Theme;
|
|
24
|
+
/**
|
|
25
|
+
* Teams theme string.
|
|
26
|
+
*/
|
|
27
|
+
themeString: string;
|
|
28
|
+
/**
|
|
29
|
+
* Teams context object.
|
|
30
|
+
*/
|
|
31
|
+
context?: any;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Initialize TeamsFx SDK with customized configuration.
|
|
35
|
+
*
|
|
36
|
+
* @param teamsfxConfig - custom configuration to override default ones.
|
|
37
|
+
* @returns TeamsFxContext object
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export declare function useTeamsFx(teamsfxConfig?: Record<string, string>): TeamsFxContext;
|
|
42
42
|
//# sourceMappingURL=useTeamsFx.d.ts.map
|
package/build/esm/useTeamsFx.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
4
|
-
import { LogLevel, setLogLevel, setLogFunction, TeamsFx, IdentityType } from "@microsoft/teamsfx";
|
|
5
|
-
import { useTeams } from "./useTeams";
|
|
6
|
-
import { useData } from "./useData";
|
|
7
|
-
/**
|
|
8
|
-
* Initialize TeamsFx SDK with customized configuration.
|
|
9
|
-
*
|
|
10
|
-
* @param teamsfxConfig - custom configuration to override default ones.
|
|
11
|
-
* @returns TeamsFxContext object
|
|
12
|
-
*
|
|
13
|
-
* @beta
|
|
14
|
-
*/
|
|
15
|
-
export function useTeamsFx(teamsfxConfig) {
|
|
16
|
-
var _this = this;
|
|
17
|
-
var result = useTeams({})[0];
|
|
18
|
-
var _a = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19
|
-
return __generator(this, function (_a) {
|
|
20
|
-
if (process.env.NODE_ENV === "development") {
|
|
21
|
-
setLogLevel(LogLevel.Verbose);
|
|
22
|
-
setLogFunction(function (level, message) {
|
|
23
|
-
console.log(message);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return [2 /*return*/, new TeamsFx(IdentityType.User, teamsfxConfig)];
|
|
27
|
-
});
|
|
28
|
-
}); }), data = _a.data, error = _a.error, loading = _a.loading;
|
|
29
|
-
return __assign({ teamsfx: data, error: error, loading: loading }, result);
|
|
30
|
-
}
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
4
|
+
import { LogLevel, setLogLevel, setLogFunction, TeamsFx, IdentityType } from "@microsoft/teamsfx";
|
|
5
|
+
import { useTeams } from "./useTeams";
|
|
6
|
+
import { useData } from "./useData";
|
|
7
|
+
/**
|
|
8
|
+
* Initialize TeamsFx SDK with customized configuration.
|
|
9
|
+
*
|
|
10
|
+
* @param teamsfxConfig - custom configuration to override default ones.
|
|
11
|
+
* @returns TeamsFxContext object
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export function useTeamsFx(teamsfxConfig) {
|
|
16
|
+
var _this = this;
|
|
17
|
+
var result = useTeams({})[0];
|
|
18
|
+
var _a = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19
|
+
return __generator(this, function (_a) {
|
|
20
|
+
if (process.env.NODE_ENV === "development") {
|
|
21
|
+
setLogLevel(LogLevel.Verbose);
|
|
22
|
+
setLogFunction(function (level, message) {
|
|
23
|
+
console.log(message);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return [2 /*return*/, new TeamsFx(IdentityType.User, teamsfxConfig)];
|
|
27
|
+
});
|
|
28
|
+
}); }), data = _a.data, error = _a.error, loading = _a.loading;
|
|
29
|
+
return __assign({ teamsfx: data, error: error, loading: loading }, result);
|
|
30
|
+
}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { TeamsUserCredentialAuthConfig, TeamsUserCredential } from "@microsoft/teamsfx";
|
|
2
|
-
import { Theme } from "@fluentui/react-components";
|
|
3
|
-
export type TeamsContextWithCredential = {
|
|
4
|
-
/**
|
|
5
|
-
* Instance of TeamsUserCredential.
|
|
6
|
-
*/
|
|
7
|
-
teamsUserCredential?: TeamsUserCredential;
|
|
8
|
-
/**
|
|
9
|
-
* Status of data loading.
|
|
10
|
-
*/
|
|
11
|
-
loading: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Error information.
|
|
14
|
-
*/
|
|
15
|
-
error: unknown;
|
|
16
|
-
/**
|
|
17
|
-
* Indicates that current environment is in Teams
|
|
18
|
-
*/
|
|
19
|
-
inTeams?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Teams theme.
|
|
22
|
-
*/
|
|
23
|
-
theme: Theme;
|
|
24
|
-
/**
|
|
25
|
-
* Teams theme string.
|
|
26
|
-
*/
|
|
27
|
-
themeString: string;
|
|
28
|
-
/**
|
|
29
|
-
* Teams context object.
|
|
30
|
-
*/
|
|
31
|
-
context?: any;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Initialize TeamsFx SDK with customized configuration.
|
|
35
|
-
*
|
|
36
|
-
* @param authConfig - custom configuration to override default ones.
|
|
37
|
-
* @returns TeamsContextWithCredential object
|
|
38
|
-
*
|
|
39
|
-
* @beta
|
|
40
|
-
*/
|
|
41
|
-
export declare function useTeamsUserCredential(authConfig: TeamsUserCredentialAuthConfig): TeamsContextWithCredential;
|
|
1
|
+
import { TeamsUserCredentialAuthConfig, TeamsUserCredential } from "@microsoft/teamsfx";
|
|
2
|
+
import { Theme } from "@fluentui/react-components";
|
|
3
|
+
export type TeamsContextWithCredential = {
|
|
4
|
+
/**
|
|
5
|
+
* Instance of TeamsUserCredential.
|
|
6
|
+
*/
|
|
7
|
+
teamsUserCredential?: TeamsUserCredential;
|
|
8
|
+
/**
|
|
9
|
+
* Status of data loading.
|
|
10
|
+
*/
|
|
11
|
+
loading: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Error information.
|
|
14
|
+
*/
|
|
15
|
+
error: unknown;
|
|
16
|
+
/**
|
|
17
|
+
* Indicates that current environment is in Teams
|
|
18
|
+
*/
|
|
19
|
+
inTeams?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Teams theme.
|
|
22
|
+
*/
|
|
23
|
+
theme: Theme;
|
|
24
|
+
/**
|
|
25
|
+
* Teams theme string.
|
|
26
|
+
*/
|
|
27
|
+
themeString: string;
|
|
28
|
+
/**
|
|
29
|
+
* Teams context object.
|
|
30
|
+
*/
|
|
31
|
+
context?: any;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Initialize TeamsFx SDK with customized configuration.
|
|
35
|
+
*
|
|
36
|
+
* @param authConfig - custom configuration to override default ones.
|
|
37
|
+
* @returns TeamsContextWithCredential object
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export declare function useTeamsUserCredential(authConfig: TeamsUserCredentialAuthConfig): TeamsContextWithCredential;
|
|
42
42
|
//# sourceMappingURL=useTeamsUserCredential.d.ts.map
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation.
|
|
2
|
-
// Licensed under the MIT license.
|
|
3
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
4
|
-
import { LogLevel, setLogLevel, setLogFunction, TeamsUserCredential, } from "@microsoft/teamsfx";
|
|
5
|
-
import { useTeams } from "./useTeams";
|
|
6
|
-
import { useData } from "./useData";
|
|
7
|
-
/**
|
|
8
|
-
* Initialize TeamsFx SDK with customized configuration.
|
|
9
|
-
*
|
|
10
|
-
* @param authConfig - custom configuration to override default ones.
|
|
11
|
-
* @returns TeamsContextWithCredential object
|
|
12
|
-
*
|
|
13
|
-
* @beta
|
|
14
|
-
*/
|
|
15
|
-
export function useTeamsUserCredential(authConfig) {
|
|
16
|
-
var _this = this;
|
|
17
|
-
var result = useTeams({})[0];
|
|
18
|
-
var _a = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19
|
-
return __generator(this, function (_a) {
|
|
20
|
-
if (process.env.NODE_ENV === "development") {
|
|
21
|
-
setLogLevel(LogLevel.Verbose);
|
|
22
|
-
setLogFunction(function (level, message) {
|
|
23
|
-
console.log(message);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
return [2 /*return*/, new TeamsUserCredential(authConfig)];
|
|
27
|
-
});
|
|
28
|
-
}); }), data = _a.data, error = _a.error, loading = _a.loading;
|
|
29
|
-
return __assign({ teamsUserCredential: data, error: error, loading: loading }, result);
|
|
30
|
-
}
|
|
1
|
+
// Copyright (c) Microsoft Corporation.
|
|
2
|
+
// Licensed under the MIT license.
|
|
3
|
+
import { __assign, __awaiter, __generator } from "tslib";
|
|
4
|
+
import { LogLevel, setLogLevel, setLogFunction, TeamsUserCredential, } from "@microsoft/teamsfx";
|
|
5
|
+
import { useTeams } from "./useTeams";
|
|
6
|
+
import { useData } from "./useData";
|
|
7
|
+
/**
|
|
8
|
+
* Initialize TeamsFx SDK with customized configuration.
|
|
9
|
+
*
|
|
10
|
+
* @param authConfig - custom configuration to override default ones.
|
|
11
|
+
* @returns TeamsContextWithCredential object
|
|
12
|
+
*
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export function useTeamsUserCredential(authConfig) {
|
|
16
|
+
var _this = this;
|
|
17
|
+
var result = useTeams({})[0];
|
|
18
|
+
var _a = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
19
|
+
return __generator(this, function (_a) {
|
|
20
|
+
if (process.env.NODE_ENV === "development") {
|
|
21
|
+
setLogLevel(LogLevel.Verbose);
|
|
22
|
+
setLogFunction(function (level, message) {
|
|
23
|
+
console.log(message);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return [2 /*return*/, new TeamsUserCredential(authConfig)];
|
|
27
|
+
});
|
|
28
|
+
}); }), data = _a.data, error = _a.error, loading = _a.loading;
|
|
29
|
+
return __assign({ teamsUserCredential: data, error: error, loading: loading }, result);
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/teamsfx-react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1-alpha.ru6q1vrv0.0",
|
|
4
4
|
"description": "React helper functions for Microsoft TeamsFx",
|
|
5
5
|
"main": "build/cjs/index.js",
|
|
6
6
|
"module": "build/esm/index.js",
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
"precommit": "npm run check-sensitive && lint-staged"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@fluentui/react": "^8.106.1",
|
|
31
32
|
"@fluentui/react-components": "^9.15.0",
|
|
32
33
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
33
|
-
"@microsoft/eslint-plugin-teamsfx": "0.0.
|
|
34
|
+
"@microsoft/eslint-plugin-teamsfx": "^0.0.1",
|
|
34
35
|
"@microsoft/microsoft-graph-client": "^3.0.1",
|
|
35
36
|
"@microsoft/teams-js": "^2.0.0",
|
|
36
|
-
"@microsoft/teamsfx": "2.
|
|
37
|
+
"@microsoft/teamsfx": "^2.1.0",
|
|
37
38
|
"@testing-library/react": "^13.4.0",
|
|
38
39
|
"@types/enzyme": "^3.10.10",
|
|
39
40
|
"@types/jest": "^29.4.0",
|
|
@@ -70,6 +71,7 @@
|
|
|
70
71
|
"typescript": "latest"
|
|
71
72
|
},
|
|
72
73
|
"peerDependencies": {
|
|
74
|
+
"@fluentui/react": "^8.106.1",
|
|
73
75
|
"@fluentui/react-components": "^9.15.0",
|
|
74
76
|
"@microsoft/microsoft-graph-client": "^3.0.1",
|
|
75
77
|
"@microsoft/teams-js": "^2.0.0",
|
|
@@ -84,6 +86,5 @@
|
|
|
84
86
|
"*.{js,jsx,css,ts,tsx}": [
|
|
85
87
|
"npx eslint --cache --fix --quiet"
|
|
86
88
|
]
|
|
87
|
-
}
|
|
88
|
-
"gitHead": "68ba6e6eedcdc207ff0862bdea061526ffc666d4"
|
|
89
|
+
}
|
|
89
90
|
}
|