@wise/dynamic-flow-client 1.0.2 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/build/i18n/pl.json +2 -2
  2. package/build/i18n/zh.json +5 -5
  3. package/build/main.js +880 -743
  4. package/build/main.min.js +3 -3
  5. package/build/types/common/utils/step-utils.d.ts +1 -5
  6. package/build/types/dynamicFlow/utils/responseParsers/response-parsers.d.ts +1 -1
  7. package/build/types/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.d.ts +3 -3
  8. package/build/types/dynamicFlow/utils/useLoader.d.ts +1 -1
  9. package/build/types/fixtures/components/decision-flags.d.ts +3 -0
  10. package/build/types/fixtures/components/decision-icons.d.ts +3 -0
  11. package/build/types/fixtures/components/index.d.ts +2 -0
  12. package/build/types/fixtures/index.d.ts +4 -0
  13. package/build/types/fixtures/schemas/all-of.d.ts +3 -0
  14. package/build/types/fixtures/schemas/boolean.d.ts +3 -0
  15. package/build/types/fixtures/schemas/index.d.ts +2 -0
  16. package/build/types/jsonSchemaForm/schemaFormControl/utils/mapping-utils.d.ts +10 -14
  17. package/build/types/layout/button/utils.d.ts +5 -0
  18. package/build/types/layout/icon/DynamicIcon.d.ts +2 -2
  19. package/build/types/layout/icon/FlagIcon.d.ts +7 -0
  20. package/build/types/layout/icon/NamedIcon.d.ts +6 -0
  21. package/build/types/layout/index.d.ts +1 -1
  22. package/build/types/layout/markdown/DynamicMarkdown.d.ts +10 -0
  23. package/build/types/types/specification/LayoutComponent.d.ts +11 -1
  24. package/build/types/types/specification/Step.d.ts +9 -26
  25. package/package.json +3 -2
  26. package/build/types/jsonSchemaForm/schemaFormControl/utils/currency-utils.d.ts +0 -3
  27. package/build/types/layout/info/DynamicInfo.d.ts +0 -6
package/build/main.js CHANGED
@@ -541,92 +541,87 @@ __export(src_exports, {
541
541
  module.exports = __toCommonJS(src_exports);
542
542
 
543
543
  // src/step/layoutStep/utils/layout-utils.ts
544
- function convertStepToLayout(step31, { displayStepTitle = true } = {}) {
545
- if (!step31 || !step31.type) {
546
- throw new Error("Missing step type");
544
+ function convertStepToLayout(step35, { displayStepTitle = true } = {}) {
545
+ if (step35.layout) {
546
+ return addMissingTitleAndDescriptionToStep(step35, displayStepTitle);
547
547
  }
548
- if (step31.layout) {
549
- return addMissingTitleAndDescriptionToStep(step31, displayStepTitle);
550
- }
551
- switch (step31.type) {
548
+ switch (step35.type) {
552
549
  case "final":
553
- return convertFinalStepToDynamicLayout(step31);
550
+ return convertFinalStepToDynamicLayout(step35);
554
551
  case "decision":
555
- return convertDecisionStepToDynamicLayout(step31);
556
- case "form":
557
- return convertFormStepToDynamicLayout(step31);
552
+ return convertDecisionStepToDynamicLayout(step35);
558
553
  case "external":
559
- return convertExternalStepToDynamicLayout(step31);
554
+ return convertExternalStepToDynamicLayout(step35);
560
555
  default:
561
- throw new Error("invalid step type");
556
+ return convertFormStepToDynamicLayout(step35);
562
557
  }
563
558
  }
564
- function convertCommonComponents(step31) {
559
+ function convertCommonComponents(step35) {
565
560
  const layout6 = [];
566
- if (step31.title) {
567
- layout6.push(convertStepTitleToDynamicHeading(step31.title));
561
+ if (step35.title) {
562
+ layout6.push(convertStepTitleToDynamicHeading(step35.title));
568
563
  }
569
- if (step31.image) {
570
- const image = convertStepImageToDynamicImage(step31.image);
564
+ if (step35.image) {
565
+ const image = convertStepImageToDynamicImage(step35.image);
571
566
  layout6.push(image);
572
567
  }
573
- if (step31.description) {
574
- layout6.push(convertStepDescriptionToDynamicParagraph(step31.description));
568
+ if (step35.description) {
569
+ layout6.push(convertStepDescriptionToDynamicParagraph(step35.description));
575
570
  }
576
571
  return layout6;
577
572
  }
578
- function convertExternalStepToDynamicLayout(step31) {
579
- return [...convertCommonComponents(step31), convertStepToExternalComponent(step31)];
573
+ function convertExternalStepToDynamicLayout(step35) {
574
+ return [...convertCommonComponents(step35), convertStepToExternalComponent(step35)];
580
575
  }
581
- function convertStepToExternalComponent(step31) {
576
+ function convertStepToExternalComponent(step35) {
582
577
  return {
583
578
  type: "external",
584
- requestUrl: step31.requestUrl,
585
- polling: step31.polling,
586
- responseHandlers: step31.responseHandlers,
587
- retryTitle: step31.retryTitle
579
+ requestUrl: step35.requestUrl,
580
+ polling: step35.polling,
581
+ responseHandlers: step35.responseHandlers,
582
+ retryTitle: step35.retryTitle
588
583
  };
589
584
  }
590
- function convertFormStepToDynamicLayout(step31) {
591
- const layout6 = convertCommonComponents(step31);
592
- if (step31.reviewFields) {
593
- layout6.push(convertStepReviewToDynamicReview(step31.reviewFields));
585
+ function convertFormStepToDynamicLayout(step35) {
586
+ const layout6 = convertCommonComponents(step35);
587
+ if (step35.reviewFields) {
588
+ layout6.push(convertStepReviewToDynamicReview(step35.reviewFields));
594
589
  }
595
- if (step31.schemas) {
596
- layout6.push(...getSchemaLayout(step31));
590
+ if (step35.schemas) {
591
+ layout6.push(...getSchemaLayout(step35));
597
592
  }
598
- if (step31.actions) {
599
- const actions = step31.actions.map(convertStepActionToDynamicAction);
593
+ if (step35.actions) {
594
+ const actions = step35.actions.map(convertStepActionToDynamicAction);
600
595
  layout6.push(dynamicBox(actions, "md"));
601
596
  }
602
597
  return layout6;
603
598
  }
604
- function convertFinalStepToDynamicLayout(step31) {
599
+ function convertFinalStepToDynamicLayout(step35) {
605
600
  const layout6 = [];
606
- if (step31.details) {
607
- if (step31.details.image) {
608
- const image = convertFinalStepImageToDynamicImage(step31.details.image);
601
+ if (step35.details) {
602
+ if (step35.details.image) {
603
+ const image = convertFinalStepImageToDynamicImage(step35.details.image);
609
604
  layout6.push(image);
610
605
  }
611
- if (step31.details.title) {
612
- layout6.push(convertStepTitleToDynamicHeading(step31.details.title));
606
+ if (step35.details.title) {
607
+ layout6.push(convertStepTitleToDynamicHeading(step35.details.title));
613
608
  }
614
- if (step31.details.description) {
615
- layout6.push(convertStepDescriptionToDynamicParagraph(step31.details.description));
609
+ if (step35.details.description) {
610
+ layout6.push(convertStepDescriptionToDynamicParagraph(step35.details.description));
616
611
  }
617
612
  }
618
- if (step31.actions) {
619
- const actions = step31.actions.map(
613
+ if (step35.actions) {
614
+ const actions = step35.actions.map(
620
615
  (action2) => convertStepActionToDynamicAction(__spreadProps(__spreadValues({}, action2), { type: action2.type || "primary" }))
621
616
  );
622
617
  layout6.push(dynamicBox(actions, "md"));
623
618
  }
624
619
  return layout6;
625
620
  }
626
- function convertDecisionStepToDynamicLayout(step31) {
627
- const layout6 = convertCommonComponents(step31);
628
- if (step31.options) {
629
- layout6.push(convertStepDecisionToDynamicDecision(step31.options));
621
+ function convertDecisionStepToDynamicLayout(step35) {
622
+ const layout6 = convertCommonComponents(step35);
623
+ if (step35.options) {
624
+ layout6.push(convertStepDecisionToDynamicDecision(step35.options));
630
625
  }
631
626
  return layout6;
632
627
  }
@@ -712,10 +707,10 @@ function convertReviewFieldToDefinition(reviewField) {
712
707
  value: reviewField.value
713
708
  };
714
709
  }
715
- function getSchemaLayout(step31) {
710
+ function getSchemaLayout(step35) {
716
711
  const layout6 = [];
717
- if (step31.schemas && step31.schemas[0]) {
718
- const schema2 = step31.schemas[0];
712
+ if (step35.schemas && step35.schemas[0]) {
713
+ const schema2 = step35.schemas[0];
719
714
  const dynamicForm = convertStepSchemaToDynamicForm(schema2);
720
715
  if (isWideForm()) {
721
716
  layout6.push(dynamicForm);
@@ -728,11 +723,11 @@ function getSchemaLayout(step31) {
728
723
  function isWideForm() {
729
724
  return false;
730
725
  }
731
- function addMissingTitleAndDescriptionToStep(step31, displayStepTitle) {
726
+ function addMissingTitleAndDescriptionToStep(step35, displayStepTitle) {
732
727
  return [
733
- ...displayStepTitle && step31.title ? [convertStepTitleToDynamicHeading(step31.title)] : [],
734
- ...step31.description ? [convertStepDescriptionToDynamicParagraph(step31.description)] : [],
735
- ...step31.layout || []
728
+ ...displayStepTitle && step35.title ? [convertStepTitleToDynamicHeading(step35.title)] : [],
729
+ ...step35.description ? [convertStepDescriptionToDynamicParagraph(step35.description)] : [],
730
+ ...step35.layout || []
736
731
  ];
737
732
  }
738
733
 
@@ -1711,23 +1706,19 @@ function shouldDebounceSchema(schema2) {
1711
1706
  }
1712
1707
 
1713
1708
  // src/common/utils/step-utils.ts
1714
- var stepType = {
1715
- LAYOUT: "layout",
1716
- CAMERA: "camera"
1709
+ var isCameraStep = (step35) => {
1710
+ return isFormStep(step35) && hasSingleAction(step35) && hasSingleFileUploadSchemaWithCameraOnly(step35);
1717
1711
  };
1718
- var isCameraStep = (step31) => {
1719
- return isFormStep(step31) && hasSingleAction(step31) && hasSingleFileUploadSchemaWithCameraOnly(step31);
1720
- };
1721
- var isFormStep = (step31) => (step31 == null ? void 0 : step31.type) === "form";
1722
- var hasSingleAction = (step31) => {
1712
+ var isFormStep = (step35) => !step35.type || step35.type === "form";
1713
+ var hasSingleAction = (step35) => {
1723
1714
  var _a;
1724
- return ((_a = step31 == null ? void 0 : step31.actions) == null ? void 0 : _a.length) === 1;
1715
+ return ((_a = step35 == null ? void 0 : step35.actions) == null ? void 0 : _a.length) === 1;
1725
1716
  };
1726
- var hasSingleFileUploadSchemaWithCameraOnly = (step31) => {
1727
- if (!step31.schemas) {
1717
+ var hasSingleFileUploadSchemaWithCameraOnly = (step35) => {
1718
+ if (!step35.schemas) {
1728
1719
  return false;
1729
1720
  }
1730
- const schemas = filterHiddenSchemas(step31.schemas);
1721
+ const schemas = filterHiddenSchemas(step35.schemas);
1731
1722
  if ((schemas == null ? void 0 : schemas.length) !== 1) {
1732
1723
  return false;
1733
1724
  }
@@ -1749,12 +1740,6 @@ var filterHiddenSchemas = (schemas) => {
1749
1740
  return (schema2 == null ? void 0 : schema2.hidden) !== true;
1750
1741
  });
1751
1742
  };
1752
- var getStepType = (step31) => {
1753
- if (isCameraStep(step31)) {
1754
- return stepType.CAMERA;
1755
- }
1756
- return stepType.LAYOUT;
1757
- };
1758
1743
 
1759
1744
  // src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
1760
1745
  function useDebouncedFunction(callback, waitMs) {
@@ -2101,13 +2086,57 @@ var DynamicBox_default = DynamicBox;
2101
2086
 
2102
2087
  // src/layout/button/DynamicButton.tsx
2103
2088
  var import_components2 = require("@transferwise/components");
2089
+
2090
+ // src/layout/button/utils.ts
2091
+ var priorities = {
2092
+ primary: "primary",
2093
+ secondary: "secondary",
2094
+ link: "tertiary",
2095
+ positive: "primary",
2096
+ negative: "primary"
2097
+ };
2098
+ var getButtonPriority = (component) => {
2099
+ var _a;
2100
+ const actionType = component.action.type;
2101
+ return (_a = component.control) != null ? _a : actionType ? priorities[actionType] : "secondary";
2102
+ };
2103
+ var types = {
2104
+ primary: "neutral",
2105
+ secondary: "neutral",
2106
+ link: "neutral",
2107
+ positive: "positive",
2108
+ negative: "negative"
2109
+ };
2110
+ var getButtonType = (component) => {
2111
+ var _a;
2112
+ const actionType = component.action.type;
2113
+ const type = (_a = component.context) != null ? _a : actionType ? types[actionType] : "neutral";
2114
+ return type === "neutral" ? "accent" : type;
2115
+ };
2116
+ var getButtonSize = (size) => {
2117
+ switch (size) {
2118
+ case "xs":
2119
+ case "sm":
2120
+ return "sm";
2121
+ case "lg":
2122
+ case "xl":
2123
+ return "lg";
2124
+ case "md":
2125
+ default:
2126
+ return "md";
2127
+ }
2128
+ };
2129
+
2130
+ // src/layout/button/DynamicButton.tsx
2104
2131
  var import_jsx_runtime7 = require("react/jsx-runtime");
2105
2132
  var DynamicButton = (props) => {
2133
+ var _a;
2106
2134
  const { component, onAction } = props;
2107
2135
  const componentAction = component.action;
2108
- const { type, priority } = getButtonTypeAndPriority(componentAction);
2136
+ const type = getButtonType(component);
2137
+ const priority = getButtonPriority(component);
2109
2138
  const { loading } = useDynamicFlow();
2110
- const className = getMarginBottom(component.margin || "md") + " " + getActionClasses(componentAction);
2139
+ const className = getMarginBottom(component.margin || "md");
2111
2140
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2112
2141
  import_components2.Button,
2113
2142
  {
@@ -2116,44 +2145,12 @@ var DynamicButton = (props) => {
2116
2145
  priority,
2117
2146
  block: true,
2118
2147
  className,
2119
- disabled: componentAction.disabled || loading,
2148
+ disabled: component.disabled || componentAction.disabled || loading,
2120
2149
  onClick: () => onAction(componentAction),
2121
- children: componentAction.title
2150
+ children: (_a = component.title) != null ? _a : componentAction.title
2122
2151
  }
2123
2152
  );
2124
2153
  };
2125
- var getActionClasses = (action2) => {
2126
- return action2.primary ? "btn-primary" : "";
2127
- };
2128
- var getButtonSize = (size) => {
2129
- switch (size) {
2130
- case "xs":
2131
- case "sm":
2132
- return "sm";
2133
- case "lg":
2134
- case "xl":
2135
- return "lg";
2136
- case "md":
2137
- default:
2138
- return "md";
2139
- }
2140
- };
2141
- var getButtonTypeAndPriority = (action2) => {
2142
- switch (action2.type) {
2143
- case "link":
2144
- return { type: "accent", priority: "tertiary" };
2145
- case "primary":
2146
- return { type: "accent", priority: "primary" };
2147
- case "secondary":
2148
- return { type: "accent", priority: "secondary" };
2149
- case "positive":
2150
- return { type: "positive", priority: "primary" };
2151
- case "negative":
2152
- return { type: "negative", priority: "primary" };
2153
- default:
2154
- return { type: "accent", priority: "secondary" };
2155
- }
2156
- };
2157
2154
  var DynamicButton_default = DynamicButton;
2158
2155
 
2159
2156
  // src/layout/columns/DynamicColumns.tsx
@@ -2994,7 +2991,7 @@ var _FormControl = class extends import_react13.PureComponent {
2994
2991
  const {
2995
2992
  name,
2996
2993
  placeholder,
2997
- step: step31,
2994
+ step: step35,
2998
2995
  countryCode,
2999
2996
  type,
3000
2997
  options,
@@ -3102,7 +3099,7 @@ var _FormControl = class extends import_react13.PureComponent {
3102
3099
  placeholder,
3103
3100
  readOnly,
3104
3101
  required,
3105
- step: step31,
3102
+ step: step35,
3106
3103
  type: "number",
3107
3104
  value: getSafeStringOrNumberValue(value, { coerceValue: true }),
3108
3105
  onBlur: this.handleOnBlur,
@@ -3318,52 +3315,30 @@ FormControl.defaultProps = {
3318
3315
  // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
3319
3316
  var import_components9 = require("@transferwise/components");
3320
3317
 
3321
- // src/layout/icon/DynamicIcon.tsx
3322
- var icons = __toESM(require("@transferwise/icons"));
3318
+ // src/layout/icon/FlagIcon.tsx
3323
3319
  var import_jsx_runtime20 = require("react/jsx-runtime");
3324
- var DynamicIcon = ({ type }) => {
3325
- const iconName = toCapitalisedCamelCase(type);
3326
- if (!Object.keys(icons).includes(iconName)) {
3327
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, {});
3320
+ var isFlagIcon = (name) => availableCurrencyFlags.some((currencyCode) => name === `flag-${currencyCode}`);
3321
+ var FlagIcon = ({ name }) => {
3322
+ if (!isFlagIcon(name)) {
3323
+ return null;
3328
3324
  }
3329
- const Icon = icons[iconName];
3330
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Icon, { size: 24 });
3331
- };
3332
- function toCapitalisedCamelCase(value) {
3333
- return value.split("-").map(capitaliseFirstChar).join("");
3334
- }
3335
- function capitaliseFirstChar(value) {
3336
- var _a;
3337
- return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
3338
- }
3339
- function isValidIconName(name) {
3340
- const iconName = toCapitalisedCamelCase(name);
3341
- return Object.keys(icons).includes(iconName);
3342
- }
3343
- var DynamicIcon_default = DynamicIcon;
3344
-
3345
- // src/jsonSchemaForm/schemaFormControl/utils/currency-utils.ts
3346
- function getCurrencyFlag(iconName) {
3347
- if (iconName) {
3348
- const index = availablePrefixedCurrencyFlags.indexOf(iconName);
3349
- if (index >= 0) {
3350
- return {
3351
- currency: availableCurrencyFlags[index]
3352
- };
3325
+ const currencyCode = name.substring(5);
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3327
+ "img",
3328
+ {
3329
+ src: `https://wise.com/web-art/assets/flags/${currencyCode}.svg`,
3330
+ alt: "",
3331
+ "data-testid": `img-flag-${currencyCode}`
3353
3332
  }
3354
- }
3355
- return null;
3356
- }
3333
+ );
3334
+ };
3357
3335
  var availableCurrencyFlags = [
3358
- "eur",
3359
- "gbp",
3360
- "inr",
3361
- "usd",
3362
3336
  "aed",
3363
3337
  "ars",
3364
3338
  "aud",
3365
3339
  "bdt",
3366
3340
  "bgn",
3341
+ "bnd",
3367
3342
  "brl",
3368
3343
  "bwp",
3369
3344
  "cad",
@@ -3375,7 +3350,9 @@ var availableCurrencyFlags = [
3375
3350
  "czk",
3376
3351
  "dkk",
3377
3352
  "egp",
3353
+ "eur",
3378
3354
  "fjd",
3355
+ "gbp",
3379
3356
  "gel",
3380
3357
  "ghs",
3381
3358
  "hkd",
@@ -3383,10 +3360,14 @@ var availableCurrencyFlags = [
3383
3360
  "huf",
3384
3361
  "idr",
3385
3362
  "ils",
3363
+ "imp",
3364
+ "inr",
3386
3365
  "jpy",
3387
3366
  "kes",
3388
3367
  "krw",
3368
+ "lak",
3389
3369
  "lkr",
3370
+ "lsl",
3390
3371
  "mad",
3391
3372
  "mxn",
3392
3373
  "myr",
@@ -3396,6 +3377,7 @@ var availableCurrencyFlags = [
3396
3377
  "nok",
3397
3378
  "npr",
3398
3379
  "nzd",
3380
+ "pab",
3399
3381
  "pen",
3400
3382
  "php",
3401
3383
  "pkr",
@@ -3405,20 +3387,58 @@ var availableCurrencyFlags = [
3405
3387
  "sek",
3406
3388
  "sgd",
3407
3389
  "thb",
3390
+ "tmt",
3408
3391
  "try",
3409
3392
  "tzs",
3410
3393
  "uah",
3411
3394
  "ugx",
3395
+ "usd",
3412
3396
  "uyu",
3413
3397
  "vnd",
3414
3398
  "xof",
3415
3399
  "zar",
3416
3400
  "zmw"
3417
3401
  ];
3418
- var availablePrefixedCurrencyFlags = availableCurrencyFlags.map((code) => `flag-${code}`);
3419
3402
 
3420
- // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
3403
+ // src/layout/icon/NamedIcon.tsx
3404
+ var icons = __toESM(require("@transferwise/icons"));
3421
3405
  var import_jsx_runtime21 = require("react/jsx-runtime");
3406
+ var isNamedIcon = (name) => {
3407
+ const iconName = toCapitalisedCamelCase(name);
3408
+ return Object.keys(icons).includes(iconName);
3409
+ };
3410
+ var NamedIcon = ({ name }) => {
3411
+ if (!isNamedIcon(name)) {
3412
+ return null;
3413
+ }
3414
+ const iconName = toCapitalisedCamelCase(name);
3415
+ const Icon = icons[iconName];
3416
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 24 });
3417
+ };
3418
+ var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
3419
+ var capitaliseFirstChar = (value) => {
3420
+ var _a;
3421
+ return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
3422
+ };
3423
+
3424
+ // src/layout/icon/DynamicIcon.tsx
3425
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3426
+ var DynamicIcon = ({ type }) => {
3427
+ if (isFlagIcon(type)) {
3428
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FlagIcon, { name: type });
3429
+ }
3430
+ if (isNamedIcon(type)) {
3431
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(NamedIcon, { name: type });
3432
+ }
3433
+ return null;
3434
+ };
3435
+ function isValidIconName(name) {
3436
+ return isNamedIcon(name) || isFlagIcon(name);
3437
+ }
3438
+ var DynamicIcon_default = DynamicIcon;
3439
+
3440
+ // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
3441
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3422
3442
  var mapConstSchemaToOption = (schema2, controlType) => {
3423
3443
  switch (controlType) {
3424
3444
  case "select":
@@ -3429,56 +3449,58 @@ var mapConstSchemaToOption = (schema2, controlType) => {
3429
3449
  }
3430
3450
  };
3431
3451
  var mapConstSchemaToRadioOption = (schema2) => {
3432
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
3452
+ return __spreadValues(__spreadValues(__spreadValues({
3433
3453
  // TODO: LOW avoid type assertion -- using || '' would fail some tests
3434
3454
  label: schema2.title,
3435
3455
  value: schema2.const
3436
- }, getOptionDescription(schema2.title, schema2.description)), mapIconToAvatar(schema2.icon)), mapCurrency(schema2.icon)), mapAvatar(schema2.image)), getDisabled(schema2.disabled));
3456
+ }, getOptionDescription(schema2.title, schema2.description)), getAvatarPropertyForRadioOption(schema2)), getDisabled(schema2.disabled));
3437
3457
  };
3438
3458
  var mapConstSchemaToSelectOption = (schema2) => {
3439
- return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
3459
+ return __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
3440
3460
  // TODO: LOW avoid type assertion -- using || '' would fail some tests
3441
3461
  label: schema2.title,
3442
3462
  value: schema2.const
3443
- }, getOptionDescription(schema2.title, schema2.description)), mapIcon(schema2.icon)), mapCurrency(schema2.icon)), mapImage(schema2.image)), getDisabled(schema2.disabled)), mapKeywordsToSearchStrings(schema2.keywords));
3463
+ }, getOptionDescription(schema2.title, schema2.description)), getIconPropertyForSelectOption(schema2.icon)), mapImage(schema2.image)), getDisabled(schema2.disabled)), mapKeywordsToSearchStrings(schema2.keywords));
3444
3464
  };
3445
- var mapCurrency = (icon) => icon ? getCurrencyFlag(icon.name) : null;
3446
3465
  var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { searchStrings } : {};
3447
3466
  var mapImage = (image) => {
3448
3467
  if (image == null ? void 0 : image.url) {
3449
3468
  return {
3450
- icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
3469
+ icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
3451
3470
  };
3452
3471
  }
3453
3472
  return null;
3454
3473
  };
3455
- var mapIcon = (icon) => {
3474
+ var getIconPropertyForSelectOption = (icon) => {
3475
+ if ((icon == null ? void 0 : icon.name) && isFlagIcon(icon.name)) {
3476
+ return { currency: icon.name.substring(5) };
3477
+ }
3456
3478
  if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3457
- return { icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DynamicIcon_default, { type: icon.name }) };
3479
+ return { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DynamicIcon_default, { type: icon.name }) };
3458
3480
  }
3459
3481
  if (icon == null ? void 0 : icon.text) {
3460
- return { icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: icon.text }) };
3482
+ return { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: icon.text }) };
3461
3483
  }
3462
3484
  return null;
3463
3485
  };
3464
- var mapIconToAvatar = (icon) => {
3486
+ var getAvatarPropertyForRadioOption = ({ image, icon }) => {
3487
+ if (image == null ? void 0 : image.url) {
3488
+ return {
3489
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: image.url, alt: "" }) })
3490
+ };
3491
+ }
3465
3492
  if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3466
3493
  return {
3467
- avatar: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DynamicIcon_default, { type: icon.name }) })
3494
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DynamicIcon_default, { type: icon.name }) })
3468
3495
  };
3469
3496
  }
3470
3497
  if (icon == null ? void 0 : icon.text) {
3471
3498
  return {
3472
- avatar: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.INITIALS, children: icon.text })
3499
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.INITIALS, children: icon.text })
3473
3500
  };
3474
3501
  }
3475
3502
  return null;
3476
3503
  };
