@wise/dynamic-flow-client 3.18.0 → 3.19.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
@@ -138,12 +138,12 @@ var init_clsx = __esm({
138
138
  }
139
139
  });
140
140
 
141
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js
141
+ // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js
142
142
  import { useState as useState2, useEffect as useEffect2, forwardRef, Suspense, lazy } from "react";
143
143
  import { jsx as jsx17, jsxs as jsxs4, Fragment as Fragment3 } from "react/jsx-runtime";
144
144
  var unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
145
145
  var init_index_93a0c34e_esm = __esm({
146
- "../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js"() {
146
+ "../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js"() {
147
147
  "use strict";
148
148
  init_clsx();
149
149
  unknownFlagName = "wise";
@@ -1598,6 +1598,8 @@ var instructionsComponentToProps = ({
1598
1598
 
1599
1599
  // src/revamp/renderers/mappers/integerInputComponentToProps.ts
1600
1600
  var integerInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-integer")), {
1601
+ maximum: component.maximum,
1602
+ minimum: component.minimum,
1601
1603
  onChange: component.onChange.bind(component)
1602
1604
  });
1603
1605
 
@@ -1661,6 +1663,8 @@ var multiUploadInputComponentToProps = (component) => {
1661
1663
 
1662
1664
  // src/revamp/renderers/mappers/numberInputComponentToProps.ts
1663
1665
  var numberInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-number")), {
1666
+ maximum: component.maximum,
1667
+ minimum: component.minimum,
1664
1668
  onChange: component.onChange.bind(component)
1665
1669
  });
1666
1670
 
@@ -1697,6 +1701,8 @@ var repeatableComponentToProps = (component, children, editableItemChildren) =>
1697
1701
  description,
1698
1702
  editItemTitle,
1699
1703
  errors,
1704
+ maxItems,
1705
+ minItems,
1700
1706
  summaryDefaults,
1701
1707
  title = "",
1702
1708
  onEdit,
@@ -1719,13 +1725,15 @@ var repeatableComponentToProps = (component, children, editableItemChildren) =>
1719
1725
  return {
1720
1726
  type: "repeatable",
1721
1727
  children,
1728
+ addItemTitle,
1722
1729
  control,
1723
- items: itemProps,
1724
- editableItem: editableItemChildren,
1725
- title,
1726
1730
  description,
1727
- addItemTitle,
1731
+ editableItem: editableItemChildren,
1728
1732
  editItemTitle,
1733
+ items: itemProps,
1734
+ maxItems,
1735
+ minItems,
1736
+ title,
1729
1737
  error: errors[0],
1730
1738
  onAdd: onAdd.bind(component),
1731
1739
  onEdit: onEdit.bind(component),
@@ -1834,14 +1842,18 @@ var statusListComponentToProps = ({
1834
1842
  // src/revamp/renderers/mappers/textInputComponentToProps.ts
1835
1843
  var textInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-text")), {
1836
1844
  displayFormat: component.displayFormat,
1845
+ maxLength: component.maxLength,
1846
+ minLength: component.minLength,
1837
1847
  onChange: component.onChange.bind(component)
1838
1848
  });
1839
1849
 
1840
1850
  // src/revamp/renderers/mappers/multiSelectComponentToProps.ts
1841
1851
  var multiSelectInputComponentToProps = (component) => {
1842
- const { options, selectedIndices, onSelect } = component;
1843
- const _a = inputComponentToProps(component, "input-multi-select"), { value } = _a, props = __objRest(_a, ["value"]);
1852
+ const { maxItems, minItems, options, selectedIndices, onSelect } = component;
1853
+ const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
1844
1854
  return __spreadProps(__spreadValues({}, props), {
1855
+ maxItems,
1856
+ minItems,
1845
1857
  options,
1846
1858
  selectedIndices,
1847
1859
  onSelect: onSelect.bind(component)
@@ -6784,84 +6796,34 @@ var createStepComponent = (stepProps) => {
6784
6796
  });
6785
6797
  };
6786
6798
 
6787
- // src/revamp/flow/response-utils.ts
6788
- var assertResponseIsValid = (response) => {
6789
- if (!isResponse(response)) {
6790
- throw new Error("Incorrect type of response from fetch. Expected object of type Response.");
6791
- }
6792
- if (response.bodyUsed) {
6793
- throw new Error(
6794
- "The body of the provided Response object has already been used. Every request must respond with a new Response object."
6795
- );
6796
- }
6797
- };
6798
- var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
6799
- var parseResponseBodyAsJsonElement = async (response) => {
6800
- try {
6801
- return await response.json();
6802
- } catch (e) {
6803
- return null;
6804
- }
6805
- };
6806
- function isActionResponseBody(body) {
6807
- return validateActionResponse(body).valid;
6808
- }
6809
- function assertActionResponseBody(body) {
6810
- if (!isObject(body) || !isObject(body.action)) {
6811
- throw new Error(
6812
- "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
6813
- );
6814
- }
6815
- }
6816
- function isErrorResponseBody(body) {
6817
- return Boolean(
6818
- isObject(body) && (body.refreshFormUrl || body.refreshUrl || body.validation || body.error || body.analytics)
6819
- );
6820
- }
6821
- function assertStepResponseBody(body) {
6822
- if (!isObject(body)) {
6823
- throw new Error("Incorrect response body in step response. Expected an object.");
6824
- }
6825
- }
6826
-
6827
6799
  // src/revamp/domain/features/polling/getStepPolling.ts
6828
6800
  var getStepPolling = ({
6829
- httpClient,
6830
6801
  pollingConfig,
6831
- onAction
6802
+ onAction,
6803
+ onPoll
6832
6804
  }) => {
6833
6805
  const { interval, delay = interval, maxAttempts, url, onError } = pollingConfig;
6834
6806
  let abortController = new AbortController();
6835
6807
  if (delay == null) {
6836
6808
  throw new Error("Polling configuration must include delay or interval");
6837
6809
  }
6838
- const onFailure = () => {
6839
- stop();
6840
- void onAction(onError.action);
6841
- };
6842
6810
  let attempts = 0;
6843
6811
  const poll = () => {
6844
6812
  attempts += 1;
6845
6813
  abortController.abort();
6846
6814
  abortController = new AbortController();
6847
6815
  const { signal } = abortController;
6848
- httpClient(url, { signal }).then(async (response) => {
6849
- if (!response.ok) {
6850
- onFailure();
6816
+ onPoll(url, onError.action, signal).then((result) => {
6817
+ if (result) {
6818
+ stop();
6851
6819
  return;
6852
6820
  }
6853
- response.json().then((body) => {
6854
- if (isActionResponseBody(body)) {
6855
- void onAction(body.action);
6856
- stop();
6857
- }
6858
- }).catch(() => {
6859
- });
6821
+ if (attempts >= maxAttempts && !signal.aborted) {
6822
+ void onAction(onError.action);
6823
+ stop();
6824
+ }
6860
6825
  }).catch(() => {
6861
6826
  });
6862
- if (attempts >= maxAttempts && !signal.aborted) {
6863
- onFailure();
6864
- }
6865
6827
  };
6866
6828
  poll();
6867
6829
  const intervalRef = setInterval(poll, delay * 1e3);
@@ -7636,6 +7598,46 @@ var autocompleteTokenMap = {
7636
7598
  pager: "pager"
7637
7599
  };
7638
7600
 
7601
+ // src/revamp/flow/response-utils.ts
7602
+ var assertResponseIsValid = (response) => {
7603
+ if (!isResponse(response)) {
7604
+ throw new Error("Incorrect type of response from fetch. Expected object of type Response.");
7605
+ }
7606
+ if (response.bodyUsed) {
7607
+ throw new Error(
7608
+ "The body of the provided Response object has already been used. Every request must respond with a new Response object."
7609
+ );
7610
+ }
7611
+ };
7612
+ var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
7613
+ var parseResponseBodyAsJsonElement = async (response) => {
7614
+ try {
7615
+ return await response.json();
7616
+ } catch (e) {
7617
+ return null;
7618
+ }
7619
+ };
7620
+ function isActionResponseBody(body) {
7621
+ return validateActionResponse(body).valid;
7622
+ }
7623
+ function assertActionResponseBody(body) {
7624
+ if (!isObject(body) || !isObject(body.action)) {
7625
+ throw new Error(
7626
+ "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
7627
+ );
7628
+ }
7629
+ }
7630
+ function isErrorResponseBody(body) {
7631
+ return Boolean(
7632
+ isObject(body) && (body.refreshFormUrl || body.refreshUrl || body.validation || body.error || body.analytics)
7633
+ );
7634
+ }
7635
+ function assertStepResponseBody(body) {
7636
+ if (!isObject(body)) {
7637
+ throw new Error("Incorrect response body in step response. Expected an object.");
7638
+ }
7639
+ }
7640
+
7639
7641
  // src/revamp/domain/features/utils/response-utils.ts
7640
7642
  var getAnalyticsFromErrorResponse = (json) => {
7641
7643
  if (!isErrorResponseBody(json)) {
@@ -7836,7 +7838,7 @@ var schemaHasValidationAsync = (schema) => Boolean("validationAsync" in schema &
7836
7838
  // src/revamp/domain/mappers/schema/numberSchemaToComponent.ts
7837
7839
  var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
7838
7840
  const { schema, model, localValue, required = false } = schemaMapperProps;
7839
- const { autocompleteHint, validationMessages, default: defaultValue } = schema;
7841
+ const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
7840
7842
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
7841
7843
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
7842
7844
  const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
@@ -7859,6 +7861,8 @@ var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
7859
7861
  getAboveMaximumCheck(schema, errorMessageFunctions)
7860
7862
  ],
7861
7863
  value,
7864
+ maximum,
7865
+ minimum,
7862
7866
  persistedState,
7863
7867
  validationState,
7864
7868
  performPersistAsync,
@@ -8018,7 +8022,7 @@ var createAllOfComponent = (allOfProps) => {
8018
8022
  return getLocalValues(this.components);
8019
8023
  },
8020
8024
  validate() {
8021
- return validateComponents(this.getChildren());
8025
+ return hidden ? true : validateComponents(this.getChildren());
8022
8026
  }
8023
8027
  };
8024
8028
  };
@@ -8183,7 +8187,7 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
8183
8187
  // src/revamp/domain/mappers/schema/integerSchemaToComponent.ts
8184
8188
  var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8185
8189
  const { schema, localValue, model, required = false } = schemaMapperProps;
8186
- const { autocompleteHint, validationMessages, default: defaultValue } = schema;
8190
+ const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
8187
8191
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
8188
8192
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
8189
8193
  const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
@@ -8206,6 +8210,8 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8206
8210
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
8207
8211
  autoComplete: getAutocompleteString(autocompleteHint),
8208
8212
  checks,
8213
+ maximum,
8214
+ minimum,
8209
8215
  persistedState,
8210
8216
  value,
8211
8217
  validationState,
@@ -8218,82 +8224,29 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8218
8224
  );
8219
8225
  };
8220
8226
 
8221
- // src/revamp/domain/components/utils/getComponentForLocalValueKey.ts
8222
- var getComponentForLocalValueKey = (key, component) => {
8223
- if (component.type === "object") {
8224
- return component.componentMap[key];
8225
- }
8226
- if (component.type === "select") {
8227
- const selectedChild = component.getSelectedChild();
8228
- return selectedChild ? getComponentForLocalValueKey(key, selectedChild) : null;
8229
- }
8230
- const child = hasChildren(component) ? [...component.getChildren()].reverse().find((c) => {
8231
- const v = c.getLocalValue();
8232
- return isObjectLocalValue(v) && key in v;
8233
- }) : void 0;
8234
- return child ? getComponentForLocalValueKey(key, child) : null;
8235
- };
8236
-
8237
- // src/revamp/domain/components/utils/isPartialLocalValueMatch.ts
8238
- var isPartialLocalValueMatch = (partialValue, component) => {
8239
- if (!component) {
8240
- return false;
8241
- }
8242
- const componentValue = component.getLocalValue();
8243
- if (component.type === "const") {
8244
- return isExactLocalValueMatch(partialValue, componentValue);
8245
- }
8246
- if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
8247
- return isPartialObjectMatch(partialValue, componentValue, component);
8248
- }
8249
- if (isArrayLocalValue(partialValue) && component.type === "tuple") {
8250
- return isPartialTupleMatch(partialValue, component);
8227
+ // src/revamp/domain/components/utils/isPartialModelMatch.ts
8228
+ var isPartialModelMatch = (localModel, incomingModel) => {
8229
+ if (isArrayModel(localModel) && isArrayModel(incomingModel)) {
8230
+ return localModel.length === incomingModel.length && localModel.every((value, index) => isPartialModelMatch(value, incomingModel[index]));
8251
8231
  }
8252
- return null;
8253
- };
8254
- var isPartialObjectMatch = (partialValue, componentValue, component) => {
8255
- const results = getMatchingKeys(partialValue, componentValue).map((key) => {
8256
- const componentForKey = getComponentForLocalValueKey(key, component);
8257
- return componentForKey && componentForKey.type === "const" ? isPartialLocalValueMatch(partialValue[key], componentForKey) : null;
8258
- });
8259
- if (results.includes(false)) {
8260
- return false;
8261
- }
8262
- if (results.includes(true)) {
8263
- return true;
8264
- }
8265
- return null;
8266
- };
8267
- var isPartialTupleMatch = (partialValue, component) => {
8268
- const children = component.getChildren();
8269
- const shortest = partialValue.length < children.length ? partialValue : children;
8270
- const results = shortest.map((_value, index) => {
8271
- if (children[index].type !== "const") {
8272
- return null;
8273
- }
8274
- return isPartialLocalValueMatch(partialValue[index], children[index]);
8275
- });
8276
- if (results.includes(false)) {
8277
- return false;
8278
- }
8279
- if (results.includes(true)) {
8280
- return true;
8232
+ if (isObjectModel(localModel) && isObjectModel(incomingModel)) {
8233
+ const nonNullishKeysInBoth = nonNullishKeys(localModel).filter(
8234
+ (key) => nonNullishKeys(incomingModel).includes(key)
8235
+ );
8236
+ return nonNullishKeysInBoth.length > 0 && nonNullishKeysInBoth.every((key) => isPartialModelMatch(localModel[key], incomingModel[key]));
8281
8237
  }
8282
- return null;
8283
- };
8284
- var getMatchingKeys = (a, b) => {
8285
- const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]));
8286
- return allKeys.filter((key) => !isNullish(a[key]) && !isNullish(b[key]));
8238
+ return localModel === incomingModel;
8287
8239
  };
8240
+ var nonNullishKeys = (model) => Object.keys(model).filter((key) => !isNullish(model[key]));
8288
8241
 
8289
8242
  // src/revamp/domain/components/SelectInputComponent.ts
8290
8243
  var createSelectInputComponent = (selectProps, updateComponent) => {
8291
- const _a = selectProps, { uid, checks, initialValue, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialValue", "options", "performRefresh", "onValueChange", "summariser"]);
8244
+ const _a = selectProps, { uid, checks, initialModel, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialModel", "options", "performRefresh", "onValueChange", "summariser"]);
8292
8245
  const children = options.map((option) => option.component);
8293
8246
  const matchingOptions = options.map(
8294
- (option) => isPartialLocalValueMatch(selectProps.initialValue, option.component)
8247
+ (option) => isPartialModelMatch(option.component.getSubmittableValueSync(), initialModel)
8295
8248
  );
8296
- const selectedIndex = matchingOptions.filter(isTrue).length === 1 ? matchingOptions.indexOf(true) : null;
8249
+ const selectedIndex = matchingOptions.filter((match) => match).length === 1 ? matchingOptions.indexOf(true) : null;
8297
8250
  const update = getInputUpdateFunction(uid, updateComponent);
8298
8251
  const getValidationErrors = getLocalValueValidator(checks);
8299
8252
  const getAndSetValidationErrors = (currentValue) => {
@@ -8361,11 +8314,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
8361
8314
  }
8362
8315
  });
8363
8316
  };
8364
- var isTrue = (value) => value === true;
8365
8317
 
8366
8318
  // src/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.ts
8367
8319
  var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8368
- var _a, _b;
8320
+ var _a;
8369
8321
  const {
8370
8322
  uid,
8371
8323
  localValue,
@@ -8387,7 +8339,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8387
8339
  component: mapSchemaToComponent(
8388
8340
  {
8389
8341
  uid: `${uid}.oneOf-${index}`,
8390
- schema: supressSchemaTitleAndDescription(childSchema),
8342
+ schema: isFormSectionSchema(childSchema) ? supressSchemaTitleAndDescription(childSchema) : childSchema,
8391
8343
  model: initialModel,
8392
8344
  localValue,
8393
8345
  validationErrors: initialError,
@@ -8398,15 +8350,14 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8398
8350
  };
8399
8351
  });
8400
8352
  const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
8401
- const { default: defaultValue, validationMessages } = schema;
8353
+ const { validationMessages } = schema;
8402
8354
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
8403
- const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
8404
8355
  return createSelectInputComponent(
8405
8356
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
8406
8357
  autoComplete: getAutocompleteString(schema.autocompleteHint),
8407
8358
  checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
8408
8359
  options,
8409
- initialValue,
8360
+ initialModel,
8410
8361
  performRefresh: getPerformRefresh(schema, onRefresh),
8411
8362
  onValueChange,
8412
8363
  trackEvent
@@ -8414,6 +8365,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8414
8365
  updateComponent
8415
8366
  );
8416
8367
  };
8368
+ var isFormSectionSchema = (schema) => isObjectSchema(schema) || isArrayTupleSchema(schema) || isAllOfSchema(schema);
8417
8369
  var supressSchemaTitleAndDescription = (schema) => {
8418
8370
  const _a = schema, { title, description } = _a, headlessSchema = __objRest(_a, ["title", "description"]);
8419
8371
  return headlessSchema;
@@ -8838,6 +8790,8 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
8838
8790
  default: defaultValue,
8839
8791
  displayFormat,
8840
8792
  format,
8793
+ maxLength,
8794
+ minLength,
8841
8795
  validationMessages
8842
8796
  } = schema;
8843
8797
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
@@ -8865,6 +8819,8 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
8865
8819
  ],
8866
8820
  control: control != null ? control : controlForLegacyFormat,
8867
8821
  displayFormat,
8822
+ maxLength,
8823
+ minLength,
8868
8824
  value,
8869
8825
  persistedState,
8870
8826
  validationState,
@@ -9043,7 +8999,7 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
9043
8999
  required = false,
9044
9000
  validationErrors
9045
9001
  } = schemaMapperProps;
9046
- const { items, addItemTitle, editItemTitle, summary } = schema;
9002
+ const { items, addItemTitle, editItemTitle, maxItems, minItems, summary } = schema;
9047
9003
  const value = isArray(localValue) ? localValue : [];
9048
9004
  const components = initialModel == null ? void 0 : initialModel.map(
9049
9005
  (item, index) => mapSchemaToComponent(
@@ -9080,6 +9036,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
9080
9036
  ],
9081
9037
  components: components != null ? components : [],
9082
9038
  editItemTitle,
9039
+ maxItems,
9040
+ minItems,
9083
9041
  summary,
9084
9042
  createEditableComponent,
9085
9043
  onValueChange
@@ -9392,7 +9350,7 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
9392
9350
  )
9393
9351
  };
9394
9352
  });
