@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.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.29.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");
|
|
@@ -1808,6 +1808,10 @@ var isIOSWebKit = () => {
|
|
|
1808
1808
|
const mtp = navigator.maxTouchPoints;
|
|
1809
1809
|
return _isIOSResult = navigator.platform === "MacIntel" && mtp !== void 0 && mtp > 0;
|
|
1810
1810
|
};
|
|
1811
|
+
var getRect = (element) => {
|
|
1812
|
+
const { offsetWidth, offsetHeight } = element;
|
|
1813
|
+
return { width: offsetWidth, height: offsetHeight };
|
|
1814
|
+
};
|
|
1811
1815
|
var defaultKeyExtractor = (index) => index;
|
|
1812
1816
|
var defaultRangeExtractor = (range) => {
|
|
1813
1817
|
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
@@ -1819,6 +1823,43 @@ var defaultRangeExtractor = (range) => {
|
|
|
1819
1823
|
}
|
|
1820
1824
|
return arr;
|
|
1821
1825
|
};
|
|
1826
|
+
var observeElementRect = (instance, cb) => {
|
|
1827
|
+
const element = instance.scrollElement;
|
|
1828
|
+
if (!element) {
|
|
1829
|
+
return;
|
|
1830
|
+
}
|
|
1831
|
+
const targetWindow = instance.targetWindow;
|
|
1832
|
+
if (!targetWindow) {
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1835
|
+
const handler = (rect) => {
|
|
1836
|
+
const { width, height } = rect;
|
|
1837
|
+
cb({ width: Math.round(width), height: Math.round(height) });
|
|
1838
|
+
};
|
|
1839
|
+
handler(getRect(element));
|
|
1840
|
+
if (!targetWindow.ResizeObserver) {
|
|
1841
|
+
return () => {
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
1845
|
+
const run = () => {
|
|
1846
|
+
const entry = entries[0];
|
|
1847
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1848
|
+
const box = entry.borderBoxSize[0];
|
|
1849
|
+
if (box) {
|
|
1850
|
+
handler({ width: box.inlineSize, height: box.blockSize });
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
handler(getRect(element));
|
|
1855
|
+
};
|
|
1856
|
+
instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1857
|
+
});
|
|
1858
|
+
observer.observe(element, { box: "border-box" });
|
|
1859
|
+
return () => {
|
|
1860
|
+
observer.unobserve(element);
|
|
1861
|
+
};
|
|
1862
|
+
};
|
|
1822
1863
|
var addEventListenerOptions = {
|
|
1823
1864
|
passive: true
|
|
1824
1865
|
};
|
|
@@ -1872,6 +1913,10 @@ var observeOffset = (instance, cb, readOffset) => {
|
|
|
1872
1913
|
fallback == null ? void 0 : fallback.cancel();
|
|
1873
1914
|
};
|
|
1874
1915
|
};
|
|
1916
|
+
var observeElementOffset = (instance, cb) => observeOffset(instance, cb, (el) => {
|
|
1917
|
+
const { horizontal, isRtl } = instance.options;
|
|
1918
|
+
return horizontal ? el.scrollLeft * (isRtl && -1 || 1) : el.scrollTop;
|
|
1919
|
+
});
|
|
1875
1920
|
var observeWindowOffset = (instance, cb) => observeOffset(
|
|
1876
1921
|
instance,
|
|
1877
1922
|
cb,
|
|
@@ -1914,6 +1959,7 @@ var scrollWithAdjustments = (offset, {
|
|
|
1914
1959
|
});
|
|
1915
1960
|
};
|
|
1916
1961
|
var windowScroll = scrollWithAdjustments;
|
|
1962
|
+
var elementScroll = scrollWithAdjustments;
|
|
1917
1963
|
var Virtualizer = class {
|
|
1918
1964
|
constructor(opts) {
|
|
1919
1965
|
this.unsubs = [];
|
|
@@ -3156,6 +3202,13 @@ function useVirtualizerBase(_a) {
|
|
|
3156
3202
|
});
|
|
3157
3203
|
return instance;
|
|
3158
3204
|
}
|
|
3205
|
+
function useVirtualizer(options) {
|
|
3206
|
+
return useVirtualizerBase(__spreadValues({
|
|
3207
|
+
observeElementRect,
|
|
3208
|
+
observeElementOffset,
|
|
3209
|
+
scrollToFn: elementScroll
|
|
3210
|
+
}, options));
|
|
3211
|
+
}
|
|
3159
3212
|
function useWindowVirtualizer(options) {
|
|
3160
3213
|
return useVirtualizerBase(__spreadValues({
|
|
3161
3214
|
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
@@ -3228,7 +3281,7 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3228
3281
|
] })
|
|
3229
3282
|
] });
|
|
3230
3283
|
};
|
|
3231
|
-
var useIsElementVisible = (elementRef) => {
|
|
3284
|
+
var useIsElementVisible = (elementRef, root = null) => {
|
|
3232
3285
|
const [isVisible, setIsVisible] = (0, import_react8.useState)(false);
|
|
3233
3286
|
(0, import_react8.useEffect)(() => {
|
|
3234
3287
|
const element = elementRef.current;
|
|
@@ -3237,11 +3290,11 @@ var useIsElementVisible = (elementRef) => {
|
|
|
3237
3290
|
([entry]) => {
|
|
3238
3291
|
setIsVisible(entry.isIntersecting);
|
|
3239
3292
|
},
|
|
3240
|
-
{ rootMargin: "1px" }
|
|
3293
|
+
{ root, rootMargin: "1px" }
|
|
3241
3294
|
);
|
|
3242
3295
|
observer.observe(element);
|
|
3243
3296
|
return () => observer.disconnect();
|
|
3244
|
-
}, [elementRef]);
|
|
3297
|
+
}, [elementRef, root]);
|
|
3245
3298
|
return isVisible;
|
|
3246
3299
|
};
|
|
3247
3300
|
|
|
@@ -3263,12 +3316,40 @@ var collection_messages_default = (0, import_react_intl8.defineMessages)({
|
|
|
3263
3316
|
}
|
|
3264
3317
|
});
|
|
3265
3318
|
|
|
3319
|
+
// ../renderers/src/CollectionRenderer/components/getScrollableAncestor.ts
|
|
3320
|
+
var SCROLLABLE_OVERFLOW_VALUES = /* @__PURE__ */ new Set(["auto", "overlay", "scroll"]);
|
|
3321
|
+
var getScrollableAncestor = (element) => {
|
|
3322
|
+
var _a;
|
|
3323
|
+
const view = element == null ? void 0 : element.ownerDocument.defaultView;
|
|
3324
|
+
let ancestor = (_a = element == null ? void 0 : element.parentElement) != null ? _a : null;
|
|
3325
|
+
if (!view) {
|
|
3326
|
+
return null;
|
|
3327
|
+
}
|
|
3328
|
+
while (ancestor) {
|
|
3329
|
+
const { overflowY } = view.getComputedStyle(ancestor);
|
|
3330
|
+
const hasScrollableOverflow = SCROLLABLE_OVERFLOW_VALUES.has(overflowY);
|
|
3331
|
+
if (hasScrollableOverflow && ancestor.scrollHeight > ancestor.clientHeight) {
|
|
3332
|
+
return ancestor;
|
|
3333
|
+
}
|
|
3334
|
+
ancestor = ancestor.parentElement;
|
|
3335
|
+
}
|
|
3336
|
+
return null;
|
|
3337
|
+
};
|
|
3338
|
+
|
|
3266
3339
|
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
3267
3340
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3268
3341
|
var ContentComponent = (props) => {
|
|
3269
3342
|
const { state, status, SectionHeader, Item } = props;
|
|
3343
|
+
const contentRef = (0, import_react9.useRef)(null);
|
|
3344
|
+
const [scrollElement, setScrollElement] = (0, import_react9.useState)(null);
|
|
3345
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
3346
|
+
const nextScrollElement = getScrollableAncestor(contentRef.current);
|
|
3347
|
+
setScrollElement(
|
|
3348
|
+
(currentScrollElement) => currentScrollElement === nextScrollElement ? currentScrollElement : nextScrollElement
|
|
3349
|
+
);
|
|
3350
|
+
}, []);
|
|
3270
3351
|
const endOfContentRef = (0, import_react9.useRef)(null);
|
|
3271
|
-
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
3352
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef, scrollElement);
|
|
3272
3353
|
(0, import_react9.useEffect)(() => {
|
|
3273
3354
|
const shouldAutoLoad = isBottomVisible && status.type === "idle" && state.afterSectionsProps.length === 0;
|
|
3274
3355
|
if (shouldAutoLoad && status.loadMore) {
|
|
@@ -3300,51 +3381,90 @@ var ContentComponent = (props) => {
|
|
|
3300
3381
|
var _a, _b;
|
|
3301
3382
|
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
3302
3383
|
});
|
|
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: [
|
|
3384
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { ref: contentRef, children: [
|
|
3311
3385
|
state.beforeSections,
|
|
3312
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3313
|
-
|
|
3386
|
+
scrollElement ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3387
|
+
ElementVirtualizedItems,
|
|
3314
3388
|
{
|
|
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
|
-
})
|
|
3389
|
+
Item,
|
|
3390
|
+
SectionHeader,
|
|
3391
|
+
items,
|
|
3392
|
+
scrollElement,
|
|
3393
|
+
stateCount
|
|
3394
|
+
}
|
|
3395
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3396
|
+
WindowVirtualizedItems,
|
|
3397
|
+
{
|
|
3398
|
+
Item,
|
|
3399
|
+
SectionHeader,
|
|
3400
|
+
items,
|
|
3401
|
+
stateCount
|
|
3342
3402
|
}
|
|
3343
3403
|
),
|
|
3344
3404
|
/* @__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
3405
|
state.afterSections
|
|
3346
3406
|
] });
|
|
3347
3407
|
};
|
|
3408
|
+
var WindowVirtualizedItems = (props) => {
|
|
3409
|
+
const { stateCount } = props;
|
|
3410
|
+
const virtualItemsRef = (0, import_react9.useRef)(null);
|
|
3411
|
+
const virtualizer = useWindowVirtualizer({
|
|
3412
|
+
count: stateCount,
|
|
3413
|
+
estimateSize: () => 120,
|
|
3414
|
+
overscan: 10
|
|
3415
|
+
});
|
|
3416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3417
|
+
};
|
|
3418
|
+
var ElementVirtualizedItems = (props) => {
|
|
3419
|
+
const { scrollElement, stateCount } = props;
|
|
3420
|
+
const virtualItemsRef = (0, import_react9.useRef)(null);
|
|
3421
|
+
const virtualizer = useVirtualizer({
|
|
3422
|
+
count: stateCount,
|
|
3423
|
+
getScrollElement: () => scrollElement,
|
|
3424
|
+
estimateSize: () => 120,
|
|
3425
|
+
overscan: 10
|
|
3426
|
+
});
|
|
3427
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VirtualizedItems, __spreadProps(__spreadValues({}, props), { virtualItemsRef, virtualizer }));
|
|
3428
|
+
};
|
|
3429
|
+
var VirtualizedItems = ({
|
|
3430
|
+
Item,
|
|
3431
|
+
SectionHeader,
|
|
3432
|
+
items,
|
|
3433
|
+
virtualItemsRef,
|
|
3434
|
+
virtualizer
|
|
3435
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3436
|
+
"div",
|
|
3437
|
+
{
|
|
3438
|
+
ref: virtualItemsRef,
|
|
3439
|
+
style: {
|
|
3440
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
3441
|
+
width: "100%",
|
|
3442
|
+
position: "relative"
|
|
3443
|
+
},
|
|
3444
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
3445
|
+
const i = items[item.index];
|
|
3446
|
+
if (!i) {
|
|
3447
|
+
return null;
|
|
3448
|
+
}
|
|
3449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3450
|
+
"div",
|
|
3451
|
+
{
|
|
3452
|
+
ref: virtualizer.measureElement,
|
|
3453
|
+
"data-index": item.index,
|
|
3454
|
+
style: {
|
|
3455
|
+
position: "absolute",
|
|
3456
|
+
top: 0,
|
|
3457
|
+
left: 0,
|
|
3458
|
+
width: "100%",
|
|
3459
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
3460
|
+
},
|
|
3461
|
+
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Item, __spreadValues({}, i.item))
|
|
3462
|
+
},
|
|
3463
|
+
item.key
|
|
3464
|
+
);
|
|
3465
|
+
})
|
|
3466
|
+
}
|
|
3467
|
+
);
|
|
3348
3468
|
var PaginationComponent = ({
|
|
3349
3469
|
status,
|
|
3350
3470
|
state
|
|
@@ -6633,8 +6753,6 @@ var import_components69 = require("@transferwise/components");
|
|
|
6633
6753
|
|
|
6634
6754
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
6635
6755
|
var import_components68 = require("@transferwise/components");
|
|
6636
|
-
var import_icons7 = require("@transferwise/icons");
|
|
6637
|
-
var import_react27 = require("react");
|
|
6638
6756
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
6639
6757
|
var commonKeys = [
|
|
6640
6758
|
"autoComplete",
|
|
@@ -6650,18 +6768,13 @@ var commonKeys = [
|
|
|
6650
6768
|
"value"
|
|
6651
6769
|
];
|
|
6652
6770
|
function VariableTextInput(inputProps) {
|
|
6653
|
-
const { id, value, control,
|
|
6771
|
+
const { id, value, control, onChange } = inputProps;
|
|
6654
6772
|
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
6773
|
switch (control) {
|
|
6659
6774
|
case "email":
|
|
6660
6775
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
6661
6776
|
case "password":
|
|
6662
6777
|
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
6778
|
case "numeric": {
|
|
6666
6779
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
6667
6780
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -6682,79 +6795,10 @@ function VariableTextInput(inputProps) {
|
|
|
6682
6795
|
}
|
|
6683
6796
|
}
|
|
6684
6797
|
function TextInput(props) {
|
|
6685
|
-
const _a = props, { control, displayFormat, onChange
|
|
6798
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
6686
6799
|
const InputWithPattern = control === "textarea" ? import_components68.TextareaWithDisplayFormat : import_components68.InputWithDisplayFormat;
|
|
6687
6800
|
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
|
-
] });
|
|
6801
|
+
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
6802
|
}
|
|
6759
6803
|
|
|
6760
6804
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -6966,7 +7010,7 @@ var LargeUploadRenderer = {
|
|
|
6966
7010
|
// ../renderers/src/UpsellRenderer.tsx
|
|
6967
7011
|
var import_components71 = require("@transferwise/components");
|
|
6968
7012
|
var import_classnames35 = __toESM(require_classnames());
|
|
6969
|
-
var
|
|
7013
|
+
var import_react27 = require("react");
|
|
6970
7014
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
6971
7015
|
var UpsellRenderer = {
|
|
6972
7016
|
canRenderType: "upsell",
|
|
@@ -6974,7 +7018,7 @@ var UpsellRenderer = {
|
|
|
6974
7018
|
};
|
|
6975
7019
|
function UpsellRendererComponent(props) {
|
|
6976
7020
|
const { text, callToAction, media, margin, onDismiss, control, tags } = props;
|
|
6977
|
-
const [isVisible, setIsVisible] = (0,
|
|
7021
|
+
const [isVisible, setIsVisible] = (0, import_react27.useState)(true);
|
|
6978
7022
|
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
6979
7023
|
import_components71.Nudge,
|
|
6980
7024
|
{
|
|
@@ -7203,7 +7247,7 @@ var customEventsToAnalytics = {
|
|
|
7203
7247
|
};
|
|
7204
7248
|
|
|
7205
7249
|
// src/dynamicFlow/useOnCopy.tsx
|
|
7206
|
-
var
|
|
7250
|
+
var import_react28 = require("react");
|
|
7207
7251
|
var import_react_intl36 = require("react-intl");
|
|
7208
7252
|
|
|
7209
7253
|
// src/dynamicFlow/messages.ts
|
|
@@ -7225,7 +7269,7 @@ var messages_default = (0, import_react_intl35.defineMessages)({
|
|
|
7225
7269
|
var useOnCopy = () => {
|
|
7226
7270
|
const { formatMessage } = (0, import_react_intl36.useIntl)();
|
|
7227
7271
|
const createSnackBar = useSnackBarIfAvailable();
|
|
7228
|
-
return (0,
|
|
7272
|
+
return (0, import_react28.useCallback)(
|
|
7229
7273
|
(copiedContent) => {
|
|
7230
7274
|
if (copiedContent) {
|
|
7231
7275
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -7238,11 +7282,11 @@ var useOnCopy = () => {
|
|
|
7238
7282
|
};
|
|
7239
7283
|
|
|
7240
7284
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
7241
|
-
var
|
|
7285
|
+
var import_react29 = require("react");
|
|
7242
7286
|
var import_react_intl37 = require("react-intl");
|
|
7243
7287
|
var useWiseHttpClient = (httpClient) => {
|
|
7244
7288
|
const { locale } = (0, import_react_intl37.useIntl)();
|
|
7245
|
-
return (0,
|
|
7289
|
+
return (0, import_react29.useCallback)(
|
|
7246
7290
|
async (input, init = {}) => {
|
|
7247
7291
|
const headers = new Headers(init.headers);
|
|
7248
7292
|
headers.set("accept-language", locale);
|
|
@@ -7283,10 +7327,10 @@ var useWiseToCoreProps = (props) => {
|
|
|
7283
7327
|
onLog
|
|
7284
7328
|
} = props;
|
|
7285
7329
|
const httpClient = useWiseHttpClient(customFetch);
|
|
7286
|
-
const mergedRenderers = (0,
|
|
7330
|
+
const mergedRenderers = (0, import_react30.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
7287
7331
|
const createSnackBar = useCreateSnackBar();
|
|
7288
|
-
const logEvent = (0,
|
|
7289
|
-
const trackEvent = (0,
|
|
7332
|
+
const logEvent = (0, import_react30.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
7333
|
+
const trackEvent = (0, import_react30.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
7290
7334
|
const onCopy = useOnCopy();
|
|
7291
7335
|
return __spreadProps(__spreadValues({}, props), {
|
|
7292
7336
|
httpClient,
|
|
@@ -7334,14 +7378,14 @@ function DynamicFlow(props) {
|
|
|
7334
7378
|
}
|
|
7335
7379
|
|
|
7336
7380
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
7337
|
-
var
|
|
7381
|
+
var import_react31 = require("react");
|
|
7338
7382
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
7339
7383
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
7340
|
-
var DynamicFlowWithRef = (0,
|
|
7384
|
+
var DynamicFlowWithRef = (0, import_react31.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
7341
7385
|
const { className = "" } = props;
|
|
7342
7386
|
const dfProps = useWiseToCoreProps(props);
|
|
7343
7387
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
7344
|
-
(0,
|
|
7388
|
+
(0, import_react31.useImperativeHandle)(
|
|
7345
7389
|
ref,
|
|
7346
7390
|
() => ({
|
|
7347
7391
|
getValue: () => {
|