@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.css
CHANGED
|
@@ -387,31 +387,6 @@
|
|
|
387
387
|
.df-prefer-container-queries {
|
|
388
388
|
container-type: inline-size;
|
|
389
389
|
}
|
|
390
|
-
|
|
391
|
-
.df-ssn-input-wrapper {
|
|
392
|
-
position: relative;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
.df-ssn-input {
|
|
396
|
-
padding-right: 3.5rem;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
.df-ssn-input-toggle {
|
|
400
|
-
align-items: center;
|
|
401
|
-
background: transparent;
|
|
402
|
-
border: 0;
|
|
403
|
-
color: inherit;
|
|
404
|
-
cursor: pointer;
|
|
405
|
-
display: flex;
|
|
406
|
-
height: 100%;
|
|
407
|
-
justify-content: center;
|
|
408
|
-
padding: 0;
|
|
409
|
-
position: absolute;
|
|
410
|
-
right: 0;
|
|
411
|
-
top: 0;
|
|
412
|
-
width: 3.5rem;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
390
|
.df-context-menu {
|
|
416
391
|
position: fixed;
|
|
417
392
|
z-index: 10;
|
package/build/main.js
CHANGED
|
@@ -146,7 +146,7 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
|
146
146
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
147
147
|
var appVersion = (
|
|
148
148
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
149
|
-
typeof process !== "undefined" ? "5.
|
|
149
|
+
typeof process !== "undefined" ? "5.30.0" : "0.0.0"
|
|
150
150
|
);
|
|
151
151
|
|
|
152
152
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
@@ -336,7 +336,7 @@ var recursivelyRemoveNullish = (element) => {
|
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
339
|
-
var
|
|
339
|
+
var import_react30 = require("react");
|
|
340
340
|
|
|
341
341
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
342
342
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
@@ -626,11 +626,16 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
|
|
|
626
626
|
// ../renderers/src/components/Media/Media.tsx
|
|
627
627
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
628
628
|
var Media = ({ media, preferAvatar = false, size }) => {
|
|
629
|
+
var _a, _b;
|
|
629
630
|
switch (media == null ? void 0 : media.type) {
|
|
630
631
|
case "avatar":
|
|
631
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
|
|
632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size: (_a = media.size && mediaSizeTokenMappings[media.size]) != null ? _a : size }));
|
|
632
633
|
case "image": {
|
|
633
|
-
const { asset, icon } = resolveMediaFromUri(
|
|
634
|
+
const { asset, icon } = resolveMediaFromUri(
|
|
635
|
+
media.uri,
|
|
636
|
+
(_b = media.size && mediaSizeTokenMappings[media.size]) != null ? _b : size,
|
|
637
|
+
media.accessibilityDescription
|
|
638
|
+
);
|
|
634
639
|
return icon != null ? icon : asset;
|
|
635
640
|
}
|
|
636
641
|
case "legacy": {
|
|
@@ -669,6 +674,13 @@ function extractFirstImageFromAvatar(avatar) {
|
|
|
669
674
|
accessibilityDescription: avatar.accessibilityDescription
|
|
670
675
|
};
|
|
671
676
|
}
|
|
677
|
+
var mediaSizeTokenMappings = {
|
|
678
|
+
xs: 24,
|
|
679
|
+
sm: 32,
|
|
680
|
+
md: 48,
|
|
681
|
+
lg: 56,
|
|
682
|
+
xl: 72
|
|
683
|
+
};
|
|
672
684
|
|
|
673
685
|
// ../renderers/src/components/Media/OptionMedia.tsx
|
|
674
686
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
@@ -1808,6 +1820,10 @@ var isIOSWebKit = () => {
|
|
|
1808
1820
|
const mtp = navigator.maxTouchPoints;
|
|
1809
1821
|
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
1810
1822
|
};
|
|
1823
|
+
var getRect = (element) => {
|
|
1824
|
+
const { offsetWidth, offsetHeight } = element;
|
|
1825
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
1826
|
+
};
|
|
1811
1827
|
var defaultKeyExtractor = (index) => index;
|
|
1812
1828
|
var defaultRangeExtractor = (range) => {
|
|
1813
1829
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -1819,6 +1835,43 @@ var defaultRangeExtractor = (range) => {
|
|
|
1819
1835
|
}
|
|
1820
1836
|
return arr;
|
|
1821
1837
|
};
|
|
1838
|
+
var observeElementRect = (instance, cb) => {
|
|
1839
|
+
const element = instance.scrollElement;
|
|
1840
|
+
if (!element) {
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
const targetWindow = instance.targetWindow;
|
|
1844
|
+
if (!targetWindow) {
|
|
1845
|
+
return;
|
|
1846
|
+
}
|
|
1847
|
+
const handler = (rect) => {
|
|
1848
|
+
const { width, height } = rect;
|
|
1849
|
+
cb({ width: Math.round(width), height: Math.round(height) });
|
|
1850
|
+
};
|
|
1851
|
+
handler(getRect(element));
|
|
1852
|
+
if (!targetWindow.ResizeObserver) {
|
|
1853
|
+
return () => {
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
1857
|
+
const run = () => {
|
|
1858
|
+
const entry = entries[0];
|
|
1859
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1860
|
+
const box = entry.borderBoxSize[0];
|
|
1861
|
+
if (box) {
|
|
1862
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
handler(getRect(element));
|
|
1867
|
+
};
|
|
1868
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1869
|
+
});
|
|
1870
|
+
observer.observe(element, { box: "border-box" });
|
|
1871
|
+
return () => {
|
|
1872
|
+
observer.unobserve(element);
|
|
1873
|
+
};
|
|
1874
|
+
};
|
|
1822
1875
|
var addEventListenerOptions = {
|
|
1823
1876
|
passive: true
|
|
1824
1877
|
};
|
|
@@ -1872,6 +1925,10 @@ var observeOffset = (instance, cb, readOffset) => {
|
|
|
1872
1925
|
fallback == null ? void 0 : fallback.cancel();
|
|
1873
1926
|
};
|
|
1874
1927
|
};
|
|
1928
|
+
var observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
1929
|
+
const { horizontal, isRtl } = instance.options;
|
|
1930
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
1931
|
+
});
|
|
1875
1932
|
var observeWindowOffset = (instance, cb) => observeOffset(
|
|
1876
1933
|
instance,
|
|
1877
1934
|
cb,
|
|
@@ -1914,6 +1971,7 @@ var scrollWithAdjustments = (offset, {
|
|
|
1914
1971
|
});
|
|
1915
1972
|
};
|
|
1916
1973
|
var windowScroll = scrollWithAdjustments;
|
|
1974
|
+
var elementScroll = scrollWithAdjustments;
|
|
1917
1975
|
var Virtualizer = class {
|
|
1918
1976
|
constructor(opts) {
|
|
1919
1977
|
this.unsubs = [];
|
|
@@ -3156,6 +3214,13 @@ function useVirtualizerBase(_a) {
|
|
|
3156
3214
|
});
|
|
3157
3215
|
return instance;
|
|
3158
3216
|
}
|
|
3217
|
+
function useVirtualizer(options) {
|
|
3218
|
+
return useVirtualizerBase(__spreadValues({
|
|
3219
|
+
observeElementRect,
|
|
3220
|
+
observeElementOffset,
|
|
3221
|
+
scrollToFn: elementScroll
|
|
3222
|
+
}, options));
|
|
3223
|
+
}
|
|
3159
3224
|
function useWindowVirtualizer(options) {
|
|
3160
3225
|
return useVirtualizerBase(__spreadValues({
|
|
3161
3226
|
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
@@ -3228,7 +3293,7 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3228
3293
|
] })
|
|
3229
3294
|
] });
|
|
3230
3295
|
};
|
|
3231
|
-
var useIsElementVisible = (elementRef) => {
|
|
3296
|
+
var useIsElementVisible = (elementRef, root = null) => {
|
|
3232
3297
|
const [isVisible, setIsVisible] = (0, import_react8.useState)(false);
|
|
3233
3298
|
(0, import_react8.useEffect)(() => {
|
|
3234
3299
|
const element = elementRef.current;
|
|
@@ -3237,11 +3302,11 @@ var useIsElementVisible = (elementRef) => {
|
|
|
3237
3302
|
([entry]) => {
|
|
3238
3303
|
setIsVisible(entry.isIntersecting);
|
|
3239
3304
|
},
|
|
3240
|
-
{ rootMargin: "1px" }
|
|
3305
|
+
{ root, rootMargin: "1px" }
|
|
3241
3306
|
);
|
|
3242
3307
|
observer.observe(element);
|
|
3243
3308
|
return () => observer.disconnect();
|
|
3244
|
-
}, [elementRef]);
|
|
3309
|
+
}, [elementRef, root]);
|
|
3245
3310
|
return isVisible;
|
|
3246
3311
|
};
|
|
3247
3312
|
|
|
@@ -3263,12 +3328,40 @@ var collection_messages_default = (0, import_react_intl8.defineMessages)({
|
|
|
3263
3328
|
}
|
|
3264
3329
|
});
|
|
3265
3330
|
|
|
3331
|
+
// ../renderers/src/CollectionRenderer/components/getScrollableAncestor.ts
|
|
3332
|
+
var SCROLLABLE_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["auto", "overlay", "scroll"]);
|
|
3333
|
+
var getScrollableAncestor = (element) => {
|
|
3334
|
+
var _a;
|
|
3335
|
+
const view = element == null ? void 0 : element.ownerDocument.defaultView;
|
|
3336
|
+
let ancestor = (_a = element == null ? void 0 : element.parentElement) != null ? _a : null;
|
|
3337
|
+
if (!view) {
|
|
3338
|
+
return null;
|
|
3339
|
+
}
|
|
3340
|
+
while (ancestor) {
|
|
3341
|
+
const { overflowY } = view.getComputedStyle(ancestor);
|
|
3342
|
+
const hasScrollableOverflow = SCROLLABLE_OVERFLOW_VALUES.has(overflowY);
|
|
3343
|
+
if (hasScrollableOverflow && ancestor.scrollHeight > ancestor.clientHeight) {
|
|
3344
|
+
return ancestor;
|
|
3345
|
+
}
|
|
3346
|
+
ancestor = ancestor.parentElement;
|
|
3347
|
+
}
|
|
3348
|
+
return null;
|
|
3349
|
+
};
|
|
3350
|
+
|
|
3266
3351
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3267
3352
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3268
3353
|
var ContentComponent = (props) => {
|
|
3269
3354
|
const { state, status, SectionHeader, Item } = props;
|
|
3355
|
+
const contentRef = (0, import_react9.useRef)(null);
|
|
3356
|
+
const [scrollElement, setScrollElement] = (0, import_react9.useState)(null);
|
|
3357
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
3358
|
+
const nextScrollElement = getScrollableAncestor(contentRef.current);
|
|
3359
|
+
setScrollElement(
|
|
3360
|
+
(currentScrollElement) => currentScrollElement === nextScrollElement ? currentScrollElement : nextScrollElement
|
|
3361
|
+
);
|
|
3362
|
+
}, []);
|
|
3270
3363
|
const endOfContentRef = (0, import_react9.useRef)(null);
|
|
3271
|
-
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
3364
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef, scrollElement);
|
|
3272
3365
|
(0, import_react9.useEffect)(() => {
|
|
3273
3366
|
const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
|
|
3274
3367
|
if (shouldAutoLoad && status.loadMore) {
|
|
@@ -3300,51 +3393,90 @@ var ContentComponent = (props) => {
|
|
|
3300
3393
|
var _a, _b;
|
|
3301
3394
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
3302
3395
|
});
|
|
3303
|
-
|
|
3304
|
-
count: stateCount,
|
|
3305
|
-
estimateSize: () => 120,
|
|
3306
|
-
overscan: 10,
|
|
3307
|
-
// eslint-disable-next-line react-hooks/refs
|
|
3308
|
-
scrollMargin: listOffsetRef.current
|
|
3309
|
-
});
|
|
3310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ref: listRef, children: [
|
|
3396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ref: contentRef, children: [
|
|
3311
3397
|
state.beforeSections,
|
|
3312
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3313
|
-
|
|
3398
|
+
scrollElement ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3399
|
+
ElementVirtualizedItems,
|
|
3314
3400
|
{
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
ref: virtualizer.measureElement,
|
|
3329
|
-
"data-index": item.index,
|
|
3330
|
-
style: {
|
|
3331
|
-
position: "absolute",
|
|
3332
|
-
top: 0,
|
|
3333
|
-
left: 0,
|
|
3334
|
-
width: "100%",
|
|
3335
|
-
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3336
|
-
},
|
|
3337
|
-
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Item, __spreadValues({}, i.item))
|
|
3338
|
-
},
|
|
3339
|
-
item.key
|
|
3340
|
-
);
|
|
3341
|
-
})
|
|
3401
|
+
Item,
|
|
3402
|
+
SectionHeader,
|
|
3403
|
+
items,
|
|
3404
|
+
scrollElement,
|
|
3405
|
+
stateCount
|
|
3406
|
+
}
|
|
3407
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3408
|
+
WindowVirtualizedItems,
|
|
3409
|
+
{
|
|
3410
|
+
Item,
|
|
3411
|
+
SectionHeader,
|
|
3412
|
+
items,
|
|
3413
|
+
stateCount
|
|
3342
3414
|
}
|
|
3343
3415
|
),
|
|
3344
3416
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PaginationComponent, { status, state }) }),
|
|
3345
3417
|
state.afterSections
|
|
3346
3418
|
] });
|
|
3347
3419
|
};
|
|
3420
|
+
var WindowVirtualizedItems = (props) => {
|
|
3421
|
+
const { stateCount } = props;
|
|
3422
|
+
const virtualItemsRef = (0, import_react9.useRef)(null);
|
|
3423
|
+
const virtualizer = useWindowVirtualizer({
|
|
3424
|
+
count: stateCount,
|
|
3425
|
+
estimateSize: () => 120,
|
|
3426
|
+
overscan: 10
|
|
3427
|
+
});
|
|
3428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3429
|
+
};
|
|
3430
|
+
var ElementVirtualizedItems = (props) => {
|
|
3431
|
+
const { scrollElement, stateCount } = props;
|
|
3432
|
+
const virtualItemsRef = (0, import_react9.useRef)(null);
|
|
3433
|
+
const virtualizer = useVirtualizer({
|
|
3434
|
+
count: stateCount,
|
|
3435
|
+
getScrollElement: () => scrollElement,
|
|
3436
|
+
estimateSize: () => 120,
|
|
3437
|
+
overscan: 10
|
|
3438
|
+
});
|
|
3439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3440
|
+
};
|
|
3441
|
+
var VirtualizedItems = ({
|
|
3442
|
+
Item,
|
|
3443
|
+
SectionHeader,
|
|
3444
|
+
items,
|
|
3445
|
+
virtualItemsRef,
|
|
3446
|
+
virtualizer
|
|
3447
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3448
|
+
"div",
|
|
3449
|
+
{
|
|
3450
|
+
ref: virtualItemsRef,
|
|
3451
|
+
style: {
|
|
3452
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
3453
|
+
width: "100%",
|
|
3454
|
+
position: "relative"
|
|
3455
|
+
},
|
|
3456
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
3457
|
+
const i = items[item.index];
|
|
3458
|
+
if (!i) {
|
|
3459
|
+
return null;
|
|
3460
|
+
}
|
|
3461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3462
|
+
"div",
|
|
3463
|
+
{
|
|
3464
|
+
ref: virtualizer.measureElement,
|
|
3465
|
+
"data-index": item.index,
|
|
3466
|
+
style: {
|
|
3467
|
+
position: "absolute",
|
|
3468
|
+
top: 0,
|
|
3469
|
+
left: 0,
|
|
3470
|
+
width: "100%",
|
|
3471
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3472
|
+
},
|
|
3473
|
+
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Item, __spreadValues({}, i.item))
|
|
3474
|
+
},
|
|
3475
|
+
item.key
|
|
3476
|
+
);
|
|
3477
|
+
})
|
|
3478
|
+
}
|
|
3479
|
+
);
|
|
3348
3480
|
var PaginationComponent = ({
|
|
3349
3481
|
status,
|
|
3350
3482
|
state
|
|
@@ -4654,11 +4786,28 @@ var AvatarMediaRendererComponent = ({
|
|
|
4654
4786
|
};
|
|
4655
4787
|
var ImageMediaRendererComponent = (_a) => {
|
|
4656
4788
|
var _b = _a, {
|
|
4657
|
-
media
|
|
4789
|
+
media,
|
|
4790
|
+
size
|
|
4658
4791
|
} = _b, rest = __objRest(_b, [
|
|
4659
|
-
"media"
|
|
4792
|
+
"media",
|
|
4793
|
+
"size"
|
|
4660
4794
|
]);
|
|
4661
|
-
|
|
4795
|
+
var _a2, _b2;
|
|
4796
|
+
return isUrnImage(media.uri) ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4797
|
+
UrnImage,
|
|
4798
|
+
__spreadValues({
|
|
4799
|
+
uri: media.uri,
|
|
4800
|
+
size: (_a2 = media.size) != null ? _a2 : size,
|
|
4801
|
+
accessibilityDescription: media.accessibilityDescription
|
|
4802
|
+
}, rest)
|
|
4803
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
4804
|
+
UrlImage,
|
|
4805
|
+
__spreadValues({
|
|
4806
|
+
uri: media.uri,
|
|
4807
|
+
size: (_b2 = media.size) != null ? _b2 : size,
|
|
4808
|
+
accessibilityDescription: media.accessibilityDescription
|
|
4809
|
+
}, rest)
|
|
4810
|
+
);
|
|
4662
4811
|
};
|
|
4663
4812
|
var mapAvatarMediaSize = (size) => {
|
|
4664
4813
|
switch (size) {
|
|
@@ -6633,8 +6782,6 @@ var import_components69 = require("@transferwise/components");
|
|
|
6633
6782
|
|
|
6634
6783
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
6635
6784
|
var import_components68 = require("@transferwise/components");
|
|
6636
|
-
var import_icons7 = require("@transferwise/icons");
|
|
6637
|
-
var import_react27 = require("react");
|
|
6638
6785
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
6639
6786
|
var commonKeys = [
|
|
6640
6787
|
"autoComplete",
|
|
@@ -6650,18 +6797,13 @@ var commonKeys = [
|
|
|
6650
6797
|
"value"
|
|
6651
6798
|
];
|
|
6652
6799
|
function VariableTextInput(inputProps) {
|
|
6653
|
-
const { id, value, control,
|
|
6800
|
+
const { id, value, control, onChange } = inputProps;
|
|
6654
6801
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
6655
|
-
if (control === "ssn-input" || (displayFormat == null ? void 0 : displayFormat.includes("*"))) {
|
|
6656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SsnInput, __spreadProps(__spreadValues({}, commonProps), { maxLength: inputProps.maxLength, onChange }));
|
|
6657
|
-
}
|
|
6658
6802
|
switch (control) {
|
|
6659
6803
|
case "email":
|
|
6660
6804
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
6661
6805
|
case "password":
|
|
6662
6806
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
6663
|
-
case "ssn-input":
|
|
6664
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6665
6807
|
case "numeric": {
|
|
6666
6808
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
6667
6809
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -6682,79 +6824,10 @@ function VariableTextInput(inputProps) {
|
|
|
6682
6824
|
}
|
|
6683
6825
|
}
|
|
6684
6826
|
function TextInput(props) {
|
|
6685
|
-
const _a = props, { control, displayFormat, onChange
|
|
6827
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
6686
6828
|
const InputWithPattern = control === "textarea" ? import_components68.TextareaWithDisplayFormat : import_components68.InputWithDisplayFormat;
|
|
6687
6829
|
const InputWithoutPattern = control === "textarea" ? import_components68.TextArea : import_components68.Input;
|
|
6688
|
-
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), {
|
|
6689
|
-
}
|
|
6690
|
-
function SsnInput(props) {
|
|
6691
|
-
const _a = props, {
|
|
6692
|
-
displayFormat = "",
|
|
6693
|
-
maxLength,
|
|
6694
|
-
onChange,
|
|
6695
|
-
type: _type,
|
|
6696
|
-
value = ""
|
|
6697
|
-
} = _a, commonProps = __objRest(_a, [
|
|
6698
|
-
"displayFormat",
|
|
6699
|
-
"maxLength",
|
|
6700
|
-
"onChange",
|
|
6701
|
-
"type",
|
|
6702
|
-
"value"
|
|
6703
|
-
]);
|
|
6704
|
-
const [isVisible, setIsVisible] = (0, import_react27.useState)(false);
|
|
6705
|
-
const maxDigits = displayFormat.split("").filter((character) => character === "*").length || maxLength || Infinity;
|
|
6706
|
-
const formattedValue = displayFormat ? displayFormat.split("").reduce(
|
|
6707
|
-
({ display, digitsUsed }, character) => {
|
|
6708
|
-
if (character === "*") {
|
|
6709
|
-
return digitsUsed < value.length ? {
|
|
6710
|
-
display: `${display}${isVisible ? value[digitsUsed] : "\u2022"}`,
|
|
6711
|
-
digitsUsed: digitsUsed + 1
|
|
6712
|
-
} : { display, digitsUsed };
|
|
6713
|
-
}
|
|
6714
|
-
return digitsUsed > 0 && digitsUsed < value.length ? { display: `${display}${character}`, digitsUsed } : { display, digitsUsed };
|
|
6715
|
-
},
|
|
6716
|
-
{ display: "", digitsUsed: 0 }
|
|
6717
|
-
).display : isVisible ? value : "\u2022".repeat(value.length);
|
|
6718
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "df-ssn-input-wrapper", children: [
|
|
6719
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
6720
|
-
"input",
|
|
6721
|
-
__spreadProps(__spreadValues({}, commonProps), {
|
|
6722
|
-
className: "form-control np-form-control np-input np-input--shape-rectangle df-ssn-input",
|
|
6723
|
-
type: "text",
|
|
6724
|
-
inputMode: "numeric",
|
|
6725
|
-
maxLength: displayFormat.length || maxLength,
|
|
6726
|
-
value: formattedValue,
|
|
6727
|
-
onChange: () => void 0,
|
|
6728
|
-
onKeyDown: (event) => {
|
|
6729
|
-
const rawValue = value.replace(/\D/g, "");
|
|
6730
|
-
if (/^\d$/.test(event.key)) {
|
|
6731
|
-
event.preventDefault();
|
|
6732
|
-
if (rawValue.length < maxDigits) {
|
|
6733
|
-
onChange(`${rawValue}${event.key}`);
|
|
6734
|
-
}
|
|
6735
|
-
} else if (event.key === "Backspace") {
|
|
6736
|
-
event.preventDefault();
|
|
6737
|
-
onChange(rawValue.slice(0, -1));
|
|
6738
|
-
}
|
|
6739
|
-
},
|
|
6740
|
-
onPaste: (event) => {
|
|
6741
|
-
event.preventDefault();
|
|
6742
|
-
const pastedValue = event.clipboardData.getData("text").replace(/\D/g, "");
|
|
6743
|
-
onChange(`${value}${pastedValue}`.replace(/\D/g, "").slice(0, maxDigits));
|
|
6744
|
-
}
|
|
6745
|
-
})
|
|
6746
|
-
),
|
|
6747
|
-
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
6748
|
-
"button",
|
|
6749
|
-
{
|
|
6750
|
-
type: "button",
|
|
6751
|
-
className: "df-ssn-input-toggle",
|
|
6752
|
-
"aria-label": isVisible ? "Hide value" : "Show value",
|
|
6753
|
-
onClick: () => setIsVisible((visible) => !visible),
|
|
6754
|
-
children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_icons7.EyeShut, { size: 24 }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(import_icons7.Eye, { size: 24 })
|
|
6755
|
-
}
|
|
6756
|
-
)
|
|
6757
|
-
] });
|
|
6830
|
+
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
6758
6831
|
}
|
|
6759
6832
|
|
|
6760
6833
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -6966,7 +7039,7 @@ var LargeUploadRenderer = {
|
|
|
6966
7039
|
// ../renderers/src/UpsellRenderer.tsx
|
|
6967
7040
|
var import_components71 = require("@transferwise/components");
|
|
6968
7041
|
var import_classnames35 = __toESM(require_classnames());
|
|
6969
|
-
var
|
|
7042
|
+
var import_react27 = require("react");
|
|
6970
7043
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
6971
7044
|
var UpsellRenderer = {
|
|
6972
7045
|
canRenderType: "upsell",
|
|
@@ -6974,7 +7047,7 @@ var UpsellRenderer = {
|
|
|
6974
7047
|
};
|
|
6975
7048
|
function UpsellRendererComponent(props) {
|
|
6976
7049
|
const { text, callToAction, media, margin, onDismiss, control, tags } = props;
|
|
6977
|
-
const [isVisible, setIsVisible] = (0,
|
|
7050
|
+
const [isVisible, setIsVisible] = (0, import_react27.useState)(true);
|
|
6978
7051
|
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
6979
7052
|
import_components71.Nudge,
|
|
6980
7053
|
{
|
|
@@ -7203,7 +7276,7 @@ var customEventsToAnalytics = {
|
|
|
7203
7276
|
};
|
|
7204
7277
|
|
|
7205
7278
|
// src/dynamicFlow/useOnCopy.tsx
|
|
7206
|
-
var
|
|
7279
|
+
var import_react28 = require("react");
|
|
7207
7280
|
var import_react_intl36 = require("react-intl");
|
|
7208
7281
|
|
|
7209
7282
|
// src/dynamicFlow/messages.ts
|
|
@@ -7225,7 +7298,7 @@ var messages_default = (0, import_react_intl35.defineMessages)({
|
|
|
7225
7298
|
var useOnCopy = () => {
|
|
7226
7299
|
const { formatMessage } = (0, import_react_intl36.useIntl)();
|
|
7227
7300
|
const createSnackBar = useSnackBarIfAvailable();
|
|
7228
|
-
return (0,
|
|
7301
|
+
return (0, import_react28.useCallback)(
|
|
7229
7302
|
(copiedContent) => {
|
|
7230
7303
|
if (copiedContent) {
|
|
7231
7304
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -7238,11 +7311,11 @@ var useOnCopy = () => {
|
|
|
7238
7311
|
};
|
|
7239
7312
|
|
|
7240
7313
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
7241
|
-
var
|
|
7314
|
+
var import_react29 = require("react");
|
|
7242
7315
|
var import_react_intl37 = require("react-intl");
|
|
7243
7316
|
var useWiseHttpClient = (httpClient) => {
|
|
7244
7317
|
const { locale } = (0, import_react_intl37.useIntl)();
|
|
7245
|
-
return (0,
|
|
7318
|
+
return (0, import_react29.useCallback)(
|
|
7246
7319
|
async (input, init = {}) => {
|
|
7247
7320
|
const headers = new Headers(init.headers);
|
|
7248
7321
|
headers.set("accept-language", locale);
|
|
@@ -7283,10 +7356,10 @@ var useWiseToCoreProps = (props) => {
|
|
|
7283
7356
|
onLog
|
|
7284
7357
|
} = props;
|
|
7285
7358
|
const httpClient = useWiseHttpClient(customFetch);
|
|
7286
|
-
const mergedRenderers = (0,
|
|
7359
|
+
const mergedRenderers = (0, import_react30.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
7287
7360
|
const createSnackBar = useCreateSnackBar();
|
|
7288
|
-
const logEvent = (0,
|
|
7289
|
-
const trackEvent = (0,
|
|
7361
|
+
const logEvent = (0, import_react30.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
7362
|
+
const trackEvent = (0, import_react30.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
7290
7363
|
const onCopy = useOnCopy();
|
|
7291
7364
|
return __spreadProps(__spreadValues({}, props), {
|
|
7292
7365
|
httpClient,
|
|
@@ -7334,14 +7407,14 @@ function DynamicFlow(props) {
|
|
|
7334
7407
|
}
|
|
7335
7408
|
|
|
7336
7409
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
7337
|
-
var
|
|
7410
|
+
var import_react31 = require("react");
|
|
7338
7411
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
7339
7412
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
7340
|
-
var DynamicFlowWithRef = (0,
|
|
7413
|
+
var DynamicFlowWithRef = (0, import_react31.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
7341
7414
|
const { className = "" } = props;
|
|
7342
7415
|
const dfProps = useWiseToCoreProps(props);
|
|
7343
7416
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
7344
|
-
(0,
|
|
7417
|
+
(0, import_react31.useImperativeHandle)(
|
|
7345
7418
|
ref,
|
|
7346
7419
|
() => ({
|
|
7347
7420
|
getValue: () => {
|