@wise/dynamic-flow-client 2.3.0-beta-c55f65.18 → 2.3.0-beta-923c14.19
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 +490 -472
- package/build/main.min.js +1 -1
- package/build/types/common/contexts/featureContext/FeatureContext.d.ts +9 -0
- package/build/types/dynamicFlow/DynamicFlowTypes.d.ts +4 -0
- package/build/types/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +1 -1
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -1017,7 +1017,7 @@ function isReference(block) {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
|
|
1019
1019
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
1020
|
-
var
|
|
1020
|
+
var import_react43 = require("react");
|
|
1021
1021
|
var import_react_intl34 = require("react-intl");
|
|
1022
1022
|
|
|
1023
1023
|
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
@@ -1179,6 +1179,19 @@ var useLogger = () => {
|
|
|
1179
1179
|
return logging;
|
|
1180
1180
|
};
|
|
1181
1181
|
|
|
1182
|
+
// src/common/contexts/featureContext/FeatureContext.tsx
|
|
1183
|
+
var import_react6 = require("react");
|
|
1184
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1185
|
+
var defaultFeatureContext = {};
|
|
1186
|
+
var FeatureContext = (0, import_react6.createContext)(defaultFeatureContext);
|
|
1187
|
+
var FeatureContextProvider = ({ featureFlags, children }) => {
|
|
1188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeatureContext.Provider, { value: featureFlags, children });
|
|
1189
|
+
};
|
|
1190
|
+
var useFeatureContext = () => {
|
|
1191
|
+
const context = (0, import_react6.useContext)(FeatureContext);
|
|
1192
|
+
return context || defaultFeatureContext;
|
|
1193
|
+
};
|
|
1194
|
+
|
|
1182
1195
|
// src/common/validators/types/type-validators.ts
|
|
1183
1196
|
var isString = (value) => typeof value === "string";
|
|
1184
1197
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
@@ -1901,18 +1914,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
1901
1914
|
};
|
|
1902
1915
|
|
|
1903
1916
|
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1904
|
-
var
|
|
1917
|
+
var import_react7 = require("react");
|
|
1905
1918
|
function useDebouncedFunction(callback, waitMs) {
|
|
1906
|
-
return (0,
|
|
1919
|
+
return (0, import_react7.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
1907
1920
|
}
|
|
1908
1921
|
|
|
1909
1922
|
// src/common/hooks/useExternal/useExternal.tsx
|
|
1910
|
-
var
|
|
1923
|
+
var import_react8 = require("react");
|
|
1911
1924
|
function useExternal(url) {
|
|
1912
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
1913
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
1925
|
+
const [externalWindow, setExternalWindow] = (0, import_react8.useState)(null);
|
|
1926
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react8.useState)(false);
|
|
1914
1927
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
1915
|
-
(0,
|
|
1928
|
+
(0, import_react8.useEffect)(() => {
|
|
1916
1929
|
if (url) {
|
|
1917
1930
|
setHasManuallyTriggered(false);
|
|
1918
1931
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -1923,10 +1936,10 @@ function useExternal(url) {
|
|
|
1923
1936
|
}
|
|
1924
1937
|
|
|
1925
1938
|
// src/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1926
|
-
var
|
|
1939
|
+
var import_react9 = require("react");
|
|
1927
1940
|
function useExternalStepPolling(polling, onAction) {
|
|
1928
1941
|
const httpClient = useHttpClient();
|
|
1929
|
-
const asyncFn = (0,
|
|
1942
|
+
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
1930
1943
|
if (polling) {
|
|
1931
1944
|
return () => {
|
|
1932
1945
|
return httpClient(polling.url).then((response) => {
|
|
@@ -1945,7 +1958,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1945
1958
|
return void 0;
|
|
1946
1959
|
}
|
|
1947
1960
|
}, [polling, httpClient]);
|
|
1948
|
-
const onPollingResponse = (0,
|
|
1961
|
+
const onPollingResponse = (0, import_react9.useCallback)(
|
|
1949
1962
|
(pollingResponse) => {
|
|
1950
1963
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
1951
1964
|
const responseHandler = responseHandlers.find(
|
|
@@ -1972,7 +1985,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1972
1985
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
1973
1986
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
1974
1987
|
onPollingResponse,
|
|
1975
|
-
onFailure: (0,
|
|
1988
|
+
onFailure: (0, import_react9.useCallback)(() => {
|
|
1976
1989
|
if (polling) {
|
|
1977
1990
|
onAction(polling.onError.action);
|
|
1978
1991
|
}
|
|
@@ -1981,7 +1994,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1981
1994
|
}
|
|
1982
1995
|
|
|
1983
1996
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1984
|
-
var
|
|
1997
|
+
var import_react30 = require("react");
|
|
1985
1998
|
var import_react_intl21 = require("react-intl");
|
|
1986
1999
|
|
|
1987
2000
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
@@ -1995,7 +2008,7 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
1995
2008
|
});
|
|
1996
2009
|
|
|
1997
2010
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1998
|
-
var
|
|
2011
|
+
var import_react29 = require("react");
|
|
1999
2012
|
var import_react_intl20 = require("react-intl");
|
|
2000
2013
|
|
|
2001
2014
|
// src/common/constants/DateMode.ts
|
|
@@ -2040,7 +2053,7 @@ var Size = {
|
|
|
2040
2053
|
|
|
2041
2054
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2042
2055
|
var import_classnames6 = __toESM(require_classnames());
|
|
2043
|
-
var
|
|
2056
|
+
var import_react28 = require("react");
|
|
2044
2057
|
|
|
2045
2058
|
// src/layout/alert/DynamicAlert.tsx
|
|
2046
2059
|
var import_components2 = require("@transferwise/components");
|
|
@@ -2049,7 +2062,7 @@ var import_components2 = require("@transferwise/components");
|
|
|
2049
2062
|
var import_components = require("@transferwise/components");
|
|
2050
2063
|
|
|
2051
2064
|
// src/layout/icon/FlagIcon.tsx
|
|
2052
|
-
var
|
|
2065
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2053
2066
|
var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
|
|
2054
2067
|
var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
|
|
2055
2068
|
var isCountryFlagIcon = (name) => countryCodes.some((countryCode) => name === `flag-${countryCode}`);
|
|
@@ -2058,7 +2071,7 @@ var FlagIcon = ({ name }) => {
|
|
|
2058
2071
|
return null;
|
|
2059
2072
|
}
|
|
2060
2073
|
const code = name.substring(5);
|
|
2061
|
-
return /* @__PURE__ */ (0,
|
|
2074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2062
2075
|
"img",
|
|
2063
2076
|
{
|
|
2064
2077
|
src: `https://wise.com/web-art/assets/flags/${code}.svg`,
|
|
@@ -2252,7 +2265,7 @@ var countryCodes = [
|
|
|
2252
2265
|
|
|
2253
2266
|
// src/layout/icon/NamedIcon.tsx
|
|
2254
2267
|
var icons = __toESM(require("@transferwise/icons"));
|
|
2255
|
-
var
|
|
2268
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2256
2269
|
var isNamedIcon = (name) => {
|
|
2257
2270
|
const iconName = toCapitalisedCamelCase(name);
|
|
2258
2271
|
return Object.keys(icons).includes(iconName);
|
|
@@ -2263,7 +2276,7 @@ var NamedIcon = ({ name }) => {
|
|
|
2263
2276
|
}
|
|
2264
2277
|
const iconName = toCapitalisedCamelCase(name);
|
|
2265
2278
|
const Icon = icons[iconName];
|
|
2266
|
-
return /* @__PURE__ */ (0,
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: 24 });
|
|
2267
2280
|
};
|
|
2268
2281
|
var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
|
|
2269
2282
|
var capitaliseFirstChar = (value) => {
|
|
@@ -2272,13 +2285,13 @@ var capitaliseFirstChar = (value) => {
|
|
|
2272
2285
|
};
|
|
2273
2286
|
|
|
2274
2287
|
// src/layout/icon/DynamicIcon.tsx
|
|
2275
|
-
var
|
|
2288
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2276
2289
|
var DynamicIcon = ({ type }) => {
|
|
2277
2290
|
if (isFlagIcon(type)) {
|
|
2278
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FlagIcon, { name: type });
|
|
2279
2292
|
}
|
|
2280
2293
|
if (isNamedIcon(type)) {
|
|
2281
|
-
return /* @__PURE__ */ (0,
|
|
2294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamedIcon, { name: type });
|
|
2282
2295
|
}
|
|
2283
2296
|
return null;
|
|
2284
2297
|
};
|
|
@@ -2288,17 +2301,17 @@ function isValidIconName(name) {
|
|
|
2288
2301
|
var DynamicIcon_default = DynamicIcon;
|
|
2289
2302
|
|
|
2290
2303
|
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2291
|
-
var
|
|
2304
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2292
2305
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
2293
2306
|
if (icon == null ? void 0 : icon.name) {
|
|
2294
|
-
return /* @__PURE__ */ (0,
|
|
2307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components.Avatar, { type: import_components.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DynamicIcon_default, { type: icon.name }) });
|
|
2295
2308
|
}
|
|
2296
2309
|
if (icon == null ? void 0 : icon.text) {
|
|
2297
|
-
return /* @__PURE__ */ (0,
|
|
2310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components.Avatar, { type: import_components.AvatarType.INITIALS, children: icon.text });
|
|
2298
2311
|
}
|
|
2299
2312
|
if (image == null ? void 0 : image.url) {
|
|
2300
2313
|
const { url, text } = image;
|
|
2301
|
-
return /* @__PURE__ */ (0,
|
|
2314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { src: url, alt: text });
|
|
2302
2315
|
}
|
|
2303
2316
|
return null;
|
|
2304
2317
|
};
|
|
@@ -2334,10 +2347,10 @@ var getTextAlignment = (align) => {
|
|
|
2334
2347
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
2335
2348
|
|
|
2336
2349
|
// src/layout/alert/DynamicAlert.tsx
|
|
2337
|
-
var
|
|
2350
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2338
2351
|
var DynamicAlert = (props) => {
|
|
2339
2352
|
const alert = props.component;
|
|
2340
|
-
return /* @__PURE__ */ (0,
|
|
2353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2341
2354
|
import_components2.Alert,
|
|
2342
2355
|
{
|
|
2343
2356
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
@@ -2370,12 +2383,12 @@ var mapContextToAlertType = (context) => {
|
|
|
2370
2383
|
var DynamicAlert_default = DynamicAlert;
|
|
2371
2384
|
|
|
2372
2385
|
// src/layout/box/DynamicBox.tsx
|
|
2373
|
-
var
|
|
2386
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2374
2387
|
var DynamicBox = (props) => {
|
|
2375
2388
|
const box = props.component;
|
|
2376
2389
|
const margin = getMargin(box.margin || box.border ? "lg" : "xs");
|
|
2377
2390
|
if (!box.width || box.width === "xl") {
|
|
2378
|
-
return /* @__PURE__ */ (0,
|
|
2391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2379
2392
|
DynamicLayout_default,
|
|
2380
2393
|
{
|
|
2381
2394
|
components: box.components,
|
|
@@ -2388,7 +2401,7 @@ var DynamicBox = (props) => {
|
|
|
2388
2401
|
}
|
|
2389
2402
|
) });
|
|
2390
2403
|
}
|
|
2391
|
-
return /* @__PURE__ */ (0,
|
|
2404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2392
2405
|
DynamicLayout_default,
|
|
2393
2406
|
{
|
|
2394
2407
|
components: box.components,
|
|
@@ -2465,7 +2478,7 @@ var getButtonSize = (size) => {
|
|
|
2465
2478
|
};
|
|
2466
2479
|
|
|
2467
2480
|
// src/layout/button/DynamicButton.tsx
|
|
2468
|
-
var
|
|
2481
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2469
2482
|
var DynamicButton = (props) => {
|
|
2470
2483
|
var _a;
|
|
2471
2484
|
const { component, onAction } = props;
|
|
@@ -2474,7 +2487,7 @@ var DynamicButton = (props) => {
|
|
|
2474
2487
|
const priority = getButtonPriority(component);
|
|
2475
2488
|
const { loading } = useDynamicFlow();
|
|
2476
2489
|
const className = getMargin(component.margin || "md");
|
|
2477
|
-
return /* @__PURE__ */ (0,
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2478
2491
|
import_components3.Button,
|
|
2479
2492
|
{
|
|
2480
2493
|
size: getButtonSize(component.size),
|
|
@@ -2491,12 +2504,12 @@ var DynamicButton = (props) => {
|
|
|
2491
2504
|
var DynamicButton_default = DynamicButton;
|
|
2492
2505
|
|
|
2493
2506
|
// src/layout/columns/DynamicColumns.tsx
|
|
2494
|
-
var
|
|
2507
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2495
2508
|
var DynamicColumns = (props) => {
|
|
2496
2509
|
const columns = props.component;
|
|
2497
2510
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
2498
|
-
return /* @__PURE__ */ (0,
|
|
2499
|
-
/* @__PURE__ */ (0,
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${getMargin(columns.margin || "xs")} row`, children: [
|
|
2512
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2500
2513
|
DynamicLayout_default,
|
|
2501
2514
|
{
|
|
2502
2515
|
components: columns.left,
|
|
@@ -2508,7 +2521,7 @@ var DynamicColumns = (props) => {
|
|
|
2508
2521
|
onPersistAsync: props.onPersistAsync
|
|
2509
2522
|
}
|
|
2510
2523
|
) }),
|
|
2511
|
-
/* @__PURE__ */ (0,
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2512
2525
|
DynamicLayout_default,
|
|
2513
2526
|
{
|
|
2514
2527
|
components: columns.right,
|
|
@@ -2544,8 +2557,8 @@ var DynamicColumns_default = DynamicColumns;
|
|
|
2544
2557
|
|
|
2545
2558
|
// src/layout/decision/DynamicDecision.tsx
|
|
2546
2559
|
var import_components4 = require("@transferwise/components");
|
|
2547
|
-
var
|
|
2548
|
-
var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0,
|
|
2560
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2561
|
+
var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getMargin(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components4.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2549
2562
|
import_components4.NavigationOption,
|
|
2550
2563
|
{
|
|
2551
2564
|
title: option.title,
|
|
@@ -2561,17 +2574,17 @@ var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0, import_js
|
|
|
2561
2574
|
var DynamicDecision_default = DynamicDecision;
|
|
2562
2575
|
|
|
2563
2576
|
// src/layout/divider/DynamicDivider.tsx
|
|
2564
|
-
var
|
|
2577
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2565
2578
|
var DynamicDivider = ({ component }) => {
|
|
2566
2579
|
const margin = getMargin(component.margin);
|
|
2567
2580
|
const className = `m-t-0 ${margin}`;
|
|
2568
|
-
return /* @__PURE__ */ (0,
|
|
2581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("hr", { className });
|
|
2569
2582
|
};
|
|
2570
2583
|
var DynamicDivider_default = DynamicDivider;
|
|
2571
2584
|
|
|
2572
2585
|
// src/layout/external/DynamicExternal.tsx
|
|
2573
2586
|
var import_components5 = require("@transferwise/components");
|
|
2574
|
-
var
|
|
2587
|
+
var import_react10 = require("react");
|
|
2575
2588
|
var import_react_intl3 = require("react-intl");
|
|
2576
2589
|
|
|
2577
2590
|
// src/layout/external/DynamicExternal.messages.js
|
|
@@ -2585,36 +2598,36 @@ var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
|
2585
2598
|
});
|
|
2586
2599
|
|
|
2587
2600
|
// src/layout/external/DynamicExternal.tsx
|
|
2588
|
-
var
|
|
2601
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2589
2602
|
var DynamicExternal = ({ component, onAction }) => {
|
|
2590
2603
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
2591
2604
|
const intl = (0, import_react_intl3.useIntl)();
|
|
2592
|
-
const openExternalUrl = (0,
|
|
2605
|
+
const openExternalUrl = (0, import_react10.useCallback)(
|
|
2593
2606
|
() => window.open(requestUrl, "df-external-window"),
|
|
2594
2607
|
[requestUrl]
|
|
2595
2608
|
);
|
|
2596
|
-
(0,
|
|
2609
|
+
(0, import_react10.useEffect)(() => {
|
|
2597
2610
|
openExternalUrl();
|
|
2598
2611
|
}, [openExternalUrl]);
|
|
2599
2612
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
2600
2613
|
responseHandlers
|
|
2601
2614
|
}) : void 0;
|
|
2602
2615
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
2603
|
-
return /* @__PURE__ */ (0,
|
|
2604
|
-
/* @__PURE__ */ (0,
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2606
|
-
/* @__PURE__ */ (0,
|
|
2616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components5.Loader, { size: import_components5.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("br", {}),
|
|
2619
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components5.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
2607
2620
|
] });
|
|
2608
2621
|
};
|
|
2609
2622
|
var DynamicExternal_default = DynamicExternal;
|
|
2610
2623
|
|
|
2611
2624
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2612
|
-
var
|
|
2625
|
+
var import_react22 = require("react");
|
|
2613
2626
|
|
|
2614
2627
|
// src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2615
2628
|
var import_classnames = __toESM(require_classnames());
|
|
2616
|
-
var
|
|
2617
|
-
var
|
|
2629
|
+
var import_react11 = require("react");
|
|
2630
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2618
2631
|
var splitModel = (model, schemas) => {
|
|
2619
2632
|
return schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
2620
2633
|
};
|
|
@@ -2637,13 +2650,13 @@ var AllOfSchema = (props) => {
|
|
|
2637
2650
|
setModels(models);
|
|
2638
2651
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
2639
2652
|
};
|
|
2640
|
-
const [models, setModels] = (0,
|
|
2641
|
-
return /* @__PURE__ */ (0,
|
|
2642
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
2643
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
2644
|
-
/* @__PURE__ */ (0,
|
|
2653
|
+
const [models, setModels] = (0, import_react11.useState)(splitModel(props.model, props.schema.allOf));
|
|
2654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2655
|
+
props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: "page-header", children: props.schema.title }),
|
|
2656
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: props.schema.description }),
|
|
2657
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
2645
2658
|
// eslint-disable-next-line react/no-array-index-key
|
|
2646
|
-
/* @__PURE__ */ (0,
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_classnames.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2647
2660
|
GenericSchema_default,
|
|
2648
2661
|
{
|
|
2649
2662
|
schema,
|
|
@@ -2669,7 +2682,7 @@ var AllOfSchema_default = AllOfSchema;
|
|
|
2669
2682
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2670
2683
|
var import_components7 = require("@transferwise/components");
|
|
2671
2684
|
var import_classnames2 = __toESM(require_classnames());
|
|
2672
|
-
var
|
|
2685
|
+
var import_react12 = require("react");
|
|
2673
2686
|
|
|
2674
2687
|
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2675
2688
|
var import_components6 = require("@transferwise/components");
|
|
@@ -2732,7 +2745,7 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
|
|
|
2732
2745
|
});
|
|
2733
2746
|
|
|
2734
2747
|
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2735
|
-
var
|
|
2748
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2736
2749
|
var ControlFeedback = (props) => {
|
|
2737
2750
|
var _a;
|
|
2738
2751
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -2741,12 +2754,12 @@ var ControlFeedback = (props) => {
|
|
|
2741
2754
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!((_a = props.validations) == null ? void 0 : _a.length);
|
|
2742
2755
|
const isDescriptionVisible = props.focused && props.schema.description && !isValidationVisible;
|
|
2743
2756
|
const hasInfoMessage = !!props.infoMessage;
|
|
2744
|
-
return /* @__PURE__ */ (0,
|
|
2745
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
2746
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
2747
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
2748
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
2749
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
2757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id: props.id, children: [
|
|
2758
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components6.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
2759
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components6.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
2760
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components6.InlineAlert, { type: "info", children: [
|
|
2761
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: props.schema.description }),
|
|
2762
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: props.infoMessage })
|
|
2750
2763
|
] })
|
|
2751
2764
|
] });
|
|
2752
2765
|
};
|
|
@@ -2888,15 +2901,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
2888
2901
|
}
|
|
2889
2902
|
|
|
2890
2903
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2891
|
-
var
|
|
2904
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2892
2905
|
var MultipleFileUploadSchema = (props) => {
|
|
2893
2906
|
var _a, _b;
|
|
2894
2907
|
const { onChange, schema } = props;
|
|
2895
2908
|
const onEvent = useEventDispatcher();
|
|
2896
2909
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
2897
|
-
const uid = (0,
|
|
2898
|
-
const [inputChanged, setInputChanged] = (0,
|
|
2899
|
-
const [files, setFiles] = (0,
|
|
2910
|
+
const uid = (0, import_react12.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
2911
|
+
const [inputChanged, setInputChanged] = (0, import_react12.useState)(false);
|
|
2912
|
+
const [files, setFiles] = (0, import_react12.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
2900
2913
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
2901
2914
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
2902
2915
|
const isBlob = isBlobSchema(fileSchemaDescriptor);
|
|
@@ -2950,10 +2963,10 @@ var MultipleFileUploadSchema = (props) => {
|
|
|
2950
2963
|
onDeleteFile: () => Promise.resolve()
|
|
2951
2964
|
});
|
|
2952
2965
|
const feedbackId = `${uid}-feedback`;
|
|
2953
|
-
return /* @__PURE__ */ (0,
|
|
2954
|
-
/* @__PURE__ */ (0,
|
|
2955
|
-
/* @__PURE__ */ (0,
|
|
2956
|
-
/* @__PURE__ */ (0,
|
|
2966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
2969
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2957
2970
|
ControlFeedback_default,
|
|
2958
2971
|
{
|
|
2959
2972
|
id: feedbackId,
|
|
@@ -2996,17 +3009,17 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
2996
3009
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
2997
3010
|
var import_components9 = require("@transferwise/components");
|
|
2998
3011
|
var import_icons = require("@transferwise/icons");
|
|
2999
|
-
var
|
|
3012
|
+
var import_react13 = require("react");
|
|
3000
3013
|
var import_react_intl11 = require("react-intl");
|
|
3001
3014
|
|
|
3002
3015
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
3003
3016
|
var import_components8 = require("@transferwise/components");
|
|
3004
|
-
var
|
|
3017
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3005
3018
|
var ItemSummaryOption = ({
|
|
3006
3019
|
item,
|
|
3007
3020
|
onClick
|
|
3008
3021
|
}) => {
|
|
3009
|
-
return /* @__PURE__ */ (0,
|
|
3022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3010
3023
|
import_components8.NavigationOption,
|
|
3011
3024
|
{
|
|
3012
3025
|
onClick,
|
|
@@ -3044,7 +3057,7 @@ var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
3044
3057
|
|
|
3045
3058
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3046
3059
|
var import_react_intl10 = require("react-intl");
|
|
3047
|
-
var
|
|
3060
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3048
3061
|
var RepeatableSchemaStep = ({
|
|
3049
3062
|
type,
|
|
3050
3063
|
schema,
|
|
@@ -3084,7 +3097,7 @@ var RepeatableSchemaStep = ({
|
|
|
3084
3097
|
actions: [],
|
|
3085
3098
|
schemas: []
|
|
3086
3099
|
};
|
|
3087
|
-
return /* @__PURE__ */ (0,
|
|
3100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3088
3101
|
DynamicFlowStep,
|
|
3089
3102
|
{
|
|
3090
3103
|
step,
|
|
@@ -3282,7 +3295,7 @@ var getStringValueFromSchema = (schema, model) => {
|
|
|
3282
3295
|
var schemaSummaryProvides = (summary, providesProp) => !!summary && Object.hasOwnProperty.call(summary, providesProp) && Boolean(summary[providesProp]);
|
|
3283
3296
|
|
|
3284
3297
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3285
|
-
var
|
|
3298
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3286
3299
|
var RepeatableSchema = ({
|
|
3287
3300
|
schema,
|
|
3288
3301
|
model,
|
|
@@ -3290,8 +3303,8 @@ var RepeatableSchema = ({
|
|
|
3290
3303
|
submitted,
|
|
3291
3304
|
onChange
|
|
3292
3305
|
}) => {
|
|
3293
|
-
const [openModalType, setOpenModalType] = (0,
|
|
3294
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
3306
|
+
const [openModalType, setOpenModalType] = (0, import_react13.useState)(null);
|
|
3307
|
+
const [itemSummaries, setItemSummaries] = (0, import_react13.useState)(() => {
|
|
3295
3308
|
if (isObject(model) && !isArray(model)) {
|
|
3296
3309
|
throw new Error(
|
|
3297
3310
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -3299,7 +3312,7 @@ var RepeatableSchema = ({
|
|
|
3299
3312
|
}
|
|
3300
3313
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
3301
3314
|
});
|
|
3302
|
-
const [editableItem, setEditableItem] = (0,
|
|
3315
|
+
const [editableItem, setEditableItem] = (0, import_react13.useState)({ item: null, model: null });
|
|
3303
3316
|
const broadcastModelChange = (updatedItems) => {
|
|
3304
3317
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
3305
3318
|
onChange({
|
|
@@ -3336,9 +3349,9 @@ var RepeatableSchema = ({
|
|
|
3336
3349
|
setOpenModalType(null);
|
|
3337
3350
|
};
|
|
3338
3351
|
const { formatMessage } = (0, import_react_intl11.useIntl)();
|
|
3339
|
-
return /* @__PURE__ */ (0,
|
|
3340
|
-
schema.title && /* @__PURE__ */ (0,
|
|
3341
|
-
itemSummaries && itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
3352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3353
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components9.Header, { title: schema.title }),
|
|
3354
|
+
itemSummaries && itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3342
3355
|
ItemSummaryOption,
|
|
3343
3356
|
{
|
|
3344
3357
|
item: itemSummary,
|
|
@@ -3346,21 +3359,21 @@ var RepeatableSchema = ({
|
|
|
3346
3359
|
},
|
|
3347
3360
|
JSON.stringify(itemSummary)
|
|
3348
3361
|
)),
|
|
3349
|
-
/* @__PURE__ */ (0,
|
|
3362
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3350
3363
|
import_components9.NavigationOption,
|
|
3351
3364
|
{
|
|
3352
3365
|
onClick: onAddItem,
|
|
3353
|
-
media: /* @__PURE__ */ (0,
|
|
3366
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons.Plus, {}),
|
|
3354
3367
|
title: schema.addItemTitle || formatMessage(RepeatableSchema_messages_default.addItemTitle)
|
|
3355
3368
|
}
|
|
3356
3369
|
),
|
|
3357
|
-
/* @__PURE__ */ (0,
|
|
3370
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3358
3371
|
import_components9.Modal,
|
|
3359
3372
|
{
|
|
3360
3373
|
open: openModalType !== null,
|
|
3361
3374
|
onClose: onCancelEdit,
|
|
3362
3375
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(RepeatableSchema_messages_default.addItemTitle),
|
|
3363
|
-
body: /* @__PURE__ */ (0,
|
|
3376
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3364
3377
|
RepeatableSchemaStep_default,
|
|
3365
3378
|
{
|
|
3366
3379
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -3401,14 +3414,14 @@ var getUpdatedItemSummaries = (action, {
|
|
|
3401
3414
|
var RepeatableSchema_default = RepeatableSchema;
|
|
3402
3415
|
|
|
3403
3416
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3404
|
-
var
|
|
3417
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3405
3418
|
var ArrayListSchema = (props) => {
|
|
3406
3419
|
const { schema } = props;
|
|
3407
3420
|
if (isMultipleFileUploadSchema(schema)) {
|
|
3408
|
-
return /* @__PURE__ */ (0,
|
|
3421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3409
3422
|
}
|
|
3410
3423
|
if (isListArraySchema(schema)) {
|
|
3411
|
-
return /* @__PURE__ */ (0,
|
|
3424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3412
3425
|
}
|
|
3413
3426
|
throw new Error("Invalid array list schema");
|
|
3414
3427
|
};
|
|
@@ -3419,11 +3432,11 @@ ArrayListSchema.defaultProps = {
|
|
|
3419
3432
|
var ArrayListSchema_default = ArrayListSchema;
|
|
3420
3433
|
|
|
3421
3434
|
// src/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3422
|
-
var
|
|
3435
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3423
3436
|
var ArraySchema = (props) => {
|
|
3424
3437
|
const { schema } = props;
|
|
3425
3438
|
if (isListArraySchema(schema)) {
|
|
3426
|
-
return /* @__PURE__ */ (0,
|
|
3439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
3427
3440
|
}
|
|
3428
3441
|
throw new Error("Not implemented");
|
|
3429
3442
|
};
|
|
@@ -3434,8 +3447,8 @@ var ArraySchema_default = ArraySchema;
|
|
|
3434
3447
|
|
|
3435
3448
|
// src/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3436
3449
|
var import_classnames3 = __toESM(require_classnames());
|
|
3437
|
-
var
|
|
3438
|
-
var
|
|
3450
|
+
var import_react14 = require("react");
|
|
3451
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3439
3452
|
var getSchemaColumnClasses2 = (width) => {
|
|
3440
3453
|
return {
|
|
3441
3454
|
"col-xs-12": true,
|
|
@@ -3444,7 +3457,7 @@ var getSchemaColumnClasses2 = (width) => {
|
|
|
3444
3457
|
};
|
|
3445
3458
|
};
|
|
3446
3459
|
var ObjectSchema = (props) => {
|
|
3447
|
-
const [model, setModel] = (0,
|
|
3460
|
+
const [model, setModel] = (0, import_react14.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
3448
3461
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
3449
3462
|
if (onChangeProps.model !== null) {
|
|
3450
3463
|
model[propertyName] = onChangeProps.model;
|
|
@@ -3455,7 +3468,7 @@ var ObjectSchema = (props) => {
|
|
|
3455
3468
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
3456
3469
|
};
|
|
3457
3470
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
3458
|
-
(0,
|
|
3471
|
+
(0, import_react14.useEffect)(() => {
|
|
3459
3472
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
3460
3473
|
setModel(newModel);
|
|
3461
3474
|
if (!isEqual(newModel, model)) {
|
|
@@ -3473,25 +3486,25 @@ var ObjectSchema = (props) => {
|
|
|
3473
3486
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
3474
3487
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
3475
3488
|
const propsErrors = props.errors;
|
|
3476
|
-
return /* @__PURE__ */ (0,
|
|
3477
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
3489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("fieldset", { children: [
|
|
3490
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("legend", { children: [
|
|
3478
3491
|
" ",
|
|
3479
3492
|
props.schema.title,
|
|
3480
3493
|
" "
|
|
3481
3494
|
] }),
|
|
3482
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0,
|
|
3495
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { children: [
|
|
3483
3496
|
" ",
|
|
3484
3497
|
props.schema.description,
|
|
3485
3498
|
" "
|
|
3486
3499
|
] }),
|
|
3487
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
3488
|
-
/* @__PURE__ */ (0,
|
|
3500
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3489
3502
|
"div",
|
|
3490
3503
|
{
|
|
3491
3504
|
className: (0, import_classnames3.default)(
|
|
3492
3505
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
3493
3506
|
),
|
|
3494
|
-
children: /* @__PURE__ */ (0,
|
|
3507
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3495
3508
|
GenericSchema_default,
|
|
3496
3509
|
{
|
|
3497
3510
|
schema: props.schema.properties[propertyName],
|
|
@@ -3517,7 +3530,7 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
3517
3530
|
|
|
3518
3531
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3519
3532
|
var import_classnames4 = __toESM(require_classnames());
|
|
3520
|
-
var
|
|
3533
|
+
var import_react17 = require("react");
|
|
3521
3534
|
|
|
3522
3535
|
// src/jsonSchemaForm/help/Help.tsx
|
|
3523
3536
|
var import_components10 = require("@transferwise/components");
|
|
@@ -3534,14 +3547,14 @@ var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
3534
3547
|
});
|
|
3535
3548
|
|
|
3536
3549
|
// src/jsonSchemaForm/help/Help.tsx
|
|
3537
|
-
var
|
|
3550
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3538
3551
|
var Help = (props) => {
|
|
3539
3552
|
const intl = (0, import_react_intl13.useIntl)();
|
|
3540
|
-
return /* @__PURE__ */ (0,
|
|
3553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3541
3554
|
import_components10.Info,
|
|
3542
3555
|
{
|
|
3543
3556
|
className: "m-l-1",
|
|
3544
|
-
content: /* @__PURE__ */ (0,
|
|
3557
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components10.Markdown, { children: props.help.markdown }),
|
|
3545
3558
|
presentation: "POPOVER",
|
|
3546
3559
|
size: "sm",
|
|
3547
3560
|
"aria-label": intl.formatMessage(Help_messages_default.helpAria)
|
|
@@ -3551,11 +3564,11 @@ var Help = (props) => {
|
|
|
3551
3564
|
var Help_default = Help;
|
|
3552
3565
|
|
|
3553
3566
|
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3554
|
-
var
|
|
3567
|
+
var import_react16 = require("react");
|
|
3555
3568
|
|
|
3556
3569
|
// src/formControl/FormControl.tsx
|
|
3557
3570
|
var import_components11 = require("@transferwise/components");
|
|
3558
|
-
var
|
|
3571
|
+
var import_react15 = require("react");
|
|
3559
3572
|
|
|
3560
3573
|
// src/formControl/utils/value-utils.ts
|
|
3561
3574
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -3665,8 +3678,8 @@ var logInvalidTypeFallbackWarning = ({
|
|
|
3665
3678
|
};
|
|
3666
3679
|
|
|
3667
3680
|
// src/formControl/FormControl.tsx
|
|
3668
|
-
var
|
|
3669
|
-
var _FormControl = class _FormControl extends
|
|
3681
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3682
|
+
var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
3670
3683
|
constructor(props) {
|
|
3671
3684
|
super(props);
|
|
3672
3685
|
/**
|
|
@@ -3754,7 +3767,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3754
3767
|
} = this.props;
|
|
3755
3768
|
switch (type) {
|
|
3756
3769
|
case FormControlType.RADIO:
|
|
3757
|
-
return /* @__PURE__ */ (0,
|
|
3770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3758
3771
|
import_components11.RadioGroup,
|
|
3759
3772
|
{
|
|
3760
3773
|
radios: options.map(this.mapOption),
|
|
@@ -3764,7 +3777,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3764
3777
|
}
|
|
3765
3778
|
);
|
|
3766
3779
|
case FormControlType.CHECKBOX:
|
|
3767
|
-
return /* @__PURE__ */ (0,
|
|
3780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3768
3781
|
import_components11.Checkbox,
|
|
3769
3782
|
{
|
|
3770
3783
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
@@ -3779,7 +3792,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3779
3792
|
);
|
|
3780
3793
|
case FormControlType.SELECT: {
|
|
3781
3794
|
const search = options.length >= 20;
|
|
3782
|
-
return /* @__PURE__ */ (0,
|
|
3795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3783
3796
|
import_components11.Select,
|
|
3784
3797
|
{
|
|
3785
3798
|
id,
|
|
@@ -3803,13 +3816,13 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3803
3816
|
);
|
|
3804
3817
|
}
|
|
3805
3818
|
case FormControlType.TAB:
|
|
3806
|
-
return /* @__PURE__ */ (0,
|
|
3819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3807
3820
|
import_components11.Tabs,
|
|
3808
3821
|
{
|
|
3809
3822
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
3810
3823
|
tabs: options.map((option) => ({
|
|
3811
3824
|
title: option.label,
|
|
3812
|
-
content: /* @__PURE__ */ (0,
|
|
3825
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}),
|
|
3813
3826
|
disabled: option.disabled || false
|
|
3814
3827
|
})),
|
|
3815
3828
|
name: id,
|
|
@@ -3823,7 +3836,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3823
3836
|
}
|
|
3824
3837
|
);
|
|
3825
3838
|
case FormControlType.NUMBER:
|
|
3826
|
-
return /* @__PURE__ */ (0,
|
|
3839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3827
3840
|
"input",
|
|
3828
3841
|
{
|
|
3829
3842
|
autoComplete: this.getAutocompleteStatus(),
|
|
@@ -3852,7 +3865,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3852
3865
|
}
|
|
3853
3866
|
);
|
|
3854
3867
|
case FormControlType.HIDDEN:
|
|
3855
|
-
return /* @__PURE__ */ (0,
|
|
3868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3856
3869
|
"input",
|
|
3857
3870
|
{
|
|
3858
3871
|
type: "hidden",
|
|
@@ -3862,7 +3875,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3862
3875
|
}
|
|
3863
3876
|
);
|
|
3864
3877
|
case FormControlType.PASSWORD:
|
|
3865
|
-
return /* @__PURE__ */ (0,
|
|
3878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3866
3879
|
"input",
|
|
3867
3880
|
{
|
|
3868
3881
|
autoComplete: this.getAutocompleteStatus(),
|
|
@@ -3882,7 +3895,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3882
3895
|
);
|
|
3883
3896
|
case FormControlType.DATE:
|
|
3884
3897
|
case FormControlType.DATETIME:
|
|
3885
|
-
return /* @__PURE__ */ (0,
|
|
3898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3886
3899
|
import_components11.DateInput,
|
|
3887
3900
|
{
|
|
3888
3901
|
disabled,
|
|
@@ -3896,7 +3909,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3896
3909
|
}
|
|
3897
3910
|
);
|
|
3898
3911
|
case FormControlType.DATELOOKUP: {
|
|
3899
|
-
return /* @__PURE__ */ (0,
|
|
3912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3900
3913
|
import_components11.DateLookup,
|
|
3901
3914
|
{
|
|
3902
3915
|
value: getSafeDateStringValue(value),
|
|
@@ -3914,7 +3927,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3914
3927
|
);
|
|
3915
3928
|
}
|
|
3916
3929
|
case FormControlType.TEL:
|
|
3917
|
-
return /* @__PURE__ */ (0,
|
|
3930
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3918
3931
|
import_components11.PhoneNumberInput,
|
|
3919
3932
|
{
|
|
3920
3933
|
disabled,
|
|
@@ -3946,7 +3959,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3946
3959
|
autoComplete: this.getAutocompleteStatus()
|
|
3947
3960
|
};
|
|
3948
3961
|
if (this.props.displayPattern) {
|
|
3949
|
-
return /* @__PURE__ */ (0,
|
|
3962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3950
3963
|
import_components11.TextareaWithDisplayFormat,
|
|
3951
3964
|
__spreadProps(__spreadValues({
|
|
3952
3965
|
displayPattern: this.props.displayPattern
|
|
@@ -3955,7 +3968,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3955
3968
|
})
|
|
3956
3969
|
);
|
|
3957
3970
|
}
|
|
3958
|
-
return /* @__PURE__ */ (0,
|
|
3971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3959
3972
|
"textarea",
|
|
3960
3973
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
3961
3974
|
onChange: this.handleInputOnChange,
|
|
@@ -3968,7 +3981,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3968
3981
|
return (
|
|
3969
3982
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3970
3983
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
3971
|
-
/* @__PURE__ */ (0,
|
|
3984
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3972
3985
|
import_components11.Upload,
|
|
3973
3986
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3974
3987
|
usAccept: uploadProps.usAccept || "*",
|
|
@@ -4005,7 +4018,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
4005
4018
|
autoComplete: this.getAutocompleteStatus()
|
|
4006
4019
|
};
|
|
4007
4020
|
if (this.props.displayPattern) {
|
|
4008
|
-
return /* @__PURE__ */ (0,
|
|
4021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4009
4022
|
import_components11.InputWithDisplayFormat,
|
|
4010
4023
|
__spreadProps(__spreadValues({
|
|
4011
4024
|
displayPattern: this.props.displayPattern
|
|
@@ -4014,7 +4027,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
4014
4027
|
})
|
|
4015
4028
|
);
|
|
4016
4029
|
}
|
|
4017
|
-
return /* @__PURE__ */ (0,
|
|
4030
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4018
4031
|
"input",
|
|
4019
4032
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
4020
4033
|
onChange: this.handleInputOnChange,
|
|
@@ -4064,7 +4077,7 @@ var FormControl = _FormControl;
|
|
|
4064
4077
|
|
|
4065
4078
|
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4066
4079
|
var import_components12 = require("@transferwise/components");
|
|
4067
|
-
var
|
|
4080
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4068
4081
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
4069
4082
|
switch (controlType) {
|
|
4070
4083
|
case "select":
|
|
@@ -4092,7 +4105,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { s
|
|
|
4092
4105
|
var mapImage = (image) => {
|
|
4093
4106
|
if (image == null ? void 0 : image.url) {
|
|
4094
4107
|
return {
|
|
4095
|
-
icon: /* @__PURE__ */ (0,
|
|
4108
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
|
|
4096
4109
|
};
|
|
4097
4110
|
}
|
|
4098
4111
|
return null;
|
|
@@ -4102,27 +4115,27 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
4102
4115
|
return { currency: icon.name.substring(5) };
|
|
4103
4116
|
}
|
|
4104
4117
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4105
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4118
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DynamicIcon_default, { type: icon.name }) };
|
|
4106
4119
|
}
|
|
4107
4120
|
if (icon == null ? void 0 : icon.text) {
|
|
4108
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4121
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: icon.text }) };
|
|
4109
4122
|
}
|
|
4110
4123
|
return null;
|
|
4111
4124
|
};
|
|
4112
4125
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
4113
4126
|
if (image == null ? void 0 : image.url) {
|
|
4114
4127
|
return {
|
|
4115
|
-
avatar: /* @__PURE__ */ (0,
|
|
4128
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("img", { src: image.url, alt: "" }) })
|
|
4116
4129
|
};
|
|
4117
4130
|
}
|
|
4118
4131
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4119
4132
|
return {
|
|
4120
|
-
avatar: /* @__PURE__ */ (0,
|
|
4133
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DynamicIcon_default, { type: icon.name }) })
|
|
4121
4134
|
};
|
|
4122
4135
|
}
|
|
4123
4136
|
if (icon == null ? void 0 : icon.text) {
|
|
4124
4137
|
return {
|
|
4125
|
-
avatar: /* @__PURE__ */ (0,
|
|
4138
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.INITIALS, children: icon.text })
|
|
4126
4139
|
};
|
|
4127
4140
|
}
|
|
4128
4141
|
return null;
|
|
@@ -4143,7 +4156,7 @@ var getDisabled = (disabled) => {
|
|
|
4143
4156
|
};
|
|
4144
4157
|
|
|
4145
4158
|
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4146
|
-
var
|
|
4159
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4147
4160
|
var isNativeInput = (propsSchemaType) => {
|
|
4148
4161
|
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
4149
4162
|
};
|
|
@@ -4196,7 +4209,7 @@ var SchemaFormControl = (props) => {
|
|
|
4196
4209
|
onChange(getValidBasicModelOrNull(value2, schema), type);
|
|
4197
4210
|
};
|
|
4198
4211
|
const controlType = getControlType(schema);
|
|
4199
|
-
(0,
|
|
4212
|
+
(0, import_react16.useEffect)(() => {
|
|
4200
4213
|
warnIfInvalidSchema(schema, log, controlType);
|
|
4201
4214
|
}, [JSON.stringify(schema), log, controlType]);
|
|
4202
4215
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -4220,7 +4233,7 @@ var SchemaFormControl = (props) => {
|
|
|
4220
4233
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
4221
4234
|
describedBy
|
|
4222
4235
|
};
|
|
4223
|
-
return /* @__PURE__ */ (0,
|
|
4236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
4224
4237
|
};
|
|
4225
4238
|
SchemaFormControl.defaultProps = {
|
|
4226
4239
|
value: null,
|
|
@@ -4249,17 +4262,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4249
4262
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4250
4263
|
|
|
4251
4264
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4252
|
-
var
|
|
4265
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4253
4266
|
var OneOfSchema = (props) => {
|
|
4254
4267
|
const onEvent = useEventDispatcher();
|
|
4255
|
-
const [changed, setChanged] = (0,
|
|
4256
|
-
const [focused, setFocused] = (0,
|
|
4257
|
-
const [blurred, setBlurred] = (0,
|
|
4258
|
-
const id = (0,
|
|
4259
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
4268
|
+
const [changed, setChanged] = (0, import_react17.useState)(false);
|
|
4269
|
+
const [focused, setFocused] = (0, import_react17.useState)(false);
|
|
4270
|
+
const [blurred, setBlurred] = (0, import_react17.useState)(false);
|
|
4271
|
+
const id = (0, import_react17.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
4272
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react17.useState)(
|
|
4260
4273
|
getActiveSchemaIndex(props.schema, props.model)
|
|
4261
4274
|
);
|
|
4262
|
-
const [models, setModels] = (0,
|
|
4275
|
+
const [models, setModels] = (0, import_react17.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
4263
4276
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
4264
4277
|
const onSearchChange = (searchValue) => {
|
|
4265
4278
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -4267,7 +4280,7 @@ var OneOfSchema = (props) => {
|
|
|
4267
4280
|
searchValueLength: searchValue.length
|
|
4268
4281
|
});
|
|
4269
4282
|
};
|
|
4270
|
-
(0,
|
|
4283
|
+
(0, import_react17.useEffect)(() => {
|
|
4271
4284
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
4272
4285
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
4273
4286
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -4323,11 +4336,11 @@ var OneOfSchema = (props) => {
|
|
|
4323
4336
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
4324
4337
|
};
|
|
4325
4338
|
const feedbackId = `${id}-feedback`;
|
|
4326
|
-
return /* @__PURE__ */ (0,
|
|
4327
|
-
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
4328
|
-
/* @__PURE__ */ (0,
|
|
4339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4340
|
+
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4341
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
4329
4342
|
getTitleAndHelp(props.schema, id),
|
|
4330
|
-
/* @__PURE__ */ (0,
|
|
4343
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4331
4344
|
SchemaFormControl_default,
|
|
4332
4345
|
{
|
|
4333
4346
|
id,
|
|
@@ -4341,7 +4354,7 @@ var OneOfSchema = (props) => {
|
|
|
4341
4354
|
describedBy: feedbackId
|
|
4342
4355
|
}
|
|
4343
4356
|
),
|
|
4344
|
-
/* @__PURE__ */ (0,
|
|
4357
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4345
4358
|
ControlFeedback_default,
|
|
4346
4359
|
{
|
|
4347
4360
|
id: feedbackId,
|
|
@@ -4356,9 +4369,9 @@ var OneOfSchema = (props) => {
|
|
|
4356
4369
|
}
|
|
4357
4370
|
)
|
|
4358
4371
|
] }),
|
|
4359
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
4372
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DynamicAlert_default, { component: props.schema.alert })
|
|
4360
4373
|
] }),
|
|
4361
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
4374
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4362
4375
|
GenericSchema_default,
|
|
4363
4376
|
{
|
|
4364
4377
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -4374,12 +4387,12 @@ var OneOfSchema = (props) => {
|
|
|
4374
4387
|
] });
|
|
4375
4388
|
};
|
|
4376
4389
|
function getTitleAndHelp(schema, id) {
|
|
4377
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
4378
|
-
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
4390
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Help_default, { help: schema.help }) : null;
|
|
4391
|
+
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
|
|
4379
4392
|
schema.title,
|
|
4380
4393
|
" ",
|
|
4381
4394
|
helpElement
|
|
4382
|
-
] }) : /* @__PURE__ */ (0,
|
|
4395
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("h4", { className: "m-b-2", children: [
|
|
4383
4396
|
schema.title,
|
|
4384
4397
|
" ",
|
|
4385
4398
|
helpElement
|
|
@@ -4420,12 +4433,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
4420
4433
|
|
|
4421
4434
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4422
4435
|
var import_classnames5 = __toESM(require_classnames());
|
|
4423
|
-
var
|
|
4436
|
+
var import_react19 = require("react");
|
|
4424
4437
|
|
|
4425
4438
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4426
4439
|
var import_components13 = require("@transferwise/components");
|
|
4427
|
-
var
|
|
4428
|
-
var
|
|
4440
|
+
var import_react18 = require("react");
|
|
4441
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4429
4442
|
var UploadInputAdapter = (props) => {
|
|
4430
4443
|
const {
|
|
4431
4444
|
id,
|
|
@@ -4441,7 +4454,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4441
4454
|
onCancel
|
|
4442
4455
|
} = props;
|
|
4443
4456
|
const onEvent = useEventDispatcher();
|
|
4444
|
-
const files = (0,
|
|
4457
|
+
const files = (0, import_react18.useMemo)(() => fileId ? [{ id: fileId, status: import_components13.Status.SUCCEEDED }] : [], [fileId]);
|
|
4445
4458
|
const uploadFile = (formData) => {
|
|
4446
4459
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4447
4460
|
return httpClient(`${httpOptions.url}`, {
|
|
@@ -4459,7 +4472,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4459
4472
|
}
|
|
4460
4473
|
});
|
|
4461
4474
|
};
|
|
4462
|
-
return /* @__PURE__ */ (0,
|
|
4475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4463
4476
|
import_components13.UploadInput,
|
|
4464
4477
|
{
|
|
4465
4478
|
id,
|
|
@@ -4479,12 +4492,12 @@ var UploadInputAdapter = (props) => {
|
|
|
4479
4492
|
};
|
|
4480
4493
|
|
|
4481
4494
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4482
|
-
var
|
|
4495
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4483
4496
|
var PersistAsyncBlobSchema = (props) => {
|
|
4484
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
4485
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
4486
|
-
const [validations, setValidations] = (0,
|
|
4487
|
-
const [changed, setChanged] = (0,
|
|
4497
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4498
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4499
|
+
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
4500
|
+
const [changed, setChanged] = (0, import_react19.useState)(false);
|
|
4488
4501
|
const httpClient = useHttpClient();
|
|
4489
4502
|
const onEvent = useEventDispatcher();
|
|
4490
4503
|
const refreshValidations = () => {
|
|
@@ -4492,7 +4505,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4492
4505
|
setValidations(getValidationFailures(props.model, props.schema, !!props.required));
|
|
4493
4506
|
}
|
|
4494
4507
|
};
|
|
4495
|
-
(0,
|
|
4508
|
+
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4496
4509
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4497
4510
|
const jsonResponse = await httpResponse.json();
|
|
4498
4511
|
const id2 = getIdFromResponse(props.schema.persistAsync.idProperty, jsonResponse);
|
|
@@ -4523,8 +4536,8 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4523
4536
|
};
|
|
4524
4537
|
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4525
4538
|
const feedbackId = `${id}-feedback`;
|
|
4526
|
-
return /* @__PURE__ */ (0,
|
|
4527
|
-
/* @__PURE__ */ (0,
|
|
4539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4540
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4528
4541
|
UploadInputAdapter,
|
|
4529
4542
|
__spreadValues({
|
|
4530
4543
|
id,
|
|
@@ -4541,7 +4554,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4541
4554
|
onCancel
|
|
4542
4555
|
}, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
|
|
4543
4556
|
) }),
|
|
4544
|
-
/* @__PURE__ */ (0,
|
|
4557
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4545
4558
|
ControlFeedback_default,
|
|
4546
4559
|
{
|
|
4547
4560
|
id: feedbackId,
|
|
@@ -4566,17 +4579,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
4566
4579
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4567
4580
|
|
|
4568
4581
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4569
|
-
var
|
|
4582
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4570
4583
|
var PersistAsyncSchema = (props) => {
|
|
4571
4584
|
const { schema } = props;
|
|
4572
4585
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4573
4586
|
if (persistAsyncSchemaType === "blob") {
|
|
4574
|
-
return /* @__PURE__ */ (0,
|
|
4587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4575
4588
|
PersistAsyncBlobSchema_default,
|
|
4576
4589
|
__spreadValues({}, props)
|
|
4577
4590
|
);
|
|
4578
4591
|
}
|
|
4579
|
-
return /* @__PURE__ */ (0,
|
|
4592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
4580
4593
|
};
|
|
4581
4594
|
PersistAsyncSchema.defaultProps = {
|
|
4582
4595
|
required: false
|
|
@@ -4584,7 +4597,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
4584
4597
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4585
4598
|
|
|
4586
4599
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4587
|
-
var
|
|
4600
|
+
var import_react20 = require("react");
|
|
4588
4601
|
|
|
4589
4602
|
// src/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4590
4603
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -4597,7 +4610,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4597
4610
|
|
|
4598
4611
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4599
4612
|
var import_components14 = require("@transferwise/components");
|
|
4600
|
-
var
|
|
4613
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4601
4614
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
4602
4615
|
const { id, selection, setSelection } = props;
|
|
4603
4616
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -4608,14 +4621,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4608
4621
|
const toggleSelection = () => {
|
|
4609
4622
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
4610
4623
|
};
|
|
4611
|
-
return /* @__PURE__ */ (0,
|
|
4624
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components14.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
4612
4625
|
};
|
|
4613
4626
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4614
4627
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4615
4628
|
|
|
4616
4629
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4617
4630
|
var import_components15 = require("@transferwise/components");
|
|
4618
|
-
var
|
|
4631
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4619
4632
|
var PromotedOneOfRadioControl = (props) => {
|
|
4620
4633
|
var _a, _b;
|
|
4621
4634
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -4632,9 +4645,9 @@ var PromotedOneOfRadioControl = (props) => {
|
|
|
4632
4645
|
secondary: promotion.other.description
|
|
4633
4646
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
4634
4647
|
];
|
|
4635
|
-
return /* @__PURE__ */ (0,
|
|
4636
|
-
title && /* @__PURE__ */ (0,
|
|
4637
|
-
/* @__PURE__ */ (0,
|
|
4648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "form-group", children: [
|
|
4649
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
4650
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4638
4651
|
import_components15.RadioGroup,
|
|
4639
4652
|
{
|
|
4640
4653
|
name: "promoted-selection",
|
|
@@ -4652,16 +4665,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
4652
4665
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4653
4666
|
|
|
4654
4667
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4655
|
-
var
|
|
4668
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4656
4669
|
var PromotedOneOfControl = (props) => {
|
|
4657
4670
|
const controlType = props.promotion.control || "radio";
|
|
4658
4671
|
switch (controlType) {
|
|
4659
4672
|
case "radio":
|
|
4660
|
-
return /* @__PURE__ */ (0,
|
|
4673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
4661
4674
|
case "checkbox":
|
|
4662
|
-
return /* @__PURE__ */ (0,
|
|
4675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
4663
4676
|
default:
|
|
4664
|
-
return /* @__PURE__ */ (0,
|
|
4677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
|
|
4665
4678
|
}
|
|
4666
4679
|
};
|
|
4667
4680
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -4671,20 +4684,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
4671
4684
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4672
4685
|
|
|
4673
4686
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4674
|
-
var
|
|
4687
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4675
4688
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4676
4689
|
var PromotedOneOfSchema = (props) => {
|
|
4677
4690
|
var _a;
|
|
4678
|
-
const [selection, setSelection] = (0,
|
|
4691
|
+
const [selection, setSelection] = (0, import_react20.useState)(
|
|
4679
4692
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
4680
4693
|
);
|
|
4681
4694
|
const promotedAlert = props.schema.alert;
|
|
4682
4695
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
4683
4696
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
4684
4697
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
4685
|
-
return /* @__PURE__ */ (0,
|
|
4686
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
4687
|
-
/* @__PURE__ */ (0,
|
|
4698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
4699
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
4700
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4688
4701
|
PromotedOneOfControl_default,
|
|
4689
4702
|
{
|
|
4690
4703
|
id: props.schema.$id,
|
|
@@ -4695,8 +4708,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
4695
4708
|
setSelection
|
|
4696
4709
|
}
|
|
4697
4710
|
),
|
|
4698
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
4699
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
4711
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
4712
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
4700
4713
|
] });
|
|
4701
4714
|
};
|
|
4702
4715
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -4745,12 +4758,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
4745
4758
|
});
|
|
4746
4759
|
|
|
4747
4760
|
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4748
|
-
var
|
|
4761
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4749
4762
|
var ReadOnlySchema = ({ schema, model }) => {
|
|
4750
4763
|
const { title = "" } = schema;
|
|
4751
4764
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
4752
4765
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4753
|
-
return /* @__PURE__ */ (0,
|
|
4766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components16.DefinitionList, { layout: import_components16.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4754
4767
|
};
|
|
4755
4768
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4756
4769
|
function getValueForSchema({
|
|
@@ -4783,7 +4796,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
4783
4796
|
function getValueFromOption(option) {
|
|
4784
4797
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
4785
4798
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
4786
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
4799
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
4787
4800
|
icon.avatar,
|
|
4788
4801
|
" ",
|
|
4789
4802
|
text
|
|
@@ -4791,22 +4804,22 @@ function getValueFromOption(option) {
|
|
|
4791
4804
|
}
|
|
4792
4805
|
|
|
4793
4806
|
// src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4794
|
-
var
|
|
4795
|
-
var
|
|
4807
|
+
var import_react21 = require("react");
|
|
4808
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4796
4809
|
var ValidationAsyncSchema = (props) => {
|
|
4797
4810
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4798
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
4799
|
-
const previousRequestedModelReference = (0,
|
|
4800
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
4811
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react21.useState)(model);
|
|
4812
|
+
const previousRequestedModelReference = (0, import_react21.useRef)(null);
|
|
4813
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react21.useState)(
|
|
4801
4814
|
null
|
|
4802
4815
|
);
|
|
4803
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
4804
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
4805
|
-
const [abortController, setAbortController] = (0,
|
|
4816
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react21.useState)(null);
|
|
4817
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react21.useState)(false);
|
|
4818
|
+
const [abortController, setAbortController] = (0, import_react21.useState)(null);
|
|
4806
4819
|
const httpClient = useHttpClient();
|
|
4807
4820
|
const onEvent = useEventDispatcher();
|
|
4808
4821
|
const log = useLogger();
|
|
4809
|
-
(0,
|
|
4822
|
+
(0, import_react21.useEffect)(() => {
|
|
4810
4823
|
if (!schema.validationAsync.method) {
|
|
4811
4824
|
log.warning(
|
|
4812
4825
|
"Invalid schema or model",
|
|
@@ -4876,20 +4889,20 @@ var ValidationAsyncSchema = (props) => {
|
|
|
4876
4889
|
required,
|
|
4877
4890
|
schema
|
|
4878
4891
|
};
|
|
4879
|
-
return /* @__PURE__ */ (0,
|
|
4892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
4880
4893
|
};
|
|
4881
4894
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
4882
4895
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
4883
4896
|
|
|
4884
4897
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4885
|
-
var
|
|
4886
|
-
var
|
|
4898
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4899
|
+
var import_react23 = require("react");
|
|
4887
4900
|
var GenericSchemaForm = (props) => {
|
|
4888
4901
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
4889
4902
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
4890
4903
|
const type = getSchemaType(schema);
|
|
4891
4904
|
const log = useLogger();
|
|
4892
|
-
(0,
|
|
4905
|
+
(0, import_react22.useEffect)(() => {
|
|
4893
4906
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
4894
4907
|
log.error(
|
|
4895
4908
|
"Invalid schema or model",
|
|
@@ -4899,27 +4912,27 @@ var GenericSchemaForm = (props) => {
|
|
|
4899
4912
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
4900
4913
|
switch (type) {
|
|
4901
4914
|
case "readOnly":
|
|
4902
|
-
return /* @__PURE__ */ (0,
|
|
4915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
4903
4916
|
case "persistAsync":
|
|
4904
|
-
return /* @__PURE__ */ (0,
|
|
4917
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4905
4918
|
case "validationAsync":
|
|
4906
|
-
return /* @__PURE__ */ (0,
|
|
4919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4907
4920
|
case "basic": {
|
|
4908
4921
|
const basicTypeProps = __spreadValues({ infoMessage: null }, schemaProps);
|
|
4909
|
-
return /* @__PURE__ */ (0,
|
|
4922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
4910
4923
|
}
|
|
4911
4924
|
case "object":
|
|
4912
|
-
return /* @__PURE__ */ (0,
|
|
4925
|
+
return /* @__PURE__ */ (0, import_react23.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
4913
4926
|
case "array":
|
|
4914
|
-
return /* @__PURE__ */ (0,
|
|
4927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
4915
4928
|
case "promotedOneOf":
|
|
4916
|
-
return /* @__PURE__ */ (0,
|
|
4929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4917
4930
|
case "oneOf":
|
|
4918
|
-
return /* @__PURE__ */ (0,
|
|
4931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4919
4932
|
case "allOf":
|
|
4920
|
-
return /* @__PURE__ */ (0,
|
|
4933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
4921
4934
|
}
|
|
4922
|
-
return /* @__PURE__ */ (0,
|
|
4935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {});
|
|
4923
4936
|
};
|
|
4924
4937
|
var GenericSchema_default = GenericSchemaForm;
|
|
4925
4938
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -4946,7 +4959,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
4946
4959
|
};
|
|
4947
4960
|
|
|
4948
4961
|
// src/layout/form/DynamicForm.tsx
|
|
4949
|
-
var
|
|
4962
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4950
4963
|
var DynamicForm = ({
|
|
4951
4964
|
component,
|
|
4952
4965
|
model = null,
|
|
@@ -4956,7 +4969,7 @@ var DynamicForm = ({
|
|
|
4956
4969
|
onPersistAsync
|
|
4957
4970
|
}) => {
|
|
4958
4971
|
const formSchema = component.schema;
|
|
4959
|
-
return /* @__PURE__ */ (0,
|
|
4972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4960
4973
|
GenericSchema_default,
|
|
4961
4974
|
{
|
|
4962
4975
|
schema: formSchema,
|
|
@@ -4973,46 +4986,46 @@ var DynamicForm = ({
|
|
|
4973
4986
|
var DynamicForm_default = DynamicForm;
|
|
4974
4987
|
|
|
4975
4988
|
// src/layout/heading/DynamicHeading.tsx
|
|
4976
|
-
var
|
|
4989
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4977
4990
|
var DynamicHeading = (props) => {
|
|
4978
4991
|
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
4979
4992
|
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
4980
4993
|
switch (size) {
|
|
4981
4994
|
case "xs":
|
|
4982
|
-
return /* @__PURE__ */ (0,
|
|
4995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h5", { className: classes, children: text });
|
|
4983
4996
|
case "sm":
|
|
4984
|
-
return /* @__PURE__ */ (0,
|
|
4997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: classes, children: text });
|
|
4985
4998
|
case "lg":
|
|
4986
|
-
return /* @__PURE__ */ (0,
|
|
4999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h2", { className: classes, children: text });
|
|
4987
5000
|
case "xl":
|
|
4988
|
-
return /* @__PURE__ */ (0,
|
|
5001
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h1", { className: classes, children: text });
|
|
4989
5002
|
case "md":
|
|
4990
5003
|
default:
|
|
4991
|
-
return /* @__PURE__ */ (0,
|
|
5004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { className: classes, children: text });
|
|
4992
5005
|
}
|
|
4993
5006
|
};
|
|
4994
5007
|
var DynamicHeading_default = DynamicHeading;
|
|
4995
5008
|
|
|
4996
5009
|
// src/layout/markdown/DynamicMarkdown.tsx
|
|
4997
5010
|
var import_components17 = require("@transferwise/components");
|
|
4998
|
-
var
|
|
5011
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4999
5012
|
var DynamicMarkdown = ({ component }) => {
|
|
5000
5013
|
const { content, align, margin } = component;
|
|
5001
|
-
return /* @__PURE__ */ (0,
|
|
5014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
5002
5015
|
};
|
|
5003
5016
|
var DynamicInfo = ({ component }) => {
|
|
5004
|
-
return /* @__PURE__ */ (0,
|
|
5017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components17.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
5005
5018
|
};
|
|
5006
5019
|
|
|
5007
5020
|
// src/layout/image/DynamicImage.tsx
|
|
5008
5021
|
var import_components18 = require("@transferwise/components");
|
|
5009
|
-
var
|
|
5010
|
-
var
|
|
5022
|
+
var import_react24 = require("react");
|
|
5023
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5011
5024
|
var DynamicImage = ({ component: image }) => {
|
|
5012
5025
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
5013
5026
|
const httpClient = useHttpClient();
|
|
5014
|
-
const [imageSource, setImageSource] = (0,
|
|
5015
|
-
(0,
|
|
5027
|
+
const [imageSource, setImageSource] = (0, import_react24.useState)("");
|
|
5028
|
+
(0, import_react24.useEffect)(() => {
|
|
5016
5029
|
void getImageSource(httpClient, url).then(setImageSource);
|
|
5017
5030
|
}, [url, httpClient]);
|
|
5018
5031
|
const imageProps = {
|
|
@@ -5024,7 +5037,7 @@ var DynamicImage = ({ component: image }) => {
|
|
|
5024
5037
|
if (!imageSource) {
|
|
5025
5038
|
return null;
|
|
5026
5039
|
}
|
|
5027
|
-
return /* @__PURE__ */ (0,
|
|
5040
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components18.Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
|
|
5028
5041
|
};
|
|
5029
5042
|
var readImageBlobAsDataURL = (imageBlob) => {
|
|
5030
5043
|
return new Promise((resolve, reject) => {
|
|
@@ -5058,47 +5071,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
5058
5071
|
|
|
5059
5072
|
// src/layout/instructions/DynamicInstructions.tsx
|
|
5060
5073
|
var import_components19 = require("@transferwise/components");
|
|
5061
|
-
var
|
|
5074
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5062
5075
|
var doContext = ["positive", "neutral"];
|
|
5063
5076
|
var dontContext = ["warning", "negative"];
|
|
5064
5077
|
var DynamicInstructions = ({ component }) => {
|
|
5065
5078
|
const { items } = component;
|
|
5066
5079
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
5067
5080
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
5068
|
-
return /* @__PURE__ */ (0,
|
|
5069
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5070
|
-
/* @__PURE__ */ (0,
|
|
5081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5082
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components19.Header, { title: component.title }) : null,
|
|
5083
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components19.InstructionsList, { dos, donts })
|
|
5071
5084
|
] });
|
|
5072
5085
|
};
|
|
5073
5086
|
var DynamicInstructions_default = DynamicInstructions;
|
|
5074
5087
|
|
|
5075
5088
|
// src/layout/DynamicLayout.tsx
|
|
5076
|
-
var
|
|
5089
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5077
5090
|
var getKey = (component) => JSON.stringify(component);
|
|
5078
5091
|
var DynamicLayout = (props) => {
|
|
5079
5092
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
5080
5093
|
const renderComponent = (component) => {
|
|
5081
5094
|
switch (component.type) {
|
|
5082
5095
|
case "heading":
|
|
5083
|
-
return /* @__PURE__ */ (0,
|
|
5096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
5084
5097
|
case "paragraph":
|
|
5085
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
5086
5099
|
case "image":
|
|
5087
|
-
return /* @__PURE__ */ (0,
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
5088
5101
|
case "alert":
|
|
5089
|
-
return /* @__PURE__ */ (0,
|
|
5102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
5090
5103
|
case "review":
|
|
5091
|
-
return /* @__PURE__ */ (0,
|
|
5104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
5092
5105
|
case "divider":
|
|
5093
|
-
return /* @__PURE__ */ (0,
|
|
5106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
5094
5107
|
case "info":
|
|
5095
|
-
return /* @__PURE__ */ (0,
|
|
5108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicInfo, { component }, getKey(component));
|
|
5096
5109
|
case "instructions":
|
|
5097
|
-
return /* @__PURE__ */ (0,
|
|
5110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
5098
5111
|
case "markdown":
|
|
5099
|
-
return /* @__PURE__ */ (0,
|
|
5112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
5100
5113
|
case "columns":
|
|
5101
|
-
return /* @__PURE__ */ (0,
|
|
5114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5102
5115
|
DynamicColumns_default,
|
|
5103
5116
|
{
|
|
5104
5117
|
component,
|
|
@@ -5112,7 +5125,7 @@ var DynamicLayout = (props) => {
|
|
|
5112
5125
|
getKey(component)
|
|
5113
5126
|
);
|
|
5114
5127
|
case "form":
|
|
5115
|
-
return /* @__PURE__ */ (0,
|
|
5128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5116
5129
|
DynamicForm_default,
|
|
5117
5130
|
{
|
|
5118
5131
|
component,
|
|
@@ -5125,9 +5138,9 @@ var DynamicLayout = (props) => {
|
|
|
5125
5138
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
5126
5139
|
);
|
|
5127
5140
|
case "button":
|
|
5128
|
-
return /* @__PURE__ */ (0,
|
|
5141
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
5129
5142
|
case "box":
|
|
5130
|
-
return /* @__PURE__ */ (0,
|
|
5143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5131
5144
|
DynamicBox_default,
|
|
5132
5145
|
{
|
|
5133
5146
|
component,
|
|
@@ -5141,34 +5154,34 @@ var DynamicLayout = (props) => {
|
|
|
5141
5154
|
getKey(component)
|
|
5142
5155
|
);
|
|
5143
5156
|
case "decision":
|
|
5144
|
-
return /* @__PURE__ */ (0,
|
|
5157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
5145
5158
|
case "external":
|
|
5146
|
-
return /* @__PURE__ */ (0,
|
|
5159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
5147
5160
|
case "list":
|
|
5148
5161
|
case "status-list":
|
|
5149
|
-
return /* @__PURE__ */ (0,
|
|
5162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
5150
5163
|
case "loading-indicator":
|
|
5151
|
-
return /* @__PURE__ */ (0,
|
|
5164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5152
5165
|
case "search":
|
|
5153
|
-
return /* @__PURE__ */ (0,
|
|
5166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5154
5167
|
default:
|
|
5155
|
-
return /* @__PURE__ */ (0,
|
|
5168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", {}, getKey(component));
|
|
5156
5169
|
}
|
|
5157
5170
|
};
|
|
5158
5171
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5159
|
-
return /* @__PURE__ */ (0,
|
|
5172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: components.map(renderComponent) });
|
|
5160
5173
|
} else {
|
|
5161
|
-
return /* @__PURE__ */ (0,
|
|
5174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5162
5175
|
}
|
|
5163
5176
|
};
|
|
5164
5177
|
var DynamicLayout_default = DynamicLayout;
|
|
5165
5178
|
|
|
5166
5179
|
// src/layout/list/DynamicStatusList.tsx
|
|
5167
5180
|
var import_components20 = require("@transferwise/components");
|
|
5168
|
-
var
|
|
5181
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5169
5182
|
var DynamicStatusList = ({ component }) => {
|
|
5170
|
-
return /* @__PURE__ */ (0,
|
|
5171
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5184
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("h4", { className: "m-b-2", children: [
|
|
5172
5185
|
" ",
|
|
5173
5186
|
component.title,
|
|
5174
5187
|
" "
|
|
@@ -5181,8 +5194,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5181
5194
|
key: `${title}/${description || ""}`,
|
|
5182
5195
|
title,
|
|
5183
5196
|
description
|
|
5184
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
5185
|
-
return /* @__PURE__ */ (0,
|
|
5197
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
5198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components20.Summary, __spreadValues({}, props));
|
|
5186
5199
|
};
|
|
5187
5200
|
var statusListMap = {
|
|
5188
5201
|
done: "done",
|
|
@@ -5199,10 +5212,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
5199
5212
|
|
|
5200
5213
|
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5201
5214
|
var import_components21 = require("@transferwise/components");
|
|
5202
|
-
var
|
|
5215
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5203
5216
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5204
5217
|
const { margin, size = "md" } = component;
|
|
5205
|
-
return /* @__PURE__ */ (0,
|
|
5218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5206
5219
|
import_components21.Loader,
|
|
5207
5220
|
{
|
|
5208
5221
|
size,
|
|
@@ -5236,18 +5249,18 @@ var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)(
|
|
|
5236
5249
|
|
|
5237
5250
|
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5238
5251
|
var import_components22 = require("@transferwise/components");
|
|
5239
|
-
var
|
|
5252
|
+
var import_react25 = require("react");
|
|
5240
5253
|
function useSnackBarIfAvailable() {
|
|
5241
|
-
const context = (0,
|
|
5254
|
+
const context = (0, import_react25.useContext)(import_components22.SnackbarContext);
|
|
5242
5255
|
return context ? context.createSnackbar : noop2;
|
|
5243
5256
|
}
|
|
5244
5257
|
function noop2() {
|
|
5245
5258
|
}
|
|
5246
5259
|
|
|
5247
5260
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5248
|
-
var
|
|
5249
|
-
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
5250
|
-
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0,
|
|
5261
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5262
|
+
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BasicDynamicParagraph, { component });
|
|
5263
|
+
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5251
5264
|
" ",
|
|
5252
5265
|
component.text,
|
|
5253
5266
|
" "
|
|
@@ -5261,8 +5274,8 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5261
5274
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop3);
|
|
5262
5275
|
};
|
|
5263
5276
|
const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
|
|
5264
|
-
return /* @__PURE__ */ (0,
|
|
5265
|
-
/* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5278
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5266
5279
|
"input",
|
|
5267
5280
|
{
|
|
5268
5281
|
type: "text",
|
|
@@ -5272,7 +5285,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5272
5285
|
style: { textOverflow: "ellipsis" }
|
|
5273
5286
|
}
|
|
5274
5287
|
),
|
|
5275
|
-
/* @__PURE__ */ (0,
|
|
5288
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.Button, { block: true, onClick: copy, className: getMargin("sm"), children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5276
5289
|
] });
|
|
5277
5290
|
};
|
|
5278
5291
|
function noop3() {
|
|
@@ -5281,7 +5294,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
5281
5294
|
|
|
5282
5295
|
// src/layout/review/DynamicReview.tsx
|
|
5283
5296
|
var import_components24 = require("@transferwise/components");
|
|
5284
|
-
var
|
|
5297
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5285
5298
|
var getDefinitions = (orientation, review) => {
|
|
5286
5299
|
return review.fields.map(
|
|
5287
5300
|
({ label, value, help }, index) => {
|
|
@@ -5295,14 +5308,14 @@ var getDefinitions = (orientation, review) => {
|
|
|
5295
5308
|
};
|
|
5296
5309
|
var getFieldValue = (value, help, orientation) => {
|
|
5297
5310
|
if (help) {
|
|
5298
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
5299
|
-
/* @__PURE__ */ (0,
|
|
5311
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5312
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Help_default, { help }),
|
|
5300
5313
|
" ",
|
|
5301
5314
|
value
|
|
5302
|
-
] }) : /* @__PURE__ */ (0,
|
|
5315
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5303
5316
|
value,
|
|
5304
5317
|
" ",
|
|
5305
|
-
/* @__PURE__ */ (0,
|
|
5318
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Help_default, { help })
|
|
5306
5319
|
] });
|
|
5307
5320
|
}
|
|
5308
5321
|
return value;
|
|
@@ -5315,7 +5328,7 @@ var DynamicReview = (props) => {
|
|
|
5315
5328
|
const review = props.component;
|
|
5316
5329
|
const margin = getMargin(review.margin || "xs");
|
|
5317
5330
|
const getReviewAction = (action) => {
|
|
5318
|
-
return /* @__PURE__ */ (0,
|
|
5331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5319
5332
|
"a",
|
|
5320
5333
|
{
|
|
5321
5334
|
href: action.url,
|
|
@@ -5330,26 +5343,26 @@ var DynamicReview = (props) => {
|
|
|
5330
5343
|
);
|
|
5331
5344
|
};
|
|
5332
5345
|
const orientation = getReviewLayout(review);
|
|
5333
|
-
return /* @__PURE__ */ (0,
|
|
5334
|
-
review.title && /* @__PURE__ */ (0,
|
|
5346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5347
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("h6", { className: `m-b-2 ${margin}`, children: [
|
|
5335
5348
|
review.title,
|
|
5336
5349
|
review.action && getReviewAction(review.action)
|
|
5337
5350
|
] }),
|
|
5338
|
-
/* @__PURE__ */ (0,
|
|
5351
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: review.title ? "" : margin, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components24.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5339
5352
|
] });
|
|
5340
5353
|
};
|
|
5341
5354
|
var DynamicReview_default = DynamicReview;
|
|
5342
5355
|
|
|
5343
5356
|
// src/layout/search/DynamicSearch.tsx
|
|
5344
|
-
var
|
|
5357
|
+
var import_react27 = require("react");
|
|
5345
5358
|
|
|
5346
5359
|
// src/layout/search/SearchInput.tsx
|
|
5347
5360
|
var import_components25 = require("@transferwise/components");
|
|
5348
|
-
var
|
|
5361
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5349
5362
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5350
|
-
return /* @__PURE__ */ (0,
|
|
5363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5351
5364
|
title,
|
|
5352
|
-
/* @__PURE__ */ (0,
|
|
5365
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5353
5366
|
import_components25.Input,
|
|
5354
5367
|
{
|
|
5355
5368
|
type: "text",
|
|
@@ -5381,13 +5394,13 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5381
5394
|
});
|
|
5382
5395
|
|
|
5383
5396
|
// src/layout/search/SearchResults.tsx
|
|
5384
|
-
var
|
|
5397
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5385
5398
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5386
5399
|
if (results.length === 0) {
|
|
5387
|
-
return /* @__PURE__ */ (0,
|
|
5400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5388
5401
|
}
|
|
5389
|
-
return /* @__PURE__ */ (0,
|
|
5390
|
-
return /* @__PURE__ */ (0,
|
|
5402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.NavigationOptionsList, { children: results.map((result) => {
|
|
5403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5391
5404
|
import_components26.NavigationOption,
|
|
5392
5405
|
{
|
|
5393
5406
|
title: result.title,
|
|
@@ -5403,10 +5416,10 @@ var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
|
5403
5416
|
};
|
|
5404
5417
|
var ErrorResult = ({ onRetrySearch }) => {
|
|
5405
5418
|
const intl = (0, import_react_intl19.useIntl)();
|
|
5406
|
-
return /* @__PURE__ */ (0,
|
|
5419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { className: "m-t-2", children: [
|
|
5407
5420
|
intl.formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
5408
5421
|
"\xA0",
|
|
5409
|
-
/* @__PURE__ */ (0,
|
|
5422
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5410
5423
|
"a",
|
|
5411
5424
|
{
|
|
5412
5425
|
href: "/",
|
|
@@ -5421,15 +5434,15 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
5421
5434
|
};
|
|
5422
5435
|
|
|
5423
5436
|
// src/layout/search/useSearch.tsx
|
|
5424
|
-
var
|
|
5437
|
+
var import_react26 = require("react");
|
|
5425
5438
|
var headers = { "Content-Type": "application/json" };
|
|
5426
5439
|
var useSearch = (defaultSearchConfig) => {
|
|
5427
|
-
const [state, setState] = (0,
|
|
5440
|
+
const [state, setState] = (0, import_react26.useState)({
|
|
5428
5441
|
status: "idle"
|
|
5429
5442
|
});
|
|
5430
|
-
const abortControllerRef = (0,
|
|
5443
|
+
const abortControllerRef = (0, import_react26.useRef)(null);
|
|
5431
5444
|
const httpClient = useHttpClient();
|
|
5432
|
-
const search = (0,
|
|
5445
|
+
const search = (0, import_react26.useCallback)(
|
|
5433
5446
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
5434
5447
|
var _a;
|
|
5435
5448
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -5492,14 +5505,14 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5492
5505
|
};
|
|
5493
5506
|
|
|
5494
5507
|
// src/layout/search/DynamicSearch.tsx
|
|
5495
|
-
var
|
|
5508
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5496
5509
|
var DEBOUNCE_TIME = 400;
|
|
5497
5510
|
var DynamicSearch = ({ component, onAction }) => {
|
|
5498
|
-
const [query, setQuery] = (0,
|
|
5511
|
+
const [query, setQuery] = (0, import_react27.useState)("");
|
|
5499
5512
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5500
5513
|
const { status, results, search } = useSearch({ url, method, param });
|
|
5501
5514
|
const onEvent = useEventDispatcher();
|
|
5502
|
-
const debouncedSearch = (0,
|
|
5515
|
+
const debouncedSearch = (0, import_react27.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
|
|
5503
5516
|
const onSearchStart = () => {
|
|
5504
5517
|
onEvent("Dynamic Flow - Search Started", {});
|
|
5505
5518
|
};
|
|
@@ -5526,17 +5539,17 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5526
5539
|
setQuery(query);
|
|
5527
5540
|
void search(query);
|
|
5528
5541
|
};
|
|
5529
|
-
return /* @__PURE__ */ (0,
|
|
5530
|
-
/* @__PURE__ */ (0,
|
|
5531
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
5532
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
5533
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
5542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5544
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5545
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { onRetrySearch }),
|
|
5546
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5534
5547
|
] });
|
|
5535
5548
|
};
|
|
5536
5549
|
var DynamicSearch_default = DynamicSearch;
|
|
5537
5550
|
|
|
5538
5551
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5539
|
-
var
|
|
5552
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5540
5553
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5541
5554
|
var getDefaultValue = (schema) => {
|
|
5542
5555
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5573,13 +5586,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5573
5586
|
props.onBlur();
|
|
5574
5587
|
}
|
|
5575
5588
|
};
|
|
5576
|
-
const [model, setModel] = (0,
|
|
5577
|
-
const [lastModel, setLastModel] = (0,
|
|
5578
|
-
const [changed, setChanged] = (0,
|
|
5579
|
-
const [focused, setFocused] = (0,
|
|
5580
|
-
const [blurred, setBlurred] = (0,
|
|
5581
|
-
const [validations, setValidations] = (0,
|
|
5582
|
-
const id = (0,
|
|
5589
|
+
const [model, setModel] = (0, import_react28.useState)((_a = props.model) != null ? _a : null);
|
|
5590
|
+
const [lastModel, setLastModel] = (0, import_react28.useState)((_b = props.model) != null ? _b : null);
|
|
5591
|
+
const [changed, setChanged] = (0, import_react28.useState)(false);
|
|
5592
|
+
const [focused, setFocused] = (0, import_react28.useState)(false);
|
|
5593
|
+
const [blurred, setBlurred] = (0, import_react28.useState)(false);
|
|
5594
|
+
const [validations, setValidations] = (0, import_react28.useState)([]);
|
|
5595
|
+
const id = (0, import_react28.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5583
5596
|
const onSchemaChange = () => {
|
|
5584
5597
|
const defaultValue = getDefaultValue(props.schema);
|
|
5585
5598
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5594,9 +5607,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5594
5607
|
};
|
|
5595
5608
|
const isConst = props.schema.const;
|
|
5596
5609
|
const isHidden = props.schema.hidden || isConst;
|
|
5597
|
-
(0,
|
|
5598
|
-
(0,
|
|
5599
|
-
(0,
|
|
5610
|
+
(0, import_react28.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5611
|
+
(0, import_react28.useEffect)(onSchemaChange, [props.schema]);
|
|
5612
|
+
(0, import_react28.useEffect)(() => {
|
|
5600
5613
|
var _a2;
|
|
5601
5614
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
5602
5615
|
if (newModel !== model) {
|
|
@@ -5611,15 +5624,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5611
5624
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5612
5625
|
const schemaHelp = props.schema.help;
|
|
5613
5626
|
const feedbackId = `${id}-feedback`;
|
|
5614
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
5615
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
5616
|
-
/* @__PURE__ */ (0,
|
|
5617
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5618
|
-
/* @__PURE__ */ (0,
|
|
5619
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
5627
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5628
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5629
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
5630
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "d-inline-block", children: [
|
|
5631
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5632
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help: schemaHelp })
|
|
5620
5633
|
] }),
|
|
5621
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5622
|
-
/* @__PURE__ */ (0,
|
|
5634
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help: schemaHelp }),
|
|
5635
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5623
5636
|
SchemaFormControl_default,
|
|
5624
5637
|
{
|
|
5625
5638
|
id,
|
|
@@ -5632,7 +5645,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5632
5645
|
describedBy: feedbackId
|
|
5633
5646
|
}
|
|
5634
5647
|
),
|
|
5635
|
-
/* @__PURE__ */ (0,
|
|
5648
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5636
5649
|
ControlFeedback_default,
|
|
5637
5650
|
{
|
|
5638
5651
|
id: feedbackId,
|
|
@@ -5657,7 +5670,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
5657
5670
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5658
5671
|
|
|
5659
5672
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5660
|
-
var
|
|
5673
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5661
5674
|
var getIdFromResponse = (idProperty, response) => {
|
|
5662
5675
|
return response[idProperty];
|
|
5663
5676
|
};
|
|
@@ -5677,12 +5690,12 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5677
5690
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5678
5691
|
const httpClient = useHttpClient();
|
|
5679
5692
|
const onEvent = useEventDispatcher();
|
|
5680
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5693
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react29.useState)(null);
|
|
5681
5694
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5682
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
5683
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
5684
|
-
const [abortController, setAbortController] = (0,
|
|
5685
|
-
(0,
|
|
5695
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react29.useState)(null);
|
|
5696
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react29.useState)(false);
|
|
5697
|
+
const [abortController, setAbortController] = (0, import_react29.useState)(null);
|
|
5698
|
+
(0, import_react29.useEffect)(() => {
|
|
5686
5699
|
if (controlTypesWithPersistOnChange.has(
|
|
5687
5700
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5688
5701
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5749,7 +5762,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5749
5762
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5750
5763
|
}
|
|
5751
5764
|
};
|
|
5752
|
-
return /* @__PURE__ */ (0,
|
|
5765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5753
5766
|
BasicTypeSchema_default,
|
|
5754
5767
|
{
|
|
5755
5768
|
required,
|
|
@@ -5770,7 +5783,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
5770
5783
|
|
|
5771
5784
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5772
5785
|
var usePersistAsync = (persistAsync) => {
|
|
5773
|
-
const [abortController, setAbortController] = (0,
|
|
5786
|
+
const [abortController, setAbortController] = (0, import_react30.useState)(null);
|
|
5774
5787
|
const httpClient = useHttpClient();
|
|
5775
5788
|
const intl = (0, import_react_intl21.useIntl)();
|
|
5776
5789
|
const { schema } = persistAsync;
|
|
@@ -5849,7 +5862,7 @@ function hasStringMessage(value) {
|
|
|
5849
5862
|
}
|
|
5850
5863
|
|
|
5851
5864
|
// src/common/hooks/usePolling/usePolling.tsx
|
|
5852
|
-
var
|
|
5865
|
+
var import_react31 = require("react");
|
|
5853
5866
|
function usePolling({
|
|
5854
5867
|
asyncFn,
|
|
5855
5868
|
interval,
|
|
@@ -5858,9 +5871,9 @@ function usePolling({
|
|
|
5858
5871
|
onPollingResponse,
|
|
5859
5872
|
onFailure
|
|
5860
5873
|
}) {
|
|
5861
|
-
const onPollingResponseReference = (0,
|
|
5862
|
-
const onFailureReference = (0,
|
|
5863
|
-
const poll = (0,
|
|
5874
|
+
const onPollingResponseReference = (0, import_react31.useRef)(onPollingResponse);
|
|
5875
|
+
const onFailureReference = (0, import_react31.useRef)(onFailure);
|
|
5876
|
+
const poll = (0, import_react31.useMemo)(
|
|
5864
5877
|
() => createPollingClosure(
|
|
5865
5878
|
asyncFn,
|
|
5866
5879
|
maxAttempts,
|
|
@@ -5870,7 +5883,7 @@ function usePolling({
|
|
|
5870
5883
|
),
|
|
5871
5884
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5872
5885
|
);
|
|
5873
|
-
(0,
|
|
5886
|
+
(0, import_react31.useEffect)(() => {
|
|
5874
5887
|
if (interval > 0) {
|
|
5875
5888
|
const intervalReference = setInterval(() => {
|
|
5876
5889
|
poll();
|
|
@@ -5878,7 +5891,7 @@ function usePolling({
|
|
|
5878
5891
|
return () => clearInterval(intervalReference);
|
|
5879
5892
|
}
|
|
5880
5893
|
}, [poll, interval]);
|
|
5881
|
-
(0,
|
|
5894
|
+
(0, import_react31.useEffect)(() => {
|
|
5882
5895
|
onPollingResponseReference.current = onPollingResponse;
|
|
5883
5896
|
onFailureReference.current = onFailure;
|
|
5884
5897
|
}, [onPollingResponse, onFailure]);
|
|
@@ -5907,20 +5920,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
5907
5920
|
}
|
|
5908
5921
|
|
|
5909
5922
|
// src/common/hooks/usePrevious/usePrevious.js
|
|
5910
|
-
var
|
|
5923
|
+
var import_react32 = require("react");
|
|
5911
5924
|
var usePrevious = (value) => {
|
|
5912
|
-
const reference = (0,
|
|
5913
|
-
(0,
|
|
5925
|
+
const reference = (0, import_react32.useRef)();
|
|
5926
|
+
(0, import_react32.useEffect)(() => {
|
|
5914
5927
|
reference.current = value;
|
|
5915
5928
|
}, [value]);
|
|
5916
5929
|
return reference.current;
|
|
5917
5930
|
};
|
|
5918
5931
|
|
|
5919
5932
|
// src/common/hooks/useStepPolling/useStepPolling.tsx
|
|
5920
|
-
var
|
|
5933
|
+
var import_react33 = require("react");
|
|
5921
5934
|
function useStepPolling(polling, onAction) {
|
|
5922
5935
|
const httpClient = useHttpClient();
|
|
5923
|
-
const asyncFn = (0,
|
|
5936
|
+
const asyncFn = (0, import_react33.useMemo)(() => {
|
|
5924
5937
|
if (polling) {
|
|
5925
5938
|
return () => {
|
|
5926
5939
|
return httpClient(polling.url).then((response) => {
|
|
@@ -5935,7 +5948,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5935
5948
|
return void 0;
|
|
5936
5949
|
}
|
|
5937
5950
|
}, [polling, httpClient]);
|
|
5938
|
-
const onPollingResponse = (0,
|
|
5951
|
+
const onPollingResponse = (0, import_react33.useCallback)(
|
|
5939
5952
|
(pollingResponse) => {
|
|
5940
5953
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
5941
5954
|
onAction(pollingResponse.action);
|
|
@@ -5951,7 +5964,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5951
5964
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
5952
5965
|
maxConsecutiveFails: 1,
|
|
5953
5966
|
onPollingResponse,
|
|
5954
|
-
onFailure: (0,
|
|
5967
|
+
onFailure: (0, import_react33.useCallback)(() => {
|
|
5955
5968
|
if (polling) {
|
|
5956
5969
|
onAction(polling.onError.action);
|
|
5957
5970
|
}
|
|
@@ -5960,7 +5973,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5960
5973
|
}
|
|
5961
5974
|
|
|
5962
5975
|
// src/step/layoutStep/LayoutStep.tsx
|
|
5963
|
-
var
|
|
5976
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5964
5977
|
var getComponents = (step, options) => {
|
|
5965
5978
|
var _a;
|
|
5966
5979
|
if (isEmpty(step)) {
|
|
@@ -5983,7 +5996,7 @@ var LayoutStep = (props) => {
|
|
|
5983
5996
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5984
5997
|
};
|
|
5985
5998
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5986
|
-
return /* @__PURE__ */ (0,
|
|
5999
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5987
6000
|
DynamicLayout_default,
|
|
5988
6001
|
{
|
|
5989
6002
|
components,
|
|
@@ -5999,10 +6012,10 @@ var LayoutStep = (props) => {
|
|
|
5999
6012
|
var LayoutStep_default = LayoutStep;
|
|
6000
6013
|
|
|
6001
6014
|
// src/step/cameraStep/CameraStep.tsx
|
|
6002
|
-
var
|
|
6015
|
+
var import_react38 = require("react");
|
|
6003
6016
|
|
|
6004
6017
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6005
|
-
var
|
|
6018
|
+
var import_react37 = require("react");
|
|
6006
6019
|
var import_react_intl30 = require("react-intl");
|
|
6007
6020
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
6008
6021
|
|
|
@@ -6049,11 +6062,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl23.defineMess
|
|
|
6049
6062
|
});
|
|
6050
6063
|
|
|
6051
6064
|
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6052
|
-
var
|
|
6065
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6053
6066
|
var OrientationLockOverlay = () => {
|
|
6054
6067
|
const intl = (0, import_react_intl24.useIntl)();
|
|
6055
|
-
return /* @__PURE__ */ (0,
|
|
6056
|
-
/* @__PURE__ */ (0,
|
|
6068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "orientation-lock-overlay p-x-3 p-y-3", "data-testid": "orientation-lock", children: [
|
|
6069
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6057
6070
|
"img",
|
|
6058
6071
|
{
|
|
6059
6072
|
className: "m-b-3",
|
|
@@ -6063,21 +6076,21 @@ var OrientationLockOverlay = () => {
|
|
|
6063
6076
|
alt: intl.formatMessage(OrientationLockOverlay_messages_default.imgAlt)
|
|
6064
6077
|
}
|
|
6065
6078
|
),
|
|
6066
|
-
/* @__PURE__ */ (0,
|
|
6079
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6067
6080
|
] });
|
|
6068
6081
|
};
|
|
6069
6082
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6070
6083
|
|
|
6071
6084
|
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
6072
|
-
var
|
|
6073
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
6085
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6086
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
6074
6087
|
var ReviewBottomBar = ({
|
|
6075
6088
|
onSubmit,
|
|
6076
6089
|
onRetry
|
|
6077
6090
|
}) => {
|
|
6078
6091
|
const intl = (0, import_react_intl25.useIntl)();
|
|
6079
|
-
return /* @__PURE__ */ (0,
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6081
6094
|
import_components27.Button,
|
|
6082
6095
|
{
|
|
6083
6096
|
className: "m-b-1",
|
|
@@ -6088,7 +6101,7 @@ var ReviewBottomBar = ({
|
|
|
6088
6101
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
6089
6102
|
}
|
|
6090
6103
|
),
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6104
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6092
6105
|
import_components27.Button,
|
|
6093
6106
|
{
|
|
6094
6107
|
className: "m-b-2",
|
|
@@ -6102,51 +6115,51 @@ var ReviewBottomBar = ({
|
|
|
6102
6115
|
)
|
|
6103
6116
|
] }) }) });
|
|
6104
6117
|
};
|
|
6105
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
6118
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6106
6119
|
"button",
|
|
6107
6120
|
{
|
|
6108
6121
|
type: "button",
|
|
6109
6122
|
className: "camera-capture-btn m-b-2",
|
|
6110
6123
|
"data-testid": "camera-capture-button",
|
|
6111
6124
|
onClick,
|
|
6112
|
-
children: /* @__PURE__ */ (0,
|
|
6125
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
6113
6126
|
}
|
|
6114
6127
|
);
|
|
6115
6128
|
|
|
6116
6129
|
// src/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6117
|
-
var
|
|
6130
|
+
var import_react34 = require("react");
|
|
6118
6131
|
var import_screenfull = __toESM(require_screenfull());
|
|
6119
|
-
var useFullScreenOrientationLock = (
|
|
6120
|
-
const lockOrientation = (0,
|
|
6132
|
+
var useFullScreenOrientationLock = (shouldLockOrientation) => {
|
|
6133
|
+
const lockOrientation = (0, import_react34.useCallback)(() => {
|
|
6121
6134
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6122
6135
|
window.screen.orientation.lock("portrait").catch((e) => {
|
|
6123
6136
|
});
|
|
6124
6137
|
}
|
|
6125
6138
|
}, []);
|
|
6126
|
-
const unlockOrientation = (0,
|
|
6139
|
+
const unlockOrientation = (0, import_react34.useCallback)(() => {
|
|
6127
6140
|
var _a, _b;
|
|
6128
6141
|
if ((_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) {
|
|
6129
6142
|
window.screen.orientation.unlock();
|
|
6130
6143
|
}
|
|
6131
6144
|
}, []);
|
|
6132
|
-
const enterFullScreen = (0,
|
|
6145
|
+
const enterFullScreen = (0, import_react34.useCallback)(() => {
|
|
6133
6146
|
setTimeout(() => {
|
|
6134
|
-
if (
|
|
6147
|
+
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6135
6148
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
6136
6149
|
lockOrientation();
|
|
6137
6150
|
}).catch((e) => {
|
|
6138
6151
|
});
|
|
6139
6152
|
}
|
|
6140
6153
|
}, 100);
|
|
6141
|
-
}, [
|
|
6142
|
-
const exitFullScreen = (0,
|
|
6154
|
+
}, [shouldLockOrientation, lockOrientation]);
|
|
6155
|
+
const exitFullScreen = (0, import_react34.useCallback)(() => {
|
|
6143
6156
|
if (import_screenfull.default.isFullscreen) {
|
|
6144
6157
|
import_screenfull.default.exit().catch(() => {
|
|
6145
6158
|
});
|
|
6146
6159
|
}
|
|
6147
6160
|
unlockOrientation();
|
|
6148
6161
|
}, [unlockOrientation]);
|
|
6149
|
-
(0,
|
|
6162
|
+
(0, import_react34.useEffect)(() => {
|
|
6150
6163
|
return () => {
|
|
6151
6164
|
exitFullScreen();
|
|
6152
6165
|
};
|
|
@@ -6158,7 +6171,7 @@ var useFullScreenOrientationLock = (isMobile2) => {
|
|
|
6158
6171
|
};
|
|
6159
6172
|
|
|
6160
6173
|
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6161
|
-
var
|
|
6174
|
+
var import_react35 = require("react");
|
|
6162
6175
|
|
|
6163
6176
|
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
6164
6177
|
var isSelfieCamera = (stream) => {
|
|
@@ -6206,7 +6219,7 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
6206
6219
|
|
|
6207
6220
|
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6208
6221
|
var useVideoConstraints = (direction) => {
|
|
6209
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6222
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react35.useState)();
|
|
6210
6223
|
const defaultVideoConstraints = {
|
|
6211
6224
|
facingMode: direction === "front" ? "user" : "environment",
|
|
6212
6225
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -6214,7 +6227,7 @@ var useVideoConstraints = (direction) => {
|
|
|
6214
6227
|
frameRate: 30,
|
|
6215
6228
|
aspectRatio: 16 / 9
|
|
6216
6229
|
};
|
|
6217
|
-
(0,
|
|
6230
|
+
(0, import_react35.useEffect)(() => {
|
|
6218
6231
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
6219
6232
|
}, [direction]);
|
|
6220
6233
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -6232,8 +6245,8 @@ var useVideoConstraints = (direction) => {
|
|
|
6232
6245
|
};
|
|
6233
6246
|
|
|
6234
6247
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6235
|
-
var
|
|
6236
|
-
var
|
|
6248
|
+
var import_react36 = require("react");
|
|
6249
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6237
6250
|
var captureButtonHeight = 92;
|
|
6238
6251
|
var reviewButtonsHeight = 120;
|
|
6239
6252
|
var imageHeight = 40;
|
|
@@ -6249,8 +6262,8 @@ var Overlay = ({
|
|
|
6249
6262
|
instructions,
|
|
6250
6263
|
reviewInstructions
|
|
6251
6264
|
}) => {
|
|
6252
|
-
const svgReference = (0,
|
|
6253
|
-
(0,
|
|
6265
|
+
const svgReference = (0, import_react36.useRef)(null);
|
|
6266
|
+
(0, import_react36.useEffect)(() => {
|
|
6254
6267
|
const listener = debounce(() => {
|
|
6255
6268
|
var _a;
|
|
6256
6269
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -6262,18 +6275,18 @@ var Overlay = ({
|
|
|
6262
6275
|
return () => window.removeEventListener("resize", listener);
|
|
6263
6276
|
});
|
|
6264
6277
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
6265
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
6266
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
6267
|
-
title && /* @__PURE__ */ (0,
|
|
6268
|
-
instructions && /* @__PURE__ */ (0,
|
|
6278
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
6279
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6280
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6281
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6269
6282
|
] });
|
|
6270
6283
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6271
6284
|
if (reviewInstructions) {
|
|
6272
6285
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6273
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6286
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6274
6287
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6275
6288
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6276
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6289
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, {});
|
|
6277
6290
|
}
|
|
6278
6291
|
}
|
|
6279
6292
|
const framePosition = {
|
|
@@ -6291,14 +6304,14 @@ var Overlay = ({
|
|
|
6291
6304
|
width: "90%"
|
|
6292
6305
|
}
|
|
6293
6306
|
};
|
|
6294
|
-
return /* @__PURE__ */ (0,
|
|
6295
|
-
/* @__PURE__ */ (0,
|
|
6296
|
-
/* @__PURE__ */ (0,
|
|
6297
|
-
/* @__PURE__ */ (0,
|
|
6307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6308
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("mask", { id: "mask", children: [
|
|
6309
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6310
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
6298
6311
|
] }) }),
|
|
6299
|
-
overlay && /* @__PURE__ */ (0,
|
|
6300
|
-
outline && /* @__PURE__ */ (0,
|
|
6301
|
-
/* @__PURE__ */ (0,
|
|
6312
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6313
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
6314
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
6302
6315
|
] });
|
|
6303
6316
|
};
|
|
6304
6317
|
var Overlay_default = Overlay;
|
|
@@ -6328,13 +6341,13 @@ var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
6328
6341
|
});
|
|
6329
6342
|
|
|
6330
6343
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6331
|
-
var
|
|
6344
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6332
6345
|
var NoCameraAccess = ({ onAction }) => {
|
|
6333
6346
|
const intl = (0, import_react_intl27.useIntl)();
|
|
6334
|
-
return /* @__PURE__ */ (0,
|
|
6335
|
-
/* @__PURE__ */ (0,
|
|
6336
|
-
/* @__PURE__ */ (0,
|
|
6337
|
-
/* @__PURE__ */ (0,
|
|
6347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6348
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6349
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6350
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components28.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6338
6351
|
] }) }) }) });
|
|
6339
6352
|
};
|
|
6340
6353
|
var NoCameraAccess_default = NoCameraAccess;
|
|
@@ -6358,12 +6371,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages
|
|
|
6358
6371
|
});
|
|
6359
6372
|
|
|
6360
6373
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6361
|
-
var
|
|
6374
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6362
6375
|
var CameraNotSupported = () => {
|
|
6363
6376
|
const intl = (0, import_react_intl29.useIntl)();
|
|
6364
|
-
return /* @__PURE__ */ (0,
|
|
6365
|
-
/* @__PURE__ */ (0,
|
|
6366
|
-
/* @__PURE__ */ (0,
|
|
6377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6378
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6379
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6367
6380
|
] }) }) }) });
|
|
6368
6381
|
};
|
|
6369
6382
|
var CameraNotSupported_default = CameraNotSupported;
|
|
@@ -6388,7 +6401,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
6388
6401
|
};
|
|
6389
6402
|
|
|
6390
6403
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6391
|
-
var
|
|
6404
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6392
6405
|
var CameraCapture = ({
|
|
6393
6406
|
direction = "back",
|
|
6394
6407
|
overlay = "",
|
|
@@ -6400,16 +6413,20 @@ var CameraCapture = ({
|
|
|
6400
6413
|
onCapture,
|
|
6401
6414
|
onEvent
|
|
6402
6415
|
}) => {
|
|
6403
|
-
const [mode, setMode] = (0,
|
|
6404
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
6405
|
-
const [ready, setReady] = (0,
|
|
6406
|
-
const [reviewImage, setReviewImage] = (0,
|
|
6407
|
-
const webcamReference = (0,
|
|
6416
|
+
const [mode, setMode] = (0, import_react37.useState)("CAPTURE");
|
|
6417
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react37.useState)(false);
|
|
6418
|
+
const [ready, setReady] = (0, import_react37.useState)(false);
|
|
6419
|
+
const [reviewImage, setReviewImage] = (0, import_react37.useState)();
|
|
6420
|
+
const webcamReference = (0, import_react37.useRef)(null);
|
|
6408
6421
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6409
|
-
const
|
|
6410
|
-
const
|
|
6422
|
+
const featureFlags = useFeatureContext();
|
|
6423
|
+
const shouldLockOrientation = (0, import_react37.useMemo)(
|
|
6424
|
+
() => (featureFlags == null ? void 0 : featureFlags.cameraOrientationLock) === true && isMobile(),
|
|
6425
|
+
[featureFlags == null ? void 0 : featureFlags.cameraOrientationLock]
|
|
6426
|
+
);
|
|
6427
|
+
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(shouldLockOrientation);
|
|
6411
6428
|
const intl = (0, import_react_intl30.useIntl)();
|
|
6412
|
-
const handleCapture = (0,
|
|
6429
|
+
const handleCapture = (0, import_react37.useCallback)(async () => {
|
|
6413
6430
|
var _a, _b, _c, _d, _e, _f;
|
|
6414
6431
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
6415
6432
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -6431,7 +6448,7 @@ var CameraCapture = ({
|
|
|
6431
6448
|
);
|
|
6432
6449
|
}
|
|
6433
6450
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6434
|
-
const handleUserMediaError = (0,
|
|
6451
|
+
const handleUserMediaError = (0, import_react37.useCallback)(
|
|
6435
6452
|
(error) => {
|
|
6436
6453
|
if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
|
|
6437
6454
|
setMode("NO_CAMERA_ACCESS");
|
|
@@ -6443,7 +6460,7 @@ var CameraCapture = ({
|
|
|
6443
6460
|
},
|
|
6444
6461
|
[setMode, onEvent]
|
|
6445
6462
|
);
|
|
6446
|
-
const handleUserMedia = (0,
|
|
6463
|
+
const handleUserMedia = (0, import_react37.useCallback)(
|
|
6447
6464
|
(stream) => {
|
|
6448
6465
|
enterFullScreen();
|
|
6449
6466
|
setReady(true);
|
|
@@ -6460,13 +6477,13 @@ var CameraCapture = ({
|
|
|
6460
6477
|
setReviewImage(void 0);
|
|
6461
6478
|
};
|
|
6462
6479
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6463
|
-
(0,
|
|
6480
|
+
(0, import_react37.useEffect)(() => {
|
|
6464
6481
|
if (mode !== "CAPTURE") {
|
|
6465
6482
|
exitFullScreen();
|
|
6466
6483
|
}
|
|
6467
6484
|
}, [mode, exitFullScreen]);
|
|
6468
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
6469
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
6485
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6486
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6470
6487
|
import_react_webcam.default,
|
|
6471
6488
|
{
|
|
6472
6489
|
ref: webcamReference,
|
|
@@ -6477,7 +6494,7 @@ var CameraCapture = ({
|
|
|
6477
6494
|
onUserMedia: handleUserMedia
|
|
6478
6495
|
}
|
|
6479
6496
|
),
|
|
6480
|
-
/* @__PURE__ */ (0,
|
|
6497
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6481
6498
|
Overlay_default,
|
|
6482
6499
|
{
|
|
6483
6500
|
overlay,
|
|
@@ -6487,12 +6504,12 @@ var CameraCapture = ({
|
|
|
6487
6504
|
instructions
|
|
6488
6505
|
}
|
|
6489
6506
|
),
|
|
6490
|
-
|
|
6491
|
-
ready && /* @__PURE__ */ (0,
|
|
6507
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrientationLockOverlay_default, {}),
|
|
6508
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
6492
6509
|
] });
|
|
6493
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
6494
|
-
/* @__PURE__ */ (0,
|
|
6495
|
-
/* @__PURE__ */ (0,
|
|
6510
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6511
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6512
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6496
6513
|
Overlay_default,
|
|
6497
6514
|
{
|
|
6498
6515
|
overlay,
|
|
@@ -6502,19 +6519,19 @@ var CameraCapture = ({
|
|
|
6502
6519
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6503
6520
|
}
|
|
6504
6521
|
),
|
|
6505
|
-
/* @__PURE__ */ (0,
|
|
6522
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6506
6523
|
] });
|
|
6507
|
-
return /* @__PURE__ */ (0,
|
|
6524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "camera-capture", children: [
|
|
6508
6525
|
mode === "CAPTURE" && captureScreen,
|
|
6509
6526
|
mode === "REVIEW" && reviewScreen,
|
|
6510
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
6511
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
6527
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
6528
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CameraNotSupported_default, {})
|
|
6512
6529
|
] });
|
|
6513
6530
|
};
|
|
6514
6531
|
var CameraCapture_default = CameraCapture;
|
|
6515
6532
|
|
|
6516
6533
|
// src/step/cameraStep/CameraStep.tsx
|
|
6517
|
-
var
|
|
6534
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6518
6535
|
function blobToBase64(blob) {
|
|
6519
6536
|
return new Promise((resolve, _) => {
|
|
6520
6537
|
const reader = new FileReader();
|
|
@@ -6532,8 +6549,8 @@ var CameraStep = (props) => {
|
|
|
6532
6549
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6533
6550
|
const { overlay, outline } = assets || {};
|
|
6534
6551
|
const { url: imageUrl } = image || {};
|
|
6535
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6536
|
-
(0,
|
|
6552
|
+
const [captureClicked, setCaptureClicked] = (0, import_react38.useState)(false);
|
|
6553
|
+
(0, import_react38.useEffect)(() => {
|
|
6537
6554
|
if (captureClicked) {
|
|
6538
6555
|
onAction(action);
|
|
6539
6556
|
}
|
|
@@ -6552,7 +6569,7 @@ var CameraStep = (props) => {
|
|
|
6552
6569
|
});
|
|
6553
6570
|
}
|
|
6554
6571
|
};
|
|
6555
|
-
return /* @__PURE__ */ (0,
|
|
6572
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6556
6573
|
CameraCapture_default,
|
|
6557
6574
|
{
|
|
6558
6575
|
overlay,
|
|
@@ -6629,12 +6646,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMe
|
|
|
6629
6646
|
});
|
|
6630
6647
|
|
|
6631
6648
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6632
|
-
var
|
|
6649
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6633
6650
|
var noop4 = () => {
|
|
6634
6651
|
};
|
|
6635
6652
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6636
6653
|
const { formatMessage } = (0, import_react_intl32.useIntl)();
|
|
6637
|
-
return /* @__PURE__ */ (0,
|
|
6654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6638
6655
|
DynamicLayout_default,
|
|
6639
6656
|
{
|
|
6640
6657
|
components: [
|
|
@@ -6701,9 +6718,9 @@ function getOrigin(url) {
|
|
|
6701
6718
|
// src/dynamicFlow/BackButton.tsx
|
|
6702
6719
|
var import_components30 = require("@transferwise/components");
|
|
6703
6720
|
var import_icons2 = require("@transferwise/icons");
|
|
6704
|
-
var
|
|
6721
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6705
6722
|
var BackButton = ({ title, action, onAction }) => {
|
|
6706
|
-
return /* @__PURE__ */ (0,
|
|
6723
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6707
6724
|
"a",
|
|
6708
6725
|
{
|
|
6709
6726
|
onClick: (event) => {
|
|
@@ -6714,8 +6731,8 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6714
6731
|
className: "df-back-btn",
|
|
6715
6732
|
"aria-label": title,
|
|
6716
6733
|
children: [
|
|
6717
|
-
/* @__PURE__ */ (0,
|
|
6718
|
-
/* @__PURE__ */ (0,
|
|
6734
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: title }),
|
|
6735
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components30.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6719
6736
|
]
|
|
6720
6737
|
}
|
|
6721
6738
|
);
|
|
@@ -6723,7 +6740,7 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6723
6740
|
var BackButton_default = BackButton;
|
|
6724
6741
|
|
|
6725
6742
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6726
|
-
var
|
|
6743
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6727
6744
|
var DynamicFlowStep = (props) => {
|
|
6728
6745
|
var _a, _b, _c;
|
|
6729
6746
|
const { step, globalError, onAction } = props;
|
|
@@ -6734,23 +6751,23 @@ var DynamicFlowStep = (props) => {
|
|
|
6734
6751
|
return null;
|
|
6735
6752
|
}
|
|
6736
6753
|
if (externalUrl && requiresManualTrigger) {
|
|
6737
|
-
return /* @__PURE__ */ (0,
|
|
6754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6738
6755
|
}
|
|
6739
6756
|
if (isCameraStep(step)) {
|
|
6740
|
-
return /* @__PURE__ */ (0,
|
|
6757
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
6741
6758
|
}
|
|
6742
|
-
return /* @__PURE__ */ (0,
|
|
6743
|
-
backButton && /* @__PURE__ */ (0,
|
|
6744
|
-
globalError ? /* @__PURE__ */ (0,
|
|
6745
|
-
/* @__PURE__ */ (0,
|
|
6759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
6760
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
6761
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6762
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6746
6763
|
] });
|
|
6747
6764
|
};
|
|
6748
6765
|
|
|
6749
6766
|
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6750
|
-
var
|
|
6767
|
+
var import_react39 = require("react");
|
|
6751
6768
|
var DEBOUNCE_DELAY = 1e3;
|
|
6752
6769
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6753
|
-
const map = (0,
|
|
6770
|
+
const map = (0, import_react39.useRef)(/* @__PURE__ */ new Map());
|
|
6754
6771
|
const retrieveOrCreate = (key) => {
|
|
6755
6772
|
if (map.current.has(key)) {
|
|
6756
6773
|
return map.current.get(key);
|
|
@@ -6773,12 +6790,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6773
6790
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6774
6791
|
|
|
6775
6792
|
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6776
|
-
var
|
|
6793
|
+
var import_react40 = require("react");
|
|
6777
6794
|
var useDynamicFlowState = (initialStep) => {
|
|
6778
6795
|
var _a, _b;
|
|
6779
|
-
const [formErrors, setFormErrors] = (0,
|
|
6780
|
-
const [globalError, setGlobalError] = (0,
|
|
6781
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6796
|
+
const [formErrors, setFormErrors] = (0, import_react40.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6797
|
+
const [globalError, setGlobalError] = (0, import_react40.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6798
|
+
const [stepAndModels, setStepAndModels] = (0, import_react40.useState)({
|
|
6782
6799
|
step: initialStep || void 0,
|
|
6783
6800
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6784
6801
|
etag: void 0
|
|
@@ -6808,7 +6825,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6808
6825
|
return updatedState;
|
|
6809
6826
|
});
|
|
6810
6827
|
};
|
|
6811
|
-
const modelIsValid = (0,
|
|
6828
|
+
const modelIsValid = (0, import_react40.useMemo)(
|
|
6812
6829
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6813
6830
|
[models, step]
|
|
6814
6831
|
);
|
|
@@ -6887,17 +6904,17 @@ var isInlineSchema = (schema) => {
|
|
|
6887
6904
|
|
|
6888
6905
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
6889
6906
|
var import_components31 = require("@transferwise/components");
|
|
6890
|
-
var
|
|
6891
|
-
var
|
|
6907
|
+
var import_react41 = require("react");
|
|
6908
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6892
6909
|
function useLoader(loaderConfig, initialState) {
|
|
6893
6910
|
const config = __spreadValues({
|
|
6894
6911
|
size: import_components31.Size.EXTRA_LARGE,
|
|
6895
6912
|
initial: true,
|
|
6896
6913
|
submission: false
|
|
6897
6914
|
}, loaderConfig);
|
|
6898
|
-
const [loadingState, setLoadingState] = (0,
|
|
6915
|
+
const [loadingState, setLoadingState] = (0, import_react41.useState)(initialState);
|
|
6899
6916
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6900
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
6917
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6901
6918
|
import_components31.Loader,
|
|
6902
6919
|
{
|
|
6903
6920
|
size: config.size,
|
|
@@ -6909,15 +6926,15 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6909
6926
|
}
|
|
6910
6927
|
|
|
6911
6928
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6912
|
-
var
|
|
6929
|
+
var import_react42 = require("react");
|
|
6913
6930
|
|
|
6914
6931
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6915
6932
|
var import_components32 = require("@transferwise/components");
|
|
6916
6933
|
var import_react_intl33 = require("react-intl");
|
|
6917
|
-
var
|
|
6934
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6918
6935
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6919
6936
|
const { formatMessage } = (0, import_react_intl33.useIntl)();
|
|
6920
|
-
return /* @__PURE__ */ (0,
|
|
6937
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6921
6938
|
import_components32.Alert,
|
|
6922
6939
|
{
|
|
6923
6940
|
action: {
|
|
@@ -6933,10 +6950,10 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6933
6950
|
};
|
|
6934
6951
|
|
|
6935
6952
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6936
|
-
var
|
|
6953
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6937
6954
|
var noop5 = () => {
|
|
6938
6955
|
};
|
|
6939
|
-
var ErrorBoundary = class extends
|
|
6956
|
+
var ErrorBoundary = class extends import_react42.Component {
|
|
6940
6957
|
constructor(props) {
|
|
6941
6958
|
super(props);
|
|
6942
6959
|
this.handleErrorReset = () => {
|
|
@@ -6954,8 +6971,8 @@ var ErrorBoundary = class extends import_react41.Component {
|
|
|
6954
6971
|
render() {
|
|
6955
6972
|
const { children } = this.props;
|
|
6956
6973
|
const { hasError, isFatalError } = this.state;
|
|
6957
|
-
return /* @__PURE__ */ (0,
|
|
6958
|
-
hasError && /* @__PURE__ */ (0,
|
|
6974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
6975
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6959
6976
|
!isFatalError && children
|
|
6960
6977
|
] });
|
|
6961
6978
|
}
|
|
@@ -7060,7 +7077,7 @@ var assertResponseIsValid = (response) => {
|
|
|
7060
7077
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
7061
7078
|
|
|
7062
7079
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
7063
|
-
var
|
|
7080
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7064
7081
|
var noop6 = () => {
|
|
7065
7082
|
};
|
|
7066
7083
|
var DynamicFlowComponent = ({
|
|
@@ -7070,6 +7087,7 @@ var DynamicFlowComponent = ({
|
|
|
7070
7087
|
initialStep,
|
|
7071
7088
|
loaderConfig,
|
|
7072
7089
|
displayStepTitle = true,
|
|
7090
|
+
featureFlags,
|
|
7073
7091
|
onCompletion,
|
|
7074
7092
|
onError,
|
|
7075
7093
|
onEvent = noop6,
|
|
@@ -7088,24 +7106,24 @@ var DynamicFlowComponent = ({
|
|
|
7088
7106
|
setStepAndEtag,
|
|
7089
7107
|
setSchemaModel
|
|
7090
7108
|
} = useDynamicFlowState(initialStep);
|
|
7091
|
-
const [submitted, setSubmitted] = (0,
|
|
7109
|
+
const [submitted, setSubmitted] = (0, import_react43.useState)(false);
|
|
7092
7110
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
7093
7111
|
loaderConfig,
|
|
7094
7112
|
initialStep ? "idle" : "initial"
|
|
7095
7113
|
);
|
|
7096
7114
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
7097
|
-
const analyticsMetadata = (0,
|
|
7115
|
+
const analyticsMetadata = (0, import_react43.useMemo)(
|
|
7098
7116
|
() => {
|
|
7099
7117
|
var _a;
|
|
7100
7118
|
return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
|
|
7101
7119
|
},
|
|
7102
7120
|
[flowId, step]
|
|
7103
7121
|
);
|
|
7104
|
-
const dispatchEvent = (0,
|
|
7122
|
+
const dispatchEvent = (0, import_react43.useMemo)(
|
|
7105
7123
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
7106
7124
|
[onEvent, analyticsMetadata]
|
|
7107
7125
|
);
|
|
7108
|
-
const dfHttpClient = (0,
|
|
7126
|
+
const dfHttpClient = (0, import_react43.useCallback)(
|
|
7109
7127
|
({ action, data, etag: etag2 }) => {
|
|
7110
7128
|
const { url, method = "POST" } = action;
|
|
7111
7129
|
return httpClient(url != null ? url : "", {
|
|
@@ -7155,17 +7173,17 @@ var DynamicFlowComponent = ({
|
|
|
7155
7173
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
7156
7174
|
};
|
|
7157
7175
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
7158
|
-
const dispatchEventAndComplete = (0,
|
|
7176
|
+
const dispatchEventAndComplete = (0, import_react43.useCallback)(
|
|
7159
7177
|
(result) => {
|
|
7160
7178
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
7161
7179
|
onCompletion(result);
|
|
7162
7180
|
},
|
|
7163
7181
|
[onCompletion, dispatchEvent]
|
|
7164
7182
|
);
|
|
7165
|
-
(0,
|
|
7183
|
+
(0, import_react43.useEffect)(() => {
|
|
7166
7184
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
7167
7185
|
}, []);
|
|
7168
|
-
(0,
|
|
7186
|
+
(0, import_react43.useEffect)(() => {
|
|
7169
7187
|
if (!initialStep) {
|
|
7170
7188
|
const action = __spreadValues({
|
|
7171
7189
|
id: "#initial-step-request",
|
|
@@ -7280,7 +7298,7 @@ var DynamicFlowComponent = ({
|
|
|
7280
7298
|
await actionHandler(action);
|
|
7281
7299
|
}
|
|
7282
7300
|
};
|
|
7283
|
-
return /* @__PURE__ */ (0,
|
|
7301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FeatureContextProvider, { featureFlags, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7284
7302
|
DynamicFlowStep,
|
|
7285
7303
|
{
|
|
7286
7304
|
step,
|
|
@@ -7294,9 +7312,9 @@ var DynamicFlowComponent = ({
|
|
|
7294
7312
|
},
|
|
7295
7313
|
onModelChange
|
|
7296
7314
|
}
|
|
7297
|
-
) }) }) }) });
|
|
7315
|
+
) }) }) }) }) });
|
|
7298
7316
|
};
|
|
7299
|
-
var DynamicFlow = (props) => /* @__PURE__ */ (0,
|
|
7317
|
+
var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7300
7318
|
var DynamicFlow_default = DynamicFlow;
|
|
7301
7319
|
var combineModels2 = (formModels) => {
|
|
7302
7320
|
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -7314,19 +7332,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7314
7332
|
};
|
|
7315
7333
|
|
|
7316
7334
|
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7317
|
-
var
|
|
7335
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7318
7336
|
var JsonSchemaForm = (props) => {
|
|
7319
7337
|
const schemaProps = __spreadValues({
|
|
7320
7338
|
model: null,
|
|
7321
7339
|
errors: null
|
|
7322
7340
|
}, props);
|
|
7323
7341
|
const { baseUrl = "", onEvent = noop7, onLog = noop7 } = props;
|
|
7324
|
-
return /* @__PURE__ */ (0,
|
|
7342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7325
7343
|
EventsContextProvider,
|
|
7326
7344
|
{
|
|
7327
7345
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
7328
7346
|
onEvent,
|
|
7329
|
-
children: /* @__PURE__ */ (0,
|
|
7347
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7330
7348
|
}
|
|
7331
7349
|
) });
|
|
7332
7350
|
};
|