@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.js CHANGED
@@ -144,10 +144,10 @@ var init_clsx = __esm({
144
144
  }
145
145
  });
146
146
 
147
- // ../../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
147
+ // ../../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
148
148
  var import_react7, import_jsx_runtime17, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
149
149
  var init_index_93a0c34e_esm = __esm({
150
- "../../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"() {
150
+ "../../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"() {
151
151
  "use strict";
152
152
  init_clsx();
153
153
  import_react7 = require("react");
@@ -1622,6 +1622,8 @@ var instructionsComponentToProps = ({
1622
1622
 
1623
1623
  // src/revamp/renderers/mappers/integerInputComponentToProps.ts
1624
1624
  var integerInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-integer")), {
1625
+ maximum: component.maximum,
1626
+ minimum: component.minimum,
1625
1627
  onChange: component.onChange.bind(component)
1626
1628
  });
1627
1629
 
@@ -1685,6 +1687,8 @@ var multiUploadInputComponentToProps = (component) => {
1685
1687
 
1686
1688
  // src/revamp/renderers/mappers/numberInputComponentToProps.ts
1687
1689
  var numberInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-number")), {
1690
+ maximum: component.maximum,
1691
+ minimum: component.minimum,
1688
1692
  onChange: component.onChange.bind(component)
1689
1693
  });
1690
1694
 
@@ -1721,6 +1725,8 @@ var repeatableComponentToProps = (component, children, editableItemChildren) =>
1721
1725
  description,
1722
1726
  editItemTitle,
1723
1727
  errors,
1728
+ maxItems,
1729
+ minItems,
1724
1730
  summaryDefaults,
1725
1731
  title = "",
1726
1732
  onEdit,
@@ -1743,13 +1749,15 @@ var repeatableComponentToProps = (component, children, editableItemChildren) =>
1743
1749
  return {
1744
1750
  type: "repeatable",
1745
1751
  children,
1752
+ addItemTitle,
1746
1753
  control,
1747
- items: itemProps,
1748
- editableItem: editableItemChildren,
1749
- title,
1750
1754
  description,
1751
- addItemTitle,
1755
+ editableItem: editableItemChildren,
1752
1756
  editItemTitle,
1757
+ items: itemProps,
1758
+ maxItems,
1759
+ minItems,
1760
+ title,
1753
1761
  error: errors[0],
1754
1762
  onAdd: onAdd.bind(component),
1755
1763
  onEdit: onEdit.bind(component),
@@ -1858,14 +1866,18 @@ var statusListComponentToProps = ({
1858
1866
  // src/revamp/renderers/mappers/textInputComponentToProps.ts
1859
1867
  var textInputComponentToProps = (component) => __spreadProps(__spreadValues({}, inputComponentToProps(component, "input-text")), {
1860
1868
  displayFormat: component.displayFormat,
1869
+ maxLength: component.maxLength,
1870
+ minLength: component.minLength,
1861
1871
  onChange: component.onChange.bind(component)
1862
1872
  });
1863
1873
 
1864
1874
  // src/revamp/renderers/mappers/multiSelectComponentToProps.ts
1865
1875
  var multiSelectInputComponentToProps = (component) => {
1866
- const { options, selectedIndices, onSelect } = component;
1867
- const _a = inputComponentToProps(component, "input-multi-select"), { value } = _a, props = __objRest(_a, ["value"]);
1876
+ const { maxItems, minItems, options, selectedIndices, onSelect } = component;
1877
+ const _a = inputComponentToProps(component, "input-multi-select"), { required, value } = _a, props = __objRest(_a, ["required", "value"]);
1868
1878
  return __spreadProps(__spreadValues({}, props), {
1879
+ maxItems,
1880
+ minItems,
1869
1881
  options,
1870
1882
  selectedIndices,
1871
1883
  onSelect: onSelect.bind(component)
@@ -6808,84 +6820,34 @@ var createStepComponent = (stepProps) => {
6808
6820
  });
6809
6821
  };
6810
6822
 
6811
- // src/revamp/flow/response-utils.ts
6812
- var assertResponseIsValid = (response) => {
6813
- if (!isResponse(response)) {
6814
- throw new Error("Incorrect type of response from fetch. Expected object of type Response.");
6815
- }
6816
- if (response.bodyUsed) {
6817
- throw new Error(
6818
- "The body of the provided Response object has already been used. Every request must respond with a new Response object."
6819
- );
6820
- }
6821
- };
6822
- var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
6823
- var parseResponseBodyAsJsonElement = async (response) => {
6824
- try {
6825
- return await response.json();
6826
- } catch (e) {
6827
- return null;
6828
- }
6829
- };
6830
- function isActionResponseBody(body) {
6831
- return validateActionResponse(body).valid;
6832
- }
6833
- function assertActionResponseBody(body) {
6834
- if (!isObject(body) || !isObject(body.action)) {
6835
- throw new Error(
6836
- "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
6837
- );
6838
- }
6839
- }
6840
- function isErrorResponseBody(body) {
6841
- return Boolean(
6842
- isObject(body) && (body.refreshFormUrl || body.refreshUrl || body.validation || body.error || body.analytics)
6843
- );
6844
- }
6845
- function assertStepResponseBody(body) {
6846
- if (!isObject(body)) {
6847
- throw new Error("Incorrect response body in step response. Expected an object.");
6848
- }
6849
- }
6850
-
6851
6823
  // src/revamp/domain/features/polling/getStepPolling.ts
6852
6824
  var getStepPolling = ({
6853
- httpClient,
6854
6825
  pollingConfig,
6855
- onAction
6826
+ onAction,
6827
+ onPoll
6856
6828
  }) => {
6857
6829
  const { interval, delay = interval, maxAttempts, url, onError } = pollingConfig;
6858
6830
  let abortController = new AbortController();
6859
6831
  if (delay == null) {
6860
6832
  throw new Error("Polling configuration must include delay or interval");
6861
6833
  }
6862
- const onFailure = () => {
6863
- stop();
6864
- void onAction(onError.action);
6865
- };
6866
6834
  let attempts = 0;
6867
6835
  const poll = () => {
6868
6836
  attempts += 1;
6869
6837
  abortController.abort();
6870
6838
  abortController = new AbortController();
6871
6839
  const { signal } = abortController;
6872
- httpClient(url, { signal }).then(async (response) => {
6873
- if (!response.ok) {
6874
- onFailure();
6840
+ onPoll(url, onError.action, signal).then((result) => {
6841
+ if (result) {
6842
+ stop();
6875
6843
  return;
6876
6844
  }
6877
- response.json().then((body) => {
6878
- if (isActionResponseBody(body)) {
6879
- void onAction(body.action);
6880
- stop();
6881
- }
6882
- }).catch(() => {
6883
- });
6845
+ if (attempts >= maxAttempts && !signal.aborted) {
6846
+ void onAction(onError.action);
6847
+ stop();
6848
+ }
6884
6849
  }).catch(() => {
6885
6850
  });
6886
- if (attempts >= maxAttempts && !signal.aborted) {
6887
- onFailure();
6888
- }
6889
6851
  };
6890
6852
  poll();
6891
6853
  const intervalRef = setInterval(poll, delay * 1e3);
@@ -7660,6 +7622,46 @@ var autocompleteTokenMap = {
7660
7622
  pager: "pager"
7661
7623
  };
7662
7624
 
7625
+ // src/revamp/flow/response-utils.ts
7626
+ var assertResponseIsValid = (response) => {
7627
+ if (!isResponse(response)) {
7628
+ throw new Error("Incorrect type of response from fetch. Expected object of type Response.");
7629
+ }
7630
+ if (response.bodyUsed) {
7631
+ throw new Error(
7632
+ "The body of the provided Response object has already been used. Every request must respond with a new Response object."
7633
+ );
7634
+ }
7635
+ };
7636
+ var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
7637
+ var parseResponseBodyAsJsonElement = async (response) => {
7638
+ try {
7639
+ return await response.json();
7640
+ } catch (e) {
7641
+ return null;
7642
+ }
7643
+ };
7644
+ function isActionResponseBody(body) {
7645
+ return validateActionResponse(body).valid;
7646
+ }
7647
+ function assertActionResponseBody(body) {
7648
+ if (!isObject(body) || !isObject(body.action)) {
7649
+ throw new Error(
7650
+ "Incorrect response body in action response. Expected an object satisfying the type { action: Action }."
7651
+ );
7652
+ }
7653
+ }
7654
+ function isErrorResponseBody(body) {
7655
+ return Boolean(
7656
+ isObject(body) && (body.refreshFormUrl || body.refreshUrl || body.validation || body.error || body.analytics)
7657
+ );
7658
+ }
7659
+ function assertStepResponseBody(body) {
7660
+ if (!isObject(body)) {
7661
+ throw new Error("Incorrect response body in step response. Expected an object.");
7662
+ }
7663
+ }
7664
+
7663
7665
  // src/revamp/domain/features/utils/response-utils.ts
7664
7666
  var getAnalyticsFromErrorResponse = (json) => {
7665
7667
  if (!isErrorResponseBody(json)) {
@@ -7860,7 +7862,7 @@ var schemaHasValidationAsync = (schema) => Boolean("validationAsync" in schema &
7860
7862
  // src/revamp/domain/mappers/schema/numberSchemaToComponent.ts
7861
7863
  var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
7862
7864
  const { schema, model, localValue, required = false } = schemaMapperProps;
7863
- const { autocompleteHint, validationMessages, default: defaultValue } = schema;
7865
+ const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
7864
7866
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
7865
7867
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
7866
7868
  const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
@@ -7883,6 +7885,8 @@ var numberSchemaToComponent = (schemaMapperProps, mapperProps) => {
7883
7885
  getAboveMaximumCheck(schema, errorMessageFunctions)
7884
7886
  ],
7885
7887
  value,
7888
+ maximum,
7889
+ minimum,
7886
7890
  persistedState,
7887
7891
  validationState,
7888
7892
  performPersistAsync,
@@ -8042,7 +8046,7 @@ var createAllOfComponent = (allOfProps) => {
8042
8046
  return getLocalValues(this.components);
8043
8047
  },
8044
8048
  validate() {
8045
- return validateComponents(this.getChildren());
8049
+ return hidden ? true : validateComponents(this.getChildren());
8046
8050
  }
8047
8051
  };
8048
8052
  };
@@ -8207,7 +8211,7 @@ var createIntegerInputComponent = (integerInputProps, updateComponent) => {
8207
8211
  // src/revamp/domain/mappers/schema/integerSchemaToComponent.ts
8208
8212
  var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8209
8213
  const { schema, localValue, model, required = false } = schemaMapperProps;
8210
- const { autocompleteHint, validationMessages, default: defaultValue } = schema;
8214
+ const { autocompleteHint, validationMessages, default: defaultValue, maximum, minimum } = schema;
8211
8215
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
8212
8216
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
8213
8217
  const { performPersistAsync, persistedState } = getPersistAsyncInitialState(
@@ -8230,6 +8234,8 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8230
8234
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
8231
8235
  autoComplete: getAutocompleteString(autocompleteHint),
8232
8236
  checks,
8237
+ maximum,
8238
+ minimum,
8233
8239
  persistedState,
8234
8240
  value,
8235
8241
  validationState,
@@ -8242,82 +8248,29 @@ var integerSchemaToComponent = (schemaMapperProps, mapperProps) => {
8242
8248
  );
8243
8249
  };
8244
8250
 
8245
- // src/revamp/domain/components/utils/getComponentForLocalValueKey.ts
8246
- var getComponentForLocalValueKey = (key, component) => {
8247
- if (component.type === "object") {
8248
- return component.componentMap[key];
8249
- }
8250
- if (component.type === "select") {
8251
- const selectedChild = component.getSelectedChild();
8252
- return selectedChild ? getComponentForLocalValueKey(key, selectedChild) : null;
8253
- }
8254
- const child = hasChildren(component) ? [...component.getChildren()].reverse().find((c) => {
8255
- const v = c.getLocalValue();
8256
- return isObjectLocalValue(v) && key in v;
8257
- }) : void 0;
8258
- return child ? getComponentForLocalValueKey(key, child) : null;
8259
- };
8260
-
8261
- // src/revamp/domain/components/utils/isPartialLocalValueMatch.ts
8262
- var isPartialLocalValueMatch = (partialValue, component) => {
8263
- if (!component) {
8264
- return false;
8265
- }
8266
- const componentValue = component.getLocalValue();
8267
- if (component.type === "const") {
8268
- return isExactLocalValueMatch(partialValue, componentValue);
8269
- }
8270
- if (isObjectLocalValue(partialValue) && isObjectLocalValue(componentValue)) {
8271
- return isPartialObjectMatch(partialValue, componentValue, component);
8272
- }
8273
- if (isArrayLocalValue(partialValue) && component.type === "tuple") {
8274
- return isPartialTupleMatch(partialValue, component);
8251
+ // src/revamp/domain/components/utils/isPartialModelMatch.ts
8252
+ var isPartialModelMatch = (localModel, incomingModel) => {
8253
+ if (isArrayModel(localModel) && isArrayModel(incomingModel)) {
8254
+ return localModel.length === incomingModel.length && localModel.every((value, index) => isPartialModelMatch(value, incomingModel[index]));
8275
8255
  }
8276
- return null;
8277
- };
8278
- var isPartialObjectMatch = (partialValue, componentValue, component) => {
8279
- const results = getMatchingKeys(partialValue, componentValue).map((key) => {
8280
- const componentForKey = getComponentForLocalValueKey(key, component);
8281
- return componentForKey && componentForKey.type === "const" ? isPartialLocalValueMatch(partialValue[key], componentForKey) : null;
8282
- });
8283
- if (results.includes(false)) {
8284
- return false;
8285
- }
8286
- if (results.includes(true)) {
8287
- return true;
8288
- }
8289
- return null;
8290
- };
8291
- var isPartialTupleMatch = (partialValue, component) => {
8292
- const children = component.getChildren();
8293
- const shortest = partialValue.length < children.length ? partialValue : children;
8294
- const results = shortest.map((_value, index) => {
8295
- if (children[index].type !== "const") {
8296
- return null;
8297
- }
8298
- return isPartialLocalValueMatch(partialValue[index], children[index]);
8299
- });
8300
- if (results.includes(false)) {
8301
- return false;
8302
- }
8303
- if (results.includes(true)) {
8304
- return true;
8256
+ if (isObjectModel(localModel) && isObjectModel(incomingModel)) {
8257
+ const nonNullishKeysInBoth = nonNullishKeys(localModel).filter(
8258
+ (key) => nonNullishKeys(incomingModel).includes(key)
8259
+ );
8260
+ return nonNullishKeysInBoth.length > 0 && nonNullishKeysInBoth.every((key) => isPartialModelMatch(localModel[key], incomingModel[key]));
8305
8261
  }
8306
- return null;
8307
- };
8308
- var getMatchingKeys = (a, b) => {
8309
- const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]));
8310
- return allKeys.filter((key) => !isNullish(a[key]) && !isNullish(b[key]));
8262
+ return localModel === incomingModel;
8311
8263
  };
8264
+ var nonNullishKeys = (model) => Object.keys(model).filter((key) => !isNullish(model[key]));
8312
8265
 
8313
8266
  // src/revamp/domain/components/SelectInputComponent.ts
8314
8267
  var createSelectInputComponent = (selectProps, updateComponent) => {
8315
- const _a = selectProps, { uid, checks, initialValue, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialValue", "options", "performRefresh", "onValueChange", "summariser"]);
8268
+ const _a = selectProps, { uid, checks, initialModel, options, performRefresh, onValueChange, summariser } = _a, rest = __objRest(_a, ["uid", "checks", "initialModel", "options", "performRefresh", "onValueChange", "summariser"]);
8316
8269
  const children = options.map((option) => option.component);
8317
8270
  const matchingOptions = options.map(
8318
- (option) => isPartialLocalValueMatch(selectProps.initialValue, option.component)
8271
+ (option) => isPartialModelMatch(option.component.getSubmittableValueSync(), initialModel)
8319
8272
  );
8320
- const selectedIndex = matchingOptions.filter(isTrue).length === 1 ? matchingOptions.indexOf(true) : null;
8273
+ const selectedIndex = matchingOptions.filter((match) => match).length === 1 ? matchingOptions.indexOf(true) : null;
8321
8274
  const update = getInputUpdateFunction(uid, updateComponent);
8322
8275
  const getValidationErrors = getLocalValueValidator(checks);
8323
8276
  const getAndSetValidationErrors = (currentValue) => {
@@ -8385,11 +8338,10 @@ var createSelectInputComponent = (selectProps, updateComponent) => {
8385
8338
  }
8386
8339
  });
8387
8340
  };
8388
- var isTrue = (value) => value === true;
8389
8341
 
8390
8342
  // src/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.ts
8391
8343
  var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8392
- var _a, _b;
8344
+ var _a;
8393
8345
  const {
8394
8346
  uid,
8395
8347
  localValue,
@@ -8411,7 +8363,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8411
8363
  component: mapSchemaToComponent(
8412
8364
  {
8413
8365
  uid: `${uid}.oneOf-${index}`,
8414
- schema: supressSchemaTitleAndDescription(childSchema),
8366
+ schema: isFormSectionSchema(childSchema) ? supressSchemaTitleAndDescription(childSchema) : childSchema,
8415
8367
  model: initialModel,
8416
8368
  localValue,
8417
8369
  validationErrors: initialError,
@@ -8422,15 +8374,14 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8422
8374
  };
8423
8375
  });
8424
8376
  const { getErrorMessageFunctions, updateComponent, trackEvent, onRefresh, onValueChange } = mapperProps;
8425
- const { default: defaultValue, validationMessages } = schema;
8377
+ const { validationMessages } = schema;
8426
8378
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
8427
- const initialValue = (_b = model != null ? model : defaultValue) != null ? _b : null;
8428
8379
  return createSelectInputComponent(
8429
8380
  __spreadProps(__spreadValues({}, mapCommonSchemaProps(schemaMapperProps)), {
8430
8381
  autoComplete: getAutocompleteString(schema.autocompleteHint),
8431
8382
  checks: schema.hidden ? [] : [getRequiredCheck(required, errorMessageFunctions)],
8432
8383
  options,
8433
- initialValue,
8384
+ initialModel,
8434
8385
  performRefresh: getPerformRefresh(schema, onRefresh),
8435
8386
  onValueChange,
8436
8387
  trackEvent
@@ -8438,6 +8389,7 @@ var oneOfSchemaToComponent = (schemaMapperProps, mapperProps) => {
8438
8389
  updateComponent
8439
8390
  );
8440
8391
  };
8392
+ var isFormSectionSchema = (schema) => isObjectSchema(schema) || isArrayTupleSchema(schema) || isAllOfSchema(schema);
8441
8393
  var supressSchemaTitleAndDescription = (schema) => {
8442
8394
  const _a = schema, { title, description } = _a, headlessSchema = __objRest(_a, ["title", "description"]);
8443
8395
  return headlessSchema;
@@ -8862,6 +8814,8 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
8862
8814
  default: defaultValue,
8863
8815
  displayFormat,
8864
8816
  format,
8817
+ maxLength,
8818
+ minLength,
8865
8819
  validationMessages
8866
8820
  } = schema;
8867
8821
  const { getErrorMessageFunctions, updateComponent, onRefresh, onValueChange } = mapperProps;
@@ -8889,6 +8843,8 @@ var stringSchemaToTextInputComponent = (schemaMapperProps, mapperProps) => {
8889
8843
  ],
8890
8844
  control: control != null ? control : controlForLegacyFormat,
8891
8845
  displayFormat,
8846
+ maxLength,
8847
+ minLength,
8892
8848
  value,
8893
8849
  persistedState,
8894
8850
  validationState,
@@ -9067,7 +9023,7 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
9067
9023
  required = false,
9068
9024
  validationErrors
9069
9025
  } = schemaMapperProps;
9070
- const { items, addItemTitle, editItemTitle, summary } = schema;
9026
+ const { items, addItemTitle, editItemTitle, maxItems, minItems, summary } = schema;
9071
9027
  const value = isArray(localValue) ? localValue : [];
9072
9028
  const components = initialModel == null ? void 0 : initialModel.map(
9073
9029
  (item, index) => mapSchemaToComponent(
@@ -9104,6 +9060,8 @@ var arraySchemaToRepeatableComponent = (schemaMapperProps, mapperProps) => {
9104
9060
  ],
9105
9061
  components: components != null ? components : [],
9106
9062
  editItemTitle,
9063
+ maxItems,
9064
+ minItems,
9107
9065
  summary,
9108
9066
  createEditableComponent,
9109
9067
  onValueChange
@@ -9416,7 +9374,7 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
9416
9374
  )
9417
9375
  };
9418
9376
  });
9419
- const { title, validationMessages } = schema;
9377
+ const { maxItems, minItems, title, validationMessages } = schema;
9420
9378
  const { getErrorMessageFunctions, onRefresh, onValueChange, updateComponent } = mapperProps;
9421
9379
  const errorMessageFunctions = getErrorMessageFunctions(validationMessages);
9422
9380
  const { performValidationAsync, validationState } = getValidationAsyncInitialState(
@@ -9433,6 +9391,8 @@ var arraySchemaToMultiSelectComponent = (schemaMapperProps, mapperProps) => {
9433
9391
  getBelowMinItemsCheck(schema, errorMessageFunctions)
9434
9392
  ],
9435
9393
  initialValue,
9394
+ maxItems,
9395
+ minItems,
9436
9396
  options,
9437
9397
  required,
9438
9398
  title,
@@ -10293,14 +10253,16 @@ var mapStepToComponent = (_a) => {
10293
10253
  var _b = _a, {
10294
10254
  loadingState,
10295
10255
  displayStepTitle,
10296
- trackEvent
10256
+ trackEvent,
10257
+ onPoll
10297
10258
  } = _b, restProps = __objRest(_b, [
10298
10259
  "loadingState",
10299
10260
  "displayStepTitle",
10300
- "trackEvent"
10261
+ "trackEvent",
10262
+ "onPoll"
10301
10263
  ]);
10302
10264
  var _a2, _b2;
10303
- const { httpClient, step, updateComponent } = restProps;
10265
+ const { step, updateComponent } = restProps;
10304
10266
  const { id, description, errors, external, key, layout = [], navigation, polling, title } = step;
10305
10267
  const backNavigation = (_a2 = navigation == null ? void 0 : navigation.back) != null ? _a2 : navigation == null ? void 0 : navigation.backButton;
10306
10268
  const back = backNavigation ? {
@@ -10330,7 +10292,7 @@ var mapStepToComponent = (_a) => {
10330
10292
  }
10331
10293
  };
10332
10294
  const onRefresh = async (schemaId, url) => restProps.onRefresh(schemaId, url != null ? url : refreshUrl);
10333
- const stepPolling = polling ? getStepPolling({ httpClient, pollingConfig: polling, onAction: restProps.onAction }) : void 0;
10295
+ const stepPolling = polling ? getStepPolling({ pollingConfig: polling, onAction: restProps.onAction, onPoll }) : void 0;
10334
10296
  const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onAction, onRefresh });
10335
10297
  const unreferencedSchemaFormComponents = mapUnreferencedSchemas(mapperProps);
10336
10298
  const layoutComponents = layout.map(
@@ -10396,8 +10358,19 @@ var executeRefresh = async (props) => {
10396
10358
  // src/revamp/flow/getResponseType.ts
10397
10359
  var responseTypes = ["step", "action", "exit"];
10398
10360
  var getResponseType = async (response) => {
10399
- var _a, _b;
10400
10361
  assertResponseIsValid(response);
10362
+ const headerResponseType = getResponseTypeFromHeader(response);
10363
+ if (headerResponseType) {
10364
+ return headerResponseType;
10365
+ }
10366
+ const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
10367
+ if (isObject(jsonBody) && jsonBody.action) {
10368
+ return "action";
10369
+ }
10370
+ return "step";
10371
+ };
10372
+ var getResponseTypeFromHeader = (response) => {
10373
+ var _a, _b;
10401
10374
  if ((_a = response.headers) == null ? void 0 : _a.has("X-Df-Response-Type")) {
10402
10375
  const type = response.headers.get("X-Df-Response-Type");
10403
10376
  assertDFResponseType(type);
@@ -10406,11 +10379,7 @@ var getResponseType = async (response) => {
10406
10379
  if ((_b = response.headers) == null ? void 0 : _b.has("X-Df-Exit")) {
10407
10380
  return "exit";
10408
10381
  }
10409
- const jsonBody = await parseResponseBodyAsJsonElement(response.clone());
10410
- if (isObject(jsonBody) && jsonBody.action) {
10411
- return "action";
10412
- }
10413
- return "step";
10382
+ return void 0;
10414
10383
  };
10415
10384
  function assertDFResponseType(type) {
10416
10385
  if (!responseTypes.includes(type)) {
@@ -10701,6 +10670,48 @@ function useStableCallback(handler) {
10701
10670
  return (0, import_react2.useCallback)((...args) => ref.current ? ref.current(...args) : null, []);
10702
10671
  }
10703
10672
 
10673
+ // src/revamp/flow/executePoll.ts
10674
+ var executePoll = async (props) => {
10675
+ const { errorAction, signal, url, httpClient } = props;
10676
+ try {
10677
+ const response = await httpClient(url != null ? url : "", {
10678
+ method: "GET",
10679
+ signal
10680
+ });
10681
+ if (!response.ok) {
10682
+ return { type: "action", action: errorAction };
10683
+ }
10684
+ const responseType = getResponseTypeFromHeader(response);
10685
+ const body = await parseResponseBodyAsJsonElement(response);
10686
+ try {
10687
+ switch (responseType) {
10688
+ case "step": {
10689
+ const etag = response.headers.get("etag") || null;
10690
+ assertStepResponseBody(body);
10691
+ return { type: "replace-step", step: body, etag };
10692
+ }
10693
+ case "exit": {
10694
+ return { type: "complete", result: body };
10695
+ }
10696
+ case "action": {
10697
+ assertActionResponseBody(body);
10698
+ return { type: "action", action: body.action };
10699
+ }
10700
+ default: {
10701
+ if (isActionResponseBody(body)) {
10702
+ return { type: "action", action: body.action };
10703
+ }
10704
+ return { type: "continue" };
10705
+ }
10706
+ }
10707
+ } catch (error) {
10708
+ return { type: "action", action: errorAction };
10709
+ }
10710
+ } catch (error) {
10711
+ return { type: "continue" };
10712
+ }
10713
+ };
10714
+
10704
10715
  // src/revamp/useDynamicFlowCore.tsx
10705
10716
  function useDynamicFlowCore(props) {
10706
10717
  const _a = props, { flowId, initialAction, initialStep, displayStepTitle = true } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "displayStepTitle"]);
@@ -10769,6 +10780,7 @@ function useDynamicFlowCore(props) {
10769
10780
  httpClient,
10770
10781
  onAction,
10771
10782
  onRefresh,
10783
+ onPoll,
10772
10784
  onValueChange
10773
10785
  });
10774
10786
  setStepComponent(() => {
@@ -10902,6 +10914,31 @@ function useDynamicFlowCore(props) {
10902
10914
  // eslint-disable-next-line react-hooks/exhaustive-deps
10903
10915
  []
10904
10916
  );
10917
+ const onPoll = (0, import_react3.useCallback)(
10918
+ async (url, errorAction, signal) => {
10919
+ const command = await executePoll({
10920
+ httpClient,
10921
+ url,
10922
+ errorAction,
10923
+ signal
10924
+ });
10925
+ switch (command.type) {
10926
+ case "replace-step":
10927
+ initialiseWithStep(command.step, command.etag);
10928
+ return true;
10929
+ case "action":
10930
+ void onAction(command.action);
10931
+ return true;
10932
+ case "complete":
10933
+ onCompletion(command.result);
10934
+ return true;
10935
+ case "continue":
10936
+ return false;
10937
+ }
10938
+ },
10939
+ // eslint-disable-next-line react-hooks/exhaustive-deps
10940
+ []
10941
+ );
10905
10942
  return { stepComponentRef };
10906
10943
  }
10907
10944
 
@@ -11311,7 +11348,7 @@ var DateInputRenderer_default = DateInputRenderer;
11311
11348
  // ../renderers/src/DecisionRenderer.tsx
11312
11349
  var import_components9 = require("@transferwise/components");
11313
11350
 
11314
- // ../../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
11351
+ // ../../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
11315
11352
  init_index_93a0c34e_esm();
11316
11353
  init_clsx();
11317
11354
  var import_react8 = require("react");
@@ -12652,6 +12689,8 @@ var TextInputRenderer = {
12652
12689
  description,
12653
12690
  help,
12654
12691
  error,
12692
+ maxLength,
12693
+ minLength,
12655
12694
  type,
12656
12695
  value: initialValue
12657
12696
  } = _a, rest = __objRest(_a, [
@@ -12661,6 +12700,8 @@ var TextInputRenderer = {
12661
12700
  "description",
12662
12701
  "help",
12663
12702
  "error",
12703
+ "maxLength",
12704
+ "minLength",
12664
12705
  "type",
12665
12706
  "value"
12666
12707
  ]);