@wise/dynamic-flow-client 3.5.0-experimental-b041af5 → 3.5.0-experimental-63c768d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/errorBoundary/ErrorBoundary.js +44 -0
- package/build/common/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/common/makeHttpClient/makeHttpClient.spec.js +141 -0
- package/build/common/messages/external-confirmation.messages.js +23 -0
- package/build/i18n/de.json +46 -46
- package/build/i18n/en.json +46 -46
- package/build/i18n/es.json +46 -46
- package/build/i18n/fr.json +46 -46
- package/build/i18n/hu.json +46 -46
- package/build/i18n/id.json +46 -46
- package/build/i18n/index.js +36 -0
- package/build/i18n/it.json +46 -46
- package/build/i18n/ja.json +46 -46
- package/build/i18n/pl.json +46 -46
- package/build/i18n/pt.json +46 -46
- package/build/i18n/ro.json +46 -46
- package/build/i18n/ru.json +46 -46
- package/build/i18n/th.json +46 -46
- package/build/i18n/tr.json +46 -46
- package/build/i18n/zh_CN.json +46 -46
- package/build/i18n/zh_HK.json +46 -46
- package/build/index.js +10 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.spec.js +58 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.spec.js +41 -0
- package/build/legacy/common/contexts/logContext/LogContext.spec.js +54 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.spec.js +59 -0
- package/build/legacy/common/hooks/useExternal/useExternal.spec.js +236 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.spec.js +288 -0
- package/build/legacy/common/utils/debounce.spec.js +72 -0
- package/build/legacy/common/utils/file-utils.spec.js +69 -0
- package/build/legacy/common/utils/id-utils.spec.js +12 -0
- package/build/legacy/common/utils/is-equal.spec.js +88 -0
- package/build/legacy/common/utils/mobile-utils.spec.js +71 -0
- package/build/legacy/common/validators/models/model-utils.spec.js +45 -0
- package/build/legacy/common/validators/models/model-validators.spec.js +647 -0
- package/build/legacy/common/validators/schemas/schema-validators.spec.js +157 -0
- package/build/legacy/common/validators/types/type-validators.spec.js +147 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.spec.js +198 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.spec.js +145 -0
- package/build/legacy/common/validators/values/value-validators.spec.js +22 -0
- package/build/legacy/dynamicFlow/BackButton.js +22 -0
- package/build/legacy/dynamicFlow/DynamicFlow.js +346 -0
- package/build/legacy/dynamicFlow/DynamicFlowStep.js +37 -0
- package/build/legacy/dynamicFlow/DynamicFlowTypes.js +1 -0
- package/build/legacy/dynamicFlow/index.js +1 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/DynamicFlow.story.js +78 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ErrorResponses.story.js +124 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Examples.story.js +25 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Features.story.js +33 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/JsonSchemaForm.story.js +31 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/RefreshOnChange.story.js +194 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/SearchFeature.story.js +114 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ServerTest.story.js +44 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Upload.story.js +212 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ValidationAsync.story.js +156 -0
- package/build/legacy/dynamicFlow/stories/examples/ObjectConst.story.js +150 -0
- package/build/legacy/dynamicFlow/stories/fixtureHttpClient.js +117 -0
- package/build/legacy/dynamicFlow/stories/visual-tests/VisualTests.story.js +43 -0
- package/build/legacy/dynamicFlow/tests/Actions.spec.js +185 -0
- package/build/legacy/dynamicFlow/tests/AllOfSchema.spec.js +196 -0
- package/build/legacy/dynamicFlow/tests/AutocompleteHints.spec.js +59 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.BackButton.spec.js +179 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.search.spec.js +475 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.spec.js +559 -0
- package/build/legacy/dynamicFlow/tests/DynamicImage.spec.js +287 -0
- package/build/legacy/dynamicFlow/tests/DynamicInstructions.spec.js +49 -0
- package/build/legacy/dynamicFlow/tests/HiddenSchemas.spec.js +307 -0
- package/build/legacy/dynamicFlow/tests/ModalLayout.spec.js +252 -0
- package/build/legacy/dynamicFlow/tests/MultiSelect.spec.js +327 -0
- package/build/legacy/dynamicFlow/tests/MultipleFileUploadSchema.spec.js +401 -0
- package/build/legacy/dynamicFlow/tests/ObjectSchema.spec.js +295 -0
- package/build/legacy/dynamicFlow/tests/OneOfSchema.spec.js +773 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.blob-schema.spec.js +331 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.string-schema.spec.js +389 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.debouncing.spec.js +273 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.spec.js +567 -0
- package/build/legacy/dynamicFlow/tests/RepeatableSchema.spec.js +977 -0
- package/build/legacy/dynamicFlow/tests/StepModel.spec.js +119 -0
- package/build/legacy/dynamicFlow/tests/ValidationAsync.spec.js +484 -0
- package/build/legacy/dynamicFlow/tests/ssr.spec.js +47 -0
- package/build/legacy/dynamicFlow/utils/index.js +5 -0
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.js +185 -0
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.spec.js +463 -0
- package/build/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +26 -0
- package/build/legacy/dynamicFlow/utils/useDynamicFlowState.js +137 -0
- package/build/legacy/dynamicFlow/utils/useLoader.js +22 -0
- package/build/legacy/formControl/Select.spec.js +104 -0
- package/build/legacy/formControl/utils/getAutocompleteString.spec.js +30 -0
- package/build/legacy/formControl/utils/value-utils.spec.js +158 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.end-to-end.spec.js +563 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.js +24 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +34 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +134 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +85 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +135 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.spec.js +909 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.js +85 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.rtl.spec.js +55 -0
- package/build/legacy/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/index.js +1 -0
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +77 -0
- package/build/legacy/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +68 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +31 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +54 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.spec.js +312 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.spec.js +231 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +150 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/legacy/layout/button/DynamicButton.spec.js +152 -0
- package/build/legacy/layout/button/utils.spec.js +50 -0
- package/build/legacy/layout/icon/DynamicIcon.spec.js +20 -0
- package/build/legacy/layout/list/DynamicStatusList.spec.js +111 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.spec.js +25 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.spec.js +58 -0
- package/build/legacy/layout/review/DynamicReview.spec.js +152 -0
- package/build/legacy/step/cameraStep/CameraStep.js +124 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +161 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.spec.js +432 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +60 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +80 -0
- package/build/legacy/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +77 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +18 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +109 -0
- package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +107 -0
- package/build/legacy/step/cameraStep/index.js +1 -0
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/legacy/step/externalConfirmationStep/index.js +1 -0
- package/build/legacy/step/index.js +3 -0
- package/build/legacy/test-utils/DynamicFlowProviders.js +19 -0
- package/build/legacy/test-utils/index.js +4 -0
- package/build/legacy/test-utils/legacy-utils.js +69 -0
- package/build/legacy/test-utils/log-utils.js +9 -0
- package/build/main.js +6 -2
- package/build/main.min.js +1 -1
- package/build/main.mjs +6 -2
- package/build/revamp/DynamicFlowCore.js +299 -0
- package/build/revamp/DynamicFlowWise.js +69 -0
- package/build/revamp/DynamicFlowWise.spec.js +105 -0
- package/build/revamp/domain/components/AlertComponent.js +50 -0
- package/build/revamp/domain/components/AllOfComponent.js +72 -0
- package/build/revamp/domain/components/BooleanInputComponent.js +108 -0
- package/build/revamp/domain/components/BoxComponent.js +65 -0
- package/build/revamp/domain/components/ButtonComponent.js +50 -0
- package/build/revamp/domain/components/ColumnsComponent.js +74 -0
- package/build/revamp/domain/components/ConstComponent.js +50 -0
- package/build/revamp/domain/components/ContainerComponent.js +65 -0
- package/build/revamp/domain/components/DateInputComponent.js +127 -0
- package/build/revamp/domain/components/DecisionComponent.js +50 -0
- package/build/revamp/domain/components/DividerComponent.js +50 -0
- package/build/revamp/domain/components/FormComponent.js +65 -0
- package/build/revamp/domain/components/HeadingComponent.js +50 -0
- package/build/revamp/domain/components/ImageComponent.js +50 -0
- package/build/revamp/domain/components/InstructionsComponent.js +50 -0
- package/build/revamp/domain/components/IntegerInputComponent.js +125 -0
- package/build/revamp/domain/components/LoadingIndicatorComponent.js +50 -0
- package/build/revamp/domain/components/MarkdownComponent.js +50 -0
- package/build/revamp/domain/components/ModalComponent.js +65 -0
- package/build/revamp/domain/components/MultiUploadInputComponent.js +190 -0
- package/build/revamp/domain/components/NumberInputComponent.js +125 -0
- package/build/revamp/domain/components/ObjectComponent.js +104 -0
- package/build/revamp/domain/components/ParagraphComponent.js +50 -0
- package/build/revamp/domain/components/ReviewComponent.js +50 -0
- package/build/revamp/domain/components/SelectInputComponent.js +138 -0
- package/build/revamp/domain/components/StatusListComponent.js +50 -0
- package/build/revamp/domain/components/StepDomainComponent.js +93 -0
- package/build/revamp/domain/components/TextInputComponent.js +125 -0
- package/build/revamp/domain/components/UploadInputComponent.js +151 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.js +148 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.spec.js +145 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.js +108 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.spec.js +327 -0
- package/build/revamp/domain/components/utils/component-utils.js +18 -0
- package/build/revamp/domain/components/utils/debounce.js +38 -0
- package/build/revamp/domain/components/utils/debounce.spec.js +72 -0
- package/build/revamp/domain/components/utils/file-utils.js +46 -0
- package/build/revamp/domain/components/utils/getComponentForLocalValueKey.js +31 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.js +40 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +108 -0
- package/build/revamp/domain/features/events.js +1 -0
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.js +133 -0
- package/build/revamp/domain/features/persistAsync/getComponentPersistAsync.spec.js +199 -0
- package/build/revamp/domain/features/persistAsync/getInitialPersistedState.js +6 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.js +103 -0
- package/build/revamp/domain/features/persistAsync/getPerformPersistAsync.spec.js +280 -0
- package/build/revamp/domain/features/refresh/getPerformRefresh.js +53 -0
- package/build/revamp/domain/features/search/getPerformSearchFunction.js +104 -0
- package/build/revamp/domain/features/search/getPerformSearchFunction.spec.js +260 -0
- package/build/revamp/domain/features/summary/summary-utils.js +39 -0
- package/build/revamp/domain/features/summary/summary-utils.spec.js +110 -0
- package/build/revamp/domain/features/utils/http-utils.js +34 -0
- package/build/revamp/domain/features/utils/response-utils.js +9 -0
- package/build/revamp/domain/features/validation/spec-utils.js +16 -0
- package/build/revamp/domain/features/validation/validation-functions.js +12 -0
- package/build/revamp/domain/features/validation/validation-functions.spec.js +110 -0
- package/build/revamp/domain/features/validation/value-checks.js +111 -0
- package/build/revamp/domain/features/validation/value-checks.spec.js +204 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.js +94 -0
- package/build/revamp/domain/features/validationAsync/getComponentValidationAsync.spec.js +177 -0
- package/build/revamp/domain/features/validationAsync/getInitialValidationState.js +5 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.js +107 -0
- package/build/revamp/domain/features/validationAsync/getPerformValidationAsync.spec.js +266 -0
- package/build/revamp/domain/mappers/layout/alertLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/boxLayoutToComponents.js +15 -0
- package/build/revamp/domain/mappers/layout/buttonLayoutToComponent.js +64 -0
- package/build/revamp/domain/mappers/layout/columnsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/decisionLayoutToComponent.js +36 -0
- package/build/revamp/domain/mappers/layout/dividerLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/formLayoutToComponent.js +27 -0
- package/build/revamp/domain/mappers/layout/headingLayoutToComponent.js +13 -0
- package/build/revamp/domain/mappers/layout/imageLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/infoLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/instructionsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/listLayoutToComponent.js +30 -0
- package/build/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/markdownLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/modalLayoutToComponent.js +17 -0
- package/build/revamp/domain/mappers/layout/paragraphLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/reviewLayoutToComponent.js +51 -0
- package/build/revamp/domain/mappers/layout/searchLayoutToComponent.js +14 -0
- package/build/revamp/domain/mappers/layout/statusListLayoutToComponent.js +11 -0
- package/build/revamp/domain/mappers/mapLayoutToComponent.js +63 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.js +84 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.spec.js +197 -0
- package/build/revamp/domain/mappers/mapStepToComponent.js +143 -0
- package/build/revamp/domain/mappers/mapStepToComponent.spec.js +184 -0
- package/build/revamp/domain/mappers/schema/allOfSchemaToComponent.js +29 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.js +63 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.js +65 -0
- package/build/revamp/domain/mappers/schema/blobSchemaToComponent.js +30 -0
- package/build/revamp/domain/mappers/schema/booleanSchemaToComponent.js +38 -0
- package/build/revamp/domain/mappers/schema/constSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/integerSchemaToComponent.js +36 -0
- package/build/revamp/domain/mappers/schema/numberSchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.js +41 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.spec.js +165 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.js +67 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.spec.js +316 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.spec.js +220 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.js +37 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.js +45 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.js +32 -0
- package/build/revamp/domain/mappers/schema/tests/test-utils.js +27 -0
- package/build/revamp/domain/mappers/schema/types.js +1 -0
- package/build/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.js +35 -0
- package/build/revamp/domain/mappers/schema/utils/getValidationAsyncInitialState.js +25 -0
- package/build/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.js +28 -0
- package/build/revamp/domain/mappers/types.js +1 -0
- package/build/revamp/domain/mappers/utils/getAutocompleteString.js +76 -0
- package/build/revamp/domain/mappers/utils/getAutocompleteString.spec.js +21 -0
- package/build/revamp/domain/mappers/utils/getRandomId.js +2 -0
- package/build/revamp/domain/mappers/utils/legacy-utils.js +53 -0
- package/build/revamp/domain/types.js +1 -0
- package/build/revamp/flow/executeRefresh.js +97 -0
- package/build/revamp/flow/executeSubmission.js +152 -0
- package/build/revamp/flow/getResponseType.js +76 -0
- package/build/revamp/flow/response-utils.js +88 -0
- package/build/revamp/renderers/CoreContainerRenderer.js +8 -0
- package/build/revamp/renderers/LoadingContext.js +7 -0
- package/build/revamp/renderers/getRenderFunction.js +55 -0
- package/build/revamp/renderers/getSchemaErrorMessageFunction.js +90 -0
- package/build/revamp/renderers/mappers/alertComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/allOfComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/booleanInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/boxComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/buttonComponentToProps.js +14 -0
- package/build/revamp/renderers/mappers/columnsComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/componentToRendererProps.js +105 -0
- package/build/revamp/renderers/mappers/containerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dateInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/decisionComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dividerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/formComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/headingComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/hiddenComponentToProps.js +3 -0
- package/build/revamp/renderers/mappers/imageComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/instructionsComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/integerInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/loadingIndicatorComponentToProps.js +9 -0
- package/build/revamp/renderers/mappers/markdownComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/modalComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/multiUploadInputComponentToProps.js +24 -0
- package/build/revamp/renderers/mappers/numberInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/objectComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/paragraphComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/repeatableComponentToProps.js +40 -0
- package/build/revamp/renderers/mappers/reviewComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/searchComponentToProps.js +49 -0
- package/build/revamp/renderers/mappers/selectInputComponentToProps.js +29 -0
- package/build/revamp/renderers/mappers/statusListComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/textInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/uploadInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/utils/inputComponentToProps.js +27 -0
- package/build/revamp/renderers/step/ExternalConfirmationDialog.js +31 -0
- package/build/revamp/renderers/step/StepRenderer.js +29 -0
- package/build/revamp/renderers/step/useExternal.js +15 -0
- package/build/revamp/renderers/stepComponentToProps.js +9 -0
- package/build/revamp/renderers/types.js +1 -0
- package/build/revamp/stories/dev-tools/DynamicFlowRevamp.story.js +304 -0
- package/build/revamp/stories/dev-tools/EditableStep.story.js +71 -0
- package/build/revamp/stories/dev-tools/ErrorHandling.story.js +149 -0
- package/build/revamp/stories/dev-tools/External.story.js +83 -0
- package/build/revamp/stories/dev-tools/OneOf.Inititalisation.story.js +123 -0
- package/build/revamp/stories/dev-tools/PersistAsync.story.js +168 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.story.js +309 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.with.PersistAsync.story.js +1004 -0
- package/build/revamp/stories/dev-tools/ServerTest.story.js +81 -0
- package/build/revamp/stories/dev-tools/Upload.story.js +221 -0
- package/build/revamp/stories/dev-tools/ValidationAsync.story.js +161 -0
- package/build/revamp/stories/examples/ObjectConst.story.js +153 -0
- package/build/revamp/stories/examples/OneOfInitialisation.story.js +102 -0
- package/build/revamp/stories/utils/fixtureHttpClient.js +130 -0
- package/build/revamp/stories/utils/mockSearchHandler.js +125 -0
- package/build/revamp/stories/visual-tests/VisualTests.story.js +111 -0
- package/build/revamp/test-utils/component-utils.js +19 -0
- package/build/revamp/test-utils/step-utils.js +6 -0
- package/build/revamp/tests/ImageRenderer.spec.js +108 -0
- package/build/revamp/tests/InitialAction.spec.js +281 -0
- package/build/revamp/tests/InitialStep.spec.js +104 -0
- package/build/revamp/tests/Logging.spec.js +112 -0
- package/build/revamp/tests/OneOfInitialisation.spec.js +654 -0
- package/build/revamp/tests/RefreshOnChange.ResponseHandling.spec.js +322 -0
- package/build/revamp/tests/RefreshOnChange.with.Tabs.spec.js +390 -0
- package/build/revamp/tests/RefreshOnChangePreserve.spec.js +218 -0
- package/build/revamp/tests/Submission.ResponseHandling.spec.js +697 -0
- package/build/revamp/tests/Submission.spec.js +399 -0
- package/build/revamp/tests/legacy/HiddenSchemas.spec.js +312 -0
- package/build/revamp/tests/legacy/MultipleFileUploadSchema.spec.js +447 -0
- package/build/revamp/tests/legacy/PersistAsync.blob-schema.spec.js +339 -0
- package/build/revamp/tests/legacy/PersistAsync.string-schema.spec.js +385 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.debouncing.spec.js +235 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.spec.js +623 -0
- package/build/revamp/tests/legacy/ValidationAsync.spec.js +452 -0
- package/build/revamp/tests/legacy/useExternal.spec.js +235 -0
- package/build/revamp/types.js +1 -0
- package/build/revamp/utils/component-utils.js +86 -0
- package/build/revamp/utils/component-utils.spec.js +385 -0
- package/build/revamp/utils/findComponent.js +29 -0
- package/build/revamp/utils/findComponent.spec.js +92 -0
- package/build/revamp/utils/type-utils.js +56 -0
- package/build/revamp/utils/type-validators.js +16 -0
- package/build/revamp/utils/type-validators.spec.js +163 -0
- package/build/revamp/utils/useStableCallback.js +21 -0
- package/build/revamp/wise/renderers/AlertRenderer.js +11 -0
- package/build/revamp/wise/renderers/BooleanInputRenderer.js +34 -0
- package/build/revamp/wise/renderers/BoxRenderer.js +30 -0
- package/build/revamp/wise/renderers/ButtonRenderer.js +64 -0
- package/build/revamp/wise/renderers/ColumnsRenderer.js +25 -0
- package/build/revamp/wise/renderers/DateInputRenderer.js +35 -0
- package/build/revamp/wise/renderers/DecisionRenderer.js +29 -0
- package/build/revamp/wise/renderers/DividerRenderer.js +10 -0
- package/build/revamp/wise/renderers/FormRenderer.js +21 -0
- package/build/revamp/wise/renderers/FormSectionRenderer.js +16 -0
- package/build/revamp/wise/renderers/HeadingRenderer.js +57 -0
- package/build/revamp/wise/renderers/ImageRenderer.js +111 -0
- package/build/revamp/wise/renderers/InstructionsRenderer.js +34 -0
- package/build/revamp/wise/renderers/IntegerInputRenderer.js +38 -0
- package/build/revamp/wise/renderers/LoadingIndicatorRenderer.js +11 -0
- package/build/revamp/wise/renderers/MarkdownRenderer.js +22 -0
- package/build/revamp/wise/renderers/ModalRenderer.js +25 -0
- package/build/revamp/wise/renderers/MultiUploadInputRenderer.js +74 -0
- package/build/revamp/wise/renderers/NumberInputRenderer.js +38 -0
- package/build/revamp/wise/renderers/ParagraphRenderer.js +44 -0
- package/build/revamp/wise/renderers/RepeatableRenderer.js +58 -0
- package/build/revamp/wise/renderers/ReviewRenderer.js +46 -0
- package/build/revamp/wise/renderers/SearchRenderer.js +63 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/OptionMedia.js +27 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.js +25 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.js +30 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.js +56 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.js +27 -0
- package/build/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.js +33 -0
- package/build/revamp/wise/renderers/StatusListRenderer.js +32 -0
- package/build/revamp/wise/renderers/TextInputRenderer.js +35 -0
- package/build/revamp/wise/renderers/UploadInputRenderer.js +136 -0
- package/build/revamp/wise/renderers/components/FieldInput.js +20 -0
- package/build/revamp/wise/renderers/components/Help.js +21 -0
- package/build/revamp/wise/renderers/components/LabelContentWithHelp.js +6 -0
- package/build/revamp/wise/renderers/components/UploadFieldInput.js +25 -0
- package/build/revamp/wise/renderers/components/VariableDateInput.js +30 -0
- package/build/revamp/wise/renderers/components/VariableTextInput.js +69 -0
- package/build/revamp/wise/renderers/components/icon/DynamicIcon.js +17 -0
- package/build/revamp/wise/renderers/components/icon/FlagIcon.js +198 -0
- package/build/revamp/wise/renderers/components/icon/NamedIcon.js +19 -0
- package/build/revamp/wise/renderers/components/icon/NavigationOptionMedia.js +31 -0
- package/build/revamp/wise/renderers/getWiseRenderers.js +57 -0
- package/build/revamp/wise/renderers/hooks/useSnackBarIfAvailable.js +6 -0
- package/build/revamp/wise/renderers/utils/file-utils.js +70 -0
- package/build/revamp/wise/renderers/utils/getRandomId.js +2 -0
- package/build/revamp/wise/renderers/utils/input-utils.js +6 -0
- package/build/revamp/wise/renderers/utils/layout-utils.js +31 -0
- package/build/revamp/wise/renderers/utils/value-utils.js +23 -0
- package/build/revamp/wise/renderers/utils/value-utils.spec.js +33 -0
- package/build/revamp/wise/renderers/validators/type-validators.js +15 -0
- package/build/test-utils/NeptuneProviders.js +23 -0
- package/build/test-utils/fetch-utils.js +104 -0
- package/build/test-utils/index.js +2 -0
- package/build/test-utils/rtl-utils.js +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { Header, Modal, NavigationOption } from '@transferwise/components';
|
|
23
|
+
import { Plus } from '@transferwise/icons';
|
|
24
|
+
import { useMemo, useState } from 'react';
|
|
25
|
+
import { useIntl } from 'react-intl';
|
|
26
|
+
import { getValidationFailures, isArray, isEmpty, isObject, isValidSchema, } from '../../../../common/validators';
|
|
27
|
+
import { ItemSummaryOption } from './ItemSummary';
|
|
28
|
+
import messages from '../../../../../common/messages/repeatable.messages';
|
|
29
|
+
import RepeatableSchemaStep from './RepeatableSchemaStep';
|
|
30
|
+
import { getItemSummaryFromSchema } from './utils/summary-utils';
|
|
31
|
+
import classNames from 'classnames';
|
|
32
|
+
import ControlFeedback from '../../../controlFeedback';
|
|
33
|
+
import { generateRandomId } from '../../../../common/utils';
|
|
34
|
+
import { useFormattedDefaultErrorMessages } from '../multipleFileUploadSchema/utils';
|
|
35
|
+
function RepeatableSchema(_a) {
|
|
36
|
+
var _b;
|
|
37
|
+
var schema = _a.schema, model = _a.model, errors = _a.errors, submitted = _a.submitted, _c = _a.required, required = _c === void 0 ? false : _c, onChange = _a.onChange;
|
|
38
|
+
var _d = useState(null), openModalType = _d[0], setOpenModalType = _d[1];
|
|
39
|
+
var _e = useState(false), changed = _e[0], setChanged = _e[1];
|
|
40
|
+
var _f = useState(function () {
|
|
41
|
+
if (isObject(model) && !isArray(model)) {
|
|
42
|
+
throw new Error('RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema.');
|
|
43
|
+
}
|
|
44
|
+
return model
|
|
45
|
+
? model.map(function (item) { return getItemSummaryFromSchema(schema.items, item, schema === null || schema === void 0 ? void 0 : schema.summary); })
|
|
46
|
+
: null;
|
|
47
|
+
}), itemSummaries = _f[0], setItemSummaries = _f[1];
|
|
48
|
+
var _g = useState({ item: null, model: null }), editableItem = _g[0], setEditableItem = _g[1];
|
|
49
|
+
var id = useMemo(function () { return schema.$id || generateRandomId(); }, [schema.$id]);
|
|
50
|
+
var broadcastModelChange = function (updatedItems) {
|
|
51
|
+
var updatedModel = updatedItems
|
|
52
|
+
? updatedItems.map(function (_a) {
|
|
53
|
+
var value = _a.value;
|
|
54
|
+
return value;
|
|
55
|
+
})
|
|
56
|
+
: null;
|
|
57
|
+
onChange({
|
|
58
|
+
model: updatedModel,
|
|
59
|
+
triggerSchema: schema.items,
|
|
60
|
+
triggerModel: updatedModel
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
var onAddItem = function () {
|
|
64
|
+
setOpenModalType('add');
|
|
65
|
+
};
|
|
66
|
+
var onEditItem = function (item) {
|
|
67
|
+
setEditableItem({ item: item, model: item.value });
|
|
68
|
+
setOpenModalType('edit');
|
|
69
|
+
};
|
|
70
|
+
var onSaveItem = function (action, summaryTextOverride) {
|
|
71
|
+
var _a;
|
|
72
|
+
setChanged(true);
|
|
73
|
+
var updatedItem = action === 'remove'
|
|
74
|
+
? null
|
|
75
|
+
: getItemSummaryFromSchema(schema.items, editableItem.model, schema.summary, summaryTextOverride);
|
|
76
|
+
if (action !== 'remove' && !isValidSchema((_a = updatedItem === null || updatedItem === void 0 ? void 0 : updatedItem.value) !== null && _a !== void 0 ? _a : null, schema.items)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
var updatedItemSummaries = getUpdatedItemSummaries(action, {
|
|
80
|
+
originalItem: editableItem.item,
|
|
81
|
+
updatedItem: updatedItem,
|
|
82
|
+
itemSummaries: itemSummaries
|
|
83
|
+
});
|
|
84
|
+
setItemSummaries(updatedItemSummaries);
|
|
85
|
+
broadcastModelChange(updatedItemSummaries);
|
|
86
|
+
setEditableItem({ item: null, model: null });
|
|
87
|
+
setOpenModalType(null);
|
|
88
|
+
};
|
|
89
|
+
var onCancelEdit = function () {
|
|
90
|
+
setEditableItem({ item: null, model: null });
|
|
91
|
+
setOpenModalType(null);
|
|
92
|
+
};
|
|
93
|
+
var formatMessage = useIntl().formatMessage;
|
|
94
|
+
var validations = getValidationFailures(model, schema, required);
|
|
95
|
+
var base64ValidationMessages = useFormattedDefaultErrorMessages({
|
|
96
|
+
minItems: schema.minItems,
|
|
97
|
+
maxItems: schema.maxItems
|
|
98
|
+
});
|
|
99
|
+
var validationMessages = schema.items.type === 'string' && schema.items.format === 'base64url'
|
|
100
|
+
? {
|
|
101
|
+
minItems: base64ValidationMessages.minItemsErrorMessage,
|
|
102
|
+
maxItems: base64ValidationMessages.maxItemsErrorMessage,
|
|
103
|
+
required: base64ValidationMessages.requiredMessage
|
|
104
|
+
}
|
|
105
|
+
: undefined;
|
|
106
|
+
var formGroupClasses = {
|
|
107
|
+
'has-error': (_b = (errors && !isEmpty(errors))) !== null && _b !== void 0 ? _b : (submitted && validations.length)
|
|
108
|
+
};
|
|
109
|
+
return (_jsxs("div", __assign({ id: id, className: classNames(formGroupClasses) }, { children: [schema.title && _jsx(Header, { title: schema.title }), itemSummaries === null || itemSummaries === void 0 ? void 0 : itemSummaries.map(function (itemSummary) { return (_jsx(ItemSummaryOption, { item: itemSummary, onClick: function () { return onEditItem(itemSummary); } }, JSON.stringify(itemSummary))); }), _jsx(NavigationOption, { media: _jsx(Plus, {}), title: schema.addItemTitle || formatMessage(messages.addItemTitle), showMediaAtAllSizes: true, onClick: onAddItem }), _jsx(Modal, { open: openModalType !== null, title: (openModalType === 'add' ? schema.addItemTitle : schema.editItemTitle) ||
|
|
110
|
+
formatMessage(messages.addItemTitle), body: _jsx(RepeatableSchemaStep, { type: openModalType !== null && openModalType !== void 0 ? openModalType : 'add', schema: schema, model: editableItem.model, errors: errors, submitted: submitted, onAction: onSaveItem, onModelChange: function (_a) {
|
|
111
|
+
var model = _a.model;
|
|
112
|
+
return setEditableItem(__assign(__assign({}, editableItem), { model: model }));
|
|
113
|
+
} }), onClose: onCancelEdit }), _jsx(ControlFeedback, { id: "".concat(id, "-feedback"), changed: changed, focused: false, blurred: false, errors: typeof errors === 'string' ? errors : undefined, submitted: submitted, schema: schema, validations: validations, validationMessages: validationMessages, infoMessage: null })] })));
|
|
114
|
+
}
|
|
115
|
+
var getUpdatedItemSummaries = function (action, _a) {
|
|
116
|
+
var originalItem = _a.originalItem, updatedItem = _a.updatedItem, itemSummaries = _a.itemSummaries;
|
|
117
|
+
if (action === 'remove') {
|
|
118
|
+
return (itemSummaries || []).filter(function (itemSummary) { return itemSummary !== originalItem; });
|
|
119
|
+
}
|
|
120
|
+
if (!updatedItem) {
|
|
121
|
+
return itemSummaries;
|
|
122
|
+
}
|
|
123
|
+
switch (action) {
|
|
124
|
+
case 'add':
|
|
125
|
+
return __spreadArray(__spreadArray([], (itemSummaries || []), true), [updatedItem], false);
|
|
126
|
+
case 'edit':
|
|
127
|
+
return (itemSummaries || []).map(function (itemSummary) {
|
|
128
|
+
return itemSummary === originalItem ? updatedItem : itemSummary;
|
|
129
|
+
});
|
|
130
|
+
default:
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
export default RepeatableSchema;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
32
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
33
|
+
import { useState } from 'react';
|
|
34
|
+
import { useIntl } from 'react-intl';
|
|
35
|
+
import { DynamicFlowStep } from '../../../../dynamicFlow/DynamicFlowStep';
|
|
36
|
+
import messages from '../../../../../common/messages/repeatable.messages';
|
|
37
|
+
function RepeatableSchemaStep(_a) {
|
|
38
|
+
var type = _a.type, schema = _a.schema, model = _a.model, errors = _a.errors, submitted = _a.submitted, onModelChange = _a.onModelChange, onAction = _a.onAction;
|
|
39
|
+
var formatMessage = useIntl().formatMessage;
|
|
40
|
+
var _b = useState(undefined), filename = _b[0], setFilename = _b[1];
|
|
41
|
+
var step = {
|
|
42
|
+
layout: __spreadArray([
|
|
43
|
+
{
|
|
44
|
+
type: 'form',
|
|
45
|
+
schema: schema.items
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'button',
|
|
49
|
+
control: 'primary',
|
|
50
|
+
action: {
|
|
51
|
+
url: type,
|
|
52
|
+
title: formatMessage(type === 'add' ? messages.addItem : messages.editItem)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
], (type === 'edit'
|
|
56
|
+
? [
|
|
57
|
+
{
|
|
58
|
+
type: 'button',
|
|
59
|
+
context: 'negative',
|
|
60
|
+
action: {
|
|
61
|
+
url: 'remove',
|
|
62
|
+
title: formatMessage(messages.removeItem)
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
]
|
|
66
|
+
: []), true),
|
|
67
|
+
title: '',
|
|
68
|
+
actions: [],
|
|
69
|
+
schemas: []
|
|
70
|
+
};
|
|
71
|
+
var onChange = function (props) {
|
|
72
|
+
var metadata = props.metadata, model = props.model, modelChangeProps = __rest(props, ["metadata", "model"]);
|
|
73
|
+
if (schema.items.format === 'base64url' &&
|
|
74
|
+
typeof model === 'string' &&
|
|
75
|
+
typeof (metadata === null || metadata === void 0 ? void 0 : metadata.filename) === 'string') {
|
|
76
|
+
setFilename(metadata.filename);
|
|
77
|
+
}
|
|
78
|
+
onModelChange(__assign(__assign({}, modelChangeProps), { model: model }));
|
|
79
|
+
};
|
|
80
|
+
return (_jsx(DynamicFlowStep, { step: step, model: model, stepLayoutOptions: { displayStepTitle: false }, submitted: submitted, formErrors: errors, globalError: null, onAction: function (action) {
|
|
81
|
+
onAction(action.url, filename);
|
|
82
|
+
setFilename(undefined);
|
|
83
|
+
}, onModelChange: onChange }));
|
|
84
|
+
}
|
|
85
|
+
export default RepeatableSchemaStep;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { getSchemaType, isConstSchema, isNullableStringModel, isObjectModel, isOneOfObjectSchema, } from '../../../../../common/utils';
|
|
13
|
+
import { isString } from '../../../../../common/validators';
|
|
14
|
+
import { getActiveSchemaIndex, getBestMatchingSchemaIndexForValue, } from '../../../../oneOfSchema/utils';
|
|
15
|
+
export var getItemSummaryFromSchema = function (schema, model, defaults, summaryTextOverride) {
|
|
16
|
+
if (defaults === void 0) { defaults = {}; }
|
|
17
|
+
var _a = defaults.defaultTitle, defaultTitle = _a === void 0 ? '' : _a, _b = defaults.defaultDescription, defaultDescription = _b === void 0 ? '' : _b, defaultIcon = defaults.defaultIcon, defaultImage = defaults.defaultImage;
|
|
18
|
+
var title = getSummaryPropFromSchema({
|
|
19
|
+
schema: schema,
|
|
20
|
+
model: model,
|
|
21
|
+
providesProp: 'providesTitle',
|
|
22
|
+
getValueFromSchema: function (schema, model) {
|
|
23
|
+
return summaryTextOverride !== null && summaryTextOverride !== void 0 ? summaryTextOverride : getStringValueFromSchema(schema, model);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
var description = getSummaryPropFromSchema({
|
|
27
|
+
schema: schema,
|
|
28
|
+
model: model,
|
|
29
|
+
providesProp: 'providesDescription',
|
|
30
|
+
getValueFromSchema: function (schema, model) {
|
|
31
|
+
return summaryTextOverride !== null && summaryTextOverride !== void 0 ? summaryTextOverride : getStringValueFromSchema(schema, model);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var icon = getSummaryPropFromSchema({
|
|
35
|
+
schema: schema,
|
|
36
|
+
model: model,
|
|
37
|
+
providesProp: 'providesIcon',
|
|
38
|
+
getValueFromSchema: function (schema) { var _a; return (_a = schema.icon) !== null && _a !== void 0 ? _a : null; }
|
|
39
|
+
});
|
|
40
|
+
var image = getSummaryPropFromSchema({
|
|
41
|
+
schema: schema,
|
|
42
|
+
model: model,
|
|
43
|
+
providesProp: 'providesImage',
|
|
44
|
+
getValueFromSchema: function (schema) { var _a; return (_a = schema.image) !== null && _a !== void 0 ? _a : null; }
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
value: model,
|
|
48
|
+
title: title || defaultTitle,
|
|
49
|
+
description: description || defaultDescription,
|
|
50
|
+
icon: icon || defaultIcon,
|
|
51
|
+
image: image || defaultImage
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
var getSummaryPropFromSchema = function (props) {
|
|
55
|
+
var schema = props.schema, model = props.model, providesProp = props.providesProp, getValueFromSchema = props.getValueFromSchema;
|
|
56
|
+
var type = getSchemaType(schema);
|
|
57
|
+
if (schemaSummaryProvides(schema.summary, providesProp)) {
|
|
58
|
+
return getValueFromSchema(schema, model);
|
|
59
|
+
}
|
|
60
|
+
switch (type) {
|
|
61
|
+
case 'object': {
|
|
62
|
+
return getObjectValueFromSchema(props);
|
|
63
|
+
}
|
|
64
|
+
case 'oneOf': {
|
|
65
|
+
return getOneOfValueFromSchema(props);
|
|
66
|
+
}
|
|
67
|
+
case 'allOf': {
|
|
68
|
+
return getAllOfValueFromSchema(props);
|
|
69
|
+
}
|
|
70
|
+
default:
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
var getObjectValueFromSchema = function (props) {
|
|
75
|
+
var schema = props.schema, model = props.model;
|
|
76
|
+
var objectSchema = schema;
|
|
77
|
+
// eslint-disable-next-line guard-for-in, no-restricted-syntax
|
|
78
|
+
for (var propertyKey in objectSchema.properties) {
|
|
79
|
+
var propertySchema = objectSchema.properties[propertyKey];
|
|
80
|
+
var propertyModel = isObjectModel(model) && propertyKey in model ? model[propertyKey] : null;
|
|
81
|
+
var result = getSummaryPropFromSchema(__assign(__assign({}, props), { schema: propertySchema, model: propertyModel }));
|
|
82
|
+
if (result) {
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
};
|
|
88
|
+
var getOneOfValueFromSchema = function (props) {
|
|
89
|
+
var schema = props.schema, model = props.model;
|
|
90
|
+
if (isOneOfObjectSchema(schema)) {
|
|
91
|
+
if (!isObjectModel(model)) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
var activeSchemaIndex_1 = getBestMatchingSchemaIndexForValue(schema, model);
|
|
95
|
+
if (activeSchemaIndex_1 === null || activeSchemaIndex_1 < 0) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
var activeSchema = schema.oneOf[activeSchemaIndex_1];
|
|
99
|
+
return getSummaryPropFromSchema(__assign(__assign({}, props), { schema: activeSchema }));
|
|
100
|
+
}
|
|
101
|
+
var oneOfSchema = schema;
|
|
102
|
+
var activeSchemaIndex = getActiveSchemaIndex(oneOfSchema, model);
|
|
103
|
+
if (activeSchemaIndex === null || activeSchemaIndex < 0) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return getSummaryPropFromSchema(__assign(__assign({}, props), { schema: oneOfSchema.oneOf[activeSchemaIndex] }));
|
|
107
|
+
};
|
|
108
|
+
var getAllOfValueFromSchema = function (props) {
|
|
109
|
+
var schema = props.schema;
|
|
110
|
+
var allOfSchema = schema;
|
|
111
|
+
for (var _i = 0, _a = allOfSchema.allOf; _i < _a.length; _i++) {
|
|
112
|
+
var childSchema = _a[_i];
|
|
113
|
+
var result = getSummaryPropFromSchema(__assign(__assign({}, props), { schema: childSchema }));
|
|
114
|
+
if (result) {
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
};
|
|
120
|
+
var getStringValueFromSchema = function (schema, model) {
|
|
121
|
+
if (isConstSchema(schema)) {
|
|
122
|
+
if (schema.title) {
|
|
123
|
+
return schema.title;
|
|
124
|
+
}
|
|
125
|
+
if (isString(schema["const"])) {
|
|
126
|
+
return schema["const"];
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
return isNullableStringModel(model) ? model : null;
|
|
131
|
+
};
|
|
132
|
+
var schemaSummaryProvides = function (summary, providesProp) {
|
|
133
|
+
// eslint-disable-next-line prefer-object-has-own, no-implicit-coercion
|
|
134
|
+
return !!summary && Object.hasOwnProperty.call(summary, providesProp) && Boolean(summary[providesProp]);
|
|
135
|
+
};
|