@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,118 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
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;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
4
|
};
|
|
41
|
-
exports
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const contexts_1 = require("../../common/contexts");
|
|
9
|
+
const utils_1 = require("../../common/utils");
|
|
10
|
+
const types_1 = require("../../types");
|
|
11
|
+
const cameraCapture_1 = __importDefault(require("./cameraCapture"));
|
|
48
12
|
function blobToBase64(blob) {
|
|
49
|
-
return new Promise(
|
|
13
|
+
return new Promise((resolve, _) => {
|
|
50
14
|
// we can safely assume the type of reader.result is string
|
|
51
15
|
// because we're calling reader.readAsDataURL
|
|
52
16
|
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
53
|
-
|
|
17
|
+
const reader = new FileReader();
|
|
54
18
|
// eslint-disable-next-line fp/no-mutation
|
|
55
|
-
reader.onloadend =
|
|
19
|
+
reader.onloadend = () => resolve(reader.result);
|
|
56
20
|
reader.readAsDataURL(blob);
|
|
57
21
|
});
|
|
58
22
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
23
|
+
const CameraStep = (props) => {
|
|
24
|
+
const { step, model, onModelChange, onAction } = props;
|
|
25
|
+
const onEvent = (0, contexts_1.useEventDispatcher)();
|
|
26
|
+
const objectSchema = getObjectSchema(step);
|
|
27
|
+
const cameraSchema = getCameraSchema(step);
|
|
28
|
+
const action = getFirstAction(step);
|
|
29
|
+
const { title, image, cameraConfig } = cameraSchema;
|
|
30
|
+
const { assets, direction, instructions } = cameraConfig || {};
|
|
31
|
+
const { overlay, outline } = assets || {};
|
|
32
|
+
const { url: imageUrl } = image || {};
|
|
33
|
+
const [captureClicked, setCaptureClicked] = (0, react_1.useState)(false);
|
|
70
34
|
// We need to wait for model to update before we call onAction()
|
|
71
|
-
(0, react_1.useEffect)(
|
|
35
|
+
(0, react_1.useEffect)(() => {
|
|
72
36
|
if (captureClicked) {
|
|
73
37
|
onAction(action);
|
|
74
38
|
}
|
|
75
39
|
}, [model]);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
formSchema: objectSchema,
|
|
92
|
-
triggerModel: newValue,
|
|
93
|
-
triggerSchema: cameraSchema
|
|
94
|
-
});
|
|
95
|
-
_b.label = 2;
|
|
96
|
-
case 2: return [2 /*return*/];
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
}); };
|
|
100
|
-
return ((0, jsx_runtime_1.jsx)(cameraCapture_1["default"], { overlay: overlay, outline: outline, title: title, imageUrl: imageUrl, instructions: instructions, direction: direction, onEvent: onEvent, onCapture: function (blob) {
|
|
40
|
+
const handleCapture = async (blob) => {
|
|
41
|
+
const { $id } = cameraSchema;
|
|
42
|
+
if (blob) {
|
|
43
|
+
const newValue = await blobToBase64(blob);
|
|
44
|
+
const newModel = { [$id || '']: newValue };
|
|
45
|
+
setCaptureClicked(true);
|
|
46
|
+
onModelChange({
|
|
47
|
+
model: newModel,
|
|
48
|
+
formSchema: objectSchema,
|
|
49
|
+
triggerModel: newValue,
|
|
50
|
+
triggerSchema: cameraSchema,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(cameraCapture_1.default, { overlay: overlay, outline: outline, title: title, imageUrl: imageUrl, instructions: instructions, direction: direction, onEvent: onEvent, onCapture: (blob) => {
|
|
101
55
|
void handleCapture(blob);
|
|
102
56
|
} }));
|
|
103
57
|
};
|
|
104
|
-
exports
|
|
58
|
+
exports.default = CameraStep;
|
|
105
59
|
function getObjectSchema(step) {
|
|
106
|
-
|
|
107
|
-
|
|
60
|
+
const nonHiddenSchemas = (0, utils_1.filterHiddenSchemas)(step.schemas || []);
|
|
61
|
+
const objectSchema = nonHiddenSchemas[0];
|
|
108
62
|
if (!objectSchema || !(0, types_1.isObjectSchema)(objectSchema)) {
|
|
109
63
|
throw new Error('The first schema in a camera step is expected to be of type object and have at least one property with a schema...');
|
|
110
64
|
}
|
|
111
65
|
return objectSchema;
|
|
112
66
|
}
|
|
113
67
|
function getCameraSchema(step) {
|
|
114
|
-
|
|
115
|
-
|
|
68
|
+
const objectSchema = getObjectSchema(step);
|
|
69
|
+
const firstProperty = Object.values(objectSchema.properties)[0];
|
|
116
70
|
if (!firstProperty) {
|
|
117
71
|
throw new Error('The first schema in a camera step is expected to be of type object and have at least one property with a schema...');
|
|
118
72
|
}
|
|
@@ -128,3 +82,4 @@ function getFirstAction(step) {
|
|
|
128
82
|
}
|
|
129
83
|
return step.actions[0];
|
|
130
84
|
}
|
|
85
|
+
//# sourceMappingURL=CameraStep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraStep.js","sourceRoot":"","sources":["../../../src/step/cameraStep/CameraStep.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAA4C;AAE5C,oDAA2D;AAC3D,8CAAyD;AAEzD,uCAAqF;AAErF,oEAA4C;AAE5C,SAAS,YAAY,CAAC,IAAU;IAC9B,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;QACxC,2DAA2D;QAC3D,6CAA6C;QAC7C,qEAAqE;QACrE,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,0CAA0C;QAC1C,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAgB,CAAC,CAAC;QAC1D,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC;AAMD,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC5C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEvD,MAAM,OAAO,GAAG,IAA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CAAA,MAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,0CAAE,MAAM,MAAK,CAAC,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;KACjD;IAED,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -1,104 +1,47 @@
|
|
|
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
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
var handleCapture = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
-
var canvas;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_intl_1 = require("react-intl");
|
|
9
|
+
const react_webcam_1 = __importDefault(require("react-webcam"));
|
|
10
|
+
const CameraCapture_messages_1 = __importDefault(require("./CameraCapture.messages"));
|
|
11
|
+
const components_1 = require("./components");
|
|
12
|
+
const hooks_1 = require("./hooks");
|
|
13
|
+
const Overlay_1 = __importDefault(require("./overlay/Overlay"));
|
|
14
|
+
const screens_1 = require("./screens");
|
|
15
|
+
const tracking_1 = require("./tracking");
|
|
16
|
+
const utils_1 = require("./utils");
|
|
17
|
+
const CameraCapture = ({ direction = 'back', overlay = '', outline = '', imageUrl = '', title = '', instructions = '', showReview = false, onCapture, onEvent, }) => {
|
|
18
|
+
const [mode, setMode] = (0, react_1.useState)('CAPTURE');
|
|
19
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, react_1.useState)(false);
|
|
20
|
+
const [ready, setReady] = (0, react_1.useState)(false);
|
|
21
|
+
const [reviewImage, setReviewImage] = (0, react_1.useState)();
|
|
22
|
+
const webcamReference = (0, react_1.useRef)(null);
|
|
23
|
+
const { videoConstraints } = (0, hooks_1.useVideoConstraints)(direction);
|
|
24
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
25
|
+
const handleCapture = (0, react_1.useCallback)(async () => {
|
|
75
26
|
var _a, _b, _c, _d, _e, _f;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
}, 'image/jpeg', 0.92);
|
|
96
|
-
_g.label = 2;
|
|
97
|
-
case 2: return [2 /*return*/];
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
}); }, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
101
|
-
var handleUserMediaError = (0, react_1.useCallback)(function (error) {
|
|
27
|
+
if (((_a = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _a === void 0 ? void 0 : _a.video) && ((_c = (_b = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.readyState) >= 3) {
|
|
28
|
+
(_e = (_d = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _d === void 0 ? void 0 : _d.video) === null || _e === void 0 ? void 0 : _e.pause();
|
|
29
|
+
const canvas = await (0, utils_1.generateCanvasFromVideo)((_f = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _f === void 0 ? void 0 : _f.video);
|
|
30
|
+
canvas === null || canvas === void 0 ? void 0 : canvas.toBlob((blob) => {
|
|
31
|
+
if (blob) {
|
|
32
|
+
if (showReview) {
|
|
33
|
+
const source = window.URL.createObjectURL(blob);
|
|
34
|
+
setReviewImage({ source, blob });
|
|
35
|
+
setMode('REVIEW');
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
onCapture(blob);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, 'image/jpeg', 0.92);
|
|
42
|
+
}
|
|
43
|
+
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
44
|
+
const handleUserMediaError = (0, react_1.useCallback)((error) => {
|
|
102
45
|
if (error instanceof DOMException && (error === null || error === void 0 ? void 0 : error.name) === 'NotAllowedError') {
|
|
103
46
|
setMode('NO_CAMERA_ACCESS');
|
|
104
47
|
(0, tracking_1.trackCameraPermissionDenied)(onEvent);
|
|
@@ -107,21 +50,22 @@ var CameraCapture = function (_a) {
|
|
|
107
50
|
setMode('CAMERA_NOT_SUPPORTED');
|
|
108
51
|
(0, tracking_1.trackCameraNotSupported)(onEvent, error);
|
|
109
52
|
}, [setMode, onEvent]);
|
|
110
|
-
|
|
53
|
+
const handleUserMedia = (0, react_1.useCallback)((stream) => {
|
|
111
54
|
setReady(true);
|
|
112
55
|
setIsVideoMirrored((0, utils_1.isSelfieCamera)(stream));
|
|
113
|
-
void (0, tracking_1.trackCameraFeedStarted)(onEvent, { direction
|
|
56
|
+
void (0, tracking_1.trackCameraFeedStarted)(onEvent, { direction }, stream);
|
|
114
57
|
}, [setIsVideoMirrored, onEvent, direction]);
|
|
115
|
-
|
|
58
|
+
const handleReviewSubmit = () => {
|
|
116
59
|
onCapture((reviewImage === null || reviewImage === void 0 ? void 0 : reviewImage.blob) || null);
|
|
117
60
|
};
|
|
118
|
-
|
|
61
|
+
const handleReviewRetry = () => {
|
|
119
62
|
setMode('CAPTURE');
|
|
120
63
|
setReviewImage(undefined);
|
|
121
64
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return ((0, jsx_runtime_1.jsxs)("section",
|
|
65
|
+
const handleRetryCameraAccess = () => setMode('CAPTURE');
|
|
66
|
+
const captureScreen = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [videoConstraints && ((0, jsx_runtime_1.jsx)(react_webcam_1.default, { ref: webcamReference, audio: false, videoConstraints: videoConstraints, mirrored: isVideoMirrored, onUserMediaError: handleUserMediaError, onUserMedia: handleUserMedia })), (0, jsx_runtime_1.jsx)(Overlay_1.default, { overlay: overlay, outline: outline, imageUrl: imageUrl, title: title, instructions: instructions }), ready && (0, jsx_runtime_1.jsx)(components_1.CaptureBottomBar, { onCapture: () => void handleCapture() })] }));
|
|
67
|
+
const reviewScreen = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { className: "review-image", src: reviewImage === null || reviewImage === void 0 ? void 0 : reviewImage.source, alt: "" }), (0, jsx_runtime_1.jsx)(Overlay_1.default, { overlay: overlay, imageUrl: imageUrl, title: title, instructions: instructions, reviewInstructions: intl.formatMessage(CameraCapture_messages_1.default.reviewInstructions) }), (0, jsx_runtime_1.jsx)(components_1.ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })] }));
|
|
68
|
+
return ((0, jsx_runtime_1.jsxs)("section", Object.assign({ className: "camera-capture" }, { children: [mode === 'CAPTURE' && captureScreen, mode === 'REVIEW' && reviewScreen, mode === 'NO_CAMERA_ACCESS' && (0, jsx_runtime_1.jsx)(screens_1.NoCameraAccess, { onAction: handleRetryCameraAccess }), mode === 'CAMERA_NOT_SUPPORTED' && (0, jsx_runtime_1.jsx)(screens_1.CameraNotSupported, {})] })));
|
|
126
69
|
};
|
|
127
|
-
exports
|
|
70
|
+
exports.default = CameraCapture;
|
|
71
|
+
//# sourceMappingURL=CameraCapture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraCapture.js","sourceRoot":"","sources":["../../../../src/step/cameraStep/cameraCapture/CameraCapture.tsx"],"names":[],"mappings":";;;;;;AAAA,iCAAsD;AACtD,2CAAqC;AACrC,gEAAkC;AAKlC,sFAAgD;AAChD,6CAAiE;AACjE,mCAA8C;AAC9C,gEAAwC;AACxC,uCAA+D;AAC/D,yCAIoB;AACpB,mCAAkE;AAgBlE,MAAM,aAAa,GAAG,CAAC,EACrB,SAAS,GAAG,MAAM,EAClB,OAAO,GAAG,EAAE,EACZ,OAAO,GAAG,EAAE,EACZ,QAAQ,GAAG,EAAE,EACb,KAAK,GAAG,EAAE,EACV,YAAY,GAAG,EAAE,EACjB,UAAU,GAAG,KAAK,EAClB,SAAS,EACT,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AAS,IAAI,aAAa,EACnC,IAAI,KAAK,QAAQ,IAAI,YAAY,EACjC,IAAI,KAAK,kBAAkB,IAAI,uBAAC,wBAAc,IAAC,QAAQ,EAAE,uBAAuB,GAAI,EACpF,IAAI,KAAK,sBAAsB,IAAI,uBAAC,4BAAkB,KAAG,KAClD,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,aAAa,CAAC"}
|
|
@@ -1,20 +1,21 @@
|
|
|
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
|
reviewSubmit: {
|
|
6
6
|
id: 'dynamicFlows.CameraCapture.reviewSubmit',
|
|
7
7
|
defaultMessage: 'Yes, submit',
|
|
8
|
-
description: 'Accept and submit the image taken with the camera'
|
|
8
|
+
description: 'Accept and submit the image taken with the camera',
|
|
9
9
|
},
|
|
10
10
|
reviewRetry: {
|
|
11
11
|
id: 'dynamicFlows.CameraCapture.reviewRetry',
|
|
12
12
|
defaultMessage: 'No, try again',
|
|
13
|
-
description: "Image taken with camera is not good, don't submit, and retake the image"
|
|
13
|
+
description: "Image taken with camera is not good, don't submit, and retake the image",
|
|
14
14
|
},
|
|
15
15
|
reviewInstructions: {
|
|
16
16
|
id: 'dynamicFlows.CameraCapture.reviewInstructions',
|
|
17
17
|
defaultMessage: 'Is your picture clear, readable and complete?',
|
|
18
|
-
description: 'After taking an image with the camera, prompt user to review the image'
|
|
19
|
-
}
|
|
18
|
+
description: 'After taking an image with the camera, prompt user to review the image',
|
|
19
|
+
},
|
|
20
20
|
});
|
|
21
|
+
//# sourceMappingURL=CameraCapture.messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CameraCapture.messages.js","sourceRoot":"","sources":["../../../../src/step/cameraStep/cameraCapture/CameraCapture.messages.ts"],"names":[],"mappings":";;AAAA,2CAA4C;AAE5C,kBAAe,IAAA,2BAAc,EAAC;IAC5B,YAAY,EAAE;QACZ,EAAE,EAAE,yCAAyC;QAC7C,cAAc,EAAE,aAAa;QAC7B,WAAW,EAAE,mDAAmD;KACjE;IACD,WAAW,EAAE;QACX,EAAE,EAAE,wCAAwC;QAC5C,cAAc,EAAE,eAAe;QAC/B,WAAW,EAAE,yEAAyE;KACvF;IACD,kBAAkB,EAAE;QAClB,EAAE,EAAE,+CAA+C;QACnD,cAAc,EAAE,+CAA+C;QAC/D,WAAW,EAAE,wEAAwE;KACtF;CACF,CAAC,CAAC"}
|
|
@@ -1,36 +1,19 @@
|
|
|
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
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
16
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
6
|
exports.ReviewBottomBar = exports.CaptureBottomBar = void 0;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var onCapture = _a.onCapture;
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "bottom-bar" }, { children: (0, jsx_runtime_1.jsx)(CaptureButton, { onClick: onCapture }) })));
|
|
25
|
-
};
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const components_1 = require("@transferwise/components");
|
|
9
|
+
const react_intl_1 = require("react-intl");
|
|
10
|
+
const CameraCapture_messages_1 = __importDefault(require("../CameraCapture.messages"));
|
|
11
|
+
const CaptureBottomBar = ({ onCapture }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "bottom-bar" }, { children: (0, jsx_runtime_1.jsx)(CaptureButton, { onClick: onCapture }) })));
|
|
26
12
|
exports.CaptureBottomBar = CaptureBottomBar;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "bottom-bar p-x-2" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "col-xs-12 col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, __assign({ className: "m-b-1", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, onClick: onSubmit }, { children: intl.formatMessage(CameraCapture_messages_1["default"].reviewSubmit) })), (0, jsx_runtime_1.jsx)(components_1.Button, __assign({ className: "m-b-2", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, priority: components_1.Priority.SECONDARY, onClick: onRetry }, { children: intl.formatMessage(CameraCapture_messages_1["default"].reviewRetry) }))] })) })) })));
|
|
13
|
+
const ReviewBottomBar = ({ onSubmit, onRetry, }) => {
|
|
14
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
15
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "bottom-bar p-x-2" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "col-xs-12 col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ className: "m-b-1", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, onClick: onSubmit }, { children: intl.formatMessage(CameraCapture_messages_1.default.reviewSubmit) })), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ className: "m-b-2", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, priority: components_1.Priority.SECONDARY, onClick: onRetry }, { children: intl.formatMessage(CameraCapture_messages_1.default.reviewRetry) }))] })) })) })));
|
|
31
16
|
};
|
|
32
17
|
exports.ReviewBottomBar = ReviewBottomBar;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return ((0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: "camera-capture-btn m-b-2", "data-testid": "camera-capture-button", onClick: onClick }, { children: (0, jsx_runtime_1.jsx)("span", { className: "camera-capture-btn-inner" }) })));
|
|
36
|
-
};
|
|
18
|
+
const CaptureButton = ({ onClick }) => ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: "button", className: "camera-capture-btn m-b-2", "data-testid": "camera-capture-button", onClick: onClick }, { children: (0, jsx_runtime_1.jsx)("span", { className: "camera-capture-btn-inner" }) })));
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/step/cameraStep/cameraCapture/components/index.tsx"],"names":[],"mappings":";;;;;;;AAAA,yDAA+E;AAC/E,2CAAqC;AAErC,uFAAiD;AAE1C,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAA6B,EAAE,EAAE,CAAC,CAC5E,8CAAK,SAAS,EAAC,YAAY,gBACzB,uBAAC,aAAa,IAAC,OAAO,EAAE,SAAS,GAAI,IACjC,CACP,CAAC;AAJW,QAAA,gBAAgB,oBAI3B;AAEK,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,OAAO,GAIR,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,IAAA,oBAAO,GAAE,CAAC;IACvB,OAAO,CACL,8CAAK,SAAS,EAAC,kBAAkB,gBAC/B,8CAAK,SAAS,EAAC,KAAK,gBAClB,+CAAK,SAAS,EAAC,oCAAoC,iBACjD,uBAAC,mBAAM,kBACL,SAAS,EAAC,OAAO,EACjB,KAAK,QACL,IAAI,EAAE,iBAAI,CAAC,MAAM,EACjB,IAAI,EAAE,wBAAW,CAAC,MAAM,EACxB,OAAO,EAAE,QAAQ,gBAEhB,IAAI,CAAC,aAAa,CAAC,gCAAQ,CAAC,YAAY,CAAC,IACnC,EACT,uBAAC,mBAAM,kBACL,SAAS,EAAC,OAAO,EACjB,KAAK,QACL,IAAI,EAAE,iBAAI,CAAC,MAAM,EACjB,IAAI,EAAE,wBAAW,CAAC,MAAM,EACxB,QAAQ,EAAE,qBAAQ,CAAC,SAAS,EAC5B,OAAO,EAAE,OAAO,gBAEf,IAAI,CAAC,aAAa,CAAC,gCAAQ,CAAC,WAAW,CAAC,IAClC,KACL,IACF,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,eAAe,mBAmC1B;AAEF,MAAM,aAAa,GAAG,CAAC,EAAE,OAAO,EAA2B,EAAE,EAAE,CAAC,CAC9D,iDACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0BAA0B,iBACxB,uBAAuB,EACnC,OAAO,EAAE,OAAO,gBAEhB,iCAAM,SAAS,EAAC,0BAA0B,GAAG,IACtC,CACV,CAAC"}
|
|
@@ -1,84 +1,30 @@
|
|
|
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
|
-
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
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
3
|
exports.useVideoConstraints = void 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const useVideoConstraints = (direction) => {
|
|
7
|
+
const [videoConstraints, setVideoConstraints] = (0, react_1.useState)();
|
|
8
|
+
const defaultVideoConstraints = {
|
|
56
9
|
facingMode: direction === 'front' ? 'user' : 'environment',
|
|
57
10
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
58
11
|
width: { min: 640, max: 1920, ideal: 1280 },
|
|
59
12
|
frameRate: 30,
|
|
60
|
-
aspectRatio: 16 / 9
|
|
13
|
+
aspectRatio: 16 / 9,
|
|
61
14
|
};
|
|
62
|
-
(0, react_1.useEffect)(
|
|
15
|
+
(0, react_1.useEffect)(() => {
|
|
63
16
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
64
17
|
}, [direction]);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (!(direction === 'back')) return [3 /*break*/, 2];
|
|
71
|
-
return [4 /*yield*/, (0, utils_1.getAvailableVideoDevices)()];
|
|
72
|
-
case 1:
|
|
73
|
-
mainCamera = (_a.sent()).find(utils_1.isMainBackCamera);
|
|
74
|
-
if (mainCamera === null || mainCamera === void 0 ? void 0 : mainCamera.deviceId) {
|
|
75
|
-
return [2 /*return*/, __assign(__assign({}, defaultVideoConstraints), { deviceId: { exact: mainCamera.deviceId } })];
|
|
76
|
-
}
|
|
77
|
-
_a.label = 2;
|
|
78
|
-
case 2: return [2 /*return*/, defaultVideoConstraints];
|
|
18
|
+
const getVideoConstraints = async (direction) => {
|
|
19
|
+
if (direction === 'back') {
|
|
20
|
+
const mainCamera = (await (0, utils_1.getAvailableVideoDevices)()).find(utils_1.isMainBackCamera);
|
|
21
|
+
if (mainCamera === null || mainCamera === void 0 ? void 0 : mainCamera.deviceId) {
|
|
22
|
+
return Object.assign(Object.assign({}, defaultVideoConstraints), { deviceId: { exact: mainCamera.deviceId } });
|
|
79
23
|
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
24
|
+
}
|
|
25
|
+
return defaultVideoConstraints;
|
|
26
|
+
};
|
|
27
|
+
return { videoConstraints };
|
|
83
28
|
};
|
|
84
29
|
exports.useVideoConstraints = useVideoConstraints;
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/step/cameraStep/cameraCapture/hooks/index.ts"],"names":[],"mappings":";;;AAAA,iCAA4C;AAG5C,oCAAsE;AAE/D,MAAM,mBAAmB,GAAG,CAAC,SAA0B,EAAE,EAAE;IAChE,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,IAAA,gBAAQ,GAAyB,CAAC;IAElF,MAAM,uBAAuB,GAAG;QAC9B,UAAU,EAAE,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa;QAC1D,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE;QAC3C,KAAK,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;QAC3C,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE,GAAG,CAAC;KACpB,CAAC;IAEF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,KAAK,mBAAmB,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAChE,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,MAAM,mBAAmB,GAAG,KAAK,EAC/B,SAA0B,EACM,EAAE;QAClC,IAAI,SAAS,KAAK,MAAM,EAAE;YACxB,MAAM,UAAU,GAAG,CAAC,MAAM,IAAA,gCAAwB,GAAE,CAAC,CAAC,IAAI,CAAC,wBAAgB,CAAC,CAAC;YAE7E,IAAI,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,EAAE;gBACxB,uCACK,uBAAuB,KAC1B,QAAQ,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE,IACxC;aACH;SACF;QAED,OAAO,uBAAuB,CAAC;IACjC,CAAC,CAAC;IAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAC9B,CAAC,CAAC;AAjCW,QAAA,mBAAmB,uBAiC9B"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
exports.__esModule = true;
|
|
14
|
-
exports["default"] = void 0;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = void 0;
|
|
15
7
|
var CameraCapture_1 = require("./CameraCapture");
|
|
16
|
-
|
|
8
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CameraCapture_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/step/cameraStep/cameraCapture/index.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA0C;AAAjC,yHAAA,OAAO,OAAA"}
|