@telia-ace/knowledge-widget-bot-provider 0.0.24 → 1.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contact-method-a18f6436.mjs +896 -0
- package/contact-method-a9506b8c.js +99 -0
- package/contact-method-list-814eb03f.mjs +97 -0
- package/contact-method-list-b5815c14.js +28 -0
- package/feedback-list-04b512a4.mjs +80 -0
- package/feedback-list-e7973adc.js +25 -0
- package/index-07363705.js +1214 -0
- package/index-373df3a5.js +6 -0
- package/index-5c9c2abf.mjs +883 -0
- package/index-cc31f772.mjs +10810 -0
- package/index.js +1 -0
- package/index.mjs +7 -0
- package/no-good-alternative-2d562ff9.mjs +53 -0
- package/no-good-alternative-d31e7d52.js +15 -0
- package/notification-list-291a2001.mjs +1449 -0
- package/notification-list-876b3f3d.js +546 -0
- package/notification-list-9fca63ae.mjs +53 -0
- package/notification-list-f9c4cafe.js +8 -0
- package/package.json +20 -42
- package/styles-15c941d4.js +4 -0
- package/{dist/styles.a00306c5.js → styles-ad5c7069.mjs} +3 -4
- package/use-dispatch-951d7a5c.js +1 -0
- package/use-dispatch-97d3af39.mjs +24 -0
- package/{dist/utils.d.ts → utils.d.ts} +1 -1
- package/LICENSE.txt +0 -6
- package/README.md +0 -12
- package/dist/contact-method-list.4fcc98f1.js +0 -128
- package/dist/contact-method-list.4fcc98f1.js.map +0 -1
- package/dist/contact-method.4e96a7d4.js +0 -136
- package/dist/contact-method.4e96a7d4.js.map +0 -1
- package/dist/feedback-list.ff7e22da.js +0 -77
- package/dist/feedback-list.ff7e22da.js.map +0 -1
- package/dist/index.483ca2e8.js +0 -795
- package/dist/index.483ca2e8.js.map +0 -1
- package/dist/index.js +0 -9
- package/dist/index.js.map +0 -1
- package/dist/no-good-alternative.e9155cb9.js +0 -50
- package/dist/no-good-alternative.e9155cb9.js.map +0 -1
- package/dist/notification-list.7fd5ba2b.js +0 -67
- package/dist/notification-list.7fd5ba2b.js.map +0 -1
- package/dist/styles.a00306c5.js.map +0 -1
- /package/{dist/entry-handler.d.ts → entry-handler.d.ts} +0 -0
- /package/{dist/http-client.d.ts → http-client.d.ts} +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/plugin.d.ts → plugin.d.ts} +0 -0
- /package/{dist/provider.d.ts → provider.d.ts} +0 -0
- /package/{dist/store.d.ts → store.d.ts} +0 -0
- /package/{dist/types.d.ts → types.d.ts} +0 -0
- /package/{dist/ui → ui}/contact-method-list.d.ts +0 -0
- /package/{dist/ui → ui}/contact-method.d.ts +0 -0
- /package/{dist/ui → ui}/feedback-list.d.ts +0 -0
- /package/{dist/ui → ui}/no-good-alternative.d.ts +0 -0
- /package/{dist/ui → ui}/notification-list.d.ts +0 -0
- /package/{dist/ui → ui}/styles.d.ts +0 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";var Y=Object.defineProperty;var Z=(n,e,t)=>e in n?Y(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var I=(n,e,t)=>(Z(n,typeof e!="symbol"?e+"":e,t),t);const v=require("react/jsx-runtime"),l=require("./index-07363705.js"),B=require("./notification-list-876b3f3d.js"),q=require("react");require("react-dom");const D=require("./use-dispatch-951d7a5c.js"),G=(n,e)=>{let t=!0;return Object.keys(n).length!==Object.keys(e).length||Object.keys(n).some(i=>!Object.keys(e).some(c=>i===c))?!1:(Object.keys(n).forEach(i=>{if(t){const o=typeof n[i]>"u"?"":n[i],c=typeof e[i]>"u"?"":e[i];t=o.toString()===c.toString()}}),t)},ee=(n,e)=>{const t=D.useComponentDescriptor(),s=l.useContainer(),[i,o]=q.useState(void 0),c=l.useIsMounted(),r=n||t.type||"";return q.useEffect(()=>{if(r){let a;return(e||s).getAsync("componentResolver").then(u=>{if(c.current){const g=u.getComponent(r);o(g)}a=u.registerResolver(r,g=>{c.current&&o(g)})}),()=>{a&&a()}}},[c,r,e,s]),i},te=()=>q.useContext(l.ConversationContext);var U=(n=>(n.guide="guide",n.link="link",n.default="default",n))(U||{});l.newStyled(l.Paragraph)`
|
|
2
|
+
${n=>{var e;return l.headingElement(n)("h1",l.css`
|
|
3
|
+
font-weight: normal;
|
|
4
|
+
font-size: ${(e=n.theme.fonts)==null?void 0:e.medium};
|
|
5
|
+
`)}}
|
|
6
|
+
`;const ne=l.newStyled(l.Html)`
|
|
7
|
+
${l.genericHtml}
|
|
8
|
+
font-weight: 300;
|
|
9
|
+
line-height: 1.5em;
|
|
10
|
+
button:focus-visible {
|
|
11
|
+
${l.borderTabStyle};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
a:focus-visible {
|
|
15
|
+
${l.linkTabStyle};
|
|
16
|
+
}
|
|
17
|
+
`,Q=n=>{const e=ee(n.clientName),{params:{contactCategory:t,guideCategory:s,phrase:i}}=B.useRouteData();if(typeof e>"u")return null;if(e===null)return process.env.NODE_ENV!=="production"?v.jsx(oe,{title:`client-name: ${n.clientName}, id: ${n.id}`,className:"humany-non-resolved-contact-method",children:v.jsx(l.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const o=(c={})=>{const r={...n,...c},{id:a,title:u,clientName:g,symbol:f,inline:y,onClick:x=()=>{},description:h,htmlParseInstruction:b,className:d,disabled:m,guideId:w,dispatch:M=()=>{},expanded:p}=r,S=y?{onKeyDown:C=>{C.key&&C.key==="Enter"&&(x(C,r),C.defaultPrevented||!p&&M("expand",a))},onClick:C=>{x(C,r),C.defaultPrevented||!p&&M("expand",a)}}:{onClick:C=>x(C,r),routeName:"contact-method",params:B.createParams({contactCategory:t,guideId:w,guideCategory:s,phrase:i,contactMethod:a,uriName:B.formatUrl(u)})};return v.jsxs(se,{title:u,"aria-label":u,className:d,disabled:m,description:h,"data-client-name":g,...c,...S,children:[f&&v.jsx(l.SymbolBadge,{symbol:f}),h?v.jsxs("div",{className:"humany-contact-link-rich-content",children:[v.jsx(_,{children:u}),v.jsx(ne,{html:h,htmlParseInstruction:b})]}):v.jsx(_,{children:u})]})};return n.expanded?v.jsx(q.Suspense,{fallback:null,children:v.jsx(e,{...n,renderDefault:o})}):o()},ie=n=>{var e,t,s,i,o,c,r,a;return l.css`
|
|
18
|
+
display: flex;
|
|
19
|
+
padding: ${(e=n.theme.sizes)==null?void 0:e.large};
|
|
20
|
+
${n.description?"":"align-items: center;"}
|
|
21
|
+
text-decoration: none;
|
|
22
|
+
span {
|
|
23
|
+
display: inline-block;
|
|
24
|
+
color: ${(t=n.theme.colors)==null?void 0:t.text};
|
|
25
|
+
}
|
|
26
|
+
i {
|
|
27
|
+
font-size: ${(s=n.theme.fonts)==null?void 0:s.large};
|
|
28
|
+
margin: 0 ${(i=n.theme.sizes)==null?void 0:i.large} 0 0;
|
|
29
|
+
min-height: ${(o=n.theme.fonts)==null?void 0:o.large};
|
|
30
|
+
min-width: ${(c=n.theme.fonts)==null?void 0:c.large};
|
|
31
|
+
line-height: ${(r=n.theme.fonts)==null?void 0:r.large};
|
|
32
|
+
display: inline-block;
|
|
33
|
+
vertical-align: bottom;
|
|
34
|
+
color: ${(a=n.theme.colors)==null?void 0:a.text};
|
|
35
|
+
}
|
|
36
|
+
`},_=l.newStyled(l.StyledText)`
|
|
37
|
+
line-height: ${n=>{var e;return(e=n.theme.fonts)==null?void 0:e.large}};
|
|
38
|
+
`,se=l.newStyled(l.Link)`
|
|
39
|
+
${n=>ie(n)}
|
|
40
|
+
|
|
41
|
+
&:focus-visible {
|
|
42
|
+
${l.borderTabStyle};
|
|
43
|
+
}
|
|
44
|
+
`,oe=l.newStyled.div`
|
|
45
|
+
text-align: center;
|
|
46
|
+
display: block;
|
|
47
|
+
${n=>{var e,t;return typeof((e=n.theme.colors)==null?void 0:e.warning)<"u"&&`color: ${(t=n.theme.colors)==null?void 0:t.warning};`}}
|
|
48
|
+
`,re=n=>{var e,t,s;return l.css`
|
|
49
|
+
${l.itemList(n)}
|
|
50
|
+
|
|
51
|
+
> div {
|
|
52
|
+
padding: ${(e=n.theme.sizes)==null?void 0:e.large};
|
|
53
|
+
|
|
54
|
+
${l.headingElement(n)("h1",l.css`
|
|
55
|
+
margin: 0;
|
|
56
|
+
`)}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
> ul {
|
|
60
|
+
&:not(:first-child) {
|
|
61
|
+
border-top: ${n.theme.border};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
> li {
|
|
65
|
+
margin: 0;
|
|
66
|
+
white-space: normal;
|
|
67
|
+
|
|
68
|
+
> a {
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&:first-child > a {
|
|
73
|
+
border-radius: ${`${n.theme.borderRadius} ${n.theme.borderRadius} 0 0`};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:last-child:not(:first-child) > a {
|
|
77
|
+
border-radius: ${`0 0 ${n.theme.borderRadius} ${n.theme.borderRadius}`};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
&:not(:last-child) {
|
|
81
|
+
border-bottom: ${n.theme.border};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
> div {
|
|
85
|
+
padding: ${(t=n.theme.sizes)==null?void 0:t.large};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (hover: hover) {
|
|
91
|
+
a:hover {
|
|
92
|
+
background-color: ${(s=n.theme.colors)==null?void 0:s.accent};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
`},ae=l.newStyled(l.ItemList)`
|
|
96
|
+
${n=>re(n)}
|
|
97
|
+
`,ce=({contactMethods:n,children:e,guideId:t,dispatch:s,className:i="",itemRenderer:o,action:c=()=>{},header:r=""})=>n.length?v.jsx(ae,{header:r,className:l.appendClassNames(i,"humany-contact-list"),items:n,renderItem:o?a=>v.jsx("li",{"data-contact-method":a.id,children:o(a,{action:c,dispatch:s,guideId:t})},a.id):a=>v.jsx("li",{"data-contact-method":a.id,children:v.jsx(Q,{...a,action:c,dispatch:s,guideId:t})},a.id),children:e}):null,V=n=>Promise.resolve().then(()=>require("./index-373df3a5.js")).then(({ServiceClient:e,ServiceProxy:t})=>n.get("settings").then(s=>{const{name:i,events:o}=n.get("$widget"),{data:{projection:c="",site:r="current",forceHttps:a=!1}}=s,u=new t(c,{credentials:"same-origin"}),g=new e(u,{funnel:i.replace("_contact-method","").replace("_contact",""),site:de(r,a)},null,n);return o.subscribe("widget:settings-updated",(f,{data:y})=>{y&&y.projection!==c&&g.proxy.setBaseUrl(y.projection)}),g})),de=(n,e)=>()=>{const t=i=>{const o=document.createElement("a");return o.href=i,o};let s=window.location;return n==="referrer"&&document.referrer&&(s=t(document.referrer)),[e?"https:":"","//",s.host,s.pathname].join("")},L=n=>{if(n){const{Type:e,Content:t}=n;if(e&&t)return{type:e,content:t}}},K=n=>n.map(e=>{const t={id:e.Id.toString(),title:e.Name,symbol:L(e.DefaultIcon),activeSymbol:e.ActiveIcon&&L(e.ActiveIcon),description:e.Description||e.Attributes&&e.Attributes.description||"",matches:e.GuidesCount};return e.Children&&e.Children.length&&(t.items=K(e.Children)),t}),R=(n,e)=>n.filter(({Type:t})=>t===e).map(({Id:t,Title:s,Body:i})=>({id:t.toString(),title:s,body:i})),P=n=>n.map(({Id:e,Title:t,DefaultIcon:s,ListNotices:i,Notices:o})=>({id:e.toString(),title:t,symbol:L(s),defaultHeaderOptions:{visible:!!i.length},notifications:(i||[]).concat(o||[]).map(({Id:c,Title:r,Body:a,Type:u,Modified:g})=>({id:c.toString(),title:r,body:a,modified:g,expandable:u==="listNotice"}))})),z=({Id:n,Title:e,DefaultIcon:t,Exits:[s],ExitType:i,ConfirmationText:o,ExpandFormAutomatically:c,Form:r,Description:a},u)=>{const{Adapter:g}=s||{Adapter:{}},{ClientName:f="",Settings:y={},CustomClientName:x=""}=g,h={id:n.toString(),title:e,description:a,symbol:L(t),clientName:f==="custom.adapter"?x:f,expanded:!0,inline:!0,body:{}};if(f.indexOf("phone")>-1||f.indexOf("freetext")>-1){const{displayTextBeforeClick:b,textBeforeClick:d}=y;b==="true"&&(h.expanded=!1,h.title=d),f.indexOf("phone.text")>-1?h.body.phoneNumber=y.phoneNumber:h.body.freetext=y.freetext}return(f.indexOf("chat.popup")>-1||f.indexOf("link")>-1||f==="custom.adapter"&&i==="custom")&&(h.body=y,h.body.confirmationFallback=o),f.indexOf("ace")>-1&&(h.body=y),r&&r.HasValueComponents&&(u?h.body.form=l.FormBuilder.fromLegacyForm(n.toString(),r,u).get():h.body.form=l.FormBuilder.fromLegacyForm(n.toString(),r).get(),c||(h.expanded=h.inline=!1)),h},O=(n=[])=>n.map(({Id:e,Title:t,TotalMatches:s,Symbol:i,DefaultIcon:o,ActiveIcon:c})=>({id:e.toString(),title:t,matches:s,symbol:L(o||i),defaultIcon:L(o),activeIcon:L(c)})),H=n=>n.map(({Id:e,Title:t,Tags:s,FirstPublishedDate:i,Modified:o})=>({id:e.toString(),title:t,tags:O(s),published:i,modified:o})),le=(n,e)=>{switch(n){case $.MatchByCategory:case $.Match:{const t={guides:[],matches:0,topNotifications:[],middleNotifications:[],bottomNotifications:[],notificationLists:[],tags:[],byCategory:[]},{Matches:s,TotalMatches:i,Notices:o,NoticeLists:c,Tags:r,ByCategory:a}=e;return t.guides=H(s),t.matches=i,t.byCategory=(a||[]).map(({Id:u,Matches:g,TotalMatches:f})=>({id:u,guides:H(g),matches:f})),t.tags=O(r),t.notificationLists=P(c||[]),t.topNotifications=R(o||[],"noticeRowTop"),t.middleNotifications=R(o||[],"noticeRowMiddle"),t.bottomNotifications=R(o||[],"footerNotice"),t}case $.Categories:{const{Children:t,GuidesCountTotal:s}=e;return{categories:K(t||[]),matches:s}}case $.Guide:{const{Id:t,Title:s,Body:i,Related:o,Options:c,ConnectionId:r,ContactMethods:a,EnableFeedback:u,HandoverExists:g,FirstPublishedDate:f,Modified:y,ModifiedByDisplayName:x,FirstPublishedByDisplayName:h,Categories:b,Tags:d,SeoMetaDescription:m,SeoAllowIndex:w,Perspectives:M,PerspectiveKey:p,Translations:S}=e,C=p||Object.values(M).find(k=>k===r)||M.Default||null,F={guide:{id:t.toString(),title:s,body:i,modified:y,published:f,modifiedBy:x,publishedBy:h,connection:r,categories:b,hasHandover:g,allowFeedback:u,seoMetaDescription:m,seoAllowIndex:w,perspectives:M,perspective:C,translations:Object.keys(S||{}).reduce((k,A)=>(k[A]=S[A].toString(),k),{})},related:H(o||[]),dialog:[],contactMethods:(a||[]).map(k=>z(k)),tags:O(d)};return(c||[]).forEach(({CanAccess:k,Description:A,ConnectionId:E,Properties:N})=>{if(!k)return;const j={id:t.toString(),title:A,connection:E,connectionKey:N.ConnectionKey,type:U.default,parent:{id:t.toString(),title:s,tags:O(d)}};if(N.Type==="Guide"||N.Type==="Link")switch(N.Id&&(j.id=N.Id.toString()),N.Uri&&(j.href=N.Uri),N.Target&&(j.target=N.Target),N.Type){case"Guide":j.type=U.guide;break;case"Link":j.type=U.link;break}F.dialog.push(j)}),F}case $.Contacts:{const{Children:t,Matches:s,Notices:i,NoticeLists:o}=e;return{contactMethods:(s||[]).map(r=>z(r)),categories:K(t||[]),topNotifications:R(i||[],"noticeRowTop"),middleNotifications:R(i||[],"noticeRowMiddle"),bottomNotifications:R(i||[],"footerNotice"),notificationLists:P(o||[])}}case $.ContactMethod:{const{ContactMethod:t}=e;return z(t||{})}case $.Tags:case $.TagsOnGuides:return O(e||[]);case $.Notifications:{const{Notices:t,NoticeLists:s}=e;return{topNotifications:R(t||[],"noticeRowTop"),middleNotifications:R(t||[],"noticeRowMiddle"),bottomNotifications:R(t||[],"footerNotice"),notificationLists:P(s||[])}}default:return{}}};var J=(n=>(n.Guide="guide",n.Guides="guides",n.GuidesByCategory="guides-by-category",n.RowNotifications="row-notices",n.NotificationLists="notification-lists",n.GuideCategories="guide-categories",n.ContactMethodCategories="contact-method-categories",n.ContactMethod="contact-method",n.ContactMethods="contact-methods",n.Tags="tags",n.TagsOnGuides="tagsonguides",n))(J||{}),$=(n=>(n.Match="match",n.Categories="categories",n.Guide="guide",n.Contacts="contacts",n.ContactMethod="contact-method",n.MatchByCategory="match-by-category",n.Tags="tags",n.TagsOnGuides="tagsonguides",n.Notifications="notifications",n))($||{});const W=n=>{switch(n){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"}},ue=async n=>{const{invoke:e}=n.get("$widget");return await e("renderState")===l.WidgetRenderState.hidden};class T{constructor(e,t){I(this,"queries",new Map);I(this,"lastTake",0);I(this,"events");I(this,"getUnresolvedQueries",()=>{let e=0;return this.queries.forEach((t,s)=>{t.some(o=>!o.resolved)&&(e=1)}),e});this.container=e,this.matchingClient=t,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:o})=>{o===l.WidgetRenderState.hidden&&i===l.WidgetRenderState.open&&this.fetchAllUnresolvedQueries()})}static getInstance(e,t="dataClient"){return l.lock(this)(()=>e.getAsync(t).then(async s=>{let i=await e.getAsync("matchingClient");i||(i=await V(e),e.registerAsync("matchingClient",()=>i));let o=s;return o||(o=new T(e,i),e.registerAsync(t,()=>o)),o}))}fetch(e,t,s){return new Promise((i,o)=>{t.take&&(this.lastTake=+(t.take||0)),B.removeNullAndUndefinedValues(t);const c=W(e);let r=this.queries.get(c)||[],a=r.find(u=>G(u.params,t))||null;if(a&&(s!=null&&s.noCache)){const u=r.findIndex(g=>G(g.params,t));r=[...r.slice(0,u),...r.slice(u+1)],a=null}if(a){const u=r.indexOf(a);if(a.resolved?(this.events.dispatch("data-client:fetched",{params:t,type:c,response:a.data,unresolvedQueries:this.getUnresolvedQueries()}),this.track(a.data,c,a.error),a.data&&a.error?o({error:a.error}):i(a.data)):a.resolvers.push({resolve:i,reject:o}),r.splice(u,1),r.push(a),this.queries.set(c,r),!a.loading&&!a.resolved)return this.runQuery(c,t)}else return r.push({params:t,resolved:!1,loading:!0,data:{},resolvers:[{resolve:i,reject:o}]}),this.queries.set(c,r),this.runQuery(c,t)}).then(i=>l.deepClone(i))}read(e,t){const{select:s}=t,i=W(e);return(this.queries.get(i)||[]).reduce((r,a)=>{if(typeof s=="function"){const u=s(a.data);u&&r.push(u)}else r.push(a.data);return r},[])}feedback(e,t,s){return this.matchingClient.giveFeedback(e,t,s)}setLoadingStatus(e,t,s){const i=this.queries.get(e)||[],o=i.find(c=>G(c.params,t));o&&(o.loading=s),this.queries.set(e,i)}async runQuery(e,t){const{searchPhrase:s="",categories:i="0",contactMethodCategoryId:o="0",contactMethodId:c="0",tagId:r=void 0,take:a=5,connection:u="",guideId:g,expandCategories:f="descendants",currentCategory:y,sorting:x="popularity-descending",guideIds:h=[]}=t,b=s.toString().trim();if(await ue(this.container))return Promise.resolve();switch(e){case"match":{const d=m=>{const[w,M]=m.split("-");return{type:new Map([["popularity","popularity"],["alphabetic","title"],["modified","lastModified"],["published","firstPublished"]]).get(w),direction:M}};return h.length?this.matchingClient.customRequest("guides","POST",{configuration:{ids:h,take:+a}}).then(m=>m&&this.handleResponse(m,e,t)):this.matchingClient.match(b,{categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+a,tags:r,sorting:d(x),ids:h}).then(m=>m&&this.handleResponse(m,e,t))}case"match-by-category":return this.matchingClient.match(b,{groupByCategory:!0,categories:i==="0"?[]:Array.isArray(i)?i:[+i],take:+a,tags:r}).then(d=>d&&this.handleResponse(d,e,t));case"guide":return this.matchingClient.getGuide(g,{connectionId:u}).then(d=>{d&&this.handleResponse(d,e,t)}).catch(d=>{const m={message:"Something went wrong.",status:d.status||400};m.status===404&&(m.message="The guide could not be found."),this.handleResponse({},e,t,m)});case"categories":return this.matchingClient.getCategories({phrase:b,expand:f,tags:r}).then(d=>d&&this.handleResponse(d,e,t));case"contacts":return g?this.matchingClient.contactMethods(+g,{phrase:b}).then(d=>d&&this.handleResponse(d,e,t)):this.matchingClient.contacts(+o,{phrase:b}).then(d=>d&&this.handleResponse(d,e,t));case"contact-method":return this.matchingClient.getContactMethod(+c,{guideId:g,currentCategory:y}).then(d=>d&&this.handleResponse(d,e,t));case"tags":return this.matchingClient.customRequest("tags","GET",{configuration:{take:999999,phrase:b,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(d=>d&&this.handleResponse(d,e,t));case"tagsonguides":return this.matchingClient.customRequest("tagsonguides","GET",{configuration:{take:999999,phrase:b,categories:i==="0"?[]:Array.isArray(i)?i:[+i],tags:r}}).then(d=>d&&this.handleResponse(d,e,t));case"notifications":return this.matchingClient.customRequest("notices","GET",{configuration:{phrase:b,categories:i==="0"?[]:Array.isArray(i)?i:[+i]}}).then(d=>d&&this.handleResponse(d,e,t))}}handleResponse(e={},t,s,i){const o=this.queries.get(t)||[],c=o.find(r=>G(r.params,s));if(c){const r=i||le(t,e);this.track(r,t,i),c.resolvers.forEach(u=>{i?u.reject({error:r}):u.resolve(r)});const a=o.indexOf(c);a>-1&&o.splice(a,1),o.push({...c,error:i,resolvers:[],data:r,resolved:!0}),this.setLoadingStatus(t,s,!1),this.queries.set(t,o),i||this.events.dispatch("data-client:fetched",{type:t,params:s,response:r,unresolvedQueries:this.getUnresolvedQueries()})}}fetchAllUnresolvedQueries(){for(const[e,t]of this.queries)t.filter(s=>!s.resolved).forEach(s=>{this.runQuery(e,s.params)})}track(e={},t,s){const i=this.container.get("$widget");i&&!s?i.events.dispatch("tracking:service-client-response",{type:t,data:e}):i&&i.events.dispatch("tracking:service-client-error",{type:t,error:s})}static create(e){return e.getAsync("matchingClient").then(async t=>{if(t)return new T(e,t);const s=await V(e);return e.registerAsync("matchingClient",()=>s),new T(e,s)})}getClient(){return this.matchingClient}}const X=({contactMethodId:n,guideId:e,groupId:t,className:s})=>{var f,y,x;const[i,o]=q.useState(),c=l.useContainer(),r=D.useDispatch(),a=q.useRef(!0),u=te();q.useEffect(()=>{const{events:h}=c.get("$widget"),b=h.subscribe("bot-provider:form-submitted",async(m,w)=>{var A;if(((A=w.form.meta)==null?void 0:A.groupId)!==t||w.id!==i.id)return;u&&(w.form.meta||(w.form.meta={}),w.form.meta.conversation=u);const M=await c.getAsync("contactMethods"),p={...i,body:{...i.body,form:w.form}},{errors:S,valid:C,errorTypes:F}=await M.validate(p);if(!C){const E=new l.FormBuilder(i.body.form);o(void 0),E.setValidationErrors(S),p.body={...p.body,form:E.get()},o({...p});return}const k=await M.submit(p);p.confirmation=k,o(p)}),d=h.subscribe("bot-provider:evaluate",async(m,w)=>{if(w.id!==n)return;const p=await(await c.getAsync("contactMethods")).evaluate(i);let S={...i,body:{...i.body,form:p}};const C=l.updateForm(S,{submit:"Submit",errors:{},meta:{groupId:t}});S={...S,body:C},o(S)});return()=>{b(),d()}},[c,i,o,u]);const g=q.useCallback(async h=>{const d=await(await T.getInstance(c)).fetch(J.ContactMethod,{contactMethodId:h,guideId:e},{noCache:!0}),m=l.updateForm(d,{submit:"Submit",errors:{},meta:{groupId:t}});if(d.body=m,d.body.guideId=e,!a.current)return null;o(d)},[a]);return q.useEffect(()=>(g(n),()=>{a.current=!1}),[n,g]),i?v.jsx(he,{...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:(x=i.body.form)==null?void 0:x.schema}:void 0,guideId:i.body.guideId},inline:!0,expanded:!0,dispatch:r,className:l.appendClassNames("humany-bot-contact-method",s)}):null},he=l.newStyled(Q)`
|
|
98
|
+
padding: ${n=>{var e;return(e=n.theme.sizes)==null?void 0:e.normal}} ${n=>{var e;return(e=n.theme.sizes)==null?void 0:e.medium}};
|
|
99
|
+
`,ge=Object.freeze(Object.defineProperty({__proto__:null,default:X},Symbol.toStringTag,{value:"Module"}));exports.ContactList=ce;exports.ContactMethod=X;exports.ContactMethod$1=Q;exports.contactMethod=ge;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { u as M, n as l } from "./index-cc31f772.mjs";
|
|
3
|
+
import { useState as f, useEffect as b } from "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
import { u as $ } from "./use-dispatch-97d3af39.mjs";
|
|
6
|
+
import { C as S, a as E, b as j } from "./contact-method-a18f6436.mjs";
|
|
7
|
+
import "./notification-list-291a2001.mjs";
|
|
8
|
+
const D = ({ actions: t, entryId: e, groupId: h }) => {
|
|
9
|
+
const y = $(), d = M(), [m, g] = f([]), [r, x] = f([]);
|
|
10
|
+
return b(() => {
|
|
11
|
+
d.getAsync("contactMethods").then((n) => {
|
|
12
|
+
if (!n)
|
|
13
|
+
return;
|
|
14
|
+
const a = t.map(async (i) => {
|
|
15
|
+
var p;
|
|
16
|
+
if (!((p = i.data) != null && p.clientName))
|
|
17
|
+
return null;
|
|
18
|
+
const o = await n.handleAdapters(i.data);
|
|
19
|
+
return {
|
|
20
|
+
...o,
|
|
21
|
+
...i.data,
|
|
22
|
+
description: i.data.description ? i.data.description : o.description,
|
|
23
|
+
onClick: (u, s) => {
|
|
24
|
+
if (typeof o.onClick == "function" && o.onClick(u, s), !u.defaultPrevented)
|
|
25
|
+
if (s.inline && !s.expanded)
|
|
26
|
+
x([...r, s.id]);
|
|
27
|
+
else {
|
|
28
|
+
const { events: C } = d.get("$widget");
|
|
29
|
+
C.dispatch("provider:open-contact-method", {
|
|
30
|
+
entryId: e,
|
|
31
|
+
contactMethod: s,
|
|
32
|
+
actionKey: i.actionKey
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
Promise.all(a).then((i) => {
|
|
39
|
+
g(i.filter((o) => !!o));
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}, [t, d, e, r]), m.length ? /* @__PURE__ */ c(
|
|
43
|
+
k,
|
|
44
|
+
{
|
|
45
|
+
className: "humany-bot-contact-list",
|
|
46
|
+
contactMethods: m,
|
|
47
|
+
dispatch: y,
|
|
48
|
+
itemRenderer: (n, a) => (r.includes(n.id) || n.expanded) && n.inline ? /* @__PURE__ */ c(
|
|
49
|
+
w,
|
|
50
|
+
{
|
|
51
|
+
contactMethodId: n.id,
|
|
52
|
+
groupId: h,
|
|
53
|
+
guideId: n.body.guideId
|
|
54
|
+
}
|
|
55
|
+
) : /* @__PURE__ */ c(z, { ...n, ...a })
|
|
56
|
+
}
|
|
57
|
+
) : null;
|
|
58
|
+
}, k = l(S)`
|
|
59
|
+
> ul > li {
|
|
60
|
+
a {
|
|
61
|
+
display: flex;
|
|
62
|
+
align-items: center;
|
|
63
|
+
outline-offset: -2px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
&:not(:last-child) {
|
|
67
|
+
${(t) => t.theme.border && `border-bottom: ${t.theme.border};`}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`, w = l(E)`
|
|
71
|
+
i {
|
|
72
|
+
margin: 0 ${(t) => {
|
|
73
|
+
var e;
|
|
74
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
75
|
+
}} 0 0;
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
}
|
|
80
|
+
`, z = l(j)`
|
|
81
|
+
padding: ${(t) => {
|
|
82
|
+
var e;
|
|
83
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
84
|
+
}};
|
|
85
|
+
i {
|
|
86
|
+
margin: 0 ${(t) => {
|
|
87
|
+
var e;
|
|
88
|
+
return (e = t.theme.sizes) == null ? void 0 : e.medium;
|
|
89
|
+
}} 0 0;
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
align-items: center;
|
|
93
|
+
}
|
|
94
|
+
`;
|
|
95
|
+
export {
|
|
96
|
+
D as default
|
|
97
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),o=require("./index-07363705.js"),u=require("react");require("react-dom");const S=require("./use-dispatch-951d7a5c.js"),h=require("./contact-method-a9506b8c.js");require("./notification-list-876b3f3d.js");const b=({actions:e,entryId:t,groupId:y})=>{const x=S.useDispatch(),c=o.useContainer(),[m,g]=u.useState([]),[r,C]=u.useState([]);return u.useEffect(()=>{c.getAsync("contactMethods").then(n=>{if(!n)return;const a=e.map(async i=>{var p;if(!((p=i.data)!=null&&p.clientName))return null;const s=await n.handleAdapters(i.data);return{...s,...i.data,description:i.data.description?i.data.description:s.description,onClick:(f,d)=>{if(typeof s.onClick=="function"&&s.onClick(f,d),!f.defaultPrevented)if(d.inline&&!d.expanded)C([...r,d.id]);else{const{events:M}=c.get("$widget");M.dispatch("provider:open-contact-method",{entryId:t,contactMethod:d,actionKey:i.actionKey})}}}});Promise.all(a).then(i=>{g(i.filter(s=>!!s))})})},[e,c,t,r]),m.length?l.jsx(j,{className:"humany-bot-contact-list",contactMethods:m,dispatch:x,itemRenderer:(n,a)=>(r.includes(n.id)||n.expanded)&&n.inline?l.jsx(q,{contactMethodId:n.id,groupId:y,guideId:n.body.guideId}):l.jsx($,{...n,...a})}):null},j=o.newStyled(h.ContactList)`
|
|
2
|
+
> ul > li {
|
|
3
|
+
a {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
outline-offset: -2px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
&:not(:last-child) {
|
|
10
|
+
${e=>e.theme.border&&`border-bottom: ${e.theme.border};`}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`,q=o.newStyled(h.ContactMethod)`
|
|
14
|
+
i {
|
|
15
|
+
margin: 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}} 0 0;
|
|
16
|
+
display: flex;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
`,$=o.newStyled(h.ContactMethod$1)`
|
|
21
|
+
padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}};
|
|
22
|
+
i {
|
|
23
|
+
margin: 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.medium}} 0 0;
|
|
24
|
+
display: flex;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
align-items: center;
|
|
27
|
+
}
|
|
28
|
+
`;exports.default=b;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as a, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { m as i, n as s, o as n, p as l, B as m, q as c, r as d } from "./index-cc31f772.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import "react-dom";
|
|
5
|
+
import { u as p } from "./use-dispatch-97d3af39.mjs";
|
|
6
|
+
import "./notification-list-291a2001.mjs";
|
|
7
|
+
import { m as h } from "./styles-ad5c7069.mjs";
|
|
8
|
+
const w = ({ actions: e }) => {
|
|
9
|
+
const t = p();
|
|
10
|
+
return /* @__PURE__ */ a(
|
|
11
|
+
f,
|
|
12
|
+
{
|
|
13
|
+
className: "humany-bot-feedback-list",
|
|
14
|
+
items: e,
|
|
15
|
+
"data-direction": "vertical",
|
|
16
|
+
renderItem: (o) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ r(
|
|
17
|
+
u,
|
|
18
|
+
{
|
|
19
|
+
className: "humany-feedback-button",
|
|
20
|
+
disabled: !1,
|
|
21
|
+
"aria-pressed": !0,
|
|
22
|
+
"data-selected": !0,
|
|
23
|
+
onClick: () => {
|
|
24
|
+
t("action", o.actionKey);
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ a(i, { faIcon: o.actionKey === "yes" ? "smile-o" : "frown-o" }),
|
|
28
|
+
/* @__PURE__ */ a("span", { children: o.label })
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
) }, o.actionKey)
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}, f = s(n)`
|
|
35
|
+
${(e) => l(e)}
|
|
36
|
+
${h}
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: ${(e) => {
|
|
39
|
+
var t;
|
|
40
|
+
return (t = e.theme.sizes) == null ? void 0 : t.normal;
|
|
41
|
+
}};
|
|
42
|
+
flex-direction: ${(e) => e["data-direction"] === "horizontal" ? "row" : "column"};
|
|
43
|
+
> li {
|
|
44
|
+
flex: 1;
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
`, u = s(m)`
|
|
48
|
+
${c}
|
|
49
|
+
font-size: ${(e) => {
|
|
50
|
+
var t;
|
|
51
|
+
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
52
|
+
}};
|
|
53
|
+
border-color: ${(e) => {
|
|
54
|
+
var t;
|
|
55
|
+
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
56
|
+
}};
|
|
57
|
+
font-weight: 300;
|
|
58
|
+
display: block;
|
|
59
|
+
width: 100%;
|
|
60
|
+
|
|
61
|
+
${(e) => {
|
|
62
|
+
var t;
|
|
63
|
+
return d({
|
|
64
|
+
primaryColor: `${(t = e.theme.colors) == null ? void 0 : t.primary}`,
|
|
65
|
+
secondaryColor: "#FFFFFF",
|
|
66
|
+
theme: e.theme
|
|
67
|
+
});
|
|
68
|
+
}}
|
|
69
|
+
i {
|
|
70
|
+
margin: 0 ${(e) => {
|
|
71
|
+
var t;
|
|
72
|
+
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
73
|
+
}} 0 0;
|
|
74
|
+
}
|
|
75
|
+
span {
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
export {
|
|
79
|
+
w as default
|
|
80
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("./index-07363705.js");require("react");require("react-dom");const n=require("./use-dispatch-951d7a5c.js");require("./notification-list-876b3f3d.js");const i=require("./styles-15c941d4.js"),a=({actions:e})=>{const t=n.useDispatch();return r.jsx(l,{className:"humany-bot-feedback-list",items:e,"data-direction":"vertical",renderItem:o=>r.jsx("li",{children:r.jsxs(c,{className:"humany-feedback-button",disabled:!1,"aria-pressed":!0,"data-selected":!0,onClick:()=>{t("action",o.actionKey)},children:[r.jsx(s.Icon,{faIcon:o.actionKey==="yes"?"smile-o":"frown-o"}),r.jsx("span",{children:o.label})]})},o.actionKey)})},l=s.newStyled(s.List)`
|
|
2
|
+
${e=>s.list(e)}
|
|
3
|
+
${i.messageContentPadding}
|
|
4
|
+
display: flex;
|
|
5
|
+
gap: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
|
|
6
|
+
flex-direction: ${e=>e["data-direction"]==="horizontal"?"row":"column"};
|
|
7
|
+
> li {
|
|
8
|
+
flex: 1;
|
|
9
|
+
margin: 0;
|
|
10
|
+
}
|
|
11
|
+
`,c=s.newStyled(s.Button)`
|
|
12
|
+
${s.buttonCss}
|
|
13
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
14
|
+
border-color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
15
|
+
font-weight: 300;
|
|
16
|
+
display: block;
|
|
17
|
+
width: 100%;
|
|
18
|
+
|
|
19
|
+
${e=>{var t;return s.invertedHoverButton({primaryColor:`${(t=e.theme.colors)==null?void 0:t.primary}`,secondaryColor:"#FFFFFF",theme:e.theme})}}
|
|
20
|
+
i {
|
|
21
|
+
margin: 0 ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}} 0 0;
|
|
22
|
+
}
|
|
23
|
+
span {
|
|
24
|
+
}
|
|
25
|
+
`;exports.default=a;
|