9395
- const { title, validationMessages } = schema;
9353
+ const { maxItems, minItems, title, validationMessages } = schema;
9396
9354
  const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
9397
9355
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
9398
9356
  const { performValidationAsync, validationState } = getValidationAsyncInitialState(
@@ -9409,6 +9367,8 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
9409
9367
  getBelowMinItemsCheck(schema, errorMessageFunctions)
9410
9368
  ],
9411
9369
  initialValue,
9370
+ maxItems,
9371
+ minItems,
9412
9372
  options,
9413
9373
  required,
9414
9374
  title,
@@ -10269,14 +10229,16 @@ var mapStepToComponent = (_a) => {
10269
10229
  var _b = _a, {
10270
10230
  loadingState,
10271
10231
  displayStepTitle,
10272
- trackEvent
10232
+ trackEvent,
10233
+ onPoll
10273
10234
  } = _b, restProps = __objRest(_b, [
10274
10235
  "loadingState",
10275
10236
  "displayStepTitle",
10276
- "trackEvent"
10237
+ "trackEvent",
10238
+ "onPoll"
10277
10239
  ]);
10278
10240
  var _a2, _b2;
10279
- const { httpClient, step, updateComponent } = restProps;
10241
+ const { step, updateComponent } = restProps;
10280
10242
  const { id, description, errors, external, key, layout = [], navigation, polling, title } = step;
10281
10243
  const backNavigation = (_a2 = navigation == null ? void 0 : navigation.back) != null ? _a2 : navigation == null ? void 0 : navigation.backButton;
10282
10244
  const back = backNavigation ? {
@@ -10306,7 +10268,7 @@ var mapStepToComponent = (_a) => {
10306
10268
  }
10307
10269
  };
10308
10270
  const onRefresh = async (schemaId, url) => restProps.onRefresh(schemaId, url != null ? url : refreshUrl);
10309
- const stepPolling = polling ? getStepPolling({ httpClient, pollingConfig: polling, onAction: restProps.onAction }) : void 0;
10271
+ const stepPolling = polling ? getStepPolling({ pollingConfig: polling, onAction: restProps.onAction, onPoll }) : void 0;
10310
10272
  const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onAction, onRefresh });
