@wise/dynamic-flow-client 5.0.1-exp-css-28d60ea → 5.1.1

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.
Files changed (27) hide show
  1. package/README.md +7 -2
  2. package/build/main.css +1 -1
  3. package/build/main.js +286 -184
  4. package/build/main.mjs +286 -184
  5. package/build/types/domain/components/step/StepDomainComponent.d.ts +4 -2
  6. package/build/types/domain/features/polling/getStepPolling.d.ts +3 -2
  7. package/build/types/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  8. package/build/types/domain/mappers/layout/decisionLayoutToComponent.d.ts +1 -1
  9. package/build/types/domain/mappers/layout/reviewLayoutToComponent.d.ts +1 -1
  10. package/build/types/domain/mappers/layout/searchLayoutToComponent.d.ts +1 -1
  11. package/build/types/domain/mappers/layout/statusListLayoutToComponent.d.ts +1 -1
  12. package/build/types/domain/mappers/mapStepToComponent.d.ts +1 -1
  13. package/build/types/domain/mappers/schema/types.d.ts +2 -1
  14. package/build/types/domain/mappers/utils/behavior-utils.d.ts +5 -2
  15. package/build/types/domain/mappers/utils/call-to-action-utils.d.ts +3 -2
  16. package/build/types/domain/mappers/utils/utils.d.ts +3 -2
  17. package/build/types/domain/prefetching/request-cache.d.ts +9 -0
  18. package/build/types/flow/executeSubmission.d.ts +4 -1
  19. package/build/types/flow/makeSafeHttpClient.d.ts +2 -0
  20. package/build/types/flow/makeSubmissionRequest.d.ts +3 -0
  21. package/package.json +25 -35
  22. package/build/types/domain/mappers/schema/tests/test-utils.d.ts +0 -34
  23. package/build/types/test-utils/NeptuneProviders.d.ts +0 -5
  24. package/build/types/test-utils/getRandomId.d.ts +0 -1
  25. package/build/types/test-utils/index.d.ts +0 -2
  26. package/build/types/test-utils/rtl-utils.d.ts +0 -2
  27. package/build/types/tests/renderers/TextInputRenderer.test.d.ts +0 -1
package/build/main.mjs CHANGED
@@ -1148,15 +1148,16 @@ var createAlertComponent = (alertProps) => __spreadValues({
1148
1148
  }, alertProps);
1149
1149
 
1150
1150
  // src/domain/mappers/utils/behavior-utils.ts
