@wise/dynamic-flow-client-internal 5.21.3 → 5.23.0-experimental-2dcb025
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.js +1915 -670
- package/build/main.mjs +1810 -565
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +5 -5
package/build/main.js
CHANGED
|
@@ -145,7 +145,7 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
|
145
145
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
146
146
|
var appVersion = (
|
|
147
147
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
148
|
-
typeof process !== "undefined" ? "5.
|
|
148
|
+
typeof process !== "undefined" ? "5.22.0" : "0.0.0"
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
// src/dynamicFlow/context-menu/useContextMenu.tsx
|
|
@@ -329,7 +329,7 @@ var recursivelyRemoveNullish = (element) => {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
// src/dynamicFlow/useWiseToCoreProps.tsx
|
|
332
|
-
var
|
|
332
|
+
var import_react26 = require("react");
|
|
333
333
|
|
|
334
334
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
335
335
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
@@ -1083,48 +1083,1419 @@ var CheckboxItemComponent = (props) => {
|
|
|
1083
1083
|
}, getSupportingValues(supportingValues))
|
|
1084
1084
|
) });
|
|
1085
1085
|
};
|
|
1086
|
-
var SwitchItemComponent = (props) => {
|
|
1086
|
+
var SwitchItemComponent = (props) => {
|
|
1087
|
+
const {
|
|
1088
|
+
additionalText,
|
|
1089
|
+
description,
|
|
1090
|
+
disabled,
|
|
1091
|
+
inlineAlert,
|
|
1092
|
+
media,
|
|
1093
|
+
supportingValues,
|
|
1094
|
+
title,
|
|
1095
|
+
validationState,
|
|
1096
|
+
value,
|
|
1097
|
+
features,
|
|
1098
|
+
onChange
|
|
1099
|
+
} = props;
|
|
1100
|
+
const { ref } = useScrollToError(validationState, features);
|
|
1101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1102
|
+
import_components11.ListItem,
|
|
1103
|
+
__spreadValues({
|
|
1104
|
+
title,
|
|
1105
|
+
subtitle: description,
|
|
1106
|
+
additionalInfo: getAdditionalText(additionalText),
|
|
1107
|
+
media: getMedia(media, false),
|
|
1108
|
+
disabled,
|
|
1109
|
+
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
1110
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Switch, { checked: value, onClick: () => onChange(!value) })
|
|
1111
|
+
}, getSupportingValues(supportingValues))
|
|
1112
|
+
) });
|
|
1113
|
+
};
|
|
1114
|
+
var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
1115
|
+
if ((validationState == null ? void 0 : validationState.status) === "invalid") {
|
|
1116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
|
|
1117
|
+
}
|
|
1118
|
+
return getInlineAlert(inlineAlert);
|
|
1119
|
+
};
|
|
1120
|
+
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
1121
|
+
|
|
1122
|
+
// ../renderers/src/CollectionRenderer/CollectionRenderer.tsx
|
|
1123
|
+
var import_components19 = require("@transferwise/components");
|
|
1124
|
+
|
|
1125
|
+
// ../../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
|
|
1126
|
+
var React = __toESM(require("react"), 1);
|
|
1127
|
+
var import_react_dom = require("react-dom");
|
|
1128
|
+
|
|
1129
|
+
// ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/utils.js
|
|
1130
|
+
function memo(getDeps, fn, opts) {
|
|
1131
|
+
var _a;
|
|
1132
|
+
let deps = (_a = opts.initialDeps) != null ? _a : [];
|
|
1133
|
+
let result;
|
|
1134
|
+
let isInitial = true;
|
|
1135
|
+
function memoizedFunction() {
|
|
1136
|
+
var _a2, _b, _c;
|
|
1137
|
+
let depTime;
|
|
1138
|
+
if (opts.key && ((_a2 = opts.debug) == null ? void 0 : _a2.call(opts))) depTime = Date.now();
|
|
1139
|
+
const newDeps = getDeps();
|
|
1140
|
+
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
1141
|
+
if (!depsChanged) {
|
|
1142
|
+
return result;
|
|
1143
|
+
}
|
|
1144
|
+
deps = newDeps;
|
|
1145
|
+
let resultTime;
|
|
1146
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
1147
|
+
result = fn(...newDeps);
|
|
1148
|
+
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
1149
|
+
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
1150
|
+
const resultEndTime = Math.round((Date.now() - resultTime) * 100) / 100;
|
|
1151
|
+
const resultFpsPercentage = resultEndTime / 16;
|
|
1152
|
+
const pad = (str, num) => {
|
|
1153
|
+
str = String(str);
|
|
1154
|
+
while (str.length < num) {
|
|
1155
|
+
str = " " + str;
|
|
1156
|
+
}
|
|
1157
|
+
return str;
|
|
1158
|
+
};
|
|
1159
|
+
console.info(
|
|
1160
|
+
`%c\u23F1 ${pad(resultEndTime, 5)} /${pad(depEndTime, 5)} ms`,
|
|
1161
|
+
`
|
|
1162
|
+
font-size: .6rem;
|
|
1163
|
+
font-weight: bold;
|
|
1164
|
+
color: hsl(${Math.max(
|
|
1165
|
+
0,
|
|
1166
|
+
Math.min(120 - 120 * resultFpsPercentage, 120)
|
|
1167
|
+
)}deg 100% 31%);`,
|
|
1168
|
+
opts == null ? void 0 : opts.key
|
|
1169
|
+
);
|
|
1170
|
+
}
|
|
1171
|
+
if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
|
|
1172
|
+
opts.onChange(result);
|
|
1173
|
+
}
|
|
1174
|
+
isInitial = false;
|
|
1175
|
+
return result;
|
|
1176
|
+
}
|
|
1177
|
+
memoizedFunction.updateDeps = (newDeps) => {
|
|
1178
|
+
deps = newDeps;
|
|
1179
|
+
};
|
|
1180
|
+
return memoizedFunction;
|
|
1181
|
+
}
|
|
1182
|
+
function notUndefined(value, msg) {
|
|
1183
|
+
if (value === void 0) {
|
|
1184
|
+
throw new Error(`Unexpected undefined${msg ? `: ${msg}` : ""}`);
|
|
1185
|
+
} else {
|
|
1186
|
+
return value;
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
var approxEqual = (a, b) => Math.abs(a - b) < 1.01;
|
|
1190
|
+
var debounce = (targetWindow, fn, ms) => {
|
|
1191
|
+
let timeoutId;
|
|
1192
|
+
return function(...args) {
|
|
1193
|
+
targetWindow.clearTimeout(timeoutId);
|
|
1194
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
1195
|
+
};
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
// ../../node_modules/.pnpm/@tanstack+virtual-core@3.14.0/node_modules/@tanstack/virtual-core/dist/esm/index.js
|
|
1199
|
+
var defaultKeyExtractor = (index) => index;
|
|
1200
|
+
var defaultRangeExtractor = (range) => {
|
|
1201
|
+
const start = Math.max(range.startIndex - range.overscan, 0);
|
|
1202
|
+
const end = Math.min(range.endIndex + range.overscan, range.count - 1);
|
|
1203
|
+
const arr = [];
|
|
1204
|
+
for (let i = start; i <= end; i++) {
|
|
1205
|
+
arr.push(i);
|
|
1206
|
+
}
|
|
1207
|
+
return arr;
|
|
1208
|
+
};
|
|
1209
|
+
var addEventListenerOptions = {
|
|
1210
|
+
passive: true
|
|
1211
|
+
};
|
|
1212
|
+
var observeWindowRect = (instance, cb) => {
|
|
1213
|
+
const element = instance.scrollElement;
|
|
1214
|
+
if (!element) {
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
const handler = () => {
|
|
1218
|
+
cb({ width: element.innerWidth, height: element.innerHeight });
|
|
1219
|
+
};
|
|
1220
|
+
handler();
|
|
1221
|
+
element.addEventListener("resize", handler, addEventListenerOptions);
|
|
1222
|
+
return () => {
|
|
1223
|
+
element.removeEventListener("resize", handler);
|
|
1224
|
+
};
|
|
1225
|
+
};
|
|
1226
|
+
var supportsScrollend = typeof window == "undefined" ? true : "onscrollend" in window;
|
|
1227
|
+
var observeWindowOffset = (instance, cb) => {
|
|
1228
|
+
const element = instance.scrollElement;
|
|
1229
|
+
if (!element) {
|
|
1230
|
+
return;
|
|
1231
|
+
}
|
|
1232
|
+
const targetWindow = instance.targetWindow;
|
|
1233
|
+
if (!targetWindow) {
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
let offset = 0;
|
|
1237
|
+
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce(
|
|
1238
|
+
targetWindow,
|
|
1239
|
+
() => {
|
|
1240
|
+
cb(offset, false);
|
|
1241
|
+
},
|
|
1242
|
+
instance.options.isScrollingResetDelay
|
|
1243
|
+
);
|
|
1244
|
+
const createHandler = (isScrolling) => () => {
|
|
1245
|
+
offset = element[instance.options.horizontal ? "scrollX" : "scrollY"];
|
|
1246
|
+
fallback();
|
|
1247
|
+
cb(offset, isScrolling);
|
|
1248
|
+
};
|
|
1249
|
+
const handler = createHandler(true);
|
|
1250
|
+
const endHandler = createHandler(false);
|
|
1251
|
+
element.addEventListener("scroll", handler, addEventListenerOptions);
|
|
1252
|
+
const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
|
|
1253
|
+
if (registerScrollendEvent) {
|
|
1254
|
+
element.addEventListener("scrollend", endHandler, addEventListenerOptions);
|
|
1255
|
+
}
|
|
1256
|
+
return () => {
|
|
1257
|
+
element.removeEventListener("scroll", handler);
|
|
1258
|
+
if (registerScrollendEvent) {
|
|
1259
|
+
element.removeEventListener("scrollend", endHandler);
|
|
1260
|
+
}
|
|
1261
|
+
};
|
|
1262
|
+
};
|
|
1263
|
+
var measureElement = (element, entry, instance) => {
|
|
1264
|
+
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
1265
|
+
const box = entry.borderBoxSize[0];
|
|
1266
|
+
if (box) {
|
|
1267
|
+
const size = Math.round(
|
|
1268
|
+
box[instance.options.horizontal ? "inlineSize" : "blockSize"]
|
|
1269
|
+
);
|
|
1270
|
+
return size;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
|
|
1274
|
+
};
|
|
1275
|
+
var windowScroll = (offset, {
|
|
1276
|
+
adjustments = 0,
|
|
1277
|
+
behavior
|
|
1278
|
+
}, instance) => {
|
|
1279
|
+
var _a, _b;
|
|
1280
|
+
const toOffset = offset + adjustments;
|
|
1281
|
+
(_b = (_a = instance.scrollElement) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, {
|
|
1282
|
+
[instance.options.horizontal ? "left" : "top"]: toOffset,
|
|
1283
|
+
behavior
|
|
1284
|
+
});
|
|
1285
|
+
};
|
|
1286
|
+
var Virtualizer = class {
|
|
1287
|
+
constructor(opts) {
|
|
1288
|
+
this.unsubs = [];
|
|
1289
|
+
this.scrollElement = null;
|
|
1290
|
+
this.targetWindow = null;
|
|
1291
|
+
this.isScrolling = false;
|
|
1292
|
+
this.scrollState = null;
|
|
1293
|
+
this.measurementsCache = [];
|
|
1294
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
1295
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
1296
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1297
|
+
this.prevLanes = void 0;
|
|
1298
|
+
this.lanesChangedFlag = false;
|
|
1299
|
+
this.lanesSettling = false;
|
|
1300
|
+
this.scrollRect = null;
|
|
1301
|
+
this.scrollOffset = null;
|
|
1302
|
+
this.scrollDirection = null;
|
|
1303
|
+
this.scrollAdjustments = 0;
|
|
1304
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
1305
|
+
this.now = () => {
|
|
1306
|
+
var _a2;
|
|
1307
|
+
var _a, _b, _c;
|
|
1308
|
+
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();
|
|
1309
|
+
};
|
|
1310
|
+
this.observer = /* @__PURE__ */ (() => {
|
|
1311
|
+
let _ro = null;
|
|
1312
|
+
const get = () => {
|
|
1313
|
+
if (_ro) {
|
|
1314
|
+
return _ro;
|
|
1315
|
+
}
|
|
1316
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
1317
|
+
return null;
|
|
1318
|
+
}
|
|
1319
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
1320
|
+
entries.forEach((entry) => {
|
|
1321
|
+
const run = () => {
|
|
1322
|
+
const node = entry.target;
|
|
1323
|
+
const index = this.indexFromElement(node);
|
|
1324
|
+
if (!node.isConnected) {
|
|
1325
|
+
this.observer.unobserve(node);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
if (this.shouldMeasureDuringScroll(index)) {
|
|
1329
|
+
this.resizeItem(
|
|
1330
|
+
index,
|
|
1331
|
+
this.options.measureElement(node, entry, this)
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
|
|
1336
|
+
});
|
|
1337
|
+
});
|
|
1338
|
+
};
|
|
1339
|
+
return {
|
|
1340
|
+
disconnect: () => {
|
|
1341
|
+
var _a;
|
|
1342
|
+
(_a = get()) == null ? void 0 : _a.disconnect();
|
|
1343
|
+
_ro = null;
|
|
1344
|
+
},
|
|
1345
|
+
observe: (target) => {
|
|
1346
|
+
var _a;
|
|
1347
|
+
return (_a = get()) == null ? void 0 : _a.observe(target, { box: "border-box" });
|
|
1348
|
+
},
|
|
1349
|
+
unobserve: (target) => {
|
|
1350
|
+
var _a;
|
|
1351
|
+
return (_a = get()) == null ? void 0 : _a.unobserve(target);
|
|
1352
|
+
}
|
|
1353
|
+
};
|
|
1354
|
+
})();
|
|
1355
|
+
this.range = null;
|
|
1356
|
+
this.setOptions = (opts2) => {
|
|
1357
|
+
Object.entries(opts2).forEach(([key, value]) => {
|
|
1358
|
+
if (typeof value === "undefined") delete opts2[key];
|
|
1359
|
+
});
|
|
1360
|
+
this.options = __spreadValues({
|
|
1361
|
+
debug: false,
|
|
1362
|
+
initialOffset: 0,
|
|
1363
|
+
overscan: 1,
|
|
1364
|
+
paddingStart: 0,
|
|
1365
|
+
paddingEnd: 0,
|
|
1366
|
+
scrollPaddingStart: 0,
|
|
1367
|
+
scrollPaddingEnd: 0,
|
|
1368
|
+
horizontal: false,
|
|
1369
|
+
getItemKey: defaultKeyExtractor,
|
|
1370
|
+
rangeExtractor: defaultRangeExtractor,
|
|
1371
|
+
onChange: () => {
|
|
1372
|
+
},
|
|
1373
|
+
measureElement,
|
|
1374
|
+
initialRect: { width: 0, height: 0 },
|
|
1375
|
+
scrollMargin: 0,
|
|
1376
|
+
gap: 0,
|
|
1377
|
+
indexAttribute: "data-index",
|
|
1378
|
+
initialMeasurementsCache: [],
|
|
1379
|
+
lanes: 1,
|
|
1380
|
+
isScrollingResetDelay: 150,
|
|
1381
|
+
enabled: true,
|
|
1382
|
+
isRtl: false,
|
|
1383
|
+
useScrollendEvent: false,
|
|
1384
|
+
useAnimationFrameWithResizeObserver: false,
|
|
1385
|
+
laneAssignmentMode: "estimate"
|
|
1386
|
+
}, opts2);
|
|
1387
|
+
};
|
|
1388
|
+
this.notify = (sync) => {
|
|
1389
|
+
var _a, _b;
|
|
1390
|
+
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, sync);
|
|
1391
|
+
};
|
|
1392
|
+
this.maybeNotify = memo(
|
|
1393
|
+
() => {
|
|
1394
|
+
this.calculateRange();
|
|
1395
|
+
return [
|
|
1396
|
+
this.isScrolling,
|
|
1397
|
+
this.range ? this.range.startIndex : null,
|
|
1398
|
+
this.range ? this.range.endIndex : null
|
|
1399
|
+
];
|
|
1400
|
+
},
|
|
1401
|
+
(isScrolling) => {
|
|
1402
|
+
this.notify(isScrolling);
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
key: "maybeNotify",
|
|
1406
|
+
debug: () => this.options.debug,
|
|
1407
|
+
initialDeps: [
|
|
1408
|
+
this.isScrolling,
|
|
1409
|
+
this.range ? this.range.startIndex : null,
|
|
1410
|
+
this.range ? this.range.endIndex : null
|
|
1411
|
+
]
|
|
1412
|
+
}
|
|
1413
|
+
);
|
|
1414
|
+
this.cleanup = () => {
|
|
1415
|
+
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
1416
|
+
this.unsubs = [];
|
|
1417
|
+
this.observer.disconnect();
|
|
1418
|
+
if (this.rafId != null && this.targetWindow) {
|
|
1419
|
+
this.targetWindow.cancelAnimationFrame(this.rafId);
|
|
1420
|
+
this.rafId = null;
|
|
1421
|
+
}
|
|
1422
|
+
this.scrollState = null;
|
|
1423
|
+
this.scrollElement = null;
|
|
1424
|
+
this.targetWindow = null;
|
|
1425
|
+
};
|
|
1426
|
+
this._didMount = () => {
|
|
1427
|
+
return () => {
|
|
1428
|
+
this.cleanup();
|
|
1429
|
+
};
|
|
1430
|
+
};
|
|
1431
|
+
this._willUpdate = () => {
|
|
1432
|
+
var _a2;
|
|
1433
|
+
var _a;
|
|
1434
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
1435
|
+
if (this.scrollElement !== scrollElement) {
|
|
1436
|
+
this.cleanup();
|
|
1437
|
+
if (!scrollElement) {
|
|
1438
|
+
this.maybeNotify();
|
|
1439
|
+
return;
|
|
1440
|
+
}
|
|
1441
|
+
this.scrollElement = scrollElement;
|
|
1442
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
1443
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
1444
|
+
} else {
|
|
1445
|
+
this.targetWindow = (_a2 = (_a = this.scrollElement) == null ? void 0 : _a.window) != null ? _a2 : null;
|
|
1446
|
+
}
|
|
1447
|
+
this.elementsCache.forEach((cached) => {
|
|
1448
|
+
this.observer.observe(cached);
|
|
1449
|
+
});
|
|
1450
|
+
this.unsubs.push(
|
|
1451
|
+
this.options.observeElementRect(this, (rect) => {
|
|
1452
|
+
this.scrollRect = rect;
|
|
1453
|
+
this.maybeNotify();
|
|
1454
|
+
})
|
|
1455
|
+
);
|
|
1456
|
+
this.unsubs.push(
|
|
1457
|
+
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
1458
|
+
this.scrollAdjustments = 0;
|
|
1459
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
1460
|
+
this.scrollOffset = offset;
|
|
1461
|
+
this.isScrolling = isScrolling;
|
|
1462
|
+
if (this.scrollState) {
|
|
1463
|
+
this.scheduleScrollReconcile();
|
|
1464
|
+
}
|
|
1465
|
+
this.maybeNotify();
|
|
1466
|
+
})
|
|
1467
|
+
);
|
|
1468
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
1469
|
+
adjustments: void 0,
|
|
1470
|
+
behavior: void 0
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
};
|
|
1474
|
+
this.rafId = null;
|
|
1475
|
+
this.getSize = () => {
|
|
1476
|
+
var _a;
|
|
1477
|
+
if (!this.options.enabled) {
|
|
1478
|
+
this.scrollRect = null;
|
|
1479
|
+
return 0;
|
|
1480
|
+
}
|
|
1481
|
+
this.scrollRect = (_a = this.scrollRect) != null ? _a : this.options.initialRect;
|
|
1482
|
+
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
1483
|
+
};
|
|
1484
|
+
this.getScrollOffset = () => {
|
|
1485
|
+
var _a;
|
|
1486
|
+
if (!this.options.enabled) {
|
|
1487
|
+
this.scrollOffset = null;
|
|
1488
|
+
return 0;
|
|
1489
|
+
}
|
|
1490
|
+
this.scrollOffset = (_a = this.scrollOffset) != null ? _a : typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset;
|
|
1491
|
+
return this.scrollOffset;
|
|
1492
|
+
};
|
|
1493
|
+
this.getFurthestMeasurement = (measurements, index) => {
|
|
1494
|
+
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
1495
|
+
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
1496
|
+
for (let m = index - 1; m >= 0; m--) {
|
|
1497
|
+
const measurement = measurements[m];
|
|
1498
|
+
if (furthestMeasurementsFound.has(measurement.lane)) {
|
|
1499
|
+
continue;
|
|
1500
|
+
}
|
|
1501
|
+
const previousFurthestMeasurement = furthestMeasurements.get(
|
|
1502
|
+
measurement.lane
|
|
1503
|
+
);
|
|
1504
|
+
if (previousFurthestMeasurement == null || measurement.end > previousFurthestMeasurement.end) {
|
|
1505
|
+
furthestMeasurements.set(measurement.lane, measurement);
|
|
1506
|
+
} else if (measurement.end < previousFurthestMeasurement.end) {
|
|
1507
|
+
furthestMeasurementsFound.set(measurement.lane, true);
|
|
1508
|
+
}
|
|
1509
|
+
if (furthestMeasurementsFound.size === this.options.lanes) {
|
|
1510
|
+
break;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
return furthestMeasurements.size === this.options.lanes ? Array.from(furthestMeasurements.values()).sort((a, b) => {
|
|
1514
|
+
if (a.end === b.end) {
|
|
1515
|
+
return a.index - b.index;
|
|
1516
|
+
}
|
|
1517
|
+
return a.end - b.end;
|
|
1518
|
+
})[0] : void 0;
|
|
1519
|
+
};
|
|
1520
|
+
this.getMeasurementOptions = memo(
|
|
1521
|
+
() => [
|
|
1522
|
+
this.options.count,
|
|
1523
|
+
this.options.paddingStart,
|
|
1524
|
+
this.options.scrollMargin,
|
|
1525
|
+
this.options.getItemKey,
|
|
1526
|
+
this.options.enabled,
|
|
1527
|
+
this.options.lanes,
|
|
1528
|
+
this.options.laneAssignmentMode
|
|
1529
|
+
],
|
|
1530
|
+
(count, paddingStart, scrollMargin, getItemKey, enabled, lanes, laneAssignmentMode) => {
|
|
1531
|
+
const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
|
|
1532
|
+
if (lanesChanged) {
|
|
1533
|
+
this.lanesChangedFlag = true;
|
|
1534
|
+
}
|
|
1535
|
+
this.prevLanes = lanes;
|
|
1536
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1537
|
+
return {
|
|
1538
|
+
count,
|
|
1539
|
+
paddingStart,
|
|
1540
|
+
scrollMargin,
|
|
1541
|
+
getItemKey,
|
|
1542
|
+
enabled,
|
|
1543
|
+
lanes,
|
|
1544
|
+
laneAssignmentMode
|
|
1545
|
+
};
|
|
1546
|
+
},
|
|
1547
|
+
{
|
|
1548
|
+
key: false
|
|
1549
|
+
}
|
|
1550
|
+
);
|
|
1551
|
+
this.getMeasurements = memo(
|
|
1552
|
+
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
1553
|
+
({
|
|
1554
|
+
count,
|
|
1555
|
+
paddingStart,
|
|
1556
|
+
scrollMargin,
|
|
1557
|
+
getItemKey,
|
|
1558
|
+
enabled,
|
|
1559
|
+
lanes,
|
|
1560
|
+
laneAssignmentMode
|
|
1561
|
+
}, itemSizeCache) => {
|
|
1562
|
+
if (!enabled) {
|
|
1563
|
+
this.measurementsCache = [];
|
|
1564
|
+
this.itemSizeCache.clear();
|
|
1565
|
+
this.laneAssignments.clear();
|
|
1566
|
+
return [];
|
|
1567
|
+
}
|
|
1568
|
+
if (this.laneAssignments.size > count) {
|
|
1569
|
+
for (const index of this.laneAssignments.keys()) {
|
|
1570
|
+
if (index >= count) {
|
|
1571
|
+
this.laneAssignments.delete(index);
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
if (this.lanesChangedFlag) {
|
|
1576
|
+
this.lanesChangedFlag = false;
|
|
1577
|
+
this.lanesSettling = true;
|
|
1578
|
+
this.measurementsCache = [];
|
|
1579
|
+
this.itemSizeCache.clear();
|
|
1580
|
+
this.laneAssignments.clear();
|
|
1581
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1582
|
+
}
|
|
1583
|
+
if (this.measurementsCache.length === 0 && !this.lanesSettling) {
|
|
1584
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
1585
|
+
this.measurementsCache.forEach((item) => {
|
|
1586
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
1587
|
+
});
|
|
1588
|
+
}
|
|
1589
|
+
const min = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
1590
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
1591
|
+
if (this.lanesSettling && this.measurementsCache.length === count) {
|
|
1592
|
+
this.lanesSettling = false;
|
|
1593
|
+
}
|
|
1594
|
+
const measurements = this.measurementsCache.slice(0, min);
|
|
1595
|
+
const laneLastIndex = new Array(lanes).fill(
|
|
1596
|
+
void 0
|
|
1597
|
+
);
|
|
1598
|
+
for (let m = 0; m < min; m++) {
|
|
1599
|
+
const item = measurements[m];
|
|
1600
|
+
if (item) {
|
|
1601
|
+
laneLastIndex[item.lane] = m;
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
for (let i = min; i < count; i++) {
|
|
1605
|
+
const key = getItemKey(i);
|
|
1606
|
+
const cachedLane = this.laneAssignments.get(i);
|
|
1607
|
+
let lane;
|
|
1608
|
+
let start;
|
|
1609
|
+
const shouldCacheLane = laneAssignmentMode === "estimate" || itemSizeCache.has(key);
|
|
1610
|
+
if (cachedLane !== void 0 && this.options.lanes > 1) {
|
|
1611
|
+
lane = cachedLane;
|
|
1612
|
+
const prevIndex = laneLastIndex[lane];
|
|
1613
|
+
const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
|
|
1614
|
+
start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
|
|
1615
|
+
} else {
|
|
1616
|
+
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
1617
|
+
start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
1618
|
+
lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
|
|
1619
|
+
if (this.options.lanes > 1 && shouldCacheLane) {
|
|
1620
|
+
this.laneAssignments.set(i, lane);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
const measuredSize = itemSizeCache.get(key);
|
|
1624
|
+
const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
|
|
1625
|
+
const end = start + size;
|
|
1626
|
+
measurements[i] = {
|
|
1627
|
+
index: i,
|
|
1628
|
+
start,
|
|
1629
|
+
size,
|
|
1630
|
+
end,
|
|
1631
|
+
key,
|
|
1632
|
+
lane
|
|
1633
|
+
};
|
|
1634
|
+
laneLastIndex[lane] = i;
|
|
1635
|
+
}
|
|
1636
|
+
this.measurementsCache = measurements;
|
|
1637
|
+
return measurements;
|
|
1638
|
+
},
|
|
1639
|
+
{
|
|
1640
|
+
key: "getMeasurements",
|
|
1641
|
+
debug: () => this.options.debug
|
|
1642
|
+
}
|
|
1643
|
+
);
|
|
1644
|
+
this.calculateRange = memo(
|
|
1645
|
+
() => [
|
|
1646
|
+
this.getMeasurements(),
|
|
1647
|
+
this.getSize(),
|
|
1648
|
+
this.getScrollOffset(),
|
|
1649
|
+
this.options.lanes
|
|
1650
|
+
],
|
|
1651
|
+
(measurements, outerSize, scrollOffset, lanes) => {
|
|
1652
|
+
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
1653
|
+
measurements,
|
|
1654
|
+
outerSize,
|
|
1655
|
+
scrollOffset,
|
|
1656
|
+
lanes
|
|
1657
|
+
}) : null;
|
|
1658
|
+
},
|
|
1659
|
+
{
|
|
1660
|
+
key: "calculateRange",
|
|
1661
|
+
debug: () => this.options.debug
|
|
1662
|
+
}
|
|
1663
|
+
);
|
|
1664
|
+
this.getVirtualIndexes = memo(
|
|
1665
|
+
() => {
|
|
1666
|
+
let startIndex = null;
|
|
1667
|
+
let endIndex = null;
|
|
1668
|
+
const range = this.calculateRange();
|
|
1669
|
+
if (range) {
|
|
1670
|
+
startIndex = range.startIndex;
|
|
1671
|
+
endIndex = range.endIndex;
|
|
1672
|
+
}
|
|
1673
|
+
this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
|
|
1674
|
+
return [
|
|
1675
|
+
this.options.rangeExtractor,
|
|
1676
|
+
this.options.overscan,
|
|
1677
|
+
this.options.count,
|
|
1678
|
+
startIndex,
|
|
1679
|
+
endIndex
|
|
1680
|
+
];
|
|
1681
|
+
},
|
|
1682
|
+
(rangeExtractor, overscan, count, startIndex, endIndex) => {
|
|
1683
|
+
return startIndex === null || endIndex === null ? [] : rangeExtractor({
|
|
1684
|
+
startIndex,
|
|
1685
|
+
endIndex,
|
|
1686
|
+
overscan,
|
|
1687
|
+
count
|
|
1688
|
+
});
|
|
1689
|
+
},
|
|
1690
|
+
{
|
|
1691
|
+
key: "getVirtualIndexes",
|
|
1692
|
+
debug: () => this.options.debug
|
|
1693
|
+
}
|
|
1694
|
+
);
|
|
1695
|
+
this.indexFromElement = (node) => {
|
|
1696
|
+
const attributeName = this.options.indexAttribute;
|
|
1697
|
+
const indexStr = node.getAttribute(attributeName);
|
|
1698
|
+
if (!indexStr) {
|
|
1699
|
+
console.warn(
|
|
1700
|
+
`Missing attribute name '${attributeName}={index}' on measured element.`
|
|
1701
|
+
);
|
|
1702
|
+
return -1;
|
|
1703
|
+
}
|
|
1704
|
+
return parseInt(indexStr, 10);
|
|
1705
|
+
};
|
|
1706
|
+
this.shouldMeasureDuringScroll = (index) => {
|
|
1707
|
+
var _a2;
|
|
1708
|
+
var _a;
|
|
1709
|
+
if (!this.scrollState || this.scrollState.behavior !== "smooth") {
|
|
1710
|
+
return true;
|
|
1711
|
+
}
|
|
1712
|
+
const scrollIndex = (_a2 = this.scrollState.index) != null ? _a2 : (_a = this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)) == null ? void 0 : _a.index;
|
|
1713
|
+
if (scrollIndex !== void 0 && this.range) {
|
|
1714
|
+
const bufferSize = Math.max(
|
|
1715
|
+
this.options.overscan,
|
|
1716
|
+
Math.ceil((this.range.endIndex - this.range.startIndex) / 2)
|
|
1717
|
+
);
|
|
1718
|
+
const minIndex = Math.max(0, scrollIndex - bufferSize);
|
|
1719
|
+
const maxIndex = Math.min(
|
|
1720
|
+
this.options.count - 1,
|
|
1721
|
+
scrollIndex + bufferSize
|
|
1722
|
+
);
|
|
1723
|
+
return index >= minIndex && index <= maxIndex;
|
|
1724
|
+
}
|
|
1725
|
+
return true;
|
|
1726
|
+
};
|
|
1727
|
+
this.measureElement = (node) => {
|
|
1728
|
+
if (!node) {
|
|
1729
|
+
this.elementsCache.forEach((cached, key2) => {
|
|
1730
|
+
if (!cached.isConnected) {
|
|
1731
|
+
this.observer.unobserve(cached);
|
|
1732
|
+
this.elementsCache.delete(key2);
|
|
1733
|
+
}
|
|
1734
|
+
});
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
const index = this.indexFromElement(node);
|
|
1738
|
+
const key = this.options.getItemKey(index);
|
|
1739
|
+
const prevNode = this.elementsCache.get(key);
|
|
1740
|
+
if (prevNode !== node) {
|
|
1741
|
+
if (prevNode) {
|
|
1742
|
+
this.observer.unobserve(prevNode);
|
|
1743
|
+
}
|
|
1744
|
+
this.observer.observe(node);
|
|
1745
|
+
this.elementsCache.set(key, node);
|
|
1746
|
+
}
|
|
1747
|
+
if ((!this.isScrolling || this.scrollState) && this.shouldMeasureDuringScroll(index)) {
|
|
1748
|
+
this.resizeItem(index, this.options.measureElement(node, void 0, this));
|
|
1749
|
+
}
|
|
1750
|
+
};
|
|
1751
|
+
this.resizeItem = (index, size) => {
|
|
1752
|
+
var _a2;
|
|
1753
|
+
var _a;
|
|
1754
|
+
const item = this.measurementsCache[index];
|
|
1755
|
+
if (!item) return;
|
|
1756
|
+
const itemSize = (_a2 = this.itemSizeCache.get(item.key)) != null ? _a2 : item.size;
|
|
1757
|
+
const delta = size - itemSize;
|
|
1758
|
+
if (delta !== 0) {
|
|
1759
|
+
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)) {
|
|
1760
|
+
if (this.options.debug) {
|
|
1761
|
+
console.info("correction", delta);
|
|
1762
|
+
}
|
|
1763
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
1764
|
+
adjustments: this.scrollAdjustments += delta,
|
|
1765
|
+
behavior: void 0
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
this.pendingMeasuredCacheIndexes.push(item.index);
|
|
1769
|
+
this.itemSizeCache = new Map(this.itemSizeCache.set(item.key, size));
|
|
1770
|
+
this.notify(false);
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
this.getVirtualItems = memo(
|
|
1774
|
+
() => [this.getVirtualIndexes(), this.getMeasurements()],
|
|
1775
|
+
(indexes, measurements) => {
|
|
1776
|
+
const virtualItems = [];
|
|
1777
|
+
for (let k = 0, len = indexes.length; k < len; k++) {
|
|
1778
|
+
const i = indexes[k];
|
|
1779
|
+
const measurement = measurements[i];
|
|
1780
|
+
virtualItems.push(measurement);
|
|
1781
|
+
}
|
|
1782
|
+
return virtualItems;
|
|
1783
|
+
},
|
|
1784
|
+
{
|
|
1785
|
+
key: "getVirtualItems",
|
|
1786
|
+
debug: () => this.options.debug
|
|
1787
|
+
}
|
|
1788
|
+
);
|
|
1789
|
+
this.getVirtualItemForOffset = (offset) => {
|
|
1790
|
+
const measurements = this.getMeasurements();
|
|
1791
|
+
if (measurements.length === 0) {
|
|
1792
|
+
return void 0;
|
|
1793
|
+
}
|
|
1794
|
+
return notUndefined(
|
|
1795
|
+
measurements[findNearestBinarySearch(
|
|
1796
|
+
0,
|
|
1797
|
+
measurements.length - 1,
|
|
1798
|
+
(index) => notUndefined(measurements[index]).start,
|
|
1799
|
+
offset
|
|
1800
|
+
)]
|
|
1801
|
+
);
|
|
1802
|
+
};
|
|
1803
|
+
this.getMaxScrollOffset = () => {
|
|
1804
|
+
if (!this.scrollElement) return 0;
|
|
1805
|
+
if ("scrollHeight" in this.scrollElement) {
|
|
1806
|
+
return this.options.horizontal ? this.scrollElement.scrollWidth - this.scrollElement.clientWidth : this.scrollElement.scrollHeight - this.scrollElement.clientHeight;
|
|
1807
|
+
} else {
|
|
1808
|
+
const doc = this.scrollElement.document.documentElement;
|
|
1809
|
+
return this.options.horizontal ? doc.scrollWidth - this.scrollElement.innerWidth : doc.scrollHeight - this.scrollElement.innerHeight;
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
|
|
1813
|
+
if (!this.scrollElement) return 0;
|
|
1814
|
+
const size = this.getSize();
|
|
1815
|
+
const scrollOffset = this.getScrollOffset();
|
|
1816
|
+
if (align === "auto") {
|
|
1817
|
+
align = toOffset >= scrollOffset + size ? "end" : "start";
|
|
1818
|
+
}
|
|
1819
|
+
if (align === "center") {
|
|
1820
|
+
toOffset += (itemSize - size) / 2;
|
|
1821
|
+
} else if (align === "end") {
|
|
1822
|
+
toOffset -= size;
|
|
1823
|
+
}
|
|
1824
|
+
const maxOffset = this.getMaxScrollOffset();
|
|
1825
|
+
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
1826
|
+
};
|
|
1827
|
+
this.getOffsetForIndex = (index, align = "auto") => {
|
|
1828
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
1829
|
+
const size = this.getSize();
|
|
1830
|
+
const scrollOffset = this.getScrollOffset();
|
|
1831
|
+
const item = this.measurementsCache[index];
|
|
1832
|
+
if (!item) return;
|
|
1833
|
+
if (align === "auto") {
|
|
1834
|
+
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
1835
|
+
align = "end";
|
|
1836
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
1837
|
+
align = "start";
|
|
1838
|
+
} else {
|
|
1839
|
+
return [scrollOffset, align];
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
if (align === "end" && index === this.options.count - 1) {
|
|
1843
|
+
return [this.getMaxScrollOffset(), align];
|
|
1844
|
+
}
|
|
1845
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
1846
|
+
return [
|
|
1847
|
+
this.getOffsetForAlignment(toOffset, align, item.size),
|
|
1848
|
+
align
|
|
1849
|
+
];
|
|
1850
|
+
};
|
|
1851
|
+
this.scrollToOffset = (toOffset, { align = "start", behavior = "auto" } = {}) => {
|
|
1852
|
+
const offset = this.getOffsetForAlignment(toOffset, align);
|
|
1853
|
+
const now = this.now();
|
|
1854
|
+
this.scrollState = {
|
|
1855
|
+
index: null,
|
|
1856
|
+
align,
|
|
1857
|
+
behavior,
|
|
1858
|
+
startedAt: now,
|
|
1859
|
+
lastTargetOffset: offset,
|
|
1860
|
+
stableFrames: 0
|
|
1861
|
+
};
|
|
1862
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1863
|
+
this.scheduleScrollReconcile();
|
|
1864
|
+
};
|
|
1865
|
+
this.scrollToIndex = (index, {
|
|
1866
|
+
align: initialAlign = "auto",
|
|
1867
|
+
behavior = "auto"
|
|
1868
|
+
} = {}) => {
|
|
1869
|
+
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
1870
|
+
const offsetInfo = this.getOffsetForIndex(index, initialAlign);
|
|
1871
|
+
if (!offsetInfo) {
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
const [offset, align] = offsetInfo;
|
|
1875
|
+
const now = this.now();
|
|
1876
|
+
this.scrollState = {
|
|
1877
|
+
index,
|
|
1878
|
+
align,
|
|
1879
|
+
behavior,
|
|
1880
|
+
startedAt: now,
|
|
1881
|
+
lastTargetOffset: offset,
|
|
1882
|
+
stableFrames: 0
|
|
1883
|
+
};
|
|
1884
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1885
|
+
this.scheduleScrollReconcile();
|
|
1886
|
+
};
|
|
1887
|
+
this.scrollBy = (delta, { behavior = "auto" } = {}) => {
|
|
1888
|
+
const offset = this.getScrollOffset() + delta;
|
|
1889
|
+
const now = this.now();
|
|
1890
|
+
this.scrollState = {
|
|
1891
|
+
index: null,
|
|
1892
|
+
align: "start",
|
|
1893
|
+
behavior,
|
|
1894
|
+
startedAt: now,
|
|
1895
|
+
lastTargetOffset: offset,
|
|
1896
|
+
stableFrames: 0
|
|
1897
|
+
};
|
|
1898
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
1899
|
+
this.scheduleScrollReconcile();
|
|
1900
|
+
};
|
|
1901
|
+
this.getTotalSize = () => {
|
|
1902
|
+
var _a2;
|
|
1903
|
+
var _a;
|
|
1904
|
+
const measurements = this.getMeasurements();
|
|
1905
|
+
let end;
|
|
1906
|
+
if (measurements.length === 0) {
|
|
1907
|
+
end = this.options.paddingStart;
|
|
1908
|
+
} else if (this.options.lanes === 1) {
|
|
1909
|
+
end = (_a2 = (_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) != null ? _a2 : 0;
|
|
1910
|
+
} else {
|
|
1911
|
+
const endByLane = Array(this.options.lanes).fill(null);
|
|
1912
|
+
let endIndex = measurements.length - 1;
|
|
1913
|
+
while (endIndex >= 0 && endByLane.some((val) => val === null)) {
|
|
1914
|
+
const item = measurements[endIndex];
|
|
1915
|
+
if (endByLane[item.lane] === null) {
|
|
1916
|
+
endByLane[item.lane] = item.end;
|
|
1917
|
+
}
|
|
1918
|
+
endIndex--;
|
|
1919
|
+
}
|
|
1920
|
+
end = Math.max(...endByLane.filter((val) => val !== null));
|
|
1921
|
+
}
|
|
1922
|
+
return Math.max(
|
|
1923
|
+
end - this.options.scrollMargin + this.options.paddingEnd,
|
|
1924
|
+
0
|
|
1925
|
+
);
|
|
1926
|
+
};
|
|
1927
|
+
this._scrollToOffset = (offset, {
|
|
1928
|
+
adjustments,
|
|
1929
|
+
behavior
|
|
1930
|
+
}) => {
|
|
1931
|
+
this.options.scrollToFn(offset, { behavior, adjustments }, this);
|
|
1932
|
+
};
|
|
1933
|
+
this.measure = () => {
|
|
1934
|
+
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
1935
|
+
this.laneAssignments = /* @__PURE__ */ new Map();
|
|
1936
|
+
this.notify(false);
|
|
1937
|
+
};
|
|
1938
|
+
this.setOptions(opts);
|
|
1939
|
+
}
|
|
1940
|
+
scheduleScrollReconcile() {
|
|
1941
|
+
if (!this.targetWindow) {
|
|
1942
|
+
this.scrollState = null;
|
|
1943
|
+
return;
|
|
1944
|
+
}
|
|
1945
|
+
if (this.rafId != null) return;
|
|
1946
|
+
this.rafId = this.targetWindow.requestAnimationFrame(() => {
|
|
1947
|
+
this.rafId = null;
|
|
1948
|
+
this.reconcileScroll();
|
|
1949
|
+
});
|
|
1950
|
+
}
|
|
1951
|
+
reconcileScroll() {
|
|
1952
|
+
if (!this.scrollState) return;
|
|
1953
|
+
const el = this.scrollElement;
|
|
1954
|
+
if (!el) return;
|
|
1955
|
+
const MAX_RECONCILE_MS = 5e3;
|
|
1956
|
+
if (this.now() - this.scrollState.startedAt > MAX_RECONCILE_MS) {
|
|
1957
|
+
this.scrollState = null;
|
|
1958
|
+
return;
|
|
1959
|
+
}
|
|
1960
|
+
const offsetInfo = this.scrollState.index != null ? this.getOffsetForIndex(this.scrollState.index, this.scrollState.align) : void 0;
|
|
1961
|
+
const targetOffset = offsetInfo ? offsetInfo[0] : this.scrollState.lastTargetOffset;
|
|
1962
|
+
const STABLE_FRAMES = 1;
|
|
1963
|
+
const targetChanged = targetOffset !== this.scrollState.lastTargetOffset;
|
|
1964
|
+
if (!targetChanged && approxEqual(targetOffset, this.getScrollOffset())) {
|
|
1965
|
+
this.scrollState.stableFrames++;
|
|
1966
|
+
if (this.scrollState.stableFrames >= STABLE_FRAMES) {
|
|
1967
|
+
this.scrollState = null;
|
|
1968
|
+
return;
|
|
1969
|
+
}
|
|
1970
|
+
} else {
|
|
1971
|
+
this.scrollState.stableFrames = 0;
|
|
1972
|
+
if (targetChanged) {
|
|
1973
|
+
this.scrollState.lastTargetOffset = targetOffset;
|
|
1974
|
+
this.scrollState.behavior = "auto";
|
|
1975
|
+
this._scrollToOffset(targetOffset, {
|
|
1976
|
+
adjustments: void 0,
|
|
1977
|
+
behavior: "auto"
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
this.scheduleScrollReconcile();
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
var findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
1985
|
+
while (low <= high) {
|
|
1986
|
+
const middle = (low + high) / 2 | 0;
|
|
1987
|
+
const currentValue = getCurrentValue(middle);
|
|
1988
|
+
if (currentValue < value) {
|
|
1989
|
+
low = middle + 1;
|
|
1990
|
+
} else if (currentValue > value) {
|
|
1991
|
+
high = middle - 1;
|
|
1992
|
+
} else {
|
|
1993
|
+
return middle;
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
if (low > 0) {
|
|
1997
|
+
return low - 1;
|
|
1998
|
+
} else {
|
|
1999
|
+
return 0;
|
|
2000
|
+
}
|
|
2001
|
+
};
|
|
2002
|
+
function calculateRange({
|
|
2003
|
+
measurements,
|
|
2004
|
+
outerSize,
|
|
2005
|
+
scrollOffset,
|
|
2006
|
+
lanes
|
|
2007
|
+
}) {
|
|
2008
|
+
const lastIndex = measurements.length - 1;
|
|
2009
|
+
const getOffset = (index) => measurements[index].start;
|
|
2010
|
+
if (measurements.length <= lanes) {
|
|
2011
|
+
return {
|
|
2012
|
+
startIndex: 0,
|
|
2013
|
+
endIndex: lastIndex
|
|
2014
|
+
};
|
|
2015
|
+
}
|
|
2016
|
+
let startIndex = findNearestBinarySearch(
|
|
2017
|
+
0,
|
|
2018
|
+
lastIndex,
|
|
2019
|
+
getOffset,
|
|
2020
|
+
scrollOffset
|
|
2021
|
+
);
|
|
2022
|
+
let endIndex = startIndex;
|
|
2023
|
+
if (lanes === 1) {
|
|
2024
|
+
while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
|
|
2025
|
+
endIndex++;
|
|
2026
|
+
}
|
|
2027
|
+
} else if (lanes > 1) {
|
|
2028
|
+
const endPerLane = Array(lanes).fill(0);
|
|
2029
|
+
while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
|
|
2030
|
+
const item = measurements[endIndex];
|
|
2031
|
+
endPerLane[item.lane] = item.end;
|
|
2032
|
+
endIndex++;
|
|
2033
|
+
}
|
|
2034
|
+
const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
|
|
2035
|
+
while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
|
|
2036
|
+
const item = measurements[startIndex];
|
|
2037
|
+
startPerLane[item.lane] = item.start;
|
|
2038
|
+
startIndex--;
|
|
2039
|
+
}
|
|
2040
|
+
startIndex = Math.max(0, startIndex - startIndex % lanes);
|
|
2041
|
+
endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
|
|
2042
|
+
}
|
|
2043
|
+
return { startIndex, endIndex };
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
// ../../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
|
|
2047
|
+
var useIsomorphicLayoutEffect = typeof document !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
2048
|
+
function useVirtualizerBase(_a) {
|
|
2049
|
+
var _b = _a, {
|
|
2050
|
+
useFlushSync = true
|
|
2051
|
+
} = _b, options = __objRest(_b, [
|
|
2052
|
+
"useFlushSync"
|
|
2053
|
+
]);
|
|
2054
|
+
const rerender = React.useReducer(() => ({}), {})[1];
|
|
2055
|
+
const resolvedOptions = __spreadProps(__spreadValues({}, options), {
|
|
2056
|
+
onChange: (instance2, sync) => {
|
|
2057
|
+
var _a2;
|
|
2058
|
+
if (useFlushSync && sync) {
|
|
2059
|
+
(0, import_react_dom.flushSync)(rerender);
|
|
2060
|
+
} else {
|
|
2061
|
+
rerender();
|
|
2062
|
+
}
|
|
2063
|
+
(_a2 = options.onChange) == null ? void 0 : _a2.call(options, instance2, sync);
|
|
2064
|
+
}
|
|
2065
|
+
});
|
|
2066
|
+
const [instance] = React.useState(
|
|
2067
|
+
() => new Virtualizer(resolvedOptions)
|
|
2068
|
+
);
|
|
2069
|
+
instance.setOptions(resolvedOptions);
|
|
2070
|
+
useIsomorphicLayoutEffect(() => {
|
|
2071
|
+
return instance._didMount();
|
|
2072
|
+
}, []);
|
|
2073
|
+
useIsomorphicLayoutEffect(() => {
|
|
2074
|
+
return instance._willUpdate();
|
|
2075
|
+
});
|
|
2076
|
+
return instance;
|
|
2077
|
+
}
|
|
2078
|
+
function useWindowVirtualizer(options) {
|
|
2079
|
+
return useVirtualizerBase(__spreadValues({
|
|
2080
|
+
getScrollElement: () => typeof document !== "undefined" ? window : null,
|
|
2081
|
+
observeElementRect: observeWindowRect,
|
|
2082
|
+
observeElementOffset: observeWindowOffset,
|
|
2083
|
+
scrollToFn: windowScroll,
|
|
2084
|
+
initialOffset: () => typeof document !== "undefined" ? window.scrollY : 0
|
|
2085
|
+
}, options));
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2089
|
+
var import_components13 = require("@transferwise/components");
|
|
2090
|
+
var import_react6 = require("react");
|
|
2091
|
+
|
|
2092
|
+
// ../renderers/src/step/StepFooter.tsx
|
|
2093
|
+
var import_components12 = require("@transferwise/components");
|
|
2094
|
+
var import_react5 = require("react");
|
|
2095
|
+
var import_react_intl6 = require("react-intl");
|
|
2096
|
+
|
|
2097
|
+
// ../renderers/src/messages/step.messages.ts
|
|
2098
|
+
var import_react_intl5 = require("react-intl");
|
|
2099
|
+
var step_messages_default = (0, import_react_intl5.defineMessages)({
|
|
2100
|
+
scrollToBottom: {
|
|
2101
|
+
id: "df.wise.step.scrollToBottom",
|
|
2102
|
+
defaultMessage: "Scroll to bottom",
|
|
2103
|
+
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."
|
|
2104
|
+
}
|
|
2105
|
+
});
|
|
2106
|
+
|
|
2107
|
+
// ../renderers/src/step/StepFooter.tsx
|
|
2108
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2109
|
+
var SCROLL_TO_BOTTOM = "scroll-to-bottom";
|
|
2110
|
+
var StepFooter = ({ footer, tags }) => {
|
|
2111
|
+
if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
|
|
2112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FooterWithScrollButton, { footer });
|
|
2113
|
+
}
|
|
2114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DefaultFooter, { footer });
|
|
2115
|
+
};
|
|
2116
|
+
var DefaultFooter = ({ footer }) => {
|
|
2117
|
+
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
2118
|
+
return hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0;
|
|
2119
|
+
};
|
|
2120
|
+
var FooterWithScrollButton = ({ footer }) => {
|
|
2121
|
+
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
2122
|
+
const endOfLayoutRef = (0, import_react5.useRef)(null);
|
|
2123
|
+
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
2124
|
+
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2125
|
+
import_components12.Button,
|
|
2126
|
+
{
|
|
2127
|
+
className: "m-b-1",
|
|
2128
|
+
v2: true,
|
|
2129
|
+
block: true,
|
|
2130
|
+
priority: "tertiary",
|
|
2131
|
+
onClick: () => {
|
|
2132
|
+
var _a;
|
|
2133
|
+
(_a = endOfLayoutRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
2134
|
+
},
|
|
2135
|
+
children: formatMessage(step_messages_default.scrollToBottom)
|
|
2136
|
+
}
|
|
2137
|
+
);
|
|
2138
|
+
const hasStepFooterContent = footer && Array.isArray(footer) && footer.length > 0;
|
|
2139
|
+
if (isElementVisible && !hasStepFooterContent) {
|
|
2140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
|
|
2141
|
+
}
|
|
2142
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
|
|
2144
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "df-step-fixed__footer", children: [
|
|
2145
|
+
!isElementVisible && scrollButton,
|
|
2146
|
+
footer
|
|
2147
|
+
] })
|
|
2148
|
+
] });
|
|
2149
|
+
};
|
|
2150
|
+
var useIsElementVisible = (elementRef) => {
|
|
2151
|
+
const [isVisible, setIsVisible] = (0, import_react5.useState)(false);
|
|
2152
|
+
(0, import_react5.useEffect)(() => {
|
|
2153
|
+
const element = elementRef.current;
|
|
2154
|
+
if (!element) return;
|
|
2155
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
2156
|
+
setIsVisible(entry.isIntersecting);
|
|
2157
|
+
});
|
|
2158
|
+
observer.observe(element);
|
|
2159
|
+
return () => observer.disconnect();
|
|
2160
|
+
}, [elementRef]);
|
|
2161
|
+
return isVisible;
|
|
2162
|
+
};
|
|
2163
|
+
|
|
2164
|
+
// ../renderers/src/CollectionRenderer/components/ContentComponent.tsx
|
|
2165
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2166
|
+
var ContentComponent = (props) => {
|
|
2167
|
+
const { state, status, SectionHeader, Item } = props;
|
|
2168
|
+
const endOfContentRef = (0, import_react6.useRef)(null);
|
|
2169
|
+
const isBottomVisible = useIsElementVisible(endOfContentRef);
|
|
2170
|
+
(0, import_react6.useEffect)(() => {
|
|
2171
|
+
var _a;
|
|
2172
|
+
if (isBottomVisible && status.type === "idle" && status.loadMore) {
|
|
2173
|
+
(_a = status.loadMore) == null ? void 0 : _a.call(status);
|
|
2174
|
+
}
|
|
2175
|
+
}, [isBottomVisible]);
|
|
2176
|
+
const stateCount = state.sections.reduce(
|
|
2177
|
+
(total, section) => section.items.length + total + (section.title ? 1 : 0),
|
|
2178
|
+
0
|
|
2179
|
+
);
|
|
2180
|
+
const items = (0, import_react6.useMemo)(() => {
|
|
2181
|
+
return state.sections.reduce((acc, section) => {
|
|
2182
|
+
return [
|
|
2183
|
+
...acc,
|
|
2184
|
+
...section.title ? [
|
|
2185
|
+
{
|
|
2186
|
+
type: "header",
|
|
2187
|
+
title: section.title,
|
|
2188
|
+
items: section.items,
|
|
2189
|
+
id: section.id
|
|
2190
|
+
}
|
|
2191
|
+
] : [],
|
|
2192
|
+
...section.items.map((item) => ({
|
|
2193
|
+
item,
|
|
2194
|
+
type: "item"
|
|
2195
|
+
}))
|
|
2196
|
+
];
|
|
2197
|
+
}, []);
|
|
2198
|
+
}, [stateCount]);
|
|
2199
|
+
const listRef = (0, import_react6.useRef)(null);
|
|
2200
|
+
const listOffsetRef = (0, import_react6.useRef)(0);
|
|
2201
|
+
(0, import_react6.useLayoutEffect)(() => {
|
|
2202
|
+
var _a, _b;
|
|
2203
|
+
listOffsetRef.current = (_b = (_a = listRef.current) == null ? void 0 : _a.offsetTop) != null ? _b : 0;
|
|
2204
|
+
});
|
|
2205
|
+
const virtualizer = useWindowVirtualizer({
|
|
2206
|
+
count: stateCount,
|
|
2207
|
+
estimateSize: () => 120,
|
|
2208
|
+
// todo, we could be clever here. Is it worth it?
|
|
2209
|
+
overscan: 10,
|
|
2210
|
+
scrollMargin: listOffsetRef.current
|
|
2211
|
+
});
|
|
2212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { ref: listRef, children: [
|
|
2213
|
+
state.beforeSections,
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2215
|
+
"div",
|
|
2216
|
+
{
|
|
2217
|
+
style: {
|
|
2218
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
2219
|
+
width: "100%",
|
|
2220
|
+
position: "relative"
|
|
2221
|
+
},
|
|
2222
|
+
children: virtualizer.getVirtualItems().map((item) => {
|
|
2223
|
+
const i = items[item.index];
|
|
2224
|
+
if (!i) {
|
|
2225
|
+
return null;
|
|
2226
|
+
}
|
|
2227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2228
|
+
"div",
|
|
2229
|
+
{
|
|
2230
|
+
ref: virtualizer.measureElement,
|
|
2231
|
+
"data-index": item.index,
|
|
2232
|
+
style: {
|
|
2233
|
+
position: "absolute",
|
|
2234
|
+
top: 0,
|
|
2235
|
+
left: 0,
|
|
2236
|
+
width: "100%",
|
|
2237
|
+
transform: `translateY(${item.start - virtualizer.options.scrollMargin}px)`
|
|
2238
|
+
},
|
|
2239
|
+
children: i.type === "header" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SectionHeader, __spreadValues({}, i)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Item, __spreadValues({}, i.item))
|
|
2240
|
+
},
|
|
2241
|
+
item.key
|
|
2242
|
+
);
|
|
2243
|
+
})
|
|
2244
|
+
}
|
|
2245
|
+
),
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { ref: endOfContentRef, className: "d-flex m-x-auto m-y-2", children: [
|
|
2247
|
+
status.type === "idle" || status.type === "loading" && status.reason === "pagination" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.ProcessIndicator, { size: "xs" }) : null,
|
|
2248
|
+
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
|
|
2249
|
+
] }),
|
|
2250
|
+
state.afterSections
|
|
2251
|
+
] });
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// ../renderers/src/CollectionRenderer/components/SearchComponent.tsx
|
|
2255
|
+
var import_components14 = require("@transferwise/components");
|
|
2256
|
+
var import_icons = require("@transferwise/icons");
|
|
2257
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2258
|
+
var SearchComponent = ({ state, features }) => {
|
|
2259
|
+
const { search } = state;
|
|
2260
|
+
if (!search) {
|
|
2261
|
+
return;
|
|
2262
|
+
}
|
|
2263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2264
|
+
FieldInput_default,
|
|
2265
|
+
{
|
|
2266
|
+
id: "search",
|
|
2267
|
+
description: "",
|
|
2268
|
+
validation: void 0,
|
|
2269
|
+
help: "",
|
|
2270
|
+
label: search.title,
|
|
2271
|
+
features,
|
|
2272
|
+
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)(
|
|
2273
|
+
import_components14.Input,
|
|
2274
|
+
{
|
|
2275
|
+
id: "search",
|
|
2276
|
+
name: "search",
|
|
2277
|
+
shape: "pill",
|
|
2278
|
+
placeholder: search.hint,
|
|
2279
|
+
type: "text",
|
|
2280
|
+
value: search.query,
|
|
2281
|
+
onChange: ({ currentTarget: { value } }) => {
|
|
2282
|
+
search.onChange(value);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
) })
|
|
2286
|
+
}
|
|
2287
|
+
);
|
|
2288
|
+
};
|
|
2289
|
+
|
|
2290
|
+
// ../renderers/src/CollectionRenderer/components/FilterComponent.tsx
|
|
2291
|
+
var import_components15 = require("@transferwise/components");
|
|
2292
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2293
|
+
var FiltersComponent = ({ state }) => {
|
|
2294
|
+
const { filters } = state;
|
|
2295
|
+
return filters.map((filter) => {
|
|
2296
|
+
var _a;
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FilterComponent, __spreadValues({}, filter), JSON.stringify((_a = filter.options) == null ? void 0 : _a.map((o) => o.value)));
|
|
2298
|
+
});
|
|
2299
|
+
};
|
|
2300
|
+
var FilterComponent = (filter) => {
|
|
2301
|
+
const { multiSelect, options } = filter;
|
|
2302
|
+
if (!options) {
|
|
2303
|
+
return null;
|
|
2304
|
+
}
|
|
2305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2306
|
+
import_components15.Chips,
|
|
2307
|
+
{
|
|
2308
|
+
className: "m-b-1",
|
|
2309
|
+
multiple: multiSelect,
|
|
2310
|
+
selected: options.some((option) => option.selected) ? options.filter((option) => option.selected).map((option) => option.value) : multiSelect ? [] : "",
|
|
2311
|
+
chips: [
|
|
2312
|
+
...multiSelect ? [
|
|
2313
|
+
{
|
|
2314
|
+
value: "",
|
|
2315
|
+
// this is a placeholder for now, only for single selects, when it is not possible to de-select options
|
|
2316
|
+
label: "All"
|
|
2317
|
+
}
|
|
2318
|
+
] : [],
|
|
2319
|
+
...options.map((option) => ({
|
|
2320
|
+
value: option.value,
|
|
2321
|
+
label: option.title
|
|
2322
|
+
}))
|
|
2323
|
+
],
|
|
2324
|
+
onChange: (value) => {
|
|
2325
|
+
var _a;
|
|
2326
|
+
if (value.selectedValue === "") {
|
|
2327
|
+
options == null ? void 0 : options.filter((option) => option.selected).map((option) => option == null ? void 0 : option.onSelect());
|
|
2328
|
+
return;
|
|
2329
|
+
}
|
|
2330
|
+
(_a = options == null ? void 0 : options.find((option) => value.selectedValue === option.value)) == null ? void 0 : _a.onSelect();
|
|
2331
|
+
}
|
|
2332
|
+
},
|
|
2333
|
+
JSON.stringify(options)
|
|
2334
|
+
);
|
|
2335
|
+
};
|
|
2336
|
+
|
|
2337
|
+
// ../renderers/src/CollectionRenderer/components/ItemComponent.tsx
|
|
2338
|
+
var import_components18 = require("@transferwise/components");
|
|
2339
|
+
|
|
2340
|
+
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
2341
|
+
var import_components16 = require("@transferwise/components");
|
|
2342
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
2343
|
+
var getAdditionalInfo = (additionalInfo) => {
|
|
2344
|
+
var _a, _b;
|
|
2345
|
+
if (!additionalInfo) {
|
|
2346
|
+
return void 0;
|
|
2347
|
+
}
|
|
2348
|
+
const { href, text, onClick } = additionalInfo;
|
|
2349
|
+
if (href || onClick) {
|
|
2350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2351
|
+
import_components16.ListItem.AdditionalInfo,
|
|
2352
|
+
{
|
|
2353
|
+
action: __spreadValues({
|
|
2354
|
+
label: text
|
|
2355
|
+
}, (_b = (_a = additionalInfo.getAnchorProps) == null ? void 0 : _a.call(additionalInfo)) != null ? _b : { onClick })
|
|
2356
|
+
}
|
|
2357
|
+
);
|
|
2358
|
+
}
|
|
2359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components16.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2362
|
+
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
2363
|
+
var import_components17 = require("@transferwise/components");
|
|
2364
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
2365
|
+
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
2366
|
+
if (!callToAction) {
|
|
2367
|
+
return void 0;
|
|
2368
|
+
}
|
|
2369
|
+
const { accessibilityDescription, title, context } = callToAction;
|
|
2370
|
+
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
2371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2372
|
+
import_components17.ListItem.Button,
|
|
2373
|
+
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
2374
|
+
partiallyInteractive: !fullyInteractive,
|
|
2375
|
+
priority,
|
|
2376
|
+
"aria-description": accessibilityDescription,
|
|
2377
|
+
sentiment,
|
|
2378
|
+
children: title
|
|
2379
|
+
})
|
|
2380
|
+
);
|
|
2381
|
+
};
|
|
2382
|
+
var getPriorityAndSentiment = (ctaSecondary, context) => {
|
|
2383
|
+
if (context === "negative") {
|
|
2384
|
+
return { priority: "secondary", sentiment: "negative" };
|
|
2385
|
+
}
|
|
2386
|
+
return { priority: ctaSecondary ? "secondary" : "secondary-neutral", sentiment: "default" };
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
// ../renderers/src/utils/listItem/shouldUseAvatar.ts
|
|
2390
|
+
var shouldUseAvatar = (control, tags) => {
|
|
2391
|
+
var _a;
|
|
2392
|
+
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
// ../renderers/src/CollectionRenderer/components/ItemComponent.tsx
|
|
2396
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
2397
|
+
var ItemComponent = (props) => {
|
|
2398
|
+
var _a, _b;
|
|
1087
2399
|
const {
|
|
1088
|
-
|
|
2400
|
+
title,
|
|
1089
2401
|
description,
|
|
1090
|
-
disabled,
|
|
1091
|
-
inlineAlert,
|
|
1092
|
-
media,
|
|
1093
2402
|
supportingValues,
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
2403
|
+
media,
|
|
2404
|
+
additionalInfo,
|
|
2405
|
+
inlineAlert,
|
|
2406
|
+
href,
|
|
2407
|
+
onClick,
|
|
2408
|
+
callToAction,
|
|
2409
|
+
tags,
|
|
2410
|
+
parentTags,
|
|
2411
|
+
control
|
|
1099
2412
|
} = props;
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
2413
|
+
const controlOptions = {
|
|
2414
|
+
ctaSecondary: (_a = tags == null ? void 0 : tags.includes("cta-secondary")) != null ? _a : false,
|
|
2415
|
+
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
2416
|
+
};
|
|
2417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
2418
|
+
import_components18.ListItem,
|
|
2419
|
+
{
|
|
1104
2420
|
title,
|
|
1105
2421
|
subtitle: description,
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
prompt:
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
2422
|
+
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
2423
|
+
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
2424
|
+
media: getMedia(media, shouldUseAvatar(control, parentTags)),
|
|
2425
|
+
prompt: getInlineAlert(inlineAlert),
|
|
2426
|
+
additionalInfo: getAdditionalInfo(additionalInfo),
|
|
2427
|
+
control: onClick || href ? getNavigationControl(onClick, href) : getCTAControl(callToAction, controlOptions)
|
|
2428
|
+
},
|
|
2429
|
+
title
|
|
2430
|
+
);
|
|
1113
2431
|
};
|
|
1114
|
-
var
|
|
1115
|
-
if (
|
|
1116
|
-
return /* @__PURE__ */ (0,
|
|
2432
|
+
var getNavigationControl = (onClick, href) => {
|
|
2433
|
+
if (href) {
|
|
2434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components18.ListItem.Navigation, { href });
|
|
1117
2435
|
}
|
|
1118
|
-
|
|
2436
|
+
if (onClick) {
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components18.ListItem.Navigation, { onClick });
|
|
2438
|
+
}
|
|
2439
|
+
return null;
|
|
1119
2440
|
};
|
|
1120
|
-
|
|
2441
|
+
|
|
2442
|
+
// ../renderers/src/CollectionRenderer/components/SectionHeaderComponent.tsx
|
|
2443
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
2444
|
+
var SectionHeaderComponent = ({
|
|
2445
|
+
title,
|
|
2446
|
+
callToAction
|
|
2447
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Header, { title, callToAction });
|
|
2448
|
+
|
|
2449
|
+
// ../renderers/src/CollectionRenderer/createCollectionRenderer.tsx
|
|
2450
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2451
|
+
var createCollectionRenderer = (canRender, components) => {
|
|
2452
|
+
const componeontsWithDefaults = __spreadValues({
|
|
2453
|
+
Search: SearchComponent,
|
|
2454
|
+
Filters: FiltersComponent,
|
|
2455
|
+
Filter: FilterComponent,
|
|
2456
|
+
Item: ItemComponent,
|
|
2457
|
+
SectionHeader: SectionHeaderComponent,
|
|
2458
|
+
Results: ContentComponent
|
|
2459
|
+
}, components);
|
|
2460
|
+
return {
|
|
2461
|
+
canRenderType: "collection",
|
|
2462
|
+
canRender,
|
|
2463
|
+
render: (props) => {
|
|
2464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CollectionRendererComponent, __spreadValues(__spreadValues({}, props), componeontsWithDefaults));
|
|
2465
|
+
}
|
|
2466
|
+
};
|
|
2467
|
+
};
|
|
2468
|
+
|
|
2469
|
+
// ../renderers/src/CollectionRenderer/CollectionRenderer.tsx
|
|
2470
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2471
|
+
var CollectionRendererComponent = (props) => {
|
|
2472
|
+
const { status, Search: Search4, Filters, Results } = props;
|
|
2473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
|
|
2474
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Search4, __spreadValues({}, props)),
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Filters, __spreadValues({}, props)),
|
|
2476
|
+
status.type === "idle" || status.reason === "pagination" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Results, __spreadValues({}, props)) : void 0,
|
|
2477
|
+
status.type === "error" && status.reason === "search" && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_components19.InlinePrompt, { width: "full", sentiment: "negative", children: [
|
|
2478
|
+
"Something went wrong,\xA0",
|
|
2479
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components19.Link, { onClick: status.retry, children: "click here to retry" })
|
|
2480
|
+
] })
|
|
2481
|
+
] });
|
|
2482
|
+
};
|
|
2483
|
+
var CollectionRenderer = createCollectionRenderer(() => true, {
|
|
2484
|
+
Search: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SearchComponent, __spreadValues({}, props)),
|
|
2485
|
+
Filters: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FiltersComponent, __spreadValues({}, props)),
|
|
2486
|
+
Filter: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(FilterComponent, __spreadValues({}, props)),
|
|
2487
|
+
Item: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ItemComponent, __spreadValues({}, props)),
|
|
2488
|
+
SectionHeader: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SectionHeaderComponent, __spreadValues({}, props)),
|
|
2489
|
+
Results: (props) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ContentComponent, __spreadValues({}, props))
|
|
2490
|
+
});
|
|
2491
|
+
var CollectionRenderer_default = CollectionRenderer;
|
|
1121
2492
|
|
|
1122
2493
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
1123
2494
|
var import_classnames3 = __toESM(require_classnames());
|
|
1124
|
-
var
|
|
2495
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1125
2496
|
var ColumnsRenderer = {
|
|
1126
2497
|
canRenderType: "columns",
|
|
1127
|
-
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0,
|
|
2498
|
+
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1128
2499
|
"div",
|
|
1129
2500
|
{
|
|
1130
2501
|
className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
|
|
@@ -1132,8 +2503,8 @@ var ColumnsRenderer = {
|
|
|
1132
2503
|
"df-columns-renderer-bias-end": bias === "end"
|
|
1133
2504
|
}),
|
|
1134
2505
|
children: [
|
|
1135
|
-
/* @__PURE__ */ (0,
|
|
1136
|
-
/* @__PURE__ */ (0,
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "df-columns-renderer-column", children: startChildren }),
|
|
2507
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "df-columns-renderer-column", children: endChildren })
|
|
1137
2508
|
]
|
|
1138
2509
|
}
|
|
1139
2510
|
)
|
|
@@ -1141,7 +2512,7 @@ var ColumnsRenderer = {
|
|
|
1141
2512
|
var ColumnsRenderer_default = ColumnsRenderer;
|
|
1142
2513
|
|
|
1143
2514
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
1144
|
-
var
|
|
2515
|
+
var import_components20 = require("@transferwise/components");
|
|
1145
2516
|
|
|
1146
2517
|
// ../renderers/src/validators/type-validators.ts
|
|
1147
2518
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
@@ -1168,7 +2539,7 @@ var dateToDateString = (date) => {
|
|
|
1168
2539
|
};
|
|
1169
2540
|
|
|
1170
2541
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
1171
|
-
var
|
|
2542
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1172
2543
|
function VariableDateInput({
|
|
1173
2544
|
control,
|
|
1174
2545
|
inputProps
|
|
@@ -1184,8 +2555,8 @@ function VariableDateInput({
|
|
|
1184
2555
|
onFocus
|
|
1185
2556
|
} = inputProps;
|
|
1186
2557
|
if (control === "date-lookup") {
|
|
1187
|
-
return /* @__PURE__ */ (0,
|
|
1188
|
-
|
|
2558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2559
|
+
import_components20.DateLookup,
|
|
1189
2560
|
{
|
|
1190
2561
|
value: dateStringToDateOrNull(inputProps.value),
|
|
1191
2562
|
min: dateStringToDateOrNull(minimumDate),
|
|
@@ -1200,8 +2571,8 @@ function VariableDateInput({
|
|
|
1200
2571
|
}
|
|
1201
2572
|
);
|
|
1202
2573
|
}
|
|
1203
|
-
return /* @__PURE__ */ (0,
|
|
1204
|
-
|
|
2574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
2575
|
+
import_components20.DateInput,
|
|
1205
2576
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
1206
2577
|
dayAutoComplete: getAutocompleteString(autoComplete, "day"),
|
|
1207
2578
|
yearAutoComplete: getAutocompleteString(autoComplete, "year")
|
|
@@ -1217,7 +2588,7 @@ var getAutocompleteString = (value, suffix) => {
|
|
|
1217
2588
|
var VariableDateInput_default = VariableDateInput;
|
|
1218
2589
|
|
|
1219
2590
|
// ../renderers/src/DateInputRenderer.tsx
|
|
1220
|
-
var
|
|
2591
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1221
2592
|
var DateInputRenderer = {
|
|
1222
2593
|
canRenderType: "input-date",
|
|
1223
2594
|
render: (props) => {
|
|
@@ -1242,7 +2613,7 @@ var DateInputRenderer = {
|
|
|
1242
2613
|
]);
|
|
1243
2614
|
const value = initialValue != null ? initialValue : "";
|
|
1244
2615
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
1245
|
-
return /* @__PURE__ */ (0,
|
|
2616
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1246
2617
|
FieldInput_default,
|
|
1247
2618
|
{
|
|
1248
2619
|
id,
|
|
@@ -1253,7 +2624,7 @@ var DateInputRenderer = {
|
|
|
1253
2624
|
loadingState: props.fieldLoadingState,
|
|
1254
2625
|
help,
|
|
1255
2626
|
features: props.features,
|
|
1256
|
-
children: /* @__PURE__ */ (0,
|
|
2627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VariableDateInput_default, { control, inputProps })
|
|
1257
2628
|
}
|
|
1258
2629
|
);
|
|
1259
2630
|
}
|
|
@@ -1261,44 +2632,16 @@ var DateInputRenderer = {
|
|
|
1261
2632
|
var DateInputRenderer_default = DateInputRenderer;
|
|
1262
2633
|
|
|
1263
2634
|
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1264
|
-
var
|
|
1265
|
-
|
|
1266
|
-
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
1267
|
-
var import_components13 = require("@transferwise/components");
|
|
1268
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1269
|
-
var getAdditionalInfo = (additionalInfo) => {
|
|
1270
|
-
var _a, _b;
|
|
1271
|
-
if (!additionalInfo) {
|
|
1272
|
-
return void 0;
|
|
1273
|
-
}
|
|
1274
|
-
const { href, text, onClick } = additionalInfo;
|
|
1275
|
-
if (href || onClick) {
|
|
1276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1277
|
-
import_components13.ListItem.AdditionalInfo,
|
|
1278
|
-
{
|
|
1279
|
-
action: __spreadValues({
|
|
1280
|
-
label: text
|
|
1281
|
-
}, (_b = (_a = additionalInfo.getAnchorProps) == null ? void 0 : _a.call(additionalInfo)) != null ? _b : { onClick })
|
|
1282
|
-
}
|
|
1283
|
-
);
|
|
1284
|
-
}
|
|
1285
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components13.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
1286
|
-
};
|
|
1287
|
-
|
|
1288
|
-
// ../renderers/src/utils/listItem/shouldUseAvatar.ts
|
|
1289
|
-
var shouldUseAvatar = (control, tags) => {
|
|
1290
|
-
var _a;
|
|
1291
|
-
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
1292
|
-
};
|
|
2635
|
+
var import_components23 = require("@transferwise/components");
|
|
1293
2636
|
|
|
1294
2637
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1295
|
-
var
|
|
1296
|
-
var
|
|
1297
|
-
var
|
|
2638
|
+
var import_components22 = require("@transferwise/components");
|
|
2639
|
+
var import_react7 = require("react");
|
|
2640
|
+
var import_react_intl10 = require("react-intl");
|
|
1298
2641
|
|
|
1299
2642
|
// ../renderers/src/messages/filter.messages.ts
|
|
1300
|
-
var
|
|
1301
|
-
var filter_messages_default = (0,
|
|
2643
|
+
var import_react_intl7 = require("react-intl");
|
|
2644
|
+
var filter_messages_default = (0, import_react_intl7.defineMessages)({
|
|
1302
2645
|
placeholder: {
|
|
1303
2646
|
id: "df.wise.filter.placeholder",
|
|
1304
2647
|
defaultMessage: "Start typing to search",
|
|
@@ -1364,12 +2707,12 @@ function filterAndSortDecisionOptions(selectOptions, query) {
|
|
|
1364
2707
|
var normalizeAndRemoveAccents = (text) => text.trim().toLowerCase().normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "");
|
|
1365
2708
|
|
|
1366
2709
|
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
1367
|
-
var
|
|
1368
|
-
var
|
|
2710
|
+
var import_components21 = require("@transferwise/components");
|
|
2711
|
+
var import_react_intl9 = require("react-intl");
|
|
1369
2712
|
|
|
1370
2713
|
// ../renderers/src/messages/group.messages.ts
|
|
1371
|
-
var
|
|
1372
|
-
var group_messages_default = (0,
|
|
2714
|
+
var import_react_intl8 = require("react-intl");
|
|
2715
|
+
var group_messages_default = (0, import_react_intl8.defineMessages)({
|
|
1373
2716
|
all: {
|
|
1374
2717
|
id: "df.wise.group.all",
|
|
1375
2718
|
defaultMessage: "All",
|
|
@@ -1403,19 +2746,19 @@ var getGroupsFromTags = (knownTags, items) => {
|
|
|
1403
2746
|
};
|
|
1404
2747
|
|
|
1405
2748
|
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
1406
|
-
var
|
|
2749
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1407
2750
|
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
1408
2751
|
var isGroupedDecision = (options) => {
|
|
1409
2752
|
return getGroupsFromTags(groupingTags, options).length > 0;
|
|
1410
2753
|
};
|
|
1411
2754
|
var GroupedDecisionList = (_a) => {
|
|
1412
2755
|
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1413
|
-
const { formatMessage } = (0,
|
|
2756
|
+
const { formatMessage } = (0, import_react_intl9.useIntl)();
|
|
1414
2757
|
const { options } = rest;
|
|
1415
2758
|
const itemsByTag = [...getGroupsFromTags(groupingTags, options), { tag: "all", items: options }];
|
|
1416
|
-
return /* @__PURE__ */ (0,
|
|
1417
|
-
/* @__PURE__ */ (0,
|
|
1418
|
-
|
|
2759
|
+
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: [
|
|
2760
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2761
|
+
import_components21.Header,
|
|
1419
2762
|
{
|
|
1420
2763
|
as: "h2",
|
|
1421
2764
|
title: tag in group_messages_default ? formatMessage(group_messages_default[tag]) : tag
|
|
@@ -1426,26 +2769,26 @@ var GroupedDecisionList = (_a) => {
|
|
|
1426
2769
|
};
|
|
1427
2770
|
|
|
1428
2771
|
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1429
|
-
var
|
|
2772
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1430
2773
|
var DecisionWrapper = (props) => {
|
|
1431
|
-
return /* @__PURE__ */ (0,
|
|
1432
|
-
props.title && /* @__PURE__ */ (0,
|
|
1433
|
-
props.control === "filtered" ? /* @__PURE__ */ (0,
|
|
2774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
2775
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components22.Header, { as: "h2", title: props.title }),
|
|
2776
|
+
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
1434
2777
|
] });
|
|
1435
2778
|
};
|
|
1436
2779
|
var UnfilteredDecisionList = (_a) => {
|
|
1437
2780
|
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1438
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0,
|
|
2781
|
+
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
|
|
1439
2782
|
};
|
|
1440
2783
|
var FilteredDecisionList = (props) => {
|
|
1441
|
-
const { formatMessage } = (0,
|
|
1442
|
-
const [query, setQuery] = (0,
|
|
2784
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
2785
|
+
const [query, setQuery] = (0, import_react7.useState)("");
|
|
1443
2786
|
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
1444
2787
|
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
1445
2788
|
const isGrouped = isGroupedDecision(options);
|
|
1446
|
-
return /* @__PURE__ */ (0,
|
|
1447
|
-
/* @__PURE__ */ (0,
|
|
1448
|
-
|
|
2789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
2791
|
+
import_components22.SearchInput,
|
|
1449
2792
|
{
|
|
1450
2793
|
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
1451
2794
|
value: query,
|
|
@@ -1456,25 +2799,25 @@ var FilteredDecisionList = (props) => {
|
|
|
1456
2799
|
}
|
|
1457
2800
|
}
|
|
1458
2801
|
),
|
|
1459
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0,
|
|
1460
|
-
query.length > 0 && /* @__PURE__ */ (0,
|
|
2802
|
+
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
|
|
2803
|
+
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components22.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
1461
2804
|
filteredOptions.length > 0 ? renderDecisionList2({
|
|
1462
2805
|
control,
|
|
1463
2806
|
className: query.length === 0 ? "m-t-3" : "",
|
|
1464
2807
|
options: filteredOptions
|
|
1465
|
-
}) : /* @__PURE__ */ (0,
|
|
2808
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
1466
2809
|
] })
|
|
1467
2810
|
] });
|
|
1468
2811
|
};
|
|
1469
2812
|
|
|
1470
2813
|
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1471
|
-
var
|
|
2814
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1472
2815
|
var DecisionRenderer = {
|
|
1473
2816
|
canRenderType: "decision",
|
|
1474
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2817
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }))
|
|
1475
2818
|
};
|
|
1476
2819
|
var renderDecisionList = ({ options, control }) => {
|
|
1477
|
-
return /* @__PURE__ */ (0,
|
|
2820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: options.map((_a) => {
|
|
1478
2821
|
var _b = _a, { onClick } = _b, rest = __objRest(_b, ["onClick"]);
|
|
1479
2822
|
const {
|
|
1480
2823
|
description,
|
|
@@ -1487,8 +2830,8 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1487
2830
|
supportingValues,
|
|
1488
2831
|
tags
|
|
1489
2832
|
} = rest;
|
|
1490
|
-
return /* @__PURE__ */ (0,
|
|
1491
|
-
|
|
2833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2834
|
+
import_components23.ListItem,
|
|
1492
2835
|
{
|
|
1493
2836
|
title: itemTitle,
|
|
1494
2837
|
subtitle: description,
|
|
@@ -1499,7 +2842,7 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1499
2842
|
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
1500
2843
|
prompt: getInlineAlert(inlineAlert),
|
|
1501
2844
|
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
1502
|
-
control: /* @__PURE__ */ (0,
|
|
2845
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components23.ListItem.Navigation, __spreadValues({}, getAnchorProps()))
|
|
1503
2846
|
},
|
|
1504
2847
|
JSON.stringify(rest)
|
|
1505
2848
|
);
|
|
@@ -1508,8 +2851,8 @@ var renderDecisionList = ({ options, control }) => {
|
|
|
1508
2851
|
var DecisionRenderer_default = DecisionRenderer;
|
|
1509
2852
|
|
|
1510
2853
|
// ../renderers/src/DividerRenderer.tsx
|
|
1511
|
-
var
|
|
1512
|
-
var
|
|
2854
|
+
var import_components24 = require("@transferwise/components");
|
|
2855
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1513
2856
|
var mapControlToLevel = (control) => {
|
|
1514
2857
|
switch (control) {
|
|
1515
2858
|
case "section":
|
|
@@ -1522,16 +2865,16 @@ var mapControlToLevel = (control) => {
|
|
|
1522
2865
|
};
|
|
1523
2866
|
var DividerRenderer = {
|
|
1524
2867
|
canRenderType: "divider",
|
|
1525
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0,
|
|
2868
|
+
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components24.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
1526
2869
|
};
|
|
1527
2870
|
var DividerRenderer_default = DividerRenderer;
|
|
1528
2871
|
|
|
1529
2872
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1530
|
-
var
|
|
2873
|
+
var import_components25 = require("@transferwise/components");
|
|
1531
2874
|
|
|
1532
2875
|
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1533
|
-
var
|
|
1534
|
-
var external_confirmation_messages_default = (0,
|
|
2876
|
+
var import_react_intl11 = require("react-intl");
|
|
2877
|
+
var external_confirmation_messages_default = (0, import_react_intl11.defineMessages)({
|
|
1535
2878
|
title: {
|
|
1536
2879
|
id: "df.wise.ExternalConfirmation.title",
|
|
1537
2880
|
defaultMessage: "Please confirm",
|
|
@@ -1555,9 +2898,9 @@ var external_confirmation_messages_default = (0, import_react_intl9.defineMessag
|
|
|
1555
2898
|
});
|
|
1556
2899
|
|
|
1557
2900
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1558
|
-
var
|
|
1559
|
-
var
|
|
1560
|
-
var
|
|
2901
|
+
var import_react_intl12 = require("react-intl");
|
|
2902
|
+
var import_react8 = require("react");
|
|
2903
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1561
2904
|
var ExternalConfirmationRenderer = {
|
|
1562
2905
|
canRenderType: "external-confirmation",
|
|
1563
2906
|
render: ExternalConfirmationRendererComponent
|
|
@@ -1568,20 +2911,20 @@ function ExternalConfirmationRendererComponent({
|
|
|
1568
2911
|
open,
|
|
1569
2912
|
onCancel
|
|
1570
2913
|
}) {
|
|
1571
|
-
const { formatMessage } = (0,
|
|
1572
|
-
(0,
|
|
2914
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
2915
|
+
(0, import_react8.useEffect)(() => {
|
|
1573
2916
|
open();
|
|
1574
2917
|
}, []);
|
|
1575
|
-
return /* @__PURE__ */ (0,
|
|
1576
|
-
|
|
2918
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2919
|
+
import_components25.Modal,
|
|
1577
2920
|
{
|
|
1578
2921
|
open: visible,
|
|
1579
2922
|
title: formatMessage(external_confirmation_messages_default.title),
|
|
1580
|
-
body: /* @__PURE__ */ (0,
|
|
1581
|
-
/* @__PURE__ */ (0,
|
|
1582
|
-
/* @__PURE__ */ (0,
|
|
1583
|
-
/* @__PURE__ */ (0,
|
|
1584
|
-
|
|
2923
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2924
|
+
/* @__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) }) }),
|
|
2925
|
+
/* @__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: [
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2927
|
+
import_components25.Button,
|
|
1585
2928
|
{
|
|
1586
2929
|
v2: true,
|
|
1587
2930
|
block: true,
|
|
@@ -1594,7 +2937,7 @@ function ExternalConfirmationRendererComponent({
|
|
|
1594
2937
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
1595
2938
|
}
|
|
1596
2939
|
),
|
|
1597
|
-
/* @__PURE__ */ (0,
|
|
2940
|
+
/* @__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) })
|
|
1598
2941
|
] }) })
|
|
1599
2942
|
] }),
|
|
1600
2943
|
onClose: onCancel
|
|
@@ -1611,46 +2954,46 @@ function getOrigin(url) {
|
|
|
1611
2954
|
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1612
2955
|
|
|
1613
2956
|
// ../renderers/src/FormRenderer.tsx
|
|
1614
|
-
var
|
|
2957
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1615
2958
|
var FormRenderer = {
|
|
1616
2959
|
canRenderType: "form",
|
|
1617
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0,
|
|
2960
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: getMargin(margin), children })
|
|
1618
2961
|
};
|
|
1619
2962
|
var FormRenderer_default = FormRenderer;
|
|
1620
2963
|
|
|
1621
2964
|
// ../renderers/src/FormSectionRenderer.tsx
|
|
1622
|
-
var
|
|
1623
|
-
var
|
|
2965
|
+
var import_components26 = require("@transferwise/components");
|
|
2966
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1624
2967
|
var FormSectionRenderer = {
|
|
1625
2968
|
canRenderType: "form-section",
|
|
1626
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0,
|
|
1627
|
-
title && /* @__PURE__ */ (0,
|
|
1628
|
-
|
|
2969
|
+
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("fieldset", { children: [
|
|
2970
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2971
|
+
import_components26.Header,
|
|
1629
2972
|
{
|
|
1630
2973
|
as: "h2",
|
|
1631
2974
|
title
|
|
1632
2975
|
}
|
|
1633
2976
|
),
|
|
1634
|
-
description && /* @__PURE__ */ (0,
|
|
2977
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("p", { children: description }),
|
|
1635
2978
|
children
|
|
1636
2979
|
] })
|
|
1637
2980
|
};
|
|
1638
2981
|
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1639
2982
|
|
|
1640
2983
|
// ../renderers/src/HeadingRenderer.tsx
|
|
1641
|
-
var
|
|
1642
|
-
var
|
|
2984
|
+
var import_components27 = require("@transferwise/components");
|
|
2985
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1643
2986
|
var HeadingRenderer = {
|
|
1644
2987
|
canRenderType: "heading",
|
|
1645
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2988
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Heading, __spreadValues({}, props))
|
|
1646
2989
|
};
|
|
1647
2990
|
function Heading(props) {
|
|
1648
2991
|
const { text, size, align, margin, control } = props;
|
|
1649
2992
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1650
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
2993
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(StandardHeading, { size, text, className });
|
|
1651
2994
|
}
|
|
1652
2995
|
function DisplayHeading({ size, text, className }) {
|
|
1653
|
-
return /* @__PURE__ */ (0,
|
|
2996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components27.Display, { type: getDisplayType(size), className, children: text });
|
|
1654
2997
|
}
|
|
1655
2998
|
var getDisplayType = (size) => {
|
|
1656
2999
|
switch (size) {
|
|
@@ -1666,7 +3009,7 @@ var getDisplayType = (size) => {
|
|
|
1666
3009
|
}
|
|
1667
3010
|
};
|
|
1668
3011
|
function StandardHeading({ size, text, className }) {
|
|
1669
|
-
return /* @__PURE__ */ (0,
|
|
3012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components27.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1670
3013
|
}
|
|
1671
3014
|
var getTitleTypeBySize = (size) => {
|
|
1672
3015
|
var _a;
|
|
@@ -1682,8 +3025,8 @@ var getTitleTypeBySize = (size) => {
|
|
|
1682
3025
|
var HeadingRenderer_default = HeadingRenderer;
|
|
1683
3026
|
|
|
1684
3027
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1685
|
-
var
|
|
1686
|
-
var
|
|
3028
|
+
var import_components28 = require("@transferwise/components");
|
|
3029
|
+
var import_react9 = require("react");
|
|
1687
3030
|
|
|
1688
3031
|
// ../renderers/src/utils/api-utils.ts
|
|
1689
3032
|
function isRelativePath(url = "") {
|
|
@@ -1693,7 +3036,7 @@ function isRelativePath(url = "") {
|
|
|
1693
3036
|
}
|
|
1694
3037
|
|
|
1695
3038
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1696
|
-
var
|
|
3039
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1697
3040
|
function UrlImage({
|
|
1698
3041
|
accessibilityDescription,
|
|
1699
3042
|
align,
|
|
@@ -1702,14 +3045,14 @@ function UrlImage({
|
|
|
1702
3045
|
uri,
|
|
1703
3046
|
httpClient
|
|
1704
3047
|
}) {
|
|
1705
|
-
const [imageSource, setImageSource] = (0,
|
|
1706
|
-
(0,
|
|
3048
|
+
const [imageSource, setImageSource] = (0, import_react9.useState)("");
|
|
3049
|
+
(0, import_react9.useEffect)(() => {
|
|
1707
3050
|
if (!uri.startsWith("urn:")) {
|
|
1708
3051
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1709
3052
|
}
|
|
1710
3053
|
}, [uri, httpClient]);
|
|
1711
|
-
return /* @__PURE__ */ (0,
|
|
1712
|
-
|
|
3054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3055
|
+
import_components28.Image,
|
|
1713
3056
|
{
|
|
1714
3057
|
className: "df-reserve-space",
|
|
1715
3058
|
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
@@ -1752,7 +3095,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1752
3095
|
};
|
|
1753
3096
|
|
|
1754
3097
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1755
|
-
var
|
|
3098
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1756
3099
|
var maxFlagSize = 600;
|
|
1757
3100
|
function UrnFlagImage({
|
|
1758
3101
|
accessibilityDescription,
|
|
@@ -1761,12 +3104,12 @@ function UrnFlagImage({
|
|
|
1761
3104
|
size,
|
|
1762
3105
|
uri
|
|
1763
3106
|
}) {
|
|
1764
|
-
return /* @__PURE__ */ (0,
|
|
3107
|
+
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 }) });
|
|
1765
3108
|
}
|
|
1766
3109
|
|
|
1767
3110
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1768
3111
|
var import_art4 = require("@wise/art");
|
|
1769
|
-
var
|
|
3112
|
+
var import_react11 = require("react");
|
|
1770
3113
|
|
|
1771
3114
|
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1772
3115
|
var isAnimated = (uri) => {
|
|
@@ -1776,9 +3119,9 @@ var isAnimated = (uri) => {
|
|
|
1776
3119
|
|
|
1777
3120
|
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1778
3121
|
var import_art3 = require("@wise/art");
|
|
1779
|
-
var
|
|
1780
|
-
var
|
|
1781
|
-
var Illustration3DErrorBoundary = class extends
|
|
3122
|
+
var import_react10 = require("react");
|
|
3123
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3124
|
+
var Illustration3DErrorBoundary = class extends import_react10.Component {
|
|
1782
3125
|
constructor(props) {
|
|
1783
3126
|
super(props);
|
|
1784
3127
|
this.state = { hasError: false };
|
|
@@ -1801,12 +3144,12 @@ var SafeIllustration3D = ({
|
|
|
1801
3144
|
size,
|
|
1802
3145
|
onError
|
|
1803
3146
|
}) => {
|
|
1804
|
-
return /* @__PURE__ */ (0,
|
|
3147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
1805
3148
|
};
|
|
1806
3149
|
var SafeIllustration3D_default = SafeIllustration3D;
|
|
1807
3150
|
|
|
1808
3151
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1809
|
-
var
|
|
3152
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1810
3153
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1811
3154
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1812
3155
|
function UrnIllustration({
|
|
@@ -1816,12 +3159,12 @@ function UrnIllustration({
|
|
|
1816
3159
|
size,
|
|
1817
3160
|
uri
|
|
1818
3161
|
}) {
|
|
1819
|
-
const [has3DFailed, setHas3DFailed] = (0,
|
|
3162
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react11.useState)(false);
|
|
1820
3163
|
const illustrationSize = getIllustrationSize(size);
|
|
1821
3164
|
const illustrationName = getIllustrationName(uri);
|
|
1822
3165
|
const illustration3DName = getIllustration3DName(uri);
|
|
1823
3166
|
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
1824
|
-
return /* @__PURE__ */ (0,
|
|
3167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1825
3168
|
SafeIllustration3D_default,
|
|
1826
3169
|
{
|
|
1827
3170
|
name: illustration3DName,
|
|
@@ -1830,7 +3173,7 @@ function UrnIllustration({
|
|
|
1830
3173
|
}
|
|
1831
3174
|
) });
|
|
1832
3175
|
}
|
|
1833
|
-
return /* @__PURE__ */ (0,
|
|
3176
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1834
3177
|
import_art4.Illustration,
|
|
1835
3178
|
{
|
|
1836
3179
|
className: "df-illustration",
|
|
@@ -1850,32 +3193,32 @@ var getIllustration3DName = (uri) => {
|
|
|
1850
3193
|
};
|
|
1851
3194
|
|
|
1852
3195
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1853
|
-
var
|
|
3196
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1854
3197
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1855
3198
|
function UrnImage(props) {
|
|
1856
3199
|
const { uri } = props;
|
|
1857
3200
|
if (isUrnIllustration(uri)) {
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
3201
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1859
3202
|
}
|
|
1860
3203
|
if (isUrnFlag(uri)) {
|
|
1861
|
-
return /* @__PURE__ */ (0,
|
|
3204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1862
3205
|
}
|
|
1863
3206
|
return null;
|
|
1864
3207
|
}
|
|
1865
3208
|
|
|
1866
3209
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1867
|
-
var
|
|
3210
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
1868
3211
|
var ImageRenderer = {
|
|
1869
3212
|
canRenderType: "image",
|
|
1870
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0,
|
|
3213
|
+
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(UrlImage, __spreadValues({}, props))
|
|
1871
3214
|
};
|
|
1872
3215
|
|
|
1873
3216
|
// ../renderers/src/ImageRenderer/index.tsx
|
|
1874
3217
|
var ImageRenderer_default = ImageRenderer;
|
|
1875
3218
|
|
|
1876
3219
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1877
|
-
var
|
|
1878
|
-
var
|
|
3220
|
+
var import_components29 = require("@transferwise/components");
|
|
3221
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
1879
3222
|
var doContext = ["positive", "neutral"];
|
|
1880
3223
|
var dontContext = ["warning", "negative"];
|
|
1881
3224
|
var InstructionsRenderer = {
|
|
@@ -1883,16 +3226,16 @@ var InstructionsRenderer = {
|
|
|
1883
3226
|
render: ({ items, margin, title }) => {
|
|
1884
3227
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1885
3228
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1886
|
-
return /* @__PURE__ */ (0,
|
|
1887
|
-
title ? /* @__PURE__ */ (0,
|
|
1888
|
-
/* @__PURE__ */ (0,
|
|
3229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getMargin(margin), children: [
|
|
3230
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components29.Header, { title }) : null,
|
|
3231
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components29.InstructionsList, { dos, donts })
|
|
1889
3232
|
] });
|
|
1890
3233
|
}
|
|
1891
3234
|
};
|
|
1892
3235
|
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1893
3236
|
|
|
1894
3237
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1895
|
-
var
|
|
3238
|
+
var import_components30 = require("@transferwise/components");
|
|
1896
3239
|
|
|
1897
3240
|
// ../renderers/src/utils/input-utils.ts
|
|
1898
3241
|
var onWheel = (event) => {
|
|
@@ -1917,7 +3260,7 @@ function pick(obj, ...keys) {
|
|
|
1917
3260
|
}
|
|
1918
3261
|
|
|
1919
3262
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1920
|
-
var
|
|
3263
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
1921
3264
|
var IntegerInputRenderer = {
|
|
1922
3265
|
canRenderType: "input-integer",
|
|
1923
3266
|
render: (props) => {
|
|
@@ -1932,7 +3275,7 @@ var IntegerInputRenderer = {
|
|
|
1932
3275
|
"maximum",
|
|
1933
3276
|
"minimum"
|
|
1934
3277
|
);
|
|
1935
|
-
return /* @__PURE__ */ (0,
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
1936
3279
|
FieldInput_default,
|
|
1937
3280
|
{
|
|
1938
3281
|
id,
|
|
@@ -1943,8 +3286,8 @@ var IntegerInputRenderer = {
|
|
|
1943
3286
|
loadingState: props.fieldLoadingState,
|
|
1944
3287
|
help,
|
|
1945
3288
|
features: props.features,
|
|
1946
|
-
children: /* @__PURE__ */ (0,
|
|
1947
|
-
|
|
3289
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components30.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
3290
|
+
import_components30.Input,
|
|
1948
3291
|
__spreadValues({
|
|
1949
3292
|
id,
|
|
1950
3293
|
name: id,
|
|
@@ -1966,39 +3309,12 @@ var IntegerInputRenderer = {
|
|
|
1966
3309
|
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
1967
3310
|
|
|
1968
3311
|
// ../renderers/src/ListRenderer.tsx
|
|
1969
|
-
var
|
|
1970
|
-
|
|
1971
|
-
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
1972
|
-
var import_components24 = require("@transferwise/components");
|
|
1973
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1974
|
-
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
1975
|
-
if (!callToAction) {
|
|
1976
|
-
return void 0;
|
|
1977
|
-
}
|
|
1978
|
-
const { accessibilityDescription, title, context } = callToAction;
|
|
1979
|
-
const { priority, sentiment } = getPriorityAndSentiment(ctaSecondary, context);
|
|
1980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1981
|
-
import_components24.ListItem.Button,
|
|
1982
|
-
__spreadProps(__spreadValues({}, callToAction.getAnchorProps()), {
|
|
1983
|
-
partiallyInteractive: !fullyInteractive,
|
|
1984
|
-
priority,
|
|
1985
|
-
"aria-description": accessibilityDescription,
|
|
1986
|
-
sentiment,
|
|
1987
|
-
children: title
|
|
1988
|
-
})
|
|
1989
|
-
);
|
|
1990
|
-
};
|
|
1991
|
-
var getPriorityAndSentiment = (ctaSecondary, context) => {
|
|
1992
|
-
if (context === "negative") {
|
|
1993
|
-
return { priority: "secondary", sentiment: "negative" };
|
|
1994
|
-
}
|
|
1995
|
-
return { priority: ctaSecondary ? "secondary" : "secondary-neutral", sentiment: "default" };
|
|
1996
|
-
};
|
|
3312
|
+
var import_components32 = require("@transferwise/components");
|
|
1997
3313
|
|
|
1998
3314
|
// ../renderers/src/components/Header.tsx
|
|
1999
|
-
var
|
|
2000
|
-
var
|
|
2001
|
-
var
|
|
3315
|
+
var import_components31 = require("@transferwise/components");
|
|
3316
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3317
|
+
var Header = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components31.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) });
|
|
2002
3318
|
var getHeaderAction = (callToAction) => {
|
|
2003
3319
|
if (!callToAction) {
|
|
2004
3320
|
return void 0;
|
|
@@ -2010,11 +3326,11 @@ var getHeaderAction = (callToAction) => {
|
|
|
2010
3326
|
};
|
|
2011
3327
|
|
|
2012
3328
|
// ../renderers/src/ListRenderer.tsx
|
|
2013
|
-
var
|
|
3329
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2014
3330
|
var ListRenderer = {
|
|
2015
3331
|
canRenderType: "list",
|
|
2016
|
-
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0,
|
|
2017
|
-
/* @__PURE__ */ (0,
|
|
3332
|
+
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getMargin(margin), children: [
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Header, { title, callToAction }),
|
|
2018
3334
|
items.map((item) => {
|
|
2019
3335
|
var _a, _b;
|
|
2020
3336
|
const {
|
|
@@ -2031,8 +3347,8 @@ var ListRenderer = {
|
|
|
2031
3347
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
2032
3348
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
2033
3349
|
};
|
|
2034
|
-
return /* @__PURE__ */ (0,
|
|
2035
|
-
|
|
3350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3351
|
+
import_components32.ListItem,
|
|
2036
3352
|
{
|
|
2037
3353
|
title: itemTitle,
|
|
2038
3354
|
subtitle: description,
|
|
@@ -2051,12 +3367,12 @@ var ListRenderer = {
|
|
|
2051
3367
|
var ListRenderer_default = ListRenderer;
|
|
2052
3368
|
|
|
2053
3369
|
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
2054
|
-
var
|
|
2055
|
-
var
|
|
3370
|
+
var import_components33 = require("@transferwise/components");
|
|
3371
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2056
3372
|
var LoadingIndicatorRenderer = {
|
|
2057
3373
|
canRenderType: "loading-indicator",
|
|
2058
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0,
|
|
2059
|
-
|
|
3374
|
+
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3375
|
+
import_components33.Loader,
|
|
2060
3376
|
{
|
|
2061
3377
|
size,
|
|
2062
3378
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
@@ -2067,13 +3383,13 @@ var LoadingIndicatorRenderer = {
|
|
|
2067
3383
|
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
2068
3384
|
|
|
2069
3385
|
// ../renderers/src/MarkdownRenderer.tsx
|
|
2070
|
-
var
|
|
3386
|
+
var import_components34 = require("@transferwise/components");
|
|
2071
3387
|
var import_classnames4 = __toESM(require_classnames());
|
|
2072
|
-
var
|
|
3388
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2073
3389
|
var MarkdownRenderer = {
|
|
2074
3390
|
canRenderType: "markdown",
|
|
2075
|
-
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0,
|
|
2076
|
-
|
|
3391
|
+
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
3392
|
+
import_components34.Markdown,
|
|
2077
3393
|
{
|
|
2078
3394
|
className: (0, import_classnames4.default)(
|
|
2079
3395
|
"df-markdown",
|
|
@@ -2087,16 +3403,16 @@ var MarkdownRenderer = {
|
|
|
2087
3403
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
2088
3404
|
|
|
2089
3405
|
// ../renderers/src/MediaRenderer.tsx
|
|
2090
|
-
var
|
|
3406
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2091
3407
|
var MediaRenderer = {
|
|
2092
3408
|
canRenderType: "media",
|
|
2093
3409
|
render: (_a) => {
|
|
2094
3410
|
var _b = _a, { media } = _b, rest = __objRest(_b, ["media"]);
|
|
2095
3411
|
switch (media.type) {
|
|
2096
3412
|
case "avatar":
|
|
2097
|
-
return /* @__PURE__ */ (0,
|
|
3413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(AvatarMediaRendererComponent, __spreadValues({ media }, rest));
|
|
2098
3414
|
case "image":
|
|
2099
|
-
return /* @__PURE__ */ (0,
|
|
3415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ImageMediaRendererComponent, __spreadValues({ media }, rest));
|
|
2100
3416
|
case "legacy":
|
|
2101
3417
|
return null;
|
|
2102
3418
|
}
|
|
@@ -2108,7 +3424,7 @@ var AvatarMediaRendererComponent = ({
|
|
|
2108
3424
|
margin,
|
|
2109
3425
|
size
|
|
2110
3426
|
}) => {
|
|
2111
|
-
return /* @__PURE__ */ (0,
|
|
3427
|
+
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) }) });
|
|
2112
3428
|
};
|
|
2113
3429
|
var ImageMediaRendererComponent = (_a) => {
|
|
2114
3430
|
var _b = _a, {
|
|
@@ -2116,7 +3432,7 @@ var ImageMediaRendererComponent = (_a) => {
|
|
|
2116
3432
|
} = _b, rest = __objRest(_b, [
|
|
2117
3433
|
"media"
|
|
2118
3434
|
]);
|
|
2119
|
-
return isUrnImage(media.uri) ? /* @__PURE__ */ (0,
|
|
3435
|
+
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));
|
|
2120
3436
|
};
|
|
2121
3437
|
var mapAvatarMediaSize = (size) => {
|
|
2122
3438
|
switch (size) {
|
|
@@ -2134,21 +3450,21 @@ var mapAvatarMediaSize = (size) => {
|
|
|
2134
3450
|
};
|
|
2135
3451
|
|
|
2136
3452
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
2137
|
-
var
|
|
2138
|
-
var
|
|
2139
|
-
var
|
|
3453
|
+
var import_components35 = require("@transferwise/components");
|
|
3454
|
+
var import_react12 = require("react");
|
|
3455
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2140
3456
|
var ModalLayoutRenderer = {
|
|
2141
3457
|
canRenderType: "modal-layout",
|
|
2142
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
3458
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DFModal, __spreadValues({}, props))
|
|
2143
3459
|
};
|
|
2144
3460
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
2145
3461
|
function DFModal({ content, margin, trigger }) {
|
|
2146
|
-
const [visible, setVisible] = (0,
|
|
3462
|
+
const [visible, setVisible] = (0, import_react12.useState)(false);
|
|
2147
3463
|
const { children, title } = content;
|
|
2148
|
-
return /* @__PURE__ */ (0,
|
|
2149
|
-
/* @__PURE__ */ (0,
|
|
2150
|
-
/* @__PURE__ */ (0,
|
|
2151
|
-
|
|
3464
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: getMargin(margin), children: [
|
|
3465
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components35.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
3466
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3467
|
+
import_components35.Modal,
|
|
2152
3468
|
{
|
|
2153
3469
|
scroll: "content",
|
|
2154
3470
|
open: visible,
|
|
@@ -2162,20 +3478,20 @@ function DFModal({ content, margin, trigger }) {
|
|
|
2162
3478
|
}
|
|
2163
3479
|
|
|
2164
3480
|
// ../renderers/src/ModalRenderer.tsx
|
|
2165
|
-
var
|
|
2166
|
-
var
|
|
3481
|
+
var import_components36 = require("@transferwise/components");
|
|
3482
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2167
3483
|
var ModalRenderer = {
|
|
2168
3484
|
canRenderType: "modal",
|
|
2169
3485
|
render: ({ title, children, open, onClose }) => {
|
|
2170
|
-
return /* @__PURE__ */ (0,
|
|
3486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components36.Modal, { open, title, body: children, onClose });
|
|
2171
3487
|
}
|
|
2172
3488
|
};
|
|
2173
3489
|
|
|
2174
3490
|
// ../renderers/src/MoneyInputRenderer.tsx
|
|
2175
|
-
var
|
|
2176
|
-
var
|
|
2177
|
-
var
|
|
2178
|
-
var
|
|
3491
|
+
var import_components37 = require("@transferwise/components");
|
|
3492
|
+
var import_react13 = require("react");
|
|
3493
|
+
var import_react_intl13 = require("react-intl");
|
|
3494
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2179
3495
|
var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
2180
3496
|
var MoneyInputRenderer = {
|
|
2181
3497
|
canRenderType: "money-input",
|
|
@@ -2196,13 +3512,13 @@ function MoneyInputRendererComponent(props) {
|
|
|
2196
3512
|
onAmountChange,
|
|
2197
3513
|
onCurrencyChange
|
|
2198
3514
|
} = props;
|
|
2199
|
-
(0,
|
|
3515
|
+
(0, import_react13.useEffect)(() => {
|
|
2200
3516
|
if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
|
|
2201
3517
|
onCurrencyChange(0);
|
|
2202
3518
|
}
|
|
2203
3519
|
}, [selectedCurrencyIndex, onCurrencyChange, currencies.length]);
|
|
2204
|
-
const { formatMessage } = (0,
|
|
2205
|
-
return /* @__PURE__ */ (0,
|
|
3520
|
+
const { formatMessage } = (0, import_react_intl13.useIntl)();
|
|
3521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2206
3522
|
FieldInput_default,
|
|
2207
3523
|
{
|
|
2208
3524
|
id: uid,
|
|
@@ -2211,8 +3527,8 @@ function MoneyInputRendererComponent(props) {
|
|
|
2211
3527
|
validation: validationState,
|
|
2212
3528
|
help,
|
|
2213
3529
|
features: props.features,
|
|
2214
|
-
children: /* @__PURE__ */ (0,
|
|
2215
|
-
|
|
3530
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3531
|
+
import_components37.MoneyInput,
|
|
2216
3532
|
{
|
|
2217
3533
|
amount: parseFloatOrNull(amountValue),
|
|
2218
3534
|
searchPlaceholder: "",
|
|
@@ -2273,8 +3589,8 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
2273
3589
|
}
|
|
2274
3590
|
|
|
2275
3591
|
// ../renderers/src/MultiSelectInputRenderer/InlineComponent.tsx
|
|
2276
|
-
var
|
|
2277
|
-
var
|
|
3592
|
+
var import_components38 = require("@transferwise/components");
|
|
3593
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2278
3594
|
function InlineComponent(props) {
|
|
2279
3595
|
const {
|
|
2280
3596
|
id,
|
|
@@ -2288,7 +3604,7 @@ function InlineComponent(props) {
|
|
|
2288
3604
|
validationState,
|
|
2289
3605
|
onSelect
|
|
2290
3606
|
} = props;
|
|
2291
|
-
return /* @__PURE__ */ (0,
|
|
3607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2292
3608
|
FieldInput_default,
|
|
2293
3609
|
{
|
|
2294
3610
|
id,
|
|
@@ -2310,8 +3626,8 @@ function InlineComponent(props) {
|
|
|
2310
3626
|
childrenProps
|
|
2311
3627
|
} = option;
|
|
2312
3628
|
const key = (_a = childrenProps == null ? void 0 : childrenProps.uid) != null ? _a : index;
|
|
2313
|
-
return /* @__PURE__ */ (0,
|
|
2314
|
-
|
|
3629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3630
|
+
import_components38.ListItem,
|
|
2315
3631
|
{
|
|
2316
3632
|
title: itemTitle,
|
|
2317
3633
|
subtitle,
|
|
@@ -2319,10 +3635,10 @@ function InlineComponent(props) {
|
|
|
2319
3635
|
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
2320
3636
|
media: getMedia(media, false),
|
|
2321
3637
|
prompt: getInlineAlert(inlineAlert),
|
|
2322
|
-
additionalInfo: additionalText ? /* @__PURE__ */ (0,
|
|
3638
|
+
additionalInfo: additionalText ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components38.ListItem.AdditionalInfo, { children: additionalText }) : void 0,
|
|
2323
3639
|
disabled: disabled || optionDisabled,
|
|
2324
|
-
control: /* @__PURE__ */ (0,
|
|
2325
|
-
|
|
3640
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3641
|
+
import_components38.ListItem.Checkbox,
|
|
2326
3642
|
{
|
|
2327
3643
|
checked: selectedIndices.includes(index),
|
|
2328
3644
|
onChange: (e) => {
|
|
@@ -2340,13 +3656,13 @@ function InlineComponent(props) {
|
|
|
2340
3656
|
}
|
|
2341
3657
|
|
|
2342
3658
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
2343
|
-
var
|
|
2344
|
-
var
|
|
2345
|
-
var
|
|
3659
|
+
var import_components39 = require("@transferwise/components");
|
|
3660
|
+
var import_react14 = require("react");
|
|
3661
|
+
var import_react_intl15 = require("react-intl");
|
|
2346
3662
|
|
|
2347
3663
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
2348
|
-
var
|
|
2349
|
-
var multi_select_messages_default = (0,
|
|
3664
|
+
var import_react_intl14 = require("react-intl");
|
|
3665
|
+
var multi_select_messages_default = (0, import_react_intl14.defineMessages)({
|
|
2350
3666
|
summary: {
|
|
2351
3667
|
id: "df.wise.MultiSelect.summary",
|
|
2352
3668
|
defaultMessage: "{first} and {count} more",
|
|
@@ -2355,10 +3671,10 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
2355
3671
|
});
|
|
2356
3672
|
|
|
2357
3673
|
// ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
|
|
2358
|
-
var
|
|
3674
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2359
3675
|
function DefaultComponent(props) {
|
|
2360
|
-
const { formatMessage } = (0,
|
|
2361
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
3676
|
+
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
3677
|
+
const [stagedIndices, setStagedIndices] = (0, import_react14.useState)();
|
|
2362
3678
|
const {
|
|
2363
3679
|
id,
|
|
2364
3680
|
autoComplete,
|
|
@@ -2397,12 +3713,12 @@ function DefaultComponent(props) {
|
|
|
2397
3713
|
const contentProps = {
|
|
2398
3714
|
title: option.title,
|
|
2399
3715
|
description: option.description,
|
|
2400
|
-
icon: /* @__PURE__ */ (0,
|
|
3716
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2401
3717
|
};
|
|
2402
|
-
return /* @__PURE__ */ (0,
|
|
3718
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components39.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2403
3719
|
};
|
|
2404
3720
|
const extraProps = { autoComplete };
|
|
2405
|
-
return /* @__PURE__ */ (0,
|
|
3721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2406
3722
|
FieldInput_default,
|
|
2407
3723
|
{
|
|
2408
3724
|
id,
|
|
@@ -2411,8 +3727,8 @@ function DefaultComponent(props) {
|
|
|
2411
3727
|
description,
|
|
2412
3728
|
validation: validationState,
|
|
2413
3729
|
features,
|
|
2414
|
-
children: /* @__PURE__ */ (0,
|
|
2415
|
-
|
|
3730
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3731
|
+
import_components39.SelectInput,
|
|
2416
3732
|
__spreadValues({
|
|
2417
3733
|
id,
|
|
2418
3734
|
items: options.map((option, index) => {
|
|
@@ -2450,8 +3766,8 @@ function DefaultComponent(props) {
|
|
|
2450
3766
|
}
|
|
2451
3767
|
|
|
2452
3768
|
// ../renderers/src/MultiSelectInputRenderer/InlineCheckboxComponent.tsx
|
|
2453
|
-
var
|
|
2454
|
-
var
|
|
3769
|
+
var import_components40 = require("@transferwise/components");
|
|
3770
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
2455
3771
|
function InlineCheckboxComponent(props) {
|
|
2456
3772
|
const {
|
|
2457
3773
|
id,
|
|
@@ -2465,7 +3781,7 @@ function InlineCheckboxComponent(props) {
|
|
|
2465
3781
|
validationState,
|
|
2466
3782
|
onSelect
|
|
2467
3783
|
} = props;
|
|
2468
|
-
return /* @__PURE__ */ (0,
|
|
3784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
2469
3785
|
FieldInput_default,
|
|
2470
3786
|
{
|
|
2471
3787
|
id,
|
|
@@ -2494,35 +3810,35 @@ function InlineCheckboxComponent(props) {
|
|
|
2494
3810
|
onSelect(newSelectedIndices);
|
|
2495
3811
|
}
|
|
2496
3812
|
};
|
|
2497
|
-
return /* @__PURE__ */ (0,
|
|
3813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_components40.Checkbox, __spreadProps(__spreadValues({}, checkboxProps), { className: "m-t-1" }), key);
|
|
2498
3814
|
})
|
|
2499
3815
|
}
|
|
2500
3816
|
);
|
|
2501
3817
|
}
|
|
2502
3818
|
|
|
2503
3819
|
// ../renderers/src/MultiSelectInputRenderer/MultiSelectInputRenderer.tsx
|
|
2504
|
-
var
|
|
3820
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
2505
3821
|
var MultiSelectInputRenderer = {
|
|
2506
3822
|
canRenderType: "input-multi-select",
|
|
2507
3823
|
render: (props) => {
|
|
2508
3824
|
switch (props.control) {
|
|
2509
3825
|
case "inline":
|
|
2510
|
-
return /* @__PURE__ */ (0,
|
|
3826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InlineComponent, __spreadValues({}, props));
|
|
2511
3827
|
case "inline-checkbox-group":
|
|
2512
|
-
return /* @__PURE__ */ (0,
|
|
3828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InlineCheckboxComponent, __spreadValues({}, props));
|
|
2513
3829
|
default:
|
|
2514
|
-
return /* @__PURE__ */ (0,
|
|
3830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DefaultComponent, __spreadValues({}, props));
|
|
2515
3831
|
}
|
|
2516
3832
|
}
|
|
2517
3833
|
};
|
|
2518
3834
|
|
|
2519
3835
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
2520
|
-
var
|
|
3836
|
+
var import_components42 = require("@transferwise/components");
|
|
2521
3837
|
|
|
2522
3838
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
2523
|
-
var
|
|
3839
|
+
var import_components41 = require("@transferwise/components");
|
|
2524
3840
|
var import_classnames5 = __toESM(require_classnames());
|
|
2525
|
-
var
|
|
3841
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
2526
3842
|
function UploadFieldInput({
|
|
2527
3843
|
id,
|
|
2528
3844
|
children,
|
|
@@ -2532,10 +3848,10 @@ function UploadFieldInput({
|
|
|
2532
3848
|
validation,
|
|
2533
3849
|
features
|
|
2534
3850
|
}) {
|
|
2535
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
3851
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
2536
3852
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2537
3853
|
const { ref } = useScrollToError(validation, features);
|
|
2538
|
-
return /* @__PURE__ */ (0,
|
|
3854
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
2539
3855
|
"div",
|
|
2540
3856
|
{
|
|
2541
3857
|
ref,
|
|
@@ -2543,9 +3859,9 @@ function UploadFieldInput({
|
|
|
2543
3859
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
2544
3860
|
}),
|
|
2545
3861
|
children: [
|
|
2546
|
-
/* @__PURE__ */ (0,
|
|
3862
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
2547
3863
|
children,
|
|
2548
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0,
|
|
3864
|
+
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components41.InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
2549
3865
|
]
|
|
2550
3866
|
}
|
|
2551
3867
|
);
|
|
@@ -2580,7 +3896,7 @@ var getSizeLimit = (maxSize) => {
|
|
|
2580
3896
|
};
|
|
2581
3897
|
|
|
2582
3898
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
2583
|
-
var
|
|
3899
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
2584
3900
|
var MultiUploadInputRenderer = {
|
|
2585
3901
|
canRenderType: "input-upload-multi",
|
|
2586
3902
|
render: (props) => {
|
|
@@ -2606,7 +3922,7 @@ var MultiUploadInputRenderer = {
|
|
|
2606
3922
|
};
|
|
2607
3923
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
2608
3924
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2609
|
-
return /* @__PURE__ */ (0,
|
|
3925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
2610
3926
|
UploadFieldInput_default,
|
|
2611
3927
|
{
|
|
2612
3928
|
id,
|
|
@@ -2615,8 +3931,8 @@ var MultiUploadInputRenderer = {
|
|
|
2615
3931
|
validation: validationState,
|
|
2616
3932
|
help,
|
|
2617
3933
|
features,
|
|
2618
|
-
children: /* @__PURE__ */ (0,
|
|
2619
|
-
|
|
3934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
3935
|
+
import_components42.UploadInput,
|
|
2620
3936
|
{
|
|
2621
3937
|
id,
|
|
2622
3938
|
"aria-describedby": descriptionId,
|
|
@@ -2625,7 +3941,7 @@ var MultiUploadInputRenderer = {
|
|
|
2625
3941
|
files: value.map(({ id: id2, file, validationState: validationState2 }) => ({
|
|
2626
3942
|
id: id2,
|
|
2627
3943
|
filename: file.name,
|
|
2628
|
-
status: (validationState2 == null ? void 0 : validationState2.status) === "invalid" ?
|
|
3944
|
+
status: (validationState2 == null ? void 0 : validationState2.status) === "invalid" ? import_components42.Status.FAILED : import_components42.Status.SUCCEEDED
|
|
2629
3945
|
})),
|
|
2630
3946
|
fileTypes: acceptsToFileTypes(accepts),
|
|
2631
3947
|
maxFiles: maxItems,
|
|
@@ -2643,8 +3959,8 @@ var MultiUploadInputRenderer = {
|
|
|
2643
3959
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
2644
3960
|
|
|
2645
3961
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
2646
|
-
var
|
|
2647
|
-
var
|
|
3962
|
+
var import_components43 = require("@transferwise/components");
|
|
3963
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
2648
3964
|
var NumberInputRenderer = {
|
|
2649
3965
|
canRenderType: "input-number",
|
|
2650
3966
|
render: (props) => {
|
|
@@ -2658,7 +3974,7 @@ var NumberInputRenderer = {
|
|
|
2658
3974
|
"maximum",
|
|
2659
3975
|
"minimum"
|
|
2660
3976
|
);
|
|
2661
|
-
return /* @__PURE__ */ (0,
|
|
3977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2662
3978
|
FieldInput_default,
|
|
2663
3979
|
{
|
|
2664
3980
|
id,
|
|
@@ -2669,8 +3985,8 @@ var NumberInputRenderer = {
|
|
|
2669
3985
|
loadingState: props.fieldLoadingState,
|
|
2670
3986
|
help,
|
|
2671
3987
|
features: props.features,
|
|
2672
|
-
children: /* @__PURE__ */ (0,
|
|
2673
|
-
|
|
3988
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components43.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
3989
|
+
import_components43.Input,
|
|
2674
3990
|
__spreadValues({
|
|
2675
3991
|
id,
|
|
2676
3992
|
name: id,
|
|
@@ -2690,24 +4006,24 @@ var NumberInputRenderer = {
|
|
|
2690
4006
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
2691
4007
|
|
|
2692
4008
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2693
|
-
var
|
|
4009
|
+
var import_react_intl17 = require("react-intl");
|
|
2694
4010
|
|
|
2695
4011
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
2696
|
-
var
|
|
2697
|
-
var
|
|
4012
|
+
var import_components44 = require("@transferwise/components");
|
|
4013
|
+
var import_react15 = require("react");
|
|
2698
4014
|
function useSnackBarIfAvailable() {
|
|
2699
|
-
const context = (0,
|
|
4015
|
+
const context = (0, import_react15.useContext)(import_components44.SnackbarContext);
|
|
2700
4016
|
return context ? context.createSnackbar : () => {
|
|
2701
4017
|
};
|
|
2702
4018
|
}
|
|
2703
4019
|
|
|
2704
4020
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2705
|
-
var
|
|
4021
|
+
var import_components45 = require("@transferwise/components");
|
|
2706
4022
|
var import_classnames6 = __toESM(require_classnames());
|
|
2707
4023
|
|
|
2708
4024
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
2709
|
-
var
|
|
2710
|
-
var paragraph_messages_default = (0,
|
|
4025
|
+
var import_react_intl16 = require("react-intl");
|
|
4026
|
+
var paragraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
2711
4027
|
copy: {
|
|
2712
4028
|
id: "df.wise.DynamicParagraph.copy",
|
|
2713
4029
|
defaultMessage: "Copy",
|
|
@@ -2721,14 +4037,14 @@ var paragraph_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
2721
4037
|
});
|
|
2722
4038
|
|
|
2723
4039
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2724
|
-
var
|
|
4040
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
2725
4041
|
var ParagraphRenderer = {
|
|
2726
4042
|
canRenderType: "paragraph",
|
|
2727
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4043
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Paragraph, __spreadValues({}, props))
|
|
2728
4044
|
};
|
|
2729
4045
|
function Paragraph({ align, control, margin, size, text }) {
|
|
2730
4046
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
2731
|
-
return control === "copyable" ? /* @__PURE__ */ (0,
|
|
4047
|
+
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
2732
4048
|
"p",
|
|
2733
4049
|
{
|
|
2734
4050
|
className: `${["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large"} ${className}`,
|
|
@@ -2741,16 +4057,16 @@ function CopyableParagraph({
|
|
|
2741
4057
|
align,
|
|
2742
4058
|
className
|
|
2743
4059
|
}) {
|
|
2744
|
-
const { formatMessage } = (0,
|
|
4060
|
+
const { formatMessage } = (0, import_react_intl17.useIntl)();
|
|
2745
4061
|
const createSnackbar = useSnackBarIfAvailable();
|
|
2746
4062
|
const copy = () => {
|
|
2747
4063
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
2748
4064
|
});
|
|
2749
4065
|
};
|
|
2750
4066
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
2751
|
-
return /* @__PURE__ */ (0,
|
|
2752
|
-
/* @__PURE__ */ (0,
|
|
2753
|
-
|
|
4067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className, children: [
|
|
4068
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
4069
|
+
import_components45.Input,
|
|
2754
4070
|
{
|
|
2755
4071
|
type: "text",
|
|
2756
4072
|
value: text,
|
|
@@ -2758,23 +4074,23 @@ function CopyableParagraph({
|
|
|
2758
4074
|
className: (0, import_classnames6.default)("text-ellipsis", inputAlignmentClasses)
|
|
2759
4075
|
}
|
|
2760
4076
|
),
|
|
2761
|
-
/* @__PURE__ */ (0,
|
|
4077
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components45.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
2762
4078
|
] });
|
|
2763
4079
|
}
|
|
2764
4080
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
2765
4081
|
|
|
2766
4082
|
// ../renderers/src/ProgressRenderer.tsx
|
|
2767
|
-
var
|
|
2768
|
-
var
|
|
4083
|
+
var import_components46 = require("@transferwise/components");
|
|
4084
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
2769
4085
|
var ProgressRenderer = {
|
|
2770
4086
|
canRenderType: "progress",
|
|
2771
4087
|
render: ({ uid, title, help, progress, progressText, margin, description }) => {
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
2773
|
-
|
|
4088
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
4089
|
+
import_components46.ProgressBar,
|
|
2774
4090
|
{
|
|
2775
4091
|
id: uid,
|
|
2776
4092
|
className: getMargin(margin),
|
|
2777
|
-
title: title && help ? /* @__PURE__ */ (0,
|
|
4093
|
+
title: title && help ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(LabelContentWithHelp, { text: title, help }) : title,
|
|
2778
4094
|
description,
|
|
2779
4095
|
progress: {
|
|
2780
4096
|
max: 1,
|
|
@@ -2787,15 +4103,15 @@ var ProgressRenderer = {
|
|
|
2787
4103
|
};
|
|
2788
4104
|
|
|
2789
4105
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2790
|
-
var
|
|
2791
|
-
var
|
|
4106
|
+
var import_components47 = require("@transferwise/components");
|
|
4107
|
+
var import_icons2 = require("@transferwise/icons");
|
|
2792
4108
|
var import_classnames7 = __toESM(require_classnames());
|
|
2793
|
-
var
|
|
2794
|
-
var
|
|
4109
|
+
var import_react16 = require("react");
|
|
4110
|
+
var import_react_intl19 = require("react-intl");
|
|
2795
4111
|
|
|
2796
4112
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
2797
|
-
var
|
|
2798
|
-
var repeatable_messages_default = (0,
|
|
4113
|
+
var import_react_intl18 = require("react-intl");
|
|
4114
|
+
var repeatable_messages_default = (0, import_react_intl18.defineMessages)({
|
|
2799
4115
|
addItemTitle: {
|
|
2800
4116
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
2801
4117
|
defaultMessage: "Add Item",
|
|
@@ -2819,10 +4135,10 @@ var repeatable_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
2819
4135
|
});
|
|
2820
4136
|
|
|
2821
4137
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2822
|
-
var
|
|
4138
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
2823
4139
|
var RepeatableRenderer = {
|
|
2824
4140
|
canRenderType: "repeatable",
|
|
2825
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4141
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Repeatable, __spreadValues({}, props))
|
|
2826
4142
|
};
|
|
2827
4143
|
function Repeatable(props) {
|
|
2828
4144
|
const {
|
|
@@ -2839,8 +4155,8 @@ function Repeatable(props) {
|
|
|
2839
4155
|
onSave,
|
|
2840
4156
|
onRemove
|
|
2841
4157
|
} = props;
|
|
2842
|
-
const { formatMessage } = (0,
|
|
2843
|
-
const [openModalType, setOpenModalType] = (0,
|
|
4158
|
+
const { formatMessage } = (0, import_react_intl19.useIntl)();
|
|
4159
|
+
const [openModalType, setOpenModalType] = (0, import_react16.useState)(null);
|
|
2844
4160
|
const { ref } = useScrollToError(validationState, features);
|
|
2845
4161
|
const onAddItem = () => {
|
|
2846
4162
|
onAdd();
|
|
@@ -2863,43 +4179,43 @@ function Repeatable(props) {
|
|
|
2863
4179
|
const onCancelEdit = () => {
|
|
2864
4180
|
setOpenModalType(null);
|
|
2865
4181
|
};
|
|
2866
|
-
return /* @__PURE__ */ (0,
|
|
2867
|
-
/* @__PURE__ */ (0,
|
|
2868
|
-
title && /* @__PURE__ */ (0,
|
|
2869
|
-
description && /* @__PURE__ */ (0,
|
|
2870
|
-
/* @__PURE__ */ (0,
|
|
4182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
4183
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { ref, children: [
|
|
4184
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components47.Header, { title }),
|
|
4185
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { children: description }),
|
|
4186
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
2871
4187
|
"div",
|
|
2872
4188
|
{
|
|
2873
4189
|
className: (0, import_classnames7.default)("form-group", {
|
|
2874
4190
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2875
4191
|
}),
|
|
2876
4192
|
children: [
|
|
2877
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
2878
|
-
/* @__PURE__ */ (0,
|
|
2879
|
-
|
|
4193
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4195
|
+
import_components47.NavigationOption,
|
|
2880
4196
|
{
|
|
2881
|
-
media: /* @__PURE__ */ (0,
|
|
4197
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_icons2.Plus, {}),
|
|
2882
4198
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2883
4199
|
showMediaAtAllSizes: true,
|
|
2884
4200
|
onClick: () => onAddItem()
|
|
2885
4201
|
}
|
|
2886
4202
|
),
|
|
2887
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
4203
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components47.InlineAlert, { type: "negative", children: validationState.message })
|
|
2888
4204
|
]
|
|
2889
4205
|
}
|
|
2890
4206
|
)
|
|
2891
4207
|
] }),
|
|
2892
|
-
/* @__PURE__ */ (0,
|
|
2893
|
-
|
|
4208
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4209
|
+
import_components47.Modal,
|
|
2894
4210
|
{
|
|
2895
4211
|
open: openModalType !== null,
|
|
2896
4212
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2897
|
-
body: /* @__PURE__ */ (0,
|
|
2898
|
-
/* @__PURE__ */ (0,
|
|
2899
|
-
/* @__PURE__ */ (0,
|
|
2900
|
-
/* @__PURE__ */ (0,
|
|
2901
|
-
/* @__PURE__ */ (0,
|
|
2902
|
-
|
|
4213
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
4214
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
4215
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [
|
|
4216
|
+
/* @__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) }),
|
|
4217
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4218
|
+
import_components47.Button,
|
|
2903
4219
|
{
|
|
2904
4220
|
v2: true,
|
|
2905
4221
|
priority: "secondary",
|
|
@@ -2920,10 +4236,10 @@ function ItemSummaryOption({
|
|
|
2920
4236
|
item,
|
|
2921
4237
|
onClick
|
|
2922
4238
|
}) {
|
|
2923
|
-
return /* @__PURE__ */ (0,
|
|
2924
|
-
|
|
4239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
4240
|
+
import_components47.NavigationOption,
|
|
2925
4241
|
{
|
|
2926
|
-
media: /* @__PURE__ */ (0,
|
|
4242
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(OptionMedia, { media: item.media, preferAvatar: false }),
|
|
2927
4243
|
title: item.title,
|
|
2928
4244
|
content: item.description,
|
|
2929
4245
|
showMediaAtAllSizes: true,
|
|
@@ -2935,16 +4251,16 @@ function ItemSummaryOption({
|
|
|
2935
4251
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2936
4252
|
|
|
2937
4253
|
// ../renderers/src/ReviewLegacyRenderer.tsx
|
|
2938
|
-
var
|
|
2939
|
-
var
|
|
4254
|
+
var import_components48 = require("@transferwise/components");
|
|
4255
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
2940
4256
|
var ReviewRenderer = {
|
|
2941
4257
|
canRenderType: "review",
|
|
2942
4258
|
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2943
4259
|
const orientation = mapControlToDefinitionListLayout(control);
|
|
2944
|
-
return /* @__PURE__ */ (0,
|
|
2945
|
-
/* @__PURE__ */ (0,
|
|
2946
|
-
/* @__PURE__ */ (0,
|
|
2947
|
-
|
|
4260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: getMargin(margin), children: [
|
|
4261
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Header, { title, callToAction }),
|
|
4262
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4263
|
+
import_components48.DefinitionList,
|
|
2948
4264
|
{
|
|
2949
4265
|
layout: orientation,
|
|
2950
4266
|
definitions: fields.map(
|
|
@@ -2981,20 +4297,20 @@ var mapControlToDefinitionListLayout = (control) => {
|
|
|
2981
4297
|
};
|
|
2982
4298
|
var getFieldLabel = (label, help, onClick) => {
|
|
2983
4299
|
if (help) {
|
|
2984
|
-
return /* @__PURE__ */ (0,
|
|
4300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_jsx_runtime71.Fragment, { children: [
|
|
2985
4301
|
label,
|
|
2986
4302
|
" ",
|
|
2987
|
-
/* @__PURE__ */ (0,
|
|
4303
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Help_default, { help, onClick })
|
|
2988
4304
|
] });
|
|
2989
4305
|
}
|
|
2990
4306
|
return label;
|
|
2991
4307
|
};
|
|
2992
4308
|
|
|
2993
4309
|
// ../renderers/src/ReviewRenderer.tsx
|
|
2994
|
-
var
|
|
2995
|
-
var
|
|
2996
|
-
var
|
|
2997
|
-
var
|
|
4310
|
+
var import_components49 = require("@transferwise/components");
|
|
4311
|
+
var import_icons3 = require("@transferwise/icons");
|
|
4312
|
+
var import_react_intl20 = require("react-intl");
|
|
4313
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
2998
4314
|
var IGNORED_CONTROLS = [
|
|
2999
4315
|
"horizontal",
|
|
3000
4316
|
"horizontal-end-aligned",
|
|
@@ -3004,7 +4320,7 @@ var IGNORED_CONTROLS = [
|
|
|
3004
4320
|
var ReviewRenderer2 = {
|
|
3005
4321
|
canRenderType: "review",
|
|
3006
4322
|
canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
|
|
3007
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
4323
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Review, __spreadValues({}, props))
|
|
3008
4324
|
};
|
|
3009
4325
|
var Review = ({
|
|
3010
4326
|
callToAction,
|
|
@@ -3015,9 +4331,9 @@ var Review = ({
|
|
|
3015
4331
|
title,
|
|
3016
4332
|
trackEvent
|
|
3017
4333
|
}) => {
|
|
3018
|
-
const intl = (0,
|
|
3019
|
-
return /* @__PURE__ */ (0,
|
|
3020
|
-
/* @__PURE__ */ (0,
|
|
4334
|
+
const intl = (0, import_react_intl20.useIntl)();
|
|
4335
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: getMargin(margin), children: [
|
|
4336
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Header, { title, callToAction }),
|
|
3021
4337
|
fields.map((field) => {
|
|
3022
4338
|
var _a, _b, _c;
|
|
3023
4339
|
const {
|
|
@@ -3035,8 +4351,8 @@ var Review = ({
|
|
|
3035
4351
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3036
4352
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3037
4353
|
};
|
|
3038
|
-
return /* @__PURE__ */ (0,
|
|
3039
|
-
|
|
4354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4355
|
+
import_components49.ListItem,
|
|
3040
4356
|
{
|
|
3041
4357
|
title: value,
|
|
3042
4358
|
subtitle: label,
|
|
@@ -3056,18 +4372,18 @@ var Review = ({
|
|
|
3056
4372
|
] });
|
|
3057
4373
|
};
|
|
3058
4374
|
var getHelpControl = (help, ariaLabel, onClick) => {
|
|
3059
|
-
return /* @__PURE__ */ (0,
|
|
4375
|
+
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, {}) }) });
|
|
3060
4376
|
};
|
|
3061
4377
|
var ReviewRenderer_default = ReviewRenderer2;
|
|
3062
4378
|
|
|
3063
4379
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
3064
|
-
var
|
|
3065
|
-
var
|
|
3066
|
-
var
|
|
4380
|
+
var import_components51 = require("@transferwise/components");
|
|
4381
|
+
var import_react17 = require("react");
|
|
4382
|
+
var import_react_intl24 = require("react-intl");
|
|
3067
4383
|
|
|
3068
4384
|
// ../renderers/src/messages/search.messages.ts
|
|
3069
|
-
var
|
|
3070
|
-
var search_messages_default = (0,
|
|
4385
|
+
var import_react_intl21 = require("react-intl");
|
|
4386
|
+
var search_messages_default = (0, import_react_intl21.defineMessages)({
|
|
3071
4387
|
loading: {
|
|
3072
4388
|
id: "df.wise.SearchLayout.loading",
|
|
3073
4389
|
defaultMessage: "Loading...",
|
|
@@ -3076,11 +4392,11 @@ var search_messages_default = (0, import_react_intl19.defineMessages)({
|
|
|
3076
4392
|
});
|
|
3077
4393
|
|
|
3078
4394
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
3079
|
-
var
|
|
4395
|
+
var import_react_intl23 = require("react-intl");
|
|
3080
4396
|
|
|
3081
4397
|
// ../renderers/src/messages/generic-error.messages.ts
|
|
3082
|
-
var
|
|
3083
|
-
var generic_error_messages_default = (0,
|
|
4398
|
+
var import_react_intl22 = require("react-intl");
|
|
4399
|
+
var generic_error_messages_default = (0, import_react_intl22.defineMessages)({
|
|
3084
4400
|
genericErrorRetryHint: {
|
|
3085
4401
|
id: "df.wise.PersistAsyncSchema.genericError",
|
|
3086
4402
|
defaultMessage: "Something went wrong, please try again.",
|
|
@@ -3099,20 +4415,20 @@ var generic_error_messages_default = (0, import_react_intl20.defineMessages)({
|
|
|
3099
4415
|
});
|
|
3100
4416
|
|
|
3101
4417
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
3102
|
-
var
|
|
3103
|
-
var
|
|
4418
|
+
var import_components50 = require("@transferwise/components");
|
|
4419
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3104
4420
|
function ErrorResult({ state }) {
|
|
3105
|
-
const intl = (0,
|
|
3106
|
-
return /* @__PURE__ */ (0,
|
|
4421
|
+
const intl = (0, import_react_intl23.useIntl)();
|
|
4422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("p", { className: "m-t-2", children: [
|
|
3107
4423
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
3108
4424
|
"\xA0",
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
4425
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components50.Link, { onClick: () => state.onRetry(), children: intl.formatMessage(generic_error_messages_default.retry) })
|
|
3110
4426
|
] });
|
|
3111
4427
|
}
|
|
3112
4428
|
|
|
3113
4429
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
3114
|
-
var
|
|
3115
|
-
var
|
|
4430
|
+
var import_icons4 = require("@transferwise/icons");
|
|
4431
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
3116
4432
|
function BlockSearchRendererComponent({
|
|
3117
4433
|
id,
|
|
3118
4434
|
hint,
|
|
@@ -3125,10 +4441,10 @@ function BlockSearchRendererComponent({
|
|
|
3125
4441
|
trackEvent,
|
|
3126
4442
|
onChange
|
|
3127
4443
|
}) {
|
|
3128
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3129
|
-
const { formatMessage } = (0,
|
|
3130
|
-
return /* @__PURE__ */ (0,
|
|
3131
|
-
/* @__PURE__ */ (0,
|
|
4444
|
+
const [hasSearched, setHasSearched] = (0, import_react17.useState)(false);
|
|
4445
|
+
const { formatMessage } = (0, import_react_intl24.useIntl)();
|
|
4446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: getMargin(margin), children: [
|
|
4447
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3132
4448
|
FieldInput_default,
|
|
3133
4449
|
{
|
|
3134
4450
|
id,
|
|
@@ -3137,8 +4453,8 @@ function BlockSearchRendererComponent({
|
|
|
3137
4453
|
help: "",
|
|
3138
4454
|
label: title,
|
|
3139
4455
|
features,
|
|
3140
|
-
children: /* @__PURE__ */ (0,
|
|
3141
|
-
|
|
4456
|
+
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)(
|
|
4457
|
+
import_components51.Input,
|
|
3142
4458
|
{
|
|
3143
4459
|
id,
|
|
3144
4460
|
name: id,
|
|
@@ -3156,7 +4472,7 @@ function BlockSearchRendererComponent({
|
|
|
3156
4472
|
) })
|
|
3157
4473
|
}
|
|
3158
4474
|
),
|
|
3159
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
4475
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(SearchResultContent, { state, trackEvent })
|
|
3160
4476
|
] });
|
|
3161
4477
|
}
|
|
3162
4478
|
function SearchResultContent({
|
|
@@ -3165,39 +4481,39 @@ function SearchResultContent({
|
|
|
3165
4481
|
}) {
|
|
3166
4482
|
switch (state.type) {
|
|
3167
4483
|
case "error":
|
|
3168
|
-
return /* @__PURE__ */ (0,
|
|
4484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ErrorResult, { state });
|
|
3169
4485
|
case "results":
|
|
3170
|
-
return /* @__PURE__ */ (0,
|
|
4486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(SearchResults, { state, trackEvent });
|
|
3171
4487
|
case "layout":
|
|
3172
|
-
return /* @__PURE__ */ (0,
|
|
4488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
3173
4489
|
" ",
|
|
3174
4490
|
state.layout,
|
|
3175
4491
|
" "
|
|
3176
4492
|
] });
|
|
3177
4493
|
case "noResults":
|
|
3178
|
-
return /* @__PURE__ */ (0,
|
|
4494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(EmptySearchResult, { state });
|
|
3179
4495
|
case "pending":
|
|
3180
4496
|
default:
|
|
3181
4497
|
return null;
|
|
3182
4498
|
}
|
|
3183
4499
|
}
|
|
3184
4500
|
function EmptySearchResult({ state }) {
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
4501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components51.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
3186
4502
|
}
|
|
3187
4503
|
function SearchResults({
|
|
3188
4504
|
state,
|
|
3189
4505
|
trackEvent
|
|
3190
4506
|
}) {
|
|
3191
|
-
return /* @__PURE__ */ (0,
|
|
4507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components51.List, { children: state.results.map((result) => {
|
|
3192
4508
|
const { media } = result;
|
|
3193
|
-
return /* @__PURE__ */ (0,
|
|
3194
|
-
|
|
4509
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4510
|
+
import_components51.ListItem,
|
|
3195
4511
|
{
|
|
3196
4512
|
title: result.title,
|
|
3197
4513
|
subtitle: result.description,
|
|
3198
|
-
media: media ? /* @__PURE__ */ (0,
|
|
3199
|
-
control: /* @__PURE__ */ (0,
|
|
3200
|
-
|
|
4514
|
+
media: media ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(OptionMedia, { media, preferAvatar: false }) : void 0,
|
|
4515
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
4516
|
+
import_components51.ListItem.Navigation,
|
|
3201
4517
|
{
|
|
3202
4518
|
onClick: () => {
|
|
3203
4519
|
trackEvent("Search Result Selected", __spreadValues({
|
|
@@ -3215,11 +4531,11 @@ function SearchResults({
|
|
|
3215
4531
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
3216
4532
|
|
|
3217
4533
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
3218
|
-
var
|
|
3219
|
-
var
|
|
3220
|
-
var
|
|
3221
|
-
var
|
|
3222
|
-
var
|
|
4534
|
+
var import_components52 = require("@transferwise/components");
|
|
4535
|
+
var import_icons5 = require("@transferwise/icons");
|
|
4536
|
+
var import_react18 = require("react");
|
|
4537
|
+
var import_react_intl25 = require("react-intl");
|
|
4538
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3223
4539
|
function InlineSearchRenderer({
|
|
3224
4540
|
id,
|
|
3225
4541
|
hint,
|
|
@@ -3231,9 +4547,9 @@ function InlineSearchRenderer({
|
|
|
3231
4547
|
onChange,
|
|
3232
4548
|
trackEvent
|
|
3233
4549
|
}) {
|
|
3234
|
-
const [hasSearched, setHasSearched] = (0,
|
|
3235
|
-
const intl = (0,
|
|
3236
|
-
return /* @__PURE__ */ (0,
|
|
4550
|
+
const [hasSearched, setHasSearched] = (0, import_react18.useState)(false);
|
|
4551
|
+
const intl = (0, import_react_intl25.useIntl)();
|
|
4552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
3237
4553
|
FieldInput_default,
|
|
3238
4554
|
{
|
|
3239
4555
|
id,
|
|
@@ -3242,8 +4558,8 @@ function InlineSearchRenderer({
|
|
|
3242
4558
|
help: "",
|
|
3243
4559
|
label: title,
|
|
3244
4560
|
features,
|
|
3245
|
-
children: /* @__PURE__ */ (0,
|
|
3246
|
-
|
|
4561
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
4562
|
+
import_components52.Typeahead,
|
|
3247
4563
|
{
|
|
3248
4564
|
id: "typeahead-input-id",
|
|
3249
4565
|
intl,
|
|
@@ -3251,10 +4567,10 @@ function InlineSearchRenderer({
|
|
|
3251
4567
|
size: "md",
|
|
3252
4568
|
placeholder: hint,
|
|
3253
4569
|
maxHeight: 100,
|
|
3254
|
-
footer: /* @__PURE__ */ (0,
|
|
4570
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
3255
4571
|
multiple: false,
|
|
3256
4572
|
clearable: false,
|
|
3257
|
-
addon: /* @__PURE__ */ (0,
|
|
4573
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_icons5.Search, { size: 24 }),
|
|
3258
4574
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
3259
4575
|
minQueryLength: 1,
|
|
3260
4576
|
onChange: (values) => {
|
|
@@ -3291,33 +4607,33 @@ function mapResultToTypeaheadOption(result) {
|
|
|
3291
4607
|
};
|
|
3292
4608
|
}
|
|
3293
4609
|
function TypeaheadFooter({ state, isLoading }) {
|
|
3294
|
-
const { formatMessage } = (0,
|
|
4610
|
+
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3295
4611
|
if (state.type === "layout") {
|
|
3296
|
-
return /* @__PURE__ */ (0,
|
|
4612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "m-x-1 m-y-1", children: state.layout });
|
|
3297
4613
|
}
|
|
3298
4614
|
if (state.type === "noResults") {
|
|
3299
|
-
return /* @__PURE__ */ (0,
|
|
4615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
3300
4616
|
}
|
|
3301
4617
|
if (state.type === "error") {
|
|
3302
|
-
return /* @__PURE__ */ (0,
|
|
4618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(ErrorResult, { state }) });
|
|
3303
4619
|
}
|
|
3304
4620
|
if (state.type === "pending" || isLoading) {
|
|
3305
|
-
return /* @__PURE__ */ (0,
|
|
4621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
3306
4622
|
}
|
|
3307
4623
|
return null;
|
|
3308
4624
|
}
|
|
3309
4625
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
3310
4626
|
|
|
3311
4627
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
3312
|
-
var
|
|
4628
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
3313
4629
|
var SearchRenderer = {
|
|
3314
4630
|
canRenderType: "search",
|
|
3315
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0,
|
|
4631
|
+
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))
|
|
3316
4632
|
};
|
|
3317
4633
|
var SearchRenderer_default = SearchRenderer;
|
|
3318
4634
|
|
|
3319
4635
|
// ../renderers/src/SectionRenderer.tsx
|
|
3320
|
-
var
|
|
4636
|
+
var import_components53 = require("@transferwise/components");
|
|
3321
4637
|
|
|
3322
4638
|
// ../renderers/src/utils/getHeaderAction.tsx
|
|
3323
4639
|
var getHeaderAction2 = (callToAction) => {
|
|
@@ -3341,12 +4657,12 @@ var getHeaderAction2 = (callToAction) => {
|
|
|
3341
4657
|
};
|
|
3342
4658
|
|
|
3343
4659
|
// ../renderers/src/SectionRenderer.tsx
|
|
3344
|
-
var
|
|
4660
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3345
4661
|
var SectionRenderer = {
|
|
3346
4662
|
canRenderType: "section",
|
|
3347
4663
|
render: ({ children, callToAction, margin, title }) => {
|
|
3348
|
-
return /* @__PURE__ */ (0,
|
|
3349
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
4664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("section", { className: getMargin(margin), children: [
|
|
4665
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components53.Header, { title: title != null ? title : "", action: getHeaderAction2(callToAction) }),
|
|
3350
4666
|
children
|
|
3351
4667
|
] });
|
|
3352
4668
|
}
|
|
@@ -3354,8 +4670,8 @@ var SectionRenderer = {
|
|
|
3354
4670
|
var SectionRenderer_default = SectionRenderer;
|
|
3355
4671
|
|
|
3356
4672
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
3357
|
-
var
|
|
3358
|
-
var
|
|
4673
|
+
var import_components54 = require("@transferwise/components");
|
|
4674
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
3359
4675
|
function RadioInputRendererComponent(props) {
|
|
3360
4676
|
const {
|
|
3361
4677
|
id,
|
|
@@ -3370,8 +4686,8 @@ function RadioInputRendererComponent(props) {
|
|
|
3370
4686
|
validationState,
|
|
3371
4687
|
onSelect
|
|
3372
4688
|
} = props;
|
|
3373
|
-
return /* @__PURE__ */ (0,
|
|
3374
|
-
/* @__PURE__ */ (0,
|
|
4689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
|
|
4690
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
3375
4691
|
FieldInput_default,
|
|
3376
4692
|
{
|
|
3377
4693
|
id,
|
|
@@ -3380,8 +4696,8 @@ function RadioInputRendererComponent(props) {
|
|
|
3380
4696
|
description,
|
|
3381
4697
|
validation: validationState,
|
|
3382
4698
|
features,
|
|
3383
|
-
children: /* @__PURE__ */ (0,
|
|
3384
|
-
|
|
4699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
4700
|
+
import_components54.RadioGroup,
|
|
3385
4701
|
{
|
|
3386
4702
|
name: id,
|
|
3387
4703
|
radios: options.map((option, index) => ({
|
|
@@ -3389,7 +4705,7 @@ function RadioInputRendererComponent(props) {
|
|
|
3389
4705
|
value: index,
|
|
3390
4706
|
secondary: option.description,
|
|
3391
4707
|
disabled: option.disabled || disabled,
|
|
3392
|
-
avatar: /* @__PURE__ */ (0,
|
|
4708
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
3393
4709
|
})),
|
|
3394
4710
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
3395
4711
|
onChange: onSelect
|
|
@@ -3403,9 +4719,9 @@ function RadioInputRendererComponent(props) {
|
|
|
3403
4719
|
}
|
|
3404
4720
|
|
|
3405
4721
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
3406
|
-
var
|
|
3407
|
-
var
|
|
3408
|
-
var
|
|
4722
|
+
var import_components55 = require("@transferwise/components");
|
|
4723
|
+
var import_react19 = require("react");
|
|
4724
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3409
4725
|
function TabInputRendererComponent(props) {
|
|
3410
4726
|
const {
|
|
3411
4727
|
id,
|
|
@@ -3420,13 +4736,13 @@ function TabInputRendererComponent(props) {
|
|
|
3420
4736
|
validationState,
|
|
3421
4737
|
onSelect
|
|
3422
4738
|
} = props;
|
|
3423
|
-
(0,
|
|
4739
|
+
(0, import_react19.useEffect)(() => {
|
|
3424
4740
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
3425
4741
|
onSelect(0);
|
|
3426
4742
|
}
|
|
3427
4743
|
}, [selectedIndex, onSelect, options.length]);
|
|
3428
|
-
return /* @__PURE__ */ (0,
|
|
3429
|
-
/* @__PURE__ */ (0,
|
|
4744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [
|
|
4745
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3430
4746
|
FieldInput_default,
|
|
3431
4747
|
{
|
|
3432
4748
|
id,
|
|
@@ -3435,8 +4751,8 @@ function TabInputRendererComponent(props) {
|
|
|
3435
4751
|
description,
|
|
3436
4752
|
validation: validationState,
|
|
3437
4753
|
features,
|
|
3438
|
-
children: /* @__PURE__ */ (0,
|
|
3439
|
-
|
|
4754
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
4755
|
+
import_components55.Tabs,
|
|
3440
4756
|
{
|
|
3441
4757
|
name: id,
|
|
3442
4758
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -3444,7 +4760,7 @@ function TabInputRendererComponent(props) {
|
|
|
3444
4760
|
title: option.title,
|
|
3445
4761
|
// if we pass null, we get some props-types console errors
|
|
3446
4762
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
3447
|
-
content: /* @__PURE__ */ (0,
|
|
4763
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, {}),
|
|
3448
4764
|
disabled: option.disabled || disabled
|
|
3449
4765
|
})),
|
|
3450
4766
|
onTabSelect: onSelect
|
|
@@ -3458,8 +4774,8 @@ function TabInputRendererComponent(props) {
|
|
|
3458
4774
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
3459
4775
|
|
|
3460
4776
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
3461
|
-
var
|
|
3462
|
-
var
|
|
4777
|
+
var import_components56 = require("@transferwise/components");
|
|
4778
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3463
4779
|
function SelectInputRendererComponent(props) {
|
|
3464
4780
|
const {
|
|
3465
4781
|
id,
|
|
@@ -3500,13 +4816,13 @@ function SelectInputRendererComponent(props) {
|
|
|
3500
4816
|
} : {
|
|
3501
4817
|
title: option.title,
|
|
3502
4818
|
description: option.description,
|
|
3503
|
-
icon: /* @__PURE__ */ (0,
|
|
4819
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
3504
4820
|
};
|
|
3505
|
-
return /* @__PURE__ */ (0,
|
|
4821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components56.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
3506
4822
|
};
|
|
3507
4823
|
const extraProps = { autoComplete };
|
|
3508
|
-
return /* @__PURE__ */ (0,
|
|
3509
|
-
/* @__PURE__ */ (0,
|
|
4824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
|
|
4825
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3510
4826
|
FieldInput_default,
|
|
3511
4827
|
{
|
|
3512
4828
|
id,
|
|
@@ -3515,8 +4831,8 @@ function SelectInputRendererComponent(props) {
|
|
|
3515
4831
|
description,
|
|
3516
4832
|
validation: validationState,
|
|
3517
4833
|
features,
|
|
3518
|
-
children: /* @__PURE__ */ (0,
|
|
3519
|
-
|
|
4834
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
4835
|
+
import_components56.SelectInput,
|
|
3520
4836
|
__spreadValues({
|
|
3521
4837
|
name: id,
|
|
3522
4838
|
placeholder,
|
|
@@ -3536,9 +4852,9 @@ function SelectInputRendererComponent(props) {
|
|
|
3536
4852
|
}
|
|
3537
4853
|
|
|
3538
4854
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
3539
|
-
var
|
|
3540
|
-
var
|
|
3541
|
-
var
|
|
4855
|
+
var import_react20 = require("react");
|
|
4856
|
+
var import_components57 = require("@transferwise/components");
|
|
4857
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
3542
4858
|
function SegmentedInputRendererComponent(props) {
|
|
3543
4859
|
const {
|
|
3544
4860
|
id,
|
|
@@ -3552,13 +4868,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3552
4868
|
validationState,
|
|
3553
4869
|
onSelect
|
|
3554
4870
|
} = props;
|
|
3555
|
-
(0,
|
|
4871
|
+
(0, import_react20.useEffect)(() => {
|
|
3556
4872
|
if (!isValidIndex3(selectedIndex, options.length)) {
|
|
3557
4873
|
onSelect(0);
|
|
3558
4874
|
}
|
|
3559
4875
|
}, [selectedIndex, onSelect, options.length]);
|
|
3560
|
-
return /* @__PURE__ */ (0,
|
|
3561
|
-
/* @__PURE__ */ (0,
|
|
4876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
4877
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
3562
4878
|
FieldInput_default,
|
|
3563
4879
|
{
|
|
3564
4880
|
id,
|
|
@@ -3567,8 +4883,8 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3567
4883
|
description,
|
|
3568
4884
|
validation: validationState,
|
|
3569
4885
|
features,
|
|
3570
|
-
children: /* @__PURE__ */ (0,
|
|
3571
|
-
|
|
4886
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4887
|
+
import_components57.SegmentedControl,
|
|
3572
4888
|
{
|
|
3573
4889
|
name: `${id}-segmented-control`,
|
|
3574
4890
|
value: String(selectedIndex),
|
|
@@ -3584,14 +4900,14 @@ function SegmentedInputRendererComponent(props) {
|
|
|
3584
4900
|
)
|
|
3585
4901
|
}
|
|
3586
4902
|
),
|
|
3587
|
-
/* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { id: `${id}-children`, children })
|
|
3588
4904
|
] });
|
|
3589
4905
|
}
|
|
3590
4906
|
var isValidIndex3 = (index, options) => index !== null && index >= 0 && index < options;
|
|
3591
4907
|
|
|
3592
4908
|
// ../renderers/src/SelectInputRenderer/RadioItemRendererComponent.tsx
|
|
3593
|
-
var
|
|
3594
|
-
var
|
|
4909
|
+
var import_components58 = require("@transferwise/components");
|
|
4910
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
3595
4911
|
function RadioItemRendererComponent(props) {
|
|
3596
4912
|
const {
|
|
3597
4913
|
id,
|
|
@@ -3607,23 +4923,23 @@ function RadioItemRendererComponent(props) {
|
|
|
3607
4923
|
onSelect
|
|
3608
4924
|
} = props;
|
|
3609
4925
|
const { ref } = useScrollToError(validationState, features);
|
|
3610
|
-
return /* @__PURE__ */ (0,
|
|
3611
|
-
rootTitle && /* @__PURE__ */ (0,
|
|
3612
|
-
|
|
4926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { ref, children: [
|
|
4927
|
+
rootTitle && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4928
|
+
import_components58.Header,
|
|
3613
4929
|
{
|
|
3614
4930
|
as: "h2",
|
|
3615
|
-
title: help ? /* @__PURE__ */ (0,
|
|
4931
|
+
title: help ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(LabelContentWithHelp, { text: rootTitle, help }) : rootTitle
|
|
3616
4932
|
}
|
|
3617
4933
|
),
|
|
3618
|
-
rootDescription && /* @__PURE__ */ (0,
|
|
3619
|
-
/* @__PURE__ */ (0,
|
|
3620
|
-
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0,
|
|
3621
|
-
|
|
4934
|
+
rootDescription && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { children: rootDescription }),
|
|
4935
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components58.List, { children: options.map(
|
|
4936
|
+
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4937
|
+
import_components58.ListItem,
|
|
3622
4938
|
__spreadValues({
|
|
3623
4939
|
title,
|
|
3624
4940
|
subtitle: description,
|
|
3625
|
-
control: /* @__PURE__ */ (0,
|
|
3626
|
-
|
|
4941
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4942
|
+
import_components58.ListItem.Radio,
|
|
3627
4943
|
{
|
|
3628
4944
|
name: title,
|
|
3629
4945
|
checked: selectedIndex === index,
|
|
@@ -3638,50 +4954,50 @@ function RadioItemRendererComponent(props) {
|
|
|
3638
4954
|
title
|
|
3639
4955
|
)
|
|
3640
4956
|
) }, `${id}-${selectedIndex}`),
|
|
3641
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
4957
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components58.InlineAlert, { type: "negative", children: validationState.message }),
|
|
3642
4958
|
children
|
|
3643
4959
|
] });
|
|
3644
4960
|
}
|
|
3645
4961
|
|
|
3646
4962
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
3647
|
-
var
|
|
4963
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
3648
4964
|
var SelectInputRenderer = {
|
|
3649
4965
|
canRenderType: "input-select",
|
|
3650
4966
|
render: (props) => {
|
|
3651
4967
|
switch (props.control) {
|
|
3652
4968
|
case "radio":
|
|
3653
|
-
return /* @__PURE__ */ (0,
|
|
4969
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
3654
4970
|
case "radio-item":
|
|
3655
|
-
return /* @__PURE__ */ (0,
|
|
4971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RadioItemRendererComponent, __spreadValues({}, props));
|
|
3656
4972
|
case "tab":
|
|
3657
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
4973
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
3658
4974
|
case "segmented":
|
|
3659
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
4975
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
3660
4976
|
case "select":
|
|
3661
4977
|
default:
|
|
3662
|
-
return /* @__PURE__ */ (0,
|
|
4978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
3663
4979
|
}
|
|
3664
4980
|
}
|
|
3665
4981
|
};
|
|
3666
4982
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
3667
4983
|
|
|
3668
4984
|
// ../renderers/src/StatusListRenderer.tsx
|
|
3669
|
-
var
|
|
3670
|
-
var
|
|
4985
|
+
var import_components59 = require("@transferwise/components");
|
|
4986
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
3671
4987
|
var StatusListRenderer = {
|
|
3672
4988
|
canRenderType: "status-list",
|
|
3673
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
3674
|
-
title ? /* @__PURE__ */ (0,
|
|
4989
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: getMargin(margin), children: [
|
|
4990
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components59.Header, { title }) : null,
|
|
3675
4991
|
items.map((item) => {
|
|
3676
4992
|
const { callToAction, description, title: itemTitle } = item;
|
|
3677
|
-
return /* @__PURE__ */ (0,
|
|
3678
|
-
|
|
4993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
4994
|
+
import_components59.ListItem,
|
|
3679
4995
|
{
|
|
3680
4996
|
title: itemTitle,
|
|
3681
4997
|
subtitle: description,
|
|
3682
|
-
media: /* @__PURE__ */ (0,
|
|
3683
|
-
additionalInfo: callToAction ? /* @__PURE__ */ (0,
|
|
3684
|
-
|
|
4998
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(StatusListItemMedia, __spreadValues({}, item)),
|
|
4999
|
+
additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5000
|
+
import_components59.ListItem.AdditionalInfo,
|
|
3685
5001
|
{
|
|
3686
5002
|
action: __spreadValues({
|
|
3687
5003
|
label: callToAction.title
|
|
@@ -3699,10 +5015,10 @@ var StatusListItemMedia = ({ icon, status }) => {
|
|
|
3699
5015
|
return void 0;
|
|
3700
5016
|
}
|
|
3701
5017
|
if ("name" in icon) {
|
|
3702
|
-
return /* @__PURE__ */ (0,
|
|
5018
|
+
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 }) });
|
|
3703
5019
|
}
|
|
3704
5020
|
if ("text" in icon) {
|
|
3705
|
-
return /* @__PURE__ */ (0,
|
|
5021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_components59.AvatarView, { badge: { status: mapStatus(status) }, children: icon.text });
|
|
3706
5022
|
}
|
|
3707
5023
|
return void 0;
|
|
3708
5024
|
};
|
|
@@ -3720,12 +5036,12 @@ var StatusListRenderer_default = StatusListRenderer;
|
|
|
3720
5036
|
|
|
3721
5037
|
// ../renderers/src/utils/useCustomTheme.ts
|
|
3722
5038
|
var import_components_theming = require("@wise/components-theming");
|
|
3723
|
-
var
|
|
5039
|
+
var import_react21 = require("react");
|
|
3724
5040
|
var ThemeRequiredEventName = "Theme Required";
|
|
3725
5041
|
var useCustomTheme = (theme, trackEvent) => {
|
|
3726
5042
|
const theming = (0, import_components_theming.useTheme)();
|
|
3727
|
-
const previousTheme = (0,
|
|
3728
|
-
(0,
|
|
5043
|
+
const previousTheme = (0, import_react21.useMemo)(() => theming.theme, []);
|
|
5044
|
+
(0, import_react21.useEffect)(() => {
|
|
3729
5045
|
theming.setTheme(theme);
|
|
3730
5046
|
trackEvent(ThemeRequiredEventName, { theme });
|
|
3731
5047
|
return theme !== previousTheme ? () => {
|
|
@@ -3736,86 +5052,14 @@ var useCustomTheme = (theme, trackEvent) => {
|
|
|
3736
5052
|
}, []);
|
|
3737
5053
|
};
|
|
3738
5054
|
|
|
3739
|
-
// ../renderers/src/step/StepFooter.tsx
|
|
3740
|
-
var import_components54 = require("@transferwise/components");
|
|
3741
|
-
var import_react20 = require("react");
|
|
3742
|
-
var import_react_intl25 = require("react-intl");
|
|
3743
|
-
|
|
3744
|
-
// ../renderers/src/messages/step.messages.ts
|
|
3745
|
-
var import_react_intl24 = require("react-intl");
|
|
3746
|
-
var step_messages_default = (0, import_react_intl24.defineMessages)({
|
|
3747
|
-
scrollToBottom: {
|
|
3748
|
-
id: "df.wise.step.scrollToBottom",
|
|
3749
|
-
defaultMessage: "Scroll to bottom",
|
|
3750
|
-
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."
|
|
3751
|
-
}
|
|
3752
|
-
});
|
|
3753
|
-
|
|
3754
|
-
// ../renderers/src/step/StepFooter.tsx
|
|
3755
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3756
|
-
var SCROLL_TO_BOTTOM = "scroll-to-bottom";
|
|
3757
|
-
var StepFooter = ({ footer, tags }) => {
|
|
3758
|
-
if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
|
|
3759
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FooterWithScrollButton, { footer });
|
|
3760
|
-
}
|
|
3761
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(DefaultFooter, { footer });
|
|
3762
|
-
};
|
|
3763
|
-
var DefaultFooter = ({ footer }) => {
|
|
3764
|
-
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3765
|
-
return hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0;
|
|
3766
|
-
};
|
|
3767
|
-
var FooterWithScrollButton = ({ footer }) => {
|
|
3768
|
-
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3769
|
-
const endOfLayoutRef = (0, import_react20.useRef)(null);
|
|
3770
|
-
const isElementVisible = useIsElementVisible(endOfLayoutRef);
|
|
3771
|
-
const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3772
|
-
import_components54.Button,
|
|
3773
|
-
{
|
|
3774
|
-
className: "m-b-1",
|
|
3775
|
-
v2: true,
|
|
3776
|
-
block: true,
|
|
3777
|
-
priority: "tertiary",
|
|
3778
|
-
onClick: () => {
|
|
3779
|
-
var _a;
|
|
3780
|
-
(_a = endOfLayoutRef.current) == null ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
3781
|
-
},
|
|
3782
|
-
children: formatMessage(step_messages_default.scrollToBottom)
|
|
3783
|
-
}
|
|
3784
|
-
);
|
|
3785
|
-
const hasStepFooterContent = footer && Array.isArray(footer) && footer.length > 0;
|
|
3786
|
-
if (isElementVisible && !hasStepFooterContent) {
|
|
3787
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
|
|
3788
|
-
}
|
|
3789
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
3790
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
|
|
3791
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "df-step-fixed__footer", children: [
|
|
3792
|
-
!isElementVisible && scrollButton,
|
|
3793
|
-
footer
|
|
3794
|
-
] })
|
|
3795
|
-
] });
|
|
3796
|
-
};
|
|
3797
|
-
var useIsElementVisible = (elementRef) => {
|
|
3798
|
-
const [isVisible, setIsVisible] = (0, import_react20.useState)(false);
|
|
3799
|
-
(0, import_react20.useEffect)(() => {
|
|
3800
|
-
const element = elementRef.current;
|
|
3801
|
-
if (!element) return;
|
|
3802
|
-
const observer = new IntersectionObserver(([entry]) => {
|
|
3803
|
-
setIsVisible(entry.isIntersecting);
|
|
3804
|
-
});
|
|
3805
|
-
observer.observe(element);
|
|
3806
|
-
return () => observer.disconnect();
|
|
3807
|
-
}, [elementRef]);
|
|
3808
|
-
return isVisible;
|
|
3809
|
-
};
|
|
3810
|
-
|
|
3811
5055
|
// ../renderers/src/step/StepHeader.tsx
|
|
3812
|
-
var
|
|
3813
|
-
var
|
|
5056
|
+
var import_components60 = require("@transferwise/components");
|
|
5057
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
3814
5058
|
var StepHeader = ({ title, description, tags }) => {
|
|
3815
5059
|
const { titleType, alignmentClassName } = getHeaderStyle(tags);
|
|
3816
|
-
return /* @__PURE__ */ (0,
|
|
3817
|
-
title ? /* @__PURE__ */ (0,
|
|
3818
|
-
description ? /* @__PURE__ */ (0,
|
|
5060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
5061
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components60.Title, { as: "h1", type: titleType, className: `${alignmentClassName} m-b-2`, children: title }) : void 0,
|
|
5062
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("p", { className: `${alignmentClassName} np-text-body-large`, children: description }) : void 0
|
|
3819
5063
|
] });
|
|
3820
5064
|
};
|
|
3821
5065
|
var getHeaderStyle = (tags) => {
|
|
@@ -3826,8 +5070,8 @@ var getHeaderStyle = (tags) => {
|
|
|
3826
5070
|
};
|
|
3827
5071
|
|
|
3828
5072
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3829
|
-
var
|
|
3830
|
-
var
|
|
5073
|
+
var import_components61 = require("@transferwise/components");
|
|
5074
|
+
var import_icons6 = require("@transferwise/icons");
|
|
3831
5075
|
var import_react_intl27 = require("react-intl");
|
|
3832
5076
|
|
|
3833
5077
|
// ../renderers/src/messages/back.messages.ts
|
|
@@ -3841,31 +5085,31 @@ var back_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
3841
5085
|
});
|
|
3842
5086
|
|
|
3843
5087
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3844
|
-
var
|
|
5088
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
3845
5089
|
function BackButton({ title, onClick }) {
|
|
3846
5090
|
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
3847
|
-
return /* @__PURE__ */ (0,
|
|
3848
|
-
/* @__PURE__ */ (0,
|
|
3849
|
-
/* @__PURE__ */ (0,
|
|
5091
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(import_components61.IconButton, { className: "df-back-button", priority: "tertiary", onClick, children: [
|
|
5092
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "sr-only", children: title != null ? title : formatMessage(back_messages_default.back) }),
|
|
5093
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_icons6.ArrowLeft, {})
|
|
3850
5094
|
] });
|
|
3851
5095
|
}
|
|
3852
5096
|
|
|
3853
5097
|
// ../renderers/src/step/topbar/Toolbar.tsx
|
|
3854
|
-
var
|
|
3855
|
-
var
|
|
5098
|
+
var import_components62 = require("@transferwise/components");
|
|
5099
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
3856
5100
|
var Toolbar = ({ items }) => {
|
|
3857
|
-
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0,
|
|
5101
|
+
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;
|
|
3858
5102
|
};
|
|
3859
5103
|
function ToolbarButton(props) {
|
|
3860
|
-
return prefersMedia(props.control) ? /* @__PURE__ */ (0,
|
|
5104
|
+
return prefersMedia(props.control) ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(MediaToolbarButton, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TextToolbarButton, __spreadValues({}, props));
|
|
3861
5105
|
}
|
|
3862
5106
|
function MediaToolbarButton(props) {
|
|
3863
5107
|
var _a;
|
|
3864
5108
|
const { context, control, media, accessibilityDescription, disabled, onClick } = props;
|
|
3865
5109
|
const priority = getIconButtonPriority(control);
|
|
3866
5110
|
const type = getSentiment2(context);
|
|
3867
|
-
return /* @__PURE__ */ (0,
|
|
3868
|
-
|
|
5111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(
|
|
5112
|
+
import_components62.IconButton,
|
|
3869
5113
|
{
|
|
3870
5114
|
className: "df-toolbar-button",
|
|
3871
5115
|
disabled,
|
|
@@ -3874,7 +5118,7 @@ function MediaToolbarButton(props) {
|
|
|
3874
5118
|
type,
|
|
3875
5119
|
onClick,
|
|
3876
5120
|
children: [
|
|
3877
|
-
accessibilityDescription ? /* @__PURE__ */ (0,
|
|
5121
|
+
accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
|
|
3878
5122
|
media ? (_a = getAddonStartMedia(media)) == null ? void 0 : _a.value : null
|
|
3879
5123
|
]
|
|
3880
5124
|
}
|
|
@@ -3885,8 +5129,8 @@ function TextToolbarButton(props) {
|
|
|
3885
5129
|
const addonStart = media ? getAddonStartMedia(media) : void 0;
|
|
3886
5130
|
const priority = getPriority2(control);
|
|
3887
5131
|
const sentiment = getSentiment2(context);
|
|
3888
|
-
return /* @__PURE__ */ (0,
|
|
3889
|
-
|
|
5132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
5133
|
+
import_components62.Button,
|
|
3890
5134
|
{
|
|
3891
5135
|
v2: true,
|
|
3892
5136
|
size: "sm",
|
|
@@ -3915,18 +5159,18 @@ var getIconButtonPriority = (control) => {
|
|
|
3915
5159
|
};
|
|
3916
5160
|
|
|
3917
5161
|
// ../renderers/src/step/topbar/TopBar.tsx
|
|
3918
|
-
var
|
|
5162
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
3919
5163
|
function TopBar({ back, toolbar, tags }) {
|
|
3920
5164
|
const isBackAllowed = !(tags == null ? void 0 : tags.includes("non-dismissible"));
|
|
3921
5165
|
const backCTA = isBackAllowed ? back : void 0;
|
|
3922
|
-
return backCTA || toolbar ? /* @__PURE__ */ (0,
|
|
3923
|
-
backCTA ? /* @__PURE__ */ (0,
|
|
3924
|
-
toolbar ? /* @__PURE__ */ (0,
|
|
5166
|
+
return backCTA || toolbar ? /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("div", { className: "d-flex m-b-2", children: [
|
|
5167
|
+
backCTA ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(BackButton, __spreadValues({}, backCTA)) : null,
|
|
5168
|
+
toolbar ? /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Toolbar, __spreadValues({}, toolbar)) : null
|
|
3925
5169
|
] }) : null;
|
|
3926
5170
|
}
|
|
3927
5171
|
|
|
3928
5172
|
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3929
|
-
var
|
|
5173
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
3930
5174
|
var SplashCelebrationStepRenderer = {
|
|
3931
5175
|
canRenderType: "step",
|
|
3932
5176
|
canRender: ({ control }) => control === "splash-celebration",
|
|
@@ -3935,16 +5179,16 @@ var SplashCelebrationStepRenderer = {
|
|
|
3935
5179
|
function SplashCelebrationStepRendererComponent(props) {
|
|
3936
5180
|
const { back, title, description, toolbar, children, footer, tags, trackEvent } = props;
|
|
3937
5181
|
useCustomTheme("forest-green", trackEvent);
|
|
3938
|
-
return /* @__PURE__ */ (0,
|
|
3939
|
-
/* @__PURE__ */ (0,
|
|
3940
|
-
title || description ? /* @__PURE__ */ (0,
|
|
5182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
5183
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(TopBar, { back, toolbar, tags }),
|
|
5184
|
+
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,
|
|
3941
5185
|
children,
|
|
3942
|
-
/* @__PURE__ */ (0,
|
|
5186
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(StepFooter, { footer, tags })
|
|
3943
5187
|
] });
|
|
3944
5188
|
}
|
|
3945
5189
|
|
|
3946
5190
|
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3947
|
-
var
|
|
5191
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
3948
5192
|
var SplashStepRenderer = {
|
|
3949
5193
|
canRenderType: "step",
|
|
3950
5194
|
canRender: ({ control }) => control === "splash",
|
|
@@ -3952,63 +5196,63 @@ var SplashStepRenderer = {
|
|
|
3952
5196
|
};
|
|
3953
5197
|
function SplashStepRendererComponent(props) {
|
|
3954
5198
|
const { back, title, description, toolbar, children, footer, tags } = props;
|
|
3955
|
-
return /* @__PURE__ */ (0,
|
|
3956
|
-
/* @__PURE__ */ (0,
|
|
3957
|
-
title || description ? /* @__PURE__ */ (0,
|
|
5199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
5200
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TopBar, { back, toolbar, tags }),
|
|
5201
|
+
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,
|
|
3958
5202
|
children,
|
|
3959
|
-
/* @__PURE__ */ (0,
|
|
5203
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(StepFooter, { footer, tags })
|
|
3960
5204
|
] });
|
|
3961
5205
|
}
|
|
3962
5206
|
|
|
3963
5207
|
// ../renderers/src/step/StepRenderer.tsx
|
|
3964
|
-
var
|
|
3965
|
-
var
|
|
5208
|
+
var import_components63 = require("@transferwise/components");
|
|
5209
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
3966
5210
|
var StepRenderer = {
|
|
3967
5211
|
canRenderType: "step",
|
|
3968
5212
|
render: StepRendererComponent
|
|
3969
5213
|
};
|
|
3970
5214
|
function StepRendererComponent(props) {
|
|
3971
5215
|
const { back, description, error, title, children, toolbar, footer, tags } = props;
|
|
3972
|
-
return /* @__PURE__ */ (0,
|
|
3973
|
-
/* @__PURE__ */ (0,
|
|
3974
|
-
title || description ? /* @__PURE__ */ (0,
|
|
3975
|
-
error ? /* @__PURE__ */ (0,
|
|
5216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { children: [
|
|
5217
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(TopBar, { back, toolbar, tags }),
|
|
5218
|
+
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,
|
|
5219
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(import_components63.Alert, { type: "negative", className: "m-b-2", message: error }) : null,
|
|
3976
5220
|
children,
|
|
3977
|
-
/* @__PURE__ */ (0,
|
|
5221
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(StepFooter, { footer, tags })
|
|
3978
5222
|
] });
|
|
3979
5223
|
}
|
|
3980
5224
|
|
|
3981
5225
|
// ../renderers/src/TabsRenderer.tsx
|
|
3982
|
-
var
|
|
3983
|
-
var
|
|
3984
|
-
var
|
|
5226
|
+
var import_components64 = require("@transferwise/components");
|
|
5227
|
+
var import_react22 = require("react");
|
|
5228
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
3985
5229
|
var TabsRenderer = {
|
|
3986
5230
|
canRenderType: "tabs",
|
|
3987
5231
|
render: (props) => {
|
|
3988
5232
|
switch (props.control) {
|
|
3989
5233
|
case "segmented":
|
|
3990
5234
|
if (props.tabs.length > 3) {
|
|
3991
|
-
return /* @__PURE__ */ (0,
|
|
5235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3992
5236
|
}
|
|
3993
|
-
return /* @__PURE__ */ (0,
|
|
5237
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
3994
5238
|
case "chips":
|
|
3995
|
-
return /* @__PURE__ */ (0,
|
|
5239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
3996
5240
|
default:
|
|
3997
|
-
return /* @__PURE__ */ (0,
|
|
5241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3998
5242
|
}
|
|
3999
5243
|
}
|
|
4000
5244
|
};
|
|
4001
5245
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
4002
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4003
|
-
return /* @__PURE__ */ (0,
|
|
4004
|
-
|
|
5246
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
5247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5248
|
+
import_components64.Tabs,
|
|
4005
5249
|
{
|
|
4006
5250
|
name: uid,
|
|
4007
5251
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
4008
5252
|
tabs: tabs.map((option) => ({
|
|
4009
5253
|
title: option.title,
|
|
4010
5254
|
disabled: false,
|
|
4011
|
-
content: /* @__PURE__ */ (0,
|
|
5255
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "m-t-2", children: [
|
|
4012
5256
|
" ",
|
|
4013
5257
|
option.children,
|
|
4014
5258
|
" "
|
|
@@ -4020,10 +5264,10 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
4020
5264
|
}
|
|
4021
5265
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
4022
5266
|
var _a;
|
|
4023
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4024
|
-
return /* @__PURE__ */ (0,
|
|
4025
|
-
/* @__PURE__ */ (0,
|
|
4026
|
-
|
|
5267
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
5268
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getMargin(margin), children: [
|
|
5269
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5270
|
+
import_components64.SegmentedControl,
|
|
4027
5271
|
{
|
|
4028
5272
|
name: uid,
|
|
4029
5273
|
value: String(selectedIndex),
|
|
@@ -4037,31 +5281,31 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
4037
5281
|
onChange: (value) => setSelectedIndex(Number(value))
|
|
4038
5282
|
}
|
|
4039
5283
|
),
|
|
4040
|
-
/* @__PURE__ */ (0,
|
|
5284
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
4041
5285
|
] });
|
|
4042
5286
|
}
|
|
4043
5287
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
4044
5288
|
var _a;
|
|
4045
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
4046
|
-
return /* @__PURE__ */ (0,
|
|
4047
|
-
/* @__PURE__ */ (0,
|
|
4048
|
-
|
|
5289
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
|
|
5290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: getMargin(margin), children: [
|
|
5291
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
5292
|
+
import_components64.Chips,
|
|
4049
5293
|
{
|
|
4050
5294
|
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
4051
5295
|
selected: selectedIndex,
|
|
4052
5296
|
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
4053
5297
|
}
|
|
4054
5298
|
) }),
|
|
4055
|
-
/* @__PURE__ */ (0,
|
|
5299
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
4056
5300
|
] });
|
|
4057
5301
|
}
|
|
4058
5302
|
|
|
4059
5303
|
// ../renderers/src/TextInputRenderer.tsx
|
|
4060
|
-
var
|
|
5304
|
+
var import_components66 = require("@transferwise/components");
|
|
4061
5305
|
|
|
4062
5306
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
4063
|
-
var
|
|
4064
|
-
var
|
|
5307
|
+
var import_components65 = require("@transferwise/components");
|
|
5308
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
4065
5309
|
var commonKeys = [
|
|
4066
5310
|
"autoComplete",
|
|
4067
5311
|
"autoCapitalize",
|
|
@@ -4080,12 +5324,12 @@ function VariableTextInput(inputProps) {
|
|
|
4080
5324
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
4081
5325
|
switch (control) {
|
|
4082
5326
|
case "email":
|
|
4083
|
-
return /* @__PURE__ */ (0,
|
|
5327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
4084
5328
|
case "password":
|
|
4085
|
-
return /* @__PURE__ */ (0,
|
|
5329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
4086
5330
|
case "numeric": {
|
|
4087
5331
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
4088
|
-
return /* @__PURE__ */ (0,
|
|
5332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
4089
5333
|
TextInput,
|
|
4090
5334
|
__spreadProps(__spreadValues({}, numericProps), {
|
|
4091
5335
|
onChange: (newValue) => {
|
|
@@ -4096,21 +5340,21 @@ function VariableTextInput(inputProps) {
|
|
|
4096
5340
|
);
|
|
4097
5341
|
}
|
|
4098
5342
|
case "phone-number":
|
|
4099
|
-
return /* @__PURE__ */ (0,
|
|
5343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components65.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
4100
5344
|
default: {
|
|
4101
|
-
return /* @__PURE__ */ (0,
|
|
5345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
4102
5346
|
}
|
|
4103
5347
|
}
|
|
4104
5348
|
}
|
|
4105
5349
|
function TextInput(props) {
|
|
4106
5350
|
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
4107
|
-
const InputWithPattern = control === "textarea" ?
|
|
4108
|
-
const InputWithoutPattern = control === "textarea" ?
|
|
4109
|
-
return displayFormat ? /* @__PURE__ */ (0,
|
|
5351
|
+
const InputWithPattern = control === "textarea" ? import_components65.TextareaWithDisplayFormat : import_components65.InputWithDisplayFormat;
|
|
5352
|
+
const InputWithoutPattern = control === "textarea" ? import_components65.TextArea : import_components65.Input;
|
|
5353
|
+
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) }));
|
|
4110
5354
|
}
|
|
4111
5355
|
|
|
4112
5356
|
// ../renderers/src/TextInputRenderer.tsx
|
|
4113
|
-
var
|
|
5357
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
4114
5358
|
var TextInputRenderer = {
|
|
4115
5359
|
canRenderType: "input-text",
|
|
4116
5360
|
render: (props) => {
|
|
@@ -4143,7 +5387,7 @@ var TextInputRenderer = {
|
|
|
4143
5387
|
}
|
|
4144
5388
|
}
|
|
4145
5389
|
});
|
|
4146
|
-
return /* @__PURE__ */ (0,
|
|
5390
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
4147
5391
|
FieldInput_default,
|
|
4148
5392
|
{
|
|
4149
5393
|
id,
|
|
@@ -4154,7 +5398,7 @@ var TextInputRenderer = {
|
|
|
4154
5398
|
loadingState: props.fieldLoadingState,
|
|
4155
5399
|
help,
|
|
4156
5400
|
features: props.features,
|
|
4157
|
-
children: /* @__PURE__ */ (0,
|
|
5401
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_components66.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
4158
5402
|
}
|
|
4159
5403
|
);
|
|
4160
5404
|
}
|
|
@@ -4162,13 +5406,13 @@ var TextInputRenderer = {
|
|
|
4162
5406
|
var TextInputRenderer_default = TextInputRenderer;
|
|
4163
5407
|
|
|
4164
5408
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
4165
|
-
var
|
|
5409
|
+
var import_components67 = require("@transferwise/components");
|
|
4166
5410
|
|
|
4167
5411
|
// ../renderers/src/utils/getRandomId.ts
|
|
4168
5412
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
4169
5413
|
|
|
4170
5414
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
4171
|
-
var
|
|
5415
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
4172
5416
|
var UploadInputRenderer = {
|
|
4173
5417
|
canRenderType: "input-upload",
|
|
4174
5418
|
render: (props) => {
|
|
@@ -4195,7 +5439,7 @@ var UploadInputRenderer = {
|
|
|
4195
5439
|
};
|
|
4196
5440
|
return (
|
|
4197
5441
|
// We don't pass help here as there is no sensible place to display it
|
|
4198
|
-
/* @__PURE__ */ (0,
|
|
5442
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
4199
5443
|
UploadFieldInput_default,
|
|
4200
5444
|
{
|
|
4201
5445
|
id,
|
|
@@ -4203,8 +5447,8 @@ var UploadInputRenderer = {
|
|
|
4203
5447
|
description: void 0,
|
|
4204
5448
|
validation: validationState,
|
|
4205
5449
|
features,
|
|
4206
|
-
children: /* @__PURE__ */ (0,
|
|
4207
|
-
|
|
5450
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
5451
|
+
import_components67.UploadInput,
|
|
4208
5452
|
{
|
|
4209
5453
|
id,
|
|
4210
5454
|
description,
|
|
@@ -4214,7 +5458,7 @@ var UploadInputRenderer = {
|
|
|
4214
5458
|
{
|
|
4215
5459
|
id: "my-file",
|
|
4216
5460
|
filename: value.name,
|
|
4217
|
-
status: (validationState == null ? void 0 : validationState.status) === "invalid" ?
|
|
5461
|
+
status: (validationState == null ? void 0 : validationState.status) === "invalid" ? import_components67.Status.FAILED : import_components67.Status.SUCCEEDED
|
|
4218
5462
|
}
|
|
4219
5463
|
] : void 0,
|
|
4220
5464
|
fileTypes: acceptsToFileTypes(accepts),
|
|
@@ -4271,7 +5515,7 @@ var LargeUploadRenderer = {
|
|
|
4271
5515
|
};
|
|
4272
5516
|
const filetypes = acceptsToFileTypes(accepts);
|
|
4273
5517
|
const usAccept = filetypes === "*" ? "*" : filetypes.join(",");
|
|
4274
|
-
return /* @__PURE__ */ (0,
|
|
5518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
4275
5519
|
FieldInput_default,
|
|
4276
5520
|
{
|
|
4277
5521
|
id,
|
|
@@ -4280,8 +5524,8 @@ var LargeUploadRenderer = {
|
|
|
4280
5524
|
validation: validationState,
|
|
4281
5525
|
help,
|
|
4282
5526
|
features,
|
|
4283
|
-
children: /* @__PURE__ */ (0,
|
|
4284
|
-
|
|
5527
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
5528
|
+
import_components67.Upload,
|
|
4285
5529
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
4286
5530
|
usAccept,
|
|
4287
5531
|
usDisabled: disabled,
|
|
@@ -4296,18 +5540,18 @@ var LargeUploadRenderer = {
|
|
|
4296
5540
|
};
|
|
4297
5541
|
|
|
4298
5542
|
// ../renderers/src/UpsellRenderer.tsx
|
|
4299
|
-
var
|
|
4300
|
-
var
|
|
4301
|
-
var
|
|
5543
|
+
var import_components68 = require("@transferwise/components");
|
|
5544
|
+
var import_react23 = require("react");
|
|
5545
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
4302
5546
|
var UpsellRenderer = {
|
|
4303
5547
|
canRenderType: "upsell",
|
|
4304
5548
|
render: UpsellRendererComponent
|
|
4305
5549
|
};
|
|
4306
5550
|
function UpsellRendererComponent(props) {
|
|
4307
5551
|
const { text, callToAction, media, margin, onDismiss } = props;
|
|
4308
|
-
const [isVisible, setIsVisible] = (0,
|
|
4309
|
-
return isVisible ? /* @__PURE__ */ (0,
|
|
4310
|
-
|
|
5552
|
+
const [isVisible, setIsVisible] = (0, import_react23.useState)(true);
|
|
5553
|
+
return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
5554
|
+
import_components68.Nudge,
|
|
4311
5555
|
{
|
|
4312
5556
|
className: getMargin(margin),
|
|
4313
5557
|
mediaName: getMediaName(media),
|
|
@@ -4353,9 +5597,9 @@ var supportedMediaNames = [
|
|
|
4353
5597
|
];
|
|
4354
5598
|
|
|
4355
5599
|
// ../renderers/src/ButtonRenderer/CircularButtonRenderer.tsx
|
|
4356
|
-
var
|
|
5600
|
+
var import_components69 = require("@transferwise/components");
|
|
4357
5601
|
var import_classnames8 = __toESM(require_classnames());
|
|
4358
|
-
var
|
|
5602
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
4359
5603
|
var CircularButtonRenderer = {
|
|
4360
5604
|
canRenderType: "button",
|
|
4361
5605
|
canRender: ({ control }) => control === "circular",
|
|
@@ -4365,8 +5609,8 @@ function CircularButtonComponent(props) {
|
|
|
4365
5609
|
var _a;
|
|
4366
5610
|
const { context, disabled, margin, media, tags, title, onClick } = props;
|
|
4367
5611
|
const priority = tags == null ? void 0 : tags.find((tag) => tag === "primary" || tag === "secondary");
|
|
4368
|
-
return /* @__PURE__ */ (0,
|
|
4369
|
-
|
|
5612
|
+
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)(
|
|
5613
|
+
import_components69.CircularButton,
|
|
4370
5614
|
{
|
|
4371
5615
|
disabled,
|
|
4372
5616
|
priority: priority != null ? priority : "secondary",
|
|
@@ -4385,6 +5629,7 @@ var getWiseRenderers = () => [
|
|
|
4385
5629
|
CheckboxInputRenderer_default,
|
|
4386
5630
|
CircularButtonRenderer,
|
|
4387
5631
|
BoxRenderer_default,
|
|
5632
|
+
CollectionRenderer_default,
|
|
4388
5633
|
ButtonRenderer,
|
|
4389
5634
|
ColumnsRenderer_default,
|
|
4390
5635
|
DateInputRenderer_default,
|
|
@@ -4428,13 +5673,13 @@ var getWiseRenderers = () => [
|
|
|
4428
5673
|
];
|
|
4429
5674
|
|
|
4430
5675
|
// ../renderers/src/InitialLoadingStateRenderer.tsx
|
|
4431
|
-
var
|
|
4432
|
-
var
|
|
5676
|
+
var import_components70 = require("@transferwise/components");
|
|
5677
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
4433
5678
|
var InitialLoadingStateRenderer = {
|
|
4434
5679
|
canRenderType: "loading-state",
|
|
4435
5680
|
canRender: ({ stepLoadingState }) => stepLoadingState === "initial",
|
|
4436
|
-
render: () => /* @__PURE__ */ (0,
|
|
4437
|
-
|
|
5681
|
+
render: () => /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
5682
|
+
import_components70.Loader,
|
|
4438
5683
|
{
|
|
4439
5684
|
size: "md",
|
|
4440
5685
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin("md")}` },
|
|
@@ -4445,25 +5690,25 @@ var InitialLoadingStateRenderer = {
|
|
|
4445
5690
|
|
|
4446
5691
|
// src/dynamicFlow/DynamicFlowModal.tsx
|
|
4447
5692
|
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
4448
|
-
var
|
|
4449
|
-
var
|
|
5693
|
+
var import_components71 = require("@transferwise/components");
|
|
5694
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
4450
5695
|
function DynamicFlowModal(props) {
|
|
4451
5696
|
const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
|
|
4452
5697
|
const dfProps = useWiseToCoreProps(rest);
|
|
4453
5698
|
const df = (0, import_dynamic_flow_client.useDynamicFlowModal)(dfProps);
|
|
4454
|
-
return /* @__PURE__ */ (0,
|
|
4455
|
-
|
|
5699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
5700
|
+
import_components71.Modal,
|
|
4456
5701
|
__spreadProps(__spreadValues({
|
|
4457
5702
|
className: `dynamic-flow-modal ${className}`,
|
|
4458
5703
|
disableDimmerClickToClose: true
|
|
4459
5704
|
}, df.modal), {
|
|
4460
|
-
body: /* @__PURE__ */ (0,
|
|
5705
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
|
|
4461
5706
|
})
|
|
4462
5707
|
);
|
|
4463
5708
|
}
|
|
4464
5709
|
|
|
4465
5710
|
// src/dynamicFlow/getMergedRenderers.tsx
|
|
4466
|
-
var
|
|
5711
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
4467
5712
|
var wiseRenderers = getWiseRenderers();
|
|
4468
5713
|
var getMergedRenderers = (props) => {
|
|
4469
5714
|
var _d, _e;
|
|
@@ -4477,7 +5722,7 @@ var getMergedRenderers = (props) => {
|
|
|
4477
5722
|
method: initialRequest.method,
|
|
4478
5723
|
data: initialRequest.body
|
|
4479
5724
|
};
|
|
4480
|
-
return presentation.type === "push" ? /* @__PURE__ */ (0,
|
|
5725
|
+
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)(
|
|
4481
5726
|
DynamicFlowModal,
|
|
4482
5727
|
__spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
|
|
4483
5728
|
features: subflowFeatures,
|
|
@@ -4556,7 +5801,7 @@ var customEventsToAnalytics = {
|
|
|
4556
5801
|
};
|
|
4557
5802
|
|
|
4558
5803
|
// src/dynamicFlow/useOnCopy.tsx
|
|
4559
|
-
var
|
|
5804
|
+
var import_react24 = require("react");
|
|
4560
5805
|
var import_react_intl29 = require("react-intl");
|
|
4561
5806
|
|
|
4562
5807
|
// src/dynamicFlow/messages.ts
|
|
@@ -4578,7 +5823,7 @@ var messages_default = (0, import_react_intl28.defineMessages)({
|
|
|
4578
5823
|
var useOnCopy = () => {
|
|
4579
5824
|
const { formatMessage } = (0, import_react_intl29.useIntl)();
|
|
4580
5825
|
const createSnackBar = useSnackBarIfAvailable();
|
|
4581
|
-
return (0,
|
|
5826
|
+
return (0, import_react24.useCallback)(
|
|
4582
5827
|
(copiedContent) => {
|
|
4583
5828
|
if (copiedContent) {
|
|
4584
5829
|
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
@@ -4591,11 +5836,11 @@ var useOnCopy = () => {
|
|
|
4591
5836
|
};
|
|
4592
5837
|
|
|
4593
5838
|
// src/dynamicFlow/useWiseHttpClient.tsx
|
|
4594
|
-
var
|
|
5839
|
+
var import_react25 = require("react");
|
|
4595
5840
|
var import_react_intl30 = require("react-intl");
|
|
4596
5841
|
var useWiseHttpClient = (httpClient) => {
|
|
4597
5842
|
const { locale } = (0, import_react_intl30.useIntl)();
|
|
4598
|
-
return (0,
|
|
5843
|
+
return (0, import_react25.useCallback)(
|
|
4599
5844
|
async (input, init = {}) => {
|
|
4600
5845
|
const headers = new Headers(init.headers);
|
|
4601
5846
|
headers.set("accept-language", locale);
|
|
@@ -4636,10 +5881,10 @@ var useWiseToCoreProps = (props) => {
|
|
|
4636
5881
|
onLog
|
|
4637
5882
|
} = props;
|
|
4638
5883
|
const httpClient = useWiseHttpClient(customFetch);
|
|
4639
|
-
const mergedRenderers = (0,
|
|
5884
|
+
const mergedRenderers = (0, import_react26.useMemo)(() => getMergedRenderers(props), [renderers]);
|
|
4640
5885
|
const createSnackBar = useCreateSnackBar();
|
|
4641
|
-
const logEvent = (0,
|
|
4642
|
-
const trackEvent = (0,
|
|
5886
|
+
const logEvent = (0, import_react26.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
5887
|
+
const trackEvent = (0, import_react26.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
|
|
4643
5888
|
const onCopy = useOnCopy();
|
|
4644
5889
|
return __spreadProps(__spreadValues({}, props), {
|
|
4645
5890
|
httpClient,
|
|
@@ -4671,27 +5916,27 @@ var openLinkInNewTab = (url) => {
|
|
|
4671
5916
|
};
|
|
4672
5917
|
|
|
4673
5918
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
4674
|
-
var
|
|
5919
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
4675
5920
|
function DynamicFlow(props) {
|
|
4676
5921
|
const { className = "" } = props;
|
|
4677
5922
|
const dfProps = useWiseToCoreProps(props);
|
|
4678
5923
|
const df = (0, import_dynamic_flow_client4.useDynamicFlow)(dfProps);
|
|
4679
5924
|
const { onContextMenu, contextMenu } = useDFContextMenu(df.controller);
|
|
4680
|
-
return /* @__PURE__ */ (0,
|
|
5925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className, onContextMenu, children: [
|
|
4681
5926
|
df.view,
|
|
4682
5927
|
contextMenu
|
|
4683
5928
|
] });
|
|
4684
5929
|
}
|
|
4685
5930
|
|
|
4686
5931
|
// src/dynamicFlow/DynamicFlowWithRef.tsx
|
|
4687
|
-
var
|
|
5932
|
+
var import_react27 = require("react");
|
|
4688
5933
|
var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
|
|
4689
|
-
var
|
|
4690
|
-
var DynamicFlowWithRef = (0,
|
|
5934
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
5935
|
+
var DynamicFlowWithRef = (0, import_react27.forwardRef)(function DynamicFlowWithRef2(props, ref) {
|
|
4691
5936
|
const { className = "" } = props;
|
|
4692
5937
|
const dfProps = useWiseToCoreProps(props);
|
|
4693
5938
|
const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
|
|
4694
|
-
(0,
|
|
5939
|
+
(0, import_react27.useImperativeHandle)(
|
|
4695
5940
|
ref,
|
|
4696
5941
|
() => ({
|
|
4697
5942
|
getValue: async () => {
|
|
@@ -4702,14 +5947,14 @@ var DynamicFlowWithRef = (0, import_react26.forwardRef)(function DynamicFlowWith
|
|
|
4702
5947
|
}),
|
|
4703
5948
|
[df]
|
|
4704
5949
|
);
|
|
4705
|
-
return /* @__PURE__ */ (0,
|
|
5950
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className, children: df.view });
|
|
4706
5951
|
});
|
|
4707
5952
|
|
|
4708
5953
|
// src/index.ts
|
|
4709
5954
|
var import_dynamic_flow_client8 = require("@wise/dynamic-flow-client");
|
|
4710
5955
|
|
|
4711
5956
|
// src/dynamicFlow/renderers.tsx
|
|
4712
|
-
var Header10 =
|
|
5957
|
+
var Header10 = Header;
|
|
4713
5958
|
var Media2 = Media;
|
|
4714
5959
|
var getMargin2 = getMargin;
|
|
4715
5960
|
|