mind-link-ai-widget
Version:
A react widget for React Web and React-Native Mobile integrations.
331 lines (282 loc) • 20.6 kB
JavaScript
;const s=require("react"),B=require("react-router-dom");var N={exports:{}},x={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var C;function T(){if(C)return x;C=1;var e=s,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,l=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function p(m,a,b){var d,h={},f=null,v=null;b!==void 0&&(f=""+b),a.key!==void 0&&(f=""+a.key),a.ref!==void 0&&(v=a.ref);for(d in a)i.call(a,d)&&!u.hasOwnProperty(d)&&(h[d]=a[d]);if(m&&m.defaultProps)for(d in a=m.defaultProps,a)h[d]===void 0&&(h[d]=a[d]);return{$$typeof:t,type:m,key:f,ref:v,props:h,_owner:l.current}}return x.Fragment=n,x.jsx=p,x.jsxs=p,x}var S;function W(){return S||(S=1,N.exports=T()),N.exports}var r=W(),E={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},A=s.createContext&&s.createContext(E),V=["attr","size","title"];function H(e,t){if(e==null)return{};var n=F(e,t),i,l;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(l=0;l<u.length;l++)i=u[l],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function F(e,t){if(e==null)return{};var n={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;n[i]=e[i]}return n}function j(){return j=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},j.apply(this,arguments)}function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(l){return Object.getOwnPropertyDescriptor(e,l).enumerable})),n.push.apply(n,i)}return n}function w(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?_(Object(n),!0).forEach(function(i){q(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function q(e,t,n){return t=J(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function J(e){var t=K(e,"string");return typeof t=="symbol"?t:t+""}function K(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,t);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function P(e){return e&&e.map((t,n)=>s.createElement(t.tag,w({key:n},t.attr),P(t.child)))}function g(e){return t=>s.createElement(Y,j({attr:w({},e.attr)},t),P(e.child))}function Y(e){var t=n=>{var{attr:i,size:l,title:u}=e,p=H(e,V),m=l||n.size||"1em",a;return n.className&&(a=n.className),e.className&&(a=(a?a+" ":"")+e.className),s.createElement("svg",j({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,i,p,{className:a,style:w(w({color:e.color||n.color},n.style),e.style),height:m,width:m,xmlns:"http://www.w3.org/2000/svg"}),u&&s.createElement("title",null,u),e.children)};return A!==void 0?s.createElement(A.Consumer,null,n=>t(n)):t(E)}function $(e){return g({attr:{viewBox:"0 0 460 512"},child:[{tag:"path",attr:{d:"M220.6 130.3l-67.2 28.2V43.2L98.7 233.5l54.7-24.2v130.3l67.2-209.3zm-83.2-96.7l-1.3 4.7-15.2 52.9C80.6 106.7 52 145.8 52 191.5c0 52.3 34.3 95.9 83.4 105.5v53.6C57.5 340.1 0 272.4 0 191.6c0-80.5 59.8-147.2 137.4-158zm311.4 447.2c-11.2 11.2-23.1 12.3-28.6 10.5-5.4-1.8-27.1-19.9-60.4-44.4-33.3-24.6-33.6-35.7-43-56.7-9.4-20.9-30.4-42.6-57.5-52.4l-9.7-14.7c-24.7 16.9-53 26.9-81.3 28.7l2.1-6.6 15.9-49.5c46.5-11.9 80.9-54 80.9-104.2 0-54.5-38.4-102.1-96-107.1V32.3C254.4 37.4 320 106.8 320 191.6c0 33.6-11.2 64.7-29 90.4l14.6 9.6c9.8 27.1 31.5 48 52.4 57.4s32.2 9.7 56.8 43c24.6 33.2 42.7 54.9 44.5 60.3s.7 17.3-10.5 28.5zm-9.9-17.9c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z"},child:[]}]})(e)}function I(e){return g({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z"},child:[]}]})(e)}function Q(e){return g({attr:{viewBox:"0 0 576 512"},child:[{tag:"path",attr:{d:"M208 0c-29.9 0-54.7 20.5-61.8 48.2-.8 0-1.4-.2-2.2-.2-35.3 0-64 28.7-64 64 0 4.8.6 9.5 1.7 14C52.5 138 32 166.6 32 200c0 12.6 3.2 24.3 8.3 34.9C16.3 248.7 0 274.3 0 304c0 33.3 20.4 61.9 49.4 73.9-.9 4.6-1.4 9.3-1.4 14.1 0 39.8 32.2 72 72 72 4.1 0 8.1-.5 12-1.2 9.6 28.5 36.2 49.2 68 49.2 39.8 0 72-32.2 72-72V64c0-35.3-28.7-64-64-64zm368 304c0-29.7-16.3-55.3-40.3-69.1 5.2-10.6 8.3-22.3 8.3-34.9 0-33.4-20.5-62-49.7-74 1-4.5 1.7-9.2 1.7-14 0-35.3-28.7-64-64-64-.8 0-1.5.2-2.2.2C422.7 20.5 397.9 0 368 0c-35.3 0-64 28.6-64 64v376c0 39.8 32.2 72 72 72 31.8 0 58.4-20.7 68-49.2 3.9.7 7.9 1.2 12 1.2 39.8 0 72-32.2 72-72 0-4.8-.5-9.5-1.4-14.1 29-12 49.4-40.6 49.4-73.9z"},child:[]}]})(e)}function G(e){return g({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M320.2 243.8l-49.7 99.4c-6 12.1-23.4 11.7-28.9-.6l-56.9-126.3-30 71.7H60.6l182.5 186.5c7.1 7.3 18.6 7.3 25.7 0L451.4 288H342.3l-22.1-44.2zM473.7 73.9l-2.4-2.5c-51.5-52.6-135.8-52.6-187.4 0L256 100l-27.9-28.5c-51.5-52.7-135.9-52.7-187.4 0l-2.4 2.4C-10.4 123.7-12.5 203 31 256h102.4l35.9-86.2c5.4-12.9 23.6-13.2 29.4-.4l58.2 129.3 49-97.9c5.9-11.8 22.7-11.8 28.6 0l27.6 55.2H481c43.5-53 41.4-132.3-7.3-182.1z"},child:[]}]})(e)}function X(e){return g({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M224 256c70.7 0 128-57.3 128-128S294.7 0 224 0 96 57.3 96 128s57.3 128 128 128zm89.6 32h-16.7c-22.2 10.2-46.9 16-72.9 16s-50.6-5.8-72.9-16h-16.7C60.2 288 0 348.2 0 422.4V464c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48v-41.6c0-74.2-60.2-134.4-134.4-134.4z"},child:[]}]})(e)}function Z(e){return g({attr:{role:"img",viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M.87 18.257c-.248.382-.53.875-.763 1.245a.764.764 0 0 0 .255 1.04l4.965 3.054a.764.764 0 0 0 1.058-.26c.199-.332.454-.763.733-1.221 1.967-3.247 3.945-2.853 7.508-1.146l4.957 2.337a.764.764 0 0 0 1.028-.382l2.364-5.346a.764.764 0 0 0-.382-1 599.851 599.851 0 0 1-4.965-2.361C10.911 10.97 5.224 11.185.87 18.257zM23.131 5.743c.249-.405.531-.875.764-1.25a.764.764 0 0 0-.256-1.034L18.675.404a.764.764 0 0 0-1.058.26c-.195.335-.451.763-.734 1.225-1.966 3.246-3.945 2.85-7.508 1.146L4.437.694a.764.764 0 0 0-1.027.382L1.046 6.422a.764.764 0 0 0 .382 1c1.039.49 3.105 1.467 4.965 2.361 6.698 3.246 12.392 3.029 16.738-4.04z"},child:[]}]})(e)}const c=[];for(let e=0;e<256;++e)c.push((e+256).toString(16).slice(1));function ee(e,t=0){return(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase()}let O;const re=new Uint8Array(16);function te(){if(!O){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");O=crypto.getRandomValues.bind(crypto)}return O(re)}const ne=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),z={randomUUID:ne};function k(e,t,n){if(z.randomUUID&&!e)return z.randomUUID();e=e||{};const i=e.random??e.rng?.()??te();if(i.length<16)throw new Error("Random bytes length must be >= 16");return i[6]=i[6]&15|64,i[8]=i[8]&63|128,ee(i)}const ie=ae();function ae(){return k()}oe();function oe(){return k()}const se=s.createContext(void 0);function ce(){const e=s.useContext(se);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}function le(){const e=B.useNavigate(),{logout:t}=ce(),[n,i]=s.useState(""),[l,u]=s.useState(""),[p]=s.useState("Dental"),[m]=s.useState("en"),[a,b]=s.useState(""),[d,h]=s.useState(!1);function f(){t(),e("/login",{replace:!0})}const v=()=>{h(!d)},y=s.useRef(null);s.useEffect(()=>{function o(U){y.current&&!y.current.contains(U.target)&&h(!1)}return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[]);const R=["CA","CO","CT","GA","IN","KY","ME","MO","NH","NV","NY","OH","VA","WI"],L=["AK","AL","AR","AZ","DE","FL","HI","ID","IL","IA","KS","LA","MD","MA","MI","MN","MS","MT","NE","NJ","NM","NC","ND","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","WA","WV","WY"],M=["Anthem","WellPoint"];function D(){e("/antwell",{state:{brand:n,stateCode:l,category:p,language:m,userQuery:a,uuid:ie}})}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"dashboard-container",children:[r.jsx("header",{className:"dashboard-header",children:r.jsxs("div",{className:"header-content",children:[r.jsx("div",{className:"brand-section",children:r.jsxs("div",{className:"logo-wrapper",children:[r.jsx(Q,{className:"brand-icon"}),r.jsxs("div",{className:"brand-text",children:[r.jsx("h1",{children:"MindLink AI"}),r.jsx("span",{className:"tagline",children:"Healthcare Intelligence Platform"})]})]})}),r.jsxs("nav",{className:"header-nav",children:[r.jsxs("button",{onClick:()=>window.open("https://confluence.elevancehealth.com/spaces/MINDLINKAI/pages/1807005423/Mindlink+AI","_blank"),className:"nav-button",title:"Documentation",children:[r.jsx(Z,{}),r.jsx("span",{children:"Docs"})]}),r.jsxs("div",{className:"user-menu",ref:y,children:[r.jsxs("button",{onClick:v,className:"user-button","aria-expanded":d,children:[r.jsx(X,{}),r.jsx("span",{children:"Account"})]}),d&&r.jsx("div",{className:"dropdown-menu",children:r.jsx("button",{onClick:f,className:"dropdown-item",children:"Logout"})})]})]})]})}),r.jsxs("main",{className:"dashboard-main",children:[r.jsxs("div",{className:"welcome-section",children:[r.jsx("h2",{children:"Welcome to MindLink AI"}),r.jsx("p",{children:"Empowering healthcare with intelligent AI solutions for better member experiences"})]}),r.jsxs("div",{className:"services-grid",children:[r.jsxs("div",{className:"service-card antwell",children:[r.jsxs("div",{className:"card-header",children:[r.jsx("div",{className:"service-icon",children:r.jsx($,{})}),r.jsxs("div",{className:"service-info",children:[r.jsx("h3",{children:"AntWell AI"}),r.jsx("p",{children:"Smart healthcare search and insights"})]})]}),r.jsxs("div",{className:"service-form",children:[r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Brand"}),r.jsxs("select",{value:n,onChange:o=>i(o.target.value),className:"form-select",children:[r.jsx("option",{value:"",children:"Choose brand..."}),M.map(o=>r.jsx("option",{value:o,children:o},o))]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"State"}),r.jsxs("select",{value:l,onChange:o=>u(o.target.value),className:"form-select",disabled:!n,children:[r.jsx("option",{value:"",children:"Choose state..."}),n==="Anthem"?R.map(o=>r.jsx("option",{value:o,children:o},o)):L.map(o=>r.jsx("option",{value:o,children:o},o))]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Search Query"}),r.jsx("input",{type:"text",value:a,onChange:o=>b(o.target.value),placeholder:"What can I help you find?",className:"form-input"})]})]}),r.jsxs("button",{className:`service-button ${!n||!l||!a.trim()?"disabled":""}`,onClick:n&&l&&a.trim()?D:void 0,disabled:!n||!l||!a.trim(),children:[r.jsx("span",{children:"Start Search"}),r.jsx(I,{})]})]}),r.jsxs("div",{className:"service-card behive",onClick:()=>e("/behive"),children:[r.jsxs("div",{className:"card-header",children:[r.jsx("div",{className:"service-icon",children:r.jsx(G,{})}),r.jsxs("div",{className:"service-info",children:[r.jsx("h3",{children:"Behive AI"}),r.jsx("p",{children:"Behavioral health assistant"})]})]}),r.jsx("div",{className:"service-description",children:r.jsxs("ul",{children:[r.jsx("li",{children:"Mental health resources"}),r.jsx("li",{children:"Counselor search"}),r.jsx("li",{children:"Behavioral health assessments"}),r.jsx("li",{children:"Counselor appointments"}),r.jsx("li",{children:"Insurance benefits info"}),r.jsx("li",{children:"Behavioral health resources"}),r.jsx("li",{children:"Claims assistance"})]})}),r.jsxs("button",{className:"service-button",children:[r.jsx("span",{children:"Launch Behive"}),r.jsx(I,{})]})]})]})]})]}),r.jsx("style",{children:`
.dashboard-container {
min-height: 100vh;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.dashboard-header {
background: rgba(255, 255, 255, 0.95);
backdrop-filter: blur(10px);
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
position: sticky;
top: 0;
z-index: 100;
}
.header-content {
max-width: 1200px;
margin: 0 auto;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.brand-section {
display: flex;
align-items: center;
}
.logo-wrapper {
display: flex;
align-items: center;
gap: 1rem;
}
.brand-icon {
font-size: 2.5rem;
color: #667eea;
}
.brand-text h1 {
margin: 0;
font-size: 1.5rem;
font-weight: 700;
color: #1a202c;
}
.tagline {
font-size: 0.8rem;
color: #718096;
font-weight: 500;
}
.header-nav {
display: flex;
gap: 1rem;
align-items: center;
}
.nav-button, .user-button {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: transparent;
border: 1px solid #e2e8f0;
border-radius: 8px;
color: #4a5568;
cursor: pointer;
transition: all 0.2s ease;
font-size: 0.9rem;
}
.nav-button:hover, .user-button:hover {
background: #f7fafc;
border-color: #cbd5e0;
}
.user-menu {
position: relative;
}
.dropdown-menu {
position: absolute;
top: 100%;
right: 0;
background: white;
border: 1px solid #e2e8f0;
border-radius: 8px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
min-width: 150px;
margin-top: 0.5rem;
z-index: 1000;
}
.dropdown-item {
width: 100%;
padding: 0.75rem 1rem;
background: none;
border: none;
text-align: left;
cursor: pointer;
transition: background 0.2s ease;
}
.dropdown-item:hover {
background: #f7fafc;
}
.dashboard-main {
max-width: 1200px;
margin: 0 auto;
padding: 3rem 2rem;
}
.welcome-section {
text-align: center;
margin-bottom: 3rem;
}
.welcome-section h2 {
font-size: 2.5rem;
font-weight: 700;
color: #1a202c;
margin: 0 0 1rem 0;
}
.welcome-section p {
font-size: 1.1rem;
color: #718096;
margin: 0;
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
gap: 2rem;
max-width: 900px;
margin: 0 auto;
}
.service-card {
background: white;
border-radius: 16px;
padding: 2rem;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
border: 1px solid rgba(0, 0, 0, 0.05);
}
.service-card:hover {
transform: translateY(-4px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}
.service-card.behive {
cursor: pointer;
}
.card-header {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
}
.service-icon {
width: 60px;
height: 60px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
color: white;
}
.antwell .service-icon {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.behive .service-icon {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.service-info h3 {
margin: 0 0 0.25rem 0;
font-size: 1.25rem;
font-weight: 600;
color: #1a202c;
}
.service-info p {
margin: 0;
color: #718096;
font-size: 0.9rem;
}
.service-form {
margin-bottom: 1.5rem;
}
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: #374151;
font-size: 0.9rem;
}
.form-select, .form-input {
width: 100%;
padding: 0.75rem;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 0.9rem;
transition: border-color 0.2s ease;
background: white;
}
.form-select:focus, .form-input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.form-select:disabled {
background: #f9fafb;
color: #9ca3af;
}
.service-description ul {
list-style: none;
padding: 0;
margin: 0 0 1.5rem 0;
}
.service-description li {
padding: 0.5rem 0;
color: #4a5568;
position: relative;
padding-left: 1.5rem;
}
.service-description li:before {
content: '✓';
position: absolute;
left: 0;
color: #10b981;
font-weight: bold;
}
.service-button {
width: 100%;
padding: 0.875rem 1.5rem;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
}
.service-button:hover:not(.disabled) {
transform: translateY(-1px);
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.service-button.disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
.behive .service-button {
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}
.behive .service-button:hover {
box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}
@media (max-width: 768px) {
.header-content {
padding: 1rem;
flex-direction: column;
gap: 1rem;
}
.dashboard-main {
padding: 2rem 1rem;
}
.welcome-section h2 {
font-size: 2rem;
}
.services-grid {
grid-template-columns: 1fr;
gap: 1.5rem;
}
.service-card {
padding: 1.5rem;
}
.nav-button span, .user-button span {
display: none;
}
}
`})]})}module.exports=le;