1151
- var getDomainLayerBehavior = ({
1152
- action,
1153
- behavior
1154
- }, stepActions) => {
1155
- if (behavior) {
1156
- return normaliseBehavior(behavior, stepActions);
1151
+ var getDomainLayerBehavior = ({ action, behavior: specBehavior }, stepActions, registerSubmissionBehavior) => {
1152
+ if (specBehavior) {
1153
+ const behavior = normaliseBehavior(specBehavior, stepActions);
1154
+ registerSubmissionBehavior == null ? void 0 : registerSubmissionBehavior(behavior);
1155
+ return behavior;
1157
1156
  }
1158
1157
  if (action) {
1159
- return actionToBehavior(action, stepActions);
1158
+ const behavior = actionToBehavior(action, stepActions);
1159
+ registerSubmissionBehavior == null ? void 0 : registerSubmissionBehavior(behavior);
1160
+ return behavior;
1160
1161
  }
1161
1162
  return { type: "none" };
1162
1163
  };
@@ -1186,14 +1187,17 @@ var getActionByReference = ($ref, actions = []) => {
1186
1187
  };
1187
1188
 
1188
1189
  // src/domain/mappers/utils/call-to-action-utils.ts
1189
- var getDomainLayerCallToAction = (callToAction, onBehavior, stepActions) => {
1190
+ var getDomainLayerCallToAction = (callToAction, mapperProps) => {
1191
+ var _a;
1190
1192
  if (!callToAction) {
1191
1193
  return void 0;
1192
1194
  }
1195
+ const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
1196
+ const stepActions = (_a = step.actions) != null ? _a : [];
1193
1197
  const { title = "", accessibilityDescription, action, behavior } = callToAction;
1194
1198
  return getCallToAction(
1195
1199
  { title, accessibilityDescription },
1196
- getDomainLayerBehavior({ action, behavior }, stepActions),
1200
+ getDomainLayerBehavior({ action, behavior }, stepActions, registerSubmissionBehavior),
1197
1201
  onBehavior
1198
1202
  );
1199
1203
  };
@@ -1282,22 +1286,21 @@ var mapLegacyActionTypeToControl = (type) => type && type in legacyActionTypeToC
1282
1286
  var alertLayoutToComponent = (uid, {
1283
1287
  control,
1284
1288
  markdown,
1285
- margin = "md",
1286
- context = "neutral",
1289
+ margin,
1290
+ context,
1287
1291
  callToAction,
1288
1292
  analyticsId,
1289
1293
  tags
1290
- }, { onBehavior, step }) => {
1291
- var _a;
1292
- const cta = callToAction ? getDomainLayerCallToAction(callToAction, onBehavior, (_a = step.actions) != null ? _a : []) : void 0;
1294
+ }, mapperProps) => {
1295
+ const cta = callToAction ? getDomainLayerCallToAction(callToAction, mapperProps) : void 0;
1293
1296
  return createAlertComponent({
1294
1297
  uid,
1295
1298
  analyticsId,
1296
1299
  control,
1297
1300
  markdown,
1298
- margin,
1301
+ margin: margin != null ? margin : "md",
1299
1302
  callToAction: cta,
1300
- context: mapLegacyContext(context),
1303
+ context: mapLegacyContext(context != null ? context : "neutral"),
1301
1304
  tags
1302
1305
  });
1303
1306
  };
@@ -1323,8 +1326,8 @@ var boxLayoutToComponent = (uid, {
1323
1326
  border = false,
1324
1327
  components,
1325
1328
  control,
1326
- margin = "md",
1327
- width = "xl",
1329
+ margin,
1330
+ width,
1328
1331
  analyticsId,
1329
1332
  tags
1330
1333
  }, mapperProps, schemaComponents) => createBoxComponent({
@@ -1332,8 +1335,8 @@ var boxLayoutToComponent = (uid, {
1332
1335
  analyticsId,
1333
1336
  border,
1334
1337
  control,
1335
- margin,
1336
- width,
1338
+ margin: margin != null ? margin : "md",
1339
+ width: width != null ? width : "xl",
1337
1340
  tags,
1338
1341
  components: components.map((component, index) => {
1339
1342
  const shouldRemoveMargin = index === components.length - 1 && component.margin === void 0;
@@ -1371,14 +1374,18 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1371
1374
  context,
1372
1375
  control,
1373
1376
  disabled,
1374
- margin = "md",
1377
+ margin,
1375
1378
  pinOrder,
1376
1379
  size,
1377
1380
  title,
1378
1381
  analyticsId,
1379
1382
  tags
1380
1383
  } = button;
1381
- const behavior = getDomainLayerBehavior(button, (_a = mapperProps.step.actions) != null ? _a : []);
1384
+ const behavior = getDomainLayerBehavior(
1385
+ button,
1386
+ (_a = mapperProps.step.actions) != null ? _a : [],
1387
+ mapperProps.registerSubmissionBehavior
1388
+ );
1382
1389
  const onClick = () => {
1383
1390
  void onBehavior(behavior);
1384
1391
  };
@@ -1388,7 +1395,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1388
1395
  context: mapLegacyContext(context != null ? context : "neutral"),
1389
1396
  control,
1390
1397
  disabled: disabled != null ? disabled : false,
1391
- margin,
1398
+ margin: margin != null ? margin : "md",
1392
1399
  pinOrder,
1393
1400
  size,
1394
1401
  title: title != null ? title : "",
@@ -1462,12 +1469,12 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
1462
1469
  });
1463
1470
 
1464
1471
  // src/domain/mappers/layout/columnsLayoutToComponent.ts
1465
- var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md", analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1472
+ var columnsLayoutToComponent = (uid, { control, left, right, bias, margin, analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1466
1473
  uid,
1467
1474
  analyticsId,
1468
1475
  control,
1469
- margin,
1470
- bias: mapLegacyBias(bias),
1476
+ margin: margin != null ? margin : "md",
1477
+ bias: mapLegacyBias(bias != null ? bias : "none"),
1471
1478
  tags,
1472
1479
  startComponents: left.map(
1473
1480
  (component, index) => mapLayoutToComponent(
@@ -1522,9 +1529,10 @@ var mapInlineAlert = (alert) => {
1522
1529
  context: alert.context ? mapLegacyContext(alert.context) : "neutral"
1523
1530
  } : void 0;
1524
1531
  };
1525
- var mapAdditionalInfo = (info, onBehavior) => {
1532
+ var mapAdditionalInfo = (info, mapperProps) => {
1533
+ const { onBehavior, registerSubmissionBehavior } = mapperProps;
1526
1534
  if (info) {
1527
- const behavior = getDomainLayerBehavior(info, []);
1535
+ const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
1528
1536
  return {
1529
1537
  text: info.text,
1530
1538
  href: behavior.type === "link" ? behavior.url : void 0,
@@ -1547,24 +1555,25 @@ var mapSchemaAlert = (alert) => {
1547
1555
  var decisionLayoutToComponent = (uid, {
1548
1556
  analyticsId,
1549
1557
  control,
1550
- margin = "md",
1558
+ margin,
1551
1559
  options,
1552
1560
  tags,
1553
1561
  title
1554
- }, { onBehavior, step }) => createDecisionComponent({
1562
+ }, mapperProps) => createDecisionComponent({
1555
1563
  uid,
1556
1564
  analyticsId,
1557
1565
  control,
1558
- margin,
1559
- options: options.map((option) => mapOption(option, onBehavior, step.actions)),
1566
+ margin: margin != null ? margin : "md",
1567
+ options: options.map((option) => mapOption(option, mapperProps)),
1560
1568
  tags,
1561
1569
  title
1562
1570
  });
1563
- var mapOption = (option, onBehavior, stepActions = []) => {
1564
- var _a;
1565
- const behavior = getDomainLayerBehavior(option, stepActions);
1571
+ var mapOption = (option, mapperProps) => {
1572
+ var _a, _b;
1573
+ const { step, onBehavior, registerSubmissionBehavior } = mapperProps;
1574
+ const behavior = getDomainLayerBehavior(option, (_a = step.actions) != null ? _a : [], registerSubmissionBehavior);
1566
1575
  return __spreadProps(__spreadValues({}, option), {
1567
- disabled: (_a = option.disabled) != null ? _a : false,
1576
+ disabled: (_b = option.disabled) != null ? _b : false,
1568
1577
  href: behavior.type === "link" ? behavior.url : void 0,
1569
1578
  media: getDomainLayerMedia(option),
1570
1579
  inlineAlert: mapInlineAlert(option.inlineAlert),
@@ -1585,7 +1594,7 @@ var createStatusListComponent = (statusListProps) => __spreadValues({
1585
1594
  var isDeprecatedListLayout = (layout) => {
1586
1595
  return layout.items.some((item) => item.status);
1587
1596
  };
1588
- var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", title, tags }) => createStatusListComponent({
1597
+ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin, title, tags }) => createStatusListComponent({
1589
1598
  uid,
1590
1599
  analyticsId,
1591
1600
  control,
@@ -1596,7 +1605,7 @@ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margi
1596
1605
  status: status ? mapLegacyStatus(status) : void 0,
1597
1606
  tags: itemTags
1598
1607
  })),
1599
- margin,
1608
+ margin: margin != null ? margin : "md",
1600
1609
  title,
1601
1610
  tags
1602
1611
  });
@@ -1619,7 +1628,7 @@ var createDividerComponent = (props) => __spreadValues({
1619
1628
  }, props);
1620
1629
 
1621
1630
  // src/domain/mappers/layout/dividerLayoutToComponent.ts
1622
- var dividerLayoutToComponent = (uid, { control, margin = "md", analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin, tags });
1631
+ var dividerLayoutToComponent = (uid, { control, margin, analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin: margin != null ? margin : "md", tags });
1623
1632
 
1624
1633
  // src/domain/components/FormComponent.ts
1625
1634
  var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formProps), {
@@ -1631,7 +1640,7 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
1631
1640
  });
1632
1641
 
1633
1642
  // src/domain/mappers/layout/formLayoutToComponent.ts
1634
- var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin = "md", tags }, schemaComponents) => {
1643
+ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin, tags }, schemaComponents) => {
1635
1644
  const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
1636
1645
  if (id == null) {
1637
1646
  throw new Error(
@@ -1649,7 +1658,7 @@ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, co
1649
1658
  analyticsId,
1650
1659
  schemaComponent,
1651
1660
  control,
1652
- margin,
1661
+ margin: margin != null ? margin : "md",
1653
1662
  tags
1654
1663
  });
1655
1664
  };
@@ -1661,13 +1670,13 @@ var createHeadingComponent = (headingProps) => __spreadValues({
1661
1670
  }, headingProps);
1662
1671
 
1663
1672
  // src/domain/mappers/layout/headingLayoutToComponent.ts
1664
- var headingLayoutToComponent = (uid, { analyticsId, align = "left", margin = "md", size = "md", control, tags, text }) => createHeadingComponent({
1673
+ var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control, tags, text }) => createHeadingComponent({
1665
1674
  uid,
1666
1675
  analyticsId,
1667
- align: mapLegacyAlign(align),
1676
+ align: mapLegacyAlign(align != null ? align : "left"),
1668
1677
  control,
1669
- margin,
1670
- size,
1678
+ margin: margin != null ? margin : "md",
1679
+ size: size != null ? size : "md",
1671
1680
  tags,
1672
1681
  text
1673
1682
  });
@@ -1682,11 +1691,11 @@ var createImageComponent = (imageProps) => __spreadValues({
1682
1691
  var imageLayoutToComponent = (uid, {
1683
1692
  analyticsId,
1684
1693
  accessibilityDescription,
1685
- align = "center",
1694
+ align,
1686
1695
  content,
1687
1696
  control,
1688
- margin = "md",
1689
- size = "md",
1697
+ margin,
1698
+ size,
1690
1699
  tags,
1691
1700
  text,
1692
1701
  url
@@ -1695,14 +1704,14 @@ var imageLayoutToComponent = (uid, {
1695
1704
  return createImageComponent({
1696
1705
  uid,
1697
1706
  analyticsId,
1698
- align: mapLegacyAlign(align),
1707
+ align: mapLegacyAlign(align != null ? align : "center"),
1699
1708
  content: content ? {
1700
1709
  uri: (_b = (_a = content.uri) != null ? _a : content.url) != null ? _b : "",
1701
1710
  accessibilityDescription: (_c = content.accessibilityDescription) != null ? _c : content.text
1702
1711
  } : { accessibilityDescription: accessibilityDescription != null ? accessibilityDescription : text, uri: url != null ? url : "" },
1703
1712
  control,
1704
- margin,
1705
- size,
1713
+ margin: margin != null ? margin : "md",
1714
+ size: size != null ? size : "md",
1706
1715
  tags
1707
1716
  });
1708
1717
  };
@@ -1714,13 +1723,13 @@ var createMarkdownComponent = (markdownProps) => __spreadValues({
1714
1723
  }, markdownProps);
1715
1724
 
1716
1725
  // src/domain/mappers/layout/infoLayoutToComponent.ts
1717
- var infoLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", markdown: content, tags }) => createMarkdownComponent({
1726
+ var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdown: content, tags }) => createMarkdownComponent({
1718
1727
  uid,
1719
1728
  analyticsId,
1720
- align: mapLegacyAlign(align),
1729
+ align: mapLegacyAlign(align != null ? align : "left"),
1721
1730
  content,
1722
1731
  control,
1723
- margin,
1732
+ margin: margin != null ? margin : "md",
1724
1733
  tags,
1725
1734
  size: "md"
1726
1735
  });
@@ -1732,7 +1741,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadValues({
1732
1741
  }, instructionsProps);
1733
1742
 
1734
1743
  // src/domain/mappers/layout/instructionsLayoutToComponent.ts
1735
- var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }) => createInstructionsComponent({
1744
+ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }) => createInstructionsComponent({
1736
1745
  uid,
1737
1746
  analyticsId,
1738
1747
  control,
@@ -1740,7 +1749,7 @@ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin
1740
1749
  context: mapLegacyContext(item.context),
1741
1750
  tags: mapTags(item)
1742
1751
  })),
1743
- margin,
1752
+ margin: margin != null ? margin : "md",
1744
1753
  tags,
1745
1754
  title
1746
1755
  });
@@ -1752,22 +1761,19 @@ var createListComponent = (listProps) => __spreadValues({
1752
1761
  }, listProps);
1753
1762
 
1754
1763
  // src/domain/mappers/layout/listLayoutToComponent.ts
1755
- var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin = "md", tags, title }, mapperProps) => {
1756
- var _a;
1757
- const { step, onBehavior } = mapperProps;
1764
+ var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin, tags, title }, mapperProps) => {
1758
1765
  return createListComponent({
1759
1766
  uid,
1760
1767
  analyticsId,
1761
1768
  control,
1762
1769
  items: items.map((item) => mapItem(item, mapperProps)),
1763
- callToAction: getDomainLayerCallToAction(callToAction, onBehavior, (_a = step.actions) != null ? _a : []),
1764
- margin,
1770
+ callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
1771
+ margin: margin != null ? margin : "md",
1765
1772
  tags,
1766
1773
  title
1767
1774
  });
1768
1775
  };
1769
1776
  var mapItem = (item, mapperProps) => {
1770
- var _b;
1771
1777
  const _a = item, {
1772
1778
  value,
1773
1779
  subvalue,
@@ -1791,14 +1797,13 @@ var mapItem = (item, mapperProps) => {
1791
1797
  "additionalInfo",
1792
1798
  "inlineAlert"
1793
1799
  ]);
1794
- const { step, onBehavior } = mapperProps;
1795
1800
  return __spreadProps(__spreadValues({}, rest), {
1796
1801
  description: description != null ? description : subtitle,
1797
1802
  media: getDomainLayerMedia({ icon, image, media }),
1798
1803
  supportingValues: mapSupportingValues(item),
1799
- additionalInfo: mapAdditionalInfo(additionalInfo, onBehavior),
1804
+ additionalInfo: mapAdditionalInfo(additionalInfo, mapperProps),
1800
1805
  inlineAlert: mapInlineAlert(inlineAlert),
1801
- callToAction: getDomainLayerCallToAction(callToAction, onBehavior, (_b = step.actions) != null ? _b : []),
1806
+ callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
1802
1807
  tags: mapTags(rest)
1803
1808
  });
1804
1809
  };
@@ -1817,33 +1822,33 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadValues(
1817
1822
  }, loadingIndicatorProps);
1818
1823
 
1819
1824
  // src/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
1820
- var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin = "md", size = "md", tags }) => createLoadingIndicatorComponent({
1825
+ var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin, size, tags }) => createLoadingIndicatorComponent({
1821
1826
  uid,
1822
1827
  analyticsId,
1823
1828
  control,
1824
- margin,
1825
- size,
1829
+ margin: margin != null ? margin : "md",
1830
+ size: size != null ? size : "md",
1826
1831
  tags
1827
1832
  });
1828
1833
 
1829
1834
  // src/domain/mappers/layout/markdownLayoutToComponent.ts
1830
1835
  var markdownLayoutToComponent = (uid, {
1831
1836
  analyticsId,
1832
- align = "left",
1833
- margin = "md",
1837
+ align,
1838
+ margin,
1834
1839
  control,
1835
1840
  content,
1836
- size = "md",
1841
+ size,
1837
1842
  tags
1838
1843
  }) => createMarkdownComponent({
1839
1844
  uid,
1840
1845
  analyticsId,
1841
- align: mapLegacyAlign(align),
1846
+ align: mapLegacyAlign(align != null ? align : "left"),
1842
1847
  control,
1843
1848
  content,
1844
- margin,
1849
+ margin: margin != null ? margin : "md",
1845
1850
  tags,
1846
- size
1851
+ size: size != null ? size : "md"
1847
1852
  });
1848
1853
 
1849
1854
  // src/domain/components/ModalLayoutComponent.ts
@@ -1857,7 +1862,7 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
1857
1862
  });
