@telia-ace/knowledge-widget-adapters 1.0.1
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/LICENSE.txt +6 -0
- package/README.md +3 -0
- package/lib/contact-methods/chat-popup/chat-popup-plugin.d.ts +2 -0
- package/lib/contact-methods/chat-popup/chat-popup-plugin.js +79 -0
- package/lib/contact-methods/chat-popup/index.d.ts +1 -0
- package/lib/contact-methods/chat-popup/index.js +8 -0
- package/lib/contact-methods/email/email-form-component.d.ts +4 -0
- package/lib/contact-methods/email/email-form-component.js +58 -0
- package/lib/contact-methods/email/email-plugin.d.ts +16 -0
- package/lib/contact-methods/email/email-plugin.js +83 -0
- package/lib/contact-methods/email/index.d.ts +1 -0
- package/lib/contact-methods/email/index.js +12 -0
- package/lib/contact-methods/free-text/free-text-component.d.ts +4 -0
- package/lib/contact-methods/free-text/free-text-component.js +49 -0
- package/lib/contact-methods/free-text/free-text-plugin.d.ts +2 -0
- package/lib/contact-methods/free-text/free-text-plugin.js +34 -0
- package/lib/contact-methods/free-text/index.d.ts +1 -0
- package/lib/contact-methods/free-text/index.js +8 -0
- package/lib/contact-methods/index.d.ts +10 -0
- package/lib/contact-methods/index.js +31 -0
- package/lib/contact-methods/link/index.d.ts +1 -0
- package/lib/contact-methods/link/index.js +8 -0
- package/lib/contact-methods/link/link-component.d.ts +4 -0
- package/lib/contact-methods/link/link-component.js +13 -0
- package/lib/contact-methods/link/link-plugin.d.ts +2 -0
- package/lib/contact-methods/link/link-plugin.js +34 -0
- package/lib/contact-methods/phone/index.d.ts +1 -0
- package/lib/contact-methods/phone/index.js +8 -0
- package/lib/contact-methods/phone/phone-component.d.ts +4 -0
- package/lib/contact-methods/phone/phone-component.js +12 -0
- package/lib/contact-methods/phone/phone-plugin.d.ts +2 -0
- package/lib/contact-methods/phone/phone-plugin.js +34 -0
- package/lib/contact-methods/platform.d.ts +49 -0
- package/lib/contact-methods/platform.js +256 -0
- package/lib/contact-methods/ui/confirmation.d.ts +6 -0
- package/lib/contact-methods/ui/confirmation.js +47 -0
- package/lib/contact-methods/ui/contact-list.d.ts +15 -0
- package/lib/contact-methods/ui/contact-list.js +61 -0
- package/lib/contact-methods/ui/contact-method.d.ts +39 -0
- package/lib/contact-methods/ui/contact-method.js +110 -0
- package/lib/contact-methods/ui/description.d.ts +3 -0
- package/lib/contact-methods/ui/description.js +13 -0
- package/lib/contact-methods/ui/form.d.ts +4 -0
- package/lib/contact-methods/ui/form.js +54 -0
- package/lib/contact-methods/ui/index.d.ts +7 -0
- package/lib/contact-methods/ui/index.js +20 -0
- package/lib/contact-methods/ui/use-contact-method.d.ts +2 -0
- package/lib/contact-methods/ui/use-contact-method.js +39 -0
- package/lib/contact-methods/web-service/index.d.ts +1 -0
- package/lib/contact-methods/web-service/index.js +8 -0
- package/lib/contact-methods/web-service/web-service-plugin.d.ts +2 -0
- package/lib/contact-methods/web-service/web-service-plugin.js +30 -0
- package/lib/create-adapter.d.ts +7 -0
- package/lib/create-adapter.js +43 -0
- package/lib/default-contact-methods-plugin.d.ts +8 -0
- package/lib/default-contact-methods-plugin.js +42 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +25 -0
- package/lib-esm/contact-methods/chat-popup/chat-popup-plugin.d.ts +2 -0
- package/lib-esm/contact-methods/chat-popup/chat-popup-plugin.js +76 -0
- package/lib-esm/contact-methods/chat-popup/index.d.ts +1 -0
- package/lib-esm/contact-methods/chat-popup/index.js +1 -0
- package/lib-esm/contact-methods/email/email-form-component.d.ts +4 -0
- package/lib-esm/contact-methods/email/email-form-component.js +33 -0
- package/lib-esm/contact-methods/email/email-plugin.d.ts +16 -0
- package/lib-esm/contact-methods/email/email-plugin.js +52 -0
- package/lib-esm/contact-methods/email/index.d.ts +1 -0
- package/lib-esm/contact-methods/email/index.js +1 -0
- package/lib-esm/contact-methods/free-text/free-text-component.d.ts +4 -0
- package/lib-esm/contact-methods/free-text/free-text-component.js +21 -0
- package/lib-esm/contact-methods/free-text/free-text-plugin.d.ts +2 -0
- package/lib-esm/contact-methods/free-text/free-text-plugin.js +8 -0
- package/lib-esm/contact-methods/free-text/index.d.ts +1 -0
- package/lib-esm/contact-methods/free-text/index.js +1 -0
- package/lib-esm/contact-methods/index.d.ts +10 -0
- package/lib-esm/contact-methods/index.js +8 -0
- package/lib-esm/contact-methods/link/index.d.ts +1 -0
- package/lib-esm/contact-methods/link/index.js +1 -0
- package/lib-esm/contact-methods/link/link-component.d.ts +4 -0
- package/lib-esm/contact-methods/link/link-component.js +11 -0
- package/lib-esm/contact-methods/link/link-plugin.d.ts +2 -0
- package/lib-esm/contact-methods/link/link-plugin.js +8 -0
- package/lib-esm/contact-methods/phone/index.d.ts +1 -0
- package/lib-esm/contact-methods/phone/index.js +1 -0
- package/lib-esm/contact-methods/phone/phone-component.d.ts +4 -0
- package/lib-esm/contact-methods/phone/phone-component.js +10 -0
- package/lib-esm/contact-methods/phone/phone-plugin.d.ts +2 -0
- package/lib-esm/contact-methods/phone/phone-plugin.js +8 -0
- package/lib-esm/contact-methods/platform.d.ts +49 -0
- package/lib-esm/contact-methods/platform.js +253 -0
- package/lib-esm/contact-methods/ui/confirmation.d.ts +6 -0
- package/lib-esm/contact-methods/ui/confirmation.js +22 -0
- package/lib-esm/contact-methods/ui/contact-list.d.ts +15 -0
- package/lib-esm/contact-methods/ui/contact-list.js +32 -0
- package/lib-esm/contact-methods/ui/contact-method.d.ts +39 -0
- package/lib-esm/contact-methods/ui/contact-method.js +81 -0
- package/lib-esm/contact-methods/ui/description.d.ts +3 -0
- package/lib-esm/contact-methods/ui/description.js +8 -0
- package/lib-esm/contact-methods/ui/form.d.ts +4 -0
- package/lib-esm/contact-methods/ui/form.js +49 -0
- package/lib-esm/contact-methods/ui/index.d.ts +7 -0
- package/lib-esm/contact-methods/ui/index.js +6 -0
- package/lib-esm/contact-methods/ui/use-contact-method.d.ts +2 -0
- package/lib-esm/contact-methods/ui/use-contact-method.js +37 -0
- package/lib-esm/contact-methods/web-service/index.d.ts +1 -0
- package/lib-esm/contact-methods/web-service/index.js +1 -0
- package/lib-esm/contact-methods/web-service/web-service-plugin.d.ts +2 -0
- package/lib-esm/contact-methods/web-service/web-service-plugin.js +27 -0
- package/lib-esm/create-adapter.d.ts +7 -0
- package/lib-esm/create-adapter.js +39 -0
- package/lib-esm/default-contact-methods-plugin.d.ts +8 -0
- package/lib-esm/default-contact-methods-plugin.js +39 -0
- package/lib-esm/index.d.ts +5 -0
- package/lib-esm/index.js +3 -0
- package/package.json +43 -0
package/LICENSE.txt
ADDED
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
+
if (!m) return o;
|
|
16
|
+
var i = m.call(o), r, ar = [], e;
|
|
17
|
+
try {
|
|
18
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
+
}
|
|
20
|
+
catch (error) { e = { error: error }; }
|
|
21
|
+
finally {
|
|
22
|
+
try {
|
|
23
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
+
}
|
|
25
|
+
finally { if (e) throw e.error; }
|
|
26
|
+
}
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var widget_forms_1 = require("@telia-ace/widget-forms");
|
|
31
|
+
var __1 = require("..");
|
|
32
|
+
var email_1 = require("../email");
|
|
33
|
+
var popup = function (title, settings, formValues) {
|
|
34
|
+
var url = settings.url, width = settings.width, height = settings.height;
|
|
35
|
+
var queries = formValues ? formValues : {};
|
|
36
|
+
var link = document.createElement('a');
|
|
37
|
+
link.href = url;
|
|
38
|
+
link.search
|
|
39
|
+
.replace('?', '')
|
|
40
|
+
.split('&')
|
|
41
|
+
.forEach(function (part) {
|
|
42
|
+
var _a = __read(part.split('='), 2), key = _a[0], value = _a[1];
|
|
43
|
+
typeof value !== 'undefined' && (queries[key] = value);
|
|
44
|
+
});
|
|
45
|
+
link.search = Object.keys(queries)
|
|
46
|
+
.map(function (key) { return "".concat(key, "=").concat(queries[key]); })
|
|
47
|
+
.join('&');
|
|
48
|
+
window.open(link.href, title, "width=".concat(width, ",height=").concat(height));
|
|
49
|
+
return '';
|
|
50
|
+
};
|
|
51
|
+
function chatPopupPlugin(container) {
|
|
52
|
+
container.getAsync('contactMethods').then(function (platform) {
|
|
53
|
+
platform.create({
|
|
54
|
+
clientName: 'chat.popup',
|
|
55
|
+
render: 'email.form',
|
|
56
|
+
handleClick: function (contactMethod) {
|
|
57
|
+
var title = contactMethod.title, body = contactMethod.body;
|
|
58
|
+
var form = body.form, guideId = body.guideId, confirmationFallback = body.confirmationFallback, rest = __rest(body, ["form", "guideId", "confirmationFallback"]);
|
|
59
|
+
if (!form) {
|
|
60
|
+
return function (e) {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
popup(title, rest);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return function () { };
|
|
66
|
+
},
|
|
67
|
+
onValidate: function (contactMethod) { return (0, __1.defaultValidate)(container, contactMethod); },
|
|
68
|
+
onComplete: function (contactMethod) { return (0, email_1.defaultComplete)(container, contactMethod); },
|
|
69
|
+
onSubmit: function (contactMethod) {
|
|
70
|
+
var title = contactMethod.title, body = contactMethod.body;
|
|
71
|
+
var form = body.form, guideId = body.guideId, confirmationFallback = body.confirmationFallback, rest = __rest(body, ["form", "guideId", "confirmationFallback"]);
|
|
72
|
+
var formValues = new widget_forms_1.FormReader(form).export().values;
|
|
73
|
+
popup(title, rest, formValues);
|
|
74
|
+
return confirmationFallback;
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
exports.default = chatPopupPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ChatPopupPlugin } from './chat-popup-plugin';
|
|
@@ -0,0 +1,8 @@
|
|
|
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.ChatPopupPlugin = void 0;
|
|
7
|
+
var chat_popup_plugin_1 = require("./chat-popup-plugin");
|
|
8
|
+
Object.defineProperty(exports, "ChatPopupPlugin", { enumerable: true, get: function () { return __importDefault(chat_popup_plugin_1).default; } });
|
|
@@ -0,0 +1,58 @@
|
|
|
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 widget_utilities_1 = require("@telia-ace/widget-utilities");
|
|
43
|
+
var React = __importStar(require("react"));
|
|
44
|
+
var styled_components_1 = __importStar(require("styled-components"));
|
|
45
|
+
var ui_1 = require("../ui");
|
|
46
|
+
var StyledHtml = (0, styled_components_1.default)(knowledge_widget_ui_1.Html)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n\n ", "\n"], ["\n ", "\n\n ", "\n"])), knowledge_widget_ui_1.genericHtml, (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 EmailFormComponent = function (props) {
|
|
48
|
+
var className = props.className, _a = props.renderDefault, renderDefault = _a === void 0 ? function () { } : _a, form = props.body.form, confirmation = props.confirmation, htmlParseInstruction = props.htmlParseInstruction, disabled = props.disabled;
|
|
49
|
+
if (confirmation) {
|
|
50
|
+
return (React.createElement(StyledHtml, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-method-confirmation', 'humany-contact-method-email'), html: confirmation, htmlParseInstruction: htmlParseInstruction }));
|
|
51
|
+
}
|
|
52
|
+
if (form && !disabled) {
|
|
53
|
+
return (React.createElement(ui_1.Form, __assign({}, props, { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-method-email') })));
|
|
54
|
+
}
|
|
55
|
+
return renderDefault();
|
|
56
|
+
};
|
|
57
|
+
exports.default = EmailFormComponent;
|
|
58
|
+
var templateObject_1, templateObject_2;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SubmissionApiResult } from '@telia-ace/knowledge-serviceclient';
|
|
2
|
+
import { Container } from '@webprovisions/platform';
|
|
3
|
+
import { ContactMethodType } from '../ui';
|
|
4
|
+
export declare const submit: (container: Container, contactMethod: ContactMethodType, transform?: ((response: any) => SubmissionApiResult) | undefined) => Promise<string>;
|
|
5
|
+
export declare const validate: (container: Container, contactMethod: ContactMethodType) => Promise<{
|
|
6
|
+
valid: boolean;
|
|
7
|
+
errors: {
|
|
8
|
+
[key: string]: string;
|
|
9
|
+
};
|
|
10
|
+
errorTypes: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
export declare const evaluate: (container: Container, contactMethod: ContactMethodType) => Promise<import("@telia-ace/widget-forms").Form>;
|
|
15
|
+
export declare const complete: (container: Container, contactMethod: ContactMethodType) => Promise<void>;
|
|
16
|
+
export default function emailPlugin(container: Container): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
exports.complete = exports.evaluate = exports.validate = exports.submit = void 0;
|
|
27
|
+
var widget_forms_1 = require("@telia-ace/widget-forms");
|
|
28
|
+
var post = function (container, contactMethod, validate) {
|
|
29
|
+
if (validate === void 0) { validate = false; }
|
|
30
|
+
return container.getManyAsync('matchingClient', 'router').then(function (services) {
|
|
31
|
+
var formData = new widget_forms_1.FormReader(contactMethod.body.form).export(validate).formData;
|
|
32
|
+
var _a = services, router = _a.router, matchingClient = _a.matchingClient;
|
|
33
|
+
var params = router.getRouteData().params;
|
|
34
|
+
return matchingClient.customRequest("contactmethods/".concat(contactMethod.id).concat(validate ? '/validatedwithpayload' : ''), 'POST', {
|
|
35
|
+
body: formData,
|
|
36
|
+
configuration: {
|
|
37
|
+
guideId: contactMethod.body.guideId || params.guideId,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
var submit = function (container, contactMethod, transform) {
|
|
43
|
+
return post(container, contactMethod)
|
|
44
|
+
.then(function (response) { return (transform ? transform(response) : response); })
|
|
45
|
+
.then(function (_a) {
|
|
46
|
+
var ConfirmationText = _a.ConfirmationText;
|
|
47
|
+
return ConfirmationText;
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
exports.submit = submit;
|
|
51
|
+
var validate = function (container, contactMethod) {
|
|
52
|
+
return post(container, contactMethod, true).then(function (result) { return ({
|
|
53
|
+
valid: result.Validation.IsValid,
|
|
54
|
+
errors: result.Validation.Errors,
|
|
55
|
+
errorTypes: result.Validation.ErrorTypes,
|
|
56
|
+
}); });
|
|
57
|
+
};
|
|
58
|
+
exports.validate = validate;
|
|
59
|
+
var evaluate = function (container, contactMethod) {
|
|
60
|
+
return post(container, contactMethod, true).then(function (result) {
|
|
61
|
+
return widget_forms_1.FormBuilder.fromLegacyForm(contactMethod.id, result.ContactMethod.Form).get();
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
exports.evaluate = evaluate;
|
|
65
|
+
var complete = function (container, contactMethod) {
|
|
66
|
+
return container.getAsync('matchingClient').then(function (matchingClient) {
|
|
67
|
+
matchingClient.completeContactMethod(contactMethod.id);
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
exports.complete = complete;
|
|
71
|
+
function emailPlugin(container) {
|
|
72
|
+
container.getAsync('contactMethods').then(function (platform) {
|
|
73
|
+
platform.create({
|
|
74
|
+
clientName: 'email.form',
|
|
75
|
+
render: Promise.resolve().then(function () { return __importStar(require('./email-form-component')); }),
|
|
76
|
+
onEvaluate: function (contactMethod) { return (0, exports.evaluate)(container, contactMethod); },
|
|
77
|
+
onValidate: function (contactMethod) { return (0, exports.validate)(container, contactMethod); },
|
|
78
|
+
onSubmit: function (contactMethod) { return (0, exports.submit)(container, contactMethod); },
|
|
79
|
+
onComplete: function (contactMethod) { return (0, exports.complete)(container, contactMethod); },
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
exports.default = emailPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { complete as defaultComplete, default as EmailPlugin, evaluate as defaultEvaluate, submit as defaultSubmit, validate as defaultValidate, } from './email-plugin';
|
|
@@ -0,0 +1,12 @@
|
|
|
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.defaultValidate = exports.defaultSubmit = exports.defaultEvaluate = exports.EmailPlugin = exports.defaultComplete = void 0;
|
|
7
|
+
var email_plugin_1 = require("./email-plugin");
|
|
8
|
+
Object.defineProperty(exports, "defaultComplete", { enumerable: true, get: function () { return email_plugin_1.complete; } });
|
|
9
|
+
Object.defineProperty(exports, "EmailPlugin", { enumerable: true, get: function () { return __importDefault(email_plugin_1).default; } });
|
|
10
|
+
Object.defineProperty(exports, "defaultEvaluate", { enumerable: true, get: function () { return email_plugin_1.evaluate; } });
|
|
11
|
+
Object.defineProperty(exports, "defaultSubmit", { enumerable: true, get: function () { return email_plugin_1.submit; } });
|
|
12
|
+
Object.defineProperty(exports, "defaultValidate", { enumerable: true, get: function () { return email_plugin_1.validate; } });
|
|
@@ -0,0 +1,49 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
|
+
};
|
|
32
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
+
var knowledge_widget_ui_1 = require("@telia-ace/knowledge-widget-ui");
|
|
34
|
+
var widget_utilities_1 = require("@telia-ace/widget-utilities");
|
|
35
|
+
var React = __importStar(require("react"));
|
|
36
|
+
var styled_components_1 = __importDefault(require("styled-components"));
|
|
37
|
+
var ui_1 = require("../ui");
|
|
38
|
+
var FreeTextComponent = function (_a) {
|
|
39
|
+
var className = _a.className, description = _a.description, freetext = _a.body.freetext, htmlParseInstruction = _a.htmlParseInstruction;
|
|
40
|
+
if (!freetext) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return (React.createElement("div", { className: (0, widget_utilities_1.appendClassNames)(className, 'humany-contact-method-free-text') },
|
|
44
|
+
React.createElement(StyledHtml, { html: freetext, htmlParseInstruction: htmlParseInstruction }),
|
|
45
|
+
description && (React.createElement(ui_1.Description, { html: description, htmlParseInstruction: htmlParseInstruction }))));
|
|
46
|
+
};
|
|
47
|
+
exports.default = FreeTextComponent;
|
|
48
|
+
var StyledHtml = (0, styled_components_1.default)(knowledge_widget_ui_1.Html)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", ";\n"], ["\n ", ";\n"])), knowledge_widget_ui_1.genericHtml);
|
|
49
|
+
var templateObject_1;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 freeTextPlugin(container) {
|
|
27
|
+
container.getAsync('contactMethods').then(function (platform) {
|
|
28
|
+
platform.create({
|
|
29
|
+
clientName: 'custom.freetext',
|
|
30
|
+
render: Promise.resolve().then(function () { return __importStar(require('./free-text-component')); }),
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.default = freeTextPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FreeTextPlugin } from './free-text-plugin';
|
|
@@ -0,0 +1,8 @@
|
|
|
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.FreeTextPlugin = void 0;
|
|
7
|
+
var free_text_plugin_1 = require("./free-text-plugin");
|
|
8
|
+
Object.defineProperty(exports, "FreeTextPlugin", { enumerable: true, get: function () { return __importDefault(free_text_plugin_1).default; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
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 type { Click as ContactMethodClick, ReactComponentImport } from './platform';
|
|
8
|
+
export { contactItemList, contactLink, ContactList, ContactMethod, Form as DefaultForm, useContactMethod, } from './ui';
|
|
9
|
+
export type { ContactMethodType } from './ui';
|
|
10
|
+
export { WebServicePlugin } from './web-service';
|
|
@@ -0,0 +1,31 @@
|
|
|
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; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as LinkPlugin } from './link-plugin';
|
|
@@ -0,0 +1,8 @@
|
|
|
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; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as PhonePlugin } from './phone-plugin';
|
|
@@ -0,0 +1,8 @@
|
|
|
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; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
@@ -0,0 +1,34 @@
|
|
|
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;
|