@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
package/README.md CHANGED
@@ -19,15 +19,6 @@ npm install @wise/dynamic-flow-client
19
19
  pnpm install @wise/dynamic-flow-client
20
20
  ```
21
21
 
22
- **Note:** Dynamic flow is exported in three formats, minified and unminified. Most bundlers will understand the formats declared in `package.json`, but should you need to, you can find each format in the `build` folder:
23
-
24
- | Format | Minified | Unminified |
25
- | ------------ | ----------------- | ------------- |
26
- | Browser | `main.min.js` | `main.js` |
27
- | Common JS | `main.cjs.min.js` | `main.cjs.js` |
28
- | ESM | `main.esm.min.js` | `main.esm.js` |
29
-
30
-
31
22
  2. Install required peer dependencies (if not already installed). Please refer to setup instructions for `@transferwise/components` and `@transferwise/neptune-css` if installing up for the first time.
32
23
 
33
24
  ```
@@ -45,8 +36,6 @@ pnpm install @transferwise/components @transferwise/formatting @transferwise/ico
45
36
  ```
46
37
  **Note:** Keep in mind that some of these dependencies have their own peer dependencies. Don't forget to install those, for instance: `@transferwise/components` needs `@wise/art` and `@wise/components-theming`.
47
38
 
48
- 3. Import the required CSS, and wrap the DynamicFlow component in the required design system providers.
49
-
50
39
  ```js
51
40
  // Should be imported once in your application
52
41
  import '@wise/dynamic-flow-client/build/main.css';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.DateMode = void 0;