1858
1863
 
1859
1864
  // src/domain/mappers/layout/modalLayoutToComponent.ts
1860
- var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md", tags, trigger }, mapperProps, schemaComponents) => {
1865
+ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin, tags, trigger }, mapperProps, schemaComponents) => {
1861
1866
  const { components, title } = content;
1862
1867
  return createModalComponent({
1863
1868
  uid,
@@ -1869,7 +1874,7 @@ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md
1869
1874
  title
1870
1875
  },
1871
1876
  control,
1872
- margin,
1877
+ margin: margin != null ? margin : "md",
1873
1878
  tags,
1874
1879
  trigger
1875
1880
  });
@@ -1882,15 +1887,15 @@ var createParagraphComponent = (paragraphProps) => __spreadValues({
1882
1887
  }, paragraphProps);
1883
1888
 
1884
1889
  // src/domain/mappers/layout/paragraphLayoutToComponent.ts
1885
- var paragraphLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", size = "md", tags, text }) => createParagraphComponent({
1890
+ var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, size, tags, text }) => createParagraphComponent({
1886
1891
  uid,
1887
1892
  analyticsId,
1888
1893
  text,
1889
1894
  control,
1890
- align: mapLegacyAlign(align),
1891
- margin,
1895
+ align: mapLegacyAlign(align != null ? align : "left"),
1896
+ margin: margin != null ? margin : "md",
1892
1897
  tags,
1893
- size
1898
+ size: size != null ? size : "md"
1894
1899
  });
