@telia-ace/knowledge-widget-core 1.0.6 → 1.0.7

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.
Files changed (43) hide show
  1. package/{lib-esm → dist}/bootstrap.d.ts +0 -0
  2. package/{lib-esm → dist}/data-types.d.ts +0 -0
  3. package/{lib-esm → dist}/humany.d.ts +0 -0
  4. package/{lib-esm → dist}/implementation.d.ts +0 -0
  5. package/{lib-esm → dist}/index.d.ts +0 -0
  6. package/dist/index.js +122 -0
  7. package/dist/index.js.map +1 -0
  8. package/{lib-esm → dist}/load-implementation.d.ts +0 -0
  9. package/{lib-esm → dist}/plugin.d.ts +0 -0
  10. package/{lib-esm → dist}/verify-auth.d.ts +0 -0
  11. package/{lib-esm → dist}/version.d.ts +0 -0
  12. package/{lib-esm → dist}/widget-type.d.ts +0 -0
  13. package/package.json +10 -10
  14. package/lib/bootstrap.d.ts +0 -15
  15. package/lib/bootstrap.js +0 -26
  16. package/lib/data-types.d.ts +0 -87
  17. package/lib/data-types.js +0 -16
  18. package/lib/humany.d.ts +0 -48
  19. package/lib/humany.js +0 -119
  20. package/lib/implementation.d.ts +0 -7
  21. package/lib/implementation.js +0 -31
  22. package/lib/index.d.ts +0 -13
  23. package/lib/index.js +0 -43
  24. package/lib/load-implementation.d.ts +0 -8
  25. package/lib/load-implementation.js +0 -15
  26. package/lib/plugin.d.ts +0 -7
  27. package/lib/plugin.js +0 -29
  28. package/lib/verify-auth.d.ts +0 -2
  29. package/lib/verify-auth.js +0 -10
  30. package/lib/version.d.ts +0 -2
  31. package/lib/version.js +0 -3
  32. package/lib/widget-type.d.ts +0 -7
  33. package/lib/widget-type.js +0 -29
  34. package/lib-esm/bootstrap.js +0 -24
  35. package/lib-esm/data-types.js +0 -13
  36. package/lib-esm/humany.js +0 -114
  37. package/lib-esm/implementation.js +0 -29
  38. package/lib-esm/index.js +0 -12
  39. package/lib-esm/load-implementation.js +0 -13
  40. package/lib-esm/plugin.js +0 -27
  41. package/lib-esm/verify-auth.js +0 -8
  42. package/lib-esm/version.js +0 -1
  43. package/lib-esm/widget-type.js +0 -27
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/index.js ADDED
@@ -0,0 +1,122 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ export * from "@telia-ace/widget-core";
18
+ import { bootstrapImplementation, ConfigurationApi } from "@webprovisions/bootstrapping";
19
+ export { supportBootstrapping } from "@webprovisions/bootstrapping";
20
+ import { selectImplementations, version as version$1, Environment, Implementation as Implementation$1, Plugin as Plugin$1, WidgetType as WidgetType$1 } from "@webprovisions/platform";
21
+ export { Widget, destroyWidget as destroy } from "@webprovisions/platform";
22
+ var bootstrap = (implementation, configure, options = {}) => {
23
+ return bootstrapImplementation(implementation, implementation.bindings, () => {
24
+ const runtimeConfigurationHandlers = implementation.container.get("$runtimecfg").map((cfgHandlerArgs) => {
25
+ const fnOrSelector = cfgHandlerArgs[0];
26
+ if (typeof fnOrSelector === "function") {
27
+ return fnOrSelector;
28
+ }
29
+ if (selectImplementations(fnOrSelector)(implementation)) {
30
+ return cfgHandlerArgs[1];
31
+ }
32
+ }).filter((handler) => !!handler);
33
+ return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);
34
+ }, options.rootElementResolver || (() => document.body));
35
+ };
36
+ var DialogItemType = /* @__PURE__ */ ((DialogItemType2) => {
37
+ DialogItemType2["guide"] = "guide";
38
+ DialogItemType2["link"] = "link";
39
+ DialogItemType2["default"] = "default";
40
+ return DialogItemType2;
41
+ })(DialogItemType || {});
42
+ var PickerTypes = /* @__PURE__ */ ((PickerTypes2) => {
43
+ PickerTypes2["MODAL"] = "modal";
44
+ PickerTypes2["DRAWER"] = "drawer";
45
+ PickerTypes2["DROPDOWN"] = "dropdown";
46
+ PickerTypes2["NONE"] = "none";
47
+ return PickerTypes2;
48
+ })(PickerTypes || {});
49
+ var version = "#____version____#";
50
+ const _Humany = class extends Environment {
51
+ constructor(name, configurationApiExtensions = []) {
52
+ super(name, configurationApiExtensions, {
53
+ transformPluginSettings: (settings, name2, container) => {
54
+ const $settings = container.get("$settings");
55
+ const configPluginSettings = $settings.plugins && name2 ? $settings.plugins[name2] || {} : {};
56
+ return __spreadValues(__spreadValues({}, configPluginSettings), settings);
57
+ }
58
+ });
59
+ }
60
+ createImplementation(configuration) {
61
+ const implementation = super.createImplementation(configuration);
62
+ implementation.bindings = configuration.bindings;
63
+ return implementation;
64
+ }
65
+ navigate(selector, route, params) {
66
+ this.widgets.query(selector).forEach((widget) => widget.invoke("navigate", { route, params }));
67
+ }
68
+ static create(configuration = {}) {
69
+ const configurationApiExtensions = [ConfigurationApi].concat(configuration.configurationApiExtensions || []);
70
+ return new _Humany("humany", configurationApiExtensions);
71
+ }
72
+ static createFromGlobal(globalHumany, configuration = {}) {
73
+ if (this.isRuntime(globalHumany)) {
74
+ globalHumany.patch(configuration);
75
+ return globalHumany;
76
+ }
77
+ const runtimeConfiguration = [];
78
+ const tempRuntimeConfiguration = globalHumany && globalHumany._c;
79
+ if (tempRuntimeConfiguration) {
80
+ tempRuntimeConfiguration.forEach((args) => runtimeConfiguration.push(args));
81
+ }
82
+ const runtime = this.create(configuration);
83
+ runtime.container.register("$runtimecfg", runtimeConfiguration);
84
+ return runtime;
85
+ }
86
+ static isRuntime(obj) {
87
+ if (obj && typeof obj === "object" && obj.container && typeof obj.container.get === "function" && obj.container.get("$environment") === obj && obj.container.owner === obj) {
88
+ return true;
89
+ }
90
+ return false;
91
+ }
92
+ };
93
+ let Humany = _Humany;
94
+ Humany.version = `${version} (${version$1})`;
95
+ class Implementation extends Implementation$1 {
96
+ constructor() {
97
+ super(...arguments);
98
+ this.bindings = [];
99
+ }
100
+ }
101
+ const loadImplementation = (humany, url) => {
102
+ return fetch(url + "/config.json").then((response) => response.json()).then((json) => json.implementation).then((configuration) => humany.createImplementation(configuration));
103
+ };
104
+ class Plugin extends Plugin$1 {
105
+ constructor(container, settings) {
106
+ super(container, settings);
107
+ }
108
+ }
109
+ const verifyAuth = (host, widgetName) => {
110
+ const url = `${host}${widgetName}/interfaceauthorized`;
111
+ return fetch(url, {
112
+ method: "GET",
113
+ credentials: "include"
114
+ }).then((response) => response.status === 200 && response.ok);
115
+ };
116
+ class WidgetType extends WidgetType$1 {
117
+ constructor(container) {
118
+ super(container);
119
+ }
120
+ }
121
+ export { DialogItemType, Humany, Implementation, PickerTypes, Plugin, WidgetType, bootstrap, loadImplementation, verifyAuth, version };
122
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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';\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":"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"}
File without changes
File without changes
File without changes
File without changes
File without changes
package/package.json CHANGED
@@ -1,34 +1,34 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Core framework for ACE Knowledge widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
7
7
  "keywords": [
8
8
  "telia"
9
9
  ],