3477
- var mapAvatar = (image) => {
3478
- return image && image.url ? {
3479
- avatar: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: image.url, alt: "User avatar" }) })
3480
- } : null;
3481
- };
3482
3504
  var mapSchemaToUploadOptions = ({ accepts }) => __spreadValues({}, isArray(accepts) && { usAccept: accepts.join(",") });
3483
3505
  var getOptionDescription = (title, description) => {
3484
3506
  if (title && description) {
@@ -3495,7 +3517,7 @@ var getDisabled = (disabled) => {
3495
3517
  };
3496
3518
 
3497
3519
  // src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
3498
- var import_jsx_runtime22 = require("react/jsx-runtime");
3520
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3499
3521
  var isNativeInput = (propsSchemaType) => {
3500
3522
  return propsSchemaType === "string" || propsSchemaType === "number";
3501
3523
  };
@@ -3580,7 +3602,7 @@ var SchemaFormControl = (props) => {
3580
3602
  // TODO: LOW avoid type assertion below
3581
3603
  uploadProps: mapSchemaToUploadOptions(props.schema)
3582
3604
  };
3583
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps));
3605
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps));
3584
3606
  };
3585
3607
  SchemaFormControl.defaultProps = {
3586
3608
  value: null,
@@ -3651,7 +3673,7 @@ function getSchemaProperties(childSchema) {
3651
3673
  }
3652
3674
 
3653
3675
  // src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
3654
- var import_jsx_runtime23 = require("react/jsx-runtime");
3676
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3655
3677
  var OneOfSchema5 = (props) => {
3656
3678
  const onEvent = useEventDispatcher();
3657
3679
  const [changed, setChanged] = (0, import_react14.useState)(false);
@@ -3724,11 +3746,11 @@ var OneOfSchema5 = (props) => {
3724
3746
  "form-group": true,
3725
3747
  "has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
3726
3748
  };
3727
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3728
- (props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
3729
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
3749
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3750
+ (props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3751
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
3730
3752
  getTitleAndHelp(props.schema, id),
3731
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3753
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3732
3754
  SchemaFormControl_default,
3733
3755
  {
3734
3756
  id,
@@ -3741,7 +3763,7 @@ var OneOfSchema5 = (props) => {
3741
3763
  onSearchChange
3742
3764
  }
3743
3765
  ),
3744
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3766
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3745
3767
  ControlFeedback_default,
3746
3768
  {
3747
3769
  changed,
@@ -3755,9 +3777,9 @@ var OneOfSchema5 = (props) => {
3755
3777
  }
3756
3778
  )
3757
3779
  ] }),
3758
- props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DynamicAlert_default, { component: props.schema.alert })
3780
+ props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DynamicAlert_default, { component: props.schema.alert })
3759
3781
  ] }),
3760
- isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3782
+ isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3761
3783
  GenericSchema_default,
3762
3784
  {
3763
3785
  schema: props.schema.oneOf[schemaIndex],
@@ -3773,12 +3795,12 @@ var OneOfSchema5 = (props) => {
3773
3795
  ] });
3774
3796
  };
