From 55d3bb7824ca9c1c5d5c9d364ff017220edd72b7 Mon Sep 17 00:00:00 2001 From: shirleyfyx <109609935+shirleyfyx@users.noreply.github.com> Date: Wed, 13 Dec 2023 19:02:33 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20iotum/io?= =?UTF-8?q?tum-samples@a7c05c9043317f39174648bc84083f401883260d=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- asset-manifest.json | 26 +++++++++---------- index.html | 2 +- static/js/197.2d551962.chunk.js | 2 -- static/js/197.2d551962.chunk.js.map | 1 - static/js/197.faf8e74c.chunk.js | 2 ++ static/js/197.faf8e74c.chunk.js.map | 1 + static/js/210.5041c705.chunk.js | 2 -- static/js/210.5041c705.chunk.js.map | 1 - static/js/210.c013c8f4.chunk.js | 2 ++ static/js/210.c013c8f4.chunk.js.map | 1 + static/js/528.06c3a853.chunk.js | 2 -- static/js/528.06c3a853.chunk.js.map | 1 - static/js/528.110ab889.chunk.js | 2 ++ static/js/528.110ab889.chunk.js.map | 1 + static/js/906.56accfd9.chunk.js | 2 -- static/js/906.56accfd9.chunk.js.map | 1 - static/js/906.e43221f2.chunk.js | 2 ++ static/js/906.e43221f2.chunk.js.map | 1 + static/js/935.4d4ca839.chunk.js | 2 -- static/js/935.4d4ca839.chunk.js.map | 1 - static/js/935.cee7ffa5.chunk.js | 2 ++ static/js/935.cee7ffa5.chunk.js.map | 1 + static/js/main.35b37dc1.js | 3 +++ ...CENSE.txt => main.35b37dc1.js.LICENSE.txt} | 0 static/js/main.35b37dc1.js.map | 1 + static/js/main.ed22515c.js | 3 --- static/js/main.ed22515c.js.map | 1 - 27 files changed, 33 insertions(+), 33 deletions(-) delete mode 100644 static/js/197.2d551962.chunk.js delete mode 100644 static/js/197.2d551962.chunk.js.map create mode 100644 static/js/197.faf8e74c.chunk.js create mode 100644 static/js/197.faf8e74c.chunk.js.map delete mode 100644 static/js/210.5041c705.chunk.js delete mode 100644 static/js/210.5041c705.chunk.js.map create mode 100644 static/js/210.c013c8f4.chunk.js create mode 100644 static/js/210.c013c8f4.chunk.js.map delete mode 100644 static/js/528.06c3a853.chunk.js delete mode 100644 static/js/528.06c3a853.chunk.js.map create mode 100644 static/js/528.110ab889.chunk.js create mode 100644 static/js/528.110ab889.chunk.js.map delete mode 100644 static/js/906.56accfd9.chunk.js delete mode 100644 static/js/906.56accfd9.chunk.js.map create mode 100644 static/js/906.e43221f2.chunk.js create mode 100644 static/js/906.e43221f2.chunk.js.map delete mode 100644 static/js/935.4d4ca839.chunk.js delete mode 100644 static/js/935.4d4ca839.chunk.js.map create mode 100644 static/js/935.cee7ffa5.chunk.js create mode 100644 static/js/935.cee7ffa5.chunk.js.map create mode 100644 static/js/main.35b37dc1.js rename static/js/{main.ed22515c.js.LICENSE.txt => main.35b37dc1.js.LICENSE.txt} (100%) create mode 100644 static/js/main.35b37dc1.js.map delete mode 100644 static/js/main.ed22515c.js delete mode 100644 static/js/main.ed22515c.js.map diff --git a/asset-manifest.json b/asset-manifest.json index ae298cf5..c1cd9199 100644 --- a/asset-manifest.json +++ b/asset-manifest.json @@ -1,35 +1,35 @@ { "files": { "main.css": "/iotum-samples/static/css/main.b9a730fe.css", - "main.js": "/iotum-samples/static/js/main.ed22515c.js", + "main.js": "/iotum-samples/static/js/main.35b37dc1.js", "static/css/528.b3d5cfcc.chunk.css": "/iotum-samples/static/css/528.b3d5cfcc.chunk.css", - "static/js/528.06c3a853.chunk.js": "/iotum-samples/static/js/528.06c3a853.chunk.js", + "static/js/528.110ab889.chunk.js": "/iotum-samples/static/js/528.110ab889.chunk.js", "static/css/210.9e4429f7.chunk.css": "/iotum-samples/static/css/210.9e4429f7.chunk.css", - "static/js/210.5041c705.chunk.js": "/iotum-samples/static/js/210.5041c705.chunk.js", + "static/js/210.c013c8f4.chunk.js": "/iotum-samples/static/js/210.c013c8f4.chunk.js", "static/css/906.ac0f205c.chunk.css": "/iotum-samples/static/css/906.ac0f205c.chunk.css", - "static/js/906.56accfd9.chunk.js": "/iotum-samples/static/js/906.56accfd9.chunk.js", + "static/js/906.e43221f2.chunk.js": "/iotum-samples/static/js/906.e43221f2.chunk.js", "static/css/935.f7d4c3a8.chunk.css": "/iotum-samples/static/css/935.f7d4c3a8.chunk.css", - "static/js/935.4d4ca839.chunk.js": "/iotum-samples/static/js/935.4d4ca839.chunk.js", + "static/js/935.cee7ffa5.chunk.js": "/iotum-samples/static/js/935.cee7ffa5.chunk.js", "static/css/197.193aea79.chunk.css": "/iotum-samples/static/css/197.193aea79.chunk.css", - "static/js/197.2d551962.chunk.js": "/iotum-samples/static/js/197.2d551962.chunk.js", + "static/js/197.faf8e74c.chunk.js": "/iotum-samples/static/js/197.faf8e74c.chunk.js", "static/js/74.cd3cee51.chunk.js": "/iotum-samples/static/js/74.cd3cee51.chunk.js", "index.html": "/iotum-samples/index.html", "main.b9a730fe.css.map": "/iotum-samples/static/css/main.b9a730fe.css.map", - "main.ed22515c.js.map": "/iotum-samples/static/js/main.ed22515c.js.map", + "main.35b37dc1.js.map": "/iotum-samples/static/js/main.35b37dc1.js.map", "528.b3d5cfcc.chunk.css.map": "/iotum-samples/static/css/528.b3d5cfcc.chunk.css.map", - "528.06c3a853.chunk.js.map": "/iotum-samples/static/js/528.06c3a853.chunk.js.map", + "528.110ab889.chunk.js.map": "/iotum-samples/static/js/528.110ab889.chunk.js.map", "210.9e4429f7.chunk.css.map": "/iotum-samples/static/css/210.9e4429f7.chunk.css.map", - "210.5041c705.chunk.js.map": "/iotum-samples/static/js/210.5041c705.chunk.js.map", + "210.c013c8f4.chunk.js.map": "/iotum-samples/static/js/210.c013c8f4.chunk.js.map", "906.ac0f205c.chunk.css.map": "/iotum-samples/static/css/906.ac0f205c.chunk.css.map", - "906.56accfd9.chunk.js.map": "/iotum-samples/static/js/906.56accfd9.chunk.js.map", + "906.e43221f2.chunk.js.map": "/iotum-samples/static/js/906.e43221f2.chunk.js.map", "935.f7d4c3a8.chunk.css.map": "/iotum-samples/static/css/935.f7d4c3a8.chunk.css.map", - "935.4d4ca839.chunk.js.map": "/iotum-samples/static/js/935.4d4ca839.chunk.js.map", + "935.cee7ffa5.chunk.js.map": "/iotum-samples/static/js/935.cee7ffa5.chunk.js.map", "197.193aea79.chunk.css.map": "/iotum-samples/static/css/197.193aea79.chunk.css.map", - "197.2d551962.chunk.js.map": "/iotum-samples/static/js/197.2d551962.chunk.js.map", + "197.faf8e74c.chunk.js.map": "/iotum-samples/static/js/197.faf8e74c.chunk.js.map", "74.cd3cee51.chunk.js.map": "/iotum-samples/static/js/74.cd3cee51.chunk.js.map" }, "entrypoints": [ "static/css/main.b9a730fe.css", - "static/js/main.ed22515c.js" + "static/js/main.35b37dc1.js" ] } \ No newline at end of file diff --git a/index.html b/index.html index 4d5ccc10..f601fdfd 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -React App
\ No newline at end of file +React App
\ No newline at end of file diff --git a/static/js/197.2d551962.chunk.js b/static/js/197.2d551962.chunk.js deleted file mode 100644 index 22f9f909..00000000 --- a/static/js/197.2d551962.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[197],{1374:function(n,e,t){t.d(e,{Z:function(){return c}});t(2791);var o=t(7689),r="MenuButton_menuButton__e9oFw",u="MenuButton_left__d8Tih",i="MenuButton_right__fbjxn",a=t(184);var c=function(n){var e=n.position,t=void 0===e?"left":e,c=(0,o.s0)(),s="right"===t?i:u;return(0,a.jsx)("div",{children:(0,a.jsx)("button",{className:"".concat(r," ").concat(s),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),c("/menu")},children:"Menu Page"})})}},4197:function(n,e,t){t.r(e),t.d(e,{default:function(){return m}});var o=t(9439),r=t(2791),u="submitForm_appContainer__B1dgt",i="submitForm_verticalTabContainer__riwi2",a="submitForm_widgetContainer__Vm7kt",c="submitForm_badge__llHLA",s=t(5177),l=t(1374),d=t(9074),h=t(9434),f=t(1348),g=t(184),m=function(){(0,f.Z)();var n=(0,r.useState)(!0),e=(0,o.Z)(n,2),t=e[0],m=e[1],b=(0,r.useState)(0),_=(0,o.Z)(b,2),v=_[0],p=_[1],j=(0,r.useState)(!1),k=(0,o.Z)(j,2),x=k[0],C=k[1],w=(0,r.useState)(!1),T=(0,o.Z)(w,2),A=T[0],E=T[1],Z=(0,r.useRef)(null),D=(0,r.useRef)(null),M=(0,r.useRef)(null),N=(0,h.v9)((function(n){return n.credentials})),S=N.token&&N.domain&&N.hostId,B=function(){M.current&&M.current.toggle(!1),D.current&&D.current.toggle(!1)},R=(0,r.useCallback)((function(){S&&(M.current=new d.Dashboard({domain:N.domain,sso:{token:N.token,hostId:N.hostId},container:Z.current}),M.current.toggle(!1),M.current.on("dashboard.READY",(function(){D.current=new d.Dashboard({domain:N.domain,container:Z.current},"Team"),D.current.toggle(!1),D.current.on("dashboard.UNREAD_MESSAGES",(function(n){var e=Object.values(n.rooms).reduce((function(n,e){return n+e}),0);p(e)})),D.current.on("dashboard.READY",(function(){E(!0),C(!0)}))})))}),[N,S]);(0,r.useEffect)((function(){return S&&R(),function(){B(),console.log("Widget unloaded")}}),[N,R,S]),(0,r.useEffect)((function(){x&&D.current.on("dashboard.NAVIGATE",(function(n){var e="/"!==n.pathname?n.pathname:"an unspecified room";console.log("The chat widget navigated to this room: ".concat(e))}))}),[x]);var F=function(n){B(),""===n?(m(!0),console.log("Load your app")):"Team"===n?(D.current.toggle(!0),m(!1),console.log("Load the team chat widget")):(M.current.toggle(!0),M.current.load(n),m(!1),console.log("Load the ".concat(n," widget")))};return(0,g.jsxs)("div",{className:u,children:[(0,g.jsxs)("div",{className:i,children:[(0,g.jsx)("button",{onClick:function(){return F("")},disabled:!A,children:"Your App"}),(0,g.jsxs)("button",{onClick:function(){return F("Team")},disabled:!A,style:{position:"relative"},children:["Team Chat",v>0&&(0,g.jsx)("span",{className:c,children:v})]}),(0,g.jsx)("button",{onClick:function(){return F("Drive")},disabled:!A,children:"Drive"}),(0,g.jsx)("button",{onClick:function(){return F("Contacts")},disabled:!A,children:"Contacts"})]}),t&&(0,g.jsx)("div",{children:"Your app goes here"}),!A&&(0,g.jsx)("div",{children:"The widgets are loading"}),(0,g.jsx)("div",{ref:Z,className:a}),(0,g.jsx)(s.Z,{position:"right"}),(0,g.jsx)(l.Z,{position:"right"})]})}}}]); -//# sourceMappingURL=197.2d551962.chunk.js.map \ No newline at end of file diff --git a/static/js/197.2d551962.chunk.js.map b/static/js/197.2d551962.chunk.js.map deleted file mode 100644 index 0276bd99..00000000 --- a/static/js/197.2d551962.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/197.2d551962.chunk.js","mappings":"yKACA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBA,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBI,EAAeA,EAE5D,OACEC,EAAAA,EAAAA,KAAA,OAAAC,UACED,EAAAA,EAAAA,KAAA,UAAQE,UAAS,GAAAC,OAAKJ,EAAiB,KAAAI,OAAIL,GAAiBM,QAV5C,WAClBC,QAAQC,IAAI,6CACZV,EAAS,QACX,EAOqFK,SAAC,eAKxF,C,4FCrBA,EAA+E,iCAA/E,EAAuI,yCAAvI,EAAkM,oCAAlM,EAA8O,0B,2DCsI9O,EA/HY,YACVM,EAAAA,EAAAA,KACA,IAAAC,GAAgDC,EAAAA,EAAAA,WAAS,GAAKC,GAAAC,EAAAA,EAAAA,GAAAH,EAAA,GAAvDI,EAAgBF,EAAA,GAAEG,EAAmBH,EAAA,GAC5CI,GAA4CL,EAAAA,EAAAA,UAAS,GAAEM,GAAAJ,EAAAA,EAAAA,GAAAG,EAAA,GAAhDE,EAAcD,EAAA,GAAEE,EAAiBF,EAAA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EW,IAAoBZ,EAAAA,EAAAA,KAAA,OAAAC,SAAK,wBACxBuB,IAAmBxB,EAAAA,EAAAA,KAAA,OAAAC,SAAK,6BAC1BD,EAAAA,EAAAA,KAAA,OAAK+D,IAAKrC,EAAcxB,UAAWH,KACnCC,EAAAA,EAAAA,KAACgE,EAAAA,EAAW,CAACrE,SAAS,WACtBK,EAAAA,EAAAA,KAACiE,EAAAA,EAAU,CAACtE,SAAS,YAG3B,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/tabbed-dashboard/submitForm.module.css?8a8c","pages/tabbed-dashboard/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__I2O9k\",\"appContainer\":\"submitForm_appContainer__B1dgt\",\"verticalTabContainer\":\"submitForm_verticalTabContainer__riwi2\",\"widgetContainer\":\"submitForm_widgetContainer__Vm7kt\",\"badge\":\"submitForm_badge__llHLA\"};","import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\nimport useGuardedRoute from '../../components/hooks/useGuardedRoute';\n\nconst App = () => {\n useGuardedRoute(); // Guard the route\n const [isYourAppVisible, setIsYourAppVisible] = useState(true);\n const [unreadMessages, setUnreadMessages] = useState(0);\n const [isWidgetInitialized, setIsWidgetInitialized] = useState(false);\n const [chatWidgetReady, setChatWidgetReady] = useState(false);\n\n const containerRef = useRef(null);\n const chatWidgetRef = useRef(null);\n const widgetRef = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n\n // Check if all necessary credentials are available\n const areCredentialsValid = credentials.token && credentials.domain && credentials.hostId;\n\n const unloadWidgets = () => {\n if (widgetRef.current) {\n widgetRef.current.toggle(false);\n }\n if (chatWidgetRef.current) {\n chatWidgetRef.current.toggle(false);\n }\n };\n\n const renderWidget = useCallback(() => {\n if (areCredentialsValid) {\n widgetRef.current = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: containerRef.current,\n });\n\n widgetRef.current.toggle(false);\n\n widgetRef.current.on('dashboard.READY', () => {\n chatWidgetRef.current = new Callbridge.Dashboard({\n domain: credentials.domain,\n container: containerRef.current,\n }, \"Team\");\n\n chatWidgetRef.current.toggle(false);\n\n chatWidgetRef.current.on('dashboard.UNREAD_MESSAGES', (data) => {\n const totalUnread = Object.values(data.rooms).reduce((total, count) => total + count, 0);\n setUnreadMessages(totalUnread);\n });\n\n chatWidgetRef.current.on('dashboard.READY', () => {\n setChatWidgetReady(true);\n setIsWidgetInitialized(true);\n });\n });\n }\n }, [credentials, areCredentialsValid]);\n\n useEffect(() => {\n if (areCredentialsValid) {\n renderWidget();\n }\n\n return () => {\n unloadWidgets();\n console.log('Widget unloaded');\n };\n }, [credentials, renderWidget, areCredentialsValid]);\n\n useEffect(() => {\n if (isWidgetInitialized) {\n chatWidgetRef.current.on('dashboard.NAVIGATE', (data) => {\n const room = data.pathname !== '/' ? data.pathname : \"an unspecified room\";\n console.log(`The chat widget navigated to this room: ${room}`);\n });\n }\n }, [isWidgetInitialized]);\n\n const loadWidget = (service) => {\n unloadWidgets(); // Unload any currently displayed widgets\n\n if (service === \"\") {\n setIsYourAppVisible(true);\n console.log(\"Load your app\");\n } else if (service === \"Team\") {\n chatWidgetRef.current.toggle(true);\n setIsYourAppVisible(false);\n console.log(\"Load the team chat widget\");\n } else {\n widgetRef.current.toggle(true);\n widgetRef.current.load(service);\n setIsYourAppVisible(false);\n console.log(`Load the ${service} widget`);\n }\n }\n\n return (\n
\n
\n \n loadWidget('Team')}\n disabled={!chatWidgetReady}\n style={{ position: 'relative' }}\n >\n Team Chat\n {unreadMessages > 0 && {unreadMessages}}\n \n \n \n
\n {isYourAppVisible &&
Your app goes here
}\n {!chatWidgetReady &&
The widgets are loading
}\n
\n \n \n
\n );\n}\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","useGuardedRoute","_useState","useState","_useState2","_slicedToArray","isYourAppVisible","setIsYourAppVisible","_useState3","_useState4","unreadMessages","setUnreadMessages","_useState5","_useState6","isWidgetInitialized","setIsWidgetInitialized","_useState7","_useState8","chatWidgetReady","setChatWidgetReady","containerRef","useRef","chatWidgetRef","widgetRef","credentials","useSelector","state","areCredentialsValid","token","domain","hostId","unloadWidgets","current","toggle","renderWidget","useCallback","Callbridge","sso","container","on","data","totalUnread","Object","values","rooms","reduce","total","count","useEffect","room","pathname","loadWidget","service","load","_jsxs","disabled","style","ref","TokenButton","MenuButton"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/197.faf8e74c.chunk.js b/static/js/197.faf8e74c.chunk.js new file mode 100644 index 00000000..18f8c3f7 --- /dev/null +++ b/static/js/197.faf8e74c.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[197],{1374:function(n,e,t){t.d(e,{Z:function(){return c}});t(2791);var o=t(7689),r="MenuButton_menuButton__e9oFw",u="MenuButton_left__d8Tih",i="MenuButton_right__fbjxn",a=t(184);var c=function(n){var e=n.position,t=void 0===e?"left":e,c=(0,o.s0)(),s="right"===t?i:u;return(0,a.jsx)("div",{children:(0,a.jsx)("button",{className:"".concat(r," ").concat(s),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),c("/iotum-samples/menu")},children:"Menu Page"})})}},4197:function(n,e,t){t.r(e),t.d(e,{default:function(){return g}});var o=t(9439),r=t(2791),u="submitForm_appContainer__B1dgt",i="submitForm_verticalTabContainer__riwi2",a="submitForm_widgetContainer__Vm7kt",c="submitForm_badge__llHLA",s=t(5177),l=t(1374),d=t(9074),h=t(9434),f=t(184),g=function(){var n=(0,r.useState)(!0),e=(0,o.Z)(n,2),t=e[0],g=e[1],m=(0,r.useState)(0),b=(0,o.Z)(m,2),_=b[0],p=b[1],v=(0,r.useState)(!1),j=(0,o.Z)(v,2),k=j[0],x=j[1],C=(0,r.useState)(!1),w=(0,o.Z)(C,2),T=w[0],A=w[1],E=(0,r.useRef)(null),D=(0,r.useRef)(null),M=(0,r.useRef)(null),N=(0,h.v9)((function(n){return n.credentials})),S=function(){M.current&&M.current.toggle(!1),D.current&&D.current.toggle(!1)},Z=(0,r.useCallback)((function(){M.current=new d.Dashboard({domain:N.domain,sso:{token:N.token,hostId:N.hostId},container:E.current}),M.current.toggle(!1),M.current.on("dashboard.READY",(function(){D.current=new d.Dashboard({domain:"iotum.callbridge.rocks",container:E.current},"Team"),D.current.toggle(!1),D.current.on("dashboard.UNREAD_MESSAGES",(function(n){var e=Object.values(n.rooms).reduce((function(n,e){return n+e}),0);p(e)})),D.current.on("dashboard.READY",(function(){A(!0),x(!0)}))}))}),[N]);(0,r.useEffect)((function(){k&&D.current.on("dashboard.NAVIGATE",(function(n){var e="/"!==n.pathname?n.pathname:"an unspecified room";console.log("The chat widget navigated to this room: ".concat(e))}))}),[k]),(0,r.useEffect)((function(){return Z(),function(){S(),console.log("Widget unloaded")}}),[N,Z]);var B=function(n){S(),""===n?(g(!0),console.log("Load your app")):"Team"===n?(D.current.toggle(!0),g(!1),console.log("Load the team chat widget")):(M.current.toggle(!0),M.current.load(n),g(!1),console.log("Load the "+n+" widget"))};return(0,f.jsxs)("div",{className:u,children:[(0,f.jsxs)("div",{className:i,children:[(0,f.jsx)("button",{onClick:function(){return B("")},disabled:!T,children:"Your App"}),(0,f.jsxs)("button",{onClick:function(){return B("Team")},disabled:!T,style:{position:"relative"},children:["Team Chat",_>0&&(0,f.jsx)("span",{className:c,children:_})]}),(0,f.jsx)("button",{onClick:function(){return B("Drive")},disabled:!T,children:"Drive"}),(0,f.jsx)("button",{onClick:function(){return B("Contacts")},disabled:!T,children:"Contacts"})]}),t&&(0,f.jsx)("div",{children:"Your app goes here"}),!T&&(0,f.jsx)("div",{children:"The widgets are loading"}),(0,f.jsx)("div",{ref:E,className:a}),(0,f.jsx)(s.Z,{position:"right"}),(0,f.jsx)(l.Z,{position:"right"})]})}}}]); +//# sourceMappingURL=197.faf8e74c.chunk.js.map \ No newline at end of file diff --git a/static/js/197.faf8e74c.chunk.js.map b/static/js/197.faf8e74c.chunk.js.map new file mode 100644 index 00000000..fbc0639d --- /dev/null +++ b/static/js/197.faf8e74c.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/197.faf8e74c.chunk.js","mappings":"yKACA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBA,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBI,EAAeA,EAE5D,OACEC,EAAAA,EAAAA,KAAA,OAAAC,UACED,EAAAA,EAAAA,KAAA,UAAQE,UAAS,GAAAC,OAAKJ,EAAiB,KAAAI,OAAIL,GAAiBM,QAV5C,WAClBC,QAAQC,IAAI,6CACZV,EAAS,sBACX,EAOqFK,SAAC,eAKxF,C,4FCrBA,EA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AAME,UAAWH,EAAaE,SAAEc,QAEzDf,EAAAA,EAAAA,KAAA,UAAQI,QAAS,kBAAMmD,EAAW,QAAQ,EAAEI,UAAWpC,EAAgBtB,SAAC,WAGxED,EAAAA,EAAAA,KAAA,UAAQI,QAAS,kBAAMmD,EAAW,WAAW,EAAEI,UAAWpC,EAAgBtB,SAAC,gBAI5EU,IAAoBX,EAAAA,EAAAA,KAAA,OAAAC,SAAK,wBACxBsB,IAAmBvB,EAAAA,EAAAA,KAAA,OAAAC,SAAK,6BAC1BD,EAAAA,EAAAA,KAAA,OAAK6D,IAAKpC,EAAcvB,UAAWH,KACnCC,EAAAA,EAAAA,KAAC8D,EAAAA,EAAW,CAACnE,SAAS,WACtBK,EAAAA,EAAAA,KAAC+D,EAAAA,EAAU,CAACpE,SAAS,YAG3B,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/tabbed-dashboard/submitForm.module.css?8a8c","pages/tabbed-dashboard/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/iotum-samples/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__I2O9k\",\"appContainer\":\"submitForm_appContainer__B1dgt\",\"verticalTabContainer\":\"submitForm_verticalTabContainer__riwi2\",\"widgetContainer\":\"submitForm_widgetContainer__Vm7kt\",\"badge\":\"submitForm_badge__llHLA\"};","import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\n\nconst App = () => {\n const [isYourAppVisible, setIsYourAppVisible] = useState(true);\n const [unreadMessages, setUnreadMessages] = useState(0);\n const [isWidgetInitialized, setIsWidgetInitialized] = useState(false);\n const [chatWidgetReady, setChatWidgetReady] = useState(false);\n\n const containerRef = useRef(null);\n const chatWidgetRef = useRef(null);\n const widgetRef = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n\n const unloadWidgets = () => {\n if (widgetRef.current) {\n widgetRef.current.toggle(false);\n }\n if (chatWidgetRef.current) {\n chatWidgetRef.current.toggle(false);\n }\n };\n\n const renderWidget = useCallback(() => {\n widgetRef.current = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: containerRef.current,\n });\n\n widgetRef.current.toggle(false);\n\n widgetRef.current.on('dashboard.READY', () => {\n chatWidgetRef.current = new Callbridge.Dashboard({\n domain: 'iotum.callbridge.rocks',\n container: containerRef.current,\n }, \"Team\");\n\n chatWidgetRef.current.toggle(false);\n\n chatWidgetRef.current.on('dashboard.UNREAD_MESSAGES', (data) => {\n const totalUnread = Object.values(data.rooms).reduce((total, count) => total + count, 0);\n setUnreadMessages(totalUnread);\n });\n\n chatWidgetRef.current.on('dashboard.READY', () => {\n setChatWidgetReady(true);\n setIsWidgetInitialized(true);\n });\n });\n }, [credentials]);\n\n useEffect(() => {\n if (isWidgetInitialized) {\n chatWidgetRef.current.on('dashboard.NAVIGATE', (data) => {\n const room = data.pathname !== '/' ? data.pathname : \"an unspecified room\";\n console.log(`The chat widget navigated to this room: ${room}`);\n });\n }\n }, [isWidgetInitialized]);\n\n useEffect(() => {\n renderWidget();\n\n return () => {\n unloadWidgets();\n console.log('Widget unloaded')\n }\n\n }, [credentials, renderWidget]);\n\n const loadWidget = (service) => {\n unloadWidgets(); // Unload any currently displayed widgets\n\n if(service === \"\") {\n setIsYourAppVisible(true);\n console.log(\"Load your app\");\n } else if (service === \"Team\") {\n chatWidgetRef.current.toggle(true);\n setIsYourAppVisible(false);\n console.log(\"Load the team chat widget\");\n } else {\n widgetRef.current.toggle(true);\n widgetRef.current.load(service);\n setIsYourAppVisible(false);\n console.log(\"Load the \" + service + \" widget\");\n }\n }\n\n return (\n
\n
\n \n loadWidget('Team')}\n disabled={!chatWidgetReady}\n style={{ position: 'relative' }}\n >\n Team Chat\n {unreadMessages > 0 && {unreadMessages}}\n \n \n \n
\n {isYourAppVisible &&
Your app goes here
}\n {!chatWidgetReady &&
The widgets are loading
}\n
\n \n \n
\n );\n}\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","_useState","useState","_useState2","_slicedToArray","isYourAppVisible","setIsYourAppVisible","_useState3","_useState4","unreadMessages","setUnreadMessages","_useState5","_useState6","isWidgetInitialized","setIsWidgetInitialized","_useState7","_useState8","chatWidgetReady","setChatWidgetReady","containerRef","useRef","chatWidgetRef","widgetRef","credentials","useSelector","state","unloadWidgets","current","toggle","renderWidget","useCallback","Callbridge","domain","sso","token","hostId","container","on","data","totalUnread","Object","values","rooms","reduce","total","count","useEffect","room","pathname","loadWidget","service","load","_jsxs","disabled","style","ref","TokenButton","MenuButton"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/210.5041c705.chunk.js b/static/js/210.5041c705.chunk.js deleted file mode 100644 index 6dd6ee7f..00000000 --- a/static/js/210.5041c705.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[210],{1891:function(n,t,o){var a=o(2791),e=o(9434),c=o(9074),i=o(27),r=o(184);t.Z=function(n){var t=(0,a.useRef)(null),o=(0,e.v9)((function(n){return n.credentials}));return(0,a.useEffect)((function(){var a=o.domain||"iotum.callbridge.rocks",e=new c.Dashboard({domain:a,container:t.current},"Team",{layout:"main",pathname:n.path});return console.log("A new chat room was opened: "+n.path),function(){e.unload(),console.log("Chat room was closed: "+n.path)}}),[n.path,o]),(0,r.jsx)("div",{ref:t,className:i.Z.chatRoom})}},1374:function(n,t,o){o.d(t,{Z:function(){return u}});o(2791);var a=o(7689),e="MenuButton_menuButton__e9oFw",c="MenuButton_left__d8Tih",i="MenuButton_right__fbjxn",r=o(184);var u=function(n){var t=n.position,o=void 0===t?"left":t,u=(0,a.s0)(),s="right"===o?i:c;return(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"".concat(e," ").concat(s),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),u("/menu")},children:"Menu Page"})})}},9210:function(n,t,o){o.r(t),o.d(t,{default:function(){return p}});var a=o(1413),e=o(9439),c=o(2791),i=o(9434),r=o(1891),u=o(27),s=o(5177),l=o(1374),h=o(184),m=function(n){var t=n.rooms,o=n.onRoomButtonClick,a=n.onRoomClose;return(0,h.jsxs)("div",{className:u.Z.container,children:[(0,h.jsx)("div",{className:u.Z.roomListContainer,children:t.map((function(n){return(0,h.jsx)("div",{className:u.Z.chatRoomItem,children:(0,h.jsx)("button",{onClick:function(){return o(n.path)},className:n.bool?u.Z.active:"",children:n.name})},n.path)}))}),(0,h.jsxs)("div",{className:u.Z.chatRoomsContainer,children:[t.map((function(n){return n.bool&&(0,h.jsxs)("div",{className:"".concat(u.Z.chatRoom," ").concat(u.Z.activeRoom),children:[(0,h.jsx)(r.Z,{path:n.path}),(0,h.jsx)("button",{className:u.Z.closeButton,onClick:function(){return a(n.path)},children:"x"})]},n.path)})),(0,h.jsx)(s.Z,{position:"right"}),(0,h.jsx)(l.Z,{position:"right"})]})]})},d=o(9074),f=o(1348),p=function(){(0,f.Z)();var n=(0,c.useState)([]),t=(0,e.Z)(n,2),o=t[0],r=t[1],u=(0,c.useRef)(null),s=(0,i.v9)((function(n){return n.credentials})),l=(0,c.useCallback)((function(){u.current=new d.Dashboard({domain:s.domain,sso:{token:s.token,hostId:s.hostId},container:"#chat"},"Team",{layout:"list",pathname:"/"}),u.current.once("dashboard.ROOM_LIST",(function(n){var t=[],o=Object.values(n.rooms).map((function(n){var o=n.accounts.map((function(n){return n.name}));if(1===o.length){var a="".concat(o[0]," (you)");return t.push(o[0]),{name:a,path:n.path,bool:!1}}return{name:o.filter((function(n){return!t.includes(n)})).join(", "),path:n.path,bool:!1}}));r(o)})),u.current.toggle(!1)}),[s]);return(0,c.useEffect)((function(){if(s&&s.token&&s.domain&&s.hostId){var n=setTimeout((function(){l()}),100);return function(){var t;clearTimeout(n),null===(t=u.current)||void 0===t||t.unload()}}}),[s,l]),(0,h.jsxs)("div",{children:[(0,h.jsx)("div",{id:"room-buttons",children:(0,h.jsx)(m,{rooms:o,onRoomButtonClick:function(n){r((function(t){return t.map((function(t){return t.path===n?(0,a.Z)((0,a.Z)({},t),{},{bool:!0}):t}))}))},onRoomClose:function(n){r((function(t){return t.map((function(t){return t.path===n?(0,a.Z)((0,a.Z)({},t),{},{bool:!1}):t}))}))}})}),(0,h.jsx)("div",{id:"chat"})]})}},27:function(n,t){t.Z={container:"chat_container__tPqzb",roomListContainer:"chat_roomListContainer__hpRp3",chatRoomItem:"chat_chatRoomItem__tdDrk",active:"chat_active__YaH2-",chatRoomsContainer:"chat_chatRoomsContainer__Smrg+",chatRoom:"chat_chatRoom__Oon7U",activeRoom:"chat_activeRoom__fmDik",closeButton:"chat_closeButton__v7qtp"}}}]); -//# sourceMappingURL=210.5041c705.chunk.js.map \ No newline at end of file diff --git a/static/js/210.5041c705.chunk.js.map b/static/js/210.5041c705.chunk.js.map deleted file mode 100644 index 1d7bc17c..00000000 --- a/static/js/210.5041c705.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"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AAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAQ9C,GAAI,IAAEE,MAAM,IAASF,CACxD,GAAE,GACJ,EAuEQJ,YArEgB,SAACnB,GACvBwC,GAAY,SAAA4B,GAAS,OAAIA,EAAU9C,KAAI,SAAAC,GACrC,OAAOA,EAAKvB,OAASA,GAAIqE,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAQ9C,GAAI,IAAEE,MAAM,IAAUF,CACzD,GAAE,GACJ,OAoEInB,EAAAA,EAAAA,KAAA,OAAK8D,GAAG,WAGd,C,mBC9FA,KAAgB,UAAY,wBAAwB,kBAAoB,gCAAgC,aAAe,2BAA2B,OAAS,qBAAqB,mBAAqB,iCAAiC,SAAW,uBAAuB,WAAa,yBAAyB,YAAc,0B","sources":["components/ChatRoom/ChatRoom.js","webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","pages/list-widget-ui/ChatRoomList.js","pages/list-widget-ui/App.js","webpack://iotum-samples/./src/components/ChatRoom/chat.module.css?03db"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport { useSelector } from 'react-redux';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport styles from './chat.module.css';\n\nconst ChatRoom = (props) => {\n const chatContainerRef = useRef(null); \n const credentials = useSelector(state => state.credentials)\n\n useEffect(() => {\n // Use the domain from the Redux store, or a default value if not available\n const domain = credentials.domain || 'iotum.callbridge.rocks'\n\n // This code will run after the component has rendered and the chat container is available in the DOM\n const chatRoom = new Callbridge.Dashboard(\n {\n domain: domain,\n container: chatContainerRef.current, // Use the DOM element reference\n },\n 'Team',\n { layout: 'main', pathname: props.path }\n );\n\n console.log(\"A new chat room was opened: \" + props.path);\n\n // Cleanup function to be called when the component unmounts\n return () => {\n chatRoom.unload(); // Replace with actual cleanup method if available\n console.log(\"Chat room was closed: \" + props.path);\n };\n }, [props.path, credentials]); \n\n // Render the chat container reference\n return
;\n};\n\nexport default ChatRoom;\n","// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","import React from 'react';\nimport ChatRoom from '../../components/ChatRoom/ChatRoom.js';\nimport styles from '../../components/ChatRoom/chat.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\n\nconst ChatRoomList = ({ rooms, onRoomButtonClick, onRoomClose }) => {\n return (\n
\n
\n {rooms.map((room) => (\n
\n onRoomButtonClick(room.path)}\n className={room.bool ? styles.active : ''}\n >\n {room.name}\n \n
\n ))}\n
\n
\n {rooms.map((room) =>\n room.bool && (\n
\n \n onRoomClose(room.path)}\n >\n x\n \n
\n )\n )}\n \n \n
\n
\n );\n};\n\nexport default ChatRoomList;","import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport ChatRoomList from './ChatRoomList';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport useGuardedRoute from '../../components/hooks/useGuardedRoute';\n\nconst App = () => {\n useGuardedRoute()\n const [allRooms, setAllRooms] = useState([]);\n const widget = useRef(null);\n\n // Retrieve credentials from Redux store\n const credentials = useSelector(state => state.credentials);\n\n const handleRoomButtonClick = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: true } : room;\n }));\n };\n\n const handleRoomClose = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: false } : room;\n }));\n };\n\n // Define the renderWidget function with useCallback\n const renderWidget = useCallback(() => {\n widget.current = new Callbridge.Dashboard(\n {\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: '#chat',\n },\n 'Team',\n { layout: 'list', pathname: '/'}\n );\n\n widget.current.once('dashboard.ROOM_LIST', (data) => {\n const uniqueAccountNames = [];\n const allRoomsChange = Object.values(data.rooms).map((room) => {\n const accounts = room.accounts.map((account) => account.name);\n \n if (accounts.length === 1) {\n const accountName = `${accounts[0]} (you)`;\n uniqueAccountNames.push(accounts[0]);\n return {\n name: accountName,\n path: room.path,\n bool: false,\n };\n }\n\n const filteredNames = accounts.filter((name) => !uniqueAccountNames.includes(name));\n return {\n name: filteredNames.join(', '),\n path: room.path,\n bool: false,\n };\n });\n\n setAllRooms(allRoomsChange);\n });\n\n widget.current.toggle(false);\n }, [credentials]); \n\n useEffect(() => {\n if (credentials && credentials.token && credentials.domain && credentials.hostId) {\n const timer = setTimeout(() => {\n renderWidget();\n }, 100); // Delay the widget initialization to ensure the DOM element is available\n \n return () => {\n clearTimeout(timer);\n widget.current?.unload();\n };\n }\n }, [credentials, renderWidget]); // useEffect dependencies\n\n return (\n
\n
\n \n
\n
\n
\n );\n};\n\nexport default App;\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"chat_container__tPqzb\",\"roomListContainer\":\"chat_roomListContainer__hpRp3\",\"chatRoomItem\":\"chat_chatRoomItem__tdDrk\",\"active\":\"chat_active__YaH2-\",\"chatRoomsContainer\":\"chat_chatRoomsContainer__Smrg+\",\"chatRoom\":\"chat_chatRoom__Oon7U\",\"activeRoom\":\"chat_activeRoom__fmDik\",\"closeButton\":\"chat_closeButton__v7qtp\"};"],"names":["props","chatContainerRef","useRef","credentials","useSelector","state","useEffect","domain","chatRoom","Callbridge","container","current","layout","pathname","path","console","log","unload","_jsx","ref","className","styles","_ref","_ref$position","position","navigate","useNavigate","positionClass","children","concat","onClick","rooms","onRoomButtonClick","onRoomClose","_jsxs","roomListContainer","map","room","chatRoomItem","bool","active","name","chatRoomsContainer","activeRoom","ChatRoom","closeButton","TokenButton","MenuButton","useGuardedRoute","_useState","useState","_useState2","_slicedToArray","allRooms","setAllRooms","widget","renderWidget","useCallback","sso","token","hostId","once","data","uniqueAccountNames","allRoomsChange","Object","values","accounts","account","length","accountName","push","filter","includes","join","toggle","timer","setTimeout","_widget$current","clearTimeout","id","ChatRoomList","prevRooms","_objectSpread"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/210.c013c8f4.chunk.js b/static/js/210.c013c8f4.chunk.js new file mode 100644 index 00000000..90dfaac8 --- /dev/null +++ b/static/js/210.c013c8f4.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[210],{1891:function(n,t,o){var a=o(2791),e=o(9074),c=o(27),i=o(184);t.Z=function(n){var t=(0,a.useRef)(null);return(0,a.useEffect)((function(){var o=new e.Dashboard({domain:"iotum.callbridge.rocks",container:t.current},"Team",{layout:"main",pathname:n.path});return console.log("A new chat room was opened: "+n.path),function(){o.unload(),console.log("Chat room was closed: "+n.path)}}),[n.path]),(0,i.jsx)("div",{ref:t,className:c.Z.chatRoom})}},1374:function(n,t,o){o.d(t,{Z:function(){return u}});o(2791);var a=o(7689),e="MenuButton_menuButton__e9oFw",c="MenuButton_left__d8Tih",i="MenuButton_right__fbjxn",r=o(184);var u=function(n){var t=n.position,o=void 0===t?"left":t,u=(0,a.s0)(),s="right"===o?i:c;return(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"".concat(e," ").concat(s),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),u("/iotum-samples/menu")},children:"Menu Page"})})}},9210:function(n,t,o){o.r(t),o.d(t,{default:function(){return f}});var a=o(1413),e=o(9439),c=o(2791),i=o(9434),r=o(1891),u=o(27),s=o(5177),l=o(1374),m=o(184),h=function(n){var t=n.rooms,o=n.onRoomButtonClick,a=n.onRoomClose;return(0,m.jsxs)("div",{className:u.Z.container,children:[(0,m.jsx)("div",{className:u.Z.roomListContainer,children:t.map((function(n){return(0,m.jsx)("div",{className:u.Z.chatRoomItem,children:(0,m.jsx)("button",{onClick:function(){return o(n.path)},className:n.bool?u.Z.active:"",children:n.name})},n.path)}))}),(0,m.jsxs)("div",{className:u.Z.chatRoomsContainer,children:[t.map((function(n){return n.bool&&(0,m.jsxs)("div",{className:"".concat(u.Z.chatRoom," ").concat(u.Z.activeRoom),children:[(0,m.jsx)(r.Z,{path:n.path}),(0,m.jsx)("button",{className:u.Z.closeButton,onClick:function(){return a(n.path)},children:"x"})]},n.path)})),(0,m.jsx)(s.Z,{position:"right"}),(0,m.jsx)(l.Z,{position:"right"})]})]})},d=o(9074),f=function(){var n=(0,c.useState)([]),t=(0,e.Z)(n,2),o=t[0],r=t[1],u=(0,c.useRef)(null),s=(0,i.v9)((function(n){return n.credentials})),l=(0,c.useCallback)((function(){u.current=new d.Dashboard({domain:s.domain,sso:{token:s.token,hostId:s.hostId},container:"#chat"},"Team",{layout:"list",pathname:"/"}),u.current.once("dashboard.ROOM_LIST",(function(n){var t=[],o=Object.values(n.rooms).map((function(n){var o=n.accounts.map((function(n){return n.name}));if(1===o.length){var a="".concat(o[0]," (you)");return t.push(o[0]),{name:a,path:n.path,bool:!1}}return{name:o.filter((function(n){return!t.includes(n)})).join(", "),path:n.path,bool:!1}}));r(o)})),u.current.toggle(!1)}),[s]);return(0,c.useEffect)((function(){if(s&&s.token&&s.domain&&s.hostId){var n=setTimeout((function(){l()}),100);return function(){var t;clearTimeout(n),null===(t=u.current)||void 0===t||t.unload()}}}),[s,l]),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{id:"room-buttons",children:(0,m.jsx)(h,{rooms:o,onRoomButtonClick:function(n){r((function(t){return t.map((function(t){return t.path===n?(0,a.Z)((0,a.Z)({},t),{},{bool:!0}):t}))}))},onRoomClose:function(n){r((function(t){return t.map((function(t){return t.path===n?(0,a.Z)((0,a.Z)({},t),{},{bool:!1}):t}))}))}})}),(0,m.jsx)("div",{id:"chat"})]})}},27:function(n,t){t.Z={container:"chat_container__tPqzb",roomListContainer:"chat_roomListContainer__hpRp3",chatRoomItem:"chat_chatRoomItem__tdDrk",active:"chat_active__YaH2-",chatRoomsContainer:"chat_chatRoomsContainer__Smrg+",chatRoom:"chat_chatRoom__Oon7U",activeRoom:"chat_activeRoom__fmDik",closeButton:"chat_closeButton__v7qtp"}}}]); +//# sourceMappingURL=210.c013c8f4.chunk.js.map \ No newline at end of file diff --git a/static/js/210.c013c8f4.chunk.js.map b/static/js/210.c013c8f4.chunk.js.map new file mode 100644 index 00000000..31c669e9 --- /dev/null +++ b/static/js/210.c013c8f4.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/210.c013c8f4.chunk.js","mappings":"4JA+BA,IA3BiB,SAACA,GAChB,IAAMC,GAAmBC,EAAAA,EAAAA,QAAO,MAuBhC,OArBAC,EAAAA,EAAAA,YAAU,WAER,IAAMC,EAAW,IAAIC,EAAAA,UACnB,CACEC,OAAQ,yBACRC,UAAWN,EAAiBO,SAE9B,OACA,CAAEC,OAAQ,OAAQC,SAAUV,EAAMW,OAMpC,OAHAC,QAAQC,IAAI,+BAAiCb,EAAMW,MAG5C,WACLP,EAASU,SACTF,QAAQC,IAAI,yBAA2Bb,EAAMW,KAC/C,CACF,GAAG,CAACX,EAAMW,QAGHI,EAAAA,EAAAA,KAAA,OAAKC,IAAKf,EAAkBgB,UAAWC,EAAAA,EAAOd,UACvD,C,6EC5BA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBe,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBH,EAAeA,EAE5D,OACEH,EAAAA,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AG,KAEH,OAAO,WAAO,IAADsB,EACXC,aAAaH,GACC,QAAdE,EAAA1B,EAAO3C,eAAO,IAAAqE,GAAdA,EAAgB/D,QAClB,CACF,CACF,GAAG,CAACsC,EAAaG,KAGfxB,EAAAA,EAAAA,MAAA,OAAAN,SAAA,EACEV,EAAAA,EAAAA,KAAA,OAAKgE,GAAG,eAActD,UACpBV,EAAAA,EAAAA,KAACiE,EAAY,CACXpD,MAAOqB,EACPpB,kBA1EsB,SAAClB,GAC7BuC,GAAY,SAAA+B,GAAS,OAAIA,EAAUhD,KAAI,SAAAC,GACrC,OAAOA,EAAKvB,OAASA,GAAIuE,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAQhD,GAAI,IAAEE,MAAM,IAASF,CACxD,GAAE,GACJ,EAuEQJ,YArEgB,SAACnB,GACvBuC,GAAY,SAAA+B,GAAS,OAAIA,EAAUhD,KAAI,SAAAC,GACrC,OAAOA,EAAKvB,OAASA,GAAIuE,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAQhD,GAAI,IAAEE,MAAM,IAAUF,CACzD,GAAE,GACJ,OAoEInB,EAAAA,EAAAA,KAAA,OAAKgE,GAAG,WAGd,C,mBC5FA,KAAgB,UAAY,wBAAwB,kBAAoB,gCAAgC,aAAe,2BAA2B,OAAS,qBAAqB,mBAAqB,iCAAiC,SAAW,uBAAuB,WAAa,yBAAyB,YAAc,0B","sources":["components/ChatRoom/ChatRoom.js","webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","pages/list-widget-ui/ChatRoomList.js","pages/list-widget-ui/App.js","webpack://iotum-samples/./src/components/ChatRoom/chat.module.css?03db"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport styles from './chat.module.css';\n\nconst ChatRoom = (props) => {\n const chatContainerRef = useRef(null); \n\n useEffect(() => {\n // This code will run after the component has rendered and the chat container is available in the DOM\n const chatRoom = new Callbridge.Dashboard(\n {\n domain: 'iotum.callbridge.rocks',\n container: chatContainerRef.current, // Use the DOM element reference\n },\n 'Team',\n { layout: 'main', pathname: props.path }\n );\n\n console.log(\"A new chat room was opened: \" + props.path);\n\n // Cleanup function to be called when the component unmounts\n return () => {\n chatRoom.unload(); // Replace with actual cleanup method if available\n console.log(\"Chat room was closed: \" + props.path);\n };\n }, [props.path]); \n\n // Render the chat container reference\n return
;\n};\n\nexport default ChatRoom;\n","// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/iotum-samples/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","import React from 'react';\nimport ChatRoom from '../../components/ChatRoom/ChatRoom.js';\nimport styles from '../../components/ChatRoom/chat.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\n\nconst ChatRoomList = ({ rooms, onRoomButtonClick, onRoomClose }) => {\n return (\n
\n
\n {rooms.map((room) => (\n
\n onRoomButtonClick(room.path)}\n className={room.bool ? styles.active : ''}\n >\n {room.name}\n \n
\n ))}\n
\n
\n {rooms.map((room) =>\n room.bool && (\n
\n \n onRoomClose(room.path)}\n >\n x\n \n
\n )\n )}\n \n \n
\n
\n );\n};\n\nexport default ChatRoomList;","import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport ChatRoomList from './ChatRoomList';\nimport * as Callbridge from '@iotum/callbridge-js';\n\nconst App = () => {\n const [allRooms, setAllRooms] = useState([]);\n const widget = useRef(null);\n\n // Retrieve credentials from Redux store\n const credentials = useSelector(state => state.credentials);\n\n const handleRoomButtonClick = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: true } : room;\n }));\n };\n\n const handleRoomClose = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: false } : room;\n }));\n };\n\n // Define the renderWidget function with useCallback\n const renderWidget = useCallback(() => {\n widget.current = new Callbridge.Dashboard(\n {\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: '#chat',\n },\n 'Team',\n { layout: 'list', pathname: '/'}\n );\n\n widget.current.once('dashboard.ROOM_LIST', (data) => {\n const uniqueAccountNames = [];\n const allRoomsChange = Object.values(data.rooms).map((room) => {\n const accounts = room.accounts.map((account) => account.name);\n \n if (accounts.length === 1) {\n const accountName = `${accounts[0]} (you)`;\n uniqueAccountNames.push(accounts[0]);\n return {\n name: accountName,\n path: room.path,\n bool: false,\n };\n }\n\n const filteredNames = accounts.filter((name) => !uniqueAccountNames.includes(name));\n return {\n name: filteredNames.join(', '),\n path: room.path,\n bool: false,\n };\n });\n\n setAllRooms(allRoomsChange);\n });\n\n widget.current.toggle(false);\n }, [credentials]); \n\n useEffect(() => {\n if (credentials && credentials.token && credentials.domain && credentials.hostId) {\n const timer = setTimeout(() => {\n renderWidget();\n }, 100); // Delay the widget initialization to ensure the DOM element is available\n \n return () => {\n clearTimeout(timer);\n widget.current?.unload();\n };\n }\n }, [credentials, renderWidget]); // useEffect dependencies\n\n return (\n
\n
\n \n
\n
\n
\n );\n};\n\nexport default App;\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"chat_container__tPqzb\",\"roomListContainer\":\"chat_roomListContainer__hpRp3\",\"chatRoomItem\":\"chat_chatRoomItem__tdDrk\",\"active\":\"chat_active__YaH2-\",\"chatRoomsContainer\":\"chat_chatRoomsContainer__Smrg+\",\"chatRoom\":\"chat_chatRoom__Oon7U\",\"activeRoom\":\"chat_activeRoom__fmDik\",\"closeButton\":\"chat_closeButton__v7qtp\"};"],"names":["props","chatContainerRef","useRef","useEffect","chatRoom","Callbridge","domain","container","current","layout","pathname","path","console","log","unload","_jsx","ref","className","styles","_ref","_ref$position","position","navigate","useNavigate","positionClass","children","concat","onClick","rooms","onRoomButtonClick","onRoomClose","_jsxs","roomListContainer","map","room","chatRoomItem","bool","active","name","chatRoomsContainer","activeRoom","ChatRoom","closeButton","TokenButton","MenuButton","_useState","useState","_useState2","_slicedToArray","allRooms","setAllRooms","widget","credentials","useSelector","state","renderWidget","useCallback","sso","token","hostId","once","data","uniqueAccountNames","allRoomsChange","Object","values","accounts","account","length","accountName","push","filter","includes","join","toggle","timer","setTimeout","_widget$current","clearTimeout","id","ChatRoomList","prevRooms","_objectSpread"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/528.06c3a853.chunk.js b/static/js/528.06c3a853.chunk.js deleted file mode 100644 index f41bb895..00000000 --- a/static/js/528.06c3a853.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[528],{1891:function(n,t,o){var e=o(2791),a=o(9434),r=o(9074),c=o(27),i=o(184);t.Z=function(n){var t=(0,e.useRef)(null),o=(0,a.v9)((function(n){return n.credentials}));return(0,e.useEffect)((function(){var e=o.domain||"iotum.callbridge.rocks",a=new r.Dashboard({domain:e,container:t.current},"Team",{layout:"main",pathname:n.path});return console.log("A new chat room was opened: "+n.path),function(){a.unload(),console.log("Chat room was closed: "+n.path)}}),[n.path,o]),(0,i.jsx)("div",{ref:t,className:c.Z.chatRoom})}},1374:function(n,t,o){o.d(t,{Z:function(){return u}});o(2791);var e=o(7689),a="MenuButton_menuButton__e9oFw",r="MenuButton_left__d8Tih",c="MenuButton_right__fbjxn",i=o(184);var u=function(n){var t=n.position,o=void 0===t?"left":t,u=(0,e.s0)(),s="right"===o?c:r;return(0,i.jsx)("div",{children:(0,i.jsx)("button",{className:"".concat(a," ").concat(s),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),u("/menu")},children:"Menu Page"})})}},5528:function(n,t,o){o.r(t),o.d(t,{App:function(){return v},default:function(){return g}});var e=o(1413),a=o(9439),r=o(2791),c=o(9434),i=o(1891),u=o(27),s=o(5177),l=o(1374),h=o(184),m=function(n){var t=n.rooms,o=n.onRoomClose;return(0,h.jsxs)("div",{className:u.Z.chatRoomsContainer,children:[t.map((function(n){return n.bool&&(0,h.jsxs)("div",{className:"".concat(u.Z.chatRoom," ").concat(u.Z.activeRoom),children:[(0,h.jsx)(i.Z,{path:n.path}),(0,h.jsx)("button",{className:u.Z.closeButton,onClick:function(){return o(n.path)},children:"x"})]},n.path)})),(0,h.jsx)(s.Z,{position:"right"}),(0,h.jsx)(l.Z,{position:"right"})]})},d="submitForm_container__iv0mm",f="submitForm_roomListContainer__8I4zt",_=o(9074),p=o(1348),v=function(){(0,p.Z)();var n=(0,r.useState)([]),t=(0,a.Z)(n,2),o=t[0],i=t[1],u=(0,r.useRef)(null),s=(0,c.v9)((function(n){return n.credentials}));console.log("Credentials:",s);var l=(0,r.useCallback)((function(){console.log("renderWidget ran"),u.current=new _.Dashboard({domain:s.domain,sso:{token:s.token,hostId:s.hostId},container:"#chat"},"Team",{layout:"list",pathname:"/"}),console.log("dashboard rendered"),u.current.once("dashboard.ROOM_LIST",(function(n){var t=[],o=Object.values(n.rooms).map((function(n){var o=n.accounts.map((function(n){return n.name}));if(1===o.length){var e="".concat(o[0]," (you)");return t.push(o[0]),{name:e,path:n.path,bool:!1}}return{name:o.filter((function(n){return!t.includes(n)})).join(", "),path:n.path,bool:!1}}));i(o)})),u.current.on("dashboard.NAVIGATE",(function(n){var t;"/"!==n.pathname&&(u.current.load("Team",{layout:"list"}),console.log("There was a navigate event to "+n.pathname+" in the list widget and the list widget was reloaded")),t=n.pathname,i((function(n){return n.map((function(n){return n.path===t?(0,e.Z)((0,e.Z)({},n),{},{bool:!0}):n}))}))})),u.current.on("dashboard.READY",(function(){console.log("The list widget was rendered")}))}),[s]);return(0,r.useEffect)((function(){return s&&s.token&&s.domain&&s.hostId&&l(s),function(){var n;null===(n=u.current)||void 0===n||n.unload()}}),[s,l]),(0,h.jsxs)("div",{className:d,children:[(0,h.jsx)("div",{id:"chat",className:f}),(0,h.jsx)("div",{children:(0,h.jsx)(m,{rooms:o,onRoomClose:function(n){console.log(n+" was closed"),i((function(t){return t.map((function(t){return t.path===n?(0,e.Z)((0,e.Z)({},t),{},{bool:!1}):t}))}))}})})]})},g=v},27:function(n,t){t.Z={container:"chat_container__tPqzb",roomListContainer:"chat_roomListContainer__hpRp3",chatRoomItem:"chat_chatRoomItem__tdDrk",active:"chat_active__YaH2-",chatRoomsContainer:"chat_chatRoomsContainer__Smrg+",chatRoom:"chat_chatRoom__Oon7U",activeRoom:"chat_activeRoom__fmDik",closeButton:"chat_closeButton__v7qtp"}}}]); -//# sourceMappingURL=528.06c3a853.chunk.js.map \ No newline at end of file diff --git a/static/js/528.06c3a853.chunk.js.map b/static/js/528.06c3a853.chunk.js.map deleted file mode 100644 index ec331ed1..00000000 --- a/static/js/528.06c3a853.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/528.06c3a853.chunk.js","mappings":"sKAoCA,IA/BiB,SAACA,GAChB,IAAMC,GAAmBC,EAAAA,EAAAA,QAAO,MAC1BC,GAAcC,EAAAA,EAAAA,KAAY,SAAAC,GAAK,OAAIA,EAAMF,WAAW,IA0B1D,OAxBAG,EAAAA,EAAAA,YAAU,WAER,IAAMC,EAASJ,EAAYI,QAAU,yBAG/BC,EAAW,IAAIC,EAAAA,UACnB,CACEF,OAAQA,EACRG,UAAWT,EAAiBU,SAE9B,OACA,CAAEC,OAAQ,OAAQC,SAAUb,EAAMc,OAMpC,OAHAC,QAAQC,IA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Room/ChatRoom.js","webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","pages/chat-room-list/ChatRoomList.js","webpack://iotum-samples/./src/pages/chat-room-list/submitForm.module.css?5027","pages/chat-room-list/App.js","webpack://iotum-samples/./src/components/ChatRoom/chat.module.css?03db"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport { useSelector } from 'react-redux';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport styles from './chat.module.css';\n\nconst ChatRoom = (props) => {\n const chatContainerRef = useRef(null); \n const credentials = useSelector(state => state.credentials)\n\n useEffect(() => {\n // Use the domain from the Redux store, or a default value if not available\n const domain = credentials.domain || 'iotum.callbridge.rocks'\n\n // This code will run after the component has rendered and the chat container is available in the DOM\n const chatRoom = new Callbridge.Dashboard(\n {\n domain: domain,\n container: chatContainerRef.current, // Use the DOM element reference\n },\n 'Team',\n { layout: 'main', pathname: props.path }\n );\n\n console.log(\"A new chat room was opened: \" + props.path);\n\n // Cleanup function to be called when the component unmounts\n return () => {\n chatRoom.unload(); // Replace with actual cleanup method if available\n console.log(\"Chat room was closed: \" + props.path);\n };\n }, [props.path, credentials]); \n\n // Render the chat container reference\n return
;\n};\n\nexport default ChatRoom;\n","// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","import React from 'react';\nimport ChatRoom from '../../components/ChatRoom/ChatRoom.js';\nimport styles from '../../components/ChatRoom/chat.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\n\nconst ChatRoomList = ({ rooms, onRoomClose }) => {\n return (\n
\n {rooms.map((room) =>\n room.bool && (\n
\n \n onRoomClose(room.path)}\n >\n x\n \n
\n )\n )}\n \n \n
\n );\n};\n\nexport default ChatRoomList;","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__Zc6Zy\",\"container\":\"submitForm_container__iv0mm\",\"roomListContainer\":\"submitForm_roomListContainer__8I4zt\"};","import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport ChatRoomList from './ChatRoomList';\nimport styles from './submitForm.module.css';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport useGuardedRoute from '../../components/hooks/useGuardedRoute';\n\nexport const App = () => {\n useGuardedRoute()\n const [allRooms, setAllRooms] = useState([]);\n const widget = useRef(null);\n \n // Retrive credentials from Redux store\n const credentials = useSelector(state => state.credentials);\n console.log(\"Credentials:\", credentials);\n\n const handleRoomButtonClick = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: true } : room;\n }));\n };\n\n const handleRoomClose = (path) => {\n console.log(path + \" was closed\");\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: false } : room;\n }));\n };\n\n const renderWidget = useCallback(() => {\n console.log(\"renderWidget ran\");\n widget.current = new Callbridge.Dashboard(\n {\n domain: credentials.domain, // using the state variable for domain\n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: '#chat',\n },\n 'Team',\n { layout: 'list', pathname: '/'}\n );\n console.log(\"dashboard rendered\");\n\n widget.current.once('dashboard.ROOM_LIST', (data) => {\n const uniqueAccountNames = []; // To keep track of account names that should have \"(you)\" added\n const allRoomsChange = Object.values(data.rooms).map((room) => {\n const accounts = room.accounts.map((account) => account.name);\n \n // Check if the room has only one account\n if (accounts.length === 1) {\n const accountName = `${accounts[0]} (you)`;\n uniqueAccountNames.push(accounts[0]); // Add the account name to the unique list\n return {\n name: accountName,\n path: room.path,\n bool: false,\n };\n }\n \n // Filter out account names that are in the unique list\n const filteredNames = accounts.filter((name) => !uniqueAccountNames.includes(name));\n return {\n name: filteredNames.join(', '),\n path: room.path,\n bool: false,\n };\n });\n \n setAllRooms(allRoomsChange);\n });\n\n widget.current.on('dashboard.NAVIGATE', (data) => {\n if (data.pathname !== \"/\") {\n widget.current.load(\"Team\", {layout: \"list\"})\n console.log(\"There was a navigate event to \" + data.pathname + \" in the list widget and the list widget was reloaded\");\n } \n\n handleRoomButtonClick(data.pathname);\n }\n )\n\n widget.current.on('dashboard.READY', () => {\n console.log(\"The list widget was rendered\");\n });\n }, [credentials]);\n\n useEffect(() => {\n if (credentials && credentials.token && credentials.domain && credentials.hostId) {\n renderWidget(credentials);\n }\n\n return () => {\n widget.current?.unload();\n }\n }, [credentials, renderWidget]);\n \n return (\n
\n
\n
\n \n
\n
\n );\n \n};\n\nexport default App;\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"chat_container__tPqzb\",\"roomListContainer\":\"chat_roomListContainer__hpRp3\",\"chatRoomItem\":\"chat_chatRoomItem__tdDrk\",\"active\":\"chat_active__YaH2-\",\"chatRoomsContainer\":\"chat_chatRoomsContainer__Smrg+\",\"chatRoom\":\"chat_chatRoom__Oon7U\",\"activeRoom\":\"chat_activeRoom__fmDik\",\"closeButton\":\"chat_closeButton__v7qtp\"};"],"names":["props","chatContainerRef","useRef","credentials","useSelector","state","useEffect","domain","chatRoom","Callbridge","container","current","layout","pathname","path","console","log","unload","_jsx","ref","className","styles","_ref","_ref$position","position","navigate","useNavigate","positionClass","children","concat","onClick","rooms","onRoomClose","_jsxs","chatRoomsContainer","map","room","bool","activeRoom","ChatRoom","closeButton","TokenButton","MenuButton","App","useGuardedRoute","_useState","useState","_useState2","_slicedToArray","allRooms","setAllRooms","widget","renderWidget","useCallback","sso","token","hostId","once","data","uniqueAccountNames","allRoomsChange","Object","values","accounts","account","name","length","accountName","push","filter","includes","join","on","load","prevRooms","_objectSpread","_widget$current","id","ChatRoomList"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/528.110ab889.chunk.js b/static/js/528.110ab889.chunk.js new file mode 100644 index 00000000..5d7e297c --- /dev/null +++ b/static/js/528.110ab889.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[528],{1891:function(n,o,t){var e=t(2791),a=t(9074),r=t(27),c=t(184);o.Z=function(n){var o=(0,e.useRef)(null);return(0,e.useEffect)((function(){var t=new a.Dashboard({domain:"iotum.callbridge.rocks",container:o.current},"Team",{layout:"main",pathname:n.path});return console.log("A new chat room was opened: "+n.path),function(){t.unload(),console.log("Chat room was closed: "+n.path)}}),[n.path]),(0,c.jsx)("div",{ref:o,className:r.Z.chatRoom})}},1374:function(n,o,t){t.d(o,{Z:function(){return s}});t(2791);var e=t(7689),a="MenuButton_menuButton__e9oFw",r="MenuButton_left__d8Tih",c="MenuButton_right__fbjxn",i=t(184);var s=function(n){var o=n.position,t=void 0===o?"left":o,s=(0,e.s0)(),u="right"===t?c:r;return(0,i.jsx)("div",{children:(0,i.jsx)("button",{className:"".concat(a," ").concat(u),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),s("/iotum-samples/menu")},children:"Menu Page"})})}},5528:function(n,o,t){t.r(o),t.d(o,{App:function(){return p},default:function(){return v}});var e=t(1413),a=t(9439),r=t(2791),c=t(9434),i=t(1891),s=t(27),u=t(5177),l=t(1374),h=t(184),m=function(n){var o=n.rooms,t=n.onRoomClose;return(0,h.jsxs)("div",{className:s.Z.chatRoomsContainer,children:[o.map((function(n){return n.bool&&(0,h.jsxs)("div",{className:"".concat(s.Z.chatRoom," ").concat(s.Z.activeRoom),children:[(0,h.jsx)(i.Z,{path:n.path}),(0,h.jsx)("button",{className:s.Z.closeButton,onClick:function(){return t(n.path)},children:"x"})]},n.path)})),(0,h.jsx)(u.Z,{position:"right"}),(0,h.jsx)(l.Z,{position:"right"})]})},d="submitForm_container__iv0mm",f="submitForm_roomListContainer__8I4zt",_=t(9074),p=function(){var n=(0,r.useState)([]),o=(0,a.Z)(n,2),t=o[0],i=o[1],s=(0,r.useRef)(null),u=(0,c.v9)((function(n){return n.credentials}));console.log("Credentials:",u);var l=(0,r.useCallback)((function(){console.log("renderWidget ran"),s.current=new _.Dashboard({domain:u.domain,sso:{token:u.token,hostId:u.hostId},container:"#chat"},"Team",{layout:"list",pathname:"/"}),console.log("dashboard rendered"),s.current.once("dashboard.ROOM_LIST",(function(n){var o=[],t=Object.values(n.rooms).map((function(n){var t=n.accounts.map((function(n){return n.name}));if(1===t.length){var e="".concat(t[0]," (you)");return o.push(t[0]),{name:e,path:n.path,bool:!1}}return{name:t.filter((function(n){return!o.includes(n)})).join(", "),path:n.path,bool:!1}}));i(t)})),s.current.on("dashboard.NAVIGATE",(function(n){var o;"/"!==n.pathname&&(s.current.load("Team",{layout:"list"}),console.log("There was a navigate event to "+n.pathname+" in the list widget and the list widget was reloaded")),o=n.pathname,i((function(n){return n.map((function(n){return n.path===o?(0,e.Z)((0,e.Z)({},n),{},{bool:!0}):n}))}))})),s.current.on("dashboard.READY",(function(){console.log("The list widget was rendered")}))}),[u]);return(0,r.useEffect)((function(){return u&&u.token&&u.domain&&u.hostId&&l(u),function(){var n;null===(n=s.current)||void 0===n||n.unload()}}),[u,l]),(0,h.jsxs)("div",{className:d,children:[(0,h.jsx)("div",{id:"chat",className:f}),(0,h.jsx)("div",{children:(0,h.jsx)(m,{rooms:t,onRoomClose:function(n){console.log(n+" was closed"),i((function(o){return o.map((function(o){return o.path===n?(0,e.Z)((0,e.Z)({},o),{},{bool:!1}):o}))}))}})})]})},v=p},27:function(n,o){o.Z={container:"chat_container__tPqzb",roomListContainer:"chat_roomListContainer__hpRp3",chatRoomItem:"chat_chatRoomItem__tdDrk",active:"chat_active__YaH2-",chatRoomsContainer:"chat_chatRoomsContainer__Smrg+",chatRoom:"chat_chatRoom__Oon7U",activeRoom:"chat_activeRoom__fmDik",closeButton:"chat_closeButton__v7qtp"}}}]); +//# sourceMappingURL=528.110ab889.chunk.js.map \ No newline at end of file diff --git a/static/js/528.110ab889.chunk.js.map b/static/js/528.110ab889.chunk.js.map new file mode 100644 index 00000000..837c3a34 --- /dev/null +++ b/static/js/528.110ab889.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/528.110ab889.chunk.js","mappings":"4JA+BA,IA3BiB,SAACA,GAChB,IAAMC,GAAmBC,EAAAA,EAAAA,QAAO,MAuBhC,OArBAC,EAAAA,EAAAA,YAAU,WAER,IAAMC,EAAW,IAAIC,EAAAA,UACnB,CACEC,OAAQ,yBACRC,UAAWN,EAAiBO,SAE9B,OACA,CAAEC,OAAQ,OAAQC,SAAUV,EAAMW,OAMpC,OAHAC,QAAQC,IAAI,+BAAiCb,EAAMW,MAG5C,WACLP,EAASU,SACTF,QAAQC,IAAI,yBAA2Bb,EAAMW,KAC/C,CACF,GAAG,CAACX,EAAMW,QAGHI,EAAAA,EAAAA,KAAA,OAAKC,IAAKf,EAAkBgB,UAAWC,EAAAA,EAAOd,UACvD,C,6EC5BA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBe,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBH,EAAeA,EAE5D,OACEH,EAAAA,EAAAA,KAAA,OAAAU,UACEV,EAAAA,EAAAA,KAAA,UAAQE,UAAS,GAAAS,OAAKR,EAAiB,KAAAQ,OAAIF,GAAiBG,QAV5C,WAClBf,QAAQC,IAAI,6CACZS,EAAS,sBACX,EAOqFG,SAAC,eAKxF,C,wLCMA,EAtBqB,S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rB,EAAAA,EAAAA,MAAA,OAAKb,UAAWC,EAAiBO,SAAA,EAC/BV,EAAAA,EAAAA,KAAA,OAAK6D,GAAG,OAAO3D,UAAWC,KAC1BH,EAAAA,EAAAA,KAAA,OAAAU,UACEV,EAAAA,EAAAA,KAAC8D,EAAY,CAACjD,MAAOiB,EAAUhB,YAhFb,SAAClB,GACvBC,QAAQC,IAAIF,EAAO,eACnBmC,GAAY,SAAA2B,GAAS,OAAIA,EAAUzC,KAAI,SAAAC,GACrC,OAAOA,EAAKtB,OAASA,GAAI+D,EAAAA,EAAAA,IAAAA,EAAAA,EAAAA,GAAA,GAAQzC,GAAI,IAAEC,MAAM,IAAUD,CACzD,GAAE,GACJ,QAgFF,EAEA,G,mBC1GA,KAAgB,UAAY,wBAAwB,kBAAoB,gCAAgC,aAAe,2BAA2B,OAAS,qBAAqB,mBAAqB,iCAAiC,SAAW,uBAAuB,WAAa,yBAAyB,YAAc,0B","sources":["components/ChatRoom/ChatRoom.js","webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","pages/chat-room-list/ChatRoomList.js","webpack://iotum-samples/./src/pages/chat-room-list/submitForm.module.css?5027","pages/chat-room-list/App.js","webpack://iotum-samples/./src/components/ChatRoom/chat.module.css?03db"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport styles from './chat.module.css';\n\nconst ChatRoom = (props) => {\n const chatContainerRef = useRef(null); \n\n useEffect(() => {\n // This code will run after the component has rendered and the chat container is available in the DOM\n const chatRoom = new Callbridge.Dashboard(\n {\n domain: 'iotum.callbridge.rocks',\n container: chatContainerRef.current, // Use the DOM element reference\n },\n 'Team',\n { layout: 'main', pathname: props.path }\n );\n\n console.log(\"A new chat room was opened: \" + props.path);\n\n // Cleanup function to be called when the component unmounts\n return () => {\n chatRoom.unload(); // Replace with actual cleanup method if available\n console.log(\"Chat room was closed: \" + props.path);\n };\n }, [props.path]); \n\n // Render the chat container reference\n return
;\n};\n\nexport default ChatRoom;\n","// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/iotum-samples/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","import React from 'react';\nimport ChatRoom from '../../components/ChatRoom/ChatRoom.js';\nimport styles from '../../components/ChatRoom/chat.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\n\nconst ChatRoomList = ({ rooms, onRoomClose }) => {\n return (\n
\n {rooms.map((room) =>\n room.bool && (\n
\n \n onRoomClose(room.path)}\n >\n x\n \n
\n )\n )}\n \n \n
\n );\n};\n\nexport default ChatRoomList;","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__Zc6Zy\",\"container\":\"submitForm_container__iv0mm\",\"roomListContainer\":\"submitForm_roomListContainer__8I4zt\"};","import React, { useState, useEffect, useRef, useCallback } from 'react';\nimport { useSelector } from 'react-redux';\nimport ChatRoomList from './ChatRoomList';\nimport styles from './submitForm.module.css';\nimport * as Callbridge from '@iotum/callbridge-js';\n\nexport const App = () => {\n const [allRooms, setAllRooms] = useState([]);\n const widget = useRef(null);\n \n // Retrive credentials from Redux store\n const credentials = useSelector(state => state.credentials);\n console.log(\"Credentials:\", credentials);\n\n const handleRoomButtonClick = (path) => {\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: true } : room;\n }));\n };\n\n const handleRoomClose = (path) => {\n console.log(path + \" was closed\");\n setAllRooms(prevRooms => prevRooms.map(room => {\n return room.path === path ? { ...room, bool: false } : room;\n }));\n };\n\n const renderWidget = useCallback(() => {\n console.log(\"renderWidget ran\");\n widget.current = new Callbridge.Dashboard(\n {\n domain: credentials.domain, // using the state variable for domain\n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: '#chat',\n },\n 'Team',\n { layout: 'list', pathname: '/'}\n );\n console.log(\"dashboard rendered\");\n\n widget.current.once('dashboard.ROOM_LIST', (data) => {\n const uniqueAccountNames = []; // To keep track of account names that should have \"(you)\" added\n const allRoomsChange = Object.values(data.rooms).map((room) => {\n const accounts = room.accounts.map((account) => account.name);\n \n // Check if the room has only one account\n if (accounts.length === 1) {\n const accountName = `${accounts[0]} (you)`;\n uniqueAccountNames.push(accounts[0]); // Add the account name to the unique list\n return {\n name: accountName,\n path: room.path,\n bool: false,\n };\n }\n \n // Filter out account names that are in the unique list\n const filteredNames = accounts.filter((name) => !uniqueAccountNames.includes(name));\n return {\n name: filteredNames.join(', '),\n path: room.path,\n bool: false,\n };\n });\n \n setAllRooms(allRoomsChange);\n });\n\n widget.current.on('dashboard.NAVIGATE', (data) => {\n if (data.pathname !== \"/\") {\n widget.current.load(\"Team\", {layout: \"list\"})\n console.log(\"There was a navigate event to \" + data.pathname + \" in the list widget and the list widget was reloaded\");\n } \n\n handleRoomButtonClick(data.pathname);\n }\n )\n\n widget.current.on('dashboard.READY', () => {\n console.log(\"The list widget was rendered\");\n });\n }, [credentials]);\n\n useEffect(() => {\n if (credentials && credentials.token && credentials.domain && credentials.hostId) {\n renderWidget(credentials);\n }\n\n return () => {\n widget.current?.unload();\n }\n }, [credentials, renderWidget]);\n \n return (\n
\n
\n
\n \n
\n
\n );\n \n};\n\nexport default App;\n","// extracted by mini-css-extract-plugin\nexport default {\"container\":\"chat_container__tPqzb\",\"roomListContainer\":\"chat_roomListContainer__hpRp3\",\"chatRoomItem\":\"chat_chatRoomItem__tdDrk\",\"active\":\"chat_active__YaH2-\",\"chatRoomsContainer\":\"chat_chatRoomsContainer__Smrg+\",\"chatRoom\":\"chat_chatRoom__Oon7U\",\"activeRoom\":\"chat_activeRoom__fmDik\",\"closeButton\":\"chat_closeButton__v7qtp\"};"],"names":["props","chatContainerRef","useRef","useEffect","chatRoom","Callbridge","domain","container","current","layout","pathname","path","console","log","unload","_jsx","ref","className","styles","_ref","_ref$position","position","navigate","useNavigate","positionClass","children","concat","onClick","rooms","onRoomClose","_jsxs","chatRoomsContainer","map","room","bool","activeRoom","ChatRoom","closeButton","TokenButton","MenuButton","App","_useState","useState","_useState2","_slicedToArray","allRooms","setAllRooms","widget","credentials","useSelector","state","renderWidget","useCallback","sso","token","hostId","once","data","uniqueAccountNames","allRoomsChange","Object","values","accounts","account","name","length","accountName","push","filter","includes","join","on","load","prevRooms","_objectSpread","_widget$current","id","ChatRoomList"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/906.56accfd9.chunk.js b/static/js/906.56accfd9.chunk.js deleted file mode 100644 index d21c7eba..00000000 --- a/static/js/906.56accfd9.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[906],{1374:function(e,n,t){t.d(n,{Z:function(){return c}});t(2791);var o=t(7689),s="MenuButton_menuButton__e9oFw",i="MenuButton_left__d8Tih",u="MenuButton_right__fbjxn",r=t(184);var c=function(e){var n=e.position,t=void 0===n?"left":n,c=(0,o.s0)(),a="right"===t?u:i;return(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"".concat(s," ").concat(a),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),c("/menu")},children:"Menu Page"})})}},7906:function(e,n,t){t.r(n),t.d(n,{default:function(){return b}});var o=t(9439),s=t(2791),i="submitForm_appContainer__fBuO4",u="submitForm_startButton__UFeO6",r="submitForm_accessCodeLabel__grkCR",c="submitForm_accessCodeInput__TIWMW",a="submitForm_startMeetingButton__uwJ8I",l="submitForm_widgetContainer__Kk1Fh",d=t(5177),_=t(1374),m=t(9074),f=t(9434),g=t(1348),h=t(184),b=function(){(0,g.Z)();var e=(0,s.useState)(""),n=(0,o.Z)(e,2),t=n[0],b=n[1],p=(0,s.useRef)(null),v=(0,s.useRef)(null),k=(0,f.v9)((function(e){return e.credentials})),C=(0,s.useCallback)((function(){console.log("render meeting widget"),t?(v.current&&v.current.unload(),v.current=new m.Meeting({domain:k.domain,sso:{token:k.token,hostId:k.hostId},container:p.current},t,{skipJoin:!0})):console.log("Access code not set, widget will not be rendered.")}),[k,t]);return(0,h.jsxs)("div",{className:i,children:[(0,h.jsxs)("div",{className:u,children:[(0,h.jsx)("div",{className:r,children:"Access Code:"}),(0,h.jsx)("input",{type:"text",className:c,value:t,onChange:function(e){b(e.target.value)}}),(0,h.jsx)("button",{className:a,onClick:C,children:"Start Meeting"})]}),(0,h.jsx)(d.Z,{position:"right"}),(0,h.jsx)(_.Z,{position:"right"}),(0,h.jsx)("div",{ref:p,className:l})]})}}}]); -//# sourceMappingURL=906.56accfd9.chunk.js.map \ No newline at end of file diff --git a/static/js/906.56accfd9.chunk.js.map b/static/js/906.56accfd9.chunk.js.map deleted file mode 100644 index f4c5246b..00000000 --- a/static/js/906.56accfd9.chunk.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"static/js/906.56accfd9.chunk.js","mappings":"yKACA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBA,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBI,EAAeA,EAE5D,OACEC,EAAAA,EAAAA,KAAA,OAAAC,UACED,EAAAA,EAAAA,KAAA,UAAQE,UAAS,GAAAC,OAAKJ,EAAiB,KAAAI,OAAIL,GAAiBM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AS,WACtBK,EAAAA,EAAAA,KAACqC,EAAAA,EAAU,CAAC1C,SAAS,WACrBK,EAAAA,EAAAA,KAAA,OAAKsC,IAAKxB,EAAWZ,UAAWH,MAGtC,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/simple-meeting/submitForm.module.css?d69f","pages/simple-meeting/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__Gz5JF\",\"appContainer\":\"submitForm_appContainer__fBuO4\",\"startButton\":\"submitForm_startButton__UFeO6\",\"accessCodeLabel\":\"submitForm_accessCodeLabel__grkCR\",\"accessCodeInput\":\"submitForm_accessCodeInput__TIWMW\",\"startMeetingButton\":\"submitForm_startMeetingButton__uwJ8I\",\"widgetContainer\":\"submitForm_widgetContainer__Kk1Fh\"};","import React, { useState, useRef, useCallback } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\nimport useGuardedRoute from '../../components/hooks/useGuardedRoute';\n\nconst App = () => {\n useGuardedRoute()\n const [accessCode, setAccessCode] = useState('');\n const container = useRef(null);\n const widget = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n\n const handleAccessCode = (event) => {\n setAccessCode(event.target.value);\n }\n\n const renderWidget = useCallback(() => {\n console.log(\"render meeting widget\");\n\n if (!accessCode) {\n console.log(\"Access code not set, widget will not be rendered.\");\n return;\n }\n\n if (widget.current) {\n widget.current.unload();\n }\n\n widget.current = new Callbridge.Meeting(\n {\n domain: credentials.domain, \n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: container.current,\n },\n accessCode, \n {\n skipJoin: true\n }\n );\n }, [credentials, accessCode]); // Dependencies: credentials and accessCode\n\n return (\n
\n
\n
Access Code:
\n \n \n
\n \n \n
\n
\n );\n};\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","useGuardedRoute","_useState","useState","_useState2","_slicedToArray","accessCode","setAccessCode","container","useRef","widget","credentials","useSelector","state","renderWidget","useCallback","current","unload","Callbridge","domain","sso","token","hostId","skipJoin","_jsxs","type","value","onChange","event","target","TokenButton","MenuButton","ref"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/906.e43221f2.chunk.js b/static/js/906.e43221f2.chunk.js new file mode 100644 index 00000000..fc4e461c --- /dev/null +++ b/static/js/906.e43221f2.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[906],{1374:function(e,t,n){n.d(t,{Z:function(){return c}});n(2791);var s=n(7689),o="MenuButton_menuButton__e9oFw",i="MenuButton_left__d8Tih",u="MenuButton_right__fbjxn",r=n(184);var c=function(e){var t=e.position,n=void 0===t?"left":t,c=(0,s.s0)(),a="right"===n?u:i;return(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"".concat(o," ").concat(a),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),c("/iotum-samples/menu")},children:"Menu Page"})})}},7906:function(e,t,n){n.r(t),n.d(t,{default:function(){return h}});var s=n(9439),o=n(2791),i="submitForm_appContainer__fBuO4",u="submitForm_startButton__UFeO6",r="submitForm_accessCodeLabel__grkCR",c="submitForm_accessCodeInput__TIWMW",a="submitForm_startMeetingButton__uwJ8I",l="submitForm_widgetContainer__Kk1Fh",d=n(5177),m=n(1374),_=n(9074),f=n(9434),g=n(184),h=function(){var e=(0,o.useState)(""),t=(0,s.Z)(e,2),n=t[0],h=t[1],p=(0,o.useRef)(null),b=(0,o.useRef)(null),v=(0,f.v9)((function(e){return e.credentials})),k=(0,o.useCallback)((function(){console.log("render meeting widget"),n?(b.current&&b.current.unload(),b.current=new _.Meeting({domain:v.domain,sso:{token:v.token,hostId:v.hostId},container:p.current},n,{skipJoin:!0})):console.log("Access code not set, widget will not be rendered.")}),[v,n]);return(0,g.jsxs)("div",{className:i,children:[(0,g.jsxs)("div",{className:u,children:[(0,g.jsx)("div",{className:r,children:"Access Code:"}),(0,g.jsx)("input",{type:"text",className:c,value:n,onChange:function(e){h(e.target.value)}}),(0,g.jsx)("button",{className:a,onClick:k,children:"Start Meeting"})]}),(0,g.jsx)(d.Z,{position:"right"}),(0,g.jsx)(m.Z,{position:"right"}),(0,g.jsx)("div",{ref:p,className:l})]})}}}]); +//# sourceMappingURL=906.e43221f2.chunk.js.map \ No newline at end of file diff --git a/static/js/906.e43221f2.chunk.js.map b/static/js/906.e43221f2.chunk.js.map new file mode 100644 index 00000000..c37402ea --- /dev/null +++ b/static/js/906.e43221f2.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/906.e43221f2.chunk.js","mappings":"yKACA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBA,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBI,EAAeA,EAE5D,OACEC,EAAAA,EAAAA,KAAA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AASe,EAAalB,SAAC,sBAEvED,EAAAA,EAAAA,KAACmC,EAAAA,EAAW,CAACxC,SAAS,WACtBK,EAAAA,EAAAA,KAACoC,EAAAA,EAAU,CAACzC,SAAS,WACrBK,EAAAA,EAAAA,KAAA,OAAKqC,IAAKxB,EAAWX,UAAWH,MAGtC,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/simple-meeting/submitForm.module.css?d69f","pages/simple-meeting/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/iotum-samples/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__Gz5JF\",\"appContainer\":\"submitForm_appContainer__fBuO4\",\"startButton\":\"submitForm_startButton__UFeO6\",\"accessCodeLabel\":\"submitForm_accessCodeLabel__grkCR\",\"accessCodeInput\":\"submitForm_accessCodeInput__TIWMW\",\"startMeetingButton\":\"submitForm_startMeetingButton__uwJ8I\",\"widgetContainer\":\"submitForm_widgetContainer__Kk1Fh\"};","import React, { useState, useRef, useCallback } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\n\nconst App = () => {\n const [accessCode, setAccessCode] = useState('');\n const container = useRef(null);\n const widget = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n\n const handleAccessCode = (event) => {\n setAccessCode(event.target.value);\n }\n\n const renderWidget = useCallback(() => {\n console.log(\"render meeting widget\");\n\n if (!accessCode) {\n console.log(\"Access code not set, widget will not be rendered.\");\n return;\n }\n\n if (widget.current) {\n widget.current.unload();\n }\n\n widget.current = new Callbridge.Meeting(\n {\n domain: credentials.domain, \n sso: {\n token: credentials.token,\n hostId: credentials.hostId\n },\n container: container.current,\n },\n accessCode, \n {\n skipJoin: true\n }\n );\n }, [credentials, accessCode]); // Dependencies: credentials and accessCode\n\n return (\n
\n
\n
Access Code:
\n \n \n
\n \n \n
\n
\n );\n};\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","_useState","useState","_useState2","_slicedToArray","accessCode","setAccessCode","container","useRef","widget","credentials","useSelector","state","renderWidget","useCallback","current","unload","Callbridge","domain","sso","token","hostId","skipJoin","_jsxs","type","value","onChange","event","target","TokenButton","MenuButton","ref"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/935.4d4ca839.chunk.js b/static/js/935.4d4ca839.chunk.js deleted file mode 100644 index a68672ea..00000000 --- a/static/js/935.4d4ca839.chunk.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[935],{1374:function(n,e,t){t.d(e,{Z:function(){return u}});t(2791);var o=t(7689),i="MenuButton_menuButton__e9oFw",a="MenuButton_left__d8Tih",r="MenuButton_right__fbjxn",s=t(184);var u=function(n){var e=n.position,t=void 0===e?"left":e,u=(0,o.s0)(),c="right"===t?r:a;return(0,s.jsx)("div",{children:(0,s.jsx)("button",{className:"".concat(i," ").concat(c),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),u("/menu")},children:"Menu Page"})})}},6935:function(n,e,t){t.r(e),t.d(e,{default:function(){return f}});var o=t(9439),i=t(2791),a="submitForm_chatContainer__Xcj9R",r="submitForm_badge__coYDH",s="submitForm_biggerButton__hfy-z",u=t(5177),c=t(1374),d=t(9074),l=t(9434),h=t(1348),m=t(184),f=function(){(0,h.Z)();var n=(0,i.useState)(0),e=(0,o.Z)(n,2),t=e[0],f=e[1],g=(0,i.useState)(!0),v=(0,o.Z)(g,2),_=v[0],b=v[1],k=(0,i.useRef)(null),j=(0,l.v9)((function(n){return n.credentials})),x=j.token&&j.domain&&j.hostId,p=(0,i.useCallback)((function(){x&&(k.current&&k.current.instance?k.current.instance&&k.current.instance.focus():(k.current=new d.Dashboard({domain:j.domain,sso:{token:j.token,hostId:j.hostId},container:window,target:{name:"CallbridgeChatWidget",checkExisting:!0}},"Team"),k.current.on("dashboard.NAVIGATE",(function(n){console.log("navigate event")}))))}),[j,x]);return(0,i.useEffect)((function(){if(x){var n=document.createElement("div");n.style.display="none",document.body.appendChild(n);var e=new d.Dashboard({domain:j.domain,sso:{token:j.token,hostId:j.hostId},container:n,target:{name:"InvisibleWidget",checkExisting:!0}},"Team");return e.on("dashboard.UNREAD_MESSAGES",(function(n){var e=Object.values(n.rooms).reduce((function(n,e){return n+e}),0);f(e),b(!1)})),function(){var n;null===(n=k.current)||void 0===n||n.unload(),null===e||void 0===e||e.unload()}}}),[j,x]),(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.Z,{position:"right"}),(0,m.jsx)(c.Z,{position:"right"}),(0,m.jsx)("div",{className:a,children:_?(0,m.jsx)("div",{children:"Loading unread messages..."}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{className:s,onClick:p,children:"Chat"}),(0,m.jsx)("span",{className:r,children:t})]})})]})}}}]); -//# sourceMappingURL=935.4d4ca839.chunk.js.map \ No newline at end of file diff --git a/static/js/935.4d4ca839.chunk.js.map b/static/js/935.4d4ca839.chunk.js.map deleted file mode 100644 index d0f08a35..00000000 --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1B,SAAC,UAGnED,EAAAA,EAAAA,KAAA,QAAME,UAAWH,EAAaE,SAAEW,WAM5C,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/popout-chat/submitForm.module.css?9556","pages/popout-chat/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__zNU3U\",\"chatContainer\":\"submitForm_chatContainer__Xcj9R\",\"badge\":\"submitForm_badge__coYDH\",\"biggerButton\":\"submitForm_biggerButton__hfy-z\"};","import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\nimport useGuardedRoute from '../../components/hooks/useGuardedRoute';\n\nconst App = () => {\n useGuardedRoute(); // Guard the route\n const [unreadMessages, setUnreadMessages] = useState(0);\n const [isLoading, setIsLoading] = useState(true);\n const widget = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n\n // Check if all necessary credentials are available\n const areCredentialsValid = credentials.token && credentials.domain && credentials.hostId;\n\n const renderChatWidget = useCallback(() => {\n if (areCredentialsValid) {\n if (!widget.current || !widget.current.instance) {\n widget.current = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: window,\n target: {\n name: \"CallbridgeChatWidget\",\n checkExisting: true,\n }\n }, 'Team');\n\n widget.current.on('dashboard.NAVIGATE', (data) => {\n console.log(\"navigate event\");\n });\n } else if (widget.current.instance) {\n widget.current.instance.focus();\n }\n }\n }, [credentials, areCredentialsValid]);\n\n useEffect(() => {\n if (areCredentialsValid) {\n const hiddenContainer = document.createElement('div');\n hiddenContainer.style.display = 'none';\n document.body.appendChild(hiddenContainer);\n\n const invisibleWidget = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: hiddenContainer,\n target: {\n name: \"InvisibleWidget\",\n checkExisting: true,\n }\n }, 'Team');\n\n invisibleWidget.on('dashboard.UNREAD_MESSAGES', (data) => {\n const sum = Object.values(data.rooms).reduce((m, n) => m + n, 0);\n setUnreadMessages(sum);\n setIsLoading(false);\n });\n\n return () => {\n widget.current?.unload();\n invisibleWidget?.unload();\n };\n }\n }, [credentials, areCredentialsValid]);\n\n return (\n <>\n \n \n
\n {isLoading ? (\n
Loading unread messages...
\n ) : (\n <>\n \n {unreadMessages}\n \n )}\n
\n \n );\n};\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","useGuardedRoute","_useState","useState","_useState2","_slicedToArray","unreadMessages","setUnreadMessages","_useState3","_useState4","isLoading","setIsLoading","widget","useRef","credentials","useSelector","state","areCredentialsValid","token","domain","hostId","renderChatWidget","useCallback","current","instance","focus","Callbridge","sso","container","window","target","name","checkExisting","on","data","useEffect","hiddenContainer","document","createElement","style","display","body","appendChild","invisibleWidget","sum","Object","values","rooms","reduce","m","n","_widget$current","unload","_jsxs","_Fragment","TokenButton","MenuButton"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/935.cee7ffa5.chunk.js b/static/js/935.cee7ffa5.chunk.js new file mode 100644 index 00000000..476151a5 --- /dev/null +++ b/static/js/935.cee7ffa5.chunk.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunkiotum_samples=self.webpackChunkiotum_samples||[]).push([[935],{1374:function(e,n,t){t.d(n,{Z:function(){return c}});t(2791);var o=t(7689),i="MenuButton_menuButton__e9oFw",a="MenuButton_left__d8Tih",s="MenuButton_right__fbjxn",r=t(184);var c=function(e){var n=e.position,t=void 0===n?"left":n,c=(0,o.s0)(),u="right"===t?s:a;return(0,r.jsx)("div",{children:(0,r.jsx)("button",{className:"".concat(i," ").concat(u),onClick:function(){console.log("Menu Button Clicked, Go To the Menu Page."),c("/iotum-samples/menu")},children:"Menu Page"})})}},6935:function(e,n,t){t.r(n),t.d(n,{default:function(){return g}});var o=t(9439),i=t(2791),a="submitForm_chatContainer__Xcj9R",s="submitForm_badge__coYDH",r="submitForm_biggerButton__hfy-z",c=t(5177),u=t(1374),d=t(9074),l=t(9434),h=t(184),g=function(){var e=(0,i.useState)(0),n=(0,o.Z)(e,2),t=n[0],g=n[1],m=(0,i.useState)(!0),f=(0,o.Z)(m,2),v=f[0],b=f[1],_=(0,i.useRef)(null),w=(0,l.v9)((function(e){return e.credentials}));console.log("Credentials:",w);var p=(0,i.useCallback)((function(){console.log("renderChatWidget called"),_.current&&_.current.instance?_.current.instance&&(console.log("Change focus to the existing widget that's open in a new window"),_.current.instance.focus()):(console.log("Create a new widget because the window was closed/there never was a widget"),_.current=new d.Dashboard({domain:w.domain,sso:{token:w.token,hostId:w.hostId},container:window,target:{name:"CallbridgeChatWidget",checkExisting:!0}},"Team"),_.current.on("dashboard.NAVIGATE",(function(e){console.log("navigate event")})))}),[w]);return(0,i.useEffect)((function(){console.log("Setting up invisibleWidget for unread messages");var e=document.createElement("div");e.style.display="none",document.body.appendChild(e);var n=new d.Dashboard({domain:w.domain,sso:{token:w.token,hostId:w.hostId},container:e,target:{name:"InvisibleWidget",checkExisting:!0}},"Team");return n.on("dashboard.UNREAD_MESSAGES",(function(e){var n=Object.values(e.rooms).reduce((function(e,n){return e+n}),0);g(n),b(!1)})),function(){var e;null===(e=_.current)||void 0===e||e.unload(),null===n||void 0===n||n.unload()}}),[w]),(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Z,{position:"right"}),(0,h.jsx)(u.Z,{position:"right"}),(0,h.jsx)("div",{className:a,children:v?(0,h.jsx)("div",{children:"Loading unread messages..."}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("button",{className:r,onClick:p,children:"Chat"}),(0,h.jsx)("span",{className:s,children:t})]})})]})}}}]); +//# sourceMappingURL=935.cee7ffa5.chunk.js.map \ No newline at end of file diff --git a/static/js/935.cee7ffa5.chunk.js.map b/static/js/935.cee7ffa5.chunk.js.map new file mode 100644 index 00000000..232974a4 --- /dev/null +++ b/static/js/935.cee7ffa5.chunk.js.map @@ -0,0 +1 @@ +{"version":3,"file":"static/js/935.cee7ffa5.chunk.js","mappings":"yKACA,EAA6B,+BAA7B,EAAmE,yBAAnE,EAAoG,0B,SCuBpG,MApBA,SAAmBA,GAAyB,IAADC,EAAAD,EAArBE,SAAAA,OAAQ,IAAAD,EAAG,OAAMA,EAC/BE,GAAWC,EAAAA,EAAAA,MAQXC,EAA6B,UAAbH,EAAuBI,EAAeA,EAE5D,OACEC,EAAAA,EAAAA,KAAA,OAAAC,UACED,EAAAA,EAAAA,KAAA,UAAQE,UAAS,GAAAC,OAAKJ,EAAiB,KAAAI,OAAIL,GAAiBM,QAV5C,WAClBC,QAAQC,IAAI,6CACZV,EAAS,sBACX,EAOqFK,SAAC,eAKxF,C,4FCrBA,EAAgF,kCAAhF,EAA0H,0BAA1H,EAAmK,iC,iDCkGnK,EA5FY,WACV,IAAAM,GAA4CC,EAAAA,EAAAA,UAAS,GAAEC,GAAAC,EAAAA,EAAAA,GAAAH,EAAA,GAAhDI,EAAcF,EAAA,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AC9D1C,EAAkBoC,GAClBhC,GAAa,EACf,IAGO,WAAO,IAADuC,EAEG,QAAdA,EAAAtC,EAAOO,eAAO,IAAA+B,GAAdA,EAAgBC,SACD,OAAfT,QAAe,IAAfA,GAAAA,EAAiBS,QAEnB,CACA,GAAG,CAACrC,KAGJsC,EAAAA,EAAAA,MAAAC,EAAAA,SAAA,CAAAzD,SAAA,EACED,EAAAA,EAAAA,KAAC2D,EAAAA,EAAW,CAAChE,SAAS,WACtBK,EAAAA,EAAAA,KAAC4D,EAAAA,EAAU,CAACjE,SAAS,WACrBK,EAAAA,EAAAA,KAAA,OAAKE,UAAWH,EAAqBE,SAClCc,GACCf,EAAAA,EAAAA,KAAA,OAAAC,SAAK,gCAELwD,EAAAA,EAAAA,MAAAC,EAAAA,SAAA,CAAAzD,SAAA,EACED,EAAAA,EAAAA,KAAA,UAAQE,UAAWH,EAAqBK,QAASkB,EAAiBrB,SAAC,UAGnED,EAAAA,EAAAA,KAAA,QAAME,UAAWH,EAAaE,SAAEU,WAM5C,C","sources":["webpack://iotum-samples/./src/navigation/MenuButton/MenuButton.module.css?3f77","navigation/MenuButton/MenuButton.js","webpack://iotum-samples/./src/pages/popout-chat/submitForm.module.css?9556","pages/popout-chat/App.js"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport default {\"menuButton\":\"MenuButton_menuButton__e9oFw\",\"left\":\"MenuButton_left__d8Tih\",\"right\":\"MenuButton_right__fbjxn\"};","import React from 'react';\r\nimport { useNavigate } from 'react-router-dom';\r\nimport styles from './MenuButton.module.css'; \r\n\r\nfunction MenuButton({ position = 'left' }) { // 'left' is default if no position is provided\r\n const navigate = useNavigate();\r\n \r\n const handleClick = () => {\r\n console.log('Menu Button Clicked, Go To the Menu Page.');\r\n navigate('/iotum-samples/menu');\r\n };\r\n\r\n // Determine the button position class\r\n const positionClass = position === 'right' ? styles.right : styles.left;\r\n\r\n return (\r\n
\r\n \r\n
\r\n );\r\n}\r\n\r\nexport default MenuButton;\r\n","// extracted by mini-css-extract-plugin\nexport default {\"form-wrapper\":\"submitForm_form-wrapper__zNU3U\",\"chatContainer\":\"submitForm_chatContainer__Xcj9R\",\"badge\":\"submitForm_badge__coYDH\",\"biggerButton\":\"submitForm_biggerButton__hfy-z\"};","import React, { useState, useRef, useCallback, useEffect } from 'react';\nimport styles from './submitForm.module.css';\nimport TokenButton from '../../navigation/TokenButton/TokenButton';\nimport MenuButton from '../../navigation/MenuButton/MenuButton';\nimport * as Callbridge from '@iotum/callbridge-js';\nimport { useSelector } from 'react-redux';\n\nconst App = () => {\n const [unreadMessages, setUnreadMessages] = useState(0);\n const [isLoading, setIsLoading] = useState(true);\n const widget = useRef(null);\n\n const credentials = useSelector(state => state.credentials);\n console.log(\"Credentials:\", credentials);\n\n // Function to render the chat widget\n const renderChatWidget = useCallback(() => {\n console.log('renderChatWidget called'); // Debugging log\n if (!widget.current || !widget.current.instance) {\n console.log(\"Create a new widget because the window was closed/there never was a widget\");\n\n widget.current = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: window,\n target: {\n name: \"CallbridgeChatWidget\",\n checkExisting: true,\n }\n }, 'Team');\n\n widget.current.on('dashboard.NAVIGATE', (data) => {\n console.log(\"navigate event\");\n });\n } else if (widget.current.instance) {\n console.log(\"Change focus to the existing widget that's open in a new window\");\n widget.current.instance.focus();\n }\n }, [credentials]);\n\n // Effect for handling unread messages event\n useEffect(() => {\n console.log('Setting up invisibleWidget for unread messages'); // Debugging log\n\n const hiddenContainer = document.createElement('div');\n hiddenContainer.style.display = 'none';\n document.body.appendChild(hiddenContainer);\n \n const invisibleWidget = new Callbridge.Dashboard({\n domain: credentials.domain,\n sso: {\n token: credentials.token,\n hostId: credentials.hostId,\n },\n container: hiddenContainer,\n target: {\n name: \"InvisibleWidget\",\n checkExisting: true,\n }\n }, 'Team');\n\n invisibleWidget.on('dashboard.UNREAD_MESSAGES', (data) => {\n const sum = Object.values(data.rooms).reduce((m, n) => m + n, 0);\n setUnreadMessages(sum);\n setIsLoading(false);\n });\n\n // Cleanup function\n return () => {\n\n widget.current?.unload()\n invisibleWidget?.unload()\n\n };\n }, [credentials]);\n\n return (\n <>\n \n \n
\n {isLoading ? (\n
Loading unread messages...
\n ) : (\n <>\n \n {unreadMessages}\n \n )}\n
\n \n );\n};\n\nexport default App;\n"],"names":["_ref","_ref$position","position","navigate","useNavigate","positionClass","styles","_jsx","children","className","concat","onClick","console","log","_useState","useState","_useState2","_slicedToArray","unreadMessages","setUnreadMessages","_useState3","_useState4","isLoading","setIsLoading","widget","useRef","credentials","useSelector","state","renderChatWidget","useCallback","current","instance","focus","Callbridge","domain","sso","token","hostId","container","window","target","name","checkExisting","on","data","useEffect","hiddenContainer","document","createElement","style","display","body","appendChild","invisibleWidget","sum","Object","values","rooms","reduce","m","n","_widget$current","unload","_jsxs","_Fragment","TokenButton","MenuButton"],"sourceRoot":""} \ No newline at end of file diff --git a/static/js/main.35b37dc1.js b/static/js/main.35b37dc1.js new file mode 100644 index 00000000..cc741447 --- /dev/null +++ b/static/js/main.35b37dc1.js @@ -0,0 +1,3 @@ +/*! For license information please see main.35b37dc1.js.LICENSE.txt */ +!function(){"use strict";var e={5177:function(e,t,n){n.d(t,{Z:function(){return u}});n(2791);var r=n(7689),a="TokenButton_tokenButton__0BlzX",o="TokenButton_left__EmahX",i="TokenButton_right__eqoGZ",l=n(184);var u=function(e){var t=e.position,n=void 0===t?"left":t,u=(0,r.s0)(),c="right"===n?i:o;return(0,l.jsx)("div",{children:(0,l.jsx)("button",{className:"".concat(a," ").concat(c),onClick:function(){console.log("Token Button Clicked, Go To the Token Page."),u("/iotum-samples")},children:"Token Page"})})}},2084:function(e,t,n){n.d(t,{X3:function(){return oe},aU:function(){return k},OF:function(){return ie},Zq:function(){return G},J0:function(){return L},lX:function(){return P},p7:function(){return we},WK:function(){return le},RQ:function(){return te},fp:function(){return F},cP:function(){return D},pC:function(){return ee},Zn:function(){return J}});var r=n(4165),a=n(5861),o=n(4942),i=n(3144),l=n(5671),u=n(136),c=n(516),s=n(1120),f=n(9611);var d=n(8814);function p(e,t,n){return p=(0,d.Z)()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var a=new(Function.bind.apply(e,r));return n&&(0,f.Z)(a,n.prototype),a},p.apply(null,arguments)}function h(e){var t="function"===typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return p(e,arguments,(0,s.Z)(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),(0,f.Z)(n,e)},h(e)}var m=n(9439),v=n(3878);function y(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}var g=n(181),b=n(5267);function w(e,t){var n="undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=(0,g.Z)(e))||t&&e&&"number"===typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){l=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(l)throw o}}}}var k,S=n(907);function x(e){return function(e){if(Array.isArray(e))return(0,S.Z)(e)}(e)||y(e)||(0,g.Z)(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));var r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function z(e,t,n,r){void 0===r&&(r={});var a=r,o=a.window,i=void 0===o?document.defaultView:o,l=a.v5Compat,u=void 0!==l&&l,c=i.history,s=k.Pop,f=null,d=p();function p(){return(c.state||{idx:null}).idx}function h(){s=k.Pop;var e=p(),t=null==e?null:e-d;d=e,f&&f({action:s,location:v.location,delta:t})}function m(e){var t="null"!==i.location.origin?i.location.origin:i.location.href,n="string"===typeof e?e:O(e);return L(t,"No window.location.(origin|href) available to create URL for href: "+n),new URL(n,t)}null==d&&(d=0,c.replaceState(E({},c.state,{idx:d}),""));var v={get action(){return s},get location(){return e(i,c)},listen:function(e){if(f)throw new Error("A history only accepts one active listener");return i.addEventListener(_,h),f=e,function(){i.removeEventListener(_,h),f=null}},createHref:function(e){return t(i,e)},createURL:m,encodeLocation:function(e){var t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:function(e,t){s=k.Push;var r=N(v.location,e,t);n&&n(r,e);var a=R(r,d=p()+1),o=v.createHref(r);try{c.pushState(a,"",o)}catch(l){if(l instanceof DOMException&&"DataCloneError"===l.name)throw l;i.location.assign(o)}u&&f&&f({action:s,location:v.location,delta:1})},replace:function(e,t){s=k.Replace;var r=N(v.location,e,t);n&&n(r,e);var a=R(r,d=p()),o=v.createHref(r);c.replaceState(a,"",o),u&&f&&f({action:s,location:v.location,delta:0})},go:function(e){return c.go(e)}};return v}!function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(C||(C={}));var M=new Set(["lazy","caseSensitive","path","id","index","children"]);function j(e,t,n,r){return void 0===n&&(n=[]),void 0===r&&(r={}),e.map((function(e,a){var o=[].concat(x(n),[a]),i="string"===typeof e.id?e.id:o.join("-");if(L(!0!==e.index||!e.children,"Cannot specify children on an index route"),L(!r[i],'Found a route id collision on id "'+i+"\". Route id's must be globally unique within Data Router usages"),function(e){return!0===e.index}(e)){var l=E({},e,t(e),{id:i});return r[i]=l,l}var u=E({},e,t(e),{id:i,children:void 0});return r[i]=u,e.children&&(u.children=j(e.children,t,o,r)),u}))}function F(e,t,n){void 0===n&&(n="/");var r=J(("string"===typeof t?D(t):t).pathname||"/",n);if(null==r)return null;var a=I(e);!function(e){e.sort((function(e,t){return e.score!==t.score?t.score-e.score:function(e,t){var n=e.length===t.length&&e.slice(0,-1).every((function(e,n){return e===t[n]}));return n?e[e.length-1]-t[t.length-1]:0}(e.routesMeta.map((function(e){return e.childrenIndex})),t.routesMeta.map((function(e){return e.childrenIndex})))}))}(a);for(var o=null,i=0;null==o&&i0&&(L(!0!==e.index,'Index routes must not have child routes. Please remove all child routes from route path "'+l+'".'),I(e.children,t,u,l)),(null!=e.path||e.index)&&t.push({path:l,score:Q(l,e.index),routesMeta:u})};return e.forEach((function(e,t){var n;if(""!==e.path&&null!=(n=e.path)&&n.includes("?")){var r,o=w(U(e.path));try{for(o.s();!(r=o.n()).done;){var i=r.value;a(e,t,i)}}catch(l){o.e(l)}finally{o.f()}}else a(e,t)})),t}function U(e){var t=e.split("/");if(0===t.length)return[];var n,r=(n=t,(0,v.Z)(n)||y(n)||(0,g.Z)(n)||(0,b.Z)()),a=r[0],o=r.slice(1),i=a.endsWith("?"),l=a.replace(/\?$/,"");if(0===o.length)return i?[l,""]:[l];var u=U(o.join("/")),c=[];return c.push.apply(c,x(u.map((function(e){return""===e?l:[l,e].join("/")})))),i&&c.push.apply(c,x(u)),c.map((function(t){return e.startsWith("/")&&""===t?"/":t}))}var A=/^:\w+$/,Z=3,$=2,B=1,V=10,W=-2,H=function(e){return"*"===e};function Q(e,t){var n=e.split("/"),r=n.length;return n.some(H)&&(r+=W),t&&(r+=$),n.filter((function(e){return!H(e)})).reduce((function(e,t){return e+(A.test(t)?Z:""===t?B:V)}),r)}function q(e,t){for(var n=e.routesMeta,r={},a="/",o=[],i=0;i and the router will parse it for you.'}function G(e){return e.filter((function(e,t){return 0===t||e.route.path&&e.route.path.length>0}))}function ee(e,t,n,r){var a;void 0===r&&(r=!1),"string"===typeof e?a=D(e):(L(!(a=E({},e)).pathname||!a.pathname.includes("?"),X("?","pathname","search",a)),L(!a.pathname||!a.pathname.includes("#"),X("#","pathname","hash",a)),L(!a.search||!a.search.includes("#"),X("#","search","hash",a)));var o,i=""===e||""===a.pathname,l=i?"/":a.pathname;if(r||null==l)o=n;else{var u=t.length-1;if(l.startsWith("..")){for(var c=l.split("/");".."===c[0];)c.shift(),u-=1;a.pathname=c.join("/")}o=u>=0?t[u]:"/"}var s=function(e,t){void 0===t&&(t="/");var n="string"===typeof e?D(e):e,r=n.pathname,a=n.search,o=void 0===a?"":a,i=n.hash,l=void 0===i?"":i,u=r?r.startsWith("/")?r:function(e,t){var n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach((function(e){".."===e?n.length>1&&n.pop():"."!==e&&n.push(e)})),n.length>1?n.join("/"):"/"}(r,t):t;return{pathname:u,search:re(o),hash:ae(l)}}(a,o),f=l&&"/"!==l&&l.endsWith("/"),d=(i||"."===l)&&n.endsWith("/");return s.pathname.endsWith("/")||!f&&!d||(s.pathname+="/"),s}var te=function(e){return e.join("/").replace(/\/\/+/g,"/")},ne=function(e){return e.replace(/\/+$/,"").replace(/^\/*/,"/")},re=function(e){return e&&"?"!==e?e.startsWith("?")?e:"?"+e:""},ae=function(e){return e&&"#"!==e?e.startsWith("#")?e:"#"+e:""},oe=function(e){(0,u.Z)(n,e);var t=(0,c.Z)(n);function n(){return(0,l.Z)(this,n),t.apply(this,arguments)}return(0,i.Z)(n)}(h(Error));var ie=(0,i.Z)((function e(t,n,r,a){(0,l.Z)(this,e),void 0===a&&(a=!1),this.status=t,this.statusText=n||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}));function le(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"boolean"===typeof e.internal&&"data"in e}var ue=["post","put","patch","delete"],ce=new Set(ue),se=["get"].concat(ue),fe=new Set(se),de=new Set([301,302,303,307,308]),pe=new Set([307,308]),he={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},me={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ve={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ye=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ge=function(e){return{hasErrorBoundary:Boolean(e.hasErrorBoundary)}},be="remix-router-transitions";function we(e){var t,n=e.window?e.window:"undefined"!==typeof window?window:void 0,i="undefined"!==typeof n&&"undefined"!==typeof n.document&&"undefined"!==typeof n.document.createElement,l=!i;if(L(e.routes.length>0,"You must provide a non-empty routes array to createRouter"),e.mapRouteProperties)t=e.mapRouteProperties;else if(e.detectErrorBoundary){var u=e.detectErrorBoundary;t=function(e){return{hasErrorBoundary:u(e)}}}else t=ge;var c,s={},f=j(e.routes,t,void 0,s),d=e.basename||"/",p=E({v7_normalizeFormMethod:!1,v7_prependBasename:!1},e.future),h=null,v=new Set,y=null,g=null,b=null,S=null!=e.hydrationData,_=F(f,e.history.location,d),P=null;if(null==_){var R=Ue(404,{pathname:e.history.location.pathname}),O=Ie(f),D=O.matches,z=O.route;_=D,P=(0,o.Z)({},z.id,R)}var M,I,U=!_.some((function(e){return e.route.lazy}))&&(!_.some((function(e){return e.route.loader}))||null!=e.hydrationData),A={historyAction:e.history.action,location:e.history.location,matches:_,initialized:U,navigation:he,restoreScrollPosition:null==e.hydrationData&&null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||P,fetchers:new Map,blockers:new Map},Z=k.Pop,$=!1,B=!1,V=new Map,W=null,H=!1,Q=!1,q=[],K=[],Y=new Map,X=0,G=-1,ee=new Map,te=new Set,ne=new Map,re=new Map,ae=new Map,oe=!1;function ie(e,t){A=E({},A,e),v.forEach((function(e){return e(A,{unstable_viewTransitionOpts:t})}))}function le(t,n){var r,a,o,i=null!=A.actionData&&null!=A.navigation.formMethod&&Ke(A.navigation.formMethod)&&"loading"===A.navigation.state&&!0!==(null==(r=t.state)?void 0:r._isRedirect);o=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?A.actionData:null;var l=n.loaderData?je(A.loaderData,n.loaderData,n.matches||[],n.errors):A.loaderData,u=A.blockers;u.size>0&&(u=new Map(u)).forEach((function(e,t){return u.set(t,ve)}));var s,d=!0===$||null!=A.navigation.formMethod&&Ke(A.navigation.formMethod)&&!0!==(null==(a=t.state)?void 0:a._isRedirect);if(c&&(f=c,c=void 0),H||Z===k.Pop||(Z===k.Push?e.history.push(t,t.state):Z===k.Replace&&e.history.replace(t,t.state)),Z===k.Pop){var p=V.get(A.location.pathname);p&&p.has(t.pathname)?s={currentLocation:A.location,nextLocation:t}:V.has(t.pathname)&&(s={currentLocation:t,nextLocation:A.location})}else if(B){var h=V.get(A.location.pathname);h?h.add(t.pathname):(h=new Set([t.pathname]),V.set(A.location.pathname,h)),s={currentLocation:A.location,nextLocation:t}}ie(E({},n,{actionData:o,loaderData:l,historyAction:Z,location:t,initialized:!0,navigation:he,revalidation:"idle",restoreScrollPosition:ht(t,n.matches||A.matches),preventScrollReset:d,blockers:u}),s),Z=k.Pop,$=!1,B=!1,H=!1,Q=!1,q=[],K=[]}function ue(e,t){return ce.apply(this,arguments)}function ce(){return ce=(0,a.Z)((0,r.Z)().mark((function t(n,a){var o,i,l,u,c,s,f,h,m,v,y;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("number"!==typeof n){t.next=3;break}return e.history.go(n),t.abrupt("return");case 3:if(o=ke(A.location,A.matches,d,p.v7_prependBasename,n,null==a?void 0:a.fromRouteId,null==a?void 0:a.relative),i=Se(p.v7_normalizeFormMethod,!1,o,a),l=i.path,u=i.submission,c=i.error,s=A.location,f=E({},f=N(A.location,l,a&&a.state),e.history.encodeLocation(f)),h=a&&null!=a.replace?a.replace:void 0,m=k.Push,!0===h?m=k.Replace:!1===h||null!=u&&Ke(u.formMethod)&&u.formAction===A.location.pathname+A.location.search&&(m=k.Replace),v=a&&"preventScrollReset"in a?!0===a.preventScrollReset:void 0,!(y=st({currentLocation:s,nextLocation:f,historyAction:m}))){t.next=16;break}return ct(y,{state:"blocked",location:f,proceed:function(){ct(y,{state:"proceeding",proceed:void 0,reset:void 0,location:f}),ue(n,a)},reset:function(){var e=new Map(A.blockers);e.set(y,ve),ie({blockers:e})}}),t.abrupt("return");case 16:return t.next=18,se(m,f,{submission:u,pendingError:c,preventScrollReset:v,replace:a&&a.replace,enableViewTransition:a&&a.unstable_viewTransition});case 18:return t.abrupt("return",t.sent);case 19:case"end":return t.stop()}}),t)}))),ce.apply(this,arguments)}function se(e,t,n){return fe.apply(this,arguments)}function fe(){return fe=(0,a.Z)((0,r.Z)().mark((function t(n,a,i){var l,u,s,p,h,m,v,y,g,b,w,k,S,x,C;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(I&&I.abort(),I=null,Z=n,H=!0===(i&&i.startUninterruptedRevalidation),pt(A.location,A.matches),$=!0===(i&&i.preventScrollReset),B=!0===(i&&i.enableViewTransition),l=c||f,u=i&&i.overrideNavigation,s=F(l,a,d)){t.next=16;break}return p=Ue(404,{pathname:a.pathname}),h=Ie(l),m=h.matches,v=h.route,ft(),le(a,{matches:m,loaderData:{},errors:(0,o.Z)({},v.id,p)}),t.abrupt("return");case 16:if(!A.initialized||Q||!$e(A.location,a)||i&&i.submission&&Ke(i.submission.formMethod)){t.next=19;break}return le(a,{matches:s}),t.abrupt("return");case 19:if(I=new AbortController,y=Ne(e.history,a,I.signal,i&&i.submission),!i||!i.pendingError){t.next=25;break}b=(0,o.Z)({},Fe(s).route.id,i.pendingError),t.next=35;break;case 25:if(!(i&&i.submission&&Ke(i.submission.formMethod))){t.next=35;break}return t.next=28,de(y,a,i.submission,s,{replace:i.replace});case 28:if(!(w=t.sent).shortCircuited){t.next=31;break}return t.abrupt("return");case 31:g=w.pendingActionData,b=w.pendingActionError,u=rt(a,i.submission),y=new Request(y.url,{signal:y.signal});case 35:return t.next=37,xe(y,a,s,u,i&&i.submission,i&&i.fetcherSubmission,i&&i.replace,g,b);case 37:if(k=t.sent,S=k.shortCircuited,x=k.loaderData,C=k.errors,!S){t.next=43;break}return t.abrupt("return");case 43:I=null,le(a,E({matches:s},g?{actionData:g}:{},{loaderData:x,errors:C}));case 45:case"end":return t.stop()}}),t)}))),fe.apply(this,arguments)}function de(e,t,n,r,a){return we.apply(this,arguments)}function we(){return we=(0,a.Z)((0,r.Z)().mark((function e(n,a,i,l,u){var c,f,p,h;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===u&&(u={}),Ze(),ie({navigation:at(a,i)}),(f=tt(l,a)).route.action||f.route.lazy){e.next=9;break}c={type:C.error,error:Ue(405,{method:n.method,pathname:a.pathname,routeId:f.route.id})},e.next=14;break;case 9:return e.next=11,Te("action",n,f,l,s,t,d);case 11:if(c=e.sent,!n.signal.aborted){e.next=14;break}return e.abrupt("return",{shortCircuited:!0});case 14:if(!We(c)){e.next=19;break}return p=u&&null!=u.replace?u.replace:c.location===A.location.pathname+A.location.search,e.next=18,Re(A,c,{submission:i,replace:p});case 18:return e.abrupt("return",{shortCircuited:!0});case 19:if(!Ve(c)){e.next=23;break}return h=Fe(l,f.route.id),!0!==(u&&u.replace)&&(Z=k.Push),e.abrupt("return",{pendingActionData:{},pendingActionError:(0,o.Z)({},h.route.id,c.error)});case 23:if(!Be(c)){e.next=25;break}throw Ue(400,{type:"defer-action"});case 25:return e.abrupt("return",{pendingActionData:(0,o.Z)({},f.route.id,c.data)});case 26:case"end":return e.stop()}}),e)}))),we.apply(this,arguments)}function xe(e,t,n,r,a,o,i,l,u){return Ce.apply(this,arguments)}function Ce(){return Ce=(0,a.Z)((0,r.Z)().mark((function t(n,a,o,i,l,u,s,p,h){var v,y,g,b,w,k,S,x,C,_,P,L,T,R,N,O,D,z,M,j,F,U;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(v=i||rt(a,l),y=l||u||nt(v),g=c||f,b=Ee(e.history,A,o,y,a,Q,q,K,ne,te,g,d,p,h),w=(0,m.Z)(b,2),k=w[0],S=w[1],ft((function(e){return!(o&&o.some((function(t){return t.route.id===e})))||k&&k.some((function(t){return t.route.id===e}))})),G=++X,0!==k.length||0!==S.length){t.next=10;break}return x=Ge(),le(a,E({matches:o,loaderData:{},errors:h||null},p?{actionData:p}:{},x?{fetchers:new Map(A.fetchers)}:{})),t.abrupt("return",{shortCircuited:!0});case 10:return H||(S.forEach((function(e){var t=A.fetchers.get(e.key),n=ot(void 0,t?t.data:void 0);A.fetchers.set(e.key,n)})),C=p||A.actionData,ie(E({navigation:v},C?0===Object.keys(C).length?{actionData:null}:{actionData:C}:{},S.length>0?{fetchers:new Map(A.fetchers)}:{}))),S.forEach((function(e){Y.has(e.key)&&qe(e.key),e.controller&&Y.set(e.key,e.controller)})),_=function(){return S.forEach((function(e){return qe(e.key)}))},I&&I.signal.addEventListener("abort",_),t.next=16,De(A.matches,o,k,S,n);case 16:if(P=t.sent,L=P.results,T=P.loaderResults,R=P.fetcherResults,!n.signal.aborted){t.next=22;break}return t.abrupt("return",{shortCircuited:!0});case 22:if(I&&I.signal.removeEventListener("abort",_),S.forEach((function(e){return Y.delete(e.key)})),!(N=Ae(L))){t.next=30;break}return N.idx>=k.length&&(O=S[N.idx-k.length].key,te.add(O)),t.next=29,Re(A,N.result,{replace:s});case 29:return t.abrupt("return",{shortCircuited:!0});case 30:return D=Me(A,o,k,T,h,S,R,re),z=D.loaderData,M=D.errors,re.forEach((function(e,t){e.subscribe((function(n){(n||e.done)&&re.delete(t)}))})),j=Ge(),F=et(G),U=j||F||S.length>0,t.abrupt("return",E({loaderData:z,errors:M},U?{fetchers:new Map(A.fetchers)}:{}));case 36:case"end":return t.stop()}}),t)}))),Ce.apply(this,arguments)}function _e(e){return A.fetchers.get(e)||me}function Pe(){return Pe=(0,a.Z)((0,r.Z)().mark((function n(a,i,l,u,p,h){var v,y,g,b,w,k,S,x,C,_,P,T,R,N,O,D,z,M,j,U,$,B,V,W,H,J,ae,oe,ue,ce,se;return(0,r.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(Ze(),ne.delete(a),u.route.action||u.route.lazy){n.next=6;break}return v=Ue(405,{method:h.formMethod,pathname:l,routeId:i}),He(a,i,v),n.abrupt("return");case 6:return y=A.fetchers.get(a),g=it(h,y),A.fetchers.set(a,g),ie({fetchers:new Map(A.fetchers)}),b=new AbortController,w=Ne(e.history,l,b.signal,h),Y.set(a,b),k=X,n.next=16,Te("action",w,u,p,s,t,d);case 16:if(S=n.sent,!w.signal.aborted){n.next=20;break}return Y.get(a)===b&&Y.delete(a),n.abrupt("return");case 20:if(!We(S)){n.next=34;break}if(Y.delete(a),!(G>k)){n.next=29;break}return x=lt(void 0),A.fetchers.set(a,x),ie({fetchers:new Map(A.fetchers)}),n.abrupt("return");case 29:return te.add(a),C=ot(h),A.fetchers.set(a,C),ie({fetchers:new Map(A.fetchers)}),n.abrupt("return",Re(A,S,{fetcherSubmission:h}));case 34:if(!Ve(S)){n.next=37;break}return He(a,i,S.error),n.abrupt("return");case 37:if(!Be(S)){n.next=39;break}throw Ue(400,{type:"defer-action"});case 39:return _=A.navigation.location||A.location,P=Ne(e.history,_,b.signal),T=c||f,L(R="idle"!==A.navigation.state?F(T,A.navigation.location,d):A.matches,"Didn't find any matches after fetcher action"),N=++X,ee.set(a,N),O=ot(h,S.data),A.fetchers.set(a,O),D=Ee(e.history,A,R,h,_,Q,q,K,ne,te,T,d,(0,o.Z)({},u.route.id,S.data),void 0),z=(0,m.Z)(D,2),M=z[0],(j=z[1]).filter((function(e){return e.key!==a})).forEach((function(e){var t=e.key,n=A.fetchers.get(t),r=ot(void 0,n?n.data:void 0);A.fetchers.set(t,r),Y.has(t)&&qe(t),e.controller&&Y.set(t,e.controller)})),ie({fetchers:new Map(A.fetchers)}),U=function(){return j.forEach((function(e){return qe(e.key)}))},b.signal.addEventListener("abort",U),n.next=55,De(A.matches,R,M,j,P);case 55:if($=n.sent,B=$.results,V=$.loaderResults,W=$.fetcherResults,!b.signal.aborted){n.next=61;break}return n.abrupt("return");case 61:if(b.signal.removeEventListener("abort",U),ee.delete(a),Y.delete(a),j.forEach((function(e){return Y.delete(e.key)})),!(H=Ae(B))){n.next=69;break}return H.idx>=M.length&&(J=j[H.idx-M.length].key,te.add(J)),n.abrupt("return",Re(A,H.result));case 69:ae=Me(A,A.matches,M,V,void 0,j,W,re),oe=ae.loaderData,ue=ae.errors,A.fetchers.has(a)&&(ce=lt(S.data),A.fetchers.set(a,ce)),se=et(N),"loading"===A.navigation.state&&N>G?(L(Z,"Expected pending action"),I&&I.abort(),le(A.navigation.location,{matches:R,loaderData:oe,errors:ue,fetchers:new Map(A.fetchers)})):(ie(E({errors:ue,loaderData:je(A.loaderData,oe,R,ue)},se||j.length>0?{fetchers:new Map(A.fetchers)}:{})),Q=!1);case 73:case"end":return n.stop()}}),n)}))),Pe.apply(this,arguments)}function Le(){return Le=(0,a.Z)((0,r.Z)().mark((function n(a,i,l,u,c,f){var p,h,m,v,y,g,b,w,k;return(0,r.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return p=A.fetchers.get(a),h=ot(f,p?p.data:void 0),A.fetchers.set(a,h),ie({fetchers:new Map(A.fetchers)}),m=new AbortController,v=Ne(e.history,l,m.signal),Y.set(a,m),y=X,n.next=10,Te("loader",v,u,c,s,t,d);case 10:if(!Be(g=n.sent)){n.next=18;break}return n.next=14,Xe(g,v.signal,!0);case 14:if(n.t0=n.sent,n.t0){n.next=17;break}n.t0=g;case 17:g=n.t0;case 18:if(Y.get(a)===m&&Y.delete(a),!v.signal.aborted){n.next=21;break}return n.abrupt("return");case 21:if(!We(g)){n.next=33;break}if(!(G>y)){n.next=29;break}return b=lt(void 0),A.fetchers.set(a,b),ie({fetchers:new Map(A.fetchers)}),n.abrupt("return");case 29:return te.add(a),n.next=32,Re(A,g);case 32:return n.abrupt("return");case 33:if(!Ve(g)){n.next=38;break}return w=Fe(A.matches,i),A.fetchers.delete(a),ie({fetchers:new Map(A.fetchers),errors:(0,o.Z)({},w.route.id,g.error)}),n.abrupt("return");case 38:L(!Be(g),"Unhandled fetcher deferred data"),k=lt(g.data),A.fetchers.set(a,k),ie({fetchers:new Map(A.fetchers)});case 42:case"end":return n.stop()}}),n)}))),Le.apply(this,arguments)}function Re(e,t,n){return Oe.apply(this,arguments)}function Oe(){return Oe=(0,a.Z)((0,r.Z)().mark((function t(a,o,l){var u,c,s,f,p,h,m,v,y,g,b,w,S,x;return(0,r.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c=(u=void 0===l?{}:l).submission,s=u.fetcherSubmission,f=u.replace,o.revalidate&&(Q=!0),L(p=N(a.location,o.location,{_isRedirect:!0}),"Expected a location on the redirect navigation"),!i){t.next=10;break}if(h=!1,o.reloadDocument?h=!0:ye.test(o.location)&&(m=e.history.createURL(o.location),h=m.origin!==n.location.origin||null==J(m.pathname,d)),!h){t.next=10;break}return f?n.location.replace(o.location):n.location.assign(o.location),t.abrupt("return");case 10:if(I=null,v=!0===f?k.Replace:k.Push,y=a.navigation,g=y.formMethod,b=y.formAction,w=y.formEncType,!c&&!s&&g&&b&&w&&(c=nt(a.navigation)),S=c||s,!(pe.has(o.status)&&S&&Ke(S.formMethod))){t.next=20;break}return t.next=18,se(v,p,{submission:E({},S,{formAction:o.location}),preventScrollReset:$});case 18:t.next=23;break;case 20:return x=rt(p,c),t.next=23,se(v,p,{overrideNavigation:x,fetcherSubmission:s,preventScrollReset:$});case 23:case"end":return t.stop()}}),t)}))),Oe.apply(this,arguments)}function De(e,t,n,r,a){return ze.apply(this,arguments)}function ze(){return ze=(0,a.Z)((0,r.Z)().mark((function n(a,o,i,l,u){var c,f,p;return(0,r.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Promise.all([].concat(x(i.map((function(e){return Te("loader",u,e,o,s,t,d)}))),x(l.map((function(n){return n.matches&&n.match&&n.controller?Te("loader",Ne(e.history,n.path,n.controller.signal),n.match,n.matches,s,t,d):{type:C.error,error:Ue(404,{pathname:n.path})}})))));case 2:return c=n.sent,f=c.slice(0,i.length),p=c.slice(i.length),n.next=7,Promise.all([Ye(a,i,f,f.map((function(){return u.signal})),!1,A.loaderData),Ye(a,l.map((function(e){return e.match})),p,l.map((function(e){return e.controller?e.controller.signal:null})),!0)]);case 7:return n.abrupt("return",{results:c,loaderResults:f,fetcherResults:p});case 8:case"end":return n.stop()}}),n)}))),ze.apply(this,arguments)}function Ze(){var e;Q=!0,(e=q).push.apply(e,x(ft())),ne.forEach((function(e,t){Y.has(t)&&(K.push(t),qe(t))}))}function He(e,t,n){var r=Fe(A.matches,t);Qe(e),ie({errors:(0,o.Z)({},r.route.id,n),fetchers:new Map(A.fetchers)})}function Qe(e){var t=A.fetchers.get(e);!Y.has(e)||t&&"loading"===t.state&&ee.has(e)||qe(e),ne.delete(e),ee.delete(e),te.delete(e),A.fetchers.delete(e)}function qe(e){var t=Y.get(e);L(t,"Expected fetch controller: "+e),t.abort(),Y.delete(e)}function Je(e){var t,n=w(e);try{for(n.s();!(t=n.n()).done;){var r=t.value,a=lt(_e(r).data);A.fetchers.set(r,a)}}catch(o){n.e(o)}finally{n.f()}}function Ge(){var e,t=[],n=!1,r=w(te);try{for(r.s();!(e=r.n()).done;){var a=e.value,o=A.fetchers.get(a);L(o,"Expected fetcher: "+a),"loading"===o.state&&(te.delete(a),t.push(a),n=!0)}}catch(i){r.e(i)}finally{r.f()}return Je(t),n}function et(e){var t,n=[],r=w(ee);try{for(r.s();!(t=r.n()).done;){var a=(0,m.Z)(t.value,2),o=a[0];if(a[1]0}function ut(e){A.blockers.delete(e),ae.delete(e)}function ct(e,t){var n=A.blockers.get(e)||ve;L("unblocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"blocked"===t.state||"blocked"===n.state&&"proceeding"===t.state||"blocked"===n.state&&"unblocked"===t.state||"proceeding"===n.state&&"unblocked"===t.state,"Invalid blocker state transition: "+n.state+" -> "+t.state);var r=new Map(A.blockers);r.set(e,t),ie({blockers:r})}function st(e){var t=e.currentLocation,n=e.nextLocation,r=e.historyAction;if(0!==ae.size){ae.size>1&&T(!1,"A router only supports one blocker at a time");var a=Array.from(ae.entries()),o=(0,m.Z)(a[a.length-1],2),i=o[0],l=o[1],u=A.blockers.get(i);if(!u||"proceeding"!==u.state)return l({currentLocation:t,nextLocation:n,historyAction:r})?i:void 0}}function ft(e){var t=[];return re.forEach((function(n,r){e&&!e(r)||(n.cancel(),t.push(r),re.delete(r))})),t}function dt(e,t){if(g){var n=g(e,t.map((function(e){return function(e,t){var n=e.route,r=e.pathname,a=e.params;return{id:n.id,pathname:r,params:a,data:t[n.id],handle:n.handle}}(e,A.loaderData)})));return n||e.key}return e.key}function pt(e,t){if(y&&b){var n=dt(e,t);y[n]=b()}}function ht(e,t){if(y){var n=dt(e,t),r=y[n];if("number"===typeof r)return r}return null}return M={get basename(){return d},get state(){return A},get routes(){return f},get window(){return n},initialize:function(){if(h=e.history.listen((function(t){var n=t.action,r=t.location,a=t.delta;if(!oe){T(0===ae.size||null!=a,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");var o=st({currentLocation:A.location,nextLocation:r,historyAction:n});return o&&null!=a?(oe=!0,e.history.go(-1*a),void ct(o,{state:"blocked",location:r,proceed:function(){ct(o,{state:"proceeding",proceed:void 0,reset:void 0,location:r}),e.history.go(a)},reset:function(){var e=new Map(A.blockers);e.set(o,ve),ie({blockers:e})}})):se(n,r)}oe=!1})),i){!function(e,t){try{var n=e.sessionStorage.getItem(be);if(n)for(var r=JSON.parse(n),a=0,o=Object.entries(r||{});a0){var n,r={},a=w(t);try{for(a.s();!(n=a.n()).done;){var o=(0,m.Z)(n.value,2),i=o[0],l=o[1];r[i]=x(l)}}catch(u){a.e(u)}finally{a.f()}try{e.sessionStorage.setItem(be,JSON.stringify(r))}catch(R){T(!1,"Failed to save applied view transitions in sessionStorage ("+R+").")}}}(n,V)};n.addEventListener("pagehide",t),W=function(){return n.removeEventListener("pagehide",t)}}return A.initialized||se(k.Pop,A.location),M},subscribe:function(e){return v.add(e),function(){return v.delete(e)}},enableScrollRestoration:function(e,t,n){if(y=e,b=t,g=n||null,!S&&A.navigation===he){S=!0;var r=ht(A.location,A.matches);null!=r&&ie({restoreScrollPosition:r})}return function(){y=null,b=null,g=null}},navigate:ue,fetch:function(e,t,n,r){if(l)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Y.has(e)&&qe(e);var a=c||f,o=ke(A.location,A.matches,d,p.v7_prependBasename,n,t,null==r?void 0:r.relative),i=F(a,o,d);if(i){var u=Se(p.v7_normalizeFormMethod,!0,o,r),s=u.path,h=u.submission,m=u.error;if(m)He(e,t,m);else{var v=tt(i,s);$=!0===(r&&r.preventScrollReset),h&&Ke(h.formMethod)?function(e,t,n,r,a,o){Pe.apply(this,arguments)}(e,t,s,v,i,h):(ne.set(e,{routeId:t,path:s}),function(e,t,n,r,a,o){Le.apply(this,arguments)}(e,t,s,v,i,h))}}else He(e,t,Ue(404,{pathname:o}))},revalidate:function(){Ze(),ie({revalidation:"loading"}),"submitting"!==A.navigation.state&&("idle"!==A.navigation.state?se(Z||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation}):se(A.historyAction,A.location,{startUninterruptedRevalidation:!0}))},createHref:function(t){return e.history.createHref(t)},encodeLocation:function(t){return e.history.encodeLocation(t)},getFetcher:_e,deleteFetcher:Qe,dispose:function(){h&&h(),W&&W(),v.clear(),I&&I.abort(),A.fetchers.forEach((function(e,t){return Qe(t)})),A.blockers.forEach((function(e,t){return ut(t)}))},getBlocker:function(e,t){var n=A.blockers.get(e)||ve;return ae.get(e)!==t&&ae.set(e,t),n},deleteBlocker:ut,_internalFetchControllers:Y,_internalActiveDeferreds:re,_internalSetRoutes:function(e){c=j(e,t,void 0,s={})}},M}Symbol("deferred");function ke(e,t,n,r,a,o,i){var l,u;if(null!=o&&"path"!==i){l=[];var c,s=w(t);try{for(s.s();!(c=s.n()).done;){var f=c.value;if(l.push(f),f.route.id===o){u=f;break}}}catch(p){s.e(p)}finally{s.f()}}else l=t,u=t[t.length-1];var d=ee(a||".",G(l).map((function(e){return e.pathnameBase})),J(e.pathname,n)||e.pathname,"path"===i);return null==a&&(d.search=e.search,d.hash=e.hash),null!=a&&""!==a&&"."!==a||!u||!u.route.index||et(d.search)||(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&"/"!==n&&(d.pathname="/"===d.pathname?n:te([n,d.pathname])),O(d)}function Se(e,t,n,r){if(!r||!function(e){return null!=e&&("formData"in e&&null!=e.formData||"body"in e&&void 0!==e.body)}(r))return{path:n};if(r.formMethod&&!qe(r.formMethod))return{path:n,error:Ue(405,{method:r.formMethod})};var a,o,i=function(){return{path:n,error:Ue(400,{type:"invalid-body"})}},l=r.formMethod||"get",u=e?l.toUpperCase():l.toLowerCase(),c=Ze(n);if(void 0!==r.body){if("text/plain"===r.formEncType){if(!Ke(u))return i();var s="string"===typeof r.body?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((function(e,t){var n=(0,m.Z)(t,2);return""+e+n[0]+"="+n[1]+"\n"}),""):String(r.body);return{path:n,submission:{formMethod:u,formAction:c,formEncType:r.formEncType,formData:void 0,json:void 0,text:s}}}if("application/json"===r.formEncType){if(!Ke(u))return i();try{var f="string"===typeof r.body?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:u,formAction:c,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch(h){return i()}}}if(L("function"===typeof FormData,"FormData is not available in this environment"),r.formData)a=Oe(r.formData),o=r.formData;else if(r.body instanceof FormData)a=Oe(r.body),o=r.body;else if(r.body instanceof URLSearchParams)o=De(a=r.body);else if(null==r.body)a=new URLSearchParams,o=new FormData;else try{o=De(a=new URLSearchParams(r.body))}catch(h){return i()}var d={formMethod:u,formAction:c,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:o,json:void 0,text:void 0};if(Ke(d.formMethod))return{path:n,submission:d};var p=D(n);return t&&p.search&&et(p.search)&&a.append("index",""),p.search="?"+a,{path:O(p),submission:d}}function xe(e,t){var n=e;if(t){var r=e.findIndex((function(e){return e.route.id===t}));r>=0&&(n=e.slice(0,r))}return n}function Ee(e,t,n,r,a,o,i,l,u,c,s,f,d,p){var h=p?Object.values(p)[0]:d?Object.values(d)[0]:void 0,m=e.createURL(t.location),v=e.createURL(a),y=p?Object.keys(p)[0]:void 0,g=xe(n,y).filter((function(e,n){if(e.route.lazy)return!0;if(null==e.route.loader)return!1;if(function(e,t,n){var r=!t||n.route.id!==t.route.id,a=void 0===e[n.route.id];return r||a}(t.loaderData,t.matches[n],e)||i.some((function(t){return t===e.route.id})))return!0;var a=t.matches[n],l=e;return _e(e,E({currentUrl:m,currentParams:a.params,nextUrl:v,nextParams:l.params},r,{actionResult:h,defaultShouldRevalidate:o||m.pathname+m.search===v.pathname+v.search||m.search!==v.search||Ce(a,l)}))})),b=[];return u.forEach((function(e,a){if(n.some((function(t){return t.route.id===e.routeId}))){var i=F(s,e.path,f);if(i){var u=t.fetchers.get(a),d=tt(i,e.path);!c.has(a)&&(!!l.includes(a)||(u&&"idle"!==u.state&&void 0===u.data?o:_e(d,E({currentUrl:m,currentParams:t.matches[t.matches.length-1].params,nextUrl:v,nextParams:n[n.length-1].params},r,{actionResult:h,defaultShouldRevalidate:o}))))&&b.push({key:a,routeId:e.routeId,path:e.path,matches:i,match:d,controller:new AbortController})}else b.push({key:a,routeId:e.routeId,path:e.path,matches:null,match:null,controller:null})}})),[g,b]}function Ce(e,t){var n=e.route.path;return e.pathname!==t.pathname||null!=n&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function _e(e,t){if(e.route.shouldRevalidate){var n=e.route.shouldRevalidate(t);if("boolean"===typeof n)return n}return t.defaultShouldRevalidate}function Pe(e,t,n){return Le.apply(this,arguments)}function Le(){return(Le=(0,a.Z)((0,r.Z)().mark((function e(t,n,a){var o,i,l,u,c,s;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.lazy){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,t.lazy();case 4:if(o=e.sent,t.lazy){e.next=7;break}return e.abrupt("return");case 7:for(u in L(i=a[t.id],"No route found in manifest"),l={},o)c=i[u],T(!(s=void 0!==c&&"hasErrorBoundary"!==u),'Route "'+i.id+'" has a static property "'+u+'" defined but its lazy function is also returning a value for this property. The lazy route property "'+u+'" will be ignored.'),s||M.has(u)||(l[u]=o[u]);Object.assign(i,l),Object.assign(i,E({},n(i),{lazy:void 0}));case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(e,t,n,r,a,o,i,l){return Re.apply(this,arguments)}function Re(){return(Re=(0,a.Z)((0,r.Z)().mark((function e(t,n,a,o,i,l,u,c){var s,f,d,p,h,m,v,y,g,b,w,k,S,x,E,_,P,T,R;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===c&&(c={}),p=function(e){var t,r=new Promise((function(e,n){return t=n}));return d=function(){return t()},n.signal.addEventListener("abort",d),Promise.race([e({request:n,params:a.params,context:c.requestContext}),r])},e.prev=2,h=a.route[t],!a.route.lazy){e.next=32;break}if(!h){e.next=14;break}return e.next=8,Promise.all([p(h).catch((function(e){m=e})),Pe(a.route,l,i)]);case 8:if(v=e.sent,!m){e.next=11;break}throw m;case 11:f=v[0],e.next=30;break;case 14:return e.next=16,Pe(a.route,l,i);case 16:if(!(h=a.route[t])){e.next=23;break}return e.next=20,p(h);case 20:f=e.sent,e.next=30;break;case 23:if("action"!==t){e.next=29;break}throw y=new URL(n.url),g=y.pathname+y.search,Ue(405,{method:n.method,pathname:g,routeId:a.route.id});case 29:return e.abrupt("return",{type:C.data,data:void 0});case 30:e.next=41;break;case 32:if(h){e.next=38;break}throw b=new URL(n.url),Ue(404,{pathname:b.pathname+b.search});case 38:return e.next=40,p(h);case 40:f=e.sent;case 41:L(void 0!==f,"You defined "+("action"===t?"an action":"a loader")+' for route "'+a.route.id+"\" but didn't return anything from your `"+t+"` function. Please return a value or `null`."),e.next=48;break;case 44:e.prev=44,e.t0=e.catch(2),s=C.error,f=e.t0;case 48:return e.prev=48,d&&n.signal.removeEventListener("abort",d),e.finish(48);case 51:if(!Qe(f)){e.next=77;break}if(w=f.status,!de.has(w)){e.next=61;break}if(L(k=f.headers.get("Location"),"Redirects returned/thrown from loaders/actions must have a Location header"),ye.test(k)?c.isStaticRequest||(S=new URL(n.url),x=k.startsWith("//")?new URL(S.protocol+k):new URL(k),E=null!=J(x.pathname,u),x.origin===S.origin&&E&&(k=x.pathname+x.search+x.hash)):k=ke(new URL(n.url),o.slice(0,o.indexOf(a)+1),u,!0,k),!c.isStaticRequest){e.next=60;break}throw f.headers.set("Location",k),f;case 60:return e.abrupt("return",{type:C.redirect,status:w,location:k,revalidate:null!==f.headers.get("X-Remix-Revalidate"),reloadDocument:null!==f.headers.get("X-Remix-Reload-Document")});case 61:if(!c.isRouteRequest){e.next=64;break}throw{type:s===C.error?C.error:C.data,response:f};case 64:if(!(P=f.headers.get("Content-Type"))||!/\bapplication\/json\b/.test(P)){e.next=71;break}return e.next=68,f.json();case 68:_=e.sent,e.next=74;break;case 71:return e.next=73,f.text();case 73:_=e.sent;case 74:if(s!==C.error){e.next=76;break}return e.abrupt("return",{type:s,error:new ie(w,f.statusText,_),headers:f.headers});case 76:return e.abrupt("return",{type:C.data,data:_,statusCode:f.status,headers:f.headers});case 77:if(s!==C.error){e.next=79;break}return e.abrupt("return",{type:s,error:f});case 79:if(!He(f)){e.next=81;break}return e.abrupt("return",{type:C.deferred,deferredData:f,statusCode:null==(T=f.init)?void 0:T.status,headers:(null==(R=f.init)?void 0:R.headers)&&new Headers(f.init.headers)});case 81:return e.abrupt("return",{type:C.data,data:f});case 82:case"end":return e.stop()}}),e,null,[[2,44,48,51]])})))).apply(this,arguments)}function Ne(e,t,n,r){var a=e.createURL(Ze(t)).toString(),o={signal:n};if(r&&Ke(r.formMethod)){var i=r.formMethod,l=r.formEncType;o.method=i.toUpperCase(),"application/json"===l?(o.headers=new Headers({"Content-Type":l}),o.body=JSON.stringify(r.json)):"text/plain"===l?o.body=r.text:"application/x-www-form-urlencoded"===l&&r.formData?o.body=Oe(r.formData):o.body=r.formData}return new Request(a,o)}function Oe(e){var t,n=new URLSearchParams,r=w(e.entries());try{for(r.s();!(t=r.n()).done;){var a=(0,m.Z)(t.value,2),o=a[0],i=a[1];n.append(o,"string"===typeof i?i:i.name)}}catch(l){r.e(l)}finally{r.f()}return n}function De(e){var t,n=new FormData,r=w(e.entries());try{for(r.s();!(t=r.n()).done;){var a=(0,m.Z)(t.value,2),o=a[0],i=a[1];n.append(o,i)}}catch(l){r.e(l)}finally{r.f()}return n}function ze(e,t,n,r,a){var o,i={},l=null,u=!1,c={};return n.forEach((function(n,s){var f=t[s].route.id;if(L(!We(n),"Cannot handle redirect results in processLoaderData"),Ve(n)){var d=Fe(e,f),p=n.error;r&&(p=Object.values(r)[0],r=void 0),null==(l=l||{})[d.route.id]&&(l[d.route.id]=p),i[f]=void 0,u||(u=!0,o=le(n.error)?n.error.status:500),n.headers&&(c[f]=n.headers)}else Be(n)?(a.set(f,n.deferredData),i[f]=n.deferredData.data):i[f]=n.data,null==n.statusCode||200===n.statusCode||u||(o=n.statusCode),n.headers&&(c[f]=n.headers)})),r&&(l=r,i[Object.keys(r)[0]]=void 0),{loaderData:i,errors:l,statusCode:o||200,loaderHeaders:c}}function Me(e,t,n,r,a,i,l,u){for(var c=ze(t,n,r,a,u),s=c.loaderData,f=c.errors,d=0;d=0;t--){var n=e[t];if(We(n))return{result:n,idx:t}}}function Ze(e){return O(E({},"string"===typeof e?D(e):e,{hash:""}))}function $e(e,t){return e.pathname===t.pathname&&e.search===t.search&&(""===e.hash?""!==t.hash:e.hash===t.hash||""!==t.hash)}function Be(e){return e.type===C.deferred}function Ve(e){return e.type===C.error}function We(e){return(e&&e.type)===C.redirect}function He(e){var t=e;return t&&"object"===typeof t&&"object"===typeof t.data&&"function"===typeof t.subscribe&&"function"===typeof t.cancel&&"function"===typeof t.resolveData}function Qe(e){return null!=e&&"number"===typeof e.status&&"string"===typeof e.statusText&&"object"===typeof e.headers&&"undefined"!==typeof e.body}function qe(e){return fe.has(e.toLowerCase())}function Ke(e){return ce.has(e.toLowerCase())}function Ye(e,t,n,r,a,o){return Je.apply(this,arguments)}function Je(){return(Je=(0,a.Z)((0,r.Z)().mark((function e(t,n,a,o,i,l){var u,c;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=(0,r.Z)().mark((function e(u){var c,s,f,d,p;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=a[u],s=n[u]){e.next=4;break}return e.abrupt("return",1);case 4:if(f=t.find((function(e){return e.route.id===s.route.id})),d=null!=f&&!Ce(f,s)&&void 0!==(l&&l[s.route.id]),!Be(c)||!i&&!d){e.next=11;break}return L(p=o[u],"Expected an AbortSignal for revalidating fetcher deferred result"),e.next=11,Xe(c,p,i).then((function(e){e&&(a[u]=e||a[u])}));case 11:case"end":return e.stop()}}),e)})),c=0;case 2:if(!(c