@wise/dynamic-flow-client-internal 5.19.3 → 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.js CHANGED
@@ -934,13 +934,14 @@ function FieldInput({
934
934
  description,
935
935
  help,
936
936
  loadingState = "idle",
937
- inlineAlert
937
+ inlineAlert,
938
+ isFeatureEnabled
938
939
  }) {
939
940
  const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LabelContentWithHelp, { text: label, help }) : label;
940
941
  const message = validation == null ? void 0 : validation.message;
941
942
  const ref = (0, import_react4.useRef)(null);
942
943
  (0, import_react4.useEffect)(() => {
943
- if (message) {
944
+ if (message && isFeatureEnabled("scrollToErrors")) {
944
945
  scrollToIfNotVisible(ref.current);
945
946
  }
946
947
  }, [message]);
@@ -1044,6 +1045,7 @@ var CheckboxComponent = (props) => {
1044
1045
  help,
1045
1046
  inlineAlert: rest.inlineAlert,
1046
1047
  loadingState: rest.fieldLoadingState,
1048
+ isFeatureEnabled: rest.isFeatureEnabled,
1047
1049
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Checkbox, __spreadValues({ id }, checkboxProps))
1048
1050
  }
1049
1051
  );
@@ -1241,6 +1243,7 @@ var DateInputRenderer = {
1241
1243
  inlineAlert: props.inlineAlert,
1242
1244
  loadingState: props.fieldLoadingState,
1243
1245
  help,
1246
+ isFeatureEnabled: props.isFeatureEnabled,
1244
1247
  children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VariableDateInput_default, { control, inputProps })
1245
1248
  }
1246
1249
  );
