@wise/dynamic-flow-client 0.4.2 → 0.4.3

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 (468) hide show
  1. package/build/main.js +9606 -0
  2. package/build/main.min.js +31 -0
  3. package/build/types/index.d.ts +11 -15
  4. package/build/types/types/index.d.ts +15 -0
  5. package/package.json +6 -5
  6. package/build/common/constants/DateMode.js +0 -7
  7. package/build/common/constants/FormControlType.js +0 -20
  8. package/build/common/constants/MonthFormat.js +0 -7
  9. package/build/common/constants/SchemaType.js +0 -14
  10. package/build/common/constants/Size.js +0 -10
  11. package/build/common/constants/index.js +0 -21
  12. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +0 -29
  13. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +0 -19
  14. package/build/common/contexts/eventsContext/EventsContext.js +0 -22
  15. package/build/common/contexts/fetcherContexts/FetcherContexts.js +0 -29
  16. package/build/common/contexts/index.js +0 -20
  17. package/build/common/contexts/logContext/LogContext.js +0 -27
  18. package/build/common/hooks/index.js +0 -23
  19. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +0 -13
  20. package/build/common/hooks/useExternal/useExternal.js +0 -19
  21. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +0 -62
  22. package/build/common/hooks/usePersistAsync/usePersistAsync.js +0 -98
  23. package/build/common/hooks/usePolling/usePolling.js +0 -52
  24. package/build/common/hooks/usePrevious/usePrevious.js +0 -12
  25. package/build/common/hooks/useStepPolling/useStepPolling.js +0 -49
  26. package/build/common/makeFetcher/index.js +0 -17
  27. package/build/common/makeFetcher/makeFetcher.js +0 -23
  28. package/build/common/messages.js +0 -10
  29. package/build/common/utils/api-utils.js +0 -19
  30. package/build/common/utils/date-utils.js +0 -27
  31. package/build/common/utils/debounce.js +0 -38
  32. package/build/common/utils/file-utils.js +0 -38
  33. package/build/common/utils/id-utils.js +0 -8
  34. package/build/common/utils/index.js +0 -24
  35. package/build/common/utils/is-equal.js +0 -25
  36. package/build/common/utils/schema-utils.js +0 -55
  37. package/build/common/utils/step-utils.js +0 -47
  38. package/build/common/validators/index.js +0 -28
  39. package/build/common/validators/models/model-validators.js +0 -69
  40. package/build/common/validators/models/models.utils.js +0 -117
  41. package/build/common/validators/schemas/schema-validators.js +0 -99
  42. package/build/common/validators/types/type-validators.js +0 -21
  43. package/build/common/validators/validationFailures/validation-failures.js +0 -151
  44. package/build/common/validators/validationFailures/validation-failures.utils.js +0 -49
  45. package/build/common/validators/values/value-validators.js +0 -7
  46. package/build/dynamicFlow/DynamicFlow.js +0 -250
  47. package/build/dynamicFlow/DynamicFlowStep.js +0 -25
  48. package/build/dynamicFlow/DynamicFlowTypes.js +0 -8
  49. package/build/dynamicFlow/index.js +0 -8
  50. package/build/dynamicFlow/stories/DynamicFlow.story.js +0 -36
  51. package/build/dynamicFlow/stories/EditableDynamicFlow.js +0 -54
  52. package/build/dynamicFlow/stories/fixtureFetcher.js +0 -60
  53. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +0 -29
  54. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +0 -15
  55. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +0 -18
  56. package/build/dynamicFlow/utils/index.js +0 -26
  57. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +0 -66
  58. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +0 -27
  59. package/build/dynamicFlow/utils/useDynamicFlowState.js +0 -91
  60. package/build/dynamicFlow/utils/useLoader.js +0 -15
  61. package/build/fixtures/components/alert.js +0 -33
  62. package/build/fixtures/components/box.js +0 -22
  63. package/build/fixtures/components/button.js +0 -56
  64. package/build/fixtures/components/columns.js +0 -38
  65. package/build/fixtures/components/copyable.js +0 -24
  66. package/build/fixtures/components/decision.js +0 -56
  67. package/build/fixtures/components/heading.js +0 -16
  68. package/build/fixtures/components/image.js +0 -25
  69. package/build/fixtures/components/index.js +0 -32
  70. package/build/fixtures/components/info.js +0 -35
  71. package/build/fixtures/components/list.js +0 -36
  72. package/build/fixtures/components/loading-indicator.js +0 -18
  73. package/build/fixtures/components/paragraph.js +0 -30
  74. package/build/fixtures/components/review.js +0 -62
  75. package/build/fixtures/examples/camera-capture.js +0 -123
  76. package/build/fixtures/examples/index.js +0 -16
  77. package/build/fixtures/examples/recipient-update.js +0 -252
  78. package/build/fixtures/examples/recipient.js +0 -315
  79. package/build/fixtures/examples/single-file-upload.js +0 -100
  80. package/build/fixtures/examples/step-validation-errors.js +0 -77
  81. package/build/fixtures/features/action-response.js +0 -31
  82. package/build/fixtures/features/external.js +0 -33
  83. package/build/fixtures/features/index.js +0 -16
  84. package/build/fixtures/features/persist-async.js +0 -46
  85. package/build/fixtures/features/polling.js +0 -35
  86. package/build/fixtures/features/validation-async.js +0 -40
  87. package/build/fixtures/index.js +0 -38
  88. package/build/fixtures/jsonSchemaForm/allOf.js +0 -121
  89. package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +0 -3
  90. package/build/fixtures/jsonSchemaForm/audRecipient.js +0 -1106
  91. package/build/fixtures/jsonSchemaForm/currency.d.ts +0 -3
  92. package/build/fixtures/jsonSchemaForm/currency.js +0 -50
  93. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +0 -3
  94. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +0 -39
  95. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +0 -3
  96. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +0 -38
  97. package/build/fixtures/jsonSchemaForm/oneOf.d.ts +0 -3
  98. package/build/fixtures/jsonSchemaForm/oneOf.js +0 -121
  99. package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +0 -3
  100. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +0 -55
  101. package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +0 -3
  102. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +0 -58
  103. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +0 -3
  104. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +0 -104
  105. package/build/fixtures/jsonSchemaForm/simple.d.ts +0 -3
  106. package/build/fixtures/jsonSchemaForm/simple.js +0 -50
  107. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +0 -3
  108. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +0 -73
  109. package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +0 -3
  110. package/build/fixtures/jsonSchemaForm/validationAsync.js +0 -25
  111. package/build/fixtures/layouts/all.js +0 -178
  112. package/build/fixtures/layouts/final-step-layout.js +0 -41
  113. package/build/fixtures/layouts/index.js +0 -18
  114. package/build/fixtures/layouts/list.js +0 -35
  115. package/build/fixtures/layouts/pay-in.js +0 -99
  116. package/build/fixtures/layouts/review.js +0 -162
  117. package/build/fixtures/layouts/success.js +0 -68
  118. package/build/fixtures/responses/action-response-final.js +0 -26
  119. package/build/fixtures/responses/action.js +0 -4
  120. package/build/fixtures/responses/exit.js +0 -4
  121. package/build/fixtures/responses/index.js +0 -14
  122. package/build/fixtures/responses/recipient-update-final.js +0 -26
  123. package/build/fixtures/schemas/basic-form.js +0 -41
  124. package/build/fixtures/schemas/index.js +0 -14
  125. package/build/fixtures/schemas/number-and-integer.js +0 -43
  126. package/build/fixtures/schemas/one-of.js +0 -222
  127. package/build/fixtures/schemas/string-formats.js +0 -64
  128. package/build/fixtures/utils/image-util.js +0 -22
  129. package/build/formControl/FormControl.js +0 -213
  130. package/build/formControl/index.js +0 -8
  131. package/build/formControl/utils/index.js +0 -17
  132. package/build/formControl/utils/value-utils.js +0 -111
  133. package/build/i18n/index.js +0 -36
  134. package/build/index.d.ts +0 -11
  135. package/build/index.js +0 -38
  136. package/build/jsonSchemaForm/JsonSchemaForm.js +0 -22
  137. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +0 -46
  138. package/build/jsonSchemaForm/allOfSchema/index.js +0 -8
  139. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +0 -19
  140. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +0 -20
  141. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +0 -8
  142. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +0 -86
  143. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +0 -20
  144. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +0 -8
  145. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +0 -18
  146. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +0 -38
  147. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +0 -20
  148. package/build/jsonSchemaForm/arrayTypeSchema/index.js +0 -8
  149. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +0 -91
  150. package/build/jsonSchemaForm/basicTypeSchema/index.js +0 -8
  151. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +0 -73
  152. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +0 -55
  153. package/build/jsonSchemaForm/controlFeedback/index.js +0 -8
  154. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +0 -118
  155. package/build/jsonSchemaForm/genericSchema/index.js +0 -8
  156. package/build/jsonSchemaForm/help/Help.js +0 -14
  157. package/build/jsonSchemaForm/help/Help.messages.js +0 -10
  158. package/build/jsonSchemaForm/help/index.js +0 -8
  159. package/build/jsonSchemaForm/index.js +0 -8
  160. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +0 -62
  161. package/build/jsonSchemaForm/objectSchema/index.js +0 -8
  162. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +0 -135
  163. package/build/jsonSchemaForm/oneOfSchema/index.js +0 -8
  164. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +0 -13
  165. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +0 -18
  166. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +0 -69
  167. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +0 -20
  168. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +0 -10
  169. package/build/jsonSchemaForm/persistAsyncSchema/index.js +0 -8
  170. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +0 -119
  171. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +0 -8
  172. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +0 -66
  173. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +0 -36
  174. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +0 -8
  175. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +0 -58
  176. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +0 -8
  177. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +0 -12
  178. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +0 -18
  179. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +0 -25
  180. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +0 -23
  181. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +0 -58
  182. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +0 -15
  183. package/build/jsonSchemaForm/readOnlySchema/index.js +0 -8
  184. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +0 -98
  185. package/build/jsonSchemaForm/schemaFormControl/index.js +0 -8
  186. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +0 -77
  187. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +0 -17
  188. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +0 -110
  189. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +0 -89
  190. package/build/jsonSchemaForm/validationAsyncSchema/index.js +0 -8
  191. package/build/layout/DynamicLayout.js +0 -52
  192. package/build/layout/alert/DynamicAlert.js +0 -31
  193. package/build/layout/box/DynamicBox.js +0 -32
  194. package/build/layout/button/DynamicButton.js +0 -49
  195. package/build/layout/columns/DynamicColumns.js +0 -29
  196. package/build/layout/decision/DynamicDecision.js +0 -29
  197. package/build/layout/divider/DynamicDivider.js +0 -10
  198. package/build/layout/external/DynamicExternal.js +0 -25
  199. package/build/layout/external/DynamicExternal.messages.js +0 -10
  200. package/build/layout/form/DynamicForm.js +0 -16
  201. package/build/layout/heading/DynamicHeading.js +0 -22
  202. package/build/layout/icon/DynamicIcon.js +0 -49
  203. package/build/layout/image/DynamicImage.js +0 -62
  204. package/build/layout/index.js +0 -40
  205. package/build/layout/info/DynamicInfo.js +0 -9
  206. package/build/layout/list/DynamicList.js +0 -21
  207. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +0 -12
  208. package/build/layout/paragraph/DynamicParagraph.js +0 -30
  209. package/build/layout/paragraph/DynamicParagraph.messages.js +0 -15
  210. package/build/layout/paragraph/useSnackBarIfAvailable.js +0 -13
  211. package/build/layout/review/DynamicReview.js +0 -23
  212. package/build/layout/utils.js +0 -33
  213. package/build/step/cameraStep/CameraStep.js +0 -84
  214. package/build/step/cameraStep/cameraCapture/CameraCapture.js +0 -70
  215. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +0 -20
  216. package/build/step/cameraStep/cameraCapture/components/index.js +0 -18
  217. package/build/step/cameraStep/cameraCapture/hooks/index.js +0 -29
  218. package/build/step/cameraStep/cameraCapture/index.js +0 -8
  219. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +0 -68
  220. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +0 -13
  221. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +0 -15
  222. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +0 -14
  223. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +0 -20
  224. package/build/step/cameraStep/cameraCapture/screens/index.js +0 -10
  225. package/build/step/cameraStep/cameraCapture/tracking/index.js +0 -22
  226. package/build/step/cameraStep/cameraCapture/utils/index.js +0 -51
  227. package/build/step/cameraStep/index.js +0 -8
  228. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +0 -68
  229. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +0 -25
  230. package/build/step/externalConfirmationStep/index.js +0 -8
  231. package/build/step/index.js +0 -12
  232. package/build/step/layoutStep/LayoutStep.js +0 -35
  233. package/build/step/layoutStep/index.js +0 -8
  234. package/build/step/layoutStep/utils/index.js +0 -7
  235. package/build/step/layoutStep/utils/inline-reference-utils.js +0 -78
  236. package/build/step/layoutStep/utils/layout-utils.js +0 -203
  237. package/build/types/common/FormControl.js +0 -2
  238. package/build/types/index.js +0 -42
  239. package/build/types/specification/Action.js +0 -2
  240. package/build/types/specification/FileUploadSchema.js +0 -8
  241. package/build/types/specification/LayoutComponent.js +0 -2
  242. package/build/types/specification/Model.js +0 -30
  243. package/build/types/specification/PersistAsync.js +0 -2
  244. package/build/types/specification/Polling.js +0 -2
  245. package/build/types/specification/Promotion.js +0 -2
  246. package/build/types/specification/Schema.js +0 -67
  247. package/build/types/specification/Step.js +0 -6
  248. package/build/types/specification/ValidationAsync.js +0 -2
  249. package/build/types/specification/core.js +0 -2
  250. /package/build/{common → types/common}/constants/DateMode.d.ts +0 -0
  251. /package/build/{common → types/common}/constants/FormControlType.d.ts +0 -0
  252. /package/build/{common → types/common}/constants/MonthFormat.d.ts +0 -0
  253. /package/build/{common → types/common}/constants/SchemaType.d.ts +0 -0
  254. /package/build/{common → types/common}/constants/Size.d.ts +0 -0
  255. /package/build/{common → types/common}/constants/index.d.ts +0 -0
  256. /package/build/{common → types/common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
  257. /package/build/{common → types/common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
  258. /package/build/{common → types/common}/contexts/eventsContext/EventsContext.d.ts +0 -0
  259. /package/build/{common → types/common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
  260. /package/build/{common → types/common}/contexts/index.d.ts +0 -0
  261. /package/build/{common → types/common}/contexts/logContext/LogContext.d.ts +0 -0
  262. /package/build/{common → types/common}/hooks/index.d.ts +0 -0
  263. /package/build/{common → types/common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
  264. /package/build/{common → types/common}/hooks/useExternal/useExternal.d.ts +0 -0
  265. /package/build/{common → types/common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
  266. /package/build/{common → types/common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
  267. /package/build/{common → types/common}/hooks/usePolling/usePolling.d.ts +0 -0
  268. /package/build/{common → types/common}/hooks/usePrevious/usePrevious.d.ts +0 -0
  269. /package/build/{common → types/common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
  270. /package/build/{common → types/common}/makeFetcher/index.d.ts +0 -0
  271. /package/build/{common → types/common}/makeFetcher/makeFetcher.d.ts +0 -0
  272. /package/build/{common → types/common}/messages.d.ts +0 -0
  273. /package/build/{common → types/common}/utils/api-utils.d.ts +0 -0
  274. /package/build/{common → types/common}/utils/date-utils.d.ts +0 -0
  275. /package/build/{common → types/common}/utils/debounce.d.ts +0 -0
  276. /package/build/{common → types/common}/utils/file-utils.d.ts +0 -0
  277. /package/build/{common → types/common}/utils/id-utils.d.ts +0 -0
  278. /package/build/{common → types/common}/utils/index.d.ts +0 -0
  279. /package/build/{common → types/common}/utils/is-equal.d.ts +0 -0
  280. /package/build/{common → types/common}/utils/schema-utils.d.ts +0 -0
  281. /package/build/{common → types/common}/utils/step-utils.d.ts +0 -0
  282. /package/build/{common → types/common}/validators/index.d.ts +0 -0
  283. /package/build/{common → types/common}/validators/models/model-validators.d.ts +0 -0
  284. /package/build/{common → types/common}/validators/models/models.utils.d.ts +0 -0
  285. /package/build/{common → types/common}/validators/schemas/schema-validators.d.ts +0 -0
  286. /package/build/{common → types/common}/validators/types/type-validators.d.ts +0 -0
  287. /package/build/{common → types/common}/validators/validationFailures/validation-failures.d.ts +0 -0
  288. /package/build/{common → types/common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
  289. /package/build/{common → types/common}/validators/values/value-validators.d.ts +0 -0
  290. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlow.d.ts +0 -0
  291. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowStep.d.ts +0 -0
  292. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
  293. /package/build/{dynamicFlow → types/dynamicFlow}/index.d.ts +0 -0
  294. /package/build/{dynamicFlow → types/dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
  295. /package/build/{dynamicFlow → types/dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
  296. /package/build/{dynamicFlow → types/dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
  297. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
  298. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
  299. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
  300. /package/build/{dynamicFlow → types/dynamicFlow}/utils/index.d.ts +0 -0
  301. /package/build/{dynamicFlow → types/dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
  302. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
  303. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
  304. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useLoader.d.ts +0 -0
  305. /package/build/{fixtures → types/fixtures}/components/alert.d.ts +0 -0
  306. /package/build/{fixtures → types/fixtures}/components/box.d.ts +0 -0
  307. /package/build/{fixtures → types/fixtures}/components/button.d.ts +0 -0
  308. /package/build/{fixtures → types/fixtures}/components/columns.d.ts +0 -0
  309. /package/build/{fixtures → types/fixtures}/components/copyable.d.ts +0 -0
  310. /package/build/{fixtures → types/fixtures}/components/decision.d.ts +0 -0
  311. /package/build/{fixtures → types/fixtures}/components/heading.d.ts +0 -0
  312. /package/build/{fixtures → types/fixtures}/components/image.d.ts +0 -0
  313. /package/build/{fixtures → types/fixtures}/components/index.d.ts +0 -0
  314. /package/build/{fixtures → types/fixtures}/components/info.d.ts +0 -0
  315. /package/build/{fixtures → types/fixtures}/components/list.d.ts +0 -0
  316. /package/build/{fixtures → types/fixtures}/components/loading-indicator.d.ts +0 -0
  317. /package/build/{fixtures → types/fixtures}/components/paragraph.d.ts +0 -0
  318. /package/build/{fixtures → types/fixtures}/components/review.d.ts +0 -0
  319. /package/build/{fixtures → types/fixtures}/examples/camera-capture.d.ts +0 -0
  320. /package/build/{fixtures → types/fixtures}/examples/index.d.ts +0 -0
  321. /package/build/{fixtures → types/fixtures}/examples/recipient-update.d.ts +0 -0
  322. /package/build/{fixtures → types/fixtures}/examples/recipient.d.ts +0 -0
  323. /package/build/{fixtures → types/fixtures}/examples/single-file-upload.d.ts +0 -0
  324. /package/build/{fixtures → types/fixtures}/examples/step-validation-errors.d.ts +0 -0
  325. /package/build/{fixtures → types/fixtures}/features/action-response.d.ts +0 -0
  326. /package/build/{fixtures → types/fixtures}/features/external.d.ts +0 -0
  327. /package/build/{fixtures → types/fixtures}/features/index.d.ts +0 -0
  328. /package/build/{fixtures → types/fixtures}/features/persist-async.d.ts +0 -0
  329. /package/build/{fixtures → types/fixtures}/features/polling.d.ts +0 -0
  330. /package/build/{fixtures → types/fixtures}/features/validation-async.d.ts +0 -0
  331. /package/build/{fixtures → types/fixtures}/index.d.ts +0 -0
  332. /package/build/{fixtures → types/fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
  333. /package/build/{fixtures → types/fixtures}/layouts/all.d.ts +0 -0
  334. /package/build/{fixtures → types/fixtures}/layouts/final-step-layout.d.ts +0 -0
  335. /package/build/{fixtures → types/fixtures}/layouts/index.d.ts +0 -0
  336. /package/build/{fixtures → types/fixtures}/layouts/list.d.ts +0 -0
  337. /package/build/{fixtures → types/fixtures}/layouts/pay-in.d.ts +0 -0
  338. /package/build/{fixtures → types/fixtures}/layouts/review.d.ts +0 -0
  339. /package/build/{fixtures → types/fixtures}/layouts/success.d.ts +0 -0
  340. /package/build/{fixtures → types/fixtures}/responses/action-response-final.d.ts +0 -0
  341. /package/build/{fixtures → types/fixtures}/responses/action.d.ts +0 -0
  342. /package/build/{fixtures → types/fixtures}/responses/exit.d.ts +0 -0
  343. /package/build/{fixtures → types/fixtures}/responses/index.d.ts +0 -0
  344. /package/build/{fixtures → types/fixtures}/responses/recipient-update-final.d.ts +0 -0
  345. /package/build/{fixtures → types/fixtures}/schemas/basic-form.d.ts +0 -0
  346. /package/build/{fixtures → types/fixtures}/schemas/index.d.ts +0 -0
  347. /package/build/{fixtures → types/fixtures}/schemas/number-and-integer.d.ts +0 -0
  348. /package/build/{fixtures → types/fixtures}/schemas/one-of.d.ts +0 -0
  349. /package/build/{fixtures → types/fixtures}/schemas/string-formats.d.ts +0 -0
  350. /package/build/{fixtures → types/fixtures}/utils/image-util.d.ts +0 -0
  351. /package/build/{formControl → types/formControl}/FormControl.d.ts +0 -0
  352. /package/build/{formControl → types/formControl}/index.d.ts +0 -0
  353. /package/build/{formControl → types/formControl}/utils/index.d.ts +0 -0
  354. /package/build/{formControl → types/formControl}/utils/value-utils.d.ts +0 -0
  355. /package/build/{i18n → types/i18n}/index.d.ts +0 -0
  356. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
  357. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
  358. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
  359. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
  360. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
  361. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
  362. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
  363. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
  364. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
  365. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
  366. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
  367. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
  368. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
  369. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
  370. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
  371. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
  372. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
  373. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
  374. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
  375. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/index.d.ts +0 -0
  376. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.d.ts +0 -0
  377. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.messages.d.ts +0 -0
  378. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/index.d.ts +0 -0
  379. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/index.d.ts +0 -0
  380. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
  381. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/index.d.ts +0 -0
  382. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
  383. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
  384. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
  385. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
  386. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
  387. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
  388. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
  389. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
  390. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
  391. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
  392. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
  393. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
  394. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
  395. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
  396. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
  397. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
  398. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
  399. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
  400. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
  401. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
  402. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
  403. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
  404. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
  405. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
  406. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
  407. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
  408. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
  409. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
  410. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
  411. /package/build/{layout → types/layout}/DynamicLayout.d.ts +0 -0
  412. /package/build/{layout → types/layout}/alert/DynamicAlert.d.ts +0 -0
  413. /package/build/{layout → types/layout}/box/DynamicBox.d.ts +0 -0
  414. /package/build/{layout → types/layout}/button/DynamicButton.d.ts +0 -0
  415. /package/build/{layout → types/layout}/columns/DynamicColumns.d.ts +0 -0
  416. /package/build/{layout → types/layout}/decision/DynamicDecision.d.ts +0 -0
  417. /package/build/{layout → types/layout}/divider/DynamicDivider.d.ts +0 -0
  418. /package/build/{layout → types/layout}/external/DynamicExternal.d.ts +0 -0
  419. /package/build/{layout → types/layout}/external/DynamicExternal.messages.d.ts +0 -0
  420. /package/build/{layout → types/layout}/form/DynamicForm.d.ts +0 -0
  421. /package/build/{layout → types/layout}/heading/DynamicHeading.d.ts +0 -0
  422. /package/build/{layout → types/layout}/icon/DynamicIcon.d.ts +0 -0
  423. /package/build/{layout → types/layout}/image/DynamicImage.d.ts +0 -0
  424. /package/build/{layout → types/layout}/index.d.ts +0 -0
  425. /package/build/{layout → types/layout}/info/DynamicInfo.d.ts +0 -0
  426. /package/build/{layout → types/layout}/list/DynamicList.d.ts +0 -0
  427. /package/build/{layout → types/layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
  428. /package/build/{layout → types/layout}/paragraph/DynamicParagraph.d.ts +0 -0
  429. /package/build/{layout → types/layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
  430. /package/build/{layout → types/layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
  431. /package/build/{layout → types/layout}/review/DynamicReview.d.ts +0 -0
  432. /package/build/{layout → types/layout}/utils.d.ts +0 -0
  433. /package/build/{step → types/step}/cameraStep/CameraStep.d.ts +0 -0
  434. /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
  435. /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
  436. /package/build/{step → types/step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
  437. /package/build/{step → types/step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
  438. /package/build/{step → types/step}/cameraStep/cameraCapture/index.d.ts +0 -0
  439. /package/build/{step → types/step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
  440. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
  441. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
  442. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
  443. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
  444. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
  445. /package/build/{step → types/step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
  446. /package/build/{step → types/step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
  447. /package/build/{step → types/step}/cameraStep/index.d.ts +0 -0
  448. /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
  449. /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
  450. /package/build/{step → types/step}/externalConfirmationStep/index.d.ts +0 -0
  451. /package/build/{step → types/step}/index.d.ts +0 -0
  452. /package/build/{step → types/step}/layoutStep/LayoutStep.d.ts +0 -0
  453. /package/build/{step → types/step}/layoutStep/index.d.ts +0 -0
  454. /package/build/{step → types/step}/layoutStep/utils/index.d.ts +0 -0
  455. /package/build/{step → types/step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
  456. /package/build/{step → types/step}/layoutStep/utils/layout-utils.d.ts +0 -0
  457. /package/build/types/{common → types/common}/FormControl.d.ts +0 -0
  458. /package/build/types/{specification → types/specification}/Action.d.ts +0 -0
  459. /package/build/types/{specification → types/specification}/FileUploadSchema.d.ts +0 -0
  460. /package/build/types/{specification → types/specification}/LayoutComponent.d.ts +0 -0
  461. /package/build/types/{specification → types/specification}/Model.d.ts +0 -0
  462. /package/build/types/{specification → types/specification}/PersistAsync.d.ts +0 -0
  463. /package/build/types/{specification → types/specification}/Polling.d.ts +0 -0
  464. /package/build/types/{specification → types/specification}/Promotion.d.ts +0 -0
  465. /package/build/types/{specification → types/specification}/Schema.d.ts +0 -0
  466. /package/build/types/{specification → types/specification}/Step.d.ts +0 -0
  467. /package/build/types/{specification → types/specification}/ValidationAsync.d.ts +0 -0
  468. /package/build/types/{specification → types/specification}/core.d.ts +0 -0
@@ -1,20 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const persistAsyncBasicSchema_1 = __importDefault(require("./persistAsyncBasicSchema"));
8
- const persistAsyncBlobSchema_1 = __importDefault(require("./persistAsyncBlobSchema"));
9
- const PersistAsyncSchema = (props) => {
10
- const { schema } = props;
11
- const persistAsyncSchemaType = schema.persistAsync.schema.type;
12
- if (persistAsyncSchemaType === 'blob') {
13
- return ((0, jsx_runtime_1.jsx)(persistAsyncBlobSchema_1.default, Object.assign({}, props)));
14
- }
15
- return (0, jsx_runtime_1.jsx)(persistAsyncBasicSchema_1.default, Object.assign({}, props));
16
- };
17
- PersistAsyncSchema.defaultProps = {
18
- required: false,
19
- };
20
- exports.default = PersistAsyncSchema;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const 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
- });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var PersistAsyncSchema_1 = require("./PersistAsyncSchema");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PersistAsyncSchema_1).default; } });
@@ -1,119 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getErrorFromResponse = exports.getIdFromResponse = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const react_intl_1 = require("react-intl");
10
- const constants_1 = require("../../../common/constants");
11
- const contexts_1 = require("../../../common/contexts");
12
- const hooks_1 = require("../../../common/hooks");
13
- const utils_1 = require("../../../common/utils");
14
- const validators_1 = require("../../../common/validators");
15
- const allOf_1 = __importDefault(require("../../../fixtures/jsonSchemaForm/allOf"));
16
- const basicTypeSchema_1 = __importDefault(require("../../basicTypeSchema"));
17
- const SchemaFormControl_1 = require("../../schemaFormControl/SchemaFormControl");
18
- const PersistAsyncSchema_messages_1 = __importDefault(require("../PersistAsyncSchema.messages"));
19
- // TODO: LOW avoid type assertion below -- consider throwing if return value is not the expected type
20
- const getIdFromResponse = (idProperty, response) => {
21
- return response[idProperty];
22
- };
23
- exports.getIdFromResponse = getIdFromResponse;
24
- const getErrorFromResponse = (errorProperty, response) => {
25
- var _a;
26
- return (_a = response.validation) === null || _a === void 0 ? void 0 : _a[errorProperty];
27
- };
28
- exports.getErrorFromResponse = getErrorFromResponse;
29
- const controlTypesWithPersistOnChange = new Set([
30
- constants_1.FormControlType.RADIO,
31
- constants_1.FormControlType.SELECT,
32
- constants_1.FormControlType.DATELOOKUP,
33
- constants_1.FormControlType.FILE,
34
- constants_1.FormControlType.UPLOAD,
35
- ]);
36
- const PersistAsyncBasicSchema = (props) => {
37
- const intl = (0, react_intl_1.useIntl)();
38
- const fetcher = (0, contexts_1.useFetcher)();
39
- const onEvent = (0, contexts_1.useEventDispatcher)();
40
- const [persistAsyncModel, setPersistAsyncModel] = (0, react_1.useState)(null);
41
- const previousPersistAsyncModel = (0, hooks_1.usePrevious)(persistAsyncModel);
42
- const [persistAsyncError, setPersistAsyncError] = (0, react_1.useState)(null);
43
- const [fieldSubmitted, setFieldSubmitted] = (0, react_1.useState)(false);
44
- const [abortController, setAbortController] = (0, react_1.useState)(null);
45
- (0, react_1.useEffect)(() => {
46
- if (controlTypesWithPersistOnChange.has(
47
- // TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
48
- (0, SchemaFormControl_1.getControlType)(props.schema.persistAsync.schema))) {
49
- persistAsyncIfValid();
50
- }
51
- }, [persistAsyncModel]);
52
- const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(PersistAsyncSchema_messages_1.default.genericError));
53
- const getPersistAsyncResponse = async (currentPersistAsyncModel, persistAsyncSpec) => {
54
- const signal = abortCurrentRequestAndGetNewAbortSignal();
55
- const requestBody = { [persistAsyncSpec.param]: currentPersistAsyncModel };
56
- setFieldSubmitted(true); // persist async initiated implied the field has been submitted
57
- try {
58
- onEvent('Dynamic Flow - PersistAsync', { status: 'pending', schemaId: allOf_1.default.$id });
59
- const persistAsyncFetch = fetcher(persistAsyncSpec.url, {
60
- method: persistAsyncSpec.method,
61
- headers: { 'Content-Type': 'application/json' },
62
- body: JSON.stringify(requestBody),
63
- signal,
64
- });
65
- props.onPersistAsync(persistAsyncFetch);
66
- const response = await persistAsyncFetch;
67
- const responseBody = await response.json();
68
- if (!(0, validators_1.isObject)(responseBody)) {
69
- throw new Error('Response is not an object');
70
- }
71
- const { idProperty, param } = props.schema.persistAsync;
72
- if ((0, utils_1.isStatus2xx)(response.status)) {
73
- const id = (0, exports.getIdFromResponse)(idProperty, responseBody);
74
- props.onChange({ model: id, triggerSchema: props.schema, triggerModel: id });
75
- }
76
- else if ((0, utils_1.isStatus422)(response.status)) {
77
- const { validation } = responseBody;
78
- const error = ((0, validators_1.isObject)(validation) && (validation === null || validation === void 0 ? void 0 : validation[param])) || null;
79
- setPersistAsyncError(error);
80
- props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
81
- }
82
- else {
83
- setGenericPersistAsyncError();
84
- }
85
- onEvent('Dynamic Flow - PersistAsync', { status: 'success', schemaId: allOf_1.default.$id });
86
- }
87
- catch (_a) {
88
- onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: allOf_1.default.$id });
89
- setGenericPersistAsyncError();
90
- }
91
- };
92
- const abortCurrentRequestAndGetNewAbortSignal = () => {
93
- if (abortController) {
94
- abortController.abort();
95
- }
96
- const newAbortController = new AbortController();
97
- setAbortController(newAbortController);
98
- return newAbortController.signal;
99
- };
100
- const persistAsyncIfValid = () => {
101
- if (!(0, validators_1.isNull)(persistAsyncModel) && !(0, utils_1.isEqual)(persistAsyncModel, previousPersistAsyncModel)) {
102
- void getPersistAsyncResponse(persistAsyncModel, props.schema.persistAsync);
103
- }
104
- };
105
- const onBlur = () => {
106
- persistAsyncIfValid();
107
- };
108
- const persistAsyncOnChange = ({ model: newPersistAsyncModel }) => {
109
- setPersistAsyncError(null);
110
- if ((0, validators_1.isValidSchema)(newPersistAsyncModel, props.schema.persistAsync.schema)) {
111
- setPersistAsyncModel(newPersistAsyncModel);
112
- }
113
- };
114
- return ((0, jsx_runtime_1.jsx)(basicTypeSchema_1.default, { required: props.required, submitted: props.submitted || fieldSubmitted, schema: props.schema.persistAsync.schema, errors: persistAsyncError || props.errors, model: null, infoMessage: null, onChange: persistAsyncOnChange, onBlur: onBlur }));
115
- };
116
- PersistAsyncBasicSchema.defaultProps = {
117
- required: false,
118
- };
119
- exports.default = PersistAsyncBasicSchema;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var PersistAsyncBasicSchema_1 = require("./PersistAsyncBasicSchema");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PersistAsyncBasicSchema_1).default; } });
@@ -1,66 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const classnames_1 = __importDefault(require("classnames"));
8
- const react_1 = require("react");
9
- const contexts_1 = require("../../../common/contexts");
10
- const utils_1 = require("../../../common/utils");
11
- const validators_1 = require("../../../common/validators");
12
- const controlFeedback_1 = __importDefault(require("../../controlFeedback"));
13
- const utils_2 = require("../../schemaFormControl/utils");
14
- const PersistAsyncBasicSchema_1 = require("../persistAsyncBasicSchema/PersistAsyncBasicSchema");
15
- const UploadInputAdapter_1 = require("./UploadInputAdapter");
16
- const PersistAsyncBlobSchema = (props) => {
17
- const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, react_1.useState)({});
18
- const [persistAsyncValidations, setPersistAsyncValidations] = (0, react_1.useState)(null);
19
- const [validations, setValidations] = (0, react_1.useState)([]);
20
- const [changed, setChanged] = (0, react_1.useState)(false);
21
- const fetcher = (0, contexts_1.useFetcher)();
22
- const onEvent = (0, contexts_1.useEventDispatcher)();
23
- const refreshValidations = () => {
24
- if (props.submitted) {
25
- setValidations((0, validators_1.getValidationFailures)(props.model, props.schema, !!props.required));
26
- }
27
- };
28
- (0, react_1.useEffect)(refreshValidations, [props.model, props.submitted]);
29
- const onSuccess = async (httpResponse, _fileName) => {
30
- const jsonResponse = (await httpResponse.json());
31
- const id = (0, PersistAsyncBasicSchema_1.getIdFromResponse)(props.schema.persistAsync.idProperty, jsonResponse);
32
- props.onChange({ model: id, triggerSchema: props.schema, triggerModel: id });
33
- setChanged(true);
34
- onEvent('Dynamic Flow - PersistAsync', { status: 'success', schemaId: props.schema.$id });
35
- };
36
- const onFailure = async (errorResponse) => {
37
- if (errorResponse.response && (0, utils_1.isStatus422)(errorResponse.response.status)) {
38
- const jsonResponse = (await errorResponse.response.json());
39
- setPersistAsyncValidationMessages(jsonResponse.validation || {});
40
- setPersistAsyncValidations([props.schema.persistAsync.param]);
41
- }
42
- props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
43
- setChanged(true);
44
- onEvent('Dynamic Flow - PersistAsync', { status: 'failure', schemaId: props.schema.$id });
45
- };
46
- const onCancel = () => {
47
- setPersistAsyncValidations(null);
48
- props.onChange({ model: null, triggerSchema: props.schema, triggerModel: null });
49
- setChanged(true);
50
- };
51
- const { url, method } = props.schema.persistAsync;
52
- const combinedValidations = persistAsyncValidations || validations;
53
- const formGroupClasses = {
54
- 'form-group': true,
55
- 'has-error': (props.submitted || changed) && !!combinedValidations.length,
56
- };
57
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, classnames_1.default)(formGroupClasses) }, { children: [(0, jsx_runtime_1.jsx)(UploadInputAdapter_1.UploadInputAdapter, Object.assign({ id: props.schema.$id ||
58
- props.schema.persistAsync.schema.$id ||
59
- props.schema.persistAsync.idProperty,
60
- // TODO: LOW avoid type assertion -- model can be null, but fileId must be number | string -- or maybe make fileId: string| number | undefined
61
- fileId: props.model, idProperty: props.schema.persistAsync.idProperty, animationDelay: 0, maxSize: props.schema.persistAsync.schema.maxSize, usLabel: props.schema.title || props.schema.persistAsync.schema.title, usPlaceholder: props.schema.description || props.schema.persistAsync.schema.description, httpOptions: { url, method, fileInputName: props.schema.persistAsync.param }, fetcher: fetcher, onSuccess: onSuccess, onFailure: onFailure, onCancel: onCancel }, (0, utils_2.mapSchemaToUploadOptions)(props.schema.persistAsync.schema))), (0, jsx_runtime_1.jsx)(controlFeedback_1.default, { blurred: true, focused: false, changed: changed, submitted: props.submitted, errors: props.errors, schema: props.schema, validations: combinedValidations, validationMessages: Object.assign({ required: 'Value is required...' }, persistAsyncValidationMessages), infoMessage: null })] })));
62
- };
63
- PersistAsyncBlobSchema.defaultProps = {
64
- required: false,
65
- };
66
- exports.default = PersistAsyncBlobSchema;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UploadInputAdapter = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const components_1 = require("@transferwise/components");
6
- const react_1 = require("react");
7
- const contexts_1 = require("../../../common/contexts");
8
- const utils_1 = require("../../../common/utils");
9
- const UploadInputAdapter = (props) => {
10
- const { id, fetcher = fetch, httpOptions, fileId, idProperty, usAccept, maxSize, usPlaceholder, onSuccess, onFailure, onCancel, } = props;
11
- const onEvent = (0, contexts_1.useEventDispatcher)();
12
- const files = (0, react_1.useMemo)(() => (fileId ? [{ id: fileId, status: components_1.Status.SUCCEEDED }] : []), [fileId]);
13
- const uploadFile = (formData) => {
14
- onEvent('Dynamic Flow - PersistAsync', { status: 'pending', schemaId: id });
15
- return fetcher(`${httpOptions.url}`, {
16
- method: httpOptions.method || 'POST',
17
- body: formData,
18
- }).then((response) => {
19
- if (response.ok) {
20
- onSuccess && onSuccess(response.clone());
21
- return response.json().then((responseBody) => {
22
- return { id: responseBody[idProperty] };
23
- });
24
- }
25
- else {
26
- onFailure && onFailure({ response });
27
- return Promise.reject();
28
- }
29
- });
30
- };
31
- return ((0, jsx_runtime_1.jsx)(components_1.UploadInput, { id: id, fileInputName: httpOptions.fileInputName, files: files, uploadButtonTitle: props.usLabel, sizeLimit: maxSize ? (0, utils_1.toKilobytes)(maxSize) : undefined, fileTypes: usAccept, description: usPlaceholder, onUploadFile: uploadFile, onDeleteFile: (_id) => {
32
- onCancel && onCancel();
33
- return Promise.resolve();
34
- } }));
35
- };
36
- exports.UploadInputAdapter = UploadInputAdapter;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var PersistAsyncBlobSchema_1 = require("./PersistAsyncBlobSchema");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PersistAsyncBlobSchema_1).default; } });
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const layout_1 = require("../../layout");
9
- const genericSchema_1 = __importDefault(require("../genericSchema"));
10
- const objectSchema_1 = __importDefault(require("../objectSchema"));
11
- const promoted_one_of_utils_1 = require("./promoted-one-of-utils");
12
- const PromotedOneOfControl_1 = __importDefault(require("./promotedOneOfControl/PromotedOneOfControl"));
13
- const isPromoted = (schema) => schema.promoted === true;
14
- const PromotedOneOfSchema = (props) => {
15
- var _a;
16
- // TODO: LOW avoid type assertion -- actually non-null assertion operator: props.model!
17
- const [selection, setSelection] = (0, react_1.useState)((0, promoted_one_of_utils_1.getSelectionFromModel)(props.schema, props.model) ||
18
- ((_a = props.schema.promotion) === null || _a === void 0 ? void 0 : _a.default) ||
19
- 'promoted');
20
- const promotedAlert = props.schema.alert;
21
- const promotedOneOf = props.schema.oneOf.find(isPromoted);
22
- // TODO: LOW avoid type assertion -- actually non-null assertion operator
23
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
24
- const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
25
- const otherOneOf = getOtherOneOf(props.schema);
26
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [promotedAlert && (0, jsx_runtime_1.jsx)(layout_1.DynamicAlert, { component: promotedAlert }), (0, jsx_runtime_1.jsx)(PromotedOneOfControl_1.default, { id: props.schema.$id, title: props.schema.title,
27
- // TODO: LOW avoid type assertion -- actually non-null assertion operator
28
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
29
- promotedOneOf: promotedOneOf,
30
- // TODO: LOW avoid type assertion -- actually non-null assertion operator
31
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
32
- promotion: props.schema.promotion, selection: selection, setSelection: setSelection }), selection === 'promoted' && (0, jsx_runtime_1.jsx)(objectSchema_1.default, Object.assign({}, props, { schema: promotedObjectSchema })), selection === 'other' && (0, jsx_runtime_1.jsx)(genericSchema_1.default, Object.assign({}, props, { schema: otherOneOf }))] }));
33
- };
34
- function getPromotedObjectSchema(promotedSchema) {
35
- return Object.assign(Object.assign({}, promotedSchema), {
36
- // We don't need to show these since they are already displayed in the radio option
37
- title: undefined, description: undefined });
38
- }
39
- function getOtherOneOf(schema) {
40
- var _a, _b, _c;
41
- const other = ((_a = schema.promotion) === null || _a === void 0 ? void 0 : _a.displayTwice)
42
- ? [...schema.oneOf]
43
- : schema.oneOf.filter((one) => !isPromoted(one));
44
- const title = (_c = (_b = schema.promotion) === null || _b === void 0 ? void 0 : _b.other.heading) === null || _c === void 0 ? void 0 : _c.text;
45
- if (other.length === 1) {
46
- return Object.assign(Object.assign({}, other[0]), { title });
47
- }
48
- if (other.length > 1) {
49
- return {
50
- title,
51
- oneOf: other,
52
- // TODO: LOW avoid type assertion -- the spec does not recognise a `control` property in ObjectSchema
53
- control: schema.control,
54
- };
55
- }
56
- return null;
57
- }
58
- exports.default = PromotedOneOfSchema;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var PromotedOneOfSchema_1 = require("./PromotedOneOfSchema");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(PromotedOneOfSchema_1).default; } });
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSelectionFromModel = void 0;
4
- const utils_1 = require("../oneOfSchema/utils");
5
- const getSelectionFromModel = (schema, model) => {
6
- const index = (0, utils_1.getBestMatchingSchemaIndexForValue)(schema, model);
7
- if (index !== null) {
8
- return schema.oneOf[index].promoted ? 'promoted' : 'other';
9
- }
10
- return null;
11
- };
12
- exports.getSelectionFromModel = getSelectionFromModel;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const PromotedOneOfCheckboxControl = (props) => {
6
- const { id, selection, setSelection } = props;
7
- const { promoted, other, checkedMeans } = props.promotion;
8
- const title = checkedMeans === 'other' ? other.title : (promoted === null || promoted === void 0 ? void 0 : promoted.title) || props.promotedOneOf.title;
9
- const selectionWhenChecked = checkedMeans === 'other' ? 'other' : 'promoted';
10
- const selectionWhenUnchecked = checkedMeans === 'other' ? 'promoted' : 'other';
11
- const checked = selection === selectionWhenChecked;
12
- const toggleSelection = () => {
13
- setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
14
- };
15
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "form-group" }, { children: (0, jsx_runtime_1.jsx)(components_1.Checkbox, { id: id, label: title, checked: checked, onChange: toggleSelection }) })));
16
- };
17
- PromotedOneOfCheckboxControl.defaultProps = {};
18
- exports.default = PromotedOneOfCheckboxControl;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const utils_1 = require("../../../common/utils");
8
- const PromotedOneOfCheckboxControl_1 = __importDefault(require("./PromotedOneOfCheckboxControl"));
9
- const PromotedOneOfRadioControl_1 = __importDefault(require("./PromotedOneOfRadioControl"));
10
- const PromotedOneOfControl = (props) => {
11
- const controlType = props.promotion.control || 'radio';
12
- switch (controlType) {
13
- case 'radio':
14
- return (0, jsx_runtime_1.jsx)(PromotedOneOfRadioControl_1.default, Object.assign({}, props));
15
- case 'checkbox':
16
- return (0, jsx_runtime_1.jsx)(PromotedOneOfCheckboxControl_1.default, Object.assign({}, props));
17
- default:
18
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
19
- }
20
- };
21
- PromotedOneOfControl.defaultProps = {
22
- id: (0, utils_1.generateRandomId)(),
23
- title: undefined,
24
- };
25
- exports.default = PromotedOneOfControl;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const utils_1 = require("../../schemaFormControl/utils");
6
- const PromotedOneOfRadioControl = (props) => {
7
- var _a, _b;
8
- const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
9
- const radios = [
10
- Object.assign(Object.assign({ value: 'promoted',
11
- // TODO: LOW avoid type assertion below the expression may be nullish, but "label" cannot be
12
- label: (((_a = promotion.promoted) === null || _a === void 0 ? void 0 : _a.title) || promotedOneOf.title), secondary: ((_b = promotion.promoted) === null || _b === void 0 ? void 0 : _b.description) || promotedOneOf.description }, (0, utils_1.mapIconToAvatar)(promotedOneOf.icon)), (0, utils_1.mapAvatar)(promotedOneOf.image)),
13
- Object.assign(Object.assign({ value: 'other', label: promotion.other.title, secondary: promotion.other.description }, (0, utils_1.mapIconToAvatar)(promotion.other.icon)), (0, utils_1.mapAvatar)(promotion.other.image)),
14
- ];
15
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "form-group" }, { children: [title && ((0, jsx_runtime_1.jsx)("label", Object.assign({ className: "control-label", htmlFor: id }, { children: title }))), (0, jsx_runtime_1.jsx)(components_1.RadioGroup, { name: "promoted-selection", selectedValue: selection, radios: radios,
16
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
17
- // @ts-expect-error -- TODO: avoid @ts-ignore -- apparently RadioGroup does not expect an id prop
18
- id: id, onChange: setSelection })] })));
19
- };
20
- PromotedOneOfRadioControl.defaultProps = {
21
- title: undefined,
22
- };
23
- exports.default = PromotedOneOfRadioControl;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const components_1 = require("@transferwise/components");
8
- const react_intl_1 = require("react-intl");
9
- const validators_1 = require("../../common/validators");
10
- const types_1 = require("../../types");
11
- const currency_utils_1 = require("../schemaFormControl/utils/currency-utils");
12
- const ReadOnlySchema_messages_1 = __importDefault(require("./ReadOnlySchema.messages"));
13
- const ReadOnlySchema = ({ schema, model }) => {
14
- const { title = '' } = schema;
15
- const { formatMessage } = (0, react_intl_1.useIntl)();
16
- const value = getValueForSchema({ schema, model, formatMessage });
17
- // FIXME: This is a workaround for the fact that the DefinitionList component value prop doesn't match Model
18
- return ((0, jsx_runtime_1.jsx)(components_1.DefinitionList, { layout: components_1.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: '' }] }));
19
- };
20
- exports.default = ReadOnlySchema;
21
- function getValueForSchema({ schema, model, formatMessage, }) {
22
- if ((0, types_1.isBasicSchema)(schema)) {
23
- if ((0, types_1.isOneOfSchema)(schema)) {
24
- return getValueFromOneOfSchema(schema, model);
25
- }
26
- else {
27
- if (schema.type === 'boolean' && (0, validators_1.isBoolean)(model)) {
28
- return model ? formatMessage(ReadOnlySchema_messages_1.default.yes) : formatMessage(ReadOnlySchema_messages_1.default.no);
29
- }
30
- else {
31
- return (model && model.toString()) || '';
32
- }
33
- }
34
- }
35
- return '';
36
- }
37
- function getValueFromOneOfSchema(schema, model) {
38
- const option = getSelectedOneOf(schema, model);
39
- // FIXME Remove type assertion
40
- return option ? getValueFromOption(option) : model;
41
- }
42
- function getSelectedOneOf(schema, model) {
43
- return schema.oneOf.find((childSchema) => {
44
- return 'const' in childSchema ? model === childSchema.const : false;
45
- });
46
- }
47
- function getValueFromOption(option) {
48
- const text = option.title && option.description
49
- ? `${option.title} - ${option.description}`
50
- : option.title || '';
51
- const currencyFlag = getCurrencyFlagFromOption(option);
52
- return currencyFlag ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [currencyFlag, " ", text] })) : (text);
53
- }
54
- function getCurrencyFlagFromOption(option) {
55
- var _a, _b;
56
- const currency = (_b = (0, currency_utils_1.getCurrencyFlag)((_a = option.icon) === null || _a === void 0 ? void 0 : _a.name)) === null || _b === void 0 ? void 0 : _b.currency;
57
- return currency ? (0, jsx_runtime_1.jsx)("i", { className: `currency-flag currency-flag-${currency} hidden-xs` }) : null;
58
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_intl_1 = require("react-intl");
4
- exports.default = (0, react_intl_1.defineMessages)({
5
- yes: {
6
- id: 'dynamicFlows.ReadOnlySchema.yes',
7
- defaultMessage: 'Yes',
8
- description: 'Yes, used for boolean schemas with a value of true.',
9
- },
10
- no: {
11
- id: 'dynamicFlows.ReadOnlySchema.no',
12
- defaultMessage: 'No',
13
- description: 'No: used for boolean schemas with a value of false.',
14
- },
15
- });
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var ReadOnlySchema_1 = require("./ReadOnlySchema");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(ReadOnlySchema_1).default; } });
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getControlType = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const constants_1 = require("../../common/constants");
9
- const contexts_1 = require("../../common/contexts");
10
- const validators_1 = require("../../common/validators");
11
- const formControl_1 = __importDefault(require("../../formControl"));
12
- const types_1 = require("../../types");
13
- const utils_1 = require("./utils");
14
- const isNativeInput = (propsSchemaType) => {
15
- return propsSchemaType === 'string' || propsSchemaType === 'number';
16
- };
17
- const getControlType = (schema) => {
18
- if ('control' in schema && schema.control) {
19
- if ((0, types_1.isOneOfSchema)(schema) && schema.oneOf.length > 3) {
20
- return constants_1.FormControlType.SELECT;
21
- }
22
- return schema.control;
23
- }
24
- if (schema.oneOf) {
25
- return schema.oneOf.length === 1 || schema.oneOf.length >= 3 ? 'select' : 'radio';
26
- }
27
- if (schema.type === 'string') {
28
- switch (schema.format) {
29
- case 'date':
30
- return 'date';
31
- case 'password':
32
- return 'password';
33
- case 'phone-number':
34
- return 'tel';
35
- case 'base64url':
36
- return 'file';
37
- default:
38
- return 'text';
39
- }
40
- }
41
- if (schema.type === 'boolean') {
42
- return 'checkbox';
43
- }
44
- if (schema.type === 'integer') {
45
- return 'number';
46
- }
47
- return schema.type;
48
- };
49
- exports.getControlType = getControlType;
50
- const getOptions = (schema, controlType) => {
51
- if (schema.oneOf) {
52
- return schema.oneOf.map((childSchema) => (0, utils_1.mapConstSchemaToOption)(childSchema, controlType));
53
- }
54
- return null;
55
- };
56
- const SchemaFormControl = (props) => {
57
- const log = (0, contexts_1.useLogger)();
58
- const getSanitisedValue = (value) => isNativeInput(props.schema.type) && ((0, validators_1.isNull)(value) || (0, validators_1.isUndefined)(value)) ? '' : value;
59
- const onChange = (value, type) => {
60
- props.onChange((0, validators_1.getValidBasicModelOrNull)(value, props.schema), type);
61
- };
62
- const controlType = (0, exports.getControlType)(props.schema);
63
- if (controlType === 'file') {
64
- log.warning('Deprecation advanced warning', 'Please use a persist-async blob schema instead of string with base64url for file uploads. The base64url does not perform well on low end devices. Support for this schema will be removed in a later release.');
65
- }
66
- if (props.schema.values) {
67
- log.error('Deprecated schema', 'Schema.values is a legacy approach. Please use oneOf.');
68
- }
69
- const options = props.schema.values || getOptions(props.schema, controlType);
70
- const events = {
71
- onFocus: props.onFocus,
72
- onBlur: props.onBlur,
73
- onSearchChange: props.onSearchChange,
74
- onChange,
75
- };
76
- const safeValue = getSanitisedValue(props.value);
77
- const controlProps = {
78
- id: props.id,
79
- name: props.id,
80
- label: props.schema.title,
81
- options: options || [],
82
- placeholder: props.schema.placeholder,
83
- autoComplete: !props.schema.help,
84
- disabled: props.disabled || props.schema.disabled,
85
- displayPattern: props.schema.displayFormat,
86
- // TODO: LOW avoid type assertion below
87
- uploadProps: (0, utils_1.mapSchemaToUploadOptions)(props.schema),
88
- };
89
- return (0, jsx_runtime_1.jsx)(formControl_1.default, Object.assign({ type: controlType, value: safeValue }, events, controlProps));
90
- };
91
- SchemaFormControl.defaultProps = {
92
- value: null,
93
- onFocus: null,
94
- onBlur: null,
95
- onSearchChange: null,
96
- disabled: false,
97
- };
98
- exports.default = SchemaFormControl;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var SchemaFormControl_1 = require("./SchemaFormControl");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(SchemaFormControl_1).default; } });