@wise/dynamic-flow-client 5.1.0 → 5.1.2

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.css CHANGED
@@ -1,7 +1,7 @@
1
1
  /* We should move to CSS modules when we move this to the Wise layer */
2
2
  .df-box-renderer-border {
3
3
  border: 1px solid var(--color-border-neutral);
4
- border-radius: var(--radius-small);
4
+ border-radius: var(--radius-medium);
5
5
  padding: var(--size-16);
6
6
  }
7
7
  .df-box-renderer-fixed-width {
package/build/main.js CHANGED
@@ -7,6 +7,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __typeError = (msg) => {
11
+ throw TypeError(msg);
12
+ };
10
13
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
14
  var __spreadValues = (a, b) => {
12
15
  for (var prop in b || (b = {}))
@@ -45,6 +48,10 @@ var __copyProps = (to, from, except, desc) => {
45
48
  return to;
46
49
  };
47
50
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
51
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
52
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
53
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
54
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
48
55
 
49
56
  // src/index.ts
50
57
  var index_exports = {};
@@ -1313,8 +1320,8 @@ var mapLegacyActionTypeToControl = (type) => type && type in legacyActionTypeToC
1313
1320
  var alertLayoutToComponent = (uid, {
1314
1321
  control,
1315
1322
  markdown,
1316
- margin = "md",
1317
- context = "neutral",
1323
+ margin,
1324
+ context,
1318
1325
  callToAction,
1319
1326
  analyticsId,
1320
1327
  tags
@@ -1325,9 +1332,9 @@ var alertLayoutToComponent = (uid, {
1325
1332
  analyticsId,
1326
1333
  control,
1327
1334
  markdown,
1328
- margin,
1335
+ margin: margin != null ? margin : "md",
1329
1336
  callToAction: cta,
1330
- context: mapLegacyContext(context),
1337
+ context: mapLegacyContext(context != null ? context : "neutral"),
1331
1338
  tags
1332
1339
  });
1333
1340
  };
@@ -1353,8 +1360,8 @@ var boxLayoutToComponent = (uid, {
1353
1360
  border = false,
1354
1361
  components,
1355
1362
  control,
1356
- margin = "md",
1357
- width = "xl",
1363
+ margin,
1364
+ width,
1358
1365
  analyticsId,
1359
1366
  tags
1360
1367
  }, mapperProps, schemaComponents) => createBoxComponent({
@@ -1362,8 +1369,8 @@ var boxLayoutToComponent = (uid, {
1362
1369
  analyticsId,
1363
1370
  border,
1364
1371
  control,
1365
- margin,
1366
- width,
1372
+ margin: margin != null ? margin : "md",
1373
+ width: width != null ? width : "xl",
1367
1374
  tags,
1368
1375
  components: components.map((component, index) => {
1369
1376
  const shouldRemoveMargin = index === components.length - 1 && component.margin === void 0;
@@ -1401,7 +1408,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1401
1408
  context,
1402
1409
  control,
1403
1410
  disabled,
1404
- margin = "md",
1411
+ margin,
1405
1412
  pinOrder,
1406
1413
  size,
1407
1414
  title,
@@ -1422,7 +1429,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1422
1429
  context: mapLegacyContext(context != null ? context : "neutral"),
1423
1430
  control,
1424
1431
  disabled: disabled != null ? disabled : false,
1425
- margin,
1432
+ margin: margin != null ? margin : "md",
1426
1433
  pinOrder,
1427
1434
  size,
1428
1435
  title: title != null ? title : "",
@@ -1496,12 +1503,12 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
1496
1503
  });
1497
1504
 
1498
1505
  // src/domain/mappers/layout/columnsLayoutToComponent.ts
1499
- var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md", analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1506
+ var columnsLayoutToComponent = (uid, { control, left, right, bias, margin, analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1500
1507
  uid,
1501
1508
  analyticsId,
1502
1509
  control,
1503
- margin,
1504
- bias: mapLegacyBias(bias),
1510
+ margin: margin != null ? margin : "md",
1511
+ bias: mapLegacyBias(bias != null ? bias : "none"),
1505
1512
  tags,
1506
1513
  startComponents: left.map(
1507
1514
  (component, index) => mapLayoutToComponent(
@@ -1582,7 +1589,7 @@ var mapSchemaAlert = (alert) => {
1582
1589
  var decisionLayoutToComponent = (uid, {
1583
1590
  analyticsId,
1584
1591
  control,
1585
- margin = "md",
1592
+ margin,
1586
1593
  options,
1587
1594
  tags,
1588
1595
  title
@@ -1590,7 +1597,7 @@ var decisionLayoutToComponent = (uid, {
1590
1597
  uid,
1591
1598
  analyticsId,
1592
1599
  control,
1593
- margin,
1600
+ margin: margin != null ? margin : "md",
1594
1601
  options: options.map((option) => mapOption(option, mapperProps)),
1595
1602
  tags,
1596
1603
  title
@@ -1621,7 +1628,7 @@ var createStatusListComponent = (statusListProps) => __spreadValues({
1621
1628
  var isDeprecatedListLayout = (layout) => {
1622
1629
  return layout.items.some((item) => item.status);
1623
1630
  };
1624
- var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", title, tags }) => createStatusListComponent({
1631
+ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin, title, tags }) => createStatusListComponent({
1625
1632
  uid,
1626
1633
  analyticsId,
1627
1634
  control,
@@ -1632,7 +1639,7 @@ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margi
1632
1639
  status: status ? mapLegacyStatus(status) : void 0,
1633
1640
  tags: itemTags
1634
1641
  })),
1635
- margin,
1642
+ margin: margin != null ? margin : "md",
1636
1643
  title,
1637
1644
  tags
1638
1645
  });
@@ -1655,7 +1662,7 @@ var createDividerComponent = (props) => __spreadValues({
1655
1662
  }, props);
1656
1663
 
1657
1664
  // src/domain/mappers/layout/dividerLayoutToComponent.ts
1658
- var dividerLayoutToComponent = (uid, { control, margin = "md", analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin, tags });
1665
+ var dividerLayoutToComponent = (uid, { control, margin, analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin: margin != null ? margin : "md", tags });
1659
1666
 
1660
1667
  // src/domain/components/FormComponent.ts
1661
1668
  var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formProps), {
@@ -1667,7 +1674,7 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
1667
1674
  });
1668
1675
 
1669
1676
  // src/domain/mappers/layout/formLayoutToComponent.ts
1670
- var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin = "md", tags }, schemaComponents) => {
1677
+ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin, tags }, schemaComponents) => {
1671
1678
  const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
1672
1679
  if (id == null) {
1673
1680
  throw new Error(
@@ -1685,7 +1692,7 @@ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, co
1685
1692
  analyticsId,
1686
1693
  schemaComponent,
1687
1694
  control,
1688
- margin,
1695
+ margin: margin != null ? margin : "md",
1689
1696
  tags
1690
1697
  });
1691
1698
  };
@@ -1697,13 +1704,13 @@ var createHeadingComponent = (headingProps) => __spreadValues({
1697
1704
  }, headingProps);
1698
1705
 
1699
1706
  // src/domain/mappers/layout/headingLayoutToComponent.ts
1700
- var headingLayoutToComponent = (uid, { analyticsId, align = "left", margin = "md", size = "md", control, tags, text }) => createHeadingComponent({
1707
+ var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control, tags, text }) => createHeadingComponent({
1701
1708
  uid,
1702
1709
  analyticsId,
1703
- align: mapLegacyAlign(align),
1710
+ align: mapLegacyAlign(align != null ? align : "left"),
1704
1711
  control,
1705
- margin,
1706
- size,
1712
+ margin: margin != null ? margin : "md",
1713
+ size: size != null ? size : "md",
1707
1714
  tags,
1708
1715
  text
1709
1716
  });
@@ -1718,11 +1725,11 @@ var createImageComponent = (imageProps) => __spreadValues({
1718
1725
  var imageLayoutToComponent = (uid, {
1719
1726
  analyticsId,
1720
1727
  accessibilityDescription,
1721
- align = "center",
1728
+ align,
1722
1729
  content,
1723
1730
  control,
1724
- margin = "md",
1725
- size = "md",
1731
+ margin,
1732
+ size,
1726
1733
  tags,
1727
1734
  text,
1728
1735
  url
@@ -1731,14 +1738,14 @@ var imageLayoutToComponent = (uid, {
1731
1738
  return createImageComponent({
1732
1739
  uid,
1733
1740
  analyticsId,
1734
- align: mapLegacyAlign(align),
1741
+ align: mapLegacyAlign(align != null ? align : "center"),
1735
1742
  content: content ? {
1736
1743
  uri: (_b = (_a = content.uri) != null ? _a : content.url) != null ? _b : "",
1737
1744
  accessibilityDescription: (_c = content.accessibilityDescription) != null ? _c : content.text
1738
1745
  } : { accessibilityDescription: accessibilityDescription != null ? accessibilityDescription : text, uri: url != null ? url : "" },
1739
1746
  control,
1740
- margin,
1741
- size,
1747
+ margin: margin != null ? margin : "md",
1748
+ size: size != null ? size : "md",
1742
1749
  tags
1743
1750
  });
1744
1751
  };
@@ -1750,13 +1757,13 @@ var createMarkdownComponent = (markdownProps) => __spreadValues({
1750
1757
  }, markdownProps);
1751
1758
 
1752
1759
  // src/domain/mappers/layout/infoLayoutToComponent.ts
1753
- var infoLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", markdown: content, tags }) => createMarkdownComponent({
1760
+ var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdown: content, tags }) => createMarkdownComponent({
1754
1761
  uid,
1755
1762
  analyticsId,
1756
- align: mapLegacyAlign(align),
1763
+ align: mapLegacyAlign(align != null ? align : "left"),
1757
1764
  content,
1758
1765
  control,
1759
- margin,
1766
+ margin: margin != null ? margin : "md",
1760
1767
  tags,
1761
1768
  size: "md"
1762
1769
  });
@@ -1768,7 +1775,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadValues({
1768
1775
  }, instructionsProps);
1769
1776
 
1770
1777
  // src/domain/mappers/layout/instructionsLayoutToComponent.ts
1771
- var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }) => createInstructionsComponent({
1778
+ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }) => createInstructionsComponent({
1772
1779
  uid,
1773
1780
  analyticsId,
1774
1781
  control,
@@ -1776,7 +1783,7 @@ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin
1776
1783
  context: mapLegacyContext(item.context),
1777
1784
  tags: mapTags(item)
1778
1785
  })),
1779
- margin,
1786
+ margin: margin != null ? margin : "md",
1780
1787
  tags,
1781
1788
  title
1782
1789
  });
@@ -1788,14 +1795,14 @@ var createListComponent = (listProps) => __spreadValues({
1788
1795
  }, listProps);
1789
1796
 
1790
1797
  // src/domain/mappers/layout/listLayoutToComponent.ts
1791
- var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin = "md", tags, title }, mapperProps) => {
1798
+ var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin, tags, title }, mapperProps) => {
1792
1799
  return createListComponent({
1793
1800
  uid,
1794
1801
  analyticsId,
1795
1802
  control,
1796
1803
  items: items.map((item) => mapItem(item, mapperProps)),
1797
1804
  callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
1798
- margin,
1805
+ margin: margin != null ? margin : "md",
1799
1806
  tags,
1800
1807
  title
1801
1808
  });
@@ -1849,33 +1856,33 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadValues(
1849
1856
  }, loadingIndicatorProps);
1850
1857
 
1851
1858
  // src/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
1852
- var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin = "md", size = "md", tags }) => createLoadingIndicatorComponent({
1859
+ var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin, size, tags }) => createLoadingIndicatorComponent({
1853
1860
  uid,
1854
1861
  analyticsId,
1855
1862
  control,
1856
- margin,
1857
- size,
1863
+ margin: margin != null ? margin : "md",
1864
+ size: size != null ? size : "md",
1858
1865
  tags
1859
1866
  });
1860
1867
 
1861
1868
  // src/domain/mappers/layout/markdownLayoutToComponent.ts
1862
1869
  var markdownLayoutToComponent = (uid, {
1863
1870
  analyticsId,
1864
- align = "left",
1865
- margin = "md",
1871
+ align,
1872
+ margin,
1866
1873
  control,
1867
1874
  content,
1868
- size = "md",
1875
+ size,
1869
1876
  tags
1870
1877
  }) => createMarkdownComponent({
1871
1878
  uid,
1872
1879
  analyticsId,
1873
- align: mapLegacyAlign(align),
1880
+ align: mapLegacyAlign(align != null ? align : "left"),
1874
1881
  control,
1875
1882
  content,
1876
- margin,
1883
+ margin: margin != null ? margin : "md",
1877
1884
  tags,
1878
- size
1885
+ size: size != null ? size : "md"
1879
1886
  });
1880
1887
 
1881
1888
  // src/domain/components/ModalLayoutComponent.ts
@@ -1889,7 +1896,7 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
1889
1896
  });