3775
3797
  function getTitleAndHelp(schema2, id) {
3776
- const helpElement = schema2.help ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Help_default, { help: schema2.help }) : null;
3777
- const titleElement = isConstSchema(schema2.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
3798
+ const helpElement = schema2.help ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Help_default, { help: schema2.help }) : null;
3799
+ const titleElement = isConstSchema(schema2.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
3778
3800
  schema2.title,
3779
3801
  " ",
3780
3802
  helpElement
3781
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("h4", { className: "m-b-2", children: [
3803
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("h4", { className: "m-b-2", children: [
3782
3804
  schema2.title,
3783
3805
  " ",
3784
3806
  helpElement
@@ -3824,7 +3846,7 @@ var import_react16 = require("react");
3824
3846
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
3825
3847
  var import_components10 = require("@transferwise/components");
3826
3848
  var import_react15 = require("react");
3827
- var import_jsx_runtime24 = require("react/jsx-runtime");
3849
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3828
3850
  var UploadInputAdapter = (props) => {
3829
3851
  const {
3830
3852
  id,
@@ -3858,7 +3880,7 @@ var UploadInputAdapter = (props) => {
3858
3880
  }
3859
3881
  });
3860
3882
  };
3861
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3883
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3862
3884
  import_components10.UploadInput,
3863
3885
  {
3864
3886
  id,
@@ -3878,7 +3900,7 @@ var UploadInputAdapter = (props) => {
3878
3900
  };
3879
3901
 
3880
3902
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
3881
- var import_jsx_runtime25 = require("react/jsx-runtime");
3903
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3882
3904
  var PersistAsyncBlobSchema = (props) => {
3883
3905
  const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react16.useState)({});
3884
3906
  const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react16.useState)(null);
@@ -3920,8 +3942,8 @@ var PersistAsyncBlobSchema = (props) => {
3920
3942
  "form-group": true,
3921
3943
  "has-error": (props.submitted || changed) && !!combinedValidations.length
3922
3944
  };
3923
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
3924
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3945
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
3946
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3925
3947
  UploadInputAdapter,
3926
3948
  __spreadValues({
3927
3949
  id: props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty,
@@ -3938,7 +3960,7 @@ var PersistAsyncBlobSchema = (props) => {
3938
3960
  onCancel
3939
3961
  }, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
3940
3962
  ),
3941
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3963
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3942
3964
  ControlFeedback_default,
3943
3965
  {
3944
3966
  blurred: true,
@@ -3962,17 +3984,17 @@ PersistAsyncBlobSchema.defaultProps = {
3962
3984
  var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
3963
3985
 
3964
3986
  // src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
3965
- var import_jsx_runtime26 = require("react/jsx-runtime");
3987
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3966
3988
  var PersistAsyncSchema = (props) => {
3967
3989
  const { schema: schema2 } = props;
3968
3990
  const persistAsyncSchemaType = schema2.persistAsync.schema.type;
3969
3991
  if (persistAsyncSchemaType === "blob") {
3970
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3992
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3971
3993
  PersistAsyncBlobSchema_default,
3972
3994
  __spreadValues({}, props)
3973
3995
  );
3974
3996
  }
3975
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
3997
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
3976
3998
  };
3977
3999
  PersistAsyncSchema.defaultProps = {
3978
4000
  required: false
@@ -3993,7 +4015,7 @@ var getSelectionFromModel = (schema2, model) => {
3993
4015
 
3994
4016
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
3995
4017
  var import_components11 = require("@transferwise/components");
3996
- var import_jsx_runtime27 = require("react/jsx-runtime");
4018
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3997
4019
  var PromotedOneOfCheckboxControl = (props) => {
3998
4020
  const { id, selection, setSelection } = props;
3999
4021
  const { promoted, other, checkedMeans } = props.promotion;
@@ -4004,33 +4026,33 @@ var PromotedOneOfCheckboxControl = (props) => {
4004
4026
  const toggleSelection = () => {
4005
4027
  setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
4006
4028
  };
4007
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components11.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
4029
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components11.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
4008
4030
  };
4009
4031
  PromotedOneOfCheckboxControl.defaultProps = {};
4010
4032
  var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
4011
4033
 
4012
4034
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
4013
4035
  var import_components12 = require("@transferwise/components");
4014
- var import_jsx_runtime28 = require("react/jsx-runtime");
4036
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4015
4037
  var PromotedOneOfRadioControl = (props) => {
4016
4038
  var _a, _b;
4017
4039
  const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
4018
4040
  const radios = [
4019
- __spreadValues(__spreadValues({
4041
+ __spreadValues({
4020
4042
  value: "promoted",
4021
4043
  // TODO: LOW avoid type assertion below the expression may be nullish, but "label" cannot be
4022
4044
  label: ((_a = promotion.promoted) == null ? void 0 : _a.title) || promotedOneOf.title,
4023
4045
  secondary: ((_b = promotion.promoted) == null ? void 0 : _b.description) || promotedOneOf.description
4024
- }, mapIconToAvatar(promotedOneOf.icon)), mapAvatar(promotedOneOf.image)),
4025
- __spreadValues(__spreadValues({
4046
+ }, getAvatarPropertyForRadioOption(promotedOneOf)),
4047
+ __spreadValues({
4026
4048
  value: "other",
4027
4049
  label: promotion.other.title,
4028
4050
  secondary: promotion.other.description
4029
- }, mapIconToAvatar(promotion.other.icon)), mapAvatar(promotion.other.image))
4051
+ }, getAvatarPropertyForRadioOption(promotion.other))
4030
4052
  ];
4031
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "form-group", children: [
4032
- title && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
4033
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4053
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "form-group", children: [
4054
+ title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
4055
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4034
4056
  import_components12.RadioGroup,
4035
4057
  {
4036
4058
  name: "promoted-selection",
@@ -4048,16 +4070,16 @@ PromotedOneOfRadioControl.defaultProps = {
4048
4070
  var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
4049
4071
 
4050
4072
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
4051
- var import_jsx_runtime29 = require("react/jsx-runtime");
4073
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4052
4074
  var PromotedOneOfControl = (props) => {
4053
4075
  const controlType = props.promotion.control || "radio";
4054
4076
  switch (controlType) {
4055
4077
  case "radio":
4056
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
4078
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
4057
4079
  case "checkbox":
4058
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
4080
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
4059
4081
  default:
4060
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, {});
4082
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, {});
4061
4083
  }
4062
4084
  };
4063
4085
  PromotedOneOfControl.defaultProps = {
@@ -4067,7 +4089,7 @@ PromotedOneOfControl.defaultProps = {
4067
4089
  var PromotedOneOfControl_default = PromotedOneOfControl;
4068
4090
 
4069
4091
  // src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
4070
- var import_jsx_runtime30 = require("react/jsx-runtime");
4092
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4071
4093
  var isPromoted = (schema2) => schema2.promoted === true;
4072
4094
  var PromotedOneOfSchema = (props) => {
4073
4095
  var _a;
@@ -4078,9 +4100,9 @@ var PromotedOneOfSchema = (props) => {
4078
4100
  const promotedOneOf = props.schema.oneOf.find(isPromoted);
4079
4101
  const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
4080
4102
  const otherOneOf = getOtherOneOf(props.schema);
4081
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
4082
- promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DynamicAlert_default, { component: promotedAlert }),
4083
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4103
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4104
+ promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DynamicAlert_default, { component: promotedAlert }),
4105
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4084
4106
  PromotedOneOfControl_default,
4085
4107
  {
4086
4108
  id: props.schema.$id,
@@ -4091,8 +4113,8 @@ var PromotedOneOfSchema = (props) => {
4091
4113
  setSelection
4092
4114
  }
4093
4115
  ),
4094
- selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
4095
- selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
4116
+ selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
4117
+ selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
4096
4118
  ] });
4097
4119
  };
4098
4120
  function getPromotedObjectSchema(promotedSchema) {
@@ -4141,12 +4163,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl11.defineMessages)({
4141
4163
  });
4142
4164
 
4143
4165
  // src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
4144
- var import_jsx_runtime31 = require("react/jsx-runtime");
4166
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4145
4167
  var ReadOnlySchema = ({ schema: schema2, model }) => {
4146
4168
  const { title = "" } = schema2;
4147
4169
  const { formatMessage } = (0, import_react_intl12.useIntl)();
4148
4170
  const value = getValueForSchema({ schema: schema2, model, formatMessage });
4149
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.DefinitionList, { layout: import_components13.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
4171
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components13.DefinitionList, { layout: import_components13.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
4150
4172
  };
4151
4173
  var ReadOnlySchema_default = ReadOnlySchema;
4152
4174
  function getValueForSchema({
@@ -4178,22 +4200,17 @@ function getSelectedOneOf(schema2, model) {
4178
4200
  }
4179
4201
  function getValueFromOption(option) {
4180
4202
  const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
4181
- const currencyFlag = getCurrencyFlagFromOption(option);
4182
- return currencyFlag ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4183
- currencyFlag,
4203
+ const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
4204
+ return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4205
+ icon.avatar,
4184
4206
  " ",
4185
4207
  text
4186
4208
  ] }) : text;
4187
4209
  }
4188
- function getCurrencyFlagFromOption(option) {
4189
- var _a, _b;
4190
- const currency = (_b = getCurrencyFlag((_a = option.icon) == null ? void 0 : _a.name)) == null ? void 0 : _b.currency;
4191
- return currency ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("i", { className: `currency-flag currency-flag-${currency} hidden-xs` }) : null;
4192
- }
4193
4210
 
4194
4211
  // src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
4195
4212
  var import_react18 = require("react");
4196
- var import_jsx_runtime32 = require("react/jsx-runtime");
4213
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4197
4214
  var ValidationAsyncSchema = (props) => {
4198
4215
  const [validationAsyncModel, setValidationAsyncModel] = (0, import_react18.useState)(props.model);
4199
4216
  const previousRequestedModelReference = (0, import_react18.useRef)(null);
@@ -4276,13 +4293,13 @@ var ValidationAsyncSchema = (props) => {
4276
4293
  onBlur,
4277
4294
  infoMessage: validationAsyncSuccessMessage
4278
4295
  };
4279
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
4296
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
4280
4297
  };
4281
4298
  ValidationAsyncSchema.defaultProps = { required: false };
4282
4299
  var ValidationAsyncSchema_default = ValidationAsyncSchema;
4283
4300
 
4284
4301
  // src/jsonSchemaForm/genericSchema/GenericSchema.tsx
4285
- var import_jsx_runtime33 = require("react/jsx-runtime");
4302
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4286
4303
  var GenericSchemaForm = (props) => {
4287
4304
  const { schema: schema2, model = null, errors = null, hideTitle = false, disabled = false } = props;
4288
4305
  const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
@@ -4294,22 +4311,22 @@ var GenericSchemaForm = (props) => {
4294
4311
  );
4295
4312
  switch (type) {
4296
4313
  case "readOnly":
4297
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
4314
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
4298
4315
  case "persistAsync":
4299
4316
  if (isPersistAsyncSchema(schema2) && isNullableStringModel(model) && isBasicError(errors)) {
4300
4317
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4301
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncSchema_default, __spreadValues({}, filteredProps));
4318
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PersistAsyncSchema_default, __spreadValues({}, filteredProps));
4302
4319
  } else {
4303
4320
  logInvalidSchemaWarning();
4304
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PersistAsyncSchema_default, __spreadValues({}, props));
4321
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PersistAsyncSchema_default, __spreadValues({}, props));
4305
4322
  }
4306
4323
  case "validationAsync":
4307
4324
  if (isValidationAsyncSchema(schema2) && isNullableBasicModel(model) && isBasicError(errors)) {
4308
4325
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4309
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ValidationAsyncSchema_default, __spreadValues({}, filteredProps));
4326
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ValidationAsyncSchema_default, __spreadValues({}, filteredProps));
4310
4327
  } else {
4311
4328
  logInvalidSchemaWarning();
4312
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ValidationAsyncSchema_default, __spreadValues({}, props));
4329
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ValidationAsyncSchema_default, __spreadValues({}, props));
4313
4330
  }
4314
4331
  case "basic": {
4315
4332
  if (isBasicSchema(schema2) && isNullableBasicModel(model) && isBasicError(errors)) {
@@ -4320,7 +4337,7 @@ var GenericSchemaForm = (props) => {
4320
4337
  model,
4321
4338
  errors
4322
4339
  });
4323
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BasicTypeSchema_default, __spreadValues({}, filteredProps));
4340
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BasicTypeSchema_default, __spreadValues({}, filteredProps));
4324
4341
  } else {
4325
4342
  const filteredProps = __spreadProps(__spreadValues({
4326
4343
  infoMessage: null
@@ -4330,56 +4347,56 @@ var GenericSchemaForm = (props) => {
4330
4347
  errors
4331
4348
  });
4332
4349
  logInvalidSchemaWarning();
4333
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(BasicTypeSchema_default, __spreadValues({}, filteredProps));
4350
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BasicTypeSchema_default, __spreadValues({}, filteredProps));
4334
4351
  }
4335
4352
  }
4336
4353
  case "object":
4337
4354
  if (isObjectSchema(schema2) && isNullableObjectModel(model)) {
4338
4355
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4339
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ObjectSchema_default, __spreadValues({}, filteredProps), JSON.stringify(schema2));
4356
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ObjectSchema_default, __spreadValues({}, filteredProps), JSON.stringify(schema2));
4340
4357
  } else {
4341
4358
  logInvalidSchemaWarning();
4342
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ObjectSchema_default, __spreadValues({}, props));
4359
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ObjectSchema_default, __spreadValues({}, props));
4343
4360
  }
4344
4361
  case "array":
4345
4362
  if (isArraySchema(schema2) && isNullableArrayModel(model) && isBasicError(errors)) {
4346
4363
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4347
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ArraySchema_default, __spreadValues({}, filteredProps));
4364
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ArraySchema_default, __spreadValues({}, filteredProps));
4348
4365
  } else {
4349
4366
  logInvalidSchemaWarning();
4350
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ArraySchema_default, __spreadValues({}, props));
4367
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ArraySchema_default, __spreadValues({}, props));
4351
4368
  }
4352
4369
  case "promotedOneOf":
4353
4370
  if (isOneOfObjectSchema(schema2) && isNullableObjectModel(model)) {
4354
4371
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4355
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PromotedOneOfSchema_default, __spreadValues({}, filteredProps));
4372
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfSchema_default, __spreadValues({}, filteredProps));
4356
4373
  } else {
4357
4374
  logInvalidSchemaWarning();
4358
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PromotedOneOfSchema_default, __spreadValues({}, props));
4375
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfSchema_default, __spreadValues({}, props));
4359
4376
  }
4360
4377
  case "oneOf":
4361
4378
  if (isOneOfSchema(schema2)) {
4362
4379
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4363
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OneOfSchema_default, __spreadValues({}, filteredProps));
4380
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OneOfSchema_default, __spreadValues({}, filteredProps));
4364
4381
  } else {
4365
4382
  logInvalidSchemaWarning();
4366
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(OneOfSchema_default, __spreadValues({}, props));
4383
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OneOfSchema_default, __spreadValues({}, props));
4367
4384
  }
4368
4385
  case "allOf":
4369
4386
  if (isAllOfSchema(schema2) && isObjectModel(model)) {
4370
4387
  const filteredProps = __spreadProps(__spreadValues({}, schemaProps), { schema: schema2, model, errors });
4371
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AllOfSchema_default, __spreadValues({}, filteredProps));
4388
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AllOfSchema_default, __spreadValues({}, filteredProps));
4372
4389
  } else {
4373
4390
  logInvalidSchemaWarning();
4374
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AllOfSchema_default, __spreadValues({}, props));
4391
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AllOfSchema_default, __spreadValues({}, props));
4375
4392
  }
4376
4393
  }
4377
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, {});
4394
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {});
4378
4395
  };
4379
4396
  var GenericSchema_default = GenericSchemaForm;
4380
4397
 
4381
4398
  // src/jsonSchemaForm/JsonSchemaForm.tsx
4382
- var import_jsx_runtime34 = require("react/jsx-runtime");
4399
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4383
4400
  var JsonSchemaForm = (props) => {
4384
4401
  const schemaProps = __spreadValues({
4385
4402
  model: null,
@@ -4388,26 +4405,26 @@ var JsonSchemaForm = (props) => {
4388
4405
  baseUrl: ""
4389
4406
  }, props);
4390
4407
  if (useHasHttpClientProvider() || schemaProps.baseUrl == null) {
4391
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
4408
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
4392
4409
  }
4393
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4410
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4394
4411
  Providers,
4395
4412
  {
4396
4413
  baseUrl: schemaProps.baseUrl,
4397
4414
  onEvent: schemaProps.onEvent,
4398
4415
  onLog: schemaProps.onLog,
4399
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
4416
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
4400
4417
  }
4401
4418
  );
4402
4419
  };
4403
4420
  var JsonSchemaForm_default = JsonSchemaForm;
4404
4421
  var Providers = ({ baseUrl, onEvent, onLog, children }) => {
4405
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4422
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4406
4423
  EventsContextProvider,
4407
4424
  {
4408
4425
  metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
4409
4426
  onEvent: onEvent != null ? onEvent : noop2,
4410
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
4427
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
4411
4428
  }
4412
4429
  ) });
4413
4430
  };
@@ -4415,11 +4432,11 @@ var noop2 = () => {
4415
4432
  };
4416
4433
 
4417
4434
  // src/layout/form/DynamicForm.tsx
4418
- var import_jsx_runtime35 = require("react/jsx-runtime");
4435
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4419
4436
  var DynamicForm = (props) => {
4420
4437
  const form = props.component;
4421
4438
  const formSchema = form.schema;
4422
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: getMarginBottom(form.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
4439
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getMarginBottom(form.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4423
4440
  JsonSchemaForm_default,
4424
4441
  {
4425
4442
  schema: formSchema,
@@ -4436,38 +4453,41 @@ var DynamicForm = (props) => {
4436
4453
  var DynamicForm_default = DynamicForm;
4437
4454
 
4438
4455
  // src/layout/heading/DynamicHeading.tsx
4439
- var import_jsx_runtime36 = require("react/jsx-runtime");
4456
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4440
4457
  var DynamicHeading = (props) => {
4441
4458
  const { text, size = "md", align = "left", margin = "md" } = props.component;
4442
4459
  const classes = getTextAlignmentAndMargin({ align, margin });
4443
4460
  switch (size) {
4444
4461
  case "xs":
4445
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h5", { className: classes, children: text });
4462
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h5", { className: classes, children: text });
4446
4463
  case "sm":
4447
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h4", { className: classes, children: text });
4464
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h4", { className: classes, children: text });
4448
4465
  case "lg":
4449
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h2", { className: classes, children: text });
4466
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: classes, children: text });
4450
4467
  case "xl":
4451
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h1", { className: classes, children: text });
4468
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: classes, children: text });
4452
4469
  case "md":
4453
4470
  default:
4454
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: classes, children: text });
4471
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: classes, children: text });
4455
4472
  }
4456
4473
  };
4457
4474
  var DynamicHeading_default = DynamicHeading;
4458
4475
 
4459
- // src/layout/info/DynamicInfo.tsx
4476
+ // src/layout/markdown/DynamicMarkdown.tsx
4460
4477
  var import_components14 = require("@transferwise/components");
4461
- var import_jsx_runtime37 = require("react/jsx-runtime");
4478
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4479
+ var DynamicMarkdown = ({ component }) => {
4480
+ const { content, align, margin } = component;
4481
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
4482
+ };
4462
4483
  var DynamicInfo = ({ component }) => {
4463
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
4484
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
4464
4485
  };
4465
- var DynamicInfo_default = DynamicInfo;
4466
4486
 
4467
4487
  // src/layout/image/DynamicImage.tsx
4468
4488
  var import_components15 = require("@transferwise/components");
4469
4489
  var import_react19 = require("react");
4470
- var import_jsx_runtime38 = require("react/jsx-runtime");
4490
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4471
4491
  var DynamicImage = ({ component: image }) => {
4472
4492
  const { url, size, text, margin } = image;
4473
4493
  const httpClient = useHttpClient();
@@ -4484,7 +4504,7 @@ var DynamicImage = ({ component: image }) => {
4484
4504
  if (!imageSource) {
4485
4505
  return null;
4486
4506
  }
4487
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: `df-image ${size || "xl"}`, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components15.Image, __spreadValues({ className: `img-responsive ${getMarginBottom(margin || "lg")}` }, imageProps)) });
4507
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `df-image ${size || "xl"}`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components15.Image, __spreadValues({ className: `img-responsive ${getMarginBottom(margin || "lg")}` }, imageProps)) });
4488
4508
  };
4489
4509
  var readImageBlobAsDataURL = (imageBlob) => {
4490
4510
  return new Promise((resolve, reject) => {
@@ -4517,28 +4537,30 @@ var getImageSource = async (httpClient, imageUrl) => {
4517
4537
  var DynamicImage_default = DynamicImage;
4518
4538
 
4519
4539
  // src/layout/DynamicLayout.tsx
4520
- var import_jsx_runtime39 = require("react/jsx-runtime");
4540
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4521
4541
  var getKey = (component) => JSON.stringify(component);
4522
4542
  var DynamicLayout = (props) => {
4523
4543
  const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
4524
4544
  const renderComponent = (component) => {
4525
4545
  switch (component.type) {
4526
4546
  case "heading":
4527
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicHeading_default, { component }, getKey(component));
4547
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicHeading_default, { component }, getKey(component));
4528
4548
  case "paragraph":
4529
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicParagraph_default, { component }, getKey(component));
4549
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicParagraph_default, { component }, getKey(component));
4530
4550
  case "image":
4531
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicImage_default, { component }, getKey(component));
4551
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicImage_default, { component }, getKey(component));
4532
4552
  case "alert":
4533
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicAlert_default, { component }, getKey(component));
4553
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicAlert_default, { component }, getKey(component));
4534
4554
  case "review":
4535
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
4555
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
4536
4556
  case "divider":
4537
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicDivider_default, { component }, getKey(component));
4557
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicDivider_default, { component }, getKey(component));
4538
4558
  case "info":
4539
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicInfo_default, { component }, getKey(component));
4559
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicInfo, { component }, getKey(component));
4560
+ case "markdown":
4561
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicMarkdown, { component }, getKey(component));
4540
4562
  case "columns":
4541
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4563
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4542
4564
  DynamicColumns_default,
4543
4565
  {
4544
4566
  component,
@@ -4552,7 +4574,7 @@ var DynamicLayout = (props) => {
4552
4574
  getKey(component)
4553
4575
  );
4554
4576
  case "form":
4555
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4577
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4556
4578
  DynamicForm_default,
4557
4579
  {
4558
4580
  component,
@@ -4562,12 +4584,12 @@ var DynamicLayout = (props) => {
4562
4584
  onModelChange,
4563
4585
  onPersistAsync
4564
4586
  },
4565
- getKey(component)
4587
+ getKey(__spreadProps(__spreadValues({}, component), { errors }))
4566
4588
  );
4567
4589
  case "button":
4568
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
4590
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
4569
4591
  case "box":
4570
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
4592
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4571
4593
  DynamicBox_default,
4572
4594
  {
4573
4595
  component,
@@ -4581,31 +4603,31 @@ var DynamicLayout = (props) => {
4581
4603
  getKey(component)
4582
4604
  );
4583
4605
  case "decision":
4584
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
4606
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
4585
4607
  case "external":
4586
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
4608
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
4587
4609
  case "list":
4588
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicList_default, { component, onAction }, getKey(component));
4610
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicList_default, { component, onAction }, getKey(component));
4589
4611
  case "loading-indicator":
4590
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
4612
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
4591
4613
  default:
4592
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", {}, getKey(component));
4614
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", {}, getKey(component));
4593
4615
  }
4594
4616
  };
4595
4617
  if (useHasHttpClientProvider() || baseUrl == null) {
4596
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: components.map(renderComponent) });
4618
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: components.map(renderComponent) });
4597
4619
  } else {
4598
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
4620
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
4599
4621
  }
4600
4622
  };
4601
4623
  var DynamicLayout_default = DynamicLayout;
