@wise/dynamic-flow-client-internal 5.4.1 → 5.5.1

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 (3) hide show
  1. package/build/main.js +199 -179
  2. package/build/main.mjs +193 -173
  3. package/package.json +5 -5
package/build/main.js CHANGED
@@ -66,7 +66,7 @@ var require_classnames = __commonJS({
66
66
  (function() {
67
67
  "use strict";
68
68
  var hasOwn = {}.hasOwnProperty;
69
- function classNames6() {
69
+ function classNames7() {
70
70
  var classes = "";
71
71
  for (var i = 0; i < arguments.length; i++) {
72
72
  var arg = arguments[i];
@@ -84,7 +84,7 @@ var require_classnames = __commonJS({
84
84
  return "";
85
85
  }
86
86
  if (Array.isArray(arg)) {
87
- return classNames6.apply(null, arg);
87
+ return classNames7.apply(null, arg);
88
88
  }
89
89
  if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
90
90
  return arg.toString();
@@ -107,14 +107,14 @@ var require_classnames = __commonJS({
107
107
  return value + newClass;
108
108
  }
109
109
  if (typeof module2 !== "undefined" && module2.exports) {
110
- classNames6.default = classNames6;
111
- module2.exports = classNames6;
110
+ classNames7.default = classNames7;
111
+ module2.exports = classNames7;
112
112
  } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
113
113
  define("classnames", [], function() {
114
- return classNames6;
114
+ return classNames7;
115
115
  });
116
116
  } else {
117
- window.classNames = classNames6;
117
+ window.classNames = classNames7;
118
118
  }
119
119
  })();
120
120
  }
@@ -144,7 +144,7 @@ var import_react21 = require("react");
144
144
  // src/dynamicFlow/telemetry/app-version.ts
145
145
  var appVersion = (
146
146
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
147
- typeof process !== "undefined" ? "5.4.1" : "0.0.0"
147
+ typeof process !== "undefined" ? "5.5.1" : "0.0.0"
148
148
  );
149
149
 
150
150
  // src/dynamicFlow/telemetry/getLogEvent.ts
@@ -332,14 +332,14 @@ function AddressValidationButtonComponent(props) {
332
332
  var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
333
333
 
334
334
  // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
335
- var import_components3 = require("@transferwise/components");
335
+ var import_components6 = require("@transferwise/components");
336
336
 
337
337
  // ../renderers/src/utils/isButtonPriority.ts
338
338
  var validPriorities = ["primary", "secondary", "secondary-neutral", "tertiary"];
339
339
  var isButtonPriority = (control) => validPriorities.includes(control);
340
340
 
341
- // ../renderers/src/ButtonRenderer/mapButtonSize.tsx
342
- var mapButtonSize = (size) => {
341
+ // ../renderers/src/ButtonRenderer/mapLegacyButtonSize.tsx
342
+ var mapLegacyButtonSize = (size) => {
343
343
  if (!size) {
344
344
  return void 0;
345
345
  }
@@ -358,123 +358,15 @@ var mapButtonSize = (size) => {
358
358
 
359
359
  // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
360
360
  var import_react2 = require("react");
361
- var import_jsx_runtime4 = require("react/jsx-runtime");
362
- var ButtonRenderer = {
363
- canRenderType: "button",
364
- render: ButtonComponent
365
- };
366
- function ButtonComponent(props) {
367
- const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
368
- const [spinny, setSpinny] = (0, import_react2.useState)(false);
369
- (0, import_react2.useEffect)(() => {
370
- if (stepLoadingState === "idle") {
371
- setSpinny(false);
372
- }
373
- }, [stepLoadingState]);
374
- const loading = spinny && stepLoadingState !== "idle";
375
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
376
- import_components3.Button,
377
- {
378
- v2: true,
379
- block: true,
380
- className: getMargin(margin),
381
- disabled,
382
- priority: getPriority(control),
383
- loading,
384
- size: mapButtonSize(size),
385
- sentiment: getSentiment(context),
386
- onClick: () => {
387
- setSpinny(true);
388
- onClick();
389
- },
390
- children: title
391
- }
392
- );
393
- }
394
- var getSentiment = (context) => context === "negative" ? "negative" : "default";
395
- var getPriority = (control) => control && isButtonPriority(control) ? control : "secondary";
396
-
397
- // ../renderers/src/components/FieldInput.tsx
398
- var import_components5 = require("@transferwise/components");
399
-
400
- // ../renderers/src/components/Help.tsx
401
- var import_components4 = require("@transferwise/components");
402
- var import_react_intl4 = require("react-intl");
403
-
404
- // ../renderers/src/messages/help.messages.ts
405
- var import_react_intl3 = require("react-intl");
406
- var help_messages_default = (0, import_react_intl3.defineMessages)({
407
- helpAria: {
408
- id: "df.wise.Help.ariaLabel",
409
- defaultMessage: "Click here for more info.",
410
- description: "Aria label for help."
411
- }
412
- });
413
-
414
- // ../renderers/src/components/Help.tsx
415
- var import_jsx_runtime5 = require("react/jsx-runtime");
416
- function Help({ help, onClick }) {
417
- const intl = (0, import_react_intl4.useIntl)();
418
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
419
- import_components4.Info,
420
- {
421
- content: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components4.Markdown, { config: { link: { target: "_blank" } }, children: help }),
422
- presentation: "POPOVER",
423
- size: "sm",
424
- "aria-label": intl.formatMessage(help_messages_default.helpAria),
425
- onClick
426
- }
427
- );
428
- }
429
- var Help_default = Help;
430
-
431
- // ../renderers/src/components/LabelContentWithHelp.tsx
432
- var import_jsx_runtime6 = require("react/jsx-runtime");
433
- function LabelContentWithHelp({ text, help }) {
434
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
435
- text,
436
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Help_default, { help })
437
- ] });
438
- }
439
-
440
- // ../renderers/src/components/FieldInput.tsx
441
- var import_jsx_runtime7 = require("react/jsx-runtime");
442
- function FieldInput({ id, children, label, validation, description, help }) {
443
- const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LabelContentWithHelp, { text: label, help }) : label;
444
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
445
- import_components5.Field,
446
- {
447
- id,
448
- label: labelContent,
449
- description,
450
- message: validation == null ? void 0 : validation.message,
451
- sentiment: mapStatusToSentiment(validation),
452
- children
453
- }
454
- );
455
- }
456
- var mapStatusToSentiment = (validation) => {
457
- if (validation) {
458
- if (validation.status === "valid") {
459
- return "positive";
460
- }
461
- return "negative";
462
- }
463
- return void 0;
464
- };
465
- var FieldInput_default = FieldInput;
466
-
467
- // ../renderers/src/CheckboxInputRenderer.tsx
468
- var import_components11 = require("@transferwise/components");
469
361
 
470
362
  // ../renderers/src/utils/UrnFlag.tsx
471
363
  var import_art = require("@wise/art");
472
- var import_jsx_runtime8 = require("react/jsx-runtime");
364
+ var import_jsx_runtime4 = require("react/jsx-runtime");
473
365
  var countryUrnPrefix = "urn:wise:countries:";
474
366
  var currencyUrnPrefix = "urn:wise:currencies:";
475
367
  var isUrnFlag = (uri) => (uri.startsWith(countryUrnPrefix) || uri.startsWith(currencyUrnPrefix)) && uri.endsWith(":image");
476
368
  function UrnFlag({ size, urn }) {
477
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_art.Flag, { code: getCode(urn), intrinsicSize: size });
369
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_art.Flag, { code: getCode(urn), intrinsicSize: size });
478
370
  }
