@telia-ace/knowledge-widget-components-related-guide-list 1.0.22 → 1.0.23
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.js +21 -16
- package/dist/index.js.map +1 -1
- package/dist/related-guide-list.cf209a10.js.map +1 -1
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -13,22 +13,27 @@ var h = (r, e, t) => e in r ? g(r, e, { enumerable: !0, configurable: !0, writab
|
|
|
13
13
|
import { createEventSubscriber as b, extendComponent as w } from "@telia-ace/knowledge-widget-core";
|
|
14
14
|
import { DataType as C } from "@telia-ace/knowledge-widget-types-grid";
|
|
15
15
|
import { createReactComponent as v } from "@telia-ace/knowledge-widget-ui";
|
|
16
|
-
const G = (r) => v(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
16
|
+
const G = (r) => v(
|
|
17
|
+
r,
|
|
18
|
+
"related-guide-list",
|
|
19
|
+
import("./related-guide-list.cf209a10.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(o(u({}, 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(() => w(r, "related-guide-list", (e) => {
|
|
32
37
|
e.actions.watch("related-guide-list.fetch", (t, i) => {
|
|
33
38
|
const {
|
|
34
39
|
params: { guide: c, connection: d }
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/related-guide-list-component.ts"],"sourcesContent":["import {\r\n FavoriteProperties,\r\n MetaDataProperties,\r\n} from '@telia-ace/knowledge-widget-component-utilities';\r\nimport { createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\r\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type RelatedGuideListComponentProps = {\r\n header: string;\r\n items?: any[]; // internal\r\n showFavoriteToggle?: boolean;\r\n tags?: boolean;\r\n} & FavoriteProperties &\r\n MetaDataProperties;\r\n\r\nconst RelatedGuideListComponent = (container: Container) => {\r\n return createReactComponent(\r\n container,\r\n 'related-guide-list',\r\n import('./related-guide-list'),\r\n (component) => {\r\n const { events } = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n const fetch = (params: { [key: string]: string }) => {\r\n component.writeProperties({ loading: true, error: undefined });\r\n component.actions.dispatch('fetch', { params });\r\n };\r\n\r\n component.actions.create('fetch', ({ items = [] }) => {\r\n return component.actions.dispatch('fetched', {\r\n items,\r\n loading: true,\r\n });\r\n });\r\n\r\n component.actions.create('fetched', (input) => {\r\n return component.writeProperties({ ...input, loading: false });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n subscribe('router:changed', (_, { current }) => {\r\n fetch(current.routeData.params);\r\n });\r\n return () => {\r\n unsubscribe();\r\n };\r\n }\r\n ).then(() => {\r\n return extendComponent(container, 'related-guide-list', (component) => {\r\n component.actions.watch('related-guide-list.fetch', (input, next) => {\r\n const {\r\n params: { guide, connection },\r\n } = input;\r\n if (!guide) {\r\n return next(input);\r\n }\r\n const { header } = component.properties() as RelatedGuideListComponentProps;\r\n\r\n return container.getAsync('dataClient').then((dataClient: DataClient) => {\r\n return dataClient\r\n .fetch(DataType.Guide, {\r\n connection,\r\n guideId: guide,\r\n })\r\n .then(({ related }) => {\r\n return next({ ...input, items: related || [] });\r\n })\r\n .catch((e: any) => {\r\n return next(input);\r\n });\r\n });\r\n });\r\n });\r\n });\r\n};\r\n\r\nexport default RelatedGuideListComponent;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAiBM,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/related-guide-list-component.ts"],"sourcesContent":["import {\r\n FavoriteProperties,\r\n MetaDataProperties,\r\n} from '@telia-ace/knowledge-widget-component-utilities';\r\nimport { createEventSubscriber, extendComponent } from '@telia-ace/knowledge-widget-core';\r\nimport { DataClient, DataType } from '@telia-ace/knowledge-widget-types-grid';\r\nimport { createReactComponent } from '@telia-ace/knowledge-widget-ui';\r\nimport { Container } from '@webprovisions/platform';\r\n\r\nexport type RelatedGuideListComponentProps = {\r\n header: string;\r\n items?: any[]; // internal\r\n showFavoriteToggle?: boolean;\r\n tags?: boolean;\r\n} & FavoriteProperties &\r\n MetaDataProperties;\r\n\r\nconst RelatedGuideListComponent = (container: Container) => {\r\n return createReactComponent(\r\n container,\r\n 'related-guide-list',\r\n import('./related-guide-list'),\r\n (component) => {\r\n const { events } = container.get('$widget');\r\n const [subscribe, unsubscribe] = createEventSubscriber(events);\r\n\r\n const fetch = (params: { [key: string]: string }) => {\r\n component.writeProperties({ loading: true, error: undefined });\r\n component.actions.dispatch('fetch', { params });\r\n };\r\n\r\n component.actions.create('fetch', ({ items = [] }) => {\r\n return component.actions.dispatch('fetched', {\r\n items,\r\n loading: true,\r\n });\r\n });\r\n\r\n component.actions.create('fetched', (input) => {\r\n return component.writeProperties({ ...input, loading: false });\r\n });\r\n\r\n container.getAsync('router').then((router) => {\r\n const { params } = router.getRouteData();\r\n fetch(params);\r\n });\r\n subscribe('router:changed', (_, { current }) => {\r\n fetch(current.routeData.params);\r\n });\r\n return () => {\r\n unsubscribe();\r\n };\r\n }\r\n ).then(() => {\r\n return extendComponent(container, 'related-guide-list', (component) => {\r\n component.actions.watch('related-guide-list.fetch', (input, next) => {\r\n const {\r\n params: { guide, connection },\r\n } = input;\r\n if (!guide) {\r\n return next(input);\r\n }\r\n const { header } = component.properties() as RelatedGuideListComponentProps;\r\n\r\n return container.getAsync('dataClient').then((dataClient: DataClient) => {\r\n return dataClient\r\n .fetch(DataType.Guide, {\r\n connection,\r\n guideId: guide,\r\n })\r\n .then(({ related }) => {\r\n return next({ ...input, items: related || [] });\r\n })\r\n .catch((e: any) => {\r\n return next(input);\r\n });\r\n });\r\n });\r\n });\r\n });\r\n};\r\n\r\nexport default RelatedGuideListComponent;\r\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"],"mappings":";;;;;;;;;;;;;;;AAiBM,MAAAA,IAA4B,CAACC,MACxBC;AAAA,EACHD;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,CAACE,MAAc;AACX,UAAM,EAAE,QAAAC,EAAW,IAAAH,EAAU,IAAI,SAAS,GACpC,CAACI,GAAWC,CAAW,IAAIC,EAAsBH,CAAM,GAEvDI,IAAQ,CAACC,MAAsC;AACjD,MAAAN,EAAU,gBAAgB,EAAE,SAAS,IAAM,OAAO,QAAW,GAC7DA,EAAU,QAAQ,SAAS,SAAS,EAAE,QAAAM,EAAQ,CAAA;AAAA,IAAA;AAGxC,WAAAN,EAAA,QAAQ,OAAO,SAAS,CAAC,EAAE,OAAAO,IAAQ,CAAA,QAClCP,EAAU,QAAQ,SAAS,WAAW;AAAA,MACzC,OAAAO;AAAA,MACA,SAAS;AAAA,IAAA,CACZ,CACJ,GAEDP,EAAU,QAAQ,OAAO,WAAW,CAACQ,MAC1BR,EAAU,gBAAgBS,EAAAC,EAAA,IAAKF,IAAL,EAAY,SAAS,KAAO,CAChE,GAEDV,EAAU,SAAS,QAAQ,EAAE,KAAK,CAACa,MAAW;AAC1C,YAAM,EAAE,QAAAL,EAAA,IAAWK,EAAO,aAAa;AACvC,MAAAN,EAAMC,CAAM;AAAA,IAAA,CACf,GACDJ,EAAU,kBAAkB,CAACU,GAAG,EAAE,SAAAC,QAAc;AACtC,MAAAR,EAAAQ,EAAQ,UAAU,MAAM;AAAA,IAAA,CACjC,GACM,MAAM;AACG,MAAAV;IAAA;AAAA,EAEpB;AACJ,EAAE,KAAK,MACIW,EAAgBhB,GAAW,sBAAsB,CAACE,MAAc;AACnE,EAAAA,EAAU,QAAQ,MAAM,4BAA4B,CAACQ,GAAOO,MAAS;AAC3D,UAAA;AAAA,MACF,QAAQ,EAAE,OAAAC,GAAO,YAAAC,EAAW;AAAA,IAC5B,IAAAT;AACJ,WAAKQ,KAGchB,EAAU,WAAW,GAEjCF,EAAU,SAAS,YAAY,EAAE,KAAK,CAACoB,MACnCA,EACF,MAAMC,EAAS,OAAO;AAAA,MACnB,YAAAF;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;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-guide-list.cf209a10.js","sources":["../src/related-guide-list.tsx"],"sourcesContent":["import { Guide } from '@telia-ace/knowledge-widget-core';\r\nimport {\r\n contentBox,\r\n createEmptyComponent,\r\n GuideList,\r\n useContainer,\r\n useProperties,\r\n useRouteData,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames, createParams, formatUrl } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled from 'styled-components';\r\nimport { RelatedGuideListComponentProps } from './related-guide-list-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst RelatedGuideList: React.SFC<Props> = ({ className, ...other }) => {\r\n const { name, params } = useRouteData();\r\n const container = useContainer();\r\n const {\r\n showFavoriteToggle = false,\r\n items,\r\n header,\r\n metadata,\r\n tags,\r\n addFavoriteTooltip,\r\n removeFavoriteCancelLabel,\r\n removeFavoriteConfirmLabel,\r\n removeFavoriteHeader,\r\n removeFavoriteLabel,\r\n removeFavoriteTooltip,\r\n metadataByLabel,\r\n metadataModifiedLabel,\r\n metadataPublishedLabel,\r\n } = useProperties<RelatedGuideListComponentProps>();\r\n\r\n if (!items || !items.length) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-related-guide-list'),\r\n });\r\n }\r\n\r\n return (\r\n <StyledGuideList\r\n {...other}\r\n className={appendClassNames(className, 'humany-related-guide-list')}\r\n header={header}\r\n items={items}\r\n paramMappers={{\r\n guide: ({ id, title }: Guide) =>\r\n createParams({\r\n ...params,\r\n guide: id,\r\n uriName: formatUrl(title),\r\n connection: undefined,\r\n }),\r\n }}\r\n showTags={tags}\r\n showFavoriteToggle={showFavoriteToggle}\r\n addFavoriteTooltip={addFavoriteTooltip}\r\n removeFavoriteCancelLabel={removeFavoriteCancelLabel}\r\n removeFavoriteConfirmLabel={removeFavoriteConfirmLabel}\r\n removeFavoriteHeader={removeFavoriteHeader}\r\n removeFavoriteLabel={removeFavoriteLabel}\r\n removeFavoriteTooltip={removeFavoriteTooltip}\r\n metadata={{\r\n ...metadata,\r\n modifiedLabel: metadataModifiedLabel,\r\n publishedLabel: metadataPublishedLabel,\r\n byLabel: metadataByLabel,\r\n }}\r\n routing={{\r\n guide: name,\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default RelatedGuideList;\r\n\r\nconst StyledGuideList = styled(GuideList)<any>`\r\n ${contentBox}\r\n li:last-child {\r\n margin: 0;\r\n }\r\n`;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,
|
|
1
|
+
{"version":3,"file":"related-guide-list.cf209a10.js","sources":["../src/related-guide-list.tsx"],"sourcesContent":["import { Guide } from '@telia-ace/knowledge-widget-core';\r\nimport {\r\n contentBox,\r\n createEmptyComponent,\r\n GuideList,\r\n useContainer,\r\n useProperties,\r\n useRouteData,\r\n} from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames, createParams, formatUrl } from '@telia-ace/widget-utilities';\r\nimport React from 'react';\r\nimport styled from 'styled-components';\r\nimport { RelatedGuideListComponentProps } from './related-guide-list-component';\r\n\r\ntype Props = {\r\n className: string;\r\n};\r\n\r\nconst RelatedGuideList: React.SFC<Props> = ({ className, ...other }) => {\r\n const { name, params } = useRouteData();\r\n const container = useContainer();\r\n const {\r\n showFavoriteToggle = false,\r\n items,\r\n header,\r\n metadata,\r\n tags,\r\n addFavoriteTooltip,\r\n removeFavoriteCancelLabel,\r\n removeFavoriteConfirmLabel,\r\n removeFavoriteHeader,\r\n removeFavoriteLabel,\r\n removeFavoriteTooltip,\r\n metadataByLabel,\r\n metadataModifiedLabel,\r\n metadataPublishedLabel,\r\n } = useProperties<RelatedGuideListComponentProps>();\r\n\r\n if (!items || !items.length) {\r\n return createEmptyComponent(container, {\r\n ...other,\r\n className: appendClassNames(className, 'humany-related-guide-list'),\r\n });\r\n }\r\n\r\n return (\r\n <StyledGuideList\r\n {...other}\r\n className={appendClassNames(className, 'humany-related-guide-list')}\r\n header={header}\r\n items={items}\r\n paramMappers={{\r\n guide: ({ id, title }: Guide) =>\r\n createParams({\r\n ...params,\r\n guide: id,\r\n uriName: formatUrl(title),\r\n connection: undefined,\r\n }),\r\n }}\r\n showTags={tags}\r\n showFavoriteToggle={showFavoriteToggle}\r\n addFavoriteTooltip={addFavoriteTooltip}\r\n removeFavoriteCancelLabel={removeFavoriteCancelLabel}\r\n removeFavoriteConfirmLabel={removeFavoriteConfirmLabel}\r\n removeFavoriteHeader={removeFavoriteHeader}\r\n removeFavoriteLabel={removeFavoriteLabel}\r\n removeFavoriteTooltip={removeFavoriteTooltip}\r\n metadata={{\r\n ...metadata,\r\n modifiedLabel: metadataModifiedLabel,\r\n publishedLabel: metadataPublishedLabel,\r\n byLabel: metadataByLabel,\r\n }}\r\n routing={{\r\n guide: name,\r\n }}\r\n />\r\n );\r\n};\r\n\r\nexport default RelatedGuideList;\r\n\r\nconst StyledGuideList = styled(GuideList)<any>`\r\n ${contentBox}\r\n li:last-child {\r\n margin: 0;\r\n }\r\n`;\r\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,IAAqC,CAACC,MAA4B;AAA5B,MAAAC,IAAAD,GAAE,aAAAE,MAAFD,GAAgBE,IAAAC,EAAhBH,GAAgB,CAAd;AAC1C,QAAM,EAAE,MAAAI,GAAM,QAAAC,EAAO,IAAIC,EAAa,GAChCC,IAAYC,KACZ;AAAA,IACF,oBAAAC,IAAqB;AAAA,IACrB,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,wBAAAC;AAAA,MACAC,EAA8C;AAElD,SAAI,CAACb,KAAS,CAACA,EAAM,SACVc,EAAqBjB,GAAWkB,EAAAC,EAAA,IAChCxB,IADgC;AAAA,IAEnC,WAAWyB,EAAiB1B,GAAW,2BAA2B;AAAA,EAAA,EACrE,IAIA,gBAAA2B,EAAA,cAAAC,GAAAJ,EAAAC,EAAA,IACOxB,IADP;AAAA,IAEG,WAAWyB,EAAiB1B,GAAW,2BAA2B;AAAA,IAClE,QAAAU;AAAA,IACA,OAAAD;AAAA,IACA,cAAc;AAAA,MACV,OAAO,CAAC,EAAE,IAAAoB,GAAI,OAAAC,EAAA,MACVC,EAAaP,EAAAC,EAAA,IACNrB,IADM;AAAA,QAET,OAAOyB;AAAA,QACP,SAASG,EAAUF,CAAK;AAAA,QACxB,YAAY;AAAA,MAAA,EACf;AAAA,IACT;AAAA,IACA,UAAUlB;AAAA,IACV,oBAAAJ;AAAA,IACA,oBAAAK;AAAA,IACA,2BAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,qBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,UAAUM,EAAAC,EAAA,IACHd,IADG;AAAA,MAEN,eAAeS;AAAA,MACf,gBAAgBC;AAAA,MAChB,SAASF;AAAA,IACb;AAAA,IACA,SAAS;AAAA,MACL,OAAOhB;AAAA,IACX;AAAA,EAAA,EACJ;AAER,GAIMyB,IAAkBK,EAAOC,CAAS;AAAA,MAClCC;AAAA;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.
|
|
3
|
+
"version": "1.0.23",
|
|
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",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"telia"
|
|
9
9
|
],
|
|
10
10
|
"main": "dist/index.js",
|
|
11
|
+
"sourceMain": "src/index.ts",
|
|
11
12
|
"type": "module",
|
|
12
13
|
"types": "dist/index.d.ts",
|
|
13
14
|
"files": [
|
|
@@ -25,11 +26,11 @@
|
|
|
25
26
|
},
|
|
26
27
|
"sideEffects": false,
|
|
27
28
|
"dependencies": {
|
|
28
|
-
"@telia-ace/knowledge-widget-component-utilities": "^1.0.
|
|
29
|
-
"@telia-ace/knowledge-widget-core": "^1.0.
|
|
30
|
-
"@telia-ace/knowledge-widget-types-grid": "^1.0.
|
|
31
|
-
"@telia-ace/knowledge-widget-ui": "^1.0.
|
|
32
|
-
"@telia-ace/widget-utilities": "^1.0.
|
|
29
|
+
"@telia-ace/knowledge-widget-component-utilities": "^1.0.23",
|
|
30
|
+
"@telia-ace/knowledge-widget-core": "^1.0.19",
|
|
31
|
+
"@telia-ace/knowledge-widget-types-grid": "^1.0.30",
|
|
32
|
+
"@telia-ace/knowledge-widget-ui": "^1.0.25",
|
|
33
|
+
"@telia-ace/widget-utilities": "^1.0.4",
|
|
33
34
|
"@webprovisions/platform": "^1.1.2"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
@@ -42,5 +43,5 @@
|
|
|
42
43
|
"@types/react-dom": "^16.8.0",
|
|
43
44
|
"@types/styled-components": "^5.1.7"
|
|
44
45
|
},
|
|
45
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "db190a67f912245c4145c037972fac2039bda698"
|
|
46
47
|
}
|