@wise/dynamic-flow-client 0.4.0 → 0.4.2

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 (233) hide show
  1. package/build/common/constants/DateMode.js +2 -2
  2. package/build/common/constants/FormControlType.js +2 -2
  3. package/build/common/constants/MonthFormat.js +2 -2
  4. package/build/common/constants/SchemaType.js +2 -2
  5. package/build/common/constants/Size.js +2 -2
  6. package/build/common/constants/index.js +1 -1
  7. package/build/common/contexts/dynamicFlowContexts/DynamicFlowContexts.js +15 -27
  8. package/build/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.js +11 -9
  9. package/build/common/contexts/eventsContext/EventsContext.js +11 -28
  10. package/build/common/contexts/fetcherContexts/FetcherContexts.js +14 -27
  11. package/build/common/contexts/index.js +1 -1
  12. package/build/common/contexts/logContext/LogContext.js +12 -30
  13. package/build/common/hooks/index.js +1 -1
  14. package/build/common/hooks/useDebouncedFunction/useDebouncedFunction.js +3 -3
  15. package/build/common/hooks/useExternal/useExternal.js +8 -8
  16. package/build/common/hooks/useExternalStepPolling/useExternalStepPolling.js +20 -31
  17. package/build/common/hooks/usePersistAsync/usePersistAsync.js +60 -139
  18. package/build/common/hooks/usePolling/usePolling.js +20 -21
  19. package/build/common/hooks/usePrevious/usePrevious.js +5 -5
  20. package/build/common/hooks/useStepPolling/useStepPolling.js +15 -14
  21. package/build/common/makeFetcher/index.js +1 -1
  22. package/build/common/makeFetcher/makeFetcher.js +10 -24
  23. package/build/common/messages.js +5 -5
  24. package/build/common/utils/api-utils.js +3 -4
  25. package/build/common/utils/date-utils.js +11 -11
  26. package/build/common/utils/debounce.js +11 -15
  27. package/build/common/utils/file-utils.js +12 -25
  28. package/build/common/utils/id-utils.js +4 -5
  29. package/build/common/utils/index.js +1 -1
  30. package/build/common/utils/is-equal.js +8 -8
  31. package/build/common/utils/schema-utils.js +6 -6
  32. package/build/common/utils/step-utils.js +14 -14
  33. package/build/common/validators/index.js +7 -7
  34. package/build/common/validators/models/model-validators.js +8 -8
  35. package/build/common/validators/models/models.utils.js +29 -42
  36. package/build/common/validators/schemas/schema-validators.js +11 -13
  37. package/build/common/validators/types/type-validators.js +9 -13
  38. package/build/common/validators/validationFailures/validation-failures.js +14 -14
  39. package/build/common/validators/validationFailures/validation-failures.utils.js +5 -7
  40. package/build/common/validators/values/value-validators.js +4 -6
  41. package/build/dynamicFlow/DynamicFlow.js +185 -307
  42. package/build/dynamicFlow/DynamicFlowStep.js +12 -23
  43. package/build/dynamicFlow/DynamicFlowTypes.js +1 -1
  44. package/build/dynamicFlow/index.js +6 -14
  45. package/build/dynamicFlow/stories/DynamicFlow.story.js +20 -20
  46. package/build/dynamicFlow/stories/EditableDynamicFlow.js +20 -33
  47. package/build/dynamicFlow/stories/fixtureFetcher.js +46 -104
  48. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.js +22 -40
  49. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.js +6 -6
  50. package/build/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.js +10 -11
  51. package/build/dynamicFlow/utils/index.js +5 -2
  52. package/build/dynamicFlow/utils/responseParsers/response-parsers.js +53 -118
  53. package/build/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.js +9 -9
  54. package/build/dynamicFlow/utils/useDynamicFlowState.js +51 -74
  55. package/build/dynamicFlow/utils/useLoader.js +9 -20
  56. package/build/fixtures/components/alert.js +8 -8
  57. package/build/fixtures/components/box.js +7 -7
  58. package/build/fixtures/components/button.js +25 -36
  59. package/build/fixtures/components/columns.js +10 -10
  60. package/build/fixtures/components/copyable.js +6 -6
  61. package/build/fixtures/components/decision.js +15 -15
  62. package/build/fixtures/components/heading.js +7 -7
  63. package/build/fixtures/components/image.js +10 -10
  64. package/build/fixtures/components/index.js +17 -25
  65. package/build/fixtures/components/info.js +22 -6
  66. package/build/fixtures/components/list.js +8 -8
  67. package/build/fixtures/components/loading-indicator.js +5 -5
  68. package/build/fixtures/components/paragraph.js +9 -9
  69. package/build/fixtures/components/review.js +11 -11
  70. package/build/fixtures/examples/camera-capture.js +29 -29
  71. package/build/fixtures/examples/index.js +9 -17
  72. package/build/fixtures/examples/recipient-update.js +69 -69
  73. package/build/fixtures/examples/recipient.js +63 -63
  74. package/build/fixtures/examples/single-file-upload.js +21 -21
  75. package/build/fixtures/examples/step-validation-errors.js +21 -21
  76. package/build/fixtures/features/action-response.js +8 -8
  77. package/build/fixtures/features/external.js +8 -8
  78. package/build/fixtures/features/index.js +9 -17
  79. package/build/fixtures/features/persist-async.js +11 -11
  80. package/build/fixtures/features/polling.js +9 -9
  81. package/build/fixtures/features/validation-async.js +10 -10
  82. package/build/fixtures/index.js +11 -22
  83. package/build/fixtures/jsonSchemaForm/allOf.js +30 -30
  84. package/build/fixtures/jsonSchemaForm/audRecipient.js +271 -271
  85. package/build/fixtures/jsonSchemaForm/currency.js +12 -12
  86. package/build/fixtures/jsonSchemaForm/multipleFileUploadBase64.js +11 -11
  87. package/build/fixtures/jsonSchemaForm/multipleFileUploadBlob.js +11 -11
  88. package/build/fixtures/jsonSchemaForm/oneOf.js +27 -27
  89. package/build/fixtures/jsonSchemaForm/oneOfTabs.js +16 -16
  90. package/build/fixtures/jsonSchemaForm/promotedOneOf.js +17 -17
  91. package/build/fixtures/jsonSchemaForm/promotedOneOfCheckbox.js +30 -30
  92. package/build/fixtures/jsonSchemaForm/simple.js +16 -16
  93. package/build/fixtures/jsonSchemaForm/uploadPersistAsync.js +19 -19
  94. package/build/fixtures/jsonSchemaForm/validationAsync.js +8 -8
  95. package/build/fixtures/layouts/all.js +37 -37
  96. package/build/fixtures/layouts/final-step-layout.js +9 -9
  97. package/build/fixtures/layouts/index.js +10 -18
  98. package/build/fixtures/layouts/list.js +10 -10
  99. package/build/fixtures/layouts/pay-in.js +23 -23
  100. package/build/fixtures/layouts/review.js +38 -38
  101. package/build/fixtures/layouts/success.js +15 -15
  102. package/build/fixtures/responses/action-response-final.js +8 -8
  103. package/build/fixtures/responses/action.js +3 -3
  104. package/build/fixtures/responses/exit.js +3 -3
  105. package/build/fixtures/responses/index.js +8 -16
  106. package/build/fixtures/responses/recipient-update-final.js +8 -8
  107. package/build/fixtures/schemas/basic-form.js +11 -11
  108. package/build/fixtures/schemas/index.js +8 -16
  109. package/build/fixtures/schemas/number-and-integer.js +11 -11
  110. package/build/fixtures/schemas/one-of.js +43 -46
  111. package/build/fixtures/schemas/string-formats.js +15 -15
  112. package/build/fixtures/utils/image-util.js +8 -8
  113. package/build/formControl/FormControl.js +118 -148
  114. package/build/formControl/index.js +6 -14
  115. package/build/formControl/utils/index.js +1 -1
  116. package/build/formControl/utils/value-utils.js +18 -23
  117. package/build/i18n/index.js +31 -31
  118. package/build/index.js +13 -10
  119. package/build/jsonSchemaForm/JsonSchemaForm.js +12 -24
  120. package/build/jsonSchemaForm/allOfSchema/AllOfSchema.js +24 -37
  121. package/build/jsonSchemaForm/allOfSchema/index.js +6 -14
  122. package/build/jsonSchemaForm/arrayTypeSchema/ArraySchema.js +9 -20
  123. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.js +9 -20
  124. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/index.js +6 -14
  125. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.js +56 -115
  126. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.js +7 -7
  127. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/index.js +6 -14
  128. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/index.js +1 -1
  129. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/upload-utils.js +19 -71
  130. package/build/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/utils/useFormattedDefaultErrorMessages.js +10 -11
  131. package/build/jsonSchemaForm/arrayTypeSchema/index.js +6 -14
  132. package/build/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.js +45 -62
  133. package/build/jsonSchemaForm/basicTypeSchema/index.js +6 -14
  134. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.js +39 -50
  135. package/build/jsonSchemaForm/controlFeedback/ControlFeedback.messages.js +18 -18
  136. package/build/jsonSchemaForm/controlFeedback/index.js +6 -14
  137. package/build/jsonSchemaForm/genericSchema/GenericSchema.js +52 -61
  138. package/build/jsonSchemaForm/genericSchema/index.js +6 -14
  139. package/build/jsonSchemaForm/help/Help.js +9 -9
  140. package/build/jsonSchemaForm/help/Help.messages.js +5 -5
  141. package/build/jsonSchemaForm/help/index.js +6 -14
  142. package/build/jsonSchemaForm/index.js +6 -14
  143. package/build/jsonSchemaForm/objectSchema/ObjectSchema.js +28 -49
  144. package/build/jsonSchemaForm/objectSchema/index.js +6 -14
  145. package/build/jsonSchemaForm/oneOfSchema/OneOfSchema.js +54 -74
  146. package/build/jsonSchemaForm/oneOfSchema/index.js +6 -14
  147. package/build/jsonSchemaForm/oneOfSchema/utils/const-schema-utils.js +3 -3
  148. package/build/jsonSchemaForm/oneOfSchema/utils/index.js +1 -1
  149. package/build/jsonSchemaForm/oneOfSchema/utils/one-of-utils.js +19 -20
  150. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.js +11 -22
  151. package/build/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js +5 -5
  152. package/build/jsonSchemaForm/persistAsyncSchema/index.js +6 -14
  153. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.js +73 -127
  154. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/index.js +6 -14
  155. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.js +45 -110
  156. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.js +17 -17
  157. package/build/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/index.js +6 -14
  158. package/build/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.js +28 -47
  159. package/build/jsonSchemaForm/promotedOneOfSchema/index.js +6 -14
  160. package/build/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.js +4 -4
  161. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.js +13 -24
  162. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.js +11 -22
  163. package/build/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.js +12 -23
  164. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.js +24 -26
  165. package/build/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js +6 -6
  166. package/build/jsonSchemaForm/readOnlySchema/index.js +6 -14
  167. package/build/jsonSchemaForm/schemaFormControl/SchemaFormControl.js +26 -39
  168. package/build/jsonSchemaForm/schemaFormControl/index.js +6 -14
  169. package/build/jsonSchemaForm/schemaFormControl/utils/currency-utils.js +5 -5
  170. package/build/jsonSchemaForm/schemaFormControl/utils/index.js +1 -1
  171. package/build/jsonSchemaForm/schemaFormControl/utils/mapping-utils.js +30 -47
  172. package/build/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.js +57 -119
  173. package/build/jsonSchemaForm/validationAsyncSchema/index.js +6 -14
  174. package/build/layout/DynamicLayout.js +10 -21
  175. package/build/layout/alert/DynamicAlert.js +9 -9
  176. package/build/layout/box/DynamicBox.js +12 -23
  177. package/build/layout/button/DynamicButton.js +16 -27
  178. package/build/layout/columns/DynamicColumns.js +13 -24
  179. package/build/layout/decision/DynamicDecision.js +16 -27
  180. package/build/layout/divider/DynamicDivider.js +7 -8
  181. package/build/layout/external/DynamicExternal.js +16 -28
  182. package/build/layout/external/DynamicExternal.messages.js +5 -5
  183. package/build/layout/form/DynamicForm.js +10 -21
  184. package/build/layout/heading/DynamicHeading.js +12 -23
  185. package/build/layout/icon/DynamicIcon.js +9 -10
  186. package/build/layout/image/DynamicImage.js +43 -93
  187. package/build/layout/index.js +21 -29
  188. package/build/layout/info/DynamicInfo.js +7 -19
  189. package/build/layout/list/DynamicList.js +14 -26
  190. package/build/layout/loadingIndicator/DynamicLoadingIndicator.js +8 -9
  191. package/build/layout/paragraph/DynamicParagraph.js +19 -37
  192. package/build/layout/paragraph/DynamicParagraph.messages.js +6 -6
  193. package/build/layout/paragraph/useSnackBarIfAvailable.js +4 -4
  194. package/build/layout/review/DynamicReview.js +14 -26
  195. package/build/layout/utils.js +4 -6
  196. package/build/step/cameraStep/CameraStep.js +42 -88
  197. package/build/step/cameraStep/cameraCapture/CameraCapture.js +48 -105
  198. package/build/step/cameraStep/cameraCapture/CameraCapture.messages.js +7 -7
  199. package/build/step/cameraStep/cameraCapture/components/index.js +10 -28
  200. package/build/step/cameraStep/cameraCapture/hooks/index.js +17 -72
  201. package/build/step/cameraStep/cameraCapture/index.js +6 -14
  202. package/build/step/cameraStep/cameraCapture/overlay/Overlay.js +33 -45
  203. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.js +8 -19
  204. package/build/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.js +6 -6
  205. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.js +9 -21
  206. package/build/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.js +7 -7
  207. package/build/step/cameraStep/cameraCapture/screens/index.js +6 -14
  208. package/build/step/cameraStep/cameraCapture/tracking/index.js +17 -99
  209. package/build/step/cameraStep/cameraCapture/utils/index.js +33 -96
  210. package/build/step/cameraStep/index.js +6 -14
  211. package/build/step/externalConfirmationStep/ExternalConfirmationStep.js +20 -21
  212. package/build/step/externalConfirmationStep/ExternalConfirmationStep.messages.js +8 -8
  213. package/build/step/externalConfirmationStep/index.js +6 -14
  214. package/build/step/index.js +7 -15
  215. package/build/step/layoutStep/LayoutStep.js +19 -19
  216. package/build/step/layoutStep/index.js +6 -14
  217. package/build/step/layoutStep/utils/index.js +3 -14
  218. package/build/step/layoutStep/utils/inline-reference-utils.js +29 -46
  219. package/build/step/layoutStep/utils/layout-utils.js +34 -53
  220. package/build/types/common/FormControl.js +1 -1
  221. package/build/types/index.js +13 -13
  222. package/build/types/specification/Action.js +1 -1
  223. package/build/types/specification/FileUploadSchema.js +1 -1
  224. package/build/types/specification/LayoutComponent.js +1 -1
  225. package/build/types/specification/Model.js +9 -17
  226. package/build/types/specification/PersistAsync.js +1 -1
  227. package/build/types/specification/Polling.js +1 -1
  228. package/build/types/specification/Promotion.js +1 -1
  229. package/build/types/specification/Schema.js +8 -8
  230. package/build/types/specification/Step.js +3 -5
  231. package/build/types/specification/ValidationAsync.js +1 -1
  232. package/build/types/specification/core.js +1 -1
  233. package/package.json +1 -1
