@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
package/README.md CHANGED
@@ -23,17 +23,18 @@ pnpm install @wise/dynamic-flow-client
23
23
 
24
24
  ```
25
25
  # yarn
26
- yarn add prop-types react react-dom react-intl
27
- yarn add @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css @transferwise/neptune-validation
26
+ yarn add react react-dom react-intl
27
+ yarn add @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
28
28
 
29
29
  # npm
30
- npm install prop-types react react-dom react-intl
31
- npm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css @transferwise/neptune-validation
30
+ npm install react react-dom react-intl
31
+ npm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
32
32
 
33
33
  # pnpm
34
- pnpm install prop-types react react-dom react-intl
35
- pnpm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css @transferwise/neptune-validation
34
+ pnpm install react react-dom react-intl
35
+ pnpm install @transferwise/components @transferwise/formatting @transferwise/icons @transferwise/neptune-css
36
36
  ```
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`.
37
38
 
38
39
  ```js
39
40
  // Should be imported once in your application
@@ -50,10 +51,7 @@ import {
50
51
  getLangFromLocale,
51
52
  DEFAULT_LANG,
52
53
  } from '@transferwise/components';
53
- import {
54
- DynamicFlow,
55
- translations as dynamicFlowsTranslations,
56
- } from '@wise/dynamic-flow-client/';
54
+ import { DynamicFlow, translations as dynamicFlowsTranslations } from '@wise/dynamic-flow-client/';
57
55
 
58
56
  const lang = getLangFromLocale(locale) || DEFAULT_LANG;
