@wise/dynamic-flow-client 0.1.1 → 0.1.3
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/api/utils.d.ts +4 -0
- package/build/common/api/utils.js +13 -0
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.d.ts +11 -0
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.js +36 -0
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.d.ts +4 -0
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.js +13 -0
- package/build/common/contexts/fetcherContext/fetcherContext.d.ts +18 -0
- package/build/common/contexts/fetcherContext/fetcherContext.js +35 -0
- package/build/common/contexts/fetcherContext/index.d.ts +2 -0
- package/build/common/contexts/fetcherContext/index.js +2 -0
- package/build/common/contexts/fetcherContext/makeFetcher.d.ts +2 -0
- package/build/common/contexts/fetcherContext/makeFetcher.js +33 -0
- package/build/common/general/index.d.ts +2 -0
- package/build/common/general/index.js +22 -0
- package/build/common/hooks/useDebouncedFunction.d.ts +2 -0
- package/build/common/hooks/useDebouncedFunction.js +9 -0
- package/build/common/hooks/useDebouncedFunction.test.d.ts +1 -0
- package/build/common/hooks/useDebouncedFunction.test.js +59 -0
- package/build/common/hooks/usePersistAsync.d.ts +7 -0
- package/build/common/hooks/usePersistAsync.js +170 -0
- package/build/common/hooks/usePolling.d.ts +11 -0
- package/build/common/hooks/usePolling.js +48 -0
- package/build/common/hooks/usePrevious.d.ts +2 -0
- package/build/common/hooks/usePrevious.js +9 -0
- package/build/common/index.d.ts +4 -0
- package/build/common/index.js +4 -0
- package/build/common/logging/index.d.ts +22 -0
- package/build/common/logging/index.js +39 -0
- package/build/common/logging/spec.d.ts +1 -0
- package/build/common/logging/spec.js +45 -0
- package/build/common/messages.d.ts +8 -0
- package/build/common/messages.js +8 -0
- package/build/common/propsValues/dateMode.d.ts +4 -0
- package/build/common/propsValues/dateMode.js +4 -0
- package/build/common/propsValues/formControlType.d.ts +17 -0
- package/build/common/propsValues/formControlType.js +17 -0
- package/build/common/propsValues/monthFormat.d.ts +4 -0
- package/build/common/propsValues/monthFormat.js +4 -0
- package/build/common/propsValues/size.d.ts +7 -0
- package/build/common/propsValues/size.js +7 -0
- package/build/common/requirements.d.ts +10 -0
- package/build/common/requirements.js +50 -0
- package/build/common/schemaTypes/schemaTypes.d.ts +23 -0
- package/build/common/schemaTypes/schemaTypes.js +53 -0
- package/build/common/schemaTypes/shouldDebounceSchema.d.ts +2 -0
- package/build/common/schemaTypes/shouldDebounceSchema.js +6 -0
- package/build/common/stepTypes/stepTypes.d.ts +7 -0
- package/build/common/stepTypes/stepTypes.js +42 -0
- package/build/common/tracking/index.d.ts +15 -0
- package/build/common/tracking/index.js +33 -0
- package/build/common/tracking/spec.d.ts +1 -0
- package/build/common/tracking/spec.js +49 -0
- package/build/common/utils/file-utils.d.ts +4 -0
- package/build/common/utils/file-utils.js +45 -0
- package/build/common/utils/generate-random-id.d.ts +1 -0
- package/build/common/utils/generate-random-id.js +5 -0
- package/build/common/utils/generate-random-id.test.d.ts +1 -0
- package/build/common/utils/generate-random-id.test.js +12 -0
- package/build/common/validation/rule-validators/index.d.ts +10 -0
- package/build/common/validation/rule-validators/index.js +40 -0
- package/build/common/validation/rule-validators/spec.d.ts +1 -0
- package/build/common/validation/rule-validators/spec.js +145 -0
- package/build/common/validation/schema-validators/index.d.ts +9 -0
- package/build/common/validation/schema-validators/index.js +98 -0
- package/build/common/validation/schema-validators/spec.d.ts +1 -0
- package/build/common/validation/schema-validators/spec.js +137 -0
- package/build/common/validation/valid-model/index.d.ts +5 -0
- package/build/common/validation/valid-model/index.js +64 -0
- package/build/common/validation/valid-model/spec.d.ts +1 -0
- package/build/common/validation/valid-model/spec.js +605 -0
- package/build/common/validation/valid-model/utils.d.ts +11 -0
- package/build/common/validation/valid-model/utils.js +118 -0
- package/build/common/validation/validation-failures/index.d.ts +23 -0
- package/build/common/validation/validation-failures/index.js +140 -0
- package/build/common/validation/validation-failures/spec.d.ts +1 -0
- package/build/common/validation/validation-failures/spec.js +185 -0
- package/build/dynamic-flow-types/Action.d.ts +19 -0
- package/build/dynamic-flow-types/Action.js +1 -0
- package/build/dynamic-flow-types/FileUploadSchema.d.ts +23 -0
- package/build/dynamic-flow-types/FileUploadSchema.js +3 -0
- package/build/dynamic-flow-types/LayoutComponent.d.ts +129 -0
- package/build/dynamic-flow-types/LayoutComponent.js +1 -0
- package/build/dynamic-flow-types/Model.d.ts +12 -0
- package/build/dynamic-flow-types/Model.js +28 -0
- package/build/dynamic-flow-types/PersistAsync.d.ts +8 -0
- package/build/dynamic-flow-types/PersistAsync.js +1 -0
- package/build/dynamic-flow-types/Polling.d.ts +12 -0
- package/build/dynamic-flow-types/Polling.js +1 -0
- package/build/dynamic-flow-types/Promotion.d.ts +20 -0
- package/build/dynamic-flow-types/Promotion.js +1 -0
- package/build/dynamic-flow-types/Schema.d.ts +184 -0
- package/build/dynamic-flow-types/Schema.js +49 -0
- package/build/dynamic-flow-types/Step.d.ts +127 -0
- package/build/dynamic-flow-types/Step.js +4 -0
- package/build/dynamic-flow-types/ValidationAsync.d.ts +6 -0
- package/build/dynamic-flow-types/ValidationAsync.js +1 -0
- package/build/dynamic-flow-types/core.d.ts +29 -0
- package/build/dynamic-flow-types/core.js +1 -0
- package/build/dynamic-flow-types/index.d.ts +14 -0
- package/build/dynamic-flow-types/index.js +12 -0
- package/build/field/Field.d.ts +69 -0
- package/build/field/Field.js +311 -0
- package/build/field/index.d.ts +2 -0
- package/build/field/index.js +2 -0
- package/build/flow/DynamicFlow.d.ts +4 -0
- package/build/flow/DynamicFlow.js +368 -0
- package/build/flow/DynamicFlowStep.d.ts +9 -0
- package/build/flow/DynamicFlowStep.js +32 -0
- package/build/flow/errorBoundary/ErrorBoundary.d.ts +20 -0
- package/build/flow/errorBoundary/ErrorBoundary.js +45 -0
- package/build/flow/errorBoundary/ErrorBoundary.messages.d.ts +13 -0
- package/build/flow/errorBoundary/ErrorBoundary.messages.js +13 -0
- package/build/flow/errorBoundary/ErrorBoundaryAlert.d.ts +6 -0
- package/build/flow/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/flow/errorBoundary/index.d.ts +1 -0
- package/build/flow/errorBoundary/index.js +1 -0
- package/build/flow/fixtures/components/alert.d.ts +3 -0
- package/build/flow/fixtures/components/alert.js +31 -0
- package/build/flow/fixtures/components/box.d.ts +3 -0
- package/build/flow/fixtures/components/box.js +20 -0
- package/build/flow/fixtures/components/button.d.ts +3 -0
- package/build/flow/fixtures/components/button.js +65 -0
- package/build/flow/fixtures/components/columns.d.ts +3 -0
- package/build/flow/fixtures/components/columns.js +36 -0
- package/build/flow/fixtures/components/copyable.d.ts +3 -0
- package/build/flow/fixtures/components/copyable.js +22 -0
- package/build/flow/fixtures/components/decision.d.ts +3 -0
- package/build/flow/fixtures/components/decision.js +54 -0
- package/build/flow/fixtures/components/heading.d.ts +3 -0
- package/build/flow/fixtures/components/heading.js +14 -0
- package/build/flow/fixtures/components/image.d.ts +3 -0
- package/build/flow/fixtures/components/image.js +22 -0
- package/build/flow/fixtures/components/info.d.ts +3 -0
- package/build/flow/fixtures/components/info.js +17 -0
- package/build/flow/fixtures/components/list.d.ts +3 -0
- package/build/flow/fixtures/components/list.js +34 -0
- package/build/flow/fixtures/components/loading-indicator.d.ts +3 -0
- package/build/flow/fixtures/components/loading-indicator.js +16 -0
- package/build/flow/fixtures/components/paragraph.d.ts +3 -0
- package/build/flow/fixtures/components/paragraph.js +28 -0
- package/build/flow/fixtures/components/review.d.ts +3 -0
- package/build/flow/fixtures/components/review.js +60 -0
- package/build/flow/fixtures/examples/camera-capture.d.ts +3 -0
- package/build/flow/fixtures/examples/camera-capture.js +121 -0
- package/build/flow/fixtures/examples/recipient-update.d.ts +3 -0
- package/build/flow/fixtures/examples/recipient-update.js +250 -0
- package/build/flow/fixtures/examples/recipient.d.ts +3 -0
- package/build/flow/fixtures/examples/recipient.js +313 -0
- package/build/flow/fixtures/examples/single-file-upload.d.ts +3 -0
- package/build/flow/fixtures/examples/single-file-upload.js +96 -0
- package/build/flow/fixtures/examples/step-validation-errors.d.ts +3 -0
- package/build/flow/fixtures/examples/step-validation-errors.js +75 -0
- package/build/flow/fixtures/features/action-response.d.ts +3 -0
- package/build/flow/fixtures/features/action-response.js +29 -0
- package/build/flow/fixtures/features/external.d.ts +3 -0
- package/build/flow/fixtures/features/external.js +31 -0
- package/build/flow/fixtures/features/persist-async.d.ts +3 -0
- package/build/flow/fixtures/features/persist-async.js +44 -0
- package/build/flow/fixtures/features/polling.d.ts +3 -0
- package/build/flow/fixtures/features/polling.js +33 -0
- package/build/flow/fixtures/index.d.ts +42 -0
- package/build/flow/fixtures/index.js +66 -0
- package/build/flow/fixtures/responses/action-response-final.d.ts +3 -0
- package/build/flow/fixtures/responses/action-response-final.js +24 -0
- package/build/flow/fixtures/responses/action.d.ts +5 -0
- package/build/flow/fixtures/responses/action.js +2 -0
- package/build/flow/fixtures/responses/exit.d.ts +6 -0
- package/build/flow/fixtures/responses/exit.js +2 -0
- package/build/flow/fixtures/responses/recipient-update-final.d.ts +3 -0
- package/build/flow/fixtures/responses/recipient-update-final.js +24 -0
- package/build/flow/fixtures/schemas/basic-form.d.ts +3 -0
- package/build/flow/fixtures/schemas/basic-form.js +39 -0
- package/build/flow/fixtures/schemas/number-and-integer.d.ts +3 -0
- package/build/flow/fixtures/schemas/number-and-integer.js +41 -0
- package/build/flow/fixtures/schemas/one-of.d.ts +3 -0
- package/build/flow/fixtures/schemas/one-of.js +223 -0
- package/build/flow/fixtures/schemas/string-formats.d.ts +3 -0
- package/build/flow/fixtures/schemas/string-formats.js +58 -0
- package/build/flow/index.d.ts +1 -0
- package/build/flow/index.js +1 -0
- package/build/flow/response-parsers/index.d.ts +17 -0
- package/build/flow/response-parsers/index.js +112 -0
- package/build/flow/response-parsers/spec.d.ts +1 -0
- package/build/flow/response-parsers/spec.js +263 -0
- package/build/flow/stories/EditableDynamicFlow.d.ts +5 -0
- package/build/flow/stories/EditableDynamicFlow.js +61 -0
- package/build/flow/types.d.ts +77 -0
- package/build/flow/types.js +3 -0
- package/build/flow/useDebouncedRefresh/index.d.ts +1 -0
- package/build/flow/useDebouncedRefresh/index.js +1 -0
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.js +24 -0
- package/build/flow/useDynamicFlowState.d.ts +18 -0
- package/build/flow/useDynamicFlowState.js +111 -0
- package/build/flow/useLoader.d.ts +9 -0
- package/build/flow/useLoader.js +22 -0
- package/build/formControl/FormControl.d.ts +86 -0
- package/build/formControl/FormControl.js +241 -0
- package/build/formControl/index.d.ts +1 -0
- package/build/formControl/index.js +1 -0
- package/build/formControl/types.d.ts +57 -0
- package/build/formControl/types.js +1 -0
- package/build/formControl/value-utils.d.ts +9 -0
- package/build/formControl/value-utils.js +108 -0
- package/build/i18n/cs.json +8 -0
- package/build/i18n/de.json +34 -0
- package/build/i18n/en.json +38 -0
- package/build/i18n/es.json +34 -0
- package/build/i18n/fr.json +34 -0
- package/build/i18n/hu.json +34 -0
- package/build/i18n/id.json +34 -0
- package/build/i18n/index.d.ts +2 -0
- package/build/i18n/index.js +31 -0
- package/build/i18n/it.json +34 -0
- package/build/i18n/ja.json +34 -0
- package/build/i18n/pl.json +11 -0
- package/build/i18n/pt.json +34 -0
- package/build/i18n/ro.json +34 -0
- package/build/i18n/ru.json +34 -0
- package/build/i18n/th.json +34 -0
- package/build/i18n/tr.json +11 -0
- package/build/i18n/uk.json +8 -0
- package/build/i18n/zh-CN.json +34 -0
- package/build/i18n/zh.json +34 -0
- package/build/index.d.ts +12 -0
- package/build/index.js +11 -0
- package/build/jsonSchemaForm/JsonSchemaForm.d.ts +66 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +31 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +14 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +54 -0
- package/build/jsonSchemaForm/allOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/allOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +15 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +26 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +24 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.d.ts +9 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.js +14 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.d.ts +6 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.js +85 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +22 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +105 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.js +1 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +31 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +79 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts +53 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +53 -0
- package/build/jsonSchemaForm/controlFeedback/index.d.ts +1 -0
- package/build/jsonSchemaForm/controlFeedback/index.js +1 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +19 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +122 -0
- package/build/jsonSchemaForm/genericSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/genericSchema/index.js +1 -0
- package/build/jsonSchemaForm/help/Help.d.ts +8 -0
- package/build/jsonSchemaForm/help/Help.js +9 -0
- package/build/jsonSchemaForm/help/Help.messages.d.ts +8 -0
- package/build/jsonSchemaForm/help/Help.messages.js +8 -0
- package/build/jsonSchemaForm/help/index.d.ts +1 -0
- package/build/jsonSchemaForm/help/index.js +1 -0
- package/build/jsonSchemaForm/index.d.ts +1 -0
- package/build/jsonSchemaForm/index.js +1 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +16 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +78 -0
- package/build/jsonSchemaForm/objectSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/objectSchema/index.js +1 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +15 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +153 -0
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.d.ts +3 -0
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.js +40 -0
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.js +27 -0
- package/build/jsonSchemaForm/oneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.d.ts +3 -0
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.js +7 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +8 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +8 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.d.ts +21 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.js +168 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.d.ts +20 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.js +127 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.d.ts +17 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.js +32 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +9 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.js +8 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.d.ts +7 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.js +27 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.d.ts +23 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.js +31 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.d.ts +9 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.js +32 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +8 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +55 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +16 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
- package/build/jsonSchemaForm/readOnlySchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/readOnlySchema/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +25 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +106 -0
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.d.ts +3 -0
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.js +73 -0
- package/build/jsonSchemaForm/schemaFormControl/index.d.ts +1 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.d.ts +40 -0
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.js +89 -0
- package/build/jsonSchemaForm/schemas/allOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/allOf.json.js +119 -0
- package/build/jsonSchemaForm/schemas/audRecipient.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/audRecipient.json.js +1104 -0
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.js +37 -0
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.js +36 -0
- package/build/jsonSchemaForm/schemas/currency.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/currency.json.js +48 -0
- package/build/jsonSchemaForm/schemas/oneOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/oneOf.json.js +119 -0
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.js +53 -0
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.js +56 -0
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.js +102 -0
- package/build/jsonSchemaForm/schemas/simple.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/simple.json.js +48 -0
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.js +71 -0
- package/build/jsonSchemaForm/schemas/validationAsync.json.d.ts +3 -0
- package/build/jsonSchemaForm/schemas/validationAsync.json.js +23 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +17 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +149 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/layout/DynamicLayout.d.ts +17 -0
- package/build/layout/DynamicLayout.js +75 -0
- package/build/layout/alert/index.d.ts +6 -0
- package/build/layout/alert/index.js +29 -0
- package/build/layout/box/index.d.ts +8 -0
- package/build/layout/box/index.js +41 -0
- package/build/layout/button/index.d.ts +8 -0
- package/build/layout/button/index.js +58 -0
- package/build/layout/columns/index.d.ts +8 -0
- package/build/layout/columns/index.js +38 -0
- package/build/layout/decision/index.d.ts +9 -0
- package/build/layout/decision/index.js +38 -0
- package/build/layout/divider/index.d.ts +7 -0
- package/build/layout/divider/index.js +9 -0
- package/build/layout/external/DynamicExternal.d.ts +8 -0
- package/build/layout/external/DynamicExternal.js +30 -0
- package/build/layout/external/DynamicExternal.messages.d.ts +8 -0
- package/build/layout/external/DynamicExternal.messages.js +8 -0
- package/build/layout/external/index.d.ts +1 -0
- package/build/layout/external/index.js +1 -0
- package/build/layout/external/useExternalStepPolling.d.ts +11 -0
- package/build/layout/external/useExternalStepPolling.js +68 -0
- package/build/layout/form/index.d.ts +8 -0
- package/build/layout/form/index.js +22 -0
- package/build/layout/heading/index.d.ts +6 -0
- package/build/layout/heading/index.js +31 -0
- package/build/layout/icon/index.d.ts +7 -0
- package/build/layout/icon/index.js +22 -0
- package/build/layout/image/index.d.ts +6 -0
- package/build/layout/image/index.js +126 -0
- package/build/layout/index.d.ts +1 -0
- package/build/layout/index.js +1 -0
- package/build/layout/info/index.d.ts +7 -0
- package/build/layout/info/index.js +19 -0
- package/build/layout/layouts/all.json.d.ts +3 -0
- package/build/layout/layouts/all.json.js +176 -0
- package/build/layout/layouts/final-step-layout.json.d.ts +3 -0
- package/build/layout/layouts/final-step-layout.json.js +39 -0
- package/build/layout/layouts/finalStep.json.d.ts +3 -0
- package/build/layout/layouts/finalStep.json.js +24 -0
- package/build/layout/layouts/list.json.d.ts +3 -0
- package/build/layout/layouts/list.json.js +33 -0
- package/build/layout/layouts/pay-in.json.d.ts +3 -0
- package/build/layout/layouts/pay-in.json.js +97 -0
- package/build/layout/layouts/review.json.d.ts +3 -0
- package/build/layout/layouts/review.json.js +160 -0
- package/build/layout/layouts/success.json.d.ts +3 -0
- package/build/layout/layouts/success.json.js +66 -0
- package/build/layout/list/index.d.ts +8 -0
- package/build/layout/list/index.js +30 -0
- package/build/layout/loading-indicator/index.d.ts +7 -0
- package/build/layout/loading-indicator/index.js +10 -0
- package/build/layout/loading-indicator/spec.d.ts +1 -0
- package/build/layout/loading-indicator/spec.js +11 -0
- package/build/layout/paragraph/DynamicParagraph.d.ts +7 -0
- package/build/layout/paragraph/DynamicParagraph.js +42 -0
- package/build/layout/paragraph/DynamicParagraph.messages.d.ts +13 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +13 -0
- package/build/layout/paragraph/index.d.ts +1 -0
- package/build/layout/paragraph/index.js +1 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +10 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/layout/review/index.d.ts +9 -0
- package/build/layout/review/index.js +33 -0
- package/build/layout/utils.d.ts +7 -0
- package/build/layout/utils.js +31 -0
- package/build/main.css +143 -0
- package/build/schema.d.ts +1 -0
- package/build/schema.js +1 -0
- package/build/step/cameraStep/CameraStep.d.ts +8 -0
- package/build/step/cameraStep/CameraStep.js +125 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +16 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +122 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +18 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +18 -0
- package/build/step/cameraStep/cameraCapture/components/index.d.ts +8 -0
- package/build/step/cameraStep/cameraCapture/components/index.js +28 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.d.ts +4 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.js +80 -0
- package/build/step/cameraStep/cameraCapture/index.d.ts +1 -0
- package/build/step/cameraStep/cameraCapture/index.js +1 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +11 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +78 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +3 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +19 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +13 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +13 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +6 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +21 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +18 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +18 -0
- package/build/step/cameraStep/cameraCapture/screens/index.d.ts +2 -0
- package/build/step/cameraStep/cameraCapture/screens/index.js +2 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.d.ts +7 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.js +101 -0
- package/build/step/cameraStep/cameraCapture/utils/index.d.ts +8 -0
- package/build/step/cameraStep/cameraCapture/utils/index.js +103 -0
- package/build/step/cameraStep/index.d.ts +1 -0
- package/build/step/cameraStep/index.js +1 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +7 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +23 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
- package/build/step/externalConfirmationStep/index.d.ts +1 -0
- package/build/step/externalConfirmationStep/index.js +1 -0
- package/build/step/features/external/useExternal.d.ts +4 -0
- package/build/step/features/external/useExternal.js +15 -0
- package/build/step/features/index.d.ts +2 -0
- package/build/step/features/index.js +2 -0
- package/build/step/features/polling/useStepPolling.d.ts +2 -0
- package/build/step/features/polling/useStepPolling.js +44 -0
- package/build/step/index.d.ts +3 -0
- package/build/step/index.js +3 -0
- package/build/step/layoutStep/LayoutStep.d.ts +11 -0
- package/build/step/layoutStep/LayoutStep.js +34 -0
- package/build/step/layoutStep/index.d.ts +1 -0
- package/build/step/layoutStep/index.js +1 -0
- package/build/step/layoutStep/layoutService/convertStepToLayout.d.ts +8 -0
- package/build/step/layoutStep/layoutService/convertStepToLayout.js +217 -0
- package/build/step/layoutStep/layoutService/index.d.ts +2 -0
- package/build/step/layoutStep/layoutService/index.js +2 -0
- package/build/step/layoutStep/layoutService/inlineReferences.d.ts +7 -0
- package/build/step/layoutStep/layoutService/inlineReferences.js +91 -0
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { render } from '@testing-library/react';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
|
+
import { useLogger, LogProvider } from '.';
|
|
16
|
+
describe('Logging Provider', function () {
|
|
17
|
+
var TestChild = function () {
|
|
18
|
+
var log = useLogger();
|
|
19
|
+
useEffect(function () {
|
|
20
|
+
// eslint-disable-next-line testing-library/no-debugging-utils
|
|
21
|
+
log.debug('Deprecation advanced warning', 'Some description.');
|
|
22
|
+
log.info('Invalid schema or model', 'Some description.');
|
|
23
|
+
log.warning('Action supressed', 'Some description.');
|
|
24
|
+
log.error('Deprecated schema', 'This schema is no longer supported.');
|
|
25
|
+
log.critical('Deprecated schema', 'This schema is no longer supported.');
|
|
26
|
+
}, []);
|
|
27
|
+
return _jsx("span", { children: "info,error" });
|
|
28
|
+
};
|
|
29
|
+
describe('when provider is initialised with flowId and stepId', function () {
|
|
30
|
+
describe('and is called within a component', function () {
|
|
31
|
+
function renderComponent(onLog) {
|
|
32
|
+
render(_jsx(LogProvider, __assign({ flowId: "myFlowId", stepId: "myStepId", onLog: onLog }, { children: _jsx(TestChild, {}) })));
|
|
33
|
+
}
|
|
34
|
+
it('calls the onLog callback', function () {
|
|
35
|
+
var onLog = jest.fn();
|
|
36
|
+
renderComponent(onLog);
|
|
37
|
+
expect(onLog).toHaveBeenCalledWith('debug', 'Dynamic Flow debug - Deprecation advanced warning - Some description.', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId' }));
|
|
38
|
+
expect(onLog).toHaveBeenCalledWith('info', 'Dynamic Flow info - Invalid schema or model - Some description.', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId' }));
|
|
39
|
+
expect(onLog).toHaveBeenCalledWith('warning', 'Dynamic Flow warning - Action supressed - Some description.', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId' }));
|
|
40
|
+
expect(onLog).toHaveBeenCalledWith('error', 'Dynamic Flow error - Deprecated schema - This schema is no longer supported.', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId' }));
|
|
41
|
+
expect(onLog).toHaveBeenCalledWith('critical', 'Dynamic Flow critical - Deprecated schema - This schema is no longer supported.', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId' }));
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const FormControlType: {
|
|
2
|
+
RADIO: string;
|
|
3
|
+
CHECKBOX: string;
|
|
4
|
+
SELECT: string;
|
|
5
|
+
FILE: string;
|
|
6
|
+
DATE: string;
|
|
7
|
+
DATETIME: string;
|
|
8
|
+
DATELOOKUP: string;
|
|
9
|
+
TEL: string;
|
|
10
|
+
NUMBER: string;
|
|
11
|
+
HIDDEN: string;
|
|
12
|
+
PASSWORD: string;
|
|
13
|
+
TEXT: string;
|
|
14
|
+
TEXTAREA: string;
|
|
15
|
+
UPLOAD: string;
|
|
16
|
+
TAB: string;
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export var FormControlType = {
|
|
2
|
+
RADIO: 'radio',
|
|
3
|
+
CHECKBOX: 'checkbox',
|
|
4
|
+
SELECT: 'select',
|
|
5
|
+
FILE: 'file',
|
|
6
|
+
DATE: 'date',
|
|
7
|
+
DATETIME: 'date-time',
|
|
8
|
+
DATELOOKUP: 'date-lookup',
|
|
9
|
+
TEL: 'tel',
|
|
10
|
+
NUMBER: 'number',
|
|
11
|
+
HIDDEN: 'hidden',
|
|
12
|
+
PASSWORD: 'password',
|
|
13
|
+
TEXT: 'text',
|
|
14
|
+
TEXTAREA: 'textarea',
|
|
15
|
+
UPLOAD: 'upload',
|
|
16
|
+
TAB: 'tab'
|
|
17
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FormControlType } from './propsValues/formControlType';
|
|
2
|
+
type Field = {
|
|
3
|
+
hidden?: boolean;
|
|
4
|
+
control?: (typeof FormControlType)[keyof typeof FormControlType];
|
|
5
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'blob';
|
|
6
|
+
options: any[];
|
|
7
|
+
format: 'date' | 'phone' | 'base64url' | 'password' | 'email' | 'uri';
|
|
8
|
+
};
|
|
9
|
+
declare const getControlType_Legacy: (field: Field) => string;
|
|
10
|
+
export { getControlType_Legacy };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var getControlType_Legacy = function (field) {
|
|
2
|
+
if (field.control) {
|
|
3
|
+
return field.control.toLowerCase();
|
|
4
|
+
}
|
|
5
|
+
if (field.hidden) {
|
|
6
|
+
return 'hidden';
|
|
7
|
+
}
|
|
8
|
+
if (field.options && field.options.length > 0) {
|
|
9
|
+
return getSelectionType(field);
|
|
10
|
+
}
|
|
11
|
+
switch (field.type) {
|
|
12
|
+
case 'string':
|
|
13
|
+
return getControlForStringFormat(field.format);
|
|
14
|
+
case 'number':
|
|
15
|
+
case 'integer':
|
|
16
|
+
return 'number';
|
|
17
|
+
case 'boolean':
|
|
18
|
+
return 'checkbox';
|
|
19
|
+
default:
|
|
20
|
+
return 'text';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var getControlForStringFormat = function (format) {
|
|
24
|
+
switch (format) {
|
|
25
|
+
case 'date':
|
|
26
|
+
return 'date';
|
|
27
|
+
case 'base64url':
|
|
28
|
+
return 'file';
|
|
29
|
+
case 'password':
|
|
30
|
+
return 'password';
|
|
31
|
+
case 'uri':
|
|
32
|
+
return 'text'; // 'url'; - not implemented
|
|
33
|
+
case 'email':
|
|
34
|
+
return 'text'; // 'email'; - not implemented
|
|
35
|
+
case 'phone':
|
|
36
|
+
return 'tel';
|
|
37
|
+
default:
|
|
38
|
+
return 'text';
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var getSelectionType = function (field) {
|
|
42
|
+
if (field.control) {
|
|
43
|
+
return field.control;
|
|
44
|
+
}
|
|
45
|
+
if (field.options) {
|
|
46
|
+
return field.options.length > 3 ? 'select' : 'radio';
|
|
47
|
+
}
|
|
48
|
+
return 'select';
|
|
49
|
+
};
|
|
50
|
+
export { getControlType_Legacy };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Schema, isAllOfSchema as isAllOfSchemaDF, isOneOfSchema as isOneOfSchemaDF } from '../../dynamic-flow-types';
|
|
2
|
+
export declare const schemaType: {
|
|
3
|
+
READ_ONLY: string;
|
|
4
|
+
PERSIST_ASYNC: string;
|
|
5
|
+
VALIDATION_ASYNC: string;
|
|
6
|
+
OBJECT: string;
|
|
7
|
+
PROMOTED_ONE_OF: string;
|
|
8
|
+
ONE_OF: string;
|
|
9
|
+
ALL_OF: string;
|
|
10
|
+
BASIC: string;
|
|
11
|
+
ARRAY: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const isReadOnlySchema: (schema: Schema) => boolean;
|
|
14
|
+
export declare const isPromotedOneOfSchema: (schema: Schema) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Please use isOneOfSchema type guard function from "dynamic-flow-types"
|
|
17
|
+
*/
|
|
18
|
+
export declare const isOneOfSchema: typeof isOneOfSchemaDF;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Please use isAllOfSchema type guard function from "dynamic-flow-types"
|
|
21
|
+
*/
|
|
22
|
+
export declare const isAllOfSchema: typeof isAllOfSchemaDF;
|
|
23
|
+
export declare const getSchemaType: (schema: Schema) => string | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { isAllOfSchema as isAllOfSchemaDF, isOneOfSchema as isOneOfSchemaDF, isObjectSchema, isArraySchema, isPersistAsyncSchema, isValidationAsyncSchema, isBasicSchema, } from '../../dynamic-flow-types';
|
|
2
|
+
export var schemaType = {
|
|
3
|
+
READ_ONLY: 'readOnly',
|
|
4
|
+
PERSIST_ASYNC: 'persistAsync',
|
|
5
|
+
VALIDATION_ASYNC: 'validationAsync',
|
|
6
|
+
OBJECT: 'object',
|
|
7
|
+
PROMOTED_ONE_OF: 'promotedOneOf',
|
|
8
|
+
ONE_OF: 'oneOf',
|
|
9
|
+
ALL_OF: 'allOf',
|
|
10
|
+
BASIC: 'basic',
|
|
11
|
+
ARRAY: 'array'
|
|
12
|
+
};
|
|
13
|
+
export var isReadOnlySchema = function (schema) { return !!schema.readOnly && isBasicSchema(schema); };
|
|
14
|
+
export var isPromotedOneOfSchema = function (schema) { return !!schema.oneOf && !!schema.promotion; };
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Please use isOneOfSchema type guard function from "dynamic-flow-types"
|
|
17
|
+
*/
|
|
18
|
+
export var isOneOfSchema = isOneOfSchemaDF;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Please use isAllOfSchema type guard function from "dynamic-flow-types"
|
|
21
|
+
*/
|
|
22
|
+
export var isAllOfSchema = isAllOfSchemaDF;
|
|
23
|
+
export var getSchemaType = function (schema) {
|
|
24
|
+
// Order of application is important here
|
|
25
|
+
if (isReadOnlySchema(schema)) {
|
|
26
|
+
return schemaType.READ_ONLY;
|
|
27
|
+
}
|
|
28
|
+
if (isPersistAsyncSchema(schema)) {
|
|
29
|
+
return schemaType.PERSIST_ASYNC;
|
|
30
|
+
}
|
|
31
|
+
if (isValidationAsyncSchema(schema)) {
|
|
32
|
+
return schemaType.VALIDATION_ASYNC;
|
|
33
|
+
}
|
|
34
|
+
if (isObjectSchema(schema)) {
|
|
35
|
+
return schemaType.OBJECT;
|
|
36
|
+
}
|
|
37
|
+
if (isArraySchema(schema)) {
|
|
38
|
+
return schemaType.ARRAY;
|
|
39
|
+
}
|
|
40
|
+
if (isPromotedOneOfSchema(schema)) {
|
|
41
|
+
return schemaType.PROMOTED_ONE_OF;
|
|
42
|
+
}
|
|
43
|
+
if (isOneOfSchema(schema)) {
|
|
44
|
+
return schemaType.ONE_OF;
|
|
45
|
+
}
|
|
46
|
+
if (isAllOfSchema(schema)) {
|
|
47
|
+
return schemaType.ALL_OF;
|
|
48
|
+
}
|
|
49
|
+
if (isBasicSchema(schema)) {
|
|
50
|
+
return schemaType.BASIC;
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Schema, Step } from '../../dynamic-flow-types';
|
|
2
|
+
export declare const stepType: {
|
|
3
|
+
LAYOUT: string;
|
|
4
|
+
CAMERA: string;
|
|
5
|
+
};
|
|
6
|
+
export declare const filterHiddenSchemas: (schemas: Schema[]) => Schema[];
|
|
7
|
+
export declare const getStepType: (step: Step) => string;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { isFileUploadSchema, isObjectSchema } from '../../dynamic-flow-types';
|
|
2
|
+
export var stepType = {
|
|
3
|
+
LAYOUT: 'layout',
|
|
4
|
+
CAMERA: 'camera'
|
|
5
|
+
};
|
|
6
|
+
var isCameraStep = function (step) {
|
|
7
|
+
return isFormStep(step) && hasSingleAction(step) && hasSingleFileUploadSchemaWithCameraOnly(step);
|
|
8
|
+
};
|
|
9
|
+
var isFormStep = function (step) { return (step === null || step === void 0 ? void 0 : step.type) === 'form'; };
|
|
10
|
+
var hasSingleAction = function (step) { var _a; return ((_a = step === null || step === void 0 ? void 0 : step.actions) === null || _a === void 0 ? void 0 : _a.length) === 1; };
|
|
11
|
+
var hasSingleFileUploadSchemaWithCameraOnly = function (step) {
|
|
12
|
+
if (!step.schemas) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
var schemas = filterHiddenSchemas(step.schemas);
|
|
16
|
+
if ((schemas === null || schemas === void 0 ? void 0 : schemas.length) !== 1) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
var firstSchema = schemas[0];
|
|
20
|
+
if (!isObjectSchema(firstSchema) || Object.values(firstSchema.properties).length !== 1) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
var childSchema = Object.values(firstSchema.properties)[0];
|
|
24
|
+
if (!isFileUploadSchema(childSchema)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
return childSchema.source === 'camera';
|
|
28
|
+
};
|
|
29
|
+
export var filterHiddenSchemas = function (schemas) {
|
|
30
|
+
return schemas.filter(function (schema) {
|
|
31
|
+
if (isObjectSchema(schema)) {
|
|
32
|
+
return Object.values((schema === null || schema === void 0 ? void 0 : schema.properties) || {}).find(function (schema) { return (schema === null || schema === void 0 ? void 0 : schema.hidden) !== true; });
|
|
33
|
+
}
|
|
34
|
+
return (schema === null || schema === void 0 ? void 0 : schema.hidden) !== true;
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
export var getStepType = function (step) {
|
|
38
|
+
if (isCameraStep(step)) {
|
|
39
|
+
return stepType.CAMERA;
|
|
40
|
+
}
|
|
41
|
+
return stepType.LAYOUT;
|
|
42
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type TrackableEventName = 'Dynamic Flow - Flow Started' | 'Dynamic Flow - Flow Finished' | 'Dynamic Flow - Step Started' | 'Dynamic Flow - Step Submitted' | 'Dynamic Flow - Step Refreshed' | 'Dynamic Flow - OneOf Selected' | 'Dynamic Flow - PersistAsync' | 'Dynamic Flow - ValidationAsync' | 'Dynamic Flow - Camera Permission Denied' | 'Dynamic Flow - Camera Feed Started' | 'Dynamic Flow - Camera Not Supported' | 'Dynamic Flow - invalid submission response' | 'Dynamic Flow - onAction supressed' | 'Dynamic Flow - OneOf Searched';
|
|
3
|
+
export type TrackableEventHandler = (eventName: TrackableEventName, properties: Record<string, unknown>) => void;
|
|
4
|
+
type Props = {
|
|
5
|
+
metadata?: Record<string, unknown> & {
|
|
6
|
+
flowId?: string;
|
|
7
|
+
stepId?: string;
|
|
8
|
+
};
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
onTrackableEvent: TrackableEventHandler;
|
|
11
|
+
};
|
|
12
|
+
export declare const TrackingContextProvider: ({ metadata, children, onTrackableEvent }: Props) => JSX.Element;
|
|
13
|
+
export declare function useTracking(): TrackableEventHandler;
|
|
14
|
+
export declare const getTracker: (onTrackableEvent: TrackableEventHandler, metadata?: Record<string, unknown>) => TrackableEventHandler;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { createContext, useContext, useMemo } from 'react';
|
|
14
|
+
var TrackingContext = createContext({
|
|
15
|
+
trackEvent: function () {
|
|
16
|
+
// noop
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export var TrackingContextProvider = function (_a) {
|
|
20
|
+
var metadata = _a.metadata, children = _a.children, onTrackableEvent = _a.onTrackableEvent;
|
|
21
|
+
var value = useMemo(function () { return ({ trackEvent: getTracker(onTrackableEvent, metadata) }); }, [onTrackableEvent, metadata]);
|
|
22
|
+
return _jsx(TrackingContext.Provider, __assign({ value: value }, { children: children }));
|
|
23
|
+
};
|
|
24
|
+
export function useTracking() {
|
|
25
|
+
var trackEvent = useContext(TrackingContext).trackEvent;
|
|
26
|
+
return trackEvent;
|
|
27
|
+
}
|
|
28
|
+
export var getTracker = function (onTrackableEvent, metadata) {
|
|
29
|
+
return function (eventName, properties) {
|
|
30
|
+
if (properties === void 0) { properties = {}; }
|
|
31
|
+
return onTrackableEvent(eventName, __assign(__assign({}, metadata), properties));
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { render } from '@testing-library/react';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
|
+
import { TrackingContextProvider, useTracking } from '.';
|
|
16
|
+
describe('Tracking Provider', function () {
|
|
17
|
+
var TestChild = function (_a) {
|
|
18
|
+
var eventName = _a.eventName, properties = _a.properties;
|
|
19
|
+
var trackEvent = useTracking();
|
|
20
|
+
useEffect(function () {
|
|
21
|
+
trackEvent(eventName, properties);
|
|
22
|
+
}, []);
|
|
23
|
+
return _jsx("span", { children: eventName });
|
|
24
|
+
};
|
|
25
|
+
describe('when provider is initialised with metadata', function () {
|
|
26
|
+
describe('and is called upon mounting', function () {
|
|
27
|
+
function renderComponent(onTrackableEvent) {
|
|
28
|
+
render(_jsx(TrackingContextProvider, __assign({ metadata: { flowId: 'myFlowId', stepId: 'myStepId', custom: 'property' }, onTrackableEvent: onTrackableEvent }, { children: _jsx(TestChild, { eventName: "Dynamic Flow - Flow Started", properties: { custom: 'property' } }) })));
|
|
29
|
+
}
|
|
30
|
+
describe('it calls the onTrackableEvent callback', function () {
|
|
31
|
+
it('with the specified eventName', function () {
|
|
32
|
+
var onTrackableEvent = jest.fn();
|
|
33
|
+
renderComponent(onTrackableEvent);
|
|
34
|
+
expect(onTrackableEvent).toHaveBeenCalledWith('Dynamic Flow - Flow Started', expect.anything());
|
|
35
|
+
});
|
|
36
|
+
it('with the specified custom properties', function () {
|
|
37
|
+
var onTrackableEvent = jest.fn();
|
|
38
|
+
renderComponent(onTrackableEvent);
|
|
39
|
+
expect(onTrackableEvent).toHaveBeenCalledWith('Dynamic Flow - Flow Started', expect.objectContaining({ custom: 'property' }));
|
|
40
|
+
});
|
|
41
|
+
it('with the specified flow and step ids any custom properties', function () {
|
|
42
|
+
var onTrackableEvent = jest.fn();
|
|
43
|
+
renderComponent(onTrackableEvent);
|
|
44
|
+
expect(onTrackableEvent).toHaveBeenCalledWith('Dynamic Flow - Flow Started', expect.objectContaining({ flowId: 'myFlowId', stepId: 'myStepId', custom: 'property' }));
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { UploadedFile } from '@transferwise/components';
|
|
2
|
+
export declare function toKilobytes(sizeInBytes: number): number;
|
|
3
|
+
export declare const toBase64: (file: Blob) => Promise<string>;
|
|
4
|
+
export declare function areFilesSame(newFiles: UploadedFile[], files: UploadedFile[]): boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
export function toKilobytes(sizeInBytes) {
|
|
13
|
+
var ONE_KB_IN_BYTES = 1024;
|
|
14
|
+
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
15
|
+
}
|
|
16
|
+
//TODO: Refactor: This is duplicate logic as in CameraStep.tsx
|
|
17
|
+
export var toBase64 = function (file) {
|
|
18
|
+
return new Promise(function (resolve, reject) {
|
|
19
|
+
// we can safely assume the type of reader.result is string
|
|
20
|
+
// because we're calling reader.readAsDataURL
|
|
21
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
22
|
+
var reader = new FileReader();
|
|
23
|
+
reader.readAsDataURL(file);
|
|
24
|
+
reader.addEventListener('load', function () { return resolve(reader.result); });
|
|
25
|
+
reader.addEventListener('error', function (error) { return reject(error); });
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export function areFilesSame(newFiles, files) {
|
|
29
|
+
var fileIdToExistingFileMap = files.reduce(function (map, fileObject) {
|
|
30
|
+
var _a;
|
|
31
|
+
return __assign(__assign({}, map), (_a = {}, _a[fileObject.id] = fileObject, _a));
|
|
32
|
+
}, {});
|
|
33
|
+
for (var _i = 0, newFiles_1 = newFiles; _i < newFiles_1.length; _i++) {
|
|
34
|
+
var newFile = newFiles_1[_i];
|
|
35
|
+
var existingFileObject = fileIdToExistingFileMap[newFile.id];
|
|
36
|
+
var fileDoesNotExistAlready = !existingFileObject;
|
|
37
|
+
if (fileDoesNotExistAlready) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (existingFileObject.status !== newFile.status) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateRandomId: (prefix?: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { generateRandomId } from './generate-random-id';
|
|
2
|
+
jest.spyOn(Math, 'random').mockReturnValue(0.123456789);
|
|
3
|
+
describe('generateRandomId', function () {
|
|
4
|
+
it('should generate a random id', function () {
|
|
5
|
+
var id = generateRandomId();
|
|
6
|
+
expect(id).toBe('12345678');
|
|
7
|
+
});
|
|
8
|
+
it('should generate a random id with a prefix', function () {
|
|
9
|
+
var id = generateRandomId('prefix');
|
|
10
|
+
expect(id).toBe('prefix-12345678');
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function isValidRequired(value: unknown, isRequired?: boolean): boolean;
|
|
2
|
+
declare function isValidRequiredArray(value: unknown, isRequired?: boolean): boolean;
|
|
3
|
+
declare function isValidMinLength(value: unknown, minLength: number | undefined): boolean;
|
|
4
|
+
declare function isValidMaxLength(value: unknown, maxLength: number | undefined): boolean;
|
|
5
|
+
declare function isValidPattern(value: string | undefined | null, pattern: string | undefined): boolean;
|
|
6
|
+
declare function isValidMaximum(value: unknown, maximum: string | number | undefined): boolean;
|
|
7
|
+
declare function isValidMinimum(value: unknown, minimum: string | number | undefined): boolean;
|
|
8
|
+
declare function isValidMinItems(value: unknown, minItems: number | undefined): boolean;
|
|
9
|
+
declare function isValidMaxItems(value: unknown, maxItems: number | undefined): boolean;
|
|
10
|
+
export { isValidRequired, isValidMinLength, isValidMaxLength, isValidPattern, isValidMaximum, isValidMinimum, isValidMinItems, isValidMaxItems, isValidRequiredArray, };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isArray, isNumber, isString, isUndefined } from '@transferwise/neptune-validation';
|
|
2
|
+
function isValidRequired(value, isRequired) {
|
|
3
|
+
if (isRequired === void 0) { isRequired = false; }
|
|
4
|
+
return !isRequired || !isUndefined(value);
|
|
5
|
+
}
|
|
6
|
+
function isValidRequiredArray(value, isRequired) {
|
|
7
|
+
if (isRequired === void 0) { isRequired = false; }
|
|
8
|
+
return !isRequired || isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function isValidMinLength(value, minLength) {
|
|
11
|
+
return !isNumber(minLength) || (isString(value) && value.length >= minLength);
|
|
12
|
+
}
|
|
13
|
+
function isValidMaxLength(value, maxLength) {
|
|
14
|
+
return !isNumber(maxLength) || (isString(value) && value.length <= maxLength);
|
|
15
|
+
}
|
|
16
|
+
function isValidPattern(value, pattern) {
|
|
17
|
+
if (pattern === undefined) {
|
|
18
|
+
return true; // no pattern, therefore the value is valid
|
|
19
|
+
}
|
|
20
|
+
if (value === undefined || value === null) {
|
|
21
|
+
return false; // no value, but there's a pattern, therefore the value is NOT valid
|
|
22
|
+
}
|
|
23
|
+
var regex = new RegExp(pattern);
|
|
24
|
+
return !!regex.test(value);
|
|
25
|
+
}
|
|
26
|
+
function isValidMaximum(value, maximum) {
|
|
27
|
+
return ((!isNumber(maximum) && !isString(maximum)) ||
|
|
28
|
+
((isNumber(value) || isString(value)) && value <= maximum));
|
|
29
|
+
}
|
|
30
|
+
function isValidMinimum(value, minimum) {
|
|
31
|
+
return ((!isNumber(minimum) && !isString(minimum)) ||
|
|
32
|
+
((isNumber(value) || isString(value)) && value >= minimum));
|
|
33
|
+
}
|
|
34
|
+
function isValidMinItems(value, minItems) {
|
|
35
|
+
return !isNumber(minItems) || (isArray(value) && value.length >= minItems);
|
|
36
|
+
}
|
|
37
|
+
function isValidMaxItems(value, maxItems) {
|
|
38
|
+
return !isNumber(maxItems) || (isArray(value) && value.length <= maxItems);
|
|
39
|
+
}
|
|
40
|
+
export { isValidRequired, isValidMinLength, isValidMaxLength, isValidPattern, isValidMaximum, isValidMinimum, isValidMinItems, isValidMaxItems, isValidRequiredArray, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|