@wise/dynamic-flow-client 2.6.1 → 2.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +742 -718
- package/build/main.min.js +1 -1
- package/build/types/common/errorBoundary/ErrorBoundaryAlert.d.ts +5 -0
- package/build/types/{dynamicFlow/DynamicFlowTypes.d.ts → dynamic-flow-types.d.ts} +34 -38
- package/build/types/index.d.ts +7 -7
- package/build/types/legacy/common/contexts/eventsContext/EventsContext.d.ts +14 -0
- package/build/types/legacy/common/contexts/featureContext/FeatureContext.d.ts +10 -0
- package/build/types/{common → legacy/common}/contexts/httpClientContext/HttpClientContext.d.ts +3 -3
- package/build/types/{common → legacy/common}/contexts/logContext/LogContext.d.ts +3 -5
- package/build/types/{common → legacy/common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +1 -1
- package/build/types/{common → legacy/common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +1 -1
- package/build/types/{common → legacy/common}/hooks/usePersistAsync/usePersistAsync.d.ts +1 -1
- package/build/types/{common → legacy/common}/hooks/useStepPolling/useStepPolling.d.ts +1 -1
- package/build/types/{common → legacy/common}/utils/api-utils.d.ts +0 -1
- package/build/types/{common → legacy/common}/utils/debounce.d.ts +2 -2
- package/build/types/{common → legacy/common}/utils/file-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/utils/misc-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/utils/model-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/utils/schema-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/utils/step-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/validators/models/model-utils.d.ts +1 -1
- package/build/types/{common → legacy/common}/validators/models/model-validators.d.ts +1 -1
- package/build/types/{common → legacy/common}/validators/schemas/schema-validators.d.ts +1 -1
- package/build/types/{common → legacy/common}/validators/validationFailures/validation-failures.d.ts +1 -1
- package/build/types/legacy/dynamicFlow/BackButton.d.ts +9 -0
- package/build/types/legacy/dynamicFlow/DynamicFlow.d.ts +3 -0
- package/build/types/legacy/dynamicFlow/DynamicFlowStep.d.ts +8 -0
- package/build/types/legacy/dynamicFlow/DynamicFlowTypes.d.ts +8 -0
- package/build/types/{dynamicFlow → legacy/dynamicFlow}/stories/fixtureHttpClient.d.ts +1 -1
- package/build/types/{dynamicFlow → legacy/dynamicFlow}/utils/index.d.ts +1 -1
- package/build/types/{dynamicFlow → legacy/dynamicFlow}/utils/responseParsers/response-parsers.d.ts +2 -2
- package/build/types/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
- package/build/types/{dynamicFlow → legacy/dynamicFlow}/utils/useDynamicFlowState.d.ts +1 -1
- package/build/types/{dynamicFlow → legacy/dynamicFlow}/utils/useLoader.d.ts +1 -1
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/JsonSchemaForm.d.ts +4 -4
- package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +13 -0
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +16 -0
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +1 -1
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.d.ts +3 -3
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.d.ts +2 -2
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/genericSchema/GenericSchema.d.ts +4 -4
- package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +15 -0
- package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +14 -0
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +15 -0
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +6 -6
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +6 -6
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +16 -0
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +5 -5
- package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +8 -0
- package/build/types/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +7 -0
- package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +5 -5
- package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +15 -0
- package/build/types/{layout → legacy/layout}/DynamicLayout.d.ts +3 -3
- package/build/types/legacy/layout/decision/DynamicDecision.d.ts +8 -0
- package/build/types/legacy/layout/form/DynamicForm.d.ts +7 -0
- package/build/types/legacy/layout/image/DynamicImage.d.ts +6 -0
- package/build/types/{layout → legacy/layout}/index.d.ts +1 -0
- package/build/types/legacy/layout/modal/DynamicModal.d.ts +7 -0
- package/build/types/legacy/layout/review/DynamicReview.d.ts +8 -0
- package/build/types/legacy/layout/search/DynamicSearch.d.ts +8 -0
- package/build/types/{layout → legacy/layout}/search/useSearch.d.ts +2 -2
- package/build/types/legacy/step/cameraStep/CameraStep.d.ts +7 -0
- package/build/types/legacy/step/cameraStep/cameraCapture/CameraCapture.d.ts +15 -0
- package/build/types/{step → legacy/step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +1 -1
- package/build/types/{step → legacy/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +1 -1
- package/build/types/{step → legacy/step}/cameraStep/cameraCapture/tracking/index.d.ts +2 -2
- package/build/types/{step → legacy/step}/layoutStep/utils/inline-reference-utils.d.ts +1 -1
- package/build/types/legacy/test-utils/DynamicFlowProviders.d.ts +9 -0
- package/build/types/legacy/test-utils/index.d.ts +4 -0
- package/build/types/legacy/test-utils/legacy-utils.d.ts +22 -0
- package/build/types/legacy/test-utils/log-utils.d.ts +9 -0
- package/build/types/revamp/DynamicFlowRevamp.d.ts +2 -2
- package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/BoxComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ParagraphComponent.d.ts +3 -3
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +6 -7
- package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +3 -3
- package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +4 -4
- package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +3 -3
- package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +4 -4
- package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +3 -3
- package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +3 -3
- package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +4 -4
- package/build/types/revamp/domain/mappers/mapSchemaToComponent.d.ts +3 -4
- package/build/types/revamp/domain/mappers/mapStepToComponents.d.ts +3 -3
- package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +5 -3
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +5 -3
- package/build/types/revamp/domain/mappers/schema/types.d.ts +6 -3
- package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +2 -2
- package/build/types/revamp/domain/types.d.ts +8 -8
- package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/buttonComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/types.d.ts +4 -4
- package/build/types/revamp/renderers/utils/mapping-utils.d.ts +2 -2
- package/build/types/revamp/step/Step.d.ts +3 -3
- package/build/types/revamp/step/utils/render-utils.d.ts +3 -3
- package/build/types/revamp/utils/findComponent.d.ts +1 -1
- package/build/types/revamp/utils/getSubmittableData.d.ts +2 -2
- package/build/types/revamp/utils/type-utils.d.ts +2 -2
- package/build/types/revamp/wise/renderers/AlertRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/BoxRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/ButtonRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/HeadingRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/ObjectRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/ParagraphRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/TextInputRenderer.d.ts +1 -1
- package/build/types/revamp/wise/renderers/utils/layout-utils.d.ts +1 -1
- package/build/types/test-utils/NeptuneProviders.d.ts +5 -0
- package/build/types/test-utils/rtl-utils.d.ts +2 -0
- package/package.json +11 -16
- package/build/types/common/contexts/eventsContext/EventsContext.d.ts +0 -15
- package/build/types/common/contexts/featureContext/FeatureContext.d.ts +0 -10
- package/build/types/dynamicFlow/BackButton.d.ts +0 -9
- package/build/types/dynamicFlow/DynamicFlow.d.ts +0 -3
- package/build/types/dynamicFlow/DynamicFlowStep.d.ts +0 -8
- package/build/types/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -5
- package/build/types/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -6
- package/build/types/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +0 -13
- package/build/types/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -16
- package/build/types/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +0 -15
- package/build/types/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +0 -14
- package/build/types/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -15
- package/build/types/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -16
- package/build/types/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -8
- package/build/types/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +0 -7
- package/build/types/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -15
- package/build/types/layout/decision/DynamicDecision.d.ts +0 -8
- package/build/types/layout/form/DynamicForm.d.ts +0 -7
- package/build/types/layout/image/DynamicImage.d.ts +0 -6
- package/build/types/layout/review/DynamicReview.d.ts +0 -8
- package/build/types/layout/search/DynamicSearch.d.ts +0 -8
- package/build/types/step/cameraStep/CameraStep.d.ts +0 -7
- package/build/types/step/cameraStep/cameraCapture/CameraCapture.d.ts +0 -15
- package/build/types/{dynamicFlow/utils → common}/errorBoundary/ErrorBoundary.d.ts +1 -1
- /package/build/types/{dynamicFlow/utils → common}/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/DateMode.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/FeatureName.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/FormControlType.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/MonthFormat.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/Size.d.ts +0 -0
- /package/build/types/{common → legacy/common}/constants/index.d.ts +0 -0
- /package/build/types/{common → legacy/common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
- /package/build/types/{common → legacy/common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
- /package/build/types/{common → legacy/common}/contexts/index.d.ts +0 -0
- /package/build/types/{common → legacy/common}/hooks/index.d.ts +0 -0
- /package/build/types/{common → legacy/common}/hooks/useExternal/useExternal.d.ts +0 -0
- /package/build/types/{common → legacy/common}/hooks/usePolling/usePolling.d.ts +0 -0
- /package/build/types/{common → legacy/common}/hooks/usePrevious/usePrevious.d.ts +0 -0
- /package/build/types/{common → legacy/common}/messages.d.ts +0 -0
- /package/build/types/{common → legacy/common}/utils/date-utils.d.ts +0 -0
- /package/build/types/{common → legacy/common}/utils/id-utils.d.ts +0 -0
- /package/build/types/{common → legacy/common}/utils/index.d.ts +0 -0
- /package/build/types/{common → legacy/common}/utils/is-equal.d.ts +0 -0
- /package/build/types/{common → legacy/common}/utils/mobile-utils.d.ts +0 -0
- /package/build/types/{common → legacy/common}/validators/index.d.ts +0 -0
- /package/build/types/{common → legacy/common}/validators/types/type-validators.d.ts +0 -0
- /package/build/types/{common → legacy/common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
- /package/build/types/{common → legacy/common}/validators/values/value-validators.d.ts +0 -0
- /package/build/types/{dynamicFlow → legacy/dynamicFlow}/index.d.ts +0 -0
- /package/build/types/{formControl → legacy/formControl}/FormControl.d.ts +0 -0
- /package/build/types/{formControl → legacy/formControl}/index.d.ts +0 -0
- /package/build/types/{formControl → legacy/formControl}/utils/getAutocompleteString.d.ts +0 -0
- /package/build/types/{formControl → legacy/formControl}/utils/index.d.ts +0 -0
- /package/build/types/{formControl → legacy/formControl}/utils/value-utils.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/genericSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/help/Help.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/help/Help.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/help/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/objectSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/oneOfSchema/utils.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
- /package/build/types/{jsonSchemaForm → legacy/jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/alert/DynamicAlert.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/box/DynamicBox.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/button/DynamicButton.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/button/utils.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/columns/DynamicColumns.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/divider/DynamicDivider.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/external/DynamicExternal.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/external/DynamicExternal.messages.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/heading/DynamicHeading.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/icon/DynamicIcon.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/icon/FlagIcon.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/icon/NamedIcon.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/instructions/DynamicInstructions.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/list/DynamicStatusList.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/markdown/DynamicMarkdown.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/paragraph/DynamicParagraph.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/search/SearchInput.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/search/SearchResults.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/utils/getNavigationOptionMedia.d.ts +0 -0
- /package/build/types/{layout → legacy/layout}/utils/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/components/bottomBar/BottomBar.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/hooks/useVideoConstraints.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/cameraStep/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
- /package/build/types/{step → legacy/step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
- /package/build/types/{step → legacy/step}/externalConfirmationStep/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/layoutStep/LayoutStep.d.ts +0 -0
- /package/build/types/{step → legacy/step}/layoutStep/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/layoutStep/utils/index.d.ts +0 -0
- /package/build/types/{step → legacy/step}/layoutStep/utils/layout-utils.d.ts +0 -0
package/build/main.js
CHANGED
|
@@ -55,7 +55,7 @@ var require_classnames = __commonJS({
|
|
|
55
55
|
"use strict";
|
|
56
56
|
var hasOwn = {}.hasOwnProperty;
|
|
57
57
|
var nativeCodeString = "[native code]";
|
|
58
|
-
function
|
|
58
|
+
function classNames8() {
|
|
59
59
|
var classes = [];
|
|
60
60
|
for (var i = 0; i < arguments.length; i++) {
|
|
61
61
|
var arg = arguments[i];
|
|
@@ -66,7 +66,7 @@ var require_classnames = __commonJS({
|
|
|
66
66
|
classes.push(arg);
|
|
67
67
|
} else if (Array.isArray(arg)) {
|
|
68
68
|
if (arg.length) {
|
|
69
|
-
var inner =
|
|
69
|
+
var inner = classNames8.apply(null, arg);
|
|
70
70
|
if (inner) {
|
|
71
71
|
classes.push(inner);
|
|
72
72
|
}
|
|
@@ -86,14 +86,14 @@ var require_classnames = __commonJS({
|
|
|
86
86
|
return classes.join(" ");
|
|
87
87
|
}
|
|
88
88
|
if (typeof module2 !== "undefined" && module2.exports) {
|
|
89
|
-
|
|
90
|
-
module2.exports =
|
|
89
|
+
classNames8.default = classNames8;
|
|
90
|
+
module2.exports = classNames8;
|
|
91
91
|
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
92
92
|
define("classnames", [], function() {
|
|
93
|
-
return
|
|
93
|
+
return classNames8;
|
|
94
94
|
});
|
|
95
95
|
} else {
|
|
96
|
-
window.classNames =
|
|
96
|
+
window.classNames = classNames8;
|
|
97
97
|
}
|
|
98
98
|
})();
|
|
99
99
|
}
|
|
@@ -707,7 +707,7 @@ __export(src_exports, {
|
|
|
707
707
|
});
|
|
708
708
|
module.exports = __toCommonJS(src_exports);
|
|
709
709
|
|
|
710
|
-
// src/step/layoutStep/utils/layout-utils.ts
|
|
710
|
+
// src/legacy/step/layoutStep/utils/layout-utils.ts
|
|
711
711
|
function convertStepToLayout(step, { displayStepTitle = true } = {}) {
|
|
712
712
|
if (step.layout) {
|
|
713
713
|
return addMissingTitleAndDescriptionToStep(step, displayStepTitle);
|
|
@@ -898,7 +898,7 @@ function addMissingTitleAndDescriptionToStep(step, displayStepTitle) {
|
|
|
898
898
|
];
|
|
899
899
|
}
|
|
900
900
|
|
|
901
|
-
// src/step/layoutStep/utils/inline-reference-utils.ts
|
|
901
|
+
// src/legacy/step/layoutStep/utils/inline-reference-utils.ts
|
|
902
902
|
function inlineReferences({
|
|
903
903
|
layout,
|
|
904
904
|
schemas,
|
|
@@ -922,10 +922,25 @@ function inlineReferences({
|
|
|
922
922
|
return inlineAction({ actionComponent: component, actions });
|
|
923
923
|
}
|
|
924
924
|
if (component.type === "box") {
|
|
925
|
-
return
|
|
925
|
+
return __spreadProps(__spreadValues({}, component), {
|
|
926
|
+
components: inlineReferences({ layout: component.components, schemas, actions, model })
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
if (component.type === "modal") {
|
|
930
|
+
return __spreadProps(__spreadValues({}, component), {
|
|
931
|
+
components: inlineReferences({
|
|
932
|
+
layout: component.content.components,
|
|
933
|
+
schemas,
|
|
934
|
+
actions,
|
|
935
|
+
model
|
|
936
|
+
})
|
|
937
|
+
});
|
|
926
938
|
}
|
|
927
939
|
if (component.type === "columns") {
|
|
928
|
-
return
|
|
940
|
+
return __spreadProps(__spreadValues({}, component), {
|
|
941
|
+
left: inlineReferences({ layout: component.left, schemas, actions, model }),
|
|
942
|
+
right: inlineReferences({ layout: component.right, schemas, actions, model })
|
|
943
|
+
});
|
|
929
944
|
}
|
|
930
945
|
return component;
|
|
931
946
|
});
|
|
@@ -958,11 +973,11 @@ function inlineDecisionActions({
|
|
|
958
973
|
actions
|
|
959
974
|
}) {
|
|
960
975
|
var _a;
|
|
961
|
-
const newOptions = (_a = decisionComponent == null ? void 0 : decisionComponent.options) == null ? void 0 : _a.map(
|
|
962
|
-
|
|
976
|
+
const newOptions = (_a = decisionComponent == null ? void 0 : decisionComponent.options) == null ? void 0 : _a.map(
|
|
977
|
+
(option) => option.action && isReference(option.action) ? __spreadProps(__spreadValues({}, option), {
|
|
963
978
|
action: getActionById(actions, option.action.$ref)
|
|
964
|
-
}) : option
|
|
965
|
-
|
|
979
|
+
}) : option
|
|
980
|
+
);
|
|
966
981
|
return __spreadProps(__spreadValues({}, decisionComponent), {
|
|
967
982
|
options: newOptions
|
|
968
983
|
});
|
|
@@ -978,27 +993,6 @@ function inlineAction({
|
|
|
978
993
|
}
|
|
979
994
|
return actionComponent;
|
|
980
995
|
}
|
|
981
|
-
function inlineBoxReferences({
|
|
982
|
-
boxComponent,
|
|
983
|
-
schemas,
|
|
984
|
-
actions,
|
|
985
|
-
model
|
|
986
|
-
}) {
|
|
987
|
-
return __spreadProps(__spreadValues({}, boxComponent), {
|
|
988
|
-
components: inlineReferences({ layout: boxComponent.components, schemas, actions, model })
|
|
989
|
-
});
|
|
990
|
-
}
|
|
991
|
-
function inlineColumnsReferences({
|
|
992
|
-
columnsComponent,
|
|
993
|
-
schemas,
|
|
994
|
-
actions,
|
|
995
|
-
model
|
|
996
|
-
}) {
|
|
997
|
-
return __spreadProps(__spreadValues({}, columnsComponent), {
|
|
998
|
-
left: inlineReferences({ layout: columnsComponent.left, schemas, actions, model }),
|
|
999
|
-
right: inlineReferences({ layout: columnsComponent.right, schemas, actions, model })
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
996
|
function getSchemaById(schemas, id) {
|
|
1003
997
|
const schema = schemas.find((schema2) => schema2.$id === id);
|
|
1004
998
|
if (!schema) {
|
|
@@ -1014,17 +1008,17 @@ function getActionById(actions, id) {
|
|
|
1014
1008
|
return action;
|
|
1015
1009
|
}
|
|
1016
1010
|
function isReference(block) {
|
|
1017
|
-
return Object.
|
|
1011
|
+
return Object.hasOwn(block, "$ref");
|
|
1018
1012
|
}
|
|
1019
1013
|
|
|
1020
|
-
// src/dynamicFlow/DynamicFlow.tsx
|
|
1021
|
-
var
|
|
1014
|
+
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
1015
|
+
var import_react44 = require("react");
|
|
1022
1016
|
var import_react_intl34 = require("react-intl");
|
|
1023
1017
|
|
|
1024
|
-
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
1018
|
+
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
1025
1019
|
var import_react2 = require("react");
|
|
1026
1020
|
|
|
1027
|
-
// src/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
1021
|
+
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
1028
1022
|
var import_react = require("react");
|
|
1029
1023
|
function usePendingPromiseCounter() {
|
|
1030
1024
|
const [count, setCount] = (0, import_react.useState)(0);
|
|
@@ -1041,7 +1035,7 @@ var delayUntilNextCycle = (fn) => setTimeout(() => fn(), 0);
|
|
|
1041
1035
|
var noop = () => {
|
|
1042
1036
|
};
|
|
1043
1037
|
|
|
1044
|
-
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
1038
|
+
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
1045
1039
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1046
1040
|
var defaultContextValue = {
|
|
1047
1041
|
loading: false,
|
|
@@ -1064,20 +1058,20 @@ var useDynamicFlow = () => {
|
|
|
1064
1058
|
return context || defaultContextValue;
|
|
1065
1059
|
};
|
|
1066
1060
|
|
|
1067
|
-
// src/common/contexts/eventsContext/EventsContext.tsx
|
|
1061
|
+
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
1068
1062
|
var import_react3 = require("react");
|
|
1069
1063
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
1070
1064
|
var EventsContext = (0, import_react3.createContext)({
|
|
1071
1065
|
triggerEvent: () => {
|
|
1072
1066
|
}
|
|
1073
1067
|
});
|
|
1074
|
-
|
|
1068
|
+
function EventsContextProvider({ metadata, children, onEvent }) {
|
|
1075
1069
|
const value = (0, import_react3.useMemo)(
|
|
1076
1070
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
1077
1071
|
[onEvent, metadata]
|
|
1078
1072
|
);
|
|
1079
1073
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(EventsContext.Provider, { value, children });
|
|
1080
|
-
}
|
|
1074
|
+
}
|
|
1081
1075
|
function useEventDispatcher() {
|
|
1082
1076
|
const { triggerEvent } = (0, import_react3.useContext)(EventsContext);
|
|
1083
1077
|
return triggerEvent;
|
|
@@ -1089,62 +1083,55 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
1089
1083
|
}
|
|
1090
1084
|
};
|
|
1091
1085
|
|
|
1092
|
-
// src/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
1086
|
+
// src/legacy/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
1093
1087
|
var import_react4 = require("react");
|
|
1094
1088
|
|
|
1095
|
-
// src/common/utils/api-utils.ts
|
|
1096
|
-
function isStatus2xx(status) {
|
|
1097
|
-
return status >= 200 && status < 300;
|
|
1098
|
-
}
|
|
1099
|
-
function isStatus422(status) {
|
|
1100
|
-
return status === 422;
|
|
1101
|
-
}
|
|
1102
|
-
function isRelativePath(url = "") {
|
|
1103
|
-
return ["https://", "http://", "data:"].some(
|
|
1104
|
-
(prefix) => url.slice(0, prefix.length) === prefix && url.length > prefix.length
|
|
1105
|
-
) === false;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
1089
|
// src/common/makeHttpClient/makeHttpClient.ts
|
|
1109
|
-
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1090
|
+
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
1091
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1092
|
+
(input, init) => {
|
|
1093
|
+
const resource = applyBaseUrl(input, baseUrl || "");
|
|
1094
|
+
const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
|
|
1095
|
+
return fetch(resource, __spreadProps(__spreadValues({}, init != null ? init : {}), { headers: headers2 }));
|
|
1096
|
+
}
|
|
1097
|
+
);
|
|
1098
|
+
var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
|
|
1117
1099
|
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
1118
1100
|
if (!initHeaders && !additionalHeaders) {
|
|
1119
1101
|
return {};
|
|
1120
1102
|
}
|
|
1121
1103
|
const headers2 = new Headers(initHeaders);
|
|
1122
|
-
for (const [key, value] of Object.entries(additionalHeaders
|
|
1104
|
+
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
1123
1105
|
headers2.set(key, value);
|
|
1124
1106
|
}
|
|
1125
1107
|
return headers2;
|
|
1126
1108
|
};
|
|
1109
|
+
function isRelativePath(url = "") {
|
|
1110
|
+
return !["https://", "http://", "data:"].some(
|
|
1111
|
+
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1112
|
+
);
|
|
1113
|
+
}
|
|
1127
1114
|
|
|
1128
|
-
// src/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
1115
|
+
// src/legacy/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
1129
1116
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1130
1117
|
var HttpClientContext = (0, import_react4.createContext)(void 0);
|
|
1131
|
-
|
|
1118
|
+
function HttpClientProvider({ httpClient, children }) {
|
|
1132
1119
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1120
|
+
}
|
|
1121
|
+
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
1135
1122
|
const httpClient = (0, import_react4.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
1136
1123
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1137
|
-
}
|
|
1124
|
+
}
|
|
1138
1125
|
var useHttpClient = () => {
|
|
1139
1126
|
const contextFetch = (0, import_react4.useContext)(HttpClientContext);
|
|
1140
|
-
return contextFetch
|
|
1127
|
+
return contextFetch != null ? contextFetch : fetch;
|
|
1141
1128
|
};
|
|
1142
1129
|
var useHasHttpClientProvider = () => {
|
|
1143
1130
|
const context = (0, import_react4.useContext)(HttpClientContext);
|
|
1144
|
-
return
|
|
1131
|
+
return Boolean(context);
|
|
1145
1132
|
};
|
|
1146
1133
|
|
|
1147
|
-
// src/common/contexts/logContext/LogContext.tsx
|
|
1134
|
+
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
1148
1135
|
var import_react5 = require("react");
|
|
1149
1136
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1150
1137
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
@@ -1157,7 +1144,7 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
1157
1144
|
}
|
|
1158
1145
|
};
|
|
1159
1146
|
var LogContext = (0, import_react5.createContext)(null);
|
|
1160
|
-
|
|
1147
|
+
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
1161
1148
|
const value = (0, import_react5.useMemo)(
|
|
1162
1149
|
() => ({
|
|
1163
1150
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
@@ -1169,7 +1156,7 @@ var LogProvider = ({ flowId, stepId, children, onLog }) => {
|
|
|
1169
1156
|
[onLog, flowId, stepId]
|
|
1170
1157
|
);
|
|
1171
1158
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LogContext.Provider, { value, children });
|
|
1172
|
-
}
|
|
1159
|
+
}
|
|
1173
1160
|
var useLogger = () => {
|
|
1174
1161
|
const logging = (0, import_react5.useContext)(LogContext);
|
|
1175
1162
|
if (logging == null) {
|
|
@@ -1180,19 +1167,32 @@ var useLogger = () => {
|
|
|
1180
1167
|
return logging;
|
|
1181
1168
|
};
|
|
1182
1169
|
|
|
1183
|
-
// src/common/contexts/featureContext/FeatureContext.tsx
|
|
1170
|
+
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
1184
1171
|
var import_react6 = require("react");
|
|
1185
1172
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1186
1173
|
var FeatureContext = (0, import_react6.createContext)([]);
|
|
1187
|
-
|
|
1174
|
+
function FeatureContextProvider({ features, children }) {
|
|
1188
1175
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FeatureContext.Provider, { value: features, children });
|
|
1189
|
-
}
|
|
1176
|
+
}
|
|
1190
1177
|
var useFeatureFlag = (featureName) => {
|
|
1191
1178
|
const features = (0, import_react6.useContext)(FeatureContext);
|
|
1192
1179
|
return features == null ? void 0 : features.find((feature) => feature.featureName === featureName);
|
|
1193
1180
|
};
|
|
1194
1181
|
|
|
1195
|
-
// src/common/
|
|
1182
|
+
// src/legacy/common/utils/api-utils.ts
|
|
1183
|
+
function isStatus2xx(status) {
|
|
1184
|
+
return status >= 200 && status < 300;
|
|
1185
|
+
}
|
|
1186
|
+
function isStatus422(status) {
|
|
1187
|
+
return status === 422;
|
|
1188
|
+
}
|
|
1189
|
+
function isRelativePath2(url = "") {
|
|
1190
|
+
return !["https://", "http://", "data:"].some(
|
|
1191
|
+
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// src/legacy/common/validators/types/type-validators.ts
|
|
1196
1196
|
var isString = (value) => typeof value === "string";
|
|
1197
1197
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
1198
1198
|
var isInteger = (value) => {
|
|
@@ -1204,10 +1204,10 @@ var isArray = (value) => Array.isArray(value);
|
|
|
1204
1204
|
var isNull = (value) => value === null;
|
|
1205
1205
|
var isUndefined = (value) => typeof value === "undefined";
|
|
1206
1206
|
|
|
1207
|
-
// src/common/validators/values/value-validators.ts
|
|
1207
|
+
// src/legacy/common/validators/values/value-validators.ts
|
|
1208
1208
|
var isEmpty = (value) => isString(value) && value.length === 0 || (isObject(value) || isArray(value)) && Object.keys(value).length === 0;
|
|
1209
1209
|
|
|
1210
|
-
// src/common/validators/models/model-utils.ts
|
|
1210
|
+
// src/legacy/common/validators/models/model-utils.ts
|
|
1211
1211
|
function cleanBasicModelWithOneOfSchema(model, schema) {
|
|
1212
1212
|
return schema.oneOf.some(
|
|
1213
1213
|
(nestedSchema) => getValidBasicModelOrNull(model, nestedSchema) === model
|
|
@@ -1308,7 +1308,7 @@ function deepMergeObject(object1, object2) {
|
|
|
1308
1308
|
);
|
|
1309
1309
|
}
|
|
1310
1310
|
|
|
1311
|
-
// src/common/validators/models/model-validators.ts
|
|
1311
|
+
// src/legacy/common/validators/models/model-validators.ts
|
|
1312
1312
|
var getValidModelParts = (model, schema) => {
|
|
1313
1313
|
if (isObjectModel(model)) {
|
|
1314
1314
|
return getValidObjectModelParts(model, schema);
|
|
@@ -1368,7 +1368,7 @@ function getValidArrayModelParts(model, schema) {
|
|
|
1368
1368
|
return cleanModelWithArraySchema(model, schema);
|
|
1369
1369
|
}
|
|
1370
1370
|
|
|
1371
|
-
// src/common/validators/validationFailures/validation-failures.utils.ts
|
|
1371
|
+
// src/legacy/common/validators/validationFailures/validation-failures.utils.ts
|
|
1372
1372
|
function isValidRequired(value, isRequired = false) {
|
|
1373
1373
|
return !isRequired || !isUndefined(value);
|
|
1374
1374
|
}
|
|
@@ -1389,7 +1389,7 @@ function isValidPattern(value, pattern) {
|
|
|
1389
1389
|
return false;
|
|
1390
1390
|
}
|
|
1391
1391
|
const regex = new RegExp(pattern);
|
|
1392
|
-
return
|
|
1392
|
+
return Boolean(regex.test(value));
|
|
1393
1393
|
}
|
|
1394
1394
|
function isValidMaximum(value, maximum) {
|
|
1395
1395
|
return !isNumber(maximum) && !isString(maximum) || (isNumber(value) || isString(value)) && value <= maximum;
|
|
@@ -1404,7 +1404,7 @@ function isValidMaxItems(value, maxItems) {
|
|
|
1404
1404
|
return !isNumber(maxItems) || isArray(value) && value.length <= maxItems;
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
1407
|
-
// src/common/validators/validationFailures/validation-failures.ts
|
|
1407
|
+
// src/legacy/common/validators/validationFailures/validation-failures.ts
|
|
1408
1408
|
function getValidationFailures(value, schema, isRequired) {
|
|
1409
1409
|
if (schema.const) {
|
|
1410
1410
|
return getConstValidationFailures(value, schema, isRequired);
|
|
@@ -1532,7 +1532,7 @@ function getObjectValidationFailures(value, schema) {
|
|
|
1532
1532
|
return allPresent ? [] : ["required"];
|
|
1533
1533
|
}
|
|
1534
1534
|
|
|
1535
|
-
// src/common/validators/schemas/schema-validators.ts
|
|
1535
|
+
// src/legacy/common/validators/schemas/schema-validators.ts
|
|
1536
1536
|
function isValidStringSchema(value, schema) {
|
|
1537
1537
|
return !getStringValidationFailures(value, schema).length;
|
|
1538
1538
|
}
|
|
@@ -1624,11 +1624,11 @@ function isValidSchema(value, schema) {
|
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
|
|
1627
|
-
// src/common/utils/date-utils.ts
|
|
1627
|
+
// src/legacy/common/utils/date-utils.ts
|
|
1628
1628
|
function formatDate(date) {
|
|
1629
1629
|
const d = new Date(date);
|
|
1630
|
-
const month =
|
|
1631
|
-
const day =
|
|
1630
|
+
const month = String(d.getMonth() + 1);
|
|
1631
|
+
const day = String(d.getDate());
|
|
1632
1632
|
const year = d.getFullYear();
|
|
1633
1633
|
const formattedMonth = month.length < 2 ? `0${month}` : month;
|
|
1634
1634
|
const formattedDay = day.length < 2 ? `0${day}` : day;
|
|
@@ -1646,7 +1646,7 @@ var dateStringToDate = (dateString) => {
|
|
|
1646
1646
|
};
|
|
1647
1647
|
var dateToDateString = (date) => formatDate(date);
|
|
1648
1648
|
|
|
1649
|
-
// src/common/utils/debounce.ts
|
|
1649
|
+
// src/legacy/common/utils/debounce.ts
|
|
1650
1650
|
var debounce = (callback, waitMs) => {
|
|
1651
1651
|
let timeoutId;
|
|
1652
1652
|
let lastArgs;
|
|
@@ -1682,7 +1682,7 @@ var debounce = (callback, waitMs) => {
|
|
|
1682
1682
|
return debouncedFn;
|
|
1683
1683
|
};
|
|
1684
1684
|
|
|
1685
|
-
// src/common/utils/is-equal.ts
|
|
1685
|
+
// src/legacy/common/utils/is-equal.ts
|
|
1686
1686
|
var isEqual = (a, b) => {
|
|
1687
1687
|
if (a === b) {
|
|
1688
1688
|
return true;
|
|
@@ -1698,29 +1698,26 @@ var isEqual = (a, b) => {
|
|
|
1698
1698
|
var isObjectEquals = (a, b) => {
|
|
1699
1699
|
const keysA = Object.keys(a);
|
|
1700
1700
|
const keysB = Object.keys(b);
|
|
1701
|
-
return keysA.length === keysB.length && keysA.every((key) => Object.
|
|
1702
|
-
};
|
|
1703
|
-
var isNonNullObject = (a) => {
|
|
1704
|
-
return typeof a === "object" && a !== null;
|
|
1701
|
+
return keysA.length === keysB.length && keysA.every((key) => Object.hasOwn(b, key) && isEqual(a[key], b[key]));
|
|
1705
1702
|
};
|
|
1703
|
+
var isNonNullObject = (a) => typeof a === "object" && a !== null;
|
|
1706
1704
|
|
|
1707
|
-
// src/common/utils/file-utils.ts
|
|
1705
|
+
// src/legacy/common/utils/file-utils.ts
|
|
1708
1706
|
function toKilobytes(sizeInBytes) {
|
|
1709
1707
|
const ONE_KB_IN_BYTES = 1024;
|
|
1710
1708
|
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
1711
1709
|
}
|
|
1712
|
-
var toBase64 = (file) => {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
});
|
|
1719
|
-
};
|
|
1710
|
+
var toBase64 = (file) => new Promise((resolve, reject) => {
|
|
1711
|
+
const reader = new FileReader();
|
|
1712
|
+
reader.readAsDataURL(file);
|
|
1713
|
+
reader.addEventListener("load", () => resolve(reader.result));
|
|
1714
|
+
reader.addEventListener("error", (error) => reject(error));
|
|
1715
|
+
});
|
|
1720
1716
|
function areFilesSame(newFiles, files) {
|
|
1721
|
-
const fileIdToExistingFileMap = files.reduce(
|
|
1722
|
-
|
|
1723
|
-
|
|
1717
|
+
const fileIdToExistingFileMap = files.reduce(
|
|
1718
|
+
(map, fileObject) => __spreadProps(__spreadValues({}, map), { [fileObject.id]: fileObject }),
|
|
1719
|
+
{}
|
|
1720
|
+
);
|
|
1724
1721
|
for (const newFile of newFiles) {
|
|
1725
1722
|
const existingFileObject = fileIdToExistingFileMap[newFile.id];
|
|
1726
1723
|
const fileDoesNotExistAlready = !existingFileObject;
|
|
@@ -1734,21 +1731,21 @@ function areFilesSame(newFiles, files) {
|
|
|
1734
1731
|
return true;
|
|
1735
1732
|
}
|
|
1736
1733
|
|
|
1737
|
-
// src/common/utils/id-utils.ts
|
|
1734
|
+
// src/legacy/common/utils/id-utils.ts
|
|
1738
1735
|
var generateRandomId = (prefix = "") => {
|
|
1739
1736
|
const prefixString = prefix ? `${prefix}-` : "";
|
|
1740
1737
|
return `${prefixString}${Math.floor(1e8 * Math.random())}`;
|
|
1741
1738
|
};
|
|
1742
1739
|
|
|
1743
|
-
// src/common/utils/schema-utils.ts
|
|
1740
|
+
// src/legacy/common/utils/schema-utils.ts
|
|
1744
1741
|
function isConstSchema(schema) {
|
|
1745
1742
|
return !isUndefined(schema == null ? void 0 : schema.const);
|
|
1746
1743
|
}
|
|
1747
1744
|
function isNoNConstSchema(schema) {
|
|
1748
|
-
return
|
|
1745
|
+
return Boolean(schema) && !isConstSchema(schema);
|
|
1749
1746
|
}
|
|
1750
|
-
var isReadOnlySchema = (schema) =>
|
|
1751
|
-
var isPromotedOneOfSchema = (schema) =>
|
|
1747
|
+
var isReadOnlySchema = (schema) => Boolean(schema.readOnly) && isBasicSchema(schema);
|
|
1748
|
+
var isPromotedOneOfSchema = (schema) => Boolean(schema.oneOf) && Boolean(schema.promotion);
|
|
1752
1749
|
var basicTypes = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
|
|
1753
1750
|
function isBasicSchema(schema) {
|
|
1754
1751
|
return basicTypes.has(schema.type || "") || "const" in schema && schema.const !== void 0;
|
|
@@ -1760,10 +1757,10 @@ function isOneOfObjectSchema(schema) {
|
|
|
1760
1757
|
return isOneOfSchema(schema) && schema.oneOf.every((subSchema) => subSchema.type === "object");
|
|
1761
1758
|
}
|
|
1762
1759
|
function isOneOfSchema(schema) {
|
|
1763
|
-
return
|
|
1760
|
+
return Boolean(schema.oneOf);
|
|
1764
1761
|
}
|
|
1765
1762
|
function isAllOfSchema(schema) {
|
|
1766
|
-
return
|
|
1763
|
+
return Boolean(schema.allOf);
|
|
1767
1764
|
}
|
|
1768
1765
|
function isBlobSchema(schema) {
|
|
1769
1766
|
return schema.type === "blob";
|
|
@@ -1779,23 +1776,19 @@ function isStringSchema(schema) {
|
|
|
1779
1776
|
return schema.type === "string";
|
|
1780
1777
|
}
|
|
1781
1778
|
function isPersistAsyncSchema(schema) {
|
|
1782
|
-
return
|
|
1779
|
+
return Boolean(schema.persistAsync);
|
|
1783
1780
|
}
|
|
1784
1781
|
function isPersistAsyncFileSchema(schema) {
|
|
1785
1782
|
return isPersistAsyncSchema(schema) && (isBlobSchema(schema.persistAsync.schema) || isBase64FileSchema(schema.persistAsync.schema));
|
|
1786
1783
|
}
|
|
1787
|
-
var isValidationAsyncSchema = (schema) =>
|
|
1788
|
-
return isBasicSchema(schema) && !!schema.validationAsync;
|
|
1789
|
-
};
|
|
1784
|
+
var isValidationAsyncSchema = (schema) => isBasicSchema(schema) && Boolean(schema.validationAsync);
|
|
1790
1785
|
function isBase64FileSchema(schema) {
|
|
1791
1786
|
return schema.type === "string" && schema.format === "base64url";
|
|
1792
1787
|
}
|
|
1793
1788
|
function isFileUploadSchema(schema) {
|
|
1794
1789
|
return schema.type === "string" && schema.format === "base64url";
|
|
1795
1790
|
}
|
|
1796
|
-
var isMultipleFileUploadSchema = (schema) =>
|
|
1797
|
-
return isArraySchema(schema) && isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items);
|
|
1798
|
-
};
|
|
1791
|
+
var isMultipleFileUploadSchema = (schema) => isArraySchema(schema) && isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items);
|
|
1799
1792
|
var getSchemaType = (schema) => {
|
|
1800
1793
|
if (isReadOnlySchema(schema)) {
|
|
1801
1794
|
return "readOnly";
|
|
@@ -1827,10 +1820,8 @@ var getSchemaType = (schema) => {
|
|
|
1827
1820
|
return null;
|
|
1828
1821
|
};
|
|
1829
1822
|
|
|
1830
|
-
// src/common/utils/step-utils.ts
|
|
1831
|
-
var isCameraStep = (step) =>
|
|
1832
|
-
return isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
|
|
1833
|
-
};
|
|
1823
|
+
// src/legacy/common/utils/step-utils.ts
|
|
1824
|
+
var isCameraStep = (step) => isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
|
|
1834
1825
|
var isFormStep = (step) => !step.type || step.type === "form";
|
|
1835
1826
|
var hasSingleAction = (step) => {
|
|
1836
1827
|
var _a;
|
|
@@ -1854,16 +1845,14 @@ var hasSingleFileUploadSchemaWithCameraOnly = (step) => {
|
|
|
1854
1845
|
}
|
|
1855
1846
|
return childSchema.source === "camera";
|
|
1856
1847
|
};
|
|
1857
|
-
var filterHiddenSchemas = (schemas) => {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
});
|
|
1864
|
-
};
|
|
1848
|
+
var filterHiddenSchemas = (schemas) => schemas.filter((schema) => {
|
|
1849
|
+
if (isObjectSchema(schema)) {
|
|
1850
|
+
return Object.values((schema == null ? void 0 : schema.properties) || {}).find((schema2) => (schema2 == null ? void 0 : schema2.hidden) !== true);
|
|
1851
|
+
}
|
|
1852
|
+
return (schema == null ? void 0 : schema.hidden) !== true;
|
|
1853
|
+
});
|
|
1865
1854
|
|
|
1866
|
-
// src/common/utils/model-utils.ts
|
|
1855
|
+
// src/legacy/common/utils/model-utils.ts
|
|
1867
1856
|
var isObjectModel = (model) => typeof model === "object" && model !== null && model.constructor === Object;
|
|
1868
1857
|
var isNullableObjectModel = (model) => isNull(model) || isObjectModel(model);
|
|
1869
1858
|
var isNullableBasicModel = (model) => isBoolean(model) || isNumber(model) || isString(model) || isNull(model);
|
|
@@ -1886,37 +1875,34 @@ var isNullableArrayModel = (model) => {
|
|
|
1886
1875
|
return isArrayModel(model);
|
|
1887
1876
|
};
|
|
1888
1877
|
|
|
1889
|
-
// src/common/utils/misc-utils.ts
|
|
1878
|
+
// src/legacy/common/utils/misc-utils.ts
|
|
1890
1879
|
var isBasicError = (error) => isString(error) || isNull(error);
|
|
1891
1880
|
|
|
1892
|
-
// src/common/utils/mobile-utils.ts
|
|
1893
|
-
var isMobile = () =>
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => {
|
|
1900
|
-
return width < 768 || height < 768;
|
|
1901
|
-
};
|
|
1881
|
+
// src/legacy/common/utils/mobile-utils.ts
|
|
1882
|
+
var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
1883
|
+
var isMobileUA = (userAgent = window.navigator.userAgent) => (
|
|
1884
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
1885
|
+
/mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
|
|
1886
|
+
);
|
|
1887
|
+
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
|
|
1902
1888
|
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
1903
1889
|
if ("maxTouchPoints" in navigator2) {
|
|
1904
1890
|
return navigator2.maxTouchPoints > 0;
|
|
1905
1891
|
}
|
|
1906
1892
|
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
1907
1893
|
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
1908
|
-
return
|
|
1894
|
+
return Boolean(mQ.matches);
|
|
1909
1895
|
}
|
|
1910
1896
|
return false;
|
|
1911
1897
|
};
|
|
1912
1898
|
|
|
1913
|
-
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1899
|
+
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1914
1900
|
var import_react7 = require("react");
|
|
1915
1901
|
function useDebouncedFunction(callback, waitMs) {
|
|
1916
1902
|
return (0, import_react7.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
1917
1903
|
}
|
|
1918
1904
|
|
|
1919
|
-
// src/common/hooks/useExternal/useExternal.tsx
|
|
1905
|
+
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
1920
1906
|
var import_react8 = require("react");
|
|
1921
1907
|
function useExternal(url) {
|
|
1922
1908
|
const [externalWindow, setExternalWindow] = (0, import_react8.useState)(null);
|
|
@@ -1932,28 +1918,25 @@ function useExternal(url) {
|
|
|
1932
1918
|
return { requiresManualTrigger, dismissConfirmation };
|
|
1933
1919
|
}
|
|
1934
1920
|
|
|
1935
|
-
// src/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1921
|
+
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1936
1922
|
var import_react9 = require("react");
|
|
1937
1923
|
function useExternalStepPolling(polling, onAction) {
|
|
1938
1924
|
const httpClient = useHttpClient();
|
|
1939
1925
|
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
1940
1926
|
if (polling) {
|
|
1941
|
-
return () => {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
} catch (e) {
|
|
1947
|
-
throw new Error("failed");
|
|
1948
|
-
}
|
|
1949
|
-
} else {
|
|
1927
|
+
return () => httpClient(polling.url).then((response) => {
|
|
1928
|
+
if (response.ok) {
|
|
1929
|
+
try {
|
|
1930
|
+
return response.json();
|
|
1931
|
+
} catch (e) {
|
|
1950
1932
|
throw new Error("failed");
|
|
1951
1933
|
}
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1934
|
+
} else {
|
|
1935
|
+
throw new Error("failed");
|
|
1936
|
+
}
|
|
1937
|
+
});
|
|
1956
1938
|
}
|
|
1939
|
+
return void 0;
|
|
1957
1940
|
}, [polling, httpClient]);
|
|
1958
1941
|
const onPollingResponse = (0, import_react9.useCallback)(
|
|
1959
1942
|
(pollingResponse) => {
|
|
@@ -1990,11 +1973,11 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1990
1973
|
});
|
|
1991
1974
|
}
|
|
1992
1975
|
|
|
1993
|
-
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1994
|
-
var
|
|
1976
|
+
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1977
|
+
var import_react31 = require("react");
|
|
1995
1978
|
var import_react_intl21 = require("react-intl");
|
|
1996
1979
|
|
|
1997
|
-
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
1980
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
1998
1981
|
var import_react_intl = require("react-intl");
|
|
1999
1982
|
var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)({
|
|
2000
1983
|
genericError: {
|
|
@@ -2004,17 +1987,17 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
2004
1987
|
}
|
|
2005
1988
|
});
|
|
2006
1989
|
|
|
2007
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
2008
|
-
var
|
|
1990
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1991
|
+
var import_react30 = require("react");
|
|
2009
1992
|
var import_react_intl20 = require("react-intl");
|
|
2010
1993
|
|
|
2011
|
-
// src/common/constants/DateMode.ts
|
|
1994
|
+
// src/legacy/common/constants/DateMode.ts
|
|
2012
1995
|
var DateMode = {
|
|
2013
1996
|
DAY_MONTH_YEAR: "day-month-year",
|
|
2014
1997
|
MONTH_YEAR: "month-year"
|
|
2015
1998
|
};
|
|
2016
1999
|
|
|
2017
|
-
// src/common/constants/FormControlType.ts
|
|
2000
|
+
// src/legacy/common/constants/FormControlType.ts
|
|
2018
2001
|
var FormControlType = {
|
|
2019
2002
|
RADIO: "radio",
|
|
2020
2003
|
CHECKBOX: "checkbox",
|
|
@@ -2037,13 +2020,13 @@ var FormControlType = {
|
|
|
2037
2020
|
TAB: "tab"
|
|
2038
2021
|
};
|
|
2039
2022
|
|
|
2040
|
-
// src/common/constants/MonthFormat.ts
|
|
2023
|
+
// src/legacy/common/constants/MonthFormat.ts
|
|
2041
2024
|
var MonthFormat = {
|
|
2042
2025
|
SHORT: "short",
|
|
2043
2026
|
LONG: "long"
|
|
2044
2027
|
};
|
|
2045
2028
|
|
|
2046
|
-
// src/common/constants/Size.ts
|
|
2029
|
+
// src/legacy/common/constants/Size.ts
|
|
2047
2030
|
var Size = {
|
|
2048
2031
|
EXTRA_SMALL: "xs",
|
|
2049
2032
|
SMALL: "sm",
|
|
@@ -2052,17 +2035,17 @@ var Size = {
|
|
|
2052
2035
|
EXTRA_LARGE: "xl"
|
|
2053
2036
|
};
|
|
2054
2037
|
|
|
2055
|
-
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
2038
|
+
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2039
|
+
var import_classnames7 = __toESM(require_classnames());
|
|
2040
|
+
var import_react29 = require("react");
|
|
2058
2041
|
|
|
2059
|
-
// src/layout/alert/DynamicAlert.tsx
|
|
2042
|
+
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
2060
2043
|
var import_components2 = require("@transferwise/components");
|
|
2061
2044
|
|
|
2062
|
-
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2045
|
+
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
2063
2046
|
var import_components = require("@transferwise/components");
|
|
2064
2047
|
|
|
2065
|
-
// src/layout/icon/FlagIcon.tsx
|
|
2048
|
+
// src/legacy/layout/icon/FlagIcon.tsx
|
|
2066
2049
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2067
2050
|
var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
|
|
2068
2051
|
var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
|
|
@@ -2264,7 +2247,7 @@ var countryCodes = [
|
|
|
2264
2247
|
"zm"
|
|
2265
2248
|
];
|
|
2266
2249
|
|
|
2267
|
-
// src/layout/icon/NamedIcon.tsx
|
|
2250
|
+
// src/legacy/layout/icon/NamedIcon.tsx
|
|
2268
2251
|
var icons = __toESM(require("@transferwise/icons"));
|
|
2269
2252
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2270
2253
|
var isNamedIcon = (name) => {
|
|
@@ -2285,7 +2268,7 @@ var capitaliseFirstChar = (value) => {
|
|
|
2285
2268
|
return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
|
|
2286
2269
|
};
|
|
2287
2270
|
|
|
2288
|
-
// src/layout/icon/DynamicIcon.tsx
|
|
2271
|
+
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
2289
2272
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2290
2273
|
var DynamicIcon = ({ type }) => {
|
|
2291
2274
|
if (isFlagIcon(type)) {
|
|
@@ -2301,7 +2284,7 @@ function isValidIconName(name) {
|
|
|
2301
2284
|
}
|
|
2302
2285
|
var DynamicIcon_default = DynamicIcon;
|
|
2303
2286
|
|
|
2304
|
-
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2287
|
+
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
2305
2288
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2306
2289
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
2307
2290
|
if (icon == null ? void 0 : icon.name) {
|
|
@@ -2317,7 +2300,7 @@ var getNavigationOptionMedia = ({ icon, image }) => {
|
|
|
2317
2300
|
return null;
|
|
2318
2301
|
};
|
|
2319
2302
|
|
|
2320
|
-
// src/layout/utils/index.ts
|
|
2303
|
+
// src/legacy/layout/utils/index.ts
|
|
2321
2304
|
var getMargin = (size) => {
|
|
2322
2305
|
switch (size) {
|
|
2323
2306
|
case "xs":
|
|
@@ -2347,7 +2330,7 @@ var getTextAlignment = (align) => {
|
|
|
2347
2330
|
};
|
|
2348
2331
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
2349
2332
|
|
|
2350
|
-
// src/layout/alert/DynamicAlert.tsx
|
|
2333
|
+
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
2351
2334
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2352
2335
|
var DynamicAlert = (props) => {
|
|
2353
2336
|
const alert = props.component;
|
|
@@ -2383,7 +2366,7 @@ var mapContextToAlertType = (context) => {
|
|
|
2383
2366
|
};
|
|
2384
2367
|
var DynamicAlert_default = DynamicAlert;
|
|
2385
2368
|
|
|
2386
|
-
// src/layout/box/DynamicBox.tsx
|
|
2369
|
+
// src/legacy/layout/box/DynamicBox.tsx
|
|
2387
2370
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2388
2371
|
var DynamicBox = (props) => {
|
|
2389
2372
|
const box = props.component;
|
|
@@ -2435,10 +2418,10 @@ var getBoxWidthClasses = (component) => {
|
|
|
2435
2418
|
};
|
|
2436
2419
|
var DynamicBox_default = DynamicBox;
|
|
2437
2420
|
|
|
2438
|
-
// src/layout/button/DynamicButton.tsx
|
|
2421
|
+
// src/legacy/layout/button/DynamicButton.tsx
|
|
2439
2422
|
var import_components3 = require("@transferwise/components");
|
|
2440
2423
|
|
|
2441
|
-
// src/layout/button/utils.ts
|
|
2424
|
+
// src/legacy/layout/button/utils.ts
|
|
2442
2425
|
var priorities = {
|
|
2443
2426
|
primary: "primary",
|
|
2444
2427
|
secondary: "secondary",
|
|
@@ -2478,7 +2461,7 @@ var getButtonSize = (size) => {
|
|
|
2478
2461
|
}
|
|
2479
2462
|
};
|
|
2480
2463
|
|
|
2481
|
-
// src/layout/button/DynamicButton.tsx
|
|
2464
|
+
// src/legacy/layout/button/DynamicButton.tsx
|
|
2482
2465
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2483
2466
|
var DynamicButton = (props) => {
|
|
2484
2467
|
var _a;
|
|
@@ -2504,7 +2487,7 @@ var DynamicButton = (props) => {
|
|
|
2504
2487
|
};
|
|
2505
2488
|
var DynamicButton_default = DynamicButton;
|
|
2506
2489
|
|
|
2507
|
-
// src/layout/columns/DynamicColumns.tsx
|
|
2490
|
+
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
2508
2491
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2509
2492
|
var DynamicColumns = (props) => {
|
|
2510
2493
|
const columns = props.component;
|
|
@@ -2556,25 +2539,27 @@ var getWidth = (bias) => {
|
|
|
2556
2539
|
};
|
|
2557
2540
|
var DynamicColumns_default = DynamicColumns;
|
|
2558
2541
|
|
|
2559
|
-
// src/layout/decision/DynamicDecision.tsx
|
|
2542
|
+
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
2560
2543
|
var import_components4 = require("@transferwise/components");
|
|
2561
2544
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2562
|
-
|
|
2563
|
-
import_components4.
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
)
|
|
2545
|
+
function DynamicDecision({ component, onAction }) {
|
|
2546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: getMargin(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components4.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
2547
|
+
import_components4.NavigationOption,
|
|
2548
|
+
{
|
|
2549
|
+
title: option.title,
|
|
2550
|
+
content: option.description,
|
|
2551
|
+
disabled: option.disabled,
|
|
2552
|
+
media: getNavigationOptionMedia(option),
|
|
2553
|
+
showMediaCircle: false,
|
|
2554
|
+
showMediaAtAllSizes: true,
|
|
2555
|
+
onClick: () => onAction(option.action)
|
|
2556
|
+
},
|
|
2557
|
+
JSON.stringify(option)
|
|
2558
|
+
)) }) });
|
|
2559
|
+
}
|
|
2575
2560
|
var DynamicDecision_default = DynamicDecision;
|
|
2576
2561
|
|
|
2577
|
-
// src/layout/divider/DynamicDivider.tsx
|
|
2562
|
+
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
2578
2563
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2579
2564
|
var DynamicDivider = ({ component }) => {
|
|
2580
2565
|
const margin = getMargin(component.margin);
|
|
@@ -2583,12 +2568,12 @@ var DynamicDivider = ({ component }) => {
|
|
|
2583
2568
|
};
|
|
2584
2569
|
var DynamicDivider_default = DynamicDivider;
|
|
2585
2570
|
|
|
2586
|
-
// src/layout/external/DynamicExternal.tsx
|
|
2571
|
+
// src/legacy/layout/external/DynamicExternal.tsx
|
|
2587
2572
|
var import_components5 = require("@transferwise/components");
|
|
2588
2573
|
var import_react10 = require("react");
|
|
2589
2574
|
var import_react_intl3 = require("react-intl");
|
|
2590
2575
|
|
|
2591
|
-
// src/layout/external/DynamicExternal.messages.js
|
|
2576
|
+
// src/legacy/layout/external/DynamicExternal.messages.js
|
|
2592
2577
|
var import_react_intl2 = require("react-intl");
|
|
2593
2578
|
var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
2594
2579
|
retryTitle: {
|
|
@@ -2598,7 +2583,7 @@ var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
|
2598
2583
|
}
|
|
2599
2584
|
});
|
|
2600
2585
|
|
|
2601
|
-
// src/layout/external/DynamicExternal.tsx
|
|
2586
|
+
// src/legacy/layout/external/DynamicExternal.tsx
|
|
2602
2587
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2603
2588
|
var DynamicExternal = ({ component, onAction }) => {
|
|
2604
2589
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
@@ -2622,30 +2607,22 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
2622
2607
|
};
|
|
2623
2608
|
var DynamicExternal_default = DynamicExternal;
|
|
2624
2609
|
|
|
2625
|
-
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2610
|
+
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2626
2611
|
var import_react22 = require("react");
|
|
2627
2612
|
|
|
2628
|
-
// src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2613
|
+
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2629
2614
|
var import_components6 = require("@transferwise/components");
|
|
2630
2615
|
var import_classnames = __toESM(require_classnames());
|
|
2631
2616
|
var import_react11 = require("react");
|
|
2632
2617
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2633
|
-
var splitModel = (model, schemas) => {
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
var getSchemaColumnClasses = (width) => {
|
|
2642
|
-
return {
|
|
2643
|
-
"col-xs-12": true,
|
|
2644
|
-
"col-sm-6": width === "md",
|
|
2645
|
-
"col-sm-4": width === "sm"
|
|
2646
|
-
};
|
|
2647
|
-
};
|
|
2648
|
-
var AllOfSchema = (props) => {
|
|
2618
|
+
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
2619
|
+
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
2620
|
+
var getSchemaColumnClasses = (width) => ({
|
|
2621
|
+
"col-xs-12": true,
|
|
2622
|
+
"col-sm-6": width === "md",
|
|
2623
|
+
"col-sm-4": width === "sm"
|
|
2624
|
+
});
|
|
2625
|
+
function AllOfSchema(props) {
|
|
2649
2626
|
const onChangeModelIndex = (index, onChangeProps) => {
|
|
2650
2627
|
const modelSchema = props.schema.allOf[index];
|
|
2651
2628
|
models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
|
|
@@ -2675,23 +2652,23 @@ var AllOfSchema = (props) => {
|
|
|
2675
2652
|
) }, index)
|
|
2676
2653
|
)) })
|
|
2677
2654
|
] });
|
|
2678
|
-
}
|
|
2655
|
+
}
|
|
2679
2656
|
AllOfSchema.defaultProps = {
|
|
2680
2657
|
disabled: false
|
|
2681
2658
|
};
|
|
2682
2659
|
var AllOfSchema_default = AllOfSchema;
|
|
2683
2660
|
|
|
2684
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2661
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2685
2662
|
var import_components8 = require("@transferwise/components");
|
|
2686
2663
|
var import_classnames2 = __toESM(require_classnames());
|
|
2687
2664
|
var import_react12 = require("react");
|
|
2688
2665
|
|
|
2689
|
-
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2666
|
+
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2690
2667
|
var import_components7 = require("@transferwise/components");
|
|
2691
2668
|
var import_formatting = require("@transferwise/formatting");
|
|
2692
2669
|
var import_react_intl5 = require("react-intl");
|
|
2693
2670
|
|
|
2694
|
-
// src/jsonSchemaForm/controlFeedback/ControlFeedback.messages.ts
|
|
2671
|
+
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.messages.ts
|
|
2695
2672
|
var import_react_intl4 = require("react-intl");
|
|
2696
2673
|
var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
|
|
2697
2674
|
type: {
|
|
@@ -2746,7 +2723,7 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
|
|
|
2746
2723
|
}
|
|
2747
2724
|
});
|
|
2748
2725
|
|
|
2749
|
-
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2726
|
+
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2750
2727
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2751
2728
|
var ControlFeedback = (props) => {
|
|
2752
2729
|
var _a;
|
|
@@ -2820,18 +2797,17 @@ function useDefaultValidationMessages(schema) {
|
|
|
2820
2797
|
}
|
|
2821
2798
|
var ControlFeedback_default = ControlFeedback;
|
|
2822
2799
|
|
|
2823
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.ts
|
|
2800
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.ts
|
|
2824
2801
|
async function createPayload(userUploadedFile, isBlobSchema2) {
|
|
2825
2802
|
if (isBlobSchema2) {
|
|
2826
2803
|
return userUploadedFile;
|
|
2827
|
-
} else {
|
|
2828
|
-
if (userUploadedFile instanceof Blob) {
|
|
2829
|
-
return toBase64(userUploadedFile);
|
|
2830
|
-
}
|
|
2831
|
-
throw new Error(
|
|
2832
|
-
"Error creating payload for MultipleFileUploadSchema. Uploaded file is not an instance of Blob."
|
|
2833
|
-
);
|
|
2834
2804
|
}
|
|
2805
|
+
if (userUploadedFile instanceof Blob) {
|
|
2806
|
+
return toBase64(userUploadedFile);
|
|
2807
|
+
}
|
|
2808
|
+
throw new Error(
|
|
2809
|
+
"Error creating payload for MultipleFileUploadSchema. Uploaded file is not an instance of Blob."
|
|
2810
|
+
);
|
|
2835
2811
|
}
|
|
2836
2812
|
function constructUploadResponse(response) {
|
|
2837
2813
|
const id = response.data;
|
|
@@ -2847,17 +2823,16 @@ function constructUploadError(response) {
|
|
|
2847
2823
|
if (isError) {
|
|
2848
2824
|
const error = response;
|
|
2849
2825
|
return { id: generateRandomId(), message: error.message };
|
|
2850
|
-
} else {
|
|
2851
|
-
return __spreadValues({
|
|
2852
|
-
message: isString(response.message) ? response.message : ""
|
|
2853
|
-
}, response);
|
|
2854
2826
|
}
|
|
2827
|
+
return __spreadValues({
|
|
2828
|
+
message: isString(response.message) ? response.message : ""
|
|
2829
|
+
}, response);
|
|
2855
2830
|
}
|
|
2856
2831
|
|
|
2857
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2832
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2858
2833
|
var import_react_intl8 = require("react-intl");
|
|
2859
2834
|
|
|
2860
|
-
// src/common/messages.ts
|
|
2835
|
+
// src/legacy/common/messages.ts
|
|
2861
2836
|
var import_react_intl6 = require("react-intl");
|
|
2862
2837
|
var messages_default = (0, import_react_intl6.defineMessages)({
|
|
2863
2838
|
required: {
|
|
@@ -2867,7 +2842,7 @@ var messages_default = (0, import_react_intl6.defineMessages)({
|
|
|
2867
2842
|
}
|
|
2868
2843
|
});
|
|
2869
2844
|
|
|
2870
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js
|
|
2845
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js
|
|
2871
2846
|
var import_react_intl7 = require("react-intl");
|
|
2872
2847
|
var MultipleFileUploadSchema_messages_default = (0, import_react_intl7.defineMessages)({
|
|
2873
2848
|
minItemsError: {
|
|
@@ -2887,7 +2862,7 @@ var MultipleFileUploadSchema_messages_default = (0, import_react_intl7.defineMes
|
|
|
2887
2862
|
}
|
|
2888
2863
|
});
|
|
2889
2864
|
|
|
2890
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2865
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2891
2866
|
function useFormattedDefaultErrorMessages({
|
|
2892
2867
|
maxItems,
|
|
2893
2868
|
minItems
|
|
@@ -2902,9 +2877,9 @@ function useFormattedDefaultErrorMessages({
|
|
|
2902
2877
|
};
|
|
2903
2878
|
}
|
|
2904
2879
|
|
|
2905
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2880
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2906
2881
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2907
|
-
|
|
2882
|
+
function MultipleFileUploadSchema(props) {
|
|
2908
2883
|
var _a, _b;
|
|
2909
2884
|
const { onChange, schema } = props;
|
|
2910
2885
|
const onEvent = useEventDispatcher();
|
|
@@ -2988,7 +2963,7 @@ var MultipleFileUploadSchema = (props) => {
|
|
|
2988
2963
|
}
|
|
2989
2964
|
)
|
|
2990
2965
|
] });
|
|
2991
|
-
}
|
|
2966
|
+
}
|
|
2992
2967
|
MultipleFileUploadSchema.defaultProps = {
|
|
2993
2968
|
errors: null,
|
|
2994
2969
|
required: false
|
|
@@ -3008,13 +2983,13 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
3008
2983
|
return __spreadValues(__spreadValues(__spreadValues({}, required && { required: defaultErrorMessages.requiredMessage }), minItems && { minItems: defaultErrorMessages.minItemsErrorMessage }), maxItems && { maxItems: defaultErrorMessages.maxItemsErrorMessage });
|
|
3009
2984
|
}
|
|
3010
2985
|
|
|
3011
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
2986
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3012
2987
|
var import_components10 = require("@transferwise/components");
|
|
3013
2988
|
var import_icons = require("@transferwise/icons");
|
|
3014
2989
|
var import_react13 = require("react");
|
|
3015
2990
|
var import_react_intl11 = require("react-intl");
|
|
3016
2991
|
|
|
3017
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
2992
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
3018
2993
|
var import_components9 = require("@transferwise/components");
|
|
3019
2994
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3020
2995
|
var ItemSummaryOption = ({
|
|
@@ -3033,7 +3008,7 @@ var ItemSummaryOption = ({
|
|
|
3033
3008
|
);
|
|
3034
3009
|
};
|
|
3035
3010
|
|
|
3036
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.ts
|
|
3011
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.ts
|
|
3037
3012
|
var import_react_intl9 = require("react-intl");
|
|
3038
3013
|
var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
3039
3014
|
addItemTitle: {
|
|
@@ -3058,10 +3033,10 @@ var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
3058
3033
|
}
|
|
3059
3034
|
});
|
|
3060
3035
|
|
|
3061
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3036
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3062
3037
|
var import_react_intl10 = require("react-intl");
|
|
3063
3038
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3064
|
-
|
|
3039
|
+
function RepeatableSchemaStep({
|
|
3065
3040
|
type,
|
|
3066
3041
|
schema,
|
|
3067
3042
|
model,
|
|
@@ -3069,7 +3044,7 @@ var RepeatableSchemaStep = ({
|
|
|
3069
3044
|
submitted,
|
|
3070
3045
|
onModelChange,
|
|
3071
3046
|
onAction
|
|
3072
|
-
})
|
|
3047
|
+
}) {
|
|
3073
3048
|
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
3074
3049
|
const step = {
|
|
3075
3050
|
layout: [
|
|
@@ -3115,10 +3090,10 @@ var RepeatableSchemaStep = ({
|
|
|
3115
3090
|
onModelChange
|
|
3116
3091
|
}
|
|
3117
3092
|
);
|
|
3118
|
-
}
|
|
3093
|
+
}
|
|
3119
3094
|
var RepeatableSchemaStep_default = RepeatableSchemaStep;
|
|
3120
3095
|
|
|
3121
|
-
// src/jsonSchemaForm/oneOfSchema/utils.ts
|
|
3096
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/utils.ts
|
|
3122
3097
|
var getActiveSchemaIndex = (schema, model) => {
|
|
3123
3098
|
const indexFromModel = getValidIndexFromValue(schema, model);
|
|
3124
3099
|
if (indexFromModel >= 0) {
|
|
@@ -3169,7 +3144,7 @@ function getSchemaProperties(childSchema) {
|
|
|
3169
3144
|
return childSchema.properties !== null && typeof childSchema.properties === "object" ? Object.entries(childSchema.properties) : [];
|
|
3170
3145
|
}
|
|
3171
3146
|
|
|
3172
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.ts
|
|
3147
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.ts
|
|
3173
3148
|
var getItemSummaryFromSchema = (schema, model, defaults = {}) => {
|
|
3174
3149
|
const { defaultTitle = "", defaultDescription = "", defaultIcon, defaultImage } = defaults;
|
|
3175
3150
|
const title = getSummaryPropFromSchema({
|
|
@@ -3295,9 +3270,12 @@ var getStringValueFromSchema = (schema, model) => {
|
|
|
3295
3270
|
}
|
|
3296
3271
|
return isNullableStringModel(model) ? model : null;
|
|
3297
3272
|
};
|
|
3298
|
-
var schemaSummaryProvides = (summary, providesProp) =>
|
|
3273
|
+
var schemaSummaryProvides = (summary, providesProp) => (
|
|
3274
|
+
// eslint-disable-next-line prefer-object-has-own, no-implicit-coercion
|
|
3275
|
+
!!summary && Object.hasOwnProperty.call(summary, providesProp) && Boolean(summary[providesProp])
|
|
3276
|
+
);
|
|
3299
3277
|
|
|
3300
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3278
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3301
3279
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3302
3280
|
var RepeatableSchema = ({
|
|
3303
3281
|
schema,
|
|
@@ -3417,7 +3395,7 @@ var getUpdatedItemSummaries = (action, {
|
|
|
3417
3395
|
};
|
|
3418
3396
|
var RepeatableSchema_default = RepeatableSchema;
|
|
3419
3397
|
|
|
3420
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3398
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3421
3399
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3422
3400
|
var ArrayListSchema = (props) => {
|
|
3423
3401
|
const { schema } = props;
|
|
@@ -3435,7 +3413,7 @@ ArrayListSchema.defaultProps = {
|
|
|
3435
3413
|
};
|
|
3436
3414
|
var ArrayListSchema_default = ArrayListSchema;
|
|
3437
3415
|
|
|
3438
|
-
// src/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3416
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3439
3417
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3440
3418
|
var ArraySchema = (props) => {
|
|
3441
3419
|
const { schema } = props;
|
|
@@ -3449,18 +3427,16 @@ ArraySchema.defaultProps = {
|
|
|
3449
3427
|
};
|
|
3450
3428
|
var ArraySchema_default = ArraySchema;
|
|
3451
3429
|
|
|
3452
|
-
// src/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3430
|
+
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3453
3431
|
var import_classnames3 = __toESM(require_classnames());
|
|
3454
3432
|
var import_react14 = require("react");
|
|
3455
3433
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3456
|
-
var getSchemaColumnClasses2 = (width) => {
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
};
|
|
3463
|
-
var ObjectSchema = (props) => {
|
|
3434
|
+
var getSchemaColumnClasses2 = (width) => ({
|
|
3435
|
+
"col-xs-12": true,
|
|
3436
|
+
"col-sm-6": width === "md",
|
|
3437
|
+
"col-sm-4": width === "sm"
|
|
3438
|
+
});
|
|
3439
|
+
function ObjectSchema(props) {
|
|
3464
3440
|
const [model, setModel] = (0, import_react14.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
3465
3441
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
3466
3442
|
if (onChangeProps.model !== null) {
|
|
@@ -3513,7 +3489,7 @@ var ObjectSchema = (props) => {
|
|
|
3513
3489
|
{
|
|
3514
3490
|
schema: props.schema.properties[propertyName],
|
|
3515
3491
|
model: props.model && props.model[propertyName],
|
|
3516
|
-
errors: propsErrors
|
|
3492
|
+
errors: propsErrors == null ? void 0 : propsErrors[propertyName],
|
|
3517
3493
|
submitted: props.submitted,
|
|
3518
3494
|
required: isRequired(propertyName),
|
|
3519
3495
|
disabled: props.disabled,
|
|
@@ -3525,23 +3501,23 @@ var ObjectSchema = (props) => {
|
|
|
3525
3501
|
propertyName
|
|
3526
3502
|
)) })
|
|
3527
3503
|
] });
|
|
3528
|
-
}
|
|
3504
|
+
}
|
|
3529
3505
|
ObjectSchema.defaultProps = {
|
|
3530
3506
|
hideTitle: false,
|
|
3531
3507
|
disabled: false
|
|
3532
3508
|
};
|
|
3533
3509
|
var ObjectSchema_default = ObjectSchema;
|
|
3534
3510
|
|
|
3535
|
-
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3511
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3536
3512
|
var import_components14 = require("@transferwise/components");
|
|
3537
3513
|
var import_classnames4 = __toESM(require_classnames());
|
|
3538
3514
|
var import_react17 = require("react");
|
|
3539
3515
|
|
|
3540
|
-
// src/jsonSchemaForm/help/Help.tsx
|
|
3516
|
+
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3541
3517
|
var import_components11 = require("@transferwise/components");
|
|
3542
3518
|
var import_react_intl13 = require("react-intl");
|
|
3543
3519
|
|
|
3544
|
-
// src/jsonSchemaForm/help/Help.messages.js
|
|
3520
|
+
// src/legacy/jsonSchemaForm/help/Help.messages.js
|
|
3545
3521
|
var import_react_intl12 = require("react-intl");
|
|
3546
3522
|
var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
3547
3523
|
helpAria: {
|
|
@@ -3551,7 +3527,7 @@ var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
3551
3527
|
}
|
|
3552
3528
|
});
|
|
3553
3529
|
|
|
3554
|
-
// src/jsonSchemaForm/help/Help.tsx
|
|
3530
|
+
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3555
3531
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3556
3532
|
var Help = (props) => {
|
|
3557
3533
|
const intl = (0, import_react_intl13.useIntl)();
|
|
@@ -3568,14 +3544,14 @@ var Help = (props) => {
|
|
|
3568
3544
|
};
|
|
3569
3545
|
var Help_default = Help;
|
|
3570
3546
|
|
|
3571
|
-
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3547
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3572
3548
|
var import_react16 = require("react");
|
|
3573
3549
|
|
|
3574
|
-
// src/formControl/FormControl.tsx
|
|
3550
|
+
// src/legacy/formControl/FormControl.tsx
|
|
3575
3551
|
var import_components12 = require("@transferwise/components");
|
|
3576
3552
|
var import_react15 = require("react");
|
|
3577
3553
|
|
|
3578
|
-
// src/formControl/utils/value-utils.ts
|
|
3554
|
+
// src/legacy/formControl/utils/value-utils.ts
|
|
3579
3555
|
var getSafeStringValue = (value, options = {}) => {
|
|
3580
3556
|
const { coerceValue = false } = options;
|
|
3581
3557
|
if (isNull(value)) {
|
|
@@ -3682,7 +3658,7 @@ var logInvalidTypeFallbackWarning = ({
|
|
|
3682
3658
|
);
|
|
3683
3659
|
};
|
|
3684
3660
|
|
|
3685
|
-
// src/formControl/utils/getAutocompleteString.ts
|
|
3661
|
+
// src/legacy/formControl/utils/getAutocompleteString.ts
|
|
3686
3662
|
var getAutocompleteString = (hints) => {
|
|
3687
3663
|
const validHints = hints.filter((hint) => autocompleteTokenMap[hint]);
|
|
3688
3664
|
if (validHints.length === 0) {
|
|
@@ -3757,7 +3733,7 @@ var autocompleteTokenMap = {
|
|
|
3757
3733
|
pager: "pager"
|
|
3758
3734
|
};
|
|
3759
3735
|
|
|
3760
|
-
// src/formControl/FormControl.tsx
|
|
3736
|
+
// src/legacy/formControl/FormControl.tsx
|
|
3761
3737
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3762
3738
|
var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
3763
3739
|
constructor(props) {
|
|
@@ -4166,7 +4142,7 @@ _FormControl.defaultProps = {
|
|
|
4166
4142
|
};
|
|
4167
4143
|
var FormControl = _FormControl;
|
|
4168
4144
|
|
|
4169
|
-
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4145
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4170
4146
|
var import_components13 = require("@transferwise/components");
|
|
4171
4147
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4172
4148
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
@@ -4246,11 +4222,9 @@ var getDisabled = (disabled) => {
|
|
|
4246
4222
|
return void 0;
|
|
4247
4223
|
};
|
|
4248
4224
|
|
|
4249
|
-
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4225
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4250
4226
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4251
|
-
var isNativeInput = (propsSchemaType) =>
|
|
4252
|
-
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
4253
|
-
};
|
|
4227
|
+
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
4254
4228
|
var getControlType = (schema) => {
|
|
4255
4229
|
if (isOneOfSchema(schema)) {
|
|
4256
4230
|
if (schema.control === FormControlType.TAB && schema.oneOf.length > 3) {
|
|
@@ -4309,7 +4283,7 @@ var getOptions = (schema, controlType) => {
|
|
|
4309
4283
|
}
|
|
4310
4284
|
return null;
|
|
4311
4285
|
};
|
|
4312
|
-
|
|
4286
|
+
function SchemaFormControl(props) {
|
|
4313
4287
|
const { id, schema, value, disabled, onChange, onFocus, onBlur, onSearchChange, describedBy } = props;
|
|
4314
4288
|
const log = useLogger();
|
|
4315
4289
|
const getSanitisedValue = (value2) => isNativeInput(schema.type) && (isNull(value2) || isUndefined(value2)) ? "" : value2;
|
|
@@ -4343,7 +4317,7 @@ var SchemaFormControl = (props) => {
|
|
|
4343
4317
|
describedBy
|
|
4344
4318
|
};
|
|
4345
4319
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
4346
|
-
}
|
|
4320
|
+
}
|
|
4347
4321
|
SchemaFormControl.defaultProps = {
|
|
4348
4322
|
value: null,
|
|
4349
4323
|
onFocus: null,
|
|
@@ -4370,9 +4344,9 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4370
4344
|
};
|
|
4371
4345
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4372
4346
|
|
|
4373
|
-
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4347
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4374
4348
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4375
|
-
|
|
4349
|
+
function OneOfSchema(props) {
|
|
4376
4350
|
const onEvent = useEventDispatcher();
|
|
4377
4351
|
const [changed, setChanged] = (0, import_react17.useState)(false);
|
|
4378
4352
|
const [focused, setFocused] = (0, import_react17.useState)(false);
|
|
@@ -4457,11 +4431,11 @@ var OneOfSchema = (props) => {
|
|
|
4457
4431
|
schema: schemaForSelect,
|
|
4458
4432
|
value: schemaIndex,
|
|
4459
4433
|
disabled: props.disabled,
|
|
4434
|
+
describedBy: feedbackId,
|
|
4460
4435
|
onChange: onChooseNewSchema,
|
|
4461
4436
|
onFocus,
|
|
4462
4437
|
onBlur,
|
|
4463
|
-
onSearchChange
|
|
4464
|
-
describedBy: feedbackId
|
|
4438
|
+
onSearchChange
|
|
4465
4439
|
}
|
|
4466
4440
|
),
|
|
4467
4441
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -4494,7 +4468,7 @@ var OneOfSchema = (props) => {
|
|
|
4494
4468
|
}
|
|
4495
4469
|
)
|
|
4496
4470
|
] });
|
|
4497
|
-
}
|
|
4471
|
+
}
|
|
4498
4472
|
function getTitleAndHelp(schema, id) {
|
|
4499
4473
|
var _a;
|
|
4500
4474
|
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Help_default, { help: schema.help }) : null;
|
|
@@ -4512,10 +4486,10 @@ function getTitleAndHelp(schema, id) {
|
|
|
4512
4486
|
function getValidations(props, schemaIndex) {
|
|
4513
4487
|
const selectedSchema = props.schema.oneOf[schemaIndex != null ? schemaIndex : -1];
|
|
4514
4488
|
if (isConstSchema(selectedSchema)) {
|
|
4515
|
-
return getValidationFailures(selectedSchema.const, props.schema,
|
|
4489
|
+
return getValidationFailures(selectedSchema.const, props.schema, Boolean(props.required));
|
|
4516
4490
|
}
|
|
4517
4491
|
if (schemaIndex === null || schemaIndex < 0) {
|
|
4518
|
-
return getValidationFailures(null, props.schema,
|
|
4492
|
+
return getValidationFailures(null, props.schema, Boolean(props.required));
|
|
4519
4493
|
}
|
|
4520
4494
|
return [];
|
|
4521
4495
|
}
|
|
@@ -4541,15 +4515,15 @@ OneOfSchema.defaultProps = {
|
|
|
4541
4515
|
};
|
|
4542
4516
|
var OneOfSchema_default = OneOfSchema;
|
|
4543
4517
|
|
|
4544
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4518
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4545
4519
|
var import_classnames5 = __toESM(require_classnames());
|
|
4546
4520
|
var import_react19 = require("react");
|
|
4547
4521
|
|
|
4548
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4522
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4549
4523
|
var import_components15 = require("@transferwise/components");
|
|
4550
4524
|
var import_react18 = require("react");
|
|
4551
4525
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4552
|
-
|
|
4526
|
+
function UploadInputAdapter(props) {
|
|
4553
4527
|
const {
|
|
4554
4528
|
id,
|
|
4555
4529
|
httpClient = fetch,
|
|
@@ -4567,19 +4541,18 @@ var UploadInputAdapter = (props) => {
|
|
|
4567
4541
|
const files = (0, import_react18.useMemo)(() => fileId ? [{ id: fileId, status: import_components15.Status.SUCCEEDED }] : [], [fileId]);
|
|
4568
4542
|
const uploadFile = (formData) => {
|
|
4569
4543
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4570
|
-
return httpClient(
|
|
4544
|
+
return httpClient(String(httpOptions.url), {
|
|
4571
4545
|
method: httpOptions.method || "POST",
|
|
4572
4546
|
body: formData
|
|
4573
4547
|
}).then((response) => {
|
|
4574
4548
|
if (response.ok) {
|
|
4575
|
-
onSuccess
|
|
4576
|
-
return response.json().then((responseBody) => {
|
|
4577
|
-
|
|
4578
|
-
});
|
|
4579
|
-
} else {
|
|
4580
|
-
onFailure && onFailure({ response });
|
|
4581
|
-
return Promise.reject();
|
|
4549
|
+
onSuccess == null ? void 0 : onSuccess(response.clone());
|
|
4550
|
+
return response.json().then((responseBody) => ({
|
|
4551
|
+
id: responseBody[idProperty]
|
|
4552
|
+
}));
|
|
4582
4553
|
}
|
|
4554
|
+
onFailure == null ? void 0 : onFailure({ response });
|
|
4555
|
+
return Promise.reject();
|
|
4583
4556
|
});
|
|
4584
4557
|
};
|
|
4585
4558
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -4594,16 +4567,16 @@ var UploadInputAdapter = (props) => {
|
|
|
4594
4567
|
description: usPlaceholder,
|
|
4595
4568
|
onUploadFile: uploadFile,
|
|
4596
4569
|
onDeleteFile: (_id) => {
|
|
4597
|
-
onCancel
|
|
4570
|
+
onCancel == null ? void 0 : onCancel();
|
|
4598
4571
|
return Promise.resolve();
|
|
4599
4572
|
}
|
|
4600
4573
|
}
|
|
4601
4574
|
);
|
|
4602
|
-
}
|
|
4575
|
+
}
|
|
4603
4576
|
|
|
4604
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4577
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4605
4578
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4606
|
-
|
|
4579
|
+
function PersistAsyncBlobSchema(props) {
|
|
4607
4580
|
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4608
4581
|
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4609
4582
|
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
@@ -4612,7 +4585,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4612
4585
|
const onEvent = useEventDispatcher();
|
|
4613
4586
|
const refreshValidations = () => {
|
|
4614
4587
|
if (props.submitted) {
|
|
4615
|
-
setValidations(getValidationFailures(props.model, props.schema,
|
|
4588
|
+
setValidations(getValidationFailures(props.model, props.schema, Boolean(props.required)));
|
|
4616
4589
|
}
|
|
4617
4590
|
};
|
|
4618
4591
|
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
@@ -4642,7 +4615,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4642
4615
|
const combinedValidations = persistAsyncValidations || validations;
|
|
4643
4616
|
const formGroupClasses = {
|
|
4644
4617
|
"form-group": true,
|
|
4645
|
-
"has-error": (props.submitted || changed) &&
|
|
4618
|
+
"has-error": (props.submitted || changed) && Boolean(combinedValidations.length)
|
|
4646
4619
|
};
|
|
4647
4620
|
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4648
4621
|
const feedbackId = `${id}-feedback`;
|
|
@@ -4682,15 +4655,15 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4682
4655
|
}
|
|
4683
4656
|
)
|
|
4684
4657
|
] });
|
|
4685
|
-
}
|
|
4658
|
+
}
|
|
4686
4659
|
PersistAsyncBlobSchema.defaultProps = {
|
|
4687
4660
|
required: false
|
|
4688
4661
|
};
|
|
4689
4662
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4690
4663
|
|
|
4691
|
-
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4664
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4692
4665
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4693
|
-
|
|
4666
|
+
function PersistAsyncSchema(props) {
|
|
4694
4667
|
const { schema } = props;
|
|
4695
4668
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4696
4669
|
if (persistAsyncSchemaType === "blob") {
|
|
@@ -4700,16 +4673,16 @@ var PersistAsyncSchema = (props) => {
|
|
|
4700
4673
|
);
|
|
4701
4674
|
}
|
|
4702
4675
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
4703
|
-
}
|
|
4676
|
+
}
|
|
4704
4677
|
PersistAsyncSchema.defaultProps = {
|
|
4705
4678
|
required: false
|
|
4706
4679
|
};
|
|
4707
4680
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4708
4681
|
|
|
4709
|
-
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4682
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4710
4683
|
var import_react20 = require("react");
|
|
4711
4684
|
|
|
4712
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4685
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4713
4686
|
var getSelectionFromModel = (schema, model) => {
|
|
4714
4687
|
const index = getBestMatchingSchemaIndexForValue(schema, model);
|
|
4715
4688
|
if (index !== null) {
|
|
@@ -4718,7 +4691,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4718
4691
|
return null;
|
|
4719
4692
|
};
|
|
4720
4693
|
|
|
4721
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4694
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4722
4695
|
var import_components16 = require("@transferwise/components");
|
|
4723
4696
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4724
4697
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
@@ -4736,10 +4709,10 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4736
4709
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4737
4710
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4738
4711
|
|
|
4739
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4712
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4740
4713
|
var import_components17 = require("@transferwise/components");
|
|
4741
4714
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4742
|
-
|
|
4715
|
+
function PromotedOneOfRadioControl(props) {
|
|
4743
4716
|
var _a, _b;
|
|
4744
4717
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
4745
4718
|
const radios = [
|
|
@@ -4768,15 +4741,15 @@ var PromotedOneOfRadioControl = (props) => {
|
|
|
4768
4741
|
}
|
|
4769
4742
|
)
|
|
4770
4743
|
] });
|
|
4771
|
-
}
|
|
4744
|
+
}
|
|
4772
4745
|
PromotedOneOfRadioControl.defaultProps = {
|
|
4773
4746
|
title: void 0
|
|
4774
4747
|
};
|
|
4775
4748
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4776
4749
|
|
|
4777
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4750
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4778
4751
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4779
|
-
|
|
4752
|
+
function PromotedOneOfControl(props) {
|
|
4780
4753
|
const controlType = props.promotion.control || "radio";
|
|
4781
4754
|
switch (controlType) {
|
|
4782
4755
|
case "radio":
|
|
@@ -4786,14 +4759,14 @@ var PromotedOneOfControl = (props) => {
|
|
|
4786
4759
|
default:
|
|
4787
4760
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
|
|
4788
4761
|
}
|
|
4789
|
-
}
|
|
4762
|
+
}
|
|
4790
4763
|
PromotedOneOfControl.defaultProps = {
|
|
4791
4764
|
id: generateRandomId(),
|
|
4792
4765
|
title: void 0
|
|
4793
4766
|
};
|
|
4794
4767
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4795
4768
|
|
|
4796
|
-
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4769
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4797
4770
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4798
4771
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4799
4772
|
var PromotedOneOfSchema = (props) => {
|
|
@@ -4848,11 +4821,11 @@ function getOtherOneOf(schema) {
|
|
|
4848
4821
|
}
|
|
4849
4822
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
4850
4823
|
|
|
4851
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4824
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4852
4825
|
var import_components18 = require("@transferwise/components");
|
|
4853
4826
|
var import_react_intl15 = require("react-intl");
|
|
4854
4827
|
|
|
4855
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
|
|
4828
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
|
|
4856
4829
|
var import_react_intl14 = require("react-intl");
|
|
4857
4830
|
var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
4858
4831
|
yes: {
|
|
@@ -4867,14 +4840,14 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
4867
4840
|
}
|
|
4868
4841
|
});
|
|
4869
4842
|
|
|
4870
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4843
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4871
4844
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4872
|
-
|
|
4845
|
+
function ReadOnlySchema({ schema, model }) {
|
|
4873
4846
|
const { title = "" } = schema;
|
|
4874
4847
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
4875
4848
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4876
4849
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components18.DefinitionList, { layout: import_components18.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4877
|
-
}
|
|
4850
|
+
}
|
|
4878
4851
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4879
4852
|
function getValueForSchema({
|
|
4880
4853
|
schema,
|
|
@@ -4899,9 +4872,9 @@ function getValueFromOneOfSchema(schema, model) {
|
|
|
4899
4872
|
return option ? getValueFromOption(option) : model;
|
|
4900
4873
|
}
|
|
4901
4874
|
function getSelectedOneOf(schema, model) {
|
|
4902
|
-
return schema.oneOf.find(
|
|
4903
|
-
|
|
4904
|
-
|
|
4875
|
+
return schema.oneOf.find(
|
|
4876
|
+
(childSchema) => "const" in childSchema ? model === childSchema.const : false
|
|
4877
|
+
);
|
|
4905
4878
|
}
|
|
4906
4879
|
function getValueFromOption(option) {
|
|
4907
4880
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
@@ -4913,10 +4886,10 @@ function getValueFromOption(option) {
|
|
|
4913
4886
|
] }) : text;
|
|
4914
4887
|
}
|
|
4915
4888
|
|
|
4916
|
-
// src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4889
|
+
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4917
4890
|
var import_react21 = require("react");
|
|
4918
4891
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4919
|
-
|
|
4892
|
+
function ValidationAsyncSchema(props) {
|
|
4920
4893
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4921
4894
|
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react21.useState)(model);
|
|
4922
4895
|
const previousRequestedModelReference = (0, import_react21.useRef)(null);
|
|
@@ -5000,14 +4973,14 @@ var ValidationAsyncSchema = (props) => {
|
|
|
5000
4973
|
schema
|
|
5001
4974
|
};
|
|
5002
4975
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
5003
|
-
}
|
|
4976
|
+
}
|
|
5004
4977
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
5005
4978
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
5006
4979
|
|
|
5007
|
-
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4980
|
+
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
5008
4981
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5009
4982
|
var import_react23 = require("react");
|
|
5010
|
-
|
|
4983
|
+
function GenericSchemaForm(props) {
|
|
5011
4984
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
5012
4985
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
5013
4986
|
const type = getSchemaType(schema);
|
|
@@ -5028,7 +5001,9 @@ var GenericSchemaForm = (props) => {
|
|
|
5028
5001
|
case "validationAsync":
|
|
5029
5002
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
5030
5003
|
case "basic": {
|
|
5031
|
-
const basicTypeProps = __spreadValues({
|
|
5004
|
+
const basicTypeProps = __spreadValues({
|
|
5005
|
+
infoMessage: null
|
|
5006
|
+
}, schemaProps);
|
|
5032
5007
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
5033
5008
|
}
|
|
5034
5009
|
case "object":
|
|
@@ -5043,7 +5018,7 @@ var GenericSchemaForm = (props) => {
|
|
|
5043
5018
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
5044
5019
|
}
|
|
5045
5020
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {});
|
|
5046
|
-
}
|
|
5021
|
+
}
|
|
5047
5022
|
var GenericSchema_default = GenericSchemaForm;
|
|
5048
5023
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
5049
5024
|
const type = getSchemaType(schema);
|
|
@@ -5068,16 +5043,16 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
5068
5043
|
return false;
|
|
5069
5044
|
};
|
|
5070
5045
|
|
|
5071
|
-
// src/layout/form/DynamicForm.tsx
|
|
5046
|
+
// src/legacy/layout/form/DynamicForm.tsx
|
|
5072
5047
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5073
|
-
|
|
5048
|
+
function DynamicForm({
|
|
5074
5049
|
component,
|
|
5075
5050
|
model = null,
|
|
5076
5051
|
errors = null,
|
|
5077
5052
|
submitted,
|
|
5078
5053
|
onModelChange,
|
|
5079
5054
|
onPersistAsync
|
|
5080
|
-
})
|
|
5055
|
+
}) {
|
|
5081
5056
|
const formSchema = component.schema;
|
|
5082
5057
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5083
5058
|
GenericSchema_default,
|
|
@@ -5092,14 +5067,19 @@ var DynamicForm = ({
|
|
|
5092
5067
|
onPersistAsync
|
|
5093
5068
|
}
|
|
5094
5069
|
) });
|
|
5095
|
-
}
|
|
5070
|
+
}
|
|
5096
5071
|
var DynamicForm_default = DynamicForm;
|
|
5097
5072
|
|
|
5098
|
-
// src/layout/heading/DynamicHeading.tsx
|
|
5073
|
+
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
5074
|
+
var import_components19 = require("@transferwise/components");
|
|
5075
|
+
var import_classnames6 = __toESM(require_classnames());
|
|
5099
5076
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5100
5077
|
var DynamicHeading = (props) => {
|
|
5101
|
-
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
5102
|
-
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
5078
|
+
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
5079
|
+
const classes = (0, import_classnames6.default)(getTextAlignmentAndMargin({ align, margin }));
|
|
5080
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DisplayHeading, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StandardHeading, { size, text, classes });
|
|
5081
|
+
};
|
|
5082
|
+
var StandardHeading = ({ size, text, classes }) => {
|
|
5103
5083
|
switch (size) {
|
|
5104
5084
|
case "xs":
|
|
5105
5085
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h5", { className: classes, children: text });
|
|
@@ -5114,24 +5094,37 @@ var DynamicHeading = (props) => {
|
|
|
5114
5094
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { className: classes, children: text });
|
|
5115
5095
|
}
|
|
5116
5096
|
};
|
|
5097
|
+
var DisplayHeading = ({ size, text, classes }) => {
|
|
5098
|
+
switch (size) {
|
|
5099
|
+
case "xs":
|
|
5100
|
+
case "sm":
|
|
5101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-small", className: classes, children: text });
|
|
5102
|
+
case "xl":
|
|
5103
|
+
case "lg":
|
|
5104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-large", className: classes, children: text });
|
|
5105
|
+
case "md":
|
|
5106
|
+
default:
|
|
5107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-medium", className: classes, children: text });
|
|
5108
|
+
}
|
|
5109
|
+
};
|
|
5117
5110
|
var DynamicHeading_default = DynamicHeading;
|
|
5118
5111
|
|
|
5119
|
-
// src/layout/markdown/DynamicMarkdown.tsx
|
|
5120
|
-
var
|
|
5112
|
+
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
5113
|
+
var import_components20 = require("@transferwise/components");
|
|
5121
5114
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5122
5115
|
var DynamicMarkdown = ({ component }) => {
|
|
5123
5116
|
const { content, align, margin } = component;
|
|
5124
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components20.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
5125
5118
|
};
|
|
5126
5119
|
var DynamicInfo = ({ component }) => {
|
|
5127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components20.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
5128
5121
|
};
|
|
5129
5122
|
|
|
5130
|
-
// src/layout/image/DynamicImage.tsx
|
|
5131
|
-
var
|
|
5123
|
+
// src/legacy/layout/image/DynamicImage.tsx
|
|
5124
|
+
var import_components21 = require("@transferwise/components");
|
|
5132
5125
|
var import_react24 = require("react");
|
|
5133
5126
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5134
|
-
|
|
5127
|
+
function DynamicImage({ component: image }) {
|
|
5135
5128
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
5136
5129
|
const httpClient = useHttpClient();
|
|
5137
5130
|
const [imageSource, setImageSource] = (0, import_react24.useState)("");
|
|
@@ -5147,20 +5140,23 @@ var DynamicImage = ({ component: image }) => {
|
|
|
5147
5140
|
if (!imageSource) {
|
|
5148
5141
|
return null;
|
|
5149
5142
|
}
|
|
5150
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
5151
|
-
}
|
|
5152
|
-
var readImageBlobAsDataURL = (imageBlob) =>
|
|
5153
|
-
|
|
5143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components21.Image, __spreadValues({ className: `img-responsive ${getMargin(margin || "md")}` }, imageProps)) });
|
|
5144
|
+
}
|
|
5145
|
+
var readImageBlobAsDataURL = (imageBlob) => (
|
|
5146
|
+
// we can safely assume the type of reader.result is string
|
|
5147
|
+
// because we're calling reader.readAsDataURL
|
|
5148
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
5149
|
+
new Promise((resolve, reject) => {
|
|
5154
5150
|
const reader = new FileReader();
|
|
5155
5151
|
reader.addEventListener("loadend", () => resolve(reader.result));
|
|
5156
5152
|
reader.addEventListener("error", (error) => reject(error));
|
|
5157
5153
|
reader.readAsDataURL(imageBlob);
|
|
5158
|
-
})
|
|
5159
|
-
|
|
5154
|
+
})
|
|
5155
|
+
);
|
|
5160
5156
|
var getImageSource = async (httpClient, imageUrl) => {
|
|
5161
5157
|
var _a;
|
|
5162
5158
|
try {
|
|
5163
|
-
if (
|
|
5159
|
+
if (isRelativePath2(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
5164
5160
|
return httpClient(imageUrl, {
|
|
5165
5161
|
method: "GET",
|
|
5166
5162
|
headers: { "Content-Type": "image/image" },
|
|
@@ -5179,8 +5175,8 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
5179
5175
|
};
|
|
5180
5176
|
var DynamicImage_default = DynamicImage;
|
|
5181
5177
|
|
|
5182
|
-
// src/layout/instructions/DynamicInstructions.tsx
|
|
5183
|
-
var
|
|
5178
|
+
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
5179
|
+
var import_components22 = require("@transferwise/components");
|
|
5184
5180
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5185
5181
|
var doContext = ["positive", "neutral"];
|
|
5186
5182
|
var dontContext = ["warning", "negative"];
|
|
@@ -5189,16 +5185,16 @@ var DynamicInstructions = ({ component }) => {
|
|
|
5189
5185
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
5190
5186
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
5191
5187
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5192
|
-
component.title ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5193
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
5188
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components22.Header, { title: component.title }) : null,
|
|
5189
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components22.InstructionsList, { dos, donts })
|
|
5194
5190
|
] });
|
|
5195
5191
|
};
|
|
5196
5192
|
var DynamicInstructions_default = DynamicInstructions;
|
|
5197
5193
|
|
|
5198
|
-
// src/layout/DynamicLayout.tsx
|
|
5194
|
+
// src/legacy/layout/DynamicLayout.tsx
|
|
5199
5195
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5200
5196
|
var getKey = (component) => JSON.stringify(component);
|
|
5201
|
-
|
|
5197
|
+
function DynamicLayout(props) {
|
|
5202
5198
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
5203
5199
|
const renderComponent = (component) => {
|
|
5204
5200
|
switch (component.type) {
|
|
@@ -5274,24 +5270,37 @@ var DynamicLayout = (props) => {
|
|
|
5274
5270
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5275
5271
|
case "search":
|
|
5276
5272
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5273
|
+
case "modal":
|
|
5274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5275
|
+
DynamicModal_default,
|
|
5276
|
+
{
|
|
5277
|
+
component,
|
|
5278
|
+
model,
|
|
5279
|
+
submitted,
|
|
5280
|
+
errors,
|
|
5281
|
+
onModelChange,
|
|
5282
|
+
onAction,
|
|
5283
|
+
onPersistAsync
|
|
5284
|
+
},
|
|
5285
|
+
getKey(component)
|
|
5286
|
+
);
|
|
5277
5287
|
default:
|
|
5278
5288
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", {}, getKey(component));
|
|
5279
5289
|
}
|
|
5280
5290
|
};
|
|
5281
5291
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5282
5292
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: components.map(renderComponent) });
|
|
5283
|
-
} else {
|
|
5284
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5285
5293
|
}
|
|
5286
|
-
};
|
|
5294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5295
|
+
}
|
|
5287
5296
|
var DynamicLayout_default = DynamicLayout;
|
|
5288
5297
|
|
|
5289
|
-
// src/layout/list/DynamicStatusList.tsx
|
|
5290
|
-
var
|
|
5298
|
+
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
5299
|
+
var import_components23 = require("@transferwise/components");
|
|
5291
5300
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5292
5301
|
var DynamicStatusList = ({ component }) => {
|
|
5293
5302
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5294
|
-
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5303
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components23.Header, { title: component.title }) : null,
|
|
5295
5304
|
component.items.map(mapListItemToSummary)
|
|
5296
5305
|
] });
|
|
5297
5306
|
};
|
|
@@ -5301,7 +5310,7 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5301
5310
|
title,
|
|
5302
5311
|
description
|
|
5303
5312
|
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
5304
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components23.Summary, __spreadValues({}, props));
|
|
5305
5314
|
};
|
|
5306
5315
|
var statusListMap = {
|
|
5307
5316
|
done: "done",
|
|
@@ -5316,13 +5325,13 @@ var legacyStatusMap = {
|
|
|
5316
5325
|
var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMap);
|
|
5317
5326
|
var DynamicStatusList_default = DynamicStatusList;
|
|
5318
5327
|
|
|
5319
|
-
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5320
|
-
var
|
|
5328
|
+
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5329
|
+
var import_components24 = require("@transferwise/components");
|
|
5321
5330
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5322
5331
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5323
5332
|
const { margin, size = "md" } = component;
|
|
5324
5333
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5325
|
-
|
|
5334
|
+
import_components24.Loader,
|
|
5326
5335
|
{
|
|
5327
5336
|
size,
|
|
5328
5337
|
classNames: {
|
|
@@ -5334,11 +5343,11 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
5334
5343
|
};
|
|
5335
5344
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
5336
5345
|
|
|
5337
|
-
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5338
|
-
var
|
|
5346
|
+
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5347
|
+
var import_components26 = require("@transferwise/components");
|
|
5339
5348
|
var import_react_intl17 = require("react-intl");
|
|
5340
5349
|
|
|
5341
|
-
// src/layout/paragraph/DynamicParagraph.messages.ts
|
|
5350
|
+
// src/legacy/layout/paragraph/DynamicParagraph.messages.ts
|
|
5342
5351
|
var import_react_intl16 = require("react-intl");
|
|
5343
5352
|
var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
5344
5353
|
copy: {
|
|
@@ -5353,17 +5362,17 @@ var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)(
|
|
|
5353
5362
|
}
|
|
5354
5363
|
});
|
|
5355
5364
|
|
|
5356
|
-
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5357
|
-
var
|
|
5365
|
+
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5366
|
+
var import_components25 = require("@transferwise/components");
|
|
5358
5367
|
var import_react25 = require("react");
|
|
5359
5368
|
function useSnackBarIfAvailable() {
|
|
5360
|
-
const context = (0, import_react25.useContext)(
|
|
5369
|
+
const context = (0, import_react25.useContext)(import_components25.SnackbarContext);
|
|
5361
5370
|
return context ? context.createSnackbar : noop2;
|
|
5362
5371
|
}
|
|
5363
5372
|
function noop2() {
|
|
5364
5373
|
}
|
|
5365
5374
|
|
|
5366
|
-
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5375
|
+
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5367
5376
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5368
5377
|
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BasicDynamicParagraph, { component });
|
|
5369
5378
|
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
@@ -5379,39 +5388,33 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5379
5388
|
var _a;
|
|
5380
5389
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop3);
|
|
5381
5390
|
};
|
|
5382
|
-
const
|
|
5391
|
+
const classNames8 = getTextAlignmentAndMargin({ align: component.align, margin: "sm" }) + " form-control";
|
|
5383
5392
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5384
5393
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5385
5394
|
"input",
|
|
5386
5395
|
{
|
|
5387
5396
|
type: "text",
|
|
5388
|
-
className:
|
|
5397
|
+
className: classNames8,
|
|
5389
5398
|
value: text,
|
|
5390
5399
|
readOnly: true,
|
|
5391
5400
|
style: { textOverflow: "ellipsis" }
|
|
5392
5401
|
}
|
|
5393
5402
|
),
|
|
5394
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5403
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components26.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5395
5404
|
] });
|
|
5396
5405
|
};
|
|
5397
5406
|
function noop3() {
|
|
5398
5407
|
}
|
|
5399
5408
|
var DynamicParagraph_default = DynamicParagraph;
|
|
5400
5409
|
|
|
5401
|
-
// src/layout/review/DynamicReview.tsx
|
|
5402
|
-
var
|
|
5410
|
+
// src/legacy/layout/review/DynamicReview.tsx
|
|
5411
|
+
var import_components27 = require("@transferwise/components");
|
|
5403
5412
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5404
|
-
var getDefinitions = (orientation, review) => {
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
title: label,
|
|
5410
|
-
value: getFieldValue(value, help, orientation)
|
|
5411
|
-
};
|
|
5412
|
-
}
|
|
5413
|
-
);
|
|
5414
|
-
};
|
|
5413
|
+
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
5414
|
+
key: String(index),
|
|
5415
|
+
title: label,
|
|
5416
|
+
value: getFieldValue(value, help, orientation)
|
|
5417
|
+
}));
|
|
5415
5418
|
var getFieldValue = (value, help, orientation) => {
|
|
5416
5419
|
if (help) {
|
|
5417
5420
|
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
@@ -5430,7 +5433,7 @@ var getReviewLayout = (review) => {
|
|
|
5430
5433
|
const orientation = review.control || review.orientation;
|
|
5431
5434
|
return orientation === "horizontal" ? "HORIZONTAL_RIGHT_ALIGNED" : "VERTICAL_ONE_COLUMN";
|
|
5432
5435
|
};
|
|
5433
|
-
|
|
5436
|
+
function DynamicReview(props) {
|
|
5434
5437
|
const review = props.component;
|
|
5435
5438
|
const margin = getMargin(review.margin || "xs");
|
|
5436
5439
|
const getReviewAction = (title, action) => ({
|
|
@@ -5447,23 +5450,23 @@ var DynamicReview = (props) => {
|
|
|
5447
5450
|
const callToAction = review.callToAction ? getReviewAction(review.callToAction.title, review.callToAction.action) : null;
|
|
5448
5451
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction(review.action.title || "", review.action) : null;
|
|
5449
5452
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: margin, children: [
|
|
5450
|
-
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5451
|
-
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
5453
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components27.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
5454
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components27.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
5452
5455
|
] });
|
|
5453
|
-
}
|
|
5456
|
+
}
|
|
5454
5457
|
var DynamicReview_default = DynamicReview;
|
|
5455
5458
|
|
|
5456
|
-
// src/layout/search/DynamicSearch.tsx
|
|
5459
|
+
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5457
5460
|
var import_react27 = require("react");
|
|
5458
5461
|
|
|
5459
|
-
// src/layout/search/SearchInput.tsx
|
|
5460
|
-
var
|
|
5462
|
+
// src/legacy/layout/search/SearchInput.tsx
|
|
5463
|
+
var import_components28 = require("@transferwise/components");
|
|
5461
5464
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5462
5465
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5463
5466
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5464
5467
|
title,
|
|
5465
5468
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5466
|
-
|
|
5469
|
+
import_components28.Input,
|
|
5467
5470
|
{
|
|
5468
5471
|
type: "text",
|
|
5469
5472
|
value,
|
|
@@ -5475,11 +5478,11 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
5475
5478
|
] });
|
|
5476
5479
|
};
|
|
5477
5480
|
|
|
5478
|
-
// src/layout/search/SearchResults.tsx
|
|
5479
|
-
var
|
|
5481
|
+
// src/legacy/layout/search/SearchResults.tsx
|
|
5482
|
+
var import_components29 = require("@transferwise/components");
|
|
5480
5483
|
var import_react_intl19 = require("react-intl");
|
|
5481
5484
|
|
|
5482
|
-
// src/
|
|
5485
|
+
// src/common/errorBoundary/ErrorBoundary.messages.ts
|
|
5483
5486
|
var import_react_intl18 = require("react-intl");
|
|
5484
5487
|
var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
5485
5488
|
errorAlert: {
|
|
@@ -5494,15 +5497,15 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5494
5497
|
}
|
|
5495
5498
|
});
|
|
5496
5499
|
|
|
5497
|
-
// src/layout/search/SearchResults.tsx
|
|
5500
|
+
// src/legacy/layout/search/SearchResults.tsx
|
|
5498
5501
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5499
5502
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5500
5503
|
if (results.length === 0) {
|
|
5501
5504
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5502
5505
|
}
|
|
5503
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components29.NavigationOptionsList, { children: results.map((result) => {
|
|
5504
5507
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5505
|
-
|
|
5508
|
+
import_components29.NavigationOption,
|
|
5506
5509
|
{
|
|
5507
5510
|
title: result.title,
|
|
5508
5511
|
content: result.description,
|
|
@@ -5534,7 +5537,7 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
5534
5537
|
] });
|
|
5535
5538
|
};
|
|
5536
5539
|
|
|
5537
|
-
// src/layout/search/useSearch.tsx
|
|
5540
|
+
// src/legacy/layout/search/useSearch.tsx
|
|
5538
5541
|
var import_react26 = require("react");
|
|
5539
5542
|
var headers = { "Content-Type": "application/json" };
|
|
5540
5543
|
var useSearch = (defaultSearchConfig) => {
|
|
@@ -5552,7 +5555,7 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5552
5555
|
return;
|
|
5553
5556
|
}
|
|
5554
5557
|
abortControllerRef.current = new AbortController();
|
|
5555
|
-
const signal = abortControllerRef.current
|
|
5558
|
+
const { signal } = abortControllerRef.current;
|
|
5556
5559
|
setState({ status: "loading" });
|
|
5557
5560
|
try {
|
|
5558
5561
|
const request = method === "GET" ? httpClient(addQueryParameter(url, param, query), {
|
|
@@ -5568,7 +5571,7 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5568
5571
|
const response = await request;
|
|
5569
5572
|
void handleResponse(response, query);
|
|
5570
5573
|
} catch (error) {
|
|
5571
|
-
|
|
5574
|
+
handleError(error, query);
|
|
5572
5575
|
}
|
|
5573
5576
|
},
|
|
5574
5577
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5585,18 +5588,16 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5585
5588
|
setState({ status: "error" });
|
|
5586
5589
|
};
|
|
5587
5590
|
const handleError = (error, query) => {
|
|
5588
|
-
if (isAbortError(error)
|
|
5591
|
+
if (!isAbortError(error)) {
|
|
5589
5592
|
setState({ status: "error" });
|
|
5590
5593
|
}
|
|
5591
5594
|
};
|
|
5592
5595
|
const results = state.status === "success" ? state.results : [];
|
|
5593
5596
|
return { status: state.status, results, search };
|
|
5594
5597
|
};
|
|
5595
|
-
var isValidResponseBody = (body) =>
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
);
|
|
5599
|
-
};
|
|
5598
|
+
var isValidResponseBody = (body) => isObject(body) && "results" in body && isArray(body.results) && body.results.every(
|
|
5599
|
+
(result) => isObject(result) && "title" in result && "type" in result && "value" in result
|
|
5600
|
+
);
|
|
5600
5601
|
var isAbortError = (error) => error instanceof DOMException && error.name === "AbortError";
|
|
5601
5602
|
var addQueryParameter = (url, key, value) => {
|
|
5602
5603
|
const [urlBase, urlQuery] = url.split("?");
|
|
@@ -5605,10 +5606,10 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5605
5606
|
return `${urlBase}?${urlQueryParams.toString()}`;
|
|
5606
5607
|
};
|
|
5607
5608
|
|
|
5608
|
-
// src/layout/search/DynamicSearch.tsx
|
|
5609
|
+
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5609
5610
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5610
5611
|
var DEBOUNCE_TIME = 400;
|
|
5611
|
-
|
|
5612
|
+
function DynamicSearch({ component, onAction }) {
|
|
5612
5613
|
const [query, setQuery] = (0, import_react27.useState)("");
|
|
5613
5614
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5614
5615
|
const { status, results, search } = useSearch({ url, method, param });
|
|
@@ -5640,17 +5641,41 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5640
5641
|
setQuery(query);
|
|
5641
5642
|
void search(query);
|
|
5642
5643
|
};
|
|
5643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
5644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin || "md"), children: [
|
|
5644
5645
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5645
5646
|
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5646
5647
|
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { onRetrySearch }),
|
|
5647
5648
|
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5648
5649
|
] });
|
|
5649
|
-
}
|
|
5650
|
+
}
|
|
5650
5651
|
var DynamicSearch_default = DynamicSearch;
|
|
5651
5652
|
|
|
5652
|
-
// src/
|
|
5653
|
+
// src/legacy/layout/modal/DynamicModal.tsx
|
|
5654
|
+
var import_components30 = require("@transferwise/components");
|
|
5655
|
+
var import_react28 = require("react");
|
|
5653
5656
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5657
|
+
var DynamicModal = (props) => {
|
|
5658
|
+
const [visible, isVisible] = (0, import_react28.useState)(false);
|
|
5659
|
+
const { component, onAction } = props;
|
|
5660
|
+
const { margin = "md" } = component;
|
|
5661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getTextAlignmentAndMargin({ margin }), children: [
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components30.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
5663
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5664
|
+
import_components30.Modal,
|
|
5665
|
+
{
|
|
5666
|
+
scroll: "content",
|
|
5667
|
+
onClose: () => isVisible(false),
|
|
5668
|
+
open: visible,
|
|
5669
|
+
size: "lg",
|
|
5670
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicLayout_default, __spreadProps(__spreadValues({}, props), { components: component.content.components, onAction }))
|
|
5671
|
+
}
|
|
5672
|
+
)
|
|
5673
|
+
] });
|
|
5674
|
+
};
|
|
5675
|
+
var DynamicModal_default = DynamicModal;
|
|
5676
|
+
|
|
5677
|
+
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5678
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5654
5679
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5655
5680
|
var getDefaultValue = (schema) => {
|
|
5656
5681
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5687,13 +5712,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5687
5712
|
props.onBlur();
|
|
5688
5713
|
}
|
|
5689
5714
|
};
|
|
5690
|
-
const [model, setModel] = (0,
|
|
5691
|
-
const [lastModel, setLastModel] = (0,
|
|
5692
|
-
const [changed, setChanged] = (0,
|
|
5693
|
-
const [focused, setFocused] = (0,
|
|
5694
|
-
const [blurred, setBlurred] = (0,
|
|
5695
|
-
const [validations, setValidations] = (0,
|
|
5696
|
-
const id = (0,
|
|
5715
|
+
const [model, setModel] = (0, import_react29.useState)((_a = props.model) != null ? _a : null);
|
|
5716
|
+
const [lastModel, setLastModel] = (0, import_react29.useState)((_b = props.model) != null ? _b : null);
|
|
5717
|
+
const [changed, setChanged] = (0, import_react29.useState)(false);
|
|
5718
|
+
const [focused, setFocused] = (0, import_react29.useState)(false);
|
|
5719
|
+
const [blurred, setBlurred] = (0, import_react29.useState)(false);
|
|
5720
|
+
const [validations, setValidations] = (0, import_react29.useState)([]);
|
|
5721
|
+
const id = (0, import_react29.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5697
5722
|
const onSchemaChange = () => {
|
|
5698
5723
|
const defaultValue = getDefaultValue(props.schema);
|
|
5699
5724
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5708,9 +5733,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5708
5733
|
};
|
|
5709
5734
|
const isConst = props.schema.const;
|
|
5710
5735
|
const isHidden = props.schema.hidden || isConst;
|
|
5711
|
-
(0,
|
|
5712
|
-
(0,
|
|
5713
|
-
(0,
|
|
5736
|
+
(0, import_react29.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5737
|
+
(0, import_react29.useEffect)(onSchemaChange, [props.schema]);
|
|
5738
|
+
(0, import_react29.useEffect)(() => {
|
|
5714
5739
|
var _a2;
|
|
5715
5740
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
5716
5741
|
if (newModel !== model) {
|
|
@@ -5725,15 +5750,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5725
5750
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5726
5751
|
const schemaHelp = props.schema.help;
|
|
5727
5752
|
const feedbackId = `${id}-feedback`;
|
|
5728
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
5729
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
5730
|
-
/* @__PURE__ */ (0,
|
|
5731
|
-
showLabel && /* @__PURE__ */ (0,
|
|
5732
|
-
/* @__PURE__ */ (0,
|
|
5733
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
5753
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
5754
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: (0, import_classnames7.default)(formGroupClasses), children: [
|
|
5756
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
5757
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5758
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help: schemaHelp })
|
|
5734
5759
|
] }),
|
|
5735
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5736
|
-
/* @__PURE__ */ (0,
|
|
5760
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help: schemaHelp }),
|
|
5761
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5737
5762
|
SchemaFormControl_default,
|
|
5738
5763
|
{
|
|
5739
5764
|
id,
|
|
@@ -5746,7 +5771,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5746
5771
|
describedBy: feedbackId
|
|
5747
5772
|
}
|
|
5748
5773
|
),
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
5774
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5750
5775
|
ControlFeedback_default,
|
|
5751
5776
|
{
|
|
5752
5777
|
id: feedbackId,
|
|
@@ -5770,11 +5795,9 @@ BasicTypeSchema.defaultProps = {
|
|
|
5770
5795
|
};
|
|
5771
5796
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5772
5797
|
|
|
5773
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5774
|
-
var
|
|
5775
|
-
var getIdFromResponse = (idProperty, response) =>
|
|
5776
|
-
return response[idProperty];
|
|
5777
|
-
};
|
|
5798
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5799
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5800
|
+
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
5778
5801
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
5779
5802
|
var _a;
|
|
5780
5803
|
return (_a = response.validation) == null ? void 0 : _a[errorProperty];
|
|
@@ -5786,17 +5809,17 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
5786
5809
|
FormControlType.FILE,
|
|
5787
5810
|
FormControlType.UPLOAD
|
|
5788
5811
|
]);
|
|
5789
|
-
|
|
5812
|
+
function PersistAsyncBasicSchema(props) {
|
|
5790
5813
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
5791
5814
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5792
5815
|
const httpClient = useHttpClient();
|
|
5793
5816
|
const onEvent = useEventDispatcher();
|
|
5794
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5817
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react30.useState)(null);
|
|
5795
5818
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5796
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
5797
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
5798
|
-
const [abortController, setAbortController] = (0,
|
|
5799
|
-
(0,
|
|
5819
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react30.useState)(null);
|
|
5820
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react30.useState)(false);
|
|
5821
|
+
const [abortController, setAbortController] = (0, import_react30.useState)(null);
|
|
5822
|
+
(0, import_react30.useEffect)(() => {
|
|
5800
5823
|
if (controlTypesWithPersistOnChange.has(
|
|
5801
5824
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5802
5825
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5863,7 +5886,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5863
5886
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5864
5887
|
}
|
|
5865
5888
|
};
|
|
5866
|
-
return /* @__PURE__ */ (0,
|
|
5889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5867
5890
|
BasicTypeSchema_default,
|
|
5868
5891
|
{
|
|
5869
5892
|
required,
|
|
@@ -5876,15 +5899,15 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5876
5899
|
onBlur
|
|
5877
5900
|
}
|
|
5878
5901
|
);
|
|
5879
|
-
}
|
|
5902
|
+
}
|
|
5880
5903
|
PersistAsyncBasicSchema.defaultProps = {
|
|
5881
5904
|
required: false
|
|
5882
5905
|
};
|
|
5883
5906
|
var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
5884
5907
|
|
|
5885
|
-
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5908
|
+
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5886
5909
|
var usePersistAsync = (persistAsync) => {
|
|
5887
|
-
const [abortController, setAbortController] = (0,
|
|
5910
|
+
const [abortController, setAbortController] = (0, import_react31.useState)(null);
|
|
5888
5911
|
const httpClient = useHttpClient();
|
|
5889
5912
|
const intl = (0, import_react_intl21.useIntl)();
|
|
5890
5913
|
const { schema } = persistAsync;
|
|
@@ -5962,8 +5985,8 @@ function hasStringMessage(value) {
|
|
|
5962
5985
|
return isObject(value) && "message" in value && typeof value.message === "string";
|
|
5963
5986
|
}
|
|
5964
5987
|
|
|
5965
|
-
// src/common/hooks/usePolling/usePolling.tsx
|
|
5966
|
-
var
|
|
5988
|
+
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
5989
|
+
var import_react32 = require("react");
|
|
5967
5990
|
function usePolling({
|
|
5968
5991
|
asyncFn,
|
|
5969
5992
|
interval,
|
|
@@ -5972,9 +5995,9 @@ function usePolling({
|
|
|
5972
5995
|
onPollingResponse,
|
|
5973
5996
|
onFailure
|
|
5974
5997
|
}) {
|
|
5975
|
-
const onPollingResponseReference = (0,
|
|
5976
|
-
const onFailureReference = (0,
|
|
5977
|
-
const poll = (0,
|
|
5998
|
+
const onPollingResponseReference = (0, import_react32.useRef)(onPollingResponse);
|
|
5999
|
+
const onFailureReference = (0, import_react32.useRef)(onFailure);
|
|
6000
|
+
const poll = (0, import_react32.useMemo)(
|
|
5978
6001
|
() => createPollingClosure(
|
|
5979
6002
|
asyncFn,
|
|
5980
6003
|
maxAttempts,
|
|
@@ -5984,7 +6007,7 @@ function usePolling({
|
|
|
5984
6007
|
),
|
|
5985
6008
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5986
6009
|
);
|
|
5987
|
-
(0,
|
|
6010
|
+
(0, import_react32.useEffect)(() => {
|
|
5988
6011
|
if (interval > 0) {
|
|
5989
6012
|
const intervalReference = setInterval(() => {
|
|
5990
6013
|
poll();
|
|
@@ -5992,7 +6015,7 @@ function usePolling({
|
|
|
5992
6015
|
return () => clearInterval(intervalReference);
|
|
5993
6016
|
}
|
|
5994
6017
|
}, [poll, interval]);
|
|
5995
|
-
(0,
|
|
6018
|
+
(0, import_react32.useEffect)(() => {
|
|
5996
6019
|
onPollingResponseReference.current = onPollingResponse;
|
|
5997
6020
|
onFailureReference.current = onFailure;
|
|
5998
6021
|
}, [onPollingResponse, onFailure]);
|
|
@@ -6020,36 +6043,32 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
6020
6043
|
};
|
|
6021
6044
|
}
|
|
6022
6045
|
|
|
6023
|
-
// src/common/hooks/usePrevious/usePrevious.js
|
|
6024
|
-
var
|
|
6046
|
+
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
6047
|
+
var import_react33 = require("react");
|
|
6025
6048
|
var usePrevious = (value) => {
|
|
6026
|
-
const reference = (0,
|
|
6027
|
-
(0,
|
|
6049
|
+
const reference = (0, import_react33.useRef)();
|
|
6050
|
+
(0, import_react33.useEffect)(() => {
|
|
6028
6051
|
reference.current = value;
|
|
6029
6052
|
}, [value]);
|
|
6030
6053
|
return reference.current;
|
|
6031
6054
|
};
|
|
6032
6055
|
|
|
6033
|
-
// src/common/hooks/useStepPolling/useStepPolling.tsx
|
|
6034
|
-
var
|
|
6056
|
+
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
6057
|
+
var import_react34 = require("react");
|
|
6035
6058
|
function useStepPolling(polling, onAction) {
|
|
6036
6059
|
const httpClient = useHttpClient();
|
|
6037
|
-
const asyncFn = (0,
|
|
6060
|
+
const asyncFn = (0, import_react34.useMemo)(() => {
|
|
6038
6061
|
if (polling) {
|
|
6039
|
-
return () => {
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
}
|
|
6046
|
-
});
|
|
6047
|
-
};
|
|
6048
|
-
} else {
|
|
6049
|
-
return void 0;
|
|
6062
|
+
return () => httpClient(polling.url).then((response) => {
|
|
6063
|
+
if (response.ok) {
|
|
6064
|
+
return response.json().then((pollingResponse) => pollingResponse).catch((error) => null);
|
|
6065
|
+
}
|
|
6066
|
+
throw new Error("failed");
|
|
6067
|
+
});
|
|
6050
6068
|
}
|
|
6069
|
+
return void 0;
|
|
6051
6070
|
}, [polling, httpClient]);
|
|
6052
|
-
const onPollingResponse = (0,
|
|
6071
|
+
const onPollingResponse = (0, import_react34.useCallback)(
|
|
6053
6072
|
(pollingResponse) => {
|
|
6054
6073
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
6055
6074
|
onAction(pollingResponse.action);
|
|
@@ -6065,7 +6084,7 @@ function useStepPolling(polling, onAction) {
|
|
|
6065
6084
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
6066
6085
|
maxConsecutiveFails: 1,
|
|
6067
6086
|
onPollingResponse,
|
|
6068
|
-
onFailure: (0,
|
|
6087
|
+
onFailure: (0, import_react34.useCallback)(() => {
|
|
6069
6088
|
if (polling) {
|
|
6070
6089
|
onAction(polling.onError.action);
|
|
6071
6090
|
}
|
|
@@ -6073,8 +6092,8 @@ function useStepPolling(polling, onAction) {
|
|
|
6073
6092
|
});
|
|
6074
6093
|
}
|
|
6075
6094
|
|
|
6076
|
-
// src/step/layoutStep/LayoutStep.tsx
|
|
6077
|
-
var
|
|
6095
|
+
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
6096
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6078
6097
|
var getComponents = (step, options) => {
|
|
6079
6098
|
var _a;
|
|
6080
6099
|
if (isEmpty(step)) {
|
|
@@ -6097,7 +6116,7 @@ var LayoutStep = (props) => {
|
|
|
6097
6116
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
6098
6117
|
};
|
|
6099
6118
|
useStepPolling(stepSpecification.polling, onAction);
|
|
6100
|
-
return /* @__PURE__ */ (0,
|
|
6119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6101
6120
|
DynamicLayout_default,
|
|
6102
6121
|
{
|
|
6103
6122
|
components,
|
|
@@ -6112,15 +6131,15 @@ var LayoutStep = (props) => {
|
|
|
6112
6131
|
};
|
|
6113
6132
|
var LayoutStep_default = LayoutStep;
|
|
6114
6133
|
|
|
6115
|
-
// src/step/cameraStep/CameraStep.tsx
|
|
6116
|
-
var
|
|
6134
|
+
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
6135
|
+
var import_react39 = require("react");
|
|
6117
6136
|
|
|
6118
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6119
|
-
var
|
|
6137
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6138
|
+
var import_react38 = require("react");
|
|
6120
6139
|
var import_react_intl30 = require("react-intl");
|
|
6121
6140
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
6122
6141
|
|
|
6123
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
6142
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
6124
6143
|
var import_react_intl22 = require("react-intl");
|
|
6125
6144
|
var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
6126
6145
|
reviewSubmit: {
|
|
@@ -6140,57 +6159,57 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
6140
6159
|
}
|
|
6141
6160
|
});
|
|
6142
6161
|
|
|
6143
|
-
// src/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6144
|
-
var
|
|
6162
|
+
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6163
|
+
var import_components31 = require("@transferwise/components");
|
|
6145
6164
|
var import_react_intl23 = require("react-intl");
|
|
6146
|
-
var
|
|
6147
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
6165
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6166
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
6148
6167
|
var ReviewBottomBar = ({
|
|
6149
6168
|
onSubmit,
|
|
6150
6169
|
onRetry
|
|
6151
6170
|
}) => {
|
|
6152
6171
|
const intl = (0, import_react_intl23.useIntl)();
|
|
6153
|
-
return /* @__PURE__ */ (0,
|
|
6154
|
-
/* @__PURE__ */ (0,
|
|
6155
|
-
|
|
6172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
6173
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6174
|
+
import_components31.Button,
|
|
6156
6175
|
{
|
|
6157
6176
|
className: "m-b-1",
|
|
6158
6177
|
block: true,
|
|
6159
|
-
size:
|
|
6160
|
-
type:
|
|
6178
|
+
size: import_components31.Size.MEDIUM,
|
|
6179
|
+
type: import_components31.ControlType.ACCENT,
|
|
6161
6180
|
onClick: onSubmit,
|
|
6162
6181
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
6163
6182
|
}
|
|
6164
6183
|
),
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6166
|
-
|
|
6184
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6185
|
+
import_components31.Button,
|
|
6167
6186
|
{
|
|
6168
6187
|
className: "m-b-2",
|
|
6169
6188
|
block: true,
|
|
6170
|
-
size:
|
|
6171
|
-
type:
|
|
6172
|
-
priority:
|
|
6189
|
+
size: import_components31.Size.MEDIUM,
|
|
6190
|
+
type: import_components31.ControlType.ACCENT,
|
|
6191
|
+
priority: import_components31.Priority.SECONDARY,
|
|
6173
6192
|
onClick: onRetry,
|
|
6174
6193
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
6175
6194
|
}
|
|
6176
6195
|
)
|
|
6177
6196
|
] }) }) });
|
|
6178
6197
|
};
|
|
6179
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
6198
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6180
6199
|
"button",
|
|
6181
6200
|
{
|
|
6182
6201
|
type: "button",
|
|
6183
6202
|
className: "camera-capture-btn m-b-2",
|
|
6184
6203
|
"data-testid": "camera-capture-button",
|
|
6185
6204
|
onClick,
|
|
6186
|
-
children: /* @__PURE__ */ (0,
|
|
6205
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
6187
6206
|
}
|
|
6188
6207
|
);
|
|
6189
6208
|
|
|
6190
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6209
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6191
6210
|
var import_react_intl25 = require("react-intl");
|
|
6192
6211
|
|
|
6193
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
6212
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
6194
6213
|
var import_react_intl24 = require("react-intl");
|
|
6195
6214
|
var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMessages)({
|
|
6196
6215
|
text: {
|
|
@@ -6200,12 +6219,12 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMess
|
|
|
6200
6219
|
}
|
|
6201
6220
|
});
|
|
6202
6221
|
|
|
6203
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6204
|
-
var
|
|
6222
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6223
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6205
6224
|
var OrientationLockOverlay = () => {
|
|
6206
6225
|
const intl = (0, import_react_intl25.useIntl)();
|
|
6207
|
-
return /* @__PURE__ */ (0,
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
6227
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6209
6228
|
"img",
|
|
6210
6229
|
{
|
|
6211
6230
|
className: "m-b-3",
|
|
@@ -6215,25 +6234,25 @@ var OrientationLockOverlay = () => {
|
|
|
6215
6234
|
alt: ""
|
|
6216
6235
|
}
|
|
6217
6236
|
),
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6237
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6219
6238
|
] });
|
|
6220
6239
|
};
|
|
6221
6240
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6222
6241
|
|
|
6223
|
-
// src/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6224
|
-
var
|
|
6242
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6243
|
+
var import_react35 = require("react");
|
|
6225
6244
|
var import_screenfull = __toESM(require_screenfull());
|
|
6226
6245
|
var useFullScreenOrientationLock = (shouldLockOrientation) => {
|
|
6227
|
-
const lockOrientation = (0,
|
|
6246
|
+
const lockOrientation = (0, import_react35.useCallback)(() => {
|
|
6228
6247
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6229
6248
|
window.screen.orientation.lock("portrait").catch(noop4);
|
|
6230
6249
|
}
|
|
6231
6250
|
}, []);
|
|
6232
|
-
const unlockOrientation = (0,
|
|
6251
|
+
const unlockOrientation = (0, import_react35.useCallback)(() => {
|
|
6233
6252
|
var _a, _b, _c;
|
|
6234
6253
|
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);
|
|
6235
6254
|
}, []);
|
|
6236
|
-
const enterFullScreen = (0,
|
|
6255
|
+
const enterFullScreen = (0, import_react35.useCallback)(() => {
|
|
6237
6256
|
setTimeout(() => {
|
|
6238
6257
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6239
6258
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -6242,13 +6261,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation) => {
|
|
|
6242
6261
|
}
|
|
6243
6262
|
}, 100);
|
|
6244
6263
|
}, [shouldLockOrientation, lockOrientation]);
|
|
6245
|
-
const exitFullScreen = (0,
|
|
6264
|
+
const exitFullScreen = (0, import_react35.useCallback)(() => {
|
|
6246
6265
|
if (import_screenfull.default.isFullscreen) {
|
|
6247
6266
|
import_screenfull.default.exit().catch(noop4);
|
|
6248
6267
|
}
|
|
6249
6268
|
unlockOrientation();
|
|
6250
6269
|
}, [unlockOrientation]);
|
|
6251
|
-
(0,
|
|
6270
|
+
(0, import_react35.useEffect)(() => {
|
|
6252
6271
|
return () => {
|
|
6253
6272
|
exitFullScreen();
|
|
6254
6273
|
};
|
|
@@ -6261,10 +6280,10 @@ var useFullScreenOrientationLock = (shouldLockOrientation) => {
|
|
|
6261
6280
|
var noop4 = () => {
|
|
6262
6281
|
};
|
|
6263
6282
|
|
|
6264
|
-
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6265
|
-
var
|
|
6283
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6284
|
+
var import_react36 = require("react");
|
|
6266
6285
|
|
|
6267
|
-
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
6286
|
+
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
6268
6287
|
var isSelfieCamera = (stream) => {
|
|
6269
6288
|
var _a;
|
|
6270
6289
|
const { facingMode } = ((_a = getVideoTrack(stream)) == null ? void 0 : _a.getSettings()) || {};
|
|
@@ -6278,7 +6297,9 @@ var generateCanvasFromVideo = async (video) => {
|
|
|
6278
6297
|
canvas.setAttribute("width", `${video.videoWidth}`);
|
|
6279
6298
|
const context = canvas == null ? void 0 : canvas.getContext("2d");
|
|
6280
6299
|
if (context) {
|
|
6281
|
-
await new Promise((resolve) =>
|
|
6300
|
+
await new Promise((resolve) => {
|
|
6301
|
+
setTimeout(resolve, 100);
|
|
6302
|
+
});
|
|
6282
6303
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
6283
6304
|
}
|
|
6284
6305
|
}
|
|
@@ -6308,9 +6329,9 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
6308
6329
|
return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
|
|
6309
6330
|
};
|
|
6310
6331
|
|
|
6311
|
-
// src/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6332
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6312
6333
|
var useVideoConstraints = (direction) => {
|
|
6313
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6334
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react36.useState)();
|
|
6314
6335
|
const defaultVideoConstraints = {
|
|
6315
6336
|
facingMode: direction === "front" ? "user" : "environment",
|
|
6316
6337
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -6318,7 +6339,7 @@ var useVideoConstraints = (direction) => {
|
|
|
6318
6339
|
frameRate: 30,
|
|
6319
6340
|
aspectRatio: 16 / 9
|
|
6320
6341
|
};
|
|
6321
|
-
(0,
|
|
6342
|
+
(0, import_react36.useEffect)(() => {
|
|
6322
6343
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
6323
6344
|
}, [direction]);
|
|
6324
6345
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -6335,9 +6356,9 @@ var useVideoConstraints = (direction) => {
|
|
|
6335
6356
|
return { videoConstraints };
|
|
6336
6357
|
};
|
|
6337
6358
|
|
|
6338
|
-
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6339
|
-
var
|
|
6340
|
-
var
|
|
6359
|
+
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6360
|
+
var import_react37 = require("react");
|
|
6361
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6341
6362
|
var captureButtonHeight = 92;
|
|
6342
6363
|
var reviewButtonsHeight = 120;
|
|
6343
6364
|
var imageHeight = 40;
|
|
@@ -6345,16 +6366,16 @@ var titleHeight = 32;
|
|
|
6345
6366
|
var instructionsHeight = 48;
|
|
6346
6367
|
var reviewInstructionsHeight = 40;
|
|
6347
6368
|
var overlayMaxWidth = 800;
|
|
6348
|
-
|
|
6369
|
+
function Overlay({
|
|
6349
6370
|
overlay,
|
|
6350
6371
|
outline,
|
|
6351
6372
|
imageUrl,
|
|
6352
6373
|
title,
|
|
6353
6374
|
instructions,
|
|
6354
6375
|
reviewInstructions
|
|
6355
|
-
})
|
|
6356
|
-
const svgReference = (0,
|
|
6357
|
-
(0,
|
|
6376
|
+
}) {
|
|
6377
|
+
const svgReference = (0, import_react37.useRef)(null);
|
|
6378
|
+
(0, import_react37.useEffect)(() => {
|
|
6358
6379
|
const listener = debounce(() => {
|
|
6359
6380
|
var _a;
|
|
6360
6381
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -6366,18 +6387,18 @@ var Overlay = ({
|
|
|
6366
6387
|
return () => window.removeEventListener("resize", listener);
|
|
6367
6388
|
});
|
|
6368
6389
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
6369
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
6370
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
6371
|
-
title && /* @__PURE__ */ (0,
|
|
6372
|
-
instructions && /* @__PURE__ */ (0,
|
|
6390
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
6391
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6392
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6393
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6373
6394
|
] });
|
|
6374
6395
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6375
6396
|
if (reviewInstructions) {
|
|
6376
6397
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6377
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6398
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6378
6399
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6379
6400
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6380
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6401
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_jsx_runtime60.Fragment, {});
|
|
6381
6402
|
}
|
|
6382
6403
|
}
|
|
6383
6404
|
const framePosition = {
|
|
@@ -6395,23 +6416,23 @@ var Overlay = ({
|
|
|
6395
6416
|
width: "90%"
|
|
6396
6417
|
}
|
|
6397
6418
|
};
|
|
6398
|
-
return /* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
/* @__PURE__ */ (0,
|
|
6401
|
-
/* @__PURE__ */ (0,
|
|
6419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6420
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("mask", { id: "mask", children: [
|
|
6421
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6422
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
6402
6423
|
] }) }),
|
|
6403
|
-
overlay && /* @__PURE__ */ (0,
|
|
6404
|
-
outline && /* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6424
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6425
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
6426
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
6406
6427
|
] });
|
|
6407
|
-
}
|
|
6428
|
+
}
|
|
6408
6429
|
var Overlay_default = Overlay;
|
|
6409
6430
|
|
|
6410
|
-
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6411
|
-
var
|
|
6431
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6432
|
+
var import_components32 = require("@transferwise/components");
|
|
6412
6433
|
var import_react_intl27 = require("react-intl");
|
|
6413
6434
|
|
|
6414
|
-
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
6435
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
6415
6436
|
var import_react_intl26 = require("react-intl");
|
|
6416
6437
|
var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
6417
6438
|
title: {
|
|
@@ -6431,22 +6452,22 @@ var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
6431
6452
|
}
|
|
6432
6453
|
});
|
|
6433
6454
|
|
|
6434
|
-
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6435
|
-
var
|
|
6436
|
-
|
|
6455
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6456
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6457
|
+
function NoCameraAccess({ onAction }) {
|
|
6437
6458
|
const intl = (0, import_react_intl27.useIntl)();
|
|
6438
|
-
return /* @__PURE__ */ (0,
|
|
6439
|
-
/* @__PURE__ */ (0,
|
|
6440
|
-
/* @__PURE__ */ (0,
|
|
6441
|
-
/* @__PURE__ */ (0,
|
|
6459
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6460
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6461
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6462
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components32.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6442
6463
|
] }) }) }) });
|
|
6443
|
-
}
|
|
6464
|
+
}
|
|
6444
6465
|
var NoCameraAccess_default = NoCameraAccess;
|
|
6445
6466
|
|
|
6446
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6467
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6447
6468
|
var import_react_intl29 = require("react-intl");
|
|
6448
6469
|
|
|
6449
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
|
|
6470
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
|
|
6450
6471
|
var import_react_intl28 = require("react-intl");
|
|
6451
6472
|
var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages)({
|
|
6452
6473
|
title: {
|
|
@@ -6461,18 +6482,18 @@ var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages
|
|
|
6461
6482
|
}
|
|
6462
6483
|
});
|
|
6463
6484
|
|
|
6464
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6465
|
-
var
|
|
6485
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6486
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6466
6487
|
var CameraNotSupported = () => {
|
|
6467
6488
|
const intl = (0, import_react_intl29.useIntl)();
|
|
6468
|
-
return /* @__PURE__ */ (0,
|
|
6469
|
-
/* @__PURE__ */ (0,
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
6489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6490
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6491
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6471
6492
|
] }) }) }) });
|
|
6472
6493
|
};
|
|
6473
6494
|
var CameraNotSupported_default = CameraNotSupported;
|
|
6474
6495
|
|
|
6475
|
-
// src/step/cameraStep/cameraCapture/tracking/index.ts
|
|
6496
|
+
// src/legacy/step/cameraStep/cameraCapture/tracking/index.ts
|
|
6476
6497
|
var trackCameraPermissionDenied = (onEvent) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Permission Denied", {});
|
|
6477
6498
|
var trackCameraFeedStarted = async (onEvent, props, stream) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Feed Started", await getCameraStartedProperties(props, stream));
|
|
6478
6499
|
var trackCameraNotSupported = (onEvent, error) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Not Supported", { Error: error });
|
|
@@ -6491,9 +6512,9 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
6491
6512
|
});
|
|
6492
6513
|
};
|
|
6493
6514
|
|
|
6494
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6495
|
-
var
|
|
6496
|
-
|
|
6515
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6516
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6517
|
+
function CameraCapture({
|
|
6497
6518
|
direction = "back",
|
|
6498
6519
|
overlay = "",
|
|
6499
6520
|
outline = "",
|
|
@@ -6503,21 +6524,21 @@ var CameraCapture = ({
|
|
|
6503
6524
|
showReview = false,
|
|
6504
6525
|
onCapture,
|
|
6505
6526
|
onEvent
|
|
6506
|
-
})
|
|
6507
|
-
const [mode, setMode] = (0,
|
|
6508
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
6509
|
-
const [ready, setReady] = (0,
|
|
6510
|
-
const [reviewImage, setReviewImage] = (0,
|
|
6511
|
-
const webcamReference = (0,
|
|
6527
|
+
}) {
|
|
6528
|
+
const [mode, setMode] = (0, import_react38.useState)("CAPTURE");
|
|
6529
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react38.useState)(false);
|
|
6530
|
+
const [ready, setReady] = (0, import_react38.useState)(false);
|
|
6531
|
+
const [reviewImage, setReviewImage] = (0, import_react38.useState)();
|
|
6532
|
+
const webcamReference = (0, import_react38.useRef)(null);
|
|
6512
6533
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6513
6534
|
const orientationLockFeature = useFeatureFlag("camera-orientation-lock" /* CAMERA_ORIENTATION_LOCK */);
|
|
6514
|
-
const shouldLockOrientation = (0,
|
|
6535
|
+
const shouldLockOrientation = (0, import_react38.useMemo)(
|
|
6515
6536
|
() => !!((orientationLockFeature == null ? void 0 : orientationLockFeature.enabled) && isMobile()),
|
|
6516
6537
|
[orientationLockFeature]
|
|
6517
6538
|
);
|
|
6518
6539
|
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(shouldLockOrientation);
|
|
6519
6540
|
const intl = (0, import_react_intl30.useIntl)();
|
|
6520
|
-
const handleCapture = (0,
|
|
6541
|
+
const handleCapture = (0, import_react38.useCallback)(async () => {
|
|
6521
6542
|
var _a, _b, _c, _d, _e, _f;
|
|
6522
6543
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
6523
6544
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -6539,7 +6560,7 @@ var CameraCapture = ({
|
|
|
6539
6560
|
);
|
|
6540
6561
|
}
|
|
6541
6562
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6542
|
-
const handleUserMediaError = (0,
|
|
6563
|
+
const handleUserMediaError = (0, import_react38.useCallback)(
|
|
6543
6564
|
(error) => {
|
|
6544
6565
|
if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
|
|
6545
6566
|
setMode("NO_CAMERA_ACCESS");
|
|
@@ -6551,7 +6572,7 @@ var CameraCapture = ({
|
|
|
6551
6572
|
},
|
|
6552
6573
|
[setMode, onEvent]
|
|
6553
6574
|
);
|
|
6554
|
-
const handleUserMedia = (0,
|
|
6575
|
+
const handleUserMedia = (0, import_react38.useCallback)(
|
|
6555
6576
|
(stream) => {
|
|
6556
6577
|
enterFullScreen();
|
|
6557
6578
|
setReady(true);
|
|
@@ -6568,13 +6589,13 @@ var CameraCapture = ({
|
|
|
6568
6589
|
setReviewImage(void 0);
|
|
6569
6590
|
};
|
|
6570
6591
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6571
|
-
(0,
|
|
6592
|
+
(0, import_react38.useEffect)(() => {
|
|
6572
6593
|
if (mode !== "CAPTURE") {
|
|
6573
6594
|
exitFullScreen();
|
|
6574
6595
|
}
|
|
6575
6596
|
}, [mode, exitFullScreen]);
|
|
6576
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
6577
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
6597
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
6598
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6578
6599
|
import_react_webcam.default,
|
|
6579
6600
|
{
|
|
6580
6601
|
ref: webcamReference,
|
|
@@ -6585,7 +6606,7 @@ var CameraCapture = ({
|
|
|
6585
6606
|
onUserMedia: handleUserMedia
|
|
6586
6607
|
}
|
|
6587
6608
|
),
|
|
6588
|
-
/* @__PURE__ */ (0,
|
|
6609
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6589
6610
|
Overlay_default,
|
|
6590
6611
|
{
|
|
6591
6612
|
overlay,
|
|
@@ -6595,12 +6616,19 @@ var CameraCapture = ({
|
|
|
6595
6616
|
instructions
|
|
6596
6617
|
}
|
|
6597
6618
|
),
|
|
6598
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
6599
|
-
ready && /* @__PURE__ */ (0,
|
|
6619
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(OrientationLockOverlay_default, {}),
|
|
6620
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6621
|
+
CaptureBottomBar,
|
|
6622
|
+
{
|
|
6623
|
+
onCapture: () => {
|
|
6624
|
+
void handleCapture();
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
)
|
|
6600
6628
|
] });
|
|
6601
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
6602
|
-
/* @__PURE__ */ (0,
|
|
6603
|
-
/* @__PURE__ */ (0,
|
|
6629
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
6630
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6631
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6604
6632
|
Overlay_default,
|
|
6605
6633
|
{
|
|
6606
6634
|
overlay,
|
|
@@ -6610,19 +6638,19 @@ var CameraCapture = ({
|
|
|
6610
6638
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6611
6639
|
}
|
|
6612
6640
|
),
|
|
6613
|
-
/* @__PURE__ */ (0,
|
|
6641
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6614
6642
|
] });
|
|
6615
|
-
return /* @__PURE__ */ (0,
|
|
6643
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("section", { className: "camera-capture", children: [
|
|
6616
6644
|
mode === "CAPTURE" && captureScreen,
|
|
6617
6645
|
mode === "REVIEW" && reviewScreen,
|
|
6618
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
6619
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
6646
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
6647
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(CameraNotSupported_default, {})
|
|
6620
6648
|
] });
|
|
6621
|
-
}
|
|
6649
|
+
}
|
|
6622
6650
|
var CameraCapture_default = CameraCapture;
|
|
6623
6651
|
|
|
6624
|
-
// src/step/cameraStep/CameraStep.tsx
|
|
6625
|
-
var
|
|
6652
|
+
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
6653
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6626
6654
|
function blobToBase64(blob) {
|
|
6627
6655
|
return new Promise((resolve, _) => {
|
|
6628
6656
|
const reader = new FileReader();
|
|
@@ -6630,7 +6658,7 @@ function blobToBase64(blob) {
|
|
|
6630
6658
|
reader.readAsDataURL(blob);
|
|
6631
6659
|
});
|
|
6632
6660
|
}
|
|
6633
|
-
|
|
6661
|
+
function CameraStep(props) {
|
|
6634
6662
|
const { step, model, onModelChange, onAction } = props;
|
|
6635
6663
|
const onEvent = useEventDispatcher();
|
|
6636
6664
|
const objectSchema = getObjectSchema(step);
|
|
@@ -6640,8 +6668,8 @@ var CameraStep = (props) => {
|
|
|
6640
6668
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6641
6669
|
const { overlay, outline } = assets || {};
|
|
6642
6670
|
const { url: imageUrl } = image || {};
|
|
6643
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6644
|
-
(0,
|
|
6671
|
+
const [captureClicked, setCaptureClicked] = (0, import_react39.useState)(false);
|
|
6672
|
+
(0, import_react39.useEffect)(() => {
|
|
6645
6673
|
if (captureClicked) {
|
|
6646
6674
|
onAction(action);
|
|
6647
6675
|
}
|
|
@@ -6660,7 +6688,7 @@ var CameraStep = (props) => {
|
|
|
6660
6688
|
});
|
|
6661
6689
|
}
|
|
6662
6690
|
};
|
|
6663
|
-
return /* @__PURE__ */ (0,
|
|
6691
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6664
6692
|
CameraCapture_default,
|
|
6665
6693
|
{
|
|
6666
6694
|
overlay,
|
|
@@ -6675,7 +6703,7 @@ var CameraStep = (props) => {
|
|
|
6675
6703
|
}
|
|
6676
6704
|
}
|
|
6677
6705
|
);
|
|
6678
|
-
}
|
|
6706
|
+
}
|
|
6679
6707
|
var CameraStep_default = CameraStep;
|
|
6680
6708
|
function getObjectSchema(step) {
|
|
6681
6709
|
const nonHiddenSchemas = filterHiddenSchemas(step.schemas || []);
|
|
@@ -6708,10 +6736,10 @@ function getFirstAction(step) {
|
|
|
6708
6736
|
return step.actions[0];
|
|
6709
6737
|
}
|
|
6710
6738
|
|
|
6711
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6739
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6712
6740
|
var import_react_intl32 = require("react-intl");
|
|
6713
6741
|
|
|
6714
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6742
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6715
6743
|
var import_react_intl31 = require("react-intl");
|
|
6716
6744
|
var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMessages)({
|
|
6717
6745
|
title: {
|
|
@@ -6736,13 +6764,13 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMe
|
|
|
6736
6764
|
}
|
|
6737
6765
|
});
|
|
6738
6766
|
|
|
6739
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6740
|
-
var
|
|
6767
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6768
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6741
6769
|
var noop5 = () => {
|
|
6742
6770
|
};
|
|
6743
6771
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6744
6772
|
const { formatMessage } = (0, import_react_intl32.useIntl)();
|
|
6745
|
-
return /* @__PURE__ */ (0,
|
|
6773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6746
6774
|
DynamicLayout_default,
|
|
6747
6775
|
{
|
|
6748
6776
|
components: [
|
|
@@ -6806,33 +6834,33 @@ function getOrigin(url) {
|
|
|
6806
6834
|
}
|
|
6807
6835
|
}
|
|
6808
6836
|
|
|
6809
|
-
// src/dynamicFlow/BackButton.tsx
|
|
6810
|
-
var
|
|
6837
|
+
// src/legacy/dynamicFlow/BackButton.tsx
|
|
6838
|
+
var import_components34 = require("@transferwise/components");
|
|
6811
6839
|
var import_icons2 = require("@transferwise/icons");
|
|
6812
|
-
var
|
|
6813
|
-
|
|
6814
|
-
return /* @__PURE__ */ (0,
|
|
6840
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6841
|
+
function BackButton({ title, action, onAction }) {
|
|
6842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
6815
6843
|
"a",
|
|
6816
6844
|
{
|
|
6845
|
+
href: "/",
|
|
6846
|
+
className: "df-back-btn",
|
|
6847
|
+
"aria-label": title,
|
|
6817
6848
|
onClick: (event) => {
|
|
6818
6849
|
event.preventDefault();
|
|
6819
6850
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
6820
6851
|
},
|
|
6821
|
-
href: "/",
|
|
6822
|
-
className: "df-back-btn",
|
|
6823
|
-
"aria-label": title,
|
|
6824
6852
|
children: [
|
|
6825
|
-
/* @__PURE__ */ (0,
|
|
6826
|
-
/* @__PURE__ */ (0,
|
|
6853
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "sr-only", children: title }),
|
|
6854
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components34.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6827
6855
|
]
|
|
6828
6856
|
}
|
|
6829
6857
|
);
|
|
6830
|
-
}
|
|
6858
|
+
}
|
|
6831
6859
|
var BackButton_default = BackButton;
|
|
6832
6860
|
|
|
6833
|
-
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6834
|
-
var
|
|
6835
|
-
|
|
6861
|
+
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
6862
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6863
|
+
function DynamicFlowStep(props) {
|
|
6836
6864
|
var _a, _b, _c;
|
|
6837
6865
|
const { step, globalError, onAction } = props;
|
|
6838
6866
|
const externalUrl = (_a = step == null ? void 0 : step.external) == null ? void 0 : _a.url;
|
|
@@ -6840,28 +6868,28 @@ var DynamicFlowStep = (props) => {
|
|
|
6840
6868
|
const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
|
|
6841
6869
|
if (step === void 0) {
|
|
6842
6870
|
if (globalError) {
|
|
6843
|
-
return /* @__PURE__ */ (0,
|
|
6871
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
6844
6872
|
}
|
|
6845
6873
|
return null;
|
|
6846
6874
|
}
|
|
6847
6875
|
if (externalUrl && requiresManualTrigger) {
|
|
6848
|
-
return /* @__PURE__ */ (0,
|
|
6876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6849
6877
|
}
|
|
6850
6878
|
if (isCameraStep(step)) {
|
|
6851
|
-
return /* @__PURE__ */ (0,
|
|
6879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
6852
6880
|
}
|
|
6853
|
-
return /* @__PURE__ */ (0,
|
|
6854
|
-
backButton && /* @__PURE__ */ (0,
|
|
6855
|
-
globalError ? /* @__PURE__ */ (0,
|
|
6856
|
-
/* @__PURE__ */ (0,
|
|
6881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
6882
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
6883
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6884
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6857
6885
|
] });
|
|
6858
|
-
}
|
|
6886
|
+
}
|
|
6859
6887
|
|
|
6860
|
-
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6861
|
-
var
|
|
6888
|
+
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6889
|
+
var import_react40 = require("react");
|
|
6862
6890
|
var DEBOUNCE_DELAY = 1e3;
|
|
6863
6891
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6864
|
-
const map = (0,
|
|
6892
|
+
const map = (0, import_react40.useRef)(/* @__PURE__ */ new Map());
|
|
6865
6893
|
const retrieveOrCreate = (key) => {
|
|
6866
6894
|
if (map.current.has(key)) {
|
|
6867
6895
|
return map.current.get(key);
|
|
@@ -6875,21 +6903,21 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6875
6903
|
};
|
|
6876
6904
|
return function(url, data, etag, schema) {
|
|
6877
6905
|
const debouncedFetchRefresh = retrieveOrCreate(url);
|
|
6878
|
-
|
|
6906
|
+
debouncedFetchRefresh(url, data, etag);
|
|
6879
6907
|
if (!schema || !shouldDebounceSchema(schema)) {
|
|
6880
|
-
|
|
6908
|
+
debouncedFetchRefresh.flush();
|
|
6881
6909
|
}
|
|
6882
6910
|
};
|
|
6883
6911
|
}
|
|
6884
6912
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6885
6913
|
|
|
6886
|
-
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6887
|
-
var
|
|
6914
|
+
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6915
|
+
var import_react41 = require("react");
|
|
6888
6916
|
var useDynamicFlowState = (initialStep) => {
|
|
6889
6917
|
var _a, _b;
|
|
6890
|
-
const [formErrors, setFormErrors] = (0,
|
|
6891
|
-
const [globalError, setGlobalError] = (0,
|
|
6892
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6918
|
+
const [formErrors, setFormErrors] = (0, import_react41.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6919
|
+
const [globalError, setGlobalError] = (0, import_react41.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6920
|
+
const [stepAndModels, setStepAndModels] = (0, import_react41.useState)({
|
|
6893
6921
|
step: initialStep || void 0,
|
|
6894
6922
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6895
6923
|
etag: void 0
|
|
@@ -6919,7 +6947,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6919
6947
|
return updatedState;
|
|
6920
6948
|
});
|
|
6921
6949
|
};
|
|
6922
|
-
const modelIsValid = (0,
|
|
6950
|
+
const modelIsValid = (0, import_react41.useMemo)(
|
|
6923
6951
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6924
6952
|
[models, step]
|
|
6925
6953
|
);
|
|
@@ -6936,16 +6964,14 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6936
6964
|
setSchemaModel
|
|
6937
6965
|
};
|
|
6938
6966
|
};
|
|
6939
|
-
var buildInitialModels = (model, schemas = []) => {
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
}, {});
|
|
6948
|
-
};
|
|
6967
|
+
var buildInitialModels = (model, schemas = []) => schemas.reduce((acc, schema) => {
|
|
6968
|
+
if (!schema.$id) {
|
|
6969
|
+
console.warn("Schema without $id property found.");
|
|
6970
|
+
}
|
|
6971
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
6972
|
+
[schema.$id || ""]: getValidObjectModelParts(model, schema) || {}
|
|
6973
|
+
});
|
|
6974
|
+
}, {});
|
|
6949
6975
|
var getAllSchemas = (step) => [
|
|
6950
6976
|
...getAllSchemasInLayout((step == null ? void 0 : step.layout) || []),
|
|
6951
6977
|
...(step == null ? void 0 : step.schemas) || []
|
|
@@ -6978,38 +7004,34 @@ var getAllReferencedSchemaIds = (components) => components.flatMap((component) =
|
|
|
6978
7004
|
return [];
|
|
6979
7005
|
}
|
|
6980
7006
|
}).filter(Boolean);
|
|
6981
|
-
var areModelsValid = (formModels, schemas = []) => {
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
}));
|
|
6988
|
-
};
|
|
7007
|
+
var areModelsValid = (formModels, schemas = []) => !(schemas == null ? void 0 : schemas.some((schema) => {
|
|
7008
|
+
if (!schema.$id) {
|
|
7009
|
+
console.warn("Schema without $id property found.");
|
|
7010
|
+
}
|
|
7011
|
+
return !isValidSchema(formModels[schema.$id || ""] || {}, schema);
|
|
7012
|
+
}));
|
|
6989
7013
|
var getSchemaReference = (component) => {
|
|
6990
7014
|
if (component.schema && !isInlineSchema(component.schema)) {
|
|
6991
7015
|
return component.schema.$ref;
|
|
6992
7016
|
}
|
|
6993
7017
|
return component.schemaId;
|
|
6994
7018
|
};
|
|
6995
|
-
var isInlineSchema = (schema) =>
|
|
6996
|
-
return schema !== void 0 && typeof schema === "object" && Object.prototype.hasOwnProperty.call(schema, "$ref") === false;
|
|
6997
|
-
};
|
|
7019
|
+
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwn(schema, "$ref");
|
|
6998
7020
|
|
|
6999
|
-
// src/dynamicFlow/utils/useLoader.tsx
|
|
7000
|
-
var
|
|
7001
|
-
var
|
|
7002
|
-
var
|
|
7021
|
+
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
7022
|
+
var import_components35 = require("@transferwise/components");
|
|
7023
|
+
var import_react42 = require("react");
|
|
7024
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
7003
7025
|
function useLoader(loaderConfig, initialState) {
|
|
7004
7026
|
const config = __spreadValues({
|
|
7005
|
-
size:
|
|
7027
|
+
size: import_components35.Size.EXTRA_LARGE,
|
|
7006
7028
|
initial: true,
|
|
7007
7029
|
submission: false
|
|
7008
7030
|
}, loaderConfig);
|
|
7009
|
-
const [loadingState, setLoadingState] = (0,
|
|
7031
|
+
const [loadingState, setLoadingState] = (0, import_react42.useState)(initialState);
|
|
7010
7032
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
7011
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
7012
|
-
|
|
7033
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7034
|
+
import_components35.Loader,
|
|
7013
7035
|
{
|
|
7014
7036
|
size: config.size,
|
|
7015
7037
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -7019,35 +7041,35 @@ function useLoader(loaderConfig, initialState) {
|
|
|
7019
7041
|
return { isLoading: loadingState !== "idle", setLoadingState, loader };
|
|
7020
7042
|
}
|
|
7021
7043
|
|
|
7022
|
-
// src/
|
|
7023
|
-
var
|
|
7044
|
+
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
7045
|
+
var import_react43 = require("react");
|
|
7024
7046
|
|
|
7025
|
-
// src/
|
|
7026
|
-
var
|
|
7047
|
+
// src/common/errorBoundary/ErrorBoundaryAlert.tsx
|
|
7048
|
+
var import_components36 = require("@transferwise/components");
|
|
7027
7049
|
var import_react_intl33 = require("react-intl");
|
|
7028
|
-
var
|
|
7029
|
-
|
|
7050
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
7051
|
+
function ErrorBoundaryAlert({ onDismiss }) {
|
|
7030
7052
|
const { formatMessage } = (0, import_react_intl33.useIntl)();
|
|
7031
|
-
return /* @__PURE__ */ (0,
|
|
7032
|
-
|
|
7053
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
7054
|
+
import_components36.Alert,
|
|
7033
7055
|
{
|
|
7034
7056
|
action: {
|
|
7035
7057
|
text: formatMessage(ErrorBoundary_messages_default.retry),
|
|
7036
7058
|
href: window.location.href
|
|
7037
7059
|
},
|
|
7038
7060
|
message: formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
7039
|
-
type:
|
|
7061
|
+
type: import_components36.Sentiment.NEGATIVE,
|
|
7040
7062
|
className: "m-b-3",
|
|
7041
7063
|
onDismiss
|
|
7042
7064
|
}
|
|
7043
7065
|
);
|
|
7044
|
-
}
|
|
7066
|
+
}
|
|
7045
7067
|
|
|
7046
|
-
// src/
|
|
7047
|
-
var
|
|
7068
|
+
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
7069
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7048
7070
|
var noop6 = () => {
|
|
7049
7071
|
};
|
|
7050
|
-
var ErrorBoundary = class extends
|
|
7072
|
+
var ErrorBoundary = class extends import_react43.Component {
|
|
7051
7073
|
constructor(props) {
|
|
7052
7074
|
super(props);
|
|
7053
7075
|
this.handleErrorReset = () => {
|
|
@@ -7065,15 +7087,15 @@ var ErrorBoundary = class extends import_react42.Component {
|
|
|
7065
7087
|
render() {
|
|
7066
7088
|
const { children } = this.props;
|
|
7067
7089
|
const { hasError, isFatalError } = this.state;
|
|
7068
|
-
return /* @__PURE__ */ (0,
|
|
7069
|
-
hasError && /* @__PURE__ */ (0,
|
|
7090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
7091
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
7070
7092
|
!isFatalError && children
|
|
7071
7093
|
] });
|
|
7072
7094
|
}
|
|
7073
7095
|
};
|
|
7074
7096
|
var ErrorBoundary_default = ErrorBoundary;
|
|
7075
7097
|
|
|
7076
|
-
// src/dynamicFlow/utils/responseParsers/response-parsers.ts
|
|
7098
|
+
// src/legacy/dynamicFlow/utils/responseParsers/response-parsers.ts
|
|
7077
7099
|
var parseFetchResponseByResponseType = async (response, type) => {
|
|
7078
7100
|
switch (type) {
|
|
7079
7101
|
case "step":
|
|
@@ -7112,9 +7134,7 @@ var parseActionResponse = async (response) => {
|
|
|
7112
7134
|
}
|
|
7113
7135
|
return { type: "action", action: jsonBody.action };
|
|
7114
7136
|
};
|
|
7115
|
-
var parseExitResponse = async (response) => {
|
|
7116
|
-
return { type: "exit", result: await getJsonObjectOrNull(response) };
|
|
7117
|
-
};
|
|
7137
|
+
var parseExitResponse = async (response) => ({ type: "exit", result: await getJsonObjectOrNull(response) });
|
|
7118
7138
|
var parseFetchResponse = async (response) => {
|
|
7119
7139
|
var _a, _b, _c;
|
|
7120
7140
|
assertResponseIsValid(response);
|
|
@@ -7170,8 +7190,8 @@ var assertResponseIsValid = (response) => {
|
|
|
7170
7190
|
};
|
|
7171
7191
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
7172
7192
|
|
|
7173
|
-
// src/dynamicFlow/DynamicFlow.tsx
|
|
7174
|
-
var
|
|
7193
|
+
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
7194
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7175
7195
|
var noop7 = () => {
|
|
7176
7196
|
};
|
|
7177
7197
|
var DynamicFlowComponent = ({
|
|
@@ -7200,25 +7220,29 @@ var DynamicFlowComponent = ({
|
|
|
7200
7220
|
setStepAndEtag,
|
|
7201
7221
|
setSchemaModel
|
|
7202
7222
|
} = useDynamicFlowState(initialStep);
|
|
7203
|
-
const [submitted, setSubmitted] = (0,
|
|
7223
|
+
const [submitted, setSubmitted] = (0, import_react44.useState)(false);
|
|
7204
7224
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
7205
7225
|
loaderConfig,
|
|
7206
7226
|
initialStep ? "idle" : "initial"
|
|
7207
7227
|
);
|
|
7208
7228
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
7209
|
-
const analyticsMetadata = (0,
|
|
7229
|
+
const analyticsMetadata = (0, import_react44.useMemo)(
|
|
7210
7230
|
() => {
|
|
7211
7231
|
var _a;
|
|
7212
7232
|
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 : {});
|
|
7213
7233
|
},
|
|
7214
7234
|
[flowId, step]
|
|
7215
7235
|
);
|
|
7216
|
-
const dispatchEvent = (0,
|
|
7236
|
+
const dispatchEvent = (0, import_react44.useMemo)(
|
|
7217
7237
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
7218
7238
|
[onEvent, analyticsMetadata]
|
|
7219
7239
|
);
|
|
7220
|
-
const dfHttpClient = (0,
|
|
7221
|
-
({
|
|
7240
|
+
const dfHttpClient = (0, import_react44.useCallback)(
|
|
7241
|
+
({
|
|
7242
|
+
action,
|
|
7243
|
+
data,
|
|
7244
|
+
etag: etag2
|
|
7245
|
+
}) => {
|
|
7222
7246
|
const { url, method = "POST" } = action;
|
|
7223
7247
|
return httpClient(url != null ? url : "", {
|
|
7224
7248
|
method,
|
|
@@ -7267,17 +7291,17 @@ var DynamicFlowComponent = ({
|
|
|
7267
7291
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
7268
7292
|
};
|
|
7269
7293
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
7270
|
-
const dispatchEventAndComplete = (0,
|
|
7294
|
+
const dispatchEventAndComplete = (0, import_react44.useCallback)(
|
|
7271
7295
|
(result) => {
|
|
7272
7296
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
7273
7297
|
onCompletion(result);
|
|
7274
7298
|
},
|
|
7275
7299
|
[onCompletion, dispatchEvent]
|
|
7276
7300
|
);
|
|
7277
|
-
(0,
|
|
7301
|
+
(0, import_react44.useEffect)(() => {
|
|
7278
7302
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
7279
7303
|
}, []);
|
|
7280
|
-
(0,
|
|
7304
|
+
(0, import_react44.useEffect)(() => {
|
|
7281
7305
|
if (!initialStep) {
|
|
7282
7306
|
const action = __spreadValues({
|
|
7283
7307
|
id: "#initial-step-request",
|
|
@@ -7306,7 +7330,7 @@ var DynamicFlowComponent = ({
|
|
|
7306
7330
|
updateStep(result.step, result.etag, fetchType);
|
|
7307
7331
|
}
|
|
7308
7332
|
} catch (error) {
|
|
7309
|
-
|
|
7333
|
+
completeWithError(error, "Error parsing fetch response", fetchType, response.status);
|
|
7310
7334
|
}
|
|
7311
7335
|
};
|
|
7312
7336
|
const updateStep = (newStep, etag2, fetchType) => {
|
|
@@ -7392,7 +7416,7 @@ var DynamicFlowComponent = ({
|
|
|
7392
7416
|
await actionHandler(action);
|
|
7393
7417
|
}
|
|
7394
7418
|
};
|
|
7395
|
-
return /* @__PURE__ */ (0,
|
|
7419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
7396
7420
|
DynamicFlowStep,
|
|
7397
7421
|
{
|
|
7398
7422
|
step,
|
|
@@ -7408,11 +7432,11 @@ var DynamicFlowComponent = ({
|
|
|
7408
7432
|
}
|
|
7409
7433
|
) }) }) }) }) });
|
|
7410
7434
|
};
|
|
7411
|
-
|
|
7435
|
+
function DynamicFlow(props) {
|
|
7436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7437
|
+
}
|
|
7412
7438
|
var DynamicFlow_default = DynamicFlow;
|
|
7413
|
-
var combineModels2 = (formModels) => {
|
|
7414
|
-
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
7415
|
-
};
|
|
7439
|
+
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
7416
7440
|
var isSubmissionMethod = (method = "POST") => {
|
|
7417
7441
|
const submissionMethods = ["POST", "PUT", "PATCH"];
|
|
7418
7442
|
return submissionMethods.includes(method.toUpperCase());
|
|
@@ -7425,23 +7449,23 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7425
7449
|
return type !== "init" && hasRefreshOnChange && (isValid() || wasValid());
|
|
7426
7450
|
};
|
|
7427
7451
|
|
|
7428
|
-
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7429
|
-
var
|
|
7430
|
-
|
|
7452
|
+
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7453
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
7454
|
+
function JsonSchemaForm(props) {
|
|
7431
7455
|
const schemaProps = __spreadValues({
|
|
7432
7456
|
model: null,
|
|
7433
7457
|
errors: null
|
|
7434
7458
|
}, props);
|
|
7435
7459
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
7436
|
-
return /* @__PURE__ */ (0,
|
|
7460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
7437
7461
|
EventsContextProvider,
|
|
7438
7462
|
{
|
|
7439
7463
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
7440
7464
|
onEvent,
|
|
7441
|
-
children: /* @__PURE__ */ (0,
|
|
7465
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7442
7466
|
}
|
|
7443
7467
|
) });
|
|
7444
|
-
}
|
|
7468
|
+
}
|
|
7445
7469
|
var JsonSchemaForm_default = JsonSchemaForm;
|
|
7446
7470
|
var noop8 = () => {
|
|
7447
7471
|
};
|