@telia-ace/knowledge-widget-adapters 1.0.43 → 1.0.44-experimental.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.
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ContactMethodProps } from '../ui';
2
+ type ContactMethodProps = any;
3
3
  declare const EmailFormComponent: React.FC<ContactMethodProps>;
4
4
  export default EmailFormComponent;
@@ -1,6 +1,6 @@
1
1
  import { SubmissionApiResult } from '@telia-ace/knowledge-serviceclient';
2
2
  import { Container } from '@webprovisions/platform';
3
- import { ContactMethodType } from '../ui';
3
+ type ContactMethodType = any;
4
4
  export declare const submit: (container: Container, contactMethod: ContactMethodType, transform?: ((response: any) => SubmissionApiResult) | undefined) => Promise<string>;
5
5
  export declare const validate: (container: Container, contactMethod: ContactMethodType) => Promise<{
6
6
  valid: boolean;
@@ -14,3 +14,4 @@ export declare const validate: (container: Container, contactMethod: ContactMeth
14
14
  export declare const evaluate: (container: Container, contactMethod: ContactMethodType) => Promise<import("@telia-ace/widget-forms").Form>;
15
15
  export declare const complete: (container: Container, contactMethod: ContactMethodType) => Promise<void>;
16
16
  export default function emailPlugin(container: Container): void;
17
+ export {};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import { ContactMethodProps } from '../ui';
2
+ type ContactMethodProps = any;
3
3
  declare const FreeTextComponent: React.FC<ContactMethodProps>;
4
4
  export default FreeTextComponent;
@@ -5,6 +5,5 @@ export { LinkPlugin } from './link';
5
5
  export { PhonePlugin } from './phone';
6
6
  export { default as ContactMethodPlatform } from './platform';
7
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';
8
+ export { Form as DefaultForm, useContactMethod, } from './ui';
10
9
  export { WebServicePlugin } from './web-service';
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
- import { ContactMethodProps } from '../ui';
2
+ type ContactMethodProps = any;
3
3
  declare const LinkComponent: React.FC<ContactMethodProps>;
4
4
  export default LinkComponent;
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
- import { ContactMethodProps } from '../ui';
2
+ type ContactMethodProps = any;
3
3
  declare const PhoneComponent: React.FC<ContactMethodProps>;
4
4
  export default PhoneComponent;
@@ -2,7 +2,7 @@ import { ComponentPlatform } from '@telia-ace/knowledge-widget-core';
2
2
  import { Form } from '@telia-ace/widget-forms';
3
3
  import { Container } from '@webprovisions/platform';
4
4
  import React from 'react';
5
- import { ContactMethodProps } from './ui';
5
+ type ContactMethodProps = any;
6
6
  export type ReactComponentImport = Promise<{
7
7
  default: React.FunctionComponent<any>;
8
8
  }>;
@@ -1,19 +1,3 @@
1
- import { Theme } from '@emotion/react';
2
- import { DispatchAction } from '@telia-ace/knowledge-widget-ui';
3
- import React, { ReactNode } from 'react';
4
- import { ContactMethodType } from './contact-method';
5
- export declare const contactItemList: (p: {
6
- theme: Theme;
7
- }) => import("@emotion/react").SerializedStyles;
8
- type Props = {
9
- contactMethods: ContactMethodType[];
10
- header?: string;
11
- className?: string;
12
- action?: (action: string, value?: any) => void;
13
- dispatch?: DispatchAction;
14
- children?: ReactNode;
15
- itemRenderer?: (cm: any, props: any) => JSX.Element;
16
- guideId?: string;
17
- };
18
- declare const ContactList: React.FC<Props>;
1
+ import React from 'react';
2
+ declare const ContactList: React.FC<any>;
19
3
  export default ContactList;
@@ -1,41 +1 @@
1
- import { Theme } from '@emotion/react';
2
- import { Symbol } from '@telia-ace/knowledge-widget-core';
3
- import { DispatchAction, HtmlParseInstruction } from '@telia-ace/knowledge-widget-ui';
4
- import React from 'react';
5
- export type ContactMethodType = {
6
- id: string;
7
- title: string;
8
- symbol?: Symbol;
9
- clientName: string;
10
- expanded: boolean;
11
- inline: boolean;
12
- body: {
13
- [key: string]: any;
14
- };
15
- description?: string;
16
- confirmation?: string;
17
- disabled?: boolean;
18
- guideId?: string;
19
- };
20
- export type Props = Merge<ContactMethodType, {
21
- className?: string;
22
- onClick?: (event: React.MouseEvent, properties: Props) => void;
23
- renderDefault?: (extraProps?: Partial<Props>) => any;
24
- htmlParseInstruction?: HtmlParseInstruction;
25
- href?: string;
26
- target?: string;
27
- disabled?: boolean;
28
- action?: (action: string, value: any) => void;
29
- dispatch?: DispatchAction;
30
- symbol?: Symbol;
31
- description?: string;
32
- confirmation?: string;
33
- guideId?: string;
34
- autoFocus?: boolean;
35
- }>;
36
- declare const ContactMethod: React.FC<Props>;
37
- export default ContactMethod;
38
- export declare const contactLink: (p: {
39
- theme: Theme;
40
- description?: string;
41
- }) => import("@emotion/react").SerializedStyles;
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
- declare const _default: import("@emotion/styled").StyledComponent<any, {}, {
3
- ref?: import("react").Ref<any> | undefined;
4
- }>;
2
+ declare const _default: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
5
6
  export default _default;
@@ -1,4 +1,3 @@
1
1
  import React from 'react';
2
- import { ContactMethodProps } from '.';
3
- declare const Form: React.FC<ContactMethodProps>;
2
+ declare const Form: React.FC<any>;
4
3
  export default Form;
@@ -1,7 +1,4 @@
1
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 type { ContactMethodType, Props as ContactMethodProps } from './contact-method';
5
2
  export { default as Description } from './description';
6
3
  export { default as Form } from './form';
7
4
  export { default as useContactMethod } from './use-contact-method';
@@ -0,0 +1,6 @@
1
+ import o from "react";
2
+ const r = (e) => /* @__PURE__ */ o.createElement("div", null, "Todo");
3
+ export {
4
+ r as default
5
+ };
6
+ //# sourceMappingURL=email-form-component.26ca3985.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-form-component.26ca3985.js","sources":["../src/contact-methods/email/email-form-component.tsx"],"sourcesContent":["// import { genericHtml, headingElement, Html } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\n// import { ContactMethodProps } from '../ui';\ntype ContactMethodProps = any;\n\n// const StyledHtml = styled(Html)`\n// ${genericHtml}\n\n// ${(p) =>\n// headingElement(p)(\n// 'h1',\n// css`\n// font-weight: normal;\n// font-size: ${p.theme.fonts?.medium};\n// `\n// )}\n// `;\n\nconst EmailFormComponent: React.FC<ContactMethodProps> = (props) => {\n return <div>Todo</div>;\n};\n// const EmailFormComponent: React.FC<ContactMethodProps> = (props) => {\n// const {\n// className,\n// renderDefault = () => {},\n// body: { form },\n// confirmation,\n// htmlParseInstruction,\n// disabled,\n// } = props;\n\n// if (confirmation) {\n// return (\n// <StyledHtml\n// className={appendClassNames(\n// className,\n// 'humany-contact-method-confirmation',\n// 'humany-contact-method-email'\n// )}\n// html={confirmation}\n// htmlParseInstruction={htmlParseInstruction}\n// />\n// );\n// }\n\n// if (form && !disabled) {\n// return (\n// <Form\n// {...props}\n// className={appendClassNames(className, 'humany-contact-method-email')}\n// />\n// );\n// }\n\n// return renderDefault();\n// };\n\nexport default EmailFormComponent;\n"],"names":["EmailFormComponent","props","React"],"mappings":";AAkBM,MAAAA,IAAmD,CAACC,MAC/C,gBAAAC,EAAA,cAAC,aAAI,MAAI;"}
@@ -0,0 +1,11 @@
1
+ import e from "react";
2
+ const s = ({
3
+ className: t,
4
+ description: o,
5
+ body: { freetext: r },
6
+ htmlParseInstruction: n
7
+ }) => /* @__PURE__ */ e.createElement("div", null, "Todo");
8
+ export {
9
+ s as default
10
+ };
11
+ //# sourceMappingURL=free-text-component.037b4db9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"free-text-component.037b4db9.js","sources":["../src/contact-methods/free-text/free-text-component.tsx"],"sourcesContent":["// import { genericHtml, Html } from '@telia-ace/knowledge-widget-ui';\nimport React from 'react';\n// import { ContactMethodProps } from '../ui';\ntype ContactMethodProps = any;\nconst FreeTextComponent: React.FC<ContactMethodProps> = ({\n className,\n description,\n body: { freetext },\n htmlParseInstruction,\n}) => {\n return <div>Todo</div>;\n // if (!freetext) {\n // return null;\n // }\n // return (\n // <div className={appendClassNames(className, 'humany-contact-method-free-text')}>\n // <StyledHtml html={freetext} htmlParseInstruction={htmlParseInstruction} />\n // {description && (\n // <Description html={description} htmlParseInstruction={htmlParseInstruction} />\n // )}\n // </div>\n // );\n};\n\nexport default FreeTextComponent;\n\n// const StyledHtml = styled(Html)`\n// ${genericHtml};\n// `;\n"],"names":["FreeTextComponent","className","description","freetext","htmlParseInstruction","React"],"mappings":";AAIA,MAAMA,IAAkD,CAAC;AAAA,EACrD,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,MAAM,EAAE,UAAAC,EAAS;AAAA,EACjB,sBAAAC;AACJ,MACW,gBAAAC,EAAA,cAAC,aAAI,MAAI;"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { ChatPopupPlugin, contactItemList, contactLink, ContactList, ContactMethod, ContactMethodPlatform, defaultComplete, defaultEvaluate, DefaultForm, defaultSubmit, defaultValidate, EmailPlugin as EmailFormPlugin, FreeTextPlugin, LinkPlugin, PhonePlugin, useContactMethod, WebServicePlugin, } from './contact-methods';
2
- export type { ContactMethodClick, ContactMethodType, ReactComponentImport, } from './contact-methods';
1
+ export { ChatPopupPlugin, ContactMethodPlatform, defaultComplete, defaultEvaluate, DefaultForm, defaultSubmit, defaultValidate, EmailPlugin as EmailFormPlugin, FreeTextPlugin, LinkPlugin, PhonePlugin, useContactMethod, WebServicePlugin, } from './contact-methods';
2
+ export type { ContactMethodClick, ReactComponentImport, } from './contact-methods';
3
3
  export { createSubmitAdapter } from './create-adapter';
4
4
  export type { Callback } from './create-adapter';
5
5
  export { DefaultContactMethodsPlugin } from './default-contact-methods-plugin';
package/dist/index.js CHANGED
@@ -1,30 +1,353 @@
1
- import { c as m, C as r, d as p, e as c, k as d, F as P, h as f, i as g, l as C, p as h, w as b, a as F, b as L, j as M, f as k, g as v, s as S, v as x, u as D } from "./index.c1d1bd5b.js";
2
- import "@telia-ace/widget-forms";
3
- import "@telia-ace/knowledge-widget-core";
4
- import "@emotion/react";
5
- import "@emotion/styled";
6
- import "@telia-ace/knowledge-widget-ui";
7
- import "@telia-ace/widget-utilities";
8
- import "react";
1
+ var T = Object.defineProperty, D = Object.defineProperties;
2
+ var R = Object.getOwnPropertyDescriptors;
3
+ var v = Object.getOwnPropertySymbols;
4
+ var F = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
+ var A = (n, e, t) => e in n ? T(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t, h = (n, e) => {
6
+ for (var t in e || (e = {}))
7
+ F.call(e, t) && A(n, t, e[t]);
8
+ if (v)
9
+ for (var t of v(e))
10
+ V.call(e, t) && A(n, t, e[t]);
11
+ return n;
12
+ }, C = (n, e) => D(n, R(e));
13
+ var p = (n, e) => {
14
+ var t = {};
15
+ for (var o in n)
16
+ F.call(n, o) && e.indexOf(o) < 0 && (t[o] = n[o]);
17
+ if (n != null && v)
18
+ for (var o of v(n))
19
+ e.indexOf(o) < 0 && V.call(n, o) && (t[o] = n[o]);
20
+ return t;
21
+ };
22
+ var d = (n, e, t) => new Promise((o, s) => {
23
+ var c = (i) => {
24
+ try {
25
+ r(t.next(i));
26
+ } catch (m) {
27
+ s(m);
28
+ }
29
+ }, a = (i) => {
30
+ try {
31
+ r(t.throw(i));
32
+ } catch (m) {
33
+ s(m);
34
+ }
35
+ }, r = (i) => i.done ? o(i.value) : Promise.resolve(i.value).then(c, a);
36
+ r((t = t.apply(n, e)).next());
37
+ });
38
+ import { FormBuilder as L, FormReader as k, FormComponent as j } from "@telia-ace/widget-forms";
39
+ import { ComponentPlatform as N, Plugin as O } from "@telia-ace/knowledge-widget-core";
40
+ import { lock as q } from "@telia-ace/widget-utilities";
41
+ import z, { lazy as B } from "react";
42
+ const M = (n, e, t = !1) => n.getManyAsync("matchingClient", "router").then((o) => {
43
+ const { formData: s } = new k(e.body.form).export(t), { router: c, matchingClient: a } = o, { params: r } = c.getRouteData();
44
+ return a.customRequest(
45
+ `contactmethods/${e.id}${t ? "/validatedwithpayload" : ""}`,
46
+ "POST",
47
+ {
48
+ body: s,
49
+ configuration: {
50
+ guideId: e.body.guideId || r.guideId
51
+ }
52
+ }
53
+ );
54
+ }), I = (n, e, t) => M(n, e).then((o) => t ? t(o) : o).then(({ ConfirmationText: o }) => o), f = (n, e) => M(n, e, !0).then((t) => ({
55
+ valid: t.Validation.IsValid,
56
+ errors: t.Validation.Errors,
57
+ errorTypes: t.Validation.ErrorTypes
58
+ })), S = (n, e) => M(n, e, !0).then(
59
+ (t) => L.fromLegacyForm(e.id, t.ContactMethod.Form).get()
60
+ ), g = (n, e) => n.getAsync("matchingClient").then((t) => {
61
+ t.completeContactMethod(e.id);
62
+ });
63
+ function G(n) {
64
+ n.getAsync("contactMethods").then((e) => {
65
+ e.create({
66
+ clientName: "email.form",
67
+ render: import("./email-form-component.26ca3985.js"),
68
+ onEvaluate: (t) => S(n, t),
69
+ onValidate: (t) => f(n, t),
70
+ onSubmit: (t) => I(n, t),
71
+ onComplete: (t) => g(n, t)
72
+ });
73
+ });
74
+ }
75
+ const E = (n, e, t) => {
76
+ const { url: o, width: s, height: c } = e, a = t || {}, r = document.createElement("a");
77
+ return r.href = o, r.search.replace("?", "").split("&").forEach((i) => {
78
+ const [m, l] = i.split("=");
79
+ typeof l != "undefined" && (a[m] = l);
80
+ }), r.search = Object.keys(a).map((i) => `${i}=${a[i]}`).join("&"), window.open(r.href, n, `width=${s},height=${c}`), "";
81
+ };
82
+ function H(n) {
83
+ n.getAsync("contactMethods").then((e) => {
84
+ e.create({
85
+ clientName: "chat.popup",
86
+ render: "email.form",
87
+ handleClick: (t) => {
88
+ const { title: o, body: s } = t, m = s, { form: c, guideId: a, confirmationFallback: r } = m, i = p(m, ["form", "guideId", "confirmationFallback"]);
89
+ return c ? () => {
90
+ } : (l) => {
91
+ l.preventDefault(), E(o, i);
92
+ };
93
+ },
94
+ onValidate: (t) => f(n, t),
95
+ onComplete: (t) => g(n, t),
96
+ onSubmit: (t) => {
97
+ const { title: o, body: s } = t, l = s, { form: c, guideId: a, confirmationFallback: r } = l, i = p(l, ["form", "guideId", "confirmationFallback"]), m = new k(c).export().values;
98
+ return E(o, i, m), r;
99
+ }
100
+ });
101
+ });
102
+ }
103
+ function K(n) {
104
+ n.getAsync("contactMethods").then((e) => {
105
+ e.create({
106
+ clientName: "custom.freetext",
107
+ render: import("./free-text-component.037b4db9.js")
108
+ });
109
+ });
110
+ }
111
+ function W(n) {
112
+ n.getAsync("contactMethods").then((e) => {
113
+ e.create({
114
+ clientName: "custom.link",
115
+ render: import("./link-component.484bbcf2.js")
116
+ });
117
+ });
118
+ }
119
+ function J(n) {
120
+ n.getAsync("contactMethods").then((e) => {
121
+ e.create({
122
+ clientName: "phone.text",
123
+ render: import("./phone-component.0c878514.js")
124
+ });
125
+ });
126
+ }
127
+ const b = (n, e) => d(void 0, null, function* () {
128
+ const t = n.get(e.clientName);
129
+ let { description: o, disabled: s, onClick: c } = e;
130
+ if (t) {
131
+ const { handleClick: a, handleDescription: r, handleDisabled: i } = t;
132
+ typeof a == "function" && (c = yield Promise.resolve(a(e))), typeof r == "function" && (o = yield Promise.resolve(r(e))), typeof i == "function" && (s = yield Promise.resolve(i(e)));
133
+ }
134
+ return Promise.resolve(C(h({}, e), {
135
+ description: o,
136
+ disabled: s,
137
+ onClick: c
138
+ }));
139
+ });
140
+ class P {
141
+ constructor(e, t) {
142
+ if (this.container = e, this.componentPlatform = t, this.adapters = /* @__PURE__ */ new Map(), this.subs = [], t) {
143
+ t.components().ofType("contact-list").select().actions.watch("contact-list.fetched", (a, r) => d(this, null, function* () {
144
+ const { contactMethods: i } = a;
145
+ if (i) {
146
+ const m = Promise.all(
147
+ i.map(
148
+ (l) => b(this.adapters, l)
149
+ )
150
+ );
151
+ yield Promise.resolve(m).then((l) => {
152
+ a.contactMethods = l;
153
+ });
154
+ }
155
+ return r(a);
156
+ }));
157
+ const s = t.components().ofType("guide").select();
158
+ s.actions.watch("guide.fetched", (a, r) => d(this, null, function* () {
159
+ const { contactMethods: i } = a;
160
+ if (i) {
161
+ const m = Promise.all(
162
+ i.map(
163
+ (l) => b(this.adapters, l)
164
+ )
165
+ );
166
+ yield Promise.resolve(m).then((l) => {
167
+ a.contactMethods = l;
168
+ });
169
+ }
170
+ return r(a);
171
+ })), s.actions.watch("guide.handover", (a, r) => d(this, null, function* () {
172
+ const { handoverContactMethods: i } = a;
173
+ if (i) {
174
+ const m = Promise.all(
175
+ i.map(
176
+ (l) => b(this.adapters, l)
177
+ )
178
+ );
179
+ yield Promise.resolve(m).then((l) => {
180
+ a.handoverContactMethods = l;
181
+ });
182
+ }
183
+ return r(a);
184
+ })), t.components().ofType("contact-method").select().actions.watch("contact-method.fetched", (a, r) => d(this, null, function* () {
185
+ const { contactMethod: i } = a;
186
+ return i ? b(this.adapters, i).then(
187
+ (m) => r(C(h({}, a), { contactMethod: m }))
188
+ ) : r(a);
189
+ }));
190
+ }
191
+ }
192
+ static create(e) {
193
+ return N.getInstance(e).then((t) => new P(e, t));
194
+ }
195
+ static getInstance(e, t = "contactMethods") {
196
+ return q(e)(() => e.getAsync(t).then((o) => {
197
+ let s = o;
198
+ return s || N.getInstance(e).then((c) => (s = new P(e, c), e.registerAsync(t, () => s), s));
199
+ }));
200
+ }
201
+ track(e = {}, t) {
202
+ const { events: o } = this.container.get("$widget");
203
+ o.dispatch("tracking:service-client-response", {
204
+ type: t,
205
+ data: e
206
+ });
207
+ }
208
+ complete(e) {
209
+ const { id: t, title: o, clientName: s, expanded: c, body: a } = e;
210
+ this.track(
211
+ { contactMethod: { id: t, title: o, expanded: c, type: s }, hasGuide: !!a.guideId },
212
+ "contact-method-complete"
213
+ );
214
+ const r = this.adapters.get(s);
215
+ if (r && r.onComplete)
216
+ return r.onComplete(e);
217
+ }
218
+ evaluate(e) {
219
+ const { clientName: t } = e, o = this.adapters.get(t);
220
+ return o && o.onEvaluate ? Promise.resolve(o.onEvaluate(e)) : Promise.resolve(e.body.form);
221
+ }
222
+ validate(e) {
223
+ const { id: t, title: o, clientName: s } = e, c = this.adapters.get(s);
224
+ return c && c.onValidate ? Promise.resolve(c.onValidate(e)).then((a) => {
225
+ this.track(
226
+ { contactMethod: { id: t, title: o, type: s }, isValid: a.valid },
227
+ "contact-method-validate"
228
+ );
229
+ const { events: r } = this.container.get("$widget");
230
+ return r.dispatch("form:validated", { isValid: a.valid }), a;
231
+ }) : Promise.resolve({ valid: !0 });
232
+ }
233
+ submit(e) {
234
+ const { clientName: t } = e, o = this.adapters.get(t);
235
+ return o && o.onSubmit ? Promise.resolve(o.onSubmit(e)).then((s) => (this.complete(e), s)) : Promise.resolve("");
236
+ }
237
+ create(e) {
238
+ const { clientName: t, render: o } = e;
239
+ return this.adapters.set(t, h({
240
+ onValidate: (s) => f(this.container, s),
241
+ onEvaluate: (s) => S(this.container, s),
242
+ onComplete: (s) => g(this.container, s)
243
+ }, e)), this.container.getAsync("componentResolver").then((s) => {
244
+ typeof o == "string" ? this.subs.push(s.registerAlias(t, o)) : this.subs.push(
245
+ s.registerComponent(
246
+ t,
247
+ B(() => o)
248
+ )
249
+ );
250
+ });
251
+ }
252
+ dispose() {
253
+ this.subs.forEach((e) => e());
254
+ }
255
+ }
256
+ const ot = P, $ = (n, e) => {
257
+ if (n.actionKey === e)
258
+ return n;
259
+ if (!n.properties)
260
+ return null;
261
+ const t = Object.keys(n.properties);
262
+ let o;
263
+ for (let s = 0; s < t.length; s++)
264
+ if (o = $(n.properties[t[s]], e), o)
265
+ return o;
266
+ return !1;
267
+ }, Q = ({
268
+ className: n,
269
+ body: { form: e },
270
+ id: t,
271
+ action: o,
272
+ dispatch: s,
273
+ disabled: c,
274
+ autoFocus: a
275
+ }) => {
276
+ if (e && !c) {
277
+ const { schema: r, layout: i, data: m, meta: l } = e, u = s || o || (() => {
278
+ });
279
+ return /* @__PURE__ */ z.createElement(
280
+ j,
281
+ {
282
+ className: n,
283
+ schema: r,
284
+ layout: i,
285
+ data: m,
286
+ autoFocus: a,
287
+ onChange: (y, x) => {
288
+ const w = { schema: r, layout: i, data: x, meta: l };
289
+ y.toString() === "submit" ? u("submit", { id: t, form: w }) : $(r, y).evaluate ? u("evaluate", { id: t, form: w }) : u("validate", { id: t, form: w });
290
+ }
291
+ }
292
+ );
293
+ }
294
+ return null;
295
+ }, st = Q, U = (n) => null, at = U;
296
+ function X(n) {
297
+ n.getAsync("contactMethods").then((e) => {
298
+ e.create({
299
+ clientName: "custom.webservice",
300
+ render: "email.form",
301
+ onValidate: (t) => f(n, t),
302
+ onComplete: (t) => g(n, t),
303
+ onSubmit: (t) => I(n, t, (o) => C(h({}, o), {
304
+ ConfirmationText: o.ResponseHtml
305
+ }))
306
+ });
307
+ });
308
+ }
309
+ const rt = (n, e, t) => n.getAsync("contactMethods").then((o) => {
310
+ o.create({
311
+ clientName: e,
312
+ render: "email.form",
313
+ handleClick: () => (s, c) => {
314
+ const {
315
+ body: l
316
+ } = c, u = l, { form: a, guideId: r, confirmationFallback: i } = u, m = p(u, ["form", "guideId", "confirmationFallback"]);
317
+ a || (s.preventDefault(), t(m));
318
+ },
319
+ onValidate: (s) => f(n, s),
320
+ onComplete: (s) => g(n, s),
321
+ onSubmit: (s) => {
322
+ const {
323
+ body: l
324
+ } = s, u = l, { form: c, guideId: a, confirmationFallback: r } = u, i = p(u, ["form", "guideId", "confirmationFallback"]), { values: m } = new k(c).export();
325
+ return Promise.resolve(t(i, m)).then((y) => y || r);
326
+ }
327
+ });
328
+ });
329
+ class it extends O {
330
+ constructor(e, t) {
331
+ super(e, t), this.widget.implementation.configure((s) => {
332
+ s.plugin(G).plugin(H).plugin(K).plugin(J).plugin(X).plugin(W);
333
+ });
334
+ }
335
+ }
9
336
  export {
10
- m as ChatPopupPlugin,
11
- r as ContactList,
12
- p as ContactMethod,
13
- c as ContactMethodPlatform,
14
- d as DefaultContactMethodsPlugin,
15
- P as DefaultForm,
16
- f as EmailFormPlugin,
17
- g as FreeTextPlugin,
18
- C as LinkPlugin,
19
- h as PhonePlugin,
20
- b as WebServicePlugin,
21
- F as contactItemList,
22
- L as contactLink,
23
- M as createSubmitAdapter,
24
- k as defaultComplete,
25
- v as defaultEvaluate,
26
- S as defaultSubmit,
27
- x as defaultValidate,
28
- D as useContactMethod
337
+ H as ChatPopupPlugin,
338
+ ot as ContactMethodPlatform,
339
+ it as DefaultContactMethodsPlugin,
340
+ st as DefaultForm,
341
+ G as EmailFormPlugin,
342
+ K as FreeTextPlugin,
343
+ W as LinkPlugin,
344
+ J as PhonePlugin,
345
+ X as WebServicePlugin,
346
+ rt as createSubmitAdapter,
347
+ g as defaultComplete,
348
+ S as defaultEvaluate,
349
+ I as defaultSubmit,
350
+ f as defaultValidate,
351
+ at as useContactMethod
29
352
  };
30
353
  //# sourceMappingURL=index.js.map