10
- "main": "lib/index.js",
11
- "module": "lib-esm/index.js",
10
+ "module": "dist/index.js",
11
+ "types": "dist/index.d.ts",
12
12
  "files": [
13
13
  "LICENSE.txt",
14
14
  "README.md",
15
- "lib/",
16
- "lib-esm/"
15
+ "dist/"
17
16
  ],
18
17
  "publishConfig": {
19
18
  "access": "public"
20
19
  },
21
20
  "scripts": {
22
- "clean": "cleandir lib && cleandir lib-esm",
23
- "compile": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.esm.json && node scripts/print-version.js"
21
+ "clean": "rimraf ./dist",
22
+ "precompile": "tsc -emitDeclarationOnly",
23
+ "compile": "vite build",
24
+ "postcompile": "node scripts/print-version.js"
24
25
  },
25
26
  "sideEffects": false,
26
- "typings": "lib/index.d.ts",
27
27
  "dependencies": {
28
- "@telia-ace/widget-core": "^1.0.4",
28
+ "@telia-ace/widget-core": "^1.0.5",
29
29
  "@telia-ace/widget-utilities": "^1.0.1",
30
30
  "@webprovisions/bootstrapping": "^1.0.12",
31
31
  "@webprovisions/platform": "^1.1.2"
32
32
  },
