@microsoft/teamsfx-react 2.0.1-alpha.fc09814f7.0 → 2.0.1-rc.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.
@@ -1,13 +1,13 @@
1
1
  import { Data } from "./useData";
2
- import { TeamsFx, TeamsUserCredential, TeamsUserCredentialAuthConfig } from "@microsoft/teamsfx";
2
+ import { TeamsFx, TeamsUserCredential } from "@microsoft/teamsfx";
3
3
  import { Client } from "@microsoft/microsoft-graph-client";
4
4
  declare type GraphOption = {
5
5
  scope?: string[];
6
6
  teamsfx?: TeamsFx;
7
7
  };
8
- declare type GraphOptionWithAuthConfig = {
8
+ declare type GraphOptionWithCredential = {
9
9
  scope?: string[];
10
- authConfig?: TeamsUserCredentialAuthConfig;
10
+ credential?: TeamsUserCredential;
11
11
  };
12
12
  /**
13
13
  * Helper function to call Microsoft Graph API with authentication.
@@ -28,6 +28,6 @@ export declare function useGraph<T>(fetchGraphDataAsync: (graph: Client, teamsfx
28
28
  *
29
29
  * @beta
30
30
  */
31
- export declare function useGraphWithCredential<T>(fetchGraphDataAsync: (graph: Client, credential: TeamsUserCredential, scope: string[]) => Promise<T>, options?: GraphOptionWithAuthConfig): Data<T>;
31
+ export declare function useGraphWithCredential<T>(fetchGraphDataAsync: (graph: Client, credential: TeamsUserCredential, scope: string[]) => Promise<T>, options?: GraphOptionWithCredential): Data<T>;
32
32
  export {};
33
33
  //# sourceMappingURL=useGraph.d.ts.map
@@ -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,EACL,OAAO,EAGP,mBAAmB,EACnB,6BAA6B,EAE9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAc,MAAM,mCAAmC,CAAC;AAGvE,aAAK,WAAW,GAAG;IACjB,KAAK,CAAC,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mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EACrF,OAAO,CAAC,EAAE,WAAW,GACpB,IAAI,CAAC,CAAC,CAAC,CAkCT;AAED;;;;;;;;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,CAmDT"}
@@ -82,7 +82,7 @@ exports.useGraph = useGraph;
82
82
  function useGraphWithCredential(fetchGraphDataAsync, options) {
83
83
  var _this = this;
84
84
  var credential;
85
- if (!(options === null || options === void 0 ? void 0 : options.authConfig)) {
85
+ if (!(options === null || options === void 0 ? void 0 : options.credential)) {
86
86
  var authConfig = {
87
87
  clientId: process.env.REACT_APP_CLIENT_ID,
88
88
  initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
@@ -90,7 +90,7 @@ function useGraphWithCredential(fetchGraphDataAsync, options) {
90
90
  credential = new teamsfx_1.TeamsUserCredential(authConfig);
91
91
  }
92
92
  else {
93
- credential = new teamsfx_1.TeamsUserCredential(options.authConfig);
93
+ credential = options === null || options === void 0 ? void 0 : options.credential;
94
94
  }
95
95
  var scope;
96
96
  if (!(options === null || options === void 0 ? void 0 : options.scope)) {
@@ -1,13 +1,13 @@
1
1
  import { Data } from "./useData";
2
- import { TeamsFx, TeamsUserCredential, TeamsUserCredentialAuthConfig } from "@microsoft/teamsfx";
2
+ import { TeamsFx, TeamsUserCredential } from "@microsoft/teamsfx";
3
3
  import { Client } from "@microsoft/microsoft-graph-client";
4
4
  declare type GraphOption = {
5
5
  scope?: string[];
6
6
  teamsfx?: TeamsFx;
7
7
  };
8
- declare type GraphOptionWithAuthConfig = {
8
+ declare type GraphOptionWithCredential = {
9
9
  scope?: string[];
10
- authConfig?: TeamsUserCredentialAuthConfig;
10
+ credential?: TeamsUserCredential;
11
11
  };
12
12
  /**
13
13
  * Helper function to call Microsoft Graph API with authentication.
@@ -28,6 +28,6 @@ export declare function useGraph<T>(fetchGraphDataAsync: (graph: Client, teamsfx
28
28
  *
29
29
  * @beta
30
30
  */
31
- export declare function useGraphWithCredential<T>(fetchGraphDataAsync: (graph: Client, credential: TeamsUserCredential, scope: string[]) => Promise<T>, options?: GraphOptionWithAuthConfig): Data<T>;
31
+ export declare function useGraphWithCredential<T>(fetchGraphDataAsync: (graph: Client, credential: TeamsUserCredential, scope: string[]) => Promise<T>, options?: GraphOptionWithCredential): Data<T>;
32
32
  export {};
33
33
  //# sourceMappingURL=useGraph.d.ts.map
@@ -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,EACL,OAAO,EAGP,mBAAmB,EACnB,6BAA6B,EAE9B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,MAAM,EAAc,MAAM,mCAAmC,CAAC;AAGvE,aAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,aAAK,yBAAyB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,UAAU,CAAC,EAAE,6BAA6B,CAAC;CAC5C,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,mBAAmB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EACrF,OAAO,CAA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EAAE,yBAAyB,GAClC,IAAI,CAAC,CAAC,CAAC,CAmDT"}
@@ -78,7 +78,7 @@ export function useGraph(fetchGraphDataAsync, options) {
78
78
  export function useGraphWithCredential(fetchGraphDataAsync, options) {
79
79
  var _this = this;
80
80
  var credential;
81
- if (!(options === null || options === void 0 ? void 0 : options.authConfig)) {
81
+ if (!(options === null || options === void 0 ? void 0 : options.credential)) {
82
82
  var authConfig = {
83
83
  clientId: process.env.REACT_APP_CLIENT_ID,
84
84
  initiateLoginEndpoint: process.env.REACT_APP_START_LOGIN_PAGE_URL,
@@ -86,7 +86,7 @@ export function useGraphWithCredential(fetchGraphDataAsync, options) {
86
86
  credential = new TeamsUserCredential(authConfig);
87
87
  }
88
88
  else {
89
- credential = new TeamsUserCredential(options.authConfig);
89
+ credential = options === null || options === void 0 ? void 0 : options.credential;
90
90
  }
91
91
  var scope;
92
92
  if (!(options === null || options === void 0 ? void 0 : options.scope)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/teamsfx-react",
3
- "version": "2.0.1-alpha.fc09814f7.0",
3
+ "version": "2.0.1-rc.1",
4
4
  "description": "React helper functions for Microsoft TeamsFx",
5
5
  "main": "build/cjs/index.js",
6
6
  "module": "build/esm/index.js",
@@ -32,7 +32,7 @@
32
32
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
33
33
  "@microsoft/microsoft-graph-client": "^3.0.1",
34
34
  "@microsoft/teams-js": "^2.0.0",
35
- "@microsoft/teamsfx": "2.0.1-alpha.fc09814f7.0",
35
+ "@microsoft/teamsfx": "^2.0.1-rc.0",
36
36
  "@testing-library/react": "^12.1.1",
37
37
  "@testing-library/react-hooks": "^7.0.2",
38
38
  "@types/enzyme": "^3.10.10",
@@ -84,5 +84,5 @@
84
84
  "npx eslint --cache --fix --quiet"
85
85
  ]
86
86
  },
87
- "gitHead": "ba40c91d9e076fb5d34f808b1b2fb36a072f5b9c"
87
+ "gitHead": "fc686592b3322d06a6a34727022b09e4355bde59"
88
88
  }