@@ -1,40 +1,29 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- exports.__esModule = true;
14
- var jsx_runtime_1 = require("react/jsx-runtime");
15
- var components_1 = require("@transferwise/components");
16
- var __1 = require("..");
17
- var utils_1 = require("../utils");
18
- var getMedia = function (option) {
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 __1 = require("..");
6
+ const utils_1 = require("../utils");
7
+ const getMedia = (option) => {
19
8
  var _a, _b, _c;
20
9
  if ((_a = option.icon) === null || _a === void 0 ? void 0 : _a.name) {
21
- return ((0, jsx_runtime_1.jsx)(components_1.Avatar, __assign({ type: components_1.AvatarType.ICON }, { children: (0, jsx_runtime_1.jsx)(__1.DynamicIcon, { type: option.icon.name }) })));
10
+ return ((0, jsx_runtime_1.jsx)(components_1.Avatar, Object.assign({ type: components_1.AvatarType.ICON }, { children: (0, jsx_runtime_1.jsx)(__1.DynamicIcon, { type: option.icon.name }) })));
22
11
  }
23
12
  if ((_b = option.icon) === null || _b === void 0 ? void 0 : _b.text) {
24
- return (0, jsx_runtime_1.jsx)(components_1.Avatar, __assign({ type: components_1.AvatarType.INITIALS }, { children: option.icon.text }));
13
+ return (0, jsx_runtime_1.jsx)(components_1.Avatar, Object.assign({ type: components_1.AvatarType.INITIALS }, { children: option.icon.text }));
25
14
  }
26
15
  if ((_c = option.image) === null || _c === void 0 ? void 0 : _c.url) {
27
- var _d = option.image, url = _d.url, text = _d.text;
16
+ const { url, text } = option.image;
28
17
  return (0, jsx_runtime_1.jsx)("img", { src: url, alt: text });
29
18
  }
30
19
  return undefined;
31
20
  };
32
- var DynamicDecision = function (props) {
33
- var decision = props.component;
34
- var renderDecisionOption = function (option, onAction) {
35
- var media = getMedia(option);
36
- return ((0, jsx_runtime_1.jsx)(components_1.NavigationOption, { title: option.title, content: option.description, disabled: option.disabled, media: media, showMediaCircle: false, showMediaAtAllSizes: true, onClick: function () { return onAction(option.action); } }, JSON.stringify(option)));
21
+ const DynamicDecision = (props) => {
22
+ const decision = props.component;
23
+ const renderDecisionOption = (option, onAction) => {
24
+ const media = getMedia(option);
25
+ return ((0, jsx_runtime_1.jsx)(components_1.NavigationOption, { title: option.title, content: option.description, disabled: option.disabled, media: media, showMediaCircle: false, showMediaAtAllSizes: true, onClick: () => onAction(option.action) }, JSON.stringify(option)));
37
26
  };
38
- return ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, utils_1.getMarginBottom)(decision.margin) }, { children: (0, jsx_runtime_1.jsx)(components_1.NavigationOptionsList, { children: decision.options.map(function (option) { return renderDecisionOption(option, props.onAction); }) }) })));
27
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, utils_1.getMarginBottom)(decision.margin) }, { children: (0, jsx_runtime_1.jsx)(components_1.NavigationOptionsList, { children: decision.options.map((option) => renderDecisionOption(option, props.onAction)) }) })));
39
28
  };
