@wise/dynamic-flow-client 0.4.0-beta-0489d0.8 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/README.md +0 -11
  2. package/build/common/constants/DateMode.js +7 -0
  3. package/build/common/constants/FormControlType.js +20 -0
  4. package/build/common/constants/MonthFormat.js +7 -0
  5. package/build/common/constants/SchemaType.js +14 -0
  6. package/build/common/constants/Size.js +10 -0
  7. package/build/common/constants/index.js +21 -0
  8. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +41 -0
  9. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +17 -0
  10. package/build/common/contexts/eventsContext/EventsContext.js +39 -0
  11. package/build/common/contexts/fetcherContexts/FetcherContexts.js +42 -0
  12. package/build/common/contexts/index.js +20 -0
  13. package/build/common/contexts/logContext/LogContext.js +45 -0
  14. package/build/common/hooks/index.js +23 -0
  15. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +13 -0
  16. package/build/common/hooks/useExternal/useExternal.js +19 -0
  17. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +73 -0
  18. package/build/common/hooks/usePersistAsync/usePersistAsync.js +177 -0
  19. package/build/common/hooks/usePolling/usePolling.js +53 -0
  20. package/build/common/hooks/usePrevious/usePrevious.js +12 -0
  21. package/build/common/hooks/useStepPolling/useStepPolling.js +48 -0
  22. package/build/common/makeFetcher/index.js +17 -0
  23. package/build/common/makeFetcher/makeFetcher.js +37 -0
  24. package/build/common/messages.js +10 -0
  25. package/build/common/utils/api-utils.js +20 -0
  26. package/build/common/utils/date-utils.js +27 -0
  27. package/build/common/utils/debounce.js +42 -0
  28. package/build/common/utils/file-utils.js +51 -0
  29. package/build/common/utils/id-utils.js +9 -0
  30. package/build/common/utils/index.js +24 -0
  31. package/build/common/utils/is-equal.js +25 -0
  32. package/build/common/utils/schema-utils.js +55 -0
  33. package/build/common/utils/step-utils.js +47 -0
  34. package/build/common/validators/index.js +28 -0
  35. package/build/common/validators/models/model-validators.js +69 -0
  36. package/build/common/validators/models/models.utils.js +130 -0
  37. package/build/common/validators/schemas/schema-validators.js +101 -0
  38. package/build/common/validators/types/type-validators.js +25 -0
  39. package/build/common/validators/validationFailures/validation-failures.js +151 -0
  40. package/build/common/validators/validationFailures/validation-failures.utils.js +51 -0
  41. package/build/common/validators/values/value-validators.js +9 -0
  42. package/build/dynamicFlow/DynamicFlow.js +372 -0
  43. package/build/dynamicFlow/DynamicFlowStep.js +36 -0
  44. package/build/dynamicFlow/DynamicFlowTypes.js +8 -0
  45. package/build/dynamicFlow/index.js +16 -0
  46. package/build/dynamicFlow/stories/DynamicFlow.story.js +36 -0
  47. package/build/dynamicFlow/stories/EditableDynamicFlow.js +67 -0
  48. package/build/dynamicFlow/stories/fixtureFetcher.js +118 -0
  49. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +47 -0
  50. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +15 -0
  51. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +19 -0
  52. package/build/dynamicFlow/utils/index.js +23 -0
  53. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +131 -0
  54. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +27 -0
  55. package/build/dynamicFlow/utils/useDynamicFlowState.js +114 -0
  56. package/build/dynamicFlow/utils/useLoader.js +26 -0
  57. package/build/fixtures/components/alert.js +33 -0
  58. package/build/fixtures/components/box.js +22 -0
  59. package/build/fixtures/components/button.js +67 -0
  60. package/build/fixtures/components/columns.js +38 -0
  61. package/build/fixtures/components/copyable.js +24 -0
  62. package/build/fixtures/components/decision.js +56 -0
  63. package/build/fixtures/components/heading.js +16 -0
  64. package/build/fixtures/components/image.js +25 -0
  65. package/build/fixtures/components/index.js +40 -0
  66. package/build/fixtures/components/info.js +19 -0
  67. package/build/fixtures/components/list.js +36 -0
  68. package/build/fixtures/components/loading-indicator.js +18 -0
  69. package/build/fixtures/components/paragraph.js +30 -0
  70. package/build/fixtures/components/review.js +62 -0
  71. package/build/fixtures/examples/camera-capture.js +123 -0
  72. package/build/fixtures/examples/index.js +24 -0
  73. package/build/fixtures/examples/recipient-update.js +252 -0
  74. package/build/fixtures/examples/recipient.js +315 -0
  75. package/build/fixtures/examples/single-file-upload.js +100 -0
  76. package/build/fixtures/examples/step-validation-errors.js +77 -0
  77. package/build/fixtures/features/action-response.js +31 -0
  78. package/build/fixtures/features/external.js +33 -0
  79. package/build/fixtures/features/index.js +24 -0
  80. package/build/fixtures/features/persist-async.js +46 -0
  81. package/build/fixtures/features/polling.js +35 -0
  82. package/build/fixtures/features/validation-async.js +40 -0
  83. package/build/fixtures/index.js +49 -0
  84. package/build/fixtures/jsonSchemaForm/allOf.js +121 -0
  85. package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +3 -0
  86. package/build/fixtures/jsonSchemaForm/audRecipient.js +1106 -0
  87. package/build/fixtures/jsonSchemaForm/currency.d.ts +3 -0
  88. package/build/fixtures/jsonSchemaForm/currency.js +50 -0
  89. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +3 -0
  90. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +39 -0
  91. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +3 -0
  92. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +38 -0
  93. package/build/fixtures/jsonSchemaForm/oneOf.d.ts +3 -0
  94. package/build/fixtures/jsonSchemaForm/oneOf.js +121 -0
  95. package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +3 -0
  96. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +55 -0
  97. package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +3 -0
  98. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +58 -0
  99. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +3 -0
  100. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +104 -0
  101. package/build/fixtures/jsonSchemaForm/simple.d.ts +3 -0
  102. package/build/fixtures/jsonSchemaForm/simple.js +50 -0
  103. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +3 -0
  104. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +73 -0
  105. package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +3 -0
  106. package/build/fixtures/jsonSchemaForm/validationAsync.js +25 -0
  107. package/build/fixtures/layouts/all.js +178 -0
  108. package/build/fixtures/layouts/final-step-layout.js +41 -0
  109. package/build/fixtures/layouts/index.js +26 -0
  110. package/build/fixtures/layouts/list.js +35 -0
  111. package/build/fixtures/layouts/pay-in.js +99 -0
  112. package/build/fixtures/layouts/review.js +162 -0
  113. package/build/fixtures/layouts/success.js +68 -0
  114. package/build/fixtures/responses/action-response-final.js +26 -0
  115. package/build/fixtures/responses/action.js +4 -0
  116. package/build/fixtures/responses/exit.js +4 -0
  117. package/build/fixtures/responses/index.js +22 -0
  118. package/build/fixtures/responses/recipient-update-final.js +26 -0
  119. package/build/fixtures/schemas/basic-form.js +41 -0
  120. package/build/fixtures/schemas/index.js +22 -0
  121. package/build/fixtures/schemas/number-and-integer.js +43 -0
  122. package/build/fixtures/schemas/one-of.js +225 -0
  123. package/build/fixtures/schemas/string-formats.js +64 -0
  124. package/build/fixtures/utils/image-util.js +22 -0
  125. package/build/formControl/FormControl.js +243 -0
  126. package/build/formControl/index.js +16 -0
  127. package/build/formControl/utils/index.js +17 -0
  128. package/build/formControl/utils/value-utils.js +116 -0
  129. package/build/i18n/index.js +36 -0
  130. package/build/index.d.ts +11 -0
  131. package/build/index.js +35 -0
  132. package/build/jsonSchemaForm/JsonSchemaForm.js +34 -0
  133. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +59 -0
  134. package/build/jsonSchemaForm/allOfSchema/index.js +16 -0
  135. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +30 -0
  136. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +31 -0
  137. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +16 -0
  138. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +145 -0
  139. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +20 -0
  140. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +16 -0
  141. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +18 -0
  142. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +90 -0
  143. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +21 -0
  144. package/build/jsonSchemaForm/arrayTypeSchema/index.js +16 -0
  145. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +108 -0
  146. package/build/jsonSchemaForm/basicTypeSchema/index.js +16 -0
  147. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +84 -0
  148. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +55 -0
  149. package/build/jsonSchemaForm/controlFeedback/index.js +16 -0
  150. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +127 -0
  151. package/build/jsonSchemaForm/genericSchema/index.js +16 -0
  152. package/build/jsonSchemaForm/help/Help.js +14 -0
  153. package/build/jsonSchemaForm/help/Help.messages.js +10 -0
  154. package/build/jsonSchemaForm/help/index.js +16 -0
  155. package/build/jsonSchemaForm/index.js +16 -0
  156. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +83 -0
  157. package/build/jsonSchemaForm/objectSchema/index.js +16 -0
  158. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +155 -0
  159. package/build/jsonSchemaForm/oneOfSchema/index.js +16 -0
  160. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +13 -0
  161. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +18 -0
  162. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +70 -0
  163. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +31 -0
  164. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +10 -0
  165. package/build/jsonSchemaForm/persistAsyncSchema/index.js +16 -0
  166. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +173 -0
  167. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +16 -0
  168. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +131 -0
  169. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +36 -0
  170. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +16 -0
  171. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +77 -0
  172. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +16 -0
  173. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +12 -0
  174. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +29 -0
  175. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +36 -0
  176. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +34 -0
  177. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +60 -0
  178. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +15 -0
  179. package/build/jsonSchemaForm/readOnlySchema/index.js +16 -0
  180. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +111 -0
  181. package/build/jsonSchemaForm/schemaFormControl/index.js +16 -0
  182. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +77 -0
  183. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +17 -0
  184. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +127 -0
  185. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +151 -0
  186. package/build/jsonSchemaForm/validationAsyncSchema/index.js +16 -0
  187. package/build/layout/DynamicLayout.js +63 -0
  188. package/build/layout/alert/DynamicAlert.js +31 -0
  189. package/build/layout/box/DynamicBox.js +43 -0
  190. package/build/layout/button/DynamicButton.js +60 -0
  191. package/build/layout/columns/DynamicColumns.js +40 -0
  192. package/build/layout/decision/DynamicDecision.js +40 -0
  193. package/build/layout/divider/DynamicDivider.js +11 -0
  194. package/build/layout/external/DynamicExternal.js +37 -0
  195. package/build/layout/external/DynamicExternal.messages.js +10 -0
  196. package/build/layout/form/DynamicForm.js +27 -0
  197. package/build/layout/heading/DynamicHeading.js +33 -0
  198. package/build/layout/icon/DynamicIcon.js +50 -0
  199. package/build/layout/image/DynamicImage.js +112 -0
  200. package/build/layout/index.js +48 -0
  201. package/build/layout/info/DynamicInfo.js +21 -0
  202. package/build/layout/list/DynamicList.js +33 -0
  203. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +13 -0
  204. package/build/layout/paragraph/DynamicParagraph.js +48 -0
  205. package/build/layout/paragraph/DynamicParagraph.messages.js +15 -0
  206. package/build/layout/paragraph/useSnackBarIfAvailable.js +13 -0
  207. package/build/layout/review/DynamicReview.js +35 -0
  208. package/build/layout/utils.js +35 -0
  209. package/build/step/cameraStep/CameraStep.js +130 -0
  210. package/build/step/cameraStep/cameraCapture/CameraCapture.js +127 -0
  211. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +20 -0
  212. package/build/step/cameraStep/cameraCapture/components/index.js +36 -0
  213. package/build/step/cameraStep/cameraCapture/hooks/index.js +84 -0
  214. package/build/step/cameraStep/cameraCapture/index.js +16 -0
  215. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +80 -0
  216. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +24 -0
  217. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +15 -0
  218. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +26 -0
  219. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +20 -0
  220. package/build/step/cameraStep/cameraCapture/screens/index.js +18 -0
  221. package/build/step/cameraStep/cameraCapture/tracking/index.js +104 -0
  222. package/build/step/cameraStep/cameraCapture/utils/index.js +114 -0
  223. package/build/step/cameraStep/index.js +16 -0
  224. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +69 -0
  225. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +25 -0
  226. package/build/step/externalConfirmationStep/index.js +16 -0
  227. package/build/step/index.js +20 -0
  228. package/build/step/layoutStep/LayoutStep.js +35 -0
  229. package/build/step/layoutStep/index.js +16 -0
  230. package/build/step/layoutStep/utils/index.js +18 -0
  231. package/build/step/layoutStep/utils/inline-reference-utils.js +95 -0
  232. package/build/step/layoutStep/utils/layout-utils.js +222 -0
  233. package/build/types/common/FormControl.js +2 -0
  234. package/build/types/index.d.ts +15 -10
  235. package/build/types/index.js +42 -0
  236. package/build/types/specification/Action.js +2 -0
  237. package/build/types/specification/FileUploadSchema.js +8 -0
  238. package/build/types/specification/LayoutComponent.js +2 -0
  239. package/build/types/specification/Model.js +38 -0
  240. package/build/types/specification/PersistAsync.js +2 -0
  241. package/build/types/specification/Polling.js +2 -0
  242. package/build/types/specification/Promotion.js +2 -0
  243. package/build/types/specification/Schema.js +67 -0
  244. package/build/types/specification/Step.js +8 -0
  245. package/build/types/specification/ValidationAsync.js +2 -0
  246. package/build/types/specification/core.js +2 -0
  247. package/package.json +24 -26
  248. package/build/main.cjs.js +0 -6980
  249. package/build/main.cjs.min.js +0 -10
  250. package/build/main.esm.js +0 -6993
  251. package/build/main.esm.min.js +0 -10
  252. package/build/main.js +0 -6970
  253. package/build/main.min.js +0 -10
  254. package/build/types/types/index.d.ts +0 -15
  255. /package/build/{types/common → common}/constants/DateMode.d.ts +0 -0
  256. /package/build/{types/common → common}/constants/FormControlType.d.ts +0 -0
  257. /package/build/{types/common → common}/constants/MonthFormat.d.ts +0 -0
  258. /package/build/{types/common → common}/constants/SchemaType.d.ts +0 -0
  259. /package/build/{types/common → common}/constants/Size.d.ts +0 -0
  260. /package/build/{types/common → common}/constants/index.d.ts +0 -0
  261. /package/build/{types/common → common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
  262. /package/build/{types/common → common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
  263. /package/build/{types/common → common}/contexts/eventsContext/EventsContext.d.ts +0 -0
  264. /package/build/{types/common → common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
  265. /package/build/{types/common → common}/contexts/index.d.ts +0 -0
  266. /package/build/{types/common → common}/contexts/logContext/LogContext.d.ts +0 -0
  267. /package/build/{types/common → common}/hooks/index.d.ts +0 -0
  268. /package/build/{types/common → common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
  269. /package/build/{types/common → common}/hooks/useExternal/useExternal.d.ts +0 -0
  270. /package/build/{types/common → common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
  271. /package/build/{types/common → common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
  272. /package/build/{types/common → common}/hooks/usePolling/usePolling.d.ts +0 -0
  273. /package/build/{types/common → common}/hooks/usePrevious/usePrevious.d.ts +0 -0
  274. /package/build/{types/common → common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
  275. /package/build/{types/common → common}/makeFetcher/index.d.ts +0 -0
  276. /package/build/{types/common → common}/makeFetcher/makeFetcher.d.ts +0 -0
  277. /package/build/{types/common → common}/messages.d.ts +0 -0
  278. /package/build/{types/common → common}/utils/api-utils.d.ts +0 -0
  279. /package/build/{types/common → common}/utils/date-utils.d.ts +0 -0
  280. /package/build/{types/common → common}/utils/debounce.d.ts +0 -0
  281. /package/build/{types/common → common}/utils/file-utils.d.ts +0 -0
  282. /package/build/{types/common → common}/utils/id-utils.d.ts +0 -0
  283. /package/build/{types/common → common}/utils/index.d.ts +0 -0
  284. /package/build/{types/common → common}/utils/is-equal.d.ts +0 -0
  285. /package/build/{types/common → common}/utils/schema-utils.d.ts +0 -0
  286. /package/build/{types/common → common}/utils/step-utils.d.ts +0 -0
  287. /package/build/{types/common → common}/validators/index.d.ts +0 -0
  288. /package/build/{types/common → common}/validators/models/model-validators.d.ts +0 -0
  289. /package/build/{types/common → common}/validators/models/models.utils.d.ts +0 -0
  290. /package/build/{types/common → common}/validators/schemas/schema-validators.d.ts +0 -0
  291. /package/build/{types/common → common}/validators/types/type-validators.d.ts +0 -0
  292. /package/build/{types/common → common}/validators/validationFailures/validation-failures.d.ts +0 -0
  293. /package/build/{types/common → common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
  294. /package/build/{types/common → common}/validators/values/value-validators.d.ts +0 -0
  295. /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlow.d.ts +0 -0
  296. /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowStep.d.ts +0 -0
  297. /package/build/{types/dynamicFlow → dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
  298. /package/build/{types/dynamicFlow → dynamicFlow}/index.d.ts +0 -0
  299. /package/build/{types/dynamicFlow → dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
  300. /package/build/{types/dynamicFlow → dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
  301. /package/build/{types/dynamicFlow → dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
  302. /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
  303. /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
  304. /package/build/{types/dynamicFlow → dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
  305. /package/build/{types/dynamicFlow → dynamicFlow}/utils/index.d.ts +0 -0
  306. /package/build/{types/dynamicFlow → dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
  307. /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
  308. /package/build/{types/dynamicFlow → dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
  309. /package/build/{types/dynamicFlow → dynamicFlow}/utils/useLoader.d.ts +0 -0
  310. /package/build/{types/fixtures → fixtures}/components/alert.d.ts +0 -0
  311. /package/build/{types/fixtures → fixtures}/components/box.d.ts +0 -0
  312. /package/build/{types/fixtures → fixtures}/components/button.d.ts +0 -0
  313. /package/build/{types/fixtures → fixtures}/components/columns.d.ts +0 -0
  314. /package/build/{types/fixtures → fixtures}/components/copyable.d.ts +0 -0
  315. /package/build/{types/fixtures → fixtures}/components/decision.d.ts +0 -0
  316. /package/build/{types/fixtures → fixtures}/components/heading.d.ts +0 -0
  317. /package/build/{types/fixtures → fixtures}/components/image.d.ts +0 -0
  318. /package/build/{types/fixtures → fixtures}/components/index.d.ts +0 -0
  319. /package/build/{types/fixtures → fixtures}/components/info.d.ts +0 -0
  320. /package/build/{types/fixtures → fixtures}/components/list.d.ts +0 -0
  321. /package/build/{types/fixtures → fixtures}/components/loading-indicator.d.ts +0 -0
  322. /package/build/{types/fixtures → fixtures}/components/paragraph.d.ts +0 -0
  323. /package/build/{types/fixtures → fixtures}/components/review.d.ts +0 -0
  324. /package/build/{types/fixtures → fixtures}/examples/camera-capture.d.ts +0 -0
  325. /package/build/{types/fixtures → fixtures}/examples/index.d.ts +0 -0
  326. /package/build/{types/fixtures → fixtures}/examples/recipient-update.d.ts +0 -0
  327. /package/build/{types/fixtures → fixtures}/examples/recipient.d.ts +0 -0
  328. /package/build/{types/fixtures → fixtures}/examples/single-file-upload.d.ts +0 -0
  329. /package/build/{types/fixtures → fixtures}/examples/step-validation-errors.d.ts +0 -0
  330. /package/build/{types/fixtures → fixtures}/features/action-response.d.ts +0 -0
  331. /package/build/{types/fixtures → fixtures}/features/external.d.ts +0 -0
  332. /package/build/{types/fixtures → fixtures}/features/index.d.ts +0 -0
  333. /package/build/{types/fixtures → fixtures}/features/persist-async.d.ts +0 -0
  334. /package/build/{types/fixtures → fixtures}/features/polling.d.ts +0 -0
  335. /package/build/{types/fixtures → fixtures}/features/validation-async.d.ts +0 -0
  336. /package/build/{types/fixtures → fixtures}/index.d.ts +0 -0
  337. /package/build/{types/fixtures → fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
  338. /package/build/{types/fixtures → fixtures}/layouts/all.d.ts +0 -0
  339. /package/build/{types/fixtures → fixtures}/layouts/final-step-layout.d.ts +0 -0
  340. /package/build/{types/fixtures → fixtures}/layouts/index.d.ts +0 -0
  341. /package/build/{types/fixtures → fixtures}/layouts/list.d.ts +0 -0
  342. /package/build/{types/fixtures → fixtures}/layouts/pay-in.d.ts +0 -0
  343. /package/build/{types/fixtures → fixtures}/layouts/review.d.ts +0 -0
  344. /package/build/{types/fixtures → fixtures}/layouts/success.d.ts +0 -0
  345. /package/build/{types/fixtures → fixtures}/responses/action-response-final.d.ts +0 -0
  346. /package/build/{types/fixtures → fixtures}/responses/action.d.ts +0 -0
  347. /package/build/{types/fixtures → fixtures}/responses/exit.d.ts +0 -0
  348. /package/build/{types/fixtures → fixtures}/responses/index.d.ts +0 -0
  349. /package/build/{types/fixtures → fixtures}/responses/recipient-update-final.d.ts +0 -0
  350. /package/build/{types/fixtures → fixtures}/schemas/basic-form.d.ts +0 -0
  351. /package/build/{types/fixtures → fixtures}/schemas/index.d.ts +0 -0
  352. /package/build/{types/fixtures → fixtures}/schemas/number-and-integer.d.ts +0 -0
  353. /package/build/{types/fixtures → fixtures}/schemas/one-of.d.ts +0 -0
  354. /package/build/{types/fixtures → fixtures}/schemas/string-formats.d.ts +0 -0
  355. /package/build/{types/fixtures → fixtures}/utils/image-util.d.ts +0 -0
  356. /package/build/{types/formControl → formControl}/FormControl.d.ts +0 -0
  357. /package/build/{types/formControl → formControl}/index.d.ts +0 -0
  358. /package/build/{types/formControl → formControl}/utils/index.d.ts +0 -0
  359. /package/build/{types/formControl → formControl}/utils/value-utils.d.ts +0 -0
  360. /package/build/{types/i18n → i18n}/index.d.ts +0 -0
  361. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
  362. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
  363. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
  364. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
  365. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
  366. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
  367. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
  368. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
  369. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
  370. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
  371. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
  372. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
  373. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
  374. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
  375. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
  376. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
  377. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
  378. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
  379. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
  380. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/genericSchema/index.d.ts +0 -0
  381. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.d.ts +0 -0
  382. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/Help.messages.d.ts +0 -0
  383. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/help/index.d.ts +0 -0
  384. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/index.d.ts +0 -0
  385. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
  386. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/objectSchema/index.d.ts +0 -0
  387. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
  388. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
  389. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
  390. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
  391. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
  392. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
  393. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
  394. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
  395. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
  396. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
  397. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
  398. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
  399. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
  400. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
  401. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
  402. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
  403. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
  404. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
  405. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
  406. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
  407. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
  408. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
  409. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
  410. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
  411. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
  412. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
  413. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
  414. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
  415. /package/build/{types/jsonSchemaForm → jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
  416. /package/build/{types/layout → layout}/DynamicLayout.d.ts +0 -0
  417. /package/build/{types/layout → layout}/alert/DynamicAlert.d.ts +0 -0
  418. /package/build/{types/layout → layout}/box/DynamicBox.d.ts +0 -0
  419. /package/build/{types/layout → layout}/button/DynamicButton.d.ts +0 -0
  420. /package/build/{types/layout → layout}/columns/DynamicColumns.d.ts +0 -0
  421. /package/build/{types/layout → layout}/decision/DynamicDecision.d.ts +0 -0
  422. /package/build/{types/layout → layout}/divider/DynamicDivider.d.ts +0 -0
  423. /package/build/{types/layout → layout}/external/DynamicExternal.d.ts +0 -0
  424. /package/build/{types/layout → layout}/external/DynamicExternal.messages.d.ts +0 -0
  425. /package/build/{types/layout → layout}/form/DynamicForm.d.ts +0 -0
  426. /package/build/{types/layout → layout}/heading/DynamicHeading.d.ts +0 -0
  427. /package/build/{types/layout → layout}/icon/DynamicIcon.d.ts +0 -0
  428. /package/build/{types/layout → layout}/image/DynamicImage.d.ts +0 -0
  429. /package/build/{types/layout → layout}/index.d.ts +0 -0
  430. /package/build/{types/layout → layout}/info/DynamicInfo.d.ts +0 -0
  431. /package/build/{types/layout → layout}/list/DynamicList.d.ts +0 -0
  432. /package/build/{types/layout → layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
  433. /package/build/{types/layout → layout}/paragraph/DynamicParagraph.d.ts +0 -0
  434. /package/build/{types/layout → layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
  435. /package/build/{types/layout → layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
  436. /package/build/{types/layout → layout}/review/DynamicReview.d.ts +0 -0
  437. /package/build/{types/layout → layout}/utils.d.ts +0 -0
  438. /package/build/{types/step → step}/cameraStep/CameraStep.d.ts +0 -0
  439. /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
  440. /package/build/{types/step → step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
  441. /package/build/{types/step → step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
  442. /package/build/{types/step → step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
  443. /package/build/{types/step → step}/cameraStep/cameraCapture/index.d.ts +0 -0
  444. /package/build/{types/step → step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
  445. /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
  446. /package/build/{types/step → step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
  447. /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
  448. /package/build/{types/step → step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
  449. /package/build/{types/step → step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
  450. /package/build/{types/step → step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
  451. /package/build/{types/step → step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
  452. /package/build/{types/step → step}/cameraStep/index.d.ts +0 -0
  453. /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
  454. /package/build/{types/step → step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
  455. /package/build/{types/step → step}/externalConfirmationStep/index.d.ts +0 -0
  456. /package/build/{types/step → step}/index.d.ts +0 -0
  457. /package/build/{types/step → step}/layoutStep/LayoutStep.d.ts +0 -0
  458. /package/build/{types/step → step}/layoutStep/index.d.ts +0 -0
  459. /package/build/{types/step → step}/layoutStep/utils/index.d.ts +0 -0
  460. /package/build/{types/step → step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
  461. /package/build/{types/step → step}/layoutStep/utils/layout-utils.d.ts +0 -0
  462. /package/build/types/{types/common → common}/FormControl.d.ts +0 -0
  463. /package/build/types/{types/specification → specification}/Action.d.ts +0 -0
  464. /package/build/types/{types/specification → specification}/FileUploadSchema.d.ts +0 -0
  465. /package/build/types/{types/specification → specification}/LayoutComponent.d.ts +0 -0
  466. /package/build/types/{types/specification → specification}/Model.d.ts +0 -0
  467. /package/build/types/{types/specification → specification}/PersistAsync.d.ts +0 -0
  468. /package/build/types/{types/specification → specification}/Polling.d.ts +0 -0
  469. /package/build/types/{types/specification → specification}/Promotion.d.ts +0 -0
  470. /package/build/types/{types/specification → specification}/Schema.d.ts +0 -0
  471. /package/build/types/{types/specification → specification}/Step.d.ts +0 -0
  472. /package/build/types/{types/specification → specification}/ValidationAsync.d.ts +0 -0
  473. /package/build/types/{types/specification → specification}/core.d.ts +0 -0
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ exports.__esModule = true;
17
+ var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var contexts_1 = require("../../common/contexts");
19
+ var utils_1 = require("../../common/utils");
20
+ var types_1 = require("../../types");
21
+ var Schema_1 = require("../../types/specification/Schema");
22
+ var allOfSchema_1 = __importDefault(require("../allOfSchema"));
23
+ var arrayTypeSchema_1 = __importDefault(require("../arrayTypeSchema"));
24
+ var basicTypeSchema_1 = __importDefault(require("../basicTypeSchema"));
25
+ var objectSchema_1 = __importDefault(require("../objectSchema"));
26
+ var oneOfSchema_1 = __importDefault(require("../oneOfSchema"));
27
+ var persistAsyncSchema_1 = __importDefault(require("../persistAsyncSchema"));
28
+ var promotedOneOfSchema_1 = __importDefault(require("../promotedOneOfSchema"));
29
+ var readOnlySchema_1 = __importDefault(require("../readOnlySchema"));
30
+ var validationAsyncSchema_1 = __importDefault(require("../validationAsyncSchema"));
31
+ var GenericSchemaForm = function (props) {
32
+ var schema = props.schema, _a = props.model, model = _a === void 0 ? null : _a, _b = props.errors, errors = _b === void 0 ? null : _b, _c = props.hideTitle, hideTitle = _c === void 0 ? false : _c, _d = props.disabled, disabled = _d === void 0 ? false : _d;
33
+ var schemaProps = __assign(__assign({}, props), { model: model, errors: errors, hideTitle: hideTitle, disabled: disabled });
34
+ var type = (0, utils_1.getSchemaType)(schema);
35
+ var log = (0, contexts_1.useLogger)();
36
+ var logInvalidSchemaWarning = function () {
37
+ return log.error('Invalid schema or model', "Schema of type ".concat(type || 'undefined', " requested, but schema did not pass validation."));
38
+ };
39
+ switch (type) {
40
+ case 'readOnly':
41
+ return (0, jsx_runtime_1.jsx)(readOnlySchema_1["default"], __assign({}, schemaProps));
42
+ case 'persistAsync':
43
+ if ((0, types_1.isPersistAsyncSchema)(schema) && (0, types_1.isNullableStringModel)(model) && (0, types_1.isBasicError)(errors)) {
44
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
45
+ return (0, jsx_runtime_1.jsx)(persistAsyncSchema_1["default"], __assign({}, filteredProps));
46
+ }
47
+ else {
48
+ // TODO: MC-3224 Remove this once people have had a chance to fix errors
49
+ logInvalidSchemaWarning();
50
+ return (0, jsx_runtime_1.jsx)(persistAsyncSchema_1["default"], __assign({}, props));
51
+ }
52
+ case 'validationAsync':
53
+ if ((0, types_1.isValidationAsyncSchema)(schema) && (0, types_1.isNullableBasicModel)(model) && (0, types_1.isBasicError)(errors)) {
54
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
55
+ return (0, jsx_runtime_1.jsx)(validationAsyncSchema_1["default"], __assign({}, filteredProps));
56
+ }
57
+ else {
58
+ // TODO: MC-3224
59
+ logInvalidSchemaWarning();
60
+ return (0, jsx_runtime_1.jsx)(validationAsyncSchema_1["default"], __assign({}, props));
61
+ }
62
+ case 'basic': {
63
+ if ((0, types_1.isBasicSchema)(schema) && (0, types_1.isNullableBasicModel)(model) && (0, types_1.isBasicError)(errors)) {
64
+ var filteredProps = __assign(__assign({ infoMessage: null }, schemaProps), { schema: schema, model: model, errors: errors });
65
+ return (0, jsx_runtime_1.jsx)(basicTypeSchema_1["default"], __assign({}, filteredProps));
66
+ }
67
+ else {
68
+ var filteredProps = __assign(__assign({ infoMessage: null }, schemaProps), { schema: schema, model: model, errors: errors });
69
+ // TODO: MC-3224
70
+ logInvalidSchemaWarning();
71
+ return (0, jsx_runtime_1.jsx)(basicTypeSchema_1["default"], __assign({}, filteredProps));
72
+ }
73
+ }
74
+ case 'object':
75
+ if ((0, types_1.isObjectSchema)(schema) && (0, types_1.isNullableObjectModel)(model)) {
76
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
77
+ return (0, jsx_runtime_1.jsx)(objectSchema_1["default"], __assign({}, filteredProps), JSON.stringify(schema));
78
+ }
79
+ else {
80
+ // TODO: MC-3224
81
+ logInvalidSchemaWarning();
82
+ return (0, jsx_runtime_1.jsx)(objectSchema_1["default"], __assign({}, props));
83
+ }
84
+ case 'array':
85
+ if ((0, types_1.isArraySchema)(schema) && (0, types_1.isNullableArrayModel)(model) && (0, types_1.isBasicError)(errors)) {
86
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
87
+ return (0, jsx_runtime_1.jsx)(arrayTypeSchema_1["default"], __assign({}, filteredProps));
88
+ }
89
+ else {
90
+ // TODO: MC-3224
91
+ logInvalidSchemaWarning();
92
+ return (0, jsx_runtime_1.jsx)(arrayTypeSchema_1["default"], __assign({}, props));
93
+ }
94
+ case 'promotedOneOf':
95
+ if ((0, Schema_1.isOneOfObjectSchema)(schema) && (0, types_1.isNullableObjectModel)(model)) {
96
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
97
+ return (0, jsx_runtime_1.jsx)(promotedOneOfSchema_1["default"], __assign({}, filteredProps));
98
+ }
99
+ else {
100
+ // TODO: MC-3224
101
+ logInvalidSchemaWarning();
102
+ return (0, jsx_runtime_1.jsx)(promotedOneOfSchema_1["default"], __assign({}, props));
103
+ }
104
+ case 'oneOf':
105
+ if ((0, types_1.isOneOfSchema)(schema)) {
106
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
107
+ return (0, jsx_runtime_1.jsx)(oneOfSchema_1["default"], __assign({}, filteredProps));
108
+ }
109
+ else {
110
+ // TODO: MC-3224
111
+ logInvalidSchemaWarning();
112
+ return (0, jsx_runtime_1.jsx)(oneOfSchema_1["default"], __assign({}, props));
113
+ }
114
+ case 'allOf':
115
+ if ((0, Schema_1.isAllOfSchema)(schema) && (0, types_1.isObjectModel)(model)) {
116
+ var filteredProps = __assign(__assign({}, schemaProps), { schema: schema, model: model, errors: errors });
117
+ return (0, jsx_runtime_1.jsx)(allOfSchema_1["default"], __assign({}, filteredProps));
118
+ }
119
+ else {
120
+ // TODO: MC-3224
121
+ logInvalidSchemaWarning();
122
+ return (0, jsx_runtime_1.jsx)(allOfSchema_1["default"], __assign({}, props));
123
+ }
124
+ }
125
+ return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
126
+ };
127
+ exports["default"] = GenericSchemaForm;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var GenericSchema_1 = require("./GenericSchema");
16
+ __createBinding(exports, GenericSchema_1, "default");
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ exports.__esModule = true;
6
+ var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var components_1 = require("@transferwise/components");
8
+ var react_intl_1 = require("react-intl");
9
+ var Help_messages_1 = __importDefault(require("./Help.messages"));
10
+ var Help = function (props) {
11
+ var intl = (0, react_intl_1.useIntl)();
12
+ return ((0, jsx_runtime_1.jsx)(components_1.Info, { className: "m-l-1", content: (0, jsx_runtime_1.jsx)(components_1.Markdown, { children: props.help.markdown }), presentation: "POPOVER", size: "sm", "aria-label": intl.formatMessage(Help_messages_1["default"].helpAria) }));
13
+ };
14
+ exports["default"] = Help;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var react_intl_1 = require("react-intl");
4
+ exports["default"] = (0, react_intl_1.defineMessages)({
5
+ helpAria: {
6
+ id: 'dynamicFlows.Help.ariaLabel',
7
+ defaultMessage: 'Click here for more info.',
8
+ description: 'Aria label for help.'
9
+ }
10
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var Help_1 = require("./Help");
16
+ __createBinding(exports, Help_1, "default");
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var JsonSchemaForm_1 = require("./JsonSchemaForm");
16
+ __createBinding(exports, JsonSchemaForm_1, "default");
@@ -0,0 +1,83 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ exports.__esModule = true;
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var classnames_1 = __importDefault(require("classnames"));
28
+ var react_1 = require("react");
29
+ var utils_1 = require("../../common/utils");
30
+ var validators_1 = require("../../common/validators");
31
+ var layout_1 = require("../../layout");
32
+ var genericSchema_1 = __importDefault(require("../genericSchema"));
33
+ var getSchemaColumnClasses = function (width) {
34
+ return {
35
+ 'col-xs-12': true,
36
+ 'col-sm-6': width === 'md',
37
+ 'col-sm-4': width === 'sm'
38
+ };
39
+ };
40
+ var ObjectSchema = function (props) {
41
+ var _a = (0, react_1.useState)(function () { return (__assign({}, (0, validators_1.getValidObjectModelParts)(props.model, props.schema))); }), model = _a[0], setModel = _a[1];
42
+ var onChangeProperty = function (propertyName, onChangeProps) {
43
+ if (onChangeProps.model !== null) {
44
+ // FIXME we should not mutate the model here
45
+ // eslint-disable-next-line fp/no-mutation
46
+ model[propertyName] = onChangeProps.model;
47
+ }
48
+ else {
49
+ delete model[propertyName];
50
+ }
51
+ setModel(model);
52
+ props.onChange(__assign(__assign({}, onChangeProps), { model: model }));
53
+ };
54
+ var isRequired = function (propertyName) {
55
+ return props.schema.required && props.schema.required.includes(propertyName);
56
+ };
57
+ (0, react_1.useEffect)(function () {
58
+ // When the schema changes, only retain valid parts of the model
59
+ var newModel = (0, validators_1.getValidObjectModelParts)(model, props.schema) || {};
60
+ setModel(newModel);
61
+ if (!(0, utils_1.isEqual)(newModel, model)) {
62
+ props.onChange({
63
+ model: newModel,
64
+ triggerSchema: props.schema,
65
+ triggerModel: newModel
66
+ });
67
+ }
68
+ }, [props.schema]);
69
+ var allorderedPropertiesSet = new Set(__spreadArray(__spreadArray([], (props.schema.displayOrder || []), true), Object.keys(props.schema.properties), true));
70
+ var isPropertyDefined = function (propertyName) {
71
+ return typeof props.schema.properties[propertyName] !== 'undefined';
72
+ };
73
+ // eslint-disable-next-line unicorn/prefer-spread
74
+ var orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
75
+ // TODO: LOW avoid type assertion -- what happens when props.errors is not an object?
76
+ var propsErrors = props.errors;
77
+ return ((0, jsx_runtime_1.jsxs)("fieldset", { children: [props.schema.title && !props.hideTitle && (0, jsx_runtime_1.jsxs)("legend", { children: [" ", props.schema.title, " "] }), props.schema.description && !props.hideTitle && (0, jsx_runtime_1.jsxs)("p", { children: [" ", props.schema.description, " "] }), props.schema.alert && (0, jsx_runtime_1.jsx)(layout_1.DynamicAlert, { component: props.schema.alert }), (0, jsx_runtime_1.jsx)("div", __assign({ className: "row" }, { children: orderedPropertyNames.map(function (propertyName) { return ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, classnames_1["default"])(getSchemaColumnClasses(props.schema.properties[propertyName].width)) }, { children: (0, jsx_runtime_1.jsx)(genericSchema_1["default"], { schema: props.schema.properties[propertyName], model: props.model && props.model[propertyName], errors: propsErrors && propsErrors[propertyName], submitted: props.submitted, required: isRequired(propertyName), disabled: props.disabled, onChange: function (onChangeProps) { return onChangeProperty(propertyName, onChangeProps); }, onPersistAsync: props.onPersistAsync }) }), propertyName)); }) }))] }));
78
+ };
79
+ ObjectSchema.defaultProps = {
80
+ hideTitle: false,
81
+ disabled: false
82
+ };
83
+ exports["default"] = ObjectSchema;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var ObjectSchema_1 = require("./ObjectSchema");
16
+ __createBinding(exports, ObjectSchema_1, "default");
@@ -0,0 +1,155 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
25
+ exports.__esModule = true;
26
+ var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var classnames_1 = __importDefault(require("classnames"));
28
+ var react_1 = require("react");
29
+ var contexts_1 = require("../../common/contexts");
30
+ var hooks_1 = require("../../common/hooks");
31
+ var utils_1 = require("../../common/utils");
32
+ var validators_1 = require("../../common/validators");
33
+ var layout_1 = require("../../layout");
34
+ var controlFeedback_1 = __importDefault(require("../controlFeedback"));
35
+ var genericSchema_1 = __importDefault(require("../genericSchema"));
36
+ var help_1 = __importDefault(require("../help"));
37
+ var schemaFormControl_1 = __importDefault(require("../schemaFormControl"));
38
+ var utils_2 = require("./utils");
39
+ var OneOfSchema = function (props) {
40
+ var onEvent = (0, contexts_1.useEventDispatcher)();
41
+ var _a = (0, react_1.useState)(false), changed = _a[0], setChanged = _a[1];
42
+ var _b = (0, react_1.useState)(false), focused = _b[0], setFocused = _b[1];
43
+ var _c = (0, react_1.useState)(false), blurred = _c[0], setBlurred = _c[1];
44
+ var id = (0, react_1.useMemo)(function () { return props.schema.$id || (0, utils_1.generateRandomId)(); }, [props.schema.$id]);
45
+ var _d = (0, react_1.useState)((0, utils_2.getActiveSchemaIndex)(props.schema, props.model)), schemaIndex = _d[0], setSchemaIndex = _d[1];
46
+ var _e = (0, react_1.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf)), models = _e[0], setModels = _e[1];
47
+ var debouncedTrackEvent = (0, hooks_1.useDebouncedFunction)(onEvent, 200);
48
+ var onSearchChange = function (searchValue) {
49
+ debouncedTrackEvent('Dynamic Flow - OneOf Searched', {
50
+ oneOfId: props.schema.analyticsId,
51
+ searchValueLength: searchValue.length
52
+ });
53
+ };
54
+ // When the schema we receive from parent changes
55
+ (0, react_1.useEffect)(function () {
56
+ var modelIndex = (0, utils_2.getValidIndexFromValue)(props.schema, props.model);
57
+ var defaultIndex = (0, utils_2.getValidIndexFromValue)(props.schema, props.schema["default"]);
58
+ if (modelIndex === -1 && defaultIndex >= 0) {
59
+ onChooseNewSchema(defaultIndex, 'init');
60
+ }
61
+ }, [props.schema]);
62
+ if (!(0, validators_1.isArray)(props.schema.oneOf)) {
63
+ // eslint-disable-next-line no-console
64
+ console.error('Incorrect format', props.schema);
65
+ return null;
66
+ }
67
+ var onChildModelChange = function (index, onChangeParameters) {
68
+ setModels(__spreadArray(__spreadArray(__spreadArray([], models.slice(0, index), true), [onChangeParameters.model], false), models.slice(index + 1), true));
69
+ setChanged(true);
70
+ props.onChange(onChangeParameters);
71
+ };
72
+ var onFocus = function () {
73
+ setFocused(true);
74
+ };
75
+ var onBlur = function () {
76
+ setFocused(false);
77
+ setBlurred(true);
78
+ };
79
+ // TODO: LOW avoid type assertion
80
+ var onChooseNewSchema = function (index, type) {
81
+ setSchemaIndex(index);
82
+ var newSchema = props.schema.oneOf[index];
83
+ if ((0, utils_2.isConstSchema)(newSchema)) {
84
+ // If new schema is a const we want to share the parent schema, not the const
85
+ var model = newSchema["const"];
86
+ props.onChange({
87
+ model: model,
88
+ triggerSchema: props.schema,
89
+ triggerModel: model,
90
+ type: type
91
+ });
92
+ }
93
+ else {
94
+ props.onChange({
95
+ model: models[index],
96
+ triggerSchema: newSchema,
97
+ triggerModel: models[index],
98
+ type: type
99
+ });
100
+ }
101
+ if (type !== 'init' && props.schema.analyticsId) {
102
+ onEvent('Dynamic Flow - OneOf Selected', {
103
+ oneOfId: props.schema.analyticsId,
104
+ schemaId: newSchema === null || newSchema === void 0 ? void 0 : newSchema.analyticsId
105
+ });
106
+ }
107
+ };
108
+ var schemaForSelect = mapSchemasForSelect(props.schema);
109
+ var validations = getValidations(props, schemaIndex);
110
+ var formGroupClasses = {
111
+ 'form-group': true,
112
+ 'has-error': (!changed && props.errors && !(0, validators_1.isEmpty)(props.errors)) ||
113
+ ((props.submitted || (changed && blurred)) && validations.length)
114
+ };
115
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(props.schema.oneOf.length > 1 || (0, utils_2.isConstSchema)(props.schema.oneOf[0])) && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, classnames_1["default"])(formGroupClasses) }, { children: [getTitleAndHelp(props.schema, id), (0, jsx_runtime_1.jsx)(schemaFormControl_1["default"], { id: id, schema: schemaForSelect, value: schemaIndex, disabled: props.disabled, onChange: onChooseNewSchema, onFocus: onFocus, onBlur: onBlur, onSearchChange: onSearchChange }), (0, jsx_runtime_1.jsx)(controlFeedback_1["default"], { changed: changed, focused: focused, blurred: blurred, submitted: props.submitted, errors: errorsToString(props.errors), schema: props.schema, validations: validations, infoMessage: null })] })), props.schema.alert && (0, jsx_runtime_1.jsx)(layout_1.DynamicAlert, { component: props.schema.alert })] })), (0, utils_2.isNoNConstSchema)(props.schema.oneOf[schemaIndex]) && ((0, jsx_runtime_1.jsx)(genericSchema_1["default"], { schema: props.schema.oneOf[schemaIndex], model: models[schemaIndex], errors: props.errors, submitted: props.submitted, hideTitle: true, disabled: props.disabled, onChange: function (parameters) { return onChildModelChange(schemaIndex, parameters); }, onPersistAsync: props.onPersistAsync }))] }));
116
+ };
117
+ function getTitleAndHelp(schema, id) {
118
+ var helpElement = schema.help ? (0, jsx_runtime_1.jsx)(help_1["default"], { help: schema.help }) : null;
119
+ var titleElement = (0, utils_2.isConstSchema)(schema.oneOf[0]) ? ((0, jsx_runtime_1.jsxs)("label", __assign({ className: "control-label d-inline", htmlFor: id }, { children: [schema.title, " ", helpElement] }))) : ((0, jsx_runtime_1.jsxs)("h4", __assign({ className: "m-b-2" }, { children: [schema.title, " ", helpElement] })));
120
+ return schema.title ? titleElement : helpElement;
121
+ }
122
+ function getValidations(props, schemaIndex) {
123
+ var selectedSchema = props.schema.oneOf[schemaIndex !== null && schemaIndex !== void 0 ? schemaIndex : -1];
124
+ if ((0, utils_2.isConstSchema)(selectedSchema)) {
125
+ return (0, validators_1.getValidationFailures)(selectedSchema["const"], props.schema, !!props.required);
126
+ }
127
+ if (schemaIndex === null || schemaIndex < 0) {
128
+ return (0, validators_1.getValidationFailures)(null, props.schema, !!props.required);
129
+ }
130
+ return [];
131
+ }
132
+ function errorsToString(errors) {
133
+ // When oneOf represents a select, errors should be of type string
134
+ if (typeof errors === 'string') {
135
+ return errors;
136
+ }
137
+ return null;
138
+ }
139
+ function getModelPartsForSchemas(model, schemas) {
140
+ return schemas.map(function (schema) { return (0, validators_1.getValidModelParts)(model, schema); });
141
+ }
142
+ // We want our model to be the index, so alter the oneOf schemas to be a const
143
+ function mapSchemasForSelect(schema) {
144
+ return __assign(__assign({}, schema), { oneOf: schema.oneOf.map(mapOneOfToConst) });
145
+ }
146
+ function mapOneOfToConst(schema, index) {
147
+ var title = schema.title, description = schema.description, _a = schema.disabled, disabled = _a === void 0 ? false : _a, icon = schema.icon, image = schema.image, keywords = schema.keywords;
148
+ // TODO LOW avoid type assertion below -- consider adding { type: 'integer' }
149
+ return { title: title, description: description, disabled: disabled, icon: icon, image: image, "const": index, keywords: keywords };
150
+ }
151
+ OneOfSchema.defaultProps = {
152
+ required: false,
153
+ disabled: false
154
+ };
155
+ exports["default"] = OneOfSchema;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var OneOfSchema_1 = require("./OneOfSchema");
16
+ __createBinding(exports, OneOfSchema_1, "default");
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.isNoNConstSchema = exports.isConstSchema = void 0;
4
+ var validators_1 = require("../../../common/validators");
5
+ // TODO HD Move this out of here
6
+ function isConstSchema(schema) {
7
+ return !(0, validators_1.isUndefined)(schema === null || schema === void 0 ? void 0 : schema["const"]);
8
+ }
9
+ exports.isConstSchema = isConstSchema;
10
+ function isNoNConstSchema(schema) {
11
+ return !!schema && !isConstSchema(schema);
12
+ }
13
+ exports.isNoNConstSchema = isNoNConstSchema;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ exports.__esModule = true;
17
+ __exportStar(require("./const-schema-utils"), exports);
18
+ __exportStar(require("./one-of-utils"), exports);
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.getBestMatchingSchemaIndexForValue = exports.getValidIndexFromValue = exports.getActiveSchemaIndex = void 0;
4
+ var validators_1 = require("../../../common/validators");
5
+ var types_1 = require("../../../types");
6
+ var Schema_1 = require("../../../types/specification/Schema");
7
+ var const_schema_utils_1 = require("./const-schema-utils");
8
+ var getActiveSchemaIndex = function (schema, model) {
9
+ var indexFromModel = (0, exports.getValidIndexFromValue)(schema, model);
10
+ // If our model satisfies one of the schemas, use that schema.
11
+ if (indexFromModel >= 0) {
12
+ return indexFromModel;
13
+ }
14
+ // If we have a non-const oneOf and there's only one, active index must be the first one
15
+ if (schema.oneOf.length === 1 && (0, const_schema_utils_1.isNoNConstSchema)(schema.oneOf[0])) {
16
+ return 0;
17
+ }
18
+ if ((0, const_schema_utils_1.isConstSchema)(schema.oneOf[0])) {
19
+ var indexFromDefault = (0, exports.getValidIndexFromValue)(schema, schema["default"]);
20
+ // If the default value satisfies one of the schemas, use that schema.
21
+ if (indexFromDefault >= 0) {
22
+ return indexFromDefault;
23
+ }
24
+ }
25
+ if ((0, Schema_1.isOneOfObjectSchema)(schema) && (0, types_1.isObjectModel)(model) && Object.keys(model).length >= 1) {
26
+ // Even if the model does not satisfy any of the schemas, it may be closer to one of them.
27
+ return getBestMatchingSchemaIndexForValue(schema, model);
28
+ }
29
+ if ((0, Schema_1.isOneOfObjectSchema)(schema) &&
30
+ !(0, validators_1.isUndefined)(schema["default"]) &&
31
+ (0, types_1.isObjectModel)(schema["default"]) &&
32
+ Object.keys(schema["default"]).length >= 1) {
33
+ // Even if the default value does not satisfy any of the schemas, it may be closer to one of them.
34
+ return getBestMatchingSchemaIndexForValue(schema, schema["default"]);
35
+ }
36
+ // Otherwise do not default
37
+ return null;
38
+ };
39
+ exports.getActiveSchemaIndex = getActiveSchemaIndex;
40
+ var getValidIndexFromValue = function (schema, value) {
41
+ return schema.oneOf.findIndex(function (childSchema) { return !(0, validators_1.isUndefined)(value) && (0, validators_1.isValidSchema)(value, childSchema); });
42
+ };
43
+ exports.getValidIndexFromValue = getValidIndexFromValue;
44
+ function getBestMatchingSchemaIndexForValue(schema, value) {
45
+ if (value === null || value === undefined) {
46
+ return null;
47
+ }
48
+ var schemaPoints = schema.oneOf.map(function (childSchema) {
49
+ return getSchemaProperties(childSchema).reduce(function (total, _a) {
50
+ var key = _a[0], propertySchema = _a[1];
51
+ if ((0, const_schema_utils_1.isConstSchema)(propertySchema) && propertySchema["const"] === value[key]) {
52
+ return total + 2;
53
+ }
54
+ else if ((0, const_schema_utils_1.isNoNConstSchema)(propertySchema) && typeof value[key] !== 'undefined') {
55
+ return total + 1;
56
+ }
57
+ return total;
58
+ }, 0);
59
+ });
60
+ if (schemaPoints.every(function (p) { return p === schemaPoints[0]; })) {
61
+ return null;
62
+ }
63
+ return schemaPoints.indexOf(Math.max.apply(Math, schemaPoints));
64
+ }
65
+ exports.getBestMatchingSchemaIndexForValue = getBestMatchingSchemaIndexForValue;
66
+ function getSchemaProperties(childSchema) {
67
+ return childSchema.properties !== null && typeof childSchema.properties === 'object'
68
+ ? Object.entries(childSchema.properties)
69
+ : [];
70
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ exports.__esModule = true;
17
+ var jsx_runtime_1 = require("react/jsx-runtime");
18
+ var persistAsyncBasicSchema_1 = __importDefault(require("./persistAsyncBasicSchema"));
19
+ var persistAsyncBlobSchema_1 = __importDefault(require("./persistAsyncBlobSchema"));
20
+ var PersistAsyncSchema = function (props) {
21
+ var schema = props.schema;
22
+ var persistAsyncSchemaType = schema.persistAsync.schema.type;
23
+ if (persistAsyncSchemaType === 'blob') {
24
+ return ((0, jsx_runtime_1.jsx)(persistAsyncBlobSchema_1["default"], __assign({}, props)));
25
+ }
26
+ return (0, jsx_runtime_1.jsx)(persistAsyncBasicSchema_1["default"], __assign({}, props));
27
+ };
28
+ PersistAsyncSchema.defaultProps = {
29
+ required: false
30
+ };
31
+ exports["default"] = PersistAsyncSchema;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var react_intl_1 = require("react-intl");
4
+ exports["default"] = (0, react_intl_1.defineMessages)({
5
+ genericError: {
6
+ id: 'dynamicFlows.PersistAsyncSchema.genericError',
7
+ defaultMessage: 'Something went wrong, please try again later!',
8
+ description: 'Generic error message for persist async schema'
9
+ }
10
+ });
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ exports.__esModule = true;
14
+ exports["default"] = void 0;
15
+ var PersistAsyncSchema_1 = require("./PersistAsyncSchema");
16
+ __createBinding(exports, PersistAsyncSchema_1, "default");