@descope/web-component 3.45.1 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/constants/index.js +1 -1
- package/dist/cjs/constants/index.js.map +1 -1
- package/dist/cjs/descope-wc/BaseDescopeWc.js +1 -1
- package/dist/cjs/descope-wc/DescopeWc.js +1 -1
- package/dist/cjs/descope-wc/DescopeWc.js.map +1 -1
- package/dist/cjs/helpers/helpers.js +1 -1
- package/dist/cjs/helpers/helpers.js.map +1 -1
- package/dist/cjs/types.js.map +1 -1
- package/dist/esm/constants/index.js +1 -1
- package/dist/esm/constants/index.js.map +1 -1
- package/dist/esm/descope-wc/BaseDescopeWc.js +1 -1
- package/dist/esm/descope-wc/DescopeWc.js +1 -1
- package/dist/esm/descope-wc/DescopeWc.js.map +1 -1
- package/dist/esm/helpers/helpers.js +1 -1
- package/dist/esm/helpers/helpers.js.map +1 -1
- package/dist/esm/types.js.map +1 -1
- package/dist/index.d.ts +43 -42
- package/dist/index.js +2 -2
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../src/lib/helpers/helpers.ts"],"sourcesContent":["import {\n ASSETS_FOLDER,\n BASE_CONTENT_URL,\n DESCOPE_ATTRIBUTE_PREFIX,\n URL_CODE_PARAM_NAME,\n URL_ERR_PARAM_NAME,\n URL_RUN_IDS_PARAM_NAME,\n URL_TOKEN_PARAM_NAME,\n URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME,\n URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME,\n URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME,\n URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME,\n OIDC_IDP_STATE_ID_PARAM_NAME,\n SAML_IDP_STATE_ID_PARAM_NAME,\n SAML_IDP_USERNAME_PARAM_NAME,\n SSO_APP_ID_PARAM_NAME,\n OIDC_LOGIN_HINT_PARAM_NAME,\n DESCOPE_IDP_INITIATED_PARAM_NAME,\n OVERRIDE_CONTENT_URL,\n OIDC_PROMPT_PARAM_NAME,\n OIDC_ERROR_REDIRECT_URI_PARAM_NAME,\n THIRD_PARTY_APP_ID_PARAM_NAME,\n THIRD_PARTY_APP_STATE_ID_PARAM_NAME,\n APPLICATION_SCOPES_PARAM_NAME,\n SDK_SCRIPT_RESULTS_KEY,\n URL_REDIRECT_MODE_PARAM_NAME,\n} from '../constants';\nimport { EXCLUDED_STATE_KEYS } from '../constants/customScreens';\nimport {\n AutoFocusOptions,\n CustomScreenState,\n Direction,\n Locale,\n SSOQueryParams,\n StepState,\n} from '../types';\n\nconst MD_COMPONENTS = ['descope-enriched-text'];\n\nfunction getUrlParam(paramName: string) {\n const urlParams = new URLSearchParams(window.location.search);\n\n return urlParams.get(paramName);\n}\n\nfunction getFlowUrlParam() {\n return getUrlParam(URL_RUN_IDS_PARAM_NAME);\n}\n\nfunction setFlowUrlParam(id: string) {\n if (window.history.pushState && id !== getFlowUrlParam()) {\n const newUrl = new URL(window.location.href);\n const search = new URLSearchParams(newUrl.search);\n search.set(URL_RUN_IDS_PARAM_NAME, id);\n newUrl.search = search.toString();\n window.history.pushState({}, '', newUrl.toString());\n }\n}\n\nfunction resetUrlParam(paramName: string) {\n if (window.history.replaceState && getUrlParam(paramName)) {\n const newUrl = new URL(window.location.href);\n const search = new URLSearchParams(newUrl.search);\n search.delete(paramName);\n newUrl.search = search.toString();\n window.history.replaceState({}, '', newUrl.toString());\n }\n}\n\nconst getFlowIdFromExecId = (executionId: string) => {\n const regex = /(.*)\\|#\\|.*/;\n return regex.exec(executionId)?.[1] || '';\n};\n\nexport async function fetchContent<T extends 'text' | 'json'>(\n url: string,\n returnType: T,\n): Promise<{\n body: T extends 'json' ? Record<string, any> : string;\n headers: Record<string, string>;\n}> {\n const res = await fetch(url, { cache: 'default' });\n if (!res.ok) {\n throw Error(`Error fetching URL ${url} [${res.status}]`);\n }\n\n return {\n body: await res[returnType || 'text'](),\n headers: Object.fromEntries(res.headers.entries()),\n };\n}\n\nconst pathJoin = (...paths: string[]) => paths.join('/').replace(/\\/+/g, '/'); // preventing duplicate separators\n\nexport function getContentUrl({\n projectId,\n filename,\n assetsFolder = ASSETS_FOLDER,\n baseUrl,\n}: {\n projectId: string;\n filename: string;\n assetsFolder?: string;\n baseUrl?: string;\n}) {\n const url = new URL(OVERRIDE_CONTENT_URL || baseUrl || BASE_CONTENT_URL);\n url.pathname = pathJoin(url.pathname, projectId, assetsFolder, filename);\n\n return url.toString();\n}\n\nexport function getAnimationDirection(\n currentIdxStr: string,\n prevIdxStr: string,\n) {\n if (!prevIdxStr) return undefined;\n\n const currentIdx = +currentIdxStr;\n const prevIdx = +prevIdxStr;\n\n if (Number.isNaN(currentIdx) || Number.isNaN(prevIdx)) return undefined;\n if (currentIdx > prevIdx) return Direction.forward;\n if (currentIdx < prevIdx) return Direction.backward;\n return undefined;\n}\n\nexport const getRunIdsFromUrl = (flowId: string) => {\n let [executionId = '', stepId = ''] = (getFlowUrlParam() || '').split('_');\n const executionFlowId = getFlowIdFromExecId(executionId);\n\n // if the flow id does not match, this execution id is not for this flow\n if (!flowId || (executionFlowId && executionFlowId !== flowId)) {\n executionId = '';\n stepId = '';\n }\n\n return { executionId, stepId, executionFlowId };\n};\n\nexport const setRunIdsOnUrl = (executionId: string, stepId: string) => {\n setFlowUrlParam([executionId, stepId].join('_'));\n};\n\nexport function isChromium() {\n return (\n /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)\n );\n}\n\nexport function clearRunIdsFromUrl() {\n resetUrlParam(URL_RUN_IDS_PARAM_NAME);\n}\n\nexport function getTokenFromUrl() {\n return getUrlParam(URL_TOKEN_PARAM_NAME) || undefined;\n}\n\nexport function clearTokenFromUrl() {\n resetUrlParam(URL_TOKEN_PARAM_NAME);\n}\n\nexport function getCodeFromUrl() {\n return getUrlParam(URL_CODE_PARAM_NAME) || undefined;\n}\n\nexport function getIsPopupFromUrl() {\n return getUrlParam(URL_REDIRECT_MODE_PARAM_NAME) === 'popup';\n}\n\nexport function getExchangeErrorFromUrl() {\n return getUrlParam(URL_ERR_PARAM_NAME) || undefined;\n}\n\nexport function clearCodeFromUrl() {\n resetUrlParam(URL_CODE_PARAM_NAME);\n}\n\nexport function clearIsPopupFromUrl() {\n resetUrlParam(URL_REDIRECT_MODE_PARAM_NAME);\n}\n\nexport function clearExchangeErrorFromUrl() {\n resetUrlParam(URL_ERR_PARAM_NAME);\n}\n\nexport function getRedirectAuthFromUrl() {\n const redirectAuthCodeChallenge = getUrlParam(\n URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME,\n );\n const redirectAuthCallbackUrl = getUrlParam(\n URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME,\n );\n const redirectAuthBackupCallbackUri = getUrlParam(\n URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME,\n );\n const redirectAuthInitiator = getUrlParam(\n URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME,\n );\n return {\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n };\n}\n\nexport function getOIDCIDPParamFromUrl() {\n return getUrlParam(OIDC_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearOIDCIDPParamFromUrl() {\n resetUrlParam(OIDC_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function getSAMLIDPParamFromUrl() {\n return getUrlParam(SAML_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearSAMLIDPParamFromUrl() {\n resetUrlParam(SAML_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function getSAMLIDPUsernameParamFromUrl() {\n return getUrlParam(SAML_IDP_USERNAME_PARAM_NAME);\n}\n\nexport function clearSAMLIDPUsernameParamFromUrl() {\n resetUrlParam(SAML_IDP_USERNAME_PARAM_NAME);\n}\n\nexport function getDescopeIDPInitiatedParamFromUrl() {\n return getUrlParam(DESCOPE_IDP_INITIATED_PARAM_NAME);\n}\n\nexport function clearDescopeIDPInitiatedParamFromUrl() {\n resetUrlParam(DESCOPE_IDP_INITIATED_PARAM_NAME);\n}\n\nexport function getSSOAppIdParamFromUrl() {\n return getUrlParam(SSO_APP_ID_PARAM_NAME);\n}\n\nexport function getThirdPartyAppIdParamFromUrl() {\n return getUrlParam(THIRD_PARTY_APP_ID_PARAM_NAME);\n}\n\nexport function clearSSOAppIdParamFromUrl() {\n resetUrlParam(SSO_APP_ID_PARAM_NAME);\n}\n\nexport function clearThirdPartyAppIdParamFromUrl() {\n resetUrlParam(THIRD_PARTY_APP_ID_PARAM_NAME);\n}\n\nexport function getThirdPartyAppStateIdParamFromUrl() {\n return getUrlParam(THIRD_PARTY_APP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearThirdPartyAppStateIdParamFromUrl() {\n resetUrlParam(THIRD_PARTY_APP_STATE_ID_PARAM_NAME);\n}\n\nexport function getApplicationScopesParamFromUrl() {\n return getUrlParam(APPLICATION_SCOPES_PARAM_NAME);\n}\n\nexport function clearApplicationScopesParamFromUrl() {\n resetUrlParam(APPLICATION_SCOPES_PARAM_NAME);\n}\n\nexport function getOIDCLoginHintParamFromUrl() {\n return getUrlParam(OIDC_LOGIN_HINT_PARAM_NAME);\n}\n\nexport function clearOIDCLoginHintParamFromUrl() {\n resetUrlParam(OIDC_LOGIN_HINT_PARAM_NAME);\n}\n\nexport function getOIDCPromptParamFromUrl() {\n return getUrlParam(OIDC_PROMPT_PARAM_NAME);\n}\n\nexport function clearOIDCPromptParamFromUrl() {\n resetUrlParam(OIDC_PROMPT_PARAM_NAME);\n}\n\nexport function getOIDCErrorRedirectUriParamFromUrl() {\n return getUrlParam(OIDC_ERROR_REDIRECT_URI_PARAM_NAME);\n}\n\nexport function clearOIDCErrorRedirectUriParamFromUrl() {\n resetUrlParam(OIDC_ERROR_REDIRECT_URI_PARAM_NAME);\n}\n\nexport const camelCase = (s: string) =>\n s.replace(/-./g, (x) => x[1].toUpperCase());\n\nexport const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\nexport const getElementDescopeAttributes = (ele: HTMLElement) =>\n Array.from(ele?.attributes || []).reduce((acc, attr) => {\n const descopeAttrName = new RegExp(\n `^${DESCOPE_ATTRIBUTE_PREFIX}(\\\\S+)$`,\n ).exec(attr.name)?.[1];\n\n return !descopeAttrName\n ? acc\n : Object.assign(acc, { [descopeAttrName]: attr.value });\n }, {});\n\nexport const getFlowConfig = (config: Record<string, any>, flowId: string) =>\n config?.flows?.[flowId] || {};\n\nexport const handleUrlParams = (\n flowId: string,\n logger: { debug: (...data: any[]) => void },\n) => {\n const { executionId, stepId, executionFlowId } = getRunIdsFromUrl(flowId);\n\n // if the flow id does not match, we do not want to read & remove any query params\n // because it's probably belongs to another flow\n if (executionFlowId && flowId !== executionFlowId) {\n logger.debug(\n 'Flow id does not match the execution flow id, skipping url params handling',\n );\n return { ssoQueryParams: {} };\n }\n\n if (executionId || stepId) {\n clearRunIdsFromUrl();\n }\n\n const token = getTokenFromUrl();\n if (token) {\n clearTokenFromUrl();\n }\n\n const code = getCodeFromUrl();\n if (code) {\n clearCodeFromUrl();\n }\n\n // this is used for oauth when we want to open the provider login page in a new tab\n const isPopup = getIsPopupFromUrl();\n if (isPopup) {\n clearIsPopupFromUrl();\n }\n\n const exchangeError = getExchangeErrorFromUrl();\n if (exchangeError) {\n clearExchangeErrorFromUrl();\n }\n\n // these query params are retained to allow the flow to be refreshed\n // without losing the redirect auth state\n const {\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n } = getRedirectAuthFromUrl();\n\n const oidcIdpStateId = getOIDCIDPParamFromUrl();\n if (oidcIdpStateId) {\n clearOIDCIDPParamFromUrl();\n }\n\n const samlIdpStateId = getSAMLIDPParamFromUrl();\n if (samlIdpStateId) {\n clearSAMLIDPParamFromUrl();\n }\n\n const samlIdpUsername = getSAMLIDPUsernameParamFromUrl();\n if (samlIdpStateId) {\n clearSAMLIDPUsernameParamFromUrl();\n }\n\n const descopeIdpInitiated = getDescopeIDPInitiatedParamFromUrl();\n if (descopeIdpInitiated) {\n clearDescopeIDPInitiatedParamFromUrl();\n }\n\n const ssoAppId = getSSOAppIdParamFromUrl();\n if (ssoAppId) {\n clearSSOAppIdParamFromUrl();\n }\n\n const thirdPartyAppId = getThirdPartyAppIdParamFromUrl();\n if (thirdPartyAppId) {\n clearThirdPartyAppIdParamFromUrl();\n }\n\n const thirdPartyAppStateId = getThirdPartyAppStateIdParamFromUrl();\n if (thirdPartyAppStateId) {\n clearThirdPartyAppStateIdParamFromUrl();\n }\n\n const applicationScopes = getApplicationScopesParamFromUrl();\n if (applicationScopes) {\n clearApplicationScopesParamFromUrl();\n }\n\n const oidcLoginHint = getOIDCLoginHintParamFromUrl();\n if (oidcLoginHint) {\n clearOIDCLoginHintParamFromUrl();\n }\n\n const oidcPrompt = getOIDCPromptParamFromUrl();\n if (oidcPrompt) {\n clearOIDCPromptParamFromUrl();\n }\n\n const oidcErrorRedirectUri = getOIDCErrorRedirectUriParamFromUrl();\n if (oidcErrorRedirectUri) {\n clearOIDCErrorRedirectUriParamFromUrl();\n }\n\n const idpInitiatedVal = descopeIdpInitiated === 'true';\n\n return {\n executionId,\n stepId,\n token,\n code,\n isPopup,\n exchangeError,\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n ssoQueryParams: {\n oidcIdpStateId,\n samlIdpStateId,\n samlIdpUsername,\n descopeIdpInitiated: idpInitiatedVal,\n ssoAppId,\n oidcLoginHint,\n oidcPrompt,\n oidcErrorRedirectUri,\n thirdPartyAppId,\n thirdPartyAppStateId,\n applicationScopes,\n },\n };\n};\n\nexport const loadFont = (url: string) => {\n if (!url) return;\n\n const font = document.createElement('link');\n font.href = url;\n font.rel = 'stylesheet';\n document.head.appendChild(font);\n};\n\nconst compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return Object.assign(\n (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n },\n {\n reset: () => {\n prevArgs = undefined;\n cache = undefined;\n },\n },\n );\n};\n\nexport const handleAutoFocus = (\n ele: HTMLElement,\n autoFocus: AutoFocusOptions,\n isFirstScreen: boolean,\n) => {\n if (\n autoFocus === true ||\n (autoFocus === 'skipFirstScreen' && !isFirstScreen)\n ) {\n // focus the first visible input\n const firstVisibleInput: HTMLInputElement = ele.querySelector('*[name]');\n setTimeout(() => {\n firstVisibleInput?.focus();\n });\n }\n};\n\nexport const handleReportValidityOnBlur = (rootEle: HTMLElement) => {\n rootEle.querySelectorAll('*[name]').forEach((ele: HTMLInputElement) => {\n ele.addEventListener('blur', () => {\n const onBlur = () => {\n // reportValidity also focus the element if it's invalid\n // in order to prevent this we need to override the focus method\n const origFocus = ele.focus;\n // eslint-disable-next-line no-param-reassign\n ele.focus = () => {};\n ele.reportValidity?.();\n setTimeout(() => {\n // eslint-disable-next-line no-param-reassign\n ele.focus = origFocus;\n });\n };\n\n const isInputAlreadyInErrorState = ele.getAttribute('invalid') === 'true';\n\n if (isInputAlreadyInErrorState || ele.value?.length) {\n onBlur();\n return;\n }\n\n // If the input is not in an error state, has no value, and a `formnovalidate` button was clicked,\n // we want to prevent triggering validation.\n // This handles a case where a required input was focused, and the user then clicked a social login button —\n // in that case, we don't want the required error message to flash for a split second.\n const ref = { timer: undefined };\n\n const onClick = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n\n if (target.getAttribute('formnovalidate') === 'true') {\n clearTimeout(ref.timer);\n ref.timer = undefined;\n }\n };\n\n ref.timer = setTimeout(() => {\n rootEle.removeEventListener('click', onClick);\n onBlur();\n ref.timer = undefined;\n }, 150);\n\n rootEle.addEventListener('click', onClick, { once: true });\n });\n });\n};\n\n/**\n * To return a fallback value in case the timeout expires and the promise\n * isn't fulfilled:\n *\n * const promise = loadUserCount();\n * const count = await timeoutPromise(2000, promise, 0);\n *\n * Or without a fallback value to just throw an error if the timeout expires:\n *\n * try {\n * count = await timeoutPromise(2000, promise);\n * }\n *\n * Fallback is returned only in case of timeout, so if the passed promise rejects\n * the fallback value is not used, and the returned promise will throw as well.\n */\nexport function timeoutPromise<T>(\n timeout: number,\n promise: Promise<T>,\n fallback?: T,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n let expired = false;\n const timer = setTimeout(() => {\n expired = true;\n if (fallback !== undefined) {\n resolve(fallback);\n } else {\n reject(new Error(`Promise timed out after ${timeout} ms`));\n }\n }, timeout);\n\n promise\n .then((value) => {\n if (!expired) {\n clearTimeout(timer);\n resolve(value);\n }\n })\n .catch((error) => {\n if (!expired) {\n clearTimeout(timer);\n reject(error);\n }\n });\n });\n}\n\nexport const getChromiumVersion = (): number => {\n const brands = (navigator as any)?.userAgentData?.brands;\n const found = brands?.find(\n ({ brand, version }) => brand === 'Chromium' && parseFloat(version),\n );\n return found ? found.version : 0;\n};\n\n// As an optimization - We can show first screen if we have startScreenId and we don't have any other of the ssoAppId/oidcIdpStateId/samlIdp params\n// - If there startScreenId it means that the sdk can show the first screen and we don't need to wait for the sdk to return the first screen\n// - If there is any one else of the other params (like oidcIdpStateId, ..) - we can't skip this call because descope may decide not to show the first screen (in cases like a user is already logged in)\nexport const showFirstScreenOnExecutionInit = (\n startScreenId: string,\n {\n oidcIdpStateId,\n samlIdpStateId,\n samlIdpUsername,\n ssoAppId,\n oidcLoginHint,\n oidcPrompt,\n oidcErrorRedirectUri,\n thirdPartyAppId,\n thirdPartyAppStateId,\n applicationScopes,\n }: SSOQueryParams,\n): boolean =>\n !!startScreenId &&\n !oidcIdpStateId &&\n !samlIdpStateId &&\n !samlIdpUsername &&\n !ssoAppId &&\n !oidcLoginHint &&\n !oidcPrompt &&\n !oidcErrorRedirectUri &&\n !thirdPartyAppId &&\n !thirdPartyAppStateId &&\n !applicationScopes;\n\nexport const injectSamlIdpForm = (\n url: string,\n samlResponse: string,\n relayState: string,\n submitCallback: (form: HTMLFormElement) => void,\n) => {\n const formEle = document.createElement('form');\n formEle.method = 'POST';\n formEle.action = url;\n formEle.innerHTML = `\n <input type=\"hidden\" role=\"saml-response\" name=\"SAMLResponse\" value=\"${samlResponse}\" />\n <input type=\"hidden\" role=\"saml-relay-state\" name=\"RelayState\" value=\"${relayState}\" />\n <input style=\"display: none;\" id=\"SAMLSubmitButton\" type=\"submit\" value=\"Continue\" />\n `;\n\n document.body.appendChild(formEle);\n\n submitCallback(formEle);\n};\n\nexport const submitForm = (formEle: HTMLFormElement) => formEle?.submit();\n\nexport const getFirstNonEmptyValue = (obj: object, keys: string[]) => {\n const firstNonEmptyKey = keys.find((key) => obj[key]);\n return firstNonEmptyKey ? obj[firstNonEmptyKey] : null;\n};\n\nexport const leadingDebounce = <T extends (...args: any[]) => void>(\n func: T,\n wait = 100,\n) => {\n let timeout: NodeJS.Timeout;\n return function executedFunction(...args) {\n if (!timeout) func.apply(this, args);\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n timeout = null;\n }, wait);\n } as T;\n};\n\nexport function getUserLocale(locale: string): Locale {\n if (locale) {\n return { locale: locale.toLowerCase(), fallback: locale.toLowerCase() };\n }\n const nl = navigator.language;\n if (!nl) {\n return { locale: '', fallback: '' };\n }\n\n if (nl.includes('-')) {\n return {\n locale: nl.toLowerCase(),\n fallback: nl.split('-')[0].toLowerCase(),\n };\n }\n\n return { locale: nl.toLowerCase(), fallback: nl.toLowerCase() };\n}\n\nexport const clearPreviousExternalInputs = () => {\n document\n .querySelectorAll('[data-hidden-input=\"true\"]')\n .forEach((ele) => ele.remove());\n};\n\nexport const shouldHandleMarkdown = (compName: string) =>\n MD_COMPONENTS.includes(compName);\n\nconst omitBy = <T extends Record<string, any>>(\n obj: T,\n predicate: (value: any, key: keyof T) => boolean,\n): T =>\n Object.fromEntries(\n Object.entries(obj).filter(\n ([key, value]) => !predicate(value, key as keyof T),\n ),\n ) as T;\n\nexport const transformStepStateForCustomScreen = (\n state: Partial<StepState>,\n) => {\n const sanitizedState: CustomScreenState = omitBy(\n state.screenState,\n (_, key) => EXCLUDED_STATE_KEYS.includes(key) || key.startsWith('_'),\n );\n\n const {\n screenState: { errorText, errorType },\n } = state;\n\n if (errorText || errorType) {\n sanitizedState.error = { text: errorText, type: errorType };\n }\n\n if (state.action) {\n sanitizedState.action = state.action;\n }\n\n if (state.screenState?.componentsConfig?.thirdPartyAppApproveScopes?.data) {\n sanitizedState.inboundAppApproveScopes =\n state.screenState.componentsConfig.thirdPartyAppApproveScopes.data;\n }\n\n return sanitizedState;\n};\n\nexport const transformScreenInputs = (inputs: Record<string, any>) => {\n const res = { ...inputs };\n\n if (inputs.inboundAppApproveScopes) {\n res.thirdPartyAppApproveScopes = inputs.inboundAppApproveScopes;\n }\n\n return res;\n};\n\nexport function getScriptResultPath(scriptId: string, resultKey?: string) {\n const path = resultKey ? `${scriptId}_${resultKey}` : scriptId;\n return `${SDK_SCRIPT_RESULTS_KEY}.${path}`;\n}\n\nexport const openCenteredPopup = (\n url: string,\n title: string,\n w: number,\n h: number,\n) => {\n const dualScreenLeft =\n window.screenLeft !== undefined\n ? window.screenLeft\n : (window.screen as any).left;\n const dualScreenTop =\n window.screenTop !== undefined\n ? window.screenTop\n : (window.screen as any).top;\n\n const width =\n window.innerWidth ||\n document.documentElement.clientWidth ||\n window.screen.width;\n const height =\n window.innerHeight ||\n document.documentElement.clientHeight ||\n window.screen.height;\n\n const left = (width - w) / 2 + dualScreenLeft;\n const top = (height - h) / 2 + dualScreenTop;\n\n const popup = window.open(\n url,\n title,\n `width=${w},height=${h},top=${top},left=${left},scrollbars=yes,resizable=yes`,\n );\n\n popup.focus();\n\n return popup;\n};\n"],"names":["MD_COMPONENTS","getUrlParam","paramName","URLSearchParams","window","location","search","get","resetUrlParam","history","replaceState","newUrl","URL","href","delete","toString","fetchContent","url","returnType","res","fetch","cache","ok","Error","status","body","headers","Object","fromEntries","entries","getContentUrl","projectId","filename","assetsFolder","ASSETS_FOLDER","baseUrl","OVERRIDE_CONTENT_URL","BASE_CONTENT_URL","pathname","paths","join","replace","pathJoin","getAnimationDirection","currentIdxStr","prevIdxStr","currentIdx","prevIdx","Number","isNaN","Direction","forward","backward","getRunIdsFromUrl","flowId","executionId","stepId","URL_RUN_IDS_PARAM_NAME","split","executionFlowId","_a","exec","getFlowIdFromExecId","isChromium","test","navigator","userAgent","vendor","clearRunIdsFromUrl","getTokenFromUrl","URL_TOKEN_PARAM_NAME","undefined","clearTokenFromUrl","getCodeFromUrl","URL_CODE_PARAM_NAME","getIsPopupFromUrl","URL_REDIRECT_MODE_PARAM_NAME","getExchangeErrorFromUrl","URL_ERR_PARAM_NAME","clearCodeFromUrl","clearIsPopupFromUrl","clearExchangeErrorFromUrl","getRedirectAuthFromUrl","redirectAuthCodeChallenge","URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME","redirectAuthCallbackUrl","URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME","redirectAuthBackupCallbackUri","URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME","redirectAuthInitiator","URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME","getOIDCIDPParamFromUrl","OIDC_IDP_STATE_ID_PARAM_NAME","clearOIDCIDPParamFromUrl","getSAMLIDPParamFromUrl","SAML_IDP_STATE_ID_PARAM_NAME","clearSAMLIDPParamFromUrl","getSAMLIDPUsernameParamFromUrl","SAML_IDP_USERNAME_PARAM_NAME","clearSAMLIDPUsernameParamFromUrl","getDescopeIDPInitiatedParamFromUrl","DESCOPE_IDP_INITIATED_PARAM_NAME","clearDescopeIDPInitiatedParamFromUrl","getSSOAppIdParamFromUrl","SSO_APP_ID_PARAM_NAME","getThirdPartyAppIdParamFromUrl","THIRD_PARTY_APP_ID_PARAM_NAME","clearSSOAppIdParamFromUrl","clearThirdPartyAppIdParamFromUrl","getThirdPartyAppStateIdParamFromUrl","THIRD_PARTY_APP_STATE_ID_PARAM_NAME","clearThirdPartyAppStateIdParamFromUrl","getApplicationScopesParamFromUrl","APPLICATION_SCOPES_PARAM_NAME","clearApplicationScopesParamFromUrl","getOIDCLoginHintParamFromUrl","OIDC_LOGIN_HINT_PARAM_NAME","clearOIDCLoginHintParamFromUrl","getOIDCPromptParamFromUrl","OIDC_PROMPT_PARAM_NAME","clearOIDCPromptParamFromUrl","getOIDCErrorRedirectUriParamFromUrl","OIDC_ERROR_REDIRECT_URI_PARAM_NAME","clearOIDCErrorRedirectUriParamFromUrl","camelCase","s","x","toUpperCase","createIsChanged","state","prevState","attrName","getElementDescopeAttributes","ele","Array","from","attributes","reduce","acc","attr","descopeAttrName","RegExp","DESCOPE_ATTRIBUTE_PREFIX","name","assign","value","handleUrlParams","logger","debug","ssoQueryParams","token","code","isPopup","exchangeError","oidcIdpStateId","samlIdpStateId","samlIdpUsername","descopeIdpInitiated","ssoAppId","thirdPartyAppId","thirdPartyAppStateId","applicationScopes","oidcLoginHint","oidcPrompt","oidcErrorRedirectUri","withMemCache","fn","prevArgs","args","array2","array1","length","every","index","reset","handleAutoFocus","autoFocus","isFirstScreen","firstVisibleInput","querySelector","setTimeout","focus","handleReportValidityOnBlur","rootEle","querySelectorAll","forEach","addEventListener","onBlur","origFocus","reportValidity","call","getAttribute","ref","timer","onClick","e","target","clearTimeout","removeEventListener","once","timeoutPromise","timeout","promise","fallback","Promise","resolve","reject","expired","then","catch","error","getChromiumVersion","brands","userAgentData","found","find","brand","version","parseFloat","showFirstScreenOnExecutionInit","startScreenId","injectSamlIdpForm","samlResponse","relayState","submitCallback","formEle","document","createElement","method","action","innerHTML","appendChild","submitForm","submit","getFirstNonEmptyValue","obj","keys","firstNonEmptyKey","key","leadingDebounce","func","wait","apply","this","getUserLocale","locale","toLowerCase","nl","language","includes","clearPreviousExternalInputs","remove","shouldHandleMarkdown","compName","transformStepStateForCustomScreen","sanitizedState","screenState","predicate","_","EXCLUDED_STATE_KEYS","startsWith","filter","errorText","errorType","text","type","_c","_b","componentsConfig","thirdPartyAppApproveScopes","data","inboundAppApproveScopes","transformScreenInputs","inputs","getScriptResultPath","scriptId","resultKey","SDK_SCRIPT_RESULTS_KEY","openCenteredPopup","title","w","h","dualScreenLeft","screenLeft","screen","left","dualScreenTop","screenTop","top","innerWidth","documentElement","clientWidth","width","innerHeight","clientHeight","height","popup","open"],"mappings":"2gCAqCA,MAAMA,EAAgB,CAAC,yBAEvB,SAASC,EAAYC,GAGnB,OAFkB,IAAIC,gBAAgBC,OAAOC,SAASC,QAErCC,IAAIL,EACvB,CAgBA,SAASM,EAAcN,GACrB,GAAIE,OAAOK,QAAQC,cAAgBT,EAAYC,GAAY,CACzD,MAAMS,EAAS,IAAIC,IAAIR,OAAOC,SAASQ,MACjCP,EAAS,IAAIH,gBAAgBQ,EAAOL,QAC1CA,EAAOQ,OAAOZ,GACdS,EAAOL,OAASA,EAAOS,WACvBX,OAAOK,QAAQC,aAAa,CAAA,EAAI,GAAIC,EAAOI,WAC5C,CACH,CAOsB,SAAAC,EACpBC,EACAC,4CAKA,MAAMC,QAAYC,MAAMH,EAAK,CAAEI,MAAO,YACtC,IAAKF,EAAIG,GACP,MAAMC,MAAM,sBAAsBN,MAAQE,EAAIK,WAGhD,MAAO,CACLC,WAAYN,EAAID,KAChBQ,QAASC,OAAOC,YAAYT,EAAIO,QAAQG,cAE3C,CAIe,SAAAC,GAAcC,UAC5BA,EAASC,SACTA,EAAQC,aACRA,EAAeC,EAAaC,QAC5BA,IAOA,MAAMlB,EAAM,IAAIL,IAAIwB,GAAwBD,GAAWE,GAGvD,OAFApB,EAAIqB,SAdW,KAAIC,IAAoBA,EAAMC,KAAK,KAAKC,QAAQ,OAAQ,KAcxDC,CAASzB,EAAIqB,SAAUP,EAAWE,EAAcD,GAExDf,EAAIF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BH,IARJzR,OAAO6R,YACP/D,SAASgE,gBAAgBC,aACzB/R,OAAOwR,OAAOQ,OAMMZ,GAAK,EAAIE,EACzBM,IALJ5R,OAAOiS,aACPnE,SAASgE,gBAAgBI,cACzBlS,OAAOwR,OAAOW,QAGMd,GAAK,EAAIK,EAEzBU,EAAQpS,OAAOqS,KACnBxR,EACAsQ,EACA,SAASC,YAAYC,SAASO,UAAYH,kCAK5C,OAFAW,EAAMnH,QAECmH,CAAK"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../src/lib/helpers/helpers.ts"],"sourcesContent":["import {\n ASSETS_FOLDER,\n BASE_CONTENT_URL,\n DESCOPE_ATTRIBUTE_PREFIX,\n URL_CODE_PARAM_NAME,\n URL_ERR_PARAM_NAME,\n URL_RUN_IDS_PARAM_NAME,\n URL_TOKEN_PARAM_NAME,\n URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME,\n URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME,\n URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME,\n URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME,\n OIDC_IDP_STATE_ID_PARAM_NAME,\n SAML_IDP_STATE_ID_PARAM_NAME,\n SAML_IDP_USERNAME_PARAM_NAME,\n SSO_APP_ID_PARAM_NAME,\n OIDC_LOGIN_HINT_PARAM_NAME,\n DESCOPE_IDP_INITIATED_PARAM_NAME,\n OVERRIDE_CONTENT_URL,\n OIDC_PROMPT_PARAM_NAME,\n OIDC_RESOURCE_PARAM_NAME,\n OIDC_ERROR_REDIRECT_URI_PARAM_NAME,\n THIRD_PARTY_APP_ID_PARAM_NAME,\n THIRD_PARTY_APP_STATE_ID_PARAM_NAME,\n APPLICATION_SCOPES_PARAM_NAME,\n SDK_SCRIPT_RESULTS_KEY,\n URL_REDIRECT_MODE_PARAM_NAME,\n} from '../constants';\nimport { EXCLUDED_STATE_KEYS } from '../constants/customScreens';\nimport {\n AutoFocusOptions,\n CustomScreenState,\n Direction,\n Locale,\n SSOQueryParams,\n StepState,\n} from '../types';\n\nconst MD_COMPONENTS = ['descope-enriched-text'];\n\nfunction getUrlParam(paramName: string) {\n const urlParams = new URLSearchParams(window.location.search);\n\n return urlParams.get(paramName);\n}\n\nfunction getFlowUrlParam() {\n return getUrlParam(URL_RUN_IDS_PARAM_NAME);\n}\n\nfunction setFlowUrlParam(id: string) {\n if (window.history.pushState && id !== getFlowUrlParam()) {\n const newUrl = new URL(window.location.href);\n const search = new URLSearchParams(newUrl.search);\n search.set(URL_RUN_IDS_PARAM_NAME, id);\n newUrl.search = search.toString();\n window.history.pushState({}, '', newUrl.toString());\n }\n}\n\nfunction resetUrlParam(paramName: string) {\n if (window.history.replaceState && getUrlParam(paramName)) {\n const newUrl = new URL(window.location.href);\n const search = new URLSearchParams(newUrl.search);\n search.delete(paramName);\n newUrl.search = search.toString();\n window.history.replaceState({}, '', newUrl.toString());\n }\n}\n\nconst getFlowIdFromExecId = (executionId: string) => {\n const regex = /(.*)\\|#\\|.*/;\n return regex.exec(executionId)?.[1] || '';\n};\n\nexport async function fetchContent<T extends 'text' | 'json'>(\n url: string,\n returnType: T,\n): Promise<{\n body: T extends 'json' ? Record<string, any> : string;\n headers: Record<string, string>;\n}> {\n const res = await fetch(url, { cache: 'default' });\n if (!res.ok) {\n throw Error(`Error fetching URL ${url} [${res.status}]`);\n }\n\n return {\n body: await res[returnType || 'text'](),\n headers: Object.fromEntries(res.headers.entries()),\n };\n}\n\nconst pathJoin = (...paths: string[]) => paths.join('/').replace(/\\/+/g, '/'); // preventing duplicate separators\n\nexport function getContentUrl({\n projectId,\n filename,\n assetsFolder = ASSETS_FOLDER,\n baseUrl,\n}: {\n projectId: string;\n filename: string;\n assetsFolder?: string;\n baseUrl?: string;\n}) {\n const url = new URL(OVERRIDE_CONTENT_URL || baseUrl || BASE_CONTENT_URL);\n url.pathname = pathJoin(url.pathname, projectId, assetsFolder, filename);\n\n return url.toString();\n}\n\nexport function getAnimationDirection(\n currentIdxStr: string,\n prevIdxStr: string,\n) {\n if (!prevIdxStr) return undefined;\n\n const currentIdx = +currentIdxStr;\n const prevIdx = +prevIdxStr;\n\n if (Number.isNaN(currentIdx) || Number.isNaN(prevIdx)) return undefined;\n if (currentIdx > prevIdx) return Direction.forward;\n if (currentIdx < prevIdx) return Direction.backward;\n return undefined;\n}\n\nexport const getRunIdsFromUrl = (flowId: string) => {\n let [executionId = '', stepId = ''] = (getFlowUrlParam() || '').split('_');\n const executionFlowId = getFlowIdFromExecId(executionId);\n\n // if the flow id does not match, this execution id is not for this flow\n if (!flowId || (executionFlowId && executionFlowId !== flowId)) {\n executionId = '';\n stepId = '';\n }\n\n return { executionId, stepId, executionFlowId };\n};\n\nexport const setRunIdsOnUrl = (executionId: string, stepId: string) => {\n setFlowUrlParam([executionId, stepId].join('_'));\n};\n\nexport function isChromium() {\n return (\n /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor)\n );\n}\n\nexport function clearRunIdsFromUrl() {\n resetUrlParam(URL_RUN_IDS_PARAM_NAME);\n}\n\nexport function getTokenFromUrl() {\n return getUrlParam(URL_TOKEN_PARAM_NAME) || undefined;\n}\n\nexport function clearTokenFromUrl() {\n resetUrlParam(URL_TOKEN_PARAM_NAME);\n}\n\nexport function getCodeFromUrl() {\n return getUrlParam(URL_CODE_PARAM_NAME) || undefined;\n}\n\nexport function getIsPopupFromUrl() {\n return getUrlParam(URL_REDIRECT_MODE_PARAM_NAME) === 'popup';\n}\n\nexport function getExchangeErrorFromUrl() {\n return getUrlParam(URL_ERR_PARAM_NAME) || undefined;\n}\n\nexport function clearCodeFromUrl() {\n resetUrlParam(URL_CODE_PARAM_NAME);\n}\n\nexport function clearIsPopupFromUrl() {\n resetUrlParam(URL_REDIRECT_MODE_PARAM_NAME);\n}\n\nexport function clearExchangeErrorFromUrl() {\n resetUrlParam(URL_ERR_PARAM_NAME);\n}\n\nexport function getRedirectAuthFromUrl() {\n const redirectAuthCodeChallenge = getUrlParam(\n URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME,\n );\n const redirectAuthCallbackUrl = getUrlParam(\n URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME,\n );\n const redirectAuthBackupCallbackUri = getUrlParam(\n URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME,\n );\n const redirectAuthInitiator = getUrlParam(\n URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME,\n );\n return {\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n };\n}\n\nexport function getOIDCIDPParamFromUrl() {\n return getUrlParam(OIDC_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearOIDCIDPParamFromUrl() {\n resetUrlParam(OIDC_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function getSAMLIDPParamFromUrl() {\n return getUrlParam(SAML_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearSAMLIDPParamFromUrl() {\n resetUrlParam(SAML_IDP_STATE_ID_PARAM_NAME);\n}\n\nexport function getSAMLIDPUsernameParamFromUrl() {\n return getUrlParam(SAML_IDP_USERNAME_PARAM_NAME);\n}\n\nexport function clearSAMLIDPUsernameParamFromUrl() {\n resetUrlParam(SAML_IDP_USERNAME_PARAM_NAME);\n}\n\nexport function getDescopeIDPInitiatedParamFromUrl() {\n return getUrlParam(DESCOPE_IDP_INITIATED_PARAM_NAME);\n}\n\nexport function clearDescopeIDPInitiatedParamFromUrl() {\n resetUrlParam(DESCOPE_IDP_INITIATED_PARAM_NAME);\n}\n\nexport function getSSOAppIdParamFromUrl() {\n return getUrlParam(SSO_APP_ID_PARAM_NAME);\n}\n\nexport function getThirdPartyAppIdParamFromUrl() {\n return getUrlParam(THIRD_PARTY_APP_ID_PARAM_NAME);\n}\n\nexport function clearSSOAppIdParamFromUrl() {\n resetUrlParam(SSO_APP_ID_PARAM_NAME);\n}\n\nexport function clearThirdPartyAppIdParamFromUrl() {\n resetUrlParam(THIRD_PARTY_APP_ID_PARAM_NAME);\n}\n\nexport function getThirdPartyAppStateIdParamFromUrl() {\n return getUrlParam(THIRD_PARTY_APP_STATE_ID_PARAM_NAME);\n}\n\nexport function clearThirdPartyAppStateIdParamFromUrl() {\n resetUrlParam(THIRD_PARTY_APP_STATE_ID_PARAM_NAME);\n}\n\nexport function getApplicationScopesParamFromUrl() {\n return getUrlParam(APPLICATION_SCOPES_PARAM_NAME);\n}\n\nexport function clearApplicationScopesParamFromUrl() {\n resetUrlParam(APPLICATION_SCOPES_PARAM_NAME);\n}\n\nexport function getOIDCLoginHintParamFromUrl() {\n return getUrlParam(OIDC_LOGIN_HINT_PARAM_NAME);\n}\n\nexport function clearOIDCLoginHintParamFromUrl() {\n resetUrlParam(OIDC_LOGIN_HINT_PARAM_NAME);\n}\n\nexport function getOIDCPromptParamFromUrl() {\n return getUrlParam(OIDC_PROMPT_PARAM_NAME);\n}\n\nexport function clearOIDCPromptParamFromUrl() {\n resetUrlParam(OIDC_PROMPT_PARAM_NAME);\n}\n\nexport function getOIDCErrorRedirectUriParamFromUrl() {\n return getUrlParam(OIDC_ERROR_REDIRECT_URI_PARAM_NAME);\n}\n\nexport function clearOIDCErrorRedirectUriParamFromUrl() {\n resetUrlParam(OIDC_ERROR_REDIRECT_URI_PARAM_NAME);\n}\n\nexport function getOIDCResourceParamFromUrl() {\n return getUrlParam(OIDC_RESOURCE_PARAM_NAME);\n}\n\nexport function clearOIDCResourceParamFromUrl() {\n resetUrlParam(OIDC_RESOURCE_PARAM_NAME);\n}\n\nexport const camelCase = (s: string) =>\n s.replace(/-./g, (x) => x[1].toUpperCase());\n\nexport const createIsChanged =\n <T extends Record<string, any>>(state: T, prevState: T) =>\n (attrName: keyof T) =>\n state[attrName] !== prevState[attrName];\n\nexport const getElementDescopeAttributes = (ele: HTMLElement) =>\n Array.from(ele?.attributes || []).reduce((acc, attr) => {\n const descopeAttrName = new RegExp(\n `^${DESCOPE_ATTRIBUTE_PREFIX}(\\\\S+)$`,\n ).exec(attr.name)?.[1];\n\n return !descopeAttrName\n ? acc\n : Object.assign(acc, { [descopeAttrName]: attr.value });\n }, {});\n\nexport const getFlowConfig = (config: Record<string, any>, flowId: string) =>\n config?.flows?.[flowId] || {};\n\nexport const handleUrlParams = (\n flowId: string,\n logger: { debug: (...data: any[]) => void },\n) => {\n const { executionId, stepId, executionFlowId } = getRunIdsFromUrl(flowId);\n\n // if the flow id does not match, we do not want to read & remove any query params\n // because it's probably belongs to another flow\n if (executionFlowId && flowId !== executionFlowId) {\n logger.debug(\n 'Flow id does not match the execution flow id, skipping url params handling',\n );\n return { ssoQueryParams: {} };\n }\n\n if (executionId || stepId) {\n clearRunIdsFromUrl();\n }\n\n const token = getTokenFromUrl();\n if (token) {\n clearTokenFromUrl();\n }\n\n const code = getCodeFromUrl();\n if (code) {\n clearCodeFromUrl();\n }\n\n // this is used for oauth when we want to open the provider login page in a new tab\n const isPopup = getIsPopupFromUrl();\n if (isPopup) {\n clearIsPopupFromUrl();\n }\n\n const exchangeError = getExchangeErrorFromUrl();\n if (exchangeError) {\n clearExchangeErrorFromUrl();\n }\n\n // these query params are retained to allow the flow to be refreshed\n // without losing the redirect auth state\n const {\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n } = getRedirectAuthFromUrl();\n\n const oidcIdpStateId = getOIDCIDPParamFromUrl();\n if (oidcIdpStateId) {\n clearOIDCIDPParamFromUrl();\n }\n\n const samlIdpStateId = getSAMLIDPParamFromUrl();\n if (samlIdpStateId) {\n clearSAMLIDPParamFromUrl();\n }\n\n const samlIdpUsername = getSAMLIDPUsernameParamFromUrl();\n if (samlIdpStateId) {\n clearSAMLIDPUsernameParamFromUrl();\n }\n\n const descopeIdpInitiated = getDescopeIDPInitiatedParamFromUrl();\n if (descopeIdpInitiated) {\n clearDescopeIDPInitiatedParamFromUrl();\n }\n\n const ssoAppId = getSSOAppIdParamFromUrl();\n if (ssoAppId) {\n clearSSOAppIdParamFromUrl();\n }\n\n const thirdPartyAppId = getThirdPartyAppIdParamFromUrl();\n if (thirdPartyAppId) {\n clearThirdPartyAppIdParamFromUrl();\n }\n\n const thirdPartyAppStateId = getThirdPartyAppStateIdParamFromUrl();\n if (thirdPartyAppStateId) {\n clearThirdPartyAppStateIdParamFromUrl();\n }\n\n const applicationScopes = getApplicationScopesParamFromUrl();\n if (applicationScopes) {\n clearApplicationScopesParamFromUrl();\n }\n\n const oidcLoginHint = getOIDCLoginHintParamFromUrl();\n if (oidcLoginHint) {\n clearOIDCLoginHintParamFromUrl();\n }\n\n const oidcPrompt = getOIDCPromptParamFromUrl();\n if (oidcPrompt) {\n clearOIDCPromptParamFromUrl();\n }\n\n const oidcErrorRedirectUri = getOIDCErrorRedirectUriParamFromUrl();\n if (oidcErrorRedirectUri) {\n clearOIDCErrorRedirectUriParamFromUrl();\n }\n\n const oidcResource = getOIDCResourceParamFromUrl();\n if (oidcResource) {\n clearOIDCResourceParamFromUrl();\n }\n\n const idpInitiatedVal = descopeIdpInitiated === 'true';\n\n return {\n executionId,\n stepId,\n token,\n code,\n isPopup,\n exchangeError,\n redirectAuthCodeChallenge,\n redirectAuthCallbackUrl,\n redirectAuthBackupCallbackUri,\n redirectAuthInitiator,\n ssoQueryParams: {\n oidcIdpStateId,\n samlIdpStateId,\n samlIdpUsername,\n descopeIdpInitiated: idpInitiatedVal,\n ssoAppId,\n oidcLoginHint,\n oidcPrompt,\n oidcErrorRedirectUri,\n oidcResource,\n thirdPartyAppId,\n thirdPartyAppStateId,\n applicationScopes,\n },\n };\n};\n\nexport const loadFont = (url: string) => {\n if (!url) return;\n\n const font = document.createElement('link');\n font.href = url;\n font.rel = 'stylesheet';\n document.head.appendChild(font);\n};\n\nconst compareArrays = (array1: any[], array2: any[]) =>\n array1.length === array2.length &&\n array1.every((value: any, index: number) => value === array2[index]);\n\nexport const withMemCache = <I extends any[], O>(fn: (...args: I) => O) => {\n let prevArgs: any[];\n let cache: any;\n return Object.assign(\n (...args: I) => {\n if (prevArgs && compareArrays(prevArgs, args)) return cache as O;\n\n prevArgs = args;\n cache = fn(...args);\n\n return cache as O;\n },\n {\n reset: () => {\n prevArgs = undefined;\n cache = undefined;\n },\n },\n );\n};\n\nexport const handleAutoFocus = (\n ele: HTMLElement,\n autoFocus: AutoFocusOptions,\n isFirstScreen: boolean,\n) => {\n if (\n autoFocus === true ||\n (autoFocus === 'skipFirstScreen' && !isFirstScreen)\n ) {\n // focus the first visible input\n const firstVisibleInput: HTMLInputElement = ele.querySelector('*[name]');\n setTimeout(() => {\n firstVisibleInput?.focus();\n });\n }\n};\n\nexport const handleReportValidityOnBlur = (rootEle: HTMLElement) => {\n rootEle.querySelectorAll('*[name]').forEach((ele: HTMLInputElement) => {\n ele.addEventListener('blur', () => {\n const onBlur = () => {\n // reportValidity also focus the element if it's invalid\n // in order to prevent this we need to override the focus method\n const origFocus = ele.focus;\n // eslint-disable-next-line no-param-reassign\n ele.focus = () => {};\n ele.reportValidity?.();\n setTimeout(() => {\n // eslint-disable-next-line no-param-reassign\n ele.focus = origFocus;\n });\n };\n\n const isInputAlreadyInErrorState = ele.getAttribute('invalid') === 'true';\n\n if (isInputAlreadyInErrorState || ele.value?.length) {\n onBlur();\n return;\n }\n\n // If the input is not in an error state, has no value, and a `formnovalidate` button was clicked,\n // we want to prevent triggering validation.\n // This handles a case where a required input was focused, and the user then clicked a social login button —\n // in that case, we don't want the required error message to flash for a split second.\n const ref = { timer: undefined };\n\n const onClick = (e: MouseEvent) => {\n const target = e.target as HTMLElement;\n\n if (target.getAttribute('formnovalidate') === 'true') {\n clearTimeout(ref.timer);\n ref.timer = undefined;\n }\n };\n\n ref.timer = setTimeout(() => {\n rootEle.removeEventListener('click', onClick);\n onBlur();\n ref.timer = undefined;\n }, 150);\n\n rootEle.addEventListener('click', onClick, { once: true });\n });\n });\n};\n\n/**\n * To return a fallback value in case the timeout expires and the promise\n * isn't fulfilled:\n *\n * const promise = loadUserCount();\n * const count = await timeoutPromise(2000, promise, 0);\n *\n * Or without a fallback value to just throw an error if the timeout expires:\n *\n * try {\n * count = await timeoutPromise(2000, promise);\n * }\n *\n * Fallback is returned only in case of timeout, so if the passed promise rejects\n * the fallback value is not used, and the returned promise will throw as well.\n */\nexport function timeoutPromise<T>(\n timeout: number,\n promise: Promise<T>,\n fallback?: T,\n): Promise<T> {\n return new Promise((resolve, reject) => {\n let expired = false;\n const timer = setTimeout(() => {\n expired = true;\n if (fallback !== undefined) {\n resolve(fallback);\n } else {\n reject(new Error(`Promise timed out after ${timeout} ms`));\n }\n }, timeout);\n\n promise\n .then((value) => {\n if (!expired) {\n clearTimeout(timer);\n resolve(value);\n }\n })\n .catch((error) => {\n if (!expired) {\n clearTimeout(timer);\n reject(error);\n }\n });\n });\n}\n\nexport const getChromiumVersion = (): number => {\n const brands = (navigator as any)?.userAgentData?.brands;\n const found = brands?.find(\n ({ brand, version }) => brand === 'Chromium' && parseFloat(version),\n );\n return found ? found.version : 0;\n};\n\n// As an optimization - We can show first screen if we have startScreenId and we don't have any other of the ssoAppId/oidcIdpStateId/samlIdp params\n// - If there startScreenId it means that the sdk can show the first screen and we don't need to wait for the sdk to return the first screen\n// - If there is any one else of the other params (like oidcIdpStateId, ..) - we can't skip this call because descope may decide not to show the first screen (in cases like a user is already logged in)\nexport const showFirstScreenOnExecutionInit = (\n startScreenId: string,\n {\n oidcIdpStateId,\n samlIdpStateId,\n samlIdpUsername,\n ssoAppId,\n oidcLoginHint,\n oidcPrompt,\n oidcErrorRedirectUri,\n oidcResource,\n thirdPartyAppId,\n thirdPartyAppStateId,\n applicationScopes,\n }: SSOQueryParams,\n): boolean =>\n !!startScreenId &&\n !oidcIdpStateId &&\n !samlIdpStateId &&\n !samlIdpUsername &&\n !ssoAppId &&\n !oidcLoginHint &&\n !oidcPrompt &&\n !oidcErrorRedirectUri &&\n !oidcResource &&\n !thirdPartyAppId &&\n !thirdPartyAppStateId &&\n !applicationScopes;\n\nexport const injectSamlIdpForm = (\n url: string,\n samlResponse: string,\n relayState: string,\n submitCallback: (form: HTMLFormElement) => void,\n) => {\n const formEle = document.createElement('form');\n formEle.method = 'POST';\n formEle.action = url;\n formEle.innerHTML = `\n <input type=\"hidden\" role=\"saml-response\" name=\"SAMLResponse\" value=\"${samlResponse}\" />\n <input type=\"hidden\" role=\"saml-relay-state\" name=\"RelayState\" value=\"${relayState}\" />\n <input style=\"display: none;\" id=\"SAMLSubmitButton\" type=\"submit\" value=\"Continue\" />\n `;\n\n document.body.appendChild(formEle);\n\n submitCallback(formEle);\n};\n\nexport const submitForm = (formEle: HTMLFormElement) => formEle?.submit();\n\nexport const getFirstNonEmptyValue = (obj: object, keys: string[]) => {\n const firstNonEmptyKey = keys.find((key) => obj[key]);\n return firstNonEmptyKey ? obj[firstNonEmptyKey] : null;\n};\n\nexport const leadingDebounce = <T extends (...args: any[]) => void>(\n func: T,\n wait = 100,\n) => {\n let timeout: NodeJS.Timeout;\n return function executedFunction(...args) {\n if (!timeout) func.apply(this, args);\n clearTimeout(timeout);\n timeout = setTimeout(() => {\n timeout = null;\n }, wait);\n } as T;\n};\n\nexport function getUserLocale(locale: string): Locale {\n if (locale) {\n return { locale: locale.toLowerCase(), fallback: locale.toLowerCase() };\n }\n const nl = navigator.language;\n if (!nl) {\n return { locale: '', fallback: '' };\n }\n\n if (nl.includes('-')) {\n return {\n locale: nl.toLowerCase(),\n fallback: nl.split('-')[0].toLowerCase(),\n };\n }\n\n return { locale: nl.toLowerCase(), fallback: nl.toLowerCase() };\n}\n\nexport const clearPreviousExternalInputs = () => {\n document\n .querySelectorAll('[data-hidden-input=\"true\"]')\n .forEach((ele) => ele.remove());\n};\n\nexport const shouldHandleMarkdown = (compName: string) =>\n MD_COMPONENTS.includes(compName);\n\nconst omitBy = <T extends Record<string, any>>(\n obj: T,\n predicate: (value: any, key: keyof T) => boolean,\n): T =>\n Object.fromEntries(\n Object.entries(obj).filter(\n ([key, value]) => !predicate(value, key as keyof T),\n ),\n ) as T;\n\nexport const transformStepStateForCustomScreen = (\n state: Partial<StepState>,\n) => {\n const sanitizedState: CustomScreenState = omitBy(\n state.screenState,\n (_, key) => EXCLUDED_STATE_KEYS.includes(key) || key.startsWith('_'),\n );\n\n const {\n screenState: { errorText, errorType },\n } = state;\n\n if (errorText || errorType) {\n sanitizedState.error = { text: errorText, type: errorType };\n }\n\n if (state.action) {\n sanitizedState.action = state.action;\n }\n\n if (state.screenState?.componentsConfig?.thirdPartyAppApproveScopes?.data) {\n sanitizedState.inboundAppApproveScopes =\n state.screenState.componentsConfig.thirdPartyAppApproveScopes.data;\n }\n\n return sanitizedState;\n};\n\nexport const transformScreenInputs = (inputs: Record<string, any>) => {\n const res = { ...inputs };\n\n if (inputs.inboundAppApproveScopes) {\n res.thirdPartyAppApproveScopes = inputs.inboundAppApproveScopes;\n }\n\n return res;\n};\n\nexport function getScriptResultPath(scriptId: string, resultKey?: string) {\n const path = resultKey ? `${scriptId}_${resultKey}` : scriptId;\n return `${SDK_SCRIPT_RESULTS_KEY}.${path}`;\n}\n\nexport const openCenteredPopup = (\n url: string,\n title: string,\n w: number,\n h: number,\n) => {\n const dualScreenLeft =\n window.screenLeft !== undefined\n ? window.screenLeft\n : (window.screen as any).left;\n const dualScreenTop =\n window.screenTop !== undefined\n ? window.screenTop\n : (window.screen as any).top;\n\n const width =\n window.innerWidth ||\n document.documentElement.clientWidth ||\n window.screen.width;\n const height =\n window.innerHeight ||\n document.documentElement.clientHeight ||\n window.screen.height;\n\n const left = (width - w) / 2 + dualScreenLeft;\n const top = (height - h) / 2 + dualScreenTop;\n\n const popup = window.open(\n url,\n title,\n `width=${w},height=${h},top=${top},left=${left},scrollbars=yes,resizable=yes`,\n );\n\n popup.focus();\n\n return popup;\n};\n"],"names":["MD_COMPONENTS","getUrlParam","paramName","URLSearchParams","window","location","search","get","resetUrlParam","history","replaceState","newUrl","URL","href","delete","toString","fetchContent","url","returnType","res","fetch","cache","ok","Error","status","body","headers","Object","fromEntries","entries","getContentUrl","projectId","filename","assetsFolder","ASSETS_FOLDER","baseUrl","OVERRIDE_CONTENT_URL","BASE_CONTENT_URL","pathname","paths","join","replace","pathJoin","getAnimationDirection","currentIdxStr","prevIdxStr","currentIdx","prevIdx","Number","isNaN","Direction","forward","backward","getRunIdsFromUrl","flowId","executionId","stepId","URL_RUN_IDS_PARAM_NAME","split","executionFlowId","_a","exec","getFlowIdFromExecId","isChromium","test","navigator","userAgent","vendor","clearRunIdsFromUrl","getTokenFromUrl","URL_TOKEN_PARAM_NAME","undefined","clearTokenFromUrl","getCodeFromUrl","URL_CODE_PARAM_NAME","getIsPopupFromUrl","URL_REDIRECT_MODE_PARAM_NAME","getExchangeErrorFromUrl","URL_ERR_PARAM_NAME","clearCodeFromUrl","clearIsPopupFromUrl","clearExchangeErrorFromUrl","getRedirectAuthFromUrl","redirectAuthCodeChallenge","URL_REDIRECT_AUTH_CHALLENGE_PARAM_NAME","redirectAuthCallbackUrl","URL_REDIRECT_AUTH_CALLBACK_PARAM_NAME","redirectAuthBackupCallbackUri","URL_REDIRECT_AUTH_BACKUP_CALLBACK_PARAM_NAME","redirectAuthInitiator","URL_REDIRECT_AUTH_INITIATOR_PARAM_NAME","getOIDCIDPParamFromUrl","OIDC_IDP_STATE_ID_PARAM_NAME","clearOIDCIDPParamFromUrl","getSAMLIDPParamFromUrl","SAML_IDP_STATE_ID_PARAM_NAME","clearSAMLIDPParamFromUrl","getSAMLIDPUsernameParamFromUrl","SAML_IDP_USERNAME_PARAM_NAME","clearSAMLIDPUsernameParamFromUrl","getDescopeIDPInitiatedParamFromUrl","DESCOPE_IDP_INITIATED_PARAM_NAME","clearDescopeIDPInitiatedParamFromUrl","getSSOAppIdParamFromUrl","SSO_APP_ID_PARAM_NAME","getThirdPartyAppIdParamFromUrl","THIRD_PARTY_APP_ID_PARAM_NAME","clearSSOAppIdParamFromUrl","clearThirdPartyAppIdParamFromUrl","getThirdPartyAppStateIdParamFromUrl","THIRD_PARTY_APP_STATE_ID_PARAM_NAME","clearThirdPartyAppStateIdParamFromUrl","getApplicationScopesParamFromUrl","APPLICATION_SCOPES_PARAM_NAME","clearApplicationScopesParamFromUrl","getOIDCLoginHintParamFromUrl","OIDC_LOGIN_HINT_PARAM_NAME","clearOIDCLoginHintParamFromUrl","getOIDCPromptParamFromUrl","OIDC_PROMPT_PARAM_NAME","clearOIDCPromptParamFromUrl","getOIDCErrorRedirectUriParamFromUrl","OIDC_ERROR_REDIRECT_URI_PARAM_NAME","clearOIDCErrorRedirectUriParamFromUrl","getOIDCResourceParamFromUrl","OIDC_RESOURCE_PARAM_NAME","clearOIDCResourceParamFromUrl","camelCase","s","x","toUpperCase","createIsChanged","state","prevState","attrName","getElementDescopeAttributes","ele","Array","from","attributes","reduce","acc","attr","descopeAttrName","RegExp","DESCOPE_ATTRIBUTE_PREFIX","name","assign","value","handleUrlParams","logger","debug","ssoQueryParams","token","code","isPopup","exchangeError","oidcIdpStateId","samlIdpStateId","samlIdpUsername","descopeIdpInitiated","ssoAppId","thirdPartyAppId","thirdPartyAppStateId","applicationScopes","oidcLoginHint","oidcPrompt","oidcErrorRedirectUri","oidcResource","withMemCache","fn","prevArgs","args","array2","array1","length","every","index","reset","handleAutoFocus","autoFocus","isFirstScreen","firstVisibleInput","querySelector","setTimeout","focus","handleReportValidityOnBlur","rootEle","querySelectorAll","forEach","addEventListener","onBlur","origFocus","reportValidity","call","getAttribute","ref","timer","onClick","e","target","clearTimeout","removeEventListener","once","timeoutPromise","timeout","promise","fallback","Promise","resolve","reject","expired","then","catch","error","getChromiumVersion","brands","userAgentData","found","find","brand","version","parseFloat","showFirstScreenOnExecutionInit","startScreenId","injectSamlIdpForm","samlResponse","relayState","submitCallback","formEle","document","createElement","method","action","innerHTML","appendChild","submitForm","submit","getFirstNonEmptyValue","obj","keys","firstNonEmptyKey","key","leadingDebounce","func","wait","apply","this","getUserLocale","locale","toLowerCase","nl","language","includes","clearPreviousExternalInputs","remove","shouldHandleMarkdown","compName","transformStepStateForCustomScreen","sanitizedState","screenState","predicate","_","EXCLUDED_STATE_KEYS","startsWith","filter","errorText","errorType","text","type","_c","_b","componentsConfig","thirdPartyAppApproveScopes","data","inboundAppApproveScopes","transformScreenInputs","inputs","getScriptResultPath","scriptId","resultKey","SDK_SCRIPT_RESULTS_KEY","openCenteredPopup","title","w","h","dualScreenLeft","screenLeft","screen","left","dualScreenTop","screenTop","top","innerWidth","documentElement","clientWidth","width","innerHeight","clientHeight","height","popup","open"],"mappings":"yiCAsCA,MAAMA,EAAgB,CAAC,yBAEvB,SAASC,EAAYC,GAGnB,OAFkB,IAAIC,gBAAgBC,OAAOC,SAASC,QAErCC,IAAIL,EACvB,CAgBA,SAASM,EAAcN,GACrB,GAAIE,OAAOK,QAAQC,cAAgBT,EAAYC,GAAY,CACzD,MAAMS,EAAS,IAAIC,IAAIR,OAAOC,SAASQ,MACjCP,EAAS,IAAIH,gBAAgBQ,EAAOL,QAC1CA,EAAOQ,OAAOZ,GACdS,EAAOL,OAASA,EAAOS,WACvBX,OAAOK,QAAQC,aAAa,CAAA,EAAI,GAAIC,EAAOI,WAC5C,CACH,CAOsB,SAAAC,EACpBC,EACAC,4CAKA,MAAMC,QAAYC,MAAMH,EAAK,CAAEI,MAAO,YACtC,IAAKF,EAAIG,GACP,MAAMC,MAAM,sBAAsBN,MAAQE,EAAIK,WAGhD,MAAO,CACLC,WAAYN,EAAID,KAChBQ,QAASC,OAAOC,YAAYT,EAAIO,QAAQG,cAE3C,CAIe,SAAAC,GAAcC,UAC5BA,EAASC,SACTA,EAAQC,aACRA,EAAeC,EAAaC,QAC5BA,IAOA,MAAMlB,EAAM,IAAIL,IAAIwB,GAAwBD,GAAWE,GAGvD,OAFApB,EAAIqB,SAdW,KAAIC,IAAoBA,EAAMC,KAAK,KAAKC,QAAQ,OAAQ,KAcxDC,CAASzB,EAAIqB,SAAUP,EAAWE,EAAcD,GAExDf,EAAIF,UACb,CAEgB,SAAA4B,EACdC,EACAC,GAEA,IAAKA,E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KACvBC,OACiB3N,IAArBnE,OAAO+R,UACH/R,OAAO+R,UACN/R,OAAO4R,OAAeI,IAWvBH,IARJ7R,OAAOiS,YACP/D,SAASgE,gBAAgBC,aACzBnS,OAAO4R,OAAOQ,OAMMZ,GAAK,EAAIE,EACzBM,IALJhS,OAAOqS,aACPnE,SAASgE,gBAAgBI,cACzBtS,OAAO4R,OAAOW,QAGMd,GAAK,EAAIK,EAEzBU,EAAQxS,OAAOyS,KACnB5R,EACA0Q,EACA,SAASC,YAAYC,SAASO,UAAYH,kCAK5C,OAFAW,EAAMnH,QAECmH,CAAK"}
|
package/dist/esm/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/lib/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport createSdk from '@descope/web-js-sdk';\n\nexport type SdkConfig = Parameters<typeof createSdk>[0];\nexport type Sdk = ReturnType<typeof createSdk>;\n\nexport type SdkFlowNext = Sdk['flow']['next'];\n\nexport type ComponentsDynamicAttrs = {\n attributes: Record<string, any>;\n};\n\nexport type ComponentsConfig = Record<string, any> & {\n componentsDynamicAttrs?: Record<string, ComponentsDynamicAttrs>;\n};\nexport type CssVars = Record<string, any>;\n\ntype KeepArgsByIndex<F, Indices extends readonly number[]> = F extends (\n ...args: infer A\n) => infer R\n ? (...args: PickArgsByIndex<A, Indices>) => R\n : never;\n\ntype PickArgsByIndex<\n All extends readonly any[],\n Indices extends readonly number[],\n> = {\n [K in keyof Indices]: Indices[K] extends keyof All ? All[Indices[K]] : never;\n};\n\ntype Project = {\n name: string;\n};\n\nexport enum Direction {\n backward = 'backward',\n forward = 'forward',\n}\n\nexport interface LastAuthState {\n loginId?: string;\n name?: string;\n}\n\nexport interface ScreenState {\n errorText?: string;\n errorType?: string;\n componentsConfig?: ComponentsConfig;\n cssVars?: CssVars;\n form?: Record<string, string>;\n inputs?: Record<string, string>; // Backward compatibility\n lastAuth?: LastAuthState;\n project?: Project;\n totp?: { image?: string; provisionUrl?: string };\n notp?: { image?: string; redirectUrl?: string };\n selfProvisionDomains?: unknown;\n user?: unknown;\n sso?: unknown;\n dynamicSelects?: unknown;\n keysInUse?: unknown;\n genericForm?: unknown;\n linkId?: unknown;\n sentTo?: unknown;\n clientScripts?: ClientScript[];\n}\n\nexport type SSOQueryParams = {\n oidcIdpStateId?: string;\n samlIdpStateId?: string;\n samlIdpUsername?: string;\n descopeIdpInitiated?: boolean;\n ssoAppId?: string;\n thirdPartyAppId: string;\n thirdPartyAppStateId?: string;\n applicationScopes?: string;\n} & OIDCOptions;\n\nexport type OIDCOptions = {\n oidcLoginHint?: string;\n oidcPrompt?: string;\n oidcErrorRedirectUri?: string;\n};\n\nexport type Locale = {\n locale: string;\n fallback: string;\n};\n\nexport type FlowState = {\n flowId: string;\n projectId: string;\n baseUrl: string;\n tenant: string;\n stepId: string;\n stepName: string;\n executionId: string;\n action: string;\n redirectTo: string;\n redirectIsPopup: boolean;\n openInNewTabUrl?: string;\n redirectUrl: string;\n screenId: string;\n screenState: ScreenState;\n token: string;\n code: string;\n isPopup: boolean;\n exchangeError: string;\n webauthnTransactionId: string;\n webauthnOptions: string;\n redirectAuthCodeChallenge: string;\n redirectAuthCallbackUrl: string;\n redirectAuthBackupCallbackUri: string;\n redirectAuthInitiator: string;\n deferredRedirect: boolean;\n locale: string;\n samlIdpResponseUrl: string;\n samlIdpResponseSamlResponse: string;\n samlIdpResponseRelayState: string;\n nativeResponseType: string;\n nativePayload: Record<string, any>;\n reqTimestamp: number;\n} & SSOQueryParams;\n\nexport type StepState = {\n screenState: ScreenState;\n screenId: string;\n stepName: string;\n htmlFilename: string;\n htmlLocaleFilename: string;\n next: NextFn;\n direction: Direction | undefined;\n samlIdpUsername: string;\n action?: string;\n} & OIDCOptions;\n\nexport type CustomScreenState = Omit<\n ScreenState,\n 'cssVars' | 'componentsConfig' | 'inputs'\n> & {\n error?: {\n text: ScreenState['errorText'];\n type: ScreenState['errorType'];\n };\n action?: string;\n inboundAppApproveScopes?: {\n desc: string;\n id: string;\n required: boolean;\n }[];\n};\n\nexport type DebugState = {\n isDebug: boolean;\n};\n\nexport interface ScriptElement extends HTMLDivElement {\n moduleRes?: ScriptModule;\n}\n\nexport type ScriptModule = {\n stop: () => void;\n start: () => void;\n /**\n * Refreshes any tokens or state that might be needed before form submission\n * Currently implemented for reCAPTCHA to ensure we have a fresh token\n */\n refresh?: () => Promise<void>;\n};\n\nexport type ClientScript = {\n id: string;\n initArgs: Record<string, any>;\n resultKey?: string;\n};\n\nexport type NextFn = KeepArgsByIndex<SdkFlowNext, [2, 5]>;\nexport type NextFnReturnPromiseValue = Awaited<ReturnType<NextFn>>;\n\nexport type DebuggerMessage = {\n title: string;\n description?: string;\n};\n\nexport type FlowStateUpdateFn = (state: FlowState) => void;\n\ntype Operator =\n | 'equal'\n | 'not-equal'\n | 'contains'\n | 'greater-than'\n | 'greater-than-or-equal'\n | 'less-than'\n | 'less-than-or-equal'\n | 'empty'\n | 'not-empty'\n | 'is-true'\n | 'is-false'\n | 'in'\n | 'not-in'\n | 'in-range'\n | 'not-in-range'\n | 'devised-by';\n\nexport interface ClientConditionResult {\n screenId: string;\n screenName: string;\n clientScripts?: ClientScript[];\n componentsConfig?: ComponentsConfig;\n interactionId: string;\n}\n\nexport interface ClientCondition {\n operator: Operator;\n key: string;\n predicate?: string | number;\n met: ClientConditionResult;\n unmet?: ClientConditionResult;\n}\n\nexport type AutoFocusOptions = true | false | 'skipFirstScreen';\n\nexport type ThemeOptions = 'light' | 'dark' | 'os';\n\nexport type Key =\n | 'lastAuth.loginId'\n | 'idpInitiated'\n | 'externalToken'\n | 'abTestingKey';\n\ntype CheckFunction = (ctx: Context, predicate?: string | number) => boolean;\n\nexport type ConditionsMap = {\n [key in Key]: {\n [operator in Operator]?: CheckFunction;\n };\n};\n\nexport interface Context {\n loginId?: string;\n code?: string;\n token?: string;\n abTestingKey?: number;\n}\n\nexport type DescopeUI = Record<string, () => Promise<void>> & {\n componentsThemeManager: Record<string, any>;\n};\n\ntype Font = {\n family: string[];\n label: string;\n url?: string;\n};\n\ntype ThemeTemplate = {\n fonts: {\n font1: Font;\n font2: Font;\n };\n};\n\nexport type FlowConfig = {\n startScreenId?: string;\n startScreenName?: string;\n version: number;\n targetLocales?: string[];\n conditions?: ClientCondition[];\n condition?: ClientCondition;\n fingerprintEnabled?: boolean;\n fingerprintKey?: string;\n sdkScripts?: [\n {\n id: string;\n initArgs: Record<string, any>;\n resultKey?: string;\n },\n ];\n clientScripts?: ClientScript[];\n componentsConfig?: ComponentsConfig;\n};\n\nexport interface ProjectConfiguration {\n componentsVersion: string;\n cssTemplate: {\n dark: ThemeTemplate;\n light: ThemeTemplate;\n };\n flows: {\n [key: string]: FlowConfig; // dynamic key names for flows\n };\n}\n\nexport type FlowStatus = 'loading' | 'error' | 'success' | 'ready' | 'initial';\n"],"names":["Direction"],"mappings":"IAmCYA,GAAZ,SAAYA,GACVA,EAAA,SAAA,WACAA,EAAA,QAAA,SACD,CAHD,CAAYA,IAAAA,EAGX,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/lib/types.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport createSdk from '@descope/web-js-sdk';\n\nexport type SdkConfig = Parameters<typeof createSdk>[0];\nexport type Sdk = ReturnType<typeof createSdk>;\n\nexport type SdkFlowNext = Sdk['flow']['next'];\n\nexport type ComponentsDynamicAttrs = {\n attributes: Record<string, any>;\n};\n\nexport type ComponentsConfig = Record<string, any> & {\n componentsDynamicAttrs?: Record<string, ComponentsDynamicAttrs>;\n};\nexport type CssVars = Record<string, any>;\n\ntype KeepArgsByIndex<F, Indices extends readonly number[]> = F extends (\n ...args: infer A\n) => infer R\n ? (...args: PickArgsByIndex<A, Indices>) => R\n : never;\n\ntype PickArgsByIndex<\n All extends readonly any[],\n Indices extends readonly number[],\n> = {\n [K in keyof Indices]: Indices[K] extends keyof All ? All[Indices[K]] : never;\n};\n\ntype Project = {\n name: string;\n};\n\nexport enum Direction {\n backward = 'backward',\n forward = 'forward',\n}\n\nexport interface LastAuthState {\n loginId?: string;\n name?: string;\n}\n\nexport interface ScreenState {\n errorText?: string;\n errorType?: string;\n componentsConfig?: ComponentsConfig;\n cssVars?: CssVars;\n form?: Record<string, string>;\n inputs?: Record<string, string>; // Backward compatibility\n lastAuth?: LastAuthState;\n project?: Project;\n totp?: { image?: string; provisionUrl?: string };\n notp?: { image?: string; redirectUrl?: string };\n selfProvisionDomains?: unknown;\n user?: unknown;\n sso?: unknown;\n dynamicSelects?: unknown;\n keysInUse?: unknown;\n genericForm?: unknown;\n linkId?: unknown;\n sentTo?: unknown;\n clientScripts?: ClientScript[];\n}\n\nexport type SSOQueryParams = {\n oidcIdpStateId?: string;\n samlIdpStateId?: string;\n samlIdpUsername?: string;\n descopeIdpInitiated?: boolean;\n ssoAppId?: string;\n thirdPartyAppId: string;\n thirdPartyAppStateId?: string;\n applicationScopes?: string;\n} & OIDCOptions;\n\nexport type OIDCOptions = {\n oidcLoginHint?: string;\n oidcPrompt?: string;\n oidcErrorRedirectUri?: string;\n oidcResource?: string;\n};\n\nexport type Locale = {\n locale: string;\n fallback: string;\n};\n\nexport type FlowState = {\n flowId: string;\n projectId: string;\n baseUrl: string;\n tenant: string;\n stepId: string;\n stepName: string;\n executionId: string;\n action: string;\n redirectTo: string;\n redirectIsPopup: boolean;\n openInNewTabUrl?: string;\n redirectUrl: string;\n screenId: string;\n screenState: ScreenState;\n token: string;\n code: string;\n isPopup: boolean;\n exchangeError: string;\n webauthnTransactionId: string;\n webauthnOptions: string;\n redirectAuthCodeChallenge: string;\n redirectAuthCallbackUrl: string;\n redirectAuthBackupCallbackUri: string;\n redirectAuthInitiator: string;\n deferredRedirect: boolean;\n locale: string;\n samlIdpResponseUrl: string;\n samlIdpResponseSamlResponse: string;\n samlIdpResponseRelayState: string;\n nativeResponseType: string;\n nativePayload: Record<string, any>;\n reqTimestamp: number;\n} & SSOQueryParams;\n\nexport type StepState = {\n screenState: ScreenState;\n screenId: string;\n stepName: string;\n htmlFilename: string;\n htmlLocaleFilename: string;\n next: NextFn;\n direction: Direction | undefined;\n samlIdpUsername: string;\n action?: string;\n} & OIDCOptions;\n\nexport type CustomScreenState = Omit<\n ScreenState,\n 'cssVars' | 'componentsConfig' | 'inputs'\n> & {\n error?: {\n text: ScreenState['errorText'];\n type: ScreenState['errorType'];\n };\n action?: string;\n inboundAppApproveScopes?: {\n desc: string;\n id: string;\n required: boolean;\n }[];\n};\n\nexport type DebugState = {\n isDebug: boolean;\n};\n\nexport interface ScriptElement extends HTMLDivElement {\n moduleRes?: ScriptModule;\n}\n\nexport type ScriptModule = {\n stop: () => void;\n start: () => void;\n /**\n * Refreshes any tokens or state that might be needed before form submission\n * Currently implemented for reCAPTCHA to ensure we have a fresh token\n */\n refresh?: () => Promise<void>;\n};\n\nexport type ClientScript = {\n id: string;\n initArgs: Record<string, any>;\n resultKey?: string;\n};\n\nexport type NextFn = KeepArgsByIndex<SdkFlowNext, [2, 5]>;\nexport type NextFnReturnPromiseValue = Awaited<ReturnType<NextFn>>;\n\nexport type DebuggerMessage = {\n title: string;\n description?: string;\n};\n\nexport type FlowStateUpdateFn = (state: FlowState) => void;\n\ntype Operator =\n | 'equal'\n | 'not-equal'\n | 'contains'\n | 'greater-than'\n | 'greater-than-or-equal'\n | 'less-than'\n | 'less-than-or-equal'\n | 'empty'\n | 'not-empty'\n | 'is-true'\n | 'is-false'\n | 'in'\n | 'not-in'\n | 'in-range'\n | 'not-in-range'\n | 'devised-by';\n\nexport interface ClientConditionResult {\n screenId: string;\n screenName: string;\n clientScripts?: ClientScript[];\n componentsConfig?: ComponentsConfig;\n interactionId: string;\n}\n\nexport interface ClientCondition {\n operator: Operator;\n key: string;\n predicate?: string | number;\n met: ClientConditionResult;\n unmet?: ClientConditionResult;\n}\n\nexport type AutoFocusOptions = true | false | 'skipFirstScreen';\n\nexport type ThemeOptions = 'light' | 'dark' | 'os';\n\nexport type Key =\n | 'lastAuth.loginId'\n | 'idpInitiated'\n | 'externalToken'\n | 'abTestingKey';\n\ntype CheckFunction = (ctx: Context, predicate?: string | number) => boolean;\n\nexport type ConditionsMap = {\n [key in Key]: {\n [operator in Operator]?: CheckFunction;\n };\n};\n\nexport interface Context {\n loginId?: string;\n code?: string;\n token?: string;\n abTestingKey?: number;\n}\n\nexport type DescopeUI = Record<string, () => Promise<void>> & {\n componentsThemeManager: Record<string, any>;\n};\n\ntype Font = {\n family: string[];\n label: string;\n url?: string;\n};\n\ntype ThemeTemplate = {\n fonts: {\n font1: Font;\n font2: Font;\n };\n};\n\nexport type FlowConfig = {\n startScreenId?: string;\n startScreenName?: string;\n version: number;\n targetLocales?: string[];\n conditions?: ClientCondition[];\n condition?: ClientCondition;\n fingerprintEnabled?: boolean;\n fingerprintKey?: string;\n sdkScripts?: [\n {\n id: string;\n initArgs: Record<string, any>;\n resultKey?: string;\n },\n ];\n clientScripts?: ClientScript[];\n componentsConfig?: ComponentsConfig;\n};\n\nexport interface ProjectConfiguration {\n componentsVersion: string;\n cssTemplate: {\n dark: ThemeTemplate;\n light: ThemeTemplate;\n };\n flows: {\n [key: string]: FlowConfig; // dynamic key names for flows\n };\n}\n\nexport type FlowStatus = 'loading' | 'error' | 'success' | 'ready' | 'initial';\n"],"names":["Direction"],"mappings":"IAmCYA,GAAZ,SAAYA,GACVA,EAAA,SAAA,WACAA,EAAA,QAAA,SACD,CAHD,CAAYA,IAAAA,EAGX,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -67,6 +67,7 @@ type OIDCOptions = {
|
|
|
67
67
|
oidcLoginHint?: string;
|
|
68
68
|
oidcPrompt?: string;
|
|
69
69
|
oidcErrorRedirectUri?: string;
|
|
70
|
+
oidcResource?: string;
|
|
70
71
|
};
|
|
71
72
|
type FlowState = {
|
|
72
73
|
flowId: string;
|
|
@@ -234,12 +235,12 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
234
235
|
readonly cssRules: CSSRuleList;
|
|
235
236
|
} | CSSStyleSheet;
|
|
236
237
|
nonce: string;
|
|
237
|
-
"__#
|
|
238
|
+
"__#29647@#setNonce"(): void;
|
|
238
239
|
init(): Promise<void>;
|
|
239
|
-
"__#
|
|
240
|
+
"__#29642@#observeMappings": {};
|
|
240
241
|
observeAttribute(attrName: string, onAttrChange: (attrName: string, value: string) => void): () => any;
|
|
241
242
|
observeAttributes(attrs: string[], cb: (attrName: string, value: string) => void): () => void;
|
|
242
|
-
"__#
|
|
243
|
+
"__#29641@#isInit": boolean;
|
|
243
244
|
connectedCallback: (() => void) & (() => void) & (() => void);
|
|
244
245
|
accessKey: string;
|
|
245
246
|
readonly accessKeyLabel: string;
|
|
@@ -565,8 +566,8 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
565
566
|
tabIndex: number;
|
|
566
567
|
blur(): void;
|
|
567
568
|
focus(options?: FocusOptions): void;
|
|
568
|
-
"__#
|
|
569
|
-
"__#
|
|
569
|
+
"__#29640@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
570
|
+
"__#29640@#wrapLogger"(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
570
571
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
571
572
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
572
573
|
onLogEvent(logLevel: "error" | "warn" | "info" | "debug", data: any[]): void;
|
|
@@ -902,9 +903,9 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
902
903
|
focus(options?: FocusOptions): void;
|
|
903
904
|
};
|
|
904
905
|
} & (new (...params: any[]) => {
|
|
905
|
-
"__#
|
|
906
|
-
"__#
|
|
907
|
-
"__#
|
|
906
|
+
"__#29644@#lastBaseUrl"?: string;
|
|
907
|
+
"__#29644@#workingBaseUrl"?: string;
|
|
908
|
+
"__#29644@#getResourceUrls"(filename: string): (URL & {
|
|
908
909
|
baseUrl: string;
|
|
909
910
|
}) | (URL & {
|
|
910
911
|
baseUrl: string;
|
|
@@ -1242,34 +1243,34 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
1242
1243
|
blur(): void;
|
|
1243
1244
|
focus(options?: FocusOptions): void;
|
|
1244
1245
|
readonly projectId: string;
|
|
1245
|
-
"__#
|
|
1246
|
+
"__#29643@#handleError"(attrName: string, newValue: string): void;
|
|
1246
1247
|
init(): Promise<void>;
|
|
1247
|
-
"__#
|
|
1248
|
+
"__#29642@#observeMappings": {};
|
|
1248
1249
|
observeAttribute(attrName: string, onAttrChange: (attrName: string, value: string) => void): () => any;
|
|
1249
1250
|
observeAttributes(attrs: string[], cb: (attrName: string, value: string) => void): () => void;
|
|
1250
|
-
"__#
|
|
1251
|
-
"__#
|
|
1252
|
-
"__#
|
|
1251
|
+
"__#29641@#isInit": boolean;
|
|
1252
|
+
"__#29640@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1253
|
+
"__#29640@#wrapLogger": ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger);
|
|
1253
1254
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1254
1255
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
1255
1256
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void);
|
|
1256
1257
|
}) & (new (...params: any[]) => {
|
|
1257
|
-
"__#
|
|
1258
|
+
"__#29656@#globalStyle": _descope_sdk_mixins_static_resources_mixin.InjectedStyle;
|
|
1258
1259
|
readonly theme: _descope_sdk_mixins_static_resources_mixin.ThemeOptions;
|
|
1259
1260
|
readonly styleId: string;
|
|
1260
|
-
"__#
|
|
1261
|
-
"__#
|
|
1262
|
-
readonly "__#
|
|
1263
|
-
"__#
|
|
1264
|
-
"__#
|
|
1265
|
-
"__#
|
|
1261
|
+
"__#29656@#_themeResource": Promise<void | Record<string, any>>;
|
|
1262
|
+
"__#29656@#fetchTheme"(): Promise<Record<string, any>>;
|
|
1263
|
+
readonly "__#29656@#themeResource": Promise<void | Record<string, any>>;
|
|
1264
|
+
"__#29656@#loadGlobalStyle"(): Promise<void>;
|
|
1265
|
+
"__#29656@#loadComponentsStyle"(): Promise<void>;
|
|
1266
|
+
"__#29656@#getFontsConfig"(): Promise<Record<string, {
|
|
1266
1267
|
url?: string;
|
|
1267
1268
|
}>>;
|
|
1268
|
-
"__#
|
|
1269
|
-
"__#
|
|
1270
|
-
"__#
|
|
1271
|
-
"__#
|
|
1272
|
-
"__#
|
|
1269
|
+
"__#29656@#loadFonts"(): Promise<void>;
|
|
1270
|
+
"__#29656@#applyTheme"(): Promise<void>;
|
|
1271
|
+
"__#29656@#onThemeChange": () => void;
|
|
1272
|
+
"__#29656@#loadTheme"(): void;
|
|
1273
|
+
"__#29656@#toggleOsThemeChangeListener": (listen: boolean) => void;
|
|
1273
1274
|
init(): Promise<void>;
|
|
1274
1275
|
injectStyle: ((cssString: string, { prepend }?: {
|
|
1275
1276
|
prepend?: boolean;
|
|
@@ -1287,11 +1288,11 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
1287
1288
|
readonly cssRules: CSSRuleList;
|
|
1288
1289
|
});
|
|
1289
1290
|
nonce: string;
|
|
1290
|
-
"__#
|
|
1291
|
-
"__#
|
|
1291
|
+
"__#29647@#setNonce": (() => void) & (() => void);
|
|
1292
|
+
"__#29642@#observeMappings": {};
|
|
1292
1293
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any);
|
|
1293
1294
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void);
|
|
1294
|
-
"__#
|
|
1295
|
+
"__#29641@#isInit": boolean;
|
|
1295
1296
|
connectedCallback: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
1296
1297
|
accessKey: string;
|
|
1297
1298
|
readonly accessKeyLabel: string;
|
|
@@ -1617,24 +1618,24 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
1617
1618
|
tabIndex: number;
|
|
1618
1619
|
blur(): void;
|
|
1619
1620
|
focus(options?: FocusOptions): void;
|
|
1620
|
-
"__#
|
|
1621
|
-
"__#
|
|
1621
|
+
"__#29640@#logger": _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1622
|
+
"__#29640@#wrapLogger": ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger) & ((logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>) => _descope_sdk_mixins_static_resources_mixin.Logger);
|
|
1622
1623
|
get logger(): _descope_sdk_mixins_static_resources_mixin.Logger;
|
|
1623
1624
|
set logger(logger: Partial<_descope_sdk_mixins_static_resources_mixin.Logger>);
|
|
1624
1625
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void);
|
|
1625
1626
|
contentRootElement: HTMLElement;
|
|
1626
1627
|
rootElement: HTMLElement;
|
|
1627
1628
|
readonly config: Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
1628
|
-
"__#
|
|
1629
|
-
"__#
|
|
1630
|
-
"__#
|
|
1631
|
-
"__#
|
|
1629
|
+
"__#29646@#configCacheClear": (() => void) & (() => void);
|
|
1630
|
+
"__#29646@#_configResource": Promise<_descope_sdk_mixins_static_resources_mixin.Config>;
|
|
1631
|
+
"__#29646@#fetchConfig": (() => Promise<_descope_sdk_mixins_static_resources_mixin.Config>) & (() => Promise<_descope_sdk_mixins_static_resources_mixin.Config>);
|
|
1632
|
+
"__#29645@#callbacks": Map<string, () => void> & Map<string, () => void>;
|
|
1632
1633
|
onReset: ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void);
|
|
1633
1634
|
reset: ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>);
|
|
1634
|
-
"__#
|
|
1635
|
-
"__#
|
|
1636
|
-
"__#
|
|
1637
|
-
"__#
|
|
1635
|
+
"__#29643@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
1636
|
+
"__#29644@#lastBaseUrl"?: string;
|
|
1637
|
+
"__#29644@#workingBaseUrl"?: string;
|
|
1638
|
+
"__#29644@#getResourceUrls": ((filename: string) => (URL & {
|
|
1638
1639
|
baseUrl: string;
|
|
1639
1640
|
}) | (URL & {
|
|
1640
1641
|
baseUrl: string;
|
|
@@ -1660,11 +1661,11 @@ declare const BaseClass: (new (...params: any[]) => {
|
|
|
1660
1661
|
readonly baseStaticUrl: string;
|
|
1661
1662
|
readonly baseUrl: string;
|
|
1662
1663
|
readonly projectId: string;
|
|
1663
|
-
"__#
|
|
1664
|
-
"__#
|
|
1664
|
+
"__#29650@#getComponentsVersion"(): Promise<string>;
|
|
1665
|
+
"__#29650@#descopeUi": Promise<any>;
|
|
1665
1666
|
readonly descopeUi: Promise<any>;
|
|
1666
|
-
"__#
|
|
1667
|
-
"__#
|
|
1667
|
+
"__#29650@#loadDescopeUiComponent"(componentName: string): Promise<any>;
|
|
1668
|
+
"__#29650@#getDescopeUi"(): Promise<any>;
|
|
1668
1669
|
loadDescopeUiComponents(templateOrComponentNames: string[] | HTMLTemplateElement): Promise<any[]>;
|
|
1669
1670
|
readonly baseCdnUrl: string;
|
|
1670
1671
|
injectNpmLib(libName: string, version: string, filePath?: string, overrides?: string[]): Promise<{
|