@wix/form-app-builder 1.355.0 → 1.357.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 +141 -126
- package/package.json +3 -2
package/dist/component/form.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { jsx 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 c, 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 R, Suspense as B } from "react";
|
|
3
|
+
import { initI18n as $, createAsyncMessagesLoader as z, useTranslation as J, I18nextProvider as X } from "@wix/fed-cli-i18next";
|
|
4
|
+
import Q from "@wix/form-elements/Form";
|
|
5
|
+
import { convertA11yKeysToHtmlFormat as Y } from "@wix/react-component-utils";
|
|
6
|
+
import { use as Z } from "@wix/react-use-promise-polyfill";
|
|
7
|
+
import P from "classnames";
|
|
8
|
+
import { i18n as ss } from "@wix/essentials";
|
|
9
|
+
import { forms as es } from "@wix/forms";
|
|
10
|
+
import { renameKeysFromSDKRequestToRESTRequest as ts } from "@wix/sdk-runtime/rename-all-nested-keys";
|
|
11
|
+
import { transformSDKImageToRESTImage as os } from "@wix/sdk-runtime/transformations/image";
|
|
12
|
+
const x = (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
|
+
}, M = "en", as = () => {
|
|
25
25
|
try {
|
|
26
|
-
return
|
|
26
|
+
return ss.getLanguage() || M;
|
|
27
27
|
} catch {
|
|
28
|
-
return
|
|
28
|
+
return M;
|
|
29
29
|
}
|
|
30
|
-
},
|
|
31
|
-
const [e] =
|
|
32
|
-
() =>
|
|
33
|
-
locale:
|
|
30
|
+
}, rs = ({ useSuspense: s = !1 } = {}) => {
|
|
31
|
+
const [e] = u(
|
|
32
|
+
() => $({
|
|
33
|
+
locale: as(),
|
|
34
34
|
useSuspense: s,
|
|
35
|
-
asyncMessagesLoader:
|
|
35
|
+
asyncMessagesLoader: z({
|
|
36
36
|
isDev: !1,
|
|
37
|
-
loadMessages: (
|
|
38
|
-
loadDevMessages: (
|
|
37
|
+
loadMessages: (t) => x(/* @__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) => x(/* @__PURE__ */ Object.assign({}), `../assets/locale/messages_${t}.dev.json`, 4)
|
|
39
39
|
})
|
|
40
40
|
})
|
|
41
41
|
);
|
|
42
42
|
return e;
|
|
43
|
-
},
|
|
43
|
+
}, ns = (s) => ({ name: s }), is = (s) => `${s.name}:change`, N = (s, e) => {
|
|
44
44
|
window.dispatchEvent(
|
|
45
|
-
new CustomEvent(
|
|
45
|
+
new CustomEvent(is(s), { detail: e })
|
|
46
46
|
);
|
|
47
|
-
},
|
|
48
|
-
const
|
|
49
|
-
return (
|
|
50
|
-
},
|
|
47
|
+
}, ms = (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
|
+
}, cs = ({
|
|
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(() => (N(s, e), () => N(s, e)), [s, e, n]), F(() => {
|
|
60
|
+
const i = (l) => {
|
|
61
|
+
if (l.origin !== window.origin)
|
|
62
62
|
return;
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const p = ms(s, e, l.data);
|
|
64
|
+
p && a.current(p);
|
|
65
65
|
};
|
|
66
|
-
return window.addEventListener("message",
|
|
67
|
-
}, [s, e]), /* @__PURE__ */
|
|
66
|
+
return window.addEventListener("message", i), () => window.removeEventListener("message", i);
|
|
67
|
+
}, [s, e]), /* @__PURE__ */ c(
|
|
68
68
|
"template",
|
|
69
69
|
{
|
|
70
70
|
"data-channel": s.name,
|
|
@@ -72,143 +72,158 @@ const T = (s, e, o) => {
|
|
|
72
72
|
"data-widget-data": n
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
|
-
},
|
|
75
|
+
}, ls = ns(
|
|
76
76
|
"@wix/form-app-builder:form"
|
|
77
|
-
),
|
|
78
|
-
siteWidget:
|
|
79
|
-
fallbackDirection:
|
|
80
|
-
},
|
|
81
|
-
Object.entries(s).map(([e,
|
|
77
|
+
), W = (s, e) => s.some((t) => t.id === e), ps = (s) => (s.steps ?? []).reduce((e, { id: t, name: o }) => (t && e.push({ id: t, name: o ?? void 0 }), e), []), gs = "forms-platform-form", fs = "_siteWidget_iiy4r_1", ds = "_fallbackDirection_iiy4r_21", K = {
|
|
78
|
+
siteWidget: fs,
|
|
79
|
+
fallbackDirection: ds
|
|
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) ? os(t) : D(t)
|
|
84
84
|
])
|
|
85
|
-
) : s,
|
|
85
|
+
) : s, us = (s) => es.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
|
+
ts(e)
|
|
91
91
|
)
|
|
92
92
|
)
|
|
93
|
-
),
|
|
93
|
+
), U = 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: p
|
|
104
|
+
}, S) => {
|
|
105
|
+
var C, T, k;
|
|
106
|
+
const { t: j } = J(), r = Z(s), f = !!(a && ((C = r.properties) != null && C.disabled)), E = f && !n, h = !!(i && n === "closed" && !((k = (T = r.disabledFormMessage) == null ? void 0 : T.nodes) != null && k.length)), I = R(
|
|
106
107
|
() => ({
|
|
107
|
-
...
|
|
108
|
+
...r,
|
|
108
109
|
...f && {
|
|
109
|
-
properties: { ...
|
|
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
|
+
f,
|
|
119
|
+
h,
|
|
120
|
+
i,
|
|
120
121
|
j
|
|
121
122
|
]
|
|
122
|
-
), g =
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
|
|
126
|
-
}, [g,
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
), g = R(() => ps(r), [r]), d = r.revision ?? void 0, [w, y] = u({}), [b, v] = u([]), [_, O] = u();
|
|
124
|
+
F(() => {
|
|
125
|
+
var m;
|
|
126
|
+
_ && !W(g, _) && O((m = g[0]) == null ? void 0 : m.id);
|
|
127
|
+
}, [g, _]);
|
|
128
|
+
const A = (m) => {
|
|
129
|
+
m && m !== d && p(m);
|
|
130
|
+
};
|
|
131
|
+
return /* @__PURE__ */ q(G, { children: [
|
|
132
|
+
/* @__PURE__ */ c(
|
|
133
|
+
cs,
|
|
129
134
|
{
|
|
130
|
-
channel:
|
|
135
|
+
channel: ls,
|
|
131
136
|
compId: e,
|
|
132
|
-
data: { steps: g, stepId:
|
|
133
|
-
onChange: (
|
|
134
|
-
|
|
137
|
+
data: { steps: g, stepId: _, revision: d },
|
|
138
|
+
onChange: (m) => {
|
|
139
|
+
W(g, m.stepId) && O(m.stepId), A(m.revision);
|
|
135
140
|
}
|
|
136
141
|
}
|
|
137
142
|
),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
l && r.id && r.namespace && /* @__PURE__ */ c(
|
|
144
|
+
l,
|
|
145
|
+
{
|
|
146
|
+
formId: r.id,
|
|
147
|
+
namespace: r.namespace,
|
|
148
|
+
onFormUpdate: A
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
E && a,
|
|
152
|
+
/* @__PURE__ */ c(
|
|
153
|
+
Q,
|
|
141
154
|
{
|
|
142
|
-
ref:
|
|
143
|
-
className:
|
|
155
|
+
ref: S,
|
|
156
|
+
className: gs,
|
|
144
157
|
compId: e,
|
|
145
|
-
form:
|
|
146
|
-
wix:
|
|
147
|
-
elementProps:
|
|
158
|
+
form: I,
|
|
159
|
+
wix: t,
|
|
160
|
+
elementProps: o,
|
|
148
161
|
state: n,
|
|
149
|
-
values:
|
|
150
|
-
onChange:
|
|
151
|
-
errors:
|
|
152
|
-
onValidate:
|
|
153
|
-
stepId:
|
|
154
|
-
onStepIdChange:
|
|
162
|
+
values: w,
|
|
163
|
+
onChange: y,
|
|
164
|
+
errors: b,
|
|
165
|
+
onValidate: v,
|
|
166
|
+
stepId: _,
|
|
167
|
+
onStepIdChange: O
|
|
155
168
|
}
|
|
156
169
|
)
|
|
157
170
|
] });
|
|
158
171
|
}
|
|
159
172
|
);
|
|
160
|
-
|
|
161
|
-
const
|
|
173
|
+
U.displayName = "FormViewerHost";
|
|
174
|
+
const V = L(
|
|
162
175
|
({
|
|
163
176
|
id: s,
|
|
164
177
|
className: e,
|
|
165
|
-
formId:
|
|
166
|
-
direction:
|
|
178
|
+
formId: t,
|
|
179
|
+
direction: o,
|
|
167
180
|
a11y: n,
|
|
168
181
|
elementProps: a,
|
|
169
|
-
fallback:
|
|
170
|
-
emptyState:
|
|
171
|
-
pendingForm:
|
|
172
|
-
closedFormNotice:
|
|
173
|
-
closedMessagePlaceholder:
|
|
182
|
+
fallback: i = null,
|
|
183
|
+
emptyState: l = null,
|
|
184
|
+
pendingForm: p,
|
|
185
|
+
closedFormNotice: S,
|
|
186
|
+
closedMessagePlaceholder: j,
|
|
187
|
+
formUpdates: r,
|
|
174
188
|
errorBoundary: f
|
|
175
|
-
},
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
|
|
189
|
+
}, E) => {
|
|
190
|
+
var y, b, v;
|
|
191
|
+
const h = rs({ useSuspense: !0 }), [I, g] = u(), d = R(() => t ? us(t) : p, [t, I, p]), w = /* @__PURE__ */ c(B, { fallback: i, children: s && d ? /* @__PURE__ */ c(
|
|
192
|
+
U,
|
|
179
193
|
{
|
|
180
|
-
ref:
|
|
181
|
-
form:
|
|
194
|
+
ref: E,
|
|
195
|
+
form: d,
|
|
182
196
|
compId: s,
|
|
183
|
-
wix: (
|
|
184
|
-
elementProps: (
|
|
185
|
-
state: (
|
|
186
|
-
closedFormNotice:
|
|
187
|
-
closedMessagePlaceholder:
|
|
188
|
-
|
|
197
|
+
wix: (y = a == null ? void 0 : a.form) == null ? void 0 : y.wix,
|
|
198
|
+
elementProps: (b = a == null ? void 0 : a.form) == null ? void 0 : b.elementProps,
|
|
199
|
+
state: (v = a == null ? void 0 : a.form) == null ? void 0 : v.state,
|
|
200
|
+
closedFormNotice: S,
|
|
201
|
+
closedMessagePlaceholder: j,
|
|
202
|
+
formUpdates: r,
|
|
203
|
+
onFormUpdate: g
|
|
189
204
|
}
|
|
190
|
-
) :
|
|
191
|
-
return /* @__PURE__ */
|
|
205
|
+
) : l });
|
|
206
|
+
return /* @__PURE__ */ c(
|
|
192
207
|
"div",
|
|
193
208
|
{
|
|
194
209
|
id: s,
|
|
195
|
-
dir:
|
|
196
|
-
className:
|
|
210
|
+
dir: o,
|
|
211
|
+
className: P(
|
|
197
212
|
"form",
|
|
198
|
-
|
|
199
|
-
|
|
213
|
+
K.siteWidget,
|
|
214
|
+
K.fallbackDirection,
|
|
200
215
|
e
|
|
201
216
|
),
|
|
202
|
-
...n &&
|
|
203
|
-
children: /* @__PURE__ */
|
|
217
|
+
...n && Y(n),
|
|
218
|
+
children: /* @__PURE__ */ c(X, { i18n: h, children: f ? /* @__PURE__ */ c(f, { resetKey: d, children: w }) : w })
|
|
204
219
|
}
|
|
205
220
|
);
|
|
206
221
|
}
|
|
207
222
|
);
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
223
|
+
V.displayName = "FormRoot";
|
|
224
|
+
const Ds = {}, js = L((s, e) => /* @__PURE__ */ c(V, { ...s, ref: e }));
|
|
225
|
+
js.displayName = "Form";
|
|
211
226
|
export {
|
|
212
|
-
|
|
213
|
-
|
|
227
|
+
js as default,
|
|
228
|
+
Ds as defaultProps
|
|
214
229
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/form-app-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.357.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": "3b83a4f5b7cb13144a6549ddbf49be4025766b2b8addd4a7fb4ef513"
|
|
138
139
|
}
|