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