@telia-ace/knowledge-widget-adapters 1.0.22 → 1.0.23
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/dist/email-form-component.e13f4117.js +51 -0
- package/dist/email-form-component.e13f4117.js.map +1 -0
- package/dist/free-text-component.bea8185a.js +27 -0
- package/dist/free-text-component.bea8185a.js.map +1 -0
- package/dist/index.e9a517ef.js +578 -0
- package/dist/index.e9a517ef.js.map +1 -0
- package/dist/index.js +22 -1
- package/dist/link-component.484bbcf2.js +18 -0
- package/dist/link-component.484bbcf2.js.map +1 -0
- package/dist/phone-component.0c878514.js +15 -0
- package/dist/phone-component.0c878514.js.map +1 -0
- package/package.json +12 -9
- package/dist/email-form-component.js +0 -63
- package/dist/email-form-component.js.map +0 -1
- package/dist/free-text-component.js +0 -31
- package/dist/free-text-component.js.map +0 -1
- package/dist/index2.js +0 -703
- package/dist/index2.js.map +0 -1
- package/dist/link-component.js +0 -16
- package/dist/link-component.js.map +0 -1
- package/dist/phone-component.js +0 -15
- package/dist/phone-component.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var h = Object.defineProperty, u = Object.defineProperties;
|
|
2
|
+
var p = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var a = Object.getOwnPropertySymbols;
|
|
4
|
+
var y = Object.prototype.hasOwnProperty, E = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var n = (m, t, e) => t in m ? h(m, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[t] = e, r = (m, t) => {
|
|
6
|
+
for (var e in t || (t = {}))
|
|
7
|
+
y.call(t, e) && n(m, e, t[e]);
|
|
8
|
+
if (a)
|
|
9
|
+
for (var e of a(t))
|
|
10
|
+
E.call(t, e) && n(m, e, t[e]);
|
|
11
|
+
return m;
|
|
12
|
+
}, i = (m, t) => u(m, p(t));
|
|
13
|
+
import { Html as N, genericHtml as g, headingElement as F } from "@telia-ace/knowledge-widget-ui";
|
|
14
|
+
import { appendClassNames as s } from "@telia-ace/widget-utilities";
|
|
15
|
+
import * as l from "react";
|
|
16
|
+
import H, { css as $ } from "styled-components";
|
|
17
|
+
import { F as b } from "./index.e9a517ef.js";
|
|
18
|
+
import "@telia-ace/widget-forms";
|
|
19
|
+
import "@telia-ace/knowledge-widget-core";
|
|
20
|
+
const C = H(N)`
|
|
21
|
+
${g}
|
|
22
|
+
|
|
23
|
+
${F("h1", $`
|
|
24
|
+
font-weight: normal;
|
|
25
|
+
font-size: ${(m) => {
|
|
26
|
+
var t;
|
|
27
|
+
return (t = m.theme.fonts) == null ? void 0 : t.medium;
|
|
28
|
+
}};
|
|
29
|
+
`)}
|
|
30
|
+
`, S = (m) => {
|
|
31
|
+
const {
|
|
32
|
+
className: t,
|
|
33
|
+
renderDefault: e = () => {
|
|
34
|
+
},
|
|
35
|
+
body: { form: c },
|
|
36
|
+
confirmation: o,
|
|
37
|
+
htmlParseInstruction: f,
|
|
38
|
+
disabled: d
|
|
39
|
+
} = m;
|
|
40
|
+
return o ? /* @__PURE__ */ l.createElement(C, {
|
|
41
|
+
className: s(t, "humany-contact-method-confirmation", "humany-contact-method-email"),
|
|
42
|
+
html: o,
|
|
43
|
+
htmlParseInstruction: f
|
|
44
|
+
}) : c && !d ? /* @__PURE__ */ l.createElement(b, i(r({}, m), {
|
|
45
|
+
className: s(t, "humany-contact-method-email")
|
|
46
|
+
})) : e();
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
S as default
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=email-form-component.e13f4117.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-form-component.e13f4117.js","sources":["../src/contact-methods/email/email-form-component.tsx"],"sourcesContent":["import { genericHtml, headingElement, Html } from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport * as React from 'react';\r\nimport styled, { css } from 'styled-components';\r\nimport { ContactMethodProps, Form } from '../ui';\r\n\r\nconst StyledHtml = styled(Html)`\r\n ${genericHtml}\r\n\r\n ${headingElement(\r\n 'h1',\r\n css`\r\n font-weight: normal;\r\n font-size: ${(p) => p.theme.fonts?.medium};\r\n `\r\n )}\r\n`;\r\n\r\nconst EmailFormComponent: React.FC<ContactMethodProps> = (props) => {\r\n const {\r\n className,\r\n renderDefault = () => {},\r\n body: { form },\r\n confirmation,\r\n htmlParseInstruction,\r\n disabled,\r\n } = props;\r\n\r\n if (confirmation) {\r\n return (\r\n <StyledHtml\r\n className={appendClassNames(\r\n className,\r\n 'humany-contact-method-confirmation',\r\n 'humany-contact-method-email'\r\n )}\r\n html={confirmation}\r\n htmlParseInstruction={htmlParseInstruction}\r\n />\r\n );\r\n }\r\n\r\n if (form && !disabled) {\r\n return (\r\n <Form\r\n {...props}\r\n className={appendClassNames(className, 'humany-contact-method-email')}\r\n />\r\n );\r\n }\r\n\r\n return renderDefault();\r\n};\r\n\r\nexport default EmailFormComponent;\r\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,MAAM,IAAa,EAAO,CAAI;AAAA,MACxB;AAAA;AAAA,MAEA,EACE,MACA;AAAA;AAAA,yBAEiB,CAAC,MAAM;;AAAA,gBAAE,MAAM,UAAR,kBAAe;AAAA;AAAA,SAE3C;AAAA,GAGE,IAAmD,CAAC,MAAU;AAC1D,QAAA;AAAA,IACF;AAAA,IACA,mBAAgB,MAAM;AAAA,IAAC;AAAA,IACvB,MAAM,EAAE;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,MACA;AAEJ,SAAI,IAEK,kBAAA,cAAA,GAAA;AAAA,IACG,WAAW,EACP,GACA,sCACA,6BACJ;AAAA,IACA,MAAM;AAAA,IACN;AAAA,EAAA,CACJ,IAIJ,KAAQ,CAAC,IAEJ,kBAAA,cAAA,GAAA,QACO,IADP;AAAA,IAEG,WAAW,EAAiB,GAAW,6BAA6B;AAAA,EAAA,EACxE,IAID,EAAc;AACzB;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Html as a, genericHtml as l } from "@telia-ace/knowledge-widget-ui";
|
|
2
|
+
import { appendClassNames as n } from "@telia-ace/widget-utilities";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import p from "styled-components";
|
|
5
|
+
import { D as c } from "./index.e9a517ef.js";
|
|
6
|
+
import "@telia-ace/widget-forms";
|
|
7
|
+
import "@telia-ace/knowledge-widget-core";
|
|
8
|
+
const E = ({
|
|
9
|
+
className: o,
|
|
10
|
+
description: e,
|
|
11
|
+
body: { freetext: m },
|
|
12
|
+
htmlParseInstruction: r
|
|
13
|
+
}) => m ? /* @__PURE__ */ t.createElement("div", {
|
|
14
|
+
className: n(o, "humany-contact-method-free-text")
|
|
15
|
+
}, /* @__PURE__ */ t.createElement(i, {
|
|
16
|
+
html: m,
|
|
17
|
+
htmlParseInstruction: r
|
|
18
|
+
}), e && /* @__PURE__ */ t.createElement(c, {
|
|
19
|
+
html: e,
|
|
20
|
+
htmlParseInstruction: r
|
|
21
|
+
})) : null, i = p(a)`
|
|
22
|
+
${l};
|
|
23
|
+
`;
|
|
24
|
+
export {
|
|
25
|
+
E as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=free-text-component.bea8185a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"free-text-component.bea8185a.js","sources":["../src/contact-methods/free-text/free-text-component.tsx"],"sourcesContent":["import { genericHtml, Html } from '@telia-ace/knowledge-widget-ui';\r\nimport { appendClassNames } from '@telia-ace/widget-utilities';\r\nimport * as React from 'react';\r\nimport styled from 'styled-components';\r\nimport { ContactMethodProps, Description } from '../ui';\r\n\r\nconst FreeTextComponent: React.SFC<ContactMethodProps> = ({\r\n className,\r\n description,\r\n body: { freetext },\r\n htmlParseInstruction,\r\n}) => {\r\n if (!freetext) {\r\n return null;\r\n }\r\n return (\r\n <div className={appendClassNames(className, 'humany-contact-method-free-text')}>\r\n <StyledHtml html={freetext} htmlParseInstruction={htmlParseInstruction} />\r\n {description && (\r\n <Description html={description} htmlParseInstruction={htmlParseInstruction} />\r\n )}\r\n </div>\r\n );\r\n};\r\n\r\nexport default FreeTextComponent;\r\n\r\nconst StyledHtml = styled(Html)`\r\n ${genericHtml};\r\n`;\r\n"],"names":[],"mappings":";;;;;;;AAMA,MAAM,IAAmD,CAAC;AAAA,EACtD;AAAA,EACA;AAAA,EACA,MAAM,EAAE;AAAA,EACR;AAAA,MAEK,IAIA,kBAAA,cAAA,OAAA;AAAA,EAAI,WAAW,EAAiB,GAAW,iCAAiC;AAAA,GACxE,kBAAA,cAAA,GAAA;AAAA,EAAW,MAAM;AAAA,EAAU;AAA4C,CAAA,GACvE,KACI,kBAAA,cAAA,GAAA;AAAA,EAAY,MAAM;AAAA,EAAa;AAA4C,CAAA,CAEpF,IARO,MAcT,IAAa,EAAO,CAAI;AAAA,MACxB;AAAA;"}
|
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
var _ = Object.defineProperty, J = Object.defineProperties;
|
|
2
|
+
var Q = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var P = Object.getOwnPropertySymbols;
|
|
4
|
+
var V = Object.prototype.hasOwnProperty, D = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var R = (t, e, n) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, u = (t, e) => {
|
|
6
|
+
for (var n in e || (e = {}))
|
|
7
|
+
V.call(e, n) && R(t, n, e[n]);
|
|
8
|
+
if (P)
|
|
9
|
+
for (var n of P(e))
|
|
10
|
+
D.call(e, n) && R(t, n, e[n]);
|
|
11
|
+
return t;
|
|
12
|
+
}, y = (t, e) => J(t, Q(e));
|
|
13
|
+
var $ = (t, e) => {
|
|
14
|
+
var n = {};
|
|
15
|
+
for (var o in t)
|
|
16
|
+
V.call(t, o) && e.indexOf(o) < 0 && (n[o] = t[o]);
|
|
17
|
+
if (t != null && P)
|
|
18
|
+
for (var o of P(t))
|
|
19
|
+
e.indexOf(o) < 0 && D.call(t, o) && (n[o] = t[o]);
|
|
20
|
+
return n;
|
|
21
|
+
};
|
|
22
|
+
var b = (t, e, n) => new Promise((o, a) => {
|
|
23
|
+
var c = (r) => {
|
|
24
|
+
try {
|
|
25
|
+
s(n.next(r));
|
|
26
|
+
} catch (l) {
|
|
27
|
+
a(l);
|
|
28
|
+
}
|
|
29
|
+
}, i = (r) => {
|
|
30
|
+
try {
|
|
31
|
+
s(n.throw(r));
|
|
32
|
+
} catch (l) {
|
|
33
|
+
a(l);
|
|
34
|
+
}
|
|
35
|
+
}, s = (r) => r.done ? o(r.value) : Promise.resolve(r.value).then(c, i);
|
|
36
|
+
s((n = n.apply(t, e)).next());
|
|
37
|
+
});
|
|
38
|
+
import { FormReader as x, FormBuilder as X, FormComponent as Y } from "@telia-ace/widget-forms";
|
|
39
|
+
import { ComponentPlatform as L, Plugin as Z } from "@telia-ace/knowledge-widget-core";
|
|
40
|
+
import { lock as ee, createParams as te, formatUrl as ne, appendClassNames as oe } from "@telia-ace/widget-utilities";
|
|
41
|
+
import d, { lazy as ae, Suspense as re, useState as ie, useEffect as se } from "react";
|
|
42
|
+
import { Paragraph as ce, headingElement as j, Html as le, genericHtml as me, borderTabStyle as O, linkTabStyle as de, StyledText as he, Link as ue, useComponent as pe, useRouteData as fe, Typography as ge, SymbolBadge as ye, itemList as be, ItemList as ve, useContainer as Ce } from "@telia-ace/knowledge-widget-ui";
|
|
43
|
+
import v, { css as N } from "styled-components";
|
|
44
|
+
const I = (t, e, n = !1) => t.getManyAsync("matchingClient", "router").then((o) => {
|
|
45
|
+
const { formData: a } = new x(e.body.form).export(n), { router: c, matchingClient: i } = o, { params: s } = c.getRouteData();
|
|
46
|
+
return i.customRequest(`contactmethods/${e.id}${n ? "/validatedwithpayload" : ""}`, "POST", {
|
|
47
|
+
body: a,
|
|
48
|
+
configuration: {
|
|
49
|
+
guideId: e.body.guideId || s.guideId
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}), H = (t, e, n) => I(t, e).then((o) => n ? n(o) : o).then(({ ConfirmationText: o }) => o), k = (t, e) => I(t, e, !0).then((n) => ({
|
|
53
|
+
valid: n.Validation.IsValid,
|
|
54
|
+
errors: n.Validation.Errors,
|
|
55
|
+
errorTypes: n.Validation.ErrorTypes
|
|
56
|
+
})), q = (t, e) => I(t, e, !0).then((n) => X.fromLegacyForm(e.id, n.ContactMethod.Form).get()), w = (t, e) => t.getAsync("matchingClient").then((n) => {
|
|
57
|
+
n.completeContactMethod(e.id);
|
|
58
|
+
});
|
|
59
|
+
function $e(t) {
|
|
60
|
+
t.getAsync("contactMethods").then((e) => {
|
|
61
|
+
e.create({
|
|
62
|
+
clientName: "email.form",
|
|
63
|
+
render: import("./email-form-component.e13f4117.js"),
|
|
64
|
+
onEvaluate: (n) => q(t, n),
|
|
65
|
+
onValidate: (n) => k(t, n),
|
|
66
|
+
onSubmit: (n) => H(t, n),
|
|
67
|
+
onComplete: (n) => w(t, n)
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const F = (t, e, n) => {
|
|
72
|
+
const { url: o, width: a, height: c } = e, i = n || {}, s = document.createElement("a");
|
|
73
|
+
return s.href = o, s.search.replace("?", "").split("&").forEach((r) => {
|
|
74
|
+
const [l, m] = r.split("=");
|
|
75
|
+
typeof m != "undefined" && (i[l] = m);
|
|
76
|
+
}), s.search = Object.keys(i).map((r) => `${r}=${i[r]}`).join("&"), window.open(s.href, t, `width=${a},height=${c}`), "";
|
|
77
|
+
};
|
|
78
|
+
function ke(t) {
|
|
79
|
+
t.getAsync("contactMethods").then((e) => {
|
|
80
|
+
e.create({
|
|
81
|
+
clientName: "chat.popup",
|
|
82
|
+
render: "email.form",
|
|
83
|
+
handleClick: (n) => {
|
|
84
|
+
const { title: o, body: a } = n, l = a, { form: c, guideId: i, confirmationFallback: s } = l, r = $(l, ["form", "guideId", "confirmationFallback"]);
|
|
85
|
+
return c ? () => {
|
|
86
|
+
} : (m) => {
|
|
87
|
+
m.preventDefault(), F(o, r);
|
|
88
|
+
};
|
|
89
|
+
},
|
|
90
|
+
onValidate: (n) => k(t, n),
|
|
91
|
+
onComplete: (n) => w(t, n),
|
|
92
|
+
onSubmit: (n) => {
|
|
93
|
+
const { title: o, body: a } = n, m = a, { form: c, guideId: i, confirmationFallback: s } = m, r = $(m, ["form", "guideId", "confirmationFallback"]), l = new x(c).export().values;
|
|
94
|
+
return F(o, r, l), s;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function we(t) {
|
|
100
|
+
t.getAsync("contactMethods").then((e) => {
|
|
101
|
+
e.create({
|
|
102
|
+
clientName: "custom.freetext",
|
|
103
|
+
render: import("./free-text-component.bea8185a.js")
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function Pe(t) {
|
|
108
|
+
t.getAsync("contactMethods").then((e) => {
|
|
109
|
+
e.create({
|
|
110
|
+
clientName: "custom.link",
|
|
111
|
+
render: import("./link-component.484bbcf2.js")
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function Ee(t) {
|
|
116
|
+
t.getAsync("contactMethods").then((e) => {
|
|
117
|
+
e.create({
|
|
118
|
+
clientName: "phone.text",
|
|
119
|
+
render: import("./phone-component.0c878514.js")
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const E = (t, e) => b(void 0, null, function* () {
|
|
124
|
+
const n = t.get(e.clientName);
|
|
125
|
+
let { description: o, disabled: a, onClick: c } = e;
|
|
126
|
+
if (n) {
|
|
127
|
+
const { handleClick: i, handleDescription: s, handleDisabled: r } = n;
|
|
128
|
+
typeof i == "function" && (c = yield Promise.resolve(i(e))), typeof s == "function" && (o = yield Promise.resolve(s(e))), typeof r == "function" && (a = yield Promise.resolve(r(e)));
|
|
129
|
+
}
|
|
130
|
+
return Promise.resolve(y(u({}, e), {
|
|
131
|
+
description: o,
|
|
132
|
+
disabled: a,
|
|
133
|
+
onClick: c
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
136
|
+
class S {
|
|
137
|
+
constructor(e, n) {
|
|
138
|
+
if (this.container = e, this.componentPlatform = n, this.adapters = /* @__PURE__ */ new Map(), this.subs = [], n) {
|
|
139
|
+
n.components().ofType("contact-list").select().actions.watch("contact-list.fetched", (i, s) => b(this, null, function* () {
|
|
140
|
+
const { contactMethods: r } = i;
|
|
141
|
+
if (r) {
|
|
142
|
+
const l = Promise.all(r.map((m) => E(this.adapters, m)));
|
|
143
|
+
yield Promise.resolve(l).then((m) => {
|
|
144
|
+
i.contactMethods = m;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return s(i);
|
|
148
|
+
}));
|
|
149
|
+
const a = n.components().ofType("guide").select();
|
|
150
|
+
a.actions.watch("guide.fetched", (i, s) => b(this, null, function* () {
|
|
151
|
+
const { contactMethods: r } = i;
|
|
152
|
+
if (r) {
|
|
153
|
+
const l = Promise.all(r.map((m) => E(this.adapters, m)));
|
|
154
|
+
yield Promise.resolve(l).then((m) => {
|
|
155
|
+
i.contactMethods = m;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return s(i);
|
|
159
|
+
})), a.actions.watch("guide.handover", (i, s) => b(this, null, function* () {
|
|
160
|
+
const { handoverContactMethods: r } = i;
|
|
161
|
+
if (r) {
|
|
162
|
+
const l = Promise.all(r.map((m) => E(this.adapters, m)));
|
|
163
|
+
yield Promise.resolve(l).then((m) => {
|
|
164
|
+
i.handoverContactMethods = m;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return s(i);
|
|
168
|
+
})), n.components().ofType("contact-method").select().actions.watch("contact-method.fetched", (i, s) => b(this, null, function* () {
|
|
169
|
+
const { contactMethod: r } = i;
|
|
170
|
+
return r ? E(this.adapters, r).then((l) => s(y(u({}, i), { contactMethod: l }))) : s(i);
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
static create(e) {
|
|
175
|
+
return L.getInstance(e).then((n) => new S(e, n));
|
|
176
|
+
}
|
|
177
|
+
static getInstance(e, n = "contactMethods") {
|
|
178
|
+
return ee(e)(() => e.getAsync(n).then((o) => {
|
|
179
|
+
let a = o;
|
|
180
|
+
return a || L.getInstance(e).then((c) => (a = new S(e, c), e.registerAsync(n, () => a), a));
|
|
181
|
+
}));
|
|
182
|
+
}
|
|
183
|
+
track(e = {}, n) {
|
|
184
|
+
const { events: o } = this.container.get("$widget");
|
|
185
|
+
o.dispatch("tracking:service-client-response", {
|
|
186
|
+
type: n,
|
|
187
|
+
data: e
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
complete(e) {
|
|
191
|
+
const { id: n, title: o, clientName: a, expanded: c, body: i } = e;
|
|
192
|
+
this.track({ contactMethod: { id: n, title: o, expanded: c, type: a }, hasGuide: !!i.guideId }, "contact-method-complete");
|
|
193
|
+
const s = this.adapters.get(a);
|
|
194
|
+
if (s && s.onComplete)
|
|
195
|
+
return s.onComplete(e);
|
|
196
|
+
}
|
|
197
|
+
evaluate(e) {
|
|
198
|
+
const { clientName: n } = e, o = this.adapters.get(n);
|
|
199
|
+
return o && o.onEvaluate ? Promise.resolve(o.onEvaluate(e)) : Promise.resolve(e.body.form);
|
|
200
|
+
}
|
|
201
|
+
validate(e) {
|
|
202
|
+
const { id: n, title: o, clientName: a } = e, c = this.adapters.get(a);
|
|
203
|
+
return c && c.onValidate ? Promise.resolve(c.onValidate(e)).then((i) => {
|
|
204
|
+
this.track({ contactMethod: { id: n, title: o, type: a }, isValid: i.valid }, "contact-method-validate");
|
|
205
|
+
const { events: s } = this.container.get("$widget");
|
|
206
|
+
return s.dispatch("form:validated", { isValid: i.valid }), i;
|
|
207
|
+
}) : Promise.resolve({ valid: !0 });
|
|
208
|
+
}
|
|
209
|
+
submit(e) {
|
|
210
|
+
const { clientName: n } = e, o = this.adapters.get(n);
|
|
211
|
+
return o && o.onSubmit ? Promise.resolve(o.onSubmit(e)).then((a) => (this.complete(e), a)) : Promise.resolve("");
|
|
212
|
+
}
|
|
213
|
+
create(e) {
|
|
214
|
+
const { clientName: n, render: o } = e;
|
|
215
|
+
return this.adapters.set(n, u({
|
|
216
|
+
onValidate: (a) => k(this.container, a),
|
|
217
|
+
onEvaluate: (a) => q(this.container, a),
|
|
218
|
+
onComplete: (a) => w(this.container, a)
|
|
219
|
+
}, e)), this.container.getAsync("componentResolver").then((a) => {
|
|
220
|
+
typeof o == "string" ? this.subs.push(a.registerAlias(n, o)) : this.subs.push(a.registerComponent(n, ae(() => o)));
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
dispose() {
|
|
224
|
+
this.subs.forEach((e) => e());
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
v(ce)`
|
|
228
|
+
${j("h1", N`
|
|
229
|
+
font-weight: normal;
|
|
230
|
+
font-size: ${(t) => {
|
|
231
|
+
var e;
|
|
232
|
+
return (e = t.theme.fonts) == null ? void 0 : e.medium;
|
|
233
|
+
}};
|
|
234
|
+
`)}
|
|
235
|
+
`;
|
|
236
|
+
const Ne = v(le)`
|
|
237
|
+
${me}
|
|
238
|
+
font-weight: 300;
|
|
239
|
+
line-height: 1.5em;
|
|
240
|
+
button:focus {
|
|
241
|
+
${(t) => {
|
|
242
|
+
var e;
|
|
243
|
+
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && O;
|
|
244
|
+
}};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
a:focus {
|
|
248
|
+
${(t) => {
|
|
249
|
+
var e;
|
|
250
|
+
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && de;
|
|
251
|
+
}};
|
|
252
|
+
}
|
|
253
|
+
`, Se = (t) => {
|
|
254
|
+
const e = pe(t.clientName), {
|
|
255
|
+
params: { contactCategory: n, guideCategory: o, phrase: a }
|
|
256
|
+
} = fe();
|
|
257
|
+
if (typeof e == "undefined")
|
|
258
|
+
return null;
|
|
259
|
+
if (e === null)
|
|
260
|
+
return process.env.NODE_ENV !== "production" ? /* @__PURE__ */ d.createElement(Me, {
|
|
261
|
+
title: `client-name: ${t.clientName}, id: ${t.id}`,
|
|
262
|
+
className: "humany-non-resolved-contact-method"
|
|
263
|
+
}, /* @__PURE__ */ d.createElement(ge, {
|
|
264
|
+
variant: "h5"
|
|
265
|
+
}, "Non resolved Contact Method type")) : null;
|
|
266
|
+
const c = (i = {}) => {
|
|
267
|
+
const s = u(u({}, t), i), {
|
|
268
|
+
id: r,
|
|
269
|
+
title: l,
|
|
270
|
+
clientName: m,
|
|
271
|
+
symbol: h,
|
|
272
|
+
inline: g,
|
|
273
|
+
onClick: C = () => {
|
|
274
|
+
},
|
|
275
|
+
description: f,
|
|
276
|
+
htmlParseInstruction: M,
|
|
277
|
+
className: K,
|
|
278
|
+
disabled: G,
|
|
279
|
+
guideId: U,
|
|
280
|
+
dispatch: T = () => {
|
|
281
|
+
},
|
|
282
|
+
expanded: A
|
|
283
|
+
} = s, W = g ? {
|
|
284
|
+
onKeyDown: (p) => {
|
|
285
|
+
p.key && p.key === "Enter" && (C(p, s), p.defaultPrevented || !A && T("expand", r));
|
|
286
|
+
},
|
|
287
|
+
onClick: (p) => {
|
|
288
|
+
C(p, s), p.defaultPrevented || !A && T("expand", r);
|
|
289
|
+
}
|
|
290
|
+
} : {
|
|
291
|
+
onClick: (p) => C(p, s),
|
|
292
|
+
routeName: "contact-method",
|
|
293
|
+
params: te({
|
|
294
|
+
contactCategory: n,
|
|
295
|
+
guideId: U,
|
|
296
|
+
guideCategory: o,
|
|
297
|
+
phrase: a,
|
|
298
|
+
contactMethod: r,
|
|
299
|
+
uriName: ne(l)
|
|
300
|
+
})
|
|
301
|
+
};
|
|
302
|
+
return /* @__PURE__ */ d.createElement(Ie, u(u({
|
|
303
|
+
title: l,
|
|
304
|
+
"aria-label": l,
|
|
305
|
+
className: K,
|
|
306
|
+
disabled: G,
|
|
307
|
+
description: f,
|
|
308
|
+
"data-client-name": m
|
|
309
|
+
}, i), W), h && /* @__PURE__ */ d.createElement(ye, {
|
|
310
|
+
symbol: h
|
|
311
|
+
}), f ? /* @__PURE__ */ d.createElement("div", {
|
|
312
|
+
className: "humany-contact-link-rich-content"
|
|
313
|
+
}, /* @__PURE__ */ d.createElement(z, null, l), /* @__PURE__ */ d.createElement(Ne, {
|
|
314
|
+
html: f,
|
|
315
|
+
htmlParseInstruction: M
|
|
316
|
+
})) : /* @__PURE__ */ d.createElement(z, null, l));
|
|
317
|
+
};
|
|
318
|
+
return t.expanded ? /* @__PURE__ */ d.createElement(re, {
|
|
319
|
+
fallback: null
|
|
320
|
+
}, /* @__PURE__ */ d.createElement(e, y(u({}, t), {
|
|
321
|
+
renderDefault: c
|
|
322
|
+
}))) : c();
|
|
323
|
+
}, xe = N`
|
|
324
|
+
display: flex;
|
|
325
|
+
padding: ${(t) => {
|
|
326
|
+
var e;
|
|
327
|
+
return (e = t.theme.sizes) == null ? void 0 : e.large;
|
|
328
|
+
}};
|
|
329
|
+
${(t) => t.description ? "" : "align-items: center;"}
|
|
330
|
+
text-decoration: none;
|
|
331
|
+
span {
|
|
332
|
+
display: inline-block;
|
|
333
|
+
color: ${(t) => {
|
|
334
|
+
var e;
|
|
335
|
+
return (e = t.theme.colors) == null ? void 0 : e.text;
|
|
336
|
+
}};
|
|
337
|
+
}
|
|
338
|
+
i {
|
|
339
|
+
font-size: ${(t) => {
|
|
340
|
+
var e;
|
|
341
|
+
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
342
|
+
}};
|
|
343
|
+
margin: 0 ${(t) => {
|
|
344
|
+
var e;
|
|
345
|
+
return (e = t.theme.sizes) == null ? void 0 : e.large;
|
|
346
|
+
}} 0 0;
|
|
347
|
+
min-height: ${(t) => {
|
|
348
|
+
var e;
|
|
349
|
+
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
350
|
+
}};
|
|
351
|
+
min-width: ${(t) => {
|
|
352
|
+
var e;
|
|
353
|
+
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
354
|
+
}};
|
|
355
|
+
line-height: ${(t) => {
|
|
356
|
+
var e;
|
|
357
|
+
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
358
|
+
}};
|
|
359
|
+
display: inline-block;
|
|
360
|
+
vertical-align: bottom;
|
|
361
|
+
color: ${(t) => {
|
|
362
|
+
var e;
|
|
363
|
+
return (e = t.theme.colors) == null ? void 0 : e.text;
|
|
364
|
+
}};
|
|
365
|
+
}
|
|
366
|
+
`, z = v(he)`
|
|
367
|
+
line-height: ${(t) => {
|
|
368
|
+
var e;
|
|
369
|
+
return (e = t.theme.fonts) == null ? void 0 : e.large;
|
|
370
|
+
}};
|
|
371
|
+
`, Ie = v(ue)`
|
|
372
|
+
${xe}
|
|
373
|
+
|
|
374
|
+
&:focus {
|
|
375
|
+
${(t) => {
|
|
376
|
+
var e;
|
|
377
|
+
return ((e = t.theme.accessibility) == null ? void 0 : e.isTabbing) && O;
|
|
378
|
+
}};
|
|
379
|
+
}
|
|
380
|
+
`, Me = v.div`
|
|
381
|
+
text-align: center;
|
|
382
|
+
display: block;
|
|
383
|
+
${(t) => {
|
|
384
|
+
var e, n;
|
|
385
|
+
return typeof ((e = t.theme.colors) == null ? void 0 : e.warning) != "undefined" && `color: ${(n = t.theme.colors) == null ? void 0 : n.warning};`;
|
|
386
|
+
}}
|
|
387
|
+
`, Te = N`
|
|
388
|
+
${be}
|
|
389
|
+
|
|
390
|
+
> div {
|
|
391
|
+
padding: ${(t) => {
|
|
392
|
+
var e;
|
|
393
|
+
return (e = t.theme.sizes) == null ? void 0 : e.large;
|
|
394
|
+
}};
|
|
395
|
+
|
|
396
|
+
${j("h1", N`
|
|
397
|
+
margin: 0;
|
|
398
|
+
`)}
|
|
399
|
+
}
|
|
400
|
+
> ul {
|
|
401
|
+
&:not(:first-child) {
|
|
402
|
+
border-top: ${(t) => t.theme.border};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
> li {
|
|
406
|
+
margin: 0;
|
|
407
|
+
white-space: normal;
|
|
408
|
+
|
|
409
|
+
> a {
|
|
410
|
+
overflow: hidden;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
&:first-child > a {
|
|
414
|
+
border-radius: ${(t) => `${t.theme.borderRadius} ${t.theme.borderRadius} 0 0`};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
&:last-child:not(:first-child) > a {
|
|
418
|
+
border-radius: ${(t) => `0 0 ${t.theme.borderRadius} ${t.theme.borderRadius}`};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
&:not(:last-child) {
|
|
422
|
+
border-bottom: ${(t) => t.theme.border};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
> div {
|
|
426
|
+
padding: ${(t) => {
|
|
427
|
+
var e;
|
|
428
|
+
return (e = t.theme.sizes) == null ? void 0 : e.large;
|
|
429
|
+
}};
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
@media (hover: hover) {
|
|
435
|
+
a:hover {
|
|
436
|
+
background-color: ${(t) => {
|
|
437
|
+
var e;
|
|
438
|
+
return (e = t.theme.colors) == null ? void 0 : e.accent;
|
|
439
|
+
}};
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
`, Ae = v(ve)`
|
|
443
|
+
${Te}
|
|
444
|
+
`, He = ({
|
|
445
|
+
contactMethods: t,
|
|
446
|
+
children: e,
|
|
447
|
+
guideId: n,
|
|
448
|
+
dispatch: o,
|
|
449
|
+
className: a = "",
|
|
450
|
+
itemRenderer: c,
|
|
451
|
+
action: i = () => {
|
|
452
|
+
},
|
|
453
|
+
header: s = ""
|
|
454
|
+
}) => t.length ? /* @__PURE__ */ d.createElement(Ae, {
|
|
455
|
+
header: s,
|
|
456
|
+
className: oe(a, "humany-contact-list"),
|
|
457
|
+
items: t,
|
|
458
|
+
renderItem: c ? (r) => /* @__PURE__ */ d.createElement("li", {
|
|
459
|
+
key: r.id,
|
|
460
|
+
"data-contact-method": r.id
|
|
461
|
+
}, c(r, { action: i, dispatch: o, guideId: n })) : (r) => /* @__PURE__ */ d.createElement("li", {
|
|
462
|
+
key: r.id,
|
|
463
|
+
"data-contact-method": r.id
|
|
464
|
+
}, /* @__PURE__ */ d.createElement(Se, y(u({}, r), {
|
|
465
|
+
action: i,
|
|
466
|
+
dispatch: o,
|
|
467
|
+
guideId: n
|
|
468
|
+
})))
|
|
469
|
+
}, e) : null, B = (t, e) => {
|
|
470
|
+
if (t.actionKey === e)
|
|
471
|
+
return t;
|
|
472
|
+
if (!t.properties)
|
|
473
|
+
return null;
|
|
474
|
+
const n = Object.keys(t.properties);
|
|
475
|
+
let o;
|
|
476
|
+
for (let a = 0; a < n.length; a++)
|
|
477
|
+
if (o = B(t.properties[n[a]], e), o)
|
|
478
|
+
return o;
|
|
479
|
+
return !1;
|
|
480
|
+
}, qe = ({
|
|
481
|
+
className: t,
|
|
482
|
+
body: { form: e },
|
|
483
|
+
id: n,
|
|
484
|
+
action: o,
|
|
485
|
+
dispatch: a,
|
|
486
|
+
disabled: c,
|
|
487
|
+
autoFocus: i
|
|
488
|
+
}) => {
|
|
489
|
+
if (e && !c) {
|
|
490
|
+
const { schema: s, layout: r, data: l, meta: m } = e, h = a || o || (() => {
|
|
491
|
+
});
|
|
492
|
+
return /* @__PURE__ */ d.createElement(Y, {
|
|
493
|
+
className: t,
|
|
494
|
+
schema: s,
|
|
495
|
+
layout: r,
|
|
496
|
+
data: l,
|
|
497
|
+
autoFocus: i,
|
|
498
|
+
onChange: (g, C) => {
|
|
499
|
+
const f = { schema: s, layout: r, data: C, meta: m };
|
|
500
|
+
g.toString() === "submit" ? h("submit", { id: n, form: f }) : B(s, g).evaluate ? h("evaluate", { id: n, form: f }) : h("validate", { id: n, form: f });
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
return null;
|
|
505
|
+
}, Be = (t) => {
|
|
506
|
+
const [e, n] = ie(null), o = Ce();
|
|
507
|
+
return se(() => {
|
|
508
|
+
let a;
|
|
509
|
+
return o.getAsync("componentResolver").then((c) => {
|
|
510
|
+
a = c.registerResolver(t, (i) => n(i));
|
|
511
|
+
}), () => {
|
|
512
|
+
a && a();
|
|
513
|
+
};
|
|
514
|
+
}, [t]), e;
|
|
515
|
+
};
|
|
516
|
+
function Re(t) {
|
|
517
|
+
t.getAsync("contactMethods").then((e) => {
|
|
518
|
+
e.create({
|
|
519
|
+
clientName: "custom.webservice",
|
|
520
|
+
render: "email.form",
|
|
521
|
+
onValidate: (n) => k(t, n),
|
|
522
|
+
onComplete: (n) => w(t, n),
|
|
523
|
+
onSubmit: (n) => H(t, n, (o) => y(u({}, o), {
|
|
524
|
+
ConfirmationText: o.ResponseHtml
|
|
525
|
+
}))
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
const Ke = (t, e, n) => t.getAsync("contactMethods").then((o) => {
|
|
530
|
+
o.create({
|
|
531
|
+
clientName: e,
|
|
532
|
+
render: "email.form",
|
|
533
|
+
handleClick: () => (a, c) => {
|
|
534
|
+
const {
|
|
535
|
+
body: m
|
|
536
|
+
} = c, h = m, { form: i, guideId: s, confirmationFallback: r } = h, l = $(h, ["form", "guideId", "confirmationFallback"]);
|
|
537
|
+
i || (a.preventDefault(), n(l));
|
|
538
|
+
},
|
|
539
|
+
onValidate: (a) => k(t, a),
|
|
540
|
+
onComplete: (a) => w(t, a),
|
|
541
|
+
onSubmit: (a) => {
|
|
542
|
+
const {
|
|
543
|
+
body: m
|
|
544
|
+
} = a, h = m, { form: c, guideId: i, confirmationFallback: s } = h, r = $(h, ["form", "guideId", "confirmationFallback"]), { values: l } = new x(c).export();
|
|
545
|
+
return Promise.resolve(n(r, l)).then((g) => g || s);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
});
|
|
549
|
+
class Ge extends Z {
|
|
550
|
+
constructor(e, n) {
|
|
551
|
+
super(e, n), this.widget.implementation.configure((a) => {
|
|
552
|
+
a.plugin($e).plugin(ke).plugin(we).plugin(Ee).plugin(Re).plugin(Pe);
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
export {
|
|
557
|
+
He as C,
|
|
558
|
+
Ne as D,
|
|
559
|
+
qe as F,
|
|
560
|
+
Te as a,
|
|
561
|
+
xe as b,
|
|
562
|
+
ke as c,
|
|
563
|
+
Se as d,
|
|
564
|
+
S as e,
|
|
565
|
+
w as f,
|
|
566
|
+
q as g,
|
|
567
|
+
$e as h,
|
|
568
|
+
we as i,
|
|
569
|
+
Ke as j,
|
|
570
|
+
Ge as k,
|
|
571
|
+
Pe as l,
|
|
572
|
+
Ee as p,
|
|
573
|
+
H as s,
|
|
574
|
+
Be as u,
|
|
575
|
+
k as v,
|
|
576
|
+
Re as w
|
|
577
|
+
};
|
|
578
|
+
//# sourceMappingURL=index.e9a517ef.js.map
|