4602
4624
 
4603
4625
  // src/layout/list/DynamicList.tsx
4604
4626
  var import_components16 = require("@transferwise/components");
4605
- var import_jsx_runtime40 = require("react/jsx-runtime");
4627
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4606
4628
  var DynamicList = ({ component }) => {
4607
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4608
- component.title ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("h4", { className: "m-b-2", children: [
4629
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4630
+ component.title ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("h4", { className: "m-b-2", children: [
4609
4631
  " ",
4610
4632
  component.title,
4611
4633
  " "
@@ -4618,8 +4640,8 @@ function mapItemToSummary({ title, description, icon, status }) {
4618
4640
  key: `${title}/${description || ""}`,
4619
4641
  title,
4620
4642
  description
4621
- }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
4622
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components16.Summary, __spreadValues({}, props));
4643
+ }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
4644
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components16.Summary, __spreadValues({}, props));
4623
4645
  }
4624
4646
  var statusMap = {
4625
4647
  positive: "done",
@@ -4630,10 +4652,10 @@ var DynamicList_default = DynamicList;
4630
4652
 
4631
4653
  // src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
4632
4654
  var import_components17 = require("@transferwise/components");
4633
- var import_jsx_runtime41 = require("react/jsx-runtime");
4655
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4634
4656
  var DynamicLoadingIndicator = ({ component }) => {
4635
4657
  const { margin, size = "md" } = component;
4636
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
4658
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4637
4659
  import_components17.Loader,
4638
4660
  {
4639
4661
  size,
@@ -4676,9 +4698,9 @@ function noop3() {
4676
4698
  }
4677
4699
 
4678
4700
  // src/layout/paragraph/DynamicParagraph.tsx
4679
- var import_jsx_runtime42 = require("react/jsx-runtime");
4680
- var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BasicDynamicParagraph, { component });
4681
- var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
4701
+ var import_jsx_runtime44 = require("react/jsx-runtime");
4702
+ var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(BasicDynamicParagraph, { component });
4703
+ var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
4682
4704
  " ",
4683
4705
  component.text,
4684
4706
  " "
@@ -4692,8 +4714,8 @@ var CopyableDynamicParagraph = ({ component }) => {
4692
4714
  (_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
4693
4715
  };
4694
4716
  const classNames7 = getTextAlignmentAndMargin({ align: component.align, margin: "sm" }) + " form-control";
4695
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
4696
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4717
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
4718
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4697
4719
  "input",
4698
4720
  {
4699
4721
  type: "text",
@@ -4703,7 +4725,7 @@ var CopyableDynamicParagraph = ({ component }) => {
4703
4725
  style: { textOverflow: "ellipsis" }
4704
4726
  }
4705
4727
  ),
4706
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components19.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
4728
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components19.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
4707
4729
  ] });
4708
4730
  };
4709
4731
  function noop4() {
@@ -4712,7 +4734,7 @@ var DynamicParagraph_default = DynamicParagraph;
4712
4734
 
4713
4735
  // src/layout/review/DynamicReview.tsx
4714
4736
  var import_components20 = require("@transferwise/components");
4715
- var import_jsx_runtime43 = require("react/jsx-runtime");
4737
+ var import_jsx_runtime45 = require("react/jsx-runtime");
4716
4738
  var mapFieldsToDefinitions = ({ label, value }, index) => {
4717
4739
  return { key: String(index), title: label, value };
4718
4740
  };
@@ -4723,7 +4745,7 @@ var DynamicReview = (props) => {
4723
4745
  const review = props.component;
4724
4746
  const margin = getMarginBottom(review.margin || "xs");
4725
4747
  const getReviewAction = (action2) => {
4726
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4748
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4727
4749
  "a",
4728
4750
  {
4729
4751
  href: action2.url,
@@ -4737,12 +4759,12 @@ var DynamicReview = (props) => {
4737
4759
  }
4738
4760
  );
4739
4761
  };
4740
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
4741
- review.title && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h6", { className: "m-b-2", children: [
4762
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
4763
+ review.title && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("h6", { className: "m-b-2", children: [
4742
4764
  review.title,
4743
4765
  review.action && getReviewAction(review.action)
4744
4766
  ] }),
4745
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4767
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4746
4768
  import_components20.DefinitionList,
4747
4769
  {
4748
4770
  layout: getReviewLayout(review.orientation),
@@ -4754,7 +4776,7 @@ var DynamicReview = (props) => {
4754
4776
  var DynamicReview_default = DynamicReview;
4755
4777
 
4756
4778
  // src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
4757
- var import_jsx_runtime44 = require("react/jsx-runtime");
4779
+ var import_jsx_runtime46 = require("react/jsx-runtime");
4758
4780
  var isNullish = (value) => isNull(value) || isUndefined(value);
4759
4781
  var getDefaultValue = (schema2) => {
4760
4782
  return schema2.type === "boolean" && isNullish(schema2.default) ? false : schema2.default;
@@ -4816,7 +4838,10 @@ var BasicTypeSchema = (props) => {
4816
4838
  (0, import_react21.useEffect)(onSchemaChange, [props.schema]);
4817
4839
  (0, import_react21.useEffect)(() => {
4818
4840
  var _a2;
4819
- return setModel((_a2 = props.model) != null ? _a2 : null);
4841
+ const newModel = (_a2 = props.model) != null ? _a2 : null;
4842
+ if (newModel !== model) {
4843
+ setModel(newModel);
4844
+ }
4820
4845
  }, [props.model]);
4821
4846
  const formGroupClasses = {
4822
4847
  "form-group": true,
@@ -4825,15 +4850,15 @@ var BasicTypeSchema = (props) => {
4825
4850
  };
4826
4851
  const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
4827
4852
  const schemaHelp = props.schema.help;
4828
- return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
4829
- props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DynamicAlert_default, { component: props.schema.alert }),
4830
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
4831
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "d-inline-block", children: [
4832
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
4833
- !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Help_default, { help: schemaHelp })
4853
+ return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
4854
+ props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(DynamicAlert_default, { component: props.schema.alert }),
4855
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
4856
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "d-inline-block", children: [
4857
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
4858
+ !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Help_default, { help: schemaHelp })
4834
4859
  ] }),
4835
- !showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Help_default, { help: schemaHelp }),
4836
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4860
+ !showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Help_default, { help: schemaHelp }),
4861
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4837
4862
  SchemaFormControl_default,
4838
4863
  {
4839
4864
  id,
@@ -4845,7 +4870,7 @@ var BasicTypeSchema = (props) => {
4845
4870
  onBlur
4846
4871
  }
4847
4872
  ),
4848
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4873
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4849
4874
  ControlFeedback_default,
4850
4875
  {
4851
4876
  changed,
@@ -4869,7 +4894,7 @@ BasicTypeSchema.defaultProps = {
4869
4894
  var BasicTypeSchema_default = BasicTypeSchema;
4870
4895
 
4871
4896
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
4872
- var import_jsx_runtime45 = require("react/jsx-runtime");
4897
+ var import_jsx_runtime47 = require("react/jsx-runtime");
4873
4898
  var getIdFromResponse = (idProperty, response) => {
4874
4899
  return response[idProperty];
4875
4900
  };
@@ -4961,7 +4986,7 @@ var PersistAsyncBasicSchema = (props) => {
4961
4986
  setPersistAsyncModel(newPersistAsyncModel);
4962
4987
  }
4963
4988
  };
4964
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4989
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
4965
4990
  BasicTypeSchema_default,
4966
4991
  {
4967
4992
  required: props.required,
@@ -5172,18 +5197,18 @@ function useStepPolling(polling, onAction) {
5172
5197
  }
5173
5198
 
5174
5199
  // src/step/layoutStep/LayoutStep.tsx
5175
- var import_jsx_runtime46 = require("react/jsx-runtime");
5176
- var getComponents = (step31, options) => {
5200
+ var import_jsx_runtime48 = require("react/jsx-runtime");
5201
+ var getComponents = (step35, options) => {
5177
5202
  var _a;
5178
- if (!step31 || isEmpty(step31) || !step31.layout && !step31.type) {
5203
+ if (isEmpty(step35)) {
5179
5204
  return [];
5180
5205
  }
5181
- const layout6 = convertStepToLayout(step31, options);
5206
+ const layout6 = convertStepToLayout(step35, options);
5182
5207
  return inlineReferences({
5183
5208
  layout: layout6,
5184
- schemas: step31.schemas || [],
5185
- actions: step31.actions || [],
5186
- model: (_a = step31.model) != null ? _a : null
5209
+ schemas: step35.schemas || [],
5210
+ actions: step35.actions || [],
5211
+ model: (_a = step35.model) != null ? _a : null
5187
5212
  });
5188
5213
  };
5189
5214
  var LayoutStep = (props) => {
@@ -5195,7 +5220,7 @@ var LayoutStep = (props) => {
5195
5220
  onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
5196
5221
  };
5197
5222
  useStepPolling(stepSpecification.polling, onAction);
5198
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
5223
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5199
5224
  DynamicLayout_default,
5200
5225
  {
5201
5226
  components,
@@ -5241,15 +5266,15 @@ var CameraCapture_messages_default = (0, import_react_intl17.defineMessages)({
5241
5266
  // src/step/cameraStep/cameraCapture/components/index.tsx
5242
5267
  var import_components21 = require("@transferwise/components");
5243
5268
  var import_react_intl18 = require("react-intl");
5244
- var import_jsx_runtime47 = require("react/jsx-runtime");
5245
- var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(CaptureButton, { onClick: onCapture }) });
5269
+ var import_jsx_runtime49 = require("react/jsx-runtime");
5270
+ var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(CaptureButton, { onClick: onCapture }) });
5246
5271
  var ReviewBottomBar = ({
5247
5272
  onSubmit,
5248
5273
  onRetry
5249
5274
  }) => {
5250
5275
  const intl = (0, import_react_intl18.useIntl)();
5251
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
5252
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5276
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
5277
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5253
5278
  import_components21.Button,
5254
5279
  {
5255
5280
  className: "m-b-1",
@@ -5260,7 +5285,7 @@ var ReviewBottomBar = ({
5260
5285
  children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
5261
5286
  }
5262
5287
  ),
5263
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5288
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5264
5289
  import_components21.Button,
5265
5290
  {
5266
5291
  className: "m-b-2",
@@ -5274,14 +5299,14 @@ var ReviewBottomBar = ({
5274
5299
  )
5275
5300
  ] }) }) });
5276
5301
  };
5277
- var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5302
+ var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5278
5303
  "button",
5279
5304
  {
5280
5305
  type: "button",
5281
5306
  className: "camera-capture-btn m-b-2",
5282
5307
  "data-testid": "camera-capture-button",
5283
5308
  onClick,
5284
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "camera-capture-btn-inner" })
5309
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "camera-capture-btn-inner" })
5285
5310
  }
5286
5311
  );
5287
5312
 
@@ -5361,7 +5386,7 @@ var useVideoConstraints = (direction) => {
5361
5386
 
5362
5387
  // src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
5363
5388
  var import_react28 = require("react");
5364
- var import_jsx_runtime48 = require("react/jsx-runtime");
5389
+ var import_jsx_runtime50 = require("react/jsx-runtime");
5365
5390
  var captureButtonHeight = 92;
5366
5391
  var reviewButtonsHeight = 120;
5367
5392
  var imageHeight = 40;
@@ -5390,18 +5415,18 @@ var Overlay = ({
5390
5415
  return () => window.removeEventListener("resize", listener);
5391
5416
  });
5392
5417
  let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
5393
- let helperBox = /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
5394
- imageUrl && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
5395
- title && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("h4", { className: "camera-capture-title", children: title }),
5396
- instructions && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { className: "camera-capture-instructions", children: instructions })
5418
+ let helperBox = /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
5419
+ imageUrl && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
5420
+ title && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h4", { className: "camera-capture-title", children: title }),
5421
+ instructions && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("small", { className: "camera-capture-instructions", children: instructions })
5397
5422
  ] });
5398
5423
  const frameBottomMargin = captureButtonHeight + helperBoxHeight;
5399
5424
  if (reviewInstructions) {
5400
5425
  helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
5401
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
5426
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
5402
5427
  const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
5403
5428
  if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
5404
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, {});
5429
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, {});
5405
5430
  }
5406
5431
  }
5407
5432
  const framePosition = {
@@ -5419,14 +5444,14 @@ var Overlay = ({
5419
5444
  width: "90%"
5420
5445
  }
5421
5446
  };
5422
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
5423
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("mask", { id: "mask", children: [
5424
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
5425
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("image", __spreadValues({ href: overlay }, framePosition))
5447
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
5448
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("mask", { id: "mask", children: [
5449
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
5450
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("image", __spreadValues({ href: overlay }, framePosition))
5426
5451
  ] }) }),
5427
- overlay && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
5428
- outline && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("image", __spreadValues({ href: outline }, framePosition)),
5429
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
5452
+ overlay && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
5453
+ outline && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("image", __spreadValues({ href: outline }, framePosition)),
5454
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
5430
5455
  ] });
5431
5456
  };
5432
5457
  var Overlay_default = Overlay;
@@ -5456,13 +5481,13 @@ var NoCameraAccess_messages_default = (0, import_react_intl19.defineMessages)({
5456
5481
  });
5457
5482
 
5458
5483
  // src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
5459
- var import_jsx_runtime49 = require("react/jsx-runtime");
5484
+ var import_jsx_runtime51 = require("react/jsx-runtime");
5460
5485
  var NoCameraAccess = ({ onAction }) => {
5461
5486
  const intl = (0, import_react_intl20.useIntl)();
5462
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5463
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
5464
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
5465
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components22.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
5487
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5488
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
5489
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
5490
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components22.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
5466
5491
  ] }) }) }) });
5467
5492
  };
5468
5493
  var NoCameraAccess_default = NoCameraAccess;
@@ -5486,12 +5511,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl21.defineMessages
5486
5511
  });
5487
5512
 
5488
5513
  // src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
5489
- var import_jsx_runtime50 = require("react/jsx-runtime");
5514
+ var import_jsx_runtime52 = require("react/jsx-runtime");
5490
5515
  var CameraNotSupported = () => {
5491
5516
  const intl = (0, import_react_intl22.useIntl)();
5492
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5493
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
5494
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
5517
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5518
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
5519
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
5495
5520
  ] }) }) }) });
5496
5521
  };
5497
5522
  var CameraNotSupported_default = CameraNotSupported;
@@ -5516,7 +5541,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
5516
5541
  };
5517
5542
 
5518
5543
  // src/step/cameraStep/cameraCapture/CameraCapture.tsx
5519
- var import_jsx_runtime51 = require("react/jsx-runtime");
5544
+ var import_jsx_runtime53 = require("react/jsx-runtime");
5520
5545
  var CameraCapture = ({
5521
5546
  direction = "back",
5522
5547
  overlay = "",
@@ -5585,8 +5610,8 @@ var CameraCapture = ({
5585
5610
  setReviewImage(void 0);
5586
5611
  };
5587
5612
  const handleRetryCameraAccess = () => setMode("CAPTURE");
5588
- const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
5589
- videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5613
+ const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
5614
+ videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5590
5615
  import_react_webcam.default,
5591
5616
  {
5592
5617
  ref: webcamReference,
@@ -5597,7 +5622,7 @@ var CameraCapture = ({
5597
5622
  onUserMedia: handleUserMedia
5598
5623
  }
5599
5624
  ),
5600
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5625
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5601
5626
  Overlay_default,
5602
5627
  {
5603
5628
  overlay,
@@ -5607,11 +5632,11 @@ var CameraCapture = ({
5607
5632
  instructions
5608
5633
  }
5609
5634
  ),
5610
- ready && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
5635
+ ready && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
5611
5636
  ] });
5612
- const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
5613
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
5614
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
5637
+ const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
5638
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
5639
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5615
5640
  Overlay_default,
5616
5641
  {
5617
5642
  overlay,
@@ -5621,19 +5646,19 @@ var CameraCapture = ({
5621
5646
  reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
5622
5647
  }
5623
5648
  ),
5624
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
5649
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
5625
5650
  ] });
5626
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("section", { className: "camera-capture", children: [
5651
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("section", { className: "camera-capture", children: [
5627
5652
  mode === "CAPTURE" && captureScreen,
5628
5653
  mode === "REVIEW" && reviewScreen,
5629
- mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
5630
- mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CameraNotSupported_default, {})
5654
+ mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
5655
+ mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(CameraNotSupported_default, {})
5631
5656
  ] });
5632
5657
  };
5633
5658
  var CameraCapture_default = CameraCapture;
5634
5659
 
5635
5660
  // src/step/cameraStep/CameraStep.tsx
5636
- var import_jsx_runtime52 = require("react/jsx-runtime");
5661
+ var import_jsx_runtime54 = require("react/jsx-runtime");
5637
5662
  function blobToBase64(blob) {
5638
5663
  return new Promise((resolve, _) => {
5639
5664
  const reader = new FileReader();
@@ -5642,11 +5667,11 @@ function blobToBase64(blob) {
5642
5667
  });
5643
5668
  }
5644
5669
  var CameraStep = (props) => {
5645
- const { step: step31, model, onModelChange, onAction } = props;
5670
+ const { step: step35, model, onModelChange, onAction } = props;
5646
5671
  const onEvent = useEventDispatcher();
5647
- const objectSchema = getObjectSchema(step31);
5648
- const cameraSchema = getCameraSchema(step31);
5649
- const action2 = getFirstAction(step31);
5672
+ const objectSchema = getObjectSchema(step35);
5673
+ const cameraSchema = getCameraSchema(step35);
5674
+ const action2 = getFirstAction(step35);
5650
5675
  const { title, image, cameraConfig } = cameraSchema;
5651
5676
  const { assets, direction, instructions } = cameraConfig || {};
5652
5677
  const { overlay, outline } = assets || {};
@@ -5671,7 +5696,7 @@ var CameraStep = (props) => {
5671
5696
  });
5672
5697
  }
5673
5698
  };
