@itwin/one-click-lca-react 0.6.0 → 0.7.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/README.md +2 -1
- package/lib/cjs/components/api/OCLCAApiHelper.d.ts +1 -0
- package/lib/cjs/components/api/OCLCAApiHelper.js +3 -0
- package/lib/cjs/components/api/OCLCAApiHelper.js.map +1 -1
- package/lib/esm/components/api/OCLCAApiHelper.d.ts +1 -0
- package/lib/esm/components/api/OCLCAApiHelper.js +3 -0
- package/lib/esm/components/api/OCLCAApiHelper.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ This package provides a viewer _widget_. Documentation on how to add a widget to
|
|
|
13
13
|
|
|
14
14
|
## Permissions and Scopes
|
|
15
15
|
|
|
16
|
-
The SPA client used by your iTwin viewer
|
|
16
|
+
The SPA client used by your iTwin viewer must have the `itwin-platform` scope.
|
|
17
|
+
|
|
17
18
|
Users must have the `imodels_read` and `insights_view` [permissions](https://developer.bentley.com/apis/carbon-calculation/operations/create-oneclicklca-job/#authorization) assigned at either the Project or iModel level. Additional instruction on how to create roles and assign permissions can be found in the [iTwin Platform Projects API documentation](https://developer.bentley.com/apis/projects/tutorials/).
|
|
18
19
|
|
|
19
20
|
## Sample usage
|
|
@@ -4,6 +4,7 @@ import { OperationsBase } from "@itwin/insights-client";
|
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export declare class OCLCAApiHelper extends OperationsBase {
|
|
7
|
+
constructor();
|
|
7
8
|
getOCLCAAccessToken(username: string, apiPassword: string): Promise<OCLCALoginResponse | undefined>;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=OCLCAApiHelper.d.ts.map
|
|
@@ -6,6 +6,9 @@ const insights_client_1 = require("@itwin/insights-client");
|
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
class OCLCAApiHelper extends insights_client_1.OperationsBase {
|
|
9
|
+
constructor() {
|
|
10
|
+
super("https://oneclicklcaapp.com/app/api");
|
|
11
|
+
}
|
|
9
12
|
async getOCLCAAccessToken(username, apiPassword) {
|
|
10
13
|
if (username === undefined || apiPassword === undefined) {
|
|
11
14
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OCLCAApiHelper.js","sourceRoot":"","sources":["../../../../src/components/api/OCLCAApiHelper.ts"],"names":[],"mappings":";;;AAKA,4DAAwD;AAExD;;GAEG;AACH,MAAa,cAAe,SAAQ,gCAAc;
|
|
1
|
+
{"version":3,"file":"OCLCAApiHelper.js","sourceRoot":"","sources":["../../../../src/components/api/OCLCAApiHelper.ts"],"names":[],"mappings":";;;AAKA,4DAAwD;AAExD;;GAEG;AACH,MAAa,cAAe,SAAQ,gCAAc;IAChD;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,QAAgB,EAAE,WAAmB;QACpE,IAAI,QAAQ,KAAK,SAAS,IAAI,WAAW,KAAK,SAAS,EAAE;YACvD,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,cAAc,GAAgB;YAClC,MAAM,EAAE,MAAM;SACf,CAAC;QACF,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YACnC,QAAQ;YACR,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,0CAA0C,CAAC;QACvD,OAAO,IAAI,CAAC,SAAS,CAAqB,GAAG,EAAE,cAAc,CAAC,CAAC;IACjE,CAAC;CACF;AAnBD,wCAmBC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { OCLCALoginResponse} from \"@itwin/insights-client\";\nimport { OperationsBase } from \"@itwin/insights-client\";\n\n/**\n * @internal\n */\nexport class OCLCAApiHelper extends OperationsBase {\n constructor() {\n super(\"https://oneclicklcaapp.com/app/api\");\n }\n\n public async getOCLCAAccessToken(username: string, apiPassword: string) {\n if (username === undefined || apiPassword === undefined) {\n return undefined;\n }\n const requestOptions: RequestInit = {\n method: \"POST\",\n };\n requestOptions.body = JSON.stringify({\n username,\n password: apiPassword,\n });\n const url = `https://oneclicklcaapp.com/app/api/login`;\n return this.fetchJSON<OCLCALoginResponse>(url, requestOptions);\n }\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { OperationsBase } from "@itwin/insights-client";
|
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
6
6
|
export declare class OCLCAApiHelper extends OperationsBase {
|
|
7
|
+
constructor();
|
|
7
8
|
getOCLCAAccessToken(username: string, apiPassword: string): Promise<OCLCALoginResponse | undefined>;
|
|
8
9
|
}
|
|
9
10
|
//# sourceMappingURL=OCLCAApiHelper.d.ts.map
|
|
@@ -3,6 +3,9 @@ import { OperationsBase } from "@itwin/insights-client";
|
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
5
5
|
export class OCLCAApiHelper extends OperationsBase {
|
|
6
|
+
constructor() {
|
|
7
|
+
super("https://oneclicklcaapp.com/app/api");
|
|
8
|
+
}
|
|
6
9
|
async getOCLCAAccessToken(username, apiPassword) {
|
|
7
10
|
if (username === undefined || apiPassword === undefined) {
|
|
8
11
|
return undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OCLCAApiHelper.js","sourceRoot":"","sources":["../../../../src/components/api/OCLCAApiHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,cAAc;
|
|
1
|
+
{"version":3,"file":"OCLCAApiHelper.js","sourceRoot":"","sources":["../../../../src/components/api/OCLCAApiHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,cAAc;IAChD;QACE,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,QAAgB,EAAE,WAAmB;QACpE,IAAI,QAAQ,KAAK,SAAS,IAAI,WAAW,KAAK,SAAS,EAAE;YACvD,OAAO,SAAS,CAAC;SAClB;QACD,MAAM,cAAc,GAAgB;YAClC,MAAM,EAAE,MAAM;SACf,CAAC;QACF,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YACnC,QAAQ;YACR,QAAQ,EAAE,WAAW;SACtB,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,0CAA0C,CAAC;QACvD,OAAO,IAAI,CAAC,SAAS,CAAqB,GAAG,EAAE,cAAc,CAAC,CAAC;IACjE,CAAC;CACF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\nimport type { OCLCALoginResponse} from \"@itwin/insights-client\";\nimport { OperationsBase } from \"@itwin/insights-client\";\n\n/**\n * @internal\n */\nexport class OCLCAApiHelper extends OperationsBase {\n constructor() {\n super(\"https://oneclicklcaapp.com/app/api\");\n }\n\n public async getOCLCAAccessToken(username: string, apiPassword: string) {\n if (username === undefined || apiPassword === undefined) {\n return undefined;\n }\n const requestOptions: RequestInit = {\n method: \"POST\",\n };\n requestOptions.body = JSON.stringify({\n username,\n password: apiPassword,\n });\n const url = `https://oneclicklcaapp.com/app/api/login`;\n return this.fetchJSON<OCLCALoginResponse>(url, requestOptions);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/one-click-lca-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "An iTwin.js 3D Viewer Widget that interfaces with the iTwin Carbon Calculation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"cover": "nyc npm test"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@itwin/insights-client": "^0.
|
|
41
|
+
"@itwin/insights-client": "^0.15.1",
|
|
42
42
|
"@itwin/itwinui-icons-react": "^2.2.0",
|
|
43
43
|
"@itwin/itwinui-react": "^2.11.2"
|
|
44
44
|
},
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@itwin/appui-react": "^4.0.0",
|
|
99
99
|
"@itwin/core-frontend": "^4.0.0",
|
|
100
100
|
"@itwin/core-react": "^4.0.0",
|
|
101
|
-
"react": "^17.0.2",
|
|
102
|
-
"react-dom": "^17.0.2"
|
|
101
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
102
|
+
"react-dom": "^17.0.2 || ^18.0.0"
|
|
103
103
|
},
|
|
104
104
|
"nyc": {
|
|
105
105
|
"nycrc-path": "./node_modules/@itwin/build-tools/.nycrc",
|