33
- "gitHead": "f926c4ce9547bb480c1c83dd7269387456e0e985"
33
+ "gitHead": "97a688fe894038d305e52cde3d2ca25b0eae8651"
34
34
  }
@@ -1,15 +0,0 @@
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;
package/lib/bootstrap.js DELETED
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var bootstrapping_1 = require("@webprovisions/bootstrapping");
4
- var platform_1 = require("@webprovisions/platform");
5
- /**
6
- * Bootstraps an `Implementation` by scanning trigger elements and attaches them to
7
- * their corresponding widgets.
8
- */
9
- exports.default = (function (implementation, configure, options) {
10
- if (options === void 0) { options = {}; }
11
- return (0, bootstrapping_1.bootstrapImplementation)(implementation, implementation.bindings, function () {
12
- var runtimeConfigurationHandlers = implementation.container
13
- .get('$runtimecfg')
14
- .map(function (cfgHandlerArgs) {
15
- var fnOrSelector = cfgHandlerArgs[0];
16
- if (typeof fnOrSelector === 'function') {
17
- return fnOrSelector;
18
- }
19
- if ((0, platform_1.selectImplementations)(fnOrSelector)(implementation)) {
20
- return cfgHandlerArgs[1];
21
- }
22
- })
23
- .filter(function (handler) { return !!handler; });
24
- return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);
25
- }, options.rootElementResolver || (function () { return document.body; }));
26
- });
@@ -1,87 +0,0 @@
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/lib/data-types.js DELETED
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PickerTypes = exports.DialogItemType = void 0;
4
- var DialogItemType;
5
- (function (DialogItemType) {
6
- DialogItemType["guide"] = "guide";
7
- DialogItemType["link"] = "link";
8
- DialogItemType["default"] = "default";
9
- })(DialogItemType = exports.DialogItemType || (exports.DialogItemType = {}));
10
- var PickerTypes;
11
- (function (PickerTypes) {
12
- PickerTypes["MODAL"] = "modal";
13
- PickerTypes["DRAWER"] = "drawer";
14
- PickerTypes["DROPDOWN"] = "dropdown";
15
- PickerTypes["NONE"] = "none";
16
- })(PickerTypes = exports.PickerTypes || (exports.PickerTypes = {}));
package/lib/humany.d.ts DELETED
@@ -1,48 +0,0 @@
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
- }
package/lib/humany.js DELETED
@@ -1,119 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- var bootstrapping_1 = require("@webprovisions/bootstrapping");
33
- var platform_1 = require("@webprovisions/platform");
34
- var version_1 = __importDefault(require("./version"));
35
- /**
36
- * The Humany widget runtime.
37
- */
38
- var Humany = /** @class */ (function (_super) {
39
- __extends(Humany, _super);
40
- function Humany(name, configurationApiExtensions) {
41
- if (configurationApiExtensions === void 0) { configurationApiExtensions = []; }
42
- return _super.call(this, name, configurationApiExtensions, {
43
- transformPluginSettings: function (settings, name, container) {
44
- var $settings = container.get('$settings');
45
- var configPluginSettings = $settings.plugins && name ? $settings.plugins[name] || {} : {};
46
- return __assign(__assign({}, configPluginSettings), settings);
47
- },
48
- }) || this;
49
- }
50
- Humany.prototype.createImplementation = function (configuration) {
51
- var implementation = _super.prototype.createImplementation.call(this, configuration);
52
- implementation.bindings = configuration.bindings;
53
- return implementation;
54
- };
55
- /**
56
- * Performs navigation for widgets matching the specified selector by invoking a
57
- * 'navigate' command.
58
- * @param selector Widget selector matching the widget(s) to perform navigation on.
59
- * @param route Route name.
60
- * @param params Route params.
61
- */
62
- Humany.prototype.navigate = function (selector, route, params) {
63
- this.widgets
64
- .query(selector)
65
- .forEach(function (widget) { return widget.invoke('navigate', { route: route, params: params }); });
66
- };
67
- /**
68
- * Creates a `Humany` runtime based on provided configuration.
69
- * @param configuration Runtime configuration.
70
- */
71
- Humany.create = function (configuration) {
72
- if (configuration === void 0) { configuration = {}; }
73
- var configurationApiExtensions = [bootstrapping_1.ConfigurationApi].concat(configuration.configurationApiExtensions || []);
74
- return new Humany('humany', configurationApiExtensions);
75
- };
76
- /**
77
- * Creates a `Humany` runtime based on provided configuration and retains configuration handlers
78
- * registered on global context. Use this factory to fully support the default embed script.
79
- * Will return any existing `Humany` runtime if available.
80
- * @param configuration Runtime configuration.
81
- * @param global Object to read configuration handlers from (default: window).
82
- */
83
- Humany.createFromGlobal = function (globalHumany, configuration) {
84
- if (configuration === void 0) { configuration = {}; }
85
- if (this.isRuntime(globalHumany)) {
86
- globalHumany.patch(configuration);
87
- return globalHumany;
88
- }
89
- var runtimeConfiguration = [];
90
- var tempRuntimeConfiguration = globalHumany && globalHumany._c;
91
- if (tempRuntimeConfiguration) {
92
- tempRuntimeConfiguration.forEach(function (args) { return runtimeConfiguration.push(args); });
93
- }
94
- var runtime = this.create(configuration);
95
- runtime.container.register('$runtimecfg', runtimeConfiguration);
96
- return runtime;
97
- };
98
- /**
99
- * Determines whether the specified object is a valid `Humany` runtime.
100
- * @param obj Object to compare.
101
- */
102
- Humany.isRuntime = function (obj) {
103
- if (obj &&
104
- typeof obj === 'object' &&
105
- obj.container &&
106
- typeof obj.container.get === 'function' &&
107
- obj.container.get('$environment') === obj &&
108
- obj.container.owner === obj) {
109
- return true;
110
- }
111
- return false;
112
- };
113
- /**
114
- * Version of the Humany runtime.
115
- */
116
- Humany.version = "".concat(version_1.default, " (").concat(platform_1.version, ")");
117
- return Humany;
118
- }(platform_1.Environment));
119
- exports.default = Humany;
@@ -1,7 +0,0 @@
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,31 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- var platform_1 = require("@webprovisions/platform");
19
- /**
20
- * Represents a Humany implementation.
21
- */
22
- var Implementation = /** @class */ (function (_super) {
23
- __extends(Implementation, _super);
24
- function Implementation() {
25
- var _this = _super !== null && _super.apply(this, arguments) || this;
26
- _this.bindings = [];
27
- return _this;
28
- }
29
- return Implementation;
30
- }(platform_1.Implementation));
31
- exports.default = Implementation;
package/lib/index.d.ts DELETED
@@ -1,13 +0,0 @@
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/lib/index.js DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- var __importDefault = (this && this.__importDefault) || function (mod) {
17
- return (mod && mod.__esModule) ? mod : { "default": mod };
18
- };
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.WidgetType = exports.version = exports.verifyAuth = exports.Plugin = exports.loadImplementation = exports.Implementation = exports.Humany = exports.bootstrap = exports.Widget = exports.destroy = exports.supportBootstrapping = void 0;
21
- __exportStar(require("@telia-ace/widget-core"), exports);
22
- var bootstrapping_1 = require("@webprovisions/bootstrapping");
23
- Object.defineProperty(exports, "supportBootstrapping", { enumerable: true, get: function () { return bootstrapping_1.supportBootstrapping; } });
24
- var platform_1 = require("@webprovisions/platform");
25
- Object.defineProperty(exports, "destroy", { enumerable: true, get: function () { return platform_1.destroyWidget; } });
26
- Object.defineProperty(exports, "Widget", { enumerable: true, get: function () { return platform_1.Widget; } });
27
- var bootstrap_1 = require("./bootstrap");
28
- Object.defineProperty(exports, "bootstrap", { enumerable: true, get: function () { return __importDefault(bootstrap_1).default; } });
29
- __exportStar(require("./data-types"), exports);
30
- var humany_1 = require("./humany");
31
- Object.defineProperty(exports, "Humany", { enumerable: true, get: function () { return __importDefault(humany_1).default; } });
32
- var implementation_1 = require("./implementation");
33
- Object.defineProperty(exports, "Implementation", { enumerable: true, get: function () { return __importDefault(implementation_1).default; } });
34
- var load_implementation_1 = require("./load-implementation");
35
- Object.defineProperty(exports, "loadImplementation", { enumerable: true, get: function () { return __importDefault(load_implementation_1).default; } });
36
- var plugin_1 = require("./plugin");
37
- Object.defineProperty(exports, "Plugin", { enumerable: true, get: function () { return __importDefault(plugin_1).default; } });
38
- var verify_auth_1 = require("./verify-auth");
39
- Object.defineProperty(exports, "verifyAuth", { enumerable: true, get: function () { return __importDefault(verify_auth_1).default; } });
40
- var version_1 = require("./version");
41
- Object.defineProperty(exports, "version", { enumerable: true, get: function () { return __importDefault(version_1).default; } });
42
- var widget_type_1 = require("./widget-type");
43
- Object.defineProperty(exports, "WidgetType", { enumerable: true, get: function () { return __importDefault(widget_type_1).default; } });
@@ -1,8 +0,0 @@
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,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Loads a Humany implementation by fetching the configuration from the specified URL.
5
- * @param implementationPath Implementation URL.
6
- */
7
- var loadImplementation = function (humany, url) {
8
- return fetch(url + '/config.json')
9
- .then(function (response) { return response.json(); })
10
- .then(function (json) { return json.implementation; })
11
- .then(function (configuration) {
12
- return humany.createImplementation(configuration);
13
- });
14
- };
15
- exports.default = loadImplementation;
package/lib/plugin.d.ts DELETED
@@ -1,7 +0,0 @@
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
- }
package/lib/plugin.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- var platform_1 = require("@webprovisions/platform");
19
- /**
20
- * Base class for a Humany plugin.
21
- */
22
- var Plugin = /** @class */ (function (_super) {
23
- __extends(Plugin, _super);
24
- function Plugin(container, settings) {
25
- return _super.call(this, container, settings) || this;
26
- }
27
- return Plugin;
28
- }(platform_1.Plugin));
29
- exports.default = Plugin;
@@ -1,2 +0,0 @@
1
- declare const verifyAuth: (host: string, widgetName: string) => Promise<boolean>;
2
- export default verifyAuth;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var verifyAuth = function (host, widgetName) {
4
- var url = "".concat(host).concat(widgetName, "/interfaceauthorized");
5
- return fetch(url, {
6
- method: 'GET',
7
- credentials: 'include',
8
- }).then(function (response) { return response.status === 200 && response.ok; });
9
- };
10
- exports.default = verifyAuth;
package/lib/version.d.ts DELETED
@@ -1,2 +0,0 @@
1
- declare const _default: "#____version____#";
2
- export default _default;
package/lib/version.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '#____version____#';
@@ -1,7 +0,0 @@
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,29 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- var platform_1 = require("@webprovisions/platform");
19
- /**
20
- * Base class for a Humany widget.
21
- */
22
- var WidgetType = /** @class */ (function (_super) {
23
- __extends(WidgetType, _super);
24
- function WidgetType(container) {
25
- return _super.call(this, container) || this;
26
- }
27
- return WidgetType;
28
- }(platform_1.WidgetType));
29
- exports.default = WidgetType;
@@ -1,24 +0,0 @@
1
- import { bootstrapImplementation } from '@webprovisions/bootstrapping';
2
- import { selectImplementations } from '@webprovisions/platform';
3
- /**
4
- * Bootstraps an `Implementation` by scanning trigger elements and attaches them to
5
- * their corresponding widgets.
6
- */
7
- export default (function (implementation, configure, options) {
8
- if (options === void 0) { options = {}; }
9
- return bootstrapImplementation(implementation, implementation.bindings, function () {
10
- var runtimeConfigurationHandlers = implementation.container
11
- .get('$runtimecfg')
12
- .map(function (cfgHandlerArgs) {
13
- var fnOrSelector = cfgHandlerArgs[0];
14
- if (typeof fnOrSelector === 'function') {
15
- return fnOrSelector;
16
- }
17
- if (selectImplementations(fnOrSelector)(implementation)) {
18
- return cfgHandlerArgs[1];
19
- }
20
- })
21
- .filter(function (handler) { return !!handler; });
22
- return (configure ? [configure] : []).concat(runtimeConfigurationHandlers);
23
- }, options.rootElementResolver || (function () { return document.body; }));
24
- });
@@ -1,13 +0,0 @@
1
- export var DialogItemType;
2
- (function (DialogItemType) {
3
- DialogItemType["guide"] = "guide";
4
- DialogItemType["link"] = "link";
5
- DialogItemType["default"] = "default";
6
- })(DialogItemType || (DialogItemType = {}));
7
- export var PickerTypes;
8
- (function (PickerTypes) {
9
- PickerTypes["MODAL"] = "modal";
10
- PickerTypes["DRAWER"] = "drawer";
11
- PickerTypes["DROPDOWN"] = "dropdown";
12
- PickerTypes["NONE"] = "none";
13
- })(PickerTypes || (PickerTypes = {}));
package/lib-esm/humany.js DELETED
@@ -1,114 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- var __assign = (this && this.__assign) || function () {
17
- __assign = Object.assign || function(t) {
18
- for (var s, i = 1, n = arguments.length; i < n; i++) {
19
- s = arguments[i];
20
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
- t[p] = s[p];
22
- }
23
- return t;
24
- };
25
- return __assign.apply(this, arguments);
26
- };
27
- import { ConfigurationApi as BootstrappingConfigurationApi, } from '@webprovisions/bootstrapping';
28
- import { Environment, version as webprovisionsVersion, } from '@webprovisions/platform';
29
- import version from './version';
30
- /**
31
- * The Humany widget runtime.
32
- */
33
- var Humany = /** @class */ (function (_super) {
34
- __extends(Humany, _super);
35
- function Humany(name, configurationApiExtensions) {
36
- if (configurationApiExtensions === void 0) { configurationApiExtensions = []; }
37
- return _super.call(this, name, configurationApiExtensions, {
38
- transformPluginSettings: function (settings, name, container) {
39
- var $settings = container.get('$settings');
40
- var configPluginSettings = $settings.plugins && name ? $settings.plugins[name] || {} : {};
41
- return __assign(__assign({}, configPluginSettings), settings);
42
- },
43
- }) || this;
44
- }
45
- Humany.prototype.createImplementation = function (configuration) {
46
- var implementation = _super.prototype.createImplementation.call(this, configuration);
47
- implementation.bindings = configuration.bindings;
48
- return implementation;
49
- };
50
- /**
51
- * Performs navigation for widgets matching the specified selector by invoking a
52
- * 'navigate' command.
53
- * @param selector Widget selector matching the widget(s) to perform navigation on.
54
- * @param route Route name.
55
- * @param params Route params.
56
- */
57
- Humany.prototype.navigate = function (selector, route, params) {
58
- this.widgets
59
- .query(selector)
60
- .forEach(function (widget) { return widget.invoke('navigate', { route: route, params: params }); });
61
- };
62
- /**
63
- * Creates a `Humany` runtime based on provided configuration.
64
- * @param configuration Runtime configuration.
65
- */
66
- Humany.create = function (configuration) {
67
- if (configuration === void 0) { configuration = {}; }
68
- var configurationApiExtensions = [BootstrappingConfigurationApi].concat(configuration.configurationApiExtensions || []);
69
- return new Humany('humany', configurationApiExtensions);
70
- };
71
- /**
72
- * Creates a `Humany` runtime based on provided configuration and retains configuration handlers
73
- * registered on global context. Use this factory to fully support the default embed script.
74
- * Will return any existing `Humany` runtime if available.
75
- * @param configuration Runtime configuration.
76
- * @param global Object to read configuration handlers from (default: window).
77
- */
78
- Humany.createFromGlobal = function (globalHumany, configuration) {
79
- if (configuration === void 0) { configuration = {}; }
80
- if (this.isRuntime(globalHumany)) {
81
- globalHumany.patch(configuration);
82
- return globalHumany;
83
- }
84
- var runtimeConfiguration = [];
85
- var tempRuntimeConfiguration = globalHumany && globalHumany._c;
86
- if (tempRuntimeConfiguration) {
87
- tempRuntimeConfiguration.forEach(function (args) { return runtimeConfiguration.push(args); });
88
- }
89
- var runtime = this.create(configuration);
90
- runtime.container.register('$runtimecfg', runtimeConfiguration);
91
- return runtime;
92
- };
93
- /**
94
- * Determines whether the specified object is a valid `Humany` runtime.
95
- * @param obj Object to compare.
96
- */
97
- Humany.isRuntime = function (obj) {
98
- if (obj &&
99
- typeof obj === 'object' &&
100
- obj.container &&
101
- typeof obj.container.get === 'function' &&
102
- obj.container.get('$environment') === obj &&
103
- obj.container.owner === obj) {
104
- return true;
105
- }
106
- return false;
107
- };
108
- /**
109
- * Version of the Humany runtime.
110
- */
111
- Humany.version = "".concat(version, " (").concat(webprovisionsVersion, ")");
112
- return Humany;
113
- }(Environment));
114
- export default Humany;
@@ -1,29 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { Implementation as ImplementationBase } from '@webprovisions/platform';
17
- /**
18
- * Represents a Humany implementation.
19
- */
20
- var Implementation = /** @class */ (function (_super) {
21
- __extends(Implementation, _super);
22
- function Implementation() {
23
- var _this = _super !== null && _super.apply(this, arguments) || this;
24
- _this.bindings = [];
25
- return _this;
26
- }
27
- return Implementation;
28
- }(ImplementationBase));
29
- export default Implementation;
package/lib-esm/index.js DELETED
@@ -1,12 +0,0 @@
1
- export * from '@telia-ace/widget-core';
2
- export { supportBootstrapping } from '@webprovisions/bootstrapping';
3
- export { destroyWidget as destroy, Widget } from '@webprovisions/platform';
4
- export { default as bootstrap } from './bootstrap';
5
- export * from './data-types';
6
- export { default as Humany } from './humany';
7
- export { default as Implementation } from './implementation';
8
- export { default as loadImplementation } from './load-implementation';
9
- export { default as Plugin } from './plugin';
10
- export { default as verifyAuth } from './verify-auth';
11
- export { default as version } from './version';
12
- export { default as WidgetType } from './widget-type';
@@ -1,13 +0,0 @@
1
- /**
2
- * Loads a Humany implementation by fetching the configuration from the specified URL.
3
- * @param implementationPath Implementation URL.
4
- */
5
- var loadImplementation = function (humany, url) {
6
- return fetch(url + '/config.json')
7
- .then(function (response) { return response.json(); })
8
- .then(function (json) { return json.implementation; })
9
- .then(function (configuration) {
10
- return humany.createImplementation(configuration);
11
- });
12
- };
13
- export default loadImplementation;
package/lib-esm/plugin.js DELETED
@@ -1,27 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { Plugin as PluginBase } from '@webprovisions/platform';
17
- /**
18
- * Base class for a Humany plugin.
19
- */
20
- var Plugin = /** @class */ (function (_super) {
21
- __extends(Plugin, _super);
22
- function Plugin(container, settings) {
23
- return _super.call(this, container, settings) || this;
24
- }
25
- return Plugin;
26
- }(PluginBase));
27
- export default Plugin;
@@ -1,8 +0,0 @@
1
- var verifyAuth = function (host, widgetName) {
2
- var url = "".concat(host).concat(widgetName, "/interfaceauthorized");
3
- return fetch(url, {
4
- method: 'GET',
5
- credentials: 'include',
6
- }).then(function (response) { return response.status === 200 && response.ok; });
7
- };
8
- export default verifyAuth;
@@ -1 +0,0 @@
1
- export default '#____version____#';
@@ -1,27 +0,0 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- if (typeof b !== "function" && b !== null)
10
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
- extendStatics(d, b);
12
- function __() { this.constructor = d; }
13
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
- };
15
- })();
16
- import { WidgetType as WidgetTypeBase } from '@webprovisions/platform';
17
- /**
18
- * Base class for a Humany widget.
19
- */
20
- var WidgetType = /** @class */ (function (_super) {
21
- __extends(WidgetType, _super);
22
- function WidgetType(container) {
23
- return _super.call(this, container) || this;
24
- }
25
- return WidgetType;
26
- }(WidgetTypeBase));
27
- export default WidgetType;