@looker/extension-utils 0.1.20-alpha.1648 → 0.1.20
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/CHANGELOG.md +17 -0
- package/lib/APIErrorDisplay/APIErrorContent.js +0 -15
- package/lib/APIErrorDisplay/APIErrorContent.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDetails.js +0 -5
- package/lib/APIErrorDisplay/APIErrorDetails.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDialog.js +0 -7
- package/lib/APIErrorDisplay/APIErrorDialog.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDisplay.js +0 -7
- package/lib/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDocLink.js +0 -8
- package/lib/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
- package/lib/APIErrorDisplay/index.js +0 -5
- package/lib/APIErrorDisplay/index.js.map +1 -1
- package/lib/APIErrorDisplay/utils.js +1 -10
- package/lib/APIErrorDisplay/utils.js.map +1 -1
- package/lib/ExtMarkdown.js +0 -8
- package/lib/ExtMarkdown.js.map +1 -1
- package/lib/OAuthScene.js +0 -14
- package/lib/OAuthScene.js.map +1 -1
- package/lib/adaptorUtils.js +1 -17
- package/lib/adaptorUtils.js.map +1 -1
- package/lib/authUtils.js +5 -23
- package/lib/authUtils.js.map +1 -1
- package/lib/browserAdaptor.js +4 -26
- package/lib/browserAdaptor.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorContent.js +25 -20
- package/lib/esm/APIErrorDisplay/APIErrorContent.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDetails.js +21 -13
- package/lib/esm/APIErrorDisplay/APIErrorDetails.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDialog.js +18 -10
- package/lib/esm/APIErrorDisplay/APIErrorDialog.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDisplay.js +15 -7
- package/lib/esm/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDocLink.js +15 -9
- package/lib/esm/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
- package/lib/esm/APIErrorDisplay/index.js +39 -3
- package/lib/esm/APIErrorDisplay/index.js.map +1 -1
- package/lib/esm/APIErrorDisplay/utils.js +10 -7
- package/lib/esm/APIErrorDisplay/utils.js.map +1 -1
- package/lib/esm/ExtMarkdown.js +14 -8
- package/lib/esm/ExtMarkdown.js.map +1 -1
- package/lib/esm/OAuthScene.js +23 -20
- package/lib/esm/OAuthScene.js.map +1 -1
- package/lib/esm/adaptorUtils.js +22 -10
- package/lib/esm/adaptorUtils.js.map +1 -1
- package/lib/esm/authUtils.js +14 -22
- package/lib/esm/authUtils.js.map +1 -1
- package/lib/esm/browserAdaptor.js +15 -24
- package/lib/esm/browserAdaptor.js.map +1 -1
- package/lib/esm/extensionAdaptor.js +15 -26
- package/lib/esm/extensionAdaptor.js.map +1 -1
- package/lib/esm/index.js +82 -7
- package/lib/esm/index.js.map +1 -1
- package/lib/extensionAdaptor.js +4 -28
- package/lib/extensionAdaptor.js.map +1 -1
- package/lib/index.js +0 -14
- package/lib/index.js.map +1 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.20](https://github.com/looker-open-source/sdk-codegen/compare/extension-utils-v0.1.19...extension-utils-v0.1.20) (2023-02-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* keep all body parameters toggle in API Explorer requests ([#1245](https://github.com/looker-open-source/sdk-codegen/issues/1245)) ([043ed3f](https://github.com/looker-open-source/sdk-codegen/commit/043ed3ff12cba4f821604b5b668d7301ed4aa6d1))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @looker/extension-sdk bumped from ^22.20.1 to ^23.0.0
|
|
16
|
+
* @looker/extension-sdk-react bumped from ^22.20.1 to ^23.0.0
|
|
17
|
+
* @looker/sdk-rtl bumped from ^21.5.0 to ^21.6.0
|
|
18
|
+
* @looker/code-editor bumped from ^0.1.27 to ^0.1.28
|
|
19
|
+
|
|
3
20
|
### [0.1.19](https://www.github.com/looker-open-source/sdk-codegen/compare/extension-utils-v0.1.18...extension-utils-v0.1.19) (2022-12-09)
|
|
4
21
|
|
|
5
22
|
|
|
@@ -4,32 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APIErrorContent = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _sdkRtl = require("@looker/sdk-rtl");
|
|
11
|
-
|
|
12
9
|
var _adaptorUtils = require("../adaptorUtils");
|
|
13
|
-
|
|
14
10
|
var _ExtMarkdown = require("../ExtMarkdown");
|
|
15
|
-
|
|
16
11
|
var _APIErrorDetails = require("./APIErrorDetails");
|
|
17
|
-
|
|
18
12
|
var _APIErrorDocLink = require("./APIErrorDocLink");
|
|
19
|
-
|
|
20
13
|
var _utils = require("./utils");
|
|
21
|
-
|
|
22
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
|
-
|
|
24
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
-
|
|
26
16
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
27
|
-
|
|
28
17
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
29
|
-
|
|
30
18
|
var APIErrorContent = _ref => {
|
|
31
19
|
var _error$documentation_;
|
|
32
|
-
|
|
33
20
|
var {
|
|
34
21
|
error,
|
|
35
22
|
showDoc
|
|
@@ -41,7 +28,6 @@ var APIErrorContent = _ref => {
|
|
|
41
28
|
var errDoc = new _sdkRtl.ErrorDoc(adaptor.sdk, _utils.apiErrorDisplayFetch);
|
|
42
29
|
setDoc(yield errDoc.content(docUrl));
|
|
43
30
|
});
|
|
44
|
-
|
|
45
31
|
return function (_x) {
|
|
46
32
|
return _ref2.apply(this, arguments);
|
|
47
33
|
};
|
|
@@ -59,6 +45,5 @@ var APIErrorContent = _ref => {
|
|
|
59
45
|
source: doc
|
|
60
46
|
}));
|
|
61
47
|
};
|
|
62
|
-
|
|
63
48
|
exports.APIErrorContent = APIErrorContent;
|
|
64
49
|
//# sourceMappingURL=APIErrorContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"APIErrorContent.js","names":["APIErrorContent","error","showDoc","doc","setDoc","useState","getDoc","useCallback","docUrl","adaptor","getEnvAdaptor","errDoc","ErrorDoc","sdk","apiErrorDisplayFetch","content","useEffect","documentation_url"],"sources":["../../src/APIErrorDisplay/APIErrorContent.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { ErrorDoc } from '@looker/sdk-rtl'\nimport { getEnvAdaptor } from '../adaptorUtils'\nimport { ExtMarkdown } from '../ExtMarkdown'\nimport { APIErrorDetails } from './APIErrorDetails'\nimport { APIErrorDocLink } from './APIErrorDocLink'\nimport type { APIErrorDisplayProps } from './APIErrorDisplay'\nimport { apiErrorDisplayFetch } from './utils'\n\n/**\n * Shows available content of an API Error response\n * @param error to display\n * @param showDoc true to retrieve the corresponding error markdown\n */\nexport const APIErrorContent = ({ error, showDoc }: APIErrorDisplayProps) => {\n const [doc, setDoc] = useState<string>('')\n const getDoc = useCallback(\n async (docUrl: string) => {\n const adaptor = getEnvAdaptor()\n const errDoc = new ErrorDoc(adaptor.sdk, apiErrorDisplayFetch)\n setDoc(await errDoc.content(docUrl))\n },\n [error]\n )\n\n useEffect(() => {\n if (showDoc && error && error.documentation_url) {\n getDoc(error.documentation_url)\n }\n }, [error, showDoc])\n\n return (\n <>\n <APIErrorDetails error={error} />\n {!showDoc && <APIErrorDocLink docUrl={error.documentation_url ?? ''} />}\n {showDoc && doc && <ExtMarkdown source={doc} />}\n </>\n )\n}\n"],"mappings":";;;;;;AA0BA;AACA;AACA;AACA;AACA;AACA;AAEA;AAA8C;AAAA;AAAA;AAAA;AAOvC,IAAMA,eAAe,GAAG,QAA8C;EAAA;EAAA,IAA7C;IAAEC,KAAK;IAAEC;EAA8B,CAAC;EACtE,IAAM,CAACC,GAAG,EAAEC,MAAM,CAAC,GAAG,IAAAC,eAAQ,EAAS,EAAE,CAAC;EAC1C,IAAMC,MAAM,GAAG,IAAAC,kBAAW;IAAA,8BACxB,WAAOC,MAAc,EAAK;MACxB,IAAMC,OAAO,GAAG,IAAAC,2BAAa,GAAE;MAC/B,IAAMC,MAAM,GAAG,IAAIC,gBAAQ,CAACH,OAAO,CAACI,GAAG,EAAEC,2BAAoB,CAAC;MAC9DV,MAAM,OAAOO,MAAM,CAACI,OAAO,CAACP,MAAM,CAAC,CAAC;IACtC,CAAC;IAAA;MAAA;IAAA;EAAA,KACD,CAACP,KAAK,CAAC,CACR;EAED,IAAAe,gBAAS,EAAC,MAAM;IACd,IAAId,OAAO,IAAID,KAAK,IAAIA,KAAK,CAACgB,iBAAiB,EAAE;MAC/CX,MAAM,CAACL,KAAK,CAACgB,iBAAiB,CAAC;IACjC;EACF,CAAC,EAAE,CAAChB,KAAK,EAAEC,OAAO,CAAC,CAAC;EAEpB,OACE,4DACE,6BAAC,gCAAe;IAAC,KAAK,EAAED;EAAM,EAAG,EAChC,CAACC,OAAO,IAAI,6BAAC,gCAAe;IAAC,MAAM,2BAAED,KAAK,CAACgB,iBAAiB,yEAAI;EAAG,EAAG,EACtEf,OAAO,IAAIC,GAAG,IAAI,6BAAC,wBAAW;IAAC,MAAM,EAAEA;EAAI,EAAG,CAC9C;AAEP,CAAC;AAAA"}
|
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APIErrorDetails = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _components = require("@looker/components");
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
14
10
|
var APIErrorDetails = _ref => {
|
|
15
11
|
var {
|
|
16
12
|
error
|
|
@@ -39,6 +35,5 @@ var APIErrorDetails = _ref => {
|
|
|
39
35
|
}, _react.default.createElement(_components.Span, null, message)));
|
|
40
36
|
})));
|
|
41
37
|
};
|
|
42
|
-
|
|
43
38
|
exports.APIErrorDetails = APIErrorDetails;
|
|
44
39
|
//# sourceMappingURL=APIErrorDetails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"APIErrorDetails.js","names":["APIErrorDetails","error","errors","map","index","field","code","message"],"sources":["../../src/APIErrorDisplay/APIErrorDetails.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { LookerSDKError } from '@looker/sdk-rtl'\nimport React from 'react'\nimport {\n Span,\n Table,\n TableBody,\n TableDataCell,\n TableHead,\n TableHeaderCell,\n TableRow,\n} from '@looker/components'\n\ninterface APIErrorDetailsProps {\n error: LookerSDKError\n}\n\n/**\n * Shows the detailed API errors table\n *\n * Because documentation_url is currently identical with the main documentation_url\n * it is not included in the table\n *\n * @param error to display\n */\nexport const APIErrorDetails = ({ error }: APIErrorDetailsProps) => {\n if (!error?.errors) return <></>\n\n return (\n <Table>\n <TableHead>\n <TableRow>\n <TableHeaderCell p=\"xsmall\">Field</TableHeaderCell>\n <TableHeaderCell p=\"xsmall\">Code</TableHeaderCell>\n <TableHeaderCell p=\"xsmall\">Message</TableHeaderCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {error.errors.map(({ field, code, message }, index) => (\n <TableRow key={`${field}${index}`}>\n <TableDataCell p=\"xsmall\">{field}</TableDataCell>\n <TableDataCell p=\"xsmall\">{code}</TableDataCell>\n <TableDataCell p=\"xsmall\">\n <Span>{message}</Span>\n </TableDataCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n )\n}\n"],"mappings":";;;;;;AA2BA;AACA;AAQ2B;AAcpB,IAAMA,eAAe,GAAG,QAAqC;EAAA,IAApC;IAAEC;EAA4B,CAAC;EAC7D,IAAI,EAACA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,MAAM,GAAE,OAAO,2DAAK;EAEhC,OACE,6BAAC,iBAAK,QACJ,6BAAC,qBAAS,QACR,6BAAC,oBAAQ,QACP,6BAAC,2BAAe;IAAC,CAAC,EAAC;EAAQ,GAAC,OAAK,CAAkB,EACnD,6BAAC,2BAAe;IAAC,CAAC,EAAC;EAAQ,GAAC,MAAI,CAAkB,EAClD,6BAAC,2BAAe;IAAC,CAAC,EAAC;EAAQ,GAAC,SAAO,CAAkB,CAC5C,CACD,EACZ,6BAAC,qBAAS,QACPD,KAAK,CAACC,MAAM,CAACC,GAAG,CAAC,QAA2BC,KAAK;IAAA,IAA/B;MAAEC,KAAK;MAAEC,IAAI;MAAEC;IAAQ,CAAC;IAAA,OACzC,6BAAC,oBAAQ;MAAC,GAAG,YAAKF,KAAK,SAAGD,KAAK;IAAG,GAChC,6BAAC,yBAAa;MAAC,CAAC,EAAC;IAAQ,GAAEC,KAAK,CAAiB,EACjD,6BAAC,yBAAa;MAAC,CAAC,EAAC;IAAQ,GAAEC,IAAI,CAAiB,EAChD,6BAAC,yBAAa;MAAC,CAAC,EAAC;IAAQ,GACvB,6BAAC,gBAAI,QAAEC,OAAO,CAAQ,CACR,CACP;EAAA,CACZ,CAAC,CACQ,CACN;AAEZ,CAAC;AAAA"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APIErrorDialog = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _components = require("@looker/components");
|
|
11
|
-
|
|
12
9
|
var _APIErrorContent = require("./APIErrorContent");
|
|
13
|
-
|
|
14
10
|
var _utils = require("./utils");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
var APIErrorDialog = _ref => {
|
|
19
13
|
var {
|
|
20
14
|
error,
|
|
@@ -36,6 +30,5 @@ var APIErrorDialog = _ref => {
|
|
|
36
30
|
}))
|
|
37
31
|
});
|
|
38
32
|
};
|
|
39
|
-
|
|
40
33
|
exports.APIErrorDialog = APIErrorDialog;
|
|
41
34
|
//# sourceMappingURL=APIErrorDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"APIErrorDialog.js","names":["APIErrorDialog","error","isOpen","setOpen","showDoc","errorHeading"],"sources":["../../src/APIErrorDisplay/APIErrorDialog.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React from 'react'\nimport { Button, Dialog, DialogLayout } from '@looker/components'\nimport type { APIErrorDisplayProps } from './APIErrorDisplay'\nimport { APIErrorContent } from './APIErrorContent'\nimport { errorHeading } from './utils'\n\ninterface APIErrorDialogProps extends APIErrorDisplayProps {\n /** toggle for dialog being open */\n isOpen: boolean\n /** callback for toggling the dialog display */\n setOpen: (open: boolean) => void\n}\n\nexport const APIErrorDialog = ({\n error,\n isOpen,\n setOpen,\n showDoc = false,\n}: APIErrorDialogProps) => (\n <Dialog\n isOpen={isOpen}\n content={\n <DialogLayout\n header={errorHeading(error)}\n footer={\n <Button size=\"xsmall\" onClick={() => setOpen && setOpen(false)}>\n OK\n </Button>\n }\n >\n <APIErrorContent error={error} showDoc={showDoc} />\n </DialogLayout>\n }\n />\n)\n"],"mappings":";;;;;;AA0BA;AACA;AAEA;AACA;AAAsC;AAS/B,IAAMA,cAAc,GAAG;EAAA,IAAC;IAC7BC,KAAK;IACLC,MAAM;IACNC,OAAO;IACPC,OAAO,GAAG;EACS,CAAC;EAAA,OACpB,6BAAC,kBAAM;IACL,MAAM,EAAEF,MAAO;IACf,OAAO,EACL,6BAAC,wBAAY;MACX,MAAM,EAAE,IAAAG,mBAAY,EAACJ,KAAK,CAAE;MAC5B,MAAM,EACJ,6BAAC,kBAAM;QAAC,IAAI,EAAC,QAAQ;QAAC,OAAO,EAAE,MAAME,OAAO,IAAIA,OAAO,CAAC,KAAK;MAAE,GAAC,IAEhE;IACD,GAED,6BAAC,gCAAe;MAAC,KAAK,EAAEF,KAAM;MAAC,OAAO,EAAEG;IAAQ,EAAG;EAEtD,EACD;AAAA,CACH;AAAA"}
|
|
@@ -4,17 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APIErrorDisplay = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _components = require("@looker/components");
|
|
11
|
-
|
|
12
9
|
var _APIErrorContent = require("./APIErrorContent");
|
|
13
|
-
|
|
14
10
|
var _utils = require("./utils");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
var APIErrorDisplay = _ref => {
|
|
19
13
|
var {
|
|
20
14
|
error,
|
|
@@ -27,6 +21,5 @@ var APIErrorDisplay = _ref => {
|
|
|
27
21
|
showDoc: showDoc
|
|
28
22
|
})));
|
|
29
23
|
};
|
|
30
|
-
|
|
31
24
|
exports.APIErrorDisplay = APIErrorDisplay;
|
|
32
25
|
//# sourceMappingURL=APIErrorDisplay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"APIErrorDisplay.js","names":["APIErrorDisplay","error","showDoc","errorHeading"],"sources":["../../src/APIErrorDisplay/APIErrorDisplay.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React from 'react'\nimport type { LookerSDKError } from '@looker/sdk-rtl'\nimport { Heading, SpaceVertical } from '@looker/components'\nimport { APIErrorContent } from './APIErrorContent'\nimport { errorHeading } from './utils'\n\nexport interface APIErrorDisplayProps {\n /** Populated SDK error information, which may contain detailed errors */\n error: LookerSDKError\n /** true to retrieve the markdown error document from the CDN and display it instead of a link */\n showDoc?: boolean\n}\n\n/**\n * Show API error information in the parent React component\n * @param error to display\n * @param showDoc true to fetch the error document markdown. false for a clickable link\n */\nexport const APIErrorDisplay = ({\n error,\n showDoc = false,\n}: APIErrorDisplayProps) => {\n return (\n <>\n {error && (\n <SpaceVertical>\n <Heading type=\"h2\">{errorHeading(error)}</Heading>\n <APIErrorContent error={error} showDoc={showDoc} />\n </SpaceVertical>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;AA0BA;AAEA;AACA;AACA;AAAsC;AAc/B,IAAMA,eAAe,GAAG,QAGH;EAAA,IAHI;IAC9BC,KAAK;IACLC,OAAO,GAAG;EACU,CAAC;EACrB,OACE,4DACGD,KAAK,IACJ,6BAAC,yBAAa,QACZ,6BAAC,mBAAO;IAAC,IAAI,EAAC;EAAI,GAAE,IAAAE,mBAAY,EAACF,KAAK,CAAC,CAAW,EAClD,6BAAC,gCAAe;IAAC,KAAK,EAAEA,KAAM;IAAC,OAAO,EAAEC;EAAQ,EAAG,CAEtD,CACA;AAEP,CAAC;AAAA"}
|
|
@@ -4,26 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.APIErrorDocLink = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _components = require("@looker/components");
|
|
11
|
-
|
|
12
9
|
var _adaptorUtils = require("../adaptorUtils");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
var APIErrorDocLink = _ref => {
|
|
17
12
|
var {
|
|
18
13
|
docUrl
|
|
19
14
|
} = _ref;
|
|
20
|
-
|
|
21
15
|
var onClick = e => {
|
|
22
16
|
e.preventDefault();
|
|
23
17
|
var adaptor = (0, _adaptorUtils.getEnvAdaptor)();
|
|
24
18
|
adaptor.openBrowserWindow(e.currentTarget.href);
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
if (!docUrl) return _react.default.createElement(_react.default.Fragment, null);
|
|
28
21
|
return _react.default.createElement(_components.Link, {
|
|
29
22
|
href: docUrl,
|
|
@@ -31,6 +24,5 @@ var APIErrorDocLink = _ref => {
|
|
|
31
24
|
onClick: onClick
|
|
32
25
|
}, "More information");
|
|
33
26
|
};
|
|
34
|
-
|
|
35
27
|
exports.APIErrorDocLink = APIErrorDocLink;
|
|
36
28
|
//# sourceMappingURL=APIErrorDocLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"APIErrorDocLink.js","names":["APIErrorDocLink","docUrl","onClick","e","preventDefault","adaptor","getEnvAdaptor","openBrowserWindow","currentTarget","href"],"sources":["../../src/APIErrorDisplay/APIErrorDocLink.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport React from 'react'\nimport { Link } from '@looker/components'\nimport { getEnvAdaptor } from '../adaptorUtils'\n\ninterface APIErrorDocLinkProps {\n docUrl?: string\n}\n\nexport const APIErrorDocLink = ({ docUrl }: APIErrorDocLinkProps) => {\n const onClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault()\n const adaptor = getEnvAdaptor()\n adaptor.openBrowserWindow(e.currentTarget.href)\n }\n\n if (!docUrl) return <></>\n return (\n <Link href={docUrl} key={docUrl} onClick={onClick}>\n More information\n </Link>\n )\n}\n"],"mappings":";;;;;;AA0BA;AACA;AACA;AAA+C;AAMxC,IAAMA,eAAe,GAAG,QAAsC;EAAA,IAArC;IAAEC;EAA6B,CAAC;EAC9D,IAAMC,OAAO,GAAIC,CAAsC,IAAK;IAC1DA,CAAC,CAACC,cAAc,EAAE;IAClB,IAAMC,OAAO,GAAG,IAAAC,2BAAa,GAAE;IAC/BD,OAAO,CAACE,iBAAiB,CAACJ,CAAC,CAACK,aAAa,CAACC,IAAI,CAAC;EACjD,CAAC;EAED,IAAI,CAACR,MAAM,EAAE,OAAO,2DAAK;EACzB,OACE,6BAAC,gBAAI;IAAC,IAAI,EAAEA,MAAO;IAAC,GAAG,EAAEA,MAAO;IAAC,OAAO,EAAEC;EAAQ,GAAC,kBAEnD,CAAO;AAEX,CAAC;AAAA"}
|
|
@@ -12,9 +12,7 @@ Object.defineProperty(exports, "apiErrorDisplayFetch", {
|
|
|
12
12
|
return _utils.apiErrorDisplayFetch;
|
|
13
13
|
}
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var _APIErrorDialog = require("./APIErrorDialog");
|
|
17
|
-
|
|
18
16
|
Object.keys(_APIErrorDialog).forEach(function (key) {
|
|
19
17
|
if (key === "default" || key === "__esModule") return;
|
|
20
18
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -26,9 +24,7 @@ Object.keys(_APIErrorDialog).forEach(function (key) {
|
|
|
26
24
|
}
|
|
27
25
|
});
|
|
28
26
|
});
|
|
29
|
-
|
|
30
27
|
var _APIErrorDisplay = require("./APIErrorDisplay");
|
|
31
|
-
|
|
32
28
|
Object.keys(_APIErrorDisplay).forEach(function (key) {
|
|
33
29
|
if (key === "default" || key === "__esModule") return;
|
|
34
30
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
@@ -40,6 +36,5 @@ Object.keys(_APIErrorDisplay).forEach(function (key) {
|
|
|
40
36
|
}
|
|
41
37
|
});
|
|
42
38
|
});
|
|
43
|
-
|
|
44
39
|
var _utils = require("./utils");
|
|
45
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/APIErrorDisplay/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nexport * from './APIErrorDialog'\nexport * from './APIErrorDisplay'\nexport { apiErrorDisplayFetch } from './utils'\n"],"mappings":";;;;;;;;;;;;;;AA0BA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA"}
|
|
@@ -3,16 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.errorHeading = exports.apiErrorDisplayFetch = void 0;
|
|
8
7
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
|
|
10
8
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
-
|
|
12
9
|
var errorHeading = error => error.message || 'Unknown error';
|
|
13
|
-
|
|
14
10
|
exports.errorHeading = errorHeading;
|
|
15
|
-
|
|
16
11
|
var apiErrorDisplayFetch = function () {
|
|
17
12
|
var _ref = _asyncToGenerator(function* (_sdk, url) {
|
|
18
13
|
var fetched = yield fetch(url, {
|
|
@@ -20,18 +15,14 @@ var apiErrorDisplayFetch = function () {
|
|
|
20
15
|
});
|
|
21
16
|
var result = yield fetched.text();
|
|
22
17
|
var stop = result.indexOf('## API Response Type');
|
|
23
|
-
|
|
24
18
|
if (stop > 0) {
|
|
25
19
|
result = result.substring(0, stop - 1).trim();
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
return result;
|
|
29
22
|
});
|
|
30
|
-
|
|
31
23
|
return function apiErrorDisplayFetch(_x, _x2) {
|
|
32
24
|
return _ref.apply(this, arguments);
|
|
33
25
|
};
|
|
34
26
|
}();
|
|
35
|
-
|
|
36
27
|
exports.apiErrorDisplayFetch = apiErrorDisplayFetch;
|
|
37
28
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"utils.js","names":["errorHeading","error","message","apiErrorDisplayFetch","_sdk","url","fetched","fetch","mode","result","text","stop","indexOf","substring","trim"],"sources":["../../src/APIErrorDisplay/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2022 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { LookerSDKError, IAPIMethods } from '@looker/sdk-rtl'\n\n/**\n * Default the heading to 'Unknown error' if error.message is blank for any reason\n * @param error for heading\n */\nexport const errorHeading = (error: LookerSDKError) =>\n error.message || 'Unknown error'\n\n/**\n * this callback function used by the ErrorDoc constructor gets and truncates\n * API error documents for use within API Explorer\n * @param _sdk required as a parameter, but it's ignored in this function\n * @param url of document (either index.json or md) to fetch\n */\nexport const apiErrorDisplayFetch = async (_sdk: IAPIMethods, url: string) => {\n const fetched = await fetch(url, { mode: 'cors' })\n let result = await fetched.text()\n const stop = result.indexOf('## API Response Type')\n if (stop > 0) {\n result = result.substring(0, stop - 1).trim()\n }\n return result\n}\n"],"mappings":";;;;;;;;AAgCO,IAAMA,YAAY,GAAIC,KAAqB,IAChDA,KAAK,CAACC,OAAO,IAAI,eAAe;AAAA;AAQ3B,IAAMC,oBAAoB;EAAA,6BAAG,WAAOC,IAAiB,EAAEC,GAAW,EAAK;IAC5E,IAAMC,OAAO,SAASC,KAAK,CAACF,GAAG,EAAE;MAAEG,IAAI,EAAE;IAAO,CAAC,CAAC;IAClD,IAAIC,MAAM,SAASH,OAAO,CAACI,IAAI,EAAE;IACjC,IAAMC,IAAI,GAAGF,MAAM,CAACG,OAAO,CAAC,sBAAsB,CAAC;IACnD,IAAID,IAAI,GAAG,CAAC,EAAE;MACZF,MAAM,GAAGA,MAAM,CAACI,SAAS,CAAC,CAAC,EAAEF,IAAI,GAAG,CAAC,CAAC,CAACG,IAAI,EAAE;IAC/C;IACA,OAAOL,MAAM;EACf,CAAC;EAAA,gBARYN,oBAAoB;IAAA;EAAA;AAAA,GAQhC;AAAA"}
|
package/lib/ExtMarkdown.js
CHANGED
|
@@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ExtMarkdown = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _codeEditor = require("@looker/code-editor");
|
|
11
|
-
|
|
12
9
|
var _adaptorUtils = require("./adaptorUtils");
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
var ExtMarkdown = _ref => {
|
|
17
12
|
var {
|
|
18
13
|
source,
|
|
@@ -21,12 +16,10 @@ var ExtMarkdown = _ref => {
|
|
|
21
16
|
linkClickHandler,
|
|
22
17
|
paragraphOverride
|
|
23
18
|
} = _ref;
|
|
24
|
-
|
|
25
19
|
var openBrowserWindow = (_pathname, href) => {
|
|
26
20
|
var adaptor = (0, _adaptorUtils.getEnvAdaptor)();
|
|
27
21
|
adaptor.openBrowserWindow(href);
|
|
28
22
|
};
|
|
29
|
-
|
|
30
23
|
return _react.default.createElement(_codeEditor.Markdown, {
|
|
31
24
|
source: source,
|
|
32
25
|
pattern: pattern,
|
|
@@ -35,6 +28,5 @@ var ExtMarkdown = _ref => {
|
|
|
35
28
|
paragraphOverride: paragraphOverride
|
|
36
29
|
});
|
|
37
30
|
};
|
|
38
|
-
|
|
39
31
|
exports.ExtMarkdown = ExtMarkdown;
|
|
40
32
|
//# sourceMappingURL=ExtMarkdown.js.map
|
package/lib/ExtMarkdown.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"ExtMarkdown.js","names":["ExtMarkdown","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","openBrowserWindow","_pathname","href","adaptor","getEnvAdaptor"],"sources":["../src/ExtMarkdown.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC, ReactNode } from 'react'\nimport React from 'react'\nimport { Markdown } from '@looker/code-editor'\nimport { getEnvAdaptor } from './adaptorUtils'\n\ninterface ExtMarkdownProps {\n source: string\n pattern?: string\n transformLinkUri?: (url: string) => string\n linkClickHandler?: (pathname: string, href: string) => void\n paragraphOverride?: ({ children }: { children: ReactNode }) => ReactNode\n}\n\n/**\n * Simple wrapper on the standard Markdown component to handle link clicks in an extension\n * @param source markdown to render\n * @param pattern search pattern\n * @param transformLinkUri link pattern transformer override\n * @param linkClickHandler defaults to ExtensionSDK.openBrowserWindow()\n * @param paragraphOverride override paragraph display handling\n */\nexport const ExtMarkdown: FC<ExtMarkdownProps> = ({\n source,\n pattern = '',\n transformLinkUri,\n linkClickHandler,\n paragraphOverride,\n}) => {\n const openBrowserWindow = (_pathname: string, href: string) => {\n const adaptor = getEnvAdaptor()\n adaptor.openBrowserWindow(href)\n }\n\n return (\n <Markdown\n source={source}\n pattern={pattern}\n transformLinkUri={transformLinkUri}\n linkClickHandler={linkClickHandler || openBrowserWindow}\n paragraphOverride={paragraphOverride}\n />\n )\n}\n"],"mappings":";;;;;;AA2BA;AACA;AACA;AAA8C;AAkBvC,IAAMA,WAAiC,GAAG,QAM3C;EAAA,IAN4C;IAChDC,MAAM;IACNC,OAAO,GAAG,EAAE;IACZC,gBAAgB;IAChBC,gBAAgB;IAChBC;EACF,CAAC;EACC,IAAMC,iBAAiB,GAAG,CAACC,SAAiB,EAAEC,IAAY,KAAK;IAC7D,IAAMC,OAAO,GAAG,IAAAC,2BAAa,GAAE;IAC/BD,OAAO,CAACH,iBAAiB,CAACE,IAAI,CAAC;EACjC,CAAC;EAED,OACE,6BAAC,oBAAQ;IACP,MAAM,EAAEP,MAAO;IACf,OAAO,EAAEC,OAAQ;IACjB,gBAAgB,EAAEC,gBAAiB;IACnC,gBAAgB,EAAEC,gBAAgB,IAAIE,iBAAkB;IACxD,iBAAiB,EAAED;EAAkB,EACrC;AAEN,CAAC;AAAA"}
|
package/lib/OAuthScene.js
CHANGED
|
@@ -4,26 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.OAuthScene = void 0;
|
|
7
|
-
|
|
8
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
-
|
|
10
8
|
var _components = require("@looker/components");
|
|
11
|
-
|
|
12
9
|
var _reactRouter = require("react-router");
|
|
13
|
-
|
|
14
10
|
var _reactRouterDom = require("react-router-dom");
|
|
15
|
-
|
|
16
11
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
12
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
13
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
21
|
-
|
|
22
14
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
23
|
-
|
|
24
15
|
var OAuthScene = _ref => {
|
|
25
16
|
var _authSession$returnUr;
|
|
26
|
-
|
|
27
17
|
var {
|
|
28
18
|
adaptor
|
|
29
19
|
} = _ref;
|
|
@@ -39,7 +29,6 @@ var OAuthScene = _ref => {
|
|
|
39
29
|
var maybeLogin = function () {
|
|
40
30
|
var _ref2 = _asyncToGenerator(function* () {
|
|
41
31
|
var token = yield adaptor.login();
|
|
42
|
-
|
|
43
32
|
if (token) {
|
|
44
33
|
console.error({
|
|
45
34
|
push: oldUrl,
|
|
@@ -50,12 +39,10 @@ var OAuthScene = _ref => {
|
|
|
50
39
|
history.push(oldUrl);
|
|
51
40
|
}
|
|
52
41
|
});
|
|
53
|
-
|
|
54
42
|
return function maybeLogin() {
|
|
55
43
|
return _ref2.apply(this, arguments);
|
|
56
44
|
};
|
|
57
45
|
}();
|
|
58
|
-
|
|
59
46
|
maybeLogin();
|
|
60
47
|
}, []);
|
|
61
48
|
var themeOverrides = adaptor.themeOverrides();
|
|
@@ -78,6 +65,5 @@ var OAuthScene = _ref => {
|
|
|
78
65
|
as: "h2"
|
|
79
66
|
}, "Returning to ".concat(oldUrl, " after OAuth login ...")))));
|
|
80
67
|
};
|
|
81
|
-
|
|
82
68
|
exports.OAuthScene = OAuthScene;
|
|
83
69
|
//# sourceMappingURL=OAuthScene.js.map
|
package/lib/OAuthScene.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"OAuthScene.js","names":["OAuthScene","adaptor","history","useHistory","location","useLocation","reactPath","pathname","fullPath","window","extraPath","substr","indexOf","authSession","sdk","retPath","returnUrl","oldUrl","replace","useEffect","maybeLogin","token","login","console","error","push","themeOverrides","loadGoogleFonts","themeCustomizations"],"sources":["../src/OAuthScene.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { FC } from 'react'\nimport React, { useEffect } from 'react'\nimport type { BrowserSession } from '@looker/sdk-rtl'\nimport {\n ComponentsProvider,\n Flex,\n FlexItem,\n Heading,\n ProgressCircular,\n} from '@looker/components'\nimport { useHistory } from 'react-router'\nimport { useLocation } from 'react-router-dom'\nimport type { IEnvironmentAdaptor } from './adaptorUtils'\n\ninterface OAuthSceneProps {\n adaptor: IEnvironmentAdaptor\n}\n\n/**\n * OAuth scene for sdk session handling and redirection to OAuth flow initiation\n * route\n */\nexport const OAuthScene: FC<OAuthSceneProps> = ({ adaptor }) => {\n const history = useHistory()\n const location = useLocation()\n const reactPath = location.pathname\n const fullPath = (window as any).location.pathname\n const extraPath = fullPath.substr(0, fullPath.indexOf(reactPath))\n const authSession = adaptor.sdk.authSession as BrowserSession\n const retPath = authSession.returnUrl ?? '/'\n /** If this is a nested React app, remove extraPath to prevent recursive return pathing */\n const oldUrl = retPath.replace(extraPath, '')\n\n useEffect(() => {\n const maybeLogin = async () => {\n const token = await adaptor.login()\n if (token) {\n console.error({ push: oldUrl, retPath, extraPath, location })\n history.push(oldUrl)\n }\n }\n maybeLogin()\n }, [])\n\n const themeOverrides = adaptor.themeOverrides()\n return (\n <ComponentsProvider\n loadGoogleFonts={themeOverrides.loadGoogleFonts}\n themeCustomizations={themeOverrides.themeCustomizations}\n >\n <Flex flexDirection=\"column\" justifyContent=\"center\" mt=\"25%\">\n <FlexItem alignSelf=\"center\">\n <ProgressCircular size=\"large\" />\n </FlexItem>\n <FlexItem mt=\"large\" alignSelf=\"center\">\n <Heading color=\"key\" as=\"h2\">\n {`Returning to ${oldUrl} after OAuth login ...`}\n </Heading>\n </FlexItem>\n </Flex>\n </ComponentsProvider>\n )\n}\n"],"mappings":";;;;;;AA2BA;AAEA;AAOA;AACA;AAA8C;AAAA;AAAA;AAAA;AAWvC,IAAMA,UAA+B,GAAG,QAAiB;EAAA;EAAA,IAAhB;IAAEC;EAAQ,CAAC;EACzD,IAAMC,OAAO,GAAG,IAAAC,uBAAU,GAAE;EAC5B,IAAMC,QAAQ,GAAG,IAAAC,2BAAW,GAAE;EAC9B,IAAMC,SAAS,GAAGF,QAAQ,CAACG,QAAQ;EACnC,IAAMC,QAAQ,GAAIC,MAAM,CAASL,QAAQ,CAACG,QAAQ;EAClD,IAAMG,SAAS,GAAGF,QAAQ,CAACG,MAAM,CAAC,CAAC,EAAEH,QAAQ,CAACI,OAAO,CAACN,SAAS,CAAC,CAAC;EACjE,IAAMO,WAAW,GAAGZ,OAAO,CAACa,GAAG,CAACD,WAA6B;EAC7D,IAAME,OAAO,4BAAGF,WAAW,CAACG,SAAS,yEAAI,GAAG;EAE5C,IAAMC,MAAM,GAAGF,OAAO,CAACG,OAAO,CAACR,SAAS,EAAE,EAAE,CAAC;EAE7C,IAAAS,gBAAS,EAAC,MAAM;IACd,IAAMC,UAAU;MAAA,8BAAG,aAAY;QAC7B,IAAMC,KAAK,SAASpB,OAAO,CAACqB,KAAK,EAAE;QACnC,IAAID,KAAK,EAAE;UACTE,OAAO,CAACC,KAAK,CAAC;YAAEC,IAAI,EAAER,MAAM;YAAEF,OAAO;YAAEL,SAAS;YAAEN;UAAS,CAAC,CAAC;UAC7DF,OAAO,CAACuB,IAAI,CAACR,MAAM,CAAC;QACtB;MACF,CAAC;MAAA,gBANKG,UAAU;QAAA;MAAA;IAAA,GAMf;IACDA,UAAU,EAAE;EACd,CAAC,EAAE,EAAE,CAAC;EAEN,IAAMM,cAAc,GAAGzB,OAAO,CAACyB,cAAc,EAAE;EAC/C,OACE,6BAAC,8BAAkB;IACjB,eAAe,EAAEA,cAAc,CAACC,eAAgB;IAChD,mBAAmB,EAAED,cAAc,CAACE;EAAoB,GAExD,6BAAC,gBAAI;IAAC,aAAa,EAAC,QAAQ;IAAC,cAAc,EAAC,QAAQ;IAAC,EAAE,EAAC;EAAK,GAC3D,6BAAC,oBAAQ;IAAC,SAAS,EAAC;EAAQ,GAC1B,6BAAC,4BAAgB;IAAC,IAAI,EAAC;EAAO,EAAG,CACxB,EACX,6BAAC,oBAAQ;IAAC,EAAE,EAAC,OAAO;IAAC,SAAS,EAAC;EAAQ,GACrC,6BAAC,mBAAO;IAAC,KAAK,EAAC,KAAK;IAAC,EAAE,EAAC;EAAI,0BACTX,MAAM,4BACf,CACD,CACN,CACY;AAEzB,CAAC;AAAA"}
|
package/lib/adaptorUtils.js
CHANGED
|
@@ -3,14 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.unregisterEnvAdaptor = exports.registerTestEnvAdaptor = exports.registerEnvAdaptor = exports.hostedInternally = exports.getThemeOverrides = exports.getEnvAdaptor = exports.appPath = void 0;
|
|
8
7
|
var _browserAdaptor = require("./browserAdaptor");
|
|
9
|
-
|
|
10
8
|
var hostedInternally = hostname => hostname.endsWith('.looker.com') || hostname.endsWith('.google.com') || hostname === 'localhost' || hostname.startsWith('looker-developer-portal') && hostname.endsWith('.web.app');
|
|
11
|
-
|
|
12
9
|
exports.hostedInternally = hostedInternally;
|
|
13
|
-
|
|
14
10
|
var getThemeOverrides = internalTheming => internalTheming ? {
|
|
15
11
|
loadGoogleFonts: true,
|
|
16
12
|
themeCustomizations: {
|
|
@@ -28,39 +24,28 @@ var getThemeOverrides = internalTheming => internalTheming ? {
|
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
};
|
|
31
|
-
|
|
32
27
|
exports.getThemeOverrides = getThemeOverrides;
|
|
33
28
|
var extensionAdaptor;
|
|
34
|
-
|
|
35
29
|
var registerEnvAdaptor = adaptor => {
|
|
36
30
|
extensionAdaptor = adaptor;
|
|
37
31
|
};
|
|
38
|
-
|
|
39
32
|
exports.registerEnvAdaptor = registerEnvAdaptor;
|
|
40
|
-
|
|
41
33
|
var unregisterEnvAdaptor = () => {
|
|
42
34
|
extensionAdaptor = undefined;
|
|
43
35
|
};
|
|
44
|
-
|
|
45
36
|
exports.unregisterEnvAdaptor = unregisterEnvAdaptor;
|
|
46
|
-
|
|
47
37
|
var getEnvAdaptor = () => {
|
|
48
38
|
if (!extensionAdaptor) {
|
|
49
39
|
throw new Error('Environment adaptor not initialized.');
|
|
50
40
|
}
|
|
51
|
-
|
|
52
41
|
return extensionAdaptor;
|
|
53
42
|
};
|
|
54
|
-
|
|
55
43
|
exports.getEnvAdaptor = getEnvAdaptor;
|
|
56
|
-
|
|
57
44
|
var registerTestEnvAdaptor = adaptor => {
|
|
58
45
|
var mockSdk = {};
|
|
59
46
|
registerEnvAdaptor(adaptor || new _browserAdaptor.BrowserAdaptor(mockSdk));
|
|
60
47
|
};
|
|
61
|
-
|
|
62
48
|
exports.registerTestEnvAdaptor = registerTestEnvAdaptor;
|
|
63
|
-
|
|
64
49
|
var appPath = (location, newPath) => {
|
|
65
50
|
var reactPath = location.pathname;
|
|
66
51
|
var wloc = window.location;
|
|
@@ -69,6 +54,5 @@ var appPath = (location, newPath) => {
|
|
|
69
54
|
var result = "".concat(base).concat(wpath.substring(0, wpath.indexOf(reactPath))).concat(newPath);
|
|
70
55
|
return result;
|
|
71
56
|
};
|
|
72
|
-
|
|
73
57
|
exports.appPath = appPath;
|
|
74
58
|
//# sourceMappingURL=adaptorUtils.js.map
|
package/lib/adaptorUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"adaptorUtils.js","names":["hostedInternally","hostname","endsWith","startsWith","getThemeOverrides","internalTheming","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","extensionAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error","registerTestEnvAdaptor","mockSdk","BrowserAdaptor","appPath","location","newPath","reactPath","pathname","wloc","window","base","origin","wpath","result","substring","indexOf"],"sources":["../src/adaptorUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ThemeCustomizations } from '@looker/design-tokens'\nimport type { IAPIMethods } from '@looker/sdk-rtl'\nimport type { Location as HLocation } from 'history'\nimport { BrowserAdaptor } from './browserAdaptor'\n\nexport interface IAuthAdaptor {\n /** Method for retrieving an instantiated SDK */\n get sdk(): IAPIMethods\n /** Method for authenticating against the API server. Auth mechanism is dependent on the authSession implementation\n * used for the sdk. */\n login(): Promise<boolean>\n}\n\n/**\n * NOTE: This interface should describe all methods that require an adaptor when running in standalone vs extension mode\n * Examples include: local storage operations and various link navigation functions\n */\nexport interface IEnvironmentAdaptor extends IAuthAdaptor {\n /** Copy page URL to clipboard */\n copyToClipboard: (location?: {\n pathname: string\n search: string\n }) => Promise<void>\n /** Method for determining whether running in a browser or extension environment */\n isExtension(): boolean\n /** Method for retrieving a keyed value from local storage */\n localStorageGetItem(key: string): Promise<string | null>\n /** Method for setting a keyed value in local storage */\n localStorageSetItem(key: string, value: string): void\n /** Method for removing a keyed value from local storage */\n localStorageRemoveItem(key: string): void\n /** Theme settings for extension */\n themeOverrides(): ThemeOverrides\n /** Open a new browser window with the given url and target */\n openBrowserWindow: (url: string, target?: string) => void\n /** error logger */\n logError: (error: Error, componentStack: string) => void\n}\n\n/**\n * Theme overrides used to load google fonts in Google environments only.\n * Google fonts should NOT be used when it is not obvious that a Google\n * system is being used (for example an embedded extension).\n */\nexport interface ThemeOverrides {\n /** Should Google-specific fonts be used for the theme? */\n loadGoogleFonts?: boolean\n /** Property bag overrides for Looker component theming */\n themeCustomizations?: ThemeCustomizations\n}\n\n/**\n * Is this an \"internal\" host that will use internal branding?\n * @param hostname to check\n */\nexport const hostedInternally = (hostname: string): boolean =>\n hostname.endsWith('.looker.com') ||\n hostname.endsWith('.google.com') ||\n hostname === 'localhost' ||\n // Include firebase staging dev portal for now. Can be removed\n // when dev portal gets its own APIX project. Also includes\n // PRs.\n (hostname.startsWith('looker-developer-portal') &&\n hostname.endsWith('.web.app'))\n\n/**\n * Return theme overrides that make apply \"internal\" or external theming\n * @param internalTheming true if \"internal\" theme should be used\n */\nexport const getThemeOverrides = (internalTheming: boolean): ThemeOverrides =>\n internalTheming\n ? {\n loadGoogleFonts: true,\n themeCustomizations: {\n fontFamilies: { brand: 'Google Sans' },\n colors: { key: '#1A73E8' },\n },\n }\n : {\n themeCustomizations: {\n colors: { key: '#1A73E8' },\n },\n }\n\nlet extensionAdaptor: IEnvironmentAdaptor | undefined\n\n/**\n * Register the environment adaptor. Used when initializing the application\n * @param adaptor to register\n */\nexport const registerEnvAdaptor = <T extends IEnvironmentAdaptor>(\n adaptor: T\n) => {\n extensionAdaptor = adaptor\n}\n\n/**\n * Unregister the environment adaptor. Extensions should call this when unmounted\n */\nexport const unregisterEnvAdaptor = () => {\n extensionAdaptor = undefined\n}\n\n/**\n * Global access to the environment adaptor. An error will be thrown if accessed prematurely.\n */\nexport const getEnvAdaptor = () => {\n if (!extensionAdaptor) {\n throw new Error('Environment adaptor not initialized.')\n }\n return extensionAdaptor\n}\n\n/**\n * Used by some unit tests\n * @param adaptor to use for testing\n */\nexport const registerTestEnvAdaptor = <T extends IEnvironmentAdaptor>(\n adaptor?: T\n) => {\n const mockSdk = {} as unknown as IAPIMethods\n registerEnvAdaptor(adaptor || new BrowserAdaptor(mockSdk))\n}\n\n/**\n * Get new application-level base path for react application\n * This function compares the react-based location with the browser window location\n * pathname to ensure that the newPath variable is assigned at the root of the\n * React app path rather than potentially recursive nesting\n *\n * @param location which is usually from useLocation()\n * @param newPath new path to assign, like `/oauth`\n */\nexport const appPath = (location: HLocation, newPath: string) => {\n const reactPath = location.pathname\n const wloc = (window as any).location\n const base = wloc.origin\n const wpath = wloc.pathname\n const result = `${base}${wpath.substring(\n 0,\n wpath.indexOf(reactPath)\n )}${newPath}`\n return result\n}\n"],"mappings":";;;;;;AA6BA;AAoDO,IAAMA,gBAAgB,GAAIC,QAAgB,IAC/CA,QAAQ,CAACC,QAAQ,CAAC,aAAa,CAAC,IAChCD,QAAQ,CAACC,QAAQ,CAAC,aAAa,CAAC,IAChCD,QAAQ,KAAK,WAAW,IAIvBA,QAAQ,CAACE,UAAU,CAAC,yBAAyB,CAAC,IAC7CF,QAAQ,CAACC,QAAQ,CAAC,UAAU,CAAE;AAAA;AAM3B,IAAME,iBAAiB,GAAIC,eAAwB,IACxDA,eAAe,GACX;EACEC,eAAe,EAAE,IAAI;EACrBC,mBAAmB,EAAE;IACnBC,YAAY,EAAE;MAAEC,KAAK,EAAE;IAAc,CAAC;IACtCC,MAAM,EAAE;MAAEC,GAAG,EAAE;IAAU;EAC3B;AACF,CAAC,GACD;EACEJ,mBAAmB,EAAE;IACnBG,MAAM,EAAE;MAAEC,GAAG,EAAE;IAAU;EAC3B;AACF,CAAC;AAAA;AAEP,IAAIC,gBAAiD;AAM9C,IAAMC,kBAAkB,GAC7BC,OAAU,IACP;EACHF,gBAAgB,GAAGE,OAAO;AAC5B,CAAC;AAAA;AAKM,IAAMC,oBAAoB,GAAG,MAAM;EACxCH,gBAAgB,GAAGI,SAAS;AAC9B,CAAC;AAAA;AAKM,IAAMC,aAAa,GAAG,MAAM;EACjC,IAAI,CAACL,gBAAgB,EAAE;IACrB,MAAM,IAAIM,KAAK,CAAC,sCAAsC,CAAC;EACzD;EACA,OAAON,gBAAgB;AACzB,CAAC;AAAA;AAMM,IAAMO,sBAAsB,GACjCL,OAAW,IACR;EACH,IAAMM,OAAO,GAAG,CAAC,CAA2B;EAC5CP,kBAAkB,CAACC,OAAO,IAAI,IAAIO,8BAAc,CAACD,OAAO,CAAC,CAAC;AAC5D,CAAC;AAAA;AAWM,IAAME,OAAO,GAAG,CAACC,QAAmB,EAAEC,OAAe,KAAK;EAC/D,IAAMC,SAAS,GAAGF,QAAQ,CAACG,QAAQ;EACnC,IAAMC,IAAI,GAAIC,MAAM,CAASL,QAAQ;EACrC,IAAMM,IAAI,GAAGF,IAAI,CAACG,MAAM;EACxB,IAAMC,KAAK,GAAGJ,IAAI,CAACD,QAAQ;EAC3B,IAAMM,MAAM,aAAMH,IAAI,SAAGE,KAAK,CAACE,SAAS,CACtC,CAAC,EACDF,KAAK,CAACG,OAAO,CAACT,SAAS,CAAC,CACzB,SAAGD,OAAO,CAAE;EACb,OAAOQ,MAAM;AACf,CAAC;AAAA"}
|