@telia-ace/knowledge-widget-adapters 1.0.3 → 1.0.5

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.
@@ -38,6 +38,7 @@ declare class ContactMethodPlatform {
38
38
  private subs;
39
39
  static create(container: Container): Promise<ContactMethodPlatform>;
40
40
  constructor(container: Container, componentPlatform: ComponentPlatform);
41
+ static getInstance(container: Container, key?: string): Promise<ContactMethodPlatform>;
41
42
  private track;
42
43
  complete(contactMethod: ContactMethodProps): void | Promise<void>;
43
44
  evaluate(contactMethod: ContactMethodProps): Promise<Form>;
@@ -49,6 +49,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
49
49
  Object.defineProperty(exports, "__esModule", { value: true });
50
50
  exports.ContactMethodTrackTypes = void 0;
51
51
  var knowledge_widget_core_1 = require("@telia-ace/knowledge-widget-core");
52
+ var widget_utilities_1 = require("@telia-ace/widget-utilities");
52
53
  var react_1 = require("react");
53
54
  var email_1 = require("./email");
54
55
  var ContactMethodTrackTypes;
@@ -185,6 +186,22 @@ var ContactMethodPlatform = /** @class */ (function () {
185
186
  return new ContactMethodPlatform(container, platform);
186
187
  });
187
188
  };
189
+ ContactMethodPlatform.getInstance = function (container, key) {
190
+ if (key === void 0) { key = 'contactMethods'; }
191
+ return (0, widget_utilities_1.lock)(container)(function () {
192
+ return container.getAsync(key).then(function (value) {
193
+ var contactMethodPlatform = value;
194
+ if (!contactMethodPlatform) {
195
+ return knowledge_widget_core_1.ComponentPlatform.getInstance(container).then(function (components) {
196
+ contactMethodPlatform = new ContactMethodPlatform(container, components);
197
+ container.registerAsync(key, function () { return contactMethodPlatform; });
198
+ return contactMethodPlatform;
199
+ });
200
+ }
201
+ return contactMethodPlatform;
202
+ });
203
+ });
204
+ };
188
205
  ContactMethodPlatform.prototype.track = function (data, type) {
189
206
  if (data === void 0) { data = {}; }
190
207
  var events = this.container.get('$widget').events;
@@ -1,2 +1,3 @@
1
- declare const _default: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("@telia-ace/knowledge-widget-ui").HtmlProps, "html" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "htmlParseInstruction"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
1
+ /// <reference types="react" />
2
+ declare const _default: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("@telia-ace/knowledge-widget-ui").HtmlProps, "html" | "key" | "htmlParseInstruction" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
2
3
  export default _default;
@@ -38,6 +38,7 @@ declare class ContactMethodPlatform {
38
38
  private subs;
39
39
  static create(container: Container): Promise<ContactMethodPlatform>;
40
40
  constructor(container: Container, componentPlatform: ComponentPlatform);
41
+ static getInstance(container: Container, key?: string): Promise<ContactMethodPlatform>;
41
42
  private track;
42
43
  complete(contactMethod: ContactMethodProps): void | Promise<void>;
43
44
  evaluate(contactMethod: ContactMethodProps): Promise<Form>;
@@ -46,6 +46,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  }
47
47
  };
48
48
  import { ComponentPlatform } from '@telia-ace/knowledge-widget-core';
49
+ import { lock } from '@telia-ace/widget-utilities';
49
50
  import { lazy } from 'react';
50
51
  import { defaultComplete, defaultEvaluate, defaultValidate } from './email';
51
52
  export var ContactMethodTrackTypes;
@@ -182,6 +183,22 @@ var ContactMethodPlatform = /** @class */ (function () {
182
183
  return new ContactMethodPlatform(container, platform);
183
184
  });
184
185
  };
186
+ ContactMethodPlatform.getInstance = function (container, key) {
187
+ if (key === void 0) { key = 'contactMethods'; }
188
+ return lock(container)(function () {
189
+ return container.getAsync(key).then(function (value) {
190
+ var contactMethodPlatform = value;
191
+ if (!contactMethodPlatform) {
192
+ return ComponentPlatform.getInstance(container).then(function (components) {
193
+ contactMethodPlatform = new ContactMethodPlatform(container, components);
194
+ container.registerAsync(key, function () { return contactMethodPlatform; });
195
+ return contactMethodPlatform;
196
+ });
197
+ }
198
+ return contactMethodPlatform;
199
+ });
200
+ });
201
+ };
185
202
  ContactMethodPlatform.prototype.track = function (data, type) {
186
203
  if (data === void 0) { data = {}; }
187
204
  var events = this.container.get('$widget').events;
@@ -1,2 +1,3 @@
1
- declare const _default: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("@telia-ace/knowledge-widget-ui").HtmlProps, "html" | "key" | keyof import("react").HTMLAttributes<HTMLDivElement> | "htmlParseInstruction"> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
1
+ /// <reference types="react" />
2
+ declare const _default: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("@telia-ace/knowledge-widget-ui").HtmlProps, "html" | "key" | "htmlParseInstruction" | keyof import("react").HTMLAttributes<HTMLDivElement>> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
2
3
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telia-ace/knowledge-widget-adapters",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "ACE knowledge adapters for ACE widgets.",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "Telia Company AB",
@@ -25,13 +25,15 @@
25
25
  "sideEffects": false,
26
26
  "typings": "lib/index.d.ts",
27
27
  "dependencies": {
28
- "@telia-ace/knowledge-serviceclient": "^1.0.2",
29
- "@telia-ace/knowledge-widget-core": "^1.0.2",
30
- "@telia-ace/knowledge-widget-ui": "^1.0.3",
31
- "@telia-ace/widget-forms": "^1.0.3",
32
- "@telia-ace/widget-routing": "^1.0.2",
28
+ "@telia-ace/knowledge-serviceclient": "^1.0.3",
29
+ "@telia-ace/knowledge-widget-core": "^1.0.4",
30
+ "@telia-ace/knowledge-widget-ui": "^1.0.5",
31
+ "@telia-ace/widget-forms": "^1.0.6",
32
+ "@telia-ace/widget-routing": "^1.0.5",
33
33
  "@telia-ace/widget-utilities": "^1.0.1",
34
- "@webprovisions/platform": "^1.1.2",
34
+ "@webprovisions/platform": "^1.1.2"
35
+ },
36
+ "peerDependencies": {
35
37
  "react": "^16.8.0",
36
38
  "styled-components": "^4.3.2"
37
39
  },
@@ -39,5 +41,5 @@
39
41
  "@types/react": "^16.8.0",
40
42
  "@types/styled-components": "^5.1.7"
41
43
  },
42
- "gitHead": "7fcc0c30b8044e004ac9e08980c57092bf66a9cf"
44
+ "gitHead": "b84b9fb41331ff23cd0e6845fe8ff94aafaf7df3"
43
45
  }