@telia-ace/conversational-hub-bot-provider 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,644 +0,0 @@
1
- "use strict";var ke=Object.defineProperty;var Ne=(t,e,o)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var q=(t,e,o)=>(Ne(t,typeof e!="symbol"?e+"":e,o),o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),n=require("./index-482ea30a.js"),b=require("react");require("react-dom");function D(t={}){const{phrase:e="",category:o,guideCategory:s,contactCategory:i,take:r,connectionKey:c,accordion:a,id:l,uriName:d,sorting:g,tag:f,tagId:y,tagTitle:v,...p}=t,m={};return Object.keys(p).forEach(h=>{typeof t[h]=="string"&&(m[h]=t[h])}),typeof e=="string"&&e.length&&(m.phrase=e),e===null&&(m.phrase=e),typeof s=="string"&&s!=="0"&&(m.guideCategory=s),typeof s=="number"&&s!==0&&(m.guideCategory=s),typeof s=="object"&&s!==null&&(typeof s.id=="string"&&s.id!=="0"&&(m.guideCategory=s.id),typeof s.id=="number"&&s.id!==0&&(m.guideCategory=s.id)),typeof i=="string"&&i!=="0"&&(m.contactCategory=i),typeof i=="number"&&i!==0&&(m.contactCategory=i),typeof i=="object"&&i!==null&&(typeof i.id=="string"&&i.id!=="0"&&(m.contactCategory=i.id),typeof i.id=="number"&&i.id!==0&&(m.contactCategory=i.id)),typeof o=="string"&&o!=="0"&&(m.category=o),typeof o=="number"&&o!==0&&(m.category=o),typeof o=="object"&&o!==null&&(typeof o.id=="string"&&o.id!=="0"&&(m.category=o.id),typeof o.id=="number"&&o.id!==0&&(m.category=o.id)),l&&(m.id=l),d&&(+m.category||+m.guideCategory||+m.guide||+m.contactCategory||+m.contactMethod)&&(m.uriName=d),c&&(m.connectionKey=c),r&&(m.take=r),g&&(m.sorting=g),typeof a=="string"&&a.length>0&&(m.accordion=a),typeof f=="string"&&f!=="0"&&(m.tag=f),typeof f=="number"&&f!==0&&(m.tag=f),Array.isArray(f)&&f.length&&(m.tag=f),(typeof y=="string"||typeof y=="number")&&(m.tagId=y),typeof v=="string"&&(m.tagTitle=v),typeof m.tag=="string"&&(m.tag=m.tag.split(",")),m}const ee=t=>{if(!t)return"";const e=[{from:/[äæǽ]+/gi,to:"ae"},{from:/[öœ]+/gi,to:"oe"},{from:/[ü]+/gi,to:"ue"},{from:/[Ä]+/gi,to:"Ae"},{from:/[Ü]+/gi,to:"Ue"},{from:/[Ö]+/gi,to:"Oe"},{from:/[ÀÁÂÃÄÅǺĀĂĄǍΑΆẢẠẦẪẨẬẰẮẴẲẶА]+/gi,to:"A"},{from:/[àáâãåǻāăąǎªαάảạầấẫẩậằắẵẳặа]+/gi,to:"a"},{from:/[Б]+/gi,to:"B"},{from:/[б]+/gi,to:"b"},{from:/[ÇĆĈĊČ]+/gi,to:"C"},{from:/[çćĉċč]+/gi,to:"c"},{from:/[Д]+/gi,to:"D"},{from:/[д]+/gi,to:"d"},{from:/[ÐĎĐΔ]+/gi,to:"Dj"},{from:/[ðďđδ]+/gi,to:"dj"},{from:/[ÈÉÊËĒĔĖĘĚΕΈẼẺẸỀẾỄỂỆЕЭ]+/gi,to:"E"},{from:/[èéêëēĕėęěέεẽẻẹềếễểệеэ]+/gi,to:"e"},{from:/[Ф]+/gi,to:"F"},{from:/[ф]+/gi,to:"f"},{from:/[ĜĞĠĢΓГҐ]+/gi,to:"G"},{from:/[ĝğġģγгґ]+/gi,to:"g"},{from:/[ĤĦ]+/gi,to:"H"},{from:/[ĥħ]+/gi,to:"h"},{from:/[ÌÍÎÏĨĪĬǏĮİΗΉΊΙΪỈỊИЫ]+/gi,to:"I"},{from:/[ìíîïĩīĭǐįıηήίιϊỉịиыї]+/gi,to:"i"},{from:/[Ĵ]+/gi,to:"J"},{from:/[ĵ]+/gi,to:"j"},{from:/[ĶΚК]+/gi,to:"K"},{from:/[ķκк]+/gi,to:"k"},{from:/[ĹĻĽĿŁΛЛ]+/gi,to:"L"},{from:/[ĺļľŀłλл]+/gi,to:"l"},{from:/[М]+/gi,to:"M"},{from:/[м]+/gi,to:"m"},{from:/[ÑŃŅŇΝН]+/gi,to:"N"},{from:/[ñńņňʼnνн]+/gi,to:"n"},{from:/[ÒÓÔÕŌŎǑŐƠØǾΟΌΩΏỎỌỒỐỖỔỘỜỚỠỞỢО]+/gi,to:"O"},{from:/[òóôõōŏǒőơøǿºοόωώỏọồốỗổộờớỡởợо]+/gi,to:"o"},{from:/[П]+/gi,to:"P"},{from:/[п]+/gi,to:"p"},{from:/[ŔŖŘΡР]+/gi,to:"R"},{from:/[ŕŗřρр]+/gi,to:"r"},{from:/[ŚŜŞȘŠΣС]+/gi,to:"S"},{from:/[śŝşșšſσςс]+/gi,to:"s"},{from:/[ȚŢŤŦτТ]+/gi,to:"T"},{from:/[țţťŧт]+/gi,to:"t"},{from:/[ÙÚÛŨŪŬŮŰŲƯǓǕǗǙǛŨỦỤỪỨỮỬỰУ]+/gi,to:"U"},{from:/[ùúûũūŭůűųưǔǖǘǚǜυύϋủụừứữửựу]+/gi,to:"u"},{from:/[ÝŸŶΥΎΫỲỸỶỴЙ]+/gi,to:"Y"},{from:/[ýÿŷỳỹỷỵй]+/gi,to:"y"},{from:/[В]+/gi,to:"V"},{from:/[в]+/gi,to:"v"},{from:/[Ŵ]+/gi,to:"W"},{from:/[ŵ]+/gi,to:"w"},{from:/[ŹŻŽΖЗ]+/gi,to:"Z"},{from:/[źżžζз]+/gi,to:"z"},{from:/[ÆǼ]+/gi,to:"AE"},{from:/[ß]+/gi,to:"ss"},{from:/[IJ]+/gi,to:"IJ"},{from:/[ij]+/gi,to:"ij"},{from:/[Œ]+/gi,to:"OE"},{from:/[ƒ]+/gi,to:"f"},{from:/[ξ]+/gi,to:"ks"},{from:/[π]+/gi,to:"p"},{from:/[β]+/gi,to:"v"},{from:/[μ]+/gi,to:"m"},{from:/[ψ]+/gi,to:"ps"},{from:/[Ё]+/gi,to:"Yo"},{from:/[ё]+/gi,to:"yo"},{from:/[Є]+/gi,to:"Ye"},{from:/[є]+/gi,to:"ye"},{from:/[Ї]+/gi,to:"Yi"},{from:/[Ж]+/gi,to:"Zh"},{from:/[ж]+/gi,to:"zh"},{from:/[Х]+/gi,to:"Kh"},{from:/[х]+/gi,to:"kh"},{from:/[Ц]+/gi,to:"Ts"},{from:/[ц]+/gi,to:"ts"},{from:/[Ч]+/gi,to:"Ch"},{from:/[ч]+/gi,to:"ch"},{from:/[Ш]+/gi,to:"Sh"},{from:/[ш]+/gi,to:"sh"},{from:/[Щ]+/gi,to:"Shch"},{from:/[щ]+/gi,to:"shch"},{from:/[ЪъЬь]+/gi,to:""},{from:/[Ю]+/gi,to:"Yu"},{from:/[ю]+/gi,to:"yu"},{from:/[Я]+/gi,to:"Ya"},{from:/[я]+/gi,to:"ya"}],o=/[^a-zA-Z0-9]+/g,s=/[-]$/;let i=t;for(const r in e)e.hasOwnProperty(r)&&e[r].from.test(t)&&(i=i.replace(e[r].from,e[r].to));return i=i.replace(o,"-"),i=i.replace(s,""),i=i.toLowerCase(),i||"humany"},je=(t,e)=>{if(!t||!e)return!0;let o=e.parentNode,s=!1;for(;o!==null;)o===t&&(s=!0),o=o.parentNode;return s},te=(t={})=>(Object.keys(t).forEach(e=>{(t[e]===null||typeof t[e]>"u")&&delete t[e]}),t),K=(t,e)=>{let o=!0;return Object.keys(t).length!==Object.keys(e).length||Object.keys(t).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(t).forEach(i=>{if(o){const r=typeof t[i]>"u"?"":t[i],c=typeof e[i]>"u"?"":e[i];o=r.toString()===c.toString()}}),o)},fe=()=>b.useContext(n.ComponentNodeContext),Me=(t,e)=>{const o=fe(),s=n.useContainer(),[i,r]=b.useState(void 0),c=n.useIsMounted(),a=t||o.type||"";return b.useEffect(()=>{if(a){let l;return(e||s).getAsync("componentResolver").then(d=>{if(c.current){const g=d.getComponent(a);r(g)}l=d.registerResolver(a,g=>{c.current&&r(g)})}),()=>{l&&l()}}},[c,a,e,s]),i},ze=()=>b.useContext(n.ConversationContext),Te=()=>{const t=n.useComponentPlatform(),e=fe(),[o,s]=b.useState([]),[i,r]=b.useState();return b.useEffect(()=>{if(t&&e){const c=new n.ComponentQuery(t).withId(e.id),a=t.actions(c,e.type||n.uuid());r(a),o!==null&&(o.forEach(l=>{a.dispatch(l.key,l.data).then(d=>l.resolve(d)).catch(d=>l.reject(d))}),s(null))}},[t,e.id]),(c,a)=>o!==null?new Promise((l,d)=>{o.push({key:c,data:a,resolve:l,reject:d})}):i.dispatch(c,a)},Re=()=>{const[t,e]=b.useState(!1);return b.useEffect(()=>{const o=()=>{e(!1)},s=i=>{i.keyCode===9&&e(!0)};return window.addEventListener("keydown",s),window.addEventListener("click",o),()=>{window.removeEventListener("keydown",s),window.removeEventListener("click",o)}},[]),t},ie=t=>{const e=n.useContainer(),o=n.useRouter(),[s,i]=b.useState({name:"",params:{}}),r=n.useIsMounted();return b.useEffect(()=>{const c=(t||e).get("$widget");if(!c)return;const{events:a}=c;return a.subscribe("router:change",(d,{next:{routeData:g}})=>{if(r.current){const{name:f,params:y}=g;te(y),i({name:f,params:y})}})},[r,t,e]),b.useEffect(()=>{if(o&&o.history&&r.current){const c=o.getRouteData(),{name:a,params:l}=c;te(l),i({name:a,params:l})}},[o,r]),s};var ue=(t=>(t.HH_MM="hh:mm",t.YYYY_MM_DD="yyyy-mm-dd",t.YYYY_MM_DD_HH_MM="yyyy-mm-dd hh:mm",t))(ue||{});const he=({className:t="",format:e="hh:mm",timestamp:o})=>u.jsx("span",{className:n.appendClassNames(t,"humany-timestamp"),children:Ie(o,e)}),se=t=>`0${t}`.slice(-2);function Ie(t,e){const o=new Date(t),s=o.toTimeString().split(" ")[0].split(":"),i=s.length>1?`${s[0]}:${s[1]}`:s[0],r=o.getFullYear(),c=o.getMonth()+1,a=o.getDate(),l=`${r}-${se(c)}-${se(a)}`;return e==="yyyy-mm-dd"?l:e==="hh:mm"?i:`${l} ${i}`}var _=(t=>(t.guide="guide",t.link="link",t.default="default",t))(_||{});const re=t=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:o})=>t.get("settings").then(s=>{const{name:i,events:r}=t.get("$widget"),{data:{projection:c="",site:a="current",forceHttps:l=!1}}=s,d=new o(c,{credentials:"same-origin"}),g=new e(d,{funnel:i.replace("_contact-method","").replace("_contact",""),site:Ee(a,l)},null,t);return r.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),Ee=(t,e)=>()=>{const o=i=>{const r=document.createElement("a");return r.href=i,r};let s=window.location;return t==="referrer"&&document.referrer&&(s=o(document.referrer)),[e?"https:":"","//",s.host,s.pathname].join("")},E=t=>{if(t){const{Type:e,Content:o}=t;if(e&&o)return{type:e,content:o}}},oe=t=>t.map(e=>{const o={id:e.Id.toString(),title:e.Name,symbol:E(e.DefaultIcon),activeSymbol:e.ActiveIcon&&E(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(o.items=oe(e.Children)),o}),T=(t,e)=>t.filter(({Type:o})=>o===e).map(({Id:o,Title:s,Body:i})=>({id:o.toString(),title:s,body:i})),W=t=>t.map(({Id:e,Title:o,DefaultIcon:s,ListNotices:i,Notices:r})=>({id:e.toString(),title:o,symbol:E(s),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(r||[]).map(({Id:c,Title:a,Body:l,Type:d,Modified:g})=>({id:c.toString(),title:a,body:l,modified:g,expandable:d==="listNotice"}))})),Z=({Id:t,Title:e,DefaultIcon:o,Exits:[s],ExitType:i,ConfirmationText:r,ExpandFormAutomatically:c,Form:a,Description:l},d)=>{const{Adapter:g}=s||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:v=""}=g,p={id:t.toString(),title:e,description:l,symbol:E(o),clientName:f==="custom.adapter"?v:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:m,textBeforeClick:h}=y;m==="true"&&(p.expanded=!1,p.title=h),f.indexOf("phone.text")>-1?p.body.phoneNumber=y.phoneNumber:p.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(p.body=y,p.body.confirmationFallback=r),f.indexOf("ace")>-1&&(p.body=y),a&&a.HasValueComponents&&(d?p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a,d).get():p.body.form=n.FormBuilder.fromLegacyForm(t.toString(),a).get(),c||(p.expanded=p.inline=!1)),p},F=(t=[])=>t.map(({Id:e,Title:o,TotalMatches:s,Symbol:i,DefaultIcon:r,ActiveIcon:c})=>({id:e.toString(),title:o,matches:s,symbol:E(r||i),defaultIcon:E(r),activeIcon:E(c)})),J=t=>t.map(({Id:e,Title:o,Tags:s,FirstPublishedDate:i,Modified:r})=>({id:e.toString(),title:o,tags:F(s),published:i,modified:r})),Le=(t,e)=>{switch(t){case M.MatchByCategory:case M.Match:{const o={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:s,TotalMatches:i,Notices:r,NoticeLists:c,Tags:a,ByCategory:l}=e;return o.guides=J(s),o.matches=i,o.byCategory=(l||[]).map(({Id:d,Matches:g,TotalMatches:f})=>({id:d,guides:J(g),matches:f})),o.tags=F(a),o.notificationLists=W(c||[]),o.topNotifications=T(r||[],"noticeRowTop"),o.middleNotifications=T(r||[],"noticeRowMiddle"),o.bottomNotifications=T(r||[],"footerNotice"),o}case M.Categories:{const{Children:o,GuidesCountTotal:s}=e;return{categories:oe(o||[]),matches:s}}case M.Guide:{const{Id:o,Title:s,Body:i,Related:r,Options:c,ConnectionId:a,ContactMethods:l,EnableFeedback:d,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:v,FirstPublishedByDisplayName:p,Categories:m,Tags:h,SeoMetaDescription:x,SeoAllowIndex:R,Perspectives:N,PerspectiveKey:I,Translations:L}=e,C=I||Object.values(N).find(k=>k===a)||N.Default||null,G={guide:{id:o.toString(),title:s,body:i,modified:y,published:f,modifiedBy:v,publishedBy:p,connection:a,categories:m,hasHandover:g,allowFeedback:d,seoMetaDescription:x,seoAllowIndex:R,perspectives:N,perspective:C,translations:Object.keys(L||{}).reduce((k,A)=>(k[A]=L[A].toString(),k),{})},related:J(r||[]),dialog:[],contactMethods:(l||[]).map(k=>Z(k)),tags:F(h)};return(c||[]).forEach(({CanAccess:k,Description:A,ConnectionId:H,Properties:w})=>{if(!k)return;const S={id:o.toString(),title:A,connection:H,connectionKey:w.ConnectionKey,type:_.default,parent:{id:o.toString(),title:s,tags:F(h)}};if(w.Type==="Guide"||w.Type==="Link")switch(w.Id&&(S.id=w.Id.toString()),w.Uri&&(S.href=w.Uri),w.Target&&(S.target=w.Target),w.Type){case"Guide":S.type=_.guide;break;case"Link":S.type=_.link;break}G.dialog.push(S)}),G}case M.Contacts:{const{Children:o,Matches:s,Notices:i,NoticeLists:r}=e;return{contactMethods:(s||[]).map(a=>Z(a)),categories:oe(o||[]),topNotifications:T(i||[],"noticeRowTop"),middleNotifications:T(i||[],"noticeRowMiddle"),bottomNotifications:T(i||[],"footerNotice"),notificationLists:W(r||[])}}case M.ContactMethod:{const{ContactMethod:o}=e;return Z(o||{})}case M.Tags:case M.TagsOnGuides:return F(e||[]);case M.Notifications:{const{Notices:o,NoticeLists:s}=e;return{topNotifications:T(o||[],"noticeRowTop"),middleNotifications:T(o||[],"noticeRowMiddle"),bottomNotifications:T(o||[],"footerNotice"),notificationLists:W(s||[])}}default:return{}}};var ge=(t=>(t.Guide="guide",t.Guides="guides",t.GuidesByCategory="guides-by-category",t.RowNotifications="row-notices",t.NotificationLists="notification-lists",t.GuideCategories="guide-categories",t.ContactMethodCategories="contact-method-categories",t.ContactMethod="contact-method",t.ContactMethods="contact-methods",t.Tags="tags",t.TagsOnGuides="tagsonguides",t))(ge||{}),M=(t=>(t.Match="match",t.Categories="categories",t.Guide="guide",t.Contacts="contacts",t.ContactMethod="contact-method",t.MatchByCategory="match-by-category",t.Tags="tags",t.TagsOnGuides="tagsonguides",t.Notifications="notifications",t))(M||{});const ae=t=>{switch(t){case"guides":return"match";case"guides-by-category":return"match-by-category";case"guide":return"guide";case"guide-categories":return"categories";case"contact-method-categories":case"contact-methods":return"contacts";case"contact-method":return"contact-method";case"tags":return"tags";case"tagsonguides":return"tagsonguides";case"notification-lists":case"row-notices":return"notifications";default:throw"error"}},Ae=async t=>{const{invoke:e}=t.get("$widget");return await e("renderState")===n.WidgetRenderState.hidden};class P{constructor(e,o){q(this,"queries",new Map);q(this,"lastTake",0);q(this,"events");q(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((o,s)=>{o.some(r=>!r.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=o,this.events=e.get("$widget").events,this.events.subscribe("widget:settings-updated",()=>this.queries=new Map),this.events.subscribe("widget:render-state-changed",(s,{next:i,previous:r})=>{r===n.WidgetRenderState.hidden&&i===n.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,o="dataClient"){return n.lock(this)(()=>e.getAsync(o).then(async s=>{let i=await e.getAsync("matchingClient");i||(i=await re(e),e.registerAsync("matchingClient",()=>i));let r=s;return r||(r=new P(e,i),e.registerAsync(o,()=>r)),r}))}fetch(e,o,s){return new Promise((i,r)=>{o.take&&(this.lastTake=+(o.take||0)),te(o);const c=ae(e);let a=this.queries.get(c)||[],l=a.find(d=>K(d.params,o))||null;if(l&&(s!=null&&s.noCache)){const d=a.findIndex(g=>K(g.params,o));a=[...a.slice(0,d),...a.slice(d+1)],l=null}if(l){const d=a.indexOf(l);if(l.resolved?(this.events.dispatch("data-client:fetched",{params:o,type:c,response:l.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(l.data,c,l.error),l.data&&l.error?r({error:l.error}):i(l.data)):l.resolvers.push({resolve:i,reject:r}),a.splice(d,1),a.push(l),this.queries.set(c,a),!l.loading&&!l.resolved)return this.runQuery(c,o)}else return a.push({params:o,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:r}]}),this.queries.set(c,a),this.runQuery(c,o)}).then(i=>n.deepClone(i))}read(e,o){const{select:s}=o,i=ae(e);return(this.queries.get(i)||[]).reduce((a,l)=>{if(typeof s=="function"){const d=s(l.data);d&&a.push(d)}else a.push(l.data);return a},[])}feedback(e,o,s){return this.matchingClient.giveFeedback(e,o,s)}setLoadingStatus(e,o,s){const i=this.queries.get(e)||[],r=i.find(c=>K(c.params,o));r&&(r.loading=s),this.queries.set(e,i)}async runQuery(e,o){const{searchPhrase:s="",categories:i="0",contactMethodCategoryId:r="0",contactMethodId:c="0",tagId:a=void 0,take:l=5,connection:d="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:v="popularity-descending",guideIds:p=[]}=o,m=s.toString().trim();if(await Ae(this.container))return Promise.resolve();switch(e){case"match":{const h=x=>{const[R,N]=x.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(R),direction:N}};return p.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:p,take:+l}}).then(x=>x&&this.handleResponse(x,e,o)):this.matchingClient.match(m,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a,sorting:h(v),ids:p}).then(x=>x&&this.handleResponse(x,e,o))}case"match-by-category":return this.matchingClient.match(m,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+l,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"guide":return this.matchingClient.getGuide(g,{connectionId:d}).then(h=>{h&&this.handleResponse(h,e,o)}).catch(h=>{const x={message:"Something went wrong.",status:h.status||400};x.status===404&&(x.message="The guide could not be found."),this.handleResponse({},e,o,x)});case"categories":return this.matchingClient.getCategories({phrase:m,expand:f,tags:a}).then(h=>h&&this.handleResponse(h,e,o));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o)):this.matchingClient.contacts(+r,{phrase:m}).then(h=>h&&this.handleResponse(h,e,o));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(h=>h&&this.handleResponse(h,e,o));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:a}}).then(h=>h&&this.handleResponse(h,e,o));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:m,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(h=>h&&this.handleResponse(h,e,o))}}handleResponse(e={},o,s,i){const r=this.queries.get(o)||[],c=r.find(a=>K(a.params,s));if(c){const a=i||Le(o,e);this.track(a,o,i),c.resolvers.forEach(d=>{i?d.reject({error:a}):d.resolve(a)});const l=r.indexOf(c);l>-1&&r.splice(l,1),r.push({...c,error:i,resolvers:[],data:a,resolved:!0}),this.setLoadingStatus(o,s,!1),this.queries.set(o,r),i||this.events.dispatch("data-client:fetched",{type:o,params:s,response:a,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,o]of this.queries)o.filter(s=>!s.resolved).forEach(s=>{this.runQuery(e,s.params)})}track(e={},o,s){const i=this.container.get("$widget");i&&!s?i.events.dispatch("tracking:service-client-response",{type:o,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:o,error:s})}static create(e){return e.getAsync("matchingClient").then(async o=>{if(o)return new P(e,o);const s=await re(e);return e.registerAsync("matchingClient",()=>s),new P(e,s)})}getClient(){return this.matchingClient}}const Oe=({title:t="",className:e,id:o,parent:s,connection:i,type:r,target:c,href:a,children:l,connectionKey:d})=>{const g={},{name:f,params:y}=ie();switch(r){case"default":case"guide":const{id:v,title:p}=s;let m=d||i;v!==o&&!d&&(m=void 0),g.routeName=f,g.params=D({...y,guide:o,connection:m,uriName:ee(o===v?p:t)});break;case"link":g.href=a,g.target=c;break}return u.jsx(n.Link,{className:n.appendClassNames(e,"humany-dialog-link"),...g,children:l||u.jsxs(u.Fragment,{children:[r==="link"&&u.jsx(n.Icon,{faIcon:"link"}),u.jsx("span",{children:t})]})})};b.forwardRef(({className:t,dialog:e,...o},s)=>e.length?u.jsx(Be,{className:n.appendClassNames(t,"humany-dialog"),items:e,renderItem:i=>u.jsx("li",{"data-dialog":i.connection,children:u.jsx(Oe,{...i})},i.connection),...o,ref:s}):null);const Be=n.newStyled(n.List)`
2
- ${n.list}
3
- a {
4
- min-width: 150px;
5
- max-width: 400px;
6
- display: block;
7
- white-space: normal;
8
- ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&n.invertedHoverButton({primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
9
- }
10
-
11
- i {
12
- margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
13
- }
14
- `;n.newStyled(n.ItemList)`
15
- ${n.itemList}
16
- font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
17
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
18
- > ul > li {
19
- overflow: visible;
20
- font-weight: 300;
21
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
22
- }
23
- `;n.newStyled.div`
24
- background: #fff;
25
- border: #ccc 1px solid;
26
- box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
27
- font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
28
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
29
- `;n.newStyled.div`
30
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
31
- padding-bottom: 0;
32
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
33
- font-weight: normal;
34
- white-space: nowrap;
35
- display: flex;
36
- align-items: center;
37
-
38
- h1,
39
- h2,
40
- h3,
41
- h4,
42
- h5,
43
- h6 {
44
- margin: 0;
45
- font-weight: normal;
46
- padding-bottom: 0;
47
- }
48
-
49
- svg,
50
- i {
51
- margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
52
- }
53
- `;n.newStyled(n.List)`
54
- list-style: none;
55
- padding: 0;
56
- margin: 0;
57
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0;
58
-
59
- li {
60
- background: #fff;
61
-
62
- a {
63
- display: block;
64
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
65
- padding: ${t=>{var e,o;return`${(e=t.theme.sizes)==null?void 0:e.small} ${(o=t.theme.sizes)==null?void 0:o.normal}`}};
66
- cursor: pointer;
67
- color: #555;
68
- text-decoration: none;
69
-
70
- &:hover {
71
- background: #f9f9f9;
72
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
73
- }
74
- }
75
- }
76
- `;n.newStyled(n.ItemList)`
77
- ${n.itemList}
78
- font-family: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.type}};
79
- > div {
80
- ${t=>{var e;return n.headingElement(t)("> h1",n.css`
81
- font-size: ${(e=t.theme.fonts)==null?void 0:e.normal};
82
- line-height: 1.2em;
83
- `)}}
84
- }
85
- > ul > li {
86
- overflow: visible;
87
- font-weight: 300;
88
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
89
-
90
- a {
91
- display: inline-block;
92
-
93
- @media (hover: hover) {
94
- &:hover {
95
- text-decoration: underline;
96
- }
97
- }
98
- }
99
- }
100
- `;const qe=t=>n.css`
101
- ${t["data-loading"]&&"position: relative;"};
102
- ${t["data-loading"]&&"min-height: 150px;"}
103
- > * {
104
- transition: 200ms ease-out opacity;
105
- opacity: ${t["data-loading"]?"0.5":"1"};
106
- }
107
- .humany-loader {
108
- opacity: ${t["data-loading"]?"1":"0"};
109
- }
110
- `;n.newStyled(n.Icon)`
111
- && {
112
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
113
- }
114
- width: 1.2em;
115
- `;n.newStyled(n.Text)`
116
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.medium}};
117
- font-weight: normal;
118
- line-height: 1.2em;
119
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
120
- `;const Fe=n.newStyled(n.Button)`
121
- display: flex;
122
- align-items: center;
123
-
124
- ${t=>{var e;return t["data-has-label"]==="true"&&t["data-has-symbol"]==="true"&&`
125
- svg, i {
126
- margin: 0 ${(e=t.theme.sizes)==null?void 0:e.small} 0 0;
127
- }
128
- `}}
129
-
130
- &:focus-visible {
131
- ${t=>t["data-has-label"]==="true"&&n.paddedBorderTabStyle}
132
-
133
- svg, i {
134
- ${t=>t["data-has-label"]==="false"&&t["data-has-symbol"]==="true"&&n.css`
135
- ${n.paddedBorderTabStyle(t)}
136
- box-sizing: content-box;
137
- `}
138
- }
139
- }
140
-
141
- span {
142
- flex: 1;
143
- font-weight: 300;
144
- }
145
- `,Pe=({addFavoriteTooltip:t,removeFavoriteCancelLabel:e,removeFavoriteConfirmLabel:o,removeFavoriteHeader:s,removeFavoriteLabel:i,removeFavoriteTooltip:r,id:c,isFavorite:a,guideTitle:l,buttonLabel:d="",actions:{addFavorite:g,removeFavorite:f}})=>{const y=b.useCallback(()=>{f(c)},[c,f]),v=b.useCallback(()=>{g(c)},[c,g]),p=`${a?r:t}${l?`: "${l}"`:""}`;return a?u.jsx(n.Confirm,{trigger:u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,"data-favorite":"true","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(n.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(n.StyledText,{children:d})]}),onConfirm:y,cancelLabel:e,confirmLabel:o,header:s,text:i}):u.jsxs(ce,{className:"humany-favorite-button",title:p,"aria-label":p,onClick:v,"data-favorite":"false","data-has-label":d?"true":"false","data-has-symbol":"true",children:[u.jsx(n.SymbolBadge,{size:16,symbol:{type:"Svg",content:"star-empty"}}),d&&u.jsx(n.StyledText,{children:d})]})},ce=n.newStyled(Fe)`
146
- grid-area: favorite;
147
-
148
- &:focus-visible {
149
- svg {
150
- ${t=>{var e,o;return t["data-favorite"]==="true"?`
151
- fill: transparent;
152
-
153
- path {
154
- fill: transparent;
155
- }
156
- `:`
157
- fill: ${(e=t.theme.colors)==null?void 0:e.text};
158
-
159
- path {
160
- fill: ${(o=t.theme.colors)==null?void 0:o.text};
161
- }
162
- `}}
163
- }
164
- }
165
-
166
- ${t=>{var e,o,s,i,r,c,a;return((e=t.theme.colors)==null?void 0:e.text)&&n.css`
167
- svg {
168
- stroke: ${(o=t.theme.colors)==null?void 0:o.text};
169
-
170
- path {
171
- stroke: ${(s=t.theme.colors)==null?void 0:s.text};
172
- }
173
-
174
- ${t["data-favorite"]==="true"&&`
175
- fill: ${(i=t.theme.colors)==null?void 0:i.text};
176
-
177
- path {
178
- fill: ${(r=t.theme.colors)==null?void 0:r.text};
179
- }
180
- `};
181
- }
182
-
183
- &:hover {
184
- svg {
185
- ${t["data-favorite"]==="true"?`
186
- fill: transparent;
187
-
188
- path {
189
- fill: transparent;
190
- }
191
- `:`
192
- fill: ${(c=t.theme.colors)==null?void 0:c.text};
193
-
194
- path {
195
- fill: ${(a=t.theme.colors)==null?void 0:a.text};
196
- }
197
- `};
198
- }
199
- }
200
- `}}
201
- `;b.forwardRef(({onFeedback:t=()=>{},direction:e="horizontal",className:o,header:s,positive:i,negative:r,selected:c,...a},l)=>u.jsxs(Ge,{className:n.appendClassNames(o,"humany-feedback"),"data-direction":e,...n.convertToStringAttributes(a),ref:l,children:[!!s&&u.jsx(De,{children:s}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="positive","data-direction":e,onClick:()=>t("positive"),children:[u.jsx(n.Icon,{faIcon:"smile-o"}),u.jsx("span",{children:i})]}),u.jsxs(le,{className:"humany-feedback-button",disabled:!!c,"data-selected":c==="negative","data-direction":e,onClick:()=>t("negative"),children:[u.jsx(n.Icon,{faIcon:"frown-o"}),u.jsx("span",{children:r})]})]}));const De=n.newStyled(n.StyledText)`
202
- font-weight: normal;
203
- margin: 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}};
204
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
205
- display: block;
206
- `,le=n.newStyled(n.Button)`
207
- display: inline-block;
208
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
209
- font-weight: 300;
210
- && {
211
- margin-right: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
212
- }
213
-
214
- ${t=>{var e,o;return t["data-direction"]==="horizontal"&&n.css`
215
- width: 225px;
216
- max-width: calc(50% - ${(e=t.theme.sizes)==null?void 0:e.large} - ${(o=t.theme.sizes)==null?void 0:o.small});
217
- `}}
218
-
219
- ${t=>t["data-direction"]==="vertical"&&n.css`
220
- min-width: 190px;
221
- `}
222
-
223
- ${t=>{var e,o;return((e=t.theme.colors)==null?void 0:e.primary)&&n.invertedHoverButton({active:t["data-selected"],primaryColor:(o=t.theme.colors)==null?void 0:o.primary,secondaryColor:"#FFFFFF",theme:t.theme})}}
224
-
225
- i {
226
- margin: 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}} 0 0;
227
- }
228
- `,Ge=n.newStyled.div`
229
- ${t=>{var e;return t["data-direction"]==="vertical"&&n.css`
230
- > button {
231
- width: 100%;
232
- &:not(:last-child) {
233
- margin-bottom: ${(e=t.theme.sizes)==null?void 0:e.normal};
234
- }
235
- }
236
- `}}
237
- `,He=()=>{const t=n.useContainer(),[e,o]=b.useState([]),s=t.get("favorites");b.useEffect(()=>{if(s){o(s.get());const{events:l}=t.get("$widget");return l.subscribe("widget:favorites-updated",(g,{updated:f})=>{o([...f])})}},[]);const i=l=>s?s.add(l):Promise.resolve([]),r=l=>s?s.remove(l):Promise.resolve([]),c=()=>s?s.clear():Promise.resolve([]),a=b.useCallback(l=>e.indexOf(l)>-1?r(l):i(l),[e]);return[e,b.useMemo(()=>({addFavorite:i,removeFavorite:r,clearFavorites:c,toggleFavorite:a}),[e])]},Ye=({format:t=ue.YYYY_MM_DD_HH_MM,className:e="",byLabel:o="",modifiedLabel:s="",publishedLabel:i="",modifiedBy:r="",publishedBy:c="",showModified:a=!1,showPublished:l=!1,modified:d,published:g})=>{const f=l&&g?u.jsx(de,{format:t,timestamp:g}):null,y=a&&d?u.jsx(de,{format:t,timestamp:d}):null;return!f&&!y?null:u.jsxs(X,{className:n.appendClassNames(e,"humany-metadata"),children:[f&&u.jsxs(X,{className:"humany-published",children:[i,f,o&&c&&` ${o.replace("{{editor}}",c)}`]}),y&&u.jsxs(X,{className:"humany-modified",children:[f&&", ",s,y,o&&r&&` ${o.replace("{{editor}}",r)}`]})]})},de=n.newStyled(he)`
238
- &:not(:first-child) {
239
- margin-left: 4px;
240
- }
241
- &:not(:last-child) {
242
- margin-right: 4px;
243
- }
244
- `,X=n.newStyled(n.Text)`
245
- font-style: italic;
246
- `,Ue=({tags:t})=>t.filter(e=>e.symbol).length?u.jsx(Qe,{className:"humany-guide-list-tags",items:t,renderItem:({id:e,symbol:o,title:s})=>o&&u.jsx("li",{"data-tag":e,children:u.jsx(Ve,{size:18,symbol:o,title:s})},e)}):null;b.forwardRef(({title:t,id:e,route:o,symbolSize:s,collapseUri:i,children:r},c)=>{const{params:a}=ie();return u.jsxs(Ke,{ref:c,"data-guide":e,children:[u.jsx(n.TextLink,{title:t,"aria-label":t,routeName:o,params:D({...a,uriName:i||void 0,id:void 0,guide:void 0,accordion:void 0}),text:t,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:"caret-up"}})}),r]})});const Ke=n.newStyled.li`
247
- > a {
248
- grid-column: 1/-1;
249
- font-weight: bold;
250
- margin: 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0;
251
- }
252
-
253
- > div {
254
- grid-column: 1/-1;
255
- }
256
- `;b.forwardRef(({expandable:t=!1,routing:e={},paramMappers:o={},symbolSize:s=11,pageRole:i="link",pageCaret:r="down",showTags:c=!1,showFavoriteToggle:a=!1,localPaging:l=!1,onItemClick:d=()=>{},dispatch:g=()=>{},metadata:f={},pageLabel:y,className:v,children:p,items:m,renderItem:h,addFavoriteTooltip:x,removeFavoriteCancelLabel:R,removeFavoriteConfirmLabel:N,removeFavoriteHeader:I,removeFavoriteLabel:L,removeFavoriteTooltip:C,searchResultsEmptyLabel:G,...k},A)=>{const H=Re(),w=b.useRef(),S=n.usePrevious(m),{guide:ye="guide",page:pe="index"}=e,{guide:be=({id:$})=>D({guide:$}),page:ne=()=>D()}=o,[ve,xe]=He();b.useImperativeHandle(A,()=>w.current);const Q=$=>{const{id:z,title:j,tags:O,published:Y,modified:B,publishedBy:U,modifiedBy:V}=$;return u.jsxs("li",{"data-guide":z,"has-metadata":(!!(f!=null&&f.showPublished)&&!!Y||!!(f!=null&&f.showModified)&&!!B).toString(),children:[u.jsx(n.TextLink,{className:"humany-guide-link",title:j,"aria-label":j,routeName:ye,onClick:Se=>d(Se,$),params:be($),text:j,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:t?"caret-down":"caret-right"}})}),a&&u.jsx(Pe,{guideTitle:j,addFavoriteTooltip:x,removeFavoriteCancelLabel:R,removeFavoriteConfirmLabel:N,removeFavoriteHeader:I,removeFavoriteLabel:L,removeFavoriteTooltip:C,isFavorite:ve.indexOf(z)>-1,actions:xe,id:z}),c&&u.jsx(Ue,{tags:O}),u.jsx(We,{...f,indent:t?void 0:s,modified:B,published:Y,publishedBy:U,modifiedBy:V})]},z)},we=b.useCallback(($,z,j)=>h?h($,z,j,Q):Q($),[h,Q]),$e=b.useCallback($=>{l&&($.preventDefault(),g("page",ne()))},[g,l]);b.useEffect(()=>{if(S&&S.length<m.length&&w.current){const $=w.current.querySelectorAll(".humany-guide-list > ul > li"),z=$[S.length];if($.length===m.length&&S.length){const j=$[S.length];if(j){const O=j.querySelector(".humany-guide-link");O&&O.focus()}}else z&&new MutationObserver((O,Y)=>{O.forEach(B=>{if(B.addedNodes){const U=Array.from(B.addedNodes).find(V=>V.tagName==="A");U&&je(w.current,document.activeElement)&&(H&&U.focus(),Y.disconnect())}})}).observe(z,{attributes:!1,characterData:!1,childList:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1})}});const Ce=!!Object.keys(f).filter($=>typeof f[$]<"u").length;return u.jsxs(_e,{className:n.appendClassNames(v,"humany-guide-list"),"data-item-count":m.length,items:m,renderItem:we,isTabbing:H,expandable:t?"true":"false","grid-items":c||a||Ce?"true":"false",...n.convertToStringAttributes(k),ref:w,children:[y?u.jsx(n.TextLink,{text:y,title:y,"aria-label":y,routeName:pe,role:i,params:ne(),onClick:$e,children:u.jsx(n.SymbolBadge,{size:s,symbol:{type:"Svg",content:`caret-${r}`}})}):null,p,!k["data-loading"]&&m.length===0&&u.jsx("p",{children:G})]})});const _e=n.newStyled(n.ItemList)`
257
- ${n.itemList}
258
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
259
- overflow: auto;
260
- justify-content: flex-start;
261
- white-space: nowrap;
262
- font-weight: 300;
263
- text-decoration: none;
264
-
265
- > div {
266
- ${t=>n.headingElement(t)("> h1",n.css`
267
- white-space: pre-wrap;
268
- `)}
269
- }
270
-
271
- > ul > li {
272
- ${t=>{var e,o;return t["grid-items"]==="true"&&n.css`
273
- display: grid;
274
- grid-template-columns: auto 1fr 1fr;
275
- gap: 0px 0px;
276
- grid-template-areas: '. favorite tags';
277
- align-items: center;
278
-
279
- > button {
280
- margin: 0 0 0 ${(e=t.theme.sizes)==null?void 0:e.small};
281
-
282
- &[data-favorite='false'] {
283
- ${t.isTabbing?"opacity: 0;":"display: none;"};
284
- &:focus {
285
- opacity: 1;
286
- }
287
- }
288
- }
289
-
290
- > span {
291
- font-size: ${(o=t.theme.fonts)==null?void 0:o.small};
292
- }
293
-
294
- &:hover {
295
- button[data-favorite='false'] {
296
- display: flex;
297
- justify-self: flex-start;
298
- }
299
- }
300
-
301
- &[has-metadata='true'] {
302
- grid-template-rows: 1fr 1fr;
303
- grid-template-areas:
304
- '. favorite tags'
305
- 'metadata metadata metadata';
306
- }
307
- `}}
308
- > a {
309
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
310
- overflow: hidden;
311
- text-overflow: ellipsis;
312
- max-width: 100%;
313
- display: inline-block;
314
-
315
- svg {
316
- margin: 0 calc(${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}}*2) 0 0;
317
- line {
318
- stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
319
- }
320
- }
321
-
322
- ${t=>{var e;return t.expandable==="true"&&n.css`
323
- display: flex;
324
- flex-direction: row-reverse;
325
- justify-content: flex-end;
326
- align-items: center;
327
-
328
- span {
329
- overflow: hidden;
330
- text-overflow: ellipsis;
331
- }
332
-
333
- svg {
334
- margin: 0 0 0 ${(e=t.theme.sizes)==null?void 0:e.small};
335
- }
336
- `}}
337
-
338
- &:focus-visible {
339
- ${n.borderTabStyle}
340
- text-decoration: underline;
341
- }
342
-
343
- @media (hover: hover) {
344
- &:hover {
345
- text-decoration: underline;
346
- }
347
- }
348
- }
349
- }
350
-
351
- > a {
352
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
353
- margin: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} 0 0;
354
- align-self: flex-start;
355
- align-items: center;
356
- display: flex;
357
-
358
- span {
359
- text-decoration: underline;
360
- }
361
-
362
- svg {
363
- margin: 0 calc(${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}}*2) 0 0;
364
- line {
365
- stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
366
- }
367
- }
368
-
369
- &:focus-visible {
370
- ${n.borderTabStyle}
371
- text-decoration: underline;
372
- }
373
- }
374
- `,Qe=n.newStyled(n.List)`
375
- ${n.list}
376
- display: flex;
377
- margin: 0 0 0 auto;
378
- grid-area: tags;
379
-
380
- li,
381
- li:last-child {
382
- margin: 0 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
383
- display: flex;
384
- align-items: center;
385
- justify-content: space-between;
386
- }
387
- `,Ve=n.newStyled(n.SymbolBadge)`
388
- display: block;
389
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
390
- ${t=>{if(t.symbol.type==="Uri")return`
391
- width: ${t.size}px;
392
- height: ${t.size}px;
393
- `;if(t.symbol.type==="FontAwesome")return`
394
- font-size: ${t.size}px;
395
- `}}
396
- `,We=n.newStyled(Ye)`
397
- grid-area: metadata;
398
- text-overflow: ellipsis;
399
- overflow: hidden;
400
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
401
- ${t=>{var e;return typeof t.indent=="number"&&`text-indent: calc(${(e=t.theme.sizes)==null?void 0:e.small} * 2 + ${t.indent}px);`}}
402
- `,Ze=n.keyframes`
403
- 100% {
404
- transform: rotate(360deg);
405
- }
406
- `,Je=n.keyframes`
407
- 0% {
408
- stroke-dasharray: 1, 200;
409
- stroke-dashoffset: 0;
410
- }
411
- 50% {
412
- stroke-dasharray: 89, 200;
413
- stroke-dashoffset: -35px;
414
- }
415
- 100% {
416
- stroke-dasharray: 89, 200;
417
- stroke-dashoffset: -124px;
418
- }
419
- `;n.newStyled.svg`
420
- animation: ${Ze} 2s linear infinite;
421
- height: 100%;
422
- transform-origin: center center;
423
- width: 100%;
424
- position: absolute;
425
- top: 0;
426
- bottom: 0;
427
- left: 0;
428
- right: 0;
429
- margin: auto;
430
- transition: 200ms ease-out opacity;
431
- `;n.newStyled.div`
432
- position: absolute;
433
- top: 0;
434
- bottom: 0;
435
- left: 0;
436
- right: 0;
437
- height: 100%;
438
- width: 100%;
439
- pointer-events: ${t=>t["data-loading"]?"all":"none"};
440
- display: flex;
441
- flex-direction: column;
442
- justify-content: center;
443
- transition: 200ms ease-out opacity;
444
- box-sizing: border-box;
445
- overflow: hidden;
446
-
447
- .humany-spinner-svg {
448
- opacity: ${t=>t["data-loading"]?"1":"0"};
449
- }
450
- `;n.newStyled.div`
451
- position: relative;
452
- margin: 0 auto;
453
- width: 100px;
454
- &:before {
455
- content: '';
456
- display: block;
457
- padding-top: 100%;
458
- }
459
- `;n.newStyled.circle`
460
- stroke-dasharray: 1, 200;
461
- stroke-dashoffset: 0;
462
- animation: ${Je} 1.5s ease-in-out infinite;
463
- stroke-linecap: round;
464
- stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
465
- stroke-width: 2px;
466
- `;n.newStyled(n.Button)`
467
- display: flex;
468
- justify-content: space-between;
469
- align-items: center;
470
- width: 100%;
471
- text-align: left;
472
- svg,
473
- i {
474
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
475
- }
476
- span {
477
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.text}};
478
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.normal}};
479
- overflow: hidden;
480
- text-overflow: ellipsis;
481
- flex: 1;
482
- white-space: nowrap;
483
- }
484
- &:focus-visible {
485
- ${n.borderTabStyle}
486
- span {
487
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
488
- text-decoration: underline;
489
- }
490
- }
491
- `;n.newStyled(n.ItemList)`
492
- ${qe}
493
- ${n.itemList}
494
- overflow: hidden;
495
- justify-content: flex-start;
496
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.large}};
497
- ${t=>!t["data-show-header"]&&n.css`
498
- > div {
499
- ${n.headingElement(t)("h1",n.css`
500
- display: none;
501
- `)}
502
- }
503
- `}
504
-
505
- @media (hover: hover) {
506
- button:hover {
507
- text-decoration: underline;
508
- }
509
- }
510
- `;n.newStyled(n.Paragraph)`
511
- ${n.genericHtml}
512
- font-weight: 300;
513
-
514
- p {
515
- white-space: normal;
516
- }
517
- `;n.newStyled.li`
518
- .humany-paragraph {
519
- display: none;
520
- &:not(:only-child) {
521
- ${t=>{var e,o,s;return((e=t.theme.sizes)==null?void 0:e.cardinal)&&((o=t.theme.sizes)==null?void 0:o.normal)&&n.css`
522
- margin: ${(s=t.theme.sizes)==null?void 0:s.normal} 0;
523
- `}}
524
- }
525
- }
526
-
527
- ${t=>t["data-expanded"]&&n.css`
528
- .humany-paragraph {
529
- display: block;
530
- }
531
- `}
532
-
533
- > span {
534
- display: block;
535
- font-weight: 300;
536
- color: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.accent}};
537
- }
538
- `;n.newStyled(n.SymbolBadge)`
539
- margin: 0 0 0 ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.small}};
540
- line {
541
- stroke: ${t=>{var e;return(e=t.theme.colors)==null?void 0:e.primary}};
542
- }
543
- `;n.newStyled(he)`
544
- font-size: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.small}};
545
- font-weight: 300;
546
- `;n.newStyled(n.Paragraph)`
547
- ${t=>{var e;return n.headingElement(t)("h1",n.css`
548
- font-weight: normal;
549
- font-size: ${(e=t.theme.fonts)==null?void 0:e.medium};
550
- `)}}
551
- `;const Xe=n.newStyled(n.Html)`
552
- ${n.genericHtml}
553
- font-weight: 300;
554
- line-height: 1.5em;
555
- button:focus-visible {
556
- ${n.borderTabStyle};
557
- }
558
-
559
- a:focus-visible {
560
- ${n.linkTabStyle};
561
- }
562
- `,et=t=>{const e=Me(t.clientName),{params:{contactCategory:o,guideCategory:s,phrase:i}}=ie();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?u.jsx(it,{title:`client-name: ${t.clientName}, id: ${t.id}`,className:"humany-non-resolved-contact-method",children:u.jsx(n.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const r=(c={})=>{const a={...t,...c},{id:l,title:d,clientName:g,symbol:f,inline:y,onClick:v=()=>{},description:p,htmlParseInstruction:m,className:h,disabled:x,guideId:R,dispatch:N=()=>{},expanded:I}=a,L=y?{onKeyDown:C=>{C.key&&C.key==="Enter"&&(v(C,a),C.defaultPrevented||!I&&N("expand",l))},onClick:C=>{v(C,a),C.defaultPrevented||!I&&N("expand",l)}}:{onClick:C=>v(C,a),routeName:"contact-method",params:D({contactCategory:o,guideId:R,guideCategory:s,phrase:i,contactMethod:l,uriName:ee(d)})};return u.jsxs(ot,{title:d,"aria-label":d,className:h,disabled:x,description:p,"data-client-name":g,...c,...L,children:[f&&u.jsx(n.SymbolBadge,{symbol:f}),p?u.jsxs("div",{className:"humany-contact-link-rich-content",children:[u.jsx(me,{children:d}),u.jsx(Xe,{html:p,htmlParseInstruction:m})]}):u.jsx(me,{children:d})]})};return t.expanded?u.jsx(b.Suspense,{fallback:null,children:u.jsx(e,{...t,renderDefault:r})}):r()},tt=t=>{var e,o,s,i,r,c,a,l;return n.css`
563
- display: flex;
564
- padding: ${(e=t.theme.sizes)==null?void 0:e.large};
565
- ${t.description?"":"align-items: center;"}
566
- text-decoration: none;
567
- span {
568
- display: inline-block;
569
- color: ${(o=t.theme.colors)==null?void 0:o.text};
570
- }
571
- i {
572
- font-size: ${(s=t.theme.fonts)==null?void 0:s.large};
573
- margin: 0 ${(i=t.theme.sizes)==null?void 0:i.large} 0 0;
574
- min-height: ${(r=t.theme.fonts)==null?void 0:r.large};
575
- min-width: ${(c=t.theme.fonts)==null?void 0:c.large};
576
- line-height: ${(a=t.theme.fonts)==null?void 0:a.large};
577
- display: inline-block;
578
- vertical-align: bottom;
579
- color: ${(l=t.theme.colors)==null?void 0:l.text};
580
- }
581
- `},me=n.newStyled(n.StyledText)`
582
- line-height: ${t=>{var e;return(e=t.theme.fonts)==null?void 0:e.large}};
583
- `,ot=n.newStyled(n.Link)`
584
- ${t=>tt(t)}
585
-
586
- &:focus-visible {
587
- ${n.borderTabStyle};
588
- }
589
- `,it=n.newStyled.div`
590
- text-align: center;
591
- display: block;
592
- ${t=>{var e,o;return typeof((e=t.theme.colors)==null?void 0:e.warning)<"u"&&`color: ${(o=t.theme.colors)==null?void 0:o.warning};`}}
593
- `,nt=t=>{var e,o,s;return n.css`
594
- ${n.itemList(t)}
595
-
596
- > div {
597
- padding: ${(e=t.theme.sizes)==null?void 0:e.large};
598
-
599
- ${n.headingElement(t)("h1",n.css`
600
- margin: 0;
601
- `)}
602
- }
603
-
604
- > ul {
605
- &:not(:first-child) {
606
- border-top: ${t.theme.border};
607
- }
608
-
609
- > li {
610
- margin: 0;
611
- white-space: normal;
612
-
613
- > a {
614
- overflow: hidden;
615
- }
616
-
617
- &:first-child > a {
618
- border-radius: ${`${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
619
- }
620
-
621
- &:last-child:not(:first-child) > a {
622
- border-radius: ${`0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
623
- }
624
-
625
- &:not(:last-child) {
626
- border-bottom: ${t.theme.border};
627
- }
628
-
629
- > div {
630
- padding: ${(o=t.theme.sizes)==null?void 0:o.large};
631
- }
632
- }
633
- }
634
-
635
- @media (hover: hover) {
636
- a:hover {
637
- background-color: ${(s=t.theme.colors)==null?void 0:s.accent};
638
- }
639
- }
640
- `};n.newStyled(n.ItemList)`
641
- ${t=>nt(t)}
642
- `;const st=({contactMethodId:t,guideId:e,groupId:o,className:s})=>{var f,y,v;const[i,r]=b.useState(),c=n.useContainer(),a=Te(),l=b.useRef(!0),d=ze();b.useEffect(()=>{console.log("### ",c),console.log("### ",c.get("$widget"))},[c,i,r,d]);const g=b.useCallback(async p=>{const h=await(await P.getInstance(c)).fetch(ge.ContactMethod,{contactMethodId:p,guideId:e},{noCache:!0}),x=n.updateForm(h,{submit:"Submit",errors:{},meta:{groupId:o}});if(h.body=x,h.body.guideId=e,!l.current)return null;r(h)},[l]);return b.useEffect(()=>(g(t),()=>{l.current=!1}),[t,g]),i?u.jsx(rt,{...i,body:{...i.body,form:i.body.form?{...i.body.form,data:(f=i.body.form)==null?void 0:f.data,layout:{...i.body.form.layout},meta:(y=i.body.form)==null?void 0:y.meta,schema:(v=i.body.form)==null?void 0:v.schema}:void 0,guideId:i.body.guideId},inline:!0,expanded:!0,dispatch:a,className:n.appendClassNames("humany-bot-contact-method",s)}):null},rt=n.newStyled(et)`
643
- padding: ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.normal}} ${t=>{var e;return(e=t.theme.sizes)==null?void 0:e.medium}};
644
- `;exports.default=st;