@wise/dynamic-flow-client 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/constants/DateMode.js +3 -2
- package/build/common/constants/DateMode.js.map +1 -0
- package/build/common/constants/FormControlType.js +3 -2
- package/build/common/constants/FormControlType.js.map +1 -0
- package/build/common/constants/MonthFormat.js +3 -2
- package/build/common/constants/MonthFormat.js.map +1 -0
- package/build/common/constants/SchemaType.js +3 -2
- package/build/common/constants/SchemaType.js.map +1 -0
- package/build/common/constants/Size.js +3 -2
- package/build/common/constants/Size.js.map +1 -0
- package/build/common/constants/index.js +2 -1
- package/build/common/constants/index.js.map +1 -0
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +16 -27
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js.map +1 -0
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +12 -9
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js.map +1 -0
- package/build/common/contexts/eventsContext/EventsContext.js +12 -28
- package/build/common/contexts/eventsContext/EventsContext.js.map +1 -0
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +15 -27
- package/build/common/contexts/fetcherContexts/FetcherContexts.js.map +1 -0
- package/build/common/contexts/index.js +2 -1
- package/build/common/contexts/index.js.map +1 -0
- package/build/common/contexts/logContext/LogContext.js +13 -30
- package/build/common/contexts/logContext/LogContext.js.map +1 -0
- package/build/common/hooks/index.js +2 -1
- package/build/common/hooks/index.js.map +1 -0
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +4 -3
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js.map +1 -0
- package/build/common/hooks/useExternal/useExternal.js +9 -8
- package/build/common/hooks/useExternal/useExternal.js.map +1 -0
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +21 -31
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js.map +1 -0
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +61 -139
- package/build/common/hooks/usePersistAsync/usePersistAsync.js.map +1 -0
- package/build/common/hooks/usePolling/usePolling.js +21 -21
- package/build/common/hooks/usePolling/usePolling.js.map +1 -0
- package/build/common/hooks/usePrevious/usePrevious.js +6 -5
- package/build/common/hooks/usePrevious/usePrevious.js.map +1 -0
- package/build/common/hooks/useStepPolling/useStepPolling.js +16 -14
- package/build/common/hooks/useStepPolling/useStepPolling.js.map +1 -0
- package/build/common/makeFetcher/index.js +2 -1
- package/build/common/makeFetcher/index.js.map +1 -0
- package/build/common/makeFetcher/makeFetcher.js +11 -24
- package/build/common/makeFetcher/makeFetcher.js.map +1 -0
- package/build/common/messages.js +6 -5
- package/build/common/messages.js.map +1 -0
- package/build/common/utils/api-utils.js +4 -4
- package/build/common/utils/api-utils.js.map +1 -0
- package/build/common/utils/date-utils.js +12 -11
- package/build/common/utils/date-utils.js.map +1 -0
- package/build/common/utils/debounce.js +12 -15
- package/build/common/utils/debounce.js.map +1 -0
- package/build/common/utils/file-utils.js +13 -25
- package/build/common/utils/file-utils.js.map +1 -0
- package/build/common/utils/id-utils.js +5 -5
- package/build/common/utils/id-utils.js.map +1 -0
- package/build/common/utils/index.js +2 -1
- package/build/common/utils/index.js.map +1 -0
- package/build/common/utils/is-equal.js +9 -8
- package/build/common/utils/is-equal.js.map +1 -0
- package/build/common/utils/schema-utils.js +7 -6
- package/build/common/utils/schema-utils.js.map +1 -0
- package/build/common/utils/step-utils.js +15 -14
- package/build/common/utils/step-utils.js.map +1 -0
- package/build/common/validators/index.js +8 -7
- package/build/common/validators/index.js.map +1 -0
- package/build/common/validators/models/model-validators.js +9 -8
- package/build/common/validators/models/model-validators.js.map +1 -0
- package/build/common/validators/models/models.utils.js +30 -42
- package/build/common/validators/models/models.utils.js.map +1 -0
- package/build/common/validators/schemas/schema-validators.js +12 -13
- package/build/common/validators/schemas/schema-validators.js.map +1 -0
- package/build/common/validators/types/type-validators.js +10 -13
- package/build/common/validators/types/type-validators.js.map +1 -0
- package/build/common/validators/validationFailures/validation-failures.js +15 -14
- package/build/common/validators/validationFailures/validation-failures.js.map +1 -0
- package/build/common/validators/validationFailures/validation-failures.utils.js +6 -7
- package/build/common/validators/validationFailures/validation-failures.utils.js.map +1 -0
- package/build/common/validators/values/value-validators.js +5 -6
- package/build/common/validators/values/value-validators.js.map +1 -0
- package/build/dynamicFlow/DynamicFlow.js +186 -307
- package/build/dynamicFlow/DynamicFlow.js.map +1 -0
- package/build/dynamicFlow/DynamicFlowStep.js +13 -23
- package/build/dynamicFlow/DynamicFlowStep.js.map +1 -0
- package/build/dynamicFlow/DynamicFlowTypes.js +2 -1
- package/build/dynamicFlow/DynamicFlowTypes.js.map +1 -0
- package/build/dynamicFlow/index.js +7 -14
- package/build/dynamicFlow/index.js.map +1 -0
- package/build/dynamicFlow/stories/DynamicFlow.story.js +21 -20
- package/build/dynamicFlow/stories/DynamicFlow.story.js.map +1 -0
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +21 -33
- package/build/dynamicFlow/stories/EditableDynamicFlow.js.map +1 -0
- package/build/dynamicFlow/stories/fixtureFetcher.js +47 -104
- package/build/dynamicFlow/stories/fixtureFetcher.js.map +1 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +23 -40
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js.map +1 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +7 -6
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js.map +1 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +11 -11
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js.map +1 -0
- package/build/dynamicFlow/utils/index.js +6 -2
- package/build/dynamicFlow/utils/index.js.map +1 -0
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +54 -118
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js.map +1 -0
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +10 -9
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js.map +1 -0
- package/build/dynamicFlow/utils/useDynamicFlowState.js +52 -74
- package/build/dynamicFlow/utils/useDynamicFlowState.js.map +1 -0
- package/build/dynamicFlow/utils/useLoader.js +10 -20
- package/build/dynamicFlow/utils/useLoader.js.map +1 -0
- package/build/fixtures/components/alert.js +9 -8
- package/build/fixtures/components/alert.js.map +1 -0
- package/build/fixtures/components/box.js +8 -7
- package/build/fixtures/components/box.js.map +1 -0
- package/build/fixtures/components/button.js +26 -36
- package/build/fixtures/components/button.js.map +1 -0
- package/build/fixtures/components/columns.js +11 -10
- package/build/fixtures/components/columns.js.map +1 -0
- package/build/fixtures/components/copyable.js +7 -6
- package/build/fixtures/components/copyable.js.map +1 -0
- package/build/fixtures/components/decision.js +16 -15
- package/build/fixtures/components/decision.js.map +1 -0
- package/build/fixtures/components/heading.js +8 -7
- package/build/fixtures/components/heading.js.map +1 -0
- package/build/fixtures/components/image.js +11 -10
- package/build/fixtures/components/image.js.map +1 -0
- package/build/fixtures/components/index.js +18 -25
- package/build/fixtures/components/index.js.map +1 -0
- package/build/fixtures/components/info.js +23 -6
- package/build/fixtures/components/info.js.map +1 -0
- package/build/fixtures/components/list.js +9 -8
- package/build/fixtures/components/list.js.map +1 -0
- package/build/fixtures/components/loading-indicator.js +6 -5
- package/build/fixtures/components/loading-indicator.js.map +1 -0
- package/build/fixtures/components/paragraph.js +10 -9
- package/build/fixtures/components/paragraph.js.map +1 -0
- package/build/fixtures/components/review.js +12 -11
- package/build/fixtures/components/review.js.map +1 -0
- package/build/fixtures/examples/camera-capture.js +30 -29
- package/build/fixtures/examples/camera-capture.js.map +1 -0
- package/build/fixtures/examples/index.js +10 -17
- package/build/fixtures/examples/index.js.map +1 -0
- package/build/fixtures/examples/recipient-update.js +70 -69
- package/build/fixtures/examples/recipient-update.js.map +1 -0
- package/build/fixtures/examples/recipient.js +64 -63
- package/build/fixtures/examples/recipient.js.map +1 -0
- package/build/fixtures/examples/single-file-upload.js +22 -21
- package/build/fixtures/examples/single-file-upload.js.map +1 -0
- package/build/fixtures/examples/step-validation-errors.js +22 -21
- package/build/fixtures/examples/step-validation-errors.js.map +1 -0
- package/build/fixtures/features/action-response.js +9 -8
- package/build/fixtures/features/action-response.js.map +1 -0
- package/build/fixtures/features/external.js +9 -8
- package/build/fixtures/features/external.js.map +1 -0
- package/build/fixtures/features/index.js +10 -17
- package/build/fixtures/features/index.js.map +1 -0
- package/build/fixtures/features/persist-async.js +12 -11
- package/build/fixtures/features/persist-async.js.map +1 -0
- package/build/fixtures/features/polling.js +10 -9
- package/build/fixtures/features/polling.js.map +1 -0
- package/build/fixtures/features/validation-async.js +11 -10
- package/build/fixtures/features/validation-async.js.map +1 -0
- package/build/fixtures/index.js +12 -22
- package/build/fixtures/index.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/allOf.js +31 -30
- package/build/fixtures/jsonSchemaForm/allOf.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.js +272 -271
- package/build/fixtures/jsonSchemaForm/audRecipient.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/currency.js +13 -12
- package/build/fixtures/jsonSchemaForm/currency.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +12 -11
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +12 -11
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/oneOf.js +28 -27
- package/build/fixtures/jsonSchemaForm/oneOf.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +17 -16
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +18 -17
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +31 -30
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/simple.js +17 -16
- package/build/fixtures/jsonSchemaForm/simple.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +20 -19
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js.map +1 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.js +9 -8
- package/build/fixtures/jsonSchemaForm/validationAsync.js.map +1 -0
- package/build/fixtures/layouts/all.js +38 -37
- package/build/fixtures/layouts/all.js.map +1 -0
- package/build/fixtures/layouts/final-step-layout.js +10 -9
- package/build/fixtures/layouts/final-step-layout.js.map +1 -0
- package/build/fixtures/layouts/index.js +11 -18
- package/build/fixtures/layouts/index.js.map +1 -0
- package/build/fixtures/layouts/list.js +11 -10
- package/build/fixtures/layouts/list.js.map +1 -0
- package/build/fixtures/layouts/pay-in.js +24 -23
- package/build/fixtures/layouts/pay-in.js.map +1 -0
- package/build/fixtures/layouts/review.js +39 -38
- package/build/fixtures/layouts/review.js.map +1 -0
- package/build/fixtures/layouts/success.js +16 -15
- package/build/fixtures/layouts/success.js.map +1 -0
- package/build/fixtures/responses/action-response-final.js +9 -8
- package/build/fixtures/responses/action-response-final.js.map +1 -0
- package/build/fixtures/responses/action.js +4 -3
- package/build/fixtures/responses/action.js.map +1 -0
- package/build/fixtures/responses/exit.js +4 -3
- package/build/fixtures/responses/exit.js.map +1 -0
- package/build/fixtures/responses/index.js +9 -16
- package/build/fixtures/responses/index.js.map +1 -0
- package/build/fixtures/responses/recipient-update-final.js +9 -8
- package/build/fixtures/responses/recipient-update-final.js.map +1 -0
- package/build/fixtures/schemas/basic-form.js +12 -11
- package/build/fixtures/schemas/basic-form.js.map +1 -0
- package/build/fixtures/schemas/index.js +9 -16
- package/build/fixtures/schemas/index.js.map +1 -0
- package/build/fixtures/schemas/number-and-integer.js +12 -11
- package/build/fixtures/schemas/number-and-integer.js.map +1 -0
- package/build/fixtures/schemas/one-of.js +44 -46
- package/build/fixtures/schemas/one-of.js.map +1 -0
- package/build/fixtures/schemas/string-formats.js +16 -15
- package/build/fixtures/schemas/string-formats.js.map +1 -0
- package/build/fixtures/utils/image-util.js +9 -8
- package/build/fixtures/utils/image-util.js.map +1 -0
- package/build/formControl/FormControl.js +119 -148
- package/build/formControl/FormControl.js.map +1 -0
- package/build/formControl/index.js +7 -14
- package/build/formControl/index.js.map +1 -0
- package/build/formControl/utils/index.js +2 -1
- package/build/formControl/utils/index.js.map +1 -0
- package/build/formControl/utils/value-utils.js +19 -23
- package/build/formControl/utils/value-utils.js.map +1 -0
- package/build/i18n/index.js +32 -31
- package/build/i18n/index.js.map +1 -0
- package/build/index.js +14 -10
- package/build/index.js.map +1 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +13 -24
- package/build/jsonSchemaForm/JsonSchemaForm.js.map +1 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +25 -37
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js.map +1 -0
- package/build/jsonSchemaForm/allOfSchema/index.js +7 -14
- package/build/jsonSchemaForm/allOfSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +10 -20
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +10 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +7 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +57 -115
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +8 -7
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +7 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +20 -71
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +11 -11
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js.map +1 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +7 -14
- package/build/jsonSchemaForm/arrayTypeSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +46 -62
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js.map +1 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.js +7 -14
- package/build/jsonSchemaForm/basicTypeSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +40 -50
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js.map +1 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +19 -18
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js.map +1 -0
- package/build/jsonSchemaForm/controlFeedback/index.js +7 -14
- package/build/jsonSchemaForm/controlFeedback/index.js.map +1 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +53 -61
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js.map +1 -0
- package/build/jsonSchemaForm/genericSchema/index.js +7 -14
- package/build/jsonSchemaForm/genericSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/help/Help.js +10 -9
- package/build/jsonSchemaForm/help/Help.js.map +1 -0
- package/build/jsonSchemaForm/help/Help.messages.js +6 -5
- package/build/jsonSchemaForm/help/Help.messages.js.map +1 -0
- package/build/jsonSchemaForm/help/index.js +7 -14
- package/build/jsonSchemaForm/help/index.js.map +1 -0
- package/build/jsonSchemaForm/index.js +7 -14
- package/build/jsonSchemaForm/index.js.map +1 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +29 -49
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js.map +1 -0
- package/build/jsonSchemaForm/objectSchema/index.js +7 -14
- package/build/jsonSchemaForm/objectSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +55 -74
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js.map +1 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +7 -14
- package/build/jsonSchemaForm/oneOfSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +4 -3
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js.map +1 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +2 -1
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js.map +1 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +20 -20
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +12 -22
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +6 -5
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +7 -14
- package/build/jsonSchemaForm/persistAsyncSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +74 -127
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +7 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +46 -110
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +18 -17
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js.map +1 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +7 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +29 -47
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +7 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +5 -4
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +14 -24
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +12 -22
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js.map +1 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +13 -23
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js.map +1 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +25 -26
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js.map +1 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +7 -6
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js.map +1 -0
- package/build/jsonSchemaForm/readOnlySchema/index.js +7 -14
- package/build/jsonSchemaForm/readOnlySchema/index.js.map +1 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +27 -39
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js.map +1 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +7 -14
- package/build/jsonSchemaForm/schemaFormControl/index.js.map +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +6 -5
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js.map +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +2 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js.map +1 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +31 -47
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js.map +1 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +58 -119
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js.map +1 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +7 -14
- package/build/jsonSchemaForm/validationAsyncSchema/index.js.map +1 -0
- package/build/layout/DynamicLayout.js +11 -21
- package/build/layout/DynamicLayout.js.map +1 -0
- package/build/layout/alert/DynamicAlert.js +10 -9
- package/build/layout/alert/DynamicAlert.js.map +1 -0
- package/build/layout/box/DynamicBox.js +13 -23
- package/build/layout/box/DynamicBox.js.map +1 -0
- package/build/layout/button/DynamicButton.js +17 -27
- package/build/layout/button/DynamicButton.js.map +1 -0
- package/build/layout/columns/DynamicColumns.js +14 -24
- package/build/layout/columns/DynamicColumns.js.map +1 -0
- package/build/layout/decision/DynamicDecision.js +17 -27
- package/build/layout/decision/DynamicDecision.js.map +1 -0
- package/build/layout/divider/DynamicDivider.js +8 -8
- package/build/layout/divider/DynamicDivider.js.map +1 -0
- package/build/layout/external/DynamicExternal.js +17 -28
- package/build/layout/external/DynamicExternal.js.map +1 -0
- package/build/layout/external/DynamicExternal.messages.js +6 -5
- package/build/layout/external/DynamicExternal.messages.js.map +1 -0
- package/build/layout/form/DynamicForm.js +11 -21
- package/build/layout/form/DynamicForm.js.map +1 -0
- package/build/layout/heading/DynamicHeading.js +13 -23
- package/build/layout/heading/DynamicHeading.js.map +1 -0
- package/build/layout/icon/DynamicIcon.js +10 -10
- package/build/layout/icon/DynamicIcon.js.map +1 -0
- package/build/layout/image/DynamicImage.js +44 -93
- package/build/layout/image/DynamicImage.js.map +1 -0
- package/build/layout/index.js +22 -29
- package/build/layout/index.js.map +1 -0
- package/build/layout/info/DynamicInfo.js +8 -19
- package/build/layout/info/DynamicInfo.js.map +1 -0
- package/build/layout/list/DynamicList.js +15 -26
- package/build/layout/list/DynamicList.js.map +1 -0
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +9 -9
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js.map +1 -0
- package/build/layout/paragraph/DynamicParagraph.js +20 -37
- package/build/layout/paragraph/DynamicParagraph.js.map +1 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +7 -6
- package/build/layout/paragraph/DynamicParagraph.messages.js.map +1 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +5 -4
- package/build/layout/paragraph/useSnackBarIfAvailable.js.map +1 -0
- package/build/layout/review/DynamicReview.js +15 -26
- package/build/layout/review/DynamicReview.js.map +1 -0
- package/build/layout/utils.js +5 -6
- package/build/layout/utils.js.map +1 -0
- package/build/step/cameraStep/CameraStep.js +43 -88
- package/build/step/cameraStep/CameraStep.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +49 -105
- package/build/step/cameraStep/cameraCapture/CameraCapture.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +8 -7
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/components/index.js +11 -28
- package/build/step/cameraStep/cameraCapture/components/index.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.js +18 -72
- package/build/step/cameraStep/cameraCapture/hooks/index.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/index.js +7 -14
- package/build/step/cameraStep/cameraCapture/index.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +34 -45
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +9 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +7 -6
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +10 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +8 -7
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/screens/index.js +7 -14
- package/build/step/cameraStep/cameraCapture/screens/index.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.js +18 -99
- package/build/step/cameraStep/cameraCapture/tracking/index.js.map +1 -0
- package/build/step/cameraStep/cameraCapture/utils/index.js +34 -96
- package/build/step/cameraStep/cameraCapture/utils/index.js.map +1 -0
- package/build/step/cameraStep/index.js +7 -14
- package/build/step/cameraStep/index.js.map +1 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +21 -21
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js.map +1 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +9 -8
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js.map +1 -0
- package/build/step/externalConfirmationStep/index.js +7 -14
- package/build/step/externalConfirmationStep/index.js.map +1 -0
- package/build/step/index.js +8 -15
- package/build/step/index.js.map +1 -0
- package/build/step/layoutStep/LayoutStep.js +20 -19
- package/build/step/layoutStep/LayoutStep.js.map +1 -0
- package/build/step/layoutStep/index.js +7 -14
- package/build/step/layoutStep/index.js.map +1 -0
- package/build/step/layoutStep/utils/index.js +4 -14
- package/build/step/layoutStep/utils/index.js.map +1 -0
- package/build/step/layoutStep/utils/inline-reference-utils.js +30 -46
- package/build/step/layoutStep/utils/inline-reference-utils.js.map +1 -0
- package/build/step/layoutStep/utils/layout-utils.js +35 -53
- package/build/step/layoutStep/utils/layout-utils.js.map +1 -0
- package/build/types/common/FormControl.js +2 -1
- package/build/types/common/FormControl.js.map +1 -0
- package/build/types/index.js +14 -13
- package/build/types/index.js.map +1 -0
- package/build/types/specification/Action.js +2 -1
- package/build/types/specification/Action.js.map +1 -0
- package/build/types/specification/FileUploadSchema.js +2 -1
- package/build/types/specification/FileUploadSchema.js.map +1 -0
- package/build/types/specification/LayoutComponent.js +2 -1
- package/build/types/specification/LayoutComponent.js.map +1 -0
- package/build/types/specification/Model.js +10 -17
- package/build/types/specification/Model.js.map +1 -0
- package/build/types/specification/PersistAsync.js +2 -1
- package/build/types/specification/PersistAsync.js.map +1 -0
- package/build/types/specification/Polling.js +2 -1
- package/build/types/specification/Polling.js.map +1 -0
- package/build/types/specification/Promotion.js +2 -1
- package/build/types/specification/Promotion.js.map +1 -0
- package/build/types/specification/Schema.js +9 -8
- package/build/types/specification/Schema.js.map +1 -0
- package/build/types/specification/Step.js +4 -5
- package/build/types/specification/Step.js.map +1 -0
- package/build/types/specification/ValidationAsync.js +2 -1
- package/build/types/specification/ValidationAsync.js.map +1 -0
- package/build/types/specification/core.js +2 -1
- package/build/types/specification/core.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,172 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
4
|
};
|
|
52
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
6
|
exports.usePersistAsync = void 0;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
function handlePersistAsync(model) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
isInvalidSchema = model instanceof Blob ? !(0, types_1.isBlobSchema)(schema) : !(0, validators_2.isValidSchema)(model, schema);
|
|
74
|
-
if ((0, validators_1.isNull)(model) || isInvalidSchema) {
|
|
75
|
-
handleError();
|
|
76
|
-
}
|
|
77
|
-
return [4 /*yield*/, performPersistAsync(model)];
|
|
78
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
});
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const validators_1 = require("../../../common/validators");
|
|
10
|
+
const PersistAsyncSchema_messages_1 = __importDefault(require("../../../jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages"));
|
|
11
|
+
const PersistAsyncBasicSchema_1 = require("../../../jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema"); // FIXME: extract these functions form that schema component to either here or their own module
|
|
12
|
+
const types_1 = require("../../../types");
|
|
13
|
+
const contexts_1 = require("../../contexts");
|
|
14
|
+
const validators_2 = require("../../validators");
|
|
15
|
+
const usePersistAsync = (persistAsync) => {
|
|
16
|
+
const [abortController, setAbortController] = (0, react_1.useState)(null);
|
|
17
|
+
const fetcher = (0, contexts_1.useFetcher)();
|
|
18
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
19
|
+
const { schema } = persistAsync;
|
|
20
|
+
async function handlePersistAsync(model) {
|
|
21
|
+
const isInvalidSchema = model instanceof Blob ? !(0, types_1.isBlobSchema)(schema) : !(0, validators_2.isValidSchema)(model, schema);
|
|
22
|
+
if ((0, validators_1.isNull)(model) || isInvalidSchema) {
|
|
23
|
+
handleError();
|
|
24
|
+
}
|
|
25
|
+
return await performPersistAsync(model);
|
|
82
26
|
}
|
|
83
|
-
|
|
27
|
+
const abortCurrentRequestAndGetNewAbortSignal = () => {
|
|
84
28
|
if (abortController) {
|
|
85
29
|
abortController.abort();
|
|
86
30
|
}
|
|
87
|
-
|
|
31
|
+
const newAbortController = new AbortController();
|
|
88
32
|
setAbortController(newAbortController);
|
|
89
33
|
return newAbortController.signal;
|
|
90
34
|
};
|
|
91
35
|
function constructFetchInit(model) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
var requestBody = isBlob
|
|
36
|
+
const isBlob = (0, types_1.isBlobSchema)(schema);
|
|
37
|
+
const signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
38
|
+
const requestKey = persistAsync.param;
|
|
39
|
+
const requestBody = isBlob
|
|
97
40
|
? wrapInFormData(requestKey, model)
|
|
98
|
-
: JSON.stringify(
|
|
41
|
+
: JSON.stringify({ [requestKey]: model });
|
|
99
42
|
return {
|
|
100
43
|
method: persistAsync.method,
|
|
101
|
-
headers:
|
|
44
|
+
headers: Object.assign({}, (!isBlob && { 'Content-Type': 'application/json' })),
|
|
102
45
|
body: requestBody,
|
|
103
|
-
signal
|
|
46
|
+
signal,
|
|
104
47
|
};
|
|
105
48
|
}
|
|
106
|
-
function performPersistAsync(payload) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return [2 /*return*/, handleHTTPError(response)];
|
|
118
|
-
}
|
|
119
|
-
return [4 /*yield*/, response.json()];
|
|
120
|
-
case 2:
|
|
121
|
-
jsonResponse = _a.sent();
|
|
122
|
-
if ((0, validators_1.isObject)(jsonResponse)) {
|
|
123
|
-
id = jsonResponse[persistAsync.idProperty];
|
|
124
|
-
if ((0, validators_1.isString)(id) || (0, validators_1.isNumber)(id)) {
|
|
125
|
-
return [2 /*return*/, { data: id }];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return [2 /*return*/, handleError()];
|
|
129
|
-
case 3:
|
|
130
|
-
error_1 = _a.sent();
|
|
131
|
-
return [2 /*return*/, handleError(error_1)];
|
|
132
|
-
case 4: return [2 /*return*/];
|
|
49
|
+
async function performPersistAsync(payload) {
|
|
50
|
+
try {
|
|
51
|
+
const response = await fetcher(persistAsync.url, constructFetchInit(payload));
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
return handleHTTPError(response);
|
|
54
|
+
}
|
|
55
|
+
const jsonResponse = await response.json();
|
|
56
|
+
if ((0, validators_1.isObject)(jsonResponse)) {
|
|
57
|
+
const id = jsonResponse[persistAsync.idProperty];
|
|
58
|
+
if ((0, validators_1.isString)(id) || (0, validators_1.isNumber)(id)) {
|
|
59
|
+
return { data: id };
|
|
133
60
|
}
|
|
134
|
-
}
|
|
135
|
-
|
|
61
|
+
}
|
|
62
|
+
return handleError();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return handleError(error);
|
|
66
|
+
}
|
|
136
67
|
}
|
|
137
|
-
function handleHTTPError(response) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
return [4 /*yield*/, response.json()];
|
|
145
|
-
case 1:
|
|
146
|
-
jsonResponse = _a.sent();
|
|
147
|
-
if ((0, validators_1.isObject)(jsonResponse)) {
|
|
148
|
-
error = (0, PersistAsyncBasicSchema_1.getErrorFromResponse)(persistAsync.param, jsonResponse);
|
|
149
|
-
if ((0, validators_1.isString)(error)) {
|
|
150
|
-
throw new Error(error);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
_a.label = 2;
|
|
154
|
-
case 2: throw new Error(intl.formatMessage(PersistAsyncSchema_messages_1["default"].genericError));
|
|
68
|
+
async function handleHTTPError(response) {
|
|
69
|
+
if (response.status === 422) {
|
|
70
|
+
const jsonResponse = await response.json();
|
|
71
|
+
if ((0, validators_1.isObject)(jsonResponse)) {
|
|
72
|
+
const error = (0, PersistAsyncBasicSchema_1.getErrorFromResponse)(persistAsync.param, jsonResponse);
|
|
73
|
+
if ((0, validators_1.isString)(error)) {
|
|
74
|
+
throw new Error(error);
|
|
155
75
|
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
throw new Error(intl.formatMessage(PersistAsyncSchema_messages_1.default.genericError));
|
|
158
79
|
}
|
|
159
|
-
|
|
160
|
-
|
|
80
|
+
const handleError = (error) => {
|
|
81
|
+
const message = hasStringMessage(error)
|
|
161
82
|
? error.message
|
|
162
|
-
: intl.formatMessage(PersistAsyncSchema_messages_1
|
|
83
|
+
: intl.formatMessage(PersistAsyncSchema_messages_1.default.genericError);
|
|
163
84
|
throw new Error(message);
|
|
164
85
|
};
|
|
165
86
|
return handlePersistAsync;
|
|
166
87
|
};
|
|
167
88
|
exports.usePersistAsync = usePersistAsync;
|
|
168
89
|
function wrapInFormData(key, value) {
|
|
169
|
-
|
|
90
|
+
const formData = new FormData();
|
|
170
91
|
if (value !== null) {
|
|
171
92
|
formData.append(key, value);
|
|
172
93
|
}
|
|
@@ -175,3 +96,4 @@ function wrapInFormData(key, value) {
|
|
|
175
96
|
function hasStringMessage(value) {
|
|
176
97
|
return (0, validators_1.isObject)(value) && 'message' in value && typeof value.message === 'string';
|
|
177
98
|
}
|
|
99
|
+
//# sourceMappingURL=usePersistAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPollingClosure = exports.usePolling = void 0;
|
|
4
4
|
/* eslint-disable fp/no-mutation */
|
|
5
|
-
|
|
6
|
-
function usePolling(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, function (pollingResponse) { return onPollingResponseReference.current(pollingResponse); }, function () { return onFailureReference.current(); });
|
|
12
|
-
}, [asyncFn, maxAttempts, maxConsecutiveFails]);
|
|
13
|
-
(0, react_1.useEffect)(function () {
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
function usePolling({ asyncFn, interval, maxAttempts, maxConsecutiveFails, onPollingResponse, onFailure, }) {
|
|
7
|
+
const onPollingResponseReference = (0, react_1.useRef)(onPollingResponse);
|
|
8
|
+
const onFailureReference = (0, react_1.useRef)(onFailure);
|
|
9
|
+
const poll = (0, react_1.useMemo)(() => createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, (pollingResponse) => onPollingResponseReference.current(pollingResponse), () => onFailureReference.current()), [asyncFn, maxAttempts, maxConsecutiveFails]);
|
|
10
|
+
(0, react_1.useEffect)(() => {
|
|
14
11
|
if (interval > 0) {
|
|
15
|
-
|
|
12
|
+
const intervalReference = setInterval(() => {
|
|
16
13
|
poll();
|
|
17
14
|
}, interval);
|
|
18
|
-
return
|
|
15
|
+
return () => clearInterval(intervalReference);
|
|
19
16
|
}
|
|
20
17
|
}, [poll, interval]);
|
|
21
|
-
(0, react_1.useEffect)(
|
|
18
|
+
(0, react_1.useEffect)(() => {
|
|
22
19
|
onPollingResponseReference.current = onPollingResponse;
|
|
23
20
|
onFailureReference.current = onFailure;
|
|
24
21
|
}, [onPollingResponse, onFailure]);
|
|
25
22
|
}
|
|
26
23
|
exports.usePolling = usePolling;
|
|
27
24
|
function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPollingResponse, onFailure) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
let isPolling = true;
|
|
26
|
+
let consecutiveFailures = 0;
|
|
27
|
+
let attemptCount = 0;
|
|
31
28
|
return asyncFn
|
|
32
|
-
?
|
|
29
|
+
? () => {
|
|
33
30
|
if (isPolling) {
|
|
34
31
|
attemptCount++;
|
|
35
32
|
asyncFn()
|
|
36
|
-
.then(
|
|
33
|
+
.then((pollingResponse) => {
|
|
37
34
|
consecutiveFailures = 0;
|
|
38
35
|
isPolling = onPollingResponse(pollingResponse);
|
|
39
|
-
})
|
|
36
|
+
})
|
|
37
|
+
.catch(() => {
|
|
40
38
|
consecutiveFailures++;
|
|
41
|
-
})
|
|
39
|
+
})
|
|
40
|
+
.finally(() => {
|
|
42
41
|
if (consecutiveFailures >= maxConsecutiveFails || attemptCount >= maxAttempts) {
|
|
43
42
|
onFailure();
|
|
44
43
|
isPolling = false;
|
|
@@ -46,8 +45,9 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
46
45
|
});
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
:
|
|
48
|
+
: () => {
|
|
50
49
|
//
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
exports.createPollingClosure = createPollingClosure;
|
|
53
|
+
//# sourceMappingURL=usePolling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePolling.js","sourceRoot":"","sources":["../../../../src/common/hooks/usePolling/usePolling.tsx"],"names":[],"mappings":";;;AAAA,mCAAmC;AACnC,iCAAmD;AAWnD,SAAgB,UAAU,CAAkB,EAC1C,OAAO,EACP,QAAQ,EACR,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,GACuB;IAChC,MAAM,0BAA0B,GAAG,IAAA,cAAM,EAAC,iBAAiB,CAAC,CAAC;IAC7D,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAC,SAAS,CAA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xB,SAAS,GAAG,iBAAiB,CAAC,eAAe,CAAC,CAAC;gBACjD,CAAC,CAAC;qBACD,KAAK,CAAC,GAAG,EAAE;oBACV,mBAAmB,EAAE,CAAC;gBACxB,CAAC,CAAC;qBACD,OAAO,CAAC,GAAG,EAAE;oBACZ,IAAI,mBAAmB,IAAI,mBAAmB,IAAI,YAAY,IAAI,WAAW,EAAE;wBAC7E,SAAS,EAAE,CAAC;wBACZ,SAAS,GAAG,KAAK,CAAC;qBACnB;gBACH,CAAC,CAAC,CAAC;aACN;QACH,CAAC;QACH,CAAC,CAAC,GAAG,EAAE;YACH,EAAE;QACJ,CAAC,CAAC;AACR,CAAC;AAlCD,oDAkCC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.usePrevious = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(0, react_1.useEffect)(
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const usePrevious = (value) => {
|
|
6
|
+
const reference = (0, react_1.useRef)();
|
|
7
|
+
(0, react_1.useEffect)(() => {
|
|
8
8
|
reference.current = value;
|
|
9
9
|
}, [value]);
|
|
10
10
|
return reference.current;
|
|
11
11
|
};
|
|
12
12
|
exports.usePrevious = usePrevious;
|
|
13
|
+
//# sourceMappingURL=usePrevious.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../../../src/common/hooks/usePrevious/usePrevious.js"],"names":[],"mappings":";;;AAAA,iCAA0C;AAEnC,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,EAAE;IACnC,MAAM,SAAS,GAAG,IAAA,cAAM,GAAE,CAAC;IAE3B,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,KAAK,CAAC;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,OAAO,SAAS,CAAC,OAAO,CAAC;AAC3B,CAAC,CAAC;AARW,QAAA,WAAW,eAQtB"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useStepPolling = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const __1 = require("..");
|
|
6
|
+
const contexts_1 = require("../../contexts");
|
|
7
7
|
function useStepPolling(polling, onAction) {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const fetcher = (0, contexts_1.useFetcher)();
|
|
9
|
+
const asyncFn = (0, react_1.useMemo)(() => {
|
|
10
10
|
if (polling) {
|
|
11
|
-
return
|
|
12
|
-
return fetcher(polling.url).then(
|
|
11
|
+
return () => {
|
|
12
|
+
return fetcher(polling.url).then((response) => {
|
|
13
13
|
if (response.ok) {
|
|
14
14
|
return response
|
|
15
15
|
.json()
|
|
16
|
-
.then(
|
|
16
|
+
.then((pollingResponse) => pollingResponse)
|
|
17
|
+
.catch((error) => null);
|
|
17
18
|
}
|
|
18
19
|
else {
|
|
19
20
|
throw new Error('failed');
|
|
@@ -25,7 +26,7 @@ function useStepPolling(polling, onAction) {
|
|
|
25
26
|
return undefined;
|
|
26
27
|
}
|
|
27
28
|
}, [polling, fetcher]);
|
|
28
|
-
|
|
29
|
+
const onPollingResponse = (0, react_1.useCallback)((pollingResponse) => {
|
|
29
30
|
if (pollingResponse === null || pollingResponse === void 0 ? void 0 : pollingResponse.action) {
|
|
30
31
|
onAction(pollingResponse.action);
|
|
31
32
|
return false; // stop polling
|
|
@@ -33,16 +34,17 @@ function useStepPolling(polling, onAction) {
|
|
|
33
34
|
return true; // continue polling
|
|
34
35
|
}, [onAction]);
|
|
35
36
|
(0, __1.usePolling)({
|
|
36
|
-
asyncFn
|
|
37
|
+
asyncFn,
|
|
37
38
|
interval: 1000 * ((polling === null || polling === void 0 ? void 0 : polling.interval) || 0),
|
|
38
39
|
maxAttempts: (polling === null || polling === void 0 ? void 0 : polling.maxAttempts) || 0,
|
|
39
40
|
maxConsecutiveFails: 1,
|
|
40
|
-
onPollingResponse
|
|
41
|
-
onFailure: (0, react_1.useCallback)(
|
|
41
|
+
onPollingResponse,
|
|
42
|
+
onFailure: (0, react_1.useCallback)(() => {
|
|
42
43
|
if (polling) {
|
|
43
44
|
onAction(polling.onError.action);
|
|
44
45
|
}
|
|
45
|
-
}, [onAction, polling])
|
|
46
|
+
}, [onAction, polling]),
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
exports.useStepPolling = useStepPolling;
|
|
50
|
+
//# sourceMappingURL=useStepPolling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStepPolling.js","sourceRoot":"","sources":["../../../../src/common/hooks/useStepPolling/useStepPolling.tsx"],"names":[],"mappings":";;;AAAA,iCAA6C;AAE7C,0BAAgC;AAEhC,6CAA4C;AAE5C,SAAgB,cAAc,CAC5B,OAAyC,EACzC,QAAkC;IAElC,MAAM,OAAO,GAAG,IAAA,qBAAU,GAAE,CAAC;IAE7B,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC3B,IAAI,OAAO,EAAE;YACX,OAAO,GAAG,EAAE;gBACV,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oBAC5C,IAAI,QAAQ,CAAC,EAAE,EAAE;wBACf,OAAO,QAAQ;6BACZ,IAAI,EAAE;6BACN,IAAI,CAAC,CAAC,eAAgC,EAAE,EAAE,CAAC,eAAe,CAAC;6BAC3D,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;qBAC3B;yBAAM;wBACL,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;qBAC3B;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;SACH;aAAM;YACL,OAAO,SAAS,CAAC;SAClB;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEvB,MAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,CAAC,eAAgC,EAAE,EAAE;QACnC,IAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAAE;YAC3B,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YACjC,OAAO,KAAK,CAAC,CAAC,eAAe;SAC9B;QACD,OAAO,IAAI,CAAC,CAAC,mBAAmB;IAClC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,IAAA,cAAU,EAAkB;QAC1B,OAAO;QACP,QAAQ,EAAE,IAAI,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,CAAC,CAAC;QACzC,WAAW,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,KAAI,CAAC;QACtC,mBAAmB,EAAE,CAAC;QACtB,iBAAiB;QACjB,SAAS,EAAE,IAAA,mBAAW,EAAC,GAAG,EAAE;YAC1B,IAAI,OAAO,EAAE;gBACX,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAClC;QACH,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KACxB,CAAC,CAAC;AACL,CAAC;AAhDD,wCAgDC"}
|
|
@@ -13,5 +13,6 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./makeFetcher"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/makeFetcher/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B"}
|
|
@@ -1,37 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.makeFetcher = void 0;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return fetch(resource, __assign(__assign({}, (init || {})), { headers: headers }));
|
|
21
|
-
};
|
|
4
|
+
const api_utils_1 = require("../utils/api-utils");
|
|
5
|
+
const makeFetcher = (baseUrl, additionalHeaders) => (input, init) => {
|
|
6
|
+
const resource = applyBaseUrl(input, baseUrl || '');
|
|
7
|
+
const headers = mergeHeaders(init === null || init === void 0 ? void 0 : init.headers, additionalHeaders);
|
|
8
|
+
return fetch(resource, Object.assign(Object.assign({}, (init || {})), { headers }));
|
|
22
9
|
};
|
|
23
10
|
exports.makeFetcher = makeFetcher;
|
|
24
|
-
|
|
11
|
+
const applyBaseUrl = (input, baseUrl) => {
|
|
25
12
|
return typeof input === 'string' && (0, api_utils_1.isRelativePath)(input) ? baseUrl + input : input;
|
|
26
13
|
};
|
|
27
|
-
|
|
14
|
+
const mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
28
15
|
if (!initHeaders && !additionalHeaders) {
|
|
29
16
|
return {};
|
|
30
17
|
}
|
|
31
|
-
|
|
32
|
-
for (
|
|
33
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
18
|
+
const headers = new Headers(initHeaders);
|
|
19
|
+
for (const [key, value] of Object.entries(additionalHeaders || {})) {
|
|
34
20
|
headers.set(key, value);
|
|
35
21
|
}
|
|
36
22
|
return headers;
|
|
37
23
|
};
|
|
24
|
+
//# sourceMappingURL=makeFetcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"makeFetcher.js","sourceRoot":"","sources":["../../../src/common/makeFetcher/makeFetcher.ts"],"names":[],"mappings":";;;AAAA,kDAAoD;AAI7C,MAAM,WAAW,GACtB,CAAC,OAAe,EAAE,iBAA+B,EAAW,EAAE,CAC9D,CAAC,KAAK,EAAE,IAAK,EAAE,EAAE;IACf,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC,QAAQ,kCAAO,CAAC,IAAI,IAAI,EAAE,CAAC,KAAE,OAAO,IAAG,CAAC;AACvD,CAAC,CAAC;AANS,QAAA,WAAW,eAMpB;AAEJ,MAAM,YAAY,GAAG,CAAC,KAA6B,EAAE,OAAe,EAAE,EAAE;IACtE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,IAAA,0BAAc,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;AACtF,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,WAAyB,EAAE,iBAA+B,EAAE,EAAE;IAClF,IAAI,CAAC,WAAW,IAAI,CAAC,iBAAiB,EAAE;QACtC,OAAO,EAAE,CAAC;KACX;IACD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,iBAAiB,IAAI,EAAE,CAAC,EAAE;QAClE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAe,CAAC,CAAC;KACnC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
package/build/common/messages.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
3
|
-
|
|
4
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_intl_1 = require("react-intl");
|
|
4
|
+
exports.default = (0, react_intl_1.defineMessages)({
|
|
5
5
|
required: {
|
|
6
6
|
id: 'dynamicFlows.DefaultErrorMessages.required',
|
|
7
7
|
defaultMessage: 'Please fill out this field.',
|
|
8
|
-
description: 'Customer has left the required field empty'
|
|
9
|
-
}
|
|
8
|
+
description: 'Customer has left the required field empty',
|
|
9
|
+
},
|
|
10
10
|
});
|
|
11
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/common/messages.ts"],"names":[],"mappings":";;AAAA,2CAA4C;AAE5C,kBAAe,IAAA,2BAAc,EAAC;IAC5B,QAAQ,EAAE;QACR,EAAE,EAAE,4CAA4C;QAChD,cAAc,EAAE,6BAA6B;QAC7C,WAAW,EAAE,4CAA4C;KAC1D;CACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isRelativePath = exports.getJson = exports.isStatus422 = exports.isStatus2xx = void 0;
|
|
4
4
|
function isStatus2xx(status) {
|
|
5
5
|
return status >= 200 && status < 300;
|
|
@@ -13,8 +13,8 @@ function getJson(response) {
|
|
|
13
13
|
return response.json();
|
|
14
14
|
}
|
|
15
15
|
exports.getJson = getJson;
|
|
16
|
-
function isRelativePath(url) {
|
|
17
|
-
|
|
18
|
-
return (['https://', 'http://', 'data:'].some(function (prefix) { return url.slice(0, prefix.length) === prefix && url.length > prefix.length; }) === false);
|
|
16
|
+
function isRelativePath(url = '') {
|
|
17
|
+
return (['https://', 'http://', 'data:'].some((prefix) => url.slice(0, prefix.length) === prefix && url.length > prefix.length) === false);
|
|
19
18
|
}
|
|
20
19
|
exports.isRelativePath = isRelativePath;
|
|
20
|
+
//# sourceMappingURL=api-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-utils.js","sourceRoot":"","sources":["../../../src/common/utils/api-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,MAA0B;IACpD,OAAO,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC;AACvC,CAAC;AAFD,kCAEC;AAED,SAAgB,WAAW,CAAC,MAA0B;IACpD,OAAO,MAAM,KAAK,GAAG,CAAC;AACxB,CAAC;AAFD,kCAEC;AAED,SAAgB,OAAO,CAAC,QAAkB;IACxC,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAFD,0BAEC;AAED,SAAgB,cAAc,CAAC,GAAG,GAAG,EAAE;IACrC,OAAO,CACL,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,CACnC,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CACjF,KAAK,KAAK,CACZ,CAAC;AACJ,CAAC;AAND,wCAMC"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dateToDateString = exports.dateStringToDate = void 0;
|
|
4
|
-
|
|
4
|
+
const validators_1 = require("../validators");
|
|
5
5
|
// function taken from: https://stackoverflow.com/questions/23593052/format-javascript-date-as-yyyy-mm-dd
|
|
6
6
|
function formatDate(date) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
const d = new Date(date);
|
|
8
|
+
const month = `${d.getMonth() + 1}`;
|
|
9
|
+
const day = `${d.getDate()}`;
|
|
10
|
+
const year = d.getFullYear();
|
|
11
|
+
const formattedMonth = month.length < 2 ? `0${month}` : month;
|
|
12
|
+
const formattedDay = day.length < 2 ? `0${day}` : day;
|
|
13
13
|
return [year, formattedMonth, formattedDay].join('-');
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const dateStringToDate = (dateString) => {
|
|
16
16
|
if (!dateString) {
|
|
17
17
|
return null;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
const [year, month, date] = dateString.split('-').map((number) => parseInt(number, 10));
|
|
20
20
|
if (!(0, validators_1.isNumber)(year) || !(0, validators_1.isNumber)(month) || !(0, validators_1.isNumber)(date)) {
|
|
21
21
|
return null;
|
|
22
22
|
}
|
|
23
23
|
return new Date(year, month - 1, date);
|
|
24
24
|
};
|
|
25
25
|
exports.dateStringToDate = dateStringToDate;
|
|
26
|
-
|
|
26
|
+
const dateToDateString = (date) => formatDate(date);
|
|
27
27
|
exports.dateToDateString = dateToDateString;
|
|
28
|
+
//# sourceMappingURL=date-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../src/common/utils/date-utils.ts"],"names":[],"mappings":";;;AAAA,8CAAyC;AAEzC,yGAAyG;AACzG,SAAS,UAAU,CAAC,IAAmB;IACrC,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC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