@wise/dynamic-flow-client 0.3.0-beta-d45b31.38 → 0.3.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 (485) hide show
  1. package/README.md +50 -28
  2. package/build/common/constants/DateMode.d.ts +4 -0
  3. package/build/common/constants/DateMode.js +4 -0
  4. package/build/common/constants/FormControlType.d.ts +17 -0
  5. package/build/common/constants/FormControlType.js +17 -0
  6. package/build/common/constants/MonthFormat.d.ts +4 -0
  7. package/build/common/constants/MonthFormat.js +4 -0
  8. package/build/common/constants/SchemaType.d.ts +11 -0
  9. package/build/common/constants/SchemaType.js +11 -0
  10. package/build/common/constants/Size.d.ts +7 -0
  11. package/build/common/constants/Size.js +7 -0
  12. package/build/common/constants/index.d.ts +5 -0
  13. package/build/common/constants/index.js +5 -0
  14. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +11 -0
  15. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +36 -0
  16. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +4 -0
  17. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +13 -0
  18. package/build/common/contexts/eventsContext/EventsContext.d.ts +15 -0
  19. package/build/common/contexts/eventsContext/EventsContext.js +33 -0
  20. package/build/common/contexts/fetcherContexts/FetcherContexts.d.ts +18 -0
  21. package/build/common/contexts/fetcherContexts/FetcherContexts.js +35 -0
  22. package/build/common/contexts/index.d.ts +4 -0
  23. package/build/common/contexts/index.js +4 -0
  24. package/build/common/contexts/logContext/LogContext.d.ts +22 -0
  25. package/build/common/contexts/logContext/LogContext.js +39 -0
  26. package/build/common/hooks/index.d.ts +7 -0
  27. package/build/common/hooks/index.js +7 -0
  28. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +2 -0
  29. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +9 -0
  30. package/build/common/hooks/useExternal/useExternal.d.ts +4 -0
  31. package/build/common/hooks/useExternal/useExternal.js +15 -0
  32. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +12 -0
  33. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +69 -0
  34. package/build/common/hooks/usePersistAsync/usePersistAsync.d.ts +7 -0
  35. package/build/common/hooks/usePersistAsync/usePersistAsync.js +170 -0
  36. package/build/common/hooks/usePolling/usePolling.d.ts +11 -0
  37. package/build/common/hooks/usePolling/usePolling.js +48 -0
  38. package/build/common/hooks/usePrevious/usePrevious.d.ts +1 -0
  39. package/build/common/hooks/usePrevious/usePrevious.js +8 -0
  40. package/build/common/hooks/useStepPolling/useStepPolling.d.ts +2 -0
  41. package/build/common/hooks/useStepPolling/useStepPolling.js +44 -0
  42. package/build/common/makeFetcher/index.d.ts +1 -0
  43. package/build/common/makeFetcher/index.js +1 -0
  44. package/build/common/makeFetcher/makeFetcher.d.ts +2 -0
  45. package/build/common/makeFetcher/makeFetcher.js +33 -0
  46. package/build/common/messages.d.ts +8 -0
  47. package/build/common/messages.js +8 -0
  48. package/build/common/utils/api-utils.d.ts +4 -0
  49. package/build/common/utils/api-utils.js +13 -0
  50. package/build/common/utils/date-utils.d.ts +2 -0
  51. package/build/common/utils/date-utils.js +22 -0
  52. package/build/common/utils/debounce.d.ts +6 -0
  53. package/build/common/utils/debounce.js +38 -0
  54. package/build/common/utils/file-utils.d.ts +4 -0
  55. package/build/common/utils/file-utils.js +45 -0
  56. package/build/common/utils/id-utils.d.ts +1 -0
  57. package/build/common/utils/id-utils.js +5 -0
  58. package/build/common/utils/index.d.ts +8 -0
  59. package/build/common/utils/index.js +8 -0
  60. package/build/common/utils/is-equal.d.ts +1 -0
  61. package/build/common/utils/is-equal.js +21 -0
  62. package/build/common/utils/schema-utils.d.ts +13 -0
  63. package/build/common/utils/schema-utils.js +48 -0
  64. package/build/common/utils/step-utils.d.ts +7 -0
  65. package/build/common/utils/step-utils.js +42 -0
  66. package/build/common/validators/index.d.ts +5 -0
  67. package/build/common/validators/index.js +5 -0
  68. package/build/common/validators/models/model-validators.d.ts +4 -0
  69. package/build/common/validators/models/model-validators.js +63 -0
  70. package/build/common/validators/models/models.utils.d.ts +10 -0
  71. package/build/common/validators/models/models.utils.js +118 -0
  72. package/build/common/validators/schemas/schema-validators.d.ts +9 -0
  73. package/build/common/validators/schemas/schema-validators.js +98 -0
  74. package/build/common/validators/types/type-validators.d.ts +8 -0
  75. package/build/common/validators/types/type-validators.js +14 -0
  76. package/build/common/validators/validationFailures/validation-failures.d.ts +23 -0
  77. package/build/common/validators/validationFailures/validation-failures.js +140 -0
  78. package/build/common/validators/validationFailures/validation-failures.utils.d.ts +10 -0
  79. package/build/common/validators/validationFailures/validation-failures.utils.js +40 -0
  80. package/build/common/validators/values/value-validators.d.ts +2 -0
  81. package/build/common/validators/values/value-validators.js +6 -0
  82. package/build/dynamicFlow/DynamicFlow.d.ts +3 -0
  83. package/build/dynamicFlow/DynamicFlow.js +370 -0
  84. package/build/dynamicFlow/DynamicFlowStep.d.ts +8 -0
  85. package/build/dynamicFlow/DynamicFlowStep.js +32 -0
  86. package/build/dynamicFlow/DynamicFlowTypes.d.ts +51 -0
  87. package/build/dynamicFlow/DynamicFlowTypes.js +4 -0
  88. package/build/dynamicFlow/index.d.ts +1 -0
  89. package/build/dynamicFlow/index.js +1 -0
  90. package/build/dynamicFlow/stories/DynamicFlow.story.d.ts +1 -0
  91. package/build/dynamicFlow/stories/DynamicFlow.story.js +30 -0
  92. package/build/dynamicFlow/stories/EditableDynamicFlow.d.ts +4 -0
  93. package/build/dynamicFlow/stories/EditableDynamicFlow.js +62 -0
  94. package/build/dynamicFlow/stories/fixtureFetcher.d.ts +2 -0
  95. package/build/dynamicFlow/stories/fixtureFetcher.js +114 -0
  96. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.d.ts +20 -0
  97. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +45 -0
  98. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.d.ts +13 -0
  99. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +13 -0
  100. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.d.ts +5 -0
  101. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +12 -0
  102. package/build/dynamicFlow/utils/index.d.ts +5 -0
  103. package/build/dynamicFlow/utils/index.js +5 -0
  104. package/build/dynamicFlow/utils/responseParsers/response-parsers.d.ts +17 -0
  105. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +125 -0
  106. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
  107. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +23 -0
  108. package/build/dynamicFlow/utils/useDynamicFlowState.d.ts +18 -0
  109. package/build/dynamicFlow/utils/useDynamicFlowState.js +110 -0
  110. package/build/dynamicFlow/utils/useLoader.d.ts +9 -0
  111. package/build/dynamicFlow/utils/useLoader.js +22 -0
  112. package/build/fixtures/components/alert.d.ts +3 -0
  113. package/build/fixtures/components/alert.js +31 -0
  114. package/build/fixtures/components/box.d.ts +3 -0
  115. package/build/fixtures/components/box.js +20 -0
  116. package/build/fixtures/components/button.d.ts +3 -0
  117. package/build/fixtures/components/button.js +65 -0
  118. package/build/fixtures/components/columns.d.ts +3 -0
  119. package/build/fixtures/components/columns.js +36 -0
  120. package/build/fixtures/components/copyable.d.ts +3 -0
  121. package/build/fixtures/components/copyable.js +22 -0
  122. package/build/fixtures/components/decision.d.ts +3 -0
  123. package/build/fixtures/components/decision.js +54 -0
  124. package/build/fixtures/components/heading.d.ts +3 -0
  125. package/build/fixtures/components/heading.js +14 -0
  126. package/build/fixtures/components/image.d.ts +3 -0
  127. package/build/fixtures/components/image.js +23 -0
  128. package/build/fixtures/components/index.d.ts +13 -0
  129. package/build/fixtures/components/index.js +13 -0
  130. package/build/fixtures/components/info.d.ts +3 -0
  131. package/build/fixtures/components/info.js +17 -0
  132. package/build/fixtures/components/list.d.ts +3 -0
  133. package/build/fixtures/components/list.js +34 -0
  134. package/build/fixtures/components/loading-indicator.d.ts +3 -0
  135. package/build/fixtures/components/loading-indicator.js +16 -0
  136. package/build/fixtures/components/paragraph.d.ts +3 -0
  137. package/build/fixtures/components/paragraph.js +28 -0
  138. package/build/fixtures/components/review.d.ts +3 -0
  139. package/build/fixtures/components/review.js +60 -0
  140. package/build/fixtures/examples/camera-capture.d.ts +3 -0
  141. package/build/fixtures/examples/camera-capture.js +121 -0
  142. package/build/fixtures/examples/index.d.ts +5 -0
  143. package/build/fixtures/examples/index.js +5 -0
  144. package/build/fixtures/examples/recipient-update.d.ts +3 -0
  145. package/build/fixtures/examples/recipient-update.js +250 -0
  146. package/build/fixtures/examples/recipient.d.ts +3 -0
  147. package/build/fixtures/examples/recipient.js +313 -0
  148. package/build/fixtures/examples/single-file-upload.d.ts +3 -0
  149. package/build/fixtures/examples/single-file-upload.js +98 -0
  150. package/build/fixtures/examples/step-validation-errors.d.ts +3 -0
  151. package/build/fixtures/examples/step-validation-errors.js +75 -0
  152. package/build/fixtures/features/action-response.d.ts +3 -0
  153. package/build/fixtures/features/action-response.js +29 -0
  154. package/build/fixtures/features/external.d.ts +3 -0
  155. package/build/fixtures/features/external.js +31 -0
  156. package/build/fixtures/features/index.d.ts +5 -0
  157. package/build/fixtures/features/index.js +5 -0
  158. package/build/fixtures/features/persist-async.d.ts +3 -0
  159. package/build/fixtures/features/persist-async.js +44 -0
  160. package/build/fixtures/features/polling.d.ts +3 -0
  161. package/build/fixtures/features/polling.js +33 -0
  162. package/build/fixtures/features/validation-async.d.ts +3 -0
  163. package/build/fixtures/features/validation-async.js +38 -0
  164. package/build/fixtures/index.d.ts +46 -0
  165. package/build/fixtures/index.js +23 -0
  166. package/build/fixtures/jsonSchemaForm/allOf.d.ts +3 -0
  167. package/build/fixtures/jsonSchemaForm/allOf.js +119 -0
  168. package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +3 -0
  169. package/build/fixtures/jsonSchemaForm/audRecipient.js +1104 -0
  170. package/build/fixtures/jsonSchemaForm/currency.d.ts +3 -0
  171. package/build/fixtures/jsonSchemaForm/currency.js +48 -0
  172. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +3 -0
  173. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +37 -0
  174. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +3 -0
  175. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +36 -0
  176. package/build/fixtures/jsonSchemaForm/oneOf.d.ts +3 -0
  177. package/build/fixtures/jsonSchemaForm/oneOf.js +119 -0
  178. package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +3 -0
  179. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +53 -0
  180. package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +3 -0
  181. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +56 -0
  182. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +3 -0
  183. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +102 -0
  184. package/build/fixtures/jsonSchemaForm/simple.d.ts +3 -0
  185. package/build/fixtures/jsonSchemaForm/simple.js +48 -0
  186. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +3 -0
  187. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +71 -0
  188. package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +3 -0
  189. package/build/fixtures/jsonSchemaForm/validationAsync.js +23 -0
  190. package/build/fixtures/layouts/all.d.ts +3 -0
  191. package/build/fixtures/layouts/all.js +176 -0
  192. package/build/fixtures/layouts/final-step-layout.d.ts +3 -0
  193. package/build/fixtures/layouts/final-step-layout.js +39 -0
  194. package/build/fixtures/layouts/index.d.ts +6 -0
  195. package/build/fixtures/layouts/index.js +6 -0
  196. package/build/fixtures/layouts/list.d.ts +3 -0
  197. package/build/fixtures/layouts/list.js +33 -0
  198. package/build/fixtures/layouts/pay-in.d.ts +3 -0
  199. package/build/fixtures/layouts/pay-in.js +97 -0
  200. package/build/fixtures/layouts/review.d.ts +3 -0
  201. package/build/fixtures/layouts/review.js +160 -0
  202. package/build/fixtures/layouts/success.d.ts +3 -0
  203. package/build/fixtures/layouts/success.js +66 -0
  204. package/build/fixtures/responses/action-response-final.d.ts +3 -0
  205. package/build/fixtures/responses/action-response-final.js +24 -0
  206. package/build/fixtures/responses/action.d.ts +5 -0
  207. package/build/fixtures/responses/action.js +2 -0
  208. package/build/fixtures/responses/exit.d.ts +6 -0
  209. package/build/fixtures/responses/exit.js +2 -0
  210. package/build/fixtures/responses/index.d.ts +4 -0
  211. package/build/fixtures/responses/index.js +4 -0
  212. package/build/fixtures/responses/recipient-update-final.d.ts +3 -0
  213. package/build/fixtures/responses/recipient-update-final.js +24 -0
  214. package/build/fixtures/schemas/basic-form.d.ts +3 -0
  215. package/build/fixtures/schemas/basic-form.js +39 -0
  216. package/build/fixtures/schemas/index.d.ts +4 -0
  217. package/build/fixtures/schemas/index.js +4 -0
  218. package/build/fixtures/schemas/number-and-integer.d.ts +3 -0
  219. package/build/fixtures/schemas/number-and-integer.js +41 -0
  220. package/build/fixtures/schemas/one-of.d.ts +3 -0
  221. package/build/fixtures/schemas/one-of.js +223 -0
  222. package/build/fixtures/schemas/string-formats.d.ts +3 -0
  223. package/build/fixtures/schemas/string-formats.js +62 -0
  224. package/build/fixtures/utils/image-util.d.ts +2 -0
  225. package/build/fixtures/utils/image-util.js +18 -0
  226. package/build/formControl/FormControl.d.ts +86 -0
  227. package/build/formControl/FormControl.js +241 -0
  228. package/build/formControl/index.d.ts +1 -0
  229. package/build/formControl/index.js +1 -0
  230. package/build/formControl/utils/index.d.ts +1 -0
  231. package/build/formControl/utils/index.js +1 -0
  232. package/build/formControl/utils/value-utils.d.ts +9 -0
  233. package/build/formControl/utils/value-utils.js +108 -0
  234. package/build/i18n/cs.json +8 -0
  235. package/build/i18n/de.json +38 -0
  236. package/build/i18n/en.json +38 -0
  237. package/build/i18n/es.json +38 -0
  238. package/build/i18n/fr.json +38 -0
  239. package/build/i18n/hu.json +38 -0
  240. package/build/i18n/id.json +38 -0
  241. package/build/i18n/index.d.ts +2 -0
  242. package/build/i18n/index.js +31 -0
  243. package/build/i18n/it.json +38 -0
  244. package/build/i18n/ja.json +38 -0
  245. package/build/i18n/pl.json +38 -0
  246. package/build/i18n/pt.json +38 -0
  247. package/build/i18n/ro.json +38 -0
  248. package/build/i18n/ru.json +38 -0
  249. package/build/i18n/th.json +38 -0
  250. package/build/i18n/tr.json +38 -0
  251. package/build/i18n/uk.json +8 -0
  252. package/build/i18n/zh-CN.json +38 -0
  253. package/build/i18n/zh.json +38 -0
  254. package/build/index.d.ts +11 -0
  255. package/build/index.js +9 -0
  256. package/build/jsonSchemaForm/JsonSchemaForm.d.ts +64 -0
  257. package/build/jsonSchemaForm/JsonSchemaForm.js +29 -0
  258. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +13 -0
  259. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +54 -0
  260. package/build/jsonSchemaForm/allOfSchema/index.d.ts +2 -0
  261. package/build/jsonSchemaForm/allOfSchema/index.js +1 -0
  262. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +14 -0
  263. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
  264. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +15 -0
  265. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +26 -0
  266. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.d.ts +1 -0
  267. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
  268. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +17 -0
  269. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +140 -0
  270. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +24 -0
  271. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +18 -0
  272. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +1 -0
  273. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
  274. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +2 -0
  275. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +2 -0
  276. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +6 -0
  277. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +84 -0
  278. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +9 -0
  279. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +14 -0
  280. package/build/jsonSchemaForm/arrayTypeSchema/index.d.ts +2 -0
  281. package/build/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
  282. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +21 -0
  283. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +103 -0
  284. package/build/jsonSchemaForm/basicTypeSchema/index.d.ts +2 -0
  285. package/build/jsonSchemaForm/basicTypeSchema/index.js +1 -0
  286. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +30 -0
  287. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +79 -0
  288. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts +53 -0
  289. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +53 -0
  290. package/build/jsonSchemaForm/controlFeedback/index.d.ts +1 -0
  291. package/build/jsonSchemaForm/controlFeedback/index.js +1 -0
  292. package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +18 -0
  293. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +122 -0
  294. package/build/jsonSchemaForm/genericSchema/index.d.ts +1 -0
  295. package/build/jsonSchemaForm/genericSchema/index.js +1 -0
  296. package/build/jsonSchemaForm/help/Help.d.ts +7 -0
  297. package/build/jsonSchemaForm/help/Help.js +9 -0
  298. package/build/jsonSchemaForm/help/Help.messages.d.ts +8 -0
  299. package/build/jsonSchemaForm/help/Help.messages.js +8 -0
  300. package/build/jsonSchemaForm/help/index.d.ts +1 -0
  301. package/build/jsonSchemaForm/help/index.js +1 -0
  302. package/build/jsonSchemaForm/index.d.ts +1 -0
  303. package/build/jsonSchemaForm/index.js +1 -0
  304. package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +15 -0
  305. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +78 -0
  306. package/build/jsonSchemaForm/objectSchema/index.d.ts +2 -0
  307. package/build/jsonSchemaForm/objectSchema/index.js +1 -0
  308. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +14 -0
  309. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +150 -0
  310. package/build/jsonSchemaForm/oneOfSchema/index.d.ts +2 -0
  311. package/build/jsonSchemaForm/oneOfSchema/index.js +1 -0
  312. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.d.ts +3 -0
  313. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +8 -0
  314. package/build/jsonSchemaForm/oneOfSchema/utils/index.d.ts +2 -0
  315. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +2 -0
  316. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.d.ts +5 -0
  317. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +64 -0
  318. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +15 -0
  319. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
  320. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +8 -0
  321. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +8 -0
  322. package/build/jsonSchemaForm/persistAsyncSchema/index.d.ts +2 -0
  323. package/build/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
  324. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +20 -0
  325. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +165 -0
  326. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +1 -0
  327. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +1 -0
  328. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +19 -0
  329. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +126 -0
  330. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +16 -0
  331. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +32 -0
  332. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +1 -0
  333. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +1 -0
  334. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +8 -0
  335. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
  336. package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +2 -0
  337. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
  338. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.d.ts +2 -0
  339. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +8 -0
  340. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +6 -0
  341. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +27 -0
  342. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +23 -0
  343. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +31 -0
  344. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +8 -0
  345. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +32 -0
  346. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +7 -0
  347. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +55 -0
  348. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +16 -0
  349. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
  350. package/build/jsonSchemaForm/readOnlySchema/index.d.ts +1 -0
  351. package/build/jsonSchemaForm/readOnlySchema/index.js +1 -0
  352. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +24 -0
  353. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +104 -0
  354. package/build/jsonSchemaForm/schemaFormControl/index.d.ts +1 -0
  355. package/build/jsonSchemaForm/schemaFormControl/index.js +1 -0
  356. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.d.ts +3 -0
  357. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +73 -0
  358. package/build/jsonSchemaForm/schemaFormControl/utils/index.d.ts +1 -0
  359. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -0
  360. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +34 -0
  361. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +95 -0
  362. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +16 -0
  363. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +146 -0
  364. package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +2 -0
  365. package/build/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
  366. package/build/layout/DynamicLayout.d.ts +16 -0
  367. package/build/layout/DynamicLayout.js +61 -0
  368. package/build/layout/alert/DynamicAlert.d.ts +5 -0
  369. package/build/layout/alert/DynamicAlert.js +29 -0
  370. package/build/layout/box/DynamicBox.d.ts +7 -0
  371. package/build/layout/box/DynamicBox.js +41 -0
  372. package/build/layout/button/DynamicButton.d.ts +7 -0
  373. package/build/layout/button/DynamicButton.js +58 -0
  374. package/build/layout/columns/DynamicColumns.d.ts +7 -0
  375. package/build/layout/columns/DynamicColumns.js +38 -0
  376. package/build/layout/decision/DynamicDecision.d.ts +8 -0
  377. package/build/layout/decision/DynamicDecision.js +38 -0
  378. package/build/layout/divider/DynamicDivider.d.ts +6 -0
  379. package/build/layout/divider/DynamicDivider.js +9 -0
  380. package/build/layout/external/DynamicExternal.d.ts +8 -0
  381. package/build/layout/external/DynamicExternal.js +32 -0
  382. package/build/layout/external/DynamicExternal.messages.d.ts +8 -0
  383. package/build/layout/external/DynamicExternal.messages.js +8 -0
  384. package/build/layout/form/DynamicForm.d.ts +7 -0
  385. package/build/layout/form/DynamicForm.js +22 -0
  386. package/build/layout/heading/DynamicHeading.d.ts +5 -0
  387. package/build/layout/heading/DynamicHeading.js +31 -0
  388. package/build/layout/icon/DynamicIcon.d.ts +6 -0
  389. package/build/layout/icon/DynamicIcon.js +23 -0
  390. package/build/layout/image/DynamicImage.d.ts +6 -0
  391. package/build/layout/image/DynamicImage.js +110 -0
  392. package/build/layout/index.d.ts +17 -0
  393. package/build/layout/index.js +17 -0
  394. package/build/layout/info/DynamicInfo.d.ts +6 -0
  395. package/build/layout/info/DynamicInfo.js +19 -0
  396. package/build/layout/list/DynamicList.d.ts +7 -0
  397. package/build/layout/list/DynamicList.js +31 -0
  398. package/build/layout/loadingIndicator/DynamicLoadingIndicator.d.ts +6 -0
  399. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +11 -0
  400. package/build/layout/paragraph/DynamicParagraph.d.ts +6 -0
  401. package/build/layout/paragraph/DynamicParagraph.js +43 -0
  402. package/build/layout/paragraph/DynamicParagraph.messages.d.ts +13 -0
  403. package/build/layout/paragraph/DynamicParagraph.messages.js +13 -0
  404. package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +10 -0
  405. package/build/layout/paragraph/useSnackBarIfAvailable.js +9 -0
  406. package/build/layout/review/DynamicReview.d.ts +8 -0
  407. package/build/layout/review/DynamicReview.js +33 -0
  408. package/build/layout/utils.d.ts +7 -0
  409. package/build/layout/utils.js +31 -0
  410. package/build/main.css +185 -0
  411. package/build/step/cameraStep/CameraStep.d.ts +7 -0
  412. package/build/step/cameraStep/CameraStep.js +125 -0
  413. package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +15 -0
  414. package/build/step/cameraStep/cameraCapture/CameraCapture.js +122 -0
  415. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +18 -0
  416. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +18 -0
  417. package/build/step/cameraStep/cameraCapture/components/index.d.ts +7 -0
  418. package/build/step/cameraStep/cameraCapture/components/index.js +28 -0
  419. package/build/step/cameraStep/cameraCapture/hooks/index.d.ts +4 -0
  420. package/build/step/cameraStep/cameraCapture/hooks/index.js +80 -0
  421. package/build/step/cameraStep/cameraCapture/index.d.ts +1 -0
  422. package/build/step/cameraStep/cameraCapture/index.js +1 -0
  423. package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +10 -0
  424. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +78 -0
  425. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +2 -0
  426. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +19 -0
  427. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +13 -0
  428. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +13 -0
  429. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +5 -0
  430. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +21 -0
  431. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +18 -0
  432. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +18 -0
  433. package/build/step/cameraStep/cameraCapture/screens/index.d.ts +2 -0
  434. package/build/step/cameraStep/cameraCapture/screens/index.js +2 -0
  435. package/build/step/cameraStep/cameraCapture/tracking/index.d.ts +7 -0
  436. package/build/step/cameraStep/cameraCapture/tracking/index.js +98 -0
  437. package/build/step/cameraStep/cameraCapture/utils/index.d.ts +8 -0
  438. package/build/step/cameraStep/cameraCapture/utils/index.js +103 -0
  439. package/build/step/cameraStep/index.d.ts +1 -0
  440. package/build/step/cameraStep/index.js +1 -0
  441. package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +6 -0
  442. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
  443. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +23 -0
  444. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
  445. package/build/step/externalConfirmationStep/index.d.ts +1 -0
  446. package/build/step/externalConfirmationStep/index.js +1 -0
  447. package/build/step/index.d.ts +3 -0
  448. package/build/step/index.js +3 -0
  449. package/build/step/layoutStep/LayoutStep.d.ts +10 -0
  450. package/build/step/layoutStep/LayoutStep.js +33 -0
  451. package/build/step/layoutStep/index.d.ts +1 -0
  452. package/build/step/layoutStep/index.js +1 -0
  453. package/build/step/layoutStep/utils/index.d.ts +2 -0
  454. package/build/step/layoutStep/utils/index.js +2 -0
  455. package/build/step/layoutStep/utils/inline-reference-utils.d.ts +7 -0
  456. package/build/step/layoutStep/utils/inline-reference-utils.js +91 -0
  457. package/build/step/layoutStep/utils/layout-utils.d.ts +8 -0
  458. package/build/step/layoutStep/utils/layout-utils.js +217 -0
  459. package/build/types/common/FormControl.d.ts +57 -0
  460. package/build/types/common/FormControl.js +1 -0
  461. package/build/types/index.d.ts +15 -0
  462. package/build/types/index.js +13 -0
  463. package/build/types/specification/Action.d.ts +19 -0
  464. package/build/types/specification/Action.js +1 -0
  465. package/build/types/specification/FileUploadSchema.d.ts +23 -0
  466. package/build/types/specification/FileUploadSchema.js +4 -0
  467. package/build/types/specification/LayoutComponent.d.ts +129 -0
  468. package/build/types/specification/LayoutComponent.js +1 -0
  469. package/build/types/specification/Model.d.ts +12 -0
  470. package/build/types/specification/Model.js +29 -0
  471. package/build/types/specification/PersistAsync.d.ts +8 -0
  472. package/build/types/specification/PersistAsync.js +1 -0
  473. package/build/types/specification/Polling.d.ts +12 -0
  474. package/build/types/specification/Polling.js +1 -0
  475. package/build/types/specification/Promotion.d.ts +20 -0
  476. package/build/types/specification/Promotion.js +1 -0
  477. package/build/types/specification/Schema.d.ts +184 -0
  478. package/build/types/specification/Schema.js +50 -0
  479. package/build/types/specification/Step.d.ts +127 -0
  480. package/build/types/specification/Step.js +4 -0
  481. package/build/types/specification/ValidationAsync.d.ts +6 -0
  482. package/build/types/specification/ValidationAsync.js +1 -0
  483. package/build/types/specification/core.d.ts +29 -0
  484. package/build/types/specification/core.js +1 -0
  485. package/package.json +40 -52
