@wix/form-app-builder 1.337.0 → 1.338.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 +80 -87
- package/package.json +4 -4
package/dist/component/form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as m, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { initI18n as
|
|
1
|
+
import { jsx as m, jsxs as V, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d, useRef as G, useEffect as F, forwardRef as D, useMemo as O, Suspense as H } from "react";
|
|
3
|
+
import { initI18n as B, createAsyncMessagesLoader as $, useTranslation as U, I18nextProvider as z } from "@wix/fed-cli-i18next";
|
|
4
4
|
import J from "@wix/form-elements/Form";
|
|
5
5
|
import { convertA11yKeysToHtmlFormat as X } from "@wix/react-component-utils";
|
|
6
6
|
import { use as Q } from "@wix/react-use-promise-polyfill";
|
|
@@ -8,58 +8,59 @@ import Y from "classnames";
|
|
|
8
8
|
import { i18n as Z } from "@wix/essentials";
|
|
9
9
|
import { forms as P } from "@wix/forms";
|
|
10
10
|
import { renameKeysFromSDKRequestToRESTRequest as ss } from "@wix/sdk-runtime/rename-all-nested-keys";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import { transformSDKImageToRESTImage as es } from "@wix/sdk-runtime/transformations/image";
|
|
12
|
+
const T = (s, e, o) => {
|
|
13
|
+
const t = s[e];
|
|
14
|
+
return t ? typeof t == "function" ? t() : Promise.resolve(t) : new Promise((n, a) => {
|
|
14
15
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
15
16
|
a.bind(
|
|
16
17
|
null,
|
|
17
18
|
new Error(
|
|
18
|
-
"Unknown variable dynamic import: " + e + (e.split("/").length !==
|
|
19
|
+
"Unknown variable dynamic import: " + e + (e.split("/").length !== o ? ". Note that variables only represent file names one level deep." : "")
|
|
19
20
|
)
|
|
20
21
|
)
|
|
21
22
|
);
|
|
22
23
|
});
|
|
23
|
-
},
|
|
24
|
+
}, k = "en", os = () => {
|
|
24
25
|
try {
|
|
25
|
-
return Z.getLanguage() ||
|
|
26
|
+
return Z.getLanguage() || k;
|
|
26
27
|
} catch {
|
|
27
|
-
return
|
|
28
|
+
return k;
|
|
28
29
|
}
|
|
29
30
|
}, ts = ({ useSuspense: s = !1 } = {}) => {
|
|
30
|
-
const [e] =
|
|
31
|
-
() =>
|
|
32
|
-
locale:
|
|
31
|
+
const [e] = d(
|
|
32
|
+
() => B({
|
|
33
|
+
locale: os(),
|
|
33
34
|
useSuspense: s,
|
|
34
|
-
asyncMessagesLoader:
|
|
35
|
+
asyncMessagesLoader: $({
|
|
35
36
|
isDev: !1,
|
|
36
|
-
loadMessages: (
|
|
37
|
-
loadDevMessages: (
|
|
37
|
+
loadMessages: (o) => T(/* @__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_${o}.json`, 4),
|
|
38
|
+
loadDevMessages: (o) => T(/* @__PURE__ */ Object.assign({}), `../assets/locale/messages_${o}.dev.json`, 4)
|
|
38
39
|
})
|
|
39
40
|
})
|
|
40
41
|
);
|
|
41
42
|
return e;
|
|
42
|
-
},
|
|
43
|
+
}, as = (s) => ({ name: s }), ns = (s) => `${s.name}:change`, x = (s, e) => {
|
|
43
44
|
window.dispatchEvent(
|
|
44
|
-
new CustomEvent(
|
|
45
|
+
new CustomEvent(ns(s), { detail: e })
|
|
45
46
|
);
|
|
46
|
-
},
|
|
47
|
-
const
|
|
48
|
-
return (
|
|
49
|
-
},
|
|
47
|
+
}, rs = (s, e, o) => {
|
|
48
|
+
const t = o;
|
|
49
|
+
return (t == null ? void 0 : t.channel) === s.name && t.compId === e && typeof t.patch == "object" && t.patch !== null ? t.patch : void 0;
|
|
50
|
+
}, is = ({
|
|
50
51
|
channel: s,
|
|
51
52
|
compId: e,
|
|
52
|
-
data:
|
|
53
|
-
onChange:
|
|
53
|
+
data: o,
|
|
54
|
+
onChange: t
|
|
54
55
|
}) => {
|
|
55
|
-
const n = JSON.stringify(
|
|
56
|
+
const n = JSON.stringify(o), a = G(t);
|
|
56
57
|
return F(() => {
|
|
57
|
-
a.current =
|
|
58
|
-
}), F(() => (
|
|
58
|
+
a.current = t;
|
|
59
|
+
}), F(() => (x(s, e), () => x(s, e)), [s, e, n]), F(() => {
|
|
59
60
|
const r = (p) => {
|
|
60
61
|
if (p.origin !== window.origin)
|
|
61
62
|
return;
|
|
62
|
-
const l =
|
|
63
|
+
const l = rs(s, e, p.data);
|
|
63
64
|
l && a.current(l);
|
|
64
65
|
};
|
|
65
66
|
return window.addEventListener("message", r), () => window.removeEventListener("message", r);
|
|
@@ -71,106 +72,98 @@ const D = (s, e, t) => {
|
|
|
71
72
|
"data-widget-data": n
|
|
72
73
|
}
|
|
73
74
|
);
|
|
74
|
-
},
|
|
75
|
+
}, ms = as(
|
|
75
76
|
"@wix/form-app-builder:form"
|
|
76
|
-
),
|
|
77
|
-
siteWidget:
|
|
78
|
-
fallbackDirection:
|
|
79
|
-
},
|
|
80
|
-
|
|
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]) => [
|
|
77
|
+
), M = (s, e) => s.some((o) => o.id === e), cs = (s) => (s.steps ?? []).reduce((e, { id: o, name: t }) => (o && e.push({ id: o, name: t ?? void 0 }), e), []), ls = "forms-platform-form", gs = "_siteWidget_iiy4r_1", ps = "_fallbackDirection_iiy4r_21", N = {
|
|
78
|
+
siteWidget: gs,
|
|
79
|
+
fallbackDirection: ps
|
|
80
|
+
}, fs = "wix:image://", C = (s) => Array.isArray(s) ? s.map(C) : s && typeof s == "object" && !(s instanceof Date) ? Object.fromEntries(
|
|
81
|
+
Object.entries(s).map(([e, o]) => [
|
|
89
82
|
e,
|
|
90
|
-
e === "image" && typeof
|
|
83
|
+
e === "image" && typeof o == "string" && o.startsWith(fs) ? es(o) : C(o)
|
|
91
84
|
])
|
|
92
|
-
) : s,
|
|
85
|
+
) : s, _s = (s) => P.getForm(s).then(
|
|
93
86
|
(e) => (
|
|
94
87
|
// The SDK answers with `_id`/`_createdDate` and `wix:image://` strings;
|
|
95
88
|
// the element expects the un-prefixed keys and image objects.
|
|
96
|
-
|
|
89
|
+
C(
|
|
97
90
|
ss(e)
|
|
98
91
|
)
|
|
99
92
|
)
|
|
100
|
-
),
|
|
93
|
+
), W = D(
|
|
101
94
|
({
|
|
102
95
|
form: s,
|
|
103
96
|
compId: e,
|
|
104
|
-
wix:
|
|
105
|
-
elementProps:
|
|
97
|
+
wix: o,
|
|
98
|
+
elementProps: t,
|
|
106
99
|
state: n,
|
|
107
100
|
closedFormNotice: a,
|
|
108
101
|
closedMessagePlaceholder: r,
|
|
109
102
|
onRevisionChange: p
|
|
110
103
|
}, l) => {
|
|
111
|
-
var
|
|
112
|
-
const { t: j } =
|
|
104
|
+
var I, L, A;
|
|
105
|
+
const { t: j } = U(), i = Q(s), f = !!(a && ((I = i.properties) != null && I.disabled)), S = f && !n, v = !!(r && n === "closed" && !((A = (L = i.disabledFormMessage) == null ? void 0 : L.nodes) != null && A.length)), R = O(
|
|
113
106
|
() => ({
|
|
114
107
|
...i,
|
|
115
108
|
...f && {
|
|
116
109
|
properties: { ...i.properties, disabled: !1 }
|
|
117
110
|
},
|
|
118
|
-
...
|
|
111
|
+
...v && {
|
|
119
112
|
disabledFormMessage: r == null ? void 0 : r(j)
|
|
120
113
|
}
|
|
121
114
|
}),
|
|
122
115
|
[
|
|
123
116
|
i,
|
|
124
117
|
f,
|
|
125
|
-
|
|
118
|
+
v,
|
|
126
119
|
r,
|
|
127
120
|
j
|
|
128
121
|
]
|
|
129
|
-
), g =
|
|
122
|
+
), g = O(() => cs(i), [i]), _ = i.revision ?? void 0, [h, w] = d({}), [y, b] = d([]), [u, E] = d();
|
|
130
123
|
return F(() => {
|
|
131
124
|
var c;
|
|
132
|
-
u && !
|
|
133
|
-
}, [g, u]), /* @__PURE__ */
|
|
125
|
+
u && !M(g, u) && E((c = g[0]) == null ? void 0 : c.id);
|
|
126
|
+
}, [g, u]), /* @__PURE__ */ V(q, { children: [
|
|
134
127
|
/* @__PURE__ */ m(
|
|
135
|
-
|
|
128
|
+
is,
|
|
136
129
|
{
|
|
137
|
-
channel:
|
|
130
|
+
channel: ms,
|
|
138
131
|
compId: e,
|
|
139
|
-
data: { steps: g, stepId: u, revision:
|
|
132
|
+
data: { steps: g, stepId: u, revision: _ },
|
|
140
133
|
onChange: (c) => {
|
|
141
|
-
|
|
134
|
+
M(g, c.stepId) && E(c.stepId), c.revision && c.revision !== _ && p(c.revision);
|
|
142
135
|
}
|
|
143
136
|
}
|
|
144
137
|
),
|
|
145
|
-
|
|
138
|
+
S && a,
|
|
146
139
|
/* @__PURE__ */ m(
|
|
147
140
|
J,
|
|
148
141
|
{
|
|
149
142
|
ref: l,
|
|
150
|
-
className:
|
|
143
|
+
className: ls,
|
|
151
144
|
compId: e,
|
|
152
|
-
form:
|
|
153
|
-
wix:
|
|
154
|
-
elementProps:
|
|
145
|
+
form: R,
|
|
146
|
+
wix: o,
|
|
147
|
+
elementProps: t,
|
|
155
148
|
state: n,
|
|
156
|
-
values:
|
|
149
|
+
values: h,
|
|
157
150
|
onChange: w,
|
|
158
|
-
errors:
|
|
159
|
-
onValidate:
|
|
151
|
+
errors: y,
|
|
152
|
+
onValidate: b,
|
|
160
153
|
stepId: u,
|
|
161
|
-
onStepIdChange:
|
|
154
|
+
onStepIdChange: E
|
|
162
155
|
}
|
|
163
156
|
)
|
|
164
157
|
] });
|
|
165
158
|
}
|
|
166
159
|
);
|
|
167
|
-
|
|
168
|
-
const
|
|
160
|
+
W.displayName = "FormViewerHost";
|
|
161
|
+
const K = D(
|
|
169
162
|
({
|
|
170
163
|
id: s,
|
|
171
164
|
className: e,
|
|
172
|
-
formId:
|
|
173
|
-
direction:
|
|
165
|
+
formId: o,
|
|
166
|
+
direction: t,
|
|
174
167
|
a11y: n,
|
|
175
168
|
elementProps: a,
|
|
176
169
|
fallback: r = null,
|
|
@@ -179,17 +172,17 @@ const U = O(
|
|
|
179
172
|
closedFormNotice: j,
|
|
180
173
|
closedMessagePlaceholder: i,
|
|
181
174
|
errorBoundary: f
|
|
182
|
-
},
|
|
183
|
-
var w,
|
|
184
|
-
const
|
|
185
|
-
|
|
175
|
+
}, S) => {
|
|
176
|
+
var w, y, b;
|
|
177
|
+
const v = ts({ useSuspense: !0 }), [R, g] = d(), _ = O(() => o ? _s(o) : l, [o, R, l]), h = /* @__PURE__ */ m(H, { fallback: r, children: s && _ ? /* @__PURE__ */ m(
|
|
178
|
+
W,
|
|
186
179
|
{
|
|
187
|
-
ref:
|
|
188
|
-
form:
|
|
180
|
+
ref: S,
|
|
181
|
+
form: _,
|
|
189
182
|
compId: s,
|
|
190
183
|
wix: (w = a == null ? void 0 : a.form) == null ? void 0 : w.wix,
|
|
191
|
-
elementProps: (
|
|
192
|
-
state: (
|
|
184
|
+
elementProps: (y = a == null ? void 0 : a.form) == null ? void 0 : y.elementProps,
|
|
185
|
+
state: (b = a == null ? void 0 : a.form) == null ? void 0 : b.state,
|
|
193
186
|
closedFormNotice: j,
|
|
194
187
|
closedMessagePlaceholder: i,
|
|
195
188
|
onRevisionChange: g
|
|
@@ -199,23 +192,23 @@ const U = O(
|
|
|
199
192
|
"div",
|
|
200
193
|
{
|
|
201
194
|
id: s,
|
|
202
|
-
dir:
|
|
195
|
+
dir: t,
|
|
203
196
|
className: Y(
|
|
204
197
|
"form",
|
|
205
|
-
|
|
206
|
-
|
|
198
|
+
N.siteWidget,
|
|
199
|
+
N.fallbackDirection,
|
|
207
200
|
e
|
|
208
201
|
),
|
|
209
202
|
...n && X(n),
|
|
210
|
-
children: /* @__PURE__ */ m(z, { i18n:
|
|
203
|
+
children: /* @__PURE__ */ m(z, { i18n: v, children: f ? /* @__PURE__ */ m(f, { resetKey: _, children: h }) : h })
|
|
211
204
|
}
|
|
212
205
|
);
|
|
213
206
|
}
|
|
214
207
|
);
|
|
215
|
-
|
|
216
|
-
const
|
|
208
|
+
K.displayName = "FormRoot";
|
|
209
|
+
const Os = {}, us = D((s, e) => /* @__PURE__ */ m(K, { ...s, ref: e }));
|
|
217
210
|
us.displayName = "Form";
|
|
218
211
|
export {
|
|
219
212
|
us as default,
|
|
220
|
-
|
|
213
|
+
Os as defaultProps
|
|
221
214
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/form-app-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.338.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,11 +46,11 @@
|
|
|
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.152.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",
|
|
53
|
-
"@wix/sdk-runtime": "^1.0.
|
|
53
|
+
"@wix/sdk-runtime": "^1.0.30",
|
|
54
54
|
"classnames": "^2.5.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
@@ -134,5 +134,5 @@
|
|
|
134
134
|
]
|
|
135
135
|
}
|
|
136
136
|
},
|
|
137
|
-
"falconPackageHash": "
|
|
137
|
+
"falconPackageHash": "72055db35dd5d7cb39966dc3fe6d543efb1e254195145f03a05d8371"
|
|
138
138
|
}
|