10311
10273
  const unreferencedSchemaFormComponents = mapUnreferencedSchemas(mapperProps);
10312
10274
  const layoutComponents = layout.map(
@@ -10372,8 +10334,19 @@ var executeRefresh = async (props) => {
10372
10334
  // src/revamp/flow/getResponseType.ts
10373
10335
  var responseTypes = ["step", "action", "exit"];
10374
10336
  var getResponseType = async (response) => {
10375
- var _a, _b;
10376
10337
  assertResponseIsValid(response);
10338
+ const headerResponseType = getResponseTypeFromHeader(response);
10339
+ if (headerResponseType) {
10340
+ return headerResponseType;
10341
+ }
10342
+ const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
10343
+ if (isObject(jsonBody) && jsonBody.action) {
10344
+ return "action";
10345
+ }
10346
+ return "step";
10347
+ };
10348
+ var getResponseTypeFromHeader = (response) => {
10349
+ var _a, _b;
10377
10350
  if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
10378
10351
  const type = response.headers.get("X-Df-Response-Type");
10379
10352
  assertDFResponseType(type);
@@ -10382,11 +10355,7 @@ var getResponseType = async (response) => {
10382
10355
  if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
10383
10356
  return "exit";
10384
10357
  }
10385
- const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
10386
- if (isObject(jsonBody) && jsonBody.action) {
10387
- return "action";
10388
- }
10389
- return "step";
10358
+ return void 0;
10390
10359
  };
10391
10360
  function assertDFResponseType(type) {
10392
10361
  if (!responseTypes.includes(type)) {
@@ -10677,6 +10646,48 @@ function useStableCallback(handler) {
10677
10646
  return useCallback((...args) => ref.current ? ref.current(...args) : null, []);
10678
10647
  }
10679
10648
 
10649
+ // src/revamp/flow/executePoll.ts
10650
+ var executePoll = async (props) => {
10651
+ const { errorAction, signal, url, httpClient } = props;
10652
+ try {
10653
+ const response = await httpClient(url != null ? url : "", {
10654
+ method: "GET",
10655
+ signal
10656
+ });
10657
+ if (!response.ok) {
10658
+ return { type: "action", action: errorAction };
10659
+ }
10660
+ const responseType = getResponseTypeFromHeader(response);
10661
+ const body = await parseResponseBodyAsJsonElement(response);
10662
+ try {
10663
+ switch (responseType) {
10664
+ case "step": {
10665
+ const etag = response.headers.get("etag") || null;
10666
+ assertStepResponseBody(body);
10667
+ return { type: "replace-step", step: body, etag };
10668
+ }
10669
+ case "exit": {
10670
+ return { type: "complete", result: body };
10671
+ }
10672
+ case "action": {
10673
+ assertActionResponseBody(body);
10674
+ return { type: "action", action: body.action };
10675
+ }
10676
+ default: {
10677
+ if (isActionResponseBody(body)) {
10678
+ return { type: "action", action: body.action };
10679
+ }
10680
+ return { type: "continue" };
10681
+ }
10682
+ }
10683
+ } catch (error) {
10684
+ return { type: "action", action: errorAction };
10685
+ }
10686
+ } catch (error) {
10687
+ return { type: "continue" };
10688
+ }
10689
+ };
10690
+
10680
10691
  // src/revamp/useDynamicFlowCore.tsx
10681
10692
  function useDynamicFlowCore(props) {
10682
10693
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
@@ -10745,6 +10756,7 @@ function useDynamicFlowCore(props) {
10745
10756
  httpClient,
10746
10757
  onAction,
10747
10758
  onRefresh,
10759
+ onPoll,
10748
10760
  onValueChange
10749
10761
  });
10750
10762
  setStepComponent(() => {
@@ -10878,6 +10890,31 @@ function useDynamicFlowCore(props) {
10878
10890
  // eslint-disable-next-line react-hooks/exhaustive-deps
10879
10891
  []
10880
10892
  );
10893
+ const onPoll = useCallback2(
10894
+ async (url, errorAction, signal) => {
10895
+ const command = await executePoll({
10896
+ httpClient,
10897
+ url,
10898
+ errorAction,
10899
+ signal
10900
+ });
10901
+ switch (command.type) {
10902
+ case "replace-step":
10903
+ initialiseWithStep(command.step, command.etag);
10904
+ return true;
10905
+ case "action":
10906
+ void onAction(command.action);
10907
+ return true;
10908
+ case "complete":
10909
+ onCompletion(command.result);
10910
+ return true;
10911
+ case "continue":
10912
+ return false;
10913
+ }
10914
+ },
10915
+ // eslint-disable-next-line react-hooks/exhaustive-deps
10916
+ []
10917
+ );
10881
10918
  return { stepComponentRef };
10882
10919
  }
10883
10920
 
@@ -11287,7 +11324,7 @@ var DateInputRenderer_default = DateInputRenderer;
11287
11324
  // ../renderers/src/DecisionRenderer.tsx
11288
11325
  import { NavigationOptionsList, NavigationOption, Header } from "@transferwise/components";
11289
11326
 
11290
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.4_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11327
+ // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11291
11328
  init_index_93a0c34e_esm();
11292
11329
  init_clsx();
11293
11330
  import "react";
@@ -12634,6 +12671,8 @@ var TextInputRenderer = {
12634
12671
  description,
12635
12672
  help,
12636
12673
  error,
12674
+ maxLength,
12675
+ minLength,
12637
12676
  type,
12638
12677
  value: initialValue
12639
12678
  } = _a, rest = __objRest(_a, [
@@ -12643,6 +12682,8 @@ var TextInputRenderer = {
12643
12682
  "description",
12644
12683
  "help",
12645
12684
  "error",
12685
+ "maxLength",
12686
+ "minLength",
12646
12687
  "type",
12647
12688
  "value"
12648
12689
  ]);
@@ -5,11 +5,13 @@ import { type PerformRefresh } from '../features/refresh/getPerformRefresh';
5
5
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
6
6
  export type IntegerInputComponent = InputComponent<number | null> & {
7
7
  type: 'integer';
8
+ maximum?: number;
9
+ minimum?: number;
8
10
  persistedState: PersistedState;
9
11
  validationState: ValidationState;
10
12
  onChange: (value: number | null) => void;
11
13
  };
12
- export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
14
+ export declare const createIntegerInputComponent: (integerInputProps: Pick<IntegerInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "maximum" | "minimum" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationState"> & {
13
15
  checks: IsInvalidCheck<number | null>[];
14
16
  performPersistAsync: PerformPersistAsync | undefined;
15
17
  performRefresh: PerformRefresh | undefined;
@@ -6,6 +6,8 @@ import type { SelectInputOption } from './SelectInputComponent';
6
6
  export type MultiSelectComponent = InputComponent<LocalValueArray | null> & {
7
7
  type: 'multi-select';
8
8
  children: DomainComponent[];
9
+ maxItems?: number;
10
+ minItems?: number;
9
11
  options: SelectInputOption[];
10
12
  validationState: ValidationState;
11
13
  selectedIndices: number[];
@@ -13,7 +15,7 @@ export type MultiSelectComponent = InputComponent<LocalValueArray | null> & {
13
15
  getSelectedChildren: () => DomainComponent[] | null;
14
16
  onSelect: (indices: number[]) => void;
15
17
  };
16
- export declare const createMultiSelectComponent: (multiSelectProps: Pick<MultiSelectComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "hidden" | "required" | "title" | "validationState"> & {
18
+ export declare const createMultiSelectComponent: (multiSelectProps: Pick<MultiSelectComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "description" | "disabled" | "errors" | "hidden" | "maxItems" | "minItems" | "required" | "title" | "validationState"> & {
17
19
  checks: IsInvalidCheck<LocalValueArray | null>[];
18
20
  initialValue: LocalValue;
19
21
  options: (SelectInputOption & {