1890
1897
 
1891
1898
  // src/domain/mappers/layout/modalLayoutToComponent.ts
1892
- var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md", tags, trigger }, mapperProps, schemaComponents) => {
1899
+ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin, tags, trigger }, mapperProps, schemaComponents) => {
1893
1900
  const { components, title } = content;
1894
1901
  return createModalComponent({
1895
1902
  uid,
@@ -1901,7 +1908,7 @@ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md
1901
1908
  title
1902
1909
  },
1903
1910
  control,
1904
- margin,
1911
+ margin: margin != null ? margin : "md",
1905
1912
  tags,
1906
1913
  trigger
1907
1914
  });
@@ -1914,15 +1921,15 @@ var createParagraphComponent = (paragraphProps) => __spreadValues({
1914
1921
  }, paragraphProps);
1915
1922
 
1916
1923
  // src/domain/mappers/layout/paragraphLayoutToComponent.ts
1917
- var paragraphLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", size = "md", tags, text }) => createParagraphComponent({
1924
+ var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, size, tags, text }) => createParagraphComponent({
1918
1925
  uid,
1919
1926
  analyticsId,
1920
1927
  text,
1921
1928
  control,
1922
- align: mapLegacyAlign(align),
1923
- margin,
1929
+ align: mapLegacyAlign(align != null ? align : "left"),
1930
+ margin: margin != null ? margin : "md",
1924
1931
  tags,
1925
- size
1932
+ size: size != null ? size : "md"
1926
1933
  });
1927
1934
 
