@wise/dynamic-flow-client 3.2.1 → 3.2.2-short-962e290
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/errorBoundary/ErrorBoundary.js +44 -0
- package/build/common/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/common/httpClientContext/HttpClientContext.js +35 -0
- package/build/common/httpClientContext/index.js +1 -0
- package/build/common/makeHttpClient/index.js +1 -0
- package/build/common/makeHttpClient/makeHttpClient.js +34 -0
- package/build/common/makeHttpClient/makeHttpClient.spec.js +141 -0
- package/build/common/messages/generic-error.messages.js +18 -0
- package/build/common/messages/help.messages.js +8 -0
- package/build/common/messages/multi-file-upload.messages.js +18 -0
- package/build/common/messages/paragraph.messages.js +13 -0
- package/build/common/messages/repeatable.messages.js +23 -0
- package/build/common/messages/validation.array.messages.js +13 -0
- package/build/common/messages/validation.messages.js +53 -0
- package/build/common/utils/api-utils.js +4 -0
- package/build/i18n/index.js +36 -0
- package/build/index.js +10 -0
- package/build/legacy/common/constants/DateMode.js +4 -0
- package/build/legacy/common/constants/FeatureName.js +4 -0
- package/build/legacy/common/constants/FormControlType.js +21 -0
- package/build/legacy/common/constants/MonthFormat.js +4 -0
- package/build/legacy/common/constants/Size.js +7 -0
- package/build/legacy/common/constants/index.js +4 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
- package/build/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.js +38 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.spec.js +58 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.js +22 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.spec.js +41 -0
- package/build/legacy/common/contexts/index.js +3 -0
- package/build/legacy/common/contexts/logContext/LogContext.js +44 -0
- package/build/legacy/common/contexts/logContext/LogContext.spec.js +54 -0
- package/build/legacy/common/hooks/index.js +7 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.spec.js +59 -0
- package/build/legacy/common/hooks/useExternal/useExternal.js +15 -0
- package/build/legacy/common/hooks/useExternal/useExternal.spec.js +226 -0
- package/build/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.js +70 -0
- package/build/legacy/common/hooks/usePersistAsync/usePersistAsync.js +172 -0
- package/build/legacy/common/hooks/usePolling/usePolling.js +51 -0
- package/build/legacy/common/hooks/usePrevious/usePrevious.js +8 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.js +43 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.spec.js +288 -0
- package/build/legacy/common/messages.js +8 -0
- package/build/legacy/common/utils/api-utils.js +6 -0
- package/build/legacy/common/utils/date-utils.js +22 -0
- package/build/legacy/common/utils/debounce.js +38 -0
- package/build/legacy/common/utils/debounce.spec.js +72 -0
- package/build/legacy/common/utils/file-utils.js +45 -0
- package/build/legacy/common/utils/file-utils.spec.js +69 -0
- package/build/legacy/common/utils/id-utils.js +5 -0
- package/build/legacy/common/utils/id-utils.spec.js +12 -0
- package/build/legacy/common/utils/index.js +11 -0
- package/build/legacy/common/utils/is-equal.js +21 -0
- package/build/legacy/common/utils/is-equal.spec.js +88 -0
- package/build/legacy/common/utils/misc-utils.js +4 -0
- package/build/legacy/common/utils/mobile-utils.js +23 -0
- package/build/legacy/common/utils/mobile-utils.spec.js +71 -0
- package/build/legacy/common/utils/model-utils.js +33 -0
- package/build/legacy/common/utils/schema-utils.js +97 -0
- package/build/legacy/common/utils/step-utils.js +32 -0
- package/build/legacy/common/validators/index.js +5 -0
- package/build/legacy/common/validators/models/model-utils.js +119 -0
- package/build/legacy/common/validators/models/model-utils.spec.js +45 -0
- package/build/legacy/common/validators/models/model-validators.js +62 -0
- package/build/legacy/common/validators/models/model-validators.spec.js +647 -0
- package/build/legacy/common/validators/schemas/schema-validators.js +101 -0
- package/build/legacy/common/validators/schemas/schema-validators.spec.js +157 -0
- package/build/legacy/common/validators/types/type-validators.js +14 -0
- package/build/legacy/common/validators/types/type-validators.spec.js +147 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.js +139 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.spec.js +198 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.js +40 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.spec.js +145 -0
- package/build/legacy/common/validators/values/value-validators.js +6 -0
- package/build/legacy/common/validators/values/value-validators.spec.js +22 -0
- package/build/legacy/dynamic-flow-types.js +1 -0
- package/build/legacy/dynamicFlow/BackButton.js +22 -0
- package/build/legacy/dynamicFlow/DynamicFlow.js +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 +32 -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/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/FormControl.js +268 -0
- package/build/legacy/formControl/Select.spec.js +104 -0
- package/build/legacy/formControl/index.js +1 -0
- package/build/legacy/formControl/utils/getAutocompleteString.js +73 -0
- package/build/legacy/formControl/utils/getAutocompleteString.spec.js +20 -0
- package/build/legacy/formControl/utils/index.js +2 -0
- package/build/legacy/formControl/utils/value-utils.js +108 -0
- package/build/legacy/formControl/utils/value-utils.spec.js +158 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.end-to-end.spec.js +563 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.js +24 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.js +50 -0
- package/build/legacy/jsonSchemaForm/allOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +30 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +79 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.js +7 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.js +134 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.js +85 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.js +135 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.spec.js +909 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +111 -0
- package/build/legacy/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.js +86 -0
- package/build/legacy/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.js +85 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.rtl.spec.js +55 -0
- package/build/legacy/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/help/Help.js +20 -0
- package/build/legacy/jsonSchemaForm/help/index.js +1 -0
- package/build/legacy/jsonSchemaForm/index.js +1 -0
- package/build/legacy/jsonSchemaForm/objectSchema/ObjectSchema.js +77 -0
- package/build/legacy/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/oneOfSchema/utils.js +68 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +31 -0
- package/build/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
- package/build/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +54 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/legacy/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +133 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.spec.js +312 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +107 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.spec.js +231 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +150 -0
- package/build/legacy/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/legacy/layout/DynamicLayout.js +68 -0
- package/build/legacy/layout/alert/DynamicAlert.js +29 -0
- package/build/legacy/layout/box/DynamicBox.js +41 -0
- package/build/legacy/layout/button/DynamicButton.js +27 -0
- package/build/legacy/layout/button/DynamicButton.spec.js +152 -0
- package/build/legacy/layout/button/utils.js +45 -0
- package/build/legacy/layout/button/utils.spec.js +50 -0
- package/build/legacy/layout/columns/DynamicColumns.js +38 -0
- package/build/legacy/layout/decision/DynamicDecision.js +21 -0
- package/build/legacy/layout/divider/DynamicDivider.js +9 -0
- package/build/legacy/layout/external/DynamicExternal.js +32 -0
- package/build/legacy/layout/external/DynamicExternal.messages.js +8 -0
- package/build/legacy/layout/form/DynamicForm.js +22 -0
- package/build/legacy/layout/heading/DynamicHeading.js +51 -0
- package/build/legacy/layout/icon/DynamicIcon.js +17 -0
- package/build/legacy/layout/icon/DynamicIcon.spec.js +20 -0
- package/build/legacy/layout/icon/FlagIcon.js +198 -0
- package/build/legacy/layout/icon/NamedIcon.js +19 -0
- package/build/legacy/layout/image/DynamicImage.js +111 -0
- package/build/legacy/layout/index.js +20 -0
- package/build/legacy/layout/instructions/DynamicInstructions.js +30 -0
- package/build/legacy/layout/list/DynamicStatusList.js +37 -0
- package/build/legacy/layout/list/DynamicStatusList.spec.js +111 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.spec.js +25 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.js +23 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.spec.js +58 -0
- package/build/legacy/layout/modal/DynamicModal.js +26 -0
- package/build/legacy/layout/paragraph/DynamicParagraph.js +46 -0
- package/build/legacy/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/legacy/layout/review/DynamicReview.js +58 -0
- package/build/legacy/layout/review/DynamicReview.spec.js +152 -0
- package/build/legacy/layout/search/DynamicSearch.js +58 -0
- package/build/legacy/layout/search/SearchInput.js +17 -0
- package/build/legacy/layout/search/SearchResults.js +31 -0
- package/build/legacy/layout/search/useSearch.js +137 -0
- package/build/legacy/layout/utils/getNavigationOptionMedia.js +28 -0
- package/build/legacy/layout/utils/index.js +32 -0
- package/build/legacy/step/cameraStep/CameraStep.js +124 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.js +161 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.js +58 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.js +28 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/index.js +3 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.js +19 -0
- package/build/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.js +8 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.js +60 -0
- package/build/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.js +80 -0
- package/build/legacy/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/overlay/Overlay.js +77 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.js +18 -0
- package/build/legacy/step/cameraStep/cameraCapture/screens/index.js +1 -0
- package/build/legacy/step/cameraStep/cameraCapture/tracking/index.js +109 -0
- package/build/legacy/step/cameraStep/cameraCapture/types/index.js +7 -0
- package/build/legacy/step/cameraStep/cameraCapture/utils/index.js +107 -0
- package/build/legacy/step/cameraStep/index.js +1 -0
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/legacy/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
- package/build/legacy/step/externalConfirmationStep/index.js +1 -0
- package/build/legacy/step/index.js +3 -0
- package/build/legacy/step/layoutStep/LayoutStep.js +33 -0
- package/build/legacy/step/layoutStep/index.js +1 -0
- package/build/legacy/step/layoutStep/utils/index.js +2 -0
- package/build/legacy/step/layoutStep/utils/inline-reference-utils.js +105 -0
- package/build/legacy/step/layoutStep/utils/layout-utils.js +212 -0
- package/build/legacy/test-utils/DynamicFlowProviders.js +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/revamp/DynamicFlowCore.js +259 -0
- package/build/revamp/DynamicFlowWise.js +69 -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 +72 -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/isPartialLocalValueMatch.js +38 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +108 -0
- package/build/revamp/domain/features/events/getAnalyticsEventDispatcher.js +25 -0
- package/build/revamp/domain/features/events/getLogggingEventDispatcher.js +11 -0
- package/build/revamp/domain/features/events/index.js +2 -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 +26 -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 +57 -0
- package/build/revamp/domain/mappers/mapStepToComponent.spec.js +177 -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/StepRenderer.js +23 -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/stepComponentToProps.js +8 -0
- package/build/revamp/renderers/types.js +1 -0
- package/build/revamp/step/Step.js +162 -0
- package/build/revamp/step/utils/getRenderFunction.js +55 -0
- package/build/revamp/step/utils/getSchemaErrorMessageFunction.js +90 -0
- package/build/revamp/stories/utils/mockSearchHandler.js +125 -0
- package/build/revamp/test-utils/component-utils.js +19 -0
- package/build/revamp/test-utils/step-utils.js +6 -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/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 +2 -2
package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.spec.js
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { getMockMapperProps, getMockSchemaMapperProps, mockUpdateFunction, } from '../tests/test-utils';
|
|
38
|
+
import { stringSchemaToComponent } from './stringSchemaToComponent';
|
|
39
|
+
jest.mock('../../../components/utils/component-utils', function () { return ({
|
|
40
|
+
getInputUpdateFunction: jest.fn().mockImplementation(function () { return jest.fn(); })
|
|
41
|
+
}); });
|
|
42
|
+
describe('stringSchemaToComponent', function () {
|
|
43
|
+
var defaultMapperProps = getMockMapperProps();
|
|
44
|
+
describe('initial model handling', function () {
|
|
45
|
+
describe('when initial model is null', function () {
|
|
46
|
+
it('sets component value to null', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var schemaMapperProps, component, _a;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
schemaMapperProps = getMockSchemaMapperProps({
|
|
52
|
+
schema: {
|
|
53
|
+
type: 'string'
|
|
54
|
+
},
|
|
55
|
+
model: null
|
|
56
|
+
});
|
|
57
|
+
component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
58
|
+
_a = expect;
|
|
59
|
+
return [4 /*yield*/, component.getSubmittableValue()];
|
|
60
|
+
case 1:
|
|
61
|
+
_a.apply(void 0, [_b.sent()]).toBeNull();
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}); });
|
|
66
|
+
describe('when a default is provided', function () {
|
|
67
|
+
it('initialises the value to the default', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var schemaMapperProps, component, _a;
|
|
69
|
+
return __generator(this, function (_b) {
|
|
70
|
+
switch (_b.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
schemaMapperProps = getMockSchemaMapperProps({
|
|
73
|
+
schema: {
|
|
74
|
+
type: 'string',
|
|
75
|
+
"default": 'John Smith'
|
|
76
|
+
},
|
|
77
|
+
model: null
|
|
78
|
+
});
|
|
79
|
+
component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
80
|
+
_a = expect;
|
|
81
|
+
return [4 /*yield*/, component.getSubmittableValue()];
|
|
82
|
+
case 1:
|
|
83
|
+
_a.apply(void 0, [_b.sent()]).toBe('John Smith');
|
|
84
|
+
return [2 /*return*/];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}); });
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
describe('when initial model is defined', function () {
|
|
91
|
+
it('sets the component value to the initial model', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
92
|
+
var schemaMapperProps, component, _a;
|
|
93
|
+
return __generator(this, function (_b) {
|
|
94
|
+
switch (_b.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
schemaMapperProps = getMockSchemaMapperProps({
|
|
97
|
+
schema: {
|
|
98
|
+
type: 'string'
|
|
99
|
+
},
|
|
100
|
+
model: 'John Smith'
|
|
101
|
+
});
|
|
102
|
+
component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
103
|
+
_a = expect;
|
|
104
|
+
return [4 /*yield*/, component.getSubmittableValue()];
|
|
105
|
+
case 1:
|
|
106
|
+
_a.apply(void 0, [_b.sent()]).toBe('John Smith');
|
|
107
|
+
return [2 /*return*/];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}); });
|
|
111
|
+
describe('when a default is provided', function () {
|
|
112
|
+
it('prefers the model over the default', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
|
+
var schemaMapperProps, component, _a;
|
|
114
|
+
return __generator(this, function (_b) {
|
|
115
|
+
switch (_b.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
schemaMapperProps = getMockSchemaMapperProps({
|
|
118
|
+
schema: {
|
|
119
|
+
type: 'string',
|
|
120
|
+
"default": 'Jane Doe'
|
|
121
|
+
},
|
|
122
|
+
model: 'John Smith'
|
|
123
|
+
});
|
|
124
|
+
component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
125
|
+
_a = expect;
|
|
126
|
+
return [4 /*yield*/, component.getSubmittableValue()];
|
|
127
|
+
case 1:
|
|
128
|
+
_a.apply(void 0, [_b.sent()]).toBe('John Smith');
|
|
129
|
+
return [2 /*return*/];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}); });
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('initial validation error handling', function () {
|
|
137
|
+
it('sets the initial error if provided', function () {
|
|
138
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
139
|
+
schema: {
|
|
140
|
+
type: 'string'
|
|
141
|
+
},
|
|
142
|
+
model: 'jane@doe.com',
|
|
143
|
+
validationErrors: 'An account with this email already exists'
|
|
144
|
+
});
|
|
145
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
146
|
+
expect(component.errors).toStrictEqual(['An account with this email already exists']);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
describe('autocomplete', function () {
|
|
150
|
+
it('sets the autocomplete value', function () {
|
|
151
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
152
|
+
schema: {
|
|
153
|
+
type: 'string',
|
|
154
|
+
autocompleteHint: ['name', 'shipping']
|
|
155
|
+
},
|
|
156
|
+
model: 'John Smith'
|
|
157
|
+
});
|
|
158
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
159
|
+
expect(component.autoComplete).toBe('name shipping');
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
describe('validation checks', function () {
|
|
163
|
+
it('sets minimum length validation', function () {
|
|
164
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
165
|
+
schema: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
minLength: 10
|
|
168
|
+
},
|
|
169
|
+
model: 'Jane'
|
|
170
|
+
});
|
|
171
|
+
var draftComponent = {};
|
|
172
|
+
mockUpdateFunction(draftComponent);
|
|
173
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
174
|
+
expect(component.validate()).toBe(false);
|
|
175
|
+
expect(draftComponent.errors).toStrictEqual(['minLength']);
|
|
176
|
+
});
|
|
177
|
+
it('sets maximum length validation', function () {
|
|
178
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
179
|
+
schema: {
|
|
180
|
+
type: 'string',
|
|
181
|
+
maxLength: 2
|
|
182
|
+
},
|
|
183
|
+
model: 'Jane'
|
|
184
|
+
});
|
|
185
|
+
var draftComponent = {};
|
|
186
|
+
mockUpdateFunction(draftComponent);
|
|
187
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
188
|
+
expect(component.validate()).toBe(false);
|
|
189
|
+
expect(draftComponent.errors).toStrictEqual(['maxLength']);
|
|
190
|
+
});
|
|
191
|
+
it('sets pattern validation', function () {
|
|
192
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
193
|
+
schema: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
pattern: '^[a-zA-Z]*$'
|
|
196
|
+
},
|
|
197
|
+
model: '012345'
|
|
198
|
+
});
|
|
199
|
+
var draftComponent = {};
|
|
200
|
+
mockUpdateFunction(draftComponent);
|
|
201
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
202
|
+
expect(component.validate()).toBe(false);
|
|
203
|
+
expect(draftComponent.errors).toStrictEqual(['pattern']);
|
|
204
|
+
});
|
|
205
|
+
it('sets required validation', function () {
|
|
206
|
+
var schemaMapperProps = getMockSchemaMapperProps({
|
|
207
|
+
schema: {
|
|
208
|
+
type: 'string'
|
|
209
|
+
},
|
|
210
|
+
model: null,
|
|
211
|
+
required: true
|
|
212
|
+
});
|
|
213
|
+
var draftComponent = {};
|
|
214
|
+
mockUpdateFunction(draftComponent);
|
|
215
|
+
var component = stringSchemaToComponent(schemaMapperProps, defaultMapperProps);
|
|
216
|
+
expect(component.validate()).toBe(false);
|
|
217
|
+
expect(draftComponent.errors).toStrictEqual(['required']);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
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 { isString } from '../../../../utils/type-validators';
|
|
13
|
+
import { createDateInputComponent } from '../../../components/DateInputComponent';
|
|
14
|
+
import { getPerformRefresh } from '../../../features/refresh/getPerformRefresh';
|
|
15
|
+
import { getAboveMaximumDateCheck, getBelowMinimumDateCheck, getRequiredCheck, } from '../../../features/validation/value-checks';
|
|
16
|
+
import { getAutocompleteString } from '../../utils/getAutocompleteString';
|
|
17
|
+
import { getPersistAsyncInitialState } from '../utils/getPersistAsyncInitialState';
|
|
18
|
+
import { mapCommonSchemaProps } from '../utils/mapCommonSchemaProps';
|
|
19
|
+
import { getValidationAsyncInitialState } from '../utils/getValidationAsyncInitialState';
|
|
20
|
+
export var stringSchemaToDateInputComponent = function (schemaMapperProps, mapperProps) {
|
|
21
|
+
var schema = schemaMapperProps.schema, localValue = schemaMapperProps.localValue, model = schemaMapperProps.model, _a = schemaMapperProps.required, required = _a === void 0 ? false : _a;
|
|
22
|
+
var autocompleteHint = schema.autocompleteHint, defaultValue = schema["default"], minimumDate = schema.minimum, maximumDate = schema.maximum;
|
|
23
|
+
var getErrorMessageFunctions = mapperProps.getErrorMessageFunctions, updateComponent = mapperProps.updateComponent, onRefresh = mapperProps.onRefresh;
|
|
24
|
+
var errorMessageFunctions = getErrorMessageFunctions(schema.validationMessages);
|
|
25
|
+
var _b = getPersistAsyncInitialState(schemaMapperProps, mapperProps), performPersistAsync = _b.performPersistAsync, persistedState = _b.persistedState;
|
|
26
|
+
var _c = getValidationAsyncInitialState(schemaMapperProps, mapperProps), performValidationAsync = _c.performValidationAsync, validationState = _c.validationState;
|
|
27
|
+
var validLocalValue = isString(localValue) ? localValue : null;
|
|
28
|
+
var validModel = isString(model) ? model : defaultValue !== null && defaultValue !== void 0 ? defaultValue : null;
|
|
29
|
+
var value = performPersistAsync ? validLocalValue : validModel;
|
|
30
|
+
return createDateInputComponent(__assign(__assign({}, mapCommonSchemaProps(schemaMapperProps)), { autoComplete: getAutocompleteString(autocompleteHint), checks: schema.hidden
|
|
31
|
+
? []
|
|
32
|
+
: [
|
|
33
|
+
getRequiredCheck(required, errorMessageFunctions),
|
|
34
|
+
getAboveMaximumDateCheck(schema, errorMessageFunctions),
|
|
35
|
+
getBelowMinimumDateCheck(schema, errorMessageFunctions),
|
|
36
|
+
], minimumDate: minimumDate, maximumDate: maximumDate, value: value, persistedState: persistedState, validationState: validationState, performPersistAsync: performPersistAsync, performRefresh: getPerformRefresh(schema, onRefresh), performValidationAsync: performValidationAsync }), updateComponent);
|
|
37
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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 { createTextInputComponent } from '../../../components/TextInputComponent';
|
|
13
|
+
import { isString } from '../../../../utils/type-validators';
|
|
14
|
+
import { getDebouncedPerformRefresh } from '../../../features/refresh/getPerformRefresh';
|
|
15
|
+
import { getAboveMaxLengthCheck, getBelowMinLengthCheck, getNotAdheringToPatternCheck, getRequiredCheck, } from '../../../features/validation/value-checks';
|
|
16
|
+
import { getAutocompleteString } from '../../utils/getAutocompleteString';
|
|
17
|
+
import { getPersistAsyncInitialState } from '../utils/getPersistAsyncInitialState';
|
|
18
|
+
import { mapCommonSchemaProps } from '../utils/mapCommonSchemaProps';
|
|
19
|
+
import { getValidationAsyncInitialState } from '../utils/getValidationAsyncInitialState';
|
|
20
|
+
export var stringSchemaToTextInputComponent = function (schemaMapperProps, mapperProps) {
|
|
21
|
+
var schema = schemaMapperProps.schema, localValue = schemaMapperProps.localValue, model = schemaMapperProps.model, _a = schemaMapperProps.required, required = _a === void 0 ? false : _a;
|
|
22
|
+
var autocompleteHint = schema.autocompleteHint, control = schema.control, defaultValue = schema["default"], displayFormat = schema.displayFormat, format = schema.format, validationMessages = schema.validationMessages;
|
|
23
|
+
var getErrorMessageFunctions = mapperProps.getErrorMessageFunctions, updateComponent = mapperProps.updateComponent, onRefresh = mapperProps.onRefresh;
|
|
24
|
+
var controlForLegacyFormat = getControlForLegacyFormat(format);
|
|
25
|
+
var errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
26
|
+
var _b = getPersistAsyncInitialState(schemaMapperProps, mapperProps), performPersistAsync = _b.performPersistAsync, persistedState = _b.persistedState;
|
|
27
|
+
var _c = getValidationAsyncInitialState(schemaMapperProps, mapperProps), performValidationAsync = _c.performValidationAsync, validationState = _c.validationState;
|
|
28
|
+
var validLocalValue = isString(localValue) ? localValue : null;
|
|
29
|
+
var validModel = isString(model) ? model : defaultValue !== null && defaultValue !== void 0 ? defaultValue : null;
|
|
30
|
+
var value = performPersistAsync ? validLocalValue : validModel;
|
|
31
|
+
return createTextInputComponent(__assign(__assign({}, mapCommonSchemaProps(schemaMapperProps)), { autoComplete: getAutocompleteString(autocompleteHint), checks: schema.hidden
|
|
32
|
+
? []
|
|
33
|
+
: [
|
|
34
|
+
getRequiredCheck(required, errorMessageFunctions),
|
|
35
|
+
getAboveMaxLengthCheck(schema, errorMessageFunctions),
|
|
36
|
+
getBelowMinLengthCheck(schema, errorMessageFunctions),
|
|
37
|
+
getNotAdheringToPatternCheck(schema, errorMessageFunctions),
|
|
38
|
+
], control: control !== null && control !== void 0 ? control : controlForLegacyFormat, displayFormat: displayFormat, value: value, persistedState: persistedState, validationState: validationState, performPersistAsync: performPersistAsync, performRefresh: getDebouncedPerformRefresh(schema, onRefresh), performValidationAsync: performValidationAsync }), updateComponent);
|
|
39
|
+
};
|
|
40
|
+
var getControlForLegacyFormat = function (format) {
|
|
41
|
+
if (format && ['numeric', 'phone-number', 'email', 'password'].includes(format)) {
|
|
42
|
+
return format;
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { isFile } from '../../../../utils/type-validators';
|
|
13
|
+
import { createUploadInputComponent } from '../../../components/UploadInputComponent';
|
|
14
|
+
import { getInitialPersistedState } from '../../../features/persistAsync/getInitialPersistedState';
|
|
15
|
+
import { getPerformRefresh } from '../../../features/refresh/getPerformRefresh';
|
|
16
|
+
import { getRequiredCheck } from '../../../features/validation/value-checks';
|
|
17
|
+
import { getAutocompleteString } from '../../utils/getAutocompleteString';
|
|
18
|
+
import { getPersistAsyncInitialState } from '../utils/getPersistAsyncInitialState';
|
|
19
|
+
import { mapCommonSchemaProps } from '../utils/mapCommonSchemaProps';
|
|
20
|
+
export var stringSchemaToUploadInputComponent = function (schemaMapperProps, mapperProps) {
|
|
21
|
+
var schema = schemaMapperProps.schema, localValue = schemaMapperProps.localValue, model = schemaMapperProps.model, _a = schemaMapperProps.required, required = _a === void 0 ? false : _a;
|
|
22
|
+
var accepts = schema.accepts, autocompleteHint = schema.autocompleteHint, maxSize = schema.maxSize, validationMessages = schema.validationMessages;
|
|
23
|
+
var getErrorMessageFunctions = mapperProps.getErrorMessageFunctions, updateComponent = mapperProps.updateComponent, onRefresh = mapperProps.onRefresh;
|
|
24
|
+
var errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
25
|
+
var performPersistAsync = getPersistAsyncInitialState(schemaMapperProps, mapperProps).performPersistAsync;
|
|
26
|
+
var persistedState = performPersistAsync
|
|
27
|
+
? getInitialPersistedState(null, model)
|
|
28
|
+
: getInitialPersistedState();
|
|
29
|
+
var validLocalValue = isFile(localValue) ? localValue : null;
|
|
30
|
+
var value = performPersistAsync ? validLocalValue : null;
|
|
31
|
+
return createUploadInputComponent(__assign(__assign({}, mapCommonSchemaProps(schemaMapperProps)), { accepts: accepts, autoComplete: getAutocompleteString(autocompleteHint), checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)], format: 'base64', maxSize: maxSize, value: value, persistedState: persistedState, performPersistAsync: performPersistAsync, performRefresh: getPerformRefresh(schema, onRefresh) }), updateComponent);
|
|
32
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { mockErrorMessageFunctions } from '../../../features/validation/spec-utils';
|
|
13
|
+
import { getInputUpdateFunction } from '../../../components/utils/component-utils';
|
|
14
|
+
import { getRandomId } from '../../utils/getRandomId';
|
|
15
|
+
export var getMockMapperProps = function (mapperProps) {
|
|
16
|
+
if (mapperProps === void 0) { mapperProps = {}; }
|
|
17
|
+
return (__assign({ step: {}, stepLocalValue: null, updateComponent: jest.fn(), onAction: jest.fn(), onRefresh: jest.fn(), getErrorMessageFunctions: jest.fn().mockReturnValue(mockErrorMessageFunctions), trackEvent: jest.fn(), logEvent: jest.fn(), httpClient: jest.fn() }, mapperProps));
|
|
18
|
+
};
|
|
19
|
+
export var getMockSchemaMapperProps = function (schemaMapperProps) { return (__assign({ uid: getRandomId(), localValue: null, model: null, required: false, validationErrors: null }, schemaMapperProps)); };
|
|
20
|
+
export var mockUpdateFunction = function (draftComponent) {
|
|
21
|
+
return getInputUpdateFunction.mockImplementation(function () { return function (updateFn) { return updateFn(draftComponent); }; });
|
|
22
|
+
};
|
|
23
|
+
export var getUpdateFunctionMock = function (getComponent) {
|
|
24
|
+
return jest.fn(function (uid, update) {
|
|
25
|
+
update(getComponent());
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getPerformPersistAsync } from '../../../features/persistAsync/getPerformPersistAsync';
|
|
2
|
+
import { getInitialPersistedState } from '../../../features/persistAsync/getInitialPersistedState';
|
|
3
|
+
export var getPersistAsyncInitialState = function (schemaMapperProps, mapperProps) {
|
|
4
|
+
var localValue = schemaMapperProps.localValue, model = schemaMapperProps.model;
|
|
5
|
+
var performPersistAsync = getPerformPersisAsyncFn(schemaMapperProps, mapperProps);
|
|
6
|
+
var persistedState = performPersistAsync
|
|
7
|
+
? getInitialPersistedState(localValue, model)
|
|
8
|
+
: getInitialPersistedState();
|
|
9
|
+
return { performPersistAsync: performPersistAsync, persistedState: persistedState };
|
|
10
|
+
};
|
|
11
|
+
var getPerformPersisAsyncFn = function (schemaMapperProps, mapperProps) {
|
|
12
|
+
var schema = schemaMapperProps.schema, persistAsyncConfig = schemaMapperProps.persistAsyncConfig;
|
|
13
|
+
var trackEvent = mapperProps.trackEvent, logEvent = mapperProps.logEvent;
|
|
14
|
+
if (!persistAsyncConfig) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
var $id = schema.$id, analyticsId = schema.analyticsId;
|
|
18
|
+
var getErrorMessageFunctions = mapperProps.getErrorMessageFunctions, httpClient = mapperProps.httpClient;
|
|
19
|
+
var validationMessages = schemaHasValidationMessages(schema)
|
|
20
|
+
? schema.validationMessages
|
|
21
|
+
: undefined;
|
|
22
|
+
var errorMessageFunctions = getErrorMessageFunctions(validationMessages);
|
|
23
|
+
var persistAsyncError = errorMessageFunctions.genericError();
|
|
24
|
+
return getPerformPersistAsync({
|
|
25
|
+
genericErrorMessage: persistAsyncError,
|
|
26
|
+
httpClient: httpClient,
|
|
27
|
+
logEvent: logEvent,
|
|
28
|
+
persistAsyncConfig: persistAsyncConfig,
|
|
29
|
+
schemaId: analyticsId !== null && analyticsId !== void 0 ? analyticsId : $id,
|
|
30
|
+
trackEvent: trackEvent
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
var schemaHasValidationMessages = function (schema) {
|
|
34
|
+
return Boolean('validationMessages' in schema && schema.validationMessages);
|
|
35
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getPerformValidationAsync } from '../../../features/validationAsync/getPerformValidationAsync';
|
|
2
|
+
import { getInitialValidationState } from '../../../features/validationAsync/getInitialValidationState';
|
|
3
|
+
export var getValidationAsyncInitialState = function (schemaMapperProps, mapperProps) {
|
|
4
|
+
var performValidationAsync = getValidationAsyncFn(schemaMapperProps, mapperProps);
|
|
5
|
+
var validationState = getInitialValidationState();
|
|
6
|
+
return { performValidationAsync: performValidationAsync, validationState: validationState };
|
|
7
|
+
};
|
|
8
|
+
var getValidationAsyncFn = function (schemaMapperProps, mapperProps) {
|
|
9
|
+
var schema = schemaMapperProps.schema;
|
|
10
|
+
var trackEvent = mapperProps.trackEvent;
|
|
11
|
+
if (!schemaHasValidationAsync(schema)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
var $id = schema.$id, analyticsId = schema.analyticsId, validationAsync = schema.validationAsync;
|
|
15
|
+
var httpClient = mapperProps.httpClient;
|
|
16
|
+
return getPerformValidationAsync({
|
|
17
|
+
httpClient: httpClient,
|
|
18
|
+
validationAsyncConfig: validationAsync,
|
|
19
|
+
schemaId: analyticsId !== null && analyticsId !== void 0 ? analyticsId : $id,
|
|
20
|
+
trackEvent: trackEvent
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var schemaHasValidationAsync = function (schema) {
|
|
24
|
+
return Boolean('validationAsync' in schema && schema.validationAsync);
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { isString } from '../../../../utils/type-validators';
|
|
13
|
+
import { getSummariser } from '../../../features/summary/summary-utils';
|
|
14
|
+
export var mapCommonSchemaProps = function (schemaMapperProps) {
|
|
15
|
+
var _a;
|
|
16
|
+
var uid = schemaMapperProps.uid, schema = schemaMapperProps.schema, required = schemaMapperProps.required, validationErrors = schemaMapperProps.validationErrors;
|
|
17
|
+
var $id = schema.$id, analyticsId = schema.analyticsId, control = schema.control, description = schema.description, keywords = schema.keywords, title = schema.title, hidden = schema.hidden;
|
|
18
|
+
return __assign(__assign({ uid: uid, id: $id !== null && $id !== void 0 ? $id : uid, analyticsId: (_a = analyticsId !== null && analyticsId !== void 0 ? analyticsId : $id) !== null && _a !== void 0 ? _a : '', control: control, description: description, disabled: schemaHasDisabled(schema) ? schema.disabled : false, errors: isString(validationErrors) ? [validationErrors] : [], hidden: Boolean(hidden), keywords: keywords, required: Boolean(required), title: title, summariser: getSummariser(schema) }, (schemaHasHelp(schema) ? { help: schema.help.markdown } : {})), (schemaHasPlaceholder(schema) ? { placeholder: schema.placeholder } : {}));
|
|
19
|
+
};
|
|
20
|
+
var schemaHasDisabled = function (schema) {
|
|
21
|
+
return Boolean('disabled' in schema && schema.disabled !== undefined);
|
|
22
|
+
};
|
|
23
|
+
var schemaHasHelp = function (schema) {
|
|
24
|
+
return Boolean('help' in schema && schema.help);
|
|
25
|
+
};
|
|
26
|
+
var schemaHasPlaceholder = function (schema) {
|
|
27
|
+
return Boolean('placeholder' in schema && schema.placeholder);
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export var getAutocompleteString = function (hints) {
|
|
2
|
+
if (!hints || hints.length === 0) {
|
|
3
|
+
return 'off';
|
|
4
|
+
}
|
|
5
|
+
var validHints = hints.filter(function (hint) { return autocompleteTokenMap[hint]; });
|
|
6
|
+
if (validHints.length === 0) {
|
|
7
|
+
return 'off';
|
|
8
|
+
}
|
|
9
|
+
return validHints.map(function (hint) { return autocompleteTokenMap[hint]; }).join(' ');
|
|
10
|
+
};
|
|
11
|
+
var autocompleteTokenMap = {
|
|
12
|
+
on: 'on',
|
|
13
|
+
name: 'name',
|
|
14
|
+
'name-prefix': 'honorific-prefix',
|
|
15
|
+
'given-name': 'given-name',
|
|
16
|
+
'additional-name': 'additional-name',
|
|
17
|
+
'family-name': 'family-name',
|
|
18
|
+
'name-suffix': 'honorific-suffix',
|
|
19
|
+
nickname: 'nickname',
|
|
20
|
+
email: 'email',
|
|
21
|
+
// Web doesn't have a specific mapping for new username, but this is semantically close enough
|
|
22
|
+
'new-username': 'username',
|
|
23
|
+
username: 'username',
|
|
24
|
+
'new-password': 'new-password',
|
|
25
|
+
password: 'current-password',
|
|
26
|
+
'one-time-code': 'one-time-code',
|
|
27
|
+
'job-title': 'organization-title',
|
|
28
|
+
'organization-name': 'organization',
|
|
29
|
+
'full-street-address': 'street-address',
|
|
30
|
+
'street-address-line-1': 'address-line1',
|
|
31
|
+
'street-address-line-2': 'address-line2',
|
|
32
|
+
'street-address-line-3': 'address-line3',
|
|
33
|
+
'address-level-1': 'address-level1',
|
|
34
|
+
'address-level-2': 'address-level2',
|
|
35
|
+
'address-level-3': 'address-level3',
|
|
36
|
+
'address-level-4': 'address-level4',
|
|
37
|
+
'country-code': 'country',
|
|
38
|
+
'country-name': 'country-name',
|
|
39
|
+
'postal-code': 'postal-code',
|
|
40
|
+
'credit-card-name': 'cc-name',
|
|
41
|
+
'credit-card-given-name': 'cc-given-name',
|
|
42
|
+
'credit-card-middle-name': 'cc-additional-name',
|
|
43
|
+
'credit-card-family-name': 'cc-family-name',
|
|
44
|
+
'credit-card-number': 'cc-number',
|
|
45
|
+
'credit-card-expiration': 'cc-exp',
|
|
46
|
+
'credit-card-expiration-month': 'cc-exp-month',
|
|
47
|
+
'credit-card-expiration-year': 'cc-exp-year',
|
|
48
|
+
'credit-card-security-code': 'cc-csc',
|
|
49
|
+
'credit-card-type': 'cc-type',
|
|
50
|
+
'transaction-currency': 'transaction-currency',
|
|
51
|
+
'transaction-amount': 'transaction-amount',
|
|
52
|
+
language: 'language',
|
|
53
|
+
birthdate: 'bday',
|
|
54
|
+
'birthdate-day': 'bday-day',
|
|
55
|
+
'birthdate-month': 'bday-month',
|
|
56
|
+
'birthdate-year': 'bday-year',
|
|
57
|
+
gender: 'sex',
|
|
58
|
+
'phone-number': 'tel',
|
|
59
|
+
'phone-country-code': 'tel-country-code',
|
|
60
|
+
'phone-national': 'tel-national',
|
|
61
|
+
'phone-area-code': 'tel-area-code',
|
|
62
|
+
'phone-local': 'tel-local',
|
|
63
|
+
'phone-local-prefix': 'tel-local-prefix',
|
|
64
|
+
'phone-local-suffix': 'tel-local-suffix',
|
|
65
|
+
'phone-extension': 'tel-extension',
|
|
66
|
+
url: 'url',
|
|
67
|
+
photo: 'photo',
|
|
68
|
+
impp: 'impp',
|
|
69
|
+
shipping: 'shipping',
|
|
70
|
+
billing: 'billing',
|
|
71
|
+
home: 'home',
|
|
72
|
+
work: 'work',
|
|
73
|
+
mobile: 'mobile',
|
|
74
|
+
fax: 'fax',
|
|
75
|
+
pager: 'pager'
|
|
76
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getAutocompleteString } from './getAutocompleteString';
|
|
2
|
+
describe('getAutocompleteString', function () {
|
|
3
|
+
it('should return "off" if no hints are provided', function () {
|
|
4
|
+
expect(getAutocompleteString(undefined)).toBe('off');
|
|
5
|
+
expect(getAutocompleteString([])).toBe('off');
|
|
6
|
+
});
|
|
7
|
+
it('should return a string for valid hints', function () {
|
|
8
|
+
expect(getAutocompleteString(['name-prefix'])).toBe('honorific-prefix');
|
|
9
|
+
});
|
|
10
|
+
it('should return a space delimited, concatenated string for multiple valid hints', function () {
|
|
11
|
+
expect(getAutocompleteString(['name', 'billing'])).toBe('name billing');
|
|
12
|
+
});
|
|
13
|
+
it('should discard invalid hints', function () {
|
|
14
|
+
// @ts-expect-error testing an invalid hint
|
|
15
|
+
expect(getAutocompleteString(['name', 'cats'])).toBe('name');
|
|
16
|
+
});
|
|
17
|
+
it('should return "off" if no valid hints are provided', function () {
|
|
18
|
+
// @ts-expect-error testing an invalid hint
|
|
19
|
+
expect(getAutocompleteString(['cats'])).toBe('off');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export var mapLegacyContext = function (context) {
|
|
2
|
+
switch (context) {
|
|
3
|
+
case 'success':
|
|
4
|
+
return 'positive';
|
|
5
|
+
case 'failure':
|
|
6
|
+
return 'negative';
|
|
7
|
+
case 'info':
|
|
8
|
+
case 'primary':
|
|
9
|
+
return 'neutral';
|
|
10
|
+
default:
|
|
11
|
+
return context;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export var mapLegacyBias = function (bias) {
|
|
15
|
+
switch (bias) {
|
|
16
|
+
case 'left':
|
|
17
|
+
return 'start';
|
|
18
|
+
case 'right':
|
|
19
|
+
return 'end';
|
|
20
|
+
default:
|
|
21
|
+
return bias;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export var mapLegacyAlign = function (align) {
|
|
25
|
+
switch (align) {
|
|
26
|
+
case 'left':
|
|
27
|
+
return 'start';
|
|
28
|
+
case 'right':
|
|
29
|
+
return 'end';
|
|
30
|
+
default:
|
|
31
|
+
return align;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var legacyActionTypeToContext = {
|
|
35
|
+
positive: 'positive',
|
|
36
|
+
negative: 'negative',
|
|
37
|
+
primary: 'neutral',
|
|
38
|
+
secondary: 'neutral',
|
|
39
|
+
link: 'neutral'
|
|
40
|
+
};
|
|
41
|
+
export var mapLegacyActionTypeToContext = function (type) {
|
|
42
|
+
return type && type in legacyActionTypeToContext ? legacyActionTypeToContext[type] : 'neutral';
|
|
43
|
+
};
|
|
44
|
+
var legacyActionTypeToControl = {
|
|
45
|
+
primary: 'primary',
|
|
46
|
+
secondary: 'secondary',
|
|
47
|
+
link: 'tertiary',
|
|
48
|
+
positive: 'primary',
|
|
49
|
+
negative: 'primary'
|
|
50
|
+
};
|
|
51
|
+
export var mapLegacyActionTypeToControl = function (type) {
|
|
52
|
+
return type && type in legacyActionTypeToControl ? legacyActionTypeToControl[type] : 'secondary';
|
|
53
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|