@looker/run-it 0.9.23 → 0.9.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/CHANGELOG.md +82 -1
  2. package/lib/RunIt.d.ts +2 -2
  3. package/lib/RunIt.js +18 -30
  4. package/lib/RunIt.js.map +1 -1
  5. package/lib/RunItProvider.d.ts +0 -4
  6. package/lib/RunItProvider.js +2 -7
  7. package/lib/RunItProvider.js.map +1 -1
  8. package/lib/components/ConfigForm/ConfigForm.d.ts +1 -6
  9. package/lib/components/ConfigForm/ConfigForm.js +39 -48
  10. package/lib/components/ConfigForm/ConfigForm.js.map +1 -1
  11. package/lib/components/ConfigForm/index.d.ts +1 -1
  12. package/lib/components/ConfigForm/index.js +4 -4
  13. package/lib/components/ConfigForm/index.js.map +1 -1
  14. package/lib/components/ConfigForm/utils.d.ts +11 -0
  15. package/lib/components/ConfigForm/utils.js +81 -0
  16. package/lib/components/ConfigForm/utils.js.map +1 -0
  17. package/lib/components/LoginForm/LoginForm.d.ts +3 -8
  18. package/lib/components/LoginForm/LoginForm.js +9 -8
  19. package/lib/components/LoginForm/LoginForm.js.map +1 -1
  20. package/lib/components/PerfTracker/PerfTracker.d.ts +0 -2
  21. package/lib/components/PerfTracker/PerfTracker.js +7 -8
  22. package/lib/components/PerfTracker/PerfTracker.js.map +1 -1
  23. package/lib/components/RequestForm/RequestForm.d.ts +0 -6
  24. package/lib/components/RequestForm/RequestForm.js +0 -7
  25. package/lib/components/RequestForm/RequestForm.js.map +1 -1
  26. package/lib/components/common/index.d.ts +0 -1
  27. package/lib/components/common/index.js +0 -18
  28. package/lib/components/common/index.js.map +1 -1
  29. package/lib/esm/RunIt.js +19 -32
  30. package/lib/esm/RunIt.js.map +1 -1
  31. package/lib/esm/RunItProvider.js +2 -7
  32. package/lib/esm/RunItProvider.js.map +1 -1
  33. package/lib/esm/components/ConfigForm/ConfigForm.js +36 -46
  34. package/lib/esm/components/ConfigForm/ConfigForm.js.map +1 -1
  35. package/lib/esm/components/ConfigForm/index.js +1 -1
  36. package/lib/esm/components/ConfigForm/index.js.map +1 -1
  37. package/lib/esm/components/ConfigForm/utils.js +61 -0
  38. package/lib/esm/components/ConfigForm/utils.js.map +1 -0
  39. package/lib/esm/components/LoginForm/LoginForm.js +7 -7
  40. package/lib/esm/components/LoginForm/LoginForm.js.map +1 -1
  41. package/lib/esm/components/PerfTracker/PerfTracker.js +7 -8
  42. package/lib/esm/components/PerfTracker/PerfTracker.js.map +1 -1
  43. package/lib/esm/components/RequestForm/RequestForm.js +0 -7
  44. package/lib/esm/components/RequestForm/RequestForm.js.map +1 -1
  45. package/lib/esm/components/common/index.js +0 -1
  46. package/lib/esm/components/common/index.js.map +1 -1
  47. package/lib/esm/index.js +0 -1
  48. package/lib/esm/index.js.map +1 -1
  49. package/lib/esm/utils/RunItSDK.js +8 -78
  50. package/lib/esm/utils/RunItSDK.js.map +1 -1
  51. package/lib/esm/utils/requestUtils.js +21 -14
  52. package/lib/esm/utils/requestUtils.js.map +1 -1
  53. package/lib/index.d.ts +0 -1
  54. package/lib/index.js +0 -13
  55. package/lib/index.js.map +1 -1
  56. package/lib/test-data/responses.js +9 -0
  57. package/lib/test-data/responses.js.map +1 -1
  58. package/lib/utils/RunItSDK.d.ts +1 -17
  59. package/lib/utils/RunItSDK.js +10 -88
  60. package/lib/utils/RunItSDK.js.map +1 -1
  61. package/lib/utils/requestUtils.d.ts +2 -3
  62. package/lib/utils/requestUtils.js +22 -15
  63. package/lib/utils/requestUtils.js.map +1 -1
  64. package/package.json +8 -7
  65. package/lib/components/ConfigForm/configUtils.d.ts +0 -39
  66. package/lib/components/ConfigForm/configUtils.js +0 -232
  67. package/lib/components/ConfigForm/configUtils.js.map +0 -1
  68. package/lib/components/common/StandaloneConfigurator.d.ts +0 -7
  69. package/lib/components/common/StandaloneConfigurator.js +0 -61
  70. package/lib/components/common/StandaloneConfigurator.js.map +0 -1
  71. package/lib/esm/components/ConfigForm/configUtils.js +0 -196
  72. package/lib/esm/components/ConfigForm/configUtils.js.map +0 -1
  73. package/lib/esm/components/common/StandaloneConfigurator.js +0 -51
  74. package/lib/esm/components/common/StandaloneConfigurator.js.map +0 -1
  75. package/lib/esm/scenes/OAuthScene/OAuthScene.js +0 -64
  76. package/lib/esm/scenes/OAuthScene/OAuthScene.js.map +0 -1
  77. package/lib/esm/scenes/OAuthScene/index.js +0 -2
  78. package/lib/esm/scenes/OAuthScene/index.js.map +0 -1
  79. package/lib/esm/scenes/index.js +0 -2
  80. package/lib/esm/scenes/index.js.map +0 -1
  81. package/lib/scenes/OAuthScene/OAuthScene.d.ts +0 -2
  82. package/lib/scenes/OAuthScene/OAuthScene.js +0 -81
  83. package/lib/scenes/OAuthScene/OAuthScene.js.map +0 -1
  84. package/lib/scenes/OAuthScene/index.d.ts +0 -1
  85. package/lib/scenes/OAuthScene/index.js +0 -14
  86. package/lib/scenes/OAuthScene/index.js.map +0 -1
  87. package/lib/scenes/index.d.ts +0 -1
  88. package/lib/scenes/index.js +0 -14
  89. package/lib/scenes/index.js.map +0 -1
