@wise/dynamic-flow-client-internal 4.26.0 → 4.27.0-experimental-renderer-utils-876fd4f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/i18n/hu.json +1 -1
- package/build/i18n/nl.json +1 -1
- package/build/main.js +58 -3520
- package/build/main.mjs +33 -3489
- package/build/types/index.d.ts +1 -1
- package/package.json +17 -16
- package/build/types/dynamicFlow/renderers.d.ts +0 -7
package/build/main.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __defProps = Object.defineProperties;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
7
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
9
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
10
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
9
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
10
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -22,3502 +20,40 @@ var __spreadValues = (a, b) => {
|
|
|
22
20
|
return a;
|
|
23
21
|
};
|
|
24
22
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __export = (target, all) => {
|
|
38
|
-
for (var name in all)
|
|
39
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
40
|
-
};
|
|
41
|
-
var __copyProps = (to, from, except, desc) => {
|
|
42
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
43
|
-
for (let key of __getOwnPropNames(from))
|
|
44
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
45
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
46
|
-
}
|
|
47
|
-
return to;
|
|
48
|
-
};
|
|
49
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
50
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
51
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
52
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
53
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
54
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
55
|
-
mod
|
|
56
|
-
));
|
|
57
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
58
|
-
|
|
59
|
-
// src/index.ts
|
|
60
|
-
var index_exports = {};
|
|
61
|
-
__export(index_exports, {
|
|
62
|
-
DynamicFlowLegacy: () => DynamicFlowLegacy,
|
|
63
|
-
DynamicFlowRevamp: () => DynamicFlowRevamp,
|
|
64
|
-
DynamicForm: () => DynamicForm,
|
|
65
|
-
Header: () => Header11,
|
|
66
|
-
JsonSchemaForm: () => import_dynamic_flow_client4.JsonSchemaForm,
|
|
67
|
-
findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
|
|
68
|
-
getButtonV2Renderers: () => getButtonV2Renderers2,
|
|
69
|
-
getListItemRenderers: () => getListItemRenderers2,
|
|
70
|
-
getMargin: () => getMargin2,
|
|
71
|
-
isValidSchema: () => import_dynamic_flow_client4.isValidSchema,
|
|
72
|
-
makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
|
|
73
|
-
translations: () => i18n_default
|
|
74
|
-
});
|
|
75
|
-
module.exports = __toCommonJS(index_exports);
|
|
76
|
-
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
77
|
-
var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
78
|
-
|
|
79
|
-
// ../renderers/src/AlertRenderer.tsx
|
|
80
|
-
var import_components = require("@transferwise/components");
|
|
81
|
-
|
|
82
|
-
// ../renderers/src/utils/layout-utils.ts
|
|
83
|
-
var getMargin = (size) => {
|
|
84
|
-
switch (size) {
|
|
85
|
-
case "xs":
|
|
86
|
-
return "m-b-0";
|
|
87
|
-
case "sm":
|
|
88
|
-
return "m-b-1";
|
|
89
|
-
case "md":
|
|
90
|
-
return "m-b-2";
|
|
91
|
-
case "lg":
|
|
92
|
-
return "m-b-3";
|
|
93
|
-
case "xl":
|
|
94
|
-
return "m-b-5";
|
|
95
|
-
default:
|
|
96
|
-
return "";
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
var getTextAlignment = (align) => {
|
|
100
|
-
switch (align) {
|
|
101
|
-
case "end":
|
|
102
|
-
return "text-xs-right";
|
|
103
|
-
case "center":
|
|
104
|
-
return "text-xs-center";
|
|
105
|
-
case "start":
|
|
106
|
-
default:
|
|
107
|
-
return "";
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMargin(component.margin)}`;
|
|
111
|
-
|
|
112
|
-
// ../renderers/src/AlertRenderer.tsx
|
|
113
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
114
|
-
var AlertRenderer = {
|
|
115
|
-
canRenderType: "alert",
|
|
116
|
-
render: ({ context, markdown, margin, callToAction }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
-
import_components.Alert,
|
|
118
|
-
{
|
|
119
|
-
type: context,
|
|
120
|
-
className: getMargin(margin),
|
|
121
|
-
message: markdown,
|
|
122
|
-
action: mapCtaToAlertAction(callToAction)
|
|
123
|
-
}
|
|
124
|
-
)
|
|
125
|
-
};
|
|
126
|
-
var mapCtaToAlertAction = (callToAction) => {
|
|
127
|
-
if (callToAction) {
|
|
128
|
-
return __spreadValues(__spreadValues({
|
|
129
|
-
text: callToAction.title,
|
|
130
|
-
"aria-label": callToAction.accessibilityDescription
|
|
131
|
-
}, "onClick" in callToAction ? { onClick: callToAction.onClick } : {}), callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
132
|
-
}
|
|
133
|
-
return void 0;
|
|
134
|
-
};
|
|
135
|
-
var AlertRenderer_default = AlertRenderer;
|
|
136
|
-
|
|
137
|
-
// ../renderers/src/BoxRenderer.tsx
|
|
138
|
-
var import_classnames = __toESM(require("classnames"));
|
|
139
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
140
|
-
var BoxRenderer = {
|
|
141
|
-
canRenderType: "box",
|
|
142
|
-
render: ({ children, control, margin, width }) => {
|
|
143
|
-
const hasFixedWidth = width !== "xl";
|
|
144
|
-
const hasBorder = control === "bordered" || control === "bordered-web";
|
|
145
|
-
const contents = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
146
|
-
"div",
|
|
147
|
-
{
|
|
148
|
-
className: (0, import_classnames.default)({
|
|
149
|
-
"df-box-renderer-border": hasBorder,
|
|
150
|
-
[`df-box-renderer-width-${width}`]: hasFixedWidth,
|
|
151
|
-
[getMargin(margin)]: !hasFixedWidth
|
|
152
|
-
}),
|
|
153
|
-
children
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
return hasFixedWidth ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
var BoxRenderer_default = BoxRenderer;
|
|
160
|
-
|
|
161
|
-
// ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
|
|
162
|
-
var import_components2 = require("@transferwise/components");
|
|
163
|
-
var import_react_intl2 = require("react-intl");
|
|
164
|
-
|
|
165
|
-
// ../renderers/src/messages/loading-button.messages.ts
|
|
166
|
-
var import_react_intl = require("react-intl");
|
|
167
|
-
var loading_button_messages_default = (0, import_react_intl.defineMessages)({
|
|
168
|
-
buttonLoadingMessage: {
|
|
169
|
-
id: "df.wise.ButtonLayout.buttonLoadingMessage",
|
|
170
|
-
defaultMessage: "This might take a few seconds",
|
|
171
|
-
description: "Message displayed below a button when it is in a loading state."
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
|
|
176
|
-
var import_react = require("react");
|
|
177
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
178
|
-
var AddressValidationButtonRenderer = {
|
|
179
|
-
canRenderType: "button",
|
|
180
|
-
canRender: ({ control }) => control === "address-validation",
|
|
181
|
-
render: AddressValidationButtonComponent
|
|
182
|
-
};
|
|
183
|
-
function AddressValidationButtonComponent(props) {
|
|
184
|
-
const { disabled, margin, title, stepLoadingState, onClick } = props;
|
|
185
|
-
const { formatMessage } = (0, import_react_intl2.useIntl)();
|
|
186
|
-
const [spinny, setSpinny] = (0, import_react.useState)(false);
|
|
187
|
-
(0, import_react.useEffect)(() => {
|
|
188
|
-
if (stepLoadingState === "idle") {
|
|
189
|
-
setSpinny(false);
|
|
190
|
-
}
|
|
191
|
-
}, [stepLoadingState]);
|
|
192
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
|
|
193
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
194
|
-
import_components2.Button,
|
|
195
|
-
{
|
|
196
|
-
v2: true,
|
|
197
|
-
block: true,
|
|
198
|
-
disabled,
|
|
199
|
-
priority: "primary",
|
|
200
|
-
size: "md",
|
|
201
|
-
loading: spinny,
|
|
202
|
-
onClick: () => {
|
|
203
|
-
setSpinny(true);
|
|
204
|
-
onClick();
|
|
205
|
-
},
|
|
206
|
-
children: title
|
|
207
|
-
}
|
|
208
|
-
),
|
|
209
|
-
spinny && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_components2.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
|
|
210
|
-
] });
|
|
211
|
-
}
|
|
212
|
-
var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
|
|
213
|
-
|
|
214
|
-
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
215
|
-
var import_components3 = require("@transferwise/components");
|
|
216
|
-
var import_react2 = require("react");
|
|
217
|
-
|
|
218
|
-
// ../renderers/src/ButtonRenderer/mapButtonSize.tsx
|
|
219
|
-
var mapButtonSize = (size) => {
|
|
220
|
-
if (!size) {
|
|
221
|
-
return void 0;
|
|
222
|
-
}
|
|
223
|
-
switch (size) {
|
|
224
|
-
case "xs":
|
|
225
|
-
case "sm":
|
|
226
|
-
return "sm";
|
|
227
|
-
case "lg":
|
|
228
|
-
case "xl":
|
|
229
|
-
return "lg";
|
|
230
|
-
case "md":
|
|
231
|
-
default:
|
|
232
|
-
return "md";
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
|
|
236
|
-
// ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
|
|
237
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
238
|
-
var ButtonRenderer = {
|
|
239
|
-
canRenderType: "button",
|
|
240
|
-
render: ButtonComponent
|
|
241
|
-
};
|
|
242
|
-
function ButtonComponent(props) {
|
|
243
|
-
const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
|
|
244
|
-
const [spinny, setSpinny] = (0, import_react2.useState)(false);
|
|
245
|
-
(0, import_react2.useEffect)(() => {
|
|
246
|
-
if (stepLoadingState === "idle") {
|
|
247
|
-
setSpinny(false);
|
|
248
|
-
}
|
|
249
|
-
}, [stepLoadingState]);
|
|
250
|
-
const priority = getPriority(control);
|
|
251
|
-
const type = getButtonType(context, priority);
|
|
252
|
-
const loading = spinny && stepLoadingState !== "idle";
|
|
253
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
254
|
-
import_components3.Button,
|
|
255
|
-
{
|
|
256
|
-
block: true,
|
|
257
|
-
className: getMargin(margin),
|
|
258
|
-
disabled,
|
|
259
|
-
priority,
|
|
260
|
-
size: mapButtonSize(size),
|
|
261
|
-
loading,
|
|
262
|
-
type,
|
|
263
|
-
onClick: () => {
|
|
264
|
-
setSpinny(true);
|
|
265
|
-
onClick();
|
|
266
|
-
},
|
|
267
|
-
children: title
|
|
268
|
-
}
|
|
269
|
-
);
|
|
270
|
-
}
|
|
271
|
-
var getPriority = (control) => {
|
|
272
|
-
switch (control) {
|
|
273
|
-
case "primary":
|
|
274
|
-
case "tertiary":
|
|
275
|
-
return control;
|
|
276
|
-
default:
|
|
277
|
-
return "secondary";
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
var getButtonType = (context, priority) => {
|
|
281
|
-
if (priority === "tertiary") {
|
|
282
|
-
return void 0;
|
|
283
|
-
}
|
|
284
|
-
switch (context) {
|
|
285
|
-
case "neutral":
|
|
286
|
-
case "warning":
|
|
287
|
-
return "accent";
|
|
288
|
-
default:
|
|
289
|
-
return context;
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
|
|
293
|
-
// ../renderers/src/components/FieldInput.tsx
|
|
294
|
-
var import_components5 = require("@transferwise/components");
|
|
295
|
-
|
|
296
|
-
// ../renderers/src/components/Help.tsx
|
|
297
|
-
var import_components4 = require("@transferwise/components");
|
|
298
|
-
var import_react_intl4 = require("react-intl");
|
|
299
|
-
|
|
300
|
-
// ../renderers/src/messages/help.messages.ts
|
|
301
|
-
var import_react_intl3 = require("react-intl");
|
|
302
|
-
var help_messages_default = (0, import_react_intl3.defineMessages)({
|
|
303
|
-
helpAria: {
|
|
304
|
-
id: "df.wise.Help.ariaLabel",
|
|
305
|
-
defaultMessage: "Click here for more info.",
|
|
306
|
-
description: "Aria label for help."
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
// ../renderers/src/components/Help.tsx
|
|
311
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
312
|
-
function Help({ help, onClick }) {
|
|
313
|
-
const intl = (0, import_react_intl4.useIntl)();
|
|
314
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
315
|
-
import_components4.Info,
|
|
316
|
-
{
|
|
317
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components4.Markdown, { config: { link: { target: "_blank" } }, children: help }),
|
|
318
|
-
presentation: "POPOVER",
|
|
319
|
-
size: "sm",
|
|
320
|
-
"aria-label": intl.formatMessage(help_messages_default.helpAria),
|
|
321
|
-
onClick
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
}
|
|
325
|
-
var Help_default = Help;
|
|
326
|
-
|
|
327
|
-
// ../renderers/src/components/LabelContentWithHelp.tsx
|
|
328
|
-
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
329
|
-
function LabelContentWithHelp({ text, help }) {
|
|
330
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
331
|
-
text,
|
|
332
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Help_default, { help })
|
|
333
|
-
] });
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
// ../renderers/src/components/FieldInput.tsx
|
|
337
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
338
|
-
function FieldInput({ id, children, label, validation, description, help }) {
|
|
339
|
-
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
341
|
-
import_components5.Field,
|
|
342
|
-
{
|
|
343
|
-
id,
|
|
344
|
-
label: labelContent,
|
|
345
|
-
description,
|
|
346
|
-
message: validation == null ? void 0 : validation.message,
|
|
347
|
-
sentiment: mapStatusToSentiment(validation),
|
|
348
|
-
children
|
|
349
|
-
}
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
var mapStatusToSentiment = (validation) => {
|
|
353
|
-
if (validation) {
|
|
354
|
-
if (validation.status === "valid") {
|
|
355
|
-
return "positive";
|
|
356
|
-
}
|
|
357
|
-
return "negative";
|
|
358
|
-
}
|
|
359
|
-
return void 0;
|
|
360
|
-
};
|
|
361
|
-
var FieldInput_default = FieldInput;
|
|
362
|
-
|
|
363
|
-
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
364
|
-
var import_components6 = require("@transferwise/components");
|
|
365
|
-
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
366
|
-
var CheckboxInputRenderer = {
|
|
367
|
-
canRenderType: "input-checkbox",
|
|
368
|
-
render: (props) => {
|
|
369
|
-
const _a = props, {
|
|
370
|
-
id,
|
|
371
|
-
control,
|
|
372
|
-
title = "",
|
|
373
|
-
description,
|
|
374
|
-
help,
|
|
375
|
-
type,
|
|
376
|
-
validationState,
|
|
377
|
-
value
|
|
378
|
-
} = _a, rest = __objRest(_a, [
|
|
379
|
-
"id",
|
|
380
|
-
"control",
|
|
381
|
-
"title",
|
|
382
|
-
"description",
|
|
383
|
-
"help",
|
|
384
|
-
"type",
|
|
385
|
-
"validationState",
|
|
386
|
-
"value"
|
|
387
|
-
]);
|
|
388
|
-
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components6.Checkbox, __spreadValues({ id }, checkboxProps)) });
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
393
|
-
|
|
394
|
-
// ../renderers/src/ColumnsRenderer.tsx
|
|
395
|
-
var import_classnames2 = __toESM(require("classnames"));
|
|
396
|
-
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
397
|
-
var ColumnsRenderer = {
|
|
398
|
-
canRenderType: "columns",
|
|
399
|
-
render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
400
|
-
"div",
|
|
401
|
-
{
|
|
402
|
-
className: (0, import_classnames2.default)("df-columns-renderer-container", getMargin(margin), {
|
|
403
|
-
"df-columns-renderer-bias-start": bias === "start",
|
|
404
|
-
"df-columns-renderer-bias-end": bias === "end"
|
|
405
|
-
}),
|
|
406
|
-
children: [
|
|
407
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "df-columns-renderer-column", children: startChildren }),
|
|
408
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "df-columns-renderer-column", children: endChildren })
|
|
409
|
-
]
|
|
410
|
-
}
|
|
411
|
-
)
|
|
412
|
-
};
|
|
413
|
-
var ColumnsRenderer_default = ColumnsRenderer;
|
|
414
|
-
|
|
415
|
-
// ../renderers/src/components/VariableDateInput.tsx
|
|
416
|
-
var import_components7 = require("@transferwise/components");
|
|
417
|
-
|
|
418
|
-
// ../renderers/src/validators/type-validators.ts
|
|
419
|
-
var isNumber = (value) => typeof value === "number" && !Number.isNaN(value);
|
|
420
|
-
|
|
421
|
-
// ../renderers/src/utils/value-utils.ts
|
|
422
|
-
var dateStringToDateOrNull = (dateString) => {
|
|
423
|
-
if (!dateString) {
|
|
424
|
-
return null;
|
|
425
|
-
}
|
|
426
|
-
const [year, month, date] = dateString.split("-").map((number) => Number.parseInt(number, 10));
|
|
427
|
-
if (!isNumber(year) || !isNumber(month) || !isNumber(date)) {
|
|
428
|
-
return null;
|
|
429
|
-
}
|
|
430
|
-
return new Date(year, month - 1, date);
|
|
431
|
-
};
|
|
432
|
-
var dateToDateString = (date) => {
|
|
433
|
-
const d = new Date(date);
|
|
434
|
-
const month = String(d.getMonth() + 1);
|
|
435
|
-
const day = String(d.getDate());
|
|
436
|
-
const year = d.getFullYear();
|
|
437
|
-
const formattedMonth = month.length < 2 ? `0${month}` : month;
|
|
438
|
-
const formattedDay = day.length < 2 ? `0${day}` : day;
|
|
439
|
-
return [year, formattedMonth, formattedDay].join("-");
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
// ../renderers/src/components/VariableDateInput.tsx
|
|
443
|
-
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
444
|
-
function VariableDateInput({
|
|
445
|
-
control,
|
|
446
|
-
inputProps
|
|
447
|
-
}) {
|
|
448
|
-
const {
|
|
449
|
-
autoComplete,
|
|
450
|
-
minimumDate,
|
|
451
|
-
maximumDate,
|
|
452
|
-
placeholder,
|
|
453
|
-
disabled,
|
|
454
|
-
onBlur,
|
|
455
|
-
onChange,
|
|
456
|
-
onFocus
|
|
457
|
-
} = inputProps;
|
|
458
|
-
if (control === "date-lookup") {
|
|
459
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
460
|
-
import_components7.DateLookup,
|
|
461
|
-
{
|
|
462
|
-
value: dateStringToDateOrNull(inputProps.value),
|
|
463
|
-
min: dateStringToDateOrNull(minimumDate),
|
|
464
|
-
max: dateStringToDateOrNull(maximumDate),
|
|
465
|
-
placeholder,
|
|
466
|
-
disabled,
|
|
467
|
-
onChange: (date) => {
|
|
468
|
-
onChange(date !== null ? dateToDateString(date) : null);
|
|
469
|
-
},
|
|
470
|
-
onBlur,
|
|
471
|
-
onFocus
|
|
472
|
-
}
|
|
473
|
-
);
|
|
474
|
-
}
|
|
475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
476
|
-
import_components7.DateInput,
|
|
477
|
-
__spreadProps(__spreadValues({}, inputProps), {
|
|
478
|
-
dayAutoComplete: getAutocompleteString(autoComplete, "day"),
|
|
479
|
-
yearAutoComplete: getAutocompleteString(autoComplete, "year")
|
|
480
|
-
})
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
|
-
var getAutocompleteString = (value, suffix) => {
|
|
484
|
-
if (value === "bday") {
|
|
485
|
-
return `${value}-${suffix}`;
|
|
486
|
-
}
|
|
487
|
-
return void 0;
|
|
488
|
-
};
|
|
489
|
-
var VariableDateInput_default = VariableDateInput;
|
|
490
|
-
|
|
491
|
-
// ../renderers/src/DateInputRenderer.tsx
|
|
492
|
-
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
493
|
-
var DateInputRenderer = {
|
|
494
|
-
canRenderType: "input-date",
|
|
495
|
-
render: (props) => {
|
|
496
|
-
const _a = props, {
|
|
497
|
-
id,
|
|
498
|
-
control,
|
|
499
|
-
description,
|
|
500
|
-
type,
|
|
501
|
-
help,
|
|
502
|
-
title,
|
|
503
|
-
validationState,
|
|
504
|
-
value: initialValue
|
|
505
|
-
} = _a, rest = __objRest(_a, [
|
|
506
|
-
"id",
|
|
507
|
-
"control",
|
|
508
|
-
"description",
|
|
509
|
-
"type",
|
|
510
|
-
"help",
|
|
511
|
-
"title",
|
|
512
|
-
"validationState",
|
|
513
|
-
"value"
|
|
514
|
-
]);
|
|
515
|
-
const value = initialValue != null ? initialValue : "";
|
|
516
|
-
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
517
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
518
|
-
FieldInput_default,
|
|
519
|
-
{
|
|
520
|
-
id,
|
|
521
|
-
label: title,
|
|
522
|
-
description,
|
|
523
|
-
validation: validationState,
|
|
524
|
-
help,
|
|
525
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(VariableDateInput_default, { control, inputProps })
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
};
|
|
530
|
-
var DateInputRenderer_default = DateInputRenderer;
|
|
531
|
-
|
|
532
|
-
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
533
|
-
var import_components13 = require("@transferwise/components");
|
|
534
|
-
|
|
535
|
-
// ../renderers/src/utils/UrnFlag.tsx
|
|
536
|
-
var import_art = require("@wise/art");
|
|
537
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
538
|
-
var countryUrnPrefix = "urn:wise:countries:";
|
|
539
|
-
var currencyUrnPrefix = "urn:wise:currencies:";
|
|
540
|
-
var isUrnFlag = (uri) => uri.startsWith(countryUrnPrefix) || uri.startsWith(currencyUrnPrefix);
|
|
541
|
-
function UrnFlag({ size, urn }) {
|
|
542
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_art.Flag, { code: getCode(urn), intrinsicSize: size });
|
|
543
|
-
}
|
|
544
|
-
var getCode = (urn) => {
|
|
545
|
-
return urn.replace(countryUrnPrefix, "").replace(currencyUrnPrefix, "").replace(":image", "").split("?")[0];
|
|
546
|
-
};
|
|
547
|
-
|
|
548
|
-
// ../renderers/src/components/icon/FlagIcon.tsx
|
|
549
|
-
var import_art2 = require("@wise/art");
|
|
550
|
-
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
551
|
-
var isFlagIcon = (name) => name.startsWith("flag-");
|
|
552
|
-
function FlagIcon({ name }) {
|
|
553
|
-
if (!isFlagIcon(name)) {
|
|
554
|
-
return null;
|
|
555
|
-
}
|
|
556
|
-
const code = name.substring(5);
|
|
557
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_art2.Flag, { code, intrinsicSize: 24 });
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
// ../renderers/src/components/icon/NamedIcon.tsx
|
|
561
|
-
var icons = __toESM(require("@transferwise/icons"));
|
|
562
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
563
|
-
var isNamedIcon = (name) => {
|
|
564
|
-
const iconName = toCapitalisedCamelCase(name);
|
|
565
|
-
return Object.keys(icons).includes(iconName);
|
|
566
|
-
};
|
|
567
|
-
function NamedIcon({ name }) {
|
|
568
|
-
if (!isNamedIcon(name)) {
|
|
569
|
-
return null;
|
|
570
|
-
}
|
|
571
|
-
const iconName = toCapitalisedCamelCase(name);
|
|
572
|
-
const Icon = icons[iconName];
|
|
573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { size: 24 });
|
|
574
|
-
}
|
|
575
|
-
var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
|
|
576
|
-
var capitaliseFirstChar = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
577
|
-
|
|
578
|
-
// ../renderers/src/components/icon/DynamicIcon.tsx
|
|
579
|
-
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
580
|
-
function DynamicIcon({ name }) {
|
|
581
|
-
if (isFlagIcon(name)) {
|
|
582
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FlagIcon, { name });
|
|
583
|
-
}
|
|
584
|
-
if (isNamedIcon(name)) {
|
|
585
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NamedIcon, { name });
|
|
586
|
-
}
|
|
587
|
-
return null;
|
|
588
|
-
}
|
|
589
|
-
function isValidIconName(name) {
|
|
590
|
-
return isNamedIcon(name) || isFlagIcon(name);
|
|
591
|
-
}
|
|
592
|
-
function isValidIconUrn(uri) {
|
|
593
|
-
if (!uri.startsWith("urn:wise:icons:")) {
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
|
-
const name = uri.replace("urn:wise:icons:", "").split("?")[0];
|
|
597
|
-
return isValidIconName(name);
|
|
598
|
-
}
|
|
599
|
-
var DynamicIcon_default = DynamicIcon;
|
|
600
|
-
|
|
601
|
-
// ../renderers/src/components/Media/stringToURN.ts
|
|
602
|
-
var stringToURN = (uri) => {
|
|
603
|
-
var _a, _b, _c;
|
|
604
|
-
const [nameWithRQComponents, _] = uri.split("#");
|
|
605
|
-
const [nameWithRComponent, qComponent] = nameWithRQComponents.split("?=");
|
|
606
|
-
const [name, rComponent] = (_a = nameWithRComponent == null ? void 0 : nameWithRComponent.split("?+")) != null ? _a : ["", ""];
|
|
607
|
-
const rComponents = rComponent ? (_b = decodeURIComponent(rComponent)) == null ? void 0 : _b.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
|
|
608
|
-
const qComponents = qComponent ? (_c = decodeURIComponent(qComponent)) == null ? void 0 : _c.split("&").map((c) => c.split("=")).map(([a, b]) => [a, b]) : void 0;
|
|
609
|
-
return {
|
|
610
|
-
name,
|
|
611
|
-
rComponents,
|
|
612
|
-
qComponents
|
|
613
|
-
};
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
// ../renderers/src/components/Media/resolveMediaFromUri.tsx
|
|
617
|
-
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
618
|
-
var resolveMediaFromUri = (uri, size) => {
|
|
619
|
-
var _a, _b;
|
|
620
|
-
const { name, qComponents = [] } = stringToURN(uri);
|
|
621
|
-
if (isValidIconUrn(name)) {
|
|
622
|
-
const icon = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DynamicIcon_default, { name: name.replace("urn:wise:icons:", "") });
|
|
623
|
-
return {
|
|
624
|
-
icon,
|
|
625
|
-
backgroundColor: formatColor((_a = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _a[1])
|
|
626
|
-
};
|
|
627
|
-
}
|
|
628
|
-
if (isUrnFlag(name)) {
|
|
629
|
-
return {
|
|
630
|
-
asset: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UrnFlag, { urn: name, size })
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
if (name.startsWith("data:text/plain,")) {
|
|
634
|
-
const text = decodeURI(name.replace("data:text/plain,", ""));
|
|
635
|
-
return {
|
|
636
|
-
asset: text,
|
|
637
|
-
backgroundColor: formatColor((_b = qComponents.find(([key]) => key === "background-color")) == null ? void 0 : _b[1])
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
if (!uri.startsWith("urn:")) {
|
|
641
|
-
return { asset: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: uri, alt: "", width: `${size}px` }) };
|
|
642
|
-
}
|
|
643
|
-
return { asset: void 0 };
|
|
644
|
-
};
|
|
645
|
-
var formatColor = (color) => {
|
|
646
|
-
if (!color) {
|
|
647
|
-
return void 0;
|
|
648
|
-
}
|
|
649
|
-
if (color.startsWith("#")) {
|
|
650
|
-
return color;
|
|
651
|
-
}
|
|
652
|
-
return `var(--color-${color.replace(/^base-|brand-/, "")})`;
|
|
653
|
-
};
|
|
654
|
-
|
|
655
|
-
// ../renderers/src/components/Media/AvatarMedia.tsx
|
|
656
|
-
var import_components8 = require("@transferwise/components");
|
|
657
|
-
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
658
|
-
var AvatarMedia = ({
|
|
659
|
-
accessibilityDescription,
|
|
660
|
-
content,
|
|
661
|
-
size
|
|
662
|
-
}) => {
|
|
663
|
-
const getRenderableAvatar = (avatar) => {
|
|
664
|
-
if (avatar.type === "text") {
|
|
665
|
-
return { asset: avatar.text };
|
|
666
|
-
}
|
|
667
|
-
return __spreadProps(__spreadValues({}, resolveMediaFromUri(avatar.uri, size)), {
|
|
668
|
-
badge: avatar.badgeUri ? resolveMediaFromUri(avatar.badgeUri, 16) : void 0
|
|
669
|
-
});
|
|
670
|
-
};
|
|
671
|
-
const avatars = content.map(getRenderableAvatar);
|
|
672
|
-
if (avatars.length === 1) {
|
|
673
|
-
const { badge, backgroundColor, asset, icon } = avatars[0];
|
|
674
|
-
if (!asset && !icon) {
|
|
675
|
-
return null;
|
|
676
|
-
}
|
|
677
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
678
|
-
import_components8.AvatarView,
|
|
679
|
-
{
|
|
680
|
-
"aria-label": accessibilityDescription,
|
|
681
|
-
size,
|
|
682
|
-
badge: badge ? __spreadProps(__spreadValues({}, badge), {
|
|
683
|
-
type: "reference"
|
|
684
|
-
}) : void 0,
|
|
685
|
-
style: { backgroundColor },
|
|
686
|
-
children: icon != null ? icon : asset
|
|
687
|
-
}
|
|
688
|
-
);
|
|
689
|
-
}
|
|
690
|
-
const avatarsWithoutBadges = avatars.filter(({ asset }) => asset).slice(0, 2).map((_a) => {
|
|
691
|
-
var _b = _a, { badge } = _b, rest = __objRest(_b, ["badge"]);
|
|
692
|
-
return __spreadValues({}, rest);
|
|
693
|
-
});
|
|
694
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
695
|
-
import_components8.AvatarLayout,
|
|
696
|
-
{
|
|
697
|
-
"aria-label": accessibilityDescription,
|
|
698
|
-
size,
|
|
699
|
-
orientation: "diagonal",
|
|
700
|
-
avatars: avatarsWithoutBadges
|
|
701
|
-
}
|
|
702
|
-
);
|
|
703
|
-
};
|
|
704
|
-
|
|
705
|
-
// ../renderers/src/utils/image-utils.tsx
|
|
706
|
-
var import_components9 = require("@transferwise/components");
|
|
707
|
-
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
708
|
-
var getBadgedMedia = (iconNode, imageNode, size) => {
|
|
709
|
-
if (iconNode && imageNode) {
|
|
710
|
-
if (imageNode && iconNode) {
|
|
711
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components9.AvatarView, { size, badge: { asset: iconNode, type: "reference" }, children: imageNode });
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
return null;
|
|
715
|
-
};
|
|
716
|
-
var getIconNode = (icon) => {
|
|
717
|
-
if (icon) {
|
|
718
|
-
if ("name" in icon) {
|
|
719
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DynamicIcon_default, { name: icon.name });
|
|
720
|
-
}
|
|
721
|
-
if (icon.text) {
|
|
722
|
-
return icon.text;
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
return null;
|
|
726
|
-
};
|
|
727
|
-
var getImageNode = (image, size) => {
|
|
728
|
-
if (image) {
|
|
729
|
-
const { accessibilityDescription, uri } = image;
|
|
730
|
-
if (!uri.startsWith("urn:")) {
|
|
731
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("img", { src: uri, alt: accessibilityDescription, width: `${size}px` });
|
|
732
|
-
}
|
|
733
|
-
if (isUrnFlag(uri)) {
|
|
734
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(UrnFlag, { urn: uri, accessibilityDescription, size });
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
return null;
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
// ../renderers/src/components/Media/LegacyMedia.tsx
|
|
741
|
-
var import_components10 = require("@transferwise/components");
|
|
742
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
743
|
-
var LegacyMedia = ({ image, icon, preferAvatar, size }) => {
|
|
744
|
-
const imageNode = getImageNode(image, size);
|
|
745
|
-
const iconNode = getIconNode(icon);
|
|
746
|
-
const badge = getBadgedMedia(iconNode, imageNode, size);
|
|
747
|
-
if (badge) {
|
|
748
|
-
return badge;
|
|
749
|
-
}
|
|
750
|
-
if (imageNode) {
|
|
751
|
-
return preferAvatar ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components10.AvatarView, { children: imageNode }) : imageNode;
|
|
752
|
-
}
|
|
753
|
-
if (iconNode && icon) {
|
|
754
|
-
if ("text" in icon || size === 48) {
|
|
755
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components10.AvatarView, { size, children: iconNode });
|
|
756
|
-
}
|
|
757
|
-
return iconNode;
|
|
758
|
-
}
|
|
759
|
-
return null;
|
|
760
|
-
};
|
|
761
|
-
|
|
762
|
-
// ../renderers/src/components/Media/Media.tsx
|
|
763
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
764
|
-
function Media({
|
|
765
|
-
media,
|
|
766
|
-
preferAvatar,
|
|
767
|
-
size
|
|
768
|
-
}) {
|
|
769
|
-
switch (media == null ? void 0 : media.type) {
|
|
770
|
-
case "avatar":
|
|
771
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AvatarMedia, __spreadProps(__spreadValues({}, media), { size }));
|
|
772
|
-
case "image": {
|
|
773
|
-
const { asset, icon } = resolveMediaFromUri(media.uri, size);
|
|
774
|
-
return icon != null ? icon : asset;
|
|
775
|
-
}
|
|
776
|
-
case "legacy": {
|
|
777
|
-
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LegacyMedia, __spreadProps(__spreadValues({}, media), { preferAvatar, size }));
|
|
778
|
-
}
|
|
779
|
-
default:
|
|
780
|
-
return null;
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
|
|
784
|
-
// ../renderers/src/components/Media/OptionMedia.tsx
|
|
785
|
-
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
786
|
-
var mediaSize = 48;
|
|
787
|
-
function OptionMedia(props) {
|
|
788
|
-
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Media, __spreadProps(__spreadValues({}, props), { size: mediaSize }));
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
// ../renderers/src/components/Media/getInlineMedia.tsx
|
|
792
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
793
|
-
var getInlineMedia = (media) => media ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Media, { media, preferAvatar: false, size: 24 }) : null;
|
|
794
|
-
|
|
795
|
-
// ../renderers/src/DecisionRenderer/DecisionList.tsx
|
|
796
|
-
var import_components12 = require("@transferwise/components");
|
|
797
|
-
|
|
798
|
-
// ../renderers/src/DecisionRenderer/GroupedList.tsx
|
|
799
|
-
var import_components11 = require("@transferwise/components");
|
|
800
|
-
var import_react_intl6 = require("react-intl");
|
|
801
|
-
|
|
802
|
-
// ../renderers/src/messages/decision.messages.ts
|
|
803
|
-
var import_react_intl5 = require("react-intl");
|
|
804
|
-
var decision_messages_default = (0, import_react_intl5.defineMessages)({
|
|
805
|
-
all: {
|
|
806
|
-
id: "df.wise.Decision.all",
|
|
807
|
-
defaultMessage: "All",
|
|
808
|
-
description: "Label for the group of options that encompasses all options"
|
|
809
|
-
},
|
|
810
|
-
popular: {
|
|
811
|
-
id: "df.wise.Decision.popular",
|
|
812
|
-
defaultMessage: "Popular",
|
|
813
|
-
description: "Label for the group of options that are tagged as popular"
|
|
814
|
-
},
|
|
815
|
-
recent: {
|
|
816
|
-
id: "df.wise.Decision.recent",
|
|
817
|
-
defaultMessage: "Recent",
|
|
818
|
-
description: "Label for the group of options that are tagged as recent"
|
|
819
|
-
},
|
|
820
|
-
currenciesWithAccountDetails: {
|
|
821
|
-
id: "df.wise.Decision.currenciesWithAccountDetails",
|
|
822
|
-
defaultMessage: "Currencies with account details",
|
|
823
|
-
description: "Label for the group of options that are tagged as currencies with account details"
|
|
824
|
-
},
|
|
825
|
-
filterPlaceholder: {
|
|
826
|
-
id: "df.wise.Decision.filterPlaceholder",
|
|
827
|
-
defaultMessage: "Start typing to search",
|
|
828
|
-
description: "Placeholder for the filter input"
|
|
829
|
-
},
|
|
830
|
-
results: {
|
|
831
|
-
id: "df.wise.Decision.results",
|
|
832
|
-
defaultMessage: "Search results",
|
|
833
|
-
description: "Label for the results section"
|
|
834
|
-
},
|
|
835
|
-
noResults: {
|
|
836
|
-
id: "df.wise.Decision.noResults",
|
|
837
|
-
defaultMessage: "No results",
|
|
838
|
-
description: "Message for if there are no results"
|
|
839
|
-
}
|
|
840
|
-
});
|
|
841
|
-
|
|
842
|
-
// ../renderers/src/DecisionRenderer/GroupedList.tsx
|
|
843
|
-
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
844
|
-
var OPTION_GROUPS = {
|
|
845
|
-
popular: "popular",
|
|
846
|
-
recent: "recent",
|
|
847
|
-
currencyWithAccountDetails: "currencies-with-account-details"
|
|
848
|
-
};
|
|
849
|
-
var GroupedList = (_a) => {
|
|
850
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
851
|
-
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
852
|
-
const { options } = rest;
|
|
853
|
-
const popularOptions = options.filter((option) => option.tag === OPTION_GROUPS.popular);
|
|
854
|
-
const recentOptions = options.filter((option) => option.tag === OPTION_GROUPS.recent);
|
|
855
|
-
const currencyWithAccountDetailsOptions = options.filter(
|
|
856
|
-
(option) => option.tag === OPTION_GROUPS.currencyWithAccountDetails
|
|
857
|
-
);
|
|
858
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
859
|
-
popularOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components11.Section, { children: [
|
|
860
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Header, { as: "h2", title: formatMessage(decision_messages_default.popular) }),
|
|
861
|
-
renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: popularOptions }))
|
|
862
|
-
] }) : null,
|
|
863
|
-
recentOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components11.Section, { children: [
|
|
864
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Header, { as: "h2", title: formatMessage(decision_messages_default.recent) }),
|
|
865
|
-
renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: recentOptions }))
|
|
866
|
-
] }) : null,
|
|
867
|
-
currencyWithAccountDetailsOptions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components11.Section, { children: [
|
|
868
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Header, { as: "h2", title: formatMessage(decision_messages_default.currenciesWithAccountDetails) }),
|
|
869
|
-
renderDecisionList3(__spreadProps(__spreadValues({}, rest), { options: currencyWithAccountDetailsOptions }))
|
|
870
|
-
] }) : null,
|
|
871
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components11.Section, { children: [
|
|
872
|
-
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Header, { as: "h2", title: formatMessage(decision_messages_default.all) }),
|
|
873
|
-
renderDecisionList3(rest)
|
|
874
|
-
] })
|
|
875
|
-
] });
|
|
876
|
-
};
|
|
877
|
-
var isGroupedDecision = (options) => {
|
|
878
|
-
const possibleGroups = Object.values(OPTION_GROUPS);
|
|
879
|
-
return options.some(({ tag }) => tag && possibleGroups.includes(tag));
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
// ../renderers/src/DecisionRenderer/DecisionList.tsx
|
|
883
|
-
var import_react_intl7 = require("react-intl");
|
|
884
|
-
var import_react3 = require("react");
|
|
885
|
-
|
|
886
|
-
// ../renderers/src/DecisionRenderer/filter-and-sort-decision-options.ts
|
|
887
|
-
function filterAndSortDecisionOptions(selectOptions, query) {
|
|
888
|
-
const upperQuery = query.toUpperCase().trim();
|
|
889
|
-
const filteredItems = selectOptions.filter((option) => {
|
|
890
|
-
var _a, _b, _c, _d;
|
|
891
|
-
const searchableWords = [
|
|
892
|
-
option.title,
|
|
893
|
-
option.description,
|
|
894
|
-
option.additionalText,
|
|
895
|
-
(_a = option.supportingValues) == null ? void 0 : _a.value,
|
|
896
|
-
(_b = option.supportingValues) == null ? void 0 : _b.subvalue,
|
|
897
|
-
...(_c = option.keywords) != null ? _c : []
|
|
898
|
-
];
|
|
899
|
-
return (_d = searchableWords.some((word) => word == null ? void 0 : word.toUpperCase().includes(upperQuery))) != null ? _d : false;
|
|
900
|
-
});
|
|
901
|
-
return [...filteredItems].sort((a, b) => {
|
|
902
|
-
const aTitleUpper = a.title.toUpperCase();
|
|
903
|
-
const bTitleUpper = b.title.toUpperCase();
|
|
904
|
-
const aTitleStarts = aTitleUpper.startsWith(upperQuery);
|
|
905
|
-
const bTitleStarts = bTitleUpper.startsWith(upperQuery);
|
|
906
|
-
if (aTitleStarts && !bTitleStarts) {
|
|
907
|
-
return -1;
|
|
908
|
-
}
|
|
909
|
-
if (!aTitleStarts && bTitleStarts) {
|
|
910
|
-
return 1;
|
|
911
|
-
}
|
|
912
|
-
const aWordStarts = aTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
913
|
-
const bWordStarts = bTitleUpper.split(" ").some((word) => word.startsWith(upperQuery));
|
|
914
|
-
if (aWordStarts && !bWordStarts) {
|
|
915
|
-
return -1;
|
|
916
|
-
}
|
|
917
|
-
if (!aWordStarts && bWordStarts) {
|
|
918
|
-
return 1;
|
|
919
|
-
}
|
|
920
|
-
return a.title.localeCompare(b.title);
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
// ../renderers/src/DecisionRenderer/DecisionList.tsx
|
|
925
|
-
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
926
|
-
var DecisionWrapper = (props) => {
|
|
927
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: getMargin(props.margin), children: [
|
|
928
|
-
props.title && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components12.Header, { as: "h2", title: props.title }),
|
|
929
|
-
props.control === "filtered" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FilteredDecisionList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UnfilteredDecisionList, __spreadValues({}, props))
|
|
930
|
-
] });
|
|
931
|
-
};
|
|
932
|
-
var UnfilteredDecisionList = (_a) => {
|
|
933
|
-
var _b = _a, { renderDecisionList: renderDecisionList3 } = _b, rest = __objRest(_b, ["renderDecisionList"]);
|
|
934
|
-
return isGroupedDecision(rest.options) ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupedList, __spreadProps(__spreadValues({}, rest), { renderDecisionList: renderDecisionList3 })) : renderDecisionList3(rest);
|
|
935
|
-
};
|
|
936
|
-
var FilteredDecisionList = (props) => {
|
|
937
|
-
const { formatMessage } = (0, import_react_intl7.useIntl)();
|
|
938
|
-
const [query, setQuery] = (0, import_react3.useState)("");
|
|
939
|
-
const { control, options, renderDecisionList: renderDecisionList3 } = props;
|
|
940
|
-
const filteredOptions = filterAndSortDecisionOptions(options, query);
|
|
941
|
-
const isGrouped = isGroupedDecision(options);
|
|
942
|
-
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
943
|
-
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
944
|
-
import_components12.SearchInput,
|
|
945
|
-
{
|
|
946
|
-
placeholder: formatMessage(decision_messages_default.filterPlaceholder),
|
|
947
|
-
value: query,
|
|
948
|
-
onChange: (e) => {
|
|
949
|
-
var _a;
|
|
950
|
-
return setQuery((_a = e.target.value) != null ? _a : "");
|
|
951
|
-
}
|
|
952
|
-
}
|
|
953
|
-
),
|
|
954
|
-
isGrouped && query.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(GroupedList, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
955
|
-
query.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components12.Header, { as: "h2", title: formatMessage(decision_messages_default.results), className: "m-t-4" }),
|
|
956
|
-
filteredOptions.length > 0 ? renderDecisionList3({
|
|
957
|
-
control,
|
|
958
|
-
className: query.length === 0 ? "m-t-3" : "",
|
|
959
|
-
options: filteredOptions
|
|
960
|
-
}) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { children: formatMessage(decision_messages_default.noResults) })
|
|
961
|
-
] })
|
|
962
|
-
] });
|
|
963
|
-
};
|
|
964
|
-
|
|
965
|
-
// ../renderers/src/DecisionRenderer/DecisionRenderer.tsx
|
|
966
|
-
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
967
|
-
var DecisionRenderer = {
|
|
968
|
-
canRenderType: "decision",
|
|
969
|
-
render: (props) => {
|
|
970
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList }));
|
|
971
|
-
}
|
|
972
|
-
};
|
|
973
|
-
var renderDecisionList = ({ options, className, control }) => {
|
|
974
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.NavigationOptionsList, { children: options.map((option) => {
|
|
975
|
-
const { description, disabled, media, title: itemTitle, tag, onClick } = option;
|
|
976
|
-
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
977
|
-
import_components13.NavigationOption,
|
|
978
|
-
{
|
|
979
|
-
title: itemTitle,
|
|
980
|
-
content: description,
|
|
981
|
-
disabled,
|
|
982
|
-
media: media ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
983
|
-
OptionMedia,
|
|
984
|
-
{
|
|
985
|
-
media,
|
|
986
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
987
|
-
}
|
|
988
|
-
) : null,
|
|
989
|
-
showMediaCircle: false,
|
|
990
|
-
showMediaAtAllSizes: true,
|
|
991
|
-
onClick
|
|
992
|
-
},
|
|
993
|
-
JSON.stringify(option)
|
|
994
|
-
);
|
|
995
|
-
}) }) });
|
|
996
|
-
};
|
|
997
|
-
var DecisionRenderer_default = DecisionRenderer;
|
|
998
|
-
|
|
999
|
-
// ../renderers/src/DividerRenderer.tsx
|
|
1000
|
-
var import_components14 = require("@transferwise/components");
|
|
1001
|
-
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1002
|
-
var mapControlToLevel = (control) => {
|
|
1003
|
-
switch (control) {
|
|
1004
|
-
case "section":
|
|
1005
|
-
return "section";
|
|
1006
|
-
case "content":
|
|
1007
|
-
return "content";
|
|
1008
|
-
default:
|
|
1009
|
-
return "subsection";
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
var DividerRenderer = {
|
|
1013
|
-
canRenderType: "divider",
|
|
1014
|
-
render: ({ margin, control }) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components14.Divider, { className: `m-t-0 d-block ${getMargin(margin)}`, level: mapControlToLevel(control) })
|
|
1015
|
-
};
|
|
1016
|
-
var DividerRenderer_default = DividerRenderer;
|
|
1017
|
-
|
|
1018
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1019
|
-
var import_components15 = require("@transferwise/components");
|
|
1020
|
-
|
|
1021
|
-
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1022
|
-
var import_react_intl8 = require("react-intl");
|
|
1023
|
-
var external_confirmation_messages_default = (0, import_react_intl8.defineMessages)({
|
|
1024
|
-
title: {
|
|
1025
|
-
id: "df.wise.ExternalConfirmation.title",
|
|
1026
|
-
defaultMessage: "Please confirm",
|
|
1027
|
-
description: "Heading for the confirmation screen."
|
|
1028
|
-
},
|
|
1029
|
-
description: {
|
|
1030
|
-
id: "df.wise.ExternalConfirmation.description",
|
|
1031
|
-
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
1032
|
-
description: "Description for the confirmation screen."
|
|
1033
|
-
},
|
|
1034
|
-
open: {
|
|
1035
|
-
id: "df.wise.ExternalConfirmation.open",
|
|
1036
|
-
defaultMessage: "Open in new tab",
|
|
1037
|
-
description: "Button text confirming opening a new browser tab."
|
|
1038
|
-
},
|
|
1039
|
-
cancel: {
|
|
1040
|
-
id: "df.wise.ExternalConfirmation.cancel",
|
|
1041
|
-
defaultMessage: "Cancel",
|
|
1042
|
-
description: "Button text rejecting opening a new browser tab."
|
|
1043
|
-
}
|
|
1044
|
-
});
|
|
1045
|
-
|
|
1046
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1047
|
-
var import_react_intl9 = require("react-intl");
|
|
1048
|
-
var import_react4 = require("react");
|
|
1049
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1050
|
-
var ExternalConfirmationRenderer = {
|
|
1051
|
-
canRenderType: "external-confirmation",
|
|
1052
|
-
render: ExternalConfirmationRendererComponent
|
|
1053
|
-
};
|
|
1054
|
-
function ExternalConfirmationRendererComponent({
|
|
1055
|
-
url,
|
|
1056
|
-
status,
|
|
1057
|
-
onSuccess,
|
|
1058
|
-
onFailure,
|
|
1059
|
-
onCancel
|
|
1060
|
-
}) {
|
|
1061
|
-
const { formatMessage } = (0, import_react_intl9.useIntl)();
|
|
1062
|
-
(0, import_react4.useEffect)(() => {
|
|
1063
|
-
if (url) {
|
|
1064
|
-
const w = window.open(url, "_blank");
|
|
1065
|
-
if (w) {
|
|
1066
|
-
onSuccess();
|
|
1067
|
-
} else {
|
|
1068
|
-
onFailure();
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
}, []);
|
|
1072
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1073
|
-
import_components15.Modal,
|
|
1074
|
-
{
|
|
1075
|
-
open: status === "failure",
|
|
1076
|
-
title: formatMessage(external_confirmation_messages_default.title),
|
|
1077
|
-
body: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
1078
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.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) }) }),
|
|
1079
|
-
/* @__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: [
|
|
1080
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1081
|
-
import_components15.Button,
|
|
1082
|
-
{
|
|
1083
|
-
v2: true,
|
|
1084
|
-
block: true,
|
|
1085
|
-
className: "m-b-2",
|
|
1086
|
-
priority: "primary",
|
|
1087
|
-
size: "md",
|
|
1088
|
-
onClick: () => {
|
|
1089
|
-
window.open(url);
|
|
1090
|
-
onCancel();
|
|
1091
|
-
},
|
|
1092
|
-
children: formatMessage(external_confirmation_messages_default.open)
|
|
1093
|
-
}
|
|
1094
|
-
),
|
|
1095
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.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) })
|
|
1096
|
-
] }) })
|
|
1097
|
-
] }),
|
|
1098
|
-
onClose: onCancel
|
|
1099
|
-
}
|
|
1100
|
-
);
|
|
1101
|
-
}
|
|
1102
|
-
function getOrigin(url) {
|
|
1103
|
-
try {
|
|
1104
|
-
return new URL(url).origin;
|
|
1105
|
-
} catch (e) {
|
|
1106
|
-
return url;
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1110
|
-
|
|
1111
|
-
// ../renderers/src/FormRenderer.tsx
|
|
1112
|
-
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1113
|
-
var FormRenderer = {
|
|
1114
|
-
canRenderType: "form",
|
|
1115
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: getMargin(margin), children })
|
|
1116
|
-
};
|
|
1117
|
-
var FormRenderer_default = FormRenderer;
|
|
1118
|
-
|
|
1119
|
-
// ../renderers/src/FormSectionRenderer.tsx
|
|
1120
|
-
var import_components16 = require("@transferwise/components");
|
|
1121
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1122
|
-
var FormSectionRenderer = {
|
|
1123
|
-
canRenderType: "form-section",
|
|
1124
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("fieldset", { children: [
|
|
1125
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1126
|
-
import_components16.Header,
|
|
1127
|
-
{
|
|
1128
|
-
as: "h2",
|
|
1129
|
-
title
|
|
1130
|
-
}
|
|
1131
|
-
),
|
|
1132
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: description }),
|
|
1133
|
-
children
|
|
1134
|
-
] })
|
|
1135
|
-
};
|
|
1136
|
-
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1137
|
-
|
|
1138
|
-
// ../renderers/src/HeadingRenderer.tsx
|
|
1139
|
-
var import_components17 = require("@transferwise/components");
|
|
1140
|
-
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1141
|
-
var HeadingRenderer = {
|
|
1142
|
-
canRenderType: "heading",
|
|
1143
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Heading, __spreadValues({}, props))
|
|
1144
|
-
};
|
|
1145
|
-
function Heading(props) {
|
|
1146
|
-
const { text, size, align, margin, control } = props;
|
|
1147
|
-
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1148
|
-
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(StandardHeading, { size, text, className });
|
|
1149
|
-
}
|
|
1150
|
-
function DisplayHeading({ size, text, className }) {
|
|
1151
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components17.Display, { type: getDisplayType(size), className, children: text });
|
|
1152
|
-
}
|
|
1153
|
-
var getDisplayType = (size) => {
|
|
1154
|
-
switch (size) {
|
|
1155
|
-
case "xs":
|
|
1156
|
-
case "sm":
|
|
1157
|
-
return "display-small";
|
|
1158
|
-
case "xl":
|
|
1159
|
-
case "lg":
|
|
1160
|
-
return "display-large";
|
|
1161
|
-
case "md":
|
|
1162
|
-
default:
|
|
1163
|
-
return "display-medium";
|
|
1164
|
-
}
|
|
1165
|
-
};
|
|
1166
|
-
function StandardHeading({ size, text, className }) {
|
|
1167
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components17.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1168
|
-
}
|
|
1169
|
-
var getTitleTypeBySize = (size) => {
|
|
1170
|
-
var _a;
|
|
1171
|
-
const titleTypes = {
|
|
1172
|
-
xs: "title-group",
|
|
1173
|
-
sm: "title-body",
|
|
1174
|
-
md: "title-subsection",
|
|
1175
|
-
lg: "title-section",
|
|
1176
|
-
xl: "title-screen"
|
|
1177
|
-
};
|
|
1178
|
-
return (_a = titleTypes[size]) != null ? _a : "title-subsection";
|
|
1179
|
-
};
|
|
1180
|
-
var HeadingRenderer_default = HeadingRenderer;
|
|
1181
|
-
|
|
1182
|
-
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1183
|
-
var import_components18 = require("@transferwise/components");
|
|
1184
|
-
var import_react5 = require("react");
|
|
1185
|
-
|
|
1186
|
-
// ../renderers/src/utils/api-utils.ts
|
|
1187
|
-
function isRelativePath(url = "") {
|
|
1188
|
-
return !["https://", "http://", "data:"].some(
|
|
1189
|
-
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1190
|
-
);
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1194
|
-
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1195
|
-
function UrlImage({
|
|
1196
|
-
accessibilityDescription,
|
|
1197
|
-
align,
|
|
1198
|
-
margin,
|
|
1199
|
-
size,
|
|
1200
|
-
uri,
|
|
1201
|
-
httpClient
|
|
1202
|
-
}) {
|
|
1203
|
-
const [imageSource, setImageSource] = (0, import_react5.useState)("");
|
|
1204
|
-
(0, import_react5.useEffect)(() => {
|
|
1205
|
-
if (!uri.startsWith("urn:")) {
|
|
1206
|
-
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1207
|
-
}
|
|
1208
|
-
}, [uri, httpClient]);
|
|
1209
|
-
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1210
|
-
import_components18.Image,
|
|
1211
|
-
{
|
|
1212
|
-
className: `img-responsive ${getMargin(margin)}`,
|
|
1213
|
-
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
1214
|
-
src: imageSource,
|
|
1215
|
-
stretch: true,
|
|
1216
|
-
shrink: true
|
|
1217
|
-
}
|
|
1218
|
-
) });
|
|
1219
|
-
}
|
|
1220
|
-
var readImageBlobAsDataURL = async (imageBlob) => (
|
|
1221
|
-
// we can safely assume the type of reader.result is string
|
|
1222
|
-
// because we're calling reader.readAsDataURL
|
|
1223
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/FileReader/result
|
|
1224
|
-
new Promise((resolve, reject) => {
|
|
1225
|
-
const reader = new FileReader();
|
|
1226
|
-
reader.addEventListener("loadend", () => resolve(reader.result));
|
|
1227
|
-
reader.addEventListener("error", reject);
|
|
1228
|
-
reader.readAsDataURL(imageBlob);
|
|
1229
|
-
})
|
|
1230
|
-
);
|
|
1231
|
-
var getImageSource = async (httpClient, imageUrl) => {
|
|
1232
|
-
var _a;
|
|
1233
|
-
try {
|
|
1234
|
-
if (isRelativePath(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
1235
|
-
return await httpClient(imageUrl, {
|
|
1236
|
-
method: "GET",
|
|
1237
|
-
headers: { "Content-Type": "image/image" },
|
|
1238
|
-
credentials: "same-origin"
|
|
1239
|
-
}).then(async (response) => {
|
|
1240
|
-
if (response.ok) {
|
|
1241
|
-
return response.blob();
|
|
1242
|
-
}
|
|
1243
|
-
throw new Error("Image fetching failed");
|
|
1244
|
-
}).then(readImageBlobAsDataURL).catch(() => imageUrl);
|
|
1245
|
-
}
|
|
1246
|
-
return imageUrl;
|
|
1247
|
-
} catch (e) {
|
|
1248
|
-
return imageUrl;
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
|
-
|
|
1252
|
-
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1253
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1254
|
-
var maxFlagSize = 600;
|
|
1255
|
-
function UrnFlagImage({
|
|
1256
|
-
accessibilityDescription,
|
|
1257
|
-
align,
|
|
1258
|
-
margin,
|
|
1259
|
-
size,
|
|
1260
|
-
uri
|
|
1261
|
-
}) {
|
|
1262
|
-
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 }) });
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1266
|
-
var import_art4 = require("@wise/art");
|
|
1267
|
-
var import_react7 = require("react");
|
|
1268
|
-
|
|
1269
|
-
// ../renderers/src/ImageRenderer/isAnimated.ts
|
|
1270
|
-
var isAnimated = (uri) => {
|
|
1271
|
-
var _a;
|
|
1272
|
-
const { rComponents } = stringToURN(uri);
|
|
1273
|
-
return (_a = rComponents == null ? void 0 : rComponents.some(([key, value]) => key === "type" && value === "animated")) != null ? _a : false;
|
|
1274
|
-
};
|
|
1275
|
-
|
|
1276
|
-
// ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
|
|
1277
|
-
var import_art3 = require("@wise/art");
|
|
1278
|
-
var import_react6 = require("react");
|
|
1279
|
-
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1280
|
-
var Illustration3DErrorBoundary = class extends import_react6.Component {
|
|
1281
|
-
constructor(props) {
|
|
1282
|
-
super(props);
|
|
1283
|
-
this.state = { hasError: false };
|
|
1284
|
-
}
|
|
1285
|
-
static getDerivedStateFromError() {
|
|
1286
|
-
return { hasError: true };
|
|
1287
|
-
}
|
|
1288
|
-
componentDidCatch() {
|
|
1289
|
-
this.props.onError();
|
|
1290
|
-
}
|
|
1291
|
-
render() {
|
|
1292
|
-
if (this.state.hasError) {
|
|
1293
|
-
return null;
|
|
1294
|
-
}
|
|
1295
|
-
return this.props.children;
|
|
1296
|
-
}
|
|
1297
|
-
};
|
|
1298
|
-
var SafeIllustration3D = ({
|
|
1299
|
-
name,
|
|
1300
|
-
size,
|
|
1301
|
-
onError
|
|
1302
|
-
}) => {
|
|
1303
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Illustration3DErrorBoundary, { onError, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_art3.Illustration3D, { name, size }) });
|
|
1304
|
-
};
|
|
1305
|
-
var SafeIllustration3D_default = SafeIllustration3D;
|
|
1306
|
-
|
|
1307
|
-
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1308
|
-
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1309
|
-
var urnPrefix = "urn:wise:illustrations:";
|
|
1310
|
-
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1311
|
-
function UrnIllustration({
|
|
1312
|
-
accessibilityDescription,
|
|
1313
|
-
align,
|
|
1314
|
-
margin,
|
|
1315
|
-
size,
|
|
1316
|
-
uri
|
|
1317
|
-
}) {
|
|
1318
|
-
const [has3DFailed, setHas3DFailed] = (0, import_react7.useState)(false);
|
|
1319
|
-
const illustrationSize = getIllustrationSize(size);
|
|
1320
|
-
const illustrationName = getIllustrationName(uri);
|
|
1321
|
-
const illustration3DName = getIllustration3DName(uri);
|
|
1322
|
-
if (illustration3DName && isAnimated(uri) && !has3DFailed) {
|
|
1323
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1324
|
-
SafeIllustration3D_default,
|
|
1325
|
-
{
|
|
1326
|
-
name: illustration3DName,
|
|
1327
|
-
size: illustrationSize,
|
|
1328
|
-
onError: () => setHas3DFailed(true)
|
|
1329
|
-
}
|
|
1330
|
-
) });
|
|
1331
|
-
}
|
|
1332
|
-
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
1333
|
-
import_art4.Illustration,
|
|
1334
|
-
{
|
|
1335
|
-
className: "df-illustration",
|
|
1336
|
-
name: illustrationName,
|
|
1337
|
-
size: illustrationSize,
|
|
1338
|
-
alt: accessibilityDescription
|
|
1339
|
-
}
|
|
1340
|
-
) });
|
|
1341
|
-
}
|
|
1342
|
-
var getIllustrationSize = (size) => ({ xs: "small", sm: "small", md: "medium", lg: "large", xl: "large" })[size] || "medium";
|
|
1343
|
-
var getIllustrationName = (uri) => {
|
|
1344
|
-
return uri.replace(urnPrefix, "").split("?")[0];
|
|
1345
|
-
};
|
|
1346
|
-
var getIllustration3DName = (uri) => {
|
|
1347
|
-
const illustrationName = getIllustrationName(uri);
|
|
1348
|
-
return (0, import_art4.isIllustrationSupport3D)(illustrationName) ? illustrationName : null;
|
|
1349
|
-
};
|
|
1350
|
-
|
|
1351
|
-
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1352
|
-
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1353
|
-
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1354
|
-
function UrnImage(props) {
|
|
1355
|
-
const { uri } = props;
|
|
1356
|
-
if (isUrnIllustration(uri)) {
|
|
1357
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1358
|
-
}
|
|
1359
|
-
if (isUrnFlag(uri)) {
|
|
1360
|
-
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1361
|
-
}
|
|
1362
|
-
return null;
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1366
|
-
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1367
|
-
var ImageRenderer = {
|
|
1368
|
-
canRenderType: "image",
|
|
1369
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(UrlImage, __spreadValues({}, props))
|
|
1370
|
-
};
|
|
1371
|
-
|
|
1372
|
-
// ../renderers/src/ImageRenderer/index.tsx
|
|
1373
|
-
var ImageRenderer_default = ImageRenderer;
|
|
1374
|
-
|
|
1375
|
-
// ../renderers/src/InstructionsRenderer.tsx
|
|
1376
|
-
var import_components19 = require("@transferwise/components");
|
|
1377
|
-
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1378
|
-
var doContext = ["positive", "neutral"];
|
|
1379
|
-
var dontContext = ["warning", "negative"];
|
|
1380
|
-
var InstructionsRenderer = {
|
|
1381
|
-
canRenderType: "instructions",
|
|
1382
|
-
render: ({ items, margin, title }) => {
|
|
1383
|
-
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1384
|
-
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1385
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: getMargin(margin), children: [
|
|
1386
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components19.Header, { title }) : null,
|
|
1387
|
-
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components19.InstructionsList, { dos, donts })
|
|
1388
|
-
] });
|
|
1389
|
-
}
|
|
1390
|
-
};
|
|
1391
|
-
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1392
|
-
|
|
1393
|
-
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1394
|
-
var import_components20 = require("@transferwise/components");
|
|
1395
|
-
|
|
1396
|
-
// ../renderers/src/utils/input-utils.ts
|
|
1397
|
-
var onWheel = (event) => {
|
|
1398
|
-
if (event.target instanceof HTMLElement) {
|
|
1399
|
-
event.target.blur();
|
|
1400
|
-
}
|
|
1401
|
-
};
|
|
1402
|
-
|
|
1403
|
-
// ../renderers/src/utils/getInputGroupAddonStart.tsx
|
|
1404
|
-
var getInputGroupAddonStart = (media) => {
|
|
1405
|
-
const content = getInlineMedia(media);
|
|
1406
|
-
return content ? { content } : void 0;
|
|
1407
|
-
};
|
|
1408
|
-
|
|
1409
|
-
// ../renderers/src/utils/pick.ts
|
|
1410
|
-
function pick(obj, ...keys) {
|
|
1411
|
-
const result = {};
|
|
1412
|
-
keys.forEach((key) => {
|
|
1413
|
-
result[key] = obj[key];
|
|
1414
|
-
});
|
|
1415
|
-
return result;
|
|
1416
|
-
}
|
|
1417
|
-
|
|
1418
|
-
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1419
|
-
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1420
|
-
var IntegerInputRenderer = {
|
|
1421
|
-
canRenderType: "input-integer",
|
|
1422
|
-
render: (props) => {
|
|
1423
|
-
const { id, title, description, help, media, validationState, value, onChange } = props;
|
|
1424
|
-
const commonProps = pick(
|
|
1425
|
-
props,
|
|
1426
|
-
"autoComplete",
|
|
1427
|
-
"disabled",
|
|
1428
|
-
"onBlur",
|
|
1429
|
-
"onFocus",
|
|
1430
|
-
"placeholder",
|
|
1431
|
-
"maximum",
|
|
1432
|
-
"minimum"
|
|
1433
|
-
);
|
|
1434
|
-
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1435
|
-
FieldInput_default,
|
|
1436
|
-
{
|
|
1437
|
-
id,
|
|
1438
|
-
label: title,
|
|
1439
|
-
description,
|
|
1440
|
-
validation: validationState,
|
|
1441
|
-
help,
|
|
1442
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_components20.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1443
|
-
import_components20.Input,
|
|
1444
|
-
__spreadValues({
|
|
1445
|
-
id,
|
|
1446
|
-
name: id,
|
|
1447
|
-
type: "number",
|
|
1448
|
-
step: "1",
|
|
1449
|
-
pattern: "\\d+",
|
|
1450
|
-
value: value != null ? value : "",
|
|
1451
|
-
onChange: ({ target: { value: newValue } }) => {
|
|
1452
|
-
const parsedValue = Number.parseInt(newValue, 10);
|
|
1453
|
-
onChange(Number.isNaN(parsedValue) ? null : parsedValue);
|
|
1454
|
-
},
|
|
1455
|
-
onWheel
|
|
1456
|
-
}, commonProps)
|
|
1457
|
-
) })
|
|
1458
|
-
}
|
|
1459
|
-
);
|
|
1460
|
-
}
|
|
1461
|
-
};
|
|
1462
|
-
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
1463
|
-
|
|
1464
|
-
// ../renderers/src/ListRenderer.tsx
|
|
1465
|
-
var import_components21 = require("@transferwise/components");
|
|
1466
|
-
var import_classnames3 = __toESM(require("classnames"));
|
|
1467
|
-
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1468
|
-
var ListRenderer = {
|
|
1469
|
-
canRenderType: "list",
|
|
1470
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: getMargin(margin), children: [
|
|
1471
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components21.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
1472
|
-
items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
1473
|
-
] })
|
|
1474
|
-
};
|
|
1475
|
-
var DesignSystemListItem = ({
|
|
1476
|
-
title,
|
|
1477
|
-
description,
|
|
1478
|
-
supportingValues,
|
|
1479
|
-
icon,
|
|
1480
|
-
image,
|
|
1481
|
-
media,
|
|
1482
|
-
control,
|
|
1483
|
-
tag
|
|
1484
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1485
|
-
"label",
|
|
1486
|
-
{
|
|
1487
|
-
className: (0, import_classnames3.default)("np-option p-a-2", {
|
|
1488
|
-
"np-option__sm-media": true,
|
|
1489
|
-
"np-option__container-aligned": true
|
|
1490
|
-
}),
|
|
1491
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "media", children: [
|
|
1492
|
-
icon || image || media ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "media-left", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1493
|
-
ListItemMedia,
|
|
1494
|
-
{
|
|
1495
|
-
icon,
|
|
1496
|
-
media,
|
|
1497
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1498
|
-
}
|
|
1499
|
-
) }) : null,
|
|
1500
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "media-body", children: [
|
|
1501
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1502
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
1503
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
1504
|
-
] }),
|
|
1505
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1506
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components21.Body, { className: "d-block np-option__body", children: description }),
|
|
1507
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components21.Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
1508
|
-
] })
|
|
1509
|
-
] })
|
|
1510
|
-
] })
|
|
1511
|
-
},
|
|
1512
|
-
title
|
|
1513
|
-
);
|
|
1514
|
-
var ListItemMedia = ({
|
|
1515
|
-
icon,
|
|
1516
|
-
media,
|
|
1517
|
-
preferAvatar
|
|
1518
|
-
}) => {
|
|
1519
|
-
if (icon) {
|
|
1520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1521
|
-
}
|
|
1522
|
-
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(OptionMedia, { media, preferAvatar }) });
|
|
1523
|
-
};
|
|
1524
|
-
var getListAction = (callToAction) => {
|
|
1525
|
-
if (callToAction) {
|
|
1526
|
-
return __spreadValues({
|
|
1527
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
1528
|
-
text: callToAction.title,
|
|
1529
|
-
onClick: callToAction.onClick
|
|
1530
|
-
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
1531
|
-
}
|
|
1532
|
-
return void 0;
|
|
1533
|
-
};
|
|
1534
|
-
var ListRenderer_default = ListRenderer;
|
|
1535
|
-
|
|
1536
|
-
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1537
|
-
var import_components22 = require("@transferwise/components");
|
|
1538
|
-
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1539
|
-
var LoadingIndicatorRenderer = {
|
|
1540
|
-
canRenderType: "loading-indicator",
|
|
1541
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1542
|
-
import_components22.Loader,
|
|
1543
|
-
{
|
|
1544
|
-
size,
|
|
1545
|
-
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
1546
|
-
"data-testid": "loading-indicator"
|
|
1547
|
-
}
|
|
1548
|
-
)
|
|
1549
|
-
};
|
|
1550
|
-
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1551
|
-
|
|
1552
|
-
// ../renderers/src/MarkdownRenderer.tsx
|
|
1553
|
-
var import_components23 = require("@transferwise/components");
|
|
1554
|
-
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1555
|
-
var MarkdownRenderer = {
|
|
1556
|
-
canRenderType: "markdown",
|
|
1557
|
-
render: ({ content, align, margin }) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components23.Markdown, { className: "np-text-body-large", config: { link: { target: "_blank" } }, children: content }) })
|
|
1558
|
-
};
|
|
1559
|
-
var MarkdownRenderer_default = MarkdownRenderer;
|
|
1560
|
-
|
|
1561
|
-
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
1562
|
-
var import_components24 = require("@transferwise/components");
|
|
1563
|
-
var import_react8 = require("react");
|
|
1564
|
-
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1565
|
-
var ModalLayoutRenderer = {
|
|
1566
|
-
canRenderType: "modal-layout",
|
|
1567
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DFModal, __spreadValues({}, props))
|
|
1568
|
-
};
|
|
1569
|
-
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
1570
|
-
function DFModal({ content, margin, trigger }) {
|
|
1571
|
-
const [visible, setVisible] = (0, import_react8.useState)(false);
|
|
1572
|
-
const { children, title } = content;
|
|
1573
|
-
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMargin(margin), children: [
|
|
1574
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components24.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
1575
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1576
|
-
import_components24.Modal,
|
|
1577
|
-
{
|
|
1578
|
-
scroll: "content",
|
|
1579
|
-
open: visible,
|
|
1580
|
-
size: "lg",
|
|
1581
|
-
title,
|
|
1582
|
-
body: children,
|
|
1583
|
-
onClose: () => setVisible(false)
|
|
1584
|
-
}
|
|
1585
|
-
)
|
|
1586
|
-
] });
|
|
1587
|
-
}
|
|
1588
|
-
|
|
1589
|
-
// ../renderers/src/ModalRenderer.tsx
|
|
1590
|
-
var import_components25 = require("@transferwise/components");
|
|
1591
|
-
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1592
|
-
var ModalRenderer = {
|
|
1593
|
-
canRenderType: "modal",
|
|
1594
|
-
render: ({ title, children, open, onClose }) => {
|
|
1595
|
-
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components25.Modal, { open, title, body: children, onClose });
|
|
1596
|
-
}
|
|
1597
|
-
};
|
|
1598
|
-
|
|
1599
|
-
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1600
|
-
var import_components26 = require("@transferwise/components");
|
|
1601
|
-
var import_react9 = require("react");
|
|
1602
|
-
var import_react_intl11 = require("react-intl");
|
|
1603
|
-
|
|
1604
|
-
// ../renderers/src/messages/multi-select.messages.ts
|
|
1605
|
-
var import_react_intl10 = require("react-intl");
|
|
1606
|
-
var multi_select_messages_default = (0, import_react_intl10.defineMessages)({
|
|
1607
|
-
summary: {
|
|
1608
|
-
id: "df.wise.MultiSelect.summary",
|
|
1609
|
-
defaultMessage: "{first} and {count} more",
|
|
1610
|
-
description: "A summary of the multiple items selected. Showing the title of the first selected item, and the number of other items that have been selected."
|
|
1611
|
-
}
|
|
1612
|
-
});
|
|
1613
|
-
|
|
1614
|
-
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1615
|
-
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1616
|
-
var MultiSelectInputRenderer = {
|
|
1617
|
-
canRenderType: "input-multi-select",
|
|
1618
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
1619
|
-
};
|
|
1620
|
-
function MultiSelectInputRendererComponent(props) {
|
|
1621
|
-
const { formatMessage } = (0, import_react_intl11.useIntl)();
|
|
1622
|
-
const [stagedIndices, setStagedIndices] = (0, import_react9.useState)();
|
|
1623
|
-
const {
|
|
1624
|
-
id,
|
|
1625
|
-
autoComplete,
|
|
1626
|
-
description,
|
|
1627
|
-
disabled,
|
|
1628
|
-
help,
|
|
1629
|
-
options,
|
|
1630
|
-
placeholder,
|
|
1631
|
-
selectedIndices,
|
|
1632
|
-
title,
|
|
1633
|
-
validationState,
|
|
1634
|
-
onSelect
|
|
1635
|
-
} = props;
|
|
1636
|
-
const mergedIndices = stagedIndices != null ? stagedIndices : selectedIndices;
|
|
1637
|
-
const getFormattedMessage = () => {
|
|
1638
|
-
if (mergedIndices.length > 0) {
|
|
1639
|
-
if (mergedIndices.length > 1) {
|
|
1640
|
-
return formatMessage(multi_select_messages_default.summary, {
|
|
1641
|
-
first: options[mergedIndices[0]].title,
|
|
1642
|
-
count: mergedIndices.length - 1
|
|
1643
|
-
});
|
|
1644
|
-
}
|
|
1645
|
-
return options[mergedIndices[0]].title;
|
|
1646
|
-
}
|
|
1647
|
-
return void 0;
|
|
1648
|
-
};
|
|
1649
|
-
const renderValue = (index, withinTrigger) => {
|
|
1650
|
-
const option = index >= 0 ? options[index] : null;
|
|
1651
|
-
if (option === null) {
|
|
1652
|
-
return null;
|
|
1653
|
-
}
|
|
1654
|
-
if (withinTrigger) {
|
|
1655
|
-
return index === mergedIndices[0] ? getFormattedMessage() : void 0;
|
|
1656
|
-
}
|
|
1657
|
-
const contentProps = {
|
|
1658
|
-
title: option.title,
|
|
1659
|
-
description: option.description,
|
|
1660
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
1661
|
-
};
|
|
1662
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components26.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
1663
|
-
};
|
|
1664
|
-
const extraProps = { autoComplete };
|
|
1665
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1666
|
-
FieldInput_default,
|
|
1667
|
-
{
|
|
1668
|
-
id,
|
|
1669
|
-
label: title,
|
|
1670
|
-
help,
|
|
1671
|
-
description,
|
|
1672
|
-
validation: validationState,
|
|
1673
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1674
|
-
import_components26.SelectInput,
|
|
1675
|
-
__spreadValues({
|
|
1676
|
-
id,
|
|
1677
|
-
items: options.map((option, index) => {
|
|
1678
|
-
var _a, _b, _c;
|
|
1679
|
-
return {
|
|
1680
|
-
type: "option",
|
|
1681
|
-
value: index,
|
|
1682
|
-
filterMatchers: [
|
|
1683
|
-
...(_a = option.keywords) != null ? _a : [],
|
|
1684
|
-
(_b = option.title) != null ? _b : "",
|
|
1685
|
-
(_c = option.description) != null ? _c : ""
|
|
1686
|
-
],
|
|
1687
|
-
disabled: option.disabled
|
|
1688
|
-
};
|
|
1689
|
-
}),
|
|
1690
|
-
disabled,
|
|
1691
|
-
placeholder,
|
|
1692
|
-
value: mergedIndices,
|
|
1693
|
-
renderValue,
|
|
1694
|
-
multiple: true,
|
|
1695
|
-
filterable: options.length >= 8,
|
|
1696
|
-
onChange: (values) => {
|
|
1697
|
-
setStagedIndices(values);
|
|
1698
|
-
},
|
|
1699
|
-
onClose: () => {
|
|
1700
|
-
if (stagedIndices) {
|
|
1701
|
-
onSelect(stagedIndices);
|
|
1702
|
-
setStagedIndices(void 0);
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
}, extraProps)
|
|
1706
|
-
)
|
|
1707
|
-
}
|
|
1708
|
-
);
|
|
1709
|
-
}
|
|
1710
|
-
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
1711
|
-
|
|
1712
|
-
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1713
|
-
var import_components28 = require("@transferwise/components");
|
|
1714
|
-
|
|
1715
|
-
// ../renderers/src/components/UploadFieldInput.tsx
|
|
1716
|
-
var import_components27 = require("@transferwise/components");
|
|
1717
|
-
var import_classnames4 = __toESM(require("classnames"));
|
|
1718
|
-
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1719
|
-
function UploadFieldInput({
|
|
1720
|
-
id,
|
|
1721
|
-
children,
|
|
1722
|
-
label,
|
|
1723
|
-
description,
|
|
1724
|
-
help,
|
|
1725
|
-
validation
|
|
1726
|
-
}) {
|
|
1727
|
-
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
1728
|
-
const descriptionId = description ? `${id}-description` : void 0;
|
|
1729
|
-
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
1730
|
-
"div",
|
|
1731
|
-
{
|
|
1732
|
-
className: (0, import_classnames4.default)("form-group d-block", {
|
|
1733
|
-
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
1734
|
-
}),
|
|
1735
|
-
children: [
|
|
1736
|
-
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
1737
|
-
children,
|
|
1738
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components27.InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
1739
|
-
]
|
|
1740
|
-
}
|
|
1741
|
-
);
|
|
1742
|
-
}
|
|
1743
|
-
var UploadFieldInput_default = UploadFieldInput;
|
|
1744
|
-
|
|
1745
|
-
// ../renderers/src/utils/file-utils.ts
|
|
1746
|
-
var acceptsToFileTypes = (accepts) => Array.isArray(accepts) && accepts.length >= 1 ? accepts : "*";
|
|
1747
|
-
var toKilobytes = (sizeInBytes) => {
|
|
1748
|
-
const ONE_KB_IN_BYTES = 1024;
|
|
1749
|
-
return Math.floor(sizeInBytes / ONE_KB_IN_BYTES);
|
|
1750
|
-
};
|
|
1751
|
-
var toFile = async (base64Url, name) => {
|
|
1752
|
-
const type = getFileType(base64Url);
|
|
1753
|
-
const blob = await toBlob(base64Url);
|
|
1754
|
-
return new File([blob], name, { type });
|
|
1755
|
-
};
|
|
1756
|
-
var toBlob = async (base64Url) => (await fetch(base64Url)).blob();
|
|
1757
|
-
var getFileType = (base64Url) => {
|
|
1758
|
-
const contentTypeRegex = /^data:(.+);/;
|
|
1759
|
-
const matches = contentTypeRegex.exec(base64Url);
|
|
1760
|
-
if (matches && matches.length > 1) {
|
|
1761
|
-
return matches[1];
|
|
1762
|
-
}
|
|
1763
|
-
return void 0;
|
|
1764
|
-
};
|
|
1765
|
-
var getSizeLimit = (maxSize) => {
|
|
1766
|
-
if (maxSize === void 0) {
|
|
1767
|
-
return null;
|
|
1768
|
-
}
|
|
1769
|
-
return toKilobytes(maxSize);
|
|
1770
|
-
};
|
|
1771
|
-
|
|
1772
|
-
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1773
|
-
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1774
|
-
var MultiUploadInputRenderer = {
|
|
1775
|
-
canRenderType: "input-upload-multi",
|
|
1776
|
-
render: (props) => {
|
|
1777
|
-
const {
|
|
1778
|
-
id,
|
|
1779
|
-
accepts,
|
|
1780
|
-
help,
|
|
1781
|
-
title,
|
|
1782
|
-
description,
|
|
1783
|
-
disabled,
|
|
1784
|
-
maxSize,
|
|
1785
|
-
maxItems,
|
|
1786
|
-
uploadLabel,
|
|
1787
|
-
validationState,
|
|
1788
|
-
value,
|
|
1789
|
-
onInsertFile,
|
|
1790
|
-
onRemoveFile
|
|
1791
|
-
} = props;
|
|
1792
|
-
const onUploadFile = async (formData) => {
|
|
1793
|
-
const file = formData.get("file");
|
|
1794
|
-
return onInsertFile(value.length, file).then((newId) => ({ id: newId }));
|
|
1795
|
-
};
|
|
1796
|
-
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
1797
|
-
const descriptionId = description ? `${id}-description` : void 0;
|
|
1798
|
-
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1799
|
-
UploadFieldInput_default,
|
|
1800
|
-
{
|
|
1801
|
-
id,
|
|
1802
|
-
label: title,
|
|
1803
|
-
description,
|
|
1804
|
-
validation: validationState,
|
|
1805
|
-
help,
|
|
1806
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1807
|
-
import_components28.UploadInput,
|
|
1808
|
-
{
|
|
1809
|
-
id,
|
|
1810
|
-
"aria-describedby": descriptionId,
|
|
1811
|
-
description,
|
|
1812
|
-
disabled,
|
|
1813
|
-
fileTypes: acceptsToFileTypes(accepts),
|
|
1814
|
-
maxFiles: maxItems,
|
|
1815
|
-
multiple: true,
|
|
1816
|
-
sizeLimit: getSizeLimit(maxSize),
|
|
1817
|
-
uploadButtonTitle: uploadLabel,
|
|
1818
|
-
onDeleteFile,
|
|
1819
|
-
onUploadFile
|
|
1820
|
-
}
|
|
1821
|
-
)
|
|
1822
|
-
}
|
|
1823
|
-
);
|
|
1824
|
-
}
|
|
1825
|
-
};
|
|
1826
|
-
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
1827
|
-
|
|
1828
|
-
// ../renderers/src/NumberInputRenderer.tsx
|
|
1829
|
-
var import_components29 = require("@transferwise/components");
|
|
1830
|
-
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
1831
|
-
var NumberInputRenderer = {
|
|
1832
|
-
canRenderType: "input-number",
|
|
1833
|
-
render: (props) => {
|
|
1834
|
-
const { id, title, description, help, media, validationState, value, onChange } = props;
|
|
1835
|
-
const commonProps = pick(
|
|
1836
|
-
props,
|
|
1837
|
-
"disabled",
|
|
1838
|
-
"onBlur",
|
|
1839
|
-
"onFocus",
|
|
1840
|
-
"placeholder",
|
|
1841
|
-
"maximum",
|
|
1842
|
-
"minimum"
|
|
1843
|
-
);
|
|
1844
|
-
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
1845
|
-
FieldInput_default,
|
|
1846
|
-
{
|
|
1847
|
-
id,
|
|
1848
|
-
label: title,
|
|
1849
|
-
description,
|
|
1850
|
-
validation: validationState,
|
|
1851
|
-
help,
|
|
1852
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components29.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
1853
|
-
import_components29.Input,
|
|
1854
|
-
__spreadValues({
|
|
1855
|
-
id,
|
|
1856
|
-
name: id,
|
|
1857
|
-
type: "number",
|
|
1858
|
-
value: value != null ? value : "",
|
|
1859
|
-
onChange: ({ target: { value: newValue } }) => {
|
|
1860
|
-
const parsedValue = Number.parseFloat(newValue);
|
|
1861
|
-
onChange(Number.isNaN(parsedValue) ? null : parsedValue);
|
|
1862
|
-
},
|
|
1863
|
-
onWheel
|
|
1864
|
-
}, commonProps)
|
|
1865
|
-
) })
|
|
1866
|
-
}
|
|
1867
|
-
);
|
|
1868
|
-
}
|
|
1869
|
-
};
|
|
1870
|
-
var NumberInputRenderer_default = NumberInputRenderer;
|
|
1871
|
-
|
|
1872
|
-
// ../renderers/src/ParagraphRenderer.tsx
|
|
1873
|
-
var import_react_intl13 = require("react-intl");
|
|
1874
|
-
|
|
1875
|
-
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
1876
|
-
var import_components30 = require("@transferwise/components");
|
|
1877
|
-
var import_react10 = require("react");
|
|
1878
|
-
function useSnackBarIfAvailable() {
|
|
1879
|
-
const context = (0, import_react10.useContext)(import_components30.SnackbarContext);
|
|
1880
|
-
return context ? context.createSnackbar : () => {
|
|
1881
|
-
};
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
// ../renderers/src/ParagraphRenderer.tsx
|
|
1885
|
-
var import_components31 = require("@transferwise/components");
|
|
1886
|
-
var import_classnames5 = __toESM(require("classnames"));
|
|
1887
|
-
|
|
1888
|
-
// ../renderers/src/messages/paragraph.messages.ts
|
|
1889
|
-
var import_react_intl12 = require("react-intl");
|
|
1890
|
-
var paragraph_messages_default = (0, import_react_intl12.defineMessages)({
|
|
1891
|
-
copy: {
|
|
1892
|
-
id: "df.wise.DynamicParagraph.copy",
|
|
1893
|
-
defaultMessage: "Copy",
|
|
1894
|
-
description: "Copy to clipboard button label."
|
|
1895
|
-
},
|
|
1896
|
-
copied: {
|
|
1897
|
-
id: "df.wise.DynamicParagraph.copied",
|
|
1898
|
-
defaultMessage: "Copied to clipboard",
|
|
1899
|
-
description: "Appears in a snackbar when the copy operation succeeds."
|
|
1900
|
-
}
|
|
1901
|
-
});
|
|
1902
|
-
|
|
1903
|
-
// ../renderers/src/ParagraphRenderer.tsx
|
|
1904
|
-
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1905
|
-
var ParagraphRenderer = {
|
|
1906
|
-
canRenderType: "paragraph",
|
|
1907
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Paragraph, __spreadValues({}, props))
|
|
1908
|
-
};
|
|
1909
|
-
function Paragraph({ align, control, margin, text }) {
|
|
1910
|
-
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1911
|
-
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(StandardParagraph, { className, text });
|
|
1912
|
-
}
|
|
1913
|
-
function StandardParagraph({ text, className }) {
|
|
1914
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("p", { className: `np-text-body-large ${className}`, children: text });
|
|
1915
|
-
}
|
|
1916
|
-
function CopyableParagraph({
|
|
1917
|
-
text,
|
|
1918
|
-
align,
|
|
1919
|
-
className
|
|
1920
|
-
}) {
|
|
1921
|
-
const { formatMessage } = (0, import_react_intl13.useIntl)();
|
|
1922
|
-
const createSnackbar = useSnackBarIfAvailable();
|
|
1923
|
-
const copy = () => {
|
|
1924
|
-
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
1925
|
-
});
|
|
1926
|
-
};
|
|
1927
|
-
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
1928
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("div", { className, children: [
|
|
1929
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
1930
|
-
import_components31.Input,
|
|
1931
|
-
{
|
|
1932
|
-
type: "text",
|
|
1933
|
-
value: text,
|
|
1934
|
-
readOnly: true,
|
|
1935
|
-
className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
|
|
1936
|
-
}
|
|
1937
|
-
),
|
|
1938
|
-
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components31.Button, { v2: true, block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
1939
|
-
] });
|
|
1940
|
-
}
|
|
1941
|
-
var ParagraphRenderer_default = ParagraphRenderer;
|
|
1942
|
-
|
|
1943
|
-
// ../renderers/src/RepeatableRenderer.tsx
|
|
1944
|
-
var import_components32 = require("@transferwise/components");
|
|
1945
|
-
var import_icons = require("@transferwise/icons");
|
|
1946
|
-
var import_classnames6 = __toESM(require("classnames"));
|
|
1947
|
-
var import_react11 = require("react");
|
|
1948
|
-
var import_react_intl15 = require("react-intl");
|
|
1949
|
-
|
|
1950
|
-
// ../renderers/src/messages/repeatable.messages.ts
|
|
1951
|
-
var import_react_intl14 = require("react-intl");
|
|
1952
|
-
var repeatable_messages_default = (0, import_react_intl14.defineMessages)({
|
|
1953
|
-
addItemTitle: {
|
|
1954
|
-
id: "df.wise.ArraySchema.addItemTitle",
|
|
1955
|
-
defaultMessage: "Add Item",
|
|
1956
|
-
description: "Label on the button used to open a form to add an item"
|
|
1957
|
-
},
|
|
1958
|
-
addItem: {
|
|
1959
|
-
id: "df.wise.ArraySchema.addItem",
|
|
1960
|
-
defaultMessage: "Save",
|
|
1961
|
-
description: "Label on the add button used to submit a form that adds an item"
|
|
1962
|
-
},
|
|
1963
|
-
editItem: {
|
|
1964
|
-
id: "df.wise.ArraySchema.editItem",
|
|
1965
|
-
defaultMessage: "Save",
|
|
1966
|
-
description: "Label on the edit button used to submit a form that edits an item"
|
|
1967
|
-
},
|
|
1968
|
-
removeItem: {
|
|
1969
|
-
id: "df.wise.ArraySchema.removeItem",
|
|
1970
|
-
defaultMessage: "Remove",
|
|
1971
|
-
description: "Label on the remove button used to confirm deletion of an item"
|
|
1972
|
-
}
|
|
1973
|
-
});
|
|
1974
|
-
|
|
1975
|
-
// ../renderers/src/RepeatableRenderer.tsx
|
|
1976
|
-
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1977
|
-
var RepeatableRenderer = {
|
|
1978
|
-
canRenderType: "repeatable",
|
|
1979
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Repeatable, __spreadValues({}, props))
|
|
1980
|
-
};
|
|
1981
|
-
function Repeatable(props) {
|
|
1982
|
-
const {
|
|
1983
|
-
addItemTitle,
|
|
1984
|
-
description,
|
|
1985
|
-
editableItem,
|
|
1986
|
-
editItemTitle,
|
|
1987
|
-
items,
|
|
1988
|
-
title,
|
|
1989
|
-
validationState,
|
|
1990
|
-
onEdit,
|
|
1991
|
-
onAdd,
|
|
1992
|
-
onSave,
|
|
1993
|
-
onRemove
|
|
1994
|
-
} = props;
|
|
1995
|
-
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
1996
|
-
const [openModalType, setOpenModalType] = (0, import_react11.useState)(null);
|
|
1997
|
-
const onAddItem = () => {
|
|
1998
|
-
onAdd();
|
|
1999
|
-
setOpenModalType("add");
|
|
2000
|
-
};
|
|
2001
|
-
const onEditItem = (itemIndex) => {
|
|
2002
|
-
onEdit(itemIndex);
|
|
2003
|
-
setOpenModalType("edit");
|
|
2004
|
-
};
|
|
2005
|
-
const onSaveItem = () => {
|
|
2006
|
-
const saveSuccessful = onSave();
|
|
2007
|
-
if (saveSuccessful) {
|
|
2008
|
-
setOpenModalType(null);
|
|
2009
|
-
}
|
|
2010
|
-
};
|
|
2011
|
-
const onRemoveItem = () => {
|
|
2012
|
-
onRemove();
|
|
2013
|
-
setOpenModalType(null);
|
|
2014
|
-
};
|
|
2015
|
-
const onCancelEdit = () => {
|
|
2016
|
-
setOpenModalType(null);
|
|
2017
|
-
};
|
|
2018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
2019
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components32.Header, { title }),
|
|
2020
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { children: description }),
|
|
2021
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
2022
|
-
"div",
|
|
2023
|
-
{
|
|
2024
|
-
className: (0, import_classnames6.default)("form-group", {
|
|
2025
|
-
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2026
|
-
}),
|
|
2027
|
-
children: [
|
|
2028
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
2029
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2030
|
-
import_components32.NavigationOption,
|
|
2031
|
-
{
|
|
2032
|
-
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_icons.Plus, {}),
|
|
2033
|
-
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2034
|
-
showMediaAtAllSizes: true,
|
|
2035
|
-
onClick: () => onAddItem()
|
|
2036
|
-
}
|
|
2037
|
-
),
|
|
2038
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components32.InlineAlert, { type: "negative", children: validationState.message })
|
|
2039
|
-
]
|
|
2040
|
-
}
|
|
2041
|
-
),
|
|
2042
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2043
|
-
import_components32.Modal,
|
|
2044
|
-
{
|
|
2045
|
-
open: openModalType !== null,
|
|
2046
|
-
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2047
|
-
body: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
2048
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
2049
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { children: [
|
|
2050
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components32.Button, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
2051
|
-
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2052
|
-
import_components32.Button,
|
|
2053
|
-
{
|
|
2054
|
-
v2: true,
|
|
2055
|
-
priority: "secondary",
|
|
2056
|
-
sentiment: "negative",
|
|
2057
|
-
block: true,
|
|
2058
|
-
onClick: () => onRemoveItem(),
|
|
2059
|
-
children: formatMessage(repeatable_messages_default.removeItem)
|
|
2060
|
-
}
|
|
2061
|
-
)
|
|
2062
|
-
] })
|
|
2063
|
-
] }),
|
|
2064
|
-
onClose: () => onCancelEdit()
|
|
2065
|
-
}
|
|
2066
|
-
)
|
|
2067
|
-
] });
|
|
2068
|
-
}
|
|
2069
|
-
function ItemSummaryOption({
|
|
2070
|
-
item,
|
|
2071
|
-
onClick
|
|
2072
|
-
}) {
|
|
2073
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2074
|
-
import_components32.NavigationOption,
|
|
2075
|
-
{
|
|
2076
|
-
media: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(OptionMedia, { media: item.media, preferAvatar: false }),
|
|
2077
|
-
title: item.title,
|
|
2078
|
-
content: item.description,
|
|
2079
|
-
showMediaAtAllSizes: true,
|
|
2080
|
-
onClick
|
|
2081
|
-
}
|
|
2082
|
-
);
|
|
2083
|
-
}
|
|
2084
|
-
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2085
|
-
|
|
2086
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2087
|
-
var import_components34 = require("@transferwise/components");
|
|
2088
|
-
|
|
2089
|
-
// ../renderers/src/components/Header.tsx
|
|
2090
|
-
var import_components33 = require("@transferwise/components");
|
|
2091
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2092
|
-
var Header7 = ({ title, callToAction }) => (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components33.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) });
|
|
2093
|
-
var getHeaderAction = (callToAction) => {
|
|
2094
|
-
if (!callToAction) {
|
|
2095
|
-
return void 0;
|
|
2096
|
-
}
|
|
2097
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2098
|
-
return href ? {
|
|
2099
|
-
"aria-label": accessibilityDescription,
|
|
2100
|
-
text: title,
|
|
2101
|
-
href,
|
|
2102
|
-
target: "_blank"
|
|
2103
|
-
} : {
|
|
2104
|
-
"aria-label": accessibilityDescription,
|
|
2105
|
-
text: title,
|
|
2106
|
-
onClick: (event) => {
|
|
2107
|
-
event.preventDefault();
|
|
2108
|
-
onClick();
|
|
2109
|
-
}
|
|
2110
|
-
};
|
|
2111
|
-
};
|
|
2112
|
-
|
|
2113
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2114
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2115
|
-
var ReviewRenderer = {
|
|
2116
|
-
canRenderType: "review",
|
|
2117
|
-
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2118
|
-
const orientation = mapControlToDefinitionListLayout(control);
|
|
2119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: getMargin(margin), children: [
|
|
2120
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Header7, { title, callToAction }),
|
|
2121
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2122
|
-
import_components34.DefinitionList,
|
|
2123
|
-
{
|
|
2124
|
-
layout: orientation,
|
|
2125
|
-
definitions: fields.map(
|
|
2126
|
-
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2127
|
-
key: String(index),
|
|
2128
|
-
value,
|
|
2129
|
-
title: getFieldLabel(
|
|
2130
|
-
label,
|
|
2131
|
-
help,
|
|
2132
|
-
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2133
|
-
)
|
|
2134
|
-
})
|
|
2135
|
-
)
|
|
2136
|
-
}
|
|
2137
|
-
) })
|
|
2138
|
-
] });
|
|
2139
|
-
}
|
|
2140
|
-
};
|
|
2141
|
-
var ReviewRenderer_default = ReviewRenderer;
|
|
2142
|
-
var mapControlToDefinitionListLayout = (control) => {
|
|
2143
|
-
switch (control) {
|
|
2144
|
-
case "horizontal":
|
|
2145
|
-
case "horizontal-end-aligned":
|
|
2146
|
-
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2147
|
-
case "horizontal-start-aligned":
|
|
2148
|
-
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2149
|
-
case "vertical-two-column":
|
|
2150
|
-
return "VERTICAL_TWO_COLUMN";
|
|
2151
|
-
case "vertical":
|
|
2152
|
-
case "vertical-one-column":
|
|
2153
|
-
default:
|
|
2154
|
-
return "VERTICAL_ONE_COLUMN";
|
|
2155
|
-
}
|
|
23
|
+
var __export = (target, all) => {
|
|
24
|
+
for (var name in all)
|
|
25
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
2156
26
|
};
|
|
2157
|
-
var
|
|
2158
|
-
if (
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Help_default, { help, onClick })
|
|
2163
|
-
] });
|
|
27
|
+
var __copyProps = (to, from, except, desc) => {
|
|
28
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
29
|
+
for (let key of __getOwnPropNames(from))
|
|
30
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
31
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
2164
32
|
}
|
|
2165
|
-
return
|
|
33
|
+
return to;
|
|
2166
34
|
};
|
|
35
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
2167
36
|
|
|
2168
|
-
//
|
|
2169
|
-
var
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2184
|
-
var import_react_intl18 = require("react-intl");
|
|
2185
|
-
|
|
2186
|
-
// ../renderers/src/messages/generic-error.messages.ts
|
|
2187
|
-
var import_react_intl17 = require("react-intl");
|
|
2188
|
-
var generic_error_messages_default = (0, import_react_intl17.defineMessages)({
|
|
2189
|
-
genericErrorRetryHint: {
|
|
2190
|
-
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2191
|
-
defaultMessage: "Something went wrong, please try again.",
|
|
2192
|
-
description: "Generic error message for persist async schema"
|
|
2193
|
-
},
|
|
2194
|
-
genericError: {
|
|
2195
|
-
id: "df.wise.ErrorBoundary.errorAlert",
|
|
2196
|
-
defaultMessage: "Something went wrong.",
|
|
2197
|
-
description: "Generic error message for when something has gone wrong."
|
|
2198
|
-
},
|
|
2199
|
-
retry: {
|
|
2200
|
-
id: "df.wise.ErrorBoundary.retry",
|
|
2201
|
-
defaultMessage: "Retry",
|
|
2202
|
-
description: "Usually this follows the generic error and contains a link."
|
|
2203
|
-
}
|
|
37
|
+
// src/index.ts
|
|
38
|
+
var index_exports = {};
|
|
39
|
+
__export(index_exports, {
|
|
40
|
+
DynamicFlowLegacy: () => DynamicFlowLegacy,
|
|
41
|
+
DynamicFlowRevamp: () => DynamicFlowRevamp,
|
|
42
|
+
DynamicForm: () => DynamicForm,
|
|
43
|
+
Header: () => import_dynamic_flow_renderers3.Header,
|
|
44
|
+
JsonSchemaForm: () => import_dynamic_flow_client4.JsonSchemaForm,
|
|
45
|
+
findRendererPropsByType: () => import_dynamic_flow_client4.findRendererPropsByType,
|
|
46
|
+
getButtonV2Renderers: () => import_dynamic_flow_renderers3.getButtonV2Renderers,
|
|
47
|
+
getListItemRenderers: () => import_dynamic_flow_renderers3.getListItemRenderers,
|
|
48
|
+
getMargin: () => import_dynamic_flow_renderers3.getMargin,
|
|
49
|
+
isValidSchema: () => import_dynamic_flow_client4.isValidSchema,
|
|
50
|
+
makeCustomFetch: () => import_dynamic_flow_client3.makeHttpClient,
|
|
51
|
+
translations: () => i18n_default
|
|
2204
52
|
});
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
2209
|
-
function ErrorResult({ state }) {
|
|
2210
|
-
const intl = (0, import_react_intl18.useIntl)();
|
|
2211
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("p", { className: "m-t-2", children: [
|
|
2212
|
-
intl.formatMessage(generic_error_messages_default.genericError),
|
|
2213
|
-
"\xA0",
|
|
2214
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components35.Link, { onClick: () => state.onRetry(), children: intl.formatMessage(generic_error_messages_default.retry) })
|
|
2215
|
-
] });
|
|
2216
|
-
}
|
|
2217
|
-
|
|
2218
|
-
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2219
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2220
|
-
function BlockSearchRendererComponent({
|
|
2221
|
-
id,
|
|
2222
|
-
isLoading,
|
|
2223
|
-
margin,
|
|
2224
|
-
query,
|
|
2225
|
-
state,
|
|
2226
|
-
title,
|
|
2227
|
-
trackEvent,
|
|
2228
|
-
onChange
|
|
2229
|
-
}) {
|
|
2230
|
-
const [hasSearched, setHasSearched] = (0, import_react12.useState)(false);
|
|
2231
|
-
const { formatMessage } = (0, import_react_intl19.useIntl)();
|
|
2232
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
2233
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2234
|
-
import_components36.Input,
|
|
2235
|
-
{
|
|
2236
|
-
id,
|
|
2237
|
-
name: id,
|
|
2238
|
-
type: "text",
|
|
2239
|
-
value: query,
|
|
2240
|
-
className: "m-t-1",
|
|
2241
|
-
onChange: ({ currentTarget: { value } }) => {
|
|
2242
|
-
if (!hasSearched) {
|
|
2243
|
-
setHasSearched(true);
|
|
2244
|
-
trackEvent("Search Started");
|
|
2245
|
-
}
|
|
2246
|
-
onChange(value);
|
|
2247
|
-
}
|
|
2248
|
-
}
|
|
2249
|
-
) }),
|
|
2250
|
-
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResultContent, { state, trackEvent })
|
|
2251
|
-
] });
|
|
2252
|
-
}
|
|
2253
|
-
function SearchResultContent({
|
|
2254
|
-
state,
|
|
2255
|
-
trackEvent
|
|
2256
|
-
}) {
|
|
2257
|
-
switch (state.type) {
|
|
2258
|
-
case "error":
|
|
2259
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ErrorResult, { state });
|
|
2260
|
-
case "results":
|
|
2261
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(SearchResults, { state, trackEvent });
|
|
2262
|
-
case "noResults":
|
|
2263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(EmptySearchResult, { state });
|
|
2264
|
-
case "pending":
|
|
2265
|
-
default:
|
|
2266
|
-
return null;
|
|
2267
|
-
}
|
|
2268
|
-
}
|
|
2269
|
-
function EmptySearchResult({ state }) {
|
|
2270
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components36.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2271
|
-
}
|
|
2272
|
-
function SearchResults({
|
|
2273
|
-
state,
|
|
2274
|
-
trackEvent
|
|
2275
|
-
}) {
|
|
2276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components36.NavigationOptionsList, { children: state.results.map((result) => {
|
|
2277
|
-
const { media } = result;
|
|
2278
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2279
|
-
import_components36.NavigationOption,
|
|
2280
|
-
{
|
|
2281
|
-
title: result.title,
|
|
2282
|
-
content: result.description,
|
|
2283
|
-
media: media ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(OptionMedia, { media, preferAvatar: false }) : void 0,
|
|
2284
|
-
showMediaCircle: false,
|
|
2285
|
-
showMediaAtAllSizes: true,
|
|
2286
|
-
onClick: () => {
|
|
2287
|
-
trackEvent("Search Result Selected", __spreadValues({
|
|
2288
|
-
type: result.type
|
|
2289
|
-
}, result.type === "action" ? { actionId: result.id } : {}));
|
|
2290
|
-
result.onClick();
|
|
2291
|
-
}
|
|
2292
|
-
},
|
|
2293
|
-
JSON.stringify(result)
|
|
2294
|
-
);
|
|
2295
|
-
}) });
|
|
2296
|
-
}
|
|
2297
|
-
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
2298
|
-
|
|
2299
|
-
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
2300
|
-
var import_components37 = require("@transferwise/components");
|
|
2301
|
-
var import_icons2 = require("@transferwise/icons");
|
|
2302
|
-
var import_react13 = require("react");
|
|
2303
|
-
var import_react_intl20 = require("react-intl");
|
|
2304
|
-
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2305
|
-
function InlineSearchRenderer({
|
|
2306
|
-
id,
|
|
2307
|
-
isLoading,
|
|
2308
|
-
margin,
|
|
2309
|
-
onChange,
|
|
2310
|
-
state,
|
|
2311
|
-
title,
|
|
2312
|
-
trackEvent
|
|
2313
|
-
}) {
|
|
2314
|
-
const [hasSearched, setHasSearched] = (0, import_react13.useState)(false);
|
|
2315
|
-
const intl = (0, import_react_intl20.useIntl)();
|
|
2316
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
2317
|
-
import_components37.Typeahead,
|
|
2318
|
-
{
|
|
2319
|
-
id: "typeahead-input-id",
|
|
2320
|
-
intl,
|
|
2321
|
-
name: "typeahead-input-name",
|
|
2322
|
-
size: "md",
|
|
2323
|
-
maxHeight: 100,
|
|
2324
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
2325
|
-
multiple: false,
|
|
2326
|
-
clearable: false,
|
|
2327
|
-
addon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_icons2.Search, { size: 24 }),
|
|
2328
|
-
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
2329
|
-
minQueryLength: 1,
|
|
2330
|
-
onChange: (values) => {
|
|
2331
|
-
if (values.length > 0) {
|
|
2332
|
-
const [updatedValue] = values;
|
|
2333
|
-
const { value: result } = updatedValue;
|
|
2334
|
-
if (result) {
|
|
2335
|
-
trackEvent("Search Result Selected", __spreadValues({
|
|
2336
|
-
type: result.type
|
|
2337
|
-
}, result.type === "action" ? { actionId: result.id } : {}));
|
|
2338
|
-
result.onClick();
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
},
|
|
2342
|
-
onInputChange: (query) => {
|
|
2343
|
-
if (!hasSearched) {
|
|
2344
|
-
setHasSearched(true);
|
|
2345
|
-
trackEvent("Search Started");
|
|
2346
|
-
}
|
|
2347
|
-
onChange(query);
|
|
2348
|
-
}
|
|
2349
|
-
}
|
|
2350
|
-
) }) });
|
|
2351
|
-
}
|
|
2352
|
-
function mapResultToTypeaheadOption(result) {
|
|
2353
|
-
return {
|
|
2354
|
-
label: result.title,
|
|
2355
|
-
secondary: result.description,
|
|
2356
|
-
value: result,
|
|
2357
|
-
clearQueryOnSelect: result.type === "action",
|
|
2358
|
-
keepFocusOnSelect: result.type === "search"
|
|
2359
|
-
};
|
|
2360
|
-
}
|
|
2361
|
-
function TypeaheadFooter({ state, isLoading }) {
|
|
2362
|
-
const { formatMessage } = (0, import_react_intl20.useIntl)();
|
|
2363
|
-
if (state.type === "noResults") {
|
|
2364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components37.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2365
|
-
}
|
|
2366
|
-
if (state.type === "error") {
|
|
2367
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ErrorResult, { state }) });
|
|
2368
|
-
}
|
|
2369
|
-
if (state.type === "pending" || isLoading) {
|
|
2370
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
2371
|
-
}
|
|
2372
|
-
return null;
|
|
2373
|
-
}
|
|
2374
|
-
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
2375
|
-
|
|
2376
|
-
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
2377
|
-
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2378
|
-
var SearchRenderer = {
|
|
2379
|
-
canRenderType: "search",
|
|
2380
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
2381
|
-
};
|
|
2382
|
-
var SearchRenderer_default = SearchRenderer;
|
|
2383
|
-
|
|
2384
|
-
// ../renderers/src/SectionRenderer.tsx
|
|
2385
|
-
var import_components38 = require("@transferwise/components");
|
|
2386
|
-
|
|
2387
|
-
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2388
|
-
var getHeaderAction2 = (callToAction) => {
|
|
2389
|
-
if (!callToAction) {
|
|
2390
|
-
return void 0;
|
|
2391
|
-
}
|
|
2392
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2393
|
-
return href ? {
|
|
2394
|
-
"aria-label": accessibilityDescription,
|
|
2395
|
-
text: title,
|
|
2396
|
-
href,
|
|
2397
|
-
target: "_blank"
|
|
2398
|
-
} : {
|
|
2399
|
-
"aria-label": accessibilityDescription,
|
|
2400
|
-
text: title,
|
|
2401
|
-
onClick: (event) => {
|
|
2402
|
-
event.preventDefault();
|
|
2403
|
-
onClick();
|
|
2404
|
-
}
|
|
2405
|
-
};
|
|
2406
|
-
};
|
|
2407
|
-
|
|
2408
|
-
// ../renderers/src/SectionRenderer.tsx
|
|
2409
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2410
|
-
var SectionRenderer = {
|
|
2411
|
-
canRenderType: "section",
|
|
2412
|
-
render: ({ children, callToAction, margin, title }) => {
|
|
2413
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("section", { className: getMargin(margin), children: [
|
|
2414
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components38.Header, { title: title != null ? title : "", action: getHeaderAction2(callToAction) }),
|
|
2415
|
-
children
|
|
2416
|
-
] });
|
|
2417
|
-
}
|
|
2418
|
-
};
|
|
2419
|
-
var SectionRenderer_default = SectionRenderer;
|
|
2420
|
-
|
|
2421
|
-
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
2422
|
-
var import_components39 = require("@transferwise/components");
|
|
2423
|
-
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2424
|
-
function RadioInputRendererComponent(props) {
|
|
2425
|
-
const {
|
|
2426
|
-
id,
|
|
2427
|
-
children,
|
|
2428
|
-
description,
|
|
2429
|
-
disabled,
|
|
2430
|
-
help,
|
|
2431
|
-
title,
|
|
2432
|
-
options,
|
|
2433
|
-
selectedIndex,
|
|
2434
|
-
validationState,
|
|
2435
|
-
onSelect
|
|
2436
|
-
} = props;
|
|
2437
|
-
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
2438
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2439
|
-
FieldInput_default,
|
|
2440
|
-
{
|
|
2441
|
-
id,
|
|
2442
|
-
label: title,
|
|
2443
|
-
help,
|
|
2444
|
-
description,
|
|
2445
|
-
validation: validationState,
|
|
2446
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
2447
|
-
import_components39.RadioGroup,
|
|
2448
|
-
{
|
|
2449
|
-
name: id,
|
|
2450
|
-
radios: options.map((option, index) => ({
|
|
2451
|
-
label: option.title,
|
|
2452
|
-
value: index,
|
|
2453
|
-
secondary: option.description,
|
|
2454
|
-
disabled: option.disabled || disabled,
|
|
2455
|
-
avatar: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2456
|
-
})),
|
|
2457
|
-
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
2458
|
-
onChange: onSelect
|
|
2459
|
-
},
|
|
2460
|
-
`${id}-${selectedIndex}`
|
|
2461
|
-
) })
|
|
2462
|
-
}
|
|
2463
|
-
),
|
|
2464
|
-
children
|
|
2465
|
-
] });
|
|
2466
|
-
}
|
|
2467
|
-
|
|
2468
|
-
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
2469
|
-
var import_components40 = require("@transferwise/components");
|
|
2470
|
-
var import_react14 = require("react");
|
|
2471
|
-
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2472
|
-
function TabInputRendererComponent(props) {
|
|
2473
|
-
const {
|
|
2474
|
-
id,
|
|
2475
|
-
children,
|
|
2476
|
-
description,
|
|
2477
|
-
disabled,
|
|
2478
|
-
help,
|
|
2479
|
-
title,
|
|
2480
|
-
options,
|
|
2481
|
-
selectedIndex,
|
|
2482
|
-
validationState,
|
|
2483
|
-
onSelect
|
|
2484
|
-
} = props;
|
|
2485
|
-
(0, import_react14.useEffect)(() => {
|
|
2486
|
-
if (!isValidIndex(selectedIndex, options.length)) {
|
|
2487
|
-
onSelect(0);
|
|
2488
|
-
}
|
|
2489
|
-
}, [selectedIndex, onSelect, options.length]);
|
|
2490
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
2491
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2492
|
-
FieldInput_default,
|
|
2493
|
-
{
|
|
2494
|
-
id,
|
|
2495
|
-
label: title,
|
|
2496
|
-
help,
|
|
2497
|
-
description,
|
|
2498
|
-
validation: validationState,
|
|
2499
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2500
|
-
import_components40.Tabs,
|
|
2501
|
-
{
|
|
2502
|
-
name: id,
|
|
2503
|
-
selected: selectedIndex != null ? selectedIndex : 0,
|
|
2504
|
-
tabs: options.map((option) => ({
|
|
2505
|
-
title: option.title,
|
|
2506
|
-
// if we pass null, we get some props-types console errors
|
|
2507
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
2508
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, {}),
|
|
2509
|
-
disabled: option.disabled || disabled
|
|
2510
|
-
})),
|
|
2511
|
-
onTabSelect: onSelect
|
|
2512
|
-
}
|
|
2513
|
-
)
|
|
2514
|
-
}
|
|
2515
|
-
),
|
|
2516
|
-
children
|
|
2517
|
-
] });
|
|
2518
|
-
}
|
|
2519
|
-
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
2520
|
-
|
|
2521
|
-
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
2522
|
-
var import_components41 = require("@transferwise/components");
|
|
2523
|
-
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2524
|
-
function SelectInputRendererComponent(props) {
|
|
2525
|
-
const {
|
|
2526
|
-
id,
|
|
2527
|
-
autoComplete,
|
|
2528
|
-
children,
|
|
2529
|
-
description,
|
|
2530
|
-
disabled,
|
|
2531
|
-
help,
|
|
2532
|
-
title,
|
|
2533
|
-
options,
|
|
2534
|
-
placeholder,
|
|
2535
|
-
required,
|
|
2536
|
-
selectedIndex,
|
|
2537
|
-
validationState,
|
|
2538
|
-
onSelect
|
|
2539
|
-
} = props;
|
|
2540
|
-
const items = options.map(
|
|
2541
|
-
(option, index) => {
|
|
2542
|
-
var _a, _b, _c;
|
|
2543
|
-
return {
|
|
2544
|
-
type: "option",
|
|
2545
|
-
value: index,
|
|
2546
|
-
filterMatchers: [...(_a = option.keywords) != null ? _a : [], (_b = option.title) != null ? _b : "", (_c = option.description) != null ? _c : ""],
|
|
2547
|
-
disabled: option.disabled
|
|
2548
|
-
};
|
|
2549
|
-
}
|
|
2550
|
-
);
|
|
2551
|
-
const renderValue = (index, withinTrigger) => {
|
|
2552
|
-
const option = index >= 0 ? options[index] : null;
|
|
2553
|
-
if (option === null) {
|
|
2554
|
-
return null;
|
|
2555
|
-
}
|
|
2556
|
-
const contentProps = withinTrigger ? {
|
|
2557
|
-
title: option.title,
|
|
2558
|
-
note: option.description,
|
|
2559
|
-
icon: getInlineMedia(option.media)
|
|
2560
|
-
} : {
|
|
2561
|
-
title: option.title,
|
|
2562
|
-
description: option.description,
|
|
2563
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(OptionMedia, { media: option.media, preferAvatar: false })
|
|
2564
|
-
};
|
|
2565
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components41.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2566
|
-
};
|
|
2567
|
-
const extraProps = { autoComplete };
|
|
2568
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
2569
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2570
|
-
FieldInput_default,
|
|
2571
|
-
{
|
|
2572
|
-
id,
|
|
2573
|
-
label: title,
|
|
2574
|
-
help,
|
|
2575
|
-
description,
|
|
2576
|
-
validation: validationState,
|
|
2577
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2578
|
-
import_components41.SelectInput,
|
|
2579
|
-
__spreadValues({
|
|
2580
|
-
name: id,
|
|
2581
|
-
placeholder,
|
|
2582
|
-
items,
|
|
2583
|
-
disabled,
|
|
2584
|
-
value: selectedIndex,
|
|
2585
|
-
renderValue,
|
|
2586
|
-
filterable: items.length >= 8,
|
|
2587
|
-
onChange: onSelect,
|
|
2588
|
-
onClear: required ? void 0 : () => onSelect(null)
|
|
2589
|
-
}, extraProps)
|
|
2590
|
-
)
|
|
2591
|
-
}
|
|
2592
|
-
),
|
|
2593
|
-
children
|
|
2594
|
-
] });
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
|
-
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
2598
|
-
var import_react15 = require("react");
|
|
2599
|
-
var import_components42 = require("@transferwise/components");
|
|
2600
|
-
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2601
|
-
function SegmentedInputRendererComponent(props) {
|
|
2602
|
-
const {
|
|
2603
|
-
id,
|
|
2604
|
-
children,
|
|
2605
|
-
description,
|
|
2606
|
-
help,
|
|
2607
|
-
title,
|
|
2608
|
-
options,
|
|
2609
|
-
selectedIndex,
|
|
2610
|
-
validationState,
|
|
2611
|
-
onSelect
|
|
2612
|
-
} = props;
|
|
2613
|
-
(0, import_react15.useEffect)(() => {
|
|
2614
|
-
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
2615
|
-
onSelect(0);
|
|
2616
|
-
}
|
|
2617
|
-
}, [selectedIndex, onSelect, options.length]);
|
|
2618
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
|
|
2619
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2620
|
-
FieldInput_default,
|
|
2621
|
-
{
|
|
2622
|
-
id,
|
|
2623
|
-
label: title,
|
|
2624
|
-
help,
|
|
2625
|
-
description,
|
|
2626
|
-
validation: validationState,
|
|
2627
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
2628
|
-
import_components42.SegmentedControl,
|
|
2629
|
-
{
|
|
2630
|
-
name: `${id}-segmented-control`,
|
|
2631
|
-
value: String(selectedIndex),
|
|
2632
|
-
mode: "view",
|
|
2633
|
-
segments: options.map((option, index) => ({
|
|
2634
|
-
id: String(index),
|
|
2635
|
-
value: String(index),
|
|
2636
|
-
label: option.title,
|
|
2637
|
-
controls: `${id}-children`
|
|
2638
|
-
})),
|
|
2639
|
-
onChange: (value) => onSelect(Number(value))
|
|
2640
|
-
}
|
|
2641
|
-
)
|
|
2642
|
-
}
|
|
2643
|
-
),
|
|
2644
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { id: `${id}-children`, children })
|
|
2645
|
-
] });
|
|
2646
|
-
}
|
|
2647
|
-
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2648
|
-
|
|
2649
|
-
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
2650
|
-
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2651
|
-
var SelectInputRenderer = {
|
|
2652
|
-
canRenderType: "input-select",
|
|
2653
|
-
render: (props) => {
|
|
2654
|
-
switch (props.control) {
|
|
2655
|
-
case "radio":
|
|
2656
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
2657
|
-
case "tab":
|
|
2658
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
2659
|
-
case "segmented":
|
|
2660
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
2661
|
-
case "select":
|
|
2662
|
-
default:
|
|
2663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
2664
|
-
}
|
|
2665
|
-
}
|
|
2666
|
-
};
|
|
2667
|
-
var SelectInputRenderer_default = SelectInputRenderer;
|
|
2668
|
-
|
|
2669
|
-
// ../renderers/src/StatusListRenderer.tsx
|
|
2670
|
-
var import_components43 = require("@transferwise/components");
|
|
2671
|
-
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
2672
|
-
var StatusListRenderer = {
|
|
2673
|
-
canRenderType: "status-list",
|
|
2674
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: getMargin(margin), children: [
|
|
2675
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components43.Header, { title, className: "m-b-2" }) : null,
|
|
2676
|
-
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
2677
|
-
import_components43.Summary,
|
|
2678
|
-
{
|
|
2679
|
-
title: itemTitle,
|
|
2680
|
-
description,
|
|
2681
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
2682
|
-
status: mapStatus(status),
|
|
2683
|
-
action: getSummaryAction(callToAction)
|
|
2684
|
-
},
|
|
2685
|
-
`${itemTitle}/${description || ""}`
|
|
2686
|
-
))
|
|
2687
|
-
] })
|
|
2688
|
-
};
|
|
2689
|
-
var StatusListRenderer_default = StatusListRenderer;
|
|
2690
|
-
var getSummaryAction = (callToAction) => {
|
|
2691
|
-
if (!callToAction) {
|
|
2692
|
-
return void 0;
|
|
2693
|
-
}
|
|
2694
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2695
|
-
if (!href) {
|
|
2696
|
-
return {
|
|
2697
|
-
"aria-label": accessibilityDescription,
|
|
2698
|
-
text: title,
|
|
2699
|
-
onClick
|
|
2700
|
-
};
|
|
2701
|
-
}
|
|
2702
|
-
return {
|
|
2703
|
-
"aria-label": accessibilityDescription,
|
|
2704
|
-
href,
|
|
2705
|
-
target: "_blank",
|
|
2706
|
-
text: title
|
|
2707
|
-
};
|
|
2708
|
-
};
|
|
2709
|
-
var mapStatus = (status) => {
|
|
2710
|
-
if (status === "not-done") {
|
|
2711
|
-
return "notDone";
|
|
2712
|
-
}
|
|
2713
|
-
return status;
|
|
2714
|
-
};
|
|
2715
|
-
|
|
2716
|
-
// ../renderers/src/utils/useCustomTheme.ts
|
|
2717
|
-
var import_components_theming = require("@wise/components-theming");
|
|
2718
|
-
var import_react16 = require("react");
|
|
2719
|
-
var ThemeRequiredEventName = "Theme Required";
|
|
2720
|
-
var useCustomTheme = (theme, trackEvent) => {
|
|
2721
|
-
const previousThemeHookValue = (0, import_components_theming.useTheme)();
|
|
2722
|
-
const previousTheme = (0, import_react16.useMemo)(() => previousThemeHookValue.theme, []);
|
|
2723
|
-
(0, import_react16.useEffect)(() => {
|
|
2724
|
-
trackEvent(ThemeRequiredEventName, { theme });
|
|
2725
|
-
return theme !== previousTheme ? () => {
|
|
2726
|
-
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
2727
|
-
} : () => {
|
|
2728
|
-
};
|
|
2729
|
-
}, []);
|
|
2730
|
-
};
|
|
2731
|
-
|
|
2732
|
-
// ../renderers/src/step/topbar/BackButton.tsx
|
|
2733
|
-
var import_components44 = require("@transferwise/components");
|
|
2734
|
-
var import_icons3 = require("@transferwise/icons");
|
|
2735
|
-
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
2736
|
-
function BackButton({ title, onClick }) {
|
|
2737
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_components44.IconButton, { priority: "tertiary", onClick, children: [
|
|
2738
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "sr-only", children: title }),
|
|
2739
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_icons3.ArrowLeft, {})
|
|
2740
|
-
] });
|
|
2741
|
-
}
|
|
2742
|
-
|
|
2743
|
-
// ../renderers/src/step/topbar/Toolbar.tsx
|
|
2744
|
-
var import_components45 = require("@transferwise/components");
|
|
2745
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
2746
|
-
var Toolbar = ({ items }) => {
|
|
2747
|
-
return (items == null ? void 0 : items.length) > 0 ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "df-toolbar", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ToolbarButton, __spreadValues({}, item), `${item.type}-${index}-${item.title}`)) }) : null;
|
|
2748
|
-
};
|
|
2749
|
-
function ToolbarButton(props) {
|
|
2750
|
-
return prefersMedia(props.control) ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(MediaToolbarButton, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TextToolbarButton, __spreadValues({}, props));
|
|
2751
|
-
}
|
|
2752
|
-
function MediaToolbarButton(props) {
|
|
2753
|
-
var _a;
|
|
2754
|
-
const { context, control, media, accessibilityDescription, disabled, onClick } = props;
|
|
2755
|
-
const priority = getIconButtonPriority(control);
|
|
2756
|
-
const type = getSentiment(context);
|
|
2757
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
2758
|
-
import_components45.IconButton,
|
|
2759
|
-
{
|
|
2760
|
-
className: "df-toolbar-button",
|
|
2761
|
-
disabled,
|
|
2762
|
-
priority,
|
|
2763
|
-
size: 32,
|
|
2764
|
-
type,
|
|
2765
|
-
onClick,
|
|
2766
|
-
children: [
|
|
2767
|
-
accessibilityDescription ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "sr-only", children: accessibilityDescription }) : null,
|
|
2768
|
-
media ? (_a = getAddonStart(media)) == null ? void 0 : _a.value : null
|
|
2769
|
-
]
|
|
2770
|
-
}
|
|
2771
|
-
);
|
|
2772
|
-
}
|
|
2773
|
-
function TextToolbarButton(props) {
|
|
2774
|
-
const { context, control, title, media, disabled, onClick } = props;
|
|
2775
|
-
const addonStart = media ? getAddonStart(media) : void 0;
|
|
2776
|
-
const priority = getPriority2(control);
|
|
2777
|
-
const sentiment = getSentiment(context);
|
|
2778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
2779
|
-
import_components45.Button,
|
|
2780
|
-
{
|
|
2781
|
-
v2: true,
|
|
2782
|
-
size: "sm",
|
|
2783
|
-
className: "df-toolbar-button",
|
|
2784
|
-
disabled,
|
|
2785
|
-
priority,
|
|
2786
|
-
addonStart,
|
|
2787
|
-
sentiment,
|
|
2788
|
-
onClick,
|
|
2789
|
-
children: title
|
|
2790
|
-
}
|
|
2791
|
-
);
|
|
2792
|
-
}
|
|
2793
|
-
var getAddonStart = (media) => {
|
|
2794
|
-
if (media.type === "avatar") {
|
|
2795
|
-
if (media.content.length > 0 && media.content[0].type === "uri" && isValidIconUrn(media.content[0].uri)) {
|
|
2796
|
-
return {
|
|
2797
|
-
type: "icon",
|
|
2798
|
-
value: getInlineMedia({
|
|
2799
|
-
type: "image",
|
|
2800
|
-
uri: media.content[0].uri
|
|
2801
|
-
})
|
|
2802
|
-
};
|
|
2803
|
-
}
|
|
2804
|
-
return void 0;
|
|
2805
|
-
}
|
|
2806
|
-
return { type: "icon", value: getInlineMedia(media) };
|
|
2807
|
-
};
|
|
2808
|
-
var getPriority2 = (control) => isKnownControl(control) ? control : "secondary";
|
|
2809
|
-
var prefersMedia = (control) => {
|
|
2810
|
-
return false;
|
|
2811
|
-
};
|
|
2812
|
-
var knownControls = ["primary", "secondary", "secondary-neutral"];
|
|
2813
|
-
var isKnownControl = (control) => control !== void 0 && knownControls.includes(control);
|
|
2814
|
-
var getSentiment = (context) => {
|
|
2815
|
-
return "default";
|
|
2816
|
-
};
|
|
2817
|
-
var getIconButtonPriority = (control) => {
|
|
2818
|
-
const priority = getPriority2(control);
|
|
2819
|
-
return priority === "secondary-neutral" ? "tertiary" : priority;
|
|
2820
|
-
};
|
|
2821
|
-
|
|
2822
|
-
// ../renderers/src/step/topbar/TopBar.tsx
|
|
2823
|
-
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
2824
|
-
function TopBar({ back, toolbar }) {
|
|
2825
|
-
return back || toolbar ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "d-flex m-b-2", children: [
|
|
2826
|
-
back ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BackButton, __spreadValues({}, back)) : null,
|
|
2827
|
-
toolbar ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Toolbar, __spreadValues({}, toolbar)) : null
|
|
2828
|
-
] }) : null;
|
|
2829
|
-
}
|
|
2830
|
-
|
|
2831
|
-
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
2832
|
-
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
2833
|
-
var SplashCelebrationStepRenderer = {
|
|
2834
|
-
canRenderType: "step",
|
|
2835
|
-
canRender: ({ control }) => control === "splash-celebration",
|
|
2836
|
-
render: SplashCelebrationStepRendererComponent
|
|
2837
|
-
};
|
|
2838
|
-
function SplashCelebrationStepRendererComponent(props) {
|
|
2839
|
-
const { back, toolbar, children, trackEvent } = props;
|
|
2840
|
-
useCustomTheme("forest-green", trackEvent);
|
|
2841
|
-
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2842
|
-
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(TopBar, { back, toolbar }),
|
|
2843
|
-
children
|
|
2844
|
-
] });
|
|
2845
|
-
}
|
|
2846
|
-
|
|
2847
|
-
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
2848
|
-
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
2849
|
-
var SplashStepRenderer = {
|
|
2850
|
-
canRenderType: "step",
|
|
2851
|
-
canRender: ({ control }) => control === "splash",
|
|
2852
|
-
render: SplashStepRendererComponent
|
|
2853
|
-
};
|
|
2854
|
-
function SplashStepRendererComponent(props) {
|
|
2855
|
-
const { back, toolbar, children } = props;
|
|
2856
|
-
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2857
|
-
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TopBar, { back, toolbar }),
|
|
2858
|
-
children
|
|
2859
|
-
] });
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
|
-
// ../renderers/src/step/StepRenderer.tsx
|
|
2863
|
-
var import_components46 = require("@transferwise/components");
|
|
2864
|
-
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
2865
|
-
var StepRenderer = {
|
|
2866
|
-
canRenderType: "step",
|
|
2867
|
-
render: StepRendererComponent
|
|
2868
|
-
};
|
|
2869
|
-
function StepRendererComponent(props) {
|
|
2870
|
-
const { back, description, error, title, children, toolbar } = props;
|
|
2871
|
-
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
2872
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(TopBar, { back, toolbar }),
|
|
2873
|
-
title || description ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "m-b-4", children: [
|
|
2874
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components46.Title, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
2875
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
|
|
2876
|
-
] }) : void 0,
|
|
2877
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components46.Alert, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
2878
|
-
children
|
|
2879
|
-
] });
|
|
2880
|
-
}
|
|
2881
|
-
|
|
2882
|
-
// ../renderers/src/TabsRenderer.tsx
|
|
2883
|
-
var import_components47 = require("@transferwise/components");
|
|
2884
|
-
var import_react17 = require("react");
|
|
2885
|
-
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
2886
|
-
var TabsRenderer = {
|
|
2887
|
-
canRenderType: "tabs",
|
|
2888
|
-
render: (props) => {
|
|
2889
|
-
switch (props.control) {
|
|
2890
|
-
case "segmented":
|
|
2891
|
-
if (props.tabs.length > 3) {
|
|
2892
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
2893
|
-
}
|
|
2894
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
2895
|
-
case "chips":
|
|
2896
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
2897
|
-
default:
|
|
2898
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
2899
|
-
}
|
|
2900
|
-
}
|
|
2901
|
-
};
|
|
2902
|
-
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
2903
|
-
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2905
|
-
import_components47.Tabs,
|
|
2906
|
-
{
|
|
2907
|
-
name: uid,
|
|
2908
|
-
selected: selectedIndex != null ? selectedIndex : 0,
|
|
2909
|
-
tabs: tabs.map((option) => ({
|
|
2910
|
-
title: option.title,
|
|
2911
|
-
disabled: false,
|
|
2912
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "m-t-2", children: [
|
|
2913
|
-
" ",
|
|
2914
|
-
option.children,
|
|
2915
|
-
" "
|
|
2916
|
-
] })
|
|
2917
|
-
})),
|
|
2918
|
-
onTabSelect: setSelectedIndex
|
|
2919
|
-
}
|
|
2920
|
-
) });
|
|
2921
|
-
}
|
|
2922
|
-
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
2923
|
-
var _a;
|
|
2924
|
-
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2925
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: getMargin(margin), children: [
|
|
2926
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2927
|
-
import_components47.SegmentedControl,
|
|
2928
|
-
{
|
|
2929
|
-
name: uid,
|
|
2930
|
-
value: String(selectedIndex),
|
|
2931
|
-
mode: "view",
|
|
2932
|
-
segments: tabs.map((tab, index) => ({
|
|
2933
|
-
id: String(index),
|
|
2934
|
-
value: String(index),
|
|
2935
|
-
label: tab.title,
|
|
2936
|
-
controls: `${uid}-children`
|
|
2937
|
-
})),
|
|
2938
|
-
onChange: (value) => setSelectedIndex(Number(value))
|
|
2939
|
-
}
|
|
2940
|
-
),
|
|
2941
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
2942
|
-
] });
|
|
2943
|
-
}
|
|
2944
|
-
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
2945
|
-
var _a;
|
|
2946
|
-
const [selectedIndex, setSelectedIndex] = (0, import_react17.useState)(0);
|
|
2947
|
-
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: getMargin(margin), children: [
|
|
2948
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
2949
|
-
import_components47.Chips,
|
|
2950
|
-
{
|
|
2951
|
-
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
2952
|
-
selected: selectedIndex,
|
|
2953
|
-
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
2954
|
-
}
|
|
2955
|
-
) }),
|
|
2956
|
-
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
2957
|
-
] });
|
|
2958
|
-
}
|
|
2959
|
-
|
|
2960
|
-
// ../renderers/src/TextInputRenderer.tsx
|
|
2961
|
-
var import_components49 = require("@transferwise/components");
|
|
2962
|
-
|
|
2963
|
-
// ../renderers/src/components/VariableTextInput.tsx
|
|
2964
|
-
var import_components48 = require("@transferwise/components");
|
|
2965
|
-
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
2966
|
-
var commonKeys = [
|
|
2967
|
-
"autoComplete",
|
|
2968
|
-
"autoCapitalize",
|
|
2969
|
-
"placeholder",
|
|
2970
|
-
"control",
|
|
2971
|
-
"disabled",
|
|
2972
|
-
"displayFormat",
|
|
2973
|
-
"id",
|
|
2974
|
-
"onBlur",
|
|
2975
|
-
"onFocus",
|
|
2976
|
-
"placeholder",
|
|
2977
|
-
"value"
|
|
2978
|
-
];
|
|
2979
|
-
function VariableTextInput(inputProps) {
|
|
2980
|
-
const { id, value, control, onChange } = inputProps;
|
|
2981
|
-
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
2982
|
-
switch (control) {
|
|
2983
|
-
case "email":
|
|
2984
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
2985
|
-
case "password":
|
|
2986
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
2987
|
-
case "numeric": {
|
|
2988
|
-
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
2989
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
2990
|
-
TextInput,
|
|
2991
|
-
__spreadProps(__spreadValues({}, numericProps), {
|
|
2992
|
-
onChange: (newValue) => {
|
|
2993
|
-
const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
|
|
2994
|
-
onChange(numericValueOrNull);
|
|
2995
|
-
}
|
|
2996
|
-
})
|
|
2997
|
-
);
|
|
2998
|
-
}
|
|
2999
|
-
case "phone-number":
|
|
3000
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components48.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
3001
|
-
default: {
|
|
3002
|
-
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
3003
|
-
}
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
function TextInput(props) {
|
|
3007
|
-
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
3008
|
-
const InputWithPattern = control === "textarea" ? import_components48.TextareaWithDisplayFormat : import_components48.InputWithDisplayFormat;
|
|
3009
|
-
const InputWithoutPattern = control === "textarea" ? import_components48.TextArea : import_components48.Input;
|
|
3010
|
-
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
// ../renderers/src/TextInputRenderer.tsx
|
|
3014
|
-
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
3015
|
-
var TextInputRenderer = {
|
|
3016
|
-
canRenderType: "input-text",
|
|
3017
|
-
render: (props) => {
|
|
3018
|
-
const _a = props, {
|
|
3019
|
-
id,
|
|
3020
|
-
title,
|
|
3021
|
-
description,
|
|
3022
|
-
help,
|
|
3023
|
-
media,
|
|
3024
|
-
validationState,
|
|
3025
|
-
value: initialValue,
|
|
3026
|
-
onChange
|
|
3027
|
-
} = _a, rest = __objRest(_a, [
|
|
3028
|
-
"id",
|
|
3029
|
-
"title",
|
|
3030
|
-
"description",
|
|
3031
|
-
"help",
|
|
3032
|
-
"media",
|
|
3033
|
-
"validationState",
|
|
3034
|
-
"value",
|
|
3035
|
-
"onChange"
|
|
3036
|
-
]);
|
|
3037
|
-
const value = initialValue != null ? initialValue : "";
|
|
3038
|
-
const inputProps = __spreadProps(__spreadValues({}, rest), {
|
|
3039
|
-
value,
|
|
3040
|
-
id,
|
|
3041
|
-
onChange: (newValue) => {
|
|
3042
|
-
if ((value != null ? value : "") !== (newValue != null ? newValue : "")) {
|
|
3043
|
-
onChange(newValue);
|
|
3044
|
-
}
|
|
3045
|
-
}
|
|
3046
|
-
});
|
|
3047
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
3048
|
-
FieldInput_default,
|
|
3049
|
-
{
|
|
3050
|
-
id,
|
|
3051
|
-
label: title,
|
|
3052
|
-
description,
|
|
3053
|
-
validation: validationState,
|
|
3054
|
-
help,
|
|
3055
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components49.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
3056
|
-
}
|
|
3057
|
-
);
|
|
3058
|
-
}
|
|
3059
|
-
};
|
|
3060
|
-
var TextInputRenderer_default = TextInputRenderer;
|
|
3061
|
-
|
|
3062
|
-
// ../renderers/src/UploadInputRenderer.tsx
|
|
3063
|
-
var import_components50 = require("@transferwise/components");
|
|
3064
|
-
|
|
3065
|
-
// ../renderers/src/utils/getRandomId.ts
|
|
3066
|
-
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
3067
|
-
|
|
3068
|
-
// ../renderers/src/UploadInputRenderer.tsx
|
|
3069
|
-
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
3070
|
-
var UploadInputRenderer = {
|
|
3071
|
-
canRenderType: "input-upload",
|
|
3072
|
-
render: (props) => {
|
|
3073
|
-
const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
|
|
3074
|
-
const onUploadFile = async (formData) => {
|
|
3075
|
-
const file = formData.get("file");
|
|
3076
|
-
return onUpload(file).then(() => ({
|
|
3077
|
-
id: getRandomId()
|
|
3078
|
-
}));
|
|
3079
|
-
};
|
|
3080
|
-
const onDeleteFile = async () => {
|
|
3081
|
-
await onUpload(null);
|
|
3082
|
-
};
|
|
3083
|
-
return (
|
|
3084
|
-
// We don't pass help here as there is no sensible place to display it
|
|
3085
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
3086
|
-
UploadFieldInput_default,
|
|
3087
|
-
{
|
|
3088
|
-
id,
|
|
3089
|
-
label: void 0,
|
|
3090
|
-
description: void 0,
|
|
3091
|
-
validation: validationState,
|
|
3092
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
3093
|
-
import_components50.UploadInput,
|
|
3094
|
-
{
|
|
3095
|
-
id,
|
|
3096
|
-
description,
|
|
3097
|
-
disabled,
|
|
3098
|
-
sizeLimit: getSizeLimit(maxSize),
|
|
3099
|
-
fileTypes: acceptsToFileTypes(accepts),
|
|
3100
|
-
uploadButtonTitle: title,
|
|
3101
|
-
onDeleteFile,
|
|
3102
|
-
onUploadFile
|
|
3103
|
-
}
|
|
3104
|
-
)
|
|
3105
|
-
}
|
|
3106
|
-
)
|
|
3107
|
-
);
|
|
3108
|
-
}
|
|
3109
|
-
};
|
|
3110
|
-
var LargeUploadRenderer = {
|
|
3111
|
-
canRenderType: "input-upload",
|
|
3112
|
-
canRender: (props) => props.control === "upload-large",
|
|
3113
|
-
render: (props) => {
|
|
3114
|
-
const _a = props, {
|
|
3115
|
-
id,
|
|
3116
|
-
accepts,
|
|
3117
|
-
control,
|
|
3118
|
-
title,
|
|
3119
|
-
description,
|
|
3120
|
-
disabled,
|
|
3121
|
-
help,
|
|
3122
|
-
type,
|
|
3123
|
-
validationState,
|
|
3124
|
-
maxSize = null,
|
|
3125
|
-
onUpload
|
|
3126
|
-
} = _a, rest = __objRest(_a, [
|
|
3127
|
-
"id",
|
|
3128
|
-
"accepts",
|
|
3129
|
-
"control",
|
|
3130
|
-
"title",
|
|
3131
|
-
"description",
|
|
3132
|
-
"disabled",
|
|
3133
|
-
"help",
|
|
3134
|
-
"type",
|
|
3135
|
-
"validationState",
|
|
3136
|
-
"maxSize",
|
|
3137
|
-
"onUpload"
|
|
3138
|
-
]);
|
|
3139
|
-
const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id, maxSize });
|
|
3140
|
-
const onUploadFile = async (file, fileName) => {
|
|
3141
|
-
try {
|
|
3142
|
-
const convertedFile = file ? await toFile(file, fileName) : null;
|
|
3143
|
-
await onUpload(convertedFile);
|
|
3144
|
-
} catch (e) {
|
|
3145
|
-
await onUpload(null);
|
|
3146
|
-
throw e;
|
|
3147
|
-
}
|
|
3148
|
-
};
|
|
3149
|
-
const filetypes = acceptsToFileTypes(accepts);
|
|
3150
|
-
const usAccept = filetypes === "*" ? "*" : filetypes.join(",");
|
|
3151
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
3152
|
-
FieldInput_default,
|
|
3153
|
-
{
|
|
3154
|
-
id,
|
|
3155
|
-
label: title,
|
|
3156
|
-
description,
|
|
3157
|
-
validation: validationState,
|
|
3158
|
-
help,
|
|
3159
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
3160
|
-
import_components50.Upload,
|
|
3161
|
-
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3162
|
-
usAccept,
|
|
3163
|
-
usDisabled: disabled,
|
|
3164
|
-
onSuccess: onUploadFile,
|
|
3165
|
-
onFailure: async () => onUpload(null),
|
|
3166
|
-
onCancel: async () => onUpload(null)
|
|
3167
|
-
})
|
|
3168
|
-
)
|
|
3169
|
-
}
|
|
3170
|
-
);
|
|
3171
|
-
}
|
|
3172
|
-
};
|
|
3173
|
-
|
|
3174
|
-
// ../renderers/src/NewListItem/NewDecisionRenderer.tsx
|
|
3175
|
-
var import_components53 = require("@transferwise/components");
|
|
3176
|
-
|
|
3177
|
-
// ../renderers/src/NewListItem/getInlineAlert.tsx
|
|
3178
|
-
var import_components51 = require("@transferwise/components");
|
|
3179
|
-
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
3180
|
-
var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_components51.ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
|
|
3181
|
-
|
|
3182
|
-
// ../renderers/src/NewListItem/getMedia.tsx
|
|
3183
|
-
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
3184
|
-
var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(OptionMedia, { media, preferAvatar }) : void 0;
|
|
3185
|
-
|
|
3186
|
-
// ../renderers/src/NewListItem/getAdditionalInfo.tsx
|
|
3187
|
-
var import_components52 = require("@transferwise/components");
|
|
3188
|
-
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
3189
|
-
var getAdditionalInfo = (additionalInfo) => {
|
|
3190
|
-
if (!additionalInfo) {
|
|
3191
|
-
return void 0;
|
|
3192
|
-
}
|
|
3193
|
-
const { href, text, onClick } = additionalInfo;
|
|
3194
|
-
if (href || onClick) {
|
|
3195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
3196
|
-
import_components52.ListItem.AdditionalInfo,
|
|
3197
|
-
{
|
|
3198
|
-
action: {
|
|
3199
|
-
label: text,
|
|
3200
|
-
href,
|
|
3201
|
-
onClick,
|
|
3202
|
-
target: "_blank"
|
|
3203
|
-
}
|
|
3204
|
-
}
|
|
3205
|
-
);
|
|
3206
|
-
}
|
|
3207
|
-
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components52.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text });
|
|
3208
|
-
};
|
|
3209
|
-
|
|
3210
|
-
// ../renderers/src/NewListItem/NewDecisionRenderer.tsx
|
|
3211
|
-
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
3212
|
-
var DecisionRenderer2 = {
|
|
3213
|
-
canRenderType: "decision",
|
|
3214
|
-
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(DecisionWrapper, __spreadProps(__spreadValues({}, props), { renderDecisionList: renderDecisionList2 }))
|
|
3215
|
-
};
|
|
3216
|
-
var renderDecisionList2 = ({ options, control }) => {
|
|
3217
|
-
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_jsx_runtime76.Fragment, { children: options.map((option) => {
|
|
3218
|
-
const {
|
|
3219
|
-
description,
|
|
3220
|
-
disabled,
|
|
3221
|
-
media,
|
|
3222
|
-
title: itemTitle,
|
|
3223
|
-
tag,
|
|
3224
|
-
href,
|
|
3225
|
-
additionalText,
|
|
3226
|
-
inlineAlert,
|
|
3227
|
-
supportingValues,
|
|
3228
|
-
onClick
|
|
3229
|
-
} = option;
|
|
3230
|
-
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
3231
|
-
import_components53.ListItem,
|
|
3232
|
-
{
|
|
3233
|
-
title: itemTitle,
|
|
3234
|
-
subtitle: description,
|
|
3235
|
-
spotlight: control === "spotlight" ? tag === "spotlight-active" ? "active" : "inactive" : void 0,
|
|
3236
|
-
disabled,
|
|
3237
|
-
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3238
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3239
|
-
media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
|
|
3240
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3241
|
-
additionalInfo: additionalText ? getAdditionalInfo({ text: additionalText }) : void 0,
|
|
3242
|
-
control: href ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components53.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components53.ListItem.Navigation, { onClick })
|
|
3243
|
-
},
|
|
3244
|
-
JSON.stringify(option)
|
|
3245
|
-
);
|
|
3246
|
-
}) });
|
|
3247
|
-
};
|
|
3248
|
-
var NewDecisionRenderer_default = DecisionRenderer2;
|
|
3249
|
-
|
|
3250
|
-
// ../renderers/src/NewListItem/NewListRenderer.tsx
|
|
3251
|
-
var import_components54 = require("@transferwise/components");
|
|
3252
|
-
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
3253
|
-
var ListRenderer2 = {
|
|
3254
|
-
canRenderType: "list",
|
|
3255
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: getMargin(margin), children: [
|
|
3256
|
-
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Header7, { title, callToAction }),
|
|
3257
|
-
items.map((item) => {
|
|
3258
|
-
const {
|
|
3259
|
-
title: itemTitle,
|
|
3260
|
-
description,
|
|
3261
|
-
supportingValues,
|
|
3262
|
-
media,
|
|
3263
|
-
tag,
|
|
3264
|
-
additionalInfo,
|
|
3265
|
-
inlineAlert
|
|
3266
|
-
} = item;
|
|
3267
|
-
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
3268
|
-
import_components54.ListItem,
|
|
3269
|
-
{
|
|
3270
|
-
title: itemTitle,
|
|
3271
|
-
subtitle: description,
|
|
3272
|
-
valueTitle: supportingValues == null ? void 0 : supportingValues.value,
|
|
3273
|
-
valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
|
|
3274
|
-
media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
|
|
3275
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3276
|
-
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3277
|
-
},
|
|
3278
|
-
itemTitle
|
|
3279
|
-
);
|
|
3280
|
-
})
|
|
3281
|
-
] })
|
|
3282
|
-
};
|
|
3283
|
-
var NewListRenderer_default = ListRenderer2;
|
|
3284
|
-
|
|
3285
|
-
// ../renderers/src/NewListItem/NewReviewRenderer.tsx
|
|
3286
|
-
var import_components55 = require("@transferwise/components");
|
|
3287
|
-
var import_icons4 = require("@transferwise/icons");
|
|
3288
|
-
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
3289
|
-
var IGNORED_CONTROLS = [
|
|
3290
|
-
"horizontal",
|
|
3291
|
-
"horizontal-end-aligned",
|
|
3292
|
-
"horizontal-start-aligned",
|
|
3293
|
-
"vertical-two-column"
|
|
3294
|
-
];
|
|
3295
|
-
var ReviewRenderer2 = {
|
|
3296
|
-
canRenderType: "review",
|
|
3297
|
-
canRender: ({ control }) => control ? !IGNORED_CONTROLS.includes(control) : true,
|
|
3298
|
-
render: ({ callToAction, control, margin, fields, title }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: getMargin(margin), children: [
|
|
3299
|
-
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Header7, { title, callToAction }),
|
|
3300
|
-
fields.map((field) => {
|
|
3301
|
-
var _a;
|
|
3302
|
-
const {
|
|
3303
|
-
label,
|
|
3304
|
-
value,
|
|
3305
|
-
media,
|
|
3306
|
-
tag,
|
|
3307
|
-
additionalInfo,
|
|
3308
|
-
inlineAlert,
|
|
3309
|
-
help,
|
|
3310
|
-
callToAction: itemCallToAction
|
|
3311
|
-
} = field;
|
|
3312
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
3313
|
-
import_components55.ListItem,
|
|
3314
|
-
{
|
|
3315
|
-
title: value,
|
|
3316
|
-
subtitle: label,
|
|
3317
|
-
inverted: true,
|
|
3318
|
-
media: getMedia(media, control === "with-avatar" || tag === "with-avatar"),
|
|
3319
|
-
control: (_a = getCTAControl(itemCallToAction)) != null ? _a : getHelpControl(help),
|
|
3320
|
-
prompt: getInlineAlert(inlineAlert),
|
|
3321
|
-
additionalInfo: getAdditionalInfo(additionalInfo)
|
|
3322
|
-
},
|
|
3323
|
-
JSON.stringify(field)
|
|
3324
|
-
);
|
|
3325
|
-
})
|
|
3326
|
-
] })
|
|
3327
|
-
};
|
|
3328
|
-
var getCTAControl = (callToAction) => {
|
|
3329
|
-
if (!callToAction) {
|
|
3330
|
-
return void 0;
|
|
3331
|
-
}
|
|
3332
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
3333
|
-
if (href) {
|
|
3334
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.Button, { href, partiallyInteractive: true, "aria-description": accessibilityDescription, children: title });
|
|
3335
|
-
}
|
|
3336
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
3337
|
-
import_components55.ListItem.Button,
|
|
3338
|
-
{
|
|
3339
|
-
"aria-description": accessibilityDescription,
|
|
3340
|
-
partiallyInteractive: true,
|
|
3341
|
-
onClick,
|
|
3342
|
-
children: title
|
|
3343
|
-
}
|
|
3344
|
-
);
|
|
3345
|
-
};
|
|
3346
|
-
var getHelpControl = (help) => {
|
|
3347
|
-
if (!help) {
|
|
3348
|
-
return void 0;
|
|
3349
|
-
}
|
|
3350
|
-
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.Popover, { content: help, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components55.ListItem.IconButton, { partiallyInteractive: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_icons4.QuestionMarkCircle, {}) }) });
|
|
3351
|
-
};
|
|
3352
|
-
var NewReviewRenderer_default = ReviewRenderer2;
|
|
3353
|
-
|
|
3354
|
-
// ../renderers/src/NewListItem/NewStatusListRenderer.tsx
|
|
3355
|
-
var import_components56 = require("@transferwise/components");
|
|
3356
|
-
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
3357
|
-
var NewStatusListRenderer = {
|
|
3358
|
-
canRenderType: "status-list",
|
|
3359
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: getMargin(margin), children: [
|
|
3360
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.Header, { title, className: "m-b-2" }) : null,
|
|
3361
|
-
items.map((item) => {
|
|
3362
|
-
const { callToAction, description, icon, status, title: itemTitle } = item;
|
|
3363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3364
|
-
import_components56.ListItem,
|
|
3365
|
-
{
|
|
3366
|
-
title: itemTitle,
|
|
3367
|
-
subtitle: description,
|
|
3368
|
-
media: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components56.AvatarView, { badge: { status: mapStatus2(status) }, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DynamicIcon_default, { name: icon.name }) }) : void 0,
|
|
3369
|
-
additionalInfo: callToAction ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
3370
|
-
import_components56.ListItem.AdditionalInfo,
|
|
3371
|
-
{
|
|
3372
|
-
action: {
|
|
3373
|
-
href: callToAction.href,
|
|
3374
|
-
onClick: callToAction.href ? void 0 : callToAction.onClick,
|
|
3375
|
-
label: callToAction.title,
|
|
3376
|
-
target: "_blank"
|
|
3377
|
-
}
|
|
3378
|
-
}
|
|
3379
|
-
) : void 0
|
|
3380
|
-
},
|
|
3381
|
-
JSON.stringify(item)
|
|
3382
|
-
);
|
|
3383
|
-
})
|
|
3384
|
-
] })
|
|
3385
|
-
};
|
|
3386
|
-
var mapStatus2 = (status) => {
|
|
3387
|
-
switch (status) {
|
|
3388
|
-
case "done":
|
|
3389
|
-
return "positive";
|
|
3390
|
-
case "pending":
|
|
3391
|
-
return "pending";
|
|
3392
|
-
default:
|
|
3393
|
-
return void 0;
|
|
3394
|
-
}
|
|
3395
|
-
};
|
|
3396
|
-
var NewStatusListRenderer_default = NewStatusListRenderer;
|
|
3397
|
-
|
|
3398
|
-
// ../renderers/src/ButtonRenderer/ButtonRendererV2.tsx
|
|
3399
|
-
var import_components57 = require("@transferwise/components");
|
|
3400
|
-
|
|
3401
|
-
// ../renderers/src/utils/isButtonPriority.ts
|
|
3402
|
-
var validPriorities = ["primary", "secondary", "secondary-neutral", "tertiary"];
|
|
3403
|
-
var isButtonPriority = (control) => validPriorities.includes(control);
|
|
3404
|
-
|
|
3405
|
-
// ../renderers/src/ButtonRenderer/ButtonRendererV2.tsx
|
|
3406
|
-
var import_react18 = require("react");
|
|
3407
|
-
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
3408
|
-
var ButtonRendererV2 = {
|
|
3409
|
-
canRenderType: "button",
|
|
3410
|
-
render: ButtonComponent2
|
|
3411
|
-
};
|
|
3412
|
-
function ButtonComponent2(props) {
|
|
3413
|
-
const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
|
|
3414
|
-
const [spinny, setSpinny] = (0, import_react18.useState)(false);
|
|
3415
|
-
(0, import_react18.useEffect)(() => {
|
|
3416
|
-
if (stepLoadingState === "idle") {
|
|
3417
|
-
setSpinny(false);
|
|
3418
|
-
}
|
|
3419
|
-
}, [stepLoadingState]);
|
|
3420
|
-
const loading = spinny && stepLoadingState !== "idle";
|
|
3421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
3422
|
-
import_components57.Button,
|
|
3423
|
-
{
|
|
3424
|
-
v2: true,
|
|
3425
|
-
block: true,
|
|
3426
|
-
className: getMargin(margin),
|
|
3427
|
-
disabled,
|
|
3428
|
-
priority: getPriority3(control),
|
|
3429
|
-
loading,
|
|
3430
|
-
size: mapButtonSize(size),
|
|
3431
|
-
sentiment: getSentiment2(context),
|
|
3432
|
-
onClick: () => {
|
|
3433
|
-
setSpinny(true);
|
|
3434
|
-
onClick();
|
|
3435
|
-
},
|
|
3436
|
-
children: title
|
|
3437
|
-
}
|
|
3438
|
-
);
|
|
3439
|
-
}
|
|
3440
|
-
var getSentiment2 = (context) => context === "negative" ? "negative" : "default";
|
|
3441
|
-
var getPriority3 = (control) => control && isButtonPriority(control) ? control : "secondary";
|
|
3442
|
-
|
|
3443
|
-
// ../renderers/src/ProgressRenderer.tsx
|
|
3444
|
-
var import_components58 = require("@transferwise/components");
|
|
3445
|
-
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
3446
|
-
var ProgressRenderer = {
|
|
3447
|
-
canRenderType: "progress",
|
|
3448
|
-
render: ({ uid, title, help, progress, progressText, margin, description }) => {
|
|
3449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
3450
|
-
import_components58.ProgressBar,
|
|
3451
|
-
{
|
|
3452
|
-
id: uid,
|
|
3453
|
-
className: getMargin(margin),
|
|
3454
|
-
title: title && help ? /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(LabelContentWithHelp, { text: title, help }) : title,
|
|
3455
|
-
description,
|
|
3456
|
-
progress: {
|
|
3457
|
-
max: 1,
|
|
3458
|
-
value: progress
|
|
3459
|
-
},
|
|
3460
|
-
textEnd: progressText
|
|
3461
|
-
}
|
|
3462
|
-
);
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
|
|
3466
|
-
// ../renderers/src/getWiseRenderers.ts
|
|
3467
|
-
var getListItemRenderers = () => [
|
|
3468
|
-
NewDecisionRenderer_default,
|
|
3469
|
-
NewListRenderer_default,
|
|
3470
|
-
NewReviewRenderer_default,
|
|
3471
|
-
NewStatusListRenderer_default
|
|
3472
|
-
];
|
|
3473
|
-
var getButtonV2Renderers = () => [ButtonRendererV2];
|
|
3474
|
-
var getWiseRenderers = () => [
|
|
3475
|
-
AddressValidationButtonRenderer_default,
|
|
3476
|
-
AlertRenderer_default,
|
|
3477
|
-
CheckboxInputRenderer_default,
|
|
3478
|
-
BoxRenderer_default,
|
|
3479
|
-
ButtonRenderer,
|
|
3480
|
-
ColumnsRenderer_default,
|
|
3481
|
-
DateInputRenderer_default,
|
|
3482
|
-
DecisionRenderer_default,
|
|
3483
|
-
DividerRenderer_default,
|
|
3484
|
-
ExternalConfirmationRenderer_default,
|
|
3485
|
-
FormRenderer_default,
|
|
3486
|
-
FormSectionRenderer_default,
|
|
3487
|
-
HeadingRenderer_default,
|
|
3488
|
-
ImageRenderer_default,
|
|
3489
|
-
InstructionsRenderer_default,
|
|
3490
|
-
IntegerInputRenderer_default,
|
|
3491
|
-
LargeUploadRenderer,
|
|
3492
|
-
ListRenderer_default,
|
|
3493
|
-
LoadingIndicatorRenderer_default,
|
|
3494
|
-
MarkdownRenderer_default,
|
|
3495
|
-
ModalRenderer,
|
|
3496
|
-
ModalLayoutRenderer_default,
|
|
3497
|
-
MultiSelectInputRenderer_default,
|
|
3498
|
-
MultiUploadInputRenderer_default,
|
|
3499
|
-
NumberInputRenderer_default,
|
|
3500
|
-
ParagraphRenderer_default,
|
|
3501
|
-
ProgressRenderer,
|
|
3502
|
-
RepeatableRenderer_default,
|
|
3503
|
-
ReviewRenderer_default,
|
|
3504
|
-
SearchRenderer_default,
|
|
3505
|
-
SelectInputRenderer_default,
|
|
3506
|
-
SectionRenderer_default,
|
|
3507
|
-
StatusListRenderer_default,
|
|
3508
|
-
TabsRenderer,
|
|
3509
|
-
TextInputRenderer_default,
|
|
3510
|
-
UploadInputRenderer,
|
|
3511
|
-
SplashStepRenderer,
|
|
3512
|
-
SplashCelebrationStepRenderer,
|
|
3513
|
-
StepRenderer
|
|
3514
|
-
];
|
|
3515
|
-
|
|
3516
|
-
// src/dynamicFlow/renderers.ts
|
|
3517
|
-
var Header11 = Header7;
|
|
3518
|
-
var getMargin2 = getMargin;
|
|
3519
|
-
var getListItemRenderers2 = getListItemRenderers;
|
|
3520
|
-
var getButtonV2Renderers2 = getButtonV2Renderers;
|
|
53
|
+
module.exports = __toCommonJS(index_exports);
|
|
54
|
+
var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
|
|
55
|
+
var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
|
|
56
|
+
var import_dynamic_flow_renderers3 = require("@wise/dynamic-flow-renderers");
|
|
3521
57
|
|
|
3522
58
|
// src/i18n/index.ts
|
|
3523
59
|
var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
|
|
@@ -3769,7 +305,7 @@ var hu_default = {
|
|
|
3769
305
|
"df.wise.CopyFeedback.copy": "V\xE1g\xF3lapra m\xE1solva",
|
|
3770
306
|
"df.wise.CopyFeedback.copyFailed": "Nem siker\xFClt a v\xE1g\xF3lapra m\xE1solni",
|
|
3771
307
|
"df.wise.Decision.all": "\xD6sszes",
|
|
3772
|
-
"df.wise.Decision.currenciesWithAccountDetails": "
|
|
308
|
+
"df.wise.Decision.currenciesWithAccountDetails": "P\xE9nznemek sz\xE1mlaadatokkal",
|
|
3773
309
|
"df.wise.Decision.filterPlaceholder": "Kezdj el g\xE9pelni a keres\xE9shez",
|
|
3774
310
|
"df.wise.Decision.noResults": "Nincs tal\xE1lat",
|
|
3775
311
|
"df.wise.Decision.popular": "N\xE9pszer\u0171",
|
|
@@ -3951,7 +487,7 @@ var nl_default = {
|
|
|
3951
487
|
"df.wise.Decision.all": "Alles",
|
|
3952
488
|
"df.wise.Decision.currenciesWithAccountDetails": "Valuta met rekeninggegevens",
|
|
3953
489
|
"df.wise.Decision.filterPlaceholder": "Begin met typen om te zoeken",
|
|
3954
|
-
"df.wise.Decision.noResults": "
|
|
490
|
+
"df.wise.Decision.noResults": "Geen resultaten",
|
|
3955
491
|
"df.wise.Decision.popular": "Populair",
|
|
3956
492
|
"df.wise.Decision.recent": "Recent",
|
|
3957
493
|
"df.wise.Decision.results": "Zoekresultaten",
|
|
@@ -4364,9 +900,10 @@ var translations = languages.reduce(
|
|
|
4364
900
|
var i18n_default = translations;
|
|
4365
901
|
|
|
4366
902
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
4367
|
-
var
|
|
4368
|
-
var
|
|
903
|
+
var import_react = require("react");
|
|
904
|
+
var import_react_intl2 = require("react-intl");
|
|
4369
905
|
var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
|
|
906
|
+
var import_dynamic_flow_renderers2 = require("@wise/dynamic-flow-renderers");
|
|
4370
907
|
|
|
4371
908
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
4372
909
|
var appVersion = (
|
|
@@ -4397,12 +934,13 @@ var logToRollbar = (level, message, extra) => {
|
|
|
4397
934
|
};
|
|
4398
935
|
|
|
4399
936
|
// src/dynamicFlow/telemetry/getTrackEvent.ts
|
|
4400
|
-
var
|
|
937
|
+
var import_components_theming = require("@wise/components-theming");
|
|
938
|
+
var import_dynamic_flow_renderers = require("@wise/dynamic-flow-renderers");
|
|
4401
939
|
var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
|
|
4402
940
|
onEvent == null ? void 0 : onEvent(name, properties);
|
|
4403
|
-
if (name.includes(ThemeRequiredEventName)) {
|
|
941
|
+
if (name.includes(import_dynamic_flow_renderers.ThemeRequiredEventName)) {
|
|
4404
942
|
const { theme } = properties != null ? properties : { theme: "personal" };
|
|
4405
|
-
if (theme && (0,
|
|
943
|
+
if (theme && (0, import_components_theming.isThemeModern)(theme)) {
|
|
4406
944
|
onThemeChange == null ? void 0 : onThemeChange(theme);
|
|
4407
945
|
}
|
|
4408
946
|
} else {
|
|
@@ -4411,8 +949,8 @@ var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties)
|
|
|
4411
949
|
};
|
|
4412
950
|
|
|
4413
951
|
// src/dynamicFlow/messages.ts
|
|
4414
|
-
var
|
|
4415
|
-
var messages_default = (0,
|
|
952
|
+
var import_react_intl = require("react-intl");
|
|
953
|
+
var messages_default = (0, import_react_intl.defineMessages)({
|
|
4416
954
|
copied: {
|
|
4417
955
|
id: "df.wise.CopyFeedback.copy",
|
|
4418
956
|
defaultMessage: "Copied to clipboard",
|
|
@@ -4426,12 +964,12 @@ var messages_default = (0, import_react_intl21.defineMessages)({
|
|
|
4426
964
|
});
|
|
4427
965
|
|
|
4428
966
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
4429
|
-
var
|
|
4430
|
-
var wiseRenderers = getWiseRenderers();
|
|
967
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
968
|
+
var wiseRenderers = (0, import_dynamic_flow_renderers2.getWiseRenderers)();
|
|
4431
969
|
function DynamicFlowLegacy(props) {
|
|
4432
970
|
const { customFetch = globalThis.fetch } = props;
|
|
4433
971
|
const coreProps = __spreadProps(__spreadValues({}, props), { httpClient: customFetch });
|
|
4434
|
-
return /* @__PURE__ */ (0,
|
|
972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client2.DynamicFlow, __spreadValues({}, coreProps));
|
|
4435
973
|
}
|
|
4436
974
|
function DynamicFlowRevamp(props) {
|
|
4437
975
|
const {
|
|
@@ -4444,12 +982,12 @@ function DynamicFlowRevamp(props) {
|
|
|
4444
982
|
onLink = openLinkInNewTab,
|
|
4445
983
|
onThemeChange
|
|
4446
984
|
} = props;
|
|
4447
|
-
const { formatMessage } = (0,
|
|
4448
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
985
|
+
const { formatMessage } = (0, import_react_intl2.useIntl)();
|
|
986
|
+
const createSnackBar = (0, import_dynamic_flow_renderers2.useSnackBarIfAvailable)();
|
|
4449
987
|
const httpClient = useWiseHttpClient(customFetch);
|
|
4450
|
-
const mergedRenderers = (0,
|
|
4451
|
-
const logEvent = (0,
|
|
4452
|
-
const trackEvent = (0,
|
|
988
|
+
const mergedRenderers = (0, import_react.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
989
|
+
const logEvent = (0, import_react.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
990
|
+
const trackEvent = (0, import_react.useMemo)(
|
|
4453
991
|
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4454
992
|
[onEvent, onAnalytics, onThemeChange]
|
|
4455
993
|
);
|
|
@@ -4468,9 +1006,9 @@ function DynamicFlowRevamp(props) {
|
|
|
4468
1006
|
onLink,
|
|
4469
1007
|
onCopy
|
|
4470
1008
|
});
|
|
4471
|
-
return /* @__PURE__ */ (0,
|
|
1009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client2.DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
|
|
4472
1010
|
}
|
|
4473
|
-
var DynamicForm = (0,
|
|
1011
|
+
var DynamicForm = (0, import_react.forwardRef)(function DynamicForm2(props, ref) {
|
|
4474
1012
|
const {
|
|
4475
1013
|
className = "",
|
|
4476
1014
|
customFetch = globalThis.fetch,
|
|
@@ -4481,12 +1019,12 @@ var DynamicForm = (0, import_react19.forwardRef)(function DynamicForm2(props, re
|
|
|
4481
1019
|
onLink = openLinkInNewTab,
|
|
4482
1020
|
onThemeChange
|
|
4483
1021
|
} = props;
|
|
4484
|
-
const { formatMessage } = (0,
|
|
4485
|
-
const createSnackBar = useSnackBarIfAvailable();
|
|
1022
|
+
const { formatMessage } = (0, import_react_intl2.useIntl)();
|
|
1023
|
+
const createSnackBar = (0, import_dynamic_flow_renderers2.useSnackBarIfAvailable)();
|
|
4486
1024
|
const httpClient = useWiseHttpClient(customFetch);
|
|
4487
|
-
const mergedRenderers = (0,
|
|
4488
|
-
const logEvent = (0,
|
|
4489
|
-
const trackEvent = (0,
|
|
1025
|
+
const mergedRenderers = (0, import_react.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
1026
|
+
const logEvent = (0, import_react.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
1027
|
+
const trackEvent = (0, import_react.useMemo)(
|
|
4490
1028
|
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
4491
1029
|
[onEvent, onAnalytics, onThemeChange]
|
|
4492
1030
|
);
|
|
@@ -4505,11 +1043,11 @@ var DynamicForm = (0, import_react19.forwardRef)(function DynamicForm2(props, re
|
|
|
4505
1043
|
onLink,
|
|
4506
1044
|
onCopy
|
|
4507
1045
|
});
|
|
4508
|
-
return /* @__PURE__ */ (0,
|
|
1046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dynamic_flow_client2.DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
|
|
4509
1047
|
});
|
|
4510
1048
|
var useWiseHttpClient = (httpClient) => {
|
|
4511
|
-
const { locale } = (0,
|
|
4512
|
-
return (0,
|
|
1049
|
+
const { locale } = (0, import_react_intl2.useIntl)();
|
|
1050
|
+
return (0, import_react.useCallback)(
|
|
4513
1051
|
async (input, init = {}) => {
|
|
4514
1052
|
const headers = new Headers(init.headers);
|
|
4515
1053
|
headers.set("accept-language", locale);
|