@telia-ace/knowledge-widget-components-contact-list 1.3.0-rc.8 → 1.3.0
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-list-component.d.ts +1 -0
- package/index.js +1 -1
- package/index.mjs +41 -36
- package/package.json +9 -9
|
@@ -4,6 +4,7 @@ import { FormComponentInstanceProperties } from '@telia-ace/widget-forms';
|
|
|
4
4
|
import { Container } from '@webprovisions/platform';
|
|
5
5
|
export type ContactListComponentProps = {
|
|
6
6
|
deflectionHeader?: string;
|
|
7
|
+
deflectionHeaderTag?: string;
|
|
7
8
|
deflection?: {
|
|
8
9
|
[contactCategoryId: string]: string[];
|
|
9
10
|
};
|
package/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const h=require("@telia-ace/knowledge-data-client"),n=require("@telia-ace/knowledge-widget-component-utilities"),y=require("@telia-ace/knowledge-widget-core"),v=require("@telia-ace/knowledge-widget-ui"),M=s=>{const{events:m}=s.get("$widget"),[P,k]=y.createEventSubscriber(m);return v.createReactComponent(s,"contact-list",Promise.resolve().then(()=>require("./contact-list-05301ab8.js")),e=>{const o=t=>{e.writeProperties({loading:!0,contactMethods:[],categories:[]}),e.actions.dispatch("fetch",{params:t})};e.actions.create("fetch",t=>{const{submitButtonLabel:r="Submit",deflectionHeaderTag:a=void 0}=e.properties();window.humany.deflectionHeaderTag=a;const d=(t.contactMethods||[]).map(c=>({...c,body:n.updateForm(c,{submit:r})}));return e.actions.dispatch("fetched",{...t,contactMethods:d,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();o(r)}),P("router:changed",(t,{current:r})=>{o(r.routeData.params)}),n.useForm(s,e),n.useExpand(e)}).then(()=>y.extendComponent(s,"contact-list",e=>{e.actions.watch("contact-list.fetch",(o,t)=>{const{deflection:r={},deflectionPageSize:a=5,deflectionAccordion:d}=e.properties(),{params:c={}}=o,{contactCategory:u,guide:l,accordion:D}=c;return h.DataClient.getInstance(s).then(g=>g.fetch(h.DataType.ContactMethodCategories,{contactMethodCategoryId:u}).then(({contactMethods:f,categories:b})=>{var p;const w=Object.keys(r),C=w.length===1&&!u?w[0]:u;return(p=r[C])!=null&&p.length?g.fetch(h.DataType.Guides,{categories:r[C],take:a}).then(i=>d&&l&&D===e.node.name?n.fetchAccordionGuideIfMissing(i,g,{guide:l}):new Promise(q=>q(i))).then(({guides:i})=>t({guides:i,contactMethods:f,categories:b})):t({contactMethods:f,categories:b})}))})})).then(()=>{k()})};module.exports=M;
|
package/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DataClient as
|
|
2
|
-
import { updateForm as
|
|
3
|
-
import { createEventSubscriber as
|
|
4
|
-
import { createReactComponent as
|
|
5
|
-
const
|
|
6
|
-
const { events:
|
|
7
|
-
return
|
|
8
|
-
|
|
1
|
+
import { DataClient as v, DataType as b } from "@telia-ace/knowledge-data-client";
|
|
2
|
+
import { updateForm as D, useForm as A, useExpand as I, fetchAccordionGuideIfMissing as S } from "@telia-ace/knowledge-widget-component-utilities";
|
|
3
|
+
import { createEventSubscriber as T, extendComponent as k } from "@telia-ace/knowledge-widget-core";
|
|
4
|
+
import { createReactComponent as x } from "@telia-ace/knowledge-widget-ui";
|
|
5
|
+
const L = (o) => {
|
|
6
|
+
const { events: y } = o.get("$widget"), [C, w] = T(y);
|
|
7
|
+
return x(
|
|
8
|
+
o,
|
|
9
9
|
"contact-list",
|
|
10
10
|
import("./contact-list-300090b9.mjs"),
|
|
11
11
|
(t) => {
|
|
@@ -17,62 +17,67 @@ const j = (s) => {
|
|
|
17
17
|
}), t.actions.dispatch("fetch", { params: e });
|
|
18
18
|
};
|
|
19
19
|
t.actions.create("fetch", (e) => {
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const {
|
|
21
|
+
submitButtonLabel: r = "Submit",
|
|
22
|
+
deflectionHeaderTag: i = void 0
|
|
23
|
+
} = t.properties();
|
|
24
|
+
window.humany.deflectionHeaderTag = i;
|
|
25
|
+
const n = (e.contactMethods || []).map(
|
|
26
|
+
(s) => ({
|
|
27
|
+
...s,
|
|
28
|
+
body: D(s, { submit: r })
|
|
24
29
|
})
|
|
25
30
|
);
|
|
26
31
|
return t.actions.dispatch("fetched", {
|
|
27
32
|
...e,
|
|
28
|
-
contactMethods:
|
|
33
|
+
contactMethods: n,
|
|
29
34
|
loading: !0
|
|
30
35
|
});
|
|
31
36
|
}), t.actions.create("fetched", (e) => t.writeProperties({
|
|
32
37
|
...e,
|
|
33
38
|
guides: e.guides || [],
|
|
34
39
|
loading: !1
|
|
35
|
-
})),
|
|
40
|
+
})), o.getAsync("router").then((e) => {
|
|
36
41
|
const { params: r } = e.getRouteData();
|
|
37
42
|
c(r);
|
|
38
|
-
}),
|
|
43
|
+
}), C("router:changed", (e, { current: r }) => {
|
|
39
44
|
c(r.routeData.params);
|
|
40
|
-
}), A(
|
|
45
|
+
}), A(o, t), I(t);
|
|
41
46
|
}
|
|
42
|
-
).then(() =>
|
|
47
|
+
).then(() => k(o, "contact-list", (t) => {
|
|
43
48
|
t.actions.watch("contact-list.fetch", (c, e) => {
|
|
44
49
|
const {
|
|
45
50
|
deflection: r = {},
|
|
46
51
|
deflectionPageSize: i = 5,
|
|
47
|
-
deflectionAccordion:
|
|
48
|
-
} = t.properties(), { params:
|
|
49
|
-
contactCategory:
|
|
50
|
-
guide:
|
|
51
|
-
accordion:
|
|
52
|
-
} =
|
|
53
|
-
return
|
|
54
|
-
(u) => u.fetch(
|
|
55
|
-
contactMethodCategoryId:
|
|
56
|
-
}).then(({ contactMethods:
|
|
57
|
-
var
|
|
58
|
-
const
|
|
59
|
-
return (
|
|
60
|
-
categories: r[
|
|
52
|
+
deflectionAccordion: n
|
|
53
|
+
} = t.properties(), { params: s = {} } = c, {
|
|
54
|
+
contactCategory: d,
|
|
55
|
+
guide: h,
|
|
56
|
+
accordion: P
|
|
57
|
+
} = s;
|
|
58
|
+
return v.getInstance(o).then(
|
|
59
|
+
(u) => u.fetch(b.ContactMethodCategories, {
|
|
60
|
+
contactMethodCategoryId: d
|
|
61
|
+
}).then(({ contactMethods: g, categories: f }) => {
|
|
62
|
+
var p;
|
|
63
|
+
const l = Object.keys(r), m = l.length === 1 && !d ? l[0] : d;
|
|
64
|
+
return (p = r[m]) != null && p.length ? u.fetch(b.Guides, {
|
|
65
|
+
categories: r[m],
|
|
61
66
|
take: i
|
|
62
|
-
}).then((a) =>
|
|
67
|
+
}).then((a) => n && h && P === t.node.name ? S(
|
|
63
68
|
a,
|
|
64
69
|
u,
|
|
65
|
-
{ guide:
|
|
70
|
+
{ guide: h }
|
|
66
71
|
) : new Promise(
|
|
67
72
|
(M) => M(a)
|
|
68
|
-
)).then(({ guides: a }) => e({ guides: a, contactMethods:
|
|
73
|
+
)).then(({ guides: a }) => e({ guides: a, contactMethods: g, categories: f })) : e({ contactMethods: g, categories: f });
|
|
69
74
|
})
|
|
70
75
|
);
|
|
71
76
|
});
|
|
72
77
|
})).then(() => {
|
|
73
|
-
|
|
78
|
+
w();
|
|
74
79
|
});
|
|
75
80
|
};
|
|
76
81
|
export {
|
|
77
|
-
|
|
82
|
+
L as default
|
|
78
83
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-contact-list",
|
|
3
|
-
"version": "1.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
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.3.0
|
|
14
|
-
"@telia-ace/knowledge-widget-component-utilities": "^1.3.0
|
|
15
|
-
"@telia-ace/knowledge-widget-core": "^1.3.0
|
|
16
|
-
"@telia-ace/knowledge-widget-ui": "^1.3.0
|
|
17
|
-
"@telia-ace/widget-forms": "^1.3.0
|
|
18
|
-
"@telia-ace/widget-utilities": "^1.3.0
|
|
19
|
-
"@telia-ace/widget-types-grid": "^1.3.0
|
|
20
|
-
"@telia-ace/knowledge-data-client": "^1.3.0
|
|
13
|
+
"@telia-ace/knowledge-widget-adapters": "^1.3.0",
|
|
14
|
+
"@telia-ace/knowledge-widget-component-utilities": "^1.3.0",
|
|
15
|
+
"@telia-ace/knowledge-widget-core": "^1.3.0",
|
|
16
|
+
"@telia-ace/knowledge-widget-ui": "^1.3.0",
|
|
17
|
+
"@telia-ace/widget-forms": "^1.3.0",
|
|
18
|
+
"@telia-ace/widget-utilities": "^1.3.0",
|
|
19
|
+
"@telia-ace/widget-types-grid": "^1.3.0",
|
|
20
|
+
"@telia-ace/knowledge-data-client": "^1.3.0",
|
|
21
21
|
"@webprovisions/platform": "^1.1.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|