@@ -1,64 +0,0 @@
1
- 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); } }
2
-
3
- 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); }); }; }
4
-
5
- import React, { useContext, useEffect, useState } from 'react';
6
- import { useHistory } from 'react-router-dom';
7
- import { RunItContext } from '../..';
8
- import { Loading } from '../../components';
9
- export var OAuthScene = () => {
10
- var origin = window.location.origin;
11
- var [loading, setLoading] = useState(true);
12
- var [auth, setAuth] = useState();
13
- var [oldUrl, setOldUrl] = useState();
14
- var history = useHistory();
15
- var {
16
- sdk
17
- } = useContext(RunItContext);
18
- useEffect(() => {
19
- if (sdk) {
20
- var authSession = sdk.authSession;
21
- setAuth(authSession);
22
- var old = authSession.returnUrl || "/";
23
- setOldUrl(old);
24
- } else {
25
- setAuth(undefined);
26
- setOldUrl(undefined);
27
- }
28
- }, [sdk]);
29
- useEffect(() => {
30
- var maybeLogin = function () {
31
- var _ref = _asyncToGenerator(function* () {
32
- if (auth) {
33
- try {
34
- var res = yield auth.login();
35
-
36
- if (!auth.isAuthenticated()) {
37
- console.error("Authentication failed ".concat(res));
38
- }
39
- } catch (error) {
40
- console.error(error);
41
- }
42
-
43
- setLoading(false);
44
-
45
- if (oldUrl) {
46
- history.push(oldUrl);
47
- }
48
- }
49
- });
50
-
51
- return function maybeLogin() {
52
- return _ref.apply(this, arguments);
53
- };
54
- }();
55
-
56
- maybeLogin();
57
- }, [auth, history]);
58
- if (!sdk) return React.createElement(React.Fragment, null);
59
- return React.createElement(Loading, {
60
- loading: loading,
61
- message: "Returning to ".concat(oldUrl || origin, " after OAuth login ...")
62
- });
63
- };
64
- //# sourceMappingURL=OAuthScene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/scenes/OAuthScene/OAuthScene.tsx"],"names":["React","useContext","useEffect","useState","useHistory","RunItContext","Loading","OAuthScene","origin","window","location","loading","setLoading","auth","setAuth","oldUrl","setOldUrl","history","sdk","authSession","old","returnUrl","undefined","maybeLogin","res","login","isAuthenticated","console","error","push"],"mappings":";;;;AA2BA,OAAOA,KAAP,IAAgBC,UAAhB,EAA4BC,SAA5B,EAAuCC,QAAvC,QAAuD,OAAvD;AACA,SAASC,UAAT,QAA2B,kBAA3B;AAEA,SAASC,YAAT,QAA6B,OAA7B;AACA,SAASC,OAAT,QAAwB,kBAAxB;AAEA,OAAO,IAAMC,UAAc,GAAG,MAAM;AAClC,MAAMC,MAAM,GAAIC,MAAD,CAAgBC,QAAhB,CAAyBF,MAAxC;AACA,MAAM,CAACG,OAAD,EAAUC,UAAV,IAAwBT,QAAQ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MAAI,CAACC,GAAL,EAAU,OAAO,yCAAP;AAEV,SACE,oBAAC,OAAD;AACE,IAAA,OAAO,EAAEP,OADX;AAEE,IAAA,OAAO,yBAAkBI,MAAM,IAAIP,MAA5B;AAFT,IADF;AAMD,CAlDM","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, { useContext, useEffect, useState } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport type { BrowserSession } from '@looker/sdk-rtl'\nimport { RunItContext } from '../..'\nimport { Loading } from '../../components'\n\nexport const OAuthScene: FC = () => {\n const origin = (window as any).location.origin\n const [loading, setLoading] = useState(true)\n const [auth, setAuth] = useState<BrowserSession>()\n const [oldUrl, setOldUrl] = useState<string>()\n const history = useHistory()\n const { sdk } = useContext(RunItContext)\n\n useEffect(() => {\n if (sdk) {\n const authSession = sdk.authSession as BrowserSession\n setAuth(authSession)\n /** capture the stored return URL before `OAuthSession.login()` clears it */\n const old = authSession.returnUrl || `/`\n setOldUrl(old)\n } else {\n setAuth(undefined)\n setOldUrl(undefined)\n }\n }, [sdk])\n\n useEffect(() => {\n const maybeLogin = async () => {\n if (auth) {\n try {\n const res = await auth.login()\n if (!auth.isAuthenticated()) {\n console.error(`Authentication failed ${res}`)\n }\n } catch (error) {\n console.error(error)\n }\n setLoading(false)\n if (oldUrl) {\n history.push(oldUrl)\n }\n }\n }\n maybeLogin()\n }, [auth, history])\n\n // No sdk no OAuth for you\n if (!sdk) return <></>\n\n return (\n <Loading\n loading={loading}\n message={`Returning to ${oldUrl || origin} after OAuth login ...`}\n />\n )\n}\n"],"file":"OAuthScene.js"}
@@ -1,2 +0,0 @@
1
- export { OAuthScene } from './OAuthScene';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/scenes/OAuthScene/index.ts"],"names":["OAuthScene"],"mappings":"AA0BA,SAASA,UAAT,QAA2B,cAA3B","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\nexport { OAuthScene } from './OAuthScene'\n"],"file":"index.js"}
@@ -1,2 +0,0 @@
1
- export { OAuthScene } from './OAuthScene';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/scenes/index.ts"],"names":["OAuthScene"],"mappings":"AA0BA,SAASA,UAAT,QAA2B,cAA3B","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\nexport { OAuthScene } from './OAuthScene'\n"],"file":"index.js"}
@@ -1,2 +0,0 @@
1
- import type { FC } from 'react';
2
- export declare const OAuthScene: FC;
@@ -1,81 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.OAuthScene = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _reactRouterDom = require("react-router-dom");
11
-
12
- var _ = require("../..");
13
-
14
- var _components = require("../../components");
15
-
16
- 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
- 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
- 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
- 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
- var OAuthScene = () => {
25
- var origin = window.location.origin;
26
- var [loading, setLoading] = (0, _react.useState)(true);
27
- var [auth, setAuth] = (0, _react.useState)();
28
- var [oldUrl, setOldUrl] = (0, _react.useState)();
29
- var history = (0, _reactRouterDom.useHistory)();
30
- var {
31
- sdk
32
- } = (0, _react.useContext)(_.RunItContext);
33
- (0, _react.useEffect)(() => {
34
- if (sdk) {
35
- var authSession = sdk.authSession;
36
- setAuth(authSession);
37
- var old = authSession.returnUrl || "/";
38
- setOldUrl(old);
39
- } else {
40
- setAuth(undefined);
41
- setOldUrl(undefined);
42
- }
43
- }, [sdk]);
44
- (0, _react.useEffect)(() => {
45
- var maybeLogin = function () {
46
- var _ref = _asyncToGenerator(function* () {
47
- if (auth) {
48
- try {
49
- var res = yield auth.login();
50
-
51
- if (!auth.isAuthenticated()) {
52
- console.error("Authentication failed ".concat(res));
53
- }
54
- } catch (error) {
55
- console.error(error);
56
- }
57
-
58
- setLoading(false);
59
-
60
- if (oldUrl) {
61
- history.push(oldUrl);
62
- }
63
- }
64
- });
65
-
66
- return function maybeLogin() {
67
- return _ref.apply(this, arguments);
68
- };
69
- }();
70
-
71
- maybeLogin();
72
- }, [auth, history]);
73
- if (!sdk) return _react.default.createElement(_react.default.Fragment, null);
74
- return _react.default.createElement(_components.Loading, {
75
- loading: loading,
76
- message: "Returning to ".concat(oldUrl || origin, " after OAuth login ...")
77
- });
78
- };
79
-
80
- exports.OAuthScene = OAuthScene;
81
- //# sourceMappingURL=OAuthScene.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/scenes/OAuthScene/OAuthScene.tsx"],"names":["OAuthScene","origin","window","location","loading","setLoading","auth","setAuth","oldUrl","setOldUrl","history","sdk","RunItContext","authSession","old","returnUrl","undefined","maybeLogin","res","login","isAuthenticated","console","error","push"],"mappings":";;;;;;;AA2BA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEO,IAAMA,UAAc,GAAG,MAAM;AAClC,MAAMC,MAAM,GAAIC,MAAD,CAAgBC,QAAhB,CAAyBF,MAAxC;AACA,MAAM,CAACG,OAAD,EAAUC,UAAV,IAAwB,qBAAS,IAAT,CAA9B;AACA,MAAM,CAACC,IAAD,EAAOC,OAAP,IAAkB,sBAAxB;AACA,MAAM,CAACC,MAAD,EAASC,SAAT,IAAsB,sBAA5B;AACA,MAAMC,OAAO,GAAG,iCAAhB;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ereby 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, { useContext, useEffect, useState } from 'react'\nimport { useHistory } from 'react-router-dom'\nimport type { BrowserSession } from '@looker/sdk-rtl'\nimport { RunItContext } from '../..'\nimport { Loading } from '../../components'\n\nexport const OAuthScene: FC = () => {\n const origin = (window as any).location.origin\n const [loading, setLoading] = useState(true)\n const [auth, setAuth] = useState<BrowserSession>()\n const [oldUrl, setOldUrl] = useState<string>()\n const history = useHistory()\n const { sdk } = useContext(RunItContext)\n\n useEffect(() => {\n if (sdk) {\n const authSession = sdk.authSession as BrowserSession\n setAuth(authSession)\n /** capture the stored return URL before `OAuthSession.login()` clears it */\n const old = authSession.returnUrl || `/`\n setOldUrl(old)\n } else {\n setAuth(undefined)\n setOldUrl(undefined)\n }\n }, [sdk])\n\n useEffect(() => {\n const maybeLogin = async () => {\n if (auth) {\n try {\n const res = await auth.login()\n if (!auth.isAuthenticated()) {\n console.error(`Authentication failed ${res}`)\n }\n } catch (error) {\n console.error(error)\n }\n setLoading(false)\n if (oldUrl) {\n history.push(oldUrl)\n }\n }\n }\n maybeLogin()\n }, [auth, history])\n\n // No sdk no OAuth for you\n if (!sdk) return <></>\n\n return (\n <Loading\n loading={loading}\n message={`Returning to ${oldUrl || origin} after OAuth login ...`}\n />\n )\n}\n"],"file":"OAuthScene.js"}
@@ -1 +0,0 @@
1
- export { OAuthScene } from './OAuthScene';
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "OAuthScene", {
7
- enumerable: true,
8
- get: function get() {
9
- return _OAuthScene.OAuthScene;
10
- }
11
- });
12
-
13
- var _OAuthScene = require("./OAuthScene");
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/scenes/OAuthScene/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AA0BA","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\nexport { OAuthScene } from './OAuthScene'\n"],"file":"index.js"}
@@ -1 +0,0 @@
1
- export { OAuthScene } from './OAuthScene';
@@ -1,14 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "OAuthScene", {
7
- enumerable: true,
8
- get: function get() {
9
- return _OAuthScene.OAuthScene;
10
- }
11
- });
12
-
13
- var _OAuthScene = require("./OAuthScene");
14
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/scenes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AA0BA","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\nexport { OAuthScene } from './OAuthScene'\n"],"file":"index.js"}