@telia-ace/knowledge-widget-components-contact-list 1.1.1-rc.2 → 1.1.1-rc.3

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.
@@ -0,0 +1,31 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),m=require("@emotion/styled"),q=require("@telia-ace/knowledge-widget-adapters"),e=require("@telia-ace/knowledge-widget-ui"),a=require("@telia-ace/widget-utilities"),D=require("@telia-ace/widget-types-grid"),k=require("react"),w=({className:n,guides:s,header:L,accordion:c,loading:g,route:S="guide",categoryTitle:x,...l})=>{const{name:p,params:{contactCategory:I=0,guide:C}}=e.useRouteData(),{name:r}=e.useComponentDescriptor(),$=e.useContainer(),f=e.useChildren(),b=e.useDispatch(),N=k.useCallback((o,i,y,u)=>{const{id:h,title:j}=o;return c&&C===h?t.jsx(e.AccordionListItem,{id:h,title:j,route:p,collapseUri:x&&a.formatUrl(x),children:f.map(d=>t.jsx(D.Component,{id:d.id,branch:"default",accordion:c},d.id))},h):u?u(o,i,y,u):null},[c,f,C]);return!s.length&&!g?e.createEmptyComponent($,{...l,className:a.appendClassNames(n,"humany-deflection-list")}):t.jsx(T,{...l,"data-loading":g,className:a.appendClassNames(n,"humany-deflection-list"),items:s,header:L,expandable:!!c,renderItem:N,dispatch:b,routing:{guide:S},paramMappers:{guide:({id:o,title:i})=>a.createParams({contactCategory:I,guide:o,accordion:c?r:void 0,uriName:a.formatUrl(i)})},children:t.jsx(e.Loader,{loading:g})})},T=m(e.GuideList)`
2
+ ${e.contentBox}
3
+ ${e.loadingOpacity}
4
+ `,U=m(q.ContactList)`
5
+ ${e.loadingOpacity}
6
+ ${e.contentBox}
7
+ `,B=m(e.ItemList)`
8
+ ${n=>e.loadingOpacity(n)}
9
+ ${e.contentBox}
10
+ ${q.contactItemList}
11
+
12
+ && {
13
+ i {
14
+ font-size: 25px;
15
+ width: 1.28571429em;
16
+ text-align: center;
17
+ }
18
+ }
19
+ `,v=m(e.Link)`
20
+ &:focus-visible {
21
+ ${e.borderTabStyle};
22
+ }
23
+
24
+ ${q.contactLink}
25
+ `,G=m.div`
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: ${n=>{var s;return(s=n.theme.sizes)==null?void 0:s.normal}};
29
+ `,O=m(e.StyledText)`
30
+ font-weight: bold;
31
+ `,P=({className:n,...s})=>{const L=e.useDispatch(),c=e.useContainer(),g=e.useRouteData(),{deflectionHeader:S="",routes:x={},contactMethods:l=[],categories:p=[],guides:I=[],deflectionAccordion:C=!1,loading:r=!1}=e.useProperties(),{contactCategory:$,guide:f="guide"}=x;if(!p.length&&!l.length&&!r)return e.createEmptyComponent(c,{...s,className:a.appendClassNames(n,"humany-contact-category-list")});const{name:b,params:{contactCategory:N}}=g,o=a.findCategoryById(N,p);return l.length?t.jsxs(t.Fragment,{children:[t.jsx(w,{className:n,guides:I,categoryTitle:o&&o.title,header:S,route:f,accordion:C,loading:r}),t.jsx(U,{"data-loading":r,className:n,contactMethods:l,dispatch:L,children:t.jsx(e.Loader,{loading:r})})]}):t.jsx(B,{...s,"data-loading":r,className:a.appendClassNames(n,"humany-contact-category-list"),items:o&&o.items||p,renderItem:({id:i,title:y,symbol:u,matches:h,items:j,description:d})=>h||j&&j.length?t.jsx("li",{"data-contact-category":i,children:t.jsxs(v,{routeName:$||b,params:a.createParams({contactCategory:i,uriName:a.formatUrl(y)}),children:[u&&t.jsx(e.SymbolBadge,{symbol:u}),d!=null&&d.length?t.jsxs(G,{children:[t.jsx(O,{children:y}),t.jsx(e.StyledText,{children:d})]}):t.jsx(e.StyledText,{children:y})]})},i):null,children:t.jsx(e.Loader,{loading:r})})};exports.default=P;
@@ -0,0 +1,190 @@
1
+ import { jsx as t, jsxs as D, Fragment as P } from "react/jsx-runtime";
2
+ import d from "@emotion/styled";
3
+ import { ContactList as T, contactItemList as U, contactLink as E } from "@telia-ace/knowledge-widget-adapters";
4
+ import { GuideList as F, contentBox as G, loadingOpacity as j, useRouteData as w, useComponentDescriptor as O, useContainer as z, useChildren as R, useDispatch as A, AccordionListItem as q, createEmptyComponent as H, Loader as k, ItemList as J, Link as K, borderTabStyle as Q, StyledText as v, useProperties as V, SymbolBadge as W } from "@telia-ace/knowledge-widget-ui";
5
+ import { formatUrl as B, appendClassNames as L, createParams as M, findCategoryById as X } from "@telia-ace/widget-utilities";
6
+ import { Component as Y } from "@telia-ace/widget-types-grid";
7
+ import { useCallback as Z } from "react";
8
+ const _ = ({
9
+ className: e,
10
+ guides: o,
11
+ header: $,
12
+ accordion: r,
13
+ loading: m,
14
+ route: x = "guide",
15
+ categoryTitle: p,
16
+ ...s
17
+ }) => {
18
+ const {
19
+ name: u,
20
+ params: { contactCategory: I = 0, guide: y }
21
+ } = w(), { name: a } = O(), b = z(), f = R(), S = A(), N = Z(
22
+ (n, c, g, l) => {
23
+ const { id: h, title: C } = n;
24
+ return r && y === h ? /* @__PURE__ */ t(
25
+ q,
26
+ {
27
+ id: h,
28
+ title: C,
29
+ route: u,
30
+ collapseUri: p && B(p),
31
+ children: f.map((i) => /* @__PURE__ */ t(
32
+ Y,
33
+ {
34
+ id: i.id,
35
+ branch: "default",
36
+ accordion: r
37
+ },
38
+ i.id
39
+ ))
40
+ },
41
+ h
42
+ ) : l ? l(n, c, g, l) : null;
43
+ },
44
+ // eslint-disable-next-line react-hooks/exhaustive-deps
45
+ [r, f, y]
46
+ );
47
+ return !o.length && !m ? H(b, {
48
+ ...s,
49
+ className: L(e, "humany-deflection-list")
50
+ }) : /* @__PURE__ */ t(
51
+ tt,
52
+ {
53
+ ...s,
54
+ "data-loading": m,
55
+ className: L(e, "humany-deflection-list"),
56
+ items: o,
57
+ header: $,
58
+ expandable: !!r,
59
+ renderItem: N,
60
+ dispatch: S,
61
+ routing: {
62
+ guide: x
63
+ },
64
+ paramMappers: {
65
+ guide: ({ id: n, title: c }) => M({
66
+ contactCategory: I,
67
+ guide: n,
68
+ accordion: r ? a : void 0,
69
+ uriName: B(c)
70
+ })
71
+ },
72
+ children: /* @__PURE__ */ t(k, { loading: m })
73
+ }
74
+ );
75
+ }, tt = d(F)`
76
+ ${G}
77
+ ${j}
78
+ `, et = d(T)`
79
+ ${j}
80
+ ${G}
81
+ `, nt = d(J)`
82
+ ${(e) => j(e)}
83
+ ${G}
84
+ ${U}
85
+
86
+ && {
87
+ i {
88
+ font-size: 25px;
89
+ width: 1.28571429em;
90
+ text-align: center;
91
+ }
92
+ }
93
+ `, ot = d(K)`
94
+ &:focus-visible {
95
+ ${Q};
96
+ }
97
+
98
+ ${E}
99
+ `, at = d.div`
100
+ display: flex;
101
+ flex-direction: column;
102
+ gap: ${(e) => {
103
+ var o;
104
+ return (o = e.theme.sizes) == null ? void 0 : o.normal;
105
+ }};
106
+ `, rt = d(v)`
107
+ font-weight: bold;
108
+ `, gt = ({ className: e, ...o }) => {
109
+ const $ = A(), r = z(), m = w(), {
110
+ deflectionHeader: x = "",
111
+ routes: p = {},
112
+ contactMethods: s = [],
113
+ categories: u = [],
114
+ guides: I = [],
115
+ deflectionAccordion: y = !1,
116
+ loading: a = !1
117
+ } = V(), { contactCategory: b, guide: f = "guide" } = p;
118
+ if (!u.length && !s.length && !a)
119
+ return H(r, {
120
+ ...o,
121
+ className: L(e, "humany-contact-category-list")
122
+ });
123
+ const {
124
+ name: S,
125
+ params: { contactCategory: N }
126
+ } = m, n = X(
127
+ N,
128
+ u
129
+ );
130
+ return s.length ? /* @__PURE__ */ D(P, { children: [
131
+ /* @__PURE__ */ t(
132
+ _,
133
+ {
134
+ className: e,
135
+ guides: I,
136
+ categoryTitle: n && n.title,
137
+ header: x,
138
+ route: f,
139
+ accordion: y,
140
+ loading: a
141
+ }
142
+ ),
143
+ /* @__PURE__ */ t(
144
+ et,
145
+ {
146
+ "data-loading": a,
147
+ className: e,
148
+ contactMethods: s,
149
+ dispatch: $,
150
+ children: /* @__PURE__ */ t(k, { loading: a })
151
+ }
152
+ )
153
+ ] }) : /* @__PURE__ */ t(
154
+ nt,
155
+ {
156
+ ...o,
157
+ "data-loading": a,
158
+ className: L(e, "humany-contact-category-list"),
159
+ items: n && n.items || u,
160
+ renderItem: ({
161
+ id: c,
162
+ title: g,
163
+ symbol: l,
164
+ matches: h,
165
+ items: C,
166
+ description: i
167
+ }) => h || C && C.length ? /* @__PURE__ */ t("li", { "data-contact-category": c, children: /* @__PURE__ */ D(
168
+ ot,
169
+ {
170
+ routeName: b || S,
171
+ params: M({
172
+ contactCategory: c,
173
+ uriName: B(g)
174
+ }),
175
+ children: [
176
+ l && /* @__PURE__ */ t(W, { symbol: l }),
177
+ i != null && i.length ? /* @__PURE__ */ D(at, { children: [
178
+ /* @__PURE__ */ t(rt, { children: g }),
179
+ /* @__PURE__ */ t(v, { children: i })
180
+ ] }) : /* @__PURE__ */ t(v, { children: g })
181
+ ]
182
+ }
183
+ ) }, c) : null,
184
+ children: /* @__PURE__ */ t(k, { loading: a })
185
+ }
186
+ );
187
+ };
188
+ export {
189
+ gt as default
190
+ };
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./index-c67477f3.js");require("react/jsx-runtime");require("@emotion/styled");require("@emotion/react");require("react");require("react-transition-group");require("react-dom");require("react-router-dom");module.exports=e.ContactListComponent;
1
+ "use strict";const g=require("@telia-ace/knowledge-data-client"),n=require("@telia-ace/knowledge-widget-component-utilities"),w=require("@telia-ace/knowledge-widget-core"),M=require("@telia-ace/knowledge-widget-ui"),v=s=>{const{events:y}=s.get("$widget"),[m,P]=w.createEventSubscriber(y);return M.createReactComponent(s,"contact-list",Promise.resolve().then(()=>require("./contact-list-05301ab8.js")),e=>{const c=t=>{e.writeProperties({loading:!0,contactMethods:[],categories:[]}),e.actions.dispatch("fetch",{params:t})};e.actions.create("fetch",t=>{const{submitButtonLabel:r="Submit"}=e.properties(),a=(t.contactMethods||[]).map(o=>({...o,body:n.updateForm(o,{submit:r})}));return e.actions.dispatch("fetched",{...t,contactMethods:a,loading:!0})}),e.actions.create("fetched",t=>e.writeProperties({...t,guides:t.guides||[],loading:!1})),s.getAsync("router").then(t=>{const{params:r}=t.getRouteData();c(r)}),m("router:changed",(t,{current:r})=>{c(r.routeData.params)}),n.useForm(s,e),n.useExpand(e)}).then(()=>w.extendComponent(s,"contact-list",e=>{e.actions.watch("contact-list.fetch",(c,t)=>{const{deflection:r={},deflectionPageSize:a=5,deflectionAccordion:o}=e.properties(),{params:k={}}=c,{contactCategory:u,guide:h,accordion:D}=k;return g.DataClient.getInstance(s).then(d=>d.fetch(g.DataType.ContactMethodCategories,{contactMethodCategoryId:u}).then(({contactMethods:l,categories:f})=>{var p;const b=Object.keys(r),C=b.length===1&&!u?b[0]:u;return(p=r[C])!=null&&p.length?d.fetch(g.DataType.Guides,{categories:r[C],take:a}).then(i=>o&&h&&D===e.node.name?n.fetchAccordionGuideIfMissing(i,d,{guide:h}):new Promise(q=>q(i))).then(({guides:i})=>t({guides:i,contactMethods:l,categories:f})):t({contactMethods:l,categories:f})}))})})).then(()=>{P()})};module.exports=v;
package/index.mjs CHANGED
@@ -1,11 +1,78 @@
1
- import { J as d } from "./index-5f1f8442.mjs";
2
- import "react/jsx-runtime";
3
- import "@emotion/styled";
4
- import "@emotion/react";
5
- import "react";
6
- import "react-transition-group";
7
- import "react-dom";
8
- import "react-router-dom";
1
+ import { DataClient as D, DataType as p } from "@telia-ace/knowledge-data-client";
2
+ import { updateForm as v, useForm as A, useExpand as I, fetchAccordionGuideIfMissing as S } from "@telia-ace/knowledge-widget-component-utilities";
3
+ import { createEventSubscriber as k, extendComponent as x } from "@telia-ace/knowledge-widget-core";
4
+ import { createReactComponent as E } from "@telia-ace/knowledge-widget-ui";
5
+ const j = (s) => {
6
+ const { events: b } = s.get("$widget"), [y, C] = k(b);
7
+ return E(
8
+ s,
9
+ "contact-list",
10
+ import("./contact-list-300090b9.mjs"),
11
+ (t) => {
12
+ const c = (e) => {
13
+ t.writeProperties({
14
+ loading: !0,
15
+ contactMethods: [],
16
+ categories: []
17
+ }), t.actions.dispatch("fetch", { params: e });
18
+ };
19
+ t.actions.create("fetch", (e) => {
20
+ const { submitButtonLabel: r = "Submit" } = t.properties(), i = (e.contactMethods || []).map(
21
+ (o) => ({
22
+ ...o,
23
+ body: v(o, { submit: r })
24
+ })
25
+ );
26
+ return t.actions.dispatch("fetched", {
27
+ ...e,
28
+ contactMethods: i,
29
+ loading: !0
30
+ });
31
+ }), t.actions.create("fetched", (e) => t.writeProperties({
32
+ ...e,
33
+ guides: e.guides || [],
34
+ loading: !1
35
+ })), s.getAsync("router").then((e) => {
36
+ const { params: r } = e.getRouteData();
37
+ c(r);
38
+ }), y("router:changed", (e, { current: r }) => {
39
+ c(r.routeData.params);
40
+ }), A(s, t), I(t);
41
+ }
42
+ ).then(() => x(s, "contact-list", (t) => {
43
+ t.actions.watch("contact-list.fetch", (c, e) => {
44
+ const {
45
+ deflection: r = {},
46
+ deflectionPageSize: i = 5,
47
+ deflectionAccordion: o
48
+ } = t.properties(), { params: P = {} } = c, {
49
+ contactCategory: n,
50
+ guide: d,
51
+ accordion: w
52
+ } = P;
53
+ return D.getInstance(s).then(
54
+ (u) => u.fetch(p.ContactMethodCategories, {
55
+ contactMethodCategoryId: n
56
+ }).then(({ contactMethods: h, categories: g }) => {
57
+ var m;
58
+ const f = Object.keys(r), l = f.length === 1 && !n ? f[0] : n;
59
+ return (m = r[l]) != null && m.length ? u.fetch(p.Guides, {
60
+ categories: r[l],
61
+ take: i
62
+ }).then((a) => o && d && w === t.node.name ? S(
63
+ a,
64
+ u,
65
+ { guide: d }
66
+ ) : new Promise(
67
+ (M) => M(a)
68
+ )).then(({ guides: a }) => e({ guides: a, contactMethods: h, categories: g })) : e({ contactMethods: h, categories: g });
69
+ })
70
+ );
71
+ });
72
+ })).then(() => {
73
+ C();
74
+ });
75
+ };
9
76
  export {
10
- d as default
77
+ j as default
11
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-contact-list",
3
- "version": "1.1.1-rc.2",
3
+ "version": "1.1.1-rc.3",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -10,14 +10,14 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@telia-ace/knowledge-widget-adapters": "^1.1.1-rc.2",
14
- "@telia-ace/knowledge-widget-component-utilities": "^1.1.1-rc.2",
15
- "@telia-ace/knowledge-widget-core": "^1.1.1-rc.2",
16
- "@telia-ace/knowledge-widget-ui": "^1.1.1-rc.2",
17
- "@telia-ace/widget-forms": "^1.1.1-rc.2",
18
- "@telia-ace/widget-utilities": "^1.1.1-rc.2",
19
- "@telia-ace/widget-types-grid": "^1.1.1-rc.2",
20
- "@telia-ace/knowledge-data-client": "^1.1.1-rc.2",
13
+ "@telia-ace/knowledge-widget-adapters": "^1.1.1-rc.3",
14
+ "@telia-ace/knowledge-widget-component-utilities": "^1.1.1-rc.3",
15
+ "@telia-ace/knowledge-widget-core": "^1.1.1-rc.3",
16
+ "@telia-ace/knowledge-widget-ui": "^1.1.1-rc.3",
17
+ "@telia-ace/widget-forms": "^1.1.1-rc.3",
18
+ "@telia-ace/widget-utilities": "^1.1.1-rc.3",
19
+ "@telia-ace/widget-types-grid": "^1.1.1-rc.3",
20
+ "@telia-ace/knowledge-data-client": "^1.1.1-rc.3",
21
21
  "@webprovisions/platform": "^1.1.4"
22
22
  },
