@wise/dynamic-flow-client 3.4.1 → 3.5.0-experimental-6654c72
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/common/errorBoundary/ErrorBoundary.js +44 -0
- package/build/common/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/common/httpClientContext/HttpClientContext.js +35 -0
- package/build/common/httpClientContext/index.js +1 -0
- package/build/common/makeHttpClient/index.js +1 -0
- package/build/common/makeHttpClient/makeHttpClient.js +34 -0
- package/build/common/messages/external-confirmation.messages.js +23 -0
- package/build/common/messages/generic-error.messages.js +18 -0
- package/build/common/messages/help.messages.js +8 -0
- package/build/common/messages/multi-file-upload.messages.js +18 -0
- package/build/common/messages/multi-select.messages.js +8 -0
- package/build/common/messages/paragraph.messages.js +13 -0
- package/build/common/messages/repeatable.messages.js +23 -0
- package/build/common/messages/validation.array.messages.js +13 -0
- package/build/common/messages/validation.messages.js +53 -0
- package/build/common/utils/api-utils.js +4 -0
- package/build/i18n/index.js +36 -0
- package/build/legacy/common/constants/DateMode.js +4 -0
- package/build/legacy/common/constants/FeatureName.js +4 -0
- package/build/legacy/common/constants/FormControlType.js +21 -0
- package/build/legacy/common/constants/MonthFormat.js +4 -0
- package/build/legacy/common/constants/Size.js +7 -0
- package/build/legacy/common/constants/index.js +4 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +38 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +22 -0
- package/build/legacy/common/contexts/index.js +3 -0
- package/build/legacy/common/contexts/logContext/LogContext.js +44 -0
- package/build/legacy/common/hooks/index.js +7 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
- package/build/legacy/common/hooks/useExternal/useExternal.js +15 -0
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +70 -0
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +172 -0
- package/build/legacy/common/hooks/usePolling/usePolling.js +51 -0
- package/build/legacy/common/hooks/usePrevious/usePrevious.js +8 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +43 -0
- package/build/legacy/common/messages.js +8 -0
- package/build/legacy/common/utils/api-utils.js +6 -0
- package/build/legacy/common/utils/date-utils.js +22 -0
- package/build/legacy/common/utils/debounce.js +38 -0
- package/build/legacy/common/utils/file-utils.js +45 -0
- package/build/legacy/common/utils/id-utils.js +5 -0
- package/build/legacy/common/utils/index.js +11 -0
- package/build/legacy/common/utils/is-equal.js +21 -0
- package/build/legacy/common/utils/misc-utils.js +4 -0
- package/build/legacy/common/utils/mobile-utils.js +23 -0
- package/build/legacy/common/utils/model-utils.js +33 -0
- package/build/legacy/common/utils/schema-utils.js +113 -0
- package/build/legacy/common/utils/step-utils.js +32 -0
- package/build/legacy/common/validators/index.js +5 -0
- package/build/legacy/common/validators/models/model-utils.js +119 -0
- package/build/legacy/common/validators/models/model-validators.js +62 -0
- package/build/legacy/common/validators/schemas/schema-validators.js +101 -0
- package/build/legacy/common/validators/types/type-validators.js +14 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.js +139 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +40 -0
- package/build/legacy/common/validators/values/value-validators.js +6 -0
- package/build/legacy/dynamic-flow-types.js +1 -0
- package/build/legacy/dynamicFlow/BackButton.js +22 -0
- package/build/legacy/dynamicFlow/DynamicFlow.js +346 -0
- package/build/legacy/dynamicFlow/DynamicFlowStep.js +37 -0
- package/build/legacy/dynamicFlow/DynamicFlowTypes.js +1 -0
- package/build/legacy/dynamicFlow/index.js +1 -0
- package/build/legacy/dynamicFlow/utils/index.js +5 -0
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.js +185 -0
- package/build/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +26 -0
- package/build/legacy/dynamicFlow/utils/useDynamicFlowState.js +137 -0
- package/build/legacy/dynamicFlow/utils/useLoader.js +22 -0
- package/build/legacy/formControl/FormControl.js +266 -0
- package/build/legacy/formControl/index.js +1 -0
- package/build/legacy/formControl/utils/getAutocompleteString.js +80 -0
- package/build/legacy/formControl/utils/index.js +2 -0
- package/build/legacy/formControl/utils/value-utils.js +108 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.js +24 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +50 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +34 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.js +84 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +79 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.js +7 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +134 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +85 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +135 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +111 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +86 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.js +85 -0
- package/build/legacy/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/help/Help.js +20 -0
- package/build/legacy/jsonSchemaForm/help/index.js +1 -0
- package/build/legacy/jsonSchemaForm/index.js +1 -0
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +77 -0
- package/build/legacy/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +68 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +31 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +54 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +133 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +107 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +150 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/legacy/layout/DynamicLayout.js +68 -0
- package/build/legacy/layout/alert/DynamicAlert.js +29 -0
- package/build/legacy/layout/box/DynamicBox.js +41 -0
- package/build/legacy/layout/button/DynamicButton.js +27 -0
- package/build/legacy/layout/button/utils.js +45 -0
- package/build/legacy/layout/columns/DynamicColumns.js +38 -0
- package/build/legacy/layout/decision/DynamicDecision.js +21 -0
- package/build/legacy/layout/divider/DynamicDivider.js +9 -0
- package/build/legacy/layout/external/DynamicExternal.js +32 -0
- package/build/legacy/layout/external/DynamicExternal.messages.js +8 -0
- package/build/legacy/layout/form/DynamicForm.js +22 -0
- package/build/legacy/layout/heading/DynamicHeading.js +51 -0
- package/build/legacy/layout/icon/DynamicIcon.js +17 -0
- package/build/legacy/layout/icon/FlagIcon.js +198 -0
- package/build/legacy/layout/icon/NamedIcon.js +19 -0
- package/build/legacy/layout/image/DynamicImage.js +111 -0
- package/build/legacy/layout/index.js +20 -0
- package/build/legacy/layout/instructions/DynamicInstructions.js +30 -0
- package/build/legacy/layout/list/DynamicStatusList.js +37 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.js +23 -0
- package/build/legacy/layout/modal/DynamicModal.js +26 -0
- package/build/legacy/layout/paragraph/DynamicParagraph.js +46 -0
- package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/legacy/layout/review/DynamicReview.js +58 -0
- package/build/legacy/layout/search/DynamicSearch.js +58 -0
- package/build/legacy/layout/search/SearchInput.js +17 -0
- package/build/legacy/layout/search/SearchResults.js +31 -0
- package/build/legacy/layout/search/useSearch.js +137 -0
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +28 -0
- package/build/legacy/layout/utils/index.js +32 -0
- package/build/legacy/step/cameraStep/CameraStep.js +124 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +161 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +58 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +28 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/index.js +3 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +19 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +8 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +60 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +80 -0
- package/build/legacy/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +77 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +18 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +109 -0
- package/build/legacy/step/cameraStep/cameraCapture/types/index.js +7 -0
- package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +107 -0
- package/build/legacy/step/cameraStep/index.js +1 -0
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/legacy/step/externalConfirmationStep/index.js +1 -0
- package/build/legacy/step/index.js +3 -0
- package/build/legacy/step/layoutStep/LayoutStep.js +33 -0
- package/build/legacy/step/layoutStep/index.js +1 -0
- package/build/legacy/step/layoutStep/utils/index.js +2 -0
- package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +105 -0
- package/build/legacy/step/layoutStep/utils/layout-utils.js +212 -0
- package/build/main.js +4775 -225
- package/build/main.min.js +1 -1
- package/build/main.mjs +4776 -226
- package/build/revamp/domain/components/AlertComponent.js +50 -0
- package/build/revamp/domain/components/AllOfComponent.js +72 -0
- package/build/revamp/domain/components/BooleanInputComponent.js +108 -0
- package/build/revamp/domain/components/BoxComponent.js +65 -0
- package/build/revamp/domain/components/ButtonComponent.js +50 -0
- package/build/revamp/domain/components/ColumnsComponent.js +74 -0
- package/build/revamp/domain/components/ConstComponent.js +50 -0
- package/build/revamp/domain/components/ContainerComponent.js +65 -0
- package/build/revamp/domain/components/DateInputComponent.js +127 -0
- package/build/revamp/domain/components/DecisionComponent.js +50 -0
- package/build/revamp/domain/components/DividerComponent.js +50 -0
- package/build/revamp/domain/components/FormComponent.js +65 -0
- package/build/revamp/domain/components/HeadingComponent.js +50 -0
- package/build/revamp/domain/components/ImageComponent.js +50 -0
- package/build/revamp/domain/components/InstructionsComponent.js +50 -0
- package/build/revamp/domain/components/IntegerInputComponent.js +125 -0
- package/build/revamp/domain/components/LoadingIndicatorComponent.js +50 -0
- package/build/revamp/domain/components/MarkdownComponent.js +50 -0
- package/build/revamp/domain/components/ModalComponent.js +65 -0
- package/build/revamp/domain/components/MultiUploadInputComponent.js +190 -0
- package/build/revamp/domain/components/NumberInputComponent.js +125 -0
- package/build/revamp/domain/components/ObjectComponent.js +104 -0
- package/build/revamp/domain/components/ParagraphComponent.js +50 -0
- package/build/revamp/domain/components/ReviewComponent.js +50 -0
- package/build/revamp/domain/components/SelectInputComponent.js +138 -0
- package/build/revamp/domain/components/StatusListComponent.js +50 -0
- package/build/revamp/domain/components/StepDomainComponent.js +93 -0
- package/build/revamp/domain/components/TextInputComponent.js +125 -0
- package/build/revamp/domain/components/UploadInputComponent.js +151 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.js +148 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.js +108 -0
- package/build/revamp/domain/components/utils/component-utils.js +18 -0
- package/build/revamp/domain/components/utils/debounce.js +38 -0
- package/build/revamp/domain/components/utils/file-utils.js +46 -0
- package/build/revamp/domain/components/utils/getComponentForLocalValueKey.js +31 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.js +40 -0
- package/build/revamp/domain/features/events.js +1 -0
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.js +133 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.js +103 -0
- package/build/revamp/domain/features/refresh/getPerformRefresh.js +53 -0
- package/build/revamp/domain/features/summary/summary-utils.js +39 -0
- package/build/revamp/domain/features/utils/http-utils.js +34 -0
- package/build/revamp/domain/features/utils/response-utils.js +9 -0
- package/build/revamp/domain/features/validation/validation-functions.js +12 -0
- package/build/revamp/domain/features/validation/value-checks.js +111 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.js +94 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +107 -0
- package/build/revamp/domain/mappers/types.js +1 -0
- package/build/revamp/domain/types.js +1 -0
- package/build/revamp/flow/response-utils.js +88 -0
- package/build/revamp/renderers/CoreContainerRenderer.js +8 -0
- package/build/revamp/renderers/LoadingContext.js +7 -0
- package/build/revamp/renderers/types.js +1 -0
- package/build/revamp/types.js +1 -0
- package/build/revamp/utils/component-utils.js +86 -0
- package/build/revamp/utils/type-utils.js +56 -0
- package/build/revamp/utils/type-validators.js +16 -0
- package/build/revamp/wise/renderers/AlertRenderer.js +11 -0
- package/build/revamp/wise/renderers/BooleanInputRenderer.js +34 -0
- package/build/revamp/wise/renderers/BoxRenderer.js +30 -0
- package/build/revamp/wise/renderers/ButtonRenderer.js +64 -0
- package/build/revamp/wise/renderers/ColumnsRenderer.js +25 -0
- package/build/revamp/wise/renderers/components/FieldInput.js +20 -0
- package/build/revamp/wise/renderers/components/Help.js +21 -0
- package/build/revamp/wise/renderers/components/LabelContentWithHelp.js +6 -0
- package/build/revamp/wise/renderers/utils/layout-utils.js +31 -0
- package/build/types/legacy/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +1 -1
- package/build/types/revamp/domain/components/StepDomainComponent.d.ts +4 -2
- package/build/types/revamp/renderers/step/ExternalConfirmationDialog.d.ts +6 -0
- package/build/types/revamp/renderers/{StepRenderer.d.ts → step/StepRenderer.d.ts} +1 -1
- package/build/types/revamp/renderers/step/useExternal.d.ts +4 -0
- package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/types.d.ts +3 -0
- package/package.json +13 -13
- /package/build/types/{legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts → common/messages/external-confirmation.messages.d.ts} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
|
+
import { DynamicAlert, DynamicBox, DynamicButton, DynamicColumns, DynamicDecision, DynamicDivider, DynamicExternal, DynamicForm, DynamicHeading, DynamicImage, DynamicInfo, DynamicInstructions, DynamicStatusList, DynamicLoadingIndicator, DynamicMarkdown, DynamicParagraph, DynamicReview, DynamicSearch, DynamicModal, } from '.';
|
|
14
|
+
import { HttpClientProviderFromBaseUrl, useHasHttpClientProvider, } from '../../common/httpClientContext';
|
|
15
|
+
var getKey = function (component) { return JSON.stringify(component); };
|
|
16
|
+
function DynamicLayout(props) {
|
|
17
|
+
var components = props.components, model = props.model, submitted = props.submitted, errors = props.errors, onModelChange = props.onModelChange, onAction = props.onAction, onPersistAsync = props.onPersistAsync, baseUrl = props.baseUrl;
|
|
18
|
+
var renderComponent = function (component) {
|
|
19
|
+
switch (component.type) {
|
|
20
|
+
case 'heading':
|
|
21
|
+
return _jsx(DynamicHeading, { component: component }, getKey(component));
|
|
22
|
+
case 'paragraph':
|
|
23
|
+
return _jsx(DynamicParagraph, { component: component }, getKey(component));
|
|
24
|
+
case 'image':
|
|
25
|
+
return _jsx(DynamicImage, { component: component }, getKey(component));
|
|
26
|
+
case 'alert':
|
|
27
|
+
return _jsx(DynamicAlert, { component: component }, getKey(component));
|
|
28
|
+
case 'review':
|
|
29
|
+
return _jsx(DynamicReview, { component: component, onAction: onAction }, getKey(component));
|
|
30
|
+
case 'divider':
|
|
31
|
+
return _jsx(DynamicDivider, { component: component }, getKey(component));
|
|
32
|
+
case 'info':
|
|
33
|
+
return _jsx(DynamicInfo, { component: component }, getKey(component));
|
|
34
|
+
case 'instructions':
|
|
35
|
+
return _jsx(DynamicInstructions, { component: component }, getKey(component));
|
|
36
|
+
case 'markdown':
|
|
37
|
+
return _jsx(DynamicMarkdown, { component: component }, getKey(component));
|
|
38
|
+
case 'columns':
|
|
39
|
+
return (_jsx(DynamicColumns, { component: component, model: model, submitted: submitted, errors: errors, onModelChange: onModelChange, onAction: onAction, onPersistAsync: onPersistAsync }, getKey(component)));
|
|
40
|
+
case 'form':
|
|
41
|
+
return (_jsx(DynamicForm, { component: component, model: model, submitted: submitted, errors: errors, onModelChange: onModelChange, onPersistAsync: onPersistAsync }, getKey(__assign(__assign({}, component), { errors: errors !== null && errors !== void 0 ? errors : null }))));
|
|
42
|
+
case 'button':
|
|
43
|
+
return _jsx(DynamicButton, { component: component, onAction: onAction }, getKey(component));
|
|
44
|
+
case 'box':
|
|
45
|
+
return (_jsx(DynamicBox, { component: component, model: model, submitted: submitted, errors: errors, onModelChange: onModelChange, onAction: onAction, onPersistAsync: onPersistAsync }, getKey(component)));
|
|
46
|
+
case 'decision':
|
|
47
|
+
return (_jsx(DynamicDecision, { component: component, onAction: onAction }, getKey(component)));
|
|
48
|
+
case 'external':
|
|
49
|
+
return (_jsx(DynamicExternal, { component: component, onAction: onAction }, getKey(component)));
|
|
50
|
+
case 'list':
|
|
51
|
+
case 'status-list':
|
|
52
|
+
return (_jsx(DynamicStatusList, { component: component, onAction: onAction }, getKey(component)));
|
|
53
|
+
case 'loading-indicator':
|
|
54
|
+
return _jsx(DynamicLoadingIndicator, { component: component }, getKey(component));
|
|
55
|
+
case 'search':
|
|
56
|
+
return _jsx(DynamicSearch, { component: component, onAction: onAction }, getKey(component));
|
|
57
|
+
case 'modal':
|
|
58
|
+
return (_jsx(DynamicModal, { component: component, model: model, submitted: submitted, errors: errors, onModelChange: onModelChange, onAction: onAction, onPersistAsync: onPersistAsync }, getKey(component)));
|
|
59
|
+
default:
|
|
60
|
+
return _jsx("div", {}, getKey(component));
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
64
|
+
return _jsx(_Fragment, { children: components.map(renderComponent) });
|
|
65
|
+
}
|
|
66
|
+
return (_jsx(HttpClientProviderFromBaseUrl, __assign({ baseUrl: baseUrl }, { children: components.map(renderComponent) })));
|
|
67
|
+
}
|
|
68
|
+
export default DynamicLayout;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from '@transferwise/components';
|
|
3
|
+
import { getMargin } from '../utils';
|
|
4
|
+
var DynamicAlert = function (props) {
|
|
5
|
+
var alert = props.component;
|
|
6
|
+
return (_jsx(Alert, { type: mapContextToAlertType(legacy_mapContext(alert.context)), className: getMargin(alert.margin), message: alert.markdown }));
|
|
7
|
+
};
|
|
8
|
+
var legacy_mapContext = function (context) {
|
|
9
|
+
switch (context) {
|
|
10
|
+
case 'success':
|
|
11
|
+
return 'positive';
|
|
12
|
+
case 'failure':
|
|
13
|
+
return 'negative';
|
|
14
|
+
case 'warning':
|
|
15
|
+
return 'warning';
|
|
16
|
+
case 'info':
|
|
17
|
+
case 'primary':
|
|
18
|
+
return 'neutral';
|
|
19
|
+
default:
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var mapContextToAlertType = function (context) {
|
|
24
|
+
if (!context || !['neutral', 'warning', 'negative', 'positive'].includes(context)) {
|
|
25
|
+
return 'neutral';
|
|
26
|
+
}
|
|
27
|
+
return context;
|
|
28
|
+
};
|
|
29
|
+
export default DynamicAlert;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { DynamicLayout } from '..';
|
|
14
|
+
import { getMargin } from '../utils';
|
|
15
|
+
var DynamicBox = function (props) {
|
|
16
|
+
var box = props.component;
|
|
17
|
+
var margin = getMargin(box.margin || box.border ? 'lg' : 'xs');
|
|
18
|
+
if (!box.width || box.width === 'xl') {
|
|
19
|
+
return (_jsx("div", __assign({ className: margin + getBorderClass(box.border) }, { children: _jsx(DynamicLayout, { components: box.components, model: props.model, submitted: props.submitted, errors: props.errors, onModelChange: props.onModelChange, onAction: props.onAction, onPersistAsync: props.onPersistAsync }) })));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("div", __assign({ className: "row" }, { children: _jsx("div", __assign({ className: margin + getBoxWidthClasses(box) }, { children: _jsx("div", __assign({ className: getBorderClass(box.border) }, { children: _jsx(DynamicLayout, { components: box.components, model: props.model, submitted: props.submitted, errors: props.errors, onModelChange: props.onModelChange, onAction: props.onAction, onPersistAsync: props.onPersistAsync }) })) })) })));
|
|
22
|
+
};
|
|
23
|
+
var getBorderClass = function (border) {
|
|
24
|
+
return border ? ' well p-b-0' : '';
|
|
25
|
+
};
|
|
26
|
+
var getBoxWidthClasses = function (component) {
|
|
27
|
+
switch (component.width) {
|
|
28
|
+
case 'xs':
|
|
29
|
+
return ' col-md-4 col-md-offset-4';
|
|
30
|
+
case 'sm':
|
|
31
|
+
return ' col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4';
|
|
32
|
+
case 'md':
|
|
33
|
+
return ' col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3';
|
|
34
|
+
case 'lg':
|
|
35
|
+
return ' col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2';
|
|
36
|
+
case 'xl':
|
|
37
|
+
default:
|
|
38
|
+
return ' col-xs-12';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export default DynamicBox;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Button } from '@transferwise/components';
|
|
14
|
+
import { useDynamicFlow } from '../../common/contexts';
|
|
15
|
+
import { getMargin } from '../utils';
|
|
16
|
+
import { getButtonPriority, getButtonType, getButtonSize } from './utils';
|
|
17
|
+
function DynamicButton(props) {
|
|
18
|
+
var _a;
|
|
19
|
+
var component = props.component, onAction = props.onAction;
|
|
20
|
+
var componentAction = component.action; // there should be no $ref at this point
|
|
21
|
+
var type = getButtonType(component);
|
|
22
|
+
var priority = getButtonPriority(component);
|
|
23
|
+
var loading = useDynamicFlow().loading;
|
|
24
|
+
var className = getMargin(component.margin || 'md');
|
|
25
|
+
return (_jsx(Button, __assign({ size: getButtonSize(component.size), type: priority === 'tertiary' ? undefined : type, priority: priority, block: true, className: className, disabled: loading || component.disabled || componentAction.disabled, onClick: function () { return onAction(componentAction); } }, { children: (_a = component.title) !== null && _a !== void 0 ? _a : componentAction.title })));
|
|
26
|
+
}
|
|
27
|
+
export default DynamicButton;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var priorities = {
|
|
2
|
+
primary: 'primary',
|
|
3
|
+
secondary: 'secondary',
|
|
4
|
+
link: 'tertiary',
|
|
5
|
+
positive: 'primary',
|
|
6
|
+
negative: 'primary'
|
|
7
|
+
};
|
|
8
|
+
export var getButtonPriority = function (component) {
|
|
9
|
+
var _a;
|
|
10
|
+
var actionType = component.action.type;
|
|
11
|
+
return (_a = component.control) !== null && _a !== void 0 ? _a : (actionType ? priorities[actionType] : 'secondary');
|
|
12
|
+
};
|
|
13
|
+
var contextToType = {
|
|
14
|
+
positive: 'positive',
|
|
15
|
+
negative: 'negative',
|
|
16
|
+
neutral: 'accent',
|
|
17
|
+
warning: 'accent'
|
|
18
|
+
};
|
|
19
|
+
var actionTypeToType = {
|
|
20
|
+
primary: 'accent',
|
|
21
|
+
secondary: 'accent',
|
|
22
|
+
link: 'accent',
|
|
23
|
+
positive: 'positive',
|
|
24
|
+
negative: 'negative'
|
|
25
|
+
};
|
|
26
|
+
export var getButtonType = function (component) {
|
|
27
|
+
if (component.context) {
|
|
28
|
+
return contextToType[component.context];
|
|
29
|
+
}
|
|
30
|
+
var actionType = component.action.type;
|
|
31
|
+
return actionType ? actionTypeToType[actionType] : 'accent';
|
|
32
|
+
};
|
|
33
|
+
export var getButtonSize = function (size) {
|
|
34
|
+
switch (size) {
|
|
35
|
+
case 'xs':
|
|
36
|
+
case 'sm':
|
|
37
|
+
return 'sm';
|
|
38
|
+
case 'lg':
|
|
39
|
+
case 'xl':
|
|
40
|
+
return 'lg';
|
|
41
|
+
case 'md':
|
|
42
|
+
default:
|
|
43
|
+
return 'md';
|
|
44
|
+
}
|
|
45
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { DynamicLayout } from '..';
|
|
14
|
+
import { getMargin } from '../utils';
|
|
15
|
+
var DynamicColumns = function (props) {
|
|
16
|
+
var columns = props.component;
|
|
17
|
+
var _a = getWidth(columns.bias), leftWidth = _a.leftWidth, rightWidth = _a.rightWidth;
|
|
18
|
+
return (_jsxs("div", __assign({ className: "".concat(getMargin(columns.margin || 'xs'), " row") }, { children: [_jsx("div", __assign({ className: "".concat(leftWidth, " m-b-0") }, { children: _jsx(DynamicLayout, { components: columns.left, model: props.model, submitted: props.submitted, errors: props.errors, onModelChange: props.onModelChange, onAction: props.onAction, onPersistAsync: props.onPersistAsync }) })), _jsx("div", __assign({ className: "".concat(rightWidth, " m-b-0") }, { children: _jsx(DynamicLayout, { components: columns.right, model: props.model, submitted: props.submitted, errors: props.errors, onModelChange: props.onModelChange, onAction: props.onAction, onPersistAsync: props.onPersistAsync }) }))] })));
|
|
19
|
+
};
|
|
20
|
+
var getWidth = function (bias) {
|
|
21
|
+
if (bias === 'left') {
|
|
22
|
+
return {
|
|
23
|
+
leftWidth: 'col-md-8',
|
|
24
|
+
rightWidth: 'col-md-4'
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (bias === 'right') {
|
|
28
|
+
return {
|
|
29
|
+
leftWidth: 'col-md-4',
|
|
30
|
+
rightWidth: 'col-md-8'
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
leftWidth: 'col-md-6',
|
|
35
|
+
rightWidth: 'col-md-6'
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default DynamicColumns;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { NavigationOption, NavigationOptionsList } from '@transferwise/components';
|
|
14
|
+
import { getNavigationOptionMedia, getMargin } from '../utils';
|
|
15
|
+
import { useDynamicFlow } from '../../common/contexts';
|
|
16
|
+
function DynamicDecision(_a) {
|
|
17
|
+
var component = _a.component, onAction = _a.onAction;
|
|
18
|
+
var loading = useDynamicFlow().loading;
|
|
19
|
+
return (_jsx("div", __assign({ className: getMargin(component.margin) }, { children: _jsx(NavigationOptionsList, { children: component.options.map(function (option) { return (_jsx(NavigationOption, { title: option.title, content: option.description, disabled: loading || option.disabled, media: getNavigationOptionMedia(option), showMediaCircle: false, showMediaAtAllSizes: true, onClick: function () { return onAction(option.action); } }, JSON.stringify(option))); }) }) })));
|
|
20
|
+
}
|
|
21
|
+
export default DynamicDecision;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getMargin } from '../utils';
|
|
3
|
+
var DynamicDivider = function (_a) {
|
|
4
|
+
var component = _a.component;
|
|
5
|
+
var margin = getMargin(component.margin);
|
|
6
|
+
var className = "m-t-0 ".concat(margin);
|
|
7
|
+
return _jsx("hr", { className: className });
|
|
8
|
+
};
|
|
9
|
+
export default DynamicDivider;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Button, Loader, Size } from '@transferwise/components';
|
|
14
|
+
import { useCallback, useEffect } from 'react';
|
|
15
|
+
import { useIntl } from 'react-intl';
|
|
16
|
+
import { useExternalStepPolling } from '../../common/hooks';
|
|
17
|
+
import messages from './DynamicExternal.messages';
|
|
18
|
+
/** @deprecated - No longer supported, use the external feature instead */
|
|
19
|
+
var DynamicExternal = function (_a) {
|
|
20
|
+
var component = _a.component, onAction = _a.onAction;
|
|
21
|
+
var requestUrl = component.requestUrl, responseHandlers = component.responseHandlers, polling = component.polling, retryTitle = component.retryTitle;
|
|
22
|
+
var intl = useIntl();
|
|
23
|
+
var openExternalUrl = useCallback(function () { return window.open(requestUrl, 'df-external-window'); }, [requestUrl]);
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
openExternalUrl();
|
|
26
|
+
}, [openExternalUrl]);
|
|
27
|
+
var pollingConfiguration = polling && responseHandlers
|
|
28
|
+
? __assign(__assign({}, polling), { responseHandlers: responseHandlers }) : undefined;
|
|
29
|
+
useExternalStepPolling(pollingConfiguration, onAction);
|
|
30
|
+
return (_jsxs(_Fragment, { children: [_jsx(Loader, { size: Size.LARGE, classNames: { 'tw-loader': 'tw-loader m-x-auto' } }), _jsx("br", {}), _jsx(Button, __assign({ priority: "tertiary", block: true, onClick: openExternalUrl }, { children: retryTitle || intl.formatMessage(messages.retryTitle) }))] }));
|
|
31
|
+
};
|
|
32
|
+
export default DynamicExternal;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import GenericSchema from '../../jsonSchemaForm/genericSchema';
|
|
14
|
+
import { getMargin } from '../utils';
|
|
15
|
+
function DynamicForm(_a) {
|
|
16
|
+
var component = _a.component, _b = _a.model, model = _b === void 0 ? null : _b, _c = _a.errors, errors = _c === void 0 ? null : _c, submitted = _a.submitted, onModelChange = _a.onModelChange, onPersistAsync = _a.onPersistAsync;
|
|
17
|
+
var formSchema = component.schema; // There should be no $ref, nor schemaId at this point
|
|
18
|
+
return (_jsx("div", __assign({ className: getMargin(component.margin || 'md') }, { children: _jsx(GenericSchema, { schema: formSchema, model: model, errors: errors, submitted: submitted, onChange: function (parameters) {
|
|
19
|
+
onModelChange(__assign({ formSchema: formSchema }, parameters));
|
|
20
|
+
}, onPersistAsync: onPersistAsync }) })));
|
|
21
|
+
}
|
|
22
|
+
export default DynamicForm;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { Display } from '@transferwise/components';
|
|
14
|
+
import classNames from 'classnames';
|
|
15
|
+
import { getTextAlignmentAndMargin } from '../utils';
|
|
16
|
+
var DynamicHeading = function (props) {
|
|
17
|
+
var _a = props.component, text = _a.text, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.align, align = _c === void 0 ? 'left' : _c, _d = _a.margin, margin = _d === void 0 ? 'md' : _d, control = _a.control;
|
|
18
|
+
var classes = classNames(getTextAlignmentAndMargin({ align: align, margin: margin }));
|
|
19
|
+
return control === 'display' ? (_jsx(DisplayHeading, { size: size, text: text, classes: classes })) : (_jsx(StandardHeading, { size: size, text: text, classes: classes }));
|
|
20
|
+
};
|
|
21
|
+
var StandardHeading = function (_a) {
|
|
22
|
+
var size = _a.size, text = _a.text, classes = _a.classes;
|
|
23
|
+
switch (size) {
|
|
24
|
+
case 'xs':
|
|
25
|
+
return _jsx("h5", __assign({ className: classes }, { children: text }));
|
|
26
|
+
case 'sm':
|
|
27
|
+
return _jsx("h4", __assign({ className: classes }, { children: text }));
|
|
28
|
+
case 'lg':
|
|
29
|
+
return _jsx("h2", __assign({ className: classes }, { children: text }));
|
|
30
|
+
case 'xl':
|
|
31
|
+
return _jsx("h1", __assign({ className: classes }, { children: text }));
|
|
32
|
+
case 'md':
|
|
33
|
+
default:
|
|
34
|
+
return _jsx("h3", __assign({ className: classes }, { children: text }));
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var DisplayHeading = function (_a) {
|
|
38
|
+
var size = _a.size, text = _a.text, classes = _a.classes;
|
|
39
|
+
switch (size) {
|
|
40
|
+
case 'xs':
|
|
41
|
+
case 'sm':
|
|
42
|
+
return (_jsx(Display, __assign({ type: "display-small", className: classes }, { children: text })));
|
|
43
|
+
case 'xl':
|
|
44
|
+
case 'lg':
|
|
45
|
+
return (_jsx(Display, __assign({ type: "display-large", className: classes }, { children: text })));
|
|
46
|
+
case 'md':
|
|
47
|
+
default:
|
|
48
|
+
return (_jsx(Display, __assign({ type: "display-medium", className: classes }, { children: text })));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
export default DynamicHeading;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FlagIcon, isFlagIcon } from './FlagIcon';
|
|
3
|
+
import { NamedIcon, isNamedIcon } from './NamedIcon';
|
|
4
|
+
function DynamicIcon(_a) {
|
|
5
|
+
var type = _a.type;
|
|
6
|
+
if (isFlagIcon(type)) {
|
|
7
|
+
return _jsx(FlagIcon, { name: type });
|
|
8
|
+
}
|
|
9
|
+
if (isNamedIcon(type)) {
|
|
10
|
+
return _jsx(NamedIcon, { name: type });
|
|
11
|
+
}
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
export function isValidIconName(name) {
|
|
15
|
+
return isNamedIcon(name) || isFlagIcon(name);
|
|
16
|
+
}
|
|
17
|
+
export default DynamicIcon;
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export var isFlagIcon = function (name) { return isCurrencyFlagIcon(name) || isCountryFlagIcon(name); };
|
|
3
|
+
var isCurrencyFlagIcon = function (name) {
|
|
4
|
+
return currencyCodes.some(function (currencyCode) { return name === "flag-".concat(currencyCode); });
|
|
5
|
+
};
|
|
6
|
+
var isCountryFlagIcon = function (name) {
|
|
7
|
+
return countryCodes.some(function (countryCode) { return name === "flag-".concat(countryCode); });
|
|
8
|
+
};
|
|
9
|
+
export function FlagIcon(_a) {
|
|
10
|
+
var name = _a.name;
|
|
11
|
+
if (!isFlagIcon(name)) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
var code = name.substring(5);
|
|
15
|
+
return (_jsx("img", { src: "https://wise.com/web-art/assets/flags/".concat(code, ".svg"), alt: "", "data-testid": "img-flag-".concat(code), width: "24px" }));
|
|
16
|
+
}
|
|
17
|
+
var currencyCodes = [
|
|
18
|
+
'aed',
|
|
19
|
+
'ars',
|
|
20
|
+
'aud',
|
|
21
|
+
'bdt',
|
|
22
|
+
'bgn',
|
|
23
|
+
'bhd',
|
|
24
|
+
'bnd',
|
|
25
|
+
'brl',
|
|
26
|
+
'bwp',
|
|
27
|
+
'cad',
|
|
28
|
+
'chf',
|
|
29
|
+
'clp',
|
|
30
|
+
'cny',
|
|
31
|
+
'cop',
|
|
32
|
+
'crc',
|
|
33
|
+
'czk',
|
|
34
|
+
'dkk',
|
|
35
|
+
'egp',
|
|
36
|
+
'eur',
|
|
37
|
+
'fjd',
|
|
38
|
+
'gbp',
|
|
39
|
+
'gel',
|
|
40
|
+
'ghs',
|
|
41
|
+
'gtq',
|
|
42
|
+
'hkd',
|
|
43
|
+
'hrk',
|
|
44
|
+
'huf',
|
|
45
|
+
'idr',
|
|
46
|
+
'ils',
|
|
47
|
+
'imp',
|
|
48
|
+
'inr',
|
|
49
|
+
'isk',
|
|
50
|
+
'jmd',
|
|
51
|
+
'jpy',
|
|
52
|
+
'kes',
|
|
53
|
+
'krw',
|
|
54
|
+
'kwd',
|
|
55
|
+
'lak',
|
|
56
|
+
'lkr',
|
|
57
|
+
'lsl',
|
|
58
|
+
'mad',
|
|
59
|
+
'mur',
|
|
60
|
+
'mxn',
|
|
61
|
+
'myr',
|
|
62
|
+
'mzn',
|
|
63
|
+
'nad',
|
|
64
|
+
'ngn',
|
|
65
|
+
'nok',
|
|
66
|
+
'npr',
|
|
67
|
+
'nzd',
|
|
68
|
+
'omr',
|
|
69
|
+
'pab',
|
|
70
|
+
'pen',
|
|
71
|
+
'php',
|
|
72
|
+
'pkr',
|
|
73
|
+
'pln',
|
|
74
|
+
'qar',
|
|
75
|
+
'ron',
|
|
76
|
+
'rub',
|
|
77
|
+
'sar',
|
|
78
|
+
'sek',
|
|
79
|
+
'sgd',
|
|
80
|
+
'thb',
|
|
81
|
+
'tmt',
|
|
82
|
+
'try',
|
|
83
|
+
'twd',
|
|
84
|
+
'tzs',
|
|
85
|
+
'uah',
|
|
86
|
+
'ugx',
|
|
87
|
+
'usd',
|
|
88
|
+
'uyu',
|
|
89
|
+
'vnd',
|
|
90
|
+
'xof',
|
|
91
|
+
'zar',
|
|
92
|
+
'zmw',
|
|
93
|
+
];
|
|
94
|
+
var countryCodes = [
|
|
95
|
+
'ad',
|
|
96
|
+
'ae',
|
|
97
|
+
'ar',
|
|
98
|
+
'at',
|
|
99
|
+
'au',
|
|
100
|
+
'bd',
|
|
101
|
+
'be',
|
|
102
|
+
'bg',
|
|
103
|
+
'bh',
|
|
104
|
+
'bn',
|
|
105
|
+
'br',
|
|
106
|
+
'bw',
|
|
107
|
+
'ca',
|
|
108
|
+
'ch',
|
|
109
|
+
'cl',
|
|
110
|
+
'cn',
|
|
111
|
+
'co',
|
|
112
|
+
'cr',
|
|
113
|
+
'cy',
|
|
114
|
+
'cz',
|
|
115
|
+
'de',
|
|
116
|
+
'dk',
|
|
117
|
+
'ee',
|
|
118
|
+
'eg',
|
|
119
|
+
'es',
|
|
120
|
+
'eu',
|
|
121
|
+
'fi',
|
|
122
|
+
'fj',
|
|
123
|
+
'fr',
|
|
124
|
+
'gb',
|
|
125
|
+
'ge',
|
|
126
|
+
'gg',
|
|
127
|
+
'gh',
|
|
128
|
+
'gp',
|
|
129
|
+
'gr',
|
|
130
|
+
'gt',
|
|
131
|
+
'hk',
|
|
132
|
+
'hr',
|
|
133
|
+
'hu',
|
|
134
|
+
'id',
|
|
135
|
+
'ie',
|
|
136
|
+
'il',
|
|
137
|
+
'im',
|
|
138
|
+
'in',
|
|
139
|
+
'is',
|
|
140
|
+
'it',
|
|
141
|
+
'je',
|
|
142
|
+
'jm',
|
|
143
|
+
'jp',
|
|
144
|
+
'ke',
|
|
145
|
+
'kr',
|
|
146
|
+
'kw',
|
|
147
|
+
'la',
|
|
148
|
+
'li',
|
|
149
|
+
'lk',
|
|
150
|
+
'ls',
|
|
151
|
+
'lt',
|
|
152
|
+
'lu',
|
|
153
|
+
'lv',
|
|
154
|
+
'ma',
|
|
155
|
+
'mc',
|
|
156
|
+
'mt',
|
|
157
|
+
'mu',
|
|
158
|
+
'mx',
|
|
159
|
+
'my',
|
|
160
|
+
'mz',
|
|
161
|
+
'na',
|
|
162
|
+
'ng',
|
|
163
|
+
'nl',
|
|
164
|
+
'no',
|
|
165
|
+
'np',
|
|
166
|
+
'nz',
|
|
167
|
+
'om',
|
|
168
|
+
'pa',
|
|
169
|
+
'pe',
|
|
170
|
+
'ph',
|
|
171
|
+
'pk',
|
|
172
|
+
'pl',
|
|
173
|
+
'pt',
|
|
174
|
+
'qa',
|
|
175
|
+
'ro',
|
|
176
|
+
'ru',
|
|
177
|
+
'sa',
|
|
178
|
+
'se',
|
|
179
|
+
'sg',
|
|
180
|
+
'si',
|
|
181
|
+
'sk',
|
|
182
|
+
'sm',
|
|
183
|
+
'th',
|
|
184
|
+
'tm',
|
|
185
|
+
'tr',
|
|
186
|
+
'tw',
|
|
187
|
+
'tz',
|
|
188
|
+
'ua',
|
|
189
|
+
'ug',
|
|
190
|
+
'us',
|
|
191
|
+
'uy',
|
|
192
|
+
'va',
|
|
193
|
+
'vn',
|
|
194
|
+
'wi',
|
|
195
|
+
'xo',
|
|
196
|
+
'za',
|
|
197
|
+
'zm',
|
|
198
|
+
];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as icons from '@transferwise/icons';
|
|
3
|
+
export var isNamedIcon = function (name) {
|
|
4
|
+
var iconName = toCapitalisedCamelCase(name);
|
|
5
|
+
return Object.keys(icons).includes(iconName);
|
|
6
|
+
};
|
|
7
|
+
export function NamedIcon(_a) {
|
|
8
|
+
var name = _a.name;
|
|
9
|
+
if (!isNamedIcon(name)) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
var iconName = toCapitalisedCamelCase(name);
|
|
13
|
+
var Icon = icons[iconName];
|
|
14
|
+
return _jsx(Icon, { size: 24 });
|
|
15
|
+
}
|
|
16
|
+
var toCapitalisedCamelCase = function (value) {
|
|
17
|
+
return value.split('-').map(capitaliseFirstChar).join('');
|
|
18
|
+
};
|
|
19
|
+
var capitaliseFirstChar = function (value) { return "".concat(value[0].toUpperCase()).concat(value.slice(1)); };
|