openstack-uicore-foundation 4.2.29 → 4.2.31
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/.claude/settings.local.json +7 -0
- package/lib/components/clock-context.js +2 -0
- package/lib/components/clock-context.js.map +1 -0
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/inputs/company-input-v2.js +1 -1
- package/lib/components/inputs/company-input-v2.js.map +1 -1
- package/lib/utils/external-store.js +2 -0
- package/lib/utils/external-store.js.map +1 -0
- package/lib/utils/use-event-callback.js +2 -0
- package/lib/utils/use-event-callback.js.map +1 -0
- package/package.json +7 -1
- package/readme.md +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components/inputs/company-input-v2.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,wVCTF,MAAMC,EAA+B,+BAC/BC,EAAmC,mCACnCC,EAAkC,kCAClCC,EAAgC,gCAChCC,EAAyC,yCACzCC,EAAyC,wC,uFCLtD,MAAM,EAA+BC,QAAQ,qB,aCA7C,MAAM,EAA+BA,QAAQ,a,yDCqC7C,MAAMC,KAAO,IAAIC,KAIXC,4BAA8B,wCAKvBC,EAAqB,OAC5BC,EAAY,WAGZC,EAAW,UAsPXC,EAAsBC,MAAOC,EAAMC,KAErC,GAAID,IAASL,GAAsBO,IAAyB,CACxD,IAAKD,EAED,MADAE,IACMC,MAAMlB,EAAAA,kCAGhB,IAAImB,OAzBoBN,OAAOO,EAAIC,EAJhB,EAI0CC,EAHtC,OAI3B,IAAK,IAAIC,EAAU,EAAGA,EAAUF,EAAYE,IACxC,IACI,aAAaH,GACjB,CAA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I,CAAE+D,MAAO,iBAAkBH,QAAS,UAEvChC,EAAO3D,MAGf,GAGTyC,GACN,EAIVb,EAAesE,aAAe,CAC1BlG,KAAM,UACNkC,MAAO,UACPK,aAAc,GACdC,eAAe,GAGnBZ,EAAeuE,UAAY,CACvB5G,SAAU6G,IAAAA,OAAiBtE,WAC3B5E,MAAOkJ,IAAAA,UAAoB,CAACA,IAAAA,OAAkBA,IAAAA,SAC9CpE,SAAUoE,IAAAA,KAAetE,WACzBA,WAAYsE,IAAAA,KACZpG,KAAMoG,IAAAA,OACNjE,MAAOiE,IAAAA,KACPhE,WAAYgE,IAAAA,OACZ/D,OAAQ+D,IAAAA,KACR7D,aAAc6D,IAAAA,OACd9D,YAAa8D,IAAAA,OACblE,MAAOkE,IAAAA,OACP5D,cAAe4D,IAAAA,MAGnB,U","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/security/constants.js","webpack://openstack-uicore-foundation/external commonjs \"browser-tabs-lock\"","webpack://openstack-uicore-foundation/external commonjs \"js-cookie\"","webpack://openstack-uicore-foundation/./src/components/security/methods.js","webpack://openstack-uicore-foundation/./src/utils/actions.js","webpack://openstack-uicore-foundation/external commonjs \"spark-md5\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/sha256\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/enc-base64url\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/enc-hex\"","webpack://openstack-uicore-foundation/./src/utils/crypto.js","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/./src/utils/query-actions.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"i18n-react/dist/i18n-react\"","webpack://openstack-uicore-foundation/external commonjs \"idtoken-verifier\"","webpack://openstack-uicore-foundation/external commonjs \"lodash\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"superagent/lib/client\"","webpack://openstack-uicore-foundation/external commonjs \"sweetalert2\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"@mui/material\"","webpack://openstack-uicore-foundation/./src/components/inputs/company-input-v2.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","export const AUTH_ERROR_MISSING_AUTH_INFO = 'AUTH_ERROR_MISSING_AUTH_INFO';\nexport const AUTH_ERROR_MISSING_REFRESH_TOKEN = 'AUTH_ERROR_MISSING_REFRESH_TOKEN';\nexport const AUTH_ERROR_ACCESS_TOKEN_EXPIRED = 'AUTH_ERROR_ACCESS_TOKEN_EXPIRED';\nexport const AUTH_ERROR_LOCK_ACQUIRE_ERROR = 'AUTH_ERROR_LOCK_ACQUIRE_ERROR'\nexport const AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR = 'AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR';\nexport const AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR = 'AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR';\nexport const AUTH_ERROR_ID_TOKEN_INVALID = 'AUTH_ERROR_ID_TOKEN_INVALID';\nexport const AUTH_ERROR_MISSING_OTP_PARAM = 'AUTH_ERROR_MISSING_OTP_PARAM';\nexport const AUTH_ERROR_MISSING_PKCE_PARAM = 'AUTH_ERROR_MISSING_PKCE_PARAM';\nexport const AUTH_ERROR_MISSING_NONCE_PARAM = 'AUTH_ERROR_MISSING_NONCE_PARAM';\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"browser-tabs-lock\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"js-cookie\");","import {\n base64URLEncode,\n getAuthCallback,\n getCurrentLocation,\n getFromLocalStorage,\n removeFromLocalStorage,\n getOrigin,\n putOnLocalStorage,\n retryPromise,\n setSessionClearingState,\n} from \"../../utils/methods\";\nimport moment from \"moment-timezone\";\nimport request from 'superagent/lib/client';\nimport SuperTokensLock from 'browser-tabs-lock';\nimport Cookies from 'js-cookie'\nlet http = request;\nimport URI from \"urijs\";\nimport IdTokenVerifier from \"idtoken-verifier\";\nimport {SET_LOGGED_USER} from \"./actions\";\nimport {getRandomBytes, getSHA256} from \"../../utils/crypto\";\n\nimport {\n AUTH_ERROR_ACCESS_TOKEN_EXPIRED,\n AUTH_ERROR_MISSING_AUTH_INFO,\n AUTH_ERROR_MISSING_REFRESH_TOKEN,\n AUTH_ERROR_LOCK_ACQUIRE_ERROR,\n AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR,\n AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR,\n AUTH_ERROR_ID_TOKEN_INVALID,\n AUTH_ERROR_MISSING_OTP_PARAM,\n AUTH_ERROR_MISSING_PKCE_PARAM,\n AUTH_ERROR_MISSING_NONCE_PARAM,\n} from \"./constants\";\n\n/**\n * @ignore\n */\nconst Lock = new SuperTokensLock();\n/**\n * @ignore\n */\nconst GET_TOKEN_SILENTLY_LOCK_KEY = 'openstackuicore.lock.getTokenSilently';\nconst GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT = 6000;\nconst NONCE_LEN = 16;\nexport const ACCESS_TOKEN_SKEW_TIME = 60;\nexport const RESPONSE_TYPE_IMPLICIT = \"token id_token\";\nexport const RESPONSE_TYPE_CODE = 'code';\nconst AUTH_INFO = 'authInfo';\nconst NONCE = 'nonce';\nconst PKCE = 'pkce';\nconst ID_TOKEN = 'idToken';\nconst BACK_ULR_PARAM_NAME = 'BackUrl';\n\n\n/**\n *\n * @param backUrl\n * @param prompt\n * @param tokenIdHint\n * @param provider\n * @param loginHint\n * @param otpLoginHint\n * @param tenant\n * @param backUrlParamName\n * @returns {*}\n */\nexport const getAuthUrl = (\n backUrl = null,\n prompt = null,\n tokenIdHint = null,\n provider = null,\n loginHint = null,\n otpLoginHint = null,\n tenant = null,\n backUrlParamName = BACK_ULR_PARAM_NAME\n ) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let redirectUri = getAuthCallback();\n let baseUrl = getOAuth2IDPBaseUrl();\n let scopes = getOAuth2Scopes();\n let flow = getOAuth2Flow();\n\n if (backUrl != null)\n redirectUri += `?${backUrlParamName}=${encodeURIComponent(backUrl)}`;\n\n let nonce = createNonce(NONCE_LEN);\n\n // store nonce to check it later\n putOnLocalStorage(NONCE, nonce);\n let url = URI(`${baseUrl}/oauth2/auth`);\n\n let query = {\n \"response_type\": encodeURI(flow),\n \"scope\": encodeURI(scopes),\n \"nonce\": nonce,\n \"response_mode\": 'fragment',\n \"client_id\": encodeURI(oauth2ClientId),\n \"redirect_uri\": encodeURI(redirectUri)\n };\n\n if (flow === RESPONSE_TYPE_CODE) {\n const pkce = createPKCECodes()\n putOnLocalStorage(PKCE, JSON.stringify(pkce));\n query['code_challenge'] = pkce.codeChallenge;\n query['code_challenge_method'] = 'S256';\n query['approval_prompt'] = 'force';\n }\n\n if (prompt) {\n query['prompt'] = prompt;\n }\n\n if (scopes && scopes.includes('offline_access')) {\n // then we need to force prompt=consent bc we are requesting an offline access\n // and we need to let the user know\n query['prompt'] = 'consent';\n }\n\n if (tokenIdHint) {\n query['id_token_hint'] = tokenIdHint;\n }\n\n if (provider) {\n query['provider'] = provider;\n }\n\n if (otpLoginHint) {\n query['otp_login_hint'] = otpLoginHint;\n }\n\n if (loginHint) {\n query['login_hint'] = encodeURI(loginHint);\n }\n\n if (tenant) {\n query['tenant'] = tenant;\n }\n\n url = url.query(query);\n //console.log(`getAuthUrl ${url.toString()}`);\n return url;\n}\n\n/**\n * @param idToken\n * @returns {*}\n */\nexport const getLogoutUrl = (idToken = null) => {\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n let url = URI(`${baseUrl}/oauth2/end-session`);\n let state = createNonce(NONCE_LEN);\n let postLogOutUri = `${getOrigin()}/auth/logout`;\n // store nonce to check it later\n putOnLocalStorage('post_logout_state', state);\n /**\n * post_logout_redirect_uri should be listed on oauth2 client settings\n * on IDP\n * \"Security Settings\" Tab -> Logout Options -> Post Logout Uris\n */\n const queryParams = {\n \"post_logout_redirect_uri\": encodeURI(postLogOutUri),\n \"client_id\": encodeURI(oauth2ClientId),\n \"state\": state,\n }\n\n if (idToken)\n queryParams.id_token_hint = idToken;\n\n return url.query(queryParams);\n}\n\nconst createNonce = (len) => {\n let possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let nonce = '';\n for (let i = 0; i < len; i++) {\n nonce += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return nonce;\n}\n\n/**\n *\n * @param backUrl\n * @param provider\n * @param prompt\n * @param loginHint\n * @param otpLoginHint\n * @param tenant\n */\nexport const doLogin = (\n backUrl = null,\n provider = null,\n prompt = null,\n loginHint = null,\n otpLoginHint = null,\n tenant = null\n) => {\n let url = getAuthUrl(backUrl, prompt, null, provider, loginHint, otpLoginHint, tenant);\n let location = getCurrentLocation()\n location.replace(url.toString());\n}\n\n/**\n *\n * @param backUrl\n * @param loginHint\n * @param otpLoginHint\n */\nexport const doLoginBasicLogin = (backUrl = null, loginHint = null, otpLoginHint = null) => {\n doLogin(backUrl, null, null, loginHint, otpLoginHint);\n}\n\nconst createPKCECodes = () => {\n const codeVerifier = base64URLEncode(getRandomBytes(64))\n const codeChallenge = getSHA256(codeVerifier, 'Base64url')\n const createdAt = new Date()\n const codePair = {\n codeVerifier,\n codeChallenge,\n createdAt\n }\n return codePair\n}\n\n/**\n\n * @param code\n * @param backUrl\n * @param backUrlParamName\n * @returns {Promise<{access_token: *, refresh_token: *, id_token: *, expires_in: *, error: *, error_description: *}>}\n */\nexport const emitAccessToken = async (code, backUrl = null, backUrlParamName = BACK_ULR_PARAM_NAME) => {\n\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n let redirectUri = getAuthCallback();\n let pkce = JSON.parse(getFromLocalStorage(PKCE, true));\n\n if (!pkce)\n throw Error(AUTH_ERROR_MISSING_PKCE_PARAM);\n\n if (backUrl != null)\n redirectUri += `?${backUrlParamName}=${encodeURIComponent(backUrl)}`;\n\n const payload = {\n 'code': code,\n 'grant_type': 'authorization_code',\n 'code_verifier': pkce.codeVerifier,\n \"client_id\": encodeURI(oauth2ClientId),\n \"redirect_uri\": encodeURI(redirectUri)\n };\n\n try {\n //const response = await http.post(`${baseUrl}/oauth2/token`, payload);\n //const {body: {access_token, refresh_token, id_token, expires_in}} = response;\n const response = await fetch(`${baseUrl}/oauth2/token`, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload)\n }).catch(function (error) {\n console.log('Request failed:', error.message);\n });\n const json = await response.json();\n let {access_token, refresh_token, id_token, expires_in, error, error_description} = json;\n return {access_token, refresh_token, id_token, expires_in, error, error_description}\n } catch (err) {\n console.log(err);\n }\n};\n\nexport const MAX_RETRIES = 5;\nexport const BACKOFF_BASE_MS = 1000;\nexport const REFRESH_TOKEN_FETCH_TIMEOUT_MS = 10000;\n\nexport const retryWithBackoff = async (fn, maxRetries = MAX_RETRIES, baseDelayMs = BACKOFF_BASE_MS) => {\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n return await fn();\n } catch (err) {\n // only retry transient network/server errors — everything else fails fast\n const isRetryable = err.message && err.message.startsWith(AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR);\n if (!isRetryable || attempt === maxRetries - 1) {\n throw err;\n }\n const delay = baseDelayMs * Math.pow(2, attempt);\n console.log(`retryWithBackoff retry ${attempt + 1}/${maxRetries} in ${delay}ms`);\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n};\n\nconst processRefreshToken = async (flow, refreshToken) => {\n\n if (flow === RESPONSE_TYPE_CODE && useOAuth2RefreshToken()) {\n if (!refreshToken) {\n clearAuthInfo();\n throw Error(AUTH_ERROR_MISSING_REFRESH_TOKEN);\n }\n\n let response = await retryWithBackoff(() => refreshAccessToken(refreshToken));\n let {access_token, expires_in, refresh_token, id_token} = response;\n if (typeof refresh_token === 'undefined') {\n refresh_token = null; // not using rotate policy\n }\n storeAuthInfo(access_token, expires_in, refresh_token, id_token);\n return access_token;\n }\n clearAuthInfo();\n throw Error(AUTH_ERROR_ACCESS_TOKEN_EXPIRED);\n}\n\n/**\n * @returns {Promise<*>}\n * @private\n */\nconst _getAccessToken = async () => {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken`);\n let authInfo = getAuthInfo();\n\n if (!authInfo) {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken AUTH_ERROR_MISSING_AUTH_INFO`);\n throw Error(AUTH_ERROR_MISSING_AUTH_INFO);\n }\n\n let {accessToken, expiresIn, accessTokenUpdatedAt, refreshToken} = authInfo;\n let flow = getOAuth2Flow();\n // check lifetime\n const now = moment().unix();\n let timeElapsedSecs = (now - accessTokenUpdatedAt);\n\n expiresIn = (expiresIn - ACCESS_TOKEN_SKEW_TIME);\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken now ${now} accessTokenUpdatedAt ${accessTokenUpdatedAt} expiresIn ${expiresIn} timeElapsedSecs ${timeElapsedSecs}`)\n if (timeElapsedSecs >= expiresIn || accessToken == null) {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken access token expired, refreshing it ...`);\n accessToken = await processRefreshToken(flow, refreshToken);\n }\n return accessToken;\n}\n\n/**\n * @returns {Promise<*|undefined>}\n */\nexport const getAccessToken = async () => {\n if (typeof navigator !== 'undefined' && navigator.locks) {\n return await navigator.locks.request(GET_TOKEN_SILENTLY_LOCK_KEY, async lock => {\n console.log(`openstack-uicore-foundation::Security::methods::getAccessToken web lock api`, lock);\n return await _getAccessToken();\n });\n } else {\n if (\n await retryPromise(\n () => Lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT),\n 10\n )\n ) {\n try {\n return await _getAccessToken();\n } finally {\n await Lock.releaseLock(GET_TOKEN_SILENTLY_LOCK_KEY);\n }\n } else {\n // error on locking\n throw Error(AUTH_ERROR_LOCK_ACQUIRE_ERROR);\n }\n }\n}\n\n/**\n * @private\n */\nconst _clearAccessToken = () => {\n console.log(`openstack-uicore-foundation::Security::methods::_clearAccessToken`);\n\n let authInfo = getAuthInfo();\n\n if (!authInfo) {\n console.log(`openstack-uicore-foundation::Security::methods::_clearAccessToken AUTH_ERROR_MISSING_AUTH_INFO`);\n throw Error(AUTH_ERROR_MISSING_AUTH_INFO);\n }\n\n let {accessToken, expiresIn, accessTokenUpdatedAt, refreshToken} = authInfo;\n\n storeAuthInfo(null, 0, refreshToken)\n}\n\nexport const clearAccessToken = async () => {\n // see https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API\n if (typeof navigator !== 'undefined' && navigator.locks) {\n await navigator.locks.request(GET_TOKEN_SILENTLY_LOCK_KEY, async lock => {\n console.log(`openstack-uicore-foundation::Security::methods::clearAccessToken web lock api`, lock);\n _clearAccessToken();\n });\n } else {\n if (\n await retryPromise(\n () => Lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT),\n 10\n )\n ) {\n try {\n _clearAccessToken();\n } finally {\n await Lock.releaseLock(GET_TOKEN_SILENTLY_LOCK_KEY);\n }\n } else {\n // error on locking\n throw Error(AUTH_ERROR_LOCK_ACQUIRE_ERROR);\n }\n }\n}\n\n\nexport const refreshAccessToken = async (refresh_token) => {\n\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n\n const payload = {\n 'grant_type': 'refresh_token',\n \"client_id\": encodeURI(oauth2ClientId),\n \"refresh_token\": refresh_token\n };\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), REFRESH_TOKEN_FETCH_TIMEOUT_MS);\n\n let response;\n try {\n response = await fetch(`${baseUrl}/oauth2/token`, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload),\n signal: controller.signal\n });\n } catch (networkError) {\n // fetch rejects on network failures (DNS, timeout, no connectivity, abort)\n console.log('refreshAccessToken network error:', networkError.message);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: ${networkError.message}`);\n } finally {\n clearTimeout(timeoutId);\n }\n\n if (!response.ok) {\n console.log(`refreshAccessToken server error: ${response.status} - ${response.statusText}`);\n if (response.status >= 500 || response.status === 408 || response.status === 429) {\n // transient error (server error, request timeout, rate limit) — should be retried\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: ${response.status} - ${response.statusText}`);\n }\n // token is genuinely revoked — this is a real auth error\n setSessionClearingState(true);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: ${response.status} - ${response.statusText}`);\n }\n\n let json;\n try {\n json = await response.json();\n } catch (parseError) {\n // IDP returned non-JSON (HTML error page, empty body, etc.) — treat as transient\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: invalid JSON response from IDP`);\n }\n let {access_token, refresh_token: new_refresh_token, expires_in, id_token} = json;\n // Defensively ensure we never propagate an undefined access token.\n if (!access_token) {\n setSessionClearingState(true);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: missing access_token in refresh response`);\n }\n return {access_token, refresh_token: new_refresh_token, expires_in, id_token}\n}\n\nexport const storeAuthInfo = (accessToken, expiresIn, refreshToken = null, idToken = null) => {\n\n let formerAuthInfo = getAuthInfo();\n\n let authInfo = {\n accessToken: accessToken,\n expiresIn: expiresIn,\n accessTokenUpdatedAt: Math.floor(Date.now() / 1000),\n };\n\n if (refreshToken == null && formerAuthInfo) {\n refreshToken = formerAuthInfo.refreshToken;\n }\n\n if (idToken == null && formerAuthInfo) {\n idToken = formerAuthInfo.idToken;\n }\n\n if (refreshToken) {\n authInfo['refreshToken'] = refreshToken;\n }\n\n if (idToken) {\n authInfo[ID_TOKEN] = idToken;\n Cookies.set(ID_TOKEN, idToken, {secure: true, sameSite: 'Lax'});\n } else {\n Cookies.remove(ID_TOKEN);\n }\n\n putOnLocalStorage(AUTH_INFO, JSON.stringify(authInfo));\n}\n\nexport const getAuthInfo = () => {\n try {\n let res = getFromLocalStorage(AUTH_INFO, false)\n if (!res) return null;\n return JSON.parse(res);\n } catch (err) {\n return null;\n }\n}\n\nexport const clearAuthInfo = () => {\n if (typeof window !== 'undefined') {\n removeFromLocalStorage(AUTH_INFO);\n Cookies.remove(ID_TOKEN);\n }\n};\n\nexport const getIdToken = () => {\n if (typeof window !== 'undefined') {\n const authInfo = getAuthInfo();\n if (authInfo) {\n return authInfo.idToken;\n }\n return null;\n }\n return null;\n};\n\nexport const getOAuth2ClientId = () => {\n if (typeof window !== 'undefined') {\n return window.OAUTH2_CLIENT_ID;\n }\n return null;\n};\n\nexport const getOAuth2Flow = () => {\n if (typeof window !== 'undefined') {\n return window.OAUTH2_FLOW || \"token id_token\";\n }\n return \"token id_token\";\n}\n\nexport const useOAuth2RefreshToken = () => {\n if (typeof window !== 'undefined') {\n return new Boolean(window.OAUTH2_USE_REFRESH_TOKEN || true);\n }\n return true;\n}\n\nexport const getOAuth2IDPBaseUrl = () => {\n if (typeof window !== 'undefined') {\n return window.IDP_BASE_URL;\n }\n return null;\n};\n\nexport const getOAuth2Scopes = () => {\n if (typeof window !== 'undefined') {\n return window.SCOPES;\n }\n return null;\n};\n\nexport const initLogOut = () => {\n let location = getCurrentLocation();\n location.replace(getLogoutUrl(getIdToken()).toString());\n}\n\nexport const validateIdToken = (idToken, issuer, audience) => {\n\n let verifier = new IdTokenVerifier({\n issuer: issuer,\n audience: audience\n });\n\n let storedNonce = getFromLocalStorage(NONCE, true);\n if (!storedNonce)\n throw Error(AUTH_ERROR_MISSING_NONCE_PARAM);\n\n let jwt = verifier.decode(idToken);\n let alg = jwt.header.alg;\n let kid = jwt.header.kid;\n let aud = jwt.payload.aud;\n let iss = jwt.payload.iss;\n let exp = jwt.payload.exp;\n let nbf = jwt.payload.nbf;\n let tnonce = jwt.payload.nonce || null;\n\n return tnonce == storedNonce && aud == audience && iss == issuer;\n}\n\nexport const passwordlessStart = (params) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let scopes = getOAuth2Scopes();\n let nonce = createNonce(NONCE_LEN);\n // store nonce to check it later\n putOnLocalStorage(NONCE, nonce);\n let baseUrl = getOAuth2IDPBaseUrl();\n let url = URI(`${baseUrl}/oauth2/auth`);\n\n let payload = {\n \"response_type\": \"otp\",\n \"scope\": encodeURI(scopes),\n \"nonce\": nonce,\n \"client_id\": encodeURI(oauth2ClientId),\n \"connection\": params.connection || \"email\",\n \"send\": params.send || \"code\",\n };\n\n if (params.hasOwnProperty('email')) {\n payload[\"email\"] = encodeURIComponent(params.email);\n }\n\n if (params.hasOwnProperty('phone_number')) {\n payload[\"phone_number\"] = encodeURIComponent(params.phone_number);\n }\n\n if (params.hasOwnProperty('redirect_uri')) {\n payload[\"redirect_uri\"] = encodeURIComponent(params.redirect_uri);\n }\n\n let req = http.post(url.toString());\n\n return req.send(payload).then((res) => {\n let json = res.body;\n return Promise.resolve({response: json});\n }).catch((err) => {\n return Promise.reject(err);\n });\n\n}\n\nexport const passwordlessLogin = (params) => (dispatch) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let scopes = getOAuth2Scopes();\n let baseUrl = getOAuth2IDPBaseUrl();\n let url = URI(`${baseUrl}/oauth2/token`);\n\n if (!params.hasOwnProperty(\"otp\")) {\n throw Error(AUTH_ERROR_MISSING_OTP_PARAM);\n }\n\n let payload = {\n \"grant_type\": \"passwordless\",\n \"connection\": params.connection || \"email\",\n \"scope\": encodeURI(scopes),\n \"client_id\": encodeURI(oauth2ClientId),\n \"otp\": params.otp\n };\n\n if (params.hasOwnProperty('email')) {\n payload[\"email\"] = encodeURIComponent(params.email);\n }\n\n if (params.hasOwnProperty('phone_number')) {\n payload[\"phone_number\"] = encodeURIComponent(params.phone_number);\n }\n\n let req = http.post(url.toString());\n\n return req.send(payload).then((res) => {\n try {\n // now we got token\n let json = res.body;\n let {access_token, expires_in, refresh_token, id_token} = json;\n\n if (typeof refresh_token === 'undefined') {\n refresh_token = null; // not using rotate policy\n }\n\n if (typeof id_token === 'undefined') {\n id_token = null; // not using rotate policy\n }\n\n // verify id token\n\n if (id_token) {\n if (!validateIdToken(id_token, baseUrl, oauth2ClientId)) {\n throw Error(AUTH_ERROR_ID_TOKEN_INVALID);\n }\n }\n\n storeAuthInfo(access_token, expires_in, refresh_token, id_token);\n\n if (dispatch) {\n dispatch({\n type: SET_LOGGED_USER,\n payload: {sessionState: null}\n });\n }\n\n return Promise.resolve({response: json});\n } catch (e) {\n console.log(e);\n return Promise.reject(e);\n }\n }).catch((err) => {\n return Promise.reject(err);\n });\n}\n\nexport const isIdTokenAlive = (nowEpoch = null) => () => {\n\n if (!nowEpoch) {\n nowEpoch = Math.floor(Date.now() / 1000);\n }\n\n const idToken = getIdToken();\n if (!idToken)\n throw Error('Id Token not set.');\n\n const issuer = getOAuth2IDPBaseUrl();\n const audience = getOAuth2ClientId();\n\n let verifier = new IdTokenVerifier({\n issuer: issuer,\n audience: audience\n });\n\n const jwt = verifier.decode(idToken);\n const exp = jwt.payload.exp;\n\n // check life time\n return exp - (nowEpoch + ACCESS_TOKEN_SKEW_TIME) > 0;\n}\n","/**\n * Copyright 2017 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific flanguage governing permissions and\n * limitations under the License.\n **/\n\nimport request from 'superagent/lib/client';\nimport URI from \"urijs\";\nURI.escapeQuerySpace = false;\n\nlet http = request;\nimport Swal from 'sweetalert2';\nimport T from \"i18n-react/dist/i18n-react\";\nimport { isClearingSessionState, setSessionClearingState, getCurrentPathName } from './methods';\nimport { CLEAR_SESSION_STATE } from '../components/security/actions';\nimport { doLogin, initLogOut } from '../components/security/methods';\n\nexport const GENERIC_ERROR = \"Yikes. Something seems to be broken. Our web team has been notified, and we apologize for the inconvenience.\";\nexport const RESET_LOADING = 'RESET_LOADING';\nexport const START_LOADING = 'START_LOADING';\nexport const STOP_LOADING = 'STOP_LOADING';\nexport const VALIDATE = 'VALIDATE';\nexport const CLEAR_MESSAGE = 'CLEAR_MESSAGE';\nexport const SHOW_MESSAGE = 'SHOW_MESSAGE';\n\nexport const createAction = type => payload => ({\n type,\n payload\n});\n\nexport const resetLoading = createAction(RESET_LOADING);\nexport const startLoading = createAction(START_LOADING);\nexport const stopLoading = createAction(STOP_LOADING);\n\nconst xhrs = {};\nconst etagCache = {};\n\nconst cancel = (key) => {\n if(xhrs[key]) {\n xhrs[key].abort();\n console.log(`aborted request ${key}`);\n delete xhrs[key];\n }\n}\n\nconst schedule = (key, req) => {\n // console.log(`scheduling ${key}`);\n xhrs[key] = req;\n};\n\nconst isObjectEmpty = (obj) => {\n return Object.keys(obj).length === 0 && obj.constructor === Object ;\n}\n\nconst buildNotifyHandlerPayload = (httpCode, title, content, type) => ({ httpCode, title, html: content, type });\nconst buildNotifyHandlerErrorPayload = (httpCode, title, content) => buildNotifyHandlerPayload(httpCode, title, content, \"error\");\nconst buildNotifyHandlerWarningPayload = (httpCode, title, content) => buildNotifyHandlerPayload(httpCode, title, content, \"warning\");\n\nconst initLogin = () => (dispatch) => {\n const currentLocation = getCurrentPathName();\n const clearingSessionState = isClearingSessionState();\n dispatch({\n type: CLEAR_SESSION_STATE,\n payload: {}\n });\n if (!clearingSessionState) {\n setSessionClearingState(true);\n console.log(\"authErrorHandler 401 - re login\");\n doLogin(currentLocation);\n }\n};\n\nconst normalizeFormDataPayload = (req, formData) => {\n if(!isObjectEmpty(formData)) {\n Object.keys(formData).forEach(function (key) {\n let value = formData[key];\n if (Array.isArray(value)) {\n value.forEach(item => {\n req.field(`${key}[]`, item);\n });\n } else {\n req.field(key, value);\n }\n });\n }\n};\n\nexport const authErrorHandler = (\n err,\n res,\n notifyErrorHandler = showMessage\n) => (dispatch) => {\n\n const code = err.status;\n let msg = \"\";\n let payload, callback;\n\n dispatch(stopLoading());\n\n switch (code) {\n case 401:\n if (notifyErrorHandler !== showMessage) {\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.user_not_auth\"));\n callback = () => dispatch(initLogin());\n } else {\n dispatch(initLogin());\n }\n break;\n case 403:\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.user_not_authz\"));\n callback = initLogOut;\n break;\n case 404:\n msg = err.response.body?.message || err.response.error?.message || err.message;\n if (err.response.body?.errors?.length) {\n msg += `<br>${err.response.body.errors.join(\"<br>\")}`;\n }\n payload = buildNotifyHandlerWarningPayload(code, \"Not Found\", msg);\n break;\n case 412:\n for (const [key, value] of Object.entries(err.response.body.errors)) {\n msg += isNaN(key) ? `${key}: ` : \"\";\n msg += `${value}<br>`;\n }\n dispatch({\n type: VALIDATE,\n payload: { errors: err.response.body.errors }\n });\n payload = buildNotifyHandlerWarningPayload(code, \"Validation error\", msg);\n break;\n default:\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.server_error\"));\n }\n\n if (payload)\n dispatch(notifyErrorHandler(payload, callback));\n}\n\nexport const getRequest =(\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {},\n useEtag = false\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n let key = url.toString();\n\n if(!isObjectEmpty(params)) {\n // remove the access token\n const { access_token: _, ...newParams} = params;\n // and generate new key\n key = url.query(newParams).toString();\n url = url.query(params);\n }\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n cancel(key);\n\n return new Promise((resolve, reject) => {\n let req = http.get(url.toString());\n if(useEtag && etagCache.hasOwnProperty(key)){\n const { etag } = etagCache[key];\n if(etag){\n req.set('If-None-Match', etag)\n }\n }\n\n req.timeout({\n response: 60000,\n deadline: 60000,\n })\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject, key, useEtag))\n\n schedule(key, req);\n });\n};\n\nexport const putRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => ( dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n if(payload == null)\n payload = {};\n http.put(url.toString())\n .send(payload)\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject))\n });\n};\n\nexport const deleteRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params) => (dispatch, state) => {\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n if(payload == null)\n payload = {};\n\n http.delete(url)\n .send(payload)\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const postRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n let request = http.post(url);\n\n if(payload != null)\n request.send(payload);\n else // to be a simple CORS request\n request.set('Content-Type', 'text/plain');\n\n request.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const postFile = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n file,\n fileMetadata = {},\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n const req = http.post(url)\n .attach('file', file);\n\n normalizeFormDataPayload(req, fileMetadata);\n\n req.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const putFile = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n file = null,\n fileMetadata = {},\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n const req = http.put(url);\n\n if(file != null){\n req.attach('file', file);\n }\n\n normalizeFormDataPayload(req, fileMetadata)\n\n req.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const defaultErrorHandler = (err, res) => (dispatch) => {\n let body = res.body;\n let text = '';\n if(body instanceof Object){\n if(body.hasOwnProperty('message'))\n text = body.message;\n }\n Swal.fire(res.statusText, text, \"error\");\n}\n\nconst byLowerCase = toFind => value => toLowerCase(value) === toFind;\nconst toLowerCase = value => value.toLowerCase();\nconst getKeys = headers => Object.keys(headers);\n\nexport const getHeaderCaseInsensitive = (headerName, headers = {}) => {\n const key = getKeys(headers).find(byLowerCase(headerName));\n return key ? headers[key] : undefined;\n};\n\nexport const responseHandler = ( dispatch, state, receiveActionCreator, errorHandler, resolve, reject, key = null, useEtag= false ) =>\n\n (err, res) => {\n\n if (err || !res.ok) {\n let code = err.status;\n\n if(code === 304 && etagCache.hasOwnProperty(key) && useEtag){\n const { body } = etagCache[key];\n\n if(typeof receiveActionCreator === 'function') {\n dispatch(receiveActionCreator({response: body}));\n return resolve({response: body});\n }\n\n dispatch(receiveActionCreator);\n return resolve({response: body});\n }\n if(errorHandler) {\n errorHandler(err, res)(dispatch, state);\n }\n return reject({ err, res, dispatch, state })\n }\n\n let json = res.body;\n\n if(useEtag) {\n const responseETAG = getHeaderCaseInsensitive('etag', res.headers);\n if (responseETAG) {\n etagCache[key] = { etag: responseETAG, body: json};\n }\n }\n\n if(typeof receiveActionCreator === 'function') {\n dispatch(receiveActionCreator({response: json}));\n return resolve({response: json});\n }\n dispatch(receiveActionCreator);\n return resolve({response: json});\n}\n\n\nexport const fetchErrorHandler = (response) => {\n let code = response.status;\n let msg = response.statusText;\n\n switch (code) {\n case 403:\n Swal.fire(\"ERROR\", T.translate(\"errors.user_not_authz\"), \"warning\");\n break;\n case 401:\n Swal.fire(\"ERROR\", T.translate(\"errors.session_expired\"), \"error\");\n break;\n case 412:\n Swal.fire(\"ERROR\", msg, \"warning\");\n case 500:\n Swal.fire(\"ERROR\", T.translate(\"errors.server_error\"), \"error\");\n }\n}\n\nexport const fetchResponseHandler = (response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.json();\n }\n}\n\nexport const showMessage = (settings, callback = null) => (dispatch) => {\n dispatch(stopLoading());\n Swal.fire(settings).then((result) => {\n if (result.value && typeof callback === 'function') {\n callback();\n }\n });\n}\n\nexport const showSuccessMessage = (html) => (dispatch) => {\n dispatch(stopLoading());\n Swal.fire({\n title: T.translate(\"general.done\"),\n html: html,\n type: 'success'\n });\n}\n\nexport const downloadFileByContent = (filename, content, mime) => {\n let link = document.createElement('a');\n link.textContent = 'download';\n link.download = filename;\n link.href = `data:${mime},${encodeURIComponent(content)}`\n document.body.appendChild(link); // Required for FF\n link.click();\n document.body.removeChild(link);\n}\n\nexport const getCSV = (endpoint, params, filename, header = null) => (dispatch) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n dispatch(startLoading());\n\n return fetch(url.toString())\n .then((response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.text();\n }\n })\n .then((csv) => {\n dispatch(stopLoading());\n\n if (header) {\n csv = header + '\\r\\r' + csv;\n }\n downloadFileByContent(filename, csv, 'text/csv;charset=utf-8');\n })\n .catch(fetchErrorHandler);\n};\n\nexport const getRawCSV = (endpoint, params, header = null) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n return fetch(url.toString())\n .then((response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.text();\n }\n })\n .then((csv) => {\n if (header) {\n csv = header + '\\r\\r' + csv;\n }\n\n return csv;\n })\n .catch(fetchErrorHandler);\n};\n\nexport const escapeFilterValue = (value) => {\n value = String(value);\n // escape backslash first so you don't accidentally break your own escapes\n value = value.replace(/\\\\/g, \"\\\\\\\\\");\n value = value.replace(/,/g, \"\\\\,\");\n value = value.replace(/;/g, \"\\\\;\");\n // especial case for literal +\n value = value.replace(/\\+/g, \"%2B\");\n return value;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"spark-md5\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/sha256\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/enc-base64url\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/enc-hex\");","import SparkMD5 from \"spark-md5\";\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nconst MAX_BYTES = 65536\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nconst MAX_UINT32 = 4294967295\nconst crypto = typeof window !== 'undefined' ? (window.crypto || window.msCrypto) : null;\nimport sha256 from 'crypto-js/sha256';\nimport Base64url from 'crypto-js/enc-base64url'\nimport Hex from 'crypto-js/enc-hex'\nexport const getRandomBytes = (size) => {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n const bytes = Buffer.allocUnsafe(size)\n if(!crypto) return a;\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (let generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n return bytes\n}\n\nexport const getSHA256 = (message, format = 'hex') => {\n\n let f = Hex;\n if(format === 'Base64url')\n f = Base64url;\n\n return sha256(message).toString(f);\n}\n\nexport const getMD5 = (file) => {\n return new Promise((resolve, reject) => {\n const chunkSize = 2 * 1024 * 1024; // 2 MB by chunk\n const spark = new SparkMD5.ArrayBuffer();\n const fileReader = new FileReader();\n let cursor = 0;\n\n fileReader.onload = e => {\n spark.append(e.target.result); \n cursor += chunkSize;\n\n if (cursor < file.size) {\n readNextChunk();\n } else {\n resolve(spark.end()); // final MD5\n }\n };\n\n fileReader.onerror = () => reject(\"Error reading the file\");\n\n function readNextChunk() {\n const slice = file.slice(cursor, cursor + chunkSize);\n fileReader.readAsArrayBuffer(slice);\n }\n\n readNextChunk();\n });\n}","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport { fetchErrorHandler, fetchResponseHandler, escapeFilterValue } from \"./actions\";\nimport { getAccessToken } from '../components/security/methods';\nimport { buildAPIBaseUrl } from \"./methods\";\nimport _ from 'lodash';\nexport const RECEIVE_COUNTRIES = 'RECEIVE_COUNTRIES';\nconst callDelay = 500; // milliseconds\nimport URI from \"urijs\";\nURI.escapeQuerySpace = false;\nexport const DEFAULT_PAGE_SIZE = 10;\n\nconst _fetchPublic = async (endpoint, callback, options = {}) => {\n return fetch(buildAPIBaseUrl(endpoint.toString()), options)\n .then(fetchResponseHandler)\n .then((json) => {\n if(typeof callback === 'function')\n callback(json.data);\n })\n .catch(response => {\n const code = response.status;\n if (code === 404) callback([]);\n return response;\n })\n .catch(fetchErrorHandler);\n}\n\n/**\n * @param endpoint\n * @param callback\n * @param options\n * @returns {Promise<Response | void>}\n * @private\n */\nconst _fetch = async (endpoint, callback, options = {}) => {\n\n let accessToken;\n\n try {\n accessToken = await getAccessToken();\n } catch (e) {\n if(typeof callback === 'function')\n callback(e);\n return Promise.reject();\n }\n\n endpoint.addQuery('access_token', accessToken);\n\n return _fetchPublic(endpoint, callback, options);\n}\n\n/**\n *\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryMembers = _.debounce(async (input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/members`);\n\n endpoint.addQuery('expand', `tickets,rsvp,schedule_summit_events,all_affiliations`);\n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name@@${input},first_name@@${input},last_name@@${input},email@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n *\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryAttendees = _.debounce(async (summitId, input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n \n let endpoint = URI(`/api/v1/summits/${summitId}/attendees`);\n \n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n \n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name=@${input},email=@${input}`);\n }\n \n _fetch(endpoint, callback);\n \n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const querySummits = _.debounce(async (input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/all`);\n\n endpoint.addQuery('expand', `tickets,rsvp,schedule_summit_events,all_affiliations`);\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySpeakers = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE ) => {\n\n\n let endpoint = URI(`/api/v1/${summitId ? `summits/${summitId}/speakers`:`speakers`}`);\n\n endpoint.addQuery('expand', `member,registration_request`);\n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name@@${input},first_name@@${input},last_name@@${input},email@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTags = _.debounce(async (summitId, input, callback, per_page = 50) => {\n\n let endpoint = URI(`/api/v1/${summitId ? `summits/${summitId}/track-tag-groups/all/allowed-tags`:`tags`}`);\n\n if(summitId)\n endpoint.addQuery('expand', `tag,track_tag_group`);\n\n endpoint.addQuery('order','tag');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `tag@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTracks = _.debounce(async (summitId, input, callback, excludedIds = [], per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/tracks`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if (excludedIds?.length > 0) {\n endpoint.addQuery('filter[]', `not_id==${excludedIds.join(\"||\")}`);\n }\n\n if (input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTrackGroups = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/track-groups`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=, *): Promise<void>)|*>}\n */\nexport const queryEvents = _.debounce(async (summitId, input, onlyPublished = false, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/events` + (onlyPublished ? '/published' : ''));\n\n endpoint.addQuery('order','title');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `title@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=, *=): Promise<void>)|*>}\n */\nexport const queryEventTypes = _.debounce(async (summitId, input, callback, eventTypeClassName = null, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/event-types`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n if (eventTypeClassName) {\n eventTypeClassName = escapeFilterValue(eventTypeClassName);\n endpoint.addQuery('filter[]', `class_name==${eventTypeClassName}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryGroups = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/groups`);\n\n endpoint.addQuery('order','title,code');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `title@@${input},code@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryCompanies = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/companies`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryRegistrationCompanies = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/registration-companies`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySponsors = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/sponsors`);\n\n endpoint.addQuery('expand','company,sponsorship,sponsorship.type')\n endpoint.addQuery('order','id')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `company_name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySponsorsWithBadgeScans = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/sponsors`);\n\n endpoint.addQuery('expand','company,sponsorship,sponsorship.type');\n endpoint.addQuery('fields','id,company.name,sponsorship.type.name');\n endpoint.addQuery('relations','none,company.none,sponsorship.type.none');\n endpoint.addQuery('filter[]','badge_scans_count>0');\n endpoint.addQuery('order','+company_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `company_name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryAccessLevels = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/access-level-types`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryOrganizations = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/organizations`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\nexport const getLanguageList = (callback, signal) => {\n return _fetchPublic(new URI(`/api/public/v1/languages`), callback, { signal });\n};\n\nexport const getCountryList = (callback, signal) => {\n return _fetchPublic(new URI(`/api/public/v1/countries`), callback, { signal });\n};\n\nlet geocoder;\n\nexport const geoCodeAddress = (address) => {\n\n if (!geocoder) geocoder = new google.maps.Geocoder();\n\n // return a Promise\n return new Promise(function(resolve,reject) {\n geocoder.geocode( { 'address': address}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n // resolve results upon a successful status\n resolve(results);\n } else {\n // reject status upon un-successful status\n reject(status);\n }\n });\n });\n};\n\nexport const geoCodeLatLng = (lat, lng) => {\n\n if (!geocoder) geocoder = new google.maps.Geocoder();\n\n let latlng = {lat: parseFloat(lat), lng: parseFloat(lng)};\n // return a Promise\n return new Promise(function(resolve,reject) {\n geocoder.geocode( { 'location': latlng}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n // resolve results upon a successful status\n resolve(results);\n } else {\n // reject status upon un-successful status\n reject(status);\n }\n });\n });\n};\n\n/**\n * @type {DebouncedFunc<(function(*, *=, *, *=, *=): Promise<void>)|*>}\n */\nexport const queryTicketTypes = _.debounce(async (summitId, filters = {}, callback, version = 'v1', per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/${version}/summits/${summitId}/ticket-types`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(filters.hasOwnProperty('name')) {\n const name = escapeFilterValue(filters.name);\n if(name && name != '')\n endpoint.addQuery('filter[]', `name@@${name}`);\n }\n\n if(filters.hasOwnProperty('audience')){\n const audience = escapeFilterValue(filters.audience);\n if(audience && audience != '')\n endpoint.addQuery('filter[]', `audience==${audience}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const querySponsoredProjects = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n\n const endpoint = URI(`/api/v1/sponsored-projects`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryPromocodes = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE, extraFilters = []) => {\n\n\n let endpoint = URI(`/api/v1/summits/${summitId}/promo-codes`);\n\n endpoint.addQuery('order','code')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `code@@${input}`);\n }\n\n //eg: filter = 'class_name==SummitRegistrationPromoCode'\n for (const filter of extraFilters) {\n endpoint.addQuery('filter[]', filter);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"i18n-react/dist/i18n-react\");","module.exports = require(\"idtoken-verifier\");","module.exports = require(\"lodash\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"superagent/lib/client\");","module.exports = require(\"sweetalert2\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/extends\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"prop-types\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@mui/material\");","/**\n * Copyright 2017 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport T from \"i18n-react/dist/i18n-react\";\nimport { TextField, Autocomplete, Typography } from \"@mui/material\";\nimport { queryRegistrationCompanies } from \"../../utils/query-actions\";\n\nconst CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, value, error, helperText, onBlur, placeholder, options2Show, disableShrink, ...rest }) => {\n const [inputValue, setInputValue] = React.useState(\"\");\n const [options, setOptions] = React.useState([]);\n\n const noCompanyMatchText = T.translate(\"request_modal.no_company_match\");\n const createAccessRequestText = (companyName) =>\n T.translate(\"request_modal.create_company_access_request\", {\n companyName: `\"${companyName}\"`\n });\n\n React.useEffect(() => {\n if (inputValue === \"\") {\n setOptions(value ? [value] : []);\n return undefined;\n }\n\n queryRegistrationCompanies(summitId, inputValue, (results) => {\n let newOptions = [];\n\n if (value) {\n newOptions = [value];\n }\n\n if (results) {\n newOptions = [...newOptions, ...results];\n }\n\n setOptions(newOptions);\n }, options2Show);\n return undefined;\n }, [value, inputValue, summitId, options2Show]);\n\n return (\n <Autocomplete\n sx={sx}\n id={id}\n name={name}\n options={options}\n autoComplete\n autoSelect\n freeSolo\n includeInputInList\n filterSelectedOptions\n value={value}\n onBlur={() => { if (onBlur) onBlur(name) }}\n getOptionLabel={(option) => {\n // Value selected with enter, right from the input\n if (typeof option === \"string\") {\n return option;\n }\n // Add \"xxx\" option created dynamically\n if (option.inputValue) {\n return option.inputValue;\n }\n // Regular option\n return option.name;\n }}\n onChange={(_, newValue) => {\n let tmpValue = newValue?.inputValue || newValue;\n // if new option is selected ...\n if (newValue && typeof newValue === \"object\" && newValue.inputValue) {\n tmpValue = {\n id: 0,\n name: newValue.inputValue\n };\n }\n // autoSelect commits the raw typed/autofilled string on blur; normalize to {id, name}.\n if (typeof tmpValue === \"string\" && tmpValue.trim()) {\n tmpValue = { id: 0, name: tmpValue.trim() };\n }\n setOptions(tmpValue ? [tmpValue, ...options] : options);\n let ev = {\n target: {\n id: name,\n value: tmpValue,\n type: \"companyinput\"\n }\n };\n onChange(ev);\n }}\n onInputChange={(_, newInputValue) => {\n setInputValue(newInputValue);\n }}\n filterOptions={(options, params) => {\n const { inputValue } = params;\n const trimmedInput = inputValue.trim();\n const filtered = [...options];\n\n // Suggest the creation of a new value\n const isExisting = options.some(\n (option) => {\n if (typeof option === \"string\") {\n return option.toLowerCase() === trimmedInput.toLowerCase();\n }\n\n return option.name?.toLowerCase() === trimmedInput.toLowerCase();\n }\n );\n\n if (trimmedInput !== \"\" && !isExisting) {\n filtered.push({\n inputValue: trimmedInput,\n name: noCompanyMatchText\n });\n }\n\n return filtered;\n }}\n renderInput={(params) => (\n <TextField\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...params}\n label={label}\n placeholder={placeholder}\n fullWidth\n required={isRequired}\n helperText={helperText}\n error={error}\n margin=\"normal\"\n InputLabelProps={disableShrink ? { shrink: false } : undefined}\n />\n )}\n renderOption={(props, option) => {\n const { key, ...optionProps } = props;\n const isCreateOption = Boolean(option.inputValue);\n\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <li\n key={key}\n {...optionProps}\n style={{\n ...(isCreateOption\n ? {\n borderTop: \"1px solid rgba(0,0,0,0.12)\",\n display: \"block\",\n padding: \"10px 15px\"\n }\n : {})\n }}\n >\n {isCreateOption ? (\n <>\n <Typography variant=\"body2\" sx={{ color: \"text.secondary\" }}>\n {noCompanyMatchText}\n </Typography>\n <Typography\n variant=\"body2\"\n sx={{ color: \"primary.main\", fontWeight: 500 }}\n >\n {createAccessRequestText(option.inputValue)}\n </Typography>\n </>\n ) : (\n <Typography\n variant=\"body2\"\n sx={{ color: \"text.secondary\", padding: \"5px 0\" }}\n >\n {option.name}\n </Typography>\n )}\n </li>\n );\n }}\n {...rest}\n />\n );\n};\n\nCompanyInputV2.defaultProps = {\n name: \"GENERAL\",\n label: \"Company\",\n options2Show: 20,\n disableShrink: false\n};\n\nCompanyInputV2.propTypes = {\n summitId: PropTypes.number.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n onChange: PropTypes.func.isRequired,\n isRequired: PropTypes.bool,\n name: PropTypes.string,\n error: PropTypes.bool,\n helperText: PropTypes.string,\n onBlur: PropTypes.func,\n options2Show: PropTypes.number,\n placeholder: PropTypes.string,\n label: PropTypes.string,\n disableShrink: PropTypes.bool\n};\n\nexport default CompanyInputV2;\n"],"names":["root","factory","exports","module","define","amd","this","AUTH_ERROR_MISSING_AUTH_INFO","AUTH_ERROR_MISSING_REFRESH_TOKEN","AUTH_ERROR_ACCESS_TOKEN_EXPIRED","AUTH_ERROR_LOCK_ACQUIRE_ERROR","AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR","AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR","require","Lock","SuperTokensLock","GET_TOKEN_SILENTLY_LOCK_KEY","RESPONSE_TYPE_CODE","AUTH_INFO","ID_TOKEN","processRefreshToken","async","flow","refreshToken","useOAuth2RefreshToken","clearAuthInfo","Error","response","fn","maxRetries","baseDelayMs","attempt","err","message","startsWith","delay","Math","pow","console","log","Promise","resolve","setTimeout","retryWithBackoff","refreshAccessToken","access_token","expires_in","refresh_token","id_token","storeAuthInfo","_getAccessToken","authInfo","getAuthInfo","accessToken","expiresIn","accessTokenUpdatedAt","getOAuth2Flow","now","moment","unix","timeElapsedSecs","getAccessToken","navigator","locks","request","lock","retryPromise","acquireLock","releaseLock","baseUrl","getOAuth2IDPBaseUrl","oauth2ClientId","getOAuth2ClientId","payload","encodeURI","controller","AbortController","timeoutId","abort","json","fetch","method","headers","body","JSON","stringify","signal","networkError","clearTimeout","ok","status","statusText","setSessionClearingState","parseError","new_refresh_token","idToken","formerAuthInfo","floor","Date","Cookies","secure","sameSite","putOnLocalStorage","res","getFromLocalStorage","parse","window","removeFromLocalStorage","OAUTH2_CLIENT_ID","OAUTH2_FLOW","Boolean","OAUTH2_USE_REFRESH_TOKEN","IDP_BASE_URL","URI","createAction","type","fetchErrorHandler","code","msg","Swal","T","fetchResponseHandler","escapeFilterValue","value","String","replace","crypto","msCrypto","buildAPIBaseUrl","relativeUrl","API_BASE_URL","key","localStorage","setItem","removeIt","val","getItem","removeItem","clearing_session_state","cb","maxNumberOfRetries","i","callDelay","_fetchPublic","endpoint","callback","options","toString","then","data","catch","_fetch","e","reject","addQuery","queryRegistrationCompanies","_","input","per_page","DEFAULT_PAGE_SIZE","summitId","excludedIds","length","join","onlyPublished","eventTypeClassName","filters","version","hasOwnProperty","name","audience","extraFilters","filter","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","obj","prop","prototype","call","r","Symbol","toStringTag","CompanyInputV2","_ref","isRequired","sx","onChange","id","label","error","helperText","onBlur","placeholder","options2Show","disableShrink","rest","_objectWithoutProperties","_excluded","inputValue","setInputValue","React","setOptions","noCompanyMatchText","results","newOptions","Autocomplete","_extends","autoComplete","autoSelect","freeSolo","includeInputInList","filterSelectedOptions","getOptionLabel","option","newValue","tmpValue","trim","target","onInputChange","newInputValue","filterOptions","params","trimmedInput","filtered","isExisting","some","_option$name","toLowerCase","push","renderInput","TextField","fullWidth","required","margin","InputLabelProps","shrink","renderOption","props","optionProps","_excluded2","isCreateOption","style","_objectSpread","borderTop","display","padding","Typography","variant","color","fontWeight","companyName","createAccessRequestText","defaultProps","propTypes","PropTypes"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"components/inputs/company-input-v2.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,wVCTF,MAAMC,EAA+B,+BAC/BC,EAAmC,mCACnCC,EAAkC,kCAClCC,EAAgC,gCAChCC,EAAyC,yCACzCC,EAAyC,wC,uFCLtD,MAAM,EAA+BC,QAAQ,qB,aCA7C,MAAM,EAA+BA,QAAQ,a,yDCqC7C,MAAMC,KAAO,IAAIC,KAIXC,4BAA8B,wCAKvBC,EAAqB,OAC5BC,EAAY,WAGZC,EAAW,UAsPXC,EAAsBC,MAAO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,GAAIlC,EACJ9C,MAAOgI,EACPxI,KAAM,iBAEZ,EAEN0I,cAAeA,CAACjG,EAAGkG,KACfxB,EAAcwB,EAAc,EAIhCC,cAAgBC,GAASA,EACzBC,YAAcC,GACVpF,IAAAA,cAACqF,EAAAA,UACGjB,IAAA,GACIgB,EAAM,CACVvC,MAAOA,EACPI,YAAaA,EACbqC,WAAS,EACTC,SAAU7C,EACVK,WAAYA,EACZD,MAAOA,EACP0C,OAAO,SACPC,gBAAiBtC,EAAgB,CAAEuC,QAAQ,QAAUnF,KAG7DoF,aAAcA,CAACC,EAAOjB,KAClB,MAAM,IAAEtH,GAAwBuI,EAAhBC,EAAWxC,IAAKuC,EAAKE,GAI/BjD,EAA0B,iBAAX8B,EAAsBA,EAASA,aAAM,EAANA,EAAQhF,KAC5D,OAEIK,IAAAA,cAAA,KAAAoE,IAAA,CAAI/G,IAAKA,GAASwI,GACd7F,IAAAA,cAAC+F,EAAAA,WAAU,CACPC,QAAQ,QACRrD,GAAI,CAAEsD,SAAU,MAAOC,MAAO,iBAAkBC,QAAS,UAExDtD,GAEJ,GAGTO,GACN,EAIVZ,EAAe4D,aAAe,CAC1BzG,KAAM,UACNkD,MAAO,UACPK,aAAc,GACdC,eAAe,GAGnBX,EAAe6D,UAAY,CACvBnH,SAAUoH,IAAAA,OAAiB5D,WAC3B7F,MAAOyJ,IAAAA,UAAoB,CAACA,IAAAA,OAAkBA,IAAAA,SAC9C1D,SAAU0D,IAAAA,KAAe5D,WACzBA,WAAY4D,IAAAA,KACZ3G,KAAM2G,IAAAA,OACNxD,MAAOwD,IAAAA,KACPvD,WAAYuD,IAAAA,OACZtD,OAAQsD,IAAAA,KACRpD,aAAcoD,IAAAA,OACdrD,YAAaqD,IAAAA,OACbzD,MAAOyD,IAAAA,OACPnD,cAAemD,IAAAA,MAGnB,U","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/./src/components/security/constants.js","webpack://openstack-uicore-foundation/external commonjs \"browser-tabs-lock\"","webpack://openstack-uicore-foundation/external commonjs \"js-cookie\"","webpack://openstack-uicore-foundation/./src/components/security/methods.js","webpack://openstack-uicore-foundation/./src/utils/actions.js","webpack://openstack-uicore-foundation/external commonjs \"spark-md5\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/sha256\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/enc-base64url\"","webpack://openstack-uicore-foundation/external commonjs \"crypto-js/enc-hex\"","webpack://openstack-uicore-foundation/./src/utils/crypto.js","webpack://openstack-uicore-foundation/./src/utils/methods.js","webpack://openstack-uicore-foundation/./src/utils/query-actions.js","webpack://openstack-uicore-foundation/./src/utils/use-event-callback.js","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/defineProperty\"","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/objectWithoutProperties\"","webpack://openstack-uicore-foundation/external commonjs \"i18n-react/dist/i18n-react\"","webpack://openstack-uicore-foundation/external commonjs \"idtoken-verifier\"","webpack://openstack-uicore-foundation/external commonjs \"lodash\"","webpack://openstack-uicore-foundation/external commonjs \"moment-timezone\"","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/external commonjs \"superagent/lib/client\"","webpack://openstack-uicore-foundation/external commonjs \"sweetalert2\"","webpack://openstack-uicore-foundation/external commonjs \"urijs\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/external commonjs \"@babel/runtime/helpers/extends\"","webpack://openstack-uicore-foundation/external commonjs \"prop-types\"","webpack://openstack-uicore-foundation/external commonjs \"@mui/material\"","webpack://openstack-uicore-foundation/./src/components/inputs/company-input-v2.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","export const AUTH_ERROR_MISSING_AUTH_INFO = 'AUTH_ERROR_MISSING_AUTH_INFO';\nexport const AUTH_ERROR_MISSING_REFRESH_TOKEN = 'AUTH_ERROR_MISSING_REFRESH_TOKEN';\nexport const AUTH_ERROR_ACCESS_TOKEN_EXPIRED = 'AUTH_ERROR_ACCESS_TOKEN_EXPIRED';\nexport const AUTH_ERROR_LOCK_ACQUIRE_ERROR = 'AUTH_ERROR_LOCK_ACQUIRE_ERROR'\nexport const AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR = 'AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR';\nexport const AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR = 'AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR';\nexport const AUTH_ERROR_ID_TOKEN_INVALID = 'AUTH_ERROR_ID_TOKEN_INVALID';\nexport const AUTH_ERROR_MISSING_OTP_PARAM = 'AUTH_ERROR_MISSING_OTP_PARAM';\nexport const AUTH_ERROR_MISSING_PKCE_PARAM = 'AUTH_ERROR_MISSING_PKCE_PARAM';\nexport const AUTH_ERROR_MISSING_NONCE_PARAM = 'AUTH_ERROR_MISSING_NONCE_PARAM';\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"browser-tabs-lock\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"js-cookie\");","import {\n base64URLEncode,\n getAuthCallback,\n getCurrentLocation,\n getFromLocalStorage,\n removeFromLocalStorage,\n getOrigin,\n putOnLocalStorage,\n retryPromise,\n setSessionClearingState,\n} from \"../../utils/methods\";\nimport moment from \"moment-timezone\";\nimport request from 'superagent/lib/client';\nimport SuperTokensLock from 'browser-tabs-lock';\nimport Cookies from 'js-cookie'\nlet http = request;\nimport URI from \"urijs\";\nimport IdTokenVerifier from \"idtoken-verifier\";\nimport {SET_LOGGED_USER} from \"./actions\";\nimport {getRandomBytes, getSHA256} from \"../../utils/crypto\";\n\nimport {\n AUTH_ERROR_ACCESS_TOKEN_EXPIRED,\n AUTH_ERROR_MISSING_AUTH_INFO,\n AUTH_ERROR_MISSING_REFRESH_TOKEN,\n AUTH_ERROR_LOCK_ACQUIRE_ERROR,\n AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR,\n AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR,\n AUTH_ERROR_ID_TOKEN_INVALID,\n AUTH_ERROR_MISSING_OTP_PARAM,\n AUTH_ERROR_MISSING_PKCE_PARAM,\n AUTH_ERROR_MISSING_NONCE_PARAM,\n} from \"./constants\";\n\n/**\n * @ignore\n */\nconst Lock = new SuperTokensLock();\n/**\n * @ignore\n */\nconst GET_TOKEN_SILENTLY_LOCK_KEY = 'openstackuicore.lock.getTokenSilently';\nconst GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT = 6000;\nconst NONCE_LEN = 16;\nexport const ACCESS_TOKEN_SKEW_TIME = 60;\nexport const RESPONSE_TYPE_IMPLICIT = \"token id_token\";\nexport const RESPONSE_TYPE_CODE = 'code';\nconst AUTH_INFO = 'authInfo';\nconst NONCE = 'nonce';\nconst PKCE = 'pkce';\nconst ID_TOKEN = 'idToken';\nconst BACK_ULR_PARAM_NAME = 'BackUrl';\n\n\n/**\n *\n * @param backUrl\n * @param prompt\n * @param tokenIdHint\n * @param provider\n * @param loginHint\n * @param otpLoginHint\n * @param tenant\n * @param backUrlParamName\n * @returns {*}\n */\nexport const getAuthUrl = (\n backUrl = null,\n prompt = null,\n tokenIdHint = null,\n provider = null,\n loginHint = null,\n otpLoginHint = null,\n tenant = null,\n backUrlParamName = BACK_ULR_PARAM_NAME\n ) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let redirectUri = getAuthCallback();\n let baseUrl = getOAuth2IDPBaseUrl();\n let scopes = getOAuth2Scopes();\n let flow = getOAuth2Flow();\n\n if (backUrl != null)\n redirectUri += `?${backUrlParamName}=${encodeURIComponent(backUrl)}`;\n\n let nonce = createNonce(NONCE_LEN);\n\n // store nonce to check it later\n putOnLocalStorage(NONCE, nonce);\n let url = URI(`${baseUrl}/oauth2/auth`);\n\n let query = {\n \"response_type\": encodeURI(flow),\n \"scope\": encodeURI(scopes),\n \"nonce\": nonce,\n \"response_mode\": 'fragment',\n \"client_id\": encodeURI(oauth2ClientId),\n \"redirect_uri\": encodeURI(redirectUri)\n };\n\n if (flow === RESPONSE_TYPE_CODE) {\n const pkce = createPKCECodes()\n putOnLocalStorage(PKCE, JSON.stringify(pkce));\n query['code_challenge'] = pkce.codeChallenge;\n query['code_challenge_method'] = 'S256';\n query['approval_prompt'] = 'force';\n }\n\n if (prompt) {\n query['prompt'] = prompt;\n }\n\n if (scopes && scopes.includes('offline_access')) {\n // then we need to force prompt=consent bc we are requesting an offline access\n // and we need to let the user know\n query['prompt'] = 'consent';\n }\n\n if (tokenIdHint) {\n query['id_token_hint'] = tokenIdHint;\n }\n\n if (provider) {\n query['provider'] = provider;\n }\n\n if (otpLoginHint) {\n query['otp_login_hint'] = otpLoginHint;\n }\n\n if (loginHint) {\n query['login_hint'] = encodeURI(loginHint);\n }\n\n if (tenant) {\n query['tenant'] = tenant;\n }\n\n url = url.query(query);\n //console.log(`getAuthUrl ${url.toString()}`);\n return url;\n}\n\n/**\n * @param idToken\n * @returns {*}\n */\nexport const getLogoutUrl = (idToken = null) => {\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n let url = URI(`${baseUrl}/oauth2/end-session`);\n let state = createNonce(NONCE_LEN);\n let postLogOutUri = `${getOrigin()}/auth/logout`;\n // store nonce to check it later\n putOnLocalStorage('post_logout_state', state);\n /**\n * post_logout_redirect_uri should be listed on oauth2 client settings\n * on IDP\n * \"Security Settings\" Tab -> Logout Options -> Post Logout Uris\n */\n const queryParams = {\n \"post_logout_redirect_uri\": encodeURI(postLogOutUri),\n \"client_id\": encodeURI(oauth2ClientId),\n \"state\": state,\n }\n\n if (idToken)\n queryParams.id_token_hint = idToken;\n\n return url.query(queryParams);\n}\n\nconst createNonce = (len) => {\n let possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n let nonce = '';\n for (let i = 0; i < len; i++) {\n nonce += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return nonce;\n}\n\n/**\n *\n * @param backUrl\n * @param provider\n * @param prompt\n * @param loginHint\n * @param otpLoginHint\n * @param tenant\n */\nexport const doLogin = (\n backUrl = null,\n provider = null,\n prompt = null,\n loginHint = null,\n otpLoginHint = null,\n tenant = null\n) => {\n let url = getAuthUrl(backUrl, prompt, null, provider, loginHint, otpLoginHint, tenant);\n let location = getCurrentLocation()\n location.replace(url.toString());\n}\n\n/**\n *\n * @param backUrl\n * @param loginHint\n * @param otpLoginHint\n */\nexport const doLoginBasicLogin = (backUrl = null, loginHint = null, otpLoginHint = null) => {\n doLogin(backUrl, null, null, loginHint, otpLoginHint);\n}\n\nconst createPKCECodes = () => {\n const codeVerifier = base64URLEncode(getRandomBytes(64))\n const codeChallenge = getSHA256(codeVerifier, 'Base64url')\n const createdAt = new Date()\n const codePair = {\n codeVerifier,\n codeChallenge,\n createdAt\n }\n return codePair\n}\n\n/**\n\n * @param code\n * @param backUrl\n * @param backUrlParamName\n * @returns {Promise<{access_token: *, refresh_token: *, id_token: *, expires_in: *, error: *, error_description: *}>}\n */\nexport const emitAccessToken = async (code, backUrl = null, backUrlParamName = BACK_ULR_PARAM_NAME) => {\n\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n let redirectUri = getAuthCallback();\n let pkce = JSON.parse(getFromLocalStorage(PKCE, true));\n\n if (!pkce)\n throw Error(AUTH_ERROR_MISSING_PKCE_PARAM);\n\n if (backUrl != null)\n redirectUri += `?${backUrlParamName}=${encodeURIComponent(backUrl)}`;\n\n const payload = {\n 'code': code,\n 'grant_type': 'authorization_code',\n 'code_verifier': pkce.codeVerifier,\n \"client_id\": encodeURI(oauth2ClientId),\n \"redirect_uri\": encodeURI(redirectUri)\n };\n\n try {\n //const response = await http.post(`${baseUrl}/oauth2/token`, payload);\n //const {body: {access_token, refresh_token, id_token, expires_in}} = response;\n const response = await fetch(`${baseUrl}/oauth2/token`, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload)\n }).catch(function (error) {\n console.log('Request failed:', error.message);\n });\n const json = await response.json();\n let {access_token, refresh_token, id_token, expires_in, error, error_description} = json;\n return {access_token, refresh_token, id_token, expires_in, error, error_description}\n } catch (err) {\n console.log(err);\n }\n};\n\nexport const MAX_RETRIES = 5;\nexport const BACKOFF_BASE_MS = 1000;\nexport const REFRESH_TOKEN_FETCH_TIMEOUT_MS = 10000;\n\nexport const retryWithBackoff = async (fn, maxRetries = MAX_RETRIES, baseDelayMs = BACKOFF_BASE_MS) => {\n for (let attempt = 0; attempt < maxRetries; attempt++) {\n try {\n return await fn();\n } catch (err) {\n // only retry transient network/server errors — everything else fails fast\n const isRetryable = err.message && err.message.startsWith(AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR);\n if (!isRetryable || attempt === maxRetries - 1) {\n throw err;\n }\n const delay = baseDelayMs * Math.pow(2, attempt);\n console.log(`retryWithBackoff retry ${attempt + 1}/${maxRetries} in ${delay}ms`);\n await new Promise(resolve => setTimeout(resolve, delay));\n }\n }\n};\n\nconst processRefreshToken = async (flow, refreshToken) => {\n\n if (flow === RESPONSE_TYPE_CODE && useOAuth2RefreshToken()) {\n if (!refreshToken) {\n clearAuthInfo();\n throw Error(AUTH_ERROR_MISSING_REFRESH_TOKEN);\n }\n\n let response = await retryWithBackoff(() => refreshAccessToken(refreshToken));\n let {access_token, expires_in, refresh_token, id_token} = response;\n if (typeof refresh_token === 'undefined') {\n refresh_token = null; // not using rotate policy\n }\n storeAuthInfo(access_token, expires_in, refresh_token, id_token);\n return access_token;\n }\n clearAuthInfo();\n throw Error(AUTH_ERROR_ACCESS_TOKEN_EXPIRED);\n}\n\n/**\n * @returns {Promise<*>}\n * @private\n */\nconst _getAccessToken = async () => {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken`);\n let authInfo = getAuthInfo();\n\n if (!authInfo) {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken AUTH_ERROR_MISSING_AUTH_INFO`);\n throw Error(AUTH_ERROR_MISSING_AUTH_INFO);\n }\n\n let {accessToken, expiresIn, accessTokenUpdatedAt, refreshToken} = authInfo;\n let flow = getOAuth2Flow();\n // check lifetime\n const now = moment().unix();\n let timeElapsedSecs = (now - accessTokenUpdatedAt);\n\n expiresIn = (expiresIn - ACCESS_TOKEN_SKEW_TIME);\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken now ${now} accessTokenUpdatedAt ${accessTokenUpdatedAt} expiresIn ${expiresIn} timeElapsedSecs ${timeElapsedSecs}`)\n if (timeElapsedSecs >= expiresIn || accessToken == null) {\n console.log(`openstack-uicore-foundation::Security::methods::_getAccessToken access token expired, refreshing it ...`);\n accessToken = await processRefreshToken(flow, refreshToken);\n }\n return accessToken;\n}\n\n/**\n * @returns {Promise<*|undefined>}\n */\nexport const getAccessToken = async () => {\n if (typeof navigator !== 'undefined' && navigator.locks) {\n return await navigator.locks.request(GET_TOKEN_SILENTLY_LOCK_KEY, async lock => {\n console.log(`openstack-uicore-foundation::Security::methods::getAccessToken web lock api`, lock);\n return await _getAccessToken();\n });\n } else {\n if (\n await retryPromise(\n () => Lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT),\n 10\n )\n ) {\n try {\n return await _getAccessToken();\n } finally {\n await Lock.releaseLock(GET_TOKEN_SILENTLY_LOCK_KEY);\n }\n } else {\n // error on locking\n throw Error(AUTH_ERROR_LOCK_ACQUIRE_ERROR);\n }\n }\n}\n\n/**\n * @private\n */\nconst _clearAccessToken = () => {\n console.log(`openstack-uicore-foundation::Security::methods::_clearAccessToken`);\n\n let authInfo = getAuthInfo();\n\n if (!authInfo) {\n console.log(`openstack-uicore-foundation::Security::methods::_clearAccessToken AUTH_ERROR_MISSING_AUTH_INFO`);\n throw Error(AUTH_ERROR_MISSING_AUTH_INFO);\n }\n\n let {accessToken, expiresIn, accessTokenUpdatedAt, refreshToken} = authInfo;\n\n storeAuthInfo(null, 0, refreshToken)\n}\n\nexport const clearAccessToken = async () => {\n // see https://developer.mozilla.org/en-US/docs/Web/API/Web_Locks_API\n if (typeof navigator !== 'undefined' && navigator.locks) {\n await navigator.locks.request(GET_TOKEN_SILENTLY_LOCK_KEY, async lock => {\n console.log(`openstack-uicore-foundation::Security::methods::clearAccessToken web lock api`, lock);\n _clearAccessToken();\n });\n } else {\n if (\n await retryPromise(\n () => Lock.acquireLock(GET_TOKEN_SILENTLY_LOCK_KEY, GET_TOKEN_SILENTLY_LOCK_KEY_TIMEOUT),\n 10\n )\n ) {\n try {\n _clearAccessToken();\n } finally {\n await Lock.releaseLock(GET_TOKEN_SILENTLY_LOCK_KEY);\n }\n } else {\n // error on locking\n throw Error(AUTH_ERROR_LOCK_ACQUIRE_ERROR);\n }\n }\n}\n\n\nexport const refreshAccessToken = async (refresh_token) => {\n\n let baseUrl = getOAuth2IDPBaseUrl();\n let oauth2ClientId = getOAuth2ClientId();\n\n const payload = {\n 'grant_type': 'refresh_token',\n \"client_id\": encodeURI(oauth2ClientId),\n \"refresh_token\": refresh_token\n };\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), REFRESH_TOKEN_FETCH_TIMEOUT_MS);\n\n let response;\n try {\n response = await fetch(`${baseUrl}/oauth2/token`, {\n method: 'POST',\n headers: {\n 'Accept': 'application/json',\n 'Content-Type': 'application/json'\n },\n body: JSON.stringify(payload),\n signal: controller.signal\n });\n } catch (networkError) {\n // fetch rejects on network failures (DNS, timeout, no connectivity, abort)\n console.log('refreshAccessToken network error:', networkError.message);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: ${networkError.message}`);\n } finally {\n clearTimeout(timeoutId);\n }\n\n if (!response.ok) {\n console.log(`refreshAccessToken server error: ${response.status} - ${response.statusText}`);\n if (response.status >= 500 || response.status === 408 || response.status === 429) {\n // transient error (server error, request timeout, rate limit) — should be retried\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: ${response.status} - ${response.statusText}`);\n }\n // token is genuinely revoked — this is a real auth error\n setSessionClearingState(true);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: ${response.status} - ${response.statusText}`);\n }\n\n let json;\n try {\n json = await response.json();\n } catch (parseError) {\n // IDP returned non-JSON (HTML error page, empty body, etc.) — treat as transient\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR}: invalid JSON response from IDP`);\n }\n let {access_token, refresh_token: new_refresh_token, expires_in, id_token} = json;\n // Defensively ensure we never propagate an undefined access token.\n if (!access_token) {\n setSessionClearingState(true);\n throw Error(`${AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR}: missing access_token in refresh response`);\n }\n return {access_token, refresh_token: new_refresh_token, expires_in, id_token}\n}\n\nexport const storeAuthInfo = (accessToken, expiresIn, refreshToken = null, idToken = null) => {\n\n let formerAuthInfo = getAuthInfo();\n\n let authInfo = {\n accessToken: accessToken,\n expiresIn: expiresIn,\n accessTokenUpdatedAt: Math.floor(Date.now() / 1000),\n };\n\n if (refreshToken == null && formerAuthInfo) {\n refreshToken = formerAuthInfo.refreshToken;\n }\n\n if (idToken == null && formerAuthInfo) {\n idToken = formerAuthInfo.idToken;\n }\n\n if (refreshToken) {\n authInfo['refreshToken'] = refreshToken;\n }\n\n if (idToken) {\n authInfo[ID_TOKEN] = idToken;\n Cookies.set(ID_TOKEN, idToken, {secure: true, sameSite: 'Lax'});\n } else {\n Cookies.remove(ID_TOKEN);\n }\n\n putOnLocalStorage(AUTH_INFO, JSON.stringify(authInfo));\n}\n\nexport const getAuthInfo = () => {\n try {\n let res = getFromLocalStorage(AUTH_INFO, false)\n if (!res) return null;\n return JSON.parse(res);\n } catch (err) {\n return null;\n }\n}\n\nexport const clearAuthInfo = () => {\n if (typeof window !== 'undefined') {\n removeFromLocalStorage(AUTH_INFO);\n Cookies.remove(ID_TOKEN);\n }\n};\n\nexport const getIdToken = () => {\n if (typeof window !== 'undefined') {\n const authInfo = getAuthInfo();\n if (authInfo) {\n return authInfo.idToken;\n }\n return null;\n }\n return null;\n};\n\nexport const getOAuth2ClientId = () => {\n if (typeof window !== 'undefined') {\n return window.OAUTH2_CLIENT_ID;\n }\n return null;\n};\n\nexport const getOAuth2Flow = () => {\n if (typeof window !== 'undefined') {\n return window.OAUTH2_FLOW || \"token id_token\";\n }\n return \"token id_token\";\n}\n\nexport const useOAuth2RefreshToken = () => {\n if (typeof window !== 'undefined') {\n return new Boolean(window.OAUTH2_USE_REFRESH_TOKEN || true);\n }\n return true;\n}\n\nexport const getOAuth2IDPBaseUrl = () => {\n if (typeof window !== 'undefined') {\n return window.IDP_BASE_URL;\n }\n return null;\n};\n\nexport const getOAuth2Scopes = () => {\n if (typeof window !== 'undefined') {\n return window.SCOPES;\n }\n return null;\n};\n\nexport const initLogOut = () => {\n let location = getCurrentLocation();\n location.replace(getLogoutUrl(getIdToken()).toString());\n}\n\nexport const validateIdToken = (idToken, issuer, audience) => {\n\n let verifier = new IdTokenVerifier({\n issuer: issuer,\n audience: audience\n });\n\n let storedNonce = getFromLocalStorage(NONCE, true);\n if (!storedNonce)\n throw Error(AUTH_ERROR_MISSING_NONCE_PARAM);\n\n let jwt = verifier.decode(idToken);\n let alg = jwt.header.alg;\n let kid = jwt.header.kid;\n let aud = jwt.payload.aud;\n let iss = jwt.payload.iss;\n let exp = jwt.payload.exp;\n let nbf = jwt.payload.nbf;\n let tnonce = jwt.payload.nonce || null;\n\n return tnonce == storedNonce && aud == audience && iss == issuer;\n}\n\nexport const passwordlessStart = (params) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let scopes = getOAuth2Scopes();\n let nonce = createNonce(NONCE_LEN);\n // store nonce to check it later\n putOnLocalStorage(NONCE, nonce);\n let baseUrl = getOAuth2IDPBaseUrl();\n let url = URI(`${baseUrl}/oauth2/auth`);\n\n let payload = {\n \"response_type\": \"otp\",\n \"scope\": encodeURI(scopes),\n \"nonce\": nonce,\n \"client_id\": encodeURI(oauth2ClientId),\n \"connection\": params.connection || \"email\",\n \"send\": params.send || \"code\",\n };\n\n if (params.hasOwnProperty('email')) {\n payload[\"email\"] = encodeURIComponent(params.email);\n }\n\n if (params.hasOwnProperty('phone_number')) {\n payload[\"phone_number\"] = encodeURIComponent(params.phone_number);\n }\n\n if (params.hasOwnProperty('redirect_uri')) {\n payload[\"redirect_uri\"] = encodeURIComponent(params.redirect_uri);\n }\n\n let req = http.post(url.toString());\n\n return req.send(payload).then((res) => {\n let json = res.body;\n return Promise.resolve({response: json});\n }).catch((err) => {\n return Promise.reject(err);\n });\n\n}\n\nexport const passwordlessLogin = (params) => (dispatch) => {\n\n let oauth2ClientId = getOAuth2ClientId();\n let scopes = getOAuth2Scopes();\n let baseUrl = getOAuth2IDPBaseUrl();\n let url = URI(`${baseUrl}/oauth2/token`);\n\n if (!params.hasOwnProperty(\"otp\")) {\n throw Error(AUTH_ERROR_MISSING_OTP_PARAM);\n }\n\n let payload = {\n \"grant_type\": \"passwordless\",\n \"connection\": params.connection || \"email\",\n \"scope\": encodeURI(scopes),\n \"client_id\": encodeURI(oauth2ClientId),\n \"otp\": params.otp\n };\n\n if (params.hasOwnProperty('email')) {\n payload[\"email\"] = encodeURIComponent(params.email);\n }\n\n if (params.hasOwnProperty('phone_number')) {\n payload[\"phone_number\"] = encodeURIComponent(params.phone_number);\n }\n\n let req = http.post(url.toString());\n\n return req.send(payload).then((res) => {\n try {\n // now we got token\n let json = res.body;\n let {access_token, expires_in, refresh_token, id_token} = json;\n\n if (typeof refresh_token === 'undefined') {\n refresh_token = null; // not using rotate policy\n }\n\n if (typeof id_token === 'undefined') {\n id_token = null; // not using rotate policy\n }\n\n // verify id token\n\n if (id_token) {\n if (!validateIdToken(id_token, baseUrl, oauth2ClientId)) {\n throw Error(AUTH_ERROR_ID_TOKEN_INVALID);\n }\n }\n\n storeAuthInfo(access_token, expires_in, refresh_token, id_token);\n\n if (dispatch) {\n dispatch({\n type: SET_LOGGED_USER,\n payload: {sessionState: null}\n });\n }\n\n return Promise.resolve({response: json});\n } catch (e) {\n console.log(e);\n return Promise.reject(e);\n }\n }).catch((err) => {\n return Promise.reject(err);\n });\n}\n\nexport const isIdTokenAlive = (nowEpoch = null) => () => {\n\n if (!nowEpoch) {\n nowEpoch = Math.floor(Date.now() / 1000);\n }\n\n const idToken = getIdToken();\n if (!idToken)\n throw Error('Id Token not set.');\n\n const issuer = getOAuth2IDPBaseUrl();\n const audience = getOAuth2ClientId();\n\n let verifier = new IdTokenVerifier({\n issuer: issuer,\n audience: audience\n });\n\n const jwt = verifier.decode(idToken);\n const exp = jwt.payload.exp;\n\n // check life time\n return exp - (nowEpoch + ACCESS_TOKEN_SKEW_TIME) > 0;\n}\n","/**\n * Copyright 2017 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific flanguage governing permissions and\n * limitations under the License.\n **/\n\nimport request from 'superagent/lib/client';\nimport URI from \"urijs\";\nURI.escapeQuerySpace = false;\n\nlet http = request;\nimport Swal from 'sweetalert2';\nimport T from \"i18n-react/dist/i18n-react\";\nimport { isClearingSessionState, setSessionClearingState, getCurrentPathName } from './methods';\nimport { CLEAR_SESSION_STATE } from '../components/security/actions';\nimport { doLogin, initLogOut } from '../components/security/methods';\n\nexport const GENERIC_ERROR = \"Yikes. Something seems to be broken. Our web team has been notified, and we apologize for the inconvenience.\";\nexport const RESET_LOADING = 'RESET_LOADING';\nexport const START_LOADING = 'START_LOADING';\nexport const STOP_LOADING = 'STOP_LOADING';\nexport const VALIDATE = 'VALIDATE';\nexport const CLEAR_MESSAGE = 'CLEAR_MESSAGE';\nexport const SHOW_MESSAGE = 'SHOW_MESSAGE';\n\nexport const createAction = type => payload => ({\n type,\n payload\n});\n\nexport const resetLoading = createAction(RESET_LOADING);\nexport const startLoading = createAction(START_LOADING);\nexport const stopLoading = createAction(STOP_LOADING);\n\nconst xhrs = {};\nconst etagCache = {};\n\nconst cancel = (key) => {\n if(xhrs[key]) {\n xhrs[key].abort();\n console.log(`aborted request ${key}`);\n delete xhrs[key];\n }\n}\n\nconst schedule = (key, req) => {\n // console.log(`scheduling ${key}`);\n xhrs[key] = req;\n};\n\nconst isObjectEmpty = (obj) => {\n return Object.keys(obj).length === 0 && obj.constructor === Object ;\n}\n\nconst buildNotifyHandlerPayload = (httpCode, title, content, type) => ({ httpCode, title, html: content, type });\nconst buildNotifyHandlerErrorPayload = (httpCode, title, content) => buildNotifyHandlerPayload(httpCode, title, content, \"error\");\nconst buildNotifyHandlerWarningPayload = (httpCode, title, content) => buildNotifyHandlerPayload(httpCode, title, content, \"warning\");\n\nconst initLogin = () => (dispatch) => {\n const currentLocation = getCurrentPathName();\n const clearingSessionState = isClearingSessionState();\n dispatch({\n type: CLEAR_SESSION_STATE,\n payload: {}\n });\n if (!clearingSessionState) {\n setSessionClearingState(true);\n console.log(\"authErrorHandler 401 - re login\");\n doLogin(currentLocation);\n }\n};\n\nconst normalizeFormDataPayload = (req, formData) => {\n if(!isObjectEmpty(formData)) {\n Object.keys(formData).forEach(function (key) {\n let value = formData[key];\n if (Array.isArray(value)) {\n value.forEach(item => {\n req.field(`${key}[]`, item);\n });\n } else {\n req.field(key, value);\n }\n });\n }\n};\n\nexport const authErrorHandler = (\n err,\n res,\n notifyErrorHandler = showMessage\n) => (dispatch) => {\n\n const code = err.status;\n let msg = \"\";\n let payload, callback;\n\n dispatch(stopLoading());\n\n switch (code) {\n case 401:\n if (notifyErrorHandler !== showMessage) {\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.user_not_auth\"));\n callback = () => dispatch(initLogin());\n } else {\n dispatch(initLogin());\n }\n break;\n case 403:\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.user_not_authz\"));\n callback = initLogOut;\n break;\n case 404:\n msg = err.response.body?.message || err.response.error?.message || err.message;\n if (err.response.body?.errors?.length) {\n msg += `<br>${err.response.body.errors.join(\"<br>\")}`;\n }\n payload = buildNotifyHandlerWarningPayload(code, \"Not Found\", msg);\n break;\n case 412:\n for (const [key, value] of Object.entries(err.response.body.errors)) {\n msg += isNaN(key) ? `${key}: ` : \"\";\n msg += `${value}<br>`;\n }\n dispatch({\n type: VALIDATE,\n payload: { errors: err.response.body.errors }\n });\n payload = buildNotifyHandlerWarningPayload(code, \"Validation error\", msg);\n break;\n default:\n payload = buildNotifyHandlerErrorPayload(code, \"ERROR\", T.translate(\"errors.server_error\"));\n }\n\n if (payload)\n dispatch(notifyErrorHandler(payload, callback));\n}\n\nexport const getRequest =(\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {},\n useEtag = false\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n let key = url.toString();\n\n if(!isObjectEmpty(params)) {\n // remove the access token\n const { access_token: _, ...newParams} = params;\n // and generate new key\n key = url.query(newParams).toString();\n url = url.query(params);\n }\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n cancel(key);\n\n return new Promise((resolve, reject) => {\n let req = http.get(url.toString());\n if(useEtag && etagCache.hasOwnProperty(key)){\n const { etag } = etagCache[key];\n if(etag){\n req.set('If-None-Match', etag)\n }\n }\n\n req.timeout({\n response: 60000,\n deadline: 60000,\n })\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject, key, useEtag))\n\n schedule(key, req);\n });\n};\n\nexport const putRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => ( dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n if(payload == null)\n payload = {};\n http.put(url.toString())\n .send(payload)\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject))\n });\n};\n\nexport const deleteRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params) => (dispatch, state) => {\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n if(payload == null)\n payload = {};\n\n http.delete(url)\n .send(payload)\n .end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const postRequest = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n payload,\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n let request = http.post(url);\n\n if(payload != null)\n request.send(payload);\n else // to be a simple CORS request\n request.set('Content-Type', 'text/plain');\n\n request.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const postFile = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n file,\n fileMetadata = {},\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n const req = http.post(url)\n .attach('file', file);\n\n normalizeFormDataPayload(req, fileMetadata);\n\n req.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const putFile = (\n requestActionCreator,\n receiveActionCreator,\n endpoint,\n file = null,\n fileMetadata = {},\n errorHandler = defaultErrorHandler,\n requestActionPayload = {}\n) => (params = {}) => (dispatch, state) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n if(requestActionCreator && typeof requestActionCreator === 'function')\n dispatch(requestActionCreator(requestActionPayload));\n\n return new Promise((resolve, reject) => {\n\n const req = http.put(url);\n\n if(file != null){\n req.attach('file', file);\n }\n\n normalizeFormDataPayload(req, fileMetadata)\n\n req.end(responseHandler(dispatch, state, receiveActionCreator, errorHandler, resolve, reject));\n });\n};\n\nexport const defaultErrorHandler = (err, res) => (dispatch) => {\n let body = res.body;\n let text = '';\n if(body instanceof Object){\n if(body.hasOwnProperty('message'))\n text = body.message;\n }\n Swal.fire(res.statusText, text, \"error\");\n}\n\nconst byLowerCase = toFind => value => toLowerCase(value) === toFind;\nconst toLowerCase = value => value.toLowerCase();\nconst getKeys = headers => Object.keys(headers);\n\nexport const getHeaderCaseInsensitive = (headerName, headers = {}) => {\n const key = getKeys(headers).find(byLowerCase(headerName));\n return key ? headers[key] : undefined;\n};\n\nexport const responseHandler = ( dispatch, state, receiveActionCreator, errorHandler, resolve, reject, key = null, useEtag= false ) =>\n\n (err, res) => {\n\n if (err || !res.ok) {\n let code = err.status;\n\n if(code === 304 && etagCache.hasOwnProperty(key) && useEtag){\n const { body } = etagCache[key];\n\n if(typeof receiveActionCreator === 'function') {\n dispatch(receiveActionCreator({response: body}));\n return resolve({response: body});\n }\n\n dispatch(receiveActionCreator);\n return resolve({response: body});\n }\n if(errorHandler) {\n errorHandler(err, res)(dispatch, state);\n }\n return reject({ err, res, dispatch, state })\n }\n\n let json = res.body;\n\n if(useEtag) {\n const responseETAG = getHeaderCaseInsensitive('etag', res.headers);\n if (responseETAG) {\n etagCache[key] = { etag: responseETAG, body: json};\n }\n }\n\n if(typeof receiveActionCreator === 'function') {\n dispatch(receiveActionCreator({response: json}));\n return resolve({response: json});\n }\n dispatch(receiveActionCreator);\n return resolve({response: json});\n}\n\n\nexport const fetchErrorHandler = (response) => {\n let code = response.status;\n let msg = response.statusText;\n\n switch (code) {\n case 403:\n Swal.fire(\"ERROR\", T.translate(\"errors.user_not_authz\"), \"warning\");\n break;\n case 401:\n Swal.fire(\"ERROR\", T.translate(\"errors.session_expired\"), \"error\");\n break;\n case 412:\n Swal.fire(\"ERROR\", msg, \"warning\");\n case 500:\n Swal.fire(\"ERROR\", T.translate(\"errors.server_error\"), \"error\");\n }\n}\n\nexport const fetchResponseHandler = (response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.json();\n }\n}\n\nexport const showMessage = (settings, callback = null) => (dispatch) => {\n dispatch(stopLoading());\n Swal.fire(settings).then((result) => {\n if (result.value && typeof callback === 'function') {\n callback();\n }\n });\n}\n\nexport const showSuccessMessage = (html) => (dispatch) => {\n dispatch(stopLoading());\n Swal.fire({\n title: T.translate(\"general.done\"),\n html: html,\n type: 'success'\n });\n}\n\nexport const downloadFileByContent = (filename, content, mime) => {\n let link = document.createElement('a');\n link.textContent = 'download';\n link.download = filename;\n link.href = `data:${mime},${encodeURIComponent(content)}`\n document.body.appendChild(link); // Required for FF\n link.click();\n document.body.removeChild(link);\n}\n\nexport const getCSV = (endpoint, params, filename, header = null) => (dispatch) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n dispatch(startLoading());\n\n return fetch(url.toString())\n .then((response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.text();\n }\n })\n .then((csv) => {\n dispatch(stopLoading());\n\n if (header) {\n csv = header + '\\r\\r' + csv;\n }\n downloadFileByContent(filename, csv, 'text/csv;charset=utf-8');\n })\n .catch(fetchErrorHandler);\n};\n\nexport const getRawCSV = (endpoint, params, header = null) => {\n\n let url = URI(endpoint);\n\n if(!isObjectEmpty(params))\n url = url.query(params);\n\n return fetch(url.toString())\n .then((response) => {\n if (!response.ok) {\n throw response;\n } else {\n return response.text();\n }\n })\n .then((csv) => {\n if (header) {\n csv = header + '\\r\\r' + csv;\n }\n\n return csv;\n })\n .catch(fetchErrorHandler);\n};\n\nexport const escapeFilterValue = (value) => {\n value = String(value);\n // escape backslash first so you don't accidentally break your own escapes\n value = value.replace(/\\\\/g, \"\\\\\\\\\");\n value = value.replace(/,/g, \"\\\\,\");\n value = value.replace(/;/g, \"\\\\;\");\n // especial case for literal +\n value = value.replace(/\\+/g, \"%2B\");\n return value;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"spark-md5\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/sha256\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/enc-base64url\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"crypto-js/enc-hex\");","import SparkMD5 from \"spark-md5\";\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nconst MAX_BYTES = 65536\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nconst MAX_UINT32 = 4294967295\nconst crypto = typeof window !== 'undefined' ? (window.crypto || window.msCrypto) : null;\nimport sha256 from 'crypto-js/sha256';\nimport Base64url from 'crypto-js/enc-base64url'\nimport Hex from 'crypto-js/enc-hex'\nexport const getRandomBytes = (size) => {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n const bytes = Buffer.allocUnsafe(size)\n if(!crypto) return a;\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (let generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n return bytes\n}\n\nexport const getSHA256 = (message, format = 'hex') => {\n\n let f = Hex;\n if(format === 'Base64url')\n f = Base64url;\n\n return sha256(message).toString(f);\n}\n\nexport const getMD5 = (file) => {\n return new Promise((resolve, reject) => {\n const chunkSize = 2 * 1024 * 1024; // 2 MB by chunk\n const spark = new SparkMD5.ArrayBuffer();\n const fileReader = new FileReader();\n let cursor = 0;\n\n fileReader.onload = e => {\n spark.append(e.target.result); \n cursor += chunkSize;\n\n if (cursor < file.size) {\n readNextChunk();\n } else {\n resolve(spark.end()); // final MD5\n }\n };\n\n fileReader.onerror = () => reject(\"Error reading the file\");\n\n function readNextChunk() {\n const slice = file.slice(cursor, cursor + chunkSize);\n fileReader.readAsArrayBuffer(slice);\n }\n\n readNextChunk();\n });\n}","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport moment from 'moment-timezone';\nimport URI from \"urijs\";\n\nexport const findElementPos = (obj) => {\n var curtop = -70;\n if (obj.offsetParent) {\n do {\n curtop += obj.offsetTop;\n } while (obj = obj.offsetParent);\n return [curtop];\n }\n};\n\nexport const epochToMoment = (atime) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime);\n};\n\nexport const epochToMomentTimeZone = (atime, time_zone) => {\n if(!atime) return atime;\n atime = atime * 1000;\n return moment(atime).tz(time_zone);\n};\n\nexport const formatEpoch = (atime, format = 'M/D/YYYY h:mm a') => {\n if(!atime) return atime;\n return epochToMoment(atime).format(format);\n};\n\nexport const parseLocationHour = (hour) => {\n let parsedHour = hour.toString();\n if(parsedHour.length < 4) parsedHour = `0${parsedHour}`;\n parsedHour = parsedHour.match(/.{2}/g);\n parsedHour = parsedHour.join(':');\n return parsedHour;\n}\n\nexport const objectToQueryString = (obj) => {\n var str = \"\";\n for (var key in obj) {\n if (str != \"\") {\n str += \"&\";\n }\n str += key + \"=\" + encodeURIComponent(obj[key]);\n }\n\n return str;\n};\n\nexport const getBackURL = () => {\n let url = URI(window.location.href);\n let query = url.search(true);\n let fragment = url.fragment();\n let backUrl = query.hasOwnProperty('BackUrl') ? query['BackUrl'] : null;\n if(backUrl != null && fragment != null && fragment != ''){\n backUrl += `#${fragment}`;\n }\n return backUrl;\n};\n\nexport const toSlug = (text) =>{\n text = text.toLowerCase();\n return text.replace(/[^a-zA-Z0-9]+/g,'_');\n}\n\nexport const getAuthCallback = () => {\n if(typeof window !== 'undefined') {\n return `${window.location.origin}/auth/callback`;\n }\n return null;\n};\n\nexport const getCurrentLocation = () => {\n let location = '';\n if(typeof window !== 'undefined') {\n location = window.location;\n // check if we are on iframe\n if (window.top)\n location = window.top.location;\n }\n return location;\n};\n\nexport const getOrigin = () => {\n if(typeof window !== 'undefined') {\n return window.location.origin;\n }\n return null;\n};\n\nexport const getCurrentPathName = () => {\n if(typeof window !== 'undefined') {\n return window.location.pathname;\n }\n return null;\n};\n\nexport const getCurrentHref = () => {\n if(typeof window !== 'undefined') {\n return window.location.href;\n }\n return null;\n};\n\nexport const getAllowedUserGroups = () => {\n if(typeof window !== 'undefined') {\n return window.ALLOWED_USER_GROUPS || '';\n }\n return null;\n};\n\nexport const buildAPIBaseUrl = (relativeUrl) => {\n if(typeof window !== 'undefined'){\n return `${window.API_BASE_URL}${relativeUrl}`;\n }\n return null``;\n};\n\nexport const putOnLocalStorage = (key, value) => {\n if(typeof window !== 'undefined') {\n window.localStorage.setItem(key, value);\n }\n};\n\nexport const getFromLocalStorage = (key, removeIt) => {\n if(typeof window !== 'undefined') {\n let val = window.localStorage.getItem(key);\n if(removeIt){\n console.log(`getFromLocalStorage removing key ${key}`);\n removeFromLocalStorage(key);\n }\n return val;\n }\n return null;\n};\n\nexport const removeFromLocalStorage = (key) => {\n if(typeof window !== 'undefined') {\n window.localStorage.removeItem(key);\n }\n}\n\nexport const isClearingSessionState = () => {\n if(typeof window !== 'undefined') {\n return window.clearing_session_state;\n }\n return false;\n};\n\nexport const setSessionClearingState = (val) => {\n if(typeof window !== 'undefined') {\n window.clearing_session_state = val;\n }\n};\n\nexport const getCurrentUserLanguage = () => {\n let language = 'en';\n if(typeof navigator !== 'undefined') {\n language = (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage;\n }\n return language;\n};\n\nexport const scrollToError = (errors) => {\n if(Object.keys(errors).length > 0) {\n const firstError = Object.keys(errors)[0];\n const firstNode = document.getElementById(firstError);\n if (firstNode) window.scrollTo(0, findElementPos(firstNode));\n }\n};\n\nexport const hasErrors = (field, errors) => {\n if(field in errors) {\n return errors[field];\n }\n return '';\n};\n\nexport const shallowEqual = (object1, object2) => {\n const keys1 = Object.keys(object1);\n const keys2 = Object.keys(object2);\n\n if (keys1.length !== keys2.length) {\n return false;\n }\n\n for (let key of keys1) {\n if (object1[key] !== object2[key]) {\n return false;\n }\n }\n\n return true;\n};\n\nexport const arraysEqual = (a1, a2) =>\n a1.length === a2.length && a1.every((o, idx) => shallowEqual(o, a2[idx]));\n\nexport const isEmpty = (obj) => {\n return Object.keys(obj).length === 0;\n};\n\n\nexport const base64URLEncode = (str) => {\n return str\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=/g, '')\n}\n\nexport const retryPromise = async (\n cb,\n maxNumberOfRetries = 3\n) => {\n for (let i = 0; i < maxNumberOfRetries; i++) {\n if (await cb()) {\n return true;\n }\n }\n\n return false;\n}\n\nexport const getTimeServiceUrl = () => {\n if(typeof window !== 'undefined') {\n return window.TIMEINTERVALSINCE1970_API_URL || process.env.TIMEINTERVALSINCE1970_API_URL;\n }\n return null;\n};\n\nexport const getEventLocation = (event, summitVenueCount, summitShowLocDate = null, nowUtc = null) => {\n const shouldShowVenues = (summitShowLocDate && nowUtc) ? summitShowLocDate * 1000 < nowUtc : true;\n const locationName = [];\n const { location } = event;\n\n if (!shouldShowVenues) return 'TBA';\n\n if (!location) return 'TBA';\n\n if (summitVenueCount > 1 && location.venue?.name) locationName.push(location.venue.name);\n if (location.floor?.name) locationName.push(location.floor.name);\n if (location.name) locationName.push(location.name);\n\n return locationName.length > 0 ? locationName.join(' - ') : 'TBA';\n};\n\nexport const getEventHosts = (event) => {\n let hosts = [];\n if (event.speakers?.length > 0) {\n hosts = [...event.speakers];\n }\n if (event.moderator) hosts.push(event.moderator);\n\n return hosts;\n};\n\nconst loadImage = async url => {\n const img = document.createElement('img')\n img.src = url\n img.crossOrigin = 'anonymous'\n\n return new Promise((resolve, reject) => {\n img.onload = () => resolve(img)\n img.onerror = reject\n })\n}\n\nexport const convertSVGtoImg = async (svgUrl) => {\n const img = await loadImage(svgUrl)\n const newWidth = 100\n const newHeight = Math.floor(img.naturalHeight * 100 / img.naturalWidth)\n\n const canvas = document.createElement('canvas')\n canvas.width = newWidth\n canvas.height = newHeight\n canvas.getContext('2d').drawImage(img, 0, 0, newWidth, newHeight)\n\n const url = await canvas.toDataURL(`image/png`, 1.0)\n console.log(url, newWidth, newHeight);\n return {url, width: newWidth, height: newHeight}\n}\n","/**\n * Copyright 2018 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport { fetchErrorHandler, fetchResponseHandler, escapeFilterValue } from \"./actions\";\nimport { getAccessToken } from '../components/security/methods';\nimport { buildAPIBaseUrl } from \"./methods\";\nimport _ from 'lodash';\nexport const RECEIVE_COUNTRIES = 'RECEIVE_COUNTRIES';\nconst callDelay = 500; // milliseconds\nimport URI from \"urijs\";\nURI.escapeQuerySpace = false;\nexport const DEFAULT_PAGE_SIZE = 10;\n\nconst _fetchPublic = async (endpoint, callback, options = {}) => {\n return fetch(buildAPIBaseUrl(endpoint.toString()), options)\n .then(fetchResponseHandler)\n .then((json) => {\n if(typeof callback === 'function')\n callback(json.data);\n })\n .catch(response => {\n const code = response.status;\n if (code === 404) callback([]);\n return response;\n })\n .catch(fetchErrorHandler);\n}\n\n/**\n * @param endpoint\n * @param callback\n * @param options\n * @returns {Promise<Response | void>}\n * @private\n */\nconst _fetch = async (endpoint, callback, options = {}) => {\n\n let accessToken;\n\n try {\n accessToken = await getAccessToken();\n } catch (e) {\n if(typeof callback === 'function')\n callback(e);\n return Promise.reject();\n }\n\n endpoint.addQuery('access_token', accessToken);\n\n return _fetchPublic(endpoint, callback, options);\n}\n\n/**\n *\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryMembers = _.debounce(async (input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/members`);\n\n endpoint.addQuery('expand', `tickets,rsvp,schedule_summit_events,all_affiliations`);\n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name@@${input},first_name@@${input},last_name@@${input},email@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n *\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryAttendees = _.debounce(async (summitId, input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n \n let endpoint = URI(`/api/v1/summits/${summitId}/attendees`);\n \n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n \n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name=@${input},email=@${input}`);\n }\n \n _fetch(endpoint, callback);\n \n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const querySummits = _.debounce(async (input, callback, per_page= DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/all`);\n\n endpoint.addQuery('expand', `tickets,rsvp,schedule_summit_events,all_affiliations`);\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySpeakers = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE ) => {\n\n\n let endpoint = URI(`/api/v1/${summitId ? `summits/${summitId}/speakers`:`speakers`}`);\n\n endpoint.addQuery('expand', `member,registration_request`);\n endpoint.addQuery('order','first_name,last_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `full_name@@${input},first_name@@${input},last_name@@${input},email@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTags = _.debounce(async (summitId, input, callback, per_page = 50) => {\n\n let endpoint = URI(`/api/v1/${summitId ? `summits/${summitId}/track-tag-groups/all/allowed-tags`:`tags`}`);\n\n if(summitId)\n endpoint.addQuery('expand', `tag,track_tag_group`);\n\n endpoint.addQuery('order','tag');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `tag@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTracks = _.debounce(async (summitId, input, callback, excludedIds = [], per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/tracks`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if (excludedIds?.length > 0) {\n endpoint.addQuery('filter[]', `not_id==${excludedIds.join(\"||\")}`);\n }\n\n if (input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryTrackGroups = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/track-groups`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=, *): Promise<void>)|*>}\n */\nexport const queryEvents = _.debounce(async (summitId, input, onlyPublished = false, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/events` + (onlyPublished ? '/published' : ''));\n\n endpoint.addQuery('order','title');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `title@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=, *=): Promise<void>)|*>}\n */\nexport const queryEventTypes = _.debounce(async (summitId, input, callback, eventTypeClassName = null, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/event-types`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n if (eventTypeClassName) {\n eventTypeClassName = escapeFilterValue(eventTypeClassName);\n endpoint.addQuery('filter[]', `class_name==${eventTypeClassName}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryGroups = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/groups`);\n\n endpoint.addQuery('order','title,code');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `title@@${input},code@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryCompanies = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/companies`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryRegistrationCompanies = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/registration-companies`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySponsors = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/sponsors`);\n\n endpoint.addQuery('expand','company,sponsorship,sponsorship.type')\n endpoint.addQuery('order','id')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `company_name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const querySponsorsWithBadgeScans = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/sponsors`);\n\n endpoint.addQuery('expand','company,sponsorship,sponsorship.type');\n endpoint.addQuery('fields','id,company.name,sponsorship.type.name');\n endpoint.addQuery('relations','none,company.none,sponsorship.type.none');\n endpoint.addQuery('filter[]','badge_scans_count>0');\n endpoint.addQuery('order','+company_name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `company_name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryAccessLevels = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/summits/${summitId}/access-level-types`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const queryOrganizations = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/v1/organizations`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\nexport const getLanguageList = (callback, signal) => {\n return _fetchPublic(new URI(`/api/public/v1/languages`), callback, { signal });\n};\n\nexport const getCountryList = (callback, signal) => {\n return _fetchPublic(new URI(`/api/public/v1/countries`), callback, { signal });\n};\n\nlet geocoder;\n\nexport const geoCodeAddress = (address) => {\n\n if (!geocoder) geocoder = new google.maps.Geocoder();\n\n // return a Promise\n return new Promise(function(resolve,reject) {\n geocoder.geocode( { 'address': address}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n // resolve results upon a successful status\n resolve(results);\n } else {\n // reject status upon un-successful status\n reject(status);\n }\n });\n });\n};\n\nexport const geoCodeLatLng = (lat, lng) => {\n\n if (!geocoder) geocoder = new google.maps.Geocoder();\n\n let latlng = {lat: parseFloat(lat), lng: parseFloat(lng)};\n // return a Promise\n return new Promise(function(resolve,reject) {\n geocoder.geocode( { 'location': latlng}, function(results, status) {\n if (status == google.maps.GeocoderStatus.OK) {\n // resolve results upon a successful status\n resolve(results);\n } else {\n // reject status upon un-successful status\n reject(status);\n }\n });\n });\n};\n\n/**\n * @type {DebouncedFunc<(function(*, *=, *, *=, *=): Promise<void>)|*>}\n */\nexport const queryTicketTypes = _.debounce(async (summitId, filters = {}, callback, version = 'v1', per_page = DEFAULT_PAGE_SIZE) => {\n\n let endpoint = URI(`/api/${version}/summits/${summitId}/ticket-types`);\n\n endpoint.addQuery('order','name');\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(filters.hasOwnProperty('name')) {\n const name = escapeFilterValue(filters.name);\n if(name && name != '')\n endpoint.addQuery('filter[]', `name@@${name}`);\n }\n\n if(filters.hasOwnProperty('audience')){\n const audience = escapeFilterValue(filters.audience);\n if(audience && audience != '')\n endpoint.addQuery('filter[]', `audience==${audience}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *=): Promise<void>)|*>}\n */\nexport const querySponsoredProjects = _.debounce(async (input, callback, per_page = DEFAULT_PAGE_SIZE) => {\n\n\n const endpoint = URI(`/api/v1/sponsored-projects`);\n\n endpoint.addQuery('order','name')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `name@@${input}`);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n\n/**\n * @type {DebouncedFunc<(function(*, *, *, *=): Promise<void>)|*>}\n */\nexport const queryPromocodes = _.debounce(async (summitId, input, callback, per_page = DEFAULT_PAGE_SIZE, extraFilters = []) => {\n\n\n let endpoint = URI(`/api/v1/summits/${summitId}/promo-codes`);\n\n endpoint.addQuery('order','code')\n endpoint.addQuery('page', 1);\n endpoint.addQuery('per_page', per_page);\n\n if(input) {\n input = escapeFilterValue(input);\n endpoint.addQuery('filter[]', `code@@${input}`);\n }\n\n //eg: filter = 'class_name==SummitRegistrationPromoCode'\n for (const filter of extraFilters) {\n endpoint.addQuery('filter[]', filter);\n }\n\n _fetch(endpoint, callback);\n\n}, callDelay);\n","/**\n * Copyright 2026 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport React from \"react\";\n\n// Returns a callback with a stable identity that always invokes the latest\n// version of `fn`. Useful for calling props (like a parent's onChange) from\n// inside an effect without listing them as deps, which would re-run the effect\n// every time the consumer passes a new inline arrow function.\n//\n// Stable-identity wrapper over the latest-ref pattern; equivalent to React's\n// still-experimental useEffectEvent. Replace with the native hook when it\n// ships in a stable release.\nconst useEventCallback = (fn) => {\n const ref = React.useRef(fn);\n React.useLayoutEffect(() => {\n ref.current = fn;\n });\n return React.useCallback((...args) => ref.current(...args), []);\n};\n\nexport default useEventCallback;\n","module.exports = require(\"@babel/runtime/helpers/defineProperty\");","module.exports = require(\"@babel/runtime/helpers/objectWithoutProperties\");","module.exports = require(\"i18n-react/dist/i18n-react\");","module.exports = require(\"idtoken-verifier\");","module.exports = require(\"lodash\");","module.exports = require(\"moment-timezone\");","module.exports = require(\"react\");","module.exports = require(\"superagent/lib/client\");","module.exports = require(\"sweetalert2\");","module.exports = require(\"urijs\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@babel/runtime/helpers/extends\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"prop-types\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@mui/material\");","/**\n * Copyright 2017 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * */\n\nimport React from \"react\";\nimport PropTypes from \"prop-types\";\nimport { TextField, Autocomplete, Typography } from \"@mui/material\";\nimport { queryRegistrationCompanies } from \"../../utils/query-actions\";\nimport useEventCallback from \"../../utils/use-event-callback\";\n\n// Any well-formed company object (has a name string).\nexport const isCompanyObject = (o) =>\n !!o && typeof o === \"object\" && typeof o.name === \"string\";\n\n// A company already in the database (positive id assigned by the API).\nexport const isExistingCompany = (o) => isCompanyObject(o) && o.id > 0;\n\n// A company name the user typed that isn't in the database yet\n// (id === 0 is the sentinel autoSelect uses for free-text values).\nexport const isNewCompany = (o) => isCompanyObject(o) && o.id === 0 && !!o.name.trim();\n\n// Find an existing company in `candidates` whose name matches `name`\n// case-insensitively. Returns null if `name` is empty or no match found.\nexport const findExistingByName = (candidates, name) => {\n const trimmed = name?.trim().toLowerCase();\n if (!trimmed) return null;\n return (candidates || []).find(\n (c) => isExistingCompany(c) && c.name.toLowerCase() === trimmed\n ) || null;\n};\n\n// Treat empty strings, null/undefined, and empty-name objects as no selection.\n// MUI's Autocomplete renders the clear (x) icon whenever value is truthy, so\n// without this an empty-name object would keep the clear icon visible on hover\n// of an apparently empty field.\nexport const normalizeCompanyValue = (v) => {\n if (!v) return null;\n if (typeof v === \"string\") return v.trim() ? v : null;\n if (typeof v === \"object\" && typeof v.name === \"string\" && v.name.trim()) return v;\n return null;\n};\n\nconst CompanyInputV2 = ({ summitId, isRequired, sx, onChange, id, name, label, value, error, helperText, onBlur, placeholder, options2Show, disableShrink, ...rest }) => {\n const [inputValue, setInputValue] = React.useState(\"\");\n const [options, setOptions] = React.useState([]);\n\n // Memoised so the effect below doesn't re-run on every render.\n const normalizedValue = React.useMemo(() => normalizeCompanyValue(value), [value]);\n\n // Stable wrapper around the parent's onChange. Consumers commonly pass an\n // inline arrow function (new identity each render), so depending on\n // `onChange` directly in the effect below would re-run it every render and\n // cause an infinite loop of network calls.\n const fireChange = useEventCallback((nextValue) => {\n onChange({ target: { id: name, value: nextValue, type: \"companyinput\" } });\n });\n\n React.useEffect(() => {\n if (inputValue === \"\") {\n setOptions(normalizedValue ? [normalizedValue] : []);\n return undefined;\n }\n\n // Guard against the in-flight callback firing after the user clears the\n // field (or types something else): without this, a late response would\n // call onChange with the previous typed value and clobber the clear.\n let cancelled = false;\n queryRegistrationCompanies(summitId, inputValue, (results) => {\n if (cancelled) return;\n\n let newOptions = [];\n\n if (normalizedValue) {\n newOptions = [normalizedValue];\n }\n\n if (results) {\n newOptions = [...newOptions, ...results];\n }\n\n setOptions(newOptions);\n\n // If the user typed and blurred faster than the API responded, the\n // free-text commit already happened. Once the response arrives, if\n // there is a case-insensitive existing match, replace the free-text\n // value with the canonical option.\n if (isNewCompany(normalizedValue)) {\n const match = findExistingByName(results, normalizedValue.name);\n if (match) {\n fireChange(match);\n }\n }\n }, options2Show);\n return () => { cancelled = true; };\n }, [normalizedValue, inputValue, summitId, options2Show, fireChange]);\n\n return (\n <Autocomplete\n sx={sx}\n id={id}\n name={name}\n options={options}\n autoComplete\n autoSelect\n freeSolo\n includeInputInList\n filterSelectedOptions\n value={normalizedValue}\n onBlur={() => { if (onBlur) onBlur(name) }}\n getOptionLabel={(option) => {\n if (typeof option === \"string\") return option;\n return option.name;\n }}\n onChange={(_, newValue) => {\n let tmpValue = newValue;\n // autoSelect commits the raw typed/autofilled string on blur. If the\n // string matches an existing company case-insensitively, pick that\n // option (so typing \"tipit\" tabs out to \"Tipit\"). Otherwise commit\n // the typed value as a free-text {id: 0, name} entry.\n if (typeof tmpValue === \"string\" && tmpValue.trim()) {\n const trimmed = tmpValue.trim();\n tmpValue = findExistingByName(options, trimmed) || { id: 0, name: trimmed };\n }\n // Prepend the committed value but drop any existing entry with\n // the same id; otherwise resolving to an existing company would\n // produce a duplicate row when the dropdown next opens.\n setOptions(tmpValue\n ? [tmpValue, ...options.filter((o) => o?.id !== tmpValue?.id)]\n : options);\n onChange({\n target: {\n id: name,\n value: tmpValue,\n type: \"companyinput\"\n }\n });\n }}\n onInputChange={(_, newInputValue) => {\n setInputValue(newInputValue);\n }}\n // The API already filters server-side; disable MUI's client-side filtering\n // so all returned matches stay visible regardless of substring match.\n filterOptions={(opts) => opts}\n renderInput={(params) => (\n <TextField\n /* eslint-disable-next-line react/jsx-props-no-spreading */\n {...params}\n label={label}\n placeholder={placeholder}\n fullWidth\n required={isRequired}\n helperText={helperText}\n error={error}\n margin=\"normal\"\n InputLabelProps={disableShrink ? { shrink: false } : undefined}\n />\n )}\n renderOption={(props, option) => {\n const { key, ...optionProps } = props;\n // Mirror getOptionLabel: string options come through when the\n // consumer passes value as a plain string. Without this guard\n // those rows render empty.\n const label = typeof option === \"string\" ? option : option?.name;\n return (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <li key={key} {...optionProps}>\n <Typography\n variant=\"body2\"\n sx={{ fontSize: \"1em\", color: \"text.secondary\", padding: \"5px 0\" }}\n >\n {label}\n </Typography>\n </li>\n );\n }}\n {...rest}\n />\n );\n};\n\nCompanyInputV2.defaultProps = {\n name: \"GENERAL\",\n label: \"Company\",\n options2Show: 20,\n disableShrink: false\n};\n\nCompanyInputV2.propTypes = {\n summitId: PropTypes.number.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n onChange: PropTypes.func.isRequired,\n isRequired: PropTypes.bool,\n name: PropTypes.string,\n error: PropTypes.bool,\n helperText: PropTypes.string,\n onBlur: PropTypes.func,\n options2Show: PropTypes.number,\n placeholder: PropTypes.string,\n label: PropTypes.string,\n disableShrink: PropTypes.bool\n};\n\nexport default CompanyInputV2;\n"],"names":["root","factory","exports","module","define","amd","this","AUTH_ERROR_MISSING_AUTH_INFO","AUTH_ERROR_MISSING_REFRESH_TOKEN","AUTH_ERROR_ACCESS_TOKEN_EXPIRED","AUTH_ERROR_LOCK_ACQUIRE_ERROR","AUTH_ERROR_REFRESH_TOKEN_REQUEST_ERROR","AUTH_ERROR_REFRESH_TOKEN_NETWORK_ERROR","require","Lock","SuperTokensLock","GET_TOKEN_SILENTLY_LOCK_KEY","RESPONSE_TYPE_CODE","AUTH_INFO","ID_TOKEN","processRefreshToken","async","flow","refreshToken","useOAuth2RefreshToken","clearAuthInfo","Error","response","fn","maxRetries","baseDelayMs","attempt","err","message","startsWith","delay","Math","pow","console","log","Promise","resolve","setTimeout","retryWithBackoff","refreshAccessToken","access_token","expires_in","refresh_token","id_token","storeAuthInfo","_getAccessToken","authInfo","getAuthInfo","accessToken","expiresIn","accessTokenUpdatedAt","getOAuth2Flow","now","moment","unix","timeElapsedSecs","getAccessToken","navigator","locks","request","lock","retryPromise","acquireLock","releaseLock","baseUrl","getOAuth2IDPBaseUrl","oauth2ClientId","getOAuth2ClientId","payload","encodeURI","controller","AbortController","timeoutId","abort","json","fetch","method","headers","body","JSON","stringify","signal","networkError","clearTimeout","ok","status","statusText","setSessionClearingState","parseError","new_refresh_token","idToken","formerAuthInfo","floor","Date","Cookies","secure","sameSite","putOnLocalStorage","res","getFromLocalStorage","parse","window","removeFromLocalStorage","OAUTH2_CLIENT_ID","OAUTH2_FLOW","Boolean","OAUTH2_USE_REFRESH_TOKEN","IDP_BASE_URL","URI","createAction","type","fetchErrorHandler","code","msg","Swal","T","fetchResponseHandler","escapeFilterValue","value","String","replace","crypto","msCrypto","buildAPIBaseUrl","relativeUrl","API_BASE_URL","key","localStorage","setItem","removeIt","val","getItem","removeItem","clearing_session_state","cb","maxNumberOfRetries","i","callDelay","_fetchPublic","endpoint","callback","options","toString","then","data","catch","_fetch","e","reject","addQuery","queryRegistrationCompanies","_","input","per_page","DEFAULT_PAGE_SIZE","summitId","excludedIds","length","join","onlyPublished","eventTypeClassName","filters","version","hasOwnProperty","name","audience","extraFilters","filter","ref","React","current","args","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","o","Object","defineProperty","enumerable","get","obj","prop","prototype","call","r","Symbol","toStringTag","isCompanyObject","isExistingCompany","id","isNewCompany","trim","findExistingByName","candidates","trimmed","toLowerCase","find","c","normalizeCompanyValue","v","CompanyInputV2","_ref","isRequired","sx","onChange","label","error","helperText","onBlur","placeholder","options2Show","disableShrink","rest","_objectWithoutProperties","_excluded","inputValue","setInputValue","setOptions","normalizedValue","fireChange","useEventCallback","nextValue","target","cancelled","results","newOptions","match","Autocomplete","_extends","autoComplete","autoSelect","freeSolo","includeInputInList","filterSelectedOptions","getOptionLabel","option","newValue","tmpValue","_tmpValue","onInputChange","newInputValue","filterOptions","opts","renderInput","params","TextField","fullWidth","required","margin","InputLabelProps","shrink","renderOption","props","optionProps","_excluded2","Typography","variant","fontSize","color","padding","defaultProps","propTypes","PropTypes"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={2015:e=>{e.exports=require("react")}},t={};function r(o){var n=t[o];if(void 0!==n)return n.exports;var u=t[o]={exports:{}};return e[o](u,u.exports,r),u.exports}(()=>{r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t}})(),(()=>{r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})}})(),(()=>{r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var o={};r.r(o),r.d(o,{createExternalStore:()=>i});var n=r(2015),u=r.n(n);const s=require("use-sync-external-store/shim"),c=require("use-sync-external-store/shim/with-selector"),a=(e,t)=>e===t;function i(e="ExternalStore"){const t=(0,n.createContext)(null),r=()=>{const r=(0,n.useContext)(t);if(null===r)throw new Error(`${e} hooks must be used within their Provider`);return r};return{Provider:({initialValue:e=null,children:r})=>{const o=(0,n.useRef)(e),s=(0,n.useRef)(new Set),c=(0,n.useCallback)((e=>(s.current.add(e),()=>s.current.delete(e))),[]),a=(0,n.useCallback)((()=>o.current),[]),i=(0,n.useCallback)((e=>{o.current=e,s.current.forEach((e=>e()))}),[]),l=(0,n.useMemo)((()=>({subscribe:c,getSnapshot:a})),[c,a]);return u().createElement(t.Provider,{value:l},"function"==typeof r?r(i):r)},useValue:()=>{const{subscribe:e,getSnapshot:t}=r();return(0,s.useSyncExternalStore)(e,t)},useSelector:(e,t=a)=>{const{subscribe:o,getSnapshot:n}=r();return(0,c.useSyncExternalStoreWithSelector)(o,n,n,e,t)}}}return o})()));
|
|
2
|
+
//# sourceMappingURL=external-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils/external-store.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,8BAA+B,GAAIH,GAChB,iBAAZC,QACdA,QAAQ,+BAAiCD,IAEzCD,EAAK,+BAAiCC,GACvC,CATD,CASGK,MAAM,I,mCCTTH,EAAOD,QAAUK,QAAQ,Q,GCCrBC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaT,QAGrB,IAAIC,EAASK,EAAyBE,GAAY,CAGjDR,QAAS,CAAC,GAOX,OAHAW,EAAoBH,GAAUP,EAAQA,EAAOD,QAASO,GAG/CN,EAAOD,OACf,C,MCrBAO,EAAoBK,EAAKX,IACxB,IAAIY,EAASZ,GAAUA,EAAOa,WAC7B,IAAOb,EAAiB,QACxB,IAAM,EAEP,OADAM,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,CAAM,C,WCLdN,EAAoBQ,EAAI,CAACf,EAASiB,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEnB,EAASkB,IAC5EE,OAAOC,eAAerB,EAASkB,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IA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,EAAAA,sBAAqBd,EAAWM,EAAY,EAsB1BS,YAXTA,CAACC,EAASC,EAAUlC,KACpC,MAAM,UAAEiB,EAAS,YAAEM,GAAgBjB,IACnC,OAAO6B,EAAAA,EAAAA,kCACHlB,EACAM,EACAA,EACAU,EACAC,EACH,EAIT,C","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/external commonjs \"use-sync-external-store/shim\"","webpack://openstack-uicore-foundation/external commonjs \"use-sync-external-store/shim/with-selector\"","webpack://openstack-uicore-foundation/./src/utils/external-store.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","module.exports = require(\"react\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"use-sync-external-store/shim\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"use-sync-external-store/shim/with-selector\");","/**\n * Copyright 2026 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * createExternalStore - Factory for creating React-optimized external stores.\n *\n * Problem:\n * When a frequently-updating data source (clock, WebSocket, polling, etc.)\n * pushes its value into shared state (global store, lifted useState, or a\n * context value), every consuming component re-renders on every update,\n * even when they only care about a derived condition that rarely changes.\n *\n * Solution:\n * createExternalStore() returns a Provider and hooks that store the value\n * in a ref (no re-renders) and use useSyncExternalStore so components\n * can opt in to updates selectively:\n *\n * - useValue() → re-renders on every update\n * - useSelector(compute, isEqual) → re-renders only when the computed result changes\n *\n * Components that don't call either hook are never affected by updates.\n *\n * How it works:\n * 1. The Provider stores the value in a ref (writing to a ref never triggers\n * a React re-render) and keeps a Set of listener callbacks.\n * 2. When emit(value) is called, the ref is updated and all listeners are\n * notified. These listeners come from useSyncExternalStore.\n * 3. useSyncExternalStore (React 18, shimmed for 16/17) calls getSnapshot()\n * to read the ref, compares with the previous value, and only re-renders\n * the component if the value changed.\n * 4. useMemo adds a layer on top: it runs a compute function on the raw value\n * and only re-renders if the computed result changed (checked via isEqual).\n *\n * API:\n * createExternalStore(name) returns:\n *\n * - Provider Wraps your component tree. Pass children as a render function\n * to receive the emit callback: (emit) => JSX. Call emit(value)\n * each time your data source has a new value.\n *\n * - useValue() Returns the latest emitted value. The component re-renders\n * on every emit.\n *\n * - useSelector(compute, isEqual?)\n * Returns a derived value. compute(rawValue) runs on every emit,\n * but the component only re-renders when isEqual returns false\n * (default: ===). Useful when you need to derive something that\n * changes less frequently than the raw value.\n *\n * The name parameter is used in error messages. For example,\n * createExternalStore('Clock') throws \"Clock hooks must be used within\n * their Provider\" when a hook is called outside the Provider.\n *\n * For clock-specific usage:\n * A pre-built clock store is available at:\n * import { ClockProvider, useClock, useClockSelector } from 'openstack-uicore-foundation/lib/components/clock-context';\n * This wires createExternalStore to the Clock component so projects don't\n * have to repeat that boilerplate.\n *\n * Custom store example:\n * import { createExternalStore } from 'openstack-uicore-foundation/lib/utils/external-store';\n *\n * const { Provider, useValue, useSelector } = createExternalStore('WebSocket');\n *\n * const WebSocketProvider = ({ url, children }) => (\n * <Provider>\n * {(emit) => (\n * <>\n * <WebSocketSource url={url} onMessage={emit} />\n * {children}\n * </>\n * )}\n * </Provider>\n * );\n *\n * // Re-renders on every message:\n * const message = useValue();\n *\n * // Re-renders only when the derived value changes:\n * const isActive = useSelector((msg) => msg?.status === 'active');\n **/\n\nimport React, { createContext, useContext, useRef, useCallback, useMemo as reactUseMemo } from 'react';\n// Shim for React 16/17 compatibility, falls back to native in React 18+\nimport { useSyncExternalStore } from 'use-sync-external-store/shim';\nimport { useSyncExternalStoreWithSelector } from 'use-sync-external-store/shim/with-selector';\n\nconst strictEqual = (a, b) => a === b;\n\n/**\n * Creates an external store with a Provider and subscription hooks.\n *\n * @param {string} name - Store name, used in error messages (e.g., \"Clock\", \"WebSocket\")\n * @returns {{ Provider, useValue, useSelector }}\n */\nexport function createExternalStore(name = 'ExternalStore') {\n const Context = createContext(null);\n\n const useStoreContext = () => {\n const context = useContext(Context);\n if (context === null) {\n throw new Error(`${name} hooks must be used within their Provider`);\n }\n return context;\n };\n\n /**\n * Provider - Wraps your component tree and provides the store.\n *\n * Pass children as a render function to receive the `emit` callback:\n * <Provider>{(emit) => <Source onUpdate={emit} />}</Provider>\n *\n * Or pass children normally if you wire emit externally.\n *\n * Pass `initialValue` to seed the store synchronously so that hooks\n * called before the first emit see a real value instead of null.\n */\n const Provider = ({ initialValue = null, children }) => {\n const valueRef = useRef(initialValue);\n const listenersRef = useRef(new Set());\n\n const subscribe = useCallback((callback) => {\n listenersRef.current.add(callback);\n return () => listenersRef.current.delete(callback);\n }, []);\n\n const getSnapshot = useCallback(() => valueRef.current, []);\n\n const emit = useCallback((value) => {\n valueRef.current = value;\n listenersRef.current.forEach(listener => listener());\n }, []);\n\n const contextValue = reactUseMemo(() => ({ subscribe, getSnapshot }), [subscribe, getSnapshot]);\n\n return (\n <Context.Provider value={contextValue}>\n {typeof children === 'function' ? children(emit) : children}\n </Context.Provider>\n );\n };\n\n /**\n * useValue - Subscribe to every update.\n * Component re-renders each time emit() is called.\n *\n * @returns {*} The current value, or null before first emit\n */\n const useValue = () => {\n const { subscribe, getSnapshot } = useStoreContext();\n return useSyncExternalStore(subscribe, getSnapshot);\n };\n\n /**\n * useSelector - Subscribe with a selector function.\n * Only re-renders when the selected/derived value changes.\n *\n * @param {Function} compute - (value) => derivedValue\n * @param {Function} isEqual - Optional equality function (default: ===)\n * @returns {*} The computed value\n */\n const useSelector = (compute, isEqual = strictEqual) => {\n const { subscribe, getSnapshot } = useStoreContext();\n return useSyncExternalStoreWithSelector(\n subscribe,\n getSnapshot,\n getSnapshot,\n compute,\n isEqual\n );\n };\n\n return { Provider, useValue, useSelector };\n}\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","strictEqual","b","createExternalStore","name","Context","createContext","useStoreContext","context","useContext","Error","Provider","initialValue","children","valueRef","useRef","listenersRef","Set","subscribe","useCallback","callback","current","add","delete","getSnapshot","emit","forEach","listener","contextValue","reactUseMemo","React","useValue","useSyncExternalStore","useSelector","compute","isEqual","useSyncExternalStoreWithSelector"],"sourceRoot":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={2015:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var u=t[r]={exports:{}};return e[r](u,u.exports,o),u.exports}(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var r={};o.r(r),o.d(r,{default:()=>a});var n=o(2015),u=o.n(n);const a=e=>{const t=u().useRef(e);return u().useLayoutEffect((()=>{t.current=e})),u().useCallback(((...e)=>t.current(...e)),[])};return r})()));
|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AQA,EAR0BC,IACtB,MAAMC,EAAMC,IAAAA,OAAaF,GAIzB,OAHAE,IAAAA,iBAAsB,KAClBD,EAAIE,QAAUH,CAAE,IAEbE,IAAAA,aAAkB,IAAIE,IAASH,EAAIE,WAAWC,IAAO,GAAG,E","sources":["webpack://openstack-uicore-foundation/webpack/universalModuleDefinition","webpack://openstack-uicore-foundation/external commonjs \"react\"","webpack://openstack-uicore-foundation/webpack/bootstrap","webpack://openstack-uicore-foundation/webpack/runtime/compat get default export","webpack://openstack-uicore-foundation/webpack/runtime/define property getters","webpack://openstack-uicore-foundation/webpack/runtime/hasOwnProperty shorthand","webpack://openstack-uicore-foundation/webpack/runtime/make namespace object","webpack://openstack-uicore-foundation/./src/utils/use-event-callback.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"openstack-uicore-foundation\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"openstack-uicore-foundation\"] = factory();\n\telse\n\t\troot[\"openstack-uicore-foundation\"] = factory();\n})(this, () => {\nreturn ","module.exports = require(\"react\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/**\n * Copyright 2026 OpenStack Foundation\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n **/\n\nimport React from \"react\";\n\n// Returns a callback with a stable identity that always invokes the latest\n// version of `fn`. Useful for calling props (like a parent's onChange) from\n// inside an effect without listing them as deps, which would re-run the effect\n// every time the consumer passes a new inline arrow function.\n//\n// Stable-identity wrapper over the latest-ref pattern; equivalent to React's\n// still-experimental useEffectEvent. Replace with the native hook when it\n// ships in a stable release.\nconst useEventCallback = (fn) => {\n const ref = React.useRef(fn);\n React.useLayoutEffect(() => {\n ref.current = fn;\n });\n return React.useCallback((...args) => ref.current(...args), []);\n};\n\nexport default useEventCallback;\n"],"names":["root","factory","exports","module","define","amd","this","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","fn","ref","React","current","args"],"sourceRoot":""}
|