479
371
  var getCode = (urn) => {
480
372
  return urn.replace(countryUrnPrefix, "").replace(currencyUrnPrefix, "").replace(":image", "").split("?")[0];
@@ -482,19 +374,19 @@ var getCode = (urn) => {
482
374
 
483
375
  // ../renderers/src/components/icon/FlagIcon.tsx
484
376
  var import_art2 = require("@wise/art");
485
- var import_jsx_runtime9 = require("react/jsx-runtime");
377
+ var import_jsx_runtime5 = require("react/jsx-runtime");
486
378
  var isFlagIcon = (name) => name.startsWith("flag-");
487
379
  function FlagIcon({ name }) {
488
380
  if (!isFlagIcon(name)) {
489
381
  return null;
490
382
  }
491
383
  const code = name.substring(5);
492
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_art2.Flag, { code, intrinsicSize: 24 });
384
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_art2.Flag, { code, intrinsicSize: 24 });
493
385
  }
494
386
 
495
387
  // ../renderers/src/components/icon/NamedIcon.tsx
496
388
  var icons = __toESM(require("@transferwise/icons"));
497
- var import_jsx_runtime10 = require("react/jsx-runtime");
389
+ var import_jsx_runtime6 = require("react/jsx-runtime");
498
390
  var isNamedIcon = (name) => {
499
391
  const iconName = toCapitalisedCamelCase(name);
500
392
  return Object.keys(icons).includes(iconName);
@@ -505,19 +397,19 @@ function NamedIcon({ name, size = 24 }) {
505
397
  }
506
398
  const iconName = toCapitalisedCamelCase(name);
507
399
  const Icon = icons[iconName];
508
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Icon, { size });
400
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size });
509
401
  }
510
402
  var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
511
403
  var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
512
404
 
513
405
  // ../renderers/src/components/icon/DynamicIcon.tsx
514
- var import_jsx_runtime11 = require("react/jsx-runtime");
406
+ var import_jsx_runtime7 = require("react/jsx-runtime");
515
407
  function DynamicIcon({ name, size }) {
516
408
  if (isFlagIcon(name)) {
517
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FlagIcon, { name });
409
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FlagIcon, { name });
518
410
  }
519
411
  if (isNamedIcon(name)) {
520
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(NamedIcon, { name, size });
412
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NamedIcon, { name, size });
521
413
  }
522
414
  return null;
523
415
  }
@@ -549,11 +441,11 @@ var stringToURN = (uri) => {
549
441
  };
550
442
 
551
443
  // ../renderers/src/components/Media/resolveMediaFromUri.tsx
552
- var import_jsx_runtime12 = require("react/jsx-runtime");
444
+ var import_jsx_runtime8 = require("react/jsx-runtime");
553
445
  var resolveMediaFromUri = (uri, size) => {
554
446
  const { name, qComponents } = stringToURN(uri);
555
447
  if (isValidIconUrn(name)) {
556
- const icon = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
448
+ const icon = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
557
449
  return {
558
450
  icon,
559
451
  color: formatColor(qComponents["foreground-color"]),
@@ -562,7 +454,7 @@ var resolveMediaFromUri = (uri, size) => {
562
454
  }
563
455
  if (isUrnFlag(name)) {
564
456
  return {
565
- asset: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UrnFlag, { urn: name, size })
457
+ asset: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(UrnFlag, { urn: name, size })
566
458
  };
567
459
  }
568
460
  if (name.startsWith("data:text/plain,")) {
@@ -574,7 +466,7 @@ var resolveMediaFromUri = (uri, size) => {
574
466
  };
575
467
  }
576
468
  if (!uri.startsWith("urn:")) {
577
- return { asset: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("img", { src: uri, alt: "", width: `${size}px` }) };
469
+ return { asset: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: uri, alt: "", width: `${size}px` }) };
578
470
  }
579
471
  return { asset: void 0 };
580
472
  };
@@ -589,8 +481,8 @@ var formatColor = (color) => {
589
481
  };
590
482
 
591
483
  // ../renderers/src/components/Media/AvatarMedia.tsx