4
+ exports.DateMode = {
5
+ DAY_MONTH_YEAR: 'day-month-year',
6
+ MONTH_YEAR: 'month-year'
7
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.FormControlType = void 0;
4
+ exports.FormControlType = {
5
+ RADIO: 'radio',
6
+ CHECKBOX: 'checkbox',
7
+ SELECT: 'select',
8
+ FILE: 'file',
9
+ DATE: 'date',
10
+ DATETIME: 'date-time',
11
+ DATELOOKUP: 'date-lookup',
12
+ TEL: 'tel',
13
+ NUMBER: 'number',
14
+ HIDDEN: 'hidden',
15
+ PASSWORD: 'password',
16
+ TEXT: 'text',
17
+ TEXTAREA: 'textarea',
18
+ UPLOAD: 'upload',
19
+ TAB: 'tab'
20
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.MonthFormat = void 0;
4
+ exports.MonthFormat = {
5
+ SHORT: 'short',
6
+ LONG: 'long'
7
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.SchemaType = void 0;
4
+ exports.SchemaType = {
5
+ READ_ONLY: 'readOnly',
6
+ PERSIST_ASYNC: 'persistAsync',
7
+ VALIDATION_ASYNC: 'validationAsync',
8
+ OBJECT: 'object',
9
+ PROMOTED_ONE_OF: 'promotedOneOf',
10
+ ONE_OF: 'oneOf',
11
+ ALL_OF: 'allOf',
12
+ BASIC: 'basic',
13
+ ARRAY: 'array'
14
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.Size = void 0;
4
+ exports.Size = {
5
+ EXTRA_SMALL: 'xs',
6
+ SMALL: 'sm',
7
+ MEDIUM: 'md',
8
+ LARGE: 'lg',
9
+ EXTRA_LARGE: 'xl'
10
+ };
@@ -0,0 +1,21 @@
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("./DateMode"), exports);
18
+ __exportStar(require("./FormControlType"), exports);
19
+ __exportStar(require("./MonthFormat"), exports);
20
+ __exportStar(require("./SchemaType"), exports);
21
+ __exportStar(require("./Size"), exports);
@@ -0,0 +1,41 @@
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
+ exports.__esModule = true;
14
+ exports.useDynamicFlow = exports.DynamicFlowProvider = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var usePendingPromiseCounter_1 = require("./usePendingPromiseCounter");
18
+ var defaultContextValue = {
19
+ loading: false,
20
+ registerPersistAsyncPromise: function (promise) {
21
+ //
22
+ }
23
+ };
24
+ var DFContext = (0, react_1.createContext)(defaultContextValue);
25
+ var DynamicFlowProvider = function (_a) {
26
+ var loading = _a.loading, children = _a.children;
27
+ var _b = (0, usePendingPromiseCounter_1.usePendingPromiseCounter)(), pendingPromises = _b.pendingPromises, addPendingPromise = _b.addPendingPromise;
28
+ var providerValue = (0, react_1.useMemo)(function () {
29
+ return {
30
+ loading: loading || pendingPromises > 0,
31
+ registerPersistAsyncPromise: addPendingPromise
32
+ };
33
+ }, [loading, pendingPromises, addPendingPromise]);
34
+ return (0, jsx_runtime_1.jsx)(DFContext.Provider, __assign({ value: providerValue }, { children: children }));
35
+ };
36
+ exports.DynamicFlowProvider = DynamicFlowProvider;
37
+ var useDynamicFlow = function () {
38
+ var context = (0, react_1.useContext)(DFContext);
39
+ return context || defaultContextValue;
40
+ };
41
+ exports.useDynamicFlow = useDynamicFlow;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.usePendingPromiseCounter = void 0;
4
+ var react_1 = require("react");
5
+ function usePendingPromiseCounter() {
6
+ var _a = (0, react_1.useState)(0), count = _a[0], setCount = _a[1];
7
+ var addPendingPromise = (0, react_1.useCallback)(function (promise) {
8
+ setCount(function (c) { return c + 1; });
9
+ promise["catch"](noop)["finally"](function () { return delayUntilNextCycle(function () { return setCount(function (c) { return Math.max(0, c - 1); }); }); });
10
+ }, [setCount]);
11
+ return { addPendingPromise: addPendingPromise, pendingPromises: count };
12
+ }
13
+ exports.usePendingPromiseCounter = usePendingPromiseCounter;
14
+ var delayUntilNextCycle = function (fn) { return setTimeout(function () { return fn(); }, 0); };
15
+ var noop = function () {
16
+ // no-op
17
+ };
@@ -0,0 +1,39 @@
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
+ exports.__esModule = true;
14
+ exports.getEventDispatcher = exports.useEventDispatcher = exports.EventsContextProvider = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var EventsContext = (0, react_1.createContext)({
18
+ triggerEvent: function () {
19
+ // noop
20
+ }
21
+ });
22
+ var EventsContextProvider = function (_a) {
23
+ var metadata = _a.metadata, children = _a.children, onEvent = _a.onEvent;
24
+ var value = (0, react_1.useMemo)(function () { return ({ triggerEvent: (0, exports.getEventDispatcher)(onEvent, metadata) }); }, [onEvent, metadata]);
25
+ return (0, jsx_runtime_1.jsx)(EventsContext.Provider, __assign({ value: value }, { children: children }));
26
+ };
27
+ exports.EventsContextProvider = EventsContextProvider;
28
+ function useEventDispatcher() {
29
+ var triggerEvent = (0, react_1.useContext)(EventsContext).triggerEvent;
30
+ return triggerEvent;
31
+ }
32
+ exports.useEventDispatcher = useEventDispatcher;
33
+ var getEventDispatcher = function (onEvent, metadata) {
34
+ return function (eventName, properties) {
35
+ if (properties === void 0) { properties = {}; }
36
+ return onEvent(eventName, __assign(__assign({}, metadata), properties));
37
+ };
38
+ };
39
+ exports.getEventDispatcher = getEventDispatcher;
@@ -0,0 +1,42 @@
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
+ exports.__esModule = true;
14
+ exports.useHasFetcherProvider = exports.useFetcher = exports.FetcherProviderFromBaseUrl = exports.FetcherProvider = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var makeFetcher_1 = require("../../makeFetcher");
18
+ var FetcherContext = (0, react_1.createContext)(undefined);
19
+ var FetcherProvider = function (_a) {
20
+ var fetcher = _a.fetcher, children = _a.children;
21
+ return (0, jsx_runtime_1.jsx)(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
22
+ };
23
+ exports.FetcherProvider = FetcherProvider;
24
+ var FetcherProviderFromBaseUrl = function (_a) {
25
+ var baseUrl = _a.baseUrl, children = _a.children;
26
+ var fetcher = (0, react_1.useMemo)(function () { return (0, makeFetcher_1.makeFetcher)(baseUrl); }, [baseUrl]);
27
+ return (0, jsx_runtime_1.jsx)(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
28
+ };
29
+ exports.FetcherProviderFromBaseUrl = FetcherProviderFromBaseUrl;
30
+ /**
31
+ * Provides the fetch(er) function for dynamic flows asynchronous operations.
32
+ */
33
+ var useFetcher = function () {
34
+ var contextFetch = (0, react_1.useContext)(FetcherContext);
35
+ return contextFetch || fetch;
36
+ };
37
+ exports.useFetcher = useFetcher;
38
+ var useHasFetcherProvider = function () {
39
+ var context = (0, react_1.useContext)(FetcherContext);
40
+ return !!context;
41
+ };
42
+ exports.useHasFetcherProvider = useHasFetcherProvider;
@@ -0,0 +1,20 @@
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("./dynamicFlowContexts/DynamicFlowContexts"), exports);
18
+ __exportStar(require("./eventsContext/EventsContext"), exports);
19
+ __exportStar(require("./fetcherContexts/FetcherContexts"), exports);
20
+ __exportStar(require("./logContext/LogContext"), exports);
@@ -0,0 +1,45 @@
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
+ exports.__esModule = true;
14
+ exports.useLogger = exports.LogProvider = exports.getLogger = void 0;
15
+ var jsx_runtime_1 = require("react/jsx-runtime");
16
+ var react_1 = require("react");
17
+ var getLogger = function (level, onLog, flowId, stepId) {
18
+ if (flowId === void 0) { flowId = 'UNKNOWN-FLOW-ID'; }
19
+ if (stepId === void 0) { stepId = 'UNKNOWN-FLOW-ID'; }
20
+ return function (title, description, extra) {
21
+ return onLog(level, "Dynamic Flow ".concat(level, " - ").concat(title, " - ").concat(description), __assign({ flowId: flowId, stepId: stepId }, extra));
22
+ };
23
+ };
24
+ exports.getLogger = getLogger;
25
+ var LogContext = (0, react_1.createContext)(null);
26
+ var LogProvider = function (_a) {
27
+ var flowId = _a.flowId, stepId = _a.stepId, children = _a.children, onLog = _a.onLog;
28
+ var value = (0, react_1.useMemo)(function () { return ({
29
+ debug: (0, exports.getLogger)('debug', onLog, flowId, stepId),
30
+ info: (0, exports.getLogger)('info', onLog, flowId, stepId),
31
+ warning: (0, exports.getLogger)('warning', onLog, flowId, stepId),
32
+ error: (0, exports.getLogger)('error', onLog, flowId, stepId),
33
+ critical: (0, exports.getLogger)('critical', onLog, flowId, stepId)
34
+ }); }, [onLog, flowId, stepId]);
35
+ return (0, jsx_runtime_1.jsx)(LogContext.Provider, __assign({ value: value }, { children: children }));
36
+ };
37
+ exports.LogProvider = LogProvider;
38
+ var useLogger = function () {
39
+ var logging = (0, react_1.useContext)(LogContext);
40
+ if (logging == null) {
41
+ throw new Error('Logging context not found. Did you forget to wrap your component in a <LogProvider />?');
42
+ }
43
+ return logging;
44
+ };
45
+ exports.useLogger = useLogger;
@@ -0,0 +1,23 @@
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("./useDebouncedFunction/useDebouncedFunction"), exports);
18
+ __exportStar(require("./useExternal/useExternal"), exports);
19
+ __exportStar(require("./useExternalStepPolling/useExternalStepPolling"), exports);
20
+ __exportStar(require("./usePersistAsync/usePersistAsync"), exports);
21
+ __exportStar(require("./usePolling/usePolling"), exports);
22
+ __exportStar(require("./usePrevious/usePrevious"), exports);
23
+ __exportStar(require("./useStepPolling/useStepPolling"), exports);
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /* References:
3
+ - https://github.com/gnbaron/use-lodash-debounce
4
+ - https://dmitripavlutin.com/react-throttle-debounce/
5
+ */
6
+ exports.__esModule = true;
7
+ exports.useDebouncedFunction = void 0;
8
+ var react_1 = require("react");
9
+ var utils_1 = require("../../utils");
10
+ function useDebouncedFunction(callback, waitMs) {
11
+ return (0, react_1.useCallback)((0, utils_1.debounce)(callback, waitMs), [callback, waitMs]);
12
+ }
13
+ exports.useDebouncedFunction = useDebouncedFunction;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ exports.useExternal = void 0;
4
+ var react_1 = require("react");
5
+ function useExternal(url) {
6
+ // If we fail to open the window, the user will need to open this on their own
7
+ var _a = (0, react_1.useState)(null), externalWindow = _a[0], setExternalWindow = _a[1];
8
+ var _b = (0, react_1.useState)(false), hasManuallyTriggered = _b[0], setHasManuallyTriggered = _b[1];
9
+ var dismissConfirmation = function () { return setHasManuallyTriggered(true); };
10
+ (0, react_1.useEffect)(function () {
11
+ if (url) {
12
+ setHasManuallyTriggered(false);
13
+ setExternalWindow(window.open(url, '_blank'));
14
+ }
15
+ }, [url]);
16
+ var requiresManualTrigger = Boolean(url && !externalWindow && !hasManuallyTriggered);
17
+ return { requiresManualTrigger: requiresManualTrigger, dismissConfirmation: dismissConfirmation };
18
+ }
19
+ exports.useExternal = useExternal;
@@ -0,0 +1,73 @@
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
+ exports.__esModule = true;
14
+ exports.useExternalStepPolling = void 0;
15
+ var react_1 = require("react");
16
+ var __1 = require("..");
17
+ var contexts_1 = require("../../contexts");
18
+ /** @deprecated External step is no longer supported */
19
+ function useExternalStepPolling(polling, onAction) {
20
+ var fetcher = (0, contexts_1.useFetcher)();
21
+ var asyncFn = (0, react_1.useMemo)(function () {
22
+ if (polling) {
23
+ return function () {
24
+ return fetcher(polling.url).then(function (response) {
25
+ if (response.ok) {
26
+ try {
27
+ return response.json();
28
+ }
29
+ catch (_a) {
30
+ throw new Error('failed');
31
+ }
32
+ }
33
+ else {
34
+ throw new Error('failed');
35
+ }
36
+ });
37
+ };
38
+ }
39
+ else {
40
+ return undefined;
41
+ }
42
+ }, [polling, fetcher]);
43
+ var onPollingResponse = (0, react_1.useCallback)(function (pollingResponse) {
44
+ var responseHandlers = (polling === null || polling === void 0 ? void 0 : polling.responseHandlers) || [];
45
+ var responseHandler = responseHandlers.find(function (handler) { return handler.result === pollingResponse.result; });
46
+ if (responseHandler === null || responseHandler === void 0 ? void 0 : responseHandler.action) {
47
+ var action = responseHandler.action;
48
+ if (action.exit) {
49
+ var mergedResult = __assign(__assign({}, (action.result || {})), (pollingResponse.data || {}));
50
+ onAction(__assign(__assign({}, action), { result: mergedResult }));
51
+ }
52
+ else {
53
+ var mergedData = __assign(__assign({}, (action.data || {})), (pollingResponse.data || {}));
54
+ onAction(__assign(__assign({}, action), { data: mergedData }));
55
+ }
56
+ return false; // stop polling
57
+ }
58
+ return true; // continue polling
59
+ }, [polling === null || polling === void 0 ? void 0 : polling.responseHandlers, onAction]);
60
+ (0, __1.usePolling)({
61
+ asyncFn: asyncFn,
62
+ interval: (polling === null || polling === void 0 ? void 0 : polling.interval) || 0,
63
+ maxAttempts: (polling === null || polling === void 0 ? void 0 : polling.maxAttempts) || 0,
64
+ maxConsecutiveFails: (polling === null || polling === void 0 ? void 0 : polling.maxConsecutiveFails) || 0,
65
+ onPollingResponse: onPollingResponse,
66
+ onFailure: (0, react_1.useCallback)(function () {
67
+ if (polling) {
68
+ onAction(polling.onError.action);
69
+ }
70
+ }, [onAction, polling])
71
+ });
72
+ }
73
+ exports.useExternalStepPolling = useExternalStepPolling;
@@ -0,0 +1,177 @@
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ exports.__esModule = true;
53
+ exports.usePersistAsync = void 0;
54
+ var react_1 = require("react");
55
+ var react_intl_1 = require("react-intl");
56
+ var validators_1 = require("../../../common/validators");
57
+ var PersistAsyncSchema_messages_1 = __importDefault(require("../../../jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages"));
58
+ var PersistAsyncBasicSchema_1 = require("../../../jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema"); // FIXME: extract these functions form that schema component to either here or their own module
59
+ var types_1 = require("../../../types");
60
+ var contexts_1 = require("../../contexts");
61
+ var validators_2 = require("../../validators");
62
+ var usePersistAsync = function (persistAsync) {
63
+ var _a = (0, react_1.useState)(null), abortController = _a[0], setAbortController = _a[1];
64
+ var fetcher = (0, contexts_1.useFetcher)();
65
+ var intl = (0, react_intl_1.useIntl)();
66
+ var schema = persistAsync.schema;
67
+ function handlePersistAsync(model) {
68
+ return __awaiter(this, void 0, void 0, function () {
69
+ var isInvalidSchema;
70
+ return __generator(this, function (_a) {
71
+ switch (_a.label) {
72
+ case 0:
73
+ isInvalidSchema = model instanceof Blob ? !(0, types_1.isBlobSchema)(schema) : !(0, validators_2.isValidSchema)(model, schema);
74
+ if ((0, validators_1.isNull)(model) || isInvalidSchema) {
75
+ handleError();
76
+ }
77
+ return [4 /*yield*/, performPersistAsync(model)];
78
+ case 1: return [2 /*return*/, _a.sent()];
79
+ }
80
+ });
81
+ });
82
+ }
83
+ var abortCurrentRequestAndGetNewAbortSignal = function () {
84
+ if (abortController) {
85
+ abortController.abort();
86
+ }
87
+ var newAbortController = new AbortController();
88
+ setAbortController(newAbortController);
89
+ return newAbortController.signal;
90
+ };
91
+ function constructFetchInit(model) {
92
+ var _a;
93
+ var isBlob = (0, types_1.isBlobSchema)(schema);
94
+ var signal = abortCurrentRequestAndGetNewAbortSignal();
95
+ var requestKey = persistAsync.param;
96
+ var requestBody = isBlob
97
+ ? wrapInFormData(requestKey, model)
98
+ : JSON.stringify((_a = {}, _a[requestKey] = model, _a));
99
+ return {
100
+ method: persistAsync.method,
101
+ headers: __assign({}, (!isBlob && { 'Content-Type': 'application/json' })),
102
+ body: requestBody,
103
+ signal: signal
104
+ };
105
+ }
106
+ function performPersistAsync(payload) {
107
+ return __awaiter(this, void 0, void 0, function () {
108
+ var response, jsonResponse, id, error_1;
109
+ return __generator(this, function (_a) {
110
+ switch (_a.label) {
111
+ case 0:
112
+ _a.trys.push([0, 3, , 4]);
113
+ return [4 /*yield*/, fetcher(persistAsync.url, constructFetchInit(payload))];
114
+ case 1:
115
+ response = _a.sent();
116
+ if (!response.ok) {
117
+ return [2 /*return*/, handleHTTPError(response)];
118
+ }
119
+ return [4 /*yield*/, response.json()];
120
+ case 2:
121
+ jsonResponse = _a.sent();
122
+ if ((0, validators_1.isObject)(jsonResponse)) {
123
+ id = jsonResponse[persistAsync.idProperty];
124
+ if ((0, validators_1.isString)(id) || (0, validators_1.isNumber)(id)) {
125
+ return [2 /*return*/, { data: id }];
126
+ }
127
+ }
128
+ return [2 /*return*/, handleError()];
129
+ case 3:
130
+ error_1 = _a.sent();
131
+ return [2 /*return*/, handleError(error_1)];
132
+ case 4: return [2 /*return*/];
133
+ }
134
+ });
135
+ });
136
+ }
137
+ function handleHTTPError(response) {
138
+ return __awaiter(this, void 0, void 0, function () {
139
+ var jsonResponse, error;
140
+ return __generator(this, function (_a) {
141
+ switch (_a.label) {
142
+ case 0:
143
+ if (!(response.status === 422)) return [3 /*break*/, 2];
144
+ return [4 /*yield*/, response.json()];
145
+ case 1:
146
+ jsonResponse = _a.sent();
147
+ if ((0, validators_1.isObject)(jsonResponse)) {
148
+ error = (0, PersistAsyncBasicSchema_1.getErrorFromResponse)(persistAsync.param, jsonResponse);
149
+ if ((0, validators_1.isString)(error)) {
150
+ throw new Error(error);
151
+ }
152
+ }
153
+ _a.label = 2;
154
+ case 2: throw new Error(intl.formatMessage(PersistAsyncSchema_messages_1["default"].genericError));
155
+ }
156
+ });
157
+ });
158
+ }
159
+ var handleError = function (error) {
160
+ var message = hasStringMessage(error)
161
+ ? error.message
162
+ : intl.formatMessage(PersistAsyncSchema_messages_1["default"].genericError);
163
+ throw new Error(message);
164
+ };
165
+ return handlePersistAsync;
166
+ };
167
+ exports.usePersistAsync = usePersistAsync;
168
+ function wrapInFormData(key, value) {
169
+ var formData = new FormData();
170
+ if (value !== null) {
171
+ formData.append(key, value);
172
+ }
173
+ return formData;
174
+ }
175
+ function hasStringMessage(value) {
176
+ return (0, validators_1.isObject)(value) && 'message' in value && typeof value.message === 'string';
177
+ }