@wise/dynamic-flow-client 4.0.0-exp-zod-301f0be → 4.0.0-exp-next-min-fb61ff2
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 +527 -535
- package/build/main.min.js +1 -1
- package/build/main.mjs +330 -338
- package/build/types/legacy/common/utils/schema-utils.d.ts +1 -1
- package/build/types/legacy/dynamic-flow-types.d.ts +0 -15
- package/build/types/legacy/dynamicFlow/utils/useLoader.d.ts +1 -1
- package/build/types/legacy/layout/button/utils.d.ts +2 -2
- package/build/types/legacy/layout/search/useSearch.d.ts +1 -1
- package/build/types/legacy/layout/utils/index.d.ts +1 -1
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -2
- package/build/types/revamp/domain/types.d.ts +1 -0
- package/build/types/revamp/renderers/CoreContainerRenderer.d.ts +1 -1
- package/build/types/revamp/renderers/getRenderFunction.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/allOfComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/booleanInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/buttonComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/columnsComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/dateInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/decisionComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/dividerComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/formComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/hiddenComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/imageComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/instructionsComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/integerInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/listComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/loadingIndicatorComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/markdownComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/modalComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/multiSelectComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/multiUploadInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/numberInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/repeatableComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/reviewComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/searchComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/selectInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/statusListComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/tupleComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/uploadInputComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/utils/inputComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/utils/mapErrorsToValidationState.d.ts +1 -1
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/build/types/revamp/{DynamicFlowWise.d.ts → test-utils/DynamicFlowWise.d.ts} +1 -1
- package/build/types/revamp/{DynamicFragmentWise.d.ts → test-utils/DynamicFragmentWise.d.ts} +1 -1
- package/build/types/revamp/types.d.ts +2 -7
- package/package.json +3 -3
- package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +0 -9
package/build/main.js
CHANGED
|
@@ -144,13 +144,13 @@ var init_clsx = __esm({
|
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
// ../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index-8Fxev6OI.esm.js
|
|
147
|
-
var
|
|
147
|
+
var import_react14, import_jsx_runtime11, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
|
|
148
148
|
var init_index_8Fxev6OI_esm = __esm({
|
|
149
149
|
"../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index-8Fxev6OI.esm.js"() {
|
|
150
150
|
"use strict";
|
|
151
151
|
init_clsx();
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
import_react14 = require("react");
|
|
153
|
+
import_jsx_runtime11 = require("react/jsx-runtime");
|
|
154
154
|
unknownFlagName = "wise";
|
|
155
155
|
Flag = ({
|
|
156
156
|
code,
|
|
@@ -158,13 +158,13 @@ var init_index_8Fxev6OI_esm = __esm({
|
|
|
158
158
|
className = void 0,
|
|
159
159
|
loading = "lazy"
|
|
160
160
|
}) => {
|
|
161
|
-
const [fallback, setFallback] = (0,
|
|
162
|
-
(0,
|
|
161
|
+
const [fallback, setFallback] = (0, import_react14.useState)(null);
|
|
162
|
+
(0, import_react14.useEffect)(() => {
|
|
163
163
|
setFallback(null);
|
|
164
164
|
}, [code]);
|
|
165
165
|
const detailed = intrinsicSize >= 150;
|
|
166
166
|
const name = fallback !== "unknown" ? `${code.toLowerCase()}${fallback == null && detailed ? "-detailed" : ""}` : unknownFlagName;
|
|
167
|
-
return /* @__PURE__ */ (0,
|
|
167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("img", {
|
|
168
168
|
className: clsx(`wds-flag wds-flag-${name}`, className),
|
|
169
169
|
src: false ? `${name}.svg` : `https://wise.com/web-art/assets/flags/${name}.svg`,
|
|
170
170
|
loading,
|
|
@@ -1548,9 +1548,9 @@ var inputComponentToProps = (component, type) => {
|
|
|
1548
1548
|
uri: image.uri,
|
|
1549
1549
|
url: (_d = (_c = image.uri) != null ? _c : image.url) != null ? _d : ""
|
|
1550
1550
|
} : void 0,
|
|
1551
|
-
title,
|
|
1552
1551
|
placeholder,
|
|
1553
1552
|
required,
|
|
1553
|
+
title,
|
|
1554
1554
|
validationState: getValidationState(errors, validationAsyncState),
|
|
1555
1555
|
value: component.getLocalValue(),
|
|
1556
1556
|
onBlur: onBlur.bind(component),
|
|
@@ -1871,6 +1871,7 @@ var statusListComponentToProps = (component) => pick(component, "type", "control
|
|
|
1871
1871
|
// src/revamp/renderers/mappers/textInputComponentToProps.ts
|
|
1872
1872
|
var textInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-text")), {
|
|
1873
1873
|
autoComplete: component.autoComplete,
|
|
1874
|
+
autoCapitalize: component == null ? void 0 : component.autocapitalization,
|
|
1874
1875
|
displayFormat: component.displayFormat,
|
|
1875
1876
|
maxLength: component.maxLength,
|
|
1876
1877
|
minLength: component.minLength,
|
|
@@ -9208,6 +9209,7 @@ var createTextInputComponent = (textInputProps, updateComponent) => {
|
|
|
9208
9209
|
var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
9209
9210
|
const { schema, localValue, model, required = false } = schemaMapperProps;
|
|
9210
9211
|
const {
|
|
9212
|
+
autocapitalization,
|
|
9211
9213
|
autocompleteHint,
|
|
9212
9214
|
control,
|
|
9213
9215
|
default: defaultValue,
|
|
@@ -9233,6 +9235,7 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
|
|
|
9233
9235
|
const value = performPersistAsync ? validLocalValue : validModel;
|
|
9234
9236
|
return createTextInputComponent(
|
|
9235
9237
|
__spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
|
|
9238
|
+
autocapitalization,
|
|
9236
9239
|
autoComplete: getAutocompleteString(autocompleteHint),
|
|
9237
9240
|
checks: schema.hidden ? [] : [
|
|
9238
9241
|
getRequiredCheck(required, errorMessageFunctions),
|
|
@@ -12037,7 +12040,7 @@ function isReference(block) {
|
|
|
12037
12040
|
}
|
|
12038
12041
|
|
|
12039
12042
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12040
|
-
var
|
|
12043
|
+
var import_react51 = require("react");
|
|
12041
12044
|
var import_react_intl39 = require("react-intl");
|
|
12042
12045
|
|
|
12043
12046
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
@@ -12144,14 +12147,6 @@ var useLogger = () => {
|
|
|
12144
12147
|
return logging;
|
|
12145
12148
|
};
|
|
12146
12149
|
|
|
12147
|
-
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12148
|
-
var import_react10 = require("react");
|
|
12149
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
12150
|
-
var FeatureContext = (0, import_react10.createContext)([]);
|
|
12151
|
-
function FeatureContextProvider({ features, children }) {
|
|
12152
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FeatureContext.Provider, { value: features, children });
|
|
12153
|
-
}
|
|
12154
|
-
|
|
12155
12150
|
// src/common/cameraCapture/utils/mobile-utils.ts
|
|
12156
12151
|
var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
12157
12152
|
var isMobileUA = (userAgent = window.navigator.userAgent) => (
|
|
@@ -12875,6 +12870,26 @@ var filterHiddenSchemas = (schemas) => schemas.filter((schema) => {
|
|
|
12875
12870
|
return (schema == null ? void 0 : schema.hidden) !== true;
|
|
12876
12871
|
});
|
|
12877
12872
|
|
|
12873
|
+
// src/common/httpClientContext/HttpClientContext.tsx
|
|
12874
|
+
var import_react10 = require("react");
|
|
12875
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
12876
|
+
var HttpClientContext = (0, import_react10.createContext)(void 0);
|
|
12877
|
+
function HttpClientProvider({ httpClient, children }) {
|
|
12878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
12879
|
+
}
|
|
12880
|
+
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
12881
|
+
const httpClient = (0, import_react10.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
12882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
12883
|
+
}
|
|
12884
|
+
var useHttpClient = () => {
|
|
12885
|
+
const contextFetch = (0, import_react10.useContext)(HttpClientContext);
|
|
12886
|
+
return contextFetch != null ? contextFetch : fetch;
|
|
12887
|
+
};
|
|
12888
|
+
var useHasHttpClientProvider = () => {
|
|
12889
|
+
const context = (0, import_react10.useContext)(HttpClientContext);
|
|
12890
|
+
return Boolean(context);
|
|
12891
|
+
};
|
|
12892
|
+
|
|
12878
12893
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
12879
12894
|
var import_react11 = require("react");
|
|
12880
12895
|
function useDebouncedFunction(callback, waitMs) {
|
|
@@ -12898,33 +12913,11 @@ function useExternal(url) {
|
|
|
12898
12913
|
}
|
|
12899
12914
|
|
|
12900
12915
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
12901
|
-
var import_react14 = require("react");
|
|
12902
|
-
|
|
12903
|
-
// src/common/httpClientContext/HttpClientContext.tsx
|
|
12904
12916
|
var import_react13 = require("react");
|
|
12905
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
12906
|
-
var HttpClientContext = (0, import_react13.createContext)(void 0);
|
|
12907
|
-
function HttpClientProvider({ httpClient, children }) {
|
|
12908
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
12909
|
-
}
|
|
12910
|
-
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
12911
|
-
const httpClient = (0, import_react13.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
12912
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
12913
|
-
}
|
|
12914
|
-
var useHttpClient = () => {
|
|
12915
|
-
const contextFetch = (0, import_react13.useContext)(HttpClientContext);
|
|
12916
|
-
return contextFetch != null ? contextFetch : fetch;
|
|
12917
|
-
};
|
|
12918
|
-
var useHasHttpClientProvider = () => {
|
|
12919
|
-
const context = (0, import_react13.useContext)(HttpClientContext);
|
|
12920
|
-
return Boolean(context);
|
|
12921
|
-
};
|
|
12922
|
-
|
|
12923
|
-
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
12924
12917
|
function useExternalStepPolling(polling, onAction) {
|
|
12925
12918
|
var _a, _b;
|
|
12926
12919
|
const httpClient = useHttpClient();
|
|
12927
|
-
const asyncFn = (0,
|
|
12920
|
+
const asyncFn = (0, import_react13.useMemo)(() => {
|
|
12928
12921
|
if (polling) {
|
|
12929
12922
|
return () => httpClient(polling.url).then((response) => {
|
|
12930
12923
|
if (response.ok) {
|
|
@@ -12942,7 +12935,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
12942
12935
|
}
|
|
12943
12936
|
return void 0;
|
|
12944
12937
|
}, [polling, httpClient]);
|
|
12945
|
-
const onPollingResponse = (0,
|
|
12938
|
+
const onPollingResponse = (0, import_react13.useCallback)(
|
|
12946
12939
|
(pollingResponse) => {
|
|
12947
12940
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
12948
12941
|
const responseHandler = responseHandlers.find(
|
|
@@ -12969,7 +12962,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
12969
12962
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
12970
12963
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
12971
12964
|
onPollingResponse,
|
|
12972
|
-
onFailure: (0,
|
|
12965
|
+
onFailure: (0, import_react13.useCallback)(() => {
|
|
12973
12966
|
if (polling) {
|
|
12974
12967
|
onAction(polling.onError.action);
|
|
12975
12968
|
}
|
|
@@ -12978,11 +12971,11 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
12978
12971
|
}
|
|
12979
12972
|
|
|
12980
12973
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
12981
|
-
var
|
|
12974
|
+
var import_react39 = require("react");
|
|
12982
12975
|
var import_react_intl30 = require("react-intl");
|
|
12983
12976
|
|
|
12984
12977
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
12985
|
-
var
|
|
12978
|
+
var import_react38 = require("react");
|
|
12986
12979
|
var import_react_intl29 = require("react-intl");
|
|
12987
12980
|
|
|
12988
12981
|
// src/legacy/common/constants/DateMode.ts
|
|
@@ -13031,7 +13024,7 @@ var Size = {
|
|
|
13031
13024
|
|
|
13032
13025
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13033
13026
|
var import_classnames10 = __toESM(require_classnames());
|
|
13034
|
-
var
|
|
13027
|
+
var import_react37 = require("react");
|
|
13035
13028
|
|
|
13036
13029
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13037
13030
|
var import_components3 = require("@transferwise/components");
|
|
@@ -13042,23 +13035,23 @@ var import_components2 = require("@transferwise/components");
|
|
|
13042
13035
|
// ../../node_modules/.pnpm/@wise+art@2.19.0_@transferwise+neptune-css@14.20.1_@types+react@18.3.18_react-dom@18.3.1_reac_mzw7cg6j4wc7ddwlhxck7linn4/node_modules/@wise/art/dist/index.esm.js
|
|
13043
13036
|
init_index_8Fxev6OI_esm();
|
|
13044
13037
|
init_clsx();
|
|
13045
|
-
var
|
|
13046
|
-
var
|
|
13038
|
+
var import_react15 = require("react");
|
|
13039
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
13047
13040
|
|
|
13048
13041
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13049
|
-
var
|
|
13042
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
13050
13043
|
var isFlagIcon = (name) => name.startsWith("flag-");
|
|
13051
13044
|
function FlagIcon({ name }) {
|
|
13052
13045
|
if (!isFlagIcon(name)) {
|
|
13053
13046
|
return null;
|
|
13054
13047
|
}
|
|
13055
13048
|
const code = name.substring(5);
|
|
13056
|
-
return /* @__PURE__ */ (0,
|
|
13049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Flag, { intrinsicSize: 24, code });
|
|
13057
13050
|
}
|
|
13058
13051
|
|
|
13059
13052
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13060
13053
|
var icons = __toESM(require("@transferwise/icons"));
|
|
13061
|
-
var
|
|
13054
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
13062
13055
|
var isNamedIcon = (name) => {
|
|
13063
13056
|
const iconName = toCapitalisedCamelCase(name);
|
|
13064
13057
|
return Object.keys(icons).includes(iconName);
|
|
@@ -13069,19 +13062,19 @@ function NamedIcon({ name }) {
|
|
|
13069
13062
|
}
|
|
13070
13063
|
const iconName = toCapitalisedCamelCase(name);
|
|
13071
13064
|
const Icon = icons[iconName];
|
|
13072
|
-
return /* @__PURE__ */ (0,
|
|
13065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 24 });
|
|
13073
13066
|
}
|
|
13074
13067
|
var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
|
|
13075
13068
|
var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13076
13069
|
|
|
13077
13070
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13078
|
-
var
|
|
13071
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
13079
13072
|
function DynamicIcon({ type }) {
|
|
13080
13073
|
if (isFlagIcon(type)) {
|
|
13081
|
-
return /* @__PURE__ */ (0,
|
|
13074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FlagIcon, { name: type });
|
|
13082
13075
|
}
|
|
13083
13076
|
if (isNamedIcon(type)) {
|
|
13084
|
-
return /* @__PURE__ */ (0,
|
|
13077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NamedIcon, { name: type });
|
|
13085
13078
|
}
|
|
13086
13079
|
return null;
|
|
13087
13080
|
}
|
|
@@ -13091,17 +13084,17 @@ function isValidIconName(name) {
|
|
|
13091
13084
|
var DynamicIcon_default = DynamicIcon;
|
|
13092
13085
|
|
|
13093
13086
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13094
|
-
var
|
|
13087
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
13095
13088
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13096
13089
|
if (icon == null ? void 0 : icon.name) {
|
|
13097
|
-
return /* @__PURE__ */ (0,
|
|
13090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components2.Avatar, { type: import_components2.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DynamicIcon_default, { type: icon.name }) });
|
|
13098
13091
|
}
|
|
13099
13092
|
if (icon == null ? void 0 : icon.text) {
|
|
13100
|
-
return /* @__PURE__ */ (0,
|
|
13093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components2.Avatar, { type: import_components2.AvatarType.INITIALS, children: icon.text });
|
|
13101
13094
|
}
|
|
13102
13095
|
if (image == null ? void 0 : image.url) {
|
|
13103
13096
|
const { url, text } = image;
|
|
13104
|
-
return /* @__PURE__ */ (0,
|
|
13097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: url, alt: text });
|
|
13105
13098
|
}
|
|
13106
13099
|
return null;
|
|
13107
13100
|
};
|
|
@@ -13137,10 +13130,10 @@ var getTextAlignment = (align) => {
|
|
|
13137
13130
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
13138
13131
|
|
|
13139
13132
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13140
|
-
var
|
|
13133
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
13141
13134
|
var DynamicAlert = ({ component: alert, onAction }) => {
|
|
13142
13135
|
const { context, markdown, margin } = alert;
|
|
13143
|
-
return /* @__PURE__ */ (0,
|
|
13136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
13144
13137
|
import_components3.Alert,
|
|
13145
13138
|
{
|
|
13146
13139
|
type: mapContextToAlertType(legacy_mapContext(context)),
|
|
@@ -13224,12 +13217,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13224
13217
|
var DynamicAlert_default = DynamicAlert;
|
|
13225
13218
|
|
|
13226
13219
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13227
|
-
var
|
|
13220
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
13228
13221
|
var DynamicBox = (props) => {
|
|
13229
13222
|
const box = props.component;
|
|
13230
13223
|
const margin = getMargin(box.margin || box.border ? "lg" : "xs");
|
|
13231
13224
|
if (!box.width || box.width === "xl") {
|
|
13232
|
-
return /* @__PURE__ */ (0,
|
|
13225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
13233
13226
|
DynamicLayout_default,
|
|
13234
13227
|
{
|
|
13235
13228
|
components: box.components,
|
|
@@ -13242,7 +13235,7 @@ var DynamicBox = (props) => {
|
|
|
13242
13235
|
}
|
|
13243
13236
|
) });
|
|
13244
13237
|
}
|
|
13245
|
-
return /* @__PURE__ */ (0,
|
|
13238
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
13246
13239
|
DynamicLayout_default,
|
|
13247
13240
|
{
|
|
13248
13241
|
components: box.components,
|
|
@@ -13328,9 +13321,9 @@ var getButtonSize = (size) => {
|
|
|
13328
13321
|
};
|
|
13329
13322
|
|
|
13330
13323
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13331
|
-
var
|
|
13324
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
13332
13325
|
function DynamicButton(props) {
|
|
13333
|
-
return props.component.behavior ? /* @__PURE__ */ (0,
|
|
13326
|
+
return props.component.behavior ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DynamicButtonWithBehavior, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DynamicButtonWithoutBehavior, __spreadValues({}, props));
|
|
13334
13327
|
}
|
|
13335
13328
|
function DynamicButtonWithoutBehavior(props) {
|
|
13336
13329
|
var _a, _b;
|
|
@@ -13347,7 +13340,7 @@ function DynamicButtonWithoutBehavior(props) {
|
|
|
13347
13340
|
onAction(componentAction);
|
|
13348
13341
|
}
|
|
13349
13342
|
};
|
|
13350
|
-
return /* @__PURE__ */ (0,
|
|
13343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
13351
13344
|
import_components4.Button,
|
|
13352
13345
|
{
|
|
13353
13346
|
size: getButtonSize(component.size),
|
|
@@ -13399,7 +13392,7 @@ function DynamicButtonWithBehavior(props) {
|
|
|
13399
13392
|
}
|
|
13400
13393
|
}
|
|
13401
13394
|
};
|
|
13402
|
-
return /* @__PURE__ */ (0,
|
|
13395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
13403
13396
|
import_components4.Button,
|
|
13404
13397
|
{
|
|
13405
13398
|
size: getButtonSize(component.size),
|
|
@@ -13416,12 +13409,12 @@ function DynamicButtonWithBehavior(props) {
|
|
|
13416
13409
|
var DynamicButton_default = DynamicButton;
|
|
13417
13410
|
|
|
13418
13411
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13419
|
-
var
|
|
13412
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
13420
13413
|
var DynamicColumns = (props) => {
|
|
13421
13414
|
const columns = props.component;
|
|
13422
13415
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13423
|
-
return /* @__PURE__ */ (0,
|
|
13424
|
-
/* @__PURE__ */ (0,
|
|
13416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: `${getMargin(columns.margin || "xs")} row`, children: [
|
|
13417
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
13425
13418
|
DynamicLayout_default,
|
|
13426
13419
|
{
|
|
13427
13420
|
components: columns.left,
|
|
@@ -13433,7 +13426,7 @@ var DynamicColumns = (props) => {
|
|
|
13433
13426
|
onPersistAsync: props.onPersistAsync
|
|
13434
13427
|
}
|
|
13435
13428
|
) }),
|
|
13436
|
-
/* @__PURE__ */ (0,
|
|
13429
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
13437
13430
|
DynamicLayout_default,
|
|
13438
13431
|
{
|
|
13439
13432
|
components: columns.right,
|
|
@@ -13469,13 +13462,13 @@ var DynamicColumns_default = DynamicColumns;
|
|
|
13469
13462
|
|
|
13470
13463
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13471
13464
|
var import_components5 = require("@transferwise/components");
|
|
13472
|
-
var
|
|
13465
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
13473
13466
|
function DynamicDecision({ component, onAction }) {
|
|
13474
13467
|
const { loading } = useDynamicFlow();
|
|
13475
13468
|
const { margin, options, title } = component;
|
|
13476
|
-
return /* @__PURE__ */ (0,
|
|
13477
|
-
title && /* @__PURE__ */ (0,
|
|
13478
|
-
/* @__PURE__ */ (0,
|
|
13469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: getMargin(margin), children: [
|
|
13470
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components5.Header, { as: "h2", title }),
|
|
13471
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components5.NavigationOptionsList, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13479
13472
|
import_components5.NavigationOption,
|
|
13480
13473
|
{
|
|
13481
13474
|
title: option.title,
|
|
@@ -13493,17 +13486,17 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13493
13486
|
var DynamicDecision_default = DynamicDecision;
|
|
13494
13487
|
|
|
13495
13488
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13496
|
-
var
|
|
13489
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
13497
13490
|
var DynamicDivider = ({ component }) => {
|
|
13498
13491
|
const margin = getMargin(component.margin);
|
|
13499
13492
|
const className = `m-t-0 ${margin}`;
|
|
13500
|
-
return /* @__PURE__ */ (0,
|
|
13493
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("hr", { className });
|
|
13501
13494
|
};
|
|
13502
13495
|
var DynamicDivider_default = DynamicDivider;
|
|
13503
13496
|
|
|
13504
13497
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13505
13498
|
var import_components6 = require("@transferwise/components");
|
|
13506
|
-
var
|
|
13499
|
+
var import_react16 = require("react");
|
|
13507
13500
|
var import_react_intl9 = require("react-intl");
|
|
13508
13501
|
|
|
13509
13502
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
@@ -13517,39 +13510,39 @@ var DynamicExternal_messages_default = (0, import_react_intl8.defineMessages)({
|
|
|
13517
13510
|
});
|
|
13518
13511
|
|
|
13519
13512
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13520
|
-
var
|
|
13513
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
13521
13514
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13522
13515
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13523
13516
|
const intl = (0, import_react_intl9.useIntl)();
|
|
13524
|
-
const openExternalUrl = (0,
|
|
13517
|
+
const openExternalUrl = (0, import_react16.useCallback)(
|
|
13525
13518
|
() => window.open(requestUrl, "df-external-window"),
|
|
13526
13519
|
[requestUrl]
|
|
13527
13520
|
);
|
|
13528
|
-
(0,
|
|
13521
|
+
(0, import_react16.useEffect)(() => {
|
|
13529
13522
|
openExternalUrl();
|
|
13530
13523
|
}, [openExternalUrl]);
|
|
13531
|
-
const pollingConfiguration = (0,
|
|
13524
|
+
const pollingConfiguration = (0, import_react16.useMemo)(() => {
|
|
13532
13525
|
return polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
13533
13526
|
responseHandlers
|
|
13534
13527
|
}) : void 0;
|
|
13535
13528
|
}, [polling, responseHandlers]);
|
|
13536
13529
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13537
|
-
return /* @__PURE__ */ (0,
|
|
13538
|
-
/* @__PURE__ */ (0,
|
|
13539
|
-
/* @__PURE__ */ (0,
|
|
13540
|
-
/* @__PURE__ */ (0,
|
|
13530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
13531
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Loader, { size: import_components6.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
13532
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("br", {}),
|
|
13533
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
13541
13534
|
] });
|
|
13542
13535
|
};
|
|
13543
13536
|
var DynamicExternal_default = DynamicExternal;
|
|
13544
13537
|
|
|
13545
13538
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
13546
|
-
var
|
|
13539
|
+
var import_react30 = require("react");
|
|
13547
13540
|
|
|
13548
13541
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13549
13542
|
var import_components7 = require("@transferwise/components");
|
|
13550
13543
|
var import_classnames = __toESM(require_classnames());
|
|
13551
|
-
var
|
|
13552
|
-
var
|
|
13544
|
+
var import_react17 = require("react");
|
|
13545
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
13553
13546
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13554
13547
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13555
13548
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13565,13 +13558,13 @@ function AllOfSchema(props) {
|
|
|
13565
13558
|
setModels(models);
|
|
13566
13559
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13567
13560
|
};
|
|
13568
|
-
const [models, setModels] = (0,
|
|
13569
|
-
return /* @__PURE__ */ (0,
|
|
13570
|
-
props.schema.title && !hideTitle && /* @__PURE__ */ (0,
|
|
13571
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
13572
|
-
/* @__PURE__ */ (0,
|
|
13561
|
+
const [models, setModels] = (0, import_react17.useState)(splitModel(props.model, props.schema.allOf));
|
|
13562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
13563
|
+
props.schema.title && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components7.Header, { title: props.schema.title }),
|
|
13564
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: props.schema.description }),
|
|
13565
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
13573
13566
|
// eslint-disable-next-line react/no-array-index-key
|
|
13574
|
-
/* @__PURE__ */ (0,
|
|
13567
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: (0, import_classnames.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
13575
13568
|
GenericSchema_default,
|
|
13576
13569
|
{
|
|
13577
13570
|
schema,
|
|
@@ -13594,13 +13587,13 @@ var AllOfSchema_default = AllOfSchema;
|
|
|
13594
13587
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13595
13588
|
var import_components9 = require("@transferwise/components");
|
|
13596
13589
|
var import_classnames2 = __toESM(require_classnames());
|
|
13597
|
-
var
|
|
13590
|
+
var import_react18 = require("react");
|
|
13598
13591
|
|
|
13599
13592
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13600
13593
|
var import_components8 = require("@transferwise/components");
|
|
13601
13594
|
var import_formatting2 = require("@transferwise/formatting");
|
|
13602
13595
|
var import_react_intl10 = require("react-intl");
|
|
13603
|
-
var
|
|
13596
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
13604
13597
|
function ControlFeedback(props) {
|
|
13605
13598
|
const { errors = "", validations = [], validationMessages = {} } = props;
|
|
13606
13599
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13609,12 +13602,12 @@ function ControlFeedback(props) {
|
|
|
13609
13602
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean(validations == null ? void 0 : validations.length);
|
|
13610
13603
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13611
13604
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13612
|
-
return /* @__PURE__ */ (0,
|
|
13613
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
13614
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
13615
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
13616
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
13617
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
13605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { id: props.id, children: [
|
|
13606
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components8.InlineAlert, { type: "error", children: errors }) : null,
|
|
13607
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components8.InlineAlert, { type: "error", children: validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: mergedValidationMessages[validation] }, validation)) }) : null,
|
|
13608
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_components8.InlineAlert, { type: "info", children: [
|
|
13609
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: props.schema.description }),
|
|
13610
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: props.infoMessage })
|
|
13618
13611
|
] })
|
|
13619
13612
|
] });
|
|
13620
13613
|
}
|
|
@@ -13734,15 +13727,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
13734
13727
|
}
|
|
13735
13728
|
|
|
13736
13729
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13737
|
-
var
|
|
13730
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
13738
13731
|
function MultipleFileUploadSchema(props) {
|
|
13739
13732
|
var _a, _b;
|
|
13740
13733
|
const { onChange, errors = null, schema, required = false } = props;
|
|
13741
13734
|
const onEvent = useEventDispatcher();
|
|
13742
13735
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
13743
|
-
const uid = (0,
|
|
13744
|
-
const [inputChanged, setInputChanged] = (0,
|
|
13745
|
-
const [files, setFiles] = (0,
|
|
13736
|
+
const uid = (0, import_react18.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
13737
|
+
const [inputChanged, setInputChanged] = (0, import_react18.useState)(false);
|
|
13738
|
+
const [files, setFiles] = (0, import_react18.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
13746
13739
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
13747
13740
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
13748
13741
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -13795,10 +13788,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
13795
13788
|
onDeleteFile: () => Promise.resolve()
|
|
13796
13789
|
});
|
|
13797
13790
|
const feedbackId = `${uid}-feedback`;
|
|
13798
|
-
return /* @__PURE__ */ (0,
|
|
13799
|
-
/* @__PURE__ */ (0,
|
|
13800
|
-
/* @__PURE__ */ (0,
|
|
13801
|
-
/* @__PURE__ */ (0,
|
|
13791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
|
|
13792
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
13793
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components9.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
13794
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
13802
13795
|
ControlFeedback_default,
|
|
13803
13796
|
{
|
|
13804
13797
|
id: feedbackId,
|
|
@@ -13833,12 +13826,12 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
13833
13826
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
13834
13827
|
var import_components11 = require("@transferwise/components");
|
|
13835
13828
|
var import_classnames3 = __toESM(require_classnames());
|
|
13836
|
-
var
|
|
13829
|
+
var import_react19 = require("react");
|
|
13837
13830
|
var import_react_intl14 = require("react-intl");
|
|
13838
13831
|
|
|
13839
13832
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
13840
13833
|
var import_components10 = require("@transferwise/components");
|
|
13841
|
-
var
|
|
13834
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
13842
13835
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
13843
13836
|
switch (controlType) {
|
|
13844
13837
|
case "select":
|
|
@@ -13862,7 +13855,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
13862
13855
|
var mapImage = (image) => {
|
|
13863
13856
|
if (image == null ? void 0 : image.url) {
|
|
13864
13857
|
return {
|
|
13865
|
-
icon: /* @__PURE__ */ (0,
|
|
13858
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
13866
13859
|
hideIconInTrigger: true
|
|
13867
13860
|
};
|
|
13868
13861
|
}
|
|
@@ -13871,17 +13864,17 @@ var mapImage = (image) => {
|
|
|
13871
13864
|
var getIconPropertyForSelectOption = (icon) => {
|
|
13872
13865
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon(icon.name)) {
|
|
13873
13866
|
return {
|
|
13874
|
-
icon: /* @__PURE__ */ (0,
|
|
13867
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
13875
13868
|
};
|
|
13876
13869
|
}
|
|
13877
13870
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
13878
13871
|
return {
|
|
13879
|
-
icon: /* @__PURE__ */ (0,
|
|
13872
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicIcon_default, { type: icon.name })
|
|
13880
13873
|
};
|
|
13881
13874
|
}
|
|
13882
13875
|
if (icon == null ? void 0 : icon.text) {
|
|
13883
13876
|
return {
|
|
13884
|
-
icon: /* @__PURE__ */ (0,
|
|
13877
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: icon.text })
|
|
13885
13878
|
};
|
|
13886
13879
|
}
|
|
13887
13880
|
return null;
|
|
@@ -13889,17 +13882,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
13889
13882
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
13890
13883
|
if (image == null ? void 0 : image.url) {
|
|
13891
13884
|
return {
|
|
13892
|
-
avatar: /* @__PURE__ */ (0,
|
|
13885
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("img", { src: image.url, alt: "" }) })
|
|
13893
13886
|
};
|
|
13894
13887
|
}
|
|
13895
13888
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
13896
13889
|
return {
|
|
13897
|
-
avatar: /* @__PURE__ */ (0,
|
|
13890
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DynamicIcon_default, { type: icon.name }) })
|
|
13898
13891
|
};
|
|
13899
13892
|
}
|
|
13900
13893
|
if (icon == null ? void 0 : icon.text) {
|
|
13901
13894
|
return {
|
|
13902
|
-
avatar: /* @__PURE__ */ (0,
|
|
13895
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.INITIALS, children: icon.text })
|
|
13903
13896
|
};
|
|
13904
13897
|
}
|
|
13905
13898
|
return null;
|
|
@@ -13938,7 +13931,7 @@ var multi_select_messages_default = (0, import_react_intl13.defineMessages)({
|
|
|
13938
13931
|
});
|
|
13939
13932
|
|
|
13940
13933
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
13941
|
-
var
|
|
13934
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
13942
13935
|
function MultiSelectSchema({
|
|
13943
13936
|
schema,
|
|
13944
13937
|
model,
|
|
@@ -13950,10 +13943,10 @@ function MultiSelectSchema({
|
|
|
13950
13943
|
const { formatMessage, locale } = (0, import_react_intl14.useIntl)();
|
|
13951
13944
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
13952
13945
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
13953
|
-
const id = (0,
|
|
13954
|
-
const [changed, setChanged] = (0,
|
|
13955
|
-
const [selected, setSelected] = (0,
|
|
13956
|
-
(0,
|
|
13946
|
+
const id = (0, import_react19.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
13947
|
+
const [changed, setChanged] = (0, import_react19.useState)(false);
|
|
13948
|
+
const [selected, setSelected] = (0, import_react19.useState)(getInitialModelIndices2(model, options));
|
|
13949
|
+
(0, import_react19.useEffect)(
|
|
13957
13950
|
() => {
|
|
13958
13951
|
if (selected) {
|
|
13959
13952
|
broadcastModelChange(selected);
|
|
@@ -13992,9 +13985,9 @@ function MultiSelectSchema({
|
|
|
13992
13985
|
"has-error": shouldShowInitialError || shouldShowValidationError,
|
|
13993
13986
|
"has-info": !!schema.description
|
|
13994
13987
|
};
|
|
13995
|
-
return /* @__PURE__ */ (0,
|
|
13996
|
-
schema.title ? /* @__PURE__ */ (0,
|
|
13997
|
-
/* @__PURE__ */ (0,
|
|
13988
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: (0, import_classnames3.default)("d-flex flex-column", formGroupClasses), children: [
|
|
13989
|
+
schema.title ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "control-label d-inline m-b-1", htmlFor: id, children: schema.title }) : void 0,
|
|
13990
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
13998
13991
|
import_components11.SelectInput,
|
|
13999
13992
|
{
|
|
14000
13993
|
id,
|
|
@@ -14020,12 +14013,12 @@ function MultiSelectSchema({
|
|
|
14020
14013
|
if (withinTrigger) {
|
|
14021
14014
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14022
14015
|
}
|
|
14023
|
-
return /* @__PURE__ */ (0,
|
|
14016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components11.SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
14024
14017
|
},
|
|
14025
14018
|
onChange: broadcastModelChange
|
|
14026
14019
|
}
|
|
14027
14020
|
),
|
|
14028
|
-
/* @__PURE__ */ (0,
|
|
14021
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
14029
14022
|
ControlFeedback_default,
|
|
14030
14023
|
{
|
|
14031
14024
|
id: `${id}-feedback`,
|
|
@@ -14052,14 +14045,14 @@ var getInitialModelIndices2 = (model, options) => {
|
|
|
14052
14045
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14053
14046
|
var import_components13 = require("@transferwise/components");
|
|
14054
14047
|
var import_icons = require("@transferwise/icons");
|
|
14055
|
-
var
|
|
14048
|
+
var import_react21 = require("react");
|
|
14056
14049
|
var import_react_intl17 = require("react-intl");
|
|
14057
14050
|
|
|
14058
14051
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14059
14052
|
var import_components12 = require("@transferwise/components");
|
|
14060
|
-
var
|
|
14053
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
14061
14054
|
function ItemSummaryOption({ item, onClick }) {
|
|
14062
|
-
return /* @__PURE__ */ (0,
|
|
14055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
14063
14056
|
import_components12.NavigationOption,
|
|
14064
14057
|
{
|
|
14065
14058
|
media: getNavigationOptionMedia(item),
|
|
@@ -14097,9 +14090,9 @@ var repeatable_messages_default = (0, import_react_intl15.defineMessages)({
|
|
|
14097
14090
|
});
|
|
14098
14091
|
|
|
14099
14092
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14100
|
-
var
|
|
14093
|
+
var import_react20 = require("react");
|
|
14101
14094
|
var import_react_intl16 = require("react-intl");
|
|
14102
|
-
var
|
|
14095
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
14103
14096
|
function RepeatableSchemaStep({
|
|
14104
14097
|
type,
|
|
14105
14098
|
schema,
|
|
@@ -14110,7 +14103,7 @@ function RepeatableSchemaStep({
|
|
|
14110
14103
|
onAction
|
|
14111
14104
|
}) {
|
|
14112
14105
|
const { formatMessage } = (0, import_react_intl16.useIntl)();
|
|
14113
|
-
const [filename, setFilename] = (0,
|
|
14106
|
+
const [filename, setFilename] = (0, import_react20.useState)(void 0);
|
|
14114
14107
|
const step = {
|
|
14115
14108
|
layout: [
|
|
14116
14109
|
{
|
|
@@ -14147,7 +14140,7 @@ function RepeatableSchemaStep({
|
|
|
14147
14140
|
}
|
|
14148
14141
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14149
14142
|
};
|
|
14150
|
-
return /* @__PURE__ */ (0,
|
|
14143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
14151
14144
|
DynamicFlowStep,
|
|
14152
14145
|
{
|
|
14153
14146
|
step,
|
|
@@ -14353,7 +14346,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14353
14346
|
|
|
14354
14347
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14355
14348
|
var import_classnames4 = __toESM(require_classnames());
|
|
14356
|
-
var
|
|
14349
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
14357
14350
|
function RepeatableSchema({
|
|
14358
14351
|
schema,
|
|
14359
14352
|
model,
|
|
@@ -14363,9 +14356,9 @@ function RepeatableSchema({
|
|
|
14363
14356
|
onChange
|
|
14364
14357
|
}) {
|
|
14365
14358
|
var _a;
|
|
14366
|
-
const [openModalType, setOpenModalType] = (0,
|
|
14367
|
-
const [changed, setChanged] = (0,
|
|
14368
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
14359
|
+
const [openModalType, setOpenModalType] = (0, import_react21.useState)(null);
|
|
14360
|
+
const [changed, setChanged] = (0, import_react21.useState)(false);
|
|
14361
|
+
const [itemSummaries, setItemSummaries] = (0, import_react21.useState)(() => {
|
|
14369
14362
|
if (isObject2(model) && !isArray2(model)) {
|
|
14370
14363
|
throw new Error(
|
|
14371
14364
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14373,8 +14366,8 @@ function RepeatableSchema({
|
|
|
14373
14366
|
}
|
|
14374
14367
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14375
14368
|
});
|
|
14376
|
-
const [editableItem, setEditableItem] = (0,
|
|
14377
|
-
const id = (0,
|
|
14369
|
+
const [editableItem, setEditableItem] = (0, import_react21.useState)({ item: null, model: null });
|
|
14370
|
+
const id = (0, import_react21.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14378
14371
|
const broadcastModelChange = (updatedItems) => {
|
|
14379
14372
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
14380
14373
|
onChange({
|
|
@@ -14430,9 +14423,9 @@ function RepeatableSchema({
|
|
|
14430
14423
|
const formGroupClasses = {
|
|
14431
14424
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14432
14425
|
};
|
|
14433
|
-
return /* @__PURE__ */ (0,
|
|
14434
|
-
schema.title && /* @__PURE__ */ (0,
|
|
14435
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
14426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { id, className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
14427
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.Header, { title: schema.title }),
|
|
14428
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14436
14429
|
ItemSummaryOption,
|
|
14437
14430
|
{
|
|
14438
14431
|
item: itemSummary,
|
|
@@ -14440,21 +14433,21 @@ function RepeatableSchema({
|
|
|
14440
14433
|
},
|
|
14441
14434
|
JSON.stringify(itemSummary)
|
|
14442
14435
|
)),
|
|
14443
|
-
/* @__PURE__ */ (0,
|
|
14436
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14444
14437
|
import_components13.NavigationOption,
|
|
14445
14438
|
{
|
|
14446
|
-
media: /* @__PURE__ */ (0,
|
|
14439
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_icons.Plus, {}),
|
|
14447
14440
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14448
14441
|
showMediaAtAllSizes: true,
|
|
14449
14442
|
onClick: onAddItem
|
|
14450
14443
|
}
|
|
14451
14444
|
),
|
|
14452
|
-
/* @__PURE__ */ (0,
|
|
14445
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14453
14446
|
import_components13.Modal,
|
|
14454
14447
|
{
|
|
14455
14448
|
open: openModalType !== null,
|
|
14456
14449
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14457
|
-
body: /* @__PURE__ */ (0,
|
|
14450
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14458
14451
|
RepeatableSchemaStep_default,
|
|
14459
14452
|
{
|
|
14460
14453
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14469,7 +14462,7 @@ function RepeatableSchema({
|
|
|
14469
14462
|
onClose: onCancelEdit
|
|
14470
14463
|
}
|
|
14471
14464
|
),
|
|
14472
|
-
/* @__PURE__ */ (0,
|
|
14465
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
14473
14466
|
ControlFeedback_default,
|
|
14474
14467
|
{
|
|
14475
14468
|
id: `${id}-feedback`,
|
|
@@ -14511,28 +14504,28 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14511
14504
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14512
14505
|
|
|
14513
14506
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14514
|
-
var
|
|
14507
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14515
14508
|
function ArrayListSchema(props) {
|
|
14516
14509
|
const { errors = null, schema } = props;
|
|
14517
14510
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14518
|
-
return /* @__PURE__ */ (0,
|
|
14511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
14519
14512
|
}
|
|
14520
14513
|
if (isMultiSelectConstSchema(schema)) {
|
|
14521
|
-
return /* @__PURE__ */ (0,
|
|
14514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
14522
14515
|
}
|
|
14523
14516
|
if (isListArraySchema(schema)) {
|
|
14524
|
-
return /* @__PURE__ */ (0,
|
|
14517
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
|
|
14525
14518
|
}
|
|
14526
14519
|
throw new Error("Invalid array list schema");
|
|
14527
14520
|
}
|
|
14528
14521
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14529
14522
|
|
|
14530
14523
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14531
|
-
var
|
|
14524
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
14532
14525
|
var ArraySchema = (props) => {
|
|
14533
14526
|
const { schema } = props;
|
|
14534
14527
|
if (isListArraySchema(schema)) {
|
|
14535
|
-
return /* @__PURE__ */ (0,
|
|
14528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
14536
14529
|
}
|
|
14537
14530
|
throw new Error("Not implemented");
|
|
14538
14531
|
};
|
|
@@ -14541,8 +14534,8 @@ var ArraySchema_default = ArraySchema;
|
|
|
14541
14534
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14542
14535
|
var import_components14 = require("@transferwise/components");
|
|
14543
14536
|
var import_classnames5 = __toESM(require_classnames());
|
|
14544
|
-
var
|
|
14545
|
-
var
|
|
14537
|
+
var import_react22 = require("react");
|
|
14538
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
14546
14539
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14547
14540
|
"col-xs-12": true,
|
|
14548
14541
|
"col-sm-6": width === "md",
|
|
@@ -14550,7 +14543,7 @@ var getSchemaColumnClasses2 = (width) => ({
|
|
|
14550
14543
|
});
|
|
14551
14544
|
function ObjectSchema(props) {
|
|
14552
14545
|
const { disabled = false, hideTitle = false } = props;
|
|
14553
|
-
const [model, setModel] = (0,
|
|
14546
|
+
const [model, setModel] = (0, import_react22.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14554
14547
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14555
14548
|
if (onChangeProps.model !== null) {
|
|
14556
14549
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14561,7 +14554,7 @@ function ObjectSchema(props) {
|
|
|
14561
14554
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
14562
14555
|
};
|
|
14563
14556
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
14564
|
-
(0,
|
|
14557
|
+
(0, import_react22.useEffect)(() => {
|
|
14565
14558
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
14566
14559
|
setModel(newModel);
|
|
14567
14560
|
if (!isEqual(newModel, model)) {
|
|
@@ -14579,22 +14572,22 @@ function ObjectSchema(props) {
|
|
|
14579
14572
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
14580
14573
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14581
14574
|
const propsErrors = props.errors;
|
|
14582
|
-
return /* @__PURE__ */ (0,
|
|
14583
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
14584
|
-
/* @__PURE__ */ (0,
|
|
14585
|
-
props.schema.title && !hideTitle && /* @__PURE__ */ (0,
|
|
14586
|
-
props.schema.description && !hideTitle && /* @__PURE__ */ (0,
|
|
14575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
|
|
14576
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
14577
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("fieldset", { children: [
|
|
14578
|
+
props.schema.title && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components14.Header, { title: props.schema.title, as: "legend" }),
|
|
14579
|
+
props.schema.description && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("p", { children: [
|
|
14587
14580
|
" ",
|
|
14588
14581
|
props.schema.description,
|
|
14589
14582
|
" "
|
|
14590
14583
|
] }),
|
|
14591
|
-
/* @__PURE__ */ (0,
|
|
14584
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
14592
14585
|
"div",
|
|
14593
14586
|
{
|
|
14594
14587
|
className: (0, import_classnames5.default)(
|
|
14595
14588
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14596
14589
|
),
|
|
14597
|
-
children: /* @__PURE__ */ (0,
|
|
14590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
14598
14591
|
GenericSchema_default,
|
|
14599
14592
|
{
|
|
14600
14593
|
schema: props.schema.properties[propertyName],
|
|
@@ -14618,7 +14611,7 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
14618
14611
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14619
14612
|
var import_components17 = require("@transferwise/components");
|
|
14620
14613
|
var import_classnames6 = __toESM(require_classnames());
|
|
14621
|
-
var
|
|
14614
|
+
var import_react25 = require("react");
|
|
14622
14615
|
|
|
14623
14616
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14624
14617
|
var import_components15 = require("@transferwise/components");
|
|
@@ -14635,14 +14628,14 @@ var help_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
14635
14628
|
});
|
|
14636
14629
|
|
|
14637
14630
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14638
|
-
var
|
|
14631
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
14639
14632
|
function Help(props) {
|
|
14640
14633
|
const intl = (0, import_react_intl19.useIntl)();
|
|
14641
|
-
return /* @__PURE__ */ (0,
|
|
14634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
14642
14635
|
import_components15.Info,
|
|
14643
14636
|
{
|
|
14644
14637
|
className: "m-l-1",
|
|
14645
|
-
content: /* @__PURE__ */ (0,
|
|
14638
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components15.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
14646
14639
|
presentation: "POPOVER",
|
|
14647
14640
|
size: "sm",
|
|
14648
14641
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -14652,12 +14645,12 @@ function Help(props) {
|
|
|
14652
14645
|
var Help_default = Help;
|
|
14653
14646
|
|
|
14654
14647
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
14655
|
-
var
|
|
14648
|
+
var import_react24 = require("react");
|
|
14656
14649
|
var import_react_intl20 = require("react-intl");
|
|
14657
14650
|
|
|
14658
14651
|
// src/legacy/formControl/FormControl.tsx
|
|
14659
14652
|
var import_components16 = require("@transferwise/components");
|
|
14660
|
-
var
|
|
14653
|
+
var import_react23 = require("react");
|
|
14661
14654
|
|
|
14662
14655
|
// src/legacy/formControl/utils/value-utils.ts
|
|
14663
14656
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -14843,8 +14836,8 @@ var autocompleteTokenMap2 = {
|
|
|
14843
14836
|
};
|
|
14844
14837
|
|
|
14845
14838
|
// src/legacy/formControl/FormControl.tsx
|
|
14846
|
-
var
|
|
14847
|
-
var _FormControl = class _FormControl extends
|
|
14839
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
14840
|
+
var _FormControl = class _FormControl extends import_react23.PureComponent {
|
|
14848
14841
|
constructor(props) {
|
|
14849
14842
|
super(props);
|
|
14850
14843
|
this.getAutocompleteValue = ({ prefix = "", suffix = "" } = {}) => {
|
|
@@ -14933,7 +14926,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
14933
14926
|
} = this.props;
|
|
14934
14927
|
switch (type) {
|
|
14935
14928
|
case FormControlType.RADIO:
|
|
14936
|
-
return /* @__PURE__ */ (0,
|
|
14929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
14937
14930
|
import_components16.RadioGroup,
|
|
14938
14931
|
{
|
|
14939
14932
|
radios: options.map(this.mapOption),
|
|
@@ -14949,7 +14942,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
14949
14942
|
}
|
|
14950
14943
|
);
|
|
14951
14944
|
case FormControlType.CHECKBOX:
|
|
14952
|
-
return /* @__PURE__ */ (0,
|
|
14945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
14953
14946
|
import_components16.Checkbox,
|
|
14954
14947
|
{
|
|
14955
14948
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
@@ -14967,7 +14960,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
14967
14960
|
const search = options.length >= 8;
|
|
14968
14961
|
const items = options;
|
|
14969
14962
|
const selected = this.getSelectedOption(options);
|
|
14970
|
-
return /* @__PURE__ */ (0,
|
|
14963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "d-flex flex-column", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
14971
14964
|
import_components16.SelectInput,
|
|
14972
14965
|
{
|
|
14973
14966
|
id,
|
|
@@ -14983,7 +14976,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
14983
14976
|
disabled: value2.disabled
|
|
14984
14977
|
})),
|
|
14985
14978
|
value: selected != null ? selected : null,
|
|
14986
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0,
|
|
14979
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
14987
14980
|
import_components16.SelectInputOptionContent,
|
|
14988
14981
|
{
|
|
14989
14982
|
title: label2,
|
|
@@ -15012,13 +15005,13 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15012
15005
|
) });
|
|
15013
15006
|
}
|
|
15014
15007
|
case FormControlType.TAB:
|
|
15015
|
-
return /* @__PURE__ */ (0,
|
|
15008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15016
15009
|
import_components16.Tabs,
|
|
15017
15010
|
{
|
|
15018
15011
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15019
15012
|
tabs: options.map((option) => ({
|
|
15020
15013
|
title: option.label,
|
|
15021
|
-
content: /* @__PURE__ */ (0,
|
|
15014
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {}),
|
|
15022
15015
|
disabled: option.disabled || false
|
|
15023
15016
|
})),
|
|
15024
15017
|
name: id,
|
|
@@ -15033,7 +15026,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15033
15026
|
);
|
|
15034
15027
|
case FormControlType.NUMERIC:
|
|
15035
15028
|
case FormControlType.NUMBER: {
|
|
15036
|
-
return /* @__PURE__ */ (0,
|
|
15029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15037
15030
|
"input",
|
|
15038
15031
|
{
|
|
15039
15032
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15067,7 +15060,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15067
15060
|
);
|
|
15068
15061
|
}
|
|
15069
15062
|
case FormControlType.HIDDEN:
|
|
15070
|
-
return /* @__PURE__ */ (0,
|
|
15063
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15071
15064
|
"input",
|
|
15072
15065
|
{
|
|
15073
15066
|
type: "hidden",
|
|
@@ -15077,7 +15070,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15077
15070
|
}
|
|
15078
15071
|
);
|
|
15079
15072
|
case FormControlType.PASSWORD:
|
|
15080
|
-
return /* @__PURE__ */ (0,
|
|
15073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15081
15074
|
"input",
|
|
15082
15075
|
{
|
|
15083
15076
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15097,7 +15090,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15097
15090
|
);
|
|
15098
15091
|
case FormControlType.DATE:
|
|
15099
15092
|
case FormControlType.DATETIME:
|
|
15100
|
-
return /* @__PURE__ */ (0,
|
|
15093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15101
15094
|
import_components16.DateInput,
|
|
15102
15095
|
{
|
|
15103
15096
|
"aria-labelledby": labelledBy,
|
|
@@ -15114,7 +15107,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15114
15107
|
}
|
|
15115
15108
|
);
|
|
15116
15109
|
case FormControlType.DATELOOKUP: {
|
|
15117
|
-
return /* @__PURE__ */ (0,
|
|
15110
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15118
15111
|
import_components16.DateLookup,
|
|
15119
15112
|
{
|
|
15120
15113
|
value: getSafeDateStringValue(value),
|
|
@@ -15132,7 +15125,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15132
15125
|
);
|
|
15133
15126
|
}
|
|
15134
15127
|
case FormControlType.TEL:
|
|
15135
|
-
return /* @__PURE__ */ (0,
|
|
15128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15136
15129
|
import_components16.PhoneNumberInput,
|
|
15137
15130
|
{
|
|
15138
15131
|
disabled,
|
|
@@ -15164,7 +15157,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15164
15157
|
autoComplete: this.getAutocompleteValue()
|
|
15165
15158
|
};
|
|
15166
15159
|
if (this.props.displayPattern) {
|
|
15167
|
-
return /* @__PURE__ */ (0,
|
|
15160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15168
15161
|
import_components16.TextareaWithDisplayFormat,
|
|
15169
15162
|
__spreadProps(__spreadValues({
|
|
15170
15163
|
displayPattern: this.props.displayPattern
|
|
@@ -15173,7 +15166,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15173
15166
|
})
|
|
15174
15167
|
);
|
|
15175
15168
|
}
|
|
15176
|
-
return /* @__PURE__ */ (0,
|
|
15169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15177
15170
|
"textarea",
|
|
15178
15171
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15179
15172
|
"aria-describedby": describedBy,
|
|
@@ -15183,7 +15176,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15183
15176
|
}
|
|
15184
15177
|
case FormControlType.FILE:
|
|
15185
15178
|
case FormControlType.UPLOAD: {
|
|
15186
|
-
return /* @__PURE__ */ (0,
|
|
15179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15187
15180
|
import_components16.Upload,
|
|
15188
15181
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15189
15182
|
usAccept: uploadProps.usAccept || "*",
|
|
@@ -15220,7 +15213,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15220
15213
|
autoComplete: this.getAutocompleteValue()
|
|
15221
15214
|
};
|
|
15222
15215
|
if (this.props.displayPattern) {
|
|
15223
|
-
return /* @__PURE__ */ (0,
|
|
15216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15224
15217
|
import_components16.InputWithDisplayFormat,
|
|
15225
15218
|
__spreadProps(__spreadValues({
|
|
15226
15219
|
displayPattern: this.props.displayPattern
|
|
@@ -15229,7 +15222,7 @@ var _FormControl = class _FormControl extends import_react24.PureComponent {
|
|
|
15229
15222
|
})
|
|
15230
15223
|
);
|
|
15231
15224
|
}
|
|
15232
|
-
return /* @__PURE__ */ (0,
|
|
15225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
15233
15226
|
"input",
|
|
15234
15227
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15235
15228
|
"aria-describedby": describedBy,
|
|
@@ -15279,7 +15272,7 @@ _FormControl.defaultProps = {
|
|
|
15279
15272
|
var FormControl = _FormControl;
|
|
15280
15273
|
|
|
15281
15274
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15282
|
-
var
|
|
15275
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
15283
15276
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15284
15277
|
var getControlType = (schema) => {
|
|
15285
15278
|
if (isOneOfSchema2(schema)) {
|
|
@@ -15365,7 +15358,7 @@ function SchemaFormControl(props) {
|
|
|
15365
15358
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
15366
15359
|
};
|
|
15367
15360
|
const controlType = getControlType(schema);
|
|
15368
|
-
(0,
|
|
15361
|
+
(0, import_react24.useEffect)(() => {
|
|
15369
15362
|
warnIfInvalidSchema(schema, log, controlType);
|
|
15370
15363
|
}, [JSON.stringify(schema), log, controlType]);
|
|
15371
15364
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -15396,7 +15389,7 @@ function SchemaFormControl(props) {
|
|
|
15396
15389
|
labelledBy,
|
|
15397
15390
|
required
|
|
15398
15391
|
};
|
|
15399
|
-
return /* @__PURE__ */ (0,
|
|
15392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
15400
15393
|
}
|
|
15401
15394
|
var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
15402
15395
|
if (isOneOfSchema2(schema) && schema.oneOf.length === 2 && !schema.control) {
|
|
@@ -15418,18 +15411,18 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15418
15411
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15419
15412
|
|
|
15420
15413
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15421
|
-
var
|
|
15414
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
15422
15415
|
function OneOfSchema(props) {
|
|
15423
15416
|
const onEvent = useEventDispatcher();
|
|
15424
|
-
const [changed, setChanged] = (0,
|
|
15425
|
-
const [focused, setFocused] = (0,
|
|
15426
|
-
const [blurred, setBlurred] = (0,
|
|
15417
|
+
const [changed, setChanged] = (0, import_react25.useState)(false);
|
|
15418
|
+
const [focused, setFocused] = (0, import_react25.useState)(false);
|
|
15419
|
+
const [blurred, setBlurred] = (0, import_react25.useState)(false);
|
|
15427
15420
|
const { disabled = false, required = false } = props;
|
|
15428
|
-
const id = (0,
|
|
15429
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
15421
|
+
const id = (0, import_react25.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
15422
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react25.useState)(
|
|
15430
15423
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15431
15424
|
);
|
|
15432
|
-
const [models, setModels] = (0,
|
|
15425
|
+
const [models, setModels] = (0, import_react25.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15433
15426
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15434
15427
|
const onSearchChange = (searchValue) => {
|
|
15435
15428
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15437,7 +15430,7 @@ function OneOfSchema(props) {
|
|
|
15437
15430
|
searchValueLength: searchValue.length
|
|
15438
15431
|
});
|
|
15439
15432
|
};
|
|
15440
|
-
(0,
|
|
15433
|
+
(0, import_react25.useEffect)(() => {
|
|
15441
15434
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
15442
15435
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
15443
15436
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -15497,12 +15490,12 @@ function OneOfSchema(props) {
|
|
|
15497
15490
|
const isHidden = props.schema.hidden;
|
|
15498
15491
|
const feedbackId = `${id}-feedback`;
|
|
15499
15492
|
const labelId = `${id}-label`;
|
|
15500
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
15501
|
-
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
15502
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
15503
|
-
/* @__PURE__ */ (0,
|
|
15493
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
15494
|
+
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
15495
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
15496
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
15504
15497
|
getTitleAndHelp(props.schema, id, labelId),
|
|
15505
|
-
/* @__PURE__ */ (0,
|
|
15498
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
15506
15499
|
SchemaFormControl_default,
|
|
15507
15500
|
{
|
|
15508
15501
|
id,
|
|
@@ -15519,7 +15512,7 @@ function OneOfSchema(props) {
|
|
|
15519
15512
|
onSearchChange
|
|
15520
15513
|
}
|
|
15521
15514
|
),
|
|
15522
|
-
/* @__PURE__ */ (0,
|
|
15515
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
15523
15516
|
ControlFeedback_default,
|
|
15524
15517
|
{
|
|
15525
15518
|
id: feedbackId,
|
|
@@ -15535,7 +15528,7 @@ function OneOfSchema(props) {
|
|
|
15535
15528
|
)
|
|
15536
15529
|
] })
|
|
15537
15530
|
] }),
|
|
15538
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
15531
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
15539
15532
|
GenericSchema_default,
|
|
15540
15533
|
{
|
|
15541
15534
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15552,16 +15545,16 @@ function OneOfSchema(props) {
|
|
|
15552
15545
|
}
|
|
15553
15546
|
function getTitleAndHelp(schema, forId, labelId) {
|
|
15554
15547
|
var _a;
|
|
15555
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
15556
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
15548
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Help_default, { help: schema.help }) : null;
|
|
15549
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("label", { className: "control-label d-inline", id: labelId, htmlFor: forId, children: [
|
|
15557
15550
|
schema.title,
|
|
15558
15551
|
" ",
|
|
15559
15552
|
helpElement
|
|
15560
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
15553
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: helpElement ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("h4", { className: "m-b-2", children: [
|
|
15561
15554
|
schema.title,
|
|
15562
15555
|
" ",
|
|
15563
15556
|
helpElement
|
|
15564
|
-
] }) : /* @__PURE__ */ (0,
|
|
15557
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components17.Header, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15565
15558
|
return schema.title ? titleElement : helpElement;
|
|
15566
15559
|
}
|
|
15567
15560
|
function getValidations(props, schemaIndex) {
|
|
@@ -15595,13 +15588,13 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15595
15588
|
|
|
15596
15589
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15597
15590
|
var import_classnames7 = __toESM(require_classnames());
|
|
15598
|
-
var
|
|
15591
|
+
var import_react27 = require("react");
|
|
15599
15592
|
var import_react_intl21 = require("react-intl");
|
|
15600
15593
|
|
|
15601
15594
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15602
15595
|
var import_components18 = require("@transferwise/components");
|
|
15603
|
-
var
|
|
15604
|
-
var
|
|
15596
|
+
var import_react26 = require("react");
|
|
15597
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
15605
15598
|
function UploadInputAdapter(props) {
|
|
15606
15599
|
const {
|
|
15607
15600
|
id,
|
|
@@ -15617,7 +15610,7 @@ function UploadInputAdapter(props) {
|
|
|
15617
15610
|
onCancel
|
|
15618
15611
|
} = props;
|
|
15619
15612
|
const onEvent = useEventDispatcher();
|
|
15620
|
-
const files = (0,
|
|
15613
|
+
const files = (0, import_react26.useMemo)(() => fileId ? [{ id: fileId, status: import_components18.Status.SUCCEEDED }] : [], [fileId]);
|
|
15621
15614
|
const uploadFile = (formData) => {
|
|
15622
15615
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
15623
15616
|
return httpClient(String(httpOptions.url), {
|
|
@@ -15636,7 +15629,7 @@ function UploadInputAdapter(props) {
|
|
|
15636
15629
|
return Promise.reject();
|
|
15637
15630
|
});
|
|
15638
15631
|
};
|
|
15639
|
-
return /* @__PURE__ */ (0,
|
|
15632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
15640
15633
|
import_components18.UploadInput,
|
|
15641
15634
|
{
|
|
15642
15635
|
id,
|
|
@@ -15656,17 +15649,17 @@ function UploadInputAdapter(props) {
|
|
|
15656
15649
|
}
|
|
15657
15650
|
|
|
15658
15651
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15659
|
-
var
|
|
15652
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
15660
15653
|
function PersistAsyncBlobSchema(props) {
|
|
15661
15654
|
const { model, schema, submitted, required = false, errors, onChange } = props;
|
|
15662
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
15663
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
15664
|
-
const [validations, setValidations] = (0,
|
|
15665
|
-
const [changed, setChanged] = (0,
|
|
15655
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react27.useState)({});
|
|
15656
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react27.useState)(null);
|
|
15657
|
+
const [validations, setValidations] = (0, import_react27.useState)([]);
|
|
15658
|
+
const [changed, setChanged] = (0, import_react27.useState)(false);
|
|
15666
15659
|
const intl = (0, import_react_intl21.useIntl)();
|
|
15667
15660
|
const httpClient = useHttpClient();
|
|
15668
15661
|
const onEvent = useEventDispatcher();
|
|
15669
|
-
(0,
|
|
15662
|
+
(0, import_react27.useEffect)(() => {
|
|
15670
15663
|
if (submitted) {
|
|
15671
15664
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
15672
15665
|
} else {
|
|
@@ -15704,8 +15697,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15704
15697
|
};
|
|
15705
15698
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
15706
15699
|
const feedbackId = `${id}-feedback`;
|
|
15707
|
-
return /* @__PURE__ */ (0,
|
|
15708
|
-
/* @__PURE__ */ (0,
|
|
15700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: (0, import_classnames7.default)(formGroupClasses), children: [
|
|
15701
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
15709
15702
|
UploadInputAdapter,
|
|
15710
15703
|
__spreadValues({
|
|
15711
15704
|
id,
|
|
@@ -15723,7 +15716,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15723
15716
|
onCancel
|
|
15724
15717
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
15725
15718
|
) }),
|
|
15726
|
-
/* @__PURE__ */ (0,
|
|
15719
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
15727
15720
|
ControlFeedback_default,
|
|
15728
15721
|
{
|
|
15729
15722
|
id: feedbackId,
|
|
@@ -15749,22 +15742,22 @@ var getResponseJsonObject = async (response) => {
|
|
|
15749
15742
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
15750
15743
|
|
|
15751
15744
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
15752
|
-
var
|
|
15745
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
15753
15746
|
function PersistAsyncSchema(props) {
|
|
15754
15747
|
const { schema } = props;
|
|
15755
15748
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
15756
15749
|
if (persistAsyncSchemaType === "blob") {
|
|
15757
|
-
return /* @__PURE__ */ (0,
|
|
15750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
15758
15751
|
PersistAsyncBlobSchema_default,
|
|
15759
15752
|
__spreadValues({}, props)
|
|
15760
15753
|
);
|
|
15761
15754
|
}
|
|
15762
|
-
return /* @__PURE__ */ (0,
|
|
15755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
15763
15756
|
}
|
|
15764
15757
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
15765
15758
|
|
|
15766
15759
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
15767
|
-
var
|
|
15760
|
+
var import_react28 = require("react");
|
|
15768
15761
|
|
|
15769
15762
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
15770
15763
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -15777,7 +15770,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
15777
15770
|
|
|
15778
15771
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
15779
15772
|
var import_components19 = require("@transferwise/components");
|
|
15780
|
-
var
|
|
15773
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
15781
15774
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
15782
15775
|
const { id, selection, setSelection } = props;
|
|
15783
15776
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -15788,13 +15781,13 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
15788
15781
|
const toggleSelection = () => {
|
|
15789
15782
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
15790
15783
|
};
|
|
15791
|
-
return /* @__PURE__ */ (0,
|
|
15784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
15792
15785
|
};
|
|
15793
15786
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
15794
15787
|
|
|
15795
15788
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
15796
15789
|
var import_components20 = require("@transferwise/components");
|
|
15797
|
-
var
|
|
15790
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
15798
15791
|
function PromotedOneOfRadioControl(props) {
|
|
15799
15792
|
var _a, _b;
|
|
15800
15793
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -15811,9 +15804,9 @@ function PromotedOneOfRadioControl(props) {
|
|
|
15811
15804
|
secondary: promotion.other.description
|
|
15812
15805
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
15813
15806
|
];
|
|
15814
|
-
return /* @__PURE__ */ (0,
|
|
15815
|
-
title && /* @__PURE__ */ (0,
|
|
15816
|
-
/* @__PURE__ */ (0,
|
|
15807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "form-group", children: [
|
|
15808
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
15809
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
15817
15810
|
import_components20.RadioGroup,
|
|
15818
15811
|
{
|
|
15819
15812
|
name: "promoted-selection",
|
|
@@ -15831,16 +15824,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
15831
15824
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
15832
15825
|
|
|
15833
15826
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
15834
|
-
var
|
|
15827
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
15835
15828
|
function PromotedOneOfControl(props) {
|
|
15836
15829
|
const controlType = props.promotion.control || "radio";
|
|
15837
15830
|
switch (controlType) {
|
|
15838
15831
|
case "radio":
|
|
15839
|
-
return /* @__PURE__ */ (0,
|
|
15832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
15840
15833
|
case "checkbox":
|
|
15841
|
-
return /* @__PURE__ */ (0,
|
|
15834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
15842
15835
|
default:
|
|
15843
|
-
return /* @__PURE__ */ (0,
|
|
15836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, {});
|
|
15844
15837
|
}
|
|
15845
15838
|
}
|
|
15846
15839
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -15850,20 +15843,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
15850
15843
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
15851
15844
|
|
|
15852
15845
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
15853
|
-
var
|
|
15846
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
15854
15847
|
var isPromoted = (schema) => schema.promoted === true;
|
|
15855
15848
|
var PromotedOneOfSchema = (props) => {
|
|
15856
15849
|
var _a;
|
|
15857
|
-
const [selection, setSelection] = (0,
|
|
15850
|
+
const [selection, setSelection] = (0, import_react28.useState)(
|
|
15858
15851
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
15859
15852
|
);
|
|
15860
15853
|
const promotedAlert = props.schema.alert;
|
|
15861
15854
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
15862
15855
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
15863
15856
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
15864
|
-
return /* @__PURE__ */ (0,
|
|
15865
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
15866
|
-
/* @__PURE__ */ (0,
|
|
15857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
|
|
15858
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
15859
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
15867
15860
|
PromotedOneOfControl_default,
|
|
15868
15861
|
{
|
|
15869
15862
|
id: props.schema.$id,
|
|
@@ -15874,8 +15867,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
15874
15867
|
setSelection
|
|
15875
15868
|
}
|
|
15876
15869
|
),
|
|
15877
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
15878
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
15870
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
15871
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
15879
15872
|
] });
|
|
15880
15873
|
};
|
|
15881
15874
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -15924,12 +15917,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
15924
15917
|
});
|
|
15925
15918
|
|
|
15926
15919
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
15927
|
-
var
|
|
15920
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
15928
15921
|
function ReadOnlySchema({ schema, model }) {
|
|
15929
15922
|
const { title = "" } = schema;
|
|
15930
15923
|
const { formatMessage } = (0, import_react_intl23.useIntl)();
|
|
15931
15924
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
15932
|
-
return /* @__PURE__ */ (0,
|
|
15925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components21.DefinitionList, { layout: import_components21.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
15933
15926
|
}
|
|
15934
15927
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
15935
15928
|
function getValueForSchema({
|
|
@@ -15962,7 +15955,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
15962
15955
|
function getValueFromOption(option) {
|
|
15963
15956
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
15964
15957
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
15965
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
15958
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
15966
15959
|
icon.avatar,
|
|
15967
15960
|
" ",
|
|
15968
15961
|
text
|
|
@@ -15970,22 +15963,22 @@ function getValueFromOption(option) {
|
|
|
15970
15963
|
}
|
|
15971
15964
|
|
|
15972
15965
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
15973
|
-
var
|
|
15974
|
-
var
|
|
15966
|
+
var import_react29 = require("react");
|
|
15967
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
15975
15968
|
function ValidationAsyncSchema(props) {
|
|
15976
15969
|
const { schema, model, required = false, submitted, errors, onChange } = props;
|
|
15977
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
15978
|
-
const previousRequestedModelReference = (0,
|
|
15979
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
15970
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react29.useState)(model);
|
|
15971
|
+
const previousRequestedModelReference = (0, import_react29.useRef)(null);
|
|
15972
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react29.useState)(
|
|
15980
15973
|
null
|
|
15981
15974
|
);
|
|
15982
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
15983
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
15984
|
-
const [abortController, setAbortController] = (0,
|
|
15975
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react29.useState)(null);
|
|
15976
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react29.useState)(false);
|
|
15977
|
+
const [abortController, setAbortController] = (0, import_react29.useState)(null);
|
|
15985
15978
|
const httpClient = useHttpClient();
|
|
15986
15979
|
const onEvent = useEventDispatcher();
|
|
15987
15980
|
const log = useLogger();
|
|
15988
|
-
(0,
|
|
15981
|
+
(0, import_react29.useEffect)(() => {
|
|
15989
15982
|
if (!schema.validationAsync.method) {
|
|
15990
15983
|
log.warning(
|
|
15991
15984
|
"Invalid schema or model",
|
|
@@ -16055,19 +16048,19 @@ function ValidationAsyncSchema(props) {
|
|
|
16055
16048
|
required,
|
|
16056
16049
|
schema
|
|
16057
16050
|
};
|
|
16058
|
-
return /* @__PURE__ */ (0,
|
|
16051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16059
16052
|
}
|
|
16060
16053
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16061
16054
|
|
|
16062
16055
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16063
|
-
var
|
|
16064
|
-
var
|
|
16056
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
16057
|
+
var import_react31 = require("react");
|
|
16065
16058
|
function GenericSchemaForm(props) {
|
|
16066
16059
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
16067
16060
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
16068
16061
|
const type = getSchemaType(schema);
|
|
16069
16062
|
const log = useLogger();
|
|
16070
|
-
(0,
|
|
16063
|
+
(0, import_react30.useEffect)(() => {
|
|
16071
16064
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
16072
16065
|
log.error(
|
|
16073
16066
|
"Invalid schema or model",
|
|
@@ -16077,29 +16070,29 @@ function GenericSchemaForm(props) {
|
|
|
16077
16070
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16078
16071
|
switch (type) {
|
|
16079
16072
|
case "readOnly":
|
|
16080
|
-
return /* @__PURE__ */ (0,
|
|
16073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16081
16074
|
case "persistAsync":
|
|
16082
|
-
return /* @__PURE__ */ (0,
|
|
16075
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16083
16076
|
case "validationAsync":
|
|
16084
|
-
return /* @__PURE__ */ (0,
|
|
16077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16085
16078
|
case "basic": {
|
|
16086
16079
|
const basicTypeProps = __spreadValues({
|
|
16087
16080
|
infoMessage: null
|
|
16088
16081
|
}, schemaProps);
|
|
16089
|
-
return /* @__PURE__ */ (0,
|
|
16082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16090
16083
|
}
|
|
16091
16084
|
case "object":
|
|
16092
|
-
return /* @__PURE__ */ (0,
|
|
16085
|
+
return /* @__PURE__ */ (0, import_react31.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16093
16086
|
case "array":
|
|
16094
|
-
return /* @__PURE__ */ (0,
|
|
16087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16095
16088
|
case "promotedOneOf":
|
|
16096
|
-
return /* @__PURE__ */ (0,
|
|
16089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16097
16090
|
case "oneOf":
|
|
16098
|
-
return /* @__PURE__ */ (0,
|
|
16091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16099
16092
|
case "allOf":
|
|
16100
|
-
return /* @__PURE__ */ (0,
|
|
16093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16101
16094
|
}
|
|
16102
|
-
return /* @__PURE__ */ (0,
|
|
16095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, {});
|
|
16103
16096
|
}
|
|
16104
16097
|
var GenericSchema_default = GenericSchemaForm;
|
|
16105
16098
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16126,7 +16119,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16126
16119
|
};
|
|
16127
16120
|
|
|
16128
16121
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16129
|
-
var
|
|
16122
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
16130
16123
|
function DynamicForm({
|
|
16131
16124
|
component,
|
|
16132
16125
|
model = null,
|
|
@@ -16136,7 +16129,7 @@ function DynamicForm({
|
|
|
16136
16129
|
onPersistAsync
|
|
16137
16130
|
}) {
|
|
16138
16131
|
const formSchema = component.schema;
|
|
16139
|
-
return /* @__PURE__ */ (0,
|
|
16132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
16140
16133
|
GenericSchema_default,
|
|
16141
16134
|
{
|
|
16142
16135
|
schema: formSchema,
|
|
@@ -16155,63 +16148,63 @@ var DynamicForm_default = DynamicForm;
|
|
|
16155
16148
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16156
16149
|
var import_components22 = require("@transferwise/components");
|
|
16157
16150
|
var import_classnames8 = __toESM(require_classnames());
|
|
16158
|
-
var
|
|
16151
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
16159
16152
|
var DynamicHeading = (props) => {
|
|
16160
16153
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16161
16154
|
const classes = (0, import_classnames8.default)(getTextAlignmentAndMargin({ align, margin }));
|
|
16162
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
16155
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(DisplayHeading, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(StandardHeading, { size, text, classes });
|
|
16163
16156
|
};
|
|
16164
16157
|
var StandardHeading = ({ size, text, classes }) => {
|
|
16165
16158
|
switch (size) {
|
|
16166
16159
|
case "xs":
|
|
16167
|
-
return /* @__PURE__ */ (0,
|
|
16160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h5", { className: classes, children: text });
|
|
16168
16161
|
case "sm":
|
|
16169
|
-
return /* @__PURE__ */ (0,
|
|
16162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h4", { className: classes, children: text });
|
|
16170
16163
|
case "lg":
|
|
16171
|
-
return /* @__PURE__ */ (0,
|
|
16164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { className: classes, children: text });
|
|
16172
16165
|
case "xl":
|
|
16173
|
-
return /* @__PURE__ */ (0,
|
|
16166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h1", { className: classes, children: text });
|
|
16174
16167
|
case "md":
|
|
16175
16168
|
default:
|
|
16176
|
-
return /* @__PURE__ */ (0,
|
|
16169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h3", { className: classes, children: text });
|
|
16177
16170
|
}
|
|
16178
16171
|
};
|
|
16179
16172
|
var DisplayHeading = ({ size, text, classes }) => {
|
|
16180
16173
|
switch (size) {
|
|
16181
16174
|
case "xs":
|
|
16182
16175
|
case "sm":
|
|
16183
|
-
return /* @__PURE__ */ (0,
|
|
16176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components22.Display, { type: "display-small", className: classes, children: text });
|
|
16184
16177
|
case "xl":
|
|
16185
16178
|
case "lg":
|
|
16186
|
-
return /* @__PURE__ */ (0,
|
|
16179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components22.Display, { type: "display-large", className: classes, children: text });
|
|
16187
16180
|
case "md":
|
|
16188
16181
|
default:
|
|
16189
|
-
return /* @__PURE__ */ (0,
|
|
16182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components22.Display, { type: "display-medium", className: classes, children: text });
|
|
16190
16183
|
}
|
|
16191
16184
|
};
|
|
16192
16185
|
var DynamicHeading_default = DynamicHeading;
|
|
16193
16186
|
|
|
16194
16187
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16195
16188
|
var import_components23 = require("@transferwise/components");
|
|
16196
|
-
var
|
|
16189
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
16197
16190
|
var DynamicMarkdown = ({ component }) => {
|
|
16198
16191
|
const { content, align, margin } = component;
|
|
16199
|
-
return /* @__PURE__ */ (0,
|
|
16192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components23.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
16200
16193
|
};
|
|
16201
16194
|
var DynamicInfo = ({ component }) => {
|
|
16202
|
-
return /* @__PURE__ */ (0,
|
|
16195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components23.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
16203
16196
|
};
|
|
16204
16197
|
|
|
16205
16198
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16206
16199
|
var import_components24 = require("@transferwise/components");
|
|
16207
|
-
var
|
|
16208
|
-
var
|
|
16200
|
+
var import_react32 = require("react");
|
|
16201
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
16209
16202
|
function DynamicImage({ component: image }) {
|
|
16210
16203
|
var _a, _b, _c;
|
|
16211
16204
|
const { content, url, size, text, margin, accessibilityDescription } = image;
|
|
16212
16205
|
const httpClient = useHttpClient();
|
|
16213
|
-
const [imageSource, setImageSource] = (0,
|
|
16214
|
-
(0,
|
|
16206
|
+
const [imageSource, setImageSource] = (0, import_react32.useState)("");
|
|
16207
|
+
(0, import_react32.useEffect)(() => {
|
|
16215
16208
|
if (content) {
|
|
16216
16209
|
const { uri, url: contentUrl } = content;
|
|
16217
16210
|
if (uri && !uri.startsWith("urn:")) {
|
|
@@ -16236,7 +16229,7 @@ function DynamicImage({ component: image }) {
|
|
|
16236
16229
|
if (!imageSource) {
|
|
16237
16230
|
return null;
|
|
16238
16231
|
}
|
|
16239
|
-
return /* @__PURE__ */ (0,
|
|
16232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components24.Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
|
|
16240
16233
|
}
|
|
16241
16234
|
var readImageBlobAsDataURL = (imageBlob) => (
|
|
16242
16235
|
// we can safely assume the type of reader.result is string
|
|
@@ -16273,47 +16266,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
16273
16266
|
|
|
16274
16267
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16275
16268
|
var import_components25 = require("@transferwise/components");
|
|
16276
|
-
var
|
|
16269
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
16277
16270
|
var doContext = ["positive", "neutral"];
|
|
16278
16271
|
var dontContext = ["warning", "negative"];
|
|
16279
16272
|
var DynamicInstructions = ({ component }) => {
|
|
16280
16273
|
const { items } = component;
|
|
16281
16274
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
16282
16275
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
16283
|
-
return /* @__PURE__ */ (0,
|
|
16284
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16285
|
-
/* @__PURE__ */ (0,
|
|
16276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
16277
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components25.Header, { title: component.title }) : null,
|
|
16278
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components25.InstructionsList, { dos, donts })
|
|
16286
16279
|
] });
|
|
16287
16280
|
};
|
|
16288
16281
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16289
16282
|
|
|
16290
16283
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16291
|
-
var
|
|
16284
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
16292
16285
|
var getKey = (component) => JSON.stringify(component);
|
|
16293
16286
|
function DynamicLayout(props) {
|
|
16294
16287
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16295
16288
|
const renderComponent = (component) => {
|
|
16296
16289
|
switch (component.type) {
|
|
16297
16290
|
case "heading":
|
|
16298
|
-
return /* @__PURE__ */ (0,
|
|
16291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
16299
16292
|
case "paragraph":
|
|
16300
|
-
return /* @__PURE__ */ (0,
|
|
16293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
16301
16294
|
case "image":
|
|
16302
|
-
return /* @__PURE__ */ (0,
|
|
16295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
16303
16296
|
case "alert":
|
|
16304
|
-
return /* @__PURE__ */ (0,
|
|
16297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicAlert_default, { component, onAction }, getKey(component));
|
|
16305
16298
|
case "review":
|
|
16306
|
-
return /* @__PURE__ */ (0,
|
|
16299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16307
16300
|
case "divider":
|
|
16308
|
-
return /* @__PURE__ */ (0,
|
|
16301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
16309
16302
|
case "info":
|
|
16310
|
-
return /* @__PURE__ */ (0,
|
|
16303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicInfo, { component }, getKey(component));
|
|
16311
16304
|
case "instructions":
|
|
16312
|
-
return /* @__PURE__ */ (0,
|
|
16305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
16313
16306
|
case "markdown":
|
|
16314
|
-
return /* @__PURE__ */ (0,
|
|
16307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
16315
16308
|
case "columns":
|
|
16316
|
-
return /* @__PURE__ */ (0,
|
|
16309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16317
16310
|
DynamicColumns_default,
|
|
16318
16311
|
{
|
|
16319
16312
|
component,
|
|
@@ -16327,7 +16320,7 @@ function DynamicLayout(props) {
|
|
|
16327
16320
|
getKey(component)
|
|
16328
16321
|
);
|
|
16329
16322
|
case "form":
|
|
16330
|
-
return /* @__PURE__ */ (0,
|
|
16323
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16331
16324
|
DynamicForm_default,
|
|
16332
16325
|
{
|
|
16333
16326
|
component,
|
|
@@ -16340,9 +16333,9 @@ function DynamicLayout(props) {
|
|
|
16340
16333
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16341
16334
|
);
|
|
16342
16335
|
case "button":
|
|
16343
|
-
return /* @__PURE__ */ (0,
|
|
16336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16344
16337
|
case "box":
|
|
16345
|
-
return /* @__PURE__ */ (0,
|
|
16338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16346
16339
|
DynamicBox_default,
|
|
16347
16340
|
{
|
|
16348
16341
|
component,
|
|
@@ -16356,18 +16349,18 @@ function DynamicLayout(props) {
|
|
|
16356
16349
|
getKey(component)
|
|
16357
16350
|
);
|
|
16358
16351
|
case "decision":
|
|
16359
|
-
return /* @__PURE__ */ (0,
|
|
16352
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16360
16353
|
case "external":
|
|
16361
|
-
return /* @__PURE__ */ (0,
|
|
16354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16362
16355
|
case "list":
|
|
16363
16356
|
case "status-list":
|
|
16364
|
-
return /* @__PURE__ */ (0,
|
|
16357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16365
16358
|
case "loading-indicator":
|
|
16366
|
-
return /* @__PURE__ */ (0,
|
|
16359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16367
16360
|
case "search":
|
|
16368
|
-
return /* @__PURE__ */ (0,
|
|
16361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16369
16362
|
case "modal":
|
|
16370
|
-
return /* @__PURE__ */ (0,
|
|
16363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
16371
16364
|
DynamicModal_default,
|
|
16372
16365
|
{
|
|
16373
16366
|
component,
|
|
@@ -16381,22 +16374,22 @@ function DynamicLayout(props) {
|
|
|
16381
16374
|
getKey(component)
|
|
16382
16375
|
);
|
|
16383
16376
|
default:
|
|
16384
|
-
return /* @__PURE__ */ (0,
|
|
16377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", {}, getKey(component));
|
|
16385
16378
|
}
|
|
16386
16379
|
};
|
|
16387
16380
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16388
|
-
return /* @__PURE__ */ (0,
|
|
16381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_jsx_runtime54.Fragment, { children: components.map(renderComponent) });
|
|
16389
16382
|
}
|
|
16390
|
-
return /* @__PURE__ */ (0,
|
|
16383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16391
16384
|
}
|
|
16392
16385
|
var DynamicLayout_default = DynamicLayout;
|
|
16393
16386
|
|
|
16394
16387
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16395
16388
|
var import_components26 = require("@transferwise/components");
|
|
16396
|
-
var
|
|
16389
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
16397
16390
|
var DynamicStatusList = ({ component, onAction }) => {
|
|
16398
|
-
return /* @__PURE__ */ (0,
|
|
16399
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
16392
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components26.Header, { title: component.title, className: "m-b-2" }) : null,
|
|
16400
16393
|
component.items.map((item) => mapListItemToSummary(item, onAction))
|
|
16401
16394
|
] });
|
|
16402
16395
|
};
|
|
@@ -16406,8 +16399,8 @@ var mapListItemToSummary = (props, onAction) => {
|
|
|
16406
16399
|
title,
|
|
16407
16400
|
description,
|
|
16408
16401
|
action: "callToAction" in props ? callToActionToSummaryAction(props == null ? void 0 : props.callToAction, onAction) : void 0
|
|
16409
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
16410
|
-
return /* @__PURE__ */ (0,
|
|
16402
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
16403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components26.Summary, __spreadValues({}, summaryProps), `${title}/${description || ""}`);
|
|
16411
16404
|
};
|
|
16412
16405
|
var callToActionToSummaryAction = (callToAction, onAction) => {
|
|
16413
16406
|
if (!callToAction) {
|
|
@@ -16477,10 +16470,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
16477
16470
|
|
|
16478
16471
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16479
16472
|
var import_components27 = require("@transferwise/components");
|
|
16480
|
-
var
|
|
16473
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
16481
16474
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16482
16475
|
const { margin = "md", size = "md" } = component;
|
|
16483
|
-
return /* @__PURE__ */ (0,
|
|
16476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
16484
16477
|
import_components27.Loader,
|
|
16485
16478
|
{
|
|
16486
16479
|
size,
|
|
@@ -16514,21 +16507,21 @@ var paragraph_messages_default = (0, import_react_intl24.defineMessages)({
|
|
|
16514
16507
|
|
|
16515
16508
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16516
16509
|
var import_components28 = require("@transferwise/components");
|
|
16517
|
-
var
|
|
16510
|
+
var import_react33 = require("react");
|
|
16518
16511
|
function useSnackBarIfAvailable() {
|
|
16519
|
-
const context = (0,
|
|
16512
|
+
const context = (0, import_react33.useContext)(import_components28.SnackbarContext);
|
|
16520
16513
|
return context ? context.createSnackbar : noop3;
|
|
16521
16514
|
}
|
|
16522
16515
|
function noop3() {
|
|
16523
16516
|
}
|
|
16524
16517
|
|
|
16525
16518
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16526
|
-
var
|
|
16519
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
16527
16520
|
function DynamicParagraph({ component }) {
|
|
16528
|
-
return component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
16521
|
+
return component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BasicDynamicParagraph, { component });
|
|
16529
16522
|
}
|
|
16530
16523
|
function BasicDynamicParagraph({ component }) {
|
|
16531
|
-
return /* @__PURE__ */ (0,
|
|
16524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: `np-text-body-large ${getTextAlignmentAndMargin(component)}`, children: component.text });
|
|
16532
16525
|
}
|
|
16533
16526
|
function CopyableDynamicParagraph({ component }) {
|
|
16534
16527
|
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
@@ -16542,8 +16535,8 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16542
16535
|
align: component.align,
|
|
16543
16536
|
margin: "sm"
|
|
16544
16537
|
})} form-control`;
|
|
16545
|
-
return /* @__PURE__ */ (0,
|
|
16546
|
-
/* @__PURE__ */ (0,
|
|
16538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
16539
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
16547
16540
|
"input",
|
|
16548
16541
|
{
|
|
16549
16542
|
type: "text",
|
|
@@ -16553,7 +16546,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16553
16546
|
style: { textOverflow: "ellipsis" }
|
|
16554
16547
|
}
|
|
16555
16548
|
),
|
|
16556
|
-
/* @__PURE__ */ (0,
|
|
16549
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components29.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16557
16550
|
] });
|
|
16558
16551
|
}
|
|
16559
16552
|
function noop4() {
|
|
@@ -16562,7 +16555,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
16562
16555
|
|
|
16563
16556
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16564
16557
|
var import_components30 = require("@transferwise/components");
|
|
16565
|
-
var
|
|
16558
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
16566
16559
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16567
16560
|
key: String(index),
|
|
16568
16561
|
title: label,
|
|
@@ -16570,14 +16563,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16570
16563
|
}));
|
|
16571
16564
|
var getFieldValue = (value, help, orientation) => {
|
|
16572
16565
|
if (help) {
|
|
16573
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
16574
|
-
/* @__PURE__ */ (0,
|
|
16566
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
16567
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Help_default, { help }),
|
|
16575
16568
|
" ",
|
|
16576
16569
|
value
|
|
16577
|
-
] }) : /* @__PURE__ */ (0,
|
|
16570
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
16578
16571
|
value,
|
|
16579
16572
|
" ",
|
|
16580
|
-
/* @__PURE__ */ (0,
|
|
16573
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Help_default, { help })
|
|
16581
16574
|
] });
|
|
16582
16575
|
}
|
|
16583
16576
|
return value;
|
|
@@ -16651,24 +16644,24 @@ function DynamicReview({ component: review, onAction }) {
|
|
|
16651
16644
|
const orientation = getDefinitionListLayout(review);
|
|
16652
16645
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction) : null;
|
|
16653
16646
|
const legacyCallToAction = !callToAction && review.action ? { text: (_a = review.action.title) != null ? _a : "", onClick: getOnClick2(review.action) } : null;
|
|
16654
|
-
return /* @__PURE__ */ (0,
|
|
16655
|
-
review.title && /* @__PURE__ */ (0,
|
|
16656
|
-
/* @__PURE__ */ (0,
|
|
16647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: margin, children: [
|
|
16648
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components30.Header, { title: review.title, action: (_b = callToAction != null ? callToAction : legacyCallToAction) != null ? _b : void 0 }),
|
|
16649
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components30.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
16657
16650
|
] });
|
|
16658
16651
|
}
|
|
16659
16652
|
var DynamicReview_default = DynamicReview;
|
|
16660
16653
|
|
|
16661
16654
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16662
|
-
var
|
|
16655
|
+
var import_react35 = require("react");
|
|
16663
16656
|
var import_icons2 = require("@transferwise/icons");
|
|
16664
16657
|
|
|
16665
16658
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16666
16659
|
var import_components31 = require("@transferwise/components");
|
|
16667
|
-
var
|
|
16660
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
16668
16661
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16669
|
-
return /* @__PURE__ */ (0,
|
|
16662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16670
16663
|
title,
|
|
16671
|
-
/* @__PURE__ */ (0,
|
|
16664
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
16672
16665
|
import_components31.Input,
|
|
16673
16666
|
{
|
|
16674
16667
|
type: "text",
|
|
@@ -16684,12 +16677,12 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16684
16677
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16685
16678
|
var import_components32 = require("@transferwise/components");
|
|
16686
16679
|
var import_react_intl26 = require("react-intl");
|
|
16687
|
-
var
|
|
16680
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
16688
16681
|
function SearchResults({ results, emptyMessage, onSelect }) {
|
|
16689
16682
|
if (results.length === 0) {
|
|
16690
|
-
return /* @__PURE__ */ (0,
|
|
16683
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
16691
16684
|
}
|
|
16692
|
-
return /* @__PURE__ */ (0,
|
|
16685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components32.NavigationOptionsList, { children: results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
16693
16686
|
import_components32.NavigationOption,
|
|
16694
16687
|
{
|
|
16695
16688
|
title: result.title,
|
|
@@ -16704,10 +16697,10 @@ function SearchResults({ results, emptyMessage, onSelect }) {
|
|
|
16704
16697
|
}
|
|
16705
16698
|
function ErrorResult({ onRetrySearch }) {
|
|
16706
16699
|
const intl = (0, import_react_intl26.useIntl)();
|
|
16707
|
-
return /* @__PURE__ */ (0,
|
|
16700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("p", { className: "m-t-2", children: [
|
|
16708
16701
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16709
16702
|
"\xA0",
|
|
16710
|
-
/* @__PURE__ */ (0,
|
|
16703
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
16711
16704
|
"a",
|
|
16712
16705
|
{
|
|
16713
16706
|
href: "/",
|
|
@@ -16722,15 +16715,15 @@ function ErrorResult({ onRetrySearch }) {
|
|
|
16722
16715
|
}
|
|
16723
16716
|
|
|
16724
16717
|
// src/legacy/layout/search/useSearch.tsx
|
|
16725
|
-
var
|
|
16718
|
+
var import_react34 = require("react");
|
|
16726
16719
|
var headers = { "Content-Type": "application/json" };
|
|
16727
16720
|
var useSearch = (defaultSearchConfig) => {
|
|
16728
|
-
const [state, setState] = (0,
|
|
16721
|
+
const [state, setState] = (0, import_react34.useState)({
|
|
16729
16722
|
status: "idle"
|
|
16730
16723
|
});
|
|
16731
|
-
const abortControllerRef = (0,
|
|
16724
|
+
const abortControllerRef = (0, import_react34.useRef)(null);
|
|
16732
16725
|
const httpClient = useHttpClient();
|
|
16733
|
-
const search = (0,
|
|
16726
|
+
const search = (0, import_react34.useCallback)(
|
|
16734
16727
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
16735
16728
|
var _a;
|
|
16736
16729
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -16806,15 +16799,15 @@ var search_messages_default = (0, import_react_intl27.defineMessages)({
|
|
|
16806
16799
|
});
|
|
16807
16800
|
|
|
16808
16801
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16809
|
-
var
|
|
16802
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
16810
16803
|
var DEBOUNCE_TIME2 = 400;
|
|
16811
16804
|
function DynamicSearch({ component, onAction }) {
|
|
16812
|
-
const [query, setQuery] = (0,
|
|
16805
|
+
const [query, setQuery] = (0, import_react35.useState)("");
|
|
16813
16806
|
const intl = (0, import_react_intl28.useIntl)();
|
|
16814
16807
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
16815
16808
|
const { status, results, search } = useSearch({ url, method, param });
|
|
16816
16809
|
const onEvent = useEventDispatcher();
|
|
16817
|
-
const debouncedSearch = (0,
|
|
16810
|
+
const debouncedSearch = (0, import_react35.useMemo)(() => debounce2(search, DEBOUNCE_TIME2), [search]);
|
|
16818
16811
|
const onSearchStart = () => {
|
|
16819
16812
|
onEvent("Dynamic Flow - Search Started", {});
|
|
16820
16813
|
};
|
|
@@ -16844,9 +16837,9 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16844
16837
|
};
|
|
16845
16838
|
const loadingMessage = intl.formatMessage(search_messages_default.loading);
|
|
16846
16839
|
if (control === "inline") {
|
|
16847
|
-
return /* @__PURE__ */ (0,
|
|
16840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: (0, import_classnames9.default)(getMargin(margin != null ? margin : "md"), "df-search-typeahead"), children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16848
16841
|
title,
|
|
16849
|
-
/* @__PURE__ */ (0,
|
|
16842
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "m-t-1", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
16850
16843
|
import_components33.Typeahead,
|
|
16851
16844
|
{
|
|
16852
16845
|
id: "typeahead-input-id",
|
|
@@ -16854,7 +16847,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16854
16847
|
name: "typeahead-input-name",
|
|
16855
16848
|
size: "md",
|
|
16856
16849
|
maxHeight: 100,
|
|
16857
|
-
footer: /* @__PURE__ */ (0,
|
|
16850
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
16858
16851
|
TypeaheadFooter,
|
|
16859
16852
|
{
|
|
16860
16853
|
state: status,
|
|
@@ -16866,7 +16859,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16866
16859
|
),
|
|
16867
16860
|
multiple: false,
|
|
16868
16861
|
clearable: false,
|
|
16869
|
-
addon: /* @__PURE__ */ (0,
|
|
16862
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_icons2.Search, { size: 24 }),
|
|
16870
16863
|
options: results.map(mapResultToTypeaheadOption),
|
|
16871
16864
|
onChange: (values) => {
|
|
16872
16865
|
if (values.length > 0) {
|
|
@@ -16881,11 +16874,11 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16881
16874
|
) })
|
|
16882
16875
|
] }) });
|
|
16883
16876
|
}
|
|
16884
|
-
return /* @__PURE__ */ (0,
|
|
16885
|
-
/* @__PURE__ */ (0,
|
|
16886
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
16887
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
16888
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
16877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: getMargin(margin != null ? margin : "md"), children: [
|
|
16878
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
16879
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
16880
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ErrorResult, { onRetrySearch }),
|
|
16881
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
16889
16882
|
] });
|
|
16890
16883
|
}
|
|
16891
16884
|
function mapResultToTypeaheadOption(result) {
|
|
@@ -16905,13 +16898,13 @@ function TypeaheadFooter({
|
|
|
16905
16898
|
onRetrySearch
|
|
16906
16899
|
}) {
|
|
16907
16900
|
if (state === "success" && results.length === 0) {
|
|
16908
|
-
return /* @__PURE__ */ (0,
|
|
16901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components33.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: emptyMessage });
|
|
16909
16902
|
}
|
|
16910
16903
|
if (state === "error" && results.length === 0) {
|
|
16911
|
-
return /* @__PURE__ */ (0,
|
|
16904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ErrorResult, { onRetrySearch }) });
|
|
16912
16905
|
}
|
|
16913
16906
|
if (state === "loading" || results.length === 0) {
|
|
16914
|
-
return /* @__PURE__ */ (0,
|
|
16907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "m-t-2 m-x-2", children: loadingMessage });
|
|
16915
16908
|
}
|
|
16916
16909
|
return null;
|
|
16917
16910
|
}
|
|
@@ -16919,22 +16912,22 @@ var DynamicSearch_default = DynamicSearch;
|
|
|
16919
16912
|
|
|
16920
16913
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
16921
16914
|
var import_components34 = require("@transferwise/components");
|
|
16922
|
-
var
|
|
16923
|
-
var
|
|
16915
|
+
var import_react36 = require("react");
|
|
16916
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
16924
16917
|
function DynamicModal(props) {
|
|
16925
|
-
const [visible, isVisible] = (0,
|
|
16918
|
+
const [visible, isVisible] = (0, import_react36.useState)(false);
|
|
16926
16919
|
const { component, onAction } = props;
|
|
16927
16920
|
const { margin = "md" } = component;
|
|
16928
|
-
return /* @__PURE__ */ (0,
|
|
16929
|
-
/* @__PURE__ */ (0,
|
|
16930
|
-
/* @__PURE__ */ (0,
|
|
16921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: getTextAlignmentAndMargin({ margin }), children: [
|
|
16922
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components34.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
16923
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
16931
16924
|
import_components34.Modal,
|
|
16932
16925
|
{
|
|
16933
16926
|
scroll: "content",
|
|
16934
16927
|
open: visible,
|
|
16935
16928
|
size: "lg",
|
|
16936
16929
|
title: component.content.title,
|
|
16937
|
-
body: /* @__PURE__ */ (0,
|
|
16930
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
16938
16931
|
DynamicLayout_default,
|
|
16939
16932
|
__spreadProps(__spreadValues({}, props), {
|
|
16940
16933
|
components: component.content.components,
|
|
@@ -16952,7 +16945,7 @@ function DynamicModal(props) {
|
|
|
16952
16945
|
var DynamicModal_default = DynamicModal;
|
|
16953
16946
|
|
|
16954
16947
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
16955
|
-
var
|
|
16948
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
16956
16949
|
var isNullish2 = (value) => isNull2(value) || isUndefined2(value);
|
|
16957
16950
|
var getDefaultValue = (schema) => {
|
|
16958
16951
|
return schema.type === "boolean" && isNullish2(schema.default) ? false : schema.default;
|
|
@@ -16991,13 +16984,13 @@ var BasicTypeSchema = (props) => {
|
|
|
16991
16984
|
props.onBlur();
|
|
16992
16985
|
}
|
|
16993
16986
|
};
|
|
16994
|
-
const [model, setModel] = (0,
|
|
16995
|
-
const [lastModel, setLastModel] = (0,
|
|
16996
|
-
const [changed, setChanged] = (0,
|
|
16997
|
-
const [focused, setFocused] = (0,
|
|
16998
|
-
const [blurred, setBlurred] = (0,
|
|
16999
|
-
const [validations, setValidations] = (0,
|
|
17000
|
-
const id = (0,
|
|
16987
|
+
const [model, setModel] = (0, import_react37.useState)((_a = props.model) != null ? _a : null);
|
|
16988
|
+
const [lastModel, setLastModel] = (0, import_react37.useState)((_b = props.model) != null ? _b : null);
|
|
16989
|
+
const [changed, setChanged] = (0, import_react37.useState)(false);
|
|
16990
|
+
const [focused, setFocused] = (0, import_react37.useState)(false);
|
|
16991
|
+
const [blurred, setBlurred] = (0, import_react37.useState)(false);
|
|
16992
|
+
const [validations, setValidations] = (0, import_react37.useState)([]);
|
|
16993
|
+
const id = (0, import_react37.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
17001
16994
|
const onSchemaChange = () => {
|
|
17002
16995
|
const defaultValue = getDefaultValue(props.schema);
|
|
17003
16996
|
if (isNullish2(model) && !isNullish2(defaultValue)) {
|
|
@@ -17012,9 +17005,9 @@ var BasicTypeSchema = (props) => {
|
|
|
17012
17005
|
};
|
|
17013
17006
|
const isConst = props.schema.const;
|
|
17014
17007
|
const isHidden = props.schema.hidden || isConst;
|
|
17015
|
-
(0,
|
|
17016
|
-
(0,
|
|
17017
|
-
(0,
|
|
17008
|
+
(0, import_react37.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
17009
|
+
(0, import_react37.useEffect)(onSchemaChange, [props.schema]);
|
|
17010
|
+
(0, import_react37.useEffect)(() => {
|
|
17018
17011
|
var _a2;
|
|
17019
17012
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
17020
17013
|
if (newModel !== model) {
|
|
@@ -17030,15 +17023,15 @@ var BasicTypeSchema = (props) => {
|
|
|
17030
17023
|
const schemaHelp = props.schema.help;
|
|
17031
17024
|
const feedbackId = `${id}-feedback`;
|
|
17032
17025
|
const labelId = `${id}-label`;
|
|
17033
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
17034
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
17035
|
-
/* @__PURE__ */ (0,
|
|
17036
|
-
showLabel && /* @__PURE__ */ (0,
|
|
17037
|
-
/* @__PURE__ */ (0,
|
|
17038
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
17026
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
17027
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
17028
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: (0, import_classnames10.default)(formGroupClasses), children: [
|
|
17029
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
17030
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("label", { className: "control-label d-inline", htmlFor: id, id: labelId, children: props.schema.title }),
|
|
17031
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Help_default, { help: schemaHelp })
|
|
17039
17032
|
] }),
|
|
17040
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
17041
|
-
/* @__PURE__ */ (0,
|
|
17033
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Help_default, { help: schemaHelp }),
|
|
17034
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
17042
17035
|
SchemaFormControl_default,
|
|
17043
17036
|
{
|
|
17044
17037
|
id,
|
|
@@ -17052,7 +17045,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17052
17045
|
labelledBy: labelId
|
|
17053
17046
|
}
|
|
17054
17047
|
),
|
|
17055
|
-
/* @__PURE__ */ (0,
|
|
17048
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
17056
17049
|
ControlFeedback_default,
|
|
17057
17050
|
{
|
|
17058
17051
|
id: feedbackId,
|
|
@@ -17072,7 +17065,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17072
17065
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17073
17066
|
|
|
17074
17067
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17075
|
-
var
|
|
17068
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
17076
17069
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17077
17070
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17078
17071
|
var _a;
|
|
@@ -17090,12 +17083,12 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17090
17083
|
const intl = (0, import_react_intl29.useIntl)();
|
|
17091
17084
|
const httpClient = useHttpClient();
|
|
17092
17085
|
const onEvent = useEventDispatcher();
|
|
17093
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
17086
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react38.useState)(null);
|
|
17094
17087
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17095
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
17096
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
17097
|
-
const [abortController, setAbortController] = (0,
|
|
17098
|
-
(0,
|
|
17088
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react38.useState)(null);
|
|
17089
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react38.useState)(false);
|
|
17090
|
+
const [abortController, setAbortController] = (0, import_react38.useState)(null);
|
|
17091
|
+
(0, import_react38.useEffect)(() => {
|
|
17099
17092
|
if (controlTypesWithPersistOnChange.has(
|
|
17100
17093
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
17101
17094
|
getControlType(schema.persistAsync.schema)
|
|
@@ -17162,7 +17155,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17162
17155
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17163
17156
|
}
|
|
17164
17157
|
};
|
|
17165
|
-
return /* @__PURE__ */ (0,
|
|
17158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
17166
17159
|
BasicTypeSchema_default,
|
|
17167
17160
|
{
|
|
17168
17161
|
required,
|
|
@@ -17180,7 +17173,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17180
17173
|
|
|
17181
17174
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17182
17175
|
var usePersistAsync = (persistAsync) => {
|
|
17183
|
-
const [abortController, setAbortController] = (0,
|
|
17176
|
+
const [abortController, setAbortController] = (0, import_react39.useState)(null);
|
|
17184
17177
|
const httpClient = useHttpClient();
|
|
17185
17178
|
const intl = (0, import_react_intl30.useIntl)();
|
|
17186
17179
|
const { schema } = persistAsync;
|
|
@@ -17257,7 +17250,7 @@ function hasStringMessage(value) {
|
|
|
17257
17250
|
}
|
|
17258
17251
|
|
|
17259
17252
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
17260
|
-
var
|
|
17253
|
+
var import_react40 = require("react");
|
|
17261
17254
|
function usePolling({
|
|
17262
17255
|
asyncFn,
|
|
17263
17256
|
delay,
|
|
@@ -17266,9 +17259,9 @@ function usePolling({
|
|
|
17266
17259
|
onPollingResponse,
|
|
17267
17260
|
onFailure
|
|
17268
17261
|
}) {
|
|
17269
|
-
const onPollingResponseReference = (0,
|
|
17270
|
-
const onFailureReference = (0,
|
|
17271
|
-
const poll = (0,
|
|
17262
|
+
const onPollingResponseReference = (0, import_react40.useRef)(onPollingResponse);
|
|
17263
|
+
const onFailureReference = (0, import_react40.useRef)(onFailure);
|
|
17264
|
+
const poll = (0, import_react40.useMemo)(
|
|
17272
17265
|
() => createPollingClosure(
|
|
17273
17266
|
asyncFn,
|
|
17274
17267
|
maxAttempts,
|
|
@@ -17278,7 +17271,7 @@ function usePolling({
|
|
|
17278
17271
|
),
|
|
17279
17272
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
17280
17273
|
);
|
|
17281
|
-
(0,
|
|
17274
|
+
(0, import_react40.useEffect)(() => {
|
|
17282
17275
|
if (delay > 0) {
|
|
17283
17276
|
poll();
|
|
17284
17277
|
const intervalReference = setInterval(() => {
|
|
@@ -17287,7 +17280,7 @@ function usePolling({
|
|
|
17287
17280
|
return () => clearInterval(intervalReference);
|
|
17288
17281
|
}
|
|
17289
17282
|
}, [poll, delay]);
|
|
17290
|
-
(0,
|
|
17283
|
+
(0, import_react40.useEffect)(() => {
|
|
17291
17284
|
onPollingResponseReference.current = onPollingResponse;
|
|
17292
17285
|
onFailureReference.current = onFailure;
|
|
17293
17286
|
}, [onPollingResponse, onFailure]);
|
|
@@ -17318,22 +17311,22 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
17318
17311
|
}
|
|
17319
17312
|
|
|
17320
17313
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
17321
|
-
var
|
|
17314
|
+
var import_react41 = require("react");
|
|
17322
17315
|
var usePrevious = (value) => {
|
|
17323
|
-
const reference = (0,
|
|
17324
|
-
(0,
|
|
17316
|
+
const reference = (0, import_react41.useRef)();
|
|
17317
|
+
(0, import_react41.useEffect)(() => {
|
|
17325
17318
|
reference.current = value;
|
|
17326
17319
|
}, [value]);
|
|
17327
17320
|
return reference.current;
|
|
17328
17321
|
};
|
|
17329
17322
|
|
|
17330
17323
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
17331
|
-
var
|
|
17324
|
+
var import_react42 = require("react");
|
|
17332
17325
|
function useStepPolling(polling, onAction) {
|
|
17333
17326
|
var _a, _b;
|
|
17334
17327
|
const httpClient = useHttpClient();
|
|
17335
17328
|
const onEvent = useEventDispatcher();
|
|
17336
|
-
const asyncFn = (0,
|
|
17329
|
+
const asyncFn = (0, import_react42.useMemo)(() => {
|
|
17337
17330
|
if (polling) {
|
|
17338
17331
|
return () => httpClient(polling.url).then((response) => {
|
|
17339
17332
|
if (response.ok) {
|
|
@@ -17351,7 +17344,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17351
17344
|
}
|
|
17352
17345
|
return void 0;
|
|
17353
17346
|
}, [polling, httpClient]);
|
|
17354
|
-
const onPollingResponse = (0,
|
|
17347
|
+
const onPollingResponse = (0, import_react42.useCallback)(
|
|
17355
17348
|
(pollingResponse) => {
|
|
17356
17349
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
17357
17350
|
onAction(pollingResponse.action);
|
|
@@ -17367,7 +17360,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17367
17360
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
17368
17361
|
maxConsecutiveFails: 1,
|
|
17369
17362
|
onPollingResponse,
|
|
17370
|
-
onFailure: (0,
|
|
17363
|
+
onFailure: (0, import_react42.useCallback)(() => {
|
|
17371
17364
|
if (polling) {
|
|
17372
17365
|
onAction(polling.onError.action);
|
|
17373
17366
|
}
|
|
@@ -17376,7 +17369,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17376
17369
|
}
|
|
17377
17370
|
|
|
17378
17371
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17379
|
-
var
|
|
17372
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
17380
17373
|
var getComponents = (step, options) => {
|
|
17381
17374
|
var _a;
|
|
17382
17375
|
if (isEmpty(step)) {
|
|
@@ -17399,7 +17392,7 @@ var LayoutStep = (props) => {
|
|
|
17399
17392
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17400
17393
|
};
|
|
17401
17394
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17402
|
-
return /* @__PURE__ */ (0,
|
|
17395
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
17403
17396
|
DynamicLayout_default,
|
|
17404
17397
|
{
|
|
17405
17398
|
components,
|
|
@@ -17415,10 +17408,10 @@ var LayoutStep = (props) => {
|
|
|
17415
17408
|
var LayoutStep_default = LayoutStep;
|
|
17416
17409
|
|
|
17417
17410
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17418
|
-
var
|
|
17411
|
+
var import_react47 = require("react");
|
|
17419
17412
|
|
|
17420
17413
|
// src/common/cameraCapture/CameraCapture.tsx
|
|
17421
|
-
var
|
|
17414
|
+
var import_react46 = require("react");
|
|
17422
17415
|
var import_react_intl35 = require("react-intl");
|
|
17423
17416
|
var import_react_webcam = __toESM(require("react-webcam"));
|
|
17424
17417
|
|
|
@@ -17485,15 +17478,15 @@ var CameraCapture_messages_default = (0, import_react_intl31.defineMessages)({
|
|
|
17485
17478
|
// src/common/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17486
17479
|
var import_components35 = require("@transferwise/components");
|
|
17487
17480
|
var import_react_intl32 = require("react-intl");
|
|
17488
|
-
var
|
|
17489
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
17481
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
17482
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
17490
17483
|
var ReviewBottomBar = ({
|
|
17491
17484
|
onSubmit,
|
|
17492
17485
|
onRetry
|
|
17493
17486
|
}) => {
|
|
17494
17487
|
const intl = (0, import_react_intl32.useIntl)();
|
|
17495
|
-
return /* @__PURE__ */ (0,
|
|
17496
|
-
/* @__PURE__ */ (0,
|
|
17488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
17489
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17497
17490
|
import_components35.Button,
|
|
17498
17491
|
{
|
|
17499
17492
|
className: "m-b-1",
|
|
@@ -17504,7 +17497,7 @@ var ReviewBottomBar = ({
|
|
|
17504
17497
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17505
17498
|
}
|
|
17506
17499
|
),
|
|
17507
|
-
/* @__PURE__ */ (0,
|
|
17500
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17508
17501
|
import_components35.Button,
|
|
17509
17502
|
{
|
|
17510
17503
|
className: "m-b-2",
|
|
@@ -17518,14 +17511,14 @@ var ReviewBottomBar = ({
|
|
|
17518
17511
|
)
|
|
17519
17512
|
] }) }) });
|
|
17520
17513
|
};
|
|
17521
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
17514
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
17522
17515
|
"button",
|
|
17523
17516
|
{
|
|
17524
17517
|
type: "button",
|
|
17525
17518
|
className: "camera-capture-btn m-b-2",
|
|
17526
17519
|
"data-testid": "camera-capture-button",
|
|
17527
17520
|
onClick,
|
|
17528
|
-
children: /* @__PURE__ */ (0,
|
|
17521
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
17529
17522
|
}
|
|
17530
17523
|
);
|
|
17531
17524
|
|
|
@@ -17543,11 +17536,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl33.defineMess
|
|
|
17543
17536
|
});
|
|
17544
17537
|
|
|
17545
17538
|
// src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17546
|
-
var
|
|
17539
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
17547
17540
|
function OrientationLockOverlay() {
|
|
17548
17541
|
const intl = (0, import_react_intl34.useIntl)();
|
|
17549
|
-
return /* @__PURE__ */ (0,
|
|
17550
|
-
/* @__PURE__ */ (0,
|
|
17542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
17543
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
17551
17544
|
"img",
|
|
17552
17545
|
{
|
|
17553
17546
|
className: "m-b-3",
|
|
@@ -17557,13 +17550,13 @@ function OrientationLockOverlay() {
|
|
|
17557
17550
|
alt: ""
|
|
17558
17551
|
}
|
|
17559
17552
|
),
|
|
17560
|
-
/* @__PURE__ */ (0,
|
|
17553
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17561
17554
|
] });
|
|
17562
17555
|
}
|
|
17563
17556
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17564
17557
|
|
|
17565
17558
|
// src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17566
|
-
var
|
|
17559
|
+
var import_react43 = require("react");
|
|
17567
17560
|
var import_screenfull = __toESM(require_screenfull());
|
|
17568
17561
|
|
|
17569
17562
|
// src/common/cameraCapture/utils/index.ts
|
|
@@ -17642,7 +17635,7 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17642
17635
|
|
|
17643
17636
|
// src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17644
17637
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17645
|
-
const lockOrientation = (0,
|
|
17638
|
+
const lockOrientation = (0, import_react43.useCallback)(() => {
|
|
17646
17639
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17647
17640
|
const lockPromise = window.screen.orientation.lock("portrait");
|
|
17648
17641
|
if (lockPromise instanceof Promise) {
|
|
@@ -17650,11 +17643,11 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17650
17643
|
}
|
|
17651
17644
|
}
|
|
17652
17645
|
}, [onEvent]);
|
|
17653
|
-
const unlockOrientation = (0,
|
|
17646
|
+
const unlockOrientation = (0, import_react43.useCallback)(() => {
|
|
17654
17647
|
var _a, _b, _c;
|
|
17655
17648
|
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);
|
|
17656
17649
|
}, []);
|
|
17657
|
-
const enterFullScreen = (0,
|
|
17650
|
+
const enterFullScreen = (0, import_react43.useCallback)(() => {
|
|
17658
17651
|
setTimeout(() => {
|
|
17659
17652
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
17660
17653
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -17663,13 +17656,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17663
17656
|
}
|
|
17664
17657
|
}, 100);
|
|
17665
17658
|
}, [shouldLockOrientation, lockOrientation]);
|
|
17666
|
-
const exitFullScreen = (0,
|
|
17659
|
+
const exitFullScreen = (0, import_react43.useCallback)(() => {
|
|
17667
17660
|
if (import_screenfull.default.isFullscreen) {
|
|
17668
17661
|
import_screenfull.default.exit().catch(noop5);
|
|
17669
17662
|
}
|
|
17670
17663
|
unlockOrientation();
|
|
17671
17664
|
}, [unlockOrientation]);
|
|
17672
|
-
const handleOrientationChange = (0,
|
|
17665
|
+
const handleOrientationChange = (0, import_react43.useCallback)(
|
|
17673
17666
|
(event) => {
|
|
17674
17667
|
var _a, _b;
|
|
17675
17668
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -17680,7 +17673,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17680
17673
|
},
|
|
17681
17674
|
[onEvent]
|
|
17682
17675
|
);
|
|
17683
|
-
(0,
|
|
17676
|
+
(0, import_react43.useEffect)(() => {
|
|
17684
17677
|
var _a, _b;
|
|
17685
17678
|
if (shouldLockOrientation) {
|
|
17686
17679
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -17703,10 +17696,10 @@ var noop5 = () => {
|
|
|
17703
17696
|
};
|
|
17704
17697
|
|
|
17705
17698
|
// src/common/cameraCapture/hooks/useVideoConstraints.ts
|
|
17706
|
-
var
|
|
17699
|
+
var import_react44 = require("react");
|
|
17707
17700
|
var useVideoConstraints = (direction) => {
|
|
17708
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
17709
|
-
(0,
|
|
17701
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react44.useState)();
|
|
17702
|
+
(0, import_react44.useEffect)(() => {
|
|
17710
17703
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
17711
17704
|
}, [direction]);
|
|
17712
17705
|
return { videoConstraints };
|
|
@@ -17731,8 +17724,8 @@ var getVideoConstraints = async (dir) => {
|
|
|
17731
17724
|
};
|
|
17732
17725
|
|
|
17733
17726
|
// src/common/cameraCapture/overlay/Overlay.tsx
|
|
17734
|
-
var
|
|
17735
|
-
var
|
|
17727
|
+
var import_react45 = require("react");
|
|
17728
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
17736
17729
|
var captureButtonHeight = 92;
|
|
17737
17730
|
var reviewButtonsHeight = 120;
|
|
17738
17731
|
var imageHeight = 40;
|
|
@@ -17741,8 +17734,8 @@ var instructionsHeight = 48;
|
|
|
17741
17734
|
var reviewInstructionsHeight = 40;
|
|
17742
17735
|
var overlayMaxWidth = 800;
|
|
17743
17736
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
17744
|
-
const svgReference = (0,
|
|
17745
|
-
(0,
|
|
17737
|
+
const svgReference = (0, import_react45.useRef)(null);
|
|
17738
|
+
(0, import_react45.useEffect)(() => {
|
|
17746
17739
|
const listener = debounce2(() => {
|
|
17747
17740
|
var _a;
|
|
17748
17741
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -17754,18 +17747,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17754
17747
|
return () => window.removeEventListener("resize", listener);
|
|
17755
17748
|
});
|
|
17756
17749
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17757
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
17758
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
17759
|
-
title && /* @__PURE__ */ (0,
|
|
17760
|
-
instructions && /* @__PURE__ */ (0,
|
|
17750
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
17751
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
17752
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
17753
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
17761
17754
|
] });
|
|
17762
17755
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17763
17756
|
if (reviewInstructions) {
|
|
17764
17757
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17765
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17758
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17766
17759
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17767
17760
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17768
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17761
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_jsx_runtime68.Fragment, {});
|
|
17769
17762
|
}
|
|
17770
17763
|
}
|
|
17771
17764
|
const framePosition = {
|
|
@@ -17783,32 +17776,32 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17783
17776
|
width: "90%"
|
|
17784
17777
|
}
|
|
17785
17778
|
};
|
|
17786
|
-
return /* @__PURE__ */ (0,
|
|
17787
|
-
/* @__PURE__ */ (0,
|
|
17788
|
-
/* @__PURE__ */ (0,
|
|
17789
|
-
/* @__PURE__ */ (0,
|
|
17779
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
17780
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("mask", { id: "mask", children: [
|
|
17781
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
17782
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
17790
17783
|
] }) }),
|
|
17791
|
-
overlay && /* @__PURE__ */ (0,
|
|
17792
|
-
outline && /* @__PURE__ */ (0,
|
|
17793
|
-
/* @__PURE__ */ (0,
|
|
17784
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
17785
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
17786
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
17794
17787
|
] });
|
|
17795
17788
|
}
|
|
17796
17789
|
var Overlay_default = Overlay;
|
|
17797
17790
|
|
|
17798
17791
|
// src/common/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17799
17792
|
var import_components36 = require("@transferwise/components");
|
|
17800
|
-
var
|
|
17793
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
17801
17794
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17802
|
-
return /* @__PURE__ */ (0,
|
|
17803
|
-
/* @__PURE__ */ (0,
|
|
17804
|
-
/* @__PURE__ */ (0,
|
|
17805
|
-
onAction && actionButton && /* @__PURE__ */ (0,
|
|
17795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
17796
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
17797
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
|
|
17798
|
+
onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components36.Button, { block: true, onClick: onAction, children: actionButton })
|
|
17806
17799
|
] }) }) });
|
|
17807
17800
|
}
|
|
17808
17801
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
17809
17802
|
|
|
17810
17803
|
// src/common/cameraCapture/CameraCapture.tsx
|
|
17811
|
-
var
|
|
17804
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
17812
17805
|
function CameraCapture({
|
|
17813
17806
|
direction = "back",
|
|
17814
17807
|
overlay = "",
|
|
@@ -17820,14 +17813,14 @@ function CameraCapture({
|
|
|
17820
17813
|
onCapture,
|
|
17821
17814
|
onEvent
|
|
17822
17815
|
}) {
|
|
17823
|
-
const [mode, setMode] = (0,
|
|
17824
|
-
const [cameraError, setCameraError] = (0,
|
|
17825
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
17826
|
-
const [ready, setReady] = (0,
|
|
17827
|
-
const [reviewImage, setReviewImage] = (0,
|
|
17828
|
-
const webcamReference = (0,
|
|
17816
|
+
const [mode, setMode] = (0, import_react46.useState)("CAPTURE" /* CAPTURE */);
|
|
17817
|
+
const [cameraError, setCameraError] = (0, import_react46.useState)();
|
|
17818
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react46.useState)(false);
|
|
17819
|
+
const [ready, setReady] = (0, import_react46.useState)(false);
|
|
17820
|
+
const [reviewImage, setReviewImage] = (0, import_react46.useState)();
|
|
17821
|
+
const webcamReference = (0, import_react46.useRef)(null);
|
|
17829
17822
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
17830
|
-
const shouldLockOrientation = (0,
|
|
17823
|
+
const shouldLockOrientation = (0, import_react46.useMemo)(
|
|
17831
17824
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
17832
17825
|
[mode]
|
|
17833
17826
|
);
|
|
@@ -17836,7 +17829,7 @@ function CameraCapture({
|
|
|
17836
17829
|
onEvent
|
|
17837
17830
|
);
|
|
17838
17831
|
const intl = (0, import_react_intl35.useIntl)();
|
|
17839
|
-
const handleCapture = (0,
|
|
17832
|
+
const handleCapture = (0, import_react46.useCallback)(async () => {
|
|
17840
17833
|
var _a, _b, _c, _d, _e, _f;
|
|
17841
17834
|
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) {
|
|
17842
17835
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -17858,7 +17851,7 @@ function CameraCapture({
|
|
|
17858
17851
|
);
|
|
17859
17852
|
}
|
|
17860
17853
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
17861
|
-
const handleUserMediaError = (0,
|
|
17854
|
+
const handleUserMediaError = (0, import_react46.useCallback)(
|
|
17862
17855
|
(error) => {
|
|
17863
17856
|
setMode("ERROR" /* ERROR */);
|
|
17864
17857
|
if (error instanceof DOMException) {
|
|
@@ -17894,7 +17887,7 @@ function CameraCapture({
|
|
|
17894
17887
|
},
|
|
17895
17888
|
[intl, onEvent]
|
|
17896
17889
|
);
|
|
17897
|
-
const handleUserMedia = (0,
|
|
17890
|
+
const handleUserMedia = (0, import_react46.useCallback)(
|
|
17898
17891
|
(stream) => {
|
|
17899
17892
|
enterFullScreen();
|
|
17900
17893
|
setReady(true);
|
|
@@ -17911,13 +17904,13 @@ function CameraCapture({
|
|
|
17911
17904
|
setReviewImage(void 0);
|
|
17912
17905
|
};
|
|
17913
17906
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
17914
|
-
(0,
|
|
17907
|
+
(0, import_react46.useEffect)(() => {
|
|
17915
17908
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
17916
17909
|
exitFullScreen();
|
|
17917
17910
|
}
|
|
17918
17911
|
}, [mode, exitFullScreen]);
|
|
17919
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
17920
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
17912
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "camera-capture", children: [
|
|
17913
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17921
17914
|
import_react_webcam.default,
|
|
17922
17915
|
{
|
|
17923
17916
|
ref: webcamReference,
|
|
@@ -17928,7 +17921,7 @@ function CameraCapture({
|
|
|
17928
17921
|
onUserMedia: handleUserMedia
|
|
17929
17922
|
}
|
|
17930
17923
|
),
|
|
17931
|
-
/* @__PURE__ */ (0,
|
|
17924
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17932
17925
|
Overlay_default,
|
|
17933
17926
|
{
|
|
17934
17927
|
overlay,
|
|
@@ -17938,8 +17931,8 @@ function CameraCapture({
|
|
|
17938
17931
|
instructions
|
|
17939
17932
|
}
|
|
17940
17933
|
),
|
|
17941
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
17942
|
-
ready && /* @__PURE__ */ (0,
|
|
17934
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(OrientationLockOverlay_default, {}),
|
|
17935
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17943
17936
|
CaptureBottomBar,
|
|
17944
17937
|
{
|
|
17945
17938
|
onCapture: () => {
|
|
@@ -17948,9 +17941,9 @@ function CameraCapture({
|
|
|
17948
17941
|
}
|
|
17949
17942
|
)
|
|
17950
17943
|
] });
|
|
17951
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
17952
|
-
/* @__PURE__ */ (0,
|
|
17953
|
-
/* @__PURE__ */ (0,
|
|
17944
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "camera-capture", children: [
|
|
17945
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
17946
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
17954
17947
|
Overlay_default,
|
|
17955
17948
|
{
|
|
17956
17949
|
overlay,
|
|
@@ -17960,18 +17953,18 @@ function CameraCapture({
|
|
|
17960
17953
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
17961
17954
|
}
|
|
17962
17955
|
),
|
|
17963
|
-
/* @__PURE__ */ (0,
|
|
17956
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
17964
17957
|
] });
|
|
17965
|
-
return /* @__PURE__ */ (0,
|
|
17958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("section", { children: [
|
|
17966
17959
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
17967
17960
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
17968
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0,
|
|
17961
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
17969
17962
|
] });
|
|
17970
17963
|
}
|
|
17971
17964
|
var CameraCapture_default = CameraCapture;
|
|
17972
17965
|
|
|
17973
17966
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17974
|
-
var
|
|
17967
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
17975
17968
|
function blobToBase64(blob) {
|
|
17976
17969
|
return new Promise((resolve, _) => {
|
|
17977
17970
|
const reader = new FileReader();
|
|
@@ -17989,8 +17982,8 @@ function CameraStep(props) {
|
|
|
17989
17982
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
17990
17983
|
const { overlay, outline } = assets || {};
|
|
17991
17984
|
const { url: imageUrl } = image || {};
|
|
17992
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
17993
|
-
(0,
|
|
17985
|
+
const [captureClicked, setCaptureClicked] = (0, import_react47.useState)(false);
|
|
17986
|
+
(0, import_react47.useEffect)(() => {
|
|
17994
17987
|
if (captureClicked) {
|
|
17995
17988
|
onAction(action);
|
|
17996
17989
|
}
|
|
@@ -18009,7 +18002,7 @@ function CameraStep(props) {
|
|
|
18009
18002
|
});
|
|
18010
18003
|
}
|
|
18011
18004
|
};
|
|
18012
|
-
return /* @__PURE__ */ (0,
|
|
18005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
18013
18006
|
CameraCapture_default,
|
|
18014
18007
|
{
|
|
18015
18008
|
overlay,
|
|
@@ -18086,12 +18079,12 @@ var external_confirmation_messages_default = (0, import_react_intl36.defineMessa
|
|
|
18086
18079
|
});
|
|
18087
18080
|
|
|
18088
18081
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18089
|
-
var
|
|
18082
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
18090
18083
|
var noop6 = () => {
|
|
18091
18084
|
};
|
|
18092
18085
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18093
18086
|
const { formatMessage } = (0, import_react_intl37.useIntl)();
|
|
18094
|
-
return /* @__PURE__ */ (0,
|
|
18087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
18095
18088
|
DynamicLayout_default,
|
|
18096
18089
|
{
|
|
18097
18090
|
components: [
|
|
@@ -18158,9 +18151,9 @@ function getOrigin(url) {
|
|
|
18158
18151
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18159
18152
|
var import_components38 = require("@transferwise/components");
|
|
18160
18153
|
var import_icons3 = require("@transferwise/icons");
|
|
18161
|
-
var
|
|
18154
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
18162
18155
|
function BackButton({ title, action, onAction }) {
|
|
18163
|
-
return /* @__PURE__ */ (0,
|
|
18156
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "m-b-2", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
18164
18157
|
"a",
|
|
18165
18158
|
{
|
|
18166
18159
|
href: "/",
|
|
@@ -18171,8 +18164,8 @@ function BackButton({ title, action, onAction }) {
|
|
|
18171
18164
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18172
18165
|
},
|
|
18173
18166
|
children: [
|
|
18174
|
-
/* @__PURE__ */ (0,
|
|
18175
|
-
/* @__PURE__ */ (0,
|
|
18167
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "sr-only", children: title }),
|
|
18168
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components38.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
18176
18169
|
]
|
|
18177
18170
|
}
|
|
18178
18171
|
) });
|
|
@@ -18180,7 +18173,7 @@ function BackButton({ title, action, onAction }) {
|
|
|
18180
18173
|
var BackButton_default = BackButton;
|
|
18181
18174
|
|
|
18182
18175
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18183
|
-
var
|
|
18176
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
18184
18177
|
function DynamicFlowStep(props) {
|
|
18185
18178
|
var _a, _b, _c;
|
|
18186
18179
|
const { step, globalError, onAction } = props;
|
|
@@ -18189,28 +18182,28 @@ function DynamicFlowStep(props) {
|
|
|
18189
18182
|
const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
|
|
18190
18183
|
if (step === void 0) {
|
|
18191
18184
|
if (globalError) {
|
|
18192
|
-
return /* @__PURE__ */ (0,
|
|
18185
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18193
18186
|
}
|
|
18194
18187
|
return null;
|
|
18195
18188
|
}
|
|
18196
18189
|
if (externalUrl && requiresManualTrigger) {
|
|
18197
|
-
return /* @__PURE__ */ (0,
|
|
18190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18198
18191
|
}
|
|
18199
18192
|
if (isCameraStep(step)) {
|
|
18200
|
-
return /* @__PURE__ */ (0,
|
|
18193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18201
18194
|
}
|
|
18202
|
-
return /* @__PURE__ */ (0,
|
|
18203
|
-
backButton && /* @__PURE__ */ (0,
|
|
18204
|
-
globalError ? /* @__PURE__ */ (0,
|
|
18205
|
-
/* @__PURE__ */ (0,
|
|
18195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
18196
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
18197
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
18198
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
18206
18199
|
] });
|
|
18207
18200
|
}
|
|
18208
18201
|
|
|
18209
18202
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
18210
|
-
var
|
|
18203
|
+
var import_react48 = require("react");
|
|
18211
18204
|
var DEBOUNCE_DELAY = 1e3;
|
|
18212
18205
|
function useDebouncedRefresh(fetchRefresh) {
|
|
18213
|
-
const map = (0,
|
|
18206
|
+
const map = (0, import_react48.useRef)(/* @__PURE__ */ new Map());
|
|
18214
18207
|
const retrieveOrCreate = (key) => {
|
|
18215
18208
|
if (map.current.has(key)) {
|
|
18216
18209
|
return map.current.get(key);
|
|
@@ -18242,12 +18235,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18242
18235
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18243
18236
|
|
|
18244
18237
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18245
|
-
var
|
|
18238
|
+
var import_react49 = require("react");
|
|
18246
18239
|
var useDynamicFlowState = (initialStep) => {
|
|
18247
18240
|
var _a, _b;
|
|
18248
|
-
const [formErrors, setFormErrors] = (0,
|
|
18249
|
-
const [globalError, setGlobalError] = (0,
|
|
18250
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
18241
|
+
const [formErrors, setFormErrors] = (0, import_react49.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
18242
|
+
const [globalError, setGlobalError] = (0, import_react49.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
18243
|
+
const [stepAndModels, setStepAndModels] = (0, import_react49.useState)({
|
|
18251
18244
|
step: initialStep || void 0,
|
|
18252
18245
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18253
18246
|
etag: void 0
|
|
@@ -18277,7 +18270,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
18277
18270
|
return updatedState;
|
|
18278
18271
|
});
|
|
18279
18272
|
};
|
|
18280
|
-
const modelIsValid = (0,
|
|
18273
|
+
const modelIsValid = (0, import_react49.useMemo)(
|
|
18281
18274
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
18282
18275
|
[models, step]
|
|
18283
18276
|
);
|
|
@@ -18350,17 +18343,17 @@ var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object"
|
|
|
18350
18343
|
|
|
18351
18344
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18352
18345
|
var import_components39 = require("@transferwise/components");
|
|
18353
|
-
var
|
|
18354
|
-
var
|
|
18346
|
+
var import_react50 = require("react");
|
|
18347
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
18355
18348
|
function useLoader(loaderConfig, initialState) {
|
|
18356
18349
|
const config = __spreadValues({
|
|
18357
18350
|
size: import_components39.Size.EXTRA_LARGE,
|
|
18358
18351
|
initial: true,
|
|
18359
18352
|
submission: false
|
|
18360
18353
|
}, loaderConfig);
|
|
18361
|
-
const [loadingState, setLoadingState] = (0,
|
|
18354
|
+
const [loadingState, setLoadingState] = (0, import_react50.useState)(initialState);
|
|
18362
18355
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18363
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
18356
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
18364
18357
|
import_components39.Loader,
|
|
18365
18358
|
{
|
|
18366
18359
|
size: config.size,
|
|
@@ -18480,7 +18473,7 @@ var useErrorResponse = () => {
|
|
|
18480
18473
|
};
|
|
18481
18474
|
|
|
18482
18475
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18483
|
-
var
|
|
18476
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
18484
18477
|
var noop7 = () => {
|
|
18485
18478
|
};
|
|
18486
18479
|
var DynamicFlowComponent = ({
|
|
@@ -18490,7 +18483,6 @@ var DynamicFlowComponent = ({
|
|
|
18490
18483
|
initialStep,
|
|
18491
18484
|
loaderConfig,
|
|
18492
18485
|
displayStepTitle = true,
|
|
18493
|
-
features,
|
|
18494
18486
|
onCompletion,
|
|
18495
18487
|
onError,
|
|
18496
18488
|
onEvent = noop7,
|
|
@@ -18508,7 +18500,7 @@ var DynamicFlowComponent = ({
|
|
|
18508
18500
|
setStepAndEtag,
|
|
18509
18501
|
setSchemaModel
|
|
18510
18502
|
} = useDynamicFlowState(initialStep);
|
|
18511
|
-
const [submitted, setSubmitted] = (0,
|
|
18503
|
+
const [submitted, setSubmitted] = (0, import_react51.useState)(false);
|
|
18512
18504
|
const { locale } = (0, import_react_intl39.useIntl)();
|
|
18513
18505
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18514
18506
|
loaderConfig,
|
|
@@ -18527,18 +18519,18 @@ var DynamicFlowComponent = ({
|
|
|
18527
18519
|
);
|
|
18528
18520
|
}
|
|
18529
18521
|
};
|
|
18530
|
-
const analyticsMetadata = (0,
|
|
18522
|
+
const analyticsMetadata = (0, import_react51.useMemo)(
|
|
18531
18523
|
() => {
|
|
18532
18524
|
var _a;
|
|
18533
18525
|
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 : {});
|
|
18534
18526
|
},
|
|
18535
18527
|
[flowId, step]
|
|
18536
18528
|
);
|
|
18537
|
-
const dispatchEvent = (0,
|
|
18529
|
+
const dispatchEvent = (0, import_react51.useMemo)(
|
|
18538
18530
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
18539
18531
|
[onEvent, analyticsMetadata]
|
|
18540
18532
|
);
|
|
18541
|
-
const dfHttpClient = (0,
|
|
18533
|
+
const dfHttpClient = (0, import_react51.useCallback)(
|
|
18542
18534
|
({
|
|
18543
18535
|
action,
|
|
18544
18536
|
data,
|
|
@@ -18591,17 +18583,17 @@ var DynamicFlowComponent = ({
|
|
|
18591
18583
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
18592
18584
|
};
|
|
18593
18585
|
const { debouncedRefresh, isDebouncing, cancelPendingRefreshes } = useDebouncedRefresh(performRefresh);
|
|
18594
|
-
const dispatchEventAndComplete = (0,
|
|
18586
|
+
const dispatchEventAndComplete = (0, import_react51.useCallback)(
|
|
18595
18587
|
(result) => {
|
|
18596
18588
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
18597
18589
|
onCompletion(result);
|
|
18598
18590
|
},
|
|
18599
18591
|
[onCompletion, dispatchEvent]
|
|
18600
18592
|
);
|
|
18601
|
-
(0,
|
|
18593
|
+
(0, import_react51.useEffect)(() => {
|
|
18602
18594
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
18603
18595
|
}, []);
|
|
18604
|
-
(0,
|
|
18596
|
+
(0, import_react51.useEffect)(() => {
|
|
18605
18597
|
if (!initialStep) {
|
|
18606
18598
|
const action = __spreadValues({
|
|
18607
18599
|
id: "#initial-step-request",
|
|
@@ -18723,7 +18715,7 @@ var DynamicFlowComponent = ({
|
|
|
18723
18715
|
await performAction(action);
|
|
18724
18716
|
}
|
|
18725
18717
|
};
|
|
18726
|
-
return /* @__PURE__ */ (0,
|
|
18718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DynamicFlowProvider, { loading: isLoading || isDebouncing, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { id: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), className: "dynamic-flow-legacy", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
18727
18719
|
DynamicFlowStep,
|
|
18728
18720
|
{
|
|
18729
18721
|
step,
|
|
@@ -18737,10 +18729,10 @@ var DynamicFlowComponent = ({
|
|
|
18737
18729
|
},
|
|
18738
18730
|
onModelChange
|
|
18739
18731
|
}
|
|
18740
|
-
) }) }) }) }) })
|
|
18732
|
+
) }) }) }) }) });
|
|
18741
18733
|
};
|
|
18742
18734
|
function DynamicFlow(props) {
|
|
18743
|
-
return /* @__PURE__ */ (0,
|
|
18735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
18744
18736
|
}
|
|
18745
18737
|
var DynamicFlow_default = DynamicFlow;
|
|
18746
18738
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18757,19 +18749,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18757
18749
|
};
|
|
18758
18750
|
|
|
18759
18751
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18760
|
-
var
|
|
18752
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
18761
18753
|
function JsonSchemaForm(props) {
|
|
18762
18754
|
const schemaProps = __spreadValues({
|
|
18763
18755
|
model: null,
|
|
18764
18756
|
errors: null
|
|
18765
18757
|
}, props);
|
|
18766
18758
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18767
|
-
return /* @__PURE__ */ (0,
|
|
18759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
18768
18760
|
EventsContextProvider,
|
|
18769
18761
|
{
|
|
18770
18762
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18771
18763
|
onEvent,
|
|
18772
|
-
children: /* @__PURE__ */ (0,
|
|
18764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18773
18765
|
}
|
|
18774
18766
|
) });
|
|
18775
18767
|
}
|