@wise/dynamic-flow-client-internal 5.19.4-exp-scroll-to-errors-d7a48a2 → 5.19.4-exp-scroll-flag-849755e

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
@@ -916,13 +916,14 @@ function FieldInput({
916
916
  description,
917
917
  help,
918
918
  loadingState = "idle",
919
- inlineAlert
919
+ inlineAlert,
920
+ isFeatureEnabled
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);
924
925
  useEffect4(() => {
925
- if (message) {
926
+ if (message && isFeatureEnabled("scrollToErrors")) {
926
927
  scrollToIfNotVisible(ref.current);
927
928
  }
928
929
  }, [message]);
@@ -1026,6 +1027,7 @@ var CheckboxComponent = (props) => {
1026
1027
  help,
1027
1028
  inlineAlert: rest.inlineAlert,
1028
1029
  loadingState: rest.fieldLoadingState,
1030
+ isFeatureEnabled: rest.isFeatureEnabled,
1029
1031
  children: /* @__PURE__ */ jsx23(Checkbox, __spreadValues({ id }, checkboxProps))
1030
1032
  }
1031
1033
  );
@@ -1223,6 +1225,7 @@ var DateInputRenderer = {
1223
1225
  inlineAlert: props.inlineAlert,
1224
1226
  loadingState: props.fieldLoadingState,
1225
1227
  help,
1228
+ isFeatureEnabled: props.isFeatureEnabled,
1226
1229
  children: /* @__PURE__ */ jsx26(VariableDateInput_default, { control, inputProps })
1227
1230
  }
1228
1231
  );
