@wise/dynamic-flow-client 0.4.0-beta-75e4da.4 → 0.4.0-beta-ed6b0e.6
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/types/index.d.ts +10 -15
- package/build/types/{index.js → types/index.d.ts} +2 -0
- package/package.json +3 -4
- package/build/common/constants/DateMode.js +0 -4
- package/build/common/constants/FormControlType.js +0 -17
- package/build/common/constants/MonthFormat.js +0 -4
- package/build/common/constants/SchemaType.js +0 -11
- package/build/common/constants/Size.js +0 -7
- package/build/common/constants/index.js +0 -5
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +0 -36
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +0 -13
- package/build/common/contexts/eventsContext/EventsContext.js +0 -33
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +0 -35
- package/build/common/contexts/index.js +0 -4
- package/build/common/contexts/logContext/LogContext.js +0 -39
- package/build/common/hooks/index.js +0 -7
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +0 -9
- package/build/common/hooks/useExternal/useExternal.js +0 -15
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +0 -69
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +0 -170
- package/build/common/hooks/usePolling/usePolling.js +0 -48
- package/build/common/hooks/usePrevious/usePrevious.js +0 -8
- package/build/common/hooks/useStepPolling/useStepPolling.js +0 -44
- package/build/common/makeFetcher/index.js +0 -1
- package/build/common/makeFetcher/makeFetcher.js +0 -33
- package/build/common/messages.js +0 -8
- package/build/common/utils/api-utils.js +0 -13
- package/build/common/utils/date-utils.js +0 -22
- package/build/common/utils/debounce.js +0 -38
- package/build/common/utils/file-utils.js +0 -45
- package/build/common/utils/id-utils.js +0 -5
- package/build/common/utils/index.js +0 -8
- package/build/common/utils/is-equal.js +0 -21
- package/build/common/utils/schema-utils.js +0 -48
- package/build/common/utils/step-utils.js +0 -42
- package/build/common/validators/index.js +0 -5
- package/build/common/validators/models/model-validators.js +0 -63
- package/build/common/validators/models/models.utils.js +0 -118
- package/build/common/validators/schemas/schema-validators.js +0 -98
- package/build/common/validators/types/type-validators.js +0 -14
- package/build/common/validators/validationFailures/validation-failures.js +0 -140
- package/build/common/validators/validationFailures/validation-failures.utils.js +0 -40
- package/build/common/validators/values/value-validators.js +0 -6
- package/build/dynamicFlow/DynamicFlow.js +0 -370
- package/build/dynamicFlow/DynamicFlowStep.js +0 -32
- package/build/dynamicFlow/DynamicFlowTypes.js +0 -4
- package/build/dynamicFlow/index.js +0 -1
- package/build/dynamicFlow/stories/DynamicFlow.story.js +0 -30
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +0 -62
- package/build/dynamicFlow/stories/fixtureFetcher.js +0 -114
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +0 -45
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +0 -13
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +0 -12
- package/build/dynamicFlow/utils/index.js +0 -5
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +0 -125
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +0 -23
- package/build/dynamicFlow/utils/useDynamicFlowState.js +0 -110
- package/build/dynamicFlow/utils/useLoader.js +0 -22
- package/build/fixtures/components/alert.js +0 -31
- package/build/fixtures/components/box.js +0 -20
- package/build/fixtures/components/button.js +0 -65
- package/build/fixtures/components/columns.js +0 -36
- package/build/fixtures/components/copyable.js +0 -22
- package/build/fixtures/components/decision.js +0 -54
- package/build/fixtures/components/heading.js +0 -14
- package/build/fixtures/components/image.js +0 -23
- package/build/fixtures/components/index.js +0 -13
- package/build/fixtures/components/info.js +0 -17
- package/build/fixtures/components/list.js +0 -34
- package/build/fixtures/components/loading-indicator.js +0 -16
- package/build/fixtures/components/paragraph.js +0 -28
- package/build/fixtures/components/review.js +0 -60
- package/build/fixtures/examples/camera-capture.js +0 -121
- package/build/fixtures/examples/index.js +0 -5
- package/build/fixtures/examples/recipient-update.js +0 -250
- package/build/fixtures/examples/recipient.js +0 -313
- package/build/fixtures/examples/single-file-upload.js +0 -98
- package/build/fixtures/examples/step-validation-errors.js +0 -75
- package/build/fixtures/features/action-response.js +0 -29
- package/build/fixtures/features/external.js +0 -31
- package/build/fixtures/features/index.js +0 -5
- package/build/fixtures/features/persist-async.js +0 -44
- package/build/fixtures/features/polling.js +0 -33
- package/build/fixtures/features/validation-async.js +0 -38
- package/build/fixtures/index.js +0 -23
- package/build/fixtures/jsonSchemaForm/allOf.js +0 -119
- package/build/fixtures/jsonSchemaForm/audRecipient.js +0 -1104
- package/build/fixtures/jsonSchemaForm/currency.js +0 -48
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +0 -37
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +0 -36
- package/build/fixtures/jsonSchemaForm/oneOf.js +0 -119
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +0 -53
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +0 -56
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +0 -102
- package/build/fixtures/jsonSchemaForm/simple.js +0 -48
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +0 -71
- package/build/fixtures/jsonSchemaForm/validationAsync.js +0 -23
- package/build/fixtures/layouts/all.js +0 -176
- package/build/fixtures/layouts/final-step-layout.js +0 -39
- package/build/fixtures/layouts/index.js +0 -6
- package/build/fixtures/layouts/list.js +0 -33
- package/build/fixtures/layouts/pay-in.js +0 -97
- package/build/fixtures/layouts/review.js +0 -160
- package/build/fixtures/layouts/success.js +0 -66
- package/build/fixtures/responses/action-response-final.js +0 -24
- package/build/fixtures/responses/action.js +0 -2
- package/build/fixtures/responses/exit.js +0 -2
- package/build/fixtures/responses/index.js +0 -4
- package/build/fixtures/responses/recipient-update-final.js +0 -24
- package/build/fixtures/schemas/basic-form.js +0 -39
- package/build/fixtures/schemas/index.js +0 -4
- package/build/fixtures/schemas/number-and-integer.js +0 -41
- package/build/fixtures/schemas/one-of.js +0 -223
- package/build/fixtures/schemas/string-formats.js +0 -62
- package/build/fixtures/utils/image-util.js +0 -18
- package/build/formControl/FormControl.js +0 -241
- package/build/formControl/index.js +0 -1
- package/build/formControl/utils/index.js +0 -1
- package/build/formControl/utils/value-utils.js +0 -108
- package/build/i18n/index.js +0 -31
- package/build/index.d.ts +0 -10
- package/build/index.js +0 -8
- package/build/jsonSchemaForm/JsonSchemaForm.js +0 -29
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +0 -54
- package/build/jsonSchemaForm/allOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +0 -25
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +0 -26
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +0 -140
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +0 -18
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +0 -2
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +0 -84
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +0 -14
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +0 -1
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +0 -103
- package/build/jsonSchemaForm/basicTypeSchema/index.js +0 -1
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +0 -79
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +0 -53
- package/build/jsonSchemaForm/controlFeedback/index.js +0 -1
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +0 -122
- package/build/jsonSchemaForm/genericSchema/index.js +0 -1
- package/build/jsonSchemaForm/help/Help.js +0 -9
- package/build/jsonSchemaForm/help/Help.messages.js +0 -8
- package/build/jsonSchemaForm/help/index.js +0 -1
- package/build/jsonSchemaForm/index.js +0 -1
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +0 -78
- package/build/jsonSchemaForm/objectSchema/index.js +0 -1
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +0 -150
- package/build/jsonSchemaForm/oneOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +0 -8
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +0 -2
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +0 -64
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +0 -26
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +0 -8
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +0 -165
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +0 -126
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +0 -32
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +0 -1
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +0 -72
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +0 -8
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +0 -27
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +0 -31
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +0 -32
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +0 -55
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +0 -13
- package/build/jsonSchemaForm/readOnlySchema/index.js +0 -1
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +0 -104
- package/build/jsonSchemaForm/schemaFormControl/index.js +0 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +0 -73
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +0 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +0 -95
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +0 -146
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +0 -1
- package/build/layout/DynamicLayout.js +0 -61
- package/build/layout/alert/DynamicAlert.js +0 -29
- package/build/layout/box/DynamicBox.js +0 -41
- package/build/layout/button/DynamicButton.js +0 -58
- package/build/layout/columns/DynamicColumns.js +0 -38
- package/build/layout/decision/DynamicDecision.js +0 -38
- package/build/layout/divider/DynamicDivider.js +0 -9
- package/build/layout/external/DynamicExternal.js +0 -32
- package/build/layout/external/DynamicExternal.messages.js +0 -8
- package/build/layout/form/DynamicForm.js +0 -22
- package/build/layout/heading/DynamicHeading.js +0 -31
- package/build/layout/icon/DynamicIcon.js +0 -23
- package/build/layout/image/DynamicImage.js +0 -110
- package/build/layout/index.js +0 -17
- package/build/layout/info/DynamicInfo.js +0 -19
- package/build/layout/list/DynamicList.js +0 -31
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +0 -11
- package/build/layout/paragraph/DynamicParagraph.js +0 -43
- package/build/layout/paragraph/DynamicParagraph.messages.js +0 -13
- package/build/layout/paragraph/useSnackBarIfAvailable.js +0 -9
- package/build/layout/review/DynamicReview.js +0 -33
- package/build/layout/utils.js +0 -31
- package/build/step/cameraStep/CameraStep.js +0 -125
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +0 -122
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +0 -18
- package/build/step/cameraStep/cameraCapture/components/index.js +0 -28
- package/build/step/cameraStep/cameraCapture/hooks/index.js +0 -80
- package/build/step/cameraStep/cameraCapture/index.js +0 -1
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +0 -78
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +0 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +0 -13
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +0 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +0 -18
- package/build/step/cameraStep/cameraCapture/screens/index.js +0 -2
- package/build/step/cameraStep/cameraCapture/tracking/index.js +0 -98
- package/build/step/cameraStep/cameraCapture/utils/index.js +0 -103
- package/build/step/cameraStep/index.js +0 -1
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +0 -64
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +0 -23
- package/build/step/externalConfirmationStep/index.js +0 -1
- package/build/step/index.js +0 -3
- package/build/step/layoutStep/LayoutStep.js +0 -33
- package/build/step/layoutStep/index.js +0 -1
- package/build/step/layoutStep/utils/index.js +0 -2
- package/build/step/layoutStep/utils/inline-reference-utils.js +0 -91
- package/build/step/layoutStep/utils/layout-utils.js +0 -217
- package/build/types/common/FormControl.js +0 -1
- package/build/types/specification/Action.js +0 -1
- package/build/types/specification/FileUploadSchema.js +0 -4
- package/build/types/specification/LayoutComponent.js +0 -1
- package/build/types/specification/Model.js +0 -29
- package/build/types/specification/PersistAsync.js +0 -1
- package/build/types/specification/Polling.js +0 -1
- package/build/types/specification/Promotion.js +0 -1
- package/build/types/specification/Schema.js +0 -50
- package/build/types/specification/Step.js +0 -4
- package/build/types/specification/ValidationAsync.js +0 -1
- package/build/types/specification/core.js +0 -1
- /package/build/{common → types/common}/constants/DateMode.d.ts +0 -0
- /package/build/{common → types/common}/constants/FormControlType.d.ts +0 -0
- /package/build/{common → types/common}/constants/MonthFormat.d.ts +0 -0
- /package/build/{common → types/common}/constants/SchemaType.d.ts +0 -0
- /package/build/{common → types/common}/constants/Size.d.ts +0 -0
- /package/build/{common → types/common}/constants/index.d.ts +0 -0
- /package/build/{common → types/common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
- /package/build/{common → types/common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
- /package/build/{common → types/common}/contexts/eventsContext/EventsContext.d.ts +0 -0
- /package/build/{common → types/common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
- /package/build/{common → types/common}/contexts/index.d.ts +0 -0
- /package/build/{common → types/common}/contexts/logContext/LogContext.d.ts +0 -0
- /package/build/{common → types/common}/hooks/index.d.ts +0 -0
- /package/build/{common → types/common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
- /package/build/{common → types/common}/hooks/useExternal/useExternal.d.ts +0 -0
- /package/build/{common → types/common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
- /package/build/{common → types/common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
- /package/build/{common → types/common}/hooks/usePolling/usePolling.d.ts +0 -0
- /package/build/{common → types/common}/hooks/usePrevious/usePrevious.d.ts +0 -0
- /package/build/{common → types/common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
- /package/build/{common → types/common}/makeFetcher/index.d.ts +0 -0
- /package/build/{common → types/common}/makeFetcher/makeFetcher.d.ts +0 -0
- /package/build/{common → types/common}/messages.d.ts +0 -0
- /package/build/{common → types/common}/utils/api-utils.d.ts +0 -0
- /package/build/{common → types/common}/utils/date-utils.d.ts +0 -0
- /package/build/{common → types/common}/utils/debounce.d.ts +0 -0
- /package/build/{common → types/common}/utils/file-utils.d.ts +0 -0
- /package/build/{common → types/common}/utils/id-utils.d.ts +0 -0
- /package/build/{common → types/common}/utils/index.d.ts +0 -0
- /package/build/{common → types/common}/utils/is-equal.d.ts +0 -0
- /package/build/{common → types/common}/utils/schema-utils.d.ts +0 -0
- /package/build/{common → types/common}/utils/step-utils.d.ts +0 -0
- /package/build/{common → types/common}/validators/index.d.ts +0 -0
- /package/build/{common → types/common}/validators/models/model-validators.d.ts +0 -0
- /package/build/{common → types/common}/validators/models/models.utils.d.ts +0 -0
- /package/build/{common → types/common}/validators/schemas/schema-validators.d.ts +0 -0
- /package/build/{common → types/common}/validators/types/type-validators.d.ts +0 -0
- /package/build/{common → types/common}/validators/validationFailures/validation-failures.d.ts +0 -0
- /package/build/{common → types/common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
- /package/build/{common → types/common}/validators/values/value-validators.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlow.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowStep.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/index.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/index.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
- /package/build/{dynamicFlow → types/dynamicFlow}/utils/useLoader.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/alert.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/box.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/button.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/columns.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/copyable.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/decision.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/heading.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/image.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/info.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/list.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/loading-indicator.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/paragraph.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/components/review.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/camera-capture.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/recipient-update.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/recipient.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/single-file-upload.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/examples/step-validation-errors.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/action-response.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/external.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/persist-async.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/polling.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/features/validation-async.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/audRecipient.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/currency.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/multipleFileUploadBase64.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/multipleFileUploadBlob.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/oneOf.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/oneOfTabs.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/promotedOneOf.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/promotedOneOfCheckbox.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/simple.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/uploadPersistAsync.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/jsonSchemaForm/validationAsync.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/all.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/final-step-layout.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/list.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/pay-in.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/review.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/layouts/success.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/responses/action-response-final.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/responses/action.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/responses/exit.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/responses/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/responses/recipient-update-final.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/schemas/basic-form.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/schemas/index.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/schemas/number-and-integer.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/schemas/one-of.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/schemas/string-formats.d.ts +0 -0
- /package/build/{fixtures → types/fixtures}/utils/image-util.d.ts +0 -0
- /package/build/{formControl → types/formControl}/FormControl.d.ts +0 -0
- /package/build/{formControl → types/formControl}/index.d.ts +0 -0
- /package/build/{formControl → types/formControl}/utils/index.d.ts +0 -0
- /package/build/{formControl → types/formControl}/utils/value-utils.d.ts +0 -0
- /package/build/{i18n → types/i18n}/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.messages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
- /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
- /package/build/{layout → types/layout}/DynamicLayout.d.ts +0 -0
- /package/build/{layout → types/layout}/alert/DynamicAlert.d.ts +0 -0
- /package/build/{layout → types/layout}/box/DynamicBox.d.ts +0 -0
- /package/build/{layout → types/layout}/button/DynamicButton.d.ts +0 -0
- /package/build/{layout → types/layout}/columns/DynamicColumns.d.ts +0 -0
- /package/build/{layout → types/layout}/decision/DynamicDecision.d.ts +0 -0
- /package/build/{layout → types/layout}/divider/DynamicDivider.d.ts +0 -0
- /package/build/{layout → types/layout}/external/DynamicExternal.d.ts +0 -0
- /package/build/{layout → types/layout}/external/DynamicExternal.messages.d.ts +0 -0
- /package/build/{layout → types/layout}/form/DynamicForm.d.ts +0 -0
- /package/build/{layout → types/layout}/heading/DynamicHeading.d.ts +0 -0
- /package/build/{layout → types/layout}/icon/DynamicIcon.d.ts +0 -0
- /package/build/{layout → types/layout}/image/DynamicImage.d.ts +0 -0
- /package/build/{layout → types/layout}/index.d.ts +0 -0
- /package/build/{layout → types/layout}/info/DynamicInfo.d.ts +0 -0
- /package/build/{layout → types/layout}/list/DynamicList.d.ts +0 -0
- /package/build/{layout → types/layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
- /package/build/{layout → types/layout}/paragraph/DynamicParagraph.d.ts +0 -0
- /package/build/{layout → types/layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
- /package/build/{layout → types/layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
- /package/build/{layout → types/layout}/review/DynamicReview.d.ts +0 -0
- /package/build/{layout → types/layout}/utils.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/CameraStep.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
- /package/build/{step → types/step}/cameraStep/index.d.ts +0 -0
- /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
- /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
- /package/build/{step → types/step}/externalConfirmationStep/index.d.ts +0 -0
- /package/build/{step → types/step}/index.d.ts +0 -0
- /package/build/{step → types/step}/layoutStep/LayoutStep.d.ts +0 -0
- /package/build/{step → types/step}/layoutStep/index.d.ts +0 -0
- /package/build/{step → types/step}/layoutStep/utils/index.d.ts +0 -0
- /package/build/{step → types/step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
- /package/build/{step → types/step}/layoutStep/utils/layout-utils.d.ts +0 -0
- /package/build/types/{common → types/common}/FormControl.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Action.d.ts +0 -0
- /package/build/types/{specification → types/specification}/FileUploadSchema.d.ts +0 -0
- /package/build/types/{specification → types/specification}/LayoutComponent.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Model.d.ts +0 -0
- /package/build/types/{specification → types/specification}/PersistAsync.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Polling.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Promotion.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Schema.d.ts +0 -0
- /package/build/types/{specification → types/specification}/Step.d.ts +0 -0
- /package/build/types/{specification → types/specification}/ValidationAsync.d.ts +0 -0
- /package/build/types/{specification → types/specification}/core.d.ts +0 -0
package/build/types/index.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from './
|
|
9
|
-
export
|
|
10
|
-
export type {
|
|
11
|
-
export { isObjectSchema, isOneOfSchema, isAllOfSchema, isBlobSchema, isArraySchema, isTupleArraySchema, isListArraySchema, isValidationAsyncSchema, isPersistAsyncSchema, isBasicSchema, } from './specification/Schema';
|
|
12
|
-
export type { FileUploadSchema, CameraDirection } from './specification/FileUploadSchema';
|
|
13
|
-
export { isFileUploadSchema } from './specification/FileUploadSchema';
|
|
14
|
-
export { isBasicError } from './specification/Step';
|
|
15
|
-
export * from './common/FormControl';
|
|
1
|
+
export { convertStepToLayout, inlineReferences } from './step/layoutStep/utils';
|
|
2
|
+
export { default as DynamicFlow } from './dynamicFlow';
|
|
3
|
+
export { makeFetcher } from './common/makeFetcher';
|
|
4
|
+
export { default as JsonSchemaForm } from './jsonSchemaForm';
|
|
5
|
+
export { DynamicLayout as Layout } from './layout';
|
|
6
|
+
export { isValidSchema } from './common/validators';
|
|
7
|
+
export { default as translations } from './i18n';
|
|
8
|
+
export * from './dynamicFlow/DynamicFlow';
|
|
9
|
+
export type { DynamicFlowProps } from './dynamicFlow/DynamicFlowTypes';
|
|
10
|
+
export type { Step } from './types';
|
|
@@ -7,7 +7,9 @@ export * from './specification/Step';
|
|
|
7
7
|
export * from './specification/PersistAsync';
|
|
8
8
|
export * from './specification/ValidationAsync';
|
|
9
9
|
export * from './specification/Promotion';
|
|
10
|
+
export type { Schema, AllOfSchema, ArraySchema, BasicSchema, BlobSchema, BooleanSchema, ConstSchema, IntegerSchema, MultipleFileUploadSchema, NumberSchema, ObjectSchema, OneOfObjectSchema, OneOfSchema, PersistAsyncSchema, StringSchema, ListArraySchema, TupleArraySchema, ValidationAsyncSchema, } from './specification/Schema';
|
|
10
11
|
export { isObjectSchema, isOneOfSchema, isAllOfSchema, isBlobSchema, isArraySchema, isTupleArraySchema, isListArraySchema, isValidationAsyncSchema, isPersistAsyncSchema, isBasicSchema, } from './specification/Schema';
|
|
12
|
+
export type { FileUploadSchema, CameraDirection } from './specification/FileUploadSchema';
|
|
11
13
|
export { isFileUploadSchema } from './specification/FileUploadSchema';
|
|
12
14
|
export { isBasicError } from './specification/Step';
|
|
13
15
|
export * from './common/FormControl';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "0.4.0-beta-
|
|
3
|
+
"version": "0.4.0-beta-ed6b0e.6",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"main": "./build/main.min.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"dev": "storybook dev -p 3003",
|
|
21
21
|
"build": "npm-run-all build:*",
|
|
22
|
-
"build:
|
|
22
|
+
"build:types": "tsc --build ./tsconfig.build.json",
|
|
23
23
|
"build:js": "node ./scripts/build-min.mjs",
|
|
24
24
|
"build:css": "postcss src/main.css -o build/main.css",
|
|
25
25
|
"build:messages-source": "formatjs extract 'src/**/*.messages.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
|
|
@@ -29,10 +29,9 @@
|
|
|
29
29
|
"test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
|
|
30
30
|
"test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
|
|
31
31
|
"test:watch": "pnpm test:once --watch",
|
|
32
|
-
"lint": "npm-run-all lint
|
|
32
|
+
"lint": "npm-run-all lint:*",
|
|
33
33
|
"lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
|
|
34
34
|
"lint:css": "stylelint './src/**/*.css'",
|
|
35
|
-
"types": "tsc --noEmit",
|
|
36
35
|
"build-storybook": "storybook build -c .storybook"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
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';
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
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 { useCallback, useMemo } from 'react';
|
|
13
|
-
import { usePolling } from '..';
|
|
14
|
-
import { useFetcher } from '../../contexts';
|
|
15
|
-
/** @deprecated External step is no longer supported */
|
|
16
|
-
export function useExternalStepPolling(polling, onAction) {
|
|
17
|
-
var fetcher = useFetcher();
|
|
18
|
-
var asyncFn = useMemo(function () {
|
|
19
|
-
if (polling) {
|
|
20
|
-
return function () {
|
|
21
|
-
return fetcher(polling.url).then(function (response) {
|
|
22
|
-
if (response.ok) {
|
|
23
|
-
try {
|
|
24
|
-
return response.json();
|
|
25
|
-
}
|
|
26
|
-
catch (_a) {
|
|
27
|
-
throw new Error('failed');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
throw new Error('failed');
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
}, [polling, fetcher]);
|
|
40
|
-
var onPollingResponse = useCallback(function (pollingResponse) {
|
|
41
|
-
var responseHandlers = (polling === null || polling === void 0 ? void 0 : polling.responseHandlers) || [];
|
|
42
|
-
var responseHandler = responseHandlers.find(function (handler) { return handler.result === pollingResponse.result; });
|
|
43
|
-
if (responseHandler === null || responseHandler === void 0 ? void 0 : responseHandler.action) {
|
|
44
|
-
var action = responseHandler.action;
|
|
45
|
-
if (action.exit) {
|
|
46
|
-
var mergedResult = __assign(__assign({}, (action.result || {})), (pollingResponse.data || {}));
|
|
47
|
-
onAction(__assign(__assign({}, action), { result: mergedResult }));
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
var mergedData = __assign(__assign({}, (action.data || {})), (pollingResponse.data || {}));
|
|
51
|
-
onAction(__assign(__assign({}, action), { data: mergedData }));
|
|
52
|
-
}
|
|
53
|
-
return false; // stop polling
|
|
54
|
-
}
|
|
55
|
-
return true; // continue polling
|
|
56
|
-
}, [polling === null || polling === void 0 ? void 0 : polling.responseHandlers, onAction]);
|
|
57
|
-
usePolling({
|
|
58
|
-
asyncFn: asyncFn,
|
|
59
|
-
interval: (polling === null || polling === void 0 ? void 0 : polling.interval) || 0,
|
|
60
|
-
maxAttempts: (polling === null || polling === void 0 ? void 0 : polling.maxAttempts) || 0,
|
|
61
|
-
maxConsecutiveFails: (polling === null || polling === void 0 ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
62
|
-
onPollingResponse: onPollingResponse,
|
|
63
|
-
onFailure: useCallback(function () {
|
|
64
|
-
if (polling) {
|
|
65
|
-
onAction(polling.onError.action);
|
|
66
|
-
}
|
|
67
|
-
}, [onAction, polling])
|
|
68
|
-
});
|
|
69
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { useState } from 'react';
|
|
49
|
-
import { useIntl } from 'react-intl';
|
|
50
|
-
import { isNull, isObject, isNumber, isString } from '../../../common/validators';
|
|
51
|
-
import messages from '../../../jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages';
|
|
52
|
-
import { getErrorFromResponse } from '../../../jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema'; // FIXME: extract these functions form that schema component to either here or their own module
|
|
53
|
-
import { isBlobSchema } from '../../../types';
|
|
54
|
-
import { useFetcher } from '../../contexts';
|
|
55
|
-
import { isValidSchema } from '../../validators';
|
|
56
|
-
export var usePersistAsync = function (persistAsync) {
|
|
57
|
-
var _a = useState(null), abortController = _a[0], setAbortController = _a[1];
|
|
58
|
-
var fetcher = useFetcher();
|
|
59
|
-
var intl = useIntl();
|
|
60
|
-
var schema = persistAsync.schema;
|
|
61
|
-
function handlePersistAsync(model) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var isInvalidSchema;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
isInvalidSchema = model instanceof Blob ? !isBlobSchema(schema) : !isValidSchema(model, schema);
|
|
68
|
-
if (isNull(model) || isInvalidSchema) {
|
|
69
|
-
handleError();
|
|
70
|
-
}
|
|
71
|
-
return [4 /*yield*/, performPersistAsync(model)];
|
|
72
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
var abortCurrentRequestAndGetNewAbortSignal = function () {
|
|
78
|
-
if (abortController) {
|
|
79
|
-
abortController.abort();
|
|
80
|
-
}
|
|
81
|
-
var newAbortController = new AbortController();
|
|
82
|
-
setAbortController(newAbortController);
|
|
83
|
-
return newAbortController.signal;
|
|
84
|
-
};
|
|
85
|
-
function constructFetchInit(model) {
|
|
86
|
-
var _a;
|
|
87
|
-
var isBlob = isBlobSchema(schema);
|
|
88
|
-
var signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
89
|
-
var requestKey = persistAsync.param;
|
|
90
|
-
var requestBody = isBlob
|
|
91
|
-
? wrapInFormData(requestKey, model)
|
|
92
|
-
: JSON.stringify((_a = {}, _a[requestKey] = model, _a));
|
|
93
|
-
return {
|
|
94
|
-
method: persistAsync.method,
|
|
95
|
-
headers: __assign({}, (!isBlob && { 'Content-Type': 'application/json' })),
|
|
96
|
-
body: requestBody,
|
|
97
|
-
signal: signal
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function performPersistAsync(payload) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var response, jsonResponse, id, error_1;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
_a.trys.push([0, 3, , 4]);
|
|
107
|
-
return [4 /*yield*/, fetcher(persistAsync.url, constructFetchInit(payload))];
|
|
108
|
-
case 1:
|
|
109
|
-
response = _a.sent();
|
|
110
|
-
if (!response.ok) {
|
|
111
|
-
return [2 /*return*/, handleHTTPError(response)];
|
|
112
|
-
}
|
|
113
|
-
return [4 /*yield*/, response.json()];
|
|
114
|
-
case 2:
|
|
115
|
-
jsonResponse = _a.sent();
|
|
116
|
-
if (isObject(jsonResponse)) {
|
|
117
|
-
id = jsonResponse[persistAsync.idProperty];
|
|
118
|
-
if (isString(id) || isNumber(id)) {
|
|
119
|
-
return [2 /*return*/, { data: id }];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return [2 /*return*/, handleError()];
|
|
123
|
-
case 3:
|
|
124
|
-
error_1 = _a.sent();
|
|
125
|
-
return [2 /*return*/, handleError(error_1)];
|
|
126
|
-
case 4: return [2 /*return*/];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function handleHTTPError(response) {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
-
var jsonResponse, error;
|
|
134
|
-
return __generator(this, function (_a) {
|
|
135
|
-
switch (_a.label) {
|
|
136
|
-
case 0:
|
|
137
|
-
if (!(response.status === 422)) return [3 /*break*/, 2];
|
|
138
|
-
return [4 /*yield*/, response.json()];
|
|
139
|
-
case 1:
|
|
140
|
-
jsonResponse = _a.sent();
|
|
141
|
-
if (isObject(jsonResponse)) {
|
|
142
|
-
error = getErrorFromResponse(persistAsync.param, jsonResponse);
|
|
143
|
-
if (isString(error)) {
|
|
144
|
-
throw new Error(error);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
_a.label = 2;
|
|
148
|
-
case 2: throw new Error(intl.formatMessage(messages.genericError));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
var handleError = function (error) {
|
|
154
|
-
var message = hasStringMessage(error)
|
|
155
|
-
? error.message
|
|
156
|
-
: intl.formatMessage(messages.genericError);
|
|
157
|
-
throw new Error(message);
|
|
158
|
-
};
|
|
159
|
-
return handlePersistAsync;
|
|
160
|
-
};
|
|
161
|
-
function wrapInFormData(key, value) {
|
|
162
|
-
var formData = new FormData();
|
|
163
|
-
if (value !== null) {
|
|
164
|
-
formData.append(key, value);
|
|
165
|
-
}
|
|
166
|
-
return formData;
|
|
167
|
-
}
|
|
168
|
-
function hasStringMessage(value) {
|
|
169
|
-
return isObject(value) && 'message' in value && typeof value.message === 'string';
|
|
170
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/* eslint-disable fp/no-mutation */
|
|
2
|
-
import { useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
export function usePolling(_a) {
|
|
4
|
-
var asyncFn = _a.asyncFn, interval = _a.interval, maxAttempts = _a.maxAttempts, maxConsecutiveFails = _a.maxConsecutiveFails, onPollingResponse = _a.onPollingResponse, onFailure = _a.onFailure;
|
|
5
|
-
var onPollingResponseReference = useRef(onPollingResponse);
|
|
6
|
-
var onFailureReference = useRef(onFailure);
|
|
7
|
-
var poll = useMemo(function () {
|
|
8
|
-
return createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, function (pollingResponse) { return onPollingResponseReference.current(pollingResponse); }, function () { return onFailureReference.current(); });
|
|
9
|
-
}, [asyncFn, maxAttempts, maxConsecutiveFails]);
|
|
10
|
-
useEffect(function () {
|
|
11
|
-
if (interval > 0) {
|
|
12
|
-
var intervalReference_1 = setInterval(function () {
|
|
13
|
-
poll();
|
|
14
|
-
}, interval);
|
|
15
|
-
return function () { return clearInterval(intervalReference_1); };
|
|
16
|
-
}
|
|
17
|
-
}, [poll, interval]);
|
|
18
|
-
useEffect(function () {
|
|
19
|
-
onPollingResponseReference.current = onPollingResponse;
|
|
20
|
-
onFailureReference.current = onFailure;
|
|
21
|
-
}, [onPollingResponse, onFailure]);
|
|
22
|
-
}
|
|
23
|
-
export function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPollingResponse, onFailure) {
|
|
24
|
-
var isPolling = true;
|
|
25
|
-
var consecutiveFailures = 0;
|
|
26
|
-
var attemptCount = 0;
|
|
27
|
-
return asyncFn
|
|
28
|
-
? function () {
|
|
29
|
-
if (isPolling) {
|
|
30
|
-
attemptCount++;
|
|
31
|
-
asyncFn()
|
|
32
|
-
.then(function (pollingResponse) {
|
|
33
|
-
consecutiveFailures = 0;
|
|
34
|
-
isPolling = onPollingResponse(pollingResponse);
|
|
35
|
-
})["catch"](function () {
|
|
36
|
-
consecutiveFailures++;
|
|
37
|
-
})["finally"](function () {
|
|
38
|
-
if (consecutiveFailures >= maxConsecutiveFails || attemptCount >= maxAttempts) {
|
|
39
|
-
onFailure();
|
|
40
|
-
isPolling = false;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
: function () {
|
|
46
|
-
//
|
|
47
|
-
};
|
|
48
|
-
}
|