@telia-ace/knowledge-widget-adapters 1.0.13 → 1.0.14

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 (125) hide show
  1. package/{lib-esm → dist}/contact-methods/chat-popup/chat-popup-plugin.d.ts +0 -0
  2. package/{lib-esm → dist}/contact-methods/chat-popup/index.d.ts +0 -0
  3. package/{lib-esm → dist}/contact-methods/email/email-form-component.d.ts +0 -0
  4. package/{lib-esm → dist}/contact-methods/email/email-plugin.d.ts +0 -0
  5. package/{lib-esm → dist}/contact-methods/email/index.d.ts +0 -0
  6. package/{lib-esm → dist}/contact-methods/free-text/free-text-component.d.ts +0 -0
  7. package/{lib-esm → dist}/contact-methods/free-text/free-text-plugin.d.ts +0 -0
  8. package/{lib-esm → dist}/contact-methods/free-text/index.d.ts +0 -0
  9. package/{lib-esm → dist}/contact-methods/index.d.ts +0 -0
  10. package/{lib-esm → dist}/contact-methods/link/index.d.ts +0 -0
  11. package/{lib-esm → dist}/contact-methods/link/link-component.d.ts +0 -0
  12. package/{lib-esm → dist}/contact-methods/link/link-plugin.d.ts +0 -0
  13. package/{lib-esm → dist}/contact-methods/phone/index.d.ts +0 -0
  14. package/{lib-esm → dist}/contact-methods/phone/phone-component.d.ts +0 -0
  15. package/{lib-esm → dist}/contact-methods/phone/phone-plugin.d.ts +0 -0
  16. package/{lib-esm → dist}/contact-methods/platform.d.ts +0 -0
  17. package/{lib-esm → dist}/contact-methods/ui/confirmation.d.ts +0 -0
  18. package/{lib-esm → dist}/contact-methods/ui/contact-list.d.ts +0 -0
  19. package/{lib-esm → dist}/contact-methods/ui/contact-method.d.ts +0 -0
  20. package/{lib-esm → dist}/contact-methods/ui/description.d.ts +0 -0
  21. package/{lib-esm → dist}/contact-methods/ui/form.d.ts +0 -0
  22. package/{lib-esm → dist}/contact-methods/ui/index.d.ts +0 -0
  23. package/{lib-esm → dist}/contact-methods/ui/use-contact-method.d.ts +0 -0
  24. package/{lib-esm → dist}/contact-methods/web-service/index.d.ts +0 -0
  25. package/{lib-esm → dist}/contact-methods/web-service/web-service-plugin.d.ts +0 -0
  26. package/{lib-esm → dist}/create-adapter.d.ts +0 -0
  27. package/{lib-esm → dist}/default-contact-methods-plugin.d.ts +0 -0
  28. package/dist/email-form-component.js +63 -0
  29. package/dist/email-form-component.js.map +1 -0
  30. package/dist/free-text-component.js +31 -0
  31. package/dist/free-text-component.js.map +1 -0
  32. package/{lib-esm → dist}/index.d.ts +0 -0
  33. package/dist/index.js +8 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/index2.js +699 -0
  36. package/dist/index2.js.map +1 -0
  37. package/dist/link-component.js +16 -0
  38. package/dist/link-component.js.map +1 -0
  39. package/dist/phone-component.js +15 -0
  40. package/dist/phone-component.js.map +1 -0
  41. package/package.json +12 -13
  42. package/lib/contact-methods/chat-popup/chat-popup-plugin.d.ts +0 -2
  43. package/lib/contact-methods/chat-popup/chat-popup-plugin.js +0 -79
  44. package/lib/contact-methods/chat-popup/index.d.ts +0 -1
  45. package/lib/contact-methods/chat-popup/index.js +0 -8
  46. package/lib/contact-methods/email/email-form-component.d.ts +0 -4
  47. package/lib/contact-methods/email/email-form-component.js +0 -58
  48. package/lib/contact-methods/email/email-plugin.d.ts +0 -16
  49. package/lib/contact-methods/email/email-plugin.js +0 -83
  50. package/lib/contact-methods/email/index.d.ts +0 -1
  51. package/lib/contact-methods/email/index.js +0 -12
  52. package/lib/contact-methods/free-text/free-text-component.d.ts +0 -4
  53. package/lib/contact-methods/free-text/free-text-component.js +0 -49
  54. package/lib/contact-methods/free-text/free-text-plugin.d.ts +0 -2
  55. package/lib/contact-methods/free-text/free-text-plugin.js +0 -34
  56. package/lib/contact-methods/free-text/index.d.ts +0 -1
  57. package/lib/contact-methods/free-text/index.js +0 -8
  58. package/lib/contact-methods/index.d.ts +0 -10
  59. package/lib/contact-methods/index.js +0 -31
  60. package/lib/contact-methods/link/index.d.ts +0 -1
  61. package/lib/contact-methods/link/index.js +0 -8
  62. package/lib/contact-methods/link/link-component.d.ts +0 -4
  63. package/lib/contact-methods/link/link-component.js +0 -13
  64. package/lib/contact-methods/link/link-plugin.d.ts +0 -2
  65. package/lib/contact-methods/link/link-plugin.js +0 -34
  66. package/lib/contact-methods/phone/index.d.ts +0 -1
  67. package/lib/contact-methods/phone/index.js +0 -8
  68. package/lib/contact-methods/phone/phone-component.d.ts +0 -4
  69. package/lib/contact-methods/phone/phone-component.js +0 -12
  70. package/lib/contact-methods/phone/phone-plugin.d.ts +0 -2
  71. package/lib/contact-methods/phone/phone-plugin.js +0 -34
  72. package/lib/contact-methods/platform.d.ts +0 -50
  73. package/lib/contact-methods/platform.js +0 -273
  74. package/lib/contact-methods/ui/confirmation.d.ts +0 -6
  75. package/lib/contact-methods/ui/confirmation.js +0 -47
  76. package/lib/contact-methods/ui/contact-list.d.ts +0 -15
  77. package/lib/contact-methods/ui/contact-list.js +0 -61
  78. package/lib/contact-methods/ui/contact-method.d.ts +0 -39
  79. package/lib/contact-methods/ui/contact-method.js +0 -110
  80. package/lib/contact-methods/ui/description.d.ts +0 -2
  81. package/lib/contact-methods/ui/description.js +0 -13
  82. package/lib/contact-methods/ui/form.d.ts +0 -4
  83. package/lib/contact-methods/ui/form.js +0 -54
  84. package/lib/contact-methods/ui/index.d.ts +0 -7
  85. package/lib/contact-methods/ui/index.js +0 -20
  86. package/lib/contact-methods/ui/use-contact-method.d.ts +0 -2
  87. package/lib/contact-methods/ui/use-contact-method.js +0 -39
  88. package/lib/contact-methods/web-service/index.d.ts +0 -1
  89. package/lib/contact-methods/web-service/index.js +0 -8
  90. package/lib/contact-methods/web-service/web-service-plugin.d.ts +0 -2
  91. package/lib/contact-methods/web-service/web-service-plugin.js +0 -30
  92. package/lib/create-adapter.d.ts +0 -7
  93. package/lib/create-adapter.js +0 -43
  94. package/lib/default-contact-methods-plugin.d.ts +0 -8
  95. package/lib/default-contact-methods-plugin.js +0 -42
  96. package/lib/index.d.ts +0 -5
  97. package/lib/index.js +0 -25
  98. package/lib-esm/contact-methods/chat-popup/chat-popup-plugin.js +0 -76
  99. package/lib-esm/contact-methods/chat-popup/index.js +0 -1
  100. package/lib-esm/contact-methods/email/email-form-component.js +0 -33
  101. package/lib-esm/contact-methods/email/email-plugin.js +0 -52
  102. package/lib-esm/contact-methods/email/index.js +0 -1
  103. package/lib-esm/contact-methods/free-text/free-text-component.js +0 -21
  104. package/lib-esm/contact-methods/free-text/free-text-plugin.js +0 -8
  105. package/lib-esm/contact-methods/free-text/index.js +0 -1
  106. package/lib-esm/contact-methods/index.js +0 -8
  107. package/lib-esm/contact-methods/link/index.js +0 -1
  108. package/lib-esm/contact-methods/link/link-component.js +0 -11
  109. package/lib-esm/contact-methods/link/link-plugin.js +0 -8
  110. package/lib-esm/contact-methods/phone/index.js +0 -1
  111. package/lib-esm/contact-methods/phone/phone-component.js +0 -10
  112. package/lib-esm/contact-methods/phone/phone-plugin.js +0 -8
  113. package/lib-esm/contact-methods/platform.js +0 -270
  114. package/lib-esm/contact-methods/ui/confirmation.js +0 -22
  115. package/lib-esm/contact-methods/ui/contact-list.js +0 -32
  116. package/lib-esm/contact-methods/ui/contact-method.js +0 -81
  117. package/lib-esm/contact-methods/ui/description.js +0 -8
  118. package/lib-esm/contact-methods/ui/form.js +0 -49
  119. package/lib-esm/contact-methods/ui/index.js +0 -6
  120. package/lib-esm/contact-methods/ui/use-contact-method.js +0 -37
  121. package/lib-esm/contact-methods/web-service/index.js +0 -1
  122. package/lib-esm/contact-methods/web-service/web-service-plugin.js +0 -27
  123. package/lib-esm/create-adapter.js +0 -39
  124. package/lib-esm/default-contact-methods-plugin.js +0 -39
  125. package/lib-esm/index.js +0 -3
