@wix/form-app-builder 1.329.0 → 1.331.0
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/component/form.js +103 -82
- package/package.json +3 -3
package/dist/component/form.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as m, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { initI18n as
|
|
4
|
-
import
|
|
5
|
-
import { convertA11yKeysToHtmlFormat as
|
|
1
|
+
import { jsx as m, jsxs as H, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as V, useEffect as F, forwardRef as O, useMemo as C, Suspense as q } from "react";
|
|
3
|
+
import { initI18n as G, createAsyncMessagesLoader as B, useTranslation as $, I18nextProvider as z } from "@wix/fed-cli-i18next";
|
|
4
|
+
import J from "@wix/form-elements/Form";
|
|
5
|
+
import { convertA11yKeysToHtmlFormat as X } from "@wix/react-component-utils";
|
|
6
6
|
import { use as Q } from "@wix/react-use-promise-polyfill";
|
|
7
|
-
import
|
|
8
|
-
import { i18n as
|
|
9
|
-
import { forms as
|
|
10
|
-
import { renameKeysFromSDKRequestToRESTRequest as
|
|
11
|
-
const
|
|
7
|
+
import Y from "classnames";
|
|
8
|
+
import { i18n as Z } from "@wix/essentials";
|
|
9
|
+
import { forms as P } from "@wix/forms";
|
|
10
|
+
import { renameKeysFromSDKRequestToRESTRequest as ss } from "@wix/sdk-runtime/rename-all-nested-keys";
|
|
11
|
+
const D = (s, e, t) => {
|
|
12
12
|
const o = s[e];
|
|
13
13
|
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((n, a) => {
|
|
14
14
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
@@ -20,47 +20,47 @@ const x = (s, e, t) => {
|
|
|
20
20
|
)
|
|
21
21
|
);
|
|
22
22
|
});
|
|
23
|
-
},
|
|
23
|
+
}, N = "en", es = () => {
|
|
24
24
|
try {
|
|
25
|
-
return
|
|
25
|
+
return Z.getLanguage() || N;
|
|
26
26
|
} catch {
|
|
27
|
-
return
|
|
27
|
+
return N;
|
|
28
28
|
}
|
|
29
|
-
},
|
|
30
|
-
const [e] =
|
|
31
|
-
() =>
|
|
32
|
-
locale:
|
|
29
|
+
}, ts = ({ useSuspense: s = !1 } = {}) => {
|
|
30
|
+
const [e] = _(
|
|
31
|
+
() => G({
|
|
32
|
+
locale: es(),
|
|
33
33
|
useSuspense: s,
|
|
34
|
-
asyncMessagesLoader:
|
|
34
|
+
asyncMessagesLoader: B({
|
|
35
35
|
isDev: !1,
|
|
36
|
-
loadMessages: (t) =>
|
|
37
|
-
loadDevMessages: (t) =>
|
|
36
|
+
loadMessages: (t) => D(/* @__PURE__ */ Object.assign({ "../assets/locale/messages_ar.json": () => import("./messages_ar-DGqnlItp.js"), "../assets/locale/messages_bg.json": () => import("./messages_bg-7j2dzD3-.js"), "../assets/locale/messages_ca.json": () => import("./messages_ca-CcO7DMHa.js"), "../assets/locale/messages_cs.json": () => import("./messages_cs-CTVq3E2g.js"), "../assets/locale/messages_da.json": () => import("./messages_da-Aczb870I.js"), "../assets/locale/messages_de.json": () => import("./messages_de-DjOB-J1X.js"), "../assets/locale/messages_el.json": () => import("./messages_el-BpyRDrDi.js"), "../assets/locale/messages_en.json": () => import("./messages_en-LAoCjATQ.js"), "../assets/locale/messages_es.json": () => import("./messages_es-CzzSofdY.js"), "../assets/locale/messages_fi.json": () => import("./messages_fi-CZWvyyeb.js"), "../assets/locale/messages_fr.json": () => import("./messages_fr-Lbq78jBY.js"), "../assets/locale/messages_he.json": () => import("./messages_he-BrE8aCeb.js"), "../assets/locale/messages_hi.json": () => import("./messages_hi-Bzpy21yr.js"), "../assets/locale/messages_hr.json": () => import("./messages_hr-_zq2pEDq.js"), "../assets/locale/messages_hu.json": () => import("./messages_hu-DjiQZ0Iy.js"), "../assets/locale/messages_id.json": () => import("./messages_id-CMa5LD7F.js"), "../assets/locale/messages_it.json": () => import("./messages_it-DINjUlrP.js"), "../assets/locale/messages_ja.json": () => import("./messages_ja-BJadoOMy.js"), "../assets/locale/messages_ko.json": () => import("./messages_ko-C1cqfk2u.js"), "../assets/locale/messages_lt.json": () => import("./messages_lt-ja0KcCq4.js"), "../assets/locale/messages_lv.json": () => import("./messages_lv-N3hgWEFl.js"), "../assets/locale/messages_ms.json": () => import("./messages_ms-DUh0bUzJ.js"), "../assets/locale/messages_nl.json": () => import("./messages_nl-BrYvezRR.js"), "../assets/locale/messages_no.json": () => import("./messages_no-Cfp-Ev4Z.js"), "../assets/locale/messages_pl.json": () => import("./messages_pl-CSHaunjT.js"), "../assets/locale/messages_pt.json": () => import("./messages_pt-CkFjw0sb.js"), "../assets/locale/messages_ro.json": () => import("./messages_ro-C9YzJqCP.js"), "../assets/locale/messages_ru.json": () => import("./messages_ru-4uGVRg29.js"), "../assets/locale/messages_sk.json": () => import("./messages_sk-BhT2Qz0Z.js"), "../assets/locale/messages_sl.json": () => import("./messages_sl-CWn3AJHu.js"), "../assets/locale/messages_sv.json": () => import("./messages_sv-DB2VplkH.js"), "../assets/locale/messages_th.json": () => import("./messages_th-CATSt9Iu.js"), "../assets/locale/messages_tl.json": () => import("./messages_tl-D3-8huQl.js"), "../assets/locale/messages_tr.json": () => import("./messages_tr-CfQPwO3A.js"), "../assets/locale/messages_uk.json": () => import("./messages_uk-BgMP3k3g.js"), "../assets/locale/messages_vi.json": () => import("./messages_vi-CRCNIcd1.js"), "../assets/locale/messages_zh.json": () => import("./messages_zh-7UFJmLYG.js") }), `../assets/locale/messages_${t}.json`, 4),
|
|
37
|
+
loadDevMessages: (t) => D(/* @__PURE__ */ Object.assign({}), `../assets/locale/messages_${t}.dev.json`, 4)
|
|
38
38
|
})
|
|
39
39
|
})
|
|
40
40
|
);
|
|
41
41
|
return e;
|
|
42
|
-
}, os = (s) => ({ name: s }),
|
|
42
|
+
}, os = (s) => ({ name: s }), as = (s) => `${s.name}:change`, W = (s, e) => {
|
|
43
43
|
window.dispatchEvent(
|
|
44
|
-
new CustomEvent(
|
|
44
|
+
new CustomEvent(as(s), { detail: e })
|
|
45
45
|
);
|
|
46
|
-
},
|
|
46
|
+
}, ns = (s, e, t) => {
|
|
47
47
|
const o = t;
|
|
48
48
|
return (o == null ? void 0 : o.channel) === s.name && o.compId === e && typeof o.patch == "object" && o.patch !== null ? o.patch : void 0;
|
|
49
|
-
},
|
|
49
|
+
}, rs = ({
|
|
50
50
|
channel: s,
|
|
51
51
|
compId: e,
|
|
52
52
|
data: t,
|
|
53
53
|
onChange: o
|
|
54
54
|
}) => {
|
|
55
|
-
const n = JSON.stringify(t), a =
|
|
56
|
-
return
|
|
55
|
+
const n = JSON.stringify(t), a = V(o);
|
|
56
|
+
return F(() => {
|
|
57
57
|
a.current = o;
|
|
58
|
-
}),
|
|
58
|
+
}), F(() => (W(s, e), () => W(s, e)), [s, e, n]), F(() => {
|
|
59
59
|
const r = (p) => {
|
|
60
60
|
if (p.origin !== window.origin)
|
|
61
61
|
return;
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const l = ns(s, e, p.data);
|
|
63
|
+
l && a.current(l);
|
|
64
64
|
};
|
|
65
65
|
return window.addEventListener("message", r), () => window.removeEventListener("message", r);
|
|
66
66
|
}, [s, e]), /* @__PURE__ */ m(
|
|
@@ -71,12 +71,33 @@ const x = (s, e, t) => {
|
|
|
71
71
|
"data-widget-data": n
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
|
-
},
|
|
74
|
+
}, is = os(
|
|
75
75
|
"@wix/form-app-builder:form"
|
|
76
|
-
),
|
|
76
|
+
), T = (s, e) => s.some((t) => t.id === e), ms = (s) => (s.steps ?? []).reduce((e, { id: t, name: o }) => (t && e.push({ id: t, name: o ?? void 0 }), e), []), cs = "forms-platform-form", ls = "_siteWidget_ww0lh_1", gs = "_fallbackDirection_ww0lh_17", k = {
|
|
77
77
|
siteWidget: ls,
|
|
78
|
-
fallbackDirection:
|
|
79
|
-
},
|
|
78
|
+
fallbackDirection: gs
|
|
79
|
+
}, ps = "wix:image://", fs = (s) => {
|
|
80
|
+
const { pathname: e, hash: t } = new URL(s), o = new URLSearchParams(t.replace("#", "")), [n, a] = e.replace("image://v1/", "").split("/");
|
|
81
|
+
return {
|
|
82
|
+
id: n,
|
|
83
|
+
width: Number(o.get("originWidth")),
|
|
84
|
+
height: Number(o.get("originHeight")),
|
|
85
|
+
...a && { altText: decodeURIComponent(a) }
|
|
86
|
+
};
|
|
87
|
+
}, E = (s) => Array.isArray(s) ? s.map(E) : s && typeof s == "object" && !(s instanceof Date) ? Object.fromEntries(
|
|
88
|
+
Object.entries(s).map(([e, t]) => [
|
|
89
|
+
e,
|
|
90
|
+
e === "image" && typeof t == "string" && t.startsWith(ps) ? fs(t) : E(t)
|
|
91
|
+
])
|
|
92
|
+
) : s, ds = (s) => P.getForm(s).then(
|
|
93
|
+
(e) => (
|
|
94
|
+
// The SDK answers with `_id`/`_createdDate` and `wix:image://` strings;
|
|
95
|
+
// the element expects the un-prefixed keys and image objects.
|
|
96
|
+
E(
|
|
97
|
+
ss(e)
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
), M = O(
|
|
80
101
|
({
|
|
81
102
|
form: s,
|
|
82
103
|
compId: e,
|
|
@@ -86,65 +107,65 @@ const x = (s, e, t) => {
|
|
|
86
107
|
closedFormNotice: a,
|
|
87
108
|
closedMessagePlaceholder: r,
|
|
88
109
|
onRevisionChange: p
|
|
89
|
-
},
|
|
90
|
-
var
|
|
91
|
-
const { t: j } = $(), i = Q(s),
|
|
110
|
+
}, l) => {
|
|
111
|
+
var x, I, A;
|
|
112
|
+
const { t: j } = $(), i = Q(s), f = !!(a && ((x = i.properties) != null && x.disabled)), R = f && !n, h = !!(r && n === "closed" && !((A = (I = i.disabledFormMessage) == null ? void 0 : I.nodes) != null && A.length)), S = C(
|
|
92
113
|
() => ({
|
|
93
114
|
...i,
|
|
94
|
-
...
|
|
115
|
+
...f && {
|
|
95
116
|
properties: { ...i.properties, disabled: !1 }
|
|
96
117
|
},
|
|
97
|
-
...
|
|
118
|
+
...h && {
|
|
98
119
|
disabledFormMessage: r == null ? void 0 : r(j)
|
|
99
120
|
}
|
|
100
121
|
}),
|
|
101
122
|
[
|
|
102
123
|
i,
|
|
103
|
-
|
|
104
|
-
|
|
124
|
+
f,
|
|
125
|
+
h,
|
|
105
126
|
r,
|
|
106
127
|
j
|
|
107
128
|
]
|
|
108
|
-
), g =
|
|
109
|
-
return
|
|
110
|
-
var
|
|
111
|
-
|
|
112
|
-
}, [g,
|
|
129
|
+
), g = C(() => ms(i), [i]), d = i.revision ?? void 0, [w, v] = _({}), [b, y] = _([]), [u, L] = _();
|
|
130
|
+
return F(() => {
|
|
131
|
+
var c;
|
|
132
|
+
u && !T(g, u) && L((c = g[0]) == null ? void 0 : c.id);
|
|
133
|
+
}, [g, u]), /* @__PURE__ */ H(K, { children: [
|
|
113
134
|
/* @__PURE__ */ m(
|
|
114
|
-
|
|
135
|
+
rs,
|
|
115
136
|
{
|
|
116
|
-
channel:
|
|
137
|
+
channel: is,
|
|
117
138
|
compId: e,
|
|
118
|
-
data: { steps: g, stepId:
|
|
119
|
-
onChange: (
|
|
120
|
-
|
|
139
|
+
data: { steps: g, stepId: u, revision: d },
|
|
140
|
+
onChange: (c) => {
|
|
141
|
+
T(g, c.stepId) && L(c.stepId), c.revision && c.revision !== d && p(c.revision);
|
|
121
142
|
}
|
|
122
143
|
}
|
|
123
144
|
),
|
|
124
|
-
|
|
145
|
+
R && a,
|
|
125
146
|
/* @__PURE__ */ m(
|
|
126
|
-
|
|
147
|
+
J,
|
|
127
148
|
{
|
|
128
|
-
ref:
|
|
129
|
-
className:
|
|
149
|
+
ref: l,
|
|
150
|
+
className: cs,
|
|
130
151
|
compId: e,
|
|
131
|
-
form:
|
|
152
|
+
form: S,
|
|
132
153
|
wix: t,
|
|
133
154
|
elementProps: o,
|
|
134
155
|
state: n,
|
|
135
156
|
values: w,
|
|
136
|
-
onChange:
|
|
137
|
-
errors:
|
|
138
|
-
onValidate:
|
|
139
|
-
stepId:
|
|
140
|
-
onStepIdChange:
|
|
157
|
+
onChange: v,
|
|
158
|
+
errors: b,
|
|
159
|
+
onValidate: y,
|
|
160
|
+
stepId: u,
|
|
161
|
+
onStepIdChange: L
|
|
141
162
|
}
|
|
142
163
|
)
|
|
143
164
|
] });
|
|
144
165
|
}
|
|
145
166
|
);
|
|
146
|
-
|
|
147
|
-
const
|
|
167
|
+
M.displayName = "FormViewerHost";
|
|
168
|
+
const U = O(
|
|
148
169
|
({
|
|
149
170
|
id: s,
|
|
150
171
|
className: e,
|
|
@@ -154,21 +175,21 @@ const W = L(
|
|
|
154
175
|
elementProps: a,
|
|
155
176
|
fallback: r = null,
|
|
156
177
|
emptyState: p = null,
|
|
157
|
-
pendingForm:
|
|
178
|
+
pendingForm: l,
|
|
158
179
|
closedFormNotice: j,
|
|
159
180
|
closedMessagePlaceholder: i,
|
|
160
|
-
errorBoundary:
|
|
161
|
-
},
|
|
162
|
-
var
|
|
163
|
-
const
|
|
164
|
-
|
|
181
|
+
errorBoundary: f
|
|
182
|
+
}, R) => {
|
|
183
|
+
var v, b, y;
|
|
184
|
+
const h = ts({ useSuspense: !0 }), [S, g] = _(), d = C(() => t ? ds(t) : l, [t, S, l]), w = /* @__PURE__ */ m(q, { fallback: r, children: s && d ? /* @__PURE__ */ m(
|
|
185
|
+
M,
|
|
165
186
|
{
|
|
166
|
-
ref:
|
|
187
|
+
ref: R,
|
|
167
188
|
form: d,
|
|
168
189
|
compId: s,
|
|
169
|
-
wix: (
|
|
170
|
-
elementProps: (
|
|
171
|
-
state: (
|
|
190
|
+
wix: (v = a == null ? void 0 : a.form) == null ? void 0 : v.wix,
|
|
191
|
+
elementProps: (b = a == null ? void 0 : a.form) == null ? void 0 : b.elementProps,
|
|
192
|
+
state: (y = a == null ? void 0 : a.form) == null ? void 0 : y.state,
|
|
172
193
|
closedFormNotice: j,
|
|
173
194
|
closedMessagePlaceholder: i,
|
|
174
195
|
onRevisionChange: g
|
|
@@ -179,22 +200,22 @@ const W = L(
|
|
|
179
200
|
{
|
|
180
201
|
id: s,
|
|
181
202
|
dir: o,
|
|
182
|
-
className:
|
|
203
|
+
className: Y(
|
|
183
204
|
"form",
|
|
184
|
-
|
|
185
|
-
|
|
205
|
+
k.siteWidget,
|
|
206
|
+
k.fallbackDirection,
|
|
186
207
|
e
|
|
187
208
|
),
|
|
188
|
-
...n &&
|
|
189
|
-
children: /* @__PURE__ */ m(
|
|
209
|
+
...n && X(n),
|
|
210
|
+
children: /* @__PURE__ */ m(z, { i18n: h, children: f ? /* @__PURE__ */ m(f, { resetKey: d, children: w }) : w })
|
|
190
211
|
}
|
|
191
212
|
);
|
|
192
213
|
}
|
|
193
214
|
);
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
215
|
+
U.displayName = "FormRoot";
|
|
216
|
+
const Ls = {}, us = O((s, e) => /* @__PURE__ */ m(U, { ...s, ref: e }));
|
|
217
|
+
us.displayName = "Form";
|
|
197
218
|
export {
|
|
198
|
-
|
|
199
|
-
|
|
219
|
+
us as default,
|
|
220
|
+
Ls as defaultProps
|
|
200
221
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/form-app-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.331.0",
|
|
4
4
|
"description": "The Wix Forms Form for Builder apps: loads a form by id and renders it with @wix/form-elements/Form",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@wix/essentials": "^1.0.15",
|
|
48
48
|
"@wix/fed-cli-i18next": "^1.7.4",
|
|
49
|
-
"@wix/form-elements": "1.
|
|
49
|
+
"@wix/form-elements": "1.144.0",
|
|
50
50
|
"@wix/forms": "^1.0.537",
|
|
51
51
|
"@wix/react-component-utils": "^1.15.0",
|
|
52
52
|
"@wix/react-use-promise-polyfill": "^1.2.0",
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
]
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
"falconPackageHash": "
|
|
137
|
+
"falconPackageHash": "d1574e6f651fff7ca5d08229ed17a6479f8d27c6f830ecee6c7492de"
|
|
138
138
|
}
|