@wise/dynamic-flow-client 5.30.0-experimental-7a76ef5 → 5.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/DynamicFlowCore.js +5 -0
- package/build/common/capabilities/getHttpClientWithCapabilities.js +41 -0
- package/build/common/capabilities/getHttpClientWithCapabilities.test.js +106 -0
- package/build/common/capabilities/index.js +1 -0
- package/build/common/errorBoundary/ErrorBoundary.js +26 -0
- package/build/common/errorBoundary/ErrorBoundary.test.js +29 -0
- package/build/common/errorBoundary/ErrorBoundaryAlert.js +11 -0
- package/build/common/makeHttpClient/api-utils.js +3 -0
- package/build/common/makeHttpClient/index.js +1 -0
- package/build/common/makeHttpClient/makeHttpClient.js +10 -0
- package/build/common/makeHttpClient/makeHttpClient.test.js +186 -0
- package/build/common/messages/download.messages.js +18 -0
- package/build/common/messages/external-confirmation.messages.js +23 -0
- package/build/common/messages/file-upload.messages.js +13 -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/multi-select.messages.js +8 -0
- package/build/common/messages/paragraph.messages.js +13 -0
- package/build/common/messages/repeatable.messages.js +23 -0
- package/build/common/messages/search.messages.js +8 -0
- package/build/common/messages/validation.array.messages.js +13 -0
- package/build/common/messages/validation.messages.js +53 -0
- package/build/controller/FlowController.js +400 -0
- package/build/controller/executeDownload.js +86 -0
- package/build/controller/executePoll.js +65 -0
- package/build/controller/executeRefresh.js +45 -0
- package/build/controller/executeRequest.js +93 -0
- package/build/controller/executeSubflow.js +71 -0
- package/build/controller/executeSubmission.js +68 -0
- package/build/controller/getErrorMessage.js +7 -0
- package/build/controller/getFilenameFromContentDisposition.js +47 -0
- package/build/controller/getFilenameFromContentDisposition.test.js +47 -0
- package/build/controller/getRequestAbortController.js +13 -0
- package/build/controller/getResponseType.js +35 -0
- package/build/controller/getSafeHttpClient.js +8 -0
- package/build/controller/getStepCounter.js +16 -0
- package/build/controller/handleErrorResponse.js +26 -0
- package/build/controller/makeSafeHttpClient.js +8 -0
- package/build/controller/response-utils.js +72 -0
- package/build/controller/response-utils.test.js +52 -0
- package/build/domain/components/AlertComponent.js +2 -0
- package/build/domain/components/AllOfComponent.js +47 -0
- package/build/domain/components/BooleanInputComponent.js +48 -0
- package/build/domain/components/BoxComponent.js +12 -0
- package/build/domain/components/ButtonComponent.js +2 -0
- package/build/domain/components/ColumnsComponent.js +12 -0
- package/build/domain/components/ConstComponent.js +20 -0
- package/build/domain/components/ContainerComponent.js +12 -0
- package/build/domain/components/DateInputComponent.js +73 -0
- package/build/domain/components/DecisionComponent.js +2 -0
- package/build/domain/components/DividerComponent.js +2 -0
- package/build/domain/components/FormComponent.js +12 -0
- package/build/domain/components/FormattedValueComponent.js +47 -0
- package/build/domain/components/HeadingComponent.js +2 -0
- package/build/domain/components/ImageComponent.js +2 -0
- package/build/domain/components/InstructionsComponent.js +2 -0
- package/build/domain/components/IntegerInputComponent.js +75 -0
- package/build/domain/components/ListComponent.js +2 -0
- package/build/domain/components/LoadingIndicatorComponent.js +2 -0
- package/build/domain/components/MarkdownComponent.js +2 -0
- package/build/domain/components/MediaComponent.js +2 -0
- package/build/domain/components/ModalComponent.js +20 -0
- package/build/domain/components/ModalLayoutComponent.js +12 -0
- package/build/domain/components/MoneyInputComponent.js +56 -0
- package/build/domain/components/MultiSelectInputComponent.js +86 -0
- package/build/domain/components/MultiUploadInputComponent.js +86 -0
- package/build/domain/components/NumberInputComponent.js +74 -0
- package/build/domain/components/ObjectComponent.js +54 -0
- package/build/domain/components/ParagraphComponent.js +2 -0
- package/build/domain/components/PersistAsyncComponent.js +96 -0
- package/build/domain/components/ProgressComponent.js +2 -0
- package/build/domain/components/RepeatableComponent.js +106 -0
- package/build/domain/components/ReviewComponent.js +2 -0
- package/build/domain/components/RootDomainComponent.js +193 -0
- package/build/domain/components/SectionComponent.js +12 -0
- package/build/domain/components/SelectInputComponent.js +96 -0
- package/build/domain/components/StatusListComponent.js +2 -0
- package/build/domain/components/SubflowComponent.js +19 -0
- package/build/domain/components/TabsComponent.js +2 -0
- package/build/domain/components/TextInputComponent.js +77 -0
- package/build/domain/components/TupleComponent.js +48 -0
- package/build/domain/components/UpdatableComponent.js +46 -0
- package/build/domain/components/UploadInputComponent.js +78 -0
- package/build/domain/components/UpsellComponent.js +26 -0
- package/build/domain/components/collectionComponent/CollectionComponent.js +14 -0
- package/build/domain/components/collectionComponent/CollectionComponent.test.js +447 -0
- package/build/domain/components/collectionComponent/CollectionController.js +138 -0
- package/build/domain/components/collectionComponent/CollectionController.test.js +58 -0
- package/build/domain/components/collectionComponent/CollectionStack.js +40 -0
- package/build/domain/components/collectionComponent/CollectionStack.test.js +173 -0
- package/build/domain/components/collectionComponent/CollectionState.js +39 -0
- package/build/domain/components/collectionComponent/applyCollectionResponse.js +9 -0
- package/build/domain/components/collectionComponent/mergeSections.js +28 -0
- package/build/domain/components/collectionComponent/toggleFilterOption.js +15 -0
- package/build/domain/components/collectionComponent/types.js +1 -0
- package/build/domain/components/searchComponent/SearchComponent.js +91 -0
- package/build/domain/components/searchComponent/SearchComponent.test.js +190 -0
- package/build/domain/components/step/ExternalConfirmationComponent.js +27 -0
- package/build/domain/components/step/StepDomainComponent.js +153 -0
- package/build/domain/components/step/ToolbarComponent.js +1 -0
- package/build/domain/components/utils/component-utils.js +12 -0
- package/build/domain/components/utils/debounce.js +34 -0
- package/build/domain/components/utils/debounce.test.js +67 -0
- package/build/domain/components/utils/file-utils.js +21 -0
- package/build/domain/components/utils/file-utils.test.js +27 -0
- package/build/domain/components/utils/getRandomId.js +1 -0
- package/build/domain/components/utils/isExactLocalValueMatch.js +14 -0
- package/build/domain/components/utils/isOrWasValid.js +5 -0
- package/build/domain/components/utils/isPartialModelMatch.js +18 -0
- package/build/domain/components/utils/isPartialModelMatch.test.js +74 -0
- package/build/domain/features/collection/getPerformCollectionQuery.js +80 -0
- package/build/domain/features/collection/getPerformCollectionQuery.test.js +215 -0
- package/build/domain/features/delay/getStepDelays.js +37 -0
- package/build/domain/features/delay/getStepDelays.test.js +69 -0
- package/build/domain/features/domain-event-bus/DomainEventBus.js +24 -0
- package/build/domain/features/domain-event-bus/index.js +1 -0
- package/build/domain/features/domain-event-bus/types.js +1 -0
- package/build/domain/features/eventNames.js +41 -0
- package/build/domain/features/events.js +5 -0
- package/build/domain/features/persistAsync/getComponentMultiPersistAsync.js +50 -0
- package/build/domain/features/persistAsync/getInitialPersistedState.js +7 -0
- package/build/domain/features/persistAsync/getPerformPersistAsync.js +43 -0
- package/build/domain/features/persistAsync/getPerformPersistAsync.test.js +139 -0
- package/build/domain/features/polling/getStepPolling.js +50 -0
- package/build/domain/features/polling/getStepPolling.test.js +115 -0
- package/build/domain/features/prefetch/getStepPrefetch.js +56 -0
- package/build/domain/features/prefetch/request-cache.js +49 -0
- package/build/domain/features/prefetch/request-cache.test.js +70 -0
- package/build/domain/features/refreshAfter/getStepRefreshAfter.js +24 -0
- package/build/domain/features/refreshAfter/getStepRefreshAfter.test.js +40 -0
- package/build/domain/features/schema-on-change/getDebouncedSchemaOnChange.js +50 -0
- package/build/domain/features/schema-on-change/getSchemaOnChange.js +38 -0
- package/build/domain/features/search/getPerformSearchFunction.js +75 -0
- package/build/domain/features/search/getPerformSearchFunction.test.js +301 -0
- package/build/domain/features/summary/summary-utils.js +37 -0
- package/build/domain/features/summary/summary-utils.test.js +125 -0
- package/build/domain/features/updatable/getPerformUpdateQuery.js +52 -0
- package/build/domain/features/utils/http-utils.js +21 -0
- package/build/domain/features/utils/response-utils.js +9 -0
- package/build/domain/features/validation/date-availability.js +54 -0
- package/build/domain/features/validation/date-availability.test.js +54 -0
- package/build/domain/features/validation/getPatternRegExp.js +25 -0
- package/build/domain/features/validation/spec-utils.js +23 -0
- package/build/domain/features/validation/validation-functions.js +6 -0
- package/build/domain/features/validation/validation-functions.test.js +108 -0
- package/build/domain/features/validation/value-checks.js +130 -0
- package/build/domain/features/validation/value-checks.test.js +297 -0
- package/build/domain/features/validationAsync/getComponentValidationAsync.js +57 -0
- package/build/domain/features/validationAsync/getComponentValidationAsync.test.js +67 -0
- package/build/domain/features/validationAsync/getInitialValidationAsyncState.js +6 -0
- package/build/domain/features/validationAsync/getPerformValidationAsync.js +46 -0
- package/build/domain/features/validationAsync/getPerformValidationAsync.test.js +162 -0
- package/build/domain/handlers/dismissHandler.js +11 -0
- package/build/domain/mappers/layout/alertLayoutToComponent.js +18 -0
- package/build/domain/mappers/layout/boxLayoutToComponent.js +13 -0
- package/build/domain/mappers/layout/buttonLayoutToComponent.js +77 -0
- package/build/domain/mappers/layout/collectionLayoutToComponent.js +66 -0
- package/build/domain/mappers/layout/columnsLayoutToComponent.js +13 -0
- package/build/domain/mappers/layout/decisionLayoutToComponent.js +24 -0
- package/build/domain/mappers/layout/deprecatedListLayoutToComponent.js +30 -0
- package/build/domain/mappers/layout/dividerLayoutToComponent.js +2 -0
- package/build/domain/mappers/layout/formLayoutToComponent.js +19 -0
- package/build/domain/mappers/layout/headingLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/imageLayoutToComponent.js +17 -0
- package/build/domain/mappers/layout/infoLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/instructionsLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/listLayoutToComponent.js +39 -0
- package/build/domain/mappers/layout/loadingIndicatorLayoutToComponent.js +9 -0
- package/build/domain/mappers/layout/markdownLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/mediaLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/modalLayoutToComponent.js +17 -0
- package/build/domain/mappers/layout/modalToComponent.js +8 -0
- package/build/domain/mappers/layout/paragraphLayoutToComponent.js +12 -0
- package/build/domain/mappers/layout/progressLayoutToComponent.js +15 -0
- package/build/domain/mappers/layout/reviewLayoutToComponent.js +49 -0
- package/build/domain/mappers/layout/searchLayoutToComponent.js +44 -0
- package/build/domain/mappers/layout/sectionLayoutToComponent.js +16 -0
- package/build/domain/mappers/layout/statusListLayoutToComponent.js +15 -0
- package/build/domain/mappers/layout/tabsLayoutToComponent.js +16 -0
- package/build/domain/mappers/layout/updatableLayoutToComponent.js +39 -0
- package/build/domain/mappers/layout/upsellLayoutToComponent.js +18 -0
- package/build/domain/mappers/mapLayoutToComponent.js +87 -0
- package/build/domain/mappers/mapSchemaToComponent.js +65 -0
- package/build/domain/mappers/mapSchemaToComponent.test.js +116 -0
- package/build/domain/mappers/mapStepSchemas.js +14 -0
- package/build/domain/mappers/mapStepToComponent.js +145 -0
- package/build/domain/mappers/mapStepToComponent.test.js +319 -0
- package/build/domain/mappers/mapToolbarToComponent.js +15 -0
- package/build/domain/mappers/schema/allOfSchemaToComponent.js +17 -0
- package/build/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.js +26 -0
- package/build/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiSelectComponent.js +56 -0
- package/build/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.js +66 -0
- package/build/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.js +58 -0
- package/build/domain/mappers/schema/arraySchemaToComponent/arraySchemaToTupleComponent.js +18 -0
- package/build/domain/mappers/schema/blobSchemaToComponent.js +15 -0
- package/build/domain/mappers/schema/booleanSchemaToComponent.js +29 -0
- package/build/domain/mappers/schema/constSchemaToComponent.js +23 -0
- package/build/domain/mappers/schema/dateSchemaToComponent.js +56 -0
- package/build/domain/mappers/schema/dateSchemaToComponent.test.js +117 -0
- package/build/domain/mappers/schema/integerSchemaToComponent.js +28 -0
- package/build/domain/mappers/schema/numberSchemaToComponent.js +26 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/assertDisplayOrder.js +23 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/objectSchemaToFormattedValueComponent.js +9 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/objectSchemaToMoneyInputComponent.js +119 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/objectSchemaToMoneyInputComponent.test.js +97 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/objectSchemaToObjectComponent.js +32 -0
- package/build/domain/mappers/schema/objectSchemaToComponent/objectSchemaToObjectComponent.test.js +99 -0
- package/build/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.js +67 -0
- package/build/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.test.js +225 -0
- package/build/domain/mappers/schema/persistAsyncSchemaToComponent.js +29 -0
- package/build/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.js +18 -0
- package/build/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.test.js +133 -0
- package/build/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.js +38 -0
- package/build/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.js +28 -0
- package/build/domain/mappers/schema/tests/test-utils.js +16 -0
- package/build/domain/mappers/schema/types.js +1 -0
- package/build/domain/mappers/schema/utils/getPerformPersistAsyncFn.js +19 -0
- package/build/domain/mappers/schema/utils/getValidationAsyncInitialState.js +23 -0
- package/build/domain/mappers/schema/utils/mapCommonSchemaProps.js +16 -0
- package/build/domain/mappers/types.js +1 -0
- package/build/domain/mappers/utils/FeatureFlags.js +22 -0
- package/build/domain/mappers/utils/behavior-utils.js +52 -0
- package/build/domain/mappers/utils/call-to-action-utils.js +24 -0
- package/build/domain/mappers/utils/getAutocompleteString.js +76 -0
- package/build/domain/mappers/utils/getAutocompleteString.test.js +21 -0
- package/build/domain/mappers/utils/getHrefWithTracking.js +16 -0
- package/build/domain/mappers/utils/groupLayoutByPinned.js +38 -0
- package/build/domain/mappers/utils/groupLayoutByPinned.test.js +166 -0
- package/build/domain/mappers/utils/image.js +6 -0
- package/build/domain/mappers/utils/layout-utils.js +11 -0
- package/build/domain/mappers/utils/legacy-utils.js +49 -0
- package/build/domain/mappers/utils/media-utils.js +14 -0
- package/build/domain/mappers/utils/suggestions-utils.js +26 -0
- package/build/domain/mappers/utils/suggestions-utils.test.js +36 -0
- package/build/domain/mappers/utils/tags-utils.js +1 -0
- package/build/domain/mappers/utils/utils.js +45 -0
- package/build/domain/types.js +1 -0
- package/build/i18n/index.js +40 -0
- package/build/index.js +9 -0
- package/build/main.css +57 -1
- package/build/renderers/CoreContainerRenderer.js +5 -0
- package/build/renderers/CoreRootRenderer.js +12 -0
- package/build/renderers/EmptyLoadingStateRenderer.js +5 -0
- package/build/renderers/getRenderFunction.js +24 -0
- package/build/renderers/getSchemaErrorMessageFunction.js +111 -0
- package/build/renderers/mappers/alertComponentToProps.js +3 -0
- package/build/renderers/mappers/allOfComponentToProps.js +6 -0
- package/build/renderers/mappers/booleanInputComponentToProps.js +3 -0
- package/build/renderers/mappers/boxComponentToProps.js +13 -0
- package/build/renderers/mappers/buttonComponentToProps.js +4 -0
- package/build/renderers/mappers/collectionComponentToProps.js +54 -0
- package/build/renderers/mappers/columnsComponentToProps.js +8 -0
- package/build/renderers/mappers/componentToRendererProps.js +168 -0
- package/build/renderers/mappers/constComponentToProps.js +5 -0
- package/build/renderers/mappers/containerComponentToProps.js +8 -0
- package/build/renderers/mappers/dateInputComponentToProps.js +3 -0
- package/build/renderers/mappers/decisionComponentToProps.js +16 -0
- package/build/renderers/mappers/dividerComponentToProps.js +2 -0
- package/build/renderers/mappers/externalComponentToProps.js +4 -0
- package/build/renderers/mappers/formComponentToProps.js +8 -0
- package/build/renderers/mappers/formattedValueComponentToProps.js +5 -0
- package/build/renderers/mappers/headingComponentToProps.js +2 -0
- package/build/renderers/mappers/hiddenComponentToProps.js +1 -0
- package/build/renderers/mappers/imageComponentToProps.js +2 -0
- package/build/renderers/mappers/instructionsComponentToProps.js +2 -0
- package/build/renderers/mappers/integerInputComponentToProps.js +3 -0
- package/build/renderers/mappers/listComponentToProps.js +3 -0
- package/build/renderers/mappers/loadingIndicatorComponentToProps.js +2 -0
- package/build/renderers/mappers/markdownComponentToProps.js +2 -0
- package/build/renderers/mappers/mediaComponentToProps.js +2 -0
- package/build/renderers/mappers/modalComponentToProps.js +8 -0
- package/build/renderers/mappers/modalLayoutComponentToProps.js +13 -0
- package/build/renderers/mappers/moneyInputComponentToProps.js +36 -0
- package/build/renderers/mappers/multiSelectComponentToProps.js +19 -0
- package/build/renderers/mappers/multiUploadInputComponentToProps.js +7 -0
- package/build/renderers/mappers/numberInputComponentToProps.js +3 -0
- package/build/renderers/mappers/objectComponentToProps.js +8 -0
- package/build/renderers/mappers/paragraphComponentToProps.js +2 -0
- package/build/renderers/mappers/persistAsyncComponentToProps.js +7 -0
- package/build/renderers/mappers/progressComponentToProps.js +2 -0
- package/build/renderers/mappers/repeatableComponentToProps.js +22 -0
- package/build/renderers/mappers/reviewComponentToProps.js +3 -0
- package/build/renderers/mappers/rootComponentToProps.js +20 -0
- package/build/renderers/mappers/searchComponentToProps.js +45 -0
- package/build/renderers/mappers/sectionComponentToProps.js +7 -0
- package/build/renderers/mappers/selectInputComponentToProps.js +34 -0
- package/build/renderers/mappers/statusListComponentToProps.js +3 -0
- package/build/renderers/mappers/subflowComponentToRendererProps.js +26 -0
- package/build/renderers/mappers/tabsComponentToProps.js +14 -0
- package/build/renderers/mappers/textInputComponentToProps.js +3 -0
- package/build/renderers/mappers/tupleComponentToProps.js +8 -0
- package/build/renderers/mappers/updatableComponentToProps.js +6 -0
- package/build/renderers/mappers/uploadInputComponentToProps.js +5 -0
- package/build/renderers/mappers/upsellComponentToProps.js +3 -0
- package/build/renderers/mappers/utils/getValidationState.js +12 -0
- package/build/renderers/mappers/utils/inputComponentToProps.js +17 -0
- package/build/renderers/mappers/utils/mapCallToAction.js +23 -0
- package/build/renderers/mappers/utils/mapErrorsToValidationState.js +9 -0
- package/build/renderers/mappers/utils/mapRendererLoadingState.js +1 -0
- package/build/renderers/mappers/utils/pick.js +8 -0
- package/build/renderers/mappers/utils/selectInputOptionsToProps.js +11 -0
- package/build/renderers/stepComponentToProps.js +32 -0
- package/build/renderers/subflow/getDynamicSubflowRenderer.js +13 -0
- package/build/renderers/subflow/getNativeSubflowRenderer.js +26 -0
- package/build/renderers/utils.js +82 -0
- package/build/renderers/utils.test.js +70 -0
- package/build/stories/dev-tools/ContainerQueries.story.js +66 -0
- package/build/stories/dev-tools/Debugger.story.js +107 -0
- package/build/stories/dev-tools/FixtureSelect.story.js +23 -0
- package/build/stories/dev-tools/TestServer.story.js +118 -0
- package/build/stories/examples/NativeFlow.story.js +80 -0
- package/build/stories/examples/Recipients.story.js +568 -0
- package/build/stories/spec/behavior/Copy.story.js +71 -0
- package/build/stories/spec/behavior/Download.story.js +254 -0
- package/build/stories/spec/behavior/DynamicSubflow.story.js +272 -0
- package/build/stories/spec/behavior/Link.story.js +40 -0
- package/build/stories/spec/behavior/Modal.story.js +79 -0
- package/build/stories/spec/behavior/NativeSubflow.story.js +249 -0
- package/build/stories/spec/layouts/Alert.story.js +107 -0
- package/build/stories/spec/layouts/Box.Container-Widths.3-sizes.story.js +59 -0
- package/build/stories/spec/layouts/Box.Container-Widths.story.js +57 -0
- package/build/stories/spec/layouts/Box.Viewport-Widths.story.js +64 -0
- package/build/stories/spec/layouts/Collection.story.js +326 -0
- package/build/stories/spec/layouts/Decision.story.js +241 -0
- package/build/stories/spec/layouts/Image.Illustrations.Animated.story.js +37 -0
- package/build/stories/spec/layouts/Image.Sizes.story.js +58 -0
- package/build/stories/spec/layouts/List.story.js +60 -0
- package/build/stories/spec/layouts/Modal.story.js +81 -0
- package/build/stories/spec/layouts/Search.story.js +325 -0
- package/build/stories/spec/layouts/Updatable.story.js +135 -0
- package/build/stories/spec/layouts/Upsell.story.js +55 -0
- package/build/stories/spec/layouts/button/Button.story.js +111 -0
- package/build/stories/spec/layouts/button/PinnedButton.story.js +81 -0
- package/build/stories/spec/response/ActionResponse.story.js +66 -0
- package/build/stories/spec/schemas/InlineAlert.story.js +134 -0
- package/build/stories/spec/schemas/MultiSelect.story.js +206 -0
- package/build/stories/spec/schemas/Upload.story.js +168 -0
- package/build/stories/spec/schemas/const/ConstLayout.story.js +159 -0
- package/build/stories/spec/schemas/const/ObjectConst.story.js +94 -0
- package/build/stories/spec/schemas/date/DateSchema.story.js +60 -0
- package/build/stories/spec/schemas/features/PersistAsync.story.js +230 -0
- package/build/stories/spec/schemas/features/ValidationAsync.story.js +137 -0
- package/build/stories/spec/schemas/object/FormattedValue.story.js +92 -0
- package/build/stories/spec/schemas/object/MoneyInput.story.js +240 -0
- package/build/stories/spec/schemas/oneOf/OneOfInitialisation.story.js +55 -0
- package/build/stories/spec/schemas/oneOf/OneOfWithSingleOption.story.js +114 -0
- package/build/stories/spec/schemas/string/SsnInput.story.js +38 -0
- package/build/stories/spec/step/Controls.story.js +110 -0
- package/build/stories/spec/step/DFModal.story.js +58 -0
- package/build/stories/spec/step/Footer.story.js +90 -0
- package/build/stories/spec/step/Navigation.story.js +46 -0
- package/build/stories/spec/step/ScrollToBottom.story.js +103 -0
- package/build/stories/spec/step/Tags.story.js +39 -0
- package/build/stories/spec/step/ToolBar.story.js +60 -0
- package/build/stories/spec/step/features/ErrorHandling.story.js +92 -0
- package/build/stories/spec/step/features/External.story.js +91 -0
- package/build/stories/spec/step/features/LongFormError.story.js +88 -0
- package/build/stories/spec/step/features/Polling.story.js +108 -0
- package/build/stories/spec/step/features/RefreshAfter.story.js +92 -0
- package/build/stories/spec/step/features/refresh/Refresh.story.js +260 -0
- package/build/stories/spec/step/features/refresh/RefreshWithPersistAsync.story.js +958 -0
- package/build/stories/types.js +1 -0
- package/build/stories/utils/fixtureHttpClient.js +70 -0
- package/build/stories/utils/getBasicStep.js +223 -0
- package/build/stories/utils/mockSearchHandler.js +71 -0
- package/build/stories/utils/render-utils.js +59 -0
- package/build/stories/visual-tests/layouts/NotUsingListItem.story.js +17 -0
- package/build/test-utils/DynamicFlowWise.js +41 -0
- package/build/test-utils/DynamicFlowWiseModal.js +34 -0
- package/build/test-utils/NeptuneProviders.js +11 -0
- package/build/test-utils/component-utils.js +5 -0
- package/build/test-utils/dummy-native-subflows-handlers/dummySubflowHandlers.js +45 -0
- package/build/test-utils/dummy-native-subflows-handlers/geolocationSubflowHandler.js +30 -0
- package/build/test-utils/dummy-native-subflows-handlers/index.js +9 -0
- package/build/test-utils/dummy-native-subflows-handlers/notificationPermissionSubflowHandler.js +17 -0
- package/build/test-utils/fetch-utils.js +47 -0
- package/build/test-utils/getMergedTestRenderers.js +36 -0
- package/build/test-utils/getRandomId.js +1 -0
- package/build/test-utils/index.js +3 -0
- package/build/test-utils/mockIntersectionObserver.js +23 -0
- package/build/test-utils/openLinkInNewTab.js +15 -0
- package/build/test-utils/rtl-utils.js +7 -0
- package/build/test-utils/step-utils.js +6 -0
- package/build/test-utils/useSnackBar.js +4 -0
- package/build/test-utils/wait.js +3 -0
- package/build/tests/AlertLayout.test.js +228 -0
- package/build/tests/ArrayTuple.test.js +118 -0
- package/build/tests/ButtonLayout.test.js +356 -0
- package/build/tests/CollectionLayout.test.js +722 -0
- package/build/tests/CollectionLayout.v2.test.js +350 -0
- package/build/tests/ConstLayout.test.js +95 -0
- package/build/tests/DateInput.test.js +190 -0
- package/build/tests/DateSchema.test.js +171 -0
- package/build/tests/DecisionLayout.test.js +146 -0
- package/build/tests/DelayBehavior.test.js +186 -0
- package/build/tests/Download.test.js +201 -0
- package/build/tests/DynamicFlow.test.js +147 -0
- package/build/tests/External.test.js +169 -0
- package/build/tests/Flow.test.js +328 -0
- package/build/tests/FormLayout.test.js +28 -0
- package/build/tests/FormattedValue.test.js +107 -0
- package/build/tests/ImageRenderer.test.js +78 -0
- package/build/tests/InitialAction.test.js +235 -0
- package/build/tests/InitialStep.test.js +168 -0
- package/build/tests/InstructionsLayout.test.js +45 -0
- package/build/tests/ListLayout.test.js +165 -0
- package/build/tests/Logging.test.js +53 -0
- package/build/tests/ModalBehavior.test.js +149 -0
- package/build/tests/MoneyInput.test.js +313 -0
- package/build/tests/MultiUpload.test.js +293 -0
- package/build/tests/NativeBack.test.js +267 -0
- package/build/tests/NoOp.test.js +194 -0
- package/build/tests/OnLoad.test.js +153 -0
- package/build/tests/OneOfInitialisation.test.js +571 -0
- package/build/tests/PersistAsync.test.js +687 -0
- package/build/tests/Polling.test.js +708 -0
- package/build/tests/Prefetching.test.js +229 -0
- package/build/tests/RefreshAfter.test.js +63 -0
- package/build/tests/RefreshOnChange.ResponseHandling.test.js +199 -0
- package/build/tests/RefreshOnChange.test.js +233 -0
- package/build/tests/RefreshOnChange.with.Segmented.test.js +351 -0
- package/build/tests/RefreshOnChange.with.Tabs.test.js +359 -0
- package/build/tests/RefreshOnChangePreserve.test.js +221 -0
- package/build/tests/RendererProps.test.js +372 -0
- package/build/tests/Repeatable.test.js +104 -0
- package/build/tests/Rerendering.test.js +67 -0
- package/build/tests/ReviewLayout.test.js +271 -0
- package/build/tests/SchemaOnChange.test.js +133 -0
- package/build/tests/SchemaReferences.test.js +88 -0
- package/build/tests/ScrollToBottom.test.js +101 -0
- package/build/tests/ScrollToError.test.js +359 -0
- package/build/tests/ScrollToTop.test.js +95 -0
- package/build/tests/SegmentedControl.test.js +49 -0
- package/build/tests/SingleFileUpload.test.js +168 -0
- package/build/tests/StatusList.test.js +85 -0
- package/build/tests/Subflow.dynamic.test.js +887 -0
- package/build/tests/Subflow.native.test.js +448 -0
- package/build/tests/Submission.Const.test.js +70 -0
- package/build/tests/Submission.ResponseHandling.test.js +557 -0
- package/build/tests/Submission.merging.test.js +202 -0
- package/build/tests/Submission.test.js +821 -0
- package/build/tests/Tags.test.js +466 -0
- package/build/tests/UpdatableLayout.test.js +343 -0
- package/build/tests/Upsell.test.js +154 -0
- package/build/tests/ValidationAsync.test.js +295 -0
- package/build/tests/behavior/events.test.js +348 -0
- package/build/tests/legacy/Actions.test.js +158 -0
- package/build/tests/legacy/BackButton.test.js +114 -0
- package/build/tests/legacy/HiddenSchemas.test.js +250 -0
- package/build/tests/legacy/MultiSelect.test.js +546 -0
- package/build/tests/legacy/MultipleFileUploadSchema.test.js +350 -0
- package/build/tests/legacy/PersistAsync.blob-schema.test.js +224 -0
- package/build/tests/legacy/PersistAsync.string-schema.test.js +211 -0
- package/build/tests/legacy/RefreshStepOnChange.debouncing.test.js +209 -0
- package/build/tests/legacy/RefreshStepOnChange.test.js +421 -0
- package/build/tests/legacy/Search.test.js +439 -0
- package/build/tests/renderers/InlineAlertInSchemas.test.js +82 -0
- package/build/tests/renderers/MediaRenderer.test.js +74 -0
- package/build/tests/renderers/MultiSelectInputRendererProps.test.js +58 -0
- package/build/tests/renderers/SelectInputRendererProps.test.js +43 -0
- package/build/tests/renderers/TextInputRenderer.test.js +48 -0
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types.js +1 -0
- package/build/useDynamicFlow.js +110 -0
- package/build/useDynamicFlowModal.js +58 -0
- package/build/utils/analyse-step.js +14 -0
- package/build/utils/component-utils.js +8 -0
- package/build/utils/component-utils.test.js +113 -0
- package/build/utils/getScrollToTop.js +12 -0
- package/build/utils/normalise-flow-id.js +1 -0
- package/build/utils/normalise-flow-id.test.js +24 -0
- package/build/utils/recursiveMerge.js +40 -0
- package/build/utils/recursiveMerge.test.js +93 -0
- package/build/utils/safe-parse-link.js +14 -0
- package/build/utils/safe-parse-link.test.js +19 -0
- package/build/utils/type-utils.js +22 -0
- package/build/utils/type-validators.js +11 -0
- package/build/utils/type-validators.test.js +180 -0
- package/build/utils/useStableCallback.js +15 -0
- package/package.json +4 -4
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { mapSuggestions } from './suggestions-utils';
|
|
2
|
+
import { vi } from 'vitest';
|
|
3
|
+
describe('mapSuggestions', () => {
|
|
4
|
+
it('logs a warning when the value is a not a string', () => {
|
|
5
|
+
const logEvent = vi.fn();
|
|
6
|
+
const suggestions = {
|
|
7
|
+
values: [{ value: 123, label: 'Number suggestion' }],
|
|
8
|
+
};
|
|
9
|
+
mapSuggestions(suggestions, logEvent);
|
|
10
|
+
expect(logEvent).toHaveBeenCalledWith('warning', 'Suggestion values must be of type string. Found number instead.');
|
|
11
|
+
});
|
|
12
|
+
it('logs a warning when the value is null', () => {
|
|
13
|
+
const logEvent = vi.fn();
|
|
14
|
+
const suggestions = {
|
|
15
|
+
values: [{ value: null, label: 'Null suggestion' }],
|
|
16
|
+
};
|
|
17
|
+
mapSuggestions(suggestions, logEvent);
|
|
18
|
+
expect(logEvent).toHaveBeenCalledWith('warning', 'Suggestion values must be of type string. Found object instead.');
|
|
19
|
+
});
|
|
20
|
+
it('does not log a warning when the value is a string', () => {
|
|
21
|
+
const logEvent = vi.fn();
|
|
22
|
+
const suggestions = {
|
|
23
|
+
values: [{ value: 'string', label: 'String suggestion' }],
|
|
24
|
+
};
|
|
25
|
+
mapSuggestions(suggestions, logEvent);
|
|
26
|
+
expect(logEvent).not.toHaveBeenCalled();
|
|
27
|
+
});
|
|
28
|
+
it('does not log a warning when the value is an empty string', () => {
|
|
29
|
+
const logEvent = vi.fn();
|
|
30
|
+
const suggestions = {
|
|
31
|
+
values: [{ value: '', label: 'Empty string suggestion' }],
|
|
32
|
+
};
|
|
33
|
+
mapSuggestions(suggestions, logEvent);
|
|
34
|
+
expect(logEvent).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const mapTags = ({ tag, tags }) => tags !== null && tags !== void 0 ? tags : (tag != null ? [tag] : undefined);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { getDomainLayerBehavior } from './behavior-utils';
|
|
2
|
+
import { getHrefWithTracking } from './getHrefWithTracking';
|
|
3
|
+
import { mapLegacyContext } from './legacy-utils';
|
|
4
|
+
import { getDomainLayerMedia } from './media-utils';
|
|
5
|
+
export const mapInlineAlert = (alert) => {
|
|
6
|
+
return alert
|
|
7
|
+
? {
|
|
8
|
+
content: alert.content,
|
|
9
|
+
context: alert.context ? mapLegacyContext(alert.context) : 'neutral',
|
|
10
|
+
media: getDomainLayerMedia({ media: alert.media }),
|
|
11
|
+
}
|
|
12
|
+
: undefined;
|
|
13
|
+
};
|
|
14
|
+
export const mapAdditionalInfo = (info, mapperProps) => {
|
|
15
|
+
const { onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
|
|
16
|
+
if (info) {
|
|
17
|
+
const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
|
|
18
|
+
const isLink = behavior.type === 'link';
|
|
19
|
+
return {
|
|
20
|
+
text: info.text,
|
|
21
|
+
href: isLink ? behavior.url : undefined,
|
|
22
|
+
hrefWithTracking: getHrefWithTracking({
|
|
23
|
+
behavior,
|
|
24
|
+
onBehavior,
|
|
25
|
+
trackEvent,
|
|
26
|
+
}),
|
|
27
|
+
accessibilityDescription: info.accessibilityDescription,
|
|
28
|
+
onClick: behavior.type === 'none'
|
|
29
|
+
? undefined
|
|
30
|
+
: () => {
|
|
31
|
+
void onBehavior(behavior);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
};
|
|
37
|
+
export const mapSchemaAlert = (alert) => {
|
|
38
|
+
return alert
|
|
39
|
+
? {
|
|
40
|
+
content: alert.markdown,
|
|
41
|
+
context: alert.context ? mapLegacyContext(alert.context) : 'neutral',
|
|
42
|
+
media: getDomainLayerMedia({ media: alert.media }),
|
|
43
|
+
}
|
|
44
|
+
: undefined;
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import cs from './cs.json';
|
|
2
|
+
import de from './de.json';
|
|
3
|
+
import en from './en.json';
|
|
4
|
+
import es from './es.json';
|
|
5
|
+
import fr from './fr.json';
|
|
6
|
+
import hu from './hu.json';
|
|
7
|
+
import id from './id.json';
|
|
8
|
+
import it from './it.json';
|
|
9
|
+
import ja from './ja.json';
|
|
10
|
+
import nl from './nl.json';
|
|
11
|
+
import pl from './pl.json';
|
|
12
|
+
import pt from './pt.json';
|
|
13
|
+
import ro from './ro.json';
|
|
14
|
+
import ru from './ru.json';
|
|
15
|
+
import th from './th.json';
|
|
16
|
+
import tr from './tr.json';
|
|
17
|
+
import zhCN from './zh_CN.json';
|
|
18
|
+
import zhHK from './zh_HK.json';
|
|
19
|
+
const translations = {
|
|
20
|
+
cs,
|
|
21
|
+
en,
|
|
22
|
+
de,
|
|
23
|
+
es,
|
|
24
|
+
fr,
|
|
25
|
+
hu,
|
|
26
|
+
id,
|
|
27
|
+
it,
|
|
28
|
+
ja,
|
|
29
|
+
nl,
|
|
30
|
+
pl,
|
|
31
|
+
pt,
|
|
32
|
+
ro,
|
|
33
|
+
ru,
|
|
34
|
+
th,
|
|
35
|
+
tr,
|
|
36
|
+
zh: zhCN,
|
|
37
|
+
'zh-CN': zhCN,
|
|
38
|
+
'zh-HK': zhHK,
|
|
39
|
+
};
|
|
40
|
+
export default translations;
|
package/build/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { makeHttpClient } from './common/makeHttpClient';
|
|
2
|
+
export { default as translations } from './i18n';
|
|
3
|
+
export { findRendererPropsByType } from './renderers/utils';
|
|
4
|
+
export { useDynamicFlow } from './useDynamicFlow';
|
|
5
|
+
export { useDynamicFlowModal } from './useDynamicFlowModal';
|
|
6
|
+
export { DynamicFlowCore as DynamicFlow } from './DynamicFlowCore';
|
|
7
|
+
export { eventNames } from './domain/features/eventNames';
|
|
8
|
+
export { makeRequestCache } from './domain/features/prefetch/request-cache';
|
|
9
|
+
export { getDynamicSubflowRenderer } from './renderers/subflow/getDynamicSubflowRenderer';
|
package/build/main.css
CHANGED
|
@@ -143,13 +143,33 @@
|
|
|
143
143
|
background-position-x: 100%;
|
|
144
144
|
animation: shimmer 1s infinite linear;
|
|
145
145
|
transition: background 200ms;
|
|
146
|
-
border-color: var(--color-border-neutral);
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
.df-filter-loader .np-chip>* {
|
|
150
149
|
visibility: hidden;
|
|
151
150
|
}
|
|
152
151
|
|
|
152
|
+
/* v2 filter chips rest on a fainter border, leaving hover and press to Neptune,
|
|
153
|
+
scoped to the v2 filters as v1 shares the df-filters-container class */
|
|
154
|
+
.df-filters-collapsible-content .np-chip:not(:hover, :active) {
|
|
155
|
+
border-color: var(--color-border-overlay);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* selected chips keep the unselected fill, so only their border colour stands out,
|
|
159
|
+
except while loading, when every chip shares the unselected border */
|
|
160
|
+
.df-filters-container:not(.df-filter-loader) .np-chip.df-chip--selected {
|
|
161
|
+
border-color: var(--color-interactive-accent);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.np-theme-personal .df-filters-container:not(.df-filter-loader) .np-chip.df-chip--selected:not(.disabled) {
|
|
165
|
+
border-color: var(--color-interactive-primary);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/* Neptune's hover and press styles don't depend on a click handler, so chips without one opt out */
|
|
169
|
+
.df-filters-collapsible-content .np-chip.df-chip--static {
|
|
170
|
+
pointer-events: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
153
173
|
@keyframes shimmer {
|
|
154
174
|
to {
|
|
155
175
|
background-position-x: 0%;
|
|
@@ -321,9 +341,45 @@
|
|
|
321
341
|
width: 300px;
|
|
322
342
|
}
|
|
323
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* FIXME: .static-spotlight is magic CSS to work around Neptune limitation
|
|
346
|
+
* that a ListItem with Spotlight must have a control
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
/* Hide the dummy button. */
|
|
350
|
+
.static-spotlight .wds-list-item-control {
|
|
351
|
+
display: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Remove the clickable cursor and label interaction. */
|
|
355
|
+
.static-spotlight .wds-list-item-view {
|
|
356
|
+
cursor: revert !important;
|
|
357
|
+
pointer-events: none;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/* Preserve real links/buttons in additional info or prompts. */
|
|
361
|
+
.static-spotlight .wds-list-item-additional-info,
|
|
362
|
+
.static-spotlight .wds-list-item-prompt {
|
|
363
|
+
pointer-events: auto;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/* Keep the resting background during hover and press. */
|
|
367
|
+
.static-spotlight.wds-list-item-spotlight-active:not(.disabled):not(:disabled):is(:hover, :active) {
|
|
368
|
+
background-color: var(--color-background-neutral);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.static-spotlight.wds-list-item-spotlight-inactive:not(.disabled):not(:disabled):is(:hover, :active) {
|
|
372
|
+
background-color: color-mix(
|
|
373
|
+
in srgb,
|
|
374
|
+
var(--color-background-neutral) 25%,
|
|
375
|
+
transparent
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
|
|
324
379
|
.df-markdown> :last-child {
|
|
325
380
|
margin-bottom: 0px;
|
|
326
381
|
}
|
|
382
|
+
|
|
327
383
|
.df-media-layout-avatar {
|
|
328
384
|
display: flex;
|
|
329
385
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { findRendererPropsByType } from './utils';
|
|
3
|
+
export const CoreRootRenderer = {
|
|
4
|
+
canRenderType: 'root',
|
|
5
|
+
render: ({ children, childrenProps, subflow }) => {
|
|
6
|
+
if ((subflow === null || subflow === void 0 ? void 0 : subflow.presentation.type) === 'push') {
|
|
7
|
+
return _jsx(_Fragment, { children: subflow.children });
|
|
8
|
+
}
|
|
9
|
+
const [stepProps] = findRendererPropsByType(childrenProps, 'step');
|
|
10
|
+
return (_jsxs("div", { id: stepProps === null || stepProps === void 0 ? void 0 : stepProps.id, className: "dynamic-flow-step", children: [children, (subflow === null || subflow === void 0 ? void 0 : subflow.presentation.type) === 'modal' ? subflow.children : undefined] }));
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export const getRenderFunction = (renderers) => {
|
|
3
|
+
function ComponentRenderer(props) {
|
|
4
|
+
const { type } = props;
|
|
5
|
+
if (type === 'hidden') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
const renderer = renderers.find(({ canRenderType, canRender = () => true }) =>
|
|
9
|
+
// once the type is matched, we know the props are of the correct type
|
|
10
|
+
canRenderType === type && canRender(props));
|
|
11
|
+
if (!renderer) {
|
|
12
|
+
throw new Error(`Could not find a renderer for ${type}`);
|
|
13
|
+
}
|
|
14
|
+
// if renderer defined, we know props are of the correct type
|
|
15
|
+
return renderer.render(props);
|
|
16
|
+
}
|
|
17
|
+
const render = (props) => {
|
|
18
|
+
if (!props) {
|
|
19
|
+
return _jsx(_Fragment, {});
|
|
20
|
+
}
|
|
21
|
+
return _jsx(ComponentRenderer, Object.assign({}, props), props.uid);
|
|
22
|
+
};
|
|
23
|
+
return render;
|
|
24
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { formatDate } from '@transferwise/formatting';
|
|
2
|
+
import errorMessages from '../common/messages/validation.messages';
|
|
3
|
+
import genericErrorMessages from '../common/messages/generic-error.messages';
|
|
4
|
+
import arrayErrorMessages from '../common/messages/validation.array.messages';
|
|
5
|
+
import fileUploadMessages from '../common/messages/file-upload.messages';
|
|
6
|
+
import multiFileUploadMessages from '../common/messages/multi-file-upload.messages';
|
|
7
|
+
import downloadMessages from '../common/messages/download.messages';
|
|
8
|
+
export function getSchemaErrorMessageFunction(formatMessage, locale) {
|
|
9
|
+
return (validationMessages) => createErrorMessageFunctions(validationMessages !== null && validationMessages !== void 0 ? validationMessages : {}, formatMessage, locale);
|
|
10
|
+
}
|
|
11
|
+
const createErrorMessageFunctions = (validationMessages, formatMessage, locale) => ({
|
|
12
|
+
minimum(minimum) {
|
|
13
|
+
var _a;
|
|
14
|
+
return ((_a = validationMessages.minimum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.minimum, {
|
|
15
|
+
minimum,
|
|
16
|
+
}));
|
|
17
|
+
},
|
|
18
|
+
maximum(maximum) {
|
|
19
|
+
var _a;
|
|
20
|
+
return ((_a = validationMessages.maximum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.maximum, {
|
|
21
|
+
maximum,
|
|
22
|
+
}));
|
|
23
|
+
},
|
|
24
|
+
minimumDate(minimumDate) {
|
|
25
|
+
var _a;
|
|
26
|
+
return ((_a = validationMessages.minimum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.minimumDate, {
|
|
27
|
+
minimum: formatDate(new Date(minimumDate), locale, formatDateOptions),
|
|
28
|
+
}));
|
|
29
|
+
},
|
|
30
|
+
maximumDate(maximumDate) {
|
|
31
|
+
var _a;
|
|
32
|
+
return ((_a = validationMessages.maximum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.maximumDate, {
|
|
33
|
+
maximum: formatDate(new Date(maximumDate), locale, formatDateOptions),
|
|
34
|
+
}));
|
|
35
|
+
},
|
|
36
|
+
invalidDate() {
|
|
37
|
+
var _a;
|
|
38
|
+
return (_a = validationMessages.invalidDate) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.patternDate);
|
|
39
|
+
},
|
|
40
|
+
minLength(minLength) {
|
|
41
|
+
var _a;
|
|
42
|
+
return ((_a = validationMessages.minLength) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.minLength, {
|
|
43
|
+
minLength,
|
|
44
|
+
}));
|
|
45
|
+
},
|
|
46
|
+
maxLength(maxLength) {
|
|
47
|
+
var _a;
|
|
48
|
+
return ((_a = validationMessages.maxLength) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.maxLength, {
|
|
49
|
+
maxLength,
|
|
50
|
+
}));
|
|
51
|
+
},
|
|
52
|
+
minItems(minItems) {
|
|
53
|
+
var _a;
|
|
54
|
+
return ((_a = validationMessages.minItems) !== null && _a !== void 0 ? _a : formatMessage(arrayErrorMessages.minItemsError, {
|
|
55
|
+
minItems,
|
|
56
|
+
}));
|
|
57
|
+
},
|
|
58
|
+
maxItems(maxItems) {
|
|
59
|
+
var _a;
|
|
60
|
+
return ((_a = validationMessages.maxItems) !== null && _a !== void 0 ? _a : formatMessage(arrayErrorMessages.maxItemsError, {
|
|
61
|
+
maxItems,
|
|
62
|
+
}));
|
|
63
|
+
},
|
|
64
|
+
minFiles(minItems) {
|
|
65
|
+
var _a;
|
|
66
|
+
return ((_a = validationMessages.minItems) !== null && _a !== void 0 ? _a : formatMessage(multiFileUploadMessages.minItemsError, {
|
|
67
|
+
minItems,
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
maxFiles(maxItems) {
|
|
71
|
+
var _a;
|
|
72
|
+
return ((_a = validationMessages.maxItems) !== null && _a !== void 0 ? _a : formatMessage(multiFileUploadMessages.maxItemsError, {
|
|
73
|
+
maxItems,
|
|
74
|
+
}));
|
|
75
|
+
},
|
|
76
|
+
maxSize() {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = validationMessages.maxSize) !== null && _a !== void 0 ? _a : formatMessage(fileUploadMessages.maxFileSizeError);
|
|
79
|
+
},
|
|
80
|
+
accepts() {
|
|
81
|
+
var _a;
|
|
82
|
+
return (_a = validationMessages.accepts) !== null && _a !== void 0 ? _a : formatMessage(fileUploadMessages.wrongFileTypeError);
|
|
83
|
+
},
|
|
84
|
+
pattern() {
|
|
85
|
+
var _a;
|
|
86
|
+
return (_a = validationMessages.pattern) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.pattern);
|
|
87
|
+
},
|
|
88
|
+
required() {
|
|
89
|
+
var _a;
|
|
90
|
+
return (_a = validationMessages.required) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.required);
|
|
91
|
+
},
|
|
92
|
+
genericError() {
|
|
93
|
+
return formatMessage(genericErrorMessages.genericError);
|
|
94
|
+
},
|
|
95
|
+
genericErrorWithRetry() {
|
|
96
|
+
return formatMessage(genericErrorMessages.genericErrorRetryHint);
|
|
97
|
+
},
|
|
98
|
+
downloadStarted() {
|
|
99
|
+
return formatMessage(downloadMessages.downloadStarted);
|
|
100
|
+
},
|
|
101
|
+
downloadFailed() {
|
|
102
|
+
return formatMessage(downloadMessages.downloadFailed);
|
|
103
|
+
},
|
|
104
|
+
downloadSuccessful() {
|
|
105
|
+
return formatMessage(downloadMessages.downloadSuccessful);
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
const formatDateOptions = {
|
|
109
|
+
timeZone: 'UTC',
|
|
110
|
+
dateStyle: 'long',
|
|
111
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { mapCallToActionOptional } from './utils/mapCallToAction';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
export const alertComponentToProps = (component, rendererMapperProps) => (Object.assign(Object.assign(Object.assign({}, pick(component, 'uid', 'analyticsId', 'type', 'context', 'control', 'margin', 'markdown', 'media', 'tags', 'title')), { callToAction: mapCallToActionOptional(component.callToAction), onDismiss: component.dismiss, secondaryCallToAction: mapCallToActionOptional(component.secondaryCallToAction) }), rendererMapperProps));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { componentToRendererProps } from './componentToRendererProps';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
export const allOfComponentToProps = (component, rendererMapperProps) => {
|
|
4
|
+
const childrenProps = component.components.map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
5
|
+
return Object.assign(Object.assign(Object.assign({ type: 'form-section' }, pick(component, 'uid', 'analyticsId', 'control', 'description', 'help', 'media', 'tags', 'title')), rendererMapperProps), { children: childrenProps.map(rendererMapperProps.render), childrenProps });
|
|
6
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { inputComponentToProps } from './utils/inputComponentToProps';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
export const booleanInputComponentToProps = (component, rendererMapperProps) => { var _a; return (Object.assign(Object.assign(Object.assign(Object.assign({}, inputComponentToProps(component, 'input-checkbox')), rendererMapperProps), pick(component, 'additionalText', 'supportingValues', 'inlineAlert')), { onChange: component.setValue, value: (_a = component.value) !== null && _a !== void 0 ? _a : false })); };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { componentToRendererProps } from './componentToRendererProps';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
export const boxComponentToProps = (component, rendererMapperProps) => {
|
|
4
|
+
const childrenProps = component.components.map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
5
|
+
const { border, control } = component;
|
|
6
|
+
return Object.assign(Object.assign(Object.assign({}, pick(component, 'uid', 'analyticsId', 'type', 'control', 'width', 'margin', 'tags')), rendererMapperProps), { control: mapBoxControl({ border, control }), children: childrenProps.map(rendererMapperProps.render), childrenProps });
|
|
7
|
+
};
|
|
8
|
+
const mapBoxControl = ({ border, control, }) => {
|
|
9
|
+
if (border && control == null) {
|
|
10
|
+
return 'bordered';
|
|
11
|
+
}
|
|
12
|
+
return control;
|
|
13
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { pick } from './utils/pick';
|
|
2
|
+
export const buttonComponentToProps = (component, rendererMapperProps) => {
|
|
3
|
+
return Object.assign(Object.assign(Object.assign({ type: 'button' }, pick(component, 'uid', 'analyticsId', 'title', 'control', 'context', 'margin', 'media', 'pinOrder', 'size', 'onClick', 'tags')), { disabled: component.disabled || rendererMapperProps.stepLoadingState !== 'idle' }), rendererMapperProps);
|
|
4
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { componentToRendererProps } from './componentToRendererProps';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
import { mapAdditionalInfo, mapCallToActionOptional } from './utils/mapCallToAction';
|
|
4
|
+
export const collectionComponentToProps = (component, rendererMapperProps) => {
|
|
5
|
+
const { stack } = component;
|
|
6
|
+
return Object.assign(Object.assign(Object.assign({}, pick(component, 'uid', 'analyticsId', 'type', 'control', 'margin', 'tags', 'fork', 'pop')), rendererMapperProps), { state: mapCollectionState(component, component.getActiveState(), rendererMapperProps), onSearchChange: (query) => component.search(component.getActiveState(), query), depth: stack.length - 1 });
|
|
7
|
+
};
|
|
8
|
+
const mapCollectionState = (component, state, rendererMapperProps) => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
var _c, _d;
|
|
11
|
+
const { render } = rendererMapperProps;
|
|
12
|
+
const { search } = state;
|
|
13
|
+
const beforeSectionsProps = (_c = (_a = state.beforeSections) === null || _a === void 0 ? void 0 : _a.map((child) => componentToRendererProps(child, rendererMapperProps))) !== null && _c !== void 0 ? _c : [];
|
|
14
|
+
const afterSectionsProps = (_d = (_b = state.afterSections) === null || _b === void 0 ? void 0 : _b.map((child) => componentToRendererProps(child, rendererMapperProps))) !== null && _d !== void 0 ? _d : [];
|
|
15
|
+
return {
|
|
16
|
+
id: state.id,
|
|
17
|
+
status: mapStatus(component, state),
|
|
18
|
+
sections: mapSections(state.sections, rendererMapperProps),
|
|
19
|
+
filters: mapFilters(component, state),
|
|
20
|
+
beforeSectionsProps,
|
|
21
|
+
beforeSections: beforeSectionsProps.map(render),
|
|
22
|
+
afterSectionsProps,
|
|
23
|
+
afterSections: afterSectionsProps.map(render),
|
|
24
|
+
search: search
|
|
25
|
+
? Object.assign(Object.assign({}, pick(search, 'title', 'hint', 'hints', 'query')), { initialSections: search.initialSections
|
|
26
|
+
? mapSections(search.initialSections, rendererMapperProps)
|
|
27
|
+
: undefined }) : undefined,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
// TODO update renderers to use a different structure, this is just to avoid breaking them
|
|
31
|
+
const mapStatus = (component, state) => {
|
|
32
|
+
const { status } = state;
|
|
33
|
+
switch (status.type) {
|
|
34
|
+
case 'idle':
|
|
35
|
+
return {
|
|
36
|
+
type: 'idle',
|
|
37
|
+
loadMore: state.nextCursor ? () => component.loadMore(state) : undefined,
|
|
38
|
+
};
|
|
39
|
+
case 'loading':
|
|
40
|
+
return status;
|
|
41
|
+
case 'error':
|
|
42
|
+
return Object.assign(Object.assign({}, status), { retry: () => component.retry(state) });
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const mapFilters = (component, state) => { var _a; return ((_a = state.filters) !== null && _a !== void 0 ? _a : []).map((filter, filterIndex) => (Object.assign(Object.assign({}, filter), { options: filter.options.map((option, optionIndex) => (Object.assign(Object.assign({}, option), { onSelect: () => component.selectFilter(state, filterIndex, optionIndex) }))) }))); };
|
|
46
|
+
const mapSections = (sections, rendererMapperProps) => sections.map((section) => mapSection(section, rendererMapperProps));
|
|
47
|
+
const mapSection = (section, rendererMapperProps) => {
|
|
48
|
+
const baseProps = Object.assign(Object.assign({}, section), { callToAction: mapCallToActionOptional(section.callToAction) });
|
|
49
|
+
if (section.type === 'layout') {
|
|
50
|
+
const childrenProps = section.components.map((child) => componentToRendererProps(child, rendererMapperProps));
|
|
51
|
+
return Object.assign(Object.assign({}, baseProps), { type: 'layout', childrenProps, children: childrenProps.map(rendererMapperProps.render) });
|
|
52
|
+
}
|
|
53
|
+
return Object.assign(Object.assign({}, baseProps), { type: 'items', items: section.items.map((item) => (Object.assign(Object.assign({}, item), { callToAction: mapCallToActionOptional(item.callToAction), additionalInfo: mapAdditionalInfo(item.additionalInfo), disabled: rendererMapperProps.stepLoadingState !== 'idle' || item.disabled }))) });
|
|
54
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { componentToRendererProps } from './componentToRendererProps';
|
|
2
|
+
import { pick } from './utils/pick';
|
|
3
|
+
export const columnsComponentToProps = (component, rendererMapperProps) => {
|
|
4
|
+
const startChildrenProps = component.startComponents.map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
5
|
+
const endChildrenProps = component.endComponents.map((c) => componentToRendererProps(c, rendererMapperProps));
|
|
6
|
+
return Object.assign(Object.assign(Object.assign({}, rendererMapperProps), pick(component, 'uid', 'analyticsId', 'type', 'bias', 'control', 'margin', 'tags')), { startChildren: startChildrenProps.map(rendererMapperProps.render), endChildren: endChildrenProps.map(rendererMapperProps.render), startChildrenProps,
|
|
7
|
+
endChildrenProps });
|
|
8
|
+
};
|