40
- exports["default"] = DynamicDecision;
29
+ exports.default = DynamicDecision;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var jsx_runtime_1 = require("react/jsx-runtime");
4
- var utils_1 = require("../utils");
5
- var DynamicDivider = function (_a) {
6
- var component = _a.component;
7
- var margin = (0, utils_1.getMarginBottom)(component.margin);
8
- var className = "m-t-0 ".concat(margin);
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const utils_1 = require("../utils");
5
+ const DynamicDivider = ({ component }) => {
6
+ const margin = (0, utils_1.getMarginBottom)(component.margin);
7
+ const className = `m-t-0 ${margin}`;
9
8
  return (0, jsx_runtime_1.jsx)("hr", { className: className });
10
9
  };
11
- exports["default"] = DynamicDivider;
10
+ exports.default = DynamicDivider;
@@ -1,37 +1,25 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
- exports.__esModule = true;
17
- var jsx_runtime_1 = require("react/jsx-runtime");
18
- var components_1 = require("@transferwise/components");
19
- var react_1 = require("react");
20
- var react_intl_1 = require("react-intl");
21
- var hooks_1 = require("../../common/hooks");
22
- var DynamicExternal_messages_1 = __importDefault(require("./DynamicExternal.messages"));
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_1 = require("react");
9
+ const react_intl_1 = require("react-intl");
10
+ const hooks_1 = require("../../common/hooks");
11
+ const DynamicExternal_messages_1 = __importDefault(require("./DynamicExternal.messages"));
23
12
  /** @deprecated - No longer supported, use the external feature instead */
24
- var DynamicExternal = function (_a) {
25
- var component = _a.component, onAction = _a.onAction;
26
- var requestUrl = component.requestUrl, responseHandlers = component.responseHandlers, polling = component.polling, retryTitle = component.retryTitle;
27
- var intl = (0, react_intl_1.useIntl)();
28
- var openExternalUrl = (0, react_1.useCallback)(function () { return window.open(requestUrl, 'df-external-window'); }, [requestUrl]);
29
- (0, react_1.useEffect)(function () {
13
+ const DynamicExternal = ({ component, onAction }) => {
14
+ const { requestUrl, responseHandlers, polling, retryTitle } = component;
15
+ const intl = (0, react_intl_1.useIntl)();
16
+ const openExternalUrl = (0, react_1.useCallback)(() => window.open(requestUrl, 'df-external-window'), [requestUrl]);
17
+ (0, react_1.useEffect)(() => {
30
18
  openExternalUrl();
31
19
  }, [openExternalUrl]);
32
- var pollingConfiguration = polling && responseHandlers
33
- ? __assign(__assign({}, polling), { responseHandlers: responseHandlers }) : undefined;
20
+ const pollingConfiguration = polling && responseHandlers
21
+ ? Object.assign(Object.assign({}, polling), { responseHandlers }) : undefined;
34
22
  (0, hooks_1.useExternalStepPolling)(pollingConfiguration, onAction);
35
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Loader, { size: components_1.Size.LARGE, classNames: { 'tw-loader': 'tw-loader m-x-auto' } }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(components_1.Button, __assign({ priority: "tertiary", block: true, onClick: openExternalUrl }, { children: retryTitle || intl.formatMessage(DynamicExternal_messages_1["default"].retryTitle) }))] }));
23
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(components_1.Loader, { size: components_1.Size.LARGE, classNames: { 'tw-loader': 'tw-loader m-x-auto' } }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(components_1.Button, Object.assign({ priority: "tertiary", block: true, onClick: openExternalUrl }, { children: retryTitle || intl.formatMessage(DynamicExternal_messages_1.default.retryTitle) }))] }));
36
24
  };
