@wise/dynamic-flow-client 0.1.4 → 0.3.0-beta-d45b31.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +53 -48
- package/build/common/api/utils.d.ts +0 -4
- package/build/common/api/utils.js +0 -13
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.d.ts +0 -11
- package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.js +0 -36
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.d.ts +0 -4
- package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.js +0 -13
- package/build/common/contexts/fetcherContext/fetcherContext.d.ts +0 -18
- package/build/common/contexts/fetcherContext/fetcherContext.js +0 -35
- package/build/common/contexts/fetcherContext/index.d.ts +0 -2
- package/build/common/contexts/fetcherContext/index.js +0 -2
- package/build/common/contexts/fetcherContext/makeFetcher.d.ts +0 -2
- package/build/common/contexts/fetcherContext/makeFetcher.js +0 -33
- package/build/common/general/index.d.ts +0 -2
- package/build/common/general/index.js +0 -22
- package/build/common/hooks/useDebouncedFunction.d.ts +0 -2
- package/build/common/hooks/useDebouncedFunction.js +0 -9
- package/build/common/hooks/useDebouncedFunction.test.d.ts +0 -1
- package/build/common/hooks/useDebouncedFunction.test.js +0 -59
- package/build/common/hooks/usePersistAsync.d.ts +0 -7
- package/build/common/hooks/usePersistAsync.js +0 -170
- package/build/common/hooks/usePolling.d.ts +0 -11
- package/build/common/hooks/usePolling.js +0 -48
- package/build/common/hooks/usePrevious.d.ts +0 -2
- package/build/common/hooks/usePrevious.js +0 -9
- package/build/common/index.d.ts +0 -4
- package/build/common/index.js +0 -4
- package/build/common/logging/index.d.ts +0 -22
- package/build/common/logging/index.js +0 -39
- package/build/common/logging/spec.d.ts +0 -1
- package/build/common/logging/spec.js +0 -45
- package/build/common/messages.d.ts +0 -8
- package/build/common/messages.js +0 -8
- package/build/common/propsValues/dateMode.d.ts +0 -4
- package/build/common/propsValues/dateMode.js +0 -4
- package/build/common/propsValues/formControlType.d.ts +0 -17
- package/build/common/propsValues/formControlType.js +0 -17
- package/build/common/propsValues/monthFormat.d.ts +0 -4
- package/build/common/propsValues/monthFormat.js +0 -4
- package/build/common/propsValues/size.d.ts +0 -7
- package/build/common/propsValues/size.js +0 -7
- package/build/common/requirements.d.ts +0 -10
- package/build/common/requirements.js +0 -50
- package/build/common/schemaTypes/schemaTypes.d.ts +0 -23
- package/build/common/schemaTypes/schemaTypes.js +0 -53
- package/build/common/schemaTypes/shouldDebounceSchema.d.ts +0 -2
- package/build/common/schemaTypes/shouldDebounceSchema.js +0 -6
- package/build/common/stepTypes/stepTypes.d.ts +0 -7
- package/build/common/stepTypes/stepTypes.js +0 -42
- package/build/common/tracking/index.d.ts +0 -15
- package/build/common/tracking/index.js +0 -33
- package/build/common/tracking/spec.d.ts +0 -1
- package/build/common/tracking/spec.js +0 -49
- package/build/common/utils/file-utils.d.ts +0 -4
- package/build/common/utils/file-utils.js +0 -45
- package/build/common/utils/generate-random-id.d.ts +0 -1
- package/build/common/utils/generate-random-id.js +0 -5
- package/build/common/utils/generate-random-id.test.d.ts +0 -1
- package/build/common/utils/generate-random-id.test.js +0 -12
- package/build/common/validation/rule-validators/index.d.ts +0 -10
- package/build/common/validation/rule-validators/index.js +0 -40
- package/build/common/validation/rule-validators/spec.d.ts +0 -1
- package/build/common/validation/rule-validators/spec.js +0 -145
- package/build/common/validation/schema-validators/index.d.ts +0 -9
- package/build/common/validation/schema-validators/index.js +0 -98
- package/build/common/validation/schema-validators/spec.d.ts +0 -1
- package/build/common/validation/schema-validators/spec.js +0 -137
- package/build/common/validation/valid-model/index.d.ts +0 -5
- package/build/common/validation/valid-model/index.js +0 -64
- package/build/common/validation/valid-model/spec.d.ts +0 -1
- package/build/common/validation/valid-model/spec.js +0 -605
- package/build/common/validation/valid-model/utils.d.ts +0 -11
- package/build/common/validation/valid-model/utils.js +0 -118
- package/build/common/validation/validation-failures/index.d.ts +0 -23
- package/build/common/validation/validation-failures/index.js +0 -140
- package/build/common/validation/validation-failures/spec.d.ts +0 -1
- package/build/common/validation/validation-failures/spec.js +0 -185
- package/build/dynamic-flow-types/Action.d.ts +0 -19
- package/build/dynamic-flow-types/Action.js +0 -1
- package/build/dynamic-flow-types/FileUploadSchema.d.ts +0 -23
- package/build/dynamic-flow-types/FileUploadSchema.js +0 -3
- package/build/dynamic-flow-types/LayoutComponent.d.ts +0 -129
- package/build/dynamic-flow-types/LayoutComponent.js +0 -1
- package/build/dynamic-flow-types/Model.d.ts +0 -12
- package/build/dynamic-flow-types/Model.js +0 -28
- package/build/dynamic-flow-types/PersistAsync.d.ts +0 -8
- package/build/dynamic-flow-types/PersistAsync.js +0 -1
- package/build/dynamic-flow-types/Polling.d.ts +0 -12
- package/build/dynamic-flow-types/Polling.js +0 -1
- package/build/dynamic-flow-types/Promotion.d.ts +0 -20
- package/build/dynamic-flow-types/Promotion.js +0 -1
- package/build/dynamic-flow-types/Schema.d.ts +0 -184
- package/build/dynamic-flow-types/Schema.js +0 -49
- package/build/dynamic-flow-types/Step.d.ts +0 -127
- package/build/dynamic-flow-types/Step.js +0 -4
- package/build/dynamic-flow-types/ValidationAsync.d.ts +0 -6
- package/build/dynamic-flow-types/ValidationAsync.js +0 -1
- package/build/dynamic-flow-types/core.d.ts +0 -29
- package/build/dynamic-flow-types/core.js +0 -1
- package/build/dynamic-flow-types/index.d.ts +0 -14
- package/build/dynamic-flow-types/index.js +0 -12
- package/build/field/Field.d.ts +0 -69
- package/build/field/Field.js +0 -311
- package/build/field/index.d.ts +0 -2
- package/build/field/index.js +0 -2
- package/build/flow/DynamicFlow.d.ts +0 -4
- package/build/flow/DynamicFlow.js +0 -368
- package/build/flow/DynamicFlowStep.d.ts +0 -9
- package/build/flow/DynamicFlowStep.js +0 -32
- package/build/flow/errorBoundary/ErrorBoundary.d.ts +0 -20
- package/build/flow/errorBoundary/ErrorBoundary.js +0 -45
- package/build/flow/errorBoundary/ErrorBoundary.messages.d.ts +0 -13
- package/build/flow/errorBoundary/ErrorBoundary.messages.js +0 -13
- package/build/flow/errorBoundary/ErrorBoundaryAlert.d.ts +0 -6
- package/build/flow/errorBoundary/ErrorBoundaryAlert.js +0 -12
- package/build/flow/errorBoundary/index.d.ts +0 -1
- package/build/flow/errorBoundary/index.js +0 -1
- package/build/flow/fixtures/components/alert.d.ts +0 -3
- package/build/flow/fixtures/components/alert.js +0 -31
- package/build/flow/fixtures/components/box.d.ts +0 -3
- package/build/flow/fixtures/components/box.js +0 -20
- package/build/flow/fixtures/components/button.d.ts +0 -3
- package/build/flow/fixtures/components/button.js +0 -65
- package/build/flow/fixtures/components/columns.d.ts +0 -3
- package/build/flow/fixtures/components/columns.js +0 -36
- package/build/flow/fixtures/components/copyable.d.ts +0 -3
- package/build/flow/fixtures/components/copyable.js +0 -22
- package/build/flow/fixtures/components/decision.d.ts +0 -3
- package/build/flow/fixtures/components/decision.js +0 -54
- package/build/flow/fixtures/components/heading.d.ts +0 -3
- package/build/flow/fixtures/components/heading.js +0 -14
- package/build/flow/fixtures/components/image.d.ts +0 -3
- package/build/flow/fixtures/components/image.js +0 -22
- package/build/flow/fixtures/components/info.d.ts +0 -3
- package/build/flow/fixtures/components/info.js +0 -17
- package/build/flow/fixtures/components/list.d.ts +0 -3
- package/build/flow/fixtures/components/list.js +0 -34
- package/build/flow/fixtures/components/loading-indicator.d.ts +0 -3
- package/build/flow/fixtures/components/loading-indicator.js +0 -16
- package/build/flow/fixtures/components/paragraph.d.ts +0 -3
- package/build/flow/fixtures/components/paragraph.js +0 -28
- package/build/flow/fixtures/components/review.d.ts +0 -3
- package/build/flow/fixtures/components/review.js +0 -60
- package/build/flow/fixtures/examples/camera-capture.d.ts +0 -3
- package/build/flow/fixtures/examples/camera-capture.js +0 -121
- package/build/flow/fixtures/examples/recipient-update.d.ts +0 -3
- package/build/flow/fixtures/examples/recipient-update.js +0 -250
- package/build/flow/fixtures/examples/recipient.d.ts +0 -3
- package/build/flow/fixtures/examples/recipient.js +0 -313
- package/build/flow/fixtures/examples/single-file-upload.d.ts +0 -3
- package/build/flow/fixtures/examples/single-file-upload.js +0 -96
- package/build/flow/fixtures/examples/step-validation-errors.d.ts +0 -3
- package/build/flow/fixtures/examples/step-validation-errors.js +0 -75
- package/build/flow/fixtures/features/action-response.d.ts +0 -3
- package/build/flow/fixtures/features/action-response.js +0 -29
- package/build/flow/fixtures/features/external.d.ts +0 -3
- package/build/flow/fixtures/features/external.js +0 -31
- package/build/flow/fixtures/features/persist-async.d.ts +0 -3
- package/build/flow/fixtures/features/persist-async.js +0 -44
- package/build/flow/fixtures/features/polling.d.ts +0 -3
- package/build/flow/fixtures/features/polling.js +0 -33
- package/build/flow/fixtures/index.d.ts +0 -42
- package/build/flow/fixtures/index.js +0 -66
- package/build/flow/fixtures/responses/action-response-final.d.ts +0 -3
- package/build/flow/fixtures/responses/action-response-final.js +0 -24
- package/build/flow/fixtures/responses/action.d.ts +0 -5
- package/build/flow/fixtures/responses/action.js +0 -2
- package/build/flow/fixtures/responses/exit.d.ts +0 -6
- package/build/flow/fixtures/responses/exit.js +0 -2
- package/build/flow/fixtures/responses/recipient-update-final.d.ts +0 -3
- package/build/flow/fixtures/responses/recipient-update-final.js +0 -24
- package/build/flow/fixtures/schemas/basic-form.d.ts +0 -3
- package/build/flow/fixtures/schemas/basic-form.js +0 -39
- package/build/flow/fixtures/schemas/number-and-integer.d.ts +0 -3
- package/build/flow/fixtures/schemas/number-and-integer.js +0 -41
- package/build/flow/fixtures/schemas/one-of.d.ts +0 -3
- package/build/flow/fixtures/schemas/one-of.js +0 -223
- package/build/flow/fixtures/schemas/string-formats.d.ts +0 -3
- package/build/flow/fixtures/schemas/string-formats.js +0 -58
- package/build/flow/index.d.ts +0 -1
- package/build/flow/index.js +0 -1
- package/build/flow/response-parsers/index.d.ts +0 -17
- package/build/flow/response-parsers/index.js +0 -112
- package/build/flow/response-parsers/spec.d.ts +0 -1
- package/build/flow/response-parsers/spec.js +0 -263
- package/build/flow/stories/EditableDynamicFlow.d.ts +0 -5
- package/build/flow/stories/EditableDynamicFlow.js +0 -61
- package/build/flow/types.d.ts +0 -77
- package/build/flow/types.js +0 -3
- package/build/flow/useDebouncedRefresh/index.d.ts +0 -1
- package/build/flow/useDebouncedRefresh/index.js +0 -1
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -5
- package/build/flow/useDebouncedRefresh/useDebouncedRefresh.js +0 -24
- package/build/flow/useDynamicFlowState.d.ts +0 -18
- package/build/flow/useDynamicFlowState.js +0 -111
- package/build/flow/useLoader.d.ts +0 -9
- package/build/flow/useLoader.js +0 -22
- package/build/formControl/FormControl.d.ts +0 -86
- package/build/formControl/FormControl.js +0 -241
- package/build/formControl/index.d.ts +0 -1
- package/build/formControl/index.js +0 -1
- package/build/formControl/types.d.ts +0 -57
- package/build/formControl/types.js +0 -1
- package/build/formControl/value-utils.d.ts +0 -9
- package/build/formControl/value-utils.js +0 -108
- package/build/i18n/cs.json +0 -8
- package/build/i18n/de.json +0 -34
- package/build/i18n/en.json +0 -38
- package/build/i18n/es.json +0 -34
- package/build/i18n/fr.json +0 -34
- package/build/i18n/hu.json +0 -34
- package/build/i18n/id.json +0 -34
- package/build/i18n/index.d.ts +0 -2
- package/build/i18n/index.js +0 -31
- package/build/i18n/it.json +0 -34
- package/build/i18n/ja.json +0 -34
- package/build/i18n/pl.json +0 -11
- package/build/i18n/pt.json +0 -34
- package/build/i18n/ro.json +0 -34
- package/build/i18n/ru.json +0 -34
- package/build/i18n/th.json +0 -34
- package/build/i18n/tr.json +0 -11
- package/build/i18n/uk.json +0 -8
- package/build/i18n/zh-CN.json +0 -34
- package/build/i18n/zh.json +0 -34
- package/build/index.d.ts +0 -12
- package/build/index.js +0 -11
- package/build/jsonSchemaForm/JsonSchemaForm.d.ts +0 -66
- package/build/jsonSchemaForm/JsonSchemaForm.js +0 -31
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +0 -14
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +0 -54
- package/build/jsonSchemaForm/allOfSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/allOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +0 -15
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +0 -25
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -16
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +0 -26
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.d.ts +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -18
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +0 -141
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -24
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +0 -18
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +0 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.d.ts +0 -9
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.js +0 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.d.ts +0 -6
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.js +0 -85
- package/build/jsonSchemaForm/arrayTypeSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +0 -1
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +0 -22
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +0 -105
- package/build/jsonSchemaForm/basicTypeSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/basicTypeSchema/index.js +0 -1
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +0 -31
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +0 -79
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts +0 -53
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +0 -53
- package/build/jsonSchemaForm/controlFeedback/index.d.ts +0 -1
- package/build/jsonSchemaForm/controlFeedback/index.js +0 -1
- package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +0 -19
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +0 -122
- package/build/jsonSchemaForm/genericSchema/index.d.ts +0 -1
- package/build/jsonSchemaForm/genericSchema/index.js +0 -1
- package/build/jsonSchemaForm/help/Help.d.ts +0 -8
- package/build/jsonSchemaForm/help/Help.js +0 -9
- package/build/jsonSchemaForm/help/Help.messages.d.ts +0 -8
- package/build/jsonSchemaForm/help/Help.messages.js +0 -8
- package/build/jsonSchemaForm/help/index.d.ts +0 -1
- package/build/jsonSchemaForm/help/index.js +0 -1
- package/build/jsonSchemaForm/index.d.ts +0 -1
- package/build/jsonSchemaForm/index.js +0 -1
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +0 -16
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +0 -78
- package/build/jsonSchemaForm/objectSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/objectSchema/index.js +0 -1
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +0 -15
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +0 -153
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.d.ts +0 -3
- package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.js +0 -40
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.d.ts +0 -2
- package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.js +0 -27
- package/build/jsonSchemaForm/oneOfSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/oneOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.d.ts +0 -3
- package/build/jsonSchemaForm/oneOfSchema/isConstSchema.js +0 -7
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -16
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +0 -26
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +0 -8
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.d.ts +0 -21
- package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.js +0 -168
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.d.ts +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/basic/index.js +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.d.ts +0 -20
- package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.js +0 -127
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.d.ts +0 -17
- package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.js +0 -32
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.d.ts +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/blob/index.js +0 -1
- package/build/jsonSchemaForm/persistAsyncSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +0 -1
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -9
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +0 -72
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.d.ts +0 -2
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.js +0 -8
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.d.ts +0 -7
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.js +0 -27
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.d.ts +0 -23
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.js +0 -31
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.d.ts +0 -9
- package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.js +0 -32
- package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +0 -1
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +0 -8
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +0 -55
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -16
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +0 -13
- package/build/jsonSchemaForm/readOnlySchema/index.d.ts +0 -1
- package/build/jsonSchemaForm/readOnlySchema/index.js +0 -1
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +0 -25
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +0 -106
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.d.ts +0 -3
- package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.js +0 -73
- package/build/jsonSchemaForm/schemaFormControl/index.d.ts +0 -1
- package/build/jsonSchemaForm/schemaFormControl/index.js +0 -1
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.d.ts +0 -40
- package/build/jsonSchemaForm/schemaFormControl/optionMapper.js +0 -89
- package/build/jsonSchemaForm/schemas/allOf.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/allOf.json.js +0 -119
- package/build/jsonSchemaForm/schemas/audRecipient.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/audRecipient.json.js +0 -1104
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.js +0 -37
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.js +0 -36
- package/build/jsonSchemaForm/schemas/currency.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/currency.json.js +0 -48
- package/build/jsonSchemaForm/schemas/oneOf.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/oneOf.json.js +0 -119
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/oneOfTabs.json.js +0 -53
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/promotedOneOf.json.js +0 -56
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.js +0 -102
- package/build/jsonSchemaForm/schemas/simple.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/simple.json.js +0 -48
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.js +0 -71
- package/build/jsonSchemaForm/schemas/validationAsync.json.d.ts +0 -3
- package/build/jsonSchemaForm/schemas/validationAsync.json.js +0 -23
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -17
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +0 -149
- package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +0 -2
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +0 -1
- package/build/layout/DynamicLayout.d.ts +0 -17
- package/build/layout/DynamicLayout.js +0 -75
- package/build/layout/alert/index.d.ts +0 -6
- package/build/layout/alert/index.js +0 -29
- package/build/layout/box/index.d.ts +0 -8
- package/build/layout/box/index.js +0 -41
- package/build/layout/button/index.d.ts +0 -8
- package/build/layout/button/index.js +0 -58
- package/build/layout/columns/index.d.ts +0 -8
- package/build/layout/columns/index.js +0 -38
- package/build/layout/decision/index.d.ts +0 -9
- package/build/layout/decision/index.js +0 -38
- package/build/layout/divider/index.d.ts +0 -7
- package/build/layout/divider/index.js +0 -9
- package/build/layout/external/DynamicExternal.d.ts +0 -8
- package/build/layout/external/DynamicExternal.js +0 -30
- package/build/layout/external/DynamicExternal.messages.d.ts +0 -8
- package/build/layout/external/DynamicExternal.messages.js +0 -8
- package/build/layout/external/index.d.ts +0 -1
- package/build/layout/external/index.js +0 -1
- package/build/layout/external/useExternalStepPolling.d.ts +0 -11
- package/build/layout/external/useExternalStepPolling.js +0 -68
- package/build/layout/form/index.d.ts +0 -8
- package/build/layout/form/index.js +0 -22
- package/build/layout/heading/index.d.ts +0 -6
- package/build/layout/heading/index.js +0 -31
- package/build/layout/icon/index.d.ts +0 -7
- package/build/layout/icon/index.js +0 -22
- package/build/layout/image/index.d.ts +0 -6
- package/build/layout/image/index.js +0 -126
- package/build/layout/index.d.ts +0 -1
- package/build/layout/index.js +0 -1
- package/build/layout/info/index.d.ts +0 -7
- package/build/layout/info/index.js +0 -19
- package/build/layout/layouts/all.json.d.ts +0 -3
- package/build/layout/layouts/all.json.js +0 -176
- package/build/layout/layouts/final-step-layout.json.d.ts +0 -3
- package/build/layout/layouts/final-step-layout.json.js +0 -39
- package/build/layout/layouts/finalStep.json.d.ts +0 -3
- package/build/layout/layouts/finalStep.json.js +0 -24
- package/build/layout/layouts/list.json.d.ts +0 -3
- package/build/layout/layouts/list.json.js +0 -33
- package/build/layout/layouts/pay-in.json.d.ts +0 -3
- package/build/layout/layouts/pay-in.json.js +0 -97
- package/build/layout/layouts/review.json.d.ts +0 -3
- package/build/layout/layouts/review.json.js +0 -160
- package/build/layout/layouts/success.json.d.ts +0 -3
- package/build/layout/layouts/success.json.js +0 -66
- package/build/layout/list/index.d.ts +0 -8
- package/build/layout/list/index.js +0 -30
- package/build/layout/loading-indicator/index.d.ts +0 -7
- package/build/layout/loading-indicator/index.js +0 -10
- package/build/layout/loading-indicator/spec.d.ts +0 -1
- package/build/layout/loading-indicator/spec.js +0 -11
- package/build/layout/paragraph/DynamicParagraph.d.ts +0 -7
- package/build/layout/paragraph/DynamicParagraph.js +0 -42
- package/build/layout/paragraph/DynamicParagraph.messages.d.ts +0 -13
- package/build/layout/paragraph/DynamicParagraph.messages.js +0 -13
- package/build/layout/paragraph/index.d.ts +0 -1
- package/build/layout/paragraph/index.js +0 -1
- package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +0 -10
- package/build/layout/paragraph/useSnackBarIfAvailable.js +0 -9
- package/build/layout/review/index.d.ts +0 -9
- package/build/layout/review/index.js +0 -33
- package/build/layout/utils.d.ts +0 -7
- package/build/layout/utils.js +0 -31
- package/build/main.css +0 -143
- package/build/schema.d.ts +0 -1
- package/build/schema.js +0 -1
- package/build/step/cameraStep/CameraStep.d.ts +0 -8
- package/build/step/cameraStep/CameraStep.js +0 -125
- package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +0 -16
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +0 -122
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -18
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +0 -18
- package/build/step/cameraStep/cameraCapture/components/index.d.ts +0 -8
- package/build/step/cameraStep/cameraCapture/components/index.js +0 -28
- package/build/step/cameraStep/cameraCapture/hooks/index.d.ts +0 -4
- package/build/step/cameraStep/cameraCapture/hooks/index.js +0 -80
- package/build/step/cameraStep/cameraCapture/index.d.ts +0 -1
- package/build/step/cameraStep/cameraCapture/index.js +0 -1
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -11
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +0 -78
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -3
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +0 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -13
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +0 -13
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -6
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +0 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -18
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +0 -18
- package/build/step/cameraStep/cameraCapture/screens/index.d.ts +0 -2
- package/build/step/cameraStep/cameraCapture/screens/index.js +0 -2
- package/build/step/cameraStep/cameraCapture/tracking/index.d.ts +0 -7
- package/build/step/cameraStep/cameraCapture/tracking/index.js +0 -101
- package/build/step/cameraStep/cameraCapture/utils/index.d.ts +0 -8
- package/build/step/cameraStep/cameraCapture/utils/index.js +0 -103
- package/build/step/cameraStep/index.d.ts +0 -1
- package/build/step/cameraStep/index.js +0 -1
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -7
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +0 -64
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -23
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +0 -23
- package/build/step/externalConfirmationStep/index.d.ts +0 -1
- package/build/step/externalConfirmationStep/index.js +0 -1
- package/build/step/features/external/useExternal.d.ts +0 -4
- package/build/step/features/external/useExternal.js +0 -15
- package/build/step/features/index.d.ts +0 -2
- package/build/step/features/index.js +0 -2
- package/build/step/features/polling/useStepPolling.d.ts +0 -2
- package/build/step/features/polling/useStepPolling.js +0 -44
- package/build/step/index.d.ts +0 -3
- package/build/step/index.js +0 -3
- package/build/step/layoutStep/LayoutStep.d.ts +0 -11
- package/build/step/layoutStep/LayoutStep.js +0 -34
- package/build/step/layoutStep/index.d.ts +0 -1
- package/build/step/layoutStep/index.js +0 -1
- package/build/step/layoutStep/layoutService/convertStepToLayout.d.ts +0 -8
- package/build/step/layoutStep/layoutService/convertStepToLayout.js +0 -217
- package/build/step/layoutStep/layoutService/index.d.ts +0 -2
- package/build/step/layoutStep/layoutService/index.js +0 -2
- package/build/step/layoutStep/layoutService/inlineReferences.d.ts +0 -7
- package/build/step/layoutStep/layoutService/inlineReferences.js +0 -91
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This is the Dynamic Flow web client. It provides a simple way to integrate a Dynamic Flow into your web app.
|
|
4
4
|
|
|
5
|
+
⚡ Access the latest deployed version of the [Dynamic Flow Playground](https://main--641de2ace0e1566a6a450fad.chromatic.com).
|
|
6
|
+
|
|
5
7
|
## Integration
|
|
6
8
|
|
|
7
9
|
1. Install `@wise/dynamic-flow-client`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-beta-d45b31.38",
|
|
4
4
|
"description": "Wise Dynamic Flow web client",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -16,11 +16,31 @@
|
|
|
16
16
|
"fullname": "transferwise/neptune-web",
|
|
17
17
|
"url": "git+https://github.com/transferwise/neptune-web.git"
|
|
18
18
|
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "start-storybook -p 3003",
|
|
21
|
+
"build": "npm-run-all build:*",
|
|
22
|
+
"build:ts": "tsc --build ./tsconfig.build.json",
|
|
23
|
+
"build:css": "postcss src/main.css -o build/main.css",
|
|
24
|
+
"build:messages-source": "formatjs extract 'src/**/*.messages.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
|
|
25
|
+
"build:compiled-messages": "cpx 'src/i18n/*.json' build/i18n",
|
|
26
|
+
"test": "npm-run-all test:once test:tz",
|
|
27
|
+
"test:once": "jest --config jest.config.js --env=jsdom",
|
|
28
|
+
"test:coverage": "jest --config jest.config.js --env=jsdom --coverage",
|
|
29
|
+
"test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
|
|
30
|
+
"test:watch": "pnpm test:once --watch",
|
|
31
|
+
"lint": "npm-run-all lint:ts lint:css",
|
|
32
|
+
"lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
|
|
33
|
+
"lint:css": "stylelint --allow-empty-input './src/**/*.less'",
|
|
34
|
+
"build-storybook": "build-storybook -c .storybook"
|
|
35
|
+
},
|
|
19
36
|
"devDependencies": {
|
|
20
37
|
"@babel/core": "7.20.12",
|
|
38
|
+
"@babel/plugin-syntax-flow": "7.18.6",
|
|
39
|
+
"@babel/plugin-transform-react-jsx": "7.21.0",
|
|
21
40
|
"@babel/preset-env": "7.20.2",
|
|
22
|
-
"@babel/preset-react": "
|
|
23
|
-
"@babel/preset-typescript": "
|
|
41
|
+
"@babel/preset-react": "7.18.6",
|
|
42
|
+
"@babel/preset-typescript": "7.21.0",
|
|
43
|
+
"@cfaester/enzyme-adapter-react-18": "0.7.0",
|
|
24
44
|
"@formatjs/cli": "^4.8.3",
|
|
25
45
|
"@storybook/addon-a11y": "6.5.16",
|
|
26
46
|
"@storybook/addon-actions": "6.5.16",
|
|
@@ -31,61 +51,61 @@
|
|
|
31
51
|
"@storybook/manager-webpack5": "6.5.16",
|
|
32
52
|
"@storybook/react": "6.5.16",
|
|
33
53
|
"@storybook/testing-library": "0.0.13",
|
|
34
|
-
"@testing-library/dom": "
|
|
35
|
-
"@testing-library/jest-dom": "5.
|
|
36
|
-
"@testing-library/react
|
|
37
|
-
"@testing-library/react": "
|
|
54
|
+
"@testing-library/dom": "9.2.0",
|
|
55
|
+
"@testing-library/jest-dom": "5.16.5",
|
|
56
|
+
"@testing-library/react": "14.0.0",
|
|
57
|
+
"@testing-library/react-hooks": "8.0.1",
|
|
38
58
|
"@testing-library/user-event": "13.2.1",
|
|
39
|
-
"@transferwise/components": "
|
|
40
|
-
"@transferwise/eslint-config": "
|
|
59
|
+
"@transferwise/components": "43.13.49",
|
|
60
|
+
"@transferwise/eslint-config": "8.0.1",
|
|
41
61
|
"@transferwise/formatting": "^2.10.0",
|
|
42
|
-
"@transferwise/icons": "
|
|
43
|
-
"@transferwise/neptune-css": "
|
|
44
|
-
"@transferwise/neptune-tokens": "
|
|
62
|
+
"@transferwise/icons": "3.2.3",
|
|
63
|
+
"@transferwise/neptune-css": "14.3.45",
|
|
64
|
+
"@transferwise/neptune-tokens": "8.4.0",
|
|
45
65
|
"@types/enzyme": "^3.10.12",
|
|
46
66
|
"@types/jest": "29.4.0",
|
|
47
|
-
"@types/lodash.debounce": "^4.0.7",
|
|
48
67
|
"@types/lodash": "^4.14.167",
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/react": "
|
|
68
|
+
"@types/lodash.debounce": "^4.0.7",
|
|
69
|
+
"@types/react": "18",
|
|
70
|
+
"@types/react-dom": "18",
|
|
51
71
|
"@types/testing-library__jest-dom": "5.9.5",
|
|
52
72
|
"@wise/art": "2.0.1",
|
|
53
73
|
"@wise/components-theming": "^0.7.4",
|
|
54
|
-
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
|
|
55
74
|
"babel-jest": "29.5.0",
|
|
56
75
|
"cpx": "1.5.0",
|
|
57
76
|
"currency-flags": "4.0.7",
|
|
58
77
|
"enzyme": "^3.11.0",
|
|
59
78
|
"eslint": "8.36.0",
|
|
79
|
+
"jest": "29.5.0",
|
|
60
80
|
"jest-environment-jsdom": "29.5.0",
|
|
61
81
|
"jest-fetch-mock": "^3.0.3",
|
|
62
|
-
"jest": "
|
|
82
|
+
"jest-watch-typeahead": "^2.2.2",
|
|
63
83
|
"npm-run-all": "4.1.5",
|
|
84
|
+
"postcss": "^8.4.21",
|
|
64
85
|
"postcss-cli": "^10.1.0",
|
|
65
86
|
"postcss-import": "^15.1.0",
|
|
66
|
-
"postcss": "^8.4.21",
|
|
67
87
|
"prettier": "2.8.4",
|
|
68
|
-
"react
|
|
69
|
-
"react-
|
|
70
|
-
"react": "
|
|
88
|
+
"react": "18.2.0",
|
|
89
|
+
"react-dom": "18.2.0",
|
|
90
|
+
"react-intl": "6.2.1",
|
|
71
91
|
"require-from-string": "2.0.2",
|
|
72
|
-
"stylelint
|
|
73
|
-
"stylelint-
|
|
74
|
-
"stylelint-
|
|
75
|
-
"stylelint": "
|
|
92
|
+
"stylelint": "14.16.1",
|
|
93
|
+
"stylelint-config-standard": "25.0.0",
|
|
94
|
+
"stylelint-no-unsupported-browser-features": "5.0.4",
|
|
95
|
+
"stylelint-value-no-unknown-custom-properties": "4.0.0",
|
|
76
96
|
"typescript": "4.9.5",
|
|
77
97
|
"webpack": "5.75.0"
|
|
78
98
|
},
|
|
79
99
|
"peerDependencies": {
|
|
80
100
|
"@transferwise/components": "^43",
|
|
81
|
-
"@transferwise/formatting": "^2
|
|
101
|
+
"@transferwise/formatting": "^2",
|
|
82
102
|
"@transferwise/icons": "^3",
|
|
83
103
|
"@transferwise/neptune-css": "^14",
|
|
84
104
|
"@transferwise/neptune-validation": "^3",
|
|
85
|
-
"prop-types": "^15
|
|
86
|
-
"react
|
|
87
|
-
"react-
|
|
88
|
-
"react": "
|
|
105
|
+
"prop-types": "^15",
|
|
106
|
+
"react": "^18",
|
|
107
|
+
"react-dom": "^18",
|
|
108
|
+
"react-intl": "^6"
|
|
89
109
|
},
|
|
90
110
|
"peerDependenciesMeta": {
|
|
91
111
|
"prop-types": {
|
|
@@ -93,27 +113,12 @@
|
|
|
93
113
|
}
|
|
94
114
|
},
|
|
95
115
|
"dependencies": {
|
|
96
|
-
"classnames": "
|
|
116
|
+
"classnames": "2.3.2",
|
|
97
117
|
"lodash.debounce": "^4.0.8",
|
|
98
118
|
"lodash.isequal": "^4.5.0",
|
|
99
119
|
"react-use": "^17.4.0",
|
|
100
120
|
"react-webcam": "^7.0.1",
|
|
101
121
|
"screenfull": "^5.0.2"
|
|
102
122
|
},
|
|
103
|
-
"prettier": "@transferwise/eslint-config/.prettierrc.js"
|
|
104
|
-
|
|
105
|
-
"dev": "start-storybook -p 3003",
|
|
106
|
-
"build": "npm-run-all build:*",
|
|
107
|
-
"build:ts": "tsc --build ./tsconfig.build.json",
|
|
108
|
-
"build:css": "postcss src/main.css -o build/main.css",
|
|
109
|
-
"build:messages-source": "formatjs extract 'src/**/*.messages.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
|
|
110
|
-
"build:compiled-messages": "cpx 'src/i18n/*.json' build/i18n",
|
|
111
|
-
"test": "npm-run-all test:once test:tz",
|
|
112
|
-
"test:once": "jest --config jest.config.js --env=jsdom",
|
|
113
|
-
"test:tz": "TZ=US/Pacific jest ./src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.errors.spec.js ./src/formControl/FormControl.spec.js",
|
|
114
|
-
"test:watch": "pnpm test:once --watch",
|
|
115
|
-
"lint": "npm-run-all lint:ts lint:css",
|
|
116
|
-
"lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
|
|
117
|
-
"lint:css": "stylelint --allow-empty-input './src/**/*.less'"
|
|
118
|
-
}
|
|
119
|
-
}
|
|
123
|
+
"prettier": "@transferwise/eslint-config/.prettierrc.js"
|
|
124
|
+
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare function isStatus2xx(status: Response['status']): boolean;
|
|
2
|
-
export declare function isStatus422(status: Response['status']): boolean;
|
|
3
|
-
export declare function getJson(response: Response): Promise<any>;
|
|
4
|
-
export declare function isRelativePath(url?: string): boolean;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function isStatus2xx(status) {
|
|
2
|
-
return status >= 200 && status < 300;
|
|
3
|
-
}
|
|
4
|
-
export function isStatus422(status) {
|
|
5
|
-
return status === 422;
|
|
6
|
-
}
|
|
7
|
-
export function getJson(response) {
|
|
8
|
-
return response.json();
|
|
9
|
-
}
|
|
10
|
-
export function isRelativePath(url) {
|
|
11
|
-
if (url === void 0) { url = ''; }
|
|
12
|
-
return (['https://', 'http://', 'data:'].some(function (prefix) { return url.slice(0, prefix.length) === prefix && url.length > prefix.length; }) === false);
|
|
13
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Props = {
|
|
3
|
-
loading: boolean;
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
};
|
|
6
|
-
export declare const DynamicFlowProvider: ({ loading, children }: Props) => JSX.Element;
|
|
7
|
-
export declare const useDynamicFlow: () => {
|
|
8
|
-
loading: boolean;
|
|
9
|
-
registerPersistAsyncPromise: (promise: Promise<unknown>) => void;
|
|
10
|
-
};
|
|
11
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
14
|
-
import { usePendingPromiseCounter } from './usePendingPromiseCounter';
|
|
15
|
-
var defaultContextValue = {
|
|
16
|
-
loading: false,
|
|
17
|
-
registerPersistAsyncPromise: function (promise) {
|
|
18
|
-
//
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
var DFContext = createContext(defaultContextValue);
|
|
22
|
-
export var DynamicFlowProvider = function (_a) {
|
|
23
|
-
var loading = _a.loading, children = _a.children;
|
|
24
|
-
var _b = usePendingPromiseCounter(), pendingPromises = _b.pendingPromises, addPendingPromise = _b.addPendingPromise;
|
|
25
|
-
var providerValue = useMemo(function () {
|
|
26
|
-
return {
|
|
27
|
-
loading: loading || pendingPromises > 0,
|
|
28
|
-
registerPersistAsyncPromise: addPendingPromise
|
|
29
|
-
};
|
|
30
|
-
}, [loading, pendingPromises, addPendingPromise]);
|
|
31
|
-
return _jsx(DFContext.Provider, __assign({ value: providerValue }, { children: children }));
|
|
32
|
-
};
|
|
33
|
-
export var useDynamicFlow = function () {
|
|
34
|
-
var context = useContext(DFContext);
|
|
35
|
-
return context || defaultContextValue;
|
|
36
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
2
|
-
export function usePendingPromiseCounter() {
|
|
3
|
-
var _a = useState(0), count = _a[0], setCount = _a[1];
|
|
4
|
-
var addPendingPromise = useCallback(function (promise) {
|
|
5
|
-
setCount(function (c) { return c + 1; });
|
|
6
|
-
promise["catch"](noop)["finally"](function () { return delayUntilNextCycle(function () { return setCount(function (c) { return Math.max(0, c - 1); }); }); });
|
|
7
|
-
}, [setCount]);
|
|
8
|
-
return { addPendingPromise: addPendingPromise, pendingPromises: count };
|
|
9
|
-
}
|
|
10
|
-
var delayUntilNextCycle = function (fn) { return setTimeout(function () { return fn(); }, 0); };
|
|
11
|
-
var noop = function () {
|
|
12
|
-
// no-op
|
|
13
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type Fetcher = typeof fetch;
|
|
3
|
-
type FetcherProviderProps = {
|
|
4
|
-
fetcher: Fetcher;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
};
|
|
7
|
-
export declare const FetcherProvider: ({ fetcher, children }: FetcherProviderProps) => JSX.Element;
|
|
8
|
-
type FetcherProviderFromBaseUrlProps = {
|
|
9
|
-
baseUrl: string;
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export declare const FetcherProviderFromBaseUrl: ({ baseUrl, children, }: FetcherProviderFromBaseUrlProps) => JSX.Element;
|
|
13
|
-
/**
|
|
14
|
-
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
15
|
-
*/
|
|
16
|
-
export declare const useFetcher: () => typeof fetch;
|
|
17
|
-
export declare const useHasFetcherProvider: () => boolean;
|
|
18
|
-
export {};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { createContext, useContext, useMemo } from 'react';
|
|
14
|
-
import { makeFetcher } from '.';
|
|
15
|
-
var FetcherContext = createContext(undefined);
|
|
16
|
-
export var FetcherProvider = function (_a) {
|
|
17
|
-
var fetcher = _a.fetcher, children = _a.children;
|
|
18
|
-
return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
|
|
19
|
-
};
|
|
20
|
-
export var FetcherProviderFromBaseUrl = function (_a) {
|
|
21
|
-
var baseUrl = _a.baseUrl, children = _a.children;
|
|
22
|
-
var fetcher = useMemo(function () { return makeFetcher(baseUrl); }, [baseUrl]);
|
|
23
|
-
return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Provides the fetch(er) function for dynamic flows asynchronous operations.
|
|
27
|
-
*/
|
|
28
|
-
export var useFetcher = function () {
|
|
29
|
-
var contextFetch = useContext(FetcherContext);
|
|
30
|
-
return contextFetch || fetch;
|
|
31
|
-
};
|
|
32
|
-
export var useHasFetcherProvider = function () {
|
|
33
|
-
var context = useContext(FetcherContext);
|
|
34
|
-
return !!context;
|
|
35
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { isRelativePath } from '../../api/utils';
|
|
13
|
-
export var makeFetcher = function (baseUrl, additionalHeaders) {
|
|
14
|
-
return function (input, init) {
|
|
15
|
-
var resource = applyBaseUrl(input, baseUrl || '');
|
|
16
|
-
var headers = mergeHeaders(init === null || init === void 0 ? void 0 : init.headers, additionalHeaders);
|
|
17
|
-
return fetch(resource, __assign(__assign({}, (init || {})), { headers: headers }));
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
var applyBaseUrl = function (input, baseUrl) {
|
|
21
|
-
return typeof input === 'string' && isRelativePath(input) ? baseUrl + input : input;
|
|
22
|
-
};
|
|
23
|
-
var mergeHeaders = function (initHeaders, additionalHeaders) {
|
|
24
|
-
if (!initHeaders && !additionalHeaders) {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
27
|
-
var headers = new Headers(initHeaders);
|
|
28
|
-
for (var _i = 0, _a = Object.entries(additionalHeaders || {}); _i < _a.length; _i++) {
|
|
29
|
-
var _b = _a[_i], key = _b[0], value = _b[1];
|
|
30
|
-
headers.set(key, value);
|
|
31
|
-
}
|
|
32
|
-
return headers;
|
|
33
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { isNumber } from '@transferwise/neptune-validation';
|
|
2
|
-
// function taken from: https://stackoverflow.com/questions/23593052/format-javascript-date-as-yyyy-mm-dd
|
|
3
|
-
function formatDate(date) {
|
|
4
|
-
var d = new Date(date);
|
|
5
|
-
var month = "".concat(d.getMonth() + 1);
|
|
6
|
-
var day = "".concat(d.getDate());
|
|
7
|
-
var year = d.getFullYear();
|
|
8
|
-
var formattedMonth = month.length < 2 ? "0".concat(month) : month;
|
|
9
|
-
var formattedDay = day.length < 2 ? "0".concat(day) : day;
|
|
10
|
-
return [year, formattedMonth, formattedDay].join('-');
|
|
11
|
-
}
|
|
12
|
-
export var dateStringToDate = function (dateString) {
|
|
13
|
-
if (!dateString) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
var _a = dateString.split('-').map(function (number) { return parseInt(number, 10); }), year = _a[0], month = _a[1], date = _a[2];
|
|
17
|
-
if (!isNumber(year) || !isNumber(month) || !isNumber(date)) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return new Date(year, month - 1, date);
|
|
21
|
-
};
|
|
22
|
-
export var dateToDateString = function (date) { return formatDate(date); };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* References:
|
|
2
|
-
- https://github.com/gnbaron/use-lodash-debounce
|
|
3
|
-
- https://dmitripavlutin.com/react-throttle-debounce/
|
|
4
|
-
*/
|
|
5
|
-
import debounce from 'lodash.debounce';
|
|
6
|
-
import { useCallback } from 'react';
|
|
7
|
-
export function useDebouncedFunction(callback, delay, options) {
|
|
8
|
-
return useCallback(debounce(callback, delay, options), [callback, delay, options]);
|
|
9
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
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;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
import { waitFor } from '@testing-library/react';
|
|
38
|
-
import { renderHook } from '@testing-library/react-hooks';
|
|
39
|
-
import { useDebouncedFunction } from './useDebouncedFunction';
|
|
40
|
-
describe('useDebouncedFunction hook', function () {
|
|
41
|
-
it('debounces a callback', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var callback, result;
|
|
43
|
-
return __generator(this, function (_a) {
|
|
44
|
-
switch (_a.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
callback = jest.fn();
|
|
47
|
-
result = renderHook(function () { return useDebouncedFunction(callback, 200); }).result;
|
|
48
|
-
result.current();
|
|
49
|
-
expect(callback).not.toHaveBeenCalled();
|
|
50
|
-
return [4 /*yield*/, waitFor(function () {
|
|
51
|
-
expect(callback).toHaveBeenCalledTimes(1);
|
|
52
|
-
}, { interval: 200 })];
|
|
53
|
-
case 1:
|
|
54
|
-
_a.sent();
|
|
55
|
-
return [2 /*return*/];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}); });
|
|
59
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PersistAsync } from '../../dynamic-flow-types';
|
|
2
|
-
type PersistAsyncModel = string | Blob | null;
|
|
3
|
-
type PerformPersistAsyncFunction = (payload: PersistAsyncModel) => Promise<{
|
|
4
|
-
data: string | number;
|
|
5
|
-
}>;
|
|
6
|
-
export declare const usePersistAsync: (persistAsync: PersistAsync) => PerformPersistAsyncFunction;
|
|
7
|
-
export {};
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { isNull, isObject, isNumber, isString } from '@transferwise/neptune-validation';
|
|
49
|
-
import { useState } from 'react';
|
|
50
|
-
import { useIntl } from 'react-intl';
|
|
51
|
-
import { isBlobSchema } from '../../dynamic-flow-types';
|
|
52
|
-
import messages from '../../jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages';
|
|
53
|
-
import { getErrorFromResponse } from '../../jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema'; // FIXME: extract these functions form that schema component to either here or their own module
|
|
54
|
-
import { useFetcher } from '../contexts/fetcherContext';
|
|
55
|
-
import { isValidSchema } from '../validation/schema-validators';
|
|
56
|
-
export var usePersistAsync = function (persistAsync) {
|
|
57
|
-
var _a = useState(null), abortController = _a[0], setAbortController = _a[1];
|
|
58
|
-
var fetcher = useFetcher();
|
|
59
|
-
var intl = useIntl();
|
|
60
|
-
var schema = persistAsync.schema;
|
|
61
|
-
function handlePersistAsync(model) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
63
|
-
var isInvalidSchema;
|
|
64
|
-
return __generator(this, function (_a) {
|
|
65
|
-
switch (_a.label) {
|
|
66
|
-
case 0:
|
|
67
|
-
isInvalidSchema = model instanceof Blob ? !isBlobSchema(schema) : !isValidSchema(model, schema);
|
|
68
|
-
if (isNull(model) || isInvalidSchema) {
|
|
69
|
-
handleError();
|
|
70
|
-
}
|
|
71
|
-
return [4 /*yield*/, performPersistAsync(model)];
|
|
72
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
var abortCurrentRequestAndGetNewAbortSignal = function () {
|
|
78
|
-
if (abortController) {
|
|
79
|
-
abortController.abort();
|
|
80
|
-
}
|
|
81
|
-
var newAbortController = new AbortController();
|
|
82
|
-
setAbortController(newAbortController);
|
|
83
|
-
return newAbortController.signal;
|
|
84
|
-
};
|
|
85
|
-
function constructFetchInit(model) {
|
|
86
|
-
var _a;
|
|
87
|
-
var isBlob = isBlobSchema(schema);
|
|
88
|
-
var signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
89
|
-
var requestKey = persistAsync.param;
|
|
90
|
-
var requestBody = isBlob
|
|
91
|
-
? wrapInFormData(requestKey, model)
|
|
92
|
-
: JSON.stringify((_a = {}, _a[requestKey] = model, _a));
|
|
93
|
-
return {
|
|
94
|
-
method: persistAsync.method,
|
|
95
|
-
headers: __assign({}, (!isBlob && { 'Content-Type': 'application/json' })),
|
|
96
|
-
body: requestBody,
|
|
97
|
-
signal: signal
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function performPersistAsync(payload) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var response, jsonResponse, id, error_1;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
_a.trys.push([0, 3, , 4]);
|
|
107
|
-
return [4 /*yield*/, fetcher(persistAsync.url, constructFetchInit(payload))];
|
|
108
|
-
case 1:
|
|
109
|
-
response = _a.sent();
|
|
110
|
-
if (!response.ok) {
|
|
111
|
-
return [2 /*return*/, handleHTTPError(response)];
|
|
112
|
-
}
|
|
113
|
-
return [4 /*yield*/, response.json()];
|
|
114
|
-
case 2:
|
|
115
|
-
jsonResponse = _a.sent();
|
|
116
|
-
if (isObject(jsonResponse)) {
|
|
117
|
-
id = jsonResponse[persistAsync.idProperty];
|
|
118
|
-
if (isString(id) || isNumber(id)) {
|
|
119
|
-
return [2 /*return*/, { data: id }];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return [2 /*return*/, handleError()];
|
|
123
|
-
case 3:
|
|
124
|
-
error_1 = _a.sent();
|
|
125
|
-
return [2 /*return*/, handleError(error_1)];
|
|
126
|
-
case 4: return [2 /*return*/];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
function handleHTTPError(response) {
|
|
132
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
133
|
-
var jsonResponse, error;
|
|
134
|
-
return __generator(this, function (_a) {
|
|
135
|
-
switch (_a.label) {
|
|
136
|
-
case 0:
|
|
137
|
-
if (!(response.status === 422)) return [3 /*break*/, 2];
|
|
138
|
-
return [4 /*yield*/, response.json()];
|
|
139
|
-
case 1:
|
|
140
|
-
jsonResponse = _a.sent();
|
|
141
|
-
if (isObject(jsonResponse)) {
|
|
142
|
-
error = getErrorFromResponse(persistAsync.param, jsonResponse);
|
|
143
|
-
if (isString(error)) {
|
|
144
|
-
throw new Error(error);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
_a.label = 2;
|
|
148
|
-
case 2: throw new Error(intl.formatMessage(messages.genericError));
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
var handleError = function (error) {
|
|
154
|
-
var message = hasStringMessage(error)
|
|
155
|
-
? error.message
|
|
156
|
-
: intl.formatMessage(messages.genericError);
|
|
157
|
-
throw new Error(message);
|
|
158
|
-
};
|
|
159
|
-
return handlePersistAsync;
|
|
160
|
-
};
|
|
161
|
-
function wrapInFormData(key, value) {
|
|
162
|
-
var formData = new FormData();
|
|
163
|
-
if (value !== null) {
|
|
164
|
-
formData.append(key, value);
|
|
165
|
-
}
|
|
166
|
-
return formData;
|
|
167
|
-
}
|
|
168
|
-
function hasStringMessage(value) {
|
|
169
|
-
return isObject(value) && 'message' in value && typeof value.message === 'string';
|
|
170
|
-
}
|