@wise/dynamic-flow-client 0.1.2 → 0.1.4

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 (480) hide show
  1. package/build/common/api/utils.d.ts +4 -0
  2. package/build/common/api/utils.js +13 -0
  3. package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.d.ts +11 -0
  4. package/build/common/contexts/dynamicFlowContext/dynamicFlowContext.js +36 -0
  5. package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.d.ts +4 -0
  6. package/build/common/contexts/dynamicFlowContext/usePendingPromiseCounter.js +13 -0
  7. package/build/common/contexts/fetcherContext/fetcherContext.d.ts +18 -0
  8. package/build/common/contexts/fetcherContext/fetcherContext.js +35 -0
  9. package/build/common/contexts/fetcherContext/index.d.ts +2 -0
  10. package/build/common/contexts/fetcherContext/index.js +2 -0
  11. package/build/common/contexts/fetcherContext/makeFetcher.d.ts +2 -0
  12. package/build/common/contexts/fetcherContext/makeFetcher.js +33 -0
  13. package/build/common/general/index.d.ts +2 -0
  14. package/build/common/general/index.js +22 -0
  15. package/build/common/hooks/useDebouncedFunction.d.ts +2 -0
  16. package/build/common/hooks/useDebouncedFunction.js +9 -0
  17. package/build/common/hooks/useDebouncedFunction.test.d.ts +1 -0
  18. package/build/common/hooks/useDebouncedFunction.test.js +59 -0
  19. package/build/common/hooks/usePersistAsync.d.ts +7 -0
  20. package/build/common/hooks/usePersistAsync.js +170 -0
  21. package/build/common/hooks/usePolling.d.ts +11 -0
  22. package/build/common/hooks/usePolling.js +48 -0
  23. package/build/common/hooks/usePrevious.d.ts +2 -0
  24. package/build/common/hooks/usePrevious.js +9 -0
  25. package/build/common/index.d.ts +4 -0
  26. package/build/common/index.js +4 -0
  27. package/build/common/logging/index.d.ts +22 -0
  28. package/build/common/logging/index.js +39 -0
  29. package/build/common/logging/spec.d.ts +1 -0
  30. package/build/common/logging/spec.js +45 -0
  31. package/build/common/messages.d.ts +8 -0
  32. package/build/common/messages.js +8 -0
  33. package/build/common/propsValues/dateMode.d.ts +4 -0
  34. package/build/common/propsValues/dateMode.js +4 -0
  35. package/build/common/propsValues/formControlType.d.ts +17 -0
  36. package/build/common/propsValues/formControlType.js +17 -0
  37. package/build/common/propsValues/monthFormat.d.ts +4 -0
  38. package/build/common/propsValues/monthFormat.js +4 -0
  39. package/build/common/propsValues/size.d.ts +7 -0
  40. package/build/common/propsValues/size.js +7 -0
  41. package/build/common/requirements.d.ts +10 -0
  42. package/build/common/requirements.js +50 -0
  43. package/build/common/schemaTypes/schemaTypes.d.ts +23 -0
  44. package/build/common/schemaTypes/schemaTypes.js +53 -0
  45. package/build/common/schemaTypes/shouldDebounceSchema.d.ts +2 -0
  46. package/build/common/schemaTypes/shouldDebounceSchema.js +6 -0
  47. package/build/common/stepTypes/stepTypes.d.ts +7 -0
  48. package/build/common/stepTypes/stepTypes.js +42 -0
  49. package/build/common/tracking/index.d.ts +15 -0
  50. package/build/common/tracking/index.js +33 -0
  51. package/build/common/tracking/spec.d.ts +1 -0
  52. package/build/common/tracking/spec.js +49 -0
  53. package/build/common/utils/file-utils.d.ts +4 -0
  54. package/build/common/utils/file-utils.js +45 -0
  55. package/build/common/utils/generate-random-id.d.ts +1 -0
  56. package/build/common/utils/generate-random-id.js +5 -0
  57. package/build/common/utils/generate-random-id.test.d.ts +1 -0
  58. package/build/common/utils/generate-random-id.test.js +12 -0
  59. package/build/common/validation/rule-validators/index.d.ts +10 -0
  60. package/build/common/validation/rule-validators/index.js +40 -0
  61. package/build/common/validation/rule-validators/spec.d.ts +1 -0
  62. package/build/common/validation/rule-validators/spec.js +145 -0
  63. package/build/common/validation/schema-validators/index.d.ts +9 -0
  64. package/build/common/validation/schema-validators/index.js +98 -0
  65. package/build/common/validation/schema-validators/spec.d.ts +1 -0
  66. package/build/common/validation/schema-validators/spec.js +137 -0
  67. package/build/common/validation/valid-model/index.d.ts +5 -0
  68. package/build/common/validation/valid-model/index.js +64 -0
  69. package/build/common/validation/valid-model/spec.d.ts +1 -0
  70. package/build/common/validation/valid-model/spec.js +605 -0
  71. package/build/common/validation/valid-model/utils.d.ts +11 -0
  72. package/build/common/validation/valid-model/utils.js +118 -0
  73. package/build/common/validation/validation-failures/index.d.ts +23 -0
  74. package/build/common/validation/validation-failures/index.js +140 -0
  75. package/build/common/validation/validation-failures/spec.d.ts +1 -0
  76. package/build/common/validation/validation-failures/spec.js +185 -0
  77. package/build/dynamic-flow-types/Action.d.ts +19 -0
  78. package/build/dynamic-flow-types/Action.js +1 -0
  79. package/build/dynamic-flow-types/FileUploadSchema.d.ts +23 -0
  80. package/build/dynamic-flow-types/FileUploadSchema.js +3 -0
  81. package/build/dynamic-flow-types/LayoutComponent.d.ts +129 -0
  82. package/build/dynamic-flow-types/LayoutComponent.js +1 -0
  83. package/build/dynamic-flow-types/Model.d.ts +12 -0
  84. package/build/dynamic-flow-types/Model.js +28 -0
  85. package/build/dynamic-flow-types/PersistAsync.d.ts +8 -0
  86. package/build/dynamic-flow-types/PersistAsync.js +1 -0
  87. package/build/dynamic-flow-types/Polling.d.ts +12 -0
  88. package/build/dynamic-flow-types/Polling.js +1 -0
  89. package/build/dynamic-flow-types/Promotion.d.ts +20 -0
  90. package/build/dynamic-flow-types/Promotion.js +1 -0
  91. package/build/dynamic-flow-types/Schema.d.ts +184 -0
  92. package/build/dynamic-flow-types/Schema.js +49 -0
  93. package/build/dynamic-flow-types/Step.d.ts +127 -0
  94. package/build/dynamic-flow-types/Step.js +4 -0
  95. package/build/dynamic-flow-types/ValidationAsync.d.ts +6 -0
  96. package/build/dynamic-flow-types/ValidationAsync.js +1 -0
  97. package/build/dynamic-flow-types/core.d.ts +29 -0
  98. package/build/dynamic-flow-types/core.js +1 -0
  99. package/build/dynamic-flow-types/index.d.ts +14 -0
  100. package/build/dynamic-flow-types/index.js +12 -0
  101. package/build/field/Field.d.ts +69 -0
  102. package/build/field/Field.js +311 -0
  103. package/build/field/index.d.ts +2 -0
  104. package/build/field/index.js +2 -0
  105. package/build/flow/DynamicFlow.d.ts +4 -0
  106. package/build/flow/DynamicFlow.js +368 -0
  107. package/build/flow/DynamicFlowStep.d.ts +9 -0
  108. package/build/flow/DynamicFlowStep.js +32 -0
  109. package/build/flow/errorBoundary/ErrorBoundary.d.ts +20 -0
  110. package/build/flow/errorBoundary/ErrorBoundary.js +45 -0
  111. package/build/flow/errorBoundary/ErrorBoundary.messages.d.ts +13 -0
  112. package/build/flow/errorBoundary/ErrorBoundary.messages.js +13 -0
  113. package/build/flow/errorBoundary/ErrorBoundaryAlert.d.ts +6 -0
  114. package/build/flow/errorBoundary/ErrorBoundaryAlert.js +12 -0
  115. package/build/flow/errorBoundary/index.d.ts +1 -0
  116. package/build/flow/errorBoundary/index.js +1 -0
  117. package/build/flow/fixtures/components/alert.d.ts +3 -0
  118. package/build/flow/fixtures/components/alert.js +31 -0
  119. package/build/flow/fixtures/components/box.d.ts +3 -0
  120. package/build/flow/fixtures/components/box.js +20 -0
  121. package/build/flow/fixtures/components/button.d.ts +3 -0
  122. package/build/flow/fixtures/components/button.js +65 -0
  123. package/build/flow/fixtures/components/columns.d.ts +3 -0
  124. package/build/flow/fixtures/components/columns.js +36 -0
  125. package/build/flow/fixtures/components/copyable.d.ts +3 -0
  126. package/build/flow/fixtures/components/copyable.js +22 -0
  127. package/build/flow/fixtures/components/decision.d.ts +3 -0
  128. package/build/flow/fixtures/components/decision.js +54 -0
  129. package/build/flow/fixtures/components/heading.d.ts +3 -0
  130. package/build/flow/fixtures/components/heading.js +14 -0
  131. package/build/flow/fixtures/components/image.d.ts +3 -0
  132. package/build/flow/fixtures/components/image.js +22 -0
  133. package/build/flow/fixtures/components/info.d.ts +3 -0
  134. package/build/flow/fixtures/components/info.js +17 -0
  135. package/build/flow/fixtures/components/list.d.ts +3 -0
  136. package/build/flow/fixtures/components/list.js +34 -0
  137. package/build/flow/fixtures/components/loading-indicator.d.ts +3 -0
  138. package/build/flow/fixtures/components/loading-indicator.js +16 -0
  139. package/build/flow/fixtures/components/paragraph.d.ts +3 -0
  140. package/build/flow/fixtures/components/paragraph.js +28 -0
  141. package/build/flow/fixtures/components/review.d.ts +3 -0
  142. package/build/flow/fixtures/components/review.js +60 -0
  143. package/build/flow/fixtures/examples/camera-capture.d.ts +3 -0
  144. package/build/flow/fixtures/examples/camera-capture.js +121 -0
  145. package/build/flow/fixtures/examples/recipient-update.d.ts +3 -0
  146. package/build/flow/fixtures/examples/recipient-update.js +250 -0
  147. package/build/flow/fixtures/examples/recipient.d.ts +3 -0
  148. package/build/flow/fixtures/examples/recipient.js +313 -0
  149. package/build/flow/fixtures/examples/single-file-upload.d.ts +3 -0
  150. package/build/flow/fixtures/examples/single-file-upload.js +96 -0
  151. package/build/flow/fixtures/examples/step-validation-errors.d.ts +3 -0
  152. package/build/flow/fixtures/examples/step-validation-errors.js +75 -0
  153. package/build/flow/fixtures/features/action-response.d.ts +3 -0
  154. package/build/flow/fixtures/features/action-response.js +29 -0
  155. package/build/flow/fixtures/features/external.d.ts +3 -0
  156. package/build/flow/fixtures/features/external.js +31 -0
  157. package/build/flow/fixtures/features/persist-async.d.ts +3 -0
  158. package/build/flow/fixtures/features/persist-async.js +44 -0
  159. package/build/flow/fixtures/features/polling.d.ts +3 -0
  160. package/build/flow/fixtures/features/polling.js +33 -0
  161. package/build/flow/fixtures/index.d.ts +42 -0
  162. package/build/flow/fixtures/index.js +66 -0
  163. package/build/flow/fixtures/responses/action-response-final.d.ts +3 -0
  164. package/build/flow/fixtures/responses/action-response-final.js +24 -0
  165. package/build/flow/fixtures/responses/action.d.ts +5 -0
  166. package/build/flow/fixtures/responses/action.js +2 -0
  167. package/build/flow/fixtures/responses/exit.d.ts +6 -0
  168. package/build/flow/fixtures/responses/exit.js +2 -0
  169. package/build/flow/fixtures/responses/recipient-update-final.d.ts +3 -0
  170. package/build/flow/fixtures/responses/recipient-update-final.js +24 -0
  171. package/build/flow/fixtures/schemas/basic-form.d.ts +3 -0
  172. package/build/flow/fixtures/schemas/basic-form.js +39 -0
  173. package/build/flow/fixtures/schemas/number-and-integer.d.ts +3 -0
  174. package/build/flow/fixtures/schemas/number-and-integer.js +41 -0
  175. package/build/flow/fixtures/schemas/one-of.d.ts +3 -0
  176. package/build/flow/fixtures/schemas/one-of.js +223 -0
  177. package/build/flow/fixtures/schemas/string-formats.d.ts +3 -0
  178. package/build/flow/fixtures/schemas/string-formats.js +58 -0
  179. package/build/flow/index.d.ts +1 -0
  180. package/build/flow/index.js +1 -0
  181. package/build/flow/response-parsers/index.d.ts +17 -0
  182. package/build/flow/response-parsers/index.js +112 -0
  183. package/build/flow/response-parsers/spec.d.ts +1 -0
  184. package/build/flow/response-parsers/spec.js +263 -0
  185. package/build/flow/stories/EditableDynamicFlow.d.ts +5 -0
  186. package/build/flow/stories/EditableDynamicFlow.js +61 -0
  187. package/build/flow/types.d.ts +77 -0
  188. package/build/flow/types.js +3 -0
  189. package/build/flow/useDebouncedRefresh/index.d.ts +1 -0
  190. package/build/flow/useDebouncedRefresh/index.js +1 -0
  191. package/build/flow/useDebouncedRefresh/useDebouncedRefresh.d.ts +5 -0
  192. package/build/flow/useDebouncedRefresh/useDebouncedRefresh.js +24 -0
  193. package/build/flow/useDynamicFlowState.d.ts +18 -0
  194. package/build/flow/useDynamicFlowState.js +111 -0
  195. package/build/flow/useLoader.d.ts +9 -0
  196. package/build/flow/useLoader.js +22 -0
  197. package/build/formControl/FormControl.d.ts +86 -0
  198. package/build/formControl/FormControl.js +241 -0
  199. package/build/formControl/index.d.ts +1 -0
  200. package/build/formControl/index.js +1 -0
  201. package/build/formControl/types.d.ts +57 -0
  202. package/build/formControl/types.js +1 -0
  203. package/build/formControl/value-utils.d.ts +9 -0
  204. package/build/formControl/value-utils.js +108 -0
  205. package/build/i18n/cs.json +8 -0
  206. package/build/i18n/de.json +34 -0
  207. package/build/i18n/en.json +38 -0
  208. package/build/i18n/es.json +34 -0
  209. package/build/i18n/fr.json +34 -0
  210. package/build/i18n/hu.json +34 -0
  211. package/build/i18n/id.json +34 -0
  212. package/build/i18n/index.d.ts +2 -0
  213. package/build/i18n/index.js +31 -0
  214. package/build/i18n/it.json +34 -0
  215. package/build/i18n/ja.json +34 -0
  216. package/build/i18n/pl.json +11 -0
  217. package/build/i18n/pt.json +34 -0
  218. package/build/i18n/ro.json +34 -0
  219. package/build/i18n/ru.json +34 -0
  220. package/build/i18n/th.json +34 -0
  221. package/build/i18n/tr.json +11 -0
  222. package/build/i18n/uk.json +8 -0
  223. package/build/i18n/zh-CN.json +34 -0
  224. package/build/i18n/zh.json +34 -0
  225. package/build/index.d.ts +12 -0
  226. package/build/index.js +11 -0
  227. package/build/jsonSchemaForm/JsonSchemaForm.d.ts +66 -0
  228. package/build/jsonSchemaForm/JsonSchemaForm.js +31 -0
  229. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +14 -0
  230. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +54 -0
  231. package/build/jsonSchemaForm/allOfSchema/index.d.ts +2 -0
  232. package/build/jsonSchemaForm/allOfSchema/index.js +1 -0
  233. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +15 -0
  234. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +25 -0
  235. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +16 -0
  236. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +26 -0
  237. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.d.ts +1 -0
  238. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +1 -0
  239. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +18 -0
  240. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +141 -0
  241. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +24 -0
  242. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +18 -0
  243. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +1 -0
  244. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +1 -0
  245. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.d.ts +9 -0
  246. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/useFormattedDefaultErrorMessages.js +14 -0
  247. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.d.ts +6 -0
  248. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils.js +85 -0
  249. package/build/jsonSchemaForm/arrayTypeSchema/index.d.ts +2 -0
  250. package/build/jsonSchemaForm/arrayTypeSchema/index.js +1 -0
  251. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +22 -0
  252. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +105 -0
  253. package/build/jsonSchemaForm/basicTypeSchema/index.d.ts +2 -0
  254. package/build/jsonSchemaForm/basicTypeSchema/index.js +1 -0
  255. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +31 -0
  256. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +79 -0
  257. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.d.ts +53 -0
  258. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +53 -0
  259. package/build/jsonSchemaForm/controlFeedback/index.d.ts +1 -0
  260. package/build/jsonSchemaForm/controlFeedback/index.js +1 -0
  261. package/build/jsonSchemaForm/genericSchema/GenericSchema.d.ts +19 -0
  262. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +122 -0
  263. package/build/jsonSchemaForm/genericSchema/index.d.ts +1 -0
  264. package/build/jsonSchemaForm/genericSchema/index.js +1 -0
  265. package/build/jsonSchemaForm/help/Help.d.ts +8 -0
  266. package/build/jsonSchemaForm/help/Help.js +9 -0
  267. package/build/jsonSchemaForm/help/Help.messages.d.ts +8 -0
  268. package/build/jsonSchemaForm/help/Help.messages.js +8 -0
  269. package/build/jsonSchemaForm/help/index.d.ts +1 -0
  270. package/build/jsonSchemaForm/help/index.js +1 -0
  271. package/build/jsonSchemaForm/index.d.ts +1 -0
  272. package/build/jsonSchemaForm/index.js +1 -0
  273. package/build/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +16 -0
  274. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +78 -0
  275. package/build/jsonSchemaForm/objectSchema/index.d.ts +2 -0
  276. package/build/jsonSchemaForm/objectSchema/index.js +1 -0
  277. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +15 -0
  278. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +153 -0
  279. package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.d.ts +3 -0
  280. package/build/jsonSchemaForm/oneOfSchema/getActiveSchemaIndex.js +40 -0
  281. package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.d.ts +2 -0
  282. package/build/jsonSchemaForm/oneOfSchema/getBestMatchingSchemaIndexForValue.js +27 -0
  283. package/build/jsonSchemaForm/oneOfSchema/index.d.ts +2 -0
  284. package/build/jsonSchemaForm/oneOfSchema/index.js +1 -0
  285. package/build/jsonSchemaForm/oneOfSchema/isConstSchema.d.ts +3 -0
  286. package/build/jsonSchemaForm/oneOfSchema/isConstSchema.js +7 -0
  287. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +16 -0
  288. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +26 -0
  289. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +8 -0
  290. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +8 -0
  291. package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.d.ts +21 -0
  292. package/build/jsonSchemaForm/persistAsyncSchema/basic/PersistAsyncBasicSchema.js +168 -0
  293. package/build/jsonSchemaForm/persistAsyncSchema/basic/index.d.ts +1 -0
  294. package/build/jsonSchemaForm/persistAsyncSchema/basic/index.js +1 -0
  295. package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.d.ts +20 -0
  296. package/build/jsonSchemaForm/persistAsyncSchema/blob/PersistAsyncBlobSchema.js +127 -0
  297. package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.d.ts +17 -0
  298. package/build/jsonSchemaForm/persistAsyncSchema/blob/UploadInputAdapter.js +32 -0
  299. package/build/jsonSchemaForm/persistAsyncSchema/blob/index.d.ts +1 -0
  300. package/build/jsonSchemaForm/persistAsyncSchema/blob/index.js +1 -0
  301. package/build/jsonSchemaForm/persistAsyncSchema/index.d.ts +2 -0
  302. package/build/jsonSchemaForm/persistAsyncSchema/index.js +1 -0
  303. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.d.ts +9 -0
  304. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +72 -0
  305. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.d.ts +2 -0
  306. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchemaModelMatcher.js +8 -0
  307. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.d.ts +7 -0
  308. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfCheckboxControl.js +27 -0
  309. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.d.ts +23 -0
  310. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfControl.js +31 -0
  311. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.d.ts +9 -0
  312. package/build/jsonSchemaForm/promotedOneOfSchema/control/PromotedOneOfRadioControl.js +32 -0
  313. package/build/jsonSchemaForm/promotedOneOfSchema/index.d.ts +2 -0
  314. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +1 -0
  315. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.d.ts +8 -0
  316. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +55 -0
  317. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.d.ts +16 -0
  318. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +13 -0
  319. package/build/jsonSchemaForm/readOnlySchema/index.d.ts +1 -0
  320. package/build/jsonSchemaForm/readOnlySchema/index.js +1 -0
  321. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +25 -0
  322. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +106 -0
  323. package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.d.ts +3 -0
  324. package/build/jsonSchemaForm/schemaFormControl/availableCurrencyFlags.js +73 -0
  325. package/build/jsonSchemaForm/schemaFormControl/index.d.ts +1 -0
  326. package/build/jsonSchemaForm/schemaFormControl/index.js +1 -0
  327. package/build/jsonSchemaForm/schemaFormControl/optionMapper.d.ts +40 -0
  328. package/build/jsonSchemaForm/schemaFormControl/optionMapper.js +89 -0
  329. package/build/jsonSchemaForm/schemas/allOf.json.d.ts +3 -0
  330. package/build/jsonSchemaForm/schemas/allOf.json.js +119 -0
  331. package/build/jsonSchemaForm/schemas/audRecipient.json.d.ts +3 -0
  332. package/build/jsonSchemaForm/schemas/audRecipient.json.js +1104 -0
  333. package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.d.ts +3 -0
  334. package/build/jsonSchemaForm/schemas/base64Url_MultipleFileUpload.json.js +37 -0
  335. package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.d.ts +3 -0
  336. package/build/jsonSchemaForm/schemas/blob_MultipleFileUpload.json.js +36 -0
  337. package/build/jsonSchemaForm/schemas/currency.json.d.ts +3 -0
  338. package/build/jsonSchemaForm/schemas/currency.json.js +48 -0
  339. package/build/jsonSchemaForm/schemas/oneOf.json.d.ts +3 -0
  340. package/build/jsonSchemaForm/schemas/oneOf.json.js +119 -0
  341. package/build/jsonSchemaForm/schemas/oneOfTabs.json.d.ts +3 -0
  342. package/build/jsonSchemaForm/schemas/oneOfTabs.json.js +53 -0
  343. package/build/jsonSchemaForm/schemas/promotedOneOf.json.d.ts +3 -0
  344. package/build/jsonSchemaForm/schemas/promotedOneOf.json.js +56 -0
  345. package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.d.ts +3 -0
  346. package/build/jsonSchemaForm/schemas/promotedOneOfCheckbox.json.js +102 -0
  347. package/build/jsonSchemaForm/schemas/simple.json.d.ts +3 -0
  348. package/build/jsonSchemaForm/schemas/simple.json.js +48 -0
  349. package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.d.ts +3 -0
  350. package/build/jsonSchemaForm/schemas/uploadPersistAsync.json.js +71 -0
  351. package/build/jsonSchemaForm/schemas/validationAsync.json.d.ts +3 -0
  352. package/build/jsonSchemaForm/schemas/validationAsync.json.js +23 -0
  353. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +17 -0
  354. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +149 -0
  355. package/build/jsonSchemaForm/validationAsyncSchema/index.d.ts +2 -0
  356. package/build/jsonSchemaForm/validationAsyncSchema/index.js +1 -0
  357. package/build/layout/DynamicLayout.d.ts +17 -0
  358. package/build/layout/DynamicLayout.js +75 -0
  359. package/build/layout/alert/index.d.ts +6 -0
  360. package/build/layout/alert/index.js +29 -0
  361. package/build/layout/box/index.d.ts +8 -0
  362. package/build/layout/box/index.js +41 -0
  363. package/build/layout/button/index.d.ts +8 -0
  364. package/build/layout/button/index.js +58 -0
  365. package/build/layout/columns/index.d.ts +8 -0
  366. package/build/layout/columns/index.js +38 -0
  367. package/build/layout/decision/index.d.ts +9 -0
  368. package/build/layout/decision/index.js +38 -0
  369. package/build/layout/divider/index.d.ts +7 -0
  370. package/build/layout/divider/index.js +9 -0
  371. package/build/layout/external/DynamicExternal.d.ts +8 -0
  372. package/build/layout/external/DynamicExternal.js +30 -0
  373. package/build/layout/external/DynamicExternal.messages.d.ts +8 -0
  374. package/build/layout/external/DynamicExternal.messages.js +8 -0
  375. package/build/layout/external/index.d.ts +1 -0
  376. package/build/layout/external/index.js +1 -0
  377. package/build/layout/external/useExternalStepPolling.d.ts +11 -0
  378. package/build/layout/external/useExternalStepPolling.js +68 -0
  379. package/build/layout/form/index.d.ts +8 -0
  380. package/build/layout/form/index.js +22 -0
  381. package/build/layout/heading/index.d.ts +6 -0
  382. package/build/layout/heading/index.js +31 -0
  383. package/build/layout/icon/index.d.ts +7 -0
  384. package/build/layout/icon/index.js +22 -0
  385. package/build/layout/image/index.d.ts +6 -0
  386. package/build/layout/image/index.js +126 -0
  387. package/build/layout/index.d.ts +1 -0
  388. package/build/layout/index.js +1 -0
  389. package/build/layout/info/index.d.ts +7 -0
  390. package/build/layout/info/index.js +19 -0
  391. package/build/layout/layouts/all.json.d.ts +3 -0
  392. package/build/layout/layouts/all.json.js +176 -0
  393. package/build/layout/layouts/final-step-layout.json.d.ts +3 -0
  394. package/build/layout/layouts/final-step-layout.json.js +39 -0
  395. package/build/layout/layouts/finalStep.json.d.ts +3 -0
  396. package/build/layout/layouts/finalStep.json.js +24 -0
  397. package/build/layout/layouts/list.json.d.ts +3 -0
  398. package/build/layout/layouts/list.json.js +33 -0
  399. package/build/layout/layouts/pay-in.json.d.ts +3 -0
  400. package/build/layout/layouts/pay-in.json.js +97 -0
  401. package/build/layout/layouts/review.json.d.ts +3 -0
  402. package/build/layout/layouts/review.json.js +160 -0
  403. package/build/layout/layouts/success.json.d.ts +3 -0
  404. package/build/layout/layouts/success.json.js +66 -0
  405. package/build/layout/list/index.d.ts +8 -0
  406. package/build/layout/list/index.js +30 -0
  407. package/build/layout/loading-indicator/index.d.ts +7 -0
  408. package/build/layout/loading-indicator/index.js +10 -0
  409. package/build/layout/loading-indicator/spec.d.ts +1 -0
  410. package/build/layout/loading-indicator/spec.js +11 -0
  411. package/build/layout/paragraph/DynamicParagraph.d.ts +7 -0
  412. package/build/layout/paragraph/DynamicParagraph.js +42 -0
  413. package/build/layout/paragraph/DynamicParagraph.messages.d.ts +13 -0
  414. package/build/layout/paragraph/DynamicParagraph.messages.js +13 -0
  415. package/build/layout/paragraph/index.d.ts +1 -0
  416. package/build/layout/paragraph/index.js +1 -0
  417. package/build/layout/paragraph/useSnackBarIfAvailable.d.ts +10 -0
  418. package/build/layout/paragraph/useSnackBarIfAvailable.js +9 -0
  419. package/build/layout/review/index.d.ts +9 -0
  420. package/build/layout/review/index.js +33 -0
  421. package/build/layout/utils.d.ts +7 -0
  422. package/build/layout/utils.js +31 -0
  423. package/build/main.css +143 -0
  424. package/build/schema.d.ts +1 -0
  425. package/build/schema.js +1 -0
  426. package/build/step/cameraStep/CameraStep.d.ts +8 -0
  427. package/build/step/cameraStep/CameraStep.js +125 -0
  428. package/build/step/cameraStep/cameraCapture/CameraCapture.d.ts +16 -0
  429. package/build/step/cameraStep/cameraCapture/CameraCapture.js +122 -0
  430. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.d.ts +18 -0
  431. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +18 -0
  432. package/build/step/cameraStep/cameraCapture/components/index.d.ts +8 -0
  433. package/build/step/cameraStep/cameraCapture/components/index.js +28 -0
  434. package/build/step/cameraStep/cameraCapture/hooks/index.d.ts +4 -0
  435. package/build/step/cameraStep/cameraCapture/hooks/index.js +80 -0
  436. package/build/step/cameraStep/cameraCapture/index.d.ts +1 -0
  437. package/build/step/cameraStep/cameraCapture/index.js +1 -0
  438. package/build/step/cameraStep/cameraCapture/overlay/Overlay.d.ts +11 -0
  439. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +78 -0
  440. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +3 -0
  441. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +19 -0
  442. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +13 -0
  443. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +13 -0
  444. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +6 -0
  445. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +21 -0
  446. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +18 -0
  447. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +18 -0
  448. package/build/step/cameraStep/cameraCapture/screens/index.d.ts +2 -0
  449. package/build/step/cameraStep/cameraCapture/screens/index.js +2 -0
  450. package/build/step/cameraStep/cameraCapture/tracking/index.d.ts +7 -0
  451. package/build/step/cameraStep/cameraCapture/tracking/index.js +101 -0
  452. package/build/step/cameraStep/cameraCapture/utils/index.d.ts +8 -0
  453. package/build/step/cameraStep/cameraCapture/utils/index.js +103 -0
  454. package/build/step/cameraStep/index.d.ts +1 -0
  455. package/build/step/cameraStep/index.js +1 -0
  456. package/build/step/externalConfirmationStep/ExternalConfirmationStep.d.ts +7 -0
  457. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +64 -0
  458. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +23 -0
  459. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +23 -0
  460. package/build/step/externalConfirmationStep/index.d.ts +1 -0
  461. package/build/step/externalConfirmationStep/index.js +1 -0
  462. package/build/step/features/external/useExternal.d.ts +4 -0
  463. package/build/step/features/external/useExternal.js +15 -0
  464. package/build/step/features/index.d.ts +2 -0
  465. package/build/step/features/index.js +2 -0
  466. package/build/step/features/polling/useStepPolling.d.ts +2 -0
  467. package/build/step/features/polling/useStepPolling.js +44 -0
  468. package/build/step/index.d.ts +3 -0
  469. package/build/step/index.js +3 -0
  470. package/build/step/layoutStep/LayoutStep.d.ts +11 -0
  471. package/build/step/layoutStep/LayoutStep.js +34 -0
  472. package/build/step/layoutStep/index.d.ts +1 -0
  473. package/build/step/layoutStep/index.js +1 -0
  474. package/build/step/layoutStep/layoutService/convertStepToLayout.d.ts +8 -0
  475. package/build/step/layoutStep/layoutService/convertStepToLayout.js +217 -0
  476. package/build/step/layoutStep/layoutService/index.d.ts +2 -0
  477. package/build/step/layoutStep/layoutService/index.js +2 -0
  478. package/build/step/layoutStep/layoutService/inlineReferences.d.ts +7 -0
  479. package/build/step/layoutStep/layoutService/inlineReferences.js +91 -0
  480. package/package.json +1 -1
