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