59
57
  const i18n = {
@@ -88,7 +86,7 @@ We recommend using a `initialAction` and a `fetcher` function.
88
86
  <DynamicFlow
89
87
  initialAction={{ method: 'GET', url: '/my-amazing-new-flow' }}
90
88
  fetcher={(...args) => fetch(...args)}
91
- onClose={(result) => {
89
+ onComplete={(result) => {
92
90
  console.log('Flow exited with', result);
93
91
  }}
94
92
  onError={(error, statusCode) => {
@@ -105,44 +103,70 @@ In some cases you may want to obtain the initial step yourself, and then pass it
105
103
  <DynamicFlow
106
104
  initialStep={someInitialStepIfoundLayingAroundHere}
107
105
  fetcher={...}
108
- onClose={...}
106
+ onComplete={...}
109
107
  onError={...}
110
108
  />
111
109
  ```
112
110
 
113
- ### `baseUrl` vs `fetcher`
111
+ ### The `fetcher` function prop
114
112
 
115
- We recommend passing a fetcher function. This can be `window.fetch` itself or some wrapper function where you inject auth headers and anything else you many need.
113
+ You must pass a fetcher function. This can be `window.fetch` itself or some wrapper function where you inject authorisation headers and anything else you many need.
116
114
 
117
- You can take advantage of the `makeFetcher` utility function. This function takes a `baseUrl` and `additionalHeaders` arguments. The `baseUrl` will be prefixed to any relative request URLs. Absolute URLs will not be altered. The `additionalHeaders` parameter can be used to add any request headers you need in all requests, such as `{ 'X-Access-Token': 'Tr4n5f3rw153' }`:
115
+ You can take advantage of the provided `makeFetcher` utility function. This function takes `baseUrl` and `additionalHeaders` arguments. The `baseUrl` will be prefixed to any relative request URLs. Absolute URLs will not be altered. The `additionalHeaders` parameter can be used to add any request headers you need in all requests.
118
116
 
119
117
  ```tsx
120
118
  import { makeFetcher, DynamicFlow } from '@wise/dynamic-flow-client';
121
119
 
122
- const myFetcher = makeFetcher('/my-base-url', { 'X-Access-Token': 'Tr4n5f3rw153' });
123
-
124
- ...
120
+ const myFetcher = makeFetcher('/my-base-url', { 'X-Access-Token': 'an-access-token' });
125
121
 
126
122
  <DynamicFlow
127
- initialAction={{ method: 'GET', url: '/my-amazing-new-flow' }}
123
+ initialAction={{ method: 'GET', url: '/flow-starting-url' }}
128
124
  fetcher={myFetcher}
129
- // baseUrl="/my-base-url"
130
- onClose={...}
125
+ onComplete={...}
131
126
  onError={...}
132
127
  />
133
128
  ```
134
129
 
135
- **Important**: You must not throw from your fetcher function. Errors should result in a response with an error status code and potentially a body with an error message.
130
+ #### Custom `fetcher` functions
136
131
 
137
- ### Logging and Tracking
132
+ If you want to write your own fetcher function (or if you're writing mocks), it's important that you return proper `Response` objects, and that you **do not throw**. Errors should result in a response with an error status code and potentially a body with an error message. For example:
138
133
 
139
- The `DynamicFlow` component accepts two optional props: `onTrackableEvent` and `onLog` which can be used to track and log.
134
+ ```tsx
135
+ const mockFetcher = (input, init) => {
136
+ switch (input) {
137
+ case '/standard':
138
+ return Promise.resolve(new Response(init.body));
139
+ case '/exit':
140
+ return Promise.resolve(new Response(init.body, { headers: { 'x-df-exit': true } }));
141
+ case '/error':
142
+ default:
143
+ return Promise.resolve(new Response('An error has occurred.', { status: 500 }));
144
+ }
145
+ };
146
+ ```
147
+
148
+ Also, please make sure your mocks return a new `Response` instace every time. This is because responses are mutated when we parse their body, and they cannot be parsed a second time.
149
+
150
+ ```ts
151
+ const initialResponse = new Response(JSON.stringify(initialStep));
152
+ // ❌ wrong - the same instance is returned on each request
153
+ const mockFetcher = (input, init) => Promise.resolve(initialResponse);
154
+ ```
155
+
156
+ ```ts
157
+ // ✅ correct - a new instance is returned on each request
158
+ const mockFetcher = (input, init) => Promise.resolve(new Response(JSON.stringify(initialStep)));
159
+ ```
160
+
161
+ ### Telemetry
162
+
163
+ The `DynamicFlow` component accepts two optional props: `onEvent` and `onLog` which can be used to track and log.
140
164
 
141
165
  In the example below we send tracking events to Mixpanel and logging events to Rollbar.
142
166
 
143
167
  ```tsx
144
168
  <DynamicFlow
145
- onTrackableEvent={(event, props) => mixpanel.track(event, props)}
169
+ onEvent={(event, props) => mixpanel.track(event, props)}
146
170
  onLog={(level, message, extra) => Rollbar[level](message, extra)}
147
171
  />
148
172
  ```
@@ -150,7 +174,7 @@ In the example below we send tracking events to Mixpanel and logging events to R
150
174
  Alternatively, you can log to the browser console:
151
175
 
152
176
  ```ts
153
- onTrackableEvent={(event, props) => console.log(event, props)}
177
+ onEvent={(event, props) => console.log(event, props)}
154
178
  onLog={(level, message, extra) => {
155
179
  const levelToConsole = {
156
180
  critical: console.error,
@@ -183,8 +207,6 @@ type LoaderConfig = {
183
207
  | `initial` | boolean | Whether or not to display the Loader component while loading the initial step. | true |
184
208
  | `submission` | boolean | Whether or not to display the Loader component during form submissions. | false |
185
209
 
186
-
187
210
  ## Contributing
188
211
 
189
212
  We love contributions! Check out `CONTRIBUTING.md` for more information.
190
-
@@ -0,0 +1,4 @@
1
+ export declare const DateMode: {
2
+ DAY_MONTH_YEAR: string;
3
+ MONTH_YEAR: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export var DateMode = {
2
+ DAY_MONTH_YEAR: 'day-month-year',
3
+ MONTH_YEAR: 'month-year'
4
+ };
@@ -0,0 +1,17 @@
1
+ export declare const FormControlType: {
2
+ RADIO: string;
3
+ CHECKBOX: string;
4
+ SELECT: string;
5
+ FILE: string;
6
+ DATE: string;
7
+ DATETIME: string;
8
+ DATELOOKUP: string;
9
+ TEL: string;
10
+ NUMBER: string;
11
+ HIDDEN: string;
12
+ PASSWORD: string;
13
+ TEXT: string;
14
+ TEXTAREA: string;
15
+ UPLOAD: string;
16
+ TAB: string;
17
+ };
@@ -0,0 +1,17 @@
1
+ export var FormControlType = {
2
+ RADIO: 'radio',
3
+ CHECKBOX: 'checkbox',
4
+ SELECT: 'select',
5
+ FILE: 'file',
6
+ DATE: 'date',
7
+ DATETIME: 'date-time',
8
+ DATELOOKUP: 'date-lookup',
9
+ TEL: 'tel',
10
+ NUMBER: 'number',
11
+ HIDDEN: 'hidden',
12
+ PASSWORD: 'password',
13
+ TEXT: 'text',
14
+ TEXTAREA: 'textarea',
15
+ UPLOAD: 'upload',
16
+ TAB: 'tab'
17
+ };
@@ -0,0 +1,4 @@
1
+ export declare const MonthFormat: {
2
+ SHORT: string;
3
+ LONG: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export var MonthFormat = {
2
+ SHORT: 'short',
3
+ LONG: 'long'
4
+ };
@@ -0,0 +1,11 @@
1
+ export declare const SchemaType: {
2
+ READ_ONLY: string;
3
+ PERSIST_ASYNC: string;
4
+ VALIDATION_ASYNC: string;
5
+ OBJECT: string;
6
+ PROMOTED_ONE_OF: string;
7
+ ONE_OF: string;
8
+ ALL_OF: string;
9
+ BASIC: string;
10
+ ARRAY: string;
11
+ };
@@ -0,0 +1,11 @@
1
+ export var SchemaType = {
2
+ READ_ONLY: 'readOnly',
3
+ PERSIST_ASYNC: 'persistAsync',
4
+ VALIDATION_ASYNC: 'validationAsync',
5
+ OBJECT: 'object',
6
+ PROMOTED_ONE_OF: 'promotedOneOf',
7
+ ONE_OF: 'oneOf',
8
+ ALL_OF: 'allOf',
9
+ BASIC: 'basic',
10
+ ARRAY: 'array'
11
+ };
@@ -0,0 +1,7 @@
1
+ export declare const Size: {
2
+ EXTRA_SMALL: string;
3
+ SMALL: string;
4
+ MEDIUM: string;
5
+ LARGE: string;
6
+ EXTRA_LARGE: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ export var Size = {
2
+ EXTRA_SMALL: 'xs',
3
+ SMALL: 'sm',
4
+ MEDIUM: 'md',
5
+ LARGE: 'lg',
6
+ EXTRA_LARGE: 'xl'
7
+ };
@@ -0,0 +1,5 @@
1
+ export * from './DateMode';
2
+ export * from './FormControlType';
3
+ export * from './MonthFormat';
4
+ export * from './SchemaType';
5
+ export * from './Size';
@@ -0,0 +1,5 @@
1
+ export * from './DateMode';
2
+ export * from './FormControlType';
3
+ export * from './MonthFormat';
4
+ export * from './SchemaType';
5
+ export * from './Size';
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ type Props = {
3
+ loading: boolean;
4
+ children: React.ReactNode;
5
+ };
6
+ export declare const DynamicFlowProvider: ({ loading, children }: Props) => JSX.Element;
7
+ export declare const useDynamicFlow: () => {
8
+ loading: boolean;
9
+ registerPersistAsyncPromise: (promise: Promise<unknown>) => void;
10
+ };
11
+ export {};
@@ -0,0 +1,36 @@
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 { createContext, useContext, useMemo } from 'react';
14
+ import { usePendingPromiseCounter } from './usePendingPromiseCounter';
15
+ var defaultContextValue = {
16
+ loading: false,
17
+ registerPersistAsyncPromise: function (promise) {
18
+ //
19
+ }
20
+ };
21
+ var DFContext = createContext(defaultContextValue);
22
+ export var DynamicFlowProvider = function (_a) {
23
+ var loading = _a.loading, children = _a.children;
24
+ var _b = usePendingPromiseCounter(), pendingPromises = _b.pendingPromises, addPendingPromise = _b.addPendingPromise;
25
+ var providerValue = useMemo(function () {
26
+ return {
27
+ loading: loading || pendingPromises > 0,
28
+ registerPersistAsyncPromise: addPendingPromise
29
+ };
30
+ }, [loading, pendingPromises, addPendingPromise]);
31
+ return _jsx(DFContext.Provider, __assign({ value: providerValue }, { children: children }));
32
+ };
33
+ export var useDynamicFlow = function () {
34
+ var context = useContext(DFContext);
35
+ return context || defaultContextValue;
36
+ };
@@ -0,0 +1,4 @@
1
+ export declare function usePendingPromiseCounter(): {
2
+ addPendingPromise: (promise: Promise<unknown>) => void;
3
+ pendingPromises: number;
4
+ };
@@ -0,0 +1,13 @@
1
+ import { useCallback, useState } from 'react';
2
+ export function usePendingPromiseCounter() {
3
+ var _a = useState(0), count = _a[0], setCount = _a[1];
4
+ var addPendingPromise = useCallback(function (promise) {
5
+ setCount(function (c) { return c + 1; });
6
+ promise["catch"](noop)["finally"](function () { return delayUntilNextCycle(function () { return setCount(function (c) { return Math.max(0, c - 1); }); }); });
7
+ }, [setCount]);
8
+ return { addPendingPromise: addPendingPromise, pendingPromises: count };
9
+ }
10
+ var delayUntilNextCycle = function (fn) { return setTimeout(function () { return fn(); }, 0); };
11
+ var noop = function () {
12
+ // no-op
13
+ };
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export type EventName = 'Dynamic Flow - Flow Started' | 'Dynamic Flow - Flow Finished' | 'Dynamic Flow - Step Started' | 'Dynamic Flow - Step Submitted' | 'Dynamic Flow - Step Refreshed' | 'Dynamic Flow - OneOf Selected' | 'Dynamic Flow - PersistAsync' | 'Dynamic Flow - ValidationAsync' | 'Dynamic Flow - Camera Permission Denied' | 'Dynamic Flow - Camera Feed Started' | 'Dynamic Flow - Camera Not Supported' | 'Dynamic Flow - invalid submission response' | 'Dynamic Flow - onAction supressed' | 'Dynamic Flow - OneOf Searched';
3
+ export type EventHandler = (eventName: EventName, properties: Record<string, unknown>) => void;
4
+ type Props = {
5
+ metadata?: Record<string, unknown> & {
6
+ flowId?: string;
7
+ stepId?: string;
8
+ };
9
+ children: React.ReactNode;
10
+ onEvent: EventHandler;
11
+ };
12
+ export declare const EventsContextProvider: ({ metadata, children, onEvent }: Props) => JSX.Element;
13
+ export declare function useEventDispatcher(): EventHandler;
14
+ export declare const getEventDispatcher: (onEvent: EventHandler, metadata?: Record<string, unknown>) => EventHandler;
15
+ export {};
@@ -0,0 +1,33 @@
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 { createContext, useContext, useMemo } from 'react';
14
+ var EventsContext = createContext({
15
+ triggerEvent: function () {
16
+ // noop
17
+ }
18
+ });
19
+ export var EventsContextProvider = function (_a) {
20
+ var metadata = _a.metadata, children = _a.children, onEvent = _a.onEvent;
21
+ var value = useMemo(function () { return ({ triggerEvent: getEventDispatcher(onEvent, metadata) }); }, [onEvent, metadata]);
22
+ return _jsx(EventsContext.Provider, __assign({ value: value }, { children: children }));
23
+ };
24
+ export function useEventDispatcher() {
25
+ var triggerEvent = useContext(EventsContext).triggerEvent;
26
+ return triggerEvent;
27
+ }
28
+ export var getEventDispatcher = function (onEvent, metadata) {
29
+ return function (eventName, properties) {
30
+ if (properties === void 0) { properties = {}; }
31
+ return onEvent(eventName, __assign(__assign({}, metadata), properties));
32
+ };
33
+ };
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ type Fetcher = typeof fetch;
3
+ type FetcherProviderProps = {
4
+ fetcher: Fetcher;
5
+ children: React.ReactNode;
6
+ };
7
+ export declare const FetcherProvider: ({ fetcher, children }: FetcherProviderProps) => JSX.Element;
8
+ type FetcherProviderFromBaseUrlProps = {
9
+ baseUrl: string;
10
+ children: React.ReactNode;
11
+ };
12
+ export declare const FetcherProviderFromBaseUrl: ({ baseUrl, children, }: FetcherProviderFromBaseUrlProps) => JSX.Element;
13
+ /**
14
+ * Provides the fetch(er) function for dynamic flows asynchronous operations.
15
+ */
16
+ export declare const useFetcher: () => typeof fetch;
17
+ export declare const useHasFetcherProvider: () => boolean;
18
+ export {};
@@ -0,0 +1,35 @@
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 { createContext, useContext, useMemo } from 'react';
14
+ import { makeFetcher } from '../../makeFetcher';
15
+ var FetcherContext = createContext(undefined);
16
+ export var FetcherProvider = function (_a) {
17
+ var fetcher = _a.fetcher, children = _a.children;
18
+ return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
19
+ };
20
+ export var FetcherProviderFromBaseUrl = function (_a) {
21
+ var baseUrl = _a.baseUrl, children = _a.children;
22
+ var fetcher = useMemo(function () { return makeFetcher(baseUrl); }, [baseUrl]);
23
+ return _jsx(FetcherContext.Provider, __assign({ value: fetcher }, { children: children }));
24
+ };
25
+ /**
26
+ * Provides the fetch(er) function for dynamic flows asynchronous operations.
27
+ */
28
+ export var useFetcher = function () {
29
+ var contextFetch = useContext(FetcherContext);
30
+ return contextFetch || fetch;
31
+ };
32
+ export var useHasFetcherProvider = function () {
33
+ var context = useContext(FetcherContext);
34
+ return !!context;
35
+ };
@@ -0,0 +1,4 @@
1
+ export * from './dynamicFlowContexts/DynamicFlowContexts';
2
+ export * from './eventsContext/EventsContext';
3
+ export * from './fetcherContexts/FetcherContexts';
4
+ export * from './logContext/LogContext';
@@ -0,0 +1,4 @@
1
+ export * from './dynamicFlowContexts/DynamicFlowContexts';
2
+ export * from './eventsContext/EventsContext';
3
+ export * from './fetcherContexts/FetcherContexts';
4
+ export * from './logContext/LogContext';
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ export type LogLevel = 'debug' | 'info' | 'warning' | 'error' | 'critical';
3
+ export type LogTitle = 'Invalid schema or model' | 'Invalid model on change' | 'Invalid response' | 'Action supressed' | 'Deprecation advanced warning' | 'Deprecated schema' | 'Error fetching';
4
+ type ExtraProps = Record<string, unknown>;
5
+ export type LogEventHandler = (level: LogLevel, message: string, extra: ExtraProps) => void;
6
+ type LogFunction = (title: LogTitle, description: string, extra?: ExtraProps) => void;
7
+ export declare const getLogger: (level: LogLevel, onLog: LogEventHandler, flowId?: string | undefined, stepId?: string | undefined) => LogFunction;
8
+ type LogProviderProps = {
9
+ flowId?: string;
10
+ stepId?: string;
11
+ children: React.ReactNode;
12
+ onLog: LogEventHandler;
13
+ };
14
+ export declare const LogProvider: ({ flowId, stepId, children, onLog }: LogProviderProps) => JSX.Element;
15
+ export declare const useLogger: () => {
16
+ debug: LogFunction;
17
+ info: LogFunction;
18
+ warning: LogFunction;
19
+ error: LogFunction;
20
+ critical: LogFunction;
21
+ };
22
+ export {};
@@ -0,0 +1,39 @@
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 { createContext, useContext, useMemo } from 'react';
14
+ export var getLogger = function (level, onLog, flowId, stepId) {
15
+ if (flowId === void 0) { flowId = 'UNKNOWN-FLOW-ID'; }
16
+ if (stepId === void 0) { stepId = 'UNKNOWN-FLOW-ID'; }
17
+ return function (title, description, extra) {
18
+ return onLog(level, "Dynamic Flow ".concat(level, " - ").concat(title, " - ").concat(description), __assign({ flowId: flowId, stepId: stepId }, extra));
19
+ };
20
+ };
21
+ var LogContext = createContext(null);
22
+ export var LogProvider = function (_a) {
23
+ var flowId = _a.flowId, stepId = _a.stepId, children = _a.children, onLog = _a.onLog;
24
+ var value = useMemo(function () { return ({
25
+ debug: getLogger('debug', onLog, flowId, stepId),
26
+ info: getLogger('info', onLog, flowId, stepId),
27
+ warning: getLogger('warning', onLog, flowId, stepId),
28
+ error: getLogger('error', onLog, flowId, stepId),
29
+ critical: getLogger('critical', onLog, flowId, stepId)
30
+ }); }, [onLog, flowId, stepId]);
31
+ return _jsx(LogContext.Provider, __assign({ value: value }, { children: children }));
32
+ };
33
+ export var useLogger = function () {
34
+ var logging = useContext(LogContext);
35
+ if (logging == null) {
36
+ throw new Error('Logging context not found. Did you forget to wrap your component in a <LogProvider />?');
37
+ }
38
+ return logging;
39
+ };
@@ -0,0 +1,7 @@
1
+ export * from './useDebouncedFunction/useDebouncedFunction';
2
+ export * from './useExternal/useExternal';
3
+ export * from './useExternalStepPolling/useExternalStepPolling';
4
+ export * from './usePersistAsync/usePersistAsync';
5
+ export * from './usePolling/usePolling';
6
+ export * from './usePrevious/usePrevious';
7
+ export * from './useStepPolling/useStepPolling';
@@ -0,0 +1,7 @@
1
+ export * from './useDebouncedFunction/useDebouncedFunction';
2
+ export * from './useExternal/useExternal';
3
+ export * from './useExternalStepPolling/useExternalStepPolling';
4
+ export * from './usePersistAsync/usePersistAsync';
5
+ export * from './usePolling/usePolling';
6
+ export * from './usePrevious/usePrevious';
7
+ export * from './useStepPolling/useStepPolling';
@@ -0,0 +1,2 @@
1
+ import { DebouncedFunc } from '../../utils';
2
+ export declare function useDebouncedFunction<T extends (...args: any[]) => any>(callback: T, waitMs: number): DebouncedFunc<T>;
@@ -0,0 +1,9 @@
1
+ /* References:
2
+ - https://github.com/gnbaron/use-lodash-debounce
3
+ - https://dmitripavlutin.com/react-throttle-debounce/
4
+ */
5
+ import { useCallback } from 'react';
6
+ import { debounce } from '../../utils';
7
+ export function useDebouncedFunction(callback, waitMs) {
8
+ return useCallback(debounce(callback, waitMs), [callback, waitMs]);
9
+ }
@@ -0,0 +1,4 @@
1
+ export declare function useExternal(url?: string): {
2
+ requiresManualTrigger: boolean;
3
+ dismissConfirmation: () => void;
4
+ };
@@ -0,0 +1,15 @@
1
+ import { useEffect, useState } from 'react';
2
+ export function useExternal(url) {
3
+ // If we fail to open the window, the user will need to open this on their own
4
+ var _a = useState(null), externalWindow = _a[0], setExternalWindow = _a[1];
5
+ var _b = useState(false), hasManuallyTriggered = _b[0], setHasManuallyTriggered = _b[1];
6
+ var dismissConfirmation = function () { return setHasManuallyTriggered(true); };
7
+ useEffect(function () {
8
+ if (url) {
9
+ setHasManuallyTriggered(false);
10
+ setExternalWindow(window.open(url, '_blank'));
11
+ }
12
+ }, [url]);
13
+ var requiresManualTrigger = Boolean(url && !externalWindow && !hasManuallyTriggered);
14
+ return { requiresManualTrigger: requiresManualTrigger, dismissConfirmation: dismissConfirmation };
15
+ }
@@ -0,0 +1,12 @@
1
+ import { Action, PollingConfiguration } from '../../../types';
2
+ export type ExternalStepPollingConfiguration = PollingConfiguration & {
3
+ maxConsecutiveFails: number;
4
+ responseHandlers: ResponseHandler[];
5
+ };
6
+ type ResponseHandler = {
7
+ result: string;
8
+ action: Action;
9
+ };
10
+ /** @deprecated External step is no longer supported */
11
+ export declare function useExternalStepPolling(polling: ExternalStepPollingConfiguration | undefined, onAction: (action: Action) => void): void;
12
+ export {};