@telia-ace/knowledge-widget-adapters 1.1.1-rc.2 → 1.1.1-rc.3

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