37
- exports["default"] = DynamicExternal;
25
+ exports.default = DynamicExternal;
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var react_intl_1 = require("react-intl");
4
- exports["default"] = (0, react_intl_1.defineMessages)({
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const react_intl_1 = require("react-intl");
4
+ exports.default = (0, react_intl_1.defineMessages)({
5
5
  retryTitle: {
6
6
  id: 'dynamicFlows.DynamicExternal.retryTitle',
7
7
  defaultMessage: 'Reopen window',
8
- description: ''
9
- }
8
+ description: '',
9
+ },
10
10
  });
@@ -1,27 +1,16 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
4
  };
16
- exports.__esModule = true;
17
- var jsx_runtime_1 = require("react/jsx-runtime");
18
- var jsonSchemaForm_1 = __importDefault(require("../../jsonSchemaForm"));
19
- var utils_1 = require("../utils");
20
- var DynamicForm = function (props) {
21
- var form = props.component;
22
- var formSchema = form.schema; // There should be no $ref at this point
23
- return ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, utils_1.getMarginBottom)(form.margin || 'md') }, { children: (0, jsx_runtime_1.jsx)(jsonSchemaForm_1["default"], { schema: formSchema, model: props.model, submitted: props.submitted, errors: props.errors, onChange: function (parameters) {
24
- props.onModelChange(__assign({ formSchema: formSchema }, parameters));
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const jsonSchemaForm_1 = __importDefault(require("../../jsonSchemaForm"));
8
+ const utils_1 = require("../utils");
9
+ const DynamicForm = (props) => {
10
+ const form = props.component;
11
+ const formSchema = form.schema; // There should be no $ref at this point
12
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: (0, utils_1.getMarginBottom)(form.margin || 'md') }, { children: (0, jsx_runtime_1.jsx)(jsonSchemaForm_1.default, { schema: formSchema, model: props.model, submitted: props.submitted, errors: props.errors, onChange: (parameters) => {
13
+ props.onModelChange(Object.assign({ formSchema }, parameters));
25
14
  }, onPersistAsync: props.onPersistAsync }) })));
26
15
  };
