@levo-so/react 0.1.14 → 0.1.15
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/CheckboxWidget-BGS61gcL.js +124 -0
- package/dist/CollectionFormBuilder-BIvx_z08.js +1197 -0
- package/dist/{CurrencyWidget-COoMkfsA.js → CurrencyWidget-sD8ijLvw.js} +5 -5
- package/dist/{DateTimeWidget-DcbQ3smI.js → DateTimeWidget-KrcsxgEF.js} +3 -3
- package/dist/DefaultFormVariant-j1HgVDiI.js +127 -0
- package/dist/DropdownWidget-rm5oUqOE.js +113 -0
- package/dist/{EmailWidget-CG9oNUM5.js → EmailWidget-CvZKOywL.js} +11 -11
- package/dist/GeocoderWidget-CSsp_-hW.js +68 -0
- package/dist/{LevoProvider-BI6g_T4E.js → LevoProvider-Do3jjJ4j.js} +0 -1
- package/dist/{MultiGeocoderWidget-D3Xmv8g4.js → MultiGeocoderWidget-Blqz-lHX.js} +6 -6
- package/dist/{MultiTextWidget-CyQRcWC8.js → MultiTextWidget-CxVpyf06.js} +14 -14
- package/dist/{PhoneWidget-C1Jt7kXL.js → PhoneWidget-DezcchSP.js} +5 -5
- package/dist/{RadioWidget-BrLNF-I2.js → RadioWidget-SfD1fFDG.js} +9 -9
- package/dist/{RichTextWidget-BogYcPtS.js → RichTextWidget-Cg3RizdO.js} +21 -21
- package/dist/Spinner-Bzu2xCFZ.js +405 -0
- package/dist/{StepsFormVariant-Bx-jdciC.js → StepsFormVariant-D35dFYK6.js} +9 -9
- package/dist/{SwitchWidget-BT0-waP9.js → SwitchWidget-Id6BNlPe.js} +5 -5
- package/dist/{TextWidget-Bvsz-hey.js → TextWidget-CtFaQde1.js} +7 -7
- package/dist/{TextareaWidget-8SLym--T.js → TextareaWidget-BKzAeMod.js} +3 -3
- package/dist/{ToggleCheckboxWidget-VrCQBF5C.js → ToggleCheckboxWidget-nSlie9sE.js} +7 -7
- package/dist/Tooltip-DEBnSqlo.js +36 -0
- package/dist/{URLWidget-B99nKr6N.js → URLWidget-DtJai3xY.js} +2 -2
- package/dist/UploadWidget-Dxx2_FYo.js +616 -0
- package/dist/audience/components/page.d.ts.map +1 -1
- package/dist/audience/index.js +1 -1
- package/dist/collection/components/Altcha.d.ts +10 -0
- package/dist/collection/components/Altcha.d.ts.map +1 -0
- package/dist/collection/components/renderer/RenderCommonField.d.ts.map +1 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts +1 -1
- package/dist/collection/components/widgets/checkboxWidget/CheckboxWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts +7 -0
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2M.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/{CollectionWidget.d.ts → CollectionWidgetM2O.d.ts} +1 -1
- package/dist/collection/components/widgets/collectionWidget/CollectionWidgetM2O.d.ts.map +1 -0
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts +8 -0
- package/dist/collection/components/widgets/collectionWidget/SelectedCollectionItems.d.ts.map +1 -0
- package/dist/collection/components/widgets/dropdownWidget/DropdownWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/geocoderWidget/GeocoderWidget.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts +11 -0
- package/dist/collection/components/widgets/uploadWidget/ExternalURL.d.ts.map +1 -0
- package/dist/collection/components/widgets/uploadWidget/FileUploadDropBox.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/FileUploadModal.d.ts.map +1 -1
- package/dist/collection/components/widgets/uploadWidget/ImportFromAssets.d.ts.map +1 -1
- package/dist/collection/index.js +13 -12
- package/dist/collection/lib/hooks/useLevoForm.d.ts +2 -1
- package/dist/collection/lib/hooks/useLevoForm.d.ts.map +1 -1
- package/dist/collection/lib/variants/DefaultFormVariant.d.ts.map +1 -1
- package/dist/collection/utils/formHelpers.d.ts.map +1 -1
- package/dist/collection/utils/index.d.ts +2 -0
- package/dist/collection/utils/index.d.ts.map +1 -1
- package/dist/components/Table.d.ts +11 -0
- package/dist/components/Table.d.ts.map +1 -0
- package/dist/components/index.js +29 -29
- package/dist/constants/fileUploadPresets.d.ts +4 -2
- package/dist/constants/fileUploadPresets.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +75 -75
- package/dist/membership/index.js +1 -1
- package/dist/page-DgqTELmZ.js +212 -0
- package/dist/useLevoForm-3jSJ9I6v.js +170 -0
- package/package.json +8 -7
- package/dist/CheckboxWidget-BctVOZiO.js +0 -118
- package/dist/CollectionFormBuilder-B6CAVKhg.js +0 -772
- package/dist/DefaultFormVariant-C6zbKgwB.js +0 -80
- package/dist/DropdownWidget-DszCTSWr.js +0 -115
- package/dist/GeocoderWidget-CXu17A7y.js +0 -310
- package/dist/Spinner-DzGH5rKe.js +0 -297
- package/dist/Tooltip-CI4i4mYr.js +0 -144
- package/dist/UploadWidget-ZebPWZZZ.js +0 -505
- package/dist/collection/components/widgets/collectionWidget/CollectionWidget.d.ts.map +0 -1
- package/dist/fileUploadPresets-2raQmHT0.js +0 -74
- package/dist/page-yeiAPg3O.js +0 -200
- package/dist/useLevoForm-DjvUas25.js +0 -166
package/dist/page-yeiAPg3O.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { j as R } from "./jsx-runtime-B6kdoens.js";
|
|
3
|
-
import { useEffect as g, useState as j } from "react";
|
|
4
|
-
import { useInView as C } from "react-intersection-observer";
|
|
5
|
-
import { u as k } from "./LevoProvider-BI6g_T4E.js";
|
|
6
|
-
import { usePageLifecycle as H, LifecycleState as I } from "use-page-lifecycle";
|
|
7
|
-
const we = ({ id: e, properties: r = {} }) => {
|
|
8
|
-
const { audience: t } = k(), { ref: n, inView: s } = C({
|
|
9
|
-
triggerOnce: !0
|
|
10
|
-
});
|
|
11
|
-
return g(() => {
|
|
12
|
-
t != null && t.instance && s && (t == null || t.track("block.view", {
|
|
13
|
-
...r,
|
|
14
|
-
resource: "block",
|
|
15
|
-
identifier: e
|
|
16
|
-
}));
|
|
17
|
-
}, [s]), /* @__PURE__ */ R.jsx("div", { ref: n, style: { height: "0px" } });
|
|
18
|
-
}, Te = ({ event: e, properties: r }) => {
|
|
19
|
-
const { audience: t } = k();
|
|
20
|
-
return g(() => {
|
|
21
|
-
t != null && t.instance && (t == null || t.track(e, r));
|
|
22
|
-
}, [t == null ? void 0 : t.instance, e, r]), null;
|
|
23
|
-
};
|
|
24
|
-
function S(e) {
|
|
25
|
-
var r = typeof e;
|
|
26
|
-
return e != null && (r == "object" || r == "function");
|
|
27
|
-
}
|
|
28
|
-
var F = typeof global == "object" && global && global.Object === Object && global, G = typeof self == "object" && self && self.Object === Object && self, W = F || G || Function("return this")(), T = function() {
|
|
29
|
-
return W.Date.now();
|
|
30
|
-
}, V = /\s/;
|
|
31
|
-
function _(e) {
|
|
32
|
-
for (var r = e.length; r-- && V.test(e.charAt(r)); )
|
|
33
|
-
;
|
|
34
|
-
return r;
|
|
35
|
-
}
|
|
36
|
-
var z = /^\s+/;
|
|
37
|
-
function X(e) {
|
|
38
|
-
return e && e.slice(0, _(e) + 1).replace(z, "");
|
|
39
|
-
}
|
|
40
|
-
var h = W.Symbol, D = Object.prototype, Y = D.hasOwnProperty, Z = D.toString, p = h ? h.toStringTag : void 0;
|
|
41
|
-
function q(e) {
|
|
42
|
-
var r = Y.call(e, p), t = e[p];
|
|
43
|
-
try {
|
|
44
|
-
e[p] = void 0;
|
|
45
|
-
var n = !0;
|
|
46
|
-
} catch {
|
|
47
|
-
}
|
|
48
|
-
var s = Z.call(e);
|
|
49
|
-
return n && (r ? e[p] = t : delete e[p]), s;
|
|
50
|
-
}
|
|
51
|
-
var J = Object.prototype, K = J.toString;
|
|
52
|
-
function Q(e) {
|
|
53
|
-
return K.call(e);
|
|
54
|
-
}
|
|
55
|
-
var ee = "[object Null]", te = "[object Undefined]", $ = h ? h.toStringTag : void 0;
|
|
56
|
-
function ne(e) {
|
|
57
|
-
return e == null ? e === void 0 ? te : ee : $ && $ in Object(e) ? q(e) : Q(e);
|
|
58
|
-
}
|
|
59
|
-
function re(e) {
|
|
60
|
-
return e != null && typeof e == "object";
|
|
61
|
-
}
|
|
62
|
-
var ie = "[object Symbol]";
|
|
63
|
-
function oe(e) {
|
|
64
|
-
return typeof e == "symbol" || re(e) && ne(e) == ie;
|
|
65
|
-
}
|
|
66
|
-
var A = NaN, se = /^[-+]0x[0-9a-f]+$/i, ce = /^0b[01]+$/i, fe = /^0o[0-7]+$/i, ae = parseInt;
|
|
67
|
-
function P(e) {
|
|
68
|
-
if (typeof e == "number")
|
|
69
|
-
return e;
|
|
70
|
-
if (oe(e))
|
|
71
|
-
return A;
|
|
72
|
-
if (S(e)) {
|
|
73
|
-
var r = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
74
|
-
e = S(r) ? r + "" : r;
|
|
75
|
-
}
|
|
76
|
-
if (typeof e != "string")
|
|
77
|
-
return e === 0 ? e : +e;
|
|
78
|
-
e = X(e);
|
|
79
|
-
var t = ce.test(e);
|
|
80
|
-
return t || fe.test(e) ? ae(e.slice(2), t ? 2 : 8) : se.test(e) ? A : +e;
|
|
81
|
-
}
|
|
82
|
-
var le = "Expected a function", ue = Math.max, ge = Math.min;
|
|
83
|
-
function de(e, r, t) {
|
|
84
|
-
var n, s, f, l, i, c, a = 0, O = !1, d = !1, v = !0;
|
|
85
|
-
if (typeof e != "function")
|
|
86
|
-
throw new TypeError(le);
|
|
87
|
-
r = P(r) || 0, S(t) && (O = !!t.leading, d = "maxWait" in t, f = d ? ue(P(t.maxWait) || 0, r) : f, v = "trailing" in t ? !!t.trailing : v);
|
|
88
|
-
function y(o) {
|
|
89
|
-
var u = n, m = s;
|
|
90
|
-
return n = s = void 0, a = o, l = e.apply(m, u), l;
|
|
91
|
-
}
|
|
92
|
-
function N(o) {
|
|
93
|
-
return a = o, i = setTimeout(b, r), O ? y(o) : l;
|
|
94
|
-
}
|
|
95
|
-
function U(o) {
|
|
96
|
-
var u = o - c, m = o - a, L = r - u;
|
|
97
|
-
return d ? ge(L, f - m) : L;
|
|
98
|
-
}
|
|
99
|
-
function x(o) {
|
|
100
|
-
var u = o - c, m = o - a;
|
|
101
|
-
return c === void 0 || u >= r || u < 0 || d && m >= f;
|
|
102
|
-
}
|
|
103
|
-
function b() {
|
|
104
|
-
var o = T();
|
|
105
|
-
if (x(o))
|
|
106
|
-
return E(o);
|
|
107
|
-
i = setTimeout(b, U(o));
|
|
108
|
-
}
|
|
109
|
-
function E(o) {
|
|
110
|
-
return i = void 0, v && n ? y(o) : (n = s = void 0, l);
|
|
111
|
-
}
|
|
112
|
-
function M() {
|
|
113
|
-
i !== void 0 && clearTimeout(i), a = 0, n = c = s = i = void 0;
|
|
114
|
-
}
|
|
115
|
-
function B() {
|
|
116
|
-
return i === void 0 ? l : E(T());
|
|
117
|
-
}
|
|
118
|
-
function w() {
|
|
119
|
-
var o = T(), u = x(o);
|
|
120
|
-
if (n = arguments, s = this, c = o, u) {
|
|
121
|
-
if (i === void 0)
|
|
122
|
-
return N(c);
|
|
123
|
-
if (d)
|
|
124
|
-
return clearTimeout(i), i = setTimeout(b, r), y(c);
|
|
125
|
-
}
|
|
126
|
-
return i === void 0 && (i = setTimeout(b, r)), l;
|
|
127
|
-
}
|
|
128
|
-
return w.cancel = M, w.flush = B, w;
|
|
129
|
-
}
|
|
130
|
-
const me = () => {
|
|
131
|
-
const [e, r] = j(0), [t, n] = j(0), s = de((f) => {
|
|
132
|
-
n(f), r(f);
|
|
133
|
-
}, 250);
|
|
134
|
-
return g(() => {
|
|
135
|
-
const f = () => {
|
|
136
|
-
const l = window.scrollY, i = document.documentElement.scrollHeight, c = window.innerHeight, a = Math.round(
|
|
137
|
-
l / (i - c) * 100
|
|
138
|
-
);
|
|
139
|
-
a % 10 === 0 && a > t && s(a);
|
|
140
|
-
};
|
|
141
|
-
return window.addEventListener("scroll", f), () => window.removeEventListener("scroll", f);
|
|
142
|
-
}, [t]), e;
|
|
143
|
-
}, je = ({ id: e, properties: r = {} }) => {
|
|
144
|
-
const { client: t, audience: n } = k(), [s, f] = j(), l = me(), i = typeof window < "u" ? window.location.href : void 0;
|
|
145
|
-
g(() => {
|
|
146
|
-
i && f(i);
|
|
147
|
-
}, [i]), g(() => {
|
|
148
|
-
n != null && n.instance && (n == null || n.track("page.scroll", {
|
|
149
|
-
resource: "page",
|
|
150
|
-
identifier: e,
|
|
151
|
-
percent: l
|
|
152
|
-
}));
|
|
153
|
-
}, [n == null ? void 0 : n.instance, l]), g(() => {
|
|
154
|
-
const a = () => {
|
|
155
|
-
n == null || n.track("page.bounce", {
|
|
156
|
-
resource: "page",
|
|
157
|
-
identifier: e
|
|
158
|
-
});
|
|
159
|
-
};
|
|
160
|
-
return window && window.addEventListener("beforeunload", a), () => {
|
|
161
|
-
window && window.removeEventListener("beforeunload", a);
|
|
162
|
-
};
|
|
163
|
-
}, [i]);
|
|
164
|
-
const [c] = H();
|
|
165
|
-
return g(() => {
|
|
166
|
-
c === I.TERMINATED && (n == null || n.track("page.bounce", {
|
|
167
|
-
resource: "page",
|
|
168
|
-
identifier: e,
|
|
169
|
-
state: c
|
|
170
|
-
})), c === I.FROZEN && (n == null || n.track("page.bounce", {
|
|
171
|
-
resource: "page",
|
|
172
|
-
identifier: e,
|
|
173
|
-
state: c
|
|
174
|
-
}));
|
|
175
|
-
}, [c]), !(t != null && t.insightsUrl) || !t.workspace || !t.workspace.startsWith("W") ? (console.error(
|
|
176
|
-
"[@levo-so/audience] The utility could not be initialized, due to missing workspace, or endpoint for insights."
|
|
177
|
-
), null) : t != null && t.insightsUrl && t.workspace && s ? /* @__PURE__ */ R.jsx(
|
|
178
|
-
"img",
|
|
179
|
-
{
|
|
180
|
-
alt: "",
|
|
181
|
-
src: `${t == null ? void 0 : t.insightsUrl}/v1/insights/event/hello.gif?url=${s}&workspace=${t.workspace}`,
|
|
182
|
-
style: {
|
|
183
|
-
height: "0px"
|
|
184
|
-
},
|
|
185
|
-
onLoad: () => {
|
|
186
|
-
n != null && n.instance ? n == null || n.instance.page({
|
|
187
|
-
resource: "page",
|
|
188
|
-
identifier: r.id
|
|
189
|
-
}) : n == null || n.initiate({
|
|
190
|
-
properties: { ...r, id: e }
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
) : null;
|
|
195
|
-
};
|
|
196
|
-
export {
|
|
197
|
-
we as L,
|
|
198
|
-
Te as a,
|
|
199
|
-
je as b
|
|
200
|
-
};
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect as F, useState as O, useRef as B } from "react";
|
|
3
|
-
import { useFormContext as G, useWatch as H, useForm as W } from "react-hook-form";
|
|
4
|
-
import { useDebouncedCallback as q } from "use-debounce";
|
|
5
|
-
import { u as U } from "./LevoProvider-BI6g_T4E.js";
|
|
6
|
-
import { l as j, b as C, s as z, f as Q } from "./CollectionFormBuilder-B6CAVKhg.js";
|
|
7
|
-
import { s as X } from "./Sonner-t6JVKA0a.js";
|
|
8
|
-
import { e as x } from "./errorHandler-_34Yv8wA.js";
|
|
9
|
-
import { a as Z } from "./isEmptyObject-C5s4GzLE.js";
|
|
10
|
-
const A = {
|
|
11
|
-
FORM_DIRTY: "form-dirty",
|
|
12
|
-
FORM_VALUES: "form-values"
|
|
13
|
-
}, m = (t) => {
|
|
14
|
-
const s = localStorage.getItem(`${t}-${A.FORM_VALUES}`);
|
|
15
|
-
return s ? JSON.parse(s) : {};
|
|
16
|
-
}, h = (t, s) => {
|
|
17
|
-
localStorage.setItem(
|
|
18
|
-
`${t}-${A.FORM_VALUES}`,
|
|
19
|
-
JSON.stringify(s)
|
|
20
|
-
);
|
|
21
|
-
}, M = (t) => {
|
|
22
|
-
localStorage.removeItem(`${t}-${A.FORM_VALUES}`);
|
|
23
|
-
}, tt = async ({
|
|
24
|
-
collection_key: t,
|
|
25
|
-
data: s
|
|
26
|
-
}) => {
|
|
27
|
-
const { client: E } = U(), r = await fetch(
|
|
28
|
-
`${E.apiUrl}/v1/bevy/content/${t}/save-entry`,
|
|
29
|
-
{
|
|
30
|
-
method: "POST",
|
|
31
|
-
body: JSON.stringify({ ...s }),
|
|
32
|
-
headers: {
|
|
33
|
-
"Content-Type": "application/json"
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
return r != null && r.ok ? await r.json() : null;
|
|
38
|
-
}, ft = ({ currentValues: t, isError: s, getContentId: E }) => {
|
|
39
|
-
var v;
|
|
40
|
-
const { schema: r, isLoggedIn: d } = j(), e = G(), y = H(), V = q((p) => {
|
|
41
|
-
r != null && r.key && !s && r != null && r.allow_draft && (d ? tt({
|
|
42
|
-
collection_key: r == null ? void 0 : r.key,
|
|
43
|
-
data: p
|
|
44
|
-
}).then((u) => {
|
|
45
|
-
var I, k, _, f;
|
|
46
|
-
(k = (I = u == null ? void 0 : u.content) == null ? void 0 : I.data) != null && k._id && E((f = (_ = u == null ? void 0 : u.content) == null ? void 0 : _.data) == null ? void 0 : f._id);
|
|
47
|
-
}) : h(r == null ? void 0 : r.key, p));
|
|
48
|
-
}, 2500);
|
|
49
|
-
return F(() => {
|
|
50
|
-
var p, u;
|
|
51
|
-
!s && d && (p = e == null ? void 0 : e.formState) != null && p.isDirty && ((u = Object == null ? void 0 : Object.keys(y || {})) == null ? void 0 : u.length) > 0 && V({
|
|
52
|
-
currentValues: t,
|
|
53
|
-
...y
|
|
54
|
-
});
|
|
55
|
-
}, [(v = e == null ? void 0 : e.formState) == null ? void 0 : v.isDirty, s, d, y]), null;
|
|
56
|
-
}, ct = ({
|
|
57
|
-
schema: t,
|
|
58
|
-
saveToRemote: s,
|
|
59
|
-
onSubmit: E,
|
|
60
|
-
onSubmitSuccess: r,
|
|
61
|
-
onSubmitError: d
|
|
62
|
-
}) => {
|
|
63
|
-
const { collection: e } = U(), {
|
|
64
|
-
toastConfig: y,
|
|
65
|
-
onSuccess: V,
|
|
66
|
-
onError: v,
|
|
67
|
-
isLoggedIn: p,
|
|
68
|
-
isDisabled: u,
|
|
69
|
-
externalInitialValues: I = {}
|
|
70
|
-
} = j(), [k, _] = O({}), [f, L] = O(null), [J, R] = O(!1), [N, T] = O(!1), n = B({}), P = C(t), g = W({
|
|
71
|
-
mode: "all",
|
|
72
|
-
disabled: u,
|
|
73
|
-
defaultValues: P,
|
|
74
|
-
values: k,
|
|
75
|
-
resetOptions: {
|
|
76
|
-
keepErrors: !0
|
|
77
|
-
}
|
|
78
|
-
}), K = g.handleSubmit(async (c) => {
|
|
79
|
-
var b, S, a, o, $, D;
|
|
80
|
-
if (n.current = {
|
|
81
|
-
...n.current || {},
|
|
82
|
-
...c
|
|
83
|
-
}, s && e) {
|
|
84
|
-
if (t)
|
|
85
|
-
try {
|
|
86
|
-
const l = z(n == null ? void 0 : n.current, t);
|
|
87
|
-
let i = null;
|
|
88
|
-
if (f ? i = await (e == null ? void 0 : e.submitDraftEntry(t == null ? void 0 : t.key, l).catch((w) => (x(w), null))) : i = await (e == null ? void 0 : e.saveCollectionData({
|
|
89
|
-
collection_id: t == null ? void 0 : t.id,
|
|
90
|
-
data: l
|
|
91
|
-
}).catch((w) => (x(w), null))), (b = i == null ? void 0 : i.content) != null && b.data)
|
|
92
|
-
return y != null && y.showSuccessToast && X(
|
|
93
|
-
y.successToastText || "Form submitted successfully."
|
|
94
|
-
), n.current = Z(I) ? {} : { ...I }, M(t == null ? void 0 : t.key), L(null), V && V({
|
|
95
|
-
schemaId: t == null ? void 0 : t.id,
|
|
96
|
-
response: (S = i == null ? void 0 : i.content) == null ? void 0 : S.data
|
|
97
|
-
}), !0;
|
|
98
|
-
throw new Error("Failed to save form details, API response invalid");
|
|
99
|
-
} catch (l) {
|
|
100
|
-
const i = ($ = (o = (a = l == null ? void 0 : l.response) == null ? void 0 : a.data) == null ? void 0 : o.content) == null ? void 0 : $.errors;
|
|
101
|
-
return Q(i, g.setError), d && d(i), v && v(((D = l == null ? void 0 : l.response) == null ? void 0 : D.data) || l), !1;
|
|
102
|
-
}
|
|
103
|
-
return !1;
|
|
104
|
-
}
|
|
105
|
-
c && E && E(c);
|
|
106
|
-
}), Y = (c) => {
|
|
107
|
-
c && c !== f && L(c);
|
|
108
|
-
};
|
|
109
|
-
return F(() => {
|
|
110
|
-
if (t && e) {
|
|
111
|
-
const c = C(t);
|
|
112
|
-
if (n.current = {
|
|
113
|
-
...c,
|
|
114
|
-
...I || {},
|
|
115
|
-
...n.current || {}
|
|
116
|
-
}, !f && t != null && t.allow_draft) {
|
|
117
|
-
if (p) {
|
|
118
|
-
R(!0), e == null || e.getDraftEntry(t == null ? void 0 : t.key).then((S) => {
|
|
119
|
-
if (S === null) {
|
|
120
|
-
T(!0);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
T(!1);
|
|
124
|
-
const a = Array.isArray(S) ? S == null ? void 0 : S.filter((o) => (o == null ? void 0 : o._status) === "draft") : [];
|
|
125
|
-
if ((a == null ? void 0 : a.length) > 0) {
|
|
126
|
-
const o = (a == null ? void 0 : a[0]) || {};
|
|
127
|
-
o != null && o._id && (n.current = {
|
|
128
|
-
...n.current || {},
|
|
129
|
-
...o
|
|
130
|
-
}, L(o == null ? void 0 : o._id));
|
|
131
|
-
}
|
|
132
|
-
}).catch(() => null).finally(() => {
|
|
133
|
-
_({
|
|
134
|
-
...n == null ? void 0 : n.current
|
|
135
|
-
}), R(!1);
|
|
136
|
-
});
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const b = m(t == null ? void 0 : t.key);
|
|
140
|
-
b && (n.current = {
|
|
141
|
-
...b,
|
|
142
|
-
...n.current || {}
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
_({
|
|
146
|
-
...(n == null ? void 0 : n.current) || {}
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, [t]), F(() => {
|
|
150
|
-
t && f && M(t == null ? void 0 : t.key);
|
|
151
|
-
}, [f]), F(() => {
|
|
152
|
-
g.formState.isSubmitSuccessful && (r && r(), g.reset(), g.clearErrors());
|
|
153
|
-
}, [g.formState.isSubmitSuccessful]), {
|
|
154
|
-
methods: g,
|
|
155
|
-
isLoading: J,
|
|
156
|
-
isError: N,
|
|
157
|
-
contentId: f,
|
|
158
|
-
allFormValues: n.current,
|
|
159
|
-
handleContentId: Y,
|
|
160
|
-
handleSubmit: K
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
export {
|
|
164
|
-
ft as S,
|
|
165
|
-
ct as u
|
|
166
|
-
};
|