@wise/dynamic-flow-client 3.4.0-experimental-ed080a1 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/i18n/en.json +1 -0
- package/build/main.js +1100 -965
- package/build/main.min.js +1 -1
- package/build/main.mjs +929 -794
- package/build/types/common/messages/multi-select.messages.d.ts +8 -0
- package/build/types/legacy/common/utils/schema-utils.d.ts +4 -3
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +6 -6
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.d.ts +9 -0
- package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +1 -1
- package/package.json +3 -3
- package/build/common/httpClientContext/HttpClientContext.js +0 -35
- package/build/common/httpClientContext/index.js +0 -1
- package/build/common/makeHttpClient/index.js +0 -1
- package/build/common/makeHttpClient/makeHttpClient.js +0 -34
- package/build/common/messages/generic-error.messages.js +0 -18
- package/build/common/messages/help.messages.js +0 -8
- package/build/common/messages/multi-file-upload.messages.js +0 -18
- package/build/common/messages/paragraph.messages.js +0 -13
- package/build/common/messages/repeatable.messages.js +0 -23
- package/build/common/messages/validation.array.messages.js +0 -13
- package/build/common/messages/validation.messages.js +0 -53
- package/build/common/utils/api-utils.js +0 -4
- package/build/legacy/common/constants/DateMode.js +0 -4
- package/build/legacy/common/constants/FeatureName.js +0 -4
- package/build/legacy/common/constants/FormControlType.js +0 -21
- package/build/legacy/common/constants/MonthFormat.js +0 -4
- package/build/legacy/common/constants/Size.js +0 -7
- package/build/legacy/common/constants/index.js +0 -4
- package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +0 -36
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +0 -13
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +0 -38
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +0 -22
- package/build/legacy/common/contexts/index.js +0 -3
- package/build/legacy/common/contexts/logContext/LogContext.js +0 -44
- package/build/legacy/common/hooks/index.js +0 -7
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.js +0 -9
- package/build/legacy/common/hooks/useExternal/useExternal.js +0 -15
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +0 -70
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +0 -172
- package/build/legacy/common/hooks/usePolling/usePolling.js +0 -51
- package/build/legacy/common/hooks/usePrevious/usePrevious.js +0 -8
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +0 -43
- package/build/legacy/common/messages.js +0 -8
- package/build/legacy/common/utils/api-utils.js +0 -6
- package/build/legacy/common/utils/date-utils.js +0 -22
- package/build/legacy/common/utils/debounce.js +0 -38
- package/build/legacy/common/utils/file-utils.js +0 -45
- package/build/legacy/common/utils/id-utils.js +0 -5
- package/build/legacy/common/utils/index.js +0 -11
- package/build/legacy/common/utils/is-equal.js +0 -21
- package/build/legacy/common/utils/misc-utils.js +0 -4
- package/build/legacy/common/utils/mobile-utils.js +0 -23
- package/build/legacy/common/utils/model-utils.js +0 -33
- package/build/legacy/common/utils/schema-utils.js +0 -97
- package/build/legacy/common/utils/step-utils.js +0 -32
- package/build/legacy/common/validators/index.js +0 -5
- package/build/legacy/common/validators/models/model-utils.js +0 -119
- package/build/legacy/common/validators/models/model-validators.js +0 -62
- package/build/legacy/common/validators/schemas/schema-validators.js +0 -101
- package/build/legacy/common/validators/types/type-validators.js +0 -14
- package/build/legacy/common/validators/validationFailures/validation-failures.js +0 -139
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +0 -40
- package/build/legacy/common/validators/values/value-validators.js +0 -6
- package/build/legacy/dynamic-flow-types.js +0 -1
- package/build/legacy/dynamicFlow/BackButton.js +0 -22
- package/build/legacy/dynamicFlow/DynamicFlowStep.js +0 -37
- package/build/legacy/formControl/FormControl.js +0 -266
- package/build/legacy/formControl/index.js +0 -1
- package/build/legacy/formControl/utils/getAutocompleteString.js +0 -80
- package/build/legacy/formControl/utils/index.js +0 -2
- package/build/legacy/formControl/utils/value-utils.js +0 -108
- package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +0 -50
- package/build/legacy/jsonSchemaForm/allOfSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +0 -25
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +0 -30
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +0 -141
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +0 -2
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +0 -79
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +0 -14
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.js +0 -7
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +0 -134
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +0 -85
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +0 -135
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +0 -111
- package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +0 -86
- package/build/legacy/jsonSchemaForm/controlFeedback/index.js +0 -1
- package/build/legacy/jsonSchemaForm/help/Help.js +0 -20
- package/build/legacy/jsonSchemaForm/help/index.js +0 -1
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +0 -77
- package/build/legacy/jsonSchemaForm/objectSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +0 -155
- package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +0 -68
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +0 -26
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +0 -165
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +0 -131
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +0 -31
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +0 -72
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +0 -8
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +0 -27
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +0 -31
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +0 -32
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +0 -54
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +0 -13
- package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +0 -1
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +0 -133
- package/build/legacy/jsonSchemaForm/schemaFormControl/index.js +0 -1
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/index.js +0 -1
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +0 -107
- package/build/legacy/layout/DynamicLayout.js +0 -68
- package/build/legacy/layout/alert/DynamicAlert.js +0 -29
- package/build/legacy/layout/box/DynamicBox.js +0 -41
- package/build/legacy/layout/button/DynamicButton.js +0 -27
- package/build/legacy/layout/button/utils.js +0 -45
- package/build/legacy/layout/columns/DynamicColumns.js +0 -38
- package/build/legacy/layout/decision/DynamicDecision.js +0 -21
- package/build/legacy/layout/divider/DynamicDivider.js +0 -9
- package/build/legacy/layout/external/DynamicExternal.js +0 -32
- package/build/legacy/layout/external/DynamicExternal.messages.js +0 -8
- package/build/legacy/layout/form/DynamicForm.js +0 -22
- package/build/legacy/layout/heading/DynamicHeading.js +0 -51
- package/build/legacy/layout/icon/DynamicIcon.js +0 -17
- package/build/legacy/layout/icon/FlagIcon.js +0 -198
- package/build/legacy/layout/icon/NamedIcon.js +0 -19
- package/build/legacy/layout/image/DynamicImage.js +0 -111
- package/build/legacy/layout/index.js +0 -20
- package/build/legacy/layout/instructions/DynamicInstructions.js +0 -30
- package/build/legacy/layout/list/DynamicStatusList.js +0 -37
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +0 -11
- package/build/legacy/layout/markdown/DynamicMarkdown.js +0 -23
- package/build/legacy/layout/modal/DynamicModal.js +0 -26
- package/build/legacy/layout/paragraph/DynamicParagraph.js +0 -46
- package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +0 -9
- package/build/legacy/layout/review/DynamicReview.js +0 -58
- package/build/legacy/layout/search/DynamicSearch.js +0 -58
- package/build/legacy/layout/search/SearchInput.js +0 -17
- package/build/legacy/layout/search/SearchResults.js +0 -31
- package/build/legacy/layout/search/useSearch.js +0 -137
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +0 -28
- package/build/legacy/layout/utils/index.js +0 -32
- package/build/legacy/step/cameraStep/CameraStep.js +0 -124
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +0 -161
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +0 -58
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +0 -28
- package/build/legacy/step/cameraStep/cameraCapture/components/index.js +0 -3
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +0 -19
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +0 -8
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +0 -60
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +0 -80
- package/build/legacy/step/cameraStep/cameraCapture/index.js +0 -1
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +0 -77
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +0 -18
- package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +0 -1
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +0 -109
- package/build/legacy/step/cameraStep/cameraCapture/types/index.js +0 -7
- package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +0 -107
- package/build/legacy/step/cameraStep/index.js +0 -1
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +0 -64
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +0 -23
- package/build/legacy/step/externalConfirmationStep/index.js +0 -1
- package/build/legacy/step/index.js +0 -3
- package/build/legacy/step/layoutStep/LayoutStep.js +0 -33
- package/build/legacy/step/layoutStep/index.js +0 -1
- package/build/legacy/step/layoutStep/utils/index.js +0 -2
- package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +0 -105
- package/build/legacy/step/layoutStep/utils/layout-utils.js +0 -212
package/build/main.mjs
CHANGED
|
@@ -64,7 +64,7 @@ var require_classnames = __commonJS({
|
|
|
64
64
|
(function() {
|
|
65
65
|
"use strict";
|
|
66
66
|
var hasOwn = {}.hasOwnProperty;
|
|
67
|
-
function
|
|
67
|
+
function classNames16() {
|
|
68
68
|
var classes = "";
|
|
69
69
|
for (var i = 0; i < arguments.length; i++) {
|
|
70
70
|
var arg = arguments[i];
|
|
@@ -82,7 +82,7 @@ var require_classnames = __commonJS({
|
|
|
82
82
|
return "";
|
|
83
83
|
}
|
|
84
84
|
if (Array.isArray(arg)) {
|
|
85
|
-
return
|
|
85
|
+
return classNames16.apply(null, arg);
|
|
86
86
|
}
|
|
87
87
|
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
88
88
|
return arg.toString();
|
|
@@ -105,14 +105,14 @@ var require_classnames = __commonJS({
|
|
|
105
105
|
return value + newClass;
|
|
106
106
|
}
|
|
107
107
|
if (typeof module !== "undefined" && module.exports) {
|
|
108
|
-
|
|
109
|
-
module.exports =
|
|
108
|
+
classNames16.default = classNames16;
|
|
109
|
+
module.exports = classNames16;
|
|
110
110
|
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
111
111
|
define("classnames", [], function() {
|
|
112
|
-
return
|
|
112
|
+
return classNames16;
|
|
113
113
|
});
|
|
114
114
|
} else {
|
|
115
|
-
window.classNames =
|
|
115
|
+
window.classNames = classNames16;
|
|
116
116
|
}
|
|
117
117
|
})();
|
|
118
118
|
}
|
|
@@ -144,8 +144,8 @@ var init_clsx = __esm({
|
|
|
144
144
|
});
|
|
145
145
|
|
|
146
146
|
// ../../node_modules/.pnpm/@wise+art@2.9.2_@transferwise+neptune-css@14.9.5_@types+react@18.0.29_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index-d9418379.esm.js
|
|
147
|
-
import { useState as
|
|
148
|
-
import { jsx as
|
|
147
|
+
import { useState as useState5, useEffect as useEffect3, forwardRef, Suspense, lazy } from "react";
|
|
148
|
+
import { jsx as jsx20, jsxs as jsxs6, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
149
149
|
var unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
|
|
150
150
|
var init_index_d9418379_esm = __esm({
|
|
151
151
|
"../../node_modules/.pnpm/@wise+art@2.9.2_@transferwise+neptune-css@14.9.5_@types+react@18.0.29_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index-d9418379.esm.js"() {
|
|
@@ -157,13 +157,13 @@ var init_index_d9418379_esm = __esm({
|
|
|
157
157
|
intrinsicSize = 64,
|
|
158
158
|
className = void 0
|
|
159
159
|
}) => {
|
|
160
|
-
const [fallback, setFallback] =
|
|
161
|
-
|
|
160
|
+
const [fallback, setFallback] = useState5(null);
|
|
161
|
+
useEffect3(() => {
|
|
162
162
|
setFallback(null);
|
|
163
163
|
}, [code]);
|
|
164
164
|
const detailed = intrinsicSize >= 150;
|
|
165
165
|
const name = fallback !== "unknown" ? `${code.toLowerCase()}${fallback == null && detailed ? "-detailed" : ""}` : unknownFlagName;
|
|
166
|
-
return /* @__PURE__ */
|
|
166
|
+
return /* @__PURE__ */ jsx20("img", {
|
|
167
167
|
className: clsx(`wds-flag wds-flag-${name}`, className),
|
|
168
168
|
src: `https://wise.com/web-art/assets/flags/${name}.svg`,
|
|
169
169
|
alt: "",
|
|
@@ -732,8 +732,8 @@ function isReference(block) {
|
|
|
732
732
|
}
|
|
733
733
|
|
|
734
734
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
735
|
-
import { useCallback as useCallback9, useEffect as
|
|
736
|
-
import { useIntl as
|
|
735
|
+
import { useCallback as useCallback9, useEffect as useEffect21, useMemo as useMemo17, useState as useState26 } from "react";
|
|
736
|
+
import { useIntl as useIntl18 } from "react-intl";
|
|
737
737
|
|
|
738
738
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
739
739
|
import { createContext, useContext, useMemo } from "react";
|
|
@@ -1432,8 +1432,11 @@ function isArraySchema(schema) {
|
|
|
1432
1432
|
return schema.type === "array";
|
|
1433
1433
|
}
|
|
1434
1434
|
function isListArraySchema(schema) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1435
|
+
if (isArraySchema(schema)) {
|
|
1436
|
+
const schemaItems = schema.items;
|
|
1437
|
+
return !Array.isArray(schemaItems);
|
|
1438
|
+
}
|
|
1439
|
+
return false;
|
|
1437
1440
|
}
|
|
1438
1441
|
function isStringSchema(schema) {
|
|
1439
1442
|
return schema.type === "string";
|
|
@@ -1451,7 +1454,17 @@ function isBase64FileSchema(schema) {
|
|
|
1451
1454
|
function isFileUploadSchema(schema) {
|
|
1452
1455
|
return schema.type === "string" && schema.format === "base64url";
|
|
1453
1456
|
}
|
|
1454
|
-
var isMultipleFileUploadSchema = (schema) =>
|
|
1457
|
+
var isMultipleFileUploadSchema = (schema) => isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items);
|
|
1458
|
+
var isMultiSelectConstSchema = (schema) => {
|
|
1459
|
+
var _a;
|
|
1460
|
+
if (isListArraySchema(schema)) {
|
|
1461
|
+
const { items } = schema;
|
|
1462
|
+
if (isOneOfSchema(items) && ((_a = items.oneOf) == null ? void 0 : _a.every(isConstSchema))) {
|
|
1463
|
+
return true;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
return false;
|
|
1467
|
+
};
|
|
1455
1468
|
var getSchemaType = (schema) => {
|
|
1456
1469
|
if (isReadOnlySchema(schema)) {
|
|
1457
1470
|
return "readOnly";
|
|
@@ -1693,8 +1706,8 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1693
1706
|
}
|
|
1694
1707
|
|
|
1695
1708
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1696
|
-
import { useState as
|
|
1697
|
-
import { useIntl as
|
|
1709
|
+
import { useState as useState20 } from "react";
|
|
1710
|
+
import { useIntl as useIntl12 } from "react-intl";
|
|
1698
1711
|
|
|
1699
1712
|
// src/common/messages/generic-error.messages.ts
|
|
1700
1713
|
import { defineMessages } from "react-intl";
|
|
@@ -1717,8 +1730,8 @@ var generic_error_messages_default = defineMessages({
|
|
|
1717
1730
|
});
|
|
1718
1731
|
|
|
1719
1732
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1720
|
-
import { useEffect as
|
|
1721
|
-
import { useIntl as
|
|
1733
|
+
import { useEffect as useEffect13, useState as useState19 } from "react";
|
|
1734
|
+
import { useIntl as useIntl11 } from "react-intl";
|
|
1722
1735
|
|
|
1723
1736
|
// src/legacy/common/constants/DateMode.ts
|
|
1724
1737
|
var DateMode = {
|
|
@@ -1765,8 +1778,8 @@ var Size = {
|
|
|
1765
1778
|
};
|
|
1766
1779
|
|
|
1767
1780
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
1768
|
-
var
|
|
1769
|
-
import { useEffect as
|
|
1781
|
+
var import_classnames9 = __toESM(require_classnames());
|
|
1782
|
+
import { useEffect as useEffect12, useMemo as useMemo12, useState as useState18 } from "react";
|
|
1770
1783
|
|
|
1771
1784
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
1772
1785
|
import { Alert } from "@transferwise/components";
|
|
@@ -2343,7 +2356,7 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
2343
2356
|
var DynamicExternal_default = DynamicExternal;
|
|
2344
2357
|
|
|
2345
2358
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2346
|
-
import { useEffect as
|
|
2359
|
+
import { useEffect as useEffect10 } from "react";
|
|
2347
2360
|
|
|
2348
2361
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2349
2362
|
var import_classnames = __toESM(require_classnames());
|
|
@@ -2742,17 +2755,234 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
2742
2755
|
return __spreadValues(__spreadValues(__spreadValues({}, required && { required: defaultErrorMessages.requiredMessage }), minItems && { minItems: defaultErrorMessages.minItemsErrorMessage }), maxItems && { maxItems: defaultErrorMessages.maxItemsErrorMessage });
|
|
2743
2756
|
}
|
|
2744
2757
|
|
|
2758
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
2759
|
+
var import_classnames3 = __toESM(require_classnames());
|
|
2760
|
+
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
2761
|
+
import { useEffect as useEffect4, useMemo as useMemo7, useState as useState6 } from "react";
|
|
2762
|
+
import { useIntl as useIntl4 } from "react-intl";
|
|
2763
|
+
|
|
2764
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
2765
|
+
import { Avatar as Avatar2, AvatarType as AvatarType2 } from "@transferwise/components";
|
|
2766
|
+
|
|
2767
|
+
// ../../node_modules/.pnpm/@wise+art@2.9.2_@transferwise+neptune-css@14.9.5_@types+react@18.0.29_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index.esm.js
|
|
2768
|
+
init_index_d9418379_esm();
|
|
2769
|
+
init_clsx();
|
|
2770
|
+
import "react";
|
|
2771
|
+
import "react/jsx-runtime";
|
|
2772
|
+
|
|
2773
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
2774
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2775
|
+
var mapConstSchemaToOption = (schema, controlType) => {
|
|
2776
|
+
switch (controlType) {
|
|
2777
|
+
case "select":
|
|
2778
|
+
return mapConstSchemaToSelectOption(schema);
|
|
2779
|
+
case "radio":
|
|
2780
|
+
default:
|
|
2781
|
+
return mapConstSchemaToRadioOption(schema);
|
|
2782
|
+
}
|
|
2783
|
+
};
|
|
2784
|
+
var mapConstSchemaToRadioOption = (schema) => __spreadValues(__spreadValues(__spreadValues({
|
|
2785
|
+
// TODO: LOW avoid type assertion -- using || '' would fail some tests
|
|
2786
|
+
label: schema.title,
|
|
2787
|
+
value: schema.const
|
|
2788
|
+
}, getRadioOptionDescription(schema.title, schema.description)), getAvatarPropertyForRadioOption(schema)), getDisabled(schema.disabled));
|
|
2789
|
+
var mapConstSchemaToSelectOption = (schema) => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
2790
|
+
// TODO: LOW avoid type assertion -- using || '' would fail some tests
|
|
2791
|
+
label: schema.title,
|
|
2792
|
+
value: schema.const
|
|
2793
|
+
}, getOptionDescription(schema.title, schema.description)), getIconPropertyForSelectOption(schema.icon)), mapImage(schema.image)), getDisabled(schema.disabled)), mapKeywordsToSearchStrings(schema.keywords));
|
|
2794
|
+
var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { searchStrings } : {};
|
|
2795
|
+
var mapImage = (image) => {
|
|
2796
|
+
if (image == null ? void 0 : image.url) {
|
|
2797
|
+
return {
|
|
2798
|
+
icon: /* @__PURE__ */ jsx21("div", { className: "media", children: /* @__PURE__ */ jsx21("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx21("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
2799
|
+
hideIconInTrigger: true
|
|
2800
|
+
};
|
|
2801
|
+
}
|
|
2802
|
+
return null;
|
|
2803
|
+
};
|
|
2804
|
+
var getIconPropertyForSelectOption = (icon) => {
|
|
2805
|
+
if ((icon == null ? void 0 : icon.name) && isFlagIcon(icon.name)) {
|
|
2806
|
+
return {
|
|
2807
|
+
icon: /* @__PURE__ */ jsx21(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
2808
|
+
};
|
|
2809
|
+
}
|
|
2810
|
+
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
2811
|
+
return {
|
|
2812
|
+
icon: /* @__PURE__ */ jsx21(DynamicIcon_default, { type: icon.name })
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
if (icon == null ? void 0 : icon.text) {
|
|
2816
|
+
return {
|
|
2817
|
+
icon: /* @__PURE__ */ jsx21("span", { children: icon.text })
|
|
2818
|
+
};
|
|
2819
|
+
}
|
|
2820
|
+
return null;
|
|
2821
|
+
};
|
|
2822
|
+
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
2823
|
+
if (image == null ? void 0 : image.url) {
|
|
2824
|
+
return {
|
|
2825
|
+
avatar: /* @__PURE__ */ jsx21(Avatar2, { type: AvatarType2.THUMBNAIL, children: /* @__PURE__ */ jsx21("img", { src: image.url, alt: "" }) })
|
|
2826
|
+
};
|
|
2827
|
+
}
|
|
2828
|
+
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
2829
|
+
return {
|
|
2830
|
+
avatar: /* @__PURE__ */ jsx21(Avatar2, { type: AvatarType2.ICON, children: /* @__PURE__ */ jsx21(DynamicIcon_default, { type: icon.name }) })
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
if (icon == null ? void 0 : icon.text) {
|
|
2834
|
+
return {
|
|
2835
|
+
avatar: /* @__PURE__ */ jsx21(Avatar2, { type: AvatarType2.INITIALS, children: icon.text })
|
|
2836
|
+
};
|
|
2837
|
+
}
|
|
2838
|
+
return null;
|
|
2839
|
+
};
|
|
2840
|
+
var mapSchemaToUploadOptions = ({ accepts }) => __spreadValues({}, isArray(accepts) && { usAccept: accepts.join(",") });
|
|
2841
|
+
var getOptionDescription = (title, description) => {
|
|
2842
|
+
if (title && description) {
|
|
2843
|
+
if ((title + description).length > 50) {
|
|
2844
|
+
return { secondary: description };
|
|
2845
|
+
}
|
|
2846
|
+
return { note: description };
|
|
2847
|
+
}
|
|
2848
|
+
return void 0;
|
|
2849
|
+
};
|
|
2850
|
+
var getRadioOptionDescription = (title, description) => {
|
|
2851
|
+
if (title && description) {
|
|
2852
|
+
return { note: description };
|
|
2853
|
+
}
|
|
2854
|
+
return void 0;
|
|
2855
|
+
};
|
|
2856
|
+
var getDisabled = (disabled) => {
|
|
2857
|
+
if (!isUndefined(disabled) && !isNull(disabled)) {
|
|
2858
|
+
return { disabled };
|
|
2859
|
+
}
|
|
2860
|
+
return void 0;
|
|
2861
|
+
};
|
|
2862
|
+
|
|
2863
|
+
// src/common/messages/multi-select.messages.ts
|
|
2864
|
+
import { defineMessages as defineMessages7 } from "react-intl";
|
|
2865
|
+
var multi_select_messages_default = defineMessages7({
|
|
2866
|
+
summary: {
|
|
2867
|
+
id: "dynamicFlows.MultiSelect.summary",
|
|
2868
|
+
defaultMessage: "{first} and {count} more",
|
|
2869
|
+
description: "A summary of the multiple items selected. Showing the title of the first selected item, and the number of other items that have been selected."
|
|
2870
|
+
}
|
|
2871
|
+
});
|
|
2872
|
+
|
|
2873
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
2874
|
+
import { jsx as jsx22, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2875
|
+
function MultiSelectSchema({
|
|
2876
|
+
schema,
|
|
2877
|
+
model,
|
|
2878
|
+
submitted,
|
|
2879
|
+
required = false,
|
|
2880
|
+
errors,
|
|
2881
|
+
onChange
|
|
2882
|
+
}) {
|
|
2883
|
+
const { formatMessage, locale } = useIntl4();
|
|
2884
|
+
const { disabled, items, validationMessages, placeholder } = schema;
|
|
2885
|
+
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
2886
|
+
const id = useMemo7(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
2887
|
+
const [changed, setChanged] = useState6(false);
|
|
2888
|
+
const [selected, setSelected] = useState6(getInitialModelIndices(model, options));
|
|
2889
|
+
useEffect4(
|
|
2890
|
+
() => {
|
|
2891
|
+
if (selected) {
|
|
2892
|
+
broadcastModelChange(selected);
|
|
2893
|
+
}
|
|
2894
|
+
},
|
|
2895
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2896
|
+
[]
|
|
2897
|
+
);
|
|
2898
|
+
const broadcastModelChange = (selected2) => {
|
|
2899
|
+
setSelected(selected2);
|
|
2900
|
+
const updatedModel = selected2.map((i) => options[i].value);
|
|
2901
|
+
setChanged(true);
|
|
2902
|
+
onChange({
|
|
2903
|
+
model: !required && updatedModel.length === 0 ? null : updatedModel,
|
|
2904
|
+
triggerSchema: schema.items,
|
|
2905
|
+
triggerModel: updatedModel
|
|
2906
|
+
});
|
|
2907
|
+
};
|
|
2908
|
+
const getFormattedMessage = () => {
|
|
2909
|
+
if (selected && selected.length > 0) {
|
|
2910
|
+
if (selected.length > 1) {
|
|
2911
|
+
return formatMessage(multi_select_messages_default.summary, {
|
|
2912
|
+
first: options[selected[0]].label,
|
|
2913
|
+
count: selected.length - 1
|
|
2914
|
+
});
|
|
2915
|
+
}
|
|
2916
|
+
return options[selected[0]].label;
|
|
2917
|
+
}
|
|
2918
|
+
return placeholder;
|
|
2919
|
+
};
|
|
2920
|
+
const validations = getValidationFailures(model, schema, required);
|
|
2921
|
+
const shouldShowInitialError = Boolean(errors) && !changed;
|
|
2922
|
+
const shouldShowValidationError = Boolean(validations.length) && submitted;
|
|
2923
|
+
const formGroupClasses = {
|
|
2924
|
+
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
2925
|
+
};
|
|
2926
|
+
return /* @__PURE__ */ jsxs7("div", { className: (0, import_classnames3.default)("d-flex flex-column", formGroupClasses), children: [
|
|
2927
|
+
schema.title ? /* @__PURE__ */ jsx22("label", { htmlFor: id, children: schema.title }) : void 0,
|
|
2928
|
+
/* @__PURE__ */ jsx22(
|
|
2929
|
+
SelectInput,
|
|
2930
|
+
{
|
|
2931
|
+
id,
|
|
2932
|
+
multiple: true,
|
|
2933
|
+
disabled,
|
|
2934
|
+
placeholder: placeholder ? String(placeholder) : void 0,
|
|
2935
|
+
items: options.map((value, index) => ({
|
|
2936
|
+
type: "option",
|
|
2937
|
+
value: index,
|
|
2938
|
+
disabled: value.disabled
|
|
2939
|
+
})),
|
|
2940
|
+
value: selected != null ? selected : [],
|
|
2941
|
+
renderValue: (index, withinTrigger) => {
|
|
2942
|
+
const { icon, label, note, secondary } = options[index];
|
|
2943
|
+
if (withinTrigger) {
|
|
2944
|
+
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
2945
|
+
}
|
|
2946
|
+
return /* @__PURE__ */ jsx22(SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
2947
|
+
},
|
|
2948
|
+
onChange: broadcastModelChange
|
|
2949
|
+
}
|
|
2950
|
+
),
|
|
2951
|
+
/* @__PURE__ */ jsx22(
|
|
2952
|
+
ControlFeedback_default,
|
|
2953
|
+
{
|
|
2954
|
+
id: `${id}-feedback`,
|
|
2955
|
+
changed,
|
|
2956
|
+
focused: !submitted,
|
|
2957
|
+
blurred: !submitted,
|
|
2958
|
+
errors: typeof errors === "string" ? errors : void 0,
|
|
2959
|
+
submitted,
|
|
2960
|
+
schema,
|
|
2961
|
+
validations: submitted ? validations : void 0,
|
|
2962
|
+
validationMessages,
|
|
2963
|
+
infoMessage: null
|
|
2964
|
+
}
|
|
2965
|
+
)
|
|
2966
|
+
] });
|
|
2967
|
+
}
|
|
2968
|
+
var getInitialModelIndices = (model, options) => {
|
|
2969
|
+
if (model == null) {
|
|
2970
|
+
return null;
|
|
2971
|
+
}
|
|
2972
|
+
return model.map((m) => options.findIndex((o) => o.value === m)).filter((n) => n >= 0);
|
|
2973
|
+
};
|
|
2974
|
+
|
|
2745
2975
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
2746
2976
|
import { Header as Header2, Modal, NavigationOption as NavigationOption3 } from "@transferwise/components";
|
|
2747
2977
|
import { Plus } from "@transferwise/icons";
|
|
2748
|
-
import { useMemo as
|
|
2749
|
-
import { useIntl as
|
|
2978
|
+
import { useMemo as useMemo8, useState as useState8 } from "react";
|
|
2979
|
+
import { useIntl as useIntl6 } from "react-intl";
|
|
2750
2980
|
|
|
2751
2981
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
2752
2982
|
import { NavigationOption as NavigationOption2 } from "@transferwise/components";
|
|
2753
|
-
import { jsx as
|
|
2983
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2754
2984
|
function ItemSummaryOption({ item, onClick }) {
|
|
2755
|
-
return /* @__PURE__ */
|
|
2985
|
+
return /* @__PURE__ */ jsx23(
|
|
2756
2986
|
NavigationOption2,
|
|
2757
2987
|
{
|
|
2758
2988
|
media: getNavigationOptionMedia(item),
|
|
@@ -2765,8 +2995,8 @@ function ItemSummaryOption({ item, onClick }) {
|
|
|
2765
2995
|
}
|
|
2766
2996
|
|
|
2767
2997
|
// src/common/messages/repeatable.messages.ts
|
|
2768
|
-
import { defineMessages as
|
|
2769
|
-
var repeatable_messages_default =
|
|
2998
|
+
import { defineMessages as defineMessages8 } from "react-intl";
|
|
2999
|
+
var repeatable_messages_default = defineMessages8({
|
|
2770
3000
|
addItemTitle: {
|
|
2771
3001
|
id: "dynamicFlows.ArraySchema.addItemTitle",
|
|
2772
3002
|
defaultMessage: "Add Item",
|
|
@@ -2790,9 +3020,9 @@ var repeatable_messages_default = defineMessages7({
|
|
|
2790
3020
|
});
|
|
2791
3021
|
|
|
2792
3022
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
2793
|
-
import { useState as
|
|
2794
|
-
import { useIntl as
|
|
2795
|
-
import { jsx as
|
|
3023
|
+
import { useState as useState7 } from "react";
|
|
3024
|
+
import { useIntl as useIntl5 } from "react-intl";
|
|
3025
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2796
3026
|
function RepeatableSchemaStep({
|
|
2797
3027
|
type,
|
|
2798
3028
|
schema,
|
|
@@ -2802,8 +3032,8 @@ function RepeatableSchemaStep({
|
|
|
2802
3032
|
onModelChange,
|
|
2803
3033
|
onAction
|
|
2804
3034
|
}) {
|
|
2805
|
-
const { formatMessage } =
|
|
2806
|
-
const [filename, setFilename] =
|
|
3035
|
+
const { formatMessage } = useIntl5();
|
|
3036
|
+
const [filename, setFilename] = useState7(void 0);
|
|
2807
3037
|
const step = {
|
|
2808
3038
|
layout: [
|
|
2809
3039
|
{
|
|
@@ -2840,7 +3070,7 @@ function RepeatableSchemaStep({
|
|
|
2840
3070
|
}
|
|
2841
3071
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
2842
3072
|
};
|
|
2843
|
-
return /* @__PURE__ */
|
|
3073
|
+
return /* @__PURE__ */ jsx24(
|
|
2844
3074
|
DynamicFlowStep,
|
|
2845
3075
|
{
|
|
2846
3076
|
step,
|
|
@@ -3045,8 +3275,8 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
3045
3275
|
);
|
|
3046
3276
|
|
|
3047
3277
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3048
|
-
var
|
|
3049
|
-
import { jsx as
|
|
3278
|
+
var import_classnames4 = __toESM(require_classnames());
|
|
3279
|
+
import { jsx as jsx25, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3050
3280
|
function RepeatableSchema({
|
|
3051
3281
|
schema,
|
|
3052
3282
|
model,
|
|
@@ -3056,9 +3286,9 @@ function RepeatableSchema({
|
|
|
3056
3286
|
onChange
|
|
3057
3287
|
}) {
|
|
3058
3288
|
var _a;
|
|
3059
|
-
const [openModalType, setOpenModalType] =
|
|
3060
|
-
const [changed, setChanged] =
|
|
3061
|
-
const [itemSummaries, setItemSummaries] =
|
|
3289
|
+
const [openModalType, setOpenModalType] = useState8(null);
|
|
3290
|
+
const [changed, setChanged] = useState8(false);
|
|
3291
|
+
const [itemSummaries, setItemSummaries] = useState8(() => {
|
|
3062
3292
|
if (isObject(model) && !isArray(model)) {
|
|
3063
3293
|
throw new Error(
|
|
3064
3294
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -3066,8 +3296,8 @@ function RepeatableSchema({
|
|
|
3066
3296
|
}
|
|
3067
3297
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
3068
3298
|
});
|
|
3069
|
-
const [editableItem, setEditableItem] =
|
|
3070
|
-
const id =
|
|
3299
|
+
const [editableItem, setEditableItem] = useState8({ item: null, model: null });
|
|
3300
|
+
const id = useMemo8(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
3071
3301
|
const broadcastModelChange = (updatedItems) => {
|
|
3072
3302
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
3073
3303
|
onChange({
|
|
@@ -3109,7 +3339,7 @@ function RepeatableSchema({
|
|
|
3109
3339
|
setEditableItem({ item: null, model: null });
|
|
3110
3340
|
setOpenModalType(null);
|
|
3111
3341
|
};
|
|
3112
|
-
const { formatMessage } =
|
|
3342
|
+
const { formatMessage } = useIntl6();
|
|
3113
3343
|
const validations = getValidationFailures(model, schema, required);
|
|
3114
3344
|
const base64ValidationMessages = useFormattedDefaultErrorMessages({
|
|
3115
3345
|
minItems: schema.minItems,
|
|
@@ -3123,9 +3353,9 @@ function RepeatableSchema({
|
|
|
3123
3353
|
const formGroupClasses = {
|
|
3124
3354
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
3125
3355
|
};
|
|
3126
|
-
return /* @__PURE__ */
|
|
3127
|
-
schema.title && /* @__PURE__ */
|
|
3128
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */
|
|
3356
|
+
return /* @__PURE__ */ jsxs8("div", { id, className: (0, import_classnames4.default)(formGroupClasses), children: [
|
|
3357
|
+
schema.title && /* @__PURE__ */ jsx25(Header2, { title: schema.title }),
|
|
3358
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ jsx25(
|
|
3129
3359
|
ItemSummaryOption,
|
|
3130
3360
|
{
|
|
3131
3361
|
item: itemSummary,
|
|
@@ -3133,21 +3363,21 @@ function RepeatableSchema({
|
|
|
3133
3363
|
},
|
|
3134
3364
|
JSON.stringify(itemSummary)
|
|
3135
3365
|
)),
|
|
3136
|
-
/* @__PURE__ */
|
|
3366
|
+
/* @__PURE__ */ jsx25(
|
|
3137
3367
|
NavigationOption3,
|
|
3138
3368
|
{
|
|
3139
|
-
media: /* @__PURE__ */
|
|
3369
|
+
media: /* @__PURE__ */ jsx25(Plus, {}),
|
|
3140
3370
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
3141
3371
|
showMediaAtAllSizes: true,
|
|
3142
3372
|
onClick: onAddItem
|
|
3143
3373
|
}
|
|
3144
3374
|
),
|
|
3145
|
-
/* @__PURE__ */
|
|
3375
|
+
/* @__PURE__ */ jsx25(
|
|
3146
3376
|
Modal,
|
|
3147
3377
|
{
|
|
3148
3378
|
open: openModalType !== null,
|
|
3149
3379
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
3150
|
-
body: /* @__PURE__ */
|
|
3380
|
+
body: /* @__PURE__ */ jsx25(
|
|
3151
3381
|
RepeatableSchemaStep_default,
|
|
3152
3382
|
{
|
|
3153
3383
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -3162,7 +3392,7 @@ function RepeatableSchema({
|
|
|
3162
3392
|
onClose: onCancelEdit
|
|
3163
3393
|
}
|
|
3164
3394
|
),
|
|
3165
|
-
/* @__PURE__ */
|
|
3395
|
+
/* @__PURE__ */ jsx25(
|
|
3166
3396
|
ControlFeedback_default,
|
|
3167
3397
|
{
|
|
3168
3398
|
id: `${id}-feedback`,
|
|
@@ -3204,17 +3434,20 @@ var getUpdatedItemSummaries = (action, {
|
|
|
3204
3434
|
var RepeatableSchema_default = RepeatableSchema;
|
|
3205
3435
|
|
|
3206
3436
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3207
|
-
import { jsx as
|
|
3208
|
-
|
|
3437
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
3438
|
+
function ArrayListSchema(props) {
|
|
3209
3439
|
const { schema } = props;
|
|
3210
3440
|
if (isMultipleFileUploadSchema(schema)) {
|
|
3211
|
-
return /* @__PURE__ */
|
|
3441
|
+
return /* @__PURE__ */ jsx26(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3442
|
+
}
|
|
3443
|
+
if (isMultiSelectConstSchema(schema)) {
|
|
3444
|
+
return /* @__PURE__ */ jsx26(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3212
3445
|
}
|
|
3213
3446
|
if (isListArraySchema(schema)) {
|
|
3214
|
-
return /* @__PURE__ */
|
|
3447
|
+
return /* @__PURE__ */ jsx26(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
3215
3448
|
}
|
|
3216
3449
|
throw new Error("Invalid array list schema");
|
|
3217
|
-
}
|
|
3450
|
+
}
|
|
3218
3451
|
ArrayListSchema.defaultProps = {
|
|
3219
3452
|
errors: null,
|
|
3220
3453
|
required: false
|
|
@@ -3222,11 +3455,11 @@ ArrayListSchema.defaultProps = {
|
|
|
3222
3455
|
var ArrayListSchema_default = ArrayListSchema;
|
|
3223
3456
|
|
|
3224
3457
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3225
|
-
import { jsx as
|
|
3458
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
3226
3459
|
var ArraySchema = (props) => {
|
|
3227
3460
|
const { schema } = props;
|
|
3228
3461
|
if (isListArraySchema(schema)) {
|
|
3229
|
-
return /* @__PURE__ */
|
|
3462
|
+
return /* @__PURE__ */ jsx27(ArrayListSchema_default, __spreadValues({}, props));
|
|
3230
3463
|
}
|
|
3231
3464
|
throw new Error("Not implemented");
|
|
3232
3465
|
};
|
|
@@ -3236,17 +3469,17 @@ ArraySchema.defaultProps = {
|
|
|
3236
3469
|
var ArraySchema_default = ArraySchema;
|
|
3237
3470
|
|
|
3238
3471
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3239
|
-
var
|
|
3472
|
+
var import_classnames5 = __toESM(require_classnames());
|
|
3240
3473
|
import { Header as Header3 } from "@transferwise/components";
|
|
3241
|
-
import { useState as
|
|
3242
|
-
import { Fragment as
|
|
3474
|
+
import { useState as useState9, useEffect as useEffect5 } from "react";
|
|
3475
|
+
import { Fragment as Fragment4, jsx as jsx28, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3243
3476
|
var getSchemaColumnClasses2 = (width) => ({
|
|
3244
3477
|
"col-xs-12": true,
|
|
3245
3478
|
"col-sm-6": width === "md",
|
|
3246
3479
|
"col-sm-4": width === "sm"
|
|
3247
3480
|
});
|
|
3248
3481
|
function ObjectSchema(props) {
|
|
3249
|
-
const [model, setModel] =
|
|
3482
|
+
const [model, setModel] = useState9(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
3250
3483
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
3251
3484
|
if (onChangeProps.model !== null) {
|
|
3252
3485
|
model[propertyName] = onChangeProps.model;
|
|
@@ -3257,7 +3490,7 @@ function ObjectSchema(props) {
|
|
|
3257
3490
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
3258
3491
|
};
|
|
3259
3492
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
3260
|
-
|
|
3493
|
+
useEffect5(() => {
|
|
3261
3494
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
3262
3495
|
setModel(newModel);
|
|
3263
3496
|
if (!isEqual(newModel, model)) {
|
|
@@ -3275,22 +3508,22 @@ function ObjectSchema(props) {
|
|
|
3275
3508
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
3276
3509
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
3277
3510
|
const propsErrors = props.errors;
|
|
3278
|
-
return /* @__PURE__ */
|
|
3279
|
-
props.schema.alert && /* @__PURE__ */
|
|
3280
|
-
/* @__PURE__ */
|
|
3281
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */
|
|
3282
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */
|
|
3511
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
3512
|
+
props.schema.alert && /* @__PURE__ */ jsx28(DynamicAlert_default, { component: props.schema.alert }),
|
|
3513
|
+
/* @__PURE__ */ jsxs9("fieldset", { children: [
|
|
3514
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ jsx28(Header3, { title: props.schema.title, as: "legend" }),
|
|
3515
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ jsxs9("p", { children: [
|
|
3283
3516
|
" ",
|
|
3284
3517
|
props.schema.description,
|
|
3285
3518
|
" "
|
|
3286
3519
|
] }),
|
|
3287
|
-
/* @__PURE__ */
|
|
3520
|
+
/* @__PURE__ */ jsx28("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ jsx28(
|
|
3288
3521
|
"div",
|
|
3289
3522
|
{
|
|
3290
|
-
className: (0,
|
|
3523
|
+
className: (0, import_classnames5.default)(
|
|
3291
3524
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
3292
3525
|
),
|
|
3293
|
-
children: /* @__PURE__ */
|
|
3526
|
+
children: /* @__PURE__ */ jsx28(
|
|
3294
3527
|
GenericSchema_default,
|
|
3295
3528
|
{
|
|
3296
3529
|
schema: props.schema.properties[propertyName],
|
|
@@ -3316,17 +3549,17 @@ ObjectSchema.defaultProps = {
|
|
|
3316
3549
|
var ObjectSchema_default = ObjectSchema;
|
|
3317
3550
|
|
|
3318
3551
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3319
|
-
var
|
|
3552
|
+
var import_classnames6 = __toESM(require_classnames());
|
|
3320
3553
|
import { Header as Header4 } from "@transferwise/components";
|
|
3321
|
-
import { useEffect as
|
|
3554
|
+
import { useEffect as useEffect7, useMemo as useMemo9, useState as useState10 } from "react";
|
|
3322
3555
|
|
|
3323
3556
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3324
3557
|
import { Markdown, Info } from "@transferwise/components";
|
|
3325
|
-
import { useIntl as
|
|
3558
|
+
import { useIntl as useIntl7 } from "react-intl";
|
|
3326
3559
|
|
|
3327
3560
|
// src/common/messages/help.messages.ts
|
|
3328
|
-
import { defineMessages as
|
|
3329
|
-
var help_messages_default =
|
|
3561
|
+
import { defineMessages as defineMessages9 } from "react-intl";
|
|
3562
|
+
var help_messages_default = defineMessages9({
|
|
3330
3563
|
helpAria: {
|
|
3331
3564
|
id: "dynamicFlows.Help.ariaLabel",
|
|
3332
3565
|
defaultMessage: "Click here for more info.",
|
|
@@ -3335,14 +3568,14 @@ var help_messages_default = defineMessages8({
|
|
|
3335
3568
|
});
|
|
3336
3569
|
|
|
3337
3570
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3338
|
-
import { jsx as
|
|
3571
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3339
3572
|
function Help(props) {
|
|
3340
|
-
const intl =
|
|
3341
|
-
return /* @__PURE__ */
|
|
3573
|
+
const intl = useIntl7();
|
|
3574
|
+
return /* @__PURE__ */ jsx29(
|
|
3342
3575
|
Info,
|
|
3343
3576
|
{
|
|
3344
3577
|
className: "m-l-1",
|
|
3345
|
-
content: /* @__PURE__ */
|
|
3578
|
+
content: /* @__PURE__ */ jsx29(Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
3346
3579
|
presentation: "POPOVER",
|
|
3347
3580
|
size: "sm",
|
|
3348
3581
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -3352,7 +3585,7 @@ function Help(props) {
|
|
|
3352
3585
|
var Help_default = Help;
|
|
3353
3586
|
|
|
3354
3587
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3355
|
-
import { useEffect as
|
|
3588
|
+
import { useEffect as useEffect6 } from "react";
|
|
3356
3589
|
|
|
3357
3590
|
// src/legacy/formControl/FormControl.tsx
|
|
3358
3591
|
import {
|
|
@@ -3362,8 +3595,8 @@ import {
|
|
|
3362
3595
|
InputWithDisplayFormat,
|
|
3363
3596
|
PhoneNumberInput,
|
|
3364
3597
|
RadioGroup,
|
|
3365
|
-
SelectInput,
|
|
3366
|
-
SelectInputOptionContent,
|
|
3598
|
+
SelectInput as SelectInput2,
|
|
3599
|
+
SelectInputOptionContent as SelectInputOptionContent2,
|
|
3367
3600
|
Tabs,
|
|
3368
3601
|
TextareaWithDisplayFormat,
|
|
3369
3602
|
Upload
|
|
@@ -3554,7 +3787,7 @@ var autocompleteTokenMap = {
|
|
|
3554
3787
|
};
|
|
3555
3788
|
|
|
3556
3789
|
// src/legacy/formControl/FormControl.tsx
|
|
3557
|
-
import { Fragment as
|
|
3790
|
+
import { Fragment as Fragment5, jsx as jsx30 } from "react/jsx-runtime";
|
|
3558
3791
|
var _FormControl = class _FormControl extends PureComponent {
|
|
3559
3792
|
constructor(props) {
|
|
3560
3793
|
super(props);
|
|
@@ -3641,7 +3874,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3641
3874
|
} = this.props;
|
|
3642
3875
|
switch (type) {
|
|
3643
3876
|
case FormControlType.RADIO:
|
|
3644
|
-
return /* @__PURE__ */
|
|
3877
|
+
return /* @__PURE__ */ jsx30(
|
|
3645
3878
|
RadioGroup,
|
|
3646
3879
|
{
|
|
3647
3880
|
radios: options.map(this.mapOption),
|
|
@@ -3651,7 +3884,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3651
3884
|
}
|
|
3652
3885
|
);
|
|
3653
3886
|
case FormControlType.CHECKBOX:
|
|
3654
|
-
return /* @__PURE__ */
|
|
3887
|
+
return /* @__PURE__ */ jsx30(
|
|
3655
3888
|
Checkbox,
|
|
3656
3889
|
{
|
|
3657
3890
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
@@ -3668,8 +3901,8 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3668
3901
|
const search = options.length >= 8;
|
|
3669
3902
|
const items = options;
|
|
3670
3903
|
const selected = this.getSelectedOption(options);
|
|
3671
|
-
return /* @__PURE__ */
|
|
3672
|
-
|
|
3904
|
+
return /* @__PURE__ */ jsx30("div", { className: "d-flex flex-column", children: /* @__PURE__ */ jsx30(
|
|
3905
|
+
SelectInput2,
|
|
3673
3906
|
{
|
|
3674
3907
|
id,
|
|
3675
3908
|
items: items.map((value2) => ({
|
|
@@ -3678,8 +3911,8 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3678
3911
|
disabled: value2.disabled
|
|
3679
3912
|
})),
|
|
3680
3913
|
value: selected != null ? selected : null,
|
|
3681
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */
|
|
3682
|
-
|
|
3914
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ jsx30(
|
|
3915
|
+
SelectInputOptionContent2,
|
|
3683
3916
|
{
|
|
3684
3917
|
title: label2,
|
|
3685
3918
|
note: note != null ? note : secondary,
|
|
@@ -3706,13 +3939,13 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3706
3939
|
) });
|
|
3707
3940
|
}
|
|
3708
3941
|
case FormControlType.TAB:
|
|
3709
|
-
return /* @__PURE__ */
|
|
3942
|
+
return /* @__PURE__ */ jsx30(
|
|
3710
3943
|
Tabs,
|
|
3711
3944
|
{
|
|
3712
3945
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
3713
3946
|
tabs: options.map((option) => ({
|
|
3714
3947
|
title: option.label,
|
|
3715
|
-
content: /* @__PURE__ */
|
|
3948
|
+
content: /* @__PURE__ */ jsx30(Fragment5, {}),
|
|
3716
3949
|
disabled: option.disabled || false
|
|
3717
3950
|
})),
|
|
3718
3951
|
name: id,
|
|
@@ -3727,7 +3960,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3727
3960
|
);
|
|
3728
3961
|
case FormControlType.NUMERIC:
|
|
3729
3962
|
case FormControlType.NUMBER: {
|
|
3730
|
-
return /* @__PURE__ */
|
|
3963
|
+
return /* @__PURE__ */ jsx30(
|
|
3731
3964
|
"input",
|
|
3732
3965
|
{
|
|
3733
3966
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -3761,7 +3994,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3761
3994
|
);
|
|
3762
3995
|
}
|
|
3763
3996
|
case FormControlType.HIDDEN:
|
|
3764
|
-
return /* @__PURE__ */
|
|
3997
|
+
return /* @__PURE__ */ jsx30(
|
|
3765
3998
|
"input",
|
|
3766
3999
|
{
|
|
3767
4000
|
type: "hidden",
|
|
@@ -3771,7 +4004,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3771
4004
|
}
|
|
3772
4005
|
);
|
|
3773
4006
|
case FormControlType.PASSWORD:
|
|
3774
|
-
return /* @__PURE__ */
|
|
4007
|
+
return /* @__PURE__ */ jsx30(
|
|
3775
4008
|
"input",
|
|
3776
4009
|
{
|
|
3777
4010
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -3791,7 +4024,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3791
4024
|
);
|
|
3792
4025
|
case FormControlType.DATE:
|
|
3793
4026
|
case FormControlType.DATETIME:
|
|
3794
|
-
return /* @__PURE__ */
|
|
4027
|
+
return /* @__PURE__ */ jsx30(
|
|
3795
4028
|
DateInput,
|
|
3796
4029
|
{
|
|
3797
4030
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
@@ -3807,7 +4040,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3807
4040
|
}
|
|
3808
4041
|
);
|
|
3809
4042
|
case FormControlType.DATELOOKUP: {
|
|
3810
|
-
return /* @__PURE__ */
|
|
4043
|
+
return /* @__PURE__ */ jsx30(
|
|
3811
4044
|
DateLookup,
|
|
3812
4045
|
{
|
|
3813
4046
|
value: getSafeDateStringValue(value),
|
|
@@ -3825,7 +4058,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3825
4058
|
);
|
|
3826
4059
|
}
|
|
3827
4060
|
case FormControlType.TEL:
|
|
3828
|
-
return /* @__PURE__ */
|
|
4061
|
+
return /* @__PURE__ */ jsx30(
|
|
3829
4062
|
PhoneNumberInput,
|
|
3830
4063
|
{
|
|
3831
4064
|
disabled,
|
|
@@ -3857,7 +4090,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3857
4090
|
autoComplete: this.getAutocompleteValue()
|
|
3858
4091
|
};
|
|
3859
4092
|
if (this.props.displayPattern) {
|
|
3860
|
-
return /* @__PURE__ */
|
|
4093
|
+
return /* @__PURE__ */ jsx30(
|
|
3861
4094
|
TextareaWithDisplayFormat,
|
|
3862
4095
|
__spreadProps(__spreadValues({
|
|
3863
4096
|
displayPattern: this.props.displayPattern
|
|
@@ -3866,7 +4099,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3866
4099
|
})
|
|
3867
4100
|
);
|
|
3868
4101
|
}
|
|
3869
|
-
return /* @__PURE__ */
|
|
4102
|
+
return /* @__PURE__ */ jsx30(
|
|
3870
4103
|
"textarea",
|
|
3871
4104
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
3872
4105
|
"aria-describedby": describedBy,
|
|
@@ -3879,7 +4112,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3879
4112
|
return (
|
|
3880
4113
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3881
4114
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
3882
|
-
/* @__PURE__ */
|
|
4115
|
+
/* @__PURE__ */ jsx30(
|
|
3883
4116
|
Upload,
|
|
3884
4117
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3885
4118
|
usAccept: uploadProps.usAccept || "*",
|
|
@@ -3917,7 +4150,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3917
4150
|
autoComplete: this.getAutocompleteValue()
|
|
3918
4151
|
};
|
|
3919
4152
|
if (this.props.displayPattern) {
|
|
3920
|
-
return /* @__PURE__ */
|
|
4153
|
+
return /* @__PURE__ */ jsx30(
|
|
3921
4154
|
InputWithDisplayFormat,
|
|
3922
4155
|
__spreadProps(__spreadValues({
|
|
3923
4156
|
displayPattern: this.props.displayPattern
|
|
@@ -3926,7 +4159,7 @@ var _FormControl = class _FormControl extends PureComponent {
|
|
|
3926
4159
|
})
|
|
3927
4160
|
);
|
|
3928
4161
|
}
|
|
3929
|
-
return /* @__PURE__ */
|
|
4162
|
+
return /* @__PURE__ */ jsx30(
|
|
3930
4163
|
"input",
|
|
3931
4164
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
3932
4165
|
"aria-describedby": describedBy,
|
|
@@ -3974,107 +4207,8 @@ _FormControl.defaultProps = {
|
|
|
3974
4207
|
};
|
|
3975
4208
|
var FormControl = _FormControl;
|
|
3976
4209
|
|
|
3977
|
-
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
3978
|
-
import { Avatar as Avatar2, AvatarType as AvatarType2 } from "@transferwise/components";
|
|
3979
|
-
|
|
3980
|
-
// ../../node_modules/.pnpm/@wise+art@2.9.2_@transferwise+neptune-css@14.9.5_@types+react@18.0.29_react-dom@18.2.0_react@18.2.0/node_modules/@wise/art/dist/index.esm.js
|
|
3981
|
-
init_index_d9418379_esm();
|
|
3982
|
-
init_clsx();
|
|
3983
|
-
import "react";
|
|
3984
|
-
import "react/jsx-runtime";
|
|
3985
|
-
|
|
3986
|
-
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
3987
|
-
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
3988
|
-
var mapConstSchemaToOption = (schema, controlType) => {
|
|
3989
|
-
switch (controlType) {
|
|
3990
|
-
case "select":
|
|
3991
|
-
return mapConstSchemaToSelectOption(schema);
|
|
3992
|
-
case "radio":
|
|
3993
|
-
default:
|
|
3994
|
-
return mapConstSchemaToRadioOption(schema);
|
|
3995
|
-
}
|
|
3996
|
-
};
|
|
3997
|
-
var mapConstSchemaToRadioOption = (schema) => __spreadValues(__spreadValues(__spreadValues({
|
|
3998
|
-
// TODO: LOW avoid type assertion -- using || '' would fail some tests
|
|
3999
|
-
label: schema.title,
|
|
4000
|
-
value: schema.const
|
|
4001
|
-
}, getRadioOptionDescription(schema.title, schema.description)), getAvatarPropertyForRadioOption(schema)), getDisabled(schema.disabled));
|
|
4002
|
-
var mapConstSchemaToSelectOption = (schema) => __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
4003
|
-
// TODO: LOW avoid type assertion -- using || '' would fail some tests
|
|
4004
|
-
label: schema.title,
|
|
4005
|
-
value: schema.const
|
|
4006
|
-
}, getOptionDescription(schema.title, schema.description)), getIconPropertyForSelectOption(schema.icon)), mapImage(schema.image)), getDisabled(schema.disabled)), mapKeywordsToSearchStrings(schema.keywords));
|
|
4007
|
-
var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { searchStrings } : {};
|
|
4008
|
-
var mapImage = (image) => {
|
|
4009
|
-
if (image == null ? void 0 : image.url) {
|
|
4010
|
-
return {
|
|
4011
|
-
icon: /* @__PURE__ */ jsx29("div", { className: "media", children: /* @__PURE__ */ jsx29("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx29("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
4012
|
-
hideIconInTrigger: true
|
|
4013
|
-
};
|
|
4014
|
-
}
|
|
4015
|
-
return null;
|
|
4016
|
-
};
|
|
4017
|
-
var getIconPropertyForSelectOption = (icon) => {
|
|
4018
|
-
if ((icon == null ? void 0 : icon.name) && isFlagIcon(icon.name)) {
|
|
4019
|
-
return {
|
|
4020
|
-
icon: /* @__PURE__ */ jsx29(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
4021
|
-
};
|
|
4022
|
-
}
|
|
4023
|
-
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4024
|
-
return {
|
|
4025
|
-
icon: /* @__PURE__ */ jsx29(DynamicIcon_default, { type: icon.name })
|
|
4026
|
-
};
|
|
4027
|
-
}
|
|
4028
|
-
if (icon == null ? void 0 : icon.text) {
|
|
4029
|
-
return {
|
|
4030
|
-
icon: /* @__PURE__ */ jsx29("span", { children: icon.text })
|
|
4031
|
-
};
|
|
4032
|
-
}
|
|
4033
|
-
return null;
|
|
4034
|
-
};
|
|
4035
|
-
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
4036
|
-
if (image == null ? void 0 : image.url) {
|
|
4037
|
-
return {
|
|
4038
|
-
avatar: /* @__PURE__ */ jsx29(Avatar2, { type: AvatarType2.THUMBNAIL, children: /* @__PURE__ */ jsx29("img", { src: image.url, alt: "" }) })
|
|
4039
|
-
};
|
|
4040
|
-
}
|
|
4041
|
-
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
4042
|
-
return {
|
|
4043
|
-
avatar: /* @__PURE__ */ jsx29(Avatar2, { type: AvatarType2.ICON, children: /* @__PURE__ */ jsx29(DynamicIcon_default, { type: icon.name }) })
|
|
4044
|
-
};
|
|
4045
|
-
}
|
|
4046
|
-
if (icon == null ? void 0 : icon.text) {
|
|
4047
|
-
return {
|
|
4048
|
-
avatar: /* @__PURE__ */ jsx29(Avatar2, { type: AvatarType2.INITIALS, children: icon.text })
|
|
4049
|
-
};
|
|
4050
|
-
}
|
|
4051
|
-
return null;
|
|
4052
|
-
};
|
|
4053
|
-
var mapSchemaToUploadOptions = ({ accepts }) => __spreadValues({}, isArray(accepts) && { usAccept: accepts.join(",") });
|
|
4054
|
-
var getOptionDescription = (title, description) => {
|
|
4055
|
-
if (title && description) {
|
|
4056
|
-
if ((title + description).length > 50) {
|
|
4057
|
-
return { secondary: description };
|
|
4058
|
-
}
|
|
4059
|
-
return { note: description };
|
|
4060
|
-
}
|
|
4061
|
-
return void 0;
|
|
4062
|
-
};
|
|
4063
|
-
var getRadioOptionDescription = (title, description) => {
|
|
4064
|
-
if (title && description) {
|
|
4065
|
-
return { note: description };
|
|
4066
|
-
}
|
|
4067
|
-
return void 0;
|
|
4068
|
-
};
|
|
4069
|
-
var getDisabled = (disabled) => {
|
|
4070
|
-
if (!isUndefined(disabled) && !isNull(disabled)) {
|
|
4071
|
-
return { disabled };
|
|
4072
|
-
}
|
|
4073
|
-
return void 0;
|
|
4074
|
-
};
|
|
4075
|
-
|
|
4076
4210
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4077
|
-
import { jsx as
|
|
4211
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
4078
4212
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
4079
4213
|
var getControlType = (schema) => {
|
|
4080
4214
|
if (isOneOfSchema(schema)) {
|
|
@@ -4139,7 +4273,7 @@ function SchemaFormControl(props) {
|
|
|
4139
4273
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
4140
4274
|
};
|
|
4141
4275
|
const controlType = getControlType(schema);
|
|
4142
|
-
|
|
4276
|
+
useEffect6(() => {
|
|
4143
4277
|
warnIfInvalidSchema(schema, log, controlType);
|
|
4144
4278
|
}, [JSON.stringify(schema), log, controlType]);
|
|
4145
4279
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -4164,7 +4298,7 @@ function SchemaFormControl(props) {
|
|
|
4164
4298
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
4165
4299
|
describedBy
|
|
4166
4300
|
};
|
|
4167
|
-
return /* @__PURE__ */
|
|
4301
|
+
return /* @__PURE__ */ jsx31("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ jsx31(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
4168
4302
|
}
|
|
4169
4303
|
SchemaFormControl.defaultProps = {
|
|
4170
4304
|
value: null,
|
|
@@ -4193,17 +4327,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4193
4327
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4194
4328
|
|
|
4195
4329
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4196
|
-
import { Fragment as Fragment6, jsx as
|
|
4330
|
+
import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4197
4331
|
function OneOfSchema(props) {
|
|
4198
4332
|
const onEvent = useEventDispatcher();
|
|
4199
|
-
const [changed, setChanged] =
|
|
4200
|
-
const [focused, setFocused] =
|
|
4201
|
-
const [blurred, setBlurred] =
|
|
4202
|
-
const id =
|
|
4203
|
-
const [schemaIndex, setSchemaIndex] =
|
|
4333
|
+
const [changed, setChanged] = useState10(false);
|
|
4334
|
+
const [focused, setFocused] = useState10(false);
|
|
4335
|
+
const [blurred, setBlurred] = useState10(false);
|
|
4336
|
+
const id = useMemo9(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
4337
|
+
const [schemaIndex, setSchemaIndex] = useState10(
|
|
4204
4338
|
getActiveSchemaIndex(props.schema, props.model)
|
|
4205
4339
|
);
|
|
4206
|
-
const [models, setModels] =
|
|
4340
|
+
const [models, setModels] = useState10(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
4207
4341
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
4208
4342
|
const onSearchChange = (searchValue) => {
|
|
4209
4343
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -4211,7 +4345,7 @@ function OneOfSchema(props) {
|
|
|
4211
4345
|
searchValueLength: searchValue.length
|
|
4212
4346
|
});
|
|
4213
4347
|
};
|
|
4214
|
-
|
|
4348
|
+
useEffect7(() => {
|
|
4215
4349
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
4216
4350
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
4217
4351
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -4269,12 +4403,12 @@ function OneOfSchema(props) {
|
|
|
4269
4403
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
4270
4404
|
};
|
|
4271
4405
|
const feedbackId = `${id}-feedback`;
|
|
4272
|
-
return /* @__PURE__ */
|
|
4273
|
-
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */
|
|
4274
|
-
props.schema.alert && /* @__PURE__ */
|
|
4275
|
-
/* @__PURE__ */
|
|
4406
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4407
|
+
(props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4408
|
+
props.schema.alert && /* @__PURE__ */ jsx32(DynamicAlert_default, { component: props.schema.alert }),
|
|
4409
|
+
/* @__PURE__ */ jsxs10("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
|
|
4276
4410
|
getTitleAndHelp(props.schema, id),
|
|
4277
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ jsx32(
|
|
4278
4412
|
SchemaFormControl_default,
|
|
4279
4413
|
{
|
|
4280
4414
|
id,
|
|
@@ -4288,7 +4422,7 @@ function OneOfSchema(props) {
|
|
|
4288
4422
|
onSearchChange
|
|
4289
4423
|
}
|
|
4290
4424
|
),
|
|
4291
|
-
/* @__PURE__ */
|
|
4425
|
+
/* @__PURE__ */ jsx32(
|
|
4292
4426
|
ControlFeedback_default,
|
|
4293
4427
|
{
|
|
4294
4428
|
id: feedbackId,
|
|
@@ -4304,7 +4438,7 @@ function OneOfSchema(props) {
|
|
|
4304
4438
|
)
|
|
4305
4439
|
] })
|
|
4306
4440
|
] }),
|
|
4307
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */
|
|
4441
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ jsx32(
|
|
4308
4442
|
GenericSchema_default,
|
|
4309
4443
|
{
|
|
4310
4444
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -4321,16 +4455,16 @@ function OneOfSchema(props) {
|
|
|
4321
4455
|
}
|
|
4322
4456
|
function getTitleAndHelp(schema, forId) {
|
|
4323
4457
|
var _a;
|
|
4324
|
-
const helpElement = schema.help ? /* @__PURE__ */
|
|
4325
|
-
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */
|
|
4458
|
+
const helpElement = schema.help ? /* @__PURE__ */ jsx32(Help_default, { help: schema.help }) : null;
|
|
4459
|
+
const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ jsx32("div", { className: "m-b-1", children: /* @__PURE__ */ jsxs10("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
4326
4460
|
schema.title,
|
|
4327
4461
|
" ",
|
|
4328
4462
|
helpElement
|
|
4329
|
-
] }) }) : /* @__PURE__ */
|
|
4463
|
+
] }) }) : /* @__PURE__ */ jsx32(Fragment6, { children: helpElement ? /* @__PURE__ */ jsxs10("h4", { className: "m-b-2", children: [
|
|
4330
4464
|
schema.title,
|
|
4331
4465
|
" ",
|
|
4332
4466
|
helpElement
|
|
4333
|
-
] }) : /* @__PURE__ */
|
|
4467
|
+
] }) : /* @__PURE__ */ jsx32(Header4, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
4334
4468
|
return schema.title ? titleElement : helpElement;
|
|
4335
4469
|
}
|
|
4336
4470
|
function getValidations(props, schemaIndex) {
|
|
@@ -4366,13 +4500,13 @@ OneOfSchema.defaultProps = {
|
|
|
4366
4500
|
var OneOfSchema_default = OneOfSchema;
|
|
4367
4501
|
|
|
4368
4502
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4369
|
-
var
|
|
4370
|
-
import { useEffect as
|
|
4503
|
+
var import_classnames7 = __toESM(require_classnames());
|
|
4504
|
+
import { useEffect as useEffect8, useState as useState11 } from "react";
|
|
4371
4505
|
|
|
4372
4506
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4373
4507
|
import { Status as Status2, UploadInput as UploadInput2 } from "@transferwise/components";
|
|
4374
|
-
import { useMemo as
|
|
4375
|
-
import { jsx as
|
|
4508
|
+
import { useMemo as useMemo10 } from "react";
|
|
4509
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4376
4510
|
function UploadInputAdapter(props) {
|
|
4377
4511
|
const {
|
|
4378
4512
|
id,
|
|
@@ -4388,7 +4522,7 @@ function UploadInputAdapter(props) {
|
|
|
4388
4522
|
onCancel
|
|
4389
4523
|
} = props;
|
|
4390
4524
|
const onEvent = useEventDispatcher();
|
|
4391
|
-
const files =
|
|
4525
|
+
const files = useMemo10(() => fileId ? [{ id: fileId, status: Status2.SUCCEEDED }] : [], [fileId]);
|
|
4392
4526
|
const uploadFile = (formData) => {
|
|
4393
4527
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4394
4528
|
return httpClient(String(httpOptions.url), {
|
|
@@ -4405,7 +4539,7 @@ function UploadInputAdapter(props) {
|
|
|
4405
4539
|
return Promise.reject();
|
|
4406
4540
|
});
|
|
4407
4541
|
};
|
|
4408
|
-
return /* @__PURE__ */
|
|
4542
|
+
return /* @__PURE__ */ jsx33(
|
|
4409
4543
|
UploadInput2,
|
|
4410
4544
|
{
|
|
4411
4545
|
id,
|
|
@@ -4425,16 +4559,16 @@ function UploadInputAdapter(props) {
|
|
|
4425
4559
|
}
|
|
4426
4560
|
|
|
4427
4561
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4428
|
-
import { jsx as
|
|
4562
|
+
import { jsx as jsx34, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4429
4563
|
function PersistAsyncBlobSchema(props) {
|
|
4430
4564
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
4431
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] =
|
|
4432
|
-
const [persistAsyncValidations, setPersistAsyncValidations] =
|
|
4433
|
-
const [validations, setValidations] =
|
|
4434
|
-
const [changed, setChanged] =
|
|
4565
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = useState11({});
|
|
4566
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = useState11(null);
|
|
4567
|
+
const [validations, setValidations] = useState11([]);
|
|
4568
|
+
const [changed, setChanged] = useState11(false);
|
|
4435
4569
|
const httpClient = useHttpClient();
|
|
4436
4570
|
const onEvent = useEventDispatcher();
|
|
4437
|
-
|
|
4571
|
+
useEffect8(() => {
|
|
4438
4572
|
if (submitted) {
|
|
4439
4573
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
4440
4574
|
} else {
|
|
@@ -4471,8 +4605,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
4471
4605
|
};
|
|
4472
4606
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
4473
4607
|
const feedbackId = `${id}-feedback`;
|
|
4474
|
-
return /* @__PURE__ */
|
|
4475
|
-
/* @__PURE__ */
|
|
4608
|
+
return /* @__PURE__ */ jsxs11("div", { className: (0, import_classnames7.default)(formGroupClasses), children: [
|
|
4609
|
+
/* @__PURE__ */ jsx34("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ jsx34(
|
|
4476
4610
|
UploadInputAdapter,
|
|
4477
4611
|
__spreadValues({
|
|
4478
4612
|
id,
|
|
@@ -4489,7 +4623,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
4489
4623
|
onCancel
|
|
4490
4624
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
4491
4625
|
) }),
|
|
4492
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsx34(
|
|
4493
4627
|
ControlFeedback_default,
|
|
4494
4628
|
{
|
|
4495
4629
|
id: feedbackId,
|
|
@@ -4514,17 +4648,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
4514
4648
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4515
4649
|
|
|
4516
4650
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4517
|
-
import { jsx as
|
|
4651
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4518
4652
|
function PersistAsyncSchema(props) {
|
|
4519
4653
|
const { schema } = props;
|
|
4520
4654
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4521
4655
|
if (persistAsyncSchemaType === "blob") {
|
|
4522
|
-
return /* @__PURE__ */
|
|
4656
|
+
return /* @__PURE__ */ jsx35(
|
|
4523
4657
|
PersistAsyncBlobSchema_default,
|
|
4524
4658
|
__spreadValues({}, props)
|
|
4525
4659
|
);
|
|
4526
4660
|
}
|
|
4527
|
-
return /* @__PURE__ */
|
|
4661
|
+
return /* @__PURE__ */ jsx35(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
4528
4662
|
}
|
|
4529
4663
|
PersistAsyncSchema.defaultProps = {
|
|
4530
4664
|
required: false
|
|
@@ -4532,7 +4666,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
4532
4666
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4533
4667
|
|
|
4534
4668
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4535
|
-
import { useState as
|
|
4669
|
+
import { useState as useState12 } from "react";
|
|
4536
4670
|
|
|
4537
4671
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4538
4672
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -4545,7 +4679,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4545
4679
|
|
|
4546
4680
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4547
4681
|
import { Checkbox as Checkbox2 } from "@transferwise/components";
|
|
4548
|
-
import { jsx as
|
|
4682
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
4549
4683
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
4550
4684
|
const { id, selection, setSelection } = props;
|
|
4551
4685
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -4556,14 +4690,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4556
4690
|
const toggleSelection = () => {
|
|
4557
4691
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
4558
4692
|
};
|
|
4559
|
-
return /* @__PURE__ */
|
|
4693
|
+
return /* @__PURE__ */ jsx36("div", { className: "form-group", children: /* @__PURE__ */ jsx36(Checkbox2, { id, label: title, checked, onChange: toggleSelection }) });
|
|
4560
4694
|
};
|
|
4561
4695
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4562
4696
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4563
4697
|
|
|
4564
4698
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4565
4699
|
import { RadioGroup as RadioGroup2 } from "@transferwise/components";
|
|
4566
|
-
import { jsx as
|
|
4700
|
+
import { jsx as jsx37, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4567
4701
|
function PromotedOneOfRadioControl(props) {
|
|
4568
4702
|
var _a, _b;
|
|
4569
4703
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -4580,9 +4714,9 @@ function PromotedOneOfRadioControl(props) {
|
|
|
4580
4714
|
secondary: promotion.other.description
|
|
4581
4715
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
4582
4716
|
];
|
|
4583
|
-
return /* @__PURE__ */
|
|
4584
|
-
title && /* @__PURE__ */
|
|
4585
|
-
/* @__PURE__ */
|
|
4717
|
+
return /* @__PURE__ */ jsxs12("div", { className: "form-group", children: [
|
|
4718
|
+
title && /* @__PURE__ */ jsx37("label", { className: "control-label", htmlFor: id, children: title }),
|
|
4719
|
+
/* @__PURE__ */ jsx37(
|
|
4586
4720
|
RadioGroup2,
|
|
4587
4721
|
{
|
|
4588
4722
|
name: "promoted-selection",
|
|
@@ -4600,16 +4734,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
4600
4734
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4601
4735
|
|
|
4602
4736
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4603
|
-
import { Fragment as Fragment7, jsx as
|
|
4737
|
+
import { Fragment as Fragment7, jsx as jsx38 } from "react/jsx-runtime";
|
|
4604
4738
|
function PromotedOneOfControl(props) {
|
|
4605
4739
|
const controlType = props.promotion.control || "radio";
|
|
4606
4740
|
switch (controlType) {
|
|
4607
4741
|
case "radio":
|
|
4608
|
-
return /* @__PURE__ */
|
|
4742
|
+
return /* @__PURE__ */ jsx38(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
4609
4743
|
case "checkbox":
|
|
4610
|
-
return /* @__PURE__ */
|
|
4744
|
+
return /* @__PURE__ */ jsx38(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
4611
4745
|
default:
|
|
4612
|
-
return /* @__PURE__ */
|
|
4746
|
+
return /* @__PURE__ */ jsx38(Fragment7, {});
|
|
4613
4747
|
}
|
|
4614
4748
|
}
|
|
4615
4749
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -4619,20 +4753,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
4619
4753
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4620
4754
|
|
|
4621
4755
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4622
|
-
import { Fragment as Fragment8, jsx as
|
|
4756
|
+
import { Fragment as Fragment8, jsx as jsx39, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4623
4757
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4624
4758
|
var PromotedOneOfSchema = (props) => {
|
|
4625
4759
|
var _a;
|
|
4626
|
-
const [selection, setSelection] =
|
|
4760
|
+
const [selection, setSelection] = useState12(
|
|
4627
4761
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
4628
4762
|
);
|
|
4629
4763
|
const promotedAlert = props.schema.alert;
|
|
4630
4764
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
4631
4765
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
4632
4766
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
4633
|
-
return /* @__PURE__ */
|
|
4634
|
-
promotedAlert && /* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4767
|
+
return /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
4768
|
+
promotedAlert && /* @__PURE__ */ jsx39(DynamicAlert_default, { component: promotedAlert }),
|
|
4769
|
+
/* @__PURE__ */ jsx39(
|
|
4636
4770
|
PromotedOneOfControl_default,
|
|
4637
4771
|
{
|
|
4638
4772
|
id: props.schema.$id,
|
|
@@ -4643,8 +4777,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
4643
4777
|
setSelection
|
|
4644
4778
|
}
|
|
4645
4779
|
),
|
|
4646
|
-
selection === "promoted" && /* @__PURE__ */
|
|
4647
|
-
selection === "other" && /* @__PURE__ */
|
|
4780
|
+
selection === "promoted" && /* @__PURE__ */ jsx39(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
4781
|
+
selection === "other" && /* @__PURE__ */ jsx39(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
4648
4782
|
] });
|
|
4649
4783
|
};
|
|
4650
4784
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -4675,11 +4809,11 @@ var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
|
4675
4809
|
|
|
4676
4810
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4677
4811
|
import { DefinitionList, Layout } from "@transferwise/components";
|
|
4678
|
-
import { useIntl as
|
|
4812
|
+
import { useIntl as useIntl8 } from "react-intl";
|
|
4679
4813
|
|
|
4680
4814
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
|
|
4681
|
-
import { defineMessages as
|
|
4682
|
-
var ReadOnlySchema_messages_default =
|
|
4815
|
+
import { defineMessages as defineMessages10 } from "react-intl";
|
|
4816
|
+
var ReadOnlySchema_messages_default = defineMessages10({
|
|
4683
4817
|
yes: {
|
|
4684
4818
|
id: "dynamicFlows.ReadOnlySchema.yes",
|
|
4685
4819
|
defaultMessage: "Yes",
|
|
@@ -4693,12 +4827,12 @@ var ReadOnlySchema_messages_default = defineMessages9({
|
|
|
4693
4827
|
});
|
|
4694
4828
|
|
|
4695
4829
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4696
|
-
import { Fragment as Fragment9, jsx as
|
|
4830
|
+
import { Fragment as Fragment9, jsx as jsx40, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4697
4831
|
function ReadOnlySchema({ schema, model }) {
|
|
4698
4832
|
const { title = "" } = schema;
|
|
4699
|
-
const { formatMessage } =
|
|
4833
|
+
const { formatMessage } = useIntl8();
|
|
4700
4834
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4701
|
-
return /* @__PURE__ */
|
|
4835
|
+
return /* @__PURE__ */ jsx40(DefinitionList, { layout: Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4702
4836
|
}
|
|
4703
4837
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4704
4838
|
function getValueForSchema({
|
|
@@ -4731,7 +4865,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
4731
4865
|
function getValueFromOption(option) {
|
|
4732
4866
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
4733
4867
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
4734
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */
|
|
4868
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
4735
4869
|
icon.avatar,
|
|
4736
4870
|
" ",
|
|
4737
4871
|
text
|
|
@@ -4739,22 +4873,22 @@ function getValueFromOption(option) {
|
|
|
4739
4873
|
}
|
|
4740
4874
|
|
|
4741
4875
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4742
|
-
import { useEffect as
|
|
4743
|
-
import { jsx as
|
|
4876
|
+
import { useEffect as useEffect9, useRef, useState as useState13 } from "react";
|
|
4877
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
4744
4878
|
function ValidationAsyncSchema(props) {
|
|
4745
4879
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4746
|
-
const [validationAsyncModel, setValidationAsyncModel] =
|
|
4880
|
+
const [validationAsyncModel, setValidationAsyncModel] = useState13(model);
|
|
4747
4881
|
const previousRequestedModelReference = useRef(null);
|
|
4748
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] =
|
|
4882
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = useState13(
|
|
4749
4883
|
null
|
|
4750
4884
|
);
|
|
4751
|
-
const [validationAsyncErrors, setValidationAsyncErrors] =
|
|
4752
|
-
const [fieldSubmitted, setFieldSubmitted] =
|
|
4753
|
-
const [abortController, setAbortController] =
|
|
4885
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = useState13(null);
|
|
4886
|
+
const [fieldSubmitted, setFieldSubmitted] = useState13(false);
|
|
4887
|
+
const [abortController, setAbortController] = useState13(null);
|
|
4754
4888
|
const httpClient = useHttpClient();
|
|
4755
4889
|
const onEvent = useEventDispatcher();
|
|
4756
4890
|
const log = useLogger();
|
|
4757
|
-
|
|
4891
|
+
useEffect9(() => {
|
|
4758
4892
|
if (!schema.validationAsync.method) {
|
|
4759
4893
|
log.warning(
|
|
4760
4894
|
"Invalid schema or model",
|
|
@@ -4824,20 +4958,20 @@ function ValidationAsyncSchema(props) {
|
|
|
4824
4958
|
required,
|
|
4825
4959
|
schema
|
|
4826
4960
|
};
|
|
4827
|
-
return /* @__PURE__ */
|
|
4961
|
+
return /* @__PURE__ */ jsx41(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
4828
4962
|
}
|
|
4829
4963
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
4830
4964
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
4831
4965
|
|
|
4832
4966
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4833
|
-
import { Fragment as Fragment10, jsx as
|
|
4967
|
+
import { Fragment as Fragment10, jsx as jsx42 } from "react/jsx-runtime";
|
|
4834
4968
|
import { createElement } from "react";
|
|
4835
4969
|
function GenericSchemaForm(props) {
|
|
4836
4970
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
4837
4971
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
4838
4972
|
const type = getSchemaType(schema);
|
|
4839
4973
|
const log = useLogger();
|
|
4840
|
-
|
|
4974
|
+
useEffect10(() => {
|
|
4841
4975
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
4842
4976
|
log.error(
|
|
4843
4977
|
"Invalid schema or model",
|
|
@@ -4847,29 +4981,29 @@ function GenericSchemaForm(props) {
|
|
|
4847
4981
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
4848
4982
|
switch (type) {
|
|
4849
4983
|
case "readOnly":
|
|
4850
|
-
return /* @__PURE__ */
|
|
4984
|
+
return /* @__PURE__ */ jsx42(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
4851
4985
|
case "persistAsync":
|
|
4852
|
-
return /* @__PURE__ */
|
|
4986
|
+
return /* @__PURE__ */ jsx42(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4853
4987
|
case "validationAsync":
|
|
4854
|
-
return /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsx42(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
4855
4989
|
case "basic": {
|
|
4856
4990
|
const basicTypeProps = __spreadValues({
|
|
4857
4991
|
infoMessage: null
|
|
4858
4992
|
}, schemaProps);
|
|
4859
|
-
return /* @__PURE__ */
|
|
4993
|
+
return /* @__PURE__ */ jsx42(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
4860
4994
|
}
|
|
4861
4995
|
case "object":
|
|
4862
4996
|
return /* @__PURE__ */ createElement(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
4863
4997
|
case "array":
|
|
4864
|
-
return /* @__PURE__ */
|
|
4998
|
+
return /* @__PURE__ */ jsx42(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
4865
4999
|
case "promotedOneOf":
|
|
4866
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ jsx42(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4867
5001
|
case "oneOf":
|
|
4868
|
-
return /* @__PURE__ */
|
|
5002
|
+
return /* @__PURE__ */ jsx42(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
4869
5003
|
case "allOf":
|
|
4870
|
-
return /* @__PURE__ */
|
|
5004
|
+
return /* @__PURE__ */ jsx42(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
4871
5005
|
}
|
|
4872
|
-
return /* @__PURE__ */
|
|
5006
|
+
return /* @__PURE__ */ jsx42(Fragment10, {});
|
|
4873
5007
|
}
|
|
4874
5008
|
var GenericSchema_default = GenericSchemaForm;
|
|
4875
5009
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -4896,7 +5030,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
4896
5030
|
};
|
|
4897
5031
|
|
|
4898
5032
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
4899
|
-
import { jsx as
|
|
5033
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
4900
5034
|
function DynamicForm({
|
|
4901
5035
|
component,
|
|
4902
5036
|
model = null,
|
|
@@ -4906,7 +5040,7 @@ function DynamicForm({
|
|
|
4906
5040
|
onPersistAsync
|
|
4907
5041
|
}) {
|
|
4908
5042
|
const formSchema = component.schema;
|
|
4909
|
-
return /* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ jsx43("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ jsx43(
|
|
4910
5044
|
GenericSchema_default,
|
|
4911
5045
|
{
|
|
4912
5046
|
schema: formSchema,
|
|
@@ -4923,64 +5057,64 @@ function DynamicForm({
|
|
|
4923
5057
|
var DynamicForm_default = DynamicForm;
|
|
4924
5058
|
|
|
4925
5059
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
4926
|
-
var
|
|
5060
|
+
var import_classnames8 = __toESM(require_classnames());
|
|
4927
5061
|
import { Display } from "@transferwise/components";
|
|
4928
|
-
import { jsx as
|
|
5062
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
4929
5063
|
var DynamicHeading = (props) => {
|
|
4930
5064
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
4931
|
-
const classes = (0,
|
|
4932
|
-
return control === "display" ? /* @__PURE__ */
|
|
5065
|
+
const classes = (0, import_classnames8.default)(getTextAlignmentAndMargin({ align, margin }));
|
|
5066
|
+
return control === "display" ? /* @__PURE__ */ jsx44(DisplayHeading, { size, text, classes }) : /* @__PURE__ */ jsx44(StandardHeading, { size, text, classes });
|
|
4933
5067
|
};
|
|
4934
5068
|
var StandardHeading = ({ size, text, classes }) => {
|
|
4935
5069
|
switch (size) {
|
|
4936
5070
|
case "xs":
|
|
4937
|
-
return /* @__PURE__ */
|
|
5071
|
+
return /* @__PURE__ */ jsx44("h5", { className: classes, children: text });
|
|
4938
5072
|
case "sm":
|
|
4939
|
-
return /* @__PURE__ */
|
|
5073
|
+
return /* @__PURE__ */ jsx44("h4", { className: classes, children: text });
|
|
4940
5074
|
case "lg":
|
|
4941
|
-
return /* @__PURE__ */
|
|
5075
|
+
return /* @__PURE__ */ jsx44("h2", { className: classes, children: text });
|
|
4942
5076
|
case "xl":
|
|
4943
|
-
return /* @__PURE__ */
|
|
5077
|
+
return /* @__PURE__ */ jsx44("h1", { className: classes, children: text });
|
|
4944
5078
|
case "md":
|
|
4945
5079
|
default:
|
|
4946
|
-
return /* @__PURE__ */
|
|
5080
|
+
return /* @__PURE__ */ jsx44("h3", { className: classes, children: text });
|
|
4947
5081
|
}
|
|
4948
5082
|
};
|
|
4949
5083
|
var DisplayHeading = ({ size, text, classes }) => {
|
|
4950
5084
|
switch (size) {
|
|
4951
5085
|
case "xs":
|
|
4952
5086
|
case "sm":
|
|
4953
|
-
return /* @__PURE__ */
|
|
5087
|
+
return /* @__PURE__ */ jsx44(Display, { type: "display-small", className: classes, children: text });
|
|
4954
5088
|
case "xl":
|
|
4955
5089
|
case "lg":
|
|
4956
|
-
return /* @__PURE__ */
|
|
5090
|
+
return /* @__PURE__ */ jsx44(Display, { type: "display-large", className: classes, children: text });
|
|
4957
5091
|
case "md":
|
|
4958
5092
|
default:
|
|
4959
|
-
return /* @__PURE__ */
|
|
5093
|
+
return /* @__PURE__ */ jsx44(Display, { type: "display-medium", className: classes, children: text });
|
|
4960
5094
|
}
|
|
4961
5095
|
};
|
|
4962
5096
|
var DynamicHeading_default = DynamicHeading;
|
|
4963
5097
|
|
|
4964
5098
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
4965
5099
|
import { Markdown as Markdown2 } from "@transferwise/components";
|
|
4966
|
-
import { jsx as
|
|
5100
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
4967
5101
|
var DynamicMarkdown = ({ component }) => {
|
|
4968
5102
|
const { content, align, margin } = component;
|
|
4969
|
-
return /* @__PURE__ */
|
|
5103
|
+
return /* @__PURE__ */ jsx45("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ jsx45(Markdown2, { config: { link: { target: "_blank" } }, children: content }) });
|
|
4970
5104
|
};
|
|
4971
5105
|
var DynamicInfo = ({ component }) => {
|
|
4972
|
-
return /* @__PURE__ */
|
|
5106
|
+
return /* @__PURE__ */ jsx45("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ jsx45(Markdown2, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
4973
5107
|
};
|
|
4974
5108
|
|
|
4975
5109
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
4976
5110
|
import { Image } from "@transferwise/components";
|
|
4977
|
-
import { useEffect as
|
|
4978
|
-
import { jsx as
|
|
5111
|
+
import { useEffect as useEffect11, useState as useState14 } from "react";
|
|
5112
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
4979
5113
|
function DynamicImage({ component: image }) {
|
|
4980
5114
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
4981
5115
|
const httpClient = useHttpClient();
|
|
4982
|
-
const [imageSource, setImageSource] =
|
|
4983
|
-
|
|
5116
|
+
const [imageSource, setImageSource] = useState14("");
|
|
5117
|
+
useEffect11(() => {
|
|
4984
5118
|
void getImageSource(httpClient, url).then(setImageSource);
|
|
4985
5119
|
}, [url, httpClient]);
|
|
4986
5120
|
const imageProps = {
|
|
@@ -4992,7 +5126,7 @@ function DynamicImage({ component: image }) {
|
|
|
4992
5126
|
if (!imageSource) {
|
|
4993
5127
|
return null;
|
|
4994
5128
|
}
|
|
4995
|
-
return /* @__PURE__ */
|
|
5129
|
+
return /* @__PURE__ */ jsx46("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ jsx46(Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
|
|
4996
5130
|
}
|
|
4997
5131
|
var readImageBlobAsDataURL = (imageBlob) => (
|
|
4998
5132
|
// we can safely assume the type of reader.result is string
|
|
@@ -5029,47 +5163,47 @@ var DynamicImage_default = DynamicImage;
|
|
|
5029
5163
|
|
|
5030
5164
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
5031
5165
|
import { Header as Header5, InstructionsList } from "@transferwise/components";
|
|
5032
|
-
import { jsx as
|
|
5166
|
+
import { jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5033
5167
|
var doContext = ["positive", "neutral"];
|
|
5034
5168
|
var dontContext = ["warning", "negative"];
|
|
5035
5169
|
var DynamicInstructions = ({ component }) => {
|
|
5036
5170
|
const { items } = component;
|
|
5037
5171
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
5038
5172
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
5039
|
-
return /* @__PURE__ */
|
|
5040
|
-
component.title ? /* @__PURE__ */
|
|
5041
|
-
/* @__PURE__ */
|
|
5173
|
+
return /* @__PURE__ */ jsxs15("div", { className: getMargin(component.margin || "md"), children: [
|
|
5174
|
+
component.title ? /* @__PURE__ */ jsx47(Header5, { title: component.title }) : null,
|
|
5175
|
+
/* @__PURE__ */ jsx47(InstructionsList, { dos, donts })
|
|
5042
5176
|
] });
|
|
5043
5177
|
};
|
|
5044
5178
|
var DynamicInstructions_default = DynamicInstructions;
|
|
5045
5179
|
|
|
5046
5180
|
// src/legacy/layout/DynamicLayout.tsx
|
|
5047
|
-
import { Fragment as Fragment11, jsx as
|
|
5181
|
+
import { Fragment as Fragment11, jsx as jsx48 } from "react/jsx-runtime";
|
|
5048
5182
|
var getKey = (component) => JSON.stringify(component);
|
|
5049
5183
|
function DynamicLayout(props) {
|
|
5050
5184
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
5051
5185
|
const renderComponent = (component) => {
|
|
5052
5186
|
switch (component.type) {
|
|
5053
5187
|
case "heading":
|
|
5054
|
-
return /* @__PURE__ */
|
|
5188
|
+
return /* @__PURE__ */ jsx48(DynamicHeading_default, { component }, getKey(component));
|
|
5055
5189
|
case "paragraph":
|
|
5056
|
-
return /* @__PURE__ */
|
|
5190
|
+
return /* @__PURE__ */ jsx48(DynamicParagraph_default, { component }, getKey(component));
|
|
5057
5191
|
case "image":
|
|
5058
|
-
return /* @__PURE__ */
|
|
5192
|
+
return /* @__PURE__ */ jsx48(DynamicImage_default, { component }, getKey(component));
|
|
5059
5193
|
case "alert":
|
|
5060
|
-
return /* @__PURE__ */
|
|
5194
|
+
return /* @__PURE__ */ jsx48(DynamicAlert_default, { component }, getKey(component));
|
|
5061
5195
|
case "review":
|
|
5062
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx48(DynamicReview_default, { component, onAction }, getKey(component));
|
|
5063
5197
|
case "divider":
|
|
5064
|
-
return /* @__PURE__ */
|
|
5198
|
+
return /* @__PURE__ */ jsx48(DynamicDivider_default, { component }, getKey(component));
|
|
5065
5199
|
case "info":
|
|
5066
|
-
return /* @__PURE__ */
|
|
5200
|
+
return /* @__PURE__ */ jsx48(DynamicInfo, { component }, getKey(component));
|
|
5067
5201
|
case "instructions":
|
|
5068
|
-
return /* @__PURE__ */
|
|
5202
|
+
return /* @__PURE__ */ jsx48(DynamicInstructions_default, { component }, getKey(component));
|
|
5069
5203
|
case "markdown":
|
|
5070
|
-
return /* @__PURE__ */
|
|
5204
|
+
return /* @__PURE__ */ jsx48(DynamicMarkdown, { component }, getKey(component));
|
|
5071
5205
|
case "columns":
|
|
5072
|
-
return /* @__PURE__ */
|
|
5206
|
+
return /* @__PURE__ */ jsx48(
|
|
5073
5207
|
DynamicColumns_default,
|
|
5074
5208
|
{
|
|
5075
5209
|
component,
|
|
@@ -5083,7 +5217,7 @@ function DynamicLayout(props) {
|
|
|
5083
5217
|
getKey(component)
|
|
5084
5218
|
);
|
|
5085
5219
|
case "form":
|
|
5086
|
-
return /* @__PURE__ */
|
|
5220
|
+
return /* @__PURE__ */ jsx48(
|
|
5087
5221
|
DynamicForm_default,
|
|
5088
5222
|
{
|
|
5089
5223
|
component,
|
|
@@ -5096,9 +5230,9 @@ function DynamicLayout(props) {
|
|
|
5096
5230
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
5097
5231
|
);
|
|
5098
5232
|
case "button":
|
|
5099
|
-
return /* @__PURE__ */
|
|
5233
|
+
return /* @__PURE__ */ jsx48(DynamicButton_default, { component, onAction }, getKey(component));
|
|
5100
5234
|
case "box":
|
|
5101
|
-
return /* @__PURE__ */
|
|
5235
|
+
return /* @__PURE__ */ jsx48(
|
|
5102
5236
|
DynamicBox_default,
|
|
5103
5237
|
{
|
|
5104
5238
|
component,
|
|
@@ -5112,18 +5246,18 @@ function DynamicLayout(props) {
|
|
|
5112
5246
|
getKey(component)
|
|
5113
5247
|
);
|
|
5114
5248
|
case "decision":
|
|
5115
|
-
return /* @__PURE__ */
|
|
5249
|
+
return /* @__PURE__ */ jsx48(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
5116
5250
|
case "external":
|
|
5117
|
-
return /* @__PURE__ */
|
|
5251
|
+
return /* @__PURE__ */ jsx48(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
5118
5252
|
case "list":
|
|
5119
5253
|
case "status-list":
|
|
5120
|
-
return /* @__PURE__ */
|
|
5254
|
+
return /* @__PURE__ */ jsx48(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
5121
5255
|
case "loading-indicator":
|
|
5122
|
-
return /* @__PURE__ */
|
|
5256
|
+
return /* @__PURE__ */ jsx48(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5123
5257
|
case "search":
|
|
5124
|
-
return /* @__PURE__ */
|
|
5258
|
+
return /* @__PURE__ */ jsx48(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5125
5259
|
case "modal":
|
|
5126
|
-
return /* @__PURE__ */
|
|
5260
|
+
return /* @__PURE__ */ jsx48(
|
|
5127
5261
|
DynamicModal_default,
|
|
5128
5262
|
{
|
|
5129
5263
|
component,
|
|
@@ -5137,22 +5271,22 @@ function DynamicLayout(props) {
|
|
|
5137
5271
|
getKey(component)
|
|
5138
5272
|
);
|
|
5139
5273
|
default:
|
|
5140
|
-
return /* @__PURE__ */
|
|
5274
|
+
return /* @__PURE__ */ jsx48("div", {}, getKey(component));
|
|
5141
5275
|
}
|
|
5142
5276
|
};
|
|
5143
5277
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5144
|
-
return /* @__PURE__ */
|
|
5278
|
+
return /* @__PURE__ */ jsx48(Fragment11, { children: components.map(renderComponent) });
|
|
5145
5279
|
}
|
|
5146
|
-
return /* @__PURE__ */
|
|
5280
|
+
return /* @__PURE__ */ jsx48(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5147
5281
|
}
|
|
5148
5282
|
var DynamicLayout_default = DynamicLayout;
|
|
5149
5283
|
|
|
5150
5284
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
5151
5285
|
import { Header as Header6, Summary } from "@transferwise/components";
|
|
5152
|
-
import { jsx as
|
|
5286
|
+
import { jsx as jsx49, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5153
5287
|
var DynamicStatusList = ({ component }) => {
|
|
5154
|
-
return /* @__PURE__ */
|
|
5155
|
-
component.title ? /* @__PURE__ */
|
|
5288
|
+
return /* @__PURE__ */ jsxs16("div", { className: getMargin(component.margin || "md"), children: [
|
|
5289
|
+
component.title ? /* @__PURE__ */ jsx49(Header6, { title: component.title }) : null,
|
|
5156
5290
|
component.items.map(mapListItemToSummary)
|
|
5157
5291
|
] });
|
|
5158
5292
|
};
|
|
@@ -5161,8 +5295,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5161
5295
|
key: `${title}/${description || ""}`,
|
|
5162
5296
|
title,
|
|
5163
5297
|
description
|
|
5164
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */
|
|
5165
|
-
return /* @__PURE__ */
|
|
5298
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ jsx49(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
5299
|
+
return /* @__PURE__ */ jsx49(Summary, __spreadValues({}, props));
|
|
5166
5300
|
};
|
|
5167
5301
|
var statusListMap = {
|
|
5168
5302
|
done: "done",
|
|
@@ -5179,10 +5313,10 @@ var DynamicStatusList_default = DynamicStatusList;
|
|
|
5179
5313
|
|
|
5180
5314
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5181
5315
|
import { Loader as Loader2 } from "@transferwise/components";
|
|
5182
|
-
import { jsx as
|
|
5316
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5183
5317
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5184
5318
|
const { margin = "md", size = "md" } = component;
|
|
5185
|
-
return /* @__PURE__ */
|
|
5319
|
+
return /* @__PURE__ */ jsx50(
|
|
5186
5320
|
Loader2,
|
|
5187
5321
|
{
|
|
5188
5322
|
size,
|
|
@@ -5197,11 +5331,11 @@ var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
|
5197
5331
|
|
|
5198
5332
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5199
5333
|
import { Button as Button3 } from "@transferwise/components";
|
|
5200
|
-
import { useIntl as
|
|
5334
|
+
import { useIntl as useIntl9 } from "react-intl";
|
|
5201
5335
|
|
|
5202
5336
|
// src/common/messages/paragraph.messages.ts
|
|
5203
|
-
import { defineMessages as
|
|
5204
|
-
var paragraph_messages_default =
|
|
5337
|
+
import { defineMessages as defineMessages11 } from "react-intl";
|
|
5338
|
+
var paragraph_messages_default = defineMessages11({
|
|
5205
5339
|
copy: {
|
|
5206
5340
|
id: "dynamicFlows.DynamicParagraph.copy",
|
|
5207
5341
|
defaultMessage: "Copy",
|
|
@@ -5225,41 +5359,41 @@ function noop2() {
|
|
|
5225
5359
|
}
|
|
5226
5360
|
|
|
5227
5361
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5228
|
-
import { jsx as
|
|
5362
|
+
import { jsx as jsx51, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5229
5363
|
function DynamicParagraph({ component }) {
|
|
5230
|
-
return component.control === "copyable" ? /* @__PURE__ */
|
|
5364
|
+
return component.control === "copyable" ? /* @__PURE__ */ jsx51(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ jsx51(BasicDynamicParagraph, { component });
|
|
5231
5365
|
}
|
|
5232
5366
|
function BasicDynamicParagraph({ component }) {
|
|
5233
|
-
return /* @__PURE__ */
|
|
5367
|
+
return /* @__PURE__ */ jsxs17("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
5234
5368
|
" ",
|
|
5235
5369
|
component.text,
|
|
5236
5370
|
" "
|
|
5237
5371
|
] });
|
|
5238
5372
|
}
|
|
5239
5373
|
function CopyableDynamicParagraph({ component }) {
|
|
5240
|
-
const { formatMessage } =
|
|
5374
|
+
const { formatMessage } = useIntl9();
|
|
5241
5375
|
const createSnackbar = useSnackBarIfAvailable();
|
|
5242
5376
|
const { text } = component;
|
|
5243
5377
|
const copy = () => {
|
|
5244
5378
|
var _a;
|
|
5245
5379
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(noop3);
|
|
5246
5380
|
};
|
|
5247
|
-
const
|
|
5381
|
+
const classNames16 = `${getTextAlignmentAndMargin({
|
|
5248
5382
|
align: component.align,
|
|
5249
5383
|
margin: "sm"
|
|
5250
5384
|
})} form-control`;
|
|
5251
|
-
return /* @__PURE__ */
|
|
5252
|
-
/* @__PURE__ */
|
|
5385
|
+
return /* @__PURE__ */ jsxs17("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5386
|
+
/* @__PURE__ */ jsx51(
|
|
5253
5387
|
"input",
|
|
5254
5388
|
{
|
|
5255
5389
|
type: "text",
|
|
5256
|
-
className:
|
|
5390
|
+
className: classNames16,
|
|
5257
5391
|
value: text,
|
|
5258
5392
|
readOnly: true,
|
|
5259
5393
|
style: { textOverflow: "ellipsis" }
|
|
5260
5394
|
}
|
|
5261
5395
|
),
|
|
5262
|
-
/* @__PURE__ */
|
|
5396
|
+
/* @__PURE__ */ jsx51(Button3, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
5263
5397
|
] });
|
|
5264
5398
|
}
|
|
5265
5399
|
function noop3() {
|
|
@@ -5268,7 +5402,7 @@ var DynamicParagraph_default = DynamicParagraph;
|
|
|
5268
5402
|
|
|
5269
5403
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
5270
5404
|
import { DefinitionList as DefinitionList2, Header as Header7 } from "@transferwise/components";
|
|
5271
|
-
import { Fragment as Fragment12, jsx as
|
|
5405
|
+
import { Fragment as Fragment12, jsx as jsx52, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5272
5406
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
5273
5407
|
key: String(index),
|
|
5274
5408
|
title: label,
|
|
@@ -5276,14 +5410,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
5276
5410
|
}));
|
|
5277
5411
|
var getFieldValue = (value, help, orientation) => {
|
|
5278
5412
|
if (help) {
|
|
5279
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */
|
|
5280
|
-
/* @__PURE__ */
|
|
5413
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs18(Fragment12, { children: [
|
|
5414
|
+
/* @__PURE__ */ jsx52(Help_default, { help }),
|
|
5281
5415
|
" ",
|
|
5282
5416
|
value
|
|
5283
|
-
] }) : /* @__PURE__ */
|
|
5417
|
+
] }) : /* @__PURE__ */ jsxs18(Fragment12, { children: [
|
|
5284
5418
|
value,
|
|
5285
5419
|
" ",
|
|
5286
|
-
/* @__PURE__ */
|
|
5420
|
+
/* @__PURE__ */ jsx52(Help_default, { help })
|
|
5287
5421
|
] });
|
|
5288
5422
|
}
|
|
5289
5423
|
return value;
|
|
@@ -5308,23 +5442,23 @@ function DynamicReview(props) {
|
|
|
5308
5442
|
const orientation = getReviewLayout(review);
|
|
5309
5443
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
5310
5444
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
5311
|
-
return /* @__PURE__ */
|
|
5312
|
-
review.title && /* @__PURE__ */
|
|
5313
|
-
/* @__PURE__ */
|
|
5445
|
+
return /* @__PURE__ */ jsxs18("div", { className: margin, children: [
|
|
5446
|
+
review.title && /* @__PURE__ */ jsx52(Header7, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
5447
|
+
/* @__PURE__ */ jsx52("div", { className: margin, children: /* @__PURE__ */ jsx52(DefinitionList2, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5314
5448
|
] });
|
|
5315
5449
|
}
|
|
5316
5450
|
var DynamicReview_default = DynamicReview;
|
|
5317
5451
|
|
|
5318
5452
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5319
|
-
import { useMemo as
|
|
5453
|
+
import { useMemo as useMemo11, useState as useState16 } from "react";
|
|
5320
5454
|
|
|
5321
5455
|
// src/legacy/layout/search/SearchInput.tsx
|
|
5322
5456
|
import { Input } from "@transferwise/components";
|
|
5323
|
-
import { jsx as
|
|
5457
|
+
import { jsx as jsx53, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5324
5458
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5325
|
-
return /* @__PURE__ */
|
|
5459
|
+
return /* @__PURE__ */ jsxs19("label", { className: "control-label d-inline", children: [
|
|
5326
5460
|
title,
|
|
5327
|
-
/* @__PURE__ */
|
|
5461
|
+
/* @__PURE__ */ jsx53(
|
|
5328
5462
|
Input,
|
|
5329
5463
|
{
|
|
5330
5464
|
type: "text",
|
|
@@ -5339,13 +5473,13 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
5339
5473
|
|
|
5340
5474
|
// src/legacy/layout/search/SearchResults.tsx
|
|
5341
5475
|
import { NavigationOption as NavigationOption4, NavigationOptionsList as NavigationOptionsList2 } from "@transferwise/components";
|
|
5342
|
-
import { useIntl as
|
|
5343
|
-
import { jsx as
|
|
5476
|
+
import { useIntl as useIntl10 } from "react-intl";
|
|
5477
|
+
import { jsx as jsx54, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
5344
5478
|
function SearchResults({ results, emptyMessage, onSelect }) {
|
|
5345
5479
|
if (results.length === 0) {
|
|
5346
|
-
return /* @__PURE__ */
|
|
5480
|
+
return /* @__PURE__ */ jsx54("p", { className: "m-t-2", children: emptyMessage });
|
|
5347
5481
|
}
|
|
5348
|
-
return /* @__PURE__ */
|
|
5482
|
+
return /* @__PURE__ */ jsx54(NavigationOptionsList2, { children: results.map((result) => /* @__PURE__ */ jsx54(
|
|
5349
5483
|
NavigationOption4,
|
|
5350
5484
|
{
|
|
5351
5485
|
title: result.title,
|
|
@@ -5359,11 +5493,11 @@ function SearchResults({ results, emptyMessage, onSelect }) {
|
|
|
5359
5493
|
)) });
|
|
5360
5494
|
}
|
|
5361
5495
|
function ErrorResult({ onRetrySearch }) {
|
|
5362
|
-
const intl =
|
|
5363
|
-
return /* @__PURE__ */
|
|
5496
|
+
const intl = useIntl10();
|
|
5497
|
+
return /* @__PURE__ */ jsxs20("p", { className: "m-t-2", children: [
|
|
5364
5498
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
5365
5499
|
"\xA0",
|
|
5366
|
-
/* @__PURE__ */
|
|
5500
|
+
/* @__PURE__ */ jsx54(
|
|
5367
5501
|
"a",
|
|
5368
5502
|
{
|
|
5369
5503
|
href: "/",
|
|
@@ -5378,10 +5512,10 @@ function ErrorResult({ onRetrySearch }) {
|
|
|
5378
5512
|
}
|
|
5379
5513
|
|
|
5380
5514
|
// src/legacy/layout/search/useSearch.tsx
|
|
5381
|
-
import { useCallback as useCallback5, useRef as useRef2, useState as
|
|
5515
|
+
import { useCallback as useCallback5, useRef as useRef2, useState as useState15 } from "react";
|
|
5382
5516
|
var headers = { "Content-Type": "application/json" };
|
|
5383
5517
|
var useSearch = (defaultSearchConfig) => {
|
|
5384
|
-
const [state, setState] =
|
|
5518
|
+
const [state, setState] = useState15({
|
|
5385
5519
|
status: "idle"
|
|
5386
5520
|
});
|
|
5387
5521
|
const abortControllerRef = useRef2(null);
|
|
@@ -5447,14 +5581,14 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5447
5581
|
};
|
|
5448
5582
|
|
|
5449
5583
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5450
|
-
import { jsx as
|
|
5584
|
+
import { jsx as jsx55, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
5451
5585
|
var DEBOUNCE_TIME = 400;
|
|
5452
5586
|
function DynamicSearch({ component, onAction }) {
|
|
5453
|
-
const [query, setQuery] =
|
|
5587
|
+
const [query, setQuery] = useState16("");
|
|
5454
5588
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5455
5589
|
const { status, results, search } = useSearch({ url, method, param });
|
|
5456
5590
|
const onEvent = useEventDispatcher();
|
|
5457
|
-
const debouncedSearch =
|
|
5591
|
+
const debouncedSearch = useMemo11(() => debounce(search, DEBOUNCE_TIME), [search]);
|
|
5458
5592
|
const onSearchStart = () => {
|
|
5459
5593
|
onEvent("Dynamic Flow - Search Started", {});
|
|
5460
5594
|
};
|
|
@@ -5481,32 +5615,32 @@ function DynamicSearch({ component, onAction }) {
|
|
|
5481
5615
|
setQuery(query);
|
|
5482
5616
|
void search(query);
|
|
5483
5617
|
};
|
|
5484
|
-
return /* @__PURE__ */
|
|
5485
|
-
/* @__PURE__ */
|
|
5486
|
-
status === "loading" && /* @__PURE__ */
|
|
5487
|
-
status === "error" && /* @__PURE__ */
|
|
5488
|
-
status === "success" && /* @__PURE__ */
|
|
5618
|
+
return /* @__PURE__ */ jsxs21("div", { className: getMargin(margin || "md"), children: [
|
|
5619
|
+
/* @__PURE__ */ jsx55(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5620
|
+
status === "loading" && /* @__PURE__ */ jsx55(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5621
|
+
status === "error" && /* @__PURE__ */ jsx55(ErrorResult, { onRetrySearch }),
|
|
5622
|
+
status === "success" && /* @__PURE__ */ jsx55(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5489
5623
|
] });
|
|
5490
5624
|
}
|
|
5491
5625
|
var DynamicSearch_default = DynamicSearch;
|
|
5492
5626
|
|
|
5493
5627
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
5494
5628
|
import { Button as Button4, Modal as Modal2 } from "@transferwise/components";
|
|
5495
|
-
import { useState as
|
|
5496
|
-
import { jsx as
|
|
5629
|
+
import { useState as useState17 } from "react";
|
|
5630
|
+
import { jsx as jsx56, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
5497
5631
|
function DynamicModal(props) {
|
|
5498
|
-
const [visible, isVisible] =
|
|
5632
|
+
const [visible, isVisible] = useState17(false);
|
|
5499
5633
|
const { component, onAction } = props;
|
|
5500
5634
|
const { margin = "md" } = component;
|
|
5501
|
-
return /* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5503
|
-
/* @__PURE__ */
|
|
5635
|
+
return /* @__PURE__ */ jsxs22("div", { className: getTextAlignmentAndMargin({ margin }), children: [
|
|
5636
|
+
/* @__PURE__ */ jsx56(Button4, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
5637
|
+
/* @__PURE__ */ jsx56(
|
|
5504
5638
|
Modal2,
|
|
5505
5639
|
{
|
|
5506
5640
|
scroll: "content",
|
|
5507
5641
|
open: visible,
|
|
5508
5642
|
size: "lg",
|
|
5509
|
-
body: /* @__PURE__ */
|
|
5643
|
+
body: /* @__PURE__ */ jsx56(
|
|
5510
5644
|
DynamicLayout_default,
|
|
5511
5645
|
__spreadProps(__spreadValues({}, props), {
|
|
5512
5646
|
components: component.content.components,
|
|
@@ -5524,7 +5658,7 @@ function DynamicModal(props) {
|
|
|
5524
5658
|
var DynamicModal_default = DynamicModal;
|
|
5525
5659
|
|
|
5526
5660
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5527
|
-
import { Fragment as Fragment13, jsx as
|
|
5661
|
+
import { Fragment as Fragment13, jsx as jsx57, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
5528
5662
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5529
5663
|
var getDefaultValue = (schema) => {
|
|
5530
5664
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5562,13 +5696,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5562
5696
|
props.onBlur();
|
|
5563
5697
|
}
|
|
5564
5698
|
};
|
|
5565
|
-
const [model, setModel] =
|
|
5566
|
-
const [lastModel, setLastModel] =
|
|
5567
|
-
const [changed, setChanged] =
|
|
5568
|
-
const [focused, setFocused] =
|
|
5569
|
-
const [blurred, setBlurred] =
|
|
5570
|
-
const [validations, setValidations] =
|
|
5571
|
-
const id =
|
|
5699
|
+
const [model, setModel] = useState18((_a = props.model) != null ? _a : null);
|
|
5700
|
+
const [lastModel, setLastModel] = useState18((_b = props.model) != null ? _b : null);
|
|
5701
|
+
const [changed, setChanged] = useState18(false);
|
|
5702
|
+
const [focused, setFocused] = useState18(false);
|
|
5703
|
+
const [blurred, setBlurred] = useState18(false);
|
|
5704
|
+
const [validations, setValidations] = useState18([]);
|
|
5705
|
+
const id = useMemo12(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5572
5706
|
const onSchemaChange = () => {
|
|
5573
5707
|
const defaultValue = getDefaultValue(props.schema);
|
|
5574
5708
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5583,9 +5717,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5583
5717
|
};
|
|
5584
5718
|
const isConst = props.schema.const;
|
|
5585
5719
|
const isHidden = props.schema.hidden || isConst;
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5720
|
+
useEffect12(refreshValidations, [props.model, props.submitted]);
|
|
5721
|
+
useEffect12(onSchemaChange, [props.schema]);
|
|
5722
|
+
useEffect12(() => {
|
|
5589
5723
|
var _a2;
|
|
5590
5724
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
5591
5725
|
if (newModel !== model) {
|
|
@@ -5600,15 +5734,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5600
5734
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5601
5735
|
const schemaHelp = props.schema.help;
|
|
5602
5736
|
const feedbackId = `${id}-feedback`;
|
|
5603
|
-
return !isHidden ? /* @__PURE__ */
|
|
5604
|
-
props.schema.alert && /* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5606
|
-
showLabel && /* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5608
|
-
!!schemaHelp && /* @__PURE__ */
|
|
5737
|
+
return !isHidden ? /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
5738
|
+
props.schema.alert && /* @__PURE__ */ jsx57(DynamicAlert_default, { component: props.schema.alert }),
|
|
5739
|
+
/* @__PURE__ */ jsxs23("div", { className: (0, import_classnames9.default)(formGroupClasses), children: [
|
|
5740
|
+
showLabel && /* @__PURE__ */ jsxs23("div", { className: "d-inline-block m-b-1", children: [
|
|
5741
|
+
/* @__PURE__ */ jsx57("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5742
|
+
!!schemaHelp && /* @__PURE__ */ jsx57(Help_default, { help: schemaHelp })
|
|
5609
5743
|
] }),
|
|
5610
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */
|
|
5611
|
-
/* @__PURE__ */
|
|
5744
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ jsx57(Help_default, { help: schemaHelp }),
|
|
5745
|
+
/* @__PURE__ */ jsx57(
|
|
5612
5746
|
SchemaFormControl_default,
|
|
5613
5747
|
{
|
|
5614
5748
|
id,
|
|
@@ -5621,7 +5755,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5621
5755
|
describedBy: feedbackId
|
|
5622
5756
|
}
|
|
5623
5757
|
),
|
|
5624
|
-
/* @__PURE__ */
|
|
5758
|
+
/* @__PURE__ */ jsx57(
|
|
5625
5759
|
ControlFeedback_default,
|
|
5626
5760
|
{
|
|
5627
5761
|
id: feedbackId,
|
|
@@ -5646,7 +5780,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
5646
5780
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5647
5781
|
|
|
5648
5782
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5649
|
-
import { jsx as
|
|
5783
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
5650
5784
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
5651
5785
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
5652
5786
|
var _a;
|
|
@@ -5661,15 +5795,15 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
5661
5795
|
]);
|
|
5662
5796
|
function PersistAsyncBasicSchema(props) {
|
|
5663
5797
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
5664
|
-
const intl =
|
|
5798
|
+
const intl = useIntl11();
|
|
5665
5799
|
const httpClient = useHttpClient();
|
|
5666
5800
|
const onEvent = useEventDispatcher();
|
|
5667
|
-
const [persistAsyncModel, setPersistAsyncModel] =
|
|
5801
|
+
const [persistAsyncModel, setPersistAsyncModel] = useState19(null);
|
|
5668
5802
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5669
|
-
const [persistAsyncError, setPersistAsyncError] =
|
|
5670
|
-
const [fieldSubmitted, setFieldSubmitted] =
|
|
5671
|
-
const [abortController, setAbortController] =
|
|
5672
|
-
|
|
5803
|
+
const [persistAsyncError, setPersistAsyncError] = useState19(null);
|
|
5804
|
+
const [fieldSubmitted, setFieldSubmitted] = useState19(false);
|
|
5805
|
+
const [abortController, setAbortController] = useState19(null);
|
|
5806
|
+
useEffect13(() => {
|
|
5673
5807
|
if (controlTypesWithPersistOnChange.has(
|
|
5674
5808
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5675
5809
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5736,7 +5870,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
5736
5870
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5737
5871
|
}
|
|
5738
5872
|
};
|
|
5739
|
-
return /* @__PURE__ */
|
|
5873
|
+
return /* @__PURE__ */ jsx58(
|
|
5740
5874
|
BasicTypeSchema_default,
|
|
5741
5875
|
{
|
|
5742
5876
|
required,
|
|
@@ -5757,9 +5891,9 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
5757
5891
|
|
|
5758
5892
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5759
5893
|
var usePersistAsync = (persistAsync) => {
|
|
5760
|
-
const [abortController, setAbortController] =
|
|
5894
|
+
const [abortController, setAbortController] = useState20(null);
|
|
5761
5895
|
const httpClient = useHttpClient();
|
|
5762
|
-
const intl =
|
|
5896
|
+
const intl = useIntl12();
|
|
5763
5897
|
const { schema } = persistAsync;
|
|
5764
5898
|
async function handlePersistAsync(model) {
|
|
5765
5899
|
const isInvalidSchema = model instanceof Blob ? !isBlobSchema(schema) : !isValidSchema(model, schema);
|
|
@@ -5836,7 +5970,7 @@ function hasStringMessage(value) {
|
|
|
5836
5970
|
}
|
|
5837
5971
|
|
|
5838
5972
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
5839
|
-
import { useEffect as
|
|
5973
|
+
import { useEffect as useEffect14, useMemo as useMemo13, useRef as useRef3 } from "react";
|
|
5840
5974
|
function usePolling({
|
|
5841
5975
|
asyncFn,
|
|
5842
5976
|
interval,
|
|
@@ -5847,7 +5981,7 @@ function usePolling({
|
|
|
5847
5981
|
}) {
|
|
5848
5982
|
const onPollingResponseReference = useRef3(onPollingResponse);
|
|
5849
5983
|
const onFailureReference = useRef3(onFailure);
|
|
5850
|
-
const poll =
|
|
5984
|
+
const poll = useMemo13(
|
|
5851
5985
|
() => createPollingClosure(
|
|
5852
5986
|
asyncFn,
|
|
5853
5987
|
maxAttempts,
|
|
@@ -5857,7 +5991,7 @@ function usePolling({
|
|
|
5857
5991
|
),
|
|
5858
5992
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5859
5993
|
);
|
|
5860
|
-
|
|
5994
|
+
useEffect14(() => {
|
|
5861
5995
|
if (interval > 0) {
|
|
5862
5996
|
const intervalReference = setInterval(() => {
|
|
5863
5997
|
poll();
|
|
@@ -5865,7 +5999,7 @@ function usePolling({
|
|
|
5865
5999
|
return () => clearInterval(intervalReference);
|
|
5866
6000
|
}
|
|
5867
6001
|
}, [poll, interval]);
|
|
5868
|
-
|
|
6002
|
+
useEffect14(() => {
|
|
5869
6003
|
onPollingResponseReference.current = onPollingResponse;
|
|
5870
6004
|
onFailureReference.current = onFailure;
|
|
5871
6005
|
}, [onPollingResponse, onFailure]);
|
|
@@ -5896,20 +6030,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
5896
6030
|
}
|
|
5897
6031
|
|
|
5898
6032
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
5899
|
-
import { useEffect as
|
|
6033
|
+
import { useEffect as useEffect15, useRef as useRef4 } from "react";
|
|
5900
6034
|
var usePrevious = (value) => {
|
|
5901
6035
|
const reference = useRef4();
|
|
5902
|
-
|
|
6036
|
+
useEffect15(() => {
|
|
5903
6037
|
reference.current = value;
|
|
5904
6038
|
}, [value]);
|
|
5905
6039
|
return reference.current;
|
|
5906
6040
|
};
|
|
5907
6041
|
|
|
5908
6042
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
5909
|
-
import { useCallback as useCallback6, useMemo as
|
|
6043
|
+
import { useCallback as useCallback6, useMemo as useMemo14 } from "react";
|
|
5910
6044
|
function useStepPolling(polling, onAction) {
|
|
5911
6045
|
const httpClient = useHttpClient();
|
|
5912
|
-
const asyncFn =
|
|
6046
|
+
const asyncFn = useMemo14(() => {
|
|
5913
6047
|
if (polling) {
|
|
5914
6048
|
return () => httpClient(polling.url).then((response) => {
|
|
5915
6049
|
if (response.ok) {
|
|
@@ -5947,7 +6081,7 @@ function useStepPolling(polling, onAction) {
|
|
|
5947
6081
|
}
|
|
5948
6082
|
|
|
5949
6083
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
5950
|
-
import { jsx as
|
|
6084
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
5951
6085
|
var getComponents = (step, options) => {
|
|
5952
6086
|
var _a;
|
|
5953
6087
|
if (isEmpty(step)) {
|
|
@@ -5970,7 +6104,7 @@ var LayoutStep = (props) => {
|
|
|
5970
6104
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
5971
6105
|
};
|
|
5972
6106
|
useStepPolling(stepSpecification.polling, onAction);
|
|
5973
|
-
return /* @__PURE__ */
|
|
6107
|
+
return /* @__PURE__ */ jsx59(
|
|
5974
6108
|
DynamicLayout_default,
|
|
5975
6109
|
{
|
|
5976
6110
|
components,
|
|
@@ -5986,16 +6120,16 @@ var LayoutStep = (props) => {
|
|
|
5986
6120
|
var LayoutStep_default = LayoutStep;
|
|
5987
6121
|
|
|
5988
6122
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
5989
|
-
import { useEffect as
|
|
6123
|
+
import { useEffect as useEffect20, useState as useState23 } from "react";
|
|
5990
6124
|
|
|
5991
6125
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
5992
|
-
import { useCallback as useCallback8, useEffect as
|
|
5993
|
-
import { useIntl as
|
|
6126
|
+
import { useCallback as useCallback8, useEffect as useEffect19, useMemo as useMemo15, useRef as useRef6, useState as useState22 } from "react";
|
|
6127
|
+
import { useIntl as useIntl15 } from "react-intl";
|
|
5994
6128
|
import Webcam from "react-webcam";
|
|
5995
6129
|
|
|
5996
6130
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
5997
|
-
import { defineMessages as
|
|
5998
|
-
var CameraCapture_messages_default =
|
|
6131
|
+
import { defineMessages as defineMessages12 } from "react-intl";
|
|
6132
|
+
var CameraCapture_messages_default = defineMessages12({
|
|
5999
6133
|
reviewSubmit: {
|
|
6000
6134
|
id: "dynamicFlows.CameraCapture.reviewSubmit",
|
|
6001
6135
|
defaultMessage: "Yes, submit",
|
|
@@ -6055,16 +6189,16 @@ var CameraCapture_messages_default = defineMessages11({
|
|
|
6055
6189
|
|
|
6056
6190
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6057
6191
|
import { Button as Button5, ControlType, Priority, Size as Size3 } from "@transferwise/components";
|
|
6058
|
-
import { useIntl as
|
|
6059
|
-
import { jsx as
|
|
6060
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */
|
|
6192
|
+
import { useIntl as useIntl13 } from "react-intl";
|
|
6193
|
+
import { jsx as jsx60, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6194
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ jsx60("div", { className: "bottom-bar", children: /* @__PURE__ */ jsx60(CaptureButton, { onClick: onCapture }) });
|
|
6061
6195
|
var ReviewBottomBar = ({
|
|
6062
6196
|
onSubmit,
|
|
6063
6197
|
onRetry
|
|
6064
6198
|
}) => {
|
|
6065
|
-
const intl =
|
|
6066
|
-
return /* @__PURE__ */
|
|
6067
|
-
/* @__PURE__ */
|
|
6199
|
+
const intl = useIntl13();
|
|
6200
|
+
return /* @__PURE__ */ jsx60("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ jsx60("div", { className: "row", children: /* @__PURE__ */ jsxs24("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
6201
|
+
/* @__PURE__ */ jsx60(
|
|
6068
6202
|
Button5,
|
|
6069
6203
|
{
|
|
6070
6204
|
className: "m-b-1",
|
|
@@ -6075,7 +6209,7 @@ var ReviewBottomBar = ({
|
|
|
6075
6209
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
6076
6210
|
}
|
|
6077
6211
|
),
|
|
6078
|
-
/* @__PURE__ */
|
|
6212
|
+
/* @__PURE__ */ jsx60(
|
|
6079
6213
|
Button5,
|
|
6080
6214
|
{
|
|
6081
6215
|
className: "m-b-2",
|
|
@@ -6089,23 +6223,23 @@ var ReviewBottomBar = ({
|
|
|
6089
6223
|
)
|
|
6090
6224
|
] }) }) });
|
|
6091
6225
|
};
|
|
6092
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */
|
|
6226
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ jsx60(
|
|
6093
6227
|
"button",
|
|
6094
6228
|
{
|
|
6095
6229
|
type: "button",
|
|
6096
6230
|
className: "camera-capture-btn m-b-2",
|
|
6097
6231
|
"data-testid": "camera-capture-button",
|
|
6098
6232
|
onClick,
|
|
6099
|
-
children: /* @__PURE__ */
|
|
6233
|
+
children: /* @__PURE__ */ jsx60("span", { className: "camera-capture-btn-inner" })
|
|
6100
6234
|
}
|
|
6101
6235
|
);
|
|
6102
6236
|
|
|
6103
6237
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6104
|
-
import { useIntl as
|
|
6238
|
+
import { useIntl as useIntl14 } from "react-intl";
|
|
6105
6239
|
|
|
6106
6240
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
6107
|
-
import { defineMessages as
|
|
6108
|
-
var OrientationLockOverlay_messages_default =
|
|
6241
|
+
import { defineMessages as defineMessages13 } from "react-intl";
|
|
6242
|
+
var OrientationLockOverlay_messages_default = defineMessages13({
|
|
6109
6243
|
text: {
|
|
6110
6244
|
id: "dynamicFlows.CameraCapture.rotatePhone.text",
|
|
6111
6245
|
defaultMessage: "Rotate your phone to portrait view to take a photo",
|
|
@@ -6114,11 +6248,11 @@ var OrientationLockOverlay_messages_default = defineMessages12({
|
|
|
6114
6248
|
});
|
|
6115
6249
|
|
|
6116
6250
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6117
|
-
import { jsx as
|
|
6251
|
+
import { jsx as jsx61, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6118
6252
|
function OrientationLockOverlay() {
|
|
6119
|
-
const intl =
|
|
6120
|
-
return /* @__PURE__ */
|
|
6121
|
-
/* @__PURE__ */
|
|
6253
|
+
const intl = useIntl14();
|
|
6254
|
+
return /* @__PURE__ */ jsxs25("div", { className: "orientation-lock-overlay", children: [
|
|
6255
|
+
/* @__PURE__ */ jsx61(
|
|
6122
6256
|
"img",
|
|
6123
6257
|
{
|
|
6124
6258
|
className: "m-b-3",
|
|
@@ -6128,26 +6262,26 @@ function OrientationLockOverlay() {
|
|
|
6128
6262
|
alt: ""
|
|
6129
6263
|
}
|
|
6130
6264
|
),
|
|
6131
|
-
/* @__PURE__ */
|
|
6265
|
+
/* @__PURE__ */ jsx61("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6132
6266
|
] });
|
|
6133
6267
|
}
|
|
6134
6268
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6135
6269
|
|
|
6136
6270
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
6137
6271
|
import { Button as Button6 } from "@transferwise/components";
|
|
6138
|
-
import { jsx as
|
|
6272
|
+
import { jsx as jsx62, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6139
6273
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
6140
|
-
return /* @__PURE__ */
|
|
6141
|
-
/* @__PURE__ */
|
|
6142
|
-
/* @__PURE__ */
|
|
6143
|
-
onAction && actionButton && /* @__PURE__ */
|
|
6274
|
+
return /* @__PURE__ */ jsx62("div", { className: "container p-t-5", children: /* @__PURE__ */ jsx62("div", { className: "row", children: /* @__PURE__ */ jsxs26("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6275
|
+
/* @__PURE__ */ jsx62("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
6276
|
+
/* @__PURE__ */ jsx62("p", { className: "text-xs-center m-b-5", children: description }),
|
|
6277
|
+
onAction && actionButton && /* @__PURE__ */ jsx62(Button6, { block: true, onClick: onAction, children: actionButton })
|
|
6144
6278
|
] }) }) });
|
|
6145
6279
|
}
|
|
6146
6280
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
6147
6281
|
|
|
6148
6282
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6149
6283
|
var import_screenfull = __toESM(require_screenfull());
|
|
6150
|
-
import { useCallback as useCallback7, useEffect as
|
|
6284
|
+
import { useCallback as useCallback7, useEffect as useEffect16 } from "react";
|
|
6151
6285
|
|
|
6152
6286
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
6153
6287
|
var isSelfieCamera = (stream) => {
|
|
@@ -6260,7 +6394,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
6260
6394
|
},
|
|
6261
6395
|
[onEvent]
|
|
6262
6396
|
);
|
|
6263
|
-
|
|
6397
|
+
useEffect16(() => {
|
|
6264
6398
|
var _a, _b;
|
|
6265
6399
|
if (shouldLockOrientation) {
|
|
6266
6400
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -6283,9 +6417,9 @@ var noop4 = () => {
|
|
|
6283
6417
|
};
|
|
6284
6418
|
|
|
6285
6419
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6286
|
-
import { useEffect as
|
|
6420
|
+
import { useEffect as useEffect17, useState as useState21 } from "react";
|
|
6287
6421
|
var useVideoConstraints = (direction) => {
|
|
6288
|
-
const [videoConstraints, setVideoConstraints] =
|
|
6422
|
+
const [videoConstraints, setVideoConstraints] = useState21();
|
|
6289
6423
|
const defaultVideoConstraints = {
|
|
6290
6424
|
facingMode: direction === "front" ? "user" : "environment",
|
|
6291
6425
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -6293,7 +6427,7 @@ var useVideoConstraints = (direction) => {
|
|
|
6293
6427
|
frameRate: 30,
|
|
6294
6428
|
aspectRatio: 16 / 9
|
|
6295
6429
|
};
|
|
6296
|
-
|
|
6430
|
+
useEffect17(() => {
|
|
6297
6431
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
6298
6432
|
}, [direction]);
|
|
6299
6433
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -6311,8 +6445,8 @@ var useVideoConstraints = (direction) => {
|
|
|
6311
6445
|
};
|
|
6312
6446
|
|
|
6313
6447
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6314
|
-
import { useEffect as
|
|
6315
|
-
import { Fragment as Fragment14, jsx as
|
|
6448
|
+
import { useEffect as useEffect18, useRef as useRef5 } from "react";
|
|
6449
|
+
import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6316
6450
|
var captureButtonHeight = 92;
|
|
6317
6451
|
var reviewButtonsHeight = 120;
|
|
6318
6452
|
var imageHeight = 40;
|
|
@@ -6322,7 +6456,7 @@ var reviewInstructionsHeight = 40;
|
|
|
6322
6456
|
var overlayMaxWidth = 800;
|
|
6323
6457
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
6324
6458
|
const svgReference = useRef5(null);
|
|
6325
|
-
|
|
6459
|
+
useEffect18(() => {
|
|
6326
6460
|
const listener = debounce(() => {
|
|
6327
6461
|
var _a;
|
|
6328
6462
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -6334,18 +6468,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
6334
6468
|
return () => window.removeEventListener("resize", listener);
|
|
6335
6469
|
});
|
|
6336
6470
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
6337
|
-
let helperBox = /* @__PURE__ */
|
|
6338
|
-
imageUrl && /* @__PURE__ */
|
|
6339
|
-
title && /* @__PURE__ */
|
|
6340
|
-
instructions && /* @__PURE__ */
|
|
6471
|
+
let helperBox = /* @__PURE__ */ jsxs27(Fragment14, { children: [
|
|
6472
|
+
imageUrl && /* @__PURE__ */ jsx63("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6473
|
+
title && /* @__PURE__ */ jsx63("h4", { className: "camera-capture-title", children: title }),
|
|
6474
|
+
instructions && /* @__PURE__ */ jsx63("small", { className: "camera-capture-instructions", children: instructions })
|
|
6341
6475
|
] });
|
|
6342
6476
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6343
6477
|
if (reviewInstructions) {
|
|
6344
6478
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6345
|
-
helperBox = /* @__PURE__ */
|
|
6479
|
+
helperBox = /* @__PURE__ */ jsx63("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6346
6480
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6347
6481
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6348
|
-
helperBox = /* @__PURE__ */
|
|
6482
|
+
helperBox = /* @__PURE__ */ jsx63(Fragment14, {});
|
|
6349
6483
|
}
|
|
6350
6484
|
}
|
|
6351
6485
|
const framePosition = {
|
|
@@ -6363,20 +6497,20 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
6363
6497
|
width: "90%"
|
|
6364
6498
|
}
|
|
6365
6499
|
};
|
|
6366
|
-
return /* @__PURE__ */
|
|
6367
|
-
/* @__PURE__ */
|
|
6368
|
-
/* @__PURE__ */
|
|
6369
|
-
/* @__PURE__ */
|
|
6500
|
+
return /* @__PURE__ */ jsxs27("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6501
|
+
/* @__PURE__ */ jsx63("defs", { children: /* @__PURE__ */ jsxs27("mask", { id: "mask", children: [
|
|
6502
|
+
/* @__PURE__ */ jsx63("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6503
|
+
/* @__PURE__ */ jsx63("image", __spreadValues({ href: overlay }, framePosition))
|
|
6370
6504
|
] }) }),
|
|
6371
|
-
overlay && /* @__PURE__ */
|
|
6372
|
-
outline && /* @__PURE__ */
|
|
6373
|
-
/* @__PURE__ */
|
|
6505
|
+
overlay && /* @__PURE__ */ jsx63("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6506
|
+
outline && /* @__PURE__ */ jsx63("image", __spreadValues({ href: outline }, framePosition)),
|
|
6507
|
+
/* @__PURE__ */ jsx63("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ jsx63("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
6374
6508
|
] });
|
|
6375
6509
|
}
|
|
6376
6510
|
var Overlay_default = Overlay;
|
|
6377
6511
|
|
|
6378
6512
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6379
|
-
import { jsx as
|
|
6513
|
+
import { jsx as jsx64, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6380
6514
|
function CameraCapture({
|
|
6381
6515
|
direction = "back",
|
|
6382
6516
|
overlay = "",
|
|
@@ -6388,14 +6522,14 @@ function CameraCapture({
|
|
|
6388
6522
|
onCapture,
|
|
6389
6523
|
onEvent
|
|
6390
6524
|
}) {
|
|
6391
|
-
const [mode, setMode] =
|
|
6392
|
-
const [cameraError, setCameraError] =
|
|
6393
|
-
const [isVideoMirrored, setIsVideoMirrored] =
|
|
6394
|
-
const [ready, setReady] =
|
|
6395
|
-
const [reviewImage, setReviewImage] =
|
|
6525
|
+
const [mode, setMode] = useState22("CAPTURE" /* CAPTURE */);
|
|
6526
|
+
const [cameraError, setCameraError] = useState22();
|
|
6527
|
+
const [isVideoMirrored, setIsVideoMirrored] = useState22(false);
|
|
6528
|
+
const [ready, setReady] = useState22(false);
|
|
6529
|
+
const [reviewImage, setReviewImage] = useState22();
|
|
6396
6530
|
const webcamReference = useRef6(null);
|
|
6397
6531
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6398
|
-
const shouldLockOrientation =
|
|
6532
|
+
const shouldLockOrientation = useMemo15(
|
|
6399
6533
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
6400
6534
|
[mode]
|
|
6401
6535
|
);
|
|
@@ -6403,7 +6537,7 @@ function CameraCapture({
|
|
|
6403
6537
|
shouldLockOrientation,
|
|
6404
6538
|
onEvent
|
|
6405
6539
|
);
|
|
6406
|
-
const intl =
|
|
6540
|
+
const intl = useIntl15();
|
|
6407
6541
|
const handleCapture = useCallback8(async () => {
|
|
6408
6542
|
var _a, _b, _c, _d, _e, _f;
|
|
6409
6543
|
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) {
|
|
@@ -6479,13 +6613,13 @@ function CameraCapture({
|
|
|
6479
6613
|
setReviewImage(void 0);
|
|
6480
6614
|
};
|
|
6481
6615
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
6482
|
-
|
|
6616
|
+
useEffect19(() => {
|
|
6483
6617
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
6484
6618
|
exitFullScreen();
|
|
6485
6619
|
}
|
|
6486
6620
|
}, [mode, exitFullScreen]);
|
|
6487
|
-
const captureScreen = /* @__PURE__ */
|
|
6488
|
-
videoConstraints && /* @__PURE__ */
|
|
6621
|
+
const captureScreen = /* @__PURE__ */ jsxs28("div", { className: "camera-capture", children: [
|
|
6622
|
+
videoConstraints && /* @__PURE__ */ jsx64(
|
|
6489
6623
|
Webcam,
|
|
6490
6624
|
{
|
|
6491
6625
|
ref: webcamReference,
|
|
@@ -6496,7 +6630,7 @@ function CameraCapture({
|
|
|
6496
6630
|
onUserMedia: handleUserMedia
|
|
6497
6631
|
}
|
|
6498
6632
|
),
|
|
6499
|
-
/* @__PURE__ */
|
|
6633
|
+
/* @__PURE__ */ jsx64(
|
|
6500
6634
|
Overlay_default,
|
|
6501
6635
|
{
|
|
6502
6636
|
overlay,
|
|
@@ -6506,8 +6640,8 @@ function CameraCapture({
|
|
|
6506
6640
|
instructions
|
|
6507
6641
|
}
|
|
6508
6642
|
),
|
|
6509
|
-
shouldLockOrientation && /* @__PURE__ */
|
|
6510
|
-
ready && /* @__PURE__ */
|
|
6643
|
+
shouldLockOrientation && /* @__PURE__ */ jsx64(OrientationLockOverlay_default, {}),
|
|
6644
|
+
ready && /* @__PURE__ */ jsx64(
|
|
6511
6645
|
CaptureBottomBar,
|
|
6512
6646
|
{
|
|
6513
6647
|
onCapture: () => {
|
|
@@ -6516,9 +6650,9 @@ function CameraCapture({
|
|
|
6516
6650
|
}
|
|
6517
6651
|
)
|
|
6518
6652
|
] });
|
|
6519
|
-
const reviewScreen = /* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6653
|
+
const reviewScreen = /* @__PURE__ */ jsxs28("div", { className: "camera-capture", children: [
|
|
6654
|
+
/* @__PURE__ */ jsx64("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6655
|
+
/* @__PURE__ */ jsx64(
|
|
6522
6656
|
Overlay_default,
|
|
6523
6657
|
{
|
|
6524
6658
|
overlay,
|
|
@@ -6528,18 +6662,18 @@ function CameraCapture({
|
|
|
6528
6662
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6529
6663
|
}
|
|
6530
6664
|
),
|
|
6531
|
-
/* @__PURE__ */
|
|
6665
|
+
/* @__PURE__ */ jsx64(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6532
6666
|
] });
|
|
6533
|
-
return /* @__PURE__ */
|
|
6667
|
+
return /* @__PURE__ */ jsxs28("section", { children: [
|
|
6534
6668
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
6535
6669
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
6536
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */
|
|
6670
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ jsx64(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
6537
6671
|
] });
|
|
6538
6672
|
}
|
|
6539
6673
|
var CameraCapture_default = CameraCapture;
|
|
6540
6674
|
|
|
6541
6675
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
6542
|
-
import { jsx as
|
|
6676
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
6543
6677
|
function blobToBase64(blob) {
|
|
6544
6678
|
return new Promise((resolve, _) => {
|
|
6545
6679
|
const reader = new FileReader();
|
|
@@ -6557,8 +6691,8 @@ function CameraStep(props) {
|
|
|
6557
6691
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6558
6692
|
const { overlay, outline } = assets || {};
|
|
6559
6693
|
const { url: imageUrl } = image || {};
|
|
6560
|
-
const [captureClicked, setCaptureClicked] =
|
|
6561
|
-
|
|
6694
|
+
const [captureClicked, setCaptureClicked] = useState23(false);
|
|
6695
|
+
useEffect20(() => {
|
|
6562
6696
|
if (captureClicked) {
|
|
6563
6697
|
onAction(action);
|
|
6564
6698
|
}
|
|
@@ -6577,7 +6711,7 @@ function CameraStep(props) {
|
|
|
6577
6711
|
});
|
|
6578
6712
|
}
|
|
6579
6713
|
};
|
|
6580
|
-
return /* @__PURE__ */
|
|
6714
|
+
return /* @__PURE__ */ jsx65(
|
|
6581
6715
|
CameraCapture_default,
|
|
6582
6716
|
{
|
|
6583
6717
|
overlay,
|
|
@@ -6626,11 +6760,11 @@ function getFirstAction(step) {
|
|
|
6626
6760
|
}
|
|
6627
6761
|
|
|
6628
6762
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6629
|
-
import { useIntl as
|
|
6763
|
+
import { useIntl as useIntl16 } from "react-intl";
|
|
6630
6764
|
|
|
6631
6765
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6632
|
-
import { defineMessages as
|
|
6633
|
-
var ExternalConfirmationStep_messages_default =
|
|
6766
|
+
import { defineMessages as defineMessages14 } from "react-intl";
|
|
6767
|
+
var ExternalConfirmationStep_messages_default = defineMessages14({
|
|
6634
6768
|
title: {
|
|
6635
6769
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
6636
6770
|
defaultMessage: "Please confirm",
|
|
@@ -6654,12 +6788,12 @@ var ExternalConfirmationStep_messages_default = defineMessages13({
|
|
|
6654
6788
|
});
|
|
6655
6789
|
|
|
6656
6790
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6657
|
-
import { jsx as
|
|
6791
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
6658
6792
|
var noop5 = () => {
|
|
6659
6793
|
};
|
|
6660
6794
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6661
|
-
const { formatMessage } =
|
|
6662
|
-
return /* @__PURE__ */
|
|
6795
|
+
const { formatMessage } = useIntl16();
|
|
6796
|
+
return /* @__PURE__ */ jsx66(
|
|
6663
6797
|
DynamicLayout_default,
|
|
6664
6798
|
{
|
|
6665
6799
|
components: [
|
|
@@ -6726,9 +6860,9 @@ function getOrigin(url) {
|
|
|
6726
6860
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
6727
6861
|
import { Avatar as Avatar3 } from "@transferwise/components";
|
|
6728
6862
|
import { ArrowLeft } from "@transferwise/icons";
|
|
6729
|
-
import { jsx as
|
|
6863
|
+
import { jsx as jsx67, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6730
6864
|
function BackButton({ title, action, onAction }) {
|
|
6731
|
-
return /* @__PURE__ */
|
|
6865
|
+
return /* @__PURE__ */ jsxs29(
|
|
6732
6866
|
"a",
|
|
6733
6867
|
{
|
|
6734
6868
|
href: "/",
|
|
@@ -6739,8 +6873,8 @@ function BackButton({ title, action, onAction }) {
|
|
|
6739
6873
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
6740
6874
|
},
|
|
6741
6875
|
children: [
|
|
6742
|
-
/* @__PURE__ */
|
|
6743
|
-
/* @__PURE__ */
|
|
6876
|
+
/* @__PURE__ */ jsx67("span", { className: "sr-only", children: title }),
|
|
6877
|
+
/* @__PURE__ */ jsx67(Avatar3, { type: "icon", children: /* @__PURE__ */ jsx67(ArrowLeft, { size: "24" }) })
|
|
6744
6878
|
]
|
|
6745
6879
|
}
|
|
6746
6880
|
);
|
|
@@ -6748,7 +6882,7 @@ function BackButton({ title, action, onAction }) {
|
|
|
6748
6882
|
var BackButton_default = BackButton;
|
|
6749
6883
|
|
|
6750
6884
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
6751
|
-
import { Fragment as Fragment15, jsx as
|
|
6885
|
+
import { Fragment as Fragment15, jsx as jsx68, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
6752
6886
|
function DynamicFlowStep(props) {
|
|
6753
6887
|
var _a, _b, _c;
|
|
6754
6888
|
const { step, globalError, onAction } = props;
|
|
@@ -6757,20 +6891,20 @@ function DynamicFlowStep(props) {
|
|
|
6757
6891
|
const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
|
|
6758
6892
|
if (step === void 0) {
|
|
6759
6893
|
if (globalError) {
|
|
6760
|
-
return /* @__PURE__ */
|
|
6894
|
+
return /* @__PURE__ */ jsx68(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
6761
6895
|
}
|
|
6762
6896
|
return null;
|
|
6763
6897
|
}
|
|
6764
6898
|
if (externalUrl && requiresManualTrigger) {
|
|
6765
|
-
return /* @__PURE__ */
|
|
6899
|
+
return /* @__PURE__ */ jsx68(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6766
6900
|
}
|
|
6767
6901
|
if (isCameraStep(step)) {
|
|
6768
|
-
return /* @__PURE__ */
|
|
6902
|
+
return /* @__PURE__ */ jsx68(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
6769
6903
|
}
|
|
6770
|
-
return /* @__PURE__ */
|
|
6771
|
-
backButton && /* @__PURE__ */
|
|
6772
|
-
globalError ? /* @__PURE__ */
|
|
6773
|
-
/* @__PURE__ */
|
|
6904
|
+
return /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
6905
|
+
backButton && /* @__PURE__ */ jsx68(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
6906
|
+
globalError ? /* @__PURE__ */ jsx68(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6907
|
+
/* @__PURE__ */ jsx68(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6774
6908
|
] });
|
|
6775
6909
|
}
|
|
6776
6910
|
|
|
@@ -6801,12 +6935,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6801
6935
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6802
6936
|
|
|
6803
6937
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6804
|
-
import { useMemo as
|
|
6938
|
+
import { useMemo as useMemo16, useState as useState24 } from "react";
|
|
6805
6939
|
var useDynamicFlowState = (initialStep) => {
|
|
6806
6940
|
var _a, _b;
|
|
6807
|
-
const [formErrors, setFormErrors] =
|
|
6808
|
-
const [globalError, setGlobalError] =
|
|
6809
|
-
const [stepAndModels, setStepAndModels] =
|
|
6941
|
+
const [formErrors, setFormErrors] = useState24((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6942
|
+
const [globalError, setGlobalError] = useState24((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6943
|
+
const [stepAndModels, setStepAndModels] = useState24({
|
|
6810
6944
|
step: initialStep || void 0,
|
|
6811
6945
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6812
6946
|
etag: void 0
|
|
@@ -6836,7 +6970,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6836
6970
|
return updatedState;
|
|
6837
6971
|
});
|
|
6838
6972
|
};
|
|
6839
|
-
const modelIsValid =
|
|
6973
|
+
const modelIsValid = useMemo16(
|
|
6840
6974
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6841
6975
|
[models, step]
|
|
6842
6976
|
);
|
|
@@ -6909,17 +7043,17 @@ var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object"
|
|
|
6909
7043
|
|
|
6910
7044
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
6911
7045
|
import { Loader as Loader3, Size as Size4 } from "@transferwise/components";
|
|
6912
|
-
import { useState as
|
|
6913
|
-
import { jsx as
|
|
7046
|
+
import { useState as useState25 } from "react";
|
|
7047
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
6914
7048
|
function useLoader(loaderConfig, initialState) {
|
|
6915
7049
|
const config = __spreadValues({
|
|
6916
7050
|
size: Size4.EXTRA_LARGE,
|
|
6917
7051
|
initial: true,
|
|
6918
7052
|
submission: false
|
|
6919
7053
|
}, loaderConfig);
|
|
6920
|
-
const [loadingState, setLoadingState] =
|
|
7054
|
+
const [loadingState, setLoadingState] = useState25(initialState);
|
|
6921
7055
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6922
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */
|
|
7056
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ jsx69(
|
|
6923
7057
|
Loader3,
|
|
6924
7058
|
{
|
|
6925
7059
|
size: config.size,
|
|
@@ -6935,11 +7069,11 @@ import { Component } from "react";
|
|
|
6935
7069
|
|
|
6936
7070
|
// src/common/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6937
7071
|
import { Alert as Alert2, Sentiment } from "@transferwise/components";
|
|
6938
|
-
import { useIntl as
|
|
6939
|
-
import { jsx as
|
|
7072
|
+
import { useIntl as useIntl17 } from "react-intl";
|
|
7073
|
+
import { jsx as jsx70 } from "react/jsx-runtime";
|
|
6940
7074
|
function ErrorBoundaryAlert({ onDismiss }) {
|
|
6941
|
-
const { formatMessage } =
|
|
6942
|
-
return /* @__PURE__ */
|
|
7075
|
+
const { formatMessage } = useIntl17();
|
|
7076
|
+
return /* @__PURE__ */ jsx70(
|
|
6943
7077
|
Alert2,
|
|
6944
7078
|
{
|
|
6945
7079
|
action: {
|
|
@@ -6955,7 +7089,7 @@ function ErrorBoundaryAlert({ onDismiss }) {
|
|
|
6955
7089
|
}
|
|
6956
7090
|
|
|
6957
7091
|
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
6958
|
-
import { Fragment as Fragment16, jsx as
|
|
7092
|
+
import { Fragment as Fragment16, jsx as jsx71, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
6959
7093
|
var noop6 = () => {
|
|
6960
7094
|
};
|
|
6961
7095
|
var ErrorBoundary = class extends Component {
|
|
@@ -6976,8 +7110,8 @@ var ErrorBoundary = class extends Component {
|
|
|
6976
7110
|
render() {
|
|
6977
7111
|
const { children } = this.props;
|
|
6978
7112
|
const { hasError, isFatalError } = this.state;
|
|
6979
|
-
return /* @__PURE__ */
|
|
6980
|
-
hasError && /* @__PURE__ */
|
|
7113
|
+
return /* @__PURE__ */ jsxs31(Fragment16, { children: [
|
|
7114
|
+
hasError && /* @__PURE__ */ jsx71(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6981
7115
|
!isFatalError && children
|
|
6982
7116
|
] });
|
|
6983
7117
|
}
|
|
@@ -7076,7 +7210,7 @@ var assertResponseIsValid = (response) => {
|
|
|
7076
7210
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
7077
7211
|
|
|
7078
7212
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
7079
|
-
import { jsx as
|
|
7213
|
+
import { jsx as jsx72 } from "react/jsx-runtime";
|
|
7080
7214
|
var noop7 = () => {
|
|
7081
7215
|
};
|
|
7082
7216
|
var DynamicFlowComponent = ({
|
|
@@ -7092,7 +7226,7 @@ var DynamicFlowComponent = ({
|
|
|
7092
7226
|
onEvent = noop7,
|
|
7093
7227
|
onLog = noop7
|
|
7094
7228
|
}) => {
|
|
7095
|
-
const { locale } =
|
|
7229
|
+
const { locale } = useIntl18();
|
|
7096
7230
|
const {
|
|
7097
7231
|
formErrors,
|
|
7098
7232
|
globalError,
|
|
@@ -7105,7 +7239,7 @@ var DynamicFlowComponent = ({
|
|
|
7105
7239
|
setStepAndEtag,
|
|
7106
7240
|
setSchemaModel
|
|
7107
7241
|
} = useDynamicFlowState(initialStep);
|
|
7108
|
-
const [submitted, setSubmitted] =
|
|
7242
|
+
const [submitted, setSubmitted] = useState26(false);
|
|
7109
7243
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
7110
7244
|
loaderConfig,
|
|
7111
7245
|
initialStep ? "idle" : "initial"
|
|
@@ -7123,14 +7257,14 @@ var DynamicFlowComponent = ({
|
|
|
7123
7257
|
);
|
|
7124
7258
|
}
|
|
7125
7259
|
};
|
|
7126
|
-
const analyticsMetadata =
|
|
7260
|
+
const analyticsMetadata = useMemo17(
|
|
7127
7261
|
() => {
|
|
7128
7262
|
var _a;
|
|
7129
7263
|
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 : {});
|
|
7130
7264
|
},
|
|
7131
7265
|
[flowId, step]
|
|
7132
7266
|
);
|
|
7133
|
-
const dispatchEvent =
|
|
7267
|
+
const dispatchEvent = useMemo17(
|
|
7134
7268
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
7135
7269
|
[onEvent, analyticsMetadata]
|
|
7136
7270
|
);
|
|
@@ -7193,10 +7327,10 @@ var DynamicFlowComponent = ({
|
|
|
7193
7327
|
},
|
|
7194
7328
|
[onCompletion, dispatchEvent]
|
|
7195
7329
|
);
|
|
7196
|
-
|
|
7330
|
+
useEffect21(() => {
|
|
7197
7331
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
7198
7332
|
}, []);
|
|
7199
|
-
|
|
7333
|
+
useEffect21(() => {
|
|
7200
7334
|
if (!initialStep) {
|
|
7201
7335
|
const action = __spreadValues({
|
|
7202
7336
|
id: "#initial-step-request",
|
|
@@ -7314,7 +7448,7 @@ var DynamicFlowComponent = ({
|
|
|
7314
7448
|
await performAction(action);
|
|
7315
7449
|
}
|
|
7316
7450
|
};
|
|
7317
|
-
return /* @__PURE__ */
|
|
7451
|
+
return /* @__PURE__ */ jsx72(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ jsx72(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ jsx72(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ jsx72(HttpClientProvider, { httpClient, children: /* @__PURE__ */ jsx72(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ jsx72(
|
|
7318
7452
|
DynamicFlowStep,
|
|
7319
7453
|
{
|
|
7320
7454
|
step,
|
|
@@ -7331,7 +7465,7 @@ var DynamicFlowComponent = ({
|
|
|
7331
7465
|
) }) }) }) }) });
|
|
7332
7466
|
};
|
|
7333
7467
|
function DynamicFlow(props) {
|
|
7334
|
-
return /* @__PURE__ */
|
|
7468
|
+
return /* @__PURE__ */ jsx72(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ jsx72(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7335
7469
|
}
|
|
7336
7470
|
var DynamicFlow_default = DynamicFlow;
|
|
7337
7471
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -7348,19 +7482,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7348
7482
|
};
|
|
7349
7483
|
|
|
7350
7484
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7351
|
-
import { jsx as
|
|
7485
|
+
import { jsx as jsx73 } from "react/jsx-runtime";
|
|
7352
7486
|
function JsonSchemaForm(props) {
|
|
7353
7487
|
const schemaProps = __spreadValues({
|
|
7354
7488
|
model: null,
|
|
7355
7489
|
errors: null
|
|
7356
7490
|
}, props);
|
|
7357
7491
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
7358
|
-
return /* @__PURE__ */
|
|
7492
|
+
return /* @__PURE__ */ jsx73(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ jsx73(
|
|
7359
7493
|
EventsContextProvider,
|
|
7360
7494
|
{
|
|
7361
7495
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
7362
7496
|
onEvent,
|
|
7363
|
-
children: /* @__PURE__ */
|
|
7497
|
+
children: /* @__PURE__ */ jsx73(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ jsx73(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7364
7498
|
}
|
|
7365
7499
|
) });
|
|
7366
7500
|
}
|
|
@@ -7458,6 +7592,7 @@ var en_default = {
|
|
|
7458
7592
|
"dynamicFlows.ExternalConfirmation.open": "Open in new tab",
|
|
7459
7593
|
"dynamicFlows.ExternalConfirmation.title": "Please confirm",
|
|
7460
7594
|
"dynamicFlows.Help.ariaLabel": "Click here for more info.",
|
|
7595
|
+
"dynamicFlows.MultiSelect.summary": "{first} and {count} more",
|
|
7461
7596
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "Sorry, that file is too big. Please upload a smaller file.",
|
|
7462
7597
|
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "Please upload {maxItems} or fewer files.",
|
|
7463
7598
|
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "Please upload at least {minItems} file(s).",
|
|
@@ -8175,8 +8310,8 @@ var translations = {
|
|
|
8175
8310
|
var i18n_default = translations;
|
|
8176
8311
|
|
|
8177
8312
|
// src/revamp/DynamicFlowWise.tsx
|
|
8178
|
-
import { useMemo as
|
|
8179
|
-
import { useIntl as
|
|
8313
|
+
import { useMemo as useMemo20 } from "react";
|
|
8314
|
+
import { useIntl as useIntl24 } from "react-intl";
|
|
8180
8315
|
|
|
8181
8316
|
// src/revamp/wise/renderers/AlertRenderer.tsx
|
|
8182
8317
|
import { Alert as Alert3 } from "@transferwise/components";
|
|
@@ -8212,10 +8347,10 @@ var getTextAlignment2 = (align) => {
|
|
|
8212
8347
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
8213
8348
|
|
|
8214
8349
|
// src/revamp/wise/renderers/AlertRenderer.tsx
|
|
8215
|
-
import { jsx as
|
|
8350
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
8216
8351
|
var AlertRenderer = {
|
|
8217
8352
|
canRenderType: "alert",
|
|
8218
|
-
render: ({ context, markdown, margin }) => /* @__PURE__ */
|
|
8353
|
+
render: ({ context, markdown, margin }) => /* @__PURE__ */ jsx74(Alert3, { type: context, className: getMargin2(margin), message: markdown })
|
|
8219
8354
|
};
|
|
8220
8355
|
var AlertRenderer_default = AlertRenderer;
|
|
8221
8356
|
|
|
@@ -8243,11 +8378,11 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
8243
8378
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
8244
8379
|
}
|
|
8245
8380
|
|
|
8246
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.3_@transferwise+components@46.
|
|
8247
|
-
var
|
|
8381
|
+
// ../../node_modules/.pnpm/@wise+forms@0.3.3_@transferwise+components@46.22.1_@types+react@18.0.29_react@18.2.0/node_modules/@wise/forms/dist/index.esm.js
|
|
8382
|
+
var import_classnames10 = __toESM(require_classnames());
|
|
8248
8383
|
import { InlineAlert as InlineAlert2, Sentiment as Sentiment2, Input as Input2, TextArea } from "@transferwise/components";
|
|
8249
8384
|
import { createContext as createContext6, useContext as useContext7, forwardRef as forwardRef2 } from "react";
|
|
8250
|
-
import { jsx as
|
|
8385
|
+
import { jsx as jsx75, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8251
8386
|
var InputIdContext = /* @__PURE__ */ createContext6(void 0);
|
|
8252
8387
|
var InputIdContextProvider = InputIdContext.Provider;
|
|
8253
8388
|
var FormControlDescribedByContext = /* @__PURE__ */ createContext6(void 0);
|
|
@@ -8260,10 +8395,10 @@ var Label = ({
|
|
|
8260
8395
|
className,
|
|
8261
8396
|
children
|
|
8262
8397
|
}) => {
|
|
8263
|
-
return /* @__PURE__ */
|
|
8398
|
+
return /* @__PURE__ */ jsx75("label", {
|
|
8264
8399
|
id,
|
|
8265
8400
|
htmlFor,
|
|
8266
|
-
className: (0,
|
|
8401
|
+
className: (0, import_classnames10.default)("control-label d-flex flex-column gap-y-1 m-b-0", className),
|
|
8267
8402
|
children
|
|
8268
8403
|
});
|
|
8269
8404
|
};
|
|
@@ -8280,25 +8415,25 @@ var Field = ({
|
|
|
8280
8415
|
const fallbackInputId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
8281
8416
|
const inputId = id !== null ? id != null ? id : fallbackInputId : void 0;
|
|
8282
8417
|
const descriptionId = $1746a345f3d73bb7$export$f680877a34711e37();
|
|
8283
|
-
return /* @__PURE__ */
|
|
8418
|
+
return /* @__PURE__ */ jsx75(InputIdContextProvider, {
|
|
8284
8419
|
value: inputId,
|
|
8285
|
-
children: /* @__PURE__ */
|
|
8420
|
+
children: /* @__PURE__ */ jsx75(FormControlDescribedByProvider, {
|
|
8286
8421
|
value: hasError || hasHint ? descriptionId : void 0,
|
|
8287
|
-
children: /* @__PURE__ */
|
|
8422
|
+
children: /* @__PURE__ */ jsx75(FormControlInvalidProvider, {
|
|
8288
8423
|
value: hasError,
|
|
8289
|
-
children: /* @__PURE__ */
|
|
8290
|
-
className: (0,
|
|
8424
|
+
children: /* @__PURE__ */ jsxs32("div", {
|
|
8425
|
+
className: (0, import_classnames10.default)("form-group d-block", {
|
|
8291
8426
|
"has-error": hasError,
|
|
8292
8427
|
"has-info": hasHint
|
|
8293
8428
|
}, className),
|
|
8294
|
-
children: [/* @__PURE__ */
|
|
8429
|
+
children: [/* @__PURE__ */ jsxs32(Label, {
|
|
8295
8430
|
htmlFor: inputId,
|
|
8296
8431
|
children: [label, children]
|
|
8297
|
-
}), hasHint && /* @__PURE__ */
|
|
8432
|
+
}), hasHint && /* @__PURE__ */ jsx75(InlineAlert2, {
|
|
8298
8433
|
type: Sentiment2.NEUTRAL,
|
|
8299
8434
|
id: descriptionId,
|
|
8300
8435
|
children: hint
|
|
8301
|
-
}), hasError && /* @__PURE__ */
|
|
8436
|
+
}), hasError && /* @__PURE__ */ jsx75(InlineAlert2, {
|
|
8302
8437
|
type: Sentiment2.NEGATIVE,
|
|
8303
8438
|
id: descriptionId,
|
|
8304
8439
|
children: error
|
|
@@ -8311,15 +8446,15 @@ var Field = ({
|
|
|
8311
8446
|
|
|
8312
8447
|
// src/revamp/wise/renderers/components/Help.tsx
|
|
8313
8448
|
import { Info as Info2, Markdown as Markdown3 } from "@transferwise/components";
|
|
8314
|
-
import { useIntl as
|
|
8315
|
-
import { jsx as
|
|
8449
|
+
import { useIntl as useIntl19 } from "react-intl";
|
|
8450
|
+
import { jsx as jsx76 } from "react/jsx-runtime";
|
|
8316
8451
|
function Help2({ help }) {
|
|
8317
|
-
const intl =
|
|
8318
|
-
return /* @__PURE__ */
|
|
8452
|
+
const intl = useIntl19();
|
|
8453
|
+
return /* @__PURE__ */ jsx76(
|
|
8319
8454
|
Info2,
|
|
8320
8455
|
{
|
|
8321
8456
|
className: "m-l-1",
|
|
8322
|
-
content: /* @__PURE__ */
|
|
8457
|
+
content: /* @__PURE__ */ jsx76(Markdown3, { config: { link: { target: "_blank" } }, children: help }),
|
|
8323
8458
|
presentation: "POPOVER",
|
|
8324
8459
|
size: "sm",
|
|
8325
8460
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -8329,46 +8464,46 @@ function Help2({ help }) {
|
|
|
8329
8464
|
var Help_default2 = Help2;
|
|
8330
8465
|
|
|
8331
8466
|
// src/revamp/wise/renderers/components/LabelContentWithHelp.tsx
|
|
8332
|
-
import { jsx as
|
|
8467
|
+
import { jsx as jsx77, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8333
8468
|
function LabelContentWithHelp({ text, help }) {
|
|
8334
|
-
return /* @__PURE__ */
|
|
8469
|
+
return /* @__PURE__ */ jsxs33("div", { children: [
|
|
8335
8470
|
text,
|
|
8336
|
-
/* @__PURE__ */
|
|
8471
|
+
/* @__PURE__ */ jsx77(Help_default2, { help })
|
|
8337
8472
|
] });
|
|
8338
8473
|
}
|
|
8339
8474
|
|
|
8340
8475
|
// src/revamp/wise/renderers/components/FieldInput.tsx
|
|
8341
|
-
import { jsx as
|
|
8476
|
+
import { jsx as jsx78 } from "react/jsx-runtime";
|
|
8342
8477
|
function FieldInput({ id, children, label, error, description, help }) {
|
|
8343
|
-
const labelContent = label && help ? /* @__PURE__ */
|
|
8344
|
-
return /* @__PURE__ */
|
|
8478
|
+
const labelContent = label && help ? /* @__PURE__ */ jsx78(LabelContentWithHelp, { text: label, help }) : label;
|
|
8479
|
+
return /* @__PURE__ */ jsx78(Field, { id, label: labelContent, hint: description, error, children });
|
|
8345
8480
|
}
|
|
8346
8481
|
var FieldInput_default = FieldInput;
|
|
8347
8482
|
|
|
8348
8483
|
// src/revamp/wise/renderers/BooleanInputRenderer.tsx
|
|
8349
8484
|
import { Checkbox as Checkbox3 } from "@transferwise/components";
|
|
8350
|
-
import { jsx as
|
|
8485
|
+
import { jsx as jsx79 } from "react/jsx-runtime";
|
|
8351
8486
|
var BooleanInputRenderer = {
|
|
8352
8487
|
canRenderType: "input-boolean",
|
|
8353
8488
|
render: (props) => {
|
|
8354
8489
|
const _a = props, { id, control, label = "", description, help, error, type, value } = _a, rest = __objRest(_a, ["id", "control", "label", "description", "help", "error", "type", "value"]);
|
|
8355
8490
|
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label, checked: value });
|
|
8356
|
-
return /* @__PURE__ */
|
|
8491
|
+
return /* @__PURE__ */ jsx79(FieldInput_default, { id, label: "", description, error, help, children: /* @__PURE__ */ jsx79(Checkbox3, __spreadValues({ id }, checkboxProps)) });
|
|
8357
8492
|
}
|
|
8358
8493
|
};
|
|
8359
8494
|
var BooleanInputRenderer_default = BooleanInputRenderer;
|
|
8360
8495
|
|
|
8361
8496
|
// src/revamp/wise/renderers/BoxRenderer.tsx
|
|
8362
|
-
var
|
|
8363
|
-
import { jsx as
|
|
8497
|
+
var import_classnames11 = __toESM(require_classnames());
|
|
8498
|
+
import { jsx as jsx80 } from "react/jsx-runtime";
|
|
8364
8499
|
var BoxRenderer = {
|
|
8365
8500
|
canRenderType: "box",
|
|
8366
8501
|
render: ({ border, children, margin, width }) => {
|
|
8367
8502
|
const hasFixedWidth = width !== "xl";
|
|
8368
|
-
const contents = /* @__PURE__ */
|
|
8503
|
+
const contents = /* @__PURE__ */ jsx80(
|
|
8369
8504
|
"div",
|
|
8370
8505
|
{
|
|
8371
|
-
className: (0,
|
|
8506
|
+
className: (0, import_classnames11.default)({
|
|
8372
8507
|
"df-box-renderer-border": border,
|
|
8373
8508
|
[`df-box-renderer-width-${width}`]: hasFixedWidth,
|
|
8374
8509
|
[getMargin2(margin)]: !hasFixedWidth
|
|
@@ -8376,7 +8511,7 @@ var BoxRenderer = {
|
|
|
8376
8511
|
children
|
|
8377
8512
|
}
|
|
8378
8513
|
);
|
|
8379
|
-
return hasFixedWidth ? /* @__PURE__ */
|
|
8514
|
+
return hasFixedWidth ? /* @__PURE__ */ jsx80("div", { className: (0, import_classnames11.default)("df-box-renderer-fixed-width", getMargin2(margin)), children: contents }) : contents;
|
|
8380
8515
|
}
|
|
8381
8516
|
};
|
|
8382
8517
|
var BoxRenderer_default = BoxRenderer;
|
|
@@ -8394,7 +8529,7 @@ var useLoadingContext = () => {
|
|
|
8394
8529
|
};
|
|
8395
8530
|
|
|
8396
8531
|
// src/revamp/wise/renderers/ButtonRenderer.tsx
|
|
8397
|
-
import { jsx as
|
|
8532
|
+
import { jsx as jsx81 } from "react/jsx-runtime";
|
|
8398
8533
|
var ButtonRenderer = {
|
|
8399
8534
|
canRenderType: "button",
|
|
8400
8535
|
render: ButtonRendererComponent
|
|
@@ -8412,7 +8547,7 @@ function ButtonRendererComponent({
|
|
|
8412
8547
|
const priority = mapControl(control);
|
|
8413
8548
|
const type = priority === "tertiary" ? void 0 : mapContext(context);
|
|
8414
8549
|
const { isLoading } = useLoadingContext();
|
|
8415
|
-
return /* @__PURE__ */
|
|
8550
|
+
return /* @__PURE__ */ jsx81(
|
|
8416
8551
|
Button7,
|
|
8417
8552
|
{
|
|
8418
8553
|
block: true,
|
|
@@ -8463,20 +8598,20 @@ var mapSize = (size) => {
|
|
|
8463
8598
|
var ButtonRenderer_default = ButtonRenderer;
|
|
8464
8599
|
|
|
8465
8600
|
// src/revamp/wise/renderers/ColumnsRenderer.tsx
|
|
8466
|
-
var
|
|
8467
|
-
import { jsx as
|
|
8601
|
+
var import_classnames12 = __toESM(require_classnames());
|
|
8602
|
+
import { jsx as jsx82, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8468
8603
|
var ColumnsRenderer = {
|
|
8469
8604
|
canRenderType: "columns",
|
|
8470
|
-
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */
|
|
8605
|
+
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ jsxs34(
|
|
8471
8606
|
"div",
|
|
8472
8607
|
{
|
|
8473
|
-
className: (0,
|
|
8608
|
+
className: (0, import_classnames12.default)("df-columns-renderer-container", getMargin2(margin), {
|
|
8474
8609
|
"df-columns-renderer-bias-start": bias === "start",
|
|
8475
8610
|
"df-columns-renderer-bias-end": bias === "end"
|
|
8476
8611
|
}),
|
|
8477
8612
|
children: [
|
|
8478
|
-
/* @__PURE__ */
|
|
8479
|
-
/* @__PURE__ */
|
|
8613
|
+
/* @__PURE__ */ jsx82("div", { className: "df-columns-renderer-column", children: startChildren }),
|
|
8614
|
+
/* @__PURE__ */ jsx82("div", { className: "df-columns-renderer-column", children: endChildren })
|
|
8480
8615
|
]
|
|
8481
8616
|
}
|
|
8482
8617
|
)
|
|
@@ -8515,14 +8650,14 @@ var dateToDateString2 = (date) => {
|
|
|
8515
8650
|
};
|
|
8516
8651
|
|
|
8517
8652
|
// src/revamp/wise/renderers/components/VariableDateInput.tsx
|
|
8518
|
-
import { jsx as
|
|
8653
|
+
import { jsx as jsx83 } from "react/jsx-runtime";
|
|
8519
8654
|
function VariableDateInput({
|
|
8520
8655
|
control,
|
|
8521
8656
|
inputProps
|
|
8522
8657
|
}) {
|
|
8523
8658
|
const { minimumDate, maximumDate, placeholder, disabled, onBlur, onChange, onFocus } = inputProps;
|
|
8524
8659
|
if (control === "date-lookup") {
|
|
8525
|
-
return /* @__PURE__ */
|
|
8660
|
+
return /* @__PURE__ */ jsx83(
|
|
8526
8661
|
DateLookup2,
|
|
8527
8662
|
{
|
|
8528
8663
|
value: dateStringToDateOrNull(inputProps.value),
|
|
@@ -8538,12 +8673,12 @@ function VariableDateInput({
|
|
|
8538
8673
|
}
|
|
8539
8674
|
);
|
|
8540
8675
|
}
|
|
8541
|
-
return /* @__PURE__ */
|
|
8676
|
+
return /* @__PURE__ */ jsx83(DateInput2, __spreadValues({}, inputProps));
|
|
8542
8677
|
}
|
|
8543
8678
|
var VariableDateInput_default = VariableDateInput;
|
|
8544
8679
|
|
|
8545
8680
|
// src/revamp/wise/renderers/DateInputRenderer.tsx
|
|
8546
|
-
import { jsx as
|
|
8681
|
+
import { jsx as jsx84 } from "react/jsx-runtime";
|
|
8547
8682
|
var DateInputRenderer = {
|
|
8548
8683
|
canRenderType: "input-date",
|
|
8549
8684
|
render: (props) => {
|
|
@@ -8568,7 +8703,7 @@ var DateInputRenderer = {
|
|
|
8568
8703
|
]);
|
|
8569
8704
|
const value = initialValue != null ? initialValue : "";
|
|
8570
8705
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
8571
|
-
return /* @__PURE__ */
|
|
8706
|
+
return /* @__PURE__ */ jsx84(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx84(VariableDateInput_default, { control, inputProps }) });
|
|
8572
8707
|
}
|
|
8573
8708
|
};
|
|
8574
8709
|
var DateInputRenderer_default = DateInputRenderer;
|
|
@@ -8577,7 +8712,7 @@ var DateInputRenderer_default = DateInputRenderer;
|
|
|
8577
8712
|
import { NavigationOptionsList as NavigationOptionsList3, NavigationOption as NavigationOption5 } from "@transferwise/components";
|
|
8578
8713
|
|
|
8579
8714
|
// src/revamp/wise/renderers/components/icon/FlagIcon.tsx
|
|
8580
|
-
import { jsx as
|
|
8715
|
+
import { jsx as jsx85 } from "react/jsx-runtime";
|
|
8581
8716
|
var isFlagIcon2 = (name) => isCurrencyFlagIcon2(name) || isCountryFlagIcon2(name);
|
|
8582
8717
|
var isCurrencyFlagIcon2 = (name) => currencyCodes2.some((currencyCode) => name === `flag-${currencyCode}`);
|
|
8583
8718
|
var isCountryFlagIcon2 = (name) => countryCodes2.some((countryCode) => name === `flag-${countryCode}`);
|
|
@@ -8586,7 +8721,7 @@ function FlagIcon2({ name }) {
|
|
|
8586
8721
|
return null;
|
|
8587
8722
|
}
|
|
8588
8723
|
const code = name.substring(5);
|
|
8589
|
-
return /* @__PURE__ */
|
|
8724
|
+
return /* @__PURE__ */ jsx85(
|
|
8590
8725
|
"img",
|
|
8591
8726
|
{
|
|
8592
8727
|
src: `https://wise.com/web-art/assets/flags/${code}.svg`,
|
|
@@ -8780,7 +8915,7 @@ var countryCodes2 = [
|
|
|
8780
8915
|
|
|
8781
8916
|
// src/revamp/wise/renderers/components/icon/NamedIcon.tsx
|
|
8782
8917
|
import * as icons2 from "@transferwise/icons";
|
|
8783
|
-
import { jsx as
|
|
8918
|
+
import { jsx as jsx86 } from "react/jsx-runtime";
|
|
8784
8919
|
var isNamedIcon2 = (name) => {
|
|
8785
8920
|
const iconName = toCapitalisedCamelCase2(name);
|
|
8786
8921
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -8791,19 +8926,19 @@ function NamedIcon2({ name }) {
|
|
|
8791
8926
|
}
|
|
8792
8927
|
const iconName = toCapitalisedCamelCase2(name);
|
|
8793
8928
|
const Icon = icons2[iconName];
|
|
8794
|
-
return /* @__PURE__ */
|
|
8929
|
+
return /* @__PURE__ */ jsx86(Icon, { size: 24 });
|
|
8795
8930
|
}
|
|
8796
8931
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
8797
8932
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
8798
8933
|
|
|
8799
8934
|
// src/revamp/wise/renderers/components/icon/DynamicIcon.tsx
|
|
8800
|
-
import { jsx as
|
|
8935
|
+
import { jsx as jsx87 } from "react/jsx-runtime";
|
|
8801
8936
|
function DynamicIcon2({ name }) {
|
|
8802
8937
|
if (isFlagIcon2(name)) {
|
|
8803
|
-
return /* @__PURE__ */
|
|
8938
|
+
return /* @__PURE__ */ jsx87(FlagIcon2, { name });
|
|
8804
8939
|
}
|
|
8805
8940
|
if (isNamedIcon2(name)) {
|
|
8806
|
-
return /* @__PURE__ */
|
|
8941
|
+
return /* @__PURE__ */ jsx87(NamedIcon2, { name });
|
|
8807
8942
|
}
|
|
8808
8943
|
return null;
|
|
8809
8944
|
}
|
|
@@ -8811,25 +8946,25 @@ var DynamicIcon_default2 = DynamicIcon2;
|
|
|
8811
8946
|
|
|
8812
8947
|
// src/revamp/wise/renderers/components/icon/NavigationOptionMedia.tsx
|
|
8813
8948
|
import { Avatar as Avatar4, AvatarType as AvatarType3 } from "@transferwise/components";
|
|
8814
|
-
import { jsx as
|
|
8949
|
+
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
8815
8950
|
function NavigationOptionMedia({ icon, image }) {
|
|
8816
8951
|
if (!isNullish2(icon)) {
|
|
8817
8952
|
if ("name" in icon) {
|
|
8818
|
-
return /* @__PURE__ */
|
|
8953
|
+
return /* @__PURE__ */ jsx88(Avatar4, { type: AvatarType3.ICON, children: /* @__PURE__ */ jsx88(DynamicIcon_default2, { name: icon.name }) });
|
|
8819
8954
|
}
|
|
8820
8955
|
if (icon.text) {
|
|
8821
|
-
return /* @__PURE__ */
|
|
8956
|
+
return /* @__PURE__ */ jsx88(Avatar4, { type: AvatarType3.INITIALS, children: icon.text });
|
|
8822
8957
|
}
|
|
8823
8958
|
}
|
|
8824
8959
|
if (image == null ? void 0 : image.url) {
|
|
8825
8960
|
const { url, accessibilityDescription } = image;
|
|
8826
|
-
return /* @__PURE__ */
|
|
8961
|
+
return /* @__PURE__ */ jsx88("img", { src: url, alt: accessibilityDescription });
|
|
8827
8962
|
}
|
|
8828
8963
|
return null;
|
|
8829
8964
|
}
|
|
8830
8965
|
|
|
8831
8966
|
// src/revamp/wise/renderers/DecisionRenderer.tsx
|
|
8832
|
-
import { jsx as
|
|
8967
|
+
import { jsx as jsx89 } from "react/jsx-runtime";
|
|
8833
8968
|
var DecisionRenderer = {
|
|
8834
8969
|
canRenderType: "decision",
|
|
8835
8970
|
render: DecisionRendererComponent
|
|
@@ -8837,13 +8972,13 @@ var DecisionRenderer = {
|
|
|
8837
8972
|
var DecisionRenderer_default = DecisionRenderer;
|
|
8838
8973
|
function DecisionRendererComponent({ margin, options }) {
|
|
8839
8974
|
const { isLoading } = useLoadingContext();
|
|
8840
|
-
return /* @__PURE__ */
|
|
8975
|
+
return /* @__PURE__ */ jsx89("div", { className: getMargin2(margin), children: /* @__PURE__ */ jsx89(NavigationOptionsList3, { children: options.map(({ description, disabled, icon, image, title, onClick }) => /* @__PURE__ */ jsx89(
|
|
8841
8976
|
NavigationOption5,
|
|
8842
8977
|
{
|
|
8843
8978
|
title,
|
|
8844
8979
|
content: description,
|
|
8845
8980
|
disabled: isLoading || disabled,
|
|
8846
|
-
media: /* @__PURE__ */
|
|
8981
|
+
media: /* @__PURE__ */ jsx89(NavigationOptionMedia, { icon, image }),
|
|
8847
8982
|
showMediaCircle: false,
|
|
8848
8983
|
showMediaAtAllSizes: true,
|
|
8849
8984
|
onClick
|
|
@@ -8853,36 +8988,36 @@ function DecisionRendererComponent({ margin, options }) {
|
|
|
8853
8988
|
}
|
|
8854
8989
|
|
|
8855
8990
|
// src/revamp/wise/renderers/DividerRenderer.tsx
|
|
8856
|
-
import { jsx as
|
|
8991
|
+
import { jsx as jsx90 } from "react/jsx-runtime";
|
|
8857
8992
|
var DividerRenderer = {
|
|
8858
8993
|
canRenderType: "divider",
|
|
8859
|
-
render: ({ margin }) => /* @__PURE__ */
|
|
8994
|
+
render: ({ margin }) => /* @__PURE__ */ jsx90("hr", { className: `m-t-0 ${getMargin2(margin)}` })
|
|
8860
8995
|
};
|
|
8861
8996
|
var DividerRenderer_default = DividerRenderer;
|
|
8862
8997
|
|
|
8863
8998
|
// src/revamp/wise/renderers/FormRenderer.tsx
|
|
8864
|
-
import { jsx as
|
|
8999
|
+
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
8865
9000
|
var FormRenderer = {
|
|
8866
9001
|
canRenderType: "form",
|
|
8867
|
-
render: ({ children, margin }) => /* @__PURE__ */
|
|
9002
|
+
render: ({ children, margin }) => /* @__PURE__ */ jsx91("div", { className: getMargin2(margin), children })
|
|
8868
9003
|
};
|
|
8869
9004
|
var FormRenderer_default = FormRenderer;
|
|
8870
9005
|
|
|
8871
9006
|
// src/revamp/wise/renderers/FormSectionRenderer.tsx
|
|
8872
9007
|
import { Header as Header8 } from "@transferwise/components";
|
|
8873
|
-
import { jsx as
|
|
9008
|
+
import { jsx as jsx92, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8874
9009
|
var FormSectionRenderer = {
|
|
8875
9010
|
canRenderType: "form-section",
|
|
8876
|
-
render: ({ title, description, children }) => /* @__PURE__ */
|
|
9011
|
+
render: ({ title, description, children }) => /* @__PURE__ */ jsxs35("fieldset", { children: [
|
|
8877
9012
|
title && // TODO - once section headers support help, we could show help in here
|
|
8878
|
-
/* @__PURE__ */
|
|
9013
|
+
/* @__PURE__ */ jsx92(
|
|
8879
9014
|
Header8,
|
|
8880
9015
|
{
|
|
8881
9016
|
as: "h2",
|
|
8882
9017
|
title
|
|
8883
9018
|
}
|
|
8884
9019
|
),
|
|
8885
|
-
description && /* @__PURE__ */
|
|
9020
|
+
description && /* @__PURE__ */ jsx92("p", { children: description }),
|
|
8886
9021
|
children
|
|
8887
9022
|
] })
|
|
8888
9023
|
};
|
|
@@ -8890,32 +9025,32 @@ var FormSectionRenderer_default = FormSectionRenderer;
|
|
|
8890
9025
|
|
|
8891
9026
|
// src/revamp/wise/renderers/HeadingRenderer.tsx
|
|
8892
9027
|
import { Display as Display2 } from "@transferwise/components";
|
|
8893
|
-
import { jsx as
|
|
9028
|
+
import { jsx as jsx93 } from "react/jsx-runtime";
|
|
8894
9029
|
var HeadingRenderer = {
|
|
8895
9030
|
canRenderType: "heading",
|
|
8896
|
-
render: (props) => /* @__PURE__ */
|
|
9031
|
+
render: (props) => /* @__PURE__ */ jsx93(Heading, __spreadValues({}, props))
|
|
8897
9032
|
};
|
|
8898
9033
|
function Heading(props) {
|
|
8899
9034
|
const { text, size, align, margin, control } = props;
|
|
8900
9035
|
const className = getTextAlignmentAndMargin2({ align, margin });
|
|
8901
|
-
return control === "display" ? /* @__PURE__ */
|
|
9036
|
+
return control === "display" ? /* @__PURE__ */ jsx93(DisplayHeading2, { size, text, className }) : /* @__PURE__ */ jsx93(StandardHeading2, { size, text, className });
|
|
8902
9037
|
}
|
|
8903
9038
|
function DisplayHeading2({ size, text, className }) {
|
|
8904
|
-
return /* @__PURE__ */
|
|
9039
|
+
return /* @__PURE__ */ jsx93(Display2, { type: getDisplayType(size), className, children: text });
|
|
8905
9040
|
}
|
|
8906
9041
|
function StandardHeading2({ size, text, className }) {
|
|
8907
9042
|
switch (size) {
|
|
8908
9043
|
case "xs":
|
|
8909
|
-
return /* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsx93("h5", { className, children: text });
|
|
8910
9045
|
case "sm":
|
|
8911
|
-
return /* @__PURE__ */
|
|
9046
|
+
return /* @__PURE__ */ jsx93("h4", { className, children: text });
|
|
8912
9047
|
case "lg":
|
|
8913
|
-
return /* @__PURE__ */
|
|
9048
|
+
return /* @__PURE__ */ jsx93("h2", { className, children: text });
|
|
8914
9049
|
case "xl":
|
|
8915
|
-
return /* @__PURE__ */
|
|
9050
|
+
return /* @__PURE__ */ jsx93("h1", { className, children: text });
|
|
8916
9051
|
case "md":
|
|
8917
9052
|
default:
|
|
8918
|
-
return /* @__PURE__ */
|
|
9053
|
+
return /* @__PURE__ */ jsx93("h3", { className, children: text });
|
|
8919
9054
|
}
|
|
8920
9055
|
}
|
|
8921
9056
|
var getDisplayType = (size) => {
|
|
@@ -8935,11 +9070,11 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
8935
9070
|
|
|
8936
9071
|
// src/revamp/wise/renderers/ImageRenderer.tsx
|
|
8937
9072
|
import { Image as Image2 } from "@transferwise/components";
|
|
8938
|
-
import { useEffect as
|
|
8939
|
-
import { jsx as
|
|
9073
|
+
import { useEffect as useEffect22, useState as useState28 } from "react";
|
|
9074
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
8940
9075
|
var ImageRenderer = {
|
|
8941
9076
|
canRenderType: "image",
|
|
8942
|
-
render: (props) => /* @__PURE__ */
|
|
9077
|
+
render: (props) => /* @__PURE__ */ jsx94(ImageRendererComponent, __spreadValues({}, props))
|
|
8943
9078
|
};
|
|
8944
9079
|
var ImageRenderer_default = ImageRenderer;
|
|
8945
9080
|
function ImageRendererComponent({
|
|
@@ -8948,12 +9083,12 @@ function ImageRendererComponent({
|
|
|
8948
9083
|
size,
|
|
8949
9084
|
url
|
|
8950
9085
|
}) {
|
|
8951
|
-
const [imageSource, setImageSource] =
|
|
9086
|
+
const [imageSource, setImageSource] = useState28("");
|
|
8952
9087
|
const httpClient = useHttpClient();
|
|
8953
|
-
|
|
9088
|
+
useEffect22(() => {
|
|
8954
9089
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
8955
9090
|
}, [url, httpClient]);
|
|
8956
|
-
return /* @__PURE__ */
|
|
9091
|
+
return /* @__PURE__ */ jsx94("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ jsx94(
|
|
8957
9092
|
Image2,
|
|
8958
9093
|
{
|
|
8959
9094
|
className: `img-responsive ${getMargin2(margin)}`,
|
|
@@ -8998,7 +9133,7 @@ var getImageSource2 = async (httpClient, imageUrl) => {
|
|
|
8998
9133
|
|
|
8999
9134
|
// src/revamp/wise/renderers/InstructionsRenderer.tsx
|
|
9000
9135
|
import { Header as Header9, InstructionsList as InstructionsList2 } from "@transferwise/components";
|
|
9001
|
-
import { jsx as
|
|
9136
|
+
import { jsx as jsx95, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9002
9137
|
var doContext2 = ["positive", "neutral"];
|
|
9003
9138
|
var dontContext2 = ["warning", "negative"];
|
|
9004
9139
|
var InstructionsRenderer = {
|
|
@@ -9006,9 +9141,9 @@ var InstructionsRenderer = {
|
|
|
9006
9141
|
render: ({ items, margin, title }) => {
|
|
9007
9142
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
9008
9143
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
9009
|
-
return /* @__PURE__ */
|
|
9010
|
-
title ? /* @__PURE__ */
|
|
9011
|
-
/* @__PURE__ */
|
|
9144
|
+
return /* @__PURE__ */ jsxs36("div", { className: getMargin2(margin), children: [
|
|
9145
|
+
title ? /* @__PURE__ */ jsx95(Header9, { title }) : null,
|
|
9146
|
+
/* @__PURE__ */ jsx95(InstructionsList2, { dos, donts })
|
|
9012
9147
|
] });
|
|
9013
9148
|
}
|
|
9014
9149
|
};
|
|
@@ -9025,12 +9160,12 @@ var onWheel = (event) => {
|
|
|
9025
9160
|
};
|
|
9026
9161
|
|
|
9027
9162
|
// src/revamp/wise/renderers/IntegerInputRenderer.tsx
|
|
9028
|
-
import { jsx as
|
|
9163
|
+
import { jsx as jsx96 } from "react/jsx-runtime";
|
|
9029
9164
|
var IntegerInputRenderer = {
|
|
9030
9165
|
canRenderType: "input-integer",
|
|
9031
9166
|
render: (props) => {
|
|
9032
9167
|
const _a = props, { id, label, error, description, help, type, value, onChange } = _a, rest = __objRest(_a, ["id", "label", "error", "description", "help", "type", "value", "onChange"]);
|
|
9033
|
-
return /* @__PURE__ */
|
|
9168
|
+
return /* @__PURE__ */ jsx96(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx96(
|
|
9034
9169
|
Input3,
|
|
9035
9170
|
__spreadValues({
|
|
9036
9171
|
id,
|
|
@@ -9052,10 +9187,10 @@ var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
|
9052
9187
|
|
|
9053
9188
|
// src/revamp/wise/renderers/LoadingIndicatorRenderer.tsx
|
|
9054
9189
|
import { Loader as Loader4 } from "@transferwise/components";
|
|
9055
|
-
import { jsx as
|
|
9190
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
9056
9191
|
var LoadingIndicatorRenderer = {
|
|
9057
9192
|
canRenderType: "loading-indicator",
|
|
9058
|
-
render: ({ margin, size }) => /* @__PURE__ */
|
|
9193
|
+
render: ({ margin, size }) => /* @__PURE__ */ jsx97(
|
|
9059
9194
|
Loader4,
|
|
9060
9195
|
{
|
|
9061
9196
|
size,
|
|
@@ -9068,27 +9203,27 @@ var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
|
9068
9203
|
|
|
9069
9204
|
// src/revamp/wise/renderers/MarkdownRenderer.tsx
|
|
9070
9205
|
import { Markdown as Markdown4 } from "@transferwise/components";
|
|
9071
|
-
import { jsx as
|
|
9206
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
9072
9207
|
var MarkdownRenderer = {
|
|
9073
9208
|
canRenderType: "markdown",
|
|
9074
|
-
render: ({ content, align, margin }) => /* @__PURE__ */
|
|
9209
|
+
render: ({ content, align, margin }) => /* @__PURE__ */ jsx98("div", { className: getTextAlignmentAndMargin2({ align, margin }), children: /* @__PURE__ */ jsx98(Markdown4, { config: { link: { target: "_blank" } }, children: content }) })
|
|
9075
9210
|
};
|
|
9076
9211
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
9077
9212
|
|
|
9078
9213
|
// src/revamp/wise/renderers/ModalRenderer.tsx
|
|
9079
9214
|
import { Button as Button8, Modal as Modal3 } from "@transferwise/components";
|
|
9080
|
-
import { useState as
|
|
9081
|
-
import { jsx as
|
|
9215
|
+
import { useState as useState29 } from "react";
|
|
9216
|
+
import { jsx as jsx99, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9082
9217
|
var ModalRenderer = {
|
|
9083
9218
|
canRenderType: "modal",
|
|
9084
|
-
render: (props) => /* @__PURE__ */
|
|
9219
|
+
render: (props) => /* @__PURE__ */ jsx99(DFModal, __spreadValues({}, props))
|
|
9085
9220
|
};
|
|
9086
9221
|
var ModalRenderer_default = ModalRenderer;
|
|
9087
9222
|
function DFModal({ content, margin, trigger }) {
|
|
9088
|
-
const [visible, setVisible] =
|
|
9089
|
-
return /* @__PURE__ */
|
|
9090
|
-
/* @__PURE__ */
|
|
9091
|
-
/* @__PURE__ */
|
|
9223
|
+
const [visible, setVisible] = useState29(false);
|
|
9224
|
+
return /* @__PURE__ */ jsxs37("div", { className: getMargin2(margin), children: [
|
|
9225
|
+
/* @__PURE__ */ jsx99(Button8, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
9226
|
+
/* @__PURE__ */ jsx99(
|
|
9092
9227
|
Modal3,
|
|
9093
9228
|
{
|
|
9094
9229
|
scroll: "content",
|
|
@@ -9105,9 +9240,9 @@ function DFModal({ content, margin, trigger }) {
|
|
|
9105
9240
|
import { UploadInput as UploadInput3 } from "@transferwise/components";
|
|
9106
9241
|
|
|
9107
9242
|
// src/revamp/wise/renderers/components/UploadFieldInput.tsx
|
|
9108
|
-
var
|
|
9243
|
+
var import_classnames13 = __toESM(require_classnames());
|
|
9109
9244
|
import { InlineAlert as InlineAlert3 } from "@transferwise/components";
|
|
9110
|
-
import { jsx as
|
|
9245
|
+
import { jsx as jsx100, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9111
9246
|
function UploadFieldInput({
|
|
9112
9247
|
id,
|
|
9113
9248
|
children,
|
|
@@ -9116,18 +9251,18 @@ function UploadFieldInput({
|
|
|
9116
9251
|
error,
|
|
9117
9252
|
help
|
|
9118
9253
|
}) {
|
|
9119
|
-
const labelContent = label && help ? /* @__PURE__ */
|
|
9254
|
+
const labelContent = label && help ? /* @__PURE__ */ jsx100(LabelContentWithHelp, { text: label, help }) : label;
|
|
9120
9255
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
9121
|
-
return /* @__PURE__ */
|
|
9256
|
+
return /* @__PURE__ */ jsxs38(
|
|
9122
9257
|
"div",
|
|
9123
9258
|
{
|
|
9124
|
-
className: (0,
|
|
9259
|
+
className: (0, import_classnames13.default)("form-group d-block", {
|
|
9125
9260
|
"has-error": !!error
|
|
9126
9261
|
}),
|
|
9127
9262
|
children: [
|
|
9128
|
-
/* @__PURE__ */
|
|
9263
|
+
/* @__PURE__ */ jsx100("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
9129
9264
|
children,
|
|
9130
|
-
error && /* @__PURE__ */
|
|
9265
|
+
error && /* @__PURE__ */ jsx100(InlineAlert3, { type: "negative", id: descriptionId, children: error })
|
|
9131
9266
|
]
|
|
9132
9267
|
}
|
|
9133
9268
|
);
|
|
@@ -9170,7 +9305,7 @@ var nanoid = (size = 21) => {
|
|
|
9170
9305
|
var getRandomId = () => nanoid(10);
|
|
9171
9306
|
|
|
9172
9307
|
// src/revamp/wise/renderers/MultiUploadInputRenderer.tsx
|
|
9173
|
-
import { jsx as
|
|
9308
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
9174
9309
|
var MultiUploadInputRenderer = {
|
|
9175
9310
|
canRenderType: "input-upload-multi",
|
|
9176
9311
|
render: (props) => {
|
|
@@ -9197,7 +9332,7 @@ var MultiUploadInputRenderer = {
|
|
|
9197
9332
|
};
|
|
9198
9333
|
const onDeleteFile = async (fileId) => onDelete(String(fileId));
|
|
9199
9334
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
9200
|
-
return /* @__PURE__ */
|
|
9335
|
+
return /* @__PURE__ */ jsx101(UploadFieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx101(
|
|
9201
9336
|
UploadInput3,
|
|
9202
9337
|
{
|
|
9203
9338
|
id,
|
|
@@ -9220,12 +9355,12 @@ var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
|
9220
9355
|
|
|
9221
9356
|
// src/revamp/wise/renderers/NumberInputRenderer.tsx
|
|
9222
9357
|
import { Input as Input4 } from "@transferwise/components";
|
|
9223
|
-
import { jsx as
|
|
9358
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
9224
9359
|
var NumberInputRenderer = {
|
|
9225
9360
|
canRenderType: "input-number",
|
|
9226
9361
|
render: (props) => {
|
|
9227
9362
|
const _a = props, { id, label, error, description, help, type, value, onChange } = _a, rest = __objRest(_a, ["id", "label", "error", "description", "help", "type", "value", "onChange"]);
|
|
9228
|
-
return /* @__PURE__ */
|
|
9363
|
+
return /* @__PURE__ */ jsx102(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx102(
|
|
9229
9364
|
Input4,
|
|
9230
9365
|
__spreadValues({
|
|
9231
9366
|
id,
|
|
@@ -9244,7 +9379,7 @@ var NumberInputRenderer = {
|
|
|
9244
9379
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
9245
9380
|
|
|
9246
9381
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
9247
|
-
import { useIntl as
|
|
9382
|
+
import { useIntl as useIntl20 } from "react-intl";
|
|
9248
9383
|
|
|
9249
9384
|
// src/revamp/wise/renderers/hooks/useSnackBarIfAvailable.ts
|
|
9250
9385
|
import { SnackbarContext as SnackbarContext2 } from "@transferwise/components";
|
|
@@ -9256,57 +9391,57 @@ function useSnackBarIfAvailable2() {
|
|
|
9256
9391
|
}
|
|
9257
9392
|
|
|
9258
9393
|
// src/revamp/wise/renderers/ParagraphRenderer.tsx
|
|
9259
|
-
var
|
|
9394
|
+
var import_classnames14 = __toESM(require_classnames());
|
|
9260
9395
|
import { Button as Button9, Input as Input5 } from "@transferwise/components";
|
|
9261
|
-
import { jsx as
|
|
9396
|
+
import { jsx as jsx103, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9262
9397
|
var ParagraphRenderer = {
|
|
9263
9398
|
canRenderType: "paragraph",
|
|
9264
|
-
render: (props) => /* @__PURE__ */
|
|
9399
|
+
render: (props) => /* @__PURE__ */ jsx103(Paragraph, __spreadValues({}, props))
|
|
9265
9400
|
};
|
|
9266
9401
|
function Paragraph({ align, control, margin, text }) {
|
|
9267
9402
|
const className = getTextAlignmentAndMargin2({ align, margin });
|
|
9268
|
-
return control === "copyable" ? /* @__PURE__ */
|
|
9403
|
+
return control === "copyable" ? /* @__PURE__ */ jsx103(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ jsx103(StandardParagraph, { className, text });
|
|
9269
9404
|
}
|
|
9270
9405
|
function StandardParagraph({ text, className }) {
|
|
9271
|
-
return /* @__PURE__ */
|
|
9406
|
+
return /* @__PURE__ */ jsx103("p", { className, children: text });
|
|
9272
9407
|
}
|
|
9273
9408
|
function CopyableParagraph({
|
|
9274
9409
|
text,
|
|
9275
9410
|
align,
|
|
9276
9411
|
className
|
|
9277
9412
|
}) {
|
|
9278
|
-
const { formatMessage } =
|
|
9413
|
+
const { formatMessage } = useIntl20();
|
|
9279
9414
|
const createSnackbar = useSnackBarIfAvailable2();
|
|
9280
9415
|
const copy = () => {
|
|
9281
9416
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
9282
9417
|
});
|
|
9283
9418
|
};
|
|
9284
9419
|
const inputAlignmentClasses = getTextAlignmentAndMargin2({ align, margin: "sm" });
|
|
9285
|
-
return /* @__PURE__ */
|
|
9286
|
-
/* @__PURE__ */
|
|
9420
|
+
return /* @__PURE__ */ jsxs39("div", { className, children: [
|
|
9421
|
+
/* @__PURE__ */ jsx103(
|
|
9287
9422
|
Input5,
|
|
9288
9423
|
{
|
|
9289
9424
|
type: "text",
|
|
9290
9425
|
value: text,
|
|
9291
9426
|
readOnly: true,
|
|
9292
|
-
className: (0,
|
|
9427
|
+
className: (0, import_classnames14.default)("text-ellipsis", inputAlignmentClasses)
|
|
9293
9428
|
}
|
|
9294
9429
|
),
|
|
9295
|
-
/* @__PURE__ */
|
|
9430
|
+
/* @__PURE__ */ jsx103(Button9, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
9296
9431
|
] });
|
|
9297
9432
|
}
|
|
9298
9433
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
9299
9434
|
|
|
9300
9435
|
// src/revamp/wise/renderers/RepeatableRenderer.tsx
|
|
9301
9436
|
import { Button as Button10, Header as Header10, Modal as Modal4, NavigationOption as NavigationOption6, InlineAlert as InlineAlert4 } from "@transferwise/components";
|
|
9302
|
-
import { useState as
|
|
9437
|
+
import { useState as useState30 } from "react";
|
|
9303
9438
|
import { Plus as Plus2 } from "@transferwise/icons";
|
|
9304
|
-
import { useIntl as
|
|
9305
|
-
var
|
|
9306
|
-
import { Fragment as Fragment17, jsx as
|
|
9439
|
+
import { useIntl as useIntl21 } from "react-intl";
|
|
9440
|
+
var import_classnames15 = __toESM(require_classnames());
|
|
9441
|
+
import { Fragment as Fragment17, jsx as jsx104, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
9307
9442
|
var RepeatableRenderer = {
|
|
9308
9443
|
canRenderType: "repeatable",
|
|
9309
|
-
render: (props) => /* @__PURE__ */
|
|
9444
|
+
render: (props) => /* @__PURE__ */ jsx104(Repeatable, __spreadValues({}, props))
|
|
9310
9445
|
};
|
|
9311
9446
|
function Repeatable(props) {
|
|
9312
9447
|
const {
|
|
@@ -9322,8 +9457,8 @@ function Repeatable(props) {
|
|
|
9322
9457
|
onSave,
|
|
9323
9458
|
onRemove
|
|
9324
9459
|
} = props;
|
|
9325
|
-
const { formatMessage } =
|
|
9326
|
-
const [openModalType, setOpenModalType] =
|
|
9460
|
+
const { formatMessage } = useIntl21();
|
|
9461
|
+
const [openModalType, setOpenModalType] = useState30(null);
|
|
9327
9462
|
const onAddItem = () => {
|
|
9328
9463
|
onAdd();
|
|
9329
9464
|
setOpenModalType("add");
|
|
@@ -9345,40 +9480,40 @@ function Repeatable(props) {
|
|
|
9345
9480
|
const onCancelEdit = () => {
|
|
9346
9481
|
setOpenModalType(null);
|
|
9347
9482
|
};
|
|
9348
|
-
return /* @__PURE__ */
|
|
9349
|
-
title && /* @__PURE__ */
|
|
9350
|
-
description && /* @__PURE__ */
|
|
9351
|
-
/* @__PURE__ */
|
|
9483
|
+
return /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
9484
|
+
title && /* @__PURE__ */ jsx104(Header10, { title }),
|
|
9485
|
+
description && /* @__PURE__ */ jsx104("p", { children: description }),
|
|
9486
|
+
/* @__PURE__ */ jsxs40(
|
|
9352
9487
|
"div",
|
|
9353
9488
|
{
|
|
9354
|
-
className: (0,
|
|
9489
|
+
className: (0, import_classnames15.default)("form-group", {
|
|
9355
9490
|
"has-error": error
|
|
9356
9491
|
}),
|
|
9357
9492
|
children: [
|
|
9358
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */
|
|
9359
|
-
/* @__PURE__ */
|
|
9493
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx104(ItemSummaryOption2, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
9494
|
+
/* @__PURE__ */ jsx104(
|
|
9360
9495
|
NavigationOption6,
|
|
9361
9496
|
{
|
|
9362
|
-
media: /* @__PURE__ */
|
|
9497
|
+
media: /* @__PURE__ */ jsx104(Plus2, {}),
|
|
9363
9498
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
9364
9499
|
showMediaAtAllSizes: true,
|
|
9365
9500
|
onClick: () => onAddItem()
|
|
9366
9501
|
}
|
|
9367
9502
|
),
|
|
9368
|
-
error && /* @__PURE__ */
|
|
9503
|
+
error && /* @__PURE__ */ jsx104(InlineAlert4, { type: "negative", children: error })
|
|
9369
9504
|
]
|
|
9370
9505
|
}
|
|
9371
9506
|
),
|
|
9372
|
-
/* @__PURE__ */
|
|
9507
|
+
/* @__PURE__ */ jsx104(
|
|
9373
9508
|
Modal4,
|
|
9374
9509
|
{
|
|
9375
9510
|
open: openModalType !== null,
|
|
9376
9511
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
9377
|
-
body: /* @__PURE__ */
|
|
9378
|
-
/* @__PURE__ */
|
|
9379
|
-
/* @__PURE__ */
|
|
9380
|
-
/* @__PURE__ */
|
|
9381
|
-
/* @__PURE__ */
|
|
9512
|
+
body: /* @__PURE__ */ jsxs40(Fragment17, { children: [
|
|
9513
|
+
/* @__PURE__ */ jsx104("div", { className: "m-b-2", children: editableItem }),
|
|
9514
|
+
/* @__PURE__ */ jsxs40("div", { children: [
|
|
9515
|
+
/* @__PURE__ */ jsx104(Button10, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
9516
|
+
/* @__PURE__ */ jsx104(Button10, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
|
|
9382
9517
|
] })
|
|
9383
9518
|
] }),
|
|
9384
9519
|
onClose: () => onCancelEdit()
|
|
@@ -9390,10 +9525,10 @@ function ItemSummaryOption2({
|
|
|
9390
9525
|
item,
|
|
9391
9526
|
onClick
|
|
9392
9527
|
}) {
|
|
9393
|
-
return /* @__PURE__ */
|
|
9528
|
+
return /* @__PURE__ */ jsx104(
|
|
9394
9529
|
NavigationOption6,
|
|
9395
9530
|
{
|
|
9396
|
-
media: /* @__PURE__ */
|
|
9531
|
+
media: /* @__PURE__ */ jsx104(NavigationOptionMedia, __spreadValues({}, item)),
|
|
9397
9532
|
title: item.title,
|
|
9398
9533
|
content: item.description,
|
|
9399
9534
|
showMediaAtAllSizes: true,
|
|
@@ -9405,13 +9540,13 @@ var RepeatableRenderer_default = RepeatableRenderer;
|
|
|
9405
9540
|
|
|
9406
9541
|
// src/revamp/wise/renderers/SearchRenderer.tsx
|
|
9407
9542
|
import { Input as Input6, NavigationOption as NavigationOption7, NavigationOptionsList as NavigationOptionsList4 } from "@transferwise/components";
|
|
9408
|
-
import { useIntl as
|
|
9409
|
-
import { Fragment as Fragment18, jsx as
|
|
9543
|
+
import { useIntl as useIntl22 } from "react-intl";
|
|
9544
|
+
import { Fragment as Fragment18, jsx as jsx105, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
9410
9545
|
var SearchRenderer = {
|
|
9411
9546
|
canRenderType: "search",
|
|
9412
|
-
render: ({ id, isLoading, margin, onChange, query, state, title }) => /* @__PURE__ */
|
|
9413
|
-
/* @__PURE__ */
|
|
9414
|
-
isLoading ? /* @__PURE__ */
|
|
9547
|
+
render: ({ id, isLoading, margin, onChange, query, state, title }) => /* @__PURE__ */ jsxs41("div", { className: getMargin2(margin), children: [
|
|
9548
|
+
/* @__PURE__ */ jsx105(FieldInput_default, { id, description: "", error: "", help: "", label: title, children: /* @__PURE__ */ jsx105(SearchInput2, { id, query, onChange }) }),
|
|
9549
|
+
isLoading ? /* @__PURE__ */ jsx105(Fragment18, { children: "Loading..." }) : /* @__PURE__ */ jsx105(SearchResultContent, { state, onChange })
|
|
9415
9550
|
] })
|
|
9416
9551
|
};
|
|
9417
9552
|
function SearchResultContent({
|
|
@@ -9420,11 +9555,11 @@ function SearchResultContent({
|
|
|
9420
9555
|
}) {
|
|
9421
9556
|
switch (state.type) {
|
|
9422
9557
|
case "error":
|
|
9423
|
-
return /* @__PURE__ */
|
|
9558
|
+
return /* @__PURE__ */ jsx105(ErrorResult2, { state });
|
|
9424
9559
|
case "results":
|
|
9425
|
-
return /* @__PURE__ */
|
|
9560
|
+
return /* @__PURE__ */ jsx105(SearchResults2, { state, onChange });
|
|
9426
9561
|
case "noResults":
|
|
9427
|
-
return /* @__PURE__ */
|
|
9562
|
+
return /* @__PURE__ */ jsx105(EmptySearchResult, { state });
|
|
9428
9563
|
case "pending":
|
|
9429
9564
|
default:
|
|
9430
9565
|
return null;
|
|
@@ -9435,7 +9570,7 @@ function SearchInput2({
|
|
|
9435
9570
|
query,
|
|
9436
9571
|
onChange
|
|
9437
9572
|
}) {
|
|
9438
|
-
return /* @__PURE__ */
|
|
9573
|
+
return /* @__PURE__ */ jsx105(
|
|
9439
9574
|
Input6,
|
|
9440
9575
|
{
|
|
9441
9576
|
id,
|
|
@@ -9448,11 +9583,11 @@ function SearchInput2({
|
|
|
9448
9583
|
);
|
|
9449
9584
|
}
|
|
9450
9585
|
function ErrorResult2({ state }) {
|
|
9451
|
-
const intl =
|
|
9452
|
-
return /* @__PURE__ */
|
|
9586
|
+
const intl = useIntl22();
|
|
9587
|
+
return /* @__PURE__ */ jsxs41("p", { className: "m-t-2", children: [
|
|
9453
9588
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
9454
9589
|
"\xA0",
|
|
9455
|
-
/* @__PURE__ */
|
|
9590
|
+
/* @__PURE__ */ jsx105(
|
|
9456
9591
|
"button",
|
|
9457
9592
|
{
|
|
9458
9593
|
type: "submit",
|
|
@@ -9466,17 +9601,17 @@ function ErrorResult2({ state }) {
|
|
|
9466
9601
|
] });
|
|
9467
9602
|
}
|
|
9468
9603
|
function EmptySearchResult({ state }) {
|
|
9469
|
-
return /* @__PURE__ */
|
|
9604
|
+
return /* @__PURE__ */ jsx105("p", { className: "m-t-2", children: state.message });
|
|
9470
9605
|
}
|
|
9471
9606
|
function SearchResults2({
|
|
9472
9607
|
state
|
|
9473
9608
|
}) {
|
|
9474
|
-
return /* @__PURE__ */
|
|
9609
|
+
return /* @__PURE__ */ jsx105(NavigationOptionsList4, { children: state.results.map((result) => /* @__PURE__ */ jsx105(
|
|
9475
9610
|
NavigationOption7,
|
|
9476
9611
|
{
|
|
9477
9612
|
title: result.title,
|
|
9478
9613
|
content: result.description,
|
|
9479
|
-
media: /* @__PURE__ */
|
|
9614
|
+
media: /* @__PURE__ */ jsx105(NavigationOptionMedia, __spreadValues({}, result)),
|
|
9480
9615
|
showMediaCircle: false,
|
|
9481
9616
|
showMediaAtAllSizes: true,
|
|
9482
9617
|
onClick: () => result.onClick()
|
|
@@ -9491,22 +9626,22 @@ import { RadioGroup as RadioGroup3 } from "@transferwise/components";
|
|
|
9491
9626
|
|
|
9492
9627
|
// src/revamp/wise/renderers/SelectInputRenderer/OptionMedia.tsx
|
|
9493
9628
|
import { Avatar as Avatar5, AvatarType as AvatarType4 } from "@transferwise/components";
|
|
9494
|
-
import { jsx as
|
|
9629
|
+
import { jsx as jsx106 } from "react/jsx-runtime";
|
|
9495
9630
|
function OptionMedia({ icon, image }) {
|
|
9496
9631
|
if (image == null ? void 0 : image.url) {
|
|
9497
|
-
return /* @__PURE__ */
|
|
9632
|
+
return /* @__PURE__ */ jsx106("img", { src: image.url, alt: image.accessibilityDescription || "", width: "64px" });
|
|
9498
9633
|
}
|
|
9499
9634
|
if (icon && "name" in icon) {
|
|
9500
|
-
return /* @__PURE__ */
|
|
9635
|
+
return /* @__PURE__ */ jsx106(Avatar5, { type: AvatarType4.ICON, children: /* @__PURE__ */ jsx106(DynamicIcon_default2, { name: icon.name }) });
|
|
9501
9636
|
}
|
|
9502
9637
|
if (icon && "text" in icon) {
|
|
9503
|
-
return /* @__PURE__ */
|
|
9638
|
+
return /* @__PURE__ */ jsx106(Avatar5, { type: AvatarType4.INITIALS, children: icon.text });
|
|
9504
9639
|
}
|
|
9505
9640
|
return null;
|
|
9506
9641
|
}
|
|
9507
9642
|
|
|
9508
9643
|
// src/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
9509
|
-
import { Fragment as Fragment19, jsx as
|
|
9644
|
+
import { Fragment as Fragment19, jsx as jsx107, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
9510
9645
|
function RadioInputRendererComponent(props) {
|
|
9511
9646
|
const {
|
|
9512
9647
|
id,
|
|
@@ -9520,8 +9655,8 @@ function RadioInputRendererComponent(props) {
|
|
|
9520
9655
|
selectedIndex,
|
|
9521
9656
|
onSelect
|
|
9522
9657
|
} = props;
|
|
9523
|
-
return /* @__PURE__ */
|
|
9524
|
-
/* @__PURE__ */
|
|
9658
|
+
return /* @__PURE__ */ jsxs42(Fragment19, { children: [
|
|
9659
|
+
/* @__PURE__ */ jsx107(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx107("span", { children: /* @__PURE__ */ jsx107(
|
|
9525
9660
|
RadioGroup3,
|
|
9526
9661
|
{
|
|
9527
9662
|
name: id,
|
|
@@ -9530,7 +9665,7 @@ function RadioInputRendererComponent(props) {
|
|
|
9530
9665
|
value: index,
|
|
9531
9666
|
secondary: option.description,
|
|
9532
9667
|
disabled: option.disabled || disabled,
|
|
9533
|
-
avatar: /* @__PURE__ */
|
|
9668
|
+
avatar: /* @__PURE__ */ jsx107(OptionMedia, { icon: option.icon, image: option.image })
|
|
9534
9669
|
})),
|
|
9535
9670
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
9536
9671
|
onChange: onSelect
|
|
@@ -9542,8 +9677,8 @@ function RadioInputRendererComponent(props) {
|
|
|
9542
9677
|
|
|
9543
9678
|
// src/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
9544
9679
|
import { Tabs as Tabs2 } from "@transferwise/components";
|
|
9545
|
-
import { useEffect as
|
|
9546
|
-
import { Fragment as Fragment20, jsx as
|
|
9680
|
+
import { useEffect as useEffect23 } from "react";
|
|
9681
|
+
import { Fragment as Fragment20, jsx as jsx108, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
9547
9682
|
function TabInputRendererComponent(props) {
|
|
9548
9683
|
const {
|
|
9549
9684
|
id,
|
|
@@ -9557,13 +9692,13 @@ function TabInputRendererComponent(props) {
|
|
|
9557
9692
|
selectedIndex,
|
|
9558
9693
|
onSelect
|
|
9559
9694
|
} = props;
|
|
9560
|
-
|
|
9695
|
+
useEffect23(() => {
|
|
9561
9696
|
if (!isValidIndex(selectedIndex, options.length)) {
|
|
9562
9697
|
onSelect(0);
|
|
9563
9698
|
}
|
|
9564
9699
|
}, [selectedIndex, onSelect, options.length]);
|
|
9565
|
-
return /* @__PURE__ */
|
|
9566
|
-
/* @__PURE__ */
|
|
9700
|
+
return /* @__PURE__ */ jsxs43(Fragment20, { children: [
|
|
9701
|
+
/* @__PURE__ */ jsx108(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx108(
|
|
9567
9702
|
Tabs2,
|
|
9568
9703
|
{
|
|
9569
9704
|
name: id,
|
|
@@ -9572,7 +9707,7 @@ function TabInputRendererComponent(props) {
|
|
|
9572
9707
|
title: option.title,
|
|
9573
9708
|
// if we pass null, we get some props-types console errors
|
|
9574
9709
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
9575
|
-
content: /* @__PURE__ */
|
|
9710
|
+
content: /* @__PURE__ */ jsx108(Fragment20, {}),
|
|
9576
9711
|
disabled: option.disabled || disabled
|
|
9577
9712
|
})),
|
|
9578
9713
|
onTabSelect: onSelect
|
|
@@ -9584,26 +9719,26 @@ function TabInputRendererComponent(props) {
|
|
|
9584
9719
|
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
9585
9720
|
|
|
9586
9721
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
9587
|
-
import { SelectInput as
|
|
9722
|
+
import { SelectInput as SelectInput3, SelectInputOptionContent as SelectInputOptionContent3 } from "@transferwise/components";
|
|
9588
9723
|
|
|
9589
9724
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.tsx
|
|
9590
9725
|
import { Avatar as Avatar6, AvatarType as AvatarType5 } from "@transferwise/components";
|
|
9591
|
-
import { jsx as
|
|
9726
|
+
import { jsx as jsx109 } from "react/jsx-runtime";
|
|
9592
9727
|
function SelectTriggerMedia({ icon, image }) {
|
|
9593
9728
|
if (image == null ? void 0 : image.url) {
|
|
9594
9729
|
return null;
|
|
9595
9730
|
}
|
|
9596
9731
|
if (icon && "name" in icon) {
|
|
9597
|
-
return /* @__PURE__ */
|
|
9732
|
+
return /* @__PURE__ */ jsx109(Avatar6, { type: AvatarType5.ICON, size: 24, children: /* @__PURE__ */ jsx109(DynamicIcon_default2, { name: icon.name }) });
|
|
9598
9733
|
}
|
|
9599
9734
|
if (icon && "text" in icon) {
|
|
9600
|
-
return /* @__PURE__ */
|
|
9735
|
+
return /* @__PURE__ */ jsx109(Avatar6, { type: AvatarType5.ICON, size: 24, children: icon.text });
|
|
9601
9736
|
}
|
|
9602
9737
|
return null;
|
|
9603
9738
|
}
|
|
9604
9739
|
|
|
9605
9740
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
9606
|
-
import { Fragment as Fragment21, jsx as
|
|
9741
|
+
import { Fragment as Fragment21, jsx as jsx110, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
9607
9742
|
function SelectInputRendererComponent(props) {
|
|
9608
9743
|
const {
|
|
9609
9744
|
id,
|
|
@@ -9637,17 +9772,17 @@ function SelectInputRendererComponent(props) {
|
|
|
9637
9772
|
const contentProps = withinTrigger ? {
|
|
9638
9773
|
title: option.title,
|
|
9639
9774
|
note: option.description,
|
|
9640
|
-
icon: /* @__PURE__ */
|
|
9775
|
+
icon: /* @__PURE__ */ jsx110(SelectTriggerMedia, { icon: option.icon, image: option.image })
|
|
9641
9776
|
} : {
|
|
9642
9777
|
title: option.title,
|
|
9643
9778
|
description: option.description,
|
|
9644
|
-
icon: /* @__PURE__ */
|
|
9779
|
+
icon: /* @__PURE__ */ jsx110(OptionMedia, { icon: option.icon, image: option.image })
|
|
9645
9780
|
};
|
|
9646
|
-
return /* @__PURE__ */
|
|
9781
|
+
return /* @__PURE__ */ jsx110(SelectInputOptionContent3, __spreadValues({}, contentProps));
|
|
9647
9782
|
};
|
|
9648
|
-
return /* @__PURE__ */
|
|
9649
|
-
/* @__PURE__ */
|
|
9650
|
-
|
|
9783
|
+
return /* @__PURE__ */ jsxs44(Fragment21, { children: [
|
|
9784
|
+
/* @__PURE__ */ jsx110(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ jsx110(
|
|
9785
|
+
SelectInput3,
|
|
9651
9786
|
{
|
|
9652
9787
|
name: id,
|
|
9653
9788
|
placeholder,
|
|
@@ -9665,18 +9800,18 @@ function SelectInputRendererComponent(props) {
|
|
|
9665
9800
|
}
|
|
9666
9801
|
|
|
9667
9802
|
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
9668
|
-
import { jsx as
|
|
9803
|
+
import { jsx as jsx111 } from "react/jsx-runtime";
|
|
9669
9804
|
var SelectInputRenderer = {
|
|
9670
9805
|
canRenderType: "input-select",
|
|
9671
9806
|
render: (props) => {
|
|
9672
9807
|
switch (props.control) {
|
|
9673
9808
|
case "radio":
|
|
9674
|
-
return /* @__PURE__ */
|
|
9809
|
+
return /* @__PURE__ */ jsx111(RadioInputRendererComponent, __spreadValues({}, props));
|
|
9675
9810
|
case "tab":
|
|
9676
|
-
return props.options.length > 3 ? /* @__PURE__ */
|
|
9811
|
+
return props.options.length > 3 ? /* @__PURE__ */ jsx111(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx111(TabInputRendererComponent, __spreadValues({}, props));
|
|
9677
9812
|
case "select":
|
|
9678
9813
|
default:
|
|
9679
|
-
return /* @__PURE__ */
|
|
9814
|
+
return /* @__PURE__ */ jsx111(SelectInputRendererComponent, __spreadValues({}, props));
|
|
9680
9815
|
}
|
|
9681
9816
|
}
|
|
9682
9817
|
};
|
|
@@ -9684,17 +9819,17 @@ var SelectInputRenderer_default = SelectInputRenderer;
|
|
|
9684
9819
|
|
|
9685
9820
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
9686
9821
|
import { Header as Header11, Summary as Summary2 } from "@transferwise/components";
|
|
9687
|
-
import { jsx as
|
|
9822
|
+
import { jsx as jsx112, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
9688
9823
|
var StatusListRenderer = {
|
|
9689
9824
|
canRenderType: "status-list",
|
|
9690
|
-
render: ({ margin, items, title }) => /* @__PURE__ */
|
|
9691
|
-
title ? /* @__PURE__ */
|
|
9692
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */
|
|
9825
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ jsxs45("div", { className: getMargin2(margin), children: [
|
|
9826
|
+
title ? /* @__PURE__ */ jsx112(Header11, { title }) : null,
|
|
9827
|
+
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ jsx112(
|
|
9693
9828
|
Summary2,
|
|
9694
9829
|
{
|
|
9695
9830
|
title: itemTitle,
|
|
9696
9831
|
description,
|
|
9697
|
-
icon: icon && "name" in icon ? /* @__PURE__ */
|
|
9832
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ jsx112(DynamicIcon_default2, { name: icon.name }) : null,
|
|
9698
9833
|
status: mapStatus(status)
|
|
9699
9834
|
},
|
|
9700
9835
|
`${title}/${description || ""}`
|
|
@@ -9717,31 +9852,31 @@ import {
|
|
|
9717
9852
|
TextArea as TextArea2,
|
|
9718
9853
|
TextareaWithDisplayFormat as TextareaWithDisplayFormat2
|
|
9719
9854
|
} from "@transferwise/components";
|
|
9720
|
-
import { jsx as
|
|
9855
|
+
import { jsx as jsx113 } from "react/jsx-runtime";
|
|
9721
9856
|
function VariableTextInput({
|
|
9722
9857
|
control,
|
|
9723
9858
|
inputProps
|
|
9724
9859
|
}) {
|
|
9725
9860
|
switch (control) {
|
|
9726
9861
|
case "password":
|
|
9727
|
-
return /* @__PURE__ */
|
|
9862
|
+
return /* @__PURE__ */ jsx113(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
9728
9863
|
case "email":
|
|
9729
|
-
return /* @__PURE__ */
|
|
9864
|
+
return /* @__PURE__ */ jsx113(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
9730
9865
|
case "textarea":
|
|
9731
|
-
return /* @__PURE__ */
|
|
9866
|
+
return /* @__PURE__ */ jsx113(TextAreaInput, __spreadValues({}, inputProps));
|
|
9732
9867
|
case "numeric":
|
|
9733
|
-
return /* @__PURE__ */
|
|
9868
|
+
return /* @__PURE__ */ jsx113(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
9734
9869
|
case "phone-number":
|
|
9735
|
-
return /* @__PURE__ */
|
|
9870
|
+
return /* @__PURE__ */ jsx113(PhoneNumberInput2, __spreadValues({}, inputProps));
|
|
9736
9871
|
default:
|
|
9737
|
-
return /* @__PURE__ */
|
|
9872
|
+
return /* @__PURE__ */ jsx113(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
9738
9873
|
}
|
|
9739
9874
|
}
|
|
9740
9875
|
function TextInput(_a) {
|
|
9741
9876
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
9742
9877
|
if (typeof displayFormat === "string") {
|
|
9743
9878
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
9744
|
-
return /* @__PURE__ */
|
|
9879
|
+
return /* @__PURE__ */ jsx113(
|
|
9745
9880
|
InputWithDisplayFormat2,
|
|
9746
9881
|
__spreadValues({
|
|
9747
9882
|
displayPattern: displayFormat,
|
|
@@ -9749,29 +9884,29 @@ function TextInput(_a) {
|
|
|
9749
9884
|
}, inputProps)
|
|
9750
9885
|
);
|
|
9751
9886
|
}
|
|
9752
|
-
return /* @__PURE__ */
|
|
9887
|
+
return /* @__PURE__ */ jsx113(Input7, __spreadValues({ id, name: id, onChange: (e) => onChange(e.target.value) }, rest));
|
|
9753
9888
|
}
|
|
9754
9889
|
function TextAreaInput(_a) {
|
|
9755
9890
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
9756
9891
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
9757
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */
|
|
9892
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ jsx113(
|
|
9758
9893
|
TextareaWithDisplayFormat2,
|
|
9759
9894
|
__spreadValues({
|
|
9760
9895
|
displayPattern: displayFormat,
|
|
9761
9896
|
onChange: (newValue) => onChange(newValue)
|
|
9762
9897
|
}, textAreaProps)
|
|
9763
|
-
) : /* @__PURE__ */
|
|
9898
|
+
) : /* @__PURE__ */ jsx113(TextArea2, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
9764
9899
|
}
|
|
9765
9900
|
function NumericInput(_a) {
|
|
9766
9901
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
9767
9902
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
9768
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */
|
|
9903
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ jsx113(
|
|
9769
9904
|
InputWithDisplayFormat2,
|
|
9770
9905
|
__spreadValues({
|
|
9771
9906
|
displayPattern: displayFormat,
|
|
9772
9907
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
9773
9908
|
}, numericProps)
|
|
9774
|
-
) : /* @__PURE__ */
|
|
9909
|
+
) : /* @__PURE__ */ jsx113(
|
|
9775
9910
|
Input7,
|
|
9776
9911
|
__spreadValues({
|
|
9777
9912
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
@@ -9780,12 +9915,12 @@ function NumericInput(_a) {
|
|
|
9780
9915
|
}
|
|
9781
9916
|
function PhoneNumberInput2(_a) {
|
|
9782
9917
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
9783
|
-
return /* @__PURE__ */
|
|
9918
|
+
return /* @__PURE__ */ jsx113(PhoneNumber, __spreadValues({ initialValue: value }, rest));
|
|
9784
9919
|
}
|
|
9785
9920
|
var VariableTextInput_default = VariableTextInput;
|
|
9786
9921
|
|
|
9787
9922
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
9788
|
-
import { jsx as
|
|
9923
|
+
import { jsx as jsx114 } from "react/jsx-runtime";
|
|
9789
9924
|
var TextInputRenderer = {
|
|
9790
9925
|
canRenderType: "input-text",
|
|
9791
9926
|
render: (props) => {
|
|
@@ -9810,14 +9945,14 @@ var TextInputRenderer = {
|
|
|
9810
9945
|
]);
|
|
9811
9946
|
const value = initialValue != null ? initialValue : "";
|
|
9812
9947
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
9813
|
-
return /* @__PURE__ */
|
|
9948
|
+
return /* @__PURE__ */ jsx114(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx114(VariableTextInput_default, { control, inputProps }) });
|
|
9814
9949
|
}
|
|
9815
9950
|
};
|
|
9816
9951
|
var TextInputRenderer_default = TextInputRenderer;
|
|
9817
9952
|
|
|
9818
9953
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
9819
9954
|
import { Upload as Upload2, UploadInput as UploadInput4 } from "@transferwise/components";
|
|
9820
|
-
import { jsx as
|
|
9955
|
+
import { jsx as jsx115 } from "react/jsx-runtime";
|
|
9821
9956
|
var UploadInputRenderer = {
|
|
9822
9957
|
canRenderType: "input-upload",
|
|
9823
9958
|
render: (props) => {
|
|
@@ -9833,7 +9968,7 @@ var UploadInputRenderer = {
|
|
|
9833
9968
|
};
|
|
9834
9969
|
return (
|
|
9835
9970
|
// We don't pass help here as there is no sensible place to display it
|
|
9836
|
-
/* @__PURE__ */
|
|
9971
|
+
/* @__PURE__ */ jsx115(UploadFieldInput_default, { id, label: void 0, description: void 0, error, children: /* @__PURE__ */ jsx115(
|
|
9837
9972
|
UploadInput4,
|
|
9838
9973
|
{
|
|
9839
9974
|
id,
|
|
@@ -9888,7 +10023,7 @@ var LargeUploadRenderer = {
|
|
|
9888
10023
|
throw e;
|
|
9889
10024
|
}
|
|
9890
10025
|
};
|
|
9891
|
-
return /* @__PURE__ */
|
|
10026
|
+
return /* @__PURE__ */ jsx115(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ jsx115(
|
|
9892
10027
|
Upload2,
|
|
9893
10028
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
9894
10029
|
usAccept: getAcceptsString(accepts),
|
|
@@ -9903,7 +10038,7 @@ var LargeUploadRenderer = {
|
|
|
9903
10038
|
|
|
9904
10039
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
9905
10040
|
import { DefinitionList as DefinitionList3, Header as Header12 } from "@transferwise/components";
|
|
9906
|
-
import { Fragment as Fragment22, jsx as
|
|
10041
|
+
import { Fragment as Fragment22, jsx as jsx116, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9907
10042
|
var ReviewRenderer = {
|
|
9908
10043
|
canRenderType: "review",
|
|
9909
10044
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -9915,9 +10050,9 @@ var ReviewRenderer = {
|
|
|
9915
10050
|
callToAction.onClick();
|
|
9916
10051
|
}
|
|
9917
10052
|
} : void 0;
|
|
9918
|
-
return /* @__PURE__ */
|
|
9919
|
-
(title || callToAction) && /* @__PURE__ */
|
|
9920
|
-
/* @__PURE__ */
|
|
10053
|
+
return /* @__PURE__ */ jsxs46("div", { className: getMargin2(margin), children: [
|
|
10054
|
+
(title || callToAction) && /* @__PURE__ */ jsx116(Header12, { title: title != null ? title : "", action }),
|
|
10055
|
+
/* @__PURE__ */ jsx116("div", { className: margin, children: /* @__PURE__ */ jsx116(
|
|
9921
10056
|
DefinitionList3,
|
|
9922
10057
|
{
|
|
9923
10058
|
layout: orientation,
|
|
@@ -9934,14 +10069,14 @@ var ReviewRenderer = {
|
|
|
9934
10069
|
var ReviewRenderer_default = ReviewRenderer;
|
|
9935
10070
|
var getFieldValue2 = (value, help, orientation) => {
|
|
9936
10071
|
if (help) {
|
|
9937
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */
|
|
9938
|
-
/* @__PURE__ */
|
|
10072
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs46(Fragment22, { children: [
|
|
10073
|
+
/* @__PURE__ */ jsx116(Help_default2, { help }),
|
|
9939
10074
|
" ",
|
|
9940
10075
|
value
|
|
9941
|
-
] }) : /* @__PURE__ */
|
|
10076
|
+
] }) : /* @__PURE__ */ jsxs46(Fragment22, { children: [
|
|
9942
10077
|
value,
|
|
9943
10078
|
" ",
|
|
9944
|
-
/* @__PURE__ */
|
|
10079
|
+
/* @__PURE__ */ jsx116(Help_default2, { help })
|
|
9945
10080
|
] });
|
|
9946
10081
|
}
|
|
9947
10082
|
return value;
|
|
@@ -9980,8 +10115,8 @@ var getWiseRenderers = () => [
|
|
|
9980
10115
|
];
|
|
9981
10116
|
|
|
9982
10117
|
// src/revamp/DynamicFlowCore.tsx
|
|
9983
|
-
import { useCallback as useCallback11, useEffect as
|
|
9984
|
-
import { useIntl as
|
|
10118
|
+
import { useCallback as useCallback11, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef9, useState as useState31 } from "react";
|
|
10119
|
+
import { useIntl as useIntl23 } from "react-intl";
|
|
9985
10120
|
|
|
9986
10121
|
// src/revamp/utils/type-validators.ts
|
|
9987
10122
|
var isString2 = (value) => typeof value === "string";
|
|
@@ -13275,22 +13410,22 @@ var executeSubmission = async (props) => {
|
|
|
13275
13410
|
};
|
|
13276
13411
|
|
|
13277
13412
|
// src/revamp/renderers/CoreContainerRenderer.tsx
|
|
13278
|
-
import { Fragment as Fragment23, jsx as
|
|
13413
|
+
import { Fragment as Fragment23, jsx as jsx117 } from "react/jsx-runtime";
|
|
13279
13414
|
var CoreContainerRenderer = {
|
|
13280
13415
|
canRenderType: "container",
|
|
13281
|
-
render: ({ children }) => /* @__PURE__ */
|
|
13416
|
+
render: ({ children }) => /* @__PURE__ */ jsx117(Fragment23, { children })
|
|
13282
13417
|
};
|
|
13283
13418
|
|
|
13284
13419
|
// src/revamp/renderers/StepRenderer.tsx
|
|
13285
|
-
import { useMemo as
|
|
13286
|
-
import { jsx as
|
|
13420
|
+
import { useMemo as useMemo18 } from "react";
|
|
13421
|
+
import { jsx as jsx118 } from "react/jsx-runtime";
|
|
13287
13422
|
var StepRenderer = {
|
|
13288
13423
|
canRenderType: "step",
|
|
13289
13424
|
render: StepRendererComponent
|
|
13290
13425
|
};
|
|
13291
13426
|
function StepRendererComponent({ children, loadingState }) {
|
|
13292
|
-
const value =
|
|
13293
|
-
return /* @__PURE__ */
|
|
13427
|
+
const value = useMemo18(() => ({ loadingState }), [loadingState]);
|
|
13428
|
+
return /* @__PURE__ */ jsx118(LoadingContextProvider, { value, children });
|
|
13294
13429
|
}
|
|
13295
13430
|
|
|
13296
13431
|
// src/revamp/renderers/stepComponentToProps.ts
|
|
@@ -13786,7 +13921,7 @@ var componentToRendererProps = (component, nestedContent) => {
|
|
|
13786
13921
|
};
|
|
13787
13922
|
|
|
13788
13923
|
// src/revamp/renderers/getRenderFunction.tsx
|
|
13789
|
-
import { jsx as
|
|
13924
|
+
import { jsx as jsx119 } from "react/jsx-runtime";
|
|
13790
13925
|
var getRenderFunction = (renderers2) => {
|
|
13791
13926
|
function ComponentRenderer(props) {
|
|
13792
13927
|
const { type } = props;
|
|
@@ -13825,7 +13960,7 @@ var getRenderFunction = (renderers2) => {
|
|
|
13825
13960
|
children: component.getChildren().map(render)
|
|
13826
13961
|
};
|
|
13827
13962
|
};
|
|
13828
|
-
const render = (component) => /* @__PURE__ */
|
|
13963
|
+
const render = (component) => /* @__PURE__ */ jsx119(
|
|
13829
13964
|
ComponentRenderer,
|
|
13830
13965
|
__spreadValues({}, componentToRendererProps(component, getNestedContent(component))),
|
|
13831
13966
|
component.uid
|
|
@@ -13949,7 +14084,7 @@ function useStableCallback(handler) {
|
|
|
13949
14084
|
}
|
|
13950
14085
|
|
|
13951
14086
|
// src/revamp/DynamicFlowCore.tsx
|
|
13952
|
-
import { jsx as
|
|
14087
|
+
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
13953
14088
|
function DynamicFlowCore(props) {
|
|
13954
14089
|
const _a = props, { flowId, initialAction, initialStep, renderers: renderers2, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "renderers", "displayStepTitle"]);
|
|
13955
14090
|
const httpClient = useStableCallback(rest.httpClient);
|
|
@@ -13957,12 +14092,12 @@ function DynamicFlowCore(props) {
|
|
|
13957
14092
|
const onError = useStableCallback(rest.onError);
|
|
13958
14093
|
const onEvent = useStableCallback(rest.onEvent);
|
|
13959
14094
|
const onLog = useStableCallback(rest.onLog);
|
|
13960
|
-
const { formatMessage, locale } =
|
|
13961
|
-
const getErrorMessageFunctions =
|
|
14095
|
+
const { formatMessage, locale } = useIntl23();
|
|
14096
|
+
const getErrorMessageFunctions = useMemo19(
|
|
13962
14097
|
() => getSchemaErrorMessageFunction(formatMessage, locale),
|
|
13963
14098
|
[formatMessage, locale]
|
|
13964
14099
|
);
|
|
13965
|
-
const [stepComponent, setStepComponent] =
|
|
14100
|
+
const [stepComponent, setStepComponent] = useState31(null);
|
|
13966
14101
|
const stepComponentRef = useRef9(null);
|
|
13967
14102
|
const stepRef = useRef9(initialStep != null ? initialStep : null);
|
|
13968
14103
|
const etagRef = useRef9(null);
|
|
@@ -13972,7 +14107,7 @@ function DynamicFlowCore(props) {
|
|
|
13972
14107
|
abortControllerRef.current = new AbortController();
|
|
13973
14108
|
return abortControllerRef.current.signal;
|
|
13974
14109
|
};
|
|
13975
|
-
|
|
14110
|
+
useEffect24(() => {
|
|
13976
14111
|
trackEvent("Initiated");
|
|
13977
14112
|
if (!initialStep && initialAction) {
|
|
13978
14113
|
void onAction(initialAction);
|
|
@@ -14139,24 +14274,24 @@ function DynamicFlowCore(props) {
|
|
|
14139
14274
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
14140
14275
|
[]
|
|
14141
14276
|
);
|
|
14142
|
-
const render =
|
|
14277
|
+
const render = useMemo19(
|
|
14143
14278
|
() => getRenderFunction([CoreContainerRenderer, ...renderers2, StepRenderer]),
|
|
14144
14279
|
[renderers2]
|
|
14145
14280
|
);
|
|
14146
|
-
return /* @__PURE__ */
|
|
14281
|
+
return /* @__PURE__ */ jsx120(ErrorBoundary_default, { onError: closeWithError, children: stepComponent ? render(stepComponent) : null });
|
|
14147
14282
|
}
|
|
14148
14283
|
|
|
14149
14284
|
// src/revamp/DynamicFlowWise.tsx
|
|
14150
|
-
import { jsx as
|
|
14285
|
+
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
14151
14286
|
var renderers = getWiseRenderers();
|
|
14152
14287
|
function DynamicFlowWise(props) {
|
|
14153
14288
|
const { httpClient } = props;
|
|
14154
|
-
const { locale } =
|
|
14155
|
-
const wiseHttpClient =
|
|
14289
|
+
const { locale } = useIntl24();
|
|
14290
|
+
const wiseHttpClient = useMemo20(
|
|
14156
14291
|
() => makeWiseHttpClient(httpClient, locale),
|
|
14157
14292
|
[httpClient, locale]
|
|
14158
14293
|
);
|
|
14159
|
-
return /* @__PURE__ */
|
|
14294
|
+
return /* @__PURE__ */ jsx121(HttpClientProvider, { httpClient: wiseHttpClient, children: /* @__PURE__ */ jsx121(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers })) });
|
|
14160
14295
|
}
|
|
14161
14296
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
14162
14297
|
var makeWiseHttpClient = (httpClient, locale) => async (input, init) => httpClient(
|