5674
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
5699
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5675
5700
  CameraCapture_default,
5676
5701
  {
5677
5702
  overlay,
@@ -5688,8 +5713,8 @@ var CameraStep = (props) => {
5688
5713
  );
5689
5714
  };
5690
5715
  var CameraStep_default = CameraStep;
5691
- function getObjectSchema(step31) {
5692
- const nonHiddenSchemas = filterHiddenSchemas(step31.schemas || []);
5716
+ function getObjectSchema(step35) {
5717
+ const nonHiddenSchemas = filterHiddenSchemas(step35.schemas || []);
5693
5718
  const objectSchema = nonHiddenSchemas[0];
5694
5719
  if (!objectSchema || !isObjectSchema(objectSchema)) {
5695
5720
  throw new Error(
@@ -5698,8 +5723,8 @@ function getObjectSchema(step31) {
5698
5723
  }
5699
5724
  return objectSchema;
5700
5725
  }
5701
- function getCameraSchema(step31) {
5702
- const objectSchema = getObjectSchema(step31);
5726
+ function getCameraSchema(step35) {
5727
+ const objectSchema = getObjectSchema(step35);
5703
5728
  const firstProperty = Object.values(objectSchema.properties)[0];
5704
5729
  if (!firstProperty) {
5705
5730
  throw new Error(
@@ -5708,15 +5733,15 @@ function getCameraSchema(step31) {
5708
5733
  }
5709
5734
  return firstProperty;
5710
5735
  }
5711
- function getFirstAction(step31) {
5736
+ function getFirstAction(step35) {
5712
5737
  var _a, _b;
5713
- if (!step31.schemas || ((_a = filterHiddenSchemas(step31.schemas)) == null ? void 0 : _a.length) !== 1) {
5738
+ if (!step35.schemas || ((_a = filterHiddenSchemas(step35.schemas)) == null ? void 0 : _a.length) !== 1) {
5714
5739
  throw new Error("camera step expects 1 non-hidden object schema");
5715
5740
  }
5716
- if (((_b = step31 == null ? void 0 : step31.actions) == null ? void 0 : _b.length) !== 1) {
5741
+ if (((_b = step35 == null ? void 0 : step35.actions) == null ? void 0 : _b.length) !== 1) {
5717
5742
  throw new Error("camera step expects 1 action");
5718
5743
  }
5719
- return step31.actions[0];
5744
+ return step35.actions[0];
5720
5745
  }
5721
5746
 
5722
5747
  // src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
@@ -5748,12 +5773,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl24.defineMe
5748
5773
  });
5749
5774
 
5750
5775
  // src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
5751
- var import_jsx_runtime53 = require("react/jsx-runtime");
5776
+ var import_jsx_runtime55 = require("react/jsx-runtime");
5752
5777
  var noop5 = () => {
5753
5778
  };
5754
5779
  var ExternalConfirmationStep = ({ url, onClose }) => {
5755
5780
  const { formatMessage } = (0, import_react_intl25.useIntl)();
5756
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5781
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5757
5782
  DynamicLayout_default,
5758
5783
  {
5759
5784
  components: [
@@ -5818,24 +5843,24 @@ function getOrigin(url) {
5818
5843
  }
5819
5844
 
5820
5845
  // src/dynamicFlow/DynamicFlowStep.tsx
5821
- var import_jsx_runtime54 = require("react/jsx-runtime");
5846
+ var import_jsx_runtime56 = require("react/jsx-runtime");
5822
5847
  var DynamicFlowStep = (props) => {
5823
5848
  var _a;
5824
- const { step: step31, globalError } = props;
5825
- const externalUrl = (_a = step31 == null ? void 0 : step31.external) == null ? void 0 : _a.url;
5849
+ const { step: step35, globalError } = props;
5850
+ const externalUrl = (_a = step35 == null ? void 0 : step35.external) == null ? void 0 : _a.url;
5826
5851
  const { requiresManualTrigger, dismissConfirmation } = useExternal(externalUrl);
5827
- if (step31 === void 0) {
5852
+ if (step35 === void 0) {
5828
5853
  return null;
5829
5854
  }
5830
5855
  if (externalUrl && requiresManualTrigger) {
5831
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
5856
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
5832
5857
  }
5833
- if (getStepType(step31) === "camera") {
5834
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step: step31 }));
5858
+ if (isCameraStep(step35)) {
5859
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step: step35 }));
5835
5860
  }
5836
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
5837
- globalError ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
5838
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step31 }))
5861
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
5862
+ globalError ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
5863
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step35 }))
5839
5864
  ] });
5840
5865
  };
5841
5866
 
@@ -5849,16 +5874,15 @@ function useDebouncedRefresh(fetchRefresh) {
5849
5874
  return map.current.get(key);
5850
5875
  }
5851
5876
  const debouncedFetchRefresh = debounce(
5852
- (action2, data, etag) => fetchRefresh(action2, data, etag),
5877
+ (url, data, etag) => fetchRefresh(url, data, etag),
5853
5878
  DEBOUNCE_DELAY
5854
5879
  );
5855
5880
  map.current.set(key, debouncedFetchRefresh);
5856
5881
  return debouncedFetchRefresh;
5857
5882
  };
5858
- return function(action2, data, etag, schema2) {
5859
- const key = action2.url || "";
5860
- const debouncedFetchRefresh = retrieveOrCreate(key);
5861
- void debouncedFetchRefresh(action2, data, etag);
5883
+ return function(url, data, etag, schema2) {
5884
+ const debouncedFetchRefresh = retrieveOrCreate(url);
5885
+ void debouncedFetchRefresh(url, data, etag);
5862
5886
  if (!schema2 || !shouldDebounceSchema(schema2)) {
5863
5887
  void debouncedFetchRefresh.flush();
5864
5888
  }
@@ -5883,16 +5907,16 @@ var useDynamicFlowState = (initialStep) => {
5883
5907
  models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
5884
5908
  etag: void 0
5885
5909
  });
5886
- const { step: step31, models, etag } = stepAndModels;
5887
- const setStepAndEtag = (step32, etag2) => {
5910
+ const { step: step35, models, etag } = stepAndModels;
5911
+ const setStepAndEtag = (step36, etag2) => {
5888
5912
  var _a2, _b2, _c, _d;
5889
5913
  setStepAndModels((previous) => ({
5890
- step: step32,
5891
- models: step32.model ? buildInitialModels(step32.model, getAllSchemas(step32)) : previous.models,
5914
+ step: step36,
5915
+ models: step36.model ? buildInitialModels(step36.model, getAllSchemas(step36)) : previous.models,
5892
5916
  etag: etag2
5893
5917
  }));
5894
- setFormErrors((_b2 = (_a2 = step32 == null ? void 0 : step32.errors) == null ? void 0 : _a2.validation) != null ? _b2 : null);
5895
- setGlobalError((_d = (_c = step32 == null ? void 0 : step32.errors) == null ? void 0 : _c.error) != null ? _d : null);
5918
+ setFormErrors((_b2 = (_a2 = step36 == null ? void 0 : step36.errors) == null ? void 0 : _a2.validation) != null ? _b2 : null);
5919
+ setGlobalError((_d = (_c = step36 == null ? void 0 : step36.errors) == null ? void 0 : _c.error) != null ? _d : null);
5896
5920
  };
5897
5921
  const setSchemaModel = (schemaId, objectModel, onModelsUpdated) => {
5898
5922
  setStepAndModels((previous) => {
@@ -5908,11 +5932,11 @@ var useDynamicFlowState = (initialStep) => {
5908
5932
  return updatedState;
5909
5933
  });
5910
5934
  };
5911
- const modelIsValid = (0, import_react32.useMemo)(() => areModelsValid(models, getAllSchemas(step31)), [models, step31]);
5935
+ const modelIsValid = (0, import_react32.useMemo)(() => areModelsValid(models, getAllSchemas(step35)), [models, step35]);
5912
5936
  return {
5913
5937
  formErrors,
5914
5938
  globalError,
5915
- step: step31,
5939
+ step: step35,
5916
5940
  models,
5917
5941
  etag,
5918
5942
  modelIsValid,
@@ -5932,9 +5956,9 @@ var buildInitialModels = (model, schemas = []) => {
5932
5956
  });
5933
5957
  }, {});
5934
5958
  };
