@wise/dynamic-flow-client 2.3.0-beta-7d9b21.21 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +492 -472
- package/build/main.min.js +1 -1
- package/build/types/common/constants/FeatureName.d.ts +3 -0
- package/build/types/common/contexts/featureContext/FeatureContext.d.ts +10 -0
- package/build/types/dynamicFlow/DynamicFlowTypes.d.ts +15 -0
- package/build/types/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +1 -1
- package/package.json +26 -26
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,18 @@ 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 FeatureContext = (0, import_react6.createContext)([]);
|
|
1186
|
+
var FeatureContextProvider = ({ features, children }) => {
|
|
1187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeatureContext.Provider, { value: features, children });
|
|
1188
|
+
};
|
|
1189
|
+
var useFeatureFlag = (featureName) => {
|
|
1190
|
+
const features = (0, import_react6.useContext)(FeatureContext);
|
|
1191
|
+
return features == null ? void 0 : features.find((feature) => feature.featureName === featureName);
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1182
1194
|
// src/common/validators/types/type-validators.ts
|
|
1183
1195
|
var isString = (value) => typeof value === "string";
|
|
1184
1196
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
@@ -1898,18 +1910,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
1898
1910
|
};
|
|
1899
1911
|
|
|
1900
1912
|
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1901
|
-
var
|
|
1913
|
+
var import_react7 = require("react");
|
|
1902
1914
|
function useDebouncedFunction(callback, waitMs) {
|
|
1903
|
-
return (0,
|
|
1915
|
+
return (0, import_react7.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
1904
1916
|
}
|
|
1905
1917
|
|
|
1906
1918
|
// src/common/hooks/useExternal/useExternal.tsx
|
|
1907
|
-
var
|
|
1919
|
+
var import_react8 = require("react");
|
|
1908
1920
|
function useExternal(url) {
|
|
1909
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
1910
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
1921
|
+
const [externalWindow, setExternalWindow] = (0, import_react8.useState)(null);
|
|
1922
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react8.useState)(false);
|
|
1911
1923
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
1912
|
-
(0,
|
|
1924
|
+
(0, import_react8.useEffect)(() => {
|
|
1913
1925
|
if (url) {
|
|
1914
1926
|
setHasManuallyTriggered(false);
|
|
1915
1927
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -1920,10 +1932,10 @@ function useExternal(url) {
|
|
|
1920
1932
|
}
|
|
1921
1933
|
|
|
1922
1934
|
// src/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1923
|
-
var
|
|
1935
|
+
var import_react9 = require("react");
|
|
1924
1936
|
function useExternalStepPolling(polling, onAction) {
|
|
1925
1937
|
const httpClient = useHttpClient();
|
|
1926
|
-
const asyncFn = (0,
|
|
1938
|
+
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
1927
1939
|
if (polling) {
|
|
1928
1940
|
return () => {
|
|
1929
1941
|
return httpClient(polling.url).then((response) => {
|
|
@@ -1942,7 +1954,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1942
1954
|
return void 0;
|
|
1943
1955
|
}
|
|
1944
1956
|
}, [polling, httpClient]);
|
|
1945
|
-
const onPollingResponse = (0,
|
|
1957
|
+
const onPollingResponse = (0, import_react9.useCallback)(
|
|
1946
1958
|
(pollingResponse) => {
|
|
1947
1959
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
1948
1960
|
const responseHandler = responseHandlers.find(
|
|
@@ -1969,7 +1981,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1969
1981
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
1970
1982
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
1971
1983
|
onPollingResponse,
|
|
1972
|
-
onFailure: (0,
|
|
1984
|
+
onFailure: (0, import_react9.useCallback)(() => {
|
|
1973
1985
|
if (polling) {
|
|
1974
1986
|
onAction(polling.onError.action);
|
|
1975
1987
|
}
|
|
@@ -1978,7 +1990,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1978
1990
|
}
|
|
1979
1991
|
|
|
1980
1992
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1981
|
-
var
|
|
1993
|
+
var import_react30 = require("react");
|
|
1982
1994
|
var import_react_intl21 = require("react-intl");
|
|
1983
1995
|
|
|
1984
1996
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
@@ -1992,7 +2004,7 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
1992
2004
|
});
|
|
1993
2005
|
|
|
1994
2006
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1995
|
-
var
|
|
2007
|
+
var import_react29 = require("react");
|
|
1996
2008
|
var import_react_intl20 = require("react-intl");
|
|
1997
2009
|
|
|
1998
2010
|
// src/common/constants/DateMode.ts
|
|
@@ -2037,7 +2049,7 @@ var Size = {
|
|
|
2037
2049
|
|
|
2038
2050
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2039
2051
|
var import_classnames6 = __toESM(require_classnames());
|
|
2040
|
-
var
|
|
2052
|
+
var import_react28 = require("react");
|
|
2041
2053
|
|
|
2042
2054
|
// src/layout/alert/DynamicAlert.tsx
|
|
2043
2055
|
var import_components2 = require("@transferwise/components");
|
|
@@ -2046,7 +2058,7 @@ var import_components2 = require("@transferwise/components");
|
|
|
2046
2058
|
var import_components = require("@transferwise/components");
|
|
2047
2059
|
|
|
2048
2060
|
// src/layout/icon/FlagIcon.tsx
|
|
2049
|
-
var
|
|
2061
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2050
2062
|
var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
|
|
2051
2063
|
var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
|
|
2052
2064
|
var isCountryFlagIcon = (name) => countryCodes.some((countryCode) => name === `flag-${countryCode}`);
|
|
@@ -2055,7 +2067,7 @@ var FlagIcon = ({ name }) => {
|
|
|
2055
2067
|
return null;
|
|
2056
2068
|
}
|
|
2057
2069
|
const code = name.substring(5);
|
|
2058
|
-
return /* @__PURE__ */ (0,
|
|
2070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2059
2071
|
"img",
|
|
2060
2072
|
{
|
|
2061
2073
|
src: `https://wise.com/web-art/assets/flags/${code}.svg`,
|
|
@@ -2249,7 +2261,7 @@ var countryCodes = [
|
|
|
2249
2261
|
|
|
2250
2262
|
// src/layout/icon/NamedIcon.tsx
|
|
2251
2263
|
var icons = __toESM(require("@transferwise/icons"));
|
|
2252
|
-
var
|
|
2264
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2253
2265
|
var isNamedIcon = (name) => {
|
|
2254
2266
|
const iconName = toCapitalisedCamelCase(name);
|
|
2255
2267
|
return Object.keys(icons).includes(iconName);
|
|
@@ -2260,7 +2272,7 @@ var NamedIcon = ({ name }) => {
|
|
|
2260
2272
|
}
|
|
2261
2273
|
const iconName = toCapitalisedCamelCase(name);
|
|
2262
2274
|
const Icon = icons[iconName];
|
|
2263
|
-
return /* @__PURE__ */ (0,
|
|
2275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Icon, { size: 24 });
|
|
2264
2276
|
};
|
|
2265
2277
|
var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
|
|
2266
2278
|
var capitaliseFirstChar = (value) => {
|
|
@@ -2269,13 +2281,13 @@ var capitaliseFirstChar = (value) => {
|
|
|
2269
2281
|
};
|
|
2270
2282
|
|
|
2271
2283
|
// src/layout/icon/DynamicIcon.tsx
|
|
2272
|
-
var
|
|
2284
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2273
2285
|
var DynamicIcon = ({ type }) => {
|
|
2274
2286
|
if (isFlagIcon(type)) {
|
|
2275
|
-
return /* @__PURE__ */ (0,
|
|
2287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FlagIcon, { name: type });
|
|
2276
2288
|
}
|
|
2277
2289
|
if (isNamedIcon(type)) {
|
|
2278
|
-
return /* @__PURE__ */ (0,
|
|
2290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NamedIcon, { name: type });
|
|
2279
2291
|
}
|
|
2280
2292
|
return null;
|
|
2281
2293
|
};
|
|
@@ -2285,17 +2297,17 @@ function isValidIconName(name) {
|
|
|
2285
2297
|
var DynamicIcon_default = DynamicIcon;
|
|
2286
2298
|
|
|
2287
2299
|
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2288
|
-
var
|
|
2300
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2289
2301
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
2290
2302
|
if (icon == null ? void 0 : icon.name) {
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
2303
|
+
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 }) });
|
|
2292
2304
|
}
|
|
2293
2305
|
if (icon == null ? void 0 : icon.text) {
|
|
2294
|
-
return /* @__PURE__ */ (0,
|
|
2306
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components.Avatar, { type: import_components.AvatarType.INITIALS, children: icon.text });
|
|
2295
2307
|
}
|
|
2296
2308
|
if (image == null ? void 0 : image.url) {
|
|
2297
2309
|
const { url, text } = image;
|
|
2298
|
-
return /* @__PURE__ */ (0,
|
|
2310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { src: url, alt: text });
|
|
2299
2311
|
}
|
|
2300
2312
|
return null;
|
|
2301
2313
|
};
|
|
@@ -2331,10 +2343,10 @@ var getTextAlignment = (align) => {
|
|
|
2331
2343
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
2332
2344
|
|
|
2333
2345
|
// src/layout/alert/DynamicAlert.tsx
|
|
2334
|
-
var
|
|
2346
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2335
2347
|
var DynamicAlert = (props) => {
|
|
2336
2348
|
const alert = props.component;
|
|
2337
|
-
return /* @__PURE__ */ (0,
|
|
2349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
2338
2350
|
import_components2.Alert,
|
|
2339
2351
|
{
|
|
2340
2352
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
@@ -2367,12 +2379,12 @@ var mapContextToAlertType = (context) => {
|
|
|
2367
2379
|
var DynamicAlert_default = DynamicAlert;
|
|
2368
2380
|
|
|
2369
2381
|
// src/layout/box/DynamicBox.tsx
|
|
2370
|
-
var
|
|
2382
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2371
2383
|
var DynamicBox = (props) => {
|
|
2372
2384
|
const box = props.component;
|
|
2373
2385
|
const margin = getMargin(box.margin || box.border ? "lg" : "xs");
|
|
2374
2386
|
if (!box.width || box.width === "xl") {
|
|
2375
|
-
return /* @__PURE__ */ (0,
|
|
2387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2376
2388
|
DynamicLayout_default,
|
|
2377
2389
|
{
|
|
2378
2390
|
components: box.components,
|
|
@@ -2385,7 +2397,7 @@ var DynamicBox = (props) => {
|
|
|
2385
2397
|
}
|
|
2386
2398
|
) });
|
|
2387
2399
|
}
|
|
2388
|
-
return /* @__PURE__ */ (0,
|
|
2400
|
+
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)(
|
|
2389
2401
|
DynamicLayout_default,
|
|
2390
2402
|
{
|
|
2391
2403
|
components: box.components,
|
|
@@ -2462,7 +2474,7 @@ var getButtonSize = (size) => {
|
|
|
2462
2474
|
};
|
|
2463
2475
|
|
|
2464
2476
|
// src/layout/button/DynamicButton.tsx
|
|
2465
|
-
var
|
|
2477
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2466
2478
|
var DynamicButton = (props) => {
|
|
2467
2479
|
var _a;
|
|
2468
2480
|
const { component, onAction } = props;
|
|
@@ -2471,7 +2483,7 @@ var DynamicButton = (props) => {
|
|
|
2471
2483
|
const priority = getButtonPriority(component);
|
|
2472
2484
|
const { loading } = useDynamicFlow();
|
|
2473
2485
|
const className = getMargin(component.margin || "md");
|
|
2474
|
-
return /* @__PURE__ */ (0,
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
2475
2487
|
import_components3.Button,
|
|
2476
2488
|
{
|
|
2477
2489
|
size: getButtonSize(component.size),
|
|
@@ -2488,12 +2500,12 @@ var DynamicButton = (props) => {
|
|
|
2488
2500
|
var DynamicButton_default = DynamicButton;
|
|
2489
2501
|
|
|
2490
2502
|
// src/layout/columns/DynamicColumns.tsx
|
|
2491
|
-
var
|
|
2503
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2492
2504
|
var DynamicColumns = (props) => {
|
|
2493
2505
|
const columns = props.component;
|
|
2494
2506
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
2495
|
-
return /* @__PURE__ */ (0,
|
|
2496
|
-
/* @__PURE__ */ (0,
|
|
2507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `${getMargin(columns.margin || "xs")} row`, children: [
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2497
2509
|
DynamicLayout_default,
|
|
2498
2510
|
{
|
|
2499
2511
|
components: columns.left,
|
|
@@ -2505,7 +2517,7 @@ var DynamicColumns = (props) => {
|
|
|
2505
2517
|
onPersistAsync: props.onPersistAsync
|
|
2506
2518
|
}
|
|
2507
2519
|
) }),
|
|
2508
|
-
/* @__PURE__ */ (0,
|
|
2520
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2509
2521
|
DynamicLayout_default,
|
|
2510
2522
|
{
|
|
2511
2523
|
components: columns.right,
|
|
@@ -2541,8 +2553,8 @@ var DynamicColumns_default = DynamicColumns;
|
|
|
2541
2553
|
|
|
2542
2554
|
// src/layout/decision/DynamicDecision.tsx
|
|
2543
2555
|
var import_components4 = require("@transferwise/components");
|
|
2544
|
-
var
|
|
2545
|
-
var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0,
|
|
2556
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2557
|
+
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)(
|
|
2546
2558
|
import_components4.NavigationOption,
|
|
2547
2559
|
{
|
|
2548
2560
|
title: option.title,
|
|
@@ -2558,17 +2570,17 @@ var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0, import_js
|
|
|
2558
2570
|
var DynamicDecision_default = DynamicDecision;
|
|
2559
2571
|
|
|
2560
2572
|
// src/layout/divider/DynamicDivider.tsx
|
|
2561
|
-
var
|
|
2573
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2562
2574
|
var DynamicDivider = ({ component }) => {
|
|
2563
2575
|
const margin = getMargin(component.margin);
|
|
2564
2576
|
const className = `m-t-0 ${margin}`;
|
|
2565
|
-
return /* @__PURE__ */ (0,
|
|
2577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("hr", { className });
|
|
2566
2578
|
};
|
|
2567
2579
|
var DynamicDivider_default = DynamicDivider;
|
|
2568
2580
|
|
|
2569
2581
|
// src/layout/external/DynamicExternal.tsx
|
|
2570
2582
|
var import_components5 = require("@transferwise/components");
|
|
2571
|
-
var
|
|
2583
|
+
var import_react10 = require("react");
|
|
2572
2584
|
var import_react_intl3 = require("react-intl");
|
|
2573
2585
|
|
|
2574
2586
|
// src/layout/external/DynamicExternal.messages.js
|
|
@@ -2582,36 +2594,36 @@ var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
|
2582
2594
|
});
|
|
2583
2595
|
|
|
2584
2596
|
// src/layout/external/DynamicExternal.tsx
|
|
2585
|
-
var
|
|
2597
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2586
2598
|
var DynamicExternal = ({ component, onAction }) => {
|
|
2587
2599
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
2588
2600
|
const intl = (0, import_react_intl3.useIntl)();
|
|
2589
|
-
const openExternalUrl = (0,
|
|
2601
|
+
const openExternalUrl = (0, import_react10.useCallback)(
|
|
2590
2602
|
() => window.open(requestUrl, "df-external-window"),
|
|
2591
2603
|
[requestUrl]
|
|
2592
2604
|
);
|
|
2593
|
-
(0,
|
|
2605
|
+
(0, import_react10.useEffect)(() => {
|
|
2594
2606
|
openExternalUrl();
|
|
2595
2607
|
}, [openExternalUrl]);
|
|
2596
2608
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
2597
2609
|
responseHandlers
|
|
2598
2610
|
}) : void 0;
|
|
2599
2611
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
2600
|
-
return /* @__PURE__ */ (0,
|
|
2601
|
-
/* @__PURE__ */ (0,
|
|
2602
|
-
/* @__PURE__ */ (0,
|
|
2603
|
-
/* @__PURE__ */ (0,
|
|
2612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components5.Loader, { size: import_components5.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
2614
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("br", {}),
|
|
2615
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components5.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
2604
2616
|
] });
|
|
2605
2617
|
};
|
|
2606
2618
|
var DynamicExternal_default = DynamicExternal;
|
|
2607
2619
|
|
|
2608
2620
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2609
|
-
var
|
|
2621
|
+
var import_react22 = require("react");
|
|
2610
2622
|
|
|
2611
2623
|
// src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2612
2624
|
var import_classnames = __toESM(require_classnames());
|
|
2613
|
-
var
|
|
2614
|
-
var
|
|
2625
|
+
var import_react11 = require("react");
|
|
2626
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2615
2627
|
var splitModel = (model, schemas) => {
|
|
2616
2628
|
return schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
2617
2629
|
};
|
|
@@ -2634,13 +2646,13 @@ var AllOfSchema = (props) => {
|
|
|
2634
2646
|
setModels(models);
|
|
2635
2647
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
2636
2648
|
};
|
|
2637
|
-
const [models, setModels] = (0,
|
|
2638
|
-
return /* @__PURE__ */ (0,
|
|
2639
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
2640
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
2641
|
-
/* @__PURE__ */ (0,
|
|
2649
|
+
const [models, setModels] = (0, import_react11.useState)(splitModel(props.model, props.schema.allOf));
|
|
2650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2651
|
+
props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { className: "page-header", children: props.schema.title }),
|
|
2652
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: props.schema.description }),
|
|
2653
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
2642
2654
|
// eslint-disable-next-line react/no-array-index-key
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2655
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: (0, import_classnames.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2644
2656
|
GenericSchema_default,
|
|
2645
2657
|
{
|
|
2646
2658
|
schema,
|
|
@@ -2666,7 +2678,7 @@ var AllOfSchema_default = AllOfSchema;
|
|
|
2666
2678
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2667
2679
|
var import_components7 = require("@transferwise/components");
|
|
2668
2680
|
var import_classnames2 = __toESM(require_classnames());
|
|
2669
|
-
var
|
|
2681
|
+
var import_react12 = require("react");
|
|
2670
2682
|
|
|
2671
2683
|
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2672
2684
|
var import_components6 = require("@transferwise/components");
|
|
@@ -2729,7 +2741,7 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
|
|
|
2729
2741
|
});
|
|
2730
2742
|
|
|
2731
2743
|
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2732
|
-
var
|
|
2744
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2733
2745
|
var ControlFeedback = (props) => {
|
|
2734
2746
|
var _a;
|
|
2735
2747
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -2738,12 +2750,12 @@ var ControlFeedback = (props) => {
|
|
|
2738
2750
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!((_a = props.validations) == null ? void 0 : _a.length);
|
|
2739
2751
|
const isDescriptionVisible = props.focused && props.schema.description && !isValidationVisible;
|
|
2740
2752
|
const hasInfoMessage = !!props.infoMessage;
|
|
2741
|
-
return /* @__PURE__ */ (0,
|
|
2742
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
2743
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
2744
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
2745
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
2746
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
2753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id: props.id, children: [
|
|
2754
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components6.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
2755
|
+
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,
|
|
2756
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components6.InlineAlert, { type: "info", children: [
|
|
2757
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: props.schema.description }),
|
|
2758
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: props.infoMessage })
|
|
2747
2759
|
] })
|
|
2748
2760
|
] });
|
|
2749
2761
|
};
|
|
@@ -2885,15 +2897,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
2885
2897
|
}
|
|
2886
2898
|
|
|
2887
2899
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2888
|
-
var
|
|
2900
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2889
2901
|
var MultipleFileUploadSchema = (props) => {
|
|
2890
2902
|
var _a, _b;
|
|
2891
2903
|
const { onChange, schema } = props;
|
|
2892
2904
|
const onEvent = useEventDispatcher();
|
|
2893
2905
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
2894
|
-
const uid = (0,
|
|
2895
|
-
const [inputChanged, setInputChanged] = (0,
|
|
2896
|
-
const [files, setFiles] = (0,
|
|
2906
|
+
const uid = (0, import_react12.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
2907
|
+
const [inputChanged, setInputChanged] = (0, import_react12.useState)(false);
|
|
2908
|
+
const [files, setFiles] = (0, import_react12.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
2897
2909
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
2898
2910
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
2899
2911
|
const isBlob = isBlobSchema(fileSchemaDescriptor);
|
|
@@ -2947,10 +2959,10 @@ var MultipleFileUploadSchema = (props) => {
|
|
|
2947
2959
|
onDeleteFile: () => Promise.resolve()
|
|
2948
2960
|
});
|
|
2949
2961
|
const feedbackId = `${uid}-feedback`;
|
|
2950
|
-
return /* @__PURE__ */ (0,
|
|
2951
|
-
/* @__PURE__ */ (0,
|
|
2952
|
-
/* @__PURE__ */ (0,
|
|
2953
|
-
/* @__PURE__ */ (0,
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
2964
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2954
2966
|
ControlFeedback_default,
|
|
2955
2967
|
{
|
|
2956
2968
|
id: feedbackId,
|
|
@@ -2993,17 +3005,17 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
2993
3005
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
2994
3006
|
var import_components9 = require("@transferwise/components");
|
|
2995
3007
|
var import_icons = require("@transferwise/icons");
|
|
2996
|
-
var
|
|
3008
|
+
var import_react13 = require("react");
|
|
2997
3009
|
var import_react_intl11 = require("react-intl");
|
|
2998
3010
|
|
|
2999
3011
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
3000
3012
|
var import_components8 = require("@transferwise/components");
|
|
3001
|
-
var
|
|
3013
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3002
3014
|
var ItemSummaryOption = ({
|
|
3003
3015
|
item,
|
|
3004
3016
|
onClick
|
|
3005
3017
|
}) => {
|
|
3006
|
-
return /* @__PURE__ */ (0,
|
|
3018
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3007
3019
|
import_components8.NavigationOption,
|
|
3008
3020
|
{
|
|
3009
3021
|
onClick,
|
|
@@ -3041,7 +3053,7 @@ var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
3041
3053
|
|
|
3042
3054
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3043
3055
|
var import_react_intl10 = require("react-intl");
|
|
3044
|
-
var
|
|
3056
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3045
3057
|
var RepeatableSchemaStep = ({
|
|
3046
3058
|
type,
|
|
3047
3059
|
schema,
|
|
@@ -3081,7 +3093,7 @@ var RepeatableSchemaStep = ({
|
|
|
3081
3093
|
actions: [],
|
|
3082
3094
|
schemas: []
|
|
3083
3095
|
};
|
|
3084
|
-
return /* @__PURE__ */ (0,
|
|
3096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3085
3097
|
DynamicFlowStep,
|
|
3086
3098
|
{
|
|
3087
3099
|
step,
|
|
@@ -3279,7 +3291,7 @@ var getStringValueFromSchema = (schema, model) => {
|
|
|
3279
3291
|
var schemaSummaryProvides = (summary, providesProp) => !!summary && Object.hasOwnProperty.call(summary, providesProp) && Boolean(summary[providesProp]);
|
|
3280
3292
|
|
|
3281
3293
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3282
|
-
var
|
|
3294
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3283
3295
|
var RepeatableSchema = ({
|
|
3284
3296
|
schema,
|
|
3285
3297
|
model,
|
|
@@ -3287,8 +3299,8 @@ var RepeatableSchema = ({
|
|
|
3287
3299
|
submitted,
|
|
3288
3300
|
onChange
|
|
3289
3301
|
}) => {
|
|
3290
|
-
const [openModalType, setOpenModalType] = (0,
|
|
3291
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
3302
|
+
const [openModalType, setOpenModalType] = (0, import_react13.useState)(null);
|
|
3303
|
+
const [itemSummaries, setItemSummaries] = (0, import_react13.useState)(() => {
|
|
3292
3304
|
if (isObject(model) && !isArray(model)) {
|
|
3293
3305
|
throw new Error(
|
|
3294
3306
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -3296,7 +3308,7 @@ var RepeatableSchema = ({
|
|
|
3296
3308
|
}
|
|
3297
3309
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
3298
3310
|
});
|
|
3299
|
-
const [editableItem, setEditableItem] = (0,
|
|
3311
|
+
const [editableItem, setEditableItem] = (0, import_react13.useState)({ item: null, model: null });
|
|
3300
3312
|
const broadcastModelChange = (updatedItems) => {
|
|
3301
3313
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
3302
3314
|
onChange({
|
|
@@ -3333,9 +3345,9 @@ var RepeatableSchema = ({
|
|
|
3333
3345
|
setOpenModalType(null);
|
|
3334
3346
|
};
|
|
3335
3347
|
const { formatMessage } = (0, import_react_intl11.useIntl)();
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
3337
|
-
schema.title && /* @__PURE__ */ (0,
|
|
3338
|
-
itemSummaries && itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
3348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3349
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components9.Header, { title: schema.title }),
|
|
3350
|
+
itemSummaries && itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3339
3351
|
ItemSummaryOption,
|
|
3340
3352
|
{
|
|
3341
3353
|
item: itemSummary,
|
|
@@ -3343,21 +3355,21 @@ var RepeatableSchema = ({
|
|
|
3343
3355
|
},
|
|
3344
3356
|
JSON.stringify(itemSummary)
|
|
3345
3357
|
)),
|
|
3346
|
-
/* @__PURE__ */ (0,
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3347
3359
|
import_components9.NavigationOption,
|
|
3348
3360
|
{
|
|
3349
3361
|
onClick: onAddItem,
|
|
3350
|
-
media: /* @__PURE__ */ (0,
|
|
3362
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_icons.Plus, {}),
|
|
3351
3363
|
title: schema.addItemTitle || formatMessage(RepeatableSchema_messages_default.addItemTitle)
|
|
3352
3364
|
}
|
|
3353
3365
|
),
|
|
3354
|
-
/* @__PURE__ */ (0,
|
|
3366
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3355
3367
|
import_components9.Modal,
|
|
3356
3368
|
{
|
|
3357
3369
|
open: openModalType !== null,
|
|
3358
3370
|
onClose: onCancelEdit,
|
|
3359
3371
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(RepeatableSchema_messages_default.addItemTitle),
|
|
3360
|
-
body: /* @__PURE__ */ (0,
|
|
3372
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3361
3373
|
RepeatableSchemaStep_default,
|
|
3362
3374
|
{
|
|
3363
3375
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -3398,14 +3410,14 @@ var getUpdatedItemSummaries = (action, {
|
|
|
3398
3410
|
var RepeatableSchema_default = RepeatableSchema;
|
|
3399
3411
|
|
|
3400
3412
|
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3401
|
-
var
|
|
3413
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3402
3414
|
var ArrayListSchema = (props) => {
|
|
3403
3415
|
const { schema } = props;
|
|
3404
3416
|
if (isMultipleFileUploadSchema(schema)) {
|
|
3405
|
-
return /* @__PURE__ */ (0,
|
|
3417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3406
3418
|
}
|
|
3407
3419
|
if (isListArraySchema(schema)) {
|
|
3408
|
-
return /* @__PURE__ */ (0,
|
|
3420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3409
3421
|
}
|
|
3410
3422
|
throw new Error("Invalid array list schema");
|
|
3411
3423
|
};
|
|
@@ -3416,11 +3428,11 @@ ArrayListSchema.defaultProps = {
|
|
|
3416
3428
|
var ArrayListSchema_default = ArrayListSchema;
|
|
3417
3429
|
|
|
3418
3430
|
// src/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3419
|
-
var
|
|
3431
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3420
3432
|
var ArraySchema = (props) => {
|
|
3421
3433
|
const { schema } = props;
|
|
3422
3434
|
if (isListArraySchema(schema)) {
|
|
3423
|
-
return /* @__PURE__ */ (0,
|
|
3435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
3424
3436
|
}
|
|
3425
3437
|
throw new Error("Not implemented");
|
|
3426
3438
|
};
|
|
@@ -3431,8 +3443,8 @@ var ArraySchema_default = ArraySchema;
|
|
|
3431
3443
|
|
|
3432
3444
|
// src/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3433
3445
|
var import_classnames3 = __toESM(require_classnames());
|
|
3434
|
-
var
|
|
3435
|
-
var
|
|
3446
|
+
var import_react14 = require("react");
|
|
3447
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3436
3448
|
var getSchemaColumnClasses2 = (width) => {
|
|
3437
3449
|
return {
|
|
3438
3450
|
"col-xs-12": true,
|
|
@@ -3441,7 +3453,7 @@ var getSchemaColumnClasses2 = (width) => {
|
|
|
3441
3453
|
};
|
|
3442
3454
|
};
|
|
3443
3455
|
var ObjectSchema = (props) => {
|
|
3444
|
-
const [model, setModel] = (0,
|
|
3456
|
+
const [model, setModel] = (0, import_react14.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
3445
3457
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
3446
3458
|
if (onChangeProps.model !== null) {
|
|
3447
3459
|
model[propertyName] = onChangeProps.model;
|
|
@@ -3452,7 +3464,7 @@ var ObjectSchema = (props) => {
|
|
|
3452
3464
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
3453
3465
|
};
|
|
3454
3466
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
3455
|
-
(0,
|
|
3467
|
+
(0, import_react14.useEffect)(() => {
|
|
3456
3468
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
3457
3469
|
setModel(newModel);
|
|
3458
3470
|
if (!isEqual(newModel, model)) {
|
|
@@ -3470,25 +3482,25 @@ var ObjectSchema = (props) => {
|
|
|
3470
3482
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
3471
3483
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
3472
3484
|
const propsErrors = props.errors;
|
|
3473
|
-
return /* @__PURE__ */ (0,
|
|
3474
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
3485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("fieldset", { children: [
|
|
3486
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("legend", { children: [
|
|
3475
3487
|
" ",
|
|
3476
3488
|
props.schema.title,
|
|
3477
3489
|
" "
|
|
3478
3490
|
] }),
|
|
3479
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0,
|
|
3491
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { children: [
|
|
3480
3492
|
" ",
|
|
3481
3493
|
props.schema.description,
|
|
3482
3494
|
" "
|
|
3483
3495
|
] }),
|
|
3484
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
3485
|
-
/* @__PURE__ */ (0,
|
|
3496
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
3497
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3486
3498
|
"div",
|
|
3487
3499
|
{
|
|
3488
3500
|
className: (0, import_classnames3.default)(
|
|
3489
3501
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
3490
3502
|
),
|
|
3491
|
-
children: /* @__PURE__ */ (0,
|
|
3503
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3492
3504
|
GenericSchema_default,
|
|
3493
3505
|
{
|
|
3494
3506
|
schema: props.schema.properties[propertyName],
|
|
@@ -3514,7 +3526,7 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
3514
3526
|
|
|
3515
3527
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3516
3528
|
var import_classnames4 = __toESM(require_classnames());
|
|
3517
|
-
var
|
|
3529
|
+
var import_react17 = require("react");
|
|
3518
3530
|
|
|
3519
3531
|
// src/jsonSchemaForm/help/Help.tsx
|
|
3520
3532
|
var import_components10 = require("@transferwise/components");
|
|
@@ -3531,14 +3543,14 @@ var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
3531
3543
|
});
|
|
3532
3544
|
|
|
3533
3545
|
// src/jsonSchemaForm/help/Help.tsx
|
|
3534
|
-
var
|
|
3546
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3535
3547
|
var Help = (props) => {
|
|
3536
3548
|
const intl = (0, import_react_intl13.useIntl)();
|
|
3537
|
-
return /* @__PURE__ */ (0,
|
|
3549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3538
3550
|
import_components10.Info,
|
|
3539
3551
|
{
|
|
3540
3552
|
className: "m-l-1",
|
|
3541
|
-
content: /* @__PURE__ */ (0,
|
|
3553
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components10.Markdown, { children: props.help.markdown }),
|
|
3542
3554
|
presentation: "POPOVER",
|
|
3543
3555
|
size: "sm",
|
|
3544
3556
|
"aria-label": intl.formatMessage(Help_messages_default.helpAria)
|
|
@@ -3548,11 +3560,11 @@ var Help = (props) => {
|
|
|
3548
3560
|
var Help_default = Help;
|
|
3549
3561
|
|
|
3550
3562
|
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3551
|
-
var
|
|
3563
|
+
var import_react16 = require("react");
|
|
3552
3564
|
|
|
3553
3565
|
// src/formControl/FormControl.tsx
|
|
3554
3566
|
var import_components11 = require("@transferwise/components");
|
|
3555
|
-
var
|
|
3567
|
+
var import_react15 = require("react");
|
|
3556
3568
|
|
|
3557
3569
|
// src/formControl/utils/value-utils.ts
|
|
3558
3570
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -3662,8 +3674,8 @@ var logInvalidTypeFallbackWarning = ({
|
|
|
3662
3674
|
};
|
|
3663
3675
|
|
|
3664
3676
|
// src/formControl/FormControl.tsx
|
|
3665
|
-
var
|
|
3666
|
-
var _FormControl = class _FormControl extends
|
|
3677
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3678
|
+
var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
3667
3679
|
constructor(props) {
|
|
3668
3680
|
super(props);
|
|
3669
3681
|
/**
|
|
@@ -3751,7 +3763,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3751
3763
|
} = this.props;
|
|
3752
3764
|
switch (type) {
|
|
3753
3765
|
case FormControlType.RADIO:
|
|
3754
|
-
return /* @__PURE__ */ (0,
|
|
3766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3755
3767
|
import_components11.RadioGroup,
|
|
3756
3768
|
{
|
|
3757
3769
|
radios: options.map(this.mapOption),
|
|
@@ -3761,7 +3773,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3761
3773
|
}
|
|
3762
3774
|
);
|
|
3763
3775
|
case FormControlType.CHECKBOX:
|
|
3764
|
-
return /* @__PURE__ */ (0,
|
|
3776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3765
3777
|
import_components11.Checkbox,
|
|
3766
3778
|
{
|
|
3767
3779
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
@@ -3776,7 +3788,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3776
3788
|
);
|
|
3777
3789
|
case FormControlType.SELECT: {
|
|
3778
3790
|
const search = options.length >= 20;
|
|
3779
|
-
return /* @__PURE__ */ (0,
|
|
3791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3780
3792
|
import_components11.Select,
|
|
3781
3793
|
{
|
|
3782
3794
|
id,
|
|
@@ -3800,13 +3812,13 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3800
3812
|
);
|
|
3801
3813
|
}
|
|
3802
3814
|
case FormControlType.TAB:
|
|
3803
|
-
return /* @__PURE__ */ (0,
|
|
3815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3804
3816
|
import_components11.Tabs,
|
|
3805
3817
|
{
|
|
3806
3818
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
3807
3819
|
tabs: options.map((option) => ({
|
|
3808
3820
|
title: option.label,
|
|
3809
|
-
content: /* @__PURE__ */ (0,
|
|
3821
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_jsx_runtime27.Fragment, {}),
|
|
3810
3822
|
disabled: option.disabled || false
|
|
3811
3823
|
})),
|
|
3812
3824
|
name: id,
|
|
@@ -3820,7 +3832,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3820
3832
|
}
|
|
3821
3833
|
);
|
|
3822
3834
|
case FormControlType.NUMBER:
|
|
3823
|
-
return /* @__PURE__ */ (0,
|
|
3835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3824
3836
|
"input",
|
|
3825
3837
|
{
|
|
3826
3838
|
autoComplete: this.getAutocompleteStatus(),
|
|
@@ -3849,7 +3861,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3849
3861
|
}
|
|
3850
3862
|
);
|
|
3851
3863
|
case FormControlType.HIDDEN:
|
|
3852
|
-
return /* @__PURE__ */ (0,
|
|
3864
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3853
3865
|
"input",
|
|
3854
3866
|
{
|
|
3855
3867
|
type: "hidden",
|
|
@@ -3859,7 +3871,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3859
3871
|
}
|
|
3860
3872
|
);
|
|
3861
3873
|
case FormControlType.PASSWORD:
|
|
3862
|
-
return /* @__PURE__ */ (0,
|
|
3874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3863
3875
|
"input",
|
|
3864
3876
|
{
|
|
3865
3877
|
autoComplete: this.getAutocompleteStatus(),
|
|
@@ -3879,7 +3891,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3879
3891
|
);
|
|
3880
3892
|
case FormControlType.DATE:
|
|
3881
3893
|
case FormControlType.DATETIME:
|
|
3882
|
-
return /* @__PURE__ */ (0,
|
|
3894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3883
3895
|
import_components11.DateInput,
|
|
3884
3896
|
{
|
|
3885
3897
|
disabled,
|
|
@@ -3893,7 +3905,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3893
3905
|
}
|
|
3894
3906
|
);
|
|
3895
3907
|
case FormControlType.DATELOOKUP: {
|
|
3896
|
-
return /* @__PURE__ */ (0,
|
|
3908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3897
3909
|
import_components11.DateLookup,
|
|
3898
3910
|
{
|
|
3899
3911
|
value: getSafeDateStringValue(value),
|
|
@@ -3911,7 +3923,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3911
3923
|
);
|
|
3912
3924
|
}
|
|
3913
3925
|
case FormControlType.TEL:
|
|
3914
|
-
return /* @__PURE__ */ (0,
|
|
3926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3915
3927
|
import_components11.PhoneNumberInput,
|
|
3916
3928
|
{
|
|
3917
3929
|
disabled,
|
|
@@ -3943,7 +3955,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3943
3955
|
autoComplete: this.getAutocompleteStatus()
|
|
3944
3956
|
};
|
|
3945
3957
|
if (this.props.displayPattern) {
|
|
3946
|
-
return /* @__PURE__ */ (0,
|
|
3958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3947
3959
|
import_components11.TextareaWithDisplayFormat,
|
|
3948
3960
|
__spreadProps(__spreadValues({
|
|
3949
3961
|
displayPattern: this.props.displayPattern
|
|
@@ -3952,7 +3964,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3952
3964
|
})
|
|
3953
3965
|
);
|
|
3954
3966
|
}
|
|
3955
|
-
return /* @__PURE__ */ (0,
|
|
3967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3956
3968
|
"textarea",
|
|
3957
3969
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
3958
3970
|
onChange: this.handleInputOnChange,
|
|
@@ -3965,7 +3977,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
3965
3977
|
return (
|
|
3966
3978
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3967
3979
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
3968
|
-
/* @__PURE__ */ (0,
|
|
3980
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3969
3981
|
import_components11.Upload,
|
|
3970
3982
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3971
3983
|
usAccept: uploadProps.usAccept || "*",
|
|
@@ -4002,7 +4014,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
4002
4014
|
autoComplete: this.getAutocompleteStatus()
|
|
4003
4015
|
};
|
|
4004
4016
|
if (this.props.displayPattern) {
|
|
4005
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4006
4018
|
import_components11.InputWithDisplayFormat,
|
|
4007
4019
|
__spreadProps(__spreadValues({
|
|
4008
4020
|
displayPattern: this.props.displayPattern
|
|
@@ -4011,7 +4023,7 @@ var _FormControl = class _FormControl extends import_react14.PureComponent {
|
|
|
4011
4023
|
})
|
|
4012
4024
|
);
|
|
4013
4025
|
}
|
|
4014
|
-
return /* @__PURE__ */ (0,
|
|
4026
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
4015
4027
|
"input",
|
|
4016
4028
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
4017
4029
|
onChange: this.handleInputOnChange,
|
|
@@ -4061,7 +4073,7 @@ var FormControl = _FormControl;
|
|
|
4061
4073
|
|
|
4062
4074
|
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4063
4075
|
var import_components12 = require("@transferwise/components");
|
|
4064
|
-
var
|
|
4076
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4065
4077
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
4066
4078
|
switch (controlType) {
|
|
4067
4079
|
case "select":
|
|
@@ -4089,7 +4101,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { s
|
|
|
4089
4101
|
var mapImage = (image) => {
|
|
4090
4102
|
if (image == null ? void 0 : image.url) {
|
|
4091
4103
|
return {
|
|
4092
|
-
icon: /* @__PURE__ */ (0,
|
|
4104
|
+
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 || "" }) }) })
|
|
4093
4105
|
};
|
|
4094
4106
|
}
|
|
4095
4107
|
return null;
|
|
@@ -4099,27 +4111,27 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
4099
4111
|
return { currency: icon.name.substring(5) };
|
|
4100
4112
|
}
|
|
4101
4113
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4102
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4114
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DynamicIcon_default, { type: icon.name }) };
|
|
4103
4115
|
}
|
|
4104
4116
|
if (icon == null ? void 0 : icon.text) {
|
|
4105
|
-
return { icon: /* @__PURE__ */ (0,
|
|
4117
|
+
return { icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: icon.text }) };
|
|
4106
4118
|
}
|
|
4107
4119
|
return null;
|
|
4108
4120
|
};
|
|
4109
4121
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
4110
4122
|
if (image == null ? void 0 : image.url) {
|
|
4111
4123
|
return {
|
|
4112
|
-
avatar: /* @__PURE__ */ (0,
|
|
4124
|
+
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: "" }) })
|
|
4113
4125
|
};
|
|
4114
4126
|
}
|
|
4115
4127
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4116
4128
|
return {
|
|
4117
|
-
avatar: /* @__PURE__ */ (0,
|
|
4129
|
+
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 }) })
|
|
4118
4130
|
};
|
|
4119
4131
|
}
|
|
4120
4132
|
if (icon == null ? void 0 : icon.text) {
|
|
4121
4133
|
return {
|
|
4122
|
-
avatar: /* @__PURE__ */ (0,
|
|
4134
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components12.Avatar, { type: import_components12.AvatarType.INITIALS, children: icon.text })
|
|
4123
4135
|
};
|
|
4124
4136
|
}
|
|
4125
4137
|
return null;
|
|
@@ -4140,7 +4152,7 @@ var getDisabled = (disabled) => {
|
|
|
4140
4152
|
};
|
|
4141
4153
|
|
|
4142
4154
|
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4143
|
-
var
|
|
4155
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4144
4156
|
var isNativeInput = (propsSchemaType) => {
|
|
4145
4157
|
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
4146
4158
|
};
|
|
@@ -4193,7 +4205,7 @@ var SchemaFormControl = (props) => {
|
|
|
4193
4205
|
onChange(getValidBasicModelOrNull(value2, schema), type);
|
|
4194
4206
|
};
|
|
4195
4207
|
const controlType = getControlType(schema);
|
|
4196
|
-
(0,
|
|
4208
|
+
(0, import_react16.useEffect)(() => {
|
|
4197
4209
|
warnIfInvalidSchema(schema, log, controlType);
|
|
4198
4210
|
}, [JSON.stringify(schema), log, controlType]);
|
|
4199
4211
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -4217,7 +4229,7 @@ var SchemaFormControl = (props) => {
|
|
|
4217
4229
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
4218
4230
|
describedBy
|
|
4219
4231
|
};
|
|
4220
|
-
return /* @__PURE__ */ (0,
|
|
4232
|
+
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)) });
|
|
4221
4233
|
};
|
|
4222
4234
|
SchemaFormControl.defaultProps = {
|
|
4223
4235
|
value: null,
|
|
@@ -4246,17 +4258,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4246
4258
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4247
4259
|
|
|
4248
4260
|
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4249
|
-
var
|
|
4261
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4250
4262
|
var OneOfSchema = (props) => {
|
|
4251
4263
|
const onEvent = useEventDispatcher();
|
|
4252
|
-
const [changed, setChanged] = (0,
|
|
4253
|
-
const [focused, setFocused] = (0,
|
|
4254
|
-
const [blurred, setBlurred] = (0,
|
|
4255
|
-
const id = (0,
|
|
4256
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
4264
|
+
const [changed, setChanged] = (0, import_react17.useState)(false);
|
|
4265
|
+
const [focused, setFocused] = (0, import_react17.useState)(false);
|
|
4266
|
+
const [blurred, setBlurred] = (0, import_react17.useState)(false);
|
|
4267
|
+
const id = (0, import_react17.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
4268
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react17.useState)(
|
|
4257
4269
|
getActiveSchemaIndex(props.schema, props.model)
|
|
4258
4270
|
);
|
|
4259
|
-
const [models, setModels] = (0,
|
|
4271
|
+
const [models, setModels] = (0, import_react17.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
4260
4272
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
4261
4273
|
const onSearchChange = (searchValue) => {
|
|
4262
4274
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -4264,7 +4276,7 @@ var OneOfSchema = (props) => {
|
|
|
4264
4276
|
searchValueLength: searchValue.length
|
|
4265
4277
|
});
|
|
4266
4278
|
};
|
|
4267
|
-
(0,
|
|
4279
|
+
(0, import_react17.useEffect)(() => {
|
|
4268
4280
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
4269
4281
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
4270
4282
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -4320,11 +4332,11 @@ var OneOfSchema = (props) => {
|
|
|
4320
4332
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
4321
4333
|
};
|
|
4322
4334
|
const feedbackId = `${id}-feedback`;
|
|
4323
|
-
return /* @__PURE__ */ (0,
|
|
4324
|
-
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
4325
|
-
/* @__PURE__ */ (0,
|
|
4335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4336
|
+
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
4337
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
4326
4338
|
getTitleAndHelp(props.schema, id),
|
|
4327
|
-
/* @__PURE__ */ (0,
|
|
4339
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4328
4340
|
SchemaFormControl_default,
|
|
4329
4341
|
{
|
|
4330
4342
|
id,
|
|
@@ -4338,7 +4350,7 @@ var OneOfSchema = (props) => {
|
|
|
4338
4350
|
describedBy: feedbackId
|
|
4339
4351
|
}
|
|
4340
4352
|
),
|
|
4341
|
-
/* @__PURE__ */ (0,
|
|
4353
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4342
4354
|
ControlFeedback_default,
|
|
4343
4355
|
{
|
|
4344
4356
|
id: feedbackId,
|
|
@@ -4353,9 +4365,9 @@ var OneOfSchema = (props) => {
|
|
|
4353
4365
|
}
|
|
4354
4366
|
)
|
|
4355
4367
|
] }),
|
|
4356
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
4368
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DynamicAlert_default, { component: props.schema.alert })
|
|
4357
4369
|
] }),
|
|
4358
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
4370
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
4359
4371
|
GenericSchema_default,
|
|
4360
4372
|
{
|
|
4361
4373
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -4371,12 +4383,12 @@ var OneOfSchema = (props) => {
|
|
|
4371
4383
|
] });
|
|
4372
4384
|
};
|
|
4373
4385
|
function getTitleAndHelp(schema, id) {
|
|
4374
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
4375
|
-
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
4386
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Help_default, { help: schema.help }) : null;
|
|
4387
|
+
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
|
|
4376
4388
|
schema.title,
|
|
4377
4389
|
" ",
|
|
4378
4390
|
helpElement
|
|
4379
|
-
] }) : /* @__PURE__ */ (0,
|
|
4391
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("h4", { className: "m-b-2", children: [
|
|
4380
4392
|
schema.title,
|
|
4381
4393
|
" ",
|
|
4382
4394
|
helpElement
|
|
@@ -4417,12 +4429,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
4417
4429
|
|
|
4418
4430
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4419
4431
|
var import_classnames5 = __toESM(require_classnames());
|
|
4420
|
-
var
|
|
4432
|
+
var import_react19 = require("react");
|
|
4421
4433
|
|
|
4422
4434
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4423
4435
|
var import_components13 = require("@transferwise/components");
|
|
4424
|
-
var
|
|
4425
|
-
var
|
|
4436
|
+
var import_react18 = require("react");
|
|
4437
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4426
4438
|
var UploadInputAdapter = (props) => {
|
|
4427
4439
|
const {
|
|
4428
4440
|
id,
|
|
@@ -4438,7 +4450,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4438
4450
|
onCancel
|
|
4439
4451
|
} = props;
|
|
4440
4452
|
const onEvent = useEventDispatcher();
|
|
4441
|
-
const files = (0,
|
|
4453
|
+
const files = (0, import_react18.useMemo)(() => fileId ? [{ id: fileId, status: import_components13.Status.SUCCEEDED }] : [], [fileId]);
|
|
4442
4454
|
const uploadFile = (formData) => {
|
|
4443
4455
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4444
4456
|
return httpClient(`${httpOptions.url}`, {
|
|
@@ -4456,7 +4468,7 @@ var UploadInputAdapter = (props) => {
|
|
|
4456
4468
|
}
|
|
4457
4469
|
});
|
|
4458
4470
|
};
|
|
4459
|
-
return /* @__PURE__ */ (0,
|
|
4471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
4460
4472
|
import_components13.UploadInput,
|
|
4461
4473
|
{
|
|
4462
4474
|
id,
|
|
@@ -4476,12 +4488,12 @@ var UploadInputAdapter = (props) => {
|
|
|
4476
4488
|
};
|
|
4477
4489
|
|
|
4478
4490
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4479
|
-
var
|
|
4491
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4480
4492
|
var PersistAsyncBlobSchema = (props) => {
|
|
4481
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
4482
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
4483
|
-
const [validations, setValidations] = (0,
|
|
4484
|
-
const [changed, setChanged] = (0,
|
|
4493
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4494
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4495
|
+
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
4496
|
+
const [changed, setChanged] = (0, import_react19.useState)(false);
|
|
4485
4497
|
const httpClient = useHttpClient();
|
|
4486
4498
|
const onEvent = useEventDispatcher();
|
|
4487
4499
|
const refreshValidations = () => {
|
|
@@ -4489,7 +4501,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4489
4501
|
setValidations(getValidationFailures(props.model, props.schema, !!props.required));
|
|
4490
4502
|
}
|
|
4491
4503
|
};
|
|
4492
|
-
(0,
|
|
4504
|
+
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4493
4505
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
4494
4506
|
const jsonResponse = await httpResponse.json();
|
|
4495
4507
|
const id2 = getIdFromResponse(props.schema.persistAsync.idProperty, jsonResponse);
|
|
@@ -4520,8 +4532,8 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4520
4532
|
};
|
|
4521
4533
|
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4522
4534
|
const feedbackId = `${id}-feedback`;
|
|
4523
|
-
return /* @__PURE__ */ (0,
|
|
4524
|
-
/* @__PURE__ */ (0,
|
|
4535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
4536
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4525
4537
|
UploadInputAdapter,
|
|
4526
4538
|
__spreadValues({
|
|
4527
4539
|
id,
|
|
@@ -4538,7 +4550,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4538
4550
|
onCancel
|
|
4539
4551
|
}, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
|
|
4540
4552
|
) }),
|
|
4541
|
-
/* @__PURE__ */ (0,
|
|
4553
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
4542
4554
|
ControlFeedback_default,
|
|
4543
4555
|
{
|
|
4544
4556
|
id: feedbackId,
|
|
@@ -4563,17 +4575,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
4563
4575
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4564
4576
|
|
|
4565
4577
|
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4566
|
-
var
|
|
4578
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4567
4579
|
var PersistAsyncSchema = (props) => {
|
|
4568
4580
|
const { schema } = props;
|
|
4569
4581
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4570
4582
|
if (persistAsyncSchemaType === "blob") {
|
|
4571
|
-
return /* @__PURE__ */ (0,
|
|
4583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
4572
4584
|
PersistAsyncBlobSchema_default,
|
|
4573
4585
|
__spreadValues({}, props)
|
|
4574
4586
|
);
|
|
4575
4587
|
}
|
|
4576
|
-
return /* @__PURE__ */ (0,
|
|
4588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
4577
4589
|
};
|
|
4578
4590
|
PersistAsyncSchema.defaultProps = {
|
|
4579
4591
|
required: false
|
|
@@ -4581,7 +4593,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
4581
4593
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4582
4594
|
|
|
4583
4595
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4584
|
-
var
|
|
4596
|
+
var import_react20 = require("react");
|
|
4585
4597
|
|
|
4586
4598
|
// src/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4587
4599
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -4594,7 +4606,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4594
4606
|
|
|
4595
4607
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4596
4608
|
var import_components14 = require("@transferwise/components");
|
|
4597
|
-
var
|
|
4609
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4598
4610
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
4599
4611
|
const { id, selection, setSelection } = props;
|
|
4600
4612
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -4605,14 +4617,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4605
4617
|
const toggleSelection = () => {
|
|
4606
4618
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
4607
4619
|
};
|
|
4608
|
-
return /* @__PURE__ */ (0,
|
|
4620
|
+
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 }) });
|
|
4609
4621
|
};
|
|
4610
4622
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4611
4623
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4612
4624
|
|
|
4613
4625
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4614
4626
|
var import_components15 = require("@transferwise/components");
|
|
4615
|
-
var
|
|
4627
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4616
4628
|
var PromotedOneOfRadioControl = (props) => {
|
|
4617
4629
|
var _a, _b;
|
|
4618
4630
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -4629,9 +4641,9 @@ var PromotedOneOfRadioControl = (props) => {
|
|
|
4629
4641
|
secondary: promotion.other.description
|
|
4630
4642
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
4631
4643
|
];
|
|
4632
|
-
return /* @__PURE__ */ (0,
|
|
4633
|
-
title && /* @__PURE__ */ (0,
|
|
4634
|
-
/* @__PURE__ */ (0,
|
|
4644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "form-group", children: [
|
|
4645
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
4646
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
4635
4647
|
import_components15.RadioGroup,
|
|
4636
4648
|
{
|
|
4637
4649
|
name: "promoted-selection",
|
|
@@ -4649,16 +4661,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
4649
4661
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4650
4662
|
|
|
4651
4663
|
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4652
|
-
var
|
|
4664
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4653
4665
|
var PromotedOneOfControl = (props) => {
|
|
4654
4666
|
const controlType = props.promotion.control || "radio";
|
|
4655
4667
|
switch (controlType) {
|
|
4656
4668
|
case "radio":
|
|
4657
|
-
return /* @__PURE__ */ (0,
|
|
4669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
4658
4670
|
case "checkbox":
|
|
4659
|
-
return /* @__PURE__ */ (0,
|
|
4671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
4660
4672
|
default:
|
|
4661
|
-
return /* @__PURE__ */ (0,
|
|
4673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
|
|
4662
4674
|
}
|
|
4663
4675
|
};
|
|
4664
4676
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -4668,20 +4680,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
4668
4680
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4669
4681
|
|
|
4670
4682
|
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4671
|
-
var
|
|
4683
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4672
4684
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4673
4685
|
var PromotedOneOfSchema = (props) => {
|
|
4674
4686
|
var _a;
|
|
4675
|
-
const [selection, setSelection] = (0,
|
|
4687
|
+
const [selection, setSelection] = (0, import_react20.useState)(
|
|
4676
4688
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
4677
4689
|
);
|
|
4678
4690
|
const promotedAlert = props.schema.alert;
|
|
4679
4691
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
4680
4692
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
4681
4693
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
4682
|
-
return /* @__PURE__ */ (0,
|
|
4683
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
4684
|
-
/* @__PURE__ */ (0,
|
|
4694
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
|
|
4695
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
4696
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4685
4697
|
PromotedOneOfControl_default,
|
|
4686
4698
|
{
|
|
4687
4699
|
id: props.schema.$id,
|
|
@@ -4692,8 +4704,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
4692
4704
|
setSelection
|
|
4693
4705
|
}
|
|
4694
4706
|
),
|
|
4695
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
4696
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
4707
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
4708
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
4697
4709
|
] });
|
|
4698
4710
|
};
|
|
4699
4711
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -4742,12 +4754,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
4742
4754
|
});
|
|
4743
4755
|
|
|
4744
4756
|
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4745
|
-
var
|
|
4757
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4746
4758
|
var ReadOnlySchema = ({ schema, model }) => {
|
|
4747
4759
|
const { title = "" } = schema;
|
|
4748
4760
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
4749
4761
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4750
|
-
return /* @__PURE__ */ (0,
|
|
4762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components16.DefinitionList, { layout: import_components16.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4751
4763
|
};
|
|
4752
4764
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4753
4765
|
function getValueForSchema({
|
|
@@ -4780,7 +4792,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
4780
4792
|
function getValueFromOption(option) {
|
|
4781
4793
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
4782
4794
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
4783
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
4795
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
4784
4796
|
icon.avatar,
|
|
4785
4797
|
" ",
|
|
4786
4798
|
text
|
|
@@ -4788,22 +4800,22 @@ function getValueFromOption(option) {
|
|
|
4788
4800
|
}
|
|
4789
4801
|
|
|
4790
4802
|
// src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4791
|
-
var
|
|
4792
|
-
var
|
|
4803
|
+
var import_react21 = require("react");
|
|
4804
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4793
4805
|
var ValidationAsyncSchema = (props) => {
|
|
4794
4806
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4795
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
4796
|
-
const previousRequestedModelReference = (0,
|
|
4797
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
4807
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react21.useState)(model);
|
|
4808
|
+
const previousRequestedModelReference = (0, import_react21.useRef)(null);
|
|
4809
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react21.useState)(
|
|
4798
4810
|
null
|
|
4799
4811
|
);
|
|
4800
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
4801
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
4802
|
-
const [abortController, setAbortController] = (0,
|
|
4812
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react21.useState)(null);
|
|
4813
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react21.useState)(false);
|
|
4814
|
+
const [abortController, setAbortController] = (0, import_react21.useState)(null);
|
|
4803
4815
|
const httpClient = useHttpClient();
|
|
4804
4816
|
const onEvent = useEventDispatcher();
|
|
4805
4817
|
const log = useLogger();
|
|
4806
|
-
(0,
|
|
4818
|
+
(0, import_react21.useEffect)(() => {
|
|
4807
4819
|
if (!schema.validationAsync.method) {
|
|
4808
4820
|
log.warning(
|
|
4809
4821
|
"Invalid schema or model",
|
|
@@ -4873,20 +4885,20 @@ var ValidationAsyncSchema = (props) => {
|
|
|
4873
4885
|
required,
|
|
4874
4886
|
schema
|
|
4875
4887
|
};
|
|
4876
|
-
return /* @__PURE__ */ (0,
|
|
4888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
4877
4889
|
};
|
|
4878
4890
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
4879
4891
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
4880
4892
|
|
|
4881
4893
|
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4882
|
-
var
|
|
4883
|
-
var
|
|
4894
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4895
|
+
var import_react23 = require("react");
|
|
4884
4896
|
var GenericSchemaForm = (props) => {
|
|
4885
4897
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
4886
4898
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
4887
4899
|
const type = getSchemaType(schema);
|
|
4888
4900
|
const log = useLogger();
|
|
4889
|
-
(0,
|
|
4901
|
+
(0, import_react22.useEffect)(() => {
|
|
4890
4902
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
4891
4903
|
log.error(
|
|
4892
4904
|
"Invalid schema or model",
|
|
@@ -4896,27 +4908,27 @@ var GenericSchemaForm = (props) => {
|
|
|
4896
4908
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
4897
4909
|
switch (type) {
|
|
4898
4910
|
case "readOnly":
|
|
4899
|
-
return /* @__PURE__ */ (0,
|
|
4911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
4900
4912
|
case "persistAsync":
|
|
4901
|
-
return /* @__PURE__ */ (0,
|
|
4913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4902
4914
|
case "validationAsync":
|
|
4903
|
-
return /* @__PURE__ */ (0,
|
|
4915
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4904
4916
|
case "basic": {
|
|
4905
4917
|
const basicTypeProps = __spreadValues({ infoMessage: null }, schemaProps);
|
|
4906
|
-
return /* @__PURE__ */ (0,
|
|
4918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
4907
4919
|
}
|
|
4908
4920
|
case "object":
|
|
4909
|
-
return /* @__PURE__ */ (0,
|
|
4921
|
+
return /* @__PURE__ */ (0, import_react23.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
4910
4922
|
case "array":
|
|
4911
|
-
return /* @__PURE__ */ (0,
|
|
4923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
4912
4924
|
case "promotedOneOf":
|
|
4913
|
-
return /* @__PURE__ */ (0,
|
|
4925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4914
4926
|
case "oneOf":
|
|
4915
|
-
return /* @__PURE__ */ (0,
|
|
4927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4916
4928
|
case "allOf":
|
|
4917
|
-
return /* @__PURE__ */ (0,
|
|
4929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
4918
4930
|
}
|
|
4919
|
-
return /* @__PURE__ */ (0,
|
|
4931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {});
|
|
4920
4932
|
};
|
|
4921
4933
|
var GenericSchema_default = GenericSchemaForm;
|
|
4922
4934
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -4943,7 +4955,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
4943
4955
|
};
|
|
4944
4956
|
|
|
4945
4957
|
// src/layout/form/DynamicForm.tsx
|
|
4946
|
-
var
|
|
4958
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4947
4959
|
var DynamicForm = ({
|
|
4948
4960
|
component,
|
|
4949
4961
|
model = null,
|
|
@@ -4953,7 +4965,7 @@ var DynamicForm = ({
|
|
|
4953
4965
|
onPersistAsync
|
|
4954
4966
|
}) => {
|
|
4955
4967
|
const formSchema = component.schema;
|
|
4956
|
-
return /* @__PURE__ */ (0,
|
|
4968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4957
4969
|
GenericSchema_default,
|
|
4958
4970
|
{
|
|
4959
4971
|
schema: formSchema,
|
|
@@ -4970,46 +4982,46 @@ var DynamicForm = ({
|
|
|
4970
4982
|
var DynamicForm_default = DynamicForm;
|
|
4971
4983
|
|
|
4972
4984
|
// src/layout/heading/DynamicHeading.tsx
|
|
4973
|
-
var
|
|
4985
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
4974
4986
|
var DynamicHeading = (props) => {
|
|
4975
4987
|
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
4976
4988
|
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
4977
4989
|
switch (size) {
|
|
4978
4990
|
case "xs":
|
|
4979
|
-
return /* @__PURE__ */ (0,
|
|
4991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h5", { className: classes, children: text });
|
|
4980
4992
|
case "sm":
|
|
4981
|
-
return /* @__PURE__ */ (0,
|
|
4993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: classes, children: text });
|
|
4982
4994
|
case "lg":
|
|
4983
|
-
return /* @__PURE__ */ (0,
|
|
4995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h2", { className: classes, children: text });
|
|
4984
4996
|
case "xl":
|
|
4985
|
-
return /* @__PURE__ */ (0,
|
|
4997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h1", { className: classes, children: text });
|
|
4986
4998
|
case "md":
|
|
4987
4999
|
default:
|
|
4988
|
-
return /* @__PURE__ */ (0,
|
|
5000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { className: classes, children: text });
|
|
4989
5001
|
}
|
|
4990
5002
|
};
|
|
4991
5003
|
var DynamicHeading_default = DynamicHeading;
|
|
4992
5004
|
|
|
4993
5005
|
// src/layout/markdown/DynamicMarkdown.tsx
|
|
4994
5006
|
var import_components17 = require("@transferwise/components");
|
|
4995
|
-
var
|
|
5007
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
4996
5008
|
var DynamicMarkdown = ({ component }) => {
|
|
4997
5009
|
const { content, align, margin } = component;
|
|
4998
|
-
return /* @__PURE__ */ (0,
|
|
5010
|
+
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 }) });
|
|
4999
5011
|
};
|
|
5000
5012
|
var DynamicInfo = ({ component }) => {
|
|
5001
|
-
return /* @__PURE__ */ (0,
|
|
5013
|
+
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 }) });
|
|
5002
5014
|
};
|
|
5003
5015
|
|
|
5004
5016
|
// src/layout/image/DynamicImage.tsx
|
|
5005
5017
|
var import_components18 = require("@transferwise/components");
|
|
5006
|
-
var
|
|
5007
|
-
var
|
|
5018
|
+
var import_react24 = require("react");
|
|
5019
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5008
5020
|
var DynamicImage = ({ component: image }) => {
|
|
5009
5021
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
5010
5022
|
const httpClient = useHttpClient();
|
|
5011
|
-
const [imageSource, setImageSource] = (0,
|
|
5012
|
-
(0,
|
|
5023
|
+
const [imageSource, setImageSource] = (0, import_react24.useState)("");
|
|
5024
|
+
(0, import_react24.useEffect)(() => {
|
|
5013
5025
|
void getImageSource(httpClient, url).then(setImageSource);
|
|
5014
5026
|
}, [url, httpClient]);
|
|
5015
5027
|
const imageProps = {
|
|
@@ -5021,7 +5033,7 @@ var DynamicImage = ({ component: image }) => {
|
|
|
5021
5033
|
if (!imageSource) {
|
|
5022
5034
|
return null;
|
|
5023
5035
|
}
|
|
5024
|
-
return /* @__PURE__ */ (0,
|
|
5036
|
+
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)) });
|
|
5025
5037
|
};
|
|
5026
5038
|
var readImageBlobAsDataURL = (imageBlob) => {
|
|
5027
5039
|
return new Promise((resolve, reject) => {
|
|
@@ -5055,47 +5067,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
5055
5067
|
|
|
5056
5068
|
// src/layout/instructions/DynamicInstructions.tsx
|
|
5057
5069
|
var import_components19 = require("@transferwise/components");
|
|
5058
|
-
var
|
|
5070
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5059
5071
|
var doContext = ["positive", "neutral"];
|
|
5060
5072
|
var dontContext = ["warning", "negative"];
|
|
5061
5073
|
var DynamicInstructions = ({ component }) => {
|
|
5062
5074
|
const { items } = component;
|
|
5063
5075
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
5064
5076
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
5065
|
-
return /* @__PURE__ */ (0,
|
|
5066
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5067
|
-
/* @__PURE__ */ (0,
|
|
5077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5078
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components19.Header, { title: component.title }) : null,
|
|
5079
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components19.InstructionsList, { dos, donts })
|
|
5068
5080
|
] });
|
|
5069
5081
|
};
|
|
5070
5082
|
var DynamicInstructions_default = DynamicInstructions;
|
|
5071
5083
|
|
|
5072
5084
|
// src/layout/DynamicLayout.tsx
|
|
5073
|
-
var
|
|
5085
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5074
5086
|
var getKey = (component) => JSON.stringify(component);
|
|
5075
5087
|
var DynamicLayout = (props) => {
|
|
5076
5088
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
5077
5089
|
const renderComponent = (component) => {
|
|
5078
5090
|
switch (component.type) {
|
|
5079
5091
|
case "heading":
|
|
5080
|
-
return /* @__PURE__ */ (0,
|
|
5092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
5081
5093
|
case "paragraph":
|
|
5082
|
-
return /* @__PURE__ */ (0,
|
|
5094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
5083
5095
|
case "image":
|
|
5084
|
-
return /* @__PURE__ */ (0,
|
|
5096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
5085
5097
|
case "alert":
|
|
5086
|
-
return /* @__PURE__ */ (0,
|
|
5098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
5087
5099
|
case "review":
|
|
5088
|
-
return /* @__PURE__ */ (0,
|
|
5100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
5089
5101
|
case "divider":
|
|
5090
|
-
return /* @__PURE__ */ (0,
|
|
5102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
5091
5103
|
case "info":
|
|
5092
|
-
return /* @__PURE__ */ (0,
|
|
5104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicInfo, { component }, getKey(component));
|
|
5093
5105
|
case "instructions":
|
|
5094
|
-
return /* @__PURE__ */ (0,
|
|
5106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
5095
5107
|
case "markdown":
|
|
5096
|
-
return /* @__PURE__ */ (0,
|
|
5108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
5097
5109
|
case "columns":
|
|
5098
|
-
return /* @__PURE__ */ (0,
|
|
5110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5099
5111
|
DynamicColumns_default,
|
|
5100
5112
|
{
|
|
5101
5113
|
component,
|
|
@@ -5109,7 +5121,7 @@ var DynamicLayout = (props) => {
|
|
|
5109
5121
|
getKey(component)
|
|
5110
5122
|
);
|
|
5111
5123
|
case "form":
|
|
5112
|
-
return /* @__PURE__ */ (0,
|
|
5124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5113
5125
|
DynamicForm_default,
|
|
5114
5126
|
{
|
|
5115
5127
|
component,
|
|
@@ -5122,9 +5134,9 @@ var DynamicLayout = (props) => {
|
|
|
5122
5134
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
5123
5135
|
);
|
|
5124
5136
|
case "button":
|
|
5125
|
-
return /* @__PURE__ */ (0,
|
|
5137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
5126
5138
|
case "box":
|
|
5127
|
-
return /* @__PURE__ */ (0,
|
|
5139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5128
5140
|
DynamicBox_default,
|
|
5129
5141
|
{
|
|
5130
5142
|
component,
|
|
@@ -5138,34 +5150,34 @@ var DynamicLayout = (props) => {
|
|
|
5138
5150
|
getKey(component)
|
|
5139
5151
|
);
|
|
5140
5152
|
case "decision":
|
|
5141
|
-
return /* @__PURE__ */ (0,
|
|
5153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
5142
5154
|
case "external":
|
|
5143
|
-
return /* @__PURE__ */ (0,
|
|
5155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
5144
5156
|
case "list":
|
|
5145
5157
|
case "status-list":
|
|
5146
|
-
return /* @__PURE__ */ (0,
|
|
5158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
5147
5159
|
case "loading-indicator":
|
|
5148
|
-
return /* @__PURE__ */ (0,
|
|
5160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5149
5161
|
case "search":
|
|
5150
|
-
return /* @__PURE__ */ (0,
|
|
5162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5151
5163
|
default:
|
|
5152
|
-
return /* @__PURE__ */ (0,
|
|
5164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", {}, getKey(component));
|
|
5153
5165
|
}
|
|
5154
5166
|
};
|
|
5155
5167
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5156
|
-
return /* @__PURE__ */ (0,
|
|
5168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: components.map(renderComponent) });
|
|
5157
5169
|
} else {
|
|
5158
|
-
return /* @__PURE__ */ (0,
|
|
5170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5159
5171
|
}
|
|
5160
5172
|
};
|
|
5161
5173
|
var DynamicLayout_default = DynamicLayout;
|
|
5162
5174
|
|
|
5163
5175
|
// src/layout/list/DynamicStatusList.tsx
|
|
5164
5176
|
var import_components20 = require("@transferwise/components");
|
|
5165
|
-
var
|
|
5177
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5166
5178
|
var DynamicStatusList = ({ component }) => {
|
|
5167
|
-
return /* @__PURE__ */ (0,
|
|
5168
|
-
component.title ? /* @__PURE__ */ (0,
|
|
5179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5180
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("h4", { className: "m-b-2", children: [
|
|
5169
5181
|
" ",
|
|
5170
5182
|
component.title,
|
|
5171
5183
|
" "
|
|
@@ -5178,8 +5190,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5178
5190
|
key: `${title}/${description || ""}`,
|
|
5179
5191
|
title,
|
|
5180
5192
|
description
|
|
5181
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
5182
|
-
return /* @__PURE__ */ (0,
|
|
5193
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
5194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components20.Summary, __spreadValues({}, props));
|
|
5183
5195
|
};
|
|
5184
5196
|
var statusListMap = {
|
|
5185
5197
|
done: "done",
|
|
@@ -5196,10 +5208,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
5196
5208
|
|
|
5197
5209
|
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5198
5210
|
var import_components21 = require("@transferwise/components");
|
|
5199
|
-
var
|
|
5211
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5200
5212
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5201
5213
|
const { margin, size = "md" } = component;
|
|
5202
|
-
return /* @__PURE__ */ (0,
|
|
5214
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5203
5215
|
import_components21.Loader,
|
|
5204
5216
|
{
|
|
5205
5217
|
size,
|
|
@@ -5233,18 +5245,18 @@ var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)(
|
|
|
5233
5245
|
|
|
5234
5246
|
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5235
5247
|
var import_components22 = require("@transferwise/components");
|
|
5236
|
-
var
|
|
5248
|
+
var import_react25 = require("react");
|
|
5237
5249
|
function useSnackBarIfAvailable() {
|
|
5238
|
-
const context = (0,
|
|
5250
|
+
const context = (0, import_react25.useContext)(import_components22.SnackbarContext);
|
|
5239
5251
|
return context ? context.createSnackbar : noop2;
|
|
5240
5252
|
}
|
|
5241
5253
|
function noop2() {
|
|
5242
5254
|
}
|
|
5243
5255
|
|
|
5244
5256
|
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5245
|
-
var
|
|
5246
|
-
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
5247
|
-
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0,
|
|
5257
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5258
|
+
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BasicDynamicParagraph, { component });
|
|
5259
|
+
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5248
5260
|
" ",
|
|
5249
5261
|
component.text,
|
|
5250
5262
|
" "
|
|
@@ -5258,8 +5270,8 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5258
5270
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop3);
|
|
5259
5271
|
};
|
|
5260
5272
|
const classNames7 = getTextAlignmentAndMargin({ align: component.align }) + " form-control";
|
|
5261
|
-
return /* @__PURE__ */ (0,
|
|
5262
|
-
/* @__PURE__ */ (0,
|
|
5273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5274
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5263
5275
|
"input",
|
|
5264
5276
|
{
|
|
5265
5277
|
type: "text",
|
|
@@ -5269,7 +5281,7 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5269
5281
|
style: { textOverflow: "ellipsis" }
|
|
5270
5282
|
}
|
|
5271
5283
|
),
|
|
5272
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components23.Button, { block: true, onClick: copy, className: getMargin("sm"), children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5273
5285
|
] });
|
|
5274
5286
|
};
|
|
5275
5287
|
function noop3() {
|
|
@@ -5278,7 +5290,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
5278
5290
|
|
|
5279
5291
|
// src/layout/review/DynamicReview.tsx
|
|
5280
5292
|
var import_components24 = require("@transferwise/components");
|
|
5281
|
-
var
|
|
5293
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5282
5294
|
var getDefinitions = (orientation, review) => {
|
|
5283
5295
|
return review.fields.map(
|
|
5284
5296
|
({ label, value, help }, index) => {
|
|
@@ -5292,14 +5304,14 @@ var getDefinitions = (orientation, review) => {
|
|
|
5292
5304
|
};
|
|
5293
5305
|
var getFieldValue = (value, help, orientation) => {
|
|
5294
5306
|
if (help) {
|
|
5295
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
5296
|
-
/* @__PURE__ */ (0,
|
|
5307
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5308
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Help_default, { help }),
|
|
5297
5309
|
" ",
|
|
5298
5310
|
value
|
|
5299
|
-
] }) : /* @__PURE__ */ (0,
|
|
5311
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5300
5312
|
value,
|
|
5301
5313
|
" ",
|
|
5302
|
-
/* @__PURE__ */ (0,
|
|
5314
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Help_default, { help })
|
|
5303
5315
|
] });
|
|
5304
5316
|
}
|
|
5305
5317
|
return value;
|
|
@@ -5312,7 +5324,7 @@ var DynamicReview = (props) => {
|
|
|
5312
5324
|
const review = props.component;
|
|
5313
5325
|
const margin = getMargin(review.margin || "xs");
|
|
5314
5326
|
const getReviewAction = (action) => {
|
|
5315
|
-
return /* @__PURE__ */ (0,
|
|
5327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5316
5328
|
"a",
|
|
5317
5329
|
{
|
|
5318
5330
|
href: action.url,
|
|
@@ -5327,26 +5339,26 @@ var DynamicReview = (props) => {
|
|
|
5327
5339
|
);
|
|
5328
5340
|
};
|
|
5329
5341
|
const orientation = getReviewLayout(review);
|
|
5330
|
-
return /* @__PURE__ */ (0,
|
|
5331
|
-
review.title && /* @__PURE__ */ (0,
|
|
5342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
5343
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("h6", { className: `m-b-2 ${margin}`, children: [
|
|
5332
5344
|
review.title,
|
|
5333
5345
|
review.action && getReviewAction(review.action)
|
|
5334
5346
|
] }),
|
|
5335
|
-
/* @__PURE__ */ (0,
|
|
5347
|
+
/* @__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) }) })
|
|
5336
5348
|
] });
|
|
5337
5349
|
};
|
|
5338
5350
|
var DynamicReview_default = DynamicReview;
|
|
5339
5351
|
|
|
5340
5352
|
// src/layout/search/DynamicSearch.tsx
|
|
5341
|
-
var
|
|
5353
|
+
var import_react27 = require("react");
|
|
5342
5354
|
|
|
5343
5355
|
// src/layout/search/SearchInput.tsx
|
|
5344
5356
|
var import_components25 = require("@transferwise/components");
|
|
5345
|
-
var
|
|
5357
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5346
5358
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5347
|
-
return /* @__PURE__ */ (0,
|
|
5359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5348
5360
|
title,
|
|
5349
|
-
/* @__PURE__ */ (0,
|
|
5361
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5350
5362
|
import_components25.Input,
|
|
5351
5363
|
{
|
|
5352
5364
|
type: "text",
|
|
@@ -5378,13 +5390,13 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5378
5390
|
});
|
|
5379
5391
|
|
|
5380
5392
|
// src/layout/search/SearchResults.tsx
|
|
5381
|
-
var
|
|
5393
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5382
5394
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5383
5395
|
if (results.length === 0) {
|
|
5384
|
-
return /* @__PURE__ */ (0,
|
|
5396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5385
5397
|
}
|
|
5386
|
-
return /* @__PURE__ */ (0,
|
|
5387
|
-
return /* @__PURE__ */ (0,
|
|
5398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components26.NavigationOptionsList, { children: results.map((result) => {
|
|
5399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5388
5400
|
import_components26.NavigationOption,
|
|
5389
5401
|
{
|
|
5390
5402
|
title: result.title,
|
|
@@ -5400,10 +5412,10 @@ var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
|
5400
5412
|
};
|
|
5401
5413
|
var ErrorResult = ({ onRetrySearch }) => {
|
|
5402
5414
|
const intl = (0, import_react_intl19.useIntl)();
|
|
5403
|
-
return /* @__PURE__ */ (0,
|
|
5415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { className: "m-t-2", children: [
|
|
5404
5416
|
intl.formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
5405
5417
|
"\xA0",
|
|
5406
|
-
/* @__PURE__ */ (0,
|
|
5418
|
+
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5407
5419
|
"a",
|
|
5408
5420
|
{
|
|
5409
5421
|
href: "/",
|
|
@@ -5418,15 +5430,15 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
5418
5430
|
};
|
|
5419
5431
|
|
|
5420
5432
|
// src/layout/search/useSearch.tsx
|
|
5421
|
-
var
|
|
5433
|
+
var import_react26 = require("react");
|
|
5422
5434
|
var headers = { "Content-Type": "application/json" };
|
|
5423
5435
|
var useSearch = (defaultSearchConfig) => {
|
|
5424
|
-
const [state, setState] = (0,
|
|
5436
|
+
const [state, setState] = (0, import_react26.useState)({
|
|
5425
5437
|
status: "idle"
|
|
5426
5438
|
});
|
|
5427
|
-
const abortControllerRef = (0,
|
|
5439
|
+
const abortControllerRef = (0, import_react26.useRef)(null);
|
|
5428
5440
|
const httpClient = useHttpClient();
|
|
5429
|
-
const search = (0,
|
|
5441
|
+
const search = (0, import_react26.useCallback)(
|
|
5430
5442
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
5431
5443
|
var _a;
|
|
5432
5444
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -5489,14 +5501,14 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5489
5501
|
};
|
|
5490
5502
|
|
|
5491
5503
|
// src/layout/search/DynamicSearch.tsx
|
|
5492
|
-
var
|
|
5504
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5493
5505
|
var DEBOUNCE_TIME = 400;
|
|
5494
5506
|
var DynamicSearch = ({ component, onAction }) => {
|
|
5495
|
-
const [query, setQuery] = (0,
|
|
5507
|
+
const [query, setQuery] = (0, import_react27.useState)("");
|
|
5496
5508
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5497
5509
|
const { status, results, search } = useSearch({ url, method, param });
|
|
5498
5510
|
const onEvent = useEventDispatcher();
|
|
5499
|
-
const debouncedSearch = (0,
|
|
5511
|
+
const debouncedSearch = (0, import_react27.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
|
|
5500
5512
|
const onSearchStart = () => {
|
|
5501
5513
|
onEvent("Dynamic Flow - Search Started", {});
|
|
5502
5514
|
};
|
|
@@ -5523,17 +5535,17 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5523
5535
|
setQuery(query);
|
|
5524
5536
|
void search(query);
|
|
5525
5537
|
};
|
|
5526
|
-
return /* @__PURE__ */ (0,
|
|
5527
|
-
/* @__PURE__ */ (0,
|
|
5528
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
5529
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
5530
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
5538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5540
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5541
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { onRetrySearch }),
|
|
5542
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5531
5543
|
] });
|
|
5532
5544
|
};
|
|
5533
5545
|
var DynamicSearch_default = DynamicSearch;
|
|
5534
5546
|
|
|
5535
5547
|
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5536
|
-
var
|
|
5548
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5537
5549
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5538
5550
|
var getDefaultValue = (schema) => {
|
|
5539
5551
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5570,13 +5582,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5570
5582
|
props.onBlur();
|
|
5571
5583
|
}
|
|
5572
5584
|
};
|
|
5573
|
-
const [model, setModel] = (0,
|
|
5574
|
-
const [lastModel, setLastModel] = (0,
|
|
5575
|
-
const [changed, setChanged] = (0,
|
|
5576
|
-
const [focused, setFocused] = (0,
|
|
5577
|
-
const [blurred, setBlurred] = (0,
|
|
5578
|
-
const [validations, setValidations] = (0,
|
|
5579
|
-
const id = (0,
|
|
5585
|
+
const [model, setModel] = (0, import_react28.useState)((_a = props.model) != null ? _a : null);
|
|
5586
|
+
const [lastModel, setLastModel] = (0, import_react28.useState)((_b = props.model) != null ? _b : null);
|
|
5587
|
+
const [changed, setChanged] = (0, import_react28.useState)(false);
|
|
5588
|
+
const [focused, setFocused] = (0, import_react28.useState)(false);
|
|
5589
|
+
const [blurred, setBlurred] = (0, import_react28.useState)(false);
|
|
5590
|
+
const [validations, setValidations] = (0, import_react28.useState)([]);
|
|
5591
|
+
const id = (0, import_react28.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5580
5592
|
const onSchemaChange = () => {
|
|
5581
5593
|
const defaultValue = getDefaultValue(props.schema);
|
|
5582
5594
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5591,9 +5603,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5591
5603
|
};
|
|
5592
5604
|
const isConst = props.schema.const;
|
|
5593
5605
|
const isHidden = props.schema.hidden || isConst;
|
|
5594
|
-
(0,
|
|
5595
|
-
(0,
|
|
5596
|
-
(0,
|
|
5606
|
+
(0, import_react28.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5607
|
+
(0, import_react28.useEffect)(onSchemaChange, [props.schema]);
|
|
5608
|
+
(0, import_react28.useEffect)(() => {
|
|
5597
5609
|
var _a2;
|
|
5598
5610
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
5599
5611
|
if (newModel !== model) {
|
|
@@ -5608,15 +5620,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5608
5620
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5609
5621
|
const schemaHelp = props.schema.help;
|
|
5610
5622
|
const feedbackId = `${id}-feedback`;
|
|
5611
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
5612
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
5613
|
-
/* @__PURE__ */ (0,
|
|
5614
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5615
|
-
/* @__PURE__ */ (0,
|
|
5616
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
5623
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
5624
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5625
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
5626
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "d-inline-block", children: [
|
|
5627
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5628
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help: schemaHelp })
|
|
5617
5629
|
] }),
|
|
5618
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5619
|
-
/* @__PURE__ */ (0,
|
|
5630
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help: schemaHelp }),
|
|
5631
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5620
5632
|
SchemaFormControl_default,
|
|
5621
5633
|
{
|
|
5622
5634
|
id,
|
|
@@ -5629,7 +5641,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5629
5641
|
describedBy: feedbackId
|
|
5630
5642
|
}
|
|
5631
5643
|
),
|
|
5632
|
-
/* @__PURE__ */ (0,
|
|
5644
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5633
5645
|
ControlFeedback_default,
|
|
5634
5646
|
{
|
|
5635
5647
|
id: feedbackId,
|
|
@@ -5654,7 +5666,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
5654
5666
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5655
5667
|
|
|
5656
5668
|
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5657
|
-
var
|
|
5669
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5658
5670
|
var getIdFromResponse = (idProperty, response) => {
|
|
5659
5671
|
return response[idProperty];
|
|
5660
5672
|
};
|
|
@@ -5674,12 +5686,12 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5674
5686
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5675
5687
|
const httpClient = useHttpClient();
|
|
5676
5688
|
const onEvent = useEventDispatcher();
|
|
5677
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5689
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react29.useState)(null);
|
|
5678
5690
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5679
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
5680
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
5681
|
-
const [abortController, setAbortController] = (0,
|
|
5682
|
-
(0,
|
|
5691
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react29.useState)(null);
|
|
5692
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react29.useState)(false);
|
|
5693
|
+
const [abortController, setAbortController] = (0, import_react29.useState)(null);
|
|
5694
|
+
(0, import_react29.useEffect)(() => {
|
|
5683
5695
|
if (controlTypesWithPersistOnChange.has(
|
|
5684
5696
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5685
5697
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5746,7 +5758,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5746
5758
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5747
5759
|
}
|
|
5748
5760
|
};
|
|
5749
|
-
return /* @__PURE__ */ (0,
|
|
5761
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5750
5762
|
BasicTypeSchema_default,
|
|
5751
5763
|
{
|
|
5752
5764
|
required,
|
|
@@ -5767,7 +5779,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
5767
5779
|
|
|
5768
5780
|
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5769
5781
|
var usePersistAsync = (persistAsync) => {
|
|
5770
|
-
const [abortController, setAbortController] = (0,
|
|
5782
|
+
const [abortController, setAbortController] = (0, import_react30.useState)(null);
|
|
5771
5783
|
const httpClient = useHttpClient();
|
|
5772
5784
|
const intl = (0, import_react_intl21.useIntl)();
|
|
5773
5785
|
const { schema } = persistAsync;
|
|
@@ -5846,7 +5858,7 @@ function hasStringMessage(value) {
|
|
|
5846
5858
|
}
|
|
5847
5859
|
|
|
5848
5860
|
// src/common/hooks/usePolling/usePolling.tsx
|
|
5849
|
-
var
|
|
5861
|
+
var import_react31 = require("react");
|
|
5850
5862
|
function usePolling({
|
|
5851
5863
|
asyncFn,
|
|
5852
5864
|
interval,
|
|
@@ -5855,9 +5867,9 @@ function usePolling({
|
|
|
5855
5867
|
onPollingResponse,
|
|
5856
5868
|
onFailure
|
|
5857
5869
|
}) {
|
|
5858
|
-
const onPollingResponseReference = (0,
|
|
5859
|
-
const onFailureReference = (0,
|
|
5860
|
-
const poll = (0,
|
|
5870
|
+
const onPollingResponseReference = (0, import_react31.useRef)(onPollingResponse);
|
|
5871
|
+
const onFailureReference = (0, import_react31.useRef)(onFailure);
|
|
5872
|
+
const poll = (0, import_react31.useMemo)(
|
|
5861
5873
|
() => createPollingClosure(
|
|
5862
5874
|
asyncFn,
|
|
5863
5875
|
maxAttempts,
|
|
@@ -5867,7 +5879,7 @@ function usePolling({
|
|
|
5867
5879
|
),
|
|
5868
5880
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5869
5881
|
);
|
|
5870
|
-
(0,
|
|
5882
|
+
(0, import_react31.useEffect)(() => {
|
|
5871
5883
|
if (interval > 0) {
|
|
5872
5884
|
const intervalReference = setInterval(() => {
|
|
5873
5885
|
poll();
|
|
@@ -5875,7 +5887,7 @@ function usePolling({
|
|
|
5875
5887
|
return () => clearInterval(intervalReference);
|
|
5876
5888
|
}
|
|
5877
5889
|
}, [poll, interval]);
|
|
5878
|
-
(0,
|
|
5890
|
+
(0, import_react31.useEffect)(() => {
|
|
5879
5891
|
onPollingResponseReference.current = onPollingResponse;
|
|
5880
5892
|
onFailureReference.current = onFailure;
|
|
5881
5893
|
}, [onPollingResponse, onFailure]);
|
|
@@ -5904,20 +5916,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
5904
5916
|
}
|
|
5905
5917
|
|
|
5906
5918
|
// src/common/hooks/usePrevious/usePrevious.js
|
|
5907
|
-
var
|
|
5919
|
+
var import_react32 = require("react");
|
|
5908
5920
|
var usePrevious = (value) => {
|
|
5909
|
-
const reference = (0,
|
|
5910
|
-
(0,
|
|
5921
|
+
const reference = (0, import_react32.useRef)();
|
|
5922
|
+
(0, import_react32.useEffect)(() => {
|
|
5911
5923
|
reference.current = value;
|
|
5912
5924
|
}, [value]);
|
|
5913
5925
|
return reference.current;
|
|
5914
5926
|
};
|
|
5915
5927
|
|
|
5916
5928
|
// src/common/hooks/useStepPolling/useStepPolling.tsx
|
|
5917
|
-
var
|
|
5929
|
+
var import_react33 = require("react");
|
|
5918
5930
|
function useStepPolling(polling, onAction) {
|
|
5919
5931
|
const httpClient = useHttpClient();
|
|
5920
|
-
const asyncFn = (0,
|
|
5932
|
+
const asyncFn = (0, import_react33.useMemo)(() => {
|
|
5921
5933
|
if (polling) {
|
|
5922
5934
|
return () => {
|
|
5923
5935
|
return httpClient(polling.url).then((response) => {
|
|
@@ -5932,7 +5944,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5932
5944
|
return void 0;
|
|
5933
5945
|
}
|
|
5934
5946
|
}, [polling, httpClient]);
|
|
5935
|
-
const onPollingResponse = (0,
|
|
5947
|
+
const onPollingResponse = (0, import_react33.useCallback)(
|
|
5936
5948
|
(pollingResponse) => {
|
|
5937
5949
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
5938
5950
|
onAction(pollingResponse.action);
|
|
@@ -5948,7 +5960,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5948
5960
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
5949
5961
|
maxConsecutiveFails: 1,
|
|
5950
5962
|
onPollingResponse,
|
|
5951
|
-
onFailure: (0,
|
|
5963
|
+
onFailure: (0, import_react33.useCallback)(() => {
|
|
5952
5964
|
if (polling) {
|
|
5953
5965
|
onAction(polling.onError.action);
|
|
5954
5966
|
}
|
|
@@ -5957,7 +5969,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5957
5969
|
}
|
|
5958
5970
|
|
|
5959
5971
|
// src/step/layoutStep/LayoutStep.tsx
|
|
5960
|
-
var
|
|
5972
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5961
5973
|
var getComponents = (step, options) => {
|
|
5962
5974
|
var _a;
|
|
5963
5975
|
if (isEmpty(step)) {
|
|
@@ -5980,7 +5992,7 @@ var LayoutStep = (props) => {
|
|
|
5980
5992
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5981
5993
|
};
|
|
5982
5994
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5983
|
-
return /* @__PURE__ */ (0,
|
|
5995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5984
5996
|
DynamicLayout_default,
|
|
5985
5997
|
{
|
|
5986
5998
|
components,
|
|
@@ -5996,10 +6008,10 @@ var LayoutStep = (props) => {
|
|
|
5996
6008
|
var LayoutStep_default = LayoutStep;
|
|
5997
6009
|
|
|
5998
6010
|
// src/step/cameraStep/CameraStep.tsx
|
|
5999
|
-
var
|
|
6011
|
+
var import_react38 = require("react");
|
|
6000
6012
|
|
|
6001
6013
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6002
|
-
var
|
|
6014
|
+
var import_react37 = require("react");
|
|
6003
6015
|
var import_react_intl30 = require("react-intl");
|
|
6004
6016
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
6005
6017
|
|
|
@@ -6026,15 +6038,15 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
6026
6038
|
// src/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6027
6039
|
var import_components27 = require("@transferwise/components");
|
|
6028
6040
|
var import_react_intl23 = require("react-intl");
|
|
6029
|
-
var
|
|
6030
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
6041
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6042
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
6031
6043
|
var ReviewBottomBar = ({
|
|
6032
6044
|
onSubmit,
|
|
6033
6045
|
onRetry
|
|
6034
6046
|
}) => {
|
|
6035
6047
|
const intl = (0, import_react_intl23.useIntl)();
|
|
6036
|
-
return /* @__PURE__ */ (0,
|
|
6037
|
-
/* @__PURE__ */ (0,
|
|
6048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6038
6050
|
import_components27.Button,
|
|
6039
6051
|
{
|
|
6040
6052
|
className: "m-b-1",
|
|
@@ -6045,7 +6057,7 @@ var ReviewBottomBar = ({
|
|
|
6045
6057
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
6046
6058
|
}
|
|
6047
6059
|
),
|
|
6048
|
-
/* @__PURE__ */ (0,
|
|
6060
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6049
6061
|
import_components27.Button,
|
|
6050
6062
|
{
|
|
6051
6063
|
className: "m-b-2",
|
|
@@ -6059,14 +6071,14 @@ var ReviewBottomBar = ({
|
|
|
6059
6071
|
)
|
|
6060
6072
|
] }) }) });
|
|
6061
6073
|
};
|
|
6062
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
6074
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6063
6075
|
"button",
|
|
6064
6076
|
{
|
|
6065
6077
|
type: "button",
|
|
6066
6078
|
className: "camera-capture-btn m-b-2",
|
|
6067
6079
|
"data-testid": "camera-capture-button",
|
|
6068
6080
|
onClick,
|
|
6069
|
-
children: /* @__PURE__ */ (0,
|
|
6081
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
6070
6082
|
}
|
|
6071
6083
|
);
|
|
6072
6084
|
|
|
@@ -6084,11 +6096,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMess
|
|
|
6084
6096
|
});
|
|
6085
6097
|
|
|
6086
6098
|
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6087
|
-
var
|
|
6099
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6088
6100
|
var OrientationLockOverlay = () => {
|
|
6089
6101
|
const intl = (0, import_react_intl25.useIntl)();
|
|
6090
|
-
return /* @__PURE__ */ (0,
|
|
6091
|
-
/* @__PURE__ */ (0,
|
|
6102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
6103
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6092
6104
|
"img",
|
|
6093
6105
|
{
|
|
6094
6106
|
className: "m-b-3",
|
|
@@ -6098,40 +6110,40 @@ var OrientationLockOverlay = () => {
|
|
|
6098
6110
|
alt: ""
|
|
6099
6111
|
}
|
|
6100
6112
|
),
|
|
6101
|
-
/* @__PURE__ */ (0,
|
|
6113
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6102
6114
|
] });
|
|
6103
6115
|
};
|
|
6104
6116
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6105
6117
|
|
|
6106
6118
|
// src/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6107
|
-
var
|
|
6119
|
+
var import_react34 = require("react");
|
|
6108
6120
|
var import_screenfull = __toESM(require_screenfull());
|
|
6109
|
-
var useFullScreenOrientationLock = (
|
|
6110
|
-
const lockOrientation = (0,
|
|
6121
|
+
var useFullScreenOrientationLock = (shouldLockOrientation) => {
|
|
6122
|
+
const lockOrientation = (0, import_react34.useCallback)(() => {
|
|
6111
6123
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6112
6124
|
window.screen.orientation.lock("portrait").catch(noop4);
|
|
6113
6125
|
}
|
|
6114
6126
|
}, []);
|
|
6115
|
-
const unlockOrientation = (0,
|
|
6127
|
+
const unlockOrientation = (0, import_react34.useCallback)(() => {
|
|
6116
6128
|
var _a, _b, _c;
|
|
6117
6129
|
return (_c = (_b = (_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) == null ? void 0 : _c.call(_b);
|
|
6118
6130
|
}, []);
|
|
6119
|
-
const enterFullScreen = (0,
|
|
6131
|
+
const enterFullScreen = (0, import_react34.useCallback)(() => {
|
|
6120
6132
|
setTimeout(() => {
|
|
6121
|
-
if (
|
|
6133
|
+
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6122
6134
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
6123
6135
|
lockOrientation();
|
|
6124
6136
|
}).catch(noop4);
|
|
6125
6137
|
}
|
|
6126
6138
|
}, 100);
|
|
6127
|
-
}, [
|
|
6128
|
-
const exitFullScreen = (0,
|
|
6139
|
+
}, [shouldLockOrientation, lockOrientation]);
|
|
6140
|
+
const exitFullScreen = (0, import_react34.useCallback)(() => {
|
|
6129
6141
|
if (import_screenfull.default.isFullscreen) {
|
|
6130
6142
|
import_screenfull.default.exit().catch(noop4);
|
|
6131
6143
|
}
|
|
6132
6144
|
unlockOrientation();
|
|
6133
6145
|
}, [unlockOrientation]);
|
|
6134
|
-
(0,
|
|
6146
|
+
(0, import_react34.useEffect)(() => {
|
|
6135
6147
|
return () => {
|
|
6136
6148
|
exitFullScreen();
|
|
6137
6149
|
};
|
|
@@ -6145,7 +6157,7 @@ var noop4 = () => {
|
|
|
6145
6157
|
};
|
|
6146
6158
|
|
|
6147
6159
|
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6148
|
-
var
|
|
6160
|
+
var import_react35 = require("react");
|
|
6149
6161
|
|
|
6150
6162
|
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
6151
6163
|
var isSelfieCamera = (stream) => {
|
|
@@ -6193,7 +6205,7 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
6193
6205
|
|
|
6194
6206
|
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6195
6207
|
var useVideoConstraints = (direction) => {
|
|
6196
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6208
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react35.useState)();
|
|
6197
6209
|
const defaultVideoConstraints = {
|
|
6198
6210
|
facingMode: direction === "front" ? "user" : "environment",
|
|
6199
6211
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -6201,7 +6213,7 @@ var useVideoConstraints = (direction) => {
|
|
|
6201
6213
|
frameRate: 30,
|
|
6202
6214
|
aspectRatio: 16 / 9
|
|
6203
6215
|
};
|
|
6204
|
-
(0,
|
|
6216
|
+
(0, import_react35.useEffect)(() => {
|
|
6205
6217
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
6206
6218
|
}, [direction]);
|
|
6207
6219
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -6219,8 +6231,8 @@ var useVideoConstraints = (direction) => {
|
|
|
6219
6231
|
};
|
|
6220
6232
|
|
|
6221
6233
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6222
|
-
var
|
|
6223
|
-
var
|
|
6234
|
+
var import_react36 = require("react");
|
|
6235
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6224
6236
|
var captureButtonHeight = 92;
|
|
6225
6237
|
var reviewButtonsHeight = 120;
|
|
6226
6238
|
var imageHeight = 40;
|
|
@@ -6236,8 +6248,8 @@ var Overlay = ({
|
|
|
6236
6248
|
instructions,
|
|
6237
6249
|
reviewInstructions
|
|
6238
6250
|
}) => {
|
|
6239
|
-
const svgReference = (0,
|
|
6240
|
-
(0,
|
|
6251
|
+
const svgReference = (0, import_react36.useRef)(null);
|
|
6252
|
+
(0, import_react36.useEffect)(() => {
|
|
6241
6253
|
const listener = debounce(() => {
|
|
6242
6254
|
var _a;
|
|
6243
6255
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -6249,18 +6261,18 @@ var Overlay = ({
|
|
|
6249
6261
|
return () => window.removeEventListener("resize", listener);
|
|
6250
6262
|
});
|
|
6251
6263
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
6252
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
6253
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
6254
|
-
title && /* @__PURE__ */ (0,
|
|
6255
|
-
instructions && /* @__PURE__ */ (0,
|
|
6264
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
6265
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6266
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6267
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6256
6268
|
] });
|
|
6257
6269
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6258
6270
|
if (reviewInstructions) {
|
|
6259
6271
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6260
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6272
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6261
6273
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6262
6274
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6263
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6275
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, {});
|
|
6264
6276
|
}
|
|
6265
6277
|
}
|
|
6266
6278
|
const framePosition = {
|
|
@@ -6278,14 +6290,14 @@ var Overlay = ({
|
|
|
6278
6290
|
width: "90%"
|
|
6279
6291
|
}
|
|
6280
6292
|
};
|
|
6281
|
-
return /* @__PURE__ */ (0,
|
|
6282
|
-
/* @__PURE__ */ (0,
|
|
6283
|
-
/* @__PURE__ */ (0,
|
|
6284
|
-
/* @__PURE__ */ (0,
|
|
6293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6294
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("mask", { id: "mask", children: [
|
|
6295
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6296
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
6285
6297
|
] }) }),
|
|
6286
|
-
overlay && /* @__PURE__ */ (0,
|
|
6287
|
-
outline && /* @__PURE__ */ (0,
|
|
6288
|
-
/* @__PURE__ */ (0,
|
|
6298
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6299
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
6300
|
+
/* @__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 })) })
|
|
6289
6301
|
] });
|
|
6290
6302
|
};
|
|
6291
6303
|
var Overlay_default = Overlay;
|
|
@@ -6315,13 +6327,13 @@ var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
6315
6327
|
});
|
|
6316
6328
|
|
|
6317
6329
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6318
|
-
var
|
|
6330
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6319
6331
|
var NoCameraAccess = ({ onAction }) => {
|
|
6320
6332
|
const intl = (0, import_react_intl27.useIntl)();
|
|
6321
|
-
return /* @__PURE__ */ (0,
|
|
6322
|
-
/* @__PURE__ */ (0,
|
|
6323
|
-
/* @__PURE__ */ (0,
|
|
6324
|
-
/* @__PURE__ */ (0,
|
|
6333
|
+
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: [
|
|
6334
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6335
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6336
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components28.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6325
6337
|
] }) }) }) });
|
|
6326
6338
|
};
|
|
6327
6339
|
var NoCameraAccess_default = NoCameraAccess;
|
|
@@ -6345,12 +6357,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages
|
|
|
6345
6357
|
});
|
|
6346
6358
|
|
|
6347
6359
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6348
|
-
var
|
|
6360
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6349
6361
|
var CameraNotSupported = () => {
|
|
6350
6362
|
const intl = (0, import_react_intl29.useIntl)();
|
|
6351
|
-
return /* @__PURE__ */ (0,
|
|
6352
|
-
/* @__PURE__ */ (0,
|
|
6353
|
-
/* @__PURE__ */ (0,
|
|
6363
|
+
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: [
|
|
6364
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6365
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6354
6366
|
] }) }) }) });
|
|
6355
6367
|
};
|
|
6356
6368
|
var CameraNotSupported_default = CameraNotSupported;
|
|
@@ -6375,7 +6387,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
6375
6387
|
};
|
|
6376
6388
|
|
|
6377
6389
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6378
|
-
var
|
|
6390
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6379
6391
|
var CameraCapture = ({
|
|
6380
6392
|
direction = "back",
|
|
6381
6393
|
overlay = "",
|
|
@@ -6387,16 +6399,20 @@ var CameraCapture = ({
|
|
|
6387
6399
|
onCapture,
|
|
6388
6400
|
onEvent
|
|
6389
6401
|
}) => {
|
|
6390
|
-
const [mode, setMode] = (0,
|
|
6391
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
6392
|
-
const [ready, setReady] = (0,
|
|
6393
|
-
const [reviewImage, setReviewImage] = (0,
|
|
6394
|
-
const webcamReference = (0,
|
|
6402
|
+
const [mode, setMode] = (0, import_react37.useState)("CAPTURE");
|
|
6403
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react37.useState)(false);
|
|
6404
|
+
const [ready, setReady] = (0, import_react37.useState)(false);
|
|
6405
|
+
const [reviewImage, setReviewImage] = (0, import_react37.useState)();
|
|
6406
|
+
const webcamReference = (0, import_react37.useRef)(null);
|
|
6395
6407
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6396
|
-
const
|
|
6397
|
-
const
|
|
6408
|
+
const orientationLockFeature = useFeatureFlag("camera-orientation-lock" /* CAMERA_ORIENTATION_LOCK */);
|
|
6409
|
+
const shouldLockOrientation = (0, import_react37.useMemo)(
|
|
6410
|
+
() => !!((orientationLockFeature == null ? void 0 : orientationLockFeature.enabled) && isMobile()),
|
|
6411
|
+
[orientationLockFeature]
|
|
6412
|
+
);
|
|
6413
|
+
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(shouldLockOrientation);
|
|
6398
6414
|
const intl = (0, import_react_intl30.useIntl)();
|
|
6399
|
-
const handleCapture = (0,
|
|
6415
|
+
const handleCapture = (0, import_react37.useCallback)(async () => {
|
|
6400
6416
|
var _a, _b, _c, _d, _e, _f;
|
|
6401
6417
|
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) {
|
|
6402
6418
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -6418,7 +6434,7 @@ var CameraCapture = ({
|
|
|
6418
6434
|
);
|
|
6419
6435
|
}
|
|
6420
6436
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6421
|
-
const handleUserMediaError = (0,
|
|
6437
|
+
const handleUserMediaError = (0, import_react37.useCallback)(
|
|
6422
6438
|
(error) => {
|
|
6423
6439
|
if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
|
|
6424
6440
|
setMode("NO_CAMERA_ACCESS");
|
|
@@ -6430,7 +6446,7 @@ var CameraCapture = ({
|
|
|
6430
6446
|
},
|
|
6431
6447
|
[setMode, onEvent]
|
|
6432
6448
|
);
|
|
6433
|
-
const handleUserMedia = (0,
|
|
6449
|
+
const handleUserMedia = (0, import_react37.useCallback)(
|
|
6434
6450
|
(stream) => {
|
|
6435
6451
|
enterFullScreen();
|
|
6436
6452
|
setReady(true);
|
|
@@ -6447,13 +6463,13 @@ var CameraCapture = ({
|
|
|
6447
6463
|
setReviewImage(void 0);
|
|
6448
6464
|
};
|
|
6449
6465
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6450
|
-
(0,
|
|
6466
|
+
(0, import_react37.useEffect)(() => {
|
|
6451
6467
|
if (mode !== "CAPTURE") {
|
|
6452
6468
|
exitFullScreen();
|
|
6453
6469
|
}
|
|
6454
6470
|
}, [mode, exitFullScreen]);
|
|
6455
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
6456
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
6471
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6472
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6457
6473
|
import_react_webcam.default,
|
|
6458
6474
|
{
|
|
6459
6475
|
ref: webcamReference,
|
|
@@ -6464,7 +6480,7 @@ var CameraCapture = ({
|
|
|
6464
6480
|
onUserMedia: handleUserMedia
|
|
6465
6481
|
}
|
|
6466
6482
|
),
|
|
6467
|
-
/* @__PURE__ */ (0,
|
|
6483
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6468
6484
|
Overlay_default,
|
|
6469
6485
|
{
|
|
6470
6486
|
overlay,
|
|
@@ -6474,12 +6490,12 @@ var CameraCapture = ({
|
|
|
6474
6490
|
instructions
|
|
6475
6491
|
}
|
|
6476
6492
|
),
|
|
6477
|
-
|
|
6478
|
-
ready && /* @__PURE__ */ (0,
|
|
6493
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrientationLockOverlay_default, {}),
|
|
6494
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
6479
6495
|
] });
|
|
6480
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
6481
|
-
/* @__PURE__ */ (0,
|
|
6482
|
-
/* @__PURE__ */ (0,
|
|
6496
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6497
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6498
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6483
6499
|
Overlay_default,
|
|
6484
6500
|
{
|
|
6485
6501
|
overlay,
|
|
@@ -6489,19 +6505,19 @@ var CameraCapture = ({
|
|
|
6489
6505
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6490
6506
|
}
|
|
6491
6507
|
),
|
|
6492
|
-
/* @__PURE__ */ (0,
|
|
6508
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6493
6509
|
] });
|
|
6494
|
-
return /* @__PURE__ */ (0,
|
|
6510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "camera-capture", children: [
|
|
6495
6511
|
mode === "CAPTURE" && captureScreen,
|
|
6496
6512
|
mode === "REVIEW" && reviewScreen,
|
|
6497
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
6498
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
6513
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
6514
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CameraNotSupported_default, {})
|
|
6499
6515
|
] });
|
|
6500
6516
|
};
|
|
6501
6517
|
var CameraCapture_default = CameraCapture;
|
|
6502
6518
|
|
|
6503
6519
|
// src/step/cameraStep/CameraStep.tsx
|
|
6504
|
-
var
|
|
6520
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6505
6521
|
function blobToBase64(blob) {
|
|
6506
6522
|
return new Promise((resolve, _) => {
|
|
6507
6523
|
const reader = new FileReader();
|
|
@@ -6519,8 +6535,8 @@ var CameraStep = (props) => {
|
|
|
6519
6535
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6520
6536
|
const { overlay, outline } = assets || {};
|
|
6521
6537
|
const { url: imageUrl } = image || {};
|
|
6522
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6523
|
-
(0,
|
|
6538
|
+
const [captureClicked, setCaptureClicked] = (0, import_react38.useState)(false);
|
|
6539
|
+
(0, import_react38.useEffect)(() => {
|
|
6524
6540
|
if (captureClicked) {
|
|
6525
6541
|
onAction(action);
|
|
6526
6542
|
}
|
|
@@ -6539,7 +6555,7 @@ var CameraStep = (props) => {
|
|
|
6539
6555
|
});
|
|
6540
6556
|
}
|
|
6541
6557
|
};
|
|
6542
|
-
return /* @__PURE__ */ (0,
|
|
6558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6543
6559
|
CameraCapture_default,
|
|
6544
6560
|
{
|
|
6545
6561
|
overlay,
|
|
@@ -6616,12 +6632,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMe
|
|
|
6616
6632
|
});
|
|
6617
6633
|
|
|
6618
6634
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6619
|
-
var
|
|
6635
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6620
6636
|
var noop5 = () => {
|
|
6621
6637
|
};
|
|
6622
6638
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6623
6639
|
const { formatMessage } = (0, import_react_intl32.useIntl)();
|
|
6624
|
-
return /* @__PURE__ */ (0,
|
|
6640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6625
6641
|
DynamicLayout_default,
|
|
6626
6642
|
{
|
|
6627
6643
|
components: [
|
|
@@ -6688,9 +6704,9 @@ function getOrigin(url) {
|
|
|
6688
6704
|
// src/dynamicFlow/BackButton.tsx
|
|
6689
6705
|
var import_components30 = require("@transferwise/components");
|
|
6690
6706
|
var import_icons2 = require("@transferwise/icons");
|
|
6691
|
-
var
|
|
6707
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6692
6708
|
var BackButton = ({ title, action, onAction }) => {
|
|
6693
|
-
return /* @__PURE__ */ (0,
|
|
6709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6694
6710
|
"a",
|
|
6695
6711
|
{
|
|
6696
6712
|
onClick: (event) => {
|
|
@@ -6701,8 +6717,8 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6701
6717
|
className: "df-back-btn",
|
|
6702
6718
|
"aria-label": title,
|
|
6703
6719
|
children: [
|
|
6704
|
-
/* @__PURE__ */ (0,
|
|
6705
|
-
/* @__PURE__ */ (0,
|
|
6720
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: title }),
|
|
6721
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components30.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6706
6722
|
]
|
|
6707
6723
|
}
|
|
6708
6724
|
);
|
|
@@ -6710,7 +6726,7 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6710
6726
|
var BackButton_default = BackButton;
|
|
6711
6727
|
|
|
6712
6728
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6713
|
-
var
|
|
6729
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6714
6730
|
var DynamicFlowStep = (props) => {
|
|
6715
6731
|
var _a, _b, _c;
|
|
6716
6732
|
const { step, globalError, onAction } = props;
|
|
@@ -6718,26 +6734,29 @@ var DynamicFlowStep = (props) => {
|
|
|
6718
6734
|
const backButton = ((_b = step == null ? void 0 : step.navigation) == null ? void 0 : _b.back) || ((_c = step == null ? void 0 : step.navigation) == null ? void 0 : _c.backButton);
|
|
6719
6735
|
const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
|
|
6720
6736
|
if (step === void 0) {
|
|
6737
|
+
if (globalError) {
|
|
6738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
6739
|
+
}
|
|
6721
6740
|
return null;
|
|
6722
6741
|
}
|
|
6723
6742
|
if (externalUrl && requiresManualTrigger) {
|
|
6724
|
-
return /* @__PURE__ */ (0,
|
|
6743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6725
6744
|
}
|
|
6726
6745
|
if (isCameraStep(step)) {
|
|
6727
|
-
return /* @__PURE__ */ (0,
|
|
6746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
6728
6747
|
}
|
|
6729
|
-
return /* @__PURE__ */ (0,
|
|
6730
|
-
backButton && /* @__PURE__ */ (0,
|
|
6731
|
-
globalError ? /* @__PURE__ */ (0,
|
|
6732
|
-
/* @__PURE__ */ (0,
|
|
6748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
6749
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
6750
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6751
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6733
6752
|
] });
|
|
6734
6753
|
};
|
|
6735
6754
|
|
|
6736
6755
|
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6737
|
-
var
|
|
6756
|
+
var import_react39 = require("react");
|
|
6738
6757
|
var DEBOUNCE_DELAY = 1e3;
|
|
6739
6758
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6740
|
-
const map = (0,
|
|
6759
|
+
const map = (0, import_react39.useRef)(/* @__PURE__ */ new Map());
|
|
6741
6760
|
const retrieveOrCreate = (key) => {
|
|
6742
6761
|
if (map.current.has(key)) {
|
|
6743
6762
|
return map.current.get(key);
|
|
@@ -6760,12 +6779,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6760
6779
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6761
6780
|
|
|
6762
6781
|
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6763
|
-
var
|
|
6782
|
+
var import_react40 = require("react");
|
|
6764
6783
|
var useDynamicFlowState = (initialStep) => {
|
|
6765
6784
|
var _a, _b;
|
|
6766
|
-
const [formErrors, setFormErrors] = (0,
|
|
6767
|
-
const [globalError, setGlobalError] = (0,
|
|
6768
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6785
|
+
const [formErrors, setFormErrors] = (0, import_react40.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6786
|
+
const [globalError, setGlobalError] = (0, import_react40.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6787
|
+
const [stepAndModels, setStepAndModels] = (0, import_react40.useState)({
|
|
6769
6788
|
step: initialStep || void 0,
|
|
6770
6789
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6771
6790
|
etag: void 0
|
|
@@ -6795,7 +6814,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6795
6814
|
return updatedState;
|
|
6796
6815
|
});
|
|
6797
6816
|
};
|
|
6798
|
-
const modelIsValid = (0,
|
|
6817
|
+
const modelIsValid = (0, import_react40.useMemo)(
|
|
6799
6818
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6800
6819
|
[models, step]
|
|
6801
6820
|
);
|
|
@@ -6874,17 +6893,17 @@ var isInlineSchema = (schema) => {
|
|
|
6874
6893
|
|
|
6875
6894
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
6876
6895
|
var import_components31 = require("@transferwise/components");
|
|
6877
|
-
var
|
|
6878
|
-
var
|
|
6896
|
+
var import_react41 = require("react");
|
|
6897
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6879
6898
|
function useLoader(loaderConfig, initialState) {
|
|
6880
6899
|
const config = __spreadValues({
|
|
6881
6900
|
size: import_components31.Size.EXTRA_LARGE,
|
|
6882
6901
|
initial: true,
|
|
6883
6902
|
submission: false
|
|
6884
6903
|
}, loaderConfig);
|
|
6885
|
-
const [loadingState, setLoadingState] = (0,
|
|
6904
|
+
const [loadingState, setLoadingState] = (0, import_react41.useState)(initialState);
|
|
6886
6905
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6887
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
6906
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6888
6907
|
import_components31.Loader,
|
|
6889
6908
|
{
|
|
6890
6909
|
size: config.size,
|
|
@@ -6896,15 +6915,15 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6896
6915
|
}
|
|
6897
6916
|
|
|
6898
6917
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6899
|
-
var
|
|
6918
|
+
var import_react42 = require("react");
|
|
6900
6919
|
|
|
6901
6920
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6902
6921
|
var import_components32 = require("@transferwise/components");
|
|
6903
6922
|
var import_react_intl33 = require("react-intl");
|
|
6904
|
-
var
|
|
6923
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6905
6924
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6906
6925
|
const { formatMessage } = (0, import_react_intl33.useIntl)();
|
|
6907
|
-
return /* @__PURE__ */ (0,
|
|
6926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6908
6927
|
import_components32.Alert,
|
|
6909
6928
|
{
|
|
6910
6929
|
action: {
|
|
@@ -6920,10 +6939,10 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6920
6939
|
};
|
|
6921
6940
|
|
|
6922
6941
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6923
|
-
var
|
|
6942
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6924
6943
|
var noop6 = () => {
|
|
6925
6944
|
};
|
|
6926
|
-
var ErrorBoundary = class extends
|
|
6945
|
+
var ErrorBoundary = class extends import_react42.Component {
|
|
6927
6946
|
constructor(props) {
|
|
6928
6947
|
super(props);
|
|
6929
6948
|
this.handleErrorReset = () => {
|
|
@@ -6941,8 +6960,8 @@ var ErrorBoundary = class extends import_react41.Component {
|
|
|
6941
6960
|
render() {
|
|
6942
6961
|
const { children } = this.props;
|
|
6943
6962
|
const { hasError, isFatalError } = this.state;
|
|
6944
|
-
return /* @__PURE__ */ (0,
|
|
6945
|
-
hasError && /* @__PURE__ */ (0,
|
|
6963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
6964
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6946
6965
|
!isFatalError && children
|
|
6947
6966
|
] });
|
|
6948
6967
|
}
|
|
@@ -7047,7 +7066,7 @@ var assertResponseIsValid = (response) => {
|
|
|
7047
7066
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
7048
7067
|
|
|
7049
7068
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
7050
|
-
var
|
|
7069
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7051
7070
|
var noop7 = () => {
|
|
7052
7071
|
};
|
|
7053
7072
|
var DynamicFlowComponent = ({
|
|
@@ -7057,6 +7076,7 @@ var DynamicFlowComponent = ({
|
|
|
7057
7076
|
initialStep,
|
|
7058
7077
|
loaderConfig,
|
|
7059
7078
|
displayStepTitle = true,
|
|
7079
|
+
features,
|
|
7060
7080
|
onCompletion,
|
|
7061
7081
|
onError,
|
|
7062
7082
|
onEvent = noop7,
|
|
@@ -7075,24 +7095,24 @@ var DynamicFlowComponent = ({
|
|
|
7075
7095
|
setStepAndEtag,
|
|
7076
7096
|
setSchemaModel
|
|
7077
7097
|
} = useDynamicFlowState(initialStep);
|
|
7078
|
-
const [submitted, setSubmitted] = (0,
|
|
7098
|
+
const [submitted, setSubmitted] = (0, import_react43.useState)(false);
|
|
7079
7099
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
7080
7100
|
loaderConfig,
|
|
7081
7101
|
initialStep ? "idle" : "initial"
|
|
7082
7102
|
);
|
|
7083
7103
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
7084
|
-
const analyticsMetadata = (0,
|
|
7104
|
+
const analyticsMetadata = (0, import_react43.useMemo)(
|
|
7085
7105
|
() => {
|
|
7086
7106
|
var _a;
|
|
7087
7107
|
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 : {});
|
|
7088
7108
|
},
|
|
7089
7109
|
[flowId, step]
|
|
7090
7110
|
);
|
|
7091
|
-
const dispatchEvent = (0,
|
|
7111
|
+
const dispatchEvent = (0, import_react43.useMemo)(
|
|
7092
7112
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
7093
7113
|
[onEvent, analyticsMetadata]
|
|
7094
7114
|
);
|
|
7095
|
-
const dfHttpClient = (0,
|
|
7115
|
+
const dfHttpClient = (0, import_react43.useCallback)(
|
|
7096
7116
|
({ action, data, etag: etag2 }) => {
|
|
7097
7117
|
const { url, method = "POST" } = action;
|
|
7098
7118
|
return httpClient(url != null ? url : "", {
|
|
@@ -7142,17 +7162,17 @@ var DynamicFlowComponent = ({
|
|
|
7142
7162
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
7143
7163
|
};
|
|
7144
7164
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
7145
|
-
const dispatchEventAndComplete = (0,
|
|
7165
|
+
const dispatchEventAndComplete = (0, import_react43.useCallback)(
|
|
7146
7166
|
(result) => {
|
|
7147
7167
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
7148
7168
|
onCompletion(result);
|
|
7149
7169
|
},
|
|
7150
7170
|
[onCompletion, dispatchEvent]
|
|
7151
7171
|
);
|
|
7152
|
-
(0,
|
|
7172
|
+
(0, import_react43.useEffect)(() => {
|
|
7153
7173
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
7154
7174
|
}, []);
|
|
7155
|
-
(0,
|
|
7175
|
+
(0, import_react43.useEffect)(() => {
|
|
7156
7176
|
if (!initialStep) {
|
|
7157
7177
|
const action = __spreadValues({
|
|
7158
7178
|
id: "#initial-step-request",
|
|
@@ -7267,7 +7287,7 @@ var DynamicFlowComponent = ({
|
|
|
7267
7287
|
await actionHandler(action);
|
|
7268
7288
|
}
|
|
7269
7289
|
};
|
|
7270
|
-
return /* @__PURE__ */ (0,
|
|
7290
|
+
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, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7271
7291
|
DynamicFlowStep,
|
|
7272
7292
|
{
|
|
7273
7293
|
step,
|
|
@@ -7281,9 +7301,9 @@ var DynamicFlowComponent = ({
|
|
|
7281
7301
|
},
|
|
7282
7302
|
onModelChange
|
|
7283
7303
|
}
|
|
7284
|
-
) }) }) }) });
|
|
7304
|
+
) }) }) }) }) });
|
|
7285
7305
|
};
|
|
7286
|
-
var DynamicFlow = (props) => /* @__PURE__ */ (0,
|
|
7306
|
+
var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7287
7307
|
var DynamicFlow_default = DynamicFlow;
|
|
7288
7308
|
var combineModels2 = (formModels) => {
|
|
7289
7309
|
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -7301,19 +7321,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7301
7321
|
};
|
|
7302
7322
|
|
|
7303
7323
|
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7304
|
-
var
|
|
7324
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7305
7325
|
var JsonSchemaForm = (props) => {
|
|
7306
7326
|
const schemaProps = __spreadValues({
|
|
7307
7327
|
model: null,
|
|
7308
7328
|
errors: null
|
|
7309
7329
|
}, props);
|
|
7310
7330
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
7311
|
-
return /* @__PURE__ */ (0,
|
|
7331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7312
7332
|
EventsContextProvider,
|
|
7313
7333
|
{
|
|
7314
7334
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
7315
7335
|
onEvent,
|
|
7316
|
-
children: /* @__PURE__ */ (0,
|
|
7336
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7317
7337
|
}
|
|
7318
7338
|
) });
|
|
7319
7339
|
};
|