@looker/extension-utils 0.1.62 → 0.1.63
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 +9 -0
- package/lib/APIErrorDisplay/APIErrorContent.js +3 -4
- package/lib/APIErrorDisplay/APIErrorContent.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDetails.js +1 -1
- package/lib/APIErrorDisplay/APIErrorDetails.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDialog.js +1 -1
- package/lib/APIErrorDisplay/APIErrorDialog.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDisplay.js +1 -1
- package/lib/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDocLink.js +1 -1
- package/lib/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
- package/lib/APIErrorDisplay/index.js.map +1 -1
- package/lib/APIErrorDisplay/utils.js +2 -2
- package/lib/APIErrorDisplay/utils.js.map +1 -1
- package/lib/ExtMarkdown.js +1 -1
- package/lib/ExtMarkdown.js.map +1 -1
- package/lib/OAuthForm/index.js.map +1 -1
- package/lib/OAuthForm/src/components/CollapserCard.js +1 -1
- package/lib/OAuthForm/src/components/CollapserCard.js.map +1 -1
- package/lib/OAuthForm/src/components/ConfigHeading.js +1 -1
- package/lib/OAuthForm/src/components/ConfigHeading.js.map +1 -1
- package/lib/OAuthForm/src/components/OAuthForm.js +3 -4
- package/lib/OAuthForm/src/components/OAuthForm.js.map +1 -1
- package/lib/OAuthForm/src/components/index.js.map +1 -1
- package/lib/OAuthForm/src/index.js.map +1 -1
- package/lib/OAuthForm/src/state/index.js.map +1 -1
- package/lib/OAuthForm/src/state/sagas.js.map +1 -1
- package/lib/OAuthForm/src/state/slice.js +3 -3
- package/lib/OAuthForm/src/state/slice.js.map +1 -1
- package/lib/OAuthForm/src/utils.js +4 -4
- package/lib/OAuthForm/src/utils.js.map +1 -1
- package/lib/OAuthScene.js +3 -4
- package/lib/OAuthScene.js.map +1 -1
- package/lib/adaptorUtils.js.map +1 -1
- package/lib/authUtils.js +2 -2
- package/lib/authUtils.js.map +1 -1
- package/lib/browserAdaptor.js +4 -4
- package/lib/browserAdaptor.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorContent.js +2 -2
- package/lib/esm/APIErrorDisplay/APIErrorContent.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDetails.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDialog.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
- package/lib/esm/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
- package/lib/esm/APIErrorDisplay/index.js.map +1 -1
- package/lib/esm/APIErrorDisplay/utils.js +2 -2
- package/lib/esm/APIErrorDisplay/utils.js.map +1 -1
- package/lib/esm/ExtMarkdown.js.map +1 -1
- package/lib/esm/OAuthForm/index.js.map +1 -1
- package/lib/esm/OAuthForm/src/components/CollapserCard.js.map +1 -1
- package/lib/esm/OAuthForm/src/components/ConfigHeading.js.map +1 -1
- package/lib/esm/OAuthForm/src/components/OAuthForm.js +2 -2
- package/lib/esm/OAuthForm/src/components/OAuthForm.js.map +1 -1
- package/lib/esm/OAuthForm/src/components/index.js.map +1 -1
- package/lib/esm/OAuthForm/src/index.js.map +1 -1
- package/lib/esm/OAuthForm/src/state/index.js.map +1 -1
- package/lib/esm/OAuthForm/src/state/sagas.js.map +1 -1
- package/lib/esm/OAuthForm/src/state/slice.js +2 -2
- package/lib/esm/OAuthForm/src/state/slice.js.map +1 -1
- package/lib/esm/OAuthForm/src/utils.js +4 -4
- package/lib/esm/OAuthForm/src/utils.js.map +1 -1
- package/lib/esm/OAuthScene.js +2 -2
- package/lib/esm/OAuthScene.js.map +1 -1
- package/lib/esm/adaptorUtils.js.map +1 -1
- package/lib/esm/authUtils.js +2 -2
- package/lib/esm/authUtils.js.map +1 -1
- package/lib/esm/browserAdaptor.js +4 -4
- package/lib/esm/browserAdaptor.js.map +1 -1
- package/lib/esm/extensionAdaptor.js +4 -4
- package/lib/esm/extensionAdaptor.js.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/extensionAdaptor.js +4 -4
- package/lib/extensionAdaptor.js.map +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIErrorDisplay.js","names":["React","Heading","SpaceVertical","APIErrorContent","errorHeading","APIErrorDisplay","_ref","error","showDoc","createElement","Fragment","type"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,EAAEC,aAAa,QAAQ,oBAAoB;AAC3D,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,SAAS;AActC,OAAO,IAAMC,eAAe,GAAGC,IAAA,IAGH;EAAA,IAHI;IAC9BC,KAAK;IACLC,OAAO,GAAG;EACU,CAAC,GAAAF,IAAA;EACrB,OACEN,KAAA,CAAAS,aAAA,CAAAT,KAAA,CAAAU,QAAA,QACGH,KAAK,IACJP,KAAA,CAAAS,aAAA,CAACP,aAAa,QACZF,KAAA,CAAAS,aAAA,CAACR,OAAO;IAACU,IAAI,EAAC;EAAI,GAAEP,YAAY,CAACG,KAAK,CAAW,CAAC,EAClDP,KAAA,CAAAS,aAAA,CAACN,eAAe;IAACI,KAAK,EAAEA,KAAM;IAACC,OAAO,EAAEA;EAAQ,CAAE,CACrC,CAEjB,CAAC;AAEP,CAAC"}
|
|
1
|
+
{"version":3,"file":"APIErrorDisplay.js","names":["React","Heading","SpaceVertical","APIErrorContent","errorHeading","APIErrorDisplay","_ref","error","showDoc","createElement","Fragment","type"],"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,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,OAAO,EAAEC,aAAa,QAAQ,oBAAoB;AAC3D,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAASC,YAAY,QAAQ,SAAS;AActC,OAAO,IAAMC,eAAe,GAAGC,IAAA,IAGH;EAAA,IAHI;IAC9BC,KAAK;IACLC,OAAO,GAAG;EACU,CAAC,GAAAF,IAAA;EACrB,OACEN,KAAA,CAAAS,aAAA,CAAAT,KAAA,CAAAU,QAAA,QACGH,KAAK,IACJP,KAAA,CAAAS,aAAA,CAACP,aAAa,QACZF,KAAA,CAAAS,aAAA,CAACR,OAAO;IAACU,IAAI,EAAC;EAAI,GAAEP,YAAY,CAACG,KAAK,CAAW,CAAC,EAClDP,KAAA,CAAAS,aAAA,CAACN,eAAe;IAACI,KAAK,EAAEA,KAAM;IAACC,OAAO,EAAEA;EAAQ,CAAE,CACrC,CAEjB,CAAC;AAEP,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"APIErrorDocLink.js","names":["React","Link","getEnvAdaptor","APIErrorDocLink","_ref","docUrl","onClick","e","preventDefault","adaptor","openBrowserWindow","currentTarget","href","createElement","Fragment","key"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,oBAAoB;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAM/C,OAAO,IAAMC,eAAe,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAD,IAAA;EAC9D,IAAME,OAAO,GAAIC,CAAsC,IAAK;IAC1DA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClB,IAAMC,OAAO,GAAGP,aAAa,CAAC,CAAC;IAC/BO,OAAO,CAACC,iBAAiB,CAACH,CAAC,CAACI,aAAa,CAACC,IAAI,CAAC;EACjD,CAAC;EAED,IAAI,CAACP,MAAM,EAAE,OAAOL,KAAA,CAAAa,aAAA,CAAAb,KAAA,CAAAc,QAAA,MAAI,CAAC;EACzB,OACEd,KAAA,CAAAa,aAAA,CAACZ,IAAI;IAACW,IAAI,EAAEP,MAAO;IAACU,GAAG,EAAEV,MAAO;IAACC,OAAO,EAAEA;EAAQ,GAAC,kBAE7C,CAAC;AAEX,CAAC"}
|
|
1
|
+
{"version":3,"file":"APIErrorDocLink.js","names":["React","Link","getEnvAdaptor","APIErrorDocLink","_ref","docUrl","onClick","e","preventDefault","adaptor","openBrowserWindow","currentTarget","href","createElement","Fragment","key"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,oBAAoB;AACzC,SAASC,aAAa,QAAQ,iBAAiB;AAM/C,OAAO,IAAMC,eAAe,GAAGC,IAAA,IAAsC;EAAA,IAArC;IAAEC;EAA6B,CAAC,GAAAD,IAAA;EAC9D,IAAME,OAAO,GAAIC,CAAsC,IAAK;IAC1DA,CAAC,CAACC,cAAc,CAAC,CAAC;IAClB,IAAMC,OAAO,GAAGP,aAAa,CAAC,CAAC;IAC/BO,OAAO,CAACC,iBAAiB,CAACH,CAAC,CAACI,aAAa,CAACC,IAAI,CAAC;EACjD,CAAC;EAED,IAAI,CAACP,MAAM,EAAE,OAAOL,KAAA,CAAAa,aAAA,CAAAb,KAAA,CAAAc,QAAA,MAAI,CAAC;EACzB,OACEd,KAAA,CAAAa,aAAA,CAACZ,IAAI;IAACW,IAAI,EAAEP,MAAO;IAACU,GAAG,EAAEV,MAAO;IAACC,OAAO,EAAEA;EAAQ,GAAC,kBAE7C,CAAC;AAEX,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["apiErrorDisplayFetch"],"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,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,SAASA,oBAAoB,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["apiErrorDisplayFetch"],"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,cAAc,kBAAkB;AAChC,cAAc,mBAAmB;AACjC,SAASA,oBAAoB,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function asyncGeneratorStep(
|
|
2
|
-
function _asyncToGenerator(
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
3
|
export var errorHeading = error => error.message || 'Unknown error';
|
|
4
4
|
export var apiErrorDisplayFetch = function () {
|
|
5
5
|
var _ref = _asyncToGenerator(function* (_sdk, url) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["errorHeading","error","message","apiErrorDisplayFetch","_ref","_asyncToGenerator","_sdk","url","fetched","fetch","mode","result","text","stop","indexOf","substring","trim","_x","_x2","apply","arguments"],"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 { IAPIMethods, LookerSDKError } 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":";;AAgCA,OAAO,IAAMA,YAAY,GAAIC,KAAqB,IAChDA,KAAK,CAACC,OAAO,IAAI,eAAe;AAQlC,OAAO,IAAMC,oBAAoB;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG,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,CAAC,CAAC;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,CAAC,CAAC;IAC/C;IACA,OAAOL,MAAM;EACf,CAAC;EAAA,gBARYR,oBAAoBA,CAAAc,EAAA,EAAAC,GAAA;IAAA,OAAAd,IAAA,CAAAe,KAAA,OAAAC,SAAA;EAAA;AAAA,GAQhC"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["errorHeading","error","message","apiErrorDisplayFetch","_ref","_asyncToGenerator","_sdk","url","fetched","fetch","mode","result","text","stop","indexOf","substring","trim","_x","_x2","apply","arguments"],"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 { IAPIMethods, LookerSDKError } 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":";;AAgCA,OAAO,IAAMA,YAAY,GAAIC,KAAqB,IAChDA,KAAK,CAACC,OAAO,IAAI,eAAe;AAQlC,OAAO,IAAMC,oBAAoB;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG,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,CAAC,CAAC;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,CAAC,CAAC;IAC/C;IACA,OAAOL,MAAM;EACf,CAAC;EAAA,gBARYR,oBAAoBA,CAAAc,EAAA,EAAAC,GAAA;IAAA,OAAAd,IAAA,CAAAe,KAAA,OAAAC,SAAA;EAAA;AAAA,GAQhC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExtMarkdown.js","names":["React","Markdown","getEnvAdaptor","ExtMarkdown","_ref","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","openBrowserWindow","_pathname","href","adaptor","createElement"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,aAAa,QAAQ,gBAAgB;AAkB9C,OAAO,IAAMC,WAAiC,GAAGC,IAAA,IAM3C;EAAA,IAN4C;IAChDC,MAAM;IACNC,OAAO,GAAG,EAAE;IACZC,gBAAgB;IAChBC,gBAAgB;IAChBC;EACF,CAAC,GAAAL,IAAA;EACC,IAAMM,iBAAiB,GAAGA,CAACC,SAAiB,EAAEC,IAAY,KAAK;IAC7D,IAAMC,OAAO,GAAGX,aAAa,CAAC,CAAC;IAC/BW,OAAO,CAACH,iBAAiB,CAACE,IAAI,CAAC;EACjC,CAAC;EAED,OACEZ,KAAA,CAAAc,aAAA,CAACb,QAAQ;IACPI,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjBC,gBAAgB,EAAEA,gBAAiB;IACnCC,gBAAgB,EAAEA,gBAAgB,IAAIE,iBAAkB;IACxDD,iBAAiB,EAAEA;EAAkB,CACtC,CAAC;AAEN,CAAC"}
|
|
1
|
+
{"version":3,"file":"ExtMarkdown.js","names":["React","Markdown","getEnvAdaptor","ExtMarkdown","_ref","source","pattern","transformLinkUri","linkClickHandler","paragraphOverride","openBrowserWindow","_pathname","href","adaptor","createElement"],"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,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,aAAa,QAAQ,gBAAgB;AAkB9C,OAAO,IAAMC,WAAiC,GAAGC,IAAA,IAM3C;EAAA,IAN4C;IAChDC,MAAM;IACNC,OAAO,GAAG,EAAE;IACZC,gBAAgB;IAChBC,gBAAgB;IAChBC;EACF,CAAC,GAAAL,IAAA;EACC,IAAMM,iBAAiB,GAAGA,CAACC,SAAiB,EAAEC,IAAY,KAAK;IAC7D,IAAMC,OAAO,GAAGX,aAAa,CAAC,CAAC;IAC/BW,OAAO,CAACH,iBAAiB,CAACE,IAAI,CAAC;EACjC,CAAC;EAED,OACEZ,KAAA,CAAAc,aAAA,CAACb,QAAQ;IACPI,MAAM,EAAEA,MAAO;IACfC,OAAO,EAAEA,OAAQ;IACjBC,gBAAgB,EAAEA,gBAAiB;IACnCC,gBAAgB,EAAEA,gBAAgB,IAAIE,iBAAkB;IACxDD,iBAAiB,EAAEA;EAAkB,CACtC,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/OAuthForm/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport * from './src';\n"],"mappings":"AAyBA,cAAc,OAAO"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/OAuthForm/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport * from './src';\n"],"mappings":"AAyBA,cAAc,OAAO","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapserCard.js","names":["React","Accordion2","Box2","Divider","useToggle","ArrowDropDown","ArrowRight","ConfigHeading","CollapserCard","_ref","id","heading","children","defaultOpen","divider","level","value","toggle","createElement","display","flexDirection","appearance","indicatorPosition","isOpen","toggleOpen","indicatorIcons","close","open","label","as","pb"],"sources":["../../../../../src/OAuthForm/src/components/CollapserCard.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { FC, ReactElement } from 'react';\nimport React from 'react';\nimport { Accordion2, Box2, Divider, useToggle } from '@looker/components';\nimport { ArrowDropDown, ArrowRight } from '@styled-icons/material';\nimport { ConfigHeading } from './ConfigHeading';\n\ninterface CollapserCardProps {\n id?: string;\n heading: string;\n children: ReactElement;\n defaultOpen?: boolean;\n divider?: boolean;\n}\n\n/**\n * Render a collapsable header and children\n */\nexport const CollapserCard: FC<CollapserCardProps> = ({\n id,\n heading,\n children,\n defaultOpen = true,\n divider = true,\n}) => {\n const level = divider ? 'h3' : 'h4';\n const { value, toggle } = useToggle(defaultOpen);\n\n return (\n <Box2 display=\"flex\" flexDirection=\"column\">\n {divider && <Divider appearance=\"light\" />}\n <Accordion2\n id={id}\n indicatorPosition=\"left\"\n isOpen={value}\n toggleOpen={toggle}\n indicatorIcons={{ close: <ArrowRight />, open: <ArrowDropDown /> }}\n label={<ConfigHeading as={level}>{heading}</ConfigHeading>}\n >\n <Box2 pb=\"xlarge\">{children}</Box2>\n </Accordion2>\n </Box2>\n );\n};\n"],"mappings":"AA0BA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AACzE,SAASC,aAAa,EAAEC,UAAU,QAAQ,wBAAwB;AAClE,SAASC,aAAa,QAAQ,iBAAiB;AAa/C,OAAO,IAAMC,aAAqC,GAAGC,IAAA,IAM/C;EAAA,IANgD;IACpDC,EAAE;IACFC,OAAO;IACPC,QAAQ;IACRC,WAAW,GAAG,IAAI;IAClBC,OAAO,GAAG;EACZ,CAAC,GAAAL,IAAA;EACC,IAAMM,KAAK,GAAGD,OAAO,GAAG,IAAI,GAAG,IAAI;EACnC,IAAM;IAAEE,KAAK;IAAEC;EAAO,CAAC,GAAGb,SAAS,CAACS,WAAW,CAAC;EAEhD,OACEb,KAAA,CAAAkB,aAAA,CAAChB,IAAI;IAACiB,OAAO,EAAC,MAAM;IAACC,aAAa,EAAC;EAAQ,GACxCN,OAAO,IAAId,KAAA,CAAAkB,aAAA,CAACf,OAAO;IAACkB,UAAU,EAAC;EAAO,CAAE,CAAC,EAC1CrB,KAAA,CAAAkB,aAAA,CAACjB,UAAU;IACTS,EAAE,EAAEA,EAAG;IACPY,iBAAiB,EAAC,MAAM;IACxBC,MAAM,EAAEP,KAAM;IACdQ,UAAU,EAAEP,MAAO;IACnBQ,cAAc,EAAE;MAAEC,KAAK,EAAE1B,KAAA,CAAAkB,aAAA,CAACZ,UAAU,MAAE,CAAC;MAAEqB,IAAI,EAAE3B,KAAA,CAAAkB,aAAA,CAACb,aAAa,MAAE;IAAE,CAAE;IACnEuB,KAAK,EAAE5B,KAAA,CAAAkB,aAAA,CAACX,aAAa;MAACsB,EAAE,EAAEd;IAAM,GAAEJ,OAAuB;EAAE,GAE3DX,KAAA,CAAAkB,aAAA,CAAChB,IAAI;IAAC4B,EAAE,EAAC;EAAQ,GAAElB,QAAe,CACxB,CACR,CAAC;AAEX,CAAC"}
|
|
1
|
+
{"version":3,"file":"CollapserCard.js","names":["React","Accordion2","Box2","Divider","useToggle","ArrowDropDown","ArrowRight","ConfigHeading","CollapserCard","_ref","id","heading","children","defaultOpen","divider","level","value","toggle","createElement","display","flexDirection","appearance","indicatorPosition","isOpen","toggleOpen","indicatorIcons","close","open","label","as","pb"],"sources":["../../../../../src/OAuthForm/src/components/CollapserCard.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { FC, ReactElement } from 'react';\nimport React from 'react';\nimport { Accordion2, Box2, Divider, useToggle } from '@looker/components';\nimport { ArrowDropDown, ArrowRight } from '@styled-icons/material';\nimport { ConfigHeading } from './ConfigHeading';\n\ninterface CollapserCardProps {\n id?: string;\n heading: string;\n children: ReactElement;\n defaultOpen?: boolean;\n divider?: boolean;\n}\n\n/**\n * Render a collapsable header and children\n */\nexport const CollapserCard: FC<CollapserCardProps> = ({\n id,\n heading,\n children,\n defaultOpen = true,\n divider = true,\n}) => {\n const level = divider ? 'h3' : 'h4';\n const { value, toggle } = useToggle(defaultOpen);\n\n return (\n <Box2 display=\"flex\" flexDirection=\"column\">\n {divider && <Divider appearance=\"light\" />}\n <Accordion2\n id={id}\n indicatorPosition=\"left\"\n isOpen={value}\n toggleOpen={toggle}\n indicatorIcons={{ close: <ArrowRight />, open: <ArrowDropDown /> }}\n label={<ConfigHeading as={level}>{heading}</ConfigHeading>}\n >\n <Box2 pb=\"xlarge\">{children}</Box2>\n </Accordion2>\n </Box2>\n );\n};\n"],"mappings":"AA0BA,OAAOA,KAAK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":"ConfigHeading.js","names":["styled","Heading","ConfigHeading","attrs","_ref","mb","pt","withConfig","displayName","componentId"],"sources":["../../../../../src/OAuthForm/src/components/ConfigHeading.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport styled from 'styled-components';\nimport { Heading } from '@looker/components';\nimport type { HeadingProps } from '@looker/components';\n\nexport const ConfigHeading = styled(Heading).attrs(\n ({ mb = 'xsmall', pt = 'xsmall' }: HeadingProps) => ({ mb, pt })\n)``;\n"],"mappings":"AAyBA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,QAAQ,oBAAoB;AAG5C,OAAO,IAAMC,aAAa,GAAGF,MAAM,CAACC,OAAO,CAAC,CAACE,KAAK,CAChDC,IAAA;EAAA,IAAC;IAAEC,EAAE,GAAG,QAAQ;IAAEC,EAAE,GAAG;EAAuB,CAAC,GAAAF,IAAA;EAAA,OAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC;AAAA,CACjE,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAE"}
|
|
1
|
+
{"version":3,"file":"ConfigHeading.js","names":["styled","Heading","ConfigHeading","attrs","_ref","mb","pt","withConfig","displayName","componentId"],"sources":["../../../../../src/OAuthForm/src/components/ConfigHeading.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport styled from 'styled-components';\nimport { Heading } from '@looker/components';\nimport type { HeadingProps } from '@looker/components';\n\nexport const ConfigHeading = styled(Heading).attrs(\n ({ mb = 'xsmall', pt = 'xsmall' }: HeadingProps) => ({ mb, pt })\n)``;\n"],"mappings":"AAyBA,OAAOA,MAAM,MAAM,mBAAmB;AACtC,SAASC,OAAO,QAAQ,oBAAoB;AAG5C,OAAO,IAAMC,aAAa,GAAGF,MAAM,CAACC,OAAO,CAAC,CAACE,KAAK,CAChDC,IAAA;EAAA,IAAC;IAAEC,EAAE,GAAG,QAAQ;IAAEC,EAAE,GAAG;EAAuB,CAAC,GAAAF,IAAA;EAAA,OAAM;IAAEC,EAAE;IAAEC;EAAG,CAAC;AAAA,CACjE,CAAC,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,QAAE","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function asyncGeneratorStep(
|
|
2
|
-
function _asyncToGenerator(
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { Button, ButtonTransparent, Divider, FieldText, Fieldset, Form, Link, MessageBar, Paragraph, Space, SpaceVertical, Span, Tooltip } from '@looker/components';
|
|
5
5
|
import { CodeCopy } from '@looker/code-editor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthForm.js","names":["React","useEffect","Button","ButtonTransparent","Divider","FieldText","Fieldset","Form","Link","MessageBar","Paragraph","Space","SpaceVertical","Span","Tooltip","CodeCopy","useLocation","appPath","getEnvAdaptor","useOAuthFormActions","useOAuthFormState","CollapserCard","ConfigHeading","readyToLogin","OAuthForm","_ref","setHasConfig","clientId","clientLabel","configKey","location","redirect_uri","appConfig","concat","adaptor","sdk","initAction","setUrlAction","clearConfigAction","verifyConfigAction","clearMessageBarAction","saveConfigAction","apiServerUrl","fetchedUrl","webUrl","messageBar","validationMessages","savedConfig","isConfigured","base_url","looker_url","handleSave","client_id","handleVerify","handleClear","_ref2","_asyncToGenerator","isAuthenticated","apply","arguments","handleUrlChange","event","name","currentTarget","value","authSession","verifyButtonDisabled","trim","length","Object","keys","saveButtonDisabled","clearButtonDisabled","loginButtonDisabled","handleLogin","_ref3","e","preventDefault","login","_x","createElement","gap","fontSize","intent","onPrimaryClick","visible","text","heading","id","divider","defaultOpen","pt","px","legend","required","label","placeholder","onChange","disabled","Fragment","href","target","window","origin","key","language","code","content","onClick","mr","appearance"],"sources":["../../../../../src/OAuthForm/src/components/OAuthForm.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { BaseSyntheticEvent, Dispatch, FormEvent } from 'react';\nimport React, { useEffect } from 'react';\nimport {\n Button,\n ButtonTransparent,\n Divider,\n FieldText,\n Fieldset,\n Form,\n Link,\n MessageBar,\n Paragraph,\n Space,\n SpaceVertical,\n Span,\n Tooltip,\n} from '@looker/components';\nimport { CodeCopy } from '@looker/code-editor';\nimport { useLocation } from 'react-router-dom';\nimport { appPath, getEnvAdaptor } from '../../..';\nimport { useOAuthFormActions, useOAuthFormState } from '../state/slice';\nimport { CollapserCard } from './CollapserCard';\nimport { ConfigHeading } from './ConfigHeading';\nexport const readyToLogin =\n 'OAuth is configured but your browser session is not authenticated. Click Login.';\n\ninterface ConfigFormProps {\n /** A set state callback which allows for editing, setting or clearing OAuth configuration parameters if present */\n setHasConfig?: Dispatch<boolean>;\n /** Local storage key value for storing config parameters */\n configKey: string;\n /** OAuth client id */\n clientId: string;\n /** OAuth client display label */\n clientLabel: string;\n}\n\nexport const OAuthForm = ({\n setHasConfig,\n clientId,\n clientLabel,\n configKey,\n}: ConfigFormProps) => {\n const location = useLocation();\n const redirect_uri = appPath(location, '/oauth');\n const appConfig = `// client_guid=${clientId}\n {\n \"redirect_uri\": \"${redirect_uri}\",\n \"display_name\": \"CORS ${clientLabel}\",\n \"description\": \"Looker ${clientLabel} using CORS\",\n \"enabled\": true\n }\n `;\n const adaptor = getEnvAdaptor();\n const sdk = adaptor.sdk;\n\n const {\n initAction,\n setUrlAction,\n clearConfigAction,\n verifyConfigAction,\n clearMessageBarAction,\n saveConfigAction,\n } = useOAuthFormActions();\n const {\n apiServerUrl,\n fetchedUrl,\n webUrl,\n messageBar,\n validationMessages,\n savedConfig,\n } = useOAuthFormState();\n\n const isConfigured = () => {\n return (\n apiServerUrl === savedConfig.base_url &&\n webUrl === savedConfig.looker_url &&\n apiServerUrl !== '' &&\n webUrl !== ''\n );\n };\n\n const handleSave = () => {\n saveConfigAction({\n configKey,\n setHasConfig,\n client_id: clientId,\n redirect_uri,\n });\n };\n\n const handleVerify = () => {\n verifyConfigAction();\n };\n\n const handleClear = async () => {\n clearConfigAction({\n configKey,\n setHasConfig: setHasConfig,\n isAuthenticated: isAuthenticated(),\n });\n };\n\n const handleUrlChange = (event: FormEvent<HTMLInputElement>) => {\n setUrlAction({\n name: event.currentTarget.name,\n value: event.currentTarget.value,\n });\n };\n\n const isAuthenticated = () => sdk.authSession.isAuthenticated();\n\n const verifyButtonDisabled =\n apiServerUrl.trim().length === 0 ||\n Object.keys(validationMessages).length > 0;\n\n const saveButtonDisabled =\n verifyButtonDisabled || webUrl.trim().length === 0 || isConfigured();\n\n const clearButtonDisabled = apiServerUrl.trim().length === 0;\n\n const loginButtonDisabled =\n verifyButtonDisabled || !isConfigured() || isAuthenticated();\n\n const handleLogin = async (e: BaseSyntheticEvent) => {\n e.preventDefault();\n // This will set storage variables and return to OAuthScene when successful\n await adaptor.login();\n };\n\n useEffect(() => {\n initAction(configKey);\n }, [configKey, initAction]);\n\n return (\n <SpaceVertical gap=\"u2\">\n <ConfigHeading>Looker OAuth Configuration</ConfigHeading>\n <Span fontSize=\"small\">\n To configure Looker OAuth, you need to supply your API server URL, then\n authenticate into your Looker Instance\n </Span>\n <MessageBar\n intent={messageBar.intent}\n onPrimaryClick={clearMessageBarAction}\n visible={messageBar.text !== ''}\n >\n {messageBar.text}\n </MessageBar>\n <CollapserCard\n heading=\"1. Supply API Server URL\"\n id=\"server_config\"\n divider={false}\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical gap=\"u2\" pt=\"u3\" px=\"u6\">\n <Form validationMessages={validationMessages}>\n <Fieldset legend=\"Server locations\">\n <FieldText\n required\n label=\"API server URL\"\n placeholder=\"typically https://myserver.looker.com:19999\"\n name=\"baseUrl\"\n value={apiServerUrl}\n onChange={handleUrlChange}\n />\n <FieldText\n label=\"OAuth server URL\"\n placeholder=\"Click 'Verify' to retrieve\"\n name=\"webUrl\"\n value={webUrl}\n disabled\n />\n </Fieldset>\n </Form>\n {fetchedUrl && (\n <>\n <Paragraph fontSize=\"small\">\n On {fetchedUrl}, enable {clientLabel} as a{' '}\n <Link\n href=\"https://github.com/looker-open-source/sdk-codegen/blob/main/docs/cors.md#reference-implementation\"\n target=\"_blank\"\n >\n Looker OAuth client\n </Link>{' '}\n by adding \"{(window as any).location.origin}\" to the{' '}\n <Link href={`${webUrl}/admin/embed`} target=\"_blank\">\n Embedded Domain Allowlist\n </Link>\n . If API Explorer is also installed, the configuration below can\n be used to{' '}\n <Link\n href={`${fetchedUrl}/extensions/marketplace_extension_api_explorer::api-explorer/4.0/methods/Auth/register_oauth_client_app`}\n target=\"_blank\"\n >\n register this API Explorer instance\n </Link>{' '}\n as an OAuth client.\n </Paragraph>\n <CodeCopy key=\"appConfig\" language=\"json\" code={appConfig} />\n </>\n )}\n <Space>\n <Tooltip content=\"Clear the configuration values\">\n <ButtonTransparent\n onClick={handleClear}\n disabled={clearButtonDisabled}\n >\n Clear\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content={`Verify ${apiServerUrl}`}>\n <ButtonTransparent\n disabled={verifyButtonDisabled}\n onClick={handleVerify}\n mr=\"small\"\n >\n Verify\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content=\"Save the configuration for this browser\">\n <Button\n disabled={saveButtonDisabled}\n onClick={handleSave}\n mr=\"small\"\n >\n Save\n </Button>\n </Tooltip>\n </Space>\n </SpaceVertical>\n </CollapserCard>\n <Divider appearance=\"light\" />\n <CollapserCard\n heading=\"2. Login to instance\"\n divider={false}\n id=\"login_section\"\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical pt=\"u3\" px=\"u6\">\n {isAuthenticated() ? (\n <Span>You are already logged in. Reload the page to log out.</Span>\n ) : isConfigured() ? (\n <>\n <Span>{readyToLogin}</Span>\n </>\n ) : (\n <Span>\n You will be able to login after you Verify your API Server URL\n </Span>\n )}\n <Tooltip content={`Login to ${webUrl} using OAuth`}>\n <Button onClick={handleLogin} disabled={loginButtonDisabled}>\n Login\n </Button>\n </Tooltip>\n </SpaceVertical>\n </CollapserCard>\n </SpaceVertical>\n );\n};\n"],"mappings":";;AA0BA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,IAAI,EACJC,OAAO,QACF,oBAAoB;AAC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AAgF,aAAA,CAAAhF,KAAA,CAAAmG,QAAA,QACEnG,KAAA,CAAAgF,aAAA,CAACnE,IAAI,QAAEU,YAAmB,CAC1B,CAAC,GAEHvB,KAAA,CAAAgF,aAAA,CAACnE,IAAI,QAAC,gEAEA,CACP,EACDb,KAAA,CAAAgF,aAAA,CAAClE,OAAO;IAAC6F,OAAO,cAAA1E,MAAA,CAAcW,MAAM;EAAe,GACjD5C,KAAA,CAAAgF,aAAA,CAAC9E,MAAM;IAAC0G,OAAO,EAAElC,WAAY;IAACwB,QAAQ,EAAEzB;EAAoB,GAAC,OAErD,CACD,CACI,CACF,CACF,CAAC;AAEpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"OAuthForm.js","names":["React","useEffect","Button","ButtonTransparent","Divider","FieldText","Fieldset","Form","Link","MessageBar","Paragraph","Space","SpaceVertical","Span","Tooltip","CodeCopy","useLocation","appPath","getEnvAdaptor","useOAuthFormActions","useOAuthFormState","CollapserCard","ConfigHeading","readyToLogin","OAuthForm","_ref","setHasConfig","clientId","clientLabel","configKey","location","redirect_uri","appConfig","concat","adaptor","sdk","initAction","setUrlAction","clearConfigAction","verifyConfigAction","clearMessageBarAction","saveConfigAction","apiServerUrl","fetchedUrl","webUrl","messageBar","validationMessages","savedConfig","isConfigured","base_url","looker_url","handleSave","client_id","handleVerify","handleClear","_ref2","_asyncToGenerator","isAuthenticated","apply","arguments","handleUrlChange","event","name","currentTarget","value","authSession","verifyButtonDisabled","trim","length","Object","keys","saveButtonDisabled","clearButtonDisabled","loginButtonDisabled","handleLogin","_ref3","e","preventDefault","login","_x","createElement","gap","fontSize","intent","onPrimaryClick","visible","text","heading","id","divider","defaultOpen","pt","px","legend","required","label","placeholder","onChange","disabled","Fragment","href","target","window","origin","key","language","code","content","onClick","mr","appearance"],"sources":["../../../../../src/OAuthForm/src/components/OAuthForm.tsx"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { BaseSyntheticEvent, Dispatch, FormEvent } from 'react';\nimport React, { useEffect } from 'react';\nimport {\n Button,\n ButtonTransparent,\n Divider,\n FieldText,\n Fieldset,\n Form,\n Link,\n MessageBar,\n Paragraph,\n Space,\n SpaceVertical,\n Span,\n Tooltip,\n} from '@looker/components';\nimport { CodeCopy } from '@looker/code-editor';\nimport { useLocation } from 'react-router-dom';\nimport { appPath, getEnvAdaptor } from '../../..';\nimport { useOAuthFormActions, useOAuthFormState } from '../state/slice';\nimport { CollapserCard } from './CollapserCard';\nimport { ConfigHeading } from './ConfigHeading';\nexport const readyToLogin =\n 'OAuth is configured but your browser session is not authenticated. Click Login.';\n\ninterface ConfigFormProps {\n /** A set state callback which allows for editing, setting or clearing OAuth configuration parameters if present */\n setHasConfig?: Dispatch<boolean>;\n /** Local storage key value for storing config parameters */\n configKey: string;\n /** OAuth client id */\n clientId: string;\n /** OAuth client display label */\n clientLabel: string;\n}\n\nexport const OAuthForm = ({\n setHasConfig,\n clientId,\n clientLabel,\n configKey,\n}: ConfigFormProps) => {\n const location = useLocation();\n const redirect_uri = appPath(location, '/oauth');\n const appConfig = `// client_guid=${clientId}\n {\n \"redirect_uri\": \"${redirect_uri}\",\n \"display_name\": \"CORS ${clientLabel}\",\n \"description\": \"Looker ${clientLabel} using CORS\",\n \"enabled\": true\n }\n `;\n const adaptor = getEnvAdaptor();\n const sdk = adaptor.sdk;\n\n const {\n initAction,\n setUrlAction,\n clearConfigAction,\n verifyConfigAction,\n clearMessageBarAction,\n saveConfigAction,\n } = useOAuthFormActions();\n const {\n apiServerUrl,\n fetchedUrl,\n webUrl,\n messageBar,\n validationMessages,\n savedConfig,\n } = useOAuthFormState();\n\n const isConfigured = () => {\n return (\n apiServerUrl === savedConfig.base_url &&\n webUrl === savedConfig.looker_url &&\n apiServerUrl !== '' &&\n webUrl !== ''\n );\n };\n\n const handleSave = () => {\n saveConfigAction({\n configKey,\n setHasConfig,\n client_id: clientId,\n redirect_uri,\n });\n };\n\n const handleVerify = () => {\n verifyConfigAction();\n };\n\n const handleClear = async () => {\n clearConfigAction({\n configKey,\n setHasConfig: setHasConfig,\n isAuthenticated: isAuthenticated(),\n });\n };\n\n const handleUrlChange = (event: FormEvent<HTMLInputElement>) => {\n setUrlAction({\n name: event.currentTarget.name,\n value: event.currentTarget.value,\n });\n };\n\n const isAuthenticated = () => sdk.authSession.isAuthenticated();\n\n const verifyButtonDisabled =\n apiServerUrl.trim().length === 0 ||\n Object.keys(validationMessages).length > 0;\n\n const saveButtonDisabled =\n verifyButtonDisabled || webUrl.trim().length === 0 || isConfigured();\n\n const clearButtonDisabled = apiServerUrl.trim().length === 0;\n\n const loginButtonDisabled =\n verifyButtonDisabled || !isConfigured() || isAuthenticated();\n\n const handleLogin = async (e: BaseSyntheticEvent) => {\n e.preventDefault();\n // This will set storage variables and return to OAuthScene when successful\n await adaptor.login();\n };\n\n useEffect(() => {\n initAction(configKey);\n }, [configKey, initAction]);\n\n return (\n <SpaceVertical gap=\"u2\">\n <ConfigHeading>Looker OAuth Configuration</ConfigHeading>\n <Span fontSize=\"small\">\n To configure Looker OAuth, you need to supply your API server URL, then\n authenticate into your Looker Instance\n </Span>\n <MessageBar\n intent={messageBar.intent}\n onPrimaryClick={clearMessageBarAction}\n visible={messageBar.text !== ''}\n >\n {messageBar.text}\n </MessageBar>\n <CollapserCard\n heading=\"1. Supply API Server URL\"\n id=\"server_config\"\n divider={false}\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical gap=\"u2\" pt=\"u3\" px=\"u6\">\n <Form validationMessages={validationMessages}>\n <Fieldset legend=\"Server locations\">\n <FieldText\n required\n label=\"API server URL\"\n placeholder=\"typically https://myserver.looker.com:19999\"\n name=\"baseUrl\"\n value={apiServerUrl}\n onChange={handleUrlChange}\n />\n <FieldText\n label=\"OAuth server URL\"\n placeholder=\"Click 'Verify' to retrieve\"\n name=\"webUrl\"\n value={webUrl}\n disabled\n />\n </Fieldset>\n </Form>\n {fetchedUrl && (\n <>\n <Paragraph fontSize=\"small\">\n On {fetchedUrl}, enable {clientLabel} as a{' '}\n <Link\n href=\"https://github.com/looker-open-source/sdk-codegen/blob/main/docs/cors.md#reference-implementation\"\n target=\"_blank\"\n >\n Looker OAuth client\n </Link>{' '}\n by adding \"{(window as any).location.origin}\" to the{' '}\n <Link href={`${webUrl}/admin/embed`} target=\"_blank\">\n Embedded Domain Allowlist\n </Link>\n . If API Explorer is also installed, the configuration below can\n be used to{' '}\n <Link\n href={`${fetchedUrl}/extensions/marketplace_extension_api_explorer::api-explorer/4.0/methods/Auth/register_oauth_client_app`}\n target=\"_blank\"\n >\n register this API Explorer instance\n </Link>{' '}\n as an OAuth client.\n </Paragraph>\n <CodeCopy key=\"appConfig\" language=\"json\" code={appConfig} />\n </>\n )}\n <Space>\n <Tooltip content=\"Clear the configuration values\">\n <ButtonTransparent\n onClick={handleClear}\n disabled={clearButtonDisabled}\n >\n Clear\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content={`Verify ${apiServerUrl}`}>\n <ButtonTransparent\n disabled={verifyButtonDisabled}\n onClick={handleVerify}\n mr=\"small\"\n >\n Verify\n </ButtonTransparent>\n </Tooltip>\n <Tooltip content=\"Save the configuration for this browser\">\n <Button\n disabled={saveButtonDisabled}\n onClick={handleSave}\n mr=\"small\"\n >\n Save\n </Button>\n </Tooltip>\n </Space>\n </SpaceVertical>\n </CollapserCard>\n <Divider appearance=\"light\" />\n <CollapserCard\n heading=\"2. Login to instance\"\n divider={false}\n id=\"login_section\"\n defaultOpen={!isAuthenticated()}\n >\n <SpaceVertical pt=\"u3\" px=\"u6\">\n {isAuthenticated() ? (\n <Span>You are already logged in. Reload the page to log out.</Span>\n ) : isConfigured() ? (\n <>\n <Span>{readyToLogin}</Span>\n </>\n ) : (\n <Span>\n You will be able to login after you Verify your API Server URL\n </Span>\n )}\n <Tooltip content={`Login to ${webUrl} using OAuth`}>\n <Button onClick={handleLogin} disabled={loginButtonDisabled}>\n Login\n </Button>\n </Tooltip>\n </SpaceVertical>\n </CollapserCard>\n </SpaceVertical>\n );\n};\n"],"mappings":";;AA0BA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,IAAI,EACJC,OAAO,QACF,oBAAoB;AAC3B,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,SAASC,OAAO,EAAEC,aAAa,QAAQ,UAAU;AACjD,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,gBAAgB;AACvE,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,OAAO,IAAMC,YAAY,GACvB,iFAAiF;AAanF,OAAO,IAAMC,SAAS,GAAGC,IAAA,IAKF;EAAA,IALG;IACxBC,YAAY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,EAAEzB;EAAoB,GAAC,OAErD,CACD,CACI,CACF,CACF,CAAC;AAEpB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["OAuthForm"],"sources":["../../../../../src/OAuthForm/src/components/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport { OAuthForm } from './OAuthForm';\n"],"mappings":"AAyBA,SAASA,SAAS,QAAQ,aAAa"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["OAuthForm"],"sources":["../../../../../src/OAuthForm/src/components/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport { OAuthForm } from './OAuthForm';\n"],"mappings":"AAyBA,SAASA,SAAS,QAAQ,aAAa","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/OAuthForm/src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport * from './components';\nexport * from './state';\n"],"mappings":"AAyBA,cAAc,cAAc;AAC5B,cAAc,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/OAuthForm/src/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport * from './components';\nexport * from './state';\n"],"mappings":"AAyBA,cAAc,cAAc;AAC5B,cAAc,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["OAuthFormSlice"],"sources":["../../../../../src/OAuthForm/src/state/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport { OAuthFormSlice } from './slice';\n"],"mappings":"AAyBA,SAASA,cAAc,QAAQ,SAAS"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["OAuthFormSlice"],"sources":["../../../../../src/OAuthForm/src/state/index.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nexport { OAuthFormSlice } from './slice';\n"],"mappings":"AAyBA,SAASA,cAAc,QAAQ,SAAS","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sagas.js","names":["call","put","select","takeEvery","getVersions","validateUrl","OAuthFormActions","OAuthFormSlice","getLocalStorageConfig","configKey","EmptyConfig","base_url","looker_url","data","localStorage","getItem","result","JSON","parse","initSaga","action","initSuccessAction","setFailureAction","payload","error","message","setUrlSaga","updateValidationMessages","setUrlActionSuccess","url","value","Error","concat","elementName","name","newMessage","type","clearConfigSaga","clearConfigActionSuccess","updateMessageBarAction","setHasConfig","isAuthenticated","removeItem","intent","text","verifyConfigSaga","apiServerUrl","storeState","formState","verifyConfigActionFailure","verifyConfigActionSuccess","clearMessageBarAction","versionsUrl","versions","web_server_url","saveConfigSaga","saveConfigActionSuccess","client_id","redirect_uri","api_server_url","setItem","stringify","saga","initAction","setUrlAction","clearConfigAction","verifyConfigAction","saveConfigAction"],"sources":["../../../../../src/OAuthForm/src/state/sagas.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { call, put, select, takeEvery } from 'typed-redux-saga';\nimport type { ConfigValues } from '../utils';\nimport { getVersions, validateUrl } from '../utils';\nimport type {\n ClearConfigActionPayload,\n OAuthFormState,\n SaveConfigPayload,\n SetUrlActionPayload,\n} from './slice';\nimport { OAuthFormActions, OAuthFormSlice } from './slice';\n\n/**\n * get saved configData from localStorage key\n * @param configKey key that config will be saved under in local storage\n * @returns\n */\nconst getLocalStorageConfig = (configKey: string): ConfigValues => {\n const EmptyConfig = {\n base_url: '',\n looker_url: '',\n };\n const data = localStorage.getItem(configKey);\n const result = data ? JSON.parse(data) : EmptyConfig;\n\n return result;\n};\n\n/**\n * checks for saved configData in localStorage\n */\nfunction* initSaga(action: PayloadAction<string>) {\n const { initSuccessAction, setFailureAction } = OAuthFormActions;\n try {\n const result = yield* call(getLocalStorageConfig, action.payload);\n yield* put(initSuccessAction(result));\n } catch (error: any) {\n yield* put(setFailureAction(error.message));\n }\n}\n\n/**\n * updates the new url and adds or removes form validation message\n * @param action containing name and value of form element changed\n */\nfunction* setUrlSaga(action: PayloadAction<SetUrlActionPayload>) {\n const { updateValidationMessages, setUrlActionSuccess } = OAuthFormActions;\n try {\n const url = validateUrl(action.payload.value);\n if (!url) throw new Error(`${action.payload.value} is not a valid url`);\n\n // clear the error message if one was there\n yield* put(\n updateValidationMessages({\n elementName: action.payload.name,\n newMessage: null,\n })\n );\n } catch (error: any) {\n yield* put(\n updateValidationMessages({\n elementName: action.payload.name,\n newMessage: {\n message: error.message,\n type: 'error',\n },\n })\n );\n } finally {\n // update the form element\n const url = validateUrl(action.payload.value);\n yield* put(setUrlActionSuccess(url || action.payload.value));\n }\n}\n\n/**\n * clears form, removes local storage config key and triggers callback function\n * @param action containing the localstorage key to clear, a callback function, and if the user is already authenticated\n */\nfunction* clearConfigSaga(action: PayloadAction<ClearConfigActionPayload>) {\n const { clearConfigActionSuccess, setFailureAction, updateMessageBarAction } =\n OAuthFormActions;\n try {\n const { configKey, setHasConfig, isAuthenticated } = action.payload;\n localStorage.removeItem(configKey);\n if (setHasConfig) setHasConfig(false);\n if (isAuthenticated) {\n yield* put(\n updateMessageBarAction({\n intent: 'warn',\n text: 'Please reload the browser page to log out',\n })\n );\n }\n yield* put(clearConfigActionSuccess());\n } catch (error: any) {\n yield* put(setFailureAction(error.message));\n }\n}\n\n/**\n * verify button clicked, verifies apiServerUrl and populates OAuth server URL if valid\n */\nfunction* verifyConfigSaga() {\n const apiServerUrl = yield* select(storeState => {\n const formState: OAuthFormState = storeState[OAuthFormSlice.name];\n return formState.apiServerUrl;\n });\n const {\n verifyConfigActionFailure,\n verifyConfigActionSuccess,\n clearMessageBarAction,\n } = OAuthFormActions;\n\n try {\n yield* put(clearMessageBarAction());\n const versionsUrl = `${apiServerUrl}/versions`;\n\n const versions = yield* call(getVersions, versionsUrl);\n if (!versions) throw new Error();\n\n yield* put(verifyConfigActionSuccess(versions.web_server_url));\n } catch (error: any) {\n yield* put(verifyConfigActionFailure(error.message));\n }\n}\n\n/**\n * save button clicked, verify api server url and if valid save config data to localstorage\n * @param action containing configKey, callback function, client_id and redirect_uri\n */\nfunction* saveConfigSaga(action: PayloadAction<SaveConfigPayload>) {\n const apiServerUrl = yield* select(storeState => {\n const formState: OAuthFormState = storeState[OAuthFormSlice.name];\n return formState.apiServerUrl;\n });\n const {\n verifyConfigActionFailure,\n clearMessageBarAction,\n saveConfigActionSuccess,\n } = OAuthFormActions;\n const { configKey, setHasConfig, client_id, redirect_uri } = action.payload;\n\n try {\n yield* put(clearMessageBarAction());\n const versionsUrl = `${apiServerUrl}/versions`;\n\n const versions = yield* call(getVersions, versionsUrl);\n if (!versions) throw new Error();\n\n const data = {\n base_url: versions.api_server_url,\n looker_url: versions.web_server_url,\n client_id,\n redirect_uri,\n };\n localStorage.setItem(configKey, JSON.stringify(data));\n if (setHasConfig) setHasConfig(true);\n\n yield* put(\n saveConfigActionSuccess({\n base_url: versions.api_server_url,\n looker_url: versions.web_server_url,\n })\n );\n } catch (error: any) {\n yield* put(verifyConfigActionFailure(error.message));\n }\n}\n\nexport function* saga() {\n const {\n initAction,\n setUrlAction,\n clearConfigAction,\n verifyConfigAction,\n saveConfigAction,\n } = OAuthFormActions;\n yield* takeEvery(initAction, initSaga);\n yield* takeEvery(setUrlAction, setUrlSaga);\n yield* takeEvery(clearConfigAction, clearConfigSaga);\n yield* takeEvery(verifyConfigAction, verifyConfigSaga);\n yield* takeEvery(saveConfigAction, saveConfigSaga);\n}\n"],"mappings":"AA0BA,SAASA,IAAI,EAAEC,GAAG,EAAEC,MAAM,EAAEC,SAAS,QAAQ,kBAAkB;AAE/D,SAASC,WAAW,EAAEC,WAAW,QAAQ,UAAU;AAOnD,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,SAAS;AAO1D,IAAMC,qBAAqB,GAAIC,SAAiB,IAAmB;EACjE,IAAMC,WAAW,GAAG;IAClBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACD,IAAMC,IAAI,GAAGC,YAAY,CAACC,OAAO,CAACN,SAAS,CAAC;EAC5C,IAAMO,MAAM,GAAGH,IAAI,GAAGI,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC,GAAGH,WAAW;EAEpD,OAAOM,MAAM;AACf,CAAC;AAKD,UAAUG,QAAQA,CAACC,MAA6B,EAAE;EAChD,IAAM;IAAEC,iBAAiB;IAAEC;EAAiB,CAAC,GAAGhB,gBAAgB;EAChE,IAAI;IACF,IAAMU,MAAM,GAAG,OAAOhB,IAAI,CAACQ,qBAAqB,EAAEY,MAAM,CAACG,OAAO,CAAC;IACjE,OAAOtB,GAAG,CAACoB,iBAA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iBAAiB;IACjBC,kBAAkB;IAClBC;EACF,CAAC,GAAG7D,gBAAgB;EACpB,OAAOH,SAAS,CAAC4D,UAAU,EAAE5C,QAAQ,CAAC;EACtC,OAAOhB,SAAS,CAAC6D,YAAY,EAAEtC,UAAU,CAAC;EAC1C,OAAOvB,SAAS,CAAC8D,iBAAiB,EAAE5B,eAAe,CAAC;EACpD,OAAOlC,SAAS,CAAC+D,kBAAkB,EAAErB,gBAAgB,CAAC;EACtD,OAAO1C,SAAS,CAACgE,gBAAgB,EAAEZ,cAAc,CAAC;AACpD"}
|
|
1
|
+
{"version":3,"file":"sagas.js","names":["call","put","select","takeEvery","getVersions","validateUrl","OAuthFormActions","OAuthFormSlice","getLocalStorageConfig","configKey","EmptyConfig","base_url","looker_url","data","localStorage","getItem","result","JSON","parse","initSaga","action","initSuccessAction","setFailureAction","payload","error","message","setUrlSaga","updateValidationMessages","setUrlActionSuccess","url","value","Error","concat","elementName","name","newMessage","type","clearConfigSaga","clearConfigActionSuccess","updateMessageBarAction","setHasConfig","isAuthenticated","removeItem","intent","text","verifyConfigSaga","apiServerUrl","storeState","formState","verifyConfigActionFailure","verifyConfigActionSuccess","clearMessageBarAction","versionsUrl","versions","web_server_url","saveConfigSaga","saveConfigActionSuccess","client_id","redirect_uri","api_server_url","setItem","stringify","saga","initAction","setUrlAction","clearConfigAction","verifyConfigAction","saveConfigAction"],"sources":["../../../../../src/OAuthForm/src/state/sagas.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport { call, put, select, takeEvery } from 'typed-redux-saga';\nimport type { ConfigValues } from '../utils';\nimport { getVersions, validateUrl } from '../utils';\nimport type {\n ClearConfigActionPayload,\n OAuthFormState,\n SaveConfigPayload,\n SetUrlActionPayload,\n} from './slice';\nimport { OAuthFormActions, OAuthFormSlice } from './slice';\n\n/**\n * get saved configData from localStorage key\n * @param configKey key that config will be saved under in local storage\n * @returns\n */\nconst getLocalStorageConfig = (configKey: string): ConfigValues => {\n const EmptyConfig = {\n base_url: '',\n looker_url: '',\n };\n const data = localStorage.getItem(configKey);\n const result = data ? JSON.parse(data) : EmptyConfig;\n\n return result;\n};\n\n/**\n * checks for saved configData in localStorage\n */\nfunction* initSaga(action: PayloadAction<string>) {\n const { initSuccessAction, setFailureAction } = OAuthFormActions;\n try {\n const result = yield* call(getLocalStorageConfig, action.payload);\n yield* put(initSuccessAction(result));\n } catch (error: any) {\n yield* put(setFailureAction(error.message));\n }\n}\n\n/**\n * updates the new url and adds or removes form validation message\n * @param action containing name and value of form element changed\n */\nfunction* setUrlSaga(action: PayloadAction<SetUrlActionPayload>) {\n const { updateValidationMessages, setUrlActionSuccess } = OAuthFormActions;\n try {\n const url = validateUrl(action.payload.value);\n if (!url) throw new Error(`${action.payload.value} is not a valid url`);\n\n // clear the error message if one was there\n yield* put(\n updateValidationMessages({\n elementName: action.payload.name,\n newMessage: null,\n })\n );\n } catch (error: any) {\n yield* put(\n updateValidationMessages({\n elementName: action.payload.name,\n newMessage: {\n message: error.message,\n type: 'error',\n },\n })\n );\n } finally {\n // update the form element\n const url = validateUrl(action.payload.value);\n yield* put(setUrlActionSuccess(url || action.payload.value));\n }\n}\n\n/**\n * clears form, removes local storage config key and triggers callback function\n * @param action containing the localstorage key to clear, a callback function, and if the user is already authenticated\n */\nfunction* clearConfigSaga(action: PayloadAction<ClearConfigActionPayload>) {\n const { clearConfigActionSuccess, setFailureAction, updateMessageBarAction } =\n OAuthFormActions;\n try {\n const { configKey, setHasConfig, isAuthenticated } = action.payload;\n localStorage.removeItem(configKey);\n if (setHasConfig) setHasConfig(false);\n if (isAuthenticated) {\n yield* put(\n updateMessageBarAction({\n intent: 'warn',\n text: 'Please reload the browser page to log out',\n })\n );\n }\n yield* put(clearConfigActionSuccess());\n } catch (error: any) {\n yield* put(setFailureAction(error.message));\n }\n}\n\n/**\n * verify button clicked, verifies apiServerUrl and populates OAuth server URL if valid\n */\nfunction* verifyConfigSaga() {\n const apiServerUrl = yield* select(storeState => {\n const formState: OAuthFormState = storeState[OAuthFormSlice.name];\n return formState.apiServerUrl;\n });\n const {\n verifyConfigActionFailure,\n verifyConfigActionSuccess,\n clearMessageBarAction,\n } = OAuthFormActions;\n\n try {\n yield* put(clearMessageBarAction());\n const versionsUrl = `${apiServerUrl}/versions`;\n\n const versions = yield* call(getVersions, versionsUrl);\n if (!versions) throw new Error();\n\n yield* put(verifyConfigActionSuccess(versions.web_server_url));\n } catch (error: any) {\n yield* put(verifyConfigActionFailure(error.message));\n }\n}\n\n/**\n * save button clicked, verify api server url and if valid save config data to localstorage\n * @param action containing configKey, callback function, client_id and redirect_uri\n */\nfunction* saveConfigSaga(action: PayloadAction<SaveConfigPayload>) {\n const apiServerUrl = yield* select(storeState => {\n const formState: OAuthFormState = storeState[OAuthFormSlice.name];\n return formState.apiServerUrl;\n });\n const {\n verifyConfigActionFailure,\n clearMessageBarAction,\n saveConfigActionSuccess,\n } = OAuthFormActions;\n const { configKey, setHasConfig, client_id, redirect_uri } = action.payload;\n\n try {\n yield* put(clearMessageBarAction());\n const versionsUrl = `${apiServerUrl}/versions`;\n\n const versions = yield* call(getVersions, versionsUrl);\n if (!versions) throw new Error();\n\n const data = {\n base_url: versions.api_server_url,\n looker_url: versions.web_server_url,\n client_id,\n redirect_uri,\n };\n localStorage.setItem(configKey, JSON.stringify(data));\n if (setHasConfig) setHasConfig(true);\n\n yield* put(\n saveConfigActionSuccess({\n base_url: versions.api_server_url,\n looker_url: versions.web_server_url,\n })\n );\n } catch (error: any) {\n yield* put(verifyConfigActionFailure(error.message));\n }\n}\n\nexport function* saga() {\n const {\n initAction,\n setUrlAction,\n clearConfigAction,\n verifyConfigAction,\n saveConfigAction,\n } = OAuthFormActions;\n yield* takeEvery(initAction, initSaga);\n yield* takeEvery(setUrlAction, setUrlSaga);\n yield* takeEvery(clearConfigAction, clearConfigSaga);\n yield* takeEvery(verifyConfigAction, verifyConfigSaga);\n yield* takeEvery(saveConfigAction, saveConfigSaga);\n}\n"],"mappings":"AA0BA,SAASA,IAAI,EAAEC,GAAG,EAAEC,MAAM,EAAEC,SAAS,QAAQ,kBAAkB;AAE/D,SAASC,WAAW,EAAEC,WAAW,QAAQ,UAAU;AAOnD,SAASC,gBAAgB,EAAEC,cAAc,QAAQ,SAAS;AAO1D,IAAMC,qBAAqB,GAAIC,SAAiB,IAAmB;EACjE,IAAMC,WAAW,GAAG;IAClBC,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACD,IAAMC,IAAI,GAAGC,YAAY,CAACC,OAAO,CAACN,SAAS,CAAC;EAC5C,IAAMO,MAAM,GAAGH,IAAI,GAAGI,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC,GAAGH,WAAW;EAEpD,OAAOM,MAAM;AACf,CAAC;AAKD,UAAUG,QAAQA,CAACC,MAA6B,EAAE;EAChD,IAAM;IAAEC,iBAAiB;IAAEC;EAAiB,CAAC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G,CAACgD,yBAAyB,CAACzB,KAAK,CAACC,OAAO,CAAC,CAAC;EACtD;AACF;AAEA,OAAO,UAAUqC,IAAIA,CAAA,EAAG;EACtB,IAAM;IACJC,UAAU;IACVC,YAAY;IACZC,iBAAiB;IACjBC,kBAAkB;IAClBC;EACF,CAAC,GAAG7D,gBAAgB;EACpB,OAAOH,SAAS,CAAC4D,UAAU,EAAE5C,QAAQ,CAAC;EACtC,OAAOhB,SAAS,CAAC6D,YAAY,EAAEtC,UAAU,CAAC;EAC1C,OAAOvB,SAAS,CAAC8D,iBAAiB,EAAE5B,eAAe,CAAC;EACpD,OAAOlC,SAAS,CAAC+D,kBAAkB,EAAErB,gBAAgB,CAAC;EACtD,OAAO1C,SAAS,CAACgE,gBAAgB,EAAEZ,cAAc,CAAC;AACpD","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import { createSliceHooks } from '@looker/redux';
|
|
7
7
|
import { createSlice } from '@reduxjs/toolkit';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice.js","names":["createSliceHooks","createSlice","omit","saga","SLICE_NAME","defaultOAuthFormState","apiServerUrl","fetchedUrl","webUrl","messageBar","text","intent","validationMessages","savedConfig","base_url","looker_url","OAuthFormSlice","name","initialState","reducers","initAction","_state","_action","initSuccessAction","state","action","payload","setUrlAction","setUrlActionSuccess","updateValidationMessages","newValidationMessages","newMessage","elementName","clearConfigAction","clearConfigActionSuccess","_objectSpread","verifyConfigAction","concat","verifyConfigActionSuccess","verifyConfigActionFailure","saveConfigAction","saveConfigActionSuccess","clearMessageBarAction","updateMessageBarAction","setFailureAction","OAuthFormActions","actions","useActions","useOAuthFormActions","useStoreState","useOAuthFormState"],"sources":["../../../../../src/OAuthForm/src/state/slice.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { Dispatch } from 'react';\nimport { createSliceHooks } from '@looker/redux';\nimport { createSlice } from '@reduxjs/toolkit';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport type {\n MessageBarIntent,\n ValidationMessageProps,\n ValidationMessages,\n} from '@looker/components';\nimport omit from 'lodash/omit';\nimport type { ConfigValues } from '../utils';\nimport { saga } from './sagas';\n\nexport const SLICE_NAME = 'OAuthForm';\nexport interface MessageBarData {\n intent: MessageBarIntent;\n text: string;\n}\n\nexport interface OAuthFormState {\n apiServerUrl: string;\n fetchedUrl: string;\n webUrl: string;\n messageBar: MessageBarData;\n validationMessages: ValidationMessages;\n savedConfig: ConfigValues;\n}\n\nexport const defaultOAuthFormState: OAuthFormState = {\n apiServerUrl: '',\n fetchedUrl: '',\n webUrl: '',\n messageBar: {\n text: '',\n intent: 'positive',\n },\n validationMessages: {},\n savedConfig: { base_url: '', looker_url: '' },\n};\n\nexport interface ClearConfigActionPayload {\n configKey: string;\n setHasConfig?: Dispatch<boolean>;\n isAuthenticated: boolean;\n}\n\nexport interface SetUrlActionPayload {\n name: string;\n value: string;\n}\n\ninterface UpdateValidationMessagesPayload {\n elementName: string;\n newMessage: ValidationMessageProps | null;\n}\n\nexport interface SaveConfigPayload {\n configKey: string;\n setHasConfig?: Dispatch<boolean>;\n client_id: string;\n redirect_uri: string;\n}\n\nexport interface SaveConfigSuccessPayload {\n base_url: string;\n looker_url: string;\n}\n\nexport const OAuthFormSlice = createSlice({\n name: SLICE_NAME,\n initialState: defaultOAuthFormState,\n reducers: {\n initAction(_state, _action: PayloadAction<string>) {\n // noop\n },\n initSuccessAction(state, action: PayloadAction<ConfigValues>) {\n state.apiServerUrl = action.payload.base_url;\n state.webUrl = action.payload.looker_url;\n },\n setUrlAction(_state, _action: PayloadAction<SetUrlActionPayload>) {\n // noop\n },\n setUrlActionSuccess(state, action: PayloadAction<string>) {\n state.apiServerUrl = action.payload;\n state.webUrl = '';\n },\n updateValidationMessages(\n state,\n action: PayloadAction<UpdateValidationMessagesPayload>\n ) {\n let newValidationMessages = state.validationMessages;\n\n if (action.payload.newMessage !== null) {\n newValidationMessages[action.payload.elementName] =\n action.payload.newMessage;\n } else {\n newValidationMessages = omit(\n newValidationMessages,\n action.payload.elementName\n );\n }\n state.validationMessages = newValidationMessages;\n },\n clearConfigAction(\n _state,\n _action: PayloadAction<ClearConfigActionPayload>\n ) {\n // noop\n },\n clearConfigActionSuccess() {\n return { ...defaultOAuthFormState };\n },\n verifyConfigAction(state) {\n state.fetchedUrl = `${state.apiServerUrl}/versions`;\n },\n verifyConfigActionSuccess(state, action: PayloadAction<string>) {\n state.messageBar = {\n intent: 'positive',\n text: `Configuration is valid`,\n };\n state.webUrl = action.payload;\n },\n verifyConfigActionFailure(state, action: PayloadAction<string>) {\n state.messageBar = { intent: 'critical', text: action.payload };\n state.webUrl = '';\n },\n saveConfigAction(_state, _action: PayloadAction<SaveConfigPayload>) {\n // noop\n },\n saveConfigActionSuccess(\n state,\n action: PayloadAction<SaveConfigSuccessPayload>\n ) {\n const { base_url, looker_url } = action.payload;\n state.savedConfig = {\n base_url,\n looker_url,\n };\n state.messageBar = {\n intent: 'positive',\n text: `Saved ${looker_url} as OAuth server`,\n };\n },\n clearMessageBarAction(state) {\n state.messageBar.text = '';\n },\n updateMessageBarAction(state, action: PayloadAction<MessageBarData>) {\n state.messageBar = action.payload;\n },\n setFailureAction(state, action: PayloadAction<string>) {\n state.messageBar = { intent: 'critical', text: action.payload };\n },\n },\n});\n\nexport const OAuthFormActions = OAuthFormSlice.actions;\nexport const {\n useActions: useOAuthFormActions,\n useStoreState: useOAuthFormState,\n} = createSliceHooks(OAuthFormSlice,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;QAClBD,IAAI,WAAA2B,MAAA,CAAWtB,UAAU;MAC3B,CAAC;IACH,CAAC;IACD2B,qBAAqBA,CAAClB,KAAK,EAAE;MAC3BA,KAAK,CAACf,UAAU,CAACC,IAAI,GAAG,EAAE;IAC5B,CAAC;IACDiC,sBAAsBA,CAACnB,KAAK,EAAEC,MAAqC,EAAE;MACnED,KAAK,CAACf,UAAU,GAAGgB,MAAM,CAACC,OAAO;IACnC,CAAC;IACDkB,gBAAgBA,CAACpB,KAAK,EAAEC,MAA6B,EAAE;MACrDD,KAAK,CAACf,UAAU,GAAG;QAAEE,MAAM,EAAE,UAAU;QAAED,IAAI,EAAEe,MAAM,CAACC;MAAQ,CAAC;IACjE;EACF;AACF,CAAC,CAAC;AAEF,OAAO,IAAMmB,gBAAgB,GAAG7B,cAAc,CAAC8B,OAAO;AACtD,OAAO,IAAM;EACXC,UAAU,EAAEC,mBAAmB;EAC/BC,aAAa,EAAEC;AACjB,CAAC,GAAGlD,gBAAgB,CAACgB,cAAc,EAAEb,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"slice.js","names":["createSliceHooks","createSlice","omit","saga","SLICE_NAME","defaultOAuthFormState","apiServerUrl","fetchedUrl","webUrl","messageBar","text","intent","validationMessages","savedConfig","base_url","looker_url","OAuthFormSlice","name","initialState","reducers","initAction","_state","_action","initSuccessAction","state","action","payload","setUrlAction","setUrlActionSuccess","updateValidationMessages","newValidationMessages","newMessage","elementName","clearConfigAction","clearConfigActionSuccess","_objectSpread","verifyConfigAction","concat","verifyConfigActionSuccess","verifyConfigActionFailure","saveConfigAction","saveConfigActionSuccess","clearMessageBarAction","updateMessageBarAction","setFailureAction","OAuthFormActions","actions","useActions","useOAuthFormActions","useStoreState","useOAuthFormState"],"sources":["../../../../../src/OAuthForm/src/state/slice.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport type { Dispatch } from 'react';\nimport { createSliceHooks } from '@looker/redux';\nimport { createSlice } from '@reduxjs/toolkit';\nimport type { PayloadAction } from '@reduxjs/toolkit';\nimport type {\n MessageBarIntent,\n ValidationMessageProps,\n ValidationMessages,\n} from '@looker/components';\nimport omit from 'lodash/omit';\nimport type { ConfigValues } from '../utils';\nimport { saga } from './sagas';\n\nexport const SLICE_NAME = 'OAuthForm';\nexport interface MessageBarData {\n intent: MessageBarIntent;\n text: string;\n}\n\nexport interface OAuthFormState {\n apiServerUrl: string;\n fetchedUrl: string;\n webUrl: string;\n messageBar: MessageBarData;\n validationMessages: ValidationMessages;\n savedConfig: ConfigValues;\n}\n\nexport const defaultOAuthFormState: OAuthFormState = {\n apiServerUrl: '',\n fetchedUrl: '',\n webUrl: '',\n messageBar: {\n text: '',\n intent: 'positive',\n },\n validationMessages: {},\n savedConfig: { base_url: '', looker_url: '' },\n};\n\nexport interface ClearConfigActionPayload {\n configKey: string;\n setHasConfig?: Dispatch<boolean>;\n isAuthenticated: boolean;\n}\n\nexport interface SetUrlActionPayload {\n name: string;\n value: string;\n}\n\ninterface UpdateValidationMessagesPayload {\n elementName: string;\n newMessage: ValidationMessageProps | null;\n}\n\nexport interface SaveConfigPayload {\n configKey: string;\n setHasConfig?: Dispatch<boolean>;\n client_id: string;\n redirect_uri: string;\n}\n\nexport interface SaveConfigSuccessPayload {\n base_url: string;\n looker_url: string;\n}\n\nexport const OAuthFormSlice = createSlice({\n name: SLICE_NAME,\n initialState: defaultOAuthFormState,\n reducers: {\n initAction(_state, _action: PayloadAction<string>) {\n // noop\n },\n initSuccessAction(state, action: PayloadAction<ConfigValues>) {\n state.apiServerUrl = action.payload.base_url;\n state.webUrl = action.payload.looker_url;\n },\n setUrlAction(_state, _action: PayloadAction<SetUrlActionPayload>) {\n // noop\n },\n setUrlActionSuccess(state, action: PayloadAction<string>) {\n state.apiServerUrl = action.payload;\n state.webUrl = '';\n },\n updateValidationMessages(\n state,\n action: PayloadAction<UpdateValidationMessagesPayload>\n ) {\n let newValidationMessages = state.validationMessages;\n\n if (action.payload.newMessage !== null) {\n newValidationMessages[action.payload.elementName] =\n action.payload.newMessage;\n } else {\n newValidationMessages = omit(\n newValidationMessages,\n action.payload.elementName\n );\n }\n state.validationMessages = newValidationMessages;\n },\n clearConfigAction(\n _state,\n _action: PayloadAction<ClearConfigActionPayload>\n ) {\n // noop\n },\n clearConfigActionSuccess() {\n return { ...defaultOAuthFormState };\n },\n verifyConfigAction(state) {\n state.fetchedUrl = `${state.apiServerUrl}/versions`;\n },\n verifyConfigActionSuccess(state, action: PayloadAction<string>) {\n state.messageBar = {\n intent: 'positive',\n text: `Configuration is valid`,\n };\n state.webUrl = action.payload;\n },\n verifyConfigActionFailure(state, action: PayloadAction<string>) {\n state.messageBar = { intent: 'critical', text: action.payload };\n state.webUrl = '';\n },\n saveConfigAction(_state, _action: PayloadAction<SaveConfigPayload>) {\n // noop\n },\n saveConfigActionSuccess(\n state,\n action: PayloadAction<SaveConfigSuccessPayload>\n ) {\n const { base_url, looker_url } = action.payload;\n state.savedConfig = {\n base_url,\n looker_url,\n };\n state.messageBar = {\n intent: 'positive',\n text: `Saved ${looker_url} as OAuth server`,\n };\n },\n clearMessageBarAction(state) {\n state.messageBar.text = '';\n },\n updateMessageBarAction(state, action: PayloadAction<MessageBarData>) {\n state.messageBar = action.payload;\n },\n setFailureAction(state, action: PayloadAction<string>) {\n state.messageBar = { intent: 'critical', text: action.payload };\n },\n },\n});\n\nexport const OAuthFormActions = OAuthFormSlice.actions;\nexport const {\n useActions: useOAuthFormActions,\n useStoreState: useOAuthFormState,\n} = createSliceHooks(OAuthFormSlice, saga);\n"],"mappings":";;;;;AA0BA,SAASA,gBAAgB,QAAQ,eAAe;AAChD,SAASC,WAAW,QAAQ,kBAAkB;AAO9C,OAAOC,IAAI,MAAM,aAAa;AAE9B,SAASC,IAAI,QAAQ,SAAS;AAE9B,OAAO,IAAMC,UAAU,GAAG,WAAW;AAerC,OAAO,IAAMC,qBAAqC,GAAG;EACnDC,YAAY,EAAE,EAAE;EAChBC,UAAU,EAAE,EAAE;EACdC,MAAM,EAAE,EAAE;EACVC,UAAU,EAAE;IACVC,IAAI,EAAE,EAAE;IACRC,MAAM,EAAE;EACV,CAAC;EACDC,kBAAkB,EAAE,CAAC,CAAC;EACtBC,WAAW,EAAE;IAAEC,QAAQ,EAAE,EAAE;IAAEC,UAAU,EAAE;EAAG;AAC9C,CAAC;AA8BD,OAAO,IAAMC,cAAc,GAAGf,WAAW,CAAC;EACxCgB,IAAI,EAAEb,UAAU;EAChBc,YAAY,EAAEb,qBAAqB;EACnCc,QAAQ,EAAE;IACRC,UAAUA,CAACC,MAAM,EAAEC,OAA8B,EAAE,CAEnD,CAAC;IACDC,iBAAiBA,CAACC,KAAK,EAAEC,MAAmC,EAAE;MAC5DD,KAAK,CAAClB,YAAY,GAAGmB,MAAM,CAACC,OAAO,CAACZ,QAAQ;MAC5CU,KAAK,CAAChB,MAAM,GAAGiB,MAAM,CAACC,OAAO,CAACX,UAAU;IAC1C,CAAC;IACDY,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AAC;MAC/DF,KAAK,CAAChB,MAAM,GAAG,EAAE;IACnB,CAAC;IACDgC,gBAAgBA,CAACnB,MAAM,EAAEC,OAAyC,EAAE,CAEpE,CAAC;IACDmB,uBAAuBA,CACrBjB,KAAK,EACLC,MAA+C,EAC/C;MACA,IAAM;QAAEX,QAAQ;QAAEC;MAAW,CAAC,GAAGU,MAAM,CAACC,OAAO;MAC/CF,KAAK,CAACX,WAAW,GAAG;QAClBC,QAAQ;QACRC;MACF,CAAC;MACDS,KAAK,CAACf,UAAU,GAAG;QACjBE,MAAM,EAAE,UAAU;QAClBD,IAAI,WAAA2B,MAAA,CAAWtB,UAAU;MAC3B,CAAC;IACH,CAAC;IACD2B,qBAAqBA,CAAClB,KAAK,EAAE;MAC3BA,KAAK,CAACf,UAAU,CAACC,IAAI,GAAG,EAAE;IAC5B,CAAC;IACDiC,sBAAsBA,CAACnB,KAAK,EAAEC,MAAqC,EAAE;MACnED,KAAK,CAACf,UAAU,GAAGgB,MAAM,CAACC,OAAO;IACnC,CAAC;IACDkB,gBAAgBA,CAACpB,KAAK,EAAEC,MAA6B,EAAE;MACrDD,KAAK,CAACf,UAAU,GAAG;QAAEE,MAAM,EAAE,UAAU;QAAED,IAAI,EAAEe,MAAM,CAACC;MAAQ,CAAC;IACjE;EACF;AACF,CAAC,CAAC;AAEF,OAAO,IAAMmB,gBAAgB,GAAG7B,cAAc,CAAC8B,OAAO;AACtD,OAAO,IAAM;EACXC,UAAU,EAAEC,mBAAmB;EAC/BC,aAAa,EAAEC;AACjB,CAAC,GAAGlD,gBAAgB,CAACgB,cAAc,EAAEb,IAAI,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
function asyncGeneratorStep(
|
|
7
|
-
function _asyncToGenerator(
|
|
6
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
7
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
8
8
|
import { BrowserTransport, DefaultSettings } from '@looker/sdk-rtl';
|
|
9
9
|
export var getUrl = function () {
|
|
10
10
|
var _ref = _asyncToGenerator(function* (url) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["BrowserTransport","DefaultSettings","getUrl","_ref","_asyncToGenerator","url","settings","_objectSpread","base_url","verify_ssl","xp","response","rawRequest","body","_x","apply","arguments","getVersions","_ref2","versionsUrl","versions","content","JSON","parse","_unused","Error","_x2","validateUrl","result","URL","endsWith","origin","_unused2"],"sources":["../../../../src/OAuthForm/src/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport { BrowserTransport, DefaultSettings } from '@looker/sdk-rtl';\nimport type { ILookerVersions } from '@looker/sdk-codegen';\n\nexport type ConfigValues = Record<string, any>;\n\n/**\n * Use the browser transport to GET a url\n * @param url to fetch\n */\nexport const getUrl = async (url: string): Promise<string | ConfigValues> => {\n const settings = {\n ...DefaultSettings(),\n ...{ base_url: url, verify_ssl: false },\n };\n const xp = new BrowserTransport(settings);\n const response = await xp.rawRequest('GET', url);\n return response.body;\n};\n\n/**\n * Gets the versions payload given a versions url\n * @param versionsUrl\n */\nexport const getVersions = async (\n versionsUrl: string\n): Promise<ILookerVersions | undefined> => {\n let versions;\n try {\n const content = await getUrl(versionsUrl);\n versions = typeof content === 'string' ? JSON.parse(content) : content;\n } catch {\n throw new Error('Invalid server configuration');\n }\n return versions;\n};\n\n/**\n * Validates URL and standardizes it\n * @param url to validate\n * @returns the standardized url.origin if it's valid, or an empty string if it's not\n */\nexport const validateUrl = (url: string): string => {\n try {\n const result = new URL(url);\n if (url.endsWith(':')) return url;\n return result.origin;\n } catch {\n return '';\n }\n};\n"],"mappings":";;;;;;;AAyBA,SAASA,gBAAgB,EAAEC,eAAe,QAAQ,iBAAiB;AASnE,OAAO,IAAMC,MAAM;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG,WAAOC,GAAW,EAAqC;IAC3E,IAAMC,QAAQ,GAAAC,aAAA,CAAAA,aAAA,KACTN,eAAe,CAAC,CAAC,GACjB;MAAEO,QAAQ,EAAEH,GAAG;MAAEI,UAAU,EAAE;IAAM,CAAC,CACxC;IACD,IAAMC,EAAE,GAAG,IAAIV,gBAAgB,CAACM,QAAQ,CAAC;IACzC,IAAMK,QAAQ,SAASD,EAAE,CAACE,UAAU,CAAC,KAAK,EAAEP,GAAG,CAAC;IAChD,OAAOM,QAAQ,CAACE,IAAI;EACtB,CAAC;EAAA,gBARYX,MAAMA,CAAAY,EAAA;IAAA,OAAAX,IAAA,CAAAY,KAAA,OAAAC,SAAA;EAAA;AAAA,GAQlB;AAMD,OAAO,IAAMC,WAAW;EAAA,IAAAC,KAAA,GAAAd,iBAAA,CAAG,WACzBe,WAAmB,EACsB;IACzC,IAAIC,QAAQ;IACZ,IAAI;MACF,IAAMC,OAAO,SAASnB,MAAM,CAACiB,WAAW,CAAC;MACzCC,QAAQ,GAAG,OAAOC,OAAO,KAAK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC,GAAGA,OAAO;IACxE,CAAC,CAAC,OAAAG,OAAA,EAAM;MACN,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;IACjD;IACA,OAAOL,QAAQ;EACjB,CAAC;EAAA,gBAXYH,WAAWA,CAAAS,GAAA;IAAA,OAAAR,KAAA,CAAAH,KAAA,OAAAC,SAAA;EAAA;AAAA,GAWvB;AAOD,OAAO,IAAMW,WAAW,GAAItB,GAAW,IAAa;EAClD,IAAI;IACF,IAAMuB,MAAM,GAAG,IAAIC,GAAG,CAACxB,GAAG,CAAC;IAC3B,IAAIA,GAAG,CAACyB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOzB,GAAG;IACjC,OAAOuB,MAAM,CAACG,MAAM;EACtB,CAAC,CAAC,OAAAC,QAAA,EAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":["BrowserTransport","DefaultSettings","getUrl","_ref","_asyncToGenerator","url","settings","_objectSpread","base_url","verify_ssl","xp","response","rawRequest","body","_x","apply","arguments","getVersions","_ref2","versionsUrl","versions","content","JSON","parse","_unused","Error","_x2","validateUrl","result","URL","endsWith","origin","_unused2"],"sources":["../../../../src/OAuthForm/src/utils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2023 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 */\nimport { BrowserTransport, DefaultSettings } from '@looker/sdk-rtl';\nimport type { ILookerVersions } from '@looker/sdk-codegen';\n\nexport type ConfigValues = Record<string, any>;\n\n/**\n * Use the browser transport to GET a url\n * @param url to fetch\n */\nexport const getUrl = async (url: string): Promise<string | ConfigValues> => {\n const settings = {\n ...DefaultSettings(),\n ...{ base_url: url, verify_ssl: false },\n };\n const xp = new BrowserTransport(settings);\n const response = await xp.rawRequest('GET', url);\n return response.body;\n};\n\n/**\n * Gets the versions payload given a versions url\n * @param versionsUrl\n */\nexport const getVersions = async (\n versionsUrl: string\n): Promise<ILookerVersions | undefined> => {\n let versions;\n try {\n const content = await getUrl(versionsUrl);\n versions = typeof content === 'string' ? JSON.parse(content) : content;\n } catch {\n throw new Error('Invalid server configuration');\n }\n return versions;\n};\n\n/**\n * Validates URL and standardizes it\n * @param url to validate\n * @returns the standardized url.origin if it's valid, or an empty string if it's not\n */\nexport const validateUrl = (url: string): string => {\n try {\n const result = new URL(url);\n if (url.endsWith(':')) return url;\n return result.origin;\n } catch {\n return '';\n }\n};\n"],"mappings":";;;;;;;AAyBA,SAASA,gBAAgB,EAAEC,eAAe,QAAQ,iBAAiB;AASnE,OAAO,IAAMC,MAAM;EAAA,IAAAC,IAAA,GAAAC,iBAAA,CAAG,WAAOC,GAAW,EAAqC;IAC3E,IAAMC,QAAQ,GAAAC,aAAA,CAAAA,aAAA,KACTN,eAAe,CAAC,CAAC,GACjB;MAAEO,QAAQ,EAAEH,GAAG;MAAEI,UAAU,EAAE;IAAM,CAAC,CACxC;IACD,IAAMC,EAAE,GAAG,IAAIV,gBAAgB,CAACM,QAAQ,CAAC;IACzC,IAAMK,QAAQ,SAASD,EAAE,CAACE,UAAU,CAAC,KAAK,EAAEP,GAAG,CAAC;IAChD,OAAOM,QAAQ,CAACE,IAAI;EACtB,CAAC;EAAA,gBARYX,MAAMA,CAAAY,EAAA;IAAA,OAAAX,IAAA,CAAAY,KAAA,OAAAC,SAAA;EAAA;AAAA,GAQlB;AAMD,OAAO,IAAMC,WAAW;EAAA,IAAAC,KAAA,GAAAd,iBAAA,CAAG,WACzBe,WAAmB,EACsB;IACzC,IAAIC,QAAQ;IACZ,IAAI;MACF,IAAMC,OAAO,SAASnB,MAAM,CAACiB,WAAW,CAAC;MACzCC,QAAQ,GAAG,OAAOC,OAAO,KAAK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC,GAAGA,OAAO;IACxE,CAAC,CAAC,OAAAG,OAAA,EAAM;MACN,MAAM,IAAIC,KAAK,CAAC,8BAA8B,CAAC;IACjD;IACA,OAAOL,QAAQ;EACjB,CAAC;EAAA,gBAXYH,WAAWA,CAAAS,GAAA;IAAA,OAAAR,KAAA,CAAAH,KAAA,OAAAC,SAAA;EAAA;AAAA,GAWvB;AAOD,OAAO,IAAMW,WAAW,GAAItB,GAAW,IAAa;EAClD,IAAI;IACF,IAAMuB,MAAM,GAAG,IAAIC,GAAG,CAACxB,GAAG,CAAC;IAC3B,IAAIA,GAAG,CAACyB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOzB,GAAG;IACjC,OAAOuB,MAAM,CAACG,MAAM;EACtB,CAAC,CAAC,OAAAC,QAAA,EAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC","ignoreList":[]}
|
package/lib/esm/OAuthScene.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
function asyncGeneratorStep(
|
|
2
|
-
function _asyncToGenerator(
|
|
1
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
2
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
3
3
|
import React, { useEffect } from 'react';
|
|
4
4
|
import { ComponentsProvider, Flex, FlexItem, Heading, ProgressCircular } from '@looker/components';
|
|
5
5
|
import { useHistory } from 'react-router';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScene.js","names":["React","useEffect","ComponentsProvider","Flex","FlexItem","Heading","ProgressCircular","useHistory","useLocation","OAuthScene","_ref","_authSession$returnUr","adaptor","history","location","reactPath","pathname","fullPath","window","extraPath","substr","indexOf","authSession","sdk","retPath","returnUrl","oldUrl","replace","maybeLogin","_ref2","_asyncToGenerator","token","login","console","error","push","apply","arguments","themeOverrides","createElement","loadGoogleFonts","themeCustomizations","flexDirection","justifyContent","mt","alignSelf","size","color","as","concat"],"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,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SACEC,kBAAkB,EAClBC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,gBAAgB,Q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AAMU,cAAc,GAAG1B,OAAO,CAAC0B,cAAc,CAAC,CAAC;EAC/C,OACEtC,KAAA,CAAAuC,aAAA,CAACrC,kBAAkB;IACjBsC,eAAe,EAAEF,cAAc,CAACE,eAAgB;IAChDC,mBAAmB,EAAEH,cAAc,CAACG;EAAoB,GAExDzC,KAAA,CAAAuC,aAAA,CAACpC,IAAI;IAACuC,aAAa,EAAC,QAAQ;IAACC,cAAc,EAAC,QAAQ;IAACC,EAAE,EAAC;EAAK,GAC3D5C,KAAA,CAAAuC,aAAA,CAACnC,QAAQ;IAACyC,SAAS,EAAC;EAAQ,GAC1B7C,KAAA,CAAAuC,aAAA,CAACjC,gBAAgB;IAACwC,IAAI,EAAC;EAAO,CAAE,CACxB,CAAC,EACX9C,KAAA,CAAAuC,aAAA,CAACnC,QAAQ;IAACwC,EAAE,EAAC,OAAO;IAACC,SAAS,EAAC;EAAQ,GACrC7C,KAAA,CAAAuC,aAAA,CAAClC,OAAO;IAAC0C,KAAK,EAAC,KAAK;IAACC,EAAE,EAAC;EAAI,mBAAAC,MAAA,CACTvB,MAAM,2BAChB,CACD,CACN,CACY,CAAC;AAEzB,CAAC"}
|
|
1
|
+
{"version":3,"file":"OAuthScene.js","names":["React","useEffect","ComponentsProvider","Flex","FlexItem","Heading","ProgressCircular","useHistory","useLocation","OAuthScene","_ref","_authSession$returnUr","adaptor","history","location","reactPath","pathname","fullPath","window","extraPath","substr","indexOf","authSession","sdk","retPath","returnUrl","oldUrl","replace","maybeLogin","_ref2","_asyncToGenerator","token","login","console","error","push","apply","arguments","themeOverrides","createElement","loadGoogleFonts","themeCustomizations","flexDirection","justifyContent","mt","alignSelf","size","color","as","concat"],"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,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AAExC,SACEC,kBAAkB,EAClBC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,gBAAgB,QACX,oBAAoB;AAC3B,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,WAAW,QAAQ,kBAAkB;AAW9C,OAAO,IAAMC,UAA+B,GAAGC,IAAA,IAAiB;EAAA,IAAAC,qBAAA;EAAA,IAAhB;IAAEC;EAAQ,CAAC,GAAAF,IAAA;EACzD,IAAMG,OAAO,GAAGN,UAAU,CAAC,CAAC;EAC5B,IAAMO,QAAQ,GAAGN,WAAW,CAAC,CAAC;EAC9B,IAAMO,SAAS,GAAGD,QAAQ,CAACE,QAAQ;EACnC,IAAMC,QAAQ,GAAIC,MAAM,CAASJ,QAAQ,CAACE,QAAQ;EAClD,IAAMG,SAAS,GAAGF,QAAQ,CAACG,MAAM,CAAC,CAAC,EAAEH,QAAQ,CAACI,OAAO,CAACN,SAAS,CAAC,CAAC;EACjE,IAAMO,WAAW,GAAGV,OAAO,CAACW,GAAG,CAACD,WAA6B;EAC7D,IAAME,OAAO,IAAAb,qBAAA,GAAGW,WAAW,CAACG,SAAS,cAAAd,qBAAA,cAAAA,qBAAA,GAAI,GAAG;EAE5C,IAAMe,MAAM,GAAGF,OAAO,CAACG,OAAO,CAACR,SAAS,EAAE,EAAE,CAAC;EAE7ClB,SA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
|
|
|
1
|
-
{"version":3,"file":"adaptorUtils.js","names":["BrowserAdaptor","hostedInternally","hostname","endsWith","startsWith","getThemeOverrides","internalTheming","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","extensionAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error","registerTestEnvAdaptor","mockSdk","appPath","location","newPath","reactPath","pathname","wloc","window","base","origin","wpath","result","concat","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,SAASA,cAAc,QAAQ,kBAAkB;AAoDjD,OAAO,IAAMC,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;AAMlC,OAAO,IAAME,iBAAiB,GAAIC,eAAwB,IACxDA,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MAAM;AACf,CAAC"}
|
|
1
|
+
{"version":3,"file":"adaptorUtils.js","names":["BrowserAdaptor","hostedInternally","hostname","endsWith","startsWith","getThemeOverrides","internalTheming","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","extensionAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error","registerTestEnvAdaptor","mockSdk","appPath","location","newPath","reactPath","pathname","wloc","window","base","origin","wpath","result","concat","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,SAASA,cAAc,QAAQ,kBAAkB;AAoDjD,OAAO,IAAMC,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;AAMlC,OAAO,IAAME,iBAAiB,GAAIC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E;EACb,OAAOQ,MAAM;AACf,CAAC","ignoreList":[]}
|
package/lib/esm/authUtils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2
2
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3
|
-
function _defineProperty(
|
|
4
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i :
|
|
3
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
import { ApiSettings } from '@looker/sdk-rtl';
|
|
7
7
|
export class OAuthConfigProvider extends ApiSettings {
|