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