@microsoft/teamsfx-react 3.1.3 → 4.0.0-alpha.b8a9ab9fa.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/build/cjs/BaseDashboard.d.ts +2 -2
- package/build/cjs/BaseDashboard.d.ts.map +1 -1
- package/build/cjs/BaseWidget.d.ts +2 -2
- package/build/cjs/BaseWidget.d.ts.map +1 -1
- package/build/cjs/index.d.ts +1 -2
- package/build/cjs/index.d.ts.map +1 -1
- package/build/cjs/index.js +1 -4
- package/build/cjs/useGraph.d.ts +1 -16
- package/build/cjs/useGraph.d.ts.map +1 -1
- package/build/cjs/useGraph.js +9 -72
- package/build/esm/BaseDashboard.d.ts +2 -2
- package/build/esm/BaseDashboard.d.ts.map +1 -1
- package/build/esm/BaseWidget.d.ts +2 -2
- package/build/esm/BaseWidget.d.ts.map +1 -1
- package/build/esm/index.d.ts +1 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +1 -2
- package/build/esm/useGraph.d.ts +1 -16
- package/build/esm/useGraph.d.ts.map +1 -1
- package/build/esm/useGraph.js +10 -72
- package/package.json +40 -39
- package/build/cjs/useTeamsFx.d.ts +0 -42
- package/build/cjs/useTeamsFx.d.ts.map +0 -1
- package/build/cjs/useTeamsFx.js +0 -34
- package/build/esm/useTeamsFx.d.ts +0 -42
- package/build/esm/useTeamsFx.d.ts.map +0 -1
- package/build/esm/useTeamsFx.js +0 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* The state interface for the BaseDashboard component.
|
|
4
4
|
*/
|
|
@@ -43,7 +43,7 @@ export declare class BaseDashboard<P, S> extends Component<P, S & BaseDashboardS
|
|
|
43
43
|
/**
|
|
44
44
|
* Defines the default layout for the dashboard.
|
|
45
45
|
*/
|
|
46
|
-
render(): JSX.Element;
|
|
46
|
+
render(): React.JSX.Element;
|
|
47
47
|
/**
|
|
48
48
|
* Override this method to define the layout of the widget in the dashboard.
|
|
49
49
|
* @returns The layout of the widget in the dashboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseDashboard.d.ts","sourceRoot":"","sources":["../../src/BaseDashboard.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"BaseDashboard.d.ts","sourceRoot":"","sources":["../../src/BaseDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAoBzC;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC;IAC3E;;OAEG;IACH,OAAO,CAAC,GAAG,CAAkC;IAE7C;;;OAGG;gBACgB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAUrC;;OAEG;IACU,iBAAiB;IAa9B;;OAEG;IACI,oBAAoB,IAAI,IAAI;IAOnC;;OAEG;IACI,MAAM;IAWb;;;;OAIG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;OAIG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM;CAG5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for defining the class names of widget elements
|
|
4
4
|
*/
|
|
@@ -44,7 +44,7 @@ export declare class BaseWidget<P, S> extends Component<P, S & BaseWidgetState>
|
|
|
44
44
|
/**
|
|
45
45
|
* Defines the default layout for the widget.
|
|
46
46
|
*/
|
|
47
|
-
render(): JSX.Element;
|
|
47
|
+
render(): React.JSX.Element;
|
|
48
48
|
/**
|
|
49
49
|
* Get data required by the widget
|
|
50
50
|
* @returns Data for the widget
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseWidget.d.ts","sourceRoot":"","sources":["../../src/BaseWidget.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"BaseWidget.d.ts","sourceRoot":"","sources":["../../src/BaseWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2CD;;GAEG;AACH,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,UAAU,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC;IACrE;;;OAGG;gBACgB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAKrC;;OAEG;IACU,iBAAiB;IAI9B;;OAEG;IACI,MAAM;IAsBb;;;;OAIG;cACa,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;;;OAMG;IACH,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAIzC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI5C;;;;;OAKG;IACH,SAAS,CAAC,OAAO,IAAI,iBAAiB;CAGvC"}
|
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { useTeams } from "./useTeams";
|
|
2
2
|
export { useData } from "./useData";
|
|
3
|
-
export { useTeamsFx, TeamsFxContext } from "./useTeamsFx";
|
|
4
3
|
export { useTeamsUserCredential, TeamsContextWithCredential } from "./useTeamsUserCredential";
|
|
5
|
-
export {
|
|
4
|
+
export { useGraphWithCredential } from "./useGraph";
|
|
6
5
|
export { BaseDashboard } from "./BaseDashboard";
|
|
7
6
|
export { BaseWidget, IWidgetClassNames } from "./BaseWidget";
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/build/cjs/index.js
CHANGED
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.BaseWidget = exports.BaseDashboard = exports.useGraphWithCredential = exports.
|
|
5
|
+
exports.BaseWidget = exports.BaseDashboard = exports.useGraphWithCredential = exports.useTeamsUserCredential = exports.useData = exports.useTeams = void 0;
|
|
6
6
|
var useTeams_1 = require("./useTeams");
|
|
7
7
|
Object.defineProperty(exports, "useTeams", { enumerable: true, get: function () { return useTeams_1.useTeams; } });
|
|
8
8
|
var useData_1 = require("./useData");
|
|
9
9
|
Object.defineProperty(exports, "useData", { enumerable: true, get: function () { return useData_1.useData; } });
|
|
10
|
-
var useTeamsFx_1 = require("./useTeamsFx");
|
|
11
|
-
Object.defineProperty(exports, "useTeamsFx", { enumerable: true, get: function () { return useTeamsFx_1.useTeamsFx; } });
|
|
12
10
|
var useTeamsUserCredential_1 = require("./useTeamsUserCredential");
|
|
13
11
|
Object.defineProperty(exports, "useTeamsUserCredential", { enumerable: true, get: function () { return useTeamsUserCredential_1.useTeamsUserCredential; } });
|
|
14
12
|
var useGraph_1 = require("./useGraph");
|
|
15
|
-
Object.defineProperty(exports, "useGraph", { enumerable: true, get: function () { return useGraph_1.useGraph; } });
|
|
16
13
|
Object.defineProperty(exports, "useGraphWithCredential", { enumerable: true, get: function () { return useGraph_1.useGraphWithCredential; } });
|
|
17
14
|
var BaseDashboard_1 = require("./BaseDashboard");
|
|
18
15
|
Object.defineProperty(exports, "BaseDashboard", { enumerable: true, get: function () { return BaseDashboard_1.BaseDashboard; } });
|
package/build/cjs/useGraph.d.ts
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { Data } from "./useData";
|
|
2
|
-
import {
|
|
2
|
+
import { TeamsUserCredential } from "@microsoft/teamsfx";
|
|
3
3
|
import { Client } from "@microsoft/microsoft-graph-client";
|
|
4
|
-
type GraphOption = {
|
|
5
|
-
scope?: string[];
|
|
6
|
-
teamsfx?: TeamsFx;
|
|
7
|
-
};
|
|
8
4
|
type GraphOptionWithCredential = {
|
|
9
5
|
scope?: string[];
|
|
10
6
|
credential?: TeamsUserCredential;
|
|
11
7
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Helper function to call Microsoft Graph API with authentication.
|
|
14
|
-
* @deprecated Please use {@link useGraphWithCredential} instead.
|
|
15
|
-
*
|
|
16
|
-
* @param fetchGraphDataAsync - async function of how to call Graph API and fetch data.
|
|
17
|
-
* @param options - teamsfx instance and OAuth resource scope.
|
|
18
|
-
* @returns data, loading status, error and reload function
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export declare function useGraph<T>(fetchGraphDataAsync: (graph: Client, teamsfx: TeamsFx, scope: string[]) => Promise<T>, options?: GraphOption): Data<T>;
|
|
23
8
|
/**
|
|
24
9
|
* Helper function to call Microsoft Graph API with authentication.
|
|
25
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGraph.d.ts","sourceRoot":"","sources":["../../src/useGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAW,MAAM,WAAW,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"useGraph.d.ts","sourceRoot":"","sources":["../../src/useGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAW,MAAM,WAAW,CAAC;AAC1C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAc,MAAM,mCAAmC,CAAC;AAIvE,KAAK,yBAAyB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,CACnB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE,MAAM,EAAE,KACZ,OAAO,CAAC,CAAC,CAAC,EACf,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAAC,CAAC,CAAC,CAuDT"}
|
package/build/cjs/useGraph.js
CHANGED
|
@@ -2,76 +2,13 @@
|
|
|
2
2
|
// Copyright (c) Microsoft Corporation.
|
|
3
3
|
// Licensed under the MIT license.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.useGraphWithCredential =
|
|
5
|
+
exports.useGraphWithCredential = void 0;
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var useData_1 = require("./useData");
|
|
8
8
|
var teamsfx_1 = require("@microsoft/teamsfx");
|
|
9
9
|
var microsoft_graph_client_1 = require("@microsoft/microsoft-graph-client");
|
|
10
10
|
var azureTokenCredentials_1 = require("@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials");
|
|
11
11
|
var react_1 = require("react");
|
|
12
|
-
/**
|
|
13
|
-
* Helper function to call Microsoft Graph API with authentication.
|
|
14
|
-
* @deprecated Please use {@link useGraphWithCredential} instead.
|
|
15
|
-
*
|
|
16
|
-
* @param fetchGraphDataAsync - async function of how to call Graph API and fetch data.
|
|
17
|
-
* @param options - teamsfx instance and OAuth resource scope.
|
|
18
|
-
* @returns data, loading status, error and reload function
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
function useGraph(fetchGraphDataAsync, options) {
|
|
23
|
-
var _this = this;
|
|
24
|
-
var _a = tslib_1.__assign({ scope: ["User.Read"], teamsfx: new teamsfx_1.TeamsFx() }, options), scope = _a.scope, teamsfx = _a.teamsfx;
|
|
25
|
-
var _b = (0, react_1.useState)(false), needConsent = _b[0], setNeedConsent = _b[1];
|
|
26
|
-
var _c = (0, useData_1.useData)(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
27
|
-
var err_1, helpLink, graph, graphData, err_2;
|
|
28
|
-
var _a, _b;
|
|
29
|
-
return tslib_1.__generator(this, function (_c) {
|
|
30
|
-
switch (_c.label) {
|
|
31
|
-
case 0:
|
|
32
|
-
if (!needConsent) return [3 /*break*/, 4];
|
|
33
|
-
_c.label = 1;
|
|
34
|
-
case 1:
|
|
35
|
-
_c.trys.push([1, 3, , 4]);
|
|
36
|
-
return [4 /*yield*/, teamsfx.login(scope)];
|
|
37
|
-
case 2:
|
|
38
|
-
_c.sent();
|
|
39
|
-
setNeedConsent(false);
|
|
40
|
-
return [3 /*break*/, 4];
|
|
41
|
-
case 3:
|
|
42
|
-
err_1 = _c.sent();
|
|
43
|
-
if (err_1 instanceof teamsfx_1.ErrorWithCode && ((_a = err_1.message) === null || _a === void 0 ? void 0 : _a.includes("CancelledByUser"))) {
|
|
44
|
-
helpLink = "https://aka.ms/teamsfx-auth-code-flow";
|
|
45
|
-
err_1.message +=
|
|
46
|
-
'\nIf you see "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application" ' +
|
|
47
|
-
"in the popup window, you may be using unmatched version for TeamsFx SDK (version >= 0.5.0) and Teams Toolkit (version < 3.3.0) or " +
|
|
48
|
-
"cli (version < 0.11.0). Please refer to the help link for how to fix the issue: ".concat(helpLink);
|
|
49
|
-
}
|
|
50
|
-
throw err_1;
|
|
51
|
-
case 4:
|
|
52
|
-
_c.trys.push([4, 6, , 7]);
|
|
53
|
-
graph = (0, teamsfx_1.createMicrosoftGraphClient)(teamsfx, scope);
|
|
54
|
-
return [4 /*yield*/, fetchGraphDataAsync(graph, teamsfx, scope)];
|
|
55
|
-
case 5:
|
|
56
|
-
graphData = _c.sent();
|
|
57
|
-
return [2 /*return*/, graphData];
|
|
58
|
-
case 6:
|
|
59
|
-
err_2 = _c.sent();
|
|
60
|
-
if (err_2 instanceof microsoft_graph_client_1.GraphError && ((_b = err_2.code) === null || _b === void 0 ? void 0 : _b.includes("UiRequiredError"))) {
|
|
61
|
-
// Silently fail for user didn't consent error
|
|
62
|
-
setNeedConsent(true);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
throw err_2;
|
|
66
|
-
}
|
|
67
|
-
return [3 /*break*/, 7];
|
|
68
|
-
case 7: return [2 /*return*/];
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}); }), data = _c.data, error = _c.error, loading = _c.loading, reload = _c.reload;
|
|
72
|
-
return { data: data, error: error, loading: loading, reload: reload };
|
|
73
|
-
}
|
|
74
|
-
exports.useGraph = useGraph;
|
|
75
12
|
/**
|
|
76
13
|
* Helper function to call Microsoft Graph API with authentication.
|
|
77
14
|
*
|
|
@@ -103,7 +40,7 @@ function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
103
40
|
}
|
|
104
41
|
var _a = (0, react_1.useState)(false), needConsent = _a[0], setNeedConsent = _a[1];
|
|
105
42
|
var _b = (0, useData_1.useData)(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
106
|
-
var
|
|
43
|
+
var err_1, helpLink, authProvider, graph, graphData, err_2;
|
|
107
44
|
var _a, _b;
|
|
108
45
|
return tslib_1.__generator(this, function (_c) {
|
|
109
46
|
switch (_c.label) {
|
|
@@ -118,15 +55,15 @@ function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
118
55
|
setNeedConsent(false);
|
|
119
56
|
return [3 /*break*/, 4];
|
|
120
57
|
case 3:
|
|
121
|
-
|
|
122
|
-
if (
|
|
58
|
+
err_1 = _c.sent();
|
|
59
|
+
if (err_1 instanceof teamsfx_1.ErrorWithCode && ((_a = err_1.message) === null || _a === void 0 ? void 0 : _a.includes("CancelledByUser"))) {
|
|
123
60
|
helpLink = "https://aka.ms/teamsfx-auth-code-flow";
|
|
124
|
-
|
|
61
|
+
err_1.message +=
|
|
125
62
|
'\nIf you see "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application" ' +
|
|
126
63
|
"in the popup window, you may be using unmatched version for TeamsFx SDK (version >= 0.5.0) and Teams Toolkit (version < 3.3.0) or " +
|
|
127
64
|
"cli (version < 0.11.0). Please refer to the help link for how to fix the issue: ".concat(helpLink);
|
|
128
65
|
}
|
|
129
|
-
throw
|
|
66
|
+
throw err_1;
|
|
130
67
|
case 4:
|
|
131
68
|
_c.trys.push([4, 6, , 7]);
|
|
132
69
|
authProvider = new azureTokenCredentials_1.TokenCredentialAuthenticationProvider(credential, { scopes: scope });
|
|
@@ -138,13 +75,13 @@ function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
138
75
|
graphData = _c.sent();
|
|
139
76
|
return [2 /*return*/, graphData];
|
|
140
77
|
case 6:
|
|
141
|
-
|
|
142
|
-
if (
|
|
78
|
+
err_2 = _c.sent();
|
|
79
|
+
if (err_2 instanceof microsoft_graph_client_1.GraphError && ((_b = err_2.code) === null || _b === void 0 ? void 0 : _b.includes("UiRequiredError"))) {
|
|
143
80
|
// Silently fail for user didn't consent error
|
|
144
81
|
setNeedConsent(true);
|
|
145
82
|
}
|
|
146
83
|
else {
|
|
147
|
-
throw
|
|
84
|
+
throw err_2;
|
|
148
85
|
}
|
|
149
86
|
return [3 /*break*/, 7];
|
|
150
87
|
case 7: return [2 /*return*/];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* The state interface for the BaseDashboard component.
|
|
4
4
|
*/
|
|
@@ -43,7 +43,7 @@ export declare class BaseDashboard<P, S> extends Component<P, S & BaseDashboardS
|
|
|
43
43
|
/**
|
|
44
44
|
* Defines the default layout for the dashboard.
|
|
45
45
|
*/
|
|
46
|
-
render(): JSX.Element;
|
|
46
|
+
render(): React.JSX.Element;
|
|
47
47
|
/**
|
|
48
48
|
* Override this method to define the layout of the widget in the dashboard.
|
|
49
49
|
* @returns The layout of the widget in the dashboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseDashboard.d.ts","sourceRoot":"","sources":["../../src/BaseDashboard.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"BaseDashboard.d.ts","sourceRoot":"","sources":["../../src/BaseDashboard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAoBzC;;GAEG;AACH,UAAU,kBAAkB;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC;IAC3E;;OAEG;IACH,OAAO,CAAC,GAAG,CAAkC;IAE7C;;;OAGG;gBACgB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAUrC;;OAEG;IACU,iBAAiB;IAa9B;;OAEG;IACI,oBAAoB,IAAI,IAAI;IAOnC;;OAEG;IACI,MAAM;IAWb;;;;OAIG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;OAIG;IACH,SAAS,CAAC,OAAO,IAAI,MAAM;CAG5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from "react";
|
|
1
|
+
import React, { Component } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for defining the class names of widget elements
|
|
4
4
|
*/
|
|
@@ -44,7 +44,7 @@ export declare class BaseWidget<P, S> extends Component<P, S & BaseWidgetState>
|
|
|
44
44
|
/**
|
|
45
45
|
* Defines the default layout for the widget.
|
|
46
46
|
*/
|
|
47
|
-
render(): JSX.Element;
|
|
47
|
+
render(): React.JSX.Element;
|
|
48
48
|
/**
|
|
49
49
|
* Get data required by the widget
|
|
50
50
|
* @returns Data for the widget
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseWidget.d.ts","sourceRoot":"","sources":["../../src/BaseWidget.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"BaseWidget.d.ts","sourceRoot":"","sources":["../../src/BaseWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKzC;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2CD;;GAEG;AACH,UAAU,eAAe;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,UAAU,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC;IACrE;;;OAGG;gBACgB,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;IAKrC;;OAEG;IACU,iBAAiB;IAI9B;;OAEG;IACI,MAAM;IAsBb;;;;OAIG;cACa,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC;IAIrC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;;;OAMG;IACH,SAAS,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAIzC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI3C;;;;;;OAMG;IACH,SAAS,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,GAAG,SAAS;IAI5C;;;;;OAKG;IACH,SAAS,CAAC,OAAO,IAAI,iBAAiB;CAGvC"}
|
package/build/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
export { useTeams } from "./useTeams";
|
|
2
2
|
export { useData } from "./useData";
|
|
3
|
-
export { useTeamsFx, TeamsFxContext } from "./useTeamsFx";
|
|
4
3
|
export { useTeamsUserCredential, TeamsContextWithCredential } from "./useTeamsUserCredential";
|
|
5
|
-
export {
|
|
4
|
+
export { useGraphWithCredential } from "./useGraph";
|
|
6
5
|
export { BaseDashboard } from "./BaseDashboard";
|
|
7
6
|
export { BaseWidget, IWidgetClassNames } from "./BaseWidget";
|
|
8
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/build/esm/index.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
export { useTeams } from "./useTeams";
|
|
4
4
|
export { useData } from "./useData";
|
|
5
|
-
export { useTeamsFx } from "./useTeamsFx";
|
|
6
5
|
export { useTeamsUserCredential } from "./useTeamsUserCredential";
|
|
7
|
-
export {
|
|
6
|
+
export { useGraphWithCredential } from "./useGraph";
|
|
8
7
|
export { BaseDashboard } from "./BaseDashboard";
|
|
9
8
|
export { BaseWidget } from "./BaseWidget";
|
package/build/esm/useGraph.d.ts
CHANGED
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
import { Data } from "./useData";
|
|
2
|
-
import {
|
|
2
|
+
import { TeamsUserCredential } from "@microsoft/teamsfx";
|
|
3
3
|
import { Client } from "@microsoft/microsoft-graph-client";
|
|
4
|
-
type GraphOption = {
|
|
5
|
-
scope?: string[];
|
|
6
|
-
teamsfx?: TeamsFx;
|
|
7
|
-
};
|
|
8
4
|
type GraphOptionWithCredential = {
|
|
9
5
|
scope?: string[];
|
|
10
6
|
credential?: TeamsUserCredential;
|
|
11
7
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Helper function to call Microsoft Graph API with authentication.
|
|
14
|
-
* @deprecated Please use {@link useGraphWithCredential} instead.
|
|
15
|
-
*
|
|
16
|
-
* @param fetchGraphDataAsync - async function of how to call Graph API and fetch data.
|
|
17
|
-
* @param options - teamsfx instance and OAuth resource scope.
|
|
18
|
-
* @returns data, loading status, error and reload function
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export declare function useGraph<T>(fetchGraphDataAsync: (graph: Client, teamsfx: TeamsFx, scope: string[]) => Promise<T>, options?: GraphOption): Data<T>;
|
|
23
8
|
/**
|
|
24
9
|
* Helper function to call Microsoft Graph API with authentication.
|
|
25
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGraph.d.ts","sourceRoot":"","sources":["../../src/useGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAW,MAAM,WAAW,CAAC;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"useGraph.d.ts","sourceRoot":"","sources":["../../src/useGraph.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAW,MAAM,WAAW,CAAC;AAC1C,OAAO,EAEL,mBAAmB,EAEpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAc,MAAM,mCAAmC,CAAC;AAIvE,KAAK,yBAAyB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,mBAAmB,EAAE,CACnB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE,MAAM,EAAE,KACZ,OAAO,CAAC,CAAC,CAAC,EACf,OAAO,CAAC,EAAE,yBAAyB,GAClC,IAAI,CAAC,CAAC,CAAC,CAuDT"}
|
package/build/esm/useGraph.js
CHANGED
|
@@ -1,73 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
|
-
import {
|
|
3
|
+
import { __awaiter, __generator } from "tslib";
|
|
4
4
|
import { useData } from "./useData";
|
|
5
|
-
import {
|
|
5
|
+
import { ErrorWithCode, TeamsUserCredential, } from "@microsoft/teamsfx";
|
|
6
6
|
import { Client, GraphError } from "@microsoft/microsoft-graph-client";
|
|
7
7
|
import { TokenCredentialAuthenticationProvider } from "@microsoft/microsoft-graph-client/authProviders/azureTokenCredentials";
|
|
8
8
|
import { useState } from "react";
|
|
9
|
-
/**
|
|
10
|
-
* Helper function to call Microsoft Graph API with authentication.
|
|
11
|
-
* @deprecated Please use {@link useGraphWithCredential} instead.
|
|
12
|
-
*
|
|
13
|
-
* @param fetchGraphDataAsync - async function of how to call Graph API and fetch data.
|
|
14
|
-
* @param options - teamsfx instance and OAuth resource scope.
|
|
15
|
-
* @returns data, loading status, error and reload function
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
*/
|
|
19
|
-
export function useGraph(fetchGraphDataAsync, options) {
|
|
20
|
-
var _this = this;
|
|
21
|
-
var _a = __assign({ scope: ["User.Read"], teamsfx: new TeamsFx() }, options), scope = _a.scope, teamsfx = _a.teamsfx;
|
|
22
|
-
var _b = useState(false), needConsent = _b[0], setNeedConsent = _b[1];
|
|
23
|
-
var _c = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
24
|
-
var err_1, helpLink, graph, graphData, err_2;
|
|
25
|
-
var _a, _b;
|
|
26
|
-
return __generator(this, function (_c) {
|
|
27
|
-
switch (_c.label) {
|
|
28
|
-
case 0:
|
|
29
|
-
if (!needConsent) return [3 /*break*/, 4];
|
|
30
|
-
_c.label = 1;
|
|
31
|
-
case 1:
|
|
32
|
-
_c.trys.push([1, 3, , 4]);
|
|
33
|
-
return [4 /*yield*/, teamsfx.login(scope)];
|
|
34
|
-
case 2:
|
|
35
|
-
_c.sent();
|
|
36
|
-
setNeedConsent(false);
|
|
37
|
-
return [3 /*break*/, 4];
|
|
38
|
-
case 3:
|
|
39
|
-
err_1 = _c.sent();
|
|
40
|
-
if (err_1 instanceof ErrorWithCode && ((_a = err_1.message) === null || _a === void 0 ? void 0 : _a.includes("CancelledByUser"))) {
|
|
41
|
-
helpLink = "https://aka.ms/teamsfx-auth-code-flow";
|
|
42
|
-
err_1.message +=
|
|
43
|
-
'\nIf you see "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application" ' +
|
|
44
|
-
"in the popup window, you may be using unmatched version for TeamsFx SDK (version >= 0.5.0) and Teams Toolkit (version < 3.3.0) or " +
|
|
45
|
-
"cli (version < 0.11.0). Please refer to the help link for how to fix the issue: ".concat(helpLink);
|
|
46
|
-
}
|
|
47
|
-
throw err_1;
|
|
48
|
-
case 4:
|
|
49
|
-
_c.trys.push([4, 6, , 7]);
|
|
50
|
-
graph = createMicrosoftGraphClient(teamsfx, scope);
|
|
51
|
-
return [4 /*yield*/, fetchGraphDataAsync(graph, teamsfx, scope)];
|
|
52
|
-
case 5:
|
|
53
|
-
graphData = _c.sent();
|
|
54
|
-
return [2 /*return*/, graphData];
|
|
55
|
-
case 6:
|
|
56
|
-
err_2 = _c.sent();
|
|
57
|
-
if (err_2 instanceof GraphError && ((_b = err_2.code) === null || _b === void 0 ? void 0 : _b.includes("UiRequiredError"))) {
|
|
58
|
-
// Silently fail for user didn't consent error
|
|
59
|
-
setNeedConsent(true);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
throw err_2;
|
|
63
|
-
}
|
|
64
|
-
return [3 /*break*/, 7];
|
|
65
|
-
case 7: return [2 /*return*/];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
}); }), data = _c.data, error = _c.error, loading = _c.loading, reload = _c.reload;
|
|
69
|
-
return { data: data, error: error, loading: loading, reload: reload };
|
|
70
|
-
}
|
|
71
9
|
/**
|
|
72
10
|
* Helper function to call Microsoft Graph API with authentication.
|
|
73
11
|
*
|
|
@@ -99,7 +37,7 @@ export function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
99
37
|
}
|
|
100
38
|
var _a = useState(false), needConsent = _a[0], setNeedConsent = _a[1];
|
|
101
39
|
var _b = useData(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
102
|
-
var
|
|
40
|
+
var err_1, helpLink, authProvider, graph, graphData, err_2;
|
|
103
41
|
var _a, _b;
|
|
104
42
|
return __generator(this, function (_c) {
|
|
105
43
|
switch (_c.label) {
|
|
@@ -114,15 +52,15 @@ export function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
114
52
|
setNeedConsent(false);
|
|
115
53
|
return [3 /*break*/, 4];
|
|
116
54
|
case 3:
|
|
117
|
-
|
|
118
|
-
if (
|
|
55
|
+
err_1 = _c.sent();
|
|
56
|
+
if (err_1 instanceof ErrorWithCode && ((_a = err_1.message) === null || _a === void 0 ? void 0 : _a.includes("CancelledByUser"))) {
|
|
119
57
|
helpLink = "https://aka.ms/teamsfx-auth-code-flow";
|
|
120
|
-
|
|
58
|
+
err_1.message +=
|
|
121
59
|
'\nIf you see "AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application" ' +
|
|
122
60
|
"in the popup window, you may be using unmatched version for TeamsFx SDK (version >= 0.5.0) and Teams Toolkit (version < 3.3.0) or " +
|
|
123
61
|
"cli (version < 0.11.0). Please refer to the help link for how to fix the issue: ".concat(helpLink);
|
|
124
62
|
}
|
|
125
|
-
throw
|
|
63
|
+
throw err_1;
|
|
126
64
|
case 4:
|
|
127
65
|
_c.trys.push([4, 6, , 7]);
|
|
128
66
|
authProvider = new TokenCredentialAuthenticationProvider(credential, { scopes: scope });
|
|
@@ -134,13 +72,13 @@ export function useGraphWithCredential(fetchGraphDataAsync, options) {
|
|
|
134
72
|
graphData = _c.sent();
|
|
135
73
|
return [2 /*return*/, graphData];
|
|
136
74
|
case 6:
|
|
137
|
-
|
|
138
|
-
if (
|
|
75
|
+
err_2 = _c.sent();
|
|
76
|
+
if (err_2 instanceof GraphError && ((_b = err_2.code) === null || _b === void 0 ? void 0 : _b.includes("UiRequiredError"))) {
|
|
139
77
|
// Silently fail for user didn't consent error
|
|
140
78
|
setNeedConsent(true);
|
|
141
79
|
}
|
|
142
80
|
else {
|
|
143
|
-
throw
|
|
81
|
+
throw err_2;
|
|
144
82
|
}
|
|
145
83
|
return [3 /*break*/, 7];
|
|
146
84
|
case 7: return [2 /*return*/];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/teamsfx-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.b8a9ab9fa.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,53 +28,54 @@
|
|
|
28
28
|
"precommit": "npm run check-sensitive && lint-staged"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
+
"@babel/core": "^7.25.2",
|
|
32
|
+
"@babel/preset-env": "^7.25.4",
|
|
33
|
+
"@babel/preset-react": "^7.24.7",
|
|
34
|
+
"@babel/preset-typescript": "^7.24.7",
|
|
31
35
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
32
|
-
"@testing-library/react": "^
|
|
33
|
-
"@types/enzyme": "^3.10.
|
|
34
|
-
"@types/jest": "^29.
|
|
35
|
-
"@types/node": "^
|
|
36
|
-
"@types/react": "^18.
|
|
37
|
-
"@types/react-dom": "^18.
|
|
38
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
39
|
-
"@typescript-eslint/parser": "^
|
|
40
|
-
"
|
|
41
|
-
"eslint
|
|
36
|
+
"@testing-library/react": "^16.0.1",
|
|
37
|
+
"@types/enzyme": "^3.10.18",
|
|
38
|
+
"@types/jest": "^29.5.13",
|
|
39
|
+
"@types/node": "^18.0.0",
|
|
40
|
+
"@types/react": "^18.3.9",
|
|
41
|
+
"@types/react-dom": "^18.3.0",
|
|
42
|
+
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
|
43
|
+
"@typescript-eslint/parser": "^8.7.0",
|
|
44
|
+
"babel-jest": "^29.7.0",
|
|
45
|
+
"eslint": "^8.6.0",
|
|
42
46
|
"eslint-plugin-header": "^3.1.1",
|
|
43
|
-
"eslint-plugin-import": "^2.
|
|
44
|
-
"eslint-plugin-jest": "^
|
|
45
|
-
"eslint-plugin-n": "^
|
|
46
|
-
"eslint-plugin-no-secrets": "^0.
|
|
47
|
-
"eslint-plugin-prettier": "^
|
|
48
|
-
"eslint-plugin-promise": "^
|
|
49
|
-
"eslint-plugin-react": "^7.
|
|
50
|
-
"eslint-plugin-react-hooks": "^4.2
|
|
47
|
+
"eslint-plugin-import": "^2.30.0",
|
|
48
|
+
"eslint-plugin-jest": "^28.8.3",
|
|
49
|
+
"eslint-plugin-n": "^17.10.3",
|
|
50
|
+
"eslint-plugin-no-secrets": "^1.0.2",
|
|
51
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
52
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
53
|
+
"eslint-plugin-react": "^7.37.0",
|
|
54
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
51
55
|
"isomorphic-fetch": "^3.0.0",
|
|
52
|
-
"jest": "^29.
|
|
53
|
-
"jest-environment-jsdom": "^29.
|
|
54
|
-
"jest-junit": "^
|
|
55
|
-
"jwt-decode": "^
|
|
56
|
-
"lint-staged": "^
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"ts-jest": "29.1.0",
|
|
64
|
-
"tslib": "^2.3.1",
|
|
65
|
-
"typescript": "latest"
|
|
56
|
+
"jest": "^29.7.0",
|
|
57
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
58
|
+
"jest-junit": "^16.0.0",
|
|
59
|
+
"jwt-decode": "^4.0.0",
|
|
60
|
+
"lint-staged": "^15.2.0",
|
|
61
|
+
"nyc": "^17.1.0",
|
|
62
|
+
"prettier": "^3.3.3",
|
|
63
|
+
"rimraf": "^6.0.1",
|
|
64
|
+
"ts-jest": "29.2.5",
|
|
65
|
+
"tslib": "^2.7.0",
|
|
66
|
+
"typescript": "~5.4.2"
|
|
66
67
|
},
|
|
67
68
|
"peerDependencies": {
|
|
68
|
-
"@fluentui/react-components": "^9.
|
|
69
|
+
"@fluentui/react-components": "^9.54.16",
|
|
69
70
|
"@microsoft/microsoft-graph-client": "^3.0.7",
|
|
70
|
-
"@microsoft/teams-js": "^2.
|
|
71
|
-
"@microsoft/teamsfx": "^
|
|
71
|
+
"@microsoft/teams-js": "^2.28.0",
|
|
72
|
+
"@microsoft/teamsfx": "^3.0.0-alpha",
|
|
72
73
|
"react": ">=16.8.0 <19.0.0",
|
|
73
74
|
"react-dom": ">=16.8.0 <19.0.0"
|
|
74
75
|
},
|
|
75
76
|
"dependencies": {
|
|
76
|
-
"@fluentui/react": "^8.
|
|
77
|
-
"@microsoft/teamsfx": "
|
|
77
|
+
"@fluentui/react": "^8.120.9",
|
|
78
|
+
"@microsoft/teamsfx": "3.0.0-alpha.b8a9ab9fa.0"
|
|
78
79
|
},
|
|
79
80
|
"publishConfig": {
|
|
80
81
|
"access": "public"
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"npx eslint --cache --fix --quiet"
|
|
85
86
|
]
|
|
86
87
|
},
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "fe578371091d35cbd65a10053cd9b77a1caeaaee"
|
|
88
89
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare function useTeamsFx(teamsfxConfig?: Record<string, string>): TeamsFxContext;
|
|
42
|
-
//# sourceMappingURL=useTeamsFx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTeamsFx.d.ts","sourceRoot":"","sources":["../../src/useTeamsFx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,OAAO,EAAgB,MAAM,oBAAoB,CAAC;AAElG,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IAEH,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,CAYjF"}
|
package/build/cjs/useTeamsFx.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copyright (c) Microsoft Corporation.
|
|
3
|
-
// Licensed under the MIT license.
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.useTeamsFx = void 0;
|
|
6
|
-
var tslib_1 = require("tslib");
|
|
7
|
-
var teamsfx_1 = require("@microsoft/teamsfx");
|
|
8
|
-
var useTeams_1 = require("./useTeams");
|
|
9
|
-
var useData_1 = require("./useData");
|
|
10
|
-
/**
|
|
11
|
-
* Initialize TeamsFx SDK with customized configuration.
|
|
12
|
-
*
|
|
13
|
-
* @param teamsfxConfig - custom configuration to override default ones.
|
|
14
|
-
* @returns TeamsFxContext object
|
|
15
|
-
*
|
|
16
|
-
* @public
|
|
17
|
-
*/
|
|
18
|
-
function useTeamsFx(teamsfxConfig) {
|
|
19
|
-
var _this = this;
|
|
20
|
-
var result = (0, useTeams_1.useTeams)({})[0];
|
|
21
|
-
var _a = (0, useData_1.useData)(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
22
|
-
return tslib_1.__generator(this, function (_a) {
|
|
23
|
-
if (process.env.NODE_ENV === "development") {
|
|
24
|
-
(0, teamsfx_1.setLogLevel)(teamsfx_1.LogLevel.Verbose);
|
|
25
|
-
(0, teamsfx_1.setLogFunction)(function (level, message) {
|
|
26
|
-
console.log(message);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
return [2 /*return*/, new teamsfx_1.TeamsFx(teamsfx_1.IdentityType.User, teamsfxConfig)];
|
|
30
|
-
});
|
|
31
|
-
}); }), data = _a.data, error = _a.error, loading = _a.loading;
|
|
32
|
-
return tslib_1.__assign({ teamsfx: data, error: error, loading: loading }, result);
|
|
33
|
-
}
|
|
34
|
-
exports.useTeamsFx = useTeamsFx;
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
* @public
|
|
40
|
-
*/
|
|
41
|
-
export declare function useTeamsFx(teamsfxConfig?: Record<string, string>): TeamsFxContext;
|
|
42
|
-
//# sourceMappingURL=useTeamsFx.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTeamsFx.d.ts","sourceRoot":"","sources":["../../src/useTeamsFx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,OAAO,EAAgB,MAAM,oBAAoB,CAAC;AAElG,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAGnD,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IAEH,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,cAAc,CAYjF"}
|
package/build/esm/useTeamsFx.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
* @public
|
|
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
|
-
}
|