1895
1900
 
1896
1901
  // src/domain/components/ReviewComponent.ts
@@ -1906,35 +1911,34 @@ var reviewLayoutToComponent = (uid, {
1906
1911
  title,
1907
1912
  callToAction,
1908
1913
  control,
1909
- margin = "md",
1914
+ margin,
1910
1915
  tags,
1911
1916
  orientation,
1912
1917
  action
1913
- }, { onBehavior, step }) => createReviewComponent({
1918
+ }, mapperProps) => createReviewComponent({
1914
1919
  uid,
1915
1920
  analyticsId,
1916
- callToAction: getCallToAction2({ onBehavior, callToAction, action, stepActions: step.actions }),
1921
+ callToAction: getCallToAction2({ mapperProps, callToAction, action }),
1917
1922
  control: getOrientationControl({ control, orientation }),
1918
- fields: fields.map((field) => mapReviewField(field, { onBehavior, step })),
1919
- margin,
1923
+ fields: fields.map((field) => mapReviewField(field, mapperProps)),
1924
+ margin: margin != null ? margin : "md",
1920
1925
  tags,
1921
1926
  title
1922
1927
  });
1923
1928
  var getCallToAction2 = ({
1924
- onBehavior,
1925
1929
  callToAction,
1926
1930
  action,
1927
- stepActions = []
1931
+ mapperProps
1928
1932
  }) => {
1929
1933
  if (callToAction) {
1930
- return getDomainLayerCallToAction(callToAction, onBehavior, stepActions);
1934
+ return getDomainLayerCallToAction(callToAction, mapperProps);
1931
1935
  }
1932
1936
  if (action == null ? void 0 : action.title) {
1933
1937
  return {
1934
1938
  type: "action",
1935
1939
  title: action.title,
1936
1940
  onClick: () => {
1937
- void onBehavior({ type: "action", action });
1941
+ void mapperProps.onBehavior({ type: "action", action });
1938
1942
  }
1939
1943
  };
1940
1944
  }
@@ -1952,17 +1956,16 @@ var getOrientationControl = ({
1952
1956
  }
1953
1957
  return void 0;
1954
1958
  };
1955
- var mapReviewField = (field, { onBehavior, step }) => {
1956
- var _a, _b;
1959
+ var mapReviewField = (field, mapperProps) => {
1960
+ var _a;
1957
1961
  return __spreadProps(__spreadValues({}, field), {
1958
1962
  media: getDomainLayerMedia(field),
1959
1963
  help: (_a = field.help) == null ? void 0 : _a.markdown,
1960
1964
  inlineAlert: mapInlineAlert(field.inlineAlert),
1961
- additionalInfo: mapAdditionalInfo(field.additionalInfo, onBehavior),
1965
+ additionalInfo: mapAdditionalInfo(field.additionalInfo, mapperProps),
1962
1966
  callToAction: getCallToAction2({
1963
- onBehavior,
1964
1967
  callToAction: field.callToAction,
1965
- stepActions: (_b = step.actions) != null ? _b : []
1968
+ mapperProps
1966
1969
  }),
1967
1970
  tags: mapTags(field)
1968
1971
  });
@@ -2129,17 +2132,7 @@ var isValidResponseBody = (body) => isObject(body) && "results" in body && isArr
2129
2132
  var hashRequest = (query, config) => JSON.stringify({ query, config });
2130
2133
 
2131
2134
  // src/domain/mappers/layout/searchLayoutToComponent.ts
2132
- var searchLayoutToComponent = (uid, {
2133
- analyticsId,
2134
- control,
2135
- emptyMessage = "",
2136
- method,
2137
- param,
2138
- title,
2139
- url,
2140
- margin = "md",
2141
- tags
2142
- }, mapperProps) => {
2135
+ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }, mapperProps) => {
2143
2136
  const { httpClient, onBehavior, updateComponent } = mapperProps;
2144
2137
  const search = getPerformSearchFunction(httpClient, { method, param, url });
2145
2138
  return createSearchComponent(
@@ -2147,8 +2140,8 @@ var searchLayoutToComponent = (uid, {
2147
2140
  uid,
2148
2141
  analyticsId,
2149
2142
  control,
2150
- emptyMessage,
2151
- margin,
2143
+ emptyMessage: emptyMessage != null ? emptyMessage : "",
2144
+ margin: margin != null ? margin : "md",
2152
2145
  tags,
2153
2146
  title
2154
2147
  },
@@ -2159,20 +2152,15 @@ var searchLayoutToComponent = (uid, {
2159
2152
  };
2160
2153
 
2161
2154
  // src/domain/mappers/layout/statusListLayoutToComponent.ts
2162
- var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }, { onBehavior, step }) => createStatusListComponent({
2155
+ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }, mapperProps) => createStatusListComponent({
2163
2156
  uid,
2164
2157
  analyticsId,
2165
2158
  control,
2166
2159
  items: items.map((item) => {
2167
- var _a;
2168
- const callToAction = getDomainLayerCallToAction(
2169
- item.callToAction,
2170
- onBehavior,
2171
- (_a = step.actions) != null ? _a : []
2172
- );
2160
+ const callToAction = getDomainLayerCallToAction(item.callToAction, mapperProps);
2173
2161
  return __spreadProps(__spreadValues({}, item), { callToAction, tags: mapTags(item) });
2174
2162
  }),
2175
- margin,
2163
+ margin: margin != null ? margin : "md",
2176
2164
  tags,
2177
2165
  title
2178
2166
  });
@@ -2189,8 +2177,7 @@ var createSectionComponent = (props) => {
2189
2177
  };
2190
2178
 
2191
2179
  // src/domain/mappers/layout/sectionLayoutToComponent.ts
2192
- var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin = "md", tags }, mapperProps, schemaComponents) => {
2193
- var _a;
2180
+ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin, tags }, mapperProps, schemaComponents) => {
2194
2181
  return createSectionComponent({
2195
2182
  uid,
2196
2183
  analyticsId,
@@ -2199,12 +2186,8 @@ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components,
2199
2186
  components: components.map(
2200
2187
  (component, index) => mapLayoutToComponent(`${uid}.section-${index}`, component, mapperProps, schemaComponents)
2201
2188
  ),
2202
- margin,
2203
- callToAction: getDomainLayerCallToAction(
2204
- callToAction,
2205
- mapperProps.onBehavior,
2206
- (_a = mapperProps.step.actions) != null ? _a : []
2207
- ),
2189
+ margin: margin != null ? margin : "md",
2190
+ callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
2208
2191
  tags
2209
2192
  });
2210
2193
  };
@@ -2216,11 +2199,11 @@ var createTabsComponent = (tabsProps) => __spreadProps(__spreadValues({}, tabsPr
2216
2199
  });
2217
2200
 
2218
2201
  // src/domain/mappers/layout/tabsLayoutToComponent.ts
2219
- var tabsLayoutToComponent = (uid, { analyticsId, control, margin = "md", tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2202
+ var tabsLayoutToComponent = (uid, { analyticsId, control, margin, tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2220
2203
  uid,
2221
2204
  analyticsId,
2222
2205
  control,
2223
- margin,
2206
+ margin: margin != null ? margin : "md",
2224
2207
  tags,
2225
2208
  tabs: mapTabs(tabs, uid, mapperProps, schemaComponents)
2226
2209
  });
@@ -2246,11 +2229,11 @@ var createProgressComponent = (progressProps) => __spreadValues({
2246
2229
  // src/domain/mappers/layout/progressLayoutToComponent.ts
2247
2230
  var progressLayoutToComponent = (uid, {
2248
2231
  analyticsId,
2249
- context = "neutral",
2232
+ context,
2250
2233
  control,
2251
2234
  description,
2252
2235
  help,
2253
- margin = "md",
2236
+ margin,
2254
2237
  progress,
2255
2238
  progressText,
2256
2239
  tags,
@@ -2258,11 +2241,11 @@ var progressLayoutToComponent = (uid, {
2258
2241
  }) => createProgressComponent({
2259
2242
  uid,
2260
2243
  analyticsId,
2261
- context: mapLegacyContext(context),
2244
+ context: mapLegacyContext(context != null ? context : "neutral"),
2262
2245
  control,
2263
2246
  description,
2264
2247
  help: help == null ? void 0 : help.markdown,
2265
- margin,
2248
+ margin: margin != null ? margin : "md",
2266
2249
  progress,
2267
2250
  progressText,
2268
2251
  tags,
@@ -2333,34 +2316,39 @@ var modalToComponent = (uid, { content, title }, mapperProps, schemaComponents)
2333
2316
  mapperProps.updateComponent
2334
2317
  );
2335
2318
 
2336
- // src/domain/components/step/ExternalConfirmationComponent.ts
2337
- var createExternalConfirmation = (uid, url, updateComponent) => {
2338
- const update = getInputUpdateFunction(updateComponent);
2319
+ // src/domain/prefetching/request-cache.ts
2320
+ var makeRequestCache = () => {
2321
+ const cache = /* @__PURE__ */ new Map();
2339
2322
  return {
2340
- type: "external-confirmation",
2341
- kind: "layout",
2342
- uid,
2343
- url,
2344
- status: "initial",
2345
- onSuccess() {
2346
- update(this, (draft) => {
2347
- draft.status = "success";
2348
- });
2323
+ has: (...requestParams) => {
2324
+ return cache.has(makeKey(...requestParams));
2349
2325
  },
2350
- onFailure() {
2351
- if (this.status === "initial") {
2352
- update(this, (draft) => {
2353
- draft.status = "failure";
2354
- });
2355
- }
2326
+ get: (...requestParams) => {
2327
+ return cache.get(makeKey(...requestParams));
2356
2328
  },
2357
- onCancel() {
2358
- update(this, (draft) => {
2359
- draft.status = "dismissed";
2360
- });
2329
+ delete: (...requestParams) => {
2330
+ return cache.delete(makeKey(...requestParams));
2331
+ },
2332
+ set: (...[input, init, response]) => {
2333
+ return cache.set(makeKey(input, init), response);
2334
+ },
2335
+ clear: () => {
2336
+ cache.clear();
2361
2337
  }
2362
2338
  };
2363
2339
  };
2340
+ var makeKey = (...requestParams) => {
2341
+ var _a, _b;
2342
+ const [input, init] = requestParams;
2343
+ const url = typeof input === "string" || input instanceof URL ? input.toString() : input.url;
2344
+ const key = JSON.stringify({
2345
+ url,
2346
+ method: (_a = init == null ? void 0 : init.method) != null ? _a : "GET",
2347
+ headers: (init == null ? void 0 : init.headers) ? Array.from(new Headers(init.headers).entries()) : [],
2348
+ body: (_b = init == null ? void 0 : init.body) != null ? _b : null
2349
+ });
2350
+ return key;
2351
+ };
2364
2352
 
2365
2353
  // src/utils/recursiveMerge.ts
2366
2354
  function recursiveMerge(valueA, valueB) {
@@ -2401,6 +2389,57 @@ function mergeArrays(valueA, valueB) {
2401
2389
  );
2402
2390
  }
2403
2391
 
2392
+ // src/flow/makeSubmissionRequest.ts
2393
+ var makeSubmissionRequest = (action, model) => {
2394
+ var _a, _b;
2395
+ return [
2396
+ (_a = action.url) != null ? _a : "",
2397
+ {
2398
+ method: (_b = action.method) != null ? _b : "POST",
2399
+ body: makeRequestBody(action, model),
2400
+ headers: { "Content-Type": "application/json" }
2401
+ }
2402
+ ];
2403
+ };
2404
+ var makeRequestBody = (action, model) => {
2405
+ var _a, _b;
2406
+ const method = (_a = action.method) != null ? _a : "POST";
2407
+ if (method === "GET") {
2408
+ return void 0;
2409
+ }
2410
+ const payload = recursiveMerge(model, (_b = action.data) != null ? _b : null);
2411
+ return payload !== null ? JSON.stringify(payload) : null;
2412
+ };
2413
+
2414
+ // src/domain/components/step/ExternalConfirmationComponent.ts
2415
+ var createExternalConfirmation = (uid, url, updateComponent) => {
2416
+ const update = getInputUpdateFunction(updateComponent);
2417
+ return {
2418
+ type: "external-confirmation",
2419
+ kind: "layout",
2420
+ uid,
2421
+ url,
2422
+ status: "initial",
2423
+ onSuccess() {
2424
+ update(this, (draft) => {
2425
+ draft.status = "success";
2426
+ });
2427
+ },
2428
+ onFailure() {
2429
+ if (this.status === "initial") {
2430
+ update(this, (draft) => {
2431
+ draft.status = "failure";
2432
+ });
2433
+ }
2434
+ },
2435
+ onCancel() {
2436
+ update(this, (draft) => {
2437
+ draft.status = "dismissed";
2438
+ });
2439
+ }
2440
+ };
2441
+ };
2442
+
2404
2443
  // src/utils/component-utils.ts
2405
2444
  var getSubmittableData = async (components) => Promise.all(components.map(async (component) => component.getSubmittableValue())).then(
2406
2445
  (values) => values.reduce((acc, value) => recursiveMerge(acc, value), null)
@@ -2480,7 +2519,8 @@ var getStepPolling = ({
2480
2519
  pollingConfig,
2481
2520
  logEvent,
2482
2521
  onBehavior,
2483
- onPoll
2522
+ onPoll,
2523
+ registerSubmissionBehavior
2484
2524
  }) => {
2485
2525
  const { interval, delay = interval, maxAttempts, url, onError } = pollingConfig;
2486
2526
  let abortController = new AbortController();
@@ -2488,7 +2528,7 @@ var getStepPolling = ({
2488
2528
  if (delay == null) {
2489
2529
  throw new Error("Polling configuration must include delay or interval");
2490
2530
  }
2491
- const onErrorBehavior = getDomainLayerBehavior(onError, []);
2531
+ const onErrorBehavior = getDomainLayerBehavior(onError, [], registerSubmissionBehavior);
2492
2532
  let attempts = 0;
2493
2533
  const poll = () => {
2494
2534
  attempts += 1;
@@ -4803,11 +4843,12 @@ var objectSchemaToMoneyInputComponent = (schemaMapperProps, mapperProps) => {
4803
4843
  );
4804
4844
  };
4805
4845
  var createMoneyInputSubComponents = (schemaMapperProps, mapperProps) => {
4806
- const { schema: objectSchema } = schemaMapperProps;
4846
+ const { schema: objectSchema, model } = schemaMapperProps;
4807
4847
  const amountKey = getAmountSchemaKey(objectSchema, mapperProps);
4808
4848
  const currencyKey = getCurrencySchemaKey(objectSchema, mapperProps);
4809
4849
  const currencySchema = objectSchema.properties[currencyKey];
4810
4850
  const customSchemaMapperProps = __spreadProps(__spreadValues({}, schemaMapperProps), {
4851
+ model: getSanitizedModel(amountKey, model),
4811
4852
  schema: isOneOfSchema(currencySchema) ? objectSchema : replaceKeyInObjectSchema(objectSchema, currencyKey, { oneOf: [currencySchema] })
4812
4853
  });
4813
4854
  const componentMap = createComponentMap(customSchemaMapperProps, mapperProps, "money");
@@ -4819,6 +4860,18 @@ var createMoneyInputSubComponents = (schemaMapperProps, mapperProps) => {
4819
4860
  const checks = getMinMaxChecks(objectSchema, amountKey, mapperProps);
4820
4861
  return { amountKey, amountComponent, currencyKey, currencyComponent, extraValues, checks };
4821
4862
  };
4863
+ var isNumberString = (value) => {
4864
+ return typeof value === "string" && !Number.isNaN(Number.parseFloat(value)) && /^\d*(?:\.\d*)?$/.test(value);
4865
+ };
4866
+ var getSanitizedModel = (key, value) => {
4867
+ if (isObject(value)) {
4868
+ const amount = value[key];
4869
+ if (!isNumberString(amount)) {
4870
+ return __spreadProps(__spreadValues({}, value), { [key]: null });
4871
+ }
4872
+ }
4873
+ return value;
4874
+ };
4822
4875
  var getAmountSchemaKey = ({ displayOrder, properties }, mapperProps) => {
4823
4876
  var _a;
4824
4877
  const entry = displayOrder.map((key) => ({ key, schema: properties[key] })).find(({ schema }) => isAmountSchema(schema));
@@ -5620,7 +5673,11 @@ var mapToolbarToComponent = (uid, toolbar, mapperProps) => {
5620
5673
  tags: toolbar.tags,
5621
5674
  items: toolbar.items.map((item) => {
5622
5675
  const context = item.context ? mapLegacyContext(item.context) : void 0;
5623
- const behavior = getDomainLayerBehavior({ behavior: item.behavior }, []);
5676
+ const behavior = getDomainLayerBehavior(
5677
+ { behavior: item.behavior },
5678
+ [],
5679
+ mapperProps.registerSubmissionBehavior
5680
+ );
5624
5681
  return __spreadProps(__spreadValues({}, item), {
5625
5682
  context: context ? mapLegacyContext(context) : void 0,
5626
5683
  disabled: !!item.disabled,
@@ -5716,16 +5773,29 @@ var mapStepToComponent = (_a) => {
5716
5773
  title,
5717
5774
  tags
5718
5775
  } = step;
5776
+ const submissionRequestsCache = makeRequestCache();
5777
+ const submissionBehaviors = [];
5778
+ const registerSubmissionBehavior = (behavior) => {
5779
+ if (behavior.type === "action" && behavior.action.prefetch) {
5780
+ submissionBehaviors.push(behavior);
5781
+ }
5782
+ };
5719
5783
  const back = mapBackNavigation(navigation, onBehavior, Boolean(features.nativeBack));
5720
5784
  const stepId = id || key;
5721
5785
  if (stepId === void 0) {
5722
5786
  throw new Error("Step must have an id or a key");
5723
5787
  }
5724
5788
  const uid = `${rootUid}.${stepId != null ? stepId : "step"}`;
5725
- const stepPolling = polling ? getStepPolling({ pollingConfig: polling, logEvent, onBehavior, onPoll }) : void 0;
5789
+ const stepPolling = polling ? getStepPolling({
5790
+ pollingConfig: polling,
5791
+ logEvent,
5792
+ onBehavior,
5793
+ onPoll,
5794
+ registerSubmissionBehavior
5795
+ }) : void 0;
5726
5796
  const stepRefreshAfter = refreshAfter ? getStepRefreshAfter({ refreshAfter, logEvent, onBehavior }) : void 0;
5727
5797
  const externalConfirmation = (external == null ? void 0 : external.url) ? createExternalConfirmation(`${uid}-external-confirmation`, external == null ? void 0 : external.url, updateComponent) : void 0;
5728
- const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior });
5798
+ const mapperProps = __spreadProps(__spreadValues({}, restProps), { trackEvent, onBehavior, registerSubmissionBehavior });
5729
5799
  const referencedSchemaIds = getReferencedSchemaId(step);
5730
5800
  const schemaComponents = mapStepSchemas(
5731
5801
  uid,
@@ -5769,11 +5839,18 @@ var mapStepToComponent = (_a) => {
5769
5839
  title: !features.hideStepTitle ? title : void 0,
5770
5840
  tags,
5771
5841
  stackBehavior: (_a2 = navigation == null ? void 0 : navigation.stackBehavior) != null ? _a2 : "default",
5842
+ submissionRequestsCache,
5772
5843
  step,
5773
5844
  updateComponent,
5774
5845
  trackEvent,
5775
5846
  onBehavior
5776
5847
  });
5848
+ executePrefetch({
5849
+ httpClient: mapperProps.httpClient,
5850
+ model: stepComponent.getSubmittableValueSync(),
5851
+ behaviors: submissionBehaviors,
5852
+ requestsCache: submissionRequestsCache
5853
+ });
5777
5854
  return stepComponent;
5778
5855
  };
5779
5856
  var getReferencedSchemaId = (step) => {
@@ -5794,6 +5871,22 @@ var mapBackNavigation = (navigation, onBehavior, isNativeBackEnabled) => {
5794
5871
  }
5795
5872
  } : void 0;
5796
5873
  };
5874
+ var executePrefetch = (props) => {
5875
+ const {
5876
+ httpClient,
5877
+ behaviors: submissionBehaviors,
5878
+ model,
5879
+ requestsCache: submissionRequestsCache
5880
+ } = props;
5881
+ submissionBehaviors.forEach((behavior) => {
5882
+ const requestParams = makeSubmissionRequest(behavior.action, model);
5883
+ try {
5884
+ const responsePromise = httpClient(...requestParams).catch(() => null);
5885
+ submissionRequestsCache.set(...requestParams, responsePromise);
5886
+ } catch (e) {
5887
+ }
5888
+ });
5889
+ };
5797
5890
 
5798
5891
  // src/flow/getResponseType.ts
5799
5892
  var responseTypes = ["step", "action", "exit", "modal"];
@@ -5922,11 +6015,20 @@ var executeRefresh = async (props) => {
5922
6015
  }
5923
6016
  };
5924
6017
 
6018
+ // src/flow/makeSafeHttpClient.ts
6019
+ var makeSafeHttpClient = (httpClient) => async (...props) => {
6020
+ try {
6021
+ return await httpClient(...props);
6022
+ } catch (e) {
6023
+ return null;
6024
+ }
6025
+ };
6026
+
5925
6027
  // src/flow/executeSubmission.ts
5926
6028
  var executeSubmission = async (props) => {
5927
- const { httpClient, trackEvent, logEvent } = props;
6029
+ const { httpClient, requestCache, trackEvent, logEvent } = props;
5928
6030
  const triggerAction = async (action, model, isInitial) => {
5929
- const { exit, url, method = "POST", result = null, id: actionId } = action;
6031
+ const { exit, url, result = null, id: actionId } = action;
5930
6032
  const trackSubmissionEvent = !isInitial ? trackEvent : () => {
5931
6033
  };
5932
6034
  trackSubmissionEvent("Action Triggered", { actionId });
@@ -5934,19 +6036,8 @@ var executeSubmission = async (props) => {
5934
6036
  trackSubmissionEvent("Action Succeeded", { actionId });
5935
6037
  return { type: "complete", result };
5936
6038
  }
5937
- const makeRequestBody = () => {
5938
- var _a;
5939
- if (method === "GET") {
5940
- return void 0;
5941
- }
5942
- const payload = recursiveMerge(model, (_a = action.data) != null ? _a : null);
5943
- return payload !== null ? JSON.stringify(payload) : null;
5944
- };
5945
- const response = await getSafeHttpClient(httpClient)(url != null ? url : "", {
5946
- method,
5947
- body: makeRequestBody(),
5948
- headers: { "Content-Type": "application/json" }
5949
- });
6039
+ const requestParams = makeSubmissionRequest(action, model);
6040
+ const response = await getCachedOrFetch(requestParams, requestCache, httpClient);
5950
6041
  if (!response) {
5951
6042
  const extra = { actionId, errorMessage: "Network Error" };
5952
6043
  trackEvent("Action Failed", extra);
@@ -6019,12 +6110,18 @@ var executeSubmission = async (props) => {
6019
6110
  };
6020
6111
  return triggerAction(props.action, props.model, props.isInitial);
6021
6112
  };
6022
- var getSafeHttpClient = (httpClient) => async (input, init) => {
6023
- try {
6024
- return await httpClient(input, init);
6025
- } catch (e) {
6026
- return null;
6113
+ var getCachedOrFetch = async (requestParams, requestCache, httpClient) => {
6114
+ if (requestCache == null ? void 0 : requestCache.has(...requestParams)) {
6115
+ const cachedPromise = requestCache.get(...requestParams);
6116
+ requestCache.delete(...requestParams);
6117
+ if (cachedPromise) {
6118
+ const cachedResponse = await cachedPromise;
6119
+ if (cachedResponse == null ? void 0 : cachedResponse.ok) {
6120
+ return cachedResponse;
6121
+ }
6122
+ }
6027
6123
  }
6124
+ return makeSafeHttpClient(httpClient)(...requestParams);
6028
6125
  };
6029
6126
 
6030
6127
  // src/renderers/getSchemaErrorMessageFunction.ts
@@ -6476,10 +6573,14 @@ function useDynamicFlowCore(props) {
6476
6573
  modalToComponent(
6477
6574
  rootComponentRef.current.uid,
6478
6575
  behavior,
6479
- __spreadValues({
6576
+ __spreadProps(__spreadValues({
6480
6577
  step: currentStep,
6481
6578
  stepLocalValue: rootComponentRef.current.getLocalValue()
6482
- }, getMapperProps()),
6579
+ }, getMapperProps()), {
6580
+ registerSubmissionBehavior: () => {
6581
+ }
6582
+ // this means actions in modal responses won't have prefetching
6583
+ }),
6483
6584
  rootComponentRef.current.getSchemaComponents()
6484
6585
  )
6485
6586
  );
@@ -6498,13 +6599,14 @@ function useDynamicFlowCore(props) {
6498
6599
  }, []);
6499
6600
  const onAction = useCallback2(
6500
6601
  async (action, model) => {
6501
- var _a2, _b, _c, _d, _e, _f, _g, _h;
6602
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
6502
6603
  try {
6503
6604
  rootComponentRef.current.setLoadingState("submitting");
6504
6605
  const command = await executeSubmission({
6505
6606
  action,
6506
6607
  model,
6507
6608
  isInitial: !rootComponentRef.current.hasStep(),
6609
+ requestCache: (_a2 = rootComponentRef.current.getStep()) == null ? void 0 : _a2.submissionRequestsCache,
6508
6610
  httpClient,
6509
6611
  trackEvent: trackCoreEvent,
6510
6612
  logEvent
@@ -6525,7 +6627,7 @@ function useDynamicFlowCore(props) {
6525
6627
  case "error": {
6526
6628
  rootComponentRef.current.setLoadingState("idle");
6527
6629
  const genericErrorMessage = getErrorMessageFunctions().genericErrorWithRetry();
6528
- const errors = (_b = (_a2 = command.body) == null ? void 0 : _a2.errors) != null ? _b : { error: genericErrorMessage };
6630
+ const errors = (_c = (_b = command.body) == null ? void 0 : _b.errors) != null ? _c : { error: genericErrorMessage };
6529
6631
  const currentStep = rootComponentRef.current.getStep();
6530
6632
  if (currentStep) {
6531
6633
  updateStep(
@@ -6539,16 +6641,16 @@ function useDynamicFlowCore(props) {
6539
6641
  external: void 0
6540
6642
  // and no external, to avoid retriggering it
6541
6643
  }),
6542
- (_d = (_c = rootComponentRef.current.getStep()) == null ? void 0 : _c.etag) != null ? _d : null
6644
+ (_e = (_d = rootComponentRef.current.getStep()) == null ? void 0 : _d.etag) != null ? _e : null
6543
6645
  );
6544
6646
  } else {
6545
- const errorMessage = ((_f = (_e = command.body) == null ? void 0 : _e.errors) == null ? void 0 : _f.error) || ((_g = command.httpError) == null ? void 0 : _g.message) || "Initial request failed";
6647
+ const errorMessage = ((_g = (_f = command.body) == null ? void 0 : _f.errors) == null ? void 0 : _g.error) || ((_h = command.httpError) == null ? void 0 : _h.message) || "Initial request failed";
6546
6648
  closeWithError(
6547
6649
  new Error(errorMessage, {
6548
6650
  cause: `method: ${action.method}, url: ${action.url}`
6549
6651
  }),
6550
6652
  {},
6551
- (_h = command.httpError) == null ? void 0 : _h.statusCode
6653
+ (_i = command.httpError) == null ? void 0 : _i.statusCode
6552
6654
  );
6553
6655
  }
6554
6656
  break;