@wise/dynamic-flow-client 0.4.0 → 0.4.2
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 +2 -2
- package/build/common/constants/FormControlType.js +2 -2
- package/build/common/constants/MonthFormat.js +2 -2
- package/build/common/constants/SchemaType.js +2 -2
- package/build/common/constants/Size.js +2 -2
- package/build/common/constants/index.js +1 -1
- package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +15 -27
- package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +11 -9
- package/build/common/contexts/eventsContext/EventsContext.js +11 -28
- package/build/common/contexts/fetcherContexts/FetcherContexts.js +14 -27
- package/build/common/contexts/index.js +1 -1
- package/build/common/contexts/logContext/LogContext.js +12 -30
- package/build/common/hooks/index.js +1 -1
- package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +3 -3
- package/build/common/hooks/useExternal/useExternal.js +8 -8
- package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +20 -31
- package/build/common/hooks/usePersistAsync/usePersistAsync.js +60 -139
- package/build/common/hooks/usePolling/usePolling.js +20 -21
- package/build/common/hooks/usePrevious/usePrevious.js +5 -5
- package/build/common/hooks/useStepPolling/useStepPolling.js +15 -14
- package/build/common/makeFetcher/index.js +1 -1
- package/build/common/makeFetcher/makeFetcher.js +10 -24
- package/build/common/messages.js +5 -5
- package/build/common/utils/api-utils.js +3 -4
- package/build/common/utils/date-utils.js +11 -11
- package/build/common/utils/debounce.js +11 -15
- package/build/common/utils/file-utils.js +12 -25
- package/build/common/utils/id-utils.js +4 -5
- package/build/common/utils/index.js +1 -1
- package/build/common/utils/is-equal.js +8 -8
- package/build/common/utils/schema-utils.js +6 -6
- package/build/common/utils/step-utils.js +14 -14
- package/build/common/validators/index.js +7 -7
- package/build/common/validators/models/model-validators.js +8 -8
- package/build/common/validators/models/models.utils.js +29 -42
- package/build/common/validators/schemas/schema-validators.js +11 -13
- package/build/common/validators/types/type-validators.js +9 -13
- package/build/common/validators/validationFailures/validation-failures.js +14 -14
- package/build/common/validators/validationFailures/validation-failures.utils.js +5 -7
- package/build/common/validators/values/value-validators.js +4 -6
- package/build/dynamicFlow/DynamicFlow.js +185 -307
- package/build/dynamicFlow/DynamicFlowStep.js +12 -23
- package/build/dynamicFlow/DynamicFlowTypes.js +1 -1
- package/build/dynamicFlow/index.js +6 -14
- package/build/dynamicFlow/stories/DynamicFlow.story.js +20 -20
- package/build/dynamicFlow/stories/EditableDynamicFlow.js +20 -33
- package/build/dynamicFlow/stories/fixtureFetcher.js +46 -104
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +22 -40
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +6 -6
- package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +10 -11
- package/build/dynamicFlow/utils/index.js +5 -2
- package/build/dynamicFlow/utils/responseParsers/response-parsers.js +53 -118
- package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +9 -9
- package/build/dynamicFlow/utils/useDynamicFlowState.js +51 -74
- package/build/dynamicFlow/utils/useLoader.js +9 -20
- package/build/fixtures/components/alert.js +8 -8
- package/build/fixtures/components/box.js +7 -7
- package/build/fixtures/components/button.js +25 -36
- package/build/fixtures/components/columns.js +10 -10
- package/build/fixtures/components/copyable.js +6 -6
- package/build/fixtures/components/decision.js +15 -15
- package/build/fixtures/components/heading.js +7 -7
- package/build/fixtures/components/image.js +10 -10
- package/build/fixtures/components/index.js +17 -25
- package/build/fixtures/components/info.js +22 -6
- package/build/fixtures/components/list.js +8 -8
- package/build/fixtures/components/loading-indicator.js +5 -5
- package/build/fixtures/components/paragraph.js +9 -9
- package/build/fixtures/components/review.js +11 -11
- package/build/fixtures/examples/camera-capture.js +29 -29
- package/build/fixtures/examples/index.js +9 -17
- package/build/fixtures/examples/recipient-update.js +69 -69
- package/build/fixtures/examples/recipient.js +63 -63
- package/build/fixtures/examples/single-file-upload.js +21 -21
- package/build/fixtures/examples/step-validation-errors.js +21 -21
- package/build/fixtures/features/action-response.js +8 -8
- package/build/fixtures/features/external.js +8 -8
- package/build/fixtures/features/index.js +9 -17
- package/build/fixtures/features/persist-async.js +11 -11
- package/build/fixtures/features/polling.js +9 -9
- package/build/fixtures/features/validation-async.js +10 -10
- package/build/fixtures/index.js +11 -22
- package/build/fixtures/jsonSchemaForm/allOf.js +30 -30
- package/build/fixtures/jsonSchemaForm/audRecipient.js +271 -271
- package/build/fixtures/jsonSchemaForm/currency.js +12 -12
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +11 -11
- package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +11 -11
- package/build/fixtures/jsonSchemaForm/oneOf.js +27 -27
- package/build/fixtures/jsonSchemaForm/oneOfTabs.js +16 -16
- package/build/fixtures/jsonSchemaForm/promotedOneOf.js +17 -17
- package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +30 -30
- package/build/fixtures/jsonSchemaForm/simple.js +16 -16
- package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +19 -19
- package/build/fixtures/jsonSchemaForm/validationAsync.js +8 -8
- package/build/fixtures/layouts/all.js +37 -37
- package/build/fixtures/layouts/final-step-layout.js +9 -9
- package/build/fixtures/layouts/index.js +10 -18
- package/build/fixtures/layouts/list.js +10 -10
- package/build/fixtures/layouts/pay-in.js +23 -23
- package/build/fixtures/layouts/review.js +38 -38
- package/build/fixtures/layouts/success.js +15 -15
- package/build/fixtures/responses/action-response-final.js +8 -8
- package/build/fixtures/responses/action.js +3 -3
- package/build/fixtures/responses/exit.js +3 -3
- package/build/fixtures/responses/index.js +8 -16
- package/build/fixtures/responses/recipient-update-final.js +8 -8
- package/build/fixtures/schemas/basic-form.js +11 -11
- package/build/fixtures/schemas/index.js +8 -16
- package/build/fixtures/schemas/number-and-integer.js +11 -11
- package/build/fixtures/schemas/one-of.js +43 -46
- package/build/fixtures/schemas/string-formats.js +15 -15
- package/build/fixtures/utils/image-util.js +8 -8
- package/build/formControl/FormControl.js +118 -148
- package/build/formControl/index.js +6 -14
- package/build/formControl/utils/index.js +1 -1
- package/build/formControl/utils/value-utils.js +18 -23
- package/build/i18n/index.js +31 -31
- package/build/index.js +13 -10
- package/build/jsonSchemaForm/JsonSchemaForm.js +12 -24
- package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +24 -37
- package/build/jsonSchemaForm/allOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +9 -20
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +56 -115
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +7 -7
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +6 -14
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +19 -71
- package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +10 -11
- package/build/jsonSchemaForm/arrayTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +45 -62
- package/build/jsonSchemaForm/basicTypeSchema/index.js +6 -14
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +39 -50
- package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +18 -18
- package/build/jsonSchemaForm/controlFeedback/index.js +6 -14
- package/build/jsonSchemaForm/genericSchema/GenericSchema.js +52 -61
- package/build/jsonSchemaForm/genericSchema/index.js +6 -14
- package/build/jsonSchemaForm/help/Help.js +9 -9
- package/build/jsonSchemaForm/help/Help.messages.js +5 -5
- package/build/jsonSchemaForm/help/index.js +6 -14
- package/build/jsonSchemaForm/index.js +6 -14
- package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +28 -49
- package/build/jsonSchemaForm/objectSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +54 -74
- package/build/jsonSchemaForm/oneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +3 -3
- package/build/jsonSchemaForm/oneOfSchema/utils/index.js +1 -1
- package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +19 -20
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +11 -22
- package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +5 -5
- package/build/jsonSchemaForm/persistAsyncSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +73 -127
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +6 -14
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +45 -110
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +17 -17
- package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +28 -47
- package/build/jsonSchemaForm/promotedOneOfSchema/index.js +6 -14
- package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +4 -4
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +13 -24
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +11 -22
- package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +12 -23
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +24 -26
- package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +6 -6
- package/build/jsonSchemaForm/readOnlySchema/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +26 -39
- package/build/jsonSchemaForm/schemaFormControl/index.js +6 -14
- package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +5 -5
- package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -1
- package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +30 -47
- package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +57 -119
- package/build/jsonSchemaForm/validationAsyncSchema/index.js +6 -14
- package/build/layout/DynamicLayout.js +10 -21
- package/build/layout/alert/DynamicAlert.js +9 -9
- package/build/layout/box/DynamicBox.js +12 -23
- package/build/layout/button/DynamicButton.js +16 -27
- package/build/layout/columns/DynamicColumns.js +13 -24
- package/build/layout/decision/DynamicDecision.js +16 -27
- package/build/layout/divider/DynamicDivider.js +7 -8
- package/build/layout/external/DynamicExternal.js +16 -28
- package/build/layout/external/DynamicExternal.messages.js +5 -5
- package/build/layout/form/DynamicForm.js +10 -21
- package/build/layout/heading/DynamicHeading.js +12 -23
- package/build/layout/icon/DynamicIcon.js +9 -10
- package/build/layout/image/DynamicImage.js +43 -93
- package/build/layout/index.js +21 -29
- package/build/layout/info/DynamicInfo.js +7 -19
- package/build/layout/list/DynamicList.js +14 -26
- package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +8 -9
- package/build/layout/paragraph/DynamicParagraph.js +19 -37
- package/build/layout/paragraph/DynamicParagraph.messages.js +6 -6
- package/build/layout/paragraph/useSnackBarIfAvailable.js +4 -4
- package/build/layout/review/DynamicReview.js +14 -26
- package/build/layout/utils.js +4 -6
- package/build/step/cameraStep/CameraStep.js +42 -88
- package/build/step/cameraStep/cameraCapture/CameraCapture.js +48 -105
- package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/components/index.js +10 -28
- package/build/step/cameraStep/cameraCapture/hooks/index.js +17 -72
- package/build/step/cameraStep/cameraCapture/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +33 -45
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +8 -19
- package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +6 -6
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +9 -21
- package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +7 -7
- package/build/step/cameraStep/cameraCapture/screens/index.js +6 -14
- package/build/step/cameraStep/cameraCapture/tracking/index.js +17 -99
- package/build/step/cameraStep/cameraCapture/utils/index.js +33 -96
- package/build/step/cameraStep/index.js +6 -14
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +20 -21
- package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +8 -8
- package/build/step/externalConfirmationStep/index.js +6 -14
- package/build/step/index.js +7 -15
- package/build/step/layoutStep/LayoutStep.js +19 -19
- package/build/step/layoutStep/index.js +6 -14
- package/build/step/layoutStep/utils/index.js +3 -14
- package/build/step/layoutStep/utils/inline-reference-utils.js +29 -46
- package/build/step/layoutStep/utils/layout-utils.js +34 -53
- package/build/types/common/FormControl.js +1 -1
- package/build/types/index.js +13 -13
- package/build/types/specification/Action.js +1 -1
- package/build/types/specification/FileUploadSchema.js +1 -1
- package/build/types/specification/LayoutComponent.js +1 -1
- package/build/types/specification/Model.js +9 -17
- package/build/types/specification/PersistAsync.js +1 -1
- package/build/types/specification/Polling.js +1 -1
- package/build/types/specification/Promotion.js +1 -1
- package/build/types/specification/Schema.js +8 -8
- package/build/types/specification/Step.js +3 -5
- package/build/types/specification/ValidationAsync.js +1 -1
- package/build/types/specification/core.js +1 -1
- package/package.json +1 -1
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
14
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
15
|
-
if (ar || !(i in from)) {
|
|
16
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
17
|
-
ar[i] = from[i];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
21
|
-
};
|
|
22
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
3
|
exports.convertStepActionToDynamicAction = exports.convertStepToLayout = void 0;
|
|
24
|
-
function convertStepToLayout(step,
|
|
25
|
-
var _b = _a === void 0 ? {} : _a, _c = _b.displayStepTitle, displayStepTitle = _c === void 0 ? true : _c;
|
|
4
|
+
function convertStepToLayout(step, { displayStepTitle = true } = {}) {
|
|
26
5
|
if (!step || !step.type) {
|
|
27
6
|
throw new Error('Missing step type');
|
|
28
7
|
}
|
|
@@ -45,12 +24,12 @@ function convertStepToLayout(step, _a) {
|
|
|
45
24
|
}
|
|
46
25
|
exports.convertStepToLayout = convertStepToLayout;
|
|
47
26
|
function convertCommonComponents(step) {
|
|
48
|
-
|
|
27
|
+
const layout = [];
|
|
49
28
|
if (step.title) {
|
|
50
29
|
layout.push(convertStepTitleToDynamicHeading(step.title));
|
|
51
30
|
}
|
|
52
31
|
if (step.image) {
|
|
53
|
-
|
|
32
|
+
const image = convertStepImageToDynamicImage(step.image);
|
|
54
33
|
layout.push(image);
|
|
55
34
|
}
|
|
56
35
|
if (step.description) {
|
|
@@ -59,7 +38,7 @@ function convertCommonComponents(step) {
|
|
|
59
38
|
return layout;
|
|
60
39
|
}
|
|
61
40
|
function convertExternalStepToDynamicLayout(step) {
|
|
62
|
-
return
|
|
41
|
+
return [...convertCommonComponents(step), convertStepToExternalComponent(step)];
|
|
63
42
|
}
|
|
64
43
|
function convertStepToExternalComponent(step) {
|
|
65
44
|
return {
|
|
@@ -67,28 +46,28 @@ function convertStepToExternalComponent(step) {
|
|
|
67
46
|
requestUrl: step.requestUrl,
|
|
68
47
|
polling: step.polling,
|
|
69
48
|
responseHandlers: step.responseHandlers,
|
|
70
|
-
retryTitle: step.retryTitle
|
|
49
|
+
retryTitle: step.retryTitle,
|
|
71
50
|
};
|
|
72
51
|
}
|
|
73
52
|
function convertFormStepToDynamicLayout(step) {
|
|
74
|
-
|
|
53
|
+
const layout = convertCommonComponents(step);
|
|
75
54
|
if (step.reviewFields) {
|
|
76
55
|
layout.push(convertStepReviewToDynamicReview(step.reviewFields));
|
|
77
56
|
}
|
|
78
57
|
if (step.schemas) {
|
|
79
|
-
layout.push
|
|
58
|
+
layout.push(...getSchemaLayout(step));
|
|
80
59
|
}
|
|
81
60
|
if (step.actions) {
|
|
82
|
-
|
|
61
|
+
const actions = step.actions.map(convertStepActionToDynamicAction);
|
|
83
62
|
layout.push(dynamicBox(actions, 'md'));
|
|
84
63
|
}
|
|
85
64
|
return layout;
|
|
86
65
|
}
|
|
87
66
|
function convertFinalStepToDynamicLayout(step) {
|
|
88
|
-
|
|
67
|
+
const layout = [];
|
|
89
68
|
if (step.details) {
|
|
90
69
|
if (step.details.image) {
|
|
91
|
-
|
|
70
|
+
const image = convertFinalStepImageToDynamicImage(step.details.image);
|
|
92
71
|
layout.push(image);
|
|
93
72
|
}
|
|
94
73
|
if (step.details.title) {
|
|
@@ -99,15 +78,13 @@ function convertFinalStepToDynamicLayout(step) {
|
|
|
99
78
|
}
|
|
100
79
|
}
|
|
101
80
|
if (step.actions) {
|
|
102
|
-
|
|
103
|
-
return convertStepActionToDynamicAction(__assign(__assign({}, action), { type: action.type || 'primary' }));
|
|
104
|
-
});
|
|
81
|
+
const actions = step.actions.map((action) => convertStepActionToDynamicAction(Object.assign(Object.assign({}, action), { type: action.type || 'primary' })));
|
|
105
82
|
layout.push(dynamicBox(actions, 'md'));
|
|
106
83
|
}
|
|
107
84
|
return layout;
|
|
108
85
|
}
|
|
109
86
|
function convertDecisionStepToDynamicLayout(step) {
|
|
110
|
-
|
|
87
|
+
const layout = convertCommonComponents(step);
|
|
111
88
|
if (step.options) {
|
|
112
89
|
layout.push(convertStepDecisionToDynamicDecision(step.options));
|
|
113
90
|
}
|
|
@@ -117,7 +94,7 @@ function dynamicBox(components, size) {
|
|
|
117
94
|
return {
|
|
118
95
|
type: 'box',
|
|
119
96
|
width: size || 'md',
|
|
120
|
-
components
|
|
97
|
+
components,
|
|
121
98
|
};
|
|
122
99
|
}
|
|
123
100
|
function convertStepTitleToDynamicHeading(title) {
|
|
@@ -126,23 +103,23 @@ function convertStepTitleToDynamicHeading(title) {
|
|
|
126
103
|
text: title,
|
|
127
104
|
size: 'lg',
|
|
128
105
|
margin: 'lg',
|
|
129
|
-
align: 'center'
|
|
106
|
+
align: 'center',
|
|
130
107
|
};
|
|
131
108
|
}
|
|
132
109
|
function convertStepDescriptionToDynamicParagraph(description) {
|
|
133
110
|
return {
|
|
134
111
|
type: 'paragraph',
|
|
135
112
|
text: description,
|
|
136
|
-
align: 'center'
|
|
113
|
+
align: 'center',
|
|
137
114
|
};
|
|
138
115
|
}
|
|
139
116
|
function convertStepSchemaToDynamicForm(schema) {
|
|
140
|
-
return { type: 'form', schema
|
|
117
|
+
return { type: 'form', schema };
|
|
141
118
|
}
|
|
142
119
|
function convertStepDecisionToDynamicDecision(options) {
|
|
143
120
|
return {
|
|
144
121
|
type: 'decision',
|
|
145
|
-
options: options.map(convertStepDecisionOption)
|
|
122
|
+
options: options.map(convertStepDecisionOption),
|
|
146
123
|
};
|
|
147
124
|
}
|
|
148
125
|
function convertStepDecisionOption(option) {
|
|
@@ -153,8 +130,8 @@ function convertStepDecisionOption(option) {
|
|
|
153
130
|
title: option.title,
|
|
154
131
|
method: 'GET',
|
|
155
132
|
url: option.url,
|
|
156
|
-
disabled: option.disabled
|
|
157
|
-
}
|
|
133
|
+
disabled: option.disabled,
|
|
134
|
+
},
|
|
158
135
|
};
|
|
159
136
|
}
|
|
160
137
|
function convertStepImageToDynamicImage(image) {
|
|
@@ -163,7 +140,7 @@ function convertStepImageToDynamicImage(image) {
|
|
|
163
140
|
url: image.url,
|
|
164
141
|
text: image.text,
|
|
165
142
|
margin: image.margin || 'lg',
|
|
166
|
-
size: image.size || 'md'
|
|
143
|
+
size: image.size || 'md',
|
|
167
144
|
};
|
|
168
145
|
}
|
|
169
146
|
function convertFinalStepImageToDynamicImage(image) {
|
|
@@ -173,15 +150,15 @@ function convertFinalStepImageToDynamicImage(image) {
|
|
|
173
150
|
url: image,
|
|
174
151
|
text: undefined,
|
|
175
152
|
margin: 'lg',
|
|
176
|
-
size: 'md'
|
|
153
|
+
size: 'md',
|
|
177
154
|
}
|
|
178
155
|
: convertStepImageToDynamicImage(image);
|
|
179
156
|
}
|
|
180
157
|
function convertStepActionToDynamicAction(action) {
|
|
181
|
-
|
|
158
|
+
const newAction = Object.assign(Object.assign({}, action), { title: action.title });
|
|
182
159
|
return {
|
|
183
160
|
type: 'button',
|
|
184
|
-
action: newAction
|
|
161
|
+
action: newAction,
|
|
185
162
|
};
|
|
186
163
|
}
|
|
187
164
|
exports.convertStepActionToDynamicAction = convertStepActionToDynamicAction;
|
|
@@ -189,20 +166,20 @@ function convertStepReviewToDynamicReview(reviewFields) {
|
|
|
189
166
|
return {
|
|
190
167
|
type: 'review',
|
|
191
168
|
title: reviewFields.title,
|
|
192
|
-
fields: reviewFields.fields.map(convertReviewFieldToDefinition)
|
|
169
|
+
fields: reviewFields.fields.map(convertReviewFieldToDefinition),
|
|
193
170
|
};
|
|
194
171
|
}
|
|
195
172
|
function convertReviewFieldToDefinition(reviewField) {
|
|
196
173
|
return {
|
|
197
174
|
label: reviewField.title,
|
|
198
|
-
value: reviewField.value
|
|
175
|
+
value: reviewField.value,
|
|
199
176
|
};
|
|
200
177
|
}
|
|
201
178
|
function getSchemaLayout(step) {
|
|
202
|
-
|
|
179
|
+
const layout = [];
|
|
203
180
|
if (step.schemas && step.schemas[0]) {
|
|
204
|
-
|
|
205
|
-
|
|
181
|
+
const schema = step.schemas[0];
|
|
182
|
+
const dynamicForm = convertStepSchemaToDynamicForm(schema);
|
|
206
183
|
if (isWideForm()) {
|
|
207
184
|
layout.push(dynamicForm);
|
|
208
185
|
}
|
|
@@ -218,5 +195,9 @@ function isWideForm() {
|
|
|
218
195
|
return false;
|
|
219
196
|
}
|
|
220
197
|
function addMissingTitleAndDescriptionToStep(step, displayStepTitle) {
|
|
221
|
-
return
|
|
198
|
+
return [
|
|
199
|
+
...(displayStepTitle && step.title ? [convertStepTitleToDynamicHeading(step.title)] : []),
|
|
200
|
+
...(step.description ? [convertStepDescriptionToDynamicParagraph(step.description)] : []),
|
|
201
|
+
...(step.layout || []),
|
|
202
|
+
];
|
|
222
203
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/build/types/index.js
CHANGED
|
@@ -13,7 +13,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
-
exports
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.isBasicError = exports.isFileUploadSchema = exports.isBasicSchema = exports.isPersistAsyncSchema = exports.isValidationAsyncSchema = exports.isListArraySchema = exports.isTupleArraySchema = exports.isArraySchema = exports.isBlobSchema = exports.isAllOfSchema = exports.isOneOfSchema = exports.isObjectSchema = void 0;
|
|
18
18
|
__exportStar(require("./specification/core"), exports);
|
|
19
19
|
__exportStar(require("./specification/Action"), exports);
|
|
@@ -25,18 +25,18 @@ __exportStar(require("./specification/PersistAsync"), exports);
|
|
|
25
25
|
__exportStar(require("./specification/ValidationAsync"), exports);
|
|
26
26
|
__exportStar(require("./specification/Promotion"), exports);
|
|
27
27
|
var Schema_1 = require("./specification/Schema");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
28
|
+
Object.defineProperty(exports, "isObjectSchema", { enumerable: true, get: function () { return Schema_1.isObjectSchema; } });
|
|
29
|
+
Object.defineProperty(exports, "isOneOfSchema", { enumerable: true, get: function () { return Schema_1.isOneOfSchema; } });
|
|
30
|
+
Object.defineProperty(exports, "isAllOfSchema", { enumerable: true, get: function () { return Schema_1.isAllOfSchema; } });
|
|
31
|
+
Object.defineProperty(exports, "isBlobSchema", { enumerable: true, get: function () { return Schema_1.isBlobSchema; } });
|
|
32
|
+
Object.defineProperty(exports, "isArraySchema", { enumerable: true, get: function () { return Schema_1.isArraySchema; } });
|
|
33
|
+
Object.defineProperty(exports, "isTupleArraySchema", { enumerable: true, get: function () { return Schema_1.isTupleArraySchema; } });
|
|
34
|
+
Object.defineProperty(exports, "isListArraySchema", { enumerable: true, get: function () { return Schema_1.isListArraySchema; } });
|
|
35
|
+
Object.defineProperty(exports, "isValidationAsyncSchema", { enumerable: true, get: function () { return Schema_1.isValidationAsyncSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "isPersistAsyncSchema", { enumerable: true, get: function () { return Schema_1.isPersistAsyncSchema; } });
|
|
37
|
+
Object.defineProperty(exports, "isBasicSchema", { enumerable: true, get: function () { return Schema_1.isBasicSchema; } });
|
|
38
38
|
var FileUploadSchema_1 = require("./specification/FileUploadSchema");
|
|
39
|
-
|
|
39
|
+
Object.defineProperty(exports, "isFileUploadSchema", { enumerable: true, get: function () { return FileUploadSchema_1.isFileUploadSchema; } });
|
|
40
40
|
var Step_1 = require("./specification/Step");
|
|
41
|
-
|
|
41
|
+
Object.defineProperty(exports, "isBasicError", { enumerable: true, get: function () { return Step_1.isBasicError; } });
|
|
42
42
|
__exportStar(require("./common/FormControl"), exports);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,35 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isNullableArrayModel = exports.isArrayModel = exports.isNullableStringModel = exports.isNullableBasicModel = exports.isNullableObjectModel = exports.isObjectModel = void 0;
|
|
4
|
-
|
|
4
|
+
const validators_1 = require("../../common/validators");
|
|
5
5
|
// TODO HD Move these functions out of types
|
|
6
|
-
|
|
7
|
-
return typeof model === 'object' && model !== null && model.constructor === Object;
|
|
8
|
-
};
|
|
6
|
+
const isObjectModel = (model) => typeof model === 'object' && model !== null && model.constructor === Object;
|
|
9
7
|
exports.isObjectModel = isObjectModel;
|
|
10
|
-
|
|
11
|
-
return (0, validators_1.isNull)(model) || (0, exports.isObjectModel)(model);
|
|
12
|
-
};
|
|
8
|
+
const isNullableObjectModel = (model) => (0, validators_1.isNull)(model) || (0, exports.isObjectModel)(model);
|
|
13
9
|
exports.isNullableObjectModel = isNullableObjectModel;
|
|
14
|
-
|
|
15
|
-
return (0, validators_1.isBoolean)(model) || (0, validators_1.isNumber)(model) || (0, validators_1.isString)(model) || (0, validators_1.isNull)(model);
|
|
16
|
-
};
|
|
10
|
+
const isNullableBasicModel = (model) => (0, validators_1.isBoolean)(model) || (0, validators_1.isNumber)(model) || (0, validators_1.isString)(model) || (0, validators_1.isNull)(model);
|
|
17
11
|
exports.isNullableBasicModel = isNullableBasicModel;
|
|
18
|
-
|
|
19
|
-
return (0, validators_1.isString)(model) || (0, validators_1.isNull)(model);
|
|
20
|
-
};
|
|
12
|
+
const isNullableStringModel = (model) => (0, validators_1.isString)(model) || (0, validators_1.isNull)(model);
|
|
21
13
|
exports.isNullableStringModel = isNullableStringModel;
|
|
22
|
-
|
|
14
|
+
const isArrayModel = (model) => {
|
|
23
15
|
if ((0, validators_1.isArray)(model)) {
|
|
24
16
|
if (model.length === 0) {
|
|
25
17
|
return true;
|
|
26
18
|
}
|
|
27
|
-
return model.every(
|
|
19
|
+
return model.every((item) => typeof item === 'string' || typeof item === 'number' || typeof item === 'boolean');
|
|
28
20
|
}
|
|
29
21
|
return false;
|
|
30
22
|
};
|
|
31
23
|
exports.isArrayModel = isArrayModel;
|
|
32
|
-
|
|
24
|
+
const isNullableArrayModel = (model) => {
|
|
33
25
|
if ((0, validators_1.isNull)(model)) {
|
|
34
26
|
return true;
|
|
35
27
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isMultipleFileUploadSchema = exports.isValidationAsyncSchema = exports.isPersistAsyncFileSchema = exports.isPersistAsyncSchema = exports.isStringSchema = exports.isListArraySchema = exports.isTupleArraySchema = exports.isArraySchema = exports.isBlobSchema = exports.isAllOfSchema = exports.isOneOfSchema = exports.isOneOfObjectSchema = exports.isObjectSchema = exports.isBasicSchema = void 0;
|
|
4
|
-
|
|
4
|
+
const basicTypes = new Set(['string', 'number', 'integer', 'boolean']);
|
|
5
5
|
// TODO HD Move these out of types
|
|
6
6
|
function isBasicSchema(schema) {
|
|
7
|
-
return basicTypes.has(schema.type || '') || ('const' in schema && schema
|
|
7
|
+
return basicTypes.has(schema.type || '') || ('const' in schema && schema.const !== undefined);
|
|
8
8
|
}
|
|
9
9
|
exports.isBasicSchema = isBasicSchema;
|
|
10
10
|
function isObjectSchema(schema) {
|
|
@@ -12,7 +12,7 @@ function isObjectSchema(schema) {
|
|
|
12
12
|
}
|
|
13
13
|
exports.isObjectSchema = isObjectSchema;
|
|
14
14
|
function isOneOfObjectSchema(schema) {
|
|
15
|
-
return isOneOfSchema(schema) && schema.oneOf.every(
|
|
15
|
+
return isOneOfSchema(schema) && schema.oneOf.every((subSchema) => subSchema.type === 'object');
|
|
16
16
|
}
|
|
17
17
|
exports.isOneOfObjectSchema = isOneOfObjectSchema;
|
|
18
18
|
function isOneOfSchema(schema) {
|
|
@@ -32,12 +32,12 @@ function isArraySchema(schema) {
|
|
|
32
32
|
}
|
|
33
33
|
exports.isArraySchema = isArraySchema;
|
|
34
34
|
function isTupleArraySchema(schema) {
|
|
35
|
-
|
|
35
|
+
const schemaItems = schema.items;
|
|
36
36
|
return Array.isArray(schemaItems);
|
|
37
37
|
}
|
|
38
38
|
exports.isTupleArraySchema = isTupleArraySchema;
|
|
39
39
|
function isListArraySchema(schema) {
|
|
40
|
-
|
|
40
|
+
const schemaItems = schema.items;
|
|
41
41
|
return !Array.isArray(schemaItems);
|
|
42
42
|
}
|
|
43
43
|
exports.isListArraySchema = isListArraySchema;
|
|
@@ -54,14 +54,14 @@ function isPersistAsyncFileSchema(schema) {
|
|
|
54
54
|
(isBlobSchema(schema.persistAsync.schema) || isBase64FileSchema(schema.persistAsync.schema)));
|
|
55
55
|
}
|
|
56
56
|
exports.isPersistAsyncFileSchema = isPersistAsyncFileSchema;
|
|
57
|
-
|
|
57
|
+
const isValidationAsyncSchema = (schema) => {
|
|
58
58
|
return isBasicSchema(schema) && !!schema.validationAsync;
|
|
59
59
|
};
|
|
60
60
|
exports.isValidationAsyncSchema = isValidationAsyncSchema;
|
|
61
61
|
function isBase64FileSchema(schema) {
|
|
62
62
|
return schema.type === 'string' && schema.format === 'base64url';
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
const isMultipleFileUploadSchema = (schema) => {
|
|
65
65
|
return (isArraySchema(schema) && isListArraySchema(schema) && isPersistAsyncFileSchema(schema.items));
|
|
66
66
|
};
|
|
67
67
|
exports.isMultipleFileUploadSchema = isMultipleFileUploadSchema;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isBasicError = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return (0, validators_1.isString)(error) || (0, validators_1.isNull)(error);
|
|
7
|
-
};
|
|
4
|
+
const validators_1 = require("../../common/validators");
|
|
5
|
+
const isBasicError = (error) => (0, validators_1.isString)(error) || (0, validators_1.isNull)(error);
|
|
8
6
|
exports.isBasicError = isBasicError;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|