@telia-ace/knowledge-widget-components-notification-row 1.3.25-rc.2 → 1.3.25-rc.4

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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const f=require("@telia-ace/knowledge-data-client"),d=require("@telia-ace/knowledge-widget-core"),w=require("@telia-ace/knowledge-widget-ui"),p=s=>{const{events:h}=s.get("$widget"),[u,c]=d.createEventSubscriber(h);return w.createReactComponent(s,"notification-row",Promise.resolve().then(()=>require("./notification-row-71e572ae.js")),t=>{const a=e=>{t.writeProperties({...t.properties(),loading:!0,error:void 0,notifications:[]}),t.actions.dispatch("fetch",{params:e})};return t.actions.create("fetch",({error:e,topNotifications:i,bottomNotifications:o,middleNotifications:g})=>{if(e)return t.actions.dispatch("fetched",{error:e,loading:!0,notifications:[]});let r=[];const{notifications:l,types:n=[]}=t.properties();return n.length?(n.indexOf("top")>-1&&(r=r.concat(i)),n.indexOf("middle")>-1&&(r=r.concat(g)),n.indexOf("bottom")>-1&&(r=r.concat(o))):r=i,t.actions.dispatch("fetched",{notifications:r.length?r:l,loading:!1})}),t.actions.create("fetched",e=>t.writeProperties({...e,loading:!1})),s.getAsync("router").then(e=>{const{params:i}=e.getRouteData();a(i)}),u("router:changed",(e,{current:i})=>{a(i.routeData.params)}),()=>{c()}}).then(()=>d.extendComponent(s,"notification-row",t=>{t.actions.watch("notification-row.fetch",(a,e)=>f.DataClient.getInstance(s).then(i=>i.fetch(f.DataType.RowNotifications,{categories:[a.params.guideCategory,a.params.contactCategory].filter(o=>!!o),searchPhrase:a.params.phrase})).then(e).catch(i=>{if(i)return e(i)}))})).then(()=>{c()})};module.exports=p;
1
+ "use strict";const f=require("@telia-ace/knowledge-data-client"),d=require("@telia-ace/knowledge-widget-core"),w=require("@telia-ace/knowledge-widget-ui"),p=s=>{const{events:h}=s.get("$widget"),[u,c]=d.createEventSubscriber(h);return w.createReactComponent(s,"notification-row",Promise.resolve().then(()=>require("./notification-row-d5534c57.js")),t=>{const a=e=>{t.writeProperties({...t.properties(),loading:!0,error:void 0,notifications:[]}),t.actions.dispatch("fetch",{params:e})};return t.actions.create("fetch",({error:e,topNotifications:i,bottomNotifications:o,middleNotifications:g})=>{if(e)return t.actions.dispatch("fetched",{error:e,loading:!0,notifications:[]});let r=[];const{notifications:l,types:n=[]}=t.properties();return n.length?(n.indexOf("top")>-1&&(r=r.concat(i)),n.indexOf("middle")>-1&&(r=r.concat(g)),n.indexOf("bottom")>-1&&(r=r.concat(o))):r=i,t.actions.dispatch("fetched",{notifications:r.length?r:l,loading:!1})}),t.actions.create("fetched",e=>t.writeProperties({...e,loading:!1})),s.getAsync("router").then(e=>{const{params:i}=e.getRouteData();a(i)}),u("router:changed",(e,{current:i})=>{a(i.routeData.params)}),()=>{c()}}).then(()=>d.extendComponent(s,"notification-row",t=>{t.actions.watch("notification-row.fetch",(a,e)=>f.DataClient.getInstance(s).then(i=>i.fetch(f.DataType.RowNotifications,{categories:[a.params.guideCategory,a.params.contactCategory].filter(o=>!!o),searchPhrase:a.params.phrase})).then(e).catch(i=>{if(i)return e(i)}))})).then(()=>{c()})};module.exports=p;
package/index.mjs CHANGED
@@ -6,7 +6,7 @@ const v = (o) => {
6
6
  return m(
7
7
  o,
8
8
  "notification-row",
9
- import("./notification-row-c1d2412b.mjs"),
9
+ import("./notification-row-5d09c41e.mjs"),
10
10
  (e) => {
11
11
  const r = (t) => {
12
12
  e.writeProperties({
@@ -1,62 +1,62 @@
1
- import { jsxs as v, jsx as n } from "react/jsx-runtime";
1
+ import { jsxs as v, jsx as o } from "react/jsx-runtime";
2
2
  import { css as h } from "@emotion/react";
3
3
  import d from "@emotion/styled";
4
- import { useProperties as G, useContainer as M, createEmptyComponent as E, SymbolBadge as L, genericHtml as Y, linkTabStyle as _, borderTabStyle as N, Html as q, Button as J } from "@telia-ace/knowledge-widget-ui";
5
- import { readStorage as P, StorageMedium as O, createStorageWriter as Q, StorageCategory as U } from "@telia-ace/widget-services";
4
+ import { useProperties as G, useContainer as M, createEmptyComponent as P, SymbolBadge as N, genericHtml as Y, linkTabStyle as _, borderTabStyle as j, Html as q, Button as J } from "@telia-ace/knowledge-widget-ui";
5
+ import { readStorage as O, StorageMedium as A, createStorageWriter as Q, StorageCategory as U } from "@telia-ace/widget-services";
6
6
  import { appendClassNames as u } from "@telia-ace/widget-utilities";
7
- import { useState as x, useEffect as A } from "react";
7
+ import { useState as x, useEffect as B } from "react";
8
8
  const S = "closed-notifications", V = {
9
9
  transform: {
10
- a: ({ children: e, ...t }) => /* @__PURE__ */ n("a", { ...t, tabIndex: -1, children: e })
10
+ a: ({ children: e, ...t }) => /* @__PURE__ */ o("a", { ...t, tabIndex: -1, children: e })
11
11
  }
12
12
  }, re = ({ className: e, ...t }) => {
13
13
  const {
14
14
  types: l = [],
15
15
  allowPaging: f = !0,
16
- notifications: j = [],
16
+ notifications: R = [],
17
17
  expandable: c = !1,
18
- closeAriaLabel: R = "",
19
- pageNextAriaLabel: T = "",
20
- pagePreviousAriaLabel: W = "",
21
- expandAriaLabel: K = ""
22
- } = G(), [m, D] = x(!1), [b, z] = x([]), [i, y] = x(0), o = M(), [w, F] = x();
23
- A(() => {
24
- o && (P(o, S, O.Session).then(
25
- (a = []) => z(a)
18
+ closeAriaLabel: T = "",
19
+ pageNextAriaLabel: W = "",
20
+ pagePreviousAriaLabel: K = "",
21
+ expandAriaLabel: z = ""
22
+ } = G(), [m, D] = x(!1), [b, C] = x([]), [n, y] = x(0), i = M(), [w, F] = x();
23
+ B(() => {
24
+ i && (O(i, S, A.Session).then(
25
+ (a = []) => C(a)
26
26
  ), Q(
27
- o,
27
+ i,
28
28
  S,
29
29
  U.Functional
30
30
  ).then((a) => F(() => a)));
31
- }, [o]), A(() => {
32
- o && P(o, S, O.Session).then(
31
+ }, [i]), B(() => {
32
+ i && O(i, S, A.Session).then(
33
33
  (a = []) => {
34
34
  b.forEach(
35
35
  (r) => a.indexOf(r) === -1 && a.push(r)
36
36
  ), w && w(a);
37
37
  }
38
38
  );
39
- }, [b, o, w]);
40
- const s = j.filter(({ id: a }) => b.indexOf(a) === -1), { length: p } = s;
39
+ }, [b, i, w]);
40
+ const s = R.filter(({ id: a }) => b.indexOf(a) === -1), { length: p } = s;
41
41
  if (!s.length)
42
- return E(o, {
42
+ return P(i, {
43
43
  ...t,
44
44
  className: u(e, "humany-notification-row")
45
45
  });
46
46
  if (f) {
47
- const a = s[i] || s[i + 1] || s[i - 1];
47
+ const a = s[n] || s[n + 1] || s[n - 1];
48
48
  if (!a)
49
- return E(o, {
49
+ return P(i, {
50
50
  ...t,
51
51
  className: u(e, "humany-notification-row")
52
52
  });
53
- const { id: r, body: $ } = a || {}, C = () => D(!m);
53
+ const { id: r, body: $ } = a || {}, E = () => D(!m);
54
54
  return /* @__PURE__ */ v(
55
- B,
55
+ H,
56
56
  {
57
57
  ...t,
58
- "aria-expanded": c ? m : !0,
59
- "aria-label": K,
58
+ ...c ? { "aria-expanded": m, role: "button" } : {},
59
+ ...z ? { "aria-label": z } : {},
60
60
  tabIndex: c ? 0 : -1,
61
61
  className: u(e, "humany-notification-row"),
62
62
  "data-pageable": p > 1,
@@ -64,22 +64,22 @@ const S = "closed-notifications", V = {
64
64
  "data-allow-paging": f,
65
65
  "data-expandable": c,
66
66
  onKeyDown: (g) => {
67
- g.key === "Enter" && C();
67
+ g.key === "Enter" && E();
68
68
  },
69
- onClick: C,
69
+ onClick: E,
70
70
  children: [
71
- /* @__PURE__ */ n(
71
+ /* @__PURE__ */ o(
72
72
  Z,
73
73
  {
74
- "aria-label": R,
74
+ "aria-label": T,
75
75
  onClick: () => {
76
- y(s.indexOf(a)), z([...b, r]);
76
+ y(s.indexOf(a)), C([...b, r]);
77
77
  },
78
- children: /* @__PURE__ */ n(L, { symbol: { type: "Svg", content: "close" } })
78
+ children: /* @__PURE__ */ o(N, { symbol: { type: "Svg", content: "close" } })
79
79
  }
80
80
  ),
81
- /* @__PURE__ */ n(
82
- H,
81
+ /* @__PURE__ */ o(
82
+ I,
83
83
  {
84
84
  htmlParseInstruction: !c || m ? void 0 : V,
85
85
  "data-pageable": p > 1,
@@ -90,17 +90,17 @@ const S = "closed-notifications", V = {
90
90
  }
91
91
  ),
92
92
  p > 1 && /* @__PURE__ */ v(X, { children: [
93
- /* @__PURE__ */ n(
93
+ /* @__PURE__ */ o(
94
94
  k,
95
95
  {
96
96
  "data-testid": "page-left-button",
97
- "aria-label": W,
98
- "data-disabled": i === 0,
97
+ "aria-label": K,
98
+ "data-disabled": n === 0,
99
99
  onClick: (g) => {
100
- g.stopPropagation(), i > 0 && y(i - 1);
100
+ g.stopPropagation(), n > 0 && y(n - 1);
101
101
  },
102
- children: /* @__PURE__ */ n(
103
- I,
102
+ children: /* @__PURE__ */ o(
103
+ L,
104
104
  {
105
105
  size: 10,
106
106
  symbol: { type: "Svg", content: "caret-left" }
@@ -109,21 +109,21 @@ const S = "closed-notifications", V = {
109
109
  }
110
110
  ),
111
111
  /* @__PURE__ */ v("span", { children: [
112
- i + 1,
112
+ n + 1,
113
113
  "/",
114
114
  p
115
115
  ] }),
116
- /* @__PURE__ */ n(
116
+ /* @__PURE__ */ o(
117
117
  k,
118
118
  {
119
119
  "data-testid": "page-right-button",
120
- "aria-label": T,
121
- "data-disabled": i + 1 >= p,
120
+ "aria-label": W,
121
+ "data-disabled": n + 1 >= p,
122
122
  onClick: (g) => {
123
- g.stopPropagation(), i < p - 1 && y(i + 1);
123
+ g.stopPropagation(), n < p - 1 && y(n + 1);
124
124
  },
125
- children: /* @__PURE__ */ n(
126
- I,
125
+ children: /* @__PURE__ */ o(
126
+ L,
127
127
  {
128
128
  size: 10,
129
129
  symbol: { type: "Svg", content: "caret-right" }
@@ -136,8 +136,8 @@ const S = "closed-notifications", V = {
136
136
  }
137
137
  );
138
138
  }
139
- return /* @__PURE__ */ n(
140
- B,
139
+ return /* @__PURE__ */ o(
140
+ H,
141
141
  {
142
142
  ...t,
143
143
  className: u(e, "humany-notification-row"),
@@ -148,8 +148,8 @@ const S = "closed-notifications", V = {
148
148
  if (!a)
149
149
  return null;
150
150
  const { id: r, body: $ } = a;
151
- return /* @__PURE__ */ n(
152
- H,
151
+ return /* @__PURE__ */ o(
152
+ I,
153
153
  {
154
154
  "data-pageable": !1,
155
155
  "data-expandable": c,
@@ -162,7 +162,7 @@ const S = "closed-notifications", V = {
162
162
  })
163
163
  }
164
164
  );
165
- }, B = d.div`
165
+ }, H = d.div`
166
166
  ${Y}
167
167
  padding: ${(e) => {
168
168
  var t;
@@ -219,11 +219,11 @@ const S = "closed-notifications", V = {
219
219
  ${(e) => h`
220
220
  &:focus-visible {
221
221
  .humany-html {
222
- ${N(e)}
222
+ ${j(e)}
223
223
  }
224
224
  }
225
225
  `}
226
- `, H = d(q)`
226
+ `, I = d(q)`
227
227
  flex: 1;
228
228
  font-size: ${(e) => {
229
229
  var t;
@@ -273,7 +273,7 @@ const S = "closed-notifications", V = {
273
273
  }
274
274
 
275
275
  &:focus-visible {
276
- ${N}
276
+ ${j}
277
277
  }
278
278
 
279
279
  ${(e) => e["data-disabled"] ? h`
@@ -305,7 +305,7 @@ const S = "closed-notifications", V = {
305
305
  }};
306
306
  }
307
307
  }
308
- `, I = d(L)`
308
+ `, L = d(N)`
309
309
  line {
310
310
  stroke: #ffffff;
311
311
  }
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("@emotion/react"),c=require("@emotion/styled"),i=require("@telia-ace/knowledge-widget-ui"),m=require("@telia-ace/widget-services"),w=require("@telia-ace/widget-utilities"),g=require("react"),j="closed-notifications",L={transform:{a:({children:e,...t})=>n.jsx("a",{...t,tabIndex:-1,children:e})}},R=({className:e,...t})=>{const{types:l=[],allowPaging:u=!0,notifications:N=[],expandable:p=!1,closeAriaLabel:O="",pageNextAriaLabel:B="",pagePreviousAriaLabel:A="",expandAriaLabel:T=""}=i.useProperties(),[x,H]=g.useState(!1),[y,C]=g.useState([]),[o,S]=g.useState(0),s=i.useContainer(),[$,I]=g.useState();g.useEffect(()=>{s&&(m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>C(a)),m.createStorageWriter(s,j,m.StorageCategory.Functional).then(a=>I(()=>a)))},[s]),g.useEffect(()=>{s&&m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>{y.forEach(r=>a.indexOf(r)===-1&&a.push(r)),$&&$(a)})},[y,s,$]);const d=N.filter(({id:a})=>y.indexOf(a)===-1),{length:f}=d;if(!d.length)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});if(u){const a=d[o]||d[o+1]||d[o-1];if(!a)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});const{id:r,body:v}=a||{},z=()=>H(!x);return n.jsxs(E,{...t,"aria-expanded":p?x:!0,"aria-label":T,tabIndex:p?0:-1,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":f>1,"data-types":l,"data-allow-paging":u,"data-expandable":p,onKeyDown:h=>{h.key==="Enter"&&z()},onClick:z,children:[n.jsx(M,{"aria-label":O,onClick:()=>{S(d.indexOf(a)),C([...y,r])},children:n.jsx(i.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),n.jsx(P,{htmlParseInstruction:!p||x?void 0:L,"data-pageable":f>1,"data-notification":r,"data-expandable":p,"data-expanded":x,html:v}),f>1&&n.jsxs(W,{children:[n.jsx(k,{"data-testid":"page-left-button","aria-label":A,"data-disabled":o===0,onClick:h=>{h.stopPropagation(),o>0&&S(o-1)},children:n.jsx(q,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),n.jsxs("span",{children:[o+1,"/",f]}),n.jsx(k,{"data-testid":"page-right-button","aria-label":B,"data-disabled":o+1>=f,onClick:h=>{h.stopPropagation(),o<f-1&&S(o+1)},children:n.jsx(q,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return n.jsx(E,{...t,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":l,"data-allow-paging":!1,children:d.map(a=>{if(!a)return null;const{id:r,body:v}=a;return n.jsx(P,{"data-pageable":!1,"data-expandable":p,"data-expanded":x,"data-notification":r,html:v},r)})})},E=c.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),b=require("@emotion/react"),c=require("@emotion/styled"),i=require("@telia-ace/knowledge-widget-ui"),m=require("@telia-ace/widget-services"),w=require("@telia-ace/widget-utilities"),g=require("react"),j="closed-notifications",L={transform:{a:({children:e,...t})=>n.jsx("a",{...t,tabIndex:-1,children:e})}},R=({className:e,...t})=>{const{types:l=[],allowPaging:u=!0,notifications:O=[],expandable:p=!1,closeAriaLabel:B="",pageNextAriaLabel:A="",pagePreviousAriaLabel:T="",expandAriaLabel:C=""}=i.useProperties(),[x,H]=g.useState(!1),[y,z]=g.useState([]),[o,S]=g.useState(0),s=i.useContainer(),[$,I]=g.useState();g.useEffect(()=>{s&&(m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>z(a)),m.createStorageWriter(s,j,m.StorageCategory.Functional).then(a=>I(()=>a)))},[s]),g.useEffect(()=>{s&&m.readStorage(s,j,m.StorageMedium.Session).then((a=[])=>{y.forEach(r=>a.indexOf(r)===-1&&a.push(r)),$&&$(a)})},[y,s,$]);const d=O.filter(({id:a})=>y.indexOf(a)===-1),{length:f}=d;if(!d.length)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});if(u){const a=d[o]||d[o+1]||d[o-1];if(!a)return i.createEmptyComponent(s,{...t,className:w.appendClassNames(e,"humany-notification-row")});const{id:r,body:v}=a||{},E=()=>H(!x);return n.jsxs(P,{...t,...p?{"aria-expanded":x,role:"button"}:{},...C?{"aria-label":C}:{},tabIndex:p?0:-1,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":f>1,"data-types":l,"data-allow-paging":u,"data-expandable":p,onKeyDown:h=>{h.key==="Enter"&&E()},onClick:E,children:[n.jsx(M,{"aria-label":B,onClick:()=>{S(d.indexOf(a)),z([...y,r])},children:n.jsx(i.SymbolBadge,{symbol:{type:"Svg",content:"close"}})}),n.jsx(q,{htmlParseInstruction:!p||x?void 0:L,"data-pageable":f>1,"data-notification":r,"data-expandable":p,"data-expanded":x,html:v}),f>1&&n.jsxs(W,{children:[n.jsx(k,{"data-testid":"page-left-button","aria-label":T,"data-disabled":o===0,onClick:h=>{h.stopPropagation(),o>0&&S(o-1)},children:n.jsx(N,{size:10,symbol:{type:"Svg",content:"caret-left"}})}),n.jsxs("span",{children:[o+1,"/",f]}),n.jsx(k,{"data-testid":"page-right-button","aria-label":A,"data-disabled":o+1>=f,onClick:h=>{h.stopPropagation(),o<f-1&&S(o+1)},children:n.jsx(N,{size:10,symbol:{type:"Svg",content:"caret-right"}})})]})]})}return n.jsx(P,{...t,className:w.appendClassNames(e,"humany-notification-row"),"data-pageable":!1,"data-types":l,"data-allow-paging":!1,children:d.map(a=>{if(!a)return null;const{id:r,body:v}=a;return n.jsx(q,{"data-pageable":!1,"data-expandable":p,"data-expanded":x,"data-notification":r,html:v},r)})})},P=c.div`
2
2
  ${i.genericHtml}
3
3
  padding: ${e=>{var t;return(t=e.theme.sizes)==null?void 0:t.normal}} ${e=>{var t;return((t=e.theme.sizes)==null?void 0:t.cardinal)*12}}px;
4
4
  background-color: ${e=>{var t,l,u;return e["data-types"].length?e["data-types"].indexOf("top")>-1?(t=e.theme.colors)==null?void 0:t.warning:e["data-types"].indexOf("bottom")>-1?"transparent":(l=e.theme.colors)==null?void 0:l.primary:(u=e.theme.colors)==null?void 0:u.warning}};
@@ -38,7 +38,7 @@
38
38
  }
39
39
  }
40
40
  `}
41
- `,P=c(i.Html)`
41
+ `,q=c(i.Html)`
42
42
  flex: 1;
43
43
  font-size: ${e=>{var t;return(t=e.theme.fonts)==null?void 0:t.normal}};
44
44
  line-height: 1.6em;
@@ -105,7 +105,7 @@
105
105
  stroke: ${e=>{var t;return(t=e.theme.colors)==null?void 0:t.text}};
106
106
  }
107
107
  }
108
- `,q=c(i.SymbolBadge)`
108
+ `,N=c(i.SymbolBadge)`
109
109
  line {
110
110
  stroke: #ffffff;
111
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-notification-row",
3
- "version": "1.3.25-rc.2",
3
+ "version": "1.3.25-rc.4",
4
4
  "main": "./index.js",
5
5
  "types": "./index.d.ts",
6
6
  "exports": {
@@ -10,11 +10,11 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@telia-ace/knowledge-widget-core": "^1.3.25-rc.2",
14
- "@telia-ace/knowledge-widget-ui": "^1.3.25-rc.2",
15
- "@telia-ace/widget-services": "^1.3.25-rc.2",
16
- "@telia-ace/widget-utilities": "^1.3.25-rc.2",
17
- "@telia-ace/knowledge-data-client": "^1.3.25-rc.2",
13
+ "@telia-ace/knowledge-widget-core": "^1.3.25-rc.4",
14
+ "@telia-ace/knowledge-widget-ui": "^1.3.25-rc.4",
15
+ "@telia-ace/widget-services": "^1.3.25-rc.4",
16
+ "@telia-ace/widget-utilities": "^1.3.25-rc.4",
17
+ "@telia-ace/knowledge-data-client": "^1.3.25-rc.4",
18
18
  "@webprovisions/platform": "^1.1.4"
19
19
  },
20
20
  "peerDependencies": {