@wise/dynamic-flow-client 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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,118 @@
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 { isArray, isBoolean, isEmpty, isNull, isNumber, isString, isUndefined, } from '@transferwise/neptune-validation';
13
+ import { isListArraySchema, isObjectModel, isArraySchema, } from '../../../dynamic-flow-types';
14
+ import { getValidBasicModelOrNull, getValidModelParts, getValidObjectModelParts } from '.';
15
+ export function cleanBasicModelWithOneOfSchema(model, schema) {
16
+ return schema.oneOf.some(function (nestedSchema) { return getValidBasicModelOrNull(model, nestedSchema) === model; })
17
+ ? model
18
+ : null;
19
+ }
20
+ export function cleanArrayModelWithOneOfSchema(model, schema) {
21
+ var _a;
22
+ var validModels = filterOutNull(schema.oneOf.map(function (nestedSchema) { return getValidArrayModelOrNull(model, nestedSchema); }));
23
+ if (validModels.length === 0) {
24
+ return null;
25
+ }
26
+ return (_a = validModels.find(function (model) { return model.some(function (item) { return item !== null; }); })) !== null && _a !== void 0 ? _a : validModels[0];
27
+ }
28
+ function getValidArrayModelOrNull(model, schema) {
29
+ if (!isArraySchema(schema)) {
30
+ return null;
31
+ }
32
+ if (!isListArraySchema(schema)) {
33
+ return null; // we don't support tuples at the moment
34
+ }
35
+ return cleanModelWithArraySchema(model, schema);
36
+ }
37
+ export function cleanModelWithStringSchema(model) {
38
+ return isString(model) && !isEmpty(model) ? model : null;
39
+ }
40
+ export function cleanModelWithNumberSchema(model) {
41
+ return isNumber(model) ? model : null;
42
+ }
43
+ export function cleanModelWithBooleanSchema(model) {
44
+ return isBoolean(model) ? model : null;
45
+ }
46
+ export function cleanModelWithArraySchema(model, schema) {
47
+ if (!isArray(model)) {
48
+ return null;
49
+ }
50
+ if (!isListArraySchema(schema)) {
51
+ return null; // we don't support tuples at the moment
52
+ }
53
+ if (model.length > 0) {
54
+ var expectedType_1 = typeof model[0];
55
+ if (!model.every(function (item) { return typeof item === expectedType_1; })) {
56
+ return new Array(model.length).fill(null);
57
+ }
58
+ }
59
+ return model.map(function (childModel) { return getValidBasicModelOrNull(childModel, schema.items); });
60
+ }
61
+ export function cleanObjectModelWithObjectSchema(model, schema) {
62
+ return Object.keys(schema.properties).reduce(function (cleanedModel, property) {
63
+ var _a;
64
+ // If the property exists in the model, clean it, and add it
65
+ if (model && !isUndefined(model[property])) {
66
+ var subModel = model[property];
67
+ var subSchema = schema.properties[property];
68
+ var newValue = getValidModelParts(subModel, subSchema);
69
+ if (!isNull(newValue)) {
70
+ return __assign(__assign({}, cleanedModel), (_a = {}, _a[property] = newValue, _a));
71
+ }
72
+ }
73
+ return cleanedModel;
74
+ }, {});
75
+ }
76
+ export function cleanObjectModelWithAllOfSchema(model, schema) {
77
+ return schema.allOf.reduce(function (cleanObjectModel, nestedSchema) {
78
+ var validSubsetOfModel = getValidObjectModelParts(model, nestedSchema);
79
+ if (isObjectModel(validSubsetOfModel)) {
80
+ // Extend model with valid subset
81
+ return __assign(__assign({}, cleanObjectModel), validSubsetOfModel);
82
+ }
83
+ return cleanObjectModel;
84
+ }, {});
85
+ }
86
+ export function cleanObjectModelWithOneOfSchema(model, schema) {
87
+ return schema.oneOf
88
+ .map(function (nestedSchema) { return getValidObjectModelParts(model, nestedSchema); })
89
+ .reduce(function (combined, current) {
90
+ // If we didn't find anything valid yet, and current is good, return it
91
+ if (isNull(combined)) {
92
+ return current;
93
+ }
94
+ // If we're dealing with two objects, deep merge them into one
95
+ if (isObjectModel(combined) && isObjectModel(current)) {
96
+ return deepMergeObject(combined, current);
97
+ }
98
+ // If the current one is null, return what we already had
99
+ if (isNull(current)) {
100
+ return combined;
101
+ }
102
+ return current;
103
+ }, null);
104
+ }
105
+ function deepMergeObject(object1, object2) {
106
+ return Object.keys(object2).reduce(function (acc, property) {
107
+ var _a, _b;
108
+ var object1Property = object1[property];
109
+ var object2Property = object2[property];
110
+ if (isObjectModel(object1Property) && isObjectModel(object2Property)) {
111
+ return __assign(__assign({}, acc), (_a = {}, _a[property] = deepMergeObject(object1Property, object2Property), _a));
112
+ }
113
+ return __assign(__assign({}, acc), (_b = {}, _b[property] = object2[property], _b));
114
+ }, __assign({}, object1));
115
+ }
116
+ export function filterOutNull(array) {
117
+ return array.filter(function (item) { return item !== null; });
118
+ }
@@ -0,0 +1,23 @@
1
+ import { BlobSchema, NumberSchema, IntegerSchema, Model, Schema, AllOfSchema, OneOfSchema, StringSchema } from '../../../dynamic-flow-types';
2
+ declare function getValidationFailures(value: Model, schema: Schema, isRequired: boolean): string[];
3
+ declare function getStringValidationFailures(value: Model, schema: StringSchema, isRequired?: boolean): string[];
4
+ declare function getNumberValidationFailures(value: Model, schema: AllOfSchema | OneOfSchema | NumberSchema | IntegerSchema, isRequired?: boolean): string[];
5
+ declare function getIntegerValidationFailures(value: Model, schema: AllOfSchema | OneOfSchema | NumberSchema | IntegerSchema, isRequired?: boolean): string[];
6
+ declare function getBooleanValidationFailures(value: Model, _schema: Schema, isRequired?: boolean): string[];
7
+ declare function getConstValidationFailures(value: Model, schema: Schema, isRequired?: boolean): string[];
8
+ declare function getArrayValidationFailures(value: Model, schema: {
9
+ minItems?: number;
10
+ maxItems?: number;
11
+ }, isRequired?: boolean): string[];
12
+ declare function getBlobValidationFailures(value: Model, _schema: BlobSchema): string[];
13
+ /**
14
+ * When validating an object we only checking that it is an object and that it
15
+ * has the required properties, we do not check if the properties are valid.
16
+ *
17
+ * @param value
18
+ * @param schema
19
+ */
20
+ declare function getObjectValidationFailures(value: Model, schema: {
21
+ required?: string[];
22
+ }): string[];
23
+ export { getValidationFailures, getStringValidationFailures, getNumberValidationFailures, getIntegerValidationFailures, getBooleanValidationFailures, getConstValidationFailures, getArrayValidationFailures, getObjectValidationFailures, getBlobValidationFailures, };
@@ -0,0 +1,140 @@
1
+ import { isArray, isString, isNumber, isInteger, isBoolean, isNull, } from '@transferwise/neptune-validation';
2
+ import { isObjectModel, } from '../../../dynamic-flow-types';
3
+ import { isStringSchema } from '../../../dynamic-flow-types/Schema';
4
+ import { isValidRequired, isValidMinLength, isValidMaxLength, isValidPattern, isValidMaximum, isValidMinimum, isValidMinItems, isValidMaxItems, isValidRequiredArray, } from '../rule-validators';
5
+ function getValidationFailures(value, schema, isRequired) {
6
+ if (schema["const"]) {
7
+ return getConstValidationFailures(value, schema, isRequired);
8
+ }
9
+ if (isNull(value)) {
10
+ return isRequired ? ['required'] : [];
11
+ }
12
+ if (isStringSchema(schema)) {
13
+ return getStringValidationFailures(value, schema, isRequired);
14
+ }
15
+ switch (schema.type) {
16
+ case 'number':
17
+ return getNumberValidationFailures(value, schema, isRequired);
18
+ case 'integer':
19
+ return getIntegerValidationFailures(value, schema, isRequired);
20
+ case 'boolean':
21
+ return getBooleanValidationFailures(value, schema, isRequired);
22
+ case 'array':
23
+ return getArrayValidationFailures(value, schema, isRequired);
24
+ case 'object':
25
+ return getObjectValidationFailures(value, schema);
26
+ default:
27
+ return [];
28
+ }
29
+ }
30
+ function getStringValidationFailures(value, schema, isRequired) {
31
+ if (!isString(value) && !isNull(value)) {
32
+ return ['type'];
33
+ }
34
+ if (value === '' && isRequired) {
35
+ return ['required'];
36
+ }
37
+ var failures = [];
38
+ if (!isValidRequired(value, isRequired)) {
39
+ failures.push('required');
40
+ }
41
+ if (!isValidMinLength(value, schema.minLength)) {
42
+ failures.push('minLength');
43
+ }
44
+ if (!isValidMaxLength(value, schema.maxLength)) {
45
+ failures.push('maxLength');
46
+ }
47
+ if (!isValidPattern(value, schema.pattern)) {
48
+ failures.push('pattern');
49
+ }
50
+ if (!isValidMinimum(value, schema.minimum)) {
51
+ failures.push('minimum');
52
+ }
53
+ if (!isValidMaximum(value, schema.maximum)) {
54
+ failures.push('maximum');
55
+ }
56
+ return failures;
57
+ }
58
+ function getNumberValidationFailures(value, schema, isRequired) {
59
+ if (!isNumber(value) && !isNull(value)) {
60
+ return ['type'];
61
+ }
62
+ var failures = [];
63
+ if (!isValidRequired(value, isRequired)) {
64
+ failures.push('required');
65
+ }
66
+ if (!isValidMinimum(value, schema.minimum)) {
67
+ failures.push('minimum');
68
+ }
69
+ if (!isValidMaximum(value, schema.maximum)) {
70
+ failures.push('maximum');
71
+ }
72
+ return failures;
73
+ }
74
+ function getIntegerValidationFailures(value, schema, isRequired) {
75
+ if (!isInteger(value)) {
76
+ return ['type'];
77
+ }
78
+ return getNumberValidationFailures(value, schema, isRequired);
79
+ }
80
+ function getBooleanValidationFailures(value, _schema, isRequired) {
81
+ if (!isBoolean(value) && !isNull(value)) {
82
+ return ['type'];
83
+ }
84
+ var failures = [];
85
+ if (!isValidRequired(value, isRequired)) {
86
+ failures.push('required');
87
+ }
88
+ return failures;
89
+ }
90
+ function getConstValidationFailures(value, schema, isRequired) {
91
+ if (!isValidRequired(value, isRequired)) {
92
+ return ['required'];
93
+ }
94
+ if (value !== schema["const"]) {
95
+ return ['const'];
96
+ }
97
+ return [];
98
+ }
99
+ function getArrayValidationFailures(value, schema, isRequired) {
100
+ if (!isArray(value) && !isNull(value)) {
101
+ return ['type'];
102
+ }
103
+ if (!isValidRequiredArray(value, isRequired)) {
104
+ return ['required'];
105
+ }
106
+ var failures = [];
107
+ if (!isValidMinItems(value, schema.minItems)) {
108
+ failures.push('minItems');
109
+ }
110
+ if (!isValidMaxItems(value, schema.maxItems)) {
111
+ failures.push('maxItems');
112
+ }
113
+ return failures;
114
+ }
115
+ function getBlobValidationFailures(value, _schema) {
116
+ if (isNull(value)) {
117
+ return ['type'];
118
+ }
119
+ return [];
120
+ }
121
+ /**
122
+ * When validating an object we only checking that it is an object and that it
123
+ * has the required properties, we do not check if the properties are valid.
124
+ *
125
+ * @param value
126
+ * @param schema
127
+ */
128
+ function getObjectValidationFailures(value, schema) {
129
+ if (!isObjectModel(value)) {
130
+ return ['type'];
131
+ }
132
+ if (!isArray(schema.required)) {
133
+ return [];
134
+ }
135
+ var allPresent = schema.required
136
+ .map(function (property) { return typeof value[property] !== 'undefined'; })
137
+ .reduce(function (propertyInModel, validSoFar) { return propertyInModel && validSoFar; }, true);
138
+ return allPresent ? [] : ['required'];
139
+ }
140
+ export { getValidationFailures, getStringValidationFailures, getNumberValidationFailures, getIntegerValidationFailures, getBooleanValidationFailures, getConstValidationFailures, getArrayValidationFailures, getObjectValidationFailures, getBlobValidationFailures, };
@@ -0,0 +1,185 @@
1
+ import { getValidationFailures } from '.';
2
+ describe('Given a library for identifying validation failures', function () {
3
+ var schema;
4
+ describe('when value is null and schema required', function () {
5
+ beforeEach(function () {
6
+ schema = {
7
+ type: 'string',
8
+ minLength: 3,
9
+ maxLength: 10,
10
+ pattern: '^[a-z]+$'
11
+ };
12
+ });
13
+ it('should return only required', function () {
14
+ expect(getValidationFailures(null, schema, true)).toStrictEqual(['required']);
15
+ });
16
+ });
17
+ describe('when validating a string schema', function () {
18
+ beforeEach(function () {
19
+ schema = {
20
+ type: 'string',
21
+ minLength: 3,
22
+ maxLength: 6,
23
+ pattern: '^[a-z]+$'
24
+ };
25
+ });
26
+ it('should return an empty array for valid string', function () {
27
+ expect(getValidationFailures('string', schema, false)).toStrictEqual([]);
28
+ });
29
+ it('should return an empty array for null if not required', function () {
30
+ expect(getValidationFailures(null, schema, false)).toStrictEqual([]);
31
+ });
32
+ it('should return minLength when too short', function () {
33
+ expect(getValidationFailures('st', schema, false)).toStrictEqual(['minLength']);
34
+ });
35
+ it('should return [maxLength] when too long', function () {
36
+ expect(getValidationFailures('strings', schema, false)).toStrictEqual(['maxLength']);
37
+ });
38
+ it('should return [pattern] when does not pass regex', function () {
39
+ expect(getValidationFailures('STRING', schema, false)).toStrictEqual(['pattern']);
40
+ });
41
+ it('should return [type] when incorrect data type', function () {
42
+ expect(getValidationFailures(1234, schema, false)).toStrictEqual(['type']);
43
+ });
44
+ });
45
+ describe('when validating a string date', function () {
46
+ beforeEach(function () {
47
+ schema = {
48
+ type: 'string',
49
+ minimum: '2000-01-01T00:00:00Z',
50
+ maximum: '2010-01-01T00:00:00Z'
51
+ };
52
+ });
53
+ it('should return an empty array for valid date', function () {
54
+ expect(getValidationFailures('2005-01-01T00:00:00Z', schema, false)).toStrictEqual([]);
55
+ });
56
+ it('should return [min] when date is too early', function () {
57
+ expect(getValidationFailures('1999-01-01T00:00:00Z', schema, false)).toStrictEqual([
58
+ 'minimum',
59
+ ]);
60
+ });
61
+ it('should return [max] when date is too late', function () {
62
+ expect(getValidationFailures('2011-01-01T00:00:00Z', schema, false)).toStrictEqual([
63
+ 'maximum',
64
+ ]);
65
+ });
66
+ });
67
+ describe('when validating a number schema', function () {
68
+ beforeEach(function () {
69
+ schema = {
70
+ type: 'number',
71
+ minimum: 0,
72
+ maximum: 20
73
+ };
74
+ });
75
+ it('should return an empty array for an integer in range', function () {
76
+ expect(getValidationFailures(10, schema, false)).toStrictEqual([]);
77
+ });
78
+ it('should return an empty array for a float in range', function () {
79
+ expect(getValidationFailures(12.34, schema, false)).toStrictEqual([]);
80
+ });
81
+ it('should return an empty array for a number that matches our min', function () {
82
+ expect(getValidationFailures(0, schema, false)).toStrictEqual([]);
83
+ });
84
+ it('should return an empty array for a number that matches our max', function () {
85
+ expect(getValidationFailures(20, schema, false)).toStrictEqual([]);
86
+ });
87
+ it('should return [min] when number is too low', function () {
88
+ expect(getValidationFailures(-1, schema, false)).toStrictEqual(['minimum']);
89
+ });
90
+ it('should return [max] when number is too high', function () {
91
+ expect(getValidationFailures(21, schema, false)).toStrictEqual(['maximum']);
92
+ });
93
+ it('should return [type] when incorrect data type', function () {
94
+ expect(getValidationFailures('string', schema, false)).toStrictEqual(['type']);
95
+ });
96
+ });
97
+ describe('when validating an integer schema', function () {
98
+ beforeEach(function () {
99
+ schema = { type: 'integer' };
100
+ });
101
+ it('should return an empty array for valid integer', function () {
102
+ expect(getValidationFailures(15, schema, false)).toStrictEqual([]);
103
+ });
104
+ it('should return [type] when a number is not an integer', function () {
105
+ expect(getValidationFailures(12.34, schema, false)).toStrictEqual(['type']);
106
+ });
107
+ });
108
+ describe('when validating a boolean schema', function () {
109
+ beforeEach(function () {
110
+ schema = { type: 'boolean' };
111
+ });
112
+ it('should return an empty array for valid boolean', function () {
113
+ expect(getValidationFailures(true, schema, false)).toStrictEqual([]);
114
+ expect(getValidationFailures(false, schema, false)).toStrictEqual([]);
115
+ });
116
+ it('should return [type] when incorrect data type', function () {
117
+ expect(getValidationFailures(1, schema, false)).toStrictEqual(['type']);
118
+ });
119
+ });
120
+ describe('when validating a const schema', function () {
121
+ beforeEach(function () {
122
+ schema = { "const": 'abcd' };
123
+ });
124
+ it('should return an empty array when the const matches', function () {
125
+ expect(getValidationFailures('abcd', schema, false)).toStrictEqual([]);
126
+ });
127
+ it("should return ['const'] when the const does not match", function () {
128
+ expect(getValidationFailures('1234', schema, false)).toStrictEqual(['const']);
129
+ });
130
+ it("should return ['const'] when null", function () {
131
+ expect(getValidationFailures(null, schema, false)).toStrictEqual(['const']);
132
+ });
133
+ it("should return ['const'] when undefined", function () {
134
+ expect(getValidationFailures(undefined, schema, false)) //
135
+ .toStrictEqual(['const']);
136
+ });
137
+ });
138
+ describe('when validating an array schema', function () {
139
+ beforeEach(function () {
140
+ schema = {
141
+ type: 'array',
142
+ items: {
143
+ type: 'number'
144
+ },
145
+ minItems: 2,
146
+ maxItems: 2
147
+ };
148
+ });
149
+ it('should return an empty array for a valid array', function () {
150
+ expect(getValidationFailures([1, 2], schema, false)).toStrictEqual([]);
151
+ });
152
+ it('should return [minItems] when the array is too small', function () {
153
+ expect(getValidationFailures([1], schema, false)).toStrictEqual(['minItems']);
154
+ });
155
+ it('should return [maxItems] when the array is too big', function () {
156
+ expect(getValidationFailures([1, 2, 3], schema, false)).toStrictEqual(['maxItems']);
157
+ });
158
+ it('should return [type] when incorrect data type', function () {
159
+ expect(getValidationFailures({ a: 1 }, schema, false)).toStrictEqual(['type']);
160
+ });
161
+ });
162
+ describe('when validating an object schema', function () {
163
+ beforeEach(function () {
164
+ schema = {
165
+ type: 'object',
166
+ properties: {
167
+ a: {
168
+ type: 'number'
169
+ }
170
+ },
171
+ required: ['a'],
172
+ displayOrder: ['a']
173
+ };
174
+ });
175
+ it('should return an empty array for a valid object', function () {
176
+ expect(getValidationFailures({ a: 1 }, schema, false)).toStrictEqual([]);
177
+ });
178
+ it('should return [required] when required properties are missing', function () {
179
+ expect(getValidationFailures({}, schema, false)).toStrictEqual(['required']);
180
+ });
181
+ it('should return [type] when incorrect data type', function () {
182
+ expect(getValidationFailures([1], schema, false)).toStrictEqual(['type']);
183
+ });
184
+ });
185
+ });
@@ -0,0 +1,19 @@
1
+ import { HttpMethod } from './core';
2
+ type CoreAction = {
3
+ $id?: string;
4
+ data?: Record<string, unknown>;
5
+ exit?: boolean;
6
+ method?: HttpMethod;
7
+ result?: Record<string, unknown>;
8
+ timeout?: number;
9
+ url?: string;
10
+ };
11
+ export type Action = CoreAction & {
12
+ title?: string;
13
+ type?: 'primary' | 'secondary' | 'link' | 'positive' | 'negative';
14
+ disabled?: boolean;
15
+ };
16
+ export type ActionResponseBody = {
17
+ action: Action;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ImageLayout } from './LayoutComponent';
2
+ import { StringSchema } from './Schema';
3
+ export type FileUploadSchema = Omit<StringSchema, 'type' | 'format' | 'source' | 'image' | 'cameraConfig'> & {
4
+ type: 'string';
5
+ format: 'base64url';
6
+ source?: 'camera' | 'file';
7
+ image?: ImageLayout;
8
+ cameraConfig?: CameraConfig;
9
+ };
10
+ type CameraConfig = {
11
+ assets?: {
12
+ overlay?: string;
13
+ outline?: string;
14
+ };
15
+ direction?: CameraDirection;
16
+ instructions?: string;
17
+ };
18
+ export declare function isFileUploadSchema(schema: {
19
+ type?: string;
20
+ format?: string;
21
+ }): schema is FileUploadSchema;
22
+ export type CameraDirection = 'back' | 'front';
23
+ export {};
@@ -0,0 +1,3 @@
1
+ export function isFileUploadSchema(schema) {
2
+ return schema.type === 'string' && schema.format === 'base64url';
3
+ }
@@ -0,0 +1,129 @@
1
+ import { ExternalStepPollingConfiguration } from '../layout/external/useExternalStepPolling';
2
+ import { Action } from './Action';
3
+ import { Schema } from './Schema';
4
+ import { Margin, Size, Icon, Image, Align, Orientation, Reference, Alert } from './core';
5
+ export type LayoutComponent = AlertLayout | BoxLayout | ButtonLayout | ColumnsLayout | DecisionLayout | DividerLayout | ExternalLayout | FormLayout | HeadingLayout | ImageLayout | InfoLayout | ListLayout | LoadingIndicatorLayout | ParagraphLayout | ReviewLayout;
6
+ export type AlertLayout = {
7
+ type: 'alert';
8
+ } & Alert;
9
+ export type BoxLayout = {
10
+ type: 'box';
11
+ components: LayoutComponent[];
12
+ width?: Size;
13
+ margin?: Margin;
14
+ border?: boolean;
15
+ };
16
+ export type ButtonLayout = {
17
+ type: 'button';
18
+ action: Action | Reference;
19
+ margin?: Margin;
20
+ /**
21
+ * @deprecated Only supported on web client
22
+ */
23
+ size?: Size;
24
+ };
25
+ export type ColumnsLayout = {
26
+ type: 'columns';
27
+ left: LayoutComponent[];
28
+ right: LayoutComponent[];
29
+ bias?: 'none' | 'left' | 'right';
30
+ margin?: Margin;
31
+ };
32
+ export type DecisionLayout = {
33
+ type: 'decision';
34
+ options: DecisionOption[];
35
+ margin?: Margin;
36
+ };
37
+ type DecisionOption = {
38
+ action: Action | Reference;
39
+ title: string;
40
+ description?: string;
41
+ icon?: Icon;
42
+ image?: Image;
43
+ disabled?: boolean;
44
+ };
45
+ /**
46
+ * @deprecated Only supported on web client
47
+ */
48
+ export type DividerLayout = {
49
+ type: 'divider';
50
+ margin?: Margin;
51
+ };
52
+ /**
53
+ * @deprecated Please use the external feature set instead
54
+ */
55
+ export type ExternalLayout = {
56
+ type: 'external';
57
+ requestUrl: string;
58
+ polling?: Omit<ExternalStepPollingConfiguration, 'responseHandlers'>;
59
+ responseHandlers?: ExternalStepPollingConfiguration['responseHandlers'];
60
+ retryTitle?: string;
61
+ };
62
+ export type FormLayout = {
63
+ type: 'form';
64
+ schema: Schema | Reference;
65
+ margin?: Margin;
66
+ };
67
+ export type HeadingLayout = {
68
+ type: 'heading';
69
+ size?: Size;
70
+ text: string;
71
+ margin?: Margin;
72
+ align?: Align;
73
+ };
74
+ export type ImageLayout = {
75
+ type: 'image';
76
+ url: string;
77
+ /**
78
+ * @deprecated Only supported on web client
79
+ */
80
+ text?: string;
81
+ size?: Size;
82
+ margin?: Margin;
83
+ };
84
+ export type InfoLayout = {
85
+ type: 'info';
86
+ markdown: string;
87
+ margin?: Margin;
88
+ align?: Align;
89
+ };
90
+ export type ListLayout = {
91
+ type: 'list';
92
+ items: ListItem[];
93
+ title?: string;
94
+ margin?: Margin;
95
+ };
96
+ type ListItem = {
97
+ title: string;
98
+ description?: string;
99
+ icon?: Icon;
100
+ status?: 'positive' | 'neutral' | 'warning';
101
+ };
102
+ export type LoadingIndicatorLayout = {
103
+ type: 'loading-indicator';
104
+ margin?: Margin;
105
+ size?: Size;
106
+ };
107
+ export type ParagraphLayout = {
108
+ type: 'paragraph';
109
+ text: string;
110
+ control?: 'copyable';
111
+ margin?: Margin;
112
+ align?: Align;
113
+ };
114
+ export type ReviewLayout = {
115
+ type: 'review';
116
+ title?: string;
117
+ fields: ReviewField[];
118
+ orientation?: Orientation;
119
+ margin?: Margin;
120
+ /**
121
+ * @deprecated Only supported on web client
122
+ */
123
+ action?: Action;
124
+ };
125
+ type ReviewField = {
126
+ label: string;
127
+ value: string | number | boolean | null | undefined;
128
+ };
129
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export type BasicModel = boolean | number | string;
2
+ export type ObjectModel = {
3
+ [key: string]: Model;
4
+ };
5
+ export type ArrayModel = Array<BasicModel | null>;
6
+ export type Model = BasicModel | ObjectModel | ArrayModel | null;
7
+ export declare const isObjectModel: (model: Model) => model is ObjectModel;
8
+ export declare const isNullableObjectModel: (model: Model) => model is ObjectModel | null;
9
+ export declare const isNullableBasicModel: (model: Model) => model is BasicModel | null;
10
+ export declare const isNullableStringModel: (model: Model) => model is string | null;
11
+ export declare const isArrayModel: (model: Model) => model is ArrayModel;
12
+ export declare const isNullableArrayModel: (model: Model) => model is ArrayModel | null;