@wise/dynamic-flow-client-internal 5.23.0 → 5.24.0-experimental-9265cac
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 +33 -0
- package/build/main.js +1924 -680
- package/build/main.mjs +1825 -581
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/dynamicFlow/context-menu/useDFContextMenu.d.ts.map +1 -1
- package/build/types/dynamicFlow/getMergedRenderers.d.ts.map +1 -1
- package/build/types/dynamicFlow/messages.d.ts.map +1 -1
- package/build/types/dynamicFlow/renderers.d.ts +11 -5
- package/build/types/dynamicFlow/renderers.d.ts.map +1 -1
- package/build/types/dynamicFlow/telemetry/dispatchAnalyticsEvent.d.ts.map +1 -1
- package/build/types/dynamicFlow/telemetry/getLogEvent.d.ts.map +1 -1
- package/build/types/dynamicFlow/telemetry/getTrackEvent.d.ts.map +1 -1
- package/build/types/dynamicFlow/useWiseHttpClient.d.ts.map +1 -1
- package/build/types/dynamicFlow/useWiseToCoreProps.d.ts.map +1 -1
- package/build/types/i18n/index.d.ts.map +1 -1
- package/build/types/test-utils/NeptuneProviders.d.ts.map +1 -1
- package/build/types/test-utils/respond-with.d.ts.map +1 -1
- package/build/types/test-utils/rtl-utils.d.ts.map +1 -1
- package/build/types/test-utils/wait.d.ts.map +1 -1
- package/package.json +19 -19
package/build/main.js
CHANGED
|
@@ -329,7 +329,7 @@ var recursivelyRemoveNullish = (element) => {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
332
|
-
var
|
|
332
|
+
var import_react27 = require("react");
|
|
333
333
|
|
|
334
334
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
335
335
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
@@ -660,7 +660,7 @@ var AvatarMedia = ({
|
|
|
660
660
|
}
|
|
661
661
|
);
|
|
662
662
|
}
|
|
663
|
-
const avatarsWithoutBadges = avatars.filter(({ asset, icon }) => asset || icon).slice(0, 2).map(({ asset, icon, backgroundColor, color }) => ({
|
|
663
|
+
const avatarsWithoutBadges = avatars.filter(({ asset, icon }) => Boolean(asset || icon)).slice(0, 2).map(({ asset, icon, backgroundColor, color }) => ({
|
|
664
664
|
asset: icon != null ? icon : asset,
|
|
665
665
|
style: { backgroundColor, color }
|
|
666
666
|
}));
|
|
@@ -747,16 +747,19 @@ var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
|
|
|
747
747
|
const iconNode = getIconNode(icon);
|
|
748
748
|
const badge = getBadgedMedia(iconNode, imageNode, size);
|
|
749
749
|
if (badge) {
|
|
750
|
-
return badge;
|
|
750
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: badge });
|
|
751
751
|
}
|
|
752
752
|
if (imageNode) {
|
|
753
|
-
return preferAvatar ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components5.AvatarView, { children: imageNode }) :
|
|
753
|
+
return preferAvatar ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components5.AvatarView, { children: imageNode }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
|
|
754
|
+
imageNode,
|
|
755
|
+
" "
|
|
756
|
+
] });
|
|
754
757
|
}
|
|
755
758
|
if (iconNode && icon) {
|
|
756
759
|
if ("text" in icon || size === 48) {
|
|
757
760
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components5.AvatarView, { size, children: iconNode });
|
|
758
761
|
}
|
|
759
|
-
return iconNode;
|
|
762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: iconNode });
|
|
760
763
|
}
|
|
761
764
|
return null;
|
|
762
765
|
};
|
|
@@ -1083,54 +1086,1420 @@ var CheckboxItemComponent = (props) => {
|
|
|
1083
1086
|
}, getSupportingValues(supportingValues))
|
|
1084
1087
|
) });
|
|
1085
1088
|
};
|
|
1086
|
-
var SwitchItemComponent = (props) => {
|
|
1089
|
+
var SwitchItemComponent = (props) => {
|
|
1090
|
+
const {
|
|
1091
|
+
additionalText,
|
|
1092
|
+
description,
|
|
1093
|
+
disabled,
|
|
1094
|
+
inlineAlert,
|
|
1095
|
+
media,
|
|
1096
|
+
supportingValues,
|
|
1097
|
+
title,
|
|
1098
|
+
validationState,
|
|
1099
|
+
value,
|
|
1100
|
+
features,
|
|
1101
|
+
onChange
|
|
1102
|
+
} = props;
|
|
1103
|
+
const { ref } = useScrollToError(validationState, features);
|
|
1104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1105
|
+
import_components11.ListItem,
|
|
1106
|
+
__spreadValues({
|
|
1107
|
+
title,
|
|
1108
|
+
subtitle: description,
|
|
1109
|
+
additionalInfo: getAdditionalText(additionalText),
|
|
1110
|
+
media: getMedia(media, false),
|
|
1111
|
+
disabled,
|
|
1112
|
+
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
1113
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Switch, { checked: value, onClick: () => onChange(!value) })
|
|
1114
|
+
}, getSupportingValues(supportingValues))
|
|
1115
|
+
) });
|
|
1116
|
+
};
|
|
1117
|
+
var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
1118
|
+
if ((validationState == null ? void 0 : validationState.status) === "invalid") {
|
|
1119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
|
|
1120
|
+
}
|
|
1121
|
+
return getInlineAlert(inlineAlert);
|
|
1122
|
+
};
|
|
1123
|
+
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
1124
|
+
|
|
1125
|
+
// ../renderers/src/CollectionRenderer/CollectionRenderer.tsx
|
|
1126
|
+
var import_components19 = require("@transferwise/components");
|
|
1127
|
+
|
|
1128
|
+
// ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-virtual/dist/esm/index.js
|
|
1129
|
+
var React = __toESM(require("react"), 1);
|
|
1130
|
+
var import_react_dom = require("react-dom");
|
|
1131
|
+
|
|
1132
|
+
// ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
1133
|
+
function memo(getDeps, fn, opts) {
|
|
1134
|
+
var _a;
|
|
1135
|
+
let deps = (_a = opts.initialDeps) != null ? _a : [];
|
|
1136
|
+
let result;
|
|
1137
|
+
let isInitial = true;
|
|
1138
|
+
function memoizedFunction() {
|
|
1139
|
+
var _a2, _b, _c;
|
|
1140
|
+
let depTime;
|
|
1141
|
+
if (opts.key && ((_a2 = opts.debug) == null ? void 0 : _a2.call(opts))) depTime = Date.now();
|
|
1142
|
+
const newDeps = getDeps();
|
|
1143
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
1144
|
+
if (!depsChanged) {
|
|
1145
|
+
return result;
|
|
1146
|
+
}
|
|
1147
|
+
deps = newDeps;
|
|
1148
|
+
let resultTime;
|
|
1149
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
1150
|
+
result = fn(...newDeps);
|
|
1151
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
1152
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
1153
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
1154
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
1155
|
+
const pad = (str, num) => {
|
|
1156
|
+
str = String(str);
|
|
1157
|
+
while (str.length < num) {
|
|
1158
|
+
str = " " + str;
|
|
1159
|
+
}
|
|
1160
|
+
return str;
|
|
1161
|
+
};
|
|
1162
|
+
console.info(
|
|
1163
|
+
`%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
1164
|
+
`
|
|
1165
|
+
font-size: .6rem;
|
|
1166
|
+
font-weight: bold;
|
|
1167
|
+
color: hsl(${Math.max(
|
|
1168
|
+
0,
|
|
1169
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
1170
|
+
)}deg 100% 31%);`,
|
|
1171
|
+
opts == null ? void 0 : opts.key
|
|
1172
|
+
);
|
|
1173
|
+
}
|
|
1174
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
1175
|
+
opts.onChange(result);
|
|
1176
|
+
}
|
|
1177
|
+
isInitial = false;
|
|
1178
|
+
return result;
|
|
1179
|
+
}
|
|
1180
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
1181
|
+
deps = newDeps;
|
|
1182
|
+
};
|
|
1183
|
+
return memoizedFunction;
|
|
1184
|
+
}
|
|
1185
|
+
function notUndefined(value, msg) {
|
|
1186
|
+
if (value === void 0) {
|
|
1187
|
+
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
1188
|
+
} else {
|
|
1189
|
+
return value;
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
1193
|
+
var debounce = (targetWindow, fn, ms) => {
|
|
1194
|
+
let timeoutId;
|
|
1195
|
+
return function(...args) {
|
|
1196
|
+
targetWindow.clearTimeout(timeoutId);
|
|
1197
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
1198
|
+
};
|
|
1199
|
+
};
|
|
1200
|
+
|
|
1201
|
+
// ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/index.js
|
|
1202
|
+
var defaultKeyExtractor = (index) => index;
|
|
1203
|
+
var defaultRangeExtractor = (range) => {
|
|
1204
|
+
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
1205
|
+
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
1206
|
+
const arr = [];
|
|
1207
|
+
for (let i = start; i <= end; i++) {
|
|
1208
|
+
arr.push(i);
|
|
1209
|
+
}
|
|
1210
|
+
return arr;
|
|
1211
|
+
};
|
|
1212
|
+
var addEventListenerOptions = {
|
|
1213
|
+
passive: true
|
|
1214
|
+
};
|
|
1215
|
+
var observeWindowRect = (instance, cb) => {
|
|
1216
|
+
const element = instance.scrollElement;
|
|
1217
|
+
if (!element) {
|
|
1218
|
+
return;
|
|
1219
|
+
}
|
|
1220
|
+
const handler = () => {
|
|
1221
|
+
cb({ width: element.innerWidth, height: element.innerHeight });
|
|
1222
|
+
};
|
|
1223
|
+
handler();
|
|
1224
|
+
element.addEventListener("resize", handler, addEventListenerOptions);
|
|
1225
|
+
return () => {
|
|
1226
|
+
element.removeEventListener("resize", handler);
|
|
1227
|
+
};
|
|
1228
|
+
};
|
|
1229
|
+
var supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
1230
|
+
var observeWindowOffset = (instance, cb) => {
|
|
1231
|
+
const element = instance.scrollElement;
|
|
1232
|
+
if (!element) {
|
|
1233
|
+
return;
|
|
1234
|
+
}
|
|
1235
|
+
const targetWindow = instance.targetWindow;
|
|
1236
|
+
if (!targetWindow) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
let offset = 0;
|
|
1240
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
1241
|
+
targetWindow,
|
|
1242
|
+
() => {
|
|
1243
|
+
cb(offset, false);
|
|
1244
|
+
},
|
|
1245
|
+
instance.options.isScrollingResetDelay
|
|
1246
|
+
);
|
|
1247
|
+
const createHandler = (isScrolling) => () => {
|
|
1248
|
+
offset = element[instance.options.horizontal ? "scrollX" : "scrollY"];
|
|
1249
|
+
fallback();
|
|
1250
|
+
cb(offset, isScrolling);
|
|
1251
|
+
};
|
|
1252
|
+
const handler = createHandler(true);
|
|
1253
|
+
const endHandler = createHandler(false);
|
|
1254
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
1255
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
1256
|
+
if (registerScrollendEvent) {
|
|
1257
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
1258
|
+
}
|
|
1259
|
+
return () => {
|
|
1260
|
+
element.removeEventListener("scroll", handler);
|
|
1261
|
+
if (registerScrollendEvent) {
|
|
1262
|
+
element.removeEventListener("scrollend", endHandler);
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
};
|
|
1266
|
+
var measureElement = (element, entry, instance) => {
|
|
1267
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1268
|
+
const box = entry.borderBoxSize[0];
|
|
1269
|
+
if (box) {
|
|
1270
|
+
const size = Math.round(
|
|
1271
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
1272
|
+
);
|
|
1273
|
+
return size;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
1277
|
+
};
|
|
1278
|
+
var windowScroll = (offset, {
|
|
1279
|
+
adjustments = 0,
|
|
1280
|
+
behavior
|
|
1281
|
+
}, instance) => {
|
|
1282
|
+
var _a, _b;
|
|
1283
|
+
const toOffset = offset + adjustments;
|
|
1284
|
+
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
1285
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
1286
|
+
behavior
|
|
1287
|
+
});
|
|
1288
|
+
};
|
|
1289
|
+
var Virtualizer = class {
|
|
1290
|
+
constructor(opts) {
|
|
1291
|
+
this.unsubs = [];
|
|
1292
|
+
this.scrollElement = null;
|
|
1293
|
+
this.targetWindow = null;
|
|
1294
|
+
this.isScrolling = false;
|
|
1295
|
+
this.scrollState = null;
|
|
1296
|
+
this.measurementsCache = [];
|
|
1297
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
1298
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
1299
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1300
|
+
this.prevLanes = void 0;
|
|
1301
|
+
this.lanesChangedFlag = false;
|
|
1302
|
+
this.lanesSettling = false;
|
|
1303
|
+
this.scrollRect = null;
|
|
1304
|
+
this.scrollOffset = null;
|
|
1305
|
+
this.scrollDirection = null;
|
|
1306
|
+
this.scrollAdjustments = 0;
|
|
1307
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
1308
|
+
this.now = () => {
|
|
1309
|
+
var _a2;
|
|
1310
|
+
var _a, _b, _c;
|
|
1311
|
+
return (_a2 = (_c = (_b = (_a = this.targetWindow) == null ? void 0 : _a.performance) == null ? void 0 : _b.now) == null ? void 0 : _c.call(_b)) != null ? _a2 : Date.now();
|
|
1312
|
+
};
|
|
1313
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
1314
|
+
let _ro = null;
|
|
1315
|
+
const get = () => {
|
|
1316
|
+
if (_ro) {
|
|
1317
|
+
return _ro;
|
|
1318
|
+
}
|
|
1319
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
1320
|
+
return null;
|
|
1321
|
+
}
|
|
1322
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
1323
|
+
entries.forEach((entry) => {
|
|
1324
|
+
const run = () => {
|
|
1325
|
+
const node = entry.target;
|
|
1326
|
+
const index = this.indexFromElement(node);
|
|
1327
|
+
if (!node.isConnected) {
|
|
1328
|
+
this.observer.unobserve(node);
|
|
1329
|
+
return;
|
|
1330
|
+
}
|
|
1331
|
+
if (this.shouldMeasureDuringScroll(index)) {
|
|
1332
|
+
this.resizeItem(
|
|
1333
|
+
index,
|
|
1334
|
+
this.options.measureElement(node, entry, this)
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
};
|
|
1338
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1339
|
+
});
|
|
1340
|
+
});
|
|
1341
|
+
};
|
|
1342
|
+
return {
|
|
1343
|
+
disconnect: () => {
|
|
1344
|
+
var _a;
|
|
1345
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
1346
|
+
_ro = null;
|
|
1347
|
+
},
|
|
1348
|
+
observe: (target) => {
|
|
1349
|
+
var _a;
|
|
1350
|
+
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
1351
|
+
},
|
|
1352
|
+
unobserve: (target) => {
|
|
1353
|
+
var _a;
|
|
1354
|
+
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
1355
|
+
}
|
|
1356
|
+
};
|
|
1357
|
+
})();
|
|
1358
|
+
this.range = null;
|
|
1359
|
+
this.setOptions = (opts2) => {
|
|
1360
|
+
Object.entries(opts2).forEach(([key, value]) => {
|
|
1361
|
+
if (typeof value === "undefined") delete opts2[key];
|
|
1362
|
+
});
|
|
1363
|
+
this.options = __spreadValues({
|
|
1364
|
+
debug: false,
|
|
1365
|
+
initialOffset: 0,
|
|
1366
|
+
overscan: 1,
|
|
1367
|
+
paddingStart: 0,
|
|
1368
|
+
paddingEnd: 0,
|
|
1369
|
+
scrollPaddingStart: 0,
|
|
1370
|
+
scrollPaddingEnd: 0,
|
|
1371
|
+
horizontal: false,
|
|
1372
|
+
getItemKey: defaultKeyExtractor,
|
|
1373
|
+
rangeExtractor: defaultRangeExtractor,
|
|
1374
|
+
onChange: () => {
|
|
1375
|
+
},
|
|
1376
|
+
measureElement,
|
|
1377
|
+
initialRect: { width: 0, height: 0 },
|
|
1378
|
+
scrollMargin: 0,
|
|
1379
|
+
gap: 0,
|
|
1380
|
+
indexAttribute: "data-index",
|
|
1381
|
+
initialMeasurementsCache: [],
|
|
1382
|
+
lanes: 1,
|
|
1383
|
+
isScrollingResetDelay: 150,
|
|
1384
|
+
enabled: true,
|
|
1385
|
+
isRtl: false,
|
|
1386
|
+
useScrollendEvent: false,
|
|
1387
|
+
useAnimationFrameWithResizeObserver: false,
|
|
1388
|
+
laneAssignmentMode: "estimate"
|
|
1389
|
+
}, opts2);
|
|
1390
|
+
};
|
|
1391
|
+
this.notify = (sync) => {
|
|
1392
|
+
var _a, _b;
|
|
1393
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
1394
|
+
};
|
|
1395
|
+
this.maybeNotify = memo(
|
|
1396
|
+
() => {
|
|
1397
|
+
this.calculateRange();
|
|
1398
|
+
return [
|
|
1399
|
+
this.isScrolling,
|
|
1400
|
+
this.range ? this.range.startIndex : null,
|
|
1401
|
+
this.range ? this.range.endIndex : null
|
|
1402
|
+
];
|
|
1403
|
+
},
|
|
1404
|
+
(isScrolling) => {
|
|
1405
|
+
this.notify(isScrolling);
|
|
1406
|
+
},
|
|
1407
|
+
{
|
|
1408
|
+
key: "maybeNotify",
|
|
1409
|
+
debug: () => this.options.debug,
|
|
1410
|
+
initialDeps: [
|
|
1411
|
+
this.isScrolling,
|
|
1412
|
+
this.range ? this.range.startIndex : null,
|
|
1413
|
+
this.range ? this.range.endIndex : null
|
|
1414
|
+
]
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1417
|
+
this.cleanup = () => {
|
|
1418
|
+
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
1419
|
+
this.unsubs = [];
|
|
1420
|
+
this.observer.disconnect();
|
|
1421
|
+
if (this.rafId != null && this.targetWindow) {
|
|
1422
|
+
this.targetWindow.cancelAnimationFrame(this.rafId);
|
|
1423
|
+
this.rafId = null;
|
|
1424
|
+
}
|
|
1425
|
+
this.scrollState = null;
|
|
1426
|
+
this.scrollElement = null;
|
|
1427
|
+
this.targetWindow = null;
|
|
1428
|
+
};
|
|
1429
|
+
this._didMount = () => {
|
|
1430
|
+
return () => {
|
|
1431
|
+
this.cleanup();
|
|
1432
|
+
};
|
|
1433
|
+
};
|
|
1434
|
+
this._willUpdate = () => {
|
|
1435
|
+
var _a2;
|
|
1436
|
+
var _a;
|
|
1437
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
1438
|
+
if (this.scrollElement !== scrollElement) {
|
|
1439
|
+
this.cleanup();
|
|
1440
|
+
if (!scrollElement) {
|
|
1441
|
+
this.maybeNotify();
|
|
1442
|
+
return;
|
|
1443
|
+
}
|
|
1444
|
+
this.scrollElement = scrollElement;
|
|
1445
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
1446
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
1447
|
+
} else {
|
|
1448
|
+
this.targetWindow = (_a2 = (_a = this.scrollElement) == null ? void 0 : _a.window) != null ? _a2 : null;
|
|
1449
|
+
}
|
|
1450
|
+
this.elementsCache.forEach((cached) => {
|
|
1451
|
+
this.observer.observe(cached);
|
|
1452
|
+
});
|
|
1453
|
+
this.unsubs.push(
|
|
1454
|
+
this.options.observeElementRect(this, (rect) => {
|
|
1455
|
+
this.scrollRect = rect;
|
|
1456
|
+
this.maybeNotify();
|
|
1457
|
+
})
|
|
1458
|
+
);
|
|
1459
|
+
this.unsubs.push(
|
|
1460
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
1461
|
+
this.scrollAdjustments = 0;
|
|
1462
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
1463
|
+
this.scrollOffset = offset;
|
|
1464
|
+
this.isScrolling = isScrolling;
|
|
1465
|
+
if (this.scrollState) {
|
|
1466
|
+
this.scheduleScrollReconcile();
|
|
1467
|
+
}
|
|
1468
|
+
this.maybeNotify();
|
|
1469
|
+
})
|
|
1470
|
+
);
|
|
1471
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
1472
|
+
adjustments: void 0,
|
|
1473
|
+
behavior: void 0
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
};
|
|
1477
|
+
this.rafId = null;
|
|
1478
|
+
this.getSize = () => {
|
|
1479
|
+
var _a;
|
|
1480
|
+
if (!this.options.enabled) {
|
|
1481
|
+
this.scrollRect = null;
|
|
1482
|
+
return 0;
|
|
1483
|
+
}
|
|
1484
|
+
this.scrollRect = (_a = this.scrollRect) != null ? _a : this.options.initialRect;
|
|
1485
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
1486
|
+
};
|
|
1487
|
+
this.getScrollOffset = () => {
|
|
1488
|
+
var _a;
|
|
1489
|
+
if (!this.options.enabled) {
|
|
1490
|
+
this.scrollOffset = null;
|
|
1491
|
+
return 0;
|
|
1492
|
+
}
|
|
1493
|
+
this.scrollOffset = (_a = this.scrollOffset) != null ? _a : typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset;
|
|
1494
|
+
return this.scrollOffset;
|
|
1495
|
+
};
|
|
1496
|
+
this.getFurthestMeasurement = (measurements, index) => {
|
|
1497
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
1498
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
1499
|
+
for (let m = index - 1; m >= 0; m--) {
|
|
1500
|
+
const measurement = measurements[m];
|
|
1501
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
1502
|
+
continue;
|
|
1503
|
+
}
|
|
1504
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
1505
|
+
measurement.lane
|
|
1506
|
+
);
|
|
1507
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
1508
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
1509
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
1510
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
1511
|
+
}
|
|
1512
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
1517
|
+
if (a.end === b.end) {
|
|
1518
|
+
return a.index - b.index;
|
|
1519
|
+
}
|
|
1520
|
+
return a.end - b.end;
|
|
1521
|
+
})[0] : void 0;
|
|
1522
|
+
};
|
|
1523
|
+
this.getMeasurementOptions = memo(
|
|
1524
|
+
() => [
|
|
1525
|
+
this.options.count,
|
|
1526
|
+
this.options.paddingStart,
|
|
1527
|
+
this.options.scrollMargin,
|
|
1528
|
+
this.options.getItemKey,
|
|
1529
|
+
this.options.enabled,
|
|
1530
|
+
this.options.lanes,
|
|
1531
|
+
this.options.laneAssignmentMode
|
|
1532
|
+
],
|
|
1533
|
+
(count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode) => {
|
|
1534
|
+
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
1535
|
+
if (lanesChanged) {
|
|
1536
|
+
this.lanesChangedFlag = true;
|
|
1537
|
+
}
|
|
1538
|
+
this.prevLanes = lanes;
|
|
1539
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1540
|
+
return {
|
|
1541
|
+
count,
|
|
1542
|
+
paddingStart,
|
|
1543
|
+
scrollMargin,
|
|
1544
|
+
getItemKey,
|
|
1545
|
+
enabled,
|
|
1546
|
+
lanes,
|
|
1547
|
+
laneAssignmentMode
|
|
1548
|
+
};
|
|
1549
|
+
},
|
|
1550
|
+
{
|
|
1551
|
+
key: false
|
|
1552
|
+
}
|
|
1553
|
+
);
|
|
1554
|
+
this.getMeasurements = memo(
|
|
1555
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
1556
|
+
({
|
|
1557
|
+
count,
|
|
1558
|
+
paddingStart,
|
|
1559
|
+
scrollMargin,
|
|
1560
|
+
getItemKey,
|
|
1561
|
+
enabled,
|
|
1562
|
+
lanes,
|
|
1563
|
+
laneAssignmentMode
|
|
1564
|
+
}, itemSizeCache) => {
|
|
1565
|
+
if (!enabled) {
|
|
1566
|
+
this.measurementsCache = [];
|
|
1567
|
+
this.itemSizeCache.clear();
|
|
1568
|
+
this.laneAssignments.clear();
|
|
1569
|
+
return [];
|
|
1570
|
+
}
|
|
1571
|
+
if (this.laneAssignments.size > count) {
|
|
1572
|
+
for (const index of this.laneAssignments.keys()) {
|
|
1573
|
+
if (index >= count) {
|
|
1574
|
+
this.laneAssignments.delete(index);
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
if (this.lanesChangedFlag) {
|
|
1579
|
+
this.lanesChangedFlag = false;
|
|
1580
|
+
this.lanesSettling = true;
|
|
1581
|
+
this.measurementsCache = [];
|
|
1582
|
+
this.itemSizeCache.clear();
|
|
1583
|
+
this.laneAssignments.clear();
|
|
1584
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1585
|
+
}
|
|
1586
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
1587
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
1588
|
+
this.measurementsCache.forEach((item) => {
|
|
1589
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
const min = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
1593
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1594
|
+
if (this.lanesSettling && this.measurementsCache.length === count) {
|
|
1595
|
+
this.lanesSettling = false;
|
|
1596
|
+
}
|
|
1597
|
+
const measurements = this.measurementsCache.slice(0, min);
|
|
1598
|
+
const laneLastIndex = new Array(lanes).fill(
|
|
1599
|
+
void 0
|
|
1600
|
+
);
|
|
1601
|
+
for (let m = 0; m < min; m++) {
|
|
1602
|
+
const item = measurements[m];
|
|
1603
|
+
if (item) {
|
|
1604
|
+
laneLastIndex[item.lane] = m;
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
for (let i = min; i < count; i++) {
|
|
1608
|
+
const key = getItemKey(i);
|
|
1609
|
+
const cachedLane = this.laneAssignments.get(i);
|
|
1610
|
+
let lane;
|
|
1611
|
+
let start;
|
|
1612
|
+
const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
|
|
1613
|
+
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
1614
|
+
lane = cachedLane;
|
|
1615
|
+
const prevIndex = laneLastIndex[lane];
|
|
1616
|
+
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
1617
|
+
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
1618
|
+
} else {
|
|
1619
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
1620
|
+
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
1621
|
+
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
1622
|
+
if (this.options.lanes > 1 && shouldCacheLane) {
|
|
1623
|
+
this.laneAssignments.set(i, lane);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
const measuredSize = itemSizeCache.get(key);
|
|
1627
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
1628
|
+
const end = start + size;
|
|
1629
|
+
measurements[i] = {
|
|
1630
|
+
index: i,
|
|
1631
|
+
start,
|
|
1632
|
+
size,
|
|
1633
|
+
end,
|
|
1634
|
+
key,
|
|
1635
|
+
lane
|
|
1636
|
+
};
|
|
1637
|
+
laneLastIndex[lane] = i;
|
|
1638
|
+
}
|
|
1639
|
+
this.measurementsCache = measurements;
|
|
1640
|
+
return measurements;
|
|
1641
|
+
},
|
|
1642
|
+
{
|
|
1643
|
+
key: "getMeasurements",
|
|
1644
|
+
debug: () => this.options.debug
|
|
1645
|
+
}
|
|
1646
|
+
);
|
|
1647
|
+
this.calculateRange = memo(
|
|
1648
|
+
() => [
|
|
1649
|
+
this.getMeasurements(),
|
|
1650
|
+
this.getSize(),
|
|
1651
|
+
this.getScrollOffset(),
|
|
1652
|
+
this.options.lanes
|
|
1653
|
+
],
|
|
1654
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
1655
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
1656
|
+
measurements,
|
|
1657
|
+
outerSize,
|
|
1658
|
+
scrollOffset,
|
|
1659
|
+
lanes
|
|
1660
|
+
}) : null;
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
key: "calculateRange",
|
|
1664
|
+
debug: () => this.options.debug
|
|
1665
|
+
}
|
|
1666
|
+
);
|
|
1667
|
+
this.getVirtualIndexes = memo(
|
|
1668
|
+
() => {
|
|
1669
|
+
let startIndex = null;
|
|
1670
|
+
let endIndex = null;
|
|
1671
|
+
const range = this.calculateRange();
|
|
1672
|
+
if (range) {
|
|
1673
|
+
startIndex = range.startIndex;
|
|
1674
|
+
endIndex = range.endIndex;
|
|
1675
|
+
}
|
|
1676
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
1677
|
+
return [
|
|
1678
|
+
this.options.rangeExtractor,
|
|
1679
|
+
this.options.overscan,
|
|
1680
|
+
this.options.count,
|
|
1681
|
+
startIndex,
|
|
1682
|
+
endIndex
|
|
1683
|
+
];
|
|
1684
|
+
},
|
|
1685
|
+
(rangeExtractor, overscan, count, startIndex, endIndex) => {
|
|
1686
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
1687
|
+
startIndex,
|
|
1688
|
+
endIndex,
|
|
1689
|
+
overscan,
|
|
1690
|
+
count
|
|
1691
|
+
});
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
key: "getVirtualIndexes",
|
|
1695
|
+
debug: () => this.options.debug
|
|
1696
|
+
}
|
|
1697
|
+
);
|
|
1698
|
+
this.indexFromElement = (node) => {
|
|
1699
|
+
const attributeName = this.options.indexAttribute;
|
|
1700
|
+
const indexStr = node.getAttribute(attributeName);
|
|
1701
|
+
if (!indexStr) {
|
|
1702
|
+
console.warn(
|
|
1703
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
1704
|
+
);
|
|
1705
|
+
return -1;
|
|
1706
|
+
}
|
|
1707
|
+
return parseInt(indexStr, 10);
|
|
1708
|
+
};
|
|
1709
|
+
this.shouldMeasureDuringScroll = (index) => {
|
|
1710
|
+
var _a2;
|
|
1711
|
+
var _a;
|
|
1712
|
+
if (!this.scrollState || this.scrollState.behavior !== "smooth") {
|
|
1713
|
+
return true;
|
|
1714
|
+
}
|
|
1715
|
+
const scrollIndex = (_a2 = this.scrollState.index) != null ? _a2 : (_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index;
|
|
1716
|
+
if (scrollIndex !== void 0 && this.range) {
|
|
1717
|
+
const bufferSize = Math.max(
|
|
1718
|
+
this.options.overscan,
|
|
1719
|
+
Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
|
|
1720
|
+
);
|
|
1721
|
+
const minIndex = Math.max(0, scrollIndex - bufferSize);
|
|
1722
|
+
const maxIndex = Math.min(
|
|
1723
|
+
this.options.count - 1,
|
|
1724
|
+
scrollIndex + bufferSize
|
|
1725
|
+
);
|
|
1726
|
+
return index >= minIndex && index <= maxIndex;
|
|
1727
|
+
}
|
|
1728
|
+
return true;
|
|
1729
|
+
};
|
|
1730
|
+
this.measureElement = (node) => {
|
|
1731
|
+
if (!node) {
|
|
1732
|
+
this.elementsCache.forEach((cached, key2) => {
|
|
1733
|
+
if (!cached.isConnected) {
|
|
1734
|
+
this.observer.unobserve(cached);
|
|
1735
|
+
this.elementsCache.delete(key2);
|
|
1736
|
+
}
|
|
1737
|
+
});
|
|
1738
|
+
return;
|
|
1739
|
+
}
|
|
1740
|
+
const index = this.indexFromElement(node);
|
|
1741
|
+
const key = this.options.getItemKey(index);
|
|
1742
|
+
const prevNode = this.elementsCache.get(key);
|
|
1743
|
+
if (prevNode !== node) {
|
|
1744
|
+
if (prevNode) {
|
|
1745
|
+
this.observer.unobserve(prevNode);
|
|
1746
|
+
}
|
|
1747
|
+
this.observer.observe(node);
|
|
1748
|
+
this.elementsCache.set(key, node);
|
|
1749
|
+
}
|
|
1750
|
+
if ((!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(index)) {
|
|
1751
|
+
this.resizeItem(index, this.options.measureElement(node, void 0, this));
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
this.resizeItem = (index, size) => {
|
|
1755
|
+
var _a2;
|
|
1756
|
+
var _a;
|
|
1757
|
+
const item = this.measurementsCache[index];
|
|
1758
|
+
if (!item) return;
|
|
1759
|
+
const itemSize = (_a2 = this.itemSizeCache.get(item.key)) != null ? _a2 : item.size;
|
|
1760
|
+
const delta = size - itemSize;
|
|
1761
|
+
if (delta !== 0) {
|
|
1762
|
+
if (((_a = this.scrollState) == null ? void 0 : _a.behavior) !== "smooth" && (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments)) {
|
|
1763
|
+
if (this.options.debug) {
|
|
1764
|
+
console.info("correction", delta);
|
|
1765
|
+
}
|
|
1766
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
1767
|
+
adjustments: this.scrollAdjustments += delta,
|
|
1768
|
+
behavior: void 0
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
1772
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
1773
|
+
this.notify(false);
|
|
1774
|
+
}
|
|
1775
|
+
};
|
|
1776
|
+
this.getVirtualItems = memo(
|
|
1777
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
1778
|
+
(indexes, measurements) => {
|
|
1779
|
+
const virtualItems = [];
|
|
1780
|
+
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
1781
|
+
const i = indexes[k];
|
|
1782
|
+
const measurement = measurements[i];
|
|
1783
|
+
virtualItems.push(measurement);
|
|
1784
|
+
}
|
|
1785
|
+
return virtualItems;
|
|
1786
|
+
},
|
|
1787
|
+
{
|
|
1788
|
+
key: "getVirtualItems",
|
|
1789
|
+
debug: () => this.options.debug
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1792
|
+
this.getVirtualItemForOffset = (offset) => {
|
|
1793
|
+
const measurements = this.getMeasurements();
|
|
1794
|
+
if (measurements.length === 0) {
|
|
1795
|
+
return void 0;
|
|
1796
|
+
}
|
|
1797
|
+
return notUndefined(
|
|
1798
|
+
measurements[findNearestBinarySearch(
|
|
1799
|
+
0,
|
|
1800
|
+
measurements.length - 1,
|
|
1801
|
+
(index) => notUndefined(measurements[index]).start,
|
|
1802
|
+
offset
|
|
1803
|
+
)]
|
|
1804
|
+
);
|
|
1805
|
+
};
|
|
1806
|
+
this.getMaxScrollOffset = () => {
|
|
1807
|
+
if (!this.scrollElement) return 0;
|
|
1808
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
1809
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
1810
|
+
} else {
|
|
1811
|
+
const doc = this.scrollElement.document.documentElement;
|
|
1812
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
1813
|
+
}
|
|
1814
|
+
};
|
|
1815
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
1816
|
+
if (!this.scrollElement) return 0;
|
|
1817
|
+
const size = this.getSize();
|
|
1818
|
+
const scrollOffset = this.getScrollOffset();
|
|
1819
|
+
if (align === "auto") {
|
|
1820
|
+
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
1821
|
+
}
|
|
1822
|
+
if (align === "center") {
|
|
1823
|
+
toOffset += (itemSize - size) / 2;
|
|
1824
|
+
} else if (align === "end") {
|
|
1825
|
+
toOffset -= size;
|
|
1826
|
+
}
|
|
1827
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
1828
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
1829
|
+
};
|
|
1830
|
+
this.getOffsetForIndex = (index, align = "auto") => {
|
|
1831
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
1832
|
+
const size = this.getSize();
|
|
1833
|
+
const scrollOffset = this.getScrollOffset();
|
|
1834
|
+
const item = this.measurementsCache[index];
|
|
1835
|
+
if (!item) return;
|
|
1836
|
+
if (align === "auto") {
|
|
1837
|
+
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
1838
|
+
align = "end";
|
|
1839
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
1840
|
+
align = "start";
|
|
1841
|
+
} else {
|
|
1842
|
+
return [scrollOffset, align];
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
1846
|
+
return [this.getMaxScrollOffset(), align];
|
|
1847
|
+
}
|
|
1848
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
1849
|
+
return [
|
|
1850
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
1851
|
+
align
|
|
1852
|
+
];
|
|
1853
|
+
};
|
|
1854
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
|
|
1855
|
+
const offset = this.getOffsetForAlignment(toOffset, align);
|
|
1856
|
+
const now = this.now();
|
|
1857
|
+
this.scrollState = {
|
|
1858
|
+
index: null,
|
|
1859
|
+
align,
|
|
1860
|
+
behavior,
|
|
1861
|
+
startedAt: now,
|
|
1862
|
+
lastTargetOffset: offset,
|
|
1863
|
+
stableFrames: 0
|
|
1864
|
+
};
|
|
1865
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1866
|
+
this.scheduleScrollReconcile();
|
|
1867
|
+
};
|
|
1868
|
+
this.scrollToIndex = (index, {
|
|
1869
|
+
align: initialAlign = "auto",
|
|
1870
|
+
behavior = "auto"
|
|
1871
|
+
} = {}) => {
|
|
1872
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
1873
|
+
const offsetInfo = this.getOffsetForIndex(index, initialAlign);
|
|
1874
|
+
if (!offsetInfo) {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
const [offset, align] = offsetInfo;
|
|
1878
|
+
const now = this.now();
|
|
1879
|
+
this.scrollState = {
|
|
1880
|
+
index,
|
|
1881
|
+
align,
|
|
1882
|
+
behavior,
|
|
1883
|
+
startedAt: now,
|
|
1884
|
+
lastTargetOffset: offset,
|
|
1885
|
+
stableFrames: 0
|
|
1886
|
+
};
|
|
1887
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1888
|
+
this.scheduleScrollReconcile();
|
|
1889
|
+
};
|
|
1890
|
+
this.scrollBy = (delta, { behavior = "auto" } = {}) => {
|
|
1891
|
+
const offset = this.getScrollOffset() + delta;
|
|
1892
|
+
const now = this.now();
|
|
1893
|
+
this.scrollState = {
|
|
1894
|
+
index: null,
|
|
1895
|
+
align: "start",
|
|
1896
|
+
behavior,
|
|
1897
|
+
startedAt: now,
|
|
1898
|
+
lastTargetOffset: offset,
|
|
1899
|
+
stableFrames: 0
|
|
1900
|
+
};
|
|
1901
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1902
|
+
this.scheduleScrollReconcile();
|
|
1903
|
+
};
|
|
1904
|
+
this.getTotalSize = () => {
|
|
1905
|
+
var _a2;
|
|
1906
|
+
var _a;
|
|
1907
|
+
const measurements = this.getMeasurements();
|
|
1908
|
+
let end;
|
|
1909
|
+
if (measurements.length === 0) {
|
|
1910
|
+
end = this.options.paddingStart;
|
|
1911
|
+
} else if (this.options.lanes === 1) {
|
|
1912
|
+
end = (_a2 = (_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) != null ? _a2 : 0;
|
|
1913
|
+
} else {
|
|
1914
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
1915
|
+
let endIndex = measurements.length - 1;
|
|
1916
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
1917
|
+
const item = measurements[endIndex];
|
|
1918
|
+
if (endByLane[item.lane] === null) {
|
|
1919
|
+
endByLane[item.lane] = item.end;
|
|
1920
|
+
}
|
|
1921
|
+
endIndex--;
|
|
1922
|
+
}
|
|
1923
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
1924
|
+
}
|
|
1925
|
+
return Math.max(
|
|
1926
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
1927
|
+
0
|
|
1928
|
+
);
|
|
1929
|
+
};
|
|
1930
|
+
this._scrollToOffset = (offset, {
|
|
1931
|
+
adjustments,
|
|
1932
|
+
behavior
|
|
1933
|
+
}) => {
|
|
1934
|
+
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
1935
|
+
};
|
|
1936
|
+
this.measure = () => {
|
|
1937
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
1938
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
1939
|
+
this.notify(false);
|
|
1940
|
+
};
|
|
1941
|
+
this.setOptions(opts);
|
|
1942
|
+
}
|
|
1943
|
+
scheduleScrollReconcile() {
|
|
1944
|
+
if (!this.targetWindow) {
|
|
1945
|
+
this.scrollState = null;
|
|
1946
|
+
return;
|
|
1947
|
+
}
|
|
1948
|
+
if (this.rafId != null) return;
|
|
1949
|
+
this.rafId = this.targetWindow.requestAnimationFrame(() => {
|
|
1950
|
+
this.rafId = null;
|
|
1951
|
+
this.reconcileScroll();
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
reconcileScroll() {
|
|
1955
|
+
if (!this.scrollState) return;
|
|
1956
|
+
const el = this.scrollElement;
|
|
1957
|
+
if (!el) return;
|
|
1958
|
+
const MAX_RECONCILE_MS = 5e3;
|
|
1959
|
+
if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {
|
|
1960
|
+
this.scrollState = null;
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
|
|
1964
|
+
const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
|
|
1965
|
+
const STABLE_FRAMES = 1;
|
|
1966
|
+
const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
|
|
1967
|
+
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
1968
|
+
this.scrollState.stableFrames++;
|
|
1969
|
+
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
1970
|
+
this.scrollState = null;
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
} else {
|
|
1974
|
+
this.scrollState.stableFrames = 0;
|
|
1975
|
+
if (targetChanged) {
|
|
1976
|
+
this.scrollState.lastTargetOffset = targetOffset;
|
|
1977
|
+
this.scrollState.behavior = "auto";
|
|
1978
|
+
this._scrollToOffset(targetOffset, {
|
|
1979
|
+
adjustments: void 0,
|
|
1980
|
+
behavior: "auto"
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
}
|
|
1984
|
+
this.scheduleScrollReconcile();
|
|
1985
|
+
}
|
|
1986
|
+
};
|
|
1987
|
+
var findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
1988
|
+
while (low <= high) {
|
|
1989
|
+
const middle = (low + high) / 2 | 0;
|
|
1990
|
+
const currentValue = getCurrentValue(middle);
|
|
1991
|
+
if (currentValue < value) {
|
|
1992
|
+
low = middle + 1;
|
|
1993
|
+
} else if (currentValue > value) {
|
|
1994
|
+
high = middle - 1;
|
|
1995
|
+
} else {
|
|
1996
|
+
return middle;
|
|
1997
|
+
}
|
|
1998
|
+
}
|
|
1999
|
+
if (low > 0) {
|
|
2000
|
+
return low - 1;
|
|
2001
|
+
} else {
|
|
2002
|
+
return 0;
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
function calculateRange({
|
|
2006
|
+
measurements,
|
|
2007
|
+
outerSize,
|
|
2008
|
+
scrollOffset,
|
|
2009
|
+
lanes
|
|
2010
|
+
}) {
|
|
2011
|
+
const lastIndex = measurements.length - 1;
|
|
2012
|
+
const getOffset = (index) => measurements[index].start;
|
|
2013
|
+
if (measurements.length <= lanes) {
|
|
2014
|
+
return {
|
|
2015
|
+
startIndex: 0,
|
|
2016
|
+
endIndex: lastIndex
|
|
2017
|
+
};
|
|
2018
|
+
}
|
|
2019
|
+
let startIndex = findNearestBinarySearch(
|
|
2020
|
+
0,
|
|
2021
|
+
lastIndex,
|
|
2022
|
+
getOffset,
|
|
2023
|
+
scrollOffset
|
|
2024
|
+
);
|
|
2025
|
+
let endIndex = startIndex;
|
|
2026
|
+
if (lanes === 1) {
|
|
2027
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
2028
|
+
endIndex++;
|
|
2029
|
+
}
|
|
2030
|
+
} else if (lanes > 1) {
|
|
2031
|
+
const endPerLane = Array(lanes).fill(0);
|
|
2032
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
2033
|
+
const item = measurements[endIndex];
|
|
2034
|
+
endPerLane[item.lane] = item.end;
|
|
2035
|
+
endIndex++;
|
|
2036
|
+
}
|
|
2037
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
2038
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
2039
|
+
const item = measurements[startIndex];
|
|
2040
|
+
startPerLane[item.lane] = item.start;
|
|
2041
|
+
startIndex--;
|
|
2042
|
+
}
|
|
2043
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
2044
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
2045
|
+
}
|
|
2046
|
+
return { startIndex, endIndex };
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
// ../../node_modules/.pnpm/@tanstack+react-virtual@3.13.24_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/@tanstack/react-virtual/dist/esm/index.js
|
|
2050
|
+
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
2051
|
+
function useVirtualizerBase(_a) {
|
|
2052
|
+
var _b = _a, {
|
|
2053
|
+
useFlushSync = true
|
|
2054
|
+
} = _b, options = __objRest(_b, [
|
|
2055
|
+
"useFlushSync"
|
|
2056
|
+
]);
|
|
2057
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
2058
|
+
const resolvedOptions = __spreadProps(__spreadValues({}, options), {
|
|
2059
|
+
onChange: (instance2, sync) => {
|
|
2060
|
+
var _a2;
|
|
2061
|
+
if (useFlushSync && sync) {
|
|
2062
|
+
(0, import_react_dom.flushSync)(rerender);
|
|
2063
|
+
} else {
|
|
2064
|
+
rerender();
|
|
2065
|
+
}
|
|
2066
|
+
(_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance2, sync);
|
|
2067
|
+
}
|
|
2068
|
+
});
|
|
2069
|
+
const [instance] = React.useState(
|
|
2070
|
+
() => new Virtualizer(resolvedOptions)
|
|
2071
|
+
);
|
|
2072
|
+
instance.setOptions(resolvedOptions);
|
|
2073
|
+
useIsomorphicLayoutEffect(() => {
|
|
2074
|
+
return instance._didMount();
|
|
2075
|
+
}, []);
|
|
2076
|
+
useIsomorphicLayoutEffect(() => {
|
|
2077
|
+
return instance._willUpdate();
|
|
2078
|
+
});
|
|
2079
|
+
return instance;
|
|
2080
|
+
}
|
|
2081
|
+
function useWindowVirtualizer(options) {
|
|
2082
|
+
return useVirtualizerBase(__spreadValues({
|
|
2083
|
+
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
2084
|
+
observeElementRect: observeWindowRect,
|
|
2085
|
+
observeElementOffset: observeWindowOffset,
|
|
2086
|
+
scrollToFn: windowScroll,
|
|
2087
|
+
initialOffset: () => typeof document !== "undefined" ? window.scrollY : 0
|
|
2088
|
+
}, options));
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2092
|
+
var import_components13 = require("@transferwise/components");
|
|
2093
|
+
var import_react6 = require("react");
|
|
2094
|
+
|
|
2095
|
+
// ../renderers/src/step/StepFooter.tsx
|
|
2096
|
+
var import_components12 = require("@transferwise/components");
|
|
2097
|
+
var import_react5 = require("react");
|
|
2098
|
+
var import_react_intl6 = require("react-intl");
|
|
2099
|
+
|
|
2100
|
+
// ../renderers/src/messages/step.messages.ts
|
|
2101
|
+
var import_react_intl5 = require("react-intl");
|
|
2102
|
+
var step_messages_default = (0, import_react_intl5.defineMessages)({
|
|
2103
|
+
scrollToBottom: {
|
|
2104
|
+
id: "df.wise.step.scrollToBottom",
|
|
2105
|
+
defaultMessage: "Scroll to bottom",
|
|
2106
|
+
description: "Label for a button that appears when the content of a step is too long and the user needs to scroll to the bottom to see all the content."
|
|
2107
|
+
}
|
|
2108
|
+
});
|
|
2109
|
+
|
|
2110
|
+
// ../renderers/src/step/StepFooter.tsx
|
|
2111
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2112
|
+
var SCROLL_TO_BOTTOM = "scroll-to-bottom";
|
|
2113
|
+
var StepFooter = ({ footer, tags }) => {
|
|
2114
|
+
if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
|
|
2115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FooterWithScrollButton, { footer });
|
|
2116
|
+
}
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DefaultFooter, { footer });
|
|
2118
|
+
};
|
|
2119
|
+
var DefaultFooter = ({ footer }) => {
|
|
2120
|
+
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
2121
|
+
return hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0;
|
|
2122
|
+
};
|
|
2123
|
+
var FooterWithScrollButton = ({ footer }) => {
|
|
2124
|
+
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
2125
|
+
const endOfLayoutRef = (0, import_react5.useRef)(null);
|
|
2126
|
+
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
2127
|
+
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2128
|
+
import_components12.Button,
|
|
2129
|
+
{
|
|
2130
|
+
className: "m-b-1",
|
|
2131
|
+
v2: true,
|
|
2132
|
+
block: true,
|
|
2133
|
+
priority: "tertiary",
|
|
2134
|
+
onClick: () => {
|
|
2135
|
+
var _a;
|
|
2136
|
+
(_a = endOfLayoutRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
2137
|
+
},
|
|
2138
|
+
children: formatMessage(step_messages_default.scrollToBottom)
|
|
2139
|
+
}
|
|
2140
|
+
);
|
|
2141
|
+
const hasStepFooterContent = footer && Array.isArray(footer) && footer.length > 0;
|
|
2142
|
+
if (isElementVisible && !hasStepFooterContent) {
|
|
2143
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
|
|
2144
|
+
}
|
|
2145
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2146
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
|
|
2147
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "df-step-fixed__footer", children: [
|
|
2148
|
+
!isElementVisible && scrollButton,
|
|
2149
|
+
footer
|
|
2150
|
+
] })
|
|
2151
|
+
] });
|
|
2152
|
+
};
|
|
2153
|
+
var useIsElementVisible = (elementRef) => {
|
|
2154
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(false);
|
|
2155
|
+
(0, import_react5.useEffect)(() => {
|
|
2156
|
+
const element = elementRef.current;
|
|
2157
|
+
if (!element) return;
|
|
2158
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
2159
|
+
setIsVisible(entry.isIntersecting);
|
|
2160
|
+
});
|
|
2161
|
+
observer.observe(element);
|
|
2162
|
+
return () => observer.disconnect();
|
|
2163
|
+
}, [elementRef]);
|
|
2164
|
+
return isVisible;
|
|
2165
|
+
};
|
|
2166
|
+
|
|
2167
|
+
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2168
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2169
|
+
var ContentComponent = (props) => {
|
|
2170
|
+
const { state, status, SectionHeader, Item } = props;
|
|
2171
|
+
const endOfContentRef = (0, import_react6.useRef)(null);
|
|
2172
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
2173
|
+
(0, import_react6.useEffect)(() => {
|
|
2174
|
+
var _a;
|
|
2175
|
+
console.log("bottom visible", status);
|
|
2176
|
+
if (isBottomVisible && status.type === "idle" && status.loadMore) {
|
|
2177
|
+
(_a = status.loadMore) == null ? void 0 : _a.call(status);
|
|
2178
|
+
}
|
|
2179
|
+
}, [isBottomVisible]);
|
|
2180
|
+
const stateCount = state.sections.reduce(
|
|
2181
|
+
(total, section) => section.items.length + total + (section.title ? 1 : 0),
|
|
2182
|
+
0
|
|
2183
|
+
);
|
|
2184
|
+
const items = (0, import_react6.useMemo)(() => {
|
|
2185
|
+
return state.sections.reduce((acc, section) => {
|
|
2186
|
+
return [
|
|
2187
|
+
...acc,
|
|
2188
|
+
...section.title ? [
|
|
2189
|
+
{
|
|
2190
|
+
type: "header",
|
|
2191
|
+
title: section.title,
|
|
2192
|
+
items: section.items,
|
|
2193
|
+
id: section.id
|
|
2194
|
+
}
|
|
2195
|
+
] : [],
|
|
2196
|
+
...section.items.map((item) => ({
|
|
2197
|
+
item,
|
|
2198
|
+
type: "item"
|
|
2199
|
+
}))
|
|
2200
|
+
];
|
|
2201
|
+
}, []);
|
|
2202
|
+
}, [stateCount]);
|
|
2203
|
+
const listRef = (0, import_react6.useRef)(null);
|
|
2204
|
+
const listOffsetRef = (0, import_react6.useRef)(0);
|
|
2205
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
2206
|
+
var _a, _b;
|
|
2207
|
+
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
2208
|
+
});
|
|
2209
|
+
const virtualizer = useWindowVirtualizer({
|
|
2210
|
+
count: stateCount,
|
|
2211
|
+
estimateSize: () => 120,
|
|
2212
|
+
// todo, we could be clever here. Is it worth it?
|
|
2213
|
+
overscan: 10,
|
|
2214
|
+
scrollMargin: listOffsetRef.current
|
|
2215
|
+
});
|
|
2216
|
+
const showState = status.type === "idle" || status.reason === "pagination";
|
|
2217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { ref: listRef, children: [
|
|
2218
|
+
showState && state.beforeSections,
|
|
2219
|
+
showState && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2220
|
+
"div",
|
|
2221
|
+
{
|
|
2222
|
+
style: {
|
|
2223
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
2224
|
+
width: "100%",
|
|
2225
|
+
position: "relative"
|
|
2226
|
+
},
|
|
2227
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
2228
|
+
const i = items[item.index];
|
|
2229
|
+
if (!i) {
|
|
2230
|
+
return null;
|
|
2231
|
+
}
|
|
2232
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2233
|
+
"div",
|
|
2234
|
+
{
|
|
2235
|
+
ref: virtualizer.measureElement,
|
|
2236
|
+
"data-index": item.index,
|
|
2237
|
+
style: {
|
|
2238
|
+
position: "absolute",
|
|
2239
|
+
top: 0,
|
|
2240
|
+
left: 0,
|
|
2241
|
+
width: "100%",
|
|
2242
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
2243
|
+
},
|
|
2244
|
+
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Item, __spreadValues({}, i.item))
|
|
2245
|
+
},
|
|
2246
|
+
item.key
|
|
2247
|
+
);
|
|
2248
|
+
})
|
|
2249
|
+
}
|
|
2250
|
+
),
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: [
|
|
2252
|
+
status.type === "idle" && status.loadMore || status.type === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.ProcessIndicator, { size: "xs" }) : null,
|
|
2253
|
+
status.type === "error" && status.reason === "pagination" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "d-flex m-x-auto", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.Button, { v2: true, size: "sm", priority: "secondary-neutral", onClick: status.retry, children: "Load more" }) }) : null
|
|
2254
|
+
] }),
|
|
2255
|
+
showState && state.afterSections
|
|
2256
|
+
] });
|
|
2257
|
+
};
|
|
2258
|
+
|
|
2259
|
+
// ../renderers/src/CollectionRenderer/components/SearchComponent.tsx
|
|
2260
|
+
var import_components14 = require("@transferwise/components");
|
|
2261
|
+
var import_icons = require("@transferwise/icons");
|
|
2262
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2263
|
+
var SearchComponent = ({ state, features }) => {
|
|
2264
|
+
const { search } = state;
|
|
2265
|
+
if (!search) {
|
|
2266
|
+
return;
|
|
2267
|
+
}
|
|
2268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2269
|
+
FieldInput_default,
|
|
2270
|
+
{
|
|
2271
|
+
id: "search",
|
|
2272
|
+
description: "",
|
|
2273
|
+
validation: void 0,
|
|
2274
|
+
help: "",
|
|
2275
|
+
label: search.title,
|
|
2276
|
+
features,
|
|
2277
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components14.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_icons.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2278
|
+
import_components14.Input,
|
|
2279
|
+
{
|
|
2280
|
+
id: "search",
|
|
2281
|
+
name: "search",
|
|
2282
|
+
shape: "pill",
|
|
2283
|
+
placeholder: search.hint,
|
|
2284
|
+
type: "text",
|
|
2285
|
+
value: search.query,
|
|
2286
|
+
onChange: ({ currentTarget: { value } }) => {
|
|
2287
|
+
search.onChange(value);
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
) })
|
|
2291
|
+
}
|
|
2292
|
+
);
|
|
2293
|
+
};
|
|
2294
|
+
|
|
2295
|
+
// ../renderers/src/CollectionRenderer/components/FilterComponent.tsx
|
|
2296
|
+
var import_components15 = require("@transferwise/components");
|
|
2297
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2298
|
+
var FiltersComponent = ({ state }) => {
|
|
2299
|
+
const { filters } = state;
|
|
2300
|
+
return filters.map((filter) => {
|
|
2301
|
+
var _a;
|
|
2302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FilterComponent, __spreadValues({}, filter), JSON.stringify((_a = filter.options) == null ? void 0 : _a.map((o) => o.value)));
|
|
2303
|
+
});
|
|
2304
|
+
};
|
|
2305
|
+
var FilterComponent = (filter) => {
|
|
2306
|
+
const { multiSelect, options } = filter;
|
|
2307
|
+
if (!options) {
|
|
2308
|
+
return null;
|
|
2309
|
+
}
|
|
2310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2311
|
+
import_components15.Chips,
|
|
2312
|
+
{
|
|
2313
|
+
className: "m-b-1",
|
|
2314
|
+
multiple: multiSelect,
|
|
2315
|
+
selected: options.some((option) => option.selected) ? options.filter((option) => option.selected).map((option) => option.value) : multiSelect ? [] : "",
|
|
2316
|
+
chips: [
|
|
2317
|
+
...options.map((option) => ({
|
|
2318
|
+
value: option.value,
|
|
2319
|
+
label: option.title
|
|
2320
|
+
}))
|
|
2321
|
+
],
|
|
2322
|
+
onChange: (value) => {
|
|
2323
|
+
var _a;
|
|
2324
|
+
if (value.selectedValue === "") {
|
|
2325
|
+
options == null ? void 0 : options.filter((option) => option.selected).map((option) => option == null ? void 0 : option.onSelect());
|
|
2326
|
+
return;
|
|
2327
|
+
}
|
|
2328
|
+
(_a = options == null ? void 0 : options.find((option) => value.selectedValue === option.value)) == null ? void 0 : _a.onSelect();
|
|
2329
|
+
}
|
|
2330
|
+
},
|
|
2331
|
+
JSON.stringify(options)
|
|
2332
|
+
);
|
|
2333
|
+
};
|
|
2334
|
+
|
|
2335
|
+
// ../renderers/src/CollectionRenderer/components/ItemComponent.tsx
|
|
2336
|
+
var import_components18 = require("@transferwise/components");
|
|
2337
|
+
|
|
2338
|
+
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
2339
|
+
var import_components16 = require("@transferwise/components");
|
|
2340
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2341
|
+
var getAdditionalInfo = (additionalInfo) => {
|
|
2342
|
+
var _a, _b;
|
|
2343
|
+
if (!additionalInfo) {
|
|
2344
|
+
return void 0;
|
|
2345
|
+
}
|
|
2346
|
+
const { href, text, onClick } = additionalInfo;
|
|
2347
|
+
if (href || onClick) {
|
|
2348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2349
|
+
import_components16.ListItem.AdditionalInfo,
|
|
2350
|
+
{
|
|
2351
|
+
action: __spreadValues({
|
|
2352
|
+
label: text
|
|
2353
|
+
}, (_b = (_a = additionalInfo.getAnchorProps) == null ? void 0 : _a.call(additionalInfo)) != null ? _b : { onClick })
|
|
2354
|
+
}
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components16.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
2358
|
+
};
|
|
2359
|
+
|
|
2360
|
+
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
2361
|
+
var import_components17 = require("@transferwise/components");
|
|
2362
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2363
|
+
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
2364
|
+
if (!callToAction) {
|
|
2365
|
+
return void 0;
|
|
2366
|
+
}
|
|
2367
|
+
const { accessibilityDescription, title, context } = callToAction;
|
|
2368
|
+
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
2369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2370
|
+
import_components17.ListItem.Button,
|
|
2371
|
+
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
2372
|
+
partiallyInteractive: !fullyInteractive,
|
|
2373
|
+
priority,
|
|
2374
|
+
"aria-description": accessibilityDescription,
|
|
2375
|
+
sentiment,
|
|
2376
|
+
children: title
|
|
2377
|
+
})
|
|
2378
|
+
);
|
|
2379
|
+
};
|
|
2380
|
+
var getPriorityAndSentiment = (ctaSecondary, context) => {
|
|
2381
|
+
if (context === "negative") {
|
|
2382
|
+
return { priority: "secondary", sentiment: "negative" };
|
|
2383
|
+
}
|
|
2384
|
+
return { priority: ctaSecondary ? "secondary" : "secondary-neutral", sentiment: "default" };
|
|
2385
|
+
};
|
|
2386
|
+
|
|
2387
|
+
// ../renderers/src/utils/listItem/shouldUseAvatar.ts
|
|
2388
|
+
var shouldUseAvatar = (control, tags) => {
|
|
2389
|
+
var _a;
|
|
2390
|
+
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
2391
|
+
};
|
|
2392
|
+
|
|
2393
|
+
// ../renderers/src/CollectionRenderer/components/ItemComponent.tsx
|
|
2394
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2395
|
+
var ItemComponent = (props) => {
|
|
2396
|
+
var _a, _b;
|
|
1087
2397
|
const {
|
|
1088
|
-
|
|
2398
|
+
title,
|
|
1089
2399
|
description,
|
|
1090
|
-
disabled,
|
|
1091
|
-
inlineAlert,
|
|
1092
|
-
media,
|
|
1093
2400
|
supportingValues,
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
2401
|
+
media,
|
|
2402
|
+
additionalInfo,
|
|
2403
|
+
inlineAlert,
|
|
2404
|
+
href,
|
|
2405
|
+
onClick,
|
|
2406
|
+
callToAction,
|
|
2407
|
+
tags,
|
|
2408
|
+
parentTags,
|
|
2409
|
+
control
|
|
1099
2410
|
} = props;
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
2411
|
+
const controlOptions = {
|
|
2412
|
+
ctaSecondary: (_a = tags == null ? void 0 : tags.includes("cta-secondary")) != null ? _a : false,
|
|
2413
|
+
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
2414
|
+
};
|
|
2415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2416
|
+
import_components18.ListItem,
|
|
2417
|
+
{
|
|
1104
2418
|
title,
|
|
1105
2419
|
subtitle: description,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
prompt:
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
2420
|
+
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
2421
|
+
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
2422
|
+
media: getMedia(media, shouldUseAvatar(control, parentTags)),
|
|
2423
|
+
prompt: getInlineAlert(inlineAlert),
|
|
2424
|
+
additionalInfo: getAdditionalInfo(additionalInfo),
|
|
2425
|
+
control: onClick || href ? getNavigationControl(onClick, href) : getCTAControl(callToAction, controlOptions)
|
|
2426
|
+
},
|
|
2427
|
+
title
|
|
2428
|
+
);
|
|
1113
2429
|
};
|
|
1114
|
-
var
|
|
1115
|
-
if (
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
2430
|
+
var getNavigationControl = (onClick, href) => {
|
|
2431
|
+
if (href) {
|
|
2432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components18.ListItem.Navigation, { href });
|
|
1117
2433
|
}
|
|
1118
|
-
|
|
2434
|
+
if (onClick) {
|
|
2435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components18.ListItem.Navigation, { onClick });
|
|
2436
|
+
}
|
|
2437
|
+
return null;
|
|
1119
2438
|
};
|
|
1120
|
-
|
|
2439
|
+
|
|
2440
|
+
// ../renderers/src/CollectionRenderer/components/SectionHeaderComponent.tsx
|
|
2441
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2442
|
+
var SectionHeaderComponent = ({
|
|
2443
|
+
title,
|
|
2444
|
+
callToAction
|
|
2445
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Header, { title, callToAction });
|
|
2446
|
+
|
|
2447
|
+
// ../renderers/src/CollectionRenderer/createCollectionRenderer.tsx
|
|
2448
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2449
|
+
var createCollectionRenderer = (canRender, components) => {
|
|
2450
|
+
const componeontsWithDefaults = __spreadValues({
|
|
2451
|
+
Search: SearchComponent,
|
|
2452
|
+
Filters: FiltersComponent,
|
|
2453
|
+
Filter: FilterComponent,
|
|
2454
|
+
Item: ItemComponent,
|
|
2455
|
+
SectionHeader: SectionHeaderComponent,
|
|
2456
|
+
Results: ContentComponent
|
|
2457
|
+
}, components);
|
|
2458
|
+
return {
|
|
2459
|
+
canRenderType: "collection",
|
|
2460
|
+
canRender,
|
|
2461
|
+
render: (props) => {
|
|
2462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CollectionRendererComponent, __spreadValues(__spreadValues({}, props), componeontsWithDefaults));
|
|
2463
|
+
}
|
|
2464
|
+
};
|
|
2465
|
+
};
|
|
2466
|
+
|
|
2467
|
+
// ../renderers/src/CollectionRenderer/CollectionRenderer.tsx
|
|
2468
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2469
|
+
var CollectionRendererComponent = (props) => {
|
|
2470
|
+
const { status, Search: Search4, Filters, Results } = props;
|
|
2471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Search4, __spreadValues({}, props)),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Filters, __spreadValues({}, props)),
|
|
2474
|
+
status.type === "idle" || status.type === "loading" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Results, __spreadValues({}, props)) : void 0,
|
|
2475
|
+
status.type === "error" && status.reason === "search" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_components19.InlinePrompt, { width: "full", sentiment: "negative", children: [
|
|
2476
|
+
"Something went wrong,\xA0",
|
|
2477
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components19.Link, { onClick: status.retry, children: "click here to retry" })
|
|
2478
|
+
] })
|
|
2479
|
+
] });
|
|
2480
|
+
};
|
|
2481
|
+
var CollectionRenderer = createCollectionRenderer(() => true, {
|
|
2482
|
+
Search: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SearchComponent, __spreadValues({}, props)),
|
|
2483
|
+
Filters: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FiltersComponent, __spreadValues({}, props)),
|
|
2484
|
+
Filter: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FilterComponent, __spreadValues({}, props)),
|
|
2485
|
+
Item: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemComponent, __spreadValues({}, props)),
|
|
2486
|
+
SectionHeader: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SectionHeaderComponent, __spreadValues({}, props)),
|
|
2487
|
+
Results: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ContentComponent, __spreadValues({}, props))
|
|
2488
|
+
});
|
|
2489
|
+
var CollectionRenderer_default = CollectionRenderer;
|
|
1121
2490
|
|
|
1122
2491
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
1123
2492
|
var import_classnames3 = __toESM(require_classnames());
|
|
1124
2493
|
|
|
1125
2494
|
// ../renderers/src/utils/useIsCollapsed.ts
|
|
1126
|
-
var
|
|
2495
|
+
var import_react7 = require("react");
|
|
1127
2496
|
var COLLAPSE_QUERY = "(max-width: 767.98px)";
|
|
1128
2497
|
var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
|
|
1129
2498
|
var useIsCollapsed = () => {
|
|
1130
|
-
const [collapsed, setCollapsed] = (0,
|
|
2499
|
+
const [collapsed, setCollapsed] = (0, import_react7.useState)(
|
|
1131
2500
|
() => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
|
|
1132
2501
|
);
|
|
1133
|
-
(0,
|
|
2502
|
+
(0, import_react7.useEffect)(() => {
|
|
1134
2503
|
if (supportsMatchMedia()) {
|
|
1135
2504
|
const mql = window.matchMedia(COLLAPSE_QUERY);
|
|
1136
2505
|
const update = () => setCollapsed(mql.matches);
|
|
@@ -1143,7 +2512,7 @@ var useIsCollapsed = () => {
|
|
|
1143
2512
|
};
|
|
1144
2513
|
|
|
1145
2514
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
1146
|
-
var
|
|
2515
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1147
2516
|
var RIGHT_FIRST_STACKING = "right-first-stacking";
|
|
1148
2517
|
var ColumnsRenderer = {
|
|
1149
2518
|
canRenderType: "columns",
|
|
@@ -1159,9 +2528,9 @@ function ColumnsRendererComponent({
|
|
|
1159
2528
|
var _a;
|
|
1160
2529
|
const isCollapsed = useIsCollapsed();
|
|
1161
2530
|
const reverse = isCollapsed && ((_a = tags == null ? void 0 : tags.includes(RIGHT_FIRST_STACKING)) != null ? _a : false);
|
|
1162
|
-
const startColumn = /* @__PURE__ */ (0,
|
|
1163
|
-
const endColumn = /* @__PURE__ */ (0,
|
|
1164
|
-
return /* @__PURE__ */ (0,
|
|
2531
|
+
const startColumn = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "df-columns-renderer-column", children: startChildren });
|
|
2532
|
+
const endColumn = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "df-columns-renderer-column", children: endChildren });
|
|
2533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1165
2534
|
"div",
|
|
1166
2535
|
{
|
|
1167
2536
|
className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
|
|
@@ -1178,7 +2547,7 @@ function ColumnsRendererComponent({
|
|
|
1178
2547
|
var ColumnsRenderer_default = ColumnsRenderer;
|
|
1179
2548
|
|
|
1180
2549
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
1181
|
-
var
|
|
2550
|
+
var import_components20 = require("@transferwise/components");
|
|
1182
2551
|
|
|
1183
2552
|
// ../renderers/src/validators/type-validators.ts
|
|
1184
2553
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
@@ -1205,7 +2574,7 @@ var dateToDateString = (date) => {
|
|
|
1205
2574
|
};
|
|
1206
2575
|
|
|
1207
2576
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
1208
|
-
var
|
|
2577
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1209
2578
|
function VariableDateInput({
|
|
1210
2579
|
control,
|
|
1211
2580
|
inputProps
|
|
@@ -1221,8 +2590,8 @@ function VariableDateInput({
|
|
|
1221
2590
|
onFocus
|
|
1222
2591
|
} = inputProps;
|
|
1223
2592
|
if (control === "date-lookup") {
|
|
1224
|
-
return /* @__PURE__ */ (0,
|
|
1225
|
-
|
|
2593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2594
|
+
import_components20.DateLookup,
|
|
1226
2595
|
{
|
|
1227
2596
|
value: dateStringToDateOrNull(inputProps.value),
|
|
1228
2597
|
min: dateStringToDateOrNull(minimumDate),
|
|
@@ -1237,8 +2606,8 @@ function VariableDateInput({
|
|
|
1237
2606
|
}
|
|
1238
2607
|
);
|
|
1239
2608
|
}
|
|
1240
|
-
return /* @__PURE__ */ (0,
|
|
1241
|
-
|
|
2609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2610
|
+
import_components20.DateInput,
|
|
1242
2611
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
1243
2612
|
dayAutoComplete: getAutocompleteString(autoComplete, "day"),
|
|
1244
2613
|
yearAutoComplete: getAutocompleteString(autoComplete, "year")
|
|
@@ -1254,7 +2623,7 @@ var getAutocompleteString = (value, suffix) => {
|
|
|
1254
2623
|
var VariableDateInput_default = VariableDateInput;
|
|
1255
2624
|
|
|
1256
2625
|
// ../renderers/src/DateInputRenderer.tsx
|
|
1257
|
-
var
|
|
2626
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1258
2627
|
var DateInputRenderer = {
|
|
1259
2628
|
canRenderType: "input-date",
|
|
1260
2629
|
render: (props) => {
|
|
@@ -1279,7 +2648,7 @@ var DateInputRenderer = {
|
|
|
1279
2648
|
]);
|
|
1280
2649
|
const value = initialValue != null ? initialValue : "";
|
|
1281
2650
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
1282
|
-
return /* @__PURE__ */ (0,
|
|
2651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1283
2652
|
FieldInput_default,
|
|
1284
2653
|
{
|
|
1285
2654
|
id,
|
|
@@ -1290,7 +2659,7 @@ var DateInputRenderer = {
|
|
|
1290
2659
|
loadingState: props.fieldLoadingState,
|
|
1291
2660
|
help,
|
|
1292
2661
|
features: props.features,
|
|
1293
|
-
children: /* @__PURE__ */ (0,
|
|
2662
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VariableDateInput_default, { control, inputProps })
|
|
1294
2663
|
}
|
|
1295
2664
|
);
|
|
1296
2665
|
}
|
|
@@ -1298,44 +2667,16 @@ var DateInputRenderer = {
|
|
|
1298
2667
|
var DateInputRenderer_default = DateInputRenderer;
|
|
1299
2668
|
|
|
1300
2669
|
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1301
|
-
var
|
|
1302
|
-
|
|
1303
|
-
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
1304
|
-
var import_components13 = require("@transferwise/components");
|
|
1305
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1306
|
-
var getAdditionalInfo = (additionalInfo) => {
|
|
1307
|
-
var _a, _b;
|
|
1308
|
-
if (!additionalInfo) {
|
|
1309
|
-
return void 0;
|
|
1310
|
-
}
|
|
1311
|
-
const { href, text, onClick } = additionalInfo;
|
|
1312
|
-
if (href || onClick) {
|
|
1313
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1314
|
-
import_components13.ListItem.AdditionalInfo,
|
|
1315
|
-
{
|
|
1316
|
-
action: __spreadValues({
|
|
1317
|
-
label: text
|
|
1318
|
-
}, (_b = (_a = additionalInfo.getAnchorProps) == null ? void 0 : _a.call(additionalInfo)) != null ? _b : { onClick })
|
|
1319
|
-
}
|
|
1320
|
-
);
|
|
1321
|
-
}
|
|
1322
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components13.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
1323
|
-
};
|
|
1324
|
-
|
|
1325
|
-
// ../renderers/src/utils/listItem/shouldUseAvatar.ts
|
|
1326
|
-
var shouldUseAvatar = (control, tags) => {
|
|
1327
|
-
var _a;
|
|
1328
|
-
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
1329
|
-
};
|
|
2670
|
+
var import_components23 = require("@transferwise/components");
|
|
1330
2671
|
|
|
1331
2672
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
1334
|
-
var
|
|
2673
|
+
var import_components22 = require("@transferwise/components");
|
|
2674
|
+
var import_react8 = require("react");
|
|
2675
|
+
var import_react_intl10 = require("react-intl");
|
|
1335
2676
|
|
|
1336
2677
|
// ../renderers/src/messages/filter.messages.ts
|
|
1337
|
-
var
|
|
1338
|
-
var filter_messages_default = (0,
|
|
2678
|
+
var import_react_intl7 = require("react-intl");
|
|
2679
|
+
var filter_messages_default = (0, import_react_intl7.defineMessages)({
|
|
1339
2680
|
placeholder: {
|
|
1340
2681
|
id: "df.wise.filter.placeholder",
|
|
1341
2682
|
defaultMessage: "Start typing to search",
|
|
@@ -1401,12 +2742,12 @@ function filterAndSortDecisionOptions(selectOptions, query) {
|
|
|
1401
2742
|
var normalizeAndRemoveAccents = (text) => text.trim().toLowerCase().normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "");
|
|
1402
2743
|
|
|
1403
2744
|
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
1404
|
-
var
|
|
1405
|
-
var
|
|
2745
|
+
var import_components21 = require("@transferwise/components");
|
|
2746
|
+
var import_react_intl9 = require("react-intl");
|
|
1406
2747
|
|
|
1407
2748
|
// ../renderers/src/messages/group.messages.ts
|
|
1408
|
-
var
|
|
1409
|
-
var group_messages_default = (0,
|
|
2749
|
+
var import_react_intl8 = require("react-intl");
|
|
2750
|
+
var group_messages_default = (0, import_react_intl8.defineMessages)({
|
|
1410
2751
|
all: {
|
|
1411
2752
|
id: "df.wise.group.all",
|
|
1412
2753
|
defaultMessage: "All",
|
|
@@ -1440,19 +2781,19 @@ var getGroupsFromTags = (knownTags, items) => {
|
|
|
1440
2781
|
};
|
|
1441
2782
|
|
|
1442
2783
|
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
1443
|
-
var
|
|
2784
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1444
2785
|
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
1445
2786
|
var isGroupedDecision = (options) => {
|
|
1446
2787
|
return getGroupsFromTags(groupingTags, options).length > 0;
|
|
1447
2788
|
};
|
|
1448
2789
|
var GroupedDecisionList = (_a) => {
|
|
1449
2790
|
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1450
|
-
const { formatMessage } = (0,
|
|
2791
|
+
const { formatMessage } = (0, import_react_intl9.useIntl)();
|
|
1451
2792
|
const { options } = rest;
|
|
1452
2793
|
const itemsByTag = [...getGroupsFromTags(groupingTags, options), { tag: "all", items: options }];
|
|
1453
|
-
return /* @__PURE__ */ (0,
|
|
1454
|
-
/* @__PURE__ */ (0,
|
|
1455
|
-
|
|
2794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: itemsByTag.map(({ tag, items }) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components21.Section, { children: [
|
|
2795
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2796
|
+
import_components21.Header,
|
|
1456
2797
|
{
|
|
1457
2798
|
as: "h2",
|
|
1458
2799
|
title: tag in group_messages_default ? formatMessage(group_messages_default[tag]) : tag
|
|
@@ -1463,26 +2804,26 @@ var GroupedDecisionList = (_a) => {
|
|
|
1463
2804
|
};
|
|
1464
2805
|
|
|
1465
2806
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1466
|
-
var
|
|
2807
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1467
2808
|
var DecisionWrapper = (props) => {
|
|
1468
|
-
return /* @__PURE__ */ (0,
|
|
1469
|
-
props.title && /* @__PURE__ */ (0,
|
|
1470
|
-
props.control === "filtered" ? /* @__PURE__ */ (0,
|
|
2809
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
2810
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components22.Header, { as: "h2", title: props.title }),
|
|
2811
|
+
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
1471
2812
|
] });
|
|
1472
2813
|
};
|
|
1473
2814
|
var UnfilteredDecisionList = (_a) => {
|
|
1474
2815
|
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1475
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0,
|
|
2816
|
+
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
|
|
1476
2817
|
};
|
|
1477
2818
|
var FilteredDecisionList = (props) => {
|
|
1478
|
-
const { formatMessage } = (0,
|
|
1479
|
-
const [query, setQuery] = (0,
|
|
2819
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
2820
|
+
const [query, setQuery] = (0, import_react8.useState)("");
|
|
1480
2821
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
1481
2822
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
1482
2823
|
const isGrouped = isGroupedDecision(options);
|
|
1483
|
-
return /* @__PURE__ */ (0,
|
|
1484
|
-
/* @__PURE__ */ (0,
|
|
1485
|
-
|
|
2824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2825
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2826
|
+
import_components22.SearchInput,
|
|
1486
2827
|
{
|
|
1487
2828
|
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
1488
2829
|
value: query,
|
|
@@ -1493,25 +2834,25 @@ var FilteredDecisionList = (props) => {
|
|
|
1493
2834
|
}
|
|
1494
2835
|
}
|
|
1495
2836
|
),
|
|
1496
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0,
|
|
1497
|
-
query.length > 0 && /* @__PURE__ */ (0,
|
|
2837
|
+
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2838
|
+
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components22.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
1498
2839
|
filteredOptions.length > 0 ? renderDecisionList2({
|
|
1499
2840
|
control,
|
|
1500
2841
|
className: query.length === 0 ? "m-t-3" : "",
|
|
1501
2842
|
options: filteredOptions
|
|
1502
|
-
}) : /* @__PURE__ */ (0,
|
|
2843
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
1503
2844
|
] })
|
|
1504
2845
|
] });
|
|
1505
2846
|
};
|
|
1506
2847
|
|
|
1507
2848
|
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1508
|
-
var
|
|
2849
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1509
2850
|
var DecisionRenderer = {
|
|
1510
2851
|
canRenderType: "decision",
|
|
1511
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2852
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }))
|
|
1512
2853
|
};
|
|
1513
2854
|
var renderDecisionList = ({ options, control }) => {
|
|
1514
|
-
return /* @__PURE__ */ (0,
|
|
2855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: options.map((_a) => {
|
|
1515
2856
|
var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
|
|
1516
2857
|
const {
|
|
1517
2858
|
description,
|
|
@@ -1524,8 +2865,8 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1524
2865
|
supportingValues,
|
|
1525
2866
|
tags
|
|
1526
2867
|
} = rest;
|
|
1527
|
-
return /* @__PURE__ */ (0,
|
|
1528
|
-
|
|
2868
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2869
|
+
import_components23.ListItem,
|
|
1529
2870
|
{
|
|
1530
2871
|
title: itemTitle,
|
|
1531
2872
|
subtitle: description,
|
|
@@ -1536,7 +2877,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1536
2877
|
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
1537
2878
|
prompt: getInlineAlert(inlineAlert),
|
|
1538
2879
|
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
1539
|
-
control: /* @__PURE__ */ (0,
|
|
2880
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components23.ListItem.Navigation, __spreadValues({}, getAnchorProps()))
|
|
1540
2881
|
},
|
|
1541
2882
|
JSON.stringify(rest)
|
|
1542
2883
|
);
|
|
@@ -1545,8 +2886,8 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1545
2886
|
var DecisionRenderer_default = DecisionRenderer;
|
|
1546
2887
|
|
|
1547
2888
|
// ../renderers/src/DividerRenderer.tsx
|
|
1548
|
-
var
|
|
1549
|
-
var
|
|
2889
|
+
var import_components24 = require("@transferwise/components");
|
|
2890
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1550
2891
|
var mapControlToLevel = (control) => {
|
|
1551
2892
|
switch (control) {
|
|
1552
2893
|
case "section":
|
|
@@ -1559,16 +2900,16 @@ var mapControlToLevel = (control) => {
|
|
|
1559
2900
|
};
|
|
1560
2901
|
var DividerRenderer = {
|
|
1561
2902
|
canRenderType: "divider",
|
|
1562
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0,
|
|
2903
|
+
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components24.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
1563
2904
|
};
|
|
1564
2905
|
var DividerRenderer_default = DividerRenderer;
|
|
1565
2906
|
|
|
1566
2907
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1567
|
-
var
|
|
2908
|
+
var import_components25 = require("@transferwise/components");
|
|
1568
2909
|
|
|
1569
2910
|
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1570
|
-
var
|
|
1571
|
-
var external_confirmation_messages_default = (0,
|
|
2911
|
+
var import_react_intl11 = require("react-intl");
|
|
2912
|
+
var external_confirmation_messages_default = (0, import_react_intl11.defineMessages)({
|
|
1572
2913
|
title: {
|
|
1573
2914
|
id: "df.wise.ExternalConfirmation.title",
|
|
1574
2915
|
defaultMessage: "Please confirm",
|
|
@@ -1592,9 +2933,9 @@ var external_confirmation_messages_default = (0, import_react_intl9.defineMessag
|
|
|
1592
2933
|
});
|
|
1593
2934
|
|
|
1594
2935
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1595
|
-
var
|
|
1596
|
-
var
|
|
1597
|
-
var
|
|
2936
|
+
var import_react_intl12 = require("react-intl");
|
|
2937
|
+
var import_react9 = require("react");
|
|
2938
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1598
2939
|
var ExternalConfirmationRenderer = {
|
|
1599
2940
|
canRenderType: "external-confirmation",
|
|
1600
2941
|
render: ExternalConfirmationRendererComponent
|
|
@@ -1605,20 +2946,20 @@ function ExternalConfirmationRendererComponent({
|
|
|
1605
2946
|
open,
|
|
1606
2947
|
onCancel
|
|
1607
2948
|
}) {
|
|
1608
|
-
const { formatMessage } = (0,
|
|
1609
|
-
(0,
|
|
2949
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
2950
|
+
(0, import_react9.useEffect)(() => {
|
|
1610
2951
|
open();
|
|
1611
2952
|
}, []);
|
|
1612
|
-
return /* @__PURE__ */ (0,
|
|
1613
|
-
|
|
2953
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2954
|
+
import_components25.Modal,
|
|
1614
2955
|
{
|
|
1615
2956
|
open: visible,
|
|
1616
2957
|
title: formatMessage(external_confirmation_messages_default.title),
|
|
1617
|
-
body: /* @__PURE__ */ (0,
|
|
1618
|
-
/* @__PURE__ */ (0,
|
|
1619
|
-
/* @__PURE__ */ (0,
|
|
1620
|
-
/* @__PURE__ */ (0,
|
|
1621
|
-
|
|
2958
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components25.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
2960
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
2961
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2962
|
+
import_components25.Button,
|
|
1622
2963
|
{
|
|
1623
2964
|
v2: true,
|
|
1624
2965
|
block: true,
|
|
@@ -1631,7 +2972,7 @@ function ExternalConfirmationRendererComponent({
|
|
|
1631
2972
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
1632
2973
|
}
|
|
1633
2974
|
),
|
|
1634
|
-
/* @__PURE__ */ (0,
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components25.Button, { v2: true, block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
1635
2976
|
] }) })
|
|
1636
2977
|
] }),
|
|
1637
2978
|
onClose: onCancel
|
|
@@ -1648,46 +2989,46 @@ function getOrigin(url) {
|
|
|
1648
2989
|
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1649
2990
|
|
|
1650
2991
|
// ../renderers/src/FormRenderer.tsx
|
|
1651
|
-
var
|
|
2992
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1652
2993
|
var FormRenderer = {
|
|
1653
2994
|
canRenderType: "form",
|
|
1654
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0,
|
|
2995
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getMargin(margin), children })
|
|
1655
2996
|
};
|
|
1656
2997
|
var FormRenderer_default = FormRenderer;
|
|
1657
2998
|
|
|
1658
2999
|
// ../renderers/src/FormSectionRenderer.tsx
|
|
1659
|
-
var
|
|
1660
|
-
var
|
|
3000
|
+
var import_components26 = require("@transferwise/components");
|
|
3001
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1661
3002
|
var FormSectionRenderer = {
|
|
1662
3003
|
canRenderType: "form-section",
|
|
1663
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0,
|
|
1664
|
-
title && /* @__PURE__ */ (0,
|
|
1665
|
-
|
|
3004
|
+
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("fieldset", { children: [
|
|
3005
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
3006
|
+
import_components26.Header,
|
|
1666
3007
|
{
|
|
1667
3008
|
as: "h2",
|
|
1668
3009
|
title
|
|
1669
3010
|
}
|
|
1670
3011
|
),
|
|
1671
|
-
description && /* @__PURE__ */ (0,
|
|
3012
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description }),
|
|
1672
3013
|
children
|
|
1673
3014
|
] })
|
|
1674
3015
|
};
|
|
1675
3016
|
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1676
3017
|
|
|
1677
3018
|
// ../renderers/src/HeadingRenderer.tsx
|
|
1678
|
-
var
|
|
1679
|
-
var
|
|
3019
|
+
var import_components27 = require("@transferwise/components");
|
|
3020
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1680
3021
|
var HeadingRenderer = {
|
|
1681
3022
|
canRenderType: "heading",
|
|
1682
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
3023
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Heading, __spreadValues({}, props))
|
|
1683
3024
|
};
|
|
1684
3025
|
function Heading(props) {
|
|
1685
3026
|
const { text, size, align, margin, control } = props;
|
|
1686
3027
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1687
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
3028
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StandardHeading, { size, text, className });
|
|
1688
3029
|
}
|
|
1689
3030
|
function DisplayHeading({ size, text, className }) {
|
|
1690
|
-
return /* @__PURE__ */ (0,
|
|
3031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components27.Display, { type: getDisplayType(size), className, children: text });
|
|
1691
3032
|
}
|
|
1692
3033
|
var getDisplayType = (size) => {
|
|
1693
3034
|
switch (size) {
|
|
@@ -1703,7 +3044,7 @@ var getDisplayType = (size) => {
|
|
|
1703
3044
|
}
|
|
1704
3045
|
};
|
|
1705
3046
|
function StandardHeading({ size, text, className }) {
|
|
1706
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components27.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1707
3048
|
}
|
|
1708
3049
|
var getTitleTypeBySize = (size) => {
|
|
1709
3050
|
var _a;
|
|
@@ -1719,8 +3060,8 @@ var getTitleTypeBySize = (size) => {
|
|
|
1719
3060
|
var HeadingRenderer_default = HeadingRenderer;
|
|
1720
3061
|
|
|
1721
3062
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1722
|
-
var
|
|
1723
|
-
var
|
|
3063
|
+
var import_components28 = require("@transferwise/components");
|
|
3064
|
+
var import_react10 = require("react");
|
|
1724
3065
|
|
|
1725
3066
|
// ../renderers/src/utils/api-utils.ts
|
|
1726
3067
|
function isRelativePath(url = "") {
|
|
@@ -1730,7 +3071,7 @@ function isRelativePath(url = "") {
|
|
|
1730
3071
|
}
|
|
1731
3072
|
|
|
1732
3073
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1733
|
-
var
|
|
3074
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1734
3075
|
function UrlImage({
|
|
1735
3076
|
accessibilityDescription,
|
|
1736
3077
|
align,
|
|
@@ -1739,14 +3080,14 @@ function UrlImage({
|
|
|
1739
3080
|
uri,
|
|
1740
3081
|
httpClient
|
|
1741
3082
|
}) {
|
|
1742
|
-
const [imageSource, setImageSource] = (0,
|
|
1743
|
-
(0,
|
|
3083
|
+
const [imageSource, setImageSource] = (0, import_react10.useState)("");
|
|
3084
|
+
(0, import_react10.useEffect)(() => {
|
|
1744
3085
|
if (!uri.startsWith("urn:")) {
|
|
1745
3086
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1746
3087
|
}
|
|
1747
3088
|
}, [uri, httpClient]);
|
|
1748
|
-
return /* @__PURE__ */ (0,
|
|
1749
|
-
|
|
3089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3090
|
+
import_components28.Image,
|
|
1750
3091
|
{
|
|
1751
3092
|
className: "df-reserve-space",
|
|
1752
3093
|
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
@@ -1789,7 +3130,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1789
3130
|
};
|
|
1790
3131
|
|
|
1791
3132
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1792
|
-
var
|
|
3133
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1793
3134
|
var maxFlagSize = 600;
|
|
1794
3135
|
function UrnFlagImage({
|
|
1795
3136
|
accessibilityDescription,
|
|
@@ -1798,24 +3139,24 @@ function UrnFlagImage({
|
|
|
1798
3139
|
size,
|
|
1799
3140
|
uri
|
|
1800
3141
|
}) {
|
|
1801
|
-
return /* @__PURE__ */ (0,
|
|
3142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
1802
3143
|
}
|
|
1803
3144
|
|
|
1804
3145
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1805
3146
|
var import_art4 = require("@wise/art");
|
|
1806
|
-
var
|
|
3147
|
+
var import_react12 = require("react");
|
|
1807
3148
|
|
|
1808
3149
|
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1809
3150
|
var isAnimated = (uri) => {
|
|
1810
3151
|
const { rComponents } = stringToURN(uri);
|
|
1811
|
-
return rComponents
|
|
3152
|
+
return rComponents.type === "animated";
|
|
1812
3153
|
};
|
|
1813
3154
|
|
|
1814
3155
|
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1815
3156
|
var import_art3 = require("@wise/art");
|
|
1816
|
-
var
|
|
1817
|
-
var
|
|
1818
|
-
var Illustration3DErrorBoundary = class extends
|
|
3157
|
+
var import_react11 = require("react");
|
|
3158
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3159
|
+
var Illustration3DErrorBoundary = class extends import_react11.Component {
|
|
1819
3160
|
constructor(props) {
|
|
1820
3161
|
super(props);
|
|
1821
3162
|
this.state = { hasError: false };
|
|
@@ -1826,7 +3167,7 @@ var Illustration3DErrorBoundary = class extends import_react9.Component {
|
|
|
1826
3167
|
componentDidCatch() {
|
|
1827
3168
|
this.props.onError();
|
|
1828
3169
|
}
|
|
1829
|
-
render() {
|
|
3170
|
+
async render() {
|
|
1830
3171
|
if (this.state.hasError) {
|
|
1831
3172
|
return null;
|
|
1832
3173
|
}
|
|
@@ -1838,12 +3179,12 @@ var SafeIllustration3D = ({
|
|
|
1838
3179
|
size,
|
|
1839
3180
|
onError
|
|
1840
3181
|
}) => {
|
|
1841
|
-
return /* @__PURE__ */ (0,
|
|
3182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
1842
3183
|
};
|
|
1843
3184
|
var SafeIllustration3D_default = SafeIllustration3D;
|
|
1844
3185
|
|
|
1845
3186
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1846
|
-
var
|
|
3187
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1847
3188
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1848
3189
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1849
3190
|
function UrnIllustration({
|
|
@@ -1853,12 +3194,12 @@ function UrnIllustration({
|
|
|
1853
3194
|
size,
|
|
1854
3195
|
uri
|
|
1855
3196
|
}) {
|
|
1856
|
-
const [has3DFailed, setHas3DFailed] = (0,
|
|
3197
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react12.useState)(false);
|
|
1857
3198
|
const illustrationSize = getIllustrationSize(size);
|
|
1858
3199
|
const illustrationName = getIllustrationName(uri);
|
|
1859
3200
|
const illustration3DName = getIllustration3DName(uri);
|
|
1860
3201
|
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
3202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1862
3203
|
SafeIllustration3D_default,
|
|
1863
3204
|
{
|
|
1864
3205
|
name: illustration3DName,
|
|
@@ -1867,7 +3208,7 @@ function UrnIllustration({
|
|
|
1867
3208
|
}
|
|
1868
3209
|
) });
|
|
1869
3210
|
}
|
|
1870
|
-
return /* @__PURE__ */ (0,
|
|
3211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1871
3212
|
import_art4.Illustration,
|
|
1872
3213
|
{
|
|
1873
3214
|
className: "df-illustration",
|
|
@@ -1887,32 +3228,32 @@ var getIllustration3DName = (uri) => {
|
|
|
1887
3228
|
};
|
|
1888
3229
|
|
|
1889
3230
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1890
|
-
var
|
|
3231
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1891
3232
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1892
3233
|
function UrnImage(props) {
|
|
1893
3234
|
const { uri } = props;
|
|
1894
3235
|
if (isUrnIllustration(uri)) {
|
|
1895
|
-
return /* @__PURE__ */ (0,
|
|
3236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1896
3237
|
}
|
|
1897
3238
|
if (isUrnFlag(uri)) {
|
|
1898
|
-
return /* @__PURE__ */ (0,
|
|
3239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1899
3240
|
}
|
|
1900
3241
|
return null;
|
|
1901
3242
|
}
|
|
1902
3243
|
|
|
1903
3244
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1904
|
-
var
|
|
3245
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
1905
3246
|
var ImageRenderer = {
|
|
1906
3247
|
canRenderType: "image",
|
|
1907
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0,
|
|
3248
|
+
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UrlImage, __spreadValues({}, props))
|
|
1908
3249
|
};
|
|
1909
3250
|
|
|
1910
3251
|
// ../renderers/src/ImageRenderer/index.tsx
|
|
1911
3252
|
var ImageRenderer_default = ImageRenderer;
|
|
1912
3253
|
|
|
1913
3254
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1914
|
-
var
|
|
1915
|
-
var
|
|
3255
|
+
var import_components29 = require("@transferwise/components");
|
|
3256
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
1916
3257
|
var doContext = ["positive", "neutral"];
|
|
1917
3258
|
var dontContext = ["warning", "negative"];
|
|
1918
3259
|
var InstructionsRenderer = {
|
|
@@ -1920,16 +3261,16 @@ var InstructionsRenderer = {
|
|
|
1920
3261
|
render: ({ items, margin, title }) => {
|
|
1921
3262
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1922
3263
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1923
|
-
return /* @__PURE__ */ (0,
|
|
1924
|
-
title ? /* @__PURE__ */ (0,
|
|
1925
|
-
/* @__PURE__ */ (0,
|
|
3264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getMargin(margin), children: [
|
|
3265
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components29.Header, { title }) : null,
|
|
3266
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components29.InstructionsList, { dos, donts })
|
|
1926
3267
|
] });
|
|
1927
3268
|
}
|
|
1928
3269
|
};
|
|
1929
3270
|
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1930
3271
|
|
|
1931
3272
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1932
|
-
var
|
|
3273
|
+
var import_components30 = require("@transferwise/components");
|
|
1933
3274
|
|
|
1934
3275
|
// ../renderers/src/utils/input-utils.ts
|
|
1935
3276
|
var onWheel = (event) => {
|
|
@@ -1954,7 +3295,7 @@ function pick(obj, ...keys) {
|
|
|
1954
3295
|
}
|
|
1955
3296
|
|
|
1956
3297
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1957
|
-
var
|
|
3298
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
1958
3299
|
var IntegerInputRenderer = {
|
|
1959
3300
|
canRenderType: "input-integer",
|
|
1960
3301
|
render: (props) => {
|
|
@@ -1969,7 +3310,7 @@ var IntegerInputRenderer = {
|
|
|
1969
3310
|
"maximum",
|
|
1970
3311
|
"minimum"
|
|
1971
3312
|
);
|
|
1972
|
-
return /* @__PURE__ */ (0,
|
|
3313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1973
3314
|
FieldInput_default,
|
|
1974
3315
|
{
|
|
1975
3316
|
id,
|
|
@@ -1980,8 +3321,8 @@ var IntegerInputRenderer = {
|
|
|
1980
3321
|
loadingState: props.fieldLoadingState,
|
|
1981
3322
|
help,
|
|
1982
3323
|
features: props.features,
|
|
1983
|
-
children: /* @__PURE__ */ (0,
|
|
1984
|
-
|
|
3324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components30.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3325
|
+
import_components30.Input,
|
|
1985
3326
|
__spreadValues({
|
|
1986
3327
|
id,
|
|
1987
3328
|
name: id,
|
|
@@ -2003,39 +3344,12 @@ var IntegerInputRenderer = {
|
|
|
2003
3344
|
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
2004
3345
|
|
|
2005
3346
|
// ../renderers/src/ListRenderer.tsx
|
|
2006
|
-
var
|
|
2007
|
-
|
|
2008
|
-
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
2009
|
-
var import_components24 = require("@transferwise/components");
|
|
2010
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2011
|
-
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
2012
|
-
if (!callToAction) {
|
|
2013
|
-
return void 0;
|
|
2014
|
-
}
|
|
2015
|
-
const { accessibilityDescription, title, context } = callToAction;
|
|
2016
|
-
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
2017
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2018
|
-
import_components24.ListItem.Button,
|
|
2019
|
-
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
2020
|
-
partiallyInteractive: !fullyInteractive,
|
|
2021
|
-
priority,
|
|
2022
|
-
"aria-description": accessibilityDescription,
|
|
2023
|
-
sentiment,
|
|
2024
|
-
children: title
|
|
2025
|
-
})
|
|
2026
|
-
);
|
|
2027
|
-
};
|
|
2028
|
-
var getPriorityAndSentiment = (ctaSecondary, context) => {
|
|
2029
|
-
if (context === "negative") {
|
|
2030
|
-
return { priority: "secondary", sentiment: "negative" };
|
|
2031
|
-
}
|
|
2032
|
-
return { priority: ctaSecondary ? "secondary" : "secondary-neutral", sentiment: "default" };
|
|
2033
|
-
};
|
|
3347
|
+
var import_components32 = require("@transferwise/components");
|
|
2034
3348
|
|
|
2035
3349
|
// ../renderers/src/components/Header.tsx
|
|
2036
|
-
var
|
|
2037
|
-
var
|
|
2038
|
-
var
|
|
3350
|
+
var import_components31 = require("@transferwise/components");
|
|
3351
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3352
|
+
var Header = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components31.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) });
|
|
2039
3353
|
var getHeaderAction = (callToAction) => {
|
|
2040
3354
|
if (!callToAction) {
|
|
2041
3355
|
return void 0;
|
|
@@ -2047,11 +3361,11 @@ var getHeaderAction = (callToAction) => {
|
|
|
2047
3361
|
};
|
|
2048
3362
|
|
|
2049
3363
|
// ../renderers/src/ListRenderer.tsx
|
|
2050
|
-
var
|
|
3364
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2051
3365
|
var ListRenderer = {
|
|
2052
3366
|
canRenderType: "list",
|
|
2053
|
-
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0,
|
|
2054
|
-
/* @__PURE__ */ (0,
|
|
3367
|
+
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getMargin(margin), children: [
|
|
3368
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Header, { title, callToAction }),
|
|
2055
3369
|
items.map((item) => {
|
|
2056
3370
|
var _a, _b;
|
|
2057
3371
|
const {
|
|
@@ -2068,8 +3382,8 @@ var ListRenderer = {
|
|
|
2068
3382
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
2069
3383
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
2070
3384
|
};
|
|
2071
|
-
return /* @__PURE__ */ (0,
|
|
2072
|
-
|
|
3385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3386
|
+
import_components32.ListItem,
|
|
2073
3387
|
{
|
|
2074
3388
|
title: itemTitle,
|
|
2075
3389
|
subtitle: description,
|
|
@@ -2088,12 +3402,12 @@ var ListRenderer = {
|
|
|
2088
3402
|
var ListRenderer_default = ListRenderer;
|
|
2089
3403
|
|
|
2090
3404
|
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
2091
|
-
var
|
|
2092
|
-
var
|
|
3405
|
+
var import_components33 = require("@transferwise/components");
|
|
3406
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2093
3407
|
var LoadingIndicatorRenderer = {
|
|
2094
3408
|
canRenderType: "loading-indicator",
|
|
2095
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0,
|
|
2096
|
-
|
|
3409
|
+
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3410
|
+
import_components33.Loader,
|
|
2097
3411
|
{
|
|
2098
3412
|
size,
|
|
2099
3413
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
@@ -2104,13 +3418,13 @@ var LoadingIndicatorRenderer = {
|
|
|
2104
3418
|
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
2105
3419
|
|
|
2106
3420
|
// ../renderers/src/MarkdownRenderer.tsx
|
|
2107
|
-
var
|
|
3421
|
+
var import_components34 = require("@transferwise/components");
|
|
2108
3422
|
var import_classnames4 = __toESM(require_classnames());
|
|
2109
|
-
var
|
|
3423
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2110
3424
|
var MarkdownRenderer = {
|
|
2111
3425
|
canRenderType: "markdown",
|
|
2112
|
-
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0,
|
|
2113
|
-
|
|
3426
|
+
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3427
|
+
import_components34.Markdown,
|
|
2114
3428
|
{
|
|
2115
3429
|
className: (0, import_classnames4.default)(
|
|
2116
3430
|
"df-markdown",
|
|
@@ -2124,16 +3438,16 @@ var MarkdownRenderer = {
|
|
|
2124
3438
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
2125
3439
|
|
|
2126
3440
|
// ../renderers/src/MediaRenderer.tsx
|
|
2127
|
-
var
|
|
3441
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2128
3442
|
var MediaRenderer = {
|
|
2129
3443
|
canRenderType: "media",
|
|
2130
3444
|
render: (_a) => {
|
|
2131
3445
|
var _b = _a, { media } = _b, rest = __objRest(_b, ["media"]);
|
|
2132
3446
|
switch (media.type) {
|
|
2133
3447
|
case "avatar":
|
|
2134
|
-
return /* @__PURE__ */ (0,
|
|
3448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(AvatarMediaRendererComponent, __spreadValues({ media }, rest));
|
|
2135
3449
|
case "image":
|
|
2136
|
-
return /* @__PURE__ */ (0,
|
|
3450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ImageMediaRendererComponent, __spreadValues({ media }, rest));
|
|
2137
3451
|
case "legacy":
|
|
2138
3452
|
return null;
|
|
2139
3453
|
}
|
|
@@ -2145,7 +3459,7 @@ var AvatarMediaRendererComponent = ({
|
|
|
2145
3459
|
margin,
|
|
2146
3460
|
size
|
|
2147
3461
|
}) => {
|
|
2148
|
-
return /* @__PURE__ */ (0,
|
|
3462
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: `df-media-layout-avatar ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Media, { media, size: mapAvatarMediaSize(size) }) });
|
|
2149
3463
|
};
|
|
2150
3464
|
var ImageMediaRendererComponent = (_a) => {
|
|
2151
3465
|
var _b = _a, {
|
|
@@ -2153,7 +3467,7 @@ var ImageMediaRendererComponent = (_a) => {
|
|
|
2153
3467
|
} = _b, rest = __objRest(_b, [
|
|
2154
3468
|
"media"
|
|
2155
3469
|
]);
|
|
2156
|
-
return isUrnImage(media.uri) ? /* @__PURE__ */ (0,
|
|
3470
|
+
return isUrnImage(media.uri) ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(UrnImage, __spreadValues({ uri: media.uri, accessibilityDescription: media.accessibilityDescription }, rest)) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(UrlImage, __spreadValues({ uri: media.uri, accessibilityDescription: media.accessibilityDescription }, rest));
|
|
2157
3471
|
};
|
|
2158
3472
|
var mapAvatarMediaSize = (size) => {
|
|
2159
3473
|
switch (size) {
|
|
@@ -2171,21 +3485,21 @@ var mapAvatarMediaSize = (size) => {
|
|
|
2171
3485
|
};
|
|
2172
3486
|
|
|
2173
3487
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
2174
|
-
var
|
|
2175
|
-
var
|
|
2176
|
-
var
|
|
3488
|
+
var import_components35 = require("@transferwise/components");
|
|
3489
|
+
var import_react13 = require("react");
|
|
3490
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2177
3491
|
var ModalLayoutRenderer = {
|
|
2178
3492
|
canRenderType: "modal-layout",
|
|
2179
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
3493
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DFModal, __spreadValues({}, props))
|
|
2180
3494
|
};
|
|
2181
3495
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
2182
3496
|
function DFModal({ content, margin, trigger }) {
|
|
2183
|
-
const [visible, setVisible] = (0,
|
|
3497
|
+
const [visible, setVisible] = (0, import_react13.useState)(false);
|
|
2184
3498
|
const { children, title } = content;
|
|
2185
|
-
return /* @__PURE__ */ (0,
|
|
2186
|
-
/* @__PURE__ */ (0,
|
|
2187
|
-
/* @__PURE__ */ (0,
|
|
2188
|
-
|
|
3499
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: getMargin(margin), children: [
|
|
3500
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components35.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
3501
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3502
|
+
import_components35.Modal,
|
|
2189
3503
|
{
|
|
2190
3504
|
scroll: "content",
|
|
2191
3505
|
open: visible,
|
|
@@ -2199,20 +3513,20 @@ function DFModal({ content, margin, trigger }) {
|
|
|
2199
3513
|
}
|
|
2200
3514
|
|
|
2201
3515
|
// ../renderers/src/ModalRenderer.tsx
|
|
2202
|
-
var
|
|
2203
|
-
var
|
|
3516
|
+
var import_components36 = require("@transferwise/components");
|
|
3517
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2204
3518
|
var ModalRenderer = {
|
|
2205
3519
|
canRenderType: "modal",
|
|
2206
3520
|
render: ({ title, children, open, onClose }) => {
|
|
2207
|
-
return /* @__PURE__ */ (0,
|
|
3521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components36.Modal, { open, title, body: children, onClose });
|
|
2208
3522
|
}
|
|
2209
3523
|
};
|
|
2210
3524
|
|
|
2211
3525
|
// ../renderers/src/MoneyInputRenderer.tsx
|
|
2212
|
-
var
|
|
2213
|
-
var
|
|
2214
|
-
var
|
|
2215
|
-
var
|
|
3526
|
+
var import_components37 = require("@transferwise/components");
|
|
3527
|
+
var import_react14 = require("react");
|
|
3528
|
+
var import_react_intl13 = require("react-intl");
|
|
3529
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2216
3530
|
var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
2217
3531
|
var MoneyInputRenderer = {
|
|
2218
3532
|
canRenderType: "money-input",
|
|
@@ -2233,13 +3547,13 @@ function MoneyInputRendererComponent(props) {
|
|
|
2233
3547
|
onAmountChange,
|
|
2234
3548
|
onCurrencyChange
|
|
2235
3549
|
} = props;
|
|
2236
|
-
(0,
|
|
3550
|
+
(0, import_react14.useEffect)(() => {
|
|
2237
3551
|
if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
|
|
2238
3552
|
onCurrencyChange(0);
|
|
2239
3553
|
}
|
|
2240
3554
|
}, [selectedCurrencyIndex, onCurrencyChange, currencies.length]);
|
|
2241
|
-
const { formatMessage } = (0,
|
|
2242
|
-
return /* @__PURE__ */ (0,
|
|
3555
|
+
const { formatMessage } = (0, import_react_intl13.useIntl)();
|
|
3556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2243
3557
|
FieldInput_default,
|
|
2244
3558
|
{
|
|
2245
3559
|
id: uid,
|
|
@@ -2248,8 +3562,8 @@ function MoneyInputRendererComponent(props) {
|
|
|
2248
3562
|
validation: validationState,
|
|
2249
3563
|
help,
|
|
2250
3564
|
features: props.features,
|
|
2251
|
-
children: /* @__PURE__ */ (0,
|
|
2252
|
-
|
|
3565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3566
|
+
import_components37.MoneyInput,
|
|
2253
3567
|
{
|
|
2254
3568
|
amount: parseFloatOrNull(amountValue),
|
|
2255
3569
|
searchPlaceholder: "",
|
|
@@ -2310,8 +3624,8 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
2310
3624
|
}
|
|
2311
3625
|
|
|
2312
3626
|
// ../renderers/src/MultiSelectInputRenderer/InlineComponent.tsx
|
|
2313
|
-
var
|
|
2314
|
-
var
|
|
3627
|
+
var import_components38 = require("@transferwise/components");
|
|
3628
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2315
3629
|
function InlineComponent(props) {
|
|
2316
3630
|
const {
|
|
2317
3631
|
id,
|
|
@@ -2325,7 +3639,7 @@ function InlineComponent(props) {
|
|
|
2325
3639
|
validationState,
|
|
2326
3640
|
onSelect
|
|
2327
3641
|
} = props;
|
|
2328
|
-
return /* @__PURE__ */ (0,
|
|
3642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2329
3643
|
FieldInput_default,
|
|
2330
3644
|
{
|
|
2331
3645
|
id,
|
|
@@ -2347,8 +3661,8 @@ function InlineComponent(props) {
|
|
|
2347
3661
|
childrenProps
|
|
2348
3662
|
} = option;
|
|
2349
3663
|
const key = (_a = childrenProps == null ? void 0 : childrenProps.uid) != null ? _a : index;
|
|
2350
|
-
return /* @__PURE__ */ (0,
|
|
2351
|
-
|
|
3664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3665
|
+
import_components38.ListItem,
|
|
2352
3666
|
{
|
|
2353
3667
|
title: itemTitle,
|
|
2354
3668
|
subtitle,
|
|
@@ -2356,10 +3670,10 @@ function InlineComponent(props) {
|
|
|
2356
3670
|
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
2357
3671
|
media: getMedia(media, false),
|
|
2358
3672
|
prompt: getInlineAlert(inlineAlert),
|
|
2359
|
-
additionalInfo: additionalText ? /* @__PURE__ */ (0,
|
|
3673
|
+
additionalInfo: additionalText ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components38.ListItem.AdditionalInfo, { children: additionalText }) : void 0,
|
|
2360
3674
|
disabled: disabled || optionDisabled,
|
|
2361
|
-
control: /* @__PURE__ */ (0,
|
|
2362
|
-
|
|
3675
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3676
|
+
import_components38.ListItem.Checkbox,
|
|
2363
3677
|
{
|
|
2364
3678
|
checked: selectedIndices.includes(index),
|
|
2365
3679
|
onChange: (e) => {
|
|
@@ -2377,13 +3691,13 @@ function InlineComponent(props) {
|
|
|
2377
3691
|
}
|
|
2378
3692
|
|
|
2379
3693
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
2380
|
-
var
|
|
2381
|
-
var
|
|
2382
|
-
var
|
|
3694
|
+
var import_components39 = require("@transferwise/components");
|
|
3695
|
+
var import_react15 = require("react");
|
|
3696
|
+
var import_react_intl15 = require("react-intl");
|
|
2383
3697
|
|
|
2384
3698
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
2385
|
-
var
|
|
2386
|
-
var multi_select_messages_default = (0,
|
|
3699
|
+
var import_react_intl14 = require("react-intl");
|
|
3700
|
+
var multi_select_messages_default = (0, import_react_intl14.defineMessages)({
|
|
2387
3701
|
summary: {
|
|
2388
3702
|
id: "df.wise.MultiSelect.summary",
|
|
2389
3703
|
defaultMessage: "{first} and {count} more",
|
|
@@ -2392,10 +3706,10 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
2392
3706
|
});
|
|
2393
3707
|
|
|
2394
3708
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
2395
|
-
var
|
|
3709
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2396
3710
|
function DefaultComponent(props) {
|
|
2397
|
-
const { formatMessage } = (0,
|
|
2398
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
3711
|
+
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
3712
|
+
const [stagedIndices, setStagedIndices] = (0, import_react15.useState)();
|
|
2399
3713
|
const {
|
|
2400
3714
|
id,
|
|
2401
3715
|
autoComplete,
|
|
@@ -2434,12 +3748,12 @@ function DefaultComponent(props) {
|
|
|
2434
3748
|
const contentProps = {
|
|
2435
3749
|
title: option.title,
|
|
2436
3750
|
description: option.description,
|
|
2437
|
-
icon: /* @__PURE__ */ (0,
|
|
3751
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2438
3752
|
};
|
|
2439
|
-
return /* @__PURE__ */ (0,
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components39.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2440
3754
|
};
|
|
2441
3755
|
const extraProps = { autoComplete };
|
|
2442
|
-
return /* @__PURE__ */ (0,
|
|
3756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2443
3757
|
FieldInput_default,
|
|
2444
3758
|
{
|
|
2445
3759
|
id,
|
|
@@ -2448,8 +3762,8 @@ function DefaultComponent(props) {
|
|
|
2448
3762
|
description,
|
|
2449
3763
|
validation: validationState,
|
|
2450
3764
|
features,
|
|
2451
|
-
children: /* @__PURE__ */ (0,
|
|
2452
|
-
|
|
3765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3766
|
+
import_components39.SelectInput,
|
|
2453
3767
|
__spreadValues({
|
|
2454
3768
|
id,
|
|
2455
3769
|
items: options.map((option, index) => {
|
|
@@ -2487,8 +3801,8 @@ function DefaultComponent(props) {
|
|
|
2487
3801
|
}
|
|
2488
3802
|
|
|
2489
3803
|
// ../renderers/src/MultiSelectInputRenderer/InlineCheckboxComponent.tsx
|
|
2490
|
-
var
|
|
2491
|
-
var
|
|
3804
|
+
var import_components40 = require("@transferwise/components");
|
|
3805
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
2492
3806
|
function InlineCheckboxComponent(props) {
|
|
2493
3807
|
const {
|
|
2494
3808
|
id,
|
|
@@ -2502,7 +3816,7 @@ function InlineCheckboxComponent(props) {
|
|
|
2502
3816
|
validationState,
|
|
2503
3817
|
onSelect
|
|
2504
3818
|
} = props;
|
|
2505
|
-
return /* @__PURE__ */ (0,
|
|
3819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
2506
3820
|
FieldInput_default,
|
|
2507
3821
|
{
|
|
2508
3822
|
id,
|
|
@@ -2531,35 +3845,35 @@ function InlineCheckboxComponent(props) {
|
|
|
2531
3845
|
onSelect(newSelectedIndices);
|
|
2532
3846
|
}
|
|
2533
3847
|
};
|
|
2534
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_components40.Checkbox, __spreadProps(__spreadValues({}, checkboxProps), { className: "m-t-1" }), key);
|
|
2535
3849
|
})
|
|
2536
3850
|
}
|
|
2537
3851
|
);
|
|
2538
3852
|
}
|
|
2539
3853
|
|
|
2540
3854
|
// ../renderers/src/MultiSelectInputRenderer/MultiSelectInputRenderer.tsx
|
|
2541
|
-
var
|
|
3855
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
2542
3856
|
var MultiSelectInputRenderer = {
|
|
2543
3857
|
canRenderType: "input-multi-select",
|
|
2544
3858
|
render: (props) => {
|
|
2545
3859
|
switch (props.control) {
|
|
2546
3860
|
case "inline":
|
|
2547
|
-
return /* @__PURE__ */ (0,
|
|
3861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InlineComponent, __spreadValues({}, props));
|
|
2548
3862
|
case "inline-checkbox-group":
|
|
2549
|
-
return /* @__PURE__ */ (0,
|
|
3863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InlineCheckboxComponent, __spreadValues({}, props));
|
|
2550
3864
|
default:
|
|
2551
|
-
return /* @__PURE__ */ (0,
|
|
3865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DefaultComponent, __spreadValues({}, props));
|
|
2552
3866
|
}
|
|
2553
3867
|
}
|
|
2554
3868
|
};
|
|
2555
3869
|
|
|
2556
3870
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
2557
|
-
var
|
|
3871
|
+
var import_components42 = require("@transferwise/components");
|
|
2558
3872
|
|
|
2559
3873
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
2560
|
-
var
|
|
3874
|
+
var import_components41 = require("@transferwise/components");
|
|
2561
3875
|
var import_classnames5 = __toESM(require_classnames());
|
|
2562
|
-
var
|
|
3876
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
2563
3877
|
function UploadFieldInput({
|
|
2564
3878
|
id,
|
|
2565
3879
|
children,
|
|
@@ -2569,10 +3883,10 @@ function UploadFieldInput({
|
|
|
2569
3883
|
validation,
|
|
2570
3884
|
features
|
|
2571
3885
|
}) {
|
|
2572
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
3886
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
2573
3887
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2574
3888
|
const { ref } = useScrollToError(validation, features);
|
|
2575
|
-
return /* @__PURE__ */ (0,
|
|
3889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
2576
3890
|
"div",
|
|
2577
3891
|
{
|
|
2578
3892
|
ref,
|
|
@@ -2580,9 +3894,9 @@ function UploadFieldInput({
|
|
|
2580
3894
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
2581
3895
|
}),
|
|
2582
3896
|
children: [
|
|
2583
|
-
/* @__PURE__ */ (0,
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
2584
3898
|
children,
|
|
2585
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0,
|
|
3899
|
+
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components41.InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
2586
3900
|
]
|
|
2587
3901
|
}
|
|
2588
3902
|
);
|
|
@@ -2617,7 +3931,7 @@ var getSizeLimit = (maxSize) => {
|
|
|
2617
3931
|
};
|
|
2618
3932
|
|
|
2619
3933
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
2620
|
-
var
|
|
3934
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
2621
3935
|
var MultiUploadInputRenderer = {
|
|
2622
3936
|
canRenderType: "input-upload-multi",
|
|
2623
3937
|
render: (props) => {
|
|
@@ -2643,7 +3957,7 @@ var MultiUploadInputRenderer = {
|
|
|
2643
3957
|
};
|
|
2644
3958
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
2645
3959
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2646
|
-
return /* @__PURE__ */ (0,
|
|
3960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
2647
3961
|
UploadFieldInput_default,
|
|
2648
3962
|
{
|
|
2649
3963
|
id,
|
|
@@ -2652,17 +3966,17 @@ var MultiUploadInputRenderer = {
|
|
|
2652
3966
|
validation: validationState,
|
|
2653
3967
|
help,
|
|
2654
3968
|
features,
|
|
2655
|
-
children: /* @__PURE__ */ (0,
|
|
2656
|
-
|
|
3969
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3970
|
+
import_components42.UploadInput,
|
|
2657
3971
|
{
|
|
2658
3972
|
id,
|
|
2659
3973
|
"aria-describedby": descriptionId,
|
|
2660
3974
|
description,
|
|
2661
3975
|
disabled,
|
|
2662
|
-
files: value.map(({ id:
|
|
2663
|
-
id:
|
|
3976
|
+
files: value.map(({ id: fileId, file, validationState: fileValidationState }) => ({
|
|
3977
|
+
id: fileId,
|
|
2664
3978
|
filename: file.name,
|
|
2665
|
-
status: (
|
|
3979
|
+
status: (fileValidationState == null ? void 0 : fileValidationState.status) === "invalid" ? import_components42.Status.FAILED : import_components42.Status.SUCCEEDED
|
|
2666
3980
|
})),
|
|
2667
3981
|
fileTypes: acceptsToFileTypes(accepts),
|
|
2668
3982
|
maxFiles: maxItems,
|
|
@@ -2680,8 +3994,8 @@ var MultiUploadInputRenderer = {
|
|
|
2680
3994
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
2681
3995
|
|
|
2682
3996
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
2683
|
-
var
|
|
2684
|
-
var
|
|
3997
|
+
var import_components43 = require("@transferwise/components");
|
|
3998
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
2685
3999
|
var NumberInputRenderer = {
|
|
2686
4000
|
canRenderType: "input-number",
|
|
2687
4001
|
render: (props) => {
|
|
@@ -2695,7 +4009,7 @@ var NumberInputRenderer = {
|
|
|
2695
4009
|
"maximum",
|
|
2696
4010
|
"minimum"
|
|
2697
4011
|
);
|
|
2698
|
-
return /* @__PURE__ */ (0,
|
|
4012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2699
4013
|
FieldInput_default,
|
|
2700
4014
|
{
|
|
2701
4015
|
id,
|
|
@@ -2706,8 +4020,8 @@ var NumberInputRenderer = {
|
|
|
2706
4020
|
loadingState: props.fieldLoadingState,
|
|
2707
4021
|
help,
|
|
2708
4022
|
features: props.features,
|
|
2709
|
-
children: /* @__PURE__ */ (0,
|
|
2710
|
-
|
|
4023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components43.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
4024
|
+
import_components43.Input,
|
|
2711
4025
|
__spreadValues({
|
|
2712
4026
|
id,
|
|
2713
4027
|
name: id,
|
|
@@ -2727,24 +4041,24 @@ var NumberInputRenderer = {
|
|
|
2727
4041
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
2728
4042
|
|
|
2729
4043
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2730
|
-
var
|
|
4044
|
+
var import_react_intl17 = require("react-intl");
|
|
2731
4045
|
|
|
2732
4046
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
2733
|
-
var
|
|
2734
|
-
var
|
|
4047
|
+
var import_components44 = require("@transferwise/components");
|
|
4048
|
+
var import_react16 = require("react");
|
|
2735
4049
|
function useSnackBarIfAvailable() {
|
|
2736
|
-
const context = (0,
|
|
4050
|
+
const context = (0, import_react16.useContext)(import_components44.SnackbarContext);
|
|
2737
4051
|
return context ? context.createSnackbar : () => {
|
|
2738
4052
|
};
|
|
2739
4053
|
}
|
|
2740
4054
|
|
|
2741
4055
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2742
|
-
var
|
|
4056
|
+
var import_components45 = require("@transferwise/components");
|
|
2743
4057
|
var import_classnames6 = __toESM(require_classnames());
|
|
2744
4058
|
|
|
2745
4059
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
2746
|
-
var
|
|
2747
|
-
var paragraph_messages_default = (0,
|
|
4060
|
+
var import_react_intl16 = require("react-intl");
|
|
4061
|
+
var paragraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
2748
4062
|
copy: {
|
|
2749
4063
|
id: "df.wise.DynamicParagraph.copy",
|
|
2750
4064
|
defaultMessage: "Copy",
|
|
@@ -2758,14 +4072,14 @@ var paragraph_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
2758
4072
|
});
|
|
2759
4073
|
|
|
2760
4074
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2761
|
-
var
|
|
4075
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
2762
4076
|
var ParagraphRenderer = {
|
|
2763
4077
|
canRenderType: "paragraph",
|
|
2764
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4078
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Paragraph, __spreadValues({}, props))
|
|
2765
4079
|
};
|
|
2766
4080
|
function Paragraph({ align, control, margin, size, text }) {
|
|
2767
4081
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
2768
|
-
return control === "copyable" ? /* @__PURE__ */ (0,
|
|
4082
|
+
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2769
4083
|
"p",
|
|
2770
4084
|
{
|
|
2771
4085
|
className: `${["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large"} ${className}`,
|
|
@@ -2778,16 +4092,16 @@ function CopyableParagraph({
|
|
|
2778
4092
|
align,
|
|
2779
4093
|
className
|
|
2780
4094
|
}) {
|
|
2781
|
-
const { formatMessage } = (0,
|
|
4095
|
+
const { formatMessage } = (0, import_react_intl17.useIntl)();
|
|
2782
4096
|
const createSnackbar = useSnackBarIfAvailable();
|
|
2783
4097
|
const copy = () => {
|
|
2784
4098
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
2785
4099
|
});
|
|
2786
4100
|
};
|
|
2787
4101
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
2788
|
-
return /* @__PURE__ */ (0,
|
|
2789
|
-
/* @__PURE__ */ (0,
|
|
2790
|
-
|
|
4102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className, children: [
|
|
4103
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
4104
|
+
import_components45.Input,
|
|
2791
4105
|
{
|
|
2792
4106
|
type: "text",
|
|
2793
4107
|
value: text,
|
|
@@ -2795,23 +4109,23 @@ function CopyableParagraph({
|
|
|
2795
4109
|
className: (0, import_classnames6.default)("text-ellipsis", inputAlignmentClasses)
|
|
2796
4110
|
}
|
|
2797
4111
|
),
|
|
2798
|
-
/* @__PURE__ */ (0,
|
|
4112
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components45.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
2799
4113
|
] });
|
|
2800
4114
|
}
|
|
2801
4115
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
2802
4116
|
|
|
2803
4117
|
// ../renderers/src/ProgressRenderer.tsx
|
|
2804
|
-
var
|
|
2805
|
-
var
|
|
4118
|
+
var import_components46 = require("@transferwise/components");
|
|
4119
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
2806
4120
|
var ProgressRenderer = {
|
|
2807
4121
|
canRenderType: "progress",
|
|
2808
4122
|
render: ({ uid, title, help, progress, progressText, margin, description }) => {
|
|
2809
|
-
return /* @__PURE__ */ (0,
|
|
2810
|
-
|
|
4123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4124
|
+
import_components46.ProgressBar,
|
|
2811
4125
|
{
|
|
2812
4126
|
id: uid,
|
|
2813
4127
|
className: getMargin(margin),
|
|
2814
|
-
title: title && help ? /* @__PURE__ */ (0,
|
|
4128
|
+
title: title && help ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LabelContentWithHelp, { text: title, help }) : title,
|
|
2815
4129
|
description,
|
|
2816
4130
|
progress: {
|
|
2817
4131
|
max: 1,
|
|
@@ -2824,15 +4138,15 @@ var ProgressRenderer = {
|
|
|
2824
4138
|
};
|
|
2825
4139
|
|
|
2826
4140
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2827
|
-
var
|
|
2828
|
-
var
|
|
4141
|
+
var import_components47 = require("@transferwise/components");
|
|
4142
|
+
var import_icons2 = require("@transferwise/icons");
|
|
2829
4143
|
var import_classnames7 = __toESM(require_classnames());
|
|
2830
|
-
var
|
|
2831
|
-
var
|
|
4144
|
+
var import_react17 = require("react");
|
|
4145
|
+
var import_react_intl19 = require("react-intl");
|
|
2832
4146
|
|
|
2833
4147
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
2834
|
-
var
|
|
2835
|
-
var repeatable_messages_default = (0,
|
|
4148
|
+
var import_react_intl18 = require("react-intl");
|
|
4149
|
+
var repeatable_messages_default = (0, import_react_intl18.defineMessages)({
|
|
2836
4150
|
addItemTitle: {
|
|
2837
4151
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
2838
4152
|
defaultMessage: "Add Item",
|
|
@@ -2856,10 +4170,10 @@ var repeatable_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
2856
4170
|
});
|
|
2857
4171
|
|
|
2858
4172
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2859
|
-
var
|
|
4173
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
2860
4174
|
var RepeatableRenderer = {
|
|
2861
4175
|
canRenderType: "repeatable",
|
|
2862
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4176
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Repeatable, __spreadValues({}, props))
|
|
2863
4177
|
};
|
|
2864
4178
|
function Repeatable(props) {
|
|
2865
4179
|
const {
|
|
@@ -2876,8 +4190,8 @@ function Repeatable(props) {
|
|
|
2876
4190
|
onSave,
|
|
2877
4191
|
onRemove
|
|
2878
4192
|
} = props;
|
|
2879
|
-
const { formatMessage } = (0,
|
|
2880
|
-
const [openModalType, setOpenModalType] = (0,
|
|
4193
|
+
const { formatMessage } = (0, import_react_intl19.useIntl)();
|
|
4194
|
+
const [openModalType, setOpenModalType] = (0, import_react17.useState)(null);
|
|
2881
4195
|
const { ref } = useScrollToError(validationState, features);
|
|
2882
4196
|
const onAddItem = () => {
|
|
2883
4197
|
onAdd();
|
|
@@ -2900,43 +4214,43 @@ function Repeatable(props) {
|
|
|
2900
4214
|
const onCancelEdit = () => {
|
|
2901
4215
|
setOpenModalType(null);
|
|
2902
4216
|
};
|
|
2903
|
-
return /* @__PURE__ */ (0,
|
|
2904
|
-
/* @__PURE__ */ (0,
|
|
2905
|
-
title && /* @__PURE__ */ (0,
|
|
2906
|
-
description && /* @__PURE__ */ (0,
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
4217
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
4218
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { ref, children: [
|
|
4219
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components47.Header, { title }),
|
|
4220
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { children: description }),
|
|
4221
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
2908
4222
|
"div",
|
|
2909
4223
|
{
|
|
2910
4224
|
className: (0, import_classnames7.default)("form-group", {
|
|
2911
4225
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2912
4226
|
}),
|
|
2913
4227
|
children: [
|
|
2914
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
2915
|
-
/* @__PURE__ */ (0,
|
|
2916
|
-
|
|
4228
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
4229
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4230
|
+
import_components47.NavigationOption,
|
|
2917
4231
|
{
|
|
2918
|
-
media: /* @__PURE__ */ (0,
|
|
4232
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_icons2.Plus, {}),
|
|
2919
4233
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2920
4234
|
showMediaAtAllSizes: true,
|
|
2921
4235
|
onClick: () => onAddItem()
|
|
2922
4236
|
}
|
|
2923
4237
|
),
|
|
2924
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
4238
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components47.InlineAlert, { type: "negative", children: validationState.message })
|
|
2925
4239
|
]
|
|
2926
4240
|
}
|
|
2927
4241
|
)
|
|
2928
4242
|
] }),
|
|
2929
|
-
/* @__PURE__ */ (0,
|
|
2930
|
-
|
|
4243
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4244
|
+
import_components47.Modal,
|
|
2931
4245
|
{
|
|
2932
4246
|
open: openModalType !== null,
|
|
2933
4247
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2934
|
-
body: /* @__PURE__ */ (0,
|
|
2935
|
-
/* @__PURE__ */ (0,
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
2937
|
-
/* @__PURE__ */ (0,
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
|
|
4248
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
4249
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
4250
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
4251
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components47.Button, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
4252
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4253
|
+
import_components47.Button,
|
|
2940
4254
|
{
|
|
2941
4255
|
v2: true,
|
|
2942
4256
|
priority: "secondary",
|
|
@@ -2957,10 +4271,10 @@ function ItemSummaryOption({
|
|
|
2957
4271
|
item,
|
|
2958
4272
|
onClick
|
|
2959
4273
|
}) {
|
|
2960
|
-
return /* @__PURE__ */ (0,
|
|
2961
|
-
|
|
4274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4275
|
+
import_components47.NavigationOption,
|
|
2962
4276
|
{
|
|
2963
|
-
media: /* @__PURE__ */ (0,
|
|
4277
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(OptionMedia, { media: item.media, preferAvatar: false }),
|
|
2964
4278
|
title: item.title,
|
|
2965
4279
|
content: item.description,
|
|
2966
4280
|
showMediaAtAllSizes: true,
|
|
@@ -2972,16 +4286,16 @@ function ItemSummaryOption({
|
|
|
2972
4286
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2973
4287
|
|
|
2974
4288
|
// ../renderers/src/ReviewLegacyRenderer.tsx
|
|
2975
|
-
var
|
|
2976
|
-
var
|
|
4289
|
+
var import_components48 = require("@transferwise/components");
|
|
4290
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
2977
4291
|
var ReviewRenderer = {
|
|
2978
4292
|
canRenderType: "review",
|
|
2979
4293
|
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2980
4294
|
const orientation = mapControlToDefinitionListLayout(control);
|
|
2981
|
-
return /* @__PURE__ */ (0,
|
|
2982
|
-
/* @__PURE__ */ (0,
|
|
2983
|
-
/* @__PURE__ */ (0,
|
|
2984
|
-
|
|
4295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: getMargin(margin), children: [
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Header, { title, callToAction }),
|
|
4297
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4298
|
+
import_components48.DefinitionList,
|
|
2985
4299
|
{
|
|
2986
4300
|
layout: orientation,
|
|
2987
4301
|
definitions: fields.map(
|
|
@@ -3018,20 +4332,20 @@ var mapControlToDefinitionListLayout = (control) => {
|
|
|
3018
4332
|
};
|
|
3019
4333
|
var getFieldLabel = (label, help, onClick) => {
|
|
3020
4334
|
if (help) {
|
|
3021
|
-
return /* @__PURE__ */ (0,
|
|
4335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
3022
4336
|
label,
|
|
3023
4337
|
" ",
|
|
3024
|
-
/* @__PURE__ */ (0,
|
|
4338
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Help_default, { help, onClick })
|
|
3025
4339
|
] });
|
|
3026
4340
|
}
|
|
3027
4341
|
return label;
|
|
3028
4342
|
};
|
|
3029
4343
|
|
|
3030
4344
|
// ../renderers/src/ReviewRenderer.tsx
|
|
3031
|
-
var
|
|
3032
|
-
var
|
|
3033
|
-
var
|
|
3034
|
-
var
|
|
4345
|
+
var import_components49 = require("@transferwise/components");
|
|
4346
|
+
var import_icons3 = require("@transferwise/icons");
|
|
4347
|
+
var import_react_intl20 = require("react-intl");
|
|
4348
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
3035
4349
|
var IGNORED_CONTROLS = [
|
|
3036
4350
|
"horizontal",
|
|
3037
4351
|
"horizontal-end-aligned",
|
|
@@ -3041,7 +4355,7 @@ var IGNORED_CONTROLS = [
|
|
|
3041
4355
|
var ReviewRenderer2 = {
|
|
3042
4356
|
canRenderType: "review",
|
|
3043
4357
|
canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
|
|
3044
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4358
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Review, __spreadValues({}, props))
|
|
3045
4359
|
};
|
|
3046
4360
|
var Review = ({
|
|
3047
4361
|
callToAction,
|
|
@@ -3052,9 +4366,9 @@ var Review = ({
|
|
|
3052
4366
|
title,
|
|
3053
4367
|
trackEvent
|
|
3054
4368
|
}) => {
|
|
3055
|
-
const intl = (0,
|
|
3056
|
-
return /* @__PURE__ */ (0,
|
|
3057
|
-
/* @__PURE__ */ (0,
|
|
4369
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
4370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: getMargin(margin), children: [
|
|
4371
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Header, { title, callToAction }),
|
|
3058
4372
|
fields.map((field) => {
|
|
3059
4373
|
var _a, _b, _c;
|
|
3060
4374
|
const {
|
|
@@ -3072,8 +4386,8 @@ var Review = ({
|
|
|
3072
4386
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3073
4387
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3074
4388
|
};
|
|
3075
|
-
return /* @__PURE__ */ (0,
|
|
3076
|
-
|
|
4389
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4390
|
+
import_components49.ListItem,
|
|
3077
4391
|
{
|
|
3078
4392
|
title: value,
|
|
3079
4393
|
subtitle: label,
|
|
@@ -3093,18 +4407,18 @@ var Review = ({
|
|
|
3093
4407
|
] });
|
|
3094
4408
|
};
|
|
3095
4409
|
var getHelpControl = (help, ariaLabel, onClick) => {
|
|
3096
|
-
return /* @__PURE__ */ (0,
|
|
4410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components49.Popover, { content: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components49.Markdown, { config: { link: { target: "_blank" } }, children: help }), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components49.ListItem.IconButton, { partiallyInteractive: true, "aria-label": ariaLabel, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_icons3.QuestionMarkCircle, {}) }) });
|
|
3097
4411
|
};
|
|
3098
4412
|
var ReviewRenderer_default = ReviewRenderer2;
|
|
3099
4413
|
|
|
3100
4414
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
3101
|
-
var
|
|
3102
|
-
var
|
|
3103
|
-
var
|
|
4415
|
+
var import_components51 = require("@transferwise/components");
|
|
4416
|
+
var import_react18 = require("react");
|
|
4417
|
+
var import_react_intl24 = require("react-intl");
|
|
3104
4418
|
|
|
3105
4419
|
// ../renderers/src/messages/search.messages.ts
|
|
3106
|
-
var
|
|
3107
|
-
var search_messages_default = (0,
|
|
4420
|
+
var import_react_intl21 = require("react-intl");
|
|
4421
|
+
var search_messages_default = (0, import_react_intl21.defineMessages)({
|
|
3108
4422
|
loading: {
|
|
3109
4423
|
id: "df.wise.SearchLayout.loading",
|
|
3110
4424
|
defaultMessage: "Loading...",
|
|
@@ -3113,11 +4427,11 @@ var search_messages_default = (0, import_react_intl19.defineMessages)({
|
|
|
3113
4427
|
});
|
|
3114
4428
|
|
|
3115
4429
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
3116
|
-
var
|
|
4430
|
+
var import_react_intl23 = require("react-intl");
|
|
3117
4431
|
|
|
3118
4432
|
// ../renderers/src/messages/generic-error.messages.ts
|
|
3119
|
-
var
|
|
3120
|
-
var generic_error_messages_default = (0,
|
|
4433
|
+
var import_react_intl22 = require("react-intl");
|
|
4434
|
+
var generic_error_messages_default = (0, import_react_intl22.defineMessages)({
|
|
3121
4435
|
genericErrorRetryHint: {
|
|
3122
4436
|
id: "df.wise.PersistAsyncSchema.genericError",
|
|
3123
4437
|
defaultMessage: "Something went wrong, please try again.",
|
|
@@ -3136,20 +4450,20 @@ var generic_error_messages_default = (0, import_react_intl20.defineMessages)({
|
|
|
3136
4450
|
});
|
|
3137
4451
|
|
|
3138
4452
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
3139
|
-
var
|
|
3140
|
-
var
|
|
4453
|
+
var import_components50 = require("@transferwise/components");
|
|
4454
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3141
4455
|
function ErrorResult({ state }) {
|
|
3142
|
-
const intl = (0,
|
|
3143
|
-
return /* @__PURE__ */ (0,
|
|
4456
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
4457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("p", { className: "m-t-2", children: [
|
|
3144
4458
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
3145
4459
|
"\xA0",
|
|
3146
|
-
/* @__PURE__ */ (0,
|
|
4460
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components50.Link, { onClick: () => state.onRetry(), children: intl.formatMessage(generic_error_messages_default.retry) })
|
|
3147
4461
|
] });
|
|
3148
4462
|
}
|
|
3149
4463
|
|
|
3150
4464
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
3151
|
-
var
|
|
3152
|
-
var
|
|
4465
|
+
var import_icons4 = require("@transferwise/icons");
|
|
4466
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
3153
4467
|
function BlockSearchRendererComponent({
|
|
3154
4468
|
id,
|
|
3155
4469
|
hint,
|
|
@@ -3162,10 +4476,10 @@ function BlockSearchRendererComponent({
|
|
|
3162
4476
|
trackEvent,
|
|
3163
4477
|
onChange
|
|
3164
4478
|
}) {
|
|
3165
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3166
|
-
const { formatMessage } = (0,
|
|
3167
|
-
return /* @__PURE__ */ (0,
|
|
3168
|
-
/* @__PURE__ */ (0,
|
|
4479
|
+
const [hasSearched, setHasSearched] = (0, import_react18.useState)(false);
|
|
4480
|
+
const { formatMessage } = (0, import_react_intl24.useIntl)();
|
|
4481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getMargin(margin), children: [
|
|
4482
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3169
4483
|
FieldInput_default,
|
|
3170
4484
|
{
|
|
3171
4485
|
id,
|
|
@@ -3174,12 +4488,13 @@ function BlockSearchRendererComponent({
|
|
|
3174
4488
|
help: "",
|
|
3175
4489
|
label: title,
|
|
3176
4490
|
features,
|
|
3177
|
-
children: /* @__PURE__ */ (0,
|
|
3178
|
-
|
|
4491
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components51.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_icons4.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4492
|
+
import_components51.Input,
|
|
3179
4493
|
{
|
|
3180
4494
|
id,
|
|
3181
4495
|
name: id,
|
|
3182
4496
|
placeholder: hint,
|
|
4497
|
+
shape: "pill",
|
|
3183
4498
|
type: "text",
|
|
3184
4499
|
value: query,
|
|
3185
4500
|
onChange: ({ currentTarget: { value } }) => {
|
|
@@ -3193,7 +4508,7 @@ function BlockSearchRendererComponent({
|
|
|
3193
4508
|
) })
|
|
3194
4509
|
}
|
|
3195
4510
|
),
|
|
3196
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4511
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(SearchResultContent, { state, trackEvent })
|
|
3197
4512
|
] });
|
|
3198
4513
|
}
|
|
3199
4514
|
function SearchResultContent({
|
|
@@ -3202,39 +4517,39 @@ function SearchResultContent({
|
|
|
3202
4517
|
}) {
|
|
3203
4518
|
switch (state.type) {
|
|
3204
4519
|
case "error":
|
|
3205
|
-
return /* @__PURE__ */ (0,
|
|
4520
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ErrorResult, { state });
|
|
3206
4521
|
case "results":
|
|
3207
|
-
return /* @__PURE__ */ (0,
|
|
4522
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(SearchResults, { state, trackEvent });
|
|
3208
4523
|
case "layout":
|
|
3209
|
-
return /* @__PURE__ */ (0,
|
|
4524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
3210
4525
|
" ",
|
|
3211
4526
|
state.layout,
|
|
3212
4527
|
" "
|
|
3213
4528
|
] });
|
|
3214
4529
|
case "noResults":
|
|
3215
|
-
return /* @__PURE__ */ (0,
|
|
4530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(EmptySearchResult, { state });
|
|
3216
4531
|
case "pending":
|
|
3217
4532
|
default:
|
|
3218
4533
|
return null;
|
|
3219
4534
|
}
|
|
3220
4535
|
}
|
|
3221
4536
|
function EmptySearchResult({ state }) {
|
|
3222
|
-
return /* @__PURE__ */ (0,
|
|
4537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components51.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
3223
4538
|
}
|
|
3224
4539
|
function SearchResults({
|
|
3225
4540
|
state,
|
|
3226
4541
|
trackEvent
|
|
3227
4542
|
}) {
|
|
3228
|
-
return /* @__PURE__ */ (0,
|
|
4543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components51.List, { children: state.results.map((result) => {
|
|
3229
4544
|
const { media } = result;
|
|
3230
|
-
return /* @__PURE__ */ (0,
|
|
3231
|
-
|
|
4545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4546
|
+
import_components51.ListItem,
|
|
3232
4547
|
{
|
|
3233
4548
|
title: result.title,
|
|
3234
4549
|
subtitle: result.description,
|
|
3235
|
-
media: media ? /* @__PURE__ */ (0,
|
|
3236
|
-
control: /* @__PURE__ */ (0,
|
|
3237
|
-
|
|
4550
|
+
media: media ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(OptionMedia, { media, preferAvatar: false }) : void 0,
|
|
4551
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4552
|
+
import_components51.ListItem.Navigation,
|
|
3238
4553
|
{
|
|
3239
4554
|
onClick: () => {
|
|
3240
4555
|
trackEvent("Search Result Selected", __spreadValues({
|
|
@@ -3252,11 +4567,11 @@ function SearchResults({
|
|
|
3252
4567
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
3253
4568
|
|
|
3254
4569
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
3255
|
-
var
|
|
3256
|
-
var
|
|
3257
|
-
var
|
|
3258
|
-
var
|
|
3259
|
-
var
|
|
4570
|
+
var import_components52 = require("@transferwise/components");
|
|
4571
|
+
var import_icons5 = require("@transferwise/icons");
|
|
4572
|
+
var import_react19 = require("react");
|
|
4573
|
+
var import_react_intl25 = require("react-intl");
|
|
4574
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3260
4575
|
function InlineSearchRenderer({
|
|
3261
4576
|
id,
|
|
3262
4577
|
hint,
|
|
@@ -3268,9 +4583,9 @@ function InlineSearchRenderer({
|
|
|
3268
4583
|
onChange,
|
|
3269
4584
|
trackEvent
|
|
3270
4585
|
}) {
|
|
3271
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3272
|
-
const intl = (0,
|
|
3273
|
-
return /* @__PURE__ */ (0,
|
|
4586
|
+
const [hasSearched, setHasSearched] = (0, import_react19.useState)(false);
|
|
4587
|
+
const intl = (0, import_react_intl25.useIntl)();
|
|
4588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
3274
4589
|
FieldInput_default,
|
|
3275
4590
|
{
|
|
3276
4591
|
id,
|
|
@@ -3279,8 +4594,8 @@ function InlineSearchRenderer({
|
|
|
3279
4594
|
help: "",
|
|
3280
4595
|
label: title,
|
|
3281
4596
|
features,
|
|
3282
|
-
children: /* @__PURE__ */ (0,
|
|
3283
|
-
|
|
4597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
4598
|
+
import_components52.Typeahead,
|
|
3284
4599
|
{
|
|
3285
4600
|
id: "typeahead-input-id",
|
|
3286
4601
|
intl,
|
|
@@ -3288,10 +4603,10 @@ function InlineSearchRenderer({
|
|
|
3288
4603
|
size: "md",
|
|
3289
4604
|
placeholder: hint,
|
|
3290
4605
|
maxHeight: 100,
|
|
3291
|
-
footer: /* @__PURE__ */ (0,
|
|
4606
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
3292
4607
|
multiple: false,
|
|
3293
4608
|
clearable: false,
|
|
3294
|
-
addon: /* @__PURE__ */ (0,
|
|
4609
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_icons5.Search, { size: 24 }),
|
|
3295
4610
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
3296
4611
|
minQueryLength: 1,
|
|
3297
4612
|
onChange: (values) => {
|
|
@@ -3328,33 +4643,33 @@ function mapResultToTypeaheadOption(result) {
|
|
|
3328
4643
|
};
|
|
3329
4644
|
}
|
|
3330
4645
|
function TypeaheadFooter({ state, isLoading }) {
|
|
3331
|
-
const { formatMessage } = (0,
|
|
4646
|
+
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3332
4647
|
if (state.type === "layout") {
|
|
3333
|
-
return /* @__PURE__ */ (0,
|
|
4648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "m-x-1 m-y-1", children: state.layout });
|
|
3334
4649
|
}
|
|
3335
4650
|
if (state.type === "noResults") {
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
4651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
3337
4652
|
}
|
|
3338
4653
|
if (state.type === "error") {
|
|
3339
|
-
return /* @__PURE__ */ (0,
|
|
4654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ErrorResult, { state }) });
|
|
3340
4655
|
}
|
|
3341
4656
|
if (state.type === "pending" || isLoading) {
|
|
3342
|
-
return /* @__PURE__ */ (0,
|
|
4657
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
3343
4658
|
}
|
|
3344
4659
|
return null;
|
|
3345
4660
|
}
|
|
3346
4661
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
3347
4662
|
|
|
3348
4663
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
3349
|
-
var
|
|
4664
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
3350
4665
|
var SearchRenderer = {
|
|
3351
4666
|
canRenderType: "search",
|
|
3352
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0,
|
|
4667
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
3353
4668
|
};
|
|
3354
4669
|
var SearchRenderer_default = SearchRenderer;
|
|
3355
4670
|
|
|
3356
4671
|
// ../renderers/src/SectionRenderer.tsx
|
|
3357
|
-
var
|
|
4672
|
+
var import_components53 = require("@transferwise/components");
|
|
3358
4673
|
|
|
3359
4674
|
// ../renderers/src/utils/getHeaderAction.tsx
|
|
3360
4675
|
var getHeaderAction2 = (callToAction) => {
|
|
@@ -3378,12 +4693,12 @@ var getHeaderAction2 = (callToAction) => {
|
|
|
3378
4693
|
};
|
|
3379
4694
|
|
|
3380
4695
|
// ../renderers/src/SectionRenderer.tsx
|
|
3381
|
-
var
|
|
4696
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3382
4697
|
var SectionRenderer = {
|
|
3383
4698
|
canRenderType: "section",
|
|
3384
4699
|
render: ({ children, callToAction, margin, title }) => {
|
|
3385
|
-
return /* @__PURE__ */ (0,
|
|
3386
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
4700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("section", { className: getMargin(margin), children: [
|
|
4701
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components53.Header, { title: title != null ? title : "", action: getHeaderAction2(callToAction) }),
|
|
3387
4702
|
children
|
|
3388
4703
|
] });
|
|
3389
4704
|
}
|
|
@@ -3391,8 +4706,8 @@ var SectionRenderer = {
|
|
|
3391
4706
|
var SectionRenderer_default = SectionRenderer;
|
|
3392
4707
|
|
|
3393
4708
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
3394
|
-
var
|
|
3395
|
-
var
|
|
4709
|
+
var import_components54 = require("@transferwise/components");
|
|
4710
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
3396
4711
|
function RadioInputRendererComponent(props) {
|
|
3397
4712
|
const {
|
|
3398
4713
|
id,
|
|
@@ -3407,8 +4722,8 @@ function RadioInputRendererComponent(props) {
|
|
|
3407
4722
|
validationState,
|
|
3408
4723
|
onSelect
|
|
3409
4724
|
} = props;
|
|
3410
|
-
return /* @__PURE__ */ (0,
|
|
3411
|
-
/* @__PURE__ */ (0,
|
|
4725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
4726
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
3412
4727
|
FieldInput_default,
|
|
3413
4728
|
{
|
|
3414
4729
|
id,
|
|
@@ -3417,8 +4732,8 @@ function RadioInputRendererComponent(props) {
|
|
|
3417
4732
|
description,
|
|
3418
4733
|
validation: validationState,
|
|
3419
4734
|
features,
|
|
3420
|
-
children: /* @__PURE__ */ (0,
|
|
3421
|
-
|
|
4735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4736
|
+
import_components54.RadioGroup,
|
|
3422
4737
|
{
|
|
3423
4738
|
name: id,
|
|
3424
4739
|
radios: options.map((option, index) => ({
|
|
@@ -3426,7 +4741,7 @@ function RadioInputRendererComponent(props) {
|
|
|
3426
4741
|
value: index,
|
|
3427
4742
|
secondary: option.description,
|
|
3428
4743
|
disabled: option.disabled || disabled,
|
|
3429
|
-
avatar: /* @__PURE__ */ (0,
|
|
4744
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
3430
4745
|
})),
|
|
3431
4746
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
3432
4747
|
onChange: onSelect
|
|
@@ -3440,9 +4755,9 @@ function RadioInputRendererComponent(props) {
|
|
|
3440
4755
|
}
|
|
3441
4756
|
|
|
3442
4757
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
3443
|
-
var
|
|
3444
|
-
var
|
|
3445
|
-
var
|
|
4758
|
+
var import_components55 = require("@transferwise/components");
|
|
4759
|
+
var import_react20 = require("react");
|
|
4760
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3446
4761
|
function TabInputRendererComponent(props) {
|
|
3447
4762
|
const {
|
|
3448
4763
|
id,
|
|
@@ -3457,13 +4772,13 @@ function TabInputRendererComponent(props) {
|
|
|
3457
4772
|
validationState,
|
|
3458
4773
|
onSelect
|
|
3459
4774
|
} = props;
|
|
3460
|
-
(0,
|
|
4775
|
+
(0, import_react20.useEffect)(() => {
|
|
3461
4776
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
3462
4777
|
onSelect(0);
|
|
3463
4778
|
}
|
|
3464
4779
|
}, [selectedIndex, onSelect, options.length]);
|
|
3465
|
-
return /* @__PURE__ */ (0,
|
|
3466
|
-
/* @__PURE__ */ (0,
|
|
4780
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3467
4782
|
FieldInput_default,
|
|
3468
4783
|
{
|
|
3469
4784
|
id,
|
|
@@ -3472,8 +4787,8 @@ function TabInputRendererComponent(props) {
|
|
|
3472
4787
|
description,
|
|
3473
4788
|
validation: validationState,
|
|
3474
4789
|
features,
|
|
3475
|
-
children: /* @__PURE__ */ (0,
|
|
3476
|
-
|
|
4790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4791
|
+
import_components55.Tabs,
|
|
3477
4792
|
{
|
|
3478
4793
|
name: id,
|
|
3479
4794
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -3481,7 +4796,7 @@ function TabInputRendererComponent(props) {
|
|
|
3481
4796
|
title: option.title,
|
|
3482
4797
|
// if we pass null, we get some props-types console errors
|
|
3483
4798
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
3484
|
-
content: /* @__PURE__ */ (0,
|
|
4799
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, {}),
|
|
3485
4800
|
disabled: option.disabled || disabled
|
|
3486
4801
|
})),
|
|
3487
4802
|
onTabSelect: onSelect
|
|
@@ -3495,8 +4810,8 @@ function TabInputRendererComponent(props) {
|
|
|
3495
4810
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
3496
4811
|
|
|
3497
4812
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
3498
|
-
var
|
|
3499
|
-
var
|
|
4813
|
+
var import_components56 = require("@transferwise/components");
|
|
4814
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3500
4815
|
function SelectInputRendererComponent(props) {
|
|
3501
4816
|
const {
|
|
3502
4817
|
id,
|
|
@@ -3537,13 +4852,13 @@ function SelectInputRendererComponent(props) {
|
|
|
3537
4852
|
} : {
|
|
3538
4853
|
title: option.title,
|
|
3539
4854
|
description: option.description,
|
|
3540
|
-
icon: /* @__PURE__ */ (0,
|
|
4855
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
3541
4856
|
};
|
|
3542
|
-
return /* @__PURE__ */ (0,
|
|
4857
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components56.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
3543
4858
|
};
|
|
3544
4859
|
const extraProps = { autoComplete };
|
|
3545
|
-
return /* @__PURE__ */ (0,
|
|
3546
|
-
/* @__PURE__ */ (0,
|
|
4860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
4861
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3547
4862
|
FieldInput_default,
|
|
3548
4863
|
{
|
|
3549
4864
|
id,
|
|
@@ -3552,8 +4867,8 @@ function SelectInputRendererComponent(props) {
|
|
|
3552
4867
|
description,
|
|
3553
4868
|
validation: validationState,
|
|
3554
4869
|
features,
|
|
3555
|
-
children: /* @__PURE__ */ (0,
|
|
3556
|
-
|
|
4870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4871
|
+
import_components56.SelectInput,
|
|
3557
4872
|
__spreadValues({
|
|
3558
4873
|
name: id,
|
|
3559
4874
|
placeholder,
|
|
@@ -3573,9 +4888,9 @@ function SelectInputRendererComponent(props) {
|
|
|
3573
4888
|
}
|
|
3574
4889
|
|
|
3575
4890
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
3576
|
-
var
|
|
3577
|
-
var
|
|
3578
|
-
var
|
|
4891
|
+
var import_react21 = require("react");
|
|
4892
|
+
var import_components57 = require("@transferwise/components");
|
|
4893
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
3579
4894
|
function SegmentedInputRendererComponent(props) {
|
|
3580
4895
|
const {
|
|
3581
4896
|
id,
|
|
@@ -3589,13 +4904,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3589
4904
|
validationState,
|
|
3590
4905
|
onSelect
|
|
3591
4906
|
} = props;
|
|
3592
|
-
(0,
|
|
4907
|
+
(0, import_react21.useEffect)(() => {
|
|
3593
4908
|
if (!isValidIndex3(selectedIndex, options.length)) {
|
|
3594
4909
|
onSelect(0);
|
|
3595
4910
|
}
|
|
3596
4911
|
}, [selectedIndex, onSelect, options.length]);
|
|
3597
|
-
return /* @__PURE__ */ (0,
|
|
3598
|
-
/* @__PURE__ */ (0,
|
|
4912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
4913
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
3599
4914
|
FieldInput_default,
|
|
3600
4915
|
{
|
|
3601
4916
|
id,
|
|
@@ -3604,8 +4919,8 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3604
4919
|
description,
|
|
3605
4920
|
validation: validationState,
|
|
3606
4921
|
features,
|
|
3607
|
-
children: /* @__PURE__ */ (0,
|
|
3608
|
-
|
|
4922
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4923
|
+
import_components57.SegmentedControl,
|
|
3609
4924
|
{
|
|
3610
4925
|
name: `${id}-segmented-control`,
|
|
3611
4926
|
value: String(selectedIndex),
|
|
@@ -3621,14 +4936,14 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3621
4936
|
)
|
|
3622
4937
|
}
|
|
3623
4938
|
),
|
|
3624
|
-
/* @__PURE__ */ (0,
|
|
4939
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { id: `${id}-children`, children })
|
|
3625
4940
|
] });
|
|
3626
4941
|
}
|
|
3627
4942
|
var isValidIndex3 = (index, options) => index !== null && index >= 0 && index < options;
|
|
3628
4943
|
|
|
3629
4944
|
// ../renderers/src/SelectInputRenderer/RadioItemRendererComponent.tsx
|
|
3630
|
-
var
|
|
3631
|
-
var
|
|
4945
|
+
var import_components58 = require("@transferwise/components");
|
|
4946
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
3632
4947
|
function RadioItemRendererComponent(props) {
|
|
3633
4948
|
const {
|
|
3634
4949
|
id,
|
|
@@ -3644,23 +4959,23 @@ function RadioItemRendererComponent(props) {
|
|
|
3644
4959
|
onSelect
|
|
3645
4960
|
} = props;
|
|
3646
4961
|
const { ref } = useScrollToError(validationState, features);
|
|
3647
|
-
return /* @__PURE__ */ (0,
|
|
3648
|
-
rootTitle && /* @__PURE__ */ (0,
|
|
3649
|
-
|
|
4962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { ref, children: [
|
|
4963
|
+
rootTitle && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4964
|
+
import_components58.Header,
|
|
3650
4965
|
{
|
|
3651
4966
|
as: "h2",
|
|
3652
|
-
title: help ? /* @__PURE__ */ (0,
|
|
4967
|
+
title: help ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LabelContentWithHelp, { text: rootTitle, help }) : rootTitle
|
|
3653
4968
|
}
|
|
3654
4969
|
),
|
|
3655
|
-
rootDescription && /* @__PURE__ */ (0,
|
|
3656
|
-
/* @__PURE__ */ (0,
|
|
3657
|
-
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0,
|
|
3658
|
-
|
|
4970
|
+
rootDescription && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { children: rootDescription }),
|
|
4971
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components58.List, { children: options.map(
|
|
4972
|
+
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4973
|
+
import_components58.ListItem,
|
|
3659
4974
|
__spreadValues({
|
|
3660
4975
|
title,
|
|
3661
4976
|
subtitle: description,
|
|
3662
|
-
control: /* @__PURE__ */ (0,
|
|
3663
|
-
|
|
4977
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4978
|
+
import_components58.ListItem.Radio,
|
|
3664
4979
|
{
|
|
3665
4980
|
name: title,
|
|
3666
4981
|
checked: selectedIndex === index,
|
|
@@ -3675,50 +4990,50 @@ function RadioItemRendererComponent(props) {
|
|
|
3675
4990
|
title
|
|
3676
4991
|
)
|
|
3677
4992
|
) }, `${id}-${selectedIndex}`),
|
|
3678
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
4993
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components58.InlineAlert, { type: "negative", children: validationState.message }),
|
|
3679
4994
|
children
|
|
3680
4995
|
] });
|
|
3681
4996
|
}
|
|
3682
4997
|
|
|
3683
4998
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
3684
|
-
var
|
|
4999
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
3685
5000
|
var SelectInputRenderer = {
|
|
3686
5001
|
canRenderType: "input-select",
|
|
3687
5002
|
render: (props) => {
|
|
3688
5003
|
switch (props.control) {
|
|
3689
5004
|
case "radio":
|
|
3690
|
-
return /* @__PURE__ */ (0,
|
|
5005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
3691
5006
|
case "radio-item":
|
|
3692
|
-
return /* @__PURE__ */ (0,
|
|
5007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RadioItemRendererComponent, __spreadValues({}, props));
|
|
3693
5008
|
case "tab":
|
|
3694
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
5009
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
3695
5010
|
case "segmented":
|
|
3696
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
5011
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
3697
5012
|
case "select":
|
|
3698
5013
|
default:
|
|
3699
|
-
return /* @__PURE__ */ (0,
|
|
5014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
3700
5015
|
}
|
|
3701
5016
|
}
|
|
3702
5017
|
};
|
|
3703
5018
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
3704
5019
|
|
|
3705
5020
|
// ../renderers/src/StatusListRenderer.tsx
|
|
3706
|
-
var
|
|
3707
|
-
var
|
|
5021
|
+
var import_components59 = require("@transferwise/components");
|
|
5022
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
3708
5023
|
var StatusListRenderer = {
|
|
3709
5024
|
canRenderType: "status-list",
|
|
3710
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
3711
|
-
title ? /* @__PURE__ */ (0,
|
|
5025
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getMargin(margin), children: [
|
|
5026
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components59.Header, { title }) : null,
|
|
3712
5027
|
items.map((item) => {
|
|
3713
5028
|
const { callToAction, description, title: itemTitle } = item;
|
|
3714
|
-
return /* @__PURE__ */ (0,
|
|
3715
|
-
|
|
5029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5030
|
+
import_components59.ListItem,
|
|
3716
5031
|
{
|
|
3717
5032
|
title: itemTitle,
|
|
3718
5033
|
subtitle: description,
|
|
3719
|
-
media: /* @__PURE__ */ (0,
|
|
3720
|
-
additionalInfo: callToAction ? /* @__PURE__ */ (0,
|
|
3721
|
-
|
|
5034
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(StatusListItemMedia, __spreadValues({}, item)),
|
|
5035
|
+
additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5036
|
+
import_components59.ListItem.AdditionalInfo,
|
|
3722
5037
|
{
|
|
3723
5038
|
action: __spreadValues({
|
|
3724
5039
|
label: callToAction.title
|
|
@@ -3736,10 +5051,10 @@ var StatusListItemMedia = ({ icon, status }) => {
|
|
|
3736
5051
|
return void 0;
|
|
3737
5052
|
}
|
|
3738
5053
|
if ("name" in icon) {
|
|
3739
|
-
return /* @__PURE__ */ (0,
|
|
5054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components59.AvatarView, { badge: { status: mapStatus(status) }, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(DynamicIcon_default, { name: icon.name }) });
|
|
3740
5055
|
}
|
|
3741
5056
|
if ("text" in icon) {
|
|
3742
|
-
return /* @__PURE__ */ (0,
|
|
5057
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components59.AvatarView, { badge: { status: mapStatus(status) }, children: icon.text });
|
|
3743
5058
|
}
|
|
3744
5059
|
return void 0;
|
|
3745
5060
|
};
|
|
@@ -3757,12 +5072,12 @@ var StatusListRenderer_default = StatusListRenderer;
|
|
|
3757
5072
|
|
|
3758
5073
|
// ../renderers/src/utils/useCustomTheme.ts
|
|
3759
5074
|
var import_components_theming = require("@wise/components-theming");
|
|
3760
|
-
var
|
|
5075
|
+
var import_react22 = require("react");
|
|
3761
5076
|
var ThemeRequiredEventName = "Theme Required";
|
|
3762
5077
|
var useCustomTheme = (theme, trackEvent) => {
|
|
3763
5078
|
const theming = (0, import_components_theming.useTheme)();
|
|
3764
|
-
const previousTheme = (0,
|
|
3765
|
-
(0,
|
|
5079
|
+
const previousTheme = (0, import_react22.useMemo)(() => theming.theme, []);
|
|
5080
|
+
(0, import_react22.useEffect)(() => {
|
|
3766
5081
|
theming.setTheme(theme);
|
|
3767
5082
|
trackEvent(ThemeRequiredEventName, { theme });
|
|
3768
5083
|
return theme !== previousTheme ? () => {
|
|
@@ -3773,86 +5088,14 @@ var useCustomTheme = (theme, trackEvent) => {
|
|
|
3773
5088
|
}, []);
|
|
3774
5089
|
};
|
|
3775
5090
|
|
|
3776
|
-
// ../renderers/src/step/StepFooter.tsx
|
|
3777
|
-
var import_components54 = require("@transferwise/components");
|
|
3778
|
-
var import_react21 = require("react");
|
|
3779
|
-
var import_react_intl25 = require("react-intl");
|
|
3780
|
-
|
|
3781
|
-
// ../renderers/src/messages/step.messages.ts
|
|
3782
|
-
var import_react_intl24 = require("react-intl");
|
|
3783
|
-
var step_messages_default = (0, import_react_intl24.defineMessages)({
|
|
3784
|
-
scrollToBottom: {
|
|
3785
|
-
id: "df.wise.step.scrollToBottom",
|
|
3786
|
-
defaultMessage: "Scroll to bottom",
|
|
3787
|
-
description: "Label for a button that appears when the content of a step is too long and the user needs to scroll to the bottom to see all the content."
|
|
3788
|
-
}
|
|
3789
|
-
});
|
|
3790
|
-
|
|
3791
|
-
// ../renderers/src/step/StepFooter.tsx
|
|
3792
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3793
|
-
var SCROLL_TO_BOTTOM = "scroll-to-bottom";
|
|
3794
|
-
var StepFooter = ({ footer, tags }) => {
|
|
3795
|
-
if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
|
|
3796
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FooterWithScrollButton, { footer });
|
|
3797
|
-
}
|
|
3798
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(DefaultFooter, { footer });
|
|
3799
|
-
};
|
|
3800
|
-
var DefaultFooter = ({ footer }) => {
|
|
3801
|
-
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3802
|
-
return hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0;
|
|
3803
|
-
};
|
|
3804
|
-
var FooterWithScrollButton = ({ footer }) => {
|
|
3805
|
-
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3806
|
-
const endOfLayoutRef = (0, import_react21.useRef)(null);
|
|
3807
|
-
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
3808
|
-
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3809
|
-
import_components54.Button,
|
|
3810
|
-
{
|
|
3811
|
-
className: "m-b-1",
|
|
3812
|
-
v2: true,
|
|
3813
|
-
block: true,
|
|
3814
|
-
priority: "tertiary",
|
|
3815
|
-
onClick: () => {
|
|
3816
|
-
var _a;
|
|
3817
|
-
(_a = endOfLayoutRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
3818
|
-
},
|
|
3819
|
-
children: formatMessage(step_messages_default.scrollToBottom)
|
|
3820
|
-
}
|
|
3821
|
-
);
|
|
3822
|
-
const hasStepFooterContent = footer && Array.isArray(footer) && footer.length > 0;
|
|
3823
|
-
if (isElementVisible && !hasStepFooterContent) {
|
|
3824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
|
|
3825
|
-
}
|
|
3826
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
3827
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
|
|
3828
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "df-step-fixed__footer", children: [
|
|
3829
|
-
!isElementVisible && scrollButton,
|
|
3830
|
-
footer
|
|
3831
|
-
] })
|
|
3832
|
-
] });
|
|
3833
|
-
};
|
|
3834
|
-
var useIsElementVisible = (elementRef) => {
|
|
3835
|
-
const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
|
|
3836
|
-
(0, import_react21.useEffect)(() => {
|
|
3837
|
-
const element = elementRef.current;
|
|
3838
|
-
if (!element) return;
|
|
3839
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
3840
|
-
setIsVisible(entry.isIntersecting);
|
|
3841
|
-
});
|
|
3842
|
-
observer.observe(element);
|
|
3843
|
-
return () => observer.disconnect();
|
|
3844
|
-
}, [elementRef]);
|
|
3845
|
-
return isVisible;
|
|
3846
|
-
};
|
|
3847
|
-
|
|
3848
5091
|
// ../renderers/src/step/StepHeader.tsx
|
|
3849
|
-
var
|
|
3850
|
-
var
|
|
5092
|
+
var import_components60 = require("@transferwise/components");
|
|
5093
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
3851
5094
|
var StepHeader = ({ title, description, tags }) => {
|
|
3852
5095
|
const { titleType, alignmentClassName } = getHeaderStyle(tags);
|
|
3853
|
-
return /* @__PURE__ */ (0,
|
|
3854
|
-
title ? /* @__PURE__ */ (0,
|
|
3855
|
-
description ? /* @__PURE__ */ (0,
|
|
5096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
5097
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components60.Title, { as: "h1", type: titleType, className: `${alignmentClassName} m-b-2`, children: title }) : void 0,
|
|
5098
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: `${alignmentClassName} np-text-body-large`, children: description }) : void 0
|
|
3856
5099
|
] });
|
|
3857
5100
|
};
|
|
3858
5101
|
var getHeaderStyle = (tags) => {
|
|
@@ -3863,8 +5106,8 @@ var getHeaderStyle = (tags) => {
|
|
|
3863
5106
|
};
|
|
3864
5107
|
|
|
3865
5108
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3866
|
-
var
|
|
3867
|
-
var
|
|
5109
|
+
var import_components61 = require("@transferwise/components");
|
|
5110
|
+
var import_icons6 = require("@transferwise/icons");
|
|
3868
5111
|
var import_react_intl27 = require("react-intl");
|
|
3869
5112
|
|
|
3870
5113
|
// ../renderers/src/messages/back.messages.ts
|
|
@@ -3878,31 +5121,31 @@ var back_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
3878
5121
|
});
|
|
3879
5122
|
|
|
3880
5123
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3881
|
-
var
|
|
5124
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
3882
5125
|
function BackButton({ title, onClick }) {
|
|
3883
5126
|
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
3884
|
-
return /* @__PURE__ */ (0,
|
|
3885
|
-
/* @__PURE__ */ (0,
|
|
3886
|
-
/* @__PURE__ */ (0,
|
|
5127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_components61.IconButton, { className: "df-back-button", priority: "tertiary", onClick, children: [
|
|
5128
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "sr-only", children: title != null ? title : formatMessage(back_messages_default.back) }),
|
|
5129
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_icons6.ArrowLeft, {})
|
|
3887
5130
|
] });
|
|
3888
5131
|
}
|
|
3889
5132
|
|
|
3890
5133
|
// ../renderers/src/step/topbar/Toolbar.tsx
|
|
3891
|
-
var
|
|
3892
|
-
var
|
|
5134
|
+
var import_components62 = require("@transferwise/components");
|
|
5135
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
3893
5136
|
var Toolbar = ({ items }) => {
|
|
3894
|
-
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0,
|
|
5137
|
+
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "df-toolbar", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ToolbarButton, __spreadValues({}, item), `${item.type}-${index}-${item.title}`)) }) : null;
|
|
3895
5138
|
};
|
|
3896
5139
|
function ToolbarButton(props) {
|
|
3897
|
-
return prefersMedia(props.control) ? /* @__PURE__ */ (0,
|
|
5140
|
+
return prefersMedia(props.control) ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(MediaToolbarButton, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TextToolbarButton, __spreadValues({}, props));
|
|
3898
5141
|
}
|
|
3899
5142
|
function MediaToolbarButton(props) {
|
|
3900
5143
|
var _a;
|
|
3901
5144
|
const { context, control, media, accessibilityDescription, disabled, onClick } = props;
|
|
3902
5145
|
const priority = getIconButtonPriority(control);
|
|
3903
5146
|
const type = getSentiment2(context);
|
|
3904
|
-
return /* @__PURE__ */ (0,
|
|
3905
|
-
|
|
5147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
5148
|
+
import_components62.IconButton,
|
|
3906
5149
|
{
|
|
3907
5150
|
className: "df-toolbar-button",
|
|
3908
5151
|
disabled,
|
|
@@ -3911,7 +5154,7 @@ function MediaToolbarButton(props) {
|
|
|
3911
5154
|
type,
|
|
3912
5155
|
onClick,
|
|
3913
5156
|
children: [
|
|
3914
|
-
accessibilityDescription ? /* @__PURE__ */ (0,
|
|
5157
|
+
accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
|
|
3915
5158
|
media ? (_a = getAddonStartMedia(media)) == null ? void 0 : _a.value : null
|
|
3916
5159
|
]
|
|
3917
5160
|
}
|
|
@@ -3922,8 +5165,8 @@ function TextToolbarButton(props) {
|
|
|
3922
5165
|
const addonStart = media ? getAddonStartMedia(media) : void 0;
|
|
3923
5166
|
const priority = getPriority2(control);
|
|
3924
5167
|
const sentiment = getSentiment2(context);
|
|
3925
|
-
return /* @__PURE__ */ (0,
|
|
3926
|
-
|
|
5168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5169
|
+
import_components62.Button,
|
|
3927
5170
|
{
|
|
3928
5171
|
v2: true,
|
|
3929
5172
|
size: "sm",
|
|
@@ -3952,18 +5195,18 @@ var getIconButtonPriority = (control) => {
|
|
|
3952
5195
|
};
|
|
3953
5196
|
|
|
3954
5197
|
// ../renderers/src/step/topbar/TopBar.tsx
|
|
3955
|
-
var
|
|
5198
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
3956
5199
|
function TopBar({ back, toolbar, tags }) {
|
|
3957
5200
|
const isBackAllowed = !(tags == null ? void 0 : tags.includes("non-dismissible"));
|
|
3958
5201
|
const backCTA = isBackAllowed ? back : void 0;
|
|
3959
|
-
return backCTA || toolbar ? /* @__PURE__ */ (0,
|
|
3960
|
-
backCTA ? /* @__PURE__ */ (0,
|
|
3961
|
-
toolbar ? /* @__PURE__ */ (0,
|
|
5202
|
+
return backCTA || toolbar ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "d-flex m-b-2", children: [
|
|
5203
|
+
backCTA ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BackButton, __spreadValues({}, backCTA)) : null,
|
|
5204
|
+
toolbar ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Toolbar, __spreadValues({}, toolbar)) : null
|
|
3962
5205
|
] }) : null;
|
|
3963
5206
|
}
|
|
3964
5207
|
|
|
3965
5208
|
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3966
|
-
var
|
|
5209
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
3967
5210
|
var SplashCelebrationStepRenderer = {
|
|
3968
5211
|
canRenderType: "step",
|
|
3969
5212
|
canRender: ({ control }) => control === "splash-celebration",
|
|
@@ -3972,16 +5215,16 @@ var SplashCelebrationStepRenderer = {
|
|
|
3972
5215
|
function SplashCelebrationStepRendererComponent(props) {
|
|
3973
5216
|
const { back, title, description, toolbar, children, footer, tags, trackEvent } = props;
|
|
3974
5217
|
useCustomTheme("forest-green", trackEvent);
|
|
3975
|
-
return /* @__PURE__ */ (0,
|
|
3976
|
-
/* @__PURE__ */ (0,
|
|
3977
|
-
title || description ? /* @__PURE__ */ (0,
|
|
5218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
5219
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TopBar, { back, toolbar, tags }),
|
|
5220
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "m-b-4", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(StepHeader, { title, description, tags }) }) : void 0,
|
|
3978
5221
|
children,
|
|
3979
|
-
/* @__PURE__ */ (0,
|
|
5222
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(StepFooter, { footer, tags })
|
|
3980
5223
|
] });
|
|
3981
5224
|
}
|
|
3982
5225
|
|
|
3983
5226
|
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3984
|
-
var
|
|
5227
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
3985
5228
|
var SplashStepRenderer = {
|
|
3986
5229
|
canRenderType: "step",
|
|
3987
5230
|
canRender: ({ control }) => control === "splash",
|
|
@@ -3989,63 +5232,63 @@ var SplashStepRenderer = {
|
|
|
3989
5232
|
};
|
|
3990
5233
|
function SplashStepRendererComponent(props) {
|
|
3991
5234
|
const { back, title, description, toolbar, children, footer, tags } = props;
|
|
3992
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
-
/* @__PURE__ */ (0,
|
|
3994
|
-
title || description ? /* @__PURE__ */ (0,
|
|
5235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
5236
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TopBar, { back, toolbar, tags }),
|
|
5237
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "m-b-4", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(StepHeader, { title, description, tags }) }) : void 0,
|
|
3995
5238
|
children,
|
|
3996
|
-
/* @__PURE__ */ (0,
|
|
5239
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(StepFooter, { footer, tags })
|
|
3997
5240
|
] });
|
|
3998
5241
|
}
|
|
3999
5242
|
|
|
4000
5243
|
// ../renderers/src/step/StepRenderer.tsx
|
|
4001
|
-
var
|
|
4002
|
-
var
|
|
5244
|
+
var import_components63 = require("@transferwise/components");
|
|
5245
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
4003
5246
|
var StepRenderer = {
|
|
4004
5247
|
canRenderType: "step",
|
|
4005
5248
|
render: StepRendererComponent
|
|
4006
5249
|
};
|
|
4007
5250
|
function StepRendererComponent(props) {
|
|
4008
5251
|
const { back, description, error, title, children, toolbar, footer, tags } = props;
|
|
4009
|
-
return /* @__PURE__ */ (0,
|
|
4010
|
-
/* @__PURE__ */ (0,
|
|
4011
|
-
title || description ? /* @__PURE__ */ (0,
|
|
4012
|
-
error ? /* @__PURE__ */ (0,
|
|
5252
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { children: [
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TopBar, { back, toolbar, tags }),
|
|
5254
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { className: "m-b-4", children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(StepHeader, { title, description, tags }) }) : void 0,
|
|
5255
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_components63.Alert, { type: "negative", className: "m-b-2", message: error }) : null,
|
|
4013
5256
|
children,
|
|
4014
|
-
/* @__PURE__ */ (0,
|
|
5257
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(StepFooter, { footer, tags })
|
|
4015
5258
|
] });
|
|
4016
5259
|
}
|
|
4017
5260
|
|
|
4018
5261
|
// ../renderers/src/TabsRenderer.tsx
|
|
4019
|
-
var
|
|
4020
|
-
var
|
|
4021
|
-
var
|
|
5262
|
+
var import_components64 = require("@transferwise/components");
|
|
5263
|
+
var import_react23 = require("react");
|
|
5264
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
4022
5265
|
var TabsRenderer = {
|
|
4023
5266
|
canRenderType: "tabs",
|
|
4024
5267
|
render: (props) => {
|
|
4025
5268
|
switch (props.control) {
|
|
4026
5269
|
case "segmented":
|
|
4027
5270
|
if (props.tabs.length > 3) {
|
|
4028
|
-
return /* @__PURE__ */ (0,
|
|
5271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
4029
5272
|
}
|
|
4030
|
-
return /* @__PURE__ */ (0,
|
|
5273
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
4031
5274
|
case "chips":
|
|
4032
|
-
return /* @__PURE__ */ (0,
|
|
5275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
4033
5276
|
default:
|
|
4034
|
-
return /* @__PURE__ */ (0,
|
|
5277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
4035
5278
|
}
|
|
4036
5279
|
}
|
|
4037
5280
|
};
|
|
4038
5281
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
4039
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4040
|
-
return /* @__PURE__ */ (0,
|
|
4041
|
-
|
|
5282
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react23.useState)(0);
|
|
5283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5284
|
+
import_components64.Tabs,
|
|
4042
5285
|
{
|
|
4043
5286
|
name: uid,
|
|
4044
5287
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
4045
5288
|
tabs: tabs.map((option) => ({
|
|
4046
5289
|
title: option.title,
|
|
4047
5290
|
disabled: false,
|
|
4048
|
-
content: /* @__PURE__ */ (0,
|
|
5291
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "m-t-2", children: [
|
|
4049
5292
|
" ",
|
|
4050
5293
|
option.children,
|
|
4051
5294
|
" "
|
|
@@ -4057,10 +5300,10 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
4057
5300
|
}
|
|
4058
5301
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
4059
5302
|
var _a;
|
|
4060
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4061
|
-
return /* @__PURE__ */ (0,
|
|
4062
|
-
/* @__PURE__ */ (0,
|
|
4063
|
-
|
|
5303
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react23.useState)(0);
|
|
5304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getMargin(margin), children: [
|
|
5305
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5306
|
+
import_components64.SegmentedControl,
|
|
4064
5307
|
{
|
|
4065
5308
|
name: uid,
|
|
4066
5309
|
value: String(selectedIndex),
|
|
@@ -4074,31 +5317,31 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
4074
5317
|
onChange: (value) => setSelectedIndex(Number(value))
|
|
4075
5318
|
}
|
|
4076
5319
|
),
|
|
4077
|
-
/* @__PURE__ */ (0,
|
|
5320
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
4078
5321
|
] });
|
|
4079
5322
|
}
|
|
4080
5323
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
4081
5324
|
var _a;
|
|
4082
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4083
|
-
return /* @__PURE__ */ (0,
|
|
4084
|
-
/* @__PURE__ */ (0,
|
|
4085
|
-
|
|
5325
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react23.useState)(0);
|
|
5326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getMargin(margin), children: [
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5328
|
+
import_components64.Chips,
|
|
4086
5329
|
{
|
|
4087
5330
|
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
4088
5331
|
selected: selectedIndex,
|
|
4089
5332
|
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
4090
5333
|
}
|
|
4091
5334
|
) }),
|
|
4092
|
-
/* @__PURE__ */ (0,
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
4093
5336
|
] });
|
|
4094
5337
|
}
|
|
4095
5338
|
|
|
4096
5339
|
// ../renderers/src/TextInputRenderer.tsx
|
|
4097
|
-
var
|
|
5340
|
+
var import_components66 = require("@transferwise/components");
|
|
4098
5341
|
|
|
4099
5342
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
4100
|
-
var
|
|
4101
|
-
var
|
|
5343
|
+
var import_components65 = require("@transferwise/components");
|
|
5344
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
4102
5345
|
var commonKeys = [
|
|
4103
5346
|
"autoComplete",
|
|
4104
5347
|
"autoCapitalize",
|
|
@@ -4117,12 +5360,12 @@ function VariableTextInput(inputProps) {
|
|
|
4117
5360
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
4118
5361
|
switch (control) {
|
|
4119
5362
|
case "email":
|
|
4120
|
-
return /* @__PURE__ */ (0,
|
|
5363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
4121
5364
|
case "password":
|
|
4122
|
-
return /* @__PURE__ */ (0,
|
|
5365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
4123
5366
|
case "numeric": {
|
|
4124
5367
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
4125
|
-
return /* @__PURE__ */ (0,
|
|
5368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
4126
5369
|
TextInput,
|
|
4127
5370
|
__spreadProps(__spreadValues({}, numericProps), {
|
|
4128
5371
|
onChange: (newValue) => {
|
|
@@ -4133,21 +5376,21 @@ function VariableTextInput(inputProps) {
|
|
|
4133
5376
|
);
|
|
4134
5377
|
}
|
|
4135
5378
|
case "phone-number":
|
|
4136
|
-
return /* @__PURE__ */ (0,
|
|
5379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components65.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
4137
5380
|
default: {
|
|
4138
|
-
return /* @__PURE__ */ (0,
|
|
5381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
4139
5382
|
}
|
|
4140
5383
|
}
|
|
4141
5384
|
}
|
|
4142
5385
|
function TextInput(props) {
|
|
4143
5386
|
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
4144
|
-
const InputWithPattern = control === "textarea" ?
|
|
4145
|
-
const InputWithoutPattern = control === "textarea" ?
|
|
4146
|
-
return displayFormat ? /* @__PURE__ */ (0,
|
|
5387
|
+
const InputWithPattern = control === "textarea" ? import_components65.TextareaWithDisplayFormat : import_components65.InputWithDisplayFormat;
|
|
5388
|
+
const InputWithoutPattern = control === "textarea" ? import_components65.TextArea : import_components65.Input;
|
|
5389
|
+
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
4147
5390
|
}
|
|
4148
5391
|
|
|
4149
5392
|
// ../renderers/src/TextInputRenderer.tsx
|
|
4150
|
-
var
|
|
5393
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
4151
5394
|
var TextInputRenderer = {
|
|
4152
5395
|
canRenderType: "input-text",
|
|
4153
5396
|
render: (props) => {
|
|
@@ -4180,7 +5423,7 @@ var TextInputRenderer = {
|
|
|
4180
5423
|
}
|
|
4181
5424
|
}
|
|
4182
5425
|
});
|
|
4183
|
-
return /* @__PURE__ */ (0,
|
|
5426
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
4184
5427
|
FieldInput_default,
|
|
4185
5428
|
{
|
|
4186
5429
|
id,
|
|
@@ -4191,7 +5434,7 @@ var TextInputRenderer = {
|
|
|
4191
5434
|
loadingState: props.fieldLoadingState,
|
|
4192
5435
|
help,
|
|
4193
5436
|
features: props.features,
|
|
4194
|
-
children: /* @__PURE__ */ (0,
|
|
5437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components66.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
4195
5438
|
}
|
|
4196
5439
|
);
|
|
4197
5440
|
}
|
|
@@ -4199,13 +5442,13 @@ var TextInputRenderer = {
|
|
|
4199
5442
|
var TextInputRenderer_default = TextInputRenderer;
|
|
4200
5443
|
|
|
4201
5444
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
4202
|
-
var
|
|
5445
|
+
var import_components67 = require("@transferwise/components");
|
|
4203
5446
|
|
|
4204
5447
|
// ../renderers/src/utils/getRandomId.ts
|
|
4205
5448
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
4206
5449
|
|
|
4207
5450
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
4208
|
-
var
|
|
5451
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
4209
5452
|
var UploadInputRenderer = {
|
|
4210
5453
|
canRenderType: "input-upload",
|
|
4211
5454
|
render: (props) => {
|
|
@@ -4232,7 +5475,7 @@ var UploadInputRenderer = {
|
|
|
4232
5475
|
};
|
|
4233
5476
|
return (
|
|
4234
5477
|
// We don't pass help here as there is no sensible place to display it
|
|
4235
|
-
/* @__PURE__ */ (0,
|
|
5478
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
4236
5479
|
UploadFieldInput_default,
|
|
4237
5480
|
{
|
|
4238
5481
|
id,
|
|
@@ -4240,8 +5483,8 @@ var UploadInputRenderer = {
|
|
|
4240
5483
|
description: void 0,
|
|
4241
5484
|
validation: validationState,
|
|
4242
5485
|
features,
|
|
4243
|
-
children: /* @__PURE__ */ (0,
|
|
4244
|
-
|
|
5486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
5487
|
+
import_components67.UploadInput,
|
|
4245
5488
|
{
|
|
4246
5489
|
id,
|
|
4247
5490
|
description,
|
|
@@ -4251,7 +5494,7 @@ var UploadInputRenderer = {
|
|
|
4251
5494
|
{
|
|
4252
5495
|
id: "my-file",
|
|
4253
5496
|
filename: value.name,
|
|
4254
|
-
status: (validationState == null ? void 0 : validationState.status) === "invalid" ?
|
|
5497
|
+
status: (validationState == null ? void 0 : validationState.status) === "invalid" ? import_components67.Status.FAILED : import_components67.Status.SUCCEEDED
|
|
4255
5498
|
}
|
|
4256
5499
|
] : void 0,
|
|
4257
5500
|
fileTypes: acceptsToFileTypes(accepts),
|
|
@@ -4308,7 +5551,7 @@ var LargeUploadRenderer = {
|
|
|
4308
5551
|
};
|
|
4309
5552
|
const filetypes = acceptsToFileTypes(accepts);
|
|
4310
5553
|
const usAccept = filetypes === "*" ? "*" : filetypes.join(",");
|
|
4311
|
-
return /* @__PURE__ */ (0,
|
|
5554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
4312
5555
|
FieldInput_default,
|
|
4313
5556
|
{
|
|
4314
5557
|
id,
|
|
@@ -4317,8 +5560,8 @@ var LargeUploadRenderer = {
|
|
|
4317
5560
|
validation: validationState,
|
|
4318
5561
|
help,
|
|
4319
5562
|
features,
|
|
4320
|
-
children: /* @__PURE__ */ (0,
|
|
4321
|
-
|
|
5563
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
5564
|
+
import_components67.Upload,
|
|
4322
5565
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
4323
5566
|
usAccept,
|
|
4324
5567
|
usDisabled: disabled,
|
|
@@ -4333,18 +5576,18 @@ var LargeUploadRenderer = {
|
|
|
4333
5576
|
};
|
|
4334
5577
|
|
|
4335
5578
|
// ../renderers/src/UpsellRenderer.tsx
|
|
4336
|
-
var
|
|
4337
|
-
var
|
|
4338
|
-
var
|
|
5579
|
+
var import_components68 = require("@transferwise/components");
|
|
5580
|
+
var import_react24 = require("react");
|
|
5581
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
4339
5582
|
var UpsellRenderer = {
|
|
4340
5583
|
canRenderType: "upsell",
|
|
4341
5584
|
render: UpsellRendererComponent
|
|
4342
5585
|
};
|
|
4343
5586
|
function UpsellRendererComponent(props) {
|
|
4344
5587
|
const { text, callToAction, media, margin, onDismiss } = props;
|
|
4345
|
-
const [isVisible, setIsVisible] = (0,
|
|
4346
|
-
return isVisible ? /* @__PURE__ */ (0,
|
|
4347
|
-
|
|
5588
|
+
const [isVisible, setIsVisible] = (0, import_react24.useState)(true);
|
|
5589
|
+
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
5590
|
+
import_components68.Nudge,
|
|
4348
5591
|
{
|
|
4349
5592
|
className: getMargin(margin),
|
|
4350
5593
|
mediaName: getMediaName(media),
|
|
@@ -4390,9 +5633,9 @@ var supportedMediaNames = [
|
|
|
4390
5633
|
];
|
|
4391
5634
|
|
|
4392
5635
|
// ../renderers/src/ButtonRenderer/CircularButtonRenderer.tsx
|
|
4393
|
-
var
|
|
5636
|
+
var import_components69 = require("@transferwise/components");
|
|
4394
5637
|
var import_classnames8 = __toESM(require_classnames());
|
|
4395
|
-
var
|
|
5638
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
4396
5639
|
var CircularButtonRenderer = {
|
|
4397
5640
|
canRenderType: "button",
|
|
4398
5641
|
canRender: ({ control }) => control === "circular",
|
|
@@ -4402,8 +5645,8 @@ function CircularButtonComponent(props) {
|
|
|
4402
5645
|
var _a;
|
|
4403
5646
|
const { context, disabled, margin, media, tags, title, onClick } = props;
|
|
4404
5647
|
const priority = tags == null ? void 0 : tags.find((tag) => tag === "primary" || tag === "secondary");
|
|
4405
|
-
return /* @__PURE__ */ (0,
|
|
4406
|
-
|
|
5648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className: (0, import_classnames8.default)(getMargin(margin), "df-button", "circular"), children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
5649
|
+
import_components69.CircularButton,
|
|
4407
5650
|
{
|
|
4408
5651
|
disabled,
|
|
4409
5652
|
priority: priority != null ? priority : "secondary",
|
|
@@ -4422,6 +5665,7 @@ var getWiseRenderers = () => [
|
|
|
4422
5665
|
CheckboxInputRenderer_default,
|
|
4423
5666
|
CircularButtonRenderer,
|
|
4424
5667
|
BoxRenderer_default,
|
|
5668
|
+
CollectionRenderer_default,
|
|
4425
5669
|
ButtonRenderer,
|
|
4426
5670
|
ColumnsRenderer_default,
|
|
4427
5671
|
DateInputRenderer_default,
|
|
@@ -4465,13 +5709,13 @@ var getWiseRenderers = () => [
|
|
|
4465
5709
|
];
|
|
4466
5710
|
|
|
4467
5711
|
// ../renderers/src/InitialLoadingStateRenderer.tsx
|
|
4468
|
-
var
|
|
4469
|
-
var
|
|
5712
|
+
var import_components70 = require("@transferwise/components");
|
|
5713
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
4470
5714
|
var InitialLoadingStateRenderer = {
|
|
4471
5715
|
canRenderType: "loading-state",
|
|
4472
5716
|
canRender: ({ stepLoadingState }) => stepLoadingState === "initial",
|
|
4473
|
-
render: () => /* @__PURE__ */ (0,
|
|
4474
|
-
|
|
5717
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
5718
|
+
import_components70.Loader,
|
|
4475
5719
|
{
|
|
4476
5720
|
size: "md",
|
|
4477
5721
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin("md")}` },
|
|
@@ -4482,25 +5726,25 @@ var InitialLoadingStateRenderer = {
|
|
|
4482
5726
|
|
|
4483
5727
|
// src/dynamicFlow/DynamicFlowModal.tsx
|
|
4484
5728
|
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
4485
|
-
var
|
|
4486
|
-
var
|
|
5729
|
+
var import_components71 = require("@transferwise/components");
|
|
5730
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
4487
5731
|
function DynamicFlowModal(props) {
|
|
4488
5732
|
const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
|
|
4489
5733
|
const dfProps = useWiseToCoreProps(rest);
|
|
4490
5734
|
const df = (0, import_dynamic_flow_client.useDynamicFlowModal)(dfProps);
|
|
4491
|
-
return /* @__PURE__ */ (0,
|
|
4492
|
-
|
|
5735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
5736
|
+
import_components71.Modal,
|
|
4493
5737
|
__spreadProps(__spreadValues({
|
|
4494
5738
|
className: `dynamic-flow-modal ${className}`,
|
|
4495
5739
|
disableDimmerClickToClose: true
|
|
4496
5740
|
}, df.modal), {
|
|
4497
|
-
body: /* @__PURE__ */ (0,
|
|
5741
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
|
|
4498
5742
|
})
|
|
4499
5743
|
);
|
|
4500
5744
|
}
|
|
4501
5745
|
|
|
4502
5746
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
4503
|
-
var
|
|
5747
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
4504
5748
|
var wiseRenderers = getWiseRenderers();
|
|
4505
5749
|
var getMergedRenderers = (props) => {
|
|
4506
5750
|
var _d, _e;
|
|
@@ -4514,7 +5758,7 @@ var getMergedRenderers = (props) => {
|
|
|
4514
5758
|
method: initialRequest.method,
|
|
4515
5759
|
data: initialRequest.body
|
|
4516
5760
|
};
|
|
4517
|
-
return presentation.type === "push" ? /* @__PURE__ */ (0,
|
|
5761
|
+
return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
4518
5762
|
DynamicFlowModal,
|
|
4519
5763
|
__spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
|
|
4520
5764
|
features: subflowFeatures,
|
|
@@ -4593,7 +5837,7 @@ var customEventsToAnalytics = {
|
|
|
4593
5837
|
};
|
|
4594
5838
|
|
|
4595
5839
|
// src/dynamicFlow/useOnCopy.tsx
|
|
4596
|
-
var
|
|
5840
|
+
var import_react25 = require("react");
|
|
4597
5841
|
var import_react_intl29 = require("react-intl");
|
|
4598
5842
|
|
|
4599
5843
|
// src/dynamicFlow/messages.ts
|
|
@@ -4615,7 +5859,7 @@ var messages_default = (0, import_react_intl28.defineMessages)({
|
|
|
4615
5859
|
var useOnCopy = () => {
|
|
4616
5860
|
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
4617
5861
|
const createSnackBar = useSnackBarIfAvailable();
|
|
4618
|
-
return (0,
|
|
5862
|
+
return (0, import_react25.useCallback)(
|
|
4619
5863
|
(copiedContent) => {
|
|
4620
5864
|
if (copiedContent) {
|
|
4621
5865
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -4628,11 +5872,11 @@ var useOnCopy = () => {
|
|
|
4628
5872
|
};
|
|
4629
5873
|
|
|
4630
5874
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
4631
|
-
var
|
|
5875
|
+
var import_react26 = require("react");
|
|
4632
5876
|
var import_react_intl30 = require("react-intl");
|
|
4633
5877
|
var useWiseHttpClient = (httpClient) => {
|
|
4634
5878
|
const { locale } = (0, import_react_intl30.useIntl)();
|
|
4635
|
-
return (0,
|
|
5879
|
+
return (0, import_react26.useCallback)(
|
|
4636
5880
|
async (input, init = {}) => {
|
|
4637
5881
|
const headers = new Headers(init.headers);
|
|
4638
5882
|
headers.set("accept-language", locale);
|
|
@@ -4673,10 +5917,10 @@ var useWiseToCoreProps = (props) => {
|
|
|
4673
5917
|
onLog
|
|
4674
5918
|
} = props;
|
|
4675
5919
|
const httpClient = useWiseHttpClient(customFetch);
|
|
4676
|
-
const mergedRenderers = (0,
|
|
5920
|
+
const mergedRenderers = (0, import_react27.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
4677
5921
|
const createSnackBar = useCreateSnackBar();
|
|
4678
|
-
const logEvent = (0,
|
|
4679
|
-
const trackEvent = (0,
|
|
5922
|
+
const logEvent = (0, import_react27.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
5923
|
+
const trackEvent = (0, import_react27.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
4680
5924
|
const onCopy = useOnCopy();
|
|
4681
5925
|
return __spreadProps(__spreadValues({}, props), {
|
|
4682
5926
|
httpClient,
|
|
@@ -4708,27 +5952,27 @@ var openLinkInNewTab = (url) => {
|
|
|
4708
5952
|
};
|
|
4709
5953
|
|
|
4710
5954
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
4711
|
-
var
|
|
5955
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
4712
5956
|
function DynamicFlow(props) {
|
|
4713
5957
|
const { className = "" } = props;
|
|
4714
5958
|
const dfProps = useWiseToCoreProps(props);
|
|
4715
5959
|
const df = (0, import_dynamic_flow_client4.useDynamicFlow)(dfProps);
|
|
4716
5960
|
const { onContextMenu, contextMenu } = useDFContextMenu(df.controller);
|
|
4717
|
-
return /* @__PURE__ */ (0,
|
|
5961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className, onContextMenu, children: [
|
|
4718
5962
|
df.view,
|
|
4719
5963
|
contextMenu
|
|
4720
5964
|
] });
|
|
4721
5965
|
}
|
|
4722
5966
|
|
|
4723
5967
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
4724
|
-
var
|
|
5968
|
+
var import_react28 = require("react");
|
|
4725
5969
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
4726
|
-
var
|
|
4727
|
-
var DynamicFlowWithRef = (0,
|
|
5970
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
5971
|
+
var DynamicFlowWithRef = (0, import_react28.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
4728
5972
|
const { className = "" } = props;
|
|
4729
5973
|
const dfProps = useWiseToCoreProps(props);
|
|
4730
5974
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
4731
|
-
(0,
|
|
5975
|
+
(0, import_react28.useImperativeHandle)(
|
|
4732
5976
|
ref,
|
|
4733
5977
|
() => ({
|
|
4734
5978
|
getValue: async () => {
|
|
@@ -4739,14 +5983,14 @@ var DynamicFlowWithRef = (0, import_react27.forwardRef)(function DynamicFlowWith
|
|
|
4739
5983
|
}),
|
|
4740
5984
|
[df]
|
|
4741
5985
|
);
|
|
4742
|
-
return /* @__PURE__ */ (0,
|
|
5986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className, children: df.view });
|
|
4743
5987
|
});
|
|
4744
5988
|
|
|
4745
5989
|
// src/index.ts
|
|
4746
5990
|
var import_dynamic_flow_client8 = require("@wise/dynamic-flow-client");
|
|
4747
5991
|
|
|
4748
5992
|
// src/dynamicFlow/renderers.tsx
|
|
4749
|
-
var Header10 =
|
|
5993
|
+
var Header10 = Header;
|
|
4750
5994
|
var Media2 = Media;
|
|
4751
5995
|
var getMargin2 = getMargin;
|
|
4752
5996
|
|