@wise/dynamic-flow-client-internal 5.20.0-exp-box-cq-2-e95523a → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.mjs CHANGED
@@ -127,7 +127,7 @@ import { useDynamicFlow } from "@wise/dynamic-flow-client";
127
127
  // src/dynamicFlow/telemetry/app-version.ts
128
128
  var appVersion = (
129
129
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
130
- typeof process !== "undefined" ? "5.19.3" : "0.0.0"
130
+ typeof process !== "undefined" ? "5.20.0" : "0.0.0"
131
131
  );
132
132
 
133
133
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -377,30 +377,25 @@ var AlertRenderer_default = AlertRenderer;
377
377
  // ../renderers/src/BoxRenderer.tsx
378
378
  var import_classnames = __toESM(require_classnames());
379
379
  import { jsx as jsx3 } from "react/jsx-runtime";
380
- var getBoxRenderer = (className) => {
381
- const renderer = {
382
- canRenderType: "box",
383
- render: ({ children, control, margin, width }) => {
384
- const hasFixedWidth = width !== "xl";
385
- const hasBorder = control === "bordered" || control === "bordered-web";
386
- const contents = /* @__PURE__ */ jsx3(
387
- "div",
388
- {
389
- className: (0, import_classnames.default)({
390
- [className]: !!className,
391
- "df-box-renderer-border": hasBorder,
392
- [`df-box-renderer-width-${width}`]: hasFixedWidth,
393
- [getMargin(margin)]: !hasFixedWidth
394
- }),
395
- children
396
- }
397
- );
398
- return hasFixedWidth ? /* @__PURE__ */ jsx3("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
399
- }
400
- };
401
- return renderer;
380
+ var BoxRenderer = {
381
+ canRenderType: "box",
382
+ render: ({ children, control, margin, width }) => {
383
+ const hasFixedWidth = width !== "xl";
384
+ const hasBorder = control === "bordered" || control === "bordered-web";
385
+ const contents = /* @__PURE__ */ jsx3(
386
+ "div",
387
+ {
388
+ className: (0, import_classnames.default)({
389
+ "df-box-renderer-border": hasBorder,
390
+ [`df-box-renderer-width-${width}`]: hasFixedWidth,
391
+ [getMargin(margin)]: !hasFixedWidth
392
+ }),
393
+ children
394
+ }
395
+ );
396
+ return hasFixedWidth ? /* @__PURE__ */ jsx3("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
397
+ }
402
398
  };
403
- var BoxRenderer = getBoxRenderer("df-box-renderer");
404
399
  var BoxRenderer_default = BoxRenderer;
405
400
 
406
401
  // ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
@@ -921,16 +916,18 @@ function FieldInput({
921
916
  description,
922
917
  help,
923
918
  loadingState = "idle",
924
- inlineAlert
919
+ inlineAlert,
920
+ features
925
921
  }) {
926
922
  const labelContent = label && help ? /* @__PURE__ */ jsx19(LabelContentWithHelp, { text: label, help }) : label;
927
923
  const message = validation == null ? void 0 : validation.message;
928
924
  const ref = useRef(null);
925
+ const shouldScrollToError = features.scrollToError !== false;
929
926
  useEffect4(() => {
930
- if (message) {
927
+ if (message && shouldScrollToError) {
931
928
  scrollToIfNotVisible(ref.current);
932
929
  }
933
- }, [message]);
930
+ }, [message, shouldScrollToError]);
934
931
  return /* @__PURE__ */ jsx19("div", { ref, children: /* @__PURE__ */ jsx19(
935
932
  Field,
936
933
  {
@@ -1031,6 +1028,7 @@ var CheckboxComponent = (props) => {
1031
1028
  help,
1032
1029
  inlineAlert: rest.inlineAlert,
1033
1030
  loadingState: rest.fieldLoadingState,
1031
+ features: rest.features,
1034
1032
  children: /* @__PURE__ */ jsx23(Checkbox, __spreadValues({ id }, checkboxProps))
1035
1033
  }
1036
1034
  );
@@ -1228,6 +1226,7 @@ var DateInputRenderer = {
1228
1226
  inlineAlert: props.inlineAlert,
1229
1227
  loadingState: props.fieldLoadingState,
1230
1228
  help,
1229
+ features: props.features,
1231
1230
  children: /* @__PURE__ */ jsx26(VariableDateInput_default, { control, inputProps })
1232
1231
  }
1233
1232
  );
@@ -1920,6 +1919,7 @@ var IntegerInputRenderer = {
1920
1919
  inlineAlert: props.inlineAlert,
1921
1920
  loadingState: props.fieldLoadingState,
1922
1921
  help,
1922
+ features: props.features,
1923
1923
  children: /* @__PURE__ */ jsx43(InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx43(
1924
1924
  Input,
1925
1925
  __spreadValues({
@@ -2183,6 +2183,7 @@ function MoneyInputRendererComponent(props) {
2183
2183
  description,
2184
2184
  validation: validationState,
2185
2185
  help,
2186
+ features: props.features,
2186
2187
  children: /* @__PURE__ */ jsx52(
2187
2188
  MoneyInput,
2188
2189
  {
@@ -2252,6 +2253,7 @@ function InlineComponent(props) {
2252
2253
  id,
2253
2254
  description,
2254
2255
  disabled,
2256
+ features,
2255
2257
  help,
2256
2258
  options,
2257
2259
  selectedIndices,
@@ -2267,6 +2269,7 @@ function InlineComponent(props) {
2267
2269
  help,
2268
2270
  description,
2269
2271
  validation: validationState,
2272
+ features,
2270
2273
  children: options.map((option, index) => {
2271
2274
  var _a;
2272
2275
  const {
@@ -2334,6 +2337,7 @@ function DefaultComponent(props) {
2334
2337
  autoComplete,
2335
2338
  description,
2336
2339
  disabled,
2340
+ features,
2337
2341
  help,
2338
2342
  options,
2339
2343
  placeholder,
@@ -2379,6 +2383,7 @@ function DefaultComponent(props) {
2379
2383
  help,
2380
2384
  description,
2381
2385
  validation: validationState,
2386
+ features,
2382
2387
  children: /* @__PURE__ */ jsx54(
2383
2388
  SelectInput,
2384
2389
  __spreadValues({
@@ -2425,6 +2430,7 @@ function InlineCheckboxComponent(props) {
2425
2430
  id,
2426
2431
  description,
2427
2432
  disabled,
2433
+ features,
2428
2434
  help,
2429
2435
  options,
2430
2436
  selectedIndices,
@@ -2440,6 +2446,7 @@ function InlineCheckboxComponent(props) {
2440
2446
  help,
2441
2447
  description,
2442
2448
  validation: validationState,
2449
+ features,
2443
2450
  children: options.map((option, index) => {
2444
2451
  var _a;
2445
2452
  const {
@@ -2487,8 +2494,8 @@ import { Status, UploadInput } from "@transferwise/components";
2487
2494
 
2488
2495
  // ../renderers/src/components/UploadFieldInput.tsx
2489
2496
  var import_classnames4 = __toESM(require_classnames());
2490
- import { useEffect as useEffect8, useRef as useRef2 } from "react";
2491
2497
  import { InlineAlert as InlineAlert2 } from "@transferwise/components";
2498
+ import { useEffect as useEffect8, useRef as useRef2 } from "react";
2492
2499
  import { jsx as jsx57, jsxs as jsxs12 } from "react/jsx-runtime";
2493
2500
  function UploadFieldInput({
2494
2501
  id,
@@ -2496,17 +2503,19 @@ function UploadFieldInput({
2496
2503
  label,
2497
2504
  description,
2498
2505
  help,
2499
- validation
2506
+ validation,
2507
+ features
2500
2508
  }) {
2501
2509
  const labelContent = label && help ? /* @__PURE__ */ jsx57(LabelContentWithHelp, { text: label, help }) : label;
2502
2510
  const descriptionId = description ? `${id}-description` : void 0;
2503
2511
  const message = validation == null ? void 0 : validation.message;
2504
2512
  const ref = useRef2(null);
2513
+ const shouldScrollToError = features.scrollToError !== false;
2505
2514
  useEffect8(() => {
2506
- if (message) {
2515
+ if (message && shouldScrollToError) {
2507
2516
  scrollToIfNotVisible(ref.current);
2508
2517
  }
2509
- }, [message]);
2518
+ }, [message, shouldScrollToError]);
2510
2519
  return /* @__PURE__ */ jsxs12(
2511
2520
  "div",
2512
2521
  {
@@ -2563,6 +2572,7 @@ var MultiUploadInputRenderer = {
2563
2572
  title,
2564
2573
  description,
2565
2574
  disabled,
2575
+ features,
2566
2576
  maxSize,
2567
2577
  maxItems,
2568
2578
  uploadLabel,
@@ -2585,6 +2595,7 @@ var MultiUploadInputRenderer = {
2585
2595
  description,
2586
2596
  validation: validationState,
2587
2597
  help,
2598
+ features,
2588
2599
  children: /* @__PURE__ */ jsx58(
2589
2600
  UploadInput,
2590
2601
  {
@@ -2638,6 +2649,7 @@ var NumberInputRenderer = {
2638
2649
  inlineAlert: props.inlineAlert,
2639
2650
  loadingState: props.fieldLoadingState,
2640
2651
  help,
2652
+ features: props.features,
2641
2653
  children: /* @__PURE__ */ jsx59(InputGroup2, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx59(
2642
2654
  Input2,
2643
2655
  __spreadValues({
@@ -3082,6 +3094,7 @@ function BlockSearchRendererComponent({
3082
3094
  id,
3083
3095
  hint,
3084
3096
  isLoading,
3097
+ features,
3085
3098
  margin,
3086
3099
  query,
3087
3100
  state,
@@ -3092,23 +3105,34 @@ function BlockSearchRendererComponent({
3092
3105
  const [hasSearched, setHasSearched] = useState10(false);
3093
3106
  const { formatMessage } = useIntl12();
3094
3107
  return /* @__PURE__ */ jsxs18("div", { className: getMargin(margin), children: [
3095
- /* @__PURE__ */ jsx66(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx66(InputGroup3, { addonStart: { content: /* @__PURE__ */ jsx66(Search, { size: 24 }) }, children: /* @__PURE__ */ jsx66(
3096
- Input4,
3108
+ /* @__PURE__ */ jsx66(
3109
+ FieldInput_default,
3097
3110
  {
3098
3111
  id,
3099
- name: id,
3100
- placeholder: hint,
3101
- type: "text",
3102
- value: query,
3103
- onChange: ({ currentTarget: { value } }) => {
3104
- if (!hasSearched) {
3105
- setHasSearched(true);
3106
- trackEvent("Search Started");
3112
+ description: "",
3113
+ validation: void 0,
3114
+ help: "",
3115
+ label: title,
3116
+ features,
3117
+ children: /* @__PURE__ */ jsx66(InputGroup3, { addonStart: { content: /* @__PURE__ */ jsx66(Search, { size: 24 }) }, children: /* @__PURE__ */ jsx66(
3118
+ Input4,
3119
+ {
3120
+ id,
3121
+ name: id,
3122
+ placeholder: hint,
3123
+ type: "text",
3124
+ value: query,
3125
+ onChange: ({ currentTarget: { value } }) => {
3126
+ if (!hasSearched) {
3127
+ setHasSearched(true);
3128
+ trackEvent("Search Started");
3129
+ }
3130
+ onChange(value);
3131
+ }
3107
3132
  }
3108
- onChange(value);
3109
- }
3133
+ ) })
3110
3134
  }
3111
- ) }) }),
3135
+ ),
3112
3136
  isLoading ? /* @__PURE__ */ jsx66("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx66(SearchResultContent, { state, trackEvent })
3113
3137
  ] });
3114
3138
  }
@@ -3177,50 +3201,62 @@ function InlineSearchRenderer({
3177
3201
  id,
3178
3202
  hint,
3179
3203
  isLoading,
3204
+ features,
3180
3205
  margin,
3181
- onChange,
3182
3206
  state,
3183
3207
  title,
3208
+ onChange,
3184
3209
  trackEvent
3185
3210
  }) {
3186
3211
  const [hasSearched, setHasSearched] = useState11(false);
3187
3212
  const intl = useIntl13();
3188
- return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx67(
3189
- Typeahead,
3213
+ return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(
3214
+ FieldInput_default,
3190
3215
  {
3191
- id: "typeahead-input-id",
3192
- intl,
3193
- name: "typeahead-input-name",
3194
- size: "md",
3195
- placeholder: hint,
3196
- maxHeight: 100,
3197
- footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3198
- multiple: false,
3199
- clearable: false,
3200
- addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3201
- options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3202
- minQueryLength: 1,
3203
- onChange: (values) => {
3204
- if (values.length > 0) {
3205
- const [updatedValue] = values;
3206
- const { value: result } = updatedValue;
3207
- if (result) {
3208
- trackEvent("Search Result Selected", __spreadValues({
3209
- type: result.type
3210
- }, result.type === "action" ? { actionId: result.id } : {}));
3211
- result.onClick();
3216
+ id,
3217
+ description: "",
3218
+ validation: void 0,
3219
+ help: "",
3220
+ label: title,
3221
+ features,
3222
+ children: /* @__PURE__ */ jsx67(
3223
+ Typeahead,
3224
+ {
3225
+ id: "typeahead-input-id",
3226
+ intl,
3227
+ name: "typeahead-input-name",
3228
+ size: "md",
3229
+ placeholder: hint,
3230
+ maxHeight: 100,
3231
+ footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3232
+ multiple: false,
3233
+ clearable: false,
3234
+ addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3235
+ options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3236
+ minQueryLength: 1,
3237
+ onChange: (values) => {
3238
+ if (values.length > 0) {
3239
+ const [updatedValue] = values;
3240
+ const { value: result } = updatedValue;
3241
+ if (result) {
3242
+ trackEvent("Search Result Selected", __spreadValues({
3243
+ type: result.type
3244
+ }, result.type === "action" ? { actionId: result.id } : {}));
3245
+ result.onClick();
3246
+ }
3247
+ }
3248
+ },
3249
+ onInputChange: (query) => {
3250
+ if (!hasSearched) {
3251
+ setHasSearched(true);
3252
+ trackEvent("Search Started");
3253
+ }
3254
+ onChange(query);
3212
3255
  }
3213
3256
  }
3214
- },
3215
- onInputChange: (query) => {
3216
- if (!hasSearched) {
3217
- setHasSearched(true);
3218
- trackEvent("Search Started");
3219
- }
3220
- onChange(query);
3221
- }
3257
+ )
3222
3258
  }
3223
- ) }) });
3259
+ ) });
3224
3260
  }
3225
3261
  function mapResultToTypeaheadOption(result) {
3226
3262
  return {
@@ -3303,6 +3339,7 @@ function RadioInputRendererComponent(props) {
3303
3339
  children,
3304
3340
  description,
3305
3341
  disabled,
3342
+ features,
3306
3343
  help,
3307
3344
  title,
3308
3345
  options,
@@ -3319,6 +3356,7 @@ function RadioInputRendererComponent(props) {
3319
3356
  help,
3320
3357
  description,
3321
3358
  validation: validationState,
3359
+ features,
3322
3360
  children: /* @__PURE__ */ jsx70("span", { children: /* @__PURE__ */ jsx70(
3323
3361
  RadioGroup,
3324
3362
  {
@@ -3351,6 +3389,7 @@ function TabInputRendererComponent(props) {
3351
3389
  children,
3352
3390
  description,
3353
3391
  disabled,
3392
+ features,
3354
3393
  help,
3355
3394
  title,
3356
3395
  options,
@@ -3372,6 +3411,7 @@ function TabInputRendererComponent(props) {
3372
3411
  help,
3373
3412
  description,
3374
3413
  validation: validationState,
3414
+ features,
3375
3415
  children: /* @__PURE__ */ jsx71(
3376
3416
  Tabs,
3377
3417
  {
@@ -3404,6 +3444,7 @@ function SelectInputRendererComponent(props) {
3404
3444
  children,
3405
3445
  description,
3406
3446
  disabled,
3447
+ features,
3407
3448
  help,
3408
3449
  title,
3409
3450
  options,
@@ -3450,6 +3491,7 @@ function SelectInputRendererComponent(props) {
3450
3491
  help,
3451
3492
  description,
3452
3493
  validation: validationState,
3494
+ features,
3453
3495
  children: /* @__PURE__ */ jsx72(
3454
3496
  SelectInput2,
3455
3497
  __spreadValues({
@@ -3479,6 +3521,7 @@ function SegmentedInputRendererComponent(props) {
3479
3521
  id,
3480
3522
  children,
3481
3523
  description,
3524
+ features,
3482
3525
  help,
3483
3526
  title,
3484
3527
  options,
@@ -3500,6 +3543,7 @@ function SegmentedInputRendererComponent(props) {
3500
3543
  help,
3501
3544
  description,
3502
3545
  validation: validationState,
3546
+ features,
3503
3547
  children: /* @__PURE__ */ jsx73(
3504
3548
  SegmentedControl,
3505
3549
  {
@@ -4090,6 +4134,7 @@ var TextInputRenderer = {
4090
4134
  inlineAlert: props.inlineAlert,
4091
4135
  loadingState: props.fieldLoadingState,
4092
4136
  help,
4137
+ features: props.features,
4093
4138
  children: /* @__PURE__ */ jsx87(InputGroup4, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx87(VariableTextInput, __spreadValues({}, inputProps)) })
4094
4139
  }
4095
4140
  );
@@ -4108,7 +4153,18 @@ import { jsx as jsx88 } from "react/jsx-runtime";
4108
4153
  var UploadInputRenderer = {
4109
4154
  canRenderType: "input-upload",
4110
4155
  render: (props) => {
4111
- const { id, accepts, title, description, disabled, maxSize, validationState, value, onUpload } = props;
4156
+ const {
4157
+ id,
4158
+ accepts,
4159
+ title,
4160
+ description,
4161
+ disabled,
4162
+ features,
4163
+ maxSize,
4164
+ validationState,
4165
+ value,
4166
+ onUpload
4167
+ } = props;
4112
4168
  const onUploadFile = async (formData) => {
4113
4169
  const file = formData.get("file");
4114
4170
  return onUpload(file).then(() => ({
@@ -4127,6 +4183,7 @@ var UploadInputRenderer = {
4127
4183
  label: void 0,
4128
4184
  description: void 0,
4129
4185
  validation: validationState,
4186
+ features,
4130
4187
  children: /* @__PURE__ */ jsx88(
4131
4188
  UploadInput2,
4132
4189
  {
@@ -4167,6 +4224,7 @@ var LargeUploadRenderer = {
4167
4224
  type,
4168
4225
  validationState,
4169
4226
  maxSize = null,
4227
+ features,
4170
4228
  onUpload
4171
4229
  } = _a, rest = __objRest(_a, [
4172
4230
  "id",
@@ -4179,6 +4237,7 @@ var LargeUploadRenderer = {
4179
4237
  "type",
4180
4238
  "validationState",
4181
4239
  "maxSize",
4240
+ "features",
4182
4241
  "onUpload"
4183
4242
  ]);
4184
4243
  const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id, maxSize });
@@ -4201,6 +4260,7 @@ var LargeUploadRenderer = {
4201
4260
  description,
4202
4261
  validation: validationState,
4203
4262
  help,
4263
+ features,
4204
4264
  children: /* @__PURE__ */ jsx88(
4205
4265
  Upload,
4206
4266
  __spreadProps(__spreadValues({}, uploadProps), {