@@ -0,0 +1,114 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ 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;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { action } from '@storybook/addon-actions';
49
+ import { isObject } from '../../common/validators';
50
+ import { fixtures } from '../../fixtures';
51
+ import { getObjectKeys } from './DynamicFlow.story';
52
+ export var fixtureFetcher = function (input, init) { return __awaiter(void 0, void 0, void 0, function () {
53
+ var url;
54
+ return __generator(this, function (_a) {
55
+ action('fixtureFetcher')(input, init);
56
+ url = getURL(input);
57
+ if (url.pathname.startsWith('/steps/')) {
58
+ return [2 /*return*/, respondWithFixture(fixtures.steps, url, init)];
59
+ }
60
+ if (url.pathname.startsWith('/responses/')) {
61
+ return [2 /*return*/, respondWithFixture(fixtures.responses, url, init)];
62
+ }
63
+ if (url.pathname.startsWith('/validate')) {
64
+ return [2 /*return*/, new Response(JSON.stringify({ message: 'Validation-async OK' }))];
65
+ }
66
+ return [2 /*return*/, new Response(null, { status: 404 })];
67
+ });
68
+ }); };
69
+ var getURL = function (input) {
70
+ if (input instanceof URL) {
71
+ return input;
72
+ }
73
+ if (input instanceof Request) {
74
+ return new URL(input.url, 'http://foo');
75
+ }
76
+ return new URL(input, 'http://foo');
77
+ };
78
+ var respondWithFixture = function (fixtures, url, init) { return __awaiter(void 0, void 0, void 0, function () {
79
+ var fixtureNames, name, fixture, body;
80
+ var _a;
81
+ return __generator(this, function (_b) {
82
+ switch (_b.label) {
83
+ case 0:
84
+ fixtureNames = getObjectKeys(fixtures);
85
+ name = url.pathname
86
+ .split('/')
87
+ .filter(function (part) { return !!part; })
88
+ .pop();
89
+ if (!fixtureNames.includes(name !== null && name !== void 0 ? name : '')) return [3 /*break*/, 3];
90
+ fixture = fixtures[name];
91
+ if (!url.searchParams.has('delay')) return [3 /*break*/, 2];
92
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, Number(url.searchParams.get('delay'))); })];
93
+ case 1:
94
+ _b.sent();
95
+ _b.label = 2;
96
+ case 2:
97
+ // by convention if the url contains a "refresh"query parameterm we use the payload as model
98
+ if (url.searchParams.has('refresh') &&
99
+ (init === null || init === void 0 ? void 0 : init.body) &&
100
+ typeof init.body === 'string' &&
101
+ isObject(fixture)) {
102
+ body = JSON.parse(init.body);
103
+ return [2 /*return*/, new Response(JSON.stringify(__assign(__assign({}, fixture), { model: __assign(__assign({}, ((_a = fixture.model) !== null && _a !== void 0 ? _a : {})), body) })))];
104
+ }
105
+ if (url.pathname.includes('exit')) {
106
+ return [2 /*return*/, new Response(JSON.stringify(fixture), { headers: { 'X-DF-Exit': 'true' } })];
107
+ }
108
+ return [2 /*return*/, new Response(JSON.stringify(fixture))];
109
+ case 3:
110
+ action('ERROR 404')(url);
111
+ return [2 /*return*/, new Response(null, { status: 404 })];
112
+ }
113
+ });
114
+ }); };
@@ -0,0 +1,20 @@
1
+ import { Component } from 'react';
2
+ type Props = {
3
+ onError?: (error: Error) => void;
4
+ children: React.ReactNode;
5
+ };
6
+ type State = {
7
+ hasError: boolean;
8
+ isFatalError: boolean;
9
+ };
10
+ declare class ErrorBoundary extends Component<Props, State> {
11
+ constructor(props: Props);
12
+ static getDerivedStateFromError(): {
13
+ hasError: boolean;
14
+ isFatalError: boolean;
15
+ };
16
+ componentDidCatch(error: Error): void;
17
+ handleErrorReset: () => void;
18
+ render(): JSX.Element;
19
+ }
20
+ export default ErrorBoundary;
@@ -0,0 +1,45 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ if (typeof b !== "function" && b !== null)
10
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
11
+ extendStatics(d, b);
12
+ function __() { this.constructor = d; }
13
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
+ };
15
+ })();
16
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
17
+ import { Component } from 'react';
18
+ import { ErrorBoundaryAlert } from './ErrorBoundaryAlert';
19
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
20
+ var noop = function () { };
21
+ var ErrorBoundary = /** @class */ (function (_super) {
22
+ __extends(ErrorBoundary, _super);
23
+ function ErrorBoundary(props) {
24
+ var _this = _super.call(this, props) || this;
25
+ _this.handleErrorReset = function () {
26
+ _this.setState({ hasError: false, isFatalError: false });
27
+ };
28
+ _this.state = { hasError: false, isFatalError: false };
29
+ return _this;
30
+ }
31
+ ErrorBoundary.getDerivedStateFromError = function () {
32
+ return { hasError: true, isFatalError: true };
33
+ };
34
+ ErrorBoundary.prototype.componentDidCatch = function (error) {
35
+ var _a = this.props.onError, onError = _a === void 0 ? noop : _a;
36
+ onError(error);
37
+ };
38
+ ErrorBoundary.prototype.render = function () {
39
+ var children = this.props.children;
40
+ var _a = this.state, hasError = _a.hasError, isFatalError = _a.isFatalError;
41
+ return (_jsxs(_Fragment, { children: [hasError && _jsx(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }), !isFatalError && children] }));
42
+ };
43
+ return ErrorBoundary;
44
+ }(Component));
45
+ export default ErrorBoundary;
@@ -0,0 +1,13 @@
1
+ declare const _default: {
2
+ errorAlert: {
3
+ id: string;
4
+ defaultMessage: string;
5
+ description: string;
6
+ };
7
+ retry: {
8
+ id: string;
9
+ defaultMessage: string;
10
+ description: string;
11
+ };
12
+ };
13
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import { defineMessages } from 'react-intl';
2
+ export default defineMessages({
3
+ errorAlert: {
4
+ id: 'dynamicFlows.ErrorBoundary.errorAlert',
5
+ defaultMessage: 'Oops. Something went wrong...',
6
+ description: 'Generic error message for when something has gone wrong'
7
+ },
8
+ retry: {
9
+ id: 'dynamicFlows.ErrorBoundary.retry',
10
+ defaultMessage: 'Retry',
11
+ description: 'Retry'
12
+ }
13
+ });
@@ -0,0 +1,5 @@
1
+ type Props = {
2
+ onDismiss: () => void;
3
+ };
4
+ export declare const ErrorBoundaryAlert: ({ onDismiss }: Props) => JSX.Element;
5
+ export {};
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Alert, Sentiment } from '@transferwise/components';
3
+ import { useIntl } from 'react-intl';
4
+ import messages from './ErrorBoundary.messages';
5
+ export var ErrorBoundaryAlert = function (_a) {
6
+ var onDismiss = _a.onDismiss;
7
+ var formatMessage = useIntl().formatMessage;
8
+ return (_jsx(Alert, { action: {
9
+ text: formatMessage(messages.retry),
10
+ href: window.location.href
11
+ }, message: formatMessage(messages.errorAlert), type: Sentiment.NEGATIVE, className: "m-b-3", onDismiss: onDismiss }));
12
+ };
@@ -0,0 +1,5 @@
1
+ export * from './useDebouncedRefresh/useDebouncedRefresh';
2
+ export * from './useDynamicFlowState';
3
+ export * from './useLoader';
4
+ export { default as ErrorBoundary } from './errorBoundary/ErrorBoundary';
5
+ export * from './responseParsers/response-parsers';
@@ -0,0 +1,5 @@
1
+ export * from './useDebouncedRefresh/useDebouncedRefresh';
2
+ export * from './useDynamicFlowState';
3
+ export * from './useLoader';
4
+ export { default as ErrorBoundary } from './errorBoundary/ErrorBoundary';
5
+ export * from './responseParsers/response-parsers';
@@ -0,0 +1,17 @@
1
+ import { ActionResponseBody, ErrorResponseBody, Step } from '../../../types';
2
+ import { DynamicFlowProps } from '../../DynamicFlowTypes';
3
+ type ParsedBody = {
4
+ type: 'exit';
5
+ result: Parameters<DynamicFlowProps['onComplete']>[0];
6
+ } | {
7
+ type: 'action';
8
+ action: ActionResponseBody['action'];
9
+ } | {
10
+ type: 'step';
11
+ step: Step;
12
+ etag?: string;
13
+ };
14
+ export declare const parseFetchResponse: (response: Response) => Promise<ParsedBody>;
15
+ export declare const parseErrorResponse: (response: Response) => Promise<ErrorResponseBody>;
16
+ export declare const parseExitResponse: (response: Response) => Promise<Parameters<DynamicFlowProps['onComplete']>[0]>;
17
+ export {};
@@ -0,0 +1,125 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ 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;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { isObject } from '../../../common/validators';
38
+ export var parseFetchResponse = function (response) { return __awaiter(void 0, void 0, void 0, function () {
39
+ var jsonBody, action, etag;
40
+ var _a;
41
+ var _b;
42
+ return __generator(this, function (_c) {
43
+ switch (_c.label) {
44
+ case 0:
45
+ assertResponseIsValid(response);
46
+ if (!((_b = response.headers) === null || _b === void 0 ? void 0 : _b.has('X-Df-Exit'))) return [3 /*break*/, 2];
47
+ _a = { type: 'exit' };
48
+ return [4 /*yield*/, parseExitResponse(response)];
49
+ case 1: return [2 /*return*/, (_a.result = _c.sent(), _a)];
50
+ case 2: return [4 /*yield*/, parseResponseJson(response)];
51
+ case 3:
52
+ jsonBody = _c.sent();
53
+ if (!isObject(jsonBody)) {
54
+ throw new Error('Incorrect response body in response. Expected an object.');
55
+ }
56
+ if (jsonBody.action) {
57
+ if (!isObject(jsonBody.action)) {
58
+ throw new Error('Incorrect response body in action response. Expected an object satisfying the type { action: Action }.');
59
+ }
60
+ action = jsonBody.action;
61
+ if (action.exit === true && isObject(action.result)) {
62
+ return [2 /*return*/, { type: 'exit', result: action.result }];
63
+ }
64
+ return [2 /*return*/, { type: 'action', action: jsonBody.action }];
65
+ }
66
+ etag = response.headers.get('etag') || undefined;
67
+ return [2 /*return*/, { type: 'step', step: jsonBody, etag: etag }];
68
+ }
69
+ });
70
+ }); };
71
+ export var parseErrorResponse = function (response) { return __awaiter(void 0, void 0, void 0, function () {
72
+ var jsonBody;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ assertResponseIsValid(response);
77
+ return [4 /*yield*/, parseResponseJson(response)];
78
+ case 1:
79
+ jsonBody = _a.sent();
80
+ if (!isObject(jsonBody)) {
81
+ throw new Error('Incorrect response body in error response. Expected an object.');
82
+ }
83
+ return [2 /*return*/, jsonBody];
84
+ }
85
+ });
86
+ }); };
87
+ export var parseExitResponse = function (response) { return __awaiter(void 0, void 0, void 0, function () {
88
+ var result;
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0:
92
+ assertResponseIsValid(response);
93
+ return [4 /*yield*/, parseResponseJson(response)];
94
+ case 1:
95
+ result = _a.sent();
96
+ if (isObject(result) || result === null) {
97
+ return [2 /*return*/, result];
98
+ }
99
+ return [2 /*return*/, null];
100
+ }
101
+ });
102
+ }); };
103
+ var parseResponseJson = function (response) { return __awaiter(void 0, void 0, void 0, function () {
104
+ var _a;
105
+ return __generator(this, function (_b) {
106
+ switch (_b.label) {
107
+ case 0:
108
+ _b.trys.push([0, 2, , 3]);
109
+ return [4 /*yield*/, response.json()];
110
+ case 1: return [2 /*return*/, (_b.sent())];
111
+ case 2:
112
+ _a = _b.sent();
113
+ return [2 /*return*/, null];
114
+ case 3: return [2 /*return*/];
115
+ }
116
+ });
117
+ }); };
118
+ var assertResponseIsValid = function (response) {
119
+ if (!(response instanceof Response)) {
120
+ throw new Error('Incorrect type of response from fetch. Expected object of type Response.');
121
+ }
122
+ if (response.bodyUsed) {
123
+ throw new Error('The body of the provided Response object has already been used. Every request must respond with a new Response object.');
124
+ }
125
+ };
@@ -0,0 +1,5 @@
1
+ import { Action, Schema } from '../../../types';
2
+ import { ETag } from '../../DynamicFlowTypes';
3
+ type FetchRefresh = (action: Action, data: unknown, etag: ETag | undefined) => Promise<void | null>;
4
+ export declare function useDebouncedRefresh(fetchRefresh: FetchRefresh): (action: Action, data: unknown, etag: ETag | undefined, schema: Schema) => void;
5
+ export {};
@@ -0,0 +1,23 @@
1
+ import { useRef } from 'react';
2
+ import { debounce, shouldDebounceSchema } from '../../../common/utils';
3
+ var DEBOUNCE_DELAY = 1000; // milliseconds
4
+ export function useDebouncedRefresh(fetchRefresh) {
5
+ var map = useRef(new Map());
6
+ var retrieveOrCreate = function (key) {
7
+ if (map.current.has(key)) {
8
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
9
+ return map.current.get(key);
10
+ }
11
+ var debouncedFetchRefresh = debounce(function (action, data, etag) { return fetchRefresh(action, data, etag); }, DEBOUNCE_DELAY);
12
+ map.current.set(key, debouncedFetchRefresh);
13
+ return debouncedFetchRefresh;
14
+ };
15
+ return function (action, data, etag, schema) {
16
+ var key = action.url || '';
17
+ var debouncedFetchRefresh = retrieveOrCreate(key);
18
+ void debouncedFetchRefresh(action, data, etag);
19
+ if (!schema || !shouldDebounceSchema(schema)) {
20
+ void debouncedFetchRefresh.flush();
21
+ }
22
+ };
23
+ }
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { FormErrors, GlobalError, ObjectModel, Step } from '../../types';
3
+ type ModelsMap = {
4
+ [key: string]: ObjectModel;
5
+ };
6
+ export declare const useDynamicFlowState: (initialStep?: Step) => {
7
+ formErrors: FormErrors;
8
+ globalError: GlobalError;
9
+ step: Step | undefined;
10
+ models: ModelsMap;
11
+ etag: string | undefined;
12
+ modelIsValid: boolean;
13
+ setFormErrors: import("react").Dispatch<import("react").SetStateAction<FormErrors>>;
14
+ setGlobalError: import("react").Dispatch<import("react").SetStateAction<GlobalError>>;
15
+ setStepAndEtag: (step: Step, etag?: string) => void;
16
+ setSchemaModel: (schemaId: string, objectModel: ObjectModel, onModelsUpdated: (models: ModelsMap) => void) => void;
17
+ };
18
+ export {};
@@ -0,0 +1,110 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { useMemo, useState } from 'react';
22
+ import { isValidSchema, getValidObjectModelParts } from '../../common/validators';
23
+ import { isSchema } from '../DynamicFlowTypes';
24
+ export var useDynamicFlowState = function (initialStep) {
25
+ var _a, _b;
26
+ var _c = useState((_a = initialStep === null || initialStep === void 0 ? void 0 : initialStep.errors) === null || _a === void 0 ? void 0 : _a.validation), formErrors = _c[0], setFormErrors = _c[1];
27
+ var _d = useState((_b = initialStep === null || initialStep === void 0 ? void 0 : initialStep.errors) === null || _b === void 0 ? void 0 : _b.error), globalError = _d[0], setGlobalError = _d[1];
28
+ var _e = useState({
29
+ step: initialStep || undefined,
30
+ models: (initialStep === null || initialStep === void 0 ? void 0 : initialStep.model)
31
+ ? buildInitialModels(initialStep.model, getAllSchemas(initialStep))
32
+ : {},
33
+ etag: undefined
34
+ }), stepAndModels = _e[0], setStepAndModels = _e[1];
35
+ var step = stepAndModels.step, models = stepAndModels.models, etag = stepAndModels.etag;
36
+ var setStepAndEtag = function (step, etag) {
37
+ var _a, _b, _c, _d;
38
+ setStepAndModels(function (previous) { return ({
39
+ step: step,
40
+ models: step.model ? buildInitialModels(step.model, getAllSchemas(step)) : previous.models,
41
+ etag: etag
42
+ }); });
43
+ setFormErrors((_b = (_a = step === null || step === void 0 ? void 0 : step.errors) === null || _a === void 0 ? void 0 : _a.validation) !== null && _b !== void 0 ? _b : null);
44
+ setGlobalError((_d = (_c = step === null || step === void 0 ? void 0 : step.errors) === null || _c === void 0 ? void 0 : _c.error) !== null && _d !== void 0 ? _d : null);
45
+ };
46
+ var setSchemaModel = function (schemaId, objectModel, onModelsUpdated) {
47
+ setStepAndModels(function (previous) {
48
+ var _a;
49
+ var updatedModels = __assign(__assign({}, previous.models), (_a = {}, _a[schemaId] = objectModel, _a));
50
+ var updatedState = {
51
+ step: previous.step,
52
+ models: updatedModels,
53
+ etag: previous.etag
54
+ };
55
+ onModelsUpdated(updatedModels);
56
+ return updatedState;
57
+ });
58
+ };
59
+ var modelIsValid = useMemo(function () { return areModelsValid(models, getAllSchemas(step)); }, [models, step]);
60
+ return {
61
+ formErrors: formErrors,
62
+ globalError: globalError,
63
+ step: step,
64
+ models: models,
65
+ etag: etag,
66
+ modelIsValid: modelIsValid,
67
+ setFormErrors: setFormErrors,
68
+ setGlobalError: setGlobalError,
69
+ setStepAndEtag: setStepAndEtag,
70
+ setSchemaModel: setSchemaModel
71
+ };
72
+ };
73
+ var buildInitialModels = function (model, schemas) {
74
+ if (schemas === void 0) { schemas = []; }
75
+ return schemas.reduce(function (acc, schema) {
76
+ var _a;
77
+ if (!schema.$id) {
78
+ // TODO: MC-3224
79
+ // eslint-disable-next-line no-console
80
+ console.warn('Schema without $id property found.');
81
+ }
82
+ return __assign(__assign({}, acc), (_a = {}, _a[schema.$id || ''] = getValidObjectModelParts(model, schema) || {}, _a));
83
+ }, {});
84
+ };
85
+ var getAllSchemas = function (step) { return __spreadArray(__spreadArray([], getAllSchemasInLayout((step === null || step === void 0 ? void 0 : step.layout) || []), true), ((step === null || step === void 0 ? void 0 : step.schemas) || []), true); };
86
+ var getAllSchemasInLayout = function (components) {
87
+ return components.flatMap(function (component) {
88
+ switch (component.type) {
89
+ case 'columns':
90
+ return __spreadArray([], getAllSchemasInLayout(__spreadArray(__spreadArray([], component.left, true), component.right, true)), true);
91
+ case 'box':
92
+ return getAllSchemasInLayout(component.components);
93
+ case 'form':
94
+ return isSchema(component.schema) ? [component.schema] : [];
95
+ default:
96
+ return [];
97
+ }
98
+ });
99
+ };
100
+ var areModelsValid = function (formModels, schemas) {
101
+ if (schemas === void 0) { schemas = []; }
102
+ return !(schemas === null || schemas === void 0 ? void 0 : schemas.some(function (schema) {
103
+ if (!schema.$id) {
104
+ // TODO: MC-3224
105
+ // eslint-disable-next-line no-console
106
+ console.warn('Schema without $id property found.');
107
+ }
108
+ return !isValidSchema(formModels[schema.$id || ''] || {}, schema);
109
+ }));
110
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { DynamicFlowProps } from '../DynamicFlowTypes';
3
+ type LoadingState = 'idle' | 'initial' | 'refresh' | 'submission';
4
+ export declare function useLoader(loaderConfig: DynamicFlowProps['loaderConfig'], initialState: LoadingState): {
5
+ loadingState: "initial" | "idle" | "refresh" | "submission";
6
+ setLoadingState: import("react").Dispatch<import("react").SetStateAction<"initial" | "idle" | "refresh" | "submission">>;
7
+ loader: JSX.Element | null;
8
+ };
9
+ export {};
@@ -0,0 +1,22 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { Loader, Size } from '@transferwise/components';
14
+ import { useState } from 'react';
15
+ export function useLoader(loaderConfig, initialState) {
16
+ var config = __assign({ size: Size.EXTRA_LARGE, initial: true, submission: false }, loaderConfig);
17
+ var _a = useState(initialState), loadingState = _a[0], setLoadingState = _a[1];
18
+ var shouldDisplayLoader = (config.initial && loadingState === 'initial') ||
19
+ (config.submission && loadingState === 'submission');
20
+ var loader = shouldDisplayLoader ? (_jsx(Loader, { size: config.size, classNames: { 'tw-loader': 'tw-loader m-x-auto' }, "data-testid": "loader" })) : null;
21
+ return { loadingState: loadingState, setLoadingState: setLoadingState, loader: loader };
22
+ }
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -0,0 +1,31 @@
1
+ var step = {
2
+ type: 'form',
3
+ key: 'Components/Alert',
4
+ title: 'Alert Component',
5
+ description: 'Alerts can have different contexts.',
6
+ actions: [],
7
+ schemas: [],
8
+ layout: [
9
+ {
10
+ type: 'alert',
11
+ markdown: 'This is an alert with "neutral" context. A subset of Markdown features are supported, like **bold text**, and __italic__ I think. But no line breaks nor links.',
12
+ context: 'neutral'
13
+ },
14
+ {
15
+ type: 'alert',
16
+ markdown: 'This is an alert with "warning" context. A subset of Markdown features are supported, like **bold text**, and __italic__ I think. But no line breaks nor links.',
17
+ context: 'warning'
18
+ },
19
+ {
20
+ type: 'alert',
21
+ markdown: 'This is an alert with "positive" context. A subset of Markdown features are supported, like **bold text**, and __italic__ I think. But no line breaks nor links.',
22
+ context: 'positive'
23
+ },
24
+ {
25
+ type: 'alert',
26
+ markdown: 'This is an alert with "negative" context. A subset of Markdown features are supported, like **bold text**, and __italic__ I think. But no line breaks nor links.',
27
+ context: 'negative'
28
+ },
29
+ ]
30
+ };
31
+ export default step;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;
@@ -0,0 +1,20 @@
1
+ var step = {
2
+ type: 'form',
3
+ key: 'Components/Box',
4
+ title: 'Box Component',
5
+ description: 'Box is a container for other layour components. It can have a border!',
6
+ actions: [],
7
+ schemas: [],
8
+ layout: ['xs', 'sm', 'md', 'lg', 'xl'].map(function (size) { return ({
9
+ type: 'box',
10
+ width: size,
11
+ border: true,
12
+ components: [
13
+ {
14
+ type: 'paragraph',
15
+ text: "This paragraph is inside a box with border: \"true\" and width: \"".concat(size, "\".")
16
+ },
17
+ ]
18
+ }); })
19
+ };
20
+ export default step;
@@ -0,0 +1,3 @@
1
+ import { FormStep } from '../../types';
2
+ declare const step: FormStep;
3
+ export default step;