@wise/dynamic-flow-client 3.9.1 → 3.9.2-experimental-535221d
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 +24 -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/makeHttpClient/makeHttpClient.spec.js +141 -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/de.json +46 -46
- package/build/i18n/en.json +46 -46
- package/build/i18n/es.json +46 -46
- package/build/i18n/fr.json +46 -46
- package/build/i18n/hu.json +46 -46
- package/build/i18n/id.json +46 -46
- package/build/i18n/index.js +36 -0
- package/build/i18n/it.json +46 -46
- package/build/i18n/ja.json +46 -46
- package/build/i18n/pl.json +46 -46
- package/build/i18n/pt.json +46 -46
- package/build/i18n/ro.json +46 -46
- package/build/i18n/ru.json +46 -46
- package/build/i18n/th.json +46 -46
- package/build/i18n/tr.json +46 -46
- package/build/i18n/zh_CN.json +46 -46
- package/build/i18n/zh_HK.json +46 -46
- package/build/index.js +11 -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 +25 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +15 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +38 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.spec.js +47 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +11 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.spec.js +30 -0
- package/build/legacy/common/contexts/index.js +3 -0
- package/build/legacy/common/contexts/logContext/LogContext.js +44 -0
- package/build/legacy/common/contexts/logContext/LogContext.spec.js +43 -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/useDebouncedFunction/useDebouncedFunction.spec.js +59 -0
- package/build/legacy/common/hooks/useExternal/useExternal.js +15 -0
- package/build/legacy/common/hooks/useExternal/useExternal.spec.js +236 -0
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +71 -0
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +172 -0
- package/build/legacy/common/hooks/usePolling/usePolling.js +53 -0
- package/build/legacy/common/hooks/usePrevious/usePrevious.js +8 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +45 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.spec.js +288 -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 +39 -0
- package/build/legacy/common/utils/debounce.spec.js +72 -0
- package/build/legacy/common/utils/file-utils.js +45 -0
- package/build/legacy/common/utils/file-utils.spec.js +69 -0
- package/build/legacy/common/utils/id-utils.js +5 -0
- package/build/legacy/common/utils/id-utils.spec.js +12 -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/is-equal.spec.js +88 -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/mobile-utils.spec.js +71 -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-utils.spec.js +45 -0
- package/build/legacy/common/validators/models/model-validators.js +62 -0
- package/build/legacy/common/validators/models/model-validators.spec.js +647 -0
- package/build/legacy/common/validators/schemas/schema-validators.js +101 -0
- package/build/legacy/common/validators/schemas/schema-validators.spec.js +157 -0
- package/build/legacy/common/validators/types/type-validators.js +14 -0
- package/build/legacy/common/validators/types/type-validators.spec.js +147 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.js +139 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.spec.js +198 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +40 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.spec.js +145 -0
- package/build/legacy/common/validators/values/value-validators.js +6 -0
- package/build/legacy/common/validators/values/value-validators.spec.js +22 -0
- package/build/legacy/dynamic-flow-types.js +1 -0
- package/build/legacy/dynamicFlow/BackButton.js +22 -0
- package/build/legacy/dynamicFlow/DynamicFlow.js +345 -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/stories/dev-tools/DynamicFlow.story.js +78 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ErrorResponses.story.js +124 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Examples.story.js +25 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Features.story.js +33 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/JsonSchemaForm.story.js +31 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/RefreshOnChange.story.js +194 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/SearchFeature.story.js +253 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ServerTest.story.js +44 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Upload.story.js +212 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ValidationAsync.story.js +156 -0
- package/build/legacy/dynamicFlow/stories/examples/ObjectConst.story.js +150 -0
- package/build/legacy/dynamicFlow/stories/fixtureHttpClient.js +117 -0
- package/build/legacy/dynamicFlow/stories/visual-tests/VisualTests.story.js +43 -0
- package/build/legacy/dynamicFlow/tests/Actions.spec.js +232 -0
- package/build/legacy/dynamicFlow/tests/AllOfSchema.spec.js +196 -0
- package/build/legacy/dynamicFlow/tests/AutocompleteHints.spec.js +59 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.BackButton.spec.js +179 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.search.spec.js +475 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.spec.js +559 -0
- package/build/legacy/dynamicFlow/tests/DynamicImage.spec.js +287 -0
- package/build/legacy/dynamicFlow/tests/DynamicInstructions.spec.js +49 -0
- package/build/legacy/dynamicFlow/tests/HiddenSchemas.spec.js +307 -0
- package/build/legacy/dynamicFlow/tests/ModalLayout.spec.js +252 -0
- package/build/legacy/dynamicFlow/tests/MultiSelect.spec.js +327 -0
- package/build/legacy/dynamicFlow/tests/MultipleFileUploadSchema.spec.js +401 -0
- package/build/legacy/dynamicFlow/tests/ObjectSchema.spec.js +295 -0
- package/build/legacy/dynamicFlow/tests/OneOfSchema.spec.js +773 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.blob-schema.spec.js +331 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.string-schema.spec.js +389 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.debouncing.spec.js +391 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.spec.js +567 -0
- package/build/legacy/dynamicFlow/tests/RepeatableSchema.spec.js +977 -0
- package/build/legacy/dynamicFlow/tests/StepModel.spec.js +119 -0
- package/build/legacy/dynamicFlow/tests/ValidationAsync.spec.js +484 -0
- package/build/legacy/dynamicFlow/tests/ssr.spec.js +47 -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/responseParsers/response-parsers.spec.js +463 -0
- package/build/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +35 -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 +267 -0
- package/build/legacy/formControl/Select.spec.js +104 -0
- package/build/legacy/formControl/index.js +1 -0
- package/build/legacy/formControl/utils/getAutocompleteString.js +80 -0
- package/build/legacy/formControl/utils/getAutocompleteString.spec.js +30 -0
- package/build/legacy/formControl/utils/index.js +2 -0
- package/build/legacy/formControl/utils/value-utils.js +108 -0
- package/build/legacy/formControl/utils/value-utils.spec.js +158 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.end-to-end.spec.js +534 -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/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.js +73 -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/arrayListSchema/repeatableSchema/utils/summary-utils.spec.js +909 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +100 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +89 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.js +85 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.rtl.spec.js +55 -0
- package/build/legacy/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/help/Help.js +9 -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 +16 -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 +138 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.spec.js +312 -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/schemaFormControl/utils/mapping-utils.spec.js +220 -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 +30 -0
- package/build/legacy/layout/button/DynamicButton.js +16 -0
- package/build/legacy/layout/button/DynamicButton.spec.js +141 -0
- package/build/legacy/layout/button/utils.js +45 -0
- package/build/legacy/layout/button/utils.spec.js +50 -0
- package/build/legacy/layout/columns/DynamicColumns.js +27 -0
- package/build/legacy/layout/decision/DynamicDecision.js +10 -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 +40 -0
- package/build/legacy/layout/icon/DynamicIcon.js +17 -0
- package/build/legacy/layout/icon/DynamicIcon.spec.js +20 -0
- package/build/legacy/layout/icon/FlagIcon.js +11 -0
- package/build/legacy/layout/icon/NamedIcon.js +19 -0
- package/build/legacy/layout/image/DynamicImage.js +112 -0
- package/build/legacy/layout/index.js +20 -0
- package/build/legacy/layout/instructions/DynamicInstructions.js +19 -0
- package/build/legacy/layout/list/DynamicStatusList.js +37 -0
- package/build/legacy/layout/list/DynamicStatusList.spec.js +111 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.spec.js +25 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.js +12 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.spec.js +58 -0
- package/build/legacy/layout/modal/DynamicModal.js +26 -0
- package/build/legacy/layout/paragraph/DynamicParagraph.js +35 -0
- package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/legacy/layout/review/DynamicReview.js +47 -0
- package/build/legacy/layout/review/DynamicReview.spec.js +152 -0
- package/build/legacy/layout/search/DynamicSearch.js +83 -0
- package/build/legacy/layout/search/SearchInput.js +6 -0
- package/build/legacy/layout/search/SearchResults.js +20 -0
- package/build/legacy/layout/search/useSearch.js +137 -0
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +17 -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/CameraCapture.spec.js +432 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +17 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/index.js +3 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +8 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +8 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +62 -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 +7 -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/legacy/test-utils/DynamicFlowProviders.js +8 -0
- package/build/legacy/test-utils/index.js +4 -0
- package/build/legacy/test-utils/legacy-utils.js +69 -0
- package/build/legacy/test-utils/log-utils.js +9 -0
- package/build/main.js +735 -684
- package/build/main.min.js +1 -1
- package/build/main.mjs +503 -452
- package/build/revamp/DynamicFlowCore.js +25 -0
- package/build/revamp/DynamicFlowWise.js +32 -0
- package/build/revamp/DynamicFlowWise.spec.js +105 -0
- package/build/revamp/DynamicFragmentWise.js +83 -0
- 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 +109 -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 +128 -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 +129 -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 +192 -0
- package/build/revamp/domain/components/NumberInputComponent.js +129 -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 +140 -0
- package/build/revamp/domain/components/StatusListComponent.js +50 -0
- package/build/revamp/domain/components/StepDomainComponent.js +87 -0
- package/build/revamp/domain/components/TextInputComponent.js +129 -0
- package/build/revamp/domain/components/UploadInputComponent.js +154 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.js +150 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.spec.js +146 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.js +111 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.spec.js +327 -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/debounce.spec.js +72 -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 +53 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +108 -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/getComponentPersistAsync.spec.js +200 -0
- package/build/revamp/domain/features/persistAsync/getInitialPersistedState.js +6 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.js +103 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.spec.js +280 -0
- package/build/revamp/domain/features/polling/getStepPolling.js +82 -0
- package/build/revamp/domain/features/polling/getStepPolling.spec.js +170 -0
- package/build/revamp/domain/features/refresh/getPerformRefresh.js +16 -0
- package/build/revamp/domain/features/search/getPerformSearchFunction.js +104 -0
- package/build/revamp/domain/features/search/getPerformSearchFunction.spec.js +260 -0
- package/build/revamp/domain/features/summary/summary-utils.js +39 -0
- package/build/revamp/domain/features/summary/summary-utils.spec.js +110 -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/spec-utils.js +16 -0
- package/build/revamp/domain/features/validation/validation-functions.js +12 -0
- package/build/revamp/domain/features/validation/validation-functions.spec.js +110 -0
- package/build/revamp/domain/features/validation/value-checks.js +111 -0
- package/build/revamp/domain/features/validation/value-checks.spec.js +204 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.js +95 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.spec.js +178 -0
- package/build/revamp/domain/features/validationAsync/getInitialValidationState.js +5 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +107 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.spec.js +266 -0
- package/build/revamp/domain/mappers/layout/alertLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/boxLayoutToComponents.js +15 -0
- package/build/revamp/domain/mappers/layout/buttonLayoutToComponent.js +45 -0
- package/build/revamp/domain/mappers/layout/columnsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/decisionLayoutToComponent.js +40 -0
- package/build/revamp/domain/mappers/layout/dividerLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/formLayoutToComponent.js +27 -0
- package/build/revamp/domain/mappers/layout/headingLayoutToComponent.js +13 -0
- package/build/revamp/domain/mappers/layout/imageLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/infoLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/instructionsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/listLayoutToComponent.js +30 -0
- package/build/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/markdownLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/modalLayoutToComponent.js +17 -0
- package/build/revamp/domain/mappers/layout/paragraphLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/reviewLayoutToComponent.js +51 -0
- package/build/revamp/domain/mappers/layout/searchLayoutToComponent.js +14 -0
- package/build/revamp/domain/mappers/layout/statusListLayoutToComponent.js +11 -0
- package/build/revamp/domain/mappers/mapLayoutToComponent.js +63 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.js +84 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.spec.js +197 -0
- package/build/revamp/domain/mappers/mapStepToComponent.js +159 -0
- package/build/revamp/domain/mappers/mapStepToComponent.spec.js +236 -0
- package/build/revamp/domain/mappers/schema/allOfSchemaToComponent.js +29 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.js +64 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.js +66 -0
- package/build/revamp/domain/mappers/schema/blobSchemaToComponent.js +30 -0
- package/build/revamp/domain/mappers/schema/booleanSchemaToComponent.js +38 -0
- package/build/revamp/domain/mappers/schema/constSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/integerSchemaToComponent.js +36 -0
- package/build/revamp/domain/mappers/schema/numberSchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.js +41 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.spec.js +165 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.js +67 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.spec.js +316 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.spec.js +220 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.js +37 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.js +45 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.js +32 -0
- package/build/revamp/domain/mappers/schema/tests/test-utils.js +27 -0
- package/build/revamp/domain/mappers/schema/types.js +1 -0
- package/build/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.js +35 -0
- package/build/revamp/domain/mappers/schema/utils/getValidationAsyncInitialState.js +25 -0
- package/build/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.js +28 -0
- package/build/revamp/domain/mappers/types.js +1 -0
- package/build/revamp/domain/mappers/utils/getAutocompleteString.js +76 -0
- package/build/revamp/domain/mappers/utils/getAutocompleteString.spec.js +21 -0
- package/build/revamp/domain/mappers/utils/getRandomId.js +2 -0
- package/build/revamp/domain/mappers/utils/inlineAction.js +23 -0
- package/build/revamp/domain/mappers/utils/legacy-utils.js +53 -0
- package/build/revamp/domain/types.js +1 -0
- package/build/revamp/flow/executeRefresh.js +97 -0
- package/build/revamp/flow/executeSubmission.js +160 -0
- package/build/revamp/flow/getResponseType.js +76 -0
- package/build/revamp/flow/response-utils.js +92 -0
- package/build/revamp/renderers/CoreContainerRenderer.js +8 -0
- package/build/revamp/renderers/getRenderFunction.js +55 -0
- package/build/revamp/renderers/getSchemaErrorMessageFunction.js +90 -0
- package/build/revamp/renderers/mappers/alertComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/allOfComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/booleanInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/boxComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/buttonComponentToProps.js +14 -0
- package/build/revamp/renderers/mappers/columnsComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/componentToRendererProps.js +105 -0
- package/build/revamp/renderers/mappers/containerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dateInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/decisionComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dividerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/formComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/headingComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/hiddenComponentToProps.js +3 -0
- package/build/revamp/renderers/mappers/imageComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/instructionsComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/integerInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/loadingIndicatorComponentToProps.js +9 -0
- package/build/revamp/renderers/mappers/markdownComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/modalComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/multiUploadInputComponentToProps.js +24 -0
- package/build/revamp/renderers/mappers/numberInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/objectComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/paragraphComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/repeatableComponentToProps.js +40 -0
- package/build/revamp/renderers/mappers/reviewComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/searchComponentToProps.js +53 -0
- package/build/revamp/renderers/mappers/selectInputComponentToProps.js +29 -0
- package/build/revamp/renderers/mappers/statusListComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/textInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/uploadInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/utils/inputComponentToProps.js +27 -0
- package/build/revamp/renderers/stepComponentToProps.js +11 -0
- package/build/revamp/renderers/types.js +1 -0
- package/build/revamp/stories/dev-tools/ActionResponse.story.js +101 -0
- package/build/revamp/stories/dev-tools/DynamicFlowRevamp.story.js +314 -0
- package/build/revamp/stories/dev-tools/EditableStep.story.js +71 -0
- package/build/revamp/stories/dev-tools/ErrorHandling.story.js +149 -0
- package/build/revamp/stories/dev-tools/External.story.js +83 -0
- package/build/revamp/stories/dev-tools/OneOf.Inititalisation.story.js +123 -0
- package/build/revamp/stories/dev-tools/PersistAsync.story.js +168 -0
- package/build/revamp/stories/dev-tools/Polling.story.js +79 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.story.js +309 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.with.PersistAsync.story.js +1004 -0
- package/build/revamp/stories/dev-tools/SearchFeature.story.js +260 -0
- package/build/revamp/stories/dev-tools/ServerTest.story.js +81 -0
- package/build/revamp/stories/dev-tools/Upload.story.js +221 -0
- package/build/revamp/stories/dev-tools/ValidationAsync.story.js +161 -0
- package/build/revamp/stories/examples/ObjectConst.story.js +153 -0
- package/build/revamp/stories/examples/OneOfInitialisation.story.js +102 -0
- package/build/revamp/stories/utils/fixtureHttpClient.js +130 -0
- package/build/revamp/stories/utils/mockSearchHandler.js +125 -0
- package/build/revamp/stories/visual-tests/VisualTests.story.js +111 -0
- package/build/revamp/test-utils/component-utils.js +19 -0
- package/build/revamp/test-utils/step-utils.js +6 -0
- package/build/revamp/tests/ImageRenderer.spec.js +108 -0
- package/build/revamp/tests/InitialAction.spec.js +299 -0
- package/build/revamp/tests/InitialStep.spec.js +104 -0
- package/build/revamp/tests/Logging.spec.js +112 -0
- package/build/revamp/tests/OneOfInitialisation.spec.js +754 -0
- package/build/revamp/tests/Polling.spec.js +611 -0
- package/build/revamp/tests/RefreshOnChange.ResponseHandling.spec.js +322 -0
- package/build/revamp/tests/RefreshOnChange.with.Segmented.spec.js +447 -0
- package/build/revamp/tests/RefreshOnChange.with.Tabs.spec.js +447 -0
- package/build/revamp/tests/RefreshOnChangePreserve.spec.js +218 -0
- package/build/revamp/tests/Rerendering.spec.js +156 -0
- package/build/revamp/tests/SegmentedControl.spec.js +48 -0
- package/build/revamp/tests/Submission.ResponseHandling.spec.js +697 -0
- package/build/revamp/tests/Submission.spec.js +399 -0
- package/build/revamp/tests/legacy/Actions.spec.js +242 -0
- package/build/revamp/tests/legacy/BackButton.spec.js +189 -0
- package/build/revamp/tests/legacy/HiddenSchemas.spec.js +312 -0
- package/build/revamp/tests/legacy/MultipleFileUploadSchema.spec.js +447 -0
- package/build/revamp/tests/legacy/PersistAsync.blob-schema.spec.js +339 -0
- package/build/revamp/tests/legacy/PersistAsync.string-schema.spec.js +385 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.debouncing.spec.js +352 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.spec.js +623 -0
- package/build/revamp/tests/legacy/Search.spec.js +501 -0
- package/build/revamp/tests/legacy/ValidationAsync.spec.js +452 -0
- package/build/revamp/tests/legacy/useExternal.spec.js +235 -0
- package/build/revamp/types.js +1 -0
- package/build/revamp/useDynamicFlowCore.js +285 -0
- package/build/revamp/utils/component-utils.js +86 -0
- package/build/revamp/utils/component-utils.spec.js +385 -0
- package/build/revamp/utils/findComponent.js +29 -0
- package/build/revamp/utils/findComponent.spec.js +92 -0
- package/build/revamp/utils/type-utils.js +59 -0
- package/build/revamp/utils/type-validators.js +16 -0
- package/build/revamp/utils/type-validators.spec.js +163 -0
- package/build/revamp/utils/useStableCallback.js +21 -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 +19 -0
- package/build/revamp/wise/renderers/ButtonRenderer.js +53 -0
- package/build/revamp/wise/renderers/ColumnsRenderer.js +14 -0
- package/build/revamp/wise/renderers/DateInputRenderer.js +35 -0
- package/build/revamp/wise/renderers/DecisionRenderer.js +18 -0
- package/build/revamp/wise/renderers/DividerRenderer.js +10 -0
- package/build/revamp/wise/renderers/FormRenderer.js +10 -0
- package/build/revamp/wise/renderers/FormSectionRenderer.js +16 -0
- package/build/revamp/wise/renderers/HeadingRenderer.js +57 -0
- package/build/revamp/wise/renderers/ImageRenderer.js +112 -0
- package/build/revamp/wise/renderers/InstructionsRenderer.js +23 -0
- package/build/revamp/wise/renderers/IntegerInputRenderer.js +38 -0
- package/build/revamp/wise/renderers/LoadingIndicatorRenderer.js +11 -0
- package/build/revamp/wise/renderers/MarkdownRenderer.js +11 -0
- package/build/revamp/wise/renderers/ModalRenderer.js +25 -0
- package/build/revamp/wise/renderers/MultiUploadInputRenderer.js +63 -0
- package/build/revamp/wise/renderers/NumberInputRenderer.js +38 -0
- package/build/revamp/wise/renderers/ParagraphRenderer.js +45 -0
- package/build/revamp/wise/renderers/RepeatableRenderer.js +58 -0
- package/build/revamp/wise/renderers/ReviewRenderer.js +35 -0
- package/build/revamp/wise/renderers/SearchRenderer/BlockSearchRendererComponent.js +59 -0
- package/build/revamp/wise/renderers/SearchRenderer/ErrorResult.js +11 -0
- package/build/revamp/wise/renderers/SearchRenderer/InlineSearchRendererComponent.js +63 -0
- package/build/revamp/wise/renderers/SearchRenderer/SearchRenderer.js +21 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/OptionMedia.js +16 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.js +14 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.js +21 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.js +33 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.js +56 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.js +16 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.js +22 -0
- package/build/revamp/wise/renderers/StatusListRenderer.js +21 -0
- package/build/revamp/wise/renderers/TextInputRenderer.js +35 -0
- package/build/revamp/wise/renderers/UploadInputRenderer.js +136 -0
- package/build/revamp/wise/renderers/components/FieldInput.js +9 -0
- package/build/revamp/wise/renderers/components/Help.js +10 -0
- package/build/revamp/wise/renderers/components/LabelContentWithHelp.js +6 -0
- package/build/revamp/wise/renderers/components/UploadFieldInput.js +14 -0
- package/build/revamp/wise/renderers/components/VariableDateInput.js +30 -0
- package/build/revamp/wise/renderers/components/VariableTextInput.js +69 -0
- package/build/revamp/wise/renderers/components/icon/DynamicIcon.js +17 -0
- package/build/revamp/wise/renderers/components/icon/FlagIcon.js +11 -0
- package/build/revamp/wise/renderers/components/icon/NamedIcon.js +19 -0
- package/build/revamp/wise/renderers/components/icon/NavigationOptionMedia.js +20 -0
- package/build/revamp/wise/renderers/getWiseRenderers.js +59 -0
- package/build/revamp/wise/renderers/hooks/useSnackBarIfAvailable.js +6 -0
- package/build/revamp/wise/renderers/step/BackButton.js +11 -0
- package/build/revamp/wise/renderers/step/ExternalConfirmationDialog.js +20 -0
- package/build/revamp/wise/renderers/step/StepRenderer.js +30 -0
- package/build/revamp/wise/renderers/step/StepRendererContext.js +11 -0
- package/build/revamp/wise/renderers/step/useExternal.js +15 -0
- package/build/revamp/wise/renderers/utils/file-utils.js +70 -0
- package/build/revamp/wise/renderers/utils/getRandomId.js +2 -0
- package/build/revamp/wise/renderers/utils/input-utils.js +6 -0
- package/build/revamp/wise/renderers/utils/layout-utils.js +31 -0
- package/build/revamp/wise/renderers/utils/value-utils.js +23 -0
- package/build/revamp/wise/renderers/utils/value-utils.spec.js +33 -0
- package/build/revamp/wise/renderers/validators/type-validators.js +15 -0
- package/build/test-utils/NeptuneProviders.js +23 -0
- package/build/test-utils/fetch-utils.js +104 -0
- package/build/test-utils/index.js +2 -0
- package/build/test-utils/rtl-utils.js +20 -0
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +1 -0
- package/build/types/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.d.ts +2 -0
- package/package.json +2 -2
package/build/main.js
CHANGED
|
@@ -1153,7 +1153,7 @@ var translations = {
|
|
|
1153
1153
|
var i18n_default = translations;
|
|
1154
1154
|
|
|
1155
1155
|
// src/revamp/DynamicFlowWise.tsx
|
|
1156
|
-
var
|
|
1156
|
+
var import_react20 = require("react");
|
|
1157
1157
|
|
|
1158
1158
|
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1159
1159
|
var import_react = require("react");
|
|
@@ -10224,7 +10224,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10224
10224
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10225
10225
|
}
|
|
10226
10226
|
|
|
10227
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.
|
|
10227
|
+
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.29.0_@types+react@18.0.29_react@18.2.0/node_modules/@wise/forms/dist/index.mjs
|
|
10228
10228
|
var import_components3 = require("@transferwise/components");
|
|
10229
10229
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10230
10230
|
var import_react7 = require("react");
|
|
@@ -11674,6 +11674,7 @@ function SelectInputRendererComponent(props) {
|
|
|
11674
11674
|
label,
|
|
11675
11675
|
options,
|
|
11676
11676
|
placeholder,
|
|
11677
|
+
required,
|
|
11677
11678
|
selectedIndex,
|
|
11678
11679
|
onSelect
|
|
11679
11680
|
} = props;
|
|
@@ -11716,44 +11717,78 @@ function SelectInputRendererComponent(props) {
|
|
|
11716
11717
|
renderValue,
|
|
11717
11718
|
filterable: items.length >= 8,
|
|
11718
11719
|
onChange: onSelect,
|
|
11719
|
-
onClear: () => onSelect(null)
|
|
11720
|
+
onClear: required ? void 0 : () => onSelect(null)
|
|
11720
11721
|
}
|
|
11721
11722
|
) }),
|
|
11722
11723
|
children
|
|
11723
11724
|
] });
|
|
11724
11725
|
}
|
|
11725
11726
|
|
|
11726
|
-
// src/revamp/wise/renderers/SelectInputRenderer/
|
|
11727
|
+
// src/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
11728
|
+
var import_react17 = require("react");
|
|
11729
|
+
var import_components31 = require("@transferwise/components");
|
|
11727
11730
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11731
|
+
function SegmentedInputRendererComponent(props) {
|
|
11732
|
+
const { id, children, description, error, help, label, options, selectedIndex, onSelect } = props;
|
|
11733
|
+
(0, import_react17.useEffect)(() => {
|
|
11734
|
+
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
11735
|
+
onSelect(0);
|
|
11736
|
+
}
|
|
11737
|
+
}, [selectedIndex, onSelect, options.length]);
|
|
11738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
11739
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11740
|
+
import_components31.SegmentedControl,
|
|
11741
|
+
{
|
|
11742
|
+
name: `${id}-segmented-control`,
|
|
11743
|
+
value: String(selectedIndex),
|
|
11744
|
+
mode: "view",
|
|
11745
|
+
segments: options.map((option, index) => ({
|
|
11746
|
+
id: String(index),
|
|
11747
|
+
value: String(index),
|
|
11748
|
+
label: option.title,
|
|
11749
|
+
controls: `${id}-children`
|
|
11750
|
+
})),
|
|
11751
|
+
onChange: (value) => onSelect(Number(value))
|
|
11752
|
+
}
|
|
11753
|
+
) }),
|
|
11754
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { id: `${id}-children`, children })
|
|
11755
|
+
] });
|
|
11756
|
+
}
|
|
11757
|
+
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
11758
|
+
|
|
11759
|
+
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
11760
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11728
11761
|
var SelectInputRenderer = {
|
|
11729
11762
|
canRenderType: "input-select",
|
|
11730
11763
|
render: (props) => {
|
|
11731
11764
|
switch (props.control) {
|
|
11732
11765
|
case "radio":
|
|
11733
|
-
return /* @__PURE__ */ (0,
|
|
11766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
11734
11767
|
case "tab":
|
|
11735
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
11768
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
11769
|
+
case "segmented":
|
|
11770
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
11736
11771
|
case "select":
|
|
11737
11772
|
default:
|
|
11738
|
-
return /* @__PURE__ */ (0,
|
|
11773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
11739
11774
|
}
|
|
11740
11775
|
}
|
|
11741
11776
|
};
|
|
11742
11777
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
11743
11778
|
|
|
11744
11779
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
11745
|
-
var
|
|
11746
|
-
var
|
|
11780
|
+
var import_components32 = require("@transferwise/components");
|
|
11781
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11747
11782
|
var StatusListRenderer = {
|
|
11748
11783
|
canRenderType: "status-list",
|
|
11749
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
11750
|
-
title ? /* @__PURE__ */ (0,
|
|
11751
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0,
|
|
11752
|
-
|
|
11784
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: getMargin(margin), children: [
|
|
11785
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components32.Header, { title }) : null,
|
|
11786
|
+
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
11787
|
+
import_components32.Summary,
|
|
11753
11788
|
{
|
|
11754
11789
|
title: itemTitle,
|
|
11755
11790
|
description,
|
|
11756
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
11791
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
11757
11792
|
status: mapStatus(status)
|
|
11758
11793
|
},
|
|
11759
11794
|
`${title}/${description || ""}`
|
|
@@ -11769,63 +11804,63 @@ var mapStatus = (status) => {
|
|
|
11769
11804
|
};
|
|
11770
11805
|
|
|
11771
11806
|
// src/revamp/wise/renderers/components/VariableTextInput.tsx
|
|
11772
|
-
var
|
|
11773
|
-
var
|
|
11807
|
+
var import_components33 = require("@transferwise/components");
|
|
11808
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11774
11809
|
function VariableTextInput({
|
|
11775
11810
|
control,
|
|
11776
11811
|
inputProps
|
|
11777
11812
|
}) {
|
|
11778
11813
|
switch (control) {
|
|
11779
11814
|
case "password":
|
|
11780
|
-
return /* @__PURE__ */ (0,
|
|
11815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
11781
11816
|
case "email":
|
|
11782
|
-
return /* @__PURE__ */ (0,
|
|
11817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
11783
11818
|
case "textarea":
|
|
11784
|
-
return /* @__PURE__ */ (0,
|
|
11819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextAreaInput, __spreadValues({}, inputProps));
|
|
11785
11820
|
case "numeric":
|
|
11786
|
-
return /* @__PURE__ */ (0,
|
|
11821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
11787
11822
|
case "phone-number":
|
|
11788
|
-
return /* @__PURE__ */ (0,
|
|
11823
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PhoneNumberInput, __spreadValues({}, inputProps));
|
|
11789
11824
|
default:
|
|
11790
|
-
return /* @__PURE__ */ (0,
|
|
11825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
11791
11826
|
}
|
|
11792
11827
|
}
|
|
11793
11828
|
function TextInput(_a) {
|
|
11794
11829
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11795
11830
|
if (typeof displayFormat === "string") {
|
|
11796
11831
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
11797
|
-
return /* @__PURE__ */ (0,
|
|
11798
|
-
|
|
11832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11833
|
+
import_components33.InputWithDisplayFormat,
|
|
11799
11834
|
__spreadValues({
|
|
11800
11835
|
displayPattern: displayFormat,
|
|
11801
11836
|
onChange: (newValue) => onChange(newValue)
|
|
11802
11837
|
}, inputProps)
|
|
11803
11838
|
);
|
|
11804
11839
|
}
|
|
11805
|
-
return /* @__PURE__ */ (0,
|
|
11840
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.Input, __spreadValues({ id, name: id, onChange: (e) => onChange(e.target.value) }, rest));
|
|
11806
11841
|
}
|
|
11807
11842
|
function TextAreaInput(_a) {
|
|
11808
11843
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11809
11844
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
11810
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11811
|
-
|
|
11845
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11846
|
+
import_components33.TextareaWithDisplayFormat,
|
|
11812
11847
|
__spreadValues({
|
|
11813
11848
|
displayPattern: displayFormat,
|
|
11814
11849
|
onChange: (newValue) => onChange(newValue)
|
|
11815
11850
|
}, textAreaProps)
|
|
11816
|
-
) : /* @__PURE__ */ (0,
|
|
11851
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.TextArea, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
11817
11852
|
}
|
|
11818
11853
|
function NumericInput(_a) {
|
|
11819
11854
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11820
11855
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
11821
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11822
|
-
|
|
11856
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11857
|
+
import_components33.InputWithDisplayFormat,
|
|
11823
11858
|
__spreadValues({
|
|
11824
11859
|
displayPattern: displayFormat,
|
|
11825
11860
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
11826
11861
|
}, numericProps)
|
|
11827
|
-
) : /* @__PURE__ */ (0,
|
|
11828
|
-
|
|
11862
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11863
|
+
import_components33.Input,
|
|
11829
11864
|
__spreadValues({
|
|
11830
11865
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
11831
11866
|
}, numericProps)
|
|
@@ -11833,12 +11868,12 @@ function NumericInput(_a) {
|
|
|
11833
11868
|
}
|
|
11834
11869
|
function PhoneNumberInput(_a) {
|
|
11835
11870
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
11836
|
-
return /* @__PURE__ */ (0,
|
|
11871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.PhoneNumberInput, __spreadValues({ initialValue: value }, rest));
|
|
11837
11872
|
}
|
|
11838
11873
|
var VariableTextInput_default = VariableTextInput;
|
|
11839
11874
|
|
|
11840
11875
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
11841
|
-
var
|
|
11876
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
11842
11877
|
var TextInputRenderer = {
|
|
11843
11878
|
canRenderType: "input-text",
|
|
11844
11879
|
render: (props) => {
|
|
@@ -11863,14 +11898,14 @@ var TextInputRenderer = {
|
|
|
11863
11898
|
]);
|
|
11864
11899
|
const value = initialValue != null ? initialValue : "";
|
|
11865
11900
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
11866
|
-
return /* @__PURE__ */ (0,
|
|
11901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(VariableTextInput_default, { control, inputProps }) });
|
|
11867
11902
|
}
|
|
11868
11903
|
};
|
|
11869
11904
|
var TextInputRenderer_default = TextInputRenderer;
|
|
11870
11905
|
|
|
11871
11906
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
11872
|
-
var
|
|
11873
|
-
var
|
|
11907
|
+
var import_components34 = require("@transferwise/components");
|
|
11908
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
11874
11909
|
var UploadInputRenderer = {
|
|
11875
11910
|
canRenderType: "input-upload",
|
|
11876
11911
|
render: (props) => {
|
|
@@ -11886,8 +11921,8 @@ var UploadInputRenderer = {
|
|
|
11886
11921
|
};
|
|
11887
11922
|
return (
|
|
11888
11923
|
// We don't pass help here as there is no sensible place to display it
|
|
11889
|
-
/* @__PURE__ */ (0,
|
|
11890
|
-
|
|
11924
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UploadFieldInput_default, { id, label: void 0, description: void 0, error, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11925
|
+
import_components34.UploadInput,
|
|
11891
11926
|
{
|
|
11892
11927
|
id,
|
|
11893
11928
|
description,
|
|
@@ -11941,8 +11976,8 @@ var LargeUploadRenderer = {
|
|
|
11941
11976
|
throw e;
|
|
11942
11977
|
}
|
|
11943
11978
|
};
|
|
11944
|
-
return /* @__PURE__ */ (0,
|
|
11945
|
-
|
|
11979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11980
|
+
import_components34.Upload,
|
|
11946
11981
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
11947
11982
|
usAccept: getAcceptsString(accepts),
|
|
11948
11983
|
usDisabled: disabled,
|
|
@@ -11955,8 +11990,8 @@ var LargeUploadRenderer = {
|
|
|
11955
11990
|
};
|
|
11956
11991
|
|
|
11957
11992
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
11958
|
-
var
|
|
11959
|
-
var
|
|
11993
|
+
var import_components35 = require("@transferwise/components");
|
|
11994
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
11960
11995
|
var ReviewRenderer = {
|
|
11961
11996
|
canRenderType: "review",
|
|
11962
11997
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -11968,10 +12003,10 @@ var ReviewRenderer = {
|
|
|
11968
12003
|
callToAction.onClick();
|
|
11969
12004
|
}
|
|
11970
12005
|
} : void 0;
|
|
11971
|
-
return /* @__PURE__ */ (0,
|
|
11972
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
11973
|
-
/* @__PURE__ */ (0,
|
|
11974
|
-
|
|
12006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getMargin(margin), children: [
|
|
12007
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components35.Header, { title: title != null ? title : "", action }),
|
|
12008
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
12009
|
+
import_components35.DefinitionList,
|
|
11975
12010
|
{
|
|
11976
12011
|
layout: orientation,
|
|
11977
12012
|
definitions: fields.map(({ label, value, help }, index) => ({
|
|
@@ -11987,21 +12022,21 @@ var ReviewRenderer = {
|
|
|
11987
12022
|
var ReviewRenderer_default = ReviewRenderer;
|
|
11988
12023
|
var getFieldValue = (value, help, orientation) => {
|
|
11989
12024
|
if (help) {
|
|
11990
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
11991
|
-
/* @__PURE__ */ (0,
|
|
12025
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
12026
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help }),
|
|
11992
12027
|
" ",
|
|
11993
12028
|
value
|
|
11994
|
-
] }) : /* @__PURE__ */ (0,
|
|
12029
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11995
12030
|
value,
|
|
11996
12031
|
" ",
|
|
11997
|
-
/* @__PURE__ */ (0,
|
|
12032
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help })
|
|
11998
12033
|
] });
|
|
11999
12034
|
}
|
|
12000
12035
|
return value;
|
|
12001
12036
|
};
|
|
12002
12037
|
|
|
12003
12038
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12004
|
-
var
|
|
12039
|
+
var import_react19 = require("react");
|
|
12005
12040
|
|
|
12006
12041
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12007
12042
|
var import_react_intl15 = require("react-intl");
|
|
@@ -12032,19 +12067,19 @@ var external_confirmation_messages_default = (0, import_react_intl14.defineMessa
|
|
|
12032
12067
|
});
|
|
12033
12068
|
|
|
12034
12069
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12035
|
-
var
|
|
12036
|
-
var
|
|
12070
|
+
var import_components36 = require("@transferwise/components");
|
|
12071
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12037
12072
|
function ExternalConfirmationDialog({
|
|
12038
12073
|
external,
|
|
12039
12074
|
onClose
|
|
12040
12075
|
}) {
|
|
12041
12076
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
12042
|
-
return /* @__PURE__ */ (0,
|
|
12043
|
-
/* @__PURE__ */ (0,
|
|
12044
|
-
/* @__PURE__ */ (0,
|
|
12045
|
-
/* @__PURE__ */ (0,
|
|
12046
|
-
/* @__PURE__ */ (0,
|
|
12047
|
-
|
|
12077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12078
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.title) }),
|
|
12079
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components36.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(external.url) }) }),
|
|
12080
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12081
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
12082
|
+
import_components36.Button,
|
|
12048
12083
|
{
|
|
12049
12084
|
block: true,
|
|
12050
12085
|
className: "m-b-2",
|
|
@@ -12057,7 +12092,7 @@ function ExternalConfirmationDialog({
|
|
|
12057
12092
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
12058
12093
|
}
|
|
12059
12094
|
),
|
|
12060
|
-
/* @__PURE__ */ (0,
|
|
12095
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components36.Button, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onClose, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
12061
12096
|
] }) })
|
|
12062
12097
|
] }) });
|
|
12063
12098
|
}
|
|
@@ -12070,12 +12105,12 @@ function getOrigin(url) {
|
|
|
12070
12105
|
}
|
|
12071
12106
|
|
|
12072
12107
|
// src/revamp/wise/renderers/step/useExternal.tsx
|
|
12073
|
-
var
|
|
12108
|
+
var import_react18 = require("react");
|
|
12074
12109
|
function useExternal(url) {
|
|
12075
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
12076
|
-
const [hasDismissed, setHasDismissed] = (0,
|
|
12110
|
+
const [externalWindow, setExternalWindow] = (0, import_react18.useState)(null);
|
|
12111
|
+
const [hasDismissed, setHasDismissed] = (0, import_react18.useState)(false);
|
|
12077
12112
|
const dismissConfirmation = () => setHasDismissed(true);
|
|
12078
|
-
(0,
|
|
12113
|
+
(0, import_react18.useEffect)(() => {
|
|
12079
12114
|
if (url) {
|
|
12080
12115
|
setHasDismissed(false);
|
|
12081
12116
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -12086,11 +12121,11 @@ function useExternal(url) {
|
|
|
12086
12121
|
}
|
|
12087
12122
|
|
|
12088
12123
|
// src/revamp/wise/renderers/step/BackButton.tsx
|
|
12089
|
-
var
|
|
12124
|
+
var import_components37 = require("@transferwise/components");
|
|
12090
12125
|
var import_icons3 = require("@transferwise/icons");
|
|
12091
|
-
var
|
|
12126
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
12092
12127
|
function BackButton({ title, onClick }) {
|
|
12093
|
-
return /* @__PURE__ */ (0,
|
|
12128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
12094
12129
|
"a",
|
|
12095
12130
|
{
|
|
12096
12131
|
href: "/",
|
|
@@ -12101,8 +12136,8 @@ function BackButton({ title, onClick }) {
|
|
|
12101
12136
|
onClick();
|
|
12102
12137
|
},
|
|
12103
12138
|
children: [
|
|
12104
|
-
/* @__PURE__ */ (0,
|
|
12105
|
-
/* @__PURE__ */ (0,
|
|
12139
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "sr-only", children: title }),
|
|
12140
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components37.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
12106
12141
|
]
|
|
12107
12142
|
}
|
|
12108
12143
|
);
|
|
@@ -12110,20 +12145,20 @@ function BackButton({ title, onClick }) {
|
|
|
12110
12145
|
var BackButton_default = BackButton;
|
|
12111
12146
|
|
|
12112
12147
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12113
|
-
var
|
|
12148
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
12114
12149
|
var StepRenderer = {
|
|
12115
12150
|
canRenderType: "step",
|
|
12116
12151
|
render: StepRendererComponent
|
|
12117
12152
|
};
|
|
12118
12153
|
function StepRendererComponent(props) {
|
|
12119
12154
|
const { back, loadingState, external, trackEvent, children } = props;
|
|
12120
|
-
const value = (0,
|
|
12155
|
+
const value = (0, import_react19.useMemo)(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12121
12156
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12122
12157
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
12123
|
-
return /* @__PURE__ */ (0,
|
|
12158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ExternalConfirmationDialog, { external, onClose: dismissConfirmation });
|
|
12124
12159
|
}
|
|
12125
|
-
return /* @__PURE__ */ (0,
|
|
12126
|
-
back ? /* @__PURE__ */ (0,
|
|
12160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(StepRendererContextProvider, { value, children: [
|
|
12161
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
12127
12162
|
children
|
|
12128
12163
|
] });
|
|
12129
12164
|
}
|
|
@@ -12162,24 +12197,24 @@ var getWiseRenderers = () => [
|
|
|
12162
12197
|
];
|
|
12163
12198
|
|
|
12164
12199
|
// src/revamp/DynamicFlowWise.tsx
|
|
12165
|
-
var
|
|
12200
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
12166
12201
|
var wiseRenderers = getWiseRenderers();
|
|
12167
12202
|
function DynamicFlowWise(props) {
|
|
12168
12203
|
const { httpClient, renderers } = props;
|
|
12169
|
-
const mergedRenderers = (0,
|
|
12170
|
-
return /* @__PURE__ */ (0,
|
|
12204
|
+
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
12205
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
|
|
12171
12206
|
}
|
|
12172
12207
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
12173
12208
|
|
|
12174
12209
|
// src/revamp/DynamicFragmentWise.tsx
|
|
12175
|
-
var
|
|
12176
|
-
var
|
|
12210
|
+
var import_react21 = require("react");
|
|
12211
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12177
12212
|
var wiseRenderers2 = getWiseRenderers();
|
|
12178
|
-
var DynamicFragmentWise = (0,
|
|
12213
|
+
var DynamicFragmentWise = (0, import_react21.forwardRef)(function DynamicFragmentWise2(props, ref) {
|
|
12179
12214
|
const { httpClient, onEvent, onError, renderers } = props;
|
|
12180
|
-
const mergedRenderers = (0,
|
|
12215
|
+
const mergedRenderers = (0, import_react21.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
|
|
12181
12216
|
const { stepComponentRef } = useDynamicFlowCore(props);
|
|
12182
|
-
(0,
|
|
12217
|
+
(0, import_react21.useImperativeHandle)(
|
|
12183
12218
|
ref,
|
|
12184
12219
|
() => ({
|
|
12185
12220
|
getValue: async () => {
|
|
@@ -12194,18 +12229,18 @@ var DynamicFragmentWise = (0, import_react20.forwardRef)(function DynamicFragmen
|
|
|
12194
12229
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12195
12230
|
[]
|
|
12196
12231
|
);
|
|
12197
|
-
const render = (0,
|
|
12232
|
+
const render = (0, import_react21.useMemo)(
|
|
12198
12233
|
() => getRenderFunction([CoreContainerRenderer, ...mergedRenderers, StepRenderer]),
|
|
12199
12234
|
[mergedRenderers]
|
|
12200
12235
|
);
|
|
12201
|
-
return /* @__PURE__ */ (0,
|
|
12236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
12202
12237
|
ErrorBoundary_default,
|
|
12203
12238
|
{
|
|
12204
12239
|
onError: (error) => {
|
|
12205
12240
|
onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed");
|
|
12206
12241
|
onError(error);
|
|
12207
12242
|
},
|
|
12208
|
-
children: /* @__PURE__ */ (0,
|
|
12243
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HttpClientProvider, { httpClient, children: stepComponentRef.current ? render(stepComponentRef.current) : null })
|
|
12209
12244
|
}
|
|
12210
12245
|
);
|
|
12211
12246
|
});
|
|
@@ -12516,16 +12551,16 @@ function isReference(block) {
|
|
|
12516
12551
|
}
|
|
12517
12552
|
|
|
12518
12553
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12519
|
-
var
|
|
12554
|
+
var import_react65 = require("react");
|
|
12520
12555
|
|
|
12521
12556
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12522
|
-
var
|
|
12557
|
+
var import_react23 = require("react");
|
|
12523
12558
|
|
|
12524
12559
|
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
12525
|
-
var
|
|
12560
|
+
var import_react22 = require("react");
|
|
12526
12561
|
function usePendingPromiseCounter() {
|
|
12527
|
-
const [count, setCount] = (0,
|
|
12528
|
-
const addPendingPromise = (0,
|
|
12562
|
+
const [count, setCount] = (0, import_react22.useState)(0);
|
|
12563
|
+
const addPendingPromise = (0, import_react22.useCallback)(
|
|
12529
12564
|
(promise) => {
|
|
12530
12565
|
setCount((c) => c + 1);
|
|
12531
12566
|
promise.catch(noop2).finally(() => delayUntilNextCycle(() => setCount((c) => Math.max(0, c - 1))));
|
|
@@ -12539,44 +12574,44 @@ var noop2 = () => {
|
|
|
12539
12574
|
};
|
|
12540
12575
|
|
|
12541
12576
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12542
|
-
var
|
|
12577
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12543
12578
|
var defaultContextValue = {
|
|
12544
12579
|
loading: false,
|
|
12545
12580
|
registerPersistAsyncPromise: (promise) => {
|
|
12546
12581
|
}
|
|
12547
12582
|
};
|
|
12548
|
-
var DFContext = (0,
|
|
12583
|
+
var DFContext = (0, import_react23.createContext)(defaultContextValue);
|
|
12549
12584
|
var DynamicFlowProvider = ({ loading, children }) => {
|
|
12550
12585
|
const { pendingPromises, addPendingPromise } = usePendingPromiseCounter();
|
|
12551
|
-
const providerValue = (0,
|
|
12586
|
+
const providerValue = (0, import_react23.useMemo)(() => {
|
|
12552
12587
|
return {
|
|
12553
12588
|
loading: loading || pendingPromises > 0,
|
|
12554
12589
|
registerPersistAsyncPromise: addPendingPromise
|
|
12555
12590
|
};
|
|
12556
12591
|
}, [loading, pendingPromises, addPendingPromise]);
|
|
12557
|
-
return /* @__PURE__ */ (0,
|
|
12592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DFContext.Provider, { value: providerValue, children });
|
|
12558
12593
|
};
|
|
12559
12594
|
var useDynamicFlow = () => {
|
|
12560
|
-
const context = (0,
|
|
12595
|
+
const context = (0, import_react23.useContext)(DFContext);
|
|
12561
12596
|
return context || defaultContextValue;
|
|
12562
12597
|
};
|
|
12563
12598
|
|
|
12564
12599
|
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
12565
|
-
var
|
|
12566
|
-
var
|
|
12567
|
-
var EventsContext = (0,
|
|
12600
|
+
var import_react24 = require("react");
|
|
12601
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12602
|
+
var EventsContext = (0, import_react24.createContext)({
|
|
12568
12603
|
triggerEvent: () => {
|
|
12569
12604
|
}
|
|
12570
12605
|
});
|
|
12571
12606
|
function EventsContextProvider({ metadata, children, onEvent }) {
|
|
12572
|
-
const value = (0,
|
|
12607
|
+
const value = (0, import_react24.useMemo)(
|
|
12573
12608
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
12574
12609
|
[onEvent, metadata]
|
|
12575
12610
|
);
|
|
12576
|
-
return /* @__PURE__ */ (0,
|
|
12611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventsContext.Provider, { value, children });
|
|
12577
12612
|
}
|
|
12578
12613
|
function useEventDispatcher() {
|
|
12579
|
-
const { triggerEvent } = (0,
|
|
12614
|
+
const { triggerEvent } = (0, import_react24.useContext)(EventsContext);
|
|
12580
12615
|
return triggerEvent;
|
|
12581
12616
|
}
|
|
12582
12617
|
var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) => {
|
|
@@ -12587,8 +12622,8 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
12587
12622
|
};
|
|
12588
12623
|
|
|
12589
12624
|
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
12590
|
-
var
|
|
12591
|
-
var
|
|
12625
|
+
var import_react25 = require("react");
|
|
12626
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
12592
12627
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
12593
12628
|
try {
|
|
12594
12629
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -12598,9 +12633,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
12598
12633
|
} catch (e) {
|
|
12599
12634
|
}
|
|
12600
12635
|
};
|
|
12601
|
-
var LogContext = (0,
|
|
12636
|
+
var LogContext = (0, import_react25.createContext)(null);
|
|
12602
12637
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
12603
|
-
const value = (0,
|
|
12638
|
+
const value = (0, import_react25.useMemo)(
|
|
12604
12639
|
() => ({
|
|
12605
12640
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
12606
12641
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -12610,10 +12645,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
12610
12645
|
}),
|
|
12611
12646
|
[onLog, flowId, stepId]
|
|
12612
12647
|
);
|
|
12613
|
-
return /* @__PURE__ */ (0,
|
|
12648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(LogContext.Provider, { value, children });
|
|
12614
12649
|
}
|
|
12615
12650
|
var useLogger = () => {
|
|
12616
|
-
const logging = (0,
|
|
12651
|
+
const logging = (0, import_react25.useContext)(LogContext);
|
|
12617
12652
|
if (logging == null) {
|
|
12618
12653
|
throw new Error(
|
|
12619
12654
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -12623,11 +12658,11 @@ var useLogger = () => {
|
|
|
12623
12658
|
};
|
|
12624
12659
|
|
|
12625
12660
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12626
|
-
var
|
|
12627
|
-
var
|
|
12628
|
-
var FeatureContext = (0,
|
|
12661
|
+
var import_react26 = require("react");
|
|
12662
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12663
|
+
var FeatureContext = (0, import_react26.createContext)([]);
|
|
12629
12664
|
function FeatureContextProvider({ features, children }) {
|
|
12630
|
-
return /* @__PURE__ */ (0,
|
|
12665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FeatureContext.Provider, { value: features, children });
|
|
12631
12666
|
}
|
|
12632
12667
|
|
|
12633
12668
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -13357,18 +13392,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
13357
13392
|
};
|
|
13358
13393
|
|
|
13359
13394
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
13360
|
-
var
|
|
13395
|
+
var import_react27 = require("react");
|
|
13361
13396
|
function useDebouncedFunction(callback, waitMs) {
|
|
13362
|
-
return (0,
|
|
13397
|
+
return (0, import_react27.useCallback)(debounce2(callback, waitMs), [callback, waitMs]);
|
|
13363
13398
|
}
|
|
13364
13399
|
|
|
13365
13400
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
13366
|
-
var
|
|
13401
|
+
var import_react28 = require("react");
|
|
13367
13402
|
function useExternal2(url) {
|
|
13368
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
13369
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
13403
|
+
const [externalWindow, setExternalWindow] = (0, import_react28.useState)(null);
|
|
13404
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react28.useState)(false);
|
|
13370
13405
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
13371
|
-
(0,
|
|
13406
|
+
(0, import_react28.useEffect)(() => {
|
|
13372
13407
|
if (url) {
|
|
13373
13408
|
setHasManuallyTriggered(false);
|
|
13374
13409
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -13379,10 +13414,10 @@ function useExternal2(url) {
|
|
|
13379
13414
|
}
|
|
13380
13415
|
|
|
13381
13416
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
13382
|
-
var
|
|
13417
|
+
var import_react29 = require("react");
|
|
13383
13418
|
function useExternalStepPolling(polling, onAction) {
|
|
13384
13419
|
const httpClient = useHttpClient();
|
|
13385
|
-
const asyncFn = (0,
|
|
13420
|
+
const asyncFn = (0, import_react29.useMemo)(() => {
|
|
13386
13421
|
if (polling) {
|
|
13387
13422
|
return () => httpClient(polling.url).then((response) => {
|
|
13388
13423
|
if (response.ok) {
|
|
@@ -13400,7 +13435,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13400
13435
|
}
|
|
13401
13436
|
return void 0;
|
|
13402
13437
|
}, [polling, httpClient]);
|
|
13403
|
-
const onPollingResponse = (0,
|
|
13438
|
+
const onPollingResponse = (0, import_react29.useCallback)(
|
|
13404
13439
|
(pollingResponse) => {
|
|
13405
13440
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
13406
13441
|
const responseHandler = responseHandlers.find(
|
|
@@ -13427,7 +13462,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13427
13462
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
13428
13463
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
13429
13464
|
onPollingResponse,
|
|
13430
|
-
onFailure: (0,
|
|
13465
|
+
onFailure: (0, import_react29.useCallback)(() => {
|
|
13431
13466
|
if (polling) {
|
|
13432
13467
|
onAction(polling.onError.action);
|
|
13433
13468
|
}
|
|
@@ -13436,11 +13471,11 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13436
13471
|
}
|
|
13437
13472
|
|
|
13438
13473
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
13439
|
-
var
|
|
13474
|
+
var import_react53 = require("react");
|
|
13440
13475
|
var import_react_intl31 = require("react-intl");
|
|
13441
13476
|
|
|
13442
13477
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
13443
|
-
var
|
|
13478
|
+
var import_react52 = require("react");
|
|
13444
13479
|
var import_react_intl30 = require("react-intl");
|
|
13445
13480
|
|
|
13446
13481
|
// src/legacy/common/constants/DateMode.ts
|
|
@@ -13489,28 +13524,28 @@ var Size = {
|
|
|
13489
13524
|
|
|
13490
13525
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13491
13526
|
var import_classnames16 = __toESM(require_classnames());
|
|
13492
|
-
var
|
|
13527
|
+
var import_react51 = require("react");
|
|
13493
13528
|
|
|
13494
13529
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13495
|
-
var
|
|
13530
|
+
var import_components39 = require("@transferwise/components");
|
|
13496
13531
|
|
|
13497
13532
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13498
|
-
var
|
|
13533
|
+
var import_components38 = require("@transferwise/components");
|
|
13499
13534
|
|
|
13500
13535
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13501
|
-
var
|
|
13536
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
13502
13537
|
var isFlagIcon2 = (name) => name.startsWith("flag-");
|
|
13503
13538
|
function FlagIcon2({ name }) {
|
|
13504
13539
|
if (!isFlagIcon2(name)) {
|
|
13505
13540
|
return null;
|
|
13506
13541
|
}
|
|
13507
13542
|
const code = name.substring(5);
|
|
13508
|
-
return /* @__PURE__ */ (0,
|
|
13543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flag, { intrinsicSize: 24, code });
|
|
13509
13544
|
}
|
|
13510
13545
|
|
|
13511
13546
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13512
13547
|
var icons2 = __toESM(require("@transferwise/icons"));
|
|
13513
|
-
var
|
|
13548
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
13514
13549
|
var isNamedIcon2 = (name) => {
|
|
13515
13550
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13516
13551
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -13521,19 +13556,19 @@ function NamedIcon2({ name }) {
|
|
|
13521
13556
|
}
|
|
13522
13557
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13523
13558
|
const Icon = icons2[iconName];
|
|
13524
|
-
return /* @__PURE__ */ (0,
|
|
13559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon, { size: 24 });
|
|
13525
13560
|
}
|
|
13526
13561
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
13527
13562
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13528
13563
|
|
|
13529
13564
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13530
|
-
var
|
|
13565
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
13531
13566
|
function DynamicIcon2({ type }) {
|
|
13532
13567
|
if (isFlagIcon2(type)) {
|
|
13533
|
-
return /* @__PURE__ */ (0,
|
|
13568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FlagIcon2, { name: type });
|
|
13534
13569
|
}
|
|
13535
13570
|
if (isNamedIcon2(type)) {
|
|
13536
|
-
return /* @__PURE__ */ (0,
|
|
13571
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NamedIcon2, { name: type });
|
|
13537
13572
|
}
|
|
13538
13573
|
return null;
|
|
13539
13574
|
}
|
|
@@ -13543,17 +13578,17 @@ function isValidIconName(name) {
|
|
|
13543
13578
|
var DynamicIcon_default2 = DynamicIcon2;
|
|
13544
13579
|
|
|
13545
13580
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13546
|
-
var
|
|
13581
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
13547
13582
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13548
13583
|
if (icon == null ? void 0 : icon.name) {
|
|
13549
|
-
return /* @__PURE__ */ (0,
|
|
13584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components38.Avatar, { type: import_components38.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicIcon_default2, { type: icon.name }) });
|
|
13550
13585
|
}
|
|
13551
13586
|
if (icon == null ? void 0 : icon.text) {
|
|
13552
|
-
return /* @__PURE__ */ (0,
|
|
13587
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components38.Avatar, { type: import_components38.AvatarType.INITIALS, children: icon.text });
|
|
13553
13588
|
}
|
|
13554
13589
|
if (image == null ? void 0 : image.url) {
|
|
13555
13590
|
const { url, text } = image;
|
|
13556
|
-
return /* @__PURE__ */ (0,
|
|
13591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("img", { src: url, alt: text });
|
|
13557
13592
|
}
|
|
13558
13593
|
return null;
|
|
13559
13594
|
};
|
|
@@ -13589,11 +13624,11 @@ var getTextAlignment2 = (align) => {
|
|
|
13589
13624
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
13590
13625
|
|
|
13591
13626
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13592
|
-
var
|
|
13627
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
13593
13628
|
var DynamicAlert = (props) => {
|
|
13594
13629
|
const alert = props.component;
|
|
13595
|
-
return /* @__PURE__ */ (0,
|
|
13596
|
-
|
|
13630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
13631
|
+
import_components39.Alert,
|
|
13597
13632
|
{
|
|
13598
13633
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
13599
13634
|
className: getMargin2(alert.margin),
|
|
@@ -13625,12 +13660,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13625
13660
|
var DynamicAlert_default = DynamicAlert;
|
|
13626
13661
|
|
|
13627
13662
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13628
|
-
var
|
|
13663
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
13629
13664
|
var DynamicBox = (props) => {
|
|
13630
13665
|
const box = props.component;
|
|
13631
13666
|
const margin = getMargin2(box.margin || box.border ? "lg" : "xs");
|
|
13632
13667
|
if (!box.width || box.width === "xl") {
|
|
13633
|
-
return /* @__PURE__ */ (0,
|
|
13668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13634
13669
|
DynamicLayout_default,
|
|
13635
13670
|
{
|
|
13636
13671
|
components: box.components,
|
|
@@ -13643,7 +13678,7 @@ var DynamicBox = (props) => {
|
|
|
13643
13678
|
}
|
|
13644
13679
|
) });
|
|
13645
13680
|
}
|
|
13646
|
-
return /* @__PURE__ */ (0,
|
|
13681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13647
13682
|
DynamicLayout_default,
|
|
13648
13683
|
{
|
|
13649
13684
|
components: box.components,
|
|
@@ -13677,7 +13712,7 @@ var getBoxWidthClasses = (component) => {
|
|
|
13677
13712
|
var DynamicBox_default = DynamicBox;
|
|
13678
13713
|
|
|
13679
13714
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13680
|
-
var
|
|
13715
|
+
var import_components40 = require("@transferwise/components");
|
|
13681
13716
|
|
|
13682
13717
|
// src/legacy/layout/button/utils.ts
|
|
13683
13718
|
var priorities = {
|
|
@@ -13727,7 +13762,7 @@ var getButtonSize = (size) => {
|
|
|
13727
13762
|
};
|
|
13728
13763
|
|
|
13729
13764
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13730
|
-
var
|
|
13765
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13731
13766
|
function DynamicButton(props) {
|
|
13732
13767
|
var _a;
|
|
13733
13768
|
const { component, onAction } = props;
|
|
@@ -13736,8 +13771,8 @@ function DynamicButton(props) {
|
|
|
13736
13771
|
const priority = getButtonPriority(component);
|
|
13737
13772
|
const { loading } = useDynamicFlow();
|
|
13738
13773
|
const className = getMargin2(component.margin || "md");
|
|
13739
|
-
return /* @__PURE__ */ (0,
|
|
13740
|
-
|
|
13774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13775
|
+
import_components40.Button,
|
|
13741
13776
|
{
|
|
13742
13777
|
size: getButtonSize(component.size),
|
|
13743
13778
|
type: priority === "tertiary" ? void 0 : type,
|
|
@@ -13753,12 +13788,12 @@ function DynamicButton(props) {
|
|
|
13753
13788
|
var DynamicButton_default = DynamicButton;
|
|
13754
13789
|
|
|
13755
13790
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13756
|
-
var
|
|
13791
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13757
13792
|
var DynamicColumns = (props) => {
|
|
13758
13793
|
const columns = props.component;
|
|
13759
13794
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13760
|
-
return /* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
13795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: `${getMargin2(columns.margin || "xs")} row`, children: [
|
|
13796
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13762
13797
|
DynamicLayout_default,
|
|
13763
13798
|
{
|
|
13764
13799
|
components: columns.left,
|
|
@@ -13770,7 +13805,7 @@ var DynamicColumns = (props) => {
|
|
|
13770
13805
|
onPersistAsync: props.onPersistAsync
|
|
13771
13806
|
}
|
|
13772
13807
|
) }),
|
|
13773
|
-
/* @__PURE__ */ (0,
|
|
13808
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13774
13809
|
DynamicLayout_default,
|
|
13775
13810
|
{
|
|
13776
13811
|
components: columns.right,
|
|
@@ -13805,12 +13840,12 @@ var getWidth = (bias) => {
|
|
|
13805
13840
|
var DynamicColumns_default = DynamicColumns;
|
|
13806
13841
|
|
|
13807
13842
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13808
|
-
var
|
|
13809
|
-
var
|
|
13843
|
+
var import_components41 = require("@transferwise/components");
|
|
13844
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13810
13845
|
function DynamicDecision({ component, onAction }) {
|
|
13811
13846
|
const { loading } = useDynamicFlow();
|
|
13812
|
-
return /* @__PURE__ */ (0,
|
|
13813
|
-
|
|
13847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getMargin2(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components41.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13848
|
+
import_components41.NavigationOption,
|
|
13814
13849
|
{
|
|
13815
13850
|
title: option.title,
|
|
13816
13851
|
content: option.description,
|
|
@@ -13826,17 +13861,17 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13826
13861
|
var DynamicDecision_default = DynamicDecision;
|
|
13827
13862
|
|
|
13828
13863
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13829
|
-
var
|
|
13864
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13830
13865
|
var DynamicDivider = ({ component }) => {
|
|
13831
13866
|
const margin = getMargin2(component.margin);
|
|
13832
13867
|
const className = `m-t-0 ${margin}`;
|
|
13833
|
-
return /* @__PURE__ */ (0,
|
|
13868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("hr", { className });
|
|
13834
13869
|
};
|
|
13835
13870
|
var DynamicDivider_default = DynamicDivider;
|
|
13836
13871
|
|
|
13837
13872
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13838
|
-
var
|
|
13839
|
-
var
|
|
13873
|
+
var import_components42 = require("@transferwise/components");
|
|
13874
|
+
var import_react30 = require("react");
|
|
13840
13875
|
var import_react_intl17 = require("react-intl");
|
|
13841
13876
|
|
|
13842
13877
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
@@ -13850,37 +13885,37 @@ var DynamicExternal_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
13850
13885
|
});
|
|
13851
13886
|
|
|
13852
13887
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13853
|
-
var
|
|
13888
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13854
13889
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13855
13890
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13856
13891
|
const intl = (0, import_react_intl17.useIntl)();
|
|
13857
|
-
const openExternalUrl = (0,
|
|
13892
|
+
const openExternalUrl = (0, import_react30.useCallback)(
|
|
13858
13893
|
() => window.open(requestUrl, "df-external-window"),
|
|
13859
13894
|
[requestUrl]
|
|
13860
13895
|
);
|
|
13861
|
-
(0,
|
|
13896
|
+
(0, import_react30.useEffect)(() => {
|
|
13862
13897
|
openExternalUrl();
|
|
13863
13898
|
}, [openExternalUrl]);
|
|
13864
13899
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
13865
13900
|
responseHandlers
|
|
13866
13901
|
}) : void 0;
|
|
13867
13902
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13868
|
-
return /* @__PURE__ */ (0,
|
|
13869
|
-
/* @__PURE__ */ (0,
|
|
13870
|
-
/* @__PURE__ */ (0,
|
|
13871
|
-
/* @__PURE__ */ (0,
|
|
13903
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
13904
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components42.Loader, { size: import_components42.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
13905
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("br", {}),
|
|
13906
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components42.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
13872
13907
|
] });
|
|
13873
13908
|
};
|
|
13874
13909
|
var DynamicExternal_default = DynamicExternal;
|
|
13875
13910
|
|
|
13876
13911
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
13877
|
-
var
|
|
13912
|
+
var import_react44 = require("react");
|
|
13878
13913
|
|
|
13879
13914
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13880
|
-
var
|
|
13915
|
+
var import_components43 = require("@transferwise/components");
|
|
13881
13916
|
var import_classnames7 = __toESM(require_classnames());
|
|
13882
|
-
var
|
|
13883
|
-
var
|
|
13917
|
+
var import_react31 = require("react");
|
|
13918
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13884
13919
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13885
13920
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13886
13921
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13895,13 +13930,13 @@ function AllOfSchema(props) {
|
|
|
13895
13930
|
setModels(models);
|
|
13896
13931
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13897
13932
|
};
|
|
13898
|
-
const [models, setModels] = (0,
|
|
13899
|
-
return /* @__PURE__ */ (0,
|
|
13900
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
13901
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
13902
|
-
/* @__PURE__ */ (0,
|
|
13933
|
+
const [models, setModels] = (0, import_react31.useState)(splitModel(props.model, props.schema.allOf));
|
|
13934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
13935
|
+
props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components43.Header, { title: props.schema.title }),
|
|
13936
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { children: props.schema.description }),
|
|
13937
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
13903
13938
|
// eslint-disable-next-line react/no-array-index-key
|
|
13904
|
-
/* @__PURE__ */ (0,
|
|
13939
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: (0, import_classnames7.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13905
13940
|
GenericSchema_default,
|
|
13906
13941
|
{
|
|
13907
13942
|
schema,
|
|
@@ -13925,15 +13960,15 @@ AllOfSchema.defaultProps = {
|
|
|
13925
13960
|
var AllOfSchema_default = AllOfSchema;
|
|
13926
13961
|
|
|
13927
13962
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13928
|
-
var
|
|
13963
|
+
var import_components45 = require("@transferwise/components");
|
|
13929
13964
|
var import_classnames8 = __toESM(require_classnames());
|
|
13930
|
-
var
|
|
13965
|
+
var import_react32 = require("react");
|
|
13931
13966
|
|
|
13932
13967
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13933
|
-
var
|
|
13968
|
+
var import_components44 = require("@transferwise/components");
|
|
13934
13969
|
var import_formatting2 = require("@transferwise/formatting");
|
|
13935
13970
|
var import_react_intl18 = require("react-intl");
|
|
13936
|
-
var
|
|
13971
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13937
13972
|
function ControlFeedback(props) {
|
|
13938
13973
|
var _a;
|
|
13939
13974
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13942,12 +13977,12 @@ function ControlFeedback(props) {
|
|
|
13942
13977
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
|
|
13943
13978
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13944
13979
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13945
|
-
return /* @__PURE__ */ (0,
|
|
13946
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
13947
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
13948
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
13949
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
13950
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
13980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { id: props.id, children: [
|
|
13981
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components44.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
13982
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components44.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
13983
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_components44.InlineAlert, { type: "info", children: [
|
|
13984
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: props.schema.description }),
|
|
13985
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: props.infoMessage })
|
|
13951
13986
|
] })
|
|
13952
13987
|
] });
|
|
13953
13988
|
}
|
|
@@ -14073,15 +14108,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
14073
14108
|
}
|
|
14074
14109
|
|
|
14075
14110
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
14076
|
-
var
|
|
14111
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14077
14112
|
function MultipleFileUploadSchema(props) {
|
|
14078
14113
|
var _a, _b;
|
|
14079
14114
|
const { onChange, schema } = props;
|
|
14080
14115
|
const onEvent = useEventDispatcher();
|
|
14081
14116
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
14082
|
-
const uid = (0,
|
|
14083
|
-
const [inputChanged, setInputChanged] = (0,
|
|
14084
|
-
const [files, setFiles] = (0,
|
|
14117
|
+
const uid = (0, import_react32.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14118
|
+
const [inputChanged, setInputChanged] = (0, import_react32.useState)(false);
|
|
14119
|
+
const [files, setFiles] = (0, import_react32.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
14085
14120
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
14086
14121
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
14087
14122
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -14135,10 +14170,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
14135
14170
|
onDeleteFile: () => Promise.resolve()
|
|
14136
14171
|
});
|
|
14137
14172
|
const feedbackId = `${uid}-feedback`;
|
|
14138
|
-
return /* @__PURE__ */ (0,
|
|
14139
|
-
/* @__PURE__ */ (0,
|
|
14140
|
-
/* @__PURE__ */ (0,
|
|
14141
|
-
/* @__PURE__ */ (0,
|
|
14173
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_classnames8.default)("form-group", { "has-error": showError }), children: [
|
|
14174
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
14175
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components45.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
14176
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14142
14177
|
ControlFeedback_default,
|
|
14143
14178
|
{
|
|
14144
14179
|
id: feedbackId,
|
|
@@ -14168,7 +14203,7 @@ function getSuccessfullyProcessedFiles(allFiles) {
|
|
|
14168
14203
|
return allFiles.filter((file) => !file.error && file.status === "succeeded");
|
|
14169
14204
|
}
|
|
14170
14205
|
function convertFileIdsToComponentFileObjects(fileIds) {
|
|
14171
|
-
return fileIds.map((id) => isValidId(id) ? { id, status:
|
|
14206
|
+
return fileIds.map((id) => isValidId(id) ? { id, status: import_components45.Status.SUCCEEDED } : null).filter((item) => item !== null);
|
|
14172
14207
|
}
|
|
14173
14208
|
function isValidId(id) {
|
|
14174
14209
|
return isNumber3(id) || isString2(id);
|
|
@@ -14179,14 +14214,14 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
14179
14214
|
}
|
|
14180
14215
|
|
|
14181
14216
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14182
|
-
var
|
|
14217
|
+
var import_components47 = require("@transferwise/components");
|
|
14183
14218
|
var import_classnames9 = __toESM(require_classnames());
|
|
14184
|
-
var
|
|
14219
|
+
var import_react33 = require("react");
|
|
14185
14220
|
var import_react_intl22 = require("react-intl");
|
|
14186
14221
|
|
|
14187
14222
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
14188
|
-
var
|
|
14189
|
-
var
|
|
14223
|
+
var import_components46 = require("@transferwise/components");
|
|
14224
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14190
14225
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
14191
14226
|
switch (controlType) {
|
|
14192
14227
|
case "select":
|
|
@@ -14210,7 +14245,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
14210
14245
|
var mapImage = (image) => {
|
|
14211
14246
|
if (image == null ? void 0 : image.url) {
|
|
14212
14247
|
return {
|
|
14213
|
-
icon: /* @__PURE__ */ (0,
|
|
14248
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
14214
14249
|
hideIconInTrigger: true
|
|
14215
14250
|
};
|
|
14216
14251
|
}
|
|
@@ -14219,17 +14254,17 @@ var mapImage = (image) => {
|
|
|
14219
14254
|
var getIconPropertyForSelectOption = (icon) => {
|
|
14220
14255
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon2(icon.name)) {
|
|
14221
14256
|
return {
|
|
14222
|
-
icon: /* @__PURE__ */ (0,
|
|
14257
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
14223
14258
|
};
|
|
14224
14259
|
}
|
|
14225
14260
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14226
14261
|
return {
|
|
14227
|
-
icon: /* @__PURE__ */ (0,
|
|
14262
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DynamicIcon_default2, { type: icon.name })
|
|
14228
14263
|
};
|
|
14229
14264
|
}
|
|
14230
14265
|
if (icon == null ? void 0 : icon.text) {
|
|
14231
14266
|
return {
|
|
14232
|
-
icon: /* @__PURE__ */ (0,
|
|
14267
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: icon.text })
|
|
14233
14268
|
};
|
|
14234
14269
|
}
|
|
14235
14270
|
return null;
|
|
@@ -14237,17 +14272,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
14237
14272
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
14238
14273
|
if (image == null ? void 0 : image.url) {
|
|
14239
14274
|
return {
|
|
14240
|
-
avatar: /* @__PURE__ */ (0,
|
|
14275
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: image.url, alt: "" }) })
|
|
14241
14276
|
};
|
|
14242
14277
|
}
|
|
14243
14278
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14244
14279
|
return {
|
|
14245
|
-
avatar: /* @__PURE__ */ (0,
|
|
14280
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DynamicIcon_default2, { type: icon.name }) })
|
|
14246
14281
|
};
|
|
14247
14282
|
}
|
|
14248
14283
|
if (icon == null ? void 0 : icon.text) {
|
|
14249
14284
|
return {
|
|
14250
|
-
avatar: /* @__PURE__ */ (0,
|
|
14285
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.INITIALS, children: icon.text })
|
|
14251
14286
|
};
|
|
14252
14287
|
}
|
|
14253
14288
|
return null;
|
|
@@ -14286,7 +14321,7 @@ var multi_select_messages_default = (0, import_react_intl21.defineMessages)({
|
|
|
14286
14321
|
});
|
|
14287
14322
|
|
|
14288
14323
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14289
|
-
var
|
|
14324
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14290
14325
|
function MultiSelectSchema({
|
|
14291
14326
|
schema,
|
|
14292
14327
|
model,
|
|
@@ -14298,10 +14333,10 @@ function MultiSelectSchema({
|
|
|
14298
14333
|
const { formatMessage, locale } = (0, import_react_intl22.useIntl)();
|
|
14299
14334
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
14300
14335
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
14301
|
-
const id = (0,
|
|
14302
|
-
const [changed, setChanged] = (0,
|
|
14303
|
-
const [selected, setSelected] = (0,
|
|
14304
|
-
(0,
|
|
14336
|
+
const id = (0, import_react33.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14337
|
+
const [changed, setChanged] = (0, import_react33.useState)(false);
|
|
14338
|
+
const [selected, setSelected] = (0, import_react33.useState)(getInitialModelIndices(model, options));
|
|
14339
|
+
(0, import_react33.useEffect)(
|
|
14305
14340
|
() => {
|
|
14306
14341
|
if (selected) {
|
|
14307
14342
|
broadcastModelChange(selected);
|
|
@@ -14338,10 +14373,10 @@ function MultiSelectSchema({
|
|
|
14338
14373
|
const formGroupClasses = {
|
|
14339
14374
|
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
14340
14375
|
};
|
|
14341
|
-
return /* @__PURE__ */ (0,
|
|
14342
|
-
schema.title ? /* @__PURE__ */ (0,
|
|
14343
|
-
/* @__PURE__ */ (0,
|
|
14344
|
-
|
|
14376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: (0, import_classnames9.default)("d-flex flex-column", formGroupClasses), children: [
|
|
14377
|
+
schema.title ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("label", { htmlFor: id, children: schema.title }) : void 0,
|
|
14378
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14379
|
+
import_components47.SelectInput,
|
|
14345
14380
|
{
|
|
14346
14381
|
id,
|
|
14347
14382
|
multiple: true,
|
|
@@ -14358,12 +14393,12 @@ function MultiSelectSchema({
|
|
|
14358
14393
|
if (withinTrigger) {
|
|
14359
14394
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14360
14395
|
}
|
|
14361
|
-
return /* @__PURE__ */ (0,
|
|
14396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
14362
14397
|
},
|
|
14363
14398
|
onChange: broadcastModelChange
|
|
14364
14399
|
}
|
|
14365
14400
|
),
|
|
14366
|
-
/* @__PURE__ */ (0,
|
|
14401
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14367
14402
|
ControlFeedback_default,
|
|
14368
14403
|
{
|
|
14369
14404
|
id: `${id}-feedback`,
|
|
@@ -14388,17 +14423,17 @@ var getInitialModelIndices = (model, options) => {
|
|
|
14388
14423
|
};
|
|
14389
14424
|
|
|
14390
14425
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14391
|
-
var
|
|
14426
|
+
var import_components49 = require("@transferwise/components");
|
|
14392
14427
|
var import_icons4 = require("@transferwise/icons");
|
|
14393
|
-
var
|
|
14428
|
+
var import_react35 = require("react");
|
|
14394
14429
|
var import_react_intl24 = require("react-intl");
|
|
14395
14430
|
|
|
14396
14431
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14397
|
-
var
|
|
14398
|
-
var
|
|
14432
|
+
var import_components48 = require("@transferwise/components");
|
|
14433
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14399
14434
|
function ItemSummaryOption2({ item, onClick }) {
|
|
14400
|
-
return /* @__PURE__ */ (0,
|
|
14401
|
-
|
|
14435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14436
|
+
import_components48.NavigationOption,
|
|
14402
14437
|
{
|
|
14403
14438
|
media: getNavigationOptionMedia(item),
|
|
14404
14439
|
title: item.title,
|
|
@@ -14410,9 +14445,9 @@ function ItemSummaryOption2({ item, onClick }) {
|
|
|
14410
14445
|
}
|
|
14411
14446
|
|
|
14412
14447
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14413
|
-
var
|
|
14448
|
+
var import_react34 = require("react");
|
|
14414
14449
|
var import_react_intl23 = require("react-intl");
|
|
14415
|
-
var
|
|
14450
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14416
14451
|
function RepeatableSchemaStep({
|
|
14417
14452
|
type,
|
|
14418
14453
|
schema,
|
|
@@ -14423,7 +14458,7 @@ function RepeatableSchemaStep({
|
|
|
14423
14458
|
onAction
|
|
14424
14459
|
}) {
|
|
14425
14460
|
const { formatMessage } = (0, import_react_intl23.useIntl)();
|
|
14426
|
-
const [filename, setFilename] = (0,
|
|
14461
|
+
const [filename, setFilename] = (0, import_react34.useState)(void 0);
|
|
14427
14462
|
const step = {
|
|
14428
14463
|
layout: [
|
|
14429
14464
|
{
|
|
@@ -14460,7 +14495,7 @@ function RepeatableSchemaStep({
|
|
|
14460
14495
|
}
|
|
14461
14496
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14462
14497
|
};
|
|
14463
|
-
return /* @__PURE__ */ (0,
|
|
14498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14464
14499
|
DynamicFlowStep,
|
|
14465
14500
|
{
|
|
14466
14501
|
step,
|
|
@@ -14666,7 +14701,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14666
14701
|
|
|
14667
14702
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14668
14703
|
var import_classnames10 = __toESM(require_classnames());
|
|
14669
|
-
var
|
|
14704
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14670
14705
|
function RepeatableSchema({
|
|
14671
14706
|
schema,
|
|
14672
14707
|
model,
|
|
@@ -14676,9 +14711,9 @@ function RepeatableSchema({
|
|
|
14676
14711
|
onChange
|
|
14677
14712
|
}) {
|
|
14678
14713
|
var _a;
|
|
14679
|
-
const [openModalType, setOpenModalType] = (0,
|
|
14680
|
-
const [changed, setChanged] = (0,
|
|
14681
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
14714
|
+
const [openModalType, setOpenModalType] = (0, import_react35.useState)(null);
|
|
14715
|
+
const [changed, setChanged] = (0, import_react35.useState)(false);
|
|
14716
|
+
const [itemSummaries, setItemSummaries] = (0, import_react35.useState)(() => {
|
|
14682
14717
|
if (isObject2(model) && !isArray2(model)) {
|
|
14683
14718
|
throw new Error(
|
|
14684
14719
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14686,8 +14721,8 @@ function RepeatableSchema({
|
|
|
14686
14721
|
}
|
|
14687
14722
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14688
14723
|
});
|
|
14689
|
-
const [editableItem, setEditableItem] = (0,
|
|
14690
|
-
const id = (0,
|
|
14724
|
+
const [editableItem, setEditableItem] = (0, import_react35.useState)({ item: null, model: null });
|
|
14725
|
+
const id = (0, import_react35.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14691
14726
|
const broadcastModelChange = (updatedItems) => {
|
|
14692
14727
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
14693
14728
|
onChange({
|
|
@@ -14743,9 +14778,9 @@ function RepeatableSchema({
|
|
|
14743
14778
|
const formGroupClasses = {
|
|
14744
14779
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14745
14780
|
};
|
|
14746
|
-
return /* @__PURE__ */ (0,
|
|
14747
|
-
schema.title && /* @__PURE__ */ (0,
|
|
14748
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
14781
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { id, className: (0, import_classnames10.default)(formGroupClasses), children: [
|
|
14782
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components49.Header, { title: schema.title }),
|
|
14783
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14749
14784
|
ItemSummaryOption2,
|
|
14750
14785
|
{
|
|
14751
14786
|
item: itemSummary,
|
|
@@ -14753,21 +14788,21 @@ function RepeatableSchema({
|
|
|
14753
14788
|
},
|
|
14754
14789
|
JSON.stringify(itemSummary)
|
|
14755
14790
|
)),
|
|
14756
|
-
/* @__PURE__ */ (0,
|
|
14757
|
-
|
|
14791
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14792
|
+
import_components49.NavigationOption,
|
|
14758
14793
|
{
|
|
14759
|
-
media: /* @__PURE__ */ (0,
|
|
14794
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_icons4.Plus, {}),
|
|
14760
14795
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14761
14796
|
showMediaAtAllSizes: true,
|
|
14762
14797
|
onClick: onAddItem
|
|
14763
14798
|
}
|
|
14764
14799
|
),
|
|
14765
|
-
/* @__PURE__ */ (0,
|
|
14766
|
-
|
|
14800
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14801
|
+
import_components49.Modal,
|
|
14767
14802
|
{
|
|
14768
14803
|
open: openModalType !== null,
|
|
14769
14804
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14770
|
-
body: /* @__PURE__ */ (0,
|
|
14805
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14771
14806
|
RepeatableSchemaStep_default,
|
|
14772
14807
|
{
|
|
14773
14808
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14782,7 +14817,7 @@ function RepeatableSchema({
|
|
|
14782
14817
|
onClose: onCancelEdit
|
|
14783
14818
|
}
|
|
14784
14819
|
),
|
|
14785
|
-
/* @__PURE__ */ (0,
|
|
14820
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14786
14821
|
ControlFeedback_default,
|
|
14787
14822
|
{
|
|
14788
14823
|
id: `${id}-feedback`,
|
|
@@ -14824,17 +14859,17 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14824
14859
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14825
14860
|
|
|
14826
14861
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14827
|
-
var
|
|
14862
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14828
14863
|
function ArrayListSchema(props) {
|
|
14829
14864
|
const { schema } = props;
|
|
14830
14865
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14831
|
-
return /* @__PURE__ */ (0,
|
|
14866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14832
14867
|
}
|
|
14833
14868
|
if (isMultiSelectConstSchema(schema)) {
|
|
14834
|
-
return /* @__PURE__ */ (0,
|
|
14869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14835
14870
|
}
|
|
14836
14871
|
if (isListArraySchema(schema)) {
|
|
14837
|
-
return /* @__PURE__ */ (0,
|
|
14872
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14838
14873
|
}
|
|
14839
14874
|
throw new Error("Invalid array list schema");
|
|
14840
14875
|
}
|
|
@@ -14845,11 +14880,11 @@ ArrayListSchema.defaultProps = {
|
|
|
14845
14880
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14846
14881
|
|
|
14847
14882
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14848
|
-
var
|
|
14883
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14849
14884
|
var ArraySchema = (props) => {
|
|
14850
14885
|
const { schema } = props;
|
|
14851
14886
|
if (isListArraySchema(schema)) {
|
|
14852
|
-
return /* @__PURE__ */ (0,
|
|
14887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
14853
14888
|
}
|
|
14854
14889
|
throw new Error("Not implemented");
|
|
14855
14890
|
};
|
|
@@ -14859,17 +14894,17 @@ ArraySchema.defaultProps = {
|
|
|
14859
14894
|
var ArraySchema_default = ArraySchema;
|
|
14860
14895
|
|
|
14861
14896
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14862
|
-
var
|
|
14897
|
+
var import_components50 = require("@transferwise/components");
|
|
14863
14898
|
var import_classnames11 = __toESM(require_classnames());
|
|
14864
|
-
var
|
|
14865
|
-
var
|
|
14899
|
+
var import_react36 = require("react");
|
|
14900
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
14866
14901
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14867
14902
|
"col-xs-12": true,
|
|
14868
14903
|
"col-sm-6": width === "md",
|
|
14869
14904
|
"col-sm-4": width === "sm"
|
|
14870
14905
|
});
|
|
14871
14906
|
function ObjectSchema(props) {
|
|
14872
|
-
const [model, setModel] = (0,
|
|
14907
|
+
const [model, setModel] = (0, import_react36.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14873
14908
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14874
14909
|
if (onChangeProps.model !== null) {
|
|
14875
14910
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14880,7 +14915,7 @@ function ObjectSchema(props) {
|
|
|
14880
14915
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
14881
14916
|
};
|
|
14882
14917
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
14883
|
-
(0,
|
|
14918
|
+
(0, import_react36.useEffect)(() => {
|
|
14884
14919
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
14885
14920
|
setModel(newModel);
|
|
14886
14921
|
if (!isEqual(newModel, model)) {
|
|
@@ -14898,22 +14933,22 @@ function ObjectSchema(props) {
|
|
|
14898
14933
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
14899
14934
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14900
14935
|
const propsErrors = props.errors;
|
|
14901
|
-
return /* @__PURE__ */ (0,
|
|
14902
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
14903
|
-
/* @__PURE__ */ (0,
|
|
14904
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14905
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
14937
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
14938
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("fieldset", { children: [
|
|
14939
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components50.Header, { title: props.schema.title, as: "legend" }),
|
|
14940
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("p", { children: [
|
|
14906
14941
|
" ",
|
|
14907
14942
|
props.schema.description,
|
|
14908
14943
|
" "
|
|
14909
14944
|
] }),
|
|
14910
|
-
/* @__PURE__ */ (0,
|
|
14945
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14911
14946
|
"div",
|
|
14912
14947
|
{
|
|
14913
14948
|
className: (0, import_classnames11.default)(
|
|
14914
14949
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14915
14950
|
),
|
|
14916
|
-
children: /* @__PURE__ */ (0,
|
|
14951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14917
14952
|
GenericSchema_default,
|
|
14918
14953
|
{
|
|
14919
14954
|
schema: props.schema.properties[propertyName],
|
|
@@ -14939,21 +14974,21 @@ ObjectSchema.defaultProps = {
|
|
|
14939
14974
|
var ObjectSchema_default = ObjectSchema;
|
|
14940
14975
|
|
|
14941
14976
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14942
|
-
var
|
|
14977
|
+
var import_components53 = require("@transferwise/components");
|
|
14943
14978
|
var import_classnames12 = __toESM(require_classnames());
|
|
14944
|
-
var
|
|
14979
|
+
var import_react39 = require("react");
|
|
14945
14980
|
|
|
14946
14981
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14947
|
-
var
|
|
14982
|
+
var import_components51 = require("@transferwise/components");
|
|
14948
14983
|
var import_react_intl25 = require("react-intl");
|
|
14949
|
-
var
|
|
14984
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
14950
14985
|
function Help2(props) {
|
|
14951
14986
|
const intl = (0, import_react_intl25.useIntl)();
|
|
14952
|
-
return /* @__PURE__ */ (0,
|
|
14953
|
-
|
|
14987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14988
|
+
import_components51.Info,
|
|
14954
14989
|
{
|
|
14955
14990
|
className: "m-l-1",
|
|
14956
|
-
content: /* @__PURE__ */ (0,
|
|
14991
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components51.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
14957
14992
|
presentation: "POPOVER",
|
|
14958
14993
|
size: "sm",
|
|
14959
14994
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -14963,11 +14998,11 @@ function Help2(props) {
|
|
|
14963
14998
|
var Help_default2 = Help2;
|
|
14964
14999
|
|
|
14965
15000
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
14966
|
-
var
|
|
15001
|
+
var import_react38 = require("react");
|
|
14967
15002
|
|
|
14968
15003
|
// src/legacy/formControl/FormControl.tsx
|
|
14969
|
-
var
|
|
14970
|
-
var
|
|
15004
|
+
var import_components52 = require("@transferwise/components");
|
|
15005
|
+
var import_react37 = require("react");
|
|
14971
15006
|
|
|
14972
15007
|
// src/legacy/formControl/utils/value-utils.ts
|
|
14973
15008
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -15153,8 +15188,8 @@ var autocompleteTokenMap2 = {
|
|
|
15153
15188
|
};
|
|
15154
15189
|
|
|
15155
15190
|
// src/legacy/formControl/FormControl.tsx
|
|
15156
|
-
var
|
|
15157
|
-
var _FormControl = class _FormControl extends
|
|
15191
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
15192
|
+
var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
15158
15193
|
constructor(props) {
|
|
15159
15194
|
super(props);
|
|
15160
15195
|
this.getAutocompleteValue = ({ prefix = "", suffix = "" } = {}) => {
|
|
@@ -15241,8 +15276,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15241
15276
|
} = this.props;
|
|
15242
15277
|
switch (type) {
|
|
15243
15278
|
case FormControlType.RADIO:
|
|
15244
|
-
return /* @__PURE__ */ (0,
|
|
15245
|
-
|
|
15279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15280
|
+
import_components52.RadioGroup,
|
|
15246
15281
|
{
|
|
15247
15282
|
radios: options.map(this.mapOption),
|
|
15248
15283
|
name,
|
|
@@ -15251,8 +15286,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15251
15286
|
}
|
|
15252
15287
|
);
|
|
15253
15288
|
case FormControlType.CHECKBOX:
|
|
15254
|
-
return /* @__PURE__ */ (0,
|
|
15255
|
-
|
|
15289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15290
|
+
import_components52.Checkbox,
|
|
15256
15291
|
{
|
|
15257
15292
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
15258
15293
|
disabled,
|
|
@@ -15269,8 +15304,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15269
15304
|
const search = options.length >= 8;
|
|
15270
15305
|
const items = options;
|
|
15271
15306
|
const selected = this.getSelectedOption(options);
|
|
15272
|
-
return /* @__PURE__ */ (0,
|
|
15273
|
-
|
|
15307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "d-flex flex-column", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15308
|
+
import_components52.SelectInput,
|
|
15274
15309
|
{
|
|
15275
15310
|
id,
|
|
15276
15311
|
items: items.map((value2) => ({
|
|
@@ -15279,8 +15314,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15279
15314
|
disabled: value2.disabled
|
|
15280
15315
|
})),
|
|
15281
15316
|
value: selected != null ? selected : null,
|
|
15282
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0,
|
|
15283
|
-
|
|
15317
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15318
|
+
import_components52.SelectInputOptionContent,
|
|
15284
15319
|
{
|
|
15285
15320
|
title: label2,
|
|
15286
15321
|
note: withinTrigger ? note != null ? note : secondary : note,
|
|
@@ -15300,7 +15335,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15300
15335
|
onFilterChange: search && onSearchChange ? ({ query }) => {
|
|
15301
15336
|
onSearchChange(query);
|
|
15302
15337
|
} : void 0,
|
|
15303
|
-
onClear: () => {
|
|
15338
|
+
onClear: required ? void 0 : () => {
|
|
15304
15339
|
this.setState({ selectedOption: null });
|
|
15305
15340
|
this.props.onChange(null);
|
|
15306
15341
|
}
|
|
@@ -15308,13 +15343,13 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15308
15343
|
) });
|
|
15309
15344
|
}
|
|
15310
15345
|
case FormControlType.TAB:
|
|
15311
|
-
return /* @__PURE__ */ (0,
|
|
15312
|
-
|
|
15346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15347
|
+
import_components52.Tabs,
|
|
15313
15348
|
{
|
|
15314
15349
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15315
15350
|
tabs: options.map((option) => ({
|
|
15316
15351
|
title: option.label,
|
|
15317
|
-
content: /* @__PURE__ */ (0,
|
|
15352
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, {}),
|
|
15318
15353
|
disabled: option.disabled || false
|
|
15319
15354
|
})),
|
|
15320
15355
|
name: id,
|
|
@@ -15329,7 +15364,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15329
15364
|
);
|
|
15330
15365
|
case FormControlType.NUMERIC:
|
|
15331
15366
|
case FormControlType.NUMBER: {
|
|
15332
|
-
return /* @__PURE__ */ (0,
|
|
15367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15333
15368
|
"input",
|
|
15334
15369
|
{
|
|
15335
15370
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15363,7 +15398,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15363
15398
|
);
|
|
15364
15399
|
}
|
|
15365
15400
|
case FormControlType.HIDDEN:
|
|
15366
|
-
return /* @__PURE__ */ (0,
|
|
15401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15367
15402
|
"input",
|
|
15368
15403
|
{
|
|
15369
15404
|
type: "hidden",
|
|
@@ -15373,7 +15408,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15373
15408
|
}
|
|
15374
15409
|
);
|
|
15375
15410
|
case FormControlType.PASSWORD:
|
|
15376
|
-
return /* @__PURE__ */ (0,
|
|
15411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15377
15412
|
"input",
|
|
15378
15413
|
{
|
|
15379
15414
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15393,8 +15428,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15393
15428
|
);
|
|
15394
15429
|
case FormControlType.DATE:
|
|
15395
15430
|
case FormControlType.DATETIME:
|
|
15396
|
-
return /* @__PURE__ */ (0,
|
|
15397
|
-
|
|
15431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15432
|
+
import_components52.DateInput,
|
|
15398
15433
|
{
|
|
15399
15434
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
15400
15435
|
yearAutoComplete: this.getAutocompleteValue({ suffix: "-year" }),
|
|
@@ -15409,8 +15444,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15409
15444
|
}
|
|
15410
15445
|
);
|
|
15411
15446
|
case FormControlType.DATELOOKUP: {
|
|
15412
|
-
return /* @__PURE__ */ (0,
|
|
15413
|
-
|
|
15447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15448
|
+
import_components52.DateLookup,
|
|
15414
15449
|
{
|
|
15415
15450
|
value: getSafeDateStringValue(value),
|
|
15416
15451
|
min: minDate,
|
|
@@ -15427,8 +15462,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15427
15462
|
);
|
|
15428
15463
|
}
|
|
15429
15464
|
case FormControlType.TEL:
|
|
15430
|
-
return /* @__PURE__ */ (0,
|
|
15431
|
-
|
|
15465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15466
|
+
import_components52.PhoneNumberInput,
|
|
15432
15467
|
{
|
|
15433
15468
|
disabled,
|
|
15434
15469
|
countryCode,
|
|
@@ -15459,8 +15494,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15459
15494
|
autoComplete: this.getAutocompleteValue()
|
|
15460
15495
|
};
|
|
15461
15496
|
if (this.props.displayPattern) {
|
|
15462
|
-
return /* @__PURE__ */ (0,
|
|
15463
|
-
|
|
15497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15498
|
+
import_components52.TextareaWithDisplayFormat,
|
|
15464
15499
|
__spreadProps(__spreadValues({
|
|
15465
15500
|
displayPattern: this.props.displayPattern
|
|
15466
15501
|
}, textareaProps), {
|
|
@@ -15468,7 +15503,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15468
15503
|
})
|
|
15469
15504
|
);
|
|
15470
15505
|
}
|
|
15471
|
-
return /* @__PURE__ */ (0,
|
|
15506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15472
15507
|
"textarea",
|
|
15473
15508
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15474
15509
|
"aria-describedby": describedBy,
|
|
@@ -15481,8 +15516,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15481
15516
|
return (
|
|
15482
15517
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15483
15518
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
15484
|
-
/* @__PURE__ */ (0,
|
|
15485
|
-
|
|
15519
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15520
|
+
import_components52.Upload,
|
|
15486
15521
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15487
15522
|
usAccept: uploadProps.usAccept || "*",
|
|
15488
15523
|
usDisabled: uploadProps.usDisabled || disabled,
|
|
@@ -15519,8 +15554,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15519
15554
|
autoComplete: this.getAutocompleteValue()
|
|
15520
15555
|
};
|
|
15521
15556
|
if (this.props.displayPattern) {
|
|
15522
|
-
return /* @__PURE__ */ (0,
|
|
15523
|
-
|
|
15557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15558
|
+
import_components52.InputWithDisplayFormat,
|
|
15524
15559
|
__spreadProps(__spreadValues({
|
|
15525
15560
|
displayPattern: this.props.displayPattern
|
|
15526
15561
|
}, inputProps), {
|
|
@@ -15528,7 +15563,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15528
15563
|
})
|
|
15529
15564
|
);
|
|
15530
15565
|
}
|
|
15531
|
-
return /* @__PURE__ */ (0,
|
|
15566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15532
15567
|
"input",
|
|
15533
15568
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15534
15569
|
"aria-describedby": describedBy,
|
|
@@ -15577,14 +15612,17 @@ _FormControl.defaultProps = {
|
|
|
15577
15612
|
var FormControl = _FormControl;
|
|
15578
15613
|
|
|
15579
15614
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15580
|
-
var
|
|
15615
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15581
15616
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15582
15617
|
var getControlType = (schema) => {
|
|
15583
15618
|
if (isOneOfSchema2(schema)) {
|
|
15584
15619
|
if (schema.control === FormControlType.TAB && schema.oneOf.length > 3) {
|
|
15585
15620
|
return FormControlType.SELECT;
|
|
15586
15621
|
}
|
|
15587
|
-
|
|
15622
|
+
if (schema.control == null || !Object.values(FormControlType).includes(schema.control)) {
|
|
15623
|
+
return FormControlType.SELECT;
|
|
15624
|
+
}
|
|
15625
|
+
return schema.control;
|
|
15588
15626
|
}
|
|
15589
15627
|
if (isStringSchema2(schema)) {
|
|
15590
15628
|
return getStringSchemaControlType(schema);
|
|
@@ -15635,14 +15673,25 @@ var getOptions = (schema, controlType) => {
|
|
|
15635
15673
|
return null;
|
|
15636
15674
|
};
|
|
15637
15675
|
function SchemaFormControl(props) {
|
|
15638
|
-
const {
|
|
15676
|
+
const {
|
|
15677
|
+
id,
|
|
15678
|
+
schema,
|
|
15679
|
+
value,
|
|
15680
|
+
disabled,
|
|
15681
|
+
required,
|
|
15682
|
+
onChange,
|
|
15683
|
+
onFocus,
|
|
15684
|
+
onBlur,
|
|
15685
|
+
onSearchChange,
|
|
15686
|
+
describedBy
|
|
15687
|
+
} = props;
|
|
15639
15688
|
const log = useLogger();
|
|
15640
15689
|
const getSanitisedValue = (value2) => isNativeInput(schema.type) && (isNull3(value2) || isUndefined3(value2)) ? "" : value2;
|
|
15641
15690
|
const onModelChange = (value2, type, metadata) => {
|
|
15642
15691
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
15643
15692
|
};
|
|
15644
15693
|
const controlType = getControlType(schema);
|
|
15645
|
-
(0,
|
|
15694
|
+
(0, import_react38.useEffect)(() => {
|
|
15646
15695
|
warnIfInvalidSchema(schema, log, controlType);
|
|
15647
15696
|
}, [JSON.stringify(schema), log, controlType]);
|
|
15648
15697
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -15666,9 +15715,10 @@ function SchemaFormControl(props) {
|
|
|
15666
15715
|
displayPattern: schema.displayFormat,
|
|
15667
15716
|
// TODO: LOW avoid type assertion below
|
|
15668
15717
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
15669
|
-
describedBy
|
|
15718
|
+
describedBy,
|
|
15719
|
+
required
|
|
15670
15720
|
};
|
|
15671
|
-
return /* @__PURE__ */ (0,
|
|
15721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
15672
15722
|
}
|
|
15673
15723
|
SchemaFormControl.defaultProps = {
|
|
15674
15724
|
value: null,
|
|
@@ -15697,17 +15747,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15697
15747
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15698
15748
|
|
|
15699
15749
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15700
|
-
var
|
|
15750
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
15701
15751
|
function OneOfSchema(props) {
|
|
15702
15752
|
const onEvent = useEventDispatcher();
|
|
15703
|
-
const [changed, setChanged] = (0,
|
|
15704
|
-
const [focused, setFocused] = (0,
|
|
15705
|
-
const [blurred, setBlurred] = (0,
|
|
15706
|
-
const id = (0,
|
|
15707
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
15753
|
+
const [changed, setChanged] = (0, import_react39.useState)(false);
|
|
15754
|
+
const [focused, setFocused] = (0, import_react39.useState)(false);
|
|
15755
|
+
const [blurred, setBlurred] = (0, import_react39.useState)(false);
|
|
15756
|
+
const id = (0, import_react39.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
15757
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react39.useState)(
|
|
15708
15758
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15709
15759
|
);
|
|
15710
|
-
const [models, setModels] = (0,
|
|
15760
|
+
const [models, setModels] = (0, import_react39.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15711
15761
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15712
15762
|
const onSearchChange = (searchValue) => {
|
|
15713
15763
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15715,7 +15765,7 @@ function OneOfSchema(props) {
|
|
|
15715
15765
|
searchValueLength: searchValue.length
|
|
15716
15766
|
});
|
|
15717
15767
|
};
|
|
15718
|
-
(0,
|
|
15768
|
+
(0, import_react39.useEffect)(() => {
|
|
15719
15769
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
15720
15770
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
15721
15771
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -15773,12 +15823,12 @@ function OneOfSchema(props) {
|
|
|
15773
15823
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
15774
15824
|
};
|
|
15775
15825
|
const feedbackId = `${id}-feedback`;
|
|
15776
|
-
return /* @__PURE__ */ (0,
|
|
15777
|
-
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
15778
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
15779
|
-
/* @__PURE__ */ (0,
|
|
15826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
15827
|
+
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
15828
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
15829
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: (0, import_classnames12.default)(formGroupClasses), children: [
|
|
15780
15830
|
getTitleAndHelp(props.schema, id),
|
|
15781
|
-
/* @__PURE__ */ (0,
|
|
15831
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15782
15832
|
SchemaFormControl_default,
|
|
15783
15833
|
{
|
|
15784
15834
|
id,
|
|
@@ -15786,13 +15836,14 @@ function OneOfSchema(props) {
|
|
|
15786
15836
|
value: schemaIndex,
|
|
15787
15837
|
disabled: props.disabled,
|
|
15788
15838
|
describedBy: feedbackId,
|
|
15839
|
+
required: props.required,
|
|
15789
15840
|
onChange: onChooseNewSchema,
|
|
15790
15841
|
onFocus,
|
|
15791
15842
|
onBlur,
|
|
15792
15843
|
onSearchChange
|
|
15793
15844
|
}
|
|
15794
15845
|
),
|
|
15795
|
-
/* @__PURE__ */ (0,
|
|
15846
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15796
15847
|
ControlFeedback_default,
|
|
15797
15848
|
{
|
|
15798
15849
|
id: feedbackId,
|
|
@@ -15808,7 +15859,7 @@ function OneOfSchema(props) {
|
|
|
15808
15859
|
)
|
|
15809
15860
|
] })
|
|
15810
15861
|
] }),
|
|
15811
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
15862
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15812
15863
|
GenericSchema_default,
|
|
15813
15864
|
{
|
|
15814
15865
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15825,16 +15876,16 @@ function OneOfSchema(props) {
|
|
|
15825
15876
|
}
|
|
15826
15877
|
function getTitleAndHelp(schema, forId) {
|
|
15827
15878
|
var _a;
|
|
15828
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
15829
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
15879
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Help_default2, { help: schema.help }) : null;
|
|
15880
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
15830
15881
|
schema.title,
|
|
15831
15882
|
" ",
|
|
15832
15883
|
helpElement
|
|
15833
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
15884
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: helpElement ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("h4", { className: "m-b-2", children: [
|
|
15834
15885
|
schema.title,
|
|
15835
15886
|
" ",
|
|
15836
15887
|
helpElement
|
|
15837
|
-
] }) : /* @__PURE__ */ (0,
|
|
15888
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_components53.Header, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15838
15889
|
return schema.title ? titleElement : helpElement;
|
|
15839
15890
|
}
|
|
15840
15891
|
function getValidations(props, schemaIndex) {
|
|
@@ -15871,12 +15922,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15871
15922
|
|
|
15872
15923
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15873
15924
|
var import_classnames13 = __toESM(require_classnames());
|
|
15874
|
-
var
|
|
15925
|
+
var import_react41 = require("react");
|
|
15875
15926
|
|
|
15876
15927
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15877
|
-
var
|
|
15878
|
-
var
|
|
15879
|
-
var
|
|
15928
|
+
var import_components54 = require("@transferwise/components");
|
|
15929
|
+
var import_react40 = require("react");
|
|
15930
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
15880
15931
|
function UploadInputAdapter(props) {
|
|
15881
15932
|
const {
|
|
15882
15933
|
id,
|
|
@@ -15892,7 +15943,7 @@ function UploadInputAdapter(props) {
|
|
|
15892
15943
|
onCancel
|
|
15893
15944
|
} = props;
|
|
15894
15945
|
const onEvent = useEventDispatcher();
|
|
15895
|
-
const files = (0,
|
|
15946
|
+
const files = (0, import_react40.useMemo)(() => fileId ? [{ id: fileId, status: import_components54.Status.SUCCEEDED }] : [], [fileId]);
|
|
15896
15947
|
const uploadFile = (formData) => {
|
|
15897
15948
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
15898
15949
|
return httpClient(String(httpOptions.url), {
|
|
@@ -15909,8 +15960,8 @@ function UploadInputAdapter(props) {
|
|
|
15909
15960
|
return Promise.reject();
|
|
15910
15961
|
});
|
|
15911
15962
|
};
|
|
15912
|
-
return /* @__PURE__ */ (0,
|
|
15913
|
-
|
|
15963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15964
|
+
import_components54.UploadInput,
|
|
15914
15965
|
{
|
|
15915
15966
|
id,
|
|
15916
15967
|
fileInputName: httpOptions.fileInputName,
|
|
@@ -15929,16 +15980,16 @@ function UploadInputAdapter(props) {
|
|
|
15929
15980
|
}
|
|
15930
15981
|
|
|
15931
15982
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15932
|
-
var
|
|
15983
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
15933
15984
|
function PersistAsyncBlobSchema(props) {
|
|
15934
15985
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
15935
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
15936
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
15937
|
-
const [validations, setValidations] = (0,
|
|
15938
|
-
const [changed, setChanged] = (0,
|
|
15986
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react41.useState)({});
|
|
15987
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react41.useState)(null);
|
|
15988
|
+
const [validations, setValidations] = (0, import_react41.useState)([]);
|
|
15989
|
+
const [changed, setChanged] = (0, import_react41.useState)(false);
|
|
15939
15990
|
const httpClient = useHttpClient();
|
|
15940
15991
|
const onEvent = useEventDispatcher();
|
|
15941
|
-
(0,
|
|
15992
|
+
(0, import_react41.useEffect)(() => {
|
|
15942
15993
|
if (submitted) {
|
|
15943
15994
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
15944
15995
|
} else {
|
|
@@ -15975,8 +16026,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15975
16026
|
};
|
|
15976
16027
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
15977
16028
|
const feedbackId = `${id}-feedback`;
|
|
15978
|
-
return /* @__PURE__ */ (0,
|
|
15979
|
-
/* @__PURE__ */ (0,
|
|
16029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_classnames13.default)(formGroupClasses), children: [
|
|
16030
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
15980
16031
|
UploadInputAdapter,
|
|
15981
16032
|
__spreadValues({
|
|
15982
16033
|
id,
|
|
@@ -15993,7 +16044,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15993
16044
|
onCancel
|
|
15994
16045
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
15995
16046
|
) }),
|
|
15996
|
-
/* @__PURE__ */ (0,
|
|
16047
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
15997
16048
|
ControlFeedback_default,
|
|
15998
16049
|
{
|
|
15999
16050
|
id: feedbackId,
|
|
@@ -16018,17 +16069,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
16018
16069
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
16019
16070
|
|
|
16020
16071
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
16021
|
-
var
|
|
16072
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
16022
16073
|
function PersistAsyncSchema(props) {
|
|
16023
16074
|
const { schema } = props;
|
|
16024
16075
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
16025
16076
|
if (persistAsyncSchemaType === "blob") {
|
|
16026
|
-
return /* @__PURE__ */ (0,
|
|
16077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16027
16078
|
PersistAsyncBlobSchema_default,
|
|
16028
16079
|
__spreadValues({}, props)
|
|
16029
16080
|
);
|
|
16030
16081
|
}
|
|
16031
|
-
return /* @__PURE__ */ (0,
|
|
16082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
16032
16083
|
}
|
|
16033
16084
|
PersistAsyncSchema.defaultProps = {
|
|
16034
16085
|
required: false
|
|
@@ -16036,7 +16087,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
16036
16087
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
16037
16088
|
|
|
16038
16089
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16039
|
-
var
|
|
16090
|
+
var import_react42 = require("react");
|
|
16040
16091
|
|
|
16041
16092
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
16042
16093
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -16048,8 +16099,8 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
16048
16099
|
};
|
|
16049
16100
|
|
|
16050
16101
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
16051
|
-
var
|
|
16052
|
-
var
|
|
16102
|
+
var import_components55 = require("@transferwise/components");
|
|
16103
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
16053
16104
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
16054
16105
|
const { id, selection, setSelection } = props;
|
|
16055
16106
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -16060,14 +16111,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
16060
16111
|
const toggleSelection = () => {
|
|
16061
16112
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
16062
16113
|
};
|
|
16063
|
-
return /* @__PURE__ */ (0,
|
|
16114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components55.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
16064
16115
|
};
|
|
16065
16116
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
16066
16117
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
16067
16118
|
|
|
16068
16119
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
16069
|
-
var
|
|
16070
|
-
var
|
|
16120
|
+
var import_components56 = require("@transferwise/components");
|
|
16121
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
16071
16122
|
function PromotedOneOfRadioControl(props) {
|
|
16072
16123
|
var _a, _b;
|
|
16073
16124
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -16084,10 +16135,10 @@ function PromotedOneOfRadioControl(props) {
|
|
|
16084
16135
|
secondary: promotion.other.description
|
|
16085
16136
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
16086
16137
|
];
|
|
16087
|
-
return /* @__PURE__ */ (0,
|
|
16088
|
-
title && /* @__PURE__ */ (0,
|
|
16089
|
-
/* @__PURE__ */ (0,
|
|
16090
|
-
|
|
16138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "form-group", children: [
|
|
16139
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
16140
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16141
|
+
import_components56.RadioGroup,
|
|
16091
16142
|
{
|
|
16092
16143
|
name: "promoted-selection",
|
|
16093
16144
|
selectedValue: selection,
|
|
@@ -16104,16 +16155,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
16104
16155
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
16105
16156
|
|
|
16106
16157
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
16107
|
-
var
|
|
16158
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
16108
16159
|
function PromotedOneOfControl(props) {
|
|
16109
16160
|
const controlType = props.promotion.control || "radio";
|
|
16110
16161
|
switch (controlType) {
|
|
16111
16162
|
case "radio":
|
|
16112
|
-
return /* @__PURE__ */ (0,
|
|
16163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
16113
16164
|
case "checkbox":
|
|
16114
|
-
return /* @__PURE__ */ (0,
|
|
16165
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
16115
16166
|
default:
|
|
16116
|
-
return /* @__PURE__ */ (0,
|
|
16167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, {});
|
|
16117
16168
|
}
|
|
16118
16169
|
}
|
|
16119
16170
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -16123,20 +16174,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
16123
16174
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
16124
16175
|
|
|
16125
16176
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16126
|
-
var
|
|
16177
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16127
16178
|
var isPromoted = (schema) => schema.promoted === true;
|
|
16128
16179
|
var PromotedOneOfSchema = (props) => {
|
|
16129
16180
|
var _a;
|
|
16130
|
-
const [selection, setSelection] = (0,
|
|
16181
|
+
const [selection, setSelection] = (0, import_react42.useState)(
|
|
16131
16182
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
16132
16183
|
);
|
|
16133
16184
|
const promotedAlert = props.schema.alert;
|
|
16134
16185
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
16135
16186
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
16136
16187
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
16137
|
-
return /* @__PURE__ */ (0,
|
|
16138
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
16139
|
-
/* @__PURE__ */ (0,
|
|
16188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
16189
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
16190
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16140
16191
|
PromotedOneOfControl_default,
|
|
16141
16192
|
{
|
|
16142
16193
|
id: props.schema.$id,
|
|
@@ -16147,8 +16198,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16147
16198
|
setSelection
|
|
16148
16199
|
}
|
|
16149
16200
|
),
|
|
16150
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
16151
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
16201
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
16202
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
16152
16203
|
] });
|
|
16153
16204
|
};
|
|
16154
16205
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -16178,7 +16229,7 @@ function getOtherOneOf(schema) {
|
|
|
16178
16229
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
16179
16230
|
|
|
16180
16231
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16181
|
-
var
|
|
16232
|
+
var import_components57 = require("@transferwise/components");
|
|
16182
16233
|
var import_react_intl27 = require("react-intl");
|
|
16183
16234
|
|
|
16184
16235
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.ts
|
|
@@ -16197,12 +16248,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
16197
16248
|
});
|
|
16198
16249
|
|
|
16199
16250
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16200
|
-
var
|
|
16251
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
16201
16252
|
function ReadOnlySchema({ schema, model }) {
|
|
16202
16253
|
const { title = "" } = schema;
|
|
16203
16254
|
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
16204
16255
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
16205
|
-
return /* @__PURE__ */ (0,
|
|
16256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_components57.DefinitionList, { layout: import_components57.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
16206
16257
|
}
|
|
16207
16258
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
16208
16259
|
function getValueForSchema({
|
|
@@ -16235,7 +16286,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
16235
16286
|
function getValueFromOption(option) {
|
|
16236
16287
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
16237
16288
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
16238
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
16289
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
16239
16290
|
icon.avatar,
|
|
16240
16291
|
" ",
|
|
16241
16292
|
text
|
|
@@ -16243,22 +16294,22 @@ function getValueFromOption(option) {
|
|
|
16243
16294
|
}
|
|
16244
16295
|
|
|
16245
16296
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
16246
|
-
var
|
|
16247
|
-
var
|
|
16297
|
+
var import_react43 = require("react");
|
|
16298
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
16248
16299
|
function ValidationAsyncSchema(props) {
|
|
16249
16300
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
16250
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
16251
|
-
const previousRequestedModelReference = (0,
|
|
16252
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
16301
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react43.useState)(model);
|
|
16302
|
+
const previousRequestedModelReference = (0, import_react43.useRef)(null);
|
|
16303
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react43.useState)(
|
|
16253
16304
|
null
|
|
16254
16305
|
);
|
|
16255
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
16256
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
16257
|
-
const [abortController, setAbortController] = (0,
|
|
16306
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react43.useState)(null);
|
|
16307
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react43.useState)(false);
|
|
16308
|
+
const [abortController, setAbortController] = (0, import_react43.useState)(null);
|
|
16258
16309
|
const httpClient = useHttpClient();
|
|
16259
16310
|
const onEvent = useEventDispatcher();
|
|
16260
16311
|
const log = useLogger();
|
|
16261
|
-
(0,
|
|
16312
|
+
(0, import_react43.useEffect)(() => {
|
|
16262
16313
|
if (!schema.validationAsync.method) {
|
|
16263
16314
|
log.warning(
|
|
16264
16315
|
"Invalid schema or model",
|
|
@@ -16328,20 +16379,20 @@ function ValidationAsyncSchema(props) {
|
|
|
16328
16379
|
required,
|
|
16329
16380
|
schema
|
|
16330
16381
|
};
|
|
16331
|
-
return /* @__PURE__ */ (0,
|
|
16382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16332
16383
|
}
|
|
16333
16384
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
16334
16385
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16335
16386
|
|
|
16336
16387
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16337
|
-
var
|
|
16338
|
-
var
|
|
16388
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
16389
|
+
var import_react45 = require("react");
|
|
16339
16390
|
function GenericSchemaForm(props) {
|
|
16340
16391
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
16341
16392
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
16342
16393
|
const type = getSchemaType(schema);
|
|
16343
16394
|
const log = useLogger();
|
|
16344
|
-
(0,
|
|
16395
|
+
(0, import_react44.useEffect)(() => {
|
|
16345
16396
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
16346
16397
|
log.error(
|
|
16347
16398
|
"Invalid schema or model",
|
|
@@ -16351,29 +16402,29 @@ function GenericSchemaForm(props) {
|
|
|
16351
16402
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16352
16403
|
switch (type) {
|
|
16353
16404
|
case "readOnly":
|
|
16354
|
-
return /* @__PURE__ */ (0,
|
|
16405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16355
16406
|
case "persistAsync":
|
|
16356
|
-
return /* @__PURE__ */ (0,
|
|
16407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16357
16408
|
case "validationAsync":
|
|
16358
|
-
return /* @__PURE__ */ (0,
|
|
16409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16359
16410
|
case "basic": {
|
|
16360
16411
|
const basicTypeProps = __spreadValues({
|
|
16361
16412
|
infoMessage: null
|
|
16362
16413
|
}, schemaProps);
|
|
16363
|
-
return /* @__PURE__ */ (0,
|
|
16414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16364
16415
|
}
|
|
16365
16416
|
case "object":
|
|
16366
|
-
return /* @__PURE__ */ (0,
|
|
16417
|
+
return /* @__PURE__ */ (0, import_react45.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16367
16418
|
case "array":
|
|
16368
|
-
return /* @__PURE__ */ (0,
|
|
16419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16369
16420
|
case "promotedOneOf":
|
|
16370
|
-
return /* @__PURE__ */ (0,
|
|
16421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16371
16422
|
case "oneOf":
|
|
16372
|
-
return /* @__PURE__ */ (0,
|
|
16423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16373
16424
|
case "allOf":
|
|
16374
|
-
return /* @__PURE__ */ (0,
|
|
16425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16375
16426
|
}
|
|
16376
|
-
return /* @__PURE__ */ (0,
|
|
16427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, {});
|
|
16377
16428
|
}
|
|
16378
16429
|
var GenericSchema_default = GenericSchemaForm;
|
|
16379
16430
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16400,7 +16451,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16400
16451
|
};
|
|
16401
16452
|
|
|
16402
16453
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16403
|
-
var
|
|
16454
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
16404
16455
|
function DynamicForm({
|
|
16405
16456
|
component,
|
|
16406
16457
|
model = null,
|
|
@@ -16410,7 +16461,7 @@ function DynamicForm({
|
|
|
16410
16461
|
onPersistAsync
|
|
16411
16462
|
}) {
|
|
16412
16463
|
const formSchema = component.schema;
|
|
16413
|
-
return /* @__PURE__ */ (0,
|
|
16464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: getMargin2(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
16414
16465
|
GenericSchema_default,
|
|
16415
16466
|
{
|
|
16416
16467
|
schema: formSchema,
|
|
@@ -16427,64 +16478,64 @@ function DynamicForm({
|
|
|
16427
16478
|
var DynamicForm_default = DynamicForm;
|
|
16428
16479
|
|
|
16429
16480
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16430
|
-
var
|
|
16481
|
+
var import_components58 = require("@transferwise/components");
|
|
16431
16482
|
var import_classnames14 = __toESM(require_classnames());
|
|
16432
|
-
var
|
|
16483
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
16433
16484
|
var DynamicHeading = (props) => {
|
|
16434
16485
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16435
16486
|
const classes = (0, import_classnames14.default)(getTextAlignmentAndMargin2({ align, margin }));
|
|
16436
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
16487
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(DisplayHeading2, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(StandardHeading2, { size, text, classes });
|
|
16437
16488
|
};
|
|
16438
16489
|
var StandardHeading2 = ({ size, text, classes }) => {
|
|
16439
16490
|
switch (size) {
|
|
16440
16491
|
case "xs":
|
|
16441
|
-
return /* @__PURE__ */ (0,
|
|
16492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h5", { className: classes, children: text });
|
|
16442
16493
|
case "sm":
|
|
16443
|
-
return /* @__PURE__ */ (0,
|
|
16494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h4", { className: classes, children: text });
|
|
16444
16495
|
case "lg":
|
|
16445
|
-
return /* @__PURE__ */ (0,
|
|
16496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h2", { className: classes, children: text });
|
|
16446
16497
|
case "xl":
|
|
16447
|
-
return /* @__PURE__ */ (0,
|
|
16498
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h1", { className: classes, children: text });
|
|
16448
16499
|
case "md":
|
|
16449
16500
|
default:
|
|
16450
|
-
return /* @__PURE__ */ (0,
|
|
16501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h3", { className: classes, children: text });
|
|
16451
16502
|
}
|
|
16452
16503
|
};
|
|
16453
16504
|
var DisplayHeading2 = ({ size, text, classes }) => {
|
|
16454
16505
|
switch (size) {
|
|
16455
16506
|
case "xs":
|
|
16456
16507
|
case "sm":
|
|
16457
|
-
return /* @__PURE__ */ (0,
|
|
16508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-small", className: classes, children: text });
|
|
16458
16509
|
case "xl":
|
|
16459
16510
|
case "lg":
|
|
16460
|
-
return /* @__PURE__ */ (0,
|
|
16511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-large", className: classes, children: text });
|
|
16461
16512
|
case "md":
|
|
16462
16513
|
default:
|
|
16463
|
-
return /* @__PURE__ */ (0,
|
|
16514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-medium", className: classes, children: text });
|
|
16464
16515
|
}
|
|
16465
16516
|
};
|
|
16466
16517
|
var DynamicHeading_default = DynamicHeading;
|
|
16467
16518
|
|
|
16468
16519
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16469
|
-
var
|
|
16470
|
-
var
|
|
16520
|
+
var import_components59 = require("@transferwise/components");
|
|
16521
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
16471
16522
|
var DynamicMarkdown = ({ component }) => {
|
|
16472
16523
|
const { content, align, margin } = component;
|
|
16473
|
-
return /* @__PURE__ */ (0,
|
|
16524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: getTextAlignmentAndMargin2({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
16474
16525
|
};
|
|
16475
16526
|
var DynamicInfo = ({ component }) => {
|
|
16476
|
-
return /* @__PURE__ */ (0,
|
|
16527
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: getTextAlignmentAndMargin2(component), children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
16477
16528
|
};
|
|
16478
16529
|
|
|
16479
16530
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16480
|
-
var
|
|
16481
|
-
var
|
|
16482
|
-
var
|
|
16531
|
+
var import_components60 = require("@transferwise/components");
|
|
16532
|
+
var import_react46 = require("react");
|
|
16533
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
16483
16534
|
function DynamicImage({ component: image }) {
|
|
16484
16535
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
16485
16536
|
const httpClient = useHttpClient();
|
|
16486
|
-
const [imageSource, setImageSource] = (0,
|
|
16487
|
-
(0,
|
|
16537
|
+
const [imageSource, setImageSource] = (0, import_react46.useState)("");
|
|
16538
|
+
(0, import_react46.useEffect)(() => {
|
|
16488
16539
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
16489
16540
|
}, [url, httpClient]);
|
|
16490
16541
|
const imageProps = {
|
|
@@ -16496,7 +16547,7 @@ function DynamicImage({ component: image }) {
|
|
|
16496
16547
|
if (!imageSource) {
|
|
16497
16548
|
return null;
|
|
16498
16549
|
}
|
|
16499
|
-
return /* @__PURE__ */ (0,
|
|
16550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_components60.Image, __spreadValues({ className: `img-responsive ${getMargin2(margin || "md")}` }, imageProps)) });
|
|
16500
16551
|
}
|
|
16501
16552
|
var readImageBlobAsDataURL2 = (imageBlob) => (
|
|
16502
16553
|
// we can safely assume the type of reader.result is string
|
|
@@ -16532,48 +16583,48 @@ var getImageSource2 = async (httpClient, imageUrl) => {
|
|
|
16532
16583
|
var DynamicImage_default = DynamicImage;
|
|
16533
16584
|
|
|
16534
16585
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16535
|
-
var
|
|
16536
|
-
var
|
|
16586
|
+
var import_components61 = require("@transferwise/components");
|
|
16587
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
16537
16588
|
var doContext2 = ["positive", "neutral"];
|
|
16538
16589
|
var dontContext2 = ["warning", "negative"];
|
|
16539
16590
|
var DynamicInstructions = ({ component }) => {
|
|
16540
16591
|
const { items } = component;
|
|
16541
16592
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
16542
16593
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
16543
|
-
return /* @__PURE__ */ (0,
|
|
16544
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16545
|
-
/* @__PURE__ */ (0,
|
|
16594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16595
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components61.Header, { title: component.title }) : null,
|
|
16596
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components61.InstructionsList, { dos, donts })
|
|
16546
16597
|
] });
|
|
16547
16598
|
};
|
|
16548
16599
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16549
16600
|
|
|
16550
16601
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16551
|
-
var
|
|
16602
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
16552
16603
|
var getKey = (component) => JSON.stringify(component);
|
|
16553
16604
|
function DynamicLayout(props) {
|
|
16554
16605
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16555
16606
|
const renderComponent = (component) => {
|
|
16556
16607
|
switch (component.type) {
|
|
16557
16608
|
case "heading":
|
|
16558
|
-
return /* @__PURE__ */ (0,
|
|
16609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
16559
16610
|
case "paragraph":
|
|
16560
|
-
return /* @__PURE__ */ (0,
|
|
16611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
16561
16612
|
case "image":
|
|
16562
|
-
return /* @__PURE__ */ (0,
|
|
16613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
16563
16614
|
case "alert":
|
|
16564
|
-
return /* @__PURE__ */ (0,
|
|
16615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
16565
16616
|
case "review":
|
|
16566
|
-
return /* @__PURE__ */ (0,
|
|
16617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16567
16618
|
case "divider":
|
|
16568
|
-
return /* @__PURE__ */ (0,
|
|
16619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
16569
16620
|
case "info":
|
|
16570
|
-
return /* @__PURE__ */ (0,
|
|
16621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicInfo, { component }, getKey(component));
|
|
16571
16622
|
case "instructions":
|
|
16572
|
-
return /* @__PURE__ */ (0,
|
|
16623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
16573
16624
|
case "markdown":
|
|
16574
|
-
return /* @__PURE__ */ (0,
|
|
16625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
16575
16626
|
case "columns":
|
|
16576
|
-
return /* @__PURE__ */ (0,
|
|
16627
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16577
16628
|
DynamicColumns_default,
|
|
16578
16629
|
{
|
|
16579
16630
|
component,
|
|
@@ -16587,7 +16638,7 @@ function DynamicLayout(props) {
|
|
|
16587
16638
|
getKey(component)
|
|
16588
16639
|
);
|
|
16589
16640
|
case "form":
|
|
16590
|
-
return /* @__PURE__ */ (0,
|
|
16641
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16591
16642
|
DynamicForm_default,
|
|
16592
16643
|
{
|
|
16593
16644
|
component,
|
|
@@ -16600,9 +16651,9 @@ function DynamicLayout(props) {
|
|
|
16600
16651
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16601
16652
|
);
|
|
16602
16653
|
case "button":
|
|
16603
|
-
return /* @__PURE__ */ (0,
|
|
16654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16604
16655
|
case "box":
|
|
16605
|
-
return /* @__PURE__ */ (0,
|
|
16656
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16606
16657
|
DynamicBox_default,
|
|
16607
16658
|
{
|
|
16608
16659
|
component,
|
|
@@ -16616,18 +16667,18 @@ function DynamicLayout(props) {
|
|
|
16616
16667
|
getKey(component)
|
|
16617
16668
|
);
|
|
16618
16669
|
case "decision":
|
|
16619
|
-
return /* @__PURE__ */ (0,
|
|
16670
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16620
16671
|
case "external":
|
|
16621
|
-
return /* @__PURE__ */ (0,
|
|
16672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16622
16673
|
case "list":
|
|
16623
16674
|
case "status-list":
|
|
16624
|
-
return /* @__PURE__ */ (0,
|
|
16675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16625
16676
|
case "loading-indicator":
|
|
16626
|
-
return /* @__PURE__ */ (0,
|
|
16677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16627
16678
|
case "search":
|
|
16628
|
-
return /* @__PURE__ */ (0,
|
|
16679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16629
16680
|
case "modal":
|
|
16630
|
-
return /* @__PURE__ */ (0,
|
|
16681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16631
16682
|
DynamicModal_default,
|
|
16632
16683
|
{
|
|
16633
16684
|
component,
|
|
@@ -16641,22 +16692,22 @@ function DynamicLayout(props) {
|
|
|
16641
16692
|
getKey(component)
|
|
16642
16693
|
);
|
|
16643
16694
|
default:
|
|
16644
|
-
return /* @__PURE__ */ (0,
|
|
16695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", {}, getKey(component));
|
|
16645
16696
|
}
|
|
16646
16697
|
};
|
|
16647
16698
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16648
|
-
return /* @__PURE__ */ (0,
|
|
16699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_jsx_runtime105.Fragment, { children: components.map(renderComponent) });
|
|
16649
16700
|
}
|
|
16650
|
-
return /* @__PURE__ */ (0,
|
|
16701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16651
16702
|
}
|
|
16652
16703
|
var DynamicLayout_default = DynamicLayout;
|
|
16653
16704
|
|
|
16654
16705
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16655
|
-
var
|
|
16656
|
-
var
|
|
16706
|
+
var import_components62 = require("@transferwise/components");
|
|
16707
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
16657
16708
|
var DynamicStatusList = ({ component }) => {
|
|
16658
|
-
return /* @__PURE__ */ (0,
|
|
16659
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16710
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components62.Header, { title: component.title }) : null,
|
|
16660
16711
|
component.items.map(mapListItemToSummary)
|
|
16661
16712
|
] });
|
|
16662
16713
|
};
|
|
@@ -16665,8 +16716,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
16665
16716
|
key: `${title}/${description || ""}`,
|
|
16666
16717
|
title,
|
|
16667
16718
|
description
|
|
16668
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
16669
|
-
return /* @__PURE__ */ (0,
|
|
16719
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
16720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components62.Summary, __spreadValues({}, props));
|
|
16670
16721
|
};
|
|
16671
16722
|
var statusListMap = {
|
|
16672
16723
|
done: "done",
|
|
@@ -16682,12 +16733,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
|
|
|
16682
16733
|
var DynamicStatusList_default = DynamicStatusList;
|
|
16683
16734
|
|
|
16684
16735
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16685
|
-
var
|
|
16686
|
-
var
|
|
16736
|
+
var import_components63 = require("@transferwise/components");
|
|
16737
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
16687
16738
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16688
16739
|
const { margin = "md", size = "md" } = component;
|
|
16689
|
-
return /* @__PURE__ */ (0,
|
|
16690
|
-
|
|
16740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
16741
|
+
import_components63.Loader,
|
|
16691
16742
|
{
|
|
16692
16743
|
size,
|
|
16693
16744
|
classNames: {
|
|
@@ -16700,26 +16751,26 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
16700
16751
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
16701
16752
|
|
|
16702
16753
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16703
|
-
var
|
|
16754
|
+
var import_components65 = require("@transferwise/components");
|
|
16704
16755
|
var import_react_intl28 = require("react-intl");
|
|
16705
16756
|
|
|
16706
16757
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16707
|
-
var
|
|
16708
|
-
var
|
|
16758
|
+
var import_components64 = require("@transferwise/components");
|
|
16759
|
+
var import_react47 = require("react");
|
|
16709
16760
|
function useSnackBarIfAvailable2() {
|
|
16710
|
-
const context = (0,
|
|
16761
|
+
const context = (0, import_react47.useContext)(import_components64.SnackbarContext);
|
|
16711
16762
|
return context ? context.createSnackbar : noop3;
|
|
16712
16763
|
}
|
|
16713
16764
|
function noop3() {
|
|
16714
16765
|
}
|
|
16715
16766
|
|
|
16716
16767
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16717
|
-
var
|
|
16768
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
16718
16769
|
function DynamicParagraph({ component }) {
|
|
16719
|
-
return component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
16770
|
+
return component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(BasicDynamicParagraph, { component });
|
|
16720
16771
|
}
|
|
16721
16772
|
function BasicDynamicParagraph({ component }) {
|
|
16722
|
-
return /* @__PURE__ */ (0,
|
|
16773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("p", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16723
16774
|
" ",
|
|
16724
16775
|
component.text,
|
|
16725
16776
|
" "
|
|
@@ -16737,8 +16788,8 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16737
16788
|
align: component.align,
|
|
16738
16789
|
margin: "sm"
|
|
16739
16790
|
})} form-control`;
|
|
16740
|
-
return /* @__PURE__ */ (0,
|
|
16741
|
-
/* @__PURE__ */ (0,
|
|
16791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16792
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
16742
16793
|
"input",
|
|
16743
16794
|
{
|
|
16744
16795
|
type: "text",
|
|
@@ -16748,7 +16799,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16748
16799
|
style: { textOverflow: "ellipsis" }
|
|
16749
16800
|
}
|
|
16750
16801
|
),
|
|
16751
|
-
/* @__PURE__ */ (0,
|
|
16802
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_components65.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16752
16803
|
] });
|
|
16753
16804
|
}
|
|
16754
16805
|
function noop4() {
|
|
@@ -16756,8 +16807,8 @@ function noop4() {
|
|
|
16756
16807
|
var DynamicParagraph_default = DynamicParagraph;
|
|
16757
16808
|
|
|
16758
16809
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16759
|
-
var
|
|
16760
|
-
var
|
|
16810
|
+
var import_components66 = require("@transferwise/components");
|
|
16811
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
16761
16812
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16762
16813
|
key: String(index),
|
|
16763
16814
|
title: label,
|
|
@@ -16765,14 +16816,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16765
16816
|
}));
|
|
16766
16817
|
var getFieldValue2 = (value, help, orientation) => {
|
|
16767
16818
|
if (help) {
|
|
16768
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
16769
|
-
/* @__PURE__ */ (0,
|
|
16819
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
16820
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Help_default2, { help }),
|
|
16770
16821
|
" ",
|
|
16771
16822
|
value
|
|
16772
|
-
] }) : /* @__PURE__ */ (0,
|
|
16823
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
16773
16824
|
value,
|
|
16774
16825
|
" ",
|
|
16775
|
-
/* @__PURE__ */ (0,
|
|
16826
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Help_default2, { help })
|
|
16776
16827
|
] });
|
|
16777
16828
|
}
|
|
16778
16829
|
return value;
|
|
@@ -16797,25 +16848,25 @@ function DynamicReview(props) {
|
|
|
16797
16848
|
const orientation = getReviewLayout(review);
|
|
16798
16849
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
16799
16850
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
16800
|
-
return /* @__PURE__ */ (0,
|
|
16801
|
-
review.title && /* @__PURE__ */ (0,
|
|
16802
|
-
/* @__PURE__ */ (0,
|
|
16851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: margin, children: [
|
|
16852
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
16853
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
16803
16854
|
] });
|
|
16804
16855
|
}
|
|
16805
16856
|
var DynamicReview_default = DynamicReview;
|
|
16806
16857
|
|
|
16807
16858
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16808
|
-
var
|
|
16859
|
+
var import_react49 = require("react");
|
|
16809
16860
|
var import_icons5 = require("@transferwise/icons");
|
|
16810
16861
|
|
|
16811
16862
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16812
|
-
var
|
|
16813
|
-
var
|
|
16863
|
+
var import_components67 = require("@transferwise/components");
|
|
16864
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
16814
16865
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16815
|
-
return /* @__PURE__ */ (0,
|
|
16866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16816
16867
|
title,
|
|
16817
|
-
/* @__PURE__ */ (0,
|
|
16818
|
-
|
|
16868
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
16869
|
+
import_components67.Input,
|
|
16819
16870
|
{
|
|
16820
16871
|
type: "text",
|
|
16821
16872
|
value,
|
|
@@ -16828,15 +16879,15 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16828
16879
|
};
|
|
16829
16880
|
|
|
16830
16881
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16831
|
-
var
|
|
16882
|
+
var import_components68 = require("@transferwise/components");
|
|
16832
16883
|
var import_react_intl29 = require("react-intl");
|
|
16833
|
-
var
|
|
16884
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16834
16885
|
function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
16835
16886
|
if (results.length === 0) {
|
|
16836
|
-
return /* @__PURE__ */ (0,
|
|
16887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
16837
16888
|
}
|
|
16838
|
-
return /* @__PURE__ */ (0,
|
|
16839
|
-
|
|
16889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components68.NavigationOptionsList, { children: results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16890
|
+
import_components68.NavigationOption,
|
|
16840
16891
|
{
|
|
16841
16892
|
title: result.title,
|
|
16842
16893
|
content: result.description,
|
|
@@ -16850,10 +16901,10 @@ function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
|
16850
16901
|
}
|
|
16851
16902
|
function ErrorResult2({ onRetrySearch }) {
|
|
16852
16903
|
const intl = (0, import_react_intl29.useIntl)();
|
|
16853
|
-
return /* @__PURE__ */ (0,
|
|
16904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("p", { className: "m-t-2", children: [
|
|
16854
16905
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16855
16906
|
"\xA0",
|
|
16856
|
-
/* @__PURE__ */ (0,
|
|
16907
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16857
16908
|
"a",
|
|
16858
16909
|
{
|
|
16859
16910
|
href: "/",
|
|
@@ -16868,15 +16919,15 @@ function ErrorResult2({ onRetrySearch }) {
|
|
|
16868
16919
|
}
|
|
16869
16920
|
|
|
16870
16921
|
// src/legacy/layout/search/useSearch.tsx
|
|
16871
|
-
var
|
|
16922
|
+
var import_react48 = require("react");
|
|
16872
16923
|
var headers = { "Content-Type": "application/json" };
|
|
16873
16924
|
var useSearch = (defaultSearchConfig) => {
|
|
16874
|
-
const [state, setState] = (0,
|
|
16925
|
+
const [state, setState] = (0, import_react48.useState)({
|
|
16875
16926
|
status: "idle"
|
|
16876
16927
|
});
|
|
16877
|
-
const abortControllerRef = (0,
|
|
16928
|
+
const abortControllerRef = (0, import_react48.useRef)(null);
|
|
16878
16929
|
const httpClient = useHttpClient();
|
|
16879
|
-
const search = (0,
|
|
16930
|
+
const search = (0, import_react48.useCallback)(
|
|
16880
16931
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
16881
16932
|
var _a;
|
|
16882
16933
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -16937,16 +16988,16 @@ var addQueryParameter2 = (url, key, value) => {
|
|
|
16937
16988
|
};
|
|
16938
16989
|
|
|
16939
16990
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16940
|
-
var
|
|
16991
|
+
var import_components69 = require("@transferwise/components");
|
|
16941
16992
|
var import_classnames15 = __toESM(require_classnames());
|
|
16942
|
-
var
|
|
16993
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16943
16994
|
var DEBOUNCE_TIME2 = 400;
|
|
16944
16995
|
function DynamicSearch({ component, onAction }) {
|
|
16945
|
-
const [query, setQuery] = (0,
|
|
16996
|
+
const [query, setQuery] = (0, import_react49.useState)("");
|
|
16946
16997
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
16947
16998
|
const { status, results, search } = useSearch({ url, method, param });
|
|
16948
16999
|
const onEvent = useEventDispatcher();
|
|
16949
|
-
const debouncedSearch = (0,
|
|
17000
|
+
const debouncedSearch = (0, import_react49.useMemo)(() => debounce2(search, DEBOUNCE_TIME2), [search]);
|
|
16950
17001
|
const onSearchStart = () => {
|
|
16951
17002
|
onEvent("Dynamic Flow - Search Started", {});
|
|
16952
17003
|
};
|
|
@@ -16975,16 +17026,16 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16975
17026
|
void search(query);
|
|
16976
17027
|
};
|
|
16977
17028
|
if (control === "inline") {
|
|
16978
|
-
return /* @__PURE__ */ (0,
|
|
17029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_classnames15.default)(getMargin2(margin != null ? margin : "md"), "df-search-typeahead"), children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16979
17030
|
title,
|
|
16980
|
-
/* @__PURE__ */ (0,
|
|
16981
|
-
|
|
17031
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "m-t-1", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
17032
|
+
import_components69.Typeahead,
|
|
16982
17033
|
{
|
|
16983
17034
|
id: "typeahead-input-id",
|
|
16984
17035
|
name: "typeahead-input-name",
|
|
16985
17036
|
size: "md",
|
|
16986
17037
|
maxHeight: 100,
|
|
16987
|
-
footer: /* @__PURE__ */ (0,
|
|
17038
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16988
17039
|
TypeaheadFooter2,
|
|
16989
17040
|
{
|
|
16990
17041
|
state: status,
|
|
@@ -16995,7 +17046,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16995
17046
|
),
|
|
16996
17047
|
multiple: false,
|
|
16997
17048
|
clearable: false,
|
|
16998
|
-
addon: /* @__PURE__ */ (0,
|
|
17049
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_icons5.Search, { size: 24 }),
|
|
16999
17050
|
options: results.map(mapResultToTypeaheadOption2),
|
|
17000
17051
|
onChange: (values) => {
|
|
17001
17052
|
if (values.length > 0) {
|
|
@@ -17010,11 +17061,11 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17010
17061
|
) })
|
|
17011
17062
|
] }) });
|
|
17012
17063
|
}
|
|
17013
|
-
return /* @__PURE__ */ (0,
|
|
17014
|
-
/* @__PURE__ */ (0,
|
|
17015
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
17016
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
17017
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
17064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: getMargin2(margin != null ? margin : "md"), children: [
|
|
17065
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
17066
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
17067
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ErrorResult2, { onRetrySearch }),
|
|
17068
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(SearchResults2, { results, emptyMessage, onSelect: onResultSelected })
|
|
17018
17069
|
] });
|
|
17019
17070
|
}
|
|
17020
17071
|
function mapResultToTypeaheadOption2(result) {
|
|
@@ -17033,35 +17084,35 @@ function TypeaheadFooter2({
|
|
|
17033
17084
|
emptyMessage
|
|
17034
17085
|
}) {
|
|
17035
17086
|
if (state === "success" && results.length === 0) {
|
|
17036
|
-
return /* @__PURE__ */ (0,
|
|
17087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: emptyMessage });
|
|
17037
17088
|
}
|
|
17038
17089
|
if (state === "error" && results.length === 0) {
|
|
17039
|
-
return /* @__PURE__ */ (0,
|
|
17090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ErrorResult2, { onRetrySearch }) });
|
|
17040
17091
|
}
|
|
17041
17092
|
if (state === "loading" || results.length === 0) {
|
|
17042
|
-
return /* @__PURE__ */ (0,
|
|
17093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
17043
17094
|
}
|
|
17044
17095
|
return null;
|
|
17045
17096
|
}
|
|
17046
17097
|
var DynamicSearch_default = DynamicSearch;
|
|
17047
17098
|
|
|
17048
17099
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
17049
|
-
var
|
|
17050
|
-
var
|
|
17051
|
-
var
|
|
17100
|
+
var import_components70 = require("@transferwise/components");
|
|
17101
|
+
var import_react50 = require("react");
|
|
17102
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
17052
17103
|
function DynamicModal(props) {
|
|
17053
|
-
const [visible, isVisible] = (0,
|
|
17104
|
+
const [visible, isVisible] = (0, import_react50.useState)(false);
|
|
17054
17105
|
const { component, onAction } = props;
|
|
17055
17106
|
const { margin = "md" } = component;
|
|
17056
|
-
return /* @__PURE__ */ (0,
|
|
17057
|
-
/* @__PURE__ */ (0,
|
|
17058
|
-
/* @__PURE__ */ (0,
|
|
17059
|
-
|
|
17107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: getTextAlignmentAndMargin2({ margin }), children: [
|
|
17108
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components70.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
17109
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17110
|
+
import_components70.Modal,
|
|
17060
17111
|
{
|
|
17061
17112
|
scroll: "content",
|
|
17062
17113
|
open: visible,
|
|
17063
17114
|
size: "lg",
|
|
17064
|
-
body: /* @__PURE__ */ (0,
|
|
17115
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17065
17116
|
DynamicLayout_default,
|
|
17066
17117
|
__spreadProps(__spreadValues({}, props), {
|
|
17067
17118
|
components: component.content.components,
|
|
@@ -17079,7 +17130,7 @@ function DynamicModal(props) {
|
|
|
17079
17130
|
var DynamicModal_default = DynamicModal;
|
|
17080
17131
|
|
|
17081
17132
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
17082
|
-
var
|
|
17133
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
17083
17134
|
var isNullish3 = (value) => isNull3(value) || isUndefined3(value);
|
|
17084
17135
|
var getDefaultValue = (schema) => {
|
|
17085
17136
|
return schema.type === "boolean" && isNullish3(schema.default) ? false : schema.default;
|
|
@@ -17117,13 +17168,13 @@ var BasicTypeSchema = (props) => {
|
|
|
17117
17168
|
props.onBlur();
|
|
17118
17169
|
}
|
|
17119
17170
|
};
|
|
17120
|
-
const [model, setModel] = (0,
|
|
17121
|
-
const [lastModel, setLastModel] = (0,
|
|
17122
|
-
const [changed, setChanged] = (0,
|
|
17123
|
-
const [focused, setFocused] = (0,
|
|
17124
|
-
const [blurred, setBlurred] = (0,
|
|
17125
|
-
const [validations, setValidations] = (0,
|
|
17126
|
-
const id = (0,
|
|
17171
|
+
const [model, setModel] = (0, import_react51.useState)((_a = props.model) != null ? _a : null);
|
|
17172
|
+
const [lastModel, setLastModel] = (0, import_react51.useState)((_b = props.model) != null ? _b : null);
|
|
17173
|
+
const [changed, setChanged] = (0, import_react51.useState)(false);
|
|
17174
|
+
const [focused, setFocused] = (0, import_react51.useState)(false);
|
|
17175
|
+
const [blurred, setBlurred] = (0, import_react51.useState)(false);
|
|
17176
|
+
const [validations, setValidations] = (0, import_react51.useState)([]);
|
|
17177
|
+
const id = (0, import_react51.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
17127
17178
|
const onSchemaChange = () => {
|
|
17128
17179
|
const defaultValue = getDefaultValue(props.schema);
|
|
17129
17180
|
if (isNullish3(model) && !isNullish3(defaultValue)) {
|
|
@@ -17138,9 +17189,9 @@ var BasicTypeSchema = (props) => {
|
|
|
17138
17189
|
};
|
|
17139
17190
|
const isConst = props.schema.const;
|
|
17140
17191
|
const isHidden = props.schema.hidden || isConst;
|
|
17141
|
-
(0,
|
|
17142
|
-
(0,
|
|
17143
|
-
(0,
|
|
17192
|
+
(0, import_react51.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
17193
|
+
(0, import_react51.useEffect)(onSchemaChange, [props.schema]);
|
|
17194
|
+
(0, import_react51.useEffect)(() => {
|
|
17144
17195
|
var _a2;
|
|
17145
17196
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
17146
17197
|
if (newModel !== model) {
|
|
@@ -17155,15 +17206,15 @@ var BasicTypeSchema = (props) => {
|
|
|
17155
17206
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
17156
17207
|
const schemaHelp = props.schema.help;
|
|
17157
17208
|
const feedbackId = `${id}-feedback`;
|
|
17158
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
17159
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
17160
|
-
/* @__PURE__ */ (0,
|
|
17161
|
-
showLabel && /* @__PURE__ */ (0,
|
|
17162
|
-
/* @__PURE__ */ (0,
|
|
17163
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
17209
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
17210
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
17211
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: (0, import_classnames16.default)(formGroupClasses), children: [
|
|
17212
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
17213
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
17214
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Help_default2, { help: schemaHelp })
|
|
17164
17215
|
] }),
|
|
17165
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
17166
|
-
/* @__PURE__ */ (0,
|
|
17216
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Help_default2, { help: schemaHelp }),
|
|
17217
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17167
17218
|
SchemaFormControl_default,
|
|
17168
17219
|
{
|
|
17169
17220
|
id,
|
|
@@ -17176,7 +17227,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17176
17227
|
describedBy: feedbackId
|
|
17177
17228
|
}
|
|
17178
17229
|
),
|
|
17179
|
-
/* @__PURE__ */ (0,
|
|
17230
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17180
17231
|
ControlFeedback_default,
|
|
17181
17232
|
{
|
|
17182
17233
|
id: feedbackId,
|
|
@@ -17201,7 +17252,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
17201
17252
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17202
17253
|
|
|
17203
17254
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17204
|
-
var
|
|
17255
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
17205
17256
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17206
17257
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17207
17258
|
var _a;
|
|
@@ -17219,12 +17270,12 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17219
17270
|
const intl = (0, import_react_intl30.useIntl)();
|
|
17220
17271
|
const httpClient = useHttpClient();
|
|
17221
17272
|
const onEvent = useEventDispatcher();
|
|
17222
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
17273
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react52.useState)(null);
|
|
17223
17274
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17224
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
17225
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
17226
|
-
const [abortController, setAbortController] = (0,
|
|
17227
|
-
(0,
|
|
17275
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react52.useState)(null);
|
|
17276
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react52.useState)(false);
|
|
17277
|
+
const [abortController, setAbortController] = (0, import_react52.useState)(null);
|
|
17278
|
+
(0, import_react52.useEffect)(() => {
|
|
17228
17279
|
if (controlTypesWithPersistOnChange.has(
|
|
17229
17280
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
17230
17281
|
getControlType(schema.persistAsync.schema)
|
|
@@ -17291,7 +17342,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17291
17342
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17292
17343
|
}
|
|
17293
17344
|
};
|
|
17294
|
-
return /* @__PURE__ */ (0,
|
|
17345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17295
17346
|
BasicTypeSchema_default,
|
|
17296
17347
|
{
|
|
17297
17348
|
required,
|
|
@@ -17312,7 +17363,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17312
17363
|
|
|
17313
17364
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17314
17365
|
var usePersistAsync = (persistAsync) => {
|
|
17315
|
-
const [abortController, setAbortController] = (0,
|
|
17366
|
+
const [abortController, setAbortController] = (0, import_react53.useState)(null);
|
|
17316
17367
|
const httpClient = useHttpClient();
|
|
17317
17368
|
const intl = (0, import_react_intl31.useIntl)();
|
|
17318
17369
|
const { schema } = persistAsync;
|
|
@@ -17391,7 +17442,7 @@ function hasStringMessage(value) {
|
|
|
17391
17442
|
}
|
|
17392
17443
|
|
|
17393
17444
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
17394
|
-
var
|
|
17445
|
+
var import_react54 = require("react");
|
|
17395
17446
|
function usePolling({
|
|
17396
17447
|
asyncFn,
|
|
17397
17448
|
interval,
|
|
@@ -17400,9 +17451,9 @@ function usePolling({
|
|
|
17400
17451
|
onPollingResponse,
|
|
17401
17452
|
onFailure
|
|
17402
17453
|
}) {
|
|
17403
|
-
const onPollingResponseReference = (0,
|
|
17404
|
-
const onFailureReference = (0,
|
|
17405
|
-
const poll = (0,
|
|
17454
|
+
const onPollingResponseReference = (0, import_react54.useRef)(onPollingResponse);
|
|
17455
|
+
const onFailureReference = (0, import_react54.useRef)(onFailure);
|
|
17456
|
+
const poll = (0, import_react54.useMemo)(
|
|
17406
17457
|
() => createPollingClosure(
|
|
17407
17458
|
asyncFn,
|
|
17408
17459
|
maxAttempts,
|
|
@@ -17412,7 +17463,7 @@ function usePolling({
|
|
|
17412
17463
|
),
|
|
17413
17464
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
17414
17465
|
);
|
|
17415
|
-
(0,
|
|
17466
|
+
(0, import_react54.useEffect)(() => {
|
|
17416
17467
|
if (interval > 0) {
|
|
17417
17468
|
const intervalReference = setInterval(() => {
|
|
17418
17469
|
poll();
|
|
@@ -17420,7 +17471,7 @@ function usePolling({
|
|
|
17420
17471
|
return () => clearInterval(intervalReference);
|
|
17421
17472
|
}
|
|
17422
17473
|
}, [poll, interval]);
|
|
17423
|
-
(0,
|
|
17474
|
+
(0, import_react54.useEffect)(() => {
|
|
17424
17475
|
onPollingResponseReference.current = onPollingResponse;
|
|
17425
17476
|
onFailureReference.current = onFailure;
|
|
17426
17477
|
}, [onPollingResponse, onFailure]);
|
|
@@ -17451,20 +17502,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
17451
17502
|
}
|
|
17452
17503
|
|
|
17453
17504
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
17454
|
-
var
|
|
17505
|
+
var import_react55 = require("react");
|
|
17455
17506
|
var usePrevious = (value) => {
|
|
17456
|
-
const reference = (0,
|
|
17457
|
-
(0,
|
|
17507
|
+
const reference = (0, import_react55.useRef)();
|
|
17508
|
+
(0, import_react55.useEffect)(() => {
|
|
17458
17509
|
reference.current = value;
|
|
17459
17510
|
}, [value]);
|
|
17460
17511
|
return reference.current;
|
|
17461
17512
|
};
|
|
17462
17513
|
|
|
17463
17514
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
17464
|
-
var
|
|
17515
|
+
var import_react56 = require("react");
|
|
17465
17516
|
function useStepPolling(polling, onAction) {
|
|
17466
17517
|
const httpClient = useHttpClient();
|
|
17467
|
-
const asyncFn = (0,
|
|
17518
|
+
const asyncFn = (0, import_react56.useMemo)(() => {
|
|
17468
17519
|
if (polling) {
|
|
17469
17520
|
return () => httpClient(polling.url).then((response) => {
|
|
17470
17521
|
if (response.ok) {
|
|
@@ -17477,7 +17528,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17477
17528
|
}
|
|
17478
17529
|
return void 0;
|
|
17479
17530
|
}, [polling, httpClient]);
|
|
17480
|
-
const onPollingResponse = (0,
|
|
17531
|
+
const onPollingResponse = (0, import_react56.useCallback)(
|
|
17481
17532
|
(pollingResponse) => {
|
|
17482
17533
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
17483
17534
|
onAction(pollingResponse.action);
|
|
@@ -17493,7 +17544,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17493
17544
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
17494
17545
|
maxConsecutiveFails: 1,
|
|
17495
17546
|
onPollingResponse,
|
|
17496
|
-
onFailure: (0,
|
|
17547
|
+
onFailure: (0, import_react56.useCallback)(() => {
|
|
17497
17548
|
if (polling) {
|
|
17498
17549
|
onAction(polling.onError.action);
|
|
17499
17550
|
}
|
|
@@ -17502,7 +17553,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17502
17553
|
}
|
|
17503
17554
|
|
|
17504
17555
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17505
|
-
var
|
|
17556
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17506
17557
|
var getComponents = (step, options) => {
|
|
17507
17558
|
var _a;
|
|
17508
17559
|
if (isEmpty(step)) {
|
|
@@ -17525,7 +17576,7 @@ var LayoutStep = (props) => {
|
|
|
17525
17576
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17526
17577
|
};
|
|
17527
17578
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17528
|
-
return /* @__PURE__ */ (0,
|
|
17579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17529
17580
|
DynamicLayout_default,
|
|
17530
17581
|
{
|
|
17531
17582
|
components,
|
|
@@ -17541,10 +17592,10 @@ var LayoutStep = (props) => {
|
|
|
17541
17592
|
var LayoutStep_default = LayoutStep;
|
|
17542
17593
|
|
|
17543
17594
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17544
|
-
var
|
|
17595
|
+
var import_react61 = require("react");
|
|
17545
17596
|
|
|
17546
17597
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17547
|
-
var
|
|
17598
|
+
var import_react60 = require("react");
|
|
17548
17599
|
var import_react_intl36 = require("react-intl");
|
|
17549
17600
|
var import_react_webcam = __toESM(require("react-webcam"));
|
|
17550
17601
|
|
|
@@ -17609,49 +17660,49 @@ var CameraCapture_messages_default = (0, import_react_intl32.defineMessages)({
|
|
|
17609
17660
|
});
|
|
17610
17661
|
|
|
17611
17662
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17612
|
-
var
|
|
17663
|
+
var import_components71 = require("@transferwise/components");
|
|
17613
17664
|
var import_react_intl33 = require("react-intl");
|
|
17614
|
-
var
|
|
17615
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
17665
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
17666
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
17616
17667
|
var ReviewBottomBar = ({
|
|
17617
17668
|
onSubmit,
|
|
17618
17669
|
onRetry
|
|
17619
17670
|
}) => {
|
|
17620
17671
|
const intl = (0, import_react_intl33.useIntl)();
|
|
17621
|
-
return /* @__PURE__ */ (0,
|
|
17622
|
-
/* @__PURE__ */ (0,
|
|
17623
|
-
|
|
17672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
17673
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17674
|
+
import_components71.Button,
|
|
17624
17675
|
{
|
|
17625
17676
|
className: "m-b-1",
|
|
17626
17677
|
block: true,
|
|
17627
|
-
size:
|
|
17628
|
-
type:
|
|
17678
|
+
size: import_components71.Size.MEDIUM,
|
|
17679
|
+
type: import_components71.ControlType.ACCENT,
|
|
17629
17680
|
onClick: onSubmit,
|
|
17630
17681
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17631
17682
|
}
|
|
17632
17683
|
),
|
|
17633
|
-
/* @__PURE__ */ (0,
|
|
17634
|
-
|
|
17684
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17685
|
+
import_components71.Button,
|
|
17635
17686
|
{
|
|
17636
17687
|
className: "m-b-2",
|
|
17637
17688
|
block: true,
|
|
17638
|
-
size:
|
|
17639
|
-
type:
|
|
17640
|
-
priority:
|
|
17689
|
+
size: import_components71.Size.MEDIUM,
|
|
17690
|
+
type: import_components71.ControlType.ACCENT,
|
|
17691
|
+
priority: import_components71.Priority.SECONDARY,
|
|
17641
17692
|
onClick: onRetry,
|
|
17642
17693
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
17643
17694
|
}
|
|
17644
17695
|
)
|
|
17645
17696
|
] }) }) });
|
|
17646
17697
|
};
|
|
17647
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
17698
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17648
17699
|
"button",
|
|
17649
17700
|
{
|
|
17650
17701
|
type: "button",
|
|
17651
17702
|
className: "camera-capture-btn m-b-2",
|
|
17652
17703
|
"data-testid": "camera-capture-button",
|
|
17653
17704
|
onClick,
|
|
17654
|
-
children: /* @__PURE__ */ (0,
|
|
17705
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
17655
17706
|
}
|
|
17656
17707
|
);
|
|
17657
17708
|
|
|
@@ -17669,11 +17720,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl34.defineMess
|
|
|
17669
17720
|
});
|
|
17670
17721
|
|
|
17671
17722
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17672
|
-
var
|
|
17723
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
17673
17724
|
function OrientationLockOverlay() {
|
|
17674
17725
|
const intl = (0, import_react_intl35.useIntl)();
|
|
17675
|
-
return /* @__PURE__ */ (0,
|
|
17676
|
-
/* @__PURE__ */ (0,
|
|
17726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
17727
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17677
17728
|
"img",
|
|
17678
17729
|
{
|
|
17679
17730
|
className: "m-b-3",
|
|
@@ -17683,25 +17734,25 @@ function OrientationLockOverlay() {
|
|
|
17683
17734
|
alt: ""
|
|
17684
17735
|
}
|
|
17685
17736
|
),
|
|
17686
|
-
/* @__PURE__ */ (0,
|
|
17737
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17687
17738
|
] });
|
|
17688
17739
|
}
|
|
17689
17740
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17690
17741
|
|
|
17691
17742
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17692
|
-
var
|
|
17693
|
-
var
|
|
17743
|
+
var import_components72 = require("@transferwise/components");
|
|
17744
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
17694
17745
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17695
|
-
return /* @__PURE__ */ (0,
|
|
17696
|
-
/* @__PURE__ */ (0,
|
|
17697
|
-
/* @__PURE__ */ (0,
|
|
17698
|
-
onAction && actionButton && /* @__PURE__ */ (0,
|
|
17746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
17747
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
17748
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
|
|
17749
|
+
onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components72.Button, { block: true, onClick: onAction, children: actionButton })
|
|
17699
17750
|
] }) }) });
|
|
17700
17751
|
}
|
|
17701
17752
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
17702
17753
|
|
|
17703
17754
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17704
|
-
var
|
|
17755
|
+
var import_react57 = require("react");
|
|
17705
17756
|
var import_screenfull = __toESM(require_screenfull());
|
|
17706
17757
|
|
|
17707
17758
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
@@ -17780,16 +17831,16 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17780
17831
|
|
|
17781
17832
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17782
17833
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17783
|
-
const lockOrientation = (0,
|
|
17834
|
+
const lockOrientation = (0, import_react57.useCallback)(() => {
|
|
17784
17835
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17785
17836
|
window.screen.orientation.lock("portrait").then(() => trackCameraOrientationLocked(onEvent)).catch(noop5);
|
|
17786
17837
|
}
|
|
17787
17838
|
}, [onEvent]);
|
|
17788
|
-
const unlockOrientation = (0,
|
|
17839
|
+
const unlockOrientation = (0, import_react57.useCallback)(() => {
|
|
17789
17840
|
var _a, _b, _c;
|
|
17790
17841
|
return (_c = (_b = (_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) == null ? void 0 : _c.call(_b);
|
|
17791
17842
|
}, []);
|
|
17792
|
-
const enterFullScreen = (0,
|
|
17843
|
+
const enterFullScreen = (0, import_react57.useCallback)(() => {
|
|
17793
17844
|
setTimeout(() => {
|
|
17794
17845
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
17795
17846
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -17798,13 +17849,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17798
17849
|
}
|
|
17799
17850
|
}, 100);
|
|
17800
17851
|
}, [shouldLockOrientation, lockOrientation]);
|
|
17801
|
-
const exitFullScreen = (0,
|
|
17852
|
+
const exitFullScreen = (0, import_react57.useCallback)(() => {
|
|
17802
17853
|
if (import_screenfull.default.isFullscreen) {
|
|
17803
17854
|
import_screenfull.default.exit().catch(noop5);
|
|
17804
17855
|
}
|
|
17805
17856
|
unlockOrientation();
|
|
17806
17857
|
}, [unlockOrientation]);
|
|
17807
|
-
const handleOrientationChange = (0,
|
|
17858
|
+
const handleOrientationChange = (0, import_react57.useCallback)(
|
|
17808
17859
|
(event) => {
|
|
17809
17860
|
var _a, _b;
|
|
17810
17861
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -17815,7 +17866,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17815
17866
|
},
|
|
17816
17867
|
[onEvent]
|
|
17817
17868
|
);
|
|
17818
|
-
(0,
|
|
17869
|
+
(0, import_react57.useEffect)(() => {
|
|
17819
17870
|
var _a, _b;
|
|
17820
17871
|
if (shouldLockOrientation) {
|
|
17821
17872
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -17838,9 +17889,9 @@ var noop5 = () => {
|
|
|
17838
17889
|
};
|
|
17839
17890
|
|
|
17840
17891
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
17841
|
-
var
|
|
17892
|
+
var import_react58 = require("react");
|
|
17842
17893
|
var useVideoConstraints = (direction) => {
|
|
17843
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
17894
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react58.useState)();
|
|
17844
17895
|
const defaultVideoConstraints = {
|
|
17845
17896
|
facingMode: direction === "front" ? "user" : "environment",
|
|
17846
17897
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -17848,7 +17899,7 @@ var useVideoConstraints = (direction) => {
|
|
|
17848
17899
|
frameRate: 30,
|
|
17849
17900
|
aspectRatio: 16 / 9
|
|
17850
17901
|
};
|
|
17851
|
-
(0,
|
|
17902
|
+
(0, import_react58.useEffect)(() => {
|
|
17852
17903
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
17853
17904
|
}, [direction]);
|
|
17854
17905
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -17866,8 +17917,8 @@ var useVideoConstraints = (direction) => {
|
|
|
17866
17917
|
};
|
|
17867
17918
|
|
|
17868
17919
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
17869
|
-
var
|
|
17870
|
-
var
|
|
17920
|
+
var import_react59 = require("react");
|
|
17921
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
17871
17922
|
var captureButtonHeight = 92;
|
|
17872
17923
|
var reviewButtonsHeight = 120;
|
|
17873
17924
|
var imageHeight = 40;
|
|
@@ -17876,8 +17927,8 @@ var instructionsHeight = 48;
|
|
|
17876
17927
|
var reviewInstructionsHeight = 40;
|
|
17877
17928
|
var overlayMaxWidth = 800;
|
|
17878
17929
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
17879
|
-
const svgReference = (0,
|
|
17880
|
-
(0,
|
|
17930
|
+
const svgReference = (0, import_react59.useRef)(null);
|
|
17931
|
+
(0, import_react59.useEffect)(() => {
|
|
17881
17932
|
const listener = debounce2(() => {
|
|
17882
17933
|
var _a;
|
|
17883
17934
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -17889,18 +17940,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17889
17940
|
return () => window.removeEventListener("resize", listener);
|
|
17890
17941
|
});
|
|
17891
17942
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17892
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
17893
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
17894
|
-
title && /* @__PURE__ */ (0,
|
|
17895
|
-
instructions && /* @__PURE__ */ (0,
|
|
17943
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
17944
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
17945
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
17946
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
17896
17947
|
] });
|
|
17897
17948
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17898
17949
|
if (reviewInstructions) {
|
|
17899
17950
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17900
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17951
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17901
17952
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17902
17953
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17903
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17954
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_jsx_runtime120.Fragment, {});
|
|
17904
17955
|
}
|
|
17905
17956
|
}
|
|
17906
17957
|
const framePosition = {
|
|
@@ -17918,20 +17969,20 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17918
17969
|
width: "90%"
|
|
17919
17970
|
}
|
|
17920
17971
|
};
|
|
17921
|
-
return /* @__PURE__ */ (0,
|
|
17922
|
-
/* @__PURE__ */ (0,
|
|
17923
|
-
/* @__PURE__ */ (0,
|
|
17924
|
-
/* @__PURE__ */ (0,
|
|
17972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
17973
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("mask", { id: "mask", children: [
|
|
17974
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
17975
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
17925
17976
|
] }) }),
|
|
17926
|
-
overlay && /* @__PURE__ */ (0,
|
|
17927
|
-
outline && /* @__PURE__ */ (0,
|
|
17928
|
-
/* @__PURE__ */ (0,
|
|
17977
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
17978
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
17979
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
17929
17980
|
] });
|
|
17930
17981
|
}
|
|
17931
17982
|
var Overlay_default = Overlay;
|
|
17932
17983
|
|
|
17933
17984
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17934
|
-
var
|
|
17985
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
17935
17986
|
function CameraCapture({
|
|
17936
17987
|
direction = "back",
|
|
17937
17988
|
overlay = "",
|
|
@@ -17943,14 +17994,14 @@ function CameraCapture({
|
|
|
17943
17994
|
onCapture,
|
|
17944
17995
|
onEvent
|
|
17945
17996
|
}) {
|
|
17946
|
-
const [mode, setMode] = (0,
|
|
17947
|
-
const [cameraError, setCameraError] = (0,
|
|
17948
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
17949
|
-
const [ready, setReady] = (0,
|
|
17950
|
-
const [reviewImage, setReviewImage] = (0,
|
|
17951
|
-
const webcamReference = (0,
|
|
17997
|
+
const [mode, setMode] = (0, import_react60.useState)("CAPTURE" /* CAPTURE */);
|
|
17998
|
+
const [cameraError, setCameraError] = (0, import_react60.useState)();
|
|
17999
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react60.useState)(false);
|
|
18000
|
+
const [ready, setReady] = (0, import_react60.useState)(false);
|
|
18001
|
+
const [reviewImage, setReviewImage] = (0, import_react60.useState)();
|
|
18002
|
+
const webcamReference = (0, import_react60.useRef)(null);
|
|
17952
18003
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
17953
|
-
const shouldLockOrientation = (0,
|
|
18004
|
+
const shouldLockOrientation = (0, import_react60.useMemo)(
|
|
17954
18005
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
17955
18006
|
[mode]
|
|
17956
18007
|
);
|
|
@@ -17959,7 +18010,7 @@ function CameraCapture({
|
|
|
17959
18010
|
onEvent
|
|
17960
18011
|
);
|
|
17961
18012
|
const intl = (0, import_react_intl36.useIntl)();
|
|
17962
|
-
const handleCapture = (0,
|
|
18013
|
+
const handleCapture = (0, import_react60.useCallback)(async () => {
|
|
17963
18014
|
var _a, _b, _c, _d, _e, _f;
|
|
17964
18015
|
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) {
|
|
17965
18016
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -17981,7 +18032,7 @@ function CameraCapture({
|
|
|
17981
18032
|
);
|
|
17982
18033
|
}
|
|
17983
18034
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
17984
|
-
const handleUserMediaError = (0,
|
|
18035
|
+
const handleUserMediaError = (0, import_react60.useCallback)(
|
|
17985
18036
|
(error) => {
|
|
17986
18037
|
setMode("ERROR" /* ERROR */);
|
|
17987
18038
|
if (error instanceof DOMException) {
|
|
@@ -18017,7 +18068,7 @@ function CameraCapture({
|
|
|
18017
18068
|
},
|
|
18018
18069
|
[intl, onEvent]
|
|
18019
18070
|
);
|
|
18020
|
-
const handleUserMedia = (0,
|
|
18071
|
+
const handleUserMedia = (0, import_react60.useCallback)(
|
|
18021
18072
|
(stream) => {
|
|
18022
18073
|
enterFullScreen();
|
|
18023
18074
|
setReady(true);
|
|
@@ -18034,13 +18085,13 @@ function CameraCapture({
|
|
|
18034
18085
|
setReviewImage(void 0);
|
|
18035
18086
|
};
|
|
18036
18087
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
18037
|
-
(0,
|
|
18088
|
+
(0, import_react60.useEffect)(() => {
|
|
18038
18089
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
18039
18090
|
exitFullScreen();
|
|
18040
18091
|
}
|
|
18041
18092
|
}, [mode, exitFullScreen]);
|
|
18042
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
18043
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
18093
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "camera-capture", children: [
|
|
18094
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18044
18095
|
import_react_webcam.default,
|
|
18045
18096
|
{
|
|
18046
18097
|
ref: webcamReference,
|
|
@@ -18051,7 +18102,7 @@ function CameraCapture({
|
|
|
18051
18102
|
onUserMedia: handleUserMedia
|
|
18052
18103
|
}
|
|
18053
18104
|
),
|
|
18054
|
-
/* @__PURE__ */ (0,
|
|
18105
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18055
18106
|
Overlay_default,
|
|
18056
18107
|
{
|
|
18057
18108
|
overlay,
|
|
@@ -18061,8 +18112,8 @@ function CameraCapture({
|
|
|
18061
18112
|
instructions
|
|
18062
18113
|
}
|
|
18063
18114
|
),
|
|
18064
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
18065
|
-
ready && /* @__PURE__ */ (0,
|
|
18115
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(OrientationLockOverlay_default, {}),
|
|
18116
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18066
18117
|
CaptureBottomBar,
|
|
18067
18118
|
{
|
|
18068
18119
|
onCapture: () => {
|
|
@@ -18071,9 +18122,9 @@ function CameraCapture({
|
|
|
18071
18122
|
}
|
|
18072
18123
|
)
|
|
18073
18124
|
] });
|
|
18074
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
18075
|
-
/* @__PURE__ */ (0,
|
|
18076
|
-
/* @__PURE__ */ (0,
|
|
18125
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "camera-capture", children: [
|
|
18126
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
18127
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18077
18128
|
Overlay_default,
|
|
18078
18129
|
{
|
|
18079
18130
|
overlay,
|
|
@@ -18083,18 +18134,18 @@ function CameraCapture({
|
|
|
18083
18134
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
18084
18135
|
}
|
|
18085
18136
|
),
|
|
18086
|
-
/* @__PURE__ */ (0,
|
|
18137
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
18087
18138
|
] });
|
|
18088
|
-
return /* @__PURE__ */ (0,
|
|
18139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("section", { children: [
|
|
18089
18140
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
18090
18141
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
18091
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0,
|
|
18142
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
18092
18143
|
] });
|
|
18093
18144
|
}
|
|
18094
18145
|
var CameraCapture_default = CameraCapture;
|
|
18095
18146
|
|
|
18096
18147
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
18097
|
-
var
|
|
18148
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
18098
18149
|
function blobToBase64(blob) {
|
|
18099
18150
|
return new Promise((resolve, _) => {
|
|
18100
18151
|
const reader = new FileReader();
|
|
@@ -18112,8 +18163,8 @@ function CameraStep(props) {
|
|
|
18112
18163
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
18113
18164
|
const { overlay, outline } = assets || {};
|
|
18114
18165
|
const { url: imageUrl } = image || {};
|
|
18115
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
18116
|
-
(0,
|
|
18166
|
+
const [captureClicked, setCaptureClicked] = (0, import_react61.useState)(false);
|
|
18167
|
+
(0, import_react61.useEffect)(() => {
|
|
18117
18168
|
if (captureClicked) {
|
|
18118
18169
|
onAction(action);
|
|
18119
18170
|
}
|
|
@@ -18132,7 +18183,7 @@ function CameraStep(props) {
|
|
|
18132
18183
|
});
|
|
18133
18184
|
}
|
|
18134
18185
|
};
|
|
18135
|
-
return /* @__PURE__ */ (0,
|
|
18186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18136
18187
|
CameraCapture_default,
|
|
18137
18188
|
{
|
|
18138
18189
|
overlay,
|
|
@@ -18182,12 +18233,12 @@ function getFirstAction(step) {
|
|
|
18182
18233
|
|
|
18183
18234
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18184
18235
|
var import_react_intl37 = require("react-intl");
|
|
18185
|
-
var
|
|
18236
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
18186
18237
|
var noop6 = () => {
|
|
18187
18238
|
};
|
|
18188
18239
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18189
18240
|
const { formatMessage } = (0, import_react_intl37.useIntl)();
|
|
18190
|
-
return /* @__PURE__ */ (0,
|
|
18241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
18191
18242
|
DynamicLayout_default,
|
|
18192
18243
|
{
|
|
18193
18244
|
components: [
|
|
@@ -18252,11 +18303,11 @@ function getOrigin2(url) {
|
|
|
18252
18303
|
}
|
|
18253
18304
|
|
|
18254
18305
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18255
|
-
var
|
|
18306
|
+
var import_components74 = require("@transferwise/components");
|
|
18256
18307
|
var import_icons6 = require("@transferwise/icons");
|
|
18257
|
-
var
|
|
18308
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
18258
18309
|
function BackButton2({ title, action, onAction }) {
|
|
18259
|
-
return /* @__PURE__ */ (0,
|
|
18310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
18260
18311
|
"a",
|
|
18261
18312
|
{
|
|
18262
18313
|
href: "/",
|
|
@@ -18267,8 +18318,8 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18267
18318
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18268
18319
|
},
|
|
18269
18320
|
children: [
|
|
18270
|
-
/* @__PURE__ */ (0,
|
|
18271
|
-
/* @__PURE__ */ (0,
|
|
18321
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "sr-only", children: title }),
|
|
18322
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components74.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_icons6.ArrowLeft, { size: "24" }) })
|
|
18272
18323
|
]
|
|
18273
18324
|
}
|
|
18274
18325
|
);
|
|
@@ -18276,7 +18327,7 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18276
18327
|
var BackButton_default2 = BackButton2;
|
|
18277
18328
|
|
|
18278
18329
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18279
|
-
var
|
|
18330
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
18280
18331
|
function DynamicFlowStep(props) {
|
|
18281
18332
|
var _a, _b, _c;
|
|
18282
18333
|
const { step, globalError, onAction } = props;
|
|
@@ -18285,28 +18336,28 @@ function DynamicFlowStep(props) {
|
|
|
18285
18336
|
const { requiresManualTrigger, dismissConfirmation } = useExternal2(externalUrl);
|
|
18286
18337
|
if (step === void 0) {
|
|
18287
18338
|
if (globalError) {
|
|
18288
|
-
return /* @__PURE__ */ (0,
|
|
18339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18289
18340
|
}
|
|
18290
18341
|
return null;
|
|
18291
18342
|
}
|
|
18292
18343
|
if (externalUrl && requiresManualTrigger) {
|
|
18293
|
-
return /* @__PURE__ */ (0,
|
|
18344
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18294
18345
|
}
|
|
18295
18346
|
if (isCameraStep(step)) {
|
|
18296
|
-
return /* @__PURE__ */ (0,
|
|
18347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18297
18348
|
}
|
|
18298
|
-
return /* @__PURE__ */ (0,
|
|
18299
|
-
backButton && /* @__PURE__ */ (0,
|
|
18300
|
-
globalError ? /* @__PURE__ */ (0,
|
|
18301
|
-
/* @__PURE__ */ (0,
|
|
18349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_jsx_runtime125.Fragment, { children: [
|
|
18350
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(BackButton_default2, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
18351
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
18352
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
18302
18353
|
] });
|
|
18303
18354
|
}
|
|
18304
18355
|
|
|
18305
18356
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
18306
|
-
var
|
|
18357
|
+
var import_react62 = require("react");
|
|
18307
18358
|
var DEBOUNCE_DELAY = 1e3;
|
|
18308
18359
|
function useDebouncedRefresh(fetchRefresh) {
|
|
18309
|
-
const map = (0,
|
|
18360
|
+
const map = (0, import_react62.useRef)(/* @__PURE__ */ new Map());
|
|
18310
18361
|
const retrieveOrCreate = (key) => {
|
|
18311
18362
|
if (map.current.has(key)) {
|
|
18312
18363
|
return map.current.get(key);
|
|
@@ -18338,12 +18389,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18338
18389
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18339
18390
|
|
|
18340
18391
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18341
|
-
var
|
|
18392
|
+
var import_react63 = require("react");
|
|
18342
18393
|
var useDynamicFlowState = (initialStep) => {
|
|
18343
18394
|
var _a, _b;
|
|
18344
|
-
const [formErrors, setFormErrors] = (0,
|
|
18345
|
-
const [globalError, setGlobalError] = (0,
|
|
18346
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
18395
|
+
const [formErrors, setFormErrors] = (0, import_react63.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
18396
|
+
const [globalError, setGlobalError] = (0, import_react63.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
18397
|
+
const [stepAndModels, setStepAndModels] = (0, import_react63.useState)({
|
|
18347
18398
|
step: initialStep || void 0,
|
|
18348
18399
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18349
18400
|
etag: void 0
|
|
@@ -18373,7 +18424,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
18373
18424
|
return updatedState;
|
|
18374
18425
|
});
|
|
18375
18426
|
};
|
|
18376
|
-
const modelIsValid = (0,
|
|
18427
|
+
const modelIsValid = (0, import_react63.useMemo)(
|
|
18377
18428
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
18378
18429
|
[models, step]
|
|
18379
18430
|
);
|
|
@@ -18445,19 +18496,19 @@ var getSchemaReference = (component) => {
|
|
|
18445
18496
|
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwnProperty.call(schema, "$ref");
|
|
18446
18497
|
|
|
18447
18498
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18448
|
-
var
|
|
18449
|
-
var
|
|
18450
|
-
var
|
|
18499
|
+
var import_components75 = require("@transferwise/components");
|
|
18500
|
+
var import_react64 = require("react");
|
|
18501
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
18451
18502
|
function useLoader(loaderConfig, initialState) {
|
|
18452
18503
|
const config = __spreadValues({
|
|
18453
|
-
size:
|
|
18504
|
+
size: import_components75.Size.EXTRA_LARGE,
|
|
18454
18505
|
initial: true,
|
|
18455
18506
|
submission: false
|
|
18456
18507
|
}, loaderConfig);
|
|
18457
|
-
const [loadingState, setLoadingState] = (0,
|
|
18508
|
+
const [loadingState, setLoadingState] = (0, import_react64.useState)(initialState);
|
|
18458
18509
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18459
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
18460
|
-
|
|
18510
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
18511
|
+
import_components75.Loader,
|
|
18461
18512
|
{
|
|
18462
18513
|
size: config.size,
|
|
18463
18514
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -18559,7 +18610,7 @@ var assertResponseIsValid2 = (response) => {
|
|
|
18559
18610
|
var isResponse2 = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
18560
18611
|
|
|
18561
18612
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18562
|
-
var
|
|
18613
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
18563
18614
|
var noop7 = () => {
|
|
18564
18615
|
};
|
|
18565
18616
|
var DynamicFlowComponent = ({
|
|
@@ -18587,7 +18638,7 @@ var DynamicFlowComponent = ({
|
|
|
18587
18638
|
setStepAndEtag,
|
|
18588
18639
|
setSchemaModel
|
|
18589
18640
|
} = useDynamicFlowState(initialStep);
|
|
18590
|
-
const [submitted, setSubmitted] = (0,
|
|
18641
|
+
const [submitted, setSubmitted] = (0, import_react65.useState)(false);
|
|
18591
18642
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18592
18643
|
loaderConfig,
|
|
18593
18644
|
initialStep ? "idle" : "initial"
|
|
@@ -18605,18 +18656,18 @@ var DynamicFlowComponent = ({
|
|
|
18605
18656
|
);
|
|
18606
18657
|
}
|
|
18607
18658
|
};
|
|
18608
|
-
const analyticsMetadata = (0,
|
|
18659
|
+
const analyticsMetadata = (0, import_react65.useMemo)(
|
|
18609
18660
|
() => {
|
|
18610
18661
|
var _a;
|
|
18611
18662
|
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 : {});
|
|
18612
18663
|
},
|
|
18613
18664
|
[flowId, step]
|
|
18614
18665
|
);
|
|
18615
|
-
const dispatchEvent = (0,
|
|
18666
|
+
const dispatchEvent = (0, import_react65.useMemo)(
|
|
18616
18667
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
18617
18668
|
[onEvent, analyticsMetadata]
|
|
18618
18669
|
);
|
|
18619
|
-
const dfHttpClient = (0,
|
|
18670
|
+
const dfHttpClient = (0, import_react65.useCallback)(
|
|
18620
18671
|
({
|
|
18621
18672
|
action,
|
|
18622
18673
|
data,
|
|
@@ -18667,17 +18718,17 @@ var DynamicFlowComponent = ({
|
|
|
18667
18718
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
18668
18719
|
};
|
|
18669
18720
|
const { debouncedRefresh, isDebouncing, cancelPendingRefreshes } = useDebouncedRefresh(performRefresh);
|
|
18670
|
-
const dispatchEventAndComplete = (0,
|
|
18721
|
+
const dispatchEventAndComplete = (0, import_react65.useCallback)(
|
|
18671
18722
|
(result) => {
|
|
18672
18723
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
18673
18724
|
onCompletion(result);
|
|
18674
18725
|
},
|
|
18675
18726
|
[onCompletion, dispatchEvent]
|
|
18676
18727
|
);
|
|
18677
|
-
(0,
|
|
18728
|
+
(0, import_react65.useEffect)(() => {
|
|
18678
18729
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
18679
18730
|
}, []);
|
|
18680
|
-
(0,
|
|
18731
|
+
(0, import_react65.useEffect)(() => {
|
|
18681
18732
|
if (!initialStep) {
|
|
18682
18733
|
const action = __spreadValues({
|
|
18683
18734
|
id: "#initial-step-request",
|
|
@@ -18797,7 +18848,7 @@ var DynamicFlowComponent = ({
|
|
|
18797
18848
|
await performAction(action);
|
|
18798
18849
|
}
|
|
18799
18850
|
};
|
|
18800
|
-
return /* @__PURE__ */ (0,
|
|
18851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(DynamicFlowProvider, { loading: isLoading || isDebouncing, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
18801
18852
|
DynamicFlowStep,
|
|
18802
18853
|
{
|
|
18803
18854
|
step,
|
|
@@ -18814,7 +18865,7 @@ var DynamicFlowComponent = ({
|
|
|
18814
18865
|
) }) }) }) }) });
|
|
18815
18866
|
};
|
|
18816
18867
|
function DynamicFlow(props) {
|
|
18817
|
-
return /* @__PURE__ */ (0,
|
|
18868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
18818
18869
|
}
|
|
18819
18870
|
var DynamicFlow_default = DynamicFlow;
|
|
18820
18871
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18831,19 +18882,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18831
18882
|
};
|
|
18832
18883
|
|
|
18833
18884
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18834
|
-
var
|
|
18885
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
18835
18886
|
function JsonSchemaForm(props) {
|
|
18836
18887
|
const schemaProps = __spreadValues({
|
|
18837
18888
|
model: null,
|
|
18838
18889
|
errors: null
|
|
18839
18890
|
}, props);
|
|
18840
18891
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18841
|
-
return /* @__PURE__ */ (0,
|
|
18892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
18842
18893
|
EventsContextProvider,
|
|
18843
18894
|
{
|
|
18844
18895
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18845
18896
|
onEvent,
|
|
18846
|
-
children: /* @__PURE__ */ (0,
|
|
18897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18847
18898
|
}
|
|
18848
18899
|
) });
|
|
18849
18900
|
}
|