@wise/dynamic-flow-client-internal 5.25.1 → 5.25.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +7 -0
- package/build/main.js +394 -342
- package/build/main.mjs +367 -315
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/dynamicFlow/context-menu/useContextMenu.d.ts +2 -1
- package/build/types/dynamicFlow/context-menu/useContextMenu.d.ts.map +1 -1
- package/build/types/dynamicFlow/context-menu/useDFContextMenu.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/package.json +4 -4
package/build/main.js
CHANGED
|
@@ -131,6 +131,7 @@ __export(index_exports, {
|
|
|
131
131
|
DynamicFlowWithRef: () => DynamicFlowWithRef,
|
|
132
132
|
Header: () => Header10,
|
|
133
133
|
Media: () => Media2,
|
|
134
|
+
createCollectionRenderer: () => createCollectionRenderer2,
|
|
134
135
|
findRendererPropsByType: () => import_dynamic_flow_client8.findRendererPropsByType,
|
|
135
136
|
getMargin: () => getMargin2,
|
|
136
137
|
makeCustomFetch: () => import_dynamic_flow_client7.makeHttpClient,
|
|
@@ -145,22 +146,27 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
|
145
146
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
146
147
|
var appVersion = (
|
|
147
148
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
148
|
-
typeof process !== "undefined" ? "5.25.
|
|
149
|
+
typeof process !== "undefined" ? "5.25.3" : "0.0.0"
|
|
149
150
|
);
|
|
150
151
|
|
|
151
152
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
152
153
|
var import_react = require("react");
|
|
153
154
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
154
|
-
function useContextMenu({
|
|
155
|
+
function useContextMenu({
|
|
156
|
+
title,
|
|
157
|
+
subtitle,
|
|
158
|
+
items
|
|
159
|
+
}) {
|
|
155
160
|
const { menuPosition, openMenuAt, closeMenu } = useMenuPosition();
|
|
156
161
|
const onContextMenu = (event) => {
|
|
157
|
-
if (items.length > 0) {
|
|
162
|
+
if (items.length > 0 && !event.shiftKey) {
|
|
158
163
|
event.preventDefault();
|
|
159
164
|
openMenuAt({ x: event.clientX, y: event.clientY });
|
|
160
165
|
}
|
|
161
166
|
};
|
|
162
167
|
const contextMenu = menuPosition ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "df-context-menu", style: { top: menuPosition.y, left: menuPosition.x }, children: [
|
|
163
168
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "menu-header", children: title }),
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "menu-subtitle", children: subtitle }),
|
|
164
170
|
items.map(({ label, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
165
171
|
"button",
|
|
166
172
|
{
|
|
@@ -222,6 +228,7 @@ var useDFContextMenu = (controller) => {
|
|
|
222
228
|
};
|
|
223
229
|
return useContextMenu({
|
|
224
230
|
title: "DynamicFlow Menu (Dev/Staging only)",
|
|
231
|
+
subtitle: "Shift + right-click for browser menu",
|
|
225
232
|
items: isDevOrStaging() ? [
|
|
226
233
|
{
|
|
227
234
|
label: `DF client version: ${appVersion}`,
|
|
@@ -335,7 +342,7 @@ var import_react29 = require("react");
|
|
|
335
342
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
336
343
|
|
|
337
344
|
// ../renderers/src/AlertRenderer/AlertRenderer.tsx
|
|
338
|
-
var
|
|
345
|
+
var import_react4 = require("react");
|
|
339
346
|
|
|
340
347
|
// ../renderers/src/AlertRenderer/ActionPromptComponent.tsx
|
|
341
348
|
var import_components5 = require("@transferwise/components");
|
|
@@ -372,13 +379,13 @@ var isNamedIcon = (name) => {
|
|
|
372
379
|
const iconName = toCapitalisedCamelCase(name);
|
|
373
380
|
return Object.keys(icons).includes(iconName);
|
|
374
381
|
};
|
|
375
|
-
function NamedIcon({ name }) {
|
|
382
|
+
function NamedIcon({ name, size }) {
|
|
376
383
|
if (!isNamedIcon(name)) {
|
|
377
384
|
return null;
|
|
378
385
|
}
|
|
379
386
|
const iconName = toCapitalisedCamelCase(name);
|
|
380
387
|
const Icon = icons[iconName];
|
|
381
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: 24 });
|
|
388
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Icon, { size: size != null ? size : 24 });
|
|
382
389
|
}
|
|
383
390
|
var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
|
|
384
391
|
var capitaliseFirstChar = (value) => value.length === 0 ? "" : `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
@@ -398,11 +405,14 @@ function isValidIconName(name) {
|
|
|
398
405
|
return isNamedIcon(name) || isFlagIcon(name);
|
|
399
406
|
}
|
|
400
407
|
function isValidIconUrn(uri) {
|
|
408
|
+
const name = extractIconNameFromUri(uri);
|
|
409
|
+
return !!name && isValidIconName(name);
|
|
410
|
+
}
|
|
411
|
+
function extractIconNameFromUri(uri) {
|
|
401
412
|
if (!uri.startsWith("urn:wise:icons:")) {
|
|
402
|
-
return
|
|
413
|
+
return void 0;
|
|
403
414
|
}
|
|
404
|
-
|
|
405
|
-
return isValidIconName(name);
|
|
415
|
+
return uri.replace("urn:wise:icons:", "").split("?")[0];
|
|
406
416
|
}
|
|
407
417
|
var DynamicIcon_default = DynamicIcon;
|
|
408
418
|
|
|
@@ -473,23 +483,23 @@ var formatColor = (color) => {
|
|
|
473
483
|
// ../renderers/src/components/Media/AvatarMedia.tsx
|
|
474
484
|
var import_components = require("@transferwise/components");
|
|
475
485
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
486
|
+
var getRenderableAvatar = (avatar, size) => {
|
|
487
|
+
if (avatar.type === "text") {
|
|
488
|
+
return {
|
|
489
|
+
asset: avatar.text,
|
|
490
|
+
badge: avatar.badgeUri ? resolveMediaFromUri(avatar.badgeUri, 16) : void 0
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
return __spreadProps(__spreadValues({}, resolveMediaFromUri(avatar.uri, size)), {
|
|
494
|
+
badge: avatar.badgeUri ? resolveMediaFromUri(avatar.badgeUri, 16) : void 0
|
|
495
|
+
});
|
|
496
|
+
};
|
|
476
497
|
var AvatarMedia = ({
|
|
477
498
|
accessibilityDescription,
|
|
478
499
|
content,
|
|
479
500
|
size
|
|
480
501
|
}) => {
|
|
481
|
-
const
|
|
482
|
-
if (avatar.type === "text") {
|
|
483
|
-
return {
|
|
484
|
-
asset: avatar.text,
|
|
485
|
-
badge: avatar.badgeUri ? resolveMediaFromUri(avatar.badgeUri, 16) : void 0
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
return __spreadProps(__spreadValues({}, resolveMediaFromUri(avatar.uri, size)), {
|
|
489
|
-
badge: avatar.badgeUri ? resolveMediaFromUri(avatar.badgeUri, 16) : void 0
|
|
490
|
-
});
|
|
491
|
-
};
|
|
492
|
-
const avatars = content.map(getRenderableAvatar);
|
|
502
|
+
const avatars = content.map((avatar) => getRenderableAvatar(avatar, size));
|
|
493
503
|
if (avatars.length === 1) {
|
|
494
504
|
const { badge, backgroundColor, color, asset, icon } = avatars[0];
|
|
495
505
|
if (!asset && !icon) {
|
|
@@ -500,7 +510,7 @@ var AvatarMedia = ({
|
|
|
500
510
|
{
|
|
501
511
|
"aria-label": accessibilityDescription,
|
|
502
512
|
size,
|
|
503
|
-
badge: badge
|
|
513
|
+
badge: badge && getAvatarBadgeAsset(badge),
|
|
504
514
|
style: { backgroundColor, color },
|
|
505
515
|
children: icon != null ? icon : asset
|
|
506
516
|
}
|
|
@@ -521,7 +531,7 @@ var AvatarMedia = ({
|
|
|
521
531
|
);
|
|
522
532
|
};
|
|
523
533
|
var DEFAULT_BADGE_BACKGROUND_COLOR = "var(--color-background-neutral)";
|
|
524
|
-
var
|
|
534
|
+
var getAvatarBadgeAsset = ({
|
|
525
535
|
backgroundColor,
|
|
526
536
|
color,
|
|
527
537
|
asset,
|
|
@@ -541,12 +551,14 @@ var getBadge = ({
|
|
|
541
551
|
},
|
|
542
552
|
children: icon || asset
|
|
543
553
|
}
|
|
544
|
-
)
|
|
554
|
+
),
|
|
555
|
+
type: "reference"
|
|
545
556
|
};
|
|
546
557
|
}
|
|
547
558
|
return {
|
|
548
559
|
icon,
|
|
549
|
-
asset
|
|
560
|
+
asset,
|
|
561
|
+
type: "reference"
|
|
550
562
|
};
|
|
551
563
|
};
|
|
552
564
|
|
|
@@ -612,20 +624,12 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
|
|
|
612
624
|
|
|
613
625
|
// ../renderers/src/components/Media/Media.tsx
|
|
614
626
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
615
|
-
var Media = ({
|
|
616
|
-
media,
|
|
617
|
-
preferAvatar = false,
|
|
618
|
-
size
|
|
619
|
-
}) => {
|
|
627
|
+
var Media = ({ media, preferAvatar = false, size }) => {
|
|
620
628
|
switch (media == null ? void 0 : media.type) {
|
|
621
629
|
case "avatar":
|
|
622
630
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
|
|
623
631
|
case "image": {
|
|
624
|
-
const { asset, icon } = resolveMediaFromUri(
|
|
625
|
-
media.uri,
|
|
626
|
-
size,
|
|
627
|
-
media.accessibilityDescription
|
|
628
|
-
);
|
|
632
|
+
const { asset, icon } = resolveMediaFromUri(media.uri, size, media.accessibilityDescription);
|
|
629
633
|
return icon != null ? icon : asset;
|
|
630
634
|
}
|
|
631
635
|
case "legacy": {
|
|
@@ -635,7 +639,26 @@ var Media = ({
|
|
|
635
639
|
return null;
|
|
636
640
|
}
|
|
637
641
|
};
|
|
638
|
-
|
|
642
|
+
function extractFirstImage(media) {
|
|
643
|
+
switch (media.type) {
|
|
644
|
+
case "image":
|
|
645
|
+
return media;
|
|
646
|
+
case "avatar":
|
|
647
|
+
return extractFirstImageFromAvatar(media);
|
|
648
|
+
default:
|
|
649
|
+
return void 0;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
function extractFirstImageFromAvatar(avatar) {
|
|
653
|
+
if (!avatar.content.length) return void 0;
|
|
654
|
+
const firstItem = avatar.content[0];
|
|
655
|
+
if (firstItem.type !== "uri") return void 0;
|
|
656
|
+
return {
|
|
657
|
+
type: "image",
|
|
658
|
+
uri: firstItem.uri,
|
|
659
|
+
accessibilityDescription: avatar.accessibilityDescription
|
|
660
|
+
};
|
|
661
|
+
}
|
|
639
662
|
|
|
640
663
|
// ../renderers/src/components/Media/OptionMedia.tsx
|
|
641
664
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -648,27 +671,6 @@ function OptionMedia(props) {
|
|
|
648
671
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
649
672
|
var getInlineMedia = (media) => media ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Media, { media, preferAvatar: false, size: 24 }) : null;
|
|
650
673
|
|
|
651
|
-
// ../renderers/src/components/Media/getPromptMedia.tsx
|
|
652
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
653
|
-
var getPromptMedia = (media) => {
|
|
654
|
-
if (!media || media.type === "legacy") {
|
|
655
|
-
return void 0;
|
|
656
|
-
}
|
|
657
|
-
if (media.type === "image" && !media.uri.startsWith("urn:")) {
|
|
658
|
-
return {
|
|
659
|
-
imgSrc: media.uri,
|
|
660
|
-
"aria-label": media.accessibilityDescription
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
const _a = media, { accessibilityDescription: ariaLabel } = _a, sansAriaLabel = __objRest(_a, ["accessibilityDescription"]);
|
|
664
|
-
return {
|
|
665
|
-
avatar: {
|
|
666
|
-
asset: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Media, { media: sansAriaLabel, size: 48 })
|
|
667
|
-
},
|
|
668
|
-
"aria-label": ariaLabel
|
|
669
|
-
};
|
|
670
|
-
};
|
|
671
|
-
|
|
672
674
|
// ../renderers/src/utils/layout-utils.ts
|
|
673
675
|
var getMargin = (size) => {
|
|
674
676
|
switch (size) {
|
|
@@ -699,9 +701,170 @@ var getTextAlignment = (align) => {
|
|
|
699
701
|
};
|
|
700
702
|
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
701
703
|
|
|
704
|
+
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
705
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
706
|
+
var maxFlagSize = 600;
|
|
707
|
+
function UrnFlagImage({
|
|
708
|
+
accessibilityDescription,
|
|
709
|
+
align,
|
|
710
|
+
margin,
|
|
711
|
+
size,
|
|
712
|
+
uri
|
|
713
|
+
}) {
|
|
714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
718
|
+
var import_art4 = require("@wise/art");
|
|
719
|
+
var import_react3 = require("react");
|
|
720
|
+
|
|
721
|
+
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
722
|
+
var isAnimated = (uri) => {
|
|
723
|
+
const { rComponents } = stringToURN(uri);
|
|
724
|
+
return rComponents.type === "animated";
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
728
|
+
var import_art3 = require("@wise/art");
|
|
729
|
+
var import_react2 = require("react");
|
|
730
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
731
|
+
var Illustration3DErrorBoundary = class extends import_react2.Component {
|
|
732
|
+
constructor(props) {
|
|
733
|
+
super(props);
|
|
734
|
+
this.state = { hasError: false };
|
|
735
|
+
}
|
|
736
|
+
static getDerivedStateFromError() {
|
|
737
|
+
return { hasError: true };
|
|
738
|
+
}
|
|
739
|
+
componentDidCatch() {
|
|
740
|
+
this.props.onError();
|
|
741
|
+
}
|
|
742
|
+
render() {
|
|
743
|
+
if (this.state.hasError) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
return this.props.children;
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
var SafeIllustration3D = ({
|
|
750
|
+
name,
|
|
751
|
+
size,
|
|
752
|
+
onError
|
|
753
|
+
}) => {
|
|
754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
755
|
+
};
|
|
756
|
+
var SafeIllustration3D_default = SafeIllustration3D;
|
|
757
|
+
|
|
758
|
+
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
759
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
760
|
+
var urnPrefix = "urn:wise:illustrations:";
|
|
761
|
+
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
762
|
+
function UrnIllustration({
|
|
763
|
+
accessibilityDescription,
|
|
764
|
+
align,
|
|
765
|
+
margin,
|
|
766
|
+
size,
|
|
767
|
+
uri
|
|
768
|
+
}) {
|
|
769
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react3.useState)(false);
|
|
770
|
+
const illustrationSize = getIllustrationSize(size);
|
|
771
|
+
const illustrationName = getIllustrationName(uri);
|
|
772
|
+
const illustration3DName = getIllustration3DName(uri);
|
|
773
|
+
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
775
|
+
SafeIllustration3D_default,
|
|
776
|
+
{
|
|
777
|
+
name: illustration3DName,
|
|
778
|
+
size: illustrationSize,
|
|
779
|
+
onError: () => setHas3DFailed(true)
|
|
780
|
+
}
|
|
781
|
+
) });
|
|
782
|
+
}
|
|
783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
784
|
+
import_art4.Illustration,
|
|
785
|
+
{
|
|
786
|
+
className: "df-illustration",
|
|
787
|
+
name: illustrationName,
|
|
788
|
+
size: illustrationSize,
|
|
789
|
+
alt: accessibilityDescription
|
|
790
|
+
}
|
|
791
|
+
) });
|
|
792
|
+
}
|
|
793
|
+
var getIllustrationSize = (size) => ({ xs: "small", sm: "small", md: "medium", lg: "large", xl: "large" })[size] || "medium";
|
|
794
|
+
var getIllustrationName = (uri) => {
|
|
795
|
+
return uri.replace(urnPrefix, "").split("?")[0];
|
|
796
|
+
};
|
|
797
|
+
var getIllustration3DName = (uri) => {
|
|
798
|
+
const illustrationName = getIllustrationName(uri);
|
|
799
|
+
return (0, import_art4.isIllustrationSupport3D)(illustrationName) ? illustrationName : null;
|
|
800
|
+
};
|
|
801
|
+
|
|
802
|
+
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
803
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
804
|
+
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
805
|
+
function UrnImage(props) {
|
|
806
|
+
const { uri } = props;
|
|
807
|
+
if (isUrnIllustration(uri)) {
|
|
808
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
809
|
+
}
|
|
810
|
+
if (isUrnFlag(uri)) {
|
|
811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
812
|
+
}
|
|
813
|
+
return null;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
// ../renderers/src/components/Media/getPromptMedia.tsx
|
|
817
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
818
|
+
var getInfoPromptMedia = (media) => {
|
|
819
|
+
const image = extractFirstImage(media);
|
|
820
|
+
const iconName = (image == null ? void 0 : image.uri) && extractIconNameFromUri(image == null ? void 0 : image.uri);
|
|
821
|
+
if (!iconName || !isNamedIcon(iconName)) return void 0;
|
|
822
|
+
return { asset: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NamedIcon, { name: iconName, size: 24 }) };
|
|
823
|
+
};
|
|
824
|
+
var getActionPromptMedia = (media) => {
|
|
825
|
+
var _a;
|
|
826
|
+
if (media.type === "legacy") {
|
|
827
|
+
return void 0;
|
|
828
|
+
}
|
|
829
|
+
if (media.type === "image" && !isUrnImage(media.uri)) {
|
|
830
|
+
return {
|
|
831
|
+
imgSrc: media.uri,
|
|
832
|
+
"aria-label": media.accessibilityDescription
|
|
833
|
+
};
|
|
834
|
+
}
|
|
835
|
+
const content = extractFirstAvatarContent(media);
|
|
836
|
+
const avatar = content && getRenderableAvatar(content, 48);
|
|
837
|
+
if (!avatar || !avatar.asset && !avatar.icon) {
|
|
838
|
+
return void 0;
|
|
839
|
+
}
|
|
840
|
+
return {
|
|
841
|
+
avatar: {
|
|
842
|
+
asset: (_a = avatar.icon) != null ? _a : avatar.asset,
|
|
843
|
+
badge: avatar.badge && getAvatarBadgeAsset(avatar.badge),
|
|
844
|
+
style: { backgroundColor: avatar.backgroundColor, color: avatar.color }
|
|
845
|
+
},
|
|
846
|
+
"aria-label": media.accessibilityDescription
|
|
847
|
+
};
|
|
848
|
+
};
|
|
849
|
+
var extractFirstAvatarContent = (media) => {
|
|
850
|
+
switch (media.type) {
|
|
851
|
+
case "avatar":
|
|
852
|
+
if (!media.content) return void 0;
|
|
853
|
+
return media.content[0];
|
|
854
|
+
case "image":
|
|
855
|
+
if (!isUrnImage(media.uri)) return void 0;
|
|
856
|
+
return {
|
|
857
|
+
type: "uri",
|
|
858
|
+
uri: media.uri
|
|
859
|
+
};
|
|
860
|
+
default:
|
|
861
|
+
return void 0;
|
|
862
|
+
}
|
|
863
|
+
};
|
|
864
|
+
|
|
702
865
|
// ../renderers/src/AlertRenderer/mappers.tsx
|
|
703
866
|
var import_components4 = require("@transferwise/components");
|
|
704
|
-
var
|
|
867
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
705
868
|
var mapCallToAction = (callToAction) => __spreadValues({
|
|
706
869
|
label: callToAction.title,
|
|
707
870
|
"aria-label": callToAction.accessibilityDescription
|
|
@@ -711,7 +874,7 @@ var promptMarkdownAllowList = [
|
|
|
711
874
|
import_components4.MarkdownNodeType.PARAGRAPH,
|
|
712
875
|
import_components4.MarkdownNodeType.STRONG
|
|
713
876
|
];
|
|
714
|
-
var mapPromptDescription = (markdown) => /* @__PURE__ */ (0,
|
|
877
|
+
var mapPromptDescription = (markdown) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
715
878
|
import_components4.Markdown,
|
|
716
879
|
{
|
|
717
880
|
as: "span",
|
|
@@ -725,7 +888,7 @@ var mapPromptDescription = (markdown) => /* @__PURE__ */ (0, import_jsx_runtime1
|
|
|
725
888
|
var mapPromptSentiment = (context) => context === "positive" ? "success" : context;
|
|
726
889
|
|
|
727
890
|
// ../renderers/src/AlertRenderer/ActionPromptComponent.tsx
|
|
728
|
-
var
|
|
891
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
729
892
|
function ActionPromptComponent({
|
|
730
893
|
callToAction,
|
|
731
894
|
context,
|
|
@@ -736,14 +899,14 @@ function ActionPromptComponent({
|
|
|
736
899
|
secondaryCallToAction,
|
|
737
900
|
title
|
|
738
901
|
}) {
|
|
739
|
-
return /* @__PURE__ */ (0,
|
|
902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
740
903
|
import_components5.ActionPrompt,
|
|
741
904
|
{
|
|
742
905
|
title: title != null ? title : "",
|
|
743
906
|
description: mapPromptDescription(markdown),
|
|
744
907
|
sentiment: mapPromptSentiment(context),
|
|
745
908
|
className: getMargin(margin),
|
|
746
|
-
media:
|
|
909
|
+
media: media && getActionPromptMedia(media),
|
|
747
910
|
action: mapCallToAction(callToAction),
|
|
748
911
|
actionSecondary: secondaryCallToAction ? mapCallToAction(secondaryCallToAction) : void 0,
|
|
749
912
|
onDismiss
|
|
@@ -753,7 +916,7 @@ function ActionPromptComponent({
|
|
|
753
916
|
|
|
754
917
|
// ../renderers/src/AlertRenderer/InfoPromptComponent.tsx
|
|
755
918
|
var import_components6 = require("@transferwise/components");
|
|
756
|
-
var
|
|
919
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
757
920
|
function InfoPromptComponent({
|
|
758
921
|
callToAction,
|
|
759
922
|
context,
|
|
@@ -763,14 +926,14 @@ function InfoPromptComponent({
|
|
|
763
926
|
onDismiss,
|
|
764
927
|
title
|
|
765
928
|
}) {
|
|
766
|
-
return /* @__PURE__ */ (0,
|
|
929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
767
930
|
import_components6.InfoPrompt,
|
|
768
931
|
{
|
|
769
932
|
title,
|
|
770
933
|
description: mapPromptDescription(markdown),
|
|
771
934
|
sentiment: mapPromptSentiment(context),
|
|
772
935
|
className: getMargin(margin),
|
|
773
|
-
media:
|
|
936
|
+
media: media && getInfoPromptMedia(media),
|
|
774
937
|
action: callToAction ? mapCallToAction(callToAction) : void 0,
|
|
775
938
|
onDismiss
|
|
776
939
|
}
|
|
@@ -778,13 +941,13 @@ function InfoPromptComponent({
|
|
|
778
941
|
}
|
|
779
942
|
|
|
780
943
|
// ../renderers/src/AlertRenderer/AlertRenderer.tsx
|
|
781
|
-
var
|
|
944
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
782
945
|
var AlertRenderer = {
|
|
783
946
|
canRenderType: "alert",
|
|
784
947
|
render: AlertRendererComponent
|
|
785
948
|
};
|
|
786
949
|
function AlertRendererComponent(props) {
|
|
787
|
-
const [isVisible, setIsVisible] = (0,
|
|
950
|
+
const [isVisible, setIsVisible] = (0, import_react4.useState)(true);
|
|
788
951
|
const { onDismiss: dismiss } = props;
|
|
789
952
|
if (!isVisible) {
|
|
790
953
|
return null;
|
|
@@ -794,9 +957,9 @@ function AlertRendererComponent(props) {
|
|
|
794
957
|
dismiss();
|
|
795
958
|
} : void 0;
|
|
796
959
|
if (shouldRenderActionPrompt(props)) {
|
|
797
|
-
return /* @__PURE__ */ (0,
|
|
960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ActionPromptComponent, __spreadProps(__spreadValues({}, props), { onDismiss }));
|
|
798
961
|
}
|
|
799
|
-
return /* @__PURE__ */ (0,
|
|
962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InfoPromptComponent, __spreadProps(__spreadValues({}, props), { onDismiss }));
|
|
800
963
|
}
|
|
801
964
|
var shouldRenderActionPrompt = (props) => {
|
|
802
965
|
var _a, _b;
|
|
@@ -808,13 +971,13 @@ var AlertRenderer_default = AlertRenderer;
|
|
|
808
971
|
|
|
809
972
|
// ../renderers/src/BoxRenderer.tsx
|
|
810
973
|
var import_classnames = __toESM(require_classnames());
|
|
811
|
-
var
|
|
974
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
812
975
|
var BoxRenderer = {
|
|
813
976
|
canRenderType: "box",
|
|
814
977
|
render: ({ children, control, margin, width }) => {
|
|
815
978
|
const hasFixedWidth = width !== "xl";
|
|
816
979
|
const hasBorder = control === "bordered" || control === "bordered-web";
|
|
817
|
-
const contents = /* @__PURE__ */ (0,
|
|
980
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
818
981
|
"div",
|
|
819
982
|
{
|
|
820
983
|
className: (0, import_classnames.default)("df-box-renderer", {
|
|
@@ -825,7 +988,7 @@ var BoxRenderer = {
|
|
|
825
988
|
children
|
|
826
989
|
}
|
|
827
990
|
);
|
|
828
|
-
return hasFixedWidth ? /* @__PURE__ */ (0,
|
|
991
|
+
return hasFixedWidth ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
|
|
829
992
|
}
|
|
830
993
|
};
|
|
831
994
|
var BoxRenderer_default = BoxRenderer;
|
|
@@ -845,8 +1008,8 @@ var loading_button_messages_default = (0, import_react_intl.defineMessages)({
|
|
|
845
1008
|
});
|
|
846
1009
|
|
|
847
1010
|
// ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
|
|
848
|
-
var
|
|
849
|
-
var
|
|
1011
|
+
var import_react5 = require("react");
|
|
1012
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
850
1013
|
var AddressValidationButtonRenderer = {
|
|
851
1014
|
canRenderType: "button",
|
|
852
1015
|
canRender: ({ control }) => control === "address-validation",
|
|
@@ -855,8 +1018,8 @@ var AddressValidationButtonRenderer = {
|
|
|
855
1018
|
function AddressValidationButtonComponent(props) {
|
|
856
1019
|
const { disabled, margin, title, stepLoadingState, onClick } = props;
|
|
857
1020
|
const { formatMessage } = (0, import_react_intl2.useIntl)();
|
|
858
|
-
const [spinny, setSpinny] = (0,
|
|
859
|
-
(0,
|
|
1021
|
+
const [spinny, setSpinny] = (0, import_react5.useState)(false);
|
|
1022
|
+
(0, import_react5.useEffect)(() => {
|
|
860
1023
|
if (stepLoadingState === "idle") {
|
|
861
1024
|
setSpinny(false);
|
|
862
1025
|
}
|
|
@@ -866,8 +1029,8 @@ function AddressValidationButtonComponent(props) {
|
|
|
866
1029
|
setSpinny(false);
|
|
867
1030
|
}
|
|
868
1031
|
};
|
|
869
|
-
return /* @__PURE__ */ (0,
|
|
870
|
-
/* @__PURE__ */ (0,
|
|
1032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
|
|
1033
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
871
1034
|
import_components7.Button,
|
|
872
1035
|
{
|
|
873
1036
|
v2: true,
|
|
@@ -884,7 +1047,7 @@ function AddressValidationButtonComponent(props) {
|
|
|
884
1047
|
children: title
|
|
885
1048
|
}
|
|
886
1049
|
),
|
|
887
|
-
spinny && /* @__PURE__ */ (0,
|
|
1050
|
+
spinny && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components7.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
|
|
888
1051
|
] });
|
|
889
1052
|
}
|
|
890
1053
|
var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
|
|
@@ -915,7 +1078,7 @@ var mapLegacyButtonSize = (size) => {
|
|
|
915
1078
|
};
|
|
916
1079
|
|
|
917
1080
|
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
918
|
-
var
|
|
1081
|
+
var import_react6 = require("react");
|
|
919
1082
|
|
|
920
1083
|
// ../renderers/src/components/Media/getAddonStartMedia.ts
|
|
921
1084
|
var getAddonStartMedia = (media) => {
|
|
@@ -936,7 +1099,7 @@ var getAddonStartMedia = (media) => {
|
|
|
936
1099
|
|
|
937
1100
|
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
938
1101
|
var import_classnames2 = __toESM(require_classnames());
|
|
939
|
-
var
|
|
1102
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
940
1103
|
var ButtonRenderer = {
|
|
941
1104
|
canRenderType: "button",
|
|
942
1105
|
render: ButtonComponent
|
|
@@ -954,8 +1117,8 @@ function ButtonComponent(props) {
|
|
|
954
1117
|
stepLoadingState,
|
|
955
1118
|
onClick
|
|
956
1119
|
} = props;
|
|
957
|
-
const [spinny, setSpinny] = (0,
|
|
958
|
-
(0,
|
|
1120
|
+
const [spinny, setSpinny] = (0, import_react6.useState)(false);
|
|
1121
|
+
(0, import_react6.useEffect)(() => {
|
|
959
1122
|
if (stepLoadingState === "idle") {
|
|
960
1123
|
setSpinny(false);
|
|
961
1124
|
}
|
|
@@ -985,7 +1148,7 @@ function ButtonComponent(props) {
|
|
|
985
1148
|
onClick();
|
|
986
1149
|
}
|
|
987
1150
|
};
|
|
988
|
-
return /* @__PURE__ */ (0,
|
|
1151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components8.Button, __spreadProps(__spreadValues({}, buttonProps), { children: title }));
|
|
989
1152
|
}
|
|
990
1153
|
var getSentiment = (context) => context === "negative" ? "negative" : "default";
|
|
991
1154
|
var getPriority = (control, tags) => {
|
|
@@ -1003,11 +1166,11 @@ var import_components13 = require("@transferwise/components");
|
|
|
1003
1166
|
var import_components10 = require("@transferwise/components");
|
|
1004
1167
|
|
|
1005
1168
|
// ../renderers/src/utils/useScrollToError.ts
|
|
1006
|
-
var
|
|
1169
|
+
var import_react7 = require("react");
|
|
1007
1170
|
var useScrollToError = (validationState, features) => {
|
|
1008
|
-
const ref = (0,
|
|
1171
|
+
const ref = (0, import_react7.useRef)(null);
|
|
1009
1172
|
const enabled = (features == null ? void 0 : features.scrollToError) !== false;
|
|
1010
|
-
(0,
|
|
1173
|
+
(0, import_react7.useEffect)(() => {
|
|
1011
1174
|
if ((validationState == null ? void 0 : validationState.status) === "invalid" && (validationState == null ? void 0 : validationState.message) && enabled) {
|
|
1012
1175
|
scrollToIfNotVisible(ref.current);
|
|
1013
1176
|
}
|
|
@@ -1039,13 +1202,13 @@ var help_messages_default = (0, import_react_intl3.defineMessages)({
|
|
|
1039
1202
|
});
|
|
1040
1203
|
|
|
1041
1204
|
// ../renderers/src/components/Help.tsx
|
|
1042
|
-
var
|
|
1205
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1043
1206
|
function Help({ help, onClick }) {
|
|
1044
1207
|
const intl = (0, import_react_intl4.useIntl)();
|
|
1045
|
-
return /* @__PURE__ */ (0,
|
|
1208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1046
1209
|
import_components9.Info,
|
|
1047
1210
|
{
|
|
1048
|
-
content: /* @__PURE__ */ (0,
|
|
1211
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components9.Markdown, { config: { link: { target: "_blank" } }, children: help }),
|
|
1049
1212
|
presentation: "POPOVER",
|
|
1050
1213
|
size: "sm",
|
|
1051
1214
|
"aria-label": intl.formatMessage(help_messages_default.helpAria),
|
|
@@ -1056,16 +1219,16 @@ function Help({ help, onClick }) {
|
|
|
1056
1219
|
var Help_default = Help;
|
|
1057
1220
|
|
|
1058
1221
|
// ../renderers/src/components/LabelContentWithHelp.tsx
|
|
1059
|
-
var
|
|
1222
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1060
1223
|
function LabelContentWithHelp({ text, help }) {
|
|
1061
|
-
return /* @__PURE__ */ (0,
|
|
1224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
|
|
1062
1225
|
text,
|
|
1063
|
-
/* @__PURE__ */ (0,
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Help_default, { help })
|
|
1064
1227
|
] });
|
|
1065
1228
|
}
|
|
1066
1229
|
|
|
1067
1230
|
// ../renderers/src/components/FieldInput.tsx
|
|
1068
|
-
var
|
|
1231
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1069
1232
|
function FieldInput({
|
|
1070
1233
|
id,
|
|
1071
1234
|
children,
|
|
@@ -1078,9 +1241,9 @@ function FieldInput({
|
|
|
1078
1241
|
features
|
|
1079
1242
|
}) {
|
|
1080
1243
|
var _a;
|
|
1081
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
1244
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
1082
1245
|
const { ref } = useScrollToError(validation, features);
|
|
1083
|
-
return /* @__PURE__ */ (0,
|
|
1246
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1084
1247
|
import_components10.Field,
|
|
1085
1248
|
{
|
|
1086
1249
|
id,
|
|
@@ -1108,22 +1271,22 @@ var FieldInput_default = FieldInput;
|
|
|
1108
1271
|
|
|
1109
1272
|
// ../renderers/src/utils/listItem/getAdditionalText.tsx
|
|
1110
1273
|
var import_components11 = require("@transferwise/components");
|
|
1111
|
-
var
|
|
1274
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1112
1275
|
var getAdditionalText = (additionalText) => {
|
|
1113
1276
|
if (!additionalText) {
|
|
1114
1277
|
return void 0;
|
|
1115
1278
|
}
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
1279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components11.ListItem.AdditionalInfo, { children: additionalText });
|
|
1117
1280
|
};
|
|
1118
1281
|
|
|
1119
1282
|
// ../renderers/src/utils/listItem/getInlineAlert.tsx
|
|
1120
1283
|
var import_components12 = require("@transferwise/components");
|
|
1121
|
-
var
|
|
1122
|
-
var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0,
|
|
1284
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1285
|
+
var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components12.ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
|
|
1123
1286
|
|
|
1124
1287
|
// ../renderers/src/utils/listItem/getMedia.tsx
|
|
1125
|
-
var
|
|
1126
|
-
var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ (0,
|
|
1288
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1289
|
+
var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(OptionMedia, { media, preferAvatar }) : void 0;
|
|
1127
1290
|
|
|
1128
1291
|
// ../renderers/src/utils/listItem/getSupportingValues.ts
|
|
1129
1292
|
var getSupportingValues = (supportingValues) => {
|
|
@@ -1131,18 +1294,18 @@ var getSupportingValues = (supportingValues) => {
|
|
|
1131
1294
|
};
|
|
1132
1295
|
|
|
1133
1296
|
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
1134
|
-
var
|
|
1297
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1135
1298
|
var CheckboxInputRenderer = {
|
|
1136
1299
|
canRenderType: "input-checkbox",
|
|
1137
1300
|
render: (props) => {
|
|
1138
1301
|
switch (props.control) {
|
|
1139
1302
|
case "switch-item":
|
|
1140
|
-
return /* @__PURE__ */ (0,
|
|
1303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(SwitchItemComponent, __spreadValues({}, props));
|
|
1141
1304
|
case "checkbox-item":
|
|
1142
|
-
return /* @__PURE__ */ (0,
|
|
1305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckboxItemComponent, __spreadValues({}, props));
|
|
1143
1306
|
case "checkbox":
|
|
1144
1307
|
default:
|
|
1145
|
-
return /* @__PURE__ */ (0,
|
|
1308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckboxComponent, __spreadValues({}, props));
|
|
1146
1309
|
}
|
|
1147
1310
|
}
|
|
1148
1311
|
};
|
|
@@ -1167,7 +1330,7 @@ var CheckboxComponent = (props) => {
|
|
|
1167
1330
|
"value"
|
|
1168
1331
|
]);
|
|
1169
1332
|
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
1170
|
-
return /* @__PURE__ */ (0,
|
|
1333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1171
1334
|
FieldInput_default,
|
|
1172
1335
|
{
|
|
1173
1336
|
id,
|
|
@@ -1178,7 +1341,7 @@ var CheckboxComponent = (props) => {
|
|
|
1178
1341
|
inlineAlert: rest.inlineAlert,
|
|
1179
1342
|
loadingState: rest.fieldLoadingState,
|
|
1180
1343
|
features: rest.features,
|
|
1181
|
-
children: /* @__PURE__ */ (0,
|
|
1344
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.Checkbox, __spreadValues({ id }, checkboxProps))
|
|
1182
1345
|
}
|
|
1183
1346
|
);
|
|
1184
1347
|
};
|
|
@@ -1197,7 +1360,7 @@ var CheckboxItemComponent = (props) => {
|
|
|
1197
1360
|
onChange
|
|
1198
1361
|
} = props;
|
|
1199
1362
|
const { ref } = useScrollToError(validationState, features);
|
|
1200
|
-
return /* @__PURE__ */ (0,
|
|
1363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1201
1364
|
import_components13.ListItem,
|
|
1202
1365
|
__spreadValues({
|
|
1203
1366
|
title,
|
|
@@ -1206,7 +1369,7 @@ var CheckboxItemComponent = (props) => {
|
|
|
1206
1369
|
media: getMedia(media, false),
|
|
1207
1370
|
disabled,
|
|
1208
1371
|
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
1209
|
-
control: /* @__PURE__ */ (0,
|
|
1372
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.ListItem.Checkbox, { checked: value, onChange: () => onChange(!value) })
|
|
1210
1373
|
}, getSupportingValues(supportingValues))
|
|
1211
1374
|
) });
|
|
1212
1375
|
};
|
|
@@ -1225,7 +1388,7 @@ var SwitchItemComponent = (props) => {
|
|
|
1225
1388
|
onChange
|
|
1226
1389
|
} = props;
|
|
1227
1390
|
const { ref } = useScrollToError(validationState, features);
|
|
1228
|
-
return /* @__PURE__ */ (0,
|
|
1391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1229
1392
|
import_components13.ListItem,
|
|
1230
1393
|
__spreadValues({
|
|
1231
1394
|
title,
|
|
@@ -1234,13 +1397,13 @@ var SwitchItemComponent = (props) => {
|
|
|
1234
1397
|
media: getMedia(media, false),
|
|
1235
1398
|
disabled,
|
|
1236
1399
|
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
1237
|
-
control: /* @__PURE__ */ (0,
|
|
1400
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.ListItem.Switch, { checked: value, onClick: () => onChange(!value) })
|
|
1238
1401
|
}, getSupportingValues(supportingValues))
|
|
1239
1402
|
) });
|
|
1240
1403
|
};
|
|
1241
1404
|
var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
1242
1405
|
if ((validationState == null ? void 0 : validationState.status) === "invalid") {
|
|
1243
|
-
return /* @__PURE__ */ (0,
|
|
1406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components13.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
|
|
1244
1407
|
}
|
|
1245
1408
|
return getInlineAlert(inlineAlert);
|
|
1246
1409
|
};
|
|
@@ -2214,11 +2377,11 @@ function useWindowVirtualizer(options) {
|
|
|
2214
2377
|
|
|
2215
2378
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2216
2379
|
var import_components15 = require("@transferwise/components");
|
|
2217
|
-
var
|
|
2380
|
+
var import_react9 = require("react");
|
|
2218
2381
|
|
|
2219
2382
|
// ../renderers/src/step/StepFooter.tsx
|
|
2220
2383
|
var import_components14 = require("@transferwise/components");
|
|
2221
|
-
var
|
|
2384
|
+
var import_react8 = require("react");
|
|
2222
2385
|
var import_react_intl6 = require("react-intl");
|
|
2223
2386
|
|
|
2224
2387
|
// ../renderers/src/messages/step.messages.ts
|
|
@@ -2232,23 +2395,23 @@ var step_messages_default = (0, import_react_intl5.defineMessages)({
|
|
|
2232
2395
|
});
|
|
2233
2396
|
|
|
2234
2397
|
// ../renderers/src/step/StepFooter.tsx
|
|
2235
|
-
var
|
|
2398
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2236
2399
|
var SCROLL_TO_BOTTOM = "scroll-to-bottom";
|
|
2237
2400
|
var StepFooter = ({ footer, tags }) => {
|
|
2238
2401
|
if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
|
|
2239
|
-
return /* @__PURE__ */ (0,
|
|
2402
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(FooterWithScrollButton, { footer });
|
|
2240
2403
|
}
|
|
2241
|
-
return /* @__PURE__ */ (0,
|
|
2404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DefaultFooter, { footer });
|
|
2242
2405
|
};
|
|
2243
2406
|
var DefaultFooter = ({ footer }) => {
|
|
2244
2407
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
2245
|
-
return hasFooter ? /* @__PURE__ */ (0,
|
|
2408
|
+
return hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0;
|
|
2246
2409
|
};
|
|
2247
2410
|
var FooterWithScrollButton = ({ footer }) => {
|
|
2248
2411
|
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
2249
|
-
const endOfLayoutRef = (0,
|
|
2412
|
+
const endOfLayoutRef = (0, import_react8.useRef)(null);
|
|
2250
2413
|
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
2251
|
-
const scrollButton = /* @__PURE__ */ (0,
|
|
2414
|
+
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
2252
2415
|
import_components14.Button,
|
|
2253
2416
|
{
|
|
2254
2417
|
className: "m-b-1",
|
|
@@ -2264,19 +2427,19 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
2264
2427
|
);
|
|
2265
2428
|
const hasStepFooterContent = footer && Array.isArray(footer) && footer.length > 0;
|
|
2266
2429
|
if (isElementVisible && !hasStepFooterContent) {
|
|
2267
|
-
return /* @__PURE__ */ (0,
|
|
2430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
|
|
2268
2431
|
}
|
|
2269
|
-
return /* @__PURE__ */ (0,
|
|
2270
|
-
/* @__PURE__ */ (0,
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "df-step-fixed__footer", children: [
|
|
2272
2435
|
!isElementVisible && scrollButton,
|
|
2273
2436
|
footer
|
|
2274
2437
|
] })
|
|
2275
2438
|
] });
|
|
2276
2439
|
};
|
|
2277
2440
|
var useIsElementVisible = (elementRef) => {
|
|
2278
|
-
const [isVisible, setIsVisible] = (0,
|
|
2279
|
-
(0,
|
|
2441
|
+
const [isVisible, setIsVisible] = (0, import_react8.useState)(false);
|
|
2442
|
+
(0, import_react8.useEffect)(() => {
|
|
2280
2443
|
const element = elementRef.current;
|
|
2281
2444
|
if (!element) return;
|
|
2282
2445
|
const observer = new IntersectionObserver(([entry]) => {
|
|
@@ -2289,12 +2452,12 @@ var useIsElementVisible = (elementRef) => {
|
|
|
2289
2452
|
};
|
|
2290
2453
|
|
|
2291
2454
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2292
|
-
var
|
|
2455
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2293
2456
|
var ContentComponent = (props) => {
|
|
2294
2457
|
const { state, status, SectionHeader, Item } = props;
|
|
2295
|
-
const endOfContentRef = (0,
|
|
2458
|
+
const endOfContentRef = (0, import_react9.useRef)(null);
|
|
2296
2459
|
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
2297
|
-
(0,
|
|
2460
|
+
(0, import_react9.useEffect)(() => {
|
|
2298
2461
|
var _a;
|
|
2299
2462
|
if (isBottomVisible && status.type === "idle" && status.loadMore) {
|
|
2300
2463
|
(_a = status.loadMore) == null ? void 0 : _a.call(status);
|
|
@@ -2318,9 +2481,9 @@ var ContentComponent = (props) => {
|
|
|
2318
2481
|
type: "item"
|
|
2319
2482
|
}))
|
|
2320
2483
|
]);
|
|
2321
|
-
const listRef = (0,
|
|
2322
|
-
const listOffsetRef = (0,
|
|
2323
|
-
(0,
|
|
2484
|
+
const listRef = (0, import_react9.useRef)(null);
|
|
2485
|
+
const listOffsetRef = (0, import_react9.useRef)(0);
|
|
2486
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
2324
2487
|
var _a, _b;
|
|
2325
2488
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
2326
2489
|
});
|
|
@@ -2331,9 +2494,9 @@ var ContentComponent = (props) => {
|
|
|
2331
2494
|
// eslint-disable-next-line react-hooks/refs
|
|
2332
2495
|
scrollMargin: listOffsetRef.current
|
|
2333
2496
|
});
|
|
2334
|
-
return /* @__PURE__ */ (0,
|
|
2497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref: listRef, children: [
|
|
2335
2498
|
state.beforeSections,
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2499
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2337
2500
|
"div",
|
|
2338
2501
|
{
|
|
2339
2502
|
style: {
|
|
@@ -2346,7 +2509,7 @@ var ContentComponent = (props) => {
|
|
|
2346
2509
|
if (!i) {
|
|
2347
2510
|
return null;
|
|
2348
2511
|
}
|
|
2349
|
-
return /* @__PURE__ */ (0,
|
|
2512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
2350
2513
|
"div",
|
|
2351
2514
|
{
|
|
2352
2515
|
ref: virtualizer.measureElement,
|
|
@@ -2358,16 +2521,16 @@ var ContentComponent = (props) => {
|
|
|
2358
2521
|
width: "100%",
|
|
2359
2522
|
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
2360
2523
|
},
|
|
2361
|
-
children: i.type === "header" ? /* @__PURE__ */ (0,
|
|
2524
|
+
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Item, __spreadValues({}, i.item))
|
|
2362
2525
|
},
|
|
2363
2526
|
item.key
|
|
2364
2527
|
);
|
|
2365
2528
|
})
|
|
2366
2529
|
}
|
|
2367
2530
|
),
|
|
2368
|
-
/* @__PURE__ */ (0,
|
|
2369
|
-
status.type === "idle" && status.loadMore || status.type === "loading" && status.reason === "pagination" ? /* @__PURE__ */ (0,
|
|
2370
|
-
status.type === "error" && status.reason === "pagination" ? /* @__PURE__ */ (0,
|
|
2531
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: [
|
|
2532
|
+
status.type === "idle" && status.loadMore || status.type === "loading" && status.reason === "pagination" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components15.ProcessIndicator, { size: "xs" }) : null,
|
|
2533
|
+
status.type === "error" && status.reason === "pagination" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "d-flex m-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components15.Button, { v2: true, size: "sm", priority: "secondary-neutral", onClick: status.retry, children: "Load more" }) }) : null
|
|
2371
2534
|
] }),
|
|
2372
2535
|
state.afterSections
|
|
2373
2536
|
] });
|
|
@@ -2375,12 +2538,12 @@ var ContentComponent = (props) => {
|
|
|
2375
2538
|
|
|
2376
2539
|
// ../renderers/src/CollectionRenderer/components/FilterComponent.tsx
|
|
2377
2540
|
var import_components16 = require("@transferwise/components");
|
|
2378
|
-
var
|
|
2541
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
2379
2542
|
var FiltersComponent = ({ state }) => {
|
|
2380
2543
|
const { filters } = state;
|
|
2381
|
-
return /* @__PURE__ */ (0,
|
|
2544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "df-filters-container", children: filters.map((filter) => {
|
|
2382
2545
|
var _a;
|
|
2383
|
-
return /* @__PURE__ */ (0,
|
|
2546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FilterComponent, __spreadValues({}, filter), JSON.stringify((_a = filter.options) == null ? void 0 : _a.map((o) => o.value)));
|
|
2384
2547
|
}) });
|
|
2385
2548
|
};
|
|
2386
2549
|
var FilterComponent = (filter) => {
|
|
@@ -2388,7 +2551,7 @@ var FilterComponent = (filter) => {
|
|
|
2388
2551
|
if (!options) {
|
|
2389
2552
|
return null;
|
|
2390
2553
|
}
|
|
2391
|
-
return /* @__PURE__ */ (0,
|
|
2554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2392
2555
|
import_components16.Chips,
|
|
2393
2556
|
{
|
|
2394
2557
|
className: "m-b-1",
|
|
@@ -2418,7 +2581,7 @@ var import_components19 = require("@transferwise/components");
|
|
|
2418
2581
|
|
|
2419
2582
|
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
2420
2583
|
var import_components17 = require("@transferwise/components");
|
|
2421
|
-
var
|
|
2584
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2422
2585
|
var getAdditionalInfo = (additionalInfo) => {
|
|
2423
2586
|
var _a, _b;
|
|
2424
2587
|
if (!additionalInfo) {
|
|
@@ -2426,7 +2589,7 @@ var getAdditionalInfo = (additionalInfo) => {
|
|
|
2426
2589
|
}
|
|
2427
2590
|
const { href, text, onClick } = additionalInfo;
|
|
2428
2591
|
if (href || onClick) {
|
|
2429
|
-
return /* @__PURE__ */ (0,
|
|
2592
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2430
2593
|
import_components17.ListItem.AdditionalInfo,
|
|
2431
2594
|
{
|
|
2432
2595
|
action: __spreadValues({
|
|
@@ -2435,19 +2598,19 @@ var getAdditionalInfo = (additionalInfo) => {
|
|
|
2435
2598
|
}
|
|
2436
2599
|
);
|
|
2437
2600
|
}
|
|
2438
|
-
return /* @__PURE__ */ (0,
|
|
2601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components17.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
2439
2602
|
};
|
|
2440
2603
|
|
|
2441
2604
|
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
2442
2605
|
var import_components18 = require("@transferwise/components");
|
|
2443
|
-
var
|
|
2606
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2444
2607
|
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
2445
2608
|
if (!callToAction) {
|
|
2446
2609
|
return void 0;
|
|
2447
2610
|
}
|
|
2448
2611
|
const { accessibilityDescription, title, context } = callToAction;
|
|
2449
2612
|
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
2450
|
-
return /* @__PURE__ */ (0,
|
|
2613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
2451
2614
|
import_components18.ListItem.Button,
|
|
2452
2615
|
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
2453
2616
|
partiallyInteractive: !fullyInteractive,
|
|
@@ -2472,7 +2635,7 @@ var shouldUseAvatar = (control, tags) => {
|
|
|
2472
2635
|
};
|
|
2473
2636
|
|
|
2474
2637
|
// ../renderers/src/CollectionRenderer/components/ItemComponent.tsx
|
|
2475
|
-
var
|
|
2638
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2476
2639
|
var ItemComponent = (props) => {
|
|
2477
2640
|
var _a, _b;
|
|
2478
2641
|
const {
|
|
@@ -2493,7 +2656,7 @@ var ItemComponent = (props) => {
|
|
|
2493
2656
|
ctaSecondary: (_a = tags == null ? void 0 : tags.includes("cta-secondary")) != null ? _a : false,
|
|
2494
2657
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
2495
2658
|
};
|
|
2496
|
-
return /* @__PURE__ */ (0,
|
|
2659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2497
2660
|
import_components19.ListItem,
|
|
2498
2661
|
{
|
|
2499
2662
|
title,
|
|
@@ -2510,10 +2673,10 @@ var ItemComponent = (props) => {
|
|
|
2510
2673
|
};
|
|
2511
2674
|
var getNavigationControl = (onClick, href) => {
|
|
2512
2675
|
if (href) {
|
|
2513
|
-
return /* @__PURE__ */ (0,
|
|
2676
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components19.ListItem.Navigation, { href });
|
|
2514
2677
|
}
|
|
2515
2678
|
if (onClick) {
|
|
2516
|
-
return /* @__PURE__ */ (0,
|
|
2679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components19.ListItem.Navigation, { onClick });
|
|
2517
2680
|
}
|
|
2518
2681
|
return null;
|
|
2519
2682
|
};
|
|
@@ -2521,13 +2684,13 @@ var getNavigationControl = (onClick, href) => {
|
|
|
2521
2684
|
// ../renderers/src/CollectionRenderer/components/SearchComponent.tsx
|
|
2522
2685
|
var import_components20 = require("@transferwise/components");
|
|
2523
2686
|
var import_icons = require("@transferwise/icons");
|
|
2524
|
-
var
|
|
2687
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2525
2688
|
var SearchComponent = ({ state, status, features }) => {
|
|
2526
2689
|
const { search } = state;
|
|
2527
2690
|
if (!search) {
|
|
2528
2691
|
return;
|
|
2529
2692
|
}
|
|
2530
|
-
return /* @__PURE__ */ (0,
|
|
2693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2531
2694
|
FieldInput_default,
|
|
2532
2695
|
{
|
|
2533
2696
|
id: "search",
|
|
@@ -2536,12 +2699,12 @@ var SearchComponent = ({ state, status, features }) => {
|
|
|
2536
2699
|
help: "",
|
|
2537
2700
|
label: search.title,
|
|
2538
2701
|
features,
|
|
2539
|
-
children: /* @__PURE__ */ (0,
|
|
2702
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2540
2703
|
import_components20.InputGroup,
|
|
2541
2704
|
{
|
|
2542
|
-
addonStart: { content: /* @__PURE__ */ (0,
|
|
2543
|
-
addonEnd: status.type === "loading" ? { content: /* @__PURE__ */ (0,
|
|
2544
|
-
children: /* @__PURE__ */ (0,
|
|
2705
|
+
addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_icons.Search, { size: 24 }) },
|
|
2706
|
+
addonEnd: status.type === "loading" ? { content: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components20.ProcessIndicator, { size: "xs" }) } : void 0,
|
|
2707
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2545
2708
|
import_components20.Input,
|
|
2546
2709
|
{
|
|
2547
2710
|
id: "search",
|
|
@@ -2562,14 +2725,14 @@ var SearchComponent = ({ state, status, features }) => {
|
|
|
2562
2725
|
};
|
|
2563
2726
|
|
|
2564
2727
|
// ../renderers/src/CollectionRenderer/components/SectionHeaderComponent.tsx
|
|
2565
|
-
var
|
|
2728
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2566
2729
|
var SectionHeaderComponent = ({
|
|
2567
2730
|
title,
|
|
2568
2731
|
callToAction
|
|
2569
|
-
}) => /* @__PURE__ */ (0,
|
|
2732
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Header, { title, callToAction });
|
|
2570
2733
|
|
|
2571
2734
|
// ../renderers/src/CollectionRenderer/createCollectionRenderer.tsx
|
|
2572
|
-
var
|
|
2735
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
2573
2736
|
var createCollectionRenderer = (canRender, components) => {
|
|
2574
2737
|
const componentsWithDefaults = __spreadValues({
|
|
2575
2738
|
Search: SearchComponent,
|
|
@@ -2583,22 +2746,22 @@ var createCollectionRenderer = (canRender, components) => {
|
|
|
2583
2746
|
canRenderType: "collection",
|
|
2584
2747
|
canRender,
|
|
2585
2748
|
render: (props) => {
|
|
2586
|
-
return /* @__PURE__ */ (0,
|
|
2749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CollectionRendererComponent, __spreadValues(__spreadValues({}, props), componentsWithDefaults));
|
|
2587
2750
|
}
|
|
2588
2751
|
};
|
|
2589
2752
|
};
|
|
2590
2753
|
|
|
2591
2754
|
// ../renderers/src/CollectionRenderer/CollectionRenderer.tsx
|
|
2592
|
-
var
|
|
2755
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
2593
2756
|
var CollectionRendererComponent = (props) => {
|
|
2594
2757
|
const { status, Search: Search4, Filters, Results } = props;
|
|
2595
|
-
return /* @__PURE__ */ (0,
|
|
2596
|
-
/* @__PURE__ */ (0,
|
|
2597
|
-
/* @__PURE__ */ (0,
|
|
2598
|
-
status.type === "idle" || status.type === "loading" ? /* @__PURE__ */ (0,
|
|
2599
|
-
status.type === "error" && status.reason === "search" && /* @__PURE__ */ (0,
|
|
2758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2759
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Search4, __spreadValues({}, props)),
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Filters, __spreadValues({}, props)),
|
|
2761
|
+
status.type === "idle" || status.type === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Results, __spreadValues({}, props)) : void 0,
|
|
2762
|
+
status.type === "error" && status.reason === "search" && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_components21.InlinePrompt, { width: "full", sentiment: "negative", children: [
|
|
2600
2763
|
"Something went wrong,\xA0",
|
|
2601
|
-
/* @__PURE__ */ (0,
|
|
2764
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components21.Link, { onClick: status.retry, children: "click here to retry" })
|
|
2602
2765
|
] })
|
|
2603
2766
|
] });
|
|
2604
2767
|
};
|
|
@@ -2609,14 +2772,14 @@ var CollectionRenderer_default = CollectionRenderer;
|
|
|
2609
2772
|
var import_classnames3 = __toESM(require_classnames());
|
|
2610
2773
|
|
|
2611
2774
|
// ../renderers/src/utils/useIsCollapsed.ts
|
|
2612
|
-
var
|
|
2775
|
+
var import_react10 = require("react");
|
|
2613
2776
|
var COLLAPSE_QUERY = "(max-width: 767.98px)";
|
|
2614
2777
|
var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
|
|
2615
2778
|
var useIsCollapsed = () => {
|
|
2616
|
-
const [collapsed, setCollapsed] = (0,
|
|
2779
|
+
const [collapsed, setCollapsed] = (0, import_react10.useState)(
|
|
2617
2780
|
() => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
|
|
2618
2781
|
);
|
|
2619
|
-
(0,
|
|
2782
|
+
(0, import_react10.useEffect)(() => {
|
|
2620
2783
|
if (supportsMatchMedia()) {
|
|
2621
2784
|
const mql = window.matchMedia(COLLAPSE_QUERY);
|
|
2622
2785
|
const update = () => setCollapsed(mql.matches);
|
|
@@ -2629,7 +2792,7 @@ var useIsCollapsed = () => {
|
|
|
2629
2792
|
};
|
|
2630
2793
|
|
|
2631
2794
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
2632
|
-
var
|
|
2795
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2633
2796
|
var RIGHT_FIRST_STACKING = "right-first-stacking";
|
|
2634
2797
|
var ColumnsRenderer = {
|
|
2635
2798
|
canRenderType: "columns",
|
|
@@ -2645,9 +2808,9 @@ function ColumnsRendererComponent({
|
|
|
2645
2808
|
var _a;
|
|
2646
2809
|
const isCollapsed = useIsCollapsed();
|
|
2647
2810
|
const reverse = isCollapsed && ((_a = tags == null ? void 0 : tags.includes(RIGHT_FIRST_STACKING)) != null ? _a : false);
|
|
2648
|
-
const startColumn = /* @__PURE__ */ (0,
|
|
2649
|
-
const endColumn = /* @__PURE__ */ (0,
|
|
2650
|
-
return /* @__PURE__ */ (0,
|
|
2811
|
+
const startColumn = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "df-columns-renderer-column", children: startChildren });
|
|
2812
|
+
const endColumn = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "df-columns-renderer-column", children: endChildren });
|
|
2813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
2651
2814
|
"div",
|
|
2652
2815
|
{
|
|
2653
2816
|
className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
|
|
@@ -2691,7 +2854,7 @@ var dateToDateString = (date) => {
|
|
|
2691
2854
|
};
|
|
2692
2855
|
|
|
2693
2856
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
2694
|
-
var
|
|
2857
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2695
2858
|
function VariableDateInput({
|
|
2696
2859
|
control,
|
|
2697
2860
|
inputProps
|
|
@@ -2707,7 +2870,7 @@ function VariableDateInput({
|
|
|
2707
2870
|
onFocus
|
|
2708
2871
|
} = inputProps;
|
|
2709
2872
|
if (control === "date-lookup") {
|
|
2710
|
-
return /* @__PURE__ */ (0,
|
|
2873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2711
2874
|
import_components22.DateLookup,
|
|
2712
2875
|
{
|
|
2713
2876
|
value: dateStringToDateOrNull(inputProps.value),
|
|
@@ -2723,7 +2886,7 @@ function VariableDateInput({
|
|
|
2723
2886
|
}
|
|
2724
2887
|
);
|
|
2725
2888
|
}
|
|
2726
|
-
return /* @__PURE__ */ (0,
|
|
2889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2727
2890
|
import_components22.DateInput,
|
|
2728
2891
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
2729
2892
|
dayAutoComplete: getAutocompleteString(autoComplete, "day"),
|
|
@@ -2740,7 +2903,7 @@ var getAutocompleteString = (value, suffix) => {
|
|
|
2740
2903
|
var VariableDateInput_default = VariableDateInput;
|
|
2741
2904
|
|
|
2742
2905
|
// ../renderers/src/DateInputRenderer.tsx
|
|
2743
|
-
var
|
|
2906
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2744
2907
|
var DateInputRenderer = {
|
|
2745
2908
|
canRenderType: "input-date",
|
|
2746
2909
|
render: (props) => {
|
|
@@ -2765,7 +2928,7 @@ var DateInputRenderer = {
|
|
|
2765
2928
|
]);
|
|
2766
2929
|
const value = initialValue != null ? initialValue : "";
|
|
2767
2930
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
2768
|
-
return /* @__PURE__ */ (0,
|
|
2931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2769
2932
|
FieldInput_default,
|
|
2770
2933
|
{
|
|
2771
2934
|
id,
|
|
@@ -2776,7 +2939,7 @@ var DateInputRenderer = {
|
|
|
2776
2939
|
loadingState: props.fieldLoadingState,
|
|
2777
2940
|
help,
|
|
2778
2941
|
features: props.features,
|
|
2779
|
-
children: /* @__PURE__ */ (0,
|
|
2942
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(VariableDateInput_default, { control, inputProps })
|
|
2780
2943
|
}
|
|
2781
2944
|
);
|
|
2782
2945
|
}
|
|
@@ -2788,7 +2951,7 @@ var import_components25 = require("@transferwise/components");
|
|
|
2788
2951
|
|
|
2789
2952
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
2790
2953
|
var import_components24 = require("@transferwise/components");
|
|
2791
|
-
var
|
|
2954
|
+
var import_react11 = require("react");
|
|
2792
2955
|
var import_react_intl10 = require("react-intl");
|
|
2793
2956
|
|
|
2794
2957
|
// ../renderers/src/messages/filter.messages.ts
|
|
@@ -2898,7 +3061,7 @@ var getGroupsFromTags = (knownTags, items) => {
|
|
|
2898
3061
|
};
|
|
2899
3062
|
|
|
2900
3063
|
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
2901
|
-
var
|
|
3064
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2902
3065
|
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
2903
3066
|
var isGroupedDecision = (options) => {
|
|
2904
3067
|
return getGroupsFromTags(groupingTags, options).length > 0;
|
|
@@ -2908,8 +3071,8 @@ var GroupedDecisionList = (_a) => {
|
|
|
2908
3071
|
const { formatMessage } = (0, import_react_intl9.useIntl)();
|
|
2909
3072
|
const { options } = rest;
|
|
2910
3073
|
const itemsByTag = [...getGroupsFromTags(groupingTags, options), { tag: "all", items: options }];
|
|
2911
|
-
return /* @__PURE__ */ (0,
|
|
2912
|
-
/* @__PURE__ */ (0,
|
|
3074
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: itemsByTag.map(({ tag, items }) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_components23.Section, { children: [
|
|
3075
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2913
3076
|
import_components23.Header,
|
|
2914
3077
|
{
|
|
2915
3078
|
as: "h2",
|
|
@@ -2921,26 +3084,26 @@ var GroupedDecisionList = (_a) => {
|
|
|
2921
3084
|
};
|
|
2922
3085
|
|
|
2923
3086
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
2924
|
-
var
|
|
3087
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2925
3088
|
var DecisionWrapper = (props) => {
|
|
2926
3089
|
const { title, control, margin } = props;
|
|
2927
|
-
return /* @__PURE__ */ (0,
|
|
2928
|
-
title && /* @__PURE__ */ (0,
|
|
2929
|
-
control === "filtered" ? /* @__PURE__ */ (0,
|
|
3090
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: getMargin(margin), children: [
|
|
3091
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components24.Header, { as: "h2", title }),
|
|
3092
|
+
control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
2930
3093
|
] });
|
|
2931
3094
|
};
|
|
2932
3095
|
var UnfilteredDecisionList = (_a) => {
|
|
2933
3096
|
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
2934
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0,
|
|
3097
|
+
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
|
|
2935
3098
|
};
|
|
2936
3099
|
var FilteredDecisionList = (props) => {
|
|
2937
3100
|
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
2938
|
-
const [query, setQuery] = (0,
|
|
3101
|
+
const [query, setQuery] = (0, import_react11.useState)("");
|
|
2939
3102
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
2940
3103
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortItems(options, query) : options;
|
|
2941
3104
|
const isGrouped = isGroupedDecision(options);
|
|
2942
|
-
return /* @__PURE__ */ (0,
|
|
2943
|
-
/* @__PURE__ */ (0,
|
|
3105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3106
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2944
3107
|
import_components24.SearchInput,
|
|
2945
3108
|
{
|
|
2946
3109
|
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
@@ -2952,25 +3115,25 @@ var FilteredDecisionList = (props) => {
|
|
|
2952
3115
|
}
|
|
2953
3116
|
}
|
|
2954
3117
|
),
|
|
2955
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0,
|
|
2956
|
-
query.length > 0 && /* @__PURE__ */ (0,
|
|
3118
|
+
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
3119
|
+
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components24.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
2957
3120
|
filteredOptions.length > 0 ? renderDecisionList2({
|
|
2958
3121
|
control,
|
|
2959
3122
|
className: query.length === 0 ? "m-t-3" : "",
|
|
2960
3123
|
options: filteredOptions
|
|
2961
|
-
}) : /* @__PURE__ */ (0,
|
|
3124
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
2962
3125
|
] })
|
|
2963
3126
|
] });
|
|
2964
3127
|
};
|
|
2965
3128
|
|
|
2966
3129
|
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
2967
|
-
var
|
|
3130
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2968
3131
|
var DecisionRenderer = {
|
|
2969
3132
|
canRenderType: "decision",
|
|
2970
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
3133
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }))
|
|
2971
3134
|
};
|
|
2972
3135
|
var renderDecisionList = ({ options, control }) => {
|
|
2973
|
-
return /* @__PURE__ */ (0,
|
|
3136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: options.map((_a) => {
|
|
2974
3137
|
var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
|
|
2975
3138
|
const {
|
|
2976
3139
|
description,
|
|
@@ -2983,7 +3146,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
2983
3146
|
supportingValues,
|
|
2984
3147
|
tags
|
|
2985
3148
|
} = rest;
|
|
2986
|
-
return /* @__PURE__ */ (0,
|
|
3149
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2987
3150
|
import_components25.ListItem,
|
|
2988
3151
|
{
|
|
2989
3152
|
title: itemTitle,
|
|
@@ -2995,7 +3158,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
2995
3158
|
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
2996
3159
|
prompt: getInlineAlert(inlineAlert),
|
|
2997
3160
|
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
2998
|
-
control: /* @__PURE__ */ (0,
|
|
3161
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components25.ListItem.Navigation, __spreadValues({}, getAnchorProps()))
|
|
2999
3162
|
},
|
|
3000
3163
|
JSON.stringify(rest)
|
|
3001
3164
|
);
|
|
@@ -3005,7 +3168,7 @@ var DecisionRenderer_default = DecisionRenderer;
|
|
|
3005
3168
|
|
|
3006
3169
|
// ../renderers/src/DividerRenderer.tsx
|
|
3007
3170
|
var import_components26 = require("@transferwise/components");
|
|
3008
|
-
var
|
|
3171
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
3009
3172
|
var mapControlToLevel = (control) => {
|
|
3010
3173
|
switch (control) {
|
|
3011
3174
|
case "section":
|
|
@@ -3018,7 +3181,7 @@ var mapControlToLevel = (control) => {
|
|
|
3018
3181
|
};
|
|
3019
3182
|
var DividerRenderer = {
|
|
3020
3183
|
canRenderType: "divider",
|
|
3021
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0,
|
|
3184
|
+
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components26.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
3022
3185
|
};
|
|
3023
3186
|
var DividerRenderer_default = DividerRenderer;
|
|
3024
3187
|
|
|
@@ -3052,8 +3215,8 @@ var external_confirmation_messages_default = (0, import_react_intl11.defineMessa
|
|
|
3052
3215
|
|
|
3053
3216
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
3054
3217
|
var import_react_intl12 = require("react-intl");
|
|
3055
|
-
var
|
|
3056
|
-
var
|
|
3218
|
+
var import_react12 = require("react");
|
|
3219
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
3057
3220
|
var ExternalConfirmationRenderer = {
|
|
3058
3221
|
canRenderType: "external-confirmation",
|
|
3059
3222
|
render: ExternalConfirmationRendererComponent
|
|
@@ -3065,18 +3228,18 @@ function ExternalConfirmationRendererComponent({
|
|
|
3065
3228
|
onCancel
|
|
3066
3229
|
}) {
|
|
3067
3230
|
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
3068
|
-
(0,
|
|
3231
|
+
(0, import_react12.useEffect)(() => {
|
|
3069
3232
|
open();
|
|
3070
3233
|
}, []);
|
|
3071
|
-
return /* @__PURE__ */ (0,
|
|
3234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3072
3235
|
import_components27.Modal,
|
|
3073
3236
|
{
|
|
3074
3237
|
open: visible,
|
|
3075
3238
|
title: formatMessage(external_confirmation_messages_default.title),
|
|
3076
|
-
body: /* @__PURE__ */ (0,
|
|
3077
|
-
/* @__PURE__ */ (0,
|
|
3078
|
-
/* @__PURE__ */ (0,
|
|
3079
|
-
/* @__PURE__ */ (0,
|
|
3239
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
3240
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components27.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
3241
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
3242
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
3080
3243
|
import_components27.Button,
|
|
3081
3244
|
{
|
|
3082
3245
|
v2: true,
|
|
@@ -3090,7 +3253,7 @@ function ExternalConfirmationRendererComponent({
|
|
|
3090
3253
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
3091
3254
|
}
|
|
3092
3255
|
),
|
|
3093
|
-
/* @__PURE__ */ (0,
|
|
3256
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components27.Button, { v2: true, block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
3094
3257
|
] }) })
|
|
3095
3258
|
] }),
|
|
3096
3259
|
onClose: onCancel
|
|
@@ -3107,27 +3270,27 @@ function getOrigin(url) {
|
|
|
3107
3270
|
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
3108
3271
|
|
|
3109
3272
|
// ../renderers/src/FormRenderer.tsx
|
|
3110
|
-
var
|
|
3273
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3111
3274
|
var FormRenderer = {
|
|
3112
3275
|
canRenderType: "form",
|
|
3113
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0,
|
|
3276
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: getMargin(margin), children })
|
|
3114
3277
|
};
|
|
3115
3278
|
var FormRenderer_default = FormRenderer;
|
|
3116
3279
|
|
|
3117
3280
|
// ../renderers/src/FormSectionRenderer.tsx
|
|
3118
3281
|
var import_components28 = require("@transferwise/components");
|
|
3119
|
-
var
|
|
3282
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3120
3283
|
var FormSectionRenderer = {
|
|
3121
3284
|
canRenderType: "form-section",
|
|
3122
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0,
|
|
3123
|
-
title && /* @__PURE__ */ (0,
|
|
3285
|
+
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("fieldset", { children: [
|
|
3286
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
3124
3287
|
import_components28.Header,
|
|
3125
3288
|
{
|
|
3126
3289
|
as: "h2",
|
|
3127
3290
|
title
|
|
3128
3291
|
}
|
|
3129
3292
|
),
|
|
3130
|
-
description && /* @__PURE__ */ (0,
|
|
3293
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("p", { children: description }),
|
|
3131
3294
|
children
|
|
3132
3295
|
] })
|
|
3133
3296
|
};
|
|
@@ -3135,18 +3298,18 @@ var FormSectionRenderer_default = FormSectionRenderer;
|
|
|
3135
3298
|
|
|
3136
3299
|
// ../renderers/src/HeadingRenderer.tsx
|
|
3137
3300
|
var import_components29 = require("@transferwise/components");
|
|
3138
|
-
var
|
|
3301
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3139
3302
|
var HeadingRenderer = {
|
|
3140
3303
|
canRenderType: "heading",
|
|
3141
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
3304
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Heading, __spreadValues({}, props))
|
|
3142
3305
|
};
|
|
3143
3306
|
function Heading(props) {
|
|
3144
3307
|
const { text, size, align, margin, control } = props;
|
|
3145
3308
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
3146
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
3309
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StandardHeading, { size, text, className });
|
|
3147
3310
|
}
|
|
3148
3311
|
function DisplayHeading({ size, text, className }) {
|
|
3149
|
-
return /* @__PURE__ */ (0,
|
|
3312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components29.Display, { type: getDisplayType(size), className, children: text });
|
|
3150
3313
|
}
|
|
3151
3314
|
var getDisplayType = (size) => {
|
|
3152
3315
|
switch (size) {
|
|
@@ -3162,7 +3325,7 @@ var getDisplayType = (size) => {
|
|
|
3162
3325
|
}
|
|
3163
3326
|
};
|
|
3164
3327
|
function StandardHeading({ size, text, className }) {
|
|
3165
|
-
return /* @__PURE__ */ (0,
|
|
3328
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components29.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
3166
3329
|
}
|
|
3167
3330
|
var getTitleTypeBySize = (size) => {
|
|
3168
3331
|
var _a;
|
|
@@ -3179,7 +3342,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
3179
3342
|
|
|
3180
3343
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
3181
3344
|
var import_components30 = require("@transferwise/components");
|
|
3182
|
-
var
|
|
3345
|
+
var import_react13 = require("react");
|
|
3183
3346
|
|
|
3184
3347
|
// ../renderers/src/utils/api-utils.ts
|
|
3185
3348
|
function isRelativePath(url = "") {
|
|
@@ -3189,7 +3352,7 @@ function isRelativePath(url = "") {
|
|
|
3189
3352
|
}
|
|
3190
3353
|
|
|
3191
3354
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
3192
|
-
var
|
|
3355
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3193
3356
|
function UrlImage({
|
|
3194
3357
|
accessibilityDescription,
|
|
3195
3358
|
align,
|
|
@@ -3198,13 +3361,13 @@ function UrlImage({
|
|
|
3198
3361
|
uri,
|
|
3199
3362
|
httpClient
|
|
3200
3363
|
}) {
|
|
3201
|
-
const [imageSource, setImageSource] = (0,
|
|
3202
|
-
(0,
|
|
3364
|
+
const [imageSource, setImageSource] = (0, import_react13.useState)("");
|
|
3365
|
+
(0, import_react13.useEffect)(() => {
|
|
3203
3366
|
if (!uri.startsWith("urn:")) {
|
|
3204
3367
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
3205
3368
|
}
|
|
3206
3369
|
}, [uri, httpClient]);
|
|
3207
|
-
return /* @__PURE__ */ (0,
|
|
3370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
3208
3371
|
import_components30.Image,
|
|
3209
3372
|
{
|
|
3210
3373
|
className: "df-reserve-space",
|
|
@@ -3247,118 +3410,6 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
3247
3410
|
}
|
|
3248
3411
|
};
|
|
3249
3412
|
|
|
3250
|
-
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
3251
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3252
|
-
var maxFlagSize = 600;
|
|
3253
|
-
function UrnFlagImage({
|
|
3254
|
-
accessibilityDescription,
|
|
3255
|
-
align,
|
|
3256
|
-
margin,
|
|
3257
|
-
size,
|
|
3258
|
-
uri
|
|
3259
|
-
}) {
|
|
3260
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
3261
|
-
}
|
|
3262
|
-
|
|
3263
|
-
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
3264
|
-
var import_art4 = require("@wise/art");
|
|
3265
|
-
var import_react13 = require("react");
|
|
3266
|
-
|
|
3267
|
-
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
3268
|
-
var isAnimated = (uri) => {
|
|
3269
|
-
const { rComponents } = stringToURN(uri);
|
|
3270
|
-
return rComponents.type === "animated";
|
|
3271
|
-
};
|
|
3272
|
-
|
|
3273
|
-
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
3274
|
-
var import_art3 = require("@wise/art");
|
|
3275
|
-
var import_react12 = require("react");
|
|
3276
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
3277
|
-
var Illustration3DErrorBoundary = class extends import_react12.Component {
|
|
3278
|
-
constructor(props) {
|
|
3279
|
-
super(props);
|
|
3280
|
-
this.state = { hasError: false };
|
|
3281
|
-
}
|
|
3282
|
-
static getDerivedStateFromError() {
|
|
3283
|
-
return { hasError: true };
|
|
3284
|
-
}
|
|
3285
|
-
componentDidCatch() {
|
|
3286
|
-
this.props.onError();
|
|
3287
|
-
}
|
|
3288
|
-
render() {
|
|
3289
|
-
if (this.state.hasError) {
|
|
3290
|
-
return null;
|
|
3291
|
-
}
|
|
3292
|
-
return this.props.children;
|
|
3293
|
-
}
|
|
3294
|
-
};
|
|
3295
|
-
var SafeIllustration3D = ({
|
|
3296
|
-
name,
|
|
3297
|
-
size,
|
|
3298
|
-
onError
|
|
3299
|
-
}) => {
|
|
3300
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
3301
|
-
};
|
|
3302
|
-
var SafeIllustration3D_default = SafeIllustration3D;
|
|
3303
|
-
|
|
3304
|
-
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
3305
|
-
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3306
|
-
var urnPrefix = "urn:wise:illustrations:";
|
|
3307
|
-
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
3308
|
-
function UrnIllustration({
|
|
3309
|
-
accessibilityDescription,
|
|
3310
|
-
align,
|
|
3311
|
-
margin,
|
|
3312
|
-
size,
|
|
3313
|
-
uri
|
|
3314
|
-
}) {
|
|
3315
|
-
const [has3DFailed, setHas3DFailed] = (0, import_react13.useState)(false);
|
|
3316
|
-
const illustrationSize = getIllustrationSize(size);
|
|
3317
|
-
const illustrationName = getIllustrationName(uri);
|
|
3318
|
-
const illustration3DName = getIllustration3DName(uri);
|
|
3319
|
-
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
3320
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3321
|
-
SafeIllustration3D_default,
|
|
3322
|
-
{
|
|
3323
|
-
name: illustration3DName,
|
|
3324
|
-
size: illustrationSize,
|
|
3325
|
-
onError: () => setHas3DFailed(true)
|
|
3326
|
-
}
|
|
3327
|
-
) });
|
|
3328
|
-
}
|
|
3329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3330
|
-
import_art4.Illustration,
|
|
3331
|
-
{
|
|
3332
|
-
className: "df-illustration",
|
|
3333
|
-
name: illustrationName,
|
|
3334
|
-
size: illustrationSize,
|
|
3335
|
-
alt: accessibilityDescription
|
|
3336
|
-
}
|
|
3337
|
-
) });
|
|
3338
|
-
}
|
|
3339
|
-
var getIllustrationSize = (size) => ({ xs: "small", sm: "small", md: "medium", lg: "large", xl: "large" })[size] || "medium";
|
|
3340
|
-
var getIllustrationName = (uri) => {
|
|
3341
|
-
return uri.replace(urnPrefix, "").split("?")[0];
|
|
3342
|
-
};
|
|
3343
|
-
var getIllustration3DName = (uri) => {
|
|
3344
|
-
const illustrationName = getIllustrationName(uri);
|
|
3345
|
-
return (0, import_art4.isIllustrationSupport3D)(illustrationName) ? illustrationName : null;
|
|
3346
|
-
};
|
|
3347
|
-
|
|
3348
|
-
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
3349
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3350
|
-
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
3351
|
-
function UrnImage(props) {
|
|
3352
|
-
const { uri } = props;
|
|
3353
|
-
if (isUrnIllustration(uri)) {
|
|
3354
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
3355
|
-
}
|
|
3356
|
-
if (isUrnFlag(uri)) {
|
|
3357
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
3358
|
-
}
|
|
3359
|
-
return null;
|
|
3360
|
-
}
|
|
3361
|
-
|
|
3362
3413
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
3363
3414
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3364
3415
|
var ImageRenderer = {
|
|
@@ -6145,6 +6196,7 @@ var import_dynamic_flow_client8 = require("@wise/dynamic-flow-client");
|
|
|
6145
6196
|
var Header10 = Header;
|
|
6146
6197
|
var Media2 = Media;
|
|
6147
6198
|
var getMargin2 = getMargin;
|
|
6199
|
+
var createCollectionRenderer2 = createCollectionRenderer;
|
|
6148
6200
|
|
|
6149
6201
|
// src/i18n/index.ts
|
|
6150
6202
|
var import_dynamic_flow_client6 = require("@wise/dynamic-flow-client");
|