@@ -1930,6 +1933,7 @@ var IntegerInputRenderer = {
1930
1933
  inlineAlert: props.inlineAlert,
1931
1934
  loadingState: props.fieldLoadingState,
1932
1935
  help,
1936
+ isFeatureEnabled: props.isFeatureEnabled,
1933
1937
  children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components23.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1934
1938
  import_components23.Input,
1935
1939
  __spreadValues({
@@ -2193,6 +2197,7 @@ function MoneyInputRendererComponent(props) {
2193
2197
  description,
2194
2198
  validation: validationState,
2195
2199
  help,
2200
+ isFeatureEnabled: props.isFeatureEnabled,
2196
2201
  children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
2197
2202
  import_components31.MoneyInput,
2198
2203
  {
@@ -2277,6 +2282,7 @@ function InlineComponent(props) {
2277
2282
  help,
2278
2283
  description,
2279
2284
  validation: validationState,
2285
+ isFeatureEnabled: props.isFeatureEnabled,
2280
2286
  children: options.map((option, index) => {
2281
2287
  var _a;
2282
2288
  const {
@@ -2389,6 +2395,7 @@ function DefaultComponent(props) {
2389
2395
  help,
2390
2396
  description,
2391
2397
  validation: validationState,
2398
+ isFeatureEnabled: props.isFeatureEnabled,
2392
2399
  children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
2393
2400
  import_components33.SelectInput,
2394
2401
  __spreadValues({
@@ -2450,6 +2457,7 @@ function InlineCheckboxComponent(props) {
2450
2457
  help,
2451
2458
  description,
2452
2459
  validation: validationState,
2460
+ isFeatureEnabled: props.isFeatureEnabled,
2453
2461
  children: options.map((option, index) => {
2454
2462
  var _a;
2455
2463
  const {
@@ -2496,9 +2504,9 @@ var MultiSelectInputRenderer = {
2496
2504
  var import_components36 = require("@transferwise/components");
2497
2505
 
2498
2506
  // ../renderers/src/components/UploadFieldInput.tsx
2499
- var import_react13 = require("react");
2500
2507
  var import_components35 = require("@transferwise/components");
2501
2508
  var import_classnames4 = __toESM(require_classnames());
2509
+ var import_react13 = require("react");
2502
2510
  var import_jsx_runtime57 = require("react/jsx-runtime");
2503
2511
  function UploadFieldInput({
2504
2512
  id,
@@ -2506,14 +2514,15 @@ function UploadFieldInput({
2506
2514
  label,
2507
2515
  description,
2508
2516
  help,
2509
- validation
2517
+ validation,
2518
+ isFeatureEnabled
2510
2519
  }) {
2511
2520
  const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LabelContentWithHelp, { text: label, help }) : label;
2512
2521
  const descriptionId = description ? `${id}-description` : void 0;
2513
2522
  const message = validation == null ? void 0 : validation.message;
2514
2523
  const ref = (0, import_react13.useRef)(null);
2515
2524
  (0, import_react13.useEffect)(() => {
2516
- if (message) {
2525
+ if (message && isFeatureEnabled("scrollToErrors")) {
2517
2526
  scrollToIfNotVisible(ref.current);
2518
2527
  }
2519
2528
  }, [message]);
@@ -2578,6 +2587,7 @@ var MultiUploadInputRenderer = {
2578
2587
  uploadLabel,
2579
2588
  validationState,
2580
2589
  value,
2590
+ isFeatureEnabled,
2581
2591
  onInsertFile,
2582
2592
  onRemoveFile
2583
2593
  } = props;
@@ -2595,6 +2605,7 @@ var MultiUploadInputRenderer = {
2595
2605
  description,
2596
2606
  validation: validationState,
2597
2607
  help,
2608
+ isFeatureEnabled,
2598
2609
  children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2599
2610
  import_components36.UploadInput,
2600
2611
  {
@@ -2648,6 +2659,7 @@ var NumberInputRenderer = {
2648
2659
  inlineAlert: props.inlineAlert,
2649
2660
  loadingState: props.fieldLoadingState,
2650
2661
  help,
2662
+ isFeatureEnabled: props.isFeatureEnabled,
2651
2663
  children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components37.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
2652
2664
  import_components37.Input,
2653
2665
  __spreadValues({
@@ -3096,29 +3108,41 @@ function BlockSearchRendererComponent({
3096
3108
  query,
3097
3109
  state,
3098
3110
  title,
3111
+ isFeatureEnabled,
3099
3112
  trackEvent,
3100
3113
  onChange
3101
3114
  }) {
3102
3115
  const [hasSearched, setHasSearched] = (0, import_react16.useState)(false);
3103
3116
  const { formatMessage } = (0, import_react_intl22.useIntl)();
3104
3117
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getMargin(margin), children: [
3105
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components45.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons3.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
3106
- import_components45.Input,
3118
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
3119
+ FieldInput_default,
3107
3120
  {
3108
3121
  id,
3109
- name: id,
3110
- placeholder: hint,
3111
- type: "text",
3112
- value: query,
3113
- onChange: ({ currentTarget: { value } }) => {
3114
- if (!hasSearched) {
3115
- setHasSearched(true);
3116
- trackEvent("Search Started");
3122
+ description: "",
3123
+ validation: void 0,
3124
+ help: "",
3125
+ label: title,
3126
+ isFeatureEnabled,
3127
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components45.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons3.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
3128
+ import_components45.Input,
3129
+ {
3130
+ id,
3131
+ name: id,
3132
+ placeholder: hint,
3133
+ type: "text",
3134
+ value: query,
3135
+ onChange: ({ currentTarget: { value } }) => {
3136
+ if (!hasSearched) {
3137
+ setHasSearched(true);
3138
+ trackEvent("Search Started");
3139
+ }
3140
+ onChange(value);
3141
+ }
3117
3142
  }
3118
- onChange(value);
3119
- }
3143
+ ) })
3120
3144
  }
3121
- ) }) }),
3145
+ ),
3122
3146
  isLoading ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(SearchResultContent, { state, trackEvent })
3123
3147
  ] });
3124
3148
  }
@@ -3191,46 +3215,58 @@ function InlineSearchRenderer({
3191
3215
  onChange,
3192
3216
  state,
3193
3217
  title,
3218
+ isFeatureEnabled,
3194
3219
  trackEvent
3195
3220
  }) {
3196
3221
  const [hasSearched, setHasSearched] = (0, import_react17.useState)(false);
3197
3222
  const intl = (0, import_react_intl23.useIntl)();
3198
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
3199
- import_components46.Typeahead,
3223
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
3224
+ FieldInput_default,
3200
3225
  {
3201
- id: "typeahead-input-id",
3202
- intl,
3203
- name: "typeahead-input-name",
3204
- size: "md",
3205
- placeholder: hint,
3206
- maxHeight: 100,
3207
- footer: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TypeaheadFooter, { state, isLoading }),
3208
- multiple: false,
3209
- clearable: false,
3210
- addon: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_icons4.Search, { size: 24 }),
3211
- options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3212
- minQueryLength: 1,
3213
- onChange: (values) => {
3214
- if (values.length > 0) {
3215
- const [updatedValue] = values;
3216
- const { value: result } = updatedValue;
3217
- if (result) {
3218
- trackEvent("Search Result Selected", __spreadValues({
3219
- type: result.type
3220
- }, result.type === "action" ? { actionId: result.id } : {}));
3221
- result.onClick();
3226
+ id,
3227
+ description: "",
3228
+ validation: void 0,
3229
+ help: "",
3230
+ label: title,
3231
+ isFeatureEnabled,
3232
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
3233
+ import_components46.Typeahead,
3234
+ {
3235
+ id: "typeahead-input-id",
3236
+ intl,
3237
+ name: "typeahead-input-name",
3238
+ size: "md",
3239
+ placeholder: hint,
3240
+ maxHeight: 100,
3241
+ footer: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(TypeaheadFooter, { state, isLoading }),
3242
+ multiple: false,
3243
+ clearable: false,
3244
+ addon: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_icons4.Search, { size: 24 }),
3245
+ options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3246
+ minQueryLength: 1,
3247
+ onChange: (values) => {
3248
+ if (values.length > 0) {
3249
+ const [updatedValue] = values;
3250
+ const { value: result } = updatedValue;
3251
+ if (result) {
3252
+ trackEvent("Search Result Selected", __spreadValues({
3253
+ type: result.type
3254
+ }, result.type === "action" ? { actionId: result.id } : {}));
3255
+ result.onClick();
3256
+ }
3257
+ }
3258
+ },
3259
+ onInputChange: (query) => {
3260
+ if (!hasSearched) {
3261
+ setHasSearched(true);
3262
+ trackEvent("Search Started");
3263
+ }
3264
+ onChange(query);
3222
3265
  }
3223
3266
  }
3224
- },
3225
- onInputChange: (query) => {
3226
- if (!hasSearched) {
3227
- setHasSearched(true);
3228
- trackEvent("Search Started");
3229
- }
3230
- onChange(query);
3231
- }
3267
+ )
3232
3268
  }
3233
- ) }) });
3269
+ ) });
3234
3270
  }
3235
3271
  function mapResultToTypeaheadOption(result) {
3236
3272
  return {
@@ -3318,6 +3354,7 @@ function RadioInputRendererComponent(props) {
3318
3354
  options,
3319
3355
  selectedIndex,
3320
3356
  validationState,
3357
+ isFeatureEnabled,
3321
3358
  onSelect
3322
3359
  } = props;
3323
3360
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
@@ -3329,6 +3366,7 @@ function RadioInputRendererComponent(props) {
3329
3366
  help,
3330
3367
  description,
3331
3368
  validation: validationState,
3369
+ isFeatureEnabled,
3332
3370
  children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
3333
3371
  import_components48.RadioGroup,
3334
3372
  {
@@ -3366,6 +3404,7 @@ function TabInputRendererComponent(props) {
3366
3404
  options,
3367
3405
  selectedIndex,
3368
3406
  validationState,
3407
+ isFeatureEnabled,
3369
3408
  onSelect
3370
3409
  } = props;
3371
3410
  (0, import_react18.useEffect)(() => {
@@ -3382,6 +3421,7 @@ function TabInputRendererComponent(props) {
3382
3421
  help,
3383
3422
  description,
3384
3423
  validation: validationState,
3424
+ isFeatureEnabled,
3385
3425
  children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3386
3426
  import_components49.Tabs,
3387
3427
  {
@@ -3460,6 +3500,7 @@ function SelectInputRendererComponent(props) {
3460
3500
  help,
3461
3501
  description,
3462
3502
  validation: validationState,
3503
+ isFeatureEnabled: props.isFeatureEnabled,
3463
3504
  children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
3464
3505
  import_components50.SelectInput,
3465
3506
  __spreadValues({
@@ -3494,6 +3535,7 @@ function SegmentedInputRendererComponent(props) {
3494
3535
  options,
3495
3536
  selectedIndex,
3496
3537
  validationState,
3538
+ isFeatureEnabled,
3497
3539
  onSelect
3498
3540
  } = props;
3499
3541
  (0, import_react19.useEffect)(() => {
@@ -3510,6 +3552,7 @@ function SegmentedInputRendererComponent(props) {
3510
3552
  help,
3511
3553
  description,
3512
3554
  validation: validationState,
3555
+ isFeatureEnabled,
3513
3556
  children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
3514
3557
  import_components51.SegmentedControl,
3515
3558
  {
@@ -4094,6 +4137,7 @@ var TextInputRenderer = {
4094
4137
  inlineAlert: props.inlineAlert,
4095
4138
  loadingState: props.fieldLoadingState,
4096
4139
  help,
4140
+ isFeatureEnabled: props.isFeatureEnabled,
4097
4141
  children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components61.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
4098
4142
  }
4099
4143
  );
@@ -4112,7 +4156,18 @@ var import_jsx_runtime88 = require("react/jsx-runtime");
4112
4156
  var UploadInputRenderer = {
4113
4157
  canRenderType: "input-upload",
4114
4158
  render: (props) => {
4115
- const { id, accepts, title, description, disabled, maxSize, validationState, value, onUpload } = props;
4159
+ const {
4160
+ id,
4161
+ accepts,
4162
+ title,
4163
+ description,
4164
+ disabled,
4165
+ maxSize,
4166
+ validationState,
4167
+ value,
4168
+ isFeatureEnabled,
4169
+ onUpload
4170
+ } = props;
4116
4171
  const onUploadFile = async (formData) => {
4117
4172
  const file = formData.get("file");
4118
4173
  return onUpload(file).then(() => ({
@@ -4131,6 +4186,7 @@ var UploadInputRenderer = {
4131
4186
  label: void 0,
4132
4187
  description: void 0,
4133
4188
  validation: validationState,
4189
+ isFeatureEnabled,
4134
4190
  children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4135
4191
  import_components62.UploadInput,
4136
4192
  {
@@ -4205,6 +4261,7 @@ var LargeUploadRenderer = {
4205
4261
  description,
4206
4262
  validation: validationState,
4207
4263
  help,
4264
+ isFeatureEnabled: rest.isFeatureEnabled,
4208
4265
  children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
4209
4266
  import_components62.Upload,
4210
4267
  __spreadProps(__spreadValues({}, uploadProps), {