@wise/dynamic-flow-client-internal 5.17.0 → 5.19.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/i18n/zh_CN.json +2 -2
- package/build/main.js +287 -233
- package/build/main.mjs +249 -195
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/dynamicFlow/DynamicFlowWiseProps.d.ts +1 -1
- package/build/types/dynamicFlow/DynamicFlowWiseProps.d.ts.map +1 -1
- package/build/types/dynamicFlow/context-menu/useDFContextMenu.d.ts.map +1 -1
- package/build/types/dynamicFlow/telemetry/dispatchAnalyticsEvent.d.ts +9 -0
- package/build/types/dynamicFlow/telemetry/dispatchAnalyticsEvent.d.ts.map +1 -0
- package/build/types/dynamicFlow/telemetry/getTrackEvent.d.ts.map +1 -1
- package/build/types/dynamicFlow/useCreateSnackBar.d.ts +7 -0
- package/build/types/dynamicFlow/useCreateSnackBar.d.ts.map +1 -0
- package/build/types/dynamicFlow/useWiseToCoreProps.d.ts +1 -1
- package/build/types/dynamicFlow/useWiseToCoreProps.d.ts.map +1 -1
- package/package.json +28 -28
package/build/main.js
CHANGED
|
@@ -35,7 +35,11 @@ var __objRest = (source, exclude) => {
|
|
|
35
35
|
return target;
|
|
36
36
|
};
|
|
37
37
|
var __commonJS = (cb, mod) => function __require() {
|
|
38
|
-
|
|
38
|
+
try {
|
|
39
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
40
|
+
} catch (e) {
|
|
41
|
+
throw mod = 0, e;
|
|
42
|
+
}
|
|
39
43
|
};
|
|
40
44
|
var __export = (target, all) => {
|
|
41
45
|
for (var name in all)
|
|
@@ -141,7 +145,7 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
|
141
145
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
142
146
|
var appVersion = (
|
|
143
147
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
144
|
-
typeof process !== "undefined" ? "5.
|
|
148
|
+
typeof process !== "undefined" ? "5.19.0" : "0.0.0"
|
|
145
149
|
);
|
|
146
150
|
|
|
147
151
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
@@ -226,27 +230,29 @@ var useDFContextMenu = (controller) => {
|
|
|
226
230
|
}
|
|
227
231
|
},
|
|
228
232
|
{
|
|
229
|
-
label: "
|
|
233
|
+
label: "Copy step JSON",
|
|
230
234
|
onClick: () => {
|
|
231
|
-
|
|
235
|
+
copyToClipboard(getCurrentStep());
|
|
232
236
|
}
|
|
233
237
|
},
|
|
234
238
|
{
|
|
235
|
-
label: "Open in
|
|
239
|
+
label: "Open in Studio (experimental)",
|
|
236
240
|
onClick: () => {
|
|
237
|
-
|
|
241
|
+
openIn("studio", getEncodedCurrentStep());
|
|
238
242
|
}
|
|
239
243
|
},
|
|
240
244
|
{
|
|
241
|
-
label: "
|
|
245
|
+
label: "Open in Sandbox",
|
|
242
246
|
onClick: () => {
|
|
243
|
-
|
|
247
|
+
openIn("sandbox", getEncodedCurrentStep());
|
|
244
248
|
}
|
|
245
249
|
},
|
|
246
250
|
{
|
|
247
|
-
label: "
|
|
251
|
+
label: "Open in Sandbox (with model)",
|
|
248
252
|
onClick: () => {
|
|
249
|
-
void
|
|
253
|
+
void getEncodedCurrentStepWithModel().then(
|
|
254
|
+
(base64Step) => openIn("sandbox", base64Step)
|
|
255
|
+
);
|
|
250
256
|
}
|
|
251
257
|
}
|
|
252
258
|
] : []
|
|
@@ -257,9 +263,9 @@ var toBase64 = (str) => {
|
|
|
257
263
|
const binString = Array.from(bytes, (b) => String.fromCharCode(b)).join("");
|
|
258
264
|
return btoa(binString);
|
|
259
265
|
};
|
|
260
|
-
var
|
|
266
|
+
var openIn = (editor, base64Step) => {
|
|
261
267
|
if (base64Step) {
|
|
262
|
-
window.open(`https://df.wise.com
|
|
268
|
+
window.open(`https://df.wise.com/${editor}#${base64Step}`, "_blank", "noopener,noreferrer");
|
|
263
269
|
}
|
|
264
270
|
};
|
|
265
271
|
var openVersionPage = (version) => {
|
|
@@ -323,56 +329,10 @@ var recursivelyRemoveNullish = (element) => {
|
|
|
323
329
|
};
|
|
324
330
|
|
|
325
331
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
326
|
-
var
|
|
327
|
-
|
|
328
|
-
// src/dynamicFlow/telemetry/getLogEvent.ts
|
|
329
|
-
var getLogEvent = (onLog) => (level, message, extra) => {
|
|
330
|
-
const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
|
|
331
|
-
dfWiseVersion: appVersion
|
|
332
|
-
});
|
|
333
|
-
if (level !== "info" && onLog) {
|
|
334
|
-
if (onLog) {
|
|
335
|
-
onLog(level, message, extraWithVersion);
|
|
336
|
-
} else {
|
|
337
|
-
logToRollbar(level, message, extraWithVersion);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
var logToRollbar = (level, message, extra) => {
|
|
342
|
-
try {
|
|
343
|
-
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
344
|
-
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
345
|
-
} catch (error) {
|
|
346
|
-
console.error("Failed to log to Rollbar", error);
|
|
347
|
-
}
|
|
348
|
-
};
|
|
332
|
+
var import_react26 = require("react");
|
|
349
333
|
|
|
350
|
-
// src/dynamicFlow/
|
|
351
|
-
var
|
|
352
|
-
var prefix = "Dynamic Flow - ";
|
|
353
|
-
var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
|
|
354
|
-
onEvent == null ? void 0 : onEvent(name, properties);
|
|
355
|
-
if (includeInAnalytics(name)) {
|
|
356
|
-
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
var includeInAnalytics = (name) => {
|
|
360
|
-
const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
|
|
361
|
-
if (isCoreEventName(eventName)) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
if (eventName in customEventsToAnalytics) {
|
|
365
|
-
return customEventsToAnalytics[eventName];
|
|
366
|
-
}
|
|
367
|
-
return true;
|
|
368
|
-
};
|
|
369
|
-
var isCoreEventName = (eventName) => {
|
|
370
|
-
return import_dynamic_flow_client.eventNames.includes(eventName);
|
|
371
|
-
};
|
|
372
|
-
var customEventsToAnalytics = {
|
|
373
|
-
"Theme Required": false
|
|
374
|
-
// Excluded from analytics
|
|
375
|
-
};
|
|
334
|
+
// src/dynamicFlow/getMergedRenderers.tsx
|
|
335
|
+
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
376
336
|
|
|
377
337
|
// ../renderers/src/AlertRenderer.tsx
|
|
378
338
|
var import_components = require("@transferwise/components");
|
|
@@ -423,10 +383,10 @@ var AlertRenderer = {
|
|
|
423
383
|
};
|
|
424
384
|
var mapCtaToAlertAction = (callToAction) => {
|
|
425
385
|
if (callToAction) {
|
|
426
|
-
return __spreadValues(
|
|
386
|
+
return __spreadValues({
|
|
427
387
|
text: callToAction.title,
|
|
428
388
|
"aria-label": callToAction.accessibilityDescription
|
|
429
|
-
},
|
|
389
|
+
}, callToAction.getAnchorProps());
|
|
430
390
|
}
|
|
431
391
|
return void 0;
|
|
432
392
|
};
|
|
@@ -911,6 +871,18 @@ var getPriority = (control, tags) => {
|
|
|
911
871
|
|
|
912
872
|
// ../renderers/src/components/FieldInput.tsx
|
|
913
873
|
var import_components8 = require("@transferwise/components");
|
|
874
|
+
var import_react4 = require("react");
|
|
875
|
+
|
|
876
|
+
// ../renderers/src/utils/scroll-to-if-not-visible.ts
|
|
877
|
+
var scrollToIfNotVisible = (ref) => {
|
|
878
|
+
const rect = ref == null ? void 0 : ref.getBoundingClientRect();
|
|
879
|
+
if (!ref || !rect) {
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
882
|
+
if (rect.bottom > window.innerHeight || rect.top < 0) {
|
|
883
|
+
ref.scrollIntoView({ behavior: "instant" });
|
|
884
|
+
}
|
|
885
|
+
};
|
|
914
886
|
|
|
915
887
|
// ../renderers/src/components/Help.tsx
|
|
916
888
|
var import_components7 = require("@transferwise/components");
|
|
@@ -954,28 +926,47 @@ function LabelContentWithHelp({ text, help }) {
|
|
|
954
926
|
|
|
955
927
|
// ../renderers/src/components/FieldInput.tsx
|
|
956
928
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
957
|
-
function FieldInput({
|
|
929
|
+
function FieldInput({
|
|
930
|
+
id,
|
|
931
|
+
children,
|
|
932
|
+
label,
|
|
933
|
+
validation,
|
|
934
|
+
description,
|
|
935
|
+
help,
|
|
936
|
+
loadingState = "idle",
|
|
937
|
+
inlineAlert
|
|
938
|
+
}) {
|
|
958
939
|
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
959
|
-
|
|
940
|
+
const message = validation == null ? void 0 : validation.message;
|
|
941
|
+
const ref = (0, import_react4.useRef)(null);
|
|
942
|
+
(0, import_react4.useEffect)(() => {
|
|
943
|
+
if (message) {
|
|
944
|
+
scrollToIfNotVisible(ref.current);
|
|
945
|
+
}
|
|
946
|
+
}, [message]);
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
960
948
|
import_components8.Field,
|
|
961
949
|
{
|
|
962
950
|
id,
|
|
963
951
|
label: labelContent,
|
|
964
952
|
description,
|
|
965
|
-
message:
|
|
966
|
-
|
|
953
|
+
message: message != null ? message : inlineAlert == null ? void 0 : inlineAlert.content,
|
|
954
|
+
messageLoading: loadingState !== "idle",
|
|
955
|
+
sentiment: mapStatusToSentiment(validation, inlineAlert == null ? void 0 : inlineAlert.context),
|
|
967
956
|
children
|
|
968
957
|
}
|
|
969
|
-
);
|
|
958
|
+
) });
|
|
970
959
|
}
|
|
971
|
-
var mapStatusToSentiment = (validation) => {
|
|
972
|
-
if (validation) {
|
|
973
|
-
|
|
974
|
-
|
|
960
|
+
var mapStatusToSentiment = (validation, defaultContext) => {
|
|
961
|
+
if (validation == null ? void 0 : validation.message) {
|
|
962
|
+
switch (validation.status) {
|
|
963
|
+
case "valid":
|
|
964
|
+
return "positive";
|
|
965
|
+
case "invalid":
|
|
966
|
+
return "negative";
|
|
975
967
|
}
|
|
976
|
-
return "negative";
|
|
977
968
|
}
|
|
978
|
-
return
|
|
969
|
+
return defaultContext;
|
|
979
970
|
};
|
|
980
971
|
var FieldInput_default = FieldInput;
|
|
981
972
|
|
|
@@ -1043,7 +1034,19 @@ var CheckboxComponent = (props) => {
|
|
|
1043
1034
|
"value"
|
|
1044
1035
|
]);
|
|
1045
1036
|
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
1046
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1038
|
+
FieldInput_default,
|
|
1039
|
+
{
|
|
1040
|
+
id,
|
|
1041
|
+
label: "",
|
|
1042
|
+
description: "",
|
|
1043
|
+
validation: validationState,
|
|
1044
|
+
help,
|
|
1045
|
+
inlineAlert: rest.inlineAlert,
|
|
1046
|
+
loadingState: rest.fieldLoadingState,
|
|
1047
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Checkbox, __spreadValues({ id }, checkboxProps))
|
|
1048
|
+
}
|
|
1049
|
+
);
|
|
1047
1050
|
};
|
|
1048
1051
|
var CheckboxItemComponent = (props) => {
|
|
1049
1052
|
const {
|
|
@@ -1098,7 +1101,7 @@ var SwitchItemComponent = (props) => {
|
|
|
1098
1101
|
);
|
|
1099
1102
|
};
|
|
1100
1103
|
var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
1101
|
-
if (validationState
|
|
1104
|
+
if ((validationState == null ? void 0 : validationState.status) === "invalid") {
|
|
1102
1105
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
|
|
1103
1106
|
}
|
|
1104
1107
|
return getInlineAlert(inlineAlert);
|
|
@@ -1235,6 +1238,8 @@ var DateInputRenderer = {
|
|
|
1235
1238
|
label: title,
|
|
1236
1239
|
description,
|
|
1237
1240
|
validation: validationState,
|
|
1241
|
+
inlineAlert: props.inlineAlert,
|
|
1242
|
+
loadingState: props.fieldLoadingState,
|
|
1238
1243
|
help,
|
|
1239
1244
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VariableDateInput_default, { control, inputProps })
|
|
1240
1245
|
}
|
|
@@ -1250,6 +1255,7 @@ var import_components16 = require("@transferwise/components");
|
|
|
1250
1255
|
var import_components13 = require("@transferwise/components");
|
|
1251
1256
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1252
1257
|
var getAdditionalInfo = (additionalInfo) => {
|
|
1258
|
+
var _a, _b;
|
|
1253
1259
|
if (!additionalInfo) {
|
|
1254
1260
|
return void 0;
|
|
1255
1261
|
}
|
|
@@ -1258,12 +1264,9 @@ var getAdditionalInfo = (additionalInfo) => {
|
|
|
1258
1264
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1259
1265
|
import_components13.ListItem.AdditionalInfo,
|
|
1260
1266
|
{
|
|
1261
|
-
action: {
|
|
1262
|
-
label: text
|
|
1263
|
-
|
|
1264
|
-
onClick,
|
|
1265
|
-
target: "_blank"
|
|
1266
|
-
}
|
|
1267
|
+
action: __spreadValues({
|
|
1268
|
+
label: text
|
|
1269
|
+
}, (_b = (_a = additionalInfo.getAnchorProps) == null ? void 0 : _a.call(additionalInfo)) != null ? _b : { onClick })
|
|
1267
1270
|
}
|
|
1268
1271
|
);
|
|
1269
1272
|
}
|
|
@@ -1278,7 +1281,7 @@ var shouldUseAvatar = (control, tags) => {
|
|
|
1278
1281
|
|
|
1279
1282
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1280
1283
|
var import_components15 = require("@transferwise/components");
|
|
1281
|
-
var
|
|
1284
|
+
var import_react5 = require("react");
|
|
1282
1285
|
var import_react_intl8 = require("react-intl");
|
|
1283
1286
|
|
|
1284
1287
|
// ../renderers/src/messages/filter.messages.ts
|
|
@@ -1424,7 +1427,7 @@ var UnfilteredDecisionList = (_a) => {
|
|
|
1424
1427
|
};
|
|
1425
1428
|
var FilteredDecisionList = (props) => {
|
|
1426
1429
|
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
1427
|
-
const [query, setQuery] = (0,
|
|
1430
|
+
const [query, setQuery] = (0, import_react5.useState)("");
|
|
1428
1431
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
1429
1432
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
1430
1433
|
const isGrouped = isGroupedDecision(options);
|
|
@@ -1466,7 +1469,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1466
1469
|
disabled,
|
|
1467
1470
|
media,
|
|
1468
1471
|
title: itemTitle,
|
|
1469
|
-
|
|
1472
|
+
getAnchorProps,
|
|
1470
1473
|
additionalText,
|
|
1471
1474
|
inlineAlert,
|
|
1472
1475
|
supportingValues,
|
|
@@ -1484,7 +1487,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1484
1487
|
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
1485
1488
|
prompt: getInlineAlert(inlineAlert),
|
|
1486
1489
|
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
1487
|
-
control:
|
|
1490
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.ListItem.Navigation, __spreadValues({}, getAnchorProps()))
|
|
1488
1491
|
},
|
|
1489
1492
|
JSON.stringify(rest)
|
|
1490
1493
|
);
|
|
@@ -1541,7 +1544,7 @@ var external_confirmation_messages_default = (0, import_react_intl9.defineMessag
|
|
|
1541
1544
|
|
|
1542
1545
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1543
1546
|
var import_react_intl10 = require("react-intl");
|
|
1544
|
-
var
|
|
1547
|
+
var import_react6 = require("react");
|
|
1545
1548
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1546
1549
|
var ExternalConfirmationRenderer = {
|
|
1547
1550
|
canRenderType: "external-confirmation",
|
|
@@ -1554,7 +1557,7 @@ function ExternalConfirmationRendererComponent({
|
|
|
1554
1557
|
onCancel
|
|
1555
1558
|
}) {
|
|
1556
1559
|
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
1557
|
-
(0,
|
|
1560
|
+
(0, import_react6.useEffect)(() => {
|
|
1558
1561
|
open();
|
|
1559
1562
|
}, []);
|
|
1560
1563
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
@@ -1668,7 +1671,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
1668
1671
|
|
|
1669
1672
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1670
1673
|
var import_components21 = require("@transferwise/components");
|
|
1671
|
-
var
|
|
1674
|
+
var import_react7 = require("react");
|
|
1672
1675
|
|
|
1673
1676
|
// ../renderers/src/utils/api-utils.ts
|
|
1674
1677
|
function isRelativePath(url = "") {
|
|
@@ -1687,8 +1690,8 @@ function UrlImage({
|
|
|
1687
1690
|
uri,
|
|
1688
1691
|
httpClient
|
|
1689
1692
|
}) {
|
|
1690
|
-
const [imageSource, setImageSource] = (0,
|
|
1691
|
-
(0,
|
|
1693
|
+
const [imageSource, setImageSource] = (0, import_react7.useState)("");
|
|
1694
|
+
(0, import_react7.useEffect)(() => {
|
|
1692
1695
|
if (!uri.startsWith("urn:")) {
|
|
1693
1696
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1694
1697
|
}
|
|
@@ -1751,7 +1754,7 @@ function UrnFlagImage({
|
|
|
1751
1754
|
|
|
1752
1755
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1753
1756
|
var import_art4 = require("@wise/art");
|
|
1754
|
-
var
|
|
1757
|
+
var import_react9 = require("react");
|
|
1755
1758
|
|
|
1756
1759
|
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1757
1760
|
var isAnimated = (uri) => {
|
|
@@ -1761,9 +1764,9 @@ var isAnimated = (uri) => {
|
|
|
1761
1764
|
|
|
1762
1765
|
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1763
1766
|
var import_art3 = require("@wise/art");
|
|
1764
|
-
var
|
|
1767
|
+
var import_react8 = require("react");
|
|
1765
1768
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1766
|
-
var Illustration3DErrorBoundary = class extends
|
|
1769
|
+
var Illustration3DErrorBoundary = class extends import_react8.Component {
|
|
1767
1770
|
constructor(props) {
|
|
1768
1771
|
super(props);
|
|
1769
1772
|
this.state = { hasError: false };
|
|
@@ -1801,7 +1804,7 @@ function UrnIllustration({
|
|
|
1801
1804
|
size,
|
|
1802
1805
|
uri
|
|
1803
1806
|
}) {
|
|
1804
|
-
const [has3DFailed, setHas3DFailed] = (0,
|
|
1807
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react9.useState)(false);
|
|
1805
1808
|
const illustrationSize = getIllustrationSize(size);
|
|
1806
1809
|
const illustrationName = getIllustrationName(uri);
|
|
1807
1810
|
const illustration3DName = getIllustration3DName(uri);
|
|
@@ -1924,6 +1927,8 @@ var IntegerInputRenderer = {
|
|
|
1924
1927
|
label: title,
|
|
1925
1928
|
description,
|
|
1926
1929
|
validation: validationState,
|
|
1930
|
+
inlineAlert: props.inlineAlert,
|
|
1931
|
+
loadingState: props.fieldLoadingState,
|
|
1927
1932
|
help,
|
|
1928
1933
|
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components23.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1929
1934
|
import_components23.Input,
|
|
@@ -1957,33 +1962,17 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
1957
1962
|
if (!callToAction) {
|
|
1958
1963
|
return void 0;
|
|
1959
1964
|
}
|
|
1960
|
-
const { accessibilityDescription,
|
|
1965
|
+
const { accessibilityDescription, title, context } = callToAction;
|
|
1961
1966
|
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
1962
|
-
if (href) {
|
|
1963
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1964
|
-
import_components24.ListItem.Button,
|
|
1965
|
-
{
|
|
1966
|
-
href,
|
|
1967
|
-
target: "_blank",
|
|
1968
|
-
rel: "noopener noreferrer",
|
|
1969
|
-
partiallyInteractive: !fullyInteractive,
|
|
1970
|
-
priority,
|
|
1971
|
-
"aria-description": accessibilityDescription,
|
|
1972
|
-
sentiment,
|
|
1973
|
-
children: title
|
|
1974
|
-
}
|
|
1975
|
-
);
|
|
1976
|
-
}
|
|
1977
1967
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1978
1968
|
import_components24.ListItem.Button,
|
|
1979
|
-
{
|
|
1980
|
-
"aria-description": accessibilityDescription,
|
|
1969
|
+
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
1981
1970
|
partiallyInteractive: !fullyInteractive,
|
|
1982
1971
|
priority,
|
|
1972
|
+
"aria-description": accessibilityDescription,
|
|
1983
1973
|
sentiment,
|
|
1984
|
-
onClick,
|
|
1985
1974
|
children: title
|
|
1986
|
-
}
|
|
1975
|
+
})
|
|
1987
1976
|
);
|
|
1988
1977
|
};
|
|
1989
1978
|
var getPriorityAndSentiment = (ctaSecondary, context) => {
|
|
@@ -2001,20 +1990,10 @@ var getHeaderAction = (callToAction) => {
|
|
|
2001
1990
|
if (!callToAction) {
|
|
2002
1991
|
return void 0;
|
|
2003
1992
|
}
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
href,
|
|
2009
|
-
target: "_blank"
|
|
2010
|
-
} : {
|
|
2011
|
-
"aria-label": accessibilityDescription,
|
|
2012
|
-
text: title,
|
|
2013
|
-
onClick: (event) => {
|
|
2014
|
-
event.preventDefault();
|
|
2015
|
-
onClick();
|
|
2016
|
-
}
|
|
2017
|
-
};
|
|
1993
|
+
return __spreadValues({
|
|
1994
|
+
"aria-label": callToAction.accessibilityDescription,
|
|
1995
|
+
text: callToAction.title
|
|
1996
|
+
}, callToAction.getAnchorProps());
|
|
2018
1997
|
};
|
|
2019
1998
|
|
|
2020
1999
|
// ../renderers/src/ListRenderer.tsx
|
|
@@ -2139,7 +2118,7 @@ var mapAvatarMediaSize = (size) => {
|
|
|
2139
2118
|
|
|
2140
2119
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
2141
2120
|
var import_components29 = require("@transferwise/components");
|
|
2142
|
-
var
|
|
2121
|
+
var import_react10 = require("react");
|
|
2143
2122
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2144
2123
|
var ModalLayoutRenderer = {
|
|
2145
2124
|
canRenderType: "modal-layout",
|
|
@@ -2147,7 +2126,7 @@ var ModalLayoutRenderer = {
|
|
|
2147
2126
|
};
|
|
2148
2127
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
2149
2128
|
function DFModal({ content, margin, trigger }) {
|
|
2150
|
-
const [visible, setVisible] = (0,
|
|
2129
|
+
const [visible, setVisible] = (0, import_react10.useState)(false);
|
|
2151
2130
|
const { children, title } = content;
|
|
2152
2131
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: getMargin(margin), children: [
|
|
2153
2132
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components29.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
@@ -2177,7 +2156,7 @@ var ModalRenderer = {
|
|
|
2177
2156
|
|
|
2178
2157
|
// ../renderers/src/MoneyInputRenderer.tsx
|
|
2179
2158
|
var import_components31 = require("@transferwise/components");
|
|
2180
|
-
var
|
|
2159
|
+
var import_react11 = require("react");
|
|
2181
2160
|
var import_react_intl11 = require("react-intl");
|
|
2182
2161
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2183
2162
|
var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
@@ -2200,7 +2179,7 @@ function MoneyInputRendererComponent(props) {
|
|
|
2200
2179
|
onAmountChange,
|
|
2201
2180
|
onCurrencyChange
|
|
2202
2181
|
} = props;
|
|
2203
|
-
(0,
|
|
2182
|
+
(0, import_react11.useEffect)(() => {
|
|
2204
2183
|
if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
|
|
2205
2184
|
onCurrencyChange(0);
|
|
2206
2185
|
}
|
|
@@ -2342,7 +2321,7 @@ function InlineComponent(props) {
|
|
|
2342
2321
|
|
|
2343
2322
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
2344
2323
|
var import_components33 = require("@transferwise/components");
|
|
2345
|
-
var
|
|
2324
|
+
var import_react12 = require("react");
|
|
2346
2325
|
var import_react_intl13 = require("react-intl");
|
|
2347
2326
|
|
|
2348
2327
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
@@ -2359,7 +2338,7 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
2359
2338
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2360
2339
|
function DefaultComponent(props) {
|
|
2361
2340
|
const { formatMessage } = (0, import_react_intl13.useIntl)();
|
|
2362
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
2341
|
+
const [stagedIndices, setStagedIndices] = (0, import_react12.useState)();
|
|
2363
2342
|
const {
|
|
2364
2343
|
id,
|
|
2365
2344
|
autoComplete,
|
|
@@ -2517,6 +2496,7 @@ var MultiSelectInputRenderer = {
|
|
|
2517
2496
|
var import_components36 = require("@transferwise/components");
|
|
2518
2497
|
|
|
2519
2498
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
2499
|
+
var import_react13 = require("react");
|
|
2520
2500
|
var import_components35 = require("@transferwise/components");
|
|
2521
2501
|
var import_classnames4 = __toESM(require_classnames());
|
|
2522
2502
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
@@ -2530,9 +2510,17 @@ function UploadFieldInput({
|
|
|
2530
2510
|
}) {
|
|
2531
2511
|
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
2532
2512
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2513
|
+
const message = validation == null ? void 0 : validation.message;
|
|
2514
|
+
const ref = (0, import_react13.useRef)(null);
|
|
2515
|
+
(0, import_react13.useEffect)(() => {
|
|
2516
|
+
if (message) {
|
|
2517
|
+
scrollToIfNotVisible(ref.current);
|
|
2518
|
+
}
|
|
2519
|
+
}, [message]);
|
|
2533
2520
|
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
2534
2521
|
"div",
|
|
2535
2522
|
{
|
|
2523
|
+
ref,
|
|
2536
2524
|
className: (0, import_classnames4.default)("form-group d-block", {
|
|
2537
2525
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
2538
2526
|
}),
|
|
@@ -2657,6 +2645,8 @@ var NumberInputRenderer = {
|
|
|
2657
2645
|
label: title,
|
|
2658
2646
|
description,
|
|
2659
2647
|
validation: validationState,
|
|
2648
|
+
inlineAlert: props.inlineAlert,
|
|
2649
|
+
loadingState: props.fieldLoadingState,
|
|
2660
2650
|
help,
|
|
2661
2651
|
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components37.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2662
2652
|
import_components37.Input,
|
|
@@ -2683,9 +2673,9 @@ var import_react_intl15 = require("react-intl");
|
|
|
2683
2673
|
|
|
2684
2674
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
2685
2675
|
var import_components38 = require("@transferwise/components");
|
|
2686
|
-
var
|
|
2676
|
+
var import_react14 = require("react");
|
|
2687
2677
|
function useSnackBarIfAvailable() {
|
|
2688
|
-
const context = (0,
|
|
2678
|
+
const context = (0, import_react14.useContext)(import_components38.SnackbarContext);
|
|
2689
2679
|
return context ? context.createSnackbar : () => {
|
|
2690
2680
|
};
|
|
2691
2681
|
}
|
|
@@ -2779,7 +2769,7 @@ var ProgressRenderer = {
|
|
|
2779
2769
|
var import_components41 = require("@transferwise/components");
|
|
2780
2770
|
var import_icons = require("@transferwise/icons");
|
|
2781
2771
|
var import_classnames6 = __toESM(require_classnames());
|
|
2782
|
-
var
|
|
2772
|
+
var import_react15 = require("react");
|
|
2783
2773
|
var import_react_intl17 = require("react-intl");
|
|
2784
2774
|
|
|
2785
2775
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
@@ -2828,7 +2818,7 @@ function Repeatable(props) {
|
|
|
2828
2818
|
onRemove
|
|
2829
2819
|
} = props;
|
|
2830
2820
|
const { formatMessage } = (0, import_react_intl17.useIntl)();
|
|
2831
|
-
const [openModalType, setOpenModalType] = (0,
|
|
2821
|
+
const [openModalType, setOpenModalType] = (0, import_react15.useState)(null);
|
|
2832
2822
|
const onAddItem = () => {
|
|
2833
2823
|
onAdd();
|
|
2834
2824
|
setOpenModalType("add");
|
|
@@ -3047,7 +3037,7 @@ var ReviewRenderer_default = ReviewRenderer2;
|
|
|
3047
3037
|
|
|
3048
3038
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
3049
3039
|
var import_components45 = require("@transferwise/components");
|
|
3050
|
-
var
|
|
3040
|
+
var import_react16 = require("react");
|
|
3051
3041
|
var import_react_intl22 = require("react-intl");
|
|
3052
3042
|
|
|
3053
3043
|
// ../renderers/src/messages/search.messages.ts
|
|
@@ -3109,7 +3099,7 @@ function BlockSearchRendererComponent({
|
|
|
3109
3099
|
trackEvent,
|
|
3110
3100
|
onChange
|
|
3111
3101
|
}) {
|
|
3112
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3102
|
+
const [hasSearched, setHasSearched] = (0, import_react16.useState)(false);
|
|
3113
3103
|
const { formatMessage } = (0, import_react_intl22.useIntl)();
|
|
3114
3104
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getMargin(margin), children: [
|
|
3115
3105
|
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components45.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons3.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
@@ -3190,7 +3180,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
|
3190
3180
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
3191
3181
|
var import_components46 = require("@transferwise/components");
|
|
3192
3182
|
var import_icons4 = require("@transferwise/icons");
|
|
3193
|
-
var
|
|
3183
|
+
var import_react17 = require("react");
|
|
3194
3184
|
var import_react_intl23 = require("react-intl");
|
|
3195
3185
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3196
3186
|
function InlineSearchRenderer({
|
|
@@ -3203,7 +3193,7 @@ function InlineSearchRenderer({
|
|
|
3203
3193
|
title,
|
|
3204
3194
|
trackEvent
|
|
3205
3195
|
}) {
|
|
3206
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3196
|
+
const [hasSearched, setHasSearched] = (0, import_react17.useState)(false);
|
|
3207
3197
|
const intl = (0, import_react_intl23.useIntl)();
|
|
3208
3198
|
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
3209
3199
|
import_components46.Typeahead,
|
|
@@ -3363,7 +3353,7 @@ function RadioInputRendererComponent(props) {
|
|
|
3363
3353
|
|
|
3364
3354
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
3365
3355
|
var import_components49 = require("@transferwise/components");
|
|
3366
|
-
var
|
|
3356
|
+
var import_react18 = require("react");
|
|
3367
3357
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
3368
3358
|
function TabInputRendererComponent(props) {
|
|
3369
3359
|
const {
|
|
@@ -3378,7 +3368,7 @@ function TabInputRendererComponent(props) {
|
|
|
3378
3368
|
validationState,
|
|
3379
3369
|
onSelect
|
|
3380
3370
|
} = props;
|
|
3381
|
-
(0,
|
|
3371
|
+
(0, import_react18.useEffect)(() => {
|
|
3382
3372
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
3383
3373
|
onSelect(0);
|
|
3384
3374
|
}
|
|
@@ -3491,7 +3481,7 @@ function SelectInputRendererComponent(props) {
|
|
|
3491
3481
|
}
|
|
3492
3482
|
|
|
3493
3483
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
3494
|
-
var
|
|
3484
|
+
var import_react19 = require("react");
|
|
3495
3485
|
var import_components51 = require("@transferwise/components");
|
|
3496
3486
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3497
3487
|
function SegmentedInputRendererComponent(props) {
|
|
@@ -3506,7 +3496,7 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3506
3496
|
validationState,
|
|
3507
3497
|
onSelect
|
|
3508
3498
|
} = props;
|
|
3509
|
-
(0,
|
|
3499
|
+
(0, import_react19.useEffect)(() => {
|
|
3510
3500
|
if (!isValidIndex3(selectedIndex, options.length)) {
|
|
3511
3501
|
onSelect(0);
|
|
3512
3502
|
}
|
|
@@ -3624,7 +3614,7 @@ var StatusListRenderer = {
|
|
|
3624
3614
|
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: getMargin(margin), children: [
|
|
3625
3615
|
title ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components53.Header, { title }) : null,
|
|
3626
3616
|
items.map((item) => {
|
|
3627
|
-
const { callToAction, description,
|
|
3617
|
+
const { callToAction, description, title: itemTitle } = item;
|
|
3628
3618
|
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
3629
3619
|
import_components53.ListItem,
|
|
3630
3620
|
{
|
|
@@ -3634,12 +3624,9 @@ var StatusListRenderer = {
|
|
|
3634
3624
|
additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
3635
3625
|
import_components53.ListItem.AdditionalInfo,
|
|
3636
3626
|
{
|
|
3637
|
-
action: {
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
label: callToAction.title,
|
|
3641
|
-
target: "_blank"
|
|
3642
|
-
}
|
|
3627
|
+
action: __spreadValues({
|
|
3628
|
+
label: callToAction.title
|
|
3629
|
+
}, callToAction.getAnchorProps())
|
|
3643
3630
|
}
|
|
3644
3631
|
) : void 0
|
|
3645
3632
|
},
|
|
@@ -3674,12 +3661,12 @@ var StatusListRenderer_default = StatusListRenderer;
|
|
|
3674
3661
|
|
|
3675
3662
|
// ../renderers/src/utils/useCustomTheme.ts
|
|
3676
3663
|
var import_components_theming = require("@wise/components-theming");
|
|
3677
|
-
var
|
|
3664
|
+
var import_react20 = require("react");
|
|
3678
3665
|
var ThemeRequiredEventName = "Theme Required";
|
|
3679
3666
|
var useCustomTheme = (theme, trackEvent) => {
|
|
3680
3667
|
const theming = (0, import_components_theming.useTheme)();
|
|
3681
|
-
const previousTheme = (0,
|
|
3682
|
-
(0,
|
|
3668
|
+
const previousTheme = (0, import_react20.useMemo)(() => theming.theme, []);
|
|
3669
|
+
(0, import_react20.useEffect)(() => {
|
|
3683
3670
|
theming.setTheme(theme);
|
|
3684
3671
|
trackEvent(ThemeRequiredEventName, { theme });
|
|
3685
3672
|
return theme !== previousTheme ? () => {
|
|
@@ -3692,7 +3679,7 @@ var useCustomTheme = (theme, trackEvent) => {
|
|
|
3692
3679
|
|
|
3693
3680
|
// ../renderers/src/step/StepFooter.tsx
|
|
3694
3681
|
var import_components54 = require("@transferwise/components");
|
|
3695
|
-
var
|
|
3682
|
+
var import_react21 = require("react");
|
|
3696
3683
|
var import_react_intl25 = require("react-intl");
|
|
3697
3684
|
|
|
3698
3685
|
// ../renderers/src/messages/step.messages.ts
|
|
@@ -3720,7 +3707,7 @@ var DefaultFooter = ({ footer }) => {
|
|
|
3720
3707
|
};
|
|
3721
3708
|
var FooterWithScrollButton = ({ footer }) => {
|
|
3722
3709
|
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3723
|
-
const endOfLayoutRef = (0,
|
|
3710
|
+
const endOfLayoutRef = (0, import_react21.useRef)(null);
|
|
3724
3711
|
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
3725
3712
|
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3726
3713
|
import_components54.Button,
|
|
@@ -3749,8 +3736,8 @@ var FooterWithScrollButton = ({ footer }) => {
|
|
|
3749
3736
|
] });
|
|
3750
3737
|
};
|
|
3751
3738
|
var useIsElementVisible = (elementRef) => {
|
|
3752
|
-
const [isVisible, setIsVisible] = (0,
|
|
3753
|
-
(0,
|
|
3739
|
+
const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
|
|
3740
|
+
(0, import_react21.useEffect)(() => {
|
|
3754
3741
|
const element = elementRef.current;
|
|
3755
3742
|
if (!element) return;
|
|
3756
3743
|
const observer = new IntersectionObserver(([entry]) => {
|
|
@@ -3934,7 +3921,7 @@ function StepRendererComponent(props) {
|
|
|
3934
3921
|
|
|
3935
3922
|
// ../renderers/src/TabsRenderer.tsx
|
|
3936
3923
|
var import_components59 = require("@transferwise/components");
|
|
3937
|
-
var
|
|
3924
|
+
var import_react22 = require("react");
|
|
3938
3925
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
3939
3926
|
var TabsRenderer = {
|
|
3940
3927
|
canRenderType: "tabs",
|
|
@@ -3953,7 +3940,7 @@ var TabsRenderer = {
|
|
|
3953
3940
|
}
|
|
3954
3941
|
};
|
|
3955
3942
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
3956
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3943
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
3957
3944
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
3958
3945
|
import_components59.Tabs,
|
|
3959
3946
|
{
|
|
@@ -3974,7 +3961,7 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3974
3961
|
}
|
|
3975
3962
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
3976
3963
|
var _a;
|
|
3977
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3964
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
3978
3965
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getMargin(margin), children: [
|
|
3979
3966
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
3980
3967
|
import_components59.SegmentedControl,
|
|
@@ -3996,7 +3983,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3996
3983
|
}
|
|
3997
3984
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3998
3985
|
var _a;
|
|
3999
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3986
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
4000
3987
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getMargin(margin), children: [
|
|
4001
3988
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
4002
3989
|
import_components59.Chips,
|
|
@@ -4104,6 +4091,8 @@ var TextInputRenderer = {
|
|
|
4104
4091
|
label: title,
|
|
4105
4092
|
description,
|
|
4106
4093
|
validation: validationState,
|
|
4094
|
+
inlineAlert: props.inlineAlert,
|
|
4095
|
+
loadingState: props.fieldLoadingState,
|
|
4107
4096
|
help,
|
|
4108
4097
|
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components61.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
4109
4098
|
}
|
|
@@ -4233,7 +4222,7 @@ var LargeUploadRenderer = {
|
|
|
4233
4222
|
|
|
4234
4223
|
// ../renderers/src/UpsellRenderer.tsx
|
|
4235
4224
|
var import_components63 = require("@transferwise/components");
|
|
4236
|
-
var
|
|
4225
|
+
var import_react23 = require("react");
|
|
4237
4226
|
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
4238
4227
|
var UpsellRenderer = {
|
|
4239
4228
|
canRenderType: "upsell",
|
|
@@ -4241,19 +4230,16 @@ var UpsellRenderer = {
|
|
|
4241
4230
|
};
|
|
4242
4231
|
function UpsellRendererComponent(props) {
|
|
4243
4232
|
const { text, callToAction, media, margin, onDismiss } = props;
|
|
4244
|
-
const [isVisible, setIsVisible] = (0,
|
|
4233
|
+
const [isVisible, setIsVisible] = (0, import_react23.useState)(true);
|
|
4245
4234
|
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
4246
4235
|
import_components63.Nudge,
|
|
4247
4236
|
{
|
|
4248
4237
|
className: getMargin(margin),
|
|
4249
4238
|
mediaName: getMediaName(media),
|
|
4250
4239
|
title: text,
|
|
4251
|
-
action: {
|
|
4252
|
-
href: callToAction.href,
|
|
4253
|
-
onClick: callToAction.href ? void 0 : callToAction.onClick,
|
|
4254
|
-
target: callToAction.href ? "_blank" : void 0,
|
|
4240
|
+
action: __spreadValues({
|
|
4255
4241
|
text: callToAction.title
|
|
4256
|
-
},
|
|
4242
|
+
}, callToAction.getAnchorProps()),
|
|
4257
4243
|
onDismiss: onDismiss ? () => {
|
|
4258
4244
|
setIsVisible(false);
|
|
4259
4245
|
onDismiss();
|
|
@@ -4263,7 +4249,7 @@ function UpsellRendererComponent(props) {
|
|
|
4263
4249
|
}
|
|
4264
4250
|
var urnPrefix2 = "urn:wise:illustrations:";
|
|
4265
4251
|
var getMediaName = (media) => {
|
|
4266
|
-
if (media
|
|
4252
|
+
if ((media == null ? void 0 : media.type) === "image" && media.uri.startsWith(urnPrefix2)) {
|
|
4267
4253
|
const mediaName = media.uri.substring(urnPrefix2.length);
|
|
4268
4254
|
if (supportedMediaNames.includes(mediaName)) {
|
|
4269
4255
|
return mediaName;
|
|
@@ -4382,8 +4368,117 @@ var InitialLoadingStateRenderer = {
|
|
|
4382
4368
|
)
|
|
4383
4369
|
};
|
|
4384
4370
|
|
|
4371
|
+
// src/dynamicFlow/DynamicFlowModal.tsx
|
|
4372
|
+
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
4373
|
+
var import_components66 = require("@transferwise/components");
|
|
4374
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
4375
|
+
function DynamicFlowModal(props) {
|
|
4376
|
+
const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
|
|
4377
|
+
const dfProps = useWiseToCoreProps(rest);
|
|
4378
|
+
const df = (0, import_dynamic_flow_client.useDynamicFlowModal)(dfProps);
|
|
4379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
4380
|
+
import_components66.Modal,
|
|
4381
|
+
__spreadProps(__spreadValues({
|
|
4382
|
+
className: `dynamic-flow-modal ${className}`,
|
|
4383
|
+
disableDimmerClickToClose: true
|
|
4384
|
+
}, df.modal), {
|
|
4385
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
|
|
4386
|
+
})
|
|
4387
|
+
);
|
|
4388
|
+
}
|
|
4389
|
+
|
|
4390
|
+
// src/dynamicFlow/getMergedRenderers.tsx
|
|
4391
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
4392
|
+
var wiseRenderers = getWiseRenderers();
|
|
4393
|
+
var getMergedRenderers = (props) => {
|
|
4394
|
+
var _d, _e;
|
|
4395
|
+
const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
|
|
4396
|
+
const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
|
|
4397
|
+
const subflowRenderer = (0, import_dynamic_flow_client2.getDynamicSubflowRenderer)({
|
|
4398
|
+
Component: (_b) => {
|
|
4399
|
+
var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
|
|
4400
|
+
const action = {
|
|
4401
|
+
url: initialRequest.url,
|
|
4402
|
+
method: initialRequest.method,
|
|
4403
|
+
data: initialRequest.body
|
|
4404
|
+
};
|
|
4405
|
+
return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
4406
|
+
DynamicFlowModal,
|
|
4407
|
+
__spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
|
|
4408
|
+
features: subflowFeatures,
|
|
4409
|
+
initialAction: action
|
|
4410
|
+
})
|
|
4411
|
+
);
|
|
4412
|
+
}
|
|
4413
|
+
});
|
|
4414
|
+
const loadingStateRenderer = ((_d = props.features) == null ? void 0 : _d.initialLoader) ? [InitialLoadingStateRenderer] : [];
|
|
4415
|
+
return [...(_e = props.renderers) != null ? _e : [], subflowRenderer, ...loadingStateRenderer, ...wiseRenderers];
|
|
4416
|
+
};
|
|
4417
|
+
|
|
4418
|
+
// src/dynamicFlow/telemetry/getLogEvent.ts
|
|
4419
|
+
var getLogEvent = (onLog) => (level, message, extra) => {
|
|
4420
|
+
const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
|
|
4421
|
+
dfWiseVersion: appVersion
|
|
4422
|
+
});
|
|
4423
|
+
if (level !== "info" && onLog) {
|
|
4424
|
+
if (onLog) {
|
|
4425
|
+
onLog(level, message, extraWithVersion);
|
|
4426
|
+
} else {
|
|
4427
|
+
logToRollbar(level, message, extraWithVersion);
|
|
4428
|
+
}
|
|
4429
|
+
}
|
|
4430
|
+
};
|
|
4431
|
+
var logToRollbar = (level, message, extra) => {
|
|
4432
|
+
try {
|
|
4433
|
+
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
4434
|
+
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
4435
|
+
} catch (error) {
|
|
4436
|
+
console.error("Failed to log to Rollbar", error);
|
|
4437
|
+
}
|
|
4438
|
+
};
|
|
4439
|
+
|
|
4440
|
+
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
4441
|
+
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
4442
|
+
|
|
4443
|
+
// src/dynamicFlow/telemetry/dispatchAnalyticsEvent.ts
|
|
4444
|
+
var dispatchAnalyticsEvent = (eventName, properties) => {
|
|
4445
|
+
const props = __spreadValues({ dfFallbackAnalytics: true }, properties);
|
|
4446
|
+
if (typeof window !== "undefined" && window.mixpanel && typeof window.mixpanel.track === "function") {
|
|
4447
|
+
window.mixpanel.track(eventName, props);
|
|
4448
|
+
}
|
|
4449
|
+
};
|
|
4450
|
+
|
|
4451
|
+
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
4452
|
+
var prefix = "Dynamic Flow - ";
|
|
4453
|
+
var getTrackEvent = (onEvent, onAnalytics) => {
|
|
4454
|
+
const dispatchAnalytics = !onAnalytics && !onEvent ? dispatchAnalyticsEvent : onAnalytics;
|
|
4455
|
+
return (name, properties) => {
|
|
4456
|
+
onEvent == null ? void 0 : onEvent(name, properties);
|
|
4457
|
+
if (includeInAnalytics(name)) {
|
|
4458
|
+
dispatchAnalytics == null ? void 0 : dispatchAnalytics(name, properties);
|
|
4459
|
+
}
|
|
4460
|
+
};
|
|
4461
|
+
};
|
|
4462
|
+
var includeInAnalytics = (name) => {
|
|
4463
|
+
const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
|
|
4464
|
+
if (isCoreEventName(eventName)) {
|
|
4465
|
+
return true;
|
|
4466
|
+
}
|
|
4467
|
+
if (eventName in customEventsToAnalytics) {
|
|
4468
|
+
return customEventsToAnalytics[eventName];
|
|
4469
|
+
}
|
|
4470
|
+
return true;
|
|
4471
|
+
};
|
|
4472
|
+
var isCoreEventName = (eventName) => {
|
|
4473
|
+
return import_dynamic_flow_client3.eventNames.includes(eventName);
|
|
4474
|
+
};
|
|
4475
|
+
var customEventsToAnalytics = {
|
|
4476
|
+
"Theme Required": false
|
|
4477
|
+
// Excluded from analytics
|
|
4478
|
+
};
|
|
4479
|
+
|
|
4385
4480
|
// src/dynamicFlow/useOnCopy.tsx
|
|
4386
|
-
var
|
|
4481
|
+
var import_react24 = require("react");
|
|
4387
4482
|
var import_react_intl29 = require("react-intl");
|
|
4388
4483
|
|
|
4389
4484
|
// src/dynamicFlow/messages.ts
|
|
@@ -4405,7 +4500,7 @@ var messages_default = (0, import_react_intl28.defineMessages)({
|
|
|
4405
4500
|
var useOnCopy = () => {
|
|
4406
4501
|
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
4407
4502
|
const createSnackBar = useSnackBarIfAvailable();
|
|
4408
|
-
return (0,
|
|
4503
|
+
return (0, import_react24.useCallback)(
|
|
4409
4504
|
(copiedContent) => {
|
|
4410
4505
|
if (copiedContent) {
|
|
4411
4506
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -4418,11 +4513,11 @@ var useOnCopy = () => {
|
|
|
4418
4513
|
};
|
|
4419
4514
|
|
|
4420
4515
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
4421
|
-
var
|
|
4516
|
+
var import_react25 = require("react");
|
|
4422
4517
|
var import_react_intl30 = require("react-intl");
|
|
4423
4518
|
var useWiseHttpClient = (httpClient) => {
|
|
4424
4519
|
const { locale } = (0, import_react_intl30.useIntl)();
|
|
4425
|
-
return (0,
|
|
4520
|
+
return (0, import_react25.useCallback)(
|
|
4426
4521
|
async (input, init = {}) => {
|
|
4427
4522
|
const headers = new Headers(init.headers);
|
|
4428
4523
|
headers.set("accept-language", locale);
|
|
@@ -4443,54 +4538,10 @@ var handleRejection = (error) => {
|
|
|
4443
4538
|
throw error;
|
|
4444
4539
|
};
|
|
4445
4540
|
|
|
4446
|
-
// src/dynamicFlow/
|
|
4447
|
-
var
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
4451
|
-
var import_components66 = require("@transferwise/components");
|
|
4452
|
-
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
4453
|
-
function DynamicFlowModal(props) {
|
|
4454
|
-
const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
|
|
4455
|
-
const dfProps = useWiseToCoreProps(rest);
|
|
4456
|
-
const df = (0, import_dynamic_flow_client2.useDynamicFlowModal)(dfProps);
|
|
4457
|
-
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
4458
|
-
import_components66.Modal,
|
|
4459
|
-
__spreadProps(__spreadValues({
|
|
4460
|
-
className: `dynamic-flow-modal ${className}`,
|
|
4461
|
-
disableDimmerClickToClose: true
|
|
4462
|
-
}, df.modal), {
|
|
4463
|
-
body: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
|
|
4464
|
-
})
|
|
4465
|
-
);
|
|
4466
|
-
}
|
|
4467
|
-
|
|
4468
|
-
// src/dynamicFlow/getMergedRenderers.tsx
|
|
4469
|
-
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
4470
|
-
var wiseRenderers = getWiseRenderers();
|
|
4471
|
-
var getMergedRenderers = (props) => {
|
|
4472
|
-
var _d, _e;
|
|
4473
|
-
const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
|
|
4474
|
-
const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
|
|
4475
|
-
const subflowRenderer = (0, import_dynamic_flow_client3.getDynamicSubflowRenderer)({
|
|
4476
|
-
Component: (_b) => {
|
|
4477
|
-
var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
|
|
4478
|
-
const action = {
|
|
4479
|
-
url: initialRequest.url,
|
|
4480
|
-
method: initialRequest.method,
|
|
4481
|
-
data: initialRequest.body
|
|
4482
|
-
};
|
|
4483
|
-
return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
4484
|
-
DynamicFlowModal,
|
|
4485
|
-
__spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
|
|
4486
|
-
features: subflowFeatures,
|
|
4487
|
-
initialAction: action
|
|
4488
|
-
})
|
|
4489
|
-
);
|
|
4490
|
-
}
|
|
4491
|
-
});
|
|
4492
|
-
const loadingStateRenderer = ((_d = props.features) == null ? void 0 : _d.initialLoader) ? [InitialLoadingStateRenderer] : [];
|
|
4493
|
-
return [...(_e = props.renderers) != null ? _e : [], subflowRenderer, ...loadingStateRenderer, ...wiseRenderers];
|
|
4541
|
+
// src/dynamicFlow/useCreateSnackBar.tsx
|
|
4542
|
+
var useCreateSnackBar = () => {
|
|
4543
|
+
const createSnackBar = useSnackBarIfAvailable();
|
|
4544
|
+
return createSnackBar;
|
|
4494
4545
|
};
|
|
4495
4546
|
|
|
4496
4547
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
@@ -4503,12 +4554,14 @@ var useWiseToCoreProps = (props) => {
|
|
|
4503
4554
|
onAnalytics,
|
|
4504
4555
|
onEvent,
|
|
4505
4556
|
onLink = openLinkInNewTab,
|
|
4557
|
+
onNotification,
|
|
4506
4558
|
onLog
|
|
4507
4559
|
} = props;
|
|
4508
4560
|
const httpClient = useWiseHttpClient(customFetch);
|
|
4509
|
-
const mergedRenderers = (0,
|
|
4510
|
-
const
|
|
4511
|
-
const
|
|
4561
|
+
const mergedRenderers = (0, import_react26.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
4562
|
+
const createSnackBar = useCreateSnackBar();
|
|
4563
|
+
const logEvent = (0, import_react26.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
4564
|
+
const trackEvent = (0, import_react26.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
4512
4565
|
const onCopy = useOnCopy();
|
|
4513
4566
|
return __spreadProps(__spreadValues({}, props), {
|
|
4514
4567
|
httpClient,
|
|
@@ -4517,6 +4570,7 @@ var useWiseToCoreProps = (props) => {
|
|
|
4517
4570
|
onEvent: trackEvent,
|
|
4518
4571
|
onLog: logEvent,
|
|
4519
4572
|
onCopy,
|
|
4573
|
+
onNotification: onNotification != null ? onNotification : createSnackBar,
|
|
4520
4574
|
onLink
|
|
4521
4575
|
});
|
|
4522
4576
|
};
|
|
@@ -4552,14 +4606,14 @@ function DynamicFlow(props) {
|
|
|
4552
4606
|
}
|
|
4553
4607
|
|
|
4554
4608
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
4555
|
-
var
|
|
4609
|
+
var import_react27 = require("react");
|
|
4556
4610
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
4557
4611
|
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
4558
|
-
var DynamicFlowWithRef = (0,
|
|
4612
|
+
var DynamicFlowWithRef = (0, import_react27.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
4559
4613
|
const { className = "" } = props;
|
|
4560
4614
|
const dfProps = useWiseToCoreProps(props);
|
|
4561
4615
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
4562
|
-
(0,
|
|
4616
|
+
(0, import_react27.useImperativeHandle)(
|
|
4563
4617
|
ref,
|
|
4564
4618
|
() => ({
|
|
4565
4619
|
getValue: async () => {
|
|
@@ -5356,7 +5410,7 @@ var zh_CN_default = {
|
|
|
5356
5410
|
"df.wise.ControlFeedback.required": "\u8BF7\u586B\u5199\u6B64\u5B57\u6BB5\u3002",
|
|
5357
5411
|
"df.wise.ControlFeedback.type": "\u7C7B\u578B\u9519\u8BEF",
|
|
5358
5412
|
"df.wise.CopyFeedback.copy": "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
5359
|
-
"df.wise.CopyFeedback.copyFailed": "\u590D\u5236\u5230\u526A\u8D34\u677F
|
|
5413
|
+
"df.wise.CopyFeedback.copyFailed": "\u65E0\u6CD5\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
5360
5414
|
"df.wise.DynamicParagraph.copied": "\u5DF2\u590D\u5236\u5230\u526A\u8D34\u677F",
|
|
5361
5415
|
"df.wise.DynamicParagraph.copy": "\u590D\u5236",
|
|
5362
5416
|
"df.wise.ErrorBoundary.errorAlert": "\u51FA\u9519\u4E86\u3002",
|
|
@@ -5371,7 +5425,7 @@ var zh_CN_default = {
|
|
|
5371
5425
|
"df.wise.MultipleFileUploadSchema.maxItemsError": "\u8BF7\u4E0A\u4F20\u4E0D\u8D85\u8FC7 {maxItems} \u4E2A\u6587\u4EF6\u3002",
|
|
5372
5426
|
"df.wise.MultipleFileUploadSchema.minItemsError": "\u8BF7\u4E0A\u4F20\u81F3\u5C11 {minItems} \u4E2A\u6587\u4EF6\u3002",
|
|
5373
5427
|
"df.wise.PersistAsyncSchema.genericError": "\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002",
|
|
5374
|
-
"df.wise.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026",
|
|
5428
|
+
"df.wise.SearchLayout.loading": "\u6B63\u5728\u52A0\u8F7D\u2026\u2026",
|
|
5375
5429
|
"df.wise.back.label": "\u8FD4\u56DE",
|
|
5376
5430
|
"df.wise.filter.noResults": "\u6682\u65E0\u7ED3\u679C",
|
|
5377
5431
|
"df.wise.filter.placeholder": "\u5F00\u59CB\u8F93\u5165\u4EE5\u641C\u7D22",
|