@wise/dynamic-flow-client 3.5.0-experimental-6654c72 → 3.5.0-experimental-63c768d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/makeHttpClient/makeHttpClient.spec.js +141 -0
- package/build/i18n/de.json +46 -46
- package/build/i18n/en.json +46 -46
- package/build/i18n/es.json +46 -46
- package/build/i18n/fr.json +46 -46
- package/build/i18n/hu.json +46 -46
- package/build/i18n/id.json +46 -46
- package/build/i18n/it.json +46 -46
- package/build/i18n/ja.json +46 -46
- package/build/i18n/pl.json +46 -46
- package/build/i18n/pt.json +46 -46
- package/build/i18n/ro.json +46 -46
- package/build/i18n/ru.json +46 -46
- package/build/i18n/th.json +46 -46
- package/build/i18n/tr.json +46 -46
- package/build/i18n/zh_CN.json +46 -46
- package/build/i18n/zh_HK.json +46 -46
- package/build/index.js +10 -0
- package/build/legacy/common/contexts/eventsContext/EventsContext.spec.js +58 -0
- package/build/legacy/common/contexts/featureContext/FeatureContext.spec.js +41 -0
- package/build/legacy/common/contexts/logContext/LogContext.spec.js +54 -0
- package/build/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.spec.js +59 -0
- package/build/legacy/common/hooks/useExternal/useExternal.spec.js +236 -0
- package/build/legacy/common/hooks/useStepPolling/useStepPolling.spec.js +288 -0
- package/build/legacy/common/utils/debounce.spec.js +72 -0
- package/build/legacy/common/utils/file-utils.spec.js +69 -0
- package/build/legacy/common/utils/id-utils.spec.js +12 -0
- package/build/legacy/common/utils/is-equal.spec.js +88 -0
- package/build/legacy/common/utils/mobile-utils.spec.js +71 -0
- package/build/legacy/common/validators/models/model-utils.spec.js +45 -0
- package/build/legacy/common/validators/models/model-validators.spec.js +647 -0
- package/build/legacy/common/validators/schemas/schema-validators.spec.js +157 -0
- package/build/legacy/common/validators/types/type-validators.spec.js +147 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.spec.js +198 -0
- package/build/legacy/common/validators/validationFailures/validation-failures.utils.spec.js +145 -0
- package/build/legacy/common/validators/values/value-validators.spec.js +22 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/DynamicFlow.story.js +78 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ErrorResponses.story.js +124 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Examples.story.js +25 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Features.story.js +33 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/JsonSchemaForm.story.js +31 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/RefreshOnChange.story.js +194 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/SearchFeature.story.js +114 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ServerTest.story.js +44 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/Upload.story.js +212 -0
- package/build/legacy/dynamicFlow/stories/dev-tools/ValidationAsync.story.js +156 -0
- package/build/legacy/dynamicFlow/stories/examples/ObjectConst.story.js +150 -0
- package/build/legacy/dynamicFlow/stories/fixtureHttpClient.js +117 -0
- package/build/legacy/dynamicFlow/stories/visual-tests/VisualTests.story.js +43 -0
- package/build/legacy/dynamicFlow/tests/Actions.spec.js +185 -0
- package/build/legacy/dynamicFlow/tests/AllOfSchema.spec.js +196 -0
- package/build/legacy/dynamicFlow/tests/AutocompleteHints.spec.js +59 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.BackButton.spec.js +179 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.search.spec.js +475 -0
- package/build/legacy/dynamicFlow/tests/DynamicFlow.spec.js +559 -0
- package/build/legacy/dynamicFlow/tests/DynamicImage.spec.js +287 -0
- package/build/legacy/dynamicFlow/tests/DynamicInstructions.spec.js +49 -0
- package/build/legacy/dynamicFlow/tests/HiddenSchemas.spec.js +307 -0
- package/build/legacy/dynamicFlow/tests/ModalLayout.spec.js +252 -0
- package/build/legacy/dynamicFlow/tests/MultiSelect.spec.js +327 -0
- package/build/legacy/dynamicFlow/tests/MultipleFileUploadSchema.spec.js +401 -0
- package/build/legacy/dynamicFlow/tests/ObjectSchema.spec.js +295 -0
- package/build/legacy/dynamicFlow/tests/OneOfSchema.spec.js +773 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.blob-schema.spec.js +331 -0
- package/build/legacy/dynamicFlow/tests/PersistAsync.string-schema.spec.js +389 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.debouncing.spec.js +273 -0
- package/build/legacy/dynamicFlow/tests/RefreshStepOnChange.spec.js +567 -0
- package/build/legacy/dynamicFlow/tests/RepeatableSchema.spec.js +977 -0
- package/build/legacy/dynamicFlow/tests/StepModel.spec.js +119 -0
- package/build/legacy/dynamicFlow/tests/ValidationAsync.spec.js +484 -0
- package/build/legacy/dynamicFlow/tests/ssr.spec.js +47 -0
- package/build/legacy/dynamicFlow/utils/responseParsers/response-parsers.spec.js +463 -0
- package/build/legacy/formControl/Select.spec.js +104 -0
- package/build/legacy/formControl/utils/getAutocompleteString.spec.js +30 -0
- package/build/legacy/formControl/utils/value-utils.spec.js +158 -0
- package/build/legacy/jsonSchemaForm/JsonSchemaForm.end-to-end.spec.js +563 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
- package/build/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/utils/summary-utils.spec.js +909 -0
- package/build/legacy/jsonSchemaForm/genericSchema/GenericSchema.rtl.spec.js +55 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.spec.js +312 -0
- package/build/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.spec.js +231 -0
- package/build/legacy/layout/button/DynamicButton.spec.js +152 -0
- package/build/legacy/layout/button/utils.spec.js +50 -0
- package/build/legacy/layout/icon/DynamicIcon.spec.js +20 -0
- package/build/legacy/layout/list/DynamicStatusList.spec.js +111 -0
- package/build/legacy/layout/loadingIndicator/DynamicLoadingIndicator.spec.js +25 -0
- package/build/legacy/layout/markdown/DynamicMarkdown.spec.js +58 -0
- package/build/legacy/layout/review/DynamicReview.spec.js +152 -0
- package/build/legacy/step/cameraStep/cameraCapture/CameraCapture.spec.js +432 -0
- package/build/legacy/test-utils/DynamicFlowProviders.js +19 -0
- package/build/legacy/test-utils/index.js +4 -0
- package/build/legacy/test-utils/legacy-utils.js +69 -0
- package/build/legacy/test-utils/log-utils.js +9 -0
- package/build/main.js +20 -20
- package/build/main.min.js +1 -1
- package/build/main.mjs +20 -20
- package/build/revamp/DynamicFlowCore.js +299 -0
- package/build/revamp/DynamicFlowWise.js +69 -0
- package/build/revamp/DynamicFlowWise.spec.js +105 -0
- package/build/revamp/domain/components/repeatableComponent/RepeatableComponent.spec.js +145 -0
- package/build/revamp/domain/components/searchComponent/SearchComponent.spec.js +327 -0
- package/build/revamp/domain/components/utils/debounce.spec.js +72 -0
- package/build/revamp/domain/components/utils/isPartialLocalValueMatch.spec.js +108 -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.spec.js +280 -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.spec.js +110 -0
- package/build/revamp/domain/features/validation/spec-utils.js +16 -0
- package/build/revamp/domain/features/validation/validation-functions.spec.js +110 -0
- package/build/revamp/domain/features/validation/value-checks.spec.js +204 -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.spec.js +266 -0
- package/build/revamp/domain/mappers/layout/alertLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/boxLayoutToComponents.js +15 -0
- package/build/revamp/domain/mappers/layout/buttonLayoutToComponent.js +64 -0
- package/build/revamp/domain/mappers/layout/columnsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/decisionLayoutToComponent.js +36 -0
- package/build/revamp/domain/mappers/layout/dividerLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/formLayoutToComponent.js +27 -0
- package/build/revamp/domain/mappers/layout/headingLayoutToComponent.js +13 -0
- package/build/revamp/domain/mappers/layout/imageLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/infoLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/instructionsLayoutToComponent.js +18 -0
- package/build/revamp/domain/mappers/layout/listLayoutToComponent.js +30 -0
- package/build/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.js +5 -0
- package/build/revamp/domain/mappers/layout/markdownLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/modalLayoutToComponent.js +17 -0
- package/build/revamp/domain/mappers/layout/paragraphLayoutToComponent.js +12 -0
- package/build/revamp/domain/mappers/layout/reviewLayoutToComponent.js +51 -0
- package/build/revamp/domain/mappers/layout/searchLayoutToComponent.js +14 -0
- package/build/revamp/domain/mappers/layout/statusListLayoutToComponent.js +11 -0
- package/build/revamp/domain/mappers/mapLayoutToComponent.js +63 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.js +84 -0
- package/build/revamp/domain/mappers/mapSchemaToComponent.spec.js +197 -0
- package/build/revamp/domain/mappers/mapStepToComponent.js +143 -0
- package/build/revamp/domain/mappers/mapStepToComponent.spec.js +184 -0
- package/build/revamp/domain/mappers/schema/allOfSchemaToComponent.js +29 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.js +63 -0
- package/build/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.js +65 -0
- package/build/revamp/domain/mappers/schema/blobSchemaToComponent.js +30 -0
- package/build/revamp/domain/mappers/schema/booleanSchemaToComponent.js +38 -0
- package/build/revamp/domain/mappers/schema/constSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/integerSchemaToComponent.js +36 -0
- package/build/revamp/domain/mappers/schema/numberSchemaToComponent.js +35 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.js +41 -0
- package/build/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.spec.js +165 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.js +67 -0
- package/build/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.spec.js +316 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.js +14 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.spec.js +220 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.js +37 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.js +45 -0
- package/build/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.js +32 -0
- package/build/revamp/domain/mappers/schema/tests/test-utils.js +27 -0
- package/build/revamp/domain/mappers/schema/types.js +1 -0
- package/build/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.js +35 -0
- package/build/revamp/domain/mappers/schema/utils/getValidationAsyncInitialState.js +25 -0
- package/build/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.js +28 -0
- package/build/revamp/domain/mappers/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/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 +1 -1
- package/build/revamp/renderers/getRenderFunction.js +55 -0
- package/build/revamp/renderers/getSchemaErrorMessageFunction.js +90 -0
- package/build/revamp/renderers/mappers/alertComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/allOfComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/booleanInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/boxComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/buttonComponentToProps.js +14 -0
- package/build/revamp/renderers/mappers/columnsComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/componentToRendererProps.js +105 -0
- package/build/revamp/renderers/mappers/containerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dateInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/decisionComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/dividerComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/formComponentToProps.js +4 -0
- package/build/revamp/renderers/mappers/headingComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/hiddenComponentToProps.js +3 -0
- package/build/revamp/renderers/mappers/imageComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/instructionsComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/integerInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/loadingIndicatorComponentToProps.js +9 -0
- package/build/revamp/renderers/mappers/markdownComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/modalComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/multiUploadInputComponentToProps.js +24 -0
- package/build/revamp/renderers/mappers/numberInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/objectComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/paragraphComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/repeatableComponentToProps.js +40 -0
- package/build/revamp/renderers/mappers/reviewComponentToProps.js +11 -0
- package/build/revamp/renderers/mappers/searchComponentToProps.js +49 -0
- package/build/revamp/renderers/mappers/selectInputComponentToProps.js +29 -0
- package/build/revamp/renderers/mappers/statusListComponentToProps.js +10 -0
- package/build/revamp/renderers/mappers/textInputComponentToProps.js +13 -0
- package/build/revamp/renderers/mappers/uploadInputComponentToProps.js +16 -0
- package/build/revamp/renderers/mappers/utils/inputComponentToProps.js +27 -0
- package/build/revamp/renderers/step/ExternalConfirmationDialog.js +31 -0
- package/build/revamp/renderers/step/StepRenderer.js +29 -0
- package/build/revamp/renderers/step/useExternal.js +15 -0
- package/build/revamp/renderers/stepComponentToProps.js +9 -0
- package/build/revamp/stories/dev-tools/DynamicFlowRevamp.story.js +304 -0
- package/build/revamp/stories/dev-tools/EditableStep.story.js +71 -0
- package/build/revamp/stories/dev-tools/ErrorHandling.story.js +149 -0
- package/build/revamp/stories/dev-tools/External.story.js +83 -0
- package/build/revamp/stories/dev-tools/OneOf.Inititalisation.story.js +123 -0
- package/build/revamp/stories/dev-tools/PersistAsync.story.js +168 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.story.js +309 -0
- package/build/revamp/stories/dev-tools/RefreshOnChange.with.PersistAsync.story.js +1004 -0
- package/build/revamp/stories/dev-tools/ServerTest.story.js +81 -0
- package/build/revamp/stories/dev-tools/Upload.story.js +221 -0
- package/build/revamp/stories/dev-tools/ValidationAsync.story.js +161 -0
- package/build/revamp/stories/examples/ObjectConst.story.js +153 -0
- package/build/revamp/stories/examples/OneOfInitialisation.story.js +102 -0
- package/build/revamp/stories/utils/fixtureHttpClient.js +130 -0
- package/build/revamp/stories/utils/mockSearchHandler.js +125 -0
- package/build/revamp/stories/visual-tests/VisualTests.story.js +111 -0
- package/build/revamp/test-utils/component-utils.js +19 -0
- package/build/revamp/test-utils/step-utils.js +6 -0
- package/build/revamp/tests/ImageRenderer.spec.js +108 -0
- package/build/revamp/tests/InitialAction.spec.js +281 -0
- package/build/revamp/tests/InitialStep.spec.js +104 -0
- package/build/revamp/tests/Logging.spec.js +112 -0
- package/build/revamp/tests/OneOfInitialisation.spec.js +654 -0
- package/build/revamp/tests/RefreshOnChange.ResponseHandling.spec.js +322 -0
- package/build/revamp/tests/RefreshOnChange.with.Tabs.spec.js +390 -0
- package/build/revamp/tests/RefreshOnChangePreserve.spec.js +218 -0
- package/build/revamp/tests/Submission.ResponseHandling.spec.js +697 -0
- package/build/revamp/tests/Submission.spec.js +399 -0
- package/build/revamp/tests/legacy/HiddenSchemas.spec.js +312 -0
- package/build/revamp/tests/legacy/MultipleFileUploadSchema.spec.js +447 -0
- package/build/revamp/tests/legacy/PersistAsync.blob-schema.spec.js +339 -0
- package/build/revamp/tests/legacy/PersistAsync.string-schema.spec.js +385 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.debouncing.spec.js +235 -0
- package/build/revamp/tests/legacy/RefreshStepOnChange.spec.js +623 -0
- package/build/revamp/tests/legacy/ValidationAsync.spec.js +452 -0
- package/build/revamp/tests/legacy/useExternal.spec.js +235 -0
- package/build/revamp/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-validators.spec.js +163 -0
- package/build/revamp/utils/useStableCallback.js +21 -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/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/value-utils.js +23 -0
- package/build/revamp/wise/renderers/utils/value-utils.spec.js +33 -0
- package/build/revamp/wise/renderers/validators/type-validators.js +15 -0
- package/build/test-utils/NeptuneProviders.js +23 -0
- package/build/test-utils/fetch-utils.js +104 -0
- package/build/test-utils/index.js +2 -0
- package/build/test-utils/rtl-utils.js +20 -0
- package/package.json +3 -2
|
@@ -0,0 +1,55 @@
|
|
|
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 { componentToRendererProps } from './mappers/componentToRendererProps';
|
|
14
|
+
import { isColumnsComponent, hasChildren, isRepeatableComponent } from '../utils/type-utils';
|
|
15
|
+
export var getRenderFunction = function (renderers) {
|
|
16
|
+
function ComponentRenderer(props) {
|
|
17
|
+
var type = props.type;
|
|
18
|
+
if (type === 'hidden') {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
var renderer = renderers.find(function (_a) {
|
|
22
|
+
var canRenderType = _a.canRenderType, _b = _a.canRender, canRender = _b === void 0 ? function () { return true; } : _b;
|
|
23
|
+
// once the type is matched, we know the props are of the correct type
|
|
24
|
+
return canRenderType === type && canRender(props);
|
|
25
|
+
});
|
|
26
|
+
if (!renderer) {
|
|
27
|
+
throw new Error("Could not find a renderer for ".concat(type));
|
|
28
|
+
}
|
|
29
|
+
// if renderer defined, we know props are of the correct type
|
|
30
|
+
return renderer.render(props);
|
|
31
|
+
}
|
|
32
|
+
var getNestedContent = function (component) {
|
|
33
|
+
if (!hasChildren(component)) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
if (isColumnsComponent(component)) {
|
|
37
|
+
return {
|
|
38
|
+
startChildren: component.startComponents.map(render),
|
|
39
|
+
endChildren: component.endComponents.map(render)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (isRepeatableComponent(component)) {
|
|
43
|
+
return {
|
|
44
|
+
// We specifically only want components here, because getChildren() includes the editable component
|
|
45
|
+
children: component.components.map(render),
|
|
46
|
+
editableItemChildren: component.editableComponent !== null ? render(component.editableComponent) : null
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
children: component.getChildren().map(render)
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
var render = function (component) { return (_jsx(ComponentRenderer, __assign({}, componentToRendererProps(component, getNestedContent(component))), component.uid)); };
|
|
54
|
+
return render;
|
|
55
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
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 multiFileUploadMessages from '../../common/messages/multi-file-upload.messages';
|
|
5
|
+
import arrayErrorMessages from '../../common/messages/validation.array.messages';
|
|
6
|
+
export function getSchemaErrorMessageFunction(formatMessage, locale) {
|
|
7
|
+
return function (validationMessages) {
|
|
8
|
+
return createErrorMessageFunctions(validationMessages !== null && validationMessages !== void 0 ? validationMessages : {}, formatMessage, locale);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
var createErrorMessageFunctions = function (validationMessages, formatMessage, locale) { return ({
|
|
12
|
+
minimum: function (minimum) {
|
|
13
|
+
var _a;
|
|
14
|
+
return ((_a = validationMessages.minimum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.minimum, {
|
|
15
|
+
minimum: minimum
|
|
16
|
+
}));
|
|
17
|
+
},
|
|
18
|
+
maximum: function (maximum) {
|
|
19
|
+
var _a;
|
|
20
|
+
return ((_a = validationMessages.maximum) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.maximum, {
|
|
21
|
+
maximum: maximum
|
|
22
|
+
}));
|
|
23
|
+
},
|
|
24
|
+
minimumDate: function (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: function (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
|
+
minLength: function (minLength) {
|
|
37
|
+
var _a;
|
|
38
|
+
return ((_a = validationMessages.minLength) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.minLength, {
|
|
39
|
+
minLength: minLength
|
|
40
|
+
}));
|
|
41
|
+
},
|
|
42
|
+
maxLength: function (maxLength) {
|
|
43
|
+
var _a;
|
|
44
|
+
return ((_a = validationMessages.maxLength) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.maxLength, {
|
|
45
|
+
maxLength: maxLength
|
|
46
|
+
}));
|
|
47
|
+
},
|
|
48
|
+
minItems: function (minItems) {
|
|
49
|
+
var _a;
|
|
50
|
+
return ((_a = validationMessages.minItems) !== null && _a !== void 0 ? _a : formatMessage(arrayErrorMessages.minItemsError, {
|
|
51
|
+
minItems: minItems
|
|
52
|
+
}));
|
|
53
|
+
},
|
|
54
|
+
maxItems: function (maxItems) {
|
|
55
|
+
var _a;
|
|
56
|
+
return ((_a = validationMessages.maxItems) !== null && _a !== void 0 ? _a : formatMessage(arrayErrorMessages.maxItemsError, {
|
|
57
|
+
maxItems: maxItems
|
|
58
|
+
}));
|
|
59
|
+
},
|
|
60
|
+
minFiles: function (minItems) {
|
|
61
|
+
var _a;
|
|
62
|
+
return ((_a = validationMessages.minItems) !== null && _a !== void 0 ? _a : formatMessage(multiFileUploadMessages.minItemsError, {
|
|
63
|
+
minItems: minItems
|
|
64
|
+
}));
|
|
65
|
+
},
|
|
66
|
+
maxFiles: function (maxItems) {
|
|
67
|
+
var _a;
|
|
68
|
+
return ((_a = validationMessages.maxItems) !== null && _a !== void 0 ? _a : formatMessage(multiFileUploadMessages.maxItemsError, {
|
|
69
|
+
maxItems: maxItems
|
|
70
|
+
}));
|
|
71
|
+
},
|
|
72
|
+
pattern: function () {
|
|
73
|
+
var _a;
|
|
74
|
+
return (_a = validationMessages.pattern) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.pattern);
|
|
75
|
+
},
|
|
76
|
+
required: function () {
|
|
77
|
+
var _a;
|
|
78
|
+
return (_a = validationMessages.required) !== null && _a !== void 0 ? _a : formatMessage(errorMessages.required);
|
|
79
|
+
},
|
|
80
|
+
genericError: function () {
|
|
81
|
+
return formatMessage(genericErrorMessages.genericError);
|
|
82
|
+
},
|
|
83
|
+
genericErrorWithRetry: function () {
|
|
84
|
+
return formatMessage(genericErrorMessages.genericErrorRetryHint);
|
|
85
|
+
}
|
|
86
|
+
}); };
|
|
87
|
+
var formatDateOptions = {
|
|
88
|
+
timeZone: 'UTC',
|
|
89
|
+
dateStyle: 'long'
|
|
90
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var allOfComponentToProps = function (_a, children) {
|
|
2
|
+
var control = _a.control, description = _a.description, help = _a.help, title = _a.title;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'form-section',
|
|
5
|
+
children: children,
|
|
6
|
+
control: control,
|
|
7
|
+
description: description,
|
|
8
|
+
help: help,
|
|
9
|
+
title: title
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { inputComponentToProps } from './utils/inputComponentToProps';
|
|
13
|
+
export var booleanInputComponentToProps = function (component) {
|
|
14
|
+
var _a;
|
|
15
|
+
return (__assign(__assign({}, inputComponentToProps(component, 'input-boolean')), { value: (_a = component.value) !== null && _a !== void 0 ? _a : false, onChange: component.onChange.bind(component) }));
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export var buttonComponentToProps = function (component) {
|
|
2
|
+
var title = component.title, control = component.control, context = component.context, disabled = component.disabled, margin = component.margin, pinOrder = component.pinOrder, size = component.size, onClick = component.onClick;
|
|
3
|
+
return {
|
|
4
|
+
type: 'button',
|
|
5
|
+
title: title,
|
|
6
|
+
control: control,
|
|
7
|
+
context: context,
|
|
8
|
+
disabled: disabled,
|
|
9
|
+
margin: margin,
|
|
10
|
+
pinOrder: pinOrder,
|
|
11
|
+
size: size,
|
|
12
|
+
onClick: onClick
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export var columnsComponentToProps = function (_a, startChildren, endChildren) {
|
|
2
|
+
var bias = _a.bias, control = _a.control, margin = _a.margin;
|
|
3
|
+
return ({ type: 'columns', bias: bias, control: control, margin: margin, startChildren: startChildren, endChildren: endChildren });
|
|
4
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { isHiddenComponent } from '../../utils/type-utils';
|
|
2
|
+
import { stepComponentToProps } from '../stepComponentToProps';
|
|
3
|
+
import { alertComponentToProps } from './alertComponentToProps';
|
|
4
|
+
import { allOfComponentToProps } from './allOfComponentToProps';
|
|
5
|
+
import { booleanInputComponentToProps } from './booleanInputComponentToProps';
|
|
6
|
+
import { boxComponentToProps } from './boxComponentToProps';
|
|
7
|
+
import { buttonComponentToProps } from './buttonComponentToProps';
|
|
8
|
+
import { columnsComponentToProps } from './columnsComponentToProps';
|
|
9
|
+
import { containerComponentToProps } from './containerComponentToProps';
|
|
10
|
+
import { dateInputComponentToProps } from './dateInputComponentToProps';
|
|
11
|
+
import { decisionComponentToProps } from './decisionComponentToProps';
|
|
12
|
+
import { dividerComponentToProps } from './dividerComponentToProps';
|
|
13
|
+
import { formComponentToProps } from './formComponentToProps';
|
|
14
|
+
import { headingComponentToProps } from './headingComponentToProps';
|
|
15
|
+
import { hiddenComponentToProps } from './hiddenComponentToProps';
|
|
16
|
+
import { imageComponentToProps } from './imageComponentToProps';
|
|
17
|
+
import { instructionsComponentToProps } from './instructionsComponentToProps';
|
|
18
|
+
import { integerInputComponentToProps } from './integerInputComponentToProps';
|
|
19
|
+
import { loadingIndicatorComponentToProps } from './loadingIndicatorComponentToProps';
|
|
20
|
+
import { markdownComponentToProps } from './markdownComponentToProps';
|
|
21
|
+
import { modalComponentToProps } from './modalComponentToProps';
|
|
22
|
+
import { multiUploadInputComponentToProps } from './multiUploadInputComponentToProps';
|
|
23
|
+
import { numberInputComponentToProps } from './numberInputComponentToProps';
|
|
24
|
+
import { objectComponentToProps } from './objectComponentToProps';
|
|
25
|
+
import { paragraphComponentToProps } from './paragraphComponentToProps';
|
|
26
|
+
import { repeatableComponentToProps } from './repeatableComponentToProps';
|
|
27
|
+
import { reviewComponentToProps } from './reviewComponentToProps';
|
|
28
|
+
import { searchComponentToProps } from './searchComponentToProps';
|
|
29
|
+
import { selectInputComponentToProps } from './selectInputComponentToProps';
|
|
30
|
+
import { statusListComponentToProps } from './statusListComponentToProps';
|
|
31
|
+
import { textInputComponentToProps } from './textInputComponentToProps';
|
|
32
|
+
import { uploadInputComponentToProps } from './uploadInputComponentToProps';
|
|
33
|
+
export var componentToRendererProps = function (component, nestedContent) {
|
|
34
|
+
var children = nestedContent.children, startChildren = nestedContent.startChildren, endChildren = nestedContent.endChildren, editableItemChildren = nestedContent.editableItemChildren;
|
|
35
|
+
if (isHiddenComponent(component)) {
|
|
36
|
+
// Any component that is hidden is mapped to the same HiddenRendererProps, and won't be rendered
|
|
37
|
+
return hiddenComponentToProps();
|
|
38
|
+
}
|
|
39
|
+
switch (component.type) {
|
|
40
|
+
case 'step':
|
|
41
|
+
return stepComponentToProps(component, children);
|
|
42
|
+
case 'alert':
|
|
43
|
+
return alertComponentToProps(component);
|
|
44
|
+
case 'all-of':
|
|
45
|
+
return allOfComponentToProps(component, children);
|
|
46
|
+
case 'boolean':
|
|
47
|
+
return booleanInputComponentToProps(component);
|
|
48
|
+
case 'box':
|
|
49
|
+
return boxComponentToProps(component, children);
|
|
50
|
+
case 'button':
|
|
51
|
+
return buttonComponentToProps(component);
|
|
52
|
+
case 'columns':
|
|
53
|
+
return columnsComponentToProps(component, startChildren, endChildren);
|
|
54
|
+
case 'container':
|
|
55
|
+
return containerComponentToProps(children);
|
|
56
|
+
case 'date':
|
|
57
|
+
return dateInputComponentToProps(component);
|
|
58
|
+
case 'decision':
|
|
59
|
+
return decisionComponentToProps(component);
|
|
60
|
+
case 'divider':
|
|
61
|
+
return dividerComponentToProps(component);
|
|
62
|
+
case 'form':
|
|
63
|
+
return formComponentToProps(component, children);
|
|
64
|
+
case 'heading':
|
|
65
|
+
return headingComponentToProps(component);
|
|
66
|
+
case 'const':
|
|
67
|
+
return hiddenComponentToProps();
|
|
68
|
+
case 'image':
|
|
69
|
+
return imageComponentToProps(component);
|
|
70
|
+
case 'instructions':
|
|
71
|
+
return instructionsComponentToProps(component);
|
|
72
|
+
case 'integer':
|
|
73
|
+
return integerInputComponentToProps(component);
|
|
74
|
+
case 'loading-indicator':
|
|
75
|
+
return loadingIndicatorComponentToProps(component);
|
|
76
|
+
case 'markdown':
|
|
77
|
+
return markdownComponentToProps(component);
|
|
78
|
+
case 'modal':
|
|
79
|
+
return modalComponentToProps(component, children);
|
|
80
|
+
case 'multi-upload':
|
|
81
|
+
return multiUploadInputComponentToProps(component);
|
|
82
|
+
case 'number':
|
|
83
|
+
return numberInputComponentToProps(component);
|
|
84
|
+
case 'object':
|
|
85
|
+
return objectComponentToProps(component, children);
|
|
86
|
+
case 'paragraph':
|
|
87
|
+
return paragraphComponentToProps(component);
|
|
88
|
+
case 'repeatable':
|
|
89
|
+
return repeatableComponentToProps(component, children !== null && children !== void 0 ? children : [], editableItemChildren);
|
|
90
|
+
case 'review':
|
|
91
|
+
return reviewComponentToProps(component);
|
|
92
|
+
case 'search':
|
|
93
|
+
return searchComponentToProps(component);
|
|
94
|
+
case 'select':
|
|
95
|
+
return selectInputComponentToProps(component, children !== null && children !== void 0 ? children : []);
|
|
96
|
+
case 'status-list':
|
|
97
|
+
return statusListComponentToProps(component);
|
|
98
|
+
case 'text':
|
|
99
|
+
return textInputComponentToProps(component);
|
|
100
|
+
case 'upload':
|
|
101
|
+
return uploadInputComponentToProps(component);
|
|
102
|
+
default:
|
|
103
|
+
throw new Error('Unknown component type');
|
|
104
|
+
}
|
|
105
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { inputComponentToProps } from './utils/inputComponentToProps';
|
|
13
|
+
export var dateInputComponentToProps = function (component) { return (__assign(__assign({}, inputComponentToProps(component, 'input-date')), { minimumDate: component.minimumDate, maximumDate: component.maximumDate, onChange: component.onChange.bind(component) })); };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var headingComponentToProps = function (_a) {
|
|
2
|
+
var align = _a.align, control = _a.control, margin = _a.margin, size = _a.size, text = _a.text;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'heading',
|
|
5
|
+
align: align,
|
|
6
|
+
control: control,
|
|
7
|
+
margin: margin,
|
|
8
|
+
size: size,
|
|
9
|
+
text: text
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var imageComponentToProps = function (_a) {
|
|
2
|
+
var accessibilityDescription = _a.accessibilityDescription, control = _a.control, margin = _a.margin, size = _a.size, url = _a.url;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'image',
|
|
5
|
+
accessibilityDescription: accessibilityDescription,
|
|
6
|
+
control: control,
|
|
7
|
+
margin: margin,
|
|
8
|
+
size: size,
|
|
9
|
+
url: url
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { inputComponentToProps } from './utils/inputComponentToProps';
|
|
13
|
+
export var integerInputComponentToProps = function (component) { return (__assign(__assign({}, inputComponentToProps(component, 'input-integer')), { onChange: component.onChange.bind(component) })); };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export var modalComponentToProps = function (_a, components) {
|
|
2
|
+
var control = _a.control, margin = _a.margin, trigger = _a.trigger;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'modal',
|
|
5
|
+
content: { components: components },
|
|
6
|
+
control: control,
|
|
7
|
+
margin: margin,
|
|
8
|
+
trigger: trigger
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
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 { inputComponentToProps } from './utils/inputComponentToProps';
|
|
13
|
+
export var multiUploadInputComponentToProps = function (component) {
|
|
14
|
+
var accepts = component.accepts, fileMap = component.fileMap, maxSize = component.maxSize, minItems = component.minItems, maxItems = component.maxItems, uploadLabel = component.uploadLabel;
|
|
15
|
+
var findIdByValue = function (file) { return Object.keys(fileMap).find(function (id) { return fileMap[id] === file; }); };
|
|
16
|
+
var fileList = Object.values(fileMap).map(function (file) {
|
|
17
|
+
var _a;
|
|
18
|
+
return ({
|
|
19
|
+
id: (_a = findIdByValue(file)) !== null && _a !== void 0 ? _a : '',
|
|
20
|
+
file: file
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
return __assign(__assign({}, inputComponentToProps(component, 'input-upload-multi')), { accepts: accepts, maxSize: maxSize, minItems: minItems, maxItems: maxItems, uploadLabel: uploadLabel, value: fileList, onUpload: component.onUpload.bind(component), onDelete: component.onDelete.bind(component) });
|
|
24
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { inputComponentToProps } from './utils/inputComponentToProps';
|
|
13
|
+
export var numberInputComponentToProps = function (component) { return (__assign(__assign({}, inputComponentToProps(component, 'input-number')), { onChange: component.onChange.bind(component) })); };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var objectComponentToProps = function (_a, children) {
|
|
2
|
+
var control = _a.control, description = _a.description, help = _a.help, title = _a.title;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'form-section',
|
|
5
|
+
children: children,
|
|
6
|
+
control: control,
|
|
7
|
+
description: description,
|
|
8
|
+
help: help,
|
|
9
|
+
title: title
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
export var repeatableComponentToProps = function (component, children, editableItemChildren) {
|
|
13
|
+
var addItemTitle = component.addItemTitle, control = component.control, components = component.components, description = component.description, editItemTitle = component.editItemTitle, errors = component.errors, summaryDefaults = component.summaryDefaults, _a = component.title, title = _a === void 0 ? '' : _a, onEdit = component.onEdit, onAdd = component.onAdd, onSave = component.onSave, onRemove = component.onRemove;
|
|
14
|
+
var getSummary = function (componentSummary) {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
return ({
|
|
17
|
+
title: (_a = componentSummary.title) !== null && _a !== void 0 ? _a : summaryDefaults.title,
|
|
18
|
+
description: (_b = componentSummary.description) !== null && _b !== void 0 ? _b : summaryDefaults.description,
|
|
19
|
+
icon: (_c = componentSummary.icon) !== null && _c !== void 0 ? _c : summaryDefaults.icon,
|
|
20
|
+
image: (_d = componentSummary.image) !== null && _d !== void 0 ? _d : summaryDefaults.image
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var itemProps = components.map(function (childComponent) { return (__assign(__assign({}, getSummary(childComponent.getSummary())), { id: "".concat(childComponent.uid, "-summary") })); });
|
|
24
|
+
return {
|
|
25
|
+
type: 'repeatable',
|
|
26
|
+
children: children,
|
|
27
|
+
control: control,
|
|
28
|
+
items: itemProps,
|
|
29
|
+
editableItem: editableItemChildren,
|
|
30
|
+
title: title,
|
|
31
|
+
description: description,
|
|
32
|
+
addItemTitle: addItemTitle,
|
|
33
|
+
editItemTitle: editItemTitle,
|
|
34
|
+
error: errors[0],
|
|
35
|
+
onAdd: onAdd.bind(component),
|
|
36
|
+
onEdit: onEdit.bind(component),
|
|
37
|
+
onSave: onSave.bind(component),
|
|
38
|
+
onRemove: onRemove.bind(component)
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export var reviewComponentToProps = function (_a) {
|
|
2
|
+
var callToAction = _a.callToAction, control = _a.control, fields = _a.fields, margin = _a.margin, title = _a.title;
|
|
3
|
+
return ({
|
|
4
|
+
type: 'review',
|
|
5
|
+
callToAction: callToAction,
|
|
6
|
+
control: control,
|
|
7
|
+
fields: fields,
|
|
8
|
+
margin: margin,
|
|
9
|
+
title: title
|
|
10
|
+
});
|
|
11
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
export var searchComponentToProps = function (component) {
|
|
13
|
+
var uid = component.uid, control = component.control, emptyMessage = component.emptyMessage, error = component.error, isLoading = component.isLoading, margin = component.margin, query = component.query, results = component.results, title = component.title;
|
|
14
|
+
var onChange = component.onChange.bind(component);
|
|
15
|
+
var onSelect = component.onSelect.bind(component);
|
|
16
|
+
var state = getSearchState({
|
|
17
|
+
emptyMessage: emptyMessage,
|
|
18
|
+
error: error,
|
|
19
|
+
query: query,
|
|
20
|
+
results: results,
|
|
21
|
+
onChange: onChange,
|
|
22
|
+
onSelect: onSelect
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
type: 'search',
|
|
26
|
+
id: uid,
|
|
27
|
+
control: control,
|
|
28
|
+
isLoading: isLoading,
|
|
29
|
+
margin: margin,
|
|
30
|
+
query: query,
|
|
31
|
+
state: state,
|
|
32
|
+
title: title,
|
|
33
|
+
onChange: onChange
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
var getSearchState = function (_a) {
|
|
37
|
+
var emptyMessage = _a.emptyMessage, error = _a.error, query = _a.query, results = _a.results, onChange = _a.onChange, onSelect = _a.onSelect;
|
|
38
|
+
if (!query) {
|
|
39
|
+
return { type: 'pending' };
|
|
40
|
+
}
|
|
41
|
+
if (error) {
|
|
42
|
+
return { type: 'error', onRetry: function () { return onChange(query); } };
|
|
43
|
+
}
|
|
44
|
+
if (results.length === 0) {
|
|
45
|
+
return { type: 'noResults', message: emptyMessage };
|
|
46
|
+
}
|
|
47
|
+
var rendererResults = results.map(function (result) { return (__assign(__assign({}, result), { onClick: function () { return onSelect(result); } })); });
|
|
48
|
+
return { type: 'results', results: rendererResults };
|
|
49
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { inputComponentToProps } from './utils/inputComponentToProps';
|
|
24
|
+
export var selectInputComponentToProps = function (component, children) {
|
|
25
|
+
var _a;
|
|
26
|
+
var options = component.options, selectedIndex = component.selectedIndex, onSelect = component.onSelect;
|
|
27
|
+
var _b = inputComponentToProps(component, 'input-select'), value = _b.value, props = __rest(_b, ["value"]);
|
|
28
|
+
return __assign(__assign({}, props), { options: options, selectedIndex: selectedIndex, onSelect: onSelect.bind(component), children: (_a = children[selectedIndex !== null && selectedIndex !== void 0 ? selectedIndex : -1]) !== null && _a !== void 0 ? _a : null });
|
|
29
|
+
};
|