1928
1935
  // src/domain/components/ReviewComponent.ts
@@ -1938,7 +1945,7 @@ var reviewLayoutToComponent = (uid, {
1938
1945
  title,
1939
1946
  callToAction,
1940
1947
  control,
1941
- margin = "md",
1948
+ margin,
1942
1949
  tags,
1943
1950
  orientation,
1944
1951
  action
@@ -1948,7 +1955,7 @@ var reviewLayoutToComponent = (uid, {
1948
1955
  callToAction: getCallToAction2({ mapperProps, callToAction, action }),
1949
1956
  control: getOrientationControl({ control, orientation }),
1950
1957
  fields: fields.map((field) => mapReviewField(field, mapperProps)),
1951
- margin,
1958
+ margin: margin != null ? margin : "md",
1952
1959
  tags,
1953
1960
  title
1954
1961
  });
@@ -2159,17 +2166,7 @@ var isValidResponseBody = (body) => isObject(body) && "results" in body && isArr
2159
2166
  var hashRequest = (query, config) => JSON.stringify({ query, config });
2160
2167
 
2161
2168
  // src/domain/mappers/layout/searchLayoutToComponent.ts
2162
- var searchLayoutToComponent = (uid, {
2163
- analyticsId,
2164
- control,
2165
- emptyMessage = "",
2166
- method,
2167
- param,
2168
- title,
2169
- url,
2170
- margin = "md",
2171
- tags
2172
- }, mapperProps) => {
2169
+ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }, mapperProps) => {
2173
2170
  const { httpClient, onBehavior, updateComponent } = mapperProps;
2174
2171
  const search = getPerformSearchFunction(httpClient, { method, param, url });
2175
2172
  return createSearchComponent(
@@ -2177,8 +2174,8 @@ var searchLayoutToComponent = (uid, {
2177
2174
  uid,
2178
2175
  analyticsId,
2179
2176
  control,
2180
- emptyMessage,
2181
- margin,
2177
+ emptyMessage: emptyMessage != null ? emptyMessage : "",
2178
+ margin: margin != null ? margin : "md",
2182
2179
  tags,
2183
2180
  title
2184
2181
  },
@@ -2189,7 +2186,7 @@ var searchLayoutToComponent = (uid, {
2189
2186
  };
2190
2187
 
2191
2188
  // src/domain/mappers/layout/statusListLayoutToComponent.ts
2192
- var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }, mapperProps) => createStatusListComponent({
2189
+ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }, mapperProps) => createStatusListComponent({
2193
2190
  uid,
2194
2191
  analyticsId,
2195
2192
  control,
@@ -2197,7 +2194,7 @@ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin =
2197
2194
  const callToAction = getDomainLayerCallToAction(item.callToAction, mapperProps);
2198
2195
  return __spreadProps(__spreadValues({}, item), { callToAction, tags: mapTags(item) });
2199
2196
  }),
2200
- margin,
2197
+ margin: margin != null ? margin : "md",
2201
2198
  tags,
2202
2199
  title
2203
2200
  });
@@ -2214,7 +2211,7 @@ var createSectionComponent = (props) => {
2214
2211
  };
2215
2212
 
2216
2213
  // src/domain/mappers/layout/sectionLayoutToComponent.ts
2217
- var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin = "md", tags }, mapperProps, schemaComponents) => {
2214
+ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin, tags }, mapperProps, schemaComponents) => {
2218
2215
  return createSectionComponent({
2219
2216
  uid,
2220
2217
  analyticsId,
@@ -2223,7 +2220,7 @@ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components,
2223
2220
  components: components.map(
2224
2221
  (component, index) => mapLayoutToComponent(`${uid}.section-${index}`, component, mapperProps, schemaComponents)
2225
2222
  ),
2226
- margin,
2223
+ margin: margin != null ? margin : "md",
2227
2224
  callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
2228
2225
  tags
2229
2226
  });
@@ -2236,11 +2233,11 @@ var createTabsComponent = (tabsProps) => __spreadProps(__spreadValues({}, tabsPr
2236
2233
  });
2237
2234
 
2238
2235
  // src/domain/mappers/layout/tabsLayoutToComponent.ts
2239
- var tabsLayoutToComponent = (uid, { analyticsId, control, margin = "md", tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2236
+ var tabsLayoutToComponent = (uid, { analyticsId, control, margin, tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2240
2237
  uid,
2241
2238
  analyticsId,
2242
2239
  control,
2243
- margin,
2240
+ margin: margin != null ? margin : "md",
2244
2241
  tags,
2245
2242
  tabs: mapTabs(tabs, uid, mapperProps, schemaComponents)
2246
2243
  });
@@ -2266,11 +2263,11 @@ var createProgressComponent = (progressProps) => __spreadValues({
2266
2263
  // src/domain/mappers/layout/progressLayoutToComponent.ts
2267
2264
  var progressLayoutToComponent = (uid, {
2268
2265
  analyticsId,
2269
- context = "neutral",
2266
+ context,
2270
2267
  control,
2271
2268
  description,
2272
2269
  help,
2273
- margin = "md",
2270
+ margin,
2274
2271
  progress,
2275
2272
  progressText,
2276
2273
  tags,
@@ -2278,11 +2275,11 @@ var progressLayoutToComponent = (uid, {
2278
2275
  }) => createProgressComponent({
2279
2276
  uid,
2280
2277
  analyticsId,
2281
- context: mapLegacyContext(context),
2278
+ context: mapLegacyContext(context != null ? context : "neutral"),
2282
2279
  control,
2283
2280
  description,
2284
2281
  help: help == null ? void 0 : help.markdown,
2285
- margin,
2282
+ margin: margin != null ? margin : "md",
2286
2283
  progress,
2287
2284
  progressText,
2288
2285
  tags,
@@ -5727,11 +5724,6 @@ var mapToolbarToComponent = (uid, toolbar, mapperProps) => {
5727
5724
  });
5728
5725
  };
5729
5726
 
5730
- // src/domain/mappers/utils/feature-utils.ts
5731
- var isFeatureEnabled = (features, featureName) => {
5732
- return features[featureName] !== void 0 && features[featureName] !== false;
5733
- };
5734
-
5735
5727
  // src/domain/mappers/utils/groupLayoutByPinned.ts
5736
5728
  var groupLayoutByPinned = (layouts) => {
5737
5729
  return layouts.reduce(groupLayout, { pinned: [], nonPinned: [] });
@@ -5817,7 +5809,7 @@ var mapStepToComponent = (_a) => {
5817
5809
  submissionBehaviors.push(behavior);
5818
5810
  }
5819
5811
  };
5820
- const back = mapBackNavigation(navigation, onBehavior, Boolean(features.nativeBack));
5812
+ const back = mapBackNavigation(navigation, onBehavior, features.isEnabled("nativeBack"));
5821
5813
  const stepId = id || key;
5822
5814
  if (stepId === void 0) {
5823
5815
  throw new Error("Step must have an id or a key");
@@ -5841,7 +5833,7 @@ var mapStepToComponent = (_a) => {
5841
5833
  mapperProps,
5842
5834
  referencedSchemaIds
5843
5835
  );
5844
- const shouldPinButtons = isFeatureEnabled(features, "pinnedButtons");
5836
+ const shouldPinButtons = features.isEnabled("pinnedButtons");
5845
5837
  const { pinned, nonPinned } = shouldPinButtons ? groupLayoutByPinned(layout) : { pinned: [], nonPinned: layout };
5846
5838
  const layoutComponents = nonPinned.map(
5847
5839
  (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
@@ -5873,7 +5865,7 @@ var mapStepToComponent = (_a) => {
5873
5865
  loadingState,
5874
5866
  stepPolling,
5875
5867
  stepRefreshAfter,
5876
- title: !features.hideStepTitle ? title : void 0,
5868
+ title: !features.isEnabled("hideStepTitle") ? title : void 0,
5877
5869
  tags,
5878
5870
  stackBehavior: (_a2 = navigation == null ? void 0 : navigation.stackBehavior) != null ? _a2 : "default",
5879
5871
  submissionRequestsCache,
@@ -5925,6 +5917,19 @@ var executePrefetch = (props) => {
5925
5917
  });
5926
5918
  };
5927
5919
 
5920
+ // src/domain/mappers/utils/FeatureFlags.ts
5921
+ var _features;
5922
+ var FeatureFlags = class {
5923
+ constructor(features) {
5924
+ __privateAdd(this, _features);
5925
+ __privateSet(this, _features, features);
5926
+ }
5927
+ isEnabled(featureName) {
5928
+ return __privateGet(this, _features)[featureName] != null && __privateGet(this, _features)[featureName] !== false;
5929
+ }
5930
+ };
5931
+ _features = new WeakMap();
5932
+
5928
5933
  // src/flow/getResponseType.ts
5929
5934
  var responseTypes = ["step", "action", "exit", "modal"];
5930
5935
  var getResponseType = async (response) => {
@@ -6390,7 +6395,7 @@ function useStableCallback(handler) {
6390
6395
 
6391
6396
  // src/useDynamicFlowCore.tsx
6392
6397
  function useDynamicFlowCore(props) {
6393
- const _a = props, { flowId, initialAction, initialStep, features = {} } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "features"]);
6398
+ const _a = props, { flowId, initialAction, initialStep } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep"]);
6394
6399
  const httpClient = useStableCallback(rest.httpClient);
6395
6400
  const onCancellation = useStableCallback(rest.onCancellation);
6396
6401
  const onCompletion = useStableCallback(rest.onCompletion);
@@ -6406,10 +6411,14 @@ function useDynamicFlowCore(props) {
6406
6411
  () => getSchemaErrorMessageFunction(formatMessage, locale),
6407
6412
  [formatMessage, locale]
6408
6413
  );
6414
+ const features = (0, import_react3.useMemo)(() => {
6415
+ var _a2;
6416
+ return new FeatureFlags((_a2 = rest.features) != null ? _a2 : {});
6417
+ }, []);
6409
6418
  const rerender = useRerender();
6410
6419
  const rootComponentRef = (0, import_react3.useRef)(
6411
6420
  createRootDomainComponent(rerender, scrollToTop, {
6412
- isNativeBackEnabled: Boolean(features.nativeBack),
6421
+ isNativeBackEnabled: features.isEnabled("nativeBack"),
6413
6422
  isFlowCancellable: Boolean(rest.onCancellation)
6414
6423
  })
6415
6424
  );
@@ -6547,7 +6556,7 @@ function useDynamicFlowCore(props) {
6547
6556
  });
6548
6557
  break;
6549
6558
  }
6550
- if (isFeatureEnabled(features, "nativeBack")) {
6559
+ if (features.isEnabled("nativeBack")) {
6551
6560
  if (rootComponentRef.current.stepStack.length > 1) {
6552
6561
  rootComponentRef.current.navigateBack();
6553
6562
  } else {
package/build/main.mjs CHANGED
@@ -4,6 +4,9 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
7
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
11
  var __spreadValues = (a, b) => {
9
12
  for (var prop in b || (b = {}))
@@ -29,6 +32,10 @@ var __objRest = (source, exclude) => {
29
32
  }
30
33
  return target;
31
34
  };
35
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
36
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
37
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
38
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
32
39
 
33
40
  // src/common/makeHttpClient/api-utils.ts
34
41
  function isRelativePath(url = "") {
@@ -1286,8 +1293,8 @@ var mapLegacyActionTypeToControl = (type) => type && type in legacyActionTypeToC
1286
1293
  var alertLayoutToComponent = (uid, {
1287
1294
  control,
1288
1295
  markdown,
1289
- margin = "md",
1290
- context = "neutral",
1296
+ margin,
1297
+ context,
1291
1298
  callToAction,
1292
1299
  analyticsId,
1293
1300
  tags
@@ -1298,9 +1305,9 @@ var alertLayoutToComponent = (uid, {
1298
1305
  analyticsId,
1299
1306
  control,
1300
1307
  markdown,
1301
- margin,
1308
+ margin: margin != null ? margin : "md",
1302
1309
  callToAction: cta,
1303
- context: mapLegacyContext(context),
1310
+ context: mapLegacyContext(context != null ? context : "neutral"),
1304
1311
  tags
1305
1312
  });
1306
1313
  };
@@ -1326,8 +1333,8 @@ var boxLayoutToComponent = (uid, {
1326
1333
  border = false,
1327
1334
  components,
1328
1335
  control,
1329
- margin = "md",
1330
- width = "xl",
1336
+ margin,
1337
+ width,
1331
1338
  analyticsId,
1332
1339
  tags
1333
1340
  }, mapperProps, schemaComponents) => createBoxComponent({
@@ -1335,8 +1342,8 @@ var boxLayoutToComponent = (uid, {
1335
1342
  analyticsId,
1336
1343
  border,
1337
1344
  control,
1338
- margin,
1339
- width,
1345
+ margin: margin != null ? margin : "md",
1346
+ width: width != null ? width : "xl",
1340
1347
  tags,
1341
1348
  components: components.map((component, index) => {
1342
1349
  const shouldRemoveMargin = index === components.length - 1 && component.margin === void 0;
@@ -1374,7 +1381,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1374
1381
  context,
1375
1382
  control,
1376
1383
  disabled,
1377
- margin = "md",
1384
+ margin,
1378
1385
  pinOrder,
1379
1386
  size,
1380
1387
  title,
@@ -1395,7 +1402,7 @@ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
1395
1402
  context: mapLegacyContext(context != null ? context : "neutral"),
1396
1403
  control,
1397
1404
  disabled: disabled != null ? disabled : false,
1398
- margin,
1405
+ margin: margin != null ? margin : "md",
1399
1406
  pinOrder,
1400
1407
  size,
1401
1408
  title: title != null ? title : "",
@@ -1469,12 +1476,12 @@ var createColumnsComponent = (columnsProps) => __spreadProps(__spreadValues({},
1469
1476
  });
1470
1477
 
1471
1478
  // src/domain/mappers/layout/columnsLayoutToComponent.ts
1472
- var columnsLayoutToComponent = (uid, { control, left, right, bias = "none", margin = "md", analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1479
+ var columnsLayoutToComponent = (uid, { control, left, right, bias, margin, analyticsId, tags }, mapperProps, schemaComponents) => createColumnsComponent({
1473
1480
  uid,
1474
1481
  analyticsId,
1475
1482
  control,
1476
- margin,
1477
- bias: mapLegacyBias(bias),
1483
+ margin: margin != null ? margin : "md",
1484
+ bias: mapLegacyBias(bias != null ? bias : "none"),
1478
1485
  tags,
1479
1486
  startComponents: left.map(
1480
1487
  (component, index) => mapLayoutToComponent(
@@ -1555,7 +1562,7 @@ var mapSchemaAlert = (alert) => {
1555
1562
  var decisionLayoutToComponent = (uid, {
1556
1563
  analyticsId,
1557
1564
  control,
1558
- margin = "md",
1565
+ margin,
1559
1566
  options,
1560
1567
  tags,
1561
1568
  title
@@ -1563,7 +1570,7 @@ var decisionLayoutToComponent = (uid, {
1563
1570
  uid,
1564
1571
  analyticsId,
1565
1572
  control,
1566
- margin,
1573
+ margin: margin != null ? margin : "md",
1567
1574
  options: options.map((option) => mapOption(option, mapperProps)),
1568
1575
  tags,
1569
1576
  title
@@ -1594,7 +1601,7 @@ var createStatusListComponent = (statusListProps) => __spreadValues({
1594
1601
  var isDeprecatedListLayout = (layout) => {
1595
1602
  return layout.items.some((item) => item.status);
1596
1603
  };
1597
- var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", title, tags }) => createStatusListComponent({
1604
+ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margin, title, tags }) => createStatusListComponent({
1598
1605
  uid,
1599
1606
  analyticsId,
1600
1607
  control,
@@ -1605,7 +1612,7 @@ var deprecatedListLayoutToComponent = (uid, { analyticsId, control, items, margi
1605
1612
  status: status ? mapLegacyStatus(status) : void 0,
1606
1613
  tags: itemTags
1607
1614
  })),
1608
- margin,
1615
+ margin: margin != null ? margin : "md",
1609
1616
  title,
1610
1617
  tags
1611
1618
  });
@@ -1628,7 +1635,7 @@ var createDividerComponent = (props) => __spreadValues({
1628
1635
  }, props);
1629
1636
 
1630
1637
  // src/domain/mappers/layout/dividerLayoutToComponent.ts
1631
- var dividerLayoutToComponent = (uid, { control, margin = "md", analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin, tags });
1638
+ var dividerLayoutToComponent = (uid, { control, margin, analyticsId, tags }) => createDividerComponent({ uid, analyticsId, control, margin: margin != null ? margin : "md", tags });
1632
1639
 
1633
1640
  // src/domain/components/FormComponent.ts
1634
1641
  var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formProps), {
@@ -1640,7 +1647,7 @@ var createFormComponent = (formProps) => __spreadProps(__spreadValues({}, formPr
1640
1647
  });
1641
1648
 
1642
1649
  // src/domain/mappers/layout/formLayoutToComponent.ts
1643
- var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin = "md", tags }, schemaComponents) => {
1650
+ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, control, margin, tags }, schemaComponents) => {
1644
1651
  const id = schemaId != null ? schemaId : schemaRef == null ? void 0 : schemaRef.$ref;
1645
1652
  if (id == null) {
1646
1653
  throw new Error(
@@ -1658,7 +1665,7 @@ var formLayoutToComponent = (uid, { analyticsId, schemaId, schema: schemaRef, co
1658
1665
  analyticsId,
1659
1666
  schemaComponent,
1660
1667
  control,
1661
- margin,
1668
+ margin: margin != null ? margin : "md",
1662
1669
  tags
1663
1670
  });
1664
1671
  };
@@ -1670,13 +1677,13 @@ var createHeadingComponent = (headingProps) => __spreadValues({
1670
1677
  }, headingProps);
1671
1678
 
1672
1679
  // src/domain/mappers/layout/headingLayoutToComponent.ts
1673
- var headingLayoutToComponent = (uid, { analyticsId, align = "left", margin = "md", size = "md", control, tags, text }) => createHeadingComponent({
1680
+ var headingLayoutToComponent = (uid, { analyticsId, align, margin, size, control, tags, text }) => createHeadingComponent({
1674
1681
  uid,
1675
1682
  analyticsId,
1676
- align: mapLegacyAlign(align),
1683
+ align: mapLegacyAlign(align != null ? align : "left"),
1677
1684
  control,
1678
- margin,
1679
- size,
1685
+ margin: margin != null ? margin : "md",
1686
+ size: size != null ? size : "md",
1680
1687
  tags,
1681
1688
  text
1682
1689
  });
@@ -1691,11 +1698,11 @@ var createImageComponent = (imageProps) => __spreadValues({
1691
1698
  var imageLayoutToComponent = (uid, {
1692
1699
  analyticsId,
1693
1700
  accessibilityDescription,
1694
- align = "center",
1701
+ align,
1695
1702
  content,
1696
1703
  control,
1697
- margin = "md",
1698
- size = "md",
1704
+ margin,
1705
+ size,
1699
1706
  tags,
1700
1707
  text,
1701
1708
  url
@@ -1704,14 +1711,14 @@ var imageLayoutToComponent = (uid, {
1704
1711
  return createImageComponent({
1705
1712
  uid,
1706
1713
  analyticsId,
1707
- align: mapLegacyAlign(align),
1714
+ align: mapLegacyAlign(align != null ? align : "center"),
1708
1715
  content: content ? {
1709
1716
  uri: (_b = (_a = content.uri) != null ? _a : content.url) != null ? _b : "",
1710
1717
  accessibilityDescription: (_c = content.accessibilityDescription) != null ? _c : content.text
1711
1718
  } : { accessibilityDescription: accessibilityDescription != null ? accessibilityDescription : text, uri: url != null ? url : "" },
1712
1719
  control,
1713
- margin,
1714
- size,
1720
+ margin: margin != null ? margin : "md",
1721
+ size: size != null ? size : "md",
1715
1722
  tags
1716
1723
  });
1717
1724
  };
@@ -1723,13 +1730,13 @@ var createMarkdownComponent = (markdownProps) => __spreadValues({
1723
1730
  }, markdownProps);
1724
1731
 
1725
1732
  // src/domain/mappers/layout/infoLayoutToComponent.ts
1726
- var infoLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", markdown: content, tags }) => createMarkdownComponent({
1733
+ var infoLayoutToComponent = (uid, { analyticsId, align, control, margin, markdown: content, tags }) => createMarkdownComponent({
1727
1734
  uid,
1728
1735
  analyticsId,
1729
- align: mapLegacyAlign(align),
1736
+ align: mapLegacyAlign(align != null ? align : "left"),
1730
1737
  content,
1731
1738
  control,
1732
- margin,
1739
+ margin: margin != null ? margin : "md",
1733
1740
  tags,
1734
1741
  size: "md"
1735
1742
  });
@@ -1741,7 +1748,7 @@ var createInstructionsComponent = (instructionsProps) => __spreadValues({
1741
1748
  }, instructionsProps);
1742
1749
 
1743
1750
  // src/domain/mappers/layout/instructionsLayoutToComponent.ts
1744
- var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }) => createInstructionsComponent({
1751
+ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }) => createInstructionsComponent({
1745
1752
  uid,
1746
1753
  analyticsId,
1747
1754
  control,
@@ -1749,7 +1756,7 @@ var instructionsLayoutToComponent = (uid, { analyticsId, control, items, margin
1749
1756
  context: mapLegacyContext(item.context),
1750
1757
  tags: mapTags(item)
1751
1758
  })),
1752
- margin,
1759
+ margin: margin != null ? margin : "md",
1753
1760
  tags,
1754
1761
  title
1755
1762
  });
@@ -1761,14 +1768,14 @@ var createListComponent = (listProps) => __spreadValues({
1761
1768
  }, listProps);
1762
1769
 
1763
1770
  // src/domain/mappers/layout/listLayoutToComponent.ts
1764
- var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin = "md", tags, title }, mapperProps) => {
1771
+ var listLayoutToComponent = (uid, { analyticsId, callToAction, control, items, margin, tags, title }, mapperProps) => {
1765
1772
  return createListComponent({
1766
1773
  uid,
1767
1774
  analyticsId,
1768
1775
  control,
1769
1776
  items: items.map((item) => mapItem(item, mapperProps)),
1770
1777
  callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
1771
- margin,
1778
+ margin: margin != null ? margin : "md",
1772
1779
  tags,
1773
1780
  title
1774
1781
  });
@@ -1822,33 +1829,33 @@ var createLoadingIndicatorComponent = (loadingIndicatorProps) => __spreadValues(
1822
1829
  }, loadingIndicatorProps);
1823
1830
 
1824
1831
  // src/domain/mappers/layout/loadingIndicatorLayoutToComponent.ts
1825
- var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin = "md", size = "md", tags }) => createLoadingIndicatorComponent({
1832
+ var loadingIndicatorLayoutToComponent = (uid, { analyticsId, control, margin, size, tags }) => createLoadingIndicatorComponent({
1826
1833
  uid,
1827
1834
  analyticsId,
1828
1835
  control,
1829
- margin,
1830
- size,
1836
+ margin: margin != null ? margin : "md",
1837
+ size: size != null ? size : "md",
1831
1838
  tags
1832
1839
  });
1833
1840
 
1834
1841
  // src/domain/mappers/layout/markdownLayoutToComponent.ts
1835
1842
  var markdownLayoutToComponent = (uid, {
1836
1843
  analyticsId,
1837
- align = "left",
1838
- margin = "md",
1844
+ align,
1845
+ margin,
1839
1846
  control,
1840
1847
  content,
1841
- size = "md",
1848
+ size,
1842
1849
  tags
1843
1850
  }) => createMarkdownComponent({
1844
1851
  uid,
1845
1852
  analyticsId,
1846
- align: mapLegacyAlign(align),
1853
+ align: mapLegacyAlign(align != null ? align : "left"),
1847
1854
  control,
1848
1855
  content,
1849
- margin,
1856
+ margin: margin != null ? margin : "md",
1850
1857
  tags,
1851
- size
1858
+ size: size != null ? size : "md"
1852
1859
  });
1853
1860
 
1854
1861
  // src/domain/components/ModalLayoutComponent.ts
@@ -1862,7 +1869,7 @@ var createModalComponent = (modalProps) => __spreadProps(__spreadValues({
1862
1869
  });
1863
1870
 
1864
1871
  // src/domain/mappers/layout/modalLayoutToComponent.ts
1865
- var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md", tags, trigger }, mapperProps, schemaComponents) => {
1872
+ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin, tags, trigger }, mapperProps, schemaComponents) => {
1866
1873
  const { components, title } = content;
1867
1874
  return createModalComponent({
1868
1875
  uid,
@@ -1874,7 +1881,7 @@ var modalLayoutToComponent = (uid, { analyticsId, content, control, margin = "md
1874
1881
  title
1875
1882
  },
1876
1883
  control,
1877
- margin,
1884
+ margin: margin != null ? margin : "md",
1878
1885
  tags,
1879
1886
  trigger
1880
1887
  });
@@ -1887,15 +1894,15 @@ var createParagraphComponent = (paragraphProps) => __spreadValues({
1887
1894
  }, paragraphProps);
1888
1895
 
1889
1896
  // src/domain/mappers/layout/paragraphLayoutToComponent.ts
1890
- var paragraphLayoutToComponent = (uid, { analyticsId, align = "left", control, margin = "md", size = "md", tags, text }) => createParagraphComponent({
1897
+ var paragraphLayoutToComponent = (uid, { analyticsId, align, control, margin, size, tags, text }) => createParagraphComponent({
1891
1898
  uid,
1892
1899
  analyticsId,
1893
1900
  text,
1894
1901
  control,
1895
- align: mapLegacyAlign(align),
1896
- margin,
1902
+ align: mapLegacyAlign(align != null ? align : "left"),
1903
+ margin: margin != null ? margin : "md",
1897
1904
  tags,
1898
- size
1905
+ size: size != null ? size : "md"
1899
1906
  });
1900
1907
 
1901
1908
  // src/domain/components/ReviewComponent.ts
@@ -1911,7 +1918,7 @@ var reviewLayoutToComponent = (uid, {
1911
1918
  title,
1912
1919
  callToAction,
1913
1920
  control,
1914
- margin = "md",
1921
+ margin,
1915
1922
  tags,
1916
1923
  orientation,
1917
1924
  action
@@ -1921,7 +1928,7 @@ var reviewLayoutToComponent = (uid, {
1921
1928
  callToAction: getCallToAction2({ mapperProps, callToAction, action }),
1922
1929
  control: getOrientationControl({ control, orientation }),
1923
1930
  fields: fields.map((field) => mapReviewField(field, mapperProps)),
1924
- margin,
1931
+ margin: margin != null ? margin : "md",
1925
1932
  tags,
1926
1933
  title
1927
1934
  });
@@ -2132,17 +2139,7 @@ var isValidResponseBody = (body) => isObject(body) && "results" in body && isArr
2132
2139
  var hashRequest = (query, config) => JSON.stringify({ query, config });
2133
2140
 
2134
2141
  // src/domain/mappers/layout/searchLayoutToComponent.ts
2135
- var searchLayoutToComponent = (uid, {
2136
- analyticsId,
2137
- control,
2138
- emptyMessage = "",
2139
- method,
2140
- param,
2141
- title,
2142
- url,
2143
- margin = "md",
2144
- tags
2145
- }, mapperProps) => {
2142
+ var searchLayoutToComponent = (uid, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }, mapperProps) => {
2146
2143
  const { httpClient, onBehavior, updateComponent } = mapperProps;
2147
2144
  const search = getPerformSearchFunction(httpClient, { method, param, url });
2148
2145
  return createSearchComponent(
@@ -2150,8 +2147,8 @@ var searchLayoutToComponent = (uid, {
2150
2147
  uid,
2151
2148
  analyticsId,
2152
2149
  control,
2153
- emptyMessage,
2154
- margin,
2150
+ emptyMessage: emptyMessage != null ? emptyMessage : "",
2151
+ margin: margin != null ? margin : "md",
2155
2152
  tags,
2156
2153
  title
2157
2154
  },
@@ -2162,7 +2159,7 @@ var searchLayoutToComponent = (uid, {
2162
2159
  };
2163
2160
 
2164
2161
  // src/domain/mappers/layout/statusListLayoutToComponent.ts
2165
- var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin = "md", tags, title }, mapperProps) => createStatusListComponent({
2162
+ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin, tags, title }, mapperProps) => createStatusListComponent({
2166
2163
  uid,
2167
2164
  analyticsId,
2168
2165
  control,
@@ -2170,7 +2167,7 @@ var statusListLayoutToComponent = (uid, { analyticsId, control, items, margin =
2170
2167
  const callToAction = getDomainLayerCallToAction(item.callToAction, mapperProps);
2171
2168
  return __spreadProps(__spreadValues({}, item), { callToAction, tags: mapTags(item) });
2172
2169
  }),
2173
- margin,
2170
+ margin: margin != null ? margin : "md",
2174
2171
  tags,
2175
2172
  title
2176
2173
  });
@@ -2187,7 +2184,7 @@ var createSectionComponent = (props) => {
2187
2184
  };
2188
2185
 
2189
2186
  // src/domain/mappers/layout/sectionLayoutToComponent.ts
2190
- var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin = "md", tags }, mapperProps, schemaComponents) => {
2187
+ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components, callToAction, margin, tags }, mapperProps, schemaComponents) => {
2191
2188
  return createSectionComponent({
2192
2189
  uid,
2193
2190
  analyticsId,
@@ -2196,7 +2193,7 @@ var sectionLayoutToComponent = (uid, { analyticsId, control, title, components,
2196
2193
  components: components.map(
2197
2194
  (component, index) => mapLayoutToComponent(`${uid}.section-${index}`, component, mapperProps, schemaComponents)
2198
2195
  ),
2199
- margin,
2196
+ margin: margin != null ? margin : "md",
2200
2197
  callToAction: getDomainLayerCallToAction(callToAction, mapperProps),
2201
2198
  tags
2202
2199
  });
@@ -2209,11 +2206,11 @@ var createTabsComponent = (tabsProps) => __spreadProps(__spreadValues({}, tabsPr
2209
2206
  });
2210
2207
 
2211
2208
  // src/domain/mappers/layout/tabsLayoutToComponent.ts
2212
- var tabsLayoutToComponent = (uid, { analyticsId, control, margin = "md", tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2209
+ var tabsLayoutToComponent = (uid, { analyticsId, control, margin, tags, tabs }, mapperProps, schemaComponents) => createTabsComponent({
2213
2210
  uid,
2214
2211
  analyticsId,
2215
2212
  control,
2216
- margin,
2213
+ margin: margin != null ? margin : "md",
2217
2214
  tags,
2218
2215
  tabs: mapTabs(tabs, uid, mapperProps, schemaComponents)
2219
2216
  });
@@ -2239,11 +2236,11 @@ var createProgressComponent = (progressProps) => __spreadValues({
2239
2236
  // src/domain/mappers/layout/progressLayoutToComponent.ts
2240
2237
  var progressLayoutToComponent = (uid, {
2241
2238
  analyticsId,
2242
- context = "neutral",
2239
+ context,
2243
2240
  control,
2244
2241
  description,
2245
2242
  help,
2246
- margin = "md",
2243
+ margin,
2247
2244
  progress,
2248
2245
  progressText,
2249
2246
  tags,
@@ -2251,11 +2248,11 @@ var progressLayoutToComponent = (uid, {
2251
2248
  }) => createProgressComponent({
2252
2249
  uid,
2253
2250
  analyticsId,
2254
- context: mapLegacyContext(context),
2251
+ context: mapLegacyContext(context != null ? context : "neutral"),
2255
2252
  control,
2256
2253
  description,
2257
2254
  help: help == null ? void 0 : help.markdown,
2258
- margin,
2255
+ margin: margin != null ? margin : "md",
2259
2256
  progress,
2260
2257
  progressText,
2261
2258
  tags,
@@ -5700,11 +5697,6 @@ var mapToolbarToComponent = (uid, toolbar, mapperProps) => {
5700
5697
  });
5701
5698
  };
5702
5699
 
5703
- // src/domain/mappers/utils/feature-utils.ts
5704
- var isFeatureEnabled = (features, featureName) => {
5705
- return features[featureName] !== void 0 && features[featureName] !== false;
5706
- };
5707
-
5708
5700
  // src/domain/mappers/utils/groupLayoutByPinned.ts
5709
5701
  var groupLayoutByPinned = (layouts) => {
5710
5702
  return layouts.reduce(groupLayout, { pinned: [], nonPinned: [] });
@@ -5790,7 +5782,7 @@ var mapStepToComponent = (_a) => {
5790
5782
  submissionBehaviors.push(behavior);
5791
5783
  }
5792
5784
  };
5793
- const back = mapBackNavigation(navigation, onBehavior, Boolean(features.nativeBack));
5785
+ const back = mapBackNavigation(navigation, onBehavior, features.isEnabled("nativeBack"));
5794
5786
  const stepId = id || key;
5795
5787
  if (stepId === void 0) {
5796
5788
  throw new Error("Step must have an id or a key");
@@ -5814,7 +5806,7 @@ var mapStepToComponent = (_a) => {
5814
5806
  mapperProps,
5815
5807
  referencedSchemaIds
5816
5808
  );
5817
- const shouldPinButtons = isFeatureEnabled(features, "pinnedButtons");
5809
+ const shouldPinButtons = features.isEnabled("pinnedButtons");
5818
5810
  const { pinned, nonPinned } = shouldPinButtons ? groupLayoutByPinned(layout) : { pinned: [], nonPinned: layout };
5819
5811
  const layoutComponents = nonPinned.map(
5820
5812
  (layoutComponent, index) => mapLayoutToComponent(`${uid}.layout-${index}`, layoutComponent, mapperProps, schemaComponents)
@@ -5846,7 +5838,7 @@ var mapStepToComponent = (_a) => {
5846
5838
  loadingState,
5847
5839
  stepPolling,
5848
5840
  stepRefreshAfter,
5849
- title: !features.hideStepTitle ? title : void 0,
5841
+ title: !features.isEnabled("hideStepTitle") ? title : void 0,
5850
5842
  tags,
5851
5843
  stackBehavior: (_a2 = navigation == null ? void 0 : navigation.stackBehavior) != null ? _a2 : "default",
5852
5844
  submissionRequestsCache,
@@ -5898,6 +5890,19 @@ var executePrefetch = (props) => {
5898
5890
  });
5899
5891
  };
5900
5892
 
5893
+ // src/domain/mappers/utils/FeatureFlags.ts
5894
+ var _features;
5895
+ var FeatureFlags = class {
5896
+ constructor(features) {
5897
+ __privateAdd(this, _features);
5898
+ __privateSet(this, _features, features);
5899
+ }
5900
+ isEnabled(featureName) {
5901
+ return __privateGet(this, _features)[featureName] != null && __privateGet(this, _features)[featureName] !== false;
5902
+ }
5903
+ };
5904
+ _features = new WeakMap();
5905
+
5901
5906
  // src/flow/getResponseType.ts
5902
5907
  var responseTypes = ["step", "action", "exit", "modal"];
5903
5908
  var getResponseType = async (response) => {
@@ -6363,7 +6368,7 @@ function useStableCallback(handler) {
6363
6368
 
6364
6369
  // src/useDynamicFlowCore.tsx
6365
6370
  function useDynamicFlowCore(props) {
6366
- const _a = props, { flowId, initialAction, initialStep, features = {} } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep", "features"]);
6371
+ const _a = props, { flowId, initialAction, initialStep } = _a, rest = __objRest(_a, ["flowId", "initialAction", "initialStep"]);
6367
6372
  const httpClient = useStableCallback(rest.httpClient);
6368
6373
  const onCancellation = useStableCallback(rest.onCancellation);
6369
6374
  const onCompletion = useStableCallback(rest.onCompletion);
@@ -6379,10 +6384,14 @@ function useDynamicFlowCore(props) {
6379
6384
  () => getSchemaErrorMessageFunction(formatMessage, locale),
6380
6385
  [formatMessage, locale]
6381
6386
  );
6387
+ const features = useMemo(() => {
6388
+ var _a2;
6389
+ return new FeatureFlags((_a2 = rest.features) != null ? _a2 : {});
6390
+ }, []);
6382
6391
  const rerender = useRerender();
6383
6392
  const rootComponentRef = useRef2(
6384
6393
  createRootDomainComponent(rerender, scrollToTop, {
6385
- isNativeBackEnabled: Boolean(features.nativeBack),
6394
+ isNativeBackEnabled: features.isEnabled("nativeBack"),
6386
6395
  isFlowCancellable: Boolean(rest.onCancellation)
6387
6396
  })
6388
6397
  );
@@ -6520,7 +6529,7 @@ function useDynamicFlowCore(props) {
6520
6529
  });
6521
6530
  break;
6522
6531
  }
6523
- if (isFeatureEnabled(features, "nativeBack")) {
6532
+ if (features.isEnabled("nativeBack")) {
6524
6533
  if (rootComponentRef.current.stepStack.length > 1) {
6525
6534
  rootComponentRef.current.navigateBack();
6526
6535
  } else {
@@ -1,3 +1,3 @@
1
1
  import type { SearchLayout } from '@wise/dynamic-flow-types/spec';
2
2
  import type { MapperProps } from '../schema/types';
3
- export declare const searchLayoutToComponent: (uid: string, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags, }: SearchLayout, mapperProps: MapperProps) => import("../../components/searchComponent/SearchComponent").SearchComponent;
3
+ export declare const searchLayoutToComponent: (uid: string, { analyticsId, control, emptyMessage, method, param, title, url, margin, tags }: SearchLayout, mapperProps: MapperProps) => import("../../components/searchComponent/SearchComponent").SearchComponent;
@@ -1,12 +1,13 @@
1
1
  import type { AnalyticsEventDispatcher } from '../features/events';
2
2
  import type { LoadingState, OnPoll } from '../types';
3
3
  import type { MapperProps } from './schema/types';
4
+ import { FeatureFlags } from './utils/FeatureFlags';
4
5
  export type StepMapperProps = Omit<MapperProps, 'trackEvent' | 'registerSubmissionBehavior'> & {
5
6
  uid: string;
6
7
  etag: string | null;
7
8
  loadingState: LoadingState;
8
9
  trackEvent: AnalyticsEventDispatcher<string>;
9
- features: Record<string, unknown>;
10
+ features: FeatureFlags;
10
11
  onPoll: OnPoll;
11
12
  };
12
13
  export declare const mapStepToComponent: ({ uid: rootUid, loadingState, features, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/step/StepDomainComponent").StepDomainComponent;
@@ -0,0 +1,7 @@
1
+ type FeatureName = 'pinnedButtons' | 'nativeBack' | 'hideStepTitle';
2
+ export declare class FeatureFlags {
3
+ #private;
4
+ constructor(features: Record<string, unknown>);
5
+ isEnabled(featureName: FeatureName): boolean;
6
+ }
7
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -32,30 +32,30 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@chromatic-com/storybook": "4.1.3",
35
- "@formatjs/cli": "^6.7.4",
36
- "@storybook/addon-a11y": "^10.1.4",
37
- "@storybook/addon-docs": "^10.1.4",
38
- "@storybook/addon-links": "^10.1.4",
39
- "@storybook/react-vite": "10.1.4",
35
+ "@formatjs/cli": "^6.9.0",
36
+ "@storybook/addon-a11y": "^10.1.11",
37
+ "@storybook/addon-docs": "^10.1.11",
38
+ "@storybook/addon-links": "^10.1.11",
39
+ "@storybook/react-vite": "10.1.11",
40
40
  "@testing-library/dom": "10.4.1",
41
41
  "@testing-library/jest-dom": "6.9.1",
42
- "@testing-library/react": "16.3.0",
42
+ "@testing-library/react": "16.3.1",
43
43
  "@testing-library/user-event": "14.6.1",
44
- "@transferwise/components": "^46.115.1",
44
+ "@transferwise/components": "^46.118.0",
45
45
  "@transferwise/formatting": "^2.13.4",
46
- "@transferwise/icons": "4.0.0",
46
+ "@transferwise/icons": "4.0.1",
47
47
  "@transferwise/navigation-ui": "4.41.0",
48
- "@transferwise/neptune-css": "14.25.2",
49
- "@types/node": "22.19.1",
48
+ "@transferwise/neptune-css": "14.26.0",
49
+ "@types/node": "22.19.3",
50
50
  "@types/react": "18.3.27",
51
51
  "@types/react-dom": "18.3.7",
52
52
  "@types/react-intl": "3.0.0",
53
- "@vitejs/plugin-react": "5.1.1",
54
- "@wise/art": "2.24.7",
55
- "@wise/components-theming": "^1.9.0",
53
+ "@vitejs/plugin-react": "5.1.2",
54
+ "@wise/art": "2.25.0",
55
+ "@wise/components-theming": "^1.9.1",
56
56
  "esbuild": "0.27.0",
57
- "eslint-plugin-storybook": "10.1.4",
58
- "framer-motion": "^12.23.25",
57
+ "eslint-plugin-storybook": "10.1.11",
58
+ "framer-motion": "^12.23.26",
59
59
  "npm-run-all2": "8.0.4",
60
60
  "postcss": "^8.5.6",
61
61
  "postcss-cli": "^11.0.1",
@@ -63,14 +63,14 @@
63
63
  "react": "18.3.1",
64
64
  "react-dom": "18.3.1",
65
65
  "react-intl": "6.8.9",
66
- "storybook": "^10.1.4",
66
+ "storybook": "^10.1.11",
67
67
  "stylelint": "16.26.1",
68
68
  "stylelint-config-standard": "36.0.1",
69
69
  "stylelint-no-unsupported-browser-features": "8.0.5",
70
- "stylelint-value-no-unknown-custom-properties": "6.0.1",
70
+ "stylelint-value-no-unknown-custom-properties": "6.1.0",
71
71
  "tsx": "4.21.0",
72
72
  "typescript": "5.9.3",
73
- "vitest": "4.0.15",
73
+ "vitest": "4.0.16",
74
74
  "vitest-fetch-mock": "0.4.5",
75
75
  "@wise/dynamic-flow-fixtures": "0.0.1",
76
76
  "@wise/dynamic-flow-renderers": "0.0.0"
@@ -86,7 +86,7 @@
86
86
  "react-intl": "^6"
87
87
  },
88
88
  "dependencies": {
89
- "@wise/dynamic-flow-types": "4.1.0"
89
+ "@wise/dynamic-flow-types": "4.1.2"
90
90
  },
91
91
  "scripts": {
92
92
  "dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",
@@ -1,3 +0,0 @@
1
- type Feature = 'pinnedButtons' | 'nativeBack';
2
- export declare const isFeatureEnabled: (features: Record<string, unknown>, featureName: Feature) => boolean;
3
- export {};