@telia-ace/knowledge-widget-components-contact-list 1.2.8 → 1.2.9

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.
@@ -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 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;
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 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,
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 { submitButtonLabel: r = "Submit" } = t.properties(), i = (e.contactMethods || []).map(
21
- (o) => ({
22
- ...o,
23
- body: v(o, { submit: r })
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: i,
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
- })), s.getAsync("router").then((e) => {
40
+ })), o.getAsync("router").then((e) => {
36
41
  const { params: r } = e.getRouteData();
37
42
  c(r);
38
- }), y("router:changed", (e, { current: r }) => {
43
+ }), C("router:changed", (e, { current: r }) => {
39
44
  c(r.routeData.params);
40
- }), A(s, t), I(t);
45
+ }), A(o, t), I(t);
41
46
  }
42
- ).then(() => x(s, "contact-list", (t) => {
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: 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],
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) => o && d && w === t.node.name ? S(
67
+ }).then((a) => n && h && P === t.node.name ? S(
63
68
  a,
64
69
  u,
65
- { guide: d }
70
+ { guide: h }
66
71
  ) : new Promise(
67
72
  (M) => M(a)
68
- )).then(({ guides: a }) => e({ guides: a, contactMethods: h, categories: g })) : e({ contactMethods: h, categories: g });
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
- C();
78
+ w();
74
79
  });
75
80
  };
76
81
  export {
77
- j as default
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.2.8",
3
+ "version": "1.2.9",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {