@wise/dynamic-flow-client 0.3.0-beta-d45b31.38 → 0.3.0
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/README.md +50 -28
- package/build/common/constants/DateMode.d.ts +4 -0
- package/build/common/constants/DateMode.js +4 -0
- package/build/common/constants/FormControlType.d.ts +17 -0
- package/build/common/constants/FormControlType.js +17 -0
- package/build/common/constants/MonthFormat.d.ts +4 -0
- package/build/common/constants/MonthFormat.js +4 -0
- package/build/common/constants/SchemaType.d.ts +11 -0
- package/build/common/constants/SchemaType.js +11 -0
- package/build/common/constants/Size.d.ts +7 -0
- package/build/common/constants/Size.js +7 -0
- package/build/common/constants/index.d.ts +5 -0
- package/build/common/constants/index.js +5 -0
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +11 -0
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +4 -0
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
- package/build/common/contexts/eventsContext/EventsContext.d.ts +15 -0
- package/build/common/contexts/eventsContext/EventsContext.js +33 -0
- package/build/common/contexts/fetcherContexts/FetcherContexts.d.ts +18 -0
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +35 -0
- package/build/common/contexts/index.d.ts +4 -0
- package/build/common/contexts/index.js +4 -0
- package/build/common/contexts/logContext/LogContext.d.ts +22 -0
- package/build/common/contexts/logContext/LogContext.js +39 -0
- package/build/common/hooks/index.d.ts +7 -0
- package/build/common/hooks/index.js +7 -0
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +2 -0
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
- package/build/common/hooks/useExternal/useExternal.d.ts +4 -0
- package/build/common/hooks/useExternal/useExternal.js +15 -0
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +12 -0
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +69 -0
- package/build/common/hooks/usePersistAsync/usePersistAsync.d.ts +7 -0
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +170 -0
- package/build/common/hooks/usePolling/usePolling.d.ts +11 -0
- package/build/common/hooks/usePolling/usePolling.js +48 -0
- package/build/common/hooks/usePrevious/usePrevious.d.ts +1 -0
- package/build/common/hooks/usePrevious/usePrevious.js +8 -0
- package/build/common/hooks/useStepPolling/useStepPolling.d.ts +2 -0
- package/build/common/hooks/useStepPolling/useStepPolling.js +44 -0
- package/build/common/makeFetcher/index.d.ts +1 -0
- package/build/common/makeFetcher/index.js +1 -0
- package/build/common/makeFetcher/makeFetcher.d.ts +2 -0
- package/build/common/makeFetcher/makeFetcher.js +33 -0
- package/build/common/messages.d.ts +8 -0
- package/build/common/messages.js +8 -0
- package/build/common/utils/api-utils.d.ts +4 -0
- package/build/common/utils/api-utils.js +13 -0
- package/build/common/utils/date-utils.d.ts +2 -0
- package/build/common/utils/date-utils.js +22 -0
- package/build/common/utils/debounce.d.ts +6 -0
- package/build/common/utils/debounce.js +38 -0
- package/build/common/utils/file-utils.d.ts +4 -0
- package/build/common/utils/file-utils.js +45 -0
- package/build/common/utils/id-utils.d.ts +1 -0
- package/build/common/utils/id-utils.js +5 -0
- package/build/common/utils/index.d.ts +8 -0
- package/build/common/utils/index.js +8 -0
- package/build/common/utils/is-equal.d.ts +1 -0
- package/build/common/utils/is-equal.js +21 -0
- package/build/common/utils/schema-utils.d.ts +13 -0
- package/build/common/utils/schema-utils.js +48 -0
- package/build/common/utils/step-utils.d.ts +7 -0
- package/build/common/utils/step-utils.js +42 -0
- package/build/common/validators/index.d.ts +5 -0
- package/build/common/validators/index.js +5 -0
- package/build/common/validators/models/model-validators.d.ts +4 -0
- package/build/common/validators/models/model-validators.js +63 -0
- package/build/common/validators/models/models.utils.d.ts +10 -0
- package/build/common/validators/models/models.utils.js +118 -0
- package/build/common/validators/schemas/schema-validators.d.ts +9 -0
- package/build/common/validators/schemas/schema-validators.js +98 -0
- package/build/common/validators/types/type-validators.d.ts +8 -0
- package/build/common/validators/types/type-validators.js +14 -0
- package/build/common/validators/validationFailures/validation-failures.d.ts +23 -0
- package/build/common/validators/validationFailures/validation-failures.js +140 -0
- package/build/common/validators/validationFailures/validation-failures.utils.d.ts +10 -0
- package/build/common/validators/validationFailures/validation-failures.utils.js +40 -0
- package/build/common/validators/values/value-validators.d.ts +2 -0
- package/build/common/validators/values/value-validators.js +6 -0
- package/build/dynamicFlow/DynamicFlow.d.ts +3 -0
- package/build/dynamicFlow/DynamicFlow.js +370 -0
- package/build/dynamicFlow/DynamicFlowStep.d.ts +8 -0
- package/build/dynamicFlow/DynamicFlowStep.js +32 -0
- package/build/dynamicFlow/DynamicFlowTypes.d.ts +51 -0
- package/build/dynamicFlow/DynamicFlowTypes.js +4 -0
- package/build/dynamicFlow/index.d.ts +1 -0
- package/build/dynamicFlow/index.js +1 -0
- package/build/dynamicFlow/stories/DynamicFlow.story.d.ts +1 -0
- package/build/dynamicFlow/stories/DynamicFlow.story.js +30 -0
- package/build/dynamicFlow/stories/EditableDynamicFlow.d.ts +4 -0
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +62 -0
- package/build/dynamicFlow/stories/fixtureFetcher.d.ts +2 -0
- package/build/dynamicFlow/stories/fixtureFetcher.js +114 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.d.ts +20 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +45 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.d.ts +13 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +13 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.d.ts +5 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +12 -0
- package/build/dynamicFlow/utils/index.d.ts +5 -0
- package/build/dynamicFlow/utils/index.js +5 -0
- package/build/dynamicFlow/utils/responseParsers/response-parsers.d.ts +17 -0
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +125 -0
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +23 -0
- package/build/dynamicFlow/utils/useDynamicFlowState.d.ts +18 -0
- package/build/dynamicFlow/utils/useDynamicFlowState.js +110 -0
- package/build/dynamicFlow/utils/useLoader.d.ts +9 -0
- package/build/dynamicFlow/utils/useLoader.js +22 -0
- package/build/fixtures/components/alert.d.ts +3 -0
- package/build/fixtures/components/alert.js +31 -0
- package/build/fixtures/components/box.d.ts +3 -0
- package/build/fixtures/components/box.js +20 -0
- package/build/fixtures/components/button.d.ts +3 -0
- package/build/fixtures/components/button.js +65 -0
- package/build/fixtures/components/columns.d.ts +3 -0
- package/build/fixtures/components/columns.js +36 -0
- package/build/fixtures/components/copyable.d.ts +3 -0
- package/build/fixtures/components/copyable.js +22 -0
- package/build/fixtures/components/decision.d.ts +3 -0
- package/build/fixtures/components/decision.js +54 -0
- package/build/fixtures/components/heading.d.ts +3 -0
- package/build/fixtures/components/heading.js +14 -0
- package/build/fixtures/components/image.d.ts +3 -0
- package/build/fixtures/components/image.js +23 -0
- package/build/fixtures/components/index.d.ts +13 -0
- package/build/fixtures/components/index.js +13 -0
- package/build/fixtures/components/info.d.ts +3 -0
- package/build/fixtures/components/info.js +17 -0
- package/build/fixtures/components/list.d.ts +3 -0
- package/build/fixtures/components/list.js +34 -0
- package/build/fixtures/components/loading-indicator.d.ts +3 -0
- package/build/fixtures/components/loading-indicator.js +16 -0
- package/build/fixtures/components/paragraph.d.ts +3 -0
- package/build/fixtures/components/paragraph.js +28 -0
- package/build/fixtures/components/review.d.ts +3 -0
- package/build/fixtures/components/review.js +60 -0
- package/build/fixtures/examples/camera-capture.d.ts +3 -0
- package/build/fixtures/examples/camera-capture.js +121 -0
- package/build/fixtures/examples/index.d.ts +5 -0
- package/build/fixtures/examples/index.js +5 -0
- package/build/fixtures/examples/recipient-update.d.ts +3 -0
- package/build/fixtures/examples/recipient-update.js +250 -0
- package/build/fixtures/examples/recipient.d.ts +3 -0
- package/build/fixtures/examples/recipient.js +313 -0
- package/build/fixtures/examples/single-file-upload.d.ts +3 -0
- package/build/fixtures/examples/single-file-upload.js +98 -0
- package/build/fixtures/examples/step-validation-errors.d.ts +3 -0
- package/build/fixtures/examples/step-validation-errors.js +75 -0
- package/build/fixtures/features/action-response.d.ts +3 -0
- package/build/fixtures/features/action-response.js +29 -0
- package/build/fixtures/features/external.d.ts +3 -0
- package/build/fixtures/features/external.js +31 -0
- package/build/fixtures/features/index.d.ts +5 -0
- package/build/fixtures/features/index.js +5 -0
- package/build/fixtures/features/persist-async.d.ts +3 -0
- package/build/fixtures/features/persist-async.js +44 -0
- package/build/fixtures/features/polling.d.ts +3 -0
- package/build/fixtures/features/polling.js +33 -0
- package/build/fixtures/features/validation-async.d.ts +3 -0
- package/build/fixtures/features/validation-async.js +38 -0
- package/build/fixtures/index.d.ts +46 -0
- package/build/fixtures/index.js +23 -0
- package/build/fixtures/jsonSchemaForm/allOf.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/allOf.js +119 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.js +1104 -0
- package/build/fixtures/jsonSchemaForm/currency.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/currency.js +48 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +37 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +36 -0
- package/build/fixtures/jsonSchemaForm/oneOf.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/oneOf.js +119 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +53 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +56 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +102 -0
- package/build/fixtures/jsonSchemaForm/simple.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/simple.js +48 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +71 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +3 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.js +23 -0
- package/build/fixtures/layouts/all.d.ts +3 -0
- package/build/fixtures/layouts/all.js +176 -0
- package/build/fixtures/layouts/final-step-layout.d.ts +3 -0
- package/build/fixtures/layouts/final-step-layout.js +39 -0
- package/build/fixtures/layouts/index.d.ts +6 -0
- package/build/fixtures/layouts/index.js +6 -0
- package/build/fixtures/layouts/list.d.ts +3 -0
- package/build/fixtures/layouts/list.js +33 -0
- package/build/fixtures/layouts/pay-in.d.ts +3 -0
- package/build/fixtures/layouts/pay-in.js +97 -0
- package/build/fixtures/layouts/review.d.ts +3 -0
- package/build/fixtures/layouts/review.js +160 -0
- package/build/fixtures/layouts/success.d.ts +3 -0
- package/build/fixtures/layouts/success.js +66 -0
- package/build/fixtures/responses/action-response-final.d.ts +3 -0
- package/build/fixtures/responses/action-response-final.js +24 -0
- package/build/fixtures/responses/action.d.ts +5 -0
- package/build/fixtures/responses/action.js +2 -0
- package/build/fixtures/responses/exit.d.ts +6 -0
- package/build/fixtures/responses/exit.js +2 -0
- package/build/fixtures/responses/index.d.ts +4 -0
- package/build/fixtures/responses/index.js +4 -0
- package/build/fixtures/responses/recipient-update-final.d.ts +3 -0
- package/build/fixtures/responses/recipient-update-final.js +24 -0
- package/build/fixtures/schemas/basic-form.d.ts +3 -0
- package/build/fixtures/schemas/basic-form.js +39 -0
- package/build/fixtures/schemas/index.d.ts +4 -0
- package/build/fixtures/schemas/index.js +4 -0
- package/build/fixtures/schemas/number-and-integer.d.ts +3 -0
- package/build/fixtures/schemas/number-and-integer.js +41 -0
- package/build/fixtures/schemas/one-of.d.ts +3 -0
- package/build/fixtures/schemas/one-of.js +223 -0
- package/build/fixtures/schemas/string-formats.d.ts +3 -0
- package/build/fixtures/schemas/string-formats.js +62 -0
- package/build/fixtures/utils/image-util.d.ts +2 -0
- package/build/fixtures/utils/image-util.js +18 -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/utils/index.d.ts +1 -0
- package/build/formControl/utils/index.js +1 -0
- package/build/formControl/utils/value-utils.d.ts +9 -0
- package/build/formControl/utils/value-utils.js +108 -0
- package/build/i18n/cs.json +8 -0
- package/build/i18n/de.json +38 -0
- package/build/i18n/en.json +38 -0
- package/build/i18n/es.json +38 -0
- package/build/i18n/fr.json +38 -0
- package/build/i18n/hu.json +38 -0
- package/build/i18n/id.json +38 -0
- package/build/i18n/index.d.ts +2 -0
- package/build/i18n/index.js +31 -0
- package/build/i18n/it.json +38 -0
- package/build/i18n/ja.json +38 -0
- package/build/i18n/pl.json +38 -0
- package/build/i18n/pt.json +38 -0
- package/build/i18n/ro.json +38 -0
- package/build/i18n/ru.json +38 -0
- package/build/i18n/th.json +38 -0
- package/build/i18n/tr.json +38 -0
- package/build/i18n/uk.json +8 -0
- package/build/i18n/zh-CN.json +38 -0
- package/build/i18n/zh.json +38 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +9 -0
- package/build/jsonSchemaForm/JsonSchemaForm.d.ts +64 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +29 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +13 -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 +14 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +15 -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 +17 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +140 -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/utils/index.d.ts +2 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +6 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +84 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +9 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -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 +21 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +103 -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 +30 -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 +18 -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 +7 -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 +15 -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 +14 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +150 -0
- package/build/jsonSchemaForm/oneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.d.ts +3 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +8 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/index.d.ts +2 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +2 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.d.ts +5 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +64 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +15 -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/index.d.ts +2 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +20 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +19 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +126 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +32 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +8 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.d.ts +2 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +6 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +23 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +8 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +7 -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 +24 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +104 -0
- package/build/jsonSchemaForm/schemaFormControl/index.d.ts +1 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.d.ts +3 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +73 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/index.d.ts +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +34 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +95 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +16 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +146 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +2 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
- package/build/layout/DynamicLayout.d.ts +16 -0
- package/build/layout/DynamicLayout.js +61 -0
- package/build/layout/alert/DynamicAlert.d.ts +5 -0
- package/build/layout/alert/DynamicAlert.js +29 -0
- package/build/layout/box/DynamicBox.d.ts +7 -0
- package/build/layout/box/DynamicBox.js +41 -0
- package/build/layout/button/DynamicButton.d.ts +7 -0
- package/build/layout/button/DynamicButton.js +58 -0
- package/build/layout/columns/DynamicColumns.d.ts +7 -0
- package/build/layout/columns/DynamicColumns.js +38 -0
- package/build/layout/decision/DynamicDecision.d.ts +8 -0
- package/build/layout/decision/DynamicDecision.js +38 -0
- package/build/layout/divider/DynamicDivider.d.ts +6 -0
- package/build/layout/divider/DynamicDivider.js +9 -0
- package/build/layout/external/DynamicExternal.d.ts +8 -0
- package/build/layout/external/DynamicExternal.js +32 -0
- package/build/layout/external/DynamicExternal.messages.d.ts +8 -0
- package/build/layout/external/DynamicExternal.messages.js +8 -0
- package/build/layout/form/DynamicForm.d.ts +7 -0
- package/build/layout/form/DynamicForm.js +22 -0
- package/build/layout/heading/DynamicHeading.d.ts +5 -0
- package/build/layout/heading/DynamicHeading.js +31 -0
- package/build/layout/icon/DynamicIcon.d.ts +6 -0
- package/build/layout/icon/DynamicIcon.js +23 -0
- package/build/layout/image/DynamicImage.d.ts +6 -0
- package/build/layout/image/DynamicImage.js +110 -0
- package/build/layout/index.d.ts +17 -0
- package/build/layout/index.js +17 -0
- package/build/layout/info/DynamicInfo.d.ts +6 -0
- package/build/layout/info/DynamicInfo.js +19 -0
- package/build/layout/list/DynamicList.d.ts +7 -0
- package/build/layout/list/DynamicList.js +31 -0
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.d.ts +6 -0
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
- package/build/layout/paragraph/DynamicParagraph.d.ts +6 -0
- package/build/layout/paragraph/DynamicParagraph.js +43 -0
- package/build/layout/paragraph/DynamicParagraph.messages.d.ts +13 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +13 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +10 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +9 -0
- package/build/layout/review/DynamicReview.d.ts +8 -0
- package/build/layout/review/DynamicReview.js +33 -0
- package/build/layout/utils.d.ts +7 -0
- package/build/layout/utils.js +31 -0
- package/build/main.css +185 -0
- package/build/step/cameraStep/CameraStep.d.ts +7 -0
- package/build/step/cameraStep/CameraStep.js +125 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +15 -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 +7 -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 +10 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +78 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +2 -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 +5 -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 +98 -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 +6 -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/index.d.ts +3 -0
- package/build/step/index.js +3 -0
- package/build/step/layoutStep/LayoutStep.d.ts +10 -0
- package/build/step/layoutStep/LayoutStep.js +33 -0
- package/build/step/layoutStep/index.d.ts +1 -0
- package/build/step/layoutStep/index.js +1 -0
- package/build/step/layoutStep/utils/index.d.ts +2 -0
- package/build/step/layoutStep/utils/index.js +2 -0
- package/build/step/layoutStep/utils/inline-reference-utils.d.ts +7 -0
- package/build/step/layoutStep/utils/inline-reference-utils.js +91 -0
- package/build/step/layoutStep/utils/layout-utils.d.ts +8 -0
- package/build/step/layoutStep/utils/layout-utils.js +217 -0
- package/build/types/common/FormControl.d.ts +57 -0
- package/build/types/common/FormControl.js +1 -0
- package/build/types/index.d.ts +15 -0
- package/build/types/index.js +13 -0
- package/build/types/specification/Action.d.ts +19 -0
- package/build/types/specification/Action.js +1 -0
- package/build/types/specification/FileUploadSchema.d.ts +23 -0
- package/build/types/specification/FileUploadSchema.js +4 -0
- package/build/types/specification/LayoutComponent.d.ts +129 -0
- package/build/types/specification/LayoutComponent.js +1 -0
- package/build/types/specification/Model.d.ts +12 -0
- package/build/types/specification/Model.js +29 -0
- package/build/types/specification/PersistAsync.d.ts +8 -0
- package/build/types/specification/PersistAsync.js +1 -0
- package/build/types/specification/Polling.d.ts +12 -0
- package/build/types/specification/Polling.js +1 -0
- package/build/types/specification/Promotion.d.ts +20 -0
- package/build/types/specification/Promotion.js +1 -0
- package/build/types/specification/Schema.d.ts +184 -0
- package/build/types/specification/Schema.js +50 -0
- package/build/types/specification/Step.d.ts +127 -0
- package/build/types/specification/Step.js +4 -0
- package/build/types/specification/ValidationAsync.d.ts +6 -0
- package/build/types/specification/ValidationAsync.js +1 -0
- package/build/types/specification/core.d.ts +29 -0
- package/build/types/specification/core.js +1 -0
- package/package.json +40 -52
package/README.md
CHANGED
|
@@ -23,17 +23,18 @@ pnpm install @wise/dynamic-flow-client
|
|
|
23
23
|
|
|
24
24
|
```
|
|
25
25
|
# yarn
|
|
26
|
-
yarn add
|
|
27
|
-
yarn add @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
26
|
+
yarn add react react-dom react-intl
|
|
27
|
+
yarn add @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
28
28
|
|
|
29
29
|
# npm
|
|
30
|
-
npm install
|
|
31
|
-
npm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
30
|
+
npm install react react-dom react-intl
|
|
31
|
+
npm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
32
32
|
|
|
33
33
|
# pnpm
|
|
34
|
-
pnpm install
|
|
35
|
-
pnpm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
34
|
+
pnpm install react react-dom react-intl
|
|
35
|
+
pnpm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
|
|
36
36
|
```
|
|
37
|
+
**Note:** Keep in mind that some of these dependencies have their own peer dependencies. Don't forget to install those, for instance: `@transferwise/components` needs `@wise/art` and `@wise/components-theming`.
|
|
37
38
|
|
|
38
39
|
```js
|
|
39
40
|
// Should be imported once in your application
|
|
@@ -50,10 +51,7 @@ import {
|
|
|
50
51
|
getLangFromLocale,
|
|
51
52
|
DEFAULT_LANG,
|
|
52
53
|
} from '@transferwise/components';
|
|
53
|
-
import {
|
|
54
|
-
DynamicFlow,
|
|
55
|
-
translations as dynamicFlowsTranslations,
|
|
56
|
-
} from '@wise/dynamic-flow-client/';
|
|
54
|
+
import { DynamicFlow, translations as dynamicFlowsTranslations } from '@wise/dynamic-flow-client/';
|
|
57
55
|
|
|
58
56
|
const lang = getLangFromLocale(locale) || DEFAULT_LANG;
|
|
59
57
|
const i18n = {
|
|
@@ -88,7 +86,7 @@ We recommend using a `initialAction` and a `fetcher` function.
|
|
|
88
86
|
<DynamicFlow
|
|
89
87
|
initialAction={{ method: 'GET', url: '/my-amazing-new-flow' }}
|
|
90
88
|
fetcher={(...args) => fetch(...args)}
|
|
91
|
-
|
|
89
|
+
onComplete={(result) => {
|
|
92
90
|
console.log('Flow exited with', result);
|
|
93
91
|
}}
|
|
94
92
|
onError={(error, statusCode) => {
|
|
@@ -105,44 +103,70 @@ In some cases you may want to obtain the initial step yourself, and then pass it
|
|
|
105
103
|
<DynamicFlow
|
|
106
104
|
initialStep={someInitialStepIfoundLayingAroundHere}
|
|
107
105
|
fetcher={...}
|
|
108
|
-
|
|
106
|
+
onComplete={...}
|
|
109
107
|
onError={...}
|
|
110
108
|
/>
|
|
111
109
|
```
|
|
112
110
|
|
|
113
|
-
### `
|
|
111
|
+
### The `fetcher` function prop
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
You must pass a fetcher function. This can be `window.fetch` itself or some wrapper function where you inject authorisation headers and anything else you many need.
|
|
116
114
|
|
|
117
|
-
You can take advantage of the `makeFetcher` utility function. This function takes
|
|
115
|
+
You can take advantage of the provided `makeFetcher` utility function. This function takes `baseUrl` and `additionalHeaders` arguments. The `baseUrl` will be prefixed to any relative request URLs. Absolute URLs will not be altered. The `additionalHeaders` parameter can be used to add any request headers you need in all requests.
|
|
118
116
|
|
|
119
117
|
```tsx
|
|
120
118
|
import { makeFetcher, DynamicFlow } from '@wise/dynamic-flow-client';
|
|
121
119
|
|
|
122
|
-
const myFetcher = makeFetcher('/my-base-url', { 'X-Access-Token': '
|
|
123
|
-
|
|
124
|
-
...
|
|
120
|
+
const myFetcher = makeFetcher('/my-base-url', { 'X-Access-Token': 'an-access-token' });
|
|
125
121
|
|
|
126
122
|
<DynamicFlow
|
|
127
|
-
initialAction={{ method: 'GET', url: '/
|
|
123
|
+
initialAction={{ method: 'GET', url: '/flow-starting-url' }}
|
|
128
124
|
fetcher={myFetcher}
|
|
129
|
-
|
|
130
|
-
onClose={...}
|
|
125
|
+
onComplete={...}
|
|
131
126
|
onError={...}
|
|
132
127
|
/>
|
|
133
128
|
```
|
|
134
129
|
|
|
135
|
-
|
|
130
|
+
#### Custom `fetcher` functions
|
|
136
131
|
|
|
137
|
-
|
|
132
|
+
If you want to write your own fetcher function (or if you're writing mocks), it's important that you return proper `Response` objects, and that you **do not throw**. Errors should result in a response with an error status code and potentially a body with an error message. For example:
|
|
138
133
|
|
|
139
|
-
|
|
134
|
+
```tsx
|
|
135
|
+
const mockFetcher = (input, init) => {
|
|
136
|
+
switch (input) {
|
|
137
|
+
case '/standard':
|
|
138
|
+
return Promise.resolve(new Response(init.body));
|
|
139
|
+
case '/exit':
|
|
140
|
+
return Promise.resolve(new Response(init.body, { headers: { 'x-df-exit': true } }));
|
|
141
|
+
case '/error':
|
|
142
|
+
default:
|
|
143
|
+
return Promise.resolve(new Response('An error has occurred.', { status: 500 }));
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Also, please make sure your mocks return a new `Response` instace every time. This is because responses are mutated when we parse their body, and they cannot be parsed a second time.
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
const initialResponse = new Response(JSON.stringify(initialStep));
|
|
152
|
+
// ❌ wrong - the same instance is returned on each request
|
|
153
|
+
const mockFetcher = (input, init) => Promise.resolve(initialResponse);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
// ✅ correct - a new instance is returned on each request
|
|
158
|
+
const mockFetcher = (input, init) => Promise.resolve(new Response(JSON.stringify(initialStep)));
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Telemetry
|
|
162
|
+
|
|
163
|
+
The `DynamicFlow` component accepts two optional props: `onEvent` and `onLog` which can be used to track and log.
|
|
140
164
|
|
|
141
165
|
In the example below we send tracking events to Mixpanel and logging events to Rollbar.
|
|
142
166
|
|
|
143
167
|
```tsx
|
|
144
168
|
<DynamicFlow
|
|
145
|
-
|
|
169
|
+
onEvent={(event, props) => mixpanel.track(event, props)}
|
|
146
170
|
onLog={(level, message, extra) => Rollbar[level](message, extra)}
|
|
147
171
|
/>
|
|
148
172
|
```
|
|
@@ -150,7 +174,7 @@ In the example below we send tracking events to Mixpanel and logging events to R
|
|
|
150
174
|
Alternatively, you can log to the browser console:
|
|
151
175
|
|
|
152
176
|
```ts
|
|
153
|
-
|
|
177
|
+
onEvent={(event, props) => console.log(event, props)}
|
|
154
178
|
onLog={(level, message, extra) => {
|
|
155
179
|
const levelToConsole = {
|
|
156
180
|
critical: console.error,
|
|
@@ -183,8 +207,6 @@ type LoaderConfig = {
|
|
|
183
207
|
| `initial` | boolean | Whether or not to display the Loader component while loading the initial step. | true |
|
|
184
208
|
| `submission` | boolean | Whether or not to display the Loader component during form submissions. | false |
|
|
185
209
|
|
|
186
|
-
|
|
187
210
|
## Contributing
|
|
188
211
|
|
|
189
212
|
We love contributions! Check out `CONTRIBUTING.md` for more information.
|
|
190
|
-
|
|
@@ -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,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
loading: boolean;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
export declare const DynamicFlowProvider: ({ loading, children }: Props) => JSX.Element;
|
|
7
|
+
export declare const useDynamicFlow: () => {
|
|
8
|
+
loading: boolean;
|
|
9
|
+
registerPersistAsyncPromise: (promise: Promise<unknown>) => void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
import { usePendingPromiseCounter } from './usePendingPromiseCounter';
|
|
15
|
+
var defaultContextValue = {
|
|
16
|
+
loading: false,
|
|
17
|
+
registerPersistAsyncPromise: function (promise) {
|
|
18
|
+
//
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var DFContext = createContext(defaultContextValue);
|
|
22
|
+
export var DynamicFlowProvider = function (_a) {
|
|
23
|
+
var loading = _a.loading, children = _a.children;
|
|
24
|
+
var _b = usePendingPromiseCounter(), pendingPromises = _b.pendingPromises, addPendingPromise = _b.addPendingPromise;
|
|
25
|
+
var providerValue = useMemo(function () {
|
|
26
|
+
return {
|
|
27
|
+
loading: loading || pendingPromises > 0,
|
|
28
|
+
registerPersistAsyncPromise: addPendingPromise
|
|
29
|
+
};
|
|
30
|
+
}, [loading, pendingPromises, addPendingPromise]);
|
|
31
|
+
return _jsx(DFContext.Provider, __assign({ value: providerValue }, { children: children }));
|
|
32
|
+
};
|
|
33
|
+
export var useDynamicFlow = function () {
|
|
34
|
+
var context = useContext(DFContext);
|
|
35
|
+
return context || defaultContextValue;
|
|
36
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useCallback, useState } from 'react';
|
|
2
|
+
export function usePendingPromiseCounter() {
|
|
3
|
+
var _a = useState(0), count = _a[0], setCount = _a[1];
|
|
4
|
+
var addPendingPromise = useCallback(function (promise) {
|
|
5
|
+
setCount(function (c) { return c + 1; });
|
|
6
|
+
promise["catch"](noop)["finally"](function () { return delayUntilNextCycle(function () { return setCount(function (c) { return Math.max(0, c - 1); }); }); });
|
|
7
|
+
}, [setCount]);
|
|
8
|
+
return { addPendingPromise: addPendingPromise, pendingPromises: count };
|
|
9
|
+
}
|
|
10
|
+
var delayUntilNextCycle = function (fn) { return setTimeout(function () { return fn(); }, 0); };
|
|
11
|
+
var noop = function () {
|
|
12
|
+
// no-op
|
|
13
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type EventName = '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 EventHandler = (eventName: EventName, 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
|
+
onEvent: EventHandler;
|
|
11
|
+
};
|
|
12
|
+
export declare const EventsContextProvider: ({ metadata, children, onEvent }: Props) => JSX.Element;
|
|
13
|
+
export declare function useEventDispatcher(): EventHandler;
|
|
14
|
+
export declare const getEventDispatcher: (onEvent: EventHandler, metadata?: Record<string, unknown>) => EventHandler;
|
|
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 EventsContext = createContext({
|
|
15
|
+
triggerEvent: function () {
|
|
16
|
+
// noop
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
export var EventsContextProvider = function (_a) {
|
|
20
|
+
var metadata = _a.metadata, children = _a.children, onEvent = _a.onEvent;
|
|
21
|
+
var value = useMemo(function () { return ({ triggerEvent: getEventDispatcher(onEvent, metadata) }); }, [onEvent, metadata]);
|
|
22
|
+
return _jsx(EventsContext.Provider, __assign({ value: value }, { children: children }));
|
|
23
|
+
};
|
|
24
|
+
export function useEventDispatcher() {
|
|
25
|
+
var triggerEvent = useContext(EventsContext).triggerEvent;
|
|
26
|
+
return triggerEvent;
|
|
27
|
+
}
|
|
28
|
+
export var getEventDispatcher = function (onEvent, metadata) {
|
|
29
|
+
return function (eventName, properties) {
|
|
30
|
+
if (properties === void 0) { properties = {}; }
|
|
31
|
+
return onEvent(eventName, __assign(__assign({}, metadata), properties));
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Fetcher = typeof fetch;
|
|
3
|
+
type FetcherProviderProps = {
|
|
4
|
+
fetcher: Fetcher;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const FetcherProvider: ({ fetcher, children }: FetcherProviderProps) => JSX.Element;
|
|
8
|
+
type FetcherProviderFromBaseUrlProps = {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export declare const FetcherProviderFromBaseUrl: ({ baseUrl, children, }: FetcherProviderFromBaseUrlProps) => JSX.Element;
|
|
13
|
+
/**
|
|
14
|
+
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
15
|
+
*/
|
|
16
|
+
export declare const useFetcher: () => typeof fetch;
|
|
17
|
+
export declare const useHasFetcherProvider: () => boolean;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
import { makeFetcher } from '../../makeFetcher';
|
|
15
|
+
var FetcherContext = createContext(undefined);
|
|
16
|
+
export var FetcherProvider = function (_a) {
|
|
17
|
+
var fetcher = _a.fetcher, children = _a.children;
|
|
18
|
+
return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
|
|
19
|
+
};
|
|
20
|
+
export var FetcherProviderFromBaseUrl = function (_a) {
|
|
21
|
+
var baseUrl = _a.baseUrl, children = _a.children;
|
|
22
|
+
var fetcher = useMemo(function () { return makeFetcher(baseUrl); }, [baseUrl]);
|
|
23
|
+
return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
27
|
+
*/
|
|
28
|
+
export var useFetcher = function () {
|
|
29
|
+
var contextFetch = useContext(FetcherContext);
|
|
30
|
+
return contextFetch || fetch;
|
|
31
|
+
};
|
|
32
|
+
export var useHasFetcherProvider = function () {
|
|
33
|
+
var context = useContext(FetcherContext);
|
|
34
|
+
return !!context;
|
|
35
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
|
|
3
|
+
export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation advanced warning' | 'Deprecated schema' | 'Error fetching';
|
|
4
|
+
type ExtraProps = Record<string, unknown>;
|
|
5
|
+
export type LogEventHandler = (level: LogLevel, message: string, extra: ExtraProps) => void;
|
|
6
|
+
type LogFunction = (title: LogTitle, description: string, extra?: ExtraProps) => void;
|
|
7
|
+
export declare const getLogger: (level: LogLevel, onLog: LogEventHandler, flowId?: string | undefined, stepId?: string | undefined) => LogFunction;
|
|
8
|
+
type LogProviderProps = {
|
|
9
|
+
flowId?: string;
|
|
10
|
+
stepId?: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
onLog: LogEventHandler;
|
|
13
|
+
};
|
|
14
|
+
export declare const LogProvider: ({ flowId, stepId, children, onLog }: LogProviderProps) => JSX.Element;
|
|
15
|
+
export declare const useLogger: () => {
|
|
16
|
+
debug: LogFunction;
|
|
17
|
+
info: LogFunction;
|
|
18
|
+
warning: LogFunction;
|
|
19
|
+
error: LogFunction;
|
|
20
|
+
critical: LogFunction;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export var getLogger = function (level, onLog, flowId, stepId) {
|
|
15
|
+
if (flowId === void 0) { flowId = 'UNKNOWN-FLOW-ID'; }
|
|
16
|
+
if (stepId === void 0) { stepId = 'UNKNOWN-FLOW-ID'; }
|
|
17
|
+
return function (title, description, extra) {
|
|
18
|
+
return onLog(level, "Dynamic Flow ".concat(level, " - ").concat(title, " - ").concat(description), __assign({ flowId: flowId, stepId: stepId }, extra));
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
var LogContext = createContext(null);
|
|
22
|
+
export var LogProvider = function (_a) {
|
|
23
|
+
var flowId = _a.flowId, stepId = _a.stepId, children = _a.children, onLog = _a.onLog;
|
|
24
|
+
var value = useMemo(function () { return ({
|
|
25
|
+
debug: getLogger('debug', onLog, flowId, stepId),
|
|
26
|
+
info: getLogger('info', onLog, flowId, stepId),
|
|
27
|
+
warning: getLogger('warning', onLog, flowId, stepId),
|
|
28
|
+
error: getLogger('error', onLog, flowId, stepId),
|
|
29
|
+
critical: getLogger('critical', onLog, flowId, stepId)
|
|
30
|
+
}); }, [onLog, flowId, stepId]);
|
|
31
|
+
return _jsx(LogContext.Provider, __assign({ value: value }, { children: children }));
|
|
32
|
+
};
|
|
33
|
+
export var useLogger = function () {
|
|
34
|
+
var logging = useContext(LogContext);
|
|
35
|
+
if (logging == null) {
|
|
36
|
+
throw new Error('Logging context not found. Did you forget to wrap your component in a <LogProvider />?');
|
|
37
|
+
}
|
|
38
|
+
return logging;
|
|
39
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './useDebouncedFunction/useDebouncedFunction';
|
|
2
|
+
export * from './useExternal/useExternal';
|
|
3
|
+
export * from './useExternalStepPolling/useExternalStepPolling';
|
|
4
|
+
export * from './usePersistAsync/usePersistAsync';
|
|
5
|
+
export * from './usePolling/usePolling';
|
|
6
|
+
export * from './usePrevious/usePrevious';
|
|
7
|
+
export * from './useStepPolling/useStepPolling';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './useDebouncedFunction/useDebouncedFunction';
|
|
2
|
+
export * from './useExternal/useExternal';
|
|
3
|
+
export * from './useExternalStepPolling/useExternalStepPolling';
|
|
4
|
+
export * from './usePersistAsync/usePersistAsync';
|
|
5
|
+
export * from './usePolling/usePolling';
|
|
6
|
+
export * from './usePrevious/usePrevious';
|
|
7
|
+
export * from './useStepPolling/useStepPolling';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* References:
|
|
2
|
+
- https://github.com/gnbaron/use-lodash-debounce
|
|
3
|
+
- https://dmitripavlutin.com/react-throttle-debounce/
|
|
4
|
+
*/
|
|
5
|
+
import { useCallback } from 'react';
|
|
6
|
+
import { debounce } from '../../utils';
|
|
7
|
+
export function useDebouncedFunction(callback, waitMs) {
|
|
8
|
+
return useCallback(debounce(callback, waitMs), [callback, waitMs]);
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export function useExternal(url) {
|
|
3
|
+
// If we fail to open the window, the user will need to open this on their own
|
|
4
|
+
var _a = useState(null), externalWindow = _a[0], setExternalWindow = _a[1];
|
|
5
|
+
var _b = useState(false), hasManuallyTriggered = _b[0], setHasManuallyTriggered = _b[1];
|
|
6
|
+
var dismissConfirmation = function () { return setHasManuallyTriggered(true); };
|
|
7
|
+
useEffect(function () {
|
|
8
|
+
if (url) {
|
|
9
|
+
setHasManuallyTriggered(false);
|
|
10
|
+
setExternalWindow(window.open(url, '_blank'));
|
|
11
|
+
}
|
|
12
|
+
}, [url]);
|
|
13
|
+
var requiresManualTrigger = Boolean(url && !externalWindow && !hasManuallyTriggered);
|
|
14
|
+
return { requiresManualTrigger: requiresManualTrigger, dismissConfirmation: dismissConfirmation };
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Action, PollingConfiguration } from '../../../types';
|
|
2
|
+
export type ExternalStepPollingConfiguration = PollingConfiguration & {
|
|
3
|
+
maxConsecutiveFails: number;
|
|
4
|
+
responseHandlers: ResponseHandler[];
|
|
5
|
+
};
|
|
6
|
+
type ResponseHandler = {
|
|
7
|
+
result: string;
|
|
8
|
+
action: Action;
|
|
9
|
+
};
|
|
10
|
+
/** @deprecated External step is no longer supported */
|
|
11
|
+
export declare function useExternalStepPolling(polling: ExternalStepPollingConfiguration | undefined, onAction: (action: Action) => void): void;
|
|
12
|
+
export {};
|