@wise/dynamic-flow-client-internal 4.37.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 +1339 -1354
- package/build/main.mjs +1323 -1319
- 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 +8 -6
- 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");
|
|
@@ -362,7 +409,7 @@ var mapStatusToSentiment = (validation) => {
|
|
|
362
409
|
var FieldInput_default = FieldInput;
|
|
363
410
|
|
|
364
411
|
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
365
|
-
var
|
|
412
|
+
var import_components11 = require("@transferwise/components");
|
|
366
413
|
|
|
367
414
|
// ../renderers/src/utils/UrnFlag.tsx
|
|
368
415
|
var import_art = require("@wise/art");
|
|
@@ -651,15 +698,45 @@ 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
|
|
706
|
+
var import_components9 = require("@transferwise/components");
|
|
659
707
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
708
|
+
var getAdditionalText = (additionalText) => {
|
|
709
|
+
if (!additionalText) {
|
|
710
|
+
return void 0;
|
|
711
|
+
}
|
|
712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components9.ListItem.AdditionalInfo, { children: additionalText });
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
// ../renderers/src/utils/listItem/getSupportingValues.ts
|
|
716
|
+
var getSupportingValues = (supportingValues) => {
|
|
717
|
+
return __spreadValues(__spreadValues({}, (supportingValues == null ? void 0 : supportingValues.value) ? { valueTitle: supportingValues.value } : {}), (supportingValues == null ? void 0 : supportingValues.subvalue) ? { valueSubtitle: supportingValues.subvalue } : {});
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
// ../renderers/src/utils/listItem/getInlineAlert.tsx
|
|
721
|
+
var import_components10 = require("@transferwise/components");
|
|
722
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
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;
|
|
724
|
+
|
|
725
|
+
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
726
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
660
727
|
var CheckboxInputRenderer = {
|
|
661
728
|
canRenderType: "input-checkbox",
|
|
662
|
-
render: (props) =>
|
|
729
|
+
render: (props) => {
|
|
730
|
+
switch (props.control) {
|
|
731
|
+
case "switch-item":
|
|
732
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(SwitchItemComponent, __spreadValues({}, props));
|
|
733
|
+
case "checkbox-item":
|
|
734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckboxItemComponent, __spreadValues({}, props));
|
|
735
|
+
case "checkbox":
|
|
736
|
+
default:
|
|
737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckboxComponent, __spreadValues({}, props));
|
|
738
|
+
}
|
|
739
|
+
}
|
|
663
740
|
};
|
|
664
741
|
var CheckboxComponent = (props) => {
|
|
665
742
|
const _a = props, {
|
|
@@ -682,30 +759,74 @@ var CheckboxComponent = (props) => {
|
|
|
682
759
|
"value"
|
|
683
760
|
]);
|
|
684
761
|
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
685
|
-
return /* @__PURE__ */ (0,
|
|
762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components11.Checkbox, __spreadValues({ id }, checkboxProps)) });
|
|
686
763
|
};
|
|
687
|
-
var
|
|
688
|
-
const {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
764
|
+
var CheckboxItemComponent = (props) => {
|
|
765
|
+
const {
|
|
766
|
+
additionalText,
|
|
767
|
+
description,
|
|
768
|
+
disabled,
|
|
769
|
+
inlineAlert,
|
|
770
|
+
media,
|
|
771
|
+
supportingValues,
|
|
772
|
+
title,
|
|
773
|
+
validationState,
|
|
774
|
+
value,
|
|
775
|
+
onChange
|
|
776
|
+
} = props;
|
|
777
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
778
|
+
import_components11.ListItem,
|
|
779
|
+
__spreadValues({
|
|
692
780
|
title,
|
|
693
781
|
subtitle: description,
|
|
782
|
+
additionalInfo: getAdditionalText(additionalText),
|
|
694
783
|
media: getMedia(media, false),
|
|
695
784
|
disabled,
|
|
696
|
-
prompt: validationState
|
|
697
|
-
control: /* @__PURE__ */ (0,
|
|
698
|
-
}
|
|
785
|
+
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
786
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components11.ListItem.Checkbox, { checked: value, onChange: () => onChange(!value) })
|
|
787
|
+
}, getSupportingValues(supportingValues))
|
|
788
|
+
);
|
|
789
|
+
};
|
|
790
|
+
var SwitchItemComponent = (props) => {
|
|
791
|
+
const {
|
|
792
|
+
additionalText,
|
|
793
|
+
description,
|
|
794
|
+
disabled,
|
|
795
|
+
inlineAlert,
|
|
796
|
+
media,
|
|
797
|
+
supportingValues,
|
|
798
|
+
title,
|
|
799
|
+
validationState,
|
|
800
|
+
value,
|
|
801
|
+
onChange
|
|
802
|
+
} = props;
|
|
803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
804
|
+
import_components11.ListItem,
|
|
805
|
+
__spreadValues({
|
|
806
|
+
title,
|
|
807
|
+
subtitle: description,
|
|
808
|
+
additionalInfo: getAdditionalText(additionalText),
|
|
809
|
+
media: getMedia(media, false),
|
|
810
|
+
disabled,
|
|
811
|
+
prompt: getInlineAlertOrValidation(validationState, inlineAlert),
|
|
812
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components11.ListItem.Switch, { checked: value, onClick: () => onChange(!value) })
|
|
813
|
+
}, getSupportingValues(supportingValues))
|
|
699
814
|
);
|
|
700
815
|
};
|
|
816
|
+
var getInlineAlertOrValidation = (validationState, inlineAlert) => {
|
|
817
|
+
if (validationState && validationState.status === "invalid") {
|
|
818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components11.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
|
|
819
|
+
}
|
|
820
|
+
return getInlineAlert(inlineAlert);
|
|
821
|
+
};
|
|
701
822
|
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
702
823
|
|
|
703
824
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
704
|
-
var import_classnames2 = __toESM(
|
|
705
|
-
var
|
|
825
|
+
var import_classnames2 = __toESM(require_classnames());
|
|
826
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
706
827
|
var ColumnsRenderer = {
|
|
707
828
|
canRenderType: "columns",
|
|
708
|
-
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0,
|
|
829
|
+
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
709
830
|
"div",
|
|
710
831
|
{
|
|
711
832
|
className: (0, import_classnames2.default)("df-columns-renderer-container", getMargin(margin), {
|
|
@@ -713,8 +834,8 @@ var ColumnsRenderer = {
|
|
|
713
834
|
"df-columns-renderer-bias-end": bias === "end"
|
|
714
835
|
}),
|
|
715
836
|
children: [
|
|
716
|
-
/* @__PURE__ */ (0,
|
|
717
|
-
/* @__PURE__ */ (0,
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "df-columns-renderer-column", children: startChildren }),
|
|
838
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "df-columns-renderer-column", children: endChildren })
|
|
718
839
|
]
|
|
719
840
|
}
|
|
720
841
|
)
|
|
@@ -722,7 +843,7 @@ var ColumnsRenderer = {
|
|
|
722
843
|
var ColumnsRenderer_default = ColumnsRenderer;
|
|
723
844
|
|
|
724
845
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
725
|
-
var
|
|
846
|
+
var import_components12 = require("@transferwise/components");
|
|
726
847
|
|
|
727
848
|
// ../renderers/src/validators/type-validators.ts
|
|
728
849
|
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
@@ -749,7 +870,7 @@ var dateToDateString = (date) => {
|
|
|
749
870
|
};
|
|
750
871
|
|
|
751
872
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
752
|
-
var
|
|
873
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
753
874
|
function VariableDateInput({
|
|
754
875
|
control,
|
|
755
876
|
inputProps
|
|
@@ -765,8 +886,8 @@ function VariableDateInput({
|
|
|
765
886
|
onFocus
|
|
766
887
|
} = inputProps;
|
|
767
888
|
if (control === "date-lookup") {
|
|
768
|
-
return /* @__PURE__ */ (0,
|
|
769
|
-
|
|
889
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
890
|
+
import_components12.DateLookup,
|
|
770
891
|
{
|
|
771
892
|
value: dateStringToDateOrNull(inputProps.value),
|
|
772
893
|
min: dateStringToDateOrNull(minimumDate),
|
|
@@ -781,8 +902,8 @@ function VariableDateInput({
|
|
|
781
902
|
}
|
|
782
903
|
);
|
|
783
904
|
}
|
|
784
|
-
return /* @__PURE__ */ (0,
|
|
785
|
-
|
|
905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
906
|
+
import_components12.DateInput,
|
|
786
907
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
787
908
|
dayAutoComplete: getAutocompleteString(autoComplete, "day"),
|
|
788
909
|
yearAutoComplete: getAutocompleteString(autoComplete, "year")
|
|
@@ -798,7 +919,7 @@ var getAutocompleteString = (value, suffix) => {
|
|
|
798
919
|
var VariableDateInput_default = VariableDateInput;
|
|
799
920
|
|
|
800
921
|
// ../renderers/src/DateInputRenderer.tsx
|
|
801
|
-
var
|
|
922
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
802
923
|
var DateInputRenderer = {
|
|
803
924
|
canRenderType: "input-date",
|
|
804
925
|
render: (props) => {
|
|
@@ -823,7 +944,7 @@ var DateInputRenderer = {
|
|
|
823
944
|
]);
|
|
824
945
|
const value = initialValue != null ? initialValue : "";
|
|
825
946
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
826
|
-
return /* @__PURE__ */ (0,
|
|
947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
827
948
|
FieldInput_default,
|
|
828
949
|
{
|
|
829
950
|
id,
|
|
@@ -831,379 +952,166 @@ var DateInputRenderer = {
|
|
|
831
952
|
description,
|
|
832
953
|
validation: validationState,
|
|
833
954
|
help,
|
|
834
|
-
children: /* @__PURE__ */ (0,
|
|
955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(VariableDateInput_default, { control, inputProps })
|
|
835
956
|
}
|
|
836
957
|
);
|
|
837
958
|
}
|
|
838
959
|
};
|
|
839
960
|
var DateInputRenderer_default = DateInputRenderer;
|
|
840
961
|
|
|
841
|
-
// ../renderers/src/
|
|
962
|
+
// ../renderers/src/DividerRenderer.tsx
|
|
842
963
|
var import_components13 = require("@transferwise/components");
|
|
964
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
965
|
+
var mapControlToLevel = (control) => {
|
|
966
|
+
switch (control) {
|
|
967
|
+
case "section":
|
|
968
|
+
return "section";
|
|
969
|
+
case "content":
|
|
970
|
+
return "content";
|
|
971
|
+
default:
|
|
972
|
+
return "subsection";
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
var DividerRenderer = {
|
|
976
|
+
canRenderType: "divider",
|
|
977
|
+
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components13.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
978
|
+
};
|
|
979
|
+
var DividerRenderer_default = DividerRenderer;
|
|
843
980
|
|
|
844
|
-
// ../renderers/src/
|
|
845
|
-
var
|
|
846
|
-
var import_react3 = require("react");
|
|
847
|
-
var import_react_intl8 = require("react-intl");
|
|
981
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
982
|
+
var import_components14 = require("@transferwise/components");
|
|
848
983
|
|
|
849
|
-
// ../renderers/src/messages/
|
|
984
|
+
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
850
985
|
var import_react_intl5 = require("react-intl");
|
|
851
|
-
var
|
|
852
|
-
|
|
853
|
-
id: "df.wise.
|
|
854
|
-
defaultMessage: "
|
|
855
|
-
description: "
|
|
986
|
+
var external_confirmation_messages_default = (0, import_react_intl5.defineMessages)({
|
|
987
|
+
title: {
|
|
988
|
+
id: "df.wise.ExternalConfirmation.title",
|
|
989
|
+
defaultMessage: "Please confirm",
|
|
990
|
+
description: "Heading for the confirmation screen."
|
|
856
991
|
},
|
|
857
|
-
|
|
858
|
-
id: "df.wise.
|
|
859
|
-
defaultMessage: "
|
|
860
|
-
description: "
|
|
992
|
+
description: {
|
|
993
|
+
id: "df.wise.ExternalConfirmation.description",
|
|
994
|
+
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
995
|
+
description: "Description for the confirmation screen."
|
|
861
996
|
},
|
|
862
|
-
|
|
863
|
-
id: "df.wise.
|
|
864
|
-
defaultMessage: "
|
|
865
|
-
description: "
|
|
997
|
+
open: {
|
|
998
|
+
id: "df.wise.ExternalConfirmation.open",
|
|
999
|
+
defaultMessage: "Open in new tab",
|
|
1000
|
+
description: "Button text confirming opening a new browser tab."
|
|
1001
|
+
},
|
|
1002
|
+
cancel: {
|
|
1003
|
+
id: "df.wise.ExternalConfirmation.cancel",
|
|
1004
|
+
defaultMessage: "Cancel",
|
|
1005
|
+
description: "Button text rejecting opening a new browser tab."
|
|
866
1006
|
}
|
|
867
1007
|
});
|
|
868
1008
|
|
|
869
|
-
// ../renderers/src/
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
const aTitleUpper = a.title.toUpperCase();
|
|
894
|
-
const bTitleUpper = b.title.toUpperCase();
|
|
895
|
-
const aTitleStarts = aTitleUpper.startsWith(upperQuery);
|
|
896
|
-
const bTitleStarts = bTitleUpper.startsWith(upperQuery);
|
|
897
|
-
if (aTitleStarts && !bTitleStarts) {
|
|
898
|
-
return -1;
|
|
899
|
-
}
|
|
900
|
-
if (!aTitleStarts && bTitleStarts) {
|
|
901
|
-
return 1;
|
|
902
|
-
}
|
|
903
|
-
const aWordStarts = aTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
904
|
-
const bWordStarts = bTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
905
|
-
if (aWordStarts && !bWordStarts) {
|
|
906
|
-
return -1;
|
|
1009
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1010
|
+
var import_react_intl6 = require("react-intl");
|
|
1011
|
+
var import_react3 = require("react");
|
|
1012
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1013
|
+
var ExternalConfirmationRenderer = {
|
|
1014
|
+
canRenderType: "external-confirmation",
|
|
1015
|
+
render: ExternalConfirmationRendererComponent
|
|
1016
|
+
};
|
|
1017
|
+
function ExternalConfirmationRendererComponent({
|
|
1018
|
+
url,
|
|
1019
|
+
status,
|
|
1020
|
+
onSuccess,
|
|
1021
|
+
onFailure,
|
|
1022
|
+
onCancel
|
|
1023
|
+
}) {
|
|
1024
|
+
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
1025
|
+
(0, import_react3.useEffect)(() => {
|
|
1026
|
+
if (url) {
|
|
1027
|
+
const w = window.open(url, "_blank");
|
|
1028
|
+
if (w) {
|
|
1029
|
+
onSuccess();
|
|
1030
|
+
} else {
|
|
1031
|
+
onFailure();
|
|
1032
|
+
}
|
|
907
1033
|
}
|
|
908
|
-
|
|
909
|
-
|
|
1034
|
+
}, []);
|
|
1035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1036
|
+
import_components14.Modal,
|
|
1037
|
+
{
|
|
1038
|
+
open: status === "failure",
|
|
1039
|
+
title: formatMessage(external_confirmation_messages_default.title),
|
|
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,
|
|
1045
|
+
{
|
|
1046
|
+
v2: true,
|
|
1047
|
+
block: true,
|
|
1048
|
+
className: "m-b-2",
|
|
1049
|
+
priority: "primary",
|
|
1050
|
+
size: "md",
|
|
1051
|
+
onClick: () => {
|
|
1052
|
+
window.open(url);
|
|
1053
|
+
onCancel();
|
|
1054
|
+
},
|
|
1055
|
+
children: formatMessage(external_confirmation_messages_default.open)
|
|
1056
|
+
}
|
|
1057
|
+
),
|
|
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) })
|
|
1059
|
+
] }) })
|
|
1060
|
+
] }),
|
|
1061
|
+
onClose: onCancel
|
|
910
1062
|
}
|
|
911
|
-
|
|
912
|
-
});
|
|
1063
|
+
);
|
|
913
1064
|
}
|
|
914
|
-
|
|
1065
|
+
function getOrigin(url) {
|
|
1066
|
+
try {
|
|
1067
|
+
return new URL(url).origin;
|
|
1068
|
+
} catch (e) {
|
|
1069
|
+
return url;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
915
1073
|
|
|
916
|
-
// ../renderers/src/
|
|
917
|
-
var
|
|
918
|
-
var
|
|
1074
|
+
// ../renderers/src/FormRenderer.tsx
|
|
1075
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1076
|
+
var FormRenderer = {
|
|
1077
|
+
canRenderType: "form",
|
|
1078
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getMargin(margin), children })
|
|
1079
|
+
};
|
|
1080
|
+
var FormRenderer_default = FormRenderer;
|
|
919
1081
|
|
|
920
|
-
// ../renderers/src/
|
|
921
|
-
var import_react_intl6 = require("react-intl");
|
|
922
|
-
var group_messages_default = (0, import_react_intl6.defineMessages)({
|
|
923
|
-
all: {
|
|
924
|
-
id: "df.wise.group.all",
|
|
925
|
-
defaultMessage: "All",
|
|
926
|
-
description: "Label for the group of options that encompasses all options"
|
|
927
|
-
},
|
|
928
|
-
popular: {
|
|
929
|
-
id: "df.wise.group.popular",
|
|
930
|
-
defaultMessage: "Popular",
|
|
931
|
-
description: "Label for the group of options that are tagged as popular"
|
|
932
|
-
},
|
|
933
|
-
recent: {
|
|
934
|
-
id: "df.wise.group.recent",
|
|
935
|
-
defaultMessage: "Recent",
|
|
936
|
-
description: "Label for the group of options that are tagged as recent"
|
|
937
|
-
},
|
|
938
|
-
"currencies-with-account-details": {
|
|
939
|
-
id: "df.wise.group.currencies-with-account-details",
|
|
940
|
-
defaultMessage: "Currencies with account details",
|
|
941
|
-
description: "Label for the group of options that are tagged as currencies with account details"
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
|
|
945
|
-
// ../renderers/src/utils/grouping-utils.ts
|
|
946
|
-
var getGroupsFromTags = (knownTags, items) => {
|
|
947
|
-
return knownTags.map((tag) => {
|
|
948
|
-
return { tag, items: items.filter((item) => {
|
|
949
|
-
var _a;
|
|
950
|
-
return (_a = item.tags) == null ? void 0 : _a.includes(tag);
|
|
951
|
-
}) };
|
|
952
|
-
}).filter((group) => group.items.length > 0);
|
|
953
|
-
};
|
|
954
|
-
|
|
955
|
-
// ../renderers/src/DecisionRenderer/GroupedDecisionList.tsx
|
|
956
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
957
|
-
var groupingTags = Object.keys(group_messages_default).filter((key) => key !== "all");
|
|
958
|
-
var isGroupedDecision = (options) => {
|
|
959
|
-
return getGroupsFromTags(groupingTags, options).length > 0;
|
|
960
|
-
};
|
|
961
|
-
var GroupedDecisionList = (_a) => {
|
|
962
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
963
|
-
const { formatMessage } = (0, import_react_intl7.useIntl)();
|
|
964
|
-
const { options } = rest;
|
|
965
|
-
const itemsByTag = [...getGroupsFromTags(groupingTags, options), { tag: "all", items: options }];
|
|
966
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_jsx_runtime24.Fragment, { children: itemsByTag.map(({ tag, items }) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components11.Section, { children: [
|
|
967
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
968
|
-
import_components11.Header,
|
|
969
|
-
{
|
|
970
|
-
as: "h2",
|
|
971
|
-
title: tag in group_messages_default ? formatMessage(group_messages_default[tag]) : tag
|
|
972
|
-
}
|
|
973
|
-
),
|
|
974
|
-
renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: items }))
|
|
975
|
-
] }, tag)) });
|
|
976
|
-
};
|
|
977
|
-
|
|
978
|
-
// ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
|
|
979
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
980
|
-
var DecisionWrapper = (props) => {
|
|
981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
982
|
-
props.title && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components12.Header, { as: "h2", title: props.title }),
|
|
983
|
-
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
984
|
-
] });
|
|
985
|
-
};
|
|
986
|
-
var UnfilteredDecisionList = (_a) => {
|
|
987
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
988
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GroupedDecisionList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList3 })) : renderDecisionList3(rest);
|
|
989
|
-
};
|
|
990
|
-
var FilteredDecisionList = (props) => {
|
|
991
|
-
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
992
|
-
const [query, setQuery] = (0, import_react3.useState)("");
|
|
993
|
-
const { control, options, renderDecisionList: renderDecisionList3 } = props;
|
|
994
|
-
const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
|
|
995
|
-
const isGrouped = isGroupedDecision(options);
|
|
996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
997
|
-
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
998
|
-
import_components12.SearchInput,
|
|
999
|
-
{
|
|
1000
|
-
placeholder: formatMessage(filter_messages_default.placeholder),
|
|
1001
|
-
value: query,
|
|
1002
|
-
className: "m-b-2",
|
|
1003
|
-
onChange: (e) => {
|
|
1004
|
-
var _a;
|
|
1005
|
-
return setQuery((_a = e.target.value) != null ? _a : "");
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
),
|
|
1009
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(GroupedDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
1010
|
-
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components12.Header, { as: "h2", title: formatMessage(filter_messages_default.results), className: "m-t-4" }),
|
|
1011
|
-
filteredOptions.length > 0 ? renderDecisionList3({
|
|
1012
|
-
control,
|
|
1013
|
-
className: query.length === 0 ? "m-t-3" : "",
|
|
1014
|
-
options: filteredOptions
|
|
1015
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { children: formatMessage(filter_messages_default.noResults) })
|
|
1016
|
-
] })
|
|
1017
|
-
] });
|
|
1018
|
-
};
|
|
1019
|
-
|
|
1020
|
-
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
1021
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1022
|
-
var DecisionRenderer = {
|
|
1023
|
-
canRenderType: "decision",
|
|
1024
|
-
render: (props) => {
|
|
1025
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }));
|
|
1026
|
-
}
|
|
1027
|
-
};
|
|
1028
|
-
var renderDecisionList = ({ options, className, control }) => {
|
|
1029
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components13.NavigationOptionsList, { children: options.map((option) => {
|
|
1030
|
-
const { description, disabled, media, title: itemTitle, tag, onClick } = option;
|
|
1031
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1032
|
-
import_components13.NavigationOption,
|
|
1033
|
-
{
|
|
1034
|
-
title: itemTitle,
|
|
1035
|
-
content: description,
|
|
1036
|
-
disabled,
|
|
1037
|
-
media: media ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1038
|
-
OptionMedia,
|
|
1039
|
-
{
|
|
1040
|
-
media,
|
|
1041
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1042
|
-
}
|
|
1043
|
-
) : null,
|
|
1044
|
-
showMediaCircle: false,
|
|
1045
|
-
showMediaAtAllSizes: true,
|
|
1046
|
-
onClick
|
|
1047
|
-
},
|
|
1048
|
-
JSON.stringify(option)
|
|
1049
|
-
);
|
|
1050
|
-
}) }) });
|
|
1051
|
-
};
|
|
1052
|
-
var DecisionRenderer_default = DecisionRenderer;
|
|
1053
|
-
|
|
1054
|
-
// ../renderers/src/DividerRenderer.tsx
|
|
1055
|
-
var import_components14 = require("@transferwise/components");
|
|
1056
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1057
|
-
var mapControlToLevel = (control) => {
|
|
1058
|
-
switch (control) {
|
|
1059
|
-
case "section":
|
|
1060
|
-
return "section";
|
|
1061
|
-
case "content":
|
|
1062
|
-
return "content";
|
|
1063
|
-
default:
|
|
1064
|
-
return "subsection";
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
var DividerRenderer = {
|
|
1068
|
-
canRenderType: "divider",
|
|
1069
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_components14.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
1070
|
-
};
|
|
1071
|
-
var DividerRenderer_default = DividerRenderer;
|
|
1072
|
-
|
|
1073
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1082
|
+
// ../renderers/src/FormSectionRenderer.tsx
|
|
1074
1083
|
var import_components15 = require("@transferwise/components");
|
|
1075
|
-
|
|
1076
|
-
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1077
|
-
var import_react_intl9 = require("react-intl");
|
|
1078
|
-
var external_confirmation_messages_default = (0, import_react_intl9.defineMessages)({
|
|
1079
|
-
title: {
|
|
1080
|
-
id: "df.wise.ExternalConfirmation.title",
|
|
1081
|
-
defaultMessage: "Please confirm",
|
|
1082
|
-
description: "Heading for the confirmation screen."
|
|
1083
|
-
},
|
|
1084
|
-
description: {
|
|
1085
|
-
id: "df.wise.ExternalConfirmation.description",
|
|
1086
|
-
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
1087
|
-
description: "Description for the confirmation screen."
|
|
1088
|
-
},
|
|
1089
|
-
open: {
|
|
1090
|
-
id: "df.wise.ExternalConfirmation.open",
|
|
1091
|
-
defaultMessage: "Open in new tab",
|
|
1092
|
-
description: "Button text confirming opening a new browser tab."
|
|
1093
|
-
},
|
|
1094
|
-
cancel: {
|
|
1095
|
-
id: "df.wise.ExternalConfirmation.cancel",
|
|
1096
|
-
defaultMessage: "Cancel",
|
|
1097
|
-
description: "Button text rejecting opening a new browser tab."
|
|
1098
|
-
}
|
|
1099
|
-
});
|
|
1100
|
-
|
|
1101
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1102
|
-
var import_react_intl10 = require("react-intl");
|
|
1103
|
-
var import_react4 = require("react");
|
|
1104
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1105
|
-
var ExternalConfirmationRenderer = {
|
|
1106
|
-
canRenderType: "external-confirmation",
|
|
1107
|
-
render: ExternalConfirmationRendererComponent
|
|
1108
|
-
};
|
|
1109
|
-
function ExternalConfirmationRendererComponent({
|
|
1110
|
-
url,
|
|
1111
|
-
status,
|
|
1112
|
-
onSuccess,
|
|
1113
|
-
onFailure,
|
|
1114
|
-
onCancel
|
|
1115
|
-
}) {
|
|
1116
|
-
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
1117
|
-
(0, import_react4.useEffect)(() => {
|
|
1118
|
-
if (url) {
|
|
1119
|
-
const w = window.open(url, "_blank");
|
|
1120
|
-
if (w) {
|
|
1121
|
-
onSuccess();
|
|
1122
|
-
} else {
|
|
1123
|
-
onFailure();
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
}, []);
|
|
1127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1128
|
-
import_components15.Modal,
|
|
1129
|
-
{
|
|
1130
|
-
open: status === "failure",
|
|
1131
|
-
title: formatMessage(external_confirmation_messages_default.title),
|
|
1132
|
-
body: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1133
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components15.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
1134
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
1135
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
1136
|
-
import_components15.Button,
|
|
1137
|
-
{
|
|
1138
|
-
v2: true,
|
|
1139
|
-
block: true,
|
|
1140
|
-
className: "m-b-2",
|
|
1141
|
-
priority: "primary",
|
|
1142
|
-
size: "md",
|
|
1143
|
-
onClick: () => {
|
|
1144
|
-
window.open(url);
|
|
1145
|
-
onCancel();
|
|
1146
|
-
},
|
|
1147
|
-
children: formatMessage(external_confirmation_messages_default.open)
|
|
1148
|
-
}
|
|
1149
|
-
),
|
|
1150
|
-
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components15.Button, { v2: true, block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
1151
|
-
] }) })
|
|
1152
|
-
] }),
|
|
1153
|
-
onClose: onCancel
|
|
1154
|
-
}
|
|
1155
|
-
);
|
|
1156
|
-
}
|
|
1157
|
-
function getOrigin(url) {
|
|
1158
|
-
try {
|
|
1159
|
-
return new URL(url).origin;
|
|
1160
|
-
} catch (e) {
|
|
1161
|
-
return url;
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1165
|
-
|
|
1166
|
-
// ../renderers/src/FormRenderer.tsx
|
|
1167
1084
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1168
|
-
var FormRenderer = {
|
|
1169
|
-
canRenderType: "form",
|
|
1170
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: getMargin(margin), children })
|
|
1171
|
-
};
|
|
1172
|
-
var FormRenderer_default = FormRenderer;
|
|
1173
|
-
|
|
1174
|
-
// ../renderers/src/FormSectionRenderer.tsx
|
|
1175
|
-
var import_components16 = require("@transferwise/components");
|
|
1176
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1177
1085
|
var FormSectionRenderer = {
|
|
1178
1086
|
canRenderType: "form-section",
|
|
1179
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0,
|
|
1180
|
-
title && /* @__PURE__ */ (0,
|
|
1181
|
-
|
|
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,
|
|
1182
1090
|
{
|
|
1183
1091
|
as: "h2",
|
|
1184
1092
|
title
|
|
1185
1093
|
}
|
|
1186
1094
|
),
|
|
1187
|
-
description && /* @__PURE__ */ (0,
|
|
1095
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: description }),
|
|
1188
1096
|
children
|
|
1189
1097
|
] })
|
|
1190
1098
|
};
|
|
1191
1099
|
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1192
1100
|
|
|
1193
1101
|
// ../renderers/src/HeadingRenderer.tsx
|
|
1194
|
-
var
|
|
1195
|
-
var
|
|
1102
|
+
var import_components16 = require("@transferwise/components");
|
|
1103
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1196
1104
|
var HeadingRenderer = {
|
|
1197
1105
|
canRenderType: "heading",
|
|
1198
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1106
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading, __spreadValues({}, props))
|
|
1199
1107
|
};
|
|
1200
1108
|
function Heading(props) {
|
|
1201
1109
|
const { text, size, align, margin, control } = props;
|
|
1202
1110
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1203
|
-
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 });
|
|
1204
1112
|
}
|
|
1205
1113
|
function DisplayHeading({ size, text, className }) {
|
|
1206
|
-
return /* @__PURE__ */ (0,
|
|
1114
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.Display, { type: getDisplayType(size), className, children: text });
|
|
1207
1115
|
}
|
|
1208
1116
|
var getDisplayType = (size) => {
|
|
1209
1117
|
switch (size) {
|
|
@@ -1219,7 +1127,7 @@ var getDisplayType = (size) => {
|
|
|
1219
1127
|
}
|
|
1220
1128
|
};
|
|
1221
1129
|
function StandardHeading({ size, text, className }) {
|
|
1222
|
-
return /* @__PURE__ */ (0,
|
|
1130
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1223
1131
|
}
|
|
1224
1132
|
var getTitleTypeBySize = (size) => {
|
|
1225
1133
|
var _a;
|
|
@@ -1235,8 +1143,8 @@ var getTitleTypeBySize = (size) => {
|
|
|
1235
1143
|
var HeadingRenderer_default = HeadingRenderer;
|
|
1236
1144
|
|
|
1237
1145
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1238
|
-
var
|
|
1239
|
-
var
|
|
1146
|
+
var import_components17 = require("@transferwise/components");
|
|
1147
|
+
var import_react4 = require("react");
|
|
1240
1148
|
|
|
1241
1149
|
// ../renderers/src/utils/api-utils.ts
|
|
1242
1150
|
function isRelativePath(url = "") {
|
|
@@ -1246,7 +1154,7 @@ function isRelativePath(url = "") {
|
|
|
1246
1154
|
}
|
|
1247
1155
|
|
|
1248
1156
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1249
|
-
var
|
|
1157
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1250
1158
|
function UrlImage({
|
|
1251
1159
|
accessibilityDescription,
|
|
1252
1160
|
align,
|
|
@@ -1255,14 +1163,14 @@ function UrlImage({
|
|
|
1255
1163
|
uri,
|
|
1256
1164
|
httpClient
|
|
1257
1165
|
}) {
|
|
1258
|
-
const [imageSource, setImageSource] = (0,
|
|
1259
|
-
(0,
|
|
1166
|
+
const [imageSource, setImageSource] = (0, import_react4.useState)("");
|
|
1167
|
+
(0, import_react4.useEffect)(() => {
|
|
1260
1168
|
if (!uri.startsWith("urn:")) {
|
|
1261
1169
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1262
1170
|
}
|
|
1263
1171
|
}, [uri, httpClient]);
|
|
1264
|
-
return /* @__PURE__ */ (0,
|
|
1265
|
-
|
|
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,
|
|
1266
1174
|
{
|
|
1267
1175
|
className: `img-responsive ${getMargin(margin)}`,
|
|
1268
1176
|
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
@@ -1305,7 +1213,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1305
1213
|
};
|
|
1306
1214
|
|
|
1307
1215
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1308
|
-
var
|
|
1216
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1309
1217
|
var maxFlagSize = 600;
|
|
1310
1218
|
function UrnFlagImage({
|
|
1311
1219
|
accessibilityDescription,
|
|
@@ -1314,12 +1222,12 @@ function UrnFlagImage({
|
|
|
1314
1222
|
size,
|
|
1315
1223
|
uri
|
|
1316
1224
|
}) {
|
|
1317
|
-
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 }) });
|
|
1318
1226
|
}
|
|
1319
1227
|
|
|
1320
1228
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1321
1229
|
var import_art4 = require("@wise/art");
|
|
1322
|
-
var
|
|
1230
|
+
var import_react6 = require("react");
|
|
1323
1231
|
|
|
1324
1232
|
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1325
1233
|
var isAnimated = (uri) => {
|
|
@@ -1329,9 +1237,9 @@ var isAnimated = (uri) => {
|
|
|
1329
1237
|
|
|
1330
1238
|
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1331
1239
|
var import_art3 = require("@wise/art");
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
1334
|
-
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 {
|
|
1335
1243
|
constructor(props) {
|
|
1336
1244
|
super(props);
|
|
1337
1245
|
this.state = { hasError: false };
|
|
@@ -1354,12 +1262,12 @@ var SafeIllustration3D = ({
|
|
|
1354
1262
|
size,
|
|
1355
1263
|
onError
|
|
1356
1264
|
}) => {
|
|
1357
|
-
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 }) });
|
|
1358
1266
|
};
|
|
1359
1267
|
var SafeIllustration3D_default = SafeIllustration3D;
|
|
1360
1268
|
|
|
1361
1269
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1362
|
-
var
|
|
1270
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1363
1271
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1364
1272
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1365
1273
|
function UrnIllustration({
|
|
@@ -1369,12 +1277,12 @@ function UrnIllustration({
|
|
|
1369
1277
|
size,
|
|
1370
1278
|
uri
|
|
1371
1279
|
}) {
|
|
1372
|
-
const [has3DFailed, setHas3DFailed] = (0,
|
|
1280
|
+
const [has3DFailed, setHas3DFailed] = (0, import_react6.useState)(false);
|
|
1373
1281
|
const illustrationSize = getIllustrationSize(size);
|
|
1374
1282
|
const illustrationName = getIllustrationName(uri);
|
|
1375
1283
|
const illustration3DName = getIllustration3DName(uri);
|
|
1376
1284
|
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
1377
|
-
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)(
|
|
1378
1286
|
SafeIllustration3D_default,
|
|
1379
1287
|
{
|
|
1380
1288
|
name: illustration3DName,
|
|
@@ -1383,7 +1291,7 @@ function UrnIllustration({
|
|
|
1383
1291
|
}
|
|
1384
1292
|
) });
|
|
1385
1293
|
}
|
|
1386
|
-
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)(
|
|
1387
1295
|
import_art4.Illustration,
|
|
1388
1296
|
{
|
|
1389
1297
|
className: "df-illustration",
|
|
@@ -1403,32 +1311,32 @@ var getIllustration3DName = (uri) => {
|
|
|
1403
1311
|
};
|
|
1404
1312
|
|
|
1405
1313
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1406
|
-
var
|
|
1314
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1407
1315
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1408
1316
|
function UrnImage(props) {
|
|
1409
1317
|
const { uri } = props;
|
|
1410
1318
|
if (isUrnIllustration(uri)) {
|
|
1411
|
-
return /* @__PURE__ */ (0,
|
|
1319
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1412
1320
|
}
|
|
1413
1321
|
if (isUrnFlag(uri)) {
|
|
1414
|
-
return /* @__PURE__ */ (0,
|
|
1322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1415
1323
|
}
|
|
1416
1324
|
return null;
|
|
1417
1325
|
}
|
|
1418
1326
|
|
|
1419
1327
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1420
|
-
var
|
|
1328
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1421
1329
|
var ImageRenderer = {
|
|
1422
1330
|
canRenderType: "image",
|
|
1423
|
-
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))
|
|
1424
1332
|
};
|
|
1425
1333
|
|
|
1426
1334
|
// ../renderers/src/ImageRenderer/index.tsx
|
|
1427
1335
|
var ImageRenderer_default = ImageRenderer;
|
|
1428
1336
|
|
|
1429
1337
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1430
|
-
var
|
|
1431
|
-
var
|
|
1338
|
+
var import_components18 = require("@transferwise/components");
|
|
1339
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1432
1340
|
var doContext = ["positive", "neutral"];
|
|
1433
1341
|
var dontContext = ["warning", "negative"];
|
|
1434
1342
|
var InstructionsRenderer = {
|
|
@@ -1436,16 +1344,16 @@ var InstructionsRenderer = {
|
|
|
1436
1344
|
render: ({ items, margin, title }) => {
|
|
1437
1345
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1438
1346
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1439
|
-
return /* @__PURE__ */ (0,
|
|
1440
|
-
title ? /* @__PURE__ */ (0,
|
|
1441
|
-
/* @__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 })
|
|
1442
1350
|
] });
|
|
1443
1351
|
}
|
|
1444
1352
|
};
|
|
1445
1353
|
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1446
1354
|
|
|
1447
1355
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1448
|
-
var
|
|
1356
|
+
var import_components19 = require("@transferwise/components");
|
|
1449
1357
|
|
|
1450
1358
|
// ../renderers/src/utils/input-utils.ts
|
|
1451
1359
|
var onWheel = (event) => {
|
|
@@ -1470,7 +1378,7 @@ function pick(obj, ...keys) {
|
|
|
1470
1378
|
}
|
|
1471
1379
|
|
|
1472
1380
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1473
|
-
var
|
|
1381
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1474
1382
|
var IntegerInputRenderer = {
|
|
1475
1383
|
canRenderType: "input-integer",
|
|
1476
1384
|
render: (props) => {
|
|
@@ -1485,7 +1393,7 @@ var IntegerInputRenderer = {
|
|
|
1485
1393
|
"maximum",
|
|
1486
1394
|
"minimum"
|
|
1487
1395
|
);
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1396
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1489
1397
|
FieldInput_default,
|
|
1490
1398
|
{
|
|
1491
1399
|
id,
|
|
@@ -1493,8 +1401,8 @@ var IntegerInputRenderer = {
|
|
|
1493
1401
|
description,
|
|
1494
1402
|
validation: validationState,
|
|
1495
1403
|
help,
|
|
1496
|
-
children: /* @__PURE__ */ (0,
|
|
1497
|
-
|
|
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,
|
|
1498
1406
|
__spreadValues({
|
|
1499
1407
|
id,
|
|
1500
1408
|
name: id,
|
|
@@ -1515,101 +1423,29 @@ var IntegerInputRenderer = {
|
|
|
1515
1423
|
};
|
|
1516
1424
|
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
1517
1425
|
|
|
1518
|
-
// ../renderers/src/
|
|
1426
|
+
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1427
|
+
var import_components20 = require("@transferwise/components");
|
|
1428
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1429
|
+
var LoadingIndicatorRenderer = {
|
|
1430
|
+
canRenderType: "loading-indicator",
|
|
1431
|
+
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1432
|
+
import_components20.Loader,
|
|
1433
|
+
{
|
|
1434
|
+
size,
|
|
1435
|
+
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
1436
|
+
"data-testid": "loading-indicator"
|
|
1437
|
+
}
|
|
1438
|
+
)
|
|
1439
|
+
};
|
|
1440
|
+
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1441
|
+
|
|
1442
|
+
// ../renderers/src/MarkdownRenderer.tsx
|
|
1519
1443
|
var import_components21 = require("@transferwise/components");
|
|
1520
|
-
var import_classnames3 = __toESM(require("classnames"));
|
|
1521
1444
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1522
|
-
var ListRenderer = {
|
|
1523
|
-
canRenderType: "list",
|
|
1524
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: getMargin(margin), children: [
|
|
1525
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components21.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
1526
|
-
items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
1527
|
-
] })
|
|
1528
|
-
};
|
|
1529
|
-
var DesignSystemListItem = ({
|
|
1530
|
-
title,
|
|
1531
|
-
description,
|
|
1532
|
-
supportingValues,
|
|
1533
|
-
icon,
|
|
1534
|
-
image,
|
|
1535
|
-
media,
|
|
1536
|
-
control,
|
|
1537
|
-
tag
|
|
1538
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1539
|
-
"label",
|
|
1540
|
-
{
|
|
1541
|
-
className: (0, import_classnames3.default)("np-option p-a-2", {
|
|
1542
|
-
"np-option__sm-media": true,
|
|
1543
|
-
"np-option__container-aligned": true
|
|
1544
|
-
}),
|
|
1545
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "media", children: [
|
|
1546
|
-
icon || image || media ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "media-left", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1547
|
-
ListItemMedia,
|
|
1548
|
-
{
|
|
1549
|
-
icon,
|
|
1550
|
-
media,
|
|
1551
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1552
|
-
}
|
|
1553
|
-
) }) : null,
|
|
1554
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "media-body", children: [
|
|
1555
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1556
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
1557
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
1558
|
-
] }),
|
|
1559
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1560
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components21.Body, { className: "d-block np-option__body", children: description }),
|
|
1561
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components21.Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
1562
|
-
] })
|
|
1563
|
-
] })
|
|
1564
|
-
] })
|
|
1565
|
-
},
|
|
1566
|
-
title
|
|
1567
|
-
);
|
|
1568
|
-
var ListItemMedia = ({
|
|
1569
|
-
icon,
|
|
1570
|
-
media,
|
|
1571
|
-
preferAvatar
|
|
1572
|
-
}) => {
|
|
1573
|
-
if (icon) {
|
|
1574
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1575
|
-
}
|
|
1576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1577
|
-
};
|
|
1578
|
-
var getListAction = (callToAction) => {
|
|
1579
|
-
if (callToAction) {
|
|
1580
|
-
return __spreadValues({
|
|
1581
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
1582
|
-
text: callToAction.title,
|
|
1583
|
-
onClick: callToAction.onClick
|
|
1584
|
-
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
1585
|
-
}
|
|
1586
|
-
return void 0;
|
|
1587
|
-
};
|
|
1588
|
-
var ListRenderer_default = ListRenderer;
|
|
1589
|
-
|
|
1590
|
-
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1591
|
-
var import_components22 = require("@transferwise/components");
|
|
1592
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1593
|
-
var LoadingIndicatorRenderer = {
|
|
1594
|
-
canRenderType: "loading-indicator",
|
|
1595
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
1596
|
-
import_components22.Loader,
|
|
1597
|
-
{
|
|
1598
|
-
size,
|
|
1599
|
-
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
1600
|
-
"data-testid": "loading-indicator"
|
|
1601
|
-
}
|
|
1602
|
-
)
|
|
1603
|
-
};
|
|
1604
|
-
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1605
|
-
|
|
1606
|
-
// ../renderers/src/MarkdownRenderer.tsx
|
|
1607
|
-
var import_components23 = require("@transferwise/components");
|
|
1608
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1609
1445
|
var MarkdownRenderer = {
|
|
1610
1446
|
canRenderType: "markdown",
|
|
1611
|
-
render: ({ content, align, margin, size }) => /* @__PURE__ */ (0,
|
|
1612
|
-
|
|
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,
|
|
1613
1449
|
{
|
|
1614
1450
|
className: ["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large",
|
|
1615
1451
|
config: { link: { target: "_blank" } },
|
|
@@ -1620,21 +1456,21 @@ var MarkdownRenderer = {
|
|
|
1620
1456
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
1621
1457
|
|
|
1622
1458
|
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
1623
|
-
var
|
|
1624
|
-
var
|
|
1625
|
-
var
|
|
1459
|
+
var import_components22 = require("@transferwise/components");
|
|
1460
|
+
var import_react7 = require("react");
|
|
1461
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1626
1462
|
var ModalLayoutRenderer = {
|
|
1627
1463
|
canRenderType: "modal-layout",
|
|
1628
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1464
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DFModal, __spreadValues({}, props))
|
|
1629
1465
|
};
|
|
1630
1466
|
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
1631
1467
|
function DFModal({ content, margin, trigger }) {
|
|
1632
|
-
const [visible, setVisible] = (0,
|
|
1468
|
+
const [visible, setVisible] = (0, import_react7.useState)(false);
|
|
1633
1469
|
const { children, title } = content;
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1636
|
-
/* @__PURE__ */ (0,
|
|
1637
|
-
|
|
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,
|
|
1638
1474
|
{
|
|
1639
1475
|
scroll: "content",
|
|
1640
1476
|
open: visible,
|
|
@@ -1648,21 +1484,60 @@ function DFModal({ content, margin, trigger }) {
|
|
|
1648
1484
|
}
|
|
1649
1485
|
|
|
1650
1486
|
// ../renderers/src/ModalRenderer.tsx
|
|
1651
|
-
var
|
|
1652
|
-
var
|
|
1487
|
+
var import_components23 = require("@transferwise/components");
|
|
1488
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1653
1489
|
var ModalRenderer = {
|
|
1654
1490
|
canRenderType: "modal",
|
|
1655
1491
|
render: ({ title, children, open, onClose }) => {
|
|
1656
|
-
return /* @__PURE__ */ (0,
|
|
1492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components23.Modal, { open, title, body: children, onClose });
|
|
1657
1493
|
}
|
|
1658
1494
|
};
|
|
1659
1495
|
|
|
1660
1496
|
// ../renderers/src/MoneyInputRenderer.tsx
|
|
1661
|
-
var
|
|
1662
|
-
var
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
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");
|
|
1666
1541
|
var MoneyInputRenderer = {
|
|
1667
1542
|
canRenderType: "money-input",
|
|
1668
1543
|
render: MoneyInputRendererComponent
|
|
@@ -1682,13 +1557,13 @@ function MoneyInputRendererComponent(props) {
|
|
|
1682
1557
|
onAmountChange,
|
|
1683
1558
|
onCurrencyChange
|
|
1684
1559
|
} = props;
|
|
1685
|
-
(0,
|
|
1560
|
+
(0, import_react8.useEffect)(() => {
|
|
1686
1561
|
if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
|
|
1687
1562
|
onCurrencyChange(0);
|
|
1688
1563
|
}
|
|
1689
1564
|
}, [selectedCurrencyIndex, onCurrencyChange, currencies.length]);
|
|
1690
|
-
const { formatMessage } = (0,
|
|
1691
|
-
return /* @__PURE__ */ (0,
|
|
1565
|
+
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
1566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1692
1567
|
FieldInput_default,
|
|
1693
1568
|
{
|
|
1694
1569
|
id: uid,
|
|
@@ -1696,8 +1571,8 @@ function MoneyInputRendererComponent(props) {
|
|
|
1696
1571
|
description,
|
|
1697
1572
|
validation: validationState,
|
|
1698
1573
|
help,
|
|
1699
|
-
children: /* @__PURE__ */ (0,
|
|
1700
|
-
|
|
1574
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
1575
|
+
import_components24.MoneyInput,
|
|
1701
1576
|
{
|
|
1702
1577
|
amount: parseFloatOrNull(amountValue),
|
|
1703
1578
|
searchPlaceholder: "",
|
|
@@ -1725,7 +1600,7 @@ var parseFloatOrNull = (value) => {
|
|
|
1725
1600
|
return Number.isNaN(parsed) ? null : parsed;
|
|
1726
1601
|
};
|
|
1727
1602
|
var mapCurrencies = (options, formatMessage) => {
|
|
1728
|
-
const groupsFromTags = getGroupsFromTags(
|
|
1603
|
+
const groupsFromTags = getGroupsFromTags(groupingTags, options);
|
|
1729
1604
|
if (groupsFromTags.length > 0) {
|
|
1730
1605
|
return [...groupsFromTags, { tag: "all", items: options }].flatMap(({ tag, items }) => {
|
|
1731
1606
|
return [
|
|
@@ -1758,13 +1633,13 @@ function assertCurrencyCodeIsString(currencyCode) {
|
|
|
1758
1633
|
}
|
|
1759
1634
|
|
|
1760
1635
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1761
|
-
var
|
|
1762
|
-
var
|
|
1763
|
-
var
|
|
1636
|
+
var import_components25 = require("@transferwise/components");
|
|
1637
|
+
var import_react9 = require("react");
|
|
1638
|
+
var import_react_intl10 = require("react-intl");
|
|
1764
1639
|
|
|
1765
1640
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
1766
|
-
var
|
|
1767
|
-
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)({
|
|
1768
1643
|
summary: {
|
|
1769
1644
|
id: "df.wise.MultiSelect.summary",
|
|
1770
1645
|
defaultMessage: "{first} and {count} more",
|
|
@@ -1773,14 +1648,14 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
|
|
|
1773
1648
|
});
|
|
1774
1649
|
|
|
1775
1650
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1776
|
-
var
|
|
1651
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1777
1652
|
var MultiSelectInputRenderer = {
|
|
1778
1653
|
canRenderType: "input-multi-select",
|
|
1779
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1654
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
1780
1655
|
};
|
|
1781
1656
|
function MultiSelectInputRendererComponent(props) {
|
|
1782
|
-
const { formatMessage } = (0,
|
|
1783
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
1657
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
1658
|
+
const [stagedIndices, setStagedIndices] = (0, import_react9.useState)();
|
|
1784
1659
|
const {
|
|
1785
1660
|
id,
|
|
1786
1661
|
autoComplete,
|
|
@@ -1818,12 +1693,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1818
1693
|
const contentProps = {
|
|
1819
1694
|
title: option.title,
|
|
1820
1695
|
description: option.description,
|
|
1821
|
-
icon: /* @__PURE__ */ (0,
|
|
1696
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
1822
1697
|
};
|
|
1823
|
-
return /* @__PURE__ */ (0,
|
|
1698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components25.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
1824
1699
|
};
|
|
1825
1700
|
const extraProps = { autoComplete };
|
|
1826
|
-
return /* @__PURE__ */ (0,
|
|
1701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1827
1702
|
FieldInput_default,
|
|
1828
1703
|
{
|
|
1829
1704
|
id,
|
|
@@ -1831,8 +1706,8 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1831
1706
|
help,
|
|
1832
1707
|
description,
|
|
1833
1708
|
validation: validationState,
|
|
1834
|
-
children: /* @__PURE__ */ (0,
|
|
1835
|
-
|
|
1709
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1710
|
+
import_components25.SelectInput,
|
|
1836
1711
|
__spreadValues({
|
|
1837
1712
|
id,
|
|
1838
1713
|
items: options.map((option, index) => {
|
|
@@ -1871,12 +1746,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1871
1746
|
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
1872
1747
|
|
|
1873
1748
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1874
|
-
var
|
|
1749
|
+
var import_components27 = require("@transferwise/components");
|
|
1875
1750
|
|
|
1876
1751
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
1877
|
-
var
|
|
1878
|
-
var
|
|
1879
|
-
var
|
|
1752
|
+
var import_components26 = require("@transferwise/components");
|
|
1753
|
+
var import_classnames3 = __toESM(require_classnames());
|
|
1754
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1880
1755
|
function UploadFieldInput({
|
|
1881
1756
|
id,
|
|
1882
1757
|
children,
|
|
@@ -1885,18 +1760,18 @@ function UploadFieldInput({
|
|
|
1885
1760
|
help,
|
|
1886
1761
|
validation
|
|
1887
1762
|
}) {
|
|
1888
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
1763
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
1889
1764
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1890
|
-
return /* @__PURE__ */ (0,
|
|
1765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
1891
1766
|
"div",
|
|
1892
1767
|
{
|
|
1893
|
-
className: (0,
|
|
1768
|
+
className: (0, import_classnames3.default)("form-group d-block", {
|
|
1894
1769
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
1895
1770
|
}),
|
|
1896
1771
|
children: [
|
|
1897
|
-
/* @__PURE__ */ (0,
|
|
1772
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
1898
1773
|
children,
|
|
1899
|
-
(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 })
|
|
1900
1775
|
]
|
|
1901
1776
|
}
|
|
1902
1777
|
);
|
|
@@ -1931,7 +1806,7 @@ var getSizeLimit = (maxSize) => {
|
|
|
1931
1806
|
};
|
|
1932
1807
|
|
|
1933
1808
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1934
|
-
var
|
|
1809
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1935
1810
|
var MultiUploadInputRenderer = {
|
|
1936
1811
|
canRenderType: "input-upload-multi",
|
|
1937
1812
|
render: (props) => {
|
|
@@ -1956,7 +1831,7 @@ var MultiUploadInputRenderer = {
|
|
|
1956
1831
|
};
|
|
1957
1832
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
1958
1833
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1959
|
-
return /* @__PURE__ */ (0,
|
|
1834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1960
1835
|
UploadFieldInput_default,
|
|
1961
1836
|
{
|
|
1962
1837
|
id,
|
|
@@ -1964,8 +1839,8 @@ var MultiUploadInputRenderer = {
|
|
|
1964
1839
|
description,
|
|
1965
1840
|
validation: validationState,
|
|
1966
1841
|
help,
|
|
1967
|
-
children: /* @__PURE__ */ (0,
|
|
1968
|
-
|
|
1842
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1843
|
+
import_components27.UploadInput,
|
|
1969
1844
|
{
|
|
1970
1845
|
id,
|
|
1971
1846
|
"aria-describedby": descriptionId,
|
|
@@ -1974,7 +1849,7 @@ var MultiUploadInputRenderer = {
|
|
|
1974
1849
|
files: value.map(({ id: id2, file, validationState: validationState2 }) => ({
|
|
1975
1850
|
id: id2,
|
|
1976
1851
|
filename: file.name,
|
|
1977
|
-
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
|
|
1978
1853
|
})),
|
|
1979
1854
|
fileTypes: acceptsToFileTypes(accepts),
|
|
1980
1855
|
maxFiles: maxItems,
|
|
@@ -1992,8 +1867,8 @@ var MultiUploadInputRenderer = {
|
|
|
1992
1867
|
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
1993
1868
|
|
|
1994
1869
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
1995
|
-
var
|
|
1996
|
-
var
|
|
1870
|
+
var import_components28 = require("@transferwise/components");
|
|
1871
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
1997
1872
|
var NumberInputRenderer = {
|
|
1998
1873
|
canRenderType: "input-number",
|
|
1999
1874
|
render: (props) => {
|
|
@@ -2007,7 +1882,7 @@ var NumberInputRenderer = {
|
|
|
2007
1882
|
"maximum",
|
|
2008
1883
|
"minimum"
|
|
2009
1884
|
);
|
|
2010
|
-
return /* @__PURE__ */ (0,
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
2011
1886
|
FieldInput_default,
|
|
2012
1887
|
{
|
|
2013
1888
|
id,
|
|
@@ -2015,8 +1890,8 @@ var NumberInputRenderer = {
|
|
|
2015
1890
|
description,
|
|
2016
1891
|
validation: validationState,
|
|
2017
1892
|
help,
|
|
2018
|
-
children: /* @__PURE__ */ (0,
|
|
2019
|
-
|
|
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,
|
|
2020
1895
|
__spreadValues({
|
|
2021
1896
|
id,
|
|
2022
1897
|
name: id,
|
|
@@ -2036,24 +1911,24 @@ var NumberInputRenderer = {
|
|
|
2036
1911
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
2037
1912
|
|
|
2038
1913
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2039
|
-
var
|
|
1914
|
+
var import_react_intl12 = require("react-intl");
|
|
2040
1915
|
|
|
2041
1916
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
2042
|
-
var
|
|
2043
|
-
var
|
|
1917
|
+
var import_components29 = require("@transferwise/components");
|
|
1918
|
+
var import_react10 = require("react");
|
|
2044
1919
|
function useSnackBarIfAvailable() {
|
|
2045
|
-
const context = (0,
|
|
1920
|
+
const context = (0, import_react10.useContext)(import_components29.SnackbarContext);
|
|
2046
1921
|
return context ? context.createSnackbar : () => {
|
|
2047
1922
|
};
|
|
2048
1923
|
}
|
|
2049
1924
|
|
|
2050
1925
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2051
|
-
var
|
|
2052
|
-
var
|
|
1926
|
+
var import_components30 = require("@transferwise/components");
|
|
1927
|
+
var import_classnames4 = __toESM(require_classnames());
|
|
2053
1928
|
|
|
2054
1929
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
2055
|
-
var
|
|
2056
|
-
var paragraph_messages_default = (0,
|
|
1930
|
+
var import_react_intl11 = require("react-intl");
|
|
1931
|
+
var paragraph_messages_default = (0, import_react_intl11.defineMessages)({
|
|
2057
1932
|
copy: {
|
|
2058
1933
|
id: "df.wise.DynamicParagraph.copy",
|
|
2059
1934
|
defaultMessage: "Copy",
|
|
@@ -2067,14 +1942,14 @@ var paragraph_messages_default = (0, import_react_intl14.defineMessages)({
|
|
|
2067
1942
|
});
|
|
2068
1943
|
|
|
2069
1944
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
2070
|
-
var
|
|
1945
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2071
1946
|
var ParagraphRenderer = {
|
|
2072
1947
|
canRenderType: "paragraph",
|
|
2073
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1948
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Paragraph, __spreadValues({}, props))
|
|
2074
1949
|
};
|
|
2075
1950
|
function Paragraph({ align, control, margin, size, text }) {
|
|
2076
1951
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
2077
|
-
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)(
|
|
2078
1953
|
"p",
|
|
2079
1954
|
{
|
|
2080
1955
|
className: `${["xs", "sm"].includes(size) ? "np-text-body-default" : "np-text-body-large"} ${className}`,
|
|
@@ -2087,38 +1962,38 @@ function CopyableParagraph({
|
|
|
2087
1962
|
align,
|
|
2088
1963
|
className
|
|
2089
1964
|
}) {
|
|
2090
|
-
const { formatMessage } = (0,
|
|
1965
|
+
const { formatMessage } = (0, import_react_intl12.useIntl)();
|
|
2091
1966
|
const createSnackbar = useSnackBarIfAvailable();
|
|
2092
1967
|
const copy = () => {
|
|
2093
1968
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
2094
1969
|
});
|
|
2095
1970
|
};
|
|
2096
1971
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
2097
|
-
return /* @__PURE__ */ (0,
|
|
2098
|
-
/* @__PURE__ */ (0,
|
|
2099
|
-
|
|
1972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className, children: [
|
|
1973
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1974
|
+
import_components30.Input,
|
|
2100
1975
|
{
|
|
2101
1976
|
type: "text",
|
|
2102
1977
|
value: text,
|
|
2103
1978
|
readOnly: true,
|
|
2104
|
-
className: (0,
|
|
1979
|
+
className: (0, import_classnames4.default)("text-ellipsis", inputAlignmentClasses)
|
|
2105
1980
|
}
|
|
2106
1981
|
),
|
|
2107
|
-
/* @__PURE__ */ (0,
|
|
1982
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components30.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
2108
1983
|
] });
|
|
2109
1984
|
}
|
|
2110
1985
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
2111
1986
|
|
|
2112
1987
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2113
|
-
var
|
|
1988
|
+
var import_components31 = require("@transferwise/components");
|
|
2114
1989
|
var import_icons = require("@transferwise/icons");
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2117
|
-
var
|
|
1990
|
+
var import_classnames5 = __toESM(require_classnames());
|
|
1991
|
+
var import_react11 = require("react");
|
|
1992
|
+
var import_react_intl14 = require("react-intl");
|
|
2118
1993
|
|
|
2119
1994
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
2120
|
-
var
|
|
2121
|
-
var repeatable_messages_default = (0,
|
|
1995
|
+
var import_react_intl13 = require("react-intl");
|
|
1996
|
+
var repeatable_messages_default = (0, import_react_intl13.defineMessages)({
|
|
2122
1997
|
addItemTitle: {
|
|
2123
1998
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
2124
1999
|
defaultMessage: "Add Item",
|
|
@@ -2142,10 +2017,10 @@ var repeatable_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
2142
2017
|
});
|
|
2143
2018
|
|
|
2144
2019
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
2145
|
-
var
|
|
2020
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2146
2021
|
var RepeatableRenderer = {
|
|
2147
2022
|
canRenderType: "repeatable",
|
|
2148
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2023
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Repeatable, __spreadValues({}, props))
|
|
2149
2024
|
};
|
|
2150
2025
|
function Repeatable(props) {
|
|
2151
2026
|
const {
|
|
@@ -2161,8 +2036,8 @@ function Repeatable(props) {
|
|
|
2161
2036
|
onSave,
|
|
2162
2037
|
onRemove
|
|
2163
2038
|
} = props;
|
|
2164
|
-
const { formatMessage } = (0,
|
|
2165
|
-
const [openModalType, setOpenModalType] = (0,
|
|
2039
|
+
const { formatMessage } = (0, import_react_intl14.useIntl)();
|
|
2040
|
+
const [openModalType, setOpenModalType] = (0, import_react11.useState)(null);
|
|
2166
2041
|
const onAddItem = () => {
|
|
2167
2042
|
onAdd();
|
|
2168
2043
|
setOpenModalType("add");
|
|
@@ -2184,41 +2059,41 @@ function Repeatable(props) {
|
|
|
2184
2059
|
const onCancelEdit = () => {
|
|
2185
2060
|
setOpenModalType(null);
|
|
2186
2061
|
};
|
|
2187
|
-
return /* @__PURE__ */ (0,
|
|
2188
|
-
title && /* @__PURE__ */ (0,
|
|
2189
|
-
description && /* @__PURE__ */ (0,
|
|
2190
|
-
/* @__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)(
|
|
2191
2066
|
"div",
|
|
2192
2067
|
{
|
|
2193
|
-
className: (0,
|
|
2068
|
+
className: (0, import_classnames5.default)("form-group", {
|
|
2194
2069
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2195
2070
|
}),
|
|
2196
2071
|
children: [
|
|
2197
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
2198
|
-
/* @__PURE__ */ (0,
|
|
2199
|
-
|
|
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,
|
|
2200
2075
|
{
|
|
2201
|
-
media: /* @__PURE__ */ (0,
|
|
2076
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons.Plus, {}),
|
|
2202
2077
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2203
2078
|
showMediaAtAllSizes: true,
|
|
2204
2079
|
onClick: () => onAddItem()
|
|
2205
2080
|
}
|
|
2206
2081
|
),
|
|
2207
|
-
(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 })
|
|
2208
2083
|
]
|
|
2209
2084
|
}
|
|
2210
2085
|
),
|
|
2211
|
-
/* @__PURE__ */ (0,
|
|
2212
|
-
|
|
2086
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2087
|
+
import_components31.Modal,
|
|
2213
2088
|
{
|
|
2214
2089
|
open: openModalType !== null,
|
|
2215
2090
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2216
|
-
body: /* @__PURE__ */ (0,
|
|
2217
|
-
/* @__PURE__ */ (0,
|
|
2218
|
-
/* @__PURE__ */ (0,
|
|
2219
|
-
/* @__PURE__ */ (0,
|
|
2220
|
-
/* @__PURE__ */ (0,
|
|
2221
|
-
|
|
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,
|
|
2222
2097
|
{
|
|
2223
2098
|
v2: true,
|
|
2224
2099
|
priority: "secondary",
|
|
@@ -2239,10 +2114,10 @@ function ItemSummaryOption({
|
|
|
2239
2114
|
item,
|
|
2240
2115
|
onClick
|
|
2241
2116
|
}) {
|
|
2242
|
-
return /* @__PURE__ */ (0,
|
|
2243
|
-
|
|
2117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2118
|
+
import_components31.NavigationOption,
|
|
2244
2119
|
{
|
|
2245
|
-
media: /* @__PURE__ */ (0,
|
|
2120
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OptionMedia, { media: item.media, preferAvatar: false }),
|
|
2246
2121
|
title: item.title,
|
|
2247
2122
|
content: item.description,
|
|
2248
2123
|
showMediaAtAllSizes: true,
|
|
@@ -2253,96 +2128,14 @@ function ItemSummaryOption({
|
|
|
2253
2128
|
}
|
|
2254
2129
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2255
2130
|
|
|
2256
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2257
|
-
var import_components35 = require("@transferwise/components");
|
|
2258
|
-
|
|
2259
|
-
// ../renderers/src/components/Header.tsx
|
|
2260
|
-
var import_components34 = require("@transferwise/components");
|
|
2261
|
-
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2262
|
-
var Header7 = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components34.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) });
|
|
2263
|
-
var getHeaderAction = (callToAction) => {
|
|
2264
|
-
if (!callToAction) {
|
|
2265
|
-
return void 0;
|
|
2266
|
-
}
|
|
2267
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2268
|
-
return href ? {
|
|
2269
|
-
"aria-label": accessibilityDescription,
|
|
2270
|
-
text: title,
|
|
2271
|
-
href,
|
|
2272
|
-
target: "_blank"
|
|
2273
|
-
} : {
|
|
2274
|
-
"aria-label": accessibilityDescription,
|
|
2275
|
-
text: title,
|
|
2276
|
-
onClick: (event) => {
|
|
2277
|
-
event.preventDefault();
|
|
2278
|
-
onClick();
|
|
2279
|
-
}
|
|
2280
|
-
};
|
|
2281
|
-
};
|
|
2282
|
-
|
|
2283
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2284
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2285
|
-
var ReviewRenderer = {
|
|
2286
|
-
canRenderType: "review",
|
|
2287
|
-
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2288
|
-
const orientation = mapControlToDefinitionListLayout(control);
|
|
2289
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
2290
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Header7, { title, callToAction }),
|
|
2291
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2292
|
-
import_components35.DefinitionList,
|
|
2293
|
-
{
|
|
2294
|
-
layout: orientation,
|
|
2295
|
-
definitions: fields.map(
|
|
2296
|
-
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2297
|
-
key: String(index),
|
|
2298
|
-
value,
|
|
2299
|
-
title: getFieldLabel(
|
|
2300
|
-
label,
|
|
2301
|
-
help,
|
|
2302
|
-
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2303
|
-
)
|
|
2304
|
-
})
|
|
2305
|
-
)
|
|
2306
|
-
}
|
|
2307
|
-
) })
|
|
2308
|
-
] });
|
|
2309
|
-
}
|
|
2310
|
-
};
|
|
2311
|
-
var ReviewRenderer_default = ReviewRenderer;
|
|
2312
|
-
var mapControlToDefinitionListLayout = (control) => {
|
|
2313
|
-
switch (control) {
|
|
2314
|
-
case "horizontal":
|
|
2315
|
-
case "horizontal-end-aligned":
|
|
2316
|
-
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2317
|
-
case "horizontal-start-aligned":
|
|
2318
|
-
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2319
|
-
case "vertical-two-column":
|
|
2320
|
-
return "VERTICAL_TWO_COLUMN";
|
|
2321
|
-
case "vertical":
|
|
2322
|
-
case "vertical-one-column":
|
|
2323
|
-
default:
|
|
2324
|
-
return "VERTICAL_ONE_COLUMN";
|
|
2325
|
-
}
|
|
2326
|
-
};
|
|
2327
|
-
var getFieldLabel = (label, help, onClick) => {
|
|
2328
|
-
if (help) {
|
|
2329
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [
|
|
2330
|
-
label,
|
|
2331
|
-
" ",
|
|
2332
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Help_default, { help, onClick })
|
|
2333
|
-
] });
|
|
2334
|
-
}
|
|
2335
|
-
return label;
|
|
2336
|
-
};
|
|
2337
|
-
|
|
2338
2131
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2339
|
-
var
|
|
2340
|
-
var
|
|
2341
|
-
var
|
|
2132
|
+
var import_components33 = require("@transferwise/components");
|
|
2133
|
+
var import_react12 = require("react");
|
|
2134
|
+
var import_react_intl18 = require("react-intl");
|
|
2342
2135
|
|
|
2343
2136
|
// ../renderers/src/messages/search.messages.ts
|
|
2344
|
-
var
|
|
2345
|
-
var search_messages_default = (0,
|
|
2137
|
+
var import_react_intl15 = require("react-intl");
|
|
2138
|
+
var search_messages_default = (0, import_react_intl15.defineMessages)({
|
|
2346
2139
|
loading: {
|
|
2347
2140
|
id: "df.wise.SearchLayout.loading",
|
|
2348
2141
|
defaultMessage: "Loading...",
|
|
@@ -2351,11 +2144,11 @@ var search_messages_default = (0, import_react_intl18.defineMessages)({
|
|
|
2351
2144
|
});
|
|
2352
2145
|
|
|
2353
2146
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2354
|
-
var
|
|
2147
|
+
var import_react_intl17 = require("react-intl");
|
|
2355
2148
|
|
|
2356
2149
|
// ../renderers/src/messages/generic-error.messages.ts
|
|
2357
|
-
var
|
|
2358
|
-
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)({
|
|
2359
2152
|
genericErrorRetryHint: {
|
|
2360
2153
|
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2361
2154
|
defaultMessage: "Something went wrong, please try again.",
|
|
@@ -2374,19 +2167,19 @@ var generic_error_messages_default = (0, import_react_intl19.defineMessages)({
|
|
|
2374
2167
|
});
|
|
2375
2168
|
|
|
2376
2169
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2377
|
-
var
|
|
2378
|
-
var
|
|
2170
|
+
var import_components32 = require("@transferwise/components");
|
|
2171
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2379
2172
|
function ErrorResult({ state }) {
|
|
2380
|
-
const intl = (0,
|
|
2381
|
-
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: [
|
|
2382
2175
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
2383
2176
|
"\xA0",
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2177
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components32.Link, { onClick: () => state.onRetry(), children: intl.formatMessage(generic_error_messages_default.retry) })
|
|
2385
2178
|
] });
|
|
2386
2179
|
}
|
|
2387
2180
|
|
|
2388
2181
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2389
|
-
var
|
|
2182
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2390
2183
|
function BlockSearchRendererComponent({
|
|
2391
2184
|
id,
|
|
2392
2185
|
isLoading,
|
|
@@ -2397,11 +2190,11 @@ function BlockSearchRendererComponent({
|
|
|
2397
2190
|
trackEvent,
|
|
2398
2191
|
onChange
|
|
2399
2192
|
}) {
|
|
2400
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2401
|
-
const { formatMessage } = (0,
|
|
2402
|
-
return /* @__PURE__ */ (0,
|
|
2403
|
-
/* @__PURE__ */ (0,
|
|
2404
|
-
|
|
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,
|
|
2405
2198
|
{
|
|
2406
2199
|
id,
|
|
2407
2200
|
name: id,
|
|
@@ -2417,7 +2210,7 @@ function BlockSearchRendererComponent({
|
|
|
2417
2210
|
}
|
|
2418
2211
|
}
|
|
2419
2212
|
) }),
|
|
2420
|
-
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 })
|
|
2421
2214
|
] });
|
|
2422
2215
|
}
|
|
2423
2216
|
function SearchResultContent({
|
|
@@ -2426,31 +2219,31 @@ function SearchResultContent({
|
|
|
2426
2219
|
}) {
|
|
2427
2220
|
switch (state.type) {
|
|
2428
2221
|
case "error":
|
|
2429
|
-
return /* @__PURE__ */ (0,
|
|
2222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ErrorResult, { state });
|
|
2430
2223
|
case "results":
|
|
2431
|
-
return /* @__PURE__ */ (0,
|
|
2224
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(SearchResults, { state, trackEvent });
|
|
2432
2225
|
case "noResults":
|
|
2433
|
-
return /* @__PURE__ */ (0,
|
|
2226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(EmptySearchResult, { state });
|
|
2434
2227
|
case "pending":
|
|
2435
2228
|
default:
|
|
2436
2229
|
return null;
|
|
2437
2230
|
}
|
|
2438
2231
|
}
|
|
2439
2232
|
function EmptySearchResult({ state }) {
|
|
2440
|
-
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 });
|
|
2441
2234
|
}
|
|
2442
2235
|
function SearchResults({
|
|
2443
2236
|
state,
|
|
2444
2237
|
trackEvent
|
|
2445
2238
|
}) {
|
|
2446
|
-
return /* @__PURE__ */ (0,
|
|
2239
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.NavigationOptionsList, { children: state.results.map((result) => {
|
|
2447
2240
|
const { media } = result;
|
|
2448
|
-
return /* @__PURE__ */ (0,
|
|
2449
|
-
|
|
2241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2242
|
+
import_components33.NavigationOption,
|
|
2450
2243
|
{
|
|
2451
2244
|
title: result.title,
|
|
2452
2245
|
content: result.description,
|
|
2453
|
-
media: media ? /* @__PURE__ */ (0,
|
|
2246
|
+
media: media ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(OptionMedia, { media, preferAvatar: false }) : void 0,
|
|
2454
2247
|
showMediaCircle: false,
|
|
2455
2248
|
showMediaAtAllSizes: true,
|
|
2456
2249
|
onClick: () => {
|
|
@@ -2467,11 +2260,11 @@ function SearchResults({
|
|
|
2467
2260
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
2468
2261
|
|
|
2469
2262
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
2470
|
-
var
|
|
2263
|
+
var import_components34 = require("@transferwise/components");
|
|
2471
2264
|
var import_icons2 = require("@transferwise/icons");
|
|
2472
|
-
var
|
|
2473
|
-
var
|
|
2474
|
-
var
|
|
2265
|
+
var import_react13 = require("react");
|
|
2266
|
+
var import_react_intl19 = require("react-intl");
|
|
2267
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2475
2268
|
function InlineSearchRenderer({
|
|
2476
2269
|
id,
|
|
2477
2270
|
isLoading,
|
|
@@ -2481,20 +2274,20 @@ function InlineSearchRenderer({
|
|
|
2481
2274
|
title,
|
|
2482
2275
|
trackEvent
|
|
2483
2276
|
}) {
|
|
2484
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2485
|
-
const intl = (0,
|
|
2486
|
-
return /* @__PURE__ */ (0,
|
|
2487
|
-
|
|
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,
|
|
2488
2281
|
{
|
|
2489
2282
|
id: "typeahead-input-id",
|
|
2490
2283
|
intl,
|
|
2491
2284
|
name: "typeahead-input-name",
|
|
2492
2285
|
size: "md",
|
|
2493
2286
|
maxHeight: 100,
|
|
2494
|
-
footer: /* @__PURE__ */ (0,
|
|
2287
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
2495
2288
|
multiple: false,
|
|
2496
2289
|
clearable: false,
|
|
2497
|
-
addon: /* @__PURE__ */ (0,
|
|
2290
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_icons2.Search, { size: 24 }),
|
|
2498
2291
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
2499
2292
|
minQueryLength: 1,
|
|
2500
2293
|
onChange: (values) => {
|
|
@@ -2529,33 +2322,33 @@ function mapResultToTypeaheadOption(result) {
|
|
|
2529
2322
|
};
|
|
2530
2323
|
}
|
|
2531
2324
|
function TypeaheadFooter({ state, isLoading }) {
|
|
2532
|
-
const { formatMessage } = (0,
|
|
2325
|
+
const { formatMessage } = (0, import_react_intl19.useIntl)();
|
|
2533
2326
|
if (state.type === "noResults") {
|
|
2534
|
-
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 });
|
|
2535
2328
|
}
|
|
2536
2329
|
if (state.type === "error") {
|
|
2537
|
-
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 }) });
|
|
2538
2331
|
}
|
|
2539
2332
|
if (state.type === "pending" || isLoading) {
|
|
2540
|
-
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) });
|
|
2541
2334
|
}
|
|
2542
2335
|
return null;
|
|
2543
2336
|
}
|
|
2544
2337
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
2545
2338
|
|
|
2546
2339
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
2547
|
-
var
|
|
2340
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2548
2341
|
var SearchRenderer = {
|
|
2549
2342
|
canRenderType: "search",
|
|
2550
|
-
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))
|
|
2551
2344
|
};
|
|
2552
2345
|
var SearchRenderer_default = SearchRenderer;
|
|
2553
2346
|
|
|
2554
2347
|
// ../renderers/src/SectionRenderer.tsx
|
|
2555
|
-
var
|
|
2348
|
+
var import_components35 = require("@transferwise/components");
|
|
2556
2349
|
|
|
2557
2350
|
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2558
|
-
var
|
|
2351
|
+
var getHeaderAction = (callToAction) => {
|
|
2559
2352
|
if (!callToAction) {
|
|
2560
2353
|
return void 0;
|
|
2561
2354
|
}
|
|
@@ -2576,12 +2369,12 @@ var getHeaderAction2 = (callToAction) => {
|
|
|
2576
2369
|
};
|
|
2577
2370
|
|
|
2578
2371
|
// ../renderers/src/SectionRenderer.tsx
|
|
2579
|
-
var
|
|
2372
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2580
2373
|
var SectionRenderer = {
|
|
2581
2374
|
canRenderType: "section",
|
|
2582
2375
|
render: ({ children, callToAction, margin, title }) => {
|
|
2583
|
-
return /* @__PURE__ */ (0,
|
|
2584
|
-
(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) }),
|
|
2585
2378
|
children
|
|
2586
2379
|
] });
|
|
2587
2380
|
}
|
|
@@ -2589,8 +2382,8 @@ var SectionRenderer = {
|
|
|
2589
2382
|
var SectionRenderer_default = SectionRenderer;
|
|
2590
2383
|
|
|
2591
2384
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
2592
|
-
var
|
|
2593
|
-
var
|
|
2385
|
+
var import_components36 = require("@transferwise/components");
|
|
2386
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2594
2387
|
function RadioInputRendererComponent(props) {
|
|
2595
2388
|
const {
|
|
2596
2389
|
id,
|
|
@@ -2604,8 +2397,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2604
2397
|
validationState,
|
|
2605
2398
|
onSelect
|
|
2606
2399
|
} = props;
|
|
2607
|
-
return /* @__PURE__ */ (0,
|
|
2608
|
-
/* @__PURE__ */ (0,
|
|
2400
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
2401
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2609
2402
|
FieldInput_default,
|
|
2610
2403
|
{
|
|
2611
2404
|
id,
|
|
@@ -2613,8 +2406,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2613
2406
|
help,
|
|
2614
2407
|
description,
|
|
2615
2408
|
validation: validationState,
|
|
2616
|
-
children: /* @__PURE__ */ (0,
|
|
2617
|
-
|
|
2409
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2410
|
+
import_components36.RadioGroup,
|
|
2618
2411
|
{
|
|
2619
2412
|
name: id,
|
|
2620
2413
|
radios: options.map((option, index) => ({
|
|
@@ -2622,7 +2415,7 @@ function RadioInputRendererComponent(props) {
|
|
|
2622
2415
|
value: index,
|
|
2623
2416
|
secondary: option.description,
|
|
2624
2417
|
disabled: option.disabled || disabled,
|
|
2625
|
-
avatar: /* @__PURE__ */ (0,
|
|
2418
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2626
2419
|
})),
|
|
2627
2420
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
2628
2421
|
onChange: onSelect
|
|
@@ -2636,9 +2429,9 @@ function RadioInputRendererComponent(props) {
|
|
|
2636
2429
|
}
|
|
2637
2430
|
|
|
2638
2431
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
2639
|
-
var
|
|
2640
|
-
var
|
|
2641
|
-
var
|
|
2432
|
+
var import_components37 = require("@transferwise/components");
|
|
2433
|
+
var import_react14 = require("react");
|
|
2434
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2642
2435
|
function TabInputRendererComponent(props) {
|
|
2643
2436
|
const {
|
|
2644
2437
|
id,
|
|
@@ -2652,13 +2445,13 @@ function TabInputRendererComponent(props) {
|
|
|
2652
2445
|
validationState,
|
|
2653
2446
|
onSelect
|
|
2654
2447
|
} = props;
|
|
2655
|
-
(0,
|
|
2448
|
+
(0, import_react14.useEffect)(() => {
|
|
2656
2449
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
2657
2450
|
onSelect(0);
|
|
2658
2451
|
}
|
|
2659
2452
|
}, [selectedIndex, onSelect, options.length]);
|
|
2660
|
-
return /* @__PURE__ */ (0,
|
|
2661
|
-
/* @__PURE__ */ (0,
|
|
2453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
|
|
2454
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2662
2455
|
FieldInput_default,
|
|
2663
2456
|
{
|
|
2664
2457
|
id,
|
|
@@ -2666,8 +2459,8 @@ function TabInputRendererComponent(props) {
|
|
|
2666
2459
|
help,
|
|
2667
2460
|
description,
|
|
2668
2461
|
validation: validationState,
|
|
2669
|
-
children: /* @__PURE__ */ (0,
|
|
2670
|
-
|
|
2462
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
2463
|
+
import_components37.Tabs,
|
|
2671
2464
|
{
|
|
2672
2465
|
name: id,
|
|
2673
2466
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
@@ -2675,7 +2468,7 @@ function TabInputRendererComponent(props) {
|
|
|
2675
2468
|
title: option.title,
|
|
2676
2469
|
// if we pass null, we get some props-types console errors
|
|
2677
2470
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
2678
|
-
content: /* @__PURE__ */ (0,
|
|
2471
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, {}),
|
|
2679
2472
|
disabled: option.disabled || disabled
|
|
2680
2473
|
})),
|
|
2681
2474
|
onTabSelect: onSelect
|
|
@@ -2689,8 +2482,8 @@ function TabInputRendererComponent(props) {
|
|
|
2689
2482
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2690
2483
|
|
|
2691
2484
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
2692
|
-
var
|
|
2693
|
-
var
|
|
2485
|
+
var import_components38 = require("@transferwise/components");
|
|
2486
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2694
2487
|
function SelectInputRendererComponent(props) {
|
|
2695
2488
|
const {
|
|
2696
2489
|
id,
|
|
@@ -2730,13 +2523,13 @@ function SelectInputRendererComponent(props) {
|
|
|
2730
2523
|
} : {
|
|
2731
2524
|
title: option.title,
|
|
2732
2525
|
description: option.description,
|
|
2733
|
-
icon: /* @__PURE__ */ (0,
|
|
2526
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2734
2527
|
};
|
|
2735
|
-
return /* @__PURE__ */ (0,
|
|
2528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components38.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2736
2529
|
};
|
|
2737
2530
|
const extraProps = { autoComplete };
|
|
2738
|
-
return /* @__PURE__ */ (0,
|
|
2739
|
-
/* @__PURE__ */ (0,
|
|
2531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
2532
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2740
2533
|
FieldInput_default,
|
|
2741
2534
|
{
|
|
2742
2535
|
id,
|
|
@@ -2744,8 +2537,8 @@ function SelectInputRendererComponent(props) {
|
|
|
2744
2537
|
help,
|
|
2745
2538
|
description,
|
|
2746
2539
|
validation: validationState,
|
|
2747
|
-
children: /* @__PURE__ */ (0,
|
|
2748
|
-
|
|
2540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2541
|
+
import_components38.SelectInput,
|
|
2749
2542
|
__spreadValues({
|
|
2750
2543
|
name: id,
|
|
2751
2544
|
placeholder,
|
|
@@ -2765,9 +2558,9 @@ function SelectInputRendererComponent(props) {
|
|
|
2765
2558
|
}
|
|
2766
2559
|
|
|
2767
2560
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
2768
|
-
var
|
|
2769
|
-
var
|
|
2770
|
-
var
|
|
2561
|
+
var import_react15 = require("react");
|
|
2562
|
+
var import_components39 = require("@transferwise/components");
|
|
2563
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2771
2564
|
function SegmentedInputRendererComponent(props) {
|
|
2772
2565
|
const {
|
|
2773
2566
|
id,
|
|
@@ -2780,13 +2573,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2780
2573
|
validationState,
|
|
2781
2574
|
onSelect
|
|
2782
2575
|
} = props;
|
|
2783
|
-
(0,
|
|
2576
|
+
(0, import_react15.useEffect)(() => {
|
|
2784
2577
|
if (!isValidIndex3(selectedIndex, options.length)) {
|
|
2785
2578
|
onSelect(0);
|
|
2786
2579
|
}
|
|
2787
2580
|
}, [selectedIndex, onSelect, options.length]);
|
|
2788
|
-
return /* @__PURE__ */ (0,
|
|
2789
|
-
/* @__PURE__ */ (0,
|
|
2581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
2582
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2790
2583
|
FieldInput_default,
|
|
2791
2584
|
{
|
|
2792
2585
|
id,
|
|
@@ -2794,8 +2587,8 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2794
2587
|
help,
|
|
2795
2588
|
description,
|
|
2796
2589
|
validation: validationState,
|
|
2797
|
-
children: /* @__PURE__ */ (0,
|
|
2798
|
-
|
|
2590
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2591
|
+
import_components39.SegmentedControl,
|
|
2799
2592
|
{
|
|
2800
2593
|
name: `${id}-segmented-control`,
|
|
2801
2594
|
value: String(selectedIndex),
|
|
@@ -2811,86 +2604,93 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2811
2604
|
)
|
|
2812
2605
|
}
|
|
2813
2606
|
),
|
|
2814
|
-
/* @__PURE__ */ (0,
|
|
2607
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { id: `${id}-children`, children })
|
|
2815
2608
|
] });
|
|
2816
2609
|
}
|
|
2817
2610
|
var isValidIndex3 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2818
2611
|
|
|
2612
|
+
// ../renderers/src/SelectInputRenderer/RadioItemRendererComponent.tsx
|
|
2613
|
+
var import_components40 = require("@transferwise/components");
|
|
2614
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2615
|
+
function RadioItemRendererComponent(props) {
|
|
2616
|
+
const {
|
|
2617
|
+
id,
|
|
2618
|
+
children,
|
|
2619
|
+
description: rootDescription,
|
|
2620
|
+
disabled: rootDisabled,
|
|
2621
|
+
help,
|
|
2622
|
+
title: rootTitle,
|
|
2623
|
+
options,
|
|
2624
|
+
selectedIndex,
|
|
2625
|
+
validationState,
|
|
2626
|
+
onSelect
|
|
2627
|
+
} = props;
|
|
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,
|
|
2631
|
+
{
|
|
2632
|
+
as: "h2",
|
|
2633
|
+
title: help ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(LabelContentWithHelp, { text: rootTitle, help }) : rootTitle
|
|
2634
|
+
}
|
|
2635
|
+
),
|
|
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,
|
|
2640
|
+
__spreadValues({
|
|
2641
|
+
title,
|
|
2642
|
+
subtitle: description,
|
|
2643
|
+
control: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2644
|
+
import_components40.ListItem.Radio,
|
|
2645
|
+
{
|
|
2646
|
+
name: title,
|
|
2647
|
+
checked: selectedIndex === index,
|
|
2648
|
+
onChange: () => onSelect(index)
|
|
2649
|
+
}
|
|
2650
|
+
),
|
|
2651
|
+
additionalInfo: getAdditionalText(additionalText),
|
|
2652
|
+
disabled: disabled || rootDisabled,
|
|
2653
|
+
prompt: getInlineAlert(inlineAlert),
|
|
2654
|
+
media: getMedia(media, false)
|
|
2655
|
+
}, getSupportingValues(supportingValues)),
|
|
2656
|
+
title
|
|
2657
|
+
)
|
|
2658
|
+
) }, `${id}-${selectedIndex}`),
|
|
2659
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components40.InlineAlert, { type: "negative", children: validationState.message }),
|
|
2660
|
+
children
|
|
2661
|
+
] });
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2819
2664
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
2820
|
-
var
|
|
2665
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2821
2666
|
var SelectInputRenderer = {
|
|
2822
2667
|
canRenderType: "input-select",
|
|
2823
2668
|
render: (props) => {
|
|
2824
2669
|
switch (props.control) {
|
|
2825
2670
|
case "radio":
|
|
2826
|
-
return /* @__PURE__ */ (0,
|
|
2671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
2672
|
+
case "radio-item":
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(RadioItemRendererComponent, __spreadValues({}, props));
|
|
2827
2674
|
case "tab":
|
|
2828
|
-
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));
|
|
2829
2676
|
case "segmented":
|
|
2830
|
-
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));
|
|
2831
2678
|
case "select":
|
|
2832
2679
|
default:
|
|
2833
|
-
return /* @__PURE__ */ (0,
|
|
2680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
2834
2681
|
}
|
|
2835
2682
|
}
|
|
2836
2683
|
};
|
|
2837
2684
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
2838
2685
|
|
|
2839
|
-
// ../renderers/src/StatusListRenderer.tsx
|
|
2840
|
-
var import_components44 = require("@transferwise/components");
|
|
2841
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
2842
|
-
var StatusListRenderer = {
|
|
2843
|
-
canRenderType: "status-list",
|
|
2844
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: getMargin(margin), children: [
|
|
2845
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_components44.Header, { title, className: "m-b-2" }) : null,
|
|
2846
|
-
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
2847
|
-
import_components44.Summary,
|
|
2848
|
-
{
|
|
2849
|
-
title: itemTitle,
|
|
2850
|
-
description,
|
|
2851
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
2852
|
-
status: mapStatus(status),
|
|
2853
|
-
action: getSummaryAction(callToAction)
|
|
2854
|
-
},
|
|
2855
|
-
`${itemTitle}/${description || ""}`
|
|
2856
|
-
))
|
|
2857
|
-
] })
|
|
2858
|
-
};
|
|
2859
|
-
var StatusListRenderer_default = StatusListRenderer;
|
|
2860
|
-
var getSummaryAction = (callToAction) => {
|
|
2861
|
-
if (!callToAction) {
|
|
2862
|
-
return void 0;
|
|
2863
|
-
}
|
|
2864
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2865
|
-
if (!href) {
|
|
2866
|
-
return {
|
|
2867
|
-
"aria-label": accessibilityDescription,
|
|
2868
|
-
text: title,
|
|
2869
|
-
onClick
|
|
2870
|
-
};
|
|
2871
|
-
}
|
|
2872
|
-
return {
|
|
2873
|
-
"aria-label": accessibilityDescription,
|
|
2874
|
-
href,
|
|
2875
|
-
target: "_blank",
|
|
2876
|
-
text: title
|
|
2877
|
-
};
|
|
2878
|
-
};
|
|
2879
|
-
var mapStatus = (status) => {
|
|
2880
|
-
if (status === "not-done") {
|
|
2881
|
-
return "notDone";
|
|
2882
|
-
}
|
|
2883
|
-
return status;
|
|
2884
|
-
};
|
|
2885
|
-
|
|
2886
2686
|
// ../renderers/src/utils/useCustomTheme.ts
|
|
2887
2687
|
var import_components_theming = require("@wise/components-theming");
|
|
2888
|
-
var
|
|
2688
|
+
var import_react16 = require("react");
|
|
2889
2689
|
var ThemeRequiredEventName = "Theme Required";
|
|
2890
2690
|
var useCustomTheme = (theme, trackEvent) => {
|
|
2891
2691
|
const previousThemeHookValue = (0, import_components_theming.useTheme)();
|
|
2892
|
-
const previousTheme = (0,
|
|
2893
|
-
(0,
|
|
2692
|
+
const previousTheme = (0, import_react16.useMemo)(() => previousThemeHookValue.theme, []);
|
|
2693
|
+
(0, import_react16.useEffect)(() => {
|
|
2894
2694
|
trackEvent(ThemeRequiredEventName, { theme });
|
|
2895
2695
|
return theme !== previousTheme ? () => {
|
|
2896
2696
|
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
@@ -2900,13 +2700,13 @@ var useCustomTheme = (theme, trackEvent) => {
|
|
|
2900
2700
|
};
|
|
2901
2701
|
|
|
2902
2702
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
2903
|
-
var
|
|
2703
|
+
var import_components41 = require("@transferwise/components");
|
|
2904
2704
|
var import_icons3 = require("@transferwise/icons");
|
|
2905
|
-
var
|
|
2705
|
+
var import_react_intl21 = require("react-intl");
|
|
2906
2706
|
|
|
2907
2707
|
// ../renderers/src/messages/back.messages.ts
|
|
2908
|
-
var
|
|
2909
|
-
var back_messages_default = (0,
|
|
2708
|
+
var import_react_intl20 = require("react-intl");
|
|
2709
|
+
var back_messages_default = (0, import_react_intl20.defineMessages)({
|
|
2910
2710
|
back: {
|
|
2911
2711
|
id: "df.wise.back.label",
|
|
2912
2712
|
defaultMessage: "Back",
|
|
@@ -2915,31 +2715,31 @@ var back_messages_default = (0, import_react_intl23.defineMessages)({
|
|
|
2915
2715
|
});
|
|
2916
2716
|
|
|
2917
2717
|
// ../renderers/src/step/topbar/BackButton.tsx
|
|
2918
|
-
var
|
|
2718
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2919
2719
|
function BackButton({ title, onClick }) {
|
|
2920
|
-
const { formatMessage } = (0,
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
2922
|
-
/* @__PURE__ */ (0,
|
|
2923
|
-
/* @__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, {})
|
|
2924
2724
|
] });
|
|
2925
2725
|
}
|
|
2926
2726
|
|
|
2927
2727
|
// ../renderers/src/step/topbar/Toolbar.tsx
|
|
2928
|
-
var
|
|
2929
|
-
var
|
|
2728
|
+
var import_components42 = require("@transferwise/components");
|
|
2729
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2930
2730
|
var Toolbar = ({ items }) => {
|
|
2931
|
-
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;
|
|
2932
2732
|
};
|
|
2933
2733
|
function ToolbarButton(props) {
|
|
2934
|
-
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));
|
|
2935
2735
|
}
|
|
2936
2736
|
function MediaToolbarButton(props) {
|
|
2937
2737
|
var _a;
|
|
2938
2738
|
const { context, control, media, accessibilityDescription, disabled, onClick } = props;
|
|
2939
2739
|
const priority = getIconButtonPriority(control);
|
|
2940
|
-
const type =
|
|
2941
|
-
return /* @__PURE__ */ (0,
|
|
2942
|
-
|
|
2740
|
+
const type = getSentiment2(context);
|
|
2741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
2742
|
+
import_components42.IconButton,
|
|
2943
2743
|
{
|
|
2944
2744
|
className: "df-toolbar-button",
|
|
2945
2745
|
disabled,
|
|
@@ -2948,7 +2748,7 @@ function MediaToolbarButton(props) {
|
|
|
2948
2748
|
type,
|
|
2949
2749
|
onClick,
|
|
2950
2750
|
children: [
|
|
2951
|
-
accessibilityDescription ? /* @__PURE__ */ (0,
|
|
2751
|
+
accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
|
|
2952
2752
|
media ? (_a = getAddonStart(media)) == null ? void 0 : _a.value : null
|
|
2953
2753
|
]
|
|
2954
2754
|
}
|
|
@@ -2958,9 +2758,9 @@ function TextToolbarButton(props) {
|
|
|
2958
2758
|
const { context, control, title, media, disabled, onClick } = props;
|
|
2959
2759
|
const addonStart = media ? getAddonStart(media) : void 0;
|
|
2960
2760
|
const priority = getPriority2(control);
|
|
2961
|
-
const sentiment =
|
|
2962
|
-
return /* @__PURE__ */ (0,
|
|
2963
|
-
|
|
2761
|
+
const sentiment = getSentiment2(context);
|
|
2762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2763
|
+
import_components42.Button,
|
|
2964
2764
|
{
|
|
2965
2765
|
v2: true,
|
|
2966
2766
|
size: "sm",
|
|
@@ -2995,7 +2795,7 @@ var prefersMedia = (control) => {
|
|
|
2995
2795
|
};
|
|
2996
2796
|
var knownControls = ["primary", "secondary", "secondary-neutral"];
|
|
2997
2797
|
var isKnownControl = (control) => control !== void 0 && knownControls.includes(control);
|
|
2998
|
-
var
|
|
2798
|
+
var getSentiment2 = (context) => {
|
|
2999
2799
|
return "default";
|
|
3000
2800
|
};
|
|
3001
2801
|
var getIconButtonPriority = (control) => {
|
|
@@ -3004,16 +2804,16 @@ var getIconButtonPriority = (control) => {
|
|
|
3004
2804
|
};
|
|
3005
2805
|
|
|
3006
2806
|
// ../renderers/src/step/topbar/TopBar.tsx
|
|
3007
|
-
var
|
|
2807
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3008
2808
|
function TopBar({ back, toolbar }) {
|
|
3009
|
-
return back || toolbar ? /* @__PURE__ */ (0,
|
|
3010
|
-
back ? /* @__PURE__ */ (0,
|
|
3011
|
-
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
|
|
3012
2812
|
] }) : null;
|
|
3013
2813
|
}
|
|
3014
2814
|
|
|
3015
2815
|
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3016
|
-
var
|
|
2816
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3017
2817
|
var SplashCelebrationStepRenderer = {
|
|
3018
2818
|
canRenderType: "step",
|
|
3019
2819
|
canRender: ({ control }) => control === "splash-celebration",
|
|
@@ -3023,15 +2823,15 @@ function SplashCelebrationStepRendererComponent(props) {
|
|
|
3023
2823
|
const { back, toolbar, children, footer, trackEvent } = props;
|
|
3024
2824
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3025
2825
|
useCustomTheme("forest-green", trackEvent);
|
|
3026
|
-
return /* @__PURE__ */ (0,
|
|
3027
|
-
/* @__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 }),
|
|
3028
2828
|
children,
|
|
3029
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2829
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3030
2830
|
] });
|
|
3031
2831
|
}
|
|
3032
2832
|
|
|
3033
2833
|
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3034
|
-
var
|
|
2834
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3035
2835
|
var SplashStepRenderer = {
|
|
3036
2836
|
canRenderType: "step",
|
|
3037
2837
|
canRender: ({ control }) => control === "splash",
|
|
@@ -3040,16 +2840,16 @@ var SplashStepRenderer = {
|
|
|
3040
2840
|
function SplashStepRendererComponent(props) {
|
|
3041
2841
|
const { back, toolbar, children, footer } = props;
|
|
3042
2842
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3043
|
-
return /* @__PURE__ */ (0,
|
|
3044
|
-
/* @__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 }),
|
|
3045
2845
|
children,
|
|
3046
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2846
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3047
2847
|
] });
|
|
3048
2848
|
}
|
|
3049
2849
|
|
|
3050
2850
|
// ../renderers/src/step/StepRenderer.tsx
|
|
3051
|
-
var
|
|
3052
|
-
var
|
|
2851
|
+
var import_components43 = require("@transferwise/components");
|
|
2852
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
3053
2853
|
var StepRenderer = {
|
|
3054
2854
|
canRenderType: "step",
|
|
3055
2855
|
render: StepRendererComponent
|
|
@@ -3057,19 +2857,19 @@ var StepRenderer = {
|
|
|
3057
2857
|
function StepRendererComponent(props) {
|
|
3058
2858
|
const { back, description, error, title, children, toolbar, footer, tags } = props;
|
|
3059
2859
|
const hasFooter = footer && Array.isArray(footer) && footer.length > 0;
|
|
3060
|
-
return /* @__PURE__ */ (0,
|
|
3061
|
-
/* @__PURE__ */ (0,
|
|
3062
|
-
title || description ? /* @__PURE__ */ (0,
|
|
3063
|
-
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,
|
|
3064
2864
|
children,
|
|
3065
|
-
hasFooter ? /* @__PURE__ */ (0,
|
|
2865
|
+
hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "df-step-fixed__footer", children: footer }) : void 0
|
|
3066
2866
|
] });
|
|
3067
2867
|
}
|
|
3068
|
-
var
|
|
2868
|
+
var Header6 = ({ title, description, tags }) => {
|
|
3069
2869
|
const { titleType, alignmentClassName } = getHeaderStyle(tags);
|
|
3070
|
-
return /* @__PURE__ */ (0,
|
|
3071
|
-
title ? /* @__PURE__ */ (0,
|
|
3072
|
-
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
|
|
3073
2873
|
] });
|
|
3074
2874
|
};
|
|
3075
2875
|
var getHeaderStyle = (tags) => {
|
|
@@ -3080,36 +2880,36 @@ var getHeaderStyle = (tags) => {
|
|
|
3080
2880
|
};
|
|
3081
2881
|
|
|
3082
2882
|
// ../renderers/src/TabsRenderer.tsx
|
|
3083
|
-
var
|
|
3084
|
-
var
|
|
3085
|
-
var
|
|
2883
|
+
var import_components44 = require("@transferwise/components");
|
|
2884
|
+
var import_react17 = require("react");
|
|
2885
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
3086
2886
|
var TabsRenderer = {
|
|
3087
2887
|
canRenderType: "tabs",
|
|
3088
2888
|
render: (props) => {
|
|
3089
2889
|
switch (props.control) {
|
|
3090
2890
|
case "segmented":
|
|
3091
2891
|
if (props.tabs.length > 3) {
|
|
3092
|
-
return /* @__PURE__ */ (0,
|
|
2892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3093
2893
|
}
|
|
3094
|
-
return /* @__PURE__ */ (0,
|
|
2894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
3095
2895
|
case "chips":
|
|
3096
|
-
return /* @__PURE__ */ (0,
|
|
2896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
3097
2897
|
default:
|
|
3098
|
-
return /* @__PURE__ */ (0,
|
|
2898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3099
2899
|
}
|
|
3100
2900
|
}
|
|
3101
2901
|
};
|
|
3102
2902
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
3103
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3104
|
-
return /* @__PURE__ */ (0,
|
|
3105
|
-
|
|
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,
|
|
3106
2906
|
{
|
|
3107
2907
|
name: uid,
|
|
3108
2908
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
3109
2909
|
tabs: tabs.map((option) => ({
|
|
3110
2910
|
title: option.title,
|
|
3111
2911
|
disabled: false,
|
|
3112
|
-
content: /* @__PURE__ */ (0,
|
|
2912
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "m-t-2", children: [
|
|
3113
2913
|
" ",
|
|
3114
2914
|
option.children,
|
|
3115
2915
|
" "
|
|
@@ -3121,10 +2921,10 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3121
2921
|
}
|
|
3122
2922
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
3123
2923
|
var _a;
|
|
3124
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3125
|
-
return /* @__PURE__ */ (0,
|
|
3126
|
-
/* @__PURE__ */ (0,
|
|
3127
|
-
|
|
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,
|
|
3128
2928
|
{
|
|
3129
2929
|
name: uid,
|
|
3130
2930
|
value: String(selectedIndex),
|
|
@@ -3138,31 +2938,31 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3138
2938
|
onChange: (value) => setSelectedIndex(Number(value))
|
|
3139
2939
|
}
|
|
3140
2940
|
),
|
|
3141
|
-
/* @__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 })
|
|
3142
2942
|
] });
|
|
3143
2943
|
}
|
|
3144
2944
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3145
2945
|
var _a;
|
|
3146
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
3147
|
-
return /* @__PURE__ */ (0,
|
|
3148
|
-
/* @__PURE__ */ (0,
|
|
3149
|
-
|
|
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,
|
|
3150
2950
|
{
|
|
3151
2951
|
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
3152
2952
|
selected: selectedIndex,
|
|
3153
2953
|
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
3154
2954
|
}
|
|
3155
2955
|
) }),
|
|
3156
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3157
2957
|
] });
|
|
3158
2958
|
}
|
|
3159
2959
|
|
|
3160
2960
|
// ../renderers/src/TextInputRenderer.tsx
|
|
3161
|
-
var
|
|
2961
|
+
var import_components46 = require("@transferwise/components");
|
|
3162
2962
|
|
|
3163
2963
|
// ../renderers/src/components/VariableTextInput.tsx
|
|
3164
|
-
var
|
|
3165
|
-
var
|
|
2964
|
+
var import_components45 = require("@transferwise/components");
|
|
2965
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
3166
2966
|
var commonKeys = [
|
|
3167
2967
|
"autoComplete",
|
|
3168
2968
|
"autoCapitalize",
|
|
@@ -3181,12 +2981,12 @@ function VariableTextInput(inputProps) {
|
|
|
3181
2981
|
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
3182
2982
|
switch (control) {
|
|
3183
2983
|
case "email":
|
|
3184
|
-
return /* @__PURE__ */ (0,
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
3185
2985
|
case "password":
|
|
3186
|
-
return /* @__PURE__ */ (0,
|
|
2986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
3187
2987
|
case "numeric": {
|
|
3188
2988
|
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
3189
|
-
return /* @__PURE__ */ (0,
|
|
2989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
3190
2990
|
TextInput,
|
|
3191
2991
|
__spreadProps(__spreadValues({}, numericProps), {
|
|
3192
2992
|
onChange: (newValue) => {
|
|
@@ -3197,21 +2997,21 @@ function VariableTextInput(inputProps) {
|
|
|
3197
2997
|
);
|
|
3198
2998
|
}
|
|
3199
2999
|
case "phone-number":
|
|
3200
|
-
return /* @__PURE__ */ (0,
|
|
3000
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components45.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
3201
3001
|
default: {
|
|
3202
|
-
return /* @__PURE__ */ (0,
|
|
3002
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
3203
3003
|
}
|
|
3204
3004
|
}
|
|
3205
3005
|
}
|
|
3206
3006
|
function TextInput(props) {
|
|
3207
3007
|
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
3208
|
-
const InputWithPattern = control === "textarea" ?
|
|
3209
|
-
const InputWithoutPattern = control === "textarea" ?
|
|
3210
|
-
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) }));
|
|
3211
3011
|
}
|
|
3212
3012
|
|
|
3213
3013
|
// ../renderers/src/TextInputRenderer.tsx
|
|
3214
|
-
var
|
|
3014
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
3215
3015
|
var TextInputRenderer = {
|
|
3216
3016
|
canRenderType: "input-text",
|
|
3217
3017
|
render: (props) => {
|
|
@@ -3244,7 +3044,7 @@ var TextInputRenderer = {
|
|
|
3244
3044
|
}
|
|
3245
3045
|
}
|
|
3246
3046
|
});
|
|
3247
|
-
return /* @__PURE__ */ (0,
|
|
3047
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
3248
3048
|
FieldInput_default,
|
|
3249
3049
|
{
|
|
3250
3050
|
id,
|
|
@@ -3252,7 +3052,7 @@ var TextInputRenderer = {
|
|
|
3252
3052
|
description,
|
|
3253
3053
|
validation: validationState,
|
|
3254
3054
|
help,
|
|
3255
|
-
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)) })
|
|
3256
3056
|
}
|
|
3257
3057
|
);
|
|
3258
3058
|
}
|
|
@@ -3260,13 +3060,13 @@ var TextInputRenderer = {
|
|
|
3260
3060
|
var TextInputRenderer_default = TextInputRenderer;
|
|
3261
3061
|
|
|
3262
3062
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
3263
|
-
var
|
|
3063
|
+
var import_components47 = require("@transferwise/components");
|
|
3264
3064
|
|
|
3265
3065
|
// ../renderers/src/utils/getRandomId.ts
|
|
3266
3066
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
3267
3067
|
|
|
3268
3068
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
3269
|
-
var
|
|
3069
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
3270
3070
|
var UploadInputRenderer = {
|
|
3271
3071
|
canRenderType: "input-upload",
|
|
3272
3072
|
render: (props) => {
|
|
@@ -3282,15 +3082,15 @@ var UploadInputRenderer = {
|
|
|
3282
3082
|
};
|
|
3283
3083
|
return (
|
|
3284
3084
|
// We don't pass help here as there is no sensible place to display it
|
|
3285
|
-
/* @__PURE__ */ (0,
|
|
3085
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3286
3086
|
UploadFieldInput_default,
|
|
3287
3087
|
{
|
|
3288
3088
|
id,
|
|
3289
3089
|
label: void 0,
|
|
3290
3090
|
description: void 0,
|
|
3291
3091
|
validation: validationState,
|
|
3292
|
-
children: /* @__PURE__ */ (0,
|
|
3293
|
-
|
|
3092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3093
|
+
import_components47.UploadInput,
|
|
3294
3094
|
{
|
|
3295
3095
|
id,
|
|
3296
3096
|
description,
|
|
@@ -3300,7 +3100,7 @@ var UploadInputRenderer = {
|
|
|
3300
3100
|
{
|
|
3301
3101
|
id: "my-file",
|
|
3302
3102
|
filename: value.name,
|
|
3303
|
-
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
|
|
3304
3104
|
}
|
|
3305
3105
|
] : void 0,
|
|
3306
3106
|
fileTypes: acceptsToFileTypes(accepts),
|
|
@@ -3355,7 +3155,7 @@ var LargeUploadRenderer = {
|
|
|
3355
3155
|
};
|
|
3356
3156
|
const filetypes = acceptsToFileTypes(accepts);
|
|
3357
3157
|
const usAccept = filetypes === "*" ? "*" : filetypes.join(",");
|
|
3358
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3359
3159
|
FieldInput_default,
|
|
3360
3160
|
{
|
|
3361
3161
|
id,
|
|
@@ -3363,8 +3163,8 @@ var LargeUploadRenderer = {
|
|
|
3363
3163
|
description,
|
|
3364
3164
|
validation: validationState,
|
|
3365
3165
|
help,
|
|
3366
|
-
children: /* @__PURE__ */ (0,
|
|
3367
|
-
|
|
3166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
3167
|
+
import_components47.Upload,
|
|
3368
3168
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3369
3169
|
usAccept,
|
|
3370
3170
|
usDisabled: disabled,
|
|
@@ -3378,25 +3178,69 @@ var LargeUploadRenderer = {
|
|
|
3378
3178
|
}
|
|
3379
3179
|
};
|
|
3380
3180
|
|
|
3381
|
-
// ../renderers/src/
|
|
3382
|
-
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
|
+
};
|
|
3383
3203
|
|
|
3384
|
-
// ../renderers/src/
|
|
3204
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
3385
3205
|
var import_components52 = require("@transferwise/components");
|
|
3386
|
-
var
|
|
3387
|
-
var
|
|
3206
|
+
var import_icons4 = require("@transferwise/icons");
|
|
3207
|
+
var import_react_intl22 = require("react-intl");
|
|
3388
3208
|
|
|
3389
|
-
// ../renderers/src/
|
|
3390
|
-
var
|
|
3391
|
-
var
|
|
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");
|
|
3392
3236
|
var getAdditionalInfo = (additionalInfo) => {
|
|
3393
3237
|
if (!additionalInfo) {
|
|
3394
3238
|
return void 0;
|
|
3395
3239
|
}
|
|
3396
3240
|
const { href, text, onClick } = additionalInfo;
|
|
3397
3241
|
if (href || onClick) {
|
|
3398
|
-
return /* @__PURE__ */ (0,
|
|
3399
|
-
|
|
3242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
3243
|
+
import_components50.ListItem.AdditionalInfo,
|
|
3400
3244
|
{
|
|
3401
3245
|
action: {
|
|
3402
3246
|
label: text,
|
|
@@ -3407,60 +3251,12 @@ var getAdditionalInfo = (additionalInfo) => {
|
|
|
3407
3251
|
}
|
|
3408
3252
|
);
|
|
3409
3253
|
}
|
|
3410
|
-
return /* @__PURE__ */ (0,
|
|
3411
|
-
};
|
|
3412
|
-
|
|
3413
|
-
// ../renderers/src/NewListItem/shouldUseAvatar.ts
|
|
3414
|
-
var shouldUseAvatar = (control, tags) => {
|
|
3415
|
-
var _a;
|
|
3416
|
-
return control === "with-avatar" || ((_a = tags == null ? void 0 : tags.includes("with-avatar")) != null ? _a : false);
|
|
3417
|
-
};
|
|
3418
|
-
|
|
3419
|
-
// ../renderers/src/NewListItem/NewDecisionRenderer.tsx
|
|
3420
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3421
|
-
var DecisionRenderer2 = {
|
|
3422
|
-
canRenderType: "decision",
|
|
3423
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
|
|
3424
|
-
};
|
|
3425
|
-
var renderDecisionList2 = ({ options, control }) => {
|
|
3426
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_jsx_runtime77.Fragment, { children: options.map((_a) => {
|
|
3427
|
-
var _b = _a, { disabled, onClick } = _b, rest = __objRest(_b, ["disabled", "onClick"]);
|
|
3428
|
-
const {
|
|
3429
|
-
description,
|
|
3430
|
-
media,
|
|
3431
|
-
title: itemTitle,
|
|
3432
|
-
href,
|
|
3433
|
-
additionalText,
|
|
3434
|
-
inlineAlert,
|
|
3435
|
-
supportingValues,
|
|
3436
|
-
tags
|
|
3437
|
-
} = rest;
|
|
3438
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3439
|
-
import_components54.ListItem,
|
|
3440
|
-
{
|
|
3441
|
-
title: itemTitle,
|
|
3442
|
-
subtitle: description,
|
|
3443
|
-
spotlight: control === "spotlight" ? (tags == null ? void 0 : tags.includes("spotlight-active")) ? "active" : "inactive" : void 0,
|
|
3444
|
-
disabled,
|
|
3445
|
-
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3446
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3447
|
-
media: getMedia(media, shouldUseAvatar(control, tags)),
|
|
3448
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3449
|
-
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
3450
|
-
control: href ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components54.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components54.ListItem.Navigation, { onClick })
|
|
3451
|
-
},
|
|
3452
|
-
JSON.stringify(rest)
|
|
3453
|
-
);
|
|
3454
|
-
}) });
|
|
3254
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components50.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
3455
3255
|
};
|
|
3456
|
-
var NewDecisionRenderer_default = DecisionRenderer2;
|
|
3457
3256
|
|
|
3458
|
-
// ../renderers/src/
|
|
3459
|
-
var
|
|
3460
|
-
|
|
3461
|
-
// ../renderers/src/NewListItem/getCTAControl.tsx
|
|
3462
|
-
var import_components55 = require("@transferwise/components");
|
|
3463
|
-
var import_jsx_runtime78 = 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");
|
|
3464
3260
|
var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
3465
3261
|
if (!callToAction) {
|
|
3466
3262
|
return void 0;
|
|
@@ -3468,8 +3264,8 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3468
3264
|
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
3469
3265
|
const priority = ctaSecondary ? "secondary" : "secondary-neutral";
|
|
3470
3266
|
if (href) {
|
|
3471
|
-
return /* @__PURE__ */ (0,
|
|
3472
|
-
|
|
3267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3268
|
+
import_components51.ListItem.Button,
|
|
3473
3269
|
{
|
|
3474
3270
|
href,
|
|
3475
3271
|
partiallyInteractive: !fullyInteractive,
|
|
@@ -3479,8 +3275,8 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3479
3275
|
}
|
|
3480
3276
|
);
|
|
3481
3277
|
}
|
|
3482
|
-
return /* @__PURE__ */ (0,
|
|
3483
|
-
|
|
3278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
3279
|
+
import_components51.ListItem.Button,
|
|
3484
3280
|
{
|
|
3485
3281
|
"aria-description": accessibilityDescription,
|
|
3486
3282
|
partiallyInteractive: !fullyInteractive,
|
|
@@ -3491,62 +3287,37 @@ var getCTAControl = (callToAction, { ctaSecondary, fullyInteractive }) => {
|
|
|
3491
3287
|
);
|
|
3492
3288
|
};
|
|
3493
3289
|
|
|
3494
|
-
// ../renderers/src/
|
|
3495
|
-
var
|
|
3496
|
-
var
|
|
3497
|
-
|
|
3498
|
-
render: ({ callToAction, control, margin, items, tags, title }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getMargin(margin), children: [
|
|
3499
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Header7, { title, callToAction }),
|
|
3500
|
-
items.map((item) => {
|
|
3501
|
-
var _a, _b;
|
|
3502
|
-
const {
|
|
3503
|
-
title: itemTitle,
|
|
3504
|
-
description,
|
|
3505
|
-
supportingValues,
|
|
3506
|
-
media,
|
|
3507
|
-
additionalInfo,
|
|
3508
|
-
inlineAlert,
|
|
3509
|
-
callToAction: itemCallToAction,
|
|
3510
|
-
tags: itemTags
|
|
3511
|
-
} = item;
|
|
3512
|
-
const controlOptions = {
|
|
3513
|
-
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3514
|
-
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3515
|
-
};
|
|
3516
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3517
|
-
import_components56.ListItem,
|
|
3518
|
-
{
|
|
3519
|
-
title: itemTitle,
|
|
3520
|
-
subtitle: description,
|
|
3521
|
-
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3522
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3523
|
-
media: getMedia(media, shouldUseAvatar(control, itemTags)),
|
|
3524
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3525
|
-
additionalInfo: getAdditionalInfo(additionalInfo),
|
|
3526
|
-
control: getCTAControl(itemCallToAction, controlOptions)
|
|
3527
|
-
},
|
|
3528
|
-
itemTitle
|
|
3529
|
-
);
|
|
3530
|
-
})
|
|
3531
|
-
] })
|
|
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);
|
|
3532
3294
|
};
|
|
3533
|
-
var NewListRenderer_default = ListRenderer2;
|
|
3534
3295
|
|
|
3535
|
-
// ../renderers/src/
|
|
3536
|
-
var
|
|
3537
|
-
var import_icons4 = require("@transferwise/icons");
|
|
3538
|
-
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3296
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
3297
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3539
3298
|
var IGNORED_CONTROLS = [
|
|
3540
3299
|
"horizontal",
|
|
3541
3300
|
"horizontal-end-aligned",
|
|
3542
3301
|
"horizontal-start-aligned",
|
|
3543
3302
|
"vertical-two-column"
|
|
3544
3303
|
];
|
|
3545
|
-
var
|
|
3304
|
+
var ReviewRenderer = {
|
|
3546
3305
|
canRenderType: "review",
|
|
3547
3306
|
canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
|
|
3548
|
-
render: (
|
|
3549
|
-
|
|
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 }),
|
|
3550
3321
|
fields.map((field) => {
|
|
3551
3322
|
var _a, _b, _c;
|
|
3552
3323
|
const {
|
|
@@ -3556,6 +3327,7 @@ var ReviewRenderer2 = {
|
|
|
3556
3327
|
additionalInfo,
|
|
3557
3328
|
inlineAlert,
|
|
3558
3329
|
help,
|
|
3330
|
+
analyticsId,
|
|
3559
3331
|
callToAction: itemCallToAction,
|
|
3560
3332
|
tags: itemTags
|
|
3561
3333
|
} = field;
|
|
@@ -3563,47 +3335,271 @@ var ReviewRenderer2 = {
|
|
|
3563
3335
|
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3564
3336
|
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3565
3337
|
};
|
|
3566
|
-
return /* @__PURE__ */ (0,
|
|
3567
|
-
|
|
3338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
3339
|
+
import_components52.ListItem,
|
|
3568
3340
|
{
|
|
3569
3341
|
title: value,
|
|
3570
3342
|
subtitle: label,
|
|
3571
3343
|
inverted: true,
|
|
3572
3344
|
media: getMedia(media, shouldUseAvatar(control, itemTags)),
|
|
3573
|
-
control: (_c = getCTAControl(itemCallToAction, controlOptions)) != null ? _c : getHelpControl(
|
|
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,
|
|
3574
3350
|
prompt: getInlineAlert(inlineAlert),
|
|
3575
3351
|
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3576
3352
|
},
|
|
3577
3353
|
JSON.stringify(field)
|
|
3578
3354
|
);
|
|
3579
3355
|
})
|
|
3580
|
-
] })
|
|
3356
|
+
] });
|
|
3581
3357
|
};
|
|
3582
|
-
var getHelpControl = (help) => {
|
|
3583
|
-
|
|
3584
|
-
|
|
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, {}) }) });
|
|
3360
|
+
};
|
|
3361
|
+
var ReviewRenderer_default = ReviewRenderer;
|
|
3362
|
+
|
|
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"
|
|
3585
3388
|
}
|
|
3586
|
-
|
|
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)) });
|
|
3587
3461
|
};
|
|
3588
|
-
var NewReviewRenderer_default = ReviewRenderer2;
|
|
3589
3462
|
|
|
3590
|
-
// ../renderers/src/
|
|
3591
|
-
var
|
|
3592
|
-
var
|
|
3593
|
-
|
|
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;
|
|
3553
|
+
const {
|
|
3554
|
+
title: itemTitle,
|
|
3555
|
+
description,
|
|
3556
|
+
supportingValues,
|
|
3557
|
+
media,
|
|
3558
|
+
additionalInfo,
|
|
3559
|
+
inlineAlert,
|
|
3560
|
+
callToAction: itemCallToAction,
|
|
3561
|
+
tags: itemTags
|
|
3562
|
+
} = item;
|
|
3563
|
+
const controlOptions = {
|
|
3564
|
+
ctaSecondary: (_a = itemTags == null ? void 0 : itemTags.includes("cta-secondary")) != null ? _a : false,
|
|
3565
|
+
fullyInteractive: (_b = (tags == null ? void 0 : tags.includes("fully-interactive")) && (additionalInfo == null ? void 0 : additionalInfo.onClick) == null) != null ? _b : false
|
|
3566
|
+
};
|
|
3567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3568
|
+
import_components56.ListItem,
|
|
3569
|
+
{
|
|
3570
|
+
title: itemTitle,
|
|
3571
|
+
subtitle: description,
|
|
3572
|
+
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3573
|
+
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3574
|
+
media: getMedia(media, shouldUseAvatar(control, itemTags)),
|
|
3575
|
+
prompt: getInlineAlert(inlineAlert),
|
|
3576
|
+
additionalInfo: getAdditionalInfo(additionalInfo),
|
|
3577
|
+
control: getCTAControl(itemCallToAction, controlOptions)
|
|
3578
|
+
},
|
|
3579
|
+
itemTitle
|
|
3580
|
+
);
|
|
3581
|
+
})
|
|
3582
|
+
] })
|
|
3583
|
+
};
|
|
3584
|
+
var ListRenderer_default = ListRenderer;
|
|
3585
|
+
|
|
3586
|
+
// ../renderers/src/StatusListRenderer.tsx
|
|
3587
|
+
var import_components57 = require("@transferwise/components");
|
|
3588
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3589
|
+
var StatusListRenderer = {
|
|
3594
3590
|
canRenderType: "status-list",
|
|
3595
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
3596
|
-
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,
|
|
3597
3593
|
items.map((item) => {
|
|
3598
3594
|
const { callToAction, description, icon, status, title: itemTitle } = item;
|
|
3599
|
-
return /* @__PURE__ */ (0,
|
|
3600
|
-
|
|
3595
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3596
|
+
import_components57.ListItem,
|
|
3601
3597
|
{
|
|
3602
3598
|
title: itemTitle,
|
|
3603
3599
|
subtitle: description,
|
|
3604
|
-
media: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
3605
|
-
additionalInfo: callToAction ? /* @__PURE__ */ (0,
|
|
3606
|
-
|
|
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,
|
|
3607
3603
|
{
|
|
3608
3604
|
action: {
|
|
3609
3605
|
href: callToAction.href,
|
|
@@ -3619,7 +3615,7 @@ var NewStatusListRenderer = {
|
|
|
3619
3615
|
})
|
|
3620
3616
|
] })
|
|
3621
3617
|
};
|
|
3622
|
-
var
|
|
3618
|
+
var mapStatus = (status) => {
|
|
3623
3619
|
switch (status) {
|
|
3624
3620
|
case "done":
|
|
3625
3621
|
return "positive";
|
|
@@ -3629,136 +3625,292 @@ var mapStatus2 = (status) => {
|
|
|
3629
3625
|
return void 0;
|
|
3630
3626
|
}
|
|
3631
3627
|
};
|
|
3632
|
-
var
|
|
3628
|
+
var StatusListRenderer_default = StatusListRenderer;
|
|
3633
3629
|
|
|
3634
|
-
// ../renderers/src/
|
|
3635
|
-
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
|
+
};
|
|
3636
3685
|
|
|
3637
|
-
// ../renderers/src/
|
|
3638
|
-
var
|
|
3639
|
-
|
|
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
|
+
];
|
|
3640
3731
|
|
|
3641
|
-
//
|
|
3642
|
-
var
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
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
|
+
}
|
|
3647
3750
|
};
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
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);
|
|
3654
3768
|
}
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
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) });
|
|
3673
3859
|
}
|
|
3674
|
-
|
|
3675
|
-
}
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
},
|
|
3696
|
-
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);
|
|
3697
3881
|
}
|
|
3698
|
-
|
|
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;
|
|
3699
3901
|
}
|
|
3700
3902
|
};
|
|
3701
3903
|
|
|
3702
|
-
//
|
|
3703
|
-
var
|
|
3704
|
-
NewDecisionRenderer_default,
|
|
3705
|
-
NewListRenderer_default,
|
|
3706
|
-
NewReviewRenderer_default,
|
|
3707
|
-
NewStatusListRenderer_default
|
|
3708
|
-
];
|
|
3709
|
-
var getButtonV2Renderers = () => [ButtonRendererV2];
|
|
3710
|
-
var getWiseRenderers = () => [
|
|
3711
|
-
AddressValidationButtonRenderer_default,
|
|
3712
|
-
AlertRenderer_default,
|
|
3713
|
-
CheckboxInputRenderer_default,
|
|
3714
|
-
BoxRenderer_default,
|
|
3715
|
-
ButtonRenderer,
|
|
3716
|
-
ColumnsRenderer_default,
|
|
3717
|
-
DateInputRenderer_default,
|
|
3718
|
-
DecisionRenderer_default,
|
|
3719
|
-
DividerRenderer_default,
|
|
3720
|
-
ExternalConfirmationRenderer_default,
|
|
3721
|
-
FormRenderer_default,
|
|
3722
|
-
FormSectionRenderer_default,
|
|
3723
|
-
HeadingRenderer_default,
|
|
3724
|
-
ImageRenderer_default,
|
|
3725
|
-
InstructionsRenderer_default,
|
|
3726
|
-
IntegerInputRenderer_default,
|
|
3727
|
-
LargeUploadRenderer,
|
|
3728
|
-
ListRenderer_default,
|
|
3729
|
-
LoadingIndicatorRenderer_default,
|
|
3730
|
-
MarkdownRenderer_default,
|
|
3731
|
-
ModalRenderer,
|
|
3732
|
-
ModalLayoutRenderer_default,
|
|
3733
|
-
MoneyInputRenderer,
|
|
3734
|
-
MultiSelectInputRenderer_default,
|
|
3735
|
-
MultiUploadInputRenderer_default,
|
|
3736
|
-
NumberInputRenderer_default,
|
|
3737
|
-
ParagraphRenderer_default,
|
|
3738
|
-
ProgressRenderer,
|
|
3739
|
-
RepeatableRenderer_default,
|
|
3740
|
-
ReviewRenderer_default,
|
|
3741
|
-
SearchRenderer_default,
|
|
3742
|
-
SelectInputRenderer_default,
|
|
3743
|
-
SectionRenderer_default,
|
|
3744
|
-
StatusListRenderer_default,
|
|
3745
|
-
TabsRenderer,
|
|
3746
|
-
TextInputRenderer_default,
|
|
3747
|
-
UploadInputRenderer,
|
|
3748
|
-
SplashStepRenderer,
|
|
3749
|
-
SplashCelebrationStepRenderer,
|
|
3750
|
-
StepRenderer
|
|
3751
|
-
];
|
|
3904
|
+
// src/index.ts
|
|
3905
|
+
var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
3752
3906
|
|
|
3753
3907
|
// src/dynamicFlow/renderers.ts
|
|
3754
|
-
var
|
|
3908
|
+
var Header11 = Header7;
|
|
3755
3909
|
var Media2 = Media;
|
|
3756
3910
|
var getMargin2 = getMargin;
|
|
3757
|
-
var getListItemRenderers2 = getListItemRenderers;
|
|
3758
|
-
var getButtonV2Renderers2 = getButtonV2Renderers;
|
|
3759
3911
|
|
|
3760
3912
|
// src/i18n/index.ts
|
|
3761
|
-
var
|
|
3913
|
+
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
3762
3914
|
|
|
3763
3915
|
// src/i18n/cs.json
|
|
3764
3916
|
var cs_default = {
|
|
@@ -4611,186 +4763,19 @@ var wiseTranslations = {
|
|
|
4611
4763
|
"zh-HK": zh_HK_default
|
|
4612
4764
|
};
|
|
4613
4765
|
var languages = Array.from(
|
|
4614
|
-
/* @__PURE__ */ new Set([...Object.keys(
|
|
4766
|
+
/* @__PURE__ */ new Set([...Object.keys(import_dynamic_flow_client2.translations), ...Object.keys(wiseTranslations)])
|
|
4615
4767
|
);
|
|
4616
4768
|
var translations = languages.reduce(
|
|
4617
|
-
(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]) }),
|
|
4618
4770
|
{}
|
|
4619
4771
|
);
|
|
4620
4772
|
var i18n_default = translations;
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
typeof process !== "undefined" ? "4.37.0" : "0.0.0"
|
|
4631
|
-
);
|
|
4632
|
-
|
|
4633
|
-
// src/dynamicFlow/telemetry/getLogEvent.ts
|
|
4634
|
-
var getLogEvent = (onLog) => (level, message, extra) => {
|
|
4635
|
-
const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
|
|
4636
|
-
dfWiseVersion: appVersion
|
|
4637
|
-
});
|
|
4638
|
-
if (level !== "info" && onLog) {
|
|
4639
|
-
if (onLog) {
|
|
4640
|
-
onLog(level, message, extraWithVersion);
|
|
4641
|
-
} else {
|
|
4642
|
-
logToRollbar(level, message, extraWithVersion);
|
|
4643
|
-
}
|
|
4644
|
-
}
|
|
4645
|
-
};
|
|
4646
|
-
var logToRollbar = (level, message, extra) => {
|
|
4647
|
-
try {
|
|
4648
|
-
const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
|
|
4649
|
-
rollbar == null ? void 0 : rollbar[level](message, extra);
|
|
4650
|
-
} catch (error) {
|
|
4651
|
-
console.error("Failed to log to Rollbar", error);
|
|
4652
|
-
}
|
|
4653
|
-
};
|
|
4654
|
-
|
|
4655
|
-
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
4656
|
-
var import_components_theming2 = require("@wise/components-theming");
|
|
4657
|
-
var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
|
|
4658
|
-
onEvent == null ? void 0 : onEvent(name, properties);
|
|
4659
|
-
if (name.includes(ThemeRequiredEventName)) {
|
|
4660
|
-
const { theme } = properties != null ? properties : { theme: "personal" };
|
|
4661
|
-
if (theme && (0, import_components_theming2.isThemeModern)(theme)) {
|
|
4662
|
-
onThemeChange == null ? void 0 : onThemeChange(theme);
|
|
4663
|
-
}
|
|
4664
|
-
} else {
|
|
4665
|
-
onAnalytics == null ? void 0 : onAnalytics(name, properties);
|
|
4666
|
-
}
|
|
4667
|
-
};
|
|
4668
|
-
|
|
4669
|
-
// src/dynamicFlow/messages.ts
|
|
4670
|
-
var import_react_intl25 = require("react-intl");
|
|
4671
|
-
var messages_default = (0, import_react_intl25.defineMessages)({
|
|
4672
|
-
copied: {
|
|
4673
|
-
id: "df.wise.CopyFeedback.copy",
|
|
4674
|
-
defaultMessage: "Copied to clipboard",
|
|
4675
|
-
description: "Appears in a snackbar when the copy operation succeeds."
|
|
4676
|
-
},
|
|
4677
|
-
copyFailed: {
|
|
4678
|
-
id: "df.wise.CopyFeedback.copyFailed",
|
|
4679
|
-
defaultMessage: "Failed to copy to clipboard",
|
|
4680
|
-
description: "Appears in a snackbar when the copy operation fails."
|
|
4681
|
-
}
|
|
4682
|
-
});
|
|
4683
|
-
|
|
4684
|
-
// src/dynamicFlow/DynamicFlow.tsx
|
|
4685
|
-
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
4686
|
-
var wiseRenderers = getWiseRenderers();
|
|
4687
|
-
function DynamicFlowLegacy(props) {
|
|
4688
|
-
const { customFetch = globalThis.fetch } = props;
|
|
4689
|
-
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient: customFetch });
|
|
4690
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_dynamic_flow_client2.DynamicFlow, __spreadValues({}, coreProps));
|
|
4691
|
-
}
|
|
4692
|
-
function DynamicFlowRevamp(props) {
|
|
4693
|
-
const {
|
|
4694
|
-
className = "",
|
|
4695
|
-
customFetch = globalThis.fetch,
|
|
4696
|
-
renderers,
|
|
4697
|
-
onAnalytics,
|
|
4698
|
-
onEvent,
|
|
4699
|
-
onLog,
|
|
4700
|
-
onLink = openLinkInNewTab,
|
|
4701
|
-
onThemeChange
|
|
4702
|
-
} = props;
|
|
4703
|
-
const { formatMessage } = (0, import_react_intl26.useIntl)();
|
|
4704
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
4705
|
-
const httpClient = useWiseHttpClient(customFetch);
|
|
4706
|
-
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
4707
|
-
const logEvent = (0, import_react20.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
4708
|
-
const trackEvent = (0, import_react20.useMemo)(
|
|
4709
|
-
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4710
|
-
[onEvent, onAnalytics, onThemeChange]
|
|
4711
|
-
);
|
|
4712
|
-
const onCopy = (copiedContent) => {
|
|
4713
|
-
if (copiedContent) {
|
|
4714
|
-
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
4715
|
-
} else {
|
|
4716
|
-
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
4717
|
-
}
|
|
4718
|
-
};
|
|
4719
|
-
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
4720
|
-
httpClient,
|
|
4721
|
-
renderers: mergedRenderers,
|
|
4722
|
-
onEvent: trackEvent,
|
|
4723
|
-
onLog: logEvent,
|
|
4724
|
-
onLink,
|
|
4725
|
-
onCopy
|
|
4726
|
-
});
|
|
4727
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_dynamic_flow_client2.DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
|
|
4728
|
-
}
|
|
4729
|
-
var DynamicForm = (0, import_react20.forwardRef)(function DynamicForm2(props, ref) {
|
|
4730
|
-
const {
|
|
4731
|
-
className = "",
|
|
4732
|
-
customFetch = globalThis.fetch,
|
|
4733
|
-
renderers,
|
|
4734
|
-
onAnalytics,
|
|
4735
|
-
onEvent,
|
|
4736
|
-
onLog,
|
|
4737
|
-
onLink = openLinkInNewTab,
|
|
4738
|
-
onThemeChange
|
|
4739
|
-
} = props;
|
|
4740
|
-
const { formatMessage } = (0, import_react_intl26.useIntl)();
|
|
4741
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
4742
|
-
const httpClient = useWiseHttpClient(customFetch);
|
|
4743
|
-
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
4744
|
-
const logEvent = (0, import_react20.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
4745
|
-
const trackEvent = (0, import_react20.useMemo)(
|
|
4746
|
-
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4747
|
-
[onEvent, onAnalytics, onThemeChange]
|
|
4748
|
-
);
|
|
4749
|
-
const onCopy = (copiedContent) => {
|
|
4750
|
-
if (copiedContent) {
|
|
4751
|
-
createSnackBar({ text: formatMessage(messages_default.copied) });
|
|
4752
|
-
} else {
|
|
4753
|
-
createSnackBar({ text: formatMessage(messages_default.copyFailed) });
|
|
4754
|
-
}
|
|
4755
|
-
};
|
|
4756
|
-
const coreProps = __spreadProps(__spreadValues({}, props), {
|
|
4757
|
-
httpClient,
|
|
4758
|
-
renderers: mergedRenderers,
|
|
4759
|
-
onEvent: trackEvent,
|
|
4760
|
-
onLog: logEvent,
|
|
4761
|
-
onLink,
|
|
4762
|
-
onCopy
|
|
4763
|
-
});
|
|
4764
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_dynamic_flow_client2.DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
|
|
4765
|
-
});
|
|
4766
|
-
var useWiseHttpClient = (httpClient) => {
|
|
4767
|
-
const { locale } = (0, import_react_intl26.useIntl)();
|
|
4768
|
-
return (0, import_react20.useCallback)(
|
|
4769
|
-
async (input, init = {}) => {
|
|
4770
|
-
const headers = new Headers(init.headers);
|
|
4771
|
-
headers.set("accept-language", locale);
|
|
4772
|
-
const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone || void 0;
|
|
4773
|
-
if (timeZone) {
|
|
4774
|
-
headers.set("time-zone", timeZone);
|
|
4775
|
-
}
|
|
4776
|
-
const requestInit = __spreadProps(__spreadValues({}, init), { credentials: "include", headers });
|
|
4777
|
-
return httpClient(input, requestInit).catch(handleRejection);
|
|
4778
|
-
},
|
|
4779
|
-
[httpClient, locale]
|
|
4780
|
-
);
|
|
4781
|
-
};
|
|
4782
|
-
var handleRejection = (error) => {
|
|
4783
|
-
if (error instanceof Error && error.message === "SCA_MODAL_CLOSED") {
|
|
4784
|
-
return new Response(JSON.stringify({ validation: {} }), { status: 400 });
|
|
4785
|
-
}
|
|
4786
|
-
throw error;
|
|
4787
|
-
};
|
|
4788
|
-
var openLinkInNewTab = (url) => {
|
|
4789
|
-
var _a;
|
|
4790
|
-
try {
|
|
4791
|
-
const w = (_a = window == null ? void 0 : window.open) == null ? void 0 : _a.call(window, url, "_blank");
|
|
4792
|
-
return Boolean(w);
|
|
4793
|
-
} catch (e) {
|
|
4794
|
-
return false;
|
|
4795
|
-
}
|
|
4796
|
-
};
|
|
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
|
+
*/
|