@wise/dynamic-flow-client-internal 5.29.0-experimental-9e4b087 → 5.29.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 +178 -134
- package/build/main.mjs +193 -149
- 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.29.0" : "0.0.0"
|
|
131
131
|
);
|
|
132
132
|
|
|
133
133
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
@@ -1792,6 +1792,10 @@ var isIOSWebKit = () => {
|
|
|
1792
1792
|
const mtp = navigator.maxTouchPoints;
|
|
1793
1793
|
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
1794
1794
|
};
|
|
1795
|
+
var getRect = (element) => {
|
|
1796
|
+
const { offsetWidth, offsetHeight } = element;
|
|
1797
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
1798
|
+
};
|
|
1795
1799
|
var defaultKeyExtractor = (index) => index;
|
|
1796
1800
|
var defaultRangeExtractor = (range) => {
|
|
1797
1801
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -1803,6 +1807,43 @@ var defaultRangeExtractor = (range) => {
|
|
|
1803
1807
|
}
|
|
1804
1808
|
return arr;
|
|
1805
1809
|
};
|
|
1810
|
+
var observeElementRect = (instance, cb) => {
|
|
1811
|
+
const element = instance.scrollElement;
|
|
1812
|
+
if (!element) {
|
|
1813
|
+
return;
|
|
1814
|
+
}
|
|
1815
|
+
const targetWindow = instance.targetWindow;
|
|
1816
|
+
if (!targetWindow) {
|
|
1817
|
+
return;
|
|
1818
|
+
}
|
|
1819
|
+
const handler = (rect) => {
|
|
1820
|
+
const { width, height } = rect;
|
|
1821
|
+
cb({ width: Math.round(width), height: Math.round(height) });
|
|
1822
|
+
};
|
|
1823
|
+
handler(getRect(element));
|
|
1824
|
+
if (!targetWindow.ResizeObserver) {
|
|
1825
|
+
return () => {
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
1829
|
+
const run = () => {
|
|
1830
|
+
const entry = entries[0];
|
|
1831
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1832
|
+
const box = entry.borderBoxSize[0];
|
|
1833
|
+
if (box) {
|
|
1834
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
1835
|
+
return;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
handler(getRect(element));
|
|
1839
|
+
};
|
|
1840
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1841
|
+
});
|
|
1842
|
+
observer.observe(element, { box: "border-box" });
|
|
1843
|
+
return () => {
|
|
1844
|
+
observer.unobserve(element);
|
|
1845
|
+
};
|
|
1846
|
+
};
|
|
1806
1847
|
var addEventListenerOptions = {
|
|
1807
1848
|
passive: true
|
|
1808
1849
|
};
|
|
@@ -1856,6 +1897,10 @@ var observeOffset = (instance, cb, readOffset) => {
|
|
|
1856
1897
|
fallback == null ? void 0 : fallback.cancel();
|
|
1857
1898
|
};
|
|
1858
1899
|
};
|
|
1900
|
+
var observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
1901
|
+
const { horizontal, isRtl } = instance.options;
|
|
1902
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
1903
|
+
});
|
|
1859
1904
|
var observeWindowOffset = (instance, cb) => observeOffset(
|
|
1860
1905
|
instance,
|
|
1861
1906
|
cb,
|
|
@@ -1898,6 +1943,7 @@ var scrollWithAdjustments = (offset, {
|
|
|
1898
1943
|
});
|
|
1899
1944
|
};
|
|
1900
1945
|
var windowScroll = scrollWithAdjustments;
|
|
1946
|
+
var elementScroll = scrollWithAdjustments;
|
|
1901
1947
|
var Virtualizer = class {
|
|
1902
1948
|
constructor(opts) {
|
|
1903
1949
|
this.unsubs = [];
|
|
@@ -3140,6 +3186,13 @@ function useVirtualizerBase(_a) {
|
|
|
3140
3186
|
});
|
|
3141
3187
|
return instance;
|
|
3142
3188
|
}
|
|
3189
|
+
function useVirtualizer(options) {
|
|
3190
|
+
return useVirtualizerBase(__spreadValues({
|
|
3191
|
+
observeElementRect,
|
|
3192
|
+
observeElementOffset,
|
|
3193
|
+
scrollToFn: elementScroll
|
|
3194
|
+
}, options));
|
|
3195
|
+
}
|
|
3143
3196
|
function useWindowVirtualizer(options) {
|
|
3144
3197
|
return useVirtualizerBase(__spreadValues({
|
|
3145
3198
|
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
@@ -3152,7 +3205,7 @@ function useWindowVirtualizer(options) {
|
|
|
3152
3205
|
|
|
3153
3206
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3154
3207
|
import { ProcessIndicator, Button as Button4 } from "@transferwise/components";
|
|
3155
|
-
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
3208
|
+
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useState as useState8 } from "react";
|
|
3156
3209
|
|
|
3157
3210
|
// ../renderers/src/step/StepFooter.tsx
|
|
3158
3211
|
import { Button as Button3 } from "@transferwise/components";
|
|
@@ -3212,7 +3265,7 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3212
3265
|
] })
|
|
3213
3266
|
] });
|
|
3214
3267
|
};
|
|
3215
|
-
var useIsElementVisible = (elementRef) => {
|
|
3268
|
+
var useIsElementVisible = (elementRef, root = null) => {
|
|
3216
3269
|
const [isVisible, setIsVisible] = useState7(false);
|
|
3217
3270
|
useEffect6(() => {
|
|
3218
3271
|
const element = elementRef.current;
|
|
@@ -3221,11 +3274,11 @@ var useIsElementVisible = (elementRef) => {
|
|
|
3221
3274
|
([entry]) => {
|
|
3222
3275
|
setIsVisible(entry.isIntersecting);
|
|
3223
3276
|
},
|
|
3224
|
-
{ rootMargin: "1px" }
|
|
3277
|
+
{ root, rootMargin: "1px" }
|
|
3225
3278
|
);
|
|
3226
3279
|
observer.observe(element);
|
|
3227
3280
|
return () => observer.disconnect();
|
|
3228
|
-
}, [elementRef]);
|
|
3281
|
+
}, [elementRef, root]);
|
|
3229
3282
|
return isVisible;
|
|
3230
3283
|
};
|
|
3231
3284
|
|
|
@@ -3247,12 +3300,40 @@ var collection_messages_default = defineMessages5({
|
|
|
3247
3300
|
}
|
|
3248
3301
|
});
|
|
3249
3302
|
|
|
3303
|
+
// ../renderers/src/CollectionRenderer/components/getScrollableAncestor.ts
|
|
3304
|
+
var SCROLLABLE_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["auto", "overlay", "scroll"]);
|
|
3305
|
+
var getScrollableAncestor = (element) => {
|
|
3306
|
+
var _a;
|
|
3307
|
+
const view = element == null ? void 0 : element.ownerDocument.defaultView;
|
|
3308
|
+
let ancestor = (_a = element == null ? void 0 : element.parentElement) != null ? _a : null;
|
|
3309
|
+
if (!view) {
|
|
3310
|
+
return null;
|
|
3311
|
+
}
|
|
3312
|
+
while (ancestor) {
|
|
3313
|
+
const { overflowY } = view.getComputedStyle(ancestor);
|
|
3314
|
+
const hasScrollableOverflow = SCROLLABLE_OVERFLOW_VALUES.has(overflowY);
|
|
3315
|
+
if (hasScrollableOverflow && ancestor.scrollHeight > ancestor.clientHeight) {
|
|
3316
|
+
return ancestor;
|
|
3317
|
+
}
|
|
3318
|
+
ancestor = ancestor.parentElement;
|
|
3319
|
+
}
|
|
3320
|
+
return null;
|
|
3321
|
+
};
|
|
3322
|
+
|
|
3250
3323
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3251
3324
|
import { jsx as jsx36, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3252
3325
|
var ContentComponent = (props) => {
|
|
3253
3326
|
const { state, status, SectionHeader, Item } = props;
|
|
3327
|
+
const contentRef = useRef4(null);
|
|
3328
|
+
const [scrollElement, setScrollElement] = useState8(null);
|
|
3329
|
+
useLayoutEffect2(() => {
|
|
3330
|
+
const nextScrollElement = getScrollableAncestor(contentRef.current);
|
|
3331
|
+
setScrollElement(
|
|
3332
|
+
(currentScrollElement) => currentScrollElement === nextScrollElement ? currentScrollElement : nextScrollElement
|
|
3333
|
+
);
|
|
3334
|
+
}, []);
|
|
3254
3335
|
const endOfContentRef = useRef4(null);
|
|
3255
|
-
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
3336
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef, scrollElement);
|
|
3256
3337
|
useEffect7(() => {
|
|
3257
3338
|
const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
|
|
3258
3339
|
if (shouldAutoLoad && status.loadMore) {
|
|
@@ -3284,51 +3365,90 @@ var ContentComponent = (props) => {
|
|
|
3284
3365
|
var _a, _b;
|
|
3285
3366
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
3286
3367
|
});
|
|
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: [
|
|
3368
|
+
return /* @__PURE__ */ jsxs7("div", { ref: contentRef, children: [
|
|
3295
3369
|
state.beforeSections,
|
|
3296
|
-
/* @__PURE__ */ jsx36(
|
|
3297
|
-
|
|
3370
|
+
scrollElement ? /* @__PURE__ */ jsx36(
|
|
3371
|
+
ElementVirtualizedItems,
|
|
3298
3372
|
{
|
|
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
|
-
})
|
|
3373
|
+
Item,
|
|
3374
|
+
SectionHeader,
|
|
3375
|
+
items,
|
|
3376
|
+
scrollElement,
|
|
3377
|
+
stateCount
|
|
3378
|
+
}
|
|
3379
|
+
) : /* @__PURE__ */ jsx36(
|
|
3380
|
+
WindowVirtualizedItems,
|
|
3381
|
+
{
|
|
3382
|
+
Item,
|
|
3383
|
+
SectionHeader,
|
|
3384
|
+
items,
|
|
3385
|
+
stateCount
|
|
3326
3386
|
}
|
|
3327
3387
|
),
|
|
3328
3388
|
/* @__PURE__ */ jsx36("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: /* @__PURE__ */ jsx36(PaginationComponent, { status, state }) }),
|
|
3329
3389
|
state.afterSections
|
|
3330
3390
|
] });
|
|
3331
3391
|
};
|
|
3392
|
+
var WindowVirtualizedItems = (props) => {
|
|
3393
|
+
const { stateCount } = props;
|
|
3394
|
+
const virtualItemsRef = useRef4(null);
|
|
3395
|
+
const virtualizer = useWindowVirtualizer({
|
|
3396
|
+
count: stateCount,
|
|
3397
|
+
estimateSize: () => 120,
|
|
3398
|
+
overscan: 10
|
|
3399
|
+
});
|
|
3400
|
+
return /* @__PURE__ */ jsx36(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3401
|
+
};
|
|
3402
|
+
var ElementVirtualizedItems = (props) => {
|
|
3403
|
+
const { scrollElement, stateCount } = props;
|
|
3404
|
+
const virtualItemsRef = useRef4(null);
|
|
3405
|
+
const virtualizer = useVirtualizer({
|
|
3406
|
+
count: stateCount,
|
|
3407
|
+
getScrollElement: () => scrollElement,
|
|
3408
|
+
estimateSize: () => 120,
|
|
3409
|
+
overscan: 10
|
|
3410
|
+
});
|
|
3411
|
+
return /* @__PURE__ */ jsx36(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3412
|
+
};
|
|
3413
|
+
var VirtualizedItems = ({
|
|
3414
|
+
Item,
|
|
3415
|
+
SectionHeader,
|
|
3416
|
+
items,
|
|
3417
|
+
virtualItemsRef,
|
|
3418
|
+
virtualizer
|
|
3419
|
+
}) => /* @__PURE__ */ jsx36(
|
|
3420
|
+
"div",
|
|
3421
|
+
{
|
|
3422
|
+
ref: virtualItemsRef,
|
|
3423
|
+
style: {
|
|
3424
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
3425
|
+
width: "100%",
|
|
3426
|
+
position: "relative"
|
|
3427
|
+
},
|
|
3428
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
3429
|
+
const i = items[item.index];
|
|
3430
|
+
if (!i) {
|
|
3431
|
+
return null;
|
|
3432
|
+
}
|
|
3433
|
+
return /* @__PURE__ */ jsx36(
|
|
3434
|
+
"div",
|
|
3435
|
+
{
|
|
3436
|
+
ref: virtualizer.measureElement,
|
|
3437
|
+
"data-index": item.index,
|
|
3438
|
+
style: {
|
|
3439
|
+
position: "absolute",
|
|
3440
|
+
top: 0,
|
|
3441
|
+
left: 0,
|
|
3442
|
+
width: "100%",
|
|
3443
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3444
|
+
},
|
|
3445
|
+
children: i.type === "header" ? /* @__PURE__ */ jsx36(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ jsx36(Item, __spreadValues({}, i.item))
|
|
3446
|
+
},
|
|
3447
|
+
item.key
|
|
3448
|
+
);
|
|
3449
|
+
})
|
|
3450
|
+
}
|
|
3451
|
+
);
|
|
3332
3452
|
var PaginationComponent = ({
|
|
3333
3453
|
status,
|
|
3334
3454
|
state
|
|
@@ -3627,11 +3747,11 @@ var CollectionRenderer_default = CollectionRenderer;
|
|
|
3627
3747
|
var import_classnames11 = __toESM(require_classnames());
|
|
3628
3748
|
|
|
3629
3749
|
// ../renderers/src/utils/useIsCollapsed.ts
|
|
3630
|
-
import { useEffect as useEffect8, useState as
|
|
3750
|
+
import { useEffect as useEffect8, useState as useState9 } from "react";
|
|
3631
3751
|
var COLLAPSE_QUERY = "(max-width: 767.98px)";
|
|
3632
3752
|
var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
|
|
3633
3753
|
var useIsCollapsed = () => {
|
|
3634
|
-
const [collapsed, setCollapsed] =
|
|
3754
|
+
const [collapsed, setCollapsed] = useState9(
|
|
3635
3755
|
() => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
|
|
3636
3756
|
);
|
|
3637
3757
|
useEffect8(() => {
|
|
@@ -3685,7 +3805,7 @@ var ColumnsRenderer_default = ColumnsRenderer;
|
|
|
3685
3805
|
import { DateInput, DateLookup } from "@transferwise/components";
|
|
3686
3806
|
|
|
3687
3807
|
// ../renderers/src/hooks/useAvailabilityRules.ts
|
|
3688
|
-
import { useState as
|
|
3808
|
+
import { useState as useState10 } from "react";
|
|
3689
3809
|
import { useIntl as useIntl7 } from "react-intl";
|
|
3690
3810
|
|
|
3691
3811
|
// ../renderers/src/messages/date-input.messages.ts
|
|
@@ -3730,7 +3850,7 @@ var dateToDateString = (date) => {
|
|
|
3730
3850
|
var useAvailabilityRules = (availability) => {
|
|
3731
3851
|
var _a, _b;
|
|
3732
3852
|
const { formatMessage } = useIntl7();
|
|
3733
|
-
const [focusedDate, setFocusedDate] =
|
|
3853
|
+
const [focusedDate, setFocusedDate] = useState10(null);
|
|
3734
3854
|
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
3855
|
const onDateSelect = ({ date }) => {
|
|
3736
3856
|
setFocusedDate(date);
|
|
@@ -3888,7 +4008,7 @@ import { ListItem as ListItem7 } from "@transferwise/components";
|
|
|
3888
4008
|
|
|
3889
4009
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
3890
4010
|
import { Header as Header3, SearchInput } from "@transferwise/components";
|
|
3891
|
-
import { useState as
|
|
4011
|
+
import { useState as useState11 } from "react";
|
|
3892
4012
|
import { useIntl as useIntl9 } from "react-intl";
|
|
3893
4013
|
|
|
3894
4014
|
// ../renderers/src/messages/filter.messages.ts
|
|
@@ -4036,7 +4156,7 @@ var UnfilteredDecisionList = (_a) => {
|
|
|
4036
4156
|
};
|
|
4037
4157
|
var FilteredDecisionList = (props) => {
|
|
4038
4158
|
const { formatMessage } = useIntl9();
|
|
4039
|
-
const [query, setQuery] =
|
|
4159
|
+
const [query, setQuery] = useState11("");
|
|
4040
4160
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
4041
4161
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortItems(options, query) : options;
|
|
4042
4162
|
const isGrouped = isGroupedDecision(options);
|
|
@@ -4301,7 +4421,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
4301
4421
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
4302
4422
|
var import_classnames16 = __toESM(require_classnames());
|
|
4303
4423
|
import { Image } from "@transferwise/components";
|
|
4304
|
-
import { useEffect as useEffect10, useState as
|
|
4424
|
+
import { useEffect as useEffect10, useState as useState12 } from "react";
|
|
4305
4425
|
|
|
4306
4426
|
// ../renderers/src/utils/api-utils.ts
|
|
4307
4427
|
function isRelativePath(url = "") {
|
|
@@ -4322,7 +4442,7 @@ function UrlImage({
|
|
|
4322
4442
|
uri,
|
|
4323
4443
|
httpClient
|
|
4324
4444
|
}) {
|
|
4325
|
-
const [imageSource, setImageSource] =
|
|
4445
|
+
const [imageSource, setImageSource] = useState12("");
|
|
4326
4446
|
useEffect10(() => {
|
|
4327
4447
|
if (!uri.startsWith("urn:")) {
|
|
4328
4448
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
@@ -4667,7 +4787,7 @@ var mapAvatarMediaSize = (size) => {
|
|
|
4667
4787
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
4668
4788
|
var import_classnames22 = __toESM(require_classnames());
|
|
4669
4789
|
import { Button as Button6, Modal as Modal2 } from "@transferwise/components";
|
|
4670
|
-
import { useState as
|
|
4790
|
+
import { useState as useState13 } from "react";
|
|
4671
4791
|
import { jsx as jsx65, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4672
4792
|
var ModalLayoutRenderer = {
|
|
4673
4793
|
canRenderType: "modal-layout",
|
|
@@ -4675,7 +4795,7 @@ var ModalLayoutRenderer = {
|
|
|
4675
4795
|
};
|
|
4676
4796
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
4677
4797
|
function DFModal({ content, margin, trigger, control, tags }) {
|
|
4678
|
-
const [visible, setVisible] =
|
|
4798
|
+
const [visible, setVisible] = useState13(false);
|
|
4679
4799
|
const { children, title } = content;
|
|
4680
4800
|
return /* @__PURE__ */ jsxs16("div", { className: (0, import_classnames22.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
4681
4801
|
/* @__PURE__ */ jsx65(Button6, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
@@ -4820,7 +4940,7 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
4820
4940
|
|
|
4821
4941
|
// ../renderers/src/MultiSelectInputRenderer/InlineComponent.tsx
|
|
4822
4942
|
import { ListItem as ListItem9, SearchInput as SearchInput2 } from "@transferwise/components";
|
|
4823
|
-
import { useState as
|
|
4943
|
+
import { useState as useState14 } from "react";
|
|
4824
4944
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4825
4945
|
|
|
4826
4946
|
// ../renderers/src/utils/items-with-index.ts
|
|
@@ -4846,7 +4966,7 @@ function InlineComponent(props) {
|
|
|
4846
4966
|
onSelect
|
|
4847
4967
|
} = props;
|
|
4848
4968
|
const optionsWithIndex = zipWithIndex(options);
|
|
4849
|
-
const [query, setQuery] =
|
|
4969
|
+
const [query, setQuery] = useState14("");
|
|
4850
4970
|
const { formatMessage } = useIntl12();
|
|
4851
4971
|
const filtered = tags == null ? void 0 : tags.includes("filtered");
|
|
4852
4972
|
const filteredOptions = query ? filterAndSortItems(optionsWithIndex, filtered ? query : "") : optionsWithIndex;
|
|
@@ -4921,7 +5041,7 @@ function InlineComponent(props) {
|
|
|
4921
5041
|
|
|
4922
5042
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
4923
5043
|
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
4924
|
-
import { useState as
|
|
5044
|
+
import { useState as useState15 } from "react";
|
|
4925
5045
|
import { useIntl as useIntl13 } from "react-intl";
|
|
4926
5046
|
|
|
4927
5047
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
@@ -4938,7 +5058,7 @@ var multi_select_messages_default = defineMessages10({
|
|
|
4938
5058
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
4939
5059
|
function DefaultComponent(props) {
|
|
4940
5060
|
const { formatMessage } = useIntl13();
|
|
4941
|
-
const [stagedIndices, setStagedIndices] =
|
|
5061
|
+
const [stagedIndices, setStagedIndices] = useState15();
|
|
4942
5062
|
const {
|
|
4943
5063
|
id,
|
|
4944
5064
|
autoComplete,
|
|
@@ -5393,7 +5513,7 @@ var ProgressRenderer = {
|
|
|
5393
5513
|
var import_classnames26 = __toESM(require_classnames());
|
|
5394
5514
|
import { Button as Button8, Header as Header6, InlineAlert as InlineAlert3, Modal as Modal4, NavigationOption } from "@transferwise/components";
|
|
5395
5515
|
import { Plus } from "@transferwise/icons";
|
|
5396
|
-
import { useState as
|
|
5516
|
+
import { useState as useState16 } from "react";
|
|
5397
5517
|
import { useIntl as useIntl15 } from "react-intl";
|
|
5398
5518
|
|
|
5399
5519
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
@@ -5443,7 +5563,7 @@ function Repeatable(props) {
|
|
|
5443
5563
|
onRemove
|
|
5444
5564
|
} = props;
|
|
5445
5565
|
const { formatMessage } = useIntl15();
|
|
5446
|
-
const [openModalType, setOpenModalType] =
|
|
5566
|
+
const [openModalType, setOpenModalType] = useState16(null);
|
|
5447
5567
|
const { ref } = useScrollToError(validationState, features);
|
|
5448
5568
|
const onAddItem = () => {
|
|
5449
5569
|
onAdd();
|
|
@@ -5667,7 +5787,7 @@ var ReviewRenderer_default = ReviewRenderer2;
|
|
|
5667
5787
|
|
|
5668
5788
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
5669
5789
|
import { Input as Input5, InputGroup as InputGroup4, List, ListItem as ListItem11, Markdown as Markdown6 } from "@transferwise/components";
|
|
5670
|
-
import { useState as
|
|
5790
|
+
import { useState as useState17 } from "react";
|
|
5671
5791
|
import { useIntl as useIntl18 } from "react-intl";
|
|
5672
5792
|
|
|
5673
5793
|
// ../renderers/src/messages/search.messages.ts
|
|
@@ -5710,7 +5830,7 @@ function BlockSearchRendererComponent({
|
|
|
5710
5830
|
trackEvent,
|
|
5711
5831
|
onChange
|
|
5712
5832
|
}) {
|
|
5713
|
-
const [hasSearched, setHasSearched] =
|
|
5833
|
+
const [hasSearched, setHasSearched] = useState17(false);
|
|
5714
5834
|
const { formatMessage } = useIntl18();
|
|
5715
5835
|
return /* @__PURE__ */ jsxs24("div", { className: getMargin(margin), children: [
|
|
5716
5836
|
/* @__PURE__ */ jsx81(
|
|
@@ -5805,7 +5925,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
|
5805
5925
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
5806
5926
|
import { Markdown as Markdown7, Typeahead } from "@transferwise/components";
|
|
5807
5927
|
import { Search as Search3 } from "@transferwise/icons";
|
|
5808
|
-
import { useState as
|
|
5928
|
+
import { useState as useState18 } from "react";
|
|
5809
5929
|
import { useIntl as useIntl19 } from "react-intl";
|
|
5810
5930
|
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
5811
5931
|
function InlineSearchRenderer({
|
|
@@ -5821,7 +5941,7 @@ function InlineSearchRenderer({
|
|
|
5821
5941
|
onChange,
|
|
5822
5942
|
trackEvent
|
|
5823
5943
|
}) {
|
|
5824
|
-
const [hasSearched, setHasSearched] =
|
|
5944
|
+
const [hasSearched, setHasSearched] = useState18(false);
|
|
5825
5945
|
const intl = useIntl19();
|
|
5826
5946
|
return /* @__PURE__ */ jsx82("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx82(
|
|
5827
5947
|
FieldInput_default,
|
|
@@ -6541,7 +6661,7 @@ function StepRendererComponent(props) {
|
|
|
6541
6661
|
// ../renderers/src/TabsRenderer.tsx
|
|
6542
6662
|
var import_classnames33 = __toESM(require_classnames());
|
|
6543
6663
|
import { Chips as Chips2, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
|
|
6544
|
-
import { useState as
|
|
6664
|
+
import { useState as useState19 } from "react";
|
|
6545
6665
|
import { jsx as jsx99, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6546
6666
|
var TabsRenderer = {
|
|
6547
6667
|
canRenderType: "tabs",
|
|
@@ -6560,7 +6680,7 @@ var TabsRenderer = {
|
|
|
6560
6680
|
}
|
|
6561
6681
|
};
|
|
6562
6682
|
function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6563
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6683
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6564
6684
|
return /* @__PURE__ */ jsx99("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: /* @__PURE__ */ jsx99(
|
|
6565
6685
|
Tabs2,
|
|
6566
6686
|
{
|
|
@@ -6581,7 +6701,7 @@ function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6581
6701
|
}
|
|
6582
6702
|
function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6583
6703
|
var _a;
|
|
6584
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6704
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6585
6705
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6586
6706
|
/* @__PURE__ */ jsx99(
|
|
6587
6707
|
SegmentedControl2,
|
|
@@ -6603,7 +6723,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6603
6723
|
}
|
|
6604
6724
|
function ChipsTabsRendererComponent({ margin, tabs, control, tags }) {
|
|
6605
6725
|
var _a;
|
|
6606
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6726
|
+
const [selectedIndex, setSelectedIndex] = useState19(0);
|
|
6607
6727
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6608
6728
|
/* @__PURE__ */ jsx99("div", { className: "chips-container", children: /* @__PURE__ */ jsx99(
|
|
6609
6729
|
Chips2,
|
|
@@ -6628,9 +6748,7 @@ import {
|
|
|
6628
6748
|
TextArea,
|
|
6629
6749
|
TextareaWithDisplayFormat
|
|
6630
6750
|
} from "@transferwise/components";
|
|
6631
|
-
import {
|
|
6632
|
-
import { useState as useState19 } from "react";
|
|
6633
|
-
import { jsx as jsx100, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6751
|
+
import { jsx as jsx100 } from "react/jsx-runtime";
|
|
6634
6752
|
var commonKeys = [
|
|
6635
6753
|
"autoComplete",
|
|
6636
6754
|
"autoCapitalize",
|
|
@@ -6645,18 +6763,13 @@ var commonKeys = [
|
|
|
6645
6763
|
"value"
|
|
6646
6764
|
];
|
|
6647
6765
|
function VariableTextInput(inputProps) {
|
|
6648
|
-
const { id, value, control,
|
|
6766
|
+
const { id, value, control, onChange } = inputProps;
|
|
6649
6767
|
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
6768
|
switch (control) {
|
|
6654
6769
|
case "email":
|
|
6655
6770
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
6656
6771
|
case "password":
|
|
6657
6772
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
6658
|
-
case "ssn-input":
|
|
6659
|
-
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6660
6773
|
case "numeric": {
|
|
6661
6774
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
6662
6775
|
return /* @__PURE__ */ jsx100(
|
|
@@ -6677,79 +6790,10 @@ function VariableTextInput(inputProps) {
|
|
|
6677
6790
|
}
|
|
6678
6791
|
}
|
|
6679
6792
|
function TextInput(props) {
|
|
6680
|
-
const _a = props, { control, displayFormat, onChange
|
|
6793
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
6681
6794
|
const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
|
|
6682
6795
|
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
|
-
] });
|
|
6796
|
+
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
6753
6797
|
}
|
|
6754
6798
|
|
|
6755
6799
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -7316,13 +7360,13 @@ var openLinkInNewTab = (url) => {
|
|
|
7316
7360
|
};
|
|
7317
7361
|
|
|
7318
7362
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
7319
|
-
import { jsxs as
|
|
7363
|
+
import { jsxs as jsxs40 } from "react/jsx-runtime";
|
|
7320
7364
|
function DynamicFlow(props) {
|
|
7321
7365
|
const { className = "" } = props;
|
|
7322
7366
|
const dfProps = useWiseToCoreProps(props);
|
|
7323
7367
|
const df = useDynamicFlow(dfProps);
|
|
7324
7368
|
const { onContextMenu, contextMenu } = useDFContextMenu(df.controller);
|
|
7325
|
-
return /* @__PURE__ */
|
|
7369
|
+
return /* @__PURE__ */ jsxs40("div", { className, onContextMenu, children: [
|
|
7326
7370
|
df.view,
|
|
7327
7371
|
contextMenu
|
|
7328
7372
|
] });
|