@wise/dynamic-flow-client-internal 4.38.0 → 5.0.0-experimental-feace93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +0 -198
- package/build/main.js +1113 -1251
- package/build/main.mjs +1105 -1224
- package/build/types/dynamicFlow/DynamicFlow.d.ts +18 -23
- package/build/types/dynamicFlow/renderers.d.ts +3 -5
- package/build/types/dynamicFlow/telemetry/getLogEvent.d.ts +2 -2
- package/build/types/dynamicFlow/telemetry/getTrackEvent.d.ts +2 -2
- package/build/types/index.d.ts +5 -6
- package/package.json +7 -5
- package/build/types/stories/utils/DynamicFlowSideBySide.d.ts +0 -6
package/build/main.js
CHANGED
|
@@ -34,6 +34,9 @@ var __objRest = (source, exclude) => {
|
|
|
34
34
|
}
|
|
35
35
|
return target;
|
|
36
36
|
};
|
|
37
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
38
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
39
|
+
};
|
|
37
40
|
var __export = (target, all) => {
|
|
38
41
|
for (var name in all)
|
|
39
42
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -56,26 +59,86 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
56
59
|
));
|
|
57
60
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
61
|
|
|
62
|
+
// ../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js
|
|
63
|
+
var require_classnames = __commonJS({
|
|
64
|
+
"../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"(exports, module2) {
|
|
65
|
+
"use strict";
|
|
66
|
+
(function() {
|
|
67
|
+
"use strict";
|
|
68
|
+
var hasOwn = {}.hasOwnProperty;
|
|
69
|
+
function classNames6() {
|
|
70
|
+
var classes = "";
|
|
71
|
+
for (var i = 0; i < arguments.length; i++) {
|
|
72
|
+
var arg = arguments[i];
|
|
73
|
+
if (arg) {
|
|
74
|
+
classes = appendClass(classes, parseValue(arg));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return classes;
|
|
78
|
+
}
|
|
79
|
+
function parseValue(arg) {
|
|
80
|
+
if (typeof arg === "string" || typeof arg === "number") {
|
|
81
|
+
return arg;
|
|
82
|
+
}
|
|
83
|
+
if (typeof arg !== "object") {
|
|
84
|
+
return "";
|
|
85
|
+
}
|
|
86
|
+
if (Array.isArray(arg)) {
|
|
87
|
+
return classNames6.apply(null, arg);
|
|
88
|
+
}
|
|
89
|
+
if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes("[native code]")) {
|
|
90
|
+
return arg.toString();
|
|
91
|
+
}
|
|
92
|
+
var classes = "";
|
|
93
|
+
for (var key in arg) {
|
|
94
|
+
if (hasOwn.call(arg, key) && arg[key]) {
|
|
95
|
+
classes = appendClass(classes, key);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return classes;
|
|
99
|
+
}
|
|
100
|
+
function appendClass(value, newClass) {
|
|
101
|
+
if (!newClass) {
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
if (value) {
|
|
105
|
+
return value + " " + newClass;
|
|
106
|
+
}
|
|
107
|
+
return value + newClass;
|
|
108
|
+
}
|
|
109
|
+
if (typeof module2 !== "undefined" && module2.exports) {
|
|
110
|
+
classNames6.default = classNames6;
|
|
111
|
+
module2.exports = classNames6;
|
|
112
|
+
} else if (typeof define === "function" && typeof define.amd === "object" && define.amd) {
|
|
113
|
+
define("classnames", [], function() {
|
|
114
|
+
return classNames6;
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
window.classNames = classNames6;
|
|
118
|
+
}
|
|
119
|
+
})();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
59
123
|
// src/index.ts
|
|
60
124
|
var index_exports = {};
|
|
61
125
|
__export(index_exports, {
|
|
62
|
-
|
|
63
|
-
DynamicFlowRevamp: () => DynamicFlowRevamp,
|
|
126
|
+
DynamicFlow: () => DynamicFlow,
|
|
64
127
|
DynamicForm: () => DynamicForm,
|
|
65
|
-
Header: () =>
|
|
66
|
-
JsonSchemaForm: () => import_dynamic_flow_client4.JsonSchemaForm,
|
|
128
|
+
Header: () => Header11,
|
|
67
129
|
Media: () => Media2,
|
|
68
130
|
findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
|
|
69
|
-
getButtonV2Renderers: () => getButtonV2Renderers2,
|
|
70
|
-
getListItemRenderers: () => getListItemRenderers2,
|
|
71
131
|
getMargin: () => getMargin2,
|
|
72
|
-
isValidSchema: () => import_dynamic_flow_client4.isValidSchema,
|
|
73
132
|
makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
|
|
74
133
|
translations: () => i18n_default
|
|
75
134
|
});
|
|
76
135
|
module.exports = __toCommonJS(index_exports);
|
|
77
136
|
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
78
|
-
|
|
137
|
+
|
|
138
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
139
|
+
var import_react19 = require("react");
|
|
140
|
+
var import_react_intl27 = require("react-intl");
|
|
141
|
+
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
79
142
|
|
|
80
143
|
// ../renderers/src/AlertRenderer.tsx
|
|
81
144
|
var import_components = require("@transferwise/components");
|
|
@@ -129,14 +192,14 @@ var mapCtaToAlertAction = (callToAction) => {
|
|
|
129
192
|
return __spreadValues(__spreadValues({
|
|
130
193
|
text: callToAction.title,
|
|
131
194
|
"aria-label": callToAction.accessibilityDescription
|
|
132
|
-
}, "onClick" in callToAction ? { onClick: callToAction.onClick } : {}), callToAction.
|
|
195
|
+
}, "onClick" in callToAction ? { onClick: callToAction.onClick } : {}), callToAction.href ? { href: callToAction.href, target: "_blank" } : {});
|
|
133
196
|
}
|
|
134
197
|
return void 0;
|
|
135
198
|
};
|
|
136
199
|
var AlertRenderer_default = AlertRenderer;
|
|
137
200
|
|
|
138
201
|
// ../renderers/src/BoxRenderer.tsx
|
|
139
|
-
var import_classnames = __toESM(
|
|
202
|
+
var import_classnames = __toESM(require_classnames());
|
|
140
203
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
141
204
|
var BoxRenderer = {
|
|
142
205
|
canRenderType: "box",
|
|
@@ -214,7 +277,10 @@ var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
|
|
|
214
277
|
|
|
215
278
|
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
216
279
|
var import_components3 = require("@transferwise/components");
|
|
217
|
-
|
|
280
|
+
|
|
281
|
+
// ../renderers/src/utils/isButtonPriority.ts
|
|
282
|
+
var validPriorities = ["primary", "secondary", "secondary-neutral", "tertiary"];
|
|
283
|
+
var isButtonPriority = (control) => validPriorities.includes(control);
|
|
218
284
|
|
|
219
285
|
// ../renderers/src/ButtonRenderer/mapButtonSize.tsx
|
|
220
286
|
var mapButtonSize = (size) => {
|
|
@@ -235,6 +301,7 @@ var mapButtonSize = (size) => {
|
|
|
235
301
|
};
|
|
236
302
|
|
|
237
303
|
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
304
|
+
var import_react2 = require("react");
|
|
238
305
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
239
306
|
var ButtonRenderer = {
|
|
240
307
|
canRenderType: "button",
|
|
@@ -248,19 +315,18 @@ function ButtonComponent(props) {
|
|
|
248
315
|
setSpinny(false);
|
|
249
316
|
}
|
|
250
317
|
}, [stepLoadingState]);
|
|
251
|
-
const priority = getPriority(control);
|
|
252
|
-
const type = getButtonType(context, priority);
|
|
253
318
|
const loading = spinny && stepLoadingState !== "idle";
|
|
254
319
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
255
320
|
import_components3.Button,
|
|
256
321
|
{
|
|
322
|
+
v2: true,
|
|
257
323
|
block: true,
|
|
258
324
|
className: getMargin(margin),
|
|
259
325
|
disabled,
|
|
260
|
-
priority,
|
|
261
|
-
size: mapButtonSize(size),
|
|
326
|
+
priority: getPriority(control),
|
|
262
327
|
loading,
|
|
263
|
-
|
|
328
|
+
size: mapButtonSize(size),
|
|
329
|
+
sentiment: getSentiment(context),
|
|
264
330
|
onClick: () => {
|
|
265
331
|
setSpinny(true);
|
|
266
332
|
onClick();
|
|
@@ -269,27 +335,8 @@ function ButtonComponent(props) {
|
|
|
269
335
|
}
|
|
270
336
|
);
|
|
271
337
|
}
|
|
272
|
-
var
|
|
273
|
-
|
|
274
|
-
case "primary":
|
|
275
|
-
case "tertiary":
|
|
276
|
-
return control;
|
|
277
|
-
default:
|
|
278
|
-
return "secondary";
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
var getButtonType = (context, priority) => {
|
|
282
|
-
if (priority === "tertiary") {
|
|
283
|
-
return void 0;
|
|
284
|
-
}
|
|
285
|
-
switch (context) {
|
|
286
|
-
case "neutral":
|
|
287
|
-
case "warning":
|
|
288
|
-
return "accent";
|
|
289
|
-
default:
|
|
290
|
-
return context;
|
|
291
|
-
}
|
|
292
|
-
};
|
|
338
|
+
var getSentiment = (context) => context === "negative" ? "negative" : "default";
|
|
339
|
+
var getPriority = (control) => control && isButtonPriority(control) ? control : "secondary";
|
|
293
340
|
|
|
294
341
|
// ../renderers/src/components/FieldInput.tsx
|
|
295
342
|
var import_components5 = require("@transferwise/components");
|
|
@@ -651,11 +698,11 @@ function OptionMedia(props) {
|
|
|
651
698
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
652
699
|
var getInlineMedia = (media) => media ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Media, { media, preferAvatar: false, size: 24 }) : null;
|
|
653
700
|
|
|
654
|
-
// ../renderers/src/
|
|
701
|
+
// ../renderers/src/utils/listItem/getMedia.tsx
|
|
655
702
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
656
703
|
var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(OptionMedia, { media, preferAvatar }) : void 0;
|
|
657
704
|
|
|
658
|
-
// ../renderers/src/
|
|
705
|
+
// ../renderers/src/utils/listItem/getAdditionalText.tsx
|
|
659
706
|
var import_components9 = require("@transferwise/components");
|
|
660
707
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
661
708
|
var getAdditionalText = (additionalText) => {
|
|
@@ -665,12 +712,12 @@ var getAdditionalText = (additionalText) => {
|
|
|
665
712
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components9.ListItem.AdditionalInfo, { children: additionalText });
|
|
666
713
|
};
|
|
667
714
|
|
|
668
|
-
// ../renderers/src/
|
|
715
|
+
// ../renderers/src/utils/listItem/getSupportingValues.ts
|
|
669
716
|
var getSupportingValues = (supportingValues) => {
|
|
670
717
|
return __spreadValues(__spreadValues({}, (supportingValues == null ? void 0 : supportingValues.value) ? { valueTitle: supportingValues.value } : {}), (supportingValues == null ? void 0 : supportingValues.subvalue) ? { valueSubtitle: supportingValues.subvalue } : {});
|
|
671
718
|
};
|
|
672
719
|
|
|
673
|
-
// ../renderers/src/
|
|
720
|
+
// ../renderers/src/utils/listItem/getInlineAlert.tsx
|
|
674
721
|
var import_components10 = require("@transferwise/components");
|
|
675
722
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
676
723
|
var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components10.ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
|
|
@@ -775,7 +822,7 @@ var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
|
775
822
|
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
776
823
|
|
|
777
824
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
778
|
-
var import_classnames2 = __toESM(
|
|
825
|
+
var import_classnames2 = __toESM(require_classnames());
|
|
779
826
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
780
827
|
var ColumnsRenderer = {
|
|
781
828
|
canRenderType: "columns",
|
|
@@ -912,222 +959,9 @@ var DateInputRenderer = {
|
|
|
912
959
|
};
|
|
913
960
|
var DateInputRenderer_default = DateInputRenderer;
|
|
914
961
|
|
|
915
|
-
// ../renderers/src/
|
|
916
|
-
var import_components15 = require("@transferwise/components");
|
|
917
|
-
|
|
918
|
-
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
919
|
-
var import_components14 = require("@transferwise/components");
|
|
920
|
-
var import_react3 = require("react");
|
|
921
|
-
var import_react_intl8 = require("react-intl");
|
|
922
|
-
|
|
923
|
-
// ../renderers/src/messages/filter.messages.ts
|
|
924
|
-
var import_react_intl5 = require("react-intl");
|
|
925
|
-
var filter_messages_default = (0, import_react_intl5.defineMessages)({
|
|
926
|
-
placeholder: {
|
|
927
|
-
id: "df.wise.filter.placeholder",
|
|
928
|
-
defaultMessage: "Start typing to search",
|
|
929
|
-
description: "Placeholder for the filter input"
|
|
930
|
-
},
|
|
931
|
-
results: {
|
|
932
|
-
id: "df.wise.filter.results",
|
|
933
|
-
defaultMessage: "Search results",
|
|
934
|
-
description: "Label for the results section"
|
|
935
|
-
},
|
|
936
|
-
noResults: {
|
|
937
|
-
id: "df.wise.filter.noResults",
|
|
938
|
-
defaultMessage: "No results",
|
|
939
|
-
description: "Message for if there are no results"
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
|
|
943
|
-
// ../renderers/src/DecisionRenderer/filter-and-sort-decision-options.ts
|
|
944
|
-
function filterAndSortDecisionOptions(selectOptions, query) {
|
|
945
|
-
const upperQuery = normalizeAndRemoveAccents(query);
|
|
946
|
-
const filteredItems = selectOptions.filter((option) => {
|
|
947
|
-
var _a, _b, _c, _d;
|
|
948
|
-
const searchableWords = [
|
|
949
|
-
option.title,
|
|
950
|
-
option.description,
|
|
951
|
-
option.additionalText,
|
|
952
|
-
(_a = option.supportingValues) == null ? void 0 : _a.value,
|
|
953
|
-
(_b = option.supportingValues) == null ? void 0 : _b.subvalue,
|
|
954
|
-
...(_c = option.keywords) != null ? _c : []
|
|
955
|
-
];
|
|
956
|
-
return (_d = searchableWords.some(
|
|
957
|
-
(word) => word && normalizeAndRemoveAccents(word).includes(upperQuery)
|
|
958
|
-
)) != null ? _d : false;
|
|
959
|
-
});
|
|
960
|
-
return [...filteredItems].sort((a, b) => {
|
|
961
|
-
if (a.disabled && !b.disabled) {
|
|
962
|
-
return 1;
|
|
963
|
-
}
|
|
964
|
-
if (!a.disabled && b.disabled) {
|
|
965
|
-
return -1;
|
|
966
|
-
}
|
|
967
|
-
const aTitleUpper = a.title.toUpperCase();
|
|
968
|
-
const bTitleUpper = b.title.toUpperCase();
|
|
969
|
-
const aTitleStarts = aTitleUpper.startsWith(upperQuery);
|
|
970
|
-
const bTitleStarts = bTitleUpper.startsWith(upperQuery);
|
|
971
|
-
if (aTitleStarts && !bTitleStarts) {
|
|
972
|
-
return -1;
|
|
973
|
-
}
|
|
974
|
-
if (!aTitleStarts && bTitleStarts) {
|
|
975
|
-
return 1;
|
|
976
|
-
}
|
|
977
|
-
const aWordStarts = aTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
978
|
-
const bWordStarts = bTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
979
|
-
if (aWordStarts && !bWordStarts) {
|
|
980
|
-
return -1;
|
|
981
|
-
}
|
|
982
|
-
if (!aWordStarts && bWordStarts) {
|
|
983
|
-
return 1;
|
|
984
|
-
}
|
|
985
|
-
return a.title.localeCompare(b.title);
|
|
986
|
-
});
|
|
987
|
-
}
|
|
988
|
-
var normalizeAndRemoveAccents = (text) => text.trim().toLowerCase().normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "");
|
|
989
|
-
|
|
990
|
-
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
962
|
+
// ../renderers/src/DividerRenderer.tsx
|
|
991
963
|
var import_components13 = require("@transferwise/components");
|
|
992
|
-
var import_react_intl7 = require("react-intl");
|
|
993
|
-
|
|
994
|
-
// ../renderers/src/messages/group.messages.ts
|
|
995
|
-
var import_react_intl6 = require("react-intl");
|
|
996
|
-
var group_messages_default = (0, import_react_intl6.defineMessages)({
|
|
997
|
-
all: {
|
|
998
|
-
id: "df.wise.group.all",
|
|
999
|
-
defaultMessage: "All",
|
|
1000
|
-
description: "Label for the group of options that encompasses all options"
|
|
1001
|
-
},
|
|
1002
|
-
popular: {
|
|
1003
|
-
id: "df.wise.group.popular",
|
|
1004
|
-
defaultMessage: "Popular",
|
|
1005
|
-
description: "Label for the group of options that are tagged as popular"
|
|
1006
|
-
},
|
|
1007
|
-
recent: {
|
|
1008
|
-
id: "df.wise.group.recent",
|
|
1009
|
-
defaultMessage: "Recent",
|
|
1010
|
-
description: "Label for the group of options that are tagged as recent"
|
|
1011
|
-
},
|
|
1012
|
-
"currencies-with-account-details": {
|
|
1013
|
-
id: "df.wise.group.currencies-with-account-details",
|
|
1014
|
-
defaultMessage: "Currencies with account details",
|
|
1015
|
-
description: "Label for the group of options that are tagged as currencies with account details"
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
1018
|
-
|
|
1019
|
-
// ../renderers/src/utils/grouping-utils.ts
|
|
1020
|
-
var getGroupsFromTags = (knownTags, items) => {
|
|
1021
|
-
return knownTags.map((tag) => {
|
|
1022
|
-
return { tag, items: items.filter((item) => {
|
|
1023
|
-
var _a;
|
|
1024
|
-
return (_a = item.tags) == null ? void 0 : _a.includes(tag);
|
|
1025
|
-
}) };
|
|
1026
|
-
}).filter((group) => group.items.length > 0);
|
|
1027
|
-
};
|
|
1028
|
-
|
|
1029
|
-
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
1030
964
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1031
|
-
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
1032
|
-
var isGroupedDecision = (options) => {
|
|
1033
|
-
return getGroupsFromTags(groupingTags, options).length > 0;
|
|
1034
|
-
};
|
|
1035
|
-
var GroupedDecisionList = (_a) => {
|
|
1036
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1037
|
-
const { formatMessage } = (0, import_react_intl7.useIntl)();
|
|
1038
|
-
const { options } = rest;
|
|
1039
|
-
const itemsByTag = [...getGroupsFromTags(groupingTags, options), { tag: "all", items: options }];
|
|
1040
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: itemsByTag.map(({ tag, items }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_components13.Section, { children: [
|
|
1041
|
-
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1042
|
-
import_components13.Header,
|
|
1043
|
-
{
|
|
1044
|
-
as: "h2",
|
|
1045
|
-
title: tag in group_messages_default ? formatMessage(group_messages_default[tag]) : tag
|
|
1046
|
-
}
|
|
1047
|
-
),
|
|
1048
|
-
renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: items }))
|
|
1049
|
-
] }, tag)) });
|
|
1050
|
-
};
|
|
1051
|
-
|
|
1052
|
-
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
1053
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1054
|
-
var DecisionWrapper = (props) => {
|
|
1055
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
1056
|
-
props.title && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components14.Header, { as: "h2", title: props.title }),
|
|
1057
|
-
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
1058
|
-
] });
|
|
1059
|
-
};
|
|
1060
|
-
var UnfilteredDecisionList = (_a) => {
|
|
1061
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
1062
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList3 })) : renderDecisionList3(rest);
|
|
1063
|
-
};
|
|
1064
|
-
var FilteredDecisionList = (props) => {
|
|
1065
|
-
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
1066
|
-
const [query, setQuery] = (0, import_react3.useState)("");
|
|
1067
|
-
const { control, options, renderDecisionList: renderDecisionList3 } = props;
|
|
1068
|
-
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
1069
|
-
const isGrouped = isGroupedDecision(options);
|
|
1070
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1071
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1072
|
-
import_components14.SearchInput,
|
|
1073
|
-
{
|
|
1074
|
-
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
1075
|
-
value: query,
|
|
1076
|
-
className: "m-b-2",
|
|
1077
|
-
onChange: (e) => {
|
|
1078
|
-
var _a;
|
|
1079
|
-
return setQuery((_a = e.target.value) != null ? _a : "");
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
),
|
|
1083
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1084
|
-
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components14.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
1085
|
-
filteredOptions.length > 0 ? renderDecisionList3({
|
|
1086
|
-
control,
|
|
1087
|
-
className: query.length === 0 ? "m-t-3" : "",
|
|
1088
|
-
options: filteredOptions
|
|
1089
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
1090
|
-
] })
|
|
1091
|
-
] });
|
|
1092
|
-
};
|
|
1093
|
-
|
|
1094
|
-
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1095
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1096
|
-
var DecisionRenderer = {
|
|
1097
|
-
canRenderType: "decision",
|
|
1098
|
-
render: (props) => {
|
|
1099
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }));
|
|
1100
|
-
}
|
|
1101
|
-
};
|
|
1102
|
-
var renderDecisionList = ({ options, className, control }) => {
|
|
1103
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components15.NavigationOptionsList, { children: options.map((option) => {
|
|
1104
|
-
const { description, disabled, media, title: itemTitle, tag, onClick } = option;
|
|
1105
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1106
|
-
import_components15.NavigationOption,
|
|
1107
|
-
{
|
|
1108
|
-
title: itemTitle,
|
|
1109
|
-
content: description,
|
|
1110
|
-
disabled,
|
|
1111
|
-
media: media ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1112
|
-
OptionMedia,
|
|
1113
|
-
{
|
|
1114
|
-
media,
|
|
1115
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1116
|
-
}
|
|
1117
|
-
) : null,
|
|
1118
|
-
showMediaCircle: false,
|
|
1119
|
-
showMediaAtAllSizes: true,
|
|
1120
|
-
onClick
|
|
1121
|
-
},
|
|
1122
|
-
JSON.stringify(option)
|
|
1123
|
-
);
|
|
1124
|
-
}) }) });
|
|
1125
|
-
};
|
|
1126
|
-
var DecisionRenderer_default = DecisionRenderer;
|
|
1127
|
-
|
|
1128
|
-
// ../renderers/src/DividerRenderer.tsx
|
|
1129
|
-
var import_components16 = require("@transferwise/components");
|
|
1130
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1131
965
|
var mapControlToLevel = (control) => {
|
|
1132
966
|
switch (control) {
|
|
1133
967
|
case "section":
|
|
@@ -1140,16 +974,16 @@ var mapControlToLevel = (control) => {
|
|
|
1140
974
|
};
|
|
1141
975
|
var DividerRenderer = {
|
|
1142
976
|
canRenderType: "divider",
|
|
1143
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0,
|
|
977
|
+
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components13.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
1144
978
|
};
|
|
1145
979
|
var DividerRenderer_default = DividerRenderer;
|
|
1146
980
|
|
|
1147
981
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1148
|
-
var
|
|
982
|
+
var import_components14 = require("@transferwise/components");
|
|
1149
983
|
|
|
1150
984
|
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1151
|
-
var
|
|
1152
|
-
var external_confirmation_messages_default = (0,
|
|
985
|
+
var import_react_intl5 = require("react-intl");
|
|
986
|
+
var external_confirmation_messages_default = (0, import_react_intl5.defineMessages)({
|
|
1153
987
|
title: {
|
|
1154
988
|
id: "df.wise.ExternalConfirmation.title",
|
|
1155
989
|
defaultMessage: "Please confirm",
|
|
@@ -1173,9 +1007,9 @@ var external_confirmation_messages_default = (0, import_react_intl9.defineMessag
|
|
|
1173
1007
|
});
|
|
1174
1008
|
|
|
1175
1009
|
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1176
|
-
var
|
|
1177
|
-
var
|
|
1178
|
-
var
|
|
1010
|
+
var import_react_intl6 = require("react-intl");
|
|
1011
|
+
var import_react3 = require("react");
|
|
1012
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1179
1013
|
var ExternalConfirmationRenderer = {
|
|
1180
1014
|
canRenderType: "external-confirmation",
|
|
1181
1015
|
render: ExternalConfirmationRendererComponent
|
|
@@ -1187,8 +1021,8 @@ function ExternalConfirmationRendererComponent({
|
|
|
1187
1021
|
onFailure,
|
|
1188
1022
|
onCancel
|
|
1189
1023
|
}) {
|
|
1190
|
-
const { formatMessage } = (0,
|
|
1191
|
-
(0,
|
|
1024
|
+
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
1025
|
+
(0, import_react3.useEffect)(() => {
|
|
1192
1026
|
if (url) {
|
|
1193
1027
|
const w = window.open(url, "_blank");
|
|
1194
1028
|
if (w) {
|
|
@@ -1198,16 +1032,16 @@ function ExternalConfirmationRendererComponent({
|
|
|
1198
1032
|
}
|
|
1199
1033
|
}
|
|
1200
1034
|
}, []);
|
|
1201
|
-
return /* @__PURE__ */ (0,
|
|
1202
|
-
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1036
|
+
import_components14.Modal,
|
|
1203
1037
|
{
|
|
1204
1038
|
open: status === "failure",
|
|
1205
1039
|
title: formatMessage(external_confirmation_messages_default.title),
|
|
1206
|
-
body: /* @__PURE__ */ (0,
|
|
1207
|
-
/* @__PURE__ */ (0,
|
|
1208
|
-
/* @__PURE__ */ (0,
|
|
1209
|
-
/* @__PURE__ */ (0,
|
|
1210
|
-
|
|
1040
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1041
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
1042
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
1043
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1044
|
+
import_components14.Button,
|
|
1211
1045
|
{
|
|
1212
1046
|
v2: true,
|
|
1213
1047
|
block: true,
|
|
@@ -1221,7 +1055,7 @@ function ExternalConfirmationRendererComponent({
|
|
|
1221
1055
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
1222
1056
|
}
|
|
1223
1057
|
),
|
|
1224
|
-
/* @__PURE__ */ (0,
|
|
1058
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components14.Button, { v2: true, block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
1225
1059
|
] }) })
|
|
1226
1060
|
] }),
|
|
1227
1061
|
onClose: onCancel
|
|
@@ -1238,46 +1072,46 @@ function getOrigin(url) {
|
|
|
1238
1072
|
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1239
1073
|
|
|
1240
1074
|
// ../renderers/src/FormRenderer.tsx
|
|
1241
|
-
var
|
|
1075
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1242
1076
|
var FormRenderer = {
|
|
1243
1077
|
canRenderType: "form",
|
|
1244
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0,
|
|
1078
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getMargin(margin), children })
|
|
1245
1079
|
};
|
|
1246
1080
|
var FormRenderer_default = FormRenderer;
|
|
1247
1081
|
|
|
1248
1082
|
// ../renderers/src/FormSectionRenderer.tsx
|
|
1249
|
-
var
|
|
1250
|
-
var
|
|
1083
|
+
var import_components15 = require("@transferwise/components");
|
|
1084
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1251
1085
|
var FormSectionRenderer = {
|
|
1252
1086
|
canRenderType: "form-section",
|
|
1253
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0,
|
|
1254
|
-
title && /* @__PURE__ */ (0,
|
|
1255
|
-
|
|
1087
|
+
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("fieldset", { children: [
|
|
1088
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1089
|
+
import_components15.Header,
|
|
1256
1090
|
{
|
|
1257
1091
|
as: "h2",
|
|
1258
1092
|
title
|
|
1259
1093
|
}
|
|
1260
1094
|
),
|
|
1261
|
-
description && /* @__PURE__ */ (0,
|
|
1095
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: description }),
|
|
1262
1096
|
children
|
|
1263
1097
|
] })
|
|
1264
1098
|
};
|
|
1265
1099
|
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1266
1100
|
|
|
1267
1101
|
// ../renderers/src/HeadingRenderer.tsx
|
|
1268
|
-
var
|
|
1269
|
-
var
|
|
1102
|
+
var import_components16 = require("@transferwise/components");
|
|
1103
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1270
1104
|
var HeadingRenderer = {
|
|
1271
1105
|
canRenderType: "heading",
|
|
1272
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1106
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading, __spreadValues({}, props))
|
|
1273
1107
|
};
|
|
1274
1108
|
function Heading(props) {
|
|
1275
1109
|
const { text, size, align, margin, control } = props;
|
|
1276
1110
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1277
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
1111
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StandardHeading, { size, text, className });
|
|
1278
1112
|
}
|
|
1279
1113
|
function DisplayHeading({ size, text, className }) {
|
|
1280
|
-
return /* @__PURE__ */ (0,
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.Display, { type: getDisplayType(size), className, children: text });
|
|
1281
1115
|
}
|
|
1282
1116
|
var getDisplayType = (size) => {
|
|
1283
1117
|
switch (size) {
|
|
@@ -1293,7 +1127,7 @@ var getDisplayType = (size) => {
|
|
|
1293
1127
|
}
|
|
1294
1128
|
};
|
|
1295
1129
|
function StandardHeading({ size, text, className }) {
|
|
1296
|
-
return /* @__PURE__ */ (0,
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1297
1131
|
}
|
|
1298
1132
|
var getTitleTypeBySize = (size) => {
|
|
1299
1133
|
var _a;
|
|
@@ -1309,8 +1143,8 @@ var getTitleTypeBySize = (size) => {
|
|
|
1309
1143
|
var HeadingRenderer_default = HeadingRenderer;
|
|
1310
1144
|
|
|
1311
1145
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1312
|
-
var
|
|
1313
|
-
var
|
|
1146
|
+
var import_components17 = require("@transferwise/components");
|
|
1147
|
+
var import_react4 = require("react");
|
|
1314
1148
|
|
|
1315
1149
|
// ../renderers/src/utils/api-utils.ts
|
|
1316
1150
|
function isRelativePath(url = "") {
|
|
@@ -1320,7 +1154,7 @@ function isRelativePath(url = "") {
|
|
|
1320
1154
|
}
|
|
1321
1155
|
|
|
1322
1156
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1323
|
-
var
|
|
1157
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1324
1158
|
function UrlImage({
|
|
1325
1159
|
accessibilityDescription,
|
|
1326
1160
|
align,
|
|
@@ -1329,14 +1163,14 @@ function UrlImage({
|
|
|
1329
1163
|
uri,
|
|
1330
1164
|
httpClient
|
|
1331
1165
|
}) {
|
|
1332
|
-
const [imageSource, setImageSource] = (0,
|
|
1333
|
-
(0,
|
|
1166
|
+
const [imageSource, setImageSource] = (0, import_react4.useState)("");
|
|
1167
|
+
(0, import_react4.useEffect)(() => {
|
|
1334
1168
|
if (!uri.startsWith("urn:")) {
|
|
1335
1169
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1336
1170
|
}
|
|
1337
1171
|
}, [uri, httpClient]);
|
|
1338
|
-
return /* @__PURE__ */ (0,
|
|
1339
|
-
|
|
1172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1173
|
+
import_components17.Image,
|
|
1340
1174
|
{
|
|
1341
1175
|
className: `img-responsive ${getMargin(margin)}`,
|
|
1342
1176
|
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
@@ -1379,7 +1213,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1379
1213
|
};
|
|
1380
1214
|
|
|
1381
1215
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1382
|
-
var
|
|
1216
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1383
1217
|
var maxFlagSize = 600;
|
|
1384
1218
|
function UrnFlagImage({
|
|
1385
1219
|
accessibilityDescription,
|
|
@@ -1388,12 +1222,12 @@ function UrnFlagImage({
|
|
|
1388
1222
|
size,
|
|
1389
1223
|
uri
|
|
1390
1224
|
}) {
|
|
1391
|
-
return /* @__PURE__ */ (0,
|
|
1225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
1392
1226
|
}
|
|
1393
1227
|
|
|
1394
1228
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1395
1229
|
var import_art4 = require("@wise/art");
|
|
1396
|
-
var
|
|
1230
|
+
var import_react6 = require("react");
|
|
1397
1231
|
|
|
1398
1232
|
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1399
1233
|
var isAnimated = (uri) => {
|
|
@@ -1403,9 +1237,9 @@ var isAnimated = (uri) => {
|
|
|
1403
1237
|
|
|
1404
1238
|
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1405
1239
|
var import_art3 = require("@wise/art");
|
|
1406
|
-
var
|
|
1407
|
-
var
|
|
1408
|
-
var Illustration3DErrorBoundary = class extends
|
|
1240
|
+
var import_react5 = require("react");
|
|
1241
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1242
|
+
var Illustration3DErrorBoundary = class extends import_react5.Component {
|
|
1409
1243
|
constructor(props) {
|
|
1410
1244
|
super(props);
|
|
1411
1245
|
this.state = { hasError: false };
|
|
@@ -1428,12 +1262,12 @@ var SafeIllustration3D = ({
|
|
|
1428
1262
|
size,
|
|
1429
1263
|
onError
|
|
1430
1264
|
}) => {
|
|
1431
|
-
return /* @__PURE__ */ (0,
|
|
1265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
1432
1266
|
};
|
|
1433
1267
|
var SafeIllustration3D_default = SafeIllustration3D;
|
|
1434
1268
|
|
|
1435
1269
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1436
|
-
var
|
|
1270
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1437
1271
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1438
1272
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1439
1273
|
function UrnIllustration({
|
|
@@ -1443,12 +1277,12 @@ function UrnIllustration({
|
|
|
1443
1277
|
size,
|
|
1444
1278
|
uri
|
|
1445
1279
|
}) {
|
|
1446
|
-
const [has3DFailed, setHas3DFailed] = (0,
|
|
1280
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react6.useState)(false);
|
|
1447
1281
|
const illustrationSize = getIllustrationSize(size);
|
|
1448
1282
|
const illustrationName = getIllustrationName(uri);
|
|
1449
1283
|
const illustration3DName = getIllustration3DName(uri);
|
|
1450
1284
|
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
1451
|
-
return /* @__PURE__ */ (0,
|
|
1285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1452
1286
|
SafeIllustration3D_default,
|
|
1453
1287
|
{
|
|
1454
1288
|
name: illustration3DName,
|
|
@@ -1457,7 +1291,7 @@ function UrnIllustration({
|
|
|
1457
1291
|
}
|
|
1458
1292
|
) });
|
|
1459
1293
|
}
|
|
1460
|
-
return /* @__PURE__ */ (0,
|
|
1294
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1461
1295
|
import_art4.Illustration,
|
|
1462
1296
|
{
|
|
1463
1297
|
className: "df-illustration",
|
|
@@ -1477,32 +1311,32 @@ var getIllustration3DName = (uri) => {
|
|
|
1477
1311
|
};
|
|
1478
1312
|
|
|
1479
1313
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1480
|
-
var
|
|
1314
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1481
1315
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1482
1316
|
function UrnImage(props) {
|
|
1483
1317
|
const { uri } = props;
|
|
1484
1318
|
if (isUrnIllustration(uri)) {
|
|
1485
|
-
return /* @__PURE__ */ (0,
|
|
1319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1486
1320
|
}
|
|
1487
1321
|
if (isUrnFlag(uri)) {
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1489
1323
|
}
|
|
1490
1324
|
return null;
|
|
1491
1325
|
}
|
|
1492
1326
|
|
|
1493
1327
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1494
|
-
var
|
|
1328
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1495
1329
|
var ImageRenderer = {
|
|
1496
1330
|
canRenderType: "image",
|
|
1497
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0,
|
|
1331
|
+
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UrlImage, __spreadValues({}, props))
|
|
1498
1332
|
};
|
|
1499
1333
|
|
|
1500
1334
|
// ../renderers/src/ImageRenderer/index.tsx
|
|
1501
1335
|
var ImageRenderer_default = ImageRenderer;
|
|
1502
1336
|
|
|
1503
1337
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1504
|
-
var
|
|
1505
|
-
var
|
|
1338
|
+
var import_components18 = require("@transferwise/components");
|
|
1339
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1506
1340
|
var doContext = ["positive", "neutral"];
|
|
1507
1341
|
var dontContext = ["warning", "negative"];
|
|
1508
1342
|
var InstructionsRenderer = {
|
|
@@ -1510,16 +1344,16 @@ var InstructionsRenderer = {
|
|
|
1510
1344
|
render: ({ items, margin, title }) => {
|
|
1511
1345
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1512
1346
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1513
|
-
return /* @__PURE__ */ (0,
|
|
1514
|
-
title ? /* @__PURE__ */ (0,
|
|
1515
|
-
/* @__PURE__ */ (0,
|
|
1347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getMargin(margin), children: [
|
|
1348
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components18.Header, { title }) : null,
|
|
1349
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components18.InstructionsList, { dos, donts })
|
|
1516
1350
|
] });
|
|
1517
1351
|
}
|
|
1518
1352
|
};
|
|
1519
1353
|
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1520
1354
|
|
|
1521
1355
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1522
|
-
var
|
|
1356
|
+
var import_components19 = require("@transferwise/components");
|
|
1523
1357
|
|
|
1524
1358
|
// ../renderers/src/utils/input-utils.ts
|
|
1525
1359
|
var onWheel = (event) => {
|
|
@@ -1544,7 +1378,7 @@ function pick(obj, ...keys) {
|
|
|
1544
1378
|
}
|
|
1545
1379
|
|
|
1546
1380
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1547
|
-
var
|
|
1381
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1548
1382
|
var IntegerInputRenderer = {
|
|
1549
1383
|
canRenderType: "input-integer",
|
|
1550
1384
|
render: (props) => {
|
|
@@ -1559,7 +1393,7 @@ var IntegerInputRenderer = {
|
|
|
1559
1393
|
"maximum",
|
|
1560
1394
|
"minimum"
|
|
1561
1395
|
);
|
|
1562
|
-
return /* @__PURE__ */ (0,
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1563
1397
|
FieldInput_default,
|
|
1564
1398
|
{
|
|
1565
1399
|
id,
|
|
@@ -1567,8 +1401,8 @@ var IntegerInputRenderer = {
|
|
|
1567
1401
|
description,
|
|
1568
1402
|
validation: validationState,
|
|
1569
1403
|
help,
|
|
1570
|
-
children: /* @__PURE__ */ (0,
|
|
1571
|
-
|
|
1404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components19.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1405
|
+
import_components19.Input,
|
|
1572
1406
|
__spreadValues({
|
|
1573
1407
|
id,
|
|
1574
1408
|
name: id,
|
|
@@ -1589,85 +1423,13 @@ var IntegerInputRenderer = {
|
|
|
1589
1423
|
};
|
|
1590
1424
|
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
1591
1425
|
|
|
1592
|
-
// ../renderers/src/ListRenderer.tsx
|
|
1593
|
-
var import_components23 = require("@transferwise/components");
|
|
1594
|
-
var import_classnames3 = __toESM(require("classnames"));
|
|
1595
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1596
|
-
var ListRenderer = {
|
|
1597
|
-
canRenderType: "list",
|
|
1598
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMargin(margin), children: [
|
|
1599
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components23.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
1600
|
-
items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
1601
|
-
] })
|
|
1602
|
-
};
|
|
1603
|
-
var DesignSystemListItem = ({
|
|
1604
|
-
title,
|
|
1605
|
-
description,
|
|
1606
|
-
supportingValues,
|
|
1607
|
-
icon,
|
|
1608
|
-
image,
|
|
1609
|
-
media,
|
|
1610
|
-
control,
|
|
1611
|
-
tag
|
|
1612
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1613
|
-
"label",
|
|
1614
|
-
{
|
|
1615
|
-
className: (0, import_classnames3.default)("np-option p-a-2", {
|
|
1616
|
-
"np-option__sm-media": true,
|
|
1617
|
-
"np-option__container-aligned": true
|
|
1618
|
-
}),
|
|
1619
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "media", children: [
|
|
1620
|
-
icon || image || media ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "media-left", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1621
|
-
ListItemMedia,
|
|
1622
|
-
{
|
|
1623
|
-
icon,
|
|
1624
|
-
media,
|
|
1625
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1626
|
-
}
|
|
1627
|
-
) }) : null,
|
|
1628
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "media-body", children: [
|
|
1629
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1630
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
1631
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
1632
|
-
] }),
|
|
1633
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1634
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components23.Body, { className: "d-block np-option__body", children: description }),
|
|
1635
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components23.Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
1636
|
-
] })
|
|
1637
|
-
] })
|
|
1638
|
-
] })
|
|
1639
|
-
},
|
|
1640
|
-
title
|
|
1641
|
-
);
|
|
1642
|
-
var ListItemMedia = ({
|
|
1643
|
-
icon,
|
|
1644
|
-
media,
|
|
1645
|
-
preferAvatar
|
|
1646
|
-
}) => {
|
|
1647
|
-
if (icon) {
|
|
1648
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1649
|
-
}
|
|
1650
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1651
|
-
};
|
|
1652
|
-
var getListAction = (callToAction) => {
|
|
1653
|
-
if (callToAction) {
|
|
1654
|
-
return __spreadValues({
|
|
1655
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
1656
|
-
text: callToAction.title,
|
|
1657
|
-
onClick: callToAction.onClick
|
|
1658
|
-
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
1659
|
-
}
|
|
1660
|
-
return void 0;
|
|
1661
|
-
};
|
|
1662
|
-
var ListRenderer_default = ListRenderer;
|
|
1663
|
-
|
|
1664
1426
|
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1665
|
-
var
|
|
1666
|
-
var
|
|
1427
|
+
var import_components20 = require("@transferwise/components");
|
|
1428
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1667
1429
|
var LoadingIndicatorRenderer = {
|
|
1668
1430
|
canRenderType: "loading-indicator",
|
|
1669
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0,
|
|
1670
|
-
|
|
1431
|
+
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1432
|
+
import_components20.Loader,
|
|
1671
1433
|
{
|
|
1672
1434
|
size,
|
|
1673
1435
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
@@ -1678,12 +1440,12 @@ var LoadingIndicatorRenderer = {
|
|
|
1678
1440
|
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1679
1441
|
|
|
1680
1442
|
// ../renderers/src/MarkdownRenderer.tsx
|
|
1681
|
-
var
|
|
1682
|
-
var
|
|
1443
|
+
var import_components21 = require("@transferwise/components");
|
|
1444
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1683
1445
|
var MarkdownRenderer = {
|
|
1684
1446
|
canRenderType: "markdown",
|
|
1685
|
-
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0,
|
|
1686
|
-
|
|
1447
|
+
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1448
|
+
import_components21.Markdown,
|
|
1687
1449
|
{
|
|
1688
1450
|
className: ["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large",
|
|
1689
1451
|
config: { link: { target: "_blank" } },
|
|
@@ -1694,21 +1456,21 @@ var MarkdownRenderer = {
|
|
|
1694
1456
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
1695
1457
|
|
|
1696
1458
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
1697
|
-
var
|
|
1698
|
-
var
|
|
1699
|
-
var
|
|
1459
|
+
var import_components22 = require("@transferwise/components");
|
|
1460
|
+
var import_react7 = require("react");
|
|
1461
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1700
1462
|
var ModalLayoutRenderer = {
|
|
1701
1463
|
canRenderType: "modal-layout",
|
|
1702
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1464
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DFModal, __spreadValues({}, props))
|
|
1703
1465
|
};
|
|
1704
1466
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
1705
1467
|
function DFModal({ content, margin, trigger }) {
|
|
1706
|
-
const [visible, setVisible] = (0,
|
|
1468
|
+
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
1707
1469
|
const { children, title } = content;
|
|
1708
|
-
return /* @__PURE__ */ (0,
|
|
1709
|
-
/* @__PURE__ */ (0,
|
|
1710
|
-
/* @__PURE__ */ (0,
|
|
1711
|
-
|
|
1470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getMargin(margin), children: [
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components22.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
1472
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
1473
|
+
import_components22.Modal,
|
|
1712
1474
|
{
|
|
1713
1475
|
scroll: "content",
|
|
1714
1476
|
open: visible,
|
|
@@ -1722,21 +1484,60 @@ function DFModal({ content, margin, trigger }) {
|
|
|
1722
1484
|
}
|
|
1723
1485
|
|
|
1724
1486
|
// ../renderers/src/ModalRenderer.tsx
|
|
1725
|
-
var
|
|
1726
|
-
var
|
|
1487
|
+
var import_components23 = require("@transferwise/components");
|
|
1488
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1727
1489
|
var ModalRenderer = {
|
|
1728
1490
|
canRenderType: "modal",
|
|
1729
1491
|
render: ({ title, children, open, onClose }) => {
|
|
1730
|
-
return /* @__PURE__ */ (0,
|
|
1492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components23.Modal, { open, title, body: children, onClose });
|
|
1731
1493
|
}
|
|
1732
1494
|
};
|
|
1733
1495
|
|
|
1734
1496
|
// ../renderers/src/MoneyInputRenderer.tsx
|
|
1735
|
-
var
|
|
1736
|
-
var
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
var
|
|
1497
|
+
var import_components24 = require("@transferwise/components");
|
|
1498
|
+
var import_react8 = require("react");
|
|
1499
|
+
|
|
1500
|
+
// ../renderers/src/utils/grouping-utils.ts
|
|
1501
|
+
var getGroupsFromTags = (knownTags, items) => {
|
|
1502
|
+
return knownTags.map((tag) => {
|
|
1503
|
+
return { tag, items: items.filter((item) => {
|
|
1504
|
+
var _a;
|
|
1505
|
+
return (_a = item.tags) == null ? void 0 : _a.includes(tag);
|
|
1506
|
+
}) };
|
|
1507
|
+
}).filter((group) => group.items.length > 0);
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
// ../renderers/src/MoneyInputRenderer.tsx
|
|
1511
|
+
var import_react_intl8 = require("react-intl");
|
|
1512
|
+
|
|
1513
|
+
// ../renderers/src/messages/group.messages.ts
|
|
1514
|
+
var import_react_intl7 = require("react-intl");
|
|
1515
|
+
var group_messages_default = (0, import_react_intl7.defineMessages)({
|
|
1516
|
+
all: {
|
|
1517
|
+
id: "df.wise.group.all",
|
|
1518
|
+
defaultMessage: "All",
|
|
1519
|
+
description: "Label for the group of options that encompasses all options"
|
|
1520
|
+
},
|
|
1521
|
+
popular: {
|
|
1522
|
+
id: "df.wise.group.popular",
|
|
1523
|
+
defaultMessage: "Popular",
|
|
1524
|
+
description: "Label for the group of options that are tagged as popular"
|
|
1525
|
+
},
|
|
1526
|
+
recent: {
|
|
1527
|
+
id: "df.wise.group.recent",
|
|
1528
|
+
defaultMessage: "Recent",
|
|
1529
|
+
description: "Label for the group of options that are tagged as recent"
|
|
1530
|
+
},
|
|
1531
|
+
"currencies-with-account-details": {
|
|
1532
|
+
id: "df.wise.group.currencies-with-account-details",
|
|
1533
|
+
defaultMessage: "Currencies with account details",
|
|
1534
|
+
description: "Label for the group of options that are tagged as currencies with account details"
|
|
1535
|
+
}
|
|
1536
|
+
});
|
|
1537
|
+
|
|
1538
|
+
// ../renderers/src/MoneyInputRenderer.tsx
|
|
1539
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1540
|
+
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
1740
1541
|
var MoneyInputRenderer = {
|
|
1741
1542
|
canRenderType: "money-input",
|
|
1742
1543
|
render: MoneyInputRendererComponent
|
|
@@ -1756,13 +1557,13 @@ function MoneyInputRendererComponent(props) {
|
|
|
1756
1557
|
onAmountChange,
|
|
1757
1558
|
onCurrencyChange
|
|
1758
1559
|
} = props;
|
|
1759
|
-
(0,
|
|
1560
|
+
(0, import_react8.useEffect)(() => {
|
|
1760
1561
|
if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
|
|
1761
1562
|
onCurrencyChange(0);
|
|
1762
1563
|
}
|
|
1763
1564
|
}, [selectedCurrencyIndex, onCurrencyChange, currencies.length]);
|
|
1764
|
-
const { formatMessage } = (0,
|
|
1765
|
-
return /* @__PURE__ */ (0,
|
|
1565
|
+
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1766
1567
|
FieldInput_default,
|
|
1767
1568
|
{
|
|
1768
1569
|
id: uid,
|
|
@@ -1770,8 +1571,8 @@ function MoneyInputRendererComponent(props) {
|
|
|
1770
1571
|
description,
|
|
1771
1572
|
validation: validationState,
|
|
1772
1573
|
help,
|
|
1773
|
-
children: /* @__PURE__ */ (0,
|
|
1774
|
-
|
|
1574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1575
|
+
import_components24.MoneyInput,
|
|
1775
1576
|
{
|
|
1776
1577
|
amount: parseFloatOrNull(amountValue),
|
|
1777
1578
|
searchPlaceholder: "",
|
|
@@ -1799,7 +1600,7 @@ var parseFloatOrNull = (value) => {
|
|
|
1799
1600
|
return Number.isNaN(parsed) ? null : parsed;
|
|
1800
1601
|
};
|
|
1801
1602
|
var mapCurrencies = (options, formatMessage) => {
|
|
1802
|
-
const groupsFromTags = getGroupsFromTags(
|
|
1603
|
+
const groupsFromTags = getGroupsFromTags(groupingTags, options);
|
|
1803
1604
|
if (groupsFromTags.length > 0) {
|
|
1804
1605
|
return [...groupsFromTags, { tag: "all", items: options }].flatMap(({ tag, items }) => {
|
|
1805
1606
|
return [
|
|
@@ -1832,13 +1633,13 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
1832
1633
|
}
|
|
1833
1634
|
|
|
1834
1635
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1835
|
-
var
|
|
1836
|
-
var
|
|
1837
|
-
var
|
|
1636
|
+
var import_components25 = require("@transferwise/components");
|
|
1637
|
+
var import_react9 = require("react");
|
|
1638
|
+
var import_react_intl10 = require("react-intl");
|
|
1838
1639
|
|
|
1839
1640
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
1840
|
-
var
|
|
1841
|
-
var multi_select_messages_default = (0,
|
|
1641
|
+
var import_react_intl9 = require("react-intl");
|
|
1642
|
+
var multi_select_messages_default = (0, import_react_intl9.defineMessages)({
|
|
1842
1643
|
summary: {
|
|
1843
1644
|
id: "df.wise.MultiSelect.summary",
|
|
1844
1645
|
defaultMessage: "{first} and {count} more",
|
|
@@ -1847,14 +1648,14 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
1847
1648
|
});
|
|
1848
1649
|
|
|
1849
1650
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1850
|
-
var
|
|
1651
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1851
1652
|
var MultiSelectInputRenderer = {
|
|
1852
1653
|
canRenderType: "input-multi-select",
|
|
1853
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1654
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
1854
1655
|
};
|
|
1855
1656
|
function MultiSelectInputRendererComponent(props) {
|
|
1856
|
-
const { formatMessage } = (0,
|
|
1857
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
1657
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
1658
|
+
const [stagedIndices, setStagedIndices] = (0, import_react9.useState)();
|
|
1858
1659
|
const {
|
|
1859
1660
|
id,
|
|
1860
1661
|
autoComplete,
|
|
@@ -1892,12 +1693,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1892
1693
|
const contentProps = {
|
|
1893
1694
|
title: option.title,
|
|
1894
1695
|
description: option.description,
|
|
1895
|
-
icon: /* @__PURE__ */ (0,
|
|
1696
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
1896
1697
|
};
|
|
1897
|
-
return /* @__PURE__ */ (0,
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components25.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
1898
1699
|
};
|
|
1899
1700
|
const extraProps = { autoComplete };
|
|
1900
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1901
1702
|
FieldInput_default,
|
|
1902
1703
|
{
|
|
1903
1704
|
id,
|
|
@@ -1905,8 +1706,8 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1905
1706
|
help,
|
|
1906
1707
|
description,
|
|
1907
1708
|
validation: validationState,
|
|
1908
|
-
children: /* @__PURE__ */ (0,
|
|
1909
|
-
|
|
1709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1710
|
+
import_components25.SelectInput,
|
|
1910
1711
|
__spreadValues({
|
|
1911
1712
|
id,
|
|
1912
1713
|
items: options.map((option, index) => {
|
|
@@ -1945,12 +1746,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1945
1746
|
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
1946
1747
|
|
|
1947
1748
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1948
|
-
var
|
|
1749
|
+
var import_components27 = require("@transferwise/components");
|
|
1949
1750
|
|
|
1950
1751
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
1951
|
-
var
|
|
1952
|
-
var
|
|
1953
|
-
var
|
|
1752
|
+
var import_components26 = require("@transferwise/components");
|
|
1753
|
+
var import_classnames3 = __toESM(require_classnames());
|
|
1754
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1954
1755
|
function UploadFieldInput({
|
|
1955
1756
|
id,
|
|
1956
1757
|
children,
|
|
@@ -1959,18 +1760,18 @@ function UploadFieldInput({
|
|
|
1959
1760
|
help,
|
|
1960
1761
|
validation
|
|
1961
1762
|
}) {
|
|
1962
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
1763
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
1963
1764
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1964
|
-
return /* @__PURE__ */ (0,
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
1965
1766
|
"div",
|
|
1966
1767
|
{
|
|
1967
|
-
className: (0,
|
|
1768
|
+
className: (0, import_classnames3.default)("form-group d-block", {
|
|
1968
1769
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
1969
1770
|
}),
|
|
1970
1771
|
children: [
|
|
1971
|
-
/* @__PURE__ */ (0,
|
|
1772
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
1972
1773
|
children,
|
|
1973
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0,
|
|
1774
|
+
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components26.InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
1974
1775
|
]
|
|
1975
1776
|
}
|
|
1976
1777
|
);
|
|
@@ -2005,7 +1806,7 @@ var getSizeLimit = (maxSize) => {
|
|
|
2005
1806
|
};
|
|
2006
1807
|
|
|
2007
1808
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
2008
|
-
var
|
|
1809
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2009
1810
|
var MultiUploadInputRenderer = {
|
|
2010
1811
|
canRenderType: "input-upload-multi",
|
|
2011
1812
|
render: (props) => {
|
|
@@ -2030,7 +1831,7 @@ var MultiUploadInputRenderer = {
|
|
|
2030
1831
|
};
|
|
2031
1832
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
2032
1833
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
2033
|
-
return /* @__PURE__ */ (0,
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2034
1835
|
UploadFieldInput_default,
|
|
2035
1836
|
{
|
|
2036
1837
|
id,
|
|
@@ -2038,8 +1839,8 @@ var MultiUploadInputRenderer = {
|
|
|
2038
1839
|
description,
|
|
2039
1840
|
validation: validationState,
|
|
2040
1841
|
help,
|
|
2041
|
-
children: /* @__PURE__ */ (0,
|
|
2042
|
-
|
|
1842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1843
|
+
import_components27.UploadInput,
|
|
2043
1844
|
{
|
|
2044
1845
|
id,
|
|
2045
1846
|
"aria-describedby": descriptionId,
|
|
@@ -2048,7 +1849,7 @@ var MultiUploadInputRenderer = {
|
|
|
2048
1849
|
files: value.map(({ id: id2, file, validationState: validationState2 }) => ({
|
|
2049
1850
|
id: id2,
|
|
2050
1851
|
filename: file.name,
|
|
2051
|
-
status: (validationState2 == null ? void 0 : validationState2.status) === "invalid" ?
|
|
1852
|
+
status: (validationState2 == null ? void 0 : validationState2.status) === "invalid" ? import_components27.Status.FAILED : import_components27.Status.SUCCEEDED
|
|
2052
1853
|
})),
|
|
2053
1854
|
fileTypes: acceptsToFileTypes(accepts),
|
|
2054
1855
|
maxFiles: maxItems,
|
|
@@ -2066,8 +1867,8 @@ var MultiUploadInputRenderer = {
|
|
|
2066
1867
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
2067
1868
|
|
|
2068
1869
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
2069
|
-
var
|
|
2070
|
-
var
|
|
1870
|
+
var import_components28 = require("@transferwise/components");
|
|
1871
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2071
1872
|
var NumberInputRenderer = {
|
|
2072
1873
|
canRenderType: "input-number",
|
|
2073
1874
|
render: (props) => {
|
|
@@ -2081,7 +1882,7 @@ var NumberInputRenderer = {
|
|
|
2081
1882
|
"maximum",
|
|
2082
1883
|
"minimum"
|
|
2083
1884
|
);
|
|
2084
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2085
1886
|
FieldInput_default,
|
|
2086
1887
|
{
|
|
2087
1888
|
id,
|
|
@@ -2089,8 +1890,8 @@ var NumberInputRenderer = {
|
|
|
2089
1890
|
description,
|
|
2090
1891
|
validation: validationState,
|
|
2091
1892
|
help,
|
|
2092
|
-
children: /* @__PURE__ */ (0,
|
|
2093
|
-
|
|
1893
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components28.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
1894
|
+
import_components28.Input,
|
|
2094
1895
|
__spreadValues({
|
|
2095
1896
|
id,
|
|
2096
1897
|
name: id,
|
|
@@ -2110,24 +1911,24 @@ var NumberInputRenderer = {
|
|
|
2110
1911
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
2111
1912
|
|
|
2112
1913
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2113
|
-
var
|
|
1914
|
+
var import_react_intl12 = require("react-intl");
|
|
2114
1915
|
|
|
2115
1916
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
2116
|
-
var
|
|
2117
|
-
var
|
|
1917
|
+
var import_components29 = require("@transferwise/components");
|
|
1918
|
+
var import_react10 = require("react");
|
|
2118
1919
|
function useSnackBarIfAvailable() {
|
|
2119
|
-
const context = (0,
|
|
1920
|
+
const context = (0, import_react10.useContext)(import_components29.SnackbarContext);
|
|
2120
1921
|
return context ? context.createSnackbar : () => {
|
|
2121
1922
|
};
|
|
2122
1923
|
}
|
|
2123
1924
|
|
|
2124
1925
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2125
|
-
var
|
|
2126
|
-
var
|
|
1926
|
+
var import_components30 = require("@transferwise/components");
|
|
1927
|
+
var import_classnames4 = __toESM(require_classnames());
|
|
2127
1928
|
|
|
2128
1929
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
2129
|
-
var
|
|
2130
|
-
var paragraph_messages_default = (0,
|
|
1930
|
+
var import_react_intl11 = require("react-intl");
|
|
1931
|
+
var paragraph_messages_default = (0, import_react_intl11.defineMessages)({
|
|
2131
1932
|
copy: {
|
|
2132
1933
|
id: "df.wise.DynamicParagraph.copy",
|
|
2133
1934
|
defaultMessage: "Copy",
|
|
@@ -2141,14 +1942,14 @@ var paragraph_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
2141
1942
|
});
|
|
2142
1943
|
|
|
2143
1944
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2144
|
-
var
|
|
1945
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2145
1946
|
var ParagraphRenderer = {
|
|
2146
1947
|
canRenderType: "paragraph",
|
|
2147
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1948
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Paragraph, __spreadValues({}, props))
|
|
2148
1949
|
};
|
|
2149
1950
|
function Paragraph({ align, control, margin, size, text }) {
|
|
2150
1951
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
2151
|
-
return control === "copyable" ? /* @__PURE__ */ (0,
|
|
1952
|
+
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2152
1953
|
"p",
|
|
2153
1954
|
{
|
|
2154
1955
|
className: `${["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large"} ${className}`,
|
|
@@ -2161,38 +1962,38 @@ function CopyableParagraph({
|
|
|
2161
1962
|
align,
|
|
2162
1963
|
className
|
|
2163
1964
|
}) {
|
|
2164
|
-
const { formatMessage } = (0,
|
|
1965
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
2165
1966
|
const createSnackbar = useSnackBarIfAvailable();
|
|
2166
1967
|
const copy = () => {
|
|
2167
1968
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
2168
1969
|
});
|
|
2169
1970
|
};
|
|
2170
1971
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
2171
|
-
return /* @__PURE__ */ (0,
|
|
2172
|
-
/* @__PURE__ */ (0,
|
|
2173
|
-
|
|
1972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className, children: [
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1974
|
+
import_components30.Input,
|
|
2174
1975
|
{
|
|
2175
1976
|
type: "text",
|
|
2176
1977
|
value: text,
|
|
2177
1978
|
readOnly: true,
|
|
2178
|
-
className: (0,
|
|
1979
|
+
className: (0, import_classnames4.default)("text-ellipsis", inputAlignmentClasses)
|
|
2179
1980
|
}
|
|
2180
1981
|
),
|
|
2181
|
-
/* @__PURE__ */ (0,
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components30.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
2182
1983
|
] });
|
|
2183
1984
|
}
|
|
2184
1985
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
2185
1986
|
|
|
2186
1987
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2187
|
-
var
|
|
1988
|
+
var import_components31 = require("@transferwise/components");
|
|
2188
1989
|
var import_icons = require("@transferwise/icons");
|
|
2189
|
-
var
|
|
2190
|
-
var
|
|
2191
|
-
var
|
|
1990
|
+
var import_classnames5 = __toESM(require_classnames());
|
|
1991
|
+
var import_react11 = require("react");
|
|
1992
|
+
var import_react_intl14 = require("react-intl");
|
|
2192
1993
|
|
|
2193
1994
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
2194
|
-
var
|
|
2195
|
-
var repeatable_messages_default = (0,
|
|
1995
|
+
var import_react_intl13 = require("react-intl");
|
|
1996
|
+
var repeatable_messages_default = (0, import_react_intl13.defineMessages)({
|
|
2196
1997
|
addItemTitle: {
|
|
2197
1998
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
2198
1999
|
defaultMessage: "Add Item",
|
|
@@ -2216,10 +2017,10 @@ var repeatable_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
2216
2017
|
});
|
|
2217
2018
|
|
|
2218
2019
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2219
|
-
var
|
|
2020
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2220
2021
|
var RepeatableRenderer = {
|
|
2221
2022
|
canRenderType: "repeatable",
|
|
2222
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2023
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Repeatable, __spreadValues({}, props))
|
|
2223
2024
|
};
|
|
2224
2025
|
function Repeatable(props) {
|
|
2225
2026
|
const {
|
|
@@ -2235,8 +2036,8 @@ function Repeatable(props) {
|
|
|
2235
2036
|
onSave,
|
|
2236
2037
|
onRemove
|
|
2237
2038
|
} = props;
|
|
2238
|
-
const { formatMessage } = (0,
|
|
2239
|
-
const [openModalType, setOpenModalType] = (0,
|
|
2039
|
+
const { formatMessage } = (0, import_react_intl14.useIntl)();
|
|
2040
|
+
const [openModalType, setOpenModalType] = (0, import_react11.useState)(null);
|
|
2240
2041
|
const onAddItem = () => {
|
|
2241
2042
|
onAdd();
|
|
2242
2043
|
setOpenModalType("add");
|
|
@@ -2258,41 +2059,41 @@ function Repeatable(props) {
|
|
|
2258
2059
|
const onCancelEdit = () => {
|
|
2259
2060
|
setOpenModalType(null);
|
|
2260
2061
|
};
|
|
2261
|
-
return /* @__PURE__ */ (0,
|
|
2262
|
-
title && /* @__PURE__ */ (0,
|
|
2263
|
-
description && /* @__PURE__ */ (0,
|
|
2264
|
-
/* @__PURE__ */ (0,
|
|
2062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
2063
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components31.Header, { title }),
|
|
2064
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: description }),
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
2265
2066
|
"div",
|
|
2266
2067
|
{
|
|
2267
|
-
className: (0,
|
|
2068
|
+
className: (0, import_classnames5.default)("form-group", {
|
|
2268
2069
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2269
2070
|
}),
|
|
2270
2071
|
children: [
|
|
2271
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2273
|
-
|
|
2072
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
2073
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2074
|
+
import_components31.NavigationOption,
|
|
2274
2075
|
{
|
|
2275
|
-
media: /* @__PURE__ */ (0,
|
|
2076
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons.Plus, {}),
|
|
2276
2077
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2277
2078
|
showMediaAtAllSizes: true,
|
|
2278
2079
|
onClick: () => onAddItem()
|
|
2279
2080
|
}
|
|
2280
2081
|
),
|
|
2281
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
2082
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components31.InlineAlert, { type: "negative", children: validationState.message })
|
|
2282
2083
|
]
|
|
2283
2084
|
}
|
|
2284
2085
|
),
|
|
2285
|
-
/* @__PURE__ */ (0,
|
|
2286
|
-
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2087
|
+
import_components31.Modal,
|
|
2287
2088
|
{
|
|
2288
2089
|
open: openModalType !== null,
|
|
2289
2090
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2290
|
-
body: /* @__PURE__ */ (0,
|
|
2291
|
-
/* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2294
|
-
/* @__PURE__ */ (0,
|
|
2295
|
-
|
|
2091
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
2092
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
2093
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
|
|
2094
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components31.Button, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
2095
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2096
|
+
import_components31.Button,
|
|
2296
2097
|
{
|
|
2297
2098
|
v2: true,
|
|
2298
2099
|
priority: "secondary",
|
|
@@ -2313,10 +2114,10 @@ function ItemSummaryOption({
|
|
|
2313
2114
|
item,
|
|
2314
2115
|
onClick
|
|
2315
2116
|
}) {
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2317
|
-
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2118
|
+
import_components31.NavigationOption,
|
|
2318
2119
|
{
|
|
2319
|
-
media: /* @__PURE__ */ (0,
|
|
2120
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OptionMedia, { media: item.media, preferAvatar: false }),
|
|
2320
2121
|
title: item.title,
|
|
2321
2122
|
content: item.description,
|
|
2322
2123
|
showMediaAtAllSizes: true,
|
|
@@ -2327,96 +2128,14 @@ function ItemSummaryOption({
|
|
|
2327
2128
|
}
|
|
2328
2129
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2329
2130
|
|
|
2330
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2331
|
-
var import_components37 = require("@transferwise/components");
|
|
2332
|
-
|
|
2333
|
-
// ../renderers/src/components/Header.tsx
|
|
2334
|
-
var import_components36 = require("@transferwise/components");
|
|
2335
|
-
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2336
|
-
var Header7 = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components36.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) });
|
|
2337
|
-
var getHeaderAction = (callToAction) => {
|
|
2338
|
-
if (!callToAction) {
|
|
2339
|
-
return void 0;
|
|
2340
|
-
}
|
|
2341
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2342
|
-
return href ? {
|
|
2343
|
-
"aria-label": accessibilityDescription,
|
|
2344
|
-
text: title,
|
|
2345
|
-
href,
|
|
2346
|
-
target: "_blank"
|
|
2347
|
-
} : {
|
|
2348
|
-
"aria-label": accessibilityDescription,
|
|
2349
|
-
text: title,
|
|
2350
|
-
onClick: (event) => {
|
|
2351
|
-
event.preventDefault();
|
|
2352
|
-
onClick();
|
|
2353
|
-
}
|
|
2354
|
-
};
|
|
2355
|
-
};
|
|
2356
|
-
|
|
2357
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2358
|
-
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2359
|
-
var ReviewRenderer = {
|
|
2360
|
-
canRenderType: "review",
|
|
2361
|
-
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2362
|
-
const orientation = mapControlToDefinitionListLayout(control);
|
|
2363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(margin), children: [
|
|
2364
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Header7, { title, callToAction }),
|
|
2365
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2366
|
-
import_components37.DefinitionList,
|
|
2367
|
-
{
|
|
2368
|
-
layout: orientation,
|
|
2369
|
-
definitions: fields.map(
|
|
2370
|
-
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2371
|
-
key: String(index),
|
|
2372
|
-
value,
|
|
2373
|
-
title: getFieldLabel(
|
|
2374
|
-
label,
|
|
2375
|
-
help,
|
|
2376
|
-
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2377
|
-
)
|
|
2378
|
-
})
|
|
2379
|
-
)
|
|
2380
|
-
}
|
|
2381
|
-
) })
|
|
2382
|
-
] });
|
|
2383
|
-
}
|
|
2384
|
-
};
|
|
2385
|
-
var ReviewRenderer_default = ReviewRenderer;
|
|
2386
|
-
var mapControlToDefinitionListLayout = (control) => {
|
|
2387
|
-
switch (control) {
|
|
2388
|
-
case "horizontal":
|
|
2389
|
-
case "horizontal-end-aligned":
|
|
2390
|
-
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2391
|
-
case "horizontal-start-aligned":
|
|
2392
|
-
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2393
|
-
case "vertical-two-column":
|
|
2394
|
-
return "VERTICAL_TWO_COLUMN";
|
|
2395
|
-
case "vertical":
|
|
2396
|
-
case "vertical-one-column":
|
|
2397
|
-
default:
|
|
2398
|
-
return "VERTICAL_ONE_COLUMN";
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
var getFieldLabel = (label, help, onClick) => {
|
|
2402
|
-
if (help) {
|
|
2403
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
2404
|
-
label,
|
|
2405
|
-
" ",
|
|
2406
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Help_default, { help, onClick })
|
|
2407
|
-
] });
|
|
2408
|
-
}
|
|
2409
|
-
return label;
|
|
2410
|
-
};
|
|
2411
|
-
|
|
2412
2131
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2413
|
-
var
|
|
2414
|
-
var
|
|
2415
|
-
var
|
|
2132
|
+
var import_components33 = require("@transferwise/components");
|
|
2133
|
+
var import_react12 = require("react");
|
|
2134
|
+
var import_react_intl18 = require("react-intl");
|
|
2416
2135
|
|
|
2417
2136
|
// ../renderers/src/messages/search.messages.ts
|
|
2418
|
-
var
|
|
2419
|
-
var search_messages_default = (0,
|
|
2137
|
+
var import_react_intl15 = require("react-intl");
|
|
2138
|
+
var search_messages_default = (0, import_react_intl15.defineMessages)({
|
|
2420
2139
|
loading: {
|
|
2421
2140
|
id: "df.wise.SearchLayout.loading",
|
|
2422
2141
|
defaultMessage: "Loading...",
|
|
@@ -2425,11 +2144,11 @@ var search_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
2425
2144
|
});
|
|
2426
2145
|
|
|
2427
2146
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2428
|
-
var
|
|
2147
|
+
var import_react_intl17 = require("react-intl");
|
|
2429
2148
|
|
|
2430
2149
|
// ../renderers/src/messages/generic-error.messages.ts
|
|
2431
|
-
var
|
|
2432
|
-
var generic_error_messages_default = (0,
|
|
2150
|
+
var import_react_intl16 = require("react-intl");
|
|
2151
|
+
var generic_error_messages_default = (0, import_react_intl16.defineMessages)({
|
|
2433
2152
|
genericErrorRetryHint: {
|
|
2434
2153
|
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2435
2154
|
defaultMessage: "Something went wrong, please try again.",
|
|
@@ -2448,19 +2167,19 @@ var generic_error_messages_default = (0, import_react_intl19.defineMessages)({
|
|
|
2448
2167
|
});
|
|
2449
2168
|
|
|
2450
2169
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2451
|
-
var
|
|
2452
|
-
var
|
|
2170
|
+
var import_components32 = require("@transferwise/components");
|
|
2171
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2453
2172
|
function ErrorResult({ state }) {
|
|
2454
|
-
const intl = (0,
|
|
2455
|
-
return /* @__PURE__ */ (0,
|
|
2173
|
+
const intl = (0, import_react_intl17.useIntl)();
|
|
2174
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("p", { className: "m-t-2", children: [
|
|
2456
2175
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
2457
2176
|
"\xA0",
|
|
2458
|
-
/* @__PURE__ */ (0,
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components32.Link, { onClick: () => state.onRetry(), children: intl.formatMessage(generic_error_messages_default.retry) })
|
|
2459
2178
|
] });
|
|
2460
2179
|
}
|
|
2461
2180
|
|
|
2462
2181
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2463
|
-
var
|
|
2182
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2464
2183
|
function BlockSearchRendererComponent({
|
|
2465
2184
|
id,
|
|
2466
2185
|
isLoading,
|
|
@@ -2471,11 +2190,11 @@ function BlockSearchRendererComponent({
|
|
|
2471
2190
|
trackEvent,
|
|
2472
2191
|
onChange
|
|
2473
2192
|
}) {
|
|
2474
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2475
|
-
const { formatMessage } = (0,
|
|
2476
|
-
return /* @__PURE__ */ (0,
|
|
2477
|
-
/* @__PURE__ */ (0,
|
|
2478
|
-
|
|
2193
|
+
const [hasSearched, setHasSearched] = (0, import_react12.useState)(false);
|
|
2194
|
+
const { formatMessage } = (0, import_react_intl18.useIntl)();
|
|
2195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getMargin(margin), children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2197
|
+
import_components33.Input,
|
|
2479
2198
|
{
|
|
2480
2199
|
id,
|
|
2481
2200
|
name: id,
|
|
@@ -2491,7 +2210,7 @@ function BlockSearchRendererComponent({
|
|
|
2491
2210
|
}
|
|
2492
2211
|
}
|
|
2493
2212
|
) }),
|
|
2494
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
2213
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SearchResultContent, { state, trackEvent })
|
|
2495
2214
|
] });
|
|
2496
2215
|
}
|
|
2497
2216
|
function SearchResultContent({
|
|
@@ -2500,31 +2219,31 @@ function SearchResultContent({
|
|
|
2500
2219
|
}) {
|
|
2501
2220
|
switch (state.type) {
|
|
2502
2221
|
case "error":
|
|
2503
|
-
return /* @__PURE__ */ (0,
|
|
2222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorResult, { state });
|
|
2504
2223
|
case "results":
|
|
2505
|
-
return /* @__PURE__ */ (0,
|
|
2224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SearchResults, { state, trackEvent });
|
|
2506
2225
|
case "noResults":
|
|
2507
|
-
return /* @__PURE__ */ (0,
|
|
2226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EmptySearchResult, { state });
|
|
2508
2227
|
case "pending":
|
|
2509
2228
|
default:
|
|
2510
2229
|
return null;
|
|
2511
2230
|
}
|
|
2512
2231
|
}
|
|
2513
2232
|
function EmptySearchResult({ state }) {
|
|
2514
|
-
return /* @__PURE__ */ (0,
|
|
2233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2515
2234
|
}
|
|
2516
2235
|
function SearchResults({
|
|
2517
2236
|
state,
|
|
2518
2237
|
trackEvent
|
|
2519
2238
|
}) {
|
|
2520
|
-
return /* @__PURE__ */ (0,
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.NavigationOptionsList, { children: state.results.map((result) => {
|
|
2521
2240
|
const { media } = result;
|
|
2522
|
-
return /* @__PURE__ */ (0,
|
|
2523
|
-
|
|
2241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2242
|
+
import_components33.NavigationOption,
|
|
2524
2243
|
{
|
|
2525
2244
|
title: result.title,
|
|
2526
2245
|
content: result.description,
|
|
2527
|
-
media: media ? /* @__PURE__ */ (0,
|
|
2246
|
+
media: media ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(OptionMedia, { media, preferAvatar: false }) : void 0,
|
|
2528
2247
|
showMediaCircle: false,
|
|
2529
2248
|
showMediaAtAllSizes: true,
|
|
2530
2249
|
onClick: () => {
|
|
@@ -2541,11 +2260,11 @@ function SearchResults({
|
|
|
2541
2260
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
2542
2261
|
|
|
2543
2262
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
2544
|
-
var
|
|
2263
|
+
var import_components34 = require("@transferwise/components");
|
|
2545
2264
|
var import_icons2 = require("@transferwise/icons");
|
|
2546
|
-
var
|
|
2547
|
-
var
|
|
2548
|
-
var
|
|
2265
|
+
var import_react13 = require("react");
|
|
2266
|
+
var import_react_intl19 = require("react-intl");
|
|
2267
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2549
2268
|
function InlineSearchRenderer({
|
|
2550
2269
|
id,
|
|
2551
2270
|
isLoading,
|
|
@@ -2555,20 +2274,20 @@ function InlineSearchRenderer({
|
|
|
2555
2274
|
title,
|
|
2556
2275
|
trackEvent
|
|
2557
2276
|
}) {
|
|
2558
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2559
|
-
const intl = (0,
|
|
2560
|
-
return /* @__PURE__ */ (0,
|
|
2561
|
-
|
|
2277
|
+
const [hasSearched, setHasSearched] = (0, import_react13.useState)(false);
|
|
2278
|
+
const intl = (0, import_react_intl19.useIntl)();
|
|
2279
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2280
|
+
import_components34.Typeahead,
|
|
2562
2281
|
{
|
|
2563
2282
|
id: "typeahead-input-id",
|
|
2564
2283
|
intl,
|
|
2565
2284
|
name: "typeahead-input-name",
|
|
2566
2285
|
size: "md",
|
|
2567
2286
|
maxHeight: 100,
|
|
2568
|
-
footer: /* @__PURE__ */ (0,
|
|
2287
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
2569
2288
|
multiple: false,
|
|
2570
2289
|
clearable: false,
|
|
2571
|
-
addon: /* @__PURE__ */ (0,
|
|
2290
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_icons2.Search, { size: 24 }),
|
|
2572
2291
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
2573
2292
|
minQueryLength: 1,
|
|
2574
2293
|
onChange: (values) => {
|
|
@@ -2603,33 +2322,33 @@ function mapResultToTypeaheadOption(result) {
|
|
|
2603
2322
|
};
|
|
2604
2323
|
}
|
|
2605
2324
|
function TypeaheadFooter({ state, isLoading }) {
|
|
2606
|
-
const { formatMessage } = (0,
|
|
2325
|
+
const { formatMessage } = (0, import_react_intl19.useIntl)();
|
|
2607
2326
|
if (state.type === "noResults") {
|
|
2608
|
-
return /* @__PURE__ */ (0,
|
|
2327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2609
2328
|
}
|
|
2610
2329
|
if (state.type === "error") {
|
|
2611
|
-
return /* @__PURE__ */ (0,
|
|
2330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ErrorResult, { state }) });
|
|
2612
2331
|
}
|
|
2613
2332
|
if (state.type === "pending" || isLoading) {
|
|
2614
|
-
return /* @__PURE__ */ (0,
|
|
2333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
2615
2334
|
}
|
|
2616
2335
|
return null;
|
|
2617
2336
|
}
|
|
2618
2337
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
2619
2338
|
|
|
2620
2339
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
2621
|
-
var
|
|
2340
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2622
2341
|
var SearchRenderer = {
|
|
2623
2342
|
canRenderType: "search",
|
|
2624
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0,
|
|
2343
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
2625
2344
|
};
|
|
2626
2345
|
var SearchRenderer_default = SearchRenderer;
|
|
2627
2346
|
|
|
2628
2347
|
// ../renderers/src/SectionRenderer.tsx
|
|
2629
|
-
var
|
|
2348
|
+
var import_components35 = require("@transferwise/components");
|
|
2630
2349
|
|
|
2631
2350
|
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2632
|
-
var
|
|
2351
|
+
var getHeaderAction = (callToAction) => {
|
|
2633
2352
|
if (!callToAction) {
|
|
2634
2353
|
return void 0;
|
|
2635
2354
|
}
|
|
@@ -2650,12 +2369,12 @@ var getHeaderAction2 = (callToAction) => {
|
|
|
2650
2369
|
};
|
|
2651
2370
|
|
|
2652
2371
|
// ../renderers/src/SectionRenderer.tsx
|
|
2653
|
-
var
|
|
2372
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2654
2373
|
var SectionRenderer = {
|
|
2655
2374
|
canRenderType: "section",
|
|
2656
2375
|
render: ({ children, callToAction, margin, title }) => {
|
|
2657
|
-
return /* @__PURE__ */ (0,
|
|
2658
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
2376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { className: getMargin(margin), children: [
|
|
2377
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components35.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2659
2378
|
children
|
|
2660
2379
|
] });
|
|
2661
2380
|
}
|
|
@@ -2663,8 +2382,8 @@ var SectionRenderer = {
|
|
|
2663
2382
|
var SectionRenderer_default = SectionRenderer;
|
|
2664
2383
|
|
|
2665
2384
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
2666
|
-
var
|
|
2667
|
-
var
|
|
2385
|
+
var import_components36 = require("@transferwise/components");
|
|
2386
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2668
2387
|
function RadioInputRendererComponent(props) {
|
|
2669
2388
|
const {
|
|
2670
2389
|
id,
|
|
@@ -2678,8 +2397,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2678
2397
|
validationState,
|
|
2679
2398
|
onSelect
|
|
2680
2399
|
} = props;
|
|
2681
|
-
return /* @__PURE__ */ (0,
|
|
2682
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
2401
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2683
2402
|
FieldInput_default,
|
|
2684
2403
|
{
|
|
2685
2404
|
id,
|
|
@@ -2687,8 +2406,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2687
2406
|
help,
|
|
2688
2407
|
description,
|
|
2689
2408
|
validation: validationState,
|
|
2690
|
-
children: /* @__PURE__ */ (0,
|
|
2691
|
-
|
|
2409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2410
|
+
import_components36.RadioGroup,
|
|
2692
2411
|
{
|
|
2693
2412
|
name: id,
|
|
2694
2413
|
radios: options.map((option, index) => ({
|
|
@@ -2696,7 +2415,7 @@ function RadioInputRendererComponent(props) {
|
|
|
2696
2415
|
value: index,
|
|
2697
2416
|
secondary: option.description,
|
|
2698
2417
|
disabled: option.disabled || disabled,
|
|
2699
|
-
avatar: /* @__PURE__ */ (0,
|
|
2418
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2700
2419
|
})),
|
|
2701
2420
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
2702
2421
|
onChange: onSelect
|
|
@@ -2710,9 +2429,9 @@ function RadioInputRendererComponent(props) {
|
|
|
2710
2429
|
}
|
|
2711
2430
|
|
|
2712
2431
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
2713
|
-
var
|
|
2714
|
-
var
|
|
2715
|
-
var
|
|
2432
|
+
var import_components37 = require("@transferwise/components");
|
|
2433
|
+
var import_react14 = require("react");
|
|
2434
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2716
2435
|
function TabInputRendererComponent(props) {
|
|
2717
2436
|
const {
|
|
2718
2437
|
id,
|
|
@@ -2726,13 +2445,13 @@ function TabInputRendererComponent(props) {
|
|
|
2726
2445
|
validationState,
|
|
2727
2446
|
onSelect
|
|
2728
2447
|
} = props;
|
|
2729
|
-
(0,
|
|
2448
|
+
(0, import_react14.useEffect)(() => {
|
|
2730
2449
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
2731
2450
|
onSelect(0);
|
|
2732
2451
|
}
|
|
2733
2452
|
}, [selectedIndex, onSelect, options.length]);
|
|
2734
|
-
return /* @__PURE__ */ (0,
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2736
2455
|
FieldInput_default,
|
|
2737
2456
|
{
|
|
2738
2457
|
id,
|
|
@@ -2740,8 +2459,8 @@ function TabInputRendererComponent(props) {
|
|
|
2740
2459
|
help,
|
|
2741
2460
|
description,
|
|
2742
2461
|
validation: validationState,
|
|
2743
|
-
children: /* @__PURE__ */ (0,
|
|
2744
|
-
|
|
2462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2463
|
+
import_components37.Tabs,
|
|
2745
2464
|
{
|
|
2746
2465
|
name: id,
|
|
2747
2466
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -2749,7 +2468,7 @@ function TabInputRendererComponent(props) {
|
|
|
2749
2468
|
title: option.title,
|
|
2750
2469
|
// if we pass null, we get some props-types console errors
|
|
2751
2470
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
2752
|
-
content: /* @__PURE__ */ (0,
|
|
2471
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, {}),
|
|
2753
2472
|
disabled: option.disabled || disabled
|
|
2754
2473
|
})),
|
|
2755
2474
|
onTabSelect: onSelect
|
|
@@ -2763,8 +2482,8 @@ function TabInputRendererComponent(props) {
|
|
|
2763
2482
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2764
2483
|
|
|
2765
2484
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
2766
|
-
var
|
|
2767
|
-
var
|
|
2485
|
+
var import_components38 = require("@transferwise/components");
|
|
2486
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2768
2487
|
function SelectInputRendererComponent(props) {
|
|
2769
2488
|
const {
|
|
2770
2489
|
id,
|
|
@@ -2804,13 +2523,13 @@ function SelectInputRendererComponent(props) {
|
|
|
2804
2523
|
} : {
|
|
2805
2524
|
title: option.title,
|
|
2806
2525
|
description: option.description,
|
|
2807
|
-
icon: /* @__PURE__ */ (0,
|
|
2526
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2808
2527
|
};
|
|
2809
|
-
return /* @__PURE__ */ (0,
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components38.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2810
2529
|
};
|
|
2811
2530
|
const extraProps = { autoComplete };
|
|
2812
|
-
return /* @__PURE__ */ (0,
|
|
2813
|
-
/* @__PURE__ */ (0,
|
|
2531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2814
2533
|
FieldInput_default,
|
|
2815
2534
|
{
|
|
2816
2535
|
id,
|
|
@@ -2818,8 +2537,8 @@ function SelectInputRendererComponent(props) {
|
|
|
2818
2537
|
help,
|
|
2819
2538
|
description,
|
|
2820
2539
|
validation: validationState,
|
|
2821
|
-
children: /* @__PURE__ */ (0,
|
|
2822
|
-
|
|
2540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2541
|
+
import_components38.SelectInput,
|
|
2823
2542
|
__spreadValues({
|
|
2824
2543
|
name: id,
|
|
2825
2544
|
placeholder,
|
|
@@ -2839,9 +2558,9 @@ function SelectInputRendererComponent(props) {
|
|
|
2839
2558
|
}
|
|
2840
2559
|
|
|
2841
2560
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
2842
|
-
var
|
|
2843
|
-
var
|
|
2844
|
-
var
|
|
2561
|
+
var import_react15 = require("react");
|
|
2562
|
+
var import_components39 = require("@transferwise/components");
|
|
2563
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2845
2564
|
function SegmentedInputRendererComponent(props) {
|
|
2846
2565
|
const {
|
|
2847
2566
|
id,
|
|
@@ -2854,13 +2573,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2854
2573
|
validationState,
|
|
2855
2574
|
onSelect
|
|
2856
2575
|
} = props;
|
|
2857
|
-
(0,
|
|
2576
|
+
(0, import_react15.useEffect)(() => {
|
|
2858
2577
|
if (!isValidIndex3(selectedIndex, options.length)) {
|
|
2859
2578
|
onSelect(0);
|
|
2860
2579
|
}
|
|
2861
2580
|
}, [selectedIndex, onSelect, options.length]);
|
|
2862
|
-
return /* @__PURE__ */ (0,
|
|
2863
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2864
2583
|
FieldInput_default,
|
|
2865
2584
|
{
|
|
2866
2585
|
id,
|
|
@@ -2868,8 +2587,8 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2868
2587
|
help,
|
|
2869
2588
|
description,
|
|
2870
2589
|
validation: validationState,
|
|
2871
|
-
children: /* @__PURE__ */ (0,
|
|
2872
|
-
|
|
2590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2591
|
+
import_components39.SegmentedControl,
|
|
2873
2592
|
{
|
|
2874
2593
|
name: `${id}-segmented-control`,
|
|
2875
2594
|
value: String(selectedIndex),
|
|
@@ -2885,14 +2604,14 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2885
2604
|
)
|
|
2886
2605
|
}
|
|
2887
2606
|
),
|
|
2888
|
-
/* @__PURE__ */ (0,
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { id: `${id}-children`, children })
|
|
2889
2608
|
] });
|
|
2890
2609
|
}
|
|
2891
2610
|
var isValidIndex3 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2892
2611
|
|
|
2893
2612
|
// ../renderers/src/SelectInputRenderer/RadioItemRendererComponent.tsx
|
|
2894
|
-
var
|
|
2895
|
-
var
|
|
2613
|
+
var import_components40 = require("@transferwise/components");
|
|
2614
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2896
2615
|
function RadioItemRendererComponent(props) {
|
|
2897
2616
|
const {
|
|
2898
2617
|
id,
|
|
@@ -2906,23 +2625,23 @@ function RadioItemRendererComponent(props) {
|
|
|
2906
2625
|
validationState,
|
|
2907
2626
|
onSelect
|
|
2908
2627
|
} = props;
|
|
2909
|
-
return /* @__PURE__ */ (0,
|
|
2910
|
-
rootTitle && /* @__PURE__ */ (0,
|
|
2911
|
-
|
|
2628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
2629
|
+
rootTitle && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2630
|
+
import_components40.Header,
|
|
2912
2631
|
{
|
|
2913
2632
|
as: "h2",
|
|
2914
|
-
title: help ? /* @__PURE__ */ (0,
|
|
2633
|
+
title: help ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelContentWithHelp, { text: rootTitle, help }) : rootTitle
|
|
2915
2634
|
}
|
|
2916
2635
|
),
|
|
2917
|
-
rootDescription && /* @__PURE__ */ (0,
|
|
2918
|
-
/* @__PURE__ */ (0,
|
|
2919
|
-
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0,
|
|
2920
|
-
|
|
2636
|
+
rootDescription && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("p", { children: rootDescription }),
|
|
2637
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components40.List, { children: options.map(
|
|
2638
|
+
({ title, description, additionalText, inlineAlert, disabled, media, supportingValues }, index) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2639
|
+
import_components40.ListItem,
|
|
2921
2640
|
__spreadValues({
|
|
2922
2641
|
title,
|
|
2923
2642
|
subtitle: description,
|
|
2924
|
-
control: /* @__PURE__ */ (0,
|
|
2925
|
-
|
|
2643
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2644
|
+
import_components40.ListItem.Radio,
|
|
2926
2645
|
{
|
|
2927
2646
|
name: title,
|
|
2928
2647
|
checked: selectedIndex === index,
|
|
@@ -2937,88 +2656,41 @@ function RadioItemRendererComponent(props) {
|
|
|
2937
2656
|
title
|
|
2938
2657
|
)
|
|
2939
2658
|
) }, `${id}-${selectedIndex}`),
|
|
2940
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
2659
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components40.InlineAlert, { type: "negative", children: validationState.message }),
|
|
2941
2660
|
children
|
|
2942
2661
|
] });
|
|
2943
2662
|
}
|
|
2944
2663
|
|
|
2945
2664
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
2946
|
-
var
|
|
2665
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2947
2666
|
var SelectInputRenderer = {
|
|
2948
2667
|
canRenderType: "input-select",
|
|
2949
2668
|
render: (props) => {
|
|
2950
2669
|
switch (props.control) {
|
|
2951
2670
|
case "radio":
|
|
2952
|
-
return /* @__PURE__ */ (0,
|
|
2671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
2953
2672
|
case "radio-item":
|
|
2954
|
-
return /* @__PURE__ */ (0,
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RadioItemRendererComponent, __spreadValues({}, props));
|
|
2955
2674
|
case "tab":
|
|
2956
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
2675
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
2957
2676
|
case "segmented":
|
|
2958
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
2677
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
2959
2678
|
case "select":
|
|
2960
2679
|
default:
|
|
2961
|
-
return /* @__PURE__ */ (0,
|
|
2680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
2962
2681
|
}
|
|
2963
2682
|
}
|
|
2964
2683
|
};
|
|
2965
2684
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
2966
2685
|
|
|
2967
|
-
// ../renderers/src/StatusListRenderer.tsx
|
|
2968
|
-
var import_components47 = require("@transferwise/components");
|
|
2969
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
2970
|
-
var StatusListRenderer = {
|
|
2971
|
-
canRenderType: "status-list",
|
|
2972
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: getMargin(margin), children: [
|
|
2973
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components47.Header, { title, className: "m-b-2" }) : null,
|
|
2974
|
-
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2975
|
-
import_components47.Summary,
|
|
2976
|
-
{
|
|
2977
|
-
title: itemTitle,
|
|
2978
|
-
description,
|
|
2979
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
2980
|
-
status: mapStatus(status),
|
|
2981
|
-
action: getSummaryAction(callToAction)
|
|
2982
|
-
},
|
|
2983
|
-
`${itemTitle}/${description || ""}`
|
|
2984
|
-
))
|
|
2985
|
-
] })
|
|
2986
|
-
};
|
|
2987
|
-
var StatusListRenderer_default = StatusListRenderer;
|
|
2988
|
-
var getSummaryAction = (callToAction) => {
|
|
2989
|
-
if (!callToAction) {
|
|
2990
|
-
return void 0;
|
|
2991
|
-
}
|
|
2992
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2993
|
-
if (!href) {
|
|
2994
|
-
return {
|
|
2995
|
-
"aria-label": accessibilityDescription,
|
|
2996
|
-
text: title,
|
|
2997
|
-
onClick
|
|
2998
|
-
};
|
|
2999
|
-
}
|
|
3000
|
-
return {
|
|
3001
|
-
"aria-label": accessibilityDescription,
|
|
3002
|
-
href,
|
|
3003
|
-
target: "_blank",
|
|
3004
|
-
text: title
|
|
3005
|
-
};
|
|
3006
|
-
};
|
|
3007
|
-
var mapStatus = (status) => {
|
|
3008
|
-
if (status === "not-done") {
|
|
3009
|
-
return "notDone";
|
|
3010
|
-
}
|
|
3011
|
-
return status;
|
|
3012
|
-
};
|
|
3013
|
-
|
|
3014
2686
|
// ../renderers/src/utils/useCustomTheme.ts
|
|
3015
2687
|
var import_components_theming = require("@wise/components-theming");
|
|
3016
|
-
var
|
|
2688
|
+
var import_react16 = require("react");
|
|
3017
2689
|
var ThemeRequiredEventName = "Theme Required";
|
|
3018
2690
|
var useCustomTheme = (theme, trackEvent) => {
|
|
3019
2691
|
const previousThemeHookValue = (0, import_components_theming.useTheme)();
|
|
3020
|
-
const previousTheme = (0,
|
|
3021
|
-
(0,
|
|
2692
|
+
const previousTheme = (0, import_react16.useMemo)(() => previousThemeHookValue.theme, []);
|
|
2693
|
+
(0, import_react16.useEffect)(() => {
|
|
3022
2694
|
trackEvent(ThemeRequiredEventName, { theme });
|
|
3023
2695
|
return theme !== previousTheme ? () => {
|
|
3024
2696
|
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
@@ -3028,13 +2700,13 @@ var useCustomTheme = (theme, trackEvent) => {
|
|
|
3028
2700
|
};
|
|
3029
2701
|
|
|
3030
2702
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3031
|
-
var
|
|
2703
|
+
var import_components41 = require("@transferwise/components");
|
|
3032
2704
|
var import_icons3 = require("@transferwise/icons");
|
|
3033
|
-
var
|
|
2705
|
+
var import_react_intl21 = require("react-intl");
|
|
3034
2706
|
|
|
3035
2707
|
// ../renderers/src/messages/back.messages.ts
|
|
3036
|
-
var
|
|
3037
|
-
var back_messages_default = (0,
|
|
2708
|
+
var import_react_intl20 = require("react-intl");
|
|
2709
|
+
var back_messages_default = (0, import_react_intl20.defineMessages)({
|
|
3038
2710
|
back: {
|
|
3039
2711
|
id: "df.wise.back.label",
|
|
3040
2712
|
defaultMessage: "Back",
|
|
@@ -3043,31 +2715,31 @@ var back_messages_default = (0, import_react_intl23.defineMessages)({
|
|
|
3043
2715
|
});
|
|
3044
2716
|
|
|
3045
2717
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
3046
|
-
var
|
|
2718
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3047
2719
|
function BackButton({ title, onClick }) {
|
|
3048
|
-
const { formatMessage } = (0,
|
|
3049
|
-
return /* @__PURE__ */ (0,
|
|
3050
|
-
/* @__PURE__ */ (0,
|
|
3051
|
-
/* @__PURE__ */ (0,
|
|
2720
|
+
const { formatMessage } = (0, import_react_intl21.useIntl)();
|
|
2721
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_components41.IconButton, { className: "df-back-button", priority: "tertiary", onClick, children: [
|
|
2722
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "sr-only", children: title != null ? title : formatMessage(back_messages_default.back) }),
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_icons3.ArrowLeft, {})
|
|
3052
2724
|
] });
|
|
3053
2725
|
}
|
|
3054
2726
|
|
|
3055
2727
|
// ../renderers/src/step/topbar/Toolbar.tsx
|
|
3056
|
-
var
|
|
3057
|
-
var
|
|
2728
|
+
var import_components42 = require("@transferwise/components");
|
|
2729
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3058
2730
|
var Toolbar = ({ items }) => {
|
|
3059
|
-
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0,
|
|
2731
|
+
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "df-toolbar", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ToolbarButton, __spreadValues({}, item), `${item.type}-${index}-${item.title}`)) }) : null;
|
|
3060
2732
|
};
|
|
3061
2733
|
function ToolbarButton(props) {
|
|
3062
|
-
return prefersMedia(props.control) ? /* @__PURE__ */ (0,
|
|
2734
|
+
return prefersMedia(props.control) ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(MediaToolbarButton, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TextToolbarButton, __spreadValues({}, props));
|
|
3063
2735
|
}
|
|
3064
2736
|
function MediaToolbarButton(props) {
|
|
3065
2737
|
var _a;
|
|
3066
2738
|
const { context, control, media, accessibilityDescription, disabled, onClick } = props;
|
|
3067
2739
|
const priority = getIconButtonPriority(control);
|
|
3068
|
-
const type =
|
|
3069
|
-
return /* @__PURE__ */ (0,
|
|
3070
|
-
|
|
2740
|
+
const type = getSentiment2(context);
|
|
2741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
2742
|
+
import_components42.IconButton,
|
|
3071
2743
|
{
|
|
3072
2744
|
className: "df-toolbar-button",
|
|
3073
2745
|
disabled,
|
|
@@ -3076,7 +2748,7 @@ function MediaToolbarButton(props) {
|
|
|
3076
2748
|
type,
|
|
3077
2749
|
onClick,
|
|
3078
2750
|
children: [
|
|
3079
|
-
accessibilityDescription ? /* @__PURE__ */ (0,
|
|
2751
|
+
accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
|
|
3080
2752
|
media ? (_a = getAddonStart(media)) == null ? void 0 : _a.value : null
|
|
3081
2753
|
]
|
|
3082
2754
|
}
|
|
@@ -3086,9 +2758,9 @@ function TextToolbarButton(props) {
|
|
|
3086
2758
|
const { context, control, title, media, disabled, onClick } = props;
|
|
3087
2759
|
const addonStart = media ? getAddonStart(media) : void 0;
|
|
3088
2760
|
const priority = getPriority2(control);
|
|
3089
|
-
const sentiment =
|
|
3090
|
-
return /* @__PURE__ */ (0,
|
|
3091
|
-
|
|
2761
|
+
const sentiment = getSentiment2(context);
|
|
2762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2763
|
+
import_components42.Button,
|
|
3092
2764
|
{
|
|
3093
2765
|
v2: true,
|
|
3094
2766
|
size: "sm",
|
|
@@ -3123,7 +2795,7 @@ var prefersMedia = (control) => {
|
|
|
3123
2795
|
};
|
|
3124
2796
|
var knownControls = ["primary", "secondary", "secondary-neutral"];
|
|
3125
2797
|
var isKnownControl = (control) => control !== void 0 && knownControls.includes(control);
|
|
3126
|
-
var
|
|
2798
|
+
var getSentiment2 = (context) => {
|
|
3127
2799
|
return "default";
|
|
3128
2800
|
};
|
|
3129
2801
|
var getIconButtonPriority = (control) => {
|
|
@@ -3132,16 +2804,16 @@ var getIconButtonPriority = (control) => {
|
|
|
3132
2804
|
};
|
|
3133
2805
|
|
|
3134
2806
|
// ../renderers/src/step/topbar/TopBar.tsx
|
|
3135
|
-
var
|
|
2807
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3136
2808
|
function TopBar({ back, toolbar }) {
|
|
3137
|
-
return back || toolbar ? /* @__PURE__ */ (0,
|
|
3138
|
-
back ? /* @__PURE__ */ (0,
|
|
3139
|
-
toolbar ? /* @__PURE__ */ (0,
|
|
2809
|
+
return back || toolbar ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "d-flex m-b-2", children: [
|
|
2810
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(BackButton, __spreadValues({}, back)) : null,
|
|
2811
|
+
toolbar ? /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Toolbar, __spreadValues({}, toolbar)) : null
|
|
3140
2812
|
] }) : null;
|
|
3141
2813
|
}
|
|
3142
2814
|
|
|
3143
2815
|
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3144
|
-
var
|
|
2816
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3145
2817
|
var SplashCelebrationStepRenderer = {
|
|
3146
2818
|
canRenderType: "step",
|
|
3147
2819
|
canRender: ({ control }) => control === "splash-celebration",
|
|
@@ -3151,15 +2823,15 @@ function SplashCelebrationStepRendererComponent(props) {
|
|
|
3151
2823
|
const { back, toolbar, children, footer, trackEvent } = props;
|
|
3152
2824
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3153
2825
|
useCustomTheme("forest-green", trackEvent);
|
|
3154
|
-
return /* @__PURE__ */ (0,
|
|
3155
|
-
/* @__PURE__ */ (0,
|
|
2826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2827
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TopBar, { back, toolbar }),
|
|
3156
2828
|
children,
|
|
3157
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2829
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3158
2830
|
] });
|
|
3159
2831
|
}
|
|
3160
2832
|
|
|
3161
2833
|
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3162
|
-
var
|
|
2834
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3163
2835
|
var SplashStepRenderer = {
|
|
3164
2836
|
canRenderType: "step",
|
|
3165
2837
|
canRender: ({ control }) => control === "splash",
|
|
@@ -3168,16 +2840,16 @@ var SplashStepRenderer = {
|
|
|
3168
2840
|
function SplashStepRendererComponent(props) {
|
|
3169
2841
|
const { back, toolbar, children, footer } = props;
|
|
3170
2842
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3171
|
-
return /* @__PURE__ */ (0,
|
|
3172
|
-
/* @__PURE__ */ (0,
|
|
2843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2844
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(TopBar, { back, toolbar }),
|
|
3173
2845
|
children,
|
|
3174
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2846
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3175
2847
|
] });
|
|
3176
2848
|
}
|
|
3177
2849
|
|
|
3178
2850
|
// ../renderers/src/step/StepRenderer.tsx
|
|
3179
|
-
var
|
|
3180
|
-
var
|
|
2851
|
+
var import_components43 = require("@transferwise/components");
|
|
2852
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3181
2853
|
var StepRenderer = {
|
|
3182
2854
|
canRenderType: "step",
|
|
3183
2855
|
render: StepRendererComponent
|
|
@@ -3185,19 +2857,19 @@ var StepRenderer = {
|
|
|
3185
2857
|
function StepRendererComponent(props) {
|
|
3186
2858
|
const { back, description, error, title, children, toolbar, footer, tags } = props;
|
|
3187
2859
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3188
|
-
return /* @__PURE__ */ (0,
|
|
3189
|
-
/* @__PURE__ */ (0,
|
|
3190
|
-
title || description ? /* @__PURE__ */ (0,
|
|
3191
|
-
error ? /* @__PURE__ */ (0,
|
|
2860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { children: [
|
|
2861
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TopBar, { back, toolbar }),
|
|
2862
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "m-b-4", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Header6, { title, description, tags }) }) : void 0,
|
|
2863
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components43.Alert, { type: "negative", className: "m-b-2", message: error }) : null,
|
|
3192
2864
|
children,
|
|
3193
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2865
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3194
2866
|
] });
|
|
3195
2867
|
}
|
|
3196
|
-
var
|
|
2868
|
+
var Header6 = ({ title, description, tags }) => {
|
|
3197
2869
|
const { titleType, alignmentClassName } = getHeaderStyle(tags);
|
|
3198
|
-
return /* @__PURE__ */ (0,
|
|
3199
|
-
title ? /* @__PURE__ */ (0,
|
|
3200
|
-
description ? /* @__PURE__ */ (0,
|
|
2870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
2871
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components43.Title, { as: "h1", type: titleType, className: `${alignmentClassName} m-b-2`, children: title }) : void 0,
|
|
2872
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("p", { className: `${alignmentClassName} np-text-body-large`, children: description }) : void 0
|
|
3201
2873
|
] });
|
|
3202
2874
|
};
|
|
3203
2875
|
var getHeaderStyle = (tags) => {
|
|
@@ -3208,36 +2880,36 @@ var getHeaderStyle = (tags) => {
|
|
|
3208
2880
|
};
|
|
3209
2881
|
|
|
3210
2882
|
// ../renderers/src/TabsRenderer.tsx
|
|
3211
|
-
var
|
|
3212
|
-
var
|
|
3213
|
-
var
|
|
2883
|
+
var import_components44 = require("@transferwise/components");
|
|
2884
|
+
var import_react17 = require("react");
|
|
2885
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3214
2886
|
var TabsRenderer = {
|
|
3215
2887
|
canRenderType: "tabs",
|
|
3216
2888
|
render: (props) => {
|
|
3217
2889
|
switch (props.control) {
|
|
3218
2890
|
case "segmented":
|
|
3219
2891
|
if (props.tabs.length > 3) {
|
|
3220
|
-
return /* @__PURE__ */ (0,
|
|
2892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3221
2893
|
}
|
|
3222
|
-
return /* @__PURE__ */ (0,
|
|
2894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
3223
2895
|
case "chips":
|
|
3224
|
-
return /* @__PURE__ */ (0,
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
3225
2897
|
default:
|
|
3226
|
-
return /* @__PURE__ */ (0,
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3227
2899
|
}
|
|
3228
2900
|
}
|
|
3229
2901
|
};
|
|
3230
2902
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
3231
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3232
|
-
return /* @__PURE__ */ (0,
|
|
3233
|
-
|
|
2903
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2905
|
+
import_components44.Tabs,
|
|
3234
2906
|
{
|
|
3235
2907
|
name: uid,
|
|
3236
2908
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
3237
2909
|
tabs: tabs.map((option) => ({
|
|
3238
2910
|
title: option.title,
|
|
3239
2911
|
disabled: false,
|
|
3240
|
-
content: /* @__PURE__ */ (0,
|
|
2912
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "m-t-2", children: [
|
|
3241
2913
|
" ",
|
|
3242
2914
|
option.children,
|
|
3243
2915
|
" "
|
|
@@ -3249,10 +2921,10 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3249
2921
|
}
|
|
3250
2922
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
3251
2923
|
var _a;
|
|
3252
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3253
|
-
return /* @__PURE__ */ (0,
|
|
3254
|
-
/* @__PURE__ */ (0,
|
|
3255
|
-
|
|
2924
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: getMargin(margin), children: [
|
|
2926
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2927
|
+
import_components44.SegmentedControl,
|
|
3256
2928
|
{
|
|
3257
2929
|
name: uid,
|
|
3258
2930
|
value: String(selectedIndex),
|
|
@@ -3266,31 +2938,31 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3266
2938
|
onChange: (value) => setSelectedIndex(Number(value))
|
|
3267
2939
|
}
|
|
3268
2940
|
),
|
|
3269
|
-
/* @__PURE__ */ (0,
|
|
2941
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3270
2942
|
] });
|
|
3271
2943
|
}
|
|
3272
2944
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3273
2945
|
var _a;
|
|
3274
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3275
|
-
return /* @__PURE__ */ (0,
|
|
3276
|
-
/* @__PURE__ */ (0,
|
|
3277
|
-
|
|
2946
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: getMargin(margin), children: [
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
2949
|
+
import_components44.Chips,
|
|
3278
2950
|
{
|
|
3279
2951
|
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
3280
2952
|
selected: selectedIndex,
|
|
3281
2953
|
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
3282
2954
|
}
|
|
3283
2955
|
) }),
|
|
3284
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3285
2957
|
] });
|
|
3286
2958
|
}
|
|
3287
2959
|
|
|
3288
2960
|
// ../renderers/src/TextInputRenderer.tsx
|
|
3289
|
-
var
|
|
2961
|
+
var import_components46 = require("@transferwise/components");
|
|
3290
2962
|
|
|
3291
2963
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
3292
|
-
var
|
|
3293
|
-
var
|
|
2964
|
+
var import_components45 = require("@transferwise/components");
|
|
2965
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
3294
2966
|
var commonKeys = [
|
|
3295
2967
|
"autoComplete",
|
|
3296
2968
|
"autoCapitalize",
|
|
@@ -3309,12 +2981,12 @@ function VariableTextInput(inputProps) {
|
|
|
3309
2981
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
3310
2982
|
switch (control) {
|
|
3311
2983
|
case "email":
|
|
3312
|
-
return /* @__PURE__ */ (0,
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
3313
2985
|
case "password":
|
|
3314
|
-
return /* @__PURE__ */ (0,
|
|
2986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
3315
2987
|
case "numeric": {
|
|
3316
2988
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
3317
|
-
return /* @__PURE__ */ (0,
|
|
2989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
3318
2990
|
TextInput,
|
|
3319
2991
|
__spreadProps(__spreadValues({}, numericProps), {
|
|
3320
2992
|
onChange: (newValue) => {
|
|
@@ -3325,21 +2997,21 @@ function VariableTextInput(inputProps) {
|
|
|
3325
2997
|
);
|
|
3326
2998
|
}
|
|
3327
2999
|
case "phone-number":
|
|
3328
|
-
return /* @__PURE__ */ (0,
|
|
3000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components45.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
3329
3001
|
default: {
|
|
3330
|
-
return /* @__PURE__ */ (0,
|
|
3002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
3331
3003
|
}
|
|
3332
3004
|
}
|
|
3333
3005
|
}
|
|
3334
3006
|
function TextInput(props) {
|
|
3335
3007
|
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
3336
|
-
const InputWithPattern = control === "textarea" ?
|
|
3337
|
-
const InputWithoutPattern = control === "textarea" ?
|
|
3338
|
-
return displayFormat ? /* @__PURE__ */ (0,
|
|
3008
|
+
const InputWithPattern = control === "textarea" ? import_components45.TextareaWithDisplayFormat : import_components45.InputWithDisplayFormat;
|
|
3009
|
+
const InputWithoutPattern = control === "textarea" ? import_components45.TextArea : import_components45.Input;
|
|
3010
|
+
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
3339
3011
|
}
|
|
3340
3012
|
|
|
3341
3013
|
// ../renderers/src/TextInputRenderer.tsx
|
|
3342
|
-
var
|
|
3014
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
3343
3015
|
var TextInputRenderer = {
|
|
3344
3016
|
canRenderType: "input-text",
|
|
3345
3017
|
render: (props) => {
|
|
@@ -3372,7 +3044,7 @@ var TextInputRenderer = {
|
|
|
3372
3044
|
}
|
|
3373
3045
|
}
|
|
3374
3046
|
});
|
|
3375
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
3376
3048
|
FieldInput_default,
|
|
3377
3049
|
{
|
|
3378
3050
|
id,
|
|
@@ -3380,7 +3052,7 @@ var TextInputRenderer = {
|
|
|
3380
3052
|
description,
|
|
3381
3053
|
validation: validationState,
|
|
3382
3054
|
help,
|
|
3383
|
-
children: /* @__PURE__ */ (0,
|
|
3055
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components46.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
3384
3056
|
}
|
|
3385
3057
|
);
|
|
3386
3058
|
}
|
|
@@ -3388,13 +3060,13 @@ var TextInputRenderer = {
|
|
|
3388
3060
|
var TextInputRenderer_default = TextInputRenderer;
|
|
3389
3061
|
|
|
3390
3062
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
3391
|
-
var
|
|
3063
|
+
var import_components47 = require("@transferwise/components");
|
|
3392
3064
|
|
|
3393
3065
|
// ../renderers/src/utils/getRandomId.ts
|
|
3394
3066
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
3395
3067
|
|
|
3396
3068
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
3397
|
-
var
|
|
3069
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
3398
3070
|
var UploadInputRenderer = {
|
|
3399
3071
|
canRenderType: "input-upload",
|
|
3400
3072
|
render: (props) => {
|
|
@@ -3410,15 +3082,15 @@ var UploadInputRenderer = {
|
|
|
3410
3082
|
};
|
|
3411
3083
|
return (
|
|
3412
3084
|
// We don't pass help here as there is no sensible place to display it
|
|
3413
|
-
/* @__PURE__ */ (0,
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3414
3086
|
UploadFieldInput_default,
|
|
3415
3087
|
{
|
|
3416
3088
|
id,
|
|
3417
3089
|
label: void 0,
|
|
3418
3090
|
description: void 0,
|
|
3419
3091
|
validation: validationState,
|
|
3420
|
-
children: /* @__PURE__ */ (0,
|
|
3421
|
-
|
|
3092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3093
|
+
import_components47.UploadInput,
|
|
3422
3094
|
{
|
|
3423
3095
|
id,
|
|
3424
3096
|
description,
|
|
@@ -3428,7 +3100,7 @@ var UploadInputRenderer = {
|
|
|
3428
3100
|
{
|
|
3429
3101
|
id: "my-file",
|
|
3430
3102
|
filename: value.name,
|
|
3431
|
-
status: (validationState == null ? void 0 : validationState.status) === "invalid" ?
|
|
3103
|
+
status: (validationState == null ? void 0 : validationState.status) === "invalid" ? import_components47.Status.FAILED : import_components47.Status.SUCCEEDED
|
|
3432
3104
|
}
|
|
3433
3105
|
] : void 0,
|
|
3434
3106
|
fileTypes: acceptsToFileTypes(accepts),
|
|
@@ -3483,7 +3155,7 @@ var LargeUploadRenderer = {
|
|
|
3483
3155
|
};
|
|
3484
3156
|
const filetypes = acceptsToFileTypes(accepts);
|
|
3485
3157
|
const usAccept = filetypes === "*" ? "*" : filetypes.join(",");
|
|
3486
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3487
3159
|
FieldInput_default,
|
|
3488
3160
|
{
|
|
3489
3161
|
id,
|
|
@@ -3491,8 +3163,8 @@ var LargeUploadRenderer = {
|
|
|
3491
3163
|
description,
|
|
3492
3164
|
validation: validationState,
|
|
3493
3165
|
help,
|
|
3494
|
-
children: /* @__PURE__ */ (0,
|
|
3495
|
-
|
|
3166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3167
|
+
import_components47.Upload,
|
|
3496
3168
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3497
3169
|
usAccept,
|
|
3498
3170
|
usDisabled: disabled,
|
|
@@ -3506,20 +3178,69 @@ var LargeUploadRenderer = {
|
|
|
3506
3178
|
}
|
|
3507
3179
|
};
|
|
3508
3180
|
|
|
3509
|
-
// ../renderers/src/
|
|
3510
|
-
var
|
|
3181
|
+
// ../renderers/src/ProgressRenderer.tsx
|
|
3182
|
+
var import_components48 = require("@transferwise/components");
|
|
3183
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
3184
|
+
var ProgressRenderer = {
|
|
3185
|
+
canRenderType: "progress",
|
|
3186
|
+
render: ({ uid, title, help, progress, progressText, margin, description }) => {
|
|
3187
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
3188
|
+
import_components48.ProgressBar,
|
|
3189
|
+
{
|
|
3190
|
+
id: uid,
|
|
3191
|
+
className: getMargin(margin),
|
|
3192
|
+
title: title && help ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LabelContentWithHelp, { text: title, help }) : title,
|
|
3193
|
+
description,
|
|
3194
|
+
progress: {
|
|
3195
|
+
max: 1,
|
|
3196
|
+
value: progress
|
|
3197
|
+
},
|
|
3198
|
+
textEnd: progressText
|
|
3199
|
+
}
|
|
3200
|
+
);
|
|
3201
|
+
}
|
|
3202
|
+
};
|
|
3511
3203
|
|
|
3512
|
-
// ../renderers/src/
|
|
3513
|
-
var
|
|
3514
|
-
var
|
|
3204
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
3205
|
+
var import_components52 = require("@transferwise/components");
|
|
3206
|
+
var import_icons4 = require("@transferwise/icons");
|
|
3207
|
+
var import_react_intl22 = require("react-intl");
|
|
3208
|
+
|
|
3209
|
+
// ../renderers/src/components/Header.tsx
|
|
3210
|
+
var import_components49 = require("@transferwise/components");
|
|
3211
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
3212
|
+
var Header7 = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components49.Header, { title: title != null ? title : "", action: getHeaderAction2(callToAction) });
|
|
3213
|
+
var getHeaderAction2 = (callToAction) => {
|
|
3214
|
+
if (!callToAction) {
|
|
3215
|
+
return void 0;
|
|
3216
|
+
}
|
|
3217
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
3218
|
+
return href ? {
|
|
3219
|
+
"aria-label": accessibilityDescription,
|
|
3220
|
+
text: title,
|
|
3221
|
+
href,
|
|
3222
|
+
target: "_blank"
|
|
3223
|
+
} : {
|
|
3224
|
+
"aria-label": accessibilityDescription,
|
|
3225
|
+
text: title,
|
|
3226
|
+
onClick: (event) => {
|
|
3227
|
+
event.preventDefault();
|
|
3228
|
+
onClick();
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
};
|
|
3232
|
+
|
|
3233
|
+
// ../renderers/src/utils/listItem/getAdditionalInfo.tsx
|
|
3234
|
+
var import_components50 = require("@transferwise/components");
|
|
3235
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3515
3236
|
var getAdditionalInfo = (additionalInfo) => {
|
|
3516
3237
|
if (!additionalInfo) {
|
|
3517
3238
|
return void 0;
|
|
3518
3239
|
}
|
|
3519
3240
|
const { href, text, onClick } = additionalInfo;
|
|
3520
3241
|
if (href || onClick) {
|
|
3521
|
-
return /* @__PURE__ */ (0,
|
|
3522
|
-
|
|
3242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
3243
|
+
import_components50.ListItem.AdditionalInfo,
|
|
3523
3244
|
{
|
|
3524
3245
|
action: {
|
|
3525
3246
|
label: text,
|
|
@@ -3530,60 +3251,12 @@ var getAdditionalInfo = (additionalInfo) => {
|
|
|
3530
3251
|
}
|
|
3531
3252
|
);
|
|
3532
3253
|
}
|
|
3533
|
-
return /* @__PURE__ */ (0,
|
|
3534
|
-
};
|
|
3535
|
-
|
|
3536
|
-
// ../renderers/src/NewListItem/shouldUseAvatar.ts
|
|
3537
|
-
var shouldUseAvatar = (control, tags) => {
|
|
3538
|
-
var _a;
|
|
3539
|
-
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
3540
|
-
};
|
|
3541
|
-
|
|
3542
|
-
// ../renderers/src/NewListItem/NewDecisionRenderer.tsx
|
|
3543
|
-
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3544
|
-
var DecisionRenderer2 = {
|
|
3545
|
-
canRenderType: "decision",
|
|
3546
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
|
|
3547
|
-
};
|
|
3548
|
-
var renderDecisionList2 = ({ options, control }) => {
|
|
3549
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_jsx_runtime79.Fragment, { children: options.map((_a) => {
|
|
3550
|
-
var _b = _a, { disabled, onClick } = _b, rest = __objRest(_b, ["disabled", "onClick"]);
|
|
3551
|
-
const {
|
|
3552
|
-
description,
|
|
3553
|
-
media,
|
|
3554
|
-
title: itemTitle,
|
|
3555
|
-
href,
|
|
3556
|
-
additionalText,
|
|
3557
|
-
inlineAlert,
|
|
3558
|
-
supportingValues,
|
|
3559
|
-
tags
|
|
3560
|
-
} = rest;
|
|
3561
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3562
|
-
import_components56.ListItem,
|
|
3563
|
-
{
|
|
3564
|
-
title: itemTitle,
|
|
3565
|
-
subtitle: description,
|
|
3566
|
-
spotlight: control === "spotlight" ? (tags == null ? void 0 : tags.includes("spotlight-active")) ? "active" : "inactive" : void 0,
|
|
3567
|
-
disabled,
|
|
3568
|
-
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3569
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3570
|
-
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
3571
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3572
|
-
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
3573
|
-
control: href ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.ListItem.Navigation, { onClick })
|
|
3574
|
-
},
|
|
3575
|
-
JSON.stringify(rest)
|
|
3576
|
-
);
|
|
3577
|
-
}) });
|
|
3254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components50.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
3578
3255
|
};
|
|
3579
|
-
var NewDecisionRenderer_default = DecisionRenderer2;
|
|
3580
3256
|
|
|
3581
|
-
// ../renderers/src/
|
|
3582
|
-
var
|
|
3583
|
-
|
|
3584
|
-
// ../renderers/src/NewListItem/getCTAControl.tsx
|
|
3585
|
-
var import_components57 = require("@transferwise/components");
|
|
3586
|
-
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3257
|
+
// ../renderers/src/utils/listItem/getCTAControl.tsx
|
|
3258
|
+
var import_components51 = require("@transferwise/components");
|
|
3259
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
3587
3260
|
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
3588
3261
|
if (!callToAction) {
|
|
3589
3262
|
return void 0;
|
|
@@ -3591,8 +3264,8 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3591
3264
|
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
3592
3265
|
const priority = ctaSecondary ? "secondary" : "secondary-neutral";
|
|
3593
3266
|
if (href) {
|
|
3594
|
-
return /* @__PURE__ */ (0,
|
|
3595
|
-
|
|
3267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3268
|
+
import_components51.ListItem.Button,
|
|
3596
3269
|
{
|
|
3597
3270
|
href,
|
|
3598
3271
|
partiallyInteractive: !fullyInteractive,
|
|
@@ -3602,8 +3275,8 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3602
3275
|
}
|
|
3603
3276
|
);
|
|
3604
3277
|
}
|
|
3605
|
-
return /* @__PURE__ */ (0,
|
|
3606
|
-
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3279
|
+
import_components51.ListItem.Button,
|
|
3607
3280
|
{
|
|
3608
3281
|
"aria-description": accessibilityDescription,
|
|
3609
3282
|
partiallyInteractive: !fullyInteractive,
|
|
@@ -3614,119 +3287,319 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3614
3287
|
);
|
|
3615
3288
|
};
|
|
3616
3289
|
|
|
3617
|
-
// ../renderers/src/
|
|
3618
|
-
var
|
|
3619
|
-
var
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3290
|
+
// ../renderers/src/utils/listItem/shouldUseAvatar.ts
|
|
3291
|
+
var shouldUseAvatar = (control, tags) => {
|
|
3292
|
+
var _a;
|
|
3293
|
+
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
3294
|
+
};
|
|
3295
|
+
|
|
3296
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
3297
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3298
|
+
var IGNORED_CONTROLS = [
|
|
3299
|
+
"horizontal",
|
|
3300
|
+
"horizontal-end-aligned",
|
|
3301
|
+
"horizontal-start-aligned",
|
|
3302
|
+
"vertical-two-column"
|
|
3303
|
+
];
|
|
3304
|
+
var ReviewRenderer = {
|
|
3305
|
+
canRenderType: "review",
|
|
3306
|
+
canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
|
|
3307
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Review, __spreadValues({}, props))
|
|
3308
|
+
};
|
|
3309
|
+
var Review = ({
|
|
3310
|
+
callToAction,
|
|
3311
|
+
control,
|
|
3312
|
+
margin,
|
|
3313
|
+
fields,
|
|
3314
|
+
tags,
|
|
3315
|
+
title,
|
|
3316
|
+
trackEvent
|
|
3317
|
+
}) => {
|
|
3318
|
+
const intl = (0, import_react_intl22.useIntl)();
|
|
3319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: getMargin(margin), children: [
|
|
3320
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Header7, { title, callToAction }),
|
|
3321
|
+
fields.map((field) => {
|
|
3322
|
+
var _a, _b, _c;
|
|
3625
3323
|
const {
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
supportingValues,
|
|
3324
|
+
label,
|
|
3325
|
+
value,
|
|
3629
3326
|
media,
|
|
3630
3327
|
additionalInfo,
|
|
3631
3328
|
inlineAlert,
|
|
3329
|
+
help,
|
|
3330
|
+
analyticsId,
|
|
3632
3331
|
callToAction: itemCallToAction,
|
|
3633
3332
|
tags: itemTags
|
|
3634
|
-
} =
|
|
3333
|
+
} = field;
|
|
3635
3334
|
const controlOptions = {
|
|
3636
3335
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3637
3336
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3638
3337
|
};
|
|
3639
|
-
return /* @__PURE__ */ (0,
|
|
3640
|
-
|
|
3338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
3339
|
+
import_components52.ListItem,
|
|
3641
3340
|
{
|
|
3642
|
-
title:
|
|
3643
|
-
subtitle:
|
|
3644
|
-
|
|
3645
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3341
|
+
title: value,
|
|
3342
|
+
subtitle: label,
|
|
3343
|
+
inverted: true,
|
|
3646
3344
|
media: getMedia(media, shouldUseAvatar(control, itemTags)),
|
|
3345
|
+
control: (_c = getCTAControl(itemCallToAction, controlOptions)) != null ? _c : help ? getHelpControl(
|
|
3346
|
+
help,
|
|
3347
|
+
intl.formatMessage(help_messages_default.helpAria),
|
|
3348
|
+
() => trackEvent("Help Pressed", { layoutItemId: analyticsId })
|
|
3349
|
+
) : void 0,
|
|
3647
3350
|
prompt: getInlineAlert(inlineAlert),
|
|
3648
|
-
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3649
|
-
control: getCTAControl(itemCallToAction, controlOptions)
|
|
3351
|
+
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3650
3352
|
},
|
|
3651
|
-
|
|
3353
|
+
JSON.stringify(field)
|
|
3652
3354
|
);
|
|
3653
3355
|
})
|
|
3654
|
-
] })
|
|
3356
|
+
] });
|
|
3357
|
+
};
|
|
3358
|
+
var getHelpControl = (help, ariaLabel, onClick) => {
|
|
3359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.Popover, { content: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.Markdown, { config: { link: { target: "_blank" } }, children: help }), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.ListItem.IconButton, { partiallyInteractive: true, "aria-label": ariaLabel, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_icons4.QuestionMarkCircle, {}) }) });
|
|
3655
3360
|
};
|
|
3656
|
-
var
|
|
3361
|
+
var ReviewRenderer_default = ReviewRenderer;
|
|
3657
3362
|
|
|
3658
|
-
// ../renderers/src/
|
|
3659
|
-
var
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
var
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
var
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3363
|
+
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
3364
|
+
var import_components55 = require("@transferwise/components");
|
|
3365
|
+
|
|
3366
|
+
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
3367
|
+
var import_components54 = require("@transferwise/components");
|
|
3368
|
+
var import_react18 = require("react");
|
|
3369
|
+
var import_react_intl25 = require("react-intl");
|
|
3370
|
+
|
|
3371
|
+
// ../renderers/src/messages/filter.messages.ts
|
|
3372
|
+
var import_react_intl23 = require("react-intl");
|
|
3373
|
+
var filter_messages_default = (0, import_react_intl23.defineMessages)({
|
|
3374
|
+
placeholder: {
|
|
3375
|
+
id: "df.wise.filter.placeholder",
|
|
3376
|
+
defaultMessage: "Start typing to search",
|
|
3377
|
+
description: "Placeholder for the filter input"
|
|
3378
|
+
},
|
|
3379
|
+
results: {
|
|
3380
|
+
id: "df.wise.filter.results",
|
|
3381
|
+
defaultMessage: "Search results",
|
|
3382
|
+
description: "Label for the results section"
|
|
3383
|
+
},
|
|
3384
|
+
noResults: {
|
|
3385
|
+
id: "df.wise.filter.noResults",
|
|
3386
|
+
defaultMessage: "No results",
|
|
3387
|
+
description: "Message for if there are no results"
|
|
3388
|
+
}
|
|
3389
|
+
});
|
|
3390
|
+
|
|
3391
|
+
// ../renderers/src/DecisionRenderer/filter-and-sort-decision-options.ts
|
|
3392
|
+
function filterAndSortDecisionOptions(selectOptions, query) {
|
|
3393
|
+
const upperQuery = normalizeAndRemoveAccents(query);
|
|
3394
|
+
const filteredItems = selectOptions.filter((option) => {
|
|
3395
|
+
var _a, _b, _c, _d;
|
|
3396
|
+
const searchableWords = [
|
|
3397
|
+
option.title,
|
|
3398
|
+
option.description,
|
|
3399
|
+
option.additionalText,
|
|
3400
|
+
(_a = option.supportingValues) == null ? void 0 : _a.value,
|
|
3401
|
+
(_b = option.supportingValues) == null ? void 0 : _b.subvalue,
|
|
3402
|
+
...(_c = option.keywords) != null ? _c : []
|
|
3403
|
+
];
|
|
3404
|
+
return (_d = searchableWords.some(
|
|
3405
|
+
(word) => word && normalizeAndRemoveAccents(word).includes(upperQuery)
|
|
3406
|
+
)) != null ? _d : false;
|
|
3407
|
+
});
|
|
3408
|
+
return [...filteredItems].sort((a, b) => {
|
|
3409
|
+
if (a.disabled && !b.disabled) {
|
|
3410
|
+
return 1;
|
|
3411
|
+
}
|
|
3412
|
+
if (!a.disabled && b.disabled) {
|
|
3413
|
+
return -1;
|
|
3414
|
+
}
|
|
3415
|
+
const aTitleUpper = a.title.toUpperCase();
|
|
3416
|
+
const bTitleUpper = b.title.toUpperCase();
|
|
3417
|
+
const aTitleStarts = aTitleUpper.startsWith(upperQuery);
|
|
3418
|
+
const bTitleStarts = bTitleUpper.startsWith(upperQuery);
|
|
3419
|
+
if (aTitleStarts && !bTitleStarts) {
|
|
3420
|
+
return -1;
|
|
3421
|
+
}
|
|
3422
|
+
if (!aTitleStarts && bTitleStarts) {
|
|
3423
|
+
return 1;
|
|
3424
|
+
}
|
|
3425
|
+
const aWordStarts = aTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
3426
|
+
const bWordStarts = bTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
3427
|
+
if (aWordStarts && !bWordStarts) {
|
|
3428
|
+
return -1;
|
|
3429
|
+
}
|
|
3430
|
+
if (!aWordStarts && bWordStarts) {
|
|
3431
|
+
return 1;
|
|
3432
|
+
}
|
|
3433
|
+
return a.title.localeCompare(b.title);
|
|
3434
|
+
});
|
|
3435
|
+
}
|
|
3436
|
+
var normalizeAndRemoveAccents = (text) => text.trim().toLowerCase().normalize("NFKD").replace(new RegExp("\\p{Diacritic}", "gu"), "");
|
|
3437
|
+
|
|
3438
|
+
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
3439
|
+
var import_components53 = require("@transferwise/components");
|
|
3440
|
+
var import_react_intl24 = require("react-intl");
|
|
3441
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
3442
|
+
var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
3443
|
+
var isGroupedDecision = (options) => {
|
|
3444
|
+
return getGroupsFromTags(groupingTags2, options).length > 0;
|
|
3445
|
+
};
|
|
3446
|
+
var GroupedDecisionList = (_a) => {
|
|
3447
|
+
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
3448
|
+
const { formatMessage } = (0, import_react_intl24.useIntl)();
|
|
3449
|
+
const { options } = rest;
|
|
3450
|
+
const itemsByTag = [...getGroupsFromTags(groupingTags2, options), { tag: "all", items: options }];
|
|
3451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: itemsByTag.map(({ tag, items }) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_components53.Section, { children: [
|
|
3452
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
3453
|
+
import_components53.Header,
|
|
3454
|
+
{
|
|
3455
|
+
as: "h2",
|
|
3456
|
+
title: tag in group_messages_default ? formatMessage(group_messages_default[tag]) : tag
|
|
3457
|
+
}
|
|
3458
|
+
),
|
|
3459
|
+
renderDecisionList2(__spreadProps(__spreadValues({}, rest), { options: items }))
|
|
3460
|
+
] }, tag)) });
|
|
3461
|
+
};
|
|
3462
|
+
|
|
3463
|
+
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
3464
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3465
|
+
var DecisionWrapper = (props) => {
|
|
3466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
3467
|
+
props.title && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components54.Header, { as: "h2", title: props.title }),
|
|
3468
|
+
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
3469
|
+
] });
|
|
3470
|
+
};
|
|
3471
|
+
var UnfilteredDecisionList = (_a) => {
|
|
3472
|
+
var _b = _a, { renderDecisionList: renderDecisionList2 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
3473
|
+
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList2 })) : renderDecisionList2(rest);
|
|
3474
|
+
};
|
|
3475
|
+
var FilteredDecisionList = (props) => {
|
|
3476
|
+
const { formatMessage } = (0, import_react_intl25.useIntl)();
|
|
3477
|
+
const [query, setQuery] = (0, import_react18.useState)("");
|
|
3478
|
+
const { control, options, renderDecisionList: renderDecisionList2 } = props;
|
|
3479
|
+
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
3480
|
+
const isGrouped = isGroupedDecision(options);
|
|
3481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3483
|
+
import_components54.SearchInput,
|
|
3484
|
+
{
|
|
3485
|
+
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
3486
|
+
value: query,
|
|
3487
|
+
className: "m-b-2",
|
|
3488
|
+
onChange: (e) => {
|
|
3489
|
+
var _a;
|
|
3490
|
+
return setQuery((_a = e.target.value) != null ? _a : "");
|
|
3491
|
+
}
|
|
3492
|
+
}
|
|
3493
|
+
),
|
|
3494
|
+
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
3495
|
+
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components54.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
3496
|
+
filteredOptions.length > 0 ? renderDecisionList2({
|
|
3497
|
+
control,
|
|
3498
|
+
className: query.length === 0 ? "m-t-3" : "",
|
|
3499
|
+
options: filteredOptions
|
|
3500
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
3501
|
+
] })
|
|
3502
|
+
] });
|
|
3503
|
+
};
|
|
3504
|
+
|
|
3505
|
+
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
3506
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
3507
|
+
var DecisionRenderer = {
|
|
3508
|
+
canRenderType: "decision",
|
|
3509
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }))
|
|
3510
|
+
};
|
|
3511
|
+
var renderDecisionList = ({ options, control }) => {
|
|
3512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_jsx_runtime78.Fragment, { children: options.map((_a) => {
|
|
3513
|
+
var _b = _a, { disabled, onClick } = _b, rest = __objRest(_b, ["disabled", "onClick"]);
|
|
3514
|
+
const {
|
|
3515
|
+
description,
|
|
3516
|
+
media,
|
|
3517
|
+
title: itemTitle,
|
|
3518
|
+
href,
|
|
3519
|
+
additionalText,
|
|
3520
|
+
inlineAlert,
|
|
3521
|
+
supportingValues,
|
|
3522
|
+
tags
|
|
3523
|
+
} = rest;
|
|
3524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
3525
|
+
import_components55.ListItem,
|
|
3526
|
+
{
|
|
3527
|
+
title: itemTitle,
|
|
3528
|
+
subtitle: description,
|
|
3529
|
+
spotlight: control === "spotlight" ? (tags == null ? void 0 : tags.includes("spotlight-active")) ? "active" : "inactive" : void 0,
|
|
3530
|
+
disabled,
|
|
3531
|
+
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3532
|
+
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3533
|
+
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
3534
|
+
prompt: getInlineAlert(inlineAlert),
|
|
3535
|
+
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
3536
|
+
control: href ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.Navigation, { onClick })
|
|
3537
|
+
},
|
|
3538
|
+
JSON.stringify(rest)
|
|
3539
|
+
);
|
|
3540
|
+
}) });
|
|
3541
|
+
};
|
|
3542
|
+
var DecisionRenderer_default = DecisionRenderer;
|
|
3543
|
+
|
|
3544
|
+
// ../renderers/src/ListRenderer.tsx
|
|
3545
|
+
var import_components56 = require("@transferwise/components");
|
|
3546
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3547
|
+
var ListRenderer = {
|
|
3548
|
+
canRenderType: "list",
|
|
3549
|
+
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getMargin(margin), children: [
|
|
3550
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Header7, { title, callToAction }),
|
|
3551
|
+
items.map((item) => {
|
|
3552
|
+
var _a, _b;
|
|
3675
3553
|
const {
|
|
3676
|
-
|
|
3677
|
-
|
|
3554
|
+
title: itemTitle,
|
|
3555
|
+
description,
|
|
3556
|
+
supportingValues,
|
|
3678
3557
|
media,
|
|
3679
3558
|
additionalInfo,
|
|
3680
3559
|
inlineAlert,
|
|
3681
|
-
help,
|
|
3682
3560
|
callToAction: itemCallToAction,
|
|
3683
3561
|
tags: itemTags
|
|
3684
|
-
} =
|
|
3562
|
+
} = item;
|
|
3685
3563
|
const controlOptions = {
|
|
3686
3564
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3687
3565
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3688
3566
|
};
|
|
3689
|
-
return /* @__PURE__ */ (0,
|
|
3690
|
-
|
|
3567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3568
|
+
import_components56.ListItem,
|
|
3691
3569
|
{
|
|
3692
|
-
title:
|
|
3693
|
-
subtitle:
|
|
3694
|
-
|
|
3570
|
+
title: itemTitle,
|
|
3571
|
+
subtitle: description,
|
|
3572
|
+
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3573
|
+
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3695
3574
|
media: getMedia(media, shouldUseAvatar(control, itemTags)),
|
|
3696
|
-
control: (_c = getCTAControl(itemCallToAction, controlOptions)) != null ? _c : getHelpControl(help),
|
|
3697
3575
|
prompt: getInlineAlert(inlineAlert),
|
|
3698
|
-
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3576
|
+
additionalInfo: getAdditionalInfo(additionalInfo),
|
|
3577
|
+
control: getCTAControl(itemCallToAction, controlOptions)
|
|
3699
3578
|
},
|
|
3700
|
-
|
|
3579
|
+
itemTitle
|
|
3701
3580
|
);
|
|
3702
3581
|
})
|
|
3703
3582
|
] })
|
|
3704
3583
|
};
|
|
3705
|
-
var
|
|
3706
|
-
if (!help) {
|
|
3707
|
-
return void 0;
|
|
3708
|
-
}
|
|
3709
|
-
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components59.Popover, { content: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components59.Markdown, { config: { link: { target: "_blank" } }, children: help }), children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components59.ListItem.IconButton, { partiallyInteractive: true, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_icons4.QuestionMarkCircle, {}) }) });
|
|
3710
|
-
};
|
|
3711
|
-
var NewReviewRenderer_default = ReviewRenderer2;
|
|
3584
|
+
var ListRenderer_default = ListRenderer;
|
|
3712
3585
|
|
|
3713
|
-
// ../renderers/src/
|
|
3714
|
-
var
|
|
3715
|
-
var
|
|
3716
|
-
var
|
|
3586
|
+
// ../renderers/src/StatusListRenderer.tsx
|
|
3587
|
+
var import_components57 = require("@transferwise/components");
|
|
3588
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3589
|
+
var StatusListRenderer = {
|
|
3717
3590
|
canRenderType: "status-list",
|
|
3718
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
3719
|
-
title ? /* @__PURE__ */ (0,
|
|
3591
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: getMargin(margin), children: [
|
|
3592
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components57.Header, { title }) : null,
|
|
3720
3593
|
items.map((item) => {
|
|
3721
3594
|
const { callToAction, description, icon, status, title: itemTitle } = item;
|
|
3722
|
-
return /* @__PURE__ */ (0,
|
|
3723
|
-
|
|
3595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3596
|
+
import_components57.ListItem,
|
|
3724
3597
|
{
|
|
3725
3598
|
title: itemTitle,
|
|
3726
3599
|
subtitle: description,
|
|
3727
|
-
media: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
3728
|
-
additionalInfo: callToAction ? /* @__PURE__ */ (0,
|
|
3729
|
-
|
|
3600
|
+
media: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_components57.AvatarView, { badge: { status: mapStatus(status) }, children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(DynamicIcon_default, { name: icon.name }) }) : void 0,
|
|
3601
|
+
additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3602
|
+
import_components57.ListItem.AdditionalInfo,
|
|
3730
3603
|
{
|
|
3731
3604
|
action: {
|
|
3732
3605
|
href: callToAction.href,
|
|
@@ -3742,7 +3615,7 @@ var NewStatusListRenderer = {
|
|
|
3742
3615
|
})
|
|
3743
3616
|
] })
|
|
3744
3617
|
};
|
|
3745
|
-
var
|
|
3618
|
+
var mapStatus = (status) => {
|
|
3746
3619
|
switch (status) {
|
|
3747
3620
|
case "done":
|
|
3748
3621
|
return "positive";
|
|
@@ -3752,136 +3625,292 @@ var mapStatus2 = (status) => {
|
|
|
3752
3625
|
return void 0;
|
|
3753
3626
|
}
|
|
3754
3627
|
};
|
|
3755
|
-
var
|
|
3628
|
+
var StatusListRenderer_default = StatusListRenderer;
|
|
3756
3629
|
|
|
3757
|
-
// ../renderers/src/
|
|
3758
|
-
var
|
|
3630
|
+
// ../renderers/src/ReviewLegacyRenderer.tsx
|
|
3631
|
+
var import_components58 = require("@transferwise/components");
|
|
3632
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
3633
|
+
var ReviewRenderer2 = {
|
|
3634
|
+
canRenderType: "review",
|
|
3635
|
+
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
3636
|
+
const orientation = mapControlToDefinitionListLayout(control);
|
|
3637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: getMargin(margin), children: [
|
|
3638
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Header7, { title, callToAction }),
|
|
3639
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
3640
|
+
import_components58.DefinitionList,
|
|
3641
|
+
{
|
|
3642
|
+
layout: orientation,
|
|
3643
|
+
definitions: fields.map(
|
|
3644
|
+
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
3645
|
+
key: String(index),
|
|
3646
|
+
value,
|
|
3647
|
+
title: getFieldLabel(
|
|
3648
|
+
label,
|
|
3649
|
+
help,
|
|
3650
|
+
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
3651
|
+
)
|
|
3652
|
+
})
|
|
3653
|
+
)
|
|
3654
|
+
}
|
|
3655
|
+
) })
|
|
3656
|
+
] });
|
|
3657
|
+
}
|
|
3658
|
+
};
|
|
3659
|
+
var ReviewLegacyRenderer_default = ReviewRenderer2;
|
|
3660
|
+
var mapControlToDefinitionListLayout = (control) => {
|
|
3661
|
+
switch (control) {
|
|
3662
|
+
case "horizontal":
|
|
3663
|
+
case "horizontal-end-aligned":
|
|
3664
|
+
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
3665
|
+
case "horizontal-start-aligned":
|
|
3666
|
+
return "HORIZONTAL_LEFT_ALIGNED";
|
|
3667
|
+
case "vertical-two-column":
|
|
3668
|
+
return "VERTICAL_TWO_COLUMN";
|
|
3669
|
+
case "vertical":
|
|
3670
|
+
case "vertical-one-column":
|
|
3671
|
+
default:
|
|
3672
|
+
return "VERTICAL_ONE_COLUMN";
|
|
3673
|
+
}
|
|
3674
|
+
};
|
|
3675
|
+
var getFieldLabel = (label, help, onClick) => {
|
|
3676
|
+
if (help) {
|
|
3677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [
|
|
3678
|
+
label,
|
|
3679
|
+
" ",
|
|
3680
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Help_default, { help, onClick })
|
|
3681
|
+
] });
|
|
3682
|
+
}
|
|
3683
|
+
return label;
|
|
3684
|
+
};
|
|
3759
3685
|
|
|
3760
|
-
// ../renderers/src/
|
|
3761
|
-
var
|
|
3762
|
-
|
|
3686
|
+
// ../renderers/src/getWiseRenderers.ts
|
|
3687
|
+
var getWiseRenderers = () => [
|
|
3688
|
+
AddressValidationButtonRenderer_default,
|
|
3689
|
+
AlertRenderer_default,
|
|
3690
|
+
CheckboxInputRenderer_default,
|
|
3691
|
+
BoxRenderer_default,
|
|
3692
|
+
ButtonRenderer,
|
|
3693
|
+
ColumnsRenderer_default,
|
|
3694
|
+
DateInputRenderer_default,
|
|
3695
|
+
DecisionRenderer_default,
|
|
3696
|
+
DividerRenderer_default,
|
|
3697
|
+
ExternalConfirmationRenderer_default,
|
|
3698
|
+
FormRenderer_default,
|
|
3699
|
+
FormSectionRenderer_default,
|
|
3700
|
+
HeadingRenderer_default,
|
|
3701
|
+
ImageRenderer_default,
|
|
3702
|
+
InstructionsRenderer_default,
|
|
3703
|
+
IntegerInputRenderer_default,
|
|
3704
|
+
LargeUploadRenderer,
|
|
3705
|
+
ListRenderer_default,
|
|
3706
|
+
LoadingIndicatorRenderer_default,
|
|
3707
|
+
MarkdownRenderer_default,
|
|
3708
|
+
ModalRenderer,
|
|
3709
|
+
ModalLayoutRenderer_default,
|
|
3710
|
+
MoneyInputRenderer,
|
|
3711
|
+
MultiSelectInputRenderer_default,
|
|
3712
|
+
MultiUploadInputRenderer_default,
|
|
3713
|
+
NumberInputRenderer_default,
|
|
3714
|
+
ParagraphRenderer_default,
|
|
3715
|
+
ProgressRenderer,
|
|
3716
|
+
RepeatableRenderer_default,
|
|
3717
|
+
ReviewRenderer_default,
|
|
3718
|
+
SearchRenderer_default,
|
|
3719
|
+
SelectInputRenderer_default,
|
|
3720
|
+
SectionRenderer_default,
|
|
3721
|
+
StatusListRenderer_default,
|
|
3722
|
+
TabsRenderer,
|
|
3723
|
+
TextInputRenderer_default,
|
|
3724
|
+
UploadInputRenderer,
|
|
3725
|
+
SplashStepRenderer,
|
|
3726
|
+
SplashCelebrationStepRenderer,
|
|
3727
|
+
StepRenderer,
|
|
3728
|
+
// Legacy renderer must come afterwards
|
|
3729
|
+
ReviewLegacyRenderer_default
|
|
3730
|
+
];
|
|
3763
3731
|
|
|
3764
|
-
//
|
|
3765
|
-
var
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3732
|
+
// src/dynamicFlow/telemetry/app-version.ts
|
|
3733
|
+
var appVersion = (
|
|
3734
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
3735
|
+
typeof process !== "undefined" ? "4.38.0" : "0.0.0"
|
|
3736
|
+
);
|
|
3737
|
+
|
|
3738
|
+
// src/dynamicFlow/telemetry/getLogEvent.ts
|
|
3739
|
+
var getLogEvent = (onLog) => (level, message, extra) => {
|
|
3740
|
+
const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
|
|
3741
|
+
dfWiseVersion: appVersion
|
|
3742
|
+
});
|
|
3743
|
+
if (level !== "info" && onLog) {
|
|
3744
|
+
if (onLog) {
|
|
3745
|
+
onLog(level, message, extraWithVersion);
|
|
3746
|
+
} else {
|
|
3747
|
+
logToRollbar(level, message, extraWithVersion);
|
|
3748
|
+
}
|
|
3749
|
+
}
|
|
3770
3750
|
};
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3751
|
+
var logToRollbar = (level, message, extra) => {
|
|
3752
|
+
try {
|
|
3753
|
+
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
3754
|
+
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
3755
|
+
} catch (error) {
|
|
3756
|
+
console.error("Failed to log to Rollbar", error);
|
|
3757
|
+
}
|
|
3758
|
+
};
|
|
3759
|
+
|
|
3760
|
+
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
3761
|
+
var import_components_theming2 = require("@wise/components-theming");
|
|
3762
|
+
var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
|
|
3763
|
+
onEvent == null ? void 0 : onEvent(name, properties);
|
|
3764
|
+
if (name.includes(ThemeRequiredEventName)) {
|
|
3765
|
+
const { theme } = properties != null ? properties : { theme: "personal" };
|
|
3766
|
+
if (theme && (0, import_components_theming2.isThemeModern)(theme)) {
|
|
3767
|
+
onThemeChange == null ? void 0 : onThemeChange(theme);
|
|
3777
3768
|
}
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3769
|
+
} else {
|
|
3770
|
+
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
3773
|
+
|
|
3774
|
+
// src/dynamicFlow/messages.ts
|
|
3775
|
+
var import_react_intl26 = require("react-intl");
|
|
3776
|
+
var messages_default = (0, import_react_intl26.defineMessages)({
|
|
3777
|
+
copied: {
|
|
3778
|
+
id: "df.wise.CopyFeedback.copy",
|
|
3779
|
+
defaultMessage: "Copied to clipboard",
|
|
3780
|
+
description: "Appears in a snackbar when the copy operation succeeds."
|
|
3781
|
+
},
|
|
3782
|
+
copyFailed: {
|
|
3783
|
+
id: "df.wise.CopyFeedback.copyFailed",
|
|
3784
|
+
defaultMessage: "Failed to copy to clipboard",
|
|
3785
|
+
description: "Appears in a snackbar when the copy operation fails."
|
|
3786
|
+
}
|
|
3787
|
+
});
|
|
3788
|
+
|
|
3789
|
+
// src/dynamicFlow/DynamicFlow.tsx
|
|
3790
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
3791
|
+
var wiseRenderers = getWiseRenderers();
|
|
3792
|
+
function DynamicFlow(props) {
|
|
3793
|
+
const {
|
|
3794
|
+
className = "",
|
|
3795
|
+
customFetch = globalThis.fetch,
|
|
3796
|
+
renderers,
|
|
3797
|
+
displayStepTitle = true,
|
|
3798
|
+
features = {},
|
|
3799
|
+
onAnalytics,
|
|
3800
|
+
onEvent,
|
|
3801
|
+
onLog,
|
|
3802
|
+
onLink = openLinkInNewTab,
|
|
3803
|
+
onThemeChange
|
|
3804
|
+
} = props;
|
|
3805
|
+
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
3806
|
+
const createSnackBar = useSnackBarIfAvailable();
|
|
3807
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
3808
|
+
const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
3809
|
+
const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
3810
|
+
const trackEvent = (0, import_react19.useMemo)(
|
|
3811
|
+
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
3812
|
+
[onEvent, onAnalytics, onThemeChange]
|
|
3813
|
+
);
|
|
3814
|
+
const onCopy = (copiedContent) => {
|
|
3815
|
+
if (copiedContent) {
|
|
3816
|
+
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
3817
|
+
} else {
|
|
3818
|
+
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
3819
|
+
}
|
|
3820
|
+
};
|
|
3821
|
+
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
3822
|
+
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3823
|
+
httpClient,
|
|
3824
|
+
renderers: mergedRenderers,
|
|
3825
|
+
onEvent: trackEvent,
|
|
3826
|
+
onLog: logEvent,
|
|
3827
|
+
onLink,
|
|
3828
|
+
onCopy
|
|
3829
|
+
});
|
|
3830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_dynamic_flow_client.DynamicFlow, __spreadValues({}, coreProps)) });
|
|
3831
|
+
}
|
|
3832
|
+
var DynamicForm = (0, import_react19.forwardRef)(function DynamicForm2(props, ref) {
|
|
3833
|
+
const {
|
|
3834
|
+
className = "",
|
|
3835
|
+
customFetch = globalThis.fetch,
|
|
3836
|
+
renderers,
|
|
3837
|
+
displayStepTitle = true,
|
|
3838
|
+
features = {},
|
|
3839
|
+
onAnalytics,
|
|
3840
|
+
onEvent,
|
|
3841
|
+
onLog,
|
|
3842
|
+
onLink = openLinkInNewTab,
|
|
3843
|
+
onThemeChange
|
|
3844
|
+
} = props;
|
|
3845
|
+
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
3846
|
+
const createSnackBar = useSnackBarIfAvailable();
|
|
3847
|
+
const httpClient = useWiseHttpClient(customFetch);
|
|
3848
|
+
const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
3849
|
+
const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
3850
|
+
const trackEvent = (0, import_react19.useMemo)(
|
|
3851
|
+
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
3852
|
+
[onEvent, onAnalytics, onThemeChange]
|
|
3853
|
+
);
|
|
3854
|
+
const onCopy = (copiedContent) => {
|
|
3855
|
+
if (copiedContent) {
|
|
3856
|
+
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
3857
|
+
} else {
|
|
3858
|
+
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
3796
3859
|
}
|
|
3797
|
-
|
|
3798
|
-
}
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
},
|
|
3819
|
-
textEnd: progressText
|
|
3860
|
+
};
|
|
3861
|
+
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
3862
|
+
httpClient,
|
|
3863
|
+
renderers: mergedRenderers,
|
|
3864
|
+
features: __spreadValues({ hideStepTitle: !displayStepTitle }, features),
|
|
3865
|
+
onEvent: trackEvent,
|
|
3866
|
+
onLog: logEvent,
|
|
3867
|
+
onLink,
|
|
3868
|
+
onCopy
|
|
3869
|
+
});
|
|
3870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_dynamic_flow_client.DynamicForm, __spreadProps(__spreadValues({}, coreProps), { ref })) });
|
|
3871
|
+
});
|
|
3872
|
+
var useWiseHttpClient = (httpClient) => {
|
|
3873
|
+
const { locale } = (0, import_react_intl27.useIntl)();
|
|
3874
|
+
return (0, import_react19.useCallback)(
|
|
3875
|
+
async (input, init = {}) => {
|
|
3876
|
+
const headers = new Headers(init.headers);
|
|
3877
|
+
headers.set("accept-language", locale);
|
|
3878
|
+
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
|
|
3879
|
+
if (timeZone) {
|
|
3880
|
+
headers.set("time-zone", timeZone);
|
|
3820
3881
|
}
|
|
3821
|
-
|
|
3882
|
+
const requestInit = __spreadProps(__spreadValues({}, init), { credentials: "include", headers });
|
|
3883
|
+
return httpClient(input, requestInit).catch(handleRejection);
|
|
3884
|
+
},
|
|
3885
|
+
[httpClient, locale]
|
|
3886
|
+
);
|
|
3887
|
+
};
|
|
3888
|
+
var handleRejection = (error) => {
|
|
3889
|
+
if (error instanceof Error && error.message === "SCA_MODAL_CLOSED") {
|
|
3890
|
+
return new Response(JSON.stringify({ validation: {} }), { status: 400 });
|
|
3891
|
+
}
|
|
3892
|
+
throw error;
|
|
3893
|
+
};
|
|
3894
|
+
var openLinkInNewTab = (url) => {
|
|
3895
|
+
var _a;
|
|
3896
|
+
try {
|
|
3897
|
+
const w = (_a = window == null ? void 0 : window.open) == null ? void 0 : _a.call(window, url, "_blank");
|
|
3898
|
+
return Boolean(w);
|
|
3899
|
+
} catch (e) {
|
|
3900
|
+
return false;
|
|
3822
3901
|
}
|
|
3823
3902
|
};
|
|
3824
3903
|
|
|
3825
|
-
//
|
|
3826
|
-
var
|
|
3827
|
-
NewDecisionRenderer_default,
|
|
3828
|
-
NewListRenderer_default,
|
|
3829
|
-
NewReviewRenderer_default,
|
|
3830
|
-
NewStatusListRenderer_default
|
|
3831
|
-
];
|
|
3832
|
-
var getButtonV2Renderers = () => [ButtonRendererV2];
|
|
3833
|
-
var getWiseRenderers = () => [
|
|
3834
|
-
AddressValidationButtonRenderer_default,
|
|
3835
|
-
AlertRenderer_default,
|
|
3836
|
-
CheckboxInputRenderer_default,
|
|
3837
|
-
BoxRenderer_default,
|
|
3838
|
-
ButtonRenderer,
|
|
3839
|
-
ColumnsRenderer_default,
|
|
3840
|
-
DateInputRenderer_default,
|
|
3841
|
-
DecisionRenderer_default,
|
|
3842
|
-
DividerRenderer_default,
|
|
3843
|
-
ExternalConfirmationRenderer_default,
|
|
3844
|
-
FormRenderer_default,
|
|
3845
|
-
FormSectionRenderer_default,
|
|
3846
|
-
HeadingRenderer_default,
|
|
3847
|
-
ImageRenderer_default,
|
|
3848
|
-
InstructionsRenderer_default,
|
|
3849
|
-
IntegerInputRenderer_default,
|
|
3850
|
-
LargeUploadRenderer,
|
|
3851
|
-
ListRenderer_default,
|
|
3852
|
-
LoadingIndicatorRenderer_default,
|
|
3853
|
-
MarkdownRenderer_default,
|
|
3854
|
-
ModalRenderer,
|
|
3855
|
-
ModalLayoutRenderer_default,
|
|
3856
|
-
MoneyInputRenderer,
|
|
3857
|
-
MultiSelectInputRenderer_default,
|
|
3858
|
-
MultiUploadInputRenderer_default,
|
|
3859
|
-
NumberInputRenderer_default,
|
|
3860
|
-
ParagraphRenderer_default,
|
|
3861
|
-
ProgressRenderer,
|
|
3862
|
-
RepeatableRenderer_default,
|
|
3863
|
-
ReviewRenderer_default,
|
|
3864
|
-
SearchRenderer_default,
|
|
3865
|
-
SelectInputRenderer_default,
|
|
3866
|
-
SectionRenderer_default,
|
|
3867
|
-
StatusListRenderer_default,
|
|
3868
|
-
TabsRenderer,
|
|
3869
|
-
TextInputRenderer_default,
|
|
3870
|
-
UploadInputRenderer,
|
|
3871
|
-
SplashStepRenderer,
|
|
3872
|
-
SplashCelebrationStepRenderer,
|
|
3873
|
-
StepRenderer
|
|
3874
|
-
];
|
|
3904
|
+
// src/index.ts
|
|
3905
|
+
var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
3875
3906
|
|
|
3876
3907
|
// src/dynamicFlow/renderers.ts
|
|
3877
|
-
var
|
|
3908
|
+
var Header11 = Header7;
|
|
3878
3909
|
var Media2 = Media;
|
|
3879
3910
|
var getMargin2 = getMargin;
|
|
3880
|
-
var getListItemRenderers2 = getListItemRenderers;
|
|
3881
|
-
var getButtonV2Renderers2 = getButtonV2Renderers;
|
|
3882
3911
|
|
|
3883
3912
|
// src/i18n/index.ts
|
|
3884
|
-
var
|
|
3913
|
+
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
3885
3914
|
|
|
3886
3915
|
// src/i18n/cs.json
|
|
3887
3916
|
var cs_default = {
|
|
@@ -4734,186 +4763,19 @@ var wiseTranslations = {
|
|
|
4734
4763
|
"zh-HK": zh_HK_default
|
|
4735
4764
|
};
|
|
4736
4765
|
var languages = Array.from(
|
|
4737
|
-
/* @__PURE__ */ new Set([...Object.keys(
|
|
4766
|
+
/* @__PURE__ */ new Set([...Object.keys(import_dynamic_flow_client2.translations), ...Object.keys(wiseTranslations)])
|
|
4738
4767
|
);
|
|
4739
4768
|
var translations = languages.reduce(
|
|
4740
|
-
(acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({},
|
|
4769
|
+
(acc, lang) => __spreadProps(__spreadValues({}, acc), { [lang]: __spreadValues(__spreadValues({}, import_dynamic_flow_client2.translations[lang]), wiseTranslations[lang]) }),
|
|
4741
4770
|
{}
|
|
4742
4771
|
);
|
|
4743
4772
|
var i18n_default = translations;
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
typeof process !== "undefined" ? "4.38.0" : "0.0.0"
|
|
4754
|
-
);
|
|
4755
|
-
|
|
4756
|
-
// src/dynamicFlow/telemetry/getLogEvent.ts
|
|
4757
|
-
var getLogEvent = (onLog) => (level, message, extra) => {
|
|
4758
|
-
const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
|
|
4759
|
-
dfWiseVersion: appVersion
|
|
4760
|
-
});
|
|
4761
|
-
if (level !== "info" && onLog) {
|
|
4762
|
-
if (onLog) {
|
|
4763
|
-
onLog(level, message, extraWithVersion);
|
|
4764
|
-
} else {
|
|
4765
|
-
logToRollbar(level, message, extraWithVersion);
|
|
4766
|
-
}
|
|
4767
|
-
}
|
|
4768
|
-
};
|
|
4769
|
-
var logToRollbar = (level, message, extra) => {
|
|
4770
|
-
try {
|
|
4771
|
-
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
4772
|
-
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
4773
|
-
} catch (error) {
|
|
4774
|
-
console.error("Failed to log to Rollbar", error);
|
|
4775
|
-
}
|
|
4776
|
-
};
|
|
4777
|
-
|
|
4778
|
-
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
4779
|
-
var import_components_theming2 = require("@wise/components-theming");
|
|
4780
|
-
var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
|
|
4781
|
-
onEvent == null ? void 0 : onEvent(name, properties);
|
|
4782
|
-
if (name.includes(ThemeRequiredEventName)) {
|
|
4783
|
-
const { theme } = properties != null ? properties : { theme: "personal" };
|
|
4784
|
-
if (theme && (0, import_components_theming2.isThemeModern)(theme)) {
|
|
4785
|
-
onThemeChange == null ? void 0 : onThemeChange(theme);
|
|
4786
|
-
}
|
|
4787
|
-
} else {
|
|
4788
|
-
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
4789
|
-
}
|
|
4790
|
-
};
|
|
4791
|
-
|
|
4792
|
-
// src/dynamicFlow/messages.ts
|
|
4793
|
-
var import_react_intl25 = require("react-intl");
|
|
4794
|
-
var messages_default = (0, import_react_intl25.defineMessages)({
|
|
4795
|
-
copied: {
|
|
4796
|
-
id: "df.wise.CopyFeedback.copy",
|
|
4797
|
-
defaultMessage: "Copied to clipboard",
|
|
4798
|
-
description: "Appears in a snackbar when the copy operation succeeds."
|
|
4799
|
-
},
|
|
4800
|
-
copyFailed: {
|
|
4801
|
-
id: "df.wise.CopyFeedback.copyFailed",
|
|
4802
|
-
defaultMessage: "Failed to copy to clipboard",
|
|
4803
|
-
description: "Appears in a snackbar when the copy operation fails."
|
|
4804
|
-
}
|
|
4805
|
-
});
|
|
4806
|
-
|
|
4807
|
-
// src/dynamicFlow/DynamicFlow.tsx
|
|
4808
|
-
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
4809
|
-
var wiseRenderers = getWiseRenderers();
|
|
4810
|
-
function DynamicFlowLegacy(props) {
|
|
4811
|
-
const { customFetch = globalThis.fetch } = props;
|
|
4812
|
-
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient: customFetch });
|
|
4813
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_dynamic_flow_client2.DynamicFlow, __spreadValues({}, coreProps));
|
|
4814
|
-
}
|
|
4815
|
-
function DynamicFlowRevamp(props) {
|
|
4816
|
-
const {
|
|
4817
|
-
className = "",
|
|
4818
|
-
customFetch = globalThis.fetch,
|
|
4819
|
-
renderers,
|
|
4820
|
-
onAnalytics,
|
|
4821
|
-
onEvent,
|
|
4822
|
-
onLog,
|
|
4823
|
-
onLink = openLinkInNewTab,
|
|
4824
|
-
onThemeChange
|
|
4825
|
-
} = props;
|
|
4826
|
-
const { formatMessage } = (0, import_react_intl26.useIntl)();
|
|
4827
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
4828
|
-
const httpClient = useWiseHttpClient(customFetch);
|
|
4829
|
-
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
4830
|
-
const logEvent = (0, import_react20.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
4831
|
-
const trackEvent = (0, import_react20.useMemo)(
|
|
4832
|
-
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4833
|
-
[onEvent, onAnalytics, onThemeChange]
|
|
4834
|
-
);
|
|
4835
|
-
const onCopy = (copiedContent) => {
|
|
4836
|
-
if (copiedContent) {
|
|
4837
|
-
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
4838
|
-
} else {
|
|
4839
|
-
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
4840
|
-
}
|
|
4841
|
-
};
|
|
4842
|
-
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
4843
|
-
httpClient,
|
|
4844
|
-
renderers: mergedRenderers,
|
|
4845
|
-
onEvent: trackEvent,
|
|
4846
|
-
onLog: logEvent,
|
|
4847
|
-
onLink,
|
|
4848
|
-
onCopy
|
|
4849
|
-
});
|
|
4850
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_dynamic_flow_client2.DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
|
|
4851
|
-
}
|
|
4852
|
-
var DynamicForm = (0, import_react20.forwardRef)(function DynamicForm2(props, ref) {
|
|
4853
|
-
const {
|
|
4854
|
-
className = "",
|
|
4855
|
-
customFetch = globalThis.fetch,
|
|
4856
|
-
renderers,
|
|
4857
|
-
onAnalytics,
|
|
4858
|
-
onEvent,
|
|
4859
|
-
onLog,
|
|
4860
|
-
onLink = openLinkInNewTab,
|
|
4861
|
-
onThemeChange
|
|
4862
|
-
} = props;
|
|
4863
|
-
const { formatMessage } = (0, import_react_intl26.useIntl)();
|
|
4864
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
4865
|
-
const httpClient = useWiseHttpClient(customFetch);
|
|
4866
|
-
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
4867
|
-
const logEvent = (0, import_react20.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
4868
|
-
const trackEvent = (0, import_react20.useMemo)(
|
|
4869
|
-
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4870
|
-
[onEvent, onAnalytics, onThemeChange]
|
|
4871
|
-
);
|
|
4872
|
-
const onCopy = (copiedContent) => {
|
|
4873
|
-
if (copiedContent) {
|
|
4874
|
-
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
4875
|
-
} else {
|
|
4876
|
-
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
4877
|
-
}
|
|
4878
|
-
};
|
|
4879
|
-
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
4880
|
-
httpClient,
|
|
4881
|
-
renderers: mergedRenderers,
|
|
4882
|
-
onEvent: trackEvent,
|
|
4883
|
-
onLog: logEvent,
|
|
4884
|
-
onLink,
|
|
4885
|
-
onCopy
|
|
4886
|
-
});
|
|
4887
|
-
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_dynamic_flow_client2.DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
|
|
4888
|
-
});
|
|
4889
|
-
var useWiseHttpClient = (httpClient) => {
|
|
4890
|
-
const { locale } = (0, import_react_intl26.useIntl)();
|
|
4891
|
-
return (0, import_react20.useCallback)(
|
|
4892
|
-
async (input, init = {}) => {
|
|
4893
|
-
const headers = new Headers(init.headers);
|
|
4894
|
-
headers.set("accept-language", locale);
|
|
4895
|
-
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
|
|
4896
|
-
if (timeZone) {
|
|
4897
|
-
headers.set("time-zone", timeZone);
|
|
4898
|
-
}
|
|
4899
|
-
const requestInit = __spreadProps(__spreadValues({}, init), { credentials: "include", headers });
|
|
4900
|
-
return httpClient(input, requestInit).catch(handleRejection);
|
|
4901
|
-
},
|
|
4902
|
-
[httpClient, locale]
|
|
4903
|
-
);
|
|
4904
|
-
};
|
|
4905
|
-
var handleRejection = (error) => {
|
|
4906
|
-
if (error instanceof Error && error.message === "SCA_MODAL_CLOSED") {
|
|
4907
|
-
return new Response(JSON.stringify({ validation: {} }), { status: 400 });
|
|
4908
|
-
}
|
|
4909
|
-
throw error;
|
|
4910
|
-
};
|
|
4911
|
-
var openLinkInNewTab = (url) => {
|
|
4912
|
-
var _a;
|
|
4913
|
-
try {
|
|
4914
|
-
const w = (_a = window == null ? void 0 : window.open) == null ? void 0 : _a.call(window, url, "_blank");
|
|
4915
|
-
return Boolean(w);
|
|
4916
|
-
} catch (e) {
|
|
4917
|
-
return false;
|
|
4918
|
-
}
|
|
4919
|
-
};
|
|
4773
|
+
/*! Bundled license information:
|
|
4774
|
+
|
|
4775
|
+
classnames/index.js:
|
|
4776
|
+
(*!
|
|
4777
|
+
Copyright (c) 2018 Jed Watson.
|
|
4778
|
+
Licensed under the MIT License (MIT), see
|
|
4779
|
+
http://jedwatson.github.io/classnames
|
|
4780
|
+
*)
|
|
4781
|
+
*/
|