@telia-ace/knowledge-widget-core 1.0.9 → 1.0.12

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/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
- Copyright © 2021, Telia Company AB. All rights reserved.
2
-
3
- THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
- THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
- AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
1
+ Copyright © 2021, Telia Company AB. All rights reserved.
2
+
3
+ THIS PACKAGE AND CONTAINING SOFTWARE IS PART OF
4
+ THE HUMANY SERVICE. BY USING THIS SOFTWARE YOU
5
+ AGREE TO THE FOLLOWING TERMS AND CONDITIONS:
6
6
  http://www.humany.com/legal
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
- # `@telia-ace/knowledge-widget-core`
2
-
3
- Core framework for ACE knowledge widgets.
1
+ # `@telia-ace/knowledge-widget-core`
2
+
3
+ Core framework for ACE knowledge widgets.
@@ -1,15 +1,15 @@
1
- import { BootstrappedImplementation } from '@webprovisions/bootstrapping';
2
- import { ConfigureCallback } from '@webprovisions/platform';
3
- import Implementation from './implementation';
4
- export declare type BootstrapOptions = {
5
- /**
6
- * Resolver function for the root element to base the bootstrapping on.
7
- */
8
- rootElementResolver?: () => HTMLElement;
9
- };
10
- declare const _default: (implementation: Implementation, configure: ConfigureCallback, options?: BootstrapOptions) => Promise<BootstrappedImplementation>;
11
- /**
12
- * Bootstraps an `Implementation` by scanning trigger elements and attaches them to
13
- * their corresponding widgets.
14
- */
15
- export default _default;
1
+ import { BootstrappedImplementation } from '@webprovisions/bootstrapping';
2
+ import { ConfigureCallback } from '@webprovisions/platform';
3
+ import Implementation from './implementation';
4
+ export declare type BootstrapOptions = {
5
+ /**
6
+ * Resolver function for the root element to base the bootstrapping on.
7
+ */
8
+ rootElementResolver?: () => HTMLElement;
9
+ };
10
+ declare const _default: (implementation: Implementation, configure: ConfigureCallback, options?: BootstrapOptions) => Promise<BootstrappedImplementation>;
11
+ /**
12
+ * Bootstraps an `Implementation` by scanning trigger elements and attaches them to
13
+ * their corresponding widgets.
14
+ */
15
+ export default _default;
@@ -1,87 +1,87 @@
1
- export declare type Symbol = {
2
- type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
3
- content: string;
4
- };
5
- export declare type Guide = {
6
- id: string;
7
- title: string;
8
- tags: Tag[];
9
- published?: string;
10
- modified?: string;
11
- publishedBy?: string;
12
- modifiedBy?: string;
13
- };
14
- export declare type Category = {
15
- id: string;
16
- title: string;
17
- symbol?: Symbol;
18
- activeSymbol?: Symbol;
19
- description?: string;
20
- items?: Category[];
21
- matches?: number;
22
- };
23
- export declare type Tag = {
24
- id: string;
25
- title: string;
26
- symbol?: Symbol;
27
- matches?: number;
28
- defaultIcon?: Symbol;
29
- activeIcon?: Symbol;
30
- };
31
- export declare enum DialogItemType {
32
- guide = "guide",
33
- link = "link",
34
- default = "default"
35
- }
36
- export declare type DialogItem = {
37
- id: string;
38
- title: string;
39
- parent: Guide;
40
- type: DialogItemType;
41
- connection?: string;
42
- href?: string;
43
- target?: string;
44
- };
45
- export declare type GuideCategoryBrowserList = {
46
- id: string;
47
- title: string;
48
- symbol?: Symbol;
49
- guides: Guide[];
50
- paging: boolean;
51
- pager?: string;
52
- };
53
- export declare type Notification = {
54
- id: string;
55
- title: string;
56
- body: string;
57
- modified?: string;
58
- expandable?: boolean;
59
- };
60
- export declare type NotificationList = {
61
- id: string;
62
- title?: string;
63
- symbol?: Symbol;
64
- notifications: Notification[];
65
- defaultHeaderOptions?: {
66
- visible: boolean;
67
- };
68
- };
69
- export declare type Tab = {
70
- title: string;
71
- name: string;
72
- aliases: string[];
73
- };
74
- export declare type WidgetEntry = {
75
- id: string;
76
- type: string;
77
- content: {
78
- open: boolean;
79
- };
80
- origin: string;
81
- };
82
- export declare enum PickerTypes {
83
- MODAL = "modal",
84
- DRAWER = "drawer",
85
- DROPDOWN = "dropdown",
86
- NONE = "none"
87
- }
1
+ export declare type Symbol = {
2
+ type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;
3
+ content: string;
4
+ };
5
+ export declare type Guide = {
6
+ id: string;
7
+ title: string;
8
+ tags: Tag[];
9
+ published?: string;
10
+ modified?: string;
11
+ publishedBy?: string;
12
+ modifiedBy?: string;
13
+ };
14
+ export declare type Category = {
15
+ id: string;
16
+ title: string;
17
+ symbol?: Symbol;
18
+ activeSymbol?: Symbol;
19
+ description?: string;
20
+ items?: Category[];
21
+ matches?: number;
22
+ };
23
+ export declare type Tag = {
24
+ id: string;
25
+ title: string;
26
+ symbol?: Symbol;
27
+ matches?: number;
28
+ defaultIcon?: Symbol;
29
+ activeIcon?: Symbol;
30
+ };
31
+ export declare enum DialogItemType {
32
+ guide = "guide",
33
+ link = "link",
34
+ default = "default"
35
+ }
36
+ export declare type DialogItem = {
37
+ id: string;
38
+ title: string;
39
+ parent: Guide;
40
+ type: DialogItemType;
41
+ connection?: string;
42
+ href?: string;
43
+ target?: string;
44
+ };
45
+ export declare type GuideCategoryBrowserList = {
46
+ id: string;
47
+ title: string;
48
+ symbol?: Symbol;
49
+ guides: Guide[];
50
+ paging: boolean;
51
+ pager?: string;
52
+ };
53
+ export declare type Notification = {
54
+ id: string;
55
+ title: string;
56
+ body: string;
57
+ modified?: string;
58
+ expandable?: boolean;
59
+ };
60
+ export declare type NotificationList = {
61
+ id: string;
62
+ title?: string;
63
+ symbol?: Symbol;
64
+ notifications: Notification[];
65
+ defaultHeaderOptions?: {
66
+ visible: boolean;
67
+ };
68
+ };
69
+ export declare type Tab = {
70
+ title: string;
71
+ name: string;
72
+ aliases: string[];
73
+ };
74
+ export declare type WidgetEntry = {
75
+ id: string;
76
+ type: string;
77
+ content: {
78
+ open: boolean;
79
+ };
80
+ origin: string;
81
+ };
82
+ export declare enum PickerTypes {
83
+ MODAL = "modal",
84
+ DRAWER = "drawer",
85
+ DROPDOWN = "dropdown",
86
+ NONE = "none"
87
+ }
package/dist/humany.d.ts CHANGED
@@ -1,48 +1,48 @@
1
- import { BootstrappedImplementationConfiguration } from '@webprovisions/bootstrapping';
2
- import { ConfigurationApiDefinition, Environment, WidgetSelector } from '@webprovisions/platform';
3
- import Implementation from './implementation';
4
- export interface HumanyConfiguration {
5
- /**
6
- * Extensions for the configuration API (optional).
7
- */
8
- configurationApiExtensions?: ConfigurationApiDefinition[];
9
- }
10
- /**
11
- * The Humany widget runtime.
12
- */
13
- export default class Humany extends Environment {
14
- /**
15
- * Version of the Humany runtime.
16
- */
17
- static version: string;
18
- constructor(name: string, configurationApiExtensions?: ConfigurationApiDefinition[]);
19
- createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation;
20
- /**
21
- * Performs navigation for widgets matching the specified selector by invoking a
22
- * 'navigate' command.
23
- * @param selector Widget selector matching the widget(s) to perform navigation on.
24
- * @param route Route name.
25
- * @param params Route params.
26
- */
27
- navigate(selector: WidgetSelector, route: string, params: {
28
- [key: string]: string;
29
- }): void;
30
- /**
31
- * Creates a `Humany` runtime based on provided configuration.
32
- * @param configuration Runtime configuration.
33
- */
34
- static create(configuration?: HumanyConfiguration): Humany;
35
- /**
36
- * Creates a `Humany` runtime based on provided configuration and retains configuration handlers
37
- * registered on global context. Use this factory to fully support the default embed script.
38
- * Will return any existing `Humany` runtime if available.
39
- * @param configuration Runtime configuration.
40
- * @param global Object to read configuration handlers from (default: window).
41
- */
42
- static createFromGlobal(globalHumany: any, configuration?: HumanyConfiguration): Humany;
43
- /**
44
- * Determines whether the specified object is a valid `Humany` runtime.
45
- * @param obj Object to compare.
46
- */
47
- static isRuntime(obj: any): boolean;
48
- }
1
+ import { BootstrappedImplementationConfiguration } from '@webprovisions/bootstrapping';
2
+ import { ConfigurationApiDefinition, Environment, WidgetSelector } from '@webprovisions/platform';
3
+ import Implementation from './implementation';
4
+ export interface HumanyConfiguration {
5
+ /**
6
+ * Extensions for the configuration API (optional).
7
+ */
8
+ configurationApiExtensions?: ConfigurationApiDefinition[];
9
+ }
10
+ /**
11
+ * The Humany widget runtime.
12
+ */
13
+ export default class Humany extends Environment {
14
+ /**
15
+ * Version of the Humany runtime.
16
+ */
17
+ static version: string;
18
+ constructor(name: string, configurationApiExtensions?: ConfigurationApiDefinition[]);
19
+ createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation;
20
+ /**
21
+ * Performs navigation for widgets matching the specified selector by invoking a
22
+ * 'navigate' command.
23
+ * @param selector Widget selector matching the widget(s) to perform navigation on.
24
+ * @param route Route name.
25
+ * @param params Route params.
26
+ */
27
+ navigate(selector: WidgetSelector, route: string, params: {
28
+ [key: string]: string;
29
+ }): void;
30
+ /**
31
+ * Creates a `Humany` runtime based on provided configuration.
32
+ * @param configuration Runtime configuration.
33
+ */
34
+ static create(configuration?: HumanyConfiguration): Humany;
35
+ /**
36
+ * Creates a `Humany` runtime based on provided configuration and retains configuration handlers
37
+ * registered on global context. Use this factory to fully support the default embed script.
38
+ * Will return any existing `Humany` runtime if available.
39
+ * @param configuration Runtime configuration.
40
+ * @param global Object to read configuration handlers from (default: window).
41
+ */
42
+ static createFromGlobal(globalHumany: any, configuration?: HumanyConfiguration): Humany;
43
+ /**
44
+ * Determines whether the specified object is a valid `Humany` runtime.
45
+ * @param obj Object to compare.
46
+ */
47
+ static isRuntime(obj: any): boolean;
48
+ }
@@ -1,7 +1,7 @@
1
- import { Implementation as ImplementationBase } from '@webprovisions/platform';
2
- /**
3
- * Represents a Humany implementation.
4
- */
5
- export default class Implementation extends ImplementationBase {
6
- bindings: string[];
7
- }
1
+ import { Implementation as ImplementationBase } from '@webprovisions/platform';
2
+ /**
3
+ * Represents a Humany implementation.
4
+ */
5
+ export default class Implementation extends ImplementationBase {
6
+ bindings: string[];
7
+ }
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- export * from '@telia-ace/widget-core';
2
- export { supportBootstrapping } from '@webprovisions/bootstrapping';
3
- export type { BootstrappingActivationData } from '@webprovisions/bootstrapping';
4
- export { destroyWidget as destroy, Widget } from '@webprovisions/platform';
5
- export { default as bootstrap } from './bootstrap';
6
- export * from './data-types';
7
- export { default as Humany } from './humany';
8
- export { default as Implementation } from './implementation';
9
- export { default as loadImplementation } from './load-implementation';
10
- export { default as Plugin } from './plugin';
11
- export { default as verifyAuth } from './verify-auth';
12
- export { default as version } from './version';
13
- export { default as WidgetType } from './widget-type';
1
+ export * from '@telia-ace/widget-core';
2
+ export { supportBootstrapping } from '@webprovisions/bootstrapping';
3
+ export type { BootstrappingActivationData } from '@webprovisions/bootstrapping';
4
+ export { destroyWidget as destroy, Widget } from '@webprovisions/platform';
5
+ export { default as bootstrap } from './bootstrap';
6
+ export * from './data-types';
7
+ export { default as Humany } from './humany';
8
+ export { default as Implementation } from './implementation';
9
+ export { default as loadImplementation } from './load-implementation';
10
+ export { default as Plugin } from './plugin';
11
+ export { default as verifyAuth } from './verify-auth';
12
+ export { default as version } from './version';
13
+ export { default as WidgetType } from './widget-type';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/bootstrap.ts","../src/data-types.ts","../src/version.ts","../src/humany.ts","../src/implementation.ts","../src/load-implementation.ts","../src/plugin.ts","../src/verify-auth.ts","../src/widget-type.ts"],"sourcesContent":["import { bootstrapImplementation, BootstrappedImplementation } from '@webprovisions/bootstrapping';\nimport { ConfigureCallback, selectImplementations } from '@webprovisions/platform';\nimport Implementation from './implementation';\n\nexport type BootstrapOptions = {\n /**\n * Resolver function for the root element to base the bootstrapping on.\n */\n rootElementResolver?: () => HTMLElement;\n};\n\n/**\n * Bootstraps an `Implementation` by scanning trigger elements and attaches them to\n * their corresponding widgets.\n */\nexport default (\n implementation: Implementation,\n configure: ConfigureCallback,\n options: BootstrapOptions = {}\n): Promise<BootstrappedImplementation> => {\n return bootstrapImplementation(\n implementation as any,\n implementation.bindings,\n () => {\n const runtimeConfigurationHandlers = implementation.container\n .get('$runtimecfg')\n .map((cfgHandlerArgs: any) => {\n const fnOrSelector = cfgHandlerArgs[0];\n if (typeof fnOrSelector === 'function') {\n return fnOrSelector;\n }\n if (selectImplementations(fnOrSelector)(implementation)) {\n return cfgHandlerArgs[1];\n }\n })\n .filter((handler: any) => !!handler);\n return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);\n },\n options.rootElementResolver || (() => document.body)\n );\n};\n","export type Symbol = {\n type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;\n content: string;\n};\n\nexport type Guide = {\n id: string;\n title: string;\n tags: Tag[];\n published?: string;\n modified?: string;\n publishedBy?: string;\n modifiedBy?: string;\n};\n\nexport type Category = {\n id: string;\n title: string;\n symbol?: Symbol;\n activeSymbol?: Symbol;\n description?: string;\n items?: Category[];\n matches?: number;\n};\n\nexport type Tag = {\n id: string;\n title: string;\n symbol?: Symbol;\n matches?: number;\n defaultIcon?: Symbol;\n activeIcon?: Symbol;\n};\n\nexport enum DialogItemType {\n guide = 'guide',\n link = 'link',\n default = 'default',\n}\n\nexport type DialogItem = {\n id: string;\n title: string;\n parent: Guide;\n type: DialogItemType;\n connection?: string;\n href?: string;\n target?: string;\n};\n\nexport type GuideCategoryBrowserList = {\n id: string;\n title: string;\n symbol?: Symbol;\n guides: Guide[];\n paging: boolean;\n pager?: string;\n};\n\nexport type Notification = {\n id: string;\n title: string;\n body: string;\n modified?: string;\n expandable?: boolean;\n};\n\nexport type NotificationList = {\n id: string;\n title?: string;\n symbol?: Symbol;\n notifications: Notification[];\n defaultHeaderOptions?: {\n visible: boolean;\n };\n};\n\nexport type Tab = {\n title: string;\n name: string;\n aliases: string[];\n};\n\nexport type WidgetEntry = {\n id: string;\n type: string;\n content: {\n open: boolean;\n };\n origin: string;\n};\n\nexport enum PickerTypes {\n MODAL = 'modal',\n DRAWER = 'drawer',\n DROPDOWN = 'dropdown',\n NONE = 'none',\n}\n","export default '#____version____#';\n","import {\n BootstrappedImplementationConfiguration,\n ConfigurationApi as BootstrappingConfigurationApi,\n} from '@webprovisions/bootstrapping';\nimport {\n ConfigurationApiDefinition,\n Environment,\n version as webprovisionsVersion,\n WidgetSelector,\n} from '@webprovisions/platform';\nimport Implementation from './implementation';\nimport version from './version';\n\nexport interface HumanyConfiguration {\n /**\n * Extensions for the configuration API (optional).\n */\n configurationApiExtensions?: ConfigurationApiDefinition[];\n}\n\n/**\n * The Humany widget runtime.\n */\nexport default class Humany extends Environment {\n /**\n * Version of the Humany runtime.\n */\n static version: string = `${version} (${webprovisionsVersion})`;\n\n constructor(name: string, configurationApiExtensions: ConfigurationApiDefinition[] = []) {\n super(name, configurationApiExtensions, {\n transformPluginSettings: (settings, name, container) => {\n const $settings = container.get('$settings');\n const configPluginSettings =\n $settings.plugins && name ? $settings.plugins[name] || {} : {};\n return {\n ...configPluginSettings,\n ...settings,\n };\n },\n });\n }\n\n createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation {\n const implementation = <Implementation>super.createImplementation(configuration);\n implementation.bindings = configuration.bindings;\n return implementation;\n }\n\n /**\n * Performs navigation for widgets matching the specified selector by invoking a\n * 'navigate' command.\n * @param selector Widget selector matching the widget(s) to perform navigation on.\n * @param route Route name.\n * @param params Route params.\n */\n navigate(selector: WidgetSelector, route: string, params: { [key: string]: string }) {\n this.widgets\n .query(selector)\n .forEach((widget) => widget.invoke('navigate', { route, params }));\n }\n\n /**\n * Creates a `Humany` runtime based on provided configuration.\n * @param configuration Runtime configuration.\n */\n static create(configuration: HumanyConfiguration = {}): Humany {\n const configurationApiExtensions = [BootstrappingConfigurationApi].concat(\n (configuration.configurationApiExtensions as any) || []\n );\n return new Humany('humany', configurationApiExtensions as any);\n }\n\n /**\n * Creates a `Humany` runtime based on provided configuration and retains configuration handlers\n * registered on global context. Use this factory to fully support the default embed script.\n * Will return any existing `Humany` runtime if available.\n * @param configuration Runtime configuration.\n * @param global Object to read configuration handlers from (default: window).\n */\n static createFromGlobal(globalHumany: any, configuration: HumanyConfiguration = {}): Humany {\n if (this.isRuntime(globalHumany)) {\n (globalHumany as Humany).patch(configuration);\n return globalHumany;\n }\n\n const runtimeConfiguration: any[] = [];\n\n const tempRuntimeConfiguration = globalHumany && globalHumany._c;\n if (tempRuntimeConfiguration) {\n tempRuntimeConfiguration.forEach((args: any) => runtimeConfiguration.push(args));\n }\n\n const runtime = this.create(configuration);\n runtime.container.register('$runtimecfg', runtimeConfiguration);\n return runtime;\n }\n\n /**\n * Determines whether the specified object is a valid `Humany` runtime.\n * @param obj Object to compare.\n */\n static isRuntime(obj: any): boolean {\n if (\n obj &&\n typeof obj === 'object' &&\n obj.container &&\n typeof obj.container.get === 'function' &&\n obj.container.get('$environment') === obj &&\n obj.container.owner === obj\n ) {\n return true;\n }\n return false;\n }\n}\n","import { Implementation as ImplementationBase } from '@webprovisions/platform';\n\n/**\n * Represents a Humany implementation.\n */\nexport default class Implementation extends ImplementationBase {\n bindings: string[] = [];\n}\n","import { BootstrappedImplementationConfiguration } from '@webprovisions/bootstrapping';\nimport Humany from './humany';\nimport Implementation from './implementation';\n\n/**\n * Loads a Humany implementation by fetching the configuration from the specified URL.\n * @param implementationPath Implementation URL.\n */\nconst loadImplementation = (humany: Humany, url: string): Promise<Implementation> => {\n return fetch(url + '/config.json')\n .then((response) => response.json())\n .then((json) => json.implementation)\n .then((configuration: BootstrappedImplementationConfiguration) =>\n humany.createImplementation(configuration)\n );\n};\nexport default loadImplementation;\n","import { Container, Plugin as PluginBase } from '@webprovisions/platform';\n\n/**\n * Base class for a Humany plugin.\n */\nexport default class Plugin extends PluginBase {\n constructor(container: Container, settings?: any) {\n super(container, settings);\n }\n}\n","const verifyAuth = (host: string, widgetName: string): Promise<boolean> => {\n const url = `${host}${widgetName}/interfaceauthorized`;\n\n return fetch(url, {\n method: 'GET',\n credentials: 'include',\n }).then((response) => response.status === 200 && response.ok);\n};\n\nexport default verifyAuth;\n","import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';\n\n/**\n * Base class for a Humany widget.\n */\nexport default class WidgetType extends WidgetTypeBase {\n constructor(container: Container) {\n super(container);\n }\n}\n"],"names":["BootstrappingConfigurationApi","webprovisionsVersion","ImplementationBase","PluginBase","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAe,YAAA,CACX,gBACA,WACA,UAA4B,OACU;AACtC,SAAO,wBACH,gBACA,eAAe,UACf,MAAM;AACI,UAAA,+BAA+B,eAAe,UAC/C,IAAI,aAAa,EACjB,IAAI,CAAC,mBAAwB;AAC1B,YAAM,eAAe,eAAe;AAChC,UAAA,OAAO,iBAAiB,YAAY;AAC7B,eAAA;AAAA,MACX;AACA,UAAI,sBAAsB,YAAY,EAAE,cAAc,GAAG;AACrD,eAAO,eAAe;AAAA,MAC1B;AAAA,IACH,CAAA,EACA,OAAO,CAAC,YAAiB,CAAC,CAAC,OAAO;AACvC,wBAAoB,CAAC,SAAS,IAAI,CAAA,GAAI,OAAO,4BAA4B;AAAA,EAE7E,GAAA,QAAQ,uBAAwB,OAAM,SAAS,KACnD;AACJ;ACNY,IAAA,mCAAA,oBAAL;AACK,kBAAA,WAAA;AACD,kBAAA,UAAA;AACG,kBAAA,aAAA;AAHF,SAAA;AAAA,GAAA,kBAAA,CAAA,CAAA;AA0DA,IAAA,gCAAA,iBAAL;AACK,eAAA,WAAA;AACC,eAAA,YAAA;AACE,eAAA,cAAA;AACJ,eAAA,UAAA;AAJC,SAAA;AAAA,GAAA,eAAA,CAAA,CAAA;AC5FZ,IAAA,UAAe;ACuBf,MAAqB,UAArB,cAAoC,YAAY;AAAA,EAM5C,YAAY,MAAc,6BAA2D,IAAI;AACrF,UAAM,MAAM,4BAA4B;AAAA,MACpC,yBAAyB,CAAC,UAAU,OAAM,cAAc;AAC9C,cAAA,YAAY,UAAU,IAAI,WAAW;AACrC,cAAA,uBACF,UAAU,WAAW,QAAO,UAAU,QAAQ,UAAS,CAAC,IAAI;AACzD,eAAA,kCACA,uBACA;AAAA,MAEX;AAAA,IAAA,CACH;AAAA,EACL;AAAA,EAEA,qBAAqB,e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AAA,MAAM,MAAM,cAAc,EAC5B,KAAK,CAAC,aAAa,SAAS,KAAA,CAAM,EAClC,KAAK,CAAC,SAAS,KAAK,cAAc,EAClC,KAAK,CAAC,kBACH,OAAO,qBAAqB,aAAa,CAC7C;AACR;ACVA,MAAqB,eAAeC,SAAW;AAAA,EAC3C,YAAY,WAAsB,UAAgB;AAC9C,UAAM,WAAW,QAAQ;AAAA,EAC7B;AACJ;ACTM,MAAA,aAAa,CAAC,MAAc,eAAyC;AACjE,QAAA,MAAM,GAAG,OAAO;AAEtB,SAAO,MAAM,KAAK;AAAA,IACd,QAAQ;AAAA,IACR,aAAa;AAAA,EAAA,CAChB,EAAE,KAAK,CAAC,aAAa,SAAS,WAAW,OAAO,SAAS,EAAE;AAChE;ACFA,MAAqB,mBAAmBC,aAAe;AAAA,EACnD,YAAY,WAAsB;AAC9B,UAAM,SAAS;AAAA,EACnB;AACJ;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/bootstrap.ts","../src/data-types.ts","../src/version.ts","../src/humany.ts","../src/implementation.ts","../src/load-implementation.ts","../src/plugin.ts","../src/verify-auth.ts","../src/widget-type.ts"],"sourcesContent":["import { bootstrapImplementation, BootstrappedImplementation } from '@webprovisions/bootstrapping';\r\nimport { ConfigureCallback, selectImplementations } from '@webprovisions/platform';\r\nimport Implementation from './implementation';\r\n\r\nexport type BootstrapOptions = {\r\n /**\r\n * Resolver function for the root element to base the bootstrapping on.\r\n */\r\n rootElementResolver?: () => HTMLElement;\r\n};\r\n\r\n/**\r\n * Bootstraps an `Implementation` by scanning trigger elements and attaches them to\r\n * their corresponding widgets.\r\n */\r\nexport default (\r\n implementation: Implementation,\r\n configure: ConfigureCallback,\r\n options: BootstrapOptions = {}\r\n): Promise<BootstrappedImplementation> => {\r\n return bootstrapImplementation(\r\n implementation as any,\r\n implementation.bindings,\r\n () => {\r\n const runtimeConfigurationHandlers = implementation.container\r\n .get('$runtimecfg')\r\n .map((cfgHandlerArgs: any) => {\r\n const fnOrSelector = cfgHandlerArgs[0];\r\n if (typeof fnOrSelector === 'function') {\r\n return fnOrSelector;\r\n }\r\n if (selectImplementations(fnOrSelector)(implementation)) {\r\n return cfgHandlerArgs[1];\r\n }\r\n })\r\n .filter((handler: any) => !!handler);\r\n return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);\r\n },\r\n options.rootElementResolver || (() => document.body)\r\n );\r\n};\r\n","export type Symbol = {\r\n type: 'Uri' | 'Svg' | 'FontAwesome' | 'Text' | string;\r\n content: string;\r\n};\r\n\r\nexport type Guide = {\r\n id: string;\r\n title: string;\r\n tags: Tag[];\r\n published?: string;\r\n modified?: string;\r\n publishedBy?: string;\r\n modifiedBy?: string;\r\n};\r\n\r\nexport type Category = {\r\n id: string;\r\n title: string;\r\n symbol?: Symbol;\r\n activeSymbol?: Symbol;\r\n description?: string;\r\n items?: Category[];\r\n matches?: number;\r\n};\r\n\r\nexport type Tag = {\r\n id: string;\r\n title: string;\r\n symbol?: Symbol;\r\n matches?: number;\r\n defaultIcon?: Symbol;\r\n activeIcon?: Symbol;\r\n};\r\n\r\nexport enum DialogItemType {\r\n guide = 'guide',\r\n link = 'link',\r\n default = 'default',\r\n}\r\n\r\nexport type DialogItem = {\r\n id: string;\r\n title: string;\r\n parent: Guide;\r\n type: DialogItemType;\r\n connection?: string;\r\n href?: string;\r\n target?: string;\r\n};\r\n\r\nexport type GuideCategoryBrowserList = {\r\n id: string;\r\n title: string;\r\n symbol?: Symbol;\r\n guides: Guide[];\r\n paging: boolean;\r\n pager?: string;\r\n};\r\n\r\nexport type Notification = {\r\n id: string;\r\n title: string;\r\n body: string;\r\n modified?: string;\r\n expandable?: boolean;\r\n};\r\n\r\nexport type NotificationList = {\r\n id: string;\r\n title?: string;\r\n symbol?: Symbol;\r\n notifications: Notification[];\r\n defaultHeaderOptions?: {\r\n visible: boolean;\r\n };\r\n};\r\n\r\nexport type Tab = {\r\n title: string;\r\n name: string;\r\n aliases: string[];\r\n};\r\n\r\nexport type WidgetEntry = {\r\n id: string;\r\n type: string;\r\n content: {\r\n open: boolean;\r\n };\r\n origin: string;\r\n};\r\n\r\nexport enum PickerTypes {\r\n MODAL = 'modal',\r\n DRAWER = 'drawer',\r\n DROPDOWN = 'dropdown',\r\n NONE = 'none',\r\n}\r\n","export default '#____version____#';\r\n","import {\r\n BootstrappedImplementationConfiguration,\r\n ConfigurationApi as BootstrappingConfigurationApi,\r\n} from '@webprovisions/bootstrapping';\r\nimport {\r\n ConfigurationApiDefinition,\r\n Environment,\r\n version as webprovisionsVersion,\r\n WidgetSelector,\r\n} from '@webprovisions/platform';\r\nimport Implementation from './implementation';\r\nimport version from './version';\r\n\r\nexport interface HumanyConfiguration {\r\n /**\r\n * Extensions for the configuration API (optional).\r\n */\r\n configurationApiExtensions?: ConfigurationApiDefinition[];\r\n}\r\n\r\n/**\r\n * The Humany widget runtime.\r\n */\r\nexport default class Humany extends Environment {\r\n /**\r\n * Version of the Humany runtime.\r\n */\r\n static version: string = `${version} (${webprovisionsVersion})`;\r\n\r\n constructor(name: string, configurationApiExtensions: ConfigurationApiDefinition[] = []) {\r\n super(name, configurationApiExtensions, {\r\n transformPluginSettings: (settings, name, container) => {\r\n const $settings = container.get('$settings');\r\n const configPluginSettings =\r\n $settings.plugins && name ? $settings.plugins[name] || {} : {};\r\n return {\r\n ...configPluginSettings,\r\n ...settings,\r\n };\r\n },\r\n });\r\n }\r\n\r\n createImplementation(configuration: BootstrappedImplementationConfiguration): Implementation {\r\n const implementation = <Implementation>super.createImplementation(configuration);\r\n implementation.bindings = configuration.bindings;\r\n return implementation;\r\n }\r\n\r\n /**\r\n * Performs navigation for widgets matching the specified selector by invoking a\r\n * 'navigate' command.\r\n * @param selector Widget selector matching the widget(s) to perform navigation on.\r\n * @param route Route name.\r\n * @param params Route params.\r\n */\r\n navigate(selector: WidgetSelector, route: string, params: { [key: string]: string }) {\r\n this.widgets\r\n .query(selector)\r\n .forEach((widget) => widget.invoke('navigate', { route, params }));\r\n }\r\n\r\n /**\r\n * Creates a `Humany` runtime based on provided configuration.\r\n * @param configuration Runtime configuration.\r\n */\r\n static create(configuration: HumanyConfiguration = {}): Humany {\r\n const configurationApiExtensions = [BootstrappingConfigurationApi].concat(\r\n (configuration.configurationApiExtensions as any) || []\r\n );\r\n return new Humany('humany', configurationApiExtensions as any);\r\n }\r\n\r\n /**\r\n * Creates a `Humany` runtime based on provided configuration and retains configuration handlers\r\n * registered on global context. Use this factory to fully support the default embed script.\r\n * Will return any existing `Humany` runtime if available.\r\n * @param configuration Runtime configuration.\r\n * @param global Object to read configuration handlers from (default: window).\r\n */\r\n static createFromGlobal(globalHumany: any, configuration: HumanyConfiguration = {}): Humany {\r\n if (this.isRuntime(globalHumany)) {\r\n (globalHumany as Humany).patch(configuration);\r\n return globalHumany;\r\n }\r\n\r\n const runtimeConfiguration: any[] = [];\r\n\r\n const tempRuntimeConfiguration = globalHumany && globalHumany._c;\r\n if (tempRuntimeConfiguration) {\r\n tempRuntimeConfiguration.forEach((args: any) => runtimeConfiguration.push(args));\r\n }\r\n\r\n const runtime = this.create(configuration);\r\n runtime.container.register('$runtimecfg', runtimeConfiguration);\r\n return runtime;\r\n }\r\n\r\n /**\r\n * Determines whether the specified object is a valid `Humany` runtime.\r\n * @param obj Object to compare.\r\n */\r\n static isRuntime(obj: any): boolean {\r\n if (\r\n obj &&\r\n typeof obj === 'object' &&\r\n obj.container &&\r\n typeof obj.container.get === 'function' &&\r\n obj.container.get('$environment') === obj &&\r\n obj.container.owner === obj\r\n ) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n}\r\n","import { Implementation as ImplementationBase } from '@webprovisions/platform';\r\n\r\n/**\r\n * Represents a Humany implementation.\r\n */\r\nexport default class Implementation extends ImplementationBase {\r\n bindings: string[] = [];\r\n}\r\n","import { BootstrappedImplementationConfiguration } from '@webprovisions/bootstrapping';\r\nimport Humany from './humany';\r\nimport Implementation from './implementation';\r\n\r\n/**\r\n * Loads a Humany implementation by fetching the configuration from the specified URL.\r\n * @param implementationPath Implementation URL.\r\n */\r\nconst loadImplementation = (humany: Humany, url: string): Promise<Implementation> => {\r\n return fetch(url + '/config.json')\r\n .then((response) => response.json())\r\n .then((json) => json.implementation)\r\n .then((configuration: BootstrappedImplementationConfiguration) =>\r\n humany.createImplementation(configuration)\r\n );\r\n};\r\nexport default loadImplementation;\r\n","import { Container, Plugin as PluginBase } from '@webprovisions/platform';\r\n\r\n/**\r\n * Base class for a Humany plugin.\r\n */\r\nexport default class Plugin extends PluginBase {\r\n constructor(container: Container, settings?: any) {\r\n super(container, settings);\r\n }\r\n}\r\n","const verifyAuth = (host: string, widgetName: string): Promise<boolean> => {\r\n const url = `${host}${widgetName}/interfaceauthorized`;\r\n\r\n return fetch(url, {\r\n method: 'GET',\r\n credentials: 'include',\r\n }).then((response) => response.status === 200 && response.ok);\r\n};\r\n\r\nexport default verifyAuth;\r\n","import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';\r\n\r\n/**\r\n * Base class for a Humany widget.\r\n */\r\nexport default class WidgetType extends WidgetTypeBase {\r\n constructor(container: Container) {\r\n super(container);\r\n }\r\n}\r\n"],"names":["BootstrappingConfigurationApi","webprovisionsVersion","ImplementationBase","PluginBase","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAeA,IAAe,YAAA,CACX,gBACA,WACA,UAA4B,OACU;AACtC,SAAO,wBACH,gBACA,eAAe,UACf,MAAM;AACI,UAAA,+BAA+B,eAAe,UAC/C,IAAI,aAAa,EACjB,IAAI,CAAC,mBAAwB;AAC1B,YAAM,eAAe,eAAe;AAChC,UAAA,OAAO,iBAAiB,YAAY;AAC7B,eAAA;AAAA,MACX;AACA,UAAI,sBAAsB,YAAY,EAAE,cAAc,GAAG;AACrD,eAAO,eAAe;AAAA,MAC1B;AAAA,IACH,CAAA,EACA,OAAO,CAAC,YAAiB,CAAC,CAAC,OAAO;AACvC,wBAAoB,CAAC,SAAS,IAAI,CAAA,GAAI,OAAO,4BAA4B;AAAA,EA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}
@@ -1,8 +1,8 @@
1
- import Humany from './humany';
2
- import Implementation from './implementation';
3
- /**
4
- * Loads a Humany implementation by fetching the configuration from the specified URL.
5
- * @param implementationPath Implementation URL.
6
- */
7
- declare const loadImplementation: (humany: Humany, url: string) => Promise<Implementation>;
8
- export default loadImplementation;
1
+ import Humany from './humany';
2
+ import Implementation from './implementation';
3
+ /**
4
+ * Loads a Humany implementation by fetching the configuration from the specified URL.
5
+ * @param implementationPath Implementation URL.
6
+ */
7
+ declare const loadImplementation: (humany: Humany, url: string) => Promise<Implementation>;
8
+ export default loadImplementation;
package/dist/plugin.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { Container, Plugin as PluginBase } from '@webprovisions/platform';
2
- /**
3
- * Base class for a Humany plugin.
4
- */
5
- export default class Plugin extends PluginBase {
6
- constructor(container: Container, settings?: any);
7
- }
1
+ import { Container, Plugin as PluginBase } from '@webprovisions/platform';
2
+ /**
3
+ * Base class for a Humany plugin.
4
+ */
5
+ export default class Plugin extends PluginBase {
6
+ constructor(container: Container, settings?: any);
7
+ }
@@ -1,2 +1,2 @@
1
- declare const verifyAuth: (host: string, widgetName: string) => Promise<boolean>;
2
- export default verifyAuth;
1
+ declare const verifyAuth: (host: string, widgetName: string) => Promise<boolean>;
2
+ export default verifyAuth;
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "#____version____#";
2
- export default _default;
1
+ declare const _default: "#____version____#";
2
+ export default _default;
@@ -1,7 +1,7 @@
1
- import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';
2
- /**
3
- * Base class for a Humany widget.
4
- */
5
- export default class WidgetType extends WidgetTypeBase {
6
- constructor(container: Container);
7
- }
1
+ import { Container, WidgetType as WidgetTypeBase } from '@webprovisions/platform';
2
+ /**
3
+ * Base class for a Humany widget.
4
+ */
5
+ export default class WidgetType extends WidgetTypeBase {
6
+ constructor(container: Container);
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-core",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "description": "Core framework for ACE Knowledge widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -25,10 +25,10 @@
25
25
  },
26
26
  "sideEffects": false,
27
27
  "dependencies": {
28
- "@telia-ace/widget-core": "^1.0.7",
28
+ "@telia-ace/widget-core": "^1.0.9",
29
29
  "@telia-ace/widget-utilities": "^1.0.2",
30
30
  "@webprovisions/bootstrapping": "^1.0.12",
31
31
  "@webprovisions/platform": "^1.1.2"
32
32
  },
33
- "gitHead": "a8bf8e5c1ca56a4749cd8ec47f756b13431394b4"
33
+ "gitHead": "1ebcbf462e3e5d7ba00dfce49f11b5936c7da555"
34
34
  }