@@ -1915,6 +1918,7 @@ var IntegerInputRenderer = {
1915
1918
  inlineAlert: props.inlineAlert,
1916
1919
  loadingState: props.fieldLoadingState,
1917
1920
  help,
1921
+ isFeatureEnabled: props.isFeatureEnabled,
1918
1922
  children: /* @__PURE__ */ jsx43(InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx43(
1919
1923
  Input,
1920
1924
  __spreadValues({
@@ -2178,6 +2182,7 @@ function MoneyInputRendererComponent(props) {
2178
2182
  description,
2179
2183
  validation: validationState,
2180
2184
  help,
2185
+ isFeatureEnabled: props.isFeatureEnabled,
2181
2186
  children: /* @__PURE__ */ jsx52(
2182
2187
  MoneyInput,
2183
2188
  {
@@ -2262,6 +2267,7 @@ function InlineComponent(props) {
2262
2267
  help,
2263
2268
  description,
2264
2269
  validation: validationState,
2270
+ isFeatureEnabled: props.isFeatureEnabled,
2265
2271
  children: options.map((option, index) => {
2266
2272
  var _a;
2267
2273
  const {
@@ -2374,6 +2380,7 @@ function DefaultComponent(props) {
2374
2380
  help,
2375
2381
  description,
2376
2382
  validation: validationState,
2383
+ isFeatureEnabled: props.isFeatureEnabled,
2377
2384
  children: /* @__PURE__ */ jsx54(
2378
2385
  SelectInput,
2379
2386
  __spreadValues({
@@ -2435,6 +2442,7 @@ function InlineCheckboxComponent(props) {
2435
2442
  help,
2436
2443
  description,
2437
2444
  validation: validationState,
2445
+ isFeatureEnabled: props.isFeatureEnabled,
2438
2446
  children: options.map((option, index) => {
2439
2447
  var _a;
2440
2448
  const {
@@ -2482,8 +2490,8 @@ import { Status, UploadInput } from "@transferwise/components";
2482
2490
 
2483
2491
  // ../renderers/src/components/UploadFieldInput.tsx
2484
2492
  var import_classnames4 = __toESM(require_classnames());
2485
- import { useEffect as useEffect8, useRef as useRef2 } from "react";
2486
2493
  import { InlineAlert as InlineAlert2 } from "@transferwise/components";
2494
+ import { useEffect as useEffect8, useRef as useRef2 } from "react";
2487
2495
  import { jsx as jsx57, jsxs as jsxs12 } from "react/jsx-runtime";
2488
2496
  function UploadFieldInput({
2489
2497
  id,
@@ -2491,14 +2499,15 @@ function UploadFieldInput({
2491
2499
  label,
2492
2500
  description,
2493
2501
  help,
2494
- validation
2502
+ validation,
2503
+ isFeatureEnabled
2495
2504
  }) {
2496
2505
  const labelContent = label && help ? /* @__PURE__ */ jsx57(LabelContentWithHelp, { text: label, help }) : label;
2497
2506
  const descriptionId = description ? `${id}-description` : void 0;
2498
2507
  const message = validation == null ? void 0 : validation.message;
2499
2508
  const ref = useRef2(null);
2500
2509
  useEffect8(() => {
2501
- if (message) {
2510
+ if (message && isFeatureEnabled("scrollToErrors")) {
2502
2511
  scrollToIfNotVisible(ref.current);
2503
2512
  }
2504
2513
  }, [message]);
@@ -2563,6 +2572,7 @@ var MultiUploadInputRenderer = {
2563
2572
  uploadLabel,
2564
2573
  validationState,
2565
2574
  value,
2575
+ isFeatureEnabled,
2566
2576
  onInsertFile,
2567
2577
  onRemoveFile
2568
2578
  } = props;
@@ -2580,6 +2590,7 @@ var MultiUploadInputRenderer = {
2580
2590
  description,
2581
2591
  validation: validationState,
2582
2592
  help,
2593
+ isFeatureEnabled,
2583
2594
  children: /* @__PURE__ */ jsx58(
2584
2595
  UploadInput,
2585
2596
  {
@@ -2633,6 +2644,7 @@ var NumberInputRenderer = {
2633
2644
  inlineAlert: props.inlineAlert,
2634
2645
  loadingState: props.fieldLoadingState,
2635
2646
  help,
2647
+ isFeatureEnabled: props.isFeatureEnabled,
2636
2648
  children: /* @__PURE__ */ jsx59(InputGroup2, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx59(
2637
2649
  Input2,
2638
2650
  __spreadValues({
@@ -3081,29 +3093,41 @@ function BlockSearchRendererComponent({
3081
3093
  query,
3082
3094
  state,
3083
3095
  title,
3096
+ isFeatureEnabled,
3084
3097
  trackEvent,
3085
3098
  onChange
3086
3099
  }) {
3087
3100
  const [hasSearched, setHasSearched] = useState10(false);
3088
3101
  const { formatMessage } = useIntl12();
3089
3102
  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,
3103
+ /* @__PURE__ */ jsx66(
3104
+ FieldInput_default,
3092
3105
  {
3093
3106
  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");
3107
+ description: "",
3108
+ validation: void 0,
3109
+ help: "",
3110
+ label: title,
3111
+ isFeatureEnabled,
3112
+ children: /* @__PURE__ */ jsx66(InputGroup3, { addonStart: { content: /* @__PURE__ */ jsx66(Search, { size: 24 }) }, children: /* @__PURE__ */ jsx66(
3113
+ Input4,
3114
+ {
3115
+ id,
3116
+ name: id,
3117
+ placeholder: hint,
3118
+ type: "text",
3119
+ value: query,
3120
+ onChange: ({ currentTarget: { value } }) => {
3121
+ if (!hasSearched) {
3122
+ setHasSearched(true);
3123
+ trackEvent("Search Started");
3124
+ }
3125
+ onChange(value);
3126
+ }
3102
3127
  }
3103
- onChange(value);
3104
- }
3128
+ ) })
3105
3129
  }
3106
- ) }) }),
3130
+ ),
3107
3131
  isLoading ? /* @__PURE__ */ jsx66("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx66(SearchResultContent, { state, trackEvent })
3108
3132
  ] });
3109
3133
  }
@@ -3176,46 +3200,58 @@ function InlineSearchRenderer({
3176
3200
  onChange,
3177
3201
  state,
3178
3202
  title,
3203
+ isFeatureEnabled,
3179
3204
  trackEvent
3180
3205
  }) {
3181
3206
  const [hasSearched, setHasSearched] = useState11(false);
3182
3207
  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,
3208
+ return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(
3209
+ FieldInput_default,
3185
3210
  {
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();
3211
+ id,
3212
+ description: "",
3213
+ validation: void 0,
3214
+ help: "",
3215
+ label: title,
3216
+ isFeatureEnabled,
3217
+ children: /* @__PURE__ */ jsx67(
3218
+ Typeahead,
3219
+ {
3220
+ id: "typeahead-input-id",
3221
+ intl,
3222
+ name: "typeahead-input-name",
3223
+ size: "md",
3224
+ placeholder: hint,
3225
+ maxHeight: 100,
3226
+ footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3227
+ multiple: false,
3228
+ clearable: false,
3229
+ addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3230
+ options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3231
+ minQueryLength: 1,
3232
+ onChange: (values) => {
3233
+ if (values.length > 0) {
3234
+ const [updatedValue] = values;
3235
+ const { value: result } = updatedValue;
3236
+ if (result) {
3237
+ trackEvent("Search Result Selected", __spreadValues({
3238
+ type: result.type
3239
+ }, result.type === "action" ? { actionId: result.id } : {}));
3240
+ result.onClick();
3241
+ }
3242
+ }
3243
+ },
3244
+ onInputChange: (query) => {
3245
+ if (!hasSearched) {
3246
+ setHasSearched(true);
3247
+ trackEvent("Search Started");
3248
+ }
3249
+ onChange(query);
3207
3250
  }
3208
3251
  }
3209
- },
3210
- onInputChange: (query) => {
3211
- if (!hasSearched) {
3212
- setHasSearched(true);
3213
- trackEvent("Search Started");
3214
- }
3215
- onChange(query);
3216
- }
3252
+ )
3217
3253
  }
3218
- ) }) });
3254
+ ) });
3219
3255
  }
3220
3256
  function mapResultToTypeaheadOption(result) {
3221
3257
  return {
@@ -3303,6 +3339,7 @@ function RadioInputRendererComponent(props) {
3303
3339
  options,
3304
3340
  selectedIndex,
3305
3341
  validationState,
3342
+ isFeatureEnabled,
3306
3343
  onSelect
3307
3344
  } = props;
3308
3345
  return /* @__PURE__ */ jsxs20(Fragment8, { children: [
@@ -3314,6 +3351,7 @@ function RadioInputRendererComponent(props) {
3314
3351
  help,
3315
3352
  description,
3316
3353
  validation: validationState,
3354
+ isFeatureEnabled,
3317
3355
  children: /* @__PURE__ */ jsx70("span", { children: /* @__PURE__ */ jsx70(
3318
3356
  RadioGroup,
3319
3357
  {
@@ -3351,6 +3389,7 @@ function TabInputRendererComponent(props) {
3351
3389
  options,
3352
3390
  selectedIndex,
3353
3391
  validationState,
3392
+ isFeatureEnabled,
3354
3393
  onSelect
3355
3394
  } = props;
3356
3395
  useEffect9(() => {
@@ -3367,6 +3406,7 @@ function TabInputRendererComponent(props) {
3367
3406
  help,
3368
3407
  description,
3369
3408
  validation: validationState,
3409
+ isFeatureEnabled,
3370
3410
  children: /* @__PURE__ */ jsx71(
3371
3411
  Tabs,
3372
3412
  {
@@ -3445,6 +3485,7 @@ function SelectInputRendererComponent(props) {
3445
3485
  help,
3446
3486
  description,
3447
3487
  validation: validationState,
3488
+ isFeatureEnabled: props.isFeatureEnabled,
3448
3489
  children: /* @__PURE__ */ jsx72(
3449
3490
  SelectInput2,
3450
3491
  __spreadValues({
@@ -3479,6 +3520,7 @@ function SegmentedInputRendererComponent(props) {
3479
3520
  options,
3480
3521
  selectedIndex,
3481
3522
  validationState,
3523
+ isFeatureEnabled,
3482
3524
  onSelect
3483
3525
  } = props;
3484
3526
  useEffect10(() => {
@@ -3495,6 +3537,7 @@ function SegmentedInputRendererComponent(props) {
3495
3537
  help,
3496
3538
  description,
3497
3539
  validation: validationState,
3540
+ isFeatureEnabled,
3498
3541
  children: /* @__PURE__ */ jsx73(
3499
3542
  SegmentedControl,
3500
3543
  {
@@ -4085,6 +4128,7 @@ var TextInputRenderer = {
4085
4128
  inlineAlert: props.inlineAlert,
4086
4129
  loadingState: props.fieldLoadingState,
4087
4130
  help,
4131
+ isFeatureEnabled: props.isFeatureEnabled,
4088
4132
  children: /* @__PURE__ */ jsx87(InputGroup4, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx87(VariableTextInput, __spreadValues({}, inputProps)) })
4089
4133
  }
4090
4134
  );
@@ -4103,7 +4147,18 @@ import { jsx as jsx88 } from "react/jsx-runtime";
4103
4147
  var UploadInputRenderer = {
4104
4148
  canRenderType: "input-upload",
4105
4149
  render: (props) => {
4106
- const { id, accepts, title, description, disabled, maxSize, validationState, value, onUpload } = props;
4150
+ const {
4151
+ id,
4152
+ accepts,
4153
+ title,
4154
+ description,
4155
+ disabled,
4156
+ maxSize,
4157
+ validationState,
4158
+ value,
4159
+ isFeatureEnabled,
4160
+ onUpload
4161
+ } = props;
4107
4162
  const onUploadFile = async (formData) => {
4108
4163
  const file = formData.get("file");
4109
4164
  return onUpload(file).then(() => ({
@@ -4122,6 +4177,7 @@ var UploadInputRenderer = {
4122
4177
  label: void 0,
4123
4178
  description: void 0,
4124
4179
  validation: validationState,
4180
+ isFeatureEnabled,
4125
4181
  children: /* @__PURE__ */ jsx88(
4126
4182
  UploadInput2,
4127
4183
  {
@@ -4196,6 +4252,7 @@ var LargeUploadRenderer = {
4196
4252
  description,
4197
4253
  validation: validationState,
4198
4254
  help,
4255
+ isFeatureEnabled: rest.isFeatureEnabled,
4199
4256
  children: /* @__PURE__ */ jsx88(
4200
4257
  Upload,
4201
4258
  __spreadProps(__spreadValues({}, uploadProps), {