@wise/dynamic-flow-client-internal 5.29.0-experimental-6048bca → 5.29.0-experimental-3acf859
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.js +107 -164
- package/build/main.mjs +134 -191
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +4 -4
package/build/main.mjs
CHANGED
|
@@ -1792,10 +1792,6 @@ 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
|
-
};
|
|
1799
1795
|
var defaultKeyExtractor = (index) => index;
|
|
1800
1796
|
var defaultRangeExtractor = (range) => {
|
|
1801
1797
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -1807,43 +1803,6 @@ var defaultRangeExtractor = (range) => {
|
|
|
1807
1803
|
}
|
|
1808
1804
|
return arr;
|
|
1809
1805
|
};
|
|
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
|
-
};
|
|
1847
1806
|
var addEventListenerOptions = {
|
|
1848
1807
|
passive: true
|
|
1849
1808
|
};
|
|
@@ -1897,10 +1856,6 @@ var observeOffset = (instance, cb, readOffset) => {
|
|
|
1897
1856
|
fallback == null ? void 0 : fallback.cancel();
|
|
1898
1857
|
};
|
|
1899
1858
|
};
|
|
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
|
-
});
|
|
1904
1859
|
var observeWindowOffset = (instance, cb) => observeOffset(
|
|
1905
1860
|
instance,
|
|
1906
1861
|
cb,
|
|
@@ -1943,7 +1898,6 @@ var scrollWithAdjustments = (offset, {
|
|
|
1943
1898
|
});
|
|
1944
1899
|
};
|
|
1945
1900
|
var windowScroll = scrollWithAdjustments;
|
|
1946
|
-
var elementScroll = scrollWithAdjustments;
|
|
1947
1901
|
var Virtualizer = class {
|
|
1948
1902
|
constructor(opts) {
|
|
1949
1903
|
this.unsubs = [];
|
|
@@ -3186,13 +3140,6 @@ function useVirtualizerBase(_a) {
|
|
|
3186
3140
|
});
|
|
3187
3141
|
return instance;
|
|
3188
3142
|
}
|
|
3189
|
-
function useVirtualizer(options) {
|
|
3190
|
-
return useVirtualizerBase(__spreadValues({
|
|
3191
|
-
observeElementRect,
|
|
3192
|
-
observeElementOffset,
|
|
3193
|
-
scrollToFn: elementScroll
|
|
3194
|
-
}, options));
|
|
3195
|
-
}
|
|
3196
3143
|
function useWindowVirtualizer(options) {
|
|
3197
3144
|
return useVirtualizerBase(__spreadValues({
|
|
3198
3145
|
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
@@ -3205,7 +3152,7 @@ function useWindowVirtualizer(options) {
|
|
|
3205
3152
|
|
|
3206
3153
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3207
3154
|
import { ProcessIndicator, Button as Button4 } from "@transferwise/components";
|
|
3208
|
-
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2
|
|
3155
|
+
import { useRef as useRef4, useEffect as useEffect7, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
3209
3156
|
|
|
3210
3157
|
// ../renderers/src/step/StepFooter.tsx
|
|
3211
3158
|
import { Button as Button3 } from "@transferwise/components";
|
|
@@ -3265,7 +3212,7 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3265
3212
|
] })
|
|
3266
3213
|
] });
|
|
3267
3214
|
};
|
|
3268
|
-
var useIsElementVisible = (elementRef
|
|
3215
|
+
var useIsElementVisible = (elementRef) => {
|
|
3269
3216
|
const [isVisible, setIsVisible] = useState7(false);
|
|
3270
3217
|
useEffect6(() => {
|
|
3271
3218
|
const element = elementRef.current;
|
|
@@ -3274,11 +3221,11 @@ var useIsElementVisible = (elementRef, root = null) => {
|
|
|
3274
3221
|
([entry]) => {
|
|
3275
3222
|
setIsVisible(entry.isIntersecting);
|
|
3276
3223
|
},
|
|
3277
|
-
{
|
|
3224
|
+
{ rootMargin: "1px" }
|
|
3278
3225
|
);
|
|
3279
3226
|
observer.observe(element);
|
|
3280
3227
|
return () => observer.disconnect();
|
|
3281
|
-
}, [elementRef
|
|
3228
|
+
}, [elementRef]);
|
|
3282
3229
|
return isVisible;
|
|
3283
3230
|
};
|
|
3284
3231
|
|
|
@@ -3300,40 +3247,12 @@ var collection_messages_default = defineMessages5({
|
|
|
3300
3247
|
}
|
|
3301
3248
|
});
|
|
3302
3249
|
|
|
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
|
-
|
|
3323
3250
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3324
3251
|
import { jsx as jsx36, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3325
3252
|
var ContentComponent = (props) => {
|
|
3326
3253
|
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
|
-
}, []);
|
|
3335
3254
|
const endOfContentRef = useRef4(null);
|
|
3336
|
-
const isBottomVisible = useIsElementVisible(endOfContentRef
|
|
3255
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
3337
3256
|
useEffect7(() => {
|
|
3338
3257
|
const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
|
|
3339
3258
|
if (shouldAutoLoad && status.loadMore) {
|
|
@@ -3365,90 +3284,51 @@ var ContentComponent = (props) => {
|
|
|
3365
3284
|
var _a, _b;
|
|
3366
3285
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
3367
3286
|
});
|
|
3368
|
-
|
|
3287
|
+
const virtualizer = useWindowVirtualizer({
|
|
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: [
|
|
3369
3295
|
state.beforeSections,
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
{
|
|
3373
|
-
Item,
|
|
3374
|
-
SectionHeader,
|
|
3375
|
-
items,
|
|
3376
|
-
scrollElement,
|
|
3377
|
-
stateCount
|
|
3378
|
-
}
|
|
3379
|
-
) : /* @__PURE__ */ jsx36(
|
|
3380
|
-
WindowVirtualizedItems,
|
|
3296
|
+
/* @__PURE__ */ jsx36(
|
|
3297
|
+
"div",
|
|
3381
3298
|
{
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3299
|
+
style: {
|
|
3300
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
3301
|
+
width: "100%",
|
|
3302
|
+
position: "relative"
|
|
3303
|
+
},
|
|
3304
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
3305
|
+
const i = items[item.index];
|
|
3306
|
+
if (!i) {
|
|
3307
|
+
return null;
|
|
3308
|
+
}
|
|
3309
|
+
return /* @__PURE__ */ jsx36(
|
|
3310
|
+
"div",
|
|
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
|
+
})
|
|
3386
3326
|
}
|
|
3387
3327
|
),
|
|
3388
3328
|
/* @__PURE__ */ jsx36("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: /* @__PURE__ */ jsx36(PaginationComponent, { status, state }) }),
|
|
3389
3329
|
state.afterSections
|
|
3390
3330
|
] });
|
|
3391
3331
|
};
|
|
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
|
-
);
|
|
3452
3332
|
var PaginationComponent = ({
|
|
3453
3333
|
status,
|
|
3454
3334
|
state
|
|
@@ -3747,11 +3627,11 @@ var CollectionRenderer_default = CollectionRenderer;
|
|
|
3747
3627
|
var import_classnames11 = __toESM(require_classnames());
|
|
3748
3628
|
|
|
3749
3629
|
// ../renderers/src/utils/useIsCollapsed.ts
|
|
3750
|
-
import { useEffect as useEffect8, useState as
|
|
3630
|
+
import { useEffect as useEffect8, useState as useState8 } from "react";
|
|
3751
3631
|
var COLLAPSE_QUERY = "(max-width: 767.98px)";
|
|
3752
3632
|
var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
|
|
3753
3633
|
var useIsCollapsed = () => {
|
|
3754
|
-
const [collapsed, setCollapsed] =
|
|
3634
|
+
const [collapsed, setCollapsed] = useState8(
|
|
3755
3635
|
() => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
|
|
3756
3636
|
);
|
|
3757
3637
|
useEffect8(() => {
|
|
@@ -3805,7 +3685,7 @@ var ColumnsRenderer_default = ColumnsRenderer;
|
|
|
3805
3685
|
import { DateInput, DateLookup } from "@transferwise/components";
|
|
3806
3686
|
|
|
3807
3687
|
// ../renderers/src/hooks/useAvailabilityRules.ts
|
|
3808
|
-
import { useState as
|
|
3688
|
+
import { useState as useState9 } from "react";
|
|
3809
3689
|
import { useIntl as useIntl7 } from "react-intl";
|
|
3810
3690
|
|
|
3811
3691
|
// ../renderers/src/messages/date-input.messages.ts
|
|
@@ -3850,7 +3730,7 @@ var dateToDateString = (date) => {
|
|
|
3850
3730
|
var useAvailabilityRules = (availability) => {
|
|
3851
3731
|
var _a, _b;
|
|
3852
3732
|
const { formatMessage } = useIntl7();
|
|
3853
|
-
const [focusedDate, setFocusedDate] =
|
|
3733
|
+
const [focusedDate, setFocusedDate] = useState9(null);
|
|
3854
3734
|
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);
|
|
3855
3735
|
const onDateSelect = ({ date }) => {
|
|
3856
3736
|
setFocusedDate(date);
|
|
@@ -4008,7 +3888,7 @@ import { ListItem as ListItem7 } from "@transferwise/components";
|
|
|
4008
3888
|
|
|
4009
3889
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
4010
3890
|
import { Header as Header3, SearchInput } from "@transferwise/components";
|
|
4011
|
-
import { useState as
|
|
3891
|
+
import { useState as useState10 } from "react";
|
|
4012
3892
|
import { useIntl as useIntl9 } from "react-intl";
|
|
4013
3893
|
|
|
4014
3894
|
// ../renderers/src/messages/filter.messages.ts
|
|
@@ -4156,7 +4036,7 @@ var UnfilteredDecisionList = (_a) => {
|
|
|
4156
4036
|
};
|
|
4157
4037
|
var FilteredDecisionList = (props) => {
|
|
4158
4038
|
const { formatMessage } = useIntl9();
|
|
4159
|
-
const [query, setQuery] =
|
|
4039
|
+
const [query, setQuery] = useState10("");
|
|
4160
4040
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
4161
4041
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortItems(options, query) : options;
|
|
4162
4042
|
const isGrouped = isGroupedDecision(options);
|
|
@@ -4421,7 +4301,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
4421
4301
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
4422
4302
|
var import_classnames16 = __toESM(require_classnames());
|
|
4423
4303
|
import { Image } from "@transferwise/components";
|
|
4424
|
-
import { useEffect as useEffect10, useState as
|
|
4304
|
+
import { useEffect as useEffect10, useState as useState11 } from "react";
|
|
4425
4305
|
|
|
4426
4306
|
// ../renderers/src/utils/api-utils.ts
|
|
4427
4307
|
function isRelativePath(url = "") {
|
|
@@ -4442,7 +4322,7 @@ function UrlImage({
|
|
|
4442
4322
|
uri,
|
|
4443
4323
|
httpClient
|
|
4444
4324
|
}) {
|
|
4445
|
-
const [imageSource, setImageSource] =
|
|
4325
|
+
const [imageSource, setImageSource] = useState11("");
|
|
4446
4326
|
useEffect10(() => {
|
|
4447
4327
|
if (!uri.startsWith("urn:")) {
|
|
4448
4328
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
@@ -4787,7 +4667,7 @@ var mapAvatarMediaSize = (size) => {
|
|
|
4787
4667
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
4788
4668
|
var import_classnames22 = __toESM(require_classnames());
|
|
4789
4669
|
import { Button as Button6, Modal as Modal2 } from "@transferwise/components";
|
|
4790
|
-
import { useState as
|
|
4670
|
+
import { useState as useState12 } from "react";
|
|
4791
4671
|
import { jsx as jsx65, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4792
4672
|
var ModalLayoutRenderer = {
|
|
4793
4673
|
canRenderType: "modal-layout",
|
|
@@ -4795,7 +4675,7 @@ var ModalLayoutRenderer = {
|
|
|
4795
4675
|
};
|
|
4796
4676
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
4797
4677
|
function DFModal({ content, margin, trigger, control, tags }) {
|
|
4798
|
-
const [visible, setVisible] =
|
|
4678
|
+
const [visible, setVisible] = useState12(false);
|
|
4799
4679
|
const { children, title } = content;
|
|
4800
4680
|
return /* @__PURE__ */ jsxs16("div", { className: (0, import_classnames22.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
4801
4681
|
/* @__PURE__ */ jsx65(Button6, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
@@ -4940,7 +4820,7 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
4940
4820
|
|
|
4941
4821
|
// ../renderers/src/MultiSelectInputRenderer/InlineComponent.tsx
|
|
4942
4822
|
import { ListItem as ListItem9, SearchInput as SearchInput2 } from "@transferwise/components";
|
|
4943
|
-
import { useState as
|
|
4823
|
+
import { useState as useState13 } from "react";
|
|
4944
4824
|
import { useIntl as useIntl12 } from "react-intl";
|
|
4945
4825
|
|
|
4946
4826
|
// ../renderers/src/utils/items-with-index.ts
|
|
@@ -4966,7 +4846,7 @@ function InlineComponent(props) {
|
|
|
4966
4846
|
onSelect
|
|
4967
4847
|
} = props;
|
|
4968
4848
|
const optionsWithIndex = zipWithIndex(options);
|
|
4969
|
-
const [query, setQuery] =
|
|
4849
|
+
const [query, setQuery] = useState13("");
|
|
4970
4850
|
const { formatMessage } = useIntl12();
|
|
4971
4851
|
const filtered = tags == null ? void 0 : tags.includes("filtered");
|
|
4972
4852
|
const filteredOptions = query ? filterAndSortItems(optionsWithIndex, filtered ? query : "") : optionsWithIndex;
|
|
@@ -5041,7 +4921,7 @@ function InlineComponent(props) {
|
|
|
5041
4921
|
|
|
5042
4922
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
5043
4923
|
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
5044
|
-
import { useState as
|
|
4924
|
+
import { useState as useState14 } from "react";
|
|
5045
4925
|
import { useIntl as useIntl13 } from "react-intl";
|
|
5046
4926
|
|
|
5047
4927
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
@@ -5058,7 +4938,7 @@ var multi_select_messages_default = defineMessages10({
|
|
|
5058
4938
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
5059
4939
|
function DefaultComponent(props) {
|
|
5060
4940
|
const { formatMessage } = useIntl13();
|
|
5061
|
-
const [stagedIndices, setStagedIndices] =
|
|
4941
|
+
const [stagedIndices, setStagedIndices] = useState14();
|
|
5062
4942
|
const {
|
|
5063
4943
|
id,
|
|
5064
4944
|
autoComplete,
|
|
@@ -5513,7 +5393,7 @@ var ProgressRenderer = {
|
|
|
5513
5393
|
var import_classnames26 = __toESM(require_classnames());
|
|
5514
5394
|
import { Button as Button8, Header as Header6, InlineAlert as InlineAlert3, Modal as Modal4, NavigationOption } from "@transferwise/components";
|
|
5515
5395
|
import { Plus } from "@transferwise/icons";
|
|
5516
|
-
import { useState as
|
|
5396
|
+
import { useState as useState15 } from "react";
|
|
5517
5397
|
import { useIntl as useIntl15 } from "react-intl";
|
|
5518
5398
|
|
|
5519
5399
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
@@ -5563,7 +5443,7 @@ function Repeatable(props) {
|
|
|
5563
5443
|
onRemove
|
|
5564
5444
|
} = props;
|
|
5565
5445
|
const { formatMessage } = useIntl15();
|
|
5566
|
-
const [openModalType, setOpenModalType] =
|
|
5446
|
+
const [openModalType, setOpenModalType] = useState15(null);
|
|
5567
5447
|
const { ref } = useScrollToError(validationState, features);
|
|
5568
5448
|
const onAddItem = () => {
|
|
5569
5449
|
onAdd();
|
|
@@ -5787,7 +5667,7 @@ var ReviewRenderer_default = ReviewRenderer2;
|
|
|
5787
5667
|
|
|
5788
5668
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
5789
5669
|
import { Input as Input5, InputGroup as InputGroup4, List, ListItem as ListItem11, Markdown as Markdown6 } from "@transferwise/components";
|
|
5790
|
-
import { useState as
|
|
5670
|
+
import { useState as useState16 } from "react";
|
|
5791
5671
|
import { useIntl as useIntl18 } from "react-intl";
|
|
5792
5672
|
|
|
5793
5673
|
// ../renderers/src/messages/search.messages.ts
|
|
@@ -5830,7 +5710,7 @@ function BlockSearchRendererComponent({
|
|
|
5830
5710
|
trackEvent,
|
|
5831
5711
|
onChange
|
|
5832
5712
|
}) {
|
|
5833
|
-
const [hasSearched, setHasSearched] =
|
|
5713
|
+
const [hasSearched, setHasSearched] = useState16(false);
|
|
5834
5714
|
const { formatMessage } = useIntl18();
|
|
5835
5715
|
return /* @__PURE__ */ jsxs24("div", { className: getMargin(margin), children: [
|
|
5836
5716
|
/* @__PURE__ */ jsx81(
|
|
@@ -5925,7 +5805,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
|
5925
5805
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
5926
5806
|
import { Markdown as Markdown7, Typeahead } from "@transferwise/components";
|
|
5927
5807
|
import { Search as Search3 } from "@transferwise/icons";
|
|
5928
|
-
import { useState as
|
|
5808
|
+
import { useState as useState17 } from "react";
|
|
5929
5809
|
import { useIntl as useIntl19 } from "react-intl";
|
|
5930
5810
|
import { jsx as jsx82 } from "react/jsx-runtime";
|
|
5931
5811
|
function InlineSearchRenderer({
|
|
@@ -5941,7 +5821,7 @@ function InlineSearchRenderer({
|
|
|
5941
5821
|
onChange,
|
|
5942
5822
|
trackEvent
|
|
5943
5823
|
}) {
|
|
5944
|
-
const [hasSearched, setHasSearched] =
|
|
5824
|
+
const [hasSearched, setHasSearched] = useState17(false);
|
|
5945
5825
|
const intl = useIntl19();
|
|
5946
5826
|
return /* @__PURE__ */ jsx82("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx82(
|
|
5947
5827
|
FieldInput_default,
|
|
@@ -6661,7 +6541,7 @@ function StepRendererComponent(props) {
|
|
|
6661
6541
|
// ../renderers/src/TabsRenderer.tsx
|
|
6662
6542
|
var import_classnames33 = __toESM(require_classnames());
|
|
6663
6543
|
import { Chips as Chips2, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
|
|
6664
|
-
import { useState as
|
|
6544
|
+
import { useState as useState18 } from "react";
|
|
6665
6545
|
import { jsx as jsx99, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
6666
6546
|
var TabsRenderer = {
|
|
6667
6547
|
canRenderType: "tabs",
|
|
@@ -6680,7 +6560,7 @@ var TabsRenderer = {
|
|
|
6680
6560
|
}
|
|
6681
6561
|
};
|
|
6682
6562
|
function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6683
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6563
|
+
const [selectedIndex, setSelectedIndex] = useState18(0);
|
|
6684
6564
|
return /* @__PURE__ */ jsx99("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: /* @__PURE__ */ jsx99(
|
|
6685
6565
|
Tabs2,
|
|
6686
6566
|
{
|
|
@@ -6701,7 +6581,7 @@ function TabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6701
6581
|
}
|
|
6702
6582
|
function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
6703
6583
|
var _a;
|
|
6704
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6584
|
+
const [selectedIndex, setSelectedIndex] = useState18(0);
|
|
6705
6585
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6706
6586
|
/* @__PURE__ */ jsx99(
|
|
6707
6587
|
SegmentedControl2,
|
|
@@ -6723,7 +6603,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs, control, tags }) {
|
|
|
6723
6603
|
}
|
|
6724
6604
|
function ChipsTabsRendererComponent({ margin, tabs, control, tags }) {
|
|
6725
6605
|
var _a;
|
|
6726
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6606
|
+
const [selectedIndex, setSelectedIndex] = useState18(0);
|
|
6727
6607
|
return /* @__PURE__ */ jsxs39("div", { className: (0, import_classnames33.default)(getMargin(margin), controlAndTagsToCSSClass({ control, tags })), children: [
|
|
6728
6608
|
/* @__PURE__ */ jsx99("div", { className: "chips-container", children: /* @__PURE__ */ jsx99(
|
|
6729
6609
|
Chips2,
|
|
@@ -6757,19 +6637,27 @@ var commonKeys = [
|
|
|
6757
6637
|
"disabled",
|
|
6758
6638
|
"displayFormat",
|
|
6759
6639
|
"id",
|
|
6640
|
+
"maxLength",
|
|
6641
|
+
"minLength",
|
|
6760
6642
|
"onBlur",
|
|
6761
6643
|
"onFocus",
|
|
6762
6644
|
"placeholder",
|
|
6645
|
+
"required",
|
|
6763
6646
|
"value"
|
|
6764
6647
|
];
|
|
6765
6648
|
function VariableTextInput(inputProps) {
|
|
6766
|
-
const { id, value, control, onChange } = inputProps;
|
|
6649
|
+
const { id, value, control, displayFormat, onChange } = inputProps;
|
|
6767
6650
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
6651
|
+
if (control === "ssn-input" || (displayFormat == null ? void 0 : displayFormat.includes("*"))) {
|
|
6652
|
+
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6653
|
+
}
|
|
6768
6654
|
switch (control) {
|
|
6769
6655
|
case "email":
|
|
6770
6656
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
6771
6657
|
case "password":
|
|
6772
6658
|
return /* @__PURE__ */ jsx100(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
6659
|
+
case "ssn-input":
|
|
6660
|
+
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6773
6661
|
case "numeric": {
|
|
6774
6662
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
6775
6663
|
return /* @__PURE__ */ jsx100(
|
|
@@ -6790,10 +6678,65 @@ function VariableTextInput(inputProps) {
|
|
|
6790
6678
|
}
|
|
6791
6679
|
}
|
|
6792
6680
|
function TextInput(props) {
|
|
6793
|
-
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
6681
|
+
const _a = props, { control, displayFormat, onChange, type } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange", "type"]);
|
|
6794
6682
|
const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
|
|
6795
6683
|
const InputWithoutPattern = control === "textarea" ? TextArea : Input6;
|
|
6796
|
-
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
6684
|
+
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { type, onChange: (e) => onChange(e.target.value) }));
|
|
6685
|
+
}
|
|
6686
|
+
function SsnInput(props) {
|
|
6687
|
+
const _a = props, {
|
|
6688
|
+
displayFormat = "",
|
|
6689
|
+
maxLength,
|
|
6690
|
+
minLength: _minLength,
|
|
6691
|
+
onChange,
|
|
6692
|
+
type: _type,
|
|
6693
|
+
value = ""
|
|
6694
|
+
} = _a, commonProps = __objRest(_a, [
|
|
6695
|
+
"displayFormat",
|
|
6696
|
+
"maxLength",
|
|
6697
|
+
"minLength",
|
|
6698
|
+
"onChange",
|
|
6699
|
+
"type",
|
|
6700
|
+
"value"
|
|
6701
|
+
]);
|
|
6702
|
+
const maxDigits = displayFormat.split("").filter((character) => character === "*").length || maxLength || Infinity;
|
|
6703
|
+
const maskedValue = displayFormat ? displayFormat.split("").reduce(
|
|
6704
|
+
({ display, digitsUsed }, character) => {
|
|
6705
|
+
if (character === "*") {
|
|
6706
|
+
return digitsUsed < value.length ? { display: `${display}\u2022`, digitsUsed: digitsUsed + 1 } : { display, digitsUsed };
|
|
6707
|
+
}
|
|
6708
|
+
return digitsUsed > 0 && digitsUsed < value.length ? { display: `${display}${character}`, digitsUsed } : { display, digitsUsed };
|
|
6709
|
+
},
|
|
6710
|
+
{ display: "", digitsUsed: 0 }
|
|
6711
|
+
).display : "\u2022".repeat(value.length);
|
|
6712
|
+
return /* @__PURE__ */ jsx100(
|
|
6713
|
+
"input",
|
|
6714
|
+
__spreadProps(__spreadValues({}, commonProps), {
|
|
6715
|
+
className: "form-control np-form-control np-form-control--size-auto np-input np-input--shape-rectangle",
|
|
6716
|
+
type: "text",
|
|
6717
|
+
inputMode: "numeric",
|
|
6718
|
+
maxLength: displayFormat.length || maxLength,
|
|
6719
|
+
value: maskedValue,
|
|
6720
|
+
onChange: () => void 0,
|
|
6721
|
+
onKeyDown: (event) => {
|
|
6722
|
+
const rawValue = value.replace(/[^0-9]/g, "");
|
|
6723
|
+
if (/^[0-9]$/.test(event.key)) {
|
|
6724
|
+
event.preventDefault();
|
|
6725
|
+
if (rawValue.length < maxDigits) {
|
|
6726
|
+
onChange(`${rawValue}${event.key}`);
|
|
6727
|
+
}
|
|
6728
|
+
} else if (event.key === "Backspace") {
|
|
6729
|
+
event.preventDefault();
|
|
6730
|
+
onChange(rawValue.slice(0, -1));
|
|
6731
|
+
}
|
|
6732
|
+
},
|
|
6733
|
+
onPaste: (event) => {
|
|
6734
|
+
event.preventDefault();
|
|
6735
|
+
const pastedValue = event.clipboardData.getData("text").replace(/[^0-9]/g, "");
|
|
6736
|
+
onChange(`${value}${pastedValue}`.replace(/[^0-9]/g, "").slice(0, maxDigits));
|
|
6737
|
+
}
|
|
6738
|
+
})
|
|
6739
|
+
);
|
|
6797
6740
|
}
|
|
6798
6741
|
|
|
6799
6742
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -7005,7 +6948,7 @@ var LargeUploadRenderer = {
|
|
|
7005
6948
|
// ../renderers/src/UpsellRenderer.tsx
|
|
7006
6949
|
var import_classnames35 = __toESM(require_classnames());
|
|
7007
6950
|
import { Nudge } from "@transferwise/components";
|
|
7008
|
-
import { useState as
|
|
6951
|
+
import { useState as useState19 } from "react";
|
|
7009
6952
|
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
7010
6953
|
var UpsellRenderer = {
|
|
7011
6954
|
canRenderType: "upsell",
|
|
@@ -7013,7 +6956,7 @@ var UpsellRenderer = {
|
|
|
7013
6956
|
};
|
|
7014
6957
|
function UpsellRendererComponent(props) {
|
|
7015
6958
|
const { text, callToAction, media, margin, onDismiss, control, tags } = props;
|
|
7016
|
-
const [isVisible, setIsVisible] =
|
|
6959
|
+
const [isVisible, setIsVisible] = useState19(true);
|
|
7017
6960
|
return isVisible ? /* @__PURE__ */ jsx104(
|
|
7018
6961
|
Nudge,
|
|
7019
6962
|
{
|