@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
|
@@ -0,0 +1,107 @@
|
|
|
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
|
+
/* eslint-disable no-implicit-coercion */
|
|
38
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
39
|
+
export var isSelfieCamera = function (stream) {
|
|
40
|
+
var _a;
|
|
41
|
+
var facingMode = (((_a = getVideoTrack(stream)) === null || _a === void 0 ? void 0 : _a.getSettings()) || {}).facingMode;
|
|
42
|
+
// facingMode === undefined for desktop users
|
|
43
|
+
return facingMode === 'user' || facingMode === undefined;
|
|
44
|
+
};
|
|
45
|
+
export var isMainBackCamera = function (deviceInfo) {
|
|
46
|
+
return !!((deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.label) || '').match(/camera2? 0/g);
|
|
47
|
+
};
|
|
48
|
+
export var generateCanvasFromVideo = function (video) { return __awaiter(void 0, void 0, void 0, function () {
|
|
49
|
+
var canvas, context;
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
canvas = document.createElement('canvas');
|
|
54
|
+
if (!video) return [3 /*break*/, 2];
|
|
55
|
+
canvas.setAttribute('height', "".concat(video.videoHeight));
|
|
56
|
+
canvas.setAttribute('width', "".concat(video.videoWidth));
|
|
57
|
+
context = canvas === null || canvas === void 0 ? void 0 : canvas.getContext('2d');
|
|
58
|
+
if (!context) return [3 /*break*/, 2];
|
|
59
|
+
// Timeout is needed for intermittent iOS issue
|
|
60
|
+
return [4 /*yield*/, new Promise(function (resolve) {
|
|
61
|
+
setTimeout(resolve, 100);
|
|
62
|
+
})];
|
|
63
|
+
case 1:
|
|
64
|
+
// Timeout is needed for intermittent iOS issue
|
|
65
|
+
_a.sent();
|
|
66
|
+
context.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
67
|
+
_a.label = 2;
|
|
68
|
+
case 2: return [2 /*return*/, canvas];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); };
|
|
72
|
+
export var getAvailableVideoDevices = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
73
|
+
var _a, _b;
|
|
74
|
+
return __generator(this, function (_c) {
|
|
75
|
+
switch (_c.label) {
|
|
76
|
+
case 0: return [4 /*yield*/, ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))];
|
|
77
|
+
case 1: return [2 /*return*/, ((_c.sent()) || []).filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}); };
|
|
81
|
+
export var getAvailableVideoDeviceLabels = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
return __generator(this, function (_c) {
|
|
84
|
+
switch (_c.label) {
|
|
85
|
+
case 0: return [4 /*yield*/, ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))];
|
|
86
|
+
case 1: return [2 /*return*/, ((_c.sent()) || [])
|
|
87
|
+
.filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })
|
|
88
|
+
.map(function (deviceInfo) { return deviceInfo.label; })];
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}); };
|
|
92
|
+
export var getActiveVideoDeviceLabel = function (videoStream) { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var capabilities;
|
|
94
|
+
var _a, _b, _c;
|
|
95
|
+
return __generator(this, function (_d) {
|
|
96
|
+
switch (_d.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
capabilities = getVideoCapabilities(videoStream);
|
|
99
|
+
return [4 /*yield*/, ((_b = (_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices) === null || _b === void 0 ? void 0 : _b.call(_a))];
|
|
100
|
+
case 1: return [2 /*return*/, (_c = ((_d.sent()) || [])
|
|
101
|
+
.filter(function (deviceInfo) { return deviceInfo.kind === 'videoinput'; })
|
|
102
|
+
.find(function (deviceInfo) { return deviceInfo.deviceId === (capabilities === null || capabilities === void 0 ? void 0 : capabilities.deviceId); })) === null || _c === void 0 ? void 0 : _c.label];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}); };
|
|
106
|
+
export var getVideoTrack = function (videoStream) { var _a; return (((_a = videoStream === null || videoStream === void 0 ? void 0 : videoStream.getVideoTracks) === null || _a === void 0 ? void 0 : _a.call(videoStream)) || [])[0]; };
|
|
107
|
+
export var getVideoCapabilities = function (videoStream) { var _a, _b; return (_b = (_a = getVideoTrack(videoStream)) === null || _a === void 0 ? void 0 : _a.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(_a); };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CameraStep';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { DynamicLayout } from '../../layout';
|
|
4
|
+
import messages from './ExternalConfirmationStep.messages';
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
6
|
+
var noop = function () { };
|
|
7
|
+
var ExternalConfirmationStep = function (_a) {
|
|
8
|
+
var url = _a.url, onClose = _a.onClose;
|
|
9
|
+
var formatMessage = useIntl().formatMessage;
|
|
10
|
+
return (_jsx(DynamicLayout, { components: [
|
|
11
|
+
{
|
|
12
|
+
type: 'box',
|
|
13
|
+
width: 'lg',
|
|
14
|
+
components: [
|
|
15
|
+
{
|
|
16
|
+
type: 'heading',
|
|
17
|
+
text: formatMessage(messages.title),
|
|
18
|
+
size: 'lg',
|
|
19
|
+
align: 'center',
|
|
20
|
+
margin: 'xl'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'info',
|
|
24
|
+
markdown: formatMessage(messages.description, { origin: getOrigin(url) }),
|
|
25
|
+
align: 'center',
|
|
26
|
+
margin: 'xl'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'box',
|
|
30
|
+
width: 'md',
|
|
31
|
+
components: [
|
|
32
|
+
{
|
|
33
|
+
type: 'button',
|
|
34
|
+
action: { title: formatMessage(messages.open), type: 'primary', url: url, exit: true }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: 'button',
|
|
38
|
+
action: {
|
|
39
|
+
title: formatMessage(messages.cancel),
|
|
40
|
+
type: 'link',
|
|
41
|
+
url: '',
|
|
42
|
+
exit: true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
], submitted: false, onAction: function (action) {
|
|
50
|
+
if (action.url) {
|
|
51
|
+
window.open(action.url, '_blank');
|
|
52
|
+
}
|
|
53
|
+
onClose();
|
|
54
|
+
}, onModelChange: noop, onPersistAsync: noop }));
|
|
55
|
+
};
|
|
56
|
+
export default ExternalConfirmationStep;
|
|
57
|
+
function getOrigin(url) {
|
|
58
|
+
try {
|
|
59
|
+
return new URL(url).origin;
|
|
60
|
+
}
|
|
61
|
+
catch (_a) {
|
|
62
|
+
return url;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export default defineMessages({
|
|
3
|
+
title: {
|
|
4
|
+
id: 'dynamicFlows.ExternalConfirmation.title',
|
|
5
|
+
defaultMessage: 'Please confirm',
|
|
6
|
+
description: 'Heading for the confirmation screen.'
|
|
7
|
+
},
|
|
8
|
+
description: {
|
|
9
|
+
id: 'dynamicFlows.ExternalConfirmation.description',
|
|
10
|
+
defaultMessage: 'Please confirm you want to open **{origin}** in a new browser tab.',
|
|
11
|
+
description: 'Description for the confirmation screen.'
|
|
12
|
+
},
|
|
13
|
+
open: {
|
|
14
|
+
id: 'dynamicFlows.ExternalConfirmation.open',
|
|
15
|
+
defaultMessage: 'Open in new tab',
|
|
16
|
+
description: 'Button text confirming opening a new browser tab.'
|
|
17
|
+
},
|
|
18
|
+
cancel: {
|
|
19
|
+
id: 'dynamicFlows.ExternalConfirmation.cancel',
|
|
20
|
+
defaultMessage: 'Cancel',
|
|
21
|
+
description: 'Button text rejecting opening a new browser tab.'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ExternalConfirmationStep';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useDynamicFlow, useEventDispatcher } from '../../common/contexts';
|
|
3
|
+
import { useStepPolling } from '../../common/hooks';
|
|
4
|
+
import { isEmpty } from '../../common/validators';
|
|
5
|
+
import { DynamicLayout } from '../../layout';
|
|
6
|
+
import { convertStepToLayout, inlineReferences } from './utils';
|
|
7
|
+
var getComponents = function (step, options) {
|
|
8
|
+
var _a;
|
|
9
|
+
if (isEmpty(step)) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
var layout = convertStepToLayout(step, options);
|
|
13
|
+
return inlineReferences({
|
|
14
|
+
layout: layout,
|
|
15
|
+
schemas: step.schemas || [],
|
|
16
|
+
actions: step.actions || [],
|
|
17
|
+
model: (_a = step.model) !== null && _a !== void 0 ? _a : null
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
var LayoutStep = function (props) {
|
|
21
|
+
var stepSpecification = props.stepSpecification, stepLayoutOptions = props.stepLayoutOptions, submitted = props.submitted, model = props.model, formErrors = props.formErrors, onModelChange = props.onModelChange;
|
|
22
|
+
var components = getComponents(stepSpecification, stepLayoutOptions);
|
|
23
|
+
var _a = useDynamicFlow(), loading = _a.loading, registerPersistAsyncPromise = _a.registerPersistAsyncPromise;
|
|
24
|
+
var onEvent = useEventDispatcher();
|
|
25
|
+
var onAction = !loading
|
|
26
|
+
? props.onAction
|
|
27
|
+
: function () {
|
|
28
|
+
onEvent('Dynamic Flow - onAction supressed', { reason: 'LayoutStep - loading state' });
|
|
29
|
+
};
|
|
30
|
+
useStepPolling(stepSpecification.polling, onAction);
|
|
31
|
+
return (_jsx(DynamicLayout, { components: components, submitted: submitted, model: model, errors: formErrors, onAction: onAction, onModelChange: onModelChange, onPersistAsync: registerPersistAsyncPromise }));
|
|
32
|
+
};
|
|
33
|
+
export default LayoutStep;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LayoutStep';
|
|
@@ -0,0 +1,105 @@
|
|
|
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 { convertStepActionToDynamicAction } from './layout-utils';
|
|
13
|
+
export function inlineReferences(_a) {
|
|
14
|
+
var layout = _a.layout, schemas = _a.schemas, actions = _a.actions, model = _a.model;
|
|
15
|
+
if (!layout) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
if (!schemas) {
|
|
19
|
+
return layout;
|
|
20
|
+
}
|
|
21
|
+
return layout.map(function (component) {
|
|
22
|
+
if (component.type === 'form') {
|
|
23
|
+
return inlineFormSchema({ formComponent: component, schemas: schemas });
|
|
24
|
+
}
|
|
25
|
+
if (component.type === 'decision') {
|
|
26
|
+
return inlineDecisionActions({ decisionComponent: component, actions: actions });
|
|
27
|
+
}
|
|
28
|
+
if (component.type === 'button') {
|
|
29
|
+
return inlineAction({ actionComponent: component, actions: actions });
|
|
30
|
+
}
|
|
31
|
+
if (component.type === 'box') {
|
|
32
|
+
return __assign(__assign({}, component), { components: inlineReferences({ layout: component.components, schemas: schemas, actions: actions, model: model }) });
|
|
33
|
+
}
|
|
34
|
+
if (component.type === 'modal') {
|
|
35
|
+
return __assign(__assign({}, component), { components: inlineReferences({
|
|
36
|
+
layout: component.content.components,
|
|
37
|
+
schemas: schemas,
|
|
38
|
+
actions: actions,
|
|
39
|
+
model: model
|
|
40
|
+
}) });
|
|
41
|
+
}
|
|
42
|
+
if (component.type === 'columns') {
|
|
43
|
+
return __assign(__assign({}, component), { left: inlineReferences({ layout: component.left, schemas: schemas, actions: actions, model: model }), right: inlineReferences({ layout: component.right, schemas: schemas, actions: actions, model: model }) });
|
|
44
|
+
}
|
|
45
|
+
return component;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function inlineFormSchema(_a) {
|
|
49
|
+
var formComponent = _a.formComponent, schemas = _a.schemas;
|
|
50
|
+
if (formComponent.schemaId) {
|
|
51
|
+
return {
|
|
52
|
+
type: 'form',
|
|
53
|
+
margin: formComponent.margin,
|
|
54
|
+
schema: getSchemaById(schemas, formComponent.schemaId)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (formComponent.schema && isReference(formComponent.schema) && formComponent.schema.$ref) {
|
|
58
|
+
return {
|
|
59
|
+
type: 'form',
|
|
60
|
+
margin: formComponent.margin,
|
|
61
|
+
schema: getSchemaById(schemas, formComponent.schema.$ref)
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (formComponent.schema && !isReference(formComponent.schema)) {
|
|
65
|
+
return __assign({}, formComponent);
|
|
66
|
+
}
|
|
67
|
+
throw new Error('Invalid form layout component. Missing "schema" or "schemaId" properties.');
|
|
68
|
+
}
|
|
69
|
+
function inlineDecisionActions(_a) {
|
|
70
|
+
var _b;
|
|
71
|
+
var decisionComponent = _a.decisionComponent, actions = _a.actions;
|
|
72
|
+
var newOptions = (_b = decisionComponent === null || decisionComponent === void 0 ? void 0 : decisionComponent.options) === null || _b === void 0 ? void 0 : _b.map(function (option) {
|
|
73
|
+
return option.action && isReference(option.action)
|
|
74
|
+
? __assign(__assign({}, option), { action: getActionById(actions, option.action.$ref) }) : option;
|
|
75
|
+
});
|
|
76
|
+
return __assign(__assign({}, decisionComponent), { options: newOptions });
|
|
77
|
+
}
|
|
78
|
+
function inlineAction(_a) {
|
|
79
|
+
var _b;
|
|
80
|
+
var actionComponent = _a.actionComponent, actions = _a.actions;
|
|
81
|
+
if (actionComponent.action &&
|
|
82
|
+
isReference(actionComponent.action) &&
|
|
83
|
+
((_b = actionComponent.action) === null || _b === void 0 ? void 0 : _b.$ref)) {
|
|
84
|
+
var newAction = getActionById(actions, actionComponent.action.$ref);
|
|
85
|
+
return convertStepActionToDynamicAction(newAction);
|
|
86
|
+
}
|
|
87
|
+
return actionComponent;
|
|
88
|
+
}
|
|
89
|
+
function getSchemaById(schemas, id) {
|
|
90
|
+
var schema = schemas.find(function (schema) { return schema.$id === id; });
|
|
91
|
+
if (!schema) {
|
|
92
|
+
throw new Error("Fatal Error. Schema not found. $id ".concat(id));
|
|
93
|
+
}
|
|
94
|
+
return schema;
|
|
95
|
+
}
|
|
96
|
+
function getActionById(actions, id) {
|
|
97
|
+
var action = actions.find(function (action) { return action.$id === id; });
|
|
98
|
+
if (!action) {
|
|
99
|
+
throw new Error("Fatal Error. Action not found. $id ".concat(id));
|
|
100
|
+
}
|
|
101
|
+
return action;
|
|
102
|
+
}
|
|
103
|
+
function isReference(block) {
|
|
104
|
+
return Object.hasOwnProperty.call(block, '$ref');
|
|
105
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
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
|
+
export function convertStepToLayout(step, _a) {
|
|
22
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.displayStepTitle, displayStepTitle = _c === void 0 ? true : _c;
|
|
23
|
+
// This condition is meant as a temporary hack until mobile platforms will be refactored to fully support the layout property
|
|
24
|
+
if (step.layout) {
|
|
25
|
+
return addMissingTitleAndDescriptionToStep(step, displayStepTitle);
|
|
26
|
+
}
|
|
27
|
+
switch (step.type) {
|
|
28
|
+
case 'final':
|
|
29
|
+
return convertFinalStepToDynamicLayout(step);
|
|
30
|
+
case 'decision':
|
|
31
|
+
return convertDecisionStepToDynamicLayout(step);
|
|
32
|
+
case 'external':
|
|
33
|
+
return convertExternalStepToDynamicLayout(step);
|
|
34
|
+
default:
|
|
35
|
+
return convertFormStepToDynamicLayout(step);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function convertCommonComponents(step) {
|
|
39
|
+
var layout = [];
|
|
40
|
+
if (step.title) {
|
|
41
|
+
layout.push(convertStepTitleToDynamicHeading(step.title));
|
|
42
|
+
}
|
|
43
|
+
if (step.image) {
|
|
44
|
+
var image = convertStepImageToDynamicImage(step.image);
|
|
45
|
+
layout.push(image);
|
|
46
|
+
}
|
|
47
|
+
if (step.description) {
|
|
48
|
+
layout.push(convertStepDescriptionToDynamicParagraph(step.description));
|
|
49
|
+
}
|
|
50
|
+
return layout;
|
|
51
|
+
}
|
|
52
|
+
function convertExternalStepToDynamicLayout(step) {
|
|
53
|
+
return __spreadArray(__spreadArray([], convertCommonComponents(step), true), [convertStepToExternalComponent(step)], false);
|
|
54
|
+
}
|
|
55
|
+
function convertStepToExternalComponent(step) {
|
|
56
|
+
return {
|
|
57
|
+
type: 'external',
|
|
58
|
+
requestUrl: step.requestUrl,
|
|
59
|
+
polling: step.polling,
|
|
60
|
+
responseHandlers: step.responseHandlers,
|
|
61
|
+
retryTitle: step.retryTitle
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function convertFormStepToDynamicLayout(step) {
|
|
65
|
+
var layout = convertCommonComponents(step);
|
|
66
|
+
if (step.reviewFields) {
|
|
67
|
+
layout.push(convertStepReviewToDynamicReview(step.reviewFields));
|
|
68
|
+
}
|
|
69
|
+
if (step.schemas) {
|
|
70
|
+
layout.push.apply(layout, getSchemaLayout(step));
|
|
71
|
+
}
|
|
72
|
+
if (step.actions) {
|
|
73
|
+
var actions = step.actions.map(convertStepActionToDynamicAction);
|
|
74
|
+
layout.push(dynamicBox(actions, 'md'));
|
|
75
|
+
}
|
|
76
|
+
return layout;
|
|
77
|
+
}
|
|
78
|
+
function convertFinalStepToDynamicLayout(step) {
|
|
79
|
+
var layout = [];
|
|
80
|
+
if (step.details) {
|
|
81
|
+
if (step.details.image) {
|
|
82
|
+
var image = convertFinalStepImageToDynamicImage(step.details.image);
|
|
83
|
+
layout.push(image);
|
|
84
|
+
}
|
|
85
|
+
if (step.details.title) {
|
|
86
|
+
layout.push(convertStepTitleToDynamicHeading(step.details.title));
|
|
87
|
+
}
|
|
88
|
+
if (step.details.description) {
|
|
89
|
+
layout.push(convertStepDescriptionToDynamicParagraph(step.details.description));
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (step.actions) {
|
|
93
|
+
var actions = step.actions.map(function (action) {
|
|
94
|
+
return convertStepActionToDynamicAction(__assign(__assign({}, action), { type: action.type || 'primary' }));
|
|
95
|
+
});
|
|
96
|
+
layout.push(dynamicBox(actions, 'md'));
|
|
97
|
+
}
|
|
98
|
+
return layout;
|
|
99
|
+
}
|
|
100
|
+
function convertDecisionStepToDynamicLayout(step) {
|
|
101
|
+
var layout = convertCommonComponents(step);
|
|
102
|
+
if (step.options) {
|
|
103
|
+
layout.push(convertStepDecisionToDynamicDecision(step.options));
|
|
104
|
+
}
|
|
105
|
+
return layout;
|
|
106
|
+
}
|
|
107
|
+
function dynamicBox(components, size) {
|
|
108
|
+
return {
|
|
109
|
+
type: 'box',
|
|
110
|
+
width: size || 'md',
|
|
111
|
+
components: components
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function convertStepTitleToDynamicHeading(title) {
|
|
115
|
+
return {
|
|
116
|
+
type: 'heading',
|
|
117
|
+
text: title,
|
|
118
|
+
size: 'lg',
|
|
119
|
+
margin: 'lg',
|
|
120
|
+
align: 'center'
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function convertStepDescriptionToDynamicParagraph(description) {
|
|
124
|
+
return {
|
|
125
|
+
type: 'paragraph',
|
|
126
|
+
text: description,
|
|
127
|
+
align: 'center'
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function convertStepSchemaToDynamicForm(schema) {
|
|
131
|
+
return { type: 'form', schema: schema };
|
|
132
|
+
}
|
|
133
|
+
function convertStepDecisionToDynamicDecision(options) {
|
|
134
|
+
return {
|
|
135
|
+
type: 'decision',
|
|
136
|
+
options: options.map(convertStepDecisionOption)
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function convertStepDecisionOption(option) {
|
|
140
|
+
return {
|
|
141
|
+
title: option.title,
|
|
142
|
+
description: option.description,
|
|
143
|
+
action: {
|
|
144
|
+
title: option.title,
|
|
145
|
+
method: 'GET',
|
|
146
|
+
url: option.url,
|
|
147
|
+
disabled: option.disabled
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function convertStepImageToDynamicImage(image) {
|
|
152
|
+
return {
|
|
153
|
+
type: 'image',
|
|
154
|
+
url: image.url,
|
|
155
|
+
text: image.text,
|
|
156
|
+
margin: image.margin || 'lg',
|
|
157
|
+
size: image.size || 'md'
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function convertFinalStepImageToDynamicImage(image) {
|
|
161
|
+
return typeof image === 'string'
|
|
162
|
+
? {
|
|
163
|
+
type: 'image',
|
|
164
|
+
url: image,
|
|
165
|
+
text: undefined,
|
|
166
|
+
margin: 'lg',
|
|
167
|
+
size: 'md'
|
|
168
|
+
}
|
|
169
|
+
: convertStepImageToDynamicImage(image);
|
|
170
|
+
}
|
|
171
|
+
export function convertStepActionToDynamicAction(action) {
|
|
172
|
+
var newAction = __assign(__assign({}, action), { title: action.title });
|
|
173
|
+
return {
|
|
174
|
+
type: 'button',
|
|
175
|
+
action: newAction
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function convertStepReviewToDynamicReview(reviewFields) {
|
|
179
|
+
return {
|
|
180
|
+
type: 'review',
|
|
181
|
+
title: reviewFields.title,
|
|
182
|
+
fields: reviewFields.fields.map(convertReviewFieldToDefinition)
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
function convertReviewFieldToDefinition(reviewField) {
|
|
186
|
+
return {
|
|
187
|
+
label: reviewField.title,
|
|
188
|
+
value: reviewField.value
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
function getSchemaLayout(step) {
|
|
192
|
+
var layout = [];
|
|
193
|
+
if (step.schemas && step.schemas[0]) {
|
|
194
|
+
var schema = step.schemas[0];
|
|
195
|
+
var dynamicForm = convertStepSchemaToDynamicForm(schema);
|
|
196
|
+
if (isWideForm()) {
|
|
197
|
+
layout.push(dynamicForm);
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
layout.push(dynamicBox([dynamicForm], 'md'));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return layout;
|
|
204
|
+
}
|
|
205
|
+
function isWideForm() {
|
|
206
|
+
// For the time being we won't support automatically widening forms
|
|
207
|
+
// Unlike it V2, there is no way to easily iterate and identify narrow fields
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
function addMissingTitleAndDescriptionToStep(step, displayStepTitle) {
|
|
211
|
+
return __spreadArray(__spreadArray(__spreadArray([], (displayStepTitle && step.title ? [convertStepTitleToDynamicHeading(step.title)] : []), true), (step.description ? [convertStepDescriptionToDynamicParagraph(step.description)] : []), true), (step.layout || []), true);
|
|
212
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { EventsContextProvider, LogProvider } from '../common/contexts';
|
|
14
|
+
var noop = function () { };
|
|
15
|
+
function DynamicFlowProviders(_a) {
|
|
16
|
+
var children = _a.children, _b = _a.onLog, onLog = _b === void 0 ? noop : _b, _c = _a.onEvent, onEvent = _c === void 0 ? noop : _c;
|
|
17
|
+
return (_jsx(LogProvider, __assign({ flowId: "", stepId: "", onLog: onLog }, { children: _jsx(EventsContextProvider, __assign({ onEvent: onEvent }, { children: children })) })));
|
|
18
|
+
}
|
|
19
|
+
export default DynamicFlowProviders;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as DynamicFlowProviders } from './DynamicFlowProviders';
|
|
2
|
+
export { mount, mountWithOptions, getMockFetchPromise, wait, getI18n, TestContextProviders, } from './legacy-utils';
|
|
3
|
+
export { default as mockUseLogger } from './log-utils';
|
|
4
|
+
export { renderWithProviders } from '../../test-utils/rtl-utils';
|
|
@@ -0,0 +1,69 @@
|
|
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
14
|
+
import { translations as componentTranslations, Provider } from '@transferwise/components';
|
|
15
|
+
import { mount } from 'enzyme';
|
|
16
|
+
import { act } from 'react-dom/test-utils';
|
|
17
|
+
import { translations as dynamicFlowTranslations } from '../..';
|
|
18
|
+
import { EventsContextProvider, LogProvider } from '../common/contexts';
|
|
19
|
+
import { HttpClientProviderFromBaseUrl } from '../../common/httpClientContext';
|
|
20
|
+
var defaultTranslations = __assign(__assign({}, componentTranslations.en), dynamicFlowTranslations.en);
|
|
21
|
+
var getMockFetchPromise = function (status, jsonFn, delay, signal) {
|
|
22
|
+
var response = {
|
|
23
|
+
status: status,
|
|
24
|
+
json: jsonFn
|
|
25
|
+
};
|
|
26
|
+
return new Promise(function (resolve) {
|
|
27
|
+
var aborted = false;
|
|
28
|
+
if (signal) {
|
|
29
|
+
signal.addEventListener('abort', function () {
|
|
30
|
+
aborted = true;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
setTimeout(function () { return !aborted && resolve(response); }, delay);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var wait = function (t) {
|
|
37
|
+
return act(function () {
|
|
38
|
+
return new Promise(function (resolve) {
|
|
39
|
+
setTimeout(resolve, t);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
function mountWithProviders(component, locale, messages, baseUrl, onEvent, onLog) {
|
|
44
|
+
if (locale === void 0) { locale = 'en-GB'; }
|
|
45
|
+
if (messages === void 0) { messages = defaultTranslations; }
|
|
46
|
+
if (baseUrl === void 0) { baseUrl = 'https://test-url'; }
|
|
47
|
+
if (onEvent === void 0) { onEvent = (function () { }); }
|
|
48
|
+
if (onLog === void 0) { onLog = (function () { }); }
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-return
|
|
50
|
+
return mount(_jsx(LogProvider, __assign({ flowId: "", stepId: "", onLog: onLog }, { children: _jsx(EventsContextProvider, __assign({ onEvent: onEvent }, { children: _jsx(Provider, __assign({ i18n: { locale: locale, messages: messages } }, { children: _jsx(HttpClientProviderFromBaseUrl, __assign({ baseUrl: baseUrl }, { children: component })) })) })) })));
|
|
51
|
+
}
|
|
52
|
+
function mountWithOptions(_a) {
|
|
53
|
+
var component = _a.component, _b = _a.locale, locale = _b === void 0 ? 'en-GB' : _b, _c = _a.messages, messages = _c === void 0 ? defaultTranslations : _c, _d = _a.baseUrl, baseUrl = _d === void 0 ? 'https://test-url' : _d, _e = _a.onEvent, onEvent = _e === void 0 ? function () { } : _e, _f = _a.onLog, onLog = _f === void 0 ? function () { } : _f;
|
|
54
|
+
return mountWithProviders(component, locale, messages, baseUrl, onEvent, onLog);
|
|
55
|
+
}
|
|
56
|
+
function getI18n(locale, messages) {
|
|
57
|
+
if (locale === void 0) { locale = 'en-GB'; }
|
|
58
|
+
if (messages === void 0) { messages = defaultTranslations; }
|
|
59
|
+
return { locale: locale, messages: messages };
|
|
60
|
+
}
|
|
61
|
+
var i18n = {
|
|
62
|
+
locale: 'en-GB',
|
|
63
|
+
messages: __assign({}, componentTranslations.en)
|
|
64
|
+
};
|
|
65
|
+
function TestContextProviders(_a) {
|
|
66
|
+
var children = _a.children;
|
|
67
|
+
return (_jsx(LogProvider, __assign({ flowId: "", stepId: "", onLog: function () { } }, { children: _jsx(Provider, __assign({ i18n: i18n }, { children: children })) })));
|
|
68
|
+
}
|
|
69
|
+
export { mountWithProviders as mount, mountWithOptions, getMockFetchPromise, wait, getI18n, TestContextProviders, };
|