@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,31 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.WebServicePlugin = exports.useContactMethod = exports.DefaultForm = exports.ContactMethod = exports.ContactList = exports.contactLink = exports.contactItemList = exports.ContactMethodPlatform = exports.PhonePlugin = exports.LinkPlugin = exports.FreeTextPlugin = exports.EmailPlugin = exports.defaultValidate = exports.defaultSubmit = exports.defaultEvaluate = exports.defaultComplete = exports.ChatPopupPlugin = void 0;
7
- var chat_popup_1 = require("./chat-popup");
8
- Object.defineProperty(exports, "ChatPopupPlugin", { enumerable: true, get: function () { return chat_popup_1.ChatPopupPlugin; } });
9
- var email_1 = require("./email");
10
- Object.defineProperty(exports, "defaultComplete", { enumerable: true, get: function () { return email_1.defaultComplete; } });
11
- Object.defineProperty(exports, "defaultEvaluate", { enumerable: true, get: function () { return email_1.defaultEvaluate; } });
12
- Object.defineProperty(exports, "defaultSubmit", { enumerable: true, get: function () { return email_1.defaultSubmit; } });
13
- Object.defineProperty(exports, "defaultValidate", { enumerable: true, get: function () { return email_1.defaultValidate; } });
14
- Object.defineProperty(exports, "EmailPlugin", { enumerable: true, get: function () { return email_1.EmailPlugin; } });
15
- var free_text_1 = require("./free-text");
16
- Object.defineProperty(exports, "FreeTextPlugin", { enumerable: true, get: function () { return free_text_1.FreeTextPlugin; } });
17
- var link_1 = require("./link");
18
- Object.defineProperty(exports, "LinkPlugin", { enumerable: true, get: function () { return link_1.LinkPlugin; } });
19
- var phone_1 = require("./phone");
20
- Object.defineProperty(exports, "PhonePlugin", { enumerable: true, get: function () { return phone_1.PhonePlugin; } });
21
- var platform_1 = require("./platform");
22
- Object.defineProperty(exports, "ContactMethodPlatform", { enumerable: true, get: function () { return __importDefault(platform_1).default; } });
23
- var ui_1 = require("./ui");
24
- Object.defineProperty(exports, "contactItemList", { enumerable: true, get: function () { return ui_1.contactItemList; } });
25
- Object.defineProperty(exports, "contactLink", { enumerable: true, get: function () { return ui_1.contactLink; } });
26
- Object.defineProperty(exports, "ContactList", { enumerable: true, get: function () { return ui_1.ContactList; } });
27
- Object.defineProperty(exports, "ContactMethod", { enumerable: true, get: function () { return ui_1.ContactMethod; } });
28
- Object.defineProperty(exports, "DefaultForm", { enumerable: true, get: function () { return ui_1.Form; } });
29
- Object.defineProperty(exports, "useContactMethod", { enumerable: true, get: function () { return ui_1.useContactMethod; } });
30
- var web_service_1 = require("./web-service");
31
- Object.defineProperty(exports, "WebServicePlugin", { enumerable: true, get: function () { return web_service_1.WebServicePlugin; } });
@@ -1 +0,0 @@
1
- export { default as LinkPlugin } from './link-plugin';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LinkPlugin = void 0;
7
- var link_plugin_1 = require("./link-plugin");
8
- Object.defineProperty(exports, "LinkPlugin", { enumerable: true, get: function () { return __importDefault(link_plugin_1).default; } });
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import { ContactMethodProps } from '../ui';
3
- declare const LinkComponent: React.SFC<ContactMethodProps>;
4
- export default LinkComponent;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
4
- var LinkComponent = function (_a) {
5
- var className = _a.className, body = _a.body, _b = _a.renderDefault, renderDefault = _b === void 0 ? function () { } : _b;
6
- var uri = body.uri, target = body.target, protocol = body.protocol;
7
- return renderDefault({
8
- target: target,
9
- className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-method-link'),
10
- href: "".concat(protocol).concat(uri),
11
- });
12
- };
13
- exports.default = LinkComponent;
@@ -1,2 +0,0 @@
1
- import { Container } from '@webprovisions/platform';
2
- export default function linkPlugin(container: Container): void;
@@ -1,34 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- function linkPlugin(container) {
27
- container.getAsync('contactMethods').then(function (platform) {
28
- platform.create({
29
- clientName: 'custom.link',
30
- render: Promise.resolve().then(function () { return __importStar(require('./link-component')); }),
31
- });
32
- });
33
- }
34
- exports.default = linkPlugin;
@@ -1 +0,0 @@
1
- export { default as PhonePlugin } from './phone-plugin';
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.PhonePlugin = void 0;
7
- var phone_plugin_1 = require("./phone-plugin");
8
- Object.defineProperty(exports, "PhonePlugin", { enumerable: true, get: function () { return __importDefault(phone_plugin_1).default; } });
@@ -1,4 +0,0 @@
1
- import * as React from 'react';
2
- import { ContactMethodProps } from '../ui';
3
- declare const PhoneComponent: React.SFC<ContactMethodProps>;
4
- export default PhoneComponent;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
4
- var PhoneComponent = function (_a) {
5
- var className = _a.className, phoneNumber = _a.body.phoneNumber, _b = _a.renderDefault, renderDefault = _b === void 0 ? function () { } : _b;
6
- return renderDefault({
7
- title: phoneNumber,
8
- className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-method-phone'),
9
- href: "tel: ".concat(phoneNumber),
10
- });
11
- };
12
- exports.default = PhoneComponent;
@@ -1,2 +0,0 @@
1
- import { Container } from '@webprovisions/platform';
2
- export default function phonePlugin(container: Container): void;
@@ -1,34 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- function phonePlugin(container) {
27
- container.getAsync('contactMethods').then(function (platform) {
28
- platform.create({
29
- clientName: 'phone.text',
30
- render: Promise.resolve().then(function () { return __importStar(require('./phone-component')); }),
31
- });
32
- });
33
- }
34
- exports.default = phonePlugin;
@@ -1,50 +0,0 @@
1
- import { ComponentPlatform } from '@telia-ace/knowledge-widget-core';
2
- import { Form } from '@telia-ace/widget-forms';
3
- import { Container } from '@webprovisions/platform';
4
- import React from 'react';
5
- import { ContactMethodProps } from './ui';
6
- export declare type ReactComponentImport = Promise<{
7
- default: React.FunctionComponent<any>;
8
- }>;
9
- export declare type Click = (e: React.MouseEvent, cm: ContactMethodProps) => void;
10
- export declare type AdapterSettings = {
11
- clientName: string;
12
- render: string | ReactComponentImport;
13
- handleDescription?: (cm: ContactMethodProps) => Promise<string> | string;
14
- handleDisabled?: (cm: ContactMethodProps) => Promise<boolean> | boolean;
15
- handleClick?: (cm: ContactMethodProps) => Promise<Click> | Click;
16
- onEvaluate?: (cm: ContactMethodProps) => Promise<Form> | Form;
17
- onValidate?: (cm: ContactMethodProps) => Promise<ValidationResult> | ValidationResult;
18
- onSubmit?: (cm: ContactMethodProps) => Promise<string> | string;
19
- onComplete?: (cm: ContactMethodProps) => Promise<void> | void;
20
- };
21
- export declare type ValidationResult = {
22
- errors?: {
23
- [key: string]: string;
24
- };
25
- errorTypes?: {
26
- [key: string]: string;
27
- };
28
- valid: boolean;
29
- };
30
- export declare enum ContactMethodTrackTypes {
31
- ContactMethodValidate = "contact-method-validate",
32
- ContactMethodComplete = "contact-method-complete"
33
- }
34
- declare class ContactMethodPlatform {
35
- private container;
36
- private componentPlatform;
37
- private adapters;
38
- private subs;
39
- static create(container: Container): Promise<ContactMethodPlatform>;
40
- constructor(container: Container, componentPlatform: ComponentPlatform);
41
- static getInstance(container: Container, key?: string): Promise<ContactMethodPlatform>;
42
- private track;
43
- complete(contactMethod: ContactMethodProps): void | Promise<void>;
44
- evaluate(contactMethod: ContactMethodProps): Promise<Form>;
45
- validate(contactMethod: ContactMethodProps): Promise<ValidationResult>;
46
- submit(contactMethod: ContactMethodProps): Promise<string>;
47
- create(settings: AdapterSettings): Promise<void>;
48
- dispose(): void;
49
- }
50
- export default ContactMethodPlatform;
@@ -1,273 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (_) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- Object.defineProperty(exports, "__esModule", { value: true });
50
- exports.ContactMethodTrackTypes = void 0;
51
- var knowledge_widget_core_1 = require("@telia-ace/knowledge-widget-core");
52
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
53
- var react_1 = require("react");
54
- var email_1 = require("./email");
55
- var ContactMethodTrackTypes;
56
- (function (ContactMethodTrackTypes) {
57
- ContactMethodTrackTypes["ContactMethodValidate"] = "contact-method-validate";
58
- ContactMethodTrackTypes["ContactMethodComplete"] = "contact-method-complete";
59
- })(ContactMethodTrackTypes = exports.ContactMethodTrackTypes || (exports.ContactMethodTrackTypes = {}));
60
- var handleContactMethod = function (adapters, contactMethod) { return __awaiter(void 0, void 0, void 0, function () {
61
- var adapter, description, disabled, onClick, handleClick, handleDescription, handleDisabled;
62
- return __generator(this, function (_a) {
63
- switch (_a.label) {
64
- case 0:
65
- adapter = adapters.get(contactMethod.clientName);
66
- description = contactMethod.description, disabled = contactMethod.disabled, onClick = contactMethod.onClick;
67
- if (!adapter) return [3 /*break*/, 6];
68
- handleClick = adapter.handleClick, handleDescription = adapter.handleDescription, handleDisabled = adapter.handleDisabled;
69
- if (!(typeof handleClick === 'function')) return [3 /*break*/, 2];
70
- return [4 /*yield*/, Promise.resolve(handleClick(contactMethod))];
71
- case 1:
72
- onClick = _a.sent();
73
- _a.label = 2;
74
- case 2:
75
- if (!(typeof handleDescription === 'function')) return [3 /*break*/, 4];
76
- return [4 /*yield*/, Promise.resolve(handleDescription(contactMethod))];
77
- case 3:
78
- description = _a.sent();
79
- _a.label = 4;
80
- case 4:
81
- if (!(typeof handleDisabled === 'function')) return [3 /*break*/, 6];
82
- return [4 /*yield*/, Promise.resolve(handleDisabled(contactMethod))];
83
- case 5:
84
- disabled = _a.sent();
85
- _a.label = 6;
86
- case 6: return [2 /*return*/, Promise.resolve(__assign(__assign({}, contactMethod), { description: description, disabled: disabled, onClick: onClick }))];
87
- }
88
- });
89
- }); };
90
- var ContactMethodPlatform = /** @class */ (function () {
91
- function ContactMethodPlatform(container, componentPlatform) {
92
- var _this = this;
93
- this.container = container;
94
- this.componentPlatform = componentPlatform;
95
- this.adapters = new Map();
96
- this.subs = [];
97
- if (componentPlatform) {
98
- var contactListComponent = componentPlatform
99
- .components()
100
- .ofType('contact-list')
101
- .select();
102
- contactListComponent.actions.watch('contact-list.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
103
- var contactMethods, promises;
104
- var _this = this;
105
- return __generator(this, function (_a) {
106
- switch (_a.label) {
107
- case 0:
108
- contactMethods = input.contactMethods;
109
- if (!contactMethods) return [3 /*break*/, 2];
110
- promises = Promise.all(contactMethods.map(function (cm) {
111
- return handleContactMethod(_this.adapters, cm);
112
- }));
113
- return [4 /*yield*/, Promise.resolve(promises).then(function (contactMethods) {
114
- input.contactMethods = contactMethods;
115
- })];
116
- case 1:
117
- _a.sent();
118
- _a.label = 2;
119
- case 2: return [2 /*return*/, next(input)];
120
- }
121
- });
122
- }); });
123
- var guideComponent = componentPlatform.components().ofType('guide').select();
124
- guideComponent.actions.watch('guide.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
125
- var contactMethods, promises;
126
- var _this = this;
127
- return __generator(this, function (_a) {
128
- switch (_a.label) {
129
- case 0:
130
- contactMethods = input.contactMethods;
131
- if (!contactMethods) return [3 /*break*/, 2];
132
- promises = Promise.all(contactMethods.map(function (cm) {
133
- return handleContactMethod(_this.adapters, cm);
134
- }));
135
- return [4 /*yield*/, Promise.resolve(promises).then(function (contactMethods) {
136
- input.contactMethods = contactMethods;
137
- })];
138
- case 1:
139
- _a.sent();
140
- _a.label = 2;
141
- case 2: return [2 /*return*/, next(input)];
142
- }
143
- });
144
- }); });
145
- guideComponent.actions.watch('guide.handover', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
146
- var handoverContactMethods, promises;
147
- var _this = this;
148
- return __generator(this, function (_a) {
149
- switch (_a.label) {
150
- case 0:
151
- handoverContactMethods = input.handoverContactMethods;
152
- if (!handoverContactMethods) return [3 /*break*/, 2];
153
- promises = Promise.all(handoverContactMethods.map(function (cm) {
154
- return handleContactMethod(_this.adapters, cm);
155
- }));
156
- return [4 /*yield*/, Promise.resolve(promises).then(function (handoverContactMethods) {
157
- input.handoverContactMethods = handoverContactMethods;
158
- })];
159
- case 1:
160
- _a.sent();
161
- _a.label = 2;
162
- case 2: return [2 /*return*/, next(input)];
163
- }
164
- });
165
- }); });
166
- var contactMethodComponent = componentPlatform
167
- .components()
168
- .ofType('contact-method')
169
- .select();
170
- contactMethodComponent.actions.watch('contact-method.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
171
- var contactMethod;
172
- return __generator(this, function (_a) {
173
- contactMethod = input.contactMethod;
174
- if (contactMethod) {
175
- return [2 /*return*/, handleContactMethod(this.adapters, contactMethod).then(function (contactMethod) {
176
- return next(__assign(__assign({}, input), { contactMethod: contactMethod }));
177
- })];
178
- }
179
- return [2 /*return*/, next(input)];
180
- });
181
- }); });
182
- }
183
- }
184
- ContactMethodPlatform.create = function (container) {
185
- return knowledge_widget_core_1.ComponentPlatform.getInstance(container).then(function (platform) {
186
- return new ContactMethodPlatform(container, platform);
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
- };
205
- ContactMethodPlatform.prototype.track = function (data, type) {
206
- if (data === void 0) { data = {}; }
207
- var events = this.container.get('$widget').events;
208
- events.dispatch('tracking:service-client-response', {
209
- type: type,
210
- data: data,
211
- });
212
- };
213
- ContactMethodPlatform.prototype.complete = function (contactMethod) {
214
- var id = contactMethod.id, title = contactMethod.title, clientName = contactMethod.clientName, expanded = contactMethod.expanded, body = contactMethod.body;
215
- this.track({ contactMethod: { id: id, title: title, expanded: expanded, type: clientName }, hasGuide: !!body.guideId }, ContactMethodTrackTypes.ContactMethodComplete);
216
- var adapter = this.adapters.get(clientName);
217
- if (adapter && adapter.onComplete) {
218
- return adapter.onComplete(contactMethod);
219
- }
220
- };
221
- ContactMethodPlatform.prototype.evaluate = function (contactMethod) {
222
- var clientName = contactMethod.clientName;
223
- var adapter = this.adapters.get(clientName);
224
- if (adapter && adapter.onEvaluate) {
225
- return Promise.resolve(adapter.onEvaluate(contactMethod));
226
- }
227
- return Promise.resolve(contactMethod.body.form);
228
- };
229
- ContactMethodPlatform.prototype.validate = function (contactMethod) {
230
- var _this = this;
231
- var id = contactMethod.id, title = contactMethod.title, clientName = contactMethod.clientName;
232
- var adapter = this.adapters.get(clientName);
233
- if (adapter && adapter.onValidate) {
234
- return Promise.resolve(adapter.onValidate(contactMethod)).then(function (result) {
235
- _this.track({ contactMethod: { id: id, title: title, type: clientName }, isValid: result.valid }, ContactMethodTrackTypes.ContactMethodValidate);
236
- var events = _this.container.get('$widget').events;
237
- events.dispatch('form:validated', { isValid: result.valid });
238
- return result;
239
- });
240
- }
241
- return Promise.resolve({ valid: true });
242
- };
243
- ContactMethodPlatform.prototype.submit = function (contactMethod) {
244
- var _this = this;
245
- var clientName = contactMethod.clientName;
246
- var adapter = this.adapters.get(clientName);
247
- if (adapter && adapter.onSubmit) {
248
- return Promise.resolve(adapter.onSubmit(contactMethod)).then(function (result) {
249
- _this.complete(contactMethod);
250
- return result;
251
- });
252
- }
253
- return Promise.resolve('');
254
- };
255
- ContactMethodPlatform.prototype.create = function (settings) {
256
- var _this = this;
257
- var clientName = settings.clientName, render = settings.render;
258
- this.adapters.set(clientName, __assign({ onValidate: function (cm) { return (0, email_1.defaultValidate)(_this.container, cm); }, onEvaluate: function (cm) { return (0, email_1.defaultEvaluate)(_this.container, cm); }, onComplete: function (cm) { return (0, email_1.defaultComplete)(_this.container, cm); } }, settings));
259
- return this.container.getAsync('componentResolver').then(function (resolver) {
260
- if (typeof render === 'string') {
261
- _this.subs.push(resolver.registerAlias(clientName, render));
262
- }
263
- else {
264
- _this.subs.push(resolver.registerComponent(clientName, (0, react_1.lazy)(function () { return render; })));
265
- }
266
- });
267
- };
268
- ContactMethodPlatform.prototype.dispose = function () {
269
- this.subs.forEach(function (s) { return s(); });
270
- };
271
- return ContactMethodPlatform;
272
- }());
273
- exports.default = ContactMethodPlatform;
@@ -1,6 +0,0 @@
1
- import * as React from 'react';
2
- export declare type Props = {
3
- html: string;
4
- };
5
- declare const Confirmation: React.SFC<Props>;
6
- export default Confirmation;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
42
- var React = __importStar(require("react"));
43
- var styled_components_1 = __importStar(require("styled-components"));
44
- var Confirmation = function (props) { return (React.createElement(StyledParagraph, __assign({}, props, { className: "humany-confirmation" }))); };
45
- exports.default = Confirmation;
46
- var StyledParagraph = (0, styled_components_1.default)(knowledge_widget_ui_1.Paragraph)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), (0, knowledge_widget_ui_1.headingElement)('h1', (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-weight: normal;\n font-size: ", ";\n "], ["\n font-weight: normal;\n font-size: ", ";\n "])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.medium; })));
47
- var templateObject_1, templateObject_2;
@@ -1,15 +0,0 @@
1
- import { DispatchAction } from '@telia-ace/knowledge-widget-ui';
2
- import React, { ReactNode } from 'react';
3
- import { ContactMethodType } from './contact-method';
4
- export declare const contactItemList: import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
5
- declare type Props = {
6
- contactMethods: ContactMethodType[];
7
- header?: string;
8
- className?: string;
9
- action?: (action: string, value?: any) => void;
10
- dispatch?: DispatchAction;
11
- children?: ReactNode;
12
- guideId?: string;
13
- };
14
- declare const ContactList: React.SFC<Props>;
15
- export default ContactList;
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
3
- if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
4
- return cooked;
5
- };
6
- var __assign = (this && this.__assign) || function () {
7
- __assign = Object.assign || function(t) {
8
- for (var s, i = 1, n = arguments.length; i < n; i++) {
9
- s = arguments[i];
10
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11
- t[p] = s[p];
12
- }
13
- return t;
14
- };
15
- return __assign.apply(this, arguments);
16
- };
17
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- var desc = Object.getOwnPropertyDescriptor(m, k);
20
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
21
- desc = { enumerable: true, get: function() { return m[k]; } };
22
- }
23
- Object.defineProperty(o, k2, desc);
24
- }) : (function(o, m, k, k2) {
25
- if (k2 === undefined) k2 = k;
26
- o[k2] = m[k];
27
- }));
28
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
29
- Object.defineProperty(o, "default", { enumerable: true, value: v });
30
- }) : function(o, v) {
31
- o["default"] = v;
32
- });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.contactItemList = void 0;
45
- var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
46
- var widget_utilities_1 = require("@telia-ace/widget-utilities");
47
- var react_1 = __importDefault(require("react"));
48
- var styled_components_1 = __importStar(require("styled-components"));
49
- var contact_method_1 = __importDefault(require("./contact-method"));
50
- exports.contactItemList = (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n > div {\n padding: ", ";\n\n ", "\n }\n > ul {\n &:not(:first-child) {\n border-top: ", ";\n }\n\n > li {\n margin: 0;\n white-space: normal;\n\n > a {\n overflow: hidden;\n }\n\n &:first-child > a {\n border-radius: ", ";\n }\n\n &:last-child:not(:first-child) > a {\n border-radius: ", ";\n }\n\n &:not(:last-child) {\n border-bottom: ", ";\n }\n\n > div {\n padding: ", ";\n }\n }\n }\n\n @media (hover: hover) {\n a:hover {\n background-color: ", ";\n }\n }\n"], ["\n ", "\n\n > div {\n padding: ", ";\n\n ", "\n }\n > ul {\n &:not(:first-child) {\n border-top: ", ";\n }\n\n > li {\n margin: 0;\n white-space: normal;\n\n > a {\n overflow: hidden;\n }\n\n &:first-child > a {\n border-radius: ", ";\n }\n\n &:last-child:not(:first-child) > a {\n border-radius: ", ";\n }\n\n &:not(:last-child) {\n border-bottom: ", ";\n }\n\n > div {\n padding: ", ";\n }\n }\n }\n\n @media (hover: hover) {\n a:hover {\n background-color: ", ";\n }\n }\n"])), knowledge_widget_ui_1.itemList, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, (0, knowledge_widget_ui_1.headingElement)('h1', (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n margin: 0;\n "], ["\n margin: 0;\n "])))), function (p) { return p.theme.border; }, function (p) { return "".concat(p.theme.borderRadius, " ").concat(p.theme.borderRadius, " 0 0"); }, function (p) { return "0 0 ".concat(p.theme.borderRadius, " ").concat(p.theme.borderRadius); }, function (p) { return p.theme.border; }, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.accent; });
51
- var StyledItemList = (0, styled_components_1.default)(knowledge_widget_ui_1.ItemList)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), exports.contactItemList);
52
- var ContactList = function (_a) {
53
- var contactMethods = _a.contactMethods, children = _a.children, guideId = _a.guideId, dispatch = _a.dispatch, _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.action, action = _c === void 0 ? function () { } : _c, _d = _a.header, header = _d === void 0 ? '' : _d;
54
- if (!contactMethods.length) {
55
- return null;
56
- }
57
- return (react_1.default.createElement(StyledItemList, { header: header, className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-list'), items: contactMethods, renderItem: function (cm) { return (react_1.default.createElement("li", { key: cm.id, "data-contact-method": cm.id },
58
- react_1.default.createElement(contact_method_1.default, __assign({}, cm, { action: action, dispatch: dispatch, guideId: guideId })))); } }, children));
59
- };
60
- exports.default = ContactList;
61
- var templateObject_1, templateObject_2, templateObject_3;