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