5935
- var getAllSchemas = (step31) => [
5936
- ...getAllSchemasInLayout((step31 == null ? void 0 : step31.layout) || []),
5937
- ...(step31 == null ? void 0 : step31.schemas) || []
5959
+ var getAllSchemas = (step35) => [
5960
+ ...getAllSchemasInLayout((step35 == null ? void 0 : step35.layout) || []),
5961
+ ...(step35 == null ? void 0 : step35.schemas) || []
5938
5962
  ];
5939
5963
  var getAllSchemasInLayout = (components) => components.flatMap((component) => {
5940
5964
  switch (component.type) {
@@ -5960,7 +5984,7 @@ var areModelsValid = (formModels, schemas = []) => {
5960
5984
  // src/dynamicFlow/utils/useLoader.tsx
5961
5985
  var import_components24 = require("@transferwise/components");
5962
5986
  var import_react33 = require("react");
5963
- var import_jsx_runtime55 = require("react/jsx-runtime");
5987
+ var import_jsx_runtime57 = require("react/jsx-runtime");
5964
5988
  function useLoader(loaderConfig, initialState) {
5965
5989
  const config = __spreadValues({
5966
5990
  size: import_components24.Size.EXTRA_LARGE,
@@ -5969,7 +5993,7 @@ function useLoader(loaderConfig, initialState) {
5969
5993
  }, loaderConfig);
5970
5994
  const [loadingState, setLoadingState] = (0, import_react33.useState)(initialState);
5971
5995
  const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
5972
- const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5996
+ const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
5973
5997
  import_components24.Loader,
5974
5998
  {
5975
5999
  size: config.size,
@@ -5977,7 +6001,7 @@ function useLoader(loaderConfig, initialState) {
5977
6001
  "data-testid": "loader"
5978
6002
  }
5979
6003
  ) : null;
5980
- return { loadingState, setLoadingState, loader };
6004
+ return { isLoading: loadingState !== "idle", setLoadingState, loader };
5981
6005
  }
5982
6006
 
5983
6007
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
@@ -6003,10 +6027,10 @@ var ErrorBoundary_messages_default = (0, import_react_intl26.defineMessages)({
6003
6027
  });
6004
6028
 
6005
6029
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
6006
- var import_jsx_runtime56 = require("react/jsx-runtime");
6030
+ var import_jsx_runtime58 = require("react/jsx-runtime");
6007
6031
  var ErrorBoundaryAlert = ({ onDismiss }) => {
6008
6032
  const { formatMessage } = (0, import_react_intl27.useIntl)();
6009
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
6033
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
6010
6034
  import_components25.Alert,
6011
6035
  {
6012
6036
  action: {
@@ -6022,7 +6046,7 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
6022
6046
  };
6023
6047
 
6024
6048
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
6025
- var import_jsx_runtime57 = require("react/jsx-runtime");
6049
+ var import_jsx_runtime59 = require("react/jsx-runtime");
6026
6050
  var noop6 = () => {
6027
6051
  };
6028
6052
  var ErrorBoundary = class extends import_react34.Component {
@@ -6043,8 +6067,8 @@ var ErrorBoundary = class extends import_react34.Component {
6043
6067
  render() {
6044
6068
  const { children } = this.props;
6045
6069
  const { hasError, isFatalError } = this.state;
6046
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
6047
- hasError && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
6070
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
6071
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
6048
6072
  !isFatalError && children
6049
6073
  ] });
6050
6074
  }
@@ -6052,46 +6076,78 @@ var ErrorBoundary = class extends import_react34.Component {
6052
6076
  var ErrorBoundary_default = ErrorBoundary;
6053
6077
 
6054
6078
  // src/dynamicFlow/utils/responseParsers/response-parsers.ts
6055
- var parseFetchResponse = async (response) => {
6056
- var _a;
6057
- assertResponseIsValid(response);
6058
- if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Exit")) {
6059
- return { type: "exit", result: await parseExitResponse(response) };
6079
+ var parseFetchResponseByResponseType = async (response) => {
6080
+ const type = response.headers.get("X-Df-ResponseType");
6081
+ switch (type) {
6082
+ case "step":
6083
+ return parseStepResponse(response);
6084
+ case "exit":
6085
+ return parseExitResponse(response);
6086
+ case "action":
6087
+ return parseActionResponse(response);
6088
+ default:
6089
+ throw new Error(
6090
+ "Unsupported X-Df-ResponseType. Allowed values are 'step', 'action', 'exit'."
6091
+ );
6060
6092
  }
6093
+ };
6094
+ var parseStepResponse = async (response) => {
6061
6095
  const jsonBody = await parseResponseJson(response);
6062
6096
  if (!isObject(jsonBody)) {
6063
6097
  throw new Error("Incorrect response body in response. Expected an object.");
6064
6098
  }
6065
- if (jsonBody.action) {
6066
- if (!isObject(jsonBody.action)) {
6067
- throw new Error(
6068
- "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
6069
- );
6070
- }
6071
- const action2 = jsonBody.action;
6072
- if (action2.exit === true && isObject(action2.result)) {
6073
- return { type: "exit", result: action2.result };
6074
- }
6075
- return { type: "action", action: jsonBody.action };
6076
- }
6077
6099
  const etag = response.headers.get("etag") || void 0;
6078
6100
  return { type: "step", step: jsonBody, etag };
6079
6101
  };
6102
+ var parseActionResponse = async (response) => {
6103
+ const jsonBody = await parseResponseJson(response);
6104
+ if (!isObject(jsonBody)) {
6105
+ throw new Error("Incorrect response body in response. Expected an object.");
6106
+ }
6107
+ if (!isObject(jsonBody.action)) {
6108
+ throw new Error(
6109
+ "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
6110
+ );
6111
+ }
6112
+ const action2 = jsonBody.action;
6113
+ if (action2.exit === true && isObject(action2.result)) {
6114
+ return { type: "exit", result: action2.result };
6115
+ }
6116
+ return { type: "action", action: jsonBody.action };
6117
+ };
6118
+ var parseExitResponse = async (response) => {
6119
+ return { type: "exit", result: await getJsonObjectOrNull(response) };
6120
+ };
6121
+ var parseFetchResponse = async (response) => {
6122
+ var _a, _b;
6123
+ assertResponseIsValid(response);
6124
+ if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-ResponseType")) {
6125
+ return parseFetchResponseByResponseType(response);
6126
+ }
6127
+ if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
6128
+ return parseExitResponse(response);
6129
+ }
6130
+ const jsonBody = await parseResponseJson(response.clone());
6131
+ if (isObject(jsonBody) && jsonBody.action) {
6132
+ return parseActionResponse(response);
6133
+ }
6134
+ return parseStepResponse(response);
6135
+ };
6080
6136
  var parseErrorResponse = async (response) => {
6081
6137
  assertResponseIsValid(response);
6082
6138
  const jsonBody = await parseResponseJson(response);
6083
6139
  if (!isObject(jsonBody)) {
6084
6140
  throw new Error("Incorrect response body in error response. Expected an object.");
6085
6141
  }
6142
+ if (!jsonBody.refreshFormUrl && !jsonBody.validation && !jsonBody.error) {
6143
+ throw jsonBody;
6144
+ }
6086
6145
  return jsonBody;
6087
6146
  };
6088
- var parseExitResponse = async (response) => {
6147
+ var getJsonObjectOrNull = async (response) => {
6089
6148
  assertResponseIsValid(response);
6090
6149
  const result = await parseResponseJson(response);
6091
- if (isObject(result) || result === null) {
6092
- return result;
6093
- }
6094
- return null;
6150
+ return isObject(result) ? result : null;
6095
6151
  };
6096
6152
  var parseResponseJson = async (response) => {
6097
6153
  try {
@@ -6113,7 +6169,7 @@ var assertResponseIsValid = (response) => {
6113
6169
  var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
6114
6170
 
6115
6171
  // src/dynamicFlow/DynamicFlow.tsx
6116
- var import_jsx_runtime58 = require("react/jsx-runtime");
6172
+ var import_jsx_runtime60 = require("react/jsx-runtime");
6117
6173
  var noop7 = () => {
6118
6174
  };
6119
6175
  var DynamicFlowComponent = ({
@@ -6132,7 +6188,7 @@ var DynamicFlowComponent = ({
6132
6188
  const {
6133
6189
  formErrors,
6134
6190
  globalError,
6135
- step: step31,
6191
+ step: step35,
6136
6192
  models,
6137
6193
  etag,
6138
6194
  modelIsValid,
@@ -6142,25 +6198,23 @@ var DynamicFlowComponent = ({
6142
6198
  setSchemaModel
6143
6199
  } = useDynamicFlowState(initialStep);
6144
6200
  const [submitted, setSubmitted] = (0, import_react35.useState)(false);
6145
- const { loadingState, setLoadingState, loader } = useLoader(
6201
+ const { isLoading, loader, setLoadingState } = useLoader(
6146
6202
  loaderConfig,
6147
6203
  initialStep ? "idle" : "initial"
6148
6204
  );
6149
- const logWarning = getLogger("warning", onLog, flowId, step31 == null ? void 0 : step31.key);
6150
- const logError = getLogger("error", onLog, flowId, step31 == null ? void 0 : step31.key);
6151
- const logCritical = getLogger("critical", onLog, flowId, step31 == null ? void 0 : step31.key);
6205
+ const logCritical = getLogger("critical", onLog, flowId, (step35 == null ? void 0 : step35.id) || (step35 == null ? void 0 : step35.key));
6152
6206
  const analyticsMetadata = (0, import_react35.useMemo)(
6153
6207
  () => {
6154
6208
  var _a;
6155
- return __spreadValues({ flowId, stepId: step31 == null ? void 0 : step31.key }, (_a = step31 == null ? void 0 : step31.analytics) != null ? _a : {});
6209
+ return __spreadValues({ flowId, stepId: (step35 == null ? void 0 : step35.id) || (step35 == null ? void 0 : step35.key) }, (_a = step35 == null ? void 0 : step35.analytics) != null ? _a : {});
6156
6210
  },
6157
- [flowId, step31]
6211
+ [flowId, step35]
6158
6212
  );
6159
6213
  const dispatchEvent = (0, import_react35.useMemo)(
6160
6214
  () => getEventDispatcher(onEvent, analyticsMetadata),
6161
6215
  [onEvent, analyticsMetadata]
6162
6216
  );
6163
- const triggerActionRequest = (0, import_react35.useCallback)(
6217
+ const dfHttpClient = (0, import_react35.useCallback)(
6164
6218
  ({ action: action2, data, etag: etag2 }) => {
6165
6219
  const { url, method = "POST" } = action2;
6166
6220
  return httpClient(url != null ? url : "", {
@@ -6176,37 +6230,40 @@ var DynamicFlowComponent = ({
6176
6230
  },
6177
6231
  [httpClient, locale]
6178
6232
  );
6179
- const fetchNextStep = async (action2, data = {}) => {
6180
- setLoadingState(loadingState === "initial" ? "initial" : "submission");
6233
+ const performAction = async (action2, data = {}) => {
6234
+ setLoadingState(!step35 ? "initial" : "submission");
6235
+ dispatchEvent("Dynamic Flow - Step Submitted", { actionId: action2.$id });
6181
6236
  try {
6182
- dispatchEvent("Dynamic Flow - Step Submitted", { actionId: action2.$id });
6183
- const response = await triggerActionRequest({ action: action2, data });
6184
- return handleFetchResponse(response, "submission");
6237
+ const response = await dfHttpClient({ action: action2, data });
6238
+ await handleResponse(response, "submission");
6185
6239
  } catch (error) {
6186
- handleFetchError(error, "Error fetching next step");
6240
+ completeWithError(error, "Error fetching next step");
6187
6241
  }
6188
6242
  };
6189
- const fetchRefreshStep = async (action2, data, etag2) => {
6243
+ const performRefresh = async (url, data, etag2) => {
6190
6244
  setLoadingState("refresh");
6245
+ dispatchEvent("Dynamic Flow - Step Refreshed", { status: "pending" });
6191
6246
  try {
6192
- dispatchEvent("Dynamic Flow - Step Refreshed", { status: "pending" });
6193
- const response = await triggerActionRequest({ action: action2, data, etag: etag2 });
6194
- await handleFetchResponse(response, "refresh");
6195
- setLoadingState("idle");
6247
+ const response = await dfHttpClient({ action: { url, method: "POST" }, data, etag: etag2 });
6248
+ await handleResponse(response, "refresh");
6196
6249
  } catch (error) {
6197
- handleFetchError(error, "Error fetching refresh step");
6250
+ completeWithError(error, "Error fetching refresh step");
6198
6251
  }
6199
6252
  };
6200
- const fetchExitResult = async (action2, data) => {
6253
+ const performExitAction = async (action2, data) => {
6254
+ setLoadingState("submission");
6201
6255
  try {
6202
- const response = await triggerActionRequest({ action: action2, data });
6203
- const exitResult = await parseExitResponse(response);
6204
- dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), action2.result));
6256
+ const response = await dfHttpClient({ action: action2, data });
6257
+ await handleExitResponse(response, action2.result);
6205
6258
  } catch (error) {
6206
- handleFetchError(error, "Error fetching exit result");
6259
+ completeWithError(error, "Error fetching exit result");
6207
6260
  }
6208
6261
  };
6209
- const debouncedFetchRefresh = useDebouncedRefresh(fetchRefreshStep);
6262
+ const handleExitResponse = async (response, actionResult) => {
6263
+ const exitResult = await getJsonObjectOrNull(response);
6264
+ dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
6265
+ };
6266
+ const debouncedRefresh = useDebouncedRefresh(performRefresh);
6210
6267
  const dispatchEventAndComplete = (0, import_react35.useCallback)(
6211
6268
  (result) => {
6212
6269
  dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
@@ -6223,79 +6280,63 @@ var DynamicFlowComponent = ({
6223
6280
  $id: "#initial-step-request",
6224
6281
  method: "GET"
6225
6282
  }, initialAction);
6226
- void fetchNextStep(action2, action2.data);
6283
+ void performAction(action2, action2.data);
6227
6284
  }
6228
6285
  }, [httpClient, locale, JSON.stringify(initialStep), JSON.stringify(initialAction)]);
6229
- const handleFetchResponse = async (response, fetchType) => {
6230
- if (response.ok) {
6231
- try {
6232
- const parsedResponse = await parseFetchResponse(response);
6233
- switch (parsedResponse.type) {
6234
- case "action":
6235
- void fetchNextStep(parsedResponse.action, parsedResponse.action.data);
6236
- return;
6237
- case "exit":
6238
- return dispatchEventAndComplete(parsedResponse.result);
6239
- case "step":
6240
- default: {
6241
- const { step: step32, etag: etag2 } = parsedResponse;
6242
- return fetchType === "submission" ? updateStepAfterSubmission(step32, etag2) : updateStepAfterRefresh(step32, etag2);
6243
- }
6244
- }
6245
- } catch (error) {
6246
- return handleFetchError(error, "Error parsing fetch response");
6286
+ const handleResponse = async (response, fetchType) => {
6287
+ try {
6288
+ if (response.status === 304) {
6289
+ setLoadingState("idle");
6290
+ return;
6291
+ }
6292
+ if (!response.ok) {
6293
+ const errorResponse = await parseErrorResponse(response);
6294
+ void updateAfterError(errorResponse);
6295
+ return;
6296
+ }
6297
+ const result = await parseFetchResponse(response);
6298
+ if (result.type === "action") {
6299
+ void performAction(result.action, result.action.data);
6300
+ } else if (result.type === "exit") {
6301
+ dispatchEventAndComplete(result.result);
6302
+ } else {
6303
+ updateStep(result.step, result.etag, fetchType);
6247
6304
  }
6305
+ } catch (error) {
6306
+ return completeWithError(error, "Error parsing fetch response", fetchType, response.status);
6248
6307
  }
6249
- return handleErrorResponse(response, fetchType);
6250
6308
  };
6251
- const updateStepAfterSubmission = (newStep, etag2) => {
6309
+ const updateStep = (newStep, etag2, fetchType) => {
6252
6310
  setStepAndEtag(newStep, etag2);
6253
- setSubmitted(false);
6254
- setLoadingState("idle");
6255
- dispatchEvent("Dynamic Flow - Step Started", __spreadValues({ stepId: newStep.key }, newStep == null ? void 0 : newStep.analytics));
6256
- };
6257
- const updateStepAfterRefresh = (step32, etag2) => {
6258
- setStepAndEtag(step32, etag2);
6259
6311
  setLoadingState("idle");
6260
- dispatchEvent("Dynamic Flow - Step Refreshed", { status: "success" });
6312
+ if (fetchType === "submission") {
6313
+ setSubmitted(false);
6314
+ dispatchEvent("Dynamic Flow - Step Started", __spreadValues({
6315
+ stepId: newStep.id || newStep.key
6316
+ }, newStep == null ? void 0 : newStep.analytics));
6317
+ } else {
6318
+ dispatchEvent("Dynamic Flow - Step Refreshed", { status: "success" });
6319
+ }
6261
6320
  };
6262
- const handleErrorResponse = async (response, fetchType) => {
6263
- if (response.status === 304) {
6264
- setLoadingState("idle");
6265
- return;
6321
+ const updateAfterError = async (errorBody) => {
6322
+ if (errorBody.refreshFormUrl) {
6323
+ await performRefresh(errorBody.refreshFormUrl, combineModels2(models), etag);
6266
6324
  }
6267
- try {
6268
- const errorBody = await parseErrorResponse(response);
6269
- if (errorBody.refreshFormUrl) {
6270
- const action2 = { url: errorBody == null ? void 0 : errorBody.refreshFormUrl, method: "POST" };
6271
- await fetchRefreshStep(action2, combineModels2(models), etag);
6272
- }
6273
- if (errorBody.validation) {
6274
- setFormErrors(errorBody.validation);
6275
- }
6276
- if (errorBody.error) {
6277
- setGlobalError(errorBody.error);
6278
- }
6279
- if (!errorBody.refreshFormUrl && !errorBody.validation && !errorBody.error) {
6280
- logError(
6281
- "Invalid response",
6282
- "Response body must contain at least one of the following properties: refreshFormUrl, validation, or error."
6283
- );
6284
- throw errorBody;
6285
- }
6286
- } catch (error) {
6287
- if (fetchType === "refresh") {
6288
- dispatchEvent("Dynamic Flow - Step Refreshed", { status: "failure" });
6289
- }
6290
- dispatchEvent("Dynamic Flow - Flow Finished", { status: "failure" });
6291
- onError(error, response.status);
6292
- logError("Invalid response", "Error response body must be an object.");
6325
+ if (errorBody.validation) {
6326
+ setFormErrors(errorBody.validation);
6327
+ }
6328
+ if (errorBody.error) {
6329
+ setGlobalError(errorBody.error);
6293
6330
  }
6294
6331
  setLoadingState("idle");
6295
6332
  };
6296
- const handleFetchError = (error, message) => {
6333
+ const completeWithError = (error, message, fetchType, responseStatus) => {
6297
6334
  logCritical("Error fetching", message);
6298
- onError(error);
6335
+ if (fetchType === "refresh") {
6336
+ dispatchEvent("Dynamic Flow - Step Refreshed", { status: "failure" });
6337
+ }
6338
+ dispatchEvent("Dynamic Flow - Flow Finished", { status: "failure" });
6339
+ onError(error, responseStatus);
6299
6340
  setLoadingState("idle");
6300
6341
  };
6301
6342
  const onModelChange = (onModelChangeProps) => {
@@ -6316,62 +6357,37 @@ var DynamicFlowComponent = ({
6316
6357
  const refreshOnChangeIfNeeded = (props, updatedModels) => {
6317
6358
  const { triggerSchema } = props;
6318
6359
  if (shouldTriggerRefresh(props)) {
6319
- const url = triggerSchema.refreshFormUrl || (step31 == null ? void 0 : step31.refreshFormUrl);
6320
- const action2 = { url, method: "POST" };
6321
- debouncedFetchRefresh(action2, combineModels2(updatedModels), etag, triggerSchema);
6360
+ const url = triggerSchema.refreshFormUrl || (step35 == null ? void 0 : step35.refreshFormUrl);
6361
+ if (url) {
6362
+ debouncedRefresh(url, combineModels2(updatedModels), etag, triggerSchema);
6363
+ }
6322
6364
  }
6323
6365
  };
6324
6366
  const onAction = async (action2) => {
6325
- const { data, method, exit: exit2, url, result } = action2;
6326
- const submissionData = __spreadValues(__spreadValues({}, combineModels2(models)), data);
6327
- const extraLoggingProps = {
6328
- url: action2.url,
6329
- method: action2.method,
6330
- currency: submissionData.currency,
6331
- type: submissionData.type
6332
- };
6333
- if (loadingState !== "idle" || action2.disabled) {
6334
- logWarning(
6335
- "Action supressed",
6336
- loadingState !== "idle" ? `onAction was supressed because loadingState is ${loadingState}` : `onAction was supressed because action is disabled`,
6337
- extraLoggingProps
6338
- );
6367
+ if (isLoading || action2.disabled) {
6339
6368
  return;
6340
6369
  }
6341
- if (exit2) {
6342
- if (url) {
6343
- if (isSubmissionMethod(method)) {
6344
- setFormErrors(null);
6345
- setSubmitted(true);
6346
- if (modelIsValid) {
6347
- await fetchExitResult(action2, submissionData);
6348
- }
6349
- } else {
6350
- await fetchExitResult(action2);
6351
- }
6352
- return;
6353
- }
6354
- dispatchEventAndComplete(result);
6370
+ if (action2.exit && !action2.url) {
6371
+ dispatchEventAndComplete(action2.result);
6355
6372
  return;
6356
6373
  }
6374
+ const actionHandler = action2.exit ? performExitAction : performAction;
6375
+ const { data, method } = action2;
6376
+ const submissionData = __spreadValues(__spreadValues({}, combineModels2(models)), data);
6357
6377
  if (isSubmissionMethod(method)) {
6358
6378
  setFormErrors(null);
6359
6379
  setSubmitted(true);
6360
6380
  if (modelIsValid) {
6361
- void fetchNextStep(action2, submissionData);
6362
- } else {
6363
- dispatchEvent("Dynamic Flow - onAction supressed", __spreadValues({
6364
- reason: "invalid model"
6365
- }, extraLoggingProps));
6381
+ await actionHandler(action2, submissionData);
6366
6382
  }
6367
- return;
6383
+ } else {
6384
+ await actionHandler(action2);
6368
6385
  }
6369
- void fetchNextStep(action2);
6370
6386
  };
6371
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LogProvider, { flowId, stepId: step31 == null ? void 0 : step31.key, onLog, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DynamicFlowProvider, { loading: loadingState !== "idle", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
6387
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(LogProvider, { flowId, stepId: (step35 == null ? void 0 : step35.id) || (step35 == null ? void 0 : step35.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
6372
6388
  DynamicFlowStep,
6373
6389
  {
6374
- step: step31,
6390
+ step: step35,
6375
6391
  model: combineModels2(models),
6376
6392
  submitted,
6377
6393
  globalError,
@@ -6384,7 +6400,7 @@ var DynamicFlowComponent = ({
6384
6400
  }
6385
6401
  ) }) }) }) });
6386
6402
  };
6387
- var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
6403
+ var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
6388
6404
  var DynamicFlow_default = DynamicFlow;
6389
6405
  var combineModels2 = (formModels) => {
6390
6406
  return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
@@ -6409,6 +6425,8 @@ __export(components_exports, {
6409
6425
  columns: () => columns_default,
6410
6426
  copyable: () => copyable_default,
6411
6427
  decision: () => decision_default,
6428
+ decisionFlags: () => decision_flags_default,
6429
+ decisionIcons: () => decision_icons_default,
6412
6430
  heading: () => heading_default,
6413
6431
  image: () => image_default,
6414
6432
  info: () => info_default,
@@ -6420,11 +6438,9 @@ __export(components_exports, {
6420
6438
 
6421
6439
  // src/fixtures/components/alert.ts
6422
6440
  var step = {
6423
- type: "form",
6424
- key: "Components/Alert",
6441
+ id: "Components/Alert",
6425
6442
  title: "Alert Component",
6426
6443
  description: "Alerts can have different contexts.",
6427
- actions: [],
6428
6444
  schemas: [],
6429
6445
  layout: [
6430
6446
  {
@@ -6453,11 +6469,9 @@ var alert_default = step;
6453
6469
 
6454
6470
  // src/fixtures/components/box.ts
6455
6471
  var step2 = {
6456
- type: "form",
6457
- key: "Components/Box",
6472
+ id: "Components/Box",
6458
6473
  title: "Box Component",
6459
6474
  description: "Box is a container for other layour components. It can have a border!",
6460
- actions: [],
6461
6475
  schemas: [],
6462
6476
  layout: ["xs", "sm", "md", "lg", "xl"].map((size) => ({
6463
6477
  type: "box",
@@ -6487,11 +6501,9 @@ var buttons = ["primary", "secondary", "negative", "link"].map(
6487
6501
  })
6488
6502
  );
6489
6503
  var step3 = {
6490
- type: "form",
6491
- key: "Components/Button",
6504
+ id: "Components/Button",
6492
6505
  title: "Button Component",
6493
6506
  description: "Buttons typically trigger actions.",
6494
- actions: [],
6495
6507
  schemas: [
6496
6508
  {
6497
6509
  $id: "#schema",
@@ -6533,11 +6545,9 @@ var button_default = step3;
6533
6545
 
6534
6546
  // src/fixtures/components/columns.ts
6535
6547
  var step4 = {
6536
- type: "form",
6537
- key: "Components/Columns",
6548
+ id: "Components/Columns",
6538
6549
  title: "Columns Component",
6539
6550
  description: `Arrange components in two columns (when there's enough space)`,
6540
- actions: [],
6541
6551
  schemas: [],
6542
6552
  layout: [
6543
6553
  {
@@ -6571,11 +6581,9 @@ var columns_default = step4;
6571
6581
 
6572
6582
  // src/fixtures/components/copyable.ts
6573
6583
  var step5 = {
6574
- key: "Components/Copyable",
6575
- type: "form",
6584
+ id: "Components/Copyable",
6576
6585
  title: "Copyable Text",
6577
6586
  description: "Copyable Text Component.",
6578
- actions: [],
6579
6587
  layout: [
6580
6588
  {
6581
6589
  type: "paragraph",
@@ -6595,11 +6603,9 @@ var copyable_default = step5;
6595
6603
 
6596
6604
  // src/fixtures/components/decision.ts
6597
6605
  var step6 = {
6598
- type: "form",
6599
- key: "Components/Decision",
6606
+ id: "Components/Decision",
6600
6607
  title: "Decision Component",
6601
6608
  description: "A step with a decision Component.",
6602
- actions: [],
6603
6609
  schemas: [],
6604
6610
  layout: [
6605
6611
  {
@@ -6642,6 +6648,17 @@ var step6 = {
6642
6648
  title: "",
6643
6649
  url: "external"
6644
6650
  }
6651
+ },
6652
+ {
6653
+ title: "Currency flags are now supported as well",
6654
+ disabled: false,
6655
+ icon: {
6656
+ name: "flag-eur"
6657
+ },
6658
+ action: {
6659
+ title: "",
6660
+ url: "external"
6661
+ }
6645
6662
  }
6646
6663
  ]
6647
6664
  }
@@ -6649,13 +6666,68 @@ var step6 = {
6649
6666
  };
6650
6667
  var decision_default = step6;
6651
6668
 
6652
- // src/fixtures/components/heading.ts
6669
+ // src/fixtures/components/decision-flags.ts
6653
6670
  var step7 = {
6654
- type: "form",
6655
- key: "Components/Heading",
6671
+ id: "Components/Decision Flags",
6672
+ title: "Decision Component",
6673
+ description: "A step with a decision Component.",
6674
+ schemas: [],
6675
+ layout: [
6676
+ {
6677
+ type: "heading",
6678
+ size: "sm",
6679
+ text: "Please continue using one of the following options:"
6680
+ },
6681
+ {
6682
+ type: "decision",
6683
+ options: availableCurrencyFlags.map((currencyCode) => {
6684
+ return {
6685
+ title: `${currencyCode.toUpperCase()}`,
6686
+ icon: {
6687
+ name: `flag-${currencyCode}`
6688
+ },
6689
+ action: { url: "/" }
6690
+ };
6691
+ })
6692
+ }
6693
+ ]
6694
+ };
6695
+ var decision_flags_default = step7;
6696
+
6697
+ // src/fixtures/components/decision-icons.ts
6698
+ var icons2 = __toESM(require("@transferwise/icons"));
6699
+ var step8 = {
6700
+ id: "Components/Decision Icons",
6701
+ title: "Decision Component",
6702
+ description: "A step with a decision Component.",
6703
+ schemas: [],
6704
+ layout: [
6705
+ {
6706
+ type: "heading",
6707
+ size: "sm",
6708
+ text: "Please continue using one of the following options:"
6709
+ },
6710
+ {
6711
+ type: "decision",
6712
+ options: Object.keys(icons2).map((iconName) => {
6713
+ return {
6714
+ title: `${iconName} Icon`,
6715
+ icon: {
6716
+ name: iconName
6717
+ },
6718
+ action: { url: "/" }
6719
+ };
6720
+ })
6721
+ }
6722
+ ]
6723
+ };
6724
+ var decision_icons_default = step8;
6725
+
6726
+ // src/fixtures/components/heading.ts
6727
+ var step9 = {
6728
+ id: "Components/Heading",
6656
6729
  title: "Heading Component",
6657
6730
  description: 'Headings can have different sizes: "xs", "sm", "md", "lg", "xl".',
6658
- actions: [],
6659
6731
  schemas: [],
6660
6732
  layout: ["xs", "sm", "md", "lg", "xl"].map((size) => ({
6661
6733
  type: "heading",
@@ -6663,16 +6735,14 @@ var step7 = {
6663
6735
  size
6664
6736
  }))
6665
6737
  };
6666
- var heading_default = step7;
6738
+ var heading_default = step9;
6667
6739
 
6668
6740
  // src/fixtures/components/image.ts
6669
6741
  var sizes = ["xs", "sm", "md", "lg", "xl"];
6670
- var step8 = {
6671
- type: "form",
6672
- key: "Components/Image",
6742
+ var step10 = {
6743
+ id: "Components/Image",
6673
6744
  title: "Image Component",
6674
6745
  description: 'Images can have different sizes: "xs", "sm", "md", "lg", "xl".',
6675
- actions: [],
6676
6746
  schemas: [],
6677
6747
  layout: sizes.flatMap((size) => [
6678
6748
  {
@@ -6682,21 +6752,19 @@ var step8 = {
6682
6752
  },
6683
6753
  {
6684
6754
  type: "image",
6685
- url: "http://placekitten.com/g/400/400",
6755
+ url: "https://images.unsplash.com/photo-1542736705-53f0131d1e98?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=400&q=80",
6686
6756
  text: `This is an image with size: "${size}"`,
6687
6757
  size
6688
6758
  }
6689
6759
  ])
6690
6760
  };
6691
- var image_default = step8;
6761
+ var image_default = step10;
6692
6762
 
6693
6763
  // src/fixtures/components/info.ts
6694
- var step9 = {
6695
- type: "form",
6696
- key: "Components/Info",
6764
+ var step11 = {
6765
+ id: "Components/Info",
6697
6766
  title: "Info Component",
6698
6767
  description: "A block of markdown content.",
6699
- actions: [],
6700
6768
  schemas: [],
6701
6769
  layout: [
6702
6770
  {
@@ -6723,15 +6791,13 @@ But the best part? Bananas are biodegradable and environmentally-friendly, makin
6723
6791
  { type: "alert", markdown: "Links always open in a new tab.", context: "neutral" }
6724
6792
  ]
6725
6793
  };
6726
- var info_default = step9;
6794
+ var info_default = step11;
6727
6795
 
6728
6796
  // src/fixtures/components/list.ts
6729
- var step10 = {
6730
- type: "form",
6731
- key: "Components/List",
6797
+ var step12 = {
6798
+ id: "Components/List",
6732
6799
  title: "List Component",
6733
6800
  description: "A list of items with optional states, subtitles, and images.",
6734
- actions: [],
6735
6801
  schemas: [],
6736
6802
  layout: [
6737
6803
  {
@@ -6759,15 +6825,13 @@ var step10 = {
6759
6825
  }
6760
6826
  ]
6761
6827
  };
6762
- var list_default = step10;
6828
+ var list_default = step12;
6763
6829
 
6764
6830
  // src/fixtures/components/loading-indicator.ts
6765
- var step11 = {
6766
- type: "form",
6767
- key: "Components/Loading Indicator",
6831
+ var step13 = {
6832
+ id: "Components/Loading Indicator",
6768
6833
  title: "Loading Indicator Component",
6769
6834
  description: "A loading indicator to be displayed within a layout.",
6770
- actions: [],
6771
6835
  schemas: [],
6772
6836
  layout: [
6773
6837
  {
@@ -6777,15 +6841,13 @@ var step11 = {
6777
6841
  }
6778
6842
  ]
6779
6843
  };
6780
- var loading_indicator_default = step11;
6844
+ var loading_indicator_default = step13;
6781
6845
 
6782
6846
  // src/fixtures/components/paragraph.ts
6783
- var step12 = {
6784
- type: "form",
6785
- key: "Components/Paragraph",
6847
+ var step14 = {
6848
+ id: "Components/Paragraph",
6786
6849
  title: "Paragraph Component",
6787
6850
  description: `A block of plain text.`,
6788
- actions: [],
6789
6851
  schemas: [],
6790
6852
  layout: [
6791
6853
  {
@@ -6807,15 +6869,13 @@ var step12 = {
6807
6869
  }
6808
6870
  ]
6809
6871
  };
6810
- var paragraph_default = step12;
6872
+ var paragraph_default = step14;
6811
6873
 
6812
6874
  // src/fixtures/components/review.ts
6813
- var step13 = {
6814
- type: "form",
6815
- key: "Components/Review",
6875
+ var step15 = {
6876
+ id: "Components/Review",
6816
6877
  title: "Review Component",
6817
6878
  description: `Show a list of read-only fields.`,
6818
- actions: [],
6819
6879
  schemas: [],
6820
6880
  layout: [
6821
6881
  {
@@ -6869,7 +6929,7 @@ var step13 = {
6869
6929
  }
6870
6930
  ]
6871
6931
  };
6872
- var review_default = step13;
6932
+ var review_default = step15;
6873
6933
 
6874
6934
  // src/fixtures/examples/index.ts
6875
6935
  var examples_exports = {};
@@ -6882,10 +6942,9 @@ __export(examples_exports, {
6882
6942
  });
6883
6943
 
6884
6944
  // src/fixtures/examples/camera-capture.ts
6885
- var step14 = {
6886
- key: "Examples/Camera Capture",
6945
+ var step16 = {
6946
+ id: "Examples/Camera Capture",
6887
6947
  title: "Camera Capture Example",
6888
- type: "form",
6889
6948
  schemas: [
6890
6949
  {
6891
6950
  properties: {
@@ -7002,15 +7061,13 @@ var step14 = {
7002
7061
  },
7003
7062
  refreshFormUrl: "/"
7004
7063
  };
7005
- var camera_capture_default = step14;
7064
+ var camera_capture_default = step16;
7006
7065
 
7007
7066
  // src/fixtures/examples/recipient.ts
7008
- var step15 = {
7009
- key: "Examples/Recipient Creation",
7010
- type: "form",
7067
+ var step17 = {
7068
+ id: "Examples/Recipient Creation",
7011
7069
  title: "Recipient Creation Example",
7012
7070
  description: "A form step with the typical recipient creation form.",
7013
- actions: [],
7014
7071
  schemas: [
7015
7072
  {
7016
7073
  $id: "#new-recipient",
@@ -7317,22 +7374,12 @@ var step15 = {
7317
7374
  details: {}
7318
7375
  }
7319
7376
  };
7320
- var recipient_default = step15;
7377
+ var recipient_default = step17;
7321
7378
 
7322
7379
  // src/fixtures/examples/recipient-update.ts
7323
- var step16 = {
7324
- key: "Examples/Recipient Update",
7325
- type: "form",
7380
+ var step18 = {
7381
+ id: "Examples/Recipient Update",
7326
7382
  title: "Edit recipient",
7327
- actions: [
7328
- {
7329
- title: "Update",
7330
- url: "/responses/recipientUpdate/?delay=5000",
7331
- type: "primary",
7332
- method: "PATCH",
7333
- $id: "submit"
7334
- }
7335
- ],
7336
7383
  schemas: [
7337
7384
  {
7338
7385
  $id: "form",
@@ -7564,19 +7611,21 @@ var step16 = {
7564
7611
  {
7565
7612
  type: "button",
7566
7613
  action: {
7567
- $ref: "submit"
7614
+ $id: "submit",
7615
+ title: "Update",
7616
+ url: "/responses/recipientUpdate/?delay=5000",
7617
+ type: "primary",
7618
+ method: "PATCH"
7568
7619
  }
7569
7620
  }
7570
7621
  ]
7571
7622
  };
7572
- var recipient_update_default = step16;
7623
+ var recipient_update_default = step18;
7573
7624
 
7574
7625
  // src/fixtures/examples/single-file-upload.ts
7575
- var step17 = {
7576
- key: "Examples/Single File Upload",
7577
- type: "form",
7626
+ var step19 = {
7627
+ id: "Examples/Single File Upload",
7578
7628
  title: "Single File Upload Example",
7579
- actions: [],
7580
7629
  schemas: [
7581
7630
  {
7582
7631
  $id: "#schema-1",
@@ -7669,13 +7718,12 @@ var step17 = {
7669
7718
  frontSide: 0
7670
7719
  }
7671
7720
  };
7672
- var single_file_upload_default = step17;
7721
+ var single_file_upload_default = step19;
7673
7722
 
7674
7723
  // src/fixtures/examples/step-validation-errors.ts
7675
- var step18 = {
7676
- key: "Examples/Step Validation Errors",
7724
+ var step20 = {
7725
+ id: "Examples/Step Validation Errors",
7677
7726
  title: "Step with validation errors",
7678
- type: "form",
7679
7727
  errors: {
7680
7728
  validation: {
7681
7729
  "bridekeeper-questions": {
@@ -7683,7 +7731,6 @@ var step18 = {
7683
7731
  }
7684
7732
  }
7685
7733
  },
7686
- actions: [],
7687
7734
  layout: [
7688
7735
  {
7689
7736
  type: "form",
@@ -7746,7 +7793,7 @@ var step18 = {
7746
7793
  }
7747
7794
  ]
7748
7795
  };
7749
- var step_validation_errors_default = step18;
7796
+ var step_validation_errors_default = step20;
7750
7797
 
7751
7798
  // src/fixtures/features/index.ts
7752
7799
  var features_exports = {};
@@ -7759,12 +7806,11 @@ __export(features_exports, {
7759
7806
  });
7760
7807
 
7761
7808
  // src/fixtures/features/action-response.ts
7762
- var step19 = {
7763
- key: "Features/Action Response",
7809
+ var step21 = {
7810
+ id: "Features/Action Response",
7764
7811
  title: "Action Response",
7765
7812
  description: "",
7766
7813
  type: "form",
7767
- actions: [],
7768
7814
  schemas: [],
7769
7815
  layout: [
7770
7816
  {
@@ -7787,12 +7833,12 @@ var step19 = {
7787
7833
  }
7788
7834
  ]
7789
7835
  };
7790
- var action_response_default = step19;
7836
+ var action_response_default = step21;
7791
7837
 
7792
7838
  // src/fixtures/features/external.ts
7793
- var step20 = {
7839
+ var step22 = {
7794
7840
  type: "form",
7795
- key: "Features/External",
7841
+ id: "Features/External",
7796
7842
  title: "External Feature",
7797
7843
  description: "Your bank is opening in another window.",
7798
7844
  external: { url: "http://google.com/" },
@@ -7817,15 +7863,13 @@ var step20 = {
7817
7863
  markdown: `If it didn't work, you can [reopen](http://google.com/) the tab`
7818
7864
  }
7819
7865
  ],
7820
- actions: [],
7821
7866
  schemas: []
7822
7867
  };
7823
- var external_default = step20;
7868
+ var external_default = step22;
7824
7869
 
7825
7870
  // src/fixtures/features/persist-async.ts
7826
- var step21 = {
7827
- type: "form",
7828
- key: "Features/Persist Async",
7871
+ var step23 = {
7872
+ id: "Features/Persist Async",
7829
7873
  title: "Persist Async Feature",
7830
7874
  schemas: [
7831
7875
  {
@@ -7851,14 +7895,6 @@ var step21 = {
7851
7895
  }
7852
7896
  }
7853
7897
  ],
7854
- actions: [
7855
- {
7856
- title: "Submit Persist Async",
7857
- url: "/persist-async-submit",
7858
- method: "POST",
7859
- type: "primary"
7860
- }
7861
- ],
7862
7898
  layout: [
7863
7899
  {
7864
7900
  type: "form",
@@ -7866,12 +7902,11 @@ var step21 = {
7866
7902
  }
7867
7903
  ]
7868
7904
  };
7869
- var persist_async_default = step21;
7905
+ var persist_async_default = step23;
7870
7906
 
7871
7907
  // src/fixtures/features/polling.ts
7872
- var step22 = {
7873
- type: "form",
7874
- key: "Features/Polling",
7908
+ var step24 = {
7909
+ id: "Features/Polling",
7875
7910
  title: "Polling Feature",
7876
7911
  description: "Polling feature in a form step.",
7877
7912
  polling: {
@@ -7898,15 +7933,14 @@ var step22 = {
7898
7933
  }
7899
7934
  }
7900
7935
  ],
7901
- actions: [],
7902
7936
  schemas: []
7903
7937
  };
7904
- var polling_default = step22;
7938
+ var polling_default = step24;
7905
7939
 
7906
7940
  // src/fixtures/features/validation-async.ts
7907
- var step23 = {
7941
+ var step25 = {
7908
7942
  type: "form",
7909
- key: "Features/Validation Async",
7943
+ id: "Features/Validation Async",
7910
7944
  title: "Validation Async Feature",
7911
7945
  schemas: [
7912
7946
  {
@@ -7936,12 +7970,11 @@ var step23 = {
7936
7970
  }
7937
7971
  }
7938
7972
  ],
7939
- actions: [],
7940
7973
  model: {
7941
7974
  // name: 'Colin Robinson',
7942
7975
  }
7943
7976
  };
7944
- var validation_async_default = step23;
7977
+ var validation_async_default = step25;
7945
7978
 
7946
7979
  // src/fixtures/layouts/index.ts
7947
7980
  var layouts_exports = {};
@@ -8209,30 +8242,10 @@ var layout3 = [
8209
8242
  var list_default2 = layout3;
8210
8243
 
8211
8244
  // src/fixtures/layouts/pay-in.ts
8212
- var step24 = {
8213
- key: "PAY_ID",
8245
+ var step26 = {
8246
+ id: "PAY_ID",
8214
8247
  type: "form",
8215
8248
  title: "Pay Using PayID",
8216
- actions: [
8217
- {
8218
- title: "I have paid",
8219
- type: "primary",
8220
- exit: true,
8221
- result: {
8222
- paid: "POTENTIALLY_PAID"
8223
- },
8224
- $id: "#payNow"
8225
- },
8226
- {
8227
- title: "I'll transfer my money later",
8228
- type: "secondary",
8229
- exit: true,
8230
- result: {
8231
- paid: "NOT_PAID"
8232
- },
8233
- $id: "#payLater"
8234
- }
8235
- ],
8236
8249
  schemas: [
8237
8250
  {
8238
8251
  title: "Pay Using PayID",
@@ -8294,18 +8307,30 @@ var step24 = {
8294
8307
  {
8295
8308
  type: "button",
8296
8309
  action: {
8297
- $ref: "#payNow"
8310
+ title: "I have paid",
8311
+ type: "primary",
8312
+ exit: true,
8313
+ result: {
8314
+ paid: "POTENTIALLY_PAID"
8315
+ },
8316
+ $id: "#payNow"
8298
8317
  }
8299
8318
  },
8300
8319
  {
8301
8320
  type: "button",
8302
8321
  action: {
8303
- $ref: "#payLater"
8322
+ $id: "#payLater",
8323
+ title: "I'll transfer my money later",
8324
+ type: "secondary",
8325
+ exit: true,
8326
+ result: {
8327
+ paid: "NOT_PAID"
8328
+ }
8304
8329
  }
8305
8330
  }
8306
8331
  ]
8307
8332
  };
8308
- var pay_in_default = step24;
8333
+ var pay_in_default = step26;
8309
8334
 
8310
8335
  // src/fixtures/layouts/review.ts
8311
8336
  var layout4 = [
@@ -8551,12 +8576,10 @@ var action = { action: { url: "/responses/success", method: "POST" } };
8551
8576
  var action_default = action;
8552
8577
 
8553
8578
  // src/fixtures/responses/action-response-final.ts
8554
- var step25 = {
8555
- type: "form",
8556
- key: "action-response-final",
8579
+ var step27 = {
8580
+ id: "action-response-final",
8557
8581
  title: "Action Response Final Step",
8558
8582
  description: `This step was loaded as a result of an Action Response.`,
8559
- actions: [],
8560
8583
  schemas: [],
8561
8584
  layout: [
8562
8585
  {
@@ -8574,19 +8597,17 @@ var step25 = {
8574
8597
  }
8575
8598
  ]
8576
8599
  };
8577
- var action_response_final_default = step25;
8600
+ var action_response_final_default = step27;
8578
8601
 
8579
8602
  // src/fixtures/responses/exit.ts
8580
8603
  var exit = { id: "123456", name: "Bob Loblaw", country: "US" };
8581
8604
  var exit_default = exit;
8582
8605
 
8583
8606
  // src/fixtures/responses/recipient-update-final.ts
8584
- var step26 = {
8585
- type: "form",
8586
- key: "recipient-update-final",
8607
+ var step28 = {
8608
+ id: "recipient-update-final",
8587
8609
  title: "Recipient Update Final Step",
8588
8610
  description: `The recipient has been updated.`,
8589
- actions: [],
8590
8611
  schemas: [],
8591
8612
  layout: [
8592
8613
  {
@@ -8604,11 +8625,13 @@ var step26 = {
8604
8625
  }
8605
8626
  ]
8606
8627
  };
8607
- var recipient_update_final_default = step26;
8628
+ var recipient_update_final_default = step28;
8608
8629
 
8609
8630
  // src/fixtures/schemas/index.ts
8610
8631
  var schemas_exports = {};
8611
8632
  __export(schemas_exports, {
8633
+ allOf: () => all_of_default,
8634
+ boolean: () => boolean_default,
8612
8635
  numberAndInteger: () => number_and_integer_default,
8613
8636
  oneOf: () => one_of_default,
8614
8637
  simpleForm: () => basic_form_default,
@@ -8616,12 +8639,10 @@ __export(schemas_exports, {
8616
8639
  });
8617
8640
 
8618
8641
  // src/fixtures/schemas/basic-form.ts
8619
- var step27 = {
8620
- key: "Schemas/Basic Form",
8642
+ var step29 = {
8643
+ id: "Schemas/Basic Form",
8621
8644
  title: "Simple Form",
8622
8645
  description: "A simple form with text fields and a checkbox.",
8623
- type: "form",
8624
- actions: [],
8625
8646
  schemas: [
8626
8647
  {
8627
8648
  $id: "#the-schema",
@@ -8654,15 +8675,13 @@ var step27 = {
8654
8675
  }
8655
8676
  ]
8656
8677
  };
8657
- var basic_form_default = step27;
8678
+ var basic_form_default = step29;
8658
8679
 
8659
8680
  // src/fixtures/schemas/number-and-integer.ts
8660
- var step28 = {
8661
- key: "Schemas/Number And Integer",
8681
+ var step30 = {
8682
+ id: "Schemas/Number And Integer",
8662
8683
  title: "Number and Integer Schemas",
8663
8684
  description: "Number and Integer Schemas.",
8664
- type: "form",
8665
- actions: [],
8666
8685
  schemas: [
8667
8686
  {
8668
8687
  $id: "#the-schema",
@@ -8697,7 +8716,7 @@ var step28 = {
8697
8716
  }
8698
8717
  ]
8699
8718
  };
8700
- var number_and_integer_default = step28;
8719
+ var number_and_integer_default = step30;
8701
8720
 
8702
8721
  // src/fixtures/schemas/one-of.ts
8703
8722
  var currencies = [
@@ -8762,13 +8781,11 @@ var currencies = [
8762
8781
  ["ZAR", "South African rand"],
8763
8782
  ["ZMW", "Zambian kwacha"]
8764
8783
  ];
8765
- var step29 = {
8766
- key: "Schemas/OneOf",
8784
+ var step31 = {
8785
+ id: "Schemas/OneOf",
8767
8786
  title: "OneOf Schemas",
8768
8787
  description: "OneOf Schema using select, radio buttons and tabs.",
8769
- type: "form",
8770
8788
  analytics: { custom: "this is the oneOf fixture" },
8771
- actions: [],
8772
8789
  schemas: [
8773
8790
  {
8774
8791
  $id: "#the-schema",
@@ -8779,6 +8796,7 @@ var step29 = {
8779
8796
  "account-type-radio": {
8780
8797
  title: 'Personal or Business Account? (oneOf schema with two options default to control: "radio")',
8781
8798
  analyticsId: "account-type-radio",
8799
+ control: "radio",
8782
8800
  oneOf: [
8783
8801
  {
8784
8802
  title: "Personal",
@@ -8919,15 +8937,13 @@ var step29 = {
8919
8937
  }
8920
8938
  ]
8921
8939
  };
8922
- var one_of_default = step29;
8940
+ var one_of_default = step31;
8923
8941
 
8924
8942
  // src/fixtures/schemas/string-formats.ts
8925
- var step30 = {
8926
- key: "Schemas/String Formats",
8943
+ var step32 = {
8944
+ id: "Schemas/String Formats",
8927
8945
  title: "String Schema Formats",
8928
8946
  description: "String schemas with different formats (password, date, telephone).",
8929
- type: "form",
8930
- actions: [],
8931
8947
  schemas: [
8932
8948
  {
8933
8949
  $id: "#the-schema",
@@ -8983,21 +8999,142 @@ var step30 = {
8983
8999
  "date-lookup": "2023-01-01"
8984
9000
  }
8985
9001
  };
8986
- var string_formats_default = step30;
9002
+ var string_formats_default = step32;
9003
+
9004
+ // src/fixtures/schemas/boolean.ts
9005
+ var step33 = {
9006
+ key: "Schemas/Boolean Schema",
9007
+ title: "Boolean Schema",
9008
+ description: "A simple form with a boolean schema with no default value.",
9009
+ actions: [],
9010
+ schemas: [
9011
+ {
9012
+ $id: "#schema-1",
9013
+ type: "object",
9014
+ displayOrder: ["pineapple"],
9015
+ required: ["pineapple"],
9016
+ properties: {
9017
+ pineapple: {
9018
+ title: "Pineapple on pizza (boolean schema)",
9019
+ type: "boolean"
9020
+ }
9021
+ }
9022
+ }
9023
+ ],
9024
+ layout: [
9025
+ {
9026
+ type: "form",
9027
+ schema: { $ref: "#schema-1" }
9028
+ },
9029
+ {
9030
+ type: "button",
9031
+ action: {
9032
+ url: "/submit",
9033
+ title: "Submit",
9034
+ type: "primary"
9035
+ }
9036
+ }
9037
+ ]
9038
+ };
9039
+ var boolean_default = step33;
9040
+
9041
+ // src/fixtures/schemas/all-of.ts
9042
+ var step34 = {
9043
+ key: "Schemas/AllOf",
9044
+ title: "AllOf Schemas",
9045
+ description: "Three object schemas wrapped in an allOf.",
9046
+ analytics: { custom: "this is the allOf fixture" },
9047
+ actions: [],
9048
+ schemas: [
9049
+ {
9050
+ $id: "#the-schema",
9051
+ allOf: [
9052
+ {
9053
+ $id: "#schema-1",
9054
+ type: "object",
9055
+ properties: {
9056
+ name: { title: "Name", type: "string" }
9057
+ },
9058
+ displayOrder: ["name"]
9059
+ },
9060
+ {
9061
+ $id: "#schema-2",
9062
+ type: "object",
9063
+ properties: {
9064
+ city: { title: "City", type: "string" }
9065
+ },
9066
+ displayOrder: ["city"]
9067
+ },
9068
+ {
9069
+ $id: "#schema-3",
9070
+ type: "object",
9071
+ properties: {
9072
+ color: {
9073
+ title: 'What is your favourite colour? (oneOf schema with more than two options default to control: "select")',
9074
+ placeholder: "Please select a colour",
9075
+ analyticsId: "colour-select",
9076
+ oneOf: [
9077
+ {
9078
+ title: "Blue",
9079
+ analyticsId: "colour-select-blue",
9080
+ image: {
9081
+ url: "https://placeholder.pics/svg/64/0099ff/FFFFFF"
9082
+ },
9083
+ const: 1
9084
+ },
9085
+ {
9086
+ title: "Yellow",
9087
+ analyticsId: "colour-select-yellow",
9088
+ image: {
9089
+ url: "https://placeholder.pics/svg/64/ffcc00/FFFFFF"
9090
+ },
9091
+ const: 2
9092
+ },
9093
+ {
9094
+ title: "Red",
9095
+ analyticsId: "colour-select-red",
9096
+ image: {
9097
+ url: "https://placeholder.pics/svg/64/ff6600/FFFFFF"
9098
+ },
9099
+ const: 3
9100
+ }
9101
+ ]
9102
+ }
9103
+ },
9104
+ displayOrder: ["color"]
9105
+ }
9106
+ ]
9107
+ }
9108
+ ],
9109
+ layout: [
9110
+ {
9111
+ type: "form",
9112
+ schema: { $ref: "#the-schema" }
9113
+ },
9114
+ {
9115
+ type: "button",
9116
+ action: {
9117
+ url: "/submit",
9118
+ title: "Submit",
9119
+ type: "primary"
9120
+ }
9121
+ }
9122
+ ]
9123
+ };
9124
+ var all_of_default = step34;
8987
9125
 
8988
9126
  // src/fixtures/utils/image-util.ts
8989
9127
  var getImageStep = (size) => {
8990
9128
  return {
8991
9129
  type: "form",
8992
- key: `Components/Image-${size}`,
9130
+ id: `Components/Image-${size}`,
8993
9131
  title: `Image Component - ${size}`,
8994
9132
  description: `This is an image with size: "${size}"`,
8995
- actions: [],
8996
9133
  schemas: [],
8997
9134
  layout: [
8998
9135
  {
8999
9136
  type: "image",
9000
- url: "http://placekitten.com/g/400/400",
9137
+ url: "https://images.unsplash.com/photo-1542736705-53f0131d1e98?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=400&q=80",
9001
9138
  text: `This is an image with size: "${size}"`,
9002
9139
  size
9003
9140
  }
@@ -9351,10 +9488,10 @@ var pl_default = {
9351
9488
  "dynamicFlows.CameraCapture.reviewRetry": "Nie, spr\xF3buj ponownie",
9352
9489
  "dynamicFlows.CameraCapture.reviewSubmit": "Tak, prze\u015Blij",
9353
9490
  "dynamicFlows.ControlFeedback.maxLength": "Prosimy wprowadzi\u0107 do {maxLength} znak\xF3w.",
9354
- "dynamicFlows.ControlFeedback.maximum": "Wprowad\u017A liczb\u0119 {maximum} lub mniejsz\u0105.",
9491
+ "dynamicFlows.ControlFeedback.maximum": "Wprowad\u017A liczb\u0119 r\xF3wn\u0105 lub mniejsz\u0105 ni\u017C {maximum}.",
9355
9492
  "dynamicFlows.ControlFeedback.maximumDate": "Wprowad\u017A dat\u0119 nie p\xF3\u017Aniejsz\u0105 ni\u017C {maximum}.",
9356
9493
  "dynamicFlows.ControlFeedback.minLength": "Prosz\u0119 wpisa\u0107 co najmniej {minLength} znak\xF3w.",
9357
- "dynamicFlows.ControlFeedback.minimum": "Wprowad\u017A liczb\u0119 {minimum} lub wi\u0119ksz\u0105.",
9494
+ "dynamicFlows.ControlFeedback.minimum": "Wprowad\u017A liczb\u0119 r\xF3wn\u0105 lub wi\u0119ksz\u0105 ni\u017C {minimum}.",
9358
9495
  "dynamicFlows.ControlFeedback.minimumDate": "Wprowad\u017A dat\u0119 nie wcze\u015Bniejsz\u0105 ni\u017C {minimum}.",
9359
9496
  "dynamicFlows.ControlFeedback.pattern": "Wprowad\u017A t\u0119 warto\u015B\u0107 w prawid\u0142owym formacie.",
9360
9497
  "dynamicFlows.ControlFeedback.patternDate": "Wprowad\u017A dat\u0119 w prawid\u0142owym formacie.",
@@ -9542,10 +9679,10 @@ var tr_default = {
9542
9679
  var zh_default = {
9543
9680
  "dynamicFlows.ArraySchema.maxItemsError": "\u8ACB\u6DFB\u52A0\u4E0D\u8D85\u904E{maxItems}\u9805\u3002",
9544
9681
  "dynamicFlows.ArraySchema.minItemsError": "\u8ACB\u81F3\u5C11\u6DFB\u52A0{minItems}\u9805\u3002",
9545
- "dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "\u4F60\u76EE\u524D\u4F7F\u7528\u7684\u700F\u89BD\u5668\u4E0D\u652F\u6301\u76F8\u6A5F\u529F\u80FD\u3002\u8ACB\u5617\u8A66\u4F7F\u7528\u5176\u4ED6\u700F\u89BD\u5668\u6216\u5176\u4ED6\u88DD\u7F6E\uFF0C\u6216\u8005\u4F60\u53EF\u4EE5\u4E0B\u8F09\u6211\u5011\u7684\u61C9\u7528\u7A0B\u5F0F\u3002",
9546
- "dynamicFlows.CameraCapture.CameraNotSupported.title": "\u4E0D\u652F\u6301\u76F8\u6A5F\u529F\u80FD",
9682
+ "dynamicFlows.CameraCapture.CameraNotSupported.paragraph": "\u4F60\u76EE\u524D\u4F7F\u7528\u7684\u700F\u89BD\u5668\u4E0D\u652F\u6301\u76F8\u6A5F\u3002\u8ACB\u5617\u8A66\u4F7F\u7528\u5176\u4ED6\u700F\u89BD\u5668\u6216\u5176\u4ED6\u88DD\u7F6E\uFF0C\u6216\u8005\u4F60\u53EF\u4EE5\u4E0B\u8F09\u6211\u5011\u7684\u61C9\u7528\u7A0B\u5F0F\u3002",
9683
+ "dynamicFlows.CameraCapture.CameraNotSupported.title": "\u4E0D\u652F\u6301\u76F8\u6A5F",
9547
9684
  "dynamicFlows.CameraCapture.NoCameraAccess.action": "\u5141\u8A31\u53D6\u7528\u76F8\u6A5F",
9548
- "dynamicFlows.CameraCapture.NoCameraAccess.paragraph": "\u4F60\u53EF\u4EE5\u5728\u700F\u89BD\u5668\u7684\u8A2D\u5B9A\u4E2D\u958B\u555F\u76F8\u6A5F\u5B58\u53D6\u6B0A\u9650",
9685
+ "dynamicFlows.CameraCapture.NoCameraAccess.paragraph": "\u4F60\u53EF\u4EE5\u5728\u700F\u89BD\u5668\u7684\u8A2D\u5B9A\u4E2D\u958B\u555F\u76F8\u6A5F\u5B58\u53D6\u6B0A\u9650\u3002",
9549
9686
  "dynamicFlows.CameraCapture.NoCameraAccess.title": "\u6211\u5011\u7121\u6CD5\u53D6\u7528\u4F60\u7684\u76F8\u6A5F",
9550
9687
  "dynamicFlows.CameraCapture.reviewInstructions": "\u4F60\u7684\u7167\u7247\u662F\u5426\u5B8C\u6574\u3001\u6E05\u6670\u53CA\u53EF\u8B80\uFF1F",
9551
9688
  "dynamicFlows.CameraCapture.reviewRetry": "\u5426\uFF0C\u518D\u8A66\u4E00\u6B21",
@@ -9560,13 +9697,13 @@ var zh_default = {
9560
9697
  "dynamicFlows.ControlFeedback.patternDate": "\u8ACB\u4EE5\u6B63\u78BA\u683C\u5F0F\u8F38\u5165\u65E5\u671F\u3002",
9561
9698
  "dynamicFlows.ControlFeedback.required": "\u8ACB\u586B\u5BEB\u6B64\u6B04\u4F4D\u3002",
9562
9699
  "dynamicFlows.ControlFeedback.type": "\u932F\u8AA4\u7684\u985E\u578B",
9563
- "dynamicFlows.DynamicExternal.retryTitle": "\u91CD\u65B0\u958B\u555F\u8996\u7A97",
9700
+ "dynamicFlows.DynamicExternal.retryTitle": "\u91CD\u65B0\u6253\u958B\u8996\u7A97",
9564
9701
  "dynamicFlows.DynamicParagraph.copied": "\u8907\u88FD\u5230\u526A\u8CBC\u677F",
9565
9702
  "dynamicFlows.DynamicParagraph.copy": "\u8907\u88FD",
9566
9703
  "dynamicFlows.ErrorBoundary.errorAlert": "\u5662\uFF01\u51FA\u4E86\u4E9B\u554F\u984C...",
9567
9704
  "dynamicFlows.ErrorBoundary.retry": "\u91CD\u8A66",
9568
9705
  "dynamicFlows.ExternalConfirmation.cancel": "\u53D6\u6D88",
9569
- "dynamicFlows.ExternalConfirmation.description": "\u8ACB\u78BA\u8A8D\u4F60\u60F3\u5728\u700F\u89BD\u5668\u7684\u65B0\u5206\u9801\u4E2D\u958B\u555F**{origin}**\u3002",
9706
+ "dynamicFlows.ExternalConfirmation.description": "\u8ACB\u78BA\u8A8D\u4F60\u662F\u5426\u8981\u5728\u700F\u89BD\u5668\u7684\u65B0\u5206\u9801\u6253\u958B**{origin}**\u3002",
9570
9707
  "dynamicFlows.ExternalConfirmation.open": "\u5728\u65B0\u5206\u9801\u4E2D\u958B\u555F",
9571
9708
  "dynamicFlows.ExternalConfirmation.title": "\u8ACB\u78BA\u8A8D",
9572
9709
  "dynamicFlows.Help.ariaLabel": "\u6309\u6B64\u67E5\u770B\u8A73\u60C5\u3002",