27
- exports["default"] = DynamicForm;
16
+ exports.default = DynamicForm;
@@ -1,33 +1,22 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- exports.__esModule = true;
14
- var jsx_runtime_1 = require("react/jsx-runtime");
15
- var utils_1 = require("../utils");
16
- var DynamicHeading = function (props) {
17
- var _a = props.component, text = _a.text, _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.align, align = _c === void 0 ? 'left' : _c, _d = _a.margin, margin = _d === void 0 ? 'md' : _d;
18
- var classes = (0, utils_1.getTextAlignmentAndMargin)({ align: align, margin: margin });
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const utils_1 = require("../utils");
5
+ const DynamicHeading = (props) => {
6
+ const { text, size = 'md', align = 'left', margin = 'md' } = props.component;
7
+ const classes = (0, utils_1.getTextAlignmentAndMargin)({ align, margin });
19
8
  switch (size) {
20
9
  case 'xs':
21
- return (0, jsx_runtime_1.jsx)("h5", __assign({ className: classes }, { children: text }));
10
+ return (0, jsx_runtime_1.jsx)("h5", Object.assign({ className: classes }, { children: text }));
22
11
  case 'sm':
23
- return (0, jsx_runtime_1.jsx)("h4", __assign({ className: classes }, { children: text }));
12
+ return (0, jsx_runtime_1.jsx)("h4", Object.assign({ className: classes }, { children: text }));
24
13
  case 'lg':
25
- return (0, jsx_runtime_1.jsx)("h2", __assign({ className: classes }, { children: text }));
14
+ return (0, jsx_runtime_1.jsx)("h2", Object.assign({ className: classes }, { children: text }));
26
15
  case 'xl':
27
- return (0, jsx_runtime_1.jsx)("h1", __assign({ className: classes }, { children: text }));
16
+ return (0, jsx_runtime_1.jsx)("h1", Object.assign({ className: classes }, { children: text }));
28
17
  case 'md':
29
18
  default:
30
- return (0, jsx_runtime_1.jsx)("h3", __assign({ className: classes }, { children: text }));
19
+ return (0, jsx_runtime_1.jsx)("h3", Object.assign({ className: classes }, { children: text }));
31
20
  }
32
21
  };
33
- exports["default"] = DynamicHeading;
22
+ exports.default = DynamicHeading;
@@ -22,17 +22,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- exports.__esModule = true;
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.isValidIconName = void 0;
27
- var jsx_runtime_1 = require("react/jsx-runtime");
28
- var icons = __importStar(require("@transferwise/icons"));
29
- var DynamicIcon = function (_a) {
30
- var type = _a.type;
31
- var iconName = toCapitalisedCamelCase(type);
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);
32
31
  if (!Object.keys(icons).includes(iconName)) {
33
32
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
34
33
  }
35
- var Icon = icons[iconName];
34
+ const Icon = icons[iconName];
36
35
  return (0, jsx_runtime_1.jsx)(Icon, { size: 24 });
37
36
  };
