@telia-ace/knowledge-widget-components-notification-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.
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";const e=require("./index-1cbc11d0.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.NotificationListComponent;
1
+ "use strict";const o=require("@telia-ace/knowledge-data-client"),c=require("@telia-ace/knowledge-widget-core"),l=require("@telia-ace/knowledge-widget-ui"),p=s=>{const{events:n}=s.get("$widget"),[d,h]=c.createEventSubscriber(n);return l.createReactComponent(s,"notification-list",Promise.resolve().then(()=>require("./notification-list-fc783b8b.js")),e=>{const r=t=>{e.writeProperties({...e.properties(),loading:!0,error:void 0,notificationList:void 0}),e.actions.dispatch("fetch",{params:t})};e.actions.create("fetch",({error:t,notificationLists:i})=>{if(t)return e.actions.dispatch("fetched",{error:t,loading:!0,notificationList:void 0});const{category:a,notificationList:f}=e.properties(),u={notificationList:i.find(g=>g.id===a)||f};return e.actions.dispatch("fetched",{...u,loading:!0})}),e.actions.create("fetched",t=>e.writeProperties({...t,loading:!1})),s.getAsync("router").then(t=>{const{params:i}=t.getRouteData();r(i)}),d("router:changed",(t,{current:i})=>{r(i.routeData.params)})}).then(()=>c.extendComponent(s,"notification-list",e=>{e.actions.watch("notification-list.fetch",(r,t)=>o.DataClient.getInstance(s).then(i=>i.fetch(o.DataType.NotificationLists,{categories:[r.params.guideCategory,r.params.contactCategory].filter(a=>!!a),searchPhrase:r.params.phrase})).then(t).catch(i=>{if(i)return t(i)}))})).then(()=>{h()})};module.exports=p;
package/index.mjs CHANGED
@@ -1,11 +1,59 @@
1
- import { b } from "./index-e76b28a2.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 u, DataType as p } from "@telia-ace/knowledge-data-client";
2
+ import { createEventSubscriber as g, extendComponent as l } from "@telia-ace/knowledge-widget-core";
3
+ import { createReactComponent as m } from "@telia-ace/knowledge-widget-ui";
4
+ const L = (r) => {
5
+ const { events: o } = r.get("$widget"), [c, n] = g(o);
6
+ return m(
7
+ r,
8
+ "notification-list",
9
+ import("./notification-list-1ff058e6.mjs"),
10
+ (e) => {
11
+ const a = (t) => {
12
+ e.writeProperties({
13
+ ...e.properties(),
14
+ loading: !0,
15
+ error: void 0,
16
+ notificationList: void 0
17
+ }), e.actions.dispatch("fetch", { params: t });
18
+ };
19
+ e.actions.create("fetch", ({ error: t, notificationLists: i }) => {
20
+ if (t)
21
+ return e.actions.dispatch("fetched", {
22
+ error: t,
23
+ loading: !0,
24
+ notificationList: void 0
25
+ });
26
+ const { category: s, notificationList: f } = e.properties(), h = {
27
+ notificationList: i.find((d) => d.id === s) || f
28
+ };
29
+ return e.actions.dispatch("fetched", {
30
+ ...h,
31
+ loading: !0
32
+ });
33
+ }), e.actions.create("fetched", (t) => e.writeProperties({ ...t, loading: !1 })), r.getAsync("router").then((t) => {
34
+ const { params: i } = t.getRouteData();
35
+ a(i);
36
+ }), c("router:changed", (t, { current: i }) => {
37
+ a(i.routeData.params);
38
+ });
39
+ }
40
+ ).then(() => l(r, "notification-list", (e) => {
41
+ e.actions.watch("notification-list.fetch", (a, t) => u.getInstance(r).then(
42
+ (i) => i.fetch(p.NotificationLists, {
43
+ categories: [
44
+ a.params.guideCategory,
45
+ a.params.contactCategory
46
+ ].filter((s) => !!s),
47
+ searchPhrase: a.params.phrase
48
+ })
49
+ ).then(t).catch((i) => {
50
+ if (i)
51
+ return t(i);
52
+ }));
53
+ })).then(() => {
54
+ n();
55
+ });
56
+ };
9
57
  export {
10
- b as default
58
+ L as default
11
59
  };
@@ -0,0 +1,29 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import r from "@emotion/styled";
3
+ import { useContainer as c, useProperties as f, createEmptyComponent as m, NotificationList as p, contentBox as l } from "@telia-ace/knowledge-widget-ui";
4
+ import { appendClassNames as d } from "@telia-ace/widget-utilities";
5
+ const L = ({ className: t, ...i }) => {
6
+ const e = c(), {
7
+ showHeader: s,
8
+ notificationList: o,
9
+ loading: n = !1
10
+ } = f();
11
+ return !(o != null && o.notifications.length) && !n ? m(e, {
12
+ ...i,
13
+ className: d(t, "humany-notification-list")
14
+ }) : /* @__PURE__ */ a(
15
+ u,
16
+ {
17
+ ...i,
18
+ className: t,
19
+ notificationList: o,
20
+ loading: n,
21
+ showHeader: s
22
+ }
23
+ );
24
+ }, u = r(p)`
25
+ ${(t) => l(t)}
26
+ `;
27
+ export {
28
+ L as default
29
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),c=require("@emotion/styled"),t=require("@telia-ace/knowledge-widget-ui"),u=require("@telia-ace/widget-utilities"),l=({className:e,...n})=>{const s=t.useContainer(),{showHeader:r,notificationList:i,loading:o=!1}=t.useProperties();return!(i!=null&&i.notifications.length)&&!o?t.createEmptyComponent(s,{...n,className:u.appendClassNames(e,"humany-notification-list")}):a.jsx(d,{...n,className:e,notificationList:i,loading:o,showHeader:r})},d=c(t.NotificationList)`
2
+ ${e=>t.contentBox(e)}
3
+ `;exports.default=l;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-components-notification-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,10 +10,10 @@
10
10
  }
11
11
  },
12
12
  "dependencies": {
13
- "@telia-ace/knowledge-widget-core": "^1.1.1-rc.2",
14
- "@telia-ace/knowledge-widget-ui": "^1.1.1-rc.2",
15
- "@telia-ace/widget-utilities": "^1.1.1-rc.2",
16
- "@telia-ace/knowledge-data-client": "^1.1.1-rc.2",
13
+ "@telia-ace/knowledge-widget-core": "^1.1.1-rc.3",
14
+ "@telia-ace/knowledge-widget-ui": "^1.1.1-rc.3",
15
+ "@telia-ace/widget-utilities": "^1.1.1-rc.3",
16
+ "@telia-ace/knowledge-data-client": "^1.1.1-rc.3",
17
17
  "@webprovisions/platform": "^1.1.4"
18
18
  },
19
19
  "peerDependencies": {