@wise/dynamic-flow-client-internal 5.20.0-exp-box-cq-da65c19 → 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
@@ -916,16 +916,18 @@ function FieldInput({
916
916
  description,
917
917
  help,
918
918
  loadingState = "idle",
919
- inlineAlert
919
+ inlineAlert,
920
+ features
920
921
  }) {
921
922
  const labelContent = label && help ? /* @__PURE__ */ jsx19(LabelContentWithHelp, { text: label, help }) : label;
922
923
  const message = validation == null ? void 0 : validation.message;
923
924
  const ref = useRef(null);
925
+ const shouldScrollToError = features.scrollToError !== false;
924
926
  useEffect4(() => {
925
- if (message) {
927
+ if (message && shouldScrollToError) {
926
928
  scrollToIfNotVisible(ref.current);
927
929
  }
928
- }, [message]);
930
+ }, [message, shouldScrollToError]);
929
931
  return /* @__PURE__ */ jsx19("div", { ref, children: /* @__PURE__ */ jsx19(
930
932
  Field,
931
933
  {
@@ -1026,6 +1028,7 @@ var CheckboxComponent = (props) => {
1026
1028
  help,
1027
1029
  inlineAlert: rest.inlineAlert,
1028
1030
  loadingState: rest.fieldLoadingState,
1031
+ features: rest.features,
1029
1032
  children: /* @__PURE__ */ jsx23(Checkbox, __spreadValues({ id }, checkboxProps))
1030
1033
  }
1031
1034
  );
@@ -1223,6 +1226,7 @@ var DateInputRenderer = {
1223
1226
  inlineAlert: props.inlineAlert,
1224
1227
  loadingState: props.fieldLoadingState,
1225
1228
  help,
1229
+ features: props.features,
1226
1230
  children: /* @__PURE__ */ jsx26(VariableDateInput_default, { control, inputProps })
1227
1231
  }
1228
1232
  );
@@ -1915,6 +1919,7 @@ var IntegerInputRenderer = {
1915
1919
  inlineAlert: props.inlineAlert,
1916
1920
  loadingState: props.fieldLoadingState,
1917
1921
  help,
1922
+ features: props.features,
1918
1923
  children: /* @__PURE__ */ jsx43(InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx43(
1919
1924
  Input,
1920
1925
  __spreadValues({
@@ -2178,6 +2183,7 @@ function MoneyInputRendererComponent(props) {
2178
2183
  description,
2179
2184
  validation: validationState,
2180
2185
  help,
2186
+ features: props.features,
2181
2187
  children: /* @__PURE__ */ jsx52(
2182
2188
  MoneyInput,
2183
2189
  {
@@ -2247,6 +2253,7 @@ function InlineComponent(props) {
2247
2253
  id,
2248
2254
  description,
2249
2255
  disabled,
2256
+ features,
2250
2257
  help,
2251
2258
  options,
2252
2259
  selectedIndices,
@@ -2262,6 +2269,7 @@ function InlineComponent(props) {
2262
2269
  help,
2263
2270
  description,
2264
2271
  validation: validationState,
2272
+ features,
2265
2273
  children: options.map((option, index) => {
2266
2274
  var _a;
2267
2275
  const {
@@ -2329,6 +2337,7 @@ function DefaultComponent(props) {
2329
2337
  autoComplete,
2330
2338
  description,
2331
2339
  disabled,
2340
+ features,
2332
2341
  help,
2333
2342
  options,
2334
2343
  placeholder,
@@ -2374,6 +2383,7 @@ function DefaultComponent(props) {
2374
2383
  help,
2375
2384
  description,
2376
2385
  validation: validationState,
2386
+ features,
2377
2387
  children: /* @__PURE__ */ jsx54(
2378
2388
  SelectInput,
2379
2389
  __spreadValues({
@@ -2420,6 +2430,7 @@ function InlineCheckboxComponent(props) {
2420
2430
  id,
2421
2431
  description,
2422
2432
  disabled,
2433
+ features,
2423
2434
  help,
2424
2435
  options,
2425
2436
  selectedIndices,
@@ -2435,6 +2446,7 @@ function InlineCheckboxComponent(props) {
2435
2446
  help,
2436
2447
  description,
2437
2448
  validation: validationState,
2449
+ features,
2438
2450
  children: options.map((option, index) => {
2439
2451
  var _a;
2440
2452
  const {
@@ -2482,8 +2494,8 @@ import { Status, UploadInput } from "@transferwise/components";
2482
2494
 
2483
2495
  // ../renderers/src/components/UploadFieldInput.tsx
2484
2496
  var import_classnames4 = __toESM(require_classnames());
2485
- import { useEffect as useEffect8, useRef as useRef2 } from "react";
2486
2497
  import { InlineAlert as InlineAlert2 } from "@transferwise/components";
2498
+ import { useEffect as useEffect8, useRef as useRef2 } from "react";
2487
2499
  import { jsx as jsx57, jsxs as jsxs12 } from "react/jsx-runtime";
2488
2500
  function UploadFieldInput({
2489
2501
  id,
@@ -2491,17 +2503,19 @@ function UploadFieldInput({
2491
2503
  label,
2492
2504
  description,
2493
2505
  help,
2494
- validation
2506
+ validation,
2507
+ features
2495
2508
  }) {
2496
2509
  const labelContent = label && help ? /* @__PURE__ */ jsx57(LabelContentWithHelp, { text: label, help }) : label;
2497
2510
  const descriptionId = description ? `${id}-description` : void 0;
2498
2511
  const message = validation == null ? void 0 : validation.message;
2499
2512
  const ref = useRef2(null);
2513
+ const shouldScrollToError = features.scrollToError !== false;
2500
2514
  useEffect8(() => {
2501
- if (message) {
2515
+ if (message && shouldScrollToError) {
2502
2516
  scrollToIfNotVisible(ref.current);
2503
2517
  }
2504
- }, [message]);
2518
+ }, [message, shouldScrollToError]);
2505
2519
  return /* @__PURE__ */ jsxs12(
2506
2520
  "div",
2507
2521
  {
@@ -2558,6 +2572,7 @@ var MultiUploadInputRenderer = {
2558
2572
  title,
2559
2573
  description,
2560
2574
  disabled,
2575
+ features,
2561
2576
  maxSize,
2562
2577
  maxItems,
2563
2578
  uploadLabel,
@@ -2580,6 +2595,7 @@ var MultiUploadInputRenderer = {
2580
2595
  description,
2581
2596
  validation: validationState,
2582
2597
  help,
2598
+ features,
2583
2599
  children: /* @__PURE__ */ jsx58(
2584
2600
  UploadInput,
2585
2601
  {
@@ -2633,6 +2649,7 @@ var NumberInputRenderer = {
2633
2649
  inlineAlert: props.inlineAlert,
2634
2650
  loadingState: props.fieldLoadingState,
2635
2651
  help,
2652
+ features: props.features,
2636
2653
  children: /* @__PURE__ */ jsx59(InputGroup2, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx59(
2637
2654
  Input2,
2638
2655
  __spreadValues({
@@ -3077,6 +3094,7 @@ function BlockSearchRendererComponent({
3077
3094
  id,
3078
3095
  hint,
3079
3096
  isLoading,
3097
+ features,
3080
3098
  margin,
3081
3099
  query,
3082
3100
  state,
@@ -3087,23 +3105,34 @@ function BlockSearchRendererComponent({
3087
3105
  const [hasSearched, setHasSearched] = useState10(false);
3088
3106
  const { formatMessage } = useIntl12();
3089
3107
  return /* @__PURE__ */ jsxs18("div", { className: getMargin(margin), children: [
3090
- /* @__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(
3091
- Input4,
3108
+ /* @__PURE__ */ jsx66(
3109
+ FieldInput_default,
3092
3110
  {
3093
3111
  id,
3094
- name: id,
3095
- placeholder: hint,
3096
- type: "text",
3097
- value: query,
3098
- onChange: ({ currentTarget: { value } }) => {
3099
- if (!hasSearched) {
3100
- setHasSearched(true);
3101
- 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
+ }
3102
3132
  }
3103
- onChange(value);
3104
- }
3133
+ ) })
3105
3134
  }
3106
- ) }) }),
3135
+ ),
3107
3136
  isLoading ? /* @__PURE__ */ jsx66("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx66(SearchResultContent, { state, trackEvent })
3108
3137
  ] });
3109
3138
  }
@@ -3172,50 +3201,62 @@ function InlineSearchRenderer({
3172
3201
  id,
3173
3202
  hint,
3174
3203
  isLoading,
3204
+ features,
3175
3205
  margin,
3176
- onChange,
3177
3206
  state,
3178
3207
  title,
3208
+ onChange,
3179
3209
  trackEvent
3180
3210
  }) {
3181
3211
  const [hasSearched, setHasSearched] = useState11(false);
3182
3212
  const intl = useIntl13();
3183
- return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx67(
3184
- Typeahead,
3213
+ return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(
3214
+ FieldInput_default,
3185
3215
  {
3186
- id: "typeahead-input-id",
3187
- intl,
3188
- name: "typeahead-input-name",
3189
- size: "md",
3190
- placeholder: hint,
3191
- maxHeight: 100,
3192
- footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3193
- multiple: false,
3194
- clearable: false,
3195
- addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3196
- options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3197
- minQueryLength: 1,
3198
- onChange: (values) => {
3199
- if (values.length > 0) {
3200
- const [updatedValue] = values;
3201
- const { value: result } = updatedValue;
3202
- if (result) {
3203
- trackEvent("Search Result Selected", __spreadValues({
3204
- type: result.type
3205
- }, result.type === "action" ? { actionId: result.id } : {}));
3206
- 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);
3207
3255
  }
3208
3256
  }
3209
- },
3210
- onInputChange: (query) => {
3211
- if (!hasSearched) {
3212
- setHasSearched(true);
3213
- trackEvent("Search Started");
3214
- }
3215
- onChange(query);
3216
- }
3257
+ )
3217
3258
  }
3218
- ) }) });
3259
+ ) });
3219
3260
  }
3220
3261
  function mapResultToTypeaheadOption(result) {
3221
3262
  return {
@@ -3298,6 +3339,7 @@ function RadioInputRendererComponent(props) {
3298
3339
  children,
3299
3340
  description,
3300
3341
  disabled,
3342
+ features,
3301
3343
  help,
3302
3344
  title,
3303
3345
  options,
@@ -3314,6 +3356,7 @@ function RadioInputRendererComponent(props) {
3314
3356
  help,
3315
3357
  description,
3316
3358
  validation: validationState,
3359
+ features,
3317
3360
  children: /* @__PURE__ */ jsx70("span", { children: /* @__PURE__ */ jsx70(
3318
3361
  RadioGroup,
3319
3362
  {
@@ -3346,6 +3389,7 @@ function TabInputRendererComponent(props) {
3346
3389
  children,
3347
3390
  description,
3348
3391
  disabled,
3392
+ features,
3349
3393
  help,
3350
3394
  title,
3351
3395
  options,
@@ -3367,6 +3411,7 @@ function TabInputRendererComponent(props) {
3367
3411
  help,
3368
3412
  description,
3369
3413
  validation: validationState,
3414
+ features,
3370
3415
  children: /* @__PURE__ */ jsx71(
3371
3416
  Tabs,
3372
3417
  {
@@ -3399,6 +3444,7 @@ function SelectInputRendererComponent(props) {
3399
3444
  children,
3400
3445
  description,
3401
3446
  disabled,
3447
+ features,
3402
3448
  help,
3403
3449
  title,
3404
3450
  options,
@@ -3445,6 +3491,7 @@ function SelectInputRendererComponent(props) {
3445
3491
  help,
3446
3492
  description,
3447
3493
  validation: validationState,
3494
+ features,
3448
3495
  children: /* @__PURE__ */ jsx72(
3449
3496
  SelectInput2,
3450
3497
  __spreadValues({
@@ -3474,6 +3521,7 @@ function SegmentedInputRendererComponent(props) {
3474
3521
  id,
3475
3522
  children,
3476
3523
  description,
3524
+ features,
3477
3525
  help,
3478
3526
  title,
3479
3527
  options,
@@ -3495,6 +3543,7 @@ function SegmentedInputRendererComponent(props) {
3495
3543
  help,
3496
3544
  description,
3497
3545
  validation: validationState,
3546
+ features,
3498
3547
  children: /* @__PURE__ */ jsx73(
3499
3548
  SegmentedControl,
3500
3549
  {
@@ -4085,6 +4134,7 @@ var TextInputRenderer = {
4085
4134
  inlineAlert: props.inlineAlert,
4086
4135
  loadingState: props.fieldLoadingState,
4087
4136
  help,
4137
+ features: props.features,
4088
4138
  children: /* @__PURE__ */ jsx87(InputGroup4, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx87(VariableTextInput, __spreadValues({}, inputProps)) })
4089
4139
  }
4090
4140
  );
@@ -4103,7 +4153,18 @@ import { jsx as jsx88 } from "react/jsx-runtime";
4103
4153
  var UploadInputRenderer = {
4104
4154
  canRenderType: "input-upload",
4105
4155
  render: (props) => {
4106
- 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;
4107
4168
  const onUploadFile = async (formData) => {
4108
4169
  const file = formData.get("file");
4109
4170
  return onUpload(file).then(() => ({
@@ -4122,6 +4183,7 @@ var UploadInputRenderer = {
4122
4183
  label: void 0,
4123
4184
  description: void 0,
4124
4185
  validation: validationState,
4186
+ features,
4125
4187
  children: /* @__PURE__ */ jsx88(
4126
4188
  UploadInput2,
4127
4189
  {
@@ -4162,6 +4224,7 @@ var LargeUploadRenderer = {
4162
4224
  type,
4163
4225
  validationState,
4164
4226
  maxSize = null,
4227
+ features,
4165
4228
  onUpload
4166
4229
  } = _a, rest = __objRest(_a, [
4167
4230
  "id",
@@ -4174,6 +4237,7 @@ var LargeUploadRenderer = {
4174
4237
  "type",
4175
4238
  "validationState",
4176
4239
  "maxSize",
4240
+ "features",
4177
4241
  "onUpload"
4178
4242
  ]);
4179
4243
  const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id, maxSize });
@@ -4196,6 +4260,7 @@ var LargeUploadRenderer = {
4196
4260
  description,
4197
4261
  validation: validationState,
4198
4262
  help,
4263
+ features,
4199
4264
  children: /* @__PURE__ */ jsx88(
4200
4265
  Upload,
4201
4266
  __spreadProps(__spreadValues({}, uploadProps), {