@telia-ace/knowledge-widget-components-notification-list 0.0.1
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.d.ts +3 -0
- package/index.js +1 -0
- package/index.mjs +62 -0
- package/notification-list-43e7cd19.mjs +29 -0
- package/notification-list-component.d.ts +10 -0
- package/notification-list-e52d1994.js +3 -0
- package/notification-list.d.ts +7 -0
- package/package.json +24 -0
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
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-e52d1994.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
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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-43e7cd19.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(
|
|
20
|
+
"fetch",
|
|
21
|
+
({ error: t, notificationLists: i }) => {
|
|
22
|
+
if (t)
|
|
23
|
+
return e.actions.dispatch("fetched", {
|
|
24
|
+
error: t,
|
|
25
|
+
loading: !0,
|
|
26
|
+
notificationList: void 0
|
|
27
|
+
});
|
|
28
|
+
const { category: s, notificationList: f } = e.properties(), h = {
|
|
29
|
+
notificationList: i.find((d) => d.id === s) || f
|
|
30
|
+
};
|
|
31
|
+
return e.actions.dispatch("fetched", {
|
|
32
|
+
...h,
|
|
33
|
+
loading: !0
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
), e.actions.create("fetched", (t) => e.writeProperties({ ...t, loading: !1 })), r.getAsync("router").then((t) => {
|
|
37
|
+
const { params: i } = t.getRouteData();
|
|
38
|
+
a(i);
|
|
39
|
+
}), c("router:changed", (t, { current: i }) => {
|
|
40
|
+
a(i.routeData.params);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
).then(() => l(r, "notification-list", (e) => {
|
|
44
|
+
e.actions.watch("notification-list.fetch", (a, t) => u.getInstance(r).then(
|
|
45
|
+
(i) => i.fetch(p.NotificationLists, {
|
|
46
|
+
categories: [
|
|
47
|
+
a.params.guideCategory,
|
|
48
|
+
a.params.contactCategory
|
|
49
|
+
].filter((s) => !!s),
|
|
50
|
+
searchPhrase: a.params.phrase
|
|
51
|
+
})
|
|
52
|
+
).then(t).catch((i) => {
|
|
53
|
+
if (i)
|
|
54
|
+
return t(i);
|
|
55
|
+
}));
|
|
56
|
+
})).then(() => {
|
|
57
|
+
n();
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
L as default
|
|
62
|
+
};
|
|
@@ -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,10 @@
|
|
|
1
|
+
import { NotificationList } from '../../../knowledge/core/src/index.ts';
|
|
2
|
+
import { Container } from '@webprovisions/platform';
|
|
3
|
+
|
|
4
|
+
export type NotificationListComponentProps = {
|
|
5
|
+
category?: string;
|
|
6
|
+
showHeader?: boolean;
|
|
7
|
+
notificationList?: NotificationList;
|
|
8
|
+
};
|
|
9
|
+
export declare const NotificationListComponent: (container: Container) => Promise<void>;
|
|
10
|
+
export default NotificationListComponent;
|
|
@@ -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
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telia-ace/knowledge-widget-components-notification-list",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./index.js",
|
|
5
|
+
"types": "./index.d.ts",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"import": "./index.mjs",
|
|
9
|
+
"require": "./index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@telia-ace/knowledge-widget-core": "*",
|
|
14
|
+
"@telia-ace/knowledge-widget-ui": "*",
|
|
15
|
+
"@telia-ace/widget-utilities": "*",
|
|
16
|
+
"@telia-ace/knowledge-data-client": "*",
|
|
17
|
+
"@webprovisions/platform": "^1.1.4"
|
|
18
|
+
},
|
|
19
|
+
"peerDependencies": {
|
|
20
|
+
"@emotion/react": "11.11.1",
|
|
21
|
+
"@emotion/styled": "11.11.0",
|
|
22
|
+
"react": "18.2.0"
|
|
23
|
+
}
|
|
24
|
+
}
|