@wise/dynamic-flow-client 2.6.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -13
- package/build/i18n/en.json +4 -0
- package/build/i18n/pt.json +2 -2
- package/build/i18n/zh_CN.json +20 -20
- package/build/main.css +0 -20
- package/build/main.js +952 -891
- 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/constants/FeatureName.d.ts +3 -0
- 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/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +2 -0
- 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/legacy/common/utils/debounce.d.ts +6 -0
- 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}/controlFeedback/ControlFeedback.d.ts +5 -5
- 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/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +58 -0
- package/build/types/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +2 -0
- package/build/types/{step → legacy/step}/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +2 -1
- package/build/types/{step → legacy/step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +1 -1
- package/build/types/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +3 -0
- package/build/types/legacy/step/cameraStep/cameraCapture/screens/index.d.ts +1 -0
- package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +8 -0
- package/build/types/legacy/step/cameraStep/cameraCapture/types/index.d.ts +11 -0
- 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 +3 -3
- package/build/types/revamp/domain/components/ButtonComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ColumnsComponent.d.ts +20 -0
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -2
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +3 -3
- package/build/types/revamp/domain/components/ParagraphComponent.d.ts +3 -3
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +9 -10
- 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/columnsLayoutToComponent.d.ts +4 -0
- 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 +2 -9
- package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +5 -3
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +12 -3
- package/build/types/revamp/domain/mappers/schema/types.d.ts +9 -3
- package/build/types/revamp/domain/mappers/types.d.ts +10 -0
- package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +5 -2
- package/build/types/revamp/domain/mappers/utils/type-validators.d.ts +9 -0
- package/build/types/revamp/domain/mappers/utils/value-checks.d.ts +10 -0
- package/build/types/revamp/domain/types.d.ts +16 -16
- package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/boxComponentToProps.d.ts +4 -4
- package/build/types/revamp/renderers/mappers/buttonComponentToProps.d.ts +2 -2
- package/build/types/revamp/renderers/mappers/columnsComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +8 -4
- package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +4 -4
- package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +3 -3
- package/build/types/revamp/renderers/types.d.ts +22 -13
- package/build/types/revamp/step/Step.d.ts +3 -3
- package/build/types/revamp/step/utils/getRenderFunction.d.ts +3 -0
- package/build/types/revamp/step/utils/getSchemaErrorMessageFunction.d.ts +4 -0
- 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 +4 -2
- package/build/types/revamp/utils/validateComponents.d.ts +2 -0
- 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/ColumnsRenderer.d.ts +3 -0
- 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 +13 -17
- package/build/types/common/constants/FeatureName.d.ts +0 -3
- 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/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -2
- package/build/types/common/utils/debounce.d.ts +0 -6
- 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/revamp/renderers/utils/mapping-utils.d.ts +0 -3
- package/build/types/revamp/step/utils/render-utils.d.ts +0 -5
- package/build/types/step/cameraStep/CameraStep.d.ts +0 -7
- package/build/types/step/cameraStep/cameraCapture/CameraCapture.d.ts +0 -15
- package/build/types/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -18
- package/build/types/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +0 -2
- package/build/types/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -2
- package/build/types/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -13
- package/build/types/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -5
- package/build/types/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -18
- package/build/types/step/cameraStep/cameraCapture/screens/index.d.ts +0 -2
- package/build/types/step/cameraStep/cameraCapture/tracking/index.d.ts +0 -7
- 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/{jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts → common/validationMessages/validation.messages.d.ts} +0 -0
- /package/build/types/{common → legacy/common}/constants/DateMode.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/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/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.messages.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/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
|
|
1022
|
-
var
|
|
1014
|
+
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
1015
|
+
var import_react44 = require("react");
|
|
1016
|
+
var import_react_intl30 = 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,28 @@ 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
|
-
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
// src/legacy/common/utils/api-utils.ts
|
|
1179
|
+
function isStatus2xx(status) {
|
|
1180
|
+
return status >= 200 && status < 300;
|
|
1181
|
+
}
|
|
1182
|
+
function isStatus422(status) {
|
|
1183
|
+
return status === 422;
|
|
1184
|
+
}
|
|
1185
|
+
function isRelativePath2(url = "") {
|
|
1186
|
+
return !["https://", "http://", "data:"].some(
|
|
1187
|
+
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1188
|
+
);
|
|
1189
|
+
}
|
|
1194
1190
|
|
|
1195
|
-
// src/common/validators/types/type-validators.ts
|
|
1191
|
+
// src/legacy/common/validators/types/type-validators.ts
|
|
1196
1192
|
var isString = (value) => typeof value === "string";
|
|
1197
1193
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
1198
1194
|
var isInteger = (value) => {
|
|
@@ -1204,10 +1200,10 @@ var isArray = (value) => Array.isArray(value);
|
|
|
1204
1200
|
var isNull = (value) => value === null;
|
|
1205
1201
|
var isUndefined = (value) => typeof value === "undefined";
|
|
1206
1202
|
|
|
1207
|
-
// src/common/validators/values/value-validators.ts
|
|
1203
|
+
// src/legacy/common/validators/values/value-validators.ts
|
|
1208
1204
|
var isEmpty = (value) => isString(value) && value.length === 0 || (isObject(value) || isArray(value)) && Object.keys(value).length === 0;
|
|
1209
1205
|
|
|
1210
|
-
// src/common/validators/models/model-utils.ts
|
|
1206
|
+
// src/legacy/common/validators/models/model-utils.ts
|
|
1211
1207
|
function cleanBasicModelWithOneOfSchema(model, schema) {
|
|
1212
1208
|
return schema.oneOf.some(
|
|
1213
1209
|
(nestedSchema) => getValidBasicModelOrNull(model, nestedSchema) === model
|
|
@@ -1308,7 +1304,7 @@ function deepMergeObject(object1, object2) {
|
|
|
1308
1304
|
);
|
|
1309
1305
|
}
|
|
1310
1306
|
|
|
1311
|
-
// src/common/validators/models/model-validators.ts
|
|
1307
|
+
// src/legacy/common/validators/models/model-validators.ts
|
|
1312
1308
|
var getValidModelParts = (model, schema) => {
|
|
1313
1309
|
if (isObjectModel(model)) {
|
|
1314
1310
|
return getValidObjectModelParts(model, schema);
|
|
@@ -1368,7 +1364,7 @@ function getValidArrayModelParts(model, schema) {
|
|
|
1368
1364
|
return cleanModelWithArraySchema(model, schema);
|
|
1369
1365
|
}
|
|
1370
1366
|
|
|
1371
|
-
// src/common/validators/validationFailures/validation-failures.utils.ts
|
|
1367
|
+
// src/legacy/common/validators/validationFailures/validation-failures.utils.ts
|
|
1372
1368
|
function isValidRequired(value, isRequired = false) {
|
|
1373
1369
|
return !isRequired || !isUndefined(value);
|
|
1374
1370
|
}
|
|
@@ -1389,7 +1385,7 @@ function isValidPattern(value, pattern) {
|
|
|
1389
1385
|
return false;
|
|
1390
1386
|
}
|
|
1391
1387
|
const regex = new RegExp(pattern);
|
|
1392
|
-
return
|
|
1388
|
+
return Boolean(regex.test(value));
|
|
1393
1389
|
}
|
|
1394
1390
|
function isValidMaximum(value, maximum) {
|
|
1395
1391
|
return !isNumber(maximum) && !isString(maximum) || (isNumber(value) || isString(value)) && value <= maximum;
|
|
@@ -1404,7 +1400,7 @@ function isValidMaxItems(value, maxItems) {
|
|
|
1404
1400
|
return !isNumber(maxItems) || isArray(value) && value.length <= maxItems;
|
|
1405
1401
|
}
|
|
1406
1402
|
|
|
1407
|
-
// src/common/validators/validationFailures/validation-failures.ts
|
|
1403
|
+
// src/legacy/common/validators/validationFailures/validation-failures.ts
|
|
1408
1404
|
function getValidationFailures(value, schema, isRequired) {
|
|
1409
1405
|
if (schema.const) {
|
|
1410
1406
|
return getConstValidationFailures(value, schema, isRequired);
|
|
@@ -1532,7 +1528,7 @@ function getObjectValidationFailures(value, schema) {
|
|
|
1532
1528
|
return allPresent ? [] : ["required"];
|
|
1533
1529
|
}
|
|
1534
1530
|
|
|
1535
|
-
// src/common/validators/schemas/schema-validators.ts
|
|
1531
|
+
// src/legacy/common/validators/schemas/schema-validators.ts
|
|
1536
1532
|
function isValidStringSchema(value, schema) {
|
|
1537
1533
|
return !getStringValidationFailures(value, schema).length;
|
|
1538
1534
|
}
|
|
@@ -1624,11 +1620,11 @@ function isValidSchema(value, schema) {
|
|
|
1624
1620
|
}
|
|
1625
1621
|
}
|
|
1626
1622
|
|
|
1627
|
-
// src/common/utils/date-utils.ts
|
|
1623
|
+
// src/legacy/common/utils/date-utils.ts
|
|
1628
1624
|
function formatDate(date) {
|
|
1629
1625
|
const d = new Date(date);
|
|
1630
|
-
const month =
|
|
1631
|
-
const day =
|
|
1626
|
+
const month = String(d.getMonth() + 1);
|
|
1627
|
+
const day = String(d.getDate());
|
|
1632
1628
|
const year = d.getFullYear();
|
|
1633
1629
|
const formattedMonth = month.length < 2 ? `0${month}` : month;
|
|
1634
1630
|
const formattedDay = day.length < 2 ? `0${day}` : day;
|
|
@@ -1646,7 +1642,7 @@ var dateStringToDate = (dateString) => {
|
|
|
1646
1642
|
};
|
|
1647
1643
|
var dateToDateString = (date) => formatDate(date);
|
|
1648
1644
|
|
|
1649
|
-
// src/common/utils/debounce.ts
|
|
1645
|
+
// src/legacy/common/utils/debounce.ts
|
|
1650
1646
|
var debounce = (callback, waitMs) => {
|
|
1651
1647
|
let timeoutId;
|
|
1652
1648
|
let lastArgs;
|
|
@@ -1682,7 +1678,7 @@ var debounce = (callback, waitMs) => {
|
|
|
1682
1678
|
return debouncedFn;
|
|
1683
1679
|
};
|
|
1684
1680
|
|
|
1685
|
-
// src/common/utils/is-equal.ts
|
|
1681
|
+
// src/legacy/common/utils/is-equal.ts
|
|
1686
1682
|
var isEqual = (a, b) => {
|
|
1687
1683
|
if (a === b) {
|
|
1688
1684
|
return true;
|
|
@@ -1698,29 +1694,26 @@ var isEqual = (a, b) => {
|
|
|
1698
1694
|
var isObjectEquals = (a, b) => {
|
|
1699
1695
|
const keysA = Object.keys(a);
|
|
1700
1696
|
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;
|
|
1697
|
+
return keysA.length === keysB.length && keysA.every((key) => Object.hasOwn(b, key) && isEqual(a[key], b[key]));
|
|
1705
1698
|
};
|
|
1699
|
+
var isNonNullObject = (a) => typeof a === "object" && a !== null;
|
|
1706
1700
|
|
|
1707
|
-
// src/common/utils/file-utils.ts
|
|
1701
|
+
// src/legacy/common/utils/file-utils.ts
|
|
1708
1702
|
function toKilobytes(sizeInBytes) {
|
|
1709
1703
|
const ONE_KB_IN_BYTES = 1024;
|
|
1710
1704
|
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
1711
1705
|
}
|
|
1712
|
-
var toBase64 = (file) => {
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
});
|
|
1719
|
-
};
|
|
1706
|
+
var toBase64 = (file) => new Promise((resolve, reject) => {
|
|
1707
|
+
const reader = new FileReader();
|
|
1708
|
+
reader.readAsDataURL(file);
|
|
1709
|
+
reader.addEventListener("load", () => resolve(reader.result));
|
|
1710
|
+
reader.addEventListener("error", (error) => reject(error));
|
|
1711
|
+
});
|
|
1720
1712
|
function areFilesSame(newFiles, files) {
|
|
1721
|
-
const fileIdToExistingFileMap = files.reduce(
|
|
1722
|
-
|
|
1723
|
-
|
|
1713
|
+
const fileIdToExistingFileMap = files.reduce(
|
|
1714
|
+
(map, fileObject) => __spreadProps(__spreadValues({}, map), { [fileObject.id]: fileObject }),
|
|
1715
|
+
{}
|
|
1716
|
+
);
|
|
1724
1717
|
for (const newFile of newFiles) {
|
|
1725
1718
|
const existingFileObject = fileIdToExistingFileMap[newFile.id];
|
|
1726
1719
|
const fileDoesNotExistAlready = !existingFileObject;
|
|
@@ -1734,21 +1727,21 @@ function areFilesSame(newFiles, files) {
|
|
|
1734
1727
|
return true;
|
|
1735
1728
|
}
|
|
1736
1729
|
|
|
1737
|
-
// src/common/utils/id-utils.ts
|
|
1730
|
+
// src/legacy/common/utils/id-utils.ts
|
|
1738
1731
|
var generateRandomId = (prefix = "") => {
|
|
1739
1732
|
const prefixString = prefix ? `${prefix}-` : "";
|
|
1740
1733
|
return `${prefixString}${Math.floor(1e8 * Math.random())}`;
|
|
1741
1734
|
};
|
|
1742
1735
|
|
|
1743
|
-
// src/common/utils/schema-utils.ts
|
|
1736
|
+
// src/legacy/common/utils/schema-utils.ts
|
|
1744
1737
|
function isConstSchema(schema) {
|
|
1745
1738
|
return !isUndefined(schema == null ? void 0 : schema.const);
|
|
1746
1739
|
}
|
|
1747
1740
|
function isNoNConstSchema(schema) {
|
|
1748
|
-
return
|
|
1741
|
+
return Boolean(schema) && !isConstSchema(schema);
|
|
1749
1742
|
}
|
|
1750
|
-
var isReadOnlySchema = (schema) =>
|
|
1751
|
-
var isPromotedOneOfSchema = (schema) =>
|
|
1743
|
+
var isReadOnlySchema = (schema) => Boolean(schema.readOnly) && isBasicSchema(schema);
|
|
1744
|
+
var isPromotedOneOfSchema = (schema) => Boolean(schema.oneOf) && Boolean(schema.promotion);
|
|
1752
1745
|
var basicTypes = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
|
|
1753
1746
|
function isBasicSchema(schema) {
|
|
1754
1747
|
return basicTypes.has(schema.type || "") || "const" in schema && schema.const !== void 0;
|
|
@@ -1760,10 +1753,10 @@ function isOneOfObjectSchema(schema) {
|
|
|
1760
1753
|
return isOneOfSchema(schema) && schema.oneOf.every((subSchema) => subSchema.type === "object");
|
|
1761
1754
|
}
|
|
1762
1755
|
function isOneOfSchema(schema) {
|
|
1763
|
-
return
|
|
1756
|
+
return Boolean(schema.oneOf);
|
|
1764
1757
|
}
|
|
1765
1758
|
function isAllOfSchema(schema) {
|
|
1766
|
-
return
|
|
1759
|
+
return Boolean(schema.allOf);
|
|
1767
1760
|
}
|
|
1768
1761
|
function isBlobSchema(schema) {
|
|
1769
1762
|
return schema.type === "blob";
|
|
@@ -1779,23 +1772,19 @@ function isStringSchema(schema) {
|
|
|
1779
1772
|
return schema.type === "string";
|
|
1780
1773
|
}
|
|
1781
1774
|
function isPersistAsyncSchema(schema) {
|
|
1782
|
-
return
|
|
1775
|
+
return Boolean(schema.persistAsync);
|
|
1783
1776
|
}
|
|
1784
1777
|
function isPersistAsyncFileSchema(schema) {
|
|
1785
1778
|
return isPersistAsyncSchema(schema) && (isBlobSchema(schema.persistAsync.schema) || isBase64FileSchema(schema.persistAsync.schema));
|
|
1786
1779
|
}
|
|
1787
|
-
var isValidationAsyncSchema = (schema) =>
|
|
1788
|
-
return isBasicSchema(schema) && !!schema.validationAsync;
|
|
1789
|
-
};
|
|
1780
|
+
var isValidationAsyncSchema = (schema) => isBasicSchema(schema) && Boolean(schema.validationAsync);
|
|
1790
1781
|
function isBase64FileSchema(schema) {
|
|
1791
1782
|
return schema.type === "string" && schema.format === "base64url";
|
|
1792
1783
|
}
|
|
1793
1784
|
function isFileUploadSchema(schema) {
|
|
1794
1785
|
return schema.type === "string" && schema.format === "base64url";
|
|
1795
1786
|
}
|
|
1796
|
-
var isMultipleFileUploadSchema = (schema) =>
|
|
1797
|
-
return isArraySchema(schema) && isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items);
|
|
1798
|
-
};
|
|
1787
|
+
var isMultipleFileUploadSchema = (schema) => isArraySchema(schema) && isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items);
|
|
1799
1788
|
var getSchemaType = (schema) => {
|
|
1800
1789
|
if (isReadOnlySchema(schema)) {
|
|
1801
1790
|
return "readOnly";
|
|
@@ -1827,10 +1816,8 @@ var getSchemaType = (schema) => {
|
|
|
1827
1816
|
return null;
|
|
1828
1817
|
};
|
|
1829
1818
|
|
|
1830
|
-
// src/common/utils/step-utils.ts
|
|
1831
|
-
var isCameraStep = (step) =>
|
|
1832
|
-
return isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
|
|
1833
|
-
};
|
|
1819
|
+
// src/legacy/common/utils/step-utils.ts
|
|
1820
|
+
var isCameraStep = (step) => isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
|
|
1834
1821
|
var isFormStep = (step) => !step.type || step.type === "form";
|
|
1835
1822
|
var hasSingleAction = (step) => {
|
|
1836
1823
|
var _a;
|
|
@@ -1854,16 +1841,14 @@ var hasSingleFileUploadSchemaWithCameraOnly = (step) => {
|
|
|
1854
1841
|
}
|
|
1855
1842
|
return childSchema.source === "camera";
|
|
1856
1843
|
};
|
|
1857
|
-
var filterHiddenSchemas = (schemas) => {
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
});
|
|
1864
|
-
};
|
|
1844
|
+
var filterHiddenSchemas = (schemas) => schemas.filter((schema) => {
|
|
1845
|
+
if (isObjectSchema(schema)) {
|
|
1846
|
+
return Object.values((schema == null ? void 0 : schema.properties) || {}).find((schema2) => (schema2 == null ? void 0 : schema2.hidden) !== true);
|
|
1847
|
+
}
|
|
1848
|
+
return (schema == null ? void 0 : schema.hidden) !== true;
|
|
1849
|
+
});
|
|
1865
1850
|
|
|
1866
|
-
// src/common/utils/model-utils.ts
|
|
1851
|
+
// src/legacy/common/utils/model-utils.ts
|
|
1867
1852
|
var isObjectModel = (model) => typeof model === "object" && model !== null && model.constructor === Object;
|
|
1868
1853
|
var isNullableObjectModel = (model) => isNull(model) || isObjectModel(model);
|
|
1869
1854
|
var isNullableBasicModel = (model) => isBoolean(model) || isNumber(model) || isString(model) || isNull(model);
|
|
@@ -1886,37 +1871,34 @@ var isNullableArrayModel = (model) => {
|
|
|
1886
1871
|
return isArrayModel(model);
|
|
1887
1872
|
};
|
|
1888
1873
|
|
|
1889
|
-
// src/common/utils/misc-utils.ts
|
|
1874
|
+
// src/legacy/common/utils/misc-utils.ts
|
|
1890
1875
|
var isBasicError = (error) => isString(error) || isNull(error);
|
|
1891
1876
|
|
|
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
|
-
};
|
|
1877
|
+
// src/legacy/common/utils/mobile-utils.ts
|
|
1878
|
+
var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
1879
|
+
var isMobileUA = (userAgent = window.navigator.userAgent) => (
|
|
1880
|
+
// eslint-disable-next-line regexp/no-unused-capturing-group
|
|
1881
|
+
/mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
|
|
1882
|
+
);
|
|
1883
|
+
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
|
|
1902
1884
|
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
1903
1885
|
if ("maxTouchPoints" in navigator2) {
|
|
1904
1886
|
return navigator2.maxTouchPoints > 0;
|
|
1905
1887
|
}
|
|
1906
1888
|
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
1907
1889
|
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
1908
|
-
return
|
|
1890
|
+
return Boolean(mQ.matches);
|
|
1909
1891
|
}
|
|
1910
1892
|
return false;
|
|
1911
1893
|
};
|
|
1912
1894
|
|
|
1913
|
-
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1895
|
+
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1914
1896
|
var import_react7 = require("react");
|
|
1915
1897
|
function useDebouncedFunction(callback, waitMs) {
|
|
1916
1898
|
return (0, import_react7.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
1917
1899
|
}
|
|
1918
1900
|
|
|
1919
|
-
// src/common/hooks/useExternal/useExternal.tsx
|
|
1901
|
+
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
1920
1902
|
var import_react8 = require("react");
|
|
1921
1903
|
function useExternal(url) {
|
|
1922
1904
|
const [externalWindow, setExternalWindow] = (0, import_react8.useState)(null);
|
|
@@ -1932,28 +1914,25 @@ function useExternal(url) {
|
|
|
1932
1914
|
return { requiresManualTrigger, dismissConfirmation };
|
|
1933
1915
|
}
|
|
1934
1916
|
|
|
1935
|
-
// src/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1917
|
+
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
1936
1918
|
var import_react9 = require("react");
|
|
1937
1919
|
function useExternalStepPolling(polling, onAction) {
|
|
1938
1920
|
const httpClient = useHttpClient();
|
|
1939
1921
|
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
1940
1922
|
if (polling) {
|
|
1941
|
-
return () => {
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
} catch (e) {
|
|
1947
|
-
throw new Error("failed");
|
|
1948
|
-
}
|
|
1949
|
-
} else {
|
|
1923
|
+
return () => httpClient(polling.url).then((response) => {
|
|
1924
|
+
if (response.ok) {
|
|
1925
|
+
try {
|
|
1926
|
+
return response.json();
|
|
1927
|
+
} catch (e) {
|
|
1950
1928
|
throw new Error("failed");
|
|
1951
1929
|
}
|
|
1952
|
-
}
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1930
|
+
} else {
|
|
1931
|
+
throw new Error("failed");
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1956
1934
|
}
|
|
1935
|
+
return void 0;
|
|
1957
1936
|
}, [polling, httpClient]);
|
|
1958
1937
|
const onPollingResponse = (0, import_react9.useCallback)(
|
|
1959
1938
|
(pollingResponse) => {
|
|
@@ -1990,11 +1969,11 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
1990
1969
|
});
|
|
1991
1970
|
}
|
|
1992
1971
|
|
|
1993
|
-
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1994
|
-
var
|
|
1972
|
+
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
1973
|
+
var import_react31 = require("react");
|
|
1995
1974
|
var import_react_intl21 = require("react-intl");
|
|
1996
1975
|
|
|
1997
|
-
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
1976
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
|
|
1998
1977
|
var import_react_intl = require("react-intl");
|
|
1999
1978
|
var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)({
|
|
2000
1979
|
genericError: {
|
|
@@ -2004,17 +1983,17 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
2004
1983
|
}
|
|
2005
1984
|
});
|
|
2006
1985
|
|
|
2007
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
2008
|
-
var
|
|
1986
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
1987
|
+
var import_react30 = require("react");
|
|
2009
1988
|
var import_react_intl20 = require("react-intl");
|
|
2010
1989
|
|
|
2011
|
-
// src/common/constants/DateMode.ts
|
|
1990
|
+
// src/legacy/common/constants/DateMode.ts
|
|
2012
1991
|
var DateMode = {
|
|
2013
1992
|
DAY_MONTH_YEAR: "day-month-year",
|
|
2014
1993
|
MONTH_YEAR: "month-year"
|
|
2015
1994
|
};
|
|
2016
1995
|
|
|
2017
|
-
// src/common/constants/FormControlType.ts
|
|
1996
|
+
// src/legacy/common/constants/FormControlType.ts
|
|
2018
1997
|
var FormControlType = {
|
|
2019
1998
|
RADIO: "radio",
|
|
2020
1999
|
CHECKBOX: "checkbox",
|
|
@@ -2037,13 +2016,13 @@ var FormControlType = {
|
|
|
2037
2016
|
TAB: "tab"
|
|
2038
2017
|
};
|
|
2039
2018
|
|
|
2040
|
-
// src/common/constants/MonthFormat.ts
|
|
2019
|
+
// src/legacy/common/constants/MonthFormat.ts
|
|
2041
2020
|
var MonthFormat = {
|
|
2042
2021
|
SHORT: "short",
|
|
2043
2022
|
LONG: "long"
|
|
2044
2023
|
};
|
|
2045
2024
|
|
|
2046
|
-
// src/common/constants/Size.ts
|
|
2025
|
+
// src/legacy/common/constants/Size.ts
|
|
2047
2026
|
var Size = {
|
|
2048
2027
|
EXTRA_SMALL: "xs",
|
|
2049
2028
|
SMALL: "sm",
|
|
@@ -2052,17 +2031,17 @@ var Size = {
|
|
|
2052
2031
|
EXTRA_LARGE: "xl"
|
|
2053
2032
|
};
|
|
2054
2033
|
|
|
2055
|
-
// src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2056
|
-
var
|
|
2057
|
-
var
|
|
2034
|
+
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
2035
|
+
var import_classnames7 = __toESM(require_classnames());
|
|
2036
|
+
var import_react29 = require("react");
|
|
2058
2037
|
|
|
2059
|
-
// src/layout/alert/DynamicAlert.tsx
|
|
2038
|
+
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
2060
2039
|
var import_components2 = require("@transferwise/components");
|
|
2061
2040
|
|
|
2062
|
-
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2041
|
+
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
2063
2042
|
var import_components = require("@transferwise/components");
|
|
2064
2043
|
|
|
2065
|
-
// src/layout/icon/FlagIcon.tsx
|
|
2044
|
+
// src/legacy/layout/icon/FlagIcon.tsx
|
|
2066
2045
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2067
2046
|
var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
|
|
2068
2047
|
var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
|
|
@@ -2264,7 +2243,7 @@ var countryCodes = [
|
|
|
2264
2243
|
"zm"
|
|
2265
2244
|
];
|
|
2266
2245
|
|
|
2267
|
-
// src/layout/icon/NamedIcon.tsx
|
|
2246
|
+
// src/legacy/layout/icon/NamedIcon.tsx
|
|
2268
2247
|
var icons = __toESM(require("@transferwise/icons"));
|
|
2269
2248
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2270
2249
|
var isNamedIcon = (name) => {
|
|
@@ -2285,7 +2264,7 @@ var capitaliseFirstChar = (value) => {
|
|
|
2285
2264
|
return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
|
|
2286
2265
|
};
|
|
2287
2266
|
|
|
2288
|
-
// src/layout/icon/DynamicIcon.tsx
|
|
2267
|
+
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
2289
2268
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2290
2269
|
var DynamicIcon = ({ type }) => {
|
|
2291
2270
|
if (isFlagIcon(type)) {
|
|
@@ -2301,7 +2280,7 @@ function isValidIconName(name) {
|
|
|
2301
2280
|
}
|
|
2302
2281
|
var DynamicIcon_default = DynamicIcon;
|
|
2303
2282
|
|
|
2304
|
-
// src/layout/utils/getNavigationOptionMedia.tsx
|
|
2283
|
+
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
2305
2284
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2306
2285
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
2307
2286
|
if (icon == null ? void 0 : icon.name) {
|
|
@@ -2317,7 +2296,7 @@ var getNavigationOptionMedia = ({ icon, image }) => {
|
|
|
2317
2296
|
return null;
|
|
2318
2297
|
};
|
|
2319
2298
|
|
|
2320
|
-
// src/layout/utils/index.ts
|
|
2299
|
+
// src/legacy/layout/utils/index.ts
|
|
2321
2300
|
var getMargin = (size) => {
|
|
2322
2301
|
switch (size) {
|
|
2323
2302
|
case "xs":
|
|
@@ -2347,7 +2326,7 @@ var getTextAlignment = (align) => {
|
|
|
2347
2326
|
};
|
|
2348
2327
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
2349
2328
|
|
|
2350
|
-
// src/layout/alert/DynamicAlert.tsx
|
|
2329
|
+
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
2351
2330
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2352
2331
|
var DynamicAlert = (props) => {
|
|
2353
2332
|
const alert = props.component;
|
|
@@ -2383,7 +2362,7 @@ var mapContextToAlertType = (context) => {
|
|
|
2383
2362
|
};
|
|
2384
2363
|
var DynamicAlert_default = DynamicAlert;
|
|
2385
2364
|
|
|
2386
|
-
// src/layout/box/DynamicBox.tsx
|
|
2365
|
+
// src/legacy/layout/box/DynamicBox.tsx
|
|
2387
2366
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2388
2367
|
var DynamicBox = (props) => {
|
|
2389
2368
|
const box = props.component;
|
|
@@ -2435,10 +2414,10 @@ var getBoxWidthClasses = (component) => {
|
|
|
2435
2414
|
};
|
|
2436
2415
|
var DynamicBox_default = DynamicBox;
|
|
2437
2416
|
|
|
2438
|
-
// src/layout/button/DynamicButton.tsx
|
|
2417
|
+
// src/legacy/layout/button/DynamicButton.tsx
|
|
2439
2418
|
var import_components3 = require("@transferwise/components");
|
|
2440
2419
|
|
|
2441
|
-
// src/layout/button/utils.ts
|
|
2420
|
+
// src/legacy/layout/button/utils.ts
|
|
2442
2421
|
var priorities = {
|
|
2443
2422
|
primary: "primary",
|
|
2444
2423
|
secondary: "secondary",
|
|
@@ -2478,7 +2457,7 @@ var getButtonSize = (size) => {
|
|
|
2478
2457
|
}
|
|
2479
2458
|
};
|
|
2480
2459
|
|
|
2481
|
-
// src/layout/button/DynamicButton.tsx
|
|
2460
|
+
// src/legacy/layout/button/DynamicButton.tsx
|
|
2482
2461
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2483
2462
|
var DynamicButton = (props) => {
|
|
2484
2463
|
var _a;
|
|
@@ -2504,7 +2483,7 @@ var DynamicButton = (props) => {
|
|
|
2504
2483
|
};
|
|
2505
2484
|
var DynamicButton_default = DynamicButton;
|
|
2506
2485
|
|
|
2507
|
-
// src/layout/columns/DynamicColumns.tsx
|
|
2486
|
+
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
2508
2487
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2509
2488
|
var DynamicColumns = (props) => {
|
|
2510
2489
|
const columns = props.component;
|
|
@@ -2556,25 +2535,27 @@ var getWidth = (bias) => {
|
|
|
2556
2535
|
};
|
|
2557
2536
|
var DynamicColumns_default = DynamicColumns;
|
|
2558
2537
|
|
|
2559
|
-
// src/layout/decision/DynamicDecision.tsx
|
|
2538
|
+
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
2560
2539
|
var import_components4 = require("@transferwise/components");
|
|
2561
2540
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2562
|
-
|
|
2563
|
-
import_components4.
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
)
|
|
2541
|
+
function DynamicDecision({ component, onAction }) {
|
|
2542
|
+
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)(
|
|
2543
|
+
import_components4.NavigationOption,
|
|
2544
|
+
{
|
|
2545
|
+
title: option.title,
|
|
2546
|
+
content: option.description,
|
|
2547
|
+
disabled: option.disabled,
|
|
2548
|
+
media: getNavigationOptionMedia(option),
|
|
2549
|
+
showMediaCircle: false,
|
|
2550
|
+
showMediaAtAllSizes: true,
|
|
2551
|
+
onClick: () => onAction(option.action)
|
|
2552
|
+
},
|
|
2553
|
+
JSON.stringify(option)
|
|
2554
|
+
)) }) });
|
|
2555
|
+
}
|
|
2575
2556
|
var DynamicDecision_default = DynamicDecision;
|
|
2576
2557
|
|
|
2577
|
-
// src/layout/divider/DynamicDivider.tsx
|
|
2558
|
+
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
2578
2559
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2579
2560
|
var DynamicDivider = ({ component }) => {
|
|
2580
2561
|
const margin = getMargin(component.margin);
|
|
@@ -2583,12 +2564,12 @@ var DynamicDivider = ({ component }) => {
|
|
|
2583
2564
|
};
|
|
2584
2565
|
var DynamicDivider_default = DynamicDivider;
|
|
2585
2566
|
|
|
2586
|
-
// src/layout/external/DynamicExternal.tsx
|
|
2567
|
+
// src/legacy/layout/external/DynamicExternal.tsx
|
|
2587
2568
|
var import_components5 = require("@transferwise/components");
|
|
2588
2569
|
var import_react10 = require("react");
|
|
2589
2570
|
var import_react_intl3 = require("react-intl");
|
|
2590
2571
|
|
|
2591
|
-
// src/layout/external/DynamicExternal.messages.js
|
|
2572
|
+
// src/legacy/layout/external/DynamicExternal.messages.js
|
|
2592
2573
|
var import_react_intl2 = require("react-intl");
|
|
2593
2574
|
var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
2594
2575
|
retryTitle: {
|
|
@@ -2598,7 +2579,7 @@ var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
|
|
|
2598
2579
|
}
|
|
2599
2580
|
});
|
|
2600
2581
|
|
|
2601
|
-
// src/layout/external/DynamicExternal.tsx
|
|
2582
|
+
// src/legacy/layout/external/DynamicExternal.tsx
|
|
2602
2583
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2603
2584
|
var DynamicExternal = ({ component, onAction }) => {
|
|
2604
2585
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
@@ -2622,30 +2603,22 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
2622
2603
|
};
|
|
2623
2604
|
var DynamicExternal_default = DynamicExternal;
|
|
2624
2605
|
|
|
2625
|
-
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2606
|
+
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
2626
2607
|
var import_react22 = require("react");
|
|
2627
2608
|
|
|
2628
|
-
// src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2609
|
+
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
2629
2610
|
var import_components6 = require("@transferwise/components");
|
|
2630
2611
|
var import_classnames = __toESM(require_classnames());
|
|
2631
2612
|
var import_react11 = require("react");
|
|
2632
2613
|
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) => {
|
|
2614
|
+
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
2615
|
+
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
2616
|
+
var getSchemaColumnClasses = (width) => ({
|
|
2617
|
+
"col-xs-12": true,
|
|
2618
|
+
"col-sm-6": width === "md",
|
|
2619
|
+
"col-sm-4": width === "sm"
|
|
2620
|
+
});
|
|
2621
|
+
function AllOfSchema(props) {
|
|
2649
2622
|
const onChangeModelIndex = (index, onChangeProps) => {
|
|
2650
2623
|
const modelSchema = props.schema.allOf[index];
|
|
2651
2624
|
models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
|
|
@@ -2675,25 +2648,25 @@ var AllOfSchema = (props) => {
|
|
|
2675
2648
|
) }, index)
|
|
2676
2649
|
)) })
|
|
2677
2650
|
] });
|
|
2678
|
-
}
|
|
2651
|
+
}
|
|
2679
2652
|
AllOfSchema.defaultProps = {
|
|
2680
2653
|
disabled: false
|
|
2681
2654
|
};
|
|
2682
2655
|
var AllOfSchema_default = AllOfSchema;
|
|
2683
2656
|
|
|
2684
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2657
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2685
2658
|
var import_components8 = require("@transferwise/components");
|
|
2686
2659
|
var import_classnames2 = __toESM(require_classnames());
|
|
2687
2660
|
var import_react12 = require("react");
|
|
2688
2661
|
|
|
2689
|
-
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2662
|
+
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2690
2663
|
var import_components7 = require("@transferwise/components");
|
|
2691
2664
|
var import_formatting = require("@transferwise/formatting");
|
|
2692
2665
|
var import_react_intl5 = require("react-intl");
|
|
2693
2666
|
|
|
2694
|
-
// src/
|
|
2667
|
+
// src/common/validationMessages/validation.messages.ts
|
|
2695
2668
|
var import_react_intl4 = require("react-intl");
|
|
2696
|
-
var
|
|
2669
|
+
var validation_messages_default = (0, import_react_intl4.defineMessages)({
|
|
2697
2670
|
type: {
|
|
2698
2671
|
id: "dynamicFlows.ControlFeedback.type",
|
|
2699
2672
|
defaultMessage: "Incorrect type",
|
|
@@ -2746,16 +2719,16 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
|
|
|
2746
2719
|
}
|
|
2747
2720
|
});
|
|
2748
2721
|
|
|
2749
|
-
// src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2722
|
+
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
2750
2723
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2751
|
-
|
|
2724
|
+
function ControlFeedback(props) {
|
|
2752
2725
|
var _a;
|
|
2753
2726
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
2754
2727
|
const validationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), props.validationMessages), props.schema.validationMessages);
|
|
2755
|
-
const isErrorVisible = (props.submitted || !props.changed) &&
|
|
2756
|
-
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) &&
|
|
2728
|
+
const isErrorVisible = (props.submitted || !props.changed) && Boolean(props.errors);
|
|
2729
|
+
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
|
|
2757
2730
|
const isDescriptionVisible = props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
2758
|
-
const hasInfoMessage =
|
|
2731
|
+
const hasInfoMessage = Boolean(props.infoMessage);
|
|
2759
2732
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { id: props.id, children: [
|
|
2760
2733
|
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
2761
2734
|
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
@@ -2764,7 +2737,7 @@ var ControlFeedback = (props) => {
|
|
|
2764
2737
|
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: props.infoMessage })
|
|
2765
2738
|
] })
|
|
2766
2739
|
] });
|
|
2767
|
-
}
|
|
2740
|
+
}
|
|
2768
2741
|
ControlFeedback.defaultProps = {
|
|
2769
2742
|
errors: "",
|
|
2770
2743
|
validations: [],
|
|
@@ -2774,26 +2747,26 @@ ControlFeedback.defaultProps = {
|
|
|
2774
2747
|
function useDefaultValidationMessages(schema) {
|
|
2775
2748
|
const { formatMessage, locale } = (0, import_react_intl5.useIntl)();
|
|
2776
2749
|
const formattedMessages = {
|
|
2777
|
-
type: formatMessage(
|
|
2778
|
-
minimum: formatMessage(
|
|
2750
|
+
type: formatMessage(validation_messages_default.type),
|
|
2751
|
+
minimum: formatMessage(validation_messages_default.minimum, {
|
|
2779
2752
|
minimum: schema.minimum
|
|
2780
2753
|
}),
|
|
2781
|
-
maximum: formatMessage(
|
|
2754
|
+
maximum: formatMessage(validation_messages_default.maximum, {
|
|
2782
2755
|
maximum: schema.maximum
|
|
2783
2756
|
}),
|
|
2784
|
-
minLength: formatMessage(
|
|
2757
|
+
minLength: formatMessage(validation_messages_default.minLength, {
|
|
2785
2758
|
minLength: schema.minLength
|
|
2786
2759
|
}),
|
|
2787
|
-
maxLength: formatMessage(
|
|
2760
|
+
maxLength: formatMessage(validation_messages_default.maxLength, {
|
|
2788
2761
|
maxLength: schema.maxLength
|
|
2789
2762
|
}),
|
|
2790
|
-
pattern: formatMessage(
|
|
2791
|
-
required: formatMessage(
|
|
2763
|
+
pattern: formatMessage(validation_messages_default.pattern),
|
|
2764
|
+
required: formatMessage(validation_messages_default.required)
|
|
2792
2765
|
};
|
|
2793
2766
|
if (schema.format === "date") {
|
|
2794
2767
|
const dateOverrides = {
|
|
2795
|
-
pattern: formatMessage(
|
|
2796
|
-
minimum: schema.minimum ? formatMessage(
|
|
2768
|
+
pattern: formatMessage(validation_messages_default.patternDate),
|
|
2769
|
+
minimum: schema.minimum ? formatMessage(validation_messages_default.minimumDate, {
|
|
2797
2770
|
minimum: (0, import_formatting.formatDate)(
|
|
2798
2771
|
new Date(schema.minimum),
|
|
2799
2772
|
locale,
|
|
@@ -2803,7 +2776,7 @@ function useDefaultValidationMessages(schema) {
|
|
|
2803
2776
|
}
|
|
2804
2777
|
)
|
|
2805
2778
|
}) : void 0,
|
|
2806
|
-
maximum: schema.maximum ? formatMessage(
|
|
2779
|
+
maximum: schema.maximum ? formatMessage(validation_messages_default.maximumDate, {
|
|
2807
2780
|
maximum: (0, import_formatting.formatDate)(
|
|
2808
2781
|
new Date(schema.maximum),
|
|
2809
2782
|
locale,
|
|
@@ -2820,18 +2793,17 @@ function useDefaultValidationMessages(schema) {
|
|
|
2820
2793
|
}
|
|
2821
2794
|
var ControlFeedback_default = ControlFeedback;
|
|
2822
2795
|
|
|
2823
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.ts
|
|
2796
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.ts
|
|
2824
2797
|
async function createPayload(userUploadedFile, isBlobSchema2) {
|
|
2825
2798
|
if (isBlobSchema2) {
|
|
2826
2799
|
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
2800
|
}
|
|
2801
|
+
if (userUploadedFile instanceof Blob) {
|
|
2802
|
+
return toBase64(userUploadedFile);
|
|
2803
|
+
}
|
|
2804
|
+
throw new Error(
|
|
2805
|
+
"Error creating payload for MultipleFileUploadSchema. Uploaded file is not an instance of Blob."
|
|
2806
|
+
);
|
|
2835
2807
|
}
|
|
2836
2808
|
function constructUploadResponse(response) {
|
|
2837
2809
|
const id = response.data;
|
|
@@ -2847,17 +2819,16 @@ function constructUploadError(response) {
|
|
|
2847
2819
|
if (isError) {
|
|
2848
2820
|
const error = response;
|
|
2849
2821
|
return { id: generateRandomId(), message: error.message };
|
|
2850
|
-
} else {
|
|
2851
|
-
return __spreadValues({
|
|
2852
|
-
message: isString(response.message) ? response.message : ""
|
|
2853
|
-
}, response);
|
|
2854
2822
|
}
|
|
2823
|
+
return __spreadValues({
|
|
2824
|
+
message: isString(response.message) ? response.message : ""
|
|
2825
|
+
}, response);
|
|
2855
2826
|
}
|
|
2856
2827
|
|
|
2857
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2828
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2858
2829
|
var import_react_intl8 = require("react-intl");
|
|
2859
2830
|
|
|
2860
|
-
// src/common/messages.ts
|
|
2831
|
+
// src/legacy/common/messages.ts
|
|
2861
2832
|
var import_react_intl6 = require("react-intl");
|
|
2862
2833
|
var messages_default = (0, import_react_intl6.defineMessages)({
|
|
2863
2834
|
required: {
|
|
@@ -2867,7 +2838,7 @@ var messages_default = (0, import_react_intl6.defineMessages)({
|
|
|
2867
2838
|
}
|
|
2868
2839
|
});
|
|
2869
2840
|
|
|
2870
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js
|
|
2841
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js
|
|
2871
2842
|
var import_react_intl7 = require("react-intl");
|
|
2872
2843
|
var MultipleFileUploadSchema_messages_default = (0, import_react_intl7.defineMessages)({
|
|
2873
2844
|
minItemsError: {
|
|
@@ -2887,7 +2858,7 @@ var MultipleFileUploadSchema_messages_default = (0, import_react_intl7.defineMes
|
|
|
2887
2858
|
}
|
|
2888
2859
|
});
|
|
2889
2860
|
|
|
2890
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2861
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.tsx
|
|
2891
2862
|
function useFormattedDefaultErrorMessages({
|
|
2892
2863
|
maxItems,
|
|
2893
2864
|
minItems
|
|
@@ -2902,9 +2873,9 @@ function useFormattedDefaultErrorMessages({
|
|
|
2902
2873
|
};
|
|
2903
2874
|
}
|
|
2904
2875
|
|
|
2905
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2876
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
2906
2877
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2907
|
-
|
|
2878
|
+
function MultipleFileUploadSchema(props) {
|
|
2908
2879
|
var _a, _b;
|
|
2909
2880
|
const { onChange, schema } = props;
|
|
2910
2881
|
const onEvent = useEventDispatcher();
|
|
@@ -2988,7 +2959,7 @@ var MultipleFileUploadSchema = (props) => {
|
|
|
2988
2959
|
}
|
|
2989
2960
|
)
|
|
2990
2961
|
] });
|
|
2991
|
-
}
|
|
2962
|
+
}
|
|
2992
2963
|
MultipleFileUploadSchema.defaultProps = {
|
|
2993
2964
|
errors: null,
|
|
2994
2965
|
required: false
|
|
@@ -3008,13 +2979,13 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
3008
2979
|
return __spreadValues(__spreadValues(__spreadValues({}, required && { required: defaultErrorMessages.requiredMessage }), minItems && { minItems: defaultErrorMessages.minItemsErrorMessage }), maxItems && { maxItems: defaultErrorMessages.maxItemsErrorMessage });
|
|
3009
2980
|
}
|
|
3010
2981
|
|
|
3011
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
2982
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3012
2983
|
var import_components10 = require("@transferwise/components");
|
|
3013
2984
|
var import_icons = require("@transferwise/icons");
|
|
3014
2985
|
var import_react13 = require("react");
|
|
3015
2986
|
var import_react_intl11 = require("react-intl");
|
|
3016
2987
|
|
|
3017
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
2988
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
3018
2989
|
var import_components9 = require("@transferwise/components");
|
|
3019
2990
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3020
2991
|
var ItemSummaryOption = ({
|
|
@@ -3033,7 +3004,7 @@ var ItemSummaryOption = ({
|
|
|
3033
3004
|
);
|
|
3034
3005
|
};
|
|
3035
3006
|
|
|
3036
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.ts
|
|
3007
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.ts
|
|
3037
3008
|
var import_react_intl9 = require("react-intl");
|
|
3038
3009
|
var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
3039
3010
|
addItemTitle: {
|
|
@@ -3058,10 +3029,10 @@ var RepeatableSchema_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
3058
3029
|
}
|
|
3059
3030
|
});
|
|
3060
3031
|
|
|
3061
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3032
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3062
3033
|
var import_react_intl10 = require("react-intl");
|
|
3063
3034
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3064
|
-
|
|
3035
|
+
function RepeatableSchemaStep({
|
|
3065
3036
|
type,
|
|
3066
3037
|
schema,
|
|
3067
3038
|
model,
|
|
@@ -3069,7 +3040,7 @@ var RepeatableSchemaStep = ({
|
|
|
3069
3040
|
submitted,
|
|
3070
3041
|
onModelChange,
|
|
3071
3042
|
onAction
|
|
3072
|
-
})
|
|
3043
|
+
}) {
|
|
3073
3044
|
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
3074
3045
|
const step = {
|
|
3075
3046
|
layout: [
|
|
@@ -3115,10 +3086,10 @@ var RepeatableSchemaStep = ({
|
|
|
3115
3086
|
onModelChange
|
|
3116
3087
|
}
|
|
3117
3088
|
);
|
|
3118
|
-
}
|
|
3089
|
+
}
|
|
3119
3090
|
var RepeatableSchemaStep_default = RepeatableSchemaStep;
|
|
3120
3091
|
|
|
3121
|
-
// src/jsonSchemaForm/oneOfSchema/utils.ts
|
|
3092
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/utils.ts
|
|
3122
3093
|
var getActiveSchemaIndex = (schema, model) => {
|
|
3123
3094
|
const indexFromModel = getValidIndexFromValue(schema, model);
|
|
3124
3095
|
if (indexFromModel >= 0) {
|
|
@@ -3169,7 +3140,7 @@ function getSchemaProperties(childSchema) {
|
|
|
3169
3140
|
return childSchema.properties !== null && typeof childSchema.properties === "object" ? Object.entries(childSchema.properties) : [];
|
|
3170
3141
|
}
|
|
3171
3142
|
|
|
3172
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.ts
|
|
3143
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.ts
|
|
3173
3144
|
var getItemSummaryFromSchema = (schema, model, defaults = {}) => {
|
|
3174
3145
|
const { defaultTitle = "", defaultDescription = "", defaultIcon, defaultImage } = defaults;
|
|
3175
3146
|
const title = getSummaryPropFromSchema({
|
|
@@ -3295,9 +3266,12 @@ var getStringValueFromSchema = (schema, model) => {
|
|
|
3295
3266
|
}
|
|
3296
3267
|
return isNullableStringModel(model) ? model : null;
|
|
3297
3268
|
};
|
|
3298
|
-
var schemaSummaryProvides = (summary, providesProp) =>
|
|
3269
|
+
var schemaSummaryProvides = (summary, providesProp) => (
|
|
3270
|
+
// eslint-disable-next-line prefer-object-has-own, no-implicit-coercion
|
|
3271
|
+
!!summary && Object.hasOwnProperty.call(summary, providesProp) && Boolean(summary[providesProp])
|
|
3272
|
+
);
|
|
3299
3273
|
|
|
3300
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3274
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
3301
3275
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3302
3276
|
var RepeatableSchema = ({
|
|
3303
3277
|
schema,
|
|
@@ -3417,7 +3391,7 @@ var getUpdatedItemSummaries = (action, {
|
|
|
3417
3391
|
};
|
|
3418
3392
|
var RepeatableSchema_default = RepeatableSchema;
|
|
3419
3393
|
|
|
3420
|
-
// src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3394
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
3421
3395
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3422
3396
|
var ArrayListSchema = (props) => {
|
|
3423
3397
|
const { schema } = props;
|
|
@@ -3435,7 +3409,7 @@ ArrayListSchema.defaultProps = {
|
|
|
3435
3409
|
};
|
|
3436
3410
|
var ArrayListSchema_default = ArrayListSchema;
|
|
3437
3411
|
|
|
3438
|
-
// src/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3412
|
+
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
3439
3413
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3440
3414
|
var ArraySchema = (props) => {
|
|
3441
3415
|
const { schema } = props;
|
|
@@ -3449,18 +3423,16 @@ ArraySchema.defaultProps = {
|
|
|
3449
3423
|
};
|
|
3450
3424
|
var ArraySchema_default = ArraySchema;
|
|
3451
3425
|
|
|
3452
|
-
// src/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3426
|
+
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
3453
3427
|
var import_classnames3 = __toESM(require_classnames());
|
|
3454
3428
|
var import_react14 = require("react");
|
|
3455
3429
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3456
|
-
var getSchemaColumnClasses2 = (width) => {
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
};
|
|
3463
|
-
var ObjectSchema = (props) => {
|
|
3430
|
+
var getSchemaColumnClasses2 = (width) => ({
|
|
3431
|
+
"col-xs-12": true,
|
|
3432
|
+
"col-sm-6": width === "md",
|
|
3433
|
+
"col-sm-4": width === "sm"
|
|
3434
|
+
});
|
|
3435
|
+
function ObjectSchema(props) {
|
|
3464
3436
|
const [model, setModel] = (0, import_react14.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
3465
3437
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
3466
3438
|
if (onChangeProps.model !== null) {
|
|
@@ -3490,58 +3462,60 @@ var ObjectSchema = (props) => {
|
|
|
3490
3462
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
3491
3463
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
3492
3464
|
const propsErrors = props.errors;
|
|
3493
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
3494
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("legend", { children: [
|
|
3495
|
-
" ",
|
|
3496
|
-
props.schema.title,
|
|
3497
|
-
" "
|
|
3498
|
-
] }),
|
|
3499
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { children: [
|
|
3500
|
-
" ",
|
|
3501
|
-
props.schema.description,
|
|
3502
|
-
" "
|
|
3503
|
-
] }),
|
|
3465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3504
3466
|
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
3505
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.
|
|
3506
|
-
"
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3467
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("fieldset", { children: [
|
|
3468
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("legend", { children: [
|
|
3469
|
+
" ",
|
|
3470
|
+
props.schema.title,
|
|
3471
|
+
" "
|
|
3472
|
+
] }),
|
|
3473
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("p", { children: [
|
|
3474
|
+
" ",
|
|
3475
|
+
props.schema.description,
|
|
3476
|
+
" "
|
|
3477
|
+
] }),
|
|
3478
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3479
|
+
"div",
|
|
3480
|
+
{
|
|
3481
|
+
className: (0, import_classnames3.default)(
|
|
3482
|
+
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
3483
|
+
),
|
|
3484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3485
|
+
GenericSchema_default,
|
|
3486
|
+
{
|
|
3487
|
+
schema: props.schema.properties[propertyName],
|
|
3488
|
+
model: props.model && props.model[propertyName],
|
|
3489
|
+
errors: propsErrors == null ? void 0 : propsErrors[propertyName],
|
|
3490
|
+
submitted: props.submitted,
|
|
3491
|
+
required: isRequired(propertyName),
|
|
3492
|
+
disabled: props.disabled,
|
|
3493
|
+
onChange: (onChangeProps) => onChangeProperty(propertyName, onChangeProps),
|
|
3494
|
+
onPersistAsync: props.onPersistAsync
|
|
3495
|
+
}
|
|
3496
|
+
)
|
|
3497
|
+
},
|
|
3498
|
+
propertyName
|
|
3499
|
+
)) })
|
|
3500
|
+
] })
|
|
3527
3501
|
] });
|
|
3528
|
-
}
|
|
3502
|
+
}
|
|
3529
3503
|
ObjectSchema.defaultProps = {
|
|
3530
3504
|
hideTitle: false,
|
|
3531
3505
|
disabled: false
|
|
3532
3506
|
};
|
|
3533
3507
|
var ObjectSchema_default = ObjectSchema;
|
|
3534
3508
|
|
|
3535
|
-
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3509
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
3536
3510
|
var import_components14 = require("@transferwise/components");
|
|
3537
3511
|
var import_classnames4 = __toESM(require_classnames());
|
|
3538
3512
|
var import_react17 = require("react");
|
|
3539
3513
|
|
|
3540
|
-
// src/jsonSchemaForm/help/Help.tsx
|
|
3514
|
+
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3541
3515
|
var import_components11 = require("@transferwise/components");
|
|
3542
3516
|
var import_react_intl13 = require("react-intl");
|
|
3543
3517
|
|
|
3544
|
-
// src/jsonSchemaForm/help/Help.messages.js
|
|
3518
|
+
// src/legacy/jsonSchemaForm/help/Help.messages.js
|
|
3545
3519
|
var import_react_intl12 = require("react-intl");
|
|
3546
3520
|
var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
3547
3521
|
helpAria: {
|
|
@@ -3551,7 +3525,7 @@ var Help_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
3551
3525
|
}
|
|
3552
3526
|
});
|
|
3553
3527
|
|
|
3554
|
-
// src/jsonSchemaForm/help/Help.tsx
|
|
3528
|
+
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
3555
3529
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3556
3530
|
var Help = (props) => {
|
|
3557
3531
|
const intl = (0, import_react_intl13.useIntl)();
|
|
@@ -3568,14 +3542,14 @@ var Help = (props) => {
|
|
|
3568
3542
|
};
|
|
3569
3543
|
var Help_default = Help;
|
|
3570
3544
|
|
|
3571
|
-
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3545
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
3572
3546
|
var import_react16 = require("react");
|
|
3573
3547
|
|
|
3574
|
-
// src/formControl/FormControl.tsx
|
|
3548
|
+
// src/legacy/formControl/FormControl.tsx
|
|
3575
3549
|
var import_components12 = require("@transferwise/components");
|
|
3576
3550
|
var import_react15 = require("react");
|
|
3577
3551
|
|
|
3578
|
-
// src/formControl/utils/value-utils.ts
|
|
3552
|
+
// src/legacy/formControl/utils/value-utils.ts
|
|
3579
3553
|
var getSafeStringValue = (value, options = {}) => {
|
|
3580
3554
|
const { coerceValue = false } = options;
|
|
3581
3555
|
if (isNull(value)) {
|
|
@@ -3682,7 +3656,7 @@ var logInvalidTypeFallbackWarning = ({
|
|
|
3682
3656
|
);
|
|
3683
3657
|
};
|
|
3684
3658
|
|
|
3685
|
-
// src/formControl/utils/getAutocompleteString.ts
|
|
3659
|
+
// src/legacy/formControl/utils/getAutocompleteString.ts
|
|
3686
3660
|
var getAutocompleteString = (hints) => {
|
|
3687
3661
|
const validHints = hints.filter((hint) => autocompleteTokenMap[hint]);
|
|
3688
3662
|
if (validHints.length === 0) {
|
|
@@ -3757,7 +3731,7 @@ var autocompleteTokenMap = {
|
|
|
3757
3731
|
pager: "pager"
|
|
3758
3732
|
};
|
|
3759
3733
|
|
|
3760
|
-
// src/formControl/FormControl.tsx
|
|
3734
|
+
// src/legacy/formControl/FormControl.tsx
|
|
3761
3735
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3762
3736
|
var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
3763
3737
|
constructor(props) {
|
|
@@ -4166,7 +4140,7 @@ _FormControl.defaultProps = {
|
|
|
4166
4140
|
};
|
|
4167
4141
|
var FormControl = _FormControl;
|
|
4168
4142
|
|
|
4169
|
-
// src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4143
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
4170
4144
|
var import_components13 = require("@transferwise/components");
|
|
4171
4145
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
4172
4146
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
@@ -4246,11 +4220,9 @@ var getDisabled = (disabled) => {
|
|
|
4246
4220
|
return void 0;
|
|
4247
4221
|
};
|
|
4248
4222
|
|
|
4249
|
-
// src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4223
|
+
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
4250
4224
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
4251
|
-
var isNativeInput = (propsSchemaType) =>
|
|
4252
|
-
return propsSchemaType === "string" || propsSchemaType === "number";
|
|
4253
|
-
};
|
|
4225
|
+
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
4254
4226
|
var getControlType = (schema) => {
|
|
4255
4227
|
if (isOneOfSchema(schema)) {
|
|
4256
4228
|
if (schema.control === FormControlType.TAB && schema.oneOf.length > 3) {
|
|
@@ -4309,7 +4281,7 @@ var getOptions = (schema, controlType) => {
|
|
|
4309
4281
|
}
|
|
4310
4282
|
return null;
|
|
4311
4283
|
};
|
|
4312
|
-
|
|
4284
|
+
function SchemaFormControl(props) {
|
|
4313
4285
|
const { id, schema, value, disabled, onChange, onFocus, onBlur, onSearchChange, describedBy } = props;
|
|
4314
4286
|
const log = useLogger();
|
|
4315
4287
|
const getSanitisedValue = (value2) => isNativeInput(schema.type) && (isNull(value2) || isUndefined(value2)) ? "" : value2;
|
|
@@ -4343,7 +4315,7 @@ var SchemaFormControl = (props) => {
|
|
|
4343
4315
|
describedBy
|
|
4344
4316
|
};
|
|
4345
4317
|
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
|
-
}
|
|
4318
|
+
}
|
|
4347
4319
|
SchemaFormControl.defaultProps = {
|
|
4348
4320
|
value: null,
|
|
4349
4321
|
onFocus: null,
|
|
@@ -4370,9 +4342,9 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
4370
4342
|
};
|
|
4371
4343
|
var SchemaFormControl_default = SchemaFormControl;
|
|
4372
4344
|
|
|
4373
|
-
// src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4345
|
+
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
4374
4346
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
4375
|
-
|
|
4347
|
+
function OneOfSchema(props) {
|
|
4376
4348
|
const onEvent = useEventDispatcher();
|
|
4377
4349
|
const [changed, setChanged] = (0, import_react17.useState)(false);
|
|
4378
4350
|
const [focused, setFocused] = (0, import_react17.useState)(false);
|
|
@@ -4457,11 +4429,11 @@ var OneOfSchema = (props) => {
|
|
|
4457
4429
|
schema: schemaForSelect,
|
|
4458
4430
|
value: schemaIndex,
|
|
4459
4431
|
disabled: props.disabled,
|
|
4432
|
+
describedBy: feedbackId,
|
|
4460
4433
|
onChange: onChooseNewSchema,
|
|
4461
4434
|
onFocus,
|
|
4462
4435
|
onBlur,
|
|
4463
|
-
onSearchChange
|
|
4464
|
-
describedBy: feedbackId
|
|
4436
|
+
onSearchChange
|
|
4465
4437
|
}
|
|
4466
4438
|
),
|
|
4467
4439
|
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
@@ -4494,7 +4466,7 @@ var OneOfSchema = (props) => {
|
|
|
4494
4466
|
}
|
|
4495
4467
|
)
|
|
4496
4468
|
] });
|
|
4497
|
-
}
|
|
4469
|
+
}
|
|
4498
4470
|
function getTitleAndHelp(schema, id) {
|
|
4499
4471
|
var _a;
|
|
4500
4472
|
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Help_default, { help: schema.help }) : null;
|
|
@@ -4512,10 +4484,10 @@ function getTitleAndHelp(schema, id) {
|
|
|
4512
4484
|
function getValidations(props, schemaIndex) {
|
|
4513
4485
|
const selectedSchema = props.schema.oneOf[schemaIndex != null ? schemaIndex : -1];
|
|
4514
4486
|
if (isConstSchema(selectedSchema)) {
|
|
4515
|
-
return getValidationFailures(selectedSchema.const, props.schema,
|
|
4487
|
+
return getValidationFailures(selectedSchema.const, props.schema, Boolean(props.required));
|
|
4516
4488
|
}
|
|
4517
4489
|
if (schemaIndex === null || schemaIndex < 0) {
|
|
4518
|
-
return getValidationFailures(null, props.schema,
|
|
4490
|
+
return getValidationFailures(null, props.schema, Boolean(props.required));
|
|
4519
4491
|
}
|
|
4520
4492
|
return [];
|
|
4521
4493
|
}
|
|
@@ -4541,15 +4513,15 @@ OneOfSchema.defaultProps = {
|
|
|
4541
4513
|
};
|
|
4542
4514
|
var OneOfSchema_default = OneOfSchema;
|
|
4543
4515
|
|
|
4544
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4516
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4545
4517
|
var import_classnames5 = __toESM(require_classnames());
|
|
4546
4518
|
var import_react19 = require("react");
|
|
4547
4519
|
|
|
4548
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4520
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
4549
4521
|
var import_components15 = require("@transferwise/components");
|
|
4550
4522
|
var import_react18 = require("react");
|
|
4551
4523
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
4552
|
-
|
|
4524
|
+
function UploadInputAdapter(props) {
|
|
4553
4525
|
const {
|
|
4554
4526
|
id,
|
|
4555
4527
|
httpClient = fetch,
|
|
@@ -4567,19 +4539,18 @@ var UploadInputAdapter = (props) => {
|
|
|
4567
4539
|
const files = (0, import_react18.useMemo)(() => fileId ? [{ id: fileId, status: import_components15.Status.SUCCEEDED }] : [], [fileId]);
|
|
4568
4540
|
const uploadFile = (formData) => {
|
|
4569
4541
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
4570
|
-
return httpClient(
|
|
4542
|
+
return httpClient(String(httpOptions.url), {
|
|
4571
4543
|
method: httpOptions.method || "POST",
|
|
4572
4544
|
body: formData
|
|
4573
4545
|
}).then((response) => {
|
|
4574
4546
|
if (response.ok) {
|
|
4575
|
-
onSuccess
|
|
4576
|
-
return response.json().then((responseBody) => {
|
|
4577
|
-
|
|
4578
|
-
});
|
|
4579
|
-
} else {
|
|
4580
|
-
onFailure && onFailure({ response });
|
|
4581
|
-
return Promise.reject();
|
|
4547
|
+
onSuccess == null ? void 0 : onSuccess(response.clone());
|
|
4548
|
+
return response.json().then((responseBody) => ({
|
|
4549
|
+
id: responseBody[idProperty]
|
|
4550
|
+
}));
|
|
4582
4551
|
}
|
|
4552
|
+
onFailure == null ? void 0 : onFailure({ response });
|
|
4553
|
+
return Promise.reject();
|
|
4583
4554
|
});
|
|
4584
4555
|
};
|
|
4585
4556
|
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
@@ -4594,16 +4565,16 @@ var UploadInputAdapter = (props) => {
|
|
|
4594
4565
|
description: usPlaceholder,
|
|
4595
4566
|
onUploadFile: uploadFile,
|
|
4596
4567
|
onDeleteFile: (_id) => {
|
|
4597
|
-
onCancel
|
|
4568
|
+
onCancel == null ? void 0 : onCancel();
|
|
4598
4569
|
return Promise.resolve();
|
|
4599
4570
|
}
|
|
4600
4571
|
}
|
|
4601
4572
|
);
|
|
4602
|
-
}
|
|
4573
|
+
}
|
|
4603
4574
|
|
|
4604
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4575
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
4605
4576
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
4606
|
-
|
|
4577
|
+
function PersistAsyncBlobSchema(props) {
|
|
4607
4578
|
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react19.useState)({});
|
|
4608
4579
|
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react19.useState)(null);
|
|
4609
4580
|
const [validations, setValidations] = (0, import_react19.useState)([]);
|
|
@@ -4612,7 +4583,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4612
4583
|
const onEvent = useEventDispatcher();
|
|
4613
4584
|
const refreshValidations = () => {
|
|
4614
4585
|
if (props.submitted) {
|
|
4615
|
-
setValidations(getValidationFailures(props.model, props.schema,
|
|
4586
|
+
setValidations(getValidationFailures(props.model, props.schema, Boolean(props.required)));
|
|
4616
4587
|
}
|
|
4617
4588
|
};
|
|
4618
4589
|
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
@@ -4642,7 +4613,7 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4642
4613
|
const combinedValidations = persistAsyncValidations || validations;
|
|
4643
4614
|
const formGroupClasses = {
|
|
4644
4615
|
"form-group": true,
|
|
4645
|
-
"has-error": (props.submitted || changed) &&
|
|
4616
|
+
"has-error": (props.submitted || changed) && Boolean(combinedValidations.length)
|
|
4646
4617
|
};
|
|
4647
4618
|
const id = props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty;
|
|
4648
4619
|
const feedbackId = `${id}-feedback`;
|
|
@@ -4682,15 +4653,15 @@ var PersistAsyncBlobSchema = (props) => {
|
|
|
4682
4653
|
}
|
|
4683
4654
|
)
|
|
4684
4655
|
] });
|
|
4685
|
-
}
|
|
4656
|
+
}
|
|
4686
4657
|
PersistAsyncBlobSchema.defaultProps = {
|
|
4687
4658
|
required: false
|
|
4688
4659
|
};
|
|
4689
4660
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
4690
4661
|
|
|
4691
|
-
// src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4662
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
4692
4663
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
4693
|
-
|
|
4664
|
+
function PersistAsyncSchema(props) {
|
|
4694
4665
|
const { schema } = props;
|
|
4695
4666
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
4696
4667
|
if (persistAsyncSchemaType === "blob") {
|
|
@@ -4700,16 +4671,16 @@ var PersistAsyncSchema = (props) => {
|
|
|
4700
4671
|
);
|
|
4701
4672
|
}
|
|
4702
4673
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
4703
|
-
}
|
|
4674
|
+
}
|
|
4704
4675
|
PersistAsyncSchema.defaultProps = {
|
|
4705
4676
|
required: false
|
|
4706
4677
|
};
|
|
4707
4678
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
4708
4679
|
|
|
4709
|
-
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4680
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4710
4681
|
var import_react20 = require("react");
|
|
4711
4682
|
|
|
4712
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4683
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
4713
4684
|
var getSelectionFromModel = (schema, model) => {
|
|
4714
4685
|
const index = getBestMatchingSchemaIndexForValue(schema, model);
|
|
4715
4686
|
if (index !== null) {
|
|
@@ -4718,7 +4689,7 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
4718
4689
|
return null;
|
|
4719
4690
|
};
|
|
4720
4691
|
|
|
4721
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4692
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
4722
4693
|
var import_components16 = require("@transferwise/components");
|
|
4723
4694
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4724
4695
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
@@ -4736,10 +4707,10 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
4736
4707
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
4737
4708
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
4738
4709
|
|
|
4739
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4710
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
4740
4711
|
var import_components17 = require("@transferwise/components");
|
|
4741
4712
|
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
4742
|
-
|
|
4713
|
+
function PromotedOneOfRadioControl(props) {
|
|
4743
4714
|
var _a, _b;
|
|
4744
4715
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
4745
4716
|
const radios = [
|
|
@@ -4768,15 +4739,15 @@ var PromotedOneOfRadioControl = (props) => {
|
|
|
4768
4739
|
}
|
|
4769
4740
|
)
|
|
4770
4741
|
] });
|
|
4771
|
-
}
|
|
4742
|
+
}
|
|
4772
4743
|
PromotedOneOfRadioControl.defaultProps = {
|
|
4773
4744
|
title: void 0
|
|
4774
4745
|
};
|
|
4775
4746
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
4776
4747
|
|
|
4777
|
-
// src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4748
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
4778
4749
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
4779
|
-
|
|
4750
|
+
function PromotedOneOfControl(props) {
|
|
4780
4751
|
const controlType = props.promotion.control || "radio";
|
|
4781
4752
|
switch (controlType) {
|
|
4782
4753
|
case "radio":
|
|
@@ -4786,14 +4757,14 @@ var PromotedOneOfControl = (props) => {
|
|
|
4786
4757
|
default:
|
|
4787
4758
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
|
|
4788
4759
|
}
|
|
4789
|
-
}
|
|
4760
|
+
}
|
|
4790
4761
|
PromotedOneOfControl.defaultProps = {
|
|
4791
4762
|
id: generateRandomId(),
|
|
4792
4763
|
title: void 0
|
|
4793
4764
|
};
|
|
4794
4765
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
4795
4766
|
|
|
4796
|
-
// src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4767
|
+
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
4797
4768
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
4798
4769
|
var isPromoted = (schema) => schema.promoted === true;
|
|
4799
4770
|
var PromotedOneOfSchema = (props) => {
|
|
@@ -4848,11 +4819,11 @@ function getOtherOneOf(schema) {
|
|
|
4848
4819
|
}
|
|
4849
4820
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
4850
4821
|
|
|
4851
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4822
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4852
4823
|
var import_components18 = require("@transferwise/components");
|
|
4853
4824
|
var import_react_intl15 = require("react-intl");
|
|
4854
4825
|
|
|
4855
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
|
|
4826
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
|
|
4856
4827
|
var import_react_intl14 = require("react-intl");
|
|
4857
4828
|
var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
4858
4829
|
yes: {
|
|
@@ -4867,14 +4838,14 @@ var ReadOnlySchema_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
4867
4838
|
}
|
|
4868
4839
|
});
|
|
4869
4840
|
|
|
4870
|
-
// src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4841
|
+
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
4871
4842
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
4872
|
-
|
|
4843
|
+
function ReadOnlySchema({ schema, model }) {
|
|
4873
4844
|
const { title = "" } = schema;
|
|
4874
4845
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
4875
4846
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
4876
4847
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components18.DefinitionList, { layout: import_components18.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
4877
|
-
}
|
|
4848
|
+
}
|
|
4878
4849
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
4879
4850
|
function getValueForSchema({
|
|
4880
4851
|
schema,
|
|
@@ -4899,9 +4870,9 @@ function getValueFromOneOfSchema(schema, model) {
|
|
|
4899
4870
|
return option ? getValueFromOption(option) : model;
|
|
4900
4871
|
}
|
|
4901
4872
|
function getSelectedOneOf(schema, model) {
|
|
4902
|
-
return schema.oneOf.find(
|
|
4903
|
-
|
|
4904
|
-
|
|
4873
|
+
return schema.oneOf.find(
|
|
4874
|
+
(childSchema) => "const" in childSchema ? model === childSchema.const : false
|
|
4875
|
+
);
|
|
4905
4876
|
}
|
|
4906
4877
|
function getValueFromOption(option) {
|
|
4907
4878
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
@@ -4913,10 +4884,10 @@ function getValueFromOption(option) {
|
|
|
4913
4884
|
] }) : text;
|
|
4914
4885
|
}
|
|
4915
4886
|
|
|
4916
|
-
// src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4887
|
+
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
4917
4888
|
var import_react21 = require("react");
|
|
4918
4889
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
4919
|
-
|
|
4890
|
+
function ValidationAsyncSchema(props) {
|
|
4920
4891
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
4921
4892
|
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react21.useState)(model);
|
|
4922
4893
|
const previousRequestedModelReference = (0, import_react21.useRef)(null);
|
|
@@ -5000,14 +4971,14 @@ var ValidationAsyncSchema = (props) => {
|
|
|
5000
4971
|
schema
|
|
5001
4972
|
};
|
|
5002
4973
|
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
5003
|
-
}
|
|
4974
|
+
}
|
|
5004
4975
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
5005
4976
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
5006
4977
|
|
|
5007
|
-
// src/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4978
|
+
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
5008
4979
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
5009
4980
|
var import_react23 = require("react");
|
|
5010
|
-
|
|
4981
|
+
function GenericSchemaForm(props) {
|
|
5011
4982
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
5012
4983
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
5013
4984
|
const type = getSchemaType(schema);
|
|
@@ -5028,7 +4999,9 @@ var GenericSchemaForm = (props) => {
|
|
|
5028
4999
|
case "validationAsync":
|
|
5029
5000
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
5030
5001
|
case "basic": {
|
|
5031
|
-
const basicTypeProps = __spreadValues({
|
|
5002
|
+
const basicTypeProps = __spreadValues({
|
|
5003
|
+
infoMessage: null
|
|
5004
|
+
}, schemaProps);
|
|
5032
5005
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
5033
5006
|
}
|
|
5034
5007
|
case "object":
|
|
@@ -5043,7 +5016,7 @@ var GenericSchemaForm = (props) => {
|
|
|
5043
5016
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
5044
5017
|
}
|
|
5045
5018
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_jsx_runtime40.Fragment, {});
|
|
5046
|
-
}
|
|
5019
|
+
}
|
|
5047
5020
|
var GenericSchema_default = GenericSchemaForm;
|
|
5048
5021
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
5049
5022
|
const type = getSchemaType(schema);
|
|
@@ -5068,16 +5041,16 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
5068
5041
|
return false;
|
|
5069
5042
|
};
|
|
5070
5043
|
|
|
5071
|
-
// src/layout/form/DynamicForm.tsx
|
|
5044
|
+
// src/legacy/layout/form/DynamicForm.tsx
|
|
5072
5045
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
5073
|
-
|
|
5046
|
+
function DynamicForm({
|
|
5074
5047
|
component,
|
|
5075
5048
|
model = null,
|
|
5076
5049
|
errors = null,
|
|
5077
5050
|
submitted,
|
|
5078
5051
|
onModelChange,
|
|
5079
5052
|
onPersistAsync
|
|
5080
|
-
})
|
|
5053
|
+
}) {
|
|
5081
5054
|
const formSchema = component.schema;
|
|
5082
5055
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getMargin(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
5083
5056
|
GenericSchema_default,
|
|
@@ -5092,14 +5065,19 @@ var DynamicForm = ({
|
|
|
5092
5065
|
onPersistAsync
|
|
5093
5066
|
}
|
|
5094
5067
|
) });
|
|
5095
|
-
}
|
|
5068
|
+
}
|
|
5096
5069
|
var DynamicForm_default = DynamicForm;
|
|
5097
5070
|
|
|
5098
|
-
// src/layout/heading/DynamicHeading.tsx
|
|
5071
|
+
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
5072
|
+
var import_components19 = require("@transferwise/components");
|
|
5073
|
+
var import_classnames6 = __toESM(require_classnames());
|
|
5099
5074
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
5100
5075
|
var DynamicHeading = (props) => {
|
|
5101
|
-
const { text, size = "md", align = "left", margin = "md" } = props.component;
|
|
5102
|
-
const classes = getTextAlignmentAndMargin({ align, margin });
|
|
5076
|
+
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
5077
|
+
const classes = (0, import_classnames6.default)(getTextAlignmentAndMargin({ align, margin }));
|
|
5078
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DisplayHeading, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(StandardHeading, { size, text, classes });
|
|
5079
|
+
};
|
|
5080
|
+
var StandardHeading = ({ size, text, classes }) => {
|
|
5103
5081
|
switch (size) {
|
|
5104
5082
|
case "xs":
|
|
5105
5083
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h5", { className: classes, children: text });
|
|
@@ -5114,24 +5092,37 @@ var DynamicHeading = (props) => {
|
|
|
5114
5092
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h3", { className: classes, children: text });
|
|
5115
5093
|
}
|
|
5116
5094
|
};
|
|
5095
|
+
var DisplayHeading = ({ size, text, classes }) => {
|
|
5096
|
+
switch (size) {
|
|
5097
|
+
case "xs":
|
|
5098
|
+
case "sm":
|
|
5099
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-small", className: classes, children: text });
|
|
5100
|
+
case "xl":
|
|
5101
|
+
case "lg":
|
|
5102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-large", className: classes, children: text });
|
|
5103
|
+
case "md":
|
|
5104
|
+
default:
|
|
5105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Display, { type: "display-medium", className: classes, children: text });
|
|
5106
|
+
}
|
|
5107
|
+
};
|
|
5117
5108
|
var DynamicHeading_default = DynamicHeading;
|
|
5118
5109
|
|
|
5119
|
-
// src/layout/markdown/DynamicMarkdown.tsx
|
|
5120
|
-
var
|
|
5110
|
+
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
5111
|
+
var import_components20 = require("@transferwise/components");
|
|
5121
5112
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
5122
5113
|
var DynamicMarkdown = ({ component }) => {
|
|
5123
5114
|
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)(
|
|
5115
|
+
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
5116
|
};
|
|
5126
5117
|
var DynamicInfo = ({ component }) => {
|
|
5127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
5118
|
+
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
5119
|
};
|
|
5129
5120
|
|
|
5130
|
-
// src/layout/image/DynamicImage.tsx
|
|
5131
|
-
var
|
|
5121
|
+
// src/legacy/layout/image/DynamicImage.tsx
|
|
5122
|
+
var import_components21 = require("@transferwise/components");
|
|
5132
5123
|
var import_react24 = require("react");
|
|
5133
5124
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
5134
|
-
|
|
5125
|
+
function DynamicImage({ component: image }) {
|
|
5135
5126
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
5136
5127
|
const httpClient = useHttpClient();
|
|
5137
5128
|
const [imageSource, setImageSource] = (0, import_react24.useState)("");
|
|
@@ -5147,20 +5138,23 @@ var DynamicImage = ({ component: image }) => {
|
|
|
5147
5138
|
if (!imageSource) {
|
|
5148
5139
|
return null;
|
|
5149
5140
|
}
|
|
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
|
-
|
|
5141
|
+
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)) });
|
|
5142
|
+
}
|
|
5143
|
+
var readImageBlobAsDataURL = (imageBlob) => (
|
|
5144
|
+
// we can safely assume the type of reader.result is string
|
|
5145
|
+
// because we're calling reader.readAsDataURL
|
|
5146
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
5147
|
+
new Promise((resolve, reject) => {
|
|
5154
5148
|
const reader = new FileReader();
|
|
5155
5149
|
reader.addEventListener("loadend", () => resolve(reader.result));
|
|
5156
5150
|
reader.addEventListener("error", (error) => reject(error));
|
|
5157
5151
|
reader.readAsDataURL(imageBlob);
|
|
5158
|
-
})
|
|
5159
|
-
|
|
5152
|
+
})
|
|
5153
|
+
);
|
|
5160
5154
|
var getImageSource = async (httpClient, imageUrl) => {
|
|
5161
5155
|
var _a;
|
|
5162
5156
|
try {
|
|
5163
|
-
if (
|
|
5157
|
+
if (isRelativePath2(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
5164
5158
|
return httpClient(imageUrl, {
|
|
5165
5159
|
method: "GET",
|
|
5166
5160
|
headers: { "Content-Type": "image/image" },
|
|
@@ -5179,8 +5173,8 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
5179
5173
|
};
|
|
5180
5174
|
var DynamicImage_default = DynamicImage;
|
|
5181
5175
|
|
|
5182
|
-
// src/layout/instructions/DynamicInstructions.tsx
|
|
5183
|
-
var
|
|
5176
|
+
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
5177
|
+
var import_components22 = require("@transferwise/components");
|
|
5184
5178
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
5185
5179
|
var doContext = ["positive", "neutral"];
|
|
5186
5180
|
var dontContext = ["warning", "negative"];
|
|
@@ -5189,16 +5183,16 @@ var DynamicInstructions = ({ component }) => {
|
|
|
5189
5183
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
5190
5184
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
5191
5185
|
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)(
|
|
5186
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components22.Header, { title: component.title }) : null,
|
|
5187
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components22.InstructionsList, { dos, donts })
|
|
5194
5188
|
] });
|
|
5195
5189
|
};
|
|
5196
5190
|
var DynamicInstructions_default = DynamicInstructions;
|
|
5197
5191
|
|
|
5198
|
-
// src/layout/DynamicLayout.tsx
|
|
5192
|
+
// src/legacy/layout/DynamicLayout.tsx
|
|
5199
5193
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
5200
5194
|
var getKey = (component) => JSON.stringify(component);
|
|
5201
|
-
|
|
5195
|
+
function DynamicLayout(props) {
|
|
5202
5196
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
5203
5197
|
const renderComponent = (component) => {
|
|
5204
5198
|
switch (component.type) {
|
|
@@ -5274,24 +5268,37 @@ var DynamicLayout = (props) => {
|
|
|
5274
5268
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
5275
5269
|
case "search":
|
|
5276
5270
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
5271
|
+
case "modal":
|
|
5272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
5273
|
+
DynamicModal_default,
|
|
5274
|
+
{
|
|
5275
|
+
component,
|
|
5276
|
+
model,
|
|
5277
|
+
submitted,
|
|
5278
|
+
errors,
|
|
5279
|
+
onModelChange,
|
|
5280
|
+
onAction,
|
|
5281
|
+
onPersistAsync
|
|
5282
|
+
},
|
|
5283
|
+
getKey(component)
|
|
5284
|
+
);
|
|
5277
5285
|
default:
|
|
5278
5286
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", {}, getKey(component));
|
|
5279
5287
|
}
|
|
5280
5288
|
};
|
|
5281
5289
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
5282
5290
|
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
5291
|
}
|
|
5286
|
-
};
|
|
5292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
5293
|
+
}
|
|
5287
5294
|
var DynamicLayout_default = DynamicLayout;
|
|
5288
5295
|
|
|
5289
|
-
// src/layout/list/DynamicStatusList.tsx
|
|
5290
|
-
var
|
|
5296
|
+
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
5297
|
+
var import_components23 = require("@transferwise/components");
|
|
5291
5298
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
5292
5299
|
var DynamicStatusList = ({ component }) => {
|
|
5293
5300
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: getMargin(component.margin || "md"), children: [
|
|
5294
|
-
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
5301
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components23.Header, { title: component.title }) : null,
|
|
5295
5302
|
component.items.map(mapListItemToSummary)
|
|
5296
5303
|
] });
|
|
5297
5304
|
};
|
|
@@ -5301,7 +5308,7 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
5301
5308
|
title,
|
|
5302
5309
|
description
|
|
5303
5310
|
}, (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)(
|
|
5311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components23.Summary, __spreadValues({}, props));
|
|
5305
5312
|
};
|
|
5306
5313
|
var statusListMap = {
|
|
5307
5314
|
done: "done",
|
|
@@ -5316,13 +5323,13 @@ var legacyStatusMap = {
|
|
|
5316
5323
|
var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMap);
|
|
5317
5324
|
var DynamicStatusList_default = DynamicStatusList;
|
|
5318
5325
|
|
|
5319
|
-
// src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5320
|
-
var
|
|
5326
|
+
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
5327
|
+
var import_components24 = require("@transferwise/components");
|
|
5321
5328
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5322
5329
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
5323
5330
|
const { margin, size = "md" } = component;
|
|
5324
5331
|
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
5325
|
-
|
|
5332
|
+
import_components24.Loader,
|
|
5326
5333
|
{
|
|
5327
5334
|
size,
|
|
5328
5335
|
classNames: {
|
|
@@ -5334,11 +5341,11 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
5334
5341
|
};
|
|
5335
5342
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
5336
5343
|
|
|
5337
|
-
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5338
|
-
var
|
|
5344
|
+
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5345
|
+
var import_components26 = require("@transferwise/components");
|
|
5339
5346
|
var import_react_intl17 = require("react-intl");
|
|
5340
5347
|
|
|
5341
|
-
// src/layout/paragraph/DynamicParagraph.messages.ts
|
|
5348
|
+
// src/legacy/layout/paragraph/DynamicParagraph.messages.ts
|
|
5342
5349
|
var import_react_intl16 = require("react-intl");
|
|
5343
5350
|
var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
5344
5351
|
copy: {
|
|
@@ -5353,17 +5360,17 @@ var DynamicParagraph_messages_default = (0, import_react_intl16.defineMessages)(
|
|
|
5353
5360
|
}
|
|
5354
5361
|
});
|
|
5355
5362
|
|
|
5356
|
-
// src/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5357
|
-
var
|
|
5363
|
+
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
5364
|
+
var import_components25 = require("@transferwise/components");
|
|
5358
5365
|
var import_react25 = require("react");
|
|
5359
5366
|
function useSnackBarIfAvailable() {
|
|
5360
|
-
const context = (0, import_react25.useContext)(
|
|
5367
|
+
const context = (0, import_react25.useContext)(import_components25.SnackbarContext);
|
|
5361
5368
|
return context ? context.createSnackbar : noop2;
|
|
5362
5369
|
}
|
|
5363
5370
|
function noop2() {
|
|
5364
5371
|
}
|
|
5365
5372
|
|
|
5366
|
-
// src/layout/paragraph/DynamicParagraph.tsx
|
|
5373
|
+
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
5367
5374
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5368
5375
|
var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(BasicDynamicParagraph, { component });
|
|
5369
5376
|
var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
|
|
@@ -5379,39 +5386,33 @@ var CopyableDynamicParagraph = ({ component }) => {
|
|
|
5379
5386
|
var _a;
|
|
5380
5387
|
(_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop3);
|
|
5381
5388
|
};
|
|
5382
|
-
const
|
|
5389
|
+
const classNames8 = getTextAlignmentAndMargin({ align: component.align, margin: "sm" }) + " form-control";
|
|
5383
5390
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
|
|
5384
5391
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5385
5392
|
"input",
|
|
5386
5393
|
{
|
|
5387
5394
|
type: "text",
|
|
5388
|
-
className:
|
|
5395
|
+
className: classNames8,
|
|
5389
5396
|
value: text,
|
|
5390
5397
|
readOnly: true,
|
|
5391
5398
|
style: { textOverflow: "ellipsis" }
|
|
5392
5399
|
}
|
|
5393
5400
|
),
|
|
5394
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5401
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components26.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
|
|
5395
5402
|
] });
|
|
5396
5403
|
};
|
|
5397
5404
|
function noop3() {
|
|
5398
5405
|
}
|
|
5399
5406
|
var DynamicParagraph_default = DynamicParagraph;
|
|
5400
5407
|
|
|
5401
|
-
// src/layout/review/DynamicReview.tsx
|
|
5402
|
-
var
|
|
5408
|
+
// src/legacy/layout/review/DynamicReview.tsx
|
|
5409
|
+
var import_components27 = require("@transferwise/components");
|
|
5403
5410
|
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
|
-
};
|
|
5411
|
+
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
5412
|
+
key: String(index),
|
|
5413
|
+
title: label,
|
|
5414
|
+
value: getFieldValue(value, help, orientation)
|
|
5415
|
+
}));
|
|
5415
5416
|
var getFieldValue = (value, help, orientation) => {
|
|
5416
5417
|
if (help) {
|
|
5417
5418
|
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
@@ -5430,7 +5431,7 @@ var getReviewLayout = (review) => {
|
|
|
5430
5431
|
const orientation = review.control || review.orientation;
|
|
5431
5432
|
return orientation === "horizontal" ? "HORIZONTAL_RIGHT_ALIGNED" : "VERTICAL_ONE_COLUMN";
|
|
5432
5433
|
};
|
|
5433
|
-
|
|
5434
|
+
function DynamicReview(props) {
|
|
5434
5435
|
const review = props.component;
|
|
5435
5436
|
const margin = getMargin(review.margin || "xs");
|
|
5436
5437
|
const getReviewAction = (title, action) => ({
|
|
@@ -5447,23 +5448,23 @@ var DynamicReview = (props) => {
|
|
|
5447
5448
|
const callToAction = review.callToAction ? getReviewAction(review.callToAction.title, review.callToAction.action) : null;
|
|
5448
5449
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction(review.action.title || "", review.action) : null;
|
|
5449
5450
|
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)(
|
|
5451
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components27.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
5452
|
+
/* @__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
5453
|
] });
|
|
5453
|
-
}
|
|
5454
|
+
}
|
|
5454
5455
|
var DynamicReview_default = DynamicReview;
|
|
5455
5456
|
|
|
5456
|
-
// src/layout/search/DynamicSearch.tsx
|
|
5457
|
+
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5457
5458
|
var import_react27 = require("react");
|
|
5458
5459
|
|
|
5459
|
-
// src/layout/search/SearchInput.tsx
|
|
5460
|
-
var
|
|
5460
|
+
// src/legacy/layout/search/SearchInput.tsx
|
|
5461
|
+
var import_components28 = require("@transferwise/components");
|
|
5461
5462
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
5462
5463
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
5463
5464
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("label", { className: "control-label d-inline", children: [
|
|
5464
5465
|
title,
|
|
5465
5466
|
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
5466
|
-
|
|
5467
|
+
import_components28.Input,
|
|
5467
5468
|
{
|
|
5468
5469
|
type: "text",
|
|
5469
5470
|
value,
|
|
@@ -5475,11 +5476,11 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
5475
5476
|
] });
|
|
5476
5477
|
};
|
|
5477
5478
|
|
|
5478
|
-
// src/layout/search/SearchResults.tsx
|
|
5479
|
-
var
|
|
5479
|
+
// src/legacy/layout/search/SearchResults.tsx
|
|
5480
|
+
var import_components29 = require("@transferwise/components");
|
|
5480
5481
|
var import_react_intl19 = require("react-intl");
|
|
5481
5482
|
|
|
5482
|
-
// src/
|
|
5483
|
+
// src/common/errorBoundary/ErrorBoundary.messages.ts
|
|
5483
5484
|
var import_react_intl18 = require("react-intl");
|
|
5484
5485
|
var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
5485
5486
|
errorAlert: {
|
|
@@ -5494,15 +5495,15 @@ var ErrorBoundary_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
5494
5495
|
}
|
|
5495
5496
|
});
|
|
5496
5497
|
|
|
5497
|
-
// src/layout/search/SearchResults.tsx
|
|
5498
|
+
// src/legacy/layout/search/SearchResults.tsx
|
|
5498
5499
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
5499
5500
|
var SearchResults = ({ results, emptyMessage, onSelect }) => {
|
|
5500
5501
|
if (results.length === 0) {
|
|
5501
5502
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
5502
5503
|
}
|
|
5503
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components29.NavigationOptionsList, { children: results.map((result) => {
|
|
5504
5505
|
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
5505
|
-
|
|
5506
|
+
import_components29.NavigationOption,
|
|
5506
5507
|
{
|
|
5507
5508
|
title: result.title,
|
|
5508
5509
|
content: result.description,
|
|
@@ -5534,7 +5535,7 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
5534
5535
|
] });
|
|
5535
5536
|
};
|
|
5536
5537
|
|
|
5537
|
-
// src/layout/search/useSearch.tsx
|
|
5538
|
+
// src/legacy/layout/search/useSearch.tsx
|
|
5538
5539
|
var import_react26 = require("react");
|
|
5539
5540
|
var headers = { "Content-Type": "application/json" };
|
|
5540
5541
|
var useSearch = (defaultSearchConfig) => {
|
|
@@ -5552,7 +5553,7 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5552
5553
|
return;
|
|
5553
5554
|
}
|
|
5554
5555
|
abortControllerRef.current = new AbortController();
|
|
5555
|
-
const signal = abortControllerRef.current
|
|
5556
|
+
const { signal } = abortControllerRef.current;
|
|
5556
5557
|
setState({ status: "loading" });
|
|
5557
5558
|
try {
|
|
5558
5559
|
const request = method === "GET" ? httpClient(addQueryParameter(url, param, query), {
|
|
@@ -5568,7 +5569,7 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5568
5569
|
const response = await request;
|
|
5569
5570
|
void handleResponse(response, query);
|
|
5570
5571
|
} catch (error) {
|
|
5571
|
-
|
|
5572
|
+
handleError(error, query);
|
|
5572
5573
|
}
|
|
5573
5574
|
},
|
|
5574
5575
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5585,18 +5586,16 @@ var useSearch = (defaultSearchConfig) => {
|
|
|
5585
5586
|
setState({ status: "error" });
|
|
5586
5587
|
};
|
|
5587
5588
|
const handleError = (error, query) => {
|
|
5588
|
-
if (isAbortError(error)
|
|
5589
|
+
if (!isAbortError(error)) {
|
|
5589
5590
|
setState({ status: "error" });
|
|
5590
5591
|
}
|
|
5591
5592
|
};
|
|
5592
5593
|
const results = state.status === "success" ? state.results : [];
|
|
5593
5594
|
return { status: state.status, results, search };
|
|
5594
5595
|
};
|
|
5595
|
-
var isValidResponseBody = (body) =>
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
);
|
|
5599
|
-
};
|
|
5596
|
+
var isValidResponseBody = (body) => isObject(body) && "results" in body && isArray(body.results) && body.results.every(
|
|
5597
|
+
(result) => isObject(result) && "title" in result && "type" in result && "value" in result
|
|
5598
|
+
);
|
|
5600
5599
|
var isAbortError = (error) => error instanceof DOMException && error.name === "AbortError";
|
|
5601
5600
|
var addQueryParameter = (url, key, value) => {
|
|
5602
5601
|
const [urlBase, urlQuery] = url.split("?");
|
|
@@ -5605,10 +5604,10 @@ var addQueryParameter = (url, key, value) => {
|
|
|
5605
5604
|
return `${urlBase}?${urlQueryParams.toString()}`;
|
|
5606
5605
|
};
|
|
5607
5606
|
|
|
5608
|
-
// src/layout/search/DynamicSearch.tsx
|
|
5607
|
+
// src/legacy/layout/search/DynamicSearch.tsx
|
|
5609
5608
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
5610
5609
|
var DEBOUNCE_TIME = 400;
|
|
5611
|
-
|
|
5610
|
+
function DynamicSearch({ component, onAction }) {
|
|
5612
5611
|
const [query, setQuery] = (0, import_react27.useState)("");
|
|
5613
5612
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
5614
5613
|
const { status, results, search } = useSearch({ url, method, param });
|
|
@@ -5640,17 +5639,41 @@ var DynamicSearch = ({ component, onAction }) => {
|
|
|
5640
5639
|
setQuery(query);
|
|
5641
5640
|
void search(query);
|
|
5642
5641
|
};
|
|
5643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
5642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin || "md"), children: [
|
|
5644
5643
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
5645
5644
|
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
5646
5645
|
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { onRetrySearch }),
|
|
5647
5646
|
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
|
|
5648
5647
|
] });
|
|
5649
|
-
}
|
|
5648
|
+
}
|
|
5650
5649
|
var DynamicSearch_default = DynamicSearch;
|
|
5651
5650
|
|
|
5652
|
-
// src/
|
|
5651
|
+
// src/legacy/layout/modal/DynamicModal.tsx
|
|
5652
|
+
var import_components30 = require("@transferwise/components");
|
|
5653
|
+
var import_react28 = require("react");
|
|
5653
5654
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
5655
|
+
var DynamicModal = (props) => {
|
|
5656
|
+
const [visible, isVisible] = (0, import_react28.useState)(false);
|
|
5657
|
+
const { component, onAction } = props;
|
|
5658
|
+
const { margin = "md" } = component;
|
|
5659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getTextAlignmentAndMargin({ margin }), children: [
|
|
5660
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components30.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
5661
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
5662
|
+
import_components30.Modal,
|
|
5663
|
+
{
|
|
5664
|
+
scroll: "content",
|
|
5665
|
+
onClose: () => isVisible(false),
|
|
5666
|
+
open: visible,
|
|
5667
|
+
size: "lg",
|
|
5668
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicLayout_default, __spreadProps(__spreadValues({}, props), { components: component.content.components, onAction }))
|
|
5669
|
+
}
|
|
5670
|
+
)
|
|
5671
|
+
] });
|
|
5672
|
+
};
|
|
5673
|
+
var DynamicModal_default = DynamicModal;
|
|
5674
|
+
|
|
5675
|
+
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
5676
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
5654
5677
|
var isNullish = (value) => isNull(value) || isUndefined(value);
|
|
5655
5678
|
var getDefaultValue = (schema) => {
|
|
5656
5679
|
return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
|
|
@@ -5687,13 +5710,13 @@ var BasicTypeSchema = (props) => {
|
|
|
5687
5710
|
props.onBlur();
|
|
5688
5711
|
}
|
|
5689
5712
|
};
|
|
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,
|
|
5713
|
+
const [model, setModel] = (0, import_react29.useState)((_a = props.model) != null ? _a : null);
|
|
5714
|
+
const [lastModel, setLastModel] = (0, import_react29.useState)((_b = props.model) != null ? _b : null);
|
|
5715
|
+
const [changed, setChanged] = (0, import_react29.useState)(false);
|
|
5716
|
+
const [focused, setFocused] = (0, import_react29.useState)(false);
|
|
5717
|
+
const [blurred, setBlurred] = (0, import_react29.useState)(false);
|
|
5718
|
+
const [validations, setValidations] = (0, import_react29.useState)([]);
|
|
5719
|
+
const id = (0, import_react29.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
5697
5720
|
const onSchemaChange = () => {
|
|
5698
5721
|
const defaultValue = getDefaultValue(props.schema);
|
|
5699
5722
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -5708,9 +5731,9 @@ var BasicTypeSchema = (props) => {
|
|
|
5708
5731
|
};
|
|
5709
5732
|
const isConst = props.schema.const;
|
|
5710
5733
|
const isHidden = props.schema.hidden || isConst;
|
|
5711
|
-
(0,
|
|
5712
|
-
(0,
|
|
5713
|
-
(0,
|
|
5734
|
+
(0, import_react29.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5735
|
+
(0, import_react29.useEffect)(onSchemaChange, [props.schema]);
|
|
5736
|
+
(0, import_react29.useEffect)(() => {
|
|
5714
5737
|
var _a2;
|
|
5715
5738
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
5716
5739
|
if (newModel !== model) {
|
|
@@ -5725,15 +5748,15 @@ var BasicTypeSchema = (props) => {
|
|
|
5725
5748
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
5726
5749
|
const schemaHelp = props.schema.help;
|
|
5727
5750
|
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,
|
|
5751
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
5752
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: (0, import_classnames7.default)(formGroupClasses), children: [
|
|
5754
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
5755
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
5756
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help: schemaHelp })
|
|
5734
5757
|
] }),
|
|
5735
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
5736
|
-
/* @__PURE__ */ (0,
|
|
5758
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help: schemaHelp }),
|
|
5759
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5737
5760
|
SchemaFormControl_default,
|
|
5738
5761
|
{
|
|
5739
5762
|
id,
|
|
@@ -5746,7 +5769,7 @@ var BasicTypeSchema = (props) => {
|
|
|
5746
5769
|
describedBy: feedbackId
|
|
5747
5770
|
}
|
|
5748
5771
|
),
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
5772
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
5750
5773
|
ControlFeedback_default,
|
|
5751
5774
|
{
|
|
5752
5775
|
id: feedbackId,
|
|
@@ -5770,11 +5793,9 @@ BasicTypeSchema.defaultProps = {
|
|
|
5770
5793
|
};
|
|
5771
5794
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
5772
5795
|
|
|
5773
|
-
// src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5774
|
-
var
|
|
5775
|
-
var getIdFromResponse = (idProperty, response) =>
|
|
5776
|
-
return response[idProperty];
|
|
5777
|
-
};
|
|
5796
|
+
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
5797
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5798
|
+
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
5778
5799
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
5779
5800
|
var _a;
|
|
5780
5801
|
return (_a = response.validation) == null ? void 0 : _a[errorProperty];
|
|
@@ -5786,17 +5807,17 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
|
|
|
5786
5807
|
FormControlType.FILE,
|
|
5787
5808
|
FormControlType.UPLOAD
|
|
5788
5809
|
]);
|
|
5789
|
-
|
|
5810
|
+
function PersistAsyncBasicSchema(props) {
|
|
5790
5811
|
const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
|
|
5791
5812
|
const intl = (0, import_react_intl20.useIntl)();
|
|
5792
5813
|
const httpClient = useHttpClient();
|
|
5793
5814
|
const onEvent = useEventDispatcher();
|
|
5794
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5815
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react30.useState)(null);
|
|
5795
5816
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
5796
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
5797
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
5798
|
-
const [abortController, setAbortController] = (0,
|
|
5799
|
-
(0,
|
|
5817
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react30.useState)(null);
|
|
5818
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react30.useState)(false);
|
|
5819
|
+
const [abortController, setAbortController] = (0, import_react30.useState)(null);
|
|
5820
|
+
(0, import_react30.useEffect)(() => {
|
|
5800
5821
|
if (controlTypesWithPersistOnChange.has(
|
|
5801
5822
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
5802
5823
|
getControlType(schema.persistAsync.schema)
|
|
@@ -5863,7 +5884,7 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5863
5884
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
5864
5885
|
}
|
|
5865
5886
|
};
|
|
5866
|
-
return /* @__PURE__ */ (0,
|
|
5887
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5867
5888
|
BasicTypeSchema_default,
|
|
5868
5889
|
{
|
|
5869
5890
|
required,
|
|
@@ -5876,15 +5897,15 @@ var PersistAsyncBasicSchema = (props) => {
|
|
|
5876
5897
|
onBlur
|
|
5877
5898
|
}
|
|
5878
5899
|
);
|
|
5879
|
-
}
|
|
5900
|
+
}
|
|
5880
5901
|
PersistAsyncBasicSchema.defaultProps = {
|
|
5881
5902
|
required: false
|
|
5882
5903
|
};
|
|
5883
5904
|
var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
5884
5905
|
|
|
5885
|
-
// src/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5906
|
+
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
5886
5907
|
var usePersistAsync = (persistAsync) => {
|
|
5887
|
-
const [abortController, setAbortController] = (0,
|
|
5908
|
+
const [abortController, setAbortController] = (0, import_react31.useState)(null);
|
|
5888
5909
|
const httpClient = useHttpClient();
|
|
5889
5910
|
const intl = (0, import_react_intl21.useIntl)();
|
|
5890
5911
|
const { schema } = persistAsync;
|
|
@@ -5962,8 +5983,8 @@ function hasStringMessage(value) {
|
|
|
5962
5983
|
return isObject(value) && "message" in value && typeof value.message === "string";
|
|
5963
5984
|
}
|
|
5964
5985
|
|
|
5965
|
-
// src/common/hooks/usePolling/usePolling.tsx
|
|
5966
|
-
var
|
|
5986
|
+
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
5987
|
+
var import_react32 = require("react");
|
|
5967
5988
|
function usePolling({
|
|
5968
5989
|
asyncFn,
|
|
5969
5990
|
interval,
|
|
@@ -5972,9 +5993,9 @@ function usePolling({
|
|
|
5972
5993
|
onPollingResponse,
|
|
5973
5994
|
onFailure
|
|
5974
5995
|
}) {
|
|
5975
|
-
const onPollingResponseReference = (0,
|
|
5976
|
-
const onFailureReference = (0,
|
|
5977
|
-
const poll = (0,
|
|
5996
|
+
const onPollingResponseReference = (0, import_react32.useRef)(onPollingResponse);
|
|
5997
|
+
const onFailureReference = (0, import_react32.useRef)(onFailure);
|
|
5998
|
+
const poll = (0, import_react32.useMemo)(
|
|
5978
5999
|
() => createPollingClosure(
|
|
5979
6000
|
asyncFn,
|
|
5980
6001
|
maxAttempts,
|
|
@@ -5984,7 +6005,7 @@ function usePolling({
|
|
|
5984
6005
|
),
|
|
5985
6006
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
5986
6007
|
);
|
|
5987
|
-
(0,
|
|
6008
|
+
(0, import_react32.useEffect)(() => {
|
|
5988
6009
|
if (interval > 0) {
|
|
5989
6010
|
const intervalReference = setInterval(() => {
|
|
5990
6011
|
poll();
|
|
@@ -5992,7 +6013,7 @@ function usePolling({
|
|
|
5992
6013
|
return () => clearInterval(intervalReference);
|
|
5993
6014
|
}
|
|
5994
6015
|
}, [poll, interval]);
|
|
5995
|
-
(0,
|
|
6016
|
+
(0, import_react32.useEffect)(() => {
|
|
5996
6017
|
onPollingResponseReference.current = onPollingResponse;
|
|
5997
6018
|
onFailureReference.current = onFailure;
|
|
5998
6019
|
}, [onPollingResponse, onFailure]);
|
|
@@ -6020,36 +6041,32 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
6020
6041
|
};
|
|
6021
6042
|
}
|
|
6022
6043
|
|
|
6023
|
-
// src/common/hooks/usePrevious/usePrevious.js
|
|
6024
|
-
var
|
|
6044
|
+
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
6045
|
+
var import_react33 = require("react");
|
|
6025
6046
|
var usePrevious = (value) => {
|
|
6026
|
-
const reference = (0,
|
|
6027
|
-
(0,
|
|
6047
|
+
const reference = (0, import_react33.useRef)();
|
|
6048
|
+
(0, import_react33.useEffect)(() => {
|
|
6028
6049
|
reference.current = value;
|
|
6029
6050
|
}, [value]);
|
|
6030
6051
|
return reference.current;
|
|
6031
6052
|
};
|
|
6032
6053
|
|
|
6033
|
-
// src/common/hooks/useStepPolling/useStepPolling.tsx
|
|
6034
|
-
var
|
|
6054
|
+
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
6055
|
+
var import_react34 = require("react");
|
|
6035
6056
|
function useStepPolling(polling, onAction) {
|
|
6036
6057
|
const httpClient = useHttpClient();
|
|
6037
|
-
const asyncFn = (0,
|
|
6058
|
+
const asyncFn = (0, import_react34.useMemo)(() => {
|
|
6038
6059
|
if (polling) {
|
|
6039
|
-
return () => {
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
}
|
|
6046
|
-
});
|
|
6047
|
-
};
|
|
6048
|
-
} else {
|
|
6049
|
-
return void 0;
|
|
6060
|
+
return () => httpClient(polling.url).then((response) => {
|
|
6061
|
+
if (response.ok) {
|
|
6062
|
+
return response.json().then((pollingResponse) => pollingResponse).catch((error) => null);
|
|
6063
|
+
}
|
|
6064
|
+
throw new Error("failed");
|
|
6065
|
+
});
|
|
6050
6066
|
}
|
|
6067
|
+
return void 0;
|
|
6051
6068
|
}, [polling, httpClient]);
|
|
6052
|
-
const onPollingResponse = (0,
|
|
6069
|
+
const onPollingResponse = (0, import_react34.useCallback)(
|
|
6053
6070
|
(pollingResponse) => {
|
|
6054
6071
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
6055
6072
|
onAction(pollingResponse.action);
|
|
@@ -6065,7 +6082,7 @@ function useStepPolling(polling, onAction) {
|
|
|
6065
6082
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
6066
6083
|
maxConsecutiveFails: 1,
|
|
6067
6084
|
onPollingResponse,
|
|
6068
|
-
onFailure: (0,
|
|
6085
|
+
onFailure: (0, import_react34.useCallback)(() => {
|
|
6069
6086
|
if (polling) {
|
|
6070
6087
|
onAction(polling.onError.action);
|
|
6071
6088
|
}
|
|
@@ -6073,8 +6090,8 @@ function useStepPolling(polling, onAction) {
|
|
|
6073
6090
|
});
|
|
6074
6091
|
}
|
|
6075
6092
|
|
|
6076
|
-
// src/step/layoutStep/LayoutStep.tsx
|
|
6077
|
-
var
|
|
6093
|
+
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
6094
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
6078
6095
|
var getComponents = (step, options) => {
|
|
6079
6096
|
var _a;
|
|
6080
6097
|
if (isEmpty(step)) {
|
|
@@ -6097,7 +6114,7 @@ var LayoutStep = (props) => {
|
|
|
6097
6114
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
6098
6115
|
};
|
|
6099
6116
|
useStepPolling(stepSpecification.polling, onAction);
|
|
6100
|
-
return /* @__PURE__ */ (0,
|
|
6117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6101
6118
|
DynamicLayout_default,
|
|
6102
6119
|
{
|
|
6103
6120
|
components,
|
|
@@ -6112,15 +6129,15 @@ var LayoutStep = (props) => {
|
|
|
6112
6129
|
};
|
|
6113
6130
|
var LayoutStep_default = LayoutStep;
|
|
6114
6131
|
|
|
6115
|
-
// src/step/cameraStep/CameraStep.tsx
|
|
6116
|
-
var
|
|
6132
|
+
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
6133
|
+
var import_react39 = require("react");
|
|
6117
6134
|
|
|
6118
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6119
|
-
var
|
|
6120
|
-
var
|
|
6135
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6136
|
+
var import_react38 = require("react");
|
|
6137
|
+
var import_react_intl26 = require("react-intl");
|
|
6121
6138
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
6122
6139
|
|
|
6123
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
6140
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
6124
6141
|
var import_react_intl22 = require("react-intl");
|
|
6125
6142
|
var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
6126
6143
|
reviewSubmit: {
|
|
@@ -6137,60 +6154,100 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
6137
6154
|
id: "dynamicFlows.CameraCapture.reviewInstructions",
|
|
6138
6155
|
defaultMessage: "Is your picture clear, readable and complete?",
|
|
6139
6156
|
description: "After taking an image with the camera, prompt user to review the image"
|
|
6157
|
+
},
|
|
6158
|
+
cameraNotSupportedTitle: {
|
|
6159
|
+
id: "dynamicFlows.CameraCapture.CameraNotSupported.title",
|
|
6160
|
+
defaultMessage: "Camera not supported",
|
|
6161
|
+
description: "Title of standalone page prompting that camera is not available on users browser"
|
|
6162
|
+
},
|
|
6163
|
+
cameraNotSupportedParagraph: {
|
|
6164
|
+
id: "dynamicFlows.CameraCapture.CameraNotSupported.paragraph",
|
|
6165
|
+
defaultMessage: "The browser you're using doesn't have support for a camera. Try a different browser, device, or download our mobile app.",
|
|
6166
|
+
description: "Further text of standalone page prompting that camera is not available on user's browser"
|
|
6167
|
+
},
|
|
6168
|
+
noCameraAccessTitle: {
|
|
6169
|
+
id: "dynamicFlows.CameraCapture.NoCameraAccess.title",
|
|
6170
|
+
defaultMessage: "We can't access your camera",
|
|
6171
|
+
description: "Title of standalone page prompting missing camera permissions"
|
|
6172
|
+
},
|
|
6173
|
+
noCameraAccessParagraph: {
|
|
6174
|
+
id: "dynamicFlows.CameraCapture.NoCameraAccess.paragraph",
|
|
6175
|
+
defaultMessage: "Enable camera access in your browser's settings to get going again.",
|
|
6176
|
+
description: "Further text of standalone page prompting missing camera permissions"
|
|
6177
|
+
},
|
|
6178
|
+
noCameraAccessAction: {
|
|
6179
|
+
id: "dynamicFlows.CameraCapture.NoCameraAccess.action",
|
|
6180
|
+
defaultMessage: "Enable camera access",
|
|
6181
|
+
description: "Action to ask for camera permissions again"
|
|
6182
|
+
},
|
|
6183
|
+
cameraConnectionIssueTitle: {
|
|
6184
|
+
id: "dynamicFlows.CameraCapture.CameraConnectionIssue.title",
|
|
6185
|
+
defaultMessage: "We can't access your camera",
|
|
6186
|
+
description: "Title of standalone page prompting that there was an issue connecting to a camera"
|
|
6187
|
+
},
|
|
6188
|
+
cameraConnectionIssueParagraph: {
|
|
6189
|
+
id: "dynamicFlows.CameraCapture.CameraConnectionIssue.paragraph",
|
|
6190
|
+
defaultMessage: "Please check if it is connected and try again.",
|
|
6191
|
+
description: "Further text of standalone page prompting that there was an issue connecting to a camera"
|
|
6192
|
+
},
|
|
6193
|
+
cameraConnectionIssueAction: {
|
|
6194
|
+
id: "dynamicFlows.CameraCapture.CameraConnectionIssue.action",
|
|
6195
|
+
defaultMessage: "Try again",
|
|
6196
|
+
description: "Action to try using camera again"
|
|
6140
6197
|
}
|
|
6141
6198
|
});
|
|
6142
6199
|
|
|
6143
|
-
// src/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6144
|
-
var
|
|
6200
|
+
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
6201
|
+
var import_components31 = require("@transferwise/components");
|
|
6145
6202
|
var import_react_intl23 = require("react-intl");
|
|
6146
|
-
var
|
|
6147
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
6203
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
6204
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
6148
6205
|
var ReviewBottomBar = ({
|
|
6149
6206
|
onSubmit,
|
|
6150
6207
|
onRetry
|
|
6151
6208
|
}) => {
|
|
6152
6209
|
const intl = (0, import_react_intl23.useIntl)();
|
|
6153
|
-
return /* @__PURE__ */ (0,
|
|
6154
|
-
/* @__PURE__ */ (0,
|
|
6155
|
-
|
|
6210
|
+
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: [
|
|
6211
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6212
|
+
import_components31.Button,
|
|
6156
6213
|
{
|
|
6157
6214
|
className: "m-b-1",
|
|
6158
6215
|
block: true,
|
|
6159
|
-
size:
|
|
6160
|
-
type:
|
|
6216
|
+
size: import_components31.Size.MEDIUM,
|
|
6217
|
+
type: import_components31.ControlType.ACCENT,
|
|
6161
6218
|
onClick: onSubmit,
|
|
6162
6219
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
6163
6220
|
}
|
|
6164
6221
|
),
|
|
6165
|
-
/* @__PURE__ */ (0,
|
|
6166
|
-
|
|
6222
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6223
|
+
import_components31.Button,
|
|
6167
6224
|
{
|
|
6168
6225
|
className: "m-b-2",
|
|
6169
6226
|
block: true,
|
|
6170
|
-
size:
|
|
6171
|
-
type:
|
|
6172
|
-
priority:
|
|
6227
|
+
size: import_components31.Size.MEDIUM,
|
|
6228
|
+
type: import_components31.ControlType.ACCENT,
|
|
6229
|
+
priority: import_components31.Priority.SECONDARY,
|
|
6173
6230
|
onClick: onRetry,
|
|
6174
6231
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
6175
6232
|
}
|
|
6176
6233
|
)
|
|
6177
6234
|
] }) }) });
|
|
6178
6235
|
};
|
|
6179
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
6236
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6180
6237
|
"button",
|
|
6181
6238
|
{
|
|
6182
6239
|
type: "button",
|
|
6183
6240
|
className: "camera-capture-btn m-b-2",
|
|
6184
6241
|
"data-testid": "camera-capture-button",
|
|
6185
6242
|
onClick,
|
|
6186
|
-
children: /* @__PURE__ */ (0,
|
|
6243
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
6187
6244
|
}
|
|
6188
6245
|
);
|
|
6189
6246
|
|
|
6190
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6247
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6191
6248
|
var import_react_intl25 = require("react-intl");
|
|
6192
6249
|
|
|
6193
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
6250
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
|
|
6194
6251
|
var import_react_intl24 = require("react-intl");
|
|
6195
6252
|
var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMessages)({
|
|
6196
6253
|
text: {
|
|
@@ -6200,12 +6257,12 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl24.defineMess
|
|
|
6200
6257
|
}
|
|
6201
6258
|
});
|
|
6202
6259
|
|
|
6203
|
-
// src/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6204
|
-
var
|
|
6205
|
-
|
|
6260
|
+
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
6261
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6262
|
+
function OrientationLockOverlay() {
|
|
6206
6263
|
const intl = (0, import_react_intl25.useIntl)();
|
|
6207
|
-
return /* @__PURE__ */ (0,
|
|
6208
|
-
/* @__PURE__ */ (0,
|
|
6264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
6265
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6209
6266
|
"img",
|
|
6210
6267
|
{
|
|
6211
6268
|
className: "m-b-3",
|
|
@@ -6215,56 +6272,28 @@ var OrientationLockOverlay = () => {
|
|
|
6215
6272
|
alt: ""
|
|
6216
6273
|
}
|
|
6217
6274
|
),
|
|
6218
|
-
/* @__PURE__ */ (0,
|
|
6275
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
6219
6276
|
] });
|
|
6220
|
-
}
|
|
6277
|
+
}
|
|
6221
6278
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
6222
6279
|
|
|
6223
|
-
// src/step/cameraStep/cameraCapture/
|
|
6224
|
-
var
|
|
6225
|
-
var
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
}
|
|
6231
|
-
}
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
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
|
-
}, []);
|
|
6236
|
-
const enterFullScreen = (0, import_react34.useCallback)(() => {
|
|
6237
|
-
setTimeout(() => {
|
|
6238
|
-
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6239
|
-
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
6240
|
-
lockOrientation();
|
|
6241
|
-
}).catch(noop4);
|
|
6242
|
-
}
|
|
6243
|
-
}, 100);
|
|
6244
|
-
}, [shouldLockOrientation, lockOrientation]);
|
|
6245
|
-
const exitFullScreen = (0, import_react34.useCallback)(() => {
|
|
6246
|
-
if (import_screenfull.default.isFullscreen) {
|
|
6247
|
-
import_screenfull.default.exit().catch(noop4);
|
|
6248
|
-
}
|
|
6249
|
-
unlockOrientation();
|
|
6250
|
-
}, [unlockOrientation]);
|
|
6251
|
-
(0, import_react34.useEffect)(() => {
|
|
6252
|
-
return () => {
|
|
6253
|
-
exitFullScreen();
|
|
6254
|
-
};
|
|
6255
|
-
}, [exitFullScreen]);
|
|
6256
|
-
return {
|
|
6257
|
-
enterFullScreen,
|
|
6258
|
-
exitFullScreen
|
|
6259
|
-
};
|
|
6260
|
-
};
|
|
6261
|
-
var noop4 = () => {
|
|
6262
|
-
};
|
|
6280
|
+
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
6281
|
+
var import_components32 = require("@transferwise/components");
|
|
6282
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6283
|
+
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
6284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6285
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
6286
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
|
|
6287
|
+
onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components32.Button, { block: true, onClick: onAction, children: actionButton })
|
|
6288
|
+
] }) }) });
|
|
6289
|
+
}
|
|
6290
|
+
var CameraErrorScreen_default = CameraErrorScreen;
|
|
6263
6291
|
|
|
6264
|
-
// src/step/cameraStep/cameraCapture/hooks/
|
|
6292
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6265
6293
|
var import_react35 = require("react");
|
|
6294
|
+
var import_screenfull = __toESM(require_screenfull());
|
|
6266
6295
|
|
|
6267
|
-
// src/step/cameraStep/cameraCapture/utils/index.ts
|
|
6296
|
+
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
6268
6297
|
var isSelfieCamera = (stream) => {
|
|
6269
6298
|
var _a;
|
|
6270
6299
|
const { facingMode } = ((_a = getVideoTrack(stream)) == null ? void 0 : _a.getSettings()) || {};
|
|
@@ -6278,7 +6307,9 @@ var generateCanvasFromVideo = async (video) => {
|
|
|
6278
6307
|
canvas.setAttribute("width", `${video.videoWidth}`);
|
|
6279
6308
|
const context = canvas == null ? void 0 : canvas.getContext("2d");
|
|
6280
6309
|
if (context) {
|
|
6281
|
-
await new Promise((resolve) =>
|
|
6310
|
+
await new Promise((resolve) => {
|
|
6311
|
+
setTimeout(resolve, 100);
|
|
6312
|
+
});
|
|
6282
6313
|
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
6283
6314
|
}
|
|
6284
6315
|
}
|
|
@@ -6308,9 +6339,97 @@ var getVideoCapabilities = (videoStream) => {
|
|
|
6308
6339
|
return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
|
|
6309
6340
|
};
|
|
6310
6341
|
|
|
6311
|
-
// src/step/cameraStep/cameraCapture/
|
|
6342
|
+
// src/legacy/step/cameraStep/cameraCapture/tracking/index.ts
|
|
6343
|
+
var trackCameraError = (message, onEvent, error) => onEvent == null ? void 0 : onEvent(message, { Error: getSerializedError(error) });
|
|
6344
|
+
var getSerializedError = (error) => error instanceof DOMException ? JSON.stringify({
|
|
6345
|
+
name: error == null ? void 0 : error.name,
|
|
6346
|
+
message: error == null ? void 0 : error.message
|
|
6347
|
+
}) : error;
|
|
6348
|
+
var trackCameraFeedStarted = async (onEvent, props, stream) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Feed Started", await getCameraStartedProperties(props, stream));
|
|
6349
|
+
var getCameraStartedProperties = async (props, videoStream) => {
|
|
6350
|
+
var _a;
|
|
6351
|
+
const videoTrack = getVideoTrack(videoStream);
|
|
6352
|
+
const capabilities = getVideoCapabilities(videoStream);
|
|
6353
|
+
const settings = (_a = videoTrack == null ? void 0 : videoTrack.getSettings) == null ? void 0 : _a.call(videoTrack);
|
|
6354
|
+
return __spreadProps(__spreadValues({}, videoTrack && {
|
|
6355
|
+
"Available Video Devices (by label)": await getAvailableVideoDeviceLabels(),
|
|
6356
|
+
"Active Video Device (by label)": await getActiveVideoDeviceLabel(videoStream),
|
|
6357
|
+
"Camera Capabilities": capabilities,
|
|
6358
|
+
"Camera Settings": settings
|
|
6359
|
+
}), {
|
|
6360
|
+
"Camera Direction (Asked)": props == null ? void 0 : props.direction
|
|
6361
|
+
});
|
|
6362
|
+
};
|
|
6363
|
+
var trackCameraOrientationLandscape = (onEvent) => {
|
|
6364
|
+
onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Lock Overlay Shown", {});
|
|
6365
|
+
};
|
|
6366
|
+
var trackCameraOrientationLocked = (onEvent) => {
|
|
6367
|
+
onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Locked", {});
|
|
6368
|
+
};
|
|
6369
|
+
|
|
6370
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
6371
|
+
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
6372
|
+
const lockOrientation = (0, import_react35.useCallback)(() => {
|
|
6373
|
+
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6374
|
+
window.screen.orientation.lock("portrait").then(() => trackCameraOrientationLocked(onEvent)).catch(noop4);
|
|
6375
|
+
}
|
|
6376
|
+
}, [onEvent]);
|
|
6377
|
+
const unlockOrientation = (0, import_react35.useCallback)(() => {
|
|
6378
|
+
var _a, _b, _c;
|
|
6379
|
+
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);
|
|
6380
|
+
}, []);
|
|
6381
|
+
const enterFullScreen = (0, import_react35.useCallback)(() => {
|
|
6382
|
+
setTimeout(() => {
|
|
6383
|
+
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
6384
|
+
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
6385
|
+
lockOrientation();
|
|
6386
|
+
}).catch(noop4);
|
|
6387
|
+
}
|
|
6388
|
+
}, 100);
|
|
6389
|
+
}, [shouldLockOrientation, lockOrientation]);
|
|
6390
|
+
const exitFullScreen = (0, import_react35.useCallback)(() => {
|
|
6391
|
+
if (import_screenfull.default.isFullscreen) {
|
|
6392
|
+
import_screenfull.default.exit().catch(noop4);
|
|
6393
|
+
}
|
|
6394
|
+
unlockOrientation();
|
|
6395
|
+
}, [unlockOrientation]);
|
|
6396
|
+
const handleOrientationChange = (0, import_react35.useCallback)(
|
|
6397
|
+
(event) => {
|
|
6398
|
+
var _a, _b;
|
|
6399
|
+
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
6400
|
+
if ((_b = window.screen) == null ? void 0 : _b.orientation) {
|
|
6401
|
+
trackCameraOrientationLandscape(onEvent);
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
},
|
|
6405
|
+
[onEvent]
|
|
6406
|
+
);
|
|
6407
|
+
(0, import_react35.useEffect)(() => {
|
|
6408
|
+
var _a, _b;
|
|
6409
|
+
if (shouldLockOrientation) {
|
|
6410
|
+
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
6411
|
+
"change",
|
|
6412
|
+
(event) => handleOrientationChange(event)
|
|
6413
|
+
);
|
|
6414
|
+
}
|
|
6415
|
+
return () => {
|
|
6416
|
+
var _a2, _b2;
|
|
6417
|
+
(_b2 = (_a2 = window.screen) == null ? void 0 : _a2.orientation) == null ? void 0 : _b2.removeEventListener("change", handleOrientationChange);
|
|
6418
|
+
exitFullScreen();
|
|
6419
|
+
};
|
|
6420
|
+
}, [exitFullScreen, handleOrientationChange, shouldLockOrientation]);
|
|
6421
|
+
return {
|
|
6422
|
+
enterFullScreen,
|
|
6423
|
+
exitFullScreen
|
|
6424
|
+
};
|
|
6425
|
+
};
|
|
6426
|
+
var noop4 = () => {
|
|
6427
|
+
};
|
|
6428
|
+
|
|
6429
|
+
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
6430
|
+
var import_react36 = require("react");
|
|
6312
6431
|
var useVideoConstraints = (direction) => {
|
|
6313
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6432
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react36.useState)();
|
|
6314
6433
|
const defaultVideoConstraints = {
|
|
6315
6434
|
facingMode: direction === "front" ? "user" : "environment",
|
|
6316
6435
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -6318,7 +6437,7 @@ var useVideoConstraints = (direction) => {
|
|
|
6318
6437
|
frameRate: 30,
|
|
6319
6438
|
aspectRatio: 16 / 9
|
|
6320
6439
|
};
|
|
6321
|
-
(0,
|
|
6440
|
+
(0, import_react36.useEffect)(() => {
|
|
6322
6441
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
6323
6442
|
}, [direction]);
|
|
6324
6443
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -6335,9 +6454,9 @@ var useVideoConstraints = (direction) => {
|
|
|
6335
6454
|
return { videoConstraints };
|
|
6336
6455
|
};
|
|
6337
6456
|
|
|
6338
|
-
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6339
|
-
var
|
|
6340
|
-
var
|
|
6457
|
+
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
6458
|
+
var import_react37 = require("react");
|
|
6459
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6341
6460
|
var captureButtonHeight = 92;
|
|
6342
6461
|
var reviewButtonsHeight = 120;
|
|
6343
6462
|
var imageHeight = 40;
|
|
@@ -6345,39 +6464,32 @@ var titleHeight = 32;
|
|
|
6345
6464
|
var instructionsHeight = 48;
|
|
6346
6465
|
var reviewInstructionsHeight = 40;
|
|
6347
6466
|
var overlayMaxWidth = 800;
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
imageUrl,
|
|
6352
|
-
title,
|
|
6353
|
-
instructions,
|
|
6354
|
-
reviewInstructions
|
|
6355
|
-
}) => {
|
|
6356
|
-
const svgReference = (0, import_react36.useRef)(null);
|
|
6357
|
-
(0, import_react36.useEffect)(() => {
|
|
6467
|
+
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
6468
|
+
const svgReference = (0, import_react37.useRef)(null);
|
|
6469
|
+
(0, import_react37.useEffect)(() => {
|
|
6358
6470
|
const listener = debounce(() => {
|
|
6359
6471
|
var _a;
|
|
6360
6472
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
6361
6473
|
const reference = svgReference.current;
|
|
6362
|
-
reference.innerHTML
|
|
6474
|
+
reference.innerHTML = String(reference.innerHTML);
|
|
6363
6475
|
}
|
|
6364
6476
|
}, 100);
|
|
6365
6477
|
window.addEventListener("resize", listener);
|
|
6366
6478
|
return () => window.removeEventListener("resize", listener);
|
|
6367
6479
|
});
|
|
6368
6480
|
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,
|
|
6481
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
6482
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6483
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6484
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6373
6485
|
] });
|
|
6374
6486
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6375
6487
|
if (reviewInstructions) {
|
|
6376
6488
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6377
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6489
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6378
6490
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6379
6491
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6380
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6492
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, {});
|
|
6381
6493
|
}
|
|
6382
6494
|
}
|
|
6383
6495
|
const framePosition = {
|
|
@@ -6395,105 +6507,21 @@ var Overlay = ({
|
|
|
6395
6507
|
width: "90%"
|
|
6396
6508
|
}
|
|
6397
6509
|
};
|
|
6398
|
-
return /* @__PURE__ */ (0,
|
|
6399
|
-
/* @__PURE__ */ (0,
|
|
6400
|
-
/* @__PURE__ */ (0,
|
|
6401
|
-
/* @__PURE__ */ (0,
|
|
6510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6511
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("mask", { id: "mask", children: [
|
|
6512
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6513
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
6402
6514
|
] }) }),
|
|
6403
|
-
overlay && /* @__PURE__ */ (0,
|
|
6404
|
-
outline && /* @__PURE__ */ (0,
|
|
6405
|
-
/* @__PURE__ */ (0,
|
|
6515
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6516
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
6517
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
6406
6518
|
] });
|
|
6407
|
-
}
|
|
6519
|
+
}
|
|
6408
6520
|
var Overlay_default = Overlay;
|
|
6409
6521
|
|
|
6410
|
-
// src/step/cameraStep/cameraCapture/
|
|
6411
|
-
var import_components30 = require("@transferwise/components");
|
|
6412
|
-
var import_react_intl27 = require("react-intl");
|
|
6413
|
-
|
|
6414
|
-
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
6415
|
-
var import_react_intl26 = require("react-intl");
|
|
6416
|
-
var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
6417
|
-
title: {
|
|
6418
|
-
id: "dynamicFlows.CameraCapture.NoCameraAccess.title",
|
|
6419
|
-
defaultMessage: "We can't access your camera",
|
|
6420
|
-
description: "Title of standalone page prompting missing camera permissions"
|
|
6421
|
-
},
|
|
6422
|
-
paragraph: {
|
|
6423
|
-
id: "dynamicFlows.CameraCapture.NoCameraAccess.paragraph",
|
|
6424
|
-
defaultMessage: "Enable camera access in your browser's settings to get going again.",
|
|
6425
|
-
description: "Further text of standalone page prompting missing camera permissions"
|
|
6426
|
-
},
|
|
6427
|
-
action: {
|
|
6428
|
-
id: "dynamicFlows.CameraCapture.NoCameraAccess.action",
|
|
6429
|
-
defaultMessage: "Enable camera access",
|
|
6430
|
-
description: "Action to ask for camera permissions again"
|
|
6431
|
-
}
|
|
6432
|
-
});
|
|
6433
|
-
|
|
6434
|
-
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6435
|
-
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6436
|
-
var NoCameraAccess = ({ onAction }) => {
|
|
6437
|
-
const intl = (0, import_react_intl27.useIntl)();
|
|
6438
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6439
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6440
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6441
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components30.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6442
|
-
] }) }) }) });
|
|
6443
|
-
};
|
|
6444
|
-
var NoCameraAccess_default = NoCameraAccess;
|
|
6445
|
-
|
|
6446
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6447
|
-
var import_react_intl29 = require("react-intl");
|
|
6448
|
-
|
|
6449
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
|
|
6450
|
-
var import_react_intl28 = require("react-intl");
|
|
6451
|
-
var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages)({
|
|
6452
|
-
title: {
|
|
6453
|
-
id: "dynamicFlows.CameraCapture.CameraNotSupported.title",
|
|
6454
|
-
defaultMessage: "Camera not supported",
|
|
6455
|
-
description: "Title of standalone page prompting that camera is not available on users browser"
|
|
6456
|
-
},
|
|
6457
|
-
paragraph: {
|
|
6458
|
-
id: "dynamicFlows.CameraCapture.CameraNotSupported.paragraph",
|
|
6459
|
-
defaultMessage: "The browser you're using doesn't have support for a camera. Try a different browser, device, or download our mobile app.",
|
|
6460
|
-
description: "Further text of standalone page prompting that camera is not available on user's browser"
|
|
6461
|
-
}
|
|
6462
|
-
});
|
|
6463
|
-
|
|
6464
|
-
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6465
|
-
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6466
|
-
var CameraNotSupported = () => {
|
|
6467
|
-
const intl = (0, import_react_intl29.useIntl)();
|
|
6468
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { id: "camera-not-supported", 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: [
|
|
6469
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6470
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6471
|
-
] }) }) }) });
|
|
6472
|
-
};
|
|
6473
|
-
var CameraNotSupported_default = CameraNotSupported;
|
|
6474
|
-
|
|
6475
|
-
// src/step/cameraStep/cameraCapture/tracking/index.ts
|
|
6476
|
-
var trackCameraPermissionDenied = (onEvent) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Permission Denied", {});
|
|
6477
|
-
var trackCameraFeedStarted = async (onEvent, props, stream) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Feed Started", await getCameraStartedProperties(props, stream));
|
|
6478
|
-
var trackCameraNotSupported = (onEvent, error) => onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Not Supported", { Error: error });
|
|
6479
|
-
var getCameraStartedProperties = async (props, videoStream) => {
|
|
6480
|
-
var _a;
|
|
6481
|
-
const videoTrack = getVideoTrack(videoStream);
|
|
6482
|
-
const capabilities = getVideoCapabilities(videoStream);
|
|
6483
|
-
const settings = (_a = videoTrack == null ? void 0 : videoTrack.getSettings) == null ? void 0 : _a.call(videoTrack);
|
|
6484
|
-
return __spreadProps(__spreadValues({}, videoTrack && {
|
|
6485
|
-
"Available Video Devices (by label)": await getAvailableVideoDeviceLabels(),
|
|
6486
|
-
"Active Video Device (by label)": await getActiveVideoDeviceLabel(videoStream),
|
|
6487
|
-
"Camera Capabilities": capabilities,
|
|
6488
|
-
"Camera Settings": settings
|
|
6489
|
-
}), {
|
|
6490
|
-
"Camera Direction (Asked)": props == null ? void 0 : props.direction
|
|
6491
|
-
});
|
|
6492
|
-
};
|
|
6493
|
-
|
|
6494
|
-
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6522
|
+
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6495
6523
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6496
|
-
|
|
6524
|
+
function CameraCapture({
|
|
6497
6525
|
direction = "back",
|
|
6498
6526
|
overlay = "",
|
|
6499
6527
|
outline = "",
|
|
@@ -6503,21 +6531,24 @@ var CameraCapture = ({
|
|
|
6503
6531
|
showReview = false,
|
|
6504
6532
|
onCapture,
|
|
6505
6533
|
onEvent
|
|
6506
|
-
})
|
|
6507
|
-
const [mode, setMode] = (0,
|
|
6508
|
-
const [
|
|
6509
|
-
const [
|
|
6510
|
-
const [
|
|
6511
|
-
const
|
|
6534
|
+
}) {
|
|
6535
|
+
const [mode, setMode] = (0, import_react38.useState)("CAPTURE" /* CAPTURE */);
|
|
6536
|
+
const [cameraError, setCameraError] = (0, import_react38.useState)();
|
|
6537
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react38.useState)(false);
|
|
6538
|
+
const [ready, setReady] = (0, import_react38.useState)(false);
|
|
6539
|
+
const [reviewImage, setReviewImage] = (0, import_react38.useState)();
|
|
6540
|
+
const webcamReference = (0, import_react38.useRef)(null);
|
|
6512
6541
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6513
|
-
const
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
[orientationLockFeature]
|
|
6542
|
+
const shouldLockOrientation = (0, import_react38.useMemo)(
|
|
6543
|
+
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
6544
|
+
[mode]
|
|
6517
6545
|
);
|
|
6518
|
-
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(
|
|
6519
|
-
|
|
6520
|
-
|
|
6546
|
+
const { enterFullScreen, exitFullScreen } = useFullScreenOrientationLock(
|
|
6547
|
+
shouldLockOrientation,
|
|
6548
|
+
onEvent
|
|
6549
|
+
);
|
|
6550
|
+
const intl = (0, import_react_intl26.useIntl)();
|
|
6551
|
+
const handleCapture = (0, import_react38.useCallback)(async () => {
|
|
6521
6552
|
var _a, _b, _c, _d, _e, _f;
|
|
6522
6553
|
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
6554
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -6528,7 +6559,7 @@ var CameraCapture = ({
|
|
|
6528
6559
|
if (showReview) {
|
|
6529
6560
|
const source = window.URL.createObjectURL(blob);
|
|
6530
6561
|
setReviewImage({ source, blob });
|
|
6531
|
-
setMode("REVIEW");
|
|
6562
|
+
setMode("REVIEW" /* REVIEW */);
|
|
6532
6563
|
} else {
|
|
6533
6564
|
onCapture(blob);
|
|
6534
6565
|
}
|
|
@@ -6539,19 +6570,43 @@ var CameraCapture = ({
|
|
|
6539
6570
|
);
|
|
6540
6571
|
}
|
|
6541
6572
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
6542
|
-
const handleUserMediaError = (0,
|
|
6573
|
+
const handleUserMediaError = (0, import_react38.useCallback)(
|
|
6543
6574
|
(error) => {
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6575
|
+
setMode("ERROR" /* ERROR */);
|
|
6576
|
+
if (error instanceof DOMException) {
|
|
6577
|
+
switch (error == null ? void 0 : error.name) {
|
|
6578
|
+
case "NotAllowedError":
|
|
6579
|
+
setCameraError({
|
|
6580
|
+
title: intl.formatMessage(CameraCapture_messages_default.noCameraAccessTitle),
|
|
6581
|
+
description: intl.formatMessage(CameraCapture_messages_default.noCameraAccessParagraph),
|
|
6582
|
+
actionButton: intl.formatMessage(CameraCapture_messages_default.noCameraAccessAction),
|
|
6583
|
+
onAction: handleRetryCameraAccess
|
|
6584
|
+
});
|
|
6585
|
+
trackCameraError("Dynamic Flow - Camera Permission Denied", onEvent, error);
|
|
6586
|
+
return;
|
|
6587
|
+
case "NotFoundError":
|
|
6588
|
+
case "OverconstrainedError":
|
|
6589
|
+
case "AbortError":
|
|
6590
|
+
case "NotReadableError":
|
|
6591
|
+
setCameraError({
|
|
6592
|
+
title: intl.formatMessage(CameraCapture_messages_default.cameraConnectionIssueTitle),
|
|
6593
|
+
description: intl.formatMessage(CameraCapture_messages_default.cameraConnectionIssueParagraph),
|
|
6594
|
+
actionButton: intl.formatMessage(CameraCapture_messages_default.cameraConnectionIssueAction),
|
|
6595
|
+
onAction: handleRetryCameraAccess
|
|
6596
|
+
});
|
|
6597
|
+
trackCameraError("Dynamic Flow - Camera Not Accessible", onEvent, error);
|
|
6598
|
+
return;
|
|
6599
|
+
}
|
|
6548
6600
|
}
|
|
6549
|
-
|
|
6550
|
-
|
|
6601
|
+
setCameraError({
|
|
6602
|
+
title: intl.formatMessage(CameraCapture_messages_default.cameraNotSupportedTitle),
|
|
6603
|
+
description: intl.formatMessage(CameraCapture_messages_default.cameraNotSupportedParagraph)
|
|
6604
|
+
});
|
|
6605
|
+
trackCameraError("Dynamic Flow - Camera Not Supported", onEvent, error);
|
|
6551
6606
|
},
|
|
6552
|
-
[
|
|
6607
|
+
[intl, onEvent]
|
|
6553
6608
|
);
|
|
6554
|
-
const handleUserMedia = (0,
|
|
6609
|
+
const handleUserMedia = (0, import_react38.useCallback)(
|
|
6555
6610
|
(stream) => {
|
|
6556
6611
|
enterFullScreen();
|
|
6557
6612
|
setReady(true);
|
|
@@ -6564,16 +6619,16 @@ var CameraCapture = ({
|
|
|
6564
6619
|
onCapture((reviewImage == null ? void 0 : reviewImage.blob) || null);
|
|
6565
6620
|
};
|
|
6566
6621
|
const handleReviewRetry = () => {
|
|
6567
|
-
setMode("CAPTURE");
|
|
6622
|
+
setMode("CAPTURE" /* CAPTURE */);
|
|
6568
6623
|
setReviewImage(void 0);
|
|
6569
6624
|
};
|
|
6570
|
-
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6571
|
-
(0,
|
|
6572
|
-
if (mode !== "CAPTURE") {
|
|
6625
|
+
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
6626
|
+
(0, import_react38.useEffect)(() => {
|
|
6627
|
+
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
6573
6628
|
exitFullScreen();
|
|
6574
6629
|
}
|
|
6575
6630
|
}, [mode, exitFullScreen]);
|
|
6576
|
-
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6631
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "camera-capture", children: [
|
|
6577
6632
|
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6578
6633
|
import_react_webcam.default,
|
|
6579
6634
|
{
|
|
@@ -6596,9 +6651,16 @@ var CameraCapture = ({
|
|
|
6596
6651
|
}
|
|
6597
6652
|
),
|
|
6598
6653
|
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrientationLockOverlay_default, {}),
|
|
6599
|
-
ready && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6654
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6655
|
+
CaptureBottomBar,
|
|
6656
|
+
{
|
|
6657
|
+
onCapture: () => {
|
|
6658
|
+
void handleCapture();
|
|
6659
|
+
}
|
|
6660
|
+
}
|
|
6661
|
+
)
|
|
6600
6662
|
] });
|
|
6601
|
-
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6663
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "camera-capture", children: [
|
|
6602
6664
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6603
6665
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6604
6666
|
Overlay_default,
|
|
@@ -6612,16 +6674,15 @@ var CameraCapture = ({
|
|
|
6612
6674
|
),
|
|
6613
6675
|
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6614
6676
|
] });
|
|
6615
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", {
|
|
6616
|
-
mode === "CAPTURE" && captureScreen,
|
|
6617
|
-
mode === "REVIEW" && reviewScreen,
|
|
6618
|
-
mode === "
|
|
6619
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CameraNotSupported_default, {})
|
|
6677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { children: [
|
|
6678
|
+
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
6679
|
+
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
6680
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
6620
6681
|
] });
|
|
6621
|
-
}
|
|
6682
|
+
}
|
|
6622
6683
|
var CameraCapture_default = CameraCapture;
|
|
6623
6684
|
|
|
6624
|
-
// src/step/cameraStep/CameraStep.tsx
|
|
6685
|
+
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
6625
6686
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6626
6687
|
function blobToBase64(blob) {
|
|
6627
6688
|
return new Promise((resolve, _) => {
|
|
@@ -6630,7 +6691,7 @@ function blobToBase64(blob) {
|
|
|
6630
6691
|
reader.readAsDataURL(blob);
|
|
6631
6692
|
});
|
|
6632
6693
|
}
|
|
6633
|
-
|
|
6694
|
+
function CameraStep(props) {
|
|
6634
6695
|
const { step, model, onModelChange, onAction } = props;
|
|
6635
6696
|
const onEvent = useEventDispatcher();
|
|
6636
6697
|
const objectSchema = getObjectSchema(step);
|
|
@@ -6640,8 +6701,8 @@ var CameraStep = (props) => {
|
|
|
6640
6701
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
6641
6702
|
const { overlay, outline } = assets || {};
|
|
6642
6703
|
const { url: imageUrl } = image || {};
|
|
6643
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
6644
|
-
(0,
|
|
6704
|
+
const [captureClicked, setCaptureClicked] = (0, import_react39.useState)(false);
|
|
6705
|
+
(0, import_react39.useEffect)(() => {
|
|
6645
6706
|
if (captureClicked) {
|
|
6646
6707
|
onAction(action);
|
|
6647
6708
|
}
|
|
@@ -6675,7 +6736,7 @@ var CameraStep = (props) => {
|
|
|
6675
6736
|
}
|
|
6676
6737
|
}
|
|
6677
6738
|
);
|
|
6678
|
-
}
|
|
6739
|
+
}
|
|
6679
6740
|
var CameraStep_default = CameraStep;
|
|
6680
6741
|
function getObjectSchema(step) {
|
|
6681
6742
|
const nonHiddenSchemas = filterHiddenSchemas(step.schemas || []);
|
|
@@ -6708,12 +6769,12 @@ function getFirstAction(step) {
|
|
|
6708
6769
|
return step.actions[0];
|
|
6709
6770
|
}
|
|
6710
6771
|
|
|
6711
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6712
|
-
var
|
|
6772
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6773
|
+
var import_react_intl28 = require("react-intl");
|
|
6713
6774
|
|
|
6714
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6715
|
-
var
|
|
6716
|
-
var ExternalConfirmationStep_messages_default = (0,
|
|
6775
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6776
|
+
var import_react_intl27 = require("react-intl");
|
|
6777
|
+
var ExternalConfirmationStep_messages_default = (0, import_react_intl27.defineMessages)({
|
|
6717
6778
|
title: {
|
|
6718
6779
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
6719
6780
|
defaultMessage: "Please confirm",
|
|
@@ -6736,12 +6797,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMe
|
|
|
6736
6797
|
}
|
|
6737
6798
|
});
|
|
6738
6799
|
|
|
6739
|
-
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6800
|
+
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6740
6801
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6741
6802
|
var noop5 = () => {
|
|
6742
6803
|
};
|
|
6743
6804
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6744
|
-
const { formatMessage } = (0,
|
|
6805
|
+
const { formatMessage } = (0, import_react_intl28.useIntl)();
|
|
6745
6806
|
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6746
6807
|
DynamicLayout_default,
|
|
6747
6808
|
{
|
|
@@ -6806,33 +6867,33 @@ function getOrigin(url) {
|
|
|
6806
6867
|
}
|
|
6807
6868
|
}
|
|
6808
6869
|
|
|
6809
|
-
// src/dynamicFlow/BackButton.tsx
|
|
6810
|
-
var
|
|
6870
|
+
// src/legacy/dynamicFlow/BackButton.tsx
|
|
6871
|
+
var import_components34 = require("@transferwise/components");
|
|
6811
6872
|
var import_icons2 = require("@transferwise/icons");
|
|
6812
6873
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6813
|
-
|
|
6874
|
+
function BackButton({ title, action, onAction }) {
|
|
6814
6875
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6815
6876
|
"a",
|
|
6816
6877
|
{
|
|
6878
|
+
href: "/",
|
|
6879
|
+
className: "df-back-btn",
|
|
6880
|
+
"aria-label": title,
|
|
6817
6881
|
onClick: (event) => {
|
|
6818
6882
|
event.preventDefault();
|
|
6819
6883
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
6820
6884
|
},
|
|
6821
|
-
href: "/",
|
|
6822
|
-
className: "df-back-btn",
|
|
6823
|
-
"aria-label": title,
|
|
6824
6885
|
children: [
|
|
6825
6886
|
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: title }),
|
|
6826
|
-
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
6887
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components34.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6827
6888
|
]
|
|
6828
6889
|
}
|
|
6829
6890
|
);
|
|
6830
|
-
}
|
|
6891
|
+
}
|
|
6831
6892
|
var BackButton_default = BackButton;
|
|
6832
6893
|
|
|
6833
|
-
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6894
|
+
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
6834
6895
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6835
|
-
|
|
6896
|
+
function DynamicFlowStep(props) {
|
|
6836
6897
|
var _a, _b, _c;
|
|
6837
6898
|
const { step, globalError, onAction } = props;
|
|
6838
6899
|
const externalUrl = (_a = step == null ? void 0 : step.external) == null ? void 0 : _a.url;
|
|
@@ -6855,13 +6916,13 @@ var DynamicFlowStep = (props) => {
|
|
|
6855
6916
|
globalError ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6856
6917
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6857
6918
|
] });
|
|
6858
|
-
}
|
|
6919
|
+
}
|
|
6859
6920
|
|
|
6860
|
-
// src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6861
|
-
var
|
|
6921
|
+
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
6922
|
+
var import_react40 = require("react");
|
|
6862
6923
|
var DEBOUNCE_DELAY = 1e3;
|
|
6863
6924
|
function useDebouncedRefresh(fetchRefresh) {
|
|
6864
|
-
const map = (0,
|
|
6925
|
+
const map = (0, import_react40.useRef)(/* @__PURE__ */ new Map());
|
|
6865
6926
|
const retrieveOrCreate = (key) => {
|
|
6866
6927
|
if (map.current.has(key)) {
|
|
6867
6928
|
return map.current.get(key);
|
|
@@ -6875,21 +6936,21 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
6875
6936
|
};
|
|
6876
6937
|
return function(url, data, etag, schema) {
|
|
6877
6938
|
const debouncedFetchRefresh = retrieveOrCreate(url);
|
|
6878
|
-
|
|
6939
|
+
debouncedFetchRefresh(url, data, etag);
|
|
6879
6940
|
if (!schema || !shouldDebounceSchema(schema)) {
|
|
6880
|
-
|
|
6941
|
+
debouncedFetchRefresh.flush();
|
|
6881
6942
|
}
|
|
6882
6943
|
};
|
|
6883
6944
|
}
|
|
6884
6945
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
6885
6946
|
|
|
6886
|
-
// src/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6887
|
-
var
|
|
6947
|
+
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
6948
|
+
var import_react41 = require("react");
|
|
6888
6949
|
var useDynamicFlowState = (initialStep) => {
|
|
6889
6950
|
var _a, _b;
|
|
6890
|
-
const [formErrors, setFormErrors] = (0,
|
|
6891
|
-
const [globalError, setGlobalError] = (0,
|
|
6892
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
6951
|
+
const [formErrors, setFormErrors] = (0, import_react41.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
6952
|
+
const [globalError, setGlobalError] = (0, import_react41.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
6953
|
+
const [stepAndModels, setStepAndModels] = (0, import_react41.useState)({
|
|
6893
6954
|
step: initialStep || void 0,
|
|
6894
6955
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
6895
6956
|
etag: void 0
|
|
@@ -6919,7 +6980,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6919
6980
|
return updatedState;
|
|
6920
6981
|
});
|
|
6921
6982
|
};
|
|
6922
|
-
const modelIsValid = (0,
|
|
6983
|
+
const modelIsValid = (0, import_react41.useMemo)(
|
|
6923
6984
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
6924
6985
|
[models, step]
|
|
6925
6986
|
);
|
|
@@ -6936,16 +6997,14 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
6936
6997
|
setSchemaModel
|
|
6937
6998
|
};
|
|
6938
6999
|
};
|
|
6939
|
-
var buildInitialModels = (model, schemas = []) => {
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
}, {});
|
|
6948
|
-
};
|
|
7000
|
+
var buildInitialModels = (model, schemas = []) => schemas.reduce((acc, schema) => {
|
|
7001
|
+
if (!schema.$id) {
|
|
7002
|
+
console.warn("Schema without $id property found.");
|
|
7003
|
+
}
|
|
7004
|
+
return __spreadProps(__spreadValues({}, acc), {
|
|
7005
|
+
[schema.$id || ""]: getValidObjectModelParts(model, schema) || {}
|
|
7006
|
+
});
|
|
7007
|
+
}, {});
|
|
6949
7008
|
var getAllSchemas = (step) => [
|
|
6950
7009
|
...getAllSchemasInLayout((step == null ? void 0 : step.layout) || []),
|
|
6951
7010
|
...(step == null ? void 0 : step.schemas) || []
|
|
@@ -6978,38 +7037,34 @@ var getAllReferencedSchemaIds = (components) => components.flatMap((component) =
|
|
|
6978
7037
|
return [];
|
|
6979
7038
|
}
|
|
6980
7039
|
}).filter(Boolean);
|
|
6981
|
-
var areModelsValid = (formModels, schemas = []) => {
|
|
6982
|
-
|
|
6983
|
-
|
|
6984
|
-
|
|
6985
|
-
|
|
6986
|
-
|
|
6987
|
-
}));
|
|
6988
|
-
};
|
|
7040
|
+
var areModelsValid = (formModels, schemas = []) => !(schemas == null ? void 0 : schemas.some((schema) => {
|
|
7041
|
+
if (!schema.$id) {
|
|
7042
|
+
console.warn("Schema without $id property found.");
|
|
7043
|
+
}
|
|
7044
|
+
return !isValidSchema(formModels[schema.$id || ""] || {}, schema);
|
|
7045
|
+
}));
|
|
6989
7046
|
var getSchemaReference = (component) => {
|
|
6990
7047
|
if (component.schema && !isInlineSchema(component.schema)) {
|
|
6991
7048
|
return component.schema.$ref;
|
|
6992
7049
|
}
|
|
6993
7050
|
return component.schemaId;
|
|
6994
7051
|
};
|
|
6995
|
-
var isInlineSchema = (schema) =>
|
|
6996
|
-
return schema !== void 0 && typeof schema === "object" && Object.prototype.hasOwnProperty.call(schema, "$ref") === false;
|
|
6997
|
-
};
|
|
7052
|
+
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwn(schema, "$ref");
|
|
6998
7053
|
|
|
6999
|
-
// src/dynamicFlow/utils/useLoader.tsx
|
|
7000
|
-
var
|
|
7001
|
-
var
|
|
7054
|
+
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
7055
|
+
var import_components35 = require("@transferwise/components");
|
|
7056
|
+
var import_react42 = require("react");
|
|
7002
7057
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
7003
7058
|
function useLoader(loaderConfig, initialState) {
|
|
7004
7059
|
const config = __spreadValues({
|
|
7005
|
-
size:
|
|
7060
|
+
size: import_components35.Size.EXTRA_LARGE,
|
|
7006
7061
|
initial: true,
|
|
7007
7062
|
submission: false
|
|
7008
7063
|
}, loaderConfig);
|
|
7009
|
-
const [loadingState, setLoadingState] = (0,
|
|
7064
|
+
const [loadingState, setLoadingState] = (0, import_react42.useState)(initialState);
|
|
7010
7065
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
7011
7066
|
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
7012
|
-
|
|
7067
|
+
import_components35.Loader,
|
|
7013
7068
|
{
|
|
7014
7069
|
size: config.size,
|
|
7015
7070
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -7019,35 +7074,35 @@ function useLoader(loaderConfig, initialState) {
|
|
|
7019
7074
|
return { isLoading: loadingState !== "idle", setLoadingState, loader };
|
|
7020
7075
|
}
|
|
7021
7076
|
|
|
7022
|
-
// src/
|
|
7023
|
-
var
|
|
7077
|
+
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
7078
|
+
var import_react43 = require("react");
|
|
7024
7079
|
|
|
7025
|
-
// src/
|
|
7026
|
-
var
|
|
7027
|
-
var
|
|
7080
|
+
// src/common/errorBoundary/ErrorBoundaryAlert.tsx
|
|
7081
|
+
var import_components36 = require("@transferwise/components");
|
|
7082
|
+
var import_react_intl29 = require("react-intl");
|
|
7028
7083
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
7029
|
-
|
|
7030
|
-
const { formatMessage } = (0,
|
|
7084
|
+
function ErrorBoundaryAlert({ onDismiss }) {
|
|
7085
|
+
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
7031
7086
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
7032
|
-
|
|
7087
|
+
import_components36.Alert,
|
|
7033
7088
|
{
|
|
7034
7089
|
action: {
|
|
7035
7090
|
text: formatMessage(ErrorBoundary_messages_default.retry),
|
|
7036
7091
|
href: window.location.href
|
|
7037
7092
|
},
|
|
7038
7093
|
message: formatMessage(ErrorBoundary_messages_default.errorAlert),
|
|
7039
|
-
type:
|
|
7094
|
+
type: import_components36.Sentiment.NEGATIVE,
|
|
7040
7095
|
className: "m-b-3",
|
|
7041
7096
|
onDismiss
|
|
7042
7097
|
}
|
|
7043
7098
|
);
|
|
7044
|
-
}
|
|
7099
|
+
}
|
|
7045
7100
|
|
|
7046
|
-
// src/
|
|
7101
|
+
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
7047
7102
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
7048
7103
|
var noop6 = () => {
|
|
7049
7104
|
};
|
|
7050
|
-
var ErrorBoundary = class extends
|
|
7105
|
+
var ErrorBoundary = class extends import_react43.Component {
|
|
7051
7106
|
constructor(props) {
|
|
7052
7107
|
super(props);
|
|
7053
7108
|
this.handleErrorReset = () => {
|
|
@@ -7073,7 +7128,7 @@ var ErrorBoundary = class extends import_react42.Component {
|
|
|
7073
7128
|
};
|
|
7074
7129
|
var ErrorBoundary_default = ErrorBoundary;
|
|
7075
7130
|
|
|
7076
|
-
// src/dynamicFlow/utils/responseParsers/response-parsers.ts
|
|
7131
|
+
// src/legacy/dynamicFlow/utils/responseParsers/response-parsers.ts
|
|
7077
7132
|
var parseFetchResponseByResponseType = async (response, type) => {
|
|
7078
7133
|
switch (type) {
|
|
7079
7134
|
case "step":
|
|
@@ -7112,9 +7167,7 @@ var parseActionResponse = async (response) => {
|
|
|
7112
7167
|
}
|
|
7113
7168
|
return { type: "action", action: jsonBody.action };
|
|
7114
7169
|
};
|
|
7115
|
-
var parseExitResponse = async (response) => {
|
|
7116
|
-
return { type: "exit", result: await getJsonObjectOrNull(response) };
|
|
7117
|
-
};
|
|
7170
|
+
var parseExitResponse = async (response) => ({ type: "exit", result: await getJsonObjectOrNull(response) });
|
|
7118
7171
|
var parseFetchResponse = async (response) => {
|
|
7119
7172
|
var _a, _b, _c;
|
|
7120
7173
|
assertResponseIsValid(response);
|
|
@@ -7170,7 +7223,7 @@ var assertResponseIsValid = (response) => {
|
|
|
7170
7223
|
};
|
|
7171
7224
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
7172
7225
|
|
|
7173
|
-
// src/dynamicFlow/DynamicFlow.tsx
|
|
7226
|
+
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
7174
7227
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
7175
7228
|
var noop7 = () => {
|
|
7176
7229
|
};
|
|
@@ -7187,7 +7240,7 @@ var DynamicFlowComponent = ({
|
|
|
7187
7240
|
onEvent = noop7,
|
|
7188
7241
|
onLog = noop7
|
|
7189
7242
|
}) => {
|
|
7190
|
-
const { locale } = (0,
|
|
7243
|
+
const { locale } = (0, import_react_intl30.useIntl)();
|
|
7191
7244
|
const {
|
|
7192
7245
|
formErrors,
|
|
7193
7246
|
globalError,
|
|
@@ -7200,25 +7253,29 @@ var DynamicFlowComponent = ({
|
|
|
7200
7253
|
setStepAndEtag,
|
|
7201
7254
|
setSchemaModel
|
|
7202
7255
|
} = useDynamicFlowState(initialStep);
|
|
7203
|
-
const [submitted, setSubmitted] = (0,
|
|
7256
|
+
const [submitted, setSubmitted] = (0, import_react44.useState)(false);
|
|
7204
7257
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
7205
7258
|
loaderConfig,
|
|
7206
7259
|
initialStep ? "idle" : "initial"
|
|
7207
7260
|
);
|
|
7208
7261
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
7209
|
-
const analyticsMetadata = (0,
|
|
7262
|
+
const analyticsMetadata = (0, import_react44.useMemo)(
|
|
7210
7263
|
() => {
|
|
7211
7264
|
var _a;
|
|
7212
7265
|
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
7266
|
},
|
|
7214
7267
|
[flowId, step]
|
|
7215
7268
|
);
|
|
7216
|
-
const dispatchEvent = (0,
|
|
7269
|
+
const dispatchEvent = (0, import_react44.useMemo)(
|
|
7217
7270
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
7218
7271
|
[onEvent, analyticsMetadata]
|
|
7219
7272
|
);
|
|
7220
|
-
const dfHttpClient = (0,
|
|
7221
|
-
({
|
|
7273
|
+
const dfHttpClient = (0, import_react44.useCallback)(
|
|
7274
|
+
({
|
|
7275
|
+
action,
|
|
7276
|
+
data,
|
|
7277
|
+
etag: etag2
|
|
7278
|
+
}) => {
|
|
7222
7279
|
const { url, method = "POST" } = action;
|
|
7223
7280
|
return httpClient(url != null ? url : "", {
|
|
7224
7281
|
method,
|
|
@@ -7267,17 +7324,17 @@ var DynamicFlowComponent = ({
|
|
|
7267
7324
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
7268
7325
|
};
|
|
7269
7326
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
7270
|
-
const dispatchEventAndComplete = (0,
|
|
7327
|
+
const dispatchEventAndComplete = (0, import_react44.useCallback)(
|
|
7271
7328
|
(result) => {
|
|
7272
7329
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
7273
7330
|
onCompletion(result);
|
|
7274
7331
|
},
|
|
7275
7332
|
[onCompletion, dispatchEvent]
|
|
7276
7333
|
);
|
|
7277
|
-
(0,
|
|
7334
|
+
(0, import_react44.useEffect)(() => {
|
|
7278
7335
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
7279
7336
|
}, []);
|
|
7280
|
-
(0,
|
|
7337
|
+
(0, import_react44.useEffect)(() => {
|
|
7281
7338
|
if (!initialStep) {
|
|
7282
7339
|
const action = __spreadValues({
|
|
7283
7340
|
id: "#initial-step-request",
|
|
@@ -7306,7 +7363,7 @@ var DynamicFlowComponent = ({
|
|
|
7306
7363
|
updateStep(result.step, result.etag, fetchType);
|
|
7307
7364
|
}
|
|
7308
7365
|
} catch (error) {
|
|
7309
|
-
|
|
7366
|
+
completeWithError(error, "Error parsing fetch response", fetchType, response.status);
|
|
7310
7367
|
}
|
|
7311
7368
|
};
|
|
7312
7369
|
const updateStep = (newStep, etag2, fetchType) => {
|
|
@@ -7408,11 +7465,11 @@ var DynamicFlowComponent = ({
|
|
|
7408
7465
|
}
|
|
7409
7466
|
) }) }) }) }) });
|
|
7410
7467
|
};
|
|
7411
|
-
|
|
7468
|
+
function DynamicFlow(props) {
|
|
7469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7470
|
+
}
|
|
7412
7471
|
var DynamicFlow_default = DynamicFlow;
|
|
7413
|
-
var combineModels2 = (formModels) => {
|
|
7414
|
-
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
7415
|
-
};
|
|
7472
|
+
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
7416
7473
|
var isSubmissionMethod = (method = "POST") => {
|
|
7417
7474
|
const submissionMethods = ["POST", "PUT", "PATCH"];
|
|
7418
7475
|
return submissionMethods.includes(method.toUpperCase());
|
|
@@ -7425,9 +7482,9 @@ var shouldTriggerRefresh = (props) => {
|
|
|
7425
7482
|
return type !== "init" && hasRefreshOnChange && (isValid() || wasValid());
|
|
7426
7483
|
};
|
|
7427
7484
|
|
|
7428
|
-
// src/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7485
|
+
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
7429
7486
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
7430
|
-
|
|
7487
|
+
function JsonSchemaForm(props) {
|
|
7431
7488
|
const schemaProps = __spreadValues({
|
|
7432
7489
|
model: null,
|
|
7433
7490
|
errors: null
|
|
@@ -7441,7 +7498,7 @@ var JsonSchemaForm = (props) => {
|
|
|
7441
7498
|
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
7442
7499
|
}
|
|
7443
7500
|
) });
|
|
7444
|
-
}
|
|
7501
|
+
}
|
|
7445
7502
|
var JsonSchemaForm_default = JsonSchemaForm;
|
|
7446
7503
|
var noop8 = () => {
|
|
7447
7504
|
};
|
|
@@ -7499,6 +7556,9 @@ var en_default = {
|
|
|
7499
7556
|
"dynamicFlows.ArraySchema.maxItemsError": "Please add {maxItems} or fewer.",
|
|
7500
7557
|
"dynamicFlows.ArraySchema.minItemsError": "Please add at least {minItems}.",
|
|
7501
7558
|
"dynamicFlows.ArraySchema.removeItem": "Remove",
|
|
7559
|
+
"dynamicFlows.CameraCapture.CameraConnectionIssue.action": "Try again",
|
|
7560
|
+
"dynamicFlows.CameraCapture.CameraConnectionIssue.paragraph": "Please check if it is connected and try again.",
|
|
7561
|
+
"dynamicFlows.CameraCapture.CameraConnectionIssue.title": "We can't access your camera",
|
|
7502
7562
|
"dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "The browser you're using doesn't have support for a camera. Try a different browser, device, or download our mobile app.",
|
|
7503
7563
|
"dynamicFlows.CameraCapture.CameraNotSupported.title": "Camera not supported",
|
|
7504
7564
|
"dynamicFlows.CameraCapture.NoCameraAccess.action": "Enable camera access",
|
|
@@ -7518,6 +7578,7 @@ var en_default = {
|
|
|
7518
7578
|
"dynamicFlows.ControlFeedback.patternDate": "Please enter a date in the corrrect format.",
|
|
7519
7579
|
"dynamicFlows.ControlFeedback.required": "Please fill out this field.",
|
|
7520
7580
|
"dynamicFlows.ControlFeedback.type": "Incorrect type",
|
|
7581
|
+
"dynamicFlows.DefaultErrorMessages.required": "Please fill out this field.",
|
|
7521
7582
|
"dynamicFlows.DynamicExternal.retryTitle": "Reopen window",
|
|
7522
7583
|
"dynamicFlows.DynamicParagraph.copied": "Copied to clipboard",
|
|
7523
7584
|
"dynamicFlows.DynamicParagraph.copy": "Copy",
|
|
@@ -7854,7 +7915,7 @@ var pl_default = {
|
|
|
7854
7915
|
// src/i18n/pt.json
|
|
7855
7916
|
var pt_default = {
|
|
7856
7917
|
"dynamicFlows.ArraySchema.addItem": "Salvar",
|
|
7857
|
-
"dynamicFlows.ArraySchema.addItemTitle": "
|
|
7918
|
+
"dynamicFlows.ArraySchema.addItemTitle": "Adicionar item",
|
|
7858
7919
|
"dynamicFlows.ArraySchema.editItem": "Salvar",
|
|
7859
7920
|
"dynamicFlows.ArraySchema.maxItemsError": "Adicione {maxItems} ou menos.",
|
|
7860
7921
|
"dynamicFlows.ArraySchema.minItemsError": "Adicione pelo menos {minItems}.",
|
|
@@ -7867,7 +7928,7 @@ var pt_default = {
|
|
|
7867
7928
|
"dynamicFlows.CameraCapture.reviewInstructions": "A sua foto est\xE1 clara, leg\xEDvel e aparece por inteiro?",
|
|
7868
7929
|
"dynamicFlows.CameraCapture.reviewRetry": "N\xE3o, tentar novamente",
|
|
7869
7930
|
"dynamicFlows.CameraCapture.reviewSubmit": "Sim, enviar",
|
|
7870
|
-
"dynamicFlows.CameraCapture.rotatePhone.text": "
|
|
7931
|
+
"dynamicFlows.CameraCapture.rotatePhone.text": "Gire o telefone para o modo retrato para tirar uma foto",
|
|
7871
7932
|
"dynamicFlows.ControlFeedback.maxLength": "Por favor, insira {maxLength} caracteres ou menos.",
|
|
7872
7933
|
"dynamicFlows.ControlFeedback.maximum": "Por favor, insira um n\xFAmero que seja {maximum} ou menos.",
|
|
7873
7934
|
"dynamicFlows.ControlFeedback.maximumDate": "Por favor, insira uma data que seja em ou antes de {maximum}.",
|
|
@@ -8079,22 +8140,22 @@ var tr_default = {
|
|
|
8079
8140
|
// src/i18n/zh_CN.json
|
|
8080
8141
|
var zh_CN_default = {
|
|
8081
8142
|
"dynamicFlows.ArraySchema.addItem": "\u4FDD\u5B58",
|
|
8082
|
-
"dynamicFlows.ArraySchema.addItemTitle": "
|
|
8143
|
+
"dynamicFlows.ArraySchema.addItemTitle": "\u6DFB\u52A0\u9879\u76EE",
|
|
8083
8144
|
"dynamicFlows.ArraySchema.editItem": "\u4FDD\u5B58",
|
|
8084
|
-
"dynamicFlows.ArraySchema.maxItemsError": "\u8BF7\u6DFB\u52A0 {maxItems} \
|
|
8085
|
-
"dynamicFlows.ArraySchema.minItemsError": "\u8BF7\u81F3\u5C11\u6DFB\u52A0 {minItems}\u3002",
|
|
8086
|
-
"dynamicFlows.ArraySchema.removeItem": "\
|
|
8087
|
-
"dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "
|
|
8145
|
+
"dynamicFlows.ArraySchema.maxItemsError": "\u8BF7\u6DFB\u52A0\u4E0D\u8D85\u8FC7 {maxItems} \u9879\u3002",
|
|
8146
|
+
"dynamicFlows.ArraySchema.minItemsError": "\u8BF7\u81F3\u5C11\u6DFB\u52A0 {minItems} \u9879\u3002",
|
|
8147
|
+
"dynamicFlows.ArraySchema.removeItem": "\u79FB\u9664",
|
|
8148
|
+
"dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "\u60A8\u76EE\u524D\u4F7F\u7528\u7684\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u6444\u50CF\u5934\u3002\u8BF7\u5C1D\u8BD5\u5176\u4ED6\u6D4F\u89C8\u5668\u3001\u8BBE\u5907\u6216\u4E0B\u8F7D\u6211\u4EEC\u7684\u5E94\u7528\u3002",
|
|
8088
8149
|
"dynamicFlows.CameraCapture.CameraNotSupported.title": "\u4E0D\u652F\u6301\u6444\u50CF\u5934",
|
|
8089
|
-
"dynamicFlows.CameraCapture.NoCameraAccess.action": "
|
|
8090
|
-
"dynamicFlows.CameraCapture.NoCameraAccess.paragraph": "
|
|
8091
|
-
"dynamicFlows.CameraCapture.NoCameraAccess.title": "
|
|
8150
|
+
"dynamicFlows.CameraCapture.NoCameraAccess.action": "\u5141\u8BB8\u8BBF\u95EE\u6444\u50CF\u5934",
|
|
8151
|
+
"dynamicFlows.CameraCapture.NoCameraAccess.paragraph": "\u5728\u6D4F\u89C8\u5668\u8BBE\u7F6E\u4E2D\u542F\u7528\u76F8\u673A\u8BBF\u95EE\u6743\u9650\uFF0C\u518D\u91CD\u65B0\u5C1D\u8BD5\u3002",
|
|
8152
|
+
"dynamicFlows.CameraCapture.NoCameraAccess.title": "\u6211\u4EEC\u65E0\u6CD5\u8BBF\u95EE\u60A8\u7684\u6444\u50CF\u5934",
|
|
8092
8153
|
"dynamicFlows.CameraCapture.reviewInstructions": "\u60A8\u7684\u56FE\u7247\u662F\u5426\u6E05\u6670\u3001\u53EF\u8BFB\u548C\u5B8C\u6574\uFF1F",
|
|
8093
|
-
"dynamicFlows.CameraCapture.reviewRetry": "\u5426\uFF0C\
|
|
8154
|
+
"dynamicFlows.CameraCapture.reviewRetry": "\u5426\uFF0C\u518D\u8BD5\u4E00\u6B21",
|
|
8094
8155
|
"dynamicFlows.CameraCapture.reviewSubmit": "\u662F\uFF0C\u63D0\u4EA4",
|
|
8095
|
-
"dynamicFlows.CameraCapture.rotatePhone.text": "
|
|
8096
|
-
"dynamicFlows.ControlFeedback.maxLength": "\u8BF7\u8F93\u5165 {maxLength} \u4E2A\
|
|
8097
|
-
"dynamicFlows.ControlFeedback.maximum": "\u8BF7\u8F93\u5165\u4E00\u4E2A\u5C0F\u4E8E\u6216\u7B49\u4E8E {maximum} \u7684\u6570\u5B57",
|
|
8156
|
+
"dynamicFlows.CameraCapture.rotatePhone.text": "\u5C06\u624B\u673A\u65CB\u8F6C\u5230\u7EB5\u5411\u89C6\u56FE\u4EE5\u62CD\u7167",
|
|
8157
|
+
"dynamicFlows.ControlFeedback.maxLength": "\u8BF7\u8F93\u5165\u4E0D\u8D85\u8FC7 {maxLength} \u4E2A\u5B57\u7B26\u3002",
|
|
8158
|
+
"dynamicFlows.ControlFeedback.maximum": "\u8BF7\u8F93\u5165\u4E00\u4E2A\u5C0F\u4E8E\u6216\u7B49\u4E8E {maximum} \u7684\u6570\u5B57\u3002",
|
|
8098
8159
|
"dynamicFlows.ControlFeedback.maximumDate": "\u8BF7\u8F93\u5165 {maximum} \u6216\u4E4B\u524D\u7684\u65E5\u671F",
|
|
8099
8160
|
"dynamicFlows.ControlFeedback.minLength": "\u8BF7\u81F3\u5C11\u8F93\u5165 {minLength} \u4E2A\u5B57\u7B26",
|
|
8100
8161
|
"dynamicFlows.ControlFeedback.minimum": "\u8BF7\u8F93\u5165\u4E00\u4E2A\u5927\u4E8E\u6216\u7B49\u4E8E {minimum} \u7684\u6570\u5B57",
|
|
@@ -8102,21 +8163,21 @@ var zh_CN_default = {
|
|
|
8102
8163
|
"dynamicFlows.ControlFeedback.pattern": "\u8BF7\u4EE5\u6B63\u786E\u7684\u683C\u5F0F\u8F93\u5165",
|
|
8103
8164
|
"dynamicFlows.ControlFeedback.patternDate": "\u8BF7\u4EE5\u6B63\u786E\u7684\u683C\u5F0F\u8F93\u5165\u65E5\u671F",
|
|
8104
8165
|
"dynamicFlows.ControlFeedback.required": "\u8BF7\u586B\u5199\u6B64\u5B57\u6BB5\u3002",
|
|
8105
|
-
"dynamicFlows.ControlFeedback.type": "\u7C7B\u578B\
|
|
8166
|
+
"dynamicFlows.ControlFeedback.type": "\u7C7B\u578B\u9519\u8BEF",
|
|
8106
8167
|
"dynamicFlows.DynamicExternal.retryTitle": "\u91CD\u65B0\u6253\u5F00\u7A97\u53E3",
|
|
8107
8168
|
"dynamicFlows.DynamicParagraph.copied": "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
8108
8169
|
"dynamicFlows.DynamicParagraph.copy": "\u590D\u5236",
|
|
8109
|
-
"dynamicFlows.ErrorBoundary.errorAlert": "\u7CDF\u7CD5\u3002\u51FA\
|
|
8170
|
+
"dynamicFlows.ErrorBoundary.errorAlert": "\u7CDF\u7CD5\u3002\u51FA\u9519\u4E86\u2026",
|
|
8110
8171
|
"dynamicFlows.ErrorBoundary.retry": "\u91CD\u8BD5",
|
|
8111
8172
|
"dynamicFlows.ExternalConfirmation.cancel": "\u53D6\u6D88",
|
|
8112
|
-
"dynamicFlows.ExternalConfirmation.description": "
|
|
8113
|
-
"dynamicFlows.ExternalConfirmation.open": "
|
|
8114
|
-
"dynamicFlows.ExternalConfirmation.title": "
|
|
8173
|
+
"dynamicFlows.ExternalConfirmation.description": "\u8BF7\u786E\u8BA4\u60A8\u662F\u5426\u8981\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00**{origin}**\u3002",
|
|
8174
|
+
"dynamicFlows.ExternalConfirmation.open": "\u5728\u65B0\u6807\u7B7E\u9875\u4E2D\u6253\u5F00",
|
|
8175
|
+
"dynamicFlows.ExternalConfirmation.title": "\u8BF7\u786E\u8BA4",
|
|
8115
8176
|
"dynamicFlows.Help.ariaLabel": "\u70B9\u51FB\u6B64\u5904\u83B7\u53D6\u66F4\u591A\u4FE1\u606F\u3002",
|
|
8116
8177
|
"dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "\u62B1\u6B49\uFF0C\u8BE5\u6587\u4EF6\u592A\u5927\u3002\u8BF7\u4E0A\u4F20\u4E00\u4E2A\u66F4\u5C0F\u7684\u6587\u4EF6\u3002",
|
|
8117
|
-
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "\u8BF7\u4E0A\u4F20 {maxItems} \u4E2A\
|
|
8118
|
-
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "\u8BF7\u81F3\u5C11
|
|
8119
|
-
"dynamicFlows.PersistAsyncSchema.genericError": "\u51FA\
|
|
8178
|
+
"dynamicFlows.MultipleFileUploadSchema.maxItemsError": "\u8BF7\u4E0A\u4F20\u4E0D\u8D85\u8FC7 {maxItems} \u4E2A\u6587\u4EF6\u3002",
|
|
8179
|
+
"dynamicFlows.MultipleFileUploadSchema.minItemsError": "\u8BF7\u4E0A\u4F20\u81F3\u5C11 {minItems} \u4E2A\u6587\u4EF6\u3002",
|
|
8180
|
+
"dynamicFlows.PersistAsyncSchema.genericError": "\u51FA\u9519\u4E86\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5\uFF01",
|
|
8120
8181
|
"dynamicFlows.ReadOnlySchema.no": "\u5426",
|
|
8121
8182
|
"dynamicFlows.ReadOnlySchema.yes": "\u662F"
|
|
8122
8183
|
};
|