@wise/dynamic-flow-client 0.4.0-beta-d2067b.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/constants/DateMode.js +7 -0
- package/build/common/constants/FormControlType.js +20 -0
- package/build/common/constants/MonthFormat.js +7 -0
- package/build/common/constants/SchemaType.js +14 -0
- package/build/common/constants/Size.js +10 -0
- package/build/common/constants/index.js +21 -0
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +41 -0
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +17 -0
- package/build/common/contexts/eventsContext/EventsContext.js +39 -0
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +42 -0
- package/build/common/contexts/index.js +20 -0
- package/build/common/contexts/logContext/LogContext.js +45 -0
- package/build/common/hooks/index.js +23 -0
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +13 -0
- package/build/common/hooks/useExternal/useExternal.js +19 -0
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +73 -0
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +177 -0
- package/build/common/hooks/usePolling/usePolling.js +53 -0
- package/build/common/hooks/usePrevious/usePrevious.js +12 -0
- package/build/common/hooks/useStepPolling/useStepPolling.js +48 -0
- package/build/common/makeFetcher/index.js +17 -0
- package/build/common/makeFetcher/makeFetcher.js +37 -0
- package/build/common/messages.js +10 -0
- package/build/common/utils/api-utils.js +20 -0
- package/build/common/utils/date-utils.js +27 -0
- package/build/common/utils/debounce.js +42 -0
- package/build/common/utils/file-utils.js +51 -0
- package/build/common/utils/id-utils.js +9 -0
- package/build/common/utils/index.js +24 -0
- package/build/common/utils/is-equal.js +25 -0
- package/build/common/utils/schema-utils.js +55 -0
- package/build/common/utils/step-utils.js +47 -0
- package/build/common/validators/index.js +28 -0
- package/build/common/validators/models/model-validators.js +69 -0
- package/build/common/validators/models/models.utils.js +130 -0
- package/build/common/validators/schemas/schema-validators.js +101 -0
- package/build/common/validators/types/type-validators.js +25 -0
- package/build/common/validators/validationFailures/validation-failures.js +151 -0
- package/build/common/validators/validationFailures/validation-failures.utils.js +51 -0
- package/build/common/validators/values/value-validators.js +9 -0
- package/build/dynamicFlow/DynamicFlow.js +372 -0
- package/build/dynamicFlow/DynamicFlowStep.js +36 -0
- package/build/dynamicFlow/DynamicFlowTypes.js +8 -0
- package/build/dynamicFlow/index.js +16 -0
- package/build/dynamicFlow/stories/DynamicFlow.story.js +36 -0
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +67 -0
- package/build/dynamicFlow/stories/fixtureFetcher.js +118 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +47 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +15 -0
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +19 -0
- package/build/dynamicFlow/utils/index.js +23 -0
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +131 -0
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +27 -0
- package/build/dynamicFlow/utils/useDynamicFlowState.js +114 -0
- package/build/dynamicFlow/utils/useLoader.js +26 -0
- package/build/fixtures/components/alert.js +33 -0
- package/build/fixtures/components/box.js +22 -0
- package/build/fixtures/components/button.js +67 -0
- package/build/fixtures/components/columns.js +38 -0
- package/build/fixtures/components/copyable.js +24 -0
- package/build/fixtures/components/decision.js +56 -0
- package/build/fixtures/components/heading.js +16 -0
- package/build/fixtures/components/image.js +25 -0
- package/build/fixtures/components/index.js +40 -0
- package/build/fixtures/components/info.js +19 -0
- package/build/fixtures/components/list.js +36 -0
- package/build/fixtures/components/loading-indicator.js +18 -0
- package/build/fixtures/components/paragraph.js +30 -0
- package/build/fixtures/components/review.js +62 -0
- package/build/fixtures/examples/camera-capture.js +123 -0
- package/build/fixtures/examples/index.js +24 -0
- package/build/fixtures/examples/recipient-update.js +252 -0
- package/build/fixtures/examples/recipient.js +315 -0
- package/build/fixtures/examples/single-file-upload.js +100 -0
- package/build/fixtures/examples/step-validation-errors.js +77 -0
- package/build/fixtures/features/action-response.js +31 -0
- package/build/fixtures/features/external.js +33 -0
- package/build/fixtures/features/index.js +24 -0
- package/build/fixtures/features/persist-async.js +46 -0
- package/build/fixtures/features/polling.js +35 -0
- package/build/fixtures/features/validation-async.js +40 -0
- package/build/fixtures/index.js +49 -0
- package/build/fixtures/jsonSchemaForm/allOf.js +121 -0
- package/build/fixtures/jsonSchemaForm/audRecipient.js +1106 -0
- package/build/fixtures/jsonSchemaForm/currency.js +50 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +39 -0
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +38 -0
- package/build/fixtures/jsonSchemaForm/oneOf.js +121 -0
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +55 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +58 -0
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +104 -0
- package/build/fixtures/jsonSchemaForm/simple.js +50 -0
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +73 -0
- package/build/fixtures/jsonSchemaForm/validationAsync.js +25 -0
- package/build/fixtures/layouts/all.js +178 -0
- package/build/fixtures/layouts/final-step-layout.js +41 -0
- package/build/fixtures/layouts/index.js +26 -0
- package/build/fixtures/layouts/list.js +35 -0
- package/build/fixtures/layouts/pay-in.js +99 -0
- package/build/fixtures/layouts/review.js +162 -0
- package/build/fixtures/layouts/success.js +68 -0
- package/build/fixtures/responses/action-response-final.js +26 -0
- package/build/fixtures/responses/action.js +4 -0
- package/build/fixtures/responses/exit.js +4 -0
- package/build/fixtures/responses/index.js +22 -0
- package/build/fixtures/responses/recipient-update-final.js +26 -0
- package/build/fixtures/schemas/basic-form.js +41 -0
- package/build/fixtures/schemas/index.js +22 -0
- package/build/fixtures/schemas/number-and-integer.js +43 -0
- package/build/fixtures/schemas/one-of.js +225 -0
- package/build/fixtures/schemas/string-formats.js +64 -0
- package/build/fixtures/utils/image-util.js +22 -0
- package/build/formControl/FormControl.js +243 -0
- package/build/formControl/index.js +16 -0
- package/build/formControl/utils/index.js +17 -0
- package/build/formControl/utils/value-utils.js +116 -0
- package/build/i18n/index.js +36 -0
- package/build/index.d.ts +11 -0
- package/build/index.js +35 -0
- package/build/jsonSchemaForm/JsonSchemaForm.js +34 -0
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +59 -0
- package/build/jsonSchemaForm/allOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +30 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +31 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +145 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +20 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +16 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +18 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +90 -0
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +21 -0
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +16 -0
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +108 -0
- package/build/jsonSchemaForm/basicTypeSchema/index.js +16 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +84 -0
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +55 -0
- package/build/jsonSchemaForm/controlFeedback/index.js +16 -0
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +127 -0
- package/build/jsonSchemaForm/genericSchema/index.js +16 -0
- package/build/jsonSchemaForm/help/Help.js +14 -0
- package/build/jsonSchemaForm/help/Help.messages.js +10 -0
- package/build/jsonSchemaForm/help/index.js +16 -0
- package/build/jsonSchemaForm/index.js +16 -0
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +83 -0
- package/build/jsonSchemaForm/objectSchema/index.js +16 -0
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
- package/build/jsonSchemaForm/oneOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +13 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +18 -0
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +70 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +31 -0
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +10 -0
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +173 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +16 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +36 -0
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +16 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +77 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +16 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +12 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +29 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +36 -0
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +34 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +60 -0
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +15 -0
- package/build/jsonSchemaForm/readOnlySchema/index.js +16 -0
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +111 -0
- package/build/jsonSchemaForm/schemaFormControl/index.js +16 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +77 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +17 -0
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +127 -0
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +151 -0
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +16 -0
- package/build/layout/DynamicLayout.js +63 -0
- package/build/layout/alert/DynamicAlert.js +31 -0
- package/build/layout/box/DynamicBox.js +43 -0
- package/build/layout/button/DynamicButton.js +60 -0
- package/build/layout/columns/DynamicColumns.js +40 -0
- package/build/layout/decision/DynamicDecision.js +40 -0
- package/build/layout/divider/DynamicDivider.js +11 -0
- package/build/layout/external/DynamicExternal.js +37 -0
- package/build/layout/external/DynamicExternal.messages.js +10 -0
- package/build/layout/form/DynamicForm.js +27 -0
- package/build/layout/heading/DynamicHeading.js +33 -0
- package/build/layout/icon/DynamicIcon.js +50 -0
- package/build/layout/image/DynamicImage.js +112 -0
- package/build/layout/index.js +48 -0
- package/build/layout/info/DynamicInfo.js +21 -0
- package/build/layout/list/DynamicList.js +33 -0
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +13 -0
- package/build/layout/paragraph/DynamicParagraph.js +48 -0
- package/build/layout/paragraph/DynamicParagraph.messages.js +15 -0
- package/build/layout/paragraph/useSnackBarIfAvailable.js +13 -0
- package/build/layout/review/DynamicReview.js +35 -0
- package/build/layout/utils.js +35 -0
- package/build/step/cameraStep/CameraStep.js +130 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +127 -0
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +20 -0
- package/build/step/cameraStep/cameraCapture/components/index.js +36 -0
- package/build/step/cameraStep/cameraCapture/hooks/index.js +84 -0
- package/build/step/cameraStep/cameraCapture/index.js +16 -0
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +80 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +24 -0
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +15 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +26 -0
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +20 -0
- package/build/step/cameraStep/cameraCapture/screens/index.js +18 -0
- package/build/step/cameraStep/cameraCapture/tracking/index.js +104 -0
- package/build/step/cameraStep/cameraCapture/utils/index.js +114 -0
- package/build/step/cameraStep/index.js +16 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +69 -0
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +25 -0
- package/build/step/externalConfirmationStep/index.js +16 -0
- package/build/step/index.js +20 -0
- package/build/step/layoutStep/LayoutStep.js +35 -0
- package/build/step/layoutStep/index.js +16 -0
- package/build/step/layoutStep/utils/index.js +18 -0
- package/build/step/layoutStep/utils/inline-reference-utils.js +95 -0
- package/build/step/layoutStep/utils/layout-utils.js +222 -0
- package/build/types/common/FormControl.js +2 -0
- package/build/types/index.d.ts +15 -10
- package/build/types/index.js +42 -0
- package/build/types/specification/Action.js +2 -0
- package/build/types/specification/FileUploadSchema.js +8 -0
- package/build/types/specification/LayoutComponent.js +2 -0
- package/build/types/specification/Model.js +38 -0
- package/build/types/specification/PersistAsync.js +2 -0
- package/build/types/specification/Polling.js +2 -0
- package/build/types/specification/Promotion.js +2 -0
- package/build/types/specification/Schema.js +67 -0
- package/build/types/specification/Step.js +8 -0
- package/build/types/specification/ValidationAsync.js +2 -0
- package/build/types/specification/core.js +2 -0
- package/package.json +23 -24
- package/build/main.js +0 -6980
- package/build/main.min.js +0 -10
- package/build/types/types/index.d.ts +0 -15
- /package/build/{types/common → common}/constants/DateMode.d.ts +0 -0
- /package/build/{types/common → common}/constants/FormControlType.d.ts +0 -0
- /package/build/{types/common → common}/constants/MonthFormat.d.ts +0 -0
- /package/build/{types/common → common}/constants/SchemaType.d.ts +0 -0
- /package/build/{types/common → common}/constants/Size.d.ts +0 -0
- /package/build/{types/common → common}/constants/index.d.ts +0 -0
- /package/build/{types/common → common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
- /package/build/{types/common → common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
- /package/build/{types/common → common}/contexts/eventsContext/EventsContext.d.ts +0 -0
- /package/build/{types/common → common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
- /package/build/{types/common → common}/contexts/index.d.ts +0 -0
- /package/build/{types/common → common}/contexts/logContext/LogContext.d.ts +0 -0
- /package/build/{types/common → common}/hooks/index.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useExternal/useExternal.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePolling/usePolling.d.ts +0 -0
- /package/build/{types/common → common}/hooks/usePrevious/usePrevious.d.ts +0 -0
- /package/build/{types/common → common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
- /package/build/{types/common → common}/makeFetcher/index.d.ts +0 -0
- /package/build/{types/common → common}/makeFetcher/makeFetcher.d.ts +0 -0
- /package/build/{types/common → common}/messages.d.ts +0 -0
- /package/build/{types/common → common}/utils/api-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/date-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/debounce.d.ts +0 -0
- /package/build/{types/common → common}/utils/file-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/id-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/index.d.ts +0 -0
- /package/build/{types/common → common}/utils/is-equal.d.ts +0 -0
- /package/build/{types/common → common}/utils/schema-utils.d.ts +0 -0
- /package/build/{types/common → common}/utils/step-utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/index.d.ts +0 -0
- /package/build/{types/common → common}/validators/models/model-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/models/models.utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/schemas/schema-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/types/type-validators.d.ts +0 -0
- /package/build/{types/common → common}/validators/validationFailures/validation-failures.d.ts +0 -0
- /package/build/{types/common → common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
- /package/build/{types/common → common}/validators/values/value-validators.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlow.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowStep.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/index.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/index.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
- /package/build/{types/dynamicFlow → dynamicFlow}/utils/useLoader.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/alert.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/box.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/button.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/columns.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/copyable.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/decision.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/heading.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/image.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/info.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/list.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/loading-indicator.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/paragraph.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/components/review.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/camera-capture.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/recipient-update.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/recipient.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/single-file-upload.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/examples/step-validation-errors.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/action-response.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/external.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/persist-async.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/polling.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/features/validation-async.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/audRecipient.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/currency.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/multipleFileUploadBase64.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/multipleFileUploadBlob.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/oneOf.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/oneOfTabs.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/promotedOneOf.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/promotedOneOfCheckbox.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/simple.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/uploadPersistAsync.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/jsonSchemaForm/validationAsync.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/all.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/final-step-layout.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/list.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/pay-in.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/review.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/layouts/success.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/action-response-final.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/action.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/exit.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/responses/recipient-update-final.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/basic-form.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/index.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/number-and-integer.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/one-of.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/schemas/string-formats.d.ts +0 -0
- /package/build/{types/fixtures → fixtures}/utils/image-util.d.ts +0 -0
- /package/build/{types/formControl → formControl}/FormControl.d.ts +0 -0
- /package/build/{types/formControl → formControl}/index.d.ts +0 -0
- /package/build/{types/formControl → formControl}/utils/index.d.ts +0 -0
- /package/build/{types/formControl → formControl}/utils/value-utils.d.ts +0 -0
- /package/build/{types/i18n → i18n}/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
- /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
- /package/build/{types/layout → layout}/DynamicLayout.d.ts +0 -0
- /package/build/{types/layout → layout}/alert/DynamicAlert.d.ts +0 -0
- /package/build/{types/layout → layout}/box/DynamicBox.d.ts +0 -0
- /package/build/{types/layout → layout}/button/DynamicButton.d.ts +0 -0
- /package/build/{types/layout → layout}/columns/DynamicColumns.d.ts +0 -0
- /package/build/{types/layout → layout}/decision/DynamicDecision.d.ts +0 -0
- /package/build/{types/layout → layout}/divider/DynamicDivider.d.ts +0 -0
- /package/build/{types/layout → layout}/external/DynamicExternal.d.ts +0 -0
- /package/build/{types/layout → layout}/external/DynamicExternal.messages.d.ts +0 -0
- /package/build/{types/layout → layout}/form/DynamicForm.d.ts +0 -0
- /package/build/{types/layout → layout}/heading/DynamicHeading.d.ts +0 -0
- /package/build/{types/layout → layout}/icon/DynamicIcon.d.ts +0 -0
- /package/build/{types/layout → layout}/image/DynamicImage.d.ts +0 -0
- /package/build/{types/layout → layout}/index.d.ts +0 -0
- /package/build/{types/layout → layout}/info/DynamicInfo.d.ts +0 -0
- /package/build/{types/layout → layout}/list/DynamicList.d.ts +0 -0
- /package/build/{types/layout → layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/DynamicParagraph.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
- /package/build/{types/layout → layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
- /package/build/{types/layout → layout}/review/DynamicReview.d.ts +0 -0
- /package/build/{types/layout → layout}/utils.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/CameraStep.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
- /package/build/{types/step → step}/cameraStep/index.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
- /package/build/{types/step → step}/externalConfirmationStep/index.d.ts +0 -0
- /package/build/{types/step → step}/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/LayoutStep.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/index.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
- /package/build/{types/step → step}/layoutStep/utils/layout-utils.d.ts +0 -0
- /package/build/types/{types/common → common}/FormControl.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Action.d.ts +0 -0
- /package/build/types/{types/specification → specification}/FileUploadSchema.d.ts +0 -0
- /package/build/types/{types/specification → specification}/LayoutComponent.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Model.d.ts +0 -0
- /package/build/types/{types/specification → specification}/PersistAsync.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Polling.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Promotion.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Schema.d.ts +0 -0
- /package/build/types/{types/specification → specification}/Step.d.ts +0 -0
- /package/build/types/{types/specification → specification}/ValidationAsync.d.ts +0 -0
- /package/build/types/{types/specification → specification}/core.d.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var react_intl_1 = require("react-intl");
|
|
4
|
+
exports["default"] = (0, react_intl_1.defineMessages)({
|
|
5
|
+
copy: {
|
|
6
|
+
id: 'dynamicFlows.DynamicParagraph.copy',
|
|
7
|
+
defaultMessage: 'Copy',
|
|
8
|
+
description: 'Copy to clipboard button label.'
|
|
9
|
+
},
|
|
10
|
+
copied: {
|
|
11
|
+
id: 'dynamicFlows.DynamicParagraph.copied',
|
|
12
|
+
defaultMessage: 'Copied to clipboard',
|
|
13
|
+
description: 'Appears in a snackbar when the copy operation succeeds.'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.useSnackBarIfAvailable = void 0;
|
|
4
|
+
var components_1 = require("@transferwise/components");
|
|
5
|
+
var react_1 = require("react");
|
|
6
|
+
function useSnackBarIfAvailable() {
|
|
7
|
+
var context = (0, react_1.useContext)(components_1.SnackbarContext);
|
|
8
|
+
return context ? context.createSnackbar : noop;
|
|
9
|
+
}
|
|
10
|
+
exports.useSnackBarIfAvailable = useSnackBarIfAvailable;
|
|
11
|
+
function noop() {
|
|
12
|
+
//
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
exports.__esModule = true;
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
var components_1 = require("@transferwise/components");
|
|
16
|
+
var utils_1 = require("../utils");
|
|
17
|
+
var mapFieldsToDefinitions = function (_a, index) {
|
|
18
|
+
var label = _a.label, value = _a.value;
|
|
19
|
+
return { key: String(index), title: label, value: value };
|
|
20
|
+
};
|
|
21
|
+
var getReviewLayout = function (orientation) {
|
|
22
|
+
return orientation === 'horizontal' ? 'HORIZONTAL_RIGHT_ALIGNED' : 'VERTICAL_ONE_COLUMN';
|
|
23
|
+
};
|
|
24
|
+
var DynamicReview = function (props) {
|
|
25
|
+
var review = props.component;
|
|
26
|
+
var margin = (0, utils_1.getMarginBottom)(review.margin || 'xs');
|
|
27
|
+
var getReviewAction = function (action) {
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)("a", __assign({ href: action.url, className: "pull-right", role: "button", onClick: function (event) {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
props.onAction(action);
|
|
31
|
+
} }, { children: action.title })));
|
|
32
|
+
};
|
|
33
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [review.title && ((0, jsx_runtime_1.jsxs)("h6", __assign({ className: "m-b-2" }, { children: [review.title, review.action && getReviewAction(review.action)] }))), (0, jsx_runtime_1.jsx)("div", __assign({ className: margin }, { children: (0, jsx_runtime_1.jsx)(components_1.DefinitionList, { layout: getReviewLayout(review.orientation), definitions: review.fields.map(mapFieldsToDefinitions) }) }))] }));
|
|
34
|
+
};
|
|
35
|
+
exports["default"] = DynamicReview;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.getTextAlignmentAndMargin = exports.getMarginBottom = void 0;
|
|
4
|
+
var getMarginBottom = function (size) {
|
|
5
|
+
switch (size) {
|
|
6
|
+
case 'xs':
|
|
7
|
+
return 'm-b-0';
|
|
8
|
+
case 'sm':
|
|
9
|
+
return 'm-b-1';
|
|
10
|
+
case 'md':
|
|
11
|
+
return 'm-b-2';
|
|
12
|
+
case 'lg':
|
|
13
|
+
return 'm-b-3';
|
|
14
|
+
case 'xl':
|
|
15
|
+
return 'm-b-5';
|
|
16
|
+
default:
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.getMarginBottom = getMarginBottom;
|
|
21
|
+
var getTextAlignment = function (align) {
|
|
22
|
+
switch (align) {
|
|
23
|
+
case 'right':
|
|
24
|
+
return 'text-xs-right';
|
|
25
|
+
case 'center':
|
|
26
|
+
return 'text-xs-center';
|
|
27
|
+
case 'left':
|
|
28
|
+
default:
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
var getTextAlignmentAndMargin = function (component) {
|
|
33
|
+
return "".concat(getTextAlignment(component.align), " ").concat(getMarginBottom(component.margin));
|
|
34
|
+
};
|
|
35
|
+
exports.getTextAlignmentAndMargin = getTextAlignmentAndMargin;
|
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
exports.__esModule = true;
|
|
42
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
43
|
+
var react_1 = require("react");
|
|
44
|
+
var contexts_1 = require("../../common/contexts");
|
|
45
|
+
var utils_1 = require("../../common/utils");
|
|
46
|
+
var types_1 = require("../../types");
|
|
47
|
+
var cameraCapture_1 = __importDefault(require("./cameraCapture"));
|
|
48
|
+
function blobToBase64(blob) {
|
|
49
|
+
return new Promise(function (resolve, _) {
|
|
50
|
+
// we can safely assume the type of reader.result is string
|
|
51
|
+
// because we're calling reader.readAsDataURL
|
|
52
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
53
|
+
var reader = new FileReader();
|
|
54
|
+
// eslint-disable-next-line fp/no-mutation
|
|
55
|
+
reader.onloadend = function () { return resolve(reader.result); };
|
|
56
|
+
reader.readAsDataURL(blob);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
var CameraStep = function (props) {
|
|
60
|
+
var step = props.step, model = props.model, onModelChange = props.onModelChange, onAction = props.onAction;
|
|
61
|
+
var onEvent = (0, contexts_1.useEventDispatcher)();
|
|
62
|
+
var objectSchema = getObjectSchema(step);
|
|
63
|
+
var cameraSchema = getCameraSchema(step);
|
|
64
|
+
var action = getFirstAction(step);
|
|
65
|
+
var title = cameraSchema.title, image = cameraSchema.image, cameraConfig = cameraSchema.cameraConfig;
|
|
66
|
+
var _a = cameraConfig || {}, assets = _a.assets, direction = _a.direction, instructions = _a.instructions;
|
|
67
|
+
var _b = assets || {}, overlay = _b.overlay, outline = _b.outline;
|
|
68
|
+
var imageUrl = (image || {}).url;
|
|
69
|
+
var _c = (0, react_1.useState)(false), captureClicked = _c[0], setCaptureClicked = _c[1];
|
|
70
|
+
// We need to wait for model to update before we call onAction()
|
|
71
|
+
(0, react_1.useEffect)(function () {
|
|
72
|
+
if (captureClicked) {
|
|
73
|
+
onAction(action);
|
|
74
|
+
}
|
|
75
|
+
}, [model]);
|
|
76
|
+
var handleCapture = function (blob) { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
|
+
var $id, newValue, newModel;
|
|
78
|
+
var _a;
|
|
79
|
+
return __generator(this, function (_b) {
|
|
80
|
+
switch (_b.label) {
|
|
81
|
+
case 0:
|
|
82
|
+
$id = cameraSchema.$id;
|
|
83
|
+
if (!blob) return [3 /*break*/, 2];
|
|
84
|
+
return [4 /*yield*/, blobToBase64(blob)];
|
|
85
|
+
case 1:
|
|
86
|
+
newValue = _b.sent();
|
|
87
|
+
newModel = (_a = {}, _a[$id || ''] = newValue, _a);
|
|
88
|
+
setCaptureClicked(true);
|
|
89
|
+
onModelChange({
|
|
90
|
+
model: newModel,
|
|
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) {
|
|
101
|
+
void handleCapture(blob);
|
|
102
|
+
} }));
|
|
103
|
+
};
|
|
104
|
+
exports["default"] = CameraStep;
|
|
105
|
+
function getObjectSchema(step) {
|
|
106
|
+
var nonHiddenSchemas = (0, utils_1.filterHiddenSchemas)(step.schemas || []);
|
|
107
|
+
var objectSchema = nonHiddenSchemas[0];
|
|
108
|
+
if (!objectSchema || !(0, types_1.isObjectSchema)(objectSchema)) {
|
|
109
|
+
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
|
+
}
|
|
111
|
+
return objectSchema;
|
|
112
|
+
}
|
|
113
|
+
function getCameraSchema(step) {
|
|
114
|
+
var objectSchema = getObjectSchema(step);
|
|
115
|
+
var firstProperty = Object.values(objectSchema.properties)[0];
|
|
116
|
+
if (!firstProperty) {
|
|
117
|
+
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
|
+
}
|
|
119
|
+
return firstProperty;
|
|
120
|
+
}
|
|
121
|
+
function getFirstAction(step) {
|
|
122
|
+
var _a, _b;
|
|
123
|
+
if (!step.schemas || ((_a = (0, utils_1.filterHiddenSchemas)(step.schemas)) === null || _a === void 0 ? void 0 : _a.length) !== 1) {
|
|
124
|
+
throw new Error('camera step expects 1 non-hidden object schema');
|
|
125
|
+
}
|
|
126
|
+
if (((_b = step === null || step === void 0 ? void 0 : step.actions) === null || _b === void 0 ? void 0 : _b.length) !== 1) {
|
|
127
|
+
throw new Error('camera step expects 1 action');
|
|
128
|
+
}
|
|
129
|
+
return step.actions[0];
|
|
130
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
exports.__esModule = true;
|
|
53
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
54
|
+
var react_1 = require("react");
|
|
55
|
+
var react_intl_1 = require("react-intl");
|
|
56
|
+
var react_webcam_1 = __importDefault(require("react-webcam"));
|
|
57
|
+
var CameraCapture_messages_1 = __importDefault(require("./CameraCapture.messages"));
|
|
58
|
+
var components_1 = require("./components");
|
|
59
|
+
var hooks_1 = require("./hooks");
|
|
60
|
+
var Overlay_1 = __importDefault(require("./overlay/Overlay"));
|
|
61
|
+
var screens_1 = require("./screens");
|
|
62
|
+
var tracking_1 = require("./tracking");
|
|
63
|
+
var utils_1 = require("./utils");
|
|
64
|
+
var CameraCapture = function (_a) {
|
|
65
|
+
var _b = _a.direction, direction = _b === void 0 ? 'back' : _b, _c = _a.overlay, overlay = _c === void 0 ? '' : _c, _d = _a.outline, outline = _d === void 0 ? '' : _d, _e = _a.imageUrl, imageUrl = _e === void 0 ? '' : _e, _f = _a.title, title = _f === void 0 ? '' : _f, _g = _a.instructions, instructions = _g === void 0 ? '' : _g, _h = _a.showReview, showReview = _h === void 0 ? false : _h, onCapture = _a.onCapture, onEvent = _a.onEvent;
|
|
66
|
+
var _j = (0, react_1.useState)('CAPTURE'), mode = _j[0], setMode = _j[1];
|
|
67
|
+
var _k = (0, react_1.useState)(false), isVideoMirrored = _k[0], setIsVideoMirrored = _k[1];
|
|
68
|
+
var _l = (0, react_1.useState)(false), ready = _l[0], setReady = _l[1];
|
|
69
|
+
var _m = (0, react_1.useState)(), reviewImage = _m[0], setReviewImage = _m[1];
|
|
70
|
+
var webcamReference = (0, react_1.useRef)(null);
|
|
71
|
+
var videoConstraints = (0, hooks_1.useVideoConstraints)(direction).videoConstraints;
|
|
72
|
+
var intl = (0, react_intl_1.useIntl)();
|
|
73
|
+
var handleCapture = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var canvas;
|
|
75
|
+
var _a, _b, _c, _d, _e, _f;
|
|
76
|
+
return __generator(this, function (_g) {
|
|
77
|
+
switch (_g.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
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)) return [3 /*break*/, 2];
|
|
80
|
+
(_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();
|
|
81
|
+
return [4 /*yield*/, (0, utils_1.generateCanvasFromVideo)((_f = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _f === void 0 ? void 0 : _f.video)];
|
|
82
|
+
case 1:
|
|
83
|
+
canvas = _g.sent();
|
|
84
|
+
canvas === null || canvas === void 0 ? void 0 : canvas.toBlob(function (blob) {
|
|
85
|
+
if (blob) {
|
|
86
|
+
if (showReview) {
|
|
87
|
+
var source = window.URL.createObjectURL(blob);
|
|
88
|
+
setReviewImage({ source: source, blob: blob });
|
|
89
|
+
setMode('REVIEW');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
onCapture(blob);
|
|
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) {
|
|
102
|
+
if (error instanceof DOMException && (error === null || error === void 0 ? void 0 : error.name) === 'NotAllowedError') {
|
|
103
|
+
setMode('NO_CAMERA_ACCESS');
|
|
104
|
+
(0, tracking_1.trackCameraPermissionDenied)(onEvent);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
setMode('CAMERA_NOT_SUPPORTED');
|
|
108
|
+
(0, tracking_1.trackCameraNotSupported)(onEvent, error);
|
|
109
|
+
}, [setMode, onEvent]);
|
|
110
|
+
var handleUserMedia = (0, react_1.useCallback)(function (stream) {
|
|
111
|
+
setReady(true);
|
|
112
|
+
setIsVideoMirrored((0, utils_1.isSelfieCamera)(stream));
|
|
113
|
+
void (0, tracking_1.trackCameraFeedStarted)(onEvent, { direction: direction }, stream);
|
|
114
|
+
}, [setIsVideoMirrored, onEvent, direction]);
|
|
115
|
+
var handleReviewSubmit = function () {
|
|
116
|
+
onCapture((reviewImage === null || reviewImage === void 0 ? void 0 : reviewImage.blob) || null);
|
|
117
|
+
};
|
|
118
|
+
var handleReviewRetry = function () {
|
|
119
|
+
setMode('CAPTURE');
|
|
120
|
+
setReviewImage(undefined);
|
|
121
|
+
};
|
|
122
|
+
var handleRetryCameraAccess = function () { return setMode('CAPTURE'); };
|
|
123
|
+
var 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: function () { return void handleCapture(); } })] }));
|
|
124
|
+
var 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 })] }));
|
|
125
|
+
return ((0, jsx_runtime_1.jsxs)("section", __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
|
+
};
|
|
127
|
+
exports["default"] = CameraCapture;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var react_intl_1 = require("react-intl");
|
|
4
|
+
exports["default"] = (0, react_intl_1.defineMessages)({
|
|
5
|
+
reviewSubmit: {
|
|
6
|
+
id: 'dynamicFlows.CameraCapture.reviewSubmit',
|
|
7
|
+
defaultMessage: 'Yes, submit',
|
|
8
|
+
description: 'Accept and submit the image taken with the camera'
|
|
9
|
+
},
|
|
10
|
+
reviewRetry: {
|
|
11
|
+
id: 'dynamicFlows.CameraCapture.reviewRetry',
|
|
12
|
+
defaultMessage: 'No, try again',
|
|
13
|
+
description: "Image taken with camera is not good, don't submit, and retake the image"
|
|
14
|
+
},
|
|
15
|
+
reviewInstructions: {
|
|
16
|
+
id: 'dynamicFlows.CameraCapture.reviewInstructions',
|
|
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
|
+
}
|
|
20
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
exports.__esModule = true;
|
|
17
|
+
exports.ReviewBottomBar = exports.CaptureBottomBar = void 0;
|
|
18
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
var components_1 = require("@transferwise/components");
|
|
20
|
+
var react_intl_1 = require("react-intl");
|
|
21
|
+
var CameraCapture_messages_1 = __importDefault(require("../CameraCapture.messages"));
|
|
22
|
+
var CaptureBottomBar = function (_a) {
|
|
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
|
+
};
|
|
26
|
+
exports.CaptureBottomBar = CaptureBottomBar;
|
|
27
|
+
var ReviewBottomBar = function (_a) {
|
|
28
|
+
var onSubmit = _a.onSubmit, onRetry = _a.onRetry;
|
|
29
|
+
var intl = (0, react_intl_1.useIntl)();
|
|
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) }))] })) })) })));
|
|
31
|
+
};
|
|
32
|
+
exports.ReviewBottomBar = ReviewBottomBar;
|
|
33
|
+
var CaptureButton = function (_a) {
|
|
34
|
+
var onClick = _a.onClick;
|
|
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
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
exports.__esModule = true;
|
|
50
|
+
exports.useVideoConstraints = void 0;
|
|
51
|
+
var react_1 = require("react");
|
|
52
|
+
var utils_1 = require("../utils");
|
|
53
|
+
var useVideoConstraints = function (direction) {
|
|
54
|
+
var _a = (0, react_1.useState)(), videoConstraints = _a[0], setVideoConstraints = _a[1];
|
|
55
|
+
var defaultVideoConstraints = {
|
|
56
|
+
facingMode: direction === 'front' ? 'user' : 'environment',
|
|
57
|
+
height: { min: 480, max: 1080, ideal: 720 },
|
|
58
|
+
width: { min: 640, max: 1920, ideal: 1280 },
|
|
59
|
+
frameRate: 30,
|
|
60
|
+
aspectRatio: 16 / 9
|
|
61
|
+
};
|
|
62
|
+
(0, react_1.useEffect)(function () {
|
|
63
|
+
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
64
|
+
}, [direction]);
|
|
65
|
+
var getVideoConstraints = function (direction) { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var mainCamera;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
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];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}); };
|
|
82
|
+
return { videoConstraints: videoConstraints };
|
|
83
|
+
};
|
|
84
|
+
exports.useVideoConstraints = useVideoConstraints;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
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;
|
|
15
|
+
var CameraCapture_1 = require("./CameraCapture");
|
|
16
|
+
__createBinding(exports, CameraCapture_1, "default");
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
exports.__esModule = true;
|
|
14
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
15
|
+
/* eslint-disable fp/no-mutation */
|
|
16
|
+
var react_1 = require("react");
|
|
17
|
+
var debounce_1 = require("../../../../common/utils/debounce");
|
|
18
|
+
var captureButtonHeight = 92;
|
|
19
|
+
var reviewButtonsHeight = 120;
|
|
20
|
+
var imageHeight = 40;
|
|
21
|
+
var titleHeight = 32;
|
|
22
|
+
var instructionsHeight = 48;
|
|
23
|
+
var reviewInstructionsHeight = 40;
|
|
24
|
+
var overlayMaxWidth = 800;
|
|
25
|
+
var Overlay = function (_a) {
|
|
26
|
+
var overlay = _a.overlay, outline = _a.outline, imageUrl = _a.imageUrl, title = _a.title, instructions = _a.instructions, reviewInstructions = _a.reviewInstructions;
|
|
27
|
+
var svgReference = (0, react_1.useRef)(null);
|
|
28
|
+
/*
|
|
29
|
+
SVG doesn't always rerender when screen orientation changes,
|
|
30
|
+
so need to force rerender
|
|
31
|
+
*/
|
|
32
|
+
(0, react_1.useEffect)(function () {
|
|
33
|
+
var listener = (0, debounce_1.debounce)(function () {
|
|
34
|
+
var _a;
|
|
35
|
+
if ((_a = svgReference.current) === null || _a === void 0 ? void 0 : _a.innerHTML) {
|
|
36
|
+
var reference = svgReference.current;
|
|
37
|
+
reference.innerHTML += '';
|
|
38
|
+
}
|
|
39
|
+
}, 100);
|
|
40
|
+
window.addEventListener('resize', listener);
|
|
41
|
+
return function () { return window.removeEventListener('resize', listener); };
|
|
42
|
+
});
|
|
43
|
+
var helperBoxHeight = (imageUrl ? imageHeight : 0) +
|
|
44
|
+
(title ? titleHeight : 0) +
|
|
45
|
+
(instructions ? instructionsHeight : 0);
|
|
46
|
+
var helperBox = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [imageUrl && (0, jsx_runtime_1.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }), title && (0, jsx_runtime_1.jsx)("h4", __assign({ className: "camera-capture-title" }, { children: title })), instructions && (0, jsx_runtime_1.jsx)("small", __assign({ className: "camera-capture-instructions" }, { children: instructions }))] }));
|
|
47
|
+
var frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
48
|
+
/*
|
|
49
|
+
frameBottomMargin needs to stay the same for the review page so that
|
|
50
|
+
the overlay position does not change! Basically if it is the review step
|
|
51
|
+
and there is a 'reviewInstructions' specified, the overlay position stays
|
|
52
|
+
the same, but the helperBox height and content changes to adjust for the
|
|
53
|
+
large review buttons and smaller height required by 'reviewInstructionsHeight'
|
|
54
|
+
*/
|
|
55
|
+
if (reviewInstructions) {
|
|
56
|
+
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
57
|
+
helperBox = (0, jsx_runtime_1.jsx)("small", __assign({ className: "camera-capture-instructions" }, { children: reviewInstructions }));
|
|
58
|
+
var frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
59
|
+
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
60
|
+
helperBox = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
var framePosition = {
|
|
64
|
+
x: '50%',
|
|
65
|
+
y: '5%',
|
|
66
|
+
width: "min(90%, ".concat(overlayMaxWidth, "px)"),
|
|
67
|
+
height: "calc(90% - ".concat(frameBottomMargin, "px)"),
|
|
68
|
+
style: { transform: "translateX(max(-45%, -".concat(overlayMaxWidth / 2, "px))") }
|
|
69
|
+
};
|
|
70
|
+
var helperBoxPosition = {
|
|
71
|
+
style: {
|
|
72
|
+
left: '5%',
|
|
73
|
+
top: "calc(100% - ".concat(frameBottomMargin, "px - 5%)"),
|
|
74
|
+
height: "calc(".concat(helperBoxHeight, "px + 5%)"),
|
|
75
|
+
width: '90%'
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return ((0, jsx_runtime_1.jsxs)("svg", __assign({ ref: svgReference, xmlns: "http://www.w3.org/2000/svg" }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", __assign({ id: "mask" }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, jsx_runtime_1.jsx)("image", __assign({ href: overlay }, framePosition))] })) }), overlay && (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }), outline && (0, jsx_runtime_1.jsx)("image", __assign({ href: outline }, framePosition)), (0, jsx_runtime_1.jsx)("foreignObject", __assign({ width: "100%", height: "100%" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "camera-capture-text-and-image-container" }, helperBoxPosition, { children: helperBox })) }))] })));
|
|
79
|
+
};
|
|
80
|
+
exports["default"] = Overlay;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
exports.__esModule = true;
|
|
17
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
|
+
var react_intl_1 = require("react-intl");
|
|
19
|
+
var CameraNotSupported_messages_1 = __importDefault(require("./CameraNotSupported.messages"));
|
|
20
|
+
var CameraNotSupported = function () {
|
|
21
|
+
var intl = (0, react_intl_1.useIntl)();
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)("div", __assign({ id: "camera-not-supported" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "container p-t-5" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)("h2", __assign({ className: "text-xs-center m-b-3" }, { children: intl.formatMessage(CameraNotSupported_messages_1["default"].title) })), (0, jsx_runtime_1.jsx)("p", __assign({ className: "text-xs-center m-b-5" }, { children: intl.formatMessage(CameraNotSupported_messages_1["default"].paragraph) }))] })) })) })) })));
|
|
23
|
+
};
|
|
24
|
+
exports["default"] = CameraNotSupported;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var react_intl_1 = require("react-intl");
|
|
4
|
+
exports["default"] = (0, react_intl_1.defineMessages)({
|
|
5
|
+
title: {
|
|
6
|
+
id: 'dynamicFlows.CameraCapture.CameraNotSupported.title',
|
|
7
|
+
defaultMessage: 'Camera not supported',
|
|
8
|
+
description: 'Title of standalone page prompting that camera is not available on users browser'
|
|
9
|
+
},
|
|
10
|
+
paragraph: {
|
|
11
|
+
id: 'dynamicFlows.CameraCapture.CameraNotSupported.paragraph',
|
|
12
|
+
defaultMessage: "The browser you're using doesn't have support for a camera. Try a different browser, device, or download our mobile app.",
|
|
13
|
+
description: "Further text of standalone page prompting that camera is not available on user's browser"
|
|
14
|
+
}
|
|
15
|
+
});
|