@wise/dynamic-flow-client-internal 5.29.0-experimental-cadf60b → 5.29.0-experimental-9e4b087
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 +25 -0
- package/build/main.js +84 -25
- package/build/main.mjs +76 -17
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +4 -4
package/build/main.css
CHANGED
|
@@ -387,6 +387,31 @@
|
|
|
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
|
+
|
|
390
415
|
.df-context-menu {
|
|
391
416
|
position: fixed;
|
|
392
417
|
z-index: 10;
|
package/build/main.js
CHANGED
|
@@ -336,7 +336,7 @@ var recursivelyRemoveNullish = (element) => {
|
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
339
|
-
var
|
|
339
|
+
var import_react31 = require("react");
|
|
340
340
|
|
|
341
341
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
342
342
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
@@ -6633,7 +6633,8 @@ var import_components69 = require("@transferwise/components");
|
|
|
6633
6633
|
|
|
6634
6634
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
6635
6635
|
var import_components68 = require("@transferwise/components");
|
|
6636
|
-
var
|
|
6636
|
+
var import_icons7 = require("@transferwise/icons");
|
|
6637
|
+
var import_react27 = require("react");
|
|
6637
6638
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
6638
6639
|
var commonKeys = [
|
|
6639
6640
|
"autoComplete",
|
|
@@ -6651,8 +6652,8 @@ var commonKeys = [
|
|
|
6651
6652
|
function VariableTextInput(inputProps) {
|
|
6652
6653
|
const { id, value, control, displayFormat, onChange } = inputProps;
|
|
6653
6654
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
6654
|
-
if (control === "ssn-input" || displayFormat
|
|
6655
|
-
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
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 }));
|
|
6656
6657
|
}
|
|
6657
6658
|
switch (control) {
|
|
6658
6659
|
case "email":
|
|
@@ -6687,15 +6688,73 @@ function TextInput(props) {
|
|
|
6687
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), { type, onChange: (e) => onChange(e.target.value) }));
|
|
6688
6689
|
}
|
|
6689
6690
|
function SsnInput(props) {
|
|
6690
|
-
const _a = props, {
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
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
|
+
] });
|
|
6699
6758
|
}
|
|
6700
6759
|
|
|
6701
6760
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -6907,7 +6966,7 @@ var LargeUploadRenderer = {
|
|
|
6907
6966
|
// ../renderers/src/UpsellRenderer.tsx
|
|
6908
6967
|
var import_components71 = require("@transferwise/components");
|
|
6909
6968
|
var import_classnames35 = __toESM(require_classnames());
|
|
6910
|
-
var
|
|
6969
|
+
var import_react28 = require("react");
|
|
6911
6970
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
6912
6971
|
var UpsellRenderer = {
|
|
6913
6972
|
canRenderType: "upsell",
|
|
@@ -6915,7 +6974,7 @@ var UpsellRenderer = {
|
|
|
6915
6974
|
};
|
|
6916
6975
|
function UpsellRendererComponent(props) {
|
|
6917
6976
|
const { text, callToAction, media, margin, onDismiss, control, tags } = props;
|
|
6918
|
-
const [isVisible, setIsVisible] = (0,
|
|
6977
|
+
const [isVisible, setIsVisible] = (0, import_react28.useState)(true);
|
|
6919
6978
|
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
6920
6979
|
import_components71.Nudge,
|
|
6921
6980
|
{
|
|
@@ -7144,7 +7203,7 @@ var customEventsToAnalytics = {
|
|
|
7144
7203
|
};
|
|
7145
7204
|
|
|
7146
7205
|
// src/dynamicFlow/useOnCopy.tsx
|
|
7147
|
-
var
|
|
7206
|
+
var import_react29 = require("react");
|
|
7148
7207
|
var import_react_intl36 = require("react-intl");
|
|
7149
7208
|
|
|
7150
7209
|
// src/dynamicFlow/messages.ts
|
|
@@ -7166,7 +7225,7 @@ var messages_default = (0, import_react_intl35.defineMessages)({
|
|
|
7166
7225
|
var useOnCopy = () => {
|
|
7167
7226
|
const { formatMessage } = (0, import_react_intl36.useIntl)();
|
|
7168
7227
|
const createSnackBar = useSnackBarIfAvailable();
|
|
7169
|
-
return (0,
|
|
7228
|
+
return (0, import_react29.useCallback)(
|
|
7170
7229
|
(copiedContent) => {
|
|
7171
7230
|
if (copiedContent) {
|
|
7172
7231
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -7179,11 +7238,11 @@ var useOnCopy = () => {
|
|
|
7179
7238
|
};
|
|
7180
7239
|
|
|
7181
7240
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
7182
|
-
var
|
|
7241
|
+
var import_react30 = require("react");
|
|
7183
7242
|
var import_react_intl37 = require("react-intl");
|
|
7184
7243
|
var useWiseHttpClient = (httpClient) => {
|
|
7185
7244
|
const { locale } = (0, import_react_intl37.useIntl)();
|
|
7186
|
-
return (0,
|
|
7245
|
+
return (0, import_react30.useCallback)(
|
|
7187
7246
|
async (input, init = {}) => {
|
|
7188
7247
|
const headers = new Headers(init.headers);
|
|
7189
7248
|
headers.set("accept-language", locale);
|
|
@@ -7224,10 +7283,10 @@ var useWiseToCoreProps = (props) => {
|
|
|
7224
7283
|
onLog
|
|
7225
7284
|
} = props;
|
|
7226
7285
|
const httpClient = useWiseHttpClient(customFetch);
|
|
7227
|
-
const mergedRenderers = (0,
|
|
7286
|
+
const mergedRenderers = (0, import_react31.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
7228
7287
|
const createSnackBar = useCreateSnackBar();
|
|
7229
|
-
const logEvent = (0,
|
|
7230
|
-
const trackEvent = (0,
|
|
7288
|
+
const logEvent = (0, import_react31.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
7289
|
+
const trackEvent = (0, import_react31.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
7231
7290
|
const onCopy = useOnCopy();
|
|
7232
7291
|
return __spreadProps(__spreadValues({}, props), {
|
|
7233
7292
|
httpClient,
|
|
@@ -7275,14 +7334,14 @@ function DynamicFlow(props) {
|
|
|
7275
7334
|
}
|
|
7276
7335
|
|
|
7277
7336
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
7278
|
-
var
|
|
7337
|
+
var import_react32 = require("react");
|
|
7279
7338
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
7280
7339
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
7281
|
-
var DynamicFlowWithRef = (0,
|
|
7340
|
+
var DynamicFlowWithRef = (0, import_react32.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
7282
7341
|
const { className = "" } = props;
|
|
7283
7342
|
const dfProps = useWiseToCoreProps(props);
|
|
7284
7343
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
7285
|
-
(0,
|
|
7344
|
+
(0, import_react32.useImperativeHandle)(
|
|
7286
7345
|
ref,
|
|
7287
7346
|
() => ({
|
|
7288
7347
|
getValue: () => {
|
package/build/main.mjs
CHANGED
|
@@ -6628,8 +6628,9 @@ import {
|
|
|
6628
6628
|
TextArea,
|
|
6629
6629
|
TextareaWithDisplayFormat
|
|
6630
6630
|
} from "@transferwise/components";
|
|
6631
|
-
import
|
|
6632
|
-
import {
|
|
6631
|
+
import { Eye, EyeShut } from "@transferwise/icons";
|
|
6632
|
+
import { useState as useState19 } from "react";
|
|
6633
|
+
import { jsx as jsx100, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
6633
6634
|
var commonKeys = [
|
|
6634
6635
|
"autoComplete",
|
|
6635
6636
|
"autoCapitalize",
|
|
@@ -6646,8 +6647,8 @@ var commonKeys = [
|
|
|
6646
6647
|
function VariableTextInput(inputProps) {
|
|
6647
6648
|
const { id, value, control, displayFormat, onChange } = inputProps;
|
|
6648
6649
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
6649
|
-
if (control === "ssn-input" || displayFormat
|
|
6650
|
-
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { onChange }));
|
|
6650
|
+
if (control === "ssn-input" || (displayFormat == null ? void 0 : displayFormat.includes("*"))) {
|
|
6651
|
+
return /* @__PURE__ */ jsx100(SsnInput, __spreadProps(__spreadValues({}, commonProps), { maxLength: inputProps.maxLength, onChange }));
|
|
6651
6652
|
}
|
|
6652
6653
|
switch (control) {
|
|
6653
6654
|
case "email":
|
|
@@ -6682,15 +6683,73 @@ function TextInput(props) {
|
|
|
6682
6683
|
return displayFormat ? /* @__PURE__ */ jsx100(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx100(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { type, onChange: (e) => onChange(e.target.value) }));
|
|
6683
6684
|
}
|
|
6684
6685
|
function SsnInput(props) {
|
|
6685
|
-
const _a = props, {
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
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
|
+
] });
|
|
6694
6753
|
}
|
|
6695
6754
|
|
|
6696
6755
|
// ../renderers/src/TextInputRenderer.tsx
|
|
@@ -6902,7 +6961,7 @@ var LargeUploadRenderer = {
|
|
|
6902
6961
|
// ../renderers/src/UpsellRenderer.tsx
|
|
6903
6962
|
var import_classnames35 = __toESM(require_classnames());
|
|
6904
6963
|
import { Nudge } from "@transferwise/components";
|
|
6905
|
-
import { useState as
|
|
6964
|
+
import { useState as useState20 } from "react";
|
|
6906
6965
|
import { jsx as jsx104 } from "react/jsx-runtime";
|
|
6907
6966
|
var UpsellRenderer = {
|
|
6908
6967
|
canRenderType: "upsell",
|
|
@@ -6910,7 +6969,7 @@ var UpsellRenderer = {
|
|
|
6910
6969
|
};
|
|
6911
6970
|
function UpsellRendererComponent(props) {
|
|
6912
6971
|
const { text, callToAction, media, margin, onDismiss, control, tags } = props;
|
|
6913
|
-
const [isVisible, setIsVisible] =
|
|
6972
|
+
const [isVisible, setIsVisible] = useState20(true);
|
|
6914
6973
|
return isVisible ? /* @__PURE__ */ jsx104(
|
|
6915
6974
|
Nudge,
|
|
6916
6975
|
{
|
|
@@ -7257,13 +7316,13 @@ var openLinkInNewTab = (url) => {
|
|
|
7257
7316
|
};
|
|
7258
7317
|
|
|
7259
7318
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
7260
|
-
import { jsxs as
|
|
7319
|
+
import { jsxs as jsxs41 } from "react/jsx-runtime";
|
|
7261
7320
|
function DynamicFlow(props) {
|
|
7262
7321
|
const { className = "" } = props;
|
|
7263
7322
|
const dfProps = useWiseToCoreProps(props);
|
|
7264
7323
|
const df = useDynamicFlow(dfProps);
|
|
7265
7324
|
const { onContextMenu, contextMenu } = useDFContextMenu(df.controller);
|
|
7266
|
-
return /* @__PURE__ */
|
|
7325
|
+
return /* @__PURE__ */ jsxs41("div", { className, onContextMenu, children: [
|
|
7267
7326
|
df.view,
|
|
7268
7327
|
contextMenu
|
|
7269
7328
|
] });
|