23
23
  "peerDependencies": {
@@ -1,188 +0,0 @@
1
- "use strict";const r=require("react/jsx-runtime"),p=require("@emotion/styled"),n=require("./index-c67477f3.js"),E=require("@emotion/react"),m=require("react");require("react-dom");const K=require("react-transition-group"),D=require("react-router");function*H(e){if(e)for(let t=0;t<e.length;t++){const o=e[t];yield o,o.items&&(yield*H(o.items))}}const W=(e,t)=>{const o=H(t);let s=o.next(),i=null;for(;!s.done;)s.value.id===e&&(i=s.value),s=o.next();return i},O=(e,t)=>({id:e.id,type:e.type,name:e.name,branch:t||"default"}),J=e=>e==="entering"||e==="entered",Z=e=>e==="exiting"||e==="exited",k={fade:{in:"opacity: 1;",out:"opacity: 0;"},"slide-left":{in:"transform: translateX(0);",out:"transform: translateX(-100%);"},"slide-right":{in:"transform: translateX(0);",out:"transform: translateX(100%);"},"slide-up":{in:"transform: translateY(0);",out:"transform: translateY(100%);"},"slide-down":{in:"transform: translateY(0);",out:"transform: translateY(-100%);"},scale:{in:"transform: scale(1);",out:"transform: scale(0);"}},ee=["slide-up","slide-down","slide-left","slide-right","scale"],q={compose:(e="exited",t)=>{const{enter:o,exit:s}=t,i=o.transitionKeys.split(" "),l=ee.indexOf(i[0])>-1?"transform":"opacity";if(J(e))return i&&i.length>0?E.css`
2
- ${i&&i.length>0&&i.map(c=>k[c]?k[c].in:"")}
3
- transition: ${l} ${o.duration}ms ${o.easing};
4
- `:"";const d=i&&i.length>0&&E.css`
5
- ${i.map(c=>k[c]?k[c].out:"")}
6
- `;if(Z(e)){const c=s.transitionKeys.split(" ");return c&&c.length>0&&e==="exiting"?E.css`
7
- ${d};
8
- ${c.map(a=>k[a]?k[a].out:"")}
9
- transition: ${l} ${s.duration}ms ${s.easing};
10
- `:d}},composeViewTransition:(e,t,o)=>{if(t==="slide")return q.compose(e,{enter:{transitionKeys:o==="forth"?"slide-right":"slide-left",duration:500},exit:{transitionKeys:o==="forth"?"slide-left":"slide-right",duration:500}});if(t==="fade")return q.compose(e,{enter:{transitionKeys:"fade",duration:500},exit:{transitionKeys:"fade",duration:500}})},get:e=>k[e]},_=(e,t)=>e.get("seoConfiguration")?r.jsx(n.Empty,{...t}):null,M=()=>m.useContext(n.ComponentNodeContext),te=()=>{const e=n.useComponentNode(),t=n.useComponentPlatform(),[o,s]=m.useState([]),i=n.useIsMounted(),l=m.useCallback(d=>{if(t&&i.current&&d){const c=t.getBranch(d),a=d.getChildren(c).map(u=>O(u));s(a)}},[i,t,s,e]);return m.useEffect(()=>{e&&l(e)},[e,t]),m.useEffect(()=>{if(t){const[d,c]=n.createEventSubscriber(t.events);return d("components:set-layout",(a,u)=>{(e===u.node.parent||u.node.parent===t.nodes.root)&&l(u.node.parent)}),d("components:node-appended",(a,u)=>{(e===u.node.parent||u.node.parent===t.nodes.root)&&l(u.node.parent)}),d("components:node-removed",(a,{parentNode:u})=>{(u===e||u===t.nodes.root)&&l(u)}),()=>{c()}}},[e,t,l]),o},ne=()=>m.useContext(n.ColumnContext),U=(e,t)=>{const o=M(),s=n.useContainer(),[i,l]=m.useState(void 0),d=n.useIsMounted(),c=e||o.type||"";return m.useEffect(()=>{if(c){let a;return(t||s).getAsync("componentResolver").then(u=>{if(d.current){const g=u.getComponent(c);l(g)}a=u.registerResolver(c,g=>{d.current&&l(g)})}),()=>{a&&a()}}},[d,c,t,s]),i},X=()=>{const e=n.useComponentPlatform(),t=M(),[o,s]=m.useState([]),[i,l]=m.useState();return m.useEffect(()=>{if(e&&t){const d=new n.ComponentQuery(e).withId(t.id),c=e.actions(d,t.type||n.uuid());l(c),o!==null&&(o.forEach(a=>{c.dispatch(a.key,a.data).then(u=>a.resolve(u)).catch(u=>a.reject(u))}),s(null))}},[e,t.id]),(d,c)=>o!==null?new Promise((a,u)=>{o.push({key:d,data:c,resolve:a,reject:u})}):i.dispatch(d,c)},oe=e=>{const t=n.useComponentNode(e),o=n.useComponentPlatform(),[s,i]=m.useState({}),l=n.useIsMounted();return m.useEffect(()=>{t&&l.current&&i(t.attributes.layout)},[t,l]),m.useEffect(()=>{if(o){const d=o.events.subscribe("components:layout-changed",(c,a)=>{t===a.node&&l.current&&i(a.node.attributes.layout)});return()=>{d()}}},[o,l,t]),s},B=()=>m.useContext(n.ComponentPropertyContext);p(n.Paragraph)`
11
- ${e=>{var t;return n.headingElement(e)("h1",E.css`
12
- font-weight: normal;
13
- font-size: ${(t=e.theme.fonts)==null?void 0:t.medium};
14
- `)}}
15
- `;const se=p(n.Html)`
16
- ${n.genericHtml}
17
- font-weight: 300;
18
- line-height: 1.5em;
19
- button:focus-visible {
20
- ${n.borderTabStyle};
21
- }
22
-
23
- a:focus-visible {
24
- ${n.linkTabStyle};
25
- }
26
- `,re=e=>{const t=U(e.clientName),{params:{contactCategory:o,guideCategory:s,phrase:i}}=n.useRouteData();if(typeof t>"u")return null;if(t===null)return process.env.NODE_ENV!=="production"?r.jsx(ae,{title:`client-name: ${e.clientName}, id: ${e.id}`,className:"humany-non-resolved-contact-method",children:r.jsx(n.Typography,{variant:"h5",children:"Non resolved Contact Method type"})}):null;const l=(d={})=>{const c={...e,...d},{id:a,title:u,clientName:g,symbol:f,inline:P,onClick:j=()=>{},description:C,htmlParseInstruction:x,className:b,disabled:S,guideId:N,dispatch:w=()=>{},expanded:y}=c,$=P?{onKeyDown:h=>{h.key&&h.key==="Enter"&&(j(h,c),h.defaultPrevented||!y&&w("expand",a))},onClick:h=>{j(h,c),h.defaultPrevented||!y&&w("expand",a)}}:{onClick:h=>j(h,c),routeName:"contact-method",params:n.createParams({contactCategory:o,guideId:N,guideCategory:s,phrase:i,contactMethod:a,uriName:n.formatUrl(u)})};return r.jsxs(ie,{title:u,"aria-label":u,className:b,disabled:S,description:C,"data-client-name":g,...d,...$,children:[f&&r.jsx(n.SymbolBadge,{symbol:f}),C?r.jsxs("div",{className:"humany-contact-link-rich-content",children:[r.jsx(G,{children:u}),r.jsx(se,{html:C,htmlParseInstruction:x})]}):r.jsx(G,{children:u})]})};return e.expanded?r.jsx(m.Suspense,{fallback:null,children:r.jsx(t,{...e,renderDefault:l})}):l()},Y=e=>{var t,o,s,i,l,d,c,a;return E.css`
27
- display: flex;
28
- padding: ${(t=e.theme.sizes)==null?void 0:t.large};
29
- ${e.description?"":"align-items: center;"}
30
- text-decoration: none;
31
- span {
32
- display: inline-block;
33
- color: ${(o=e.theme.colors)==null?void 0:o.text};
34
- }
35
- i {
36
- font-size: ${(s=e.theme.fonts)==null?void 0:s.large};
37
- margin: 0 ${(i=e.theme.sizes)==null?void 0:i.large} 0 0;
38
- min-height: ${(l=e.theme.fonts)==null?void 0:l.large};
39
- min-width: ${(d=e.theme.fonts)==null?void 0:d.large};
40
- line-height: ${(c=e.theme.fonts)==null?void 0:c.large};
41
- display: inline-block;
42
- vertical-align: bottom;
43
- color: ${(a=e.theme.colors)==null?void 0:a.text};
44
- }
45
- `},G=p(n.StyledText)`
46
- line-height: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.large}};
47
- `,ie=p(n.Link)`
48
- ${e=>Y(e)}
49
-
50
- &:focus-visible {
51
- ${n.borderTabStyle};
52
- }
53
- `,ae=p.div`
54
- text-align: center;
55
- display: block;
56
- ${e=>{var t,o;return typeof((t=e.theme.colors)==null?void 0:t.warning)<"u"&&`color: ${(o=e.theme.colors)==null?void 0:o.warning};`}}
57
- `,F=e=>{var t,o,s;return E.css`
58
- ${n.itemList(e)}
59
-
60
- > div {
61
- padding: ${(t=e.theme.sizes)==null?void 0:t.large};
62
-
63
- ${n.headingElement(e)("h1",E.css`
64
- margin: 0;
65
- `)}
66
- }
67
-
68
- > ul {
69
- &:not(:first-child) {
70
- border-top: ${e.theme.border};
71
- }
72
-
73
- > li {
74
- margin: 0;
75
- white-space: normal;
76
-
77
- > a {
78
- overflow: hidden;
79
- }
80
-
81
- &:first-child > a {
82
- border-radius: ${`${e.theme.borderRadius} ${e.theme.borderRadius} 0 0`};
83
- }
84
-
85
- &:last-child:not(:first-child) > a {
86
- border-radius: ${`0 0 ${e.theme.borderRadius} ${e.theme.borderRadius}`};
87
- }
88
-
89
- &:not(:last-child) {
90
- border-bottom: ${e.theme.border};
91
- }
92
-
93
- > div {
94
- padding: ${(o=e.theme.sizes)==null?void 0:o.large};
95
- }
96
- }
97
- }
98
-
99
- @media (hover: hover) {
100
- a:hover {
101
- background-color: ${(s=e.theme.colors)==null?void 0:s.accent};
102
- }
103
- }
104
- `},ce=p(n.ItemList)`
105
- ${e=>F(e)}
106
- `,le=({contactMethods:e,children:t,guideId:o,dispatch:s,className:i="",itemRenderer:l,action:d=()=>{},header:c=""})=>e.length?r.jsx(ce,{header:c,className:n.appendClassNames(i,"humany-contact-list"),items:e,renderItem:l?a=>r.jsx("li",{"data-contact-method":a.id,children:l(a,{action:d,dispatch:s,guideId:o})},a.id):a=>r.jsx("li",{"data-contact-method":a.id,children:r.jsx(re,{...a,action:d,dispatch:s,guideId:o})},a.id),children:t}):null;var A=(e=>(e.back="back",e.forth="forth",e))(A||{});const de=(e,t,o)=>typeof o[e]=="number"&&typeof o[t]=="number"&&o[e]>o[t]?"back":"forth",Q=({views:e,location:t,render:o})=>r.jsx(D.Switch,{location:t&&{...t,pathname:t.pathname.split("?")[0]},children:[...Object.keys(e).filter(s=>!!e[s].path),...Object.keys(e).filter(s=>!e[s].path)].map(s=>{const{path:i}=e[s];return i?Array.isArray(i)?i.map(l=>r.jsx(D.Route,{exact:!0,path:l,render:()=>o(s)},s)):r.jsx(D.Route,{exact:!0,path:i,render:()=>o(s)},s):r.jsx(D.Route,{render:()=>o(s)},s)})}),ue=p.div`
107
- position: relative;
108
- width: 100%;
109
- flex: 1;
110
- `,me=p(n.Grid)`
111
- position: absolute;
112
- left: 0;
113
- right: 0;
114
- ${e=>!!e.animationCss&&e.animationCss}
115
- ${e=>!!e.scrollableCss&&e.scrollableCss}
116
- `,fe={index:1,search:2,browse:3,guide:4,contact:5,"contact-method":6,conversation:7},he=({className:e="",...t})=>{const[o,s]=m.useState("index"),[i,l]=m.useState(A.forth),d=n.useRouteData(),c=n.useRouter(),a=B(),u=n.useContext(),g=n.useContainer(),f=n.useComponentNode(),{gap:P="0"}=u,{columns:j=1,animation:C="none",scrollable:x=!1,...b}=a,[S,N]=n.useScroll(x);if(!f||!c)return null;const{location:w}=c;d.name!==o&&d.name!==""&&C&&(l(de(o,d.name,fe)),s(d.name));const{views:y}=g.get("$settings");if(!Object.keys(y).length)return null;const $=(v,R,T)=>{const L=h(R,T),I=f.getChildren(v)[0];return r.jsx(me,{...t,...b,scrollableCss:S,ref:N,columns:j,gap:P,...L,className:n.appendClassNames(e,"humany-view"),children:r.jsx(V,{id:I.id,branch:"default"})})},h=(v,R)=>{if(C==="slide"||C==="fade")return{animationCss:q.composeViewTransition(v,C,R),"data-state":v}};return r.jsx(ue,{className:"humany-animated-view",children:r.jsx(K.TransitionGroup,{component:null,childFactory:v=>m.cloneElement(v,{direction:i}),children:r.jsx(K.Transition,{timeout:{enter:500,exit:500},onEnter:v=>v==null?void 0:v.clientHeight,unmountOnExit:!0,direction:A.forth,children:(v,{direction:R})=>r.jsx(Q,{views:y,location:w,render:T=>$(T,v,R)})},o)})})},pe=p(n.Grid)`
117
- ${e=>!!e.scrollableCss&&e.scrollableCss}
118
- `,ye=({className:e="",...t})=>{const o=B(),s=n.useContext(),i=n.useContainer(),l=n.useComponentNode(),{views:d}=i.get("$settings"),{gap:c="0"}=s,{columns:a=1,animation:u="none",scrollable:g=!1,...f}=o,[P,j]=n.useScroll(g);return l?r.jsx(pe,{...t,...f,scrollableCss:P,ref:j,columns:a,gap:c,className:n.appendClassNames(e,"humany-view"),children:r.jsx(Q,{views:d,render:C=>{const x=l.getChildren(C)[0];return r.jsx(V,{id:x.id,node:x,branch:"default"})}})}):null},z=e=>{var t,o;return E.css`
119
- outline: none;
120
- box-sizing: border-box;
121
- * {
122
- box-sizing: border-box;
123
- outline: none;
124
- }
125
-
126
- grid-column: ${e["data-indent"]?`${e["data-indent"]+1} / ${e["data-indent"]+(e["data-width"]||0)+1}`:`span ${e["data-width"]}`};
127
-
128
- ${((t=e.theme.fonts)==null?void 0:t.type)&&`
129
- font-family: ${e.theme.fonts.type};
130
-
131
- input, textarea {
132
- font-family: ${e.theme.fonts.type};
133
- }
134
- `}
135
-
136
- ${((o=e.theme.fonts)==null?void 0:o.base)&&`
137
- font-size: ${e.theme.fonts.base};
138
- `}
139
-
140
- &:focus-visible {
141
- ${n.paddedBorderTabStyle(e)};
142
- }
143
- `},ge=p(ye)`
144
- ${e=>z(e)}
145
- `,xe=p(he)`
146
- ${e=>z(e)}
147
- `,be=p.div`
148
- text-align: center;
149
- ${e=>{var t,o,s;return typeof((t=e.theme.colors)==null?void 0:t.warning)<"u"&&E.css`
150
- color: ${(o=e.theme.colors)==null?void 0:o.warning};
151
- border: 2px dashed ${(s=e.theme.colors)==null?void 0:s.warning};
152
- `}}
153
- ${e=>typeof e.theme.borderRadius<"u"&&`border-radius: ${e.theme.borderRadius};`}
154
- ${e=>z(e)}
155
- `,Ce=m.forwardRef(({className:e="",children:t,...o},s)=>{const i=U(),{name:l,type:d,id:c}=M(),a=m.useMemo(()=>i?p(i)`
156
- ${z}
157
- ${n.filterCssPropsStyle}
158
- `:null,[i]);return typeof i>"u"?null:i===null||a===null?process.env.NODE_ENV!=="production"?r.jsx(be,{...o,title:`type: ${d}, definition-id: ${l}, instance-id: ${c}`,className:n.appendClassNames(e,"humany-non-resolved-component"),children:r.jsx(n.Typography,{variant:"h5",children:"Non Resolved Component Type"})}):null:r.jsx(m.Suspense,{fallback:null,children:r.jsx(a,{ref:s,...o,className:n.appendClassNames(e,"humany-component",`humany-component-${l}`),children:t})})}),$e=e=>{const t=n.useComponentNode(e),o=n.useComponentPlatform(),[s,i]=m.useState({}),l=n.useIsMounted();return m.useEffect(()=>{t&&l.current&&i(t.attributes.properties)},[t,e,l]),m.useEffect(()=>{if(o){const d=o.events.subscribe("components:properties-changed",(c,a)=>{t===a.node&&l.current&&i(a.node.attributes.properties)});return()=>{d()}}},[o,l,e,t]),s},je=(e,t)=>t?!0:typeof e=="string"?e==="full":e>0,V=m.forwardRef(({className:e="",id:t,branch:o,node:s,ariaLabel:i,tabIndex:l,context:d,...c},a)=>{const u=n.useComponentPlatform(),g=n.useContainer(),[f,P]=m.useState(),j=ne(),C=n.useContext(t),x=$e(t),{size:b="none",indent:S=0}=oe(t),N=je(b,s);if(m.useEffect(()=>{if(u){if(t&&!s){const L=u.nodes.get(t);if(L&&(P(O(L,o)),N)){const I=L.mount(g);return()=>{I()}}}else if(s){P(O(s,o));const L=s.mount(g);return()=>{L()}}}},[u,t,s,N]),!f||!N)return null;const w={...C,...d||{}},{cardinal:y,fonts:$={},accessibility:h={},...v}=w,R={type:$.type,base:$.base||"16px",small:$.small||"0.8em",normal:$.normal||"1em",medium:$.medium||"1.2em",large:$.large||"1.6em",huge:$.huge||"2.5em"},T={...v,fonts:R,accessibility:{...h}};return typeof y=="number"&&(T.sizes={cardinal:y,small:`${y}px`,normal:`${y*3}px`,medium:`${y*5}px`,large:`${y*8}px`}),r.jsx(E.ThemeProvider,{theme:T,children:r.jsx(n.ComponentNodeContext.Provider,{value:f,children:r.jsx(n.ComponentPropertyContext.Provider,{value:x,children:(()=>{const L={"data-width":b==="full"?j:Math.min(b,j),"data-indent":S,"data-name":f.name,"data-node-id":f.id,"data-component-type":f.type,"aria-label":i,tabIndex:l,id:f.id,role:x&&x.role,...c};switch(f.type){case"view":return typeof x.animation=="string"&&x.animation!=="none"?r.jsx(xe,{...L,className:e}):r.jsx(ge,{...L,className:e});default:{const I=n.filterCssProps(x);return r.jsx(Ce,{ref:a,...L,...I,className:e})}}})()})})})});m.lazy(()=>Promise.resolve().then(()=>require("./detached-component-cc2b6165.js")));const ve=({className:e,guides:t,header:o,accordion:s,loading:i,route:l="guide",categoryTitle:d,...c})=>{const{name:a,params:{contactCategory:u=0,guide:g}}=n.useRouteData(),{name:f}=M(),P=n.useContainer(),j=te(),C=X(),x=m.useCallback((b,S,N,w)=>{const{id:y,title:$}=b;return s&&g===y?r.jsx(n.AccordionListItem,{id:y,title:$,route:a,collapseUri:d&&n.formatUrl(d),children:j.map(h=>r.jsx(V,{id:h.id,branch:"default",accordion:s},h.id))},y):w?w(b,S,N,w):null},[s,j,g]);return!t.length&&!i?_(P,{...c,className:n.appendClassNames(e,"humany-deflection-list")}):r.jsx(Se,{...c,"data-loading":i,className:n.appendClassNames(e,"humany-deflection-list"),items:t,header:o,expandable:!!s,renderItem:x,dispatch:C,routing:{guide:l},paramMappers:{guide:({id:b,title:S})=>n.createParams({contactCategory:u,guide:b,accordion:s?f:void 0,uriName:n.formatUrl(S)})},children:r.jsx(n.Loader,{loading:i})})},Se=p(n.GuideList)`
159
- ${n.contentBox}
160
- ${n.loadingOpacity}
161
- `,Ne=p(le)`
162
- ${n.loadingOpacity}
163
- ${n.contentBox}
164
- `,we=p(n.ItemList)`
165
- ${e=>n.loadingOpacity(e)}
166
- ${n.contentBox}
167
- ${F}
168
-
169
- && {
170
- i {
171
- font-size: 25px;
172
- width: 1.28571429em;
173
- text-align: center;
174
- }
175
- }
176
- `,Pe=p(n.Link)`
177
- &:focus-visible {
178
- ${n.borderTabStyle};
179
- }
180
-
181
- ${Y}
182
- `,Le=p.div`
183
- display: flex;
184
- flex-direction: column;
185
- gap: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}};
186
- `,Ee=p(n.StyledText)`
187
- font-weight: bold;
188
- `,Re=({className:e,...t})=>{const o=X(),s=n.useContainer(),i=n.useRouteData(),{deflectionHeader:l="",routes:d={},contactMethods:c=[],categories:a=[],guides:u=[],deflectionAccordion:g=!1,loading:f=!1}=B(),{contactCategory:P,guide:j="guide"}=d;if(!a.length&&!c.length&&!f)return _(s,{...t,className:n.appendClassNames(e,"humany-contact-category-list")});const{name:C,params:{contactCategory:x}}=i,b=W(x,a);return c.length?r.jsxs(r.Fragment,{children:[r.jsx(ve,{className:e,guides:u,categoryTitle:b&&b.title,header:l,route:j,accordion:g,loading:f}),r.jsx(Ne,{"data-loading":f,className:e,contactMethods:c,dispatch:o,children:r.jsx(n.Loader,{loading:f})})]}):r.jsx(we,{...t,"data-loading":f,className:n.appendClassNames(e,"humany-contact-category-list"),items:b&&b.items||a,renderItem:({id:S,title:N,symbol:w,matches:y,items:$,description:h})=>y||$&&$.length?r.jsx("li",{"data-contact-category":S,children:r.jsxs(Pe,{routeName:P||C,params:n.createParams({contactCategory:S,uriName:n.formatUrl(N)}),children:[w&&r.jsx(n.SymbolBadge,{symbol:w}),h!=null&&h.length?r.jsxs(Le,{children:[r.jsx(Ee,{children:N}),r.jsx(n.StyledText,{children:h})]}):r.jsx(n.StyledText,{children:N})]})},S):null,children:r.jsx(n.Loader,{loading:f})})},ke=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"}));exports.Component=V;exports.contactList=ke;