@looker/extension-utils 0.1.23 → 0.1.26
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 +34 -0
- package/lib/APIErrorDisplay/APIErrorContent.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDetails.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDialog.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDisplay.js.map +1 -1
- package/lib/APIErrorDisplay/APIErrorDocLink.js.map +1 -1
- package/lib/APIErrorDisplay/index.js.map +1 -1
- package/lib/APIErrorDisplay/utils.js.map +1 -1
- package/lib/ExtMarkdown.js.map +1 -1
- package/lib/OAuthForm/index.d.ts +1 -0
- package/lib/OAuthForm/index.js +17 -0
- package/lib/OAuthForm/index.js.map +1 -0
- package/lib/{esm/OAuthConfigForm/Collapser → OAuthForm/src/components}/CollapserCard.js +1 -1
- package/lib/OAuthForm/src/components/CollapserCard.js.map +1 -0
- package/lib/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.js +1 -1
- package/lib/OAuthForm/src/components/ConfigHeading.js.map +1 -0
- package/lib/{OAuthConfigForm/OAuthConfigForm.d.ts → OAuthForm/src/components/OAuthForm.d.ts} +1 -1
- package/lib/{OAuthConfigForm/OAuthConfigForm.js → OAuthForm/src/components/OAuthForm.js} +70 -60
- package/lib/OAuthForm/src/components/OAuthForm.js.map +1 -0
- package/lib/OAuthForm/src/components/index.d.ts +1 -0
- package/lib/OAuthForm/src/components/index.js +13 -0
- package/lib/OAuthForm/src/components/index.js.map +1 -0
- package/lib/OAuthForm/src/index.d.ts +2 -0
- package/lib/OAuthForm/src/index.js +28 -0
- package/lib/OAuthForm/src/index.js.map +1 -0
- package/lib/OAuthForm/src/state/index.d.ts +1 -0
- package/lib/OAuthForm/src/state/index.js +13 -0
- package/lib/OAuthForm/src/state/index.js.map +1 -0
- package/lib/OAuthForm/src/state/slice.d.ts +64 -0
- package/lib/OAuthForm/src/state/slice.js +83 -0
- package/lib/OAuthForm/src/state/slice.js.map +1 -0
- package/lib/OAuthForm/src/utils.js.map +1 -0
- package/lib/OAuthScene.js.map +1 -1
- package/lib/adaptorUtils.js.map +1 -1
- package/lib/authUtils.js.map +1 -1
- package/lib/browserAdaptor.js.map +1 -1
- 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.map +1 -1
- package/lib/esm/ExtMarkdown.js.map +1 -1
- package/lib/esm/OAuthForm/index.js +17 -0
- package/lib/esm/OAuthForm/index.js.map +1 -0
- package/lib/{OAuthConfigForm/Collapser → esm/OAuthForm/src/components}/CollapserCard.js +1 -1
- package/lib/esm/OAuthForm/src/components/CollapserCard.js.map +1 -0
- package/lib/esm/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.js +1 -1
- package/lib/esm/OAuthForm/src/components/ConfigHeading.js.map +1 -0
- package/lib/esm/{OAuthConfigForm/OAuthConfigForm.js → OAuthForm/src/components/OAuthForm.js} +70 -60
- package/lib/esm/OAuthForm/src/components/OAuthForm.js.map +1 -0
- package/lib/esm/OAuthForm/src/components/index.js +13 -0
- package/lib/esm/OAuthForm/src/components/index.js.map +1 -0
- package/lib/esm/OAuthForm/src/index.js +28 -0
- package/lib/esm/OAuthForm/src/index.js.map +1 -0
- package/lib/esm/OAuthForm/src/state/index.js +13 -0
- package/lib/esm/OAuthForm/src/state/index.js.map +1 -0
- package/lib/esm/OAuthForm/src/state/slice.js +83 -0
- package/lib/esm/OAuthForm/src/state/slice.js.map +1 -0
- package/lib/esm/OAuthForm/src/utils.js.map +1 -0
- package/lib/esm/OAuthScene.js.map +1 -1
- package/lib/esm/adaptorUtils.js.map +1 -1
- package/lib/esm/authUtils.js.map +1 -1
- package/lib/esm/browserAdaptor.js.map +1 -1
- package/lib/esm/extensionAdaptor.js.map +1 -1
- package/lib/esm/index.js +4 -4
- package/lib/esm/index.js.map +1 -1
- package/lib/extensionAdaptor.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +4 -4
- package/lib/index.js.map +1 -1
- package/package.json +10 -7
- package/lib/OAuthConfigForm/Collapser/CollapserCard.js.map +0 -1
- package/lib/OAuthConfigForm/Collapser/index.d.ts +0 -1
- package/lib/OAuthConfigForm/Collapser/index.js +0 -13
- package/lib/OAuthConfigForm/Collapser/index.js.map +0 -1
- package/lib/OAuthConfigForm/ConfigHeading.js.map +0 -1
- package/lib/OAuthConfigForm/OAuthConfigForm.js.map +0 -1
- package/lib/OAuthConfigForm/index.d.ts +0 -1
- package/lib/OAuthConfigForm/index.js +0 -13
- package/lib/OAuthConfigForm/index.js.map +0 -1
- package/lib/OAuthConfigForm/utils.js.map +0 -1
- package/lib/esm/OAuthConfigForm/Collapser/CollapserCard.js.map +0 -1
- package/lib/esm/OAuthConfigForm/Collapser/index.js +0 -13
- package/lib/esm/OAuthConfigForm/Collapser/index.js.map +0 -1
- package/lib/esm/OAuthConfigForm/ConfigHeading.js.map +0 -1
- package/lib/esm/OAuthConfigForm/OAuthConfigForm.js.map +0 -1
- package/lib/esm/OAuthConfigForm/index.js +0 -13
- package/lib/esm/OAuthConfigForm/index.js.map +0 -1
- package/lib/esm/OAuthConfigForm/utils.js.map +0 -1
- /package/lib/{OAuthConfigForm/Collapser → OAuthForm/src/components}/CollapserCard.d.ts +0 -0
- /package/lib/{OAuthConfigForm → OAuthForm/src/components}/ConfigHeading.d.ts +0 -0
- /package/lib/{OAuthConfigForm → OAuthForm/src}/utils.d.ts +0 -0
- /package/lib/{OAuthConfigForm → OAuthForm/src}/utils.js +0 -0
- /package/lib/esm/{OAuthConfigForm → OAuthForm/src}/utils.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScene.js","names":["OAuthScene","adaptor","history","useHistory","location","useLocation","reactPath","pathname","fullPath","window","extraPath","substr","indexOf","authSession","sdk","retPath","returnUrl","oldUrl","replace","useEffect","maybeLogin","token","login","console","
|
|
1
|
+
{"version":3,"file":"OAuthScene.js","names":["_react","_interopRequireWildcard","require","_components","_reactRouter","_reactRouterDom","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","asyncGeneratorStep","gen","resolve","reject","_next","_throw","arg","info","value","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","OAuthScene","_ref","_authSession$returnUr","adaptor","history","useHistory","location","useLocation","reactPath","pathname","fullPath","window","extraPath","substr","indexOf","authSession","sdk","retPath","returnUrl","oldUrl","replace","useEffect","maybeLogin","_ref2","token","login","console","push","themeOverrides","createElement","ComponentsProvider","loadGoogleFonts","themeCustomizations","Flex","flexDirection","justifyContent","mt","FlexItem","alignSelf","ProgressCircular","size","Heading","color","as","concat","exports"],"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\"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,aAAA,CAAC3E,WAAA,CAAAmF,QAAQ;IAACC,SAAS,EAAC;EAAQ,GAC1BvF,MAAA,CAAAa,OAAA,CAAAiE,aAAA,CAAC3E,WAAA,CAAAqF,gBAAgB;IAACC,IAAI,EAAC;EAAO,EAAG,CACxB,EACXzF,MAAA,CAAAa,OAAA,CAAAiE,aAAA,CAAC3E,WAAA,CAAAmF,QAAQ;IAACD,EAAE,EAAC,OAAO;IAACE,SAAS,EAAC;EAAQ,GACrCvF,MAAA,CAAAa,OAAA,CAAAiE,aAAA,CAAC3E,WAAA,CAAAuF,OAAO;IAACC,KAAK,EAAC,KAAK;IAACC,EAAE,EAAC;EAAI,mBAAAC,MAAA,CACTzB,MAAM,4BACf,CACD,CACN,CACY;AAEzB,CAAC;AAAA0B,OAAA,CAAA7C,UAAA,GAAAA,UAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adaptorUtils.js","names":["hostedInternally","hostname","endsWith","startsWith","getThemeOverrides","internalTheming","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","extensionAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error","registerTestEnvAdaptor","mockSdk","BrowserAdaptor","appPath","location","newPath","reactPath","pathname","wloc","window","base","origin","wpath","result","substring","indexOf"],"sources":["../../src/adaptorUtils.ts"],"sourcesContent":["/*\n\n MIT License\n\n Copyright (c) 2021 Looker Data Sciences, Inc.\n\n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n\n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n\n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n\n */\n\nimport type { ThemeCustomizations } from '@looker/design-tokens'\nimport type { IAPIMethods } from '@looker/sdk-rtl'\nimport type { Location as HLocation } from 'history'\nimport { BrowserAdaptor } from './browserAdaptor'\n\nexport interface IAuthAdaptor {\n /** Method for retrieving an instantiated SDK */\n get sdk(): IAPIMethods\n /** Method for authenticating against the API server. Auth mechanism is dependent on the authSession implementation\n * used for the sdk. */\n login(): Promise<boolean>\n}\n\n/**\n * NOTE: This interface should describe all methods that require an adaptor when running in standalone vs extension mode\n * Examples include: local storage operations and various link navigation functions\n */\nexport interface IEnvironmentAdaptor extends IAuthAdaptor {\n /** Copy page URL to clipboard */\n copyToClipboard: (location?: {\n pathname: string\n search: string\n }) => Promise<void>\n /** Method for determining whether running in a browser or extension environment */\n isExtension(): boolean\n /** Method for retrieving a keyed value from local storage */\n localStorageGetItem(key: string): Promise<string | null>\n /** Method for setting a keyed value in local storage */\n localStorageSetItem(key: string, value: string): void\n /** Method for removing a keyed value from local storage */\n localStorageRemoveItem(key: string): void\n /** Theme settings for extension */\n themeOverrides(): ThemeOverrides\n /** Open a new browser window with the given url and target */\n openBrowserWindow: (url: string, target?: string) => void\n /** error logger */\n logError: (error: Error, componentStack: string) => void\n}\n\n/**\n * Theme overrides used to load google fonts in Google environments only.\n * Google fonts should NOT be used when it is not obvious that a Google\n * system is being used (for example an embedded extension).\n */\nexport interface ThemeOverrides {\n /** Should Google-specific fonts be used for the theme? */\n loadGoogleFonts?: boolean\n /** Property bag overrides for Looker component theming */\n themeCustomizations?: ThemeCustomizations\n}\n\n/**\n * Is this an \"internal\" host that will use internal branding?\n * @param hostname to check\n */\nexport const hostedInternally = (hostname: string): boolean =>\n hostname.endsWith('.looker.com') ||\n hostname.endsWith('.google.com') ||\n hostname === 'localhost' ||\n // Include firebase staging dev portal for now. Can be removed\n // when dev portal gets its own APIX project. Also includes\n // PRs.\n (hostname.startsWith('looker-developer-portal') &&\n hostname.endsWith('.web.app'))\n\n/**\n * Return theme overrides that make apply \"internal\" or external theming\n * @param internalTheming true if \"internal\" theme should be used\n */\nexport const getThemeOverrides = (internalTheming: boolean): ThemeOverrides =>\n internalTheming\n ? {\n loadGoogleFonts: true,\n themeCustomizations: {\n fontFamilies: { brand: 'Google Sans' },\n colors: { key: '#1A73E8' },\n },\n }\n : {\n themeCustomizations: {\n colors: { key: '#1A73E8' },\n },\n }\n\nlet extensionAdaptor: IEnvironmentAdaptor | undefined\n\n/**\n * Register the environment adaptor. Used when initializing the application\n * @param adaptor to register\n */\nexport const registerEnvAdaptor = <T extends IEnvironmentAdaptor>(\n adaptor: T\n) => {\n extensionAdaptor = adaptor\n}\n\n/**\n * Unregister the environment adaptor. Extensions should call this when unmounted\n */\nexport const unregisterEnvAdaptor = () => {\n extensionAdaptor = undefined\n}\n\n/**\n * Global access to the environment adaptor. An error will be thrown if accessed prematurely.\n */\nexport const getEnvAdaptor = () => {\n if (!extensionAdaptor) {\n throw new Error('Environment adaptor not initialized.')\n }\n return extensionAdaptor\n}\n\n/**\n * Used by some unit tests\n * @param adaptor to use for testing\n */\nexport const registerTestEnvAdaptor = <T extends IEnvironmentAdaptor>(\n adaptor?: T\n) => {\n const mockSdk = {} as unknown as IAPIMethods\n registerEnvAdaptor(adaptor || new BrowserAdaptor(mockSdk))\n}\n\n/**\n * Get new application-level base path for react application\n * This function compares the react-based location with the browser window location\n * pathname to ensure that the newPath variable is assigned at the root of the\n * React app path rather than potentially recursive nesting\n *\n * @param location which is usually from useLocation()\n * @param newPath new path to assign, like `/oauth`\n */\nexport const appPath = (location: HLocation, newPath: string) => {\n const reactPath = location.pathname\n const wloc = (window as any).location\n const base = wloc.origin\n const wpath = wloc.pathname\n const result = `${base}${wpath.substring(\n 0,\n wpath.indexOf(reactPath)\n )}${newPath}`\n return result\n}\n"],"mappings":";;;;;;AA6BA;AAoDO,
|
|
1
|
+
{"version":3,"file":"adaptorUtils.js","names":["_browserAdaptor","require","hostedInternally","hostname","endsWith","startsWith","exports","getThemeOverrides","internalTheming","loadGoogleFonts","themeCustomizations","fontFamilies","brand","colors","key","extensionAdaptor","registerEnvAdaptor","adaptor","unregisterEnvAdaptor","undefined","getEnvAdaptor","Error","registerTestEnvAdaptor","mockSdk","BrowserAdaptor","appPath","location","newPath","reactPath","pathname","wloc","window","base","origin","wpath","result","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,IAAAA,eAAA,GAAAC,OAAA;AAoDO,IAAMC,gBAAgB,GAAIC,QAAgB,IAC/CA,QAAQ,CAACC,QAAQ,CAAC,aAAa,CAAC,IAChCD,QAAQ,CAACC,QAAQ,CAAC,aAAa,CAAC,IAChCD,Q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EAC/D,IAAMC,SAAS,GAAGF,QAAQ,CAACG,QAAQ;EACnC,IAAMC,IAAI,GAAIC,MAAM,CAASL,QAAQ;EACrC,IAAMM,IAAI,GAAGF,IAAI,CAACG,MAAM;EACxB,IAAMC,KAAK,GAAGJ,IAAI,CAACD,QAAQ;EAC3B,IAAMM,MAAM,MAAAC,MAAA,CAAMJ,IAAI,EAAAI,MAAA,CAAGF,KAAK,CAACG,SAAS,CACtC,CAAC,EACDH,KAAK,CAACI,OAAO,CAACV,SAAS,CAAC,CACzB,EAAAQ,MAAA,CAAGT,OAAO,CAAE;EACb,OAAOQ,MAAM;AACf,CAAC;AAAA7B,OAAA,CAAAmB,OAAA,GAAAA,OAAA"}
|
package/lib/esm/authUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authUtils.js","names":["OAuthConfigProvider","ApiSettings","constructor","settings","oauthClientId","configKey","getStorage","
|
|
1
|
+
{"version":3,"file":"authUtils.js","names":["_sdkRtl","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","OAuthConfigProvider","ApiSettings","constructor","settings","oauthClientId","configKey","getStorage","defaultValue","sessionStorage","getItem","location","localStorage","isConfigured","getStoredConfig","storage","config","base_url","looker_url","client_id","redirect_uri","JSON","parse","authIsConfigured","readConfig","_section","url","URL","authServer","concat","protocol","hostname","window","origin","exports"],"sources":["../../src/authUtils.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 */\nimport type { IApiSection, IApiSettings } from '@looker/sdk-rtl'\nimport { ApiSettings } from '@looker/sdk-rtl'\n\nexport type StorageLocation = 'session' | 'local'\n\n/** Object returned from storage service */\nexport interface IStorageValue {\n /** Location of the stored object */\n location: StorageLocation\n /** Stored string representation of the value (usually JSON) */\n value: string\n}\n\n/**\n * An OAuth Session configuration provider\n */\nexport class OAuthConfigProvider extends ApiSettings {\n oauthClientId: string\n constructor(\n settings: Partial<IApiSettings>,\n oauthClientId: string,\n private readonly configKey: string\n ) {\n super(settings)\n this.oauthClientId = oauthClientId\n }\n\n private getStorage(key: string, defaultValue = ''): IStorageValue {\n let value = sessionStorage.getItem(key)\n if (value) {\n return {\n location: 'session',\n value,\n }\n }\n value = localStorage.getItem(key)\n if (value) {\n return {\n location: 'local',\n value,\n }\n }\n return {\n location: 'session',\n value: defaultValue,\n }\n }\n\n isConfigured(): boolean {\n // Required to be true otherwise SDK initialization fails\n return true\n }\n\n getStoredConfig() {\n const storage = this.getStorage(this.configKey)\n let config = {\n base_url: '',\n looker_url: '',\n client_id: '',\n redirect_uri: '',\n }\n if (storage.value) {\n config = JSON.parse(storage.value)\n }\n return config\n }\n\n authIsConfigured(): boolean {\n const config = this.getStoredConfig()\n return config.base_url !== '' && config.looker_url !== ''\n }\n\n readConfig(_section?: string): IApiSection {\n // Read server url values from storage\n let config = this.getStoredConfig()\n if (!this.authIsConfigured()) {\n // derive Looker server URL from base_url\n const url = new URL(this.base_url)\n const authServer = `${url.protocol}//${url.hostname}`\n config = {\n base_url: this.base_url,\n looker_url: `${authServer}:9999`,\n client_id: this.oauthClientId,\n redirect_uri: `${window.location.origin}/oauth`,\n }\n }\n\n const { base_url, looker_url, client_id, redirect_uri } = config\n /* update base_url to the dynamically determined value for standard transport requests */\n this.base_url = base_url\n return {\n ...super.readConfig(_section),\n ...{\n base_url,\n looker_url,\n client_id,\n redirect_uri,\n },\n }\n }\n}\n"],"mappings":";;;;;;AA0BA,IAAAA,OAAA,GAAAC,OAAA;AAA6C,SAAAC,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,IAAAC,eAAA,CAAAP,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAA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I,CAAC,IAAI,CAACS,gBAAgB,EAAE,EAAE;MAE5B,IAAMG,GAAG,GAAG,IAAIC,GAAG,CAAC,IAAI,CAACV,QAAQ,CAAC;MAClC,IAAMW,UAAU,MAAAC,MAAA,CAAMH,GAAG,CAACI,QAAQ,QAAAD,MAAA,CAAKH,GAAG,CAACK,QAAQ,CAAE;MACrDf,MAAM,GAAG;QACPC,QAAQ,EAAE,IAAI,CAACA,QAAQ;QACvBC,UAAU,KAAAW,MAAA,CAAKD,UAAU,UAAO;QAChCT,SAAS,EAAE,IAAI,CAACd,aAAa;QAC7Be,YAAY,KAAAS,MAAA,CAAKG,MAAM,CAACrB,QAAQ,CAACsB,MAAM;MACzC,CAAC;IACH;IAEA,IAAM;MAAEhB,QAAQ;MAAEC,UAAU;MAAEC,SAAS;MAAEC;IAAa,CAAC,GAAGJ,MAAM;IAEhE,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,OAAA9C,aAAA,CAAAA,aAAA,KACK,KAAK,CAACqD,UAAU,CAACC,QAAQ,CAAC,GAC1B;MACDR,QAAQ;MACRC,UAAU;MACVC,SAAS;MACTC;IACF,CAAC;EAEL;AACF;AAACc,OAAA,CAAAjC,mBAAA,GAAAA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browserAdaptor.js","names":["BrowserAuthAdaptor","constructor","sdk","login","token","settings","authSession","authIsConfigured","BrowserAdaptor","hostname","location","_themeOverrides","getThemeOverrides","hostedInternally","copyToClipboard","navigator","clipboard","writeText","href","isExtension","localStorageGetItem","
|
|
1
|
+
{"version":3,"file":"browserAdaptor.js","names":["_adaptorUtils","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","BrowserAuthAdaptor","constructor","sdk","login","_this","token","settings","authSession","authIsConfigured","exports","BrowserAdaptor","hostname","location","_themeOverrides","getThemeOverrides","hostedInternally","copyToClipboard","navigator","clipboard","writeText","href","isExtension","localStorageGetItem","localStorage","getItem","localStorageSetItem","setItem","localStorageRemoveItem","removeItem","themeOverrides","openBrowserWindow","url","target","window","open","logError","_error","_componentStack"],"sources":["../../src/browserAdaptor.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 { IAPIMethods } from '@looker/sdk-rtl'\nimport type {\n IAuthAdaptor,\n IEnvironmentAdaptor,\n ThemeOverrides,\n} from './adaptorUtils'\nimport { getThemeOverrides, hostedInternally } from './adaptorUtils'\nimport type { OAuthConfigProvider } from './authUtils'\n\nexport class BrowserAuthAdaptor implements IAuthAdaptor {\n constructor(public readonly sdk: IAPIMethods) {}\n\n async login() {\n let token\n const settings = this.sdk.authSession.settings as OAuthConfigProvider\n if (settings.authIsConfigured()) {\n token = await this.sdk.authSession.login()\n }\n return !!token\n }\n}\n\n/**\n * An adaptor class for interacting with browser APIs when not running in an extension\n */\nexport class BrowserAdaptor\n extends BrowserAuthAdaptor\n implements IEnvironmentAdaptor\n{\n private _themeOverrides: ThemeOverrides\n\n constructor(sdk: IAPIMethods) {\n super(sdk)\n const { hostname } = location\n this._themeOverrides = getThemeOverrides(hostedInternally(hostname))\n }\n\n async copyToClipboard() {\n await navigator.clipboard.writeText(location.href)\n }\n\n isExtension() {\n return false\n }\n\n async localStorageGetItem(key: string) {\n return localStorage.getItem(key)\n }\n\n async localStorageSetItem(key: string, value: string) {\n await localStorage.setItem(key, value)\n }\n\n async localStorageRemoveItem(key: string) {\n await localStorage.removeItem(key)\n }\n\n themeOverrides() {\n return this._themeOverrides\n }\n\n openBrowserWindow(url: string, target?: string) {\n window.open(url, target)\n }\n\n logError(_error: Error, _componentStack: string): void {\n // noop - error logging for standalone applications TBD\n }\n}\n"],"mappings":";;;;;;AAgCA,IAAAA,aAAA,GAAAC,OAAA;AAAoE,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ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AAC;EAC1B;EAEAG,QAAQA,CAACC,MAAa,EAAEC,eAAuB,EAAQ,CAEvD;AACF;AAAC5B,OAAA,CAAAC,cAAA,GAAAA,cAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionAdaptor.js","names":["ExtensionAuthAdaptor","constructor","sdk","login","ExtensionAdaptor","extensionSdk","_themeOverrides","getThemeOverrides","lookerHostData","hostType","copyToClipboard","location","hostOrigin","extensionId","pathname","search","url","clipboardWrite","isExtension","localStorageGetItem","
|
|
1
|
+
{"version":3,"file":"extensionAdaptor.js","names":["_adaptorUtils","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","ExtensionAuthAdaptor","constructor","sdk","login","exports","ExtensionAdaptor","extensionSdk","_themeOverrides","getThemeOverrides","lookerHostData","hostType","copyToClipboard","location","_this","hostOrigin","extensionId","pathname","search","url","concat","clipboardWrite","isExtension","localStorageGetItem","_this2","localStorageSetItem","_this3","localStorageRemoveItem","_this4","themeOverrides","openBrowserWindow","target","logError","componentStack","message"],"sources":["../../src/extensionAdaptor.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 { ExtensionSDK } from '@looker/extension-sdk'\nimport type { IAPIMethods } from '@looker/sdk-rtl'\nimport type {\n IEnvironmentAdaptor,\n ThemeOverrides,\n IAuthAdaptor,\n} from './adaptorUtils'\nimport { getThemeOverrides } from './adaptorUtils'\n\nexport class ExtensionAuthAdaptor implements IAuthAdaptor {\n constructor(public readonly sdk: IAPIMethods) {}\n\n async login() {\n // Noop for extensions. Authentication is not required in an extension context\n return true\n }\n}\n\n/**\n * An adaptor class for interacting with browser APIs when running as an extension\n */\nexport class ExtensionAdaptor\n extends ExtensionAuthAdaptor\n implements IEnvironmentAdaptor\n{\n _themeOverrides: ThemeOverrides\n\n constructor(public extensionSdk: ExtensionSDK, sdk: IAPIMethods) {\n super(sdk)\n this._themeOverrides = getThemeOverrides(\n (this.extensionSdk.lookerHostData || { hostType: 'standard' })\n .hostType === 'standard'\n )\n }\n\n async copyToClipboard(location?: { pathname: string; search: string }) {\n const { lookerHostData } = this.extensionSdk\n if (lookerHostData && location) {\n const { hostOrigin, extensionId } = lookerHostData\n const { pathname, search } = location\n const url = `${hostOrigin}/extensions/${extensionId}${pathname}${search}`\n await this.extensionSdk.clipboardWrite(url)\n }\n }\n\n isExtension() {\n return true\n }\n\n async localStorageGetItem(key: string) {\n return await this.extensionSdk.localStorageGetItem(key)\n }\n\n async localStorageSetItem(key: string, value: string) {\n await this.extensionSdk.localStorageSetItem(key, value)\n }\n\n async localStorageRemoveItem(key: string) {\n await this.extensionSdk.localStorageRemoveItem(key)\n }\n\n themeOverrides(): ThemeOverrides {\n return this._themeOverrides\n }\n\n openBrowserWindow(url: string, target?: string) {\n this.extensionSdk.openBrowserWindow(url, target)\n }\n\n logError(error: Error, componentStack: string): void {\n this.extensionSdk.error({\n error: error,\n message: componentStack,\n } as ErrorEvent)\n }\n}\n"],"mappings":";;;;;;AAiCA,IAAAA,aAAA,GAAAC,OAAA;AAAkD,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,CAAAK,IAAA,CAAAP,KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAAA,SAAAU,mBAAAC,GAAA,EAAAC,OAAA,EAAAC,MAAA,EAAAC,KAAA,EAAAC,MAAA,EAAA1B,GAAA,EAAAQ,GAAA,cAAAmB,IAAA,GAAAL,GAAA,CAAAtB,GAAA,EAAAQ,GAAA,OAAAP,KAAA,GAAA0B,IAAA,CAAA1B,KAAA,WAAA2B,KAAA,IAAAJ,MAAA,CAAAI,KAAA,iBAAAD,IAAA,CAAAE,IAAA,IA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CAACjB,KAAK,CAAC;MACtBA,KAAK,EAAEA,KAAK;MACZ4C,OAAO,EAAED;IACX,CAAC,CAAe;EAClB;AACF;AAAC5B,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
|
package/lib/esm/index.js
CHANGED
|
@@ -80,14 +80,14 @@ Object.keys(_OAuthScene).forEach(function (key) {
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
-
var
|
|
84
|
-
Object.keys(
|
|
83
|
+
var _OAuthForm = require("./OAuthForm");
|
|
84
|
+
Object.keys(_OAuthForm).forEach(function (key) {
|
|
85
85
|
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] ===
|
|
86
|
+
if (key in exports && exports[key] === _OAuthForm[key]) return;
|
|
87
87
|
Object.defineProperty(exports, key, {
|
|
88
88
|
enumerable: true,
|
|
89
89
|
get: function get() {
|
|
90
|
-
return
|
|
90
|
+
return _OAuthForm[key];
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.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\nexport * from './adaptorUtils'\nexport * from './APIErrorDisplay'\nexport * from './browserAdaptor'\nexport * from './extensionAdaptor'\nexport * from './ExtMarkdown'\nexport * from './authUtils'\nexport * from './OAuthScene'\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":["_adaptorUtils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_APIErrorDisplay","_browserAdaptor","_extensionAdaptor","_ExtMarkdown","_authUtils","_OAuthScene","_OAuthForm"],"sources":["../../src/index.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\nexport * from './adaptorUtils'\nexport * from './APIErrorDisplay'\nexport * from './browserAdaptor'\nexport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MAAAU,WAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAM,WAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,UAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,UAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,UAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAO,UAAA,CAAAX,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extensionAdaptor.js","names":["ExtensionAuthAdaptor","constructor","sdk","login","ExtensionAdaptor","extensionSdk","_themeOverrides","getThemeOverrides","lookerHostData","hostType","copyToClipboard","location","hostOrigin","extensionId","pathname","search","url","clipboardWrite","isExtension","localStorageGetItem","
|
|
1
|
+
{"version":3,"file":"extensionAdaptor.js","names":["_adaptorUtils","require","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","done","Promise","then","_asyncToGenerator","fn","self","args","arguments","apply","err","ExtensionAuthAdaptor","constructor","sdk","login","exports","ExtensionAdaptor","extensionSdk","_themeOverrides","getThemeOverrides","lookerHostData","hostType","copyToClipboard","location","_this","hostOrigin","extensionId","pathname","search","url","concat","clipboardWrite","isExtension","localStorageGetItem","_this2","localStorageSetItem","_this3","localStorageRemoveItem","_this4","themeOverrides","openBrowserWindow","target","logError","componentStack","message"],"sources":["../src/extensionAdaptor.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 { ExtensionSDK } from '@looker/extension-sdk'\nimport type { IAPIMethods } from '@looker/sdk-rtl'\nimport type {\n IEnvironmentAdaptor,\n ThemeOverrides,\n IAuthAdaptor,\n} from './adaptorUtils'\nimport { getThemeOverrides } from './adaptorUtils'\n\nexport class ExtensionAuthAdaptor implements IAuthAdaptor {\n constructor(public readonly sdk: IAPIMethods) {}\n\n async login() {\n // Noop for extensions. Authentication is not required in an extension context\n return true\n }\n}\n\n/**\n * An adaptor class for interacting with browser APIs when running as an extension\n */\nexport class ExtensionAdaptor\n extends ExtensionAuthAdaptor\n implements IEnvironmentAdaptor\n{\n _themeOverrides: ThemeOverrides\n\n constructor(public extensionSdk: ExtensionSDK, sdk: IAPIMethods) {\n super(sdk)\n this._themeOverrides = getThemeOverrides(\n (this.extensionSdk.lookerHostData || { hostType: 'standard' })\n .hostType === 'standard'\n )\n }\n\n async copyToClipboard(location?: { pathname: string; search: string }) {\n const { lookerHostData } = this.extensionSdk\n if (lookerHostData && location) {\n const { hostOrigin, extensionId } = lookerHostData\n const { pathname, search } = location\n const url = `${hostOrigin}/extensions/${extensionId}${pathname}${search}`\n await this.extensionSdk.clipboardWrite(url)\n }\n }\n\n isExtension() {\n return true\n }\n\n async localStorageGetItem(key: string) {\n return await this.extensionSdk.localStorageGetItem(key)\n }\n\n async localStorageSetItem(key: string, value: string) {\n await this.extensionSdk.localStorageSetItem(key, value)\n }\n\n async localStorageRemoveItem(key: string) {\n await this.extensionSdk.localStorageRemoveItem(key)\n }\n\n themeOverrides(): ThemeOverrides {\n return this._themeOverrides\n }\n\n openBrowserWindow(url: string, target?: string) {\n this.extensionSdk.openBrowserWindow(url, target)\n }\n\n logError(error: Error, componentStack: string): void {\n this.extensionSdk.error({\n error: error,\n message: componentStack,\n } as ErrorEvent)\n }\n}\n"],"mappings":";;;;;;AAiCA,IAAAA,aAAA,GAAAC,OAAA;AAAkD,SAAAC,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,GAAA,QAAAR,GAAA,GAAAS,YAAA,CAAAD,GAAA,2BAAAR,GAAA,gBAAAA,GAAA,GAAAU,MAAA,CAAAV,GAAA;AAAA,SAAAS,aAAAE,KAAA,EAAAC,IAAA,eAAAD,KAAA,iBAAAA,KAAA,kBAAAA,KAAA,MAAAE,IAAA,GAAAF,KAAA,CAAAG,MAAA,CAAAC,WAAA,OAAAF,IAAA,KAAAG,SAAA,QAAAC,GAAA,GAAAJ,IAAA,C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AACjE,GAAW,EAAE;IAAA,IAAAkE,MAAA;IAAA,OAAAlC,iBAAA;MACxC,MAAMkC,MAAI,CAACrB,YAAY,CAACoB,sBAAsB,CAACjE,GAAG,CAAC;IAAA;EACrD;EAEAmE,cAAcA,CAAA,EAAmB;IAC/B,OAAO,IAAI,CAACrB,eAAe;EAC7B;EAEAsB,iBAAiBA,CAACX,GAAW,EAAEY,MAAe,EAAE;IAC9C,IAAI,CAACxB,YAAY,CAACuB,iBAAiB,CAACX,GAAG,EAAEY,MAAM,CAAC;EAClD;EAEAC,QAAQA,CAAC1C,KAAY,EAAE2C,cAAsB,EAAQ;IACnD,IAAI,CAAC1B,YAAY,CAACjB,KAAK,CAAC;MACtBA,KAAK,EAAEA,KAAK;MACZ4C,OAAO,EAAED;IACX,CAAC,CAAe;EAClB;AACF;AAAC5B,OAAA,CAAAC,gBAAA,GAAAA,gBAAA"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -80,14 +80,14 @@ Object.keys(_OAuthScene).forEach(function (key) {
|
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
|
-
var
|
|
84
|
-
Object.keys(
|
|
83
|
+
var _OAuthForm = require("./OAuthForm");
|
|
84
|
+
Object.keys(_OAuthForm).forEach(function (key) {
|
|
85
85
|
if (key === "default" || key === "__esModule") return;
|
|
86
|
-
if (key in exports && exports[key] ===
|
|
86
|
+
if (key in exports && exports[key] === _OAuthForm[key]) return;
|
|
87
87
|
Object.defineProperty(exports, key, {
|
|
88
88
|
enumerable: true,
|
|
89
89
|
get: function get() {
|
|
90
|
-
return
|
|
90
|
+
return _OAuthForm[key];
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
});
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.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\nexport * from './adaptorUtils'\nexport * from './APIErrorDisplay'\nexport * from './browserAdaptor'\nexport * from './extensionAdaptor'\nexport * from './ExtMarkdown'\nexport * from './authUtils'\nexport * from './OAuthScene'\nexport * from './
|
|
1
|
+
{"version":3,"file":"index.js","names":["_adaptorUtils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_APIErrorDisplay","_browserAdaptor","_extensionAdaptor","_ExtMarkdown","_authUtils","_OAuthScene","_OAuthForm"],"sources":["../src/index.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\nexport * from './adaptorUtils'\nexport * from './APIErrorDisplay'\nexport * from './browserAdaptor'\nexport * from './extensionAdaptor'\nexport * from './ExtMarkdown'\nexport * from './authUtils'\nexport * from './OAuthScene'\nexport * from './OAuthForm'\n"],"mappings":";;;;;AA0BA,IAAAA,aAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,aAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,aAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,aAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,gBAAA,CAAAL,GA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AA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAS,UAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAK,UAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,WAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,WAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAU,WAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAM,WAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,UAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,UAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAW,UAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAO,UAAA,CAAAX,GAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@looker/extension-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Looker Extension Utilities",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -25,14 +25,17 @@
|
|
|
25
25
|
"watch": "yarn lerna exec --scope @looker/extension-utils --stream 'BABEL_ENV=build babel src --root-mode upward --out-dir lib/esm --source-maps --extensions .ts,.tsx --no-comments --watch'"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@looker/code-editor": "^0.1.
|
|
28
|
+
"@looker/code-editor": "^0.1.29",
|
|
29
29
|
"@looker/components": "^4.1.1",
|
|
30
|
-
"@looker/extension-sdk": "^23.
|
|
31
|
-
"@looker/extension-sdk-react": "^23.
|
|
32
|
-
"@looker/
|
|
33
|
-
"@looker/sdk
|
|
30
|
+
"@looker/extension-sdk": "^23.10.0",
|
|
31
|
+
"@looker/extension-sdk-react": "^23.10.0",
|
|
32
|
+
"@looker/redux": "^0.0.1",
|
|
33
|
+
"@looker/sdk": "^23.10.0",
|
|
34
|
+
"@looker/sdk-rtl": "^21.6.1",
|
|
35
|
+
"@reduxjs/toolkit": "^1.9.3",
|
|
34
36
|
"@styled-icons/material": "^10.47.0",
|
|
35
37
|
"react": "^16.14.0",
|
|
38
|
+
"react-redux": "^7.2.3",
|
|
36
39
|
"react-router-dom": "^5.3.4"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
@@ -47,5 +50,5 @@
|
|
|
47
50
|
"webpack-cli": "^4.6.0",
|
|
48
51
|
"webpack-merge": "^5.7.3"
|
|
49
52
|
},
|
|
50
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "03f443d0eedb8cd7b06f6e501bd4f28a37db5069"
|
|
51
54
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollapserCard.js","names":["CollapserCard","id","heading","children","defaultOpen","divider","level","value","toggle","useToggle","close","open"],"sources":["../../../src/OAuthConfigForm/Collapser/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 { useToggle, Accordion2, Divider, Box2 } from '@looker/components'\nimport { ArrowRight, ArrowDropDown } 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;AACA;AACA;AACA;AAAgD;AAazC,IAAMA,aAAqC,GAAG,QAM/C;EAAA,IANgD;IACpDC,EAAE;IACFC,OAAO;IACPC,QAAQ;IACRC,WAAW,GAAG,IAAI;IAClBC,OAAO,GAAG;EACZ,CAAC;EACC,IAAMC,KAAK,GAAGD,OAAO,GAAG,IAAI,GAAG,IAAI;EACnC,IAAM;IAAEE,KAAK;IAAEC;EAAO,CAAC,GAAG,IAAAC,qBAAS,EAACL,WAAW,CAAC;EAEhD,OACE,6BAAC,gBAAI;IAAC,OAAO,EAAC,MAAM;IAAC,aAAa,EAAC;EAAQ,GACxCC,OAAO,IAAI,6BAAC,mBAAO;IAAC,UAAU,EAAC;EAAO,EAAG,EAC1C,6BAAC,sBAAU;IACT,EAAE,EAAEJ,EAAG;IACP,iBAAiB,EAAC,MAAM;IACxB,MAAM,EAAEM,KAAM;IACd,UAAU,EAAEC,MAAO;IACnB,cAAc,EAAE;MAAEE,KAAK,EAAE,6BAAC,oBAAU,OAAG;MAAEC,IAAI,EAAE,6BAAC,uBAAa;IAAI,CAAE;IACnE,KAAK,EAAE,6BAAC,4BAAa;MAAC,EAAE,EAAEL;IAAM,GAAEJ,OAAO;EAAkB,GAE3D,6BAAC,gBAAI;IAAC,EAAE,EAAC;EAAQ,GAAEC,QAAQ,CAAQ,CACxB,CACR;AAEX,CAAC;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CollapserCard } from './CollapserCard';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "CollapserCard", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _CollapserCard.CollapserCard;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _CollapserCard = require("./CollapserCard");
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/OAuthConfigForm/Collapser/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 { CollapserCard } from './CollapserCard'\n"],"mappings":";;;;;;;;;;;AAyBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigHeading.js","names":["ConfigHeading","styled","Heading","attrs","mb","pt"],"sources":["../../src/OAuthConfigForm/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;AACA;AAA4C;AAGrC,IAAMA,aAAa,GAAG,IAAAC,yBAAM,EAACC,mBAAO,CAAC,CAACC,KAAK,CAChD;EAAA,IAAC;IAAEC,EAAE,GAAG,QAAQ;IAAEC,EAAE,GAAG;EAAuB,CAAC;EAAA,OAAM;IAAED,EAAE;IAAEC;EAAG,CAAC;AAAA,CAAC,CACjE;EAAA;EAAA;AAAA,QAAE;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthConfigForm.js","names":["readyToLogin","EmptyConfig","base_url","looker_url","OAuthConfigForm","setHasConfig","clientId","clientLabel","configKey","location","useLocation","redirect_uri","appPath","appConfig","adaptor","getEnvAdaptor","sdk","getConfig","data","localStorage","getItem","result","JSON","parse","config","apiServerUrl","setApiServerUrl","useState","fetchedUrl","setFetchedUrl","webUrl","setWebUrl","messageBarIntent","setMessageBarIntent","messageBarText","setMessageBarText","validationMessages","setValidationMessages","saved","setSaved","updateMessageBar","intent","message","isConfigured","fetchError","saveConfig","baseUrl","client_id","setItem","stringify","verifyUrl","versionsUrl","versions","getVersions","web_server_url","e","undefined","handleSave","api_server_url","handleVerify","handleClear","_e","removeItem","isAuthenticated","handleUrlChange","event","name","currentTarget","value","newValidationMessages","url","validateUrl","type","authSession","verifyButtonDisabled","trim","length","Object","keys","saveButtonDisabled","clearButtonDisabled","loginButtonDisabled","handleLogin","preventDefault","login","useEffect","window","origin"],"sources":["../../src/OAuthConfigForm/OAuthConfigForm.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, { useState, useEffect } from 'react'\nimport type { ValidationMessages, MessageBarIntent } from '@looker/components'\nimport {\n Button,\n ButtonTransparent,\n Divider,\n Fieldset,\n FieldText,\n Form,\n MessageBar,\n Paragraph,\n Link,\n Space,\n SpaceVertical,\n Span,\n Tooltip,\n} from '@looker/components'\nimport { CodeCopy } from '@looker/code-editor'\nimport type { ILookerVersions } from '@looker/sdk-codegen'\nimport { useLocation } from 'react-router-dom'\nimport { appPath, getEnvAdaptor } from '..'\nimport { ConfigHeading } from './ConfigHeading'\nimport { CollapserCard } from './Collapser'\nimport { getVersions, validateUrl } from './utils'\nimport type { ConfigValues } from './utils'\n\nexport const readyToLogin =\n 'OAuth is configured but your browser session is not authenticated. Click Login.'\n\nconst EmptyConfig = { base_url: '', looker_url: '' }\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 OAuthConfigForm = ({\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 // See https://codesandbox.io/s/youthful-surf-0g27j?file=/src/index.tsx for a prototype from Luke\n // TODO see about useReducer to clean this up a bit more\n\n const getConfig = () => {\n // TODO: This is temporary until config settings are available in redux.\n // get configuration from storage, or default it\n const data = localStorage.getItem(configKey)\n const result = data ? JSON.parse(data) : EmptyConfig\n return result\n }\n\n const config = getConfig()\n const [apiServerUrl, setApiServerUrl] = useState('')\n const [fetchedUrl, setFetchedUrl] = useState('')\n const [webUrl, setWebUrl] = useState('')\n const [messageBarIntent, setMessageBarIntent] =\n useState<MessageBarIntent>('positive')\n const [messageBarText, setMessageBarText] = useState('')\n const [validationMessages, setValidationMessages] =\n useState<ValidationMessages>({})\n const [saved, setSaved] = useState<ConfigValues>(config)\n\n const updateMessageBar = (intent: MessageBarIntent, message: string) => {\n setMessageBarIntent(intent)\n setMessageBarText(message)\n }\n\n const isConfigured = () => {\n return (\n apiServerUrl === saved.base_url &&\n webUrl === saved.looker_url &&\n apiServerUrl !== '' &&\n webUrl !== ''\n )\n }\n\n const fetchError = (message: string) => {\n setWebUrl('')\n updateMessageBar('critical', message)\n }\n\n const saveConfig = (baseUrl: string, webUrl: string) => {\n const data = {\n base_url: baseUrl,\n looker_url: webUrl,\n client_id: clientId,\n redirect_uri,\n }\n // TODO: replace when redux is introduced\n localStorage.setItem(configKey, JSON.stringify(data))\n if (setHasConfig) setHasConfig(true)\n setSaved(data)\n updateMessageBar('positive', `Saved ${webUrl} as OAuth server`)\n }\n\n const verifyUrl = async (): Promise<ILookerVersions | undefined> => {\n updateMessageBar(messageBarIntent, '')\n const versionsUrl = `${apiServerUrl}/versions`\n try {\n setFetchedUrl(apiServerUrl)\n const versions = await getVersions(versionsUrl)\n\n if (versions) {\n updateMessageBar('positive', 'Configuration is valid')\n setWebUrl(versions.web_server_url)\n }\n\n return versions\n } catch (e: any) {\n fetchError(e.message)\n return undefined\n }\n }\n\n const handleSave = async () => {\n const versions = await verifyUrl()\n if (versions) {\n saveConfig(versions.api_server_url, versions.web_server_url)\n }\n }\n\n const handleVerify = () => {\n verifyUrl()\n }\n\n const handleClear = async (_e: BaseSyntheticEvent) => {\n // TODO: replace when redux is introduced to run it\n localStorage.removeItem(configKey)\n\n setApiServerUrl('')\n setFetchedUrl('')\n setWebUrl('')\n setMessageBarText('')\n setMessageBarIntent('critical')\n setSaved(EmptyConfig)\n\n if (setHasConfig) setHasConfig(false)\n if (isAuthenticated()) {\n updateMessageBar('warn', 'Please reload the browser page to log out')\n }\n }\n\n const handleUrlChange = (event: FormEvent<HTMLInputElement>) => {\n const name = event.currentTarget.name\n const value = event.currentTarget.value\n\n const newValidationMessages = { ...validationMessages }\n\n setApiServerUrl(value)\n setWebUrl('')\n\n const url = validateUrl(value)\n if (url) {\n delete newValidationMessages[name]\n // Update URL if it's been cleaned up\n setApiServerUrl(url)\n } else {\n newValidationMessages[name] = {\n message: `'${value}' is not a valid url`,\n type: 'error',\n }\n }\n\n setValidationMessages(newValidationMessages)\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 const data = getConfig()\n const { base_url, looker_url } = data\n setApiServerUrl(base_url)\n setWebUrl(looker_url)\n }, [])\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={messageBarIntent}\n onPrimaryClick={() => updateMessageBar(messageBarIntent, '')}\n visible={messageBarText !== ''}\n >\n {messageBarText}\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={true}\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;AAEA;AAeA;AAEA;AACA;AACA;AACA;AACA;AAAkD;AAAA;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;EAAO,EAAG,EAC9B,6BAAC,wBAAa;IACZ,OAAO,EAAC,sBAAsB;IAC9B,OAAO,EAAE,KAAM;IACf,EAAE,EAAC,eAAe;IAClB,WAAW,EAAE,CAACM,eAAe;EAAG,GAEhC,6BAAC,yBAAa;IAAC,EAAE,EAAC,IAAI;IAAC,EAAE,EAAC;EAAI,GAC3BA,eAAe,EAAE,GAChB,6BAAC,gBAAI,QAAC,wDAAsD,CAAO,GACjEpB,YAAY,EAAE,GAChB,4DACE,6BAAC,gBAAI,QAAE3C,YAAY,CAAQ,CAC1B,GAEH,6BAAC,gBAAI,QAAC,gEAEN,CACD,EACD,6BAAC,mBAAO;IAAC,OAAO,qBAAc8B,MAAM;EAAe,GACjD,6BAAC,kBAAM;IAAC,OAAO,EAAEoD,WAAY;IAAC,QAAQ,EAAED;EAAoB,GAAC,OAE7D,CAAS,CACD,CACI,CACF,CACF;AAEpB,CAAC;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { OAuthConfigForm } from './OAuthConfigForm';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "OAuthConfigForm", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _OAuthConfigForm.OAuthConfigForm;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _OAuthConfigForm = require("./OAuthConfigForm");
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/OAuthConfigForm/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 { OAuthConfigForm } from './OAuthConfigForm'\n"],"mappings":";;;;;;;;;;;AAyBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":["getUrl","url","settings","DefaultSettings","base_url","verify_ssl","xp","BrowserTransport","response","rawRequest","body","getVersions","versionsUrl","versions","content","JSON","parse","Error","validateUrl","result","URL","endsWith","origin"],"sources":["../../src/OAuthConfigForm/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;AAAmE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAS5D,IAAMA,MAAM;EAAA,6BAAG,WAAOC,GAAW,EAAqC;IAC3E,IAAMC,QAAQ,mCACT,IAAAC,uBAAe,GAAE,GACjB;MAAEC,QAAQ,EAAEH,GAAG;MAAEI,UAAU,EAAE;IAAM,CAAC,CACxC;IACD,IAAMC,EAAE,GAAG,IAAIC,wBAAgB,CAACL,QAAQ,CAAC;IACzC,IAAMM,QAAQ,SAASF,EAAE,CAACG,UAAU,CAAC,KAAK,EAAER,GAAG,CAAC;IAChD,OAAOO,QAAQ,CAACE,IAAI;EACtB,CAAC;EAAA,gBARYV,MAAM;IAAA;EAAA;AAAA,GAQlB;AAAA;AAMM,IAAMW,WAAW;EAAA,8BAAG,WACzBC,WAAmB,EACsB;IACzC,IAAIC,QAAQ;IACZ,IAAI;MACF,IAAMC,OAAO,SAASd,MAAM,CAACY,WAAW,CAAC;MACzCC,QAAQ,GAAG,OAAOC,OAAO,KAAK,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACF,OAAO,CAAC,GAAGA,OAAO;IACxE,CAAC,CAAC,gBAAM;MACN,MAAM,IAAIG,KAAK,CAAC,8BAA8B,CAAC;IACjD;IACA,OAAOJ,QAAQ;EACjB,CAAC;EAAA,gBAXYF,WAAW;IAAA;EAAA;AAAA,GAWvB;AAAA;AAOM,IAAMO,WAAW,GAAIjB,GAAW,IAAa;EAClD,IAAI;IACF,IAAMkB,MAAM,GAAG,IAAIC,GAAG,CAACnB,GAAG,CAAC;IAC3B,IAAIA,GAAG,CAACoB,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAOpB,GAAG;IACjC,OAAOkB,MAAM,CAACG,MAAM;EACtB,CAAC,CAAC,iBAAM;IACN,OAAO,EAAE;EACX;AACF,CAAC;AAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CollapserCard.js","names":["CollapserCard","id","heading","children","defaultOpen","divider","level","value","toggle","useToggle","close","open"],"sources":["../../../../src/OAuthConfigForm/Collapser/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 { useToggle, Accordion2, Divider, Box2 } from '@looker/components'\nimport { ArrowRight, ArrowDropDown } 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;AACA;AACA;AACA;AAAgD;AAazC,IAAMA,aAAqC,GAAG,QAM/C;EAAA,IANgD;IACpDC,EAAE;IACFC,OAAO;IACPC,QAAQ;IACRC,WAAW,GAAG,IAAI;IAClBC,OAAO,GAAG;EACZ,CAAC;EACC,IAAMC,KAAK,GAAGD,OAAO,GAAG,IAAI,GAAG,IAAI;EACnC,IAAM;IAAEE,KAAK;IAAEC;EAAO,CAAC,GAAG,IAAAC,qBAAS,EAACL,WAAW,CAAC;EAEhD,OACE,6BAAC,gBAAI;IAAC,OAAO,EAAC,MAAM;IAAC,aAAa,EAAC;EAAQ,GACxCC,OAAO,IAAI,6BAAC,mBAAO;IAAC,UAAU,EAAC;EAAO,EAAG,EAC1C,6BAAC,sBAAU;IACT,EAAE,EAAEJ,EAAG;IACP,iBAAiB,EAAC,MAAM;IACxB,MAAM,EAAEM,KAAM;IACd,UAAU,EAAEC,MAAO;IACnB,cAAc,EAAE;MAAEE,KAAK,EAAE,6BAAC,oBAAU,OAAG;MAAEC,IAAI,EAAE,6BAAC,uBAAa;IAAI,CAAE;IACnE,KAAK,EAAE,6BAAC,4BAAa;MAAC,EAAE,EAAEL;IAAM,GAAEJ,OAAO;EAAkB,GAE3D,6BAAC,gBAAI;IAAC,EAAE,EAAC;EAAQ,GAAEC,QAAQ,CAAQ,CACxB,CACR;AAEX,CAAC;AAAA"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "CollapserCard", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _CollapserCard.CollapserCard;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
var _CollapserCard = require("./CollapserCard");
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/OAuthConfigForm/Collapser/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 { CollapserCard } from './CollapserCard'\n"],"mappings":";;;;;;;;;;;AAyBA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigHeading.js","names":["ConfigHeading","styled","Heading","attrs","mb","pt"],"sources":["../../../src/OAuthConfigForm/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;AACA;AAA4C;AAGrC,IAAMA,aAAa,GAAG,IAAAC,yBAAM,EAACC,mBAAO,CAAC,CAACC,KAAK,CAChD;EAAA,IAAC;IAAEC,EAAE,GAAG,QAAQ;IAAEC,EAAE,GAAG;EAAuB,CAAC;EAAA,OAAM;IAAED,EAAE;IAAEC;EAAG,CAAC;AAAA,CAAC,CACjE;EAAA;EAAA;AAAA,QAAE;AAAA"}
|