@@ -0,0 +1,263 @@
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 { parseErrorResponse, parseExitResponse, parseFetchResponse } from '.';
38
+ describe('parseFetchResponse', function () {
39
+ describe('when response contains the X-DF-Exit header', function () {
40
+ var headers = { 'X-Df-Exit': 'true' };
41
+ describe('and response body can be json-parsed as an object', function () {
42
+ it('should return exit result', function () { return __awaiter(void 0, void 0, void 0, function () {
43
+ var response, parsedBody;
44
+ return __generator(this, function (_a) {
45
+ switch (_a.label) {
46
+ case 0:
47
+ response = new Response("{ \"exitResult\": \"exit result\" }", { headers: headers });
48
+ return [4 /*yield*/, parseFetchResponse(response)];
49
+ case 1:
50
+ parsedBody = _a.sent();
51
+ expect(parsedBody).toStrictEqual({
52
+ type: 'exit',
53
+ result: { exitResult: 'exit result' }
54
+ });
55
+ return [2 /*return*/];
56
+ }
57
+ });
58
+ }); });
59
+ });
60
+ describe('but response body cannot be json-parsed as an object', function () {
61
+ getNonObjectBodyCases().forEach(function (_a) {
62
+ var description = _a[0], body = _a[1];
63
+ describe("when the body is ".concat(description), function () {
64
+ it("returns exit result with null", function () { return __awaiter(void 0, void 0, void 0, function () {
65
+ var parsedBody;
66
+ return __generator(this, function (_a) {
67
+ switch (_a.label) {
68
+ case 0: return [4 /*yield*/, parseFetchResponse(new Response(body, { headers: headers }))];
69
+ case 1:
70
+ parsedBody = _a.sent();
71
+ expect(parsedBody).toStrictEqual({ type: 'exit', result: null });
72
+ return [2 /*return*/];
73
+ }
74
+ });
75
+ }); });
76
+ });
77
+ });
78
+ });
79
+ });
80
+ describe('when response does not contain the X-DF-Exit header', function () {
81
+ var headers = { etag: 'etag' };
82
+ describe('and response body can be json-parsed as an object', function () {
83
+ describe('and it contains an action property', function () {
84
+ describe('and the action property is an object', function () {
85
+ it('assumes the action property is of type Action, and returns type action and the action', function () { return __awaiter(void 0, void 0, void 0, function () {
86
+ var parsedBody;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0: return [4 /*yield*/, parseFetchResponse(new Response('{ "action": { "url": "/path", "method": "POST" } }'))];
90
+ case 1:
91
+ parsedBody = _a.sent();
92
+ expect(parsedBody).toStrictEqual({
93
+ type: 'action',
94
+ action: { url: '/path', method: 'POST' }
95
+ });
96
+ return [2 /*return*/];
97
+ }
98
+ });
99
+ }); });
100
+ it('assumes the action property is of type Action, even if its NOT', function () { return __awaiter(void 0, void 0, void 0, function () {
101
+ var parsedBody;
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0: return [4 /*yield*/, parseFetchResponse(new Response('{ "action": { "random": "property" } }'))];
105
+ case 1:
106
+ parsedBody = _a.sent();
107
+ expect(parsedBody).toStrictEqual({ type: 'action', action: { random: 'property' } });
108
+ return [2 /*return*/];
109
+ }
110
+ });
111
+ }); });
112
+ });
113
+ describe('and the action property is NOT an object', function () {
114
+ it('throws an error', function () { return __awaiter(void 0, void 0, void 0, function () {
115
+ return __generator(this, function (_a) {
116
+ switch (_a.label) {
117
+ case 0: return [4 /*yield*/, expect(parseFetchResponse(new Response('{ "action": 123 }'))).rejects.toThrow('Incorrect response body in action response. Expected an object satisfying the type { action: Action }.')];
118
+ case 1:
119
+ _a.sent();
120
+ return [2 /*return*/];
121
+ }
122
+ });
123
+ }); });
124
+ });
125
+ });
126
+ describe('when the body is NOT an object with an action property', function () {
127
+ it('assumes the response is a step and returns step and etag', function () { return __awaiter(void 0, void 0, void 0, function () {
128
+ var response, parsedBody;
129
+ return __generator(this, function (_a) {
130
+ switch (_a.label) {
131
+ case 0:
132
+ response = new Response("{ \"stepResult\": \"step result\" }", { headers: headers });
133
+ return [4 /*yield*/, parseFetchResponse(response)];
134
+ case 1:
135
+ parsedBody = _a.sent();
136
+ expect(parsedBody).toStrictEqual({
137
+ type: 'step',
138
+ step: { stepResult: 'step result' },
139
+ etag: 'etag'
140
+ });
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ }); });
145
+ });
146
+ });
147
+ describe('but response body cannot be json-parsed as an object', function () {
148
+ getNonObjectBodyCases().forEach(function (_a) {
149
+ var description = _a[0], body = _a[1];
150
+ describe("when the body is ".concat(description), function () {
151
+ it("throws an error", function () { return __awaiter(void 0, void 0, void 0, function () {
152
+ return __generator(this, function (_a) {
153
+ switch (_a.label) {
154
+ case 0: return [4 /*yield*/, expect(parseFetchResponse(new Response(body))).rejects.toThrow('Incorrect response body in response. Expected an object.')];
155
+ case 1:
156
+ _a.sent();
157
+ return [2 /*return*/];
158
+ }
159
+ });
160
+ }); });
161
+ });
162
+ });
163
+ });
164
+ });
165
+ });
166
+ describe('parseErrorResponse', function () {
167
+ describe('when response body can be json-parsed as an object', function () {
168
+ it('returns the response body', function () { return __awaiter(void 0, void 0, void 0, function () {
169
+ var response, parsedBody;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0:
173
+ response = new Response(JSON.stringify({
174
+ error: 'This is a global error',
175
+ validation: { field: 'This is a field error' }
176
+ }), { status: 422 });
177
+ return [4 /*yield*/, parseErrorResponse(response)];
178
+ case 1:
179
+ parsedBody = _a.sent();
180
+ expect(parsedBody).toStrictEqual({
181
+ error: 'This is a global error',
182
+ validation: { field: 'This is a field error' }
183
+ });
184
+ return [2 /*return*/];
185
+ }
186
+ });
187
+ }); });
188
+ });
189
+ describe('when response body CANNOT be json-parsed as an object', function () {
190
+ getNonObjectBodyCases().forEach(function (_a) {
191
+ var description = _a[0], body = _a[1];
192
+ describe("when the body is ".concat(description), function () {
193
+ it("throws an error", function () { return __awaiter(void 0, void 0, void 0, function () {
194
+ return __generator(this, function (_a) {
195
+ switch (_a.label) {
196
+ case 0: return [4 /*yield*/, expect(parseErrorResponse(new Response(body))).rejects.toThrow('Incorrect response body in error response. Expected an object.')];
197
+ case 1:
198
+ _a.sent();
199
+ return [2 /*return*/];
200
+ }
201
+ });
202
+ }); });
203
+ });
204
+ });
205
+ });
206
+ });
207
+ describe('parseExitResponse', function () {
208
+ describe('when response body can be json-parsed as an object', function () {
209
+ it('returns the parsed response body', function () { return __awaiter(void 0, void 0, void 0, function () {
210
+ var response;
211
+ return __generator(this, function (_a) {
212
+ switch (_a.label) {
213
+ case 0:
214
+ response = new Response("{ \"exitResult\": \"exit result\" }");
215
+ return [4 /*yield*/, expect(parseExitResponse(response)).resolves.toStrictEqual({
216
+ exitResult: 'exit result'
217
+ })];
218
+ case 1:
219
+ _a.sent();
220
+ return [2 /*return*/];
221
+ }
222
+ });
223
+ }); });
224
+ });
225
+ describe('when response body CANNOT be json-parsed as an object', function () {
226
+ getNonObjectBodyCases().forEach(function (_a) {
227
+ var description = _a[0], body = _a[1];
228
+ describe("when the body is ".concat(description), function () {
229
+ it("returns null", function () { return __awaiter(void 0, void 0, void 0, function () {
230
+ var parsedBody;
231
+ return __generator(this, function (_a) {
232
+ switch (_a.label) {
233
+ case 0: return [4 /*yield*/, parseExitResponse(new Response(body))];
234
+ case 1:
235
+ parsedBody = _a.sent();
236
+ expect(parsedBody).toBeNull();
237
+ return [2 /*return*/];
238
+ }
239
+ });
240
+ }); });
241
+ });
242
+ });
243
+ });
244
+ });
245
+ function getNonObjectBodyCases() {
246
+ return [
247
+ ['parseable as number', '1234'],
248
+ ['parseable as a string', '"json string"'],
249
+ ['parseable as an empty string', '""'],
250
+ ['parseable as an array', '[]'],
251
+ ['parseable as true', 'true'],
252
+ ['parseable as false', 'false'],
253
+ ['parseable as null', 'null'],
254
+ ['an empty string', ''],
255
+ ['non-json parseable string', 'non-json string'],
256
+ ['a number', 1234],
257
+ ['NaN', NaN],
258
+ ['undefined', undefined],
259
+ ['a Blob instance', new Blob()],
260
+ ['a FormData instance', new FormData()],
261
+ ['a URLSearchParams instance', new URLSearchParams('foo=bar')],
262
+ ];
263
+ }
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const EditableDynamicFlow: ({ initialStepName }: {
3
+ initialStepName?: string | undefined;
4
+ }) => JSX.Element;
5
+ export default EditableDynamicFlow;
@@ -0,0 +1,61 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ /* eslint-disable react/forbid-dom-props */
14
+ import { action } from '@storybook/addon-actions';
15
+ import { useState } from 'react';
16
+ import DynamicFlow from '../DynamicFlow';
17
+ import { fixtures } from '../fixtures';
18
+ var EditableDynamicFlow = function (_a) {
19
+ var _b = _a.initialStepName, initialStepName = _b === void 0 ? '' : _b;
20
+ var selectedStep = fixtures.steps[initialStepName] || {};
21
+ var selectedInitialStep = JSON.stringify(selectedStep, null, 2);
22
+ return _jsx(InteractiveDemo, { selectedInitialStep: selectedInitialStep }, selectedInitialStep);
23
+ };
24
+ var InteractiveDemo = function (_a) {
25
+ var selectedInitialStep = _a.selectedInitialStep;
26
+ var _b = useState(selectedInitialStep), initialStep = _b[0], setInitialStep = _b[1];
27
+ var onTextAreaChange = function (event) {
28
+ setInitialStep(event.target.value);
29
+ };
30
+ return (_jsxs("div", __assign({ style: { display: 'flex', gap: '1em' } }, { children: [_jsxs("div", __assign({ style: { flexBasis: '50%' } }, { children: [_jsx("h3", { children: "Editable Demo" }), _jsxs("p", { children: ["You can select an initial step from the drop down in the controls panel.", _jsx("br", {}), "You can edit the JSON below and see the result on the right."] }), _jsx("textarea", { wrap: "off", rows: 40, style: { fontFamily: 'monospace', fontSize: '0.9em', width: '100%' }, value: initialStep, onChange: onTextAreaChange })] })), _jsx("div", __assign({ style: { flexBasis: '50%' } }, { children: _jsx(DynamicFlow, { initialStep: safeParseStepJson(initialStep), fetcher: function () { return Promise.resolve(new Response(initialStep)); }, onClose: action('onClose'), onStepChange: action('onStepChange'), onError: action('onError'), onTrackableEvent: action('onTrackableEvent'), onLog: action('onLog') }, initialStep) }))] })));
31
+ };
32
+ function safeParseStepJson(jsonStep) {
33
+ try {
34
+ return JSON.parse(jsonStep);
35
+ }
36
+ catch (_a) {
37
+ // eslint-disable-next-line no-console
38
+ console.warn('JSON parsing error');
39
+ return {
40
+ type: 'final',
41
+ layout: [
42
+ {
43
+ type: 'box',
44
+ width: 'lg',
45
+ components: [
46
+ {
47
+ type: 'alert',
48
+ markdown: "**Error parsing JSON.**",
49
+ context: 'warning'
50
+ },
51
+ {
52
+ type: 'paragraph',
53
+ text: " Invalid syntax or missing elements are preventing the JSON code you entered from being parsed. Carefully review and edit the code for errors such as missing commas or brackets."
54
+ },
55
+ ]
56
+ },
57
+ ]
58
+ };
59
+ }
60
+ }
61
+ export default EditableDynamicFlow;
@@ -0,0 +1,77 @@
1
+ import { LogEventHandler } from '../common/logging';
2
+ import { TrackableEventHandler } from '../common/tracking';
3
+ import { Action, FormLayout, Schema, Size, Step } from '../dynamic-flow-types';
4
+ import { OnChangeProps } from '../jsonSchemaForm/JsonSchemaForm';
5
+ export type DynamicFlowPropsBasic = {
6
+ id?: string;
7
+ loaderConfig?: LoaderConfig;
8
+ displayStepTitle?: boolean;
9
+ onClose: (result: Record<string, unknown> | undefined | null) => void;
10
+ onStepChange?: (newStep: Step, previousStep: Step | undefined) => void;
11
+ onError: (error: unknown, status?: number) => void;
12
+ onTrackableEvent?: TrackableEventHandler;
13
+ onLog?: LogEventHandler;
14
+ };
15
+ type DynamicFlowPropsWithBaseUrl = {
16
+ baseUrl: string;
17
+ fetcher?: never;
18
+ };
19
+ type DynamicFlowPropsWithFetcher = {
20
+ baseUrl?: never;
21
+ fetcher: Fetcher;
22
+ };
23
+ type DynamicFlowPropsWithInitialAction = {
24
+ initialAction: InitialAction;
25
+ initialStep?: never;
26
+ flowUrl?: never;
27
+ };
28
+ type DynamicFlowPropsWithInitialStep = {
29
+ initialAction?: never;
30
+ initialStep: Step;
31
+ flowUrl?: never;
32
+ };
33
+ type DynamicFlowPropsWithFlowUrl = {
34
+ initialAction?: never;
35
+ initialStep?: never;
36
+ /** @deprecated Use initialAction instead */
37
+ flowUrl: string;
38
+ };
39
+ export type DynamicFlowProps = DynamicFlowPropsBasic & (DynamicFlowPropsWithBaseUrl | DynamicFlowPropsWithFetcher) & (DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep | DynamicFlowPropsWithFlowUrl);
40
+ /** @deprecated Use DynamicFlowProps instead */
41
+ export type DynamicFlowV3Props = DynamicFlowProps;
42
+ /** @deprecated Use DynamicFlowPropsWithBaseUrl instead */
43
+ export type DynamicFlowV3PropsWithBaseUrl = DynamicFlowPropsWithBaseUrl;
44
+ /** @deprecated Use DynamicFlowPropsWithFetcher instead */
45
+ export type DynamicFlowV3PropsWithFetcher = DynamicFlowPropsWithFetcher;
46
+ /** @deprecated Use DynamicFlowPropsWithInitialAction instead */
47
+ export type DynamicFlowV3PropsWithFlowUrl = DynamicFlowPropsWithInitialAction;
48
+ /** @deprecated Use DynamicFlowPropsWithInitialStep instead */
49
+ export type DynamicFlowV3PropsWithInitialStep = DynamicFlowPropsWithInitialStep;
50
+ /** @deprecated Use DynamicFlowPropsBasic instead */
51
+ export type DynamicFlowV3PropsBasic = DynamicFlowPropsBasic;
52
+ export declare function isSchema(schema: FormLayout['schema']): schema is Schema;
53
+ export type Fetcher = typeof fetch;
54
+ export type ETag = string;
55
+ export type LoaderConfig = {
56
+ size?: Size;
57
+ initial?: boolean;
58
+ submission?: boolean;
59
+ };
60
+ export type OnModelChangeProps = OnChangeProps & {
61
+ formSchema: Schema;
62
+ };
63
+ export type OnModelChange = (props: OnModelChangeProps) => void;
64
+ export type OnAction = (action: Action) => void;
65
+ export type OnPersistAsync = (promise: Promise<unknown>) => void;
66
+ export type InitialAction = {
67
+ $id?: string;
68
+ url: string;
69
+ method?: 'GET';
70
+ data?: never;
71
+ } | {
72
+ $id?: string;
73
+ url: string;
74
+ method: 'POST';
75
+ data: Record<string, unknown>;
76
+ };
77
+ export {};
@@ -0,0 +1,3 @@
1
+ export function isSchema(schema) {
2
+ return Object.prototype.hasOwnProperty.call(schema, '$ref') === false;
3
+ }
@@ -0,0 +1 @@
1
+ export { useDebouncedRefresh } from './useDebouncedRefresh';
@@ -0,0 +1 @@
1
+ export { useDebouncedRefresh } from './useDebouncedRefresh';
@@ -0,0 +1,5 @@
1
+ import { Action, Schema } from '../../dynamic-flow-types';
2
+ import { ETag } from '../types';
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,24 @@
1
+ import debounce from 'lodash.debounce';
2
+ import { useRef } from 'react';
3
+ import { shouldDebounceSchema } from '../../common/schemaTypes/shouldDebounceSchema';
4
+ var DEBOUNCE_DELAY = 1000; // milliseconds
5
+ export function useDebouncedRefresh(fetchRefresh) {
6
+ var map = useRef(new Map());
7
+ var retrieveOrCreate = function (key) {
8
+ if (map.current.has(key)) {
9
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
10
+ return map.current.get(key);
11
+ }
12
+ var debouncedFetchRefresh = debounce(function (action, data, etag) { return fetchRefresh(action, data, etag); }, DEBOUNCE_DELAY);
13
+ map.current.set(key, debouncedFetchRefresh);
14
+ return debouncedFetchRefresh;
15
+ };
16
+ return function (action, data, etag, schema) {
17
+ var key = action.url || '';
18
+ var debouncedFetchRefresh = retrieveOrCreate(key);
19
+ void debouncedFetchRefresh(action, data, etag);
20
+ if (!schema || !shouldDebounceSchema(schema)) {
21
+ void debouncedFetchRefresh.flush();
22
+ }
23
+ };
24
+ }
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { FormErrors, GlobalError, ObjectModel, Step } from '../dynamic-flow-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,111 @@
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 } from '../common/validation/schema-validators';
23
+ import { getValidObjectModelParts } from '../common/validation/valid-model';
24
+ import { isSchema } from '../schema';
25
+ export var useDynamicFlowState = function (initialStep) {
26
+ var _a, _b;
27
+ 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];
28
+ 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];
29
+ var _e = useState({
30
+ step: initialStep || undefined,
31
+ models: (initialStep === null || initialStep === void 0 ? void 0 : initialStep.model)
32
+ ? buildInitialModels(initialStep.model, getAllSchemas(initialStep))
33
+ : {},
34
+ etag: undefined
35
+ }), stepAndModels = _e[0], setStepAndModels = _e[1];
36
+ var step = stepAndModels.step, models = stepAndModels.models, etag = stepAndModels.etag;
37
+ var setStepAndEtag = function (step, etag) {
38
+ var _a, _b, _c, _d;
39
+ setStepAndModels(function (previous) { return ({
40
+ step: step,
41
+ models: step.model ? buildInitialModels(step.model, getAllSchemas(step)) : previous.models,
42
+ etag: etag
43
+ }); });
44
+ 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);
45
+ 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);
46
+ };
47
+ var setSchemaModel = function (schemaId, objectModel, onModelsUpdated) {
48
+ setStepAndModels(function (previous) {
49
+ var _a;
50
+ var updatedModels = __assign(__assign({}, previous.models), (_a = {}, _a[schemaId] = objectModel, _a));
51
+ var updatedState = {
52
+ step: previous.step,
53
+ models: updatedModels,
54
+ etag: previous.etag
55
+ };
56
+ onModelsUpdated(updatedModels);
57
+ return updatedState;
58
+ });
59
+ };
60
+ var modelIsValid = useMemo(function () { return areModelsValid(models, getAllSchemas(step)); }, [models, step]);
61
+ return {
62
+ formErrors: formErrors,
63
+ globalError: globalError,
64
+ step: step,
65
+ models: models,
66
+ etag: etag,
67
+ modelIsValid: modelIsValid,
68
+ setFormErrors: setFormErrors,
69
+ setGlobalError: setGlobalError,
70
+ setStepAndEtag: setStepAndEtag,
71
+ setSchemaModel: setSchemaModel
72
+ };
73
+ };
74
+ var buildInitialModels = function (model, schemas) {
75
+ if (schemas === void 0) { schemas = []; }
76
+ return schemas.reduce(function (acc, schema) {
77
+ var _a;
78
+ if (!schema.$id) {
79
+ // TODO: MC-3224
80
+ // eslint-disable-next-line no-console
81
+ console.warn('Schema without $id property found.');
82
+ }
83
+ return __assign(__assign({}, acc), (_a = {}, _a[schema.$id || ''] = getValidObjectModelParts(model, schema) || {}, _a));
84
+ }, {});
85
+ };
86
+ 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); };
87
+ var getAllSchemasInLayout = function (components) {
88
+ return components.flatMap(function (component) {
89
+ switch (component.type) {
90
+ case 'columns':
91
+ return __spreadArray([], getAllSchemasInLayout(__spreadArray(__spreadArray([], component.left, true), component.right, true)), true);
92
+ case 'box':
93
+ return getAllSchemasInLayout(component.components);
94
+ case 'form':
95
+ return isSchema(component.schema) ? [component.schema] : [];
96
+ default:
97
+ return [];
98
+ }
99
+ });
100
+ };
101
+ var areModelsValid = function (formModels, schemas) {
102
+ if (schemas === void 0) { schemas = []; }
103
+ return !(schemas === null || schemas === void 0 ? void 0 : schemas.some(function (schema) {
104
+ if (!schema.$id) {
105
+ // TODO: MC-3224
106
+ // eslint-disable-next-line no-console
107
+ console.warn('Schema without $id property found.');
108
+ }
109
+ return !isValidSchema(formModels[schema.$id || ''] || {}, schema);
110
+ }));
111
+ };
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { DynamicFlowProps } from './types';
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
+ }