@telia-ace/knowledge-widget-components-guide 1.1.2-rc.0 → 1.1.2-rc.2
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/{guide-e74afad8.js → guide-9d79906b.js} +98 -98
- package/{guide-38b65368.mjs → guide-bea67580.mjs} +161 -132
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +10 -10
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),E=require("@emotion/react"),r=require("@emotion/styled"),W=require("@telia-ace/knowledge-widget-adapters"),a=require("@telia-ace/knowledge-widget-ui"),V=require("@telia-ace/widget-types-grid"),D=require("@telia-ace/widget-utilities"),j=require("react"),$=require("@telia-ace/knowledge-widget-core"),Q=({className:e,defaultAnswerVersionLabel:t,guide:{perspective:n,perspectives:i},availablePerspectives:m=[]})=>{const{name:l,params:c}=a.useRouteData(),h=j.useMemo(()=>!i||!m.length?[]:m.filter(({name:d})=>!!i[d]).map(({name:d,title:g})=>({label:g,connection:i[d]})),[i,m]);return s.jsx(X,{className:D.appendClassNames(e,"humany-guide-answer-version-picker"),items:h,renderItem:d=>{const g=d.label==="Default"?t:d.label,y=n===d.connection,u=y&&(!c.connection||n===c.connection);return s.jsx("li",{"data-version":d.connection,children:s.jsx(Y,{as:u?"span":void 0,text:g,routeName:l,selected:y,"aria-label":g,title:g,params:{...c,connection:d.connection}},d.connection)},d.connection)}})},X=r(a.List)`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
list-style: none;
|
|
7
|
+
padding: 0;
|
|
8
|
+
margin: 0;
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
li:not(:last-child) {
|
|
11
|
+
margin: 0 calc(${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}} * 2) 0 0;
|
|
12
|
+
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
li > span {
|
|
15
|
+
cursor: default;
|
|
16
|
+
}
|
|
17
17
|
`,Y=r(a.TextLink)`
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
font-weight: 300;
|
|
19
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
20
|
+
text-decoration: none;
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
${e=>e.selected&&E.css`
|
|
23
|
+
font-weight: bold;
|
|
24
|
+
text-decoration: underline;
|
|
25
|
+
`}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
${a.paddedBorderTabStyle};
|
|
29
|
+
}
|
|
30
30
|
`,Z=r(W.ContactList)`
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
border-top: ${e=>e.theme.border};
|
|
32
|
+
${e=>e.backButtonShown==="true"&&`border-bottom: ${e.theme.border};`}
|
|
33
33
|
`,_=r(a.Feedback)`
|
|
34
|
-
|
|
34
|
+
${e=>{var t,n;return`padding: ${(t=e.theme.sizes)==null?void 0:t.large} ${(n=e.theme.sizes)==null?void 0:n.large};`}}
|
|
35
35
|
`,ee=r(a.StyledHeaderText)`
|
|
36
|
-
|
|
36
|
+
${e=>{var t,n;return`padding: ${(t=e.theme.sizes)==null?void 0:t.large} ${(n=e.theme.sizes)==null?void 0:n.large};`}}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
display: block;
|
|
39
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
40
|
+
font-weight: bold;
|
|
41
41
|
`,te=({backButtonShown:e=!1,accordion:t=!1})=>{const n=a.useDispatch(),{loading:i=!1,dialog:m=[],guide:l,handoverContactMethods:c=[],contactHeader:h,showFeedback:d,feedbackDirection:g="horizontal",feedbackRecognitionLabel:y,feedbackGiven:u,feedbackHeader:p,positiveFeedbackLabel:b,negativeFeedbackLabel:B,contactFeedbackLabel:f}=a.useProperties(),[x,o]=j.useState(!1);return j.useEffect(()=>{u||o(!1)},[u]),!d||!l||!l.allowFeedback||i&&!u||m.length?null:u&&y&&!c.length&&!i?s.jsx(ee,{accordion:t?"true":"false",tabindex:-1,ref:k=>{!x&&k&&(o(!0),k.focus())},children:y}):l.hasHandover&&c.length?s.jsx(Z,{backButtonShown:e?"true":"false",accordion:t?"true":"false",header:h,contactMethods:c,dispatch:n}):s.jsx(_,{accordion:t?"true":"false",positive:b,negative:l.hasHandover?f:B,header:p,selected:u,onFeedback:k=>n("feedback",k),direction:g})},se=({guide:{categories:e=[]},toolbar:{picker:t=$.PickerTypes.NONE}})=>{const[n,i]=j.useState([]),m=a.useContainer();return j.useEffect(()=>{D.buildCategoryTrail("index",e.map(l=>l.toString()),m).then(l=>{i(l)})},[e]),n.length?s.jsx(a.Tooltip,{className:"humany-guide-category-tooltip",sticky:t===$.PickerTypes.DRAWER,content:s.jsx(s.Fragment,{children:n.map(l=>s.jsx(ne,{className:"humany-guide-category-trail",children:l.map((c,h)=>s.jsxs(a.Text,{className:"humany-guide-category-trail-segment",children:[c.symbol&&h===0&&s.jsx(a.SymbolBadge,{size:14,symbol:c.symbol}),c.title,h!==l.length-1&&s.jsx(ae,{className:"humany-category-separator",children:"/"})]},c.id))},l.map(c=>c.id).join(".")))}),children:t===$.PickerTypes.DRAWER?s.jsx(a.StyledListButton,{className:"humany-guide-category-tooltip-button","data-has-label":"false","data-has-symbol":"true",children:s.jsx(A,{size:19,symbol:{type:"Svg",content:"information"}})}):s.jsx(A,{size:19,symbol:{type:"Svg",content:"information"}})}):null},ne=r.div`
|
|
42
42
|
i,
|
|
43
43
|
svg {
|
|
@@ -108,89 +108,89 @@
|
|
|
108
108
|
text-decoration: underline;
|
|
109
109
|
}
|
|
110
110
|
`,fe=e=>{const{allowCopy:t=!1,allowPrint:n=!1,guideCategories:i=!1,language:m=!1,showFavoriteToggle:l=!1,picker:c=$.PickerTypes.NONE}=e;return!t&&!n&&!m&&!l&&!i||c===$.PickerTypes.NONE},ye=({className:e="",dispatch:t})=>{const{toolbarLanguageHeader:n,toolbarFunctionsHeader:i,toolbarLanguageTooltip:m,toolbarFunctionsTooltip:l,toolbarFunctionsCloseButtonAriaLabel:c,printActionLabel:h,copyActionLabel:d,addFavoriteTooltip:g,removeFavoriteCancelLabel:y,removeFavoriteConfirmLabel:u,removeFavoriteHeader:p,removeFavoriteLabel:b,removeFavoriteTooltip:B,guide:f,toolbar:x,...o}=a.useProperties();if(!f||!x||fe(x))return null;const{language:k,guideCategories:v,allowCopy:C,allowPrint:w,showFavoriteToggle:T,picker:S}=x;return s.jsxs(pe,{className:D.appendClassNames("humany-guide-toolbar",e),children:[k&&Object.keys(f.translations||{}).length>1&&s.jsx(ce,{guide:f,header:n,tooltip:m,picker:S,...o}),v&&s.jsx(se,{guide:f,toolbar:x}),(C||w||T)&&s.jsx(oe,{guide:f,header:i,tooltip:l,printActionLabel:h,copyActionLabel:d,addFavoriteTooltip:g,removeFavoriteCancelLabel:y,removeFavoriteConfirmLabel:u,removeFavoriteHeader:p,removeFavoriteLabel:b,removeFavoriteTooltip:B,toolbarFunctionsCloseButtonAriaLabel:c,allowCopy:C,allowPrint:w,showFavoriteToggle:T,picker:S,dispatch:t})]})},pe=r.div`
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: space-between;
|
|
114
|
+
margin: 0 0 0 auto;
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
> :not(:last-child) {
|
|
117
|
+
margin: 0 calc(${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}} * 2) 0 0;
|
|
118
|
+
}
|
|
119
119
|
`,xe=j.forwardRef(({className:e,accordion:t=!1,...n},i)=>{const{loading:m=!1,dialog:l=[],contactMethods:c=[],showHeader:h=!0,showAnswerVersions:d=!1,defaultAnswerVersionLabel:g="Default",backButtonLabel:y,metadataByLabel:u,metadataModifiedLabel:p,metadataPublishedLabel:b,availablePerspectives:B,metadata:f,toolbar:x,guide:o,error:k}=a.useProperties(),{params:{connection:v,guide:C}}=a.useRouteData(),w=a.useContainer(),T=a.useChildren(),S=a.useDispatch(),z=j.useMemo(()=>({transform:{img:L=>s.jsx(a.Lightbox,{attrs:L,htmlBody:(o==null?void 0:o.body)||""}),a:L=>{const{children:U,...J}=L,q=J["data-target"];if(q&&l.length){const H=l.find(({connection:K})=>K===q);if(H)return s.jsx(a.DialogLink,{...H,children:U})}return a.embeddedLinkMapper(w)(L)}}}),[o,w,l]),P=j.useCallback(()=>{S("back")},[S]);if(!o&&!k&&!m)return a.createEmptyComponent(w,{...n,className:D.appendClassNames(e,"humany-guide")});const{id:N="",title:R="",body:O="",translations:M={}}=o||{};if(k&&k.status===404)return s.jsx(V.NotFound,{showSearch:!1});const F=!!t&&!!v,G=Object.keys(M).find(L=>M[L]===`${N}`);return s.jsxs($e,{ref:i,...n,"data-loading":m,className:D.appendClassNames(e,"humany-guide"),children:[s.jsxs(Le,{"data-loading":m,accordion:t?"true":"false",className:"humany-guide-content",children:[(d&&o||!!x)&&s.jsxs(Se,{className:"humany-guide-top",children:[d&&o&&s.jsx(Q,{defaultAnswerVersionLabel:g,availablePerspectives:B,guide:o}),!!x&&s.jsx(ye,{dispatch:S})]}),!!(R||O)&&s.jsx(ke,{className:"humany-guide-body",accordion:t?"true":"false",header:h&&R||void 0,html:O,htmlParseInstruction:z,lang:G}),l&&O.indexOf("h-option-link")===-1&&s.jsx(we,{dialog:l}),s.jsx(je,{backButtonShown:F?"true":"false",contactMethods:c,dispatch:S,guideId:o&&o.id}),!c.length&&C===(o==null?void 0:o.id)&&s.jsx(te,{backButtonShown:F,accordion:t}),F&&s.jsxs(Te,{"aria-label":y,onClick:P,children:[s.jsxs(Ce,{width:"7",height:"13",viewBox:"0 0 7 13",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("line",{x1:"6.64645",y1:"12.5513",x2:"0.648357",y2:"6.55319"}),s.jsx("line",{x1:"0.646447",y1:"6.64455",x2:"6.64454",y2:"0.646465"})]}),y&&s.jsx("span",{children:y})]}),f&&s.jsx(Be,{...f,modified:o==null?void 0:o.modified,published:o==null?void 0:o.published,modifiedBy:o==null?void 0:o.modifiedBy,publishedBy:o==null?void 0:o.publishedBy,byLabel:u,modifiedLabel:p,publishedLabel:b}),T.map(L=>s.jsx(ze,{id:L.id,branch:"default",embedded:!0},L.id))]}),s.jsx(a.Loader,{loading:m})]})}),$e=r.div`
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
${a.loadingOpacity}
|
|
121
|
+
min-width: 0;
|
|
122
122
|
`,ke=r(a.Paragraph)`
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
${a.genericHtml}
|
|
124
|
+
${e=>{var t;return`padding: ${(t=e.theme.sizes)==null?void 0:t.large};`}}
|
|
125
125
|
display: block;
|
|
126
|
-
|
|
126
|
+
line-height: 1.6em;
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
${e=>{var t,n;return a.headingElement(e)("h1",E.css`
|
|
129
|
+
font-size: ${(t=e.theme.fonts)==null?void 0:t.large};
|
|
130
|
+
font-weight: normal;
|
|
131
|
+
line-height: 1.6em;
|
|
132
|
+
line-height: 1.6em;
|
|
133
|
+
margin: 0 0 ${(n=e.theme.sizes)==null?void 0:n.small};
|
|
134
|
+
`)}}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
136
|
+
p {
|
|
137
|
+
font-weight: 300;
|
|
138
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
139
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
140
|
+
a {
|
|
141
|
+
display: inline;
|
|
143
142
|
}
|
|
143
|
+
}
|
|
144
144
|
`,je=r(W.ContactList)`
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
border-top: ${e=>e.theme.border};
|
|
146
|
+
${e=>e.backButtonShown==="true"&&`border-bottom: ${e.theme.border};`}
|
|
147
147
|
`,we=r(a.DialogList)`
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
${e=>{var t,n;return`padding: 0 ${(t=e.theme.sizes)==null?void 0:t.large} ${(n=e.theme.sizes)==null?void 0:n.large};`}}
|
|
149
|
+
display: block;
|
|
150
150
|
`,Se=r.div`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
151
|
+
${e=>{var t,n;return`padding: calc(${(t=e.theme.sizes)==null?void 0:t.normal}*2) ${(n=e.theme.sizes)==null?void 0:n.large};`}}
|
|
152
|
+
display: flex;
|
|
153
|
+
justify-content: space-between;
|
|
154
|
+
align-items: center;
|
|
155
|
+
border-bottom: ${e=>e.theme.border};
|
|
156
|
+
border-radius: ${e=>`${e.theme.borderRadius} ${e.theme.borderRadius}`} 0 0;
|
|
157
|
+
background-color: #ffffff;
|
|
158
158
|
`,Le=r.div`
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
159
|
+
${a.contentBox}
|
|
160
|
+
display: block;
|
|
161
|
+
> a {
|
|
162
|
+
${W.contactLink}
|
|
163
|
+
}
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
165
|
+
${e=>e.accordion==="true"&&E.css`
|
|
166
|
+
white-space: normal;
|
|
167
|
+
box-shadow: none;
|
|
168
|
+
background-color: #fafafa;
|
|
169
|
+
`}
|
|
170
170
|
`,Be=r(a.Metadata)`
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
display: block;
|
|
172
|
+
${e=>{var t,n;return`padding: calc(${(t=e.theme.sizes)==null?void 0:t.normal}*2) ${(n=e.theme.sizes)==null?void 0:n.large};`}}
|
|
173
|
+
font-weight: 300;
|
|
174
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
175
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
|
|
176
|
+
border-top: ${e=>e.theme.border};
|
|
177
177
|
`,ze=r(V.Component)`
|
|
178
|
-
|
|
178
|
+
border-top: ${e=>e.theme.border};
|
|
179
179
|
`,Te=r(a.Button)`
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
180
|
+
${e=>{var t,n;return`padding: ${(t=e.theme.sizes)==null?void 0:t.normal} calc(${(n=e.theme.sizes)==null?void 0:n.normal} * 2);`}}
|
|
181
|
+
color: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
182
|
+
text-decoration: underline;
|
|
183
|
+
font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
|
|
184
|
+
span {
|
|
185
|
+
font-weight: 300;
|
|
186
|
+
}
|
|
187
|
+
&:focus-visible {
|
|
188
|
+
${a.linkTabStyle}
|
|
189
|
+
padding: ${e=>{var t,n;return`calc(${(t=e.theme.sizes)==null?void 0:t.small} / 2) ${(n=e.theme.sizes)==null?void 0:n.small}`}};
|
|
190
|
+
}
|
|
191
191
|
`,Ce=r.svg`
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
margin-right: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.small}};
|
|
193
|
+
line {
|
|
194
|
+
stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.primary}};
|
|
195
|
+
}
|
|
196
196
|
`;exports.default=xe;
|
|
@@ -17,85 +17,98 @@ const He = ({
|
|
|
17
17
|
return /* @__PURE__ */ a(
|
|
18
18
|
je,
|
|
19
19
|
{
|
|
20
|
-
className: I(
|
|
20
|
+
className: I(
|
|
21
|
+
e,
|
|
22
|
+
"humany-guide-answer-version-picker"
|
|
23
|
+
),
|
|
21
24
|
items: h,
|
|
22
25
|
renderItem: (c) => {
|
|
23
26
|
const u = c.label === "Default" ? t : c.label, b = n === c.connection, m = b && (!i.connection || n === i.connection);
|
|
24
|
-
return /* @__PURE__ */ a(
|
|
25
|
-
|
|
27
|
+
return /* @__PURE__ */ a(
|
|
28
|
+
"li",
|
|
26
29
|
{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
"data-version": c.connection,
|
|
31
|
+
children: /* @__PURE__ */ a(
|
|
32
|
+
Me,
|
|
33
|
+
{
|
|
34
|
+
as: m ? "span" : void 0,
|
|
35
|
+
text: u,
|
|
36
|
+
routeName: l,
|
|
37
|
+
selected: b,
|
|
38
|
+
"aria-label": u,
|
|
39
|
+
title: u,
|
|
40
|
+
params: {
|
|
41
|
+
...i,
|
|
42
|
+
connection: c.connection
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
c.connection
|
|
46
|
+
)
|
|
37
47
|
},
|
|
38
48
|
c.connection
|
|
39
|
-
)
|
|
49
|
+
);
|
|
40
50
|
}
|
|
41
51
|
}
|
|
42
52
|
);
|
|
43
53
|
}, je = r(he)`
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
flex-wrap: wrap;
|
|
47
57
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
list-style: none;
|
|
59
|
+
padding: 0;
|
|
60
|
+
margin: 0;
|
|
51
61
|
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
li:not(:last-child) {
|
|
63
|
+
margin: 0 calc(${(e) => {
|
|
54
64
|
var t;
|
|
55
65
|
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
56
66
|
}} * 2) 0 0;
|
|
57
|
-
|
|
67
|
+
}
|
|
58
68
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
69
|
+
li > span {
|
|
70
|
+
cursor: default;
|
|
71
|
+
}
|
|
62
72
|
`, Me = r(Z)`
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
font-weight: 300;
|
|
74
|
+
color: ${(e) => {
|
|
65
75
|
var t;
|
|
66
76
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
67
77
|
}};
|
|
68
|
-
|
|
78
|
+
text-decoration: none;
|
|
69
79
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
80
|
+
${(e) => e.selected && P`
|
|
81
|
+
font-weight: bold;
|
|
82
|
+
text-decoration: underline;
|
|
83
|
+
`}
|
|
74
84
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
85
|
+
&:focus-visible {
|
|
86
|
+
${_};
|
|
87
|
+
}
|
|
78
88
|
`, Pe = r(Y)`
|
|
79
|
-
|
|
80
|
-
|
|
89
|
+
border-top: ${(e) => e.theme.border};
|
|
90
|
+
${(e) => e.backButtonShown === "true" && `border-bottom: ${e.theme.border};`}
|
|
81
91
|
`, Ae = r(ue)`
|
|
82
|
-
|
|
92
|
+
${(e) => {
|
|
83
93
|
var t, n;
|
|
84
94
|
return `padding: ${(t = e.theme.sizes) == null ? void 0 : t.large} ${(n = e.theme.sizes) == null ? void 0 : n.large};`;
|
|
85
95
|
}}
|
|
86
96
|
`, Ve = r(ge)`
|
|
87
|
-
|
|
97
|
+
${(e) => {
|
|
88
98
|
var t, n;
|
|
89
99
|
return `padding: ${(t = e.theme.sizes) == null ? void 0 : t.large} ${(n = e.theme.sizes) == null ? void 0 : n.large};`;
|
|
90
100
|
}}
|
|
91
101
|
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
display: block;
|
|
103
|
+
font-size: ${(e) => {
|
|
94
104
|
var t;
|
|
95
105
|
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
96
106
|
}};
|
|
97
|
-
|
|
98
|
-
`, Ge = ({
|
|
107
|
+
font-weight: bold;
|
|
108
|
+
`, Ge = ({
|
|
109
|
+
backButtonShown: e = !1,
|
|
110
|
+
accordion: t = !1
|
|
111
|
+
}) => {
|
|
99
112
|
const n = ee(), {
|
|
100
113
|
loading: s = !1,
|
|
101
114
|
dialog: d = [],
|
|
@@ -573,7 +586,14 @@ const He = ({
|
|
|
573
586
|
} = V();
|
|
574
587
|
if (!f || !p || st(p))
|
|
575
588
|
return null;
|
|
576
|
-
const {
|
|
589
|
+
const {
|
|
590
|
+
language: k,
|
|
591
|
+
guideCategories: D,
|
|
592
|
+
allowCopy: C,
|
|
593
|
+
allowPrint: x,
|
|
594
|
+
showFavoriteToggle: N,
|
|
595
|
+
picker: z
|
|
596
|
+
} = p;
|
|
577
597
|
return /* @__PURE__ */ w(rt, { className: I("humany-guide-toolbar", e), children: [
|
|
578
598
|
k && Object.keys(f.translations || {}).length > 1 && /* @__PURE__ */ a(
|
|
579
599
|
Ze,
|
|
@@ -610,17 +630,17 @@ const He = ({
|
|
|
610
630
|
)
|
|
611
631
|
] });
|
|
612
632
|
}, rt = r.div`
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
633
|
+
display: flex;
|
|
634
|
+
align-items: center;
|
|
635
|
+
justify-content: space-between;
|
|
636
|
+
margin: 0 0 0 auto;
|
|
617
637
|
|
|
618
|
-
|
|
619
|
-
|
|
638
|
+
> :not(:last-child) {
|
|
639
|
+
margin: 0 calc(${(e) => {
|
|
620
640
|
var t;
|
|
621
641
|
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
622
642
|
}} * 2) 0 0;
|
|
623
|
-
|
|
643
|
+
}
|
|
624
644
|
`, Ct = We(
|
|
625
645
|
({ className: e, accordion: t = !1, ...n }, s) => {
|
|
626
646
|
const {
|
|
@@ -667,7 +687,9 @@ const He = ({
|
|
|
667
687
|
const { id: v = "", title: O = "", body: W = "", translations: q = {} } = o || {};
|
|
668
688
|
if (k && k.status === 404)
|
|
669
689
|
return /* @__PURE__ */ a(Te, { showSearch: !1 });
|
|
670
|
-
const H = !!t && !!D, re = Object.keys(q).find(
|
|
690
|
+
const H = !!t && !!D, re = Object.keys(q).find(
|
|
691
|
+
(L) => q[L] === `${v}`
|
|
692
|
+
);
|
|
671
693
|
return /* @__PURE__ */ w(
|
|
672
694
|
it,
|
|
673
695
|
{
|
|
@@ -716,23 +738,30 @@ const He = ({
|
|
|
716
738
|
}
|
|
717
739
|
),
|
|
718
740
|
!i.length && C === (o == null ? void 0 : o.id) && /* @__PURE__ */ a(Ge, { backButtonShown: H, accordion: t }),
|
|
719
|
-
H && /* @__PURE__ */ w(
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
741
|
+
H && /* @__PURE__ */ w(
|
|
742
|
+
bt,
|
|
743
|
+
{
|
|
744
|
+
"aria-label": b,
|
|
745
|
+
onClick: R,
|
|
746
|
+
children: [
|
|
747
|
+
/* @__PURE__ */ w(
|
|
748
|
+
yt,
|
|
749
|
+
{
|
|
750
|
+
width: "7",
|
|
751
|
+
height: "13",
|
|
752
|
+
viewBox: "0 0 7 13",
|
|
753
|
+
fill: "none",
|
|
754
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ a("line", { x1: "6.64645", y1: "12.5513", x2: "0.648357", y2: "6.55319" }),
|
|
757
|
+
/* @__PURE__ */ a("line", { x1: "0.646447", y1: "6.64455", x2: "6.64454", y2: "0.646465" })
|
|
758
|
+
]
|
|
759
|
+
}
|
|
760
|
+
),
|
|
761
|
+
b && /* @__PURE__ */ a("span", { children: b })
|
|
762
|
+
]
|
|
763
|
+
}
|
|
764
|
+
),
|
|
736
765
|
f && /* @__PURE__ */ a(
|
|
737
766
|
gt,
|
|
738
767
|
{
|
|
@@ -764,130 +793,130 @@ const He = ({
|
|
|
764
793
|
);
|
|
765
794
|
}
|
|
766
795
|
), it = r.div`
|
|
767
|
-
|
|
768
|
-
|
|
796
|
+
${Le}
|
|
797
|
+
min-width: 0;
|
|
769
798
|
`, ct = r(Se)`
|
|
770
|
-
|
|
771
|
-
|
|
799
|
+
${Be}
|
|
800
|
+
${(e) => {
|
|
772
801
|
var t;
|
|
773
802
|
return `padding: ${(t = e.theme.sizes) == null ? void 0 : t.large};`;
|
|
774
803
|
}}
|
|
775
804
|
display: block;
|
|
776
|
-
|
|
805
|
+
line-height: 1.6em;
|
|
777
806
|
|
|
778
|
-
|
|
807
|
+
${(e) => {
|
|
779
808
|
var t, n;
|
|
780
809
|
return Ne(e)(
|
|
781
810
|
"h1",
|
|
782
811
|
P`
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
812
|
+
font-size: ${(t = e.theme.fonts) == null ? void 0 : t.large};
|
|
813
|
+
font-weight: normal;
|
|
814
|
+
line-height: 1.6em;
|
|
815
|
+
line-height: 1.6em;
|
|
816
|
+
margin: 0 0 ${(n = e.theme.sizes) == null ? void 0 : n.small};
|
|
817
|
+
`
|
|
789
818
|
);
|
|
790
819
|
}}
|
|
791
820
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
821
|
+
p {
|
|
822
|
+
font-weight: 300;
|
|
823
|
+
font-size: ${(e) => {
|
|
795
824
|
var t;
|
|
796
825
|
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
797
826
|
}};
|
|
798
|
-
|
|
827
|
+
color: ${(e) => {
|
|
799
828
|
var t;
|
|
800
829
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
801
830
|
}};
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
831
|
+
a {
|
|
832
|
+
display: inline;
|
|
805
833
|
}
|
|
834
|
+
}
|
|
806
835
|
`, dt = r(Y)`
|
|
807
|
-
|
|
808
|
-
|
|
836
|
+
border-top: ${(e) => e.theme.border};
|
|
837
|
+
${(e) => e.backButtonShown === "true" && `border-bottom: ${e.theme.border};`}
|
|
809
838
|
`, mt = r(Ce)`
|
|
810
|
-
|
|
839
|
+
${(e) => {
|
|
811
840
|
var t, n;
|
|
812
841
|
return `padding: 0 ${(t = e.theme.sizes) == null ? void 0 : t.large} ${(n = e.theme.sizes) == null ? void 0 : n.large};`;
|
|
813
842
|
}}
|
|
814
|
-
|
|
843
|
+
display: block;
|
|
815
844
|
`, ht = r.div`
|
|
816
|
-
|
|
845
|
+
${(e) => {
|
|
817
846
|
var t, n;
|
|
818
847
|
return `padding: calc(${(t = e.theme.sizes) == null ? void 0 : t.normal}*2) ${(n = e.theme.sizes) == null ? void 0 : n.large};`;
|
|
819
848
|
}}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
849
|
+
display: flex;
|
|
850
|
+
justify-content: space-between;
|
|
851
|
+
align-items: center;
|
|
852
|
+
border-bottom: ${(e) => e.theme.border};
|
|
853
|
+
border-radius: ${(e) => `${e.theme.borderRadius} ${e.theme.borderRadius}`} 0 0;
|
|
854
|
+
background-color: #ffffff;
|
|
826
855
|
`, ut = r.div`
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
856
|
+
${ve}
|
|
857
|
+
display: block;
|
|
858
|
+
> a {
|
|
859
|
+
${me}
|
|
860
|
+
}
|
|
832
861
|
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
862
|
+
${(e) => e.accordion === "true" && P`
|
|
863
|
+
white-space: normal;
|
|
864
|
+
box-shadow: none;
|
|
865
|
+
background-color: #fafafa;
|
|
866
|
+
`}
|
|
838
867
|
`, gt = r(De)`
|
|
839
|
-
|
|
840
|
-
|
|
868
|
+
display: block;
|
|
869
|
+
${(e) => {
|
|
841
870
|
var t, n;
|
|
842
871
|
return `padding: calc(${(t = e.theme.sizes) == null ? void 0 : t.normal}*2) ${(n = e.theme.sizes) == null ? void 0 : n.large};`;
|
|
843
872
|
}}
|
|
844
|
-
|
|
845
|
-
|
|
873
|
+
font-weight: 300;
|
|
874
|
+
font-size: ${(e) => {
|
|
846
875
|
var t;
|
|
847
876
|
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
848
877
|
}};
|
|
849
|
-
|
|
878
|
+
color: ${(e) => {
|
|
850
879
|
var t;
|
|
851
880
|
return (t = e.theme.colors) == null ? void 0 : t.text;
|
|
852
881
|
}};
|
|
853
|
-
|
|
882
|
+
border-top: ${(e) => e.theme.border};
|
|
854
883
|
`, ft = r(Fe)`
|
|
855
|
-
|
|
884
|
+
border-top: ${(e) => e.theme.border};
|
|
856
885
|
`, bt = r(Re)`
|
|
857
|
-
|
|
886
|
+
${(e) => {
|
|
858
887
|
var t, n;
|
|
859
888
|
return `padding: ${(t = e.theme.sizes) == null ? void 0 : t.normal} calc(${(n = e.theme.sizes) == null ? void 0 : n.normal} * 2);`;
|
|
860
889
|
}}
|
|
861
|
-
|
|
890
|
+
color: ${(e) => {
|
|
862
891
|
var t;
|
|
863
892
|
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
864
893
|
}};
|
|
865
|
-
|
|
866
|
-
|
|
894
|
+
text-decoration: underline;
|
|
895
|
+
font-size: ${(e) => {
|
|
867
896
|
var t;
|
|
868
897
|
return (t = e.theme.fonts) == null ? void 0 : t.normal;
|
|
869
898
|
}};
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
899
|
+
span {
|
|
900
|
+
font-weight: 300;
|
|
901
|
+
}
|
|
902
|
+
&:focus-visible {
|
|
903
|
+
${Oe}
|
|
904
|
+
padding: ${(e) => {
|
|
876
905
|
var t, n;
|
|
877
906
|
return `calc(${(t = e.theme.sizes) == null ? void 0 : t.small} / 2) ${(n = e.theme.sizes) == null ? void 0 : n.small}`;
|
|
878
907
|
}};
|
|
879
|
-
|
|
908
|
+
}
|
|
880
909
|
`, yt = r.svg`
|
|
881
|
-
|
|
910
|
+
margin-right: ${(e) => {
|
|
882
911
|
var t;
|
|
883
912
|
return (t = e.theme.sizes) == null ? void 0 : t.small;
|
|
884
913
|
}};
|
|
885
|
-
|
|
886
|
-
|
|
914
|
+
line {
|
|
915
|
+
stroke: ${(e) => {
|
|
887
916
|
var t;
|
|
888
917
|
return (t = e.theme.colors) == null ? void 0 : t.primary;
|
|
889
918
|
}};
|
|
890
|
-
|
|
919
|
+
}
|
|
891
920
|
`;
|
|
892
921
|
export {
|
|
893
922
|
Ct as default
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";const u=require("@telia-ace/knowledge-data-client"),l=require("@telia-ace/knowledge-widget-component-utilities"),b=require("@telia-ace/knowledge-widget-core"),v=require("@telia-ace/knowledge-widget-ui"),k=require("clipboard-polyfill");function w(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const s=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(r,a,s.get?s:{enumerable:!0,get:()=>e[a]})}}return r.default=e,Object.freeze(r)}const m=w(k),y=(e,r)=>{r.actions.create("feedback",a=>{const s=a==="negative"?u.FeedbackType.Negative:u.FeedbackType.Positive,{guide:i,submitButtonLabel:c="Submit"}=r.properties();if(i){const{connection:t,id:n,hasHandover:o}=i;r.writeProperties({feedbackGiven:a,loading:o&&s===u.FeedbackType.Negative});const{events:d}=e.get("$widget");return d.dispatch("tracking:feedback-given",{guide:i,categories:i.categories,feedbackType:s.toLowerCase()}),u.DataClient.getInstance(e).then(h=>h.feedback(n,t,s).then(()=>{if(o&&s===u.FeedbackType.Negative)return h.fetch(u.DataType.ContactMethods,{guideId:n}).then(({contactMethods:p})=>r.actions.dispatch("handover",{handoverContactMethods:p.map(g=>({...g,body:l.updateForm(g,{submit:c})})),loading:!1}))}))}}),r.actions.create("handover",a=>r.writeProperties({...a,loading:!1}))},T=({title:e,body:r})=>{let a="";e&&e.length&&(a=e.trim()),r&&r.length&&(a=`${a.trim()}
|
|
2
|
-
${r.trim()}`);const s=document.createElement("div");s.innerHTML=a;const i=Array.from(s.getElementsByTagName("a"));let c=s.innerText;return i.forEach(t=>{c=c.replace(t.innerText,`[${t.href}] (${t.innerText})`)}),c},C=({title:e,body:r})=>{let a="";return e&&e.length&&(a=`<h2>${e.trim()}</h2>`),r&&r.length&&(a=`${a.trim()}${r.trim()}`),a.trim()},x=e=>{const{events:r}=e.get("$widget"),[a,s]=b.createEventSubscriber(r);return v.createReactComponent(e,"guide",Promise.resolve().then(()=>require("./guide-
|
|
2
|
+
${r.trim()}`);const s=document.createElement("div");s.innerHTML=a;const i=Array.from(s.getElementsByTagName("a"));let c=s.innerText;return i.forEach(t=>{c=c.replace(t.innerText,`[${t.href}] (${t.innerText})`)}),c},C=({title:e,body:r})=>{let a="";return e&&e.length&&(a=`<h2>${e.trim()}</h2>`),r&&r.length&&(a=`${a.trim()}${r.trim()}`),a.trim()},x=e=>{const{events:r}=e.get("$widget"),[a,s]=b.createEventSubscriber(r);return v.createReactComponent(e,"guide",Promise.resolve().then(()=>require("./guide-9d79906b.js")),i=>{const c=t=>{i.writeProperties({loading:!0,error:void 0,guide:void 0,dialog:void 0,contactMethods:void 0,feedbackGiven:void 0}),i.actions.dispatch("fetch",{params:t})};i.actions.create("copy",t=>{const n=new m.ClipboardItem({"text/html":new Blob([C(t)],{type:"text/html"}),"text/plain":new Blob([T(t)],{type:"text/plain"})});return m.write([n]).then(()=>{r.dispatch("widget:menu-toggled",null)})}),i.actions.create("print",()=>{const t=document.querySelector(".humany-guide .humany-paragraph"),n=window.open("","","height=500, width=500");r.dispatch("widget:menu-toggled",null),t&&n&&(n.document.write(`<html><body>${t.innerHTML}</body></html>`),n.document.close(),n.print())}),i.actions.create("back",(t,n)=>{if(!n.preventDefault)return e.getAsync("router").then(o=>{o.goBack()})}),i.actions.create("fetch",({contactMethods:t=[],dialog:n=[],guide:o,error:d})=>{if(d)return i.actions.dispatch("fetched",{error:d,guide:void 0,contactMethods:[],feedbackGiven:void 0,handoverContactMethods:[],showFeedback:!1,loading:!0});const{showFeedback:h=!0,submitButtonLabel:p="Submit"}=i.properties(),g={showFeedback:h,dialog:n,guide:o,feedbackGiven:void 0,handoverContactMethods:[],contactMethods:t.map(f=>({...f,body:l.updateForm(f,{submit:p})}))};return i.actions.dispatch("fetched",{...g,loading:!0})}),i.actions.create("fetched",t=>i.writeProperties({...t,feedbackGiven:void 0,loading:!1})),e.getAsync("router").then(t=>{const{params:n}=t.getRouteData();c(n)}),a("router:changed",(t,{current:n})=>{c(n.routeData.params)}),y(e,i),l.useForm(e,i),l.useExpand(i)}).then(()=>b.extendComponent(e,"guide",i=>{i.actions.watch("guide.fetch",(c,t)=>{const{params:{guide:n,connection:o}}=c;return n?u.DataClient.getInstance(e).then(d=>d.fetch(u.DataType.Guide,{connection:o,guideId:n})).then(t).catch(d=>{if(d)return t(d)}):t(c)})})).then(()=>{s()})};module.exports=x;
|
package/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-guide",
|
|
3
|
-
"version": "1.1.2-rc.
|
|
3
|
+
"version": "1.1.2-rc.2",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@telia-ace/knowledge-widget-ui": "^1.1.2-rc.
|
|
14
|
-
"@telia-ace/widget-utilities": "^1.1.2-rc.
|
|
15
|
-
"@telia-ace/knowledge-widget-core": "^1.1.2-rc.
|
|
16
|
-
"@telia-ace/knowledge-widget-adapters": "^1.1.2-rc.
|
|
17
|
-
"@telia-ace/knowledge-widget-component-utilities": "^1.1.2-rc.
|
|
18
|
-
"@telia-ace/widget-forms": "^1.1.2-rc.
|
|
19
|
-
"@telia-ace/widget-routing": "^1.1.2-rc.
|
|
20
|
-
"@telia-ace/widget-types-grid": "^1.1.2-rc.
|
|
21
|
-
"@telia-ace/knowledge-data-client": "^1.1.2-rc.
|
|
13
|
+
"@telia-ace/knowledge-widget-ui": "^1.1.2-rc.2",
|
|
14
|
+
"@telia-ace/widget-utilities": "^1.1.2-rc.2",
|
|
15
|
+
"@telia-ace/knowledge-widget-core": "^1.1.2-rc.2",
|
|
16
|
+
"@telia-ace/knowledge-widget-adapters": "^1.1.2-rc.2",
|
|
17
|
+
"@telia-ace/knowledge-widget-component-utilities": "^1.1.2-rc.2",
|
|
18
|
+
"@telia-ace/widget-forms": "^1.1.2-rc.2",
|
|
19
|
+
"@telia-ace/widget-routing": "^1.1.2-rc.2",
|
|
20
|
+
"@telia-ace/widget-types-grid": "^1.1.2-rc.2",
|
|
21
|
+
"@telia-ace/knowledge-data-client": "^1.1.2-rc.2",
|
|
22
22
|
"@webprovisions/platform": "^1.1.4",
|
|
23
23
|
"clipboard-polyfill": "4.0.0-rc1"
|
|
24
24
|
},
|