38
37
  function toCapitalisedCamelCase(value) {
@@ -40,11 +39,11 @@ function toCapitalisedCamelCase(value) {
40
39
  }
41
40
  function capitaliseFirstChar(value) {
42
41
  var _a;
43
- return "".concat((_a = value[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()).concat(value.slice(1));
42
+ return `${(_a = value[0]) === null || _a === void 0 ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
44
43
  }
45
44
  function isValidIconName(name) {
46
- var iconName = toCapitalisedCamelCase(name);
45
+ const iconName = toCapitalisedCamelCase(name);
47
46
  return Object.keys(icons).includes(iconName);
48
47
  }
49
48
  exports.isValidIconName = isValidIconName;
50
- exports["default"] = DynamicIcon;
49
+ exports.default = DynamicIcon;
@@ -1,112 +1,62 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- exports.__esModule = true;
50
- var jsx_runtime_1 = require("react/jsx-runtime");
51
- var components_1 = require("@transferwise/components");
52
- var react_1 = require("react");
53
- var contexts_1 = require("../../common/contexts");
54
- var utils_1 = require("../../common/utils");
55
- var utils_2 = require("../utils");
56
- var DynamicImage = function (_a) {
57
- var image = _a.component;
58
- var url = image.url, size = image.size, text = image.text, margin = image.margin;
59
- var fetcher = (0, contexts_1.useFetcher)();
60
- var _b = (0, react_1.useState)(''), imageSource = _b[0], setImageSource = _b[1];
61
- (0, react_1.useEffect)(function () {
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)(() => {
62
14
  void getImageSource(fetcher, url).then(setImageSource);
63
15
  }, [url, fetcher]);
64
- var imageProps = {
16
+ const imageProps = {
65
17
  alt: text || '',
66
18
  src: imageSource,
67
19
  stretch: true,
68
- shrink: true
20
+ shrink: true,
69
21
  };
70
22
  if (!imageSource) {
71
23
  return null;
72
24
  }
73
- return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "df-image ".concat(size || 'xl') }, { children: (0, jsx_runtime_1.jsx)(components_1.Image, __assign({ className: "img-responsive ".concat((0, utils_2.getMarginBottom)(margin || 'lg')) }, imageProps)) })));
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)) })));
74
26
  };
75
- var readImageBlobAsDataURL = function (imageBlob) {
27
+ const readImageBlobAsDataURL = (imageBlob) => {
76
28
  // we can safely assume the type of reader.result is string
77
29
  // because we're calling reader.readAsDataURL
78
30
  // https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
79
- return new Promise(function (resolve, reject) {
80
- var reader = new FileReader();
81
- reader.addEventListener('loadend', function () { return resolve(reader.result); });
82
- reader.addEventListener('error', function (error) { return reject(error); });
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));
83
35
  reader.readAsDataURL(imageBlob);
84
36
  });
85
37
  };
86
- var getImageSource = function (fetcher, imageUrl) { return __awaiter(void 0, void 0, void 0, function () {
38
+ const getImageSource = async (fetcher, imageUrl) => {
87
39
  var _a;
88
- return __generator(this, function (_b) {
89
- try {
90
- if ((0, utils_1.isRelativePath)(imageUrl) || (imageUrl === null || imageUrl === void 0 ? void 0 : imageUrl.indexOf("".concat((_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.origin, "/"))) === 0) {
91
- return [2 /*return*/, fetcher(imageUrl, {
92
- method: 'GET',
93
- headers: { 'Content-Type': 'image/image' },
94
- credentials: 'same-origin'
95
- })
96
- .then(function (response) {
97
- if (response.ok) {
98
- return response.blob();
99
- }
100
- throw new Error('Image fetching failed');
101
- })
102
- .then(readImageBlobAsDataURL)["catch"](function () { return imageUrl; })];
103
- }
104
- return [2 /*return*/, imageUrl];
105
- }
106
- catch (_c) {
107
- return [2 /*return*/, imageUrl];
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);
108
55
  }
109
- return [2 /*return*/];
110
- });
111
- }); };
112
- exports["default"] = DynamicImage;
56
+ return imageUrl;
57
+ }
58
+ catch (_b) {
59
+ return imageUrl;
60
+ }
61
+ };
62
+ exports.default = DynamicImage;
@@ -1,48 +1,40 @@
1
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
- exports.__esModule = true;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
14
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;
15
7
  var DynamicAlert_1 = require("./alert/DynamicAlert");
16
- __createBinding(exports, DynamicAlert_1, "default", "DynamicAlert");
8
+ Object.defineProperty(exports, "DynamicAlert", { enumerable: true, get: function () { return __importDefault(DynamicAlert_1).default; } });
17
9
  var DynamicBox_1 = require("./box/DynamicBox");
18
- __createBinding(exports, DynamicBox_1, "default", "DynamicBox");
10
+ Object.defineProperty(exports, "DynamicBox", { enumerable: true, get: function () { return __importDefault(DynamicBox_1).default; } });
19
11
  var DynamicButton_1 = require("./button/DynamicButton");
20
- __createBinding(exports, DynamicButton_1, "default", "DynamicButton");
12
+ Object.defineProperty(exports, "DynamicButton", { enumerable: true, get: function () { return __importDefault(DynamicButton_1).default; } });
21
13
  var DynamicColumns_1 = require("./columns/DynamicColumns");
22
- __createBinding(exports, DynamicColumns_1, "default", "DynamicColumns");
14
+ Object.defineProperty(exports, "DynamicColumns", { enumerable: true, get: function () { return __importDefault(DynamicColumns_1).default; } });
23
15
  var DynamicDecision_1 = require("./decision/DynamicDecision");
24
- __createBinding(exports, DynamicDecision_1, "default", "DynamicDecision");
16
+ Object.defineProperty(exports, "DynamicDecision", { enumerable: true, get: function () { return __importDefault(DynamicDecision_1).default; } });
25
17
  var DynamicDivider_1 = require("./divider/DynamicDivider");
26
- __createBinding(exports, DynamicDivider_1, "default", "DynamicDivider");
18
+ Object.defineProperty(exports, "DynamicDivider", { enumerable: true, get: function () { return __importDefault(DynamicDivider_1).default; } });
27
19
  var DynamicExternal_1 = require("./external/DynamicExternal");
28
- __createBinding(exports, DynamicExternal_1, "default", "DynamicExternal");
20
+ Object.defineProperty(exports, "DynamicExternal", { enumerable: true, get: function () { return __importDefault(DynamicExternal_1).default; } });
29
21
  var DynamicForm_1 = require("./form/DynamicForm");
30
- __createBinding(exports, DynamicForm_1, "default", "DynamicForm");
22
+ Object.defineProperty(exports, "DynamicForm", { enumerable: true, get: function () { return __importDefault(DynamicForm_1).default; } });
31
23
  var DynamicHeading_1 = require("./heading/DynamicHeading");
32
- __createBinding(exports, DynamicHeading_1, "default", "DynamicHeading");
24
+ Object.defineProperty(exports, "DynamicHeading", { enumerable: true, get: function () { return __importDefault(DynamicHeading_1).default; } });
33
25
  var DynamicIcon_1 = require("./icon/DynamicIcon");
34
- __createBinding(exports, DynamicIcon_1, "default", "DynamicIcon");
26
+ Object.defineProperty(exports, "DynamicIcon", { enumerable: true, get: function () { return __importDefault(DynamicIcon_1).default; } });
35
27
  var DynamicInfo_1 = require("./info/DynamicInfo");
36
- __createBinding(exports, DynamicInfo_1, "default", "DynamicInfo");
28
+ Object.defineProperty(exports, "DynamicInfo", { enumerable: true, get: function () { return __importDefault(DynamicInfo_1).default; } });
37
29
  var DynamicImage_1 = require("./image/DynamicImage");
38
- __createBinding(exports, DynamicImage_1, "default", "DynamicImage");
30
+ Object.defineProperty(exports, "DynamicImage", { enumerable: true, get: function () { return __importDefault(DynamicImage_1).default; } });
39
31
  var DynamicLayout_1 = require("./DynamicLayout");
40
- __createBinding(exports, DynamicLayout_1, "default", "DynamicLayout");
32
+ Object.defineProperty(exports, "DynamicLayout", { enumerable: true, get: function () { return __importDefault(DynamicLayout_1).default; } });
41
33
  var DynamicList_1 = require("./list/DynamicList");
42
- __createBinding(exports, DynamicList_1, "default", "DynamicList");
34
+ Object.defineProperty(exports, "DynamicList", { enumerable: true, get: function () { return __importDefault(DynamicList_1).default; } });
43
35
  var DynamicLoadingIndicator_1 = require("./loadingIndicator/DynamicLoadingIndicator");
44
- __createBinding(exports, DynamicLoadingIndicator_1, "default", "DynamicLoadingIndicator");
36
+ Object.defineProperty(exports, "DynamicLoadingIndicator", { enumerable: true, get: function () { return __importDefault(DynamicLoadingIndicator_1).default; } });
45
37
  var DynamicParagraph_1 = require("./paragraph/DynamicParagraph");
46
- __createBinding(exports, DynamicParagraph_1, "default", "DynamicParagraph");
38
+ Object.defineProperty(exports, "DynamicParagraph", { enumerable: true, get: function () { return __importDefault(DynamicParagraph_1).default; } });
47
39
  var DynamicReview_1 = require("./review/DynamicReview");
48
- __createBinding(exports, DynamicReview_1, "default", "DynamicReview");
40
+ Object.defineProperty(exports, "DynamicReview", { enumerable: true, get: function () { return __importDefault(DynamicReview_1).default; } });
@@ -1,21 +1,9 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
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 })) })));
12
8
  };
13
- exports.__esModule = true;
14
- var jsx_runtime_1 = require("react/jsx-runtime");
15
- var components_1 = require("@transferwise/components");
16
- var utils_1 = require("../utils");
17
- var DynamicInfo = function (_a) {
18
- var component = _a.component;
19
- return ((0, jsx_runtime_1.jsx)("div", __assign({ className: (0, utils_1.getTextAlignmentAndMargin)(component) }, { children: (0, jsx_runtime_1.jsx)(components_1.Markdown, __assign({ config: { link: { target: '_blank' } } }, { children: component.markdown })) })));
20
- };
21
- exports["default"] = DynamicInfo;
9
+ exports.default = DynamicInfo;
@@ -1,33 +1,21 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- exports.__esModule = true;
14
- var jsx_runtime_1 = require("react/jsx-runtime");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
15
4
  /* eslint-disable @typescript-eslint/no-unsafe-return */
16
- var components_1 = require("@transferwise/components");
17
- var __1 = require("..");
18
- var utils_1 = require("../utils");
19
- var DynamicList = function (_a) {
20
- var component = _a.component;
21
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: (0, utils_1.getMarginBottom)(component.margin || 'md') }, { children: [component.title ? (0, jsx_runtime_1.jsxs)("h4", __assign({ className: "m-b-2" }, { children: [" ", component.title, " "] })) : null, component.items.map(mapItemToSummary)] })));
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)] })));
22
10
  };
23
- function mapItemToSummary(_a) {
24
- var title = _a.title, description = _a.description, icon = _a.icon, status = _a.status;
25
- var props = __assign(__assign({ key: "".concat(title, "/").concat(description || ''), title: title, description: 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] } : {}));
26
- return (0, jsx_runtime_1.jsx)(components_1.Summary, __assign({}, props));
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));
27
15
  }
28
- var statusMap = {
16
+ const statusMap = {
29
17
  positive: 'done',
30
18
  warning: 'pending',
31
- neutral: 'notDone'
19
+ neutral: 'notDone',
32
20
  };
33
- exports["default"] = DynamicList;
21
+ exports.default = DynamicList;
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
- exports.__esModule = true;
3
- var jsx_runtime_1 = require("react/jsx-runtime");
4
- var components_1 = require("@transferwise/components");
5
- var utils_1 = require("../utils");
6
- var DynamicLoadingIndicator = function (_a) {
7
- var component = _a.component;
8
- var margin = component.margin, _b = component.size, size = _b === void 0 ? 'md' : _b;
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;
9
8
  return ((0, jsx_runtime_1.jsx)(components_1.Loader, { size: size, classNames: {
10
- 'tw-loader': "tw-loader m-x-auto ".concat((0, utils_1.getMarginBottom)(margin))
9
+ 'tw-loader': `tw-loader m-x-auto ${(0, utils_1.getMarginBottom)(margin)}`,
11
10
  }, "data-testid": "loading-indicator" }));
12
11
  };
13
- exports["default"] = DynamicLoadingIndicator;
12
+ exports.default = DynamicLoadingIndicator;