@wise/dynamic-flow-client-internal 2.8.8 → 2.8.9
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/build/main.js +210 -210
- package/build/main.min.js +1 -1
- package/package.json +20 -20
package/build/main.js
CHANGED
|
@@ -88,34 +88,34 @@ var require_main_min = __commonJS({
|
|
|
88
88
|
"use strict";
|
|
89
89
|
(function() {
|
|
90
90
|
"use strict";
|
|
91
|
-
var e = {}.hasOwnProperty
|
|
92
|
-
function
|
|
93
|
-
for (var
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
var i = typeof n;
|
|
97
|
-
if (i === "string" || i === "number")
|
|
98
|
-
a.push(n);
|
|
99
|
-
else if (Array.isArray(n)) {
|
|
100
|
-
if (n.length) {
|
|
101
|
-
var c = r.apply(null, n);
|
|
102
|
-
c && a.push(c);
|
|
103
|
-
}
|
|
104
|
-
} else if (i === "object") {
|
|
105
|
-
if (n.toString !== Object.prototype.toString && !n.toString.toString().includes("[native code]")) {
|
|
106
|
-
a.push(n.toString());
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
for (var l in n)
|
|
110
|
-
e.call(n, l) && n[l] && a.push(l);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
91
|
+
var e = {}.hasOwnProperty;
|
|
92
|
+
function t() {
|
|
93
|
+
for (var o = "", n = 0; n < arguments.length; n++) {
|
|
94
|
+
var i = arguments[n];
|
|
95
|
+
i && (o = a(o, r(i)));
|
|
113
96
|
}
|
|
114
|
-
return
|
|
97
|
+
return o;
|
|
98
|
+
}
|
|
99
|
+
function r(o) {
|
|
100
|
+
if (typeof o == "string" || typeof o == "number")
|
|
101
|
+
return o;
|
|
102
|
+
if (typeof o != "object")
|
|
103
|
+
return "";
|
|
104
|
+
if (Array.isArray(o))
|
|
105
|
+
return t.apply(null, o);
|
|
106
|
+
if (o.toString !== Object.prototype.toString && !o.toString.toString().includes("[native code]"))
|
|
107
|
+
return o.toString();
|
|
108
|
+
var n = "";
|
|
109
|
+
for (var i in o)
|
|
110
|
+
e.call(o, i) && o[i] && (n = a(n, i));
|
|
111
|
+
return n;
|
|
112
|
+
}
|
|
113
|
+
function a(o, n) {
|
|
114
|
+
return n ? o ? o + " " + n : o + n : o;
|
|
115
115
|
}
|
|
116
|
-
typeof Ur != "undefined" && Ur.exports ? (
|
|
117
|
-
return
|
|
118
|
-
}) : window.classNames =
|
|
116
|
+
typeof Ur != "undefined" && Ur.exports ? (t.default = t, Ur.exports = t) : typeof define == "function" && typeof define.amd == "object" && define.amd ? define("classnames", [], function() {
|
|
117
|
+
return t;
|
|
118
|
+
}) : window.classNames = t;
|
|
119
119
|
})();
|
|
120
120
|
});
|
|
121
121
|
var Fc = Aa((hr, jo) => {
|
|
@@ -141,8 +141,8 @@ var require_main_min = __commonJS({
|
|
|
141
141
|
var i = /* @__PURE__ */ Object.create(null);
|
|
142
142
|
if (a.r(i), Object.defineProperty(i, "default", { enumerable: true, value: o }), n & 2 && typeof o != "string")
|
|
143
143
|
for (var c in o)
|
|
144
|
-
a.d(i, c, function(
|
|
145
|
-
return o[
|
|
144
|
+
a.d(i, c, function(d) {
|
|
145
|
+
return o[d];
|
|
146
146
|
}.bind(null, c));
|
|
147
147
|
return i;
|
|
148
148
|
}, a.n = function(o) {
|
|
@@ -158,45 +158,45 @@ var require_main_min = __commonJS({
|
|
|
158
158
|
}({ "./src/react-webcam.tsx": function(t, r, a) {
|
|
159
159
|
"use strict";
|
|
160
160
|
a.r(r);
|
|
161
|
-
var o = a("react"), n = a.n(o), i = function() {
|
|
161
|
+
var o = a("react"), n = a.n(o), i = /* @__PURE__ */ function() {
|
|
162
162
|
var h = function(y, u) {
|
|
163
|
-
return h = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(
|
|
164
|
-
|
|
165
|
-
} || function(
|
|
163
|
+
return h = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(l, f) {
|
|
164
|
+
l.__proto__ = f;
|
|
165
|
+
} || function(l, f) {
|
|
166
166
|
for (var w in f)
|
|
167
|
-
f.hasOwnProperty(w) && (
|
|
167
|
+
f.hasOwnProperty(w) && (l[w] = f[w]);
|
|
168
168
|
}, h(y, u);
|
|
169
169
|
};
|
|
170
170
|
return function(y, u) {
|
|
171
171
|
h(y, u);
|
|
172
|
-
function
|
|
172
|
+
function l() {
|
|
173
173
|
this.constructor = y;
|
|
174
174
|
}
|
|
175
|
-
y.prototype = u === null ? Object.create(u) : (
|
|
175
|
+
y.prototype = u === null ? Object.create(u) : (l.prototype = u.prototype, new l());
|
|
176
176
|
};
|
|
177
177
|
}(), c = function() {
|
|
178
178
|
return c = Object.assign || function(h) {
|
|
179
|
-
for (var y, u = 1,
|
|
179
|
+
for (var y, u = 1, l = arguments.length; u < l; u++) {
|
|
180
180
|
y = arguments[u];
|
|
181
181
|
for (var f in y)
|
|
182
182
|
Object.prototype.hasOwnProperty.call(y, f) && (h[f] = y[f]);
|
|
183
183
|
}
|
|
184
184
|
return h;
|
|
185
185
|
}, c.apply(this, arguments);
|
|
186
|
-
},
|
|
186
|
+
}, d = function(h, y) {
|
|
187
187
|
var u = {};
|
|
188
|
-
for (var
|
|
189
|
-
Object.prototype.hasOwnProperty.call(h,
|
|
188
|
+
for (var l in h)
|
|
189
|
+
Object.prototype.hasOwnProperty.call(h, l) && y.indexOf(l) < 0 && (u[l] = h[l]);
|
|
190
190
|
if (h != null && typeof Object.getOwnPropertySymbols == "function")
|
|
191
|
-
for (var f = 0,
|
|
192
|
-
y.indexOf(
|
|
191
|
+
for (var f = 0, l = Object.getOwnPropertySymbols(h); f < l.length; f++)
|
|
192
|
+
y.indexOf(l[f]) < 0 && Object.prototype.propertyIsEnumerable.call(h, l[f]) && (u[l[f]] = h[l[f]]);
|
|
193
193
|
return u;
|
|
194
194
|
};
|
|
195
195
|
(function() {
|
|
196
196
|
typeof window != "undefined" && (navigator.mediaDevices === void 0 && (navigator.mediaDevices = {}), navigator.mediaDevices.getUserMedia === void 0 && (navigator.mediaDevices.getUserMedia = function(y) {
|
|
197
197
|
var u = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
|
|
198
|
-
return u ? new Promise(function(
|
|
199
|
-
u.call(navigator, y,
|
|
198
|
+
return u ? new Promise(function(l, f) {
|
|
199
|
+
u.call(navigator, y, l, f);
|
|
200
200
|
}) : Promise.reject(new Error("getUserMedia is not implemented in this browser"));
|
|
201
201
|
}));
|
|
202
202
|
})();
|
|
@@ -206,43 +206,43 @@ var require_main_min = __commonJS({
|
|
|
206
206
|
var p = function(h) {
|
|
207
207
|
i(y, h);
|
|
208
208
|
function y(u) {
|
|
209
|
-
var
|
|
210
|
-
return
|
|
209
|
+
var l = h.call(this, u) || this;
|
|
210
|
+
return l.canvas = null, l.ctx = null, l.requestUserMediaId = 0, l.unmounted = false, l.state = { hasUserMedia: false }, l;
|
|
211
211
|
}
|
|
212
212
|
return y.prototype.componentDidMount = function() {
|
|
213
|
-
var u = this,
|
|
213
|
+
var u = this, l = u.state, f = u.props;
|
|
214
214
|
if (this.unmounted = false, !m()) {
|
|
215
215
|
f.onUserMediaError("getUserMedia not supported");
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
|
|
218
|
+
l.hasUserMedia || this.requestUserMedia(), f.children && typeof f.children != "function" && console.warn("children must be a function");
|
|
219
219
|
}, y.prototype.componentDidUpdate = function(u) {
|
|
220
|
-
var
|
|
220
|
+
var l = this.props;
|
|
221
221
|
if (!m()) {
|
|
222
|
-
|
|
222
|
+
l.onUserMediaError("getUserMedia not supported");
|
|
223
223
|
return;
|
|
224
224
|
}
|
|
225
|
-
var f = JSON.stringify(u.audioConstraints) !== JSON.stringify(
|
|
225
|
+
var f = JSON.stringify(u.audioConstraints) !== JSON.stringify(l.audioConstraints), w = JSON.stringify(u.videoConstraints) !== JSON.stringify(l.videoConstraints), S = u.minScreenshotWidth !== l.minScreenshotWidth, F = u.minScreenshotHeight !== l.minScreenshotHeight;
|
|
226
226
|
(w || S || F) && (this.canvas = null, this.ctx = null), (f || w) && (this.stopAndCleanup(), this.requestUserMedia());
|
|
227
227
|
}, y.prototype.componentWillUnmount = function() {
|
|
228
228
|
this.unmounted = true, this.stopAndCleanup();
|
|
229
229
|
}, y.stopMediaStream = function(u) {
|
|
230
|
-
u && (u.getVideoTracks && u.getAudioTracks ? (u.getVideoTracks().map(function(
|
|
231
|
-
u.removeTrack(
|
|
232
|
-
}), u.getAudioTracks().map(function(
|
|
233
|
-
u.removeTrack(
|
|
230
|
+
u && (u.getVideoTracks && u.getAudioTracks ? (u.getVideoTracks().map(function(l) {
|
|
231
|
+
u.removeTrack(l), l.stop();
|
|
232
|
+
}), u.getAudioTracks().map(function(l) {
|
|
233
|
+
u.removeTrack(l), l.stop();
|
|
234
234
|
})) : u.stop());
|
|
235
235
|
}, y.prototype.stopAndCleanup = function() {
|
|
236
236
|
var u = this.state;
|
|
237
237
|
u.hasUserMedia && (y.stopMediaStream(this.stream), u.src && window.URL.revokeObjectURL(u.src));
|
|
238
238
|
}, y.prototype.getScreenshot = function(u) {
|
|
239
|
-
var
|
|
239
|
+
var l = this, f = l.state, w = l.props;
|
|
240
240
|
if (!f.hasUserMedia)
|
|
241
241
|
return null;
|
|
242
242
|
var S = this.getCanvas(u);
|
|
243
243
|
return S && S.toDataURL(w.screenshotFormat, w.screenshotQuality);
|
|
244
244
|
}, y.prototype.getCanvas = function(u) {
|
|
245
|
-
var
|
|
245
|
+
var l = this, f = l.state, w = l.props;
|
|
246
246
|
if (!this.video || !f.hasUserMedia || !this.video.videoHeight)
|
|
247
247
|
return null;
|
|
248
248
|
if (!this.ctx) {
|
|
@@ -256,9 +256,9 @@ var require_main_min = __commonJS({
|
|
|
256
256
|
var v = this, O = v.ctx, x = v.canvas;
|
|
257
257
|
return O && x && (x.width = (u == null ? void 0 : u.width) || x.width, x.height = (u == null ? void 0 : u.height) || x.height, w.mirrored && (O.translate(x.width, 0), O.scale(-1, 1)), O.imageSmoothingEnabled = w.imageSmoothing, O.drawImage(this.video, 0, 0, (u == null ? void 0 : u.width) || x.width, (u == null ? void 0 : u.height) || x.height), w.mirrored && (O.scale(-1, 1), O.translate(-x.width, 0))), x;
|
|
258
258
|
}, y.prototype.requestUserMedia = function() {
|
|
259
|
-
var u = this,
|
|
259
|
+
var u = this, l = this.props, f = function(F, g) {
|
|
260
260
|
var v = { video: typeof g != "undefined" ? g : true };
|
|
261
|
-
|
|
261
|
+
l.audio && (v.audio = typeof F != "undefined" ? F : true), u.requestUserMediaId++;
|
|
262
262
|
var O = u.requestUserMediaId;
|
|
263
263
|
navigator.mediaDevices.getUserMedia(v).then(function(x) {
|
|
264
264
|
u.unmounted || O !== u.requestUserMediaId ? y.stopMediaStream(x) : u.handleUserMedia(null, x);
|
|
@@ -267,7 +267,7 @@ var require_main_min = __commonJS({
|
|
|
267
267
|
});
|
|
268
268
|
};
|
|
269
269
|
if ("mediaDevices" in navigator)
|
|
270
|
-
f(
|
|
270
|
+
f(l.audioConstraints, l.videoConstraints);
|
|
271
271
|
else {
|
|
272
272
|
var w = function(F) {
|
|
273
273
|
return { optional: [{ sourceId: F }] };
|
|
@@ -280,27 +280,27 @@ var require_main_min = __commonJS({
|
|
|
280
280
|
F.forEach(function(M) {
|
|
281
281
|
M.kind === "audio" ? g = M.id : M.kind === "video" && (v = M.id);
|
|
282
282
|
});
|
|
283
|
-
var O = S(
|
|
283
|
+
var O = S(l.audioConstraints);
|
|
284
284
|
O && (g = O);
|
|
285
|
-
var x = S(
|
|
285
|
+
var x = S(l.videoConstraints);
|
|
286
286
|
x && (v = x), f(w(g), w(v));
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
|
-
}, y.prototype.handleUserMedia = function(u,
|
|
289
|
+
}, y.prototype.handleUserMedia = function(u, l) {
|
|
290
290
|
var f = this.props;
|
|
291
|
-
if (u || !
|
|
291
|
+
if (u || !l) {
|
|
292
292
|
this.setState({ hasUserMedia: false }), f.onUserMediaError(u);
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
|
-
this.stream =
|
|
295
|
+
this.stream = l;
|
|
296
296
|
try {
|
|
297
|
-
this.video && (this.video.srcObject =
|
|
297
|
+
this.video && (this.video.srcObject = l), this.setState({ hasUserMedia: true });
|
|
298
298
|
} catch (w) {
|
|
299
|
-
this.setState({ hasUserMedia: true, src: window.URL.createObjectURL(
|
|
299
|
+
this.setState({ hasUserMedia: true, src: window.URL.createObjectURL(l) });
|
|
300
300
|
}
|
|
301
|
-
f.onUserMedia(
|
|
301
|
+
f.onUserMedia(l);
|
|
302
302
|
}, y.prototype.render = function() {
|
|
303
|
-
var u = this,
|
|
303
|
+
var u = this, l = this, f = l.state, w = l.props, S = w.audio, F = w.forceScreenshotSourceSize, g = w.disablePictureInPicture, v = w.onUserMedia, O = w.onUserMediaError, x = w.screenshotFormat, M = w.screenshotQuality, E = w.minScreenshotWidth, P = w.minScreenshotHeight, D = w.audioConstraints, U = w.videoConstraints, ee = w.imageSmoothing, A = w.mirrored, B = w.style, k = B === void 0 ? {} : B, ie = w.children, W = d(w, ["audio", "forceScreenshotSourceSize", "disablePictureInPicture", "onUserMedia", "onUserMediaError", "screenshotFormat", "screenshotQuality", "minScreenshotWidth", "minScreenshotHeight", "audioConstraints", "videoConstraints", "imageSmoothing", "mirrored", "style", "children"]), X = A ? c(c({}, k), { transform: (k.transform || "") + " scaleX(-1)" }) : k, ke = { getScreenshot: this.getScreenshot.bind(this) };
|
|
304
304
|
return o.createElement(o.Fragment, null, o.createElement("video", c({ autoPlay: true, disablePictureInPicture: g, src: f.src, muted: !S, playsInline: true, ref: function(nt) {
|
|
305
305
|
u.video = nt;
|
|
306
306
|
}, style: X }, W)), ie && ie(ke));
|
|
@@ -319,7 +319,7 @@ var require_main_min = __commonJS({
|
|
|
319
319
|
(function() {
|
|
320
320
|
"use strict";
|
|
321
321
|
var e = typeof window != "undefined" && typeof window.document != "undefined" ? window.document : {}, t = typeof wr != "undefined" && wr.exports, r = function() {
|
|
322
|
-
for (var n, i = [["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]], c = 0,
|
|
322
|
+
for (var n, i = [["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"], ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror"], ["webkitRequestFullScreen", "webkitCancelFullScreen", "webkitCurrentFullScreenElement", "webkitCancelFullScreen", "webkitfullscreenchange", "webkitfullscreenerror"], ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror"], ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]], c = 0, d = i.length, m = {}; c < d; c++)
|
|
323
323
|
if (n = i[c], n && n[1] in e) {
|
|
324
324
|
for (c = 0; c < n.length; c++)
|
|
325
325
|
m[i[0][c]] = n[c];
|
|
@@ -327,13 +327,13 @@ var require_main_min = __commonJS({
|
|
|
327
327
|
}
|
|
328
328
|
return false;
|
|
329
329
|
}(), a = { change: r.fullscreenchange, error: r.fullscreenerror }, o = { request: function(n, i) {
|
|
330
|
-
return new Promise(function(c,
|
|
330
|
+
return new Promise(function(c, d) {
|
|
331
331
|
var m = function() {
|
|
332
332
|
this.off("change", m), c();
|
|
333
333
|
}.bind(this);
|
|
334
334
|
this.on("change", m), n = n || e.documentElement;
|
|
335
335
|
var p = n[r.requestFullscreen](i);
|
|
336
|
-
p instanceof Promise && p.then(m).catch(
|
|
336
|
+
p instanceof Promise && p.then(m).catch(d);
|
|
337
337
|
}.bind(this));
|
|
338
338
|
}, exit: function() {
|
|
339
339
|
return new Promise(function(n, i) {
|
|
@@ -345,8 +345,8 @@ var require_main_min = __commonJS({
|
|
|
345
345
|
this.off("change", c), n();
|
|
346
346
|
}.bind(this);
|
|
347
347
|
this.on("change", c);
|
|
348
|
-
var
|
|
349
|
-
|
|
348
|
+
var d = e[r.exitFullscreen]();
|
|
349
|
+
d instanceof Promise && d.then(c).catch(i);
|
|
350
350
|
}.bind(this));
|
|
351
351
|
}, toggle: function(n, i) {
|
|
352
352
|
return this.isFullscreen ? this.exit() : this.request(n, i);
|
|
@@ -1027,15 +1027,15 @@ var require_main_min = __commonJS({
|
|
|
1027
1027
|
throw new Error(n.message === "failed" ? "failed" : "network failed");
|
|
1028
1028
|
});
|
|
1029
1029
|
}, [e, r]), o = (0, or.useCallback)((n) => {
|
|
1030
|
-
let c = ((e == null ? void 0 : e.responseHandlers) || []).find((
|
|
1030
|
+
let c = ((e == null ? void 0 : e.responseHandlers) || []).find((d) => d.result === n.result);
|
|
1031
1031
|
if (c != null && c.action) {
|
|
1032
|
-
let { action:
|
|
1033
|
-
if (
|
|
1034
|
-
let m = s(s({},
|
|
1035
|
-
t(C(s({},
|
|
1032
|
+
let { action: d } = c;
|
|
1033
|
+
if (d.exit) {
|
|
1034
|
+
let m = s(s({}, d.result || {}), n.data || {});
|
|
1035
|
+
t(C(s({}, d), { result: m }));
|
|
1036
1036
|
} else {
|
|
1037
|
-
let m = s(s({},
|
|
1038
|
-
t(C(s({},
|
|
1037
|
+
let m = s(s({}, d.data || {}), n.data || {});
|
|
1038
|
+
t(C(s({}, d), { data: m }));
|
|
1039
1039
|
}
|
|
1040
1040
|
return false;
|
|
1041
1041
|
}
|
|
@@ -1208,9 +1208,9 @@ var require_main_min = __commonJS({
|
|
|
1208
1208
|
};
|
|
1209
1209
|
var Ci = require("react/jsx-runtime");
|
|
1210
1210
|
var od = (e) => {
|
|
1211
|
-
var
|
|
1211
|
+
var d;
|
|
1212
1212
|
let { component: t, onAction: r } = e, a = t.action, o = hi(t), n = fi(t), { loading: i } = At(), c = V(t.margin || "md");
|
|
1213
|
-
return (0, Ci.jsx)(wi.Button, { size: gi(t.size), type: n === "tertiary" ? void 0 : o, priority: n, block: true, className: c, disabled: t.disabled || a.disabled || i, onClick: () => r(a), children: (
|
|
1213
|
+
return (0, Ci.jsx)(wi.Button, { size: gi(t.size), type: n === "tertiary" ? void 0 : o, priority: n, block: true, className: c, disabled: t.disabled || a.disabled || i, onClick: () => r(a), children: (d = t.title) != null ? d : a.title });
|
|
1214
1214
|
};
|
|
1215
1215
|
var Ka = od;
|
|
1216
1216
|
var yt = require("react/jsx-runtime");
|
|
@@ -1247,8 +1247,8 @@ var require_main_min = __commonJS({
|
|
|
1247
1247
|
(0, Wr.useEffect)(() => {
|
|
1248
1248
|
c();
|
|
1249
1249
|
}, [c]);
|
|
1250
|
-
let
|
|
1251
|
-
return ti(
|
|
1250
|
+
let d = o && a ? C(s({}, o), { responseHandlers: a }) : void 0;
|
|
1251
|
+
return ti(d, t), (0, Ze.jsxs)(Ze.Fragment, { children: [(0, Ze.jsx)(Rt.Loader, { size: Rt.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }), (0, Ze.jsx)("br", {}), (0, Ze.jsx)(Rt.Button, { priority: "tertiary", block: true, onClick: c, children: n || i.formatMessage(bi.retryTitle) })] });
|
|
1252
1252
|
};
|
|
1253
1253
|
var Za = md;
|
|
1254
1254
|
var qs = require("react");
|
|
@@ -1280,7 +1280,7 @@ var require_main_min = __commonJS({
|
|
|
1280
1280
|
function Ei(e) {
|
|
1281
1281
|
var c;
|
|
1282
1282
|
let t = pd(e.schema), r = s(s(s({}, t), e.validationMessages), e.schema.validationMessages), a = (e.submitted || !e.changed) && !!e.errors, o = !a && (e.submitted || e.changed && e.blurred) && !!((c = e.validations) != null && c.length), n = e.schema.description && !a && !o, i = !!e.infoMessage;
|
|
1283
|
-
return (0, Ue.jsxs)("div", { id: e.id, children: [a ? (0, Ue.jsx)($r.InlineAlert, { type: "error", children: e.errors }) : null, o ? (0, Ue.jsx)($r.InlineAlert, { type: "error", children: e.validations.map((
|
|
1283
|
+
return (0, Ue.jsxs)("div", { id: e.id, children: [a ? (0, Ue.jsx)($r.InlineAlert, { type: "error", children: e.errors }) : null, o ? (0, Ue.jsx)($r.InlineAlert, { type: "error", children: e.validations.map((d) => (0, Ue.jsx)("div", { children: r[d] }, d)) }) : null, (n || i) && (0, Ue.jsxs)($r.InlineAlert, { type: "info", children: [n && (0, Ue.jsx)("div", { children: e.schema.description }), i && (0, Ue.jsx)("div", { children: e.infoMessage })] })] });
|
|
1284
1284
|
}
|
|
1285
1285
|
Ei.defaultProps = { errors: "", validations: [], validationMessages: {}, validationAsyncSuccessMessage: null };
|
|
1286
1286
|
function pd(e) {
|
|
@@ -1325,7 +1325,7 @@ var require_main_min = __commonJS({
|
|
|
1325
1325
|
var ft = require("react/jsx-runtime");
|
|
1326
1326
|
function Hi(e) {
|
|
1327
1327
|
var M, E;
|
|
1328
|
-
let { onChange: t, schema: r } = e, a = re(), o = ji(r), n = (0, sr.useMemo)(() => r.$id || Te(), [r.$id]), [i, c] = (0, sr.useState)(false), [
|
|
1328
|
+
let { onChange: t, schema: r } = e, a = re(), o = ji(r), n = (0, sr.useMemo)(() => r.$id || Te(), [r.$id]), [i, c] = (0, sr.useState)(false), [d, m] = (0, sr.useState)(() => yd(e.model || [])), p = qi(r.items.persistAsync), h = r.items.persistAsync.schema, y = Dt(h), u = async (P) => {
|
|
1329
1329
|
c(true);
|
|
1330
1330
|
try {
|
|
1331
1331
|
let D = await Ii(P, y);
|
|
@@ -1336,14 +1336,14 @@ var require_main_min = __commonJS({
|
|
|
1336
1336
|
return a("Dynamic Flow - PersistAsync", { status: "failure", schemaId: r.$id }), Promise.reject(Li(D));
|
|
1337
1337
|
}
|
|
1338
1338
|
};
|
|
1339
|
-
function
|
|
1340
|
-
if ($n(P,
|
|
1339
|
+
function l(P) {
|
|
1340
|
+
if ($n(P, d))
|
|
1341
1341
|
return;
|
|
1342
1342
|
m(P);
|
|
1343
1343
|
let U = Vi(P).map((ee) => ee.id);
|
|
1344
1344
|
t({ model: U, triggerSchema: r, triggerModel: U });
|
|
1345
1345
|
}
|
|
1346
|
-
let w = Vi(
|
|
1346
|
+
let w = Vi(d).map((P) => P.id), S = It(w, r, e.required), F = !!e.errors || (i || e.submitted) && !!S.length, g = "accepts" in h && h.accepts, v = "maxSize" in h && h.maxSize, O = C(s(s({ multiple: true, className: "form-control", files: d, fileInputName: n, id: n }, g ? { fileTypes: g } : void 0), v ? { sizeLimit: Nr(v) } : void 0), { sizeLimitErrorMessage: ((M = h.validationMessages) == null ? void 0 : M.maxSize) || o.maxFileSizeErrorMessage, maxFiles: e.schema.maxItems, maxFilesErrorMessage: ((E = e.schema.validationMessages) == null ? void 0 : E.maxItems) || o.maxItemsErrorMessage, uploadButtonTitle: h.title, description: h.description, disabled: e.disabled, onUploadFile: (P) => u(P.get(n)), onFilesChange: l, onDeleteFile: () => Promise.resolve() }), x = `${n}-feedback`;
|
|
1347
1347
|
return (0, ft.jsxs)("div", { className: (0, Ui.default)("form-group", { "has-error": F }), children: [(0, ft.jsx)("label", { className: "d-block control-label", htmlFor: n, children: e.schema.title }), (0, ft.jsx)("div", { "aria-describedby": x, children: (0, ft.jsx)(_r.UploadInput, s({}, O)) }), (0, ft.jsx)(He, { id: x, changed: i, submitted: e.submitted, errors: e.errors, schema: e.schema, validations: S, validationMessages: hd(r, !!e.required, o), infoMessage: null, focused: false, blurred: true })] });
|
|
1348
1348
|
}
|
|
1349
1349
|
Hi.defaultProps = { errors: null, required: false };
|
|
@@ -1373,8 +1373,8 @@ var require_main_min = __commonJS({
|
|
|
1373
1373
|
var Ki = require("react-intl");
|
|
1374
1374
|
var Xi = require("react/jsx-runtime");
|
|
1375
1375
|
function gd({ type: e, schema: t, model: r, errors: a, submitted: o, onModelChange: n, onAction: i }) {
|
|
1376
|
-
let { formatMessage: c } = (0, Ki.useIntl)(),
|
|
1377
|
-
return (0, Xi.jsx)(Kr, { step:
|
|
1376
|
+
let { formatMessage: c } = (0, Ki.useIntl)(), d = { layout: [{ type: "form", schema: t.items }, { type: "button", control: "primary", action: { url: e, title: c(e === "add" ? ht.addItem : ht.editItem) } }, ...e === "edit" ? [{ type: "button", context: "negative", action: { url: "remove", title: c(ht.removeItem) } }] : []], title: "", actions: [], schemas: [] };
|
|
1377
|
+
return (0, Xi.jsx)(Kr, { step: d, model: r, stepLayoutOptions: { displayStepTitle: false }, submitted: o, formErrors: a, globalError: null, onAction: (m) => {
|
|
1378
1378
|
i(m.url);
|
|
1379
1379
|
}, onModelChange: n });
|
|
1380
1380
|
}
|
|
@@ -1406,14 +1406,14 @@ var require_main_min = __commonJS({
|
|
|
1406
1406
|
return e.properties !== null && typeof e.properties == "object" ? Object.entries(e.properties) : [];
|
|
1407
1407
|
}
|
|
1408
1408
|
var ro = (e, t, r = {}) => {
|
|
1409
|
-
let { defaultTitle: a = "", defaultDescription: o = "", defaultIcon: n, defaultImage: i } = r, c = Qe({ schema: e, model: t, providesProp: "providesTitle", getValueFromSchema: Yi }),
|
|
1409
|
+
let { defaultTitle: a = "", defaultDescription: o = "", defaultIcon: n, defaultImage: i } = r, c = Qe({ schema: e, model: t, providesProp: "providesTitle", getValueFromSchema: Yi }), d = Qe({ schema: e, model: t, providesProp: "providesDescription", getValueFromSchema: Yi }), m = Qe({ schema: e, model: t, providesProp: "providesIcon", getValueFromSchema: (h) => {
|
|
1410
1410
|
var y;
|
|
1411
1411
|
return (y = h.icon) != null ? y : null;
|
|
1412
1412
|
} }), p = Qe({ schema: e, model: t, providesProp: "providesImage", getValueFromSchema: (h) => {
|
|
1413
1413
|
var y;
|
|
1414
1414
|
return (y = h.image) != null ? y : null;
|
|
1415
1415
|
} });
|
|
1416
|
-
return { value: t, title: c || a, description:
|
|
1416
|
+
return { value: t, title: c || a, description: d || o, icon: m || n, image: p || i };
|
|
1417
1417
|
};
|
|
1418
1418
|
var Qe = (e) => {
|
|
1419
1419
|
let { schema: t, model: r, providesProp: a, getValueFromSchema: o } = e;
|
|
@@ -1466,7 +1466,7 @@ var require_main_min = __commonJS({
|
|
|
1466
1466
|
var bd = (e, t) => !!e && Object.hasOwnProperty.call(e, t) && !!e[t];
|
|
1467
1467
|
var Fe = require("react/jsx-runtime");
|
|
1468
1468
|
var xd = ({ schema: e, model: t, errors: r, submitted: a, onChange: o }) => {
|
|
1469
|
-
let [n, i] = (0, Xr.useState)(null), [c,
|
|
1469
|
+
let [n, i] = (0, Xr.useState)(null), [c, d] = (0, Xr.useState)(() => {
|
|
1470
1470
|
if (R(t) && !j(t))
|
|
1471
1471
|
throw new Error("RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema.");
|
|
1472
1472
|
return t ? t.map((S) => ro(e.items, S, e == null ? void 0 : e.summary)) : null;
|
|
@@ -1477,17 +1477,17 @@ var require_main_min = __commonJS({
|
|
|
1477
1477
|
i("add");
|
|
1478
1478
|
}, u = (S) => {
|
|
1479
1479
|
p({ item: S, model: S.value }), i("edit");
|
|
1480
|
-
},
|
|
1480
|
+
}, l = (S) => {
|
|
1481
1481
|
var v;
|
|
1482
1482
|
let F = S === "remove" ? null : ro(e.items, m.model, e == null ? void 0 : e.summary);
|
|
1483
1483
|
if (S !== "remove" && !G((v = F == null ? void 0 : F.value) != null ? v : null, e.items))
|
|
1484
1484
|
return;
|
|
1485
1485
|
let g = vd(S, { originalItem: m.item, updatedItem: F, itemSummaries: c });
|
|
1486
|
-
|
|
1486
|
+
d(g), h(g), p({ item: null, model: null }), i(null);
|
|
1487
1487
|
}, f = () => {
|
|
1488
1488
|
p({ item: null, model: null }), i(null);
|
|
1489
1489
|
}, { formatMessage: w } = (0, Qi.useIntl)();
|
|
1490
|
-
return (0, Fe.jsxs)(Fe.Fragment, { children: [e.title && (0, Fe.jsx)(Bt.Header, { title: e.title }), c && c.map((S) => (0, Fe.jsx)(Wi, { item: S, onClick: () => u(S) }, JSON.stringify(S))), (0, Fe.jsx)(Bt.NavigationOption, { onClick: y, media: (0, Fe.jsx)(Zi.Plus, {}), title: e.addItemTitle || w(ht.addItemTitle), showMediaAtAllSizes: true }), (0, Fe.jsx)(Bt.Modal, { open: n !== null, onClose: f, title: (n === "add" ? e.addItemTitle : e.editItemTitle) || w(ht.addItemTitle), body: (0, Fe.jsx)(Ji, { type: n != null ? n : "add", schema: e, model: m.model, errors: r, submitted: a, onAction:
|
|
1490
|
+
return (0, Fe.jsxs)(Fe.Fragment, { children: [e.title && (0, Fe.jsx)(Bt.Header, { title: e.title }), c && c.map((S) => (0, Fe.jsx)(Wi, { item: S, onClick: () => u(S) }, JSON.stringify(S))), (0, Fe.jsx)(Bt.NavigationOption, { onClick: y, media: (0, Fe.jsx)(Zi.Plus, {}), title: e.addItemTitle || w(ht.addItemTitle), showMediaAtAllSizes: true }), (0, Fe.jsx)(Bt.Modal, { open: n !== null, onClose: f, title: (n === "add" ? e.addItemTitle : e.editItemTitle) || w(ht.addItemTitle), body: (0, Fe.jsx)(Ji, { type: n != null ? n : "add", schema: e, model: m.model, errors: r, submitted: a, onAction: l, onModelChange: ({ model: S }) => p(C(s({}, m), { model: S })) }) })] });
|
|
1491
1491
|
};
|
|
1492
1492
|
var vd = (e, { originalItem: t, updatedItem: r, itemSummaries: a }) => {
|
|
1493
1493
|
if (e === "remove")
|
|
@@ -1536,8 +1536,8 @@ var require_main_min = __commonJS({
|
|
|
1536
1536
|
let m = ce(t, e.schema) || {};
|
|
1537
1537
|
r(m), Je(m, t) || e.onChange({ model: m, triggerSchema: e.schema, triggerModel: m });
|
|
1538
1538
|
}, [e.schema]);
|
|
1539
|
-
let n = /* @__PURE__ */ new Set([...e.schema.displayOrder || [], ...Object.keys(e.schema.properties)]), i = (m) => typeof e.schema.properties[m] != "undefined", c = Array.from(n).filter(i),
|
|
1540
|
-
return (0, fe.jsxs)(fe.Fragment, { children: [e.schema.alert && (0, fe.jsx)(se, { component: e.schema.alert }), (0, fe.jsxs)("fieldset", { children: [e.schema.title && !e.hideTitle && (0, fe.jsxs)("legend", { children: [" ", e.schema.title, " "] }), e.schema.description && !e.hideTitle && (0, fe.jsxs)("p", { children: [" ", e.schema.description, " "] }), (0, fe.jsx)("div", { className: "row", children: c.map((m) => (0, fe.jsx)("div", { className: (0, ns.default)(Ad(e.schema.properties[m].width)), children: (0, fe.jsx)(me, { schema: e.schema.properties[m], model: e.model && e.model[m], errors:
|
|
1539
|
+
let n = /* @__PURE__ */ new Set([...e.schema.displayOrder || [], ...Object.keys(e.schema.properties)]), i = (m) => typeof e.schema.properties[m] != "undefined", c = Array.from(n).filter(i), d = e.errors;
|
|
1540
|
+
return (0, fe.jsxs)(fe.Fragment, { children: [e.schema.alert && (0, fe.jsx)(se, { component: e.schema.alert }), (0, fe.jsxs)("fieldset", { children: [e.schema.title && !e.hideTitle && (0, fe.jsxs)("legend", { children: [" ", e.schema.title, " "] }), e.schema.description && !e.hideTitle && (0, fe.jsxs)("p", { children: [" ", e.schema.description, " "] }), (0, fe.jsx)("div", { className: "row", children: c.map((m) => (0, fe.jsx)("div", { className: (0, ns.default)(Ad(e.schema.properties[m].width)), children: (0, fe.jsx)(me, { schema: e.schema.properties[m], model: e.model && e.model[m], errors: d == null ? void 0 : d[m], submitted: e.submitted, required: o(m), disabled: e.disabled, onChange: (p) => a(m, p), onPersistAsync: e.onPersistAsync }) }, m)) })] })] });
|
|
1541
1541
|
}
|
|
1542
1542
|
is.defaultProps = { hideTitle: false, disabled: false };
|
|
1543
1543
|
var mr = is;
|
|
@@ -1671,15 +1671,15 @@ var require_main_min = __commonJS({
|
|
|
1671
1671
|
}
|
|
1672
1672
|
render() {
|
|
1673
1673
|
var ee;
|
|
1674
|
-
let { name: r, placeholder: a, step: o, countryCode: n, type: i, options: c, disabled:
|
|
1674
|
+
let { name: r, placeholder: a, step: o, countryCode: n, type: i, options: c, disabled: d, readOnly: m, required: p, minLength: h, maxLength: y, min: u, max: l, searchPlaceholder: f, searchValue: w, onSearchChange: S, size: F, uploadProps: g, label: v, monthFormat: O, id: x, minDate: M, maxDate: E, value: P, mode: D, describedBy: U } = this.props;
|
|
1675
1675
|
switch (i) {
|
|
1676
1676
|
case N.RADIO:
|
|
1677
1677
|
return (0, Z.jsx)(_.RadioGroup, { radios: c.map(this.mapOption), name: r, selectedValue: io(P, { coerceValue: true }), onChange: this.handleOnChange });
|
|
1678
1678
|
case N.CHECKBOX:
|
|
1679
|
-
return (0, Z.jsx)(_.Checkbox, { checked: ls(P, { coerceValue: true }), disabled:
|
|
1679
|
+
return (0, Z.jsx)(_.Checkbox, { checked: ls(P, { coerceValue: true }), disabled: d, label: v, required: p, readOnly: m, onChange: this.handleOnChange, onBlur: this.handleOnBlur, onFocus: this.handleOnFocus });
|
|
1680
1680
|
case N.SELECT: {
|
|
1681
1681
|
let A = c.length >= 20;
|
|
1682
|
-
return (0, Z.jsx)(_.Select, { id: x, selected: this.getSelectedOption(c), options: c, search: A, required: p, disabled:
|
|
1682
|
+
return (0, Z.jsx)(_.Select, { id: x, selected: this.getSelectedOption(c), options: c, search: A, required: p, disabled: d, placeholder: a, searchPlaceholder: f, searchValue: w, onChange: (B) => {
|
|
1683
1683
|
var k;
|
|
1684
1684
|
this.setState({ selectedOption: B != null ? B : void 0 }), this.props.onChange((k = B == null ? void 0 : B.value) != null ? k : null);
|
|
1685
1685
|
}, onFocus: this.handleOnFocus, onBlur: this.handleOnBlur, onSearchChange: A ? S : void 0 });
|
|
@@ -1691,7 +1691,7 @@ var require_main_min = __commonJS({
|
|
|
1691
1691
|
} });
|
|
1692
1692
|
case N.NUMERIC:
|
|
1693
1693
|
case N.NUMBER:
|
|
1694
|
-
return (0, Z.jsx)("input", { autoComplete: this.getAutocompleteValue(), className: "form-control", disabled:
|
|
1694
|
+
return (0, Z.jsx)("input", { autoComplete: this.getAutocompleteValue(), className: "form-control", disabled: d, id: x, max: l, min: u, placeholder: a, readOnly: m, required: p, step: o, type: "number", value: io(P, { coerceValue: true }), onBlur: this.handleOnBlur, onChange: (A) => {
|
|
1695
1695
|
i === N.NUMERIC ? this.props.onChange(A.target.value) : this.props.onChange(parseFloat(A.target.value));
|
|
1696
1696
|
}, onFocus: this.handleOnFocus, onWheel: (A) => {
|
|
1697
1697
|
A.target instanceof HTMLElement && A.target.blur();
|
|
@@ -1699,23 +1699,23 @@ var require_main_min = __commonJS({
|
|
|
1699
1699
|
case N.HIDDEN:
|
|
1700
1700
|
return (0, Z.jsx)("input", { type: "hidden", name: r, value: zt(P, { coerceValue: true }), id: x });
|
|
1701
1701
|
case N.PASSWORD:
|
|
1702
|
-
return (0, Z.jsx)("input", { autoComplete: this.getAutocompleteValue(), className: "form-control", disabled:
|
|
1702
|
+
return (0, Z.jsx)("input", { autoComplete: this.getAutocompleteValue(), className: "form-control", disabled: d, id: x, placeholder: a, readOnly: m, required: p, type: "password", value: zt(P, { coerceValue: true }), onBlur: this.handleOnBlur, onChange: this.handleInputOnChange, onFocus: this.handleOnFocus, "aria-describedby": U });
|
|
1703
1703
|
case N.DATE:
|
|
1704
1704
|
case N.DATETIME:
|
|
1705
|
-
return (0, Z.jsx)(_.DateInput, { disabled:
|
|
1705
|
+
return (0, Z.jsx)(_.DateInput, { disabled: d, size: F, value: ds(P), mode: D, monthFormat: O, onBlur: this.handleOnBlur, onChange: this.handleOnChange, onFocus: this.handleOnFocus });
|
|
1706
1706
|
case N.DATELOOKUP:
|
|
1707
|
-
return (0, Z.jsx)(_.DateLookup, { value: us(P), min: M, max: E, placeholder: a, monthFormat: O, disabled:
|
|
1707
|
+
return (0, Z.jsx)(_.DateLookup, { value: us(P), min: M, max: E, placeholder: a, monthFormat: O, disabled: d, onChange: (A) => {
|
|
1708
1708
|
this.handleOnChange(qn(A));
|
|
1709
1709
|
}, onBlur: this.handleOnBlur, onFocus: this.handleOnFocus });
|
|
1710
1710
|
case N.TEL:
|
|
1711
|
-
return (0, Z.jsx)(_.PhoneNumberInput, { disabled:
|
|
1711
|
+
return (0, Z.jsx)(_.PhoneNumberInput, { disabled: d, countryCode: n, placeholder: a, required: p, searchPlaceholder: f, size: F, initialValue: zt(P), onBlur: this.handleOnBlur, onChange: this.handleOnChange, onFocus: this.handleOnFocus });
|
|
1712
1712
|
case N.TEXTAREA: {
|
|
1713
|
-
let A = { className: "form-control tw-form-control", id: x, name: r, placeholder: a, value: zt(P, { coerceValue: true }), readOnly: m, required: p, minLength: h, maxLength: y, onFocus: this.handleOnFocus, onBlur: this.handleOnBlur, disabled:
|
|
1713
|
+
let A = { className: "form-control tw-form-control", id: x, name: r, placeholder: a, value: zt(P, { coerceValue: true }), readOnly: m, required: p, minLength: h, maxLength: y, onFocus: this.handleOnFocus, onBlur: this.handleOnBlur, disabled: d, autoComplete: this.getAutocompleteValue() };
|
|
1714
1714
|
return this.props.displayPattern ? (0, Z.jsx)(_.TextareaWithDisplayFormat, C(s({ displayPattern: this.props.displayPattern }, A), { onChange: this.handleOnChange })) : (0, Z.jsx)("textarea", C(s({}, A), { onChange: this.handleInputOnChange, "aria-describedby": U }));
|
|
1715
1715
|
}
|
|
1716
1716
|
case N.FILE:
|
|
1717
1717
|
case N.UPLOAD:
|
|
1718
|
-
return (0, Z.jsx)(_.Upload, C(s({}, g), { usAccept: g.usAccept || "*", usDisabled: g.usDisabled ||
|
|
1718
|
+
return (0, Z.jsx)(_.Upload, C(s({}, g), { usAccept: g.usAccept || "*", usDisabled: g.usDisabled || d, onSuccess: (A) => {
|
|
1719
1719
|
this.handleOnChange(A);
|
|
1720
1720
|
}, onFailure: () => {
|
|
1721
1721
|
this.handleOnChange(null);
|
|
@@ -1725,7 +1725,7 @@ var require_main_min = __commonJS({
|
|
|
1725
1725
|
case N.TEXT:
|
|
1726
1726
|
case N.EMAIL:
|
|
1727
1727
|
default: {
|
|
1728
|
-
let A = { type: i === N.EMAIL ? "email" : "text", className: "form-control", id: x, name: r, placeholder: a, value: zt(P, { coerceValue: true }), readOnly: m, required: p, minLength: h, maxLength: y, onFocus: this.handleOnFocus, onBlur: this.handleOnBlur, disabled:
|
|
1728
|
+
let A = { type: i === N.EMAIL ? "email" : "text", className: "form-control", id: x, name: r, placeholder: a, value: zt(P, { coerceValue: true }), readOnly: m, required: p, minLength: h, maxLength: y, onFocus: this.handleOnFocus, onBlur: this.handleOnBlur, disabled: d, autoComplete: this.getAutocompleteValue() };
|
|
1729
1729
|
return this.props.displayPattern ? (0, Z.jsx)(_.InputWithDisplayFormat, C(s({ displayPattern: this.props.displayPattern }, A), { onChange: this.handleOnChange })) : (0, Z.jsx)("input", C(s({}, A), { onChange: this.handleInputOnChange, "aria-describedby": U }));
|
|
1730
1730
|
}
|
|
1731
1731
|
}
|
|
@@ -1771,13 +1771,13 @@ var require_main_min = __commonJS({
|
|
|
1771
1771
|
var Bd = { date: "date", email: "email", base64url: "file", password: "password", "phone-number": "tel" };
|
|
1772
1772
|
var zd = (e, t) => e.oneOf ? e.oneOf.map((r) => fs(r, t)) : null;
|
|
1773
1773
|
function ws(e) {
|
|
1774
|
-
let { id: t, schema: r, value: a, disabled: o, onChange: n, onFocus: i, onBlur: c, onSearchChange:
|
|
1774
|
+
let { id: t, schema: r, value: a, disabled: o, onChange: n, onFocus: i, onBlur: c, onSearchChange: d, describedBy: m } = e, p = Mt(), h = (F) => Td(r.type) && (I(F) || Y(F)) ? "" : F, y = (F, g) => {
|
|
1775
1775
|
n($e(F, r), g);
|
|
1776
1776
|
}, u = lo(r);
|
|
1777
1777
|
(0, gs.useEffect)(() => {
|
|
1778
1778
|
jd(r, p, u);
|
|
1779
1779
|
}, [JSON.stringify(r), p, u]);
|
|
1780
|
-
let
|
|
1780
|
+
let l = r.values || zd(r, u), f = { onFocus: i, onBlur: c, onSearchChange: d, onChange: y }, w = h(a), S = { id: t, name: t, label: r.title, options: l || [], placeholder: r.placeholder, autoComplete: !r.help, autocompleteHint: r.autocompleteHint, disabled: o || r.disabled, displayPattern: r.displayFormat, uploadProps: Qr(r), describedBy: m };
|
|
1781
1781
|
return (0, mo.jsx)("div", { "aria-describedby": m, children: (0, mo.jsx)(jt, s(s({ type: u, value: w }, f), S)) });
|
|
1782
1782
|
}
|
|
1783
1783
|
ws.defaultProps = { value: null, onFocus: null, onBlur: null, onSearchChange: null, disabled: false };
|
|
@@ -1787,7 +1787,7 @@ var require_main_min = __commonJS({
|
|
|
1787
1787
|
var lr = ws;
|
|
1788
1788
|
var Q = require("react/jsx-runtime");
|
|
1789
1789
|
function Fs(e) {
|
|
1790
|
-
let t = re(), [r, a] = (0, Ne.useState)(false), [o, n] = (0, Ne.useState)(false), [i, c] = (0, Ne.useState)(false),
|
|
1790
|
+
let t = re(), [r, a] = (0, Ne.useState)(false), [o, n] = (0, Ne.useState)(false), [i, c] = (0, Ne.useState)(false), d = (0, Ne.useMemo)(() => e.schema.$id || Te(), [e.schema.$id]), [m, p] = (0, Ne.useState)(Jr(e.schema, e.model)), [h, y] = (0, Ne.useState)(qd(e.model, e.schema.oneOf)), u = Qn(t, 200), l = (M) => {
|
|
1791
1791
|
u("Dynamic Flow - OneOf Searched", { oneOfId: e.schema.analyticsId, searchValueLength: M.length });
|
|
1792
1792
|
};
|
|
1793
1793
|
if ((0, Ne.useEffect)(() => {
|
|
@@ -1810,8 +1810,8 @@ var require_main_min = __commonJS({
|
|
|
1810
1810
|
} else
|
|
1811
1811
|
e.onChange({ model: h[M], triggerSchema: P, triggerModel: h[M], type: E });
|
|
1812
1812
|
E !== "init" && e.schema.analyticsId && t("Dynamic Flow - OneOf Selected", { oneOfId: e.schema.analyticsId, schemaId: P == null ? void 0 : P.analyticsId });
|
|
1813
|
-
}, g = Gd(e.schema), v = Ud(e, m), O = { "form-group": true, "has-error": !r && e.errors && !kt(e.errors) || (e.submitted || r && i) && v.length }, x = `${
|
|
1814
|
-
return (0, Q.jsxs)(Q.Fragment, { children: [(e.schema.oneOf.length > 1 || we(e.schema.oneOf[0])) && (0, Q.jsxs)(Q.Fragment, { children: [e.schema.alert && (0, Q.jsx)(se, { component: e.schema.alert }), (0, Q.jsxs)("div", { className: (0, Ss.default)(O), children: [Vd(e.schema,
|
|
1813
|
+
}, g = Gd(e.schema), v = Ud(e, m), O = { "form-group": true, "has-error": !r && e.errors && !kt(e.errors) || (e.submitted || r && i) && v.length }, x = `${d}-feedback`;
|
|
1814
|
+
return (0, Q.jsxs)(Q.Fragment, { children: [(e.schema.oneOf.length > 1 || we(e.schema.oneOf[0])) && (0, Q.jsxs)(Q.Fragment, { children: [e.schema.alert && (0, Q.jsx)(se, { component: e.schema.alert }), (0, Q.jsxs)("div", { className: (0, Ss.default)(O), children: [Vd(e.schema, d), (0, Q.jsx)(lr, { id: d, schema: g, value: m, disabled: e.disabled, describedBy: x, onChange: F, onFocus: w, onBlur: S, onSearchChange: l }), (0, Q.jsx)(He, { id: x, changed: r, focused: o, blurred: i, submitted: e.submitted, errors: Hd(e.errors), schema: e.schema, validations: v, infoMessage: null })] })] }), tr(e.schema.oneOf[m]) && (0, Q.jsx)(me, { schema: e.schema.oneOf[m], model: h[m], errors: e.errors, submitted: e.submitted, hideTitle: true, disabled: e.disabled, onChange: (M) => f(m, M), onPersistAsync: e.onPersistAsync })] });
|
|
1815
1815
|
}
|
|
1816
1816
|
function Vd(e, t) {
|
|
1817
1817
|
var o;
|
|
@@ -1843,28 +1843,28 @@ var require_main_min = __commonJS({
|
|
|
1843
1843
|
var bs = require("react");
|
|
1844
1844
|
var vs = require("react/jsx-runtime");
|
|
1845
1845
|
function xs(e) {
|
|
1846
|
-
let { id: t, httpClient: r = fetch, httpOptions: a, fileId: o, idProperty: n, usAccept: i, maxSize: c, usPlaceholder:
|
|
1847
|
-
return (0, vs.jsx)(ea.UploadInput, { id: t, fileInputName: a.fileInputName, files: u, uploadButtonTitle: e.usLabel, sizeLimit: c ? Nr(c) : void 0, fileTypes: i, description:
|
|
1846
|
+
let { id: t, httpClient: r = fetch, httpOptions: a, fileId: o, idProperty: n, usAccept: i, maxSize: c, usPlaceholder: d, onSuccess: m, onFailure: p, onCancel: h } = e, y = re(), u = (0, bs.useMemo)(() => o ? [{ id: o, status: ea.Status.SUCCEEDED }] : [], [o]), l = (f) => (y("Dynamic Flow - PersistAsync", { status: "pending", schemaId: t }), r(String(a.url), { method: a.method || "POST", body: f }).then((w) => w.ok ? (m == null || m(w.clone()), w.json().then((S) => ({ id: S[n] }))) : (p == null || p({ response: w }), Promise.reject())));
|
|
1847
|
+
return (0, vs.jsx)(ea.UploadInput, { id: t, fileInputName: a.fileInputName, files: u, uploadButtonTitle: e.usLabel, sizeLimit: c ? Nr(c) : void 0, fileTypes: i, description: d, onUploadFile: l, onDeleteFile: (f) => (h == null || h(), Promise.resolve()) });
|
|
1848
1848
|
}
|
|
1849
1849
|
var Ut = require("react/jsx-runtime");
|
|
1850
1850
|
function Os(e) {
|
|
1851
|
-
let [t, r] = (0, wt.useState)({}), [a, o] = (0, wt.useState)(null), [n, i] = (0, wt.useState)([]), [c,
|
|
1851
|
+
let [t, r] = (0, wt.useState)({}), [a, o] = (0, wt.useState)(null), [n, i] = (0, wt.useState)([]), [c, d] = (0, wt.useState)(false), m = ae(), p = re();
|
|
1852
1852
|
(0, wt.useEffect)(() => {
|
|
1853
1853
|
e.submitted && i(_e(e.model, e.schema, !!e.required));
|
|
1854
1854
|
}, [e.model, e.submitted]);
|
|
1855
1855
|
let y = async (O, x) => {
|
|
1856
1856
|
let M = await O.json(), E = fo(e.schema.persistAsync.idProperty, M);
|
|
1857
|
-
e.onChange({ model: E, triggerSchema: e.schema, triggerModel: E }),
|
|
1857
|
+
e.onChange({ model: E, triggerSchema: e.schema, triggerModel: E }), d(true), p("Dynamic Flow - PersistAsync", { status: "success", schemaId: e.schema.$id });
|
|
1858
1858
|
}, u = async (O) => {
|
|
1859
1859
|
if (O.response && Lr(O.response.status)) {
|
|
1860
1860
|
let x = await O.response.json();
|
|
1861
1861
|
r(x.validation || {}), o([e.schema.persistAsync.param]);
|
|
1862
1862
|
}
|
|
1863
|
-
e.onChange({ model: null, triggerSchema: e.schema, triggerModel: null }),
|
|
1864
|
-
},
|
|
1865
|
-
o(null), e.onChange({ model: null, triggerSchema: e.schema, triggerModel: null }),
|
|
1863
|
+
e.onChange({ model: null, triggerSchema: e.schema, triggerModel: null }), d(true), p("Dynamic Flow - PersistAsync", { status: "failure", schemaId: e.schema.$id });
|
|
1864
|
+
}, l = () => {
|
|
1865
|
+
o(null), e.onChange({ model: null, triggerSchema: e.schema, triggerModel: null }), d(true);
|
|
1866
1866
|
}, { url: f, method: w } = e.schema.persistAsync, S = a || n, F = { "form-group": true, "has-error": (e.submitted || c) && !!S.length }, g = e.schema.$id || e.schema.persistAsync.schema.$id || e.schema.persistAsync.idProperty, v = `${g}-feedback`;
|
|
1867
|
-
return (0, Ut.jsxs)("div", { className: (0, As.default)(F), children: [(0, Ut.jsx)("div", { "aria-describedby": v, children: (0, Ut.jsx)(xs, s({ id: g, fileId: e.model, idProperty: e.schema.persistAsync.idProperty, animationDelay: 0, maxSize: e.schema.persistAsync.schema.maxSize, usLabel: e.schema.title || e.schema.persistAsync.schema.title, usPlaceholder: e.schema.description || e.schema.persistAsync.schema.description, httpOptions: { url: f, method: w, fileInputName: e.schema.persistAsync.param }, httpClient: m, onSuccess: y, onFailure: u, onCancel:
|
|
1867
|
+
return (0, Ut.jsxs)("div", { className: (0, As.default)(F), children: [(0, Ut.jsx)("div", { "aria-describedby": v, children: (0, Ut.jsx)(xs, s({ id: g, fileId: e.model, idProperty: e.schema.persistAsync.idProperty, animationDelay: 0, maxSize: e.schema.persistAsync.schema.maxSize, usLabel: e.schema.title || e.schema.persistAsync.schema.title, usPlaceholder: e.schema.description || e.schema.persistAsync.schema.description, httpOptions: { url: f, method: w, fileInputName: e.schema.persistAsync.param }, httpClient: m, onSuccess: y, onFailure: u, onCancel: l }, Qr(e.schema.persistAsync.schema))) }), (0, Ut.jsx)(He, { id: v, blurred: true, focused: false, changed: c, submitted: e.submitted, errors: e.errors, schema: e.schema, validations: S, validationMessages: s({ required: "Value is required..." }, t), infoMessage: null })] });
|
|
1868
1868
|
}
|
|
1869
1869
|
Os.defaultProps = { required: false };
|
|
1870
1870
|
var yo = Os;
|
|
@@ -1883,9 +1883,9 @@ var require_main_min = __commonJS({
|
|
|
1883
1883
|
var ks = require("@transferwise/components");
|
|
1884
1884
|
var wo = require("react/jsx-runtime");
|
|
1885
1885
|
var Es = (e) => {
|
|
1886
|
-
let { id: t, selection: r, setSelection: a } = e, { promoted: o, other: n, checkedMeans: i } = e.promotion, c = i === "other" ? n.title : (o == null ? void 0 : o.title) || e.promotedOneOf.title,
|
|
1886
|
+
let { id: t, selection: r, setSelection: a } = e, { promoted: o, other: n, checkedMeans: i } = e.promotion, c = i === "other" ? n.title : (o == null ? void 0 : o.title) || e.promotedOneOf.title, d = i === "other" ? "other" : "promoted", m = i === "other" ? "promoted" : "other", p = r === d;
|
|
1887
1887
|
return (0, wo.jsx)("div", { className: "form-group", children: (0, wo.jsx)(ks.Checkbox, { id: t, label: c, checked: p, onChange: () => {
|
|
1888
|
-
a(p ? m :
|
|
1888
|
+
a(p ? m : d);
|
|
1889
1889
|
} }) });
|
|
1890
1890
|
};
|
|
1891
1891
|
Es.defaultProps = {};
|
|
@@ -1893,8 +1893,8 @@ var require_main_min = __commonJS({
|
|
|
1893
1893
|
var Ds = require("@transferwise/components");
|
|
1894
1894
|
var dr = require("react/jsx-runtime");
|
|
1895
1895
|
function Ls(e) {
|
|
1896
|
-
var
|
|
1897
|
-
let { id: t, selection: r, setSelection: a, promotion: o, promotedOneOf: n, title: i } = e, c = [s({ value: "promoted", label: ((
|
|
1896
|
+
var d, m;
|
|
1897
|
+
let { id: t, selection: r, setSelection: a, promotion: o, promotedOneOf: n, title: i } = e, c = [s({ value: "promoted", label: ((d = o.promoted) == null ? void 0 : d.title) || n.title, secondary: ((m = o.promoted) == null ? void 0 : m.description) || n.description }, Vt(n)), s({ value: "other", label: o.other.title, secondary: o.other.description }, Vt(o.other))];
|
|
1898
1898
|
return (0, dr.jsxs)("div", { className: "form-group", children: [i && (0, dr.jsx)("label", { className: "control-label", htmlFor: t, children: i }), (0, dr.jsx)(Ds.RadioGroup, { name: "promoted-selection", selectedValue: r, radios: c, id: t, onChange: a })] });
|
|
1899
1899
|
}
|
|
1900
1900
|
Ls.defaultProps = { title: void 0 };
|
|
@@ -1955,7 +1955,7 @@ var require_main_min = __commonJS({
|
|
|
1955
1955
|
var Be = require("react");
|
|
1956
1956
|
var Hs = require("react/jsx-runtime");
|
|
1957
1957
|
function Us(e) {
|
|
1958
|
-
let { schema: t, model: r, required: a, submitted: o, errors: n, onChange: i } = e, [c,
|
|
1958
|
+
let { schema: t, model: r, required: a, submitted: o, errors: n, onChange: i } = e, [c, d] = (0, Be.useState)(r), m = (0, Be.useRef)(null), [p, h] = (0, Be.useState)(null), [y, u] = (0, Be.useState)(null), [l, f] = (0, Be.useState)(false), [w, S] = (0, Be.useState)(null), F = ae(), g = re(), v = Mt();
|
|
1959
1959
|
(0, Be.useEffect)(() => {
|
|
1960
1960
|
t.validationAsync.method || v.warning("Invalid schema or model", 'ValidationAsyncSchema without a "method" property would have defaulted to "GET" in previous versions. Now defaults to "POST".', {});
|
|
1961
1961
|
}, [v, t.validationAsync.method]);
|
|
@@ -1976,8 +1976,8 @@ var require_main_min = __commonJS({
|
|
|
1976
1976
|
let D = new AbortController();
|
|
1977
1977
|
return S(D), D.signal;
|
|
1978
1978
|
};
|
|
1979
|
-
return (0, Hs.jsx)(Ct, s({}, { submitted: o ||
|
|
1980
|
-
i(C(s({}, D), { triggerSchema: t, triggerModel: D.model })), u(null), h(null),
|
|
1979
|
+
return (0, Hs.jsx)(Ct, s({}, { submitted: o || l, model: c, errors: y || n, infoMessage: p, onChange: (D) => {
|
|
1980
|
+
i(C(s({}, D), { triggerSchema: t, triggerModel: D.model })), u(null), h(null), d(D.model);
|
|
1981
1981
|
}, onBlur: () => {
|
|
1982
1982
|
!I(c) && !Je(c, m.current) && G(c, t) && O(c, t.validationAsync);
|
|
1983
1983
|
}, required: a, schema: t }));
|
|
@@ -1987,10 +1987,10 @@ var require_main_min = __commonJS({
|
|
|
1987
1987
|
var he = require("react/jsx-runtime");
|
|
1988
1988
|
var Gs = require("react");
|
|
1989
1989
|
function eu(e) {
|
|
1990
|
-
let { schema: t, model: r = null, errors: a = null, hideTitle: o = false, disabled: n = false } = e, i = C(s({}, e), { model: r, errors: a, hideTitle: o, disabled: n }), c = dt(t),
|
|
1990
|
+
let { schema: t, model: r = null, errors: a = null, hideTitle: o = false, disabled: n = false } = e, i = C(s({}, e), { model: r, errors: a, hideTitle: o, disabled: n }), c = dt(t), d = Mt();
|
|
1991
1991
|
switch ((0, qs.useEffect)(() => {
|
|
1992
|
-
tu(t, r, a) ||
|
|
1993
|
-
}, [JSON.stringify(t), JSON.stringify(r), JSON.stringify(a), c,
|
|
1992
|
+
tu(t, r, a) || d.error("Invalid schema or model", `Schema of type ${c || "undefined"} requested, but schema did not pass validation.`);
|
|
1993
|
+
}, [JSON.stringify(t), JSON.stringify(r), JSON.stringify(a), c, d]), c) {
|
|
1994
1994
|
case "readOnly":
|
|
1995
1995
|
return (0, he.jsx)(Fo, s({}, i));
|
|
1996
1996
|
case "persistAsync":
|
|
@@ -2091,9 +2091,9 @@ var require_main_min = __commonJS({
|
|
|
2091
2091
|
var aa = require("react");
|
|
2092
2092
|
var ko = require("react/jsx-runtime");
|
|
2093
2093
|
function iu({ component: e }) {
|
|
2094
|
-
let { url: t, size: r, text: a, margin: o, accessibilityDescription: n } = e, i = ae(), [c,
|
|
2094
|
+
let { url: t, size: r, text: a, margin: o, accessibilityDescription: n } = e, i = ae(), [c, d] = (0, aa.useState)("");
|
|
2095
2095
|
(0, aa.useEffect)(() => {
|
|
2096
|
-
cu(i, t).then(
|
|
2096
|
+
cu(i, t).then(d);
|
|
2097
2097
|
}, [t, i]);
|
|
2098
2098
|
let m = { alt: n || a || "", src: c, stretch: true, shrink: true };
|
|
2099
2099
|
return c ? (0, ko.jsx)("div", { className: `df-image ${r || "md"}`, children: (0, ko.jsx)($s.Image, s({ className: `img-responsive ${V(o || "md")}` }, m)) }) : null;
|
|
@@ -2127,7 +2127,7 @@ var require_main_min = __commonJS({
|
|
|
2127
2127
|
var H = require("react/jsx-runtime");
|
|
2128
2128
|
var K = (e) => JSON.stringify(e);
|
|
2129
2129
|
function uu(e) {
|
|
2130
|
-
let { components: t, model: r, submitted: a, errors: o, onModelChange: n, onAction: i, onPersistAsync: c, baseUrl:
|
|
2130
|
+
let { components: t, model: r, submitted: a, errors: o, onModelChange: n, onAction: i, onPersistAsync: c, baseUrl: d } = e, m = (p) => {
|
|
2131
2131
|
switch (p.type) {
|
|
2132
2132
|
case "heading":
|
|
2133
2133
|
return (0, H.jsx)(Ao, { component: p }, K(p));
|
|
@@ -2172,7 +2172,7 @@ var require_main_min = __commonJS({
|
|
|
2172
2172
|
return (0, H.jsx)("div", {}, K(p));
|
|
2173
2173
|
}
|
|
2174
2174
|
};
|
|
2175
|
-
return wn() ||
|
|
2175
|
+
return wn() || d == null ? (0, H.jsx)(H.Fragment, { children: t.map(m) }) : (0, H.jsx)(Ir, { baseUrl: d, children: t.map(m) });
|
|
2176
2176
|
}
|
|
2177
2177
|
var ne = uu;
|
|
2178
2178
|
var na = require("@transferwise/components");
|
|
@@ -2228,8 +2228,8 @@ var require_main_min = __commonJS({
|
|
|
2228
2228
|
var Au = (e, t, r) => t ? r === "HORIZONTAL_RIGHT_ALIGNED" ? (0, le.jsxs)(le.Fragment, { children: [(0, le.jsx)(qe, { help: t }), " ", e] }) : (0, le.jsxs)(le.Fragment, { children: [e, " ", (0, le.jsx)(qe, { help: t })] }) : e;
|
|
2229
2229
|
var Ou = (e) => (e.control || e.orientation) === "horizontal" ? "HORIZONTAL_RIGHT_ALIGNED" : "VERTICAL_ONE_COLUMN";
|
|
2230
2230
|
function Pu(e) {
|
|
2231
|
-
let t = e.component, r = V(t.margin || "xs"), a = (c,
|
|
2232
|
-
m.preventDefault(),
|
|
2231
|
+
let t = e.component, r = V(t.margin || "xs"), a = (c, d) => ({ text: c != null ? c : "", href: d.url, onClick: (m) => {
|
|
2232
|
+
m.preventDefault(), d && e.onAction(d);
|
|
2233
2233
|
} }), o = Ou(t), n = t.callToAction ? a(t.callToAction.title, t.callToAction.action) : null, i = !n && t.action ? a(t.action.title || "", t.action) : null;
|
|
2234
2234
|
return (0, le.jsxs)("div", { className: r, children: [t.title && (0, le.jsx)(ia.Header, { title: t.title, action: n || i || void 0 }), (0, le.jsx)("div", { className: r, children: (0, le.jsx)(ia.DefinitionList, { layout: o, definitions: vu(o, t) }) })] });
|
|
2235
2235
|
}
|
|
@@ -2254,8 +2254,8 @@ var require_main_min = __commonJS({
|
|
|
2254
2254
|
var sc = { "Content-Type": "application/json" };
|
|
2255
2255
|
var cc = (e) => {
|
|
2256
2256
|
let [t, r] = (0, $t.useState)({ status: "idle" }), a = (0, $t.useRef)(null), o = ae(), n = (0, $t.useCallback)(async (m, { url: p, method: h, param: y } = e) => {
|
|
2257
|
-
var
|
|
2258
|
-
if ((
|
|
2257
|
+
var l;
|
|
2258
|
+
if ((l = a.current) == null || l.abort(), !m) {
|
|
2259
2259
|
r({ status: "idle" });
|
|
2260
2260
|
return;
|
|
2261
2261
|
}
|
|
@@ -2279,8 +2279,8 @@ var require_main_min = __commonJS({
|
|
|
2279
2279
|
r({ status: "error" });
|
|
2280
2280
|
}, c = (m, p) => {
|
|
2281
2281
|
ku(m) || r({ status: "error" });
|
|
2282
|
-
},
|
|
2283
|
-
return { status: t.status, results:
|
|
2282
|
+
}, d = t.status === "success" ? t.results : [];
|
|
2283
|
+
return { status: t.status, results: d, search: n };
|
|
2284
2284
|
};
|
|
2285
2285
|
var Mu = (e) => R(e) && "results" in e && j(e.results) && e.results.every((t) => R(t) && "title" in t && "type" in t && "value" in t);
|
|
2286
2286
|
var ku = (e) => e instanceof DOMException && e.name === "AbortError";
|
|
@@ -2291,10 +2291,10 @@ var require_main_min = __commonJS({
|
|
|
2291
2291
|
var Ft = require("react/jsx-runtime");
|
|
2292
2292
|
var Iu = 400;
|
|
2293
2293
|
function Du({ component: e, onAction: t }) {
|
|
2294
|
-
let [r, a] = (0, ma.useState)(""), { title: o, margin: n, url: i, method: c, param:
|
|
2294
|
+
let [r, a] = (0, ma.useState)(""), { title: o, margin: n, url: i, method: c, param: d, emptyMessage: m } = e, { status: p, results: h, search: y } = cc({ url: i, method: c, param: d }), u = re(), l = (0, ma.useMemo)(() => Ke(y, Iu), [y]), f = () => {
|
|
2295
2295
|
u("Dynamic Flow - Search Started", {});
|
|
2296
2296
|
}, w = (g) => {
|
|
2297
|
-
a(g),
|
|
2297
|
+
a(g), l(g);
|
|
2298
2298
|
}, S = ({ type: g, value: v }) => {
|
|
2299
2299
|
if (g === "action" && (u("Dynamic Flow - Search Result Selected", { type: "action", actionId: v.id || v.$id }), t(v)), g === "search") {
|
|
2300
2300
|
a(v.query);
|
|
@@ -2323,14 +2323,14 @@ var require_main_min = __commonJS({
|
|
|
2323
2323
|
let t = (k) => {
|
|
2324
2324
|
y(true), a(o(k), "user");
|
|
2325
2325
|
}, r = (k) => _e(k, e.schema, e.required), a = (k, ie) => {
|
|
2326
|
-
|
|
2326
|
+
d(k);
|
|
2327
2327
|
let W = r(k);
|
|
2328
2328
|
F(W);
|
|
2329
2329
|
let X = k;
|
|
2330
2330
|
p(X), X !== m && e.onChange({ model: X, triggerSchema: e.schema, triggerModel: X, lastTriggerModel: m, type: ie });
|
|
2331
|
-
}, o = (k) => $e(k, e.schema), n = () =>
|
|
2332
|
-
|
|
2333
|
-
}, [c,
|
|
2331
|
+
}, o = (k) => $e(k, e.schema), n = () => l(true), i = () => {
|
|
2332
|
+
l(false), w(true), e.onBlur && e.onBlur();
|
|
2333
|
+
}, [c, d] = (0, de.useState)((ee = e.model) != null ? ee : null), [m, p] = (0, de.useState)((A = e.model) != null ? A : null), [h, y] = (0, de.useState)(false), [u, l] = (0, de.useState)(false), [f, w] = (0, de.useState)(false), [S, F] = (0, de.useState)([]), g = (0, de.useMemo)(() => e.schema.$id || Te(), [e.schema.$id]), v = () => {
|
|
2334
2334
|
let k = Tu(e.schema);
|
|
2335
2335
|
zo(c) && !zo(k) && a(k, "init"), e.schema.const && a(e.schema.const, "init");
|
|
2336
2336
|
}, O = () => {
|
|
@@ -2339,7 +2339,7 @@ var require_main_min = __commonJS({
|
|
|
2339
2339
|
(0, de.useEffect)(O, [e.model, e.submitted]), (0, de.useEffect)(v, [e.schema]), (0, de.useEffect)(() => {
|
|
2340
2340
|
var ie;
|
|
2341
2341
|
let k = (ie = e.model) != null ? ie : null;
|
|
2342
|
-
k !== c &&
|
|
2342
|
+
k !== c && d(k);
|
|
2343
2343
|
}, [e.model]);
|
|
2344
2344
|
let E = { "form-group": true, "has-error": (e.submitted || !h) && !!e.errors || (e.submitted || h && f) && !!S.length, "has-info": !!e.schema.description || !!e.infoMessage }, P = e.schema.format !== "file" && e.schema.type !== "boolean", D = e.schema.help, U = `${g}-feedback`;
|
|
2345
2345
|
return M ? null : (0, ue.jsxs)(ue.Fragment, { children: [e.schema.alert && (0, ue.jsx)(se, { component: e.schema.alert }), (0, ue.jsxs)("div", { className: (0, lc.default)(E), children: [P && (0, ue.jsxs)("div", { className: "d-inline-block m-b-1", children: [(0, ue.jsx)("label", { className: "control-label d-inline", htmlFor: g, children: e.schema.title }), !!D && (0, ue.jsx)(qe, { help: D })] }), !P && !!D && (0, ue.jsx)(qe, { help: D }), (0, ue.jsx)(lr, { id: g, schema: e.schema, value: c, disabled: !!e.disabled, onChange: t, onFocus: n, onBlur: i, describedBy: U }), (0, ue.jsx)(He, { id: U, changed: h, focused: u, blurred: f, submitted: e.submitted, errors: (B = e.errors) != null ? B : null, schema: e.schema, validations: S, infoMessage: e.infoMessage })] })] });
|
|
@@ -2354,16 +2354,16 @@ var require_main_min = __commonJS({
|
|
|
2354
2354
|
};
|
|
2355
2355
|
var Ru = /* @__PURE__ */ new Set([N.RADIO, N.SELECT, N.DATELOOKUP, N.FILE, N.UPLOAD]);
|
|
2356
2356
|
function yc(e) {
|
|
2357
|
-
let { schema: t, required: r, submitted: a, errors: o, onChange: n, onPersistAsync: i } = e, c = (0, uc.useIntl)(),
|
|
2357
|
+
let { schema: t, required: r, submitted: a, errors: o, onChange: n, onPersistAsync: i } = e, c = (0, uc.useIntl)(), d = ae(), m = re(), [p, h] = (0, bt.useState)(null), y = hc(p), [u, l] = (0, bt.useState)(null), [f, w] = (0, bt.useState)(false), [S, F] = (0, bt.useState)(null);
|
|
2358
2358
|
(0, bt.useEffect)(() => {
|
|
2359
2359
|
Ru.has(lo(t.persistAsync.schema)) && x();
|
|
2360
2360
|
}, [p]);
|
|
2361
|
-
let g = () =>
|
|
2361
|
+
let g = () => l(c.formatMessage(nr.genericError)), v = async (P, D) => {
|
|
2362
2362
|
let U = O(), ee = { [D.param]: P };
|
|
2363
2363
|
w(true);
|
|
2364
2364
|
try {
|
|
2365
2365
|
m("Dynamic Flow - PersistAsync", { status: "pending", schemaId: t.$id });
|
|
2366
|
-
let A =
|
|
2366
|
+
let A = d(D.url, { method: D.method, headers: { "Content-Type": "application/json" }, body: JSON.stringify(ee), signal: U });
|
|
2367
2367
|
i(A);
|
|
2368
2368
|
let B = await A, k = await B.json();
|
|
2369
2369
|
if (!R(k))
|
|
@@ -2374,7 +2374,7 @@ var require_main_min = __commonJS({
|
|
|
2374
2374
|
n({ model: X, triggerSchema: t, triggerModel: X });
|
|
2375
2375
|
} else if (Lr(B.status)) {
|
|
2376
2376
|
let { validation: X } = k, ke = R(X) && (X == null ? void 0 : X[W]) || null;
|
|
2377
|
-
|
|
2377
|
+
l(ke), n({ model: null, triggerSchema: t, triggerModel: null });
|
|
2378
2378
|
} else
|
|
2379
2379
|
g();
|
|
2380
2380
|
m("Dynamic Flow - PersistAsync", { status: "success", schemaId: t.$id });
|
|
@@ -2390,7 +2390,7 @@ var require_main_min = __commonJS({
|
|
|
2390
2390
|
}, M = () => {
|
|
2391
2391
|
x();
|
|
2392
2392
|
}, E = ({ model: P }) => {
|
|
2393
|
-
|
|
2393
|
+
l(null), G(P, t.persistAsync.schema) && h(P);
|
|
2394
2394
|
};
|
|
2395
2395
|
return (0, fc.jsx)(Ct, { required: r, submitted: a || f, schema: t.persistAsync.schema, errors: u || o, model: null, infoMessage: null, onChange: E, onBlur: M });
|
|
2396
2396
|
}
|
|
@@ -2407,18 +2407,18 @@ var require_main_min = __commonJS({
|
|
|
2407
2407
|
let y = new AbortController();
|
|
2408
2408
|
return r(y), y.signal;
|
|
2409
2409
|
};
|
|
2410
|
-
function
|
|
2411
|
-
let u = Dt(n),
|
|
2412
|
-
return { method: e.method, headers: s({}, !u && { "Content-Type": "application/json" }), body: w, signal:
|
|
2410
|
+
function d(y) {
|
|
2411
|
+
let u = Dt(n), l = c(), f = e.param, w = u ? Nu(f, y) : JSON.stringify({ [f]: y });
|
|
2412
|
+
return { method: e.method, headers: s({}, !u && { "Content-Type": "application/json" }), body: w, signal: l };
|
|
2413
2413
|
}
|
|
2414
2414
|
async function m(y) {
|
|
2415
2415
|
try {
|
|
2416
|
-
let u = await a(e.url,
|
|
2416
|
+
let u = await a(e.url, d(y));
|
|
2417
2417
|
if (!u.ok)
|
|
2418
2418
|
return p(u);
|
|
2419
|
-
let
|
|
2420
|
-
if (R(
|
|
2421
|
-
let f =
|
|
2419
|
+
let l = await u.json();
|
|
2420
|
+
if (R(l)) {
|
|
2421
|
+
let f = l[e.idProperty];
|
|
2422
2422
|
if (L(f) || z(f))
|
|
2423
2423
|
return { data: f };
|
|
2424
2424
|
}
|
|
@@ -2431,9 +2431,9 @@ var require_main_min = __commonJS({
|
|
|
2431
2431
|
if (y.status === 422) {
|
|
2432
2432
|
let u = await y.json();
|
|
2433
2433
|
if (R(u)) {
|
|
2434
|
-
let
|
|
2435
|
-
if (L(
|
|
2436
|
-
throw new Error(
|
|
2434
|
+
let l = pc(e.param, u);
|
|
2435
|
+
if (L(l))
|
|
2436
|
+
throw new Error(l);
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
throw new Error(o.formatMessage(nr.genericError));
|
|
@@ -2453,25 +2453,25 @@ var require_main_min = __commonJS({
|
|
|
2453
2453
|
}
|
|
2454
2454
|
var rt = require("react");
|
|
2455
2455
|
function Vr({ asyncFn: e, interval: t, maxAttempts: r, maxConsecutiveFails: a, onPollingResponse: o, onFailure: n }) {
|
|
2456
|
-
let i = (0, rt.useRef)(o), c = (0, rt.useRef)(n),
|
|
2456
|
+
let i = (0, rt.useRef)(o), c = (0, rt.useRef)(n), d = (0, rt.useMemo)(() => zu(e, r, a, (m) => i.current(m), () => c.current()), [e, r, a]);
|
|
2457
2457
|
(0, rt.useEffect)(() => {
|
|
2458
2458
|
if (t > 0) {
|
|
2459
2459
|
let m = setInterval(() => {
|
|
2460
|
-
|
|
2460
|
+
d();
|
|
2461
2461
|
}, t);
|
|
2462
2462
|
return () => clearInterval(m);
|
|
2463
2463
|
}
|
|
2464
|
-
}, [
|
|
2464
|
+
}, [d, t]), (0, rt.useEffect)(() => {
|
|
2465
2465
|
i.current = o, c.current = n;
|
|
2466
2466
|
}, [o, n]);
|
|
2467
2467
|
}
|
|
2468
2468
|
function zu(e, t, r, a, o) {
|
|
2469
2469
|
let n = true, i = 0, c = 0;
|
|
2470
2470
|
return e ? () => {
|
|
2471
|
-
n && (c++, e().then((
|
|
2472
|
-
i = 0, n = a(
|
|
2473
|
-
}).catch((
|
|
2474
|
-
|
|
2471
|
+
n && (c++, e().then((d) => {
|
|
2472
|
+
i = 0, n = a(d);
|
|
2473
|
+
}).catch((d) => {
|
|
2474
|
+
d.message !== "network failed" && (i += 1);
|
|
2475
2475
|
}).finally(() => {
|
|
2476
2476
|
(i >= r || c >= t) && (o(), n = false);
|
|
2477
2477
|
}));
|
|
@@ -2510,7 +2510,7 @@ var require_main_min = __commonJS({
|
|
|
2510
2510
|
return ze({ layout: r, schemas: e.schemas || [], actions: e.actions || [], model: (a = e.model) != null ? a : null });
|
|
2511
2511
|
};
|
|
2512
2512
|
var Vu = (e) => {
|
|
2513
|
-
let { stepSpecification: t, stepLayoutOptions: r, submitted: a, model: o, formErrors: n, onModelChange: i } = e, c = ju(t, r), { loading:
|
|
2513
|
+
let { stepSpecification: t, stepLayoutOptions: r, submitted: a, model: o, formErrors: n, onModelChange: i } = e, c = ju(t, r), { loading: d, registerPersistAsyncPromise: m } = At(), p = re(), h = d ? () => {
|
|
2514
2514
|
p("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
2515
2515
|
} : e.onAction;
|
|
2516
2516
|
return Cc(t.polling, h), (0, Sc.jsx)(ne, { components: c, submitted: a, model: o, errors: n, onAction: h, onModelChange: i, onPersistAsync: m });
|
|
@@ -2604,8 +2604,8 @@ var require_main_min = __commonJS({
|
|
|
2604
2604
|
let r = (0, ot.useCallback)(() => {
|
|
2605
2605
|
window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock == "function" && window.screen.orientation.lock("portrait").then(() => Bc(t)).catch(Wo);
|
|
2606
2606
|
}, [t]), a = (0, ot.useCallback)(() => {
|
|
2607
|
-
var c,
|
|
2608
|
-
return (m = (
|
|
2607
|
+
var c, d, m;
|
|
2608
|
+
return (m = (d = (c = window == null ? void 0 : window.screen) == null ? void 0 : c.orientation) == null ? void 0 : d.unlock) == null ? void 0 : m.call(d);
|
|
2609
2609
|
}, []), o = (0, ot.useCallback)(() => {
|
|
2610
2610
|
setTimeout(() => {
|
|
2611
2611
|
e && !Kt.default.isFullscreen && Kt.default.isEnabled && Kt.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -2615,12 +2615,12 @@ var require_main_min = __commonJS({
|
|
|
2615
2615
|
}, [e, r]), n = (0, ot.useCallback)(() => {
|
|
2616
2616
|
Kt.default.isFullscreen && Kt.default.exit().catch(Wo), a();
|
|
2617
2617
|
}, [a]), i = (0, ot.useCallback)((c) => {
|
|
2618
|
-
var
|
|
2619
|
-
(
|
|
2618
|
+
var d, m;
|
|
2619
|
+
(d = c == null ? void 0 : c.target) != null && d.type.includes("landscape") && (m = window.screen) != null && m.orientation && Nc(t);
|
|
2620
2620
|
}, [t]);
|
|
2621
2621
|
return (0, ot.useEffect)(() => {
|
|
2622
|
-
var c,
|
|
2623
|
-
return e && ((
|
|
2622
|
+
var c, d;
|
|
2623
|
+
return e && ((d = (c = window.screen) == null ? void 0 : c.orientation) == null || d.addEventListener("change", (m) => i(m))), () => {
|
|
2624
2624
|
var m, p;
|
|
2625
2625
|
(p = (m = window.screen) == null ? void 0 : m.orientation) == null || p.removeEventListener("change", i), n();
|
|
2626
2626
|
};
|
|
@@ -2659,25 +2659,25 @@ var require_main_min = __commonJS({
|
|
|
2659
2659
|
let y = Ke(() => {
|
|
2660
2660
|
var u;
|
|
2661
2661
|
if ((u = i.current) != null && u.innerHTML) {
|
|
2662
|
-
let
|
|
2663
|
-
|
|
2662
|
+
let l = i.current;
|
|
2663
|
+
l.innerHTML = String(l.innerHTML);
|
|
2664
2664
|
}
|
|
2665
2665
|
}, 100);
|
|
2666
2666
|
return window.addEventListener("resize", y), () => window.removeEventListener("resize", y);
|
|
2667
2667
|
});
|
|
2668
|
-
let c = (r ? _u : 0) + (a ? Ku : 0) + (o ? Ju : 0),
|
|
2668
|
+
let c = (r ? _u : 0) + (a ? Ku : 0) + (o ? Ju : 0), d = (0, J.jsxs)(J.Fragment, { children: [r && (0, J.jsx)("img", { className: "camera-capture-img", src: r, alt: "" }), a && (0, J.jsx)("h4", { className: "camera-capture-title", children: a }), o && (0, J.jsx)("small", { className: "camera-capture-instructions", children: o })] }), m = $u + c;
|
|
2669
2669
|
if (n) {
|
|
2670
|
-
c = m - Vc,
|
|
2670
|
+
c = m - Vc, d = (0, J.jsx)("small", { className: "camera-capture-instructions", children: n });
|
|
2671
2671
|
let y = Vc + Xu;
|
|
2672
|
-
m < y && (
|
|
2672
|
+
m < y && (d = (0, J.jsx)(J.Fragment, {}));
|
|
2673
2673
|
}
|
|
2674
2674
|
let p = { x: "50%", y: "5%", width: `min(90%, ${Uc}px)`, height: `calc(90% - ${m}px)`, style: { transform: `translateX(max(-45%, -${Uc / 2}px))` } }, h = { style: { left: "5%", top: `calc(100% - ${m}px - 5%)`, height: `calc(${c}px + 5%)`, width: "90%" } };
|
|
2675
|
-
return (0, J.jsxs)("svg", { ref: i, xmlns: "http://www.w3.org/2000/svg", children: [(0, J.jsx)("defs", { children: (0, J.jsxs)("mask", { id: "mask", children: [(0, J.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, J.jsx)("image", s({ href: e }, p))] }) }), e && (0, J.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }), t && (0, J.jsx)("image", s({ href: t }, p)), (0, J.jsx)("foreignObject", { width: "100%", height: "100%", children: (0, J.jsx)("div", C(s({ className: "camera-capture-text-and-image-container" }, h), { children:
|
|
2675
|
+
return (0, J.jsxs)("svg", { ref: i, xmlns: "http://www.w3.org/2000/svg", children: [(0, J.jsx)("defs", { children: (0, J.jsxs)("mask", { id: "mask", children: [(0, J.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, J.jsx)("image", s({ href: e }, p))] }) }), e && (0, J.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }), t && (0, J.jsx)("image", s({ href: t }, p)), (0, J.jsx)("foreignObject", { width: "100%", height: "100%", children: (0, J.jsx)("div", C(s({ className: "camera-capture-text-and-image-container" }, h), { children: d })) })] });
|
|
2676
2676
|
}
|
|
2677
2677
|
var $o = Yu;
|
|
2678
2678
|
var ye = require("react/jsx-runtime");
|
|
2679
|
-
function Zu({ direction: e = "back", overlay: t = "", outline: r = "", imageUrl: a = "", title: o = "", instructions: n = "", showReview: i = false, onCapture: c, onEvent:
|
|
2680
|
-
let [m, p] = (0, oe.useState)("CAPTURE"), [h, y] = (0, oe.useState)(), [u,
|
|
2679
|
+
function Zu({ direction: e = "back", overlay: t = "", outline: r = "", imageUrl: a = "", title: o = "", instructions: n = "", showReview: i = false, onCapture: c, onEvent: d }) {
|
|
2680
|
+
let [m, p] = (0, oe.useState)("CAPTURE"), [h, y] = (0, oe.useState)(), [u, l] = (0, oe.useState)(false), [f, w] = (0, oe.useState)(false), [S, F] = (0, oe.useState)(), g = (0, oe.useRef)(null), { videoConstraints: v } = jc(e), O = (0, oe.useMemo)(() => !!(Yn() && m === "CAPTURE"), [m]), { enterFullScreen: x, exitFullScreen: M } = zc(O, d), E = (0, Hc.useIntl)(), P = (0, oe.useCallback)(async () => {
|
|
2681
2681
|
var W, X, ke, nt, br, xr;
|
|
2682
2682
|
if ((W = g == null ? void 0 : g.current) != null && W.video && ((ke = (X = g == null ? void 0 : g.current) == null ? void 0 : X.video) == null ? void 0 : ke.readyState) >= 3) {
|
|
2683
2683
|
(br = (nt = g == null ? void 0 : g.current) == null ? void 0 : nt.video) == null || br.pause();
|
|
@@ -2695,19 +2695,19 @@ var require_main_min = __commonJS({
|
|
|
2695
2695
|
if (p("ERROR"), W instanceof DOMException)
|
|
2696
2696
|
switch (W == null ? void 0 : W.name) {
|
|
2697
2697
|
case "NotAllowedError":
|
|
2698
|
-
y({ title: E.formatMessage(pe.noCameraAccessTitle), description: E.formatMessage(pe.noCameraAccessParagraph), actionButton: E.formatMessage(pe.noCameraAccessAction), onAction: B }), ya("Dynamic Flow - Camera Permission Denied",
|
|
2698
|
+
y({ title: E.formatMessage(pe.noCameraAccessTitle), description: E.formatMessage(pe.noCameraAccessParagraph), actionButton: E.formatMessage(pe.noCameraAccessAction), onAction: B }), ya("Dynamic Flow - Camera Permission Denied", d, W);
|
|
2699
2699
|
return;
|
|
2700
2700
|
case "NotFoundError":
|
|
2701
2701
|
case "OverconstrainedError":
|
|
2702
2702
|
case "AbortError":
|
|
2703
2703
|
case "NotReadableError":
|
|
2704
|
-
y({ title: E.formatMessage(pe.cameraConnectionIssueTitle), description: E.formatMessage(pe.cameraConnectionIssueParagraph), actionButton: E.formatMessage(pe.cameraConnectionIssueAction), onAction: B }), ya("Dynamic Flow - Camera Not Accessible",
|
|
2704
|
+
y({ title: E.formatMessage(pe.cameraConnectionIssueTitle), description: E.formatMessage(pe.cameraConnectionIssueParagraph), actionButton: E.formatMessage(pe.cameraConnectionIssueAction), onAction: B }), ya("Dynamic Flow - Camera Not Accessible", d, W);
|
|
2705
2705
|
return;
|
|
2706
2706
|
}
|
|
2707
|
-
y({ title: E.formatMessage(pe.cameraNotSupportedTitle), description: E.formatMessage(pe.cameraNotSupportedParagraph) }), ya("Dynamic Flow - Camera Not Supported",
|
|
2708
|
-
}, [E,
|
|
2709
|
-
x(), w(true),
|
|
2710
|
-
}, [
|
|
2707
|
+
y({ title: E.formatMessage(pe.cameraNotSupportedTitle), description: E.formatMessage(pe.cameraNotSupportedParagraph) }), ya("Dynamic Flow - Camera Not Supported", d, W);
|
|
2708
|
+
}, [E, d]), U = (0, oe.useCallback)((W) => {
|
|
2709
|
+
x(), w(true), l(kc(W)), Rc(d, { direction: e }, W);
|
|
2710
|
+
}, [l, d, e, x]), ee = () => {
|
|
2711
2711
|
c((S == null ? void 0 : S.blob) || null);
|
|
2712
2712
|
}, A = () => {
|
|
2713
2713
|
p("CAPTURE"), F(void 0);
|
|
@@ -2729,9 +2729,9 @@ var require_main_min = __commonJS({
|
|
|
2729
2729
|
});
|
|
2730
2730
|
}
|
|
2731
2731
|
function ep(e) {
|
|
2732
|
-
let { step: t, model: r, onModelChange: a, onAction: o } = e, n = re(), i = Gc(t), c = tp(t),
|
|
2732
|
+
let { step: t, model: r, onModelChange: a, onAction: o } = e, n = re(), i = Gc(t), c = tp(t), d = rp(t), { title: m, image: p, cameraConfig: h } = c, { assets: y, direction: u, instructions: l } = h || {}, { overlay: f, outline: w } = y || {}, { url: S } = p || {}, [F, g] = (0, ga.useState)(false);
|
|
2733
2733
|
(0, ga.useEffect)(() => {
|
|
2734
|
-
F && o(
|
|
2734
|
+
F && o(d);
|
|
2735
2735
|
}, [r]);
|
|
2736
2736
|
let v = async (O) => {
|
|
2737
2737
|
let { $id: x } = c;
|
|
@@ -2740,7 +2740,7 @@ var require_main_min = __commonJS({
|
|
|
2740
2740
|
g(true), a({ model: E, formSchema: i, triggerModel: M, triggerSchema: c });
|
|
2741
2741
|
}
|
|
2742
2742
|
};
|
|
2743
|
-
return (0, Wc.jsx)(_o, { overlay: f, outline: w, title: m, imageUrl: S, instructions:
|
|
2743
|
+
return (0, Wc.jsx)(_o, { overlay: f, outline: w, title: m, imageUrl: S, instructions: l, direction: u, onEvent: n, onCapture: (O) => {
|
|
2744
2744
|
v(O);
|
|
2745
2745
|
} });
|
|
2746
2746
|
}
|
|
@@ -2796,8 +2796,8 @@ var require_main_min = __commonJS({
|
|
|
2796
2796
|
var Zc = np;
|
|
2797
2797
|
var Pe = require("react/jsx-runtime");
|
|
2798
2798
|
function Kr(e) {
|
|
2799
|
-
var
|
|
2800
|
-
let { step: t, globalError: r, onAction: a } = e, o = (
|
|
2799
|
+
var d, m, p;
|
|
2800
|
+
let { step: t, globalError: r, onAction: a } = e, o = (d = t == null ? void 0 : t.external) == null ? void 0 : d.url, n = ((m = t == null ? void 0 : t.navigation) == null ? void 0 : m.back) || ((p = t == null ? void 0 : t.navigation) == null ? void 0 : p.backButton), { requiresManualTrigger: i, dismissConfirmation: c } = ei(o);
|
|
2801
2801
|
return t === void 0 ? r ? (0, Pe.jsx)(se, { component: { context: "negative", markdown: r, margin: "lg" } }) : null : o && i ? (0, Pe.jsx)(Ca, { url: o, onClose: c }) : Jn(t) ? (0, Pe.jsx)(wa, C(s({}, e), { step: t })) : (0, Pe.jsxs)(Pe.Fragment, { children: [n && (0, Pe.jsx)(Zc, C(s({}, n), { onAction: a })), r ? (0, Pe.jsx)(se, { component: { context: "negative", markdown: r, margin: "lg" } }) : null, (0, Pe.jsx)(ua, C(s({}, e), { stepSpecification: t }))] });
|
|
2802
2802
|
}
|
|
2803
2803
|
var Qc = require("react");
|
|
@@ -2817,8 +2817,8 @@ var require_main_min = __commonJS({
|
|
|
2817
2817
|
var sp = (e) => dt(e) === "basic" && e.type !== "boolean" && e.format !== "base64url";
|
|
2818
2818
|
var Xt = require("react");
|
|
2819
2819
|
var am = (e) => {
|
|
2820
|
-
var u,
|
|
2821
|
-
let [t, r] = (0, Xt.useState)((u = e == null ? void 0 : e.errors) == null ? void 0 : u.validation), [a, o] = (0, Xt.useState)((
|
|
2820
|
+
var u, l;
|
|
2821
|
+
let [t, r] = (0, Xt.useState)((u = e == null ? void 0 : e.errors) == null ? void 0 : u.validation), [a, o] = (0, Xt.useState)((l = e == null ? void 0 : e.errors) == null ? void 0 : l.error), [n, i] = (0, Xt.useState)({ step: e || void 0, models: e != null && e.model ? tm(e.model, rm(e)) : {}, etag: void 0 }), { step: c, models: d, etag: m } = n, p = (f, w) => {
|
|
2822
2822
|
var S, F, g, v;
|
|
2823
2823
|
i((O) => ({ step: f, models: f.model ? tm(f.model, rm(f)) : O.models, etag: w })), r((F = (S = f == null ? void 0 : f.errors) == null ? void 0 : S.validation) != null ? F : null), o((v = (g = f == null ? void 0 : f.errors) == null ? void 0 : g.error) != null ? v : null);
|
|
2824
2824
|
}, h = (f, w, S) => {
|
|
@@ -2826,8 +2826,8 @@ var require_main_min = __commonJS({
|
|
|
2826
2826
|
let g = C(s({}, F.models), { [f]: w }), v = { step: F.step, models: g, etag: F.etag };
|
|
2827
2827
|
return S(g), v;
|
|
2828
2828
|
});
|
|
2829
|
-
}, y = (0, Xt.useMemo)(() => mp(
|
|
2830
|
-
return { formErrors: t, globalError: a, step: c, models:
|
|
2829
|
+
}, y = (0, Xt.useMemo)(() => mp(d, cp(c)), [d, c]);
|
|
2830
|
+
return { formErrors: t, globalError: a, step: c, models: d, etag: m, modelIsValid: y, setFormErrors: r, setGlobalError: o, setStepAndEtag: p, setSchemaModel: h };
|
|
2831
2831
|
};
|
|
2832
2832
|
var tm = (e, t = []) => t.reduce((r, a) => (a.$id || console.warn("Schema without $id property found."), C(s({}, r), { [a.$id || ""]: ce(e, a) || {} })), {});
|
|
2833
2833
|
var rm = (e) => [...Sa((e == null ? void 0 : e.layout) || []), ...(e == null ? void 0 : e.schemas) || []];
|
|
@@ -2973,15 +2973,15 @@ var require_main_min = __commonJS({
|
|
|
2973
2973
|
var We = require("react/jsx-runtime");
|
|
2974
2974
|
var wm = () => {
|
|
2975
2975
|
};
|
|
2976
|
-
var pp = ({ flowId: e, httpClient: t, initialAction: r, initialStep: a, loaderConfig: o, displayStepTitle: n = true, features: i, onCompletion: c, onError:
|
|
2977
|
-
let { locale: h } = (0, Cm.useIntl)(), { formErrors: y, globalError: u, step:
|
|
2976
|
+
var pp = ({ flowId: e, httpClient: t, initialAction: r, initialStep: a, loaderConfig: o, displayStepTitle: n = true, features: i, onCompletion: c, onError: d, onEvent: m = wm, onLog: p = wm }) => {
|
|
2977
|
+
let { locale: h } = (0, Cm.useIntl)(), { formErrors: y, globalError: u, step: l, models: f, etag: w, modelIsValid: S, setFormErrors: F, setGlobalError: g, setStepAndEtag: v, setSchemaModel: O } = am(a), [x, M] = (0, Me.useState)(false), { isLoading: E, loader: P, setLoadingState: D } = im(o, a ? "idle" : "initial"), U = mt("critical", p, e, (l == null ? void 0 : l.id) || (l == null ? void 0 : l.key)), ee = (0, Me.useMemo)(() => {
|
|
2978
2978
|
var b;
|
|
2979
|
-
return s({ flowId: e, stepId: (
|
|
2980
|
-
}, [e,
|
|
2979
|
+
return s({ flowId: e, stepId: (l == null ? void 0 : l.id) || (l == null ? void 0 : l.key) }, (b = l == null ? void 0 : l.analytics) != null ? b : {});
|
|
2980
|
+
}, [e, l]), A = (0, Me.useMemo)(() => Ea(m, ee), [m, ee]), B = (0, Me.useCallback)(({ action: b, data: q, etag: T }) => {
|
|
2981
2981
|
let { url: te, method: st = "POST" } = b;
|
|
2982
2982
|
return t(te != null ? te : "", { method: st, headers: s({ "accept-language": h, "Content-Type": "application/json" }, T ? { "If-None-Match": T } : {}), credentials: "include", body: st === "GET" ? void 0 : JSON.stringify(q) });
|
|
2983
2983
|
}, [t, h]), k = async (b, q = {}) => {
|
|
2984
|
-
D(
|
|
2984
|
+
D(l ? "submission" : "initial"), A("Dynamic Flow - Step Submitted", { actionId: b.id || b.$id });
|
|
2985
2985
|
try {
|
|
2986
2986
|
let T = await B({ action: b, data: q });
|
|
2987
2987
|
if (b.exit && T.ok) {
|
|
@@ -3036,7 +3036,7 @@ var require_main_min = __commonJS({
|
|
|
3036
3036
|
let q = b.refreshUrl || b.refreshFormUrl;
|
|
3037
3037
|
q && await ie(q, xa(f), w), b.validation && F(b.validation), b.error && g(b.error), D("idle");
|
|
3038
3038
|
}, it = (b, q, T, te) => {
|
|
3039
|
-
U("Error fetching", q), T === "refresh" && A("Dynamic Flow - Step Refreshed", { status: "failure" }), A("Dynamic Flow - Flow Finished", { status: "failure" }),
|
|
3039
|
+
U("Error fetching", q), T === "refresh" && A("Dynamic Flow - Step Refreshed", { status: "failure" }), A("Dynamic Flow - Flow Finished", { status: "failure" }), d(b, te), D("idle");
|
|
3040
3040
|
}, xt = (b) => {
|
|
3041
3041
|
let { model: q, formSchema: T } = b, { $id: te = "" } = T;
|
|
3042
3042
|
g(null), $(q) || U("Invalid model on change", "onModelChange was called but the model argument is not an object"), O(te, q, (vr) => {
|
|
@@ -3045,7 +3045,7 @@ var require_main_min = __commonJS({
|
|
|
3045
3045
|
}, va = (b, q) => {
|
|
3046
3046
|
let { triggerSchema: T } = b;
|
|
3047
3047
|
if (hp(b)) {
|
|
3048
|
-
let te = T.refreshUrl || T.refreshFormUrl, st = (
|
|
3048
|
+
let te = T.refreshUrl || T.refreshFormUrl, st = (l == null ? void 0 : l.refreshUrl) || (l == null ? void 0 : l.refreshFormUrl), vr = te || st;
|
|
3049
3049
|
vr && X(vr, xa(q), w, T);
|
|
3050
3050
|
}
|
|
3051
3051
|
}, Bm = async (b) => {
|
|
@@ -3058,7 +3058,7 @@ var require_main_min = __commonJS({
|
|
|
3058
3058
|
let { data: q, method: T, skipValidation: te } = b, st = s(s({}, xa(f)), q);
|
|
3059
3059
|
fp(T) ? (F(null), te || M(true), (S || te) && await k(b, st)) : await k(b);
|
|
3060
3060
|
};
|
|
3061
|
-
return (0, We.jsx)(Dr, { flowId: e, stepId: (
|
|
3061
|
+
return (0, We.jsx)(Dr, { flowId: e, stepId: (l == null ? void 0 : l.id) || (l == null ? void 0 : l.key), onLog: p, children: (0, We.jsx)(Mr, { metadata: ee, onEvent: m, children: (0, We.jsx)(pn, { loading: E, children: (0, We.jsx)(gn, { httpClient: t, children: (0, We.jsx)(Fn, { features: i, children: P !== null ? P : (0, We.jsx)(Kr, { step: l, model: xa(f), submitted: x, globalError: u, formErrors: y, stepLayoutOptions: { displayStepTitle: n }, onAction: (b) => {
|
|
3062
3062
|
Bm(b);
|
|
3063
3063
|
}, onModelChange: xt }) }) }) }) }) });
|
|
3064
3064
|
};
|