592
- var import_components6 = require("@transferwise/components");
593
- var import_jsx_runtime13 = require("react/jsx-runtime");
484
+ var import_components3 = require("@transferwise/components");
485
+ var import_jsx_runtime9 = require("react/jsx-runtime");
594
486
  var AvatarMedia = ({
595
487
  accessibilityDescription,
596
488
  content,
@@ -613,8 +505,8 @@ var AvatarMedia = ({
613
505
  if (!asset && !icon) {
614
506
  return null;
615
507
  }
616
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
617
- import_components6.AvatarView,
508
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
509
+ import_components3.AvatarView,
618
510
  {
619
511
  "aria-label": accessibilityDescription,
620
512
  size,
@@ -628,8 +520,8 @@ var AvatarMedia = ({
628
520
  asset: icon != null ? icon : asset,
629
521
  style: { backgroundColor, color }
630
522
  }));
631
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
632
- import_components6.AvatarLayout,
523
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
524
+ import_components3.AvatarLayout,
633
525
  {
634
526
  "aria-label": accessibilityDescription,
635
527
  size,
@@ -647,7 +539,7 @@ var getBadge = ({
647
539
  }) => {
648
540
  if (backgroundColor || color) {
649
541
  return {
650
- asset: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
542
+ asset: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
651
543
  "div",
652
544
  {
653
545
  className: "d-flex align-items-center justify-content-center",
@@ -669,12 +561,12 @@ var getBadge = ({
669
561
  };
670
562
 
671
563
  // ../renderers/src/utils/image-utils.tsx
672
- var import_components7 = require("@transferwise/components");
673
- var import_jsx_runtime14 = require("react/jsx-runtime");
564
+ var import_components4 = require("@transferwise/components");
565
+ var import_jsx_runtime10 = require("react/jsx-runtime");
674
566
  var getBadgedMedia = (iconNode, imageNode, size) => {
675
567
  if (iconNode && imageNode) {
676
568
  if (imageNode && iconNode) {
677
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components7.AvatarView, { size, badge: { asset: iconNode, type: "reference" }, children: imageNode });
569
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_components4.AvatarView, { size, badge: { asset: iconNode, type: "reference" }, children: imageNode });
678
570
  }
679
571
  }
680
572
  return null;
@@ -682,7 +574,7 @@ var getBadgedMedia = (iconNode, imageNode, size) => {
682
574
  var getIconNode = (icon) => {
683
575
  if (icon) {
684
576
  if ("name" in icon) {
685
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DynamicIcon_default, { name: icon.name });
577
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DynamicIcon_default, { name: icon.name });
686
578
  }
687
579
  if (icon.text) {
688
580
  return icon.text;
@@ -694,18 +586,18 @@ var getImageNode = (image, size) => {
694
586
  if (image) {
695
587
  const { accessibilityDescription, uri } = image;
696
588
  if (!uri.startsWith("urn:")) {
697
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("img", { src: uri, alt: accessibilityDescription, width: `${size}px` });
589
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("img", { src: uri, alt: accessibilityDescription, width: `${size}px` });
698
590
  }
699
591
  if (isUrnFlag(uri)) {
700
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(UrnFlag, { urn: uri, accessibilityDescription, size });
592
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UrnFlag, { urn: uri, accessibilityDescription, size });
701
593
  }
702
594
  }
703
595
  return null;
704
596
  };
705
597
 
706
598
  // ../renderers/src/components/Media/LegacyMedia.tsx
707
- var import_components8 = require("@transferwise/components");
708
- var import_jsx_runtime15 = require("react/jsx-runtime");
599
+ var import_components5 = require("@transferwise/components");
600
+ var import_jsx_runtime11 = require("react/jsx-runtime");
709
601
  var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
710
602
  const imageNode = getImageNode(image, size);
711
603
  const iconNode = getIconNode(icon);
@@ -714,11 +606,11 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
714
606
  return badge;
715
607
  }
716
608
  if (imageNode) {
717
- return preferAvatar ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components8.AvatarView, { children: imageNode }) : imageNode;
609
+ return preferAvatar ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.AvatarView, { children: imageNode }) : imageNode;
718
610
  }
719
611
  if (iconNode && icon) {
720
612
  if ("text" in icon || size === 48) {
721
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components8.AvatarView, { size, children: iconNode });
613
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.AvatarView, { size, children: iconNode });
722
614
  }
723
615
  return iconNode;
724
616
  }
@@ -726,17 +618,17 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
726
618
  };
727
619
 
728
620
  // ../renderers/src/components/Media/Media.tsx
729
- var import_jsx_runtime16 = require("react/jsx-runtime");
621
+ var import_jsx_runtime12 = require("react/jsx-runtime");
730
622
  var Media = ({ media, preferAvatar = false, size }) => {
731
623
  switch (media == null ? void 0 : media.type) {
732
624
  case "avatar":
733
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
625
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
734
626
  case "image": {
735
627
  const { asset, icon } = resolveMediaFromUri(media.uri, size);
736
628
  return icon != null ? icon : asset;
737
629
  }
738
630
  case "legacy": {
739
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LegacyMedia, __spreadProps(__spreadValues({}, media), { preferAvatar, size }));
631
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(LegacyMedia, __spreadProps(__spreadValues({}, media), { preferAvatar, size }));
740
632
  }
741
633
  default:
742
634
  return null;
@@ -744,15 +636,158 @@ var Media = ({ media, preferAvatar = false, size }) => {
744
636
  };
745
637
 
746
638
  // ../renderers/src/components/Media/OptionMedia.tsx
747
- var import_jsx_runtime17 = require("react/jsx-runtime");
639
+ var import_jsx_runtime13 = require("react/jsx-runtime");
748
640
  var mediaSize = 48;
749
641
  function OptionMedia(props) {
750
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Media, __spreadProps(__spreadValues({}, props), { size: mediaSize }));
642
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Media, __spreadProps(__spreadValues({}, props), { size: mediaSize }));
751
643
  }
752
644
 
753
645
  // ../renderers/src/components/Media/getInlineMedia.tsx
646
+ var import_jsx_runtime14 = require("react/jsx-runtime");
647
+ var getInlineMedia = (media) => media ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Media, { media, preferAvatar: false, size: 24 }) : null;
648
+
649
+ // ../renderers/src/components/Media/getAddonStartMedia.ts
650
+ var getAddonStartMedia = (media) => {
651
+ if (media.type === "avatar") {
652
+ if (media.content.length > 0 && media.content[0].type === "uri" && isValidIconUrn(media.content[0].uri)) {
653
+ return {
654
+ type: "icon",
655
+ value: getInlineMedia({
656
+ type: "image",
657
+ uri: media.content[0].uri
658
+ })
659
+ };
660
+ }
661
+ return void 0;
662
+ }
663
+ return { type: "icon", value: getInlineMedia(media) };
664
+ };
665
+
666
+ // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
667
+ var import_classnames2 = __toESM(require_classnames());
668
+ var import_jsx_runtime15 = require("react/jsx-runtime");
669
+ var ButtonRenderer = {
670
+ canRenderType: "button",
671
+ render: ButtonComponent
672
+ };
673
+ function ButtonComponent(props) {
674
+ const {
675
+ control,
676
+ context,
677
+ disabled,
678
+ margin,
679
+ media,
680
+ tags,
681
+ title,
682
+ size,
683
+ stepLoadingState,
684
+ onClick
685
+ } = props;
686
+ const [spinny, setSpinny] = (0, import_react2.useState)(false);
687
+ (0, import_react2.useEffect)(() => {
688
+ if (stepLoadingState === "idle") {
689
+ setSpinny(false);
690
+ }
691
+ }, [stepLoadingState]);
692
+ const loading = spinny && stepLoadingState !== "idle";
693
+ const buttonProps = {
694
+ v2: true,
695
+ block: control !== "small",
696
+ className: (0, import_classnames2.default)(getMargin(margin), { "d-block": control === "small" }),
697
+ addonStart: control === "small" && media ? getAddonStartMedia(media) : void 0,
698
+ disabled,
699
+ priority: getPriority(control, tags),
700
+ loading,
701
+ size: control === "small" ? "sm" : mapLegacyButtonSize(size),
702
+ sentiment: getSentiment(context),
703
+ onClick: () => {
704
+ setSpinny(true);
705
+ onClick();
706
+ }
707
+ };
708
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components6.Button, __spreadProps(__spreadValues({}, buttonProps), { children: title }));
709
+ }
710
+ var getSentiment = (context) => context === "negative" ? "negative" : "default";
711
+ var getPriority = (control, tags) => {
712
+ const tagPriority = tags == null ? void 0 : tags.find((tag) => isButtonPriority(tag));
713
+ if (tagPriority) {
714
+ return tagPriority;
715
+ }
716
+ return control && isButtonPriority(control) ? control : "secondary";
717
+ };
718
+
719
+ // ../renderers/src/components/FieldInput.tsx
720
+ var import_components8 = require("@transferwise/components");
721
+
722
+ // ../renderers/src/components/Help.tsx
723
+ var import_components7 = require("@transferwise/components");
724
+ var import_react_intl4 = require("react-intl");
725
+
726
+ // ../renderers/src/messages/help.messages.ts
727
+ var import_react_intl3 = require("react-intl");
728
+ var help_messages_default = (0, import_react_intl3.defineMessages)({
729
+ helpAria: {
730
+ id: "df.wise.Help.ariaLabel",
731
+ defaultMessage: "Click here for more info.",
732
+ description: "Aria label for help."
733
+ }
734
+ });
735
+
736
+ // ../renderers/src/components/Help.tsx
737
+ var import_jsx_runtime16 = require("react/jsx-runtime");
738
+ function Help({ help, onClick }) {
739
+ const intl = (0, import_react_intl4.useIntl)();
740
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
741
+ import_components7.Info,
742
+ {
743
+ content: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components7.Markdown, { config: { link: { target: "_blank" } }, children: help }),
744
+ presentation: "POPOVER",
745
+ size: "sm",
746
+ "aria-label": intl.formatMessage(help_messages_default.helpAria),
747
+ onClick
748
+ }
749
+ );
750
+ }
751
+ var Help_default = Help;
752
+
753
+ // ../renderers/src/components/LabelContentWithHelp.tsx
754
+ var import_jsx_runtime17 = require("react/jsx-runtime");
755
+ function LabelContentWithHelp({ text, help }) {
756
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
757
+ text,
758
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Help_default, { help })
759
+ ] });
760
+ }
761
+
762
+ // ../renderers/src/components/FieldInput.tsx
754
763
  var import_jsx_runtime18 = require("react/jsx-runtime");
755
- var getInlineMedia = (media) => media ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Media, { media, preferAvatar: false, size: 24 }) : null;
764
+ function FieldInput({ id, children, label, validation, description, help }) {
765
+ const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(LabelContentWithHelp, { text: label, help }) : label;
766
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
767
+ import_components8.Field,
768
+ {
769
+ id,
770
+ label: labelContent,
771
+ description,
772
+ message: validation == null ? void 0 : validation.message,
773
+ sentiment: mapStatusToSentiment(validation),
774
+ children
775
+ }
776
+ );
777
+ }
778
+ var mapStatusToSentiment = (validation) => {
779
+ if (validation) {
780
+ if (validation.status === "valid") {
781
+ return "positive";
782
+ }
783
+ return "negative";
784
+ }
785
+ return void 0;
786
+ };
787
+ var FieldInput_default = FieldInput;
788
+
789
+ // ../renderers/src/CheckboxInputRenderer.tsx
790
+ var import_components11 = require("@transferwise/components");
756
791
 
