@telia-ace/knowledge-widget-components-related-guide-list 1.0.38-experimental.8 → 1.0.38
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/dist/index.d.ts +2 -1
- package/dist/index.js +47 -2
- package/dist/index.js.map +1 -1
- package/dist/related-guide-list-component.d.ts +10 -1
- package/dist/related-guide-list.7ecfd11f.js +86 -0
- package/dist/related-guide-list.7ecfd11f.js.map +1 -0
- package/dist/related-guide-list.d.ts +6 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import RelatedGuideListComponent from './related-guide-list-component';
|
|
2
|
+
export default RelatedGuideListComponent;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
var g = Object.defineProperty, l = Object.defineProperties;
|
|
2
|
+
var f = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var n = Object.getOwnPropertySymbols;
|
|
4
|
+
var p = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var h = (r, e, t) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, o = (r, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
p.call(e, t) && h(r, t, e[t]);
|
|
8
|
+
if (n)
|
|
9
|
+
for (var t of n(e))
|
|
10
|
+
m.call(e, t) && h(r, t, e[t]);
|
|
11
|
+
return r;
|
|
12
|
+
}, u = (r, e) => l(r, f(e));
|
|
13
|
+
import { createEventSubscriber as b, extendComponent as C } from "@telia-ace/knowledge-widget-core";
|
|
14
|
+
import { DataType as w } from "@telia-ace/knowledge-widget-types-grid";
|
|
15
|
+
import { createReactComponent as R } from "@telia-ace/knowledge-widget-ui";
|
|
16
|
+
const v = (r) => R(
|
|
17
|
+
r,
|
|
18
|
+
"related-guide-list",
|
|
19
|
+
import("./related-guide-list.7ecfd11f.js"),
|
|
20
|
+
(e) => {
|
|
21
|
+
const { events: t } = r.get("$widget"), [i, c] = b(t), d = (a) => {
|
|
22
|
+
e.writeProperties({ loading: !0, error: void 0 }), e.actions.dispatch("fetch", { params: a });
|
|
23
|
+
};
|
|
24
|
+
return e.actions.create("fetch", ({ items: a = [] }) => e.actions.dispatch("fetched", {
|
|
25
|
+
items: a,
|
|
26
|
+
loading: !0
|
|
27
|
+
})), e.actions.create("fetched", (a) => e.writeProperties(u(o({}, a), { loading: !1 }))), r.getAsync("router").then((a) => {
|
|
28
|
+
const { params: s } = a.getRouteData();
|
|
29
|
+
d(s);
|
|
30
|
+
}), i("router:changed", (a, { current: s }) => {
|
|
31
|
+
d(s.routeData.params);
|
|
32
|
+
}), () => {
|
|
33
|
+
c();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
).then(() => C(r, "related-guide-list", (e) => {
|
|
37
|
+
e.actions.watch("related-guide-list.fetch", (t, i) => {
|
|
38
|
+
const {
|
|
39
|
+
params: { guide: c, connection: d }
|
|
40
|
+
} = t;
|
|
41
|
+
return c ? (e.properties(), r.getAsync("dataClient").then((a) => a.fetch(w.Guide, {
|
|
42
|
+
connection: d,
|
|
43
|
+
guideId: c
|
|
44
|
+
}).then(({ related: s }) => i(u(o({}, t), { items: s || [] }))).catch((s) => i(t)))) : i(t);
|
|
45
|
+
});
|
|
46
|
+
})), L = v;
|
|
2
47
|
export {
|
|
3
|
-
|
|
48
|
+
L as default
|
|
4
49
|
};
|
|
5
50
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/related-guide-list-component.ts"],"sourcesContent":["import {\n FavoriteProperties,\n MetaDataProperties,\n} from '@telia-ace/knowledge-widget-component-utilities';\nimport { createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\nimport { Container } from '@webprovisions/platform';\n\nexport type RelatedGuideListComponentProps = {\n header: string;\n items?: any[]; // internal\n showFavoriteToggle?: boolean;\n tags?: boolean;\n} & FavoriteProperties &\n MetaDataProperties;\n\nconst RelatedGuideListComponent = (container: Container) => {\n return createReactComponent(\n container,\n 'related-guide-list',\n import('./related-guide-list'),\n (component) => {\n const { events } = container.get('$widget');\n const [subscribe, unsubscribe] = createEventSubscriber(events);\n\n const fetch = (params: { [key: string]: string }) => {\n component.writeProperties({ loading: true, error: undefined });\n component.actions.dispatch('fetch', { params });\n };\n\n component.actions.create('fetch', ({ items = [] }) => {\n return component.actions.dispatch('fetched', {\n items,\n loading: true,\n });\n });\n\n component.actions.create('fetched', (input) => {\n return component.writeProperties({ ...input, loading: false });\n });\n\n container.getAsync('router').then((router) => {\n const { params } = router.getRouteData();\n fetch(params);\n });\n subscribe('router:changed', (_, { current }) => {\n fetch(current.routeData.params);\n });\n return () => {\n unsubscribe();\n };\n }\n ).then(() => {\n return extendComponent(container, 'related-guide-list', (component) => {\n component.actions.watch('related-guide-list.fetch', (input, next) => {\n const {\n params: { guide, connection },\n } = input;\n if (!guide) {\n return next(input);\n }\n const { header } = component.properties() as RelatedGuideListComponentProps;\n\n return container.getAsync('dataClient').then((dataClient: DataClient) => {\n return dataClient\n .fetch(DataType.Guide, {\n connection,\n guideId: guide,\n })\n .then(({ related }) => {\n return next({ ...input, items: related || [] });\n })\n .catch((e: any) => {\n return next(input);\n });\n });\n });\n });\n });\n};\n\nexport default RelatedGuideListComponent;\n"],"names":["RelatedGuideListComponent","container","createReactComponent","component","events","subscribe","unsubscribe","createEventSubscriber","fetch","params","items","input","__spreadProps","__spreadValues","router","_","current","extendComponent","next","guide","connection","dataClient","DataType","related","e","RelatedGuideListComponent$1"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAMA,IAA4B,CAACC,MACxBC;AA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AF;AAAA,MACA,SAASD;AAAA,IACZ,CAAA,EACA,KAAK,CAAC,EAAE,SAAAI,QACEL,EAAKN,EAAAC,EAAA,IAAKF,IAAL,EAAY,OAAOY,KAAW,KAAI,CACjD,EACA,MAAM,CAACC,MACGN,EAAKP,CAAK,CACpB,CACR,KAhBUO,EAAKP,CAAK;AAAA,EAgBpB,CACJ;AAAA,CACJ,CACJ,GAGLc,IAAezB;"}
|
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { FavoriteProperties, MetaDataProperties } from '@telia-ace/knowledge-widget-component-utilities';
|
|
2
|
+
import { Container } from '@webprovisions/platform';
|
|
3
|
+
export type RelatedGuideListComponentProps = {
|
|
4
|
+
header: string;
|
|
5
|
+
items?: any[];
|
|
6
|
+
showFavoriteToggle?: boolean;
|
|
7
|
+
tags?: boolean;
|
|
8
|
+
} & FavoriteProperties & MetaDataProperties;
|
|
9
|
+
declare const RelatedGuideListComponent: (container: Container) => Promise<void>;
|
|
10
|
+
export default RelatedGuideListComponent;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
var E = Object.defineProperty, M = Object.defineProperties;
|
|
2
|
+
var D = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var m = Object.getOwnPropertySymbols;
|
|
4
|
+
var l = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var d = (e, a, t) => a in e ? E(e, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[a] = t, i = (e, a) => {
|
|
6
|
+
for (var t in a || (a = {}))
|
|
7
|
+
l.call(a, t) && d(e, t, a[t]);
|
|
8
|
+
if (m)
|
|
9
|
+
for (var t of m(a))
|
|
10
|
+
n.call(a, t) && d(e, t, a[t]);
|
|
11
|
+
return e;
|
|
12
|
+
}, r = (e, a) => M(e, D(a));
|
|
13
|
+
var u = (e, a) => {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var o in e)
|
|
16
|
+
l.call(e, o) && a.indexOf(o) < 0 && (t[o] = e[o]);
|
|
17
|
+
if (e != null && m)
|
|
18
|
+
for (var o of m(e))
|
|
19
|
+
a.indexOf(o) < 0 && n.call(e, o) && (t[o] = e[o]);
|
|
20
|
+
return t;
|
|
21
|
+
};
|
|
22
|
+
import H from "@emotion/styled";
|
|
23
|
+
import { useRouteData as S, useContainer as U, useProperties as $, createEmptyComponent as j, GuideList as k, contentBox as q } from "@telia-ace/knowledge-widget-ui";
|
|
24
|
+
import { appendClassNames as p, createParams as z, formatUrl as A } from "@telia-ace/widget-utilities";
|
|
25
|
+
import I from "react";
|
|
26
|
+
const X = (t) => {
|
|
27
|
+
var o = t, { className: e } = o, a = u(o, ["className"]);
|
|
28
|
+
const { name: c, params: v } = S(), b = U(), {
|
|
29
|
+
showFavoriteToggle: g = !1,
|
|
30
|
+
items: s,
|
|
31
|
+
header: L,
|
|
32
|
+
metadata: f,
|
|
33
|
+
tags: h,
|
|
34
|
+
addFavoriteTooltip: y,
|
|
35
|
+
removeFavoriteCancelLabel: F,
|
|
36
|
+
removeFavoriteConfirmLabel: C,
|
|
37
|
+
removeFavoriteHeader: T,
|
|
38
|
+
removeFavoriteLabel: G,
|
|
39
|
+
removeFavoriteTooltip: N,
|
|
40
|
+
metadataByLabel: P,
|
|
41
|
+
metadataModifiedLabel: R,
|
|
42
|
+
metadataPublishedLabel: w
|
|
43
|
+
} = $();
|
|
44
|
+
return !s || !s.length ? j(b, r(i({}, a), {
|
|
45
|
+
className: p(e, "humany-related-guide-list")
|
|
46
|
+
})) : /* @__PURE__ */ I.createElement(
|
|
47
|
+
J,
|
|
48
|
+
r(i({}, a), {
|
|
49
|
+
className: p(e, "humany-related-guide-list"),
|
|
50
|
+
header: L,
|
|
51
|
+
items: s,
|
|
52
|
+
paramMappers: {
|
|
53
|
+
guide: ({ id: x, title: B }) => z(r(i({}, v), {
|
|
54
|
+
guide: x,
|
|
55
|
+
uriName: A(B),
|
|
56
|
+
connection: void 0
|
|
57
|
+
}))
|
|
58
|
+
},
|
|
59
|
+
showTags: h,
|
|
60
|
+
showFavoriteToggle: g,
|
|
61
|
+
addFavoriteTooltip: y,
|
|
62
|
+
removeFavoriteCancelLabel: F,
|
|
63
|
+
removeFavoriteConfirmLabel: C,
|
|
64
|
+
removeFavoriteHeader: T,
|
|
65
|
+
removeFavoriteLabel: G,
|
|
66
|
+
removeFavoriteTooltip: N,
|
|
67
|
+
metadata: r(i({}, f), {
|
|
68
|
+
modifiedLabel: R,
|
|
69
|
+
publishedLabel: w,
|
|
70
|
+
byLabel: P
|
|
71
|
+
}),
|
|
72
|
+
routing: {
|
|
73
|
+
guide: c
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
}, J = H(k)`
|
|
78
|
+
${q}
|
|
79
|
+
li:last-child {
|
|
80
|
+
margin: 0;
|
|
81
|
+
}
|
|
82
|
+
`;
|
|
83
|
+
export {
|
|
84
|
+
X as default
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=related-guide-list.7ecfd11f.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-guide-list.7ecfd11f.js","sources":["../src/related-guide-list.tsx"],"sourcesContent":["import styled from '@emotion/styled';\nimport { Guide } from '@telia-ace/knowledge-widget-core';\nimport {\n contentBox,\n createEmptyComponent,\n GuideList,\n useContainer,\n useProperties,\n useRouteData,\n} from '@telia-ace/knowledge-widget-ui';\nimport { appendClassNames, createParams, formatUrl } from '@telia-ace/widget-utilities';\nimport React from 'react';\nimport { RelatedGuideListComponentProps } from './related-guide-list-component';\n\ntype Props = {\n className: string;\n};\n\nconst RelatedGuideList: React.FC<Props> = ({ className, ...other }) => {\n const { name, params } = useRouteData();\n const container = useContainer();\n const {\n showFavoriteToggle = false,\n items,\n header,\n metadata,\n tags,\n addFavoriteTooltip,\n removeFavoriteCancelLabel,\n removeFavoriteConfirmLabel,\n removeFavoriteHeader,\n removeFavoriteLabel,\n removeFavoriteTooltip,\n metadataByLabel,\n metadataModifiedLabel,\n metadataPublishedLabel,\n } = useProperties<RelatedGuideListComponentProps>();\n\n if (!items || !items.length) {\n return createEmptyComponent(container, {\n ...other,\n className: appendClassNames(className, 'humany-related-guide-list'),\n });\n }\n\n return (\n <StyledGuideList\n {...other}\n className={appendClassNames(className, 'humany-related-guide-list')}\n header={header}\n items={items}\n paramMappers={{\n guide: ({ id, title }: Guide) =>\n createParams({\n ...params,\n guide: id,\n uriName: formatUrl(title),\n connection: undefined,\n }),\n }}\n showTags={tags}\n showFavoriteToggle={showFavoriteToggle}\n addFavoriteTooltip={addFavoriteTooltip}\n removeFavoriteCancelLabel={removeFavoriteCancelLabel}\n removeFavoriteConfirmLabel={removeFavoriteConfirmLabel}\n removeFavoriteHeader={removeFavoriteHeader}\n removeFavoriteLabel={removeFavoriteLabel}\n removeFavoriteTooltip={removeFavoriteTooltip}\n metadata={{\n ...metadata,\n modifiedLabel: metadataModifiedLabel,\n publishedLabel: metadataPublishedLabel,\n byLabel: metadataByLabel,\n }}\n routing={{\n guide: name,\n }}\n />\n );\n};\n\nexport default RelatedGuideList;\n\nconst StyledGuideList = styled(GuideList)<any>`\n ${contentBox}\n li:last-child {\n margin: 0;\n }\n`;\n"],"names":["RelatedGuideList","_a","_b","className","other","__objRest","name","params","useRouteData","container","useContainer","showFavoriteToggle","items","header","metadata","tags","addFavoriteTooltip","removeFavoriteCancelLabel","removeFavoriteConfirmLabel","removeFavoriteHeader","removeFavoriteLabel","removeFavoriteTooltip","metadataByLabel","metadataModifiedLabel","metadataPublishedLabel","useProperties","createEmptyComponent","__spreadProps","__spreadValues","appendClassNames","React","StyledGuideList","id","title","createParams","formatUrl","styled","GuideList","contentBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,MAAMA,IAAoC,CAACC,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAE,MAAFD,GAAgBE,IAAAC,EAAhBH,GAAgB,CAAd;AACzC,QAAM,EAAE,MAAAI,GAAM,QAAAC,EAA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A;AAAA;AAAA;AAAA;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/knowledge-widget-components-related-guide-list",
|
|
3
|
-
"version": "1.0.38
|
|
3
|
+
"version": "1.0.38",
|
|
4
4
|
"description": "Related guide list component for ACE Knowledge Widgets.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@telia-ace/knowledge-widget-component-utilities": "1.0.38
|
|
25
|
-
"@telia-ace/knowledge-widget-core": "1.0.34
|
|
26
|
-
"@telia-ace/knowledge-widget-types-grid": "1.0.45
|
|
27
|
-
"@telia-ace/knowledge-widget-ui": "1.0.40
|
|
28
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
24
|
+
"@telia-ace/knowledge-widget-component-utilities": "^1.0.38",
|
|
25
|
+
"@telia-ace/knowledge-widget-core": "^1.0.34",
|
|
26
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.45",
|
|
27
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.40",
|
|
28
|
+
"@telia-ace/widget-utilities": "^1.0.9",
|
|
29
29
|
"@webprovisions/platform": "^1.1.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|