{"version":3,"sources":["WebChat.js","MinimizableWebChat.js","App.js","serviceWorker.js","index.js"],"names":["WebChat","className","onFetchToken","store","token","directLine","useMemo","createDirectLine","avatarOptions","botAvatarInitials","userAvatarInitials","styleSet","createStyleSet","backgroundColor","useEffect","styleOptions","MinimizableWebChat","createStore","dispatch","next","action","type","payload","name","value","language","window","navigator","activity","from","role","setNewMessage","useState","loaded","setLoaded","minimized","setMinimized","newMessage","side","setSide","setToken","handleFetchToken","useCallback","a","fetch","headers","method","res","json","handleMaximizeButtonClick","handleMinimizeButtonClick","handleSwitchButtonClick","onClick","class","viewBox","fill","d","id","classNames","App","Boolean","location","hostname","match","ReactDOM","render","document","getElementById","serviceWorker","ready","then","registration","unregister"],"mappings":"gkBAyCeA,EApCC,SAAC,GAA+C,IAA7CC,EAA4C,EAA5CA,UAAWC,EAAiC,EAAjCA,aAAcC,EAAmB,EAAnBA,MAAOC,EAAY,EAAZA,MAC3CC,EAAaC,mBAAQ,kBAAMC,2BAAiB,CAAEH,YAAU,CAACA,IAEzDI,EAAgBF,mBAAQ,WAC5B,MAAO,CACPG,kBAAmB,OACnBC,mBAAoB,SAEjB,IAECC,EAAWL,mBACf,kBACEM,yBAAe,CACbC,gBAAiB,kBAErB,IAOF,OAJAC,qBAAU,WACRZ,MACC,CAACA,IAEGE,EACL,cAAC,IAAD,CAAcH,UAAS,UAAKA,GAAa,GAAlB,aAAiCI,WAAYA,EAAYF,MAAOA,EAAOQ,SAAUA,EAAUI,aAAcP,IAEhI,qBAAKP,UAAS,UAAKA,GAAa,GAAlB,oBAAd,SACE,sBAAKA,UAAU,UAAf,UACE,qBAAKA,UAAU,OAAf,SACE,sBAAMA,UAAU,6BAElB,2ECgGOe,G,gBA1HY,WACzB,IAAMb,EAAQG,mBACZ,kBACEW,sBAAY,IAAI,gBAAGC,EAAH,EAAGA,SAAH,OAAkB,SAAAC,GAAI,OAAI,SAAAC,GAiBxC,MAhBoB,kCAAhBA,EAAOC,KACTH,EAAS,CACPG,K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B,sBAAMoD,MAAM,kBAAZ,SACM,qBAAKA,MAAM,gBAAgBC,QAAQ,YAAnC,SACE,sBAAMC,KAAK,OAAO,YAAU,UAAUC,EAAE,+hBAG5C,sBAAMC,GAAG,kBAAT,kCAEEpB,GACE,sBAAMpC,UAAU,iDAI3BgC,GACC,sBAAKhC,UAAWyD,IAAoB,SAATpB,EAAkB,gBAAkB,iBAAkBH,EAAY,OAAS,IAAtG,UACE,mCACE,qBAAKlC,UAAU,WACf,wBAAQA,UAAU,SAASmD,QAASD,EAApC,SACE,sBAAMlD,UAAU,8BAElB,wBAAQA,UAAU,WAAWmD,QAASF,EAAtC,SACE,sBAAMjD,UAAU,yCAGpB,cAAC,EAAD,CACEA,UAAU,iBACVC,aAAcuC,EACdtC,MAAOA,EACPQ,SAAUA,EACVP,MAAOA,YChHJuD,G,QANH,kBACV,qBAAK1D,UAAU,MAAf,SACE,cAAC,EAAD,QCKgB2D,QACW,cAA7BlC,OAAOmC,SAASC,UAEe,UAA7BpC,OAAOmC,SAASC,UAEhBpC,OAAOmC,SAASC,SAASC,MAAM,2DCXnCC,IAASC,OAAO,cAAC,EAAD,IAASC,SAASC,eAAe,SDoH3C,kBAAmBxC,WACrBA,UAAUyC,cAAcC,MAAMC,MAAK,SAAAC,GACjCA,EAAaC,iB","file":"static/js/main.12f5fcd4.chunk.js","sourcesContent":["import React, { useEffect, useMemo } from 'react';\nimport ReactWebChat, { createDirectLine, createStyleSet } from 'botframework-webchat';\n\nimport './WebChat.css';\n\nconst WebChat = ({ className, onFetchToken, store, token }) => {\n const directLine = useMemo(() => createDirectLine({ token }), [token]);\n\n const avatarOptions = useMemo(() => {\n return {\n botAvatarInitials: 'Alex',\n userAvatarInitials: 'You'\n }\n }, []);\n\n const styleSet = useMemo(\n () =>\n createStyleSet({\n backgroundColor: 'Transparent'\n }),\n []\n );\n\n useEffect(() => {\n onFetchToken();\n }, [onFetchToken]);\n\n return token ? (\n \n ) : (\n
\n
\n
\n \n
\n

Please wait while we are connecting.

\n
\n
\n );\n};\n\nexport default WebChat;\n","import classNames from 'classnames';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport { createStore, createStyleSet } from 'botframework-webchat';\n\nimport WebChat from './WebChat';\n\nimport './fabric-icons-inline.css';\nimport './MinimizableWebChat.css';\n\nconst MinimizableWebChat = () => {\n const store = useMemo(\n () =>\n createStore({}, ({ dispatch }) => next => action => {\n if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {\n dispatch({\n type: 'WEB_CHAT/SEND_EVENT',\n payload: {\n name: 'webchat/join',\n value: {\n language: window.navigator.language\n }\n }\n });\n } else if (action.type === 'DIRECT_LINE/INCOMING_ACTIVITY') {\n if (action.payload.activity.from.role === 'bot') {\n setNewMessage(true);\n }\n }\n\n return next(action);\n }),\n []\n );\n\n const styleSet = useMemo(\n () =>\n createStyleSet({\n backgroundColor: 'Transparent'\n }),\n []\n );\n\n const [loaded, setLoaded] = useState(false);\n const [minimized, setMinimized] = useState(true);\n const [newMessage, setNewMessage] = useState(false);\n const [side, setSide] = useState('right');\n const [token, setToken] = useState();\n\n // To learn about reconnecting to a conversation, see the following documentation:\n // https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-direct-line-3-0-reconnect-to-conversation?view=azure-bot-service-4.0\n\n const handleFetchToken = useCallback(async () => {\n if (!token) {\n const res = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {\n headers: {\n \"Authorization\": \"Bearer hC2PRl80vWs.ssq3VdeZfsV2iY6DF7lCPag54iNH7nvy00b9fPqoWOk\",\n 'httpAgent': 'new http.Agent({ keepAlive: false })',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/json;charset=UTF-8',\n 'Access-Control-Allow-Origin': '*'\n },\n method: 'POST'\n });\n const { token } = await res.json();\n\n setToken(token);\n }\n }, [setToken, token]);\n\n const handleMaximizeButtonClick = useCallback(async () => {\n setLoaded(true);\n setMinimized(false);\n setNewMessage(false);\n }, [setMinimized, setNewMessage]);\n\n const handleMinimizeButtonClick = useCallback(() => {\n setMinimized(true);\n setNewMessage(false);\n }, [setMinimized, setNewMessage]);\n\n const handleSwitchButtonClick = useCallback(() => {\n setSide(side === 'left' ? 'right' : 'left');\n }, [setSide, side]);\n\n // TODO: [P2] Currently, we cannot unmount Web Chat from DOM when it is minimized.\n // Today, if we unmount it, Web Chat will call disconnect on DirectLineJS object.\n // When minimized, we still want to maintain that connection while the UI is gone.\n // This is related to https://github.com/microsoft/BotFramework-WebChat/issues/2750.\n\n return (\n
\n {minimized && (\n \n )}\n {loaded && (\n
\n
\n
\n \n \n
\n \n
\n )}\n
\n );\n};\n\nexport default MinimizableWebChat;\n","import React from 'react';\n\nimport MinimizableWebChat from './MinimizableWebChat';\nimport './App.css';\n\nconst App = () => (\n
\n \n
\n);\n\nexport default App;","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read http://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.1/8 is considered localhost for IPv4.\n window.location.hostname.match(/^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/)\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit http://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See http://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl)\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (response.status === 404 || (contentType != null && contentType.indexOf('javascript') === -1)) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log('No internet connection found. App is running in offline mode.');\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister();\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(, document.getElementById('root'));\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: http://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}