757
792
  // ../renderers/src/utils/listItem/getMedia.tsx
758
793
  var import_jsx_runtime19 = require("react/jsx-runtime");
@@ -878,14 +913,14 @@ var getInlineAlertOrValidation = (validationState, inlineAlert) => {
878
913
  var CheckboxInputRenderer_default = CheckboxInputRenderer;
879
914
 
880
915
  // ../renderers/src/ColumnsRenderer.tsx
881
- var import_classnames2 = __toESM(require_classnames());
916
+ var import_classnames3 = __toESM(require_classnames());
882
917
  var import_jsx_runtime23 = require("react/jsx-runtime");
883
918
  var ColumnsRenderer = {
884
919
  canRenderType: "columns",
885
920
  render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
886
921
  "div",
887
922
  {
888
- className: (0, import_classnames2.default)("df-columns-renderer-container", getMargin(margin), {
923
+ className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
889
924
  "df-columns-renderer-bias-start": bias === "start",
890
925
  "df-columns-renderer-bias-end": bias === "end"
891
926
  }),
@@ -1806,7 +1841,7 @@ var import_components27 = require("@transferwise/components");
1806
1841
 
1807
1842
  // ../renderers/src/components/UploadFieldInput.tsx
1808
1843
  var import_components26 = require("@transferwise/components");
1809
- var import_classnames3 = __toESM(require_classnames());
1844
+ var import_classnames4 = __toESM(require_classnames());
1810
1845
  var import_jsx_runtime45 = require("react/jsx-runtime");
1811
1846
  function UploadFieldInput({
1812
1847
  id,
@@ -1821,7 +1856,7 @@ function UploadFieldInput({
1821
1856
  return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
1822
1857
  "div",
1823
1858
  {
1824
- className: (0, import_classnames3.default)("form-group d-block", {
1859
+ className: (0, import_classnames4.default)("form-group d-block", {
1825
1860
  "has-error": (validation == null ? void 0 : validation.status) === "invalid"
1826
1861
  }),
1827
1862
  children: [
@@ -1980,7 +2015,7 @@ function useSnackBarIfAvailable() {
1980
2015
 
1981
2016
  // ../renderers/src/ParagraphRenderer.tsx
1982
2017
  var import_components30 = require("@transferwise/components");
1983
- var import_classnames4 = __toESM(require_classnames());
2018
+ var import_classnames5 = __toESM(require_classnames());
1984
2019
 
1985
2020
  // ../renderers/src/messages/paragraph.messages.ts
1986
2021
  var import_react_intl11 = require("react-intl");
@@ -2032,7 +2067,7 @@ function CopyableParagraph({
2032
2067
  type: "text",
2033
2068
  value: text,
2034
2069
  readOnly: true,
2035
- className: (0, import_classnames4.default)("text-ellipsis", inputAlignmentClasses)
2070
+ className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
2036
2071
  }
2037
2072
  ),
2038
2073
  /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components30.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
@@ -2043,7 +2078,7 @@ var ParagraphRenderer_default = ParagraphRenderer;
2043
2078
  // ../renderers/src/RepeatableRenderer.tsx
2044
2079
  var import_components31 = require("@transferwise/components");
2045
2080
  var import_icons = require("@transferwise/icons");
2046
- var import_classnames5 = __toESM(require_classnames());
2081
+ var import_classnames6 = __toESM(require_classnames());
2047
2082
  var import_react11 = require("react");
2048
2083
  var import_react_intl14 = require("react-intl");
2049
2084
 
@@ -2121,7 +2156,7 @@ function Repeatable(props) {
2121
2156
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
2122
2157
  "div",
2123
2158
  {
2124
- className: (0, import_classnames5.default)("form-group", {
2159
+ className: (0, import_classnames6.default)("form-group", {
2125
2160
  "has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
2126
2161
  }),
2127
2162
  children: [
@@ -2807,14 +2842,14 @@ function MediaToolbarButton(props) {
2807
2842
  onClick,
2808
2843
  children: [
2809
2844
  accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
2810
- media ? (_a = getAddonStart(media)) == null ? void 0 : _a.value : null
2845
+ media ? (_a = getAddonStartMedia(media)) == null ? void 0 : _a.value : null
2811
2846
  ]
2812
2847
  }
2813
2848
  );
2814
2849
  }
2815
2850
  function TextToolbarButton(props) {
2816
2851
  const { context, control, title, media, disabled, onClick } = props;
2817
- const addonStart = media ? getAddonStart(media) : void 0;
2852
+ const addonStart = media ? getAddonStartMedia(media) : void 0;
2818
2853
  const priority = getPriority2(control);
2819
2854
  const sentiment = getSentiment2(context);
2820
2855
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
@@ -2832,21 +2867,6 @@ function TextToolbarButton(props) {
2832
2867
  }
2833
2868
  );
2834
2869
  }
2835
- var getAddonStart = (media) => {
2836
- if (media.type === "avatar") {
2837
- if (media.content.length > 0 && media.content[0].type === "uri" && isValidIconUrn(media.content[0].uri)) {
2838
- return {
2839
- type: "icon",
2840
- value: getInlineMedia({
2841
- type: "image",
2842
- uri: media.content[0].uri
2843
- })
2844
- };
2845
- }
2846
- return void 0;
2847
- }
2848
- return { type: "icon", value: getInlineMedia(media) };
2849
- };
2850
2870
  var getPriority2 = (control) => isKnownControl(control) ? control : "secondary";
2851
2871
  var prefersMedia = (control) => {
2852
2872
  return false;
package/build/main.mjs CHANGED
@@ -60,7 +60,7 @@ var require_classnames = __commonJS({
60
60
  (function() {
61
61
  "use strict";
62
62
  var hasOwn = {}.hasOwnProperty;
63
- function classNames6() {
63
+ function classNames7() {
64
64
  var classes = "";
65
65
  for (var i = 0; i < arguments.length; i++) {
66
66
  var arg = arguments[i];
@@ -78,7 +78,7 @@ var require_classnames = __commonJS({
78
78
  return "";
79
79
  }
80
80
  if (Array.isArray(arg)) {
81
- return classNames6.apply(null, arg);
81
+ return classNames7.apply(null, arg);
82
82
  }
83
83
  if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
84
84
  return arg.toString();
@@ -101,14 +101,14 @@ var require_classnames = __commonJS({
101
101
  return value + newClass;
102
102
  }
103
103
  if (typeof module !== "undefined" && module.exports) {
104
- classNames6.default = classNames6;
105
- module.exports = classNames6;
104
+ classNames7.default = classNames7;
105
+ module.exports = classNames7;
106
106
  } else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
107
107
  define("classnames", [], function() {
108
- return classNames6;
108
+ return classNames7;
109
109
  });
110
110
  } else {
111
- window.classNames = classNames6;
111
+ window.classNames = classNames7;
112
112
  }
113
113
  })();
114
114
  }
@@ -126,7 +126,7 @@ import { useMemo as useMemo2 } from "react";
126
126
  // src/dynamicFlow/telemetry/app-version.ts
127
127
  var appVersion = (
128
128
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
129
- typeof process !== "undefined" ? "5.4.1" : "0.0.0"
129
+ typeof process !== "undefined" ? "5.5.1" : "0.0.0"
130
130
  );
131
131
 
132
132
  // src/dynamicFlow/telemetry/getLogEvent.ts
@@ -320,8 +320,8 @@ import { Button as Button2 } from "@transferwise/components";
320
320
  var validPriorities = ["primary", "secondary", "secondary-neutral", "tertiary"];
321
321
  var isButtonPriority = (control) => validPriorities.includes(control);
322
322
 
323
- // ../renderers/src/ButtonRenderer/mapButtonSize.tsx
324
- var mapButtonSize = (size) => {
323
+ // ../renderers/src/ButtonRenderer/mapLegacyButtonSize.tsx
324
+ var mapLegacyButtonSize = (size) => {
325
325
  if (!size) {
326
326
  return void 0;
327
327
  }
@@ -340,123 +340,15 @@ var mapButtonSize = (size) => {
340
340
 
341
341
  // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
342
342
  import { useEffect as useEffect2, useState as useState2 } from "react";
343
- import { jsx as jsx4 } from "react/jsx-runtime";
344
- var ButtonRenderer = {
345
- canRenderType: "button",
346
- render: ButtonComponent
347
- };
348
- function ButtonComponent(props) {
349
- const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
350
- const [spinny, setSpinny] = useState2(false);
351
- useEffect2(() => {
352
- if (stepLoadingState === "idle") {
353
- setSpinny(false);
354
- }
355
- }, [stepLoadingState]);
356
- const loading = spinny && stepLoadingState !== "idle";
357
- return /* @__PURE__ */ jsx4(
358
- Button2,
359
- {
360
- v2: true,
361
- block: true,
362
- className: getMargin(margin),
363
- disabled,
364
- priority: getPriority(control),
365
- loading,
366
- size: mapButtonSize(size),
367
- sentiment: getSentiment(context),
368
- onClick: () => {
369
- setSpinny(true);
370
- onClick();
371
- },
372
- children: title
373
- }
374
- );
375
- }
376
- var getSentiment = (context) => context === "negative" ? "negative" : "default";
377
- var getPriority = (control) => control && isButtonPriority(control) ? control : "secondary";
378
-
379
- // ../renderers/src/components/FieldInput.tsx
380
- import { Field } from "@transferwise/components";
381
-
382
- // ../renderers/src/components/Help.tsx
383
- import { Info, Markdown } from "@transferwise/components";
384
- import { useIntl as useIntl2 } from "react-intl";
385
-
386
- // ../renderers/src/messages/help.messages.ts
387
- import { defineMessages as defineMessages2 } from "react-intl";
388
- var help_messages_default = defineMessages2({
389
- helpAria: {
390
- id: "df.wise.Help.ariaLabel",
391
- defaultMessage: "Click here for more info.",
392
- description: "Aria label for help."
393
- }
394
- });
395
-
396
- // ../renderers/src/components/Help.tsx
397
- import { jsx as jsx5 } from "react/jsx-runtime";
398
- function Help({ help, onClick }) {
399
- const intl = useIntl2();
400
- return /* @__PURE__ */ jsx5(
401
- Info,
402
- {
403
- content: /* @__PURE__ */ jsx5(Markdown, { config: { link: { target: "_blank" } }, children: help }),
404
- presentation: "POPOVER",
405
- size: "sm",
406
- "aria-label": intl.formatMessage(help_messages_default.helpAria),
407
- onClick
408
- }
409
- );
410
- }
411
- var Help_default = Help;
412
-
413
- // ../renderers/src/components/LabelContentWithHelp.tsx
414
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
415
- function LabelContentWithHelp({ text, help }) {
416
- return /* @__PURE__ */ jsxs2("div", { children: [
417
- text,
418
- /* @__PURE__ */ jsx6(Help_default, { help })
419
- ] });
420
- }
421
-
422
- // ../renderers/src/components/FieldInput.tsx
423
- import { jsx as jsx7 } from "react/jsx-runtime";
424
- function FieldInput({ id, children, label, validation, description, help }) {
425
- const labelContent = label && help ? /* @__PURE__ */ jsx7(LabelContentWithHelp, { text: label, help }) : label;
426
- return /* @__PURE__ */ jsx7(
427
- Field,
428
- {
429
- id,
430
- label: labelContent,
431
- description,
432
- message: validation == null ? void 0 : validation.message,
433
- sentiment: mapStatusToSentiment(validation),
434
- children
435
- }
436
- );
437
- }
438
- var mapStatusToSentiment = (validation) => {
439
- if (validation) {
440
- if (validation.status === "valid") {
441
- return "positive";
442
- }
443
- return "negative";
444
- }
445
- return void 0;
446
- };
447
- var FieldInput_default = FieldInput;
448
-
449
- // ../renderers/src/CheckboxInputRenderer.tsx
450
- import { Checkbox, ListItem as ListItem3 } from "@transferwise/components";
451
343
 
452
344
  // ../renderers/src/utils/UrnFlag.tsx
453
345
  import { Flag } from "@wise/art";
454
- import { jsx as jsx8 } from "react/jsx-runtime";
346
+ import { jsx as jsx4 } from "react/jsx-runtime";
455
347
  var countryUrnPrefix = "urn:wise:countries:";
456
348
  var currencyUrnPrefix = "urn:wise:currencies:";
457
349
  var isUrnFlag = (uri) => (uri.startsWith(countryUrnPrefix) || uri.startsWith(currencyUrnPrefix)) && uri.endsWith(":image");
458
350
  function UrnFlag({ size, urn }) {
459
- return /* @__PURE__ */ jsx8(Flag, { code: getCode(urn), intrinsicSize: size });
351
+ return /* @__PURE__ */ jsx4(Flag, { code: getCode(urn), intrinsicSize: size });
460
352
  }
461
353
  var getCode = (urn) => {
462
354
  return urn.replace(countryUrnPrefix, "").replace(currencyUrnPrefix, "").replace(":image", "").split("?")[0];
@@ -464,19 +356,19 @@ var getCode = (urn) => {
464
356
 
465
357
  // ../renderers/src/components/icon/FlagIcon.tsx
466
358
  import { Flag as Flag2 } from "@wise/art";
467
- import { jsx as jsx9 } from "react/jsx-runtime";
359
+ import { jsx as jsx5 } from "react/jsx-runtime";
468
360
  var isFlagIcon = (name) => name.startsWith("flag-");
469
361
  function FlagIcon({ name }) {
470
362
  if (!isFlagIcon(name)) {
471
363
  return null;
472
364
  }
473
365
  const code = name.substring(5);
474
- return /* @__PURE__ */ jsx9(Flag2, { code, intrinsicSize: 24 });
366
+ return /* @__PURE__ */ jsx5(Flag2, { code, intrinsicSize: 24 });
475
367
  }
476
368
 
477
369
  // ../renderers/src/components/icon/NamedIcon.tsx
478
370
  import * as icons from "@transferwise/icons";
479
- import { jsx as jsx10 } from "react/jsx-runtime";
371
+ import { jsx as jsx6 } from "react/jsx-runtime";
480
372
  var isNamedIcon = (name) => {
481
373
  const iconName = toCapitalisedCamelCase(name);
482
374
  return Object.keys(icons).includes(iconName);
@@ -487,19 +379,19 @@ function NamedIcon({ name, size = 24 }) {
487
379
  }
488
380
  const iconName = toCapitalisedCamelCase(name);
489
381
  const Icon = icons[iconName];
490
- return /* @__PURE__ */ jsx10(Icon, { size });
382
+ return /* @__PURE__ */ jsx6(Icon, { size });
491
383
  }
492
384
  var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
493
385
  var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
494
386
 
495
387
  // ../renderers/src/components/icon/DynamicIcon.tsx
496
- import { jsx as jsx11 } from "react/jsx-runtime";
388
+ import { jsx as jsx7 } from "react/jsx-runtime";
497
389
  function DynamicIcon({ name, size }) {
498
390
  if (isFlagIcon(name)) {
499
- return /* @__PURE__ */ jsx11(FlagIcon, { name });
391
+ return /* @__PURE__ */ jsx7(FlagIcon, { name });
500
392
  }
501
393
  if (isNamedIcon(name)) {
502
- return /* @__PURE__ */ jsx11(NamedIcon, { name, size });
394
+ return /* @__PURE__ */ jsx7(NamedIcon, { name, size });
503
395
  }
504
396
  return null;
505
397
  }
@@ -531,11 +423,11 @@ var stringToURN = (uri) => {
531
423
  };
532
424
 
533
425
  // ../renderers/src/components/Media/resolveMediaFromUri.tsx
534
- import { jsx as jsx12 } from "react/jsx-runtime";
426
+ import { jsx as jsx8 } from "react/jsx-runtime";
535
427
  var resolveMediaFromUri = (uri, size) => {
536
428
  const { name, qComponents } = stringToURN(uri);
537
429
  if (isValidIconUrn(name)) {
538
- const icon = /* @__PURE__ */ jsx12(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
430
+ const icon = /* @__PURE__ */ jsx8(DynamicIcon_default, { name: name.replace("urn:wise:icons:", ""), size: size === 48 ? 32 : size });
539
431
  return {
540
432
  icon,
541
433
  color: formatColor(qComponents["foreground-color"]),
@@ -544,7 +436,7 @@ var resolveMediaFromUri = (uri, size) => {
544
436
  }
545
437
  if (isUrnFlag(name)) {
546
438
  return {
547
- asset: /* @__PURE__ */ jsx12(UrnFlag, { urn: name, size })
439
+ asset: /* @__PURE__ */ jsx8(UrnFlag, { urn: name, size })
548
440
  };
549
441
  }
550
442
  if (name.startsWith("data:text/plain,")) {
@@ -556,7 +448,7 @@ var resolveMediaFromUri = (uri, size) => {
556
448
  };
557
449
  }
558
450
  if (!uri.startsWith("urn:")) {
559
- return { asset: /* @__PURE__ */ jsx12("img", { src: uri, alt: "", width: `${size}px` }) };
451
+ return { asset: /* @__PURE__ */ jsx8("img", { src: uri, alt: "", width: `${size}px` }) };
560
452
  }
561
453
  return { asset: void 0 };
562
454
  };
@@ -572,7 +464,7 @@ var formatColor = (color) => {
572
464
 
573
465
  // ../renderers/src/components/Media/AvatarMedia.tsx
574
466
  import { AvatarLayout, AvatarView } from "@transferwise/components";
575
- import { jsx as jsx13 } from "react/jsx-runtime";
467
+ import { jsx as jsx9 } from "react/jsx-runtime";
576
468
  var AvatarMedia = ({
577
469
  accessibilityDescription,
578
470
  content,
@@ -595,7 +487,7 @@ var AvatarMedia = ({
595
487
  if (!asset && !icon) {
596
488
  return null;
597
489
  }
598
- return /* @__PURE__ */ jsx13(
490
+ return /* @__PURE__ */ jsx9(
599
491
  AvatarView,
600
492
  {
601
493
  "aria-label": accessibilityDescription,
@@ -610,7 +502,7 @@ var AvatarMedia = ({
610
502
  asset: icon != null ? icon : asset,
611
503
  style: { backgroundColor, color }
612
504
  }));
613
- return /* @__PURE__ */ jsx13(
505
+ return /* @__PURE__ */ jsx9(
614
506
  AvatarLayout,
615
507
  {
616
508
  "aria-label": accessibilityDescription,
@@ -629,7 +521,7 @@ var getBadge = ({
629
521
  }) => {
630
522
  if (backgroundColor || color) {
631
523
  return {
632
- asset: /* @__PURE__ */ jsx13(
524
+ asset: /* @__PURE__ */ jsx9(
633
525
  "div",
634
526
  {
635
527
  className: "d-flex align-items-center justify-content-center",
@@ -652,11 +544,11 @@ var getBadge = ({
652
544
 
653
545
  // ../renderers/src/utils/image-utils.tsx
654
546
  import { AvatarView as AvatarView2 } from "@transferwise/components";
655
- import { jsx as jsx14 } from "react/jsx-runtime";
547
+ import { jsx as jsx10 } from "react/jsx-runtime";
656
548
  var getBadgedMedia = (iconNode, imageNode, size) => {
657
549
  if (iconNode && imageNode) {
658
550
  if (imageNode && iconNode) {
659
- return /* @__PURE__ */ jsx14(AvatarView2, { size, badge: { asset: iconNode, type: "reference" }, children: imageNode });
551
+ return /* @__PURE__ */ jsx10(AvatarView2, { size, badge: { asset: iconNode, type: "reference" }, children: imageNode });
660
552
  }
661
553
  }
662
554
  return null;
@@ -664,7 +556,7 @@ var getBadgedMedia = (iconNode, imageNode, size) => {
664
556
  var getIconNode = (icon) => {
665
557
  if (icon) {
666
558
  if ("name" in icon) {
667
- return /* @__PURE__ */ jsx14(DynamicIcon_default, { name: icon.name });
559
+ return /* @__PURE__ */ jsx10(DynamicIcon_default, { name: icon.name });
668
560
  }
669
561
  if (icon.text) {
670
562
  return icon.text;
@@ -676,10 +568,10 @@ var getImageNode = (image, size) => {
676
568
  if (image) {
677
569
  const { accessibilityDescription, uri } = image;
678
570
  if (!uri.startsWith("urn:")) {
679
- return /* @__PURE__ */ jsx14("img", { src: uri, alt: accessibilityDescription, width: `${size}px` });
571
+ return /* @__PURE__ */ jsx10("img", { src: uri, alt: accessibilityDescription, width: `${size}px` });
680
572
  }
681
573
  if (isUrnFlag(uri)) {
682
- return /* @__PURE__ */ jsx14(UrnFlag, { urn: uri, accessibilityDescription, size });
574
+ return /* @__PURE__ */ jsx10(UrnFlag, { urn: uri, accessibilityDescription, size });
683
575
  }
684
576
  }
685
577
  return null;
@@ -687,7 +579,7 @@ var getImageNode = (image, size) => {
687
579
 
688
580
  // ../renderers/src/components/Media/LegacyMedia.tsx
689
581
  import { AvatarView as AvatarView3 } from "@transferwise/components";
690
- import { jsx as jsx15 } from "react/jsx-runtime";
582
+ import { jsx as jsx11 } from "react/jsx-runtime";
691
583
  var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
692
584
  const imageNode = getImageNode(image, size);
693
585
  const iconNode = getIconNode(icon);
@@ -696,11 +588,11 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
696
588
  return badge;
697
589
  }
698
590
  if (imageNode) {
699
- return preferAvatar ? /* @__PURE__ */ jsx15(AvatarView3, { children: imageNode }) : imageNode;
591
+ return preferAvatar ? /* @__PURE__ */ jsx11(AvatarView3, { children: imageNode }) : imageNode;
700
592
  }
701
593
  if (iconNode && icon) {
702
594
  if ("text" in icon || size === 48) {
703
- return /* @__PURE__ */ jsx15(AvatarView3, { size, children: iconNode });
595
+ return /* @__PURE__ */ jsx11(AvatarView3, { size, children: iconNode });
704
596
  }
705
597
  return iconNode;
706
598
  }
@@ -708,17 +600,17 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
708
600
  };
709
601
 
710
602
  // ../renderers/src/components/Media/Media.tsx
711
- import { jsx as jsx16 } from "react/jsx-runtime";
603
+ import { jsx as jsx12 } from "react/jsx-runtime";
712
604
  var Media = ({ media, preferAvatar = false, size }) => {
713
605
  switch (media == null ? void 0 : media.type) {
714
606
  case "avatar":
715
- return /* @__PURE__ */ jsx16(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
607
+ return /* @__PURE__ */ jsx12(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
716
608
  case "image": {
717
609
  const { asset, icon } = resolveMediaFromUri(media.uri, size);
718
610
  return icon != null ? icon : asset;
719
611
  }
720
612
  case "legacy": {
721
- return /* @__PURE__ */ jsx16(LegacyMedia, __spreadProps(__spreadValues({}, media), { preferAvatar, size }));
613
+ return /* @__PURE__ */ jsx12(LegacyMedia, __spreadProps(__spreadValues({}, media), { preferAvatar, size }));
722
614
  }
723
615
  default:
724
616
  return null;
@@ -726,15 +618,158 @@ var Media = ({ media, preferAvatar = false, size }) => {
726
618
  };
727
619
 
728
620
  // ../renderers/src/components/Media/OptionMedia.tsx
729
- import { jsx as jsx17 } from "react/jsx-runtime";
621
+ import { jsx as jsx13 } from "react/jsx-runtime";
730
622
  var mediaSize = 48;
731
623
  function OptionMedia(props) {
732
- return /* @__PURE__ */ jsx17(Media, __spreadProps(__spreadValues({}, props), { size: mediaSize }));
624
+ return /* @__PURE__ */ jsx13(Media, __spreadProps(__spreadValues({}, props), { size: mediaSize }));
733
625
  }
734
626
 
735
627
  // ../renderers/src/components/Media/getInlineMedia.tsx
628
+ import { jsx as jsx14 } from "react/jsx-runtime";
629
+ var getInlineMedia = (media) => media ? /* @__PURE__ */ jsx14(Media, { media, preferAvatar: false, size: 24 }) : null;
630
+
631
+ // ../renderers/src/components/Media/getAddonStartMedia.ts
632
+ var getAddonStartMedia = (media) => {
633
+ if (media.type === "avatar") {
634
+ if (media.content.length > 0 && media.content[0].type === "uri" && isValidIconUrn(media.content[0].uri)) {
635
+ return {
636
+ type: "icon",
637
+ value: getInlineMedia({
638
+ type: "image",
639
+ uri: media.content[0].uri
640
+ })
641
+ };
642
+ }
643
+ return void 0;
644
+ }
645
+ return { type: "icon", value: getInlineMedia(media) };
646
+ };
647
+
648
+ // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
649
+ var import_classnames2 = __toESM(require_classnames());
650
+ import { jsx as jsx15 } from "react/jsx-runtime";
651
+ var ButtonRenderer = {
652
+ canRenderType: "button",
653
+ render: ButtonComponent
654
+ };
655
+ function ButtonComponent(props) {
656
+ const {
657
+ control,
658
+ context,
659
+ disabled,
660
+ margin,
661
+ media,
662
+ tags,
663
+ title,
664
+ size,
665
+ stepLoadingState,
666
+ onClick
667
+ } = props;
668
+ const [spinny, setSpinny] = useState2(false);
669
+ useEffect2(() => {
670
+ if (stepLoadingState === "idle") {
671
+ setSpinny(false);
672
+ }
673
+ }, [stepLoadingState]);
674
+ const loading = spinny && stepLoadingState !== "idle";
675
+ const buttonProps = {
676
+ v2: true,
677
+ block: control !== "small",
678
+ className: (0, import_classnames2.default)(getMargin(margin), { "d-block": control === "small" }),
679
+ addonStart: control === "small" && media ? getAddonStartMedia(media) : void 0,
680
+ disabled,
681
+ priority: getPriority(control, tags),
682
+ loading,
683
+ size: control === "small" ? "sm" : mapLegacyButtonSize(size),
684
+ sentiment: getSentiment(context),
685
+ onClick: () => {
686
+ setSpinny(true);
687
+ onClick();
688
+ }
689
+ };
690
+ return /* @__PURE__ */ jsx15(Button2, __spreadProps(__spreadValues({}, buttonProps), { children: title }));
691
+ }
692
+ var getSentiment = (context) => context === "negative" ? "negative" : "default";
693
+ var getPriority = (control, tags) => {
694
+ const tagPriority = tags == null ? void 0 : tags.find((tag) => isButtonPriority(tag));
695
+ if (tagPriority) {
696
+ return tagPriority;
697
+ }
698
+ return control && isButtonPriority(control) ? control : "secondary";
699
+ };
700
+
701
+ // ../renderers/src/components/FieldInput.tsx
702
+ import { Field } from "@transferwise/components";
703
+
704
+ // ../renderers/src/components/Help.tsx
705
+ import { Info, Markdown } from "@transferwise/components";
706
+ import { useIntl as useIntl2 } from "react-intl";
707
+
708
+ // ../renderers/src/messages/help.messages.ts
709
+ import { defineMessages as defineMessages2 } from "react-intl";
710
+ var help_messages_default = defineMessages2({
711
+ helpAria: {
712
+ id: "df.wise.Help.ariaLabel",
713
+ defaultMessage: "Click here for more info.",
714
+ description: "Aria label for help."
715
+ }
716
+ });
717
+
718
+ // ../renderers/src/components/Help.tsx
719
+ import { jsx as jsx16 } from "react/jsx-runtime";
720
+ function Help({ help, onClick }) {
721
+ const intl = useIntl2();
722
+ return /* @__PURE__ */ jsx16(
723
+ Info,
724
+ {
725
+ content: /* @__PURE__ */ jsx16(Markdown, { config: { link: { target: "_blank" } }, children: help }),
726
+ presentation: "POPOVER",
727
+ size: "sm",
728
+ "aria-label": intl.formatMessage(help_messages_default.helpAria),
729
+ onClick
730
+ }
731
+ );
732
+ }
733
+ var Help_default = Help;
734
+
735
+ // ../renderers/src/components/LabelContentWithHelp.tsx
736
+ import { jsx as jsx17, jsxs as jsxs2 } from "react/jsx-runtime";
737
+ function LabelContentWithHelp({ text, help }) {
738
+ return /* @__PURE__ */ jsxs2("div", { children: [
739
+ text,
740
+ /* @__PURE__ */ jsx17(Help_default, { help })
741
+ ] });
742
+ }
743
+
744
+ // ../renderers/src/components/FieldInput.tsx
736
745
  import { jsx as jsx18 } from "react/jsx-runtime";
737
- var getInlineMedia = (media) => media ? /* @__PURE__ */ jsx18(Media, { media, preferAvatar: false, size: 24 }) : null;
746
+ function FieldInput({ id, children, label, validation, description, help }) {
747
+ const labelContent = label && help ? /* @__PURE__ */ jsx18(LabelContentWithHelp, { text: label, help }) : label;
748
+ return /* @__PURE__ */ jsx18(
749
+ Field,
750
+ {
751
+ id,
752
+ label: labelContent,
753
+ description,
754
+ message: validation == null ? void 0 : validation.message,
755
+ sentiment: mapStatusToSentiment(validation),
756
+ children
757
+ }
758
+ );
759
+ }
760
+ var mapStatusToSentiment = (validation) => {
761
+ if (validation) {
762
+ if (validation.status === "valid") {
763
+ return "positive";
764
+ }
765
+ return "negative";
766
+ }
767
+ return void 0;
768
+ };
769
+ var FieldInput_default = FieldInput;
770
+
771
+ // ../renderers/src/CheckboxInputRenderer.tsx
772
+ import { Checkbox, ListItem as ListItem3 } from "@transferwise/components";
738
773
 
739
774
  // ../renderers/src/utils/listItem/getMedia.tsx
740
775
  import { jsx as jsx19 } from "react/jsx-runtime";
@@ -860,14 +895,14 @@ var getInlineAlertOrValidation = (validationState, inlineAlert) => {
860
895
  var CheckboxInputRenderer_default = CheckboxInputRenderer;
861
896
 
862
897
  // ../renderers/src/ColumnsRenderer.tsx
863
- var import_classnames2 = __toESM(require_classnames());
898
+ var import_classnames3 = __toESM(require_classnames());
864
899
  import { jsx as jsx23, jsxs as jsxs3 } from "react/jsx-runtime";
865
900
  var ColumnsRenderer = {
866
901
  canRenderType: "columns",
867
902
  render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ jsxs3(
868
903
  "div",
869
904
  {
870
- className: (0, import_classnames2.default)("df-columns-renderer-container", getMargin(margin), {
905
+ className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
871
906
  "df-columns-renderer-bias-start": bias === "start",
872
907
  "df-columns-renderer-bias-end": bias === "end"
873
908
  }),
@@ -1790,7 +1825,7 @@ var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
1790
1825
  import { Status, UploadInput } from "@transferwise/components";
1791
1826
 
1792
1827
  // ../renderers/src/components/UploadFieldInput.tsx
1793
- var import_classnames3 = __toESM(require_classnames());
1828
+ var import_classnames4 = __toESM(require_classnames());
1794
1829
  import { InlineAlert as InlineAlert2 } from "@transferwise/components";
1795
1830
  import { jsx as jsx45, jsxs as jsxs8 } from "react/jsx-runtime";
1796
1831
  function UploadFieldInput({
@@ -1806,7 +1841,7 @@ function UploadFieldInput({
1806
1841
  return /* @__PURE__ */ jsxs8(
1807
1842
  "div",
1808
1843
  {
1809
- className: (0, import_classnames3.default)("form-group d-block", {
1844
+ className: (0, import_classnames4.default)("form-group d-block", {
1810
1845
  "has-error": (validation == null ? void 0 : validation.status) === "invalid"
1811
1846
  }),
1812
1847
  children: [
@@ -1964,7 +1999,7 @@ function useSnackBarIfAvailable() {
1964
1999
  }
1965
2000
 
1966
2001
  // ../renderers/src/ParagraphRenderer.tsx
1967
- var import_classnames4 = __toESM(require_classnames());
2002
+ var import_classnames5 = __toESM(require_classnames());
1968
2003
  import { Button as Button5, Input as Input3 } from "@transferwise/components";
1969
2004
 
1970
2005
  // ../renderers/src/messages/paragraph.messages.ts
@@ -2017,7 +2052,7 @@ function CopyableParagraph({
2017
2052
  type: "text",
2018
2053
  value: text,
2019
2054
  readOnly: true,
2020
- className: (0, import_classnames4.default)("text-ellipsis", inputAlignmentClasses)
2055
+ className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
2021
2056
  }
2022
2057
  ),
2023
2058
  /* @__PURE__ */ jsx48(Button5, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
@@ -2026,7 +2061,7 @@ function CopyableParagraph({
2026
2061
  var ParagraphRenderer_default = ParagraphRenderer;
2027
2062
 
2028
2063
  // ../renderers/src/RepeatableRenderer.tsx
2029
- var import_classnames5 = __toESM(require_classnames());
2064
+ var import_classnames6 = __toESM(require_classnames());
2030
2065
  import { Button as Button6, Header as Header3, InlineAlert as InlineAlert3, Modal as Modal4, NavigationOption } from "@transferwise/components";
2031
2066
  import { Plus } from "@transferwise/icons";
2032
2067
  import { useState as useState7 } from "react";
@@ -2106,7 +2141,7 @@ function Repeatable(props) {
2106
2141
  /* @__PURE__ */ jsxs10(
2107
2142
  "div",
2108
2143
  {
2109
- className: (0, import_classnames5.default)("form-group", {
2144
+ className: (0, import_classnames6.default)("form-group", {
2110
2145
  "has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
2111
2146
  }),
2112
2147
  children: [
@@ -2792,14 +2827,14 @@ function MediaToolbarButton(props) {
2792
2827
  onClick,
2793
2828
  children: [
2794
2829
  accessibilityDescription ? /* @__PURE__ */ jsx62("span", { className: "sr-only", children: accessibilityDescription }) : null,
2795
- media ? (_a = getAddonStart(media)) == null ? void 0 : _a.value : null
2830
+ media ? (_a = getAddonStartMedia(media)) == null ? void 0 : _a.value : null
2796
2831
  ]
2797
2832
  }
2798
2833
  );
2799
2834
  }
2800
2835
  function TextToolbarButton(props) {
2801
2836
  const { context, control, title, media, disabled, onClick } = props;
2802
- const addonStart = media ? getAddonStart(media) : void 0;
2837
+ const addonStart = media ? getAddonStartMedia(media) : void 0;
2803
2838
  const priority = getPriority2(control);
2804
2839
  const sentiment = getSentiment2(context);
2805
2840
  return /* @__PURE__ */ jsx62(
@@ -2817,21 +2852,6 @@ function TextToolbarButton(props) {
2817
2852
  }
2818
2853
  );
2819
2854
  }
2820
- var getAddonStart = (media) => {
2821
- if (media.type === "avatar") {
2822
- if (media.content.length > 0 && media.content[0].type === "uri" && isValidIconUrn(media.content[0].uri)) {
2823
- return {
2824
- type: "icon",
2825
- value: getInlineMedia({
2826
- type: "image",
2827
- uri: media.content[0].uri
2828
- })
2829
- };
2830
- }
2831
- return void 0;
2832
- }
2833
- return { type: "icon", value: getInlineMedia(media) };
2834
- };
2835
2855
  var getPriority2 = (control) => isKnownControl(control) ? control : "secondary";
2836
2856
  var prefersMedia = (control) => {
2837
2857
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "5.4.1",
3
+ "version": "5.5.1",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -69,9 +69,9 @@
69
69
  "typescript": "5.9.3",
70
70
  "vitest": "4.0.18",
71
71
  "vitest-fetch-mock": "0.4.5",
72
+ "@wise/dynamic-flow-fixtures": "0.0.1",
72
73
  "@wise/dynamic-flow-renderers": "0.0.0",
73
- "@wise/dynamic-flow-types": "4.5.1",
74
- "@wise/dynamic-flow-fixtures": "0.0.1"
74
+ "@wise/dynamic-flow-types": "4.6.0"
75
75
  },
76
76
  "peerDependencies": {
77
77
  "@transferwise/components": "^46.104.0",
@@ -85,8 +85,8 @@
85
85
  "react-intl": "^6 || ^7"
86
86
  },
87
87
  "dependencies": {
88
- "@wise/dynamic-flow-client": "5.4.1",
89
- "@wise/dynamic-flow-types": "4.5.1"
88
+ "@wise/dynamic-flow-client": "5.5.1",
89
+ "@wise/dynamic-flow-types": "4.6.0"
90
90
  },
91
91
  "scripts": {
92
92
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",