@wix/form-app-builder 1.356.0 → 1.358.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 +89 -85
- package/package.json +3 -3
package/dist/component/form.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as u, useRef as H, useEffect as F, forwardRef as L, useMemo as
|
|
3
|
-
import { initI18n as $, createAsyncMessagesLoader 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
|
|
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
13
|
const o = s[e];
|
|
14
14
|
return o ? typeof o == "function" ? o() : Promise.resolve(o) : new Promise((n, a) => {
|
|
15
15
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
@@ -21,33 +21,33 @@ const k = (s, e, t) => {
|
|
|
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
|
-
},
|
|
30
|
+
}, rs = ({ useSuspense: s = !1 } = {}) => {
|
|
31
31
|
const [e] = u(
|
|
32
32
|
() => $({
|
|
33
|
-
locale:
|
|
33
|
+
locale: as(),
|
|
34
34
|
useSuspense: s,
|
|
35
|
-
asyncMessagesLoader:
|
|
35
|
+
asyncMessagesLoader: z({
|
|
36
36
|
isDev: !1,
|
|
37
|
-
loadMessages: (t) =>
|
|
38
|
-
loadDevMessages: (t) =>
|
|
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
|
-
},
|
|
47
|
+
}, ms = (s, e, t) => {
|
|
48
48
|
const o = t;
|
|
49
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
|
-
},
|
|
50
|
+
}, cs = ({
|
|
51
51
|
channel: s,
|
|
52
52
|
compId: e,
|
|
53
53
|
data: t,
|
|
@@ -56,15 +56,15 @@ const k = (s, e, t) => {
|
|
|
56
56
|
const n = JSON.stringify(t), a = H(o);
|
|
57
57
|
return F(() => {
|
|
58
58
|
a.current = o;
|
|
59
|
-
}), F(() => (
|
|
59
|
+
}), F(() => (N(s, e), () => N(s, e)), [s, e, n]), F(() => {
|
|
60
60
|
const i = (l) => {
|
|
61
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
66
|
return window.addEventListener("message", i), () => window.removeEventListener("message", i);
|
|
67
|
-
}, [s, e]), /* @__PURE__ */
|
|
67
|
+
}, [s, e]), /* @__PURE__ */ c(
|
|
68
68
|
"template",
|
|
69
69
|
{
|
|
70
70
|
"data-channel": s.name,
|
|
@@ -72,25 +72,25 @@ const k = (s, e, t) => {
|
|
|
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:
|
|
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
80
|
}, _s = "wix:image://", D = (s) => Array.isArray(s) ? s.map(D) : s && typeof s == "object" && !(s instanceof Date) ? Object.fromEntries(
|
|
81
81
|
Object.entries(s).map(([e, t]) => [
|
|
82
82
|
e,
|
|
83
|
-
e === "image" && typeof t == "string" && t.startsWith(_s) ?
|
|
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
89
|
D(
|
|
90
|
-
|
|
90
|
+
ts(e)
|
|
91
91
|
)
|
|
92
92
|
)
|
|
93
|
-
),
|
|
93
|
+
), U = L(
|
|
94
94
|
({
|
|
95
95
|
form: s,
|
|
96
96
|
compId: e,
|
|
@@ -100,13 +100,13 @@ const k = (s, e, t) => {
|
|
|
100
100
|
closedFormNotice: a,
|
|
101
101
|
closedMessagePlaceholder: i,
|
|
102
102
|
formUpdates: l,
|
|
103
|
-
onFormUpdate:
|
|
103
|
+
onFormUpdate: p
|
|
104
104
|
}, S) => {
|
|
105
|
-
var
|
|
106
|
-
const { t: j } =
|
|
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(
|
|
107
107
|
() => ({
|
|
108
108
|
...r,
|
|
109
|
-
...
|
|
109
|
+
...f && {
|
|
110
110
|
properties: { ...r.properties, disabled: !1 }
|
|
111
111
|
},
|
|
112
112
|
...h && {
|
|
@@ -115,58 +115,62 @@ const k = (s, e, t) => {
|
|
|
115
115
|
}),
|
|
116
116
|
[
|
|
117
117
|
r,
|
|
118
|
-
|
|
118
|
+
f,
|
|
119
119
|
h,
|
|
120
120
|
i,
|
|
121
121
|
j
|
|
122
122
|
]
|
|
123
|
-
), g =
|
|
124
|
-
|
|
125
|
-
var
|
|
126
|
-
|
|
127
|
-
}, [g,
|
|
128
|
-
|
|
129
|
-
|
|
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,
|
|
130
134
|
{
|
|
131
|
-
channel:
|
|
135
|
+
channel: ls,
|
|
132
136
|
compId: e,
|
|
133
|
-
data: { steps: g, stepId:
|
|
134
|
-
onChange: (
|
|
135
|
-
|
|
137
|
+
data: { steps: g, stepId: _, revision: d },
|
|
138
|
+
onChange: (m) => {
|
|
139
|
+
W(g, m.stepId) && O(m.stepId), A(m.revision);
|
|
136
140
|
}
|
|
137
141
|
}
|
|
138
142
|
),
|
|
139
|
-
l && r.id && r.namespace && /* @__PURE__ */
|
|
143
|
+
l && r.id && r.namespace && /* @__PURE__ */ c(
|
|
140
144
|
l,
|
|
141
145
|
{
|
|
142
146
|
formId: r.id,
|
|
143
147
|
namespace: r.namespace,
|
|
144
|
-
onFormUpdate:
|
|
148
|
+
onFormUpdate: A
|
|
145
149
|
}
|
|
146
150
|
),
|
|
147
|
-
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
|
|
151
|
+
E && a,
|
|
152
|
+
/* @__PURE__ */ c(
|
|
153
|
+
Q,
|
|
150
154
|
{
|
|
151
155
|
ref: S,
|
|
152
156
|
className: gs,
|
|
153
157
|
compId: e,
|
|
154
|
-
form:
|
|
158
|
+
form: I,
|
|
155
159
|
wix: t,
|
|
156
160
|
elementProps: o,
|
|
157
161
|
state: n,
|
|
158
162
|
values: w,
|
|
159
|
-
onChange:
|
|
160
|
-
errors:
|
|
161
|
-
onValidate:
|
|
162
|
-
stepId:
|
|
163
|
-
onStepIdChange:
|
|
163
|
+
onChange: y,
|
|
164
|
+
errors: b,
|
|
165
|
+
onValidate: v,
|
|
166
|
+
stepId: _,
|
|
167
|
+
onStepIdChange: O
|
|
164
168
|
}
|
|
165
169
|
)
|
|
166
170
|
] });
|
|
167
171
|
}
|
|
168
172
|
);
|
|
169
|
-
|
|
173
|
+
U.displayName = "FormViewerHost";
|
|
170
174
|
const V = L(
|
|
171
175
|
({
|
|
172
176
|
id: s,
|
|
@@ -177,49 +181,49 @@ const V = L(
|
|
|
177
181
|
elementProps: a,
|
|
178
182
|
fallback: i = null,
|
|
179
183
|
emptyState: l = null,
|
|
180
|
-
pendingForm:
|
|
184
|
+
pendingForm: p,
|
|
181
185
|
closedFormNotice: S,
|
|
182
186
|
closedMessagePlaceholder: j,
|
|
183
187
|
formUpdates: r,
|
|
184
|
-
errorBoundary:
|
|
185
|
-
},
|
|
186
|
-
var
|
|
187
|
-
const h =
|
|
188
|
-
|
|
188
|
+
errorBoundary: f
|
|
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,
|
|
189
193
|
{
|
|
190
|
-
ref:
|
|
194
|
+
ref: E,
|
|
191
195
|
form: d,
|
|
192
196
|
compId: s,
|
|
193
|
-
wix: (
|
|
194
|
-
elementProps: (
|
|
195
|
-
state: (
|
|
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,
|
|
196
200
|
closedFormNotice: S,
|
|
197
201
|
closedMessagePlaceholder: j,
|
|
198
202
|
formUpdates: r,
|
|
199
|
-
onFormUpdate:
|
|
203
|
+
onFormUpdate: g
|
|
200
204
|
}
|
|
201
205
|
) : l });
|
|
202
|
-
return /* @__PURE__ */
|
|
206
|
+
return /* @__PURE__ */ c(
|
|
203
207
|
"div",
|
|
204
208
|
{
|
|
205
209
|
id: s,
|
|
206
210
|
dir: o,
|
|
207
|
-
className:
|
|
211
|
+
className: P(
|
|
208
212
|
"form",
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
K.siteWidget,
|
|
214
|
+
K.fallbackDirection,
|
|
211
215
|
e
|
|
212
216
|
),
|
|
213
|
-
...n &&
|
|
214
|
-
children: /* @__PURE__ */
|
|
217
|
+
...n && Y(n),
|
|
218
|
+
children: /* @__PURE__ */ c(X, { i18n: h, children: f ? /* @__PURE__ */ c(f, { resetKey: d, children: w }) : w })
|
|
215
219
|
}
|
|
216
220
|
);
|
|
217
221
|
}
|
|
218
222
|
);
|
|
219
223
|
V.displayName = "FormRoot";
|
|
220
|
-
const
|
|
221
|
-
|
|
224
|
+
const Ds = {}, js = L((s, e) => /* @__PURE__ */ c(V, { ...s, ref: e }));
|
|
225
|
+
js.displayName = "Form";
|
|
222
226
|
export {
|
|
223
|
-
|
|
224
|
-
|
|
227
|
+
js as default,
|
|
228
|
+
Ds as defaultProps
|
|
225
229
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/form-app-builder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.358.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.170.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",
|
|
@@ -135,5 +135,5 @@
|
|
|
135
135
|
]
|
|
136
136
|
}
|
|
137
137
|
},
|
|
138
|
-
"falconPackageHash": "
|
|
138
|
+
"falconPackageHash": "3ce8fa31e975d2566ee7cf87dcd95505bc112435d90028fa4cd2337b"
|
|
139
139
|
}
|