@wise/dynamic-flow-client 0.4.2 → 0.4.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 (468) hide show
  1. package/build/main.js +9606 -0
  2. package/build/main.min.js +31 -0
  3. package/build/types/index.d.ts +11 -15
  4. package/build/types/types/index.d.ts +15 -0
  5. package/package.json +6 -5
  6. package/build/common/constants/DateMode.js +0 -7
  7. package/build/common/constants/FormControlType.js +0 -20
  8. package/build/common/constants/MonthFormat.js +0 -7
  9. package/build/common/constants/SchemaType.js +0 -14
  10. package/build/common/constants/Size.js +0 -10
  11. package/build/common/constants/index.js +0 -21
  12. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +0 -29
  13. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +0 -19
  14. package/build/common/contexts/eventsContext/EventsContext.js +0 -22
  15. package/build/common/contexts/fetcherContexts/FetcherContexts.js +0 -29
  16. package/build/common/contexts/index.js +0 -20
  17. package/build/common/contexts/logContext/LogContext.js +0 -27
  18. package/build/common/hooks/index.js +0 -23
  19. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +0 -13
  20. package/build/common/hooks/useExternal/useExternal.js +0 -19
  21. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +0 -62
  22. package/build/common/hooks/usePersistAsync/usePersistAsync.js +0 -98
  23. package/build/common/hooks/usePolling/usePolling.js +0 -52
  24. package/build/common/hooks/usePrevious/usePrevious.js +0 -12
  25. package/build/common/hooks/useStepPolling/useStepPolling.js +0 -49
  26. package/build/common/makeFetcher/index.js +0 -17
  27. package/build/common/makeFetcher/makeFetcher.js +0 -23
  28. package/build/common/messages.js +0 -10
  29. package/build/common/utils/api-utils.js +0 -19
  30. package/build/common/utils/date-utils.js +0 -27
  31. package/build/common/utils/debounce.js +0 -38
  32. package/build/common/utils/file-utils.js +0 -38
  33. package/build/common/utils/id-utils.js +0 -8
  34. package/build/common/utils/index.js +0 -24
  35. package/build/common/utils/is-equal.js +0 -25
  36. package/build/common/utils/schema-utils.js +0 -55
  37. package/build/common/utils/step-utils.js +0 -47
  38. package/build/common/validators/index.js +0 -28
  39. package/build/common/validators/models/model-validators.js +0 -69
  40. package/build/common/validators/models/models.utils.js +0 -117
  41. package/build/common/validators/schemas/schema-validators.js +0 -99
  42. package/build/common/validators/types/type-validators.js +0 -21
  43. package/build/common/validators/validationFailures/validation-failures.js +0 -151
  44. package/build/common/validators/validationFailures/validation-failures.utils.js +0 -49
  45. package/build/common/validators/values/value-validators.js +0 -7
  46. package/build/dynamicFlow/DynamicFlow.js +0 -250
  47. package/build/dynamicFlow/DynamicFlowStep.js +0 -25
  48. package/build/dynamicFlow/DynamicFlowTypes.js +0 -8
  49. package/build/dynamicFlow/index.js +0 -8
  50. package/build/dynamicFlow/stories/DynamicFlow.story.js +0 -36
  51. package/build/dynamicFlow/stories/EditableDynamicFlow.js +0 -54
  52. package/build/dynamicFlow/stories/fixtureFetcher.js +0 -60
  53. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +0 -29
  54. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +0 -15
  55. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +0 -18
  56. package/build/dynamicFlow/utils/index.js +0 -26
  57. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +0 -66
  58. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +0 -27
  59. package/build/dynamicFlow/utils/useDynamicFlowState.js +0 -91
  60. package/build/dynamicFlow/utils/useLoader.js +0 -15
  61. package/build/fixtures/components/alert.js +0 -33
  62. package/build/fixtures/components/box.js +0 -22
  63. package/build/fixtures/components/button.js +0 -56
  64. package/build/fixtures/components/columns.js +0 -38
  65. package/build/fixtures/components/copyable.js +0 -24
  66. package/build/fixtures/components/decision.js +0 -56
  67. package/build/fixtures/components/heading.js +0 -16
  68. package/build/fixtures/components/image.js +0 -25
  69. package/build/fixtures/components/index.js +0 -32
  70. package/build/fixtures/components/info.js +0 -35
  71. package/build/fixtures/components/list.js +0 -36
  72. package/build/fixtures/components/loading-indicator.js +0 -18
  73. package/build/fixtures/components/paragraph.js +0 -30
  74. package/build/fixtures/components/review.js +0 -62
  75. package/build/fixtures/examples/camera-capture.js +0 -123
  76. package/build/fixtures/examples/index.js +0 -16
  77. package/build/fixtures/examples/recipient-update.js +0 -252
  78. package/build/fixtures/examples/recipient.js +0 -315
  79. package/build/fixtures/examples/single-file-upload.js +0 -100
  80. package/build/fixtures/examples/step-validation-errors.js +0 -77
  81. package/build/fixtures/features/action-response.js +0 -31
  82. package/build/fixtures/features/external.js +0 -33
  83. package/build/fixtures/features/index.js +0 -16
  84. package/build/fixtures/features/persist-async.js +0 -46
  85. package/build/fixtures/features/polling.js +0 -35
  86. package/build/fixtures/features/validation-async.js +0 -40
  87. package/build/fixtures/index.js +0 -38
  88. package/build/fixtures/jsonSchemaForm/allOf.js +0 -121
  89. package/build/fixtures/jsonSchemaForm/audRecipient.d.ts +0 -3
  90. package/build/fixtures/jsonSchemaForm/audRecipient.js +0 -1106
  91. package/build/fixtures/jsonSchemaForm/currency.d.ts +0 -3
  92. package/build/fixtures/jsonSchemaForm/currency.js +0 -50
  93. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.d.ts +0 -3
  94. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +0 -39
  95. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.d.ts +0 -3
  96. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +0 -38
  97. package/build/fixtures/jsonSchemaForm/oneOf.d.ts +0 -3
  98. package/build/fixtures/jsonSchemaForm/oneOf.js +0 -121
  99. package/build/fixtures/jsonSchemaForm/oneOfTabs.d.ts +0 -3
  100. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +0 -55
  101. package/build/fixtures/jsonSchemaForm/promotedOneOf.d.ts +0 -3
  102. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +0 -58
  103. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.d.ts +0 -3
  104. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +0 -104
  105. package/build/fixtures/jsonSchemaForm/simple.d.ts +0 -3
  106. package/build/fixtures/jsonSchemaForm/simple.js +0 -50
  107. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.d.ts +0 -3
  108. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +0 -73
  109. package/build/fixtures/jsonSchemaForm/validationAsync.d.ts +0 -3
  110. package/build/fixtures/jsonSchemaForm/validationAsync.js +0 -25
  111. package/build/fixtures/layouts/all.js +0 -178
  112. package/build/fixtures/layouts/final-step-layout.js +0 -41
  113. package/build/fixtures/layouts/index.js +0 -18
  114. package/build/fixtures/layouts/list.js +0 -35
  115. package/build/fixtures/layouts/pay-in.js +0 -99
  116. package/build/fixtures/layouts/review.js +0 -162
  117. package/build/fixtures/layouts/success.js +0 -68
  118. package/build/fixtures/responses/action-response-final.js +0 -26
  119. package/build/fixtures/responses/action.js +0 -4
  120. package/build/fixtures/responses/exit.js +0 -4
  121. package/build/fixtures/responses/index.js +0 -14
  122. package/build/fixtures/responses/recipient-update-final.js +0 -26
  123. package/build/fixtures/schemas/basic-form.js +0 -41
  124. package/build/fixtures/schemas/index.js +0 -14
  125. package/build/fixtures/schemas/number-and-integer.js +0 -43
  126. package/build/fixtures/schemas/one-of.js +0 -222
  127. package/build/fixtures/schemas/string-formats.js +0 -64
  128. package/build/fixtures/utils/image-util.js +0 -22
  129. package/build/formControl/FormControl.js +0 -213
  130. package/build/formControl/index.js +0 -8
  131. package/build/formControl/utils/index.js +0 -17
  132. package/build/formControl/utils/value-utils.js +0 -111
  133. package/build/i18n/index.js +0 -36
  134. package/build/index.d.ts +0 -11
  135. package/build/index.js +0 -38
  136. package/build/jsonSchemaForm/JsonSchemaForm.js +0 -22
  137. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +0 -46
  138. package/build/jsonSchemaForm/allOfSchema/index.js +0 -8
  139. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +0 -19
  140. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +0 -20
  141. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +0 -8
  142. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +0 -86
  143. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +0 -20
  144. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +0 -8
  145. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +0 -18
  146. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +0 -38
  147. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +0 -20
  148. package/build/jsonSchemaForm/arrayTypeSchema/index.js +0 -8
  149. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +0 -91
  150. package/build/jsonSchemaForm/basicTypeSchema/index.js +0 -8
  151. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +0 -73
  152. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +0 -55
  153. package/build/jsonSchemaForm/controlFeedback/index.js +0 -8
  154. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +0 -118
  155. package/build/jsonSchemaForm/genericSchema/index.js +0 -8
  156. package/build/jsonSchemaForm/help/Help.js +0 -14
  157. package/build/jsonSchemaForm/help/Help.messages.js +0 -10
  158. package/build/jsonSchemaForm/help/index.js +0 -8
  159. package/build/jsonSchemaForm/index.js +0 -8
  160. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +0 -62
  161. package/build/jsonSchemaForm/objectSchema/index.js +0 -8
  162. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +0 -135
  163. package/build/jsonSchemaForm/oneOfSchema/index.js +0 -8
  164. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +0 -13
  165. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +0 -18
  166. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +0 -69
  167. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +0 -20
  168. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +0 -10
  169. package/build/jsonSchemaForm/persistAsyncSchema/index.js +0 -8
  170. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +0 -119
  171. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +0 -8
  172. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +0 -66
  173. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +0 -36
  174. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +0 -8
  175. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +0 -58
  176. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +0 -8
  177. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +0 -12
  178. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +0 -18
  179. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +0 -25
  180. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +0 -23
  181. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +0 -58
  182. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +0 -15
  183. package/build/jsonSchemaForm/readOnlySchema/index.js +0 -8
  184. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +0 -98
  185. package/build/jsonSchemaForm/schemaFormControl/index.js +0 -8
  186. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +0 -77
  187. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +0 -17
  188. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +0 -110
  189. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +0 -89
  190. package/build/jsonSchemaForm/validationAsyncSchema/index.js +0 -8
  191. package/build/layout/DynamicLayout.js +0 -52
  192. package/build/layout/alert/DynamicAlert.js +0 -31
  193. package/build/layout/box/DynamicBox.js +0 -32
  194. package/build/layout/button/DynamicButton.js +0 -49
  195. package/build/layout/columns/DynamicColumns.js +0 -29
  196. package/build/layout/decision/DynamicDecision.js +0 -29
  197. package/build/layout/divider/DynamicDivider.js +0 -10
  198. package/build/layout/external/DynamicExternal.js +0 -25
  199. package/build/layout/external/DynamicExternal.messages.js +0 -10
  200. package/build/layout/form/DynamicForm.js +0 -16
  201. package/build/layout/heading/DynamicHeading.js +0 -22
  202. package/build/layout/icon/DynamicIcon.js +0 -49
  203. package/build/layout/image/DynamicImage.js +0 -62
  204. package/build/layout/index.js +0 -40
  205. package/build/layout/info/DynamicInfo.js +0 -9
  206. package/build/layout/list/DynamicList.js +0 -21
  207. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +0 -12
  208. package/build/layout/paragraph/DynamicParagraph.js +0 -30
  209. package/build/layout/paragraph/DynamicParagraph.messages.js +0 -15
  210. package/build/layout/paragraph/useSnackBarIfAvailable.js +0 -13
  211. package/build/layout/review/DynamicReview.js +0 -23
  212. package/build/layout/utils.js +0 -33
  213. package/build/step/cameraStep/CameraStep.js +0 -84
  214. package/build/step/cameraStep/cameraCapture/CameraCapture.js +0 -70
  215. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +0 -20
  216. package/build/step/cameraStep/cameraCapture/components/index.js +0 -18
  217. package/build/step/cameraStep/cameraCapture/hooks/index.js +0 -29
  218. package/build/step/cameraStep/cameraCapture/index.js +0 -8
  219. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +0 -68
  220. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +0 -13
  221. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +0 -15
  222. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +0 -14
  223. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +0 -20
  224. package/build/step/cameraStep/cameraCapture/screens/index.js +0 -10
  225. package/build/step/cameraStep/cameraCapture/tracking/index.js +0 -22
  226. package/build/step/cameraStep/cameraCapture/utils/index.js +0 -51
  227. package/build/step/cameraStep/index.js +0 -8
  228. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +0 -68
  229. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +0 -25
  230. package/build/step/externalConfirmationStep/index.js +0 -8
  231. package/build/step/index.js +0 -12
  232. package/build/step/layoutStep/LayoutStep.js +0 -35
  233. package/build/step/layoutStep/index.js +0 -8
  234. package/build/step/layoutStep/utils/index.js +0 -7
  235. package/build/step/layoutStep/utils/inline-reference-utils.js +0 -78
  236. package/build/step/layoutStep/utils/layout-utils.js +0 -203
  237. package/build/types/common/FormControl.js +0 -2
  238. package/build/types/index.js +0 -42
  239. package/build/types/specification/Action.js +0 -2
  240. package/build/types/specification/FileUploadSchema.js +0 -8
  241. package/build/types/specification/LayoutComponent.js +0 -2
  242. package/build/types/specification/Model.js +0 -30
  243. package/build/types/specification/PersistAsync.js +0 -2
  244. package/build/types/specification/Polling.js +0 -2
  245. package/build/types/specification/Promotion.js +0 -2
  246. package/build/types/specification/Schema.js +0 -67
  247. package/build/types/specification/Step.js +0 -6
  248. package/build/types/specification/ValidationAsync.js +0 -2
  249. package/build/types/specification/core.js +0 -2
  250. /package/build/{common → types/common}/constants/DateMode.d.ts +0 -0
  251. /package/build/{common → types/common}/constants/FormControlType.d.ts +0 -0
  252. /package/build/{common → types/common}/constants/MonthFormat.d.ts +0 -0
  253. /package/build/{common → types/common}/constants/SchemaType.d.ts +0 -0
  254. /package/build/{common → types/common}/constants/Size.d.ts +0 -0
  255. /package/build/{common → types/common}/constants/index.d.ts +0 -0
  256. /package/build/{common → types/common}/contexts/dynamicFlowContexts/DynamicFlowContexts.d.ts +0 -0
  257. /package/build/{common → types/common}/contexts/dynamicFlowContexts/usePendingPromiseCounter.d.ts +0 -0
  258. /package/build/{common → types/common}/contexts/eventsContext/EventsContext.d.ts +0 -0
  259. /package/build/{common → types/common}/contexts/fetcherContexts/FetcherContexts.d.ts +0 -0
  260. /package/build/{common → types/common}/contexts/index.d.ts +0 -0
  261. /package/build/{common → types/common}/contexts/logContext/LogContext.d.ts +0 -0
  262. /package/build/{common → types/common}/hooks/index.d.ts +0 -0
  263. /package/build/{common → types/common}/hooks/useDebouncedFunction/useDebouncedFunction.d.ts +0 -0
  264. /package/build/{common → types/common}/hooks/useExternal/useExternal.d.ts +0 -0
  265. /package/build/{common → types/common}/hooks/useExternalStepPolling/useExternalStepPolling.d.ts +0 -0
  266. /package/build/{common → types/common}/hooks/usePersistAsync/usePersistAsync.d.ts +0 -0
  267. /package/build/{common → types/common}/hooks/usePolling/usePolling.d.ts +0 -0
  268. /package/build/{common → types/common}/hooks/usePrevious/usePrevious.d.ts +0 -0
  269. /package/build/{common → types/common}/hooks/useStepPolling/useStepPolling.d.ts +0 -0
  270. /package/build/{common → types/common}/makeFetcher/index.d.ts +0 -0
  271. /package/build/{common → types/common}/makeFetcher/makeFetcher.d.ts +0 -0
  272. /package/build/{common → types/common}/messages.d.ts +0 -0
  273. /package/build/{common → types/common}/utils/api-utils.d.ts +0 -0
  274. /package/build/{common → types/common}/utils/date-utils.d.ts +0 -0
  275. /package/build/{common → types/common}/utils/debounce.d.ts +0 -0
  276. /package/build/{common → types/common}/utils/file-utils.d.ts +0 -0
  277. /package/build/{common → types/common}/utils/id-utils.d.ts +0 -0
  278. /package/build/{common → types/common}/utils/index.d.ts +0 -0
  279. /package/build/{common → types/common}/utils/is-equal.d.ts +0 -0
  280. /package/build/{common → types/common}/utils/schema-utils.d.ts +0 -0
  281. /package/build/{common → types/common}/utils/step-utils.d.ts +0 -0
  282. /package/build/{common → types/common}/validators/index.d.ts +0 -0
  283. /package/build/{common → types/common}/validators/models/model-validators.d.ts +0 -0
  284. /package/build/{common → types/common}/validators/models/models.utils.d.ts +0 -0
  285. /package/build/{common → types/common}/validators/schemas/schema-validators.d.ts +0 -0
  286. /package/build/{common → types/common}/validators/types/type-validators.d.ts +0 -0
  287. /package/build/{common → types/common}/validators/validationFailures/validation-failures.d.ts +0 -0
  288. /package/build/{common → types/common}/validators/validationFailures/validation-failures.utils.d.ts +0 -0
  289. /package/build/{common → types/common}/validators/values/value-validators.d.ts +0 -0
  290. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlow.d.ts +0 -0
  291. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowStep.d.ts +0 -0
  292. /package/build/{dynamicFlow → types/dynamicFlow}/DynamicFlowTypes.d.ts +0 -0
  293. /package/build/{dynamicFlow → types/dynamicFlow}/index.d.ts +0 -0
  294. /package/build/{dynamicFlow → types/dynamicFlow}/stories/DynamicFlow.story.d.ts +0 -0
  295. /package/build/{dynamicFlow → types/dynamicFlow}/stories/EditableDynamicFlow.d.ts +0 -0
  296. /package/build/{dynamicFlow → types/dynamicFlow}/stories/fixtureFetcher.d.ts +0 -0
  297. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.d.ts +0 -0
  298. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundary.messages.d.ts +0 -0
  299. /package/build/{dynamicFlow → types/dynamicFlow}/utils/errorBoundary/ErrorBoundaryAlert.d.ts +0 -0
  300. /package/build/{dynamicFlow → types/dynamicFlow}/utils/index.d.ts +0 -0
  301. /package/build/{dynamicFlow → types/dynamicFlow}/utils/responseParsers/response-parsers.d.ts +0 -0
  302. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +0 -0
  303. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useDynamicFlowState.d.ts +0 -0
  304. /package/build/{dynamicFlow → types/dynamicFlow}/utils/useLoader.d.ts +0 -0
  305. /package/build/{fixtures → types/fixtures}/components/alert.d.ts +0 -0
  306. /package/build/{fixtures → types/fixtures}/components/box.d.ts +0 -0
  307. /package/build/{fixtures → types/fixtures}/components/button.d.ts +0 -0
  308. /package/build/{fixtures → types/fixtures}/components/columns.d.ts +0 -0
  309. /package/build/{fixtures → types/fixtures}/components/copyable.d.ts +0 -0
  310. /package/build/{fixtures → types/fixtures}/components/decision.d.ts +0 -0
  311. /package/build/{fixtures → types/fixtures}/components/heading.d.ts +0 -0
  312. /package/build/{fixtures → types/fixtures}/components/image.d.ts +0 -0
  313. /package/build/{fixtures → types/fixtures}/components/index.d.ts +0 -0
  314. /package/build/{fixtures → types/fixtures}/components/info.d.ts +0 -0
  315. /package/build/{fixtures → types/fixtures}/components/list.d.ts +0 -0
  316. /package/build/{fixtures → types/fixtures}/components/loading-indicator.d.ts +0 -0
  317. /package/build/{fixtures → types/fixtures}/components/paragraph.d.ts +0 -0
  318. /package/build/{fixtures → types/fixtures}/components/review.d.ts +0 -0
  319. /package/build/{fixtures → types/fixtures}/examples/camera-capture.d.ts +0 -0
  320. /package/build/{fixtures → types/fixtures}/examples/index.d.ts +0 -0
  321. /package/build/{fixtures → types/fixtures}/examples/recipient-update.d.ts +0 -0
  322. /package/build/{fixtures → types/fixtures}/examples/recipient.d.ts +0 -0
  323. /package/build/{fixtures → types/fixtures}/examples/single-file-upload.d.ts +0 -0
  324. /package/build/{fixtures → types/fixtures}/examples/step-validation-errors.d.ts +0 -0
  325. /package/build/{fixtures → types/fixtures}/features/action-response.d.ts +0 -0
  326. /package/build/{fixtures → types/fixtures}/features/external.d.ts +0 -0
  327. /package/build/{fixtures → types/fixtures}/features/index.d.ts +0 -0
  328. /package/build/{fixtures → types/fixtures}/features/persist-async.d.ts +0 -0
  329. /package/build/{fixtures → types/fixtures}/features/polling.d.ts +0 -0
  330. /package/build/{fixtures → types/fixtures}/features/validation-async.d.ts +0 -0
  331. /package/build/{fixtures → types/fixtures}/index.d.ts +0 -0
  332. /package/build/{fixtures → types/fixtures}/jsonSchemaForm/allOf.d.ts +0 -0
  333. /package/build/{fixtures → types/fixtures}/layouts/all.d.ts +0 -0
  334. /package/build/{fixtures → types/fixtures}/layouts/final-step-layout.d.ts +0 -0
  335. /package/build/{fixtures → types/fixtures}/layouts/index.d.ts +0 -0
  336. /package/build/{fixtures → types/fixtures}/layouts/list.d.ts +0 -0
  337. /package/build/{fixtures → types/fixtures}/layouts/pay-in.d.ts +0 -0
  338. /package/build/{fixtures → types/fixtures}/layouts/review.d.ts +0 -0
  339. /package/build/{fixtures → types/fixtures}/layouts/success.d.ts +0 -0
  340. /package/build/{fixtures → types/fixtures}/responses/action-response-final.d.ts +0 -0
  341. /package/build/{fixtures → types/fixtures}/responses/action.d.ts +0 -0
  342. /package/build/{fixtures → types/fixtures}/responses/exit.d.ts +0 -0
  343. /package/build/{fixtures → types/fixtures}/responses/index.d.ts +0 -0
  344. /package/build/{fixtures → types/fixtures}/responses/recipient-update-final.d.ts +0 -0
  345. /package/build/{fixtures → types/fixtures}/schemas/basic-form.d.ts +0 -0
  346. /package/build/{fixtures → types/fixtures}/schemas/index.d.ts +0 -0
  347. /package/build/{fixtures → types/fixtures}/schemas/number-and-integer.d.ts +0 -0
  348. /package/build/{fixtures → types/fixtures}/schemas/one-of.d.ts +0 -0
  349. /package/build/{fixtures → types/fixtures}/schemas/string-formats.d.ts +0 -0
  350. /package/build/{fixtures → types/fixtures}/utils/image-util.d.ts +0 -0
  351. /package/build/{formControl → types/formControl}/FormControl.d.ts +0 -0
  352. /package/build/{formControl → types/formControl}/index.d.ts +0 -0
  353. /package/build/{formControl → types/formControl}/utils/index.d.ts +0 -0
  354. /package/build/{formControl → types/formControl}/utils/value-utils.d.ts +0 -0
  355. /package/build/{i18n → types/i18n}/index.d.ts +0 -0
  356. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/JsonSchemaForm.d.ts +0 -0
  357. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/AllOfSchema.d.ts +0 -0
  358. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/allOfSchema/index.d.ts +0 -0
  359. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/ArraySchema.d.ts +0 -0
  360. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -0
  361. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/index.d.ts +0 -0
  362. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -0
  363. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts +0 -0
  364. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.d.ts +0 -0
  365. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.d.ts +0 -0
  366. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.d.ts +0 -0
  367. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.d.ts +0 -0
  368. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/arrayTypeSchema/index.d.ts +0 -0
  369. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/BasicTypeSchema.d.ts +0 -0
  370. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/basicTypeSchema/index.d.ts +0 -0
  371. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.d.ts +0 -0
  372. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/ControlFeedback.messages.d.ts +0 -0
  373. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/controlFeedback/index.d.ts +0 -0
  374. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/GenericSchema.d.ts +0 -0
  375. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/genericSchema/index.d.ts +0 -0
  376. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.d.ts +0 -0
  377. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/Help.messages.d.ts +0 -0
  378. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/help/index.d.ts +0 -0
  379. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/index.d.ts +0 -0
  380. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/ObjectSchema.d.ts +0 -0
  381. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/objectSchema/index.d.ts +0 -0
  382. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/OneOfSchema.d.ts +0 -0
  383. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/index.d.ts +0 -0
  384. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/const-schema-utils.d.ts +0 -0
  385. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/index.d.ts +0 -0
  386. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/oneOfSchema/utils/one-of-utils.d.ts +0 -0
  387. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -0
  388. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -0
  389. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/index.d.ts +0 -0
  390. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -0
  391. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBasicSchema/index.d.ts +0 -0
  392. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -0
  393. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.d.ts +0 -0
  394. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/persistAsyncSchema/persistAsyncBlobSchema/index.d.ts +0 -0
  395. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/PromotedOneOfSchema.d.ts +0 -0
  396. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/index.d.ts +0 -0
  397. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promoted-one-of-utils.d.ts +0 -0
  398. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +0 -0
  399. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.d.ts +0 -0
  400. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.d.ts +0 -0
  401. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.d.ts +0 -0
  402. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/ReadOnlySchema.messages.d.ts +0 -0
  403. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/readOnlySchema/index.d.ts +0 -0
  404. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/SchemaFormControl.d.ts +0 -0
  405. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/index.d.ts +0 -0
  406. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/currency-utils.d.ts +0 -0
  407. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/index.d.ts +0 -0
  408. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/schemaFormControl/utils/mapping-utils.d.ts +0 -0
  409. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -0
  410. /package/build/{jsonSchemaForm → types/jsonSchemaForm}/validationAsyncSchema/index.d.ts +0 -0
  411. /package/build/{layout → types/layout}/DynamicLayout.d.ts +0 -0
  412. /package/build/{layout → types/layout}/alert/DynamicAlert.d.ts +0 -0
  413. /package/build/{layout → types/layout}/box/DynamicBox.d.ts +0 -0
  414. /package/build/{layout → types/layout}/button/DynamicButton.d.ts +0 -0
  415. /package/build/{layout → types/layout}/columns/DynamicColumns.d.ts +0 -0
  416. /package/build/{layout → types/layout}/decision/DynamicDecision.d.ts +0 -0
  417. /package/build/{layout → types/layout}/divider/DynamicDivider.d.ts +0 -0
  418. /package/build/{layout → types/layout}/external/DynamicExternal.d.ts +0 -0
  419. /package/build/{layout → types/layout}/external/DynamicExternal.messages.d.ts +0 -0
  420. /package/build/{layout → types/layout}/form/DynamicForm.d.ts +0 -0
  421. /package/build/{layout → types/layout}/heading/DynamicHeading.d.ts +0 -0
  422. /package/build/{layout → types/layout}/icon/DynamicIcon.d.ts +0 -0
  423. /package/build/{layout → types/layout}/image/DynamicImage.d.ts +0 -0
  424. /package/build/{layout → types/layout}/index.d.ts +0 -0
  425. /package/build/{layout → types/layout}/info/DynamicInfo.d.ts +0 -0
  426. /package/build/{layout → types/layout}/list/DynamicList.d.ts +0 -0
  427. /package/build/{layout → types/layout}/loadingIndicator/DynamicLoadingIndicator.d.ts +0 -0
  428. /package/build/{layout → types/layout}/paragraph/DynamicParagraph.d.ts +0 -0
  429. /package/build/{layout → types/layout}/paragraph/DynamicParagraph.messages.d.ts +0 -0
  430. /package/build/{layout → types/layout}/paragraph/useSnackBarIfAvailable.d.ts +0 -0
  431. /package/build/{layout → types/layout}/review/DynamicReview.d.ts +0 -0
  432. /package/build/{layout → types/layout}/utils.d.ts +0 -0
  433. /package/build/{step → types/step}/cameraStep/CameraStep.d.ts +0 -0
  434. /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.d.ts +0 -0
  435. /package/build/{step → types/step}/cameraStep/cameraCapture/CameraCapture.messages.d.ts +0 -0
  436. /package/build/{step → types/step}/cameraStep/cameraCapture/components/index.d.ts +0 -0
  437. /package/build/{step → types/step}/cameraStep/cameraCapture/hooks/index.d.ts +0 -0
  438. /package/build/{step → types/step}/cameraStep/cameraCapture/index.d.ts +0 -0
  439. /package/build/{step → types/step}/cameraStep/cameraCapture/overlay/Overlay.d.ts +0 -0
  440. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.d.ts +0 -0
  441. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.d.ts +0 -0
  442. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.d.ts +0 -0
  443. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.d.ts +0 -0
  444. /package/build/{step → types/step}/cameraStep/cameraCapture/screens/index.d.ts +0 -0
  445. /package/build/{step → types/step}/cameraStep/cameraCapture/tracking/index.d.ts +0 -0
  446. /package/build/{step → types/step}/cameraStep/cameraCapture/utils/index.d.ts +0 -0
  447. /package/build/{step → types/step}/cameraStep/index.d.ts +0 -0
  448. /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.d.ts +0 -0
  449. /package/build/{step → types/step}/externalConfirmationStep/ExternalConfirmationStep.messages.d.ts +0 -0
  450. /package/build/{step → types/step}/externalConfirmationStep/index.d.ts +0 -0
  451. /package/build/{step → types/step}/index.d.ts +0 -0
  452. /package/build/{step → types/step}/layoutStep/LayoutStep.d.ts +0 -0
  453. /package/build/{step → types/step}/layoutStep/index.d.ts +0 -0
  454. /package/build/{step → types/step}/layoutStep/utils/index.d.ts +0 -0
  455. /package/build/{step → types/step}/layoutStep/utils/inline-reference-utils.d.ts +0 -0
  456. /package/build/{step → types/step}/layoutStep/utils/layout-utils.d.ts +0 -0
  457. /package/build/types/{common → types/common}/FormControl.d.ts +0 -0
  458. /package/build/types/{specification → types/specification}/Action.d.ts +0 -0
  459. /package/build/types/{specification → types/specification}/FileUploadSchema.d.ts +0 -0
  460. /package/build/types/{specification → types/specification}/LayoutComponent.d.ts +0 -0
  461. /package/build/types/{specification → types/specification}/Model.d.ts +0 -0
  462. /package/build/types/{specification → types/specification}/PersistAsync.d.ts +0 -0
  463. /package/build/types/{specification → types/specification}/Polling.d.ts +0 -0
  464. /package/build/types/{specification → types/specification}/Promotion.d.ts +0 -0
  465. /package/build/types/{specification → types/specification}/Schema.d.ts +0 -0
  466. /package/build/types/{specification → types/specification}/Step.d.ts +0 -0
  467. /package/build/types/{specification → types/specification}/ValidationAsync.d.ts +0 -0
  468. /package/build/types/{specification → types/specification}/core.d.ts +0 -0
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.isValidIconName = void 0;
27
- const jsx_runtime_1 = require("react/jsx-runtime");
28
- const icons = __importStar(require("@transferwise/icons"));
29
- const DynamicIcon = ({ type }) => {
30
- const iconName = toCapitalisedCamelCase(type);
31
- if (!Object.keys(icons).includes(iconName)) {
32
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
33
- }
34
- const Icon = icons[iconName];
35
- return (0, jsx_runtime_1.jsx)(Icon, { size: 24 });
36
- };
37
- function toCapitalisedCamelCase(value) {
38
- return value.split('-').map(capitaliseFirstChar).join('');
39
- }
40
- function capitaliseFirstChar(value) {
41
- var _a;
42
- return `${(_a = value[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
43
- }
44
- function isValidIconName(name) {
45
- const iconName = toCapitalisedCamelCase(name);
46
- return Object.keys(icons).includes(iconName);
47
- }
48
- exports.isValidIconName = isValidIconName;
49
- exports.default = DynamicIcon;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const react_1 = require("react");
6
- const contexts_1 = require("../../common/contexts");
7
- const utils_1 = require("../../common/utils");
8
- const utils_2 = require("../utils");
9
- const DynamicImage = ({ component: image }) => {
10
- const { url, size, text, margin } = image;
11
- const fetcher = (0, contexts_1.useFetcher)();
12
- const [imageSource, setImageSource] = (0, react_1.useState)('');
13
- (0, react_1.useEffect)(() => {
14
- void getImageSource(fetcher, url).then(setImageSource);
15
- }, [url, fetcher]);
16
- const imageProps = {
17
- alt: text || '',
18
- src: imageSource,
19
- stretch: true,
20
- shrink: true,
21
- };
22
- if (!imageSource) {
23
- return null;
24
- }
25
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `df-image ${size || 'xl'}` }, { children: (0, jsx_runtime_1.jsx)(components_1.Image, Object.assign({ className: `img-responsive ${(0, utils_2.getMarginBottom)(margin || 'lg')}` }, imageProps)) })));
26
- };
27
- const readImageBlobAsDataURL = (imageBlob) => {
28
- // we can safely assume the type of reader.result is string
29
- // because we're calling reader.readAsDataURL
30
- // https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
31
- return new Promise((resolve, reject) => {
32
- const reader = new FileReader();
33
- reader.addEventListener('loadend', () => resolve(reader.result));
34
- reader.addEventListener('error', (error) => reject(error));
35
- reader.readAsDataURL(imageBlob);
36
- });
37
- };
38
- const getImageSource = async (fetcher, imageUrl) => {
39
- var _a;
40
- try {
41
- if ((0, utils_1.isRelativePath)(imageUrl) || (imageUrl === null || imageUrl === void 0 ? void 0 : imageUrl.indexOf(`${(_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin}/`)) === 0) {
42
- return fetcher(imageUrl, {
43
- method: 'GET',
44
- headers: { 'Content-Type': 'image/image' },
45
- credentials: 'same-origin',
46
- })
47
- .then((response) => {
48
- if (response.ok) {
49
- return response.blob();
50
- }
51
- throw new Error('Image fetching failed');
52
- })
53
- .then(readImageBlobAsDataURL)
54
- .catch(() => imageUrl);
55
- }
56
- return imageUrl;
57
- }
58
- catch (_b) {
59
- return imageUrl;
60
- }
61
- };
62
- exports.default = DynamicImage;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DynamicReview = exports.DynamicParagraph = exports.DynamicLoadingIndicator = exports.DynamicList = exports.DynamicLayout = exports.DynamicImage = exports.DynamicInfo = exports.DynamicIcon = exports.DynamicHeading = exports.DynamicForm = exports.DynamicExternal = exports.DynamicDivider = exports.DynamicDecision = exports.DynamicColumns = exports.DynamicButton = exports.DynamicBox = exports.DynamicAlert = void 0;
7
- var DynamicAlert_1 = require("./alert/DynamicAlert");
8
- Object.defineProperty(exports, "DynamicAlert", { enumerable: true, get: function () { return __importDefault(DynamicAlert_1).default; } });
9
- var DynamicBox_1 = require("./box/DynamicBox");
10
- Object.defineProperty(exports, "DynamicBox", { enumerable: true, get: function () { return __importDefault(DynamicBox_1).default; } });
11
- var DynamicButton_1 = require("./button/DynamicButton");
12
- Object.defineProperty(exports, "DynamicButton", { enumerable: true, get: function () { return __importDefault(DynamicButton_1).default; } });
13
- var DynamicColumns_1 = require("./columns/DynamicColumns");
14
- Object.defineProperty(exports, "DynamicColumns", { enumerable: true, get: function () { return __importDefault(DynamicColumns_1).default; } });
15
- var DynamicDecision_1 = require("./decision/DynamicDecision");
16
- Object.defineProperty(exports, "DynamicDecision", { enumerable: true, get: function () { return __importDefault(DynamicDecision_1).default; } });
17
- var DynamicDivider_1 = require("./divider/DynamicDivider");
18
- Object.defineProperty(exports, "DynamicDivider", { enumerable: true, get: function () { return __importDefault(DynamicDivider_1).default; } });
19
- var DynamicExternal_1 = require("./external/DynamicExternal");
20
- Object.defineProperty(exports, "DynamicExternal", { enumerable: true, get: function () { return __importDefault(DynamicExternal_1).default; } });
21
- var DynamicForm_1 = require("./form/DynamicForm");
22
- Object.defineProperty(exports, "DynamicForm", { enumerable: true, get: function () { return __importDefault(DynamicForm_1).default; } });
23
- var DynamicHeading_1 = require("./heading/DynamicHeading");
24
- Object.defineProperty(exports, "DynamicHeading", { enumerable: true, get: function () { return __importDefault(DynamicHeading_1).default; } });
25
- var DynamicIcon_1 = require("./icon/DynamicIcon");
26
- Object.defineProperty(exports, "DynamicIcon", { enumerable: true, get: function () { return __importDefault(DynamicIcon_1).default; } });
27
- var DynamicInfo_1 = require("./info/DynamicInfo");
28
- Object.defineProperty(exports, "DynamicInfo", { enumerable: true, get: function () { return __importDefault(DynamicInfo_1).default; } });
29
- var DynamicImage_1 = require("./image/DynamicImage");
30
- Object.defineProperty(exports, "DynamicImage", { enumerable: true, get: function () { return __importDefault(DynamicImage_1).default; } });
31
- var DynamicLayout_1 = require("./DynamicLayout");
32
- Object.defineProperty(exports, "DynamicLayout", { enumerable: true, get: function () { return __importDefault(DynamicLayout_1).default; } });
33
- var DynamicList_1 = require("./list/DynamicList");
34
- Object.defineProperty(exports, "DynamicList", { enumerable: true, get: function () { return __importDefault(DynamicList_1).default; } });
35
- var DynamicLoadingIndicator_1 = require("./loadingIndicator/DynamicLoadingIndicator");
36
- Object.defineProperty(exports, "DynamicLoadingIndicator", { enumerable: true, get: function () { return __importDefault(DynamicLoadingIndicator_1).default; } });
37
- var DynamicParagraph_1 = require("./paragraph/DynamicParagraph");
38
- Object.defineProperty(exports, "DynamicParagraph", { enumerable: true, get: function () { return __importDefault(DynamicParagraph_1).default; } });
39
- var DynamicReview_1 = require("./review/DynamicReview");
40
- Object.defineProperty(exports, "DynamicReview", { enumerable: true, get: function () { return __importDefault(DynamicReview_1).default; } });
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const utils_1 = require("../utils");
6
- const DynamicInfo = ({ component }) => {
7
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, utils_1.getTextAlignmentAndMargin)(component) }, { children: (0, jsx_runtime_1.jsx)(components_1.Markdown, Object.assign({ config: { link: { target: '_blank' } } }, { children: component.markdown })) })));
8
- };
9
- exports.default = DynamicInfo;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- /* eslint-disable @typescript-eslint/no-unsafe-return */
5
- const components_1 = require("@transferwise/components");
6
- const __1 = require("..");
7
- const utils_1 = require("../utils");
8
- const DynamicList = ({ component }) => {
9
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, utils_1.getMarginBottom)(component.margin || 'md') }, { children: [component.title ? (0, jsx_runtime_1.jsxs)("h4", Object.assign({ className: "m-b-2" }, { children: [" ", component.title, " "] })) : null, component.items.map(mapItemToSummary)] })));
10
- };
11
- function mapItemToSummary({ title, description, icon, status }) {
12
- const props = Object.assign(Object.assign({ key: `${title}/${description || ''}`, title,
13
- description }, ((icon === null || icon === void 0 ? void 0 : icon.name) ? { icon: (0, jsx_runtime_1.jsx)(__1.DynamicIcon, { type: icon.name }) } : {})), (status ? { status: statusMap[status] } : {}));
14
- return (0, jsx_runtime_1.jsx)(components_1.Summary, Object.assign({}, props));
15
- }
16
- const statusMap = {
17
- positive: 'done',
18
- warning: 'pending',
19
- neutral: 'notDone',
20
- };
21
- exports.default = DynamicList;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const utils_1 = require("../utils");
6
- const DynamicLoadingIndicator = ({ component }) => {
7
- const { margin, size = 'md' } = component;
8
- return ((0, jsx_runtime_1.jsx)(components_1.Loader, { size: size, classNames: {
9
- 'tw-loader': `tw-loader m-x-auto ${(0, utils_1.getMarginBottom)(margin)}`,
10
- }, "data-testid": "loading-indicator" }));
11
- };
12
- exports.default = DynamicLoadingIndicator;
@@ -1,30 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const components_1 = require("@transferwise/components");
8
- const react_intl_1 = require("react-intl");
9
- const utils_1 = require("../utils");
10
- const DynamicParagraph_messages_1 = __importDefault(require("./DynamicParagraph.messages"));
11
- const useSnackBarIfAvailable_1 = require("./useSnackBarIfAvailable");
12
- const DynamicParagraph = ({ component }) => component.control === 'copyable' ? ((0, jsx_runtime_1.jsx)(CopyableDynamicParagraph, { component: component })) : ((0, jsx_runtime_1.jsx)(BasicDynamicParagraph, { component: component }));
13
- const BasicDynamicParagraph = ({ component }) => ((0, jsx_runtime_1.jsxs)("p", Object.assign({ className: (0, utils_1.getTextAlignmentAndMargin)(component) }, { children: [" ", component.text, " "] })));
14
- const CopyableDynamicParagraph = ({ component }) => {
15
- const { formatMessage } = (0, react_intl_1.useIntl)();
16
- const createSnackbar = (0, useSnackBarIfAvailable_1.useSnackBarIfAvailable)();
17
- const { text } = component;
18
- const copy = () => {
19
- var _a;
20
- (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_1.default.copied) })).catch(noop);
21
- };
22
- const classNames = (0, utils_1.getTextAlignmentAndMargin)({ align: component.align, margin: 'sm' }) + ' form-control';
23
- return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: (0, utils_1.getTextAlignmentAndMargin)(component) }, { children: [(0, jsx_runtime_1.jsx)("input", { type: "text", className: classNames, value: text, readOnly: true,
24
- // eslint-disable-next-line react/forbid-dom-props
25
- style: { textOverflow: 'ellipsis' } }), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ block: true, onClick: copy }, { children: formatMessage(DynamicParagraph_messages_1.default.copy) }))] })));
26
- };
27
- function noop() {
28
- //
29
- }
30
- exports.default = DynamicParagraph;
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_intl_1 = require("react-intl");
4
- exports.default = (0, react_intl_1.defineMessages)({
5
- copy: {
6
- id: 'dynamicFlows.DynamicParagraph.copy',
7
- defaultMessage: 'Copy',
8
- description: 'Copy to clipboard button label.',
9
- },
10
- copied: {
11
- id: 'dynamicFlows.DynamicParagraph.copied',
12
- defaultMessage: 'Copied to clipboard',
13
- description: 'Appears in a snackbar when the copy operation succeeds.',
14
- },
15
- });
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useSnackBarIfAvailable = void 0;
4
- const components_1 = require("@transferwise/components");
5
- const react_1 = require("react");
6
- function useSnackBarIfAvailable() {
7
- const context = (0, react_1.useContext)(components_1.SnackbarContext);
8
- return context ? context.createSnackbar : noop;
9
- }
10
- exports.useSnackBarIfAvailable = useSnackBarIfAvailable;
11
- function noop() {
12
- //
13
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- const components_1 = require("@transferwise/components");
5
- const utils_1 = require("../utils");
6
- const mapFieldsToDefinitions = ({ label, value }, index) => {
7
- return { key: String(index), title: label, value };
8
- };
9
- const getReviewLayout = (orientation) => {
10
- return orientation === 'horizontal' ? 'HORIZONTAL_RIGHT_ALIGNED' : 'VERTICAL_ONE_COLUMN';
11
- };
12
- const DynamicReview = (props) => {
13
- const review = props.component;
14
- const margin = (0, utils_1.getMarginBottom)(review.margin || 'xs');
15
- const getReviewAction = (action) => {
16
- return ((0, jsx_runtime_1.jsx)("a", Object.assign({ href: action.url, className: "pull-right", role: "button", onClick: (event) => {
17
- event.preventDefault();
18
- props.onAction(action);
19
- } }, { children: action.title })));
20
- };
21
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [review.title && ((0, jsx_runtime_1.jsxs)("h6", Object.assign({ className: "m-b-2" }, { children: [review.title, review.action && getReviewAction(review.action)] }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: margin }, { children: (0, jsx_runtime_1.jsx)(components_1.DefinitionList, { layout: getReviewLayout(review.orientation), definitions: review.fields.map(mapFieldsToDefinitions) }) }))] }));
22
- };
23
- exports.default = DynamicReview;
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTextAlignmentAndMargin = exports.getMarginBottom = void 0;
4
- const getMarginBottom = (size) => {
5
- switch (size) {
6
- case 'xs':
7
- return 'm-b-0';
8
- case 'sm':
9
- return 'm-b-1';
10
- case 'md':
11
- return 'm-b-2';
12
- case 'lg':
13
- return 'm-b-3';
14
- case 'xl':
15
- return 'm-b-5';
16
- default:
17
- return '';
18
- }
19
- };
20
- exports.getMarginBottom = getMarginBottom;
21
- const getTextAlignment = (align) => {
22
- switch (align) {
23
- case 'right':
24
- return 'text-xs-right';
25
- case 'center':
26
- return 'text-xs-center';
27
- case 'left':
28
- default:
29
- return '';
30
- }
31
- };
32
- const getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMarginBottom(component.margin)}`;
33
- exports.getTextAlignmentAndMargin = getTextAlignmentAndMargin;
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const contexts_1 = require("../../common/contexts");
9
- const utils_1 = require("../../common/utils");
10
- const types_1 = require("../../types");
11
- const cameraCapture_1 = __importDefault(require("./cameraCapture"));
12
- function blobToBase64(blob) {
13
- return new Promise((resolve, _) => {
14
- // we can safely assume the type of reader.result is string
15
- // because we're calling reader.readAsDataURL
16
- // https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
17
- const reader = new FileReader();
18
- // eslint-disable-next-line fp/no-mutation
19
- reader.onloadend = () => resolve(reader.result);
20
- reader.readAsDataURL(blob);
21
- });
22
- }
23
- const CameraStep = (props) => {
24
- const { step, model, onModelChange, onAction } = props;
25
- const onEvent = (0, contexts_1.useEventDispatcher)();
26
- const objectSchema = getObjectSchema(step);
27
- const cameraSchema = getCameraSchema(step);
28
- const action = getFirstAction(step);
29
- const { title, image, cameraConfig } = cameraSchema;
30
- const { assets, direction, instructions } = cameraConfig || {};
31
- const { overlay, outline } = assets || {};
32
- const { url: imageUrl } = image || {};
33
- const [captureClicked, setCaptureClicked] = (0, react_1.useState)(false);
34
- // We need to wait for model to update before we call onAction()
35
- (0, react_1.useEffect)(() => {
36
- if (captureClicked) {
37
- onAction(action);
38
- }
39
- }, [model]);
40
- const handleCapture = async (blob) => {
41
- const { $id } = cameraSchema;
42
- if (blob) {
43
- const newValue = await blobToBase64(blob);
44
- const newModel = { [$id || '']: newValue };
45
- setCaptureClicked(true);
46
- onModelChange({
47
- model: newModel,
48
- formSchema: objectSchema,
49
- triggerModel: newValue,
50
- triggerSchema: cameraSchema,
51
- });
52
- }
53
- };
54
- return ((0, jsx_runtime_1.jsx)(cameraCapture_1.default, { overlay: overlay, outline: outline, title: title, imageUrl: imageUrl, instructions: instructions, direction: direction, onEvent: onEvent, onCapture: (blob) => {
55
- void handleCapture(blob);
56
- } }));
57
- };
58
- exports.default = CameraStep;
59
- function getObjectSchema(step) {
60
- const nonHiddenSchemas = (0, utils_1.filterHiddenSchemas)(step.schemas || []);
61
- const objectSchema = nonHiddenSchemas[0];
62
- if (!objectSchema || !(0, types_1.isObjectSchema)(objectSchema)) {
63
- throw new Error('The first schema in a camera step is expected to be of type object and have at least one property with a schema...');
64
- }
65
- return objectSchema;
66
- }
67
- function getCameraSchema(step) {
68
- const objectSchema = getObjectSchema(step);
69
- const firstProperty = Object.values(objectSchema.properties)[0];
70
- if (!firstProperty) {
71
- throw new Error('The first schema in a camera step is expected to be of type object and have at least one property with a schema...');
72
- }
73
- return firstProperty;
74
- }
75
- function getFirstAction(step) {
76
- var _a, _b;
77
- if (!step.schemas || ((_a = (0, utils_1.filterHiddenSchemas)(step.schemas)) === null || _a === void 0 ? void 0 : _a.length) !== 1) {
78
- throw new Error('camera step expects 1 non-hidden object schema');
79
- }
80
- if (((_b = step === null || step === void 0 ? void 0 : step.actions) === null || _b === void 0 ? void 0 : _b.length) !== 1) {
81
- throw new Error('camera step expects 1 action');
82
- }
83
- return step.actions[0];
84
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const jsx_runtime_1 = require("react/jsx-runtime");
7
- const react_1 = require("react");
8
- const react_intl_1 = require("react-intl");
9
- const react_webcam_1 = __importDefault(require("react-webcam"));
10
- const CameraCapture_messages_1 = __importDefault(require("./CameraCapture.messages"));
11
- const components_1 = require("./components");
12
- const hooks_1 = require("./hooks");
13
- const Overlay_1 = __importDefault(require("./overlay/Overlay"));
14
- const screens_1 = require("./screens");
15
- const tracking_1 = require("./tracking");
16
- const utils_1 = require("./utils");
17
- const CameraCapture = ({ direction = 'back', overlay = '', outline = '', imageUrl = '', title = '', instructions = '', showReview = false, onCapture, onEvent, }) => {
18
- const [mode, setMode] = (0, react_1.useState)('CAPTURE');
19
- const [isVideoMirrored, setIsVideoMirrored] = (0, react_1.useState)(false);
20
- const [ready, setReady] = (0, react_1.useState)(false);
21
- const [reviewImage, setReviewImage] = (0, react_1.useState)();
22
- const webcamReference = (0, react_1.useRef)(null);
23
- const { videoConstraints } = (0, hooks_1.useVideoConstraints)(direction);
24
- const intl = (0, react_intl_1.useIntl)();
25
- const handleCapture = (0, react_1.useCallback)(async () => {
26
- var _a, _b, _c, _d, _e, _f;
27
- if (((_a = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _a === void 0 ? void 0 : _a.video) && ((_c = (_b = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _b === void 0 ? void 0 : _b.video) === null || _c === void 0 ? void 0 : _c.readyState) >= 3) {
28
- (_e = (_d = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _d === void 0 ? void 0 : _d.video) === null || _e === void 0 ? void 0 : _e.pause();
29
- const canvas = await (0, utils_1.generateCanvasFromVideo)((_f = webcamReference === null || webcamReference === void 0 ? void 0 : webcamReference.current) === null || _f === void 0 ? void 0 : _f.video);
30
- canvas === null || canvas === void 0 ? void 0 : canvas.toBlob((blob) => {
31
- if (blob) {
32
- if (showReview) {
33
- const source = window.URL.createObjectURL(blob);
34
- setReviewImage({ source, blob });
35
- setMode('REVIEW');
36
- }
37
- else {
38
- onCapture(blob);
39
- }
40
- }
41
- }, 'image/jpeg', 0.92);
42
- }
43
- }, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
44
- const handleUserMediaError = (0, react_1.useCallback)((error) => {
45
- if (error instanceof DOMException && (error === null || error === void 0 ? void 0 : error.name) === 'NotAllowedError') {
46
- setMode('NO_CAMERA_ACCESS');
47
- (0, tracking_1.trackCameraPermissionDenied)(onEvent);
48
- return;
49
- }
50
- setMode('CAMERA_NOT_SUPPORTED');
51
- (0, tracking_1.trackCameraNotSupported)(onEvent, error);
52
- }, [setMode, onEvent]);
53
- const handleUserMedia = (0, react_1.useCallback)((stream) => {
54
- setReady(true);
55
- setIsVideoMirrored((0, utils_1.isSelfieCamera)(stream));
56
- void (0, tracking_1.trackCameraFeedStarted)(onEvent, { direction }, stream);
57
- }, [setIsVideoMirrored, onEvent, direction]);
58
- const handleReviewSubmit = () => {
59
- onCapture((reviewImage === null || reviewImage === void 0 ? void 0 : reviewImage.blob) || null);
60
- };
61
- const handleReviewRetry = () => {
62
- setMode('CAPTURE');
63
- setReviewImage(undefined);
64
- };
65
- const handleRetryCameraAccess = () => setMode('CAPTURE');
66
- const captureScreen = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [videoConstraints && ((0, jsx_runtime_1.jsx)(react_webcam_1.default, { ref: webcamReference, audio: false, videoConstraints: videoConstraints, mirrored: isVideoMirrored, onUserMediaError: handleUserMediaError, onUserMedia: handleUserMedia })), (0, jsx_runtime_1.jsx)(Overlay_1.default, { overlay: overlay, outline: outline, imageUrl: imageUrl, title: title, instructions: instructions }), ready && (0, jsx_runtime_1.jsx)(components_1.CaptureBottomBar, { onCapture: () => void handleCapture() })] }));
67
- const reviewScreen = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("img", { className: "review-image", src: reviewImage === null || reviewImage === void 0 ? void 0 : reviewImage.source, alt: "" }), (0, jsx_runtime_1.jsx)(Overlay_1.default, { overlay: overlay, imageUrl: imageUrl, title: title, instructions: instructions, reviewInstructions: intl.formatMessage(CameraCapture_messages_1.default.reviewInstructions) }), (0, jsx_runtime_1.jsx)(components_1.ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })] }));
68
- return ((0, jsx_runtime_1.jsxs)("section", Object.assign({ className: "camera-capture" }, { children: [mode === 'CAPTURE' && captureScreen, mode === 'REVIEW' && reviewScreen, mode === 'NO_CAMERA_ACCESS' && (0, jsx_runtime_1.jsx)(screens_1.NoCameraAccess, { onAction: handleRetryCameraAccess }), mode === 'CAMERA_NOT_SUPPORTED' && (0, jsx_runtime_1.jsx)(screens_1.CameraNotSupported, {})] })));
69
- };
70
- exports.default = CameraCapture;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const react_intl_1 = require("react-intl");
4
- exports.default = (0, react_intl_1.defineMessages)({
5
- reviewSubmit: {
6
- id: 'dynamicFlows.CameraCapture.reviewSubmit',
7
- defaultMessage: 'Yes, submit',
8
- description: 'Accept and submit the image taken with the camera',
9
- },
10
- reviewRetry: {
11
- id: 'dynamicFlows.CameraCapture.reviewRetry',
12
- defaultMessage: 'No, try again',
13
- description: "Image taken with camera is not good, don't submit, and retake the image",
14
- },
15
- reviewInstructions: {
16
- id: 'dynamicFlows.CameraCapture.reviewInstructions',
17
- defaultMessage: 'Is your picture clear, readable and complete?',
18
- description: 'After taking an image with the camera, prompt user to review the image',
19
- },
20
- });
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ReviewBottomBar = exports.CaptureBottomBar = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const components_1 = require("@transferwise/components");
9
- const react_intl_1 = require("react-intl");
10
- const CameraCapture_messages_1 = __importDefault(require("../CameraCapture.messages"));
11
- const CaptureBottomBar = ({ onCapture }) => ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "bottom-bar" }, { children: (0, jsx_runtime_1.jsx)(CaptureButton, { onClick: onCapture }) })));
12
- exports.CaptureBottomBar = CaptureBottomBar;
13
- const ReviewBottomBar = ({ onSubmit, onRetry, }) => {
14
- const intl = (0, react_intl_1.useIntl)();
15
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "bottom-bar p-x-2" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "row" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "col-xs-12 col-md-6 col-md-offset-3" }, { children: [(0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ className: "m-b-1", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, onClick: onSubmit }, { children: intl.formatMessage(CameraCapture_messages_1.default.reviewSubmit) })), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ className: "m-b-2", block: true, size: components_1.Size.MEDIUM, type: components_1.ControlType.ACCENT, priority: components_1.Priority.SECONDARY, onClick: onRetry }, { children: intl.formatMessage(CameraCapture_messages_1.default.reviewRetry) }))] })) })) })));
16
- };
17
- exports.ReviewBottomBar = ReviewBottomBar;
18
- const CaptureButton = ({ onClick }) => ((0, jsx_runtime_1.jsx)("button", Object.assign({ type: "button", className: "camera-capture-btn m-b-2", "data-testid": "camera-capture-button", onClick: onClick }, { children: (0, jsx_runtime_1.jsx)("span", { className: "camera-capture-btn-inner" }) })));
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useVideoConstraints = void 0;
4
- const react_1 = require("react");
5
- const utils_1 = require("../utils");
6
- const useVideoConstraints = (direction) => {
7
- const [videoConstraints, setVideoConstraints] = (0, react_1.useState)();
8
- const defaultVideoConstraints = {
9
- facingMode: direction === 'front' ? 'user' : 'environment',
10
- height: { min: 480, max: 1080, ideal: 720 },
11
- width: { min: 640, max: 1920, ideal: 1280 },
12
- frameRate: 30,
13
- aspectRatio: 16 / 9,
14
- };
15
- (0, react_1.useEffect)(() => {
16
- void getVideoConstraints(direction).then(setVideoConstraints);
17
- }, [direction]);
18
- const getVideoConstraints = async (direction) => {
19
- if (direction === 'back') {
20
- const mainCamera = (await (0, utils_1.getAvailableVideoDevices)()).find(utils_1.isMainBackCamera);
21
- if (mainCamera === null || mainCamera === void 0 ? void 0 : mainCamera.deviceId) {
22
- return Object.assign(Object.assign({}, defaultVideoConstraints), { deviceId: { exact: mainCamera.deviceId } });
23
- }
24
- }
25
- return defaultVideoConstraints;
26
- };
27
- return { videoConstraints };
28
- };
29
- exports.useVideoConstraints = useVideoConstraints;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var CameraCapture_1 = require("./CameraCapture");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CameraCapture_1).default; } });
@@ -1,68 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- /* eslint-disable fp/no-mutation */
5
- const react_1 = require("react");
6
- const debounce_1 = require("../../../../common/utils/debounce");
7
- const captureButtonHeight = 92;
8
- const reviewButtonsHeight = 120;
9
- const imageHeight = 40;
10
- const titleHeight = 32;
11
- const instructionsHeight = 48;
12
- const reviewInstructionsHeight = 40;
13
- const overlayMaxWidth = 800;
14
- const Overlay = ({ overlay, outline, imageUrl, title, instructions, reviewInstructions, }) => {
15
- const svgReference = (0, react_1.useRef)(null);
16
- /*
17
- SVG doesn't always rerender when screen orientation changes,
18
- so need to force rerender
19
- */
20
- (0, react_1.useEffect)(() => {
21
- const listener = (0, debounce_1.debounce)(() => {
22
- var _a;
23
- if ((_a = svgReference.current) === null || _a === void 0 ? void 0 : _a.innerHTML) {
24
- const reference = svgReference.current;
25
- reference.innerHTML += '';
26
- }
27
- }, 100);
28
- window.addEventListener('resize', listener);
29
- return () => window.removeEventListener('resize', listener);
30
- });
31
- let helperBoxHeight = (imageUrl ? imageHeight : 0) +
32
- (title ? titleHeight : 0) +
33
- (instructions ? instructionsHeight : 0);
34
- let helperBox = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [imageUrl && (0, jsx_runtime_1.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }), title && (0, jsx_runtime_1.jsx)("h4", Object.assign({ className: "camera-capture-title" }, { children: title })), instructions && (0, jsx_runtime_1.jsx)("small", Object.assign({ className: "camera-capture-instructions" }, { children: instructions }))] }));
35
- const frameBottomMargin = captureButtonHeight + helperBoxHeight;
36
- /*
37
- frameBottomMargin needs to stay the same for the review page so that
38
- the overlay position does not change! Basically if it is the review step
39
- and there is a 'reviewInstructions' specified, the overlay position stays
40
- the same, but the helperBox height and content changes to adjust for the
41
- large review buttons and smaller height required by 'reviewInstructionsHeight'
42
- */
43
- if (reviewInstructions) {
44
- helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
45
- helperBox = (0, jsx_runtime_1.jsx)("small", Object.assign({ className: "camera-capture-instructions" }, { children: reviewInstructions }));
46
- const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
47
- if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
48
- helperBox = (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
49
- }
50
- }
51
- const framePosition = {
52
- x: '50%',
53
- y: '5%',
54
- width: `min(90%, ${overlayMaxWidth}px)`,
55
- height: `calc(90% - ${frameBottomMargin}px)`,
56
- style: { transform: `translateX(max(-45%, -${overlayMaxWidth / 2}px))` },
57
- };
58
- const helperBoxPosition = {
59
- style: {
60
- left: '5%',
61
- top: `calc(100% - ${frameBottomMargin}px - 5%)`,
62
- height: `calc(${helperBoxHeight}px + 5%)`,
63
- width: '90%',
64
- },
65
- };
66
- return ((0, jsx_runtime_1.jsxs)("svg", Object.assign({ ref: svgReference, xmlns: "http://www.w3.org/2000/svg" }, { children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("mask", Object.assign({ id: "mask" }, { children: [(0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }), (0, jsx_runtime_1.jsx)("image", Object.assign({ href: overlay }, framePosition))] })) }), overlay && (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }), outline && (0, jsx_runtime_1.jsx)("image", Object.assign({ href: outline }, framePosition)), (0, jsx_runtime_1.jsx)("foreignObject", Object.assign({ width: "100%", height: "100%" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "camera-capture-text-and-image-container" }, helperBoxPosition, { children: helperBox })) }))] })));
67
- };
68
- exports.default = Overlay;