@telia-ace/knowledge-widget-core 1.0.20-next.5 → 1.0.20-next.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.
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  var g = Object.defineProperty;
2
- var m = Object.getOwnPropertySymbols;
2
+ var f = Object.getOwnPropertySymbols;
3
3
  var l = Object.prototype.hasOwnProperty, h = Object.prototype.propertyIsEnumerable;
4
4
  var c = (e, t, n) => t in e ? g(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, a = (e, t) => {
5
5
  for (var n in t || (t = {}))
6
6
  l.call(t, n) && c(e, n, t[n]);
7
- if (m)
8
- for (var n of m(t))
7
+ if (f)
8
+ for (var n of f(t))
9
9
  h.call(t, n) && c(e, n, t[n]);
10
10
  return e;
11
11
  };
12
12
  var u = (e, t, n) => (c(e, typeof t != "symbol" ? t + "" : t, n), n);
13
13
  export * from "@telia-ace/widget-core";
14
14
  import { bootstrapImplementation as v, ConfigurationApi as $ } from "@webprovisions/bootstrapping";
15
- import { supportBootstrapping as L } from "@webprovisions/bootstrapping";
16
- import { selectImplementations as x, Environment as E, version as _, Implementation as I, Plugin as R, WidgetType as W } from "@webprovisions/platform";
17
- import { Widget as J, destroyWidget as K } from "@webprovisions/platform";
18
- const S = (e, t, n = {}) => v(
15
+ import { supportBootstrapping as J } from "@webprovisions/bootstrapping";
16
+ import { selectImplementations as x, Environment as E, version as I, Implementation as _, Plugin as A, WidgetType as R } from "@webprovisions/platform";
17
+ import { Widget as Q, destroyWidget as U } from "@webprovisions/platform";
18
+ const D = (e, t, n = {}) => v(
19
19
  e,
20
20
  e.bindings,
21
21
  () => {
@@ -30,8 +30,8 @@ const S = (e, t, n = {}) => v(
30
30
  },
31
31
  n.rootElementResolver || (() => document.body)
32
32
  );
33
- var w = /* @__PURE__ */ ((e) => (e.guide = "guide", e.link = "link", e.default = "default", e))(w || {}), A = /* @__PURE__ */ ((e) => (e.MODAL = "modal", e.DRAWER = "drawer", e.DROPDOWN = "dropdown", e.NONE = "none", e))(A || {});
34
- const O = "a833e37", f = class extends E {
33
+ var W = /* @__PURE__ */ ((e) => (e.guide = "guide", e.link = "link", e.default = "default", e))(W || {}), w = /* @__PURE__ */ ((e) => (e.MODAL = "modal", e.DRAWER = "drawer", e.DROPDOWN = "dropdown", e.NONE = "none", e))(w || {});
34
+ const O = "9a104ad", p = class extends E {
35
35
  constructor(t, n = []) {
36
36
  super(t, n, {
37
37
  transformPluginSettings: (i, r, o) => {
@@ -51,7 +51,7 @@ const O = "a833e37", f = class extends E {
51
51
  const n = [$].concat(
52
52
  t.configurationApiExtensions || []
53
53
  );
54
- return new f("humany", n);
54
+ return new p("humany", n);
55
55
  }
56
56
  static createFromGlobal(t, n = {}) {
57
57
  if (this.isRuntime(t))
@@ -65,47 +65,47 @@ const O = "a833e37", f = class extends E {
65
65
  return !!(t && typeof t == "object" && t.container && typeof t.container.get == "function" && t.container.get("$environment") === t && t.container.owner === t);
66
66
  }
67
67
  };
68
- let p = f;
69
- u(p, "version", `${O} (${_})`);
70
- class D extends I {
68
+ let m = p;
69
+ u(m, "version", `${O} (${I})`);
70
+ class G extends _ {
71
71
  constructor() {
72
72
  super(...arguments);
73
73
  u(this, "bindings", []);
74
74
  }
75
75
  }
76
- const G = (e, t) => fetch(t + "/config.json").then((n) => n.json()).then((n) => n.implementation).then(
76
+ const C = (e, t) => fetch(t + "/config.json").then((n) => n.json()).then((n) => n.implementation).then(
77
77
  (n) => e.createImplementation(n)
78
- );
79
- class k extends R {
78
+ ), k = C;
79
+ class q extends A {
80
80
  constructor(t, n) {
81
81
  super(t, n);
82
82
  }
83
83
  }
84
- const q = (e, t) => {
84
+ const y = (e, t) => {
85
85
  const n = `${e}${t}/interfaceauthorized`;
86
86
  return fetch(n, {
87
87
  method: "GET",
88
88
  credentials: "include"
89
89
  }).then((i) => i.status === 200 && i.ok);
90
- };
91
- class y extends W {
90
+ }, z = y;
91
+ class B extends R {
92
92
  constructor(t) {
93
93
  super(t);
94
94
  }
95
95
  }
96
96
  export {
97
- w as DialogItemType,
98
- p as Humany,
99
- D as Implementation,
100
- A as PickerTypes,
101
- k as Plugin,
102
- J as Widget,
103
- y as WidgetType,
104
- S as bootstrap,
105
- K as destroy,
106
- G as loadImplementation,
107
- L as supportBootstrapping,
108
- q as verifyAuth,
97
+ W as DialogItemType,
98
+ m as Humany,
99
+ G as Implementation,
100
+ w as PickerTypes,
101
+ q as Plugin,
102
+ Q as Widget,
103
+ B as WidgetType,
104
+ D as bootstrap,
105
+ U as destroy,
106
+ k as loadImplementation,
107
+ J as supportBootstrapping,
108
+ z as verifyAuth,
109
109
  O as version
110
110
  };
111
111
  //# sourceMappingURL=index.js.map
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 connectionKey?: 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":["bootstrap","implementation","configure","options","bootstrapImplementation","runtimeConfigurationHandlers","cfgHandlerArgs","fnOrSelector","selectImplementations","handler","DialogItemType","PickerTypes","version","_Humany","Environment","name","configurationApiExtensions","settings","container","$settings","configPluginSettings","__spreadValues","configuration","selector","route","params","widget","BootstrappingConfigurationApi","globalHumany","runtimeConfiguration","tempRuntimeConfiguration","args","runtime","obj","Humany","__publicField","webprovisionsVersion","Implementation","ImplementationBase","loadImplementation","humany","url","response","json","Plugin","PluginBase","verifyAuth","host","widgetName","WidgetType","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAeA,IAAA,CACXC,GACAC,GACAC,IAA4B,OAErBC;AAAA,EACHH;AAAA,EACAA,EAAe;AAAA,EACf,MAAM;AACI,UAAAI,IAA+BJ,EAAe,UAC/C,IAAI,aAAa,EACjB,IAAI,CAACK,MAAwB;AAC1B,YAAMC,IAAeD,EAAe;AAChC,UAAA,OAAOC,KAAiB;AACjB,eAAAA;AAEX,UAAIC,EAAsBD,CAAY,EAAEN,CAAc;AAClD,eAAOK,EAAe;AAAA,IAE7B,CAAA,EACA,OAAO,CAACG,MAAiB,CAAC,CAACA,CAAO;AACvC,YAAQP,IAAY,CAACA,CAAS,IAAI,CAAA,GAAI,OAAOG,CAA4B;AAAA,EAC7E;AAAA,EACAF,EAAQ,wBAAwB,MAAM,SAAS;AAAA;ACJ3C,IAAAO,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GA2DAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,WAAW,YACXA,EAAA,OAAO,QAJCA,IAAAA,KAAA,CAAA,CAAA;AC7FZ,MAAAC,IAAe,qBCuBMC,IAArB,cAAoCC,EAAY;AAAA,EAM5C,YAAYC,GAAcC,IAA2D,IAAI;AACrF,UAAMD,GAAMC,GAA4B;AAAA,MACpC,yBAAyB,CAACC,GAAUF,GAAMG,MAAc;AAC9C,cAAAC,IAAYD,EAAU,IAAI,WAAW,GACrCE,IACFD,EAAU,WAAWJ,I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C,UAAuBC,EAAmB;AAAA,EAA/D;AAAA;AACI,IAAAH,EAAA,kBAAqB,CAAA;AAAA;AACzB;ACCM,MAAAI,IAAqB,CAACC,GAAgBC,MACjC,MAAMA,IAAM,cAAc,EAC5B,KAAK,CAACC,MAAaA,EAAS,KAAM,CAAA,EAClC,KAAK,CAACC,MAASA,EAAK,cAAc,EAClC;AAAA,EAAK,CAACrB,MACHkB,EAAO,qBAAqBlB,CAAa;AAAA;ACRrD,MAAqBsB,UAAeC,EAAW;AAAA,EAC3C,YAAY3B,GAAsBD,GAAgB;AAC9C,UAAMC,GAAWD,CAAQ;AAAA,EAC7B;AACJ;ACTM,MAAA6B,IAAa,CAACC,GAAcC,MAAyC;AACjE,QAAAP,IAAM,GAAGM,IAAOC;AAEtB,SAAO,MAAMP,GAAK;AAAA,IACd,QAAQ;AAAA,IACR,aAAa;AAAA,EAAA,CAChB,EAAE,KAAK,CAACC,MAAaA,EAAS,WAAW,OAAOA,EAAS,EAAE;AAChE;ACFA,MAAqBO,UAAmBC,EAAe;AAAA,EACnD,YAAYhC,GAAsB;AAC9B,UAAMA,CAAS;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';\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 connectionKey?: 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":["bootstrap","implementation","configure","options","bootstrapImplementation","runtimeConfigurationHandlers","cfgHandlerArgs","fnOrSelector","selectImplementations","handler","DialogItemType","PickerTypes","version","_Humany","Environment","name","configurationApiExtensions","settings","container","$settings","configPluginSettings","__spreadValues","configuration","selector","route","params","widget","BootstrappingConfigurationApi","globalHumany","runtimeConfiguration","tempRuntimeConfiguration","args","runtime","obj","Humany","__publicField","webprovisionsVersion","Implementation","ImplementationBase","loadImplementation","humany","url","response","json","loadImplementation$1","Plugin","PluginBase","verifyAuth","host","widgetName","verifyAuth$1","WidgetType","WidgetTypeBase"],"mappings":";;;;;;;;;;;;;;;;;AAeA,MAAeA,IAAA,CACXC,GACAC,GACAC,IAA4B,OAErBC;AAAA,EACHH;AAAA,EACAA,EAAe;AAAA,EACf,MAAM;AACI,UAAAI,IAA+BJ,EAAe,UAC/C,IAAI,aAAa,EACjB,IAAI,CAACK,MAAwB;AAC1B,YAAMC,IAAeD,EAAe;AAChC,UAAA,OAAOC,KAAiB;AACjB,eAAAA;AAEX,UAAIC,EAAsBD,CAAY,EAAEN,CAAc;AAClD,eAAOK,EAAe;AAAA,IAE7B,CAAA,EACA,OAAO,CAACG,MAAiB,CAAC,CAACA,CAAO;AACvC,YAAQP,IAAY,CAACA,CAAS,IAAI,CAAA,GAAI,OAAOG,CAA4B;AAAA,EAC7E;AAAA,EACAF,EAAQ,wBAAwB,MAAM,SAAS;AAAA;ACJ3C,IAAAO,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,OAAO,QACPA,EAAA,UAAU,WAHFA,IAAAA,KAAA,CAAA,CAAA,GA2DAC,sBAAAA,OACRA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,WAAW,YACXA,EAAA,OAAO,QAJCA,IAAAA,KAAA,CAAA,CAAA;AC7FZ,M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OA,KAAQ,YACfA,EAAI,aACJ,OAAOA,EAAI,UAAU,OAAQ,cAC7BA,EAAI,UAAU,IAAI,cAAc,MAAMA,KACtCA,EAAI,UAAU,UAAUA;AAAA,EAKhC;AACJ;AA5FA,IAAqBC,IAArBrB;AAIIsB,EAJiBD,GAIV,WAAkB,GAAGtB,MAAYwB;ACtB5C,MAAqBC,UAAuBC,EAAmB;AAAA,EAA/D;AAAA;AACI,IAAAH,EAAA,kBAAqB,CAAA;AAAA;AACzB;ACCA,MAAMI,IAAqB,CAACC,GAAgBC,MACjC,MAAMA,IAAM,cAAc,EAC5B,KAAK,CAACC,MAAaA,EAAS,KAAM,CAAA,EAClC,KAAK,CAACC,MAASA,EAAK,cAAc,EAClC;AAAA,EAAK,CAACrB,MACHkB,EAAO,qBAAqBlB,CAAa;AAAA,GAGrDsB,IAAeL;ACXf,MAAqBM,UAAeC,EAAW;AAAA,EAC3C,YAAY5B,GAAsBD,GAAgB;AAC9C,UAAMC,GAAWD,CAAQ;AAAA,EAC7B;AACJ;ACTA,MAAM8B,IAAa,CAACC,GAAcC,MAAyC;AACjE,QAAAR,IAAM,GAAGO,IAAOC;AAEtB,SAAO,MAAMR,GAAK;AAAA,IACd,QAAQ;AAAA,IACR,aAAa;AAAA,EAAA,CAChB,EAAE,KAAK,CAACC,MAAaA,EAAS,WAAW,OAAOA,EAAS,EAAE;AAChE,GAEAQ,IAAeH;ACJf,MAAqBI,UAAmBC,EAAe;AAAA,EACnD,YAAYlC,GAAsB;AAC9B,UAAMA,CAAS;AAAA,EACnB;AACJ;"}
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "a833e37";
1
+ declare const _default: "9a104ad";
2
2
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-core",
3
- "version": "1.0.20-next.5",
3
+ "version": "1.0.20-next.7",
4
4
  "description": "Core framework for ACE Knowledge widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -32,5 +32,5 @@
32
32
  "@webprovisions/bootstrapping": "^1.0.12",
33
33
  "@webprovisions/platform": "^1.1.2"
34
34
  },
35
- "gitHead": "e3a86add79b0fa0617415777f6088b5764993959"
35
+ "gitHead": "fdfbe1548c53bb13e76684648742730cb31090b7"
36
36
  }