@@ -1,37 +0,0 @@
1
- var __read = (this && this.__read) || function (o, n) {
2
- var m = typeof Symbol === "function" && o[Symbol.iterator];
3
- if (!m) return o;
4
- var i = m.call(o), r, ar = [], e;
5
- try {
6
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7
- }
8
- catch (error) { e = { error: error }; }
9
- finally {
10
- try {
11
- if (r && !r.done && (m = i["return"])) m.call(i);
12
- }
13
- finally { if (e) throw e.error; }
14
- }
15
- return ar;
16
- };
17
- import { useContainer } from '@telia-ace/knowledge-widget-ui';
18
- import { useEffect, useState } from 'react';
19
- var useContactMethod = function (clientName) {
20
- var _a = __read(useState(null), 2), component = _a[0], setComponent = _a[1];
21
- var container = useContainer();
22
- useEffect(function () {
23
- var unsubscribe;
24
- container.getAsync('componentResolver').then(function (resolver) {
25
- unsubscribe = resolver.registerResolver(clientName, function (component) {
26
- return setComponent(component);
27
- });
28
- });
29
- return function () {
30
- if (unsubscribe) {
31
- unsubscribe();
32
- }
33
- };
34
- }, [clientName]);
35
- return component;
36
- };
37
- export default useContactMethod;
@@ -1 +0,0 @@
1
- export { default as WebServicePlugin } from './web-service-plugin';
@@ -1,27 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { defaultComplete, defaultSubmit, defaultValidate } from '..';
13
- export default function webServicePlugin(container) {
14
- container.getAsync('contactMethods').then(function (platform) {
15
- platform.create({
16
- clientName: 'custom.webservice',
17
- render: 'email.form',
18
- onValidate: function (contactMethod) { return defaultValidate(container, contactMethod); },
19
- onComplete: function (contactMethod) { return defaultComplete(container, contactMethod); },
20
- onSubmit: function (contactMethod) {
21
- return defaultSubmit(container, contactMethod, function (response) {
22
- return __assign(__assign({}, response), { ConfirmationText: response.ResponseHtml });
23
- });
24
- },
25
- });
26
- });
27
- }
@@ -1,39 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import { FormReader } from '@telia-ace/widget-forms';
13
- import { defaultComplete, defaultValidate } from './contact-methods';
14
- export var createSubmitAdapter = function (container, clientName, fn) {
15
- return container.getAsync('contactMethods').then(function (platform) {
16
- platform.create({
17
- clientName: clientName,
18
- render: 'email.form',
19
- handleClick: function () {
20
- return function (e, cm) {
21
- var _a = cm.body, form = _a.form, guideId = _a.guideId, confirmationFallback = _a.confirmationFallback, rest = __rest(_a, ["form", "guideId", "confirmationFallback"]);
22
- if (!form) {
23
- e.preventDefault();
24
- fn(rest);
25
- }
26
- };
27
- },
28
- onValidate: function (cm) { return defaultValidate(container, cm); },
29
- onComplete: function (cm) { return defaultComplete(container, cm); },
30
- onSubmit: function (cm) {
31
- var _a = cm.body, form = _a.form, guideId = _a.guideId, confirmationFallback = _a.confirmationFallback, rest = __rest(_a, ["form", "guideId", "confirmationFallback"]);
32
- var values = new FormReader(form).export().values;
33
- return Promise.resolve(fn(rest, values)).then(function (confirmation) {
34
- return confirmation || confirmationFallback;
35
- });
36
- },
37
- });
38
- });
39
- };
@@ -1,39 +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 } from '@telia-ace/knowledge-widget-core';
17
- import { ChatPopupPlugin, EmailFormPlugin, FreeTextPlugin, LinkPlugin, PhonePlugin, WebServicePlugin, } from '.';
18
- /**
19
- * Registers default Humany contact methods.
20
- */
21
- var DefaultContactMethodsPlugin = /** @class */ (function (_super) {
22
- __extends(DefaultContactMethodsPlugin, _super);
23
- function DefaultContactMethodsPlugin(container, settings) {
24
- var _this = _super.call(this, container, settings) || this;
25
- var implementation = _this.widget.implementation;
26
- implementation.configure(function (config) {
27
- config
28
- .plugin(EmailFormPlugin)
29
- .plugin(ChatPopupPlugin)
30
- .plugin(FreeTextPlugin)
31
- .plugin(PhonePlugin)
32
- .plugin(WebServicePlugin)
33
- .plugin(LinkPlugin);
34
- });
35
- return _this;
36
- }
37
- return DefaultContactMethodsPlugin;
38
- }(Plugin));
39
- export { DefaultContactMethodsPlugin };
package/lib-esm/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { ChatPopupPlugin, contactItemList, contactLink, ContactList, ContactMethod, ContactMethodPlatform, defaultComplete, defaultEvaluate, DefaultForm, defaultSubmit, defaultValidate, EmailPlugin as EmailFormPlugin, FreeTextPlugin, LinkPlugin, PhonePlugin, useContactMethod, WebServicePlugin, } from './contact-methods';
2
- export { createSubmitAdapter } from './create-adapter';
3
- export { DefaultContactMethodsPlugin } from './default-contact-methods-plugin';