@wise/dynamic-flow-client-internal 5.29.0-experimental-9e4b087 → 5.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +0 -25
- package/build/main.js +212 -139
- package/build/main.mjs +227 -154
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +4 -4
package/build/main.mjs
CHANGED
|
@@ -127,7 +127,7 @@ import { useDynamicFlow } from "@wise/dynamic-flow-client";
|
|
|
127
127
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
128
128
|
var appVersion = (
|
|
129
129
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
130
|
-
typeof process !== "undefined" ? "5.
|
|
130
|
+
typeof process !== "undefined" ? "5.30.0" : "0.0.0"
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
@@ -607,11 +607,16 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
|
|
|
607
607
|
// ../renderers/src/components/Media/Media.tsx
|
|
608
608
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
609
609
|
var Media = ({ media, preferAvatar = false, size }) => {
|
|
610
|
+
var _a, _b;
|
|
610
611
|
switch (media == null ? void 0 : media.type) {
|
|
611
612
|
case "avatar":
|
|
612
|
-
return /* @__PURE__ */ jsx10(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
|
|
613
|
+
return /* @__PURE__ */ jsx10(AvatarMedia, __spreadProps(__spreadValues({}, media), { size: (_a = media.size && mediaSizeTokenMappings[media.size]) != null ? _a : size }));
|
|
613
614
|
case "image": {
|
|
614
|
-
const { asset, icon } = resolveMediaFromUri(
|
|
615
|
+
const { asset, icon } = resolveMediaFromUri(
|
|
616
|
+
media.uri,
|
|
617
|
+
(_b = media.size && mediaSizeTokenMappings[media.size]) != null ? _b : size,
|
|
618
|
+
media.accessibilityDescription
|
|
619
|
+
);
|
|
615
620
|
return icon != null ? icon : asset;
|
|
616
621
|
}
|
|
617
622
|
case "legacy": {
|
|
@@ -650,6 +655,13 @@ function extractFirstImageFromAvatar(avatar) {
|
|
|
650
655
|
accessibilityDescription: avatar.accessibilityDescription
|
|
651
656
|
};
|
|
652
657
|
}
|
|
658
|
+
var mediaSizeTokenMappings = {
|
|
659
|
+
xs: 24,
|
|
660
|
+
sm: 32,
|
|
661
|
+
md: 48,
|
|
662
|
+
lg: 56,
|
|
663
|
+
xl: 72
|
|
664
|
+
};
|
|
653
665
|
|
|
654
666
|
// ../renderers/src/components/Media/OptionMedia.tsx
|
|
655
667
|
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
@@ -1792,6 +1804,10 @@ var isIOSWebKit = () => {
|
|
|
1792
1804
|
const mtp = navigator.maxTouchPoints;
|
|
1793
1805
|
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
1794
1806
|
};
|
|
1807
|
+
var getRect = (element) => {
|
|
1808
|
+
const { offsetWidth, offsetHeight } = element;
|
|
1809
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
1810
|
+
};
|
|
1795
1811
|
var defaultKeyExtractor = (index) => index;
|
|
1796
1812
|
var defaultRangeExtractor = (range) => {
|
|
1797
1813
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -1803,6 +1819,43 @@ var defaultRangeExtractor = (range) => {
|
|
|
1803
1819
|
}
|
|
1804
1820
|
return arr;
|
|
1805
1821
|
};
|
|
1822
|
+
var observeElementRect = (instance, cb) => {
|
|
1823
|
+
const element = instance.scrollElement;
|
|
1824
|
+
if (!element) {
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
const targetWindow = instance.targetWindow;
|
|
1828
|
+
if (!targetWindow) {
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
const handler = (rect) => {
|
|
1832
|
+
const { width, height } = rect;
|
|
1833
|
+
cb({ width: Math.round(width), height: Math.round(height) });
|
|
1834
|
+
};
|
|
1835
|
+
handler(getRect(element));
|
|
1836
|
+
if (!targetWindow.ResizeObserver) {
|
|
1837
|
+
return () => {
|
|
1838
|
+
};
|
|
1839
|
+
}
|
|
1840
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
1841
|
+
const run = () => {
|
|
1842
|
+
const entry = entries[0];
|
|
1843
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1844
|
+
const box = entry.borderBoxSize[0];
|
|
1845
|
+
if (box) {
|
|
1846
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
1847
|
+
return;
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
handler(getRect(element));
|
|
1851
|
+
};
|
|
1852
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1853
|
+
});
|
|
1854
|
+
observer.observe(element, { box: "border-box" });
|
|
1855
|
+
return () => {
|
|
1856
|
+
observer.unobserve(element);
|
|
1857
|
+
};
|
|
1858
|
+
};
|
|
1806
1859
|
var addEventListenerOptions = {
|
|
1807
1860
|
passive: true
|
|
1808
1861
|
};
|
|
@@ -1856,6 +1909,10 @@ var observeOffset = (instance, cb, readOffset) => {
|
|
|
1856
1909
|
fallback == null ? void 0 : fallback.cancel();
|
|
1857
1910
|
};
|
|
1858
1911
|
};
|
|
1912
|
+
var observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
1913
|
+
const { horizontal, isRtl } = instance.options;
|
|
1914
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
1915
|
+
});
|
|
1859
1916
|
var observeWindowOffset = (instance, cb) => observeOffset(
|
|
1860
1917
|
instance,
|
|
1861
1918
|
cb,
|
|
@@ -1898,6 +1955,7 @@ var scrollWithAdjustments = (offset, {
|
|
|
1898
1955
|
});
|
|
1899
1956
|
};
|
|
1900
1957
|
var windowScroll = scrollWithAdjustments;
|
|
1958
|
+
var elementScroll = scrollWithAdjustments;
|
|
1901
1959
|
var Virtualizer = class {
|
|
1902
1960
|
constructor(opts) {
|
|
1903
1961
|
this.unsubs = [];
|
|
@@ -3140,6 +3198,13 @@ function useVirtualizerBase(_a) {
|
|
|
3140
3198
|
});
|
|
3141
3199
|
return instance;
|
|
3142
3200
|
}
|
|
3201
|
+
function useVirtualizer(options) {
|
|
3202
|
+
return useVirtualizerBase(__spreadValues({
|
|
3203
|
+
observeElementRect,
|
|
3204
|
+
observeElementOffset,
|
|
3205
|
+
scrollToFn: elementScroll
|
|
3206
|
+
}, options));
|
|
3207
|
+
}
|
|
3143
3208
|
function useWindowVirtualizer(options) {
|
|
3144
3209
|
return useVirtualizerBase(__spreadValues({
|
|
3145
3210
|
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
@@ -3152,7 +3217,7 @@ function useWindowVirtualizer(options) {
|
|
|
3152
3217
|
|
|
3153
3218
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3154
3219
|
import { ProcessIndicator, Button as Button4 } from "@transferwise/components";
|
|
3155
|
-
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
3220
|
+
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useState as useState8 } from "react";
|
|
3156
3221
|
|
|
3157
3222
|
// ../renderers/src/step/StepFooter.tsx
|
|
3158
3223
|
import { Button as Button3 } from "@transferwise/components";
|
|
@@ -3212,7 +3277,7 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3212
3277
|
] })
|
|
3213
3278
|
] });
|
|
3214
3279
|
};
|
|
3215
|
-
var useIsElementVisible = (elementRef) => {
|
|
3280
|
+
var useIsElementVisible = (elementRef, root = null) => {
|
|
3216
3281
|
const [isVisible, setIsVisible] = useState7(false);
|
|
3217
3282
|
useEffect6(() => {
|
|
3218
3283
|
const element = elementRef.current;
|
|
@@ -3221,11 +3286,11 @@ var useIsElementVisible = (elementRef) => {
|
|
|
3221
3286
|
([entry]) => {
|
|
3222
3287
|
setIsVisible(entry.isIntersecting);
|
|
3223
3288
|
},
|
|
3224
|
-
{ rootMargin: "1px" }
|
|
3289
|
+
{ root, rootMargin: "1px" }
|
|
3225
3290
|
);
|
|
3226
3291
|
observer.observe(element);
|
|
3227
3292
|
return () => observer.disconnect();
|
|
3228
|
-
}, [elementRef]);
|
|
3293
|
+
}, [elementRef, root]);
|
|
3229
3294
|
return isVisible;
|
|
3230
3295
|
};
|
|
3231
3296
|
|
|
@@ -3247,12 +3312,40 @@ var collection_messages_default = defineMessages5({
|
|
|
3247
3312
|
}
|
|
3248
3313
|
});
|
|
3249
3314
|
|
|
3315
|
+
// ../renderers/src/CollectionRenderer/components/getScrollableAncestor.ts
|
|
3316
|
+
var SCROLLABLE_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["auto", "overlay", "scroll"]);
|
|
3317
|
+
var getScrollableAncestor = (element) => {
|
|
3318
|
+
var _a;
|
|
3319
|
+
const view = element == null ? void 0 : element.ownerDocument.defaultView;
|
|
3320
|
+
let ancestor = (_a = element == null ? void 0 : element.parentElement) != null ? _a : null;
|
|
3321
|
+
if (!view) {
|
|
3322
|
+
return null;
|
|
3323
|
+
}
|
|
3324
|
+
while (ancestor) {
|
|
3325
|
+
const { overflowY } = view.getComputedStyle(ancestor);
|
|
3326
|
+
const hasScrollableOverflow = SCROLLABLE_OVERFLOW_VALUES.has(overflowY);
|
|
3327
|
+
if (hasScrollableOverflow && ancestor.scrollHeight > ancestor.clientHeight) {
|
|
3328
|
+
return ancestor;
|
|
3329
|
+
}
|
|
3330
|
+
ancestor = ancestor.parentElement;
|
|
3331
|
+
}
|
|
3332
|
+
return null;
|
|
3333
|
+
};
|
|
3334
|
+
|
|
3250
3335
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3251
3336
|
import { jsx as jsx36, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3252
3337
|
var ContentComponent = (props) => {
|
|
3253
3338
|
const { state, status, SectionHeader, Item } = props;
|
|
3339
|
+
const contentRef = useRef4(null);
|
|
3340
|
+
const [scrollElement, setScrollElement] = useState8(null);
|
|
3341
|
+
useLayoutEffect2(() => {
|
|
3342
|
+
const nextScrollElement = getScrollableAncestor(contentRef.current);
|
|
3343
|
+
setScrollElement(
|
|
3344
|
+
(currentScrollElement) => currentScrollElement === nextScrollElement ? currentScrollElement : nextScrollElement
|
|
3345
|
+
);
|
|
3346
|
+
}, []);
|
|
3254
3347
|
const endOfContentRef = useRef4(null);
|
|
3255
|
-
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
3348
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef, scrollElement);
|
|
3256
3349
|
useEffect7(() => {
|
|
3257
3350
|
const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
|
|
3258
3351
|
if (shouldAutoLoad && status.loadMore) {
|
|
@@ -3284,51 +3377,90 @@ var ContentComponent = (props) => {
|
|
|
3284
3377
|
var _a, _b;
|
|
3285
3378
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
3286
3379
|
});
|
|
3287
|
-
|
|
3288
|
-
count: stateCount,
|
|
3289
|
-
estimateSize: () => 120,
|
|
3290
|
-
overscan: 10,
|
|
3291
|
-
// eslint-disable-next-line react-hooks/refs
|
|
3292
|
-
scrollMargin: listOffsetRef.current
|
|
3293
|
-
});
|
|
3294
|
-
return /* @__PURE__ */ jsxs7("div", { ref: listRef, children: [
|
|
3380
|
+
return /* @__PURE__ */ jsxs7("div", { ref: contentRef, children: [
|
|
3295
3381
|
state.beforeSections,
|
|
3296
|
-
/* @__PURE__ */ jsx36(
|
|
3297
|
-
|
|
3382
|
+
scrollElement ? /* @__PURE__ */ jsx36(
|
|
3383
|
+
ElementVirtualizedItems,
|
|
3298
3384
|
{
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
ref: virtualizer.measureElement,
|
|
3313
|
-
"data-index": item.index,
|
|
3314
|
-
style: {
|
|
3315
|
-
position: "absolute",
|
|
3316
|
-
top: 0,
|
|
3317
|
-
left: 0,
|
|
3318
|
-
width: "100%",
|
|
3319
|
-
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3320
|
-
},
|
|
3321
|
-
children: i.type === "header" ? /* @__PURE__ */ jsx36(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ jsx36(Item, __spreadValues({}, i.item))
|
|
3322
|
-
},
|
|
3323
|
-
item.key
|
|
3324
|
-
);
|
|
3325
|
-
})
|
|
3385
|
+
Item,
|
|
3386
|
+
SectionHeader,
|
|
3387
|
+
items,
|
|
3388
|
+
scrollElement,
|
|
3389
|
+
stateCount
|
|
3390
|
+
}
|
|
3391
|
+
) : /* @__PURE__ */ jsx36(
|
|
3392
|
+
WindowVirtualizedItems,
|
|
3393
|
+
{
|
|
3394
|
+
Item,
|
|
3395
|
+
SectionHeader,
|
|
3396
|
+
items,
|
|
3397
|
+
stateCount
|
|
3326
3398
|
}
|
|
3327
3399
|
),
|
|
3328
3400
|
/* @__PURE__ */ jsx36("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: /* @__PURE__ */ jsx36(PaginationComponent, { status, state }) }),
|
|
3329
3401
|
state.afterSections
|
|
3330
3402
|
] });
|
|
3331
3403
|
};
|
|
3404
|
+
var WindowVirtualizedItems = (props) => {
|
|
3405
|
+
const { stateCount } = props;
|
|
3406
|
+
const virtualItemsRef = useRef4(null);
|
|
3407
|
+
const virtualizer = useWindowVirtualizer({
|
|
3408
|
+
count: stateCount,
|
|
3409
|
+
estimateSize: () => 120,
|
|
3410
|
+
overscan: 10
|
|
3411
|
+
});
|
|
3412
|
+
return /* @__PURE__ */ jsx36(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3413
|
+
};
|
|
3414
|
+
var ElementVirtualizedItems = (props) => {
|
|
3415
|
+
const { scrollElement, stateCount } = props;
|
|
3416
|
+
const virtualItemsRef = useRef4(null);
|
|
3417
|
+
const virtualizer = useVirtualizer({
|
|
3418
|
+
count: stateCount,
|
|
3419
|
+
getScrollElement: () => scrollElement,
|
|
3420
|
+
estimateSize: () => 120,
|
|
3421
|
+
overscan: 10
|
|
3422
|
+
});
|
|
3423
|
+
return /* @__PURE__ */ jsx36(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3424
|
+
};
|
|
3425
|
+
var VirtualizedItems = ({
|
|
3426
|
+
Item,
|
|
3427
|
+
SectionHeader,
|
|
3428
|
+
items,
|
|
3429
|
+
virtualItemsRef,
|
|
3430
|
+
virtualizer
|
|
3431
|
+
}) => /* @__PURE__ */ jsx36(
|
|
3432
|
+
"div",
|
|
3433
|
+
{
|
|
3434
|
+
ref: virtualItemsRef,
|
|
3435
|
+
style: {
|
|
3436
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
3437
|
+
width: "100%",
|
|
3438
|
+
position: "relative"
|
|
3439
|
+
},
|
|
3440
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
3441
|
+
const i = items[item.index];
|
|
3442
|
+
if (!i) {
|
|
3443
|
+
return null;
|
|
3444
|
+
}
|
|
3445
|
+
return /* @__PURE__ */ jsx36(
|
|
3446
|
+
"div",
|
|
3447
|
+
{
|
|
3448
|
+
ref: virtualizer.measureElement,
|
|
3449
|
+
"data-index": item.index,
|
|
3450
|
+
style: {
|
|
3451
|
+
position: "absolute",
|
|
3452
|
+
top: 0,
|
|
3453
|
+
left: 0,
|
|
3454
|
+
width: "100%",
|
|
3455
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3456
|
+
},
|
|
3457
|
+
children: i.type === "header" ? /* @__PURE__ */ jsx36(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ jsx36(Item, __spreadValues({}, i.item))
|
|
3458
|
+
},
|
|
3459
|
+
item.key
|
|
3460
|
+
);
|
|
3461
|
+
})
|
|
3462
|
+
}
|
|
3463
|
+
);
|
|
3332
3464
|
var PaginationComponent = ({
|
|
3333
3465
|
status,
|
|
3334
3466
|
state
|
|
@@ -3627,11 +3759,11 @@ var CollectionRenderer_default = CollectionRenderer;
|
|
|
3627
3759
|
var import_classnames11 = __toESM(require_classnames());
|
|
3628
3760
|
|
|
3629
3761
|
// ../renderers/src/utils/useIsCollapsed.ts
|
|
3630
|
-
import { useEffect as useEffect8, useState as
|
|
3762
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
3631
3763
|
var COLLAPSE_QUERY = "(max-width: 767.98px)";
|
|
3632
3764
|
var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
|
|
3633
3765
|
var useIsCollapsed = () => {
|
|
3634
|
-
const [collapsed, setCollapsed] =
|
|
3766
|
+
const [collapsed, setCollapsed] = useState9(
|
|
3635
3767
|
() => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
|
|
3636
3768
|
);
|
|
3637
3769
|
useEffect8(() => {
|
|
@@ -3685,7 +3817,7 @@ var ColumnsRenderer_default = ColumnsRenderer;
|
|
|
3685
3817
|
import { DateInput, DateLookup } from "@transferwise/components";
|
|
3686
3818
|
|
|
3687
3819
|
// ../renderers/src/hooks/useAvailabilityRules.ts
|
|
3688
|
-
import { useState as
|
|
3820
|
+
import { useState as useState10 } from "react";
|
|
3689
3821
|
import { useIntl as useIntl7 } from "react-intl";
|
|
3690
3822
|
|
|
3691
3823
|
// ../renderers/src/messages/date-input.messages.ts
|
|
@@ -3730,7 +3862,7 @@ var dateToDateString = (date) => {
|
|
|
3730
3862
|
var useAvailabilityRules = (availability) => {
|
|
3731
3863
|
var _a, _b;
|
|
3732
3864
|
const { formatMessage } = useIntl7();
|
|
3733
|
-
const [focusedDate, setFocusedDate] =
|
|
3865
|
+
const [focusedDate, setFocusedDate] = useState10(null);
|
|
3734
3866
|
const unavailableMessage = (_b = (_a = focusedDate ? getUnavailableDateReason(focusedDate, availability) : null) != null ? _a : availability == null ? void 0 : availability.message) != null ? _b : formatMessage(date_input_messages_default.unavailableDates);
|
|
3735
3867
|
const onDateSelect = ({ date }) => {
|
|
3736
3868
|
setFocusedDate(date);
|
|
@@ -3888,7 +4020,7 @@ import { ListItem as ListItem7 } from "@transferwise/components";
|
|
|
3888
4020
|
|
|
3889
4021
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
3890
4022
|
import { Header as Header3, SearchInput } from "@transferwise/components";
|
|
3891
|
-
import { useState as
|
|
4023
|
+
import { useState as useState11 } from "react";
|
|
3892
4024
|
import { useIntl as useIntl9 } from "react-intl";
|
|
3893
4025
|
|
|
3894
4026
|
// ../renderers/src/messages/filter.messages.ts
|
|
@@ -4036,7 +4168,7 @@ var UnfilteredDecisionList = (_a) => {
|
|
|
4036
4168
|
};
|
|
4037
4169
|
var FilteredDecisionList = (props) => {
|
|
4038
4170
|
const { formatMessage } = useIntl9();
|
|
4039
|
-
const [query, setQuery] =
|
|
4171
|
+
const [query, setQuery] = useState11("");
|
|
4040
4172
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
4041
4173
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortItems(options, query) : options;
|
|
4042
4174
|
const isGrouped = isGroupedDecision(options);
|
|
@@ -4301,7 +4433,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
4301
4433
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
4302
4434
|
var import_classnames16 = __toESM(require_classnames());
|
|
4303
4435
|
import { Image } from "@transferwise/components";
|
|
4304
|
-
import { useEffect as useEffect10, useState as
|
|
4436
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
4305
4437
|
|
|
4306
4438
|
// ../renderers/src/utils/api-utils.ts
|
|
4307
4439
|
function isRelativePath(url = "") {
|
|
@@ -4322,7 +4454,7 @@ function UrlImage({
|
|
|
4322
4454
|
uri,
|
|
4323
4455
|
httpClient
|
|
4324
4456
|
}) {
|
|
4325
|
-
const [imageSource, setImageSource] =
|
|
4457
|
+
const [imageSource, setImageSource] = useState12("");
|
|
4326
4458
|
useEffect10(() => {
|
|
4327
4459
|
if (!uri.startsWith("urn:")) {
|
|
4328
4460
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
@@ -4643,11 +4775,28 @@ var AvatarMediaRendererComponent = ({
|
|
|
4643
4775
|
};
|
|
4644
4776
|
var ImageMediaRendererComponent = (_a) => {
|
|
4645
4777
|
var _b = _a, {
|
|
4646
|
-
media
|
|
4778
|
+
media,
|
|
4779
|
+
size
|
|
4647
4780
|
} = _b, rest = __objRest(_b, [
|
|
4648
|
-
"media"
|
|
4781
|
+
"media",
|
|
4782
|
+
"size"
|
|
4649
4783
|
]);
|
|
4650
|
-
|
|
4784
|
+
var _a2, _b2;
|
|
4785
|
+
return isUrnImage(media.uri) ? /* @__PURE__ */ jsx64(
|
|
4786
|
+
UrnImage,
|
|
4787
|
+
__spreadValues({
|
|
4788
|
+
uri: media.uri,
|
|
4789
|
+
size: (_a2 = media.size) != null ? _a2 : size,
|
|
4790
|
+
accessibilityDescription: media.accessibilityDescription
|
|
4791
|
+
}, rest)
|
|
4792
|
+
) : /* @__PURE__ */ jsx64(
|
|
4793
|
+
UrlImage,
|
|
4794
|
+
__spreadValues({
|
|
4795
|
+
uri: media.uri,
|
|
4796
|
+
size: (_b2 = media.size) != null ? _b2 : size,
|
|
4797
|
+
accessibilityDescription: media.accessibilityDescription
|
|
4798
|
+
}, rest)
|
|
4799
|
+
);
|
|
4651
4800
|
};
|
|
4652
4801
|
var mapAvatarMediaSize = (size) => {
|
|
4653
4802
|
switch (size) {
|
|
@@ -4667,7 +4816,7 @@ var mapAvatarMediaSize = (size) => {
|
|
|
4667
4816
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
4668
4817
|
var import_classnames22 = __toESM(require_classnames());
|
|
4669
4818
|
import { Button as Button6, Modal as Modal2 } from "@transferwise/components";
|
|
4670
|
-
import { useState as
|
|
4819
|
+
import { useState as useState13 } from "react";
|
|
4671
4820
|
import { jsx as jsx65, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4672
4821
|
var ModalLayoutRenderer = {
|
|
4673
4822
|
canRenderType: "modal-layout",
|
|
@@ -4675,7 +4824,7 @@ var ModalLayoutRenderer = {
|
|
|
4675
4824
|
};
|
|
4676
4825
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
4677
4826
|
function DFModal({ content, margin, trigger, control, tags }) {
|
|
4678
|
-
const [visible, setVisible] =
|
|
4827
|
+
const [visible, setVisible] = useState13(false);
|
|
4679
4828
|
const { children, title } = content;
|
|
4680
4829
|
return /* @__PURE__ */ jsxs16("div", { className: (0, import_classnames22.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
4681
4830
|
/* @__PURE__ */ jsx65(Button6, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
@@ -4820,7 +4969,7 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
4820
4969
|
|
|
4821
4970
|
// ../renderers/src/MultiSelectInputRenderer/InlineComponent.tsx
|
|
4822
4971
|
import { ListItem as ListItem9, SearchInput as SearchInput2 } from "@transferwise/components";
|
|
4823
|
-
import { useState as
|
|
4972
|
+
import { useState as useState14 } from "react";
|
|
4824
4973
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4825
4974
|
|
|
4826
4975
|
// ../renderers/src/utils/items-with-index.ts
|
|
@@ -4846,7 +4995,7 @@ function InlineComponent(props) {
|
|
|
4846
4995
|
onSelect
|
|
4847
4996
|
} = props;
|
|
4848
4997
|
const optionsWithIndex = zipWithIndex(options);
|
|
4849
|
-
const [query, setQuery] =
|
|
4998
|
+
const [query, setQuery] = useState14("");
|
|
4850
4999
|
const { formatMessage } = useIntl12();
|
|
4851
5000
|
const filtered = tags == null ? void 0 : tags.includes("filtered");
|
|
4852
5001
|
const filteredOptions = query ? filterAndSortItems(optionsWithIndex, filtered ? query : "") : optionsWithIndex;
|
|
@@ -4921,7 +5070,7 @@ function InlineComponent(props) {
|
|
|
4921
5070
|
|
|
4922
5071
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
4923
5072
|
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
4924
|
-
import { useState as
|
|
5073
|
+
import { useState as useState15 } from "react";
|
|
4925
5074
|
import { useIntl as useIntl13 } from "react-intl";
|
|
4926
5075
|
|
|
4927
5076
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
@@ -4938,7 +5087,7 @@ var multi_select_messages_default = defineMessages10({
|
|
|
4938
5087
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
4939
5088
|
function DefaultComponent(props) {
|
|
4940
5089
|
const { formatMessage } = useIntl13();
|
|
4941
|
-
const [stagedIndices, setStagedIndices] =
|
|
5090
|
+
const [stagedIndices, setStagedIndices] = useState15();
|
|
4942
5091
|
const {
|
|
4943
5092
|
id,
|
|
4944
5093
|
autoComplete,
|
|
@@ -5393,7 +5542,7 @@ var ProgressRenderer = {
|
|
|
5393
5542
|
var import_classnames26 = __toESM(require_classnames());
|
|
5394
5543
|
import { Button as Button8, Header as Header6, InlineAlert as InlineAlert3, Modal as Modal4, NavigationOption } from "@transferwise/components";
|
|
5395
5544
|
import { Plus } from "@transferwise/icons";
|
|
5396
|
-
import { useState as
|
|
5545
|
+
import { useState as useState16 } from "react";
|
|
5397
5546
|
import { useIntl as useIntl15 } from "react-intl";
|
|
5398
5547
|
|
|
5399
5548
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
@@ -5443,7 +5592,7 @@ function Repeatable(props) {
|
|
|
5443
5592
|
onRemove
|
|
5444
5593
|
} = props;
|
|
5445
5594
|
const { formatMessage } = useIntl15();
|
|
5446
|
-
const [openModalType, setOpenModalType] =
|
|
5595
|
+
const [openModalType, setOpenModalType] = useState16(null);
|
|
5447
5596
|
const { ref } = useScrollToError(validationState, features);
|
|
5448
5597
|
const onAddItem = () => {
|
|
5449
5598
|
onAdd();
|
|
@@ -5667,7 +5816,7 @@ var ReviewRenderer_default = ReviewRenderer2;
|
|
|
5667
5816
|
|
|
5668
5817
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
5669
5818
|
import { Input as Input5, InputGroup as InputGroup4, List, ListItem as ListItem11, Markdown as Markdown6 } from "@transferwise/components";
|
|
5670
|
-
import { useState as
|
|
5819
|
+
import { useState as useState17 } from "react";
|
|
5671
5820
|
import { useIntl as useIntl18 } from "react-intl";
|
|
5672
5821
|
|
|
5673
5822
|
// ../renderers/src/messages/search.messages.ts
|
|
@@ -5710,7 +5859,7 @@ function BlockSearchRendererComponent({
|
|
|
5710
5859
|
trackEvent,
|
|
5711
5860
|
onChange
|
|
5712
5861
|
}) {
|
|
5713
|
-
const [hasSearched, setHasSearched] =
|
|
5862
|
+
const [hasSearched, setHasSearched] = useState17(false);
|
|
5714
5863
|
const { formatMessage } = useIntl18();
|
|
5715
5864
|
return /* @__PURE__ */ jsxs24("div", { className: getMargin(margin), children: [
|
|
5716
5865
|
/* @__PURE__ */ jsx81(
|
|
@@ -5805,7 +5954,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
|
5805
5954
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
5806
5955
|
import { Markdown as Markdown7, Typeahead } from "@transferwise/components";
|
|
5807
5956
|
import { Search as Search3 } from "@transferwise/icons";
|
|
5808
|
-
import { useState as
|
|
5957
|
+
import { useState as useState18 } from "react";
|
|
5809
5958
|
import { useIntl as useIntl19 } from "react-intl";
|
|
5810
5959
|
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
5811
5960
|
function InlineSearchRenderer({
|
|
@@ -5821,7 +5970,7 @@ function InlineSearchRenderer({
|
|
|
5821
5970
|
onChange,
|
|
5822
5971
|
trackEvent
|
|
5823
5972
|
}) {
|
|
5824
|
-
const [hasSearched, setHasSearched] =
|
|
5973
|
+
const [hasSearched, setHasSearched] = useState18(false);
|
|
5825
5974
|
const intl = useIntl19();
|
|
5826
5975
|
return /* @__PURE__ */ jsx82("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx82(
|
|
5827
5976
|
FieldInput_default,
|
|
@@ -6541,7 +6690,7 @@ function StepRendererComponent(props) {
|
|
|
6541
6690
|
// ../renderers/src/TabsRenderer.tsx
|
|
6542
6691
|
var import_classnames33 = __toESM(require_classnames());
|
|
6543
6692
|
import { Chips as Chips2, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
|
|
6544
|
-
import { useState as
|
|
6693
|
+
import { useState as useState19 } from "react";
|
|
6545
6694
|
import { jsx as jsx99, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6546
6695
|
var TabsRenderer = {
|
|
6547
6696
|
canRenderType: "tabs",
|
|
@@ -6560,7 +6709,7 @@ var TabsRenderer = {
|
|
|
6560
6709
|
}
|
|
6561
6710
|
};
|
|
6562
6711
|
function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6563
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6712
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6564
6713
|
return /* @__PURE__ */ jsx99("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: /* @__PURE__ */ jsx99(
|
|
6565
6714
|
Tabs2,
|
|
6566
6715
|
{
|
|
@@ -6581,7 +6730,7 @@ function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6581
6730
|
}
|
|
6582
6731
|
function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6583
6732
|
var _a;
|
|
6584
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6733
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6585
6734
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6586
6735
|
/* @__PURE__ */ jsx99(
|
|
6587
6736
|
SegmentedControl2,
|
|
@@ -6603,7 +6752,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6603
6752
|
}
|
|
6604
6753
|
function ChipsTabsRendererComponent({ margin, tabs, control, tags }) {
|
|
6605
6754
|
var _a;
|
|
6606
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6755
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6607
6756
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6608
6757
|
/* @__PURE__ */ jsx99("div", { className: "chips-container", children: /* @__PURE__ */ jsx99(
|
|
6609
6758
|
Chips2,
|
|
@@ -6628,9 +6777,7 @@ import {
|
|
|
6628
6777
|
TextArea,
|
|
6629
6778
|
TextareaWithDisplayFormat
|
|
6630
6779
|
} from "@transferwise/components";
|
|
6631
|
-
import {
|
|
6632
|
-
import { useState as useState19 } from "react";
|
|
6633
|
-
import { jsx as jsx100, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6780
|
+
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
6634
6781
|
var commonKeys = [
|
|
6635
6782
|
"autoComplete",
|
|
6636
6783
|
"autoCapitalize",
|
|
@@ -6645,18 +6792,13 @@ var commonKeys = [
|
|
|
6645
6792
|
"value"
|
|
6646
6793
|
];
|
|
6647
6794
|
function VariableTextInput(inputProps) {
|
|
6648
|
-
const { id, value, control,
|
|
6795
|
+
const { id, value, control, onChange } = inputProps;
|
|
6649
6796
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
6650
|
-
if (control === "ssn-input" || (displayFormat == null ? void 0 : displayFormat.includes("*"))) {
|
|
6651
|
-
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { maxLength: inputProps.maxLength, onChange }));
|
|
6652
|
-
}
|
|
6653
6797
|
switch (control) {
|
|
6654
6798
|
case "email":
|
|
6655
6799
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
6656
6800
|
case "password":
|
|
6657
6801
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
6658
|
-
case "ssn-input":
|
|
6659
|
-
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6660
6802
|
case "numeric": {
|
|
6661
6803
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
6662
6804
|
return /* @__PURE__ */ jsx100(
|
|
@@ -6677,79 +6819,10 @@ function VariableTextInput(inputProps) {
|
|
|
6677
6819
|
}
|
|
6678
6820
|
}
|
|
6679
6821
|
function TextInput(props) {
|
|
6680
|
-
const _a = props, { control, displayFormat, onChange
|
|
6822
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
6681
6823
|
const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
|
|
6682
6824
|
const InputWithoutPattern = control === "textarea" ? TextArea : Input6;
|
|
6683
|
-
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), {
|
|
6684
|
-
}
|
|
6685
|
-
function SsnInput(props) {
|
|
6686
|
-
const _a = props, {
|
|
6687
|
-
displayFormat = "",
|
|
6688
|
-
maxLength,
|
|
6689
|
-
onChange,
|
|
6690
|
-
type: _type,
|
|
6691
|
-
value = ""
|
|
6692
|
-
} = _a, commonProps = __objRest(_a, [
|
|
6693
|
-
"displayFormat",
|
|
6694
|
-
"maxLength",
|
|
6695
|
-
"onChange",
|
|
6696
|
-
"type",
|
|
6697
|
-
"value"
|
|
6698
|
-
]);
|
|
6699
|
-
const [isVisible, setIsVisible] = useState19(false);
|
|
6700
|
-
const maxDigits = displayFormat.split("").filter((character) => character === "*").length || maxLength || Infinity;
|
|
6701
|
-
const formattedValue = displayFormat ? displayFormat.split("").reduce(
|
|
6702
|
-
({ display, digitsUsed }, character) => {
|
|
6703
|
-
if (character === "*") {
|
|
6704
|
-
return digitsUsed < value.length ? {
|
|
6705
|
-
display: `${display}${isVisible ? value[digitsUsed] : "\u2022"}`,
|
|
6706
|
-
digitsUsed: digitsUsed + 1
|
|
6707
|
-
} : { display, digitsUsed };
|
|
6708
|
-
}
|
|
6709
|
-
return digitsUsed > 0 && digitsUsed < value.length ? { display: `${display}${character}`, digitsUsed } : { display, digitsUsed };
|
|
6710
|
-
},
|
|
6711
|
-
{ display: "", digitsUsed: 0 }
|
|
6712
|
-
).display : isVisible ? value : "\u2022".repeat(value.length);
|
|
6713
|
-
return /* @__PURE__ */ jsxs40("div", { className: "df-ssn-input-wrapper", children: [
|
|
6714
|
-
/* @__PURE__ */ jsx100(
|
|
6715
|
-
"input",
|
|
6716
|
-
__spreadProps(__spreadValues({}, commonProps), {
|
|
6717
|
-
className: "form-control np-form-control np-input np-input--shape-rectangle df-ssn-input",
|
|
6718
|
-
type: "text",
|
|
6719
|
-
inputMode: "numeric",
|
|
6720
|
-
maxLength: displayFormat.length || maxLength,
|
|
6721
|
-
value: formattedValue,
|
|
6722
|
-
onChange: () => void 0,
|
|
6723
|
-
onKeyDown: (event) => {
|
|
6724
|
-
const rawValue = value.replace(/\D/g, "");
|
|
6725
|
-
if (/^\d$/.test(event.key)) {
|
|
6726
|
-
event.preventDefault();
|
|
6727
|
-
if (rawValue.length < maxDigits) {
|
|
6728
|
-
onChange(`${rawValue}${event.key}`);
|
|
6729
|
-
}
|
|
6730
|
-
} else if (event.key === "Backspace") {
|
|
6731
|
-
event.preventDefault();
|
|
6732
|
-
onChange(rawValue.slice(0, -1));
|
|
6733
|
-
}
|
|
6734
|
-
},
|
|
6735
|
-
onPaste: (event) => {
|
|
6736
|
-
event.preventDefault();
|
|
6737
|
-
const pastedValue = event.clipboardData.getData("text").replace(/\D/g, "");
|
|
6738
|
-
onChange(`${value}${pastedValue}`.replace(/\D/g, "").slice(0, maxDigits));
|
|
6739
|
-
}
|
|
6740
|
-
})
|
|
6741
|
-
),
|
|
6742
|
-
/* @__PURE__ */ jsx100(
|
|
6743
|
-
"button",
|
|
6744
|
-
{
|
|
6745
|
-
type: "button",
|
|
6746
|
-
className: "df-ssn-input-toggle",
|
|
6747
|
-
"aria-label": isVisible ? "Hide value" : "Show value",
|
|
6748
|
-
onClick: () => setIsVisible((visible) => !visible),
|
|
6749
|
-
children: isVisible ? /* @__PURE__ */ jsx100(EyeShut, { size: 24 }) : /* @__PURE__ */ jsx100(Eye, { size: 24 })
|
|
6750
|
-
}
|
|
6751
|
-
)
|
|
6752
|
-
] });
|
|
6825
|
+
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
6753
6826
|
}
|
|
6754
6827
|
|
|
6755
6828
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -7316,13 +7389,13 @@ var openLinkInNewTab = (url) => {
|
|
|
7316
7389
|
};
|
|
7317
7390
|
|
|
7318
7391
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
7319
|
-
import { jsxs as
|
|
7392
|
+
import { jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7320
7393
|
function DynamicFlow(props) {
|
|
7321
7394
|
const { className = "" } = props;
|
|
7322
7395
|
const dfProps = useWiseToCoreProps(props);
|
|
7323
7396
|
const df = useDynamicFlow(dfProps);
|
|
7324
7397
|
const { onContextMenu, contextMenu } = useDFContextMenu(df.controller);
|
|
7325
|
-
return /* @__PURE__ */
|
|
7398
|
+
return /* @__PURE__ */ jsxs40("div", { className, onContextMenu, children: [
|
|
7326
7399
|
df.view,
|
|
7327
7400
|
contextMenu
|
|
7328
7401
|
] });
|