@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.
- package/{lib-esm → dist}/contact-methods/chat-popup/chat-popup-plugin.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/chat-popup/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/email/email-form-component.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/email/email-plugin.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/email/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/free-text/free-text-component.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/free-text/free-text-plugin.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/free-text/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/link/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/link/link-component.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/link/link-plugin.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/phone/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/phone/phone-component.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/phone/phone-plugin.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/platform.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/confirmation.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/contact-list.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/contact-method.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/description.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/form.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/ui/use-contact-method.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/web-service/index.d.ts +0 -0
- package/{lib-esm → dist}/contact-methods/web-service/web-service-plugin.d.ts +0 -0
- package/{lib-esm → dist}/create-adapter.d.ts +0 -0
- package/{lib-esm → dist}/default-contact-methods-plugin.d.ts +0 -0
- package/dist/email-form-component.js +63 -0
- package/dist/email-form-component.js.map +1 -0
- package/dist/free-text-component.js +31 -0
- package/dist/free-text-component.js.map +1 -0
- package/{lib-esm → dist}/index.d.ts +0 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/index2.js +699 -0
- package/dist/index2.js.map +1 -0
- package/dist/link-component.js +16 -0
- package/dist/link-component.js.map +1 -0
- package/dist/phone-component.js +15 -0
- package/dist/phone-component.js.map +1 -0
- package/package.json +12 -13
- package/lib/contact-methods/chat-popup/chat-popup-plugin.d.ts +0 -2
- package/lib/contact-methods/chat-popup/chat-popup-plugin.js +0 -79
- package/lib/contact-methods/chat-popup/index.d.ts +0 -1
- package/lib/contact-methods/chat-popup/index.js +0 -8
- package/lib/contact-methods/email/email-form-component.d.ts +0 -4
- package/lib/contact-methods/email/email-form-component.js +0 -58
- package/lib/contact-methods/email/email-plugin.d.ts +0 -16
- package/lib/contact-methods/email/email-plugin.js +0 -83
- package/lib/contact-methods/email/index.d.ts +0 -1
- package/lib/contact-methods/email/index.js +0 -12
- package/lib/contact-methods/free-text/free-text-component.d.ts +0 -4
- package/lib/contact-methods/free-text/free-text-component.js +0 -49
- package/lib/contact-methods/free-text/free-text-plugin.d.ts +0 -2
- package/lib/contact-methods/free-text/free-text-plugin.js +0 -34
- package/lib/contact-methods/free-text/index.d.ts +0 -1
- package/lib/contact-methods/free-text/index.js +0 -8
- package/lib/contact-methods/index.d.ts +0 -10
- package/lib/contact-methods/index.js +0 -31
- package/lib/contact-methods/link/index.d.ts +0 -1
- package/lib/contact-methods/link/index.js +0 -8
- package/lib/contact-methods/link/link-component.d.ts +0 -4
- package/lib/contact-methods/link/link-component.js +0 -13
- package/lib/contact-methods/link/link-plugin.d.ts +0 -2
- package/lib/contact-methods/link/link-plugin.js +0 -34
- package/lib/contact-methods/phone/index.d.ts +0 -1
- package/lib/contact-methods/phone/index.js +0 -8
- package/lib/contact-methods/phone/phone-component.d.ts +0 -4
- package/lib/contact-methods/phone/phone-component.js +0 -12
- package/lib/contact-methods/phone/phone-plugin.d.ts +0 -2
- package/lib/contact-methods/phone/phone-plugin.js +0 -34
- package/lib/contact-methods/platform.d.ts +0 -50
- package/lib/contact-methods/platform.js +0 -273
- package/lib/contact-methods/ui/confirmation.d.ts +0 -6
- package/lib/contact-methods/ui/confirmation.js +0 -47
- package/lib/contact-methods/ui/contact-list.d.ts +0 -15
- package/lib/contact-methods/ui/contact-list.js +0 -61
- package/lib/contact-methods/ui/contact-method.d.ts +0 -39
- package/lib/contact-methods/ui/contact-method.js +0 -110
- package/lib/contact-methods/ui/description.d.ts +0 -2
- package/lib/contact-methods/ui/description.js +0 -13
- package/lib/contact-methods/ui/form.d.ts +0 -4
- package/lib/contact-methods/ui/form.js +0 -54
- package/lib/contact-methods/ui/index.d.ts +0 -7
- package/lib/contact-methods/ui/index.js +0 -20
- package/lib/contact-methods/ui/use-contact-method.d.ts +0 -2
- package/lib/contact-methods/ui/use-contact-method.js +0 -39
- package/lib/contact-methods/web-service/index.d.ts +0 -1
- package/lib/contact-methods/web-service/index.js +0 -8
- package/lib/contact-methods/web-service/web-service-plugin.d.ts +0 -2
- package/lib/contact-methods/web-service/web-service-plugin.js +0 -30
- package/lib/create-adapter.d.ts +0 -7
- package/lib/create-adapter.js +0 -43
- package/lib/default-contact-methods-plugin.d.ts +0 -8
- package/lib/default-contact-methods-plugin.js +0 -42
- package/lib/index.d.ts +0 -5
- package/lib/index.js +0 -25
- package/lib-esm/contact-methods/chat-popup/chat-popup-plugin.js +0 -76
- package/lib-esm/contact-methods/chat-popup/index.js +0 -1
- package/lib-esm/contact-methods/email/email-form-component.js +0 -33
- package/lib-esm/contact-methods/email/email-plugin.js +0 -52
- package/lib-esm/contact-methods/email/index.js +0 -1
- package/lib-esm/contact-methods/free-text/free-text-component.js +0 -21
- package/lib-esm/contact-methods/free-text/free-text-plugin.js +0 -8
- package/lib-esm/contact-methods/free-text/index.js +0 -1
- package/lib-esm/contact-methods/index.js +0 -8
- package/lib-esm/contact-methods/link/index.js +0 -1
- package/lib-esm/contact-methods/link/link-component.js +0 -11
- package/lib-esm/contact-methods/link/link-plugin.js +0 -8
- package/lib-esm/contact-methods/phone/index.js +0 -1
- package/lib-esm/contact-methods/phone/phone-component.js +0 -10
- package/lib-esm/contact-methods/phone/phone-plugin.js +0 -8
- package/lib-esm/contact-methods/platform.js +0 -270
- package/lib-esm/contact-methods/ui/confirmation.js +0 -22
- package/lib-esm/contact-methods/ui/contact-list.js +0 -32
- package/lib-esm/contact-methods/ui/contact-method.js +0 -81
- package/lib-esm/contact-methods/ui/description.js +0 -8
- package/lib-esm/contact-methods/ui/form.js +0 -49
- package/lib-esm/contact-methods/ui/index.js +0 -6
- package/lib-esm/contact-methods/ui/use-contact-method.js +0 -37
- package/lib-esm/contact-methods/web-service/index.js +0 -1
- package/lib-esm/contact-methods/web-service/web-service-plugin.js +0 -27
- package/lib-esm/create-adapter.js +0 -39
- package/lib-esm/default-contact-methods-plugin.js +0 -39
- package/lib-esm/index.js +0 -3
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { FormBuilder, FormReader } from '@telia-ace/widget-forms';
|
|
2
|
-
var post = function (container, contactMethod, validate) {
|
|
3
|
-
if (validate === void 0) { validate = false; }
|
|
4
|
-
return container.getManyAsync('matchingClient', 'router').then(function (services) {
|
|
5
|
-
var formData = new FormReader(contactMethod.body.form).export(validate).formData;
|
|
6
|
-
var _a = services, router = _a.router, matchingClient = _a.matchingClient;
|
|
7
|
-
var params = router.getRouteData().params;
|
|
8
|
-
return matchingClient.customRequest("contactmethods/".concat(contactMethod.id).concat(validate ? '/validatedwithpayload' : ''), 'POST', {
|
|
9
|
-
body: formData,
|
|
10
|
-
configuration: {
|
|
11
|
-
guideId: contactMethod.body.guideId || params.guideId,
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
export var submit = function (container, contactMethod, transform) {
|
|
17
|
-
return post(container, contactMethod)
|
|
18
|
-
.then(function (response) { return (transform ? transform(response) : response); })
|
|
19
|
-
.then(function (_a) {
|
|
20
|
-
var ConfirmationText = _a.ConfirmationText;
|
|
21
|
-
return ConfirmationText;
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
export var validate = function (container, contactMethod) {
|
|
25
|
-
return post(container, contactMethod, true).then(function (result) { return ({
|
|
26
|
-
valid: result.Validation.IsValid,
|
|
27
|
-
errors: result.Validation.Errors,
|
|
28
|
-
errorTypes: result.Validation.ErrorTypes,
|
|
29
|
-
}); });
|
|
30
|
-
};
|
|
31
|
-
export var evaluate = function (container, contactMethod) {
|
|
32
|
-
return post(container, contactMethod, true).then(function (result) {
|
|
33
|
-
return FormBuilder.fromLegacyForm(contactMethod.id, result.ContactMethod.Form).get();
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
export var complete = function (container, contactMethod) {
|
|
37
|
-
return container.getAsync('matchingClient').then(function (matchingClient) {
|
|
38
|
-
matchingClient.completeContactMethod(contactMethod.id);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
export default function emailPlugin(container) {
|
|
42
|
-
container.getAsync('contactMethods').then(function (platform) {
|
|
43
|
-
platform.create({
|
|
44
|
-
clientName: 'email.form',
|
|
45
|
-
render: import('./email-form-component'),
|
|
46
|
-
onEvaluate: function (contactMethod) { return evaluate(container, contactMethod); },
|
|
47
|
-
onValidate: function (contactMethod) { return validate(container, contactMethod); },
|
|
48
|
-
onSubmit: function (contactMethod) { return submit(container, contactMethod); },
|
|
49
|
-
onComplete: function (contactMethod) { return complete(container, contactMethod); },
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { complete as defaultComplete, default as EmailPlugin, evaluate as defaultEvaluate, submit as defaultSubmit, validate as defaultValidate, } from './email-plugin';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
import { genericHtml, Html } from '@telia-ace/knowledge-widget-ui';
|
|
6
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
7
|
-
import * as React from 'react';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
|
-
import { Description } from '../ui';
|
|
10
|
-
var FreeTextComponent = function (_a) {
|
|
11
|
-
var className = _a.className, description = _a.description, freetext = _a.body.freetext, htmlParseInstruction = _a.htmlParseInstruction;
|
|
12
|
-
if (!freetext) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return (React.createElement("div", { className: appendClassNames(className, 'humany-contact-method-free-text') },
|
|
16
|
-
React.createElement(StyledHtml, { html: freetext, htmlParseInstruction: htmlParseInstruction }),
|
|
17
|
-
description && (React.createElement(Description, { html: description, htmlParseInstruction: htmlParseInstruction }))));
|
|
18
|
-
};
|
|
19
|
-
export default FreeTextComponent;
|
|
20
|
-
var StyledHtml = styled(Html)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), genericHtml);
|
|
21
|
-
var templateObject_1;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as FreeTextPlugin } from './free-text-plugin';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export { ChatPopupPlugin } from './chat-popup';
|
|
2
|
-
export { defaultComplete, defaultEvaluate, defaultSubmit, defaultValidate, EmailPlugin, } from './email';
|
|
3
|
-
export { FreeTextPlugin } from './free-text';
|
|
4
|
-
export { LinkPlugin } from './link';
|
|
5
|
-
export { PhonePlugin } from './phone';
|
|
6
|
-
export { default as ContactMethodPlatform } from './platform';
|
|
7
|
-
export { contactItemList, contactLink, ContactList, ContactMethod, Form as DefaultForm, useContactMethod, } from './ui';
|
|
8
|
-
export { WebServicePlugin } from './web-service';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as LinkPlugin } from './link-plugin';
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
2
|
-
var LinkComponent = function (_a) {
|
|
3
|
-
var className = _a.className, body = _a.body, _b = _a.renderDefault, renderDefault = _b === void 0 ? function () { } : _b;
|
|
4
|
-
var uri = body.uri, target = body.target, protocol = body.protocol;
|
|
5
|
-
return renderDefault({
|
|
6
|
-
target: target,
|
|
7
|
-
className: appendClassNames(className, 'humany-contact-method-link'),
|
|
8
|
-
href: "".concat(protocol).concat(uri),
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
export default LinkComponent;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as PhonePlugin } from './phone-plugin';
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
2
|
-
var PhoneComponent = function (_a) {
|
|
3
|
-
var className = _a.className, phoneNumber = _a.body.phoneNumber, _b = _a.renderDefault, renderDefault = _b === void 0 ? function () { } : _b;
|
|
4
|
-
return renderDefault({
|
|
5
|
-
title: phoneNumber,
|
|
6
|
-
className: appendClassNames(className, 'humany-contact-method-phone'),
|
|
7
|
-
href: "tel: ".concat(phoneNumber),
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export default PhoneComponent;
|
|
@@ -1,270 +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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (_) try {
|
|
28
|
-
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;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { ComponentPlatform } from '@telia-ace/knowledge-widget-core';
|
|
49
|
-
import { lock } from '@telia-ace/widget-utilities';
|
|
50
|
-
import { lazy } from 'react';
|
|
51
|
-
import { defaultComplete, defaultEvaluate, defaultValidate } from './email';
|
|
52
|
-
export var ContactMethodTrackTypes;
|
|
53
|
-
(function (ContactMethodTrackTypes) {
|
|
54
|
-
ContactMethodTrackTypes["ContactMethodValidate"] = "contact-method-validate";
|
|
55
|
-
ContactMethodTrackTypes["ContactMethodComplete"] = "contact-method-complete";
|
|
56
|
-
})(ContactMethodTrackTypes || (ContactMethodTrackTypes = {}));
|
|
57
|
-
var handleContactMethod = function (adapters, contactMethod) { return __awaiter(void 0, void 0, void 0, function () {
|
|
58
|
-
var adapter, description, disabled, onClick, handleClick, handleDescription, handleDisabled;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
switch (_a.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
adapter = adapters.get(contactMethod.clientName);
|
|
63
|
-
description = contactMethod.description, disabled = contactMethod.disabled, onClick = contactMethod.onClick;
|
|
64
|
-
if (!adapter) return [3 /*break*/, 6];
|
|
65
|
-
handleClick = adapter.handleClick, handleDescription = adapter.handleDescription, handleDisabled = adapter.handleDisabled;
|
|
66
|
-
if (!(typeof handleClick === 'function')) return [3 /*break*/, 2];
|
|
67
|
-
return [4 /*yield*/, Promise.resolve(handleClick(contactMethod))];
|
|
68
|
-
case 1:
|
|
69
|
-
onClick = _a.sent();
|
|
70
|
-
_a.label = 2;
|
|
71
|
-
case 2:
|
|
72
|
-
if (!(typeof handleDescription === 'function')) return [3 /*break*/, 4];
|
|
73
|
-
return [4 /*yield*/, Promise.resolve(handleDescription(contactMethod))];
|
|
74
|
-
case 3:
|
|
75
|
-
description = _a.sent();
|
|
76
|
-
_a.label = 4;
|
|
77
|
-
case 4:
|
|
78
|
-
if (!(typeof handleDisabled === 'function')) return [3 /*break*/, 6];
|
|
79
|
-
return [4 /*yield*/, Promise.resolve(handleDisabled(contactMethod))];
|
|
80
|
-
case 5:
|
|
81
|
-
disabled = _a.sent();
|
|
82
|
-
_a.label = 6;
|
|
83
|
-
case 6: return [2 /*return*/, Promise.resolve(__assign(__assign({}, contactMethod), { description: description, disabled: disabled, onClick: onClick }))];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}); };
|
|
87
|
-
var ContactMethodPlatform = /** @class */ (function () {
|
|
88
|
-
function ContactMethodPlatform(container, componentPlatform) {
|
|
89
|
-
var _this = this;
|
|
90
|
-
this.container = container;
|
|
91
|
-
this.componentPlatform = componentPlatform;
|
|
92
|
-
this.adapters = new Map();
|
|
93
|
-
this.subs = [];
|
|
94
|
-
if (componentPlatform) {
|
|
95
|
-
var contactListComponent = componentPlatform
|
|
96
|
-
.components()
|
|
97
|
-
.ofType('contact-list')
|
|
98
|
-
.select();
|
|
99
|
-
contactListComponent.actions.watch('contact-list.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
100
|
-
var contactMethods, promises;
|
|
101
|
-
var _this = this;
|
|
102
|
-
return __generator(this, function (_a) {
|
|
103
|
-
switch (_a.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
contactMethods = input.contactMethods;
|
|
106
|
-
if (!contactMethods) return [3 /*break*/, 2];
|
|
107
|
-
promises = Promise.all(contactMethods.map(function (cm) {
|
|
108
|
-
return handleContactMethod(_this.adapters, cm);
|
|
109
|
-
}));
|
|
110
|
-
return [4 /*yield*/, Promise.resolve(promises).then(function (contactMethods) {
|
|
111
|
-
input.contactMethods = contactMethods;
|
|
112
|
-
})];
|
|
113
|
-
case 1:
|
|
114
|
-
_a.sent();
|
|
115
|
-
_a.label = 2;
|
|
116
|
-
case 2: return [2 /*return*/, next(input)];
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}); });
|
|
120
|
-
var guideComponent = componentPlatform.components().ofType('guide').select();
|
|
121
|
-
guideComponent.actions.watch('guide.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
122
|
-
var contactMethods, promises;
|
|
123
|
-
var _this = this;
|
|
124
|
-
return __generator(this, function (_a) {
|
|
125
|
-
switch (_a.label) {
|
|
126
|
-
case 0:
|
|
127
|
-
contactMethods = input.contactMethods;
|
|
128
|
-
if (!contactMethods) return [3 /*break*/, 2];
|
|
129
|
-
promises = Promise.all(contactMethods.map(function (cm) {
|
|
130
|
-
return handleContactMethod(_this.adapters, cm);
|
|
131
|
-
}));
|
|
132
|
-
return [4 /*yield*/, Promise.resolve(promises).then(function (contactMethods) {
|
|
133
|
-
input.contactMethods = contactMethods;
|
|
134
|
-
})];
|
|
135
|
-
case 1:
|
|
136
|
-
_a.sent();
|
|
137
|
-
_a.label = 2;
|
|
138
|
-
case 2: return [2 /*return*/, next(input)];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
}); });
|
|
142
|
-
guideComponent.actions.watch('guide.handover', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
143
|
-
var handoverContactMethods, promises;
|
|
144
|
-
var _this = this;
|
|
145
|
-
return __generator(this, function (_a) {
|
|
146
|
-
switch (_a.label) {
|
|
147
|
-
case 0:
|
|
148
|
-
handoverContactMethods = input.handoverContactMethods;
|
|
149
|
-
if (!handoverContactMethods) return [3 /*break*/, 2];
|
|
150
|
-
promises = Promise.all(handoverContactMethods.map(function (cm) {
|
|
151
|
-
return handleContactMethod(_this.adapters, cm);
|
|
152
|
-
}));
|
|
153
|
-
return [4 /*yield*/, Promise.resolve(promises).then(function (handoverContactMethods) {
|
|
154
|
-
input.handoverContactMethods = handoverContactMethods;
|
|
155
|
-
})];
|
|
156
|
-
case 1:
|
|
157
|
-
_a.sent();
|
|
158
|
-
_a.label = 2;
|
|
159
|
-
case 2: return [2 /*return*/, next(input)];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}); });
|
|
163
|
-
var contactMethodComponent = componentPlatform
|
|
164
|
-
.components()
|
|
165
|
-
.ofType('contact-method')
|
|
166
|
-
.select();
|
|
167
|
-
contactMethodComponent.actions.watch('contact-method.fetched', function (input, next) { return __awaiter(_this, void 0, void 0, function () {
|
|
168
|
-
var contactMethod;
|
|
169
|
-
return __generator(this, function (_a) {
|
|
170
|
-
contactMethod = input.contactMethod;
|
|
171
|
-
if (contactMethod) {
|
|
172
|
-
return [2 /*return*/, handleContactMethod(this.adapters, contactMethod).then(function (contactMethod) {
|
|
173
|
-
return next(__assign(__assign({}, input), { contactMethod: contactMethod }));
|
|
174
|
-
})];
|
|
175
|
-
}
|
|
176
|
-
return [2 /*return*/, next(input)];
|
|
177
|
-
});
|
|
178
|
-
}); });
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
ContactMethodPlatform.create = function (container) {
|
|
182
|
-
return ComponentPlatform.getInstance(container).then(function (platform) {
|
|
183
|
-
return new ContactMethodPlatform(container, platform);
|
|
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
|
-
};
|
|
202
|
-
ContactMethodPlatform.prototype.track = function (data, type) {
|
|
203
|
-
if (data === void 0) { data = {}; }
|
|
204
|
-
var events = this.container.get('$widget').events;
|
|
205
|
-
events.dispatch('tracking:service-client-response', {
|
|
206
|
-
type: type,
|
|
207
|
-
data: data,
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
ContactMethodPlatform.prototype.complete = function (contactMethod) {
|
|
211
|
-
var id = contactMethod.id, title = contactMethod.title, clientName = contactMethod.clientName, expanded = contactMethod.expanded, body = contactMethod.body;
|
|
212
|
-
this.track({ contactMethod: { id: id, title: title, expanded: expanded, type: clientName }, hasGuide: !!body.guideId }, ContactMethodTrackTypes.ContactMethodComplete);
|
|
213
|
-
var adapter = this.adapters.get(clientName);
|
|
214
|
-
if (adapter && adapter.onComplete) {
|
|
215
|
-
return adapter.onComplete(contactMethod);
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
ContactMethodPlatform.prototype.evaluate = function (contactMethod) {
|
|
219
|
-
var clientName = contactMethod.clientName;
|
|
220
|
-
var adapter = this.adapters.get(clientName);
|
|
221
|
-
if (adapter && adapter.onEvaluate) {
|
|
222
|
-
return Promise.resolve(adapter.onEvaluate(contactMethod));
|
|
223
|
-
}
|
|
224
|
-
return Promise.resolve(contactMethod.body.form);
|
|
225
|
-
};
|
|
226
|
-
ContactMethodPlatform.prototype.validate = function (contactMethod) {
|
|
227
|
-
var _this = this;
|
|
228
|
-
var id = contactMethod.id, title = contactMethod.title, clientName = contactMethod.clientName;
|
|
229
|
-
var adapter = this.adapters.get(clientName);
|
|
230
|
-
if (adapter && adapter.onValidate) {
|
|
231
|
-
return Promise.resolve(adapter.onValidate(contactMethod)).then(function (result) {
|
|
232
|
-
_this.track({ contactMethod: { id: id, title: title, type: clientName }, isValid: result.valid }, ContactMethodTrackTypes.ContactMethodValidate);
|
|
233
|
-
var events = _this.container.get('$widget').events;
|
|
234
|
-
events.dispatch('form:validated', { isValid: result.valid });
|
|
235
|
-
return result;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
return Promise.resolve({ valid: true });
|
|
239
|
-
};
|
|
240
|
-
ContactMethodPlatform.prototype.submit = function (contactMethod) {
|
|
241
|
-
var _this = this;
|
|
242
|
-
var clientName = contactMethod.clientName;
|
|
243
|
-
var adapter = this.adapters.get(clientName);
|
|
244
|
-
if (adapter && adapter.onSubmit) {
|
|
245
|
-
return Promise.resolve(adapter.onSubmit(contactMethod)).then(function (result) {
|
|
246
|
-
_this.complete(contactMethod);
|
|
247
|
-
return result;
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
return Promise.resolve('');
|
|
251
|
-
};
|
|
252
|
-
ContactMethodPlatform.prototype.create = function (settings) {
|
|
253
|
-
var _this = this;
|
|
254
|
-
var clientName = settings.clientName, render = settings.render;
|
|
255
|
-
this.adapters.set(clientName, __assign({ onValidate: function (cm) { return defaultValidate(_this.container, cm); }, onEvaluate: function (cm) { return defaultEvaluate(_this.container, cm); }, onComplete: function (cm) { return defaultComplete(_this.container, cm); } }, settings));
|
|
256
|
-
return this.container.getAsync('componentResolver').then(function (resolver) {
|
|
257
|
-
if (typeof render === 'string') {
|
|
258
|
-
_this.subs.push(resolver.registerAlias(clientName, render));
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
_this.subs.push(resolver.registerComponent(clientName, lazy(function () { return render; })));
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
};
|
|
265
|
-
ContactMethodPlatform.prototype.dispose = function () {
|
|
266
|
-
this.subs.forEach(function (s) { return s(); });
|
|
267
|
-
};
|
|
268
|
-
return ContactMethodPlatform;
|
|
269
|
-
}());
|
|
270
|
-
export default ContactMethodPlatform;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
import { headingElement, Paragraph } from '@telia-ace/knowledge-widget-ui';
|
|
17
|
-
import * as React from 'react';
|
|
18
|
-
import styled, { css } from 'styled-components';
|
|
19
|
-
var Confirmation = function (props) { return (React.createElement(StyledParagraph, __assign({}, props, { className: "humany-confirmation" }))); };
|
|
20
|
-
export default Confirmation;
|
|
21
|
-
var StyledParagraph = styled(Paragraph)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), headingElement('h1', 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; })));
|
|
22
|
-
var templateObject_1, templateObject_2;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
import { headingElement, ItemList, itemList } from '@telia-ace/knowledge-widget-ui';
|
|
17
|
-
import { appendClassNames } from '@telia-ace/widget-utilities';
|
|
18
|
-
import React from 'react';
|
|
19
|
-
import styled, { css } from 'styled-components';
|
|
20
|
-
import ContactMethod from './contact-method';
|
|
21
|
-
export var contactItemList = 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"])), itemList, function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, headingElement('h1', 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; });
|
|
22
|
-
var StyledItemList = styled(ItemList)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), contactItemList);
|
|
23
|
-
var ContactList = function (_a) {
|
|
24
|
-
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;
|
|
25
|
-
if (!contactMethods.length) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
return (React.createElement(StyledItemList, { header: header, className: appendClassNames(className, 'humany-contact-list'), items: contactMethods, renderItem: function (cm) { return (React.createElement("li", { key: cm.id, "data-contact-method": cm.id },
|
|
29
|
-
React.createElement(ContactMethod, __assign({}, cm, { action: action, dispatch: dispatch, guideId: guideId })))); } }, children));
|
|
30
|
-
};
|
|
31
|
-
export default ContactList;
|
|
32
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
var __assign = (this && this.__assign) || function () {
|
|
6
|
-
__assign = Object.assign || function(t) {
|
|
7
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
|
-
s = arguments[i];
|
|
9
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
10
|
-
t[p] = s[p];
|
|
11
|
-
}
|
|
12
|
-
return t;
|
|
13
|
-
};
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
import { borderTabStyle, Link, StyledText, SymbolBadge, Typography, useComponent, useRouteData, } from '@telia-ace/knowledge-widget-ui';
|
|
17
|
-
import { createParams, formatUrl } from '@telia-ace/widget-utilities';
|
|
18
|
-
import React, { Suspense } from 'react';
|
|
19
|
-
import styled, { css } from 'styled-components';
|
|
20
|
-
import Description from './description';
|
|
21
|
-
var ContactMethod = function (props) {
|
|
22
|
-
var ResolvedComponent = useComponent(props.clientName);
|
|
23
|
-
var _a = useRouteData().params, contactCategory = _a.contactCategory, guideCategory = _a.guideCategory, phrase = _a.phrase;
|
|
24
|
-
if (typeof ResolvedComponent === 'undefined') {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
if (ResolvedComponent === null) {
|
|
28
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
return (React.createElement(NonResolvedContactMethodWrapper, { title: "client-name: ".concat(props.clientName, ", id: ").concat(props.id), className: "humany-non-resolved-contact-method" },
|
|
30
|
-
React.createElement(Typography, { variant: "h5" }, "Non resolved Contact Method type")));
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
var renderLink = function (extraProps) {
|
|
35
|
-
if (extraProps === void 0) { extraProps = {}; }
|
|
36
|
-
var enhancedProps = __assign(__assign({}, props), extraProps);
|
|
37
|
-
var id = enhancedProps.id, title = enhancedProps.title, clientName = enhancedProps.clientName, symbol = enhancedProps.symbol, inline = enhancedProps.inline, _a = enhancedProps.onClick, onClick = _a === void 0 ? function () { } : _a, description = enhancedProps.description, htmlParseInstruction = enhancedProps.htmlParseInstruction, className = enhancedProps.className, disabled = enhancedProps.disabled, guideId = enhancedProps.guideId, _b = enhancedProps.dispatch, dispatch = _b === void 0 ? function () { } : _b, expanded = enhancedProps.expanded;
|
|
38
|
-
var linkProps = inline
|
|
39
|
-
? {
|
|
40
|
-
onKeyDown: function (event) {
|
|
41
|
-
if (event.key && event.key === 'Enter') {
|
|
42
|
-
onClick(event, enhancedProps);
|
|
43
|
-
if (!event.defaultPrevented) {
|
|
44
|
-
!expanded && dispatch('expand', id);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
onClick: function (event) {
|
|
49
|
-
onClick(event, enhancedProps);
|
|
50
|
-
if (!event.defaultPrevented) {
|
|
51
|
-
!expanded && dispatch('expand', id);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
: {
|
|
56
|
-
onClick: function (event) { return onClick(event, enhancedProps); },
|
|
57
|
-
routeName: 'contact-method',
|
|
58
|
-
params: createParams({
|
|
59
|
-
contactCategory: contactCategory,
|
|
60
|
-
guideId: guideId,
|
|
61
|
-
guideCategory: guideCategory,
|
|
62
|
-
phrase: phrase,
|
|
63
|
-
contactMethod: id,
|
|
64
|
-
uriName: formatUrl(title),
|
|
65
|
-
}),
|
|
66
|
-
};
|
|
67
|
-
return (React.createElement(StyledLink, __assign({ title: title, "aria-label": title, className: className, disabled: disabled, description: description, "data-client-name": clientName }, extraProps, linkProps),
|
|
68
|
-
symbol && React.createElement(SymbolBadge, { symbol: symbol }),
|
|
69
|
-
description ? (React.createElement("div", { className: "humany-contact-link-rich-content" },
|
|
70
|
-
React.createElement(StyledTitle, null, title),
|
|
71
|
-
React.createElement(Description, { html: description, htmlParseInstruction: htmlParseInstruction }))) : (React.createElement(StyledTitle, null, title))));
|
|
72
|
-
};
|
|
73
|
-
return props.expanded ? (React.createElement(Suspense, { fallback: null },
|
|
74
|
-
React.createElement(ResolvedComponent, __assign({}, props, { renderDefault: renderLink })))) : (renderLink());
|
|
75
|
-
};
|
|
76
|
-
export default ContactMethod;
|
|
77
|
-
export var contactLink = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n padding: ", ";\n ", "\n text-decoration: none;\n span {\n display: inline-block;\n color: ", ";\n }\n i {\n font-size: ", ";\n margin: 0 ", " 0 0;\n min-height: ", ";\n min-width: ", ";\n line-height: ", ";\n display: inline-block;\n vertical-align: bottom;\n color: ", ";\n }\n"], ["\n display: flex;\n padding: ", ";\n ", "\n text-decoration: none;\n span {\n display: inline-block;\n color: ", ";\n }\n i {\n font-size: ", ";\n margin: 0 ", " 0 0;\n min-height: ", ";\n min-width: ", ";\n line-height: ", ";\n display: inline-block;\n vertical-align: bottom;\n color: ", ";\n }\n"])), function (p) { var _a; return (_a = p.theme.sizes) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { return (!!p.description ? '' : 'align-items: center;'); }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.large; }, 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.fonts) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.large; }, function (p) { var _a; return (_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.text; });
|
|
78
|
-
var StyledTitle = styled(StyledText)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n line-height: ", ";\n"], ["\n line-height: ", ";\n"])), function (p) { var _a; return (_a = p.theme.fonts) === null || _a === void 0 ? void 0 : _a.large; });
|
|
79
|
-
var StyledLink = styled(Link)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n ", "\n\n &:focus {\n ", ";\n }\n"], ["\n ", "\n\n &:focus {\n ", ";\n }\n"])), contactLink, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; });
|
|
80
|
-
var NonResolvedContactMethodWrapper = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-align: center;\n display: block;\n ", "\n"], ["\n text-align: center;\n display: block;\n ", "\n"])), function (p) { var _a, _b; return typeof ((_a = p.theme.colors) === null || _a === void 0 ? void 0 : _a.warning) !== 'undefined' && "color: ".concat((_b = p.theme.colors) === null || _b === void 0 ? void 0 : _b.warning, ";"); });
|
|
81
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
-
return cooked;
|
|
4
|
-
};
|
|
5
|
-
import { borderTabStyle, genericHtml, Html, linkTabStyle } from '@telia-ace/knowledge-widget-ui';
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
export default styled(Html)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n font-weight: 300;\n line-height: 1.5em;\n button:focus {\n ", ";\n }\n\n a:focus {\n ", ";\n }\n"], ["\n ", "\n font-weight: 300;\n line-height: 1.5em;\n button:focus {\n ", ";\n }\n\n a:focus {\n ", ";\n }\n"])), genericHtml, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && borderTabStyle; }, function (p) { var _a; return ((_a = p.theme.accessibility) === null || _a === void 0 ? void 0 : _a.isTabbing) && linkTabStyle; });
|
|
8
|
-
var templateObject_1;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { FormComponent } from '@telia-ace/widget-forms';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
/**
|
|
4
|
-
* Recursively find form component in schema
|
|
5
|
-
* @param node Form schema
|
|
6
|
-
* @param id actionKey of component to find
|
|
7
|
-
*/
|
|
8
|
-
var lookupComponent = function (node, id) {
|
|
9
|
-
if (node.actionKey === id) {
|
|
10
|
-
return node;
|
|
11
|
-
}
|
|
12
|
-
if (!node.properties) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
var keys = Object.keys(node.properties);
|
|
16
|
-
var result;
|
|
17
|
-
// tslint:disable-next-line:no-increment-decrement
|
|
18
|
-
for (var i = 0; i < keys.length; i++) {
|
|
19
|
-
result = lookupComponent(node.properties[keys[i]], id);
|
|
20
|
-
if (result) {
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
return false;
|
|
25
|
-
};
|
|
26
|
-
var Form = function (_a) {
|
|
27
|
-
var className = _a.className, form = _a.body.form, id = _a.id, action = _a.action, dispatch = _a.dispatch, disabled = _a.disabled, autoFocus = _a.autoFocus;
|
|
28
|
-
if (form && !disabled) {
|
|
29
|
-
var schema_1 = form.schema, layout_1 = form.layout, data = form.data;
|
|
30
|
-
var trigger_1 = dispatch || action || (function () { });
|
|
31
|
-
return (React.createElement(FormComponent, { className: className, schema: schema_1, layout: layout_1, data: data, autoFocus: autoFocus, onChange: function (event, data) {
|
|
32
|
-
var form = { schema: schema_1, layout: layout_1, data: data };
|
|
33
|
-
if (event.toString() === 'submit') {
|
|
34
|
-
trigger_1('submit', { id: id, form: form });
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
var formComponent = lookupComponent(schema_1, event);
|
|
38
|
-
if (formComponent.evaluate) {
|
|
39
|
-
trigger_1('evaluate', { id: id, form: form });
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
trigger_1('validate', { id: id, form: form });
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
} }));
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
};
|
|
49
|
-
export default Form;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { default as Confirmation } from './confirmation';
|
|
2
|
-
export { contactItemList, default as ContactList } from './contact-list';
|
|
3
|
-
export { contactLink, default as ContactMethod } from './contact-method';
|
|
4
|
-
export { default as Description } from './description';
|
|
5
|
-
export { default as Form } from './form';
|
|
6
|
-
export { default as useContactMethod } from './use-contact-method';
|