@wise/dynamic-flow-client 5.20.0-experimental-9265cac → 5.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/build/i18n/ar.json +38 -0
  2. package/build/i18n/ko.json +38 -0
  3. package/build/main.js +77 -373
  4. package/build/main.mjs +77 -373
  5. package/build/tsconfig.types.tsbuildinfo +1 -1
  6. package/build/types/domain/mappers/mapLayoutToComponent.d.ts.map +1 -1
  7. package/build/types/domain/types.d.ts +2 -3
  8. package/build/types/domain/types.d.ts.map +1 -1
  9. package/build/types/renderers/mappers/componentToRendererProps.d.ts.map +1 -1
  10. package/build/types/test-utils/getMergedTestRenderers.d.ts +1 -1
  11. package/build/types/test-utils/getMergedTestRenderers.d.ts.map +1 -1
  12. package/package.json +4 -4
  13. package/build/types/domain/components/collectionComponent/CollectionComponent.d.ts +0 -7
  14. package/build/types/domain/components/collectionComponent/CollectionComponent.d.ts.map +0 -1
  15. package/build/types/domain/components/collectionComponent/applyCollectionResponse.d.ts +0 -3
  16. package/build/types/domain/components/collectionComponent/applyCollectionResponse.d.ts.map +0 -1
  17. package/build/types/domain/components/collectionComponent/types.d.ts +0 -73
  18. package/build/types/domain/components/collectionComponent/types.d.ts.map +0 -1
  19. package/build/types/domain/features/collection/getPerformCollectionQueryFunction.d.ts +0 -12
  20. package/build/types/domain/features/collection/getPerformCollectionQueryFunction.d.ts.map +0 -1
  21. package/build/types/domain/mappers/layout/collectionLayoutToComponent.d.ts +0 -7
  22. package/build/types/domain/mappers/layout/collectionLayoutToComponent.d.ts.map +0 -1
  23. package/build/types/renderers/mappers/collectionComponentToProps.d.ts +0 -5
  24. package/build/types/renderers/mappers/collectionComponentToProps.d.ts.map +0 -1
@@ -0,0 +1,38 @@
1
+ {
2
+ "dynamicFlows.ArraySchema.addItem": "Save",
3
+ "dynamicFlows.ArraySchema.addItemTitle": "Add Item",
4
+ "dynamicFlows.ArraySchema.editItem": "Save",
5
+ "dynamicFlows.ArraySchema.maxItemsError": "Please add {maxItems} or fewer.",
6
+ "dynamicFlows.ArraySchema.minItemsError": "Please add at least {minItems}.",
7
+ "dynamicFlows.ArraySchema.removeItem": "Remove",
8
+ "dynamicFlows.ControlFeedback.maxLength": "Please enter {maxLength} or fewer characters.",
9
+ "dynamicFlows.ControlFeedback.maximum": "Please enter a number that's {maximum} or less.",
10
+ "dynamicFlows.ControlFeedback.maximumDate": "Please enter a date that's on or before {maximum}.",
11
+ "dynamicFlows.ControlFeedback.minLength": "Please enter at least {minLength} characters.",
12
+ "dynamicFlows.ControlFeedback.minimum": "Please enter a number that's {minimum} or more.",
13
+ "dynamicFlows.ControlFeedback.minimumDate": "Please enter a date that's on or after {minimum}.",
14
+ "dynamicFlows.ControlFeedback.pattern": "Please enter this in the correct format.",
15
+ "dynamicFlows.ControlFeedback.patternDate": "Please enter a date in the corrrect format.",
16
+ "dynamicFlows.ControlFeedback.required": "Please fill out this field.",
17
+ "dynamicFlows.ControlFeedback.type": "Incorrect type",
18
+ "dynamicFlows.DownloadFeedback.failed": "Download failed",
19
+ "dynamicFlows.DownloadFeedback.started": "Downloading...",
20
+ "dynamicFlows.DownloadFeedback.successful": "Download successful",
21
+ "dynamicFlows.DynamicParagraph.copied": "Copied to clipboard",
22
+ "dynamicFlows.DynamicParagraph.copy": "Copy",
23
+ "dynamicFlows.ErrorBoundary.errorAlert": "Something went wrong.",
24
+ "dynamicFlows.ErrorBoundary.retry": "Retry",
25
+ "dynamicFlows.ExternalConfirmation.cancel": "Cancel",
26
+ "dynamicFlows.ExternalConfirmation.description": "Please confirm you want to open **{origin}** in a new browser tab.",
27
+ "dynamicFlows.ExternalConfirmation.open": "Open in new tab",
28
+ "dynamicFlows.ExternalConfirmation.title": "Please confirm",
29
+ "dynamicFlows.FileUploadSchema.maxFileSizeError": "Sorry, that file is too big. Please upload a smaller file.",
30
+ "dynamicFlows.FileUploadSchema.wrongFileTypeError": "Sorry, that file format is not supported. Please upload a different file.",
31
+ "dynamicFlows.Help.ariaLabel": "Click here for more info.",
32
+ "dynamicFlows.MultiSelect.summary": "{first} and {count} more",
33
+ "dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "Sorry, that file is too big. Please upload a smaller file.",
34
+ "dynamicFlows.MultipleFileUploadSchema.maxItemsError": "Please upload {maxItems} or fewer files.",
35
+ "dynamicFlows.MultipleFileUploadSchema.minItemsError": "Please upload at least {minItems} file(s).",
36
+ "dynamicFlows.PersistAsyncSchema.genericError": "Something went wrong, please try again.",
37
+ "dynamicFlows.SearchLayout.loading": "Loading..."
38
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "dynamicFlows.ArraySchema.addItem": "저장",
3
+ "dynamicFlows.ArraySchema.addItemTitle": "Add Item",
4
+ "dynamicFlows.ArraySchema.editItem": "저장",
5
+ "dynamicFlows.ArraySchema.maxItemsError": "Please add {maxItems} or fewer.",
6
+ "dynamicFlows.ArraySchema.minItemsError": "Please add at least {minItems}.",
7
+ "dynamicFlows.ArraySchema.removeItem": "제거",
8
+ "dynamicFlows.ControlFeedback.maxLength": "Please enter {maxLength} or fewer characters.",
9
+ "dynamicFlows.ControlFeedback.maximum": "Please enter a number that's {maximum} or less.",
10
+ "dynamicFlows.ControlFeedback.maximumDate": "Please enter a date that's on or before {maximum}.",
11
+ "dynamicFlows.ControlFeedback.minLength": "{minLength}자 이상 입력하세요.",
12
+ "dynamicFlows.ControlFeedback.minimum": "Please enter a number that's {minimum} or more.",
13
+ "dynamicFlows.ControlFeedback.minimumDate": "Please enter a date that's on or after {minimum}.",
14
+ "dynamicFlows.ControlFeedback.pattern": "Please enter this in the correct format.",
15
+ "dynamicFlows.ControlFeedback.patternDate": "Please enter a date in the corrrect format.",
16
+ "dynamicFlows.ControlFeedback.required": "Please fill out this field.",
17
+ "dynamicFlows.ControlFeedback.type": "Incorrect type",
18
+ "dynamicFlows.DownloadFeedback.failed": "Download failed",
19
+ "dynamicFlows.DownloadFeedback.started": "Downloading...",
20
+ "dynamicFlows.DownloadFeedback.successful": "Download successful",
21
+ "dynamicFlows.DynamicParagraph.copied": "Copied to clipboard",
22
+ "dynamicFlows.DynamicParagraph.copy": "복사",
23
+ "dynamicFlows.ErrorBoundary.errorAlert": "Something went wrong.",
24
+ "dynamicFlows.ErrorBoundary.retry": "Retry",
25
+ "dynamicFlows.ExternalConfirmation.cancel": "취소",
26
+ "dynamicFlows.ExternalConfirmation.description": "Please confirm you want to open **{origin}** in a new browser tab.",
27
+ "dynamicFlows.ExternalConfirmation.open": "Open in new tab",
28
+ "dynamicFlows.ExternalConfirmation.title": "Please confirm",
29
+ "dynamicFlows.FileUploadSchema.maxFileSizeError": "Sorry, that file is too big. Please upload a smaller file.",
30
+ "dynamicFlows.FileUploadSchema.wrongFileTypeError": "Sorry, that file format is not supported. Please upload a different file.",
31
+ "dynamicFlows.Help.ariaLabel": "Click here for more info.",
32
+ "dynamicFlows.MultiSelect.summary": "{first} and {count} more",
33
+ "dynamicFlows.MultipleFileUploadSchema.maxFileSizeError": "Sorry, that file is too big. Please upload a smaller file.",
34
+ "dynamicFlows.MultipleFileUploadSchema.maxItemsError": "Please upload {maxItems} or fewer files.",
35
+ "dynamicFlows.MultipleFileUploadSchema.minItemsError": "Please upload at least {minItems} file(s).",
36
+ "dynamicFlows.PersistAsyncSchema.genericError": "문제가 발생했습니다. 다시 시도하세요.",
37
+ "dynamicFlows.SearchLayout.loading": "Loading..."
38
+ }
package/build/main.js CHANGED
@@ -883,7 +883,6 @@ var getChildren = (node) => {
883
883
  return node.tabs.flatMap((c) => c.childrenProps);
884
884
  case "alert":
885
885
  case "button":
886
- case "collection":
887
886
  case "input-checkbox":
888
887
  case "input-date":
889
888
  case "decision":
@@ -1501,348 +1500,6 @@ var boxLayoutToComponent = (uid, { border = false, components, control, margin,
1501
1500
  )
1502
1501
  });
1503
1502
 
1504
- // src/domain/mappers/utils/utils.ts
1505
- var mapInlineAlert = (alert) => {
1506
- return alert ? {
1507
- content: alert.content,
1508
- context: alert.context ? mapLegacyContext(alert.context) : "neutral"
1509
- } : void 0;
1510
- };
1511
- var mapAdditionalInfo = (info, mapperProps) => {
1512
- const { onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
1513
- if (info) {
1514
- const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
1515
- const isLink = behavior.type === "link";
1516
- return {
1517
- text: info.text,
1518
- href: isLink ? behavior.url : void 0,
1519
- hrefWithTracking: getHrefWithTracking({
1520
- behavior,
1521
- onBehavior,
1522
- trackEvent
1523
- }),
1524
- accessibilityDescription: info.accessibilityDescription,
1525
- onClick: behavior.type === "none" ? void 0 : () => {
1526
- void onBehavior(behavior);
1527
- }
1528
- };
1529
- }
1530
- return void 0;
1531
- };
1532
- var mapSchemaAlert = (alert) => {
1533
- return alert ? {
1534
- content: alert.markdown,
1535
- context: alert.context ? mapLegacyContext(alert.context) : "neutral"
1536
- } : void 0;
1537
- };
1538
-
1539
- // src/domain/components/utils/debounce.ts
1540
- var debounce = (callback, waitMs) => {
1541
- let timeoutId = null;
1542
- let lastArgs = null;
1543
- const clearTimer = () => {
1544
- if (timeoutId !== null) {
1545
- clearTimeout(timeoutId);
1546
- timeoutId = null;
1547
- }
1548
- lastArgs = null;
1549
- };
1550
- const debouncedFn = (...args) => {
1551
- lastArgs = args;
1552
- if (timeoutId !== null) {
1553
- clearTimeout(timeoutId);
1554
- }
1555
- timeoutId = setTimeout(() => {
1556
- callback(...lastArgs);
1557
- timeoutId = null;
1558
- lastArgs = null;
1559
- }, waitMs);
1560
- };
1561
- debouncedFn.cancel = () => {
1562
- if (timeoutId !== null) {
1563
- clearTimer();
1564
- }
1565
- };
1566
- debouncedFn.flush = () => {
1567
- if (timeoutId !== null) {
1568
- callback(...lastArgs);
1569
- clearTimer();
1570
- }
1571
- };
1572
- return debouncedFn;
1573
- };
1574
-
1575
- // src/domain/components/collectionComponent/applyCollectionResponse.ts
1576
- var applyCollectionResponse = (currentState, response, isPaginated) => {
1577
- var _a, _b, _c, _d;
1578
- const sections = isPaginated ? mergeSections(currentState.sections, response.sections) : response.sections;
1579
- return {
1580
- sections,
1581
- nextCursor: response.nextCursor,
1582
- filters: (_a = response.filters) != null ? _a : currentState.filters,
1583
- search: (_b = response.search) != null ? _b : currentState.search,
1584
- beforeSections: (_c = response.beforeSections) != null ? _c : currentState.beforeSections,
1585
- afterSections: (_d = response.afterSections) != null ? _d : currentState.afterSections
1586
- };
1587
- };
1588
- var mergeSections = (existing, incoming) => {
1589
- const knownIds = new Set(existing.map((section) => section.id));
1590
- const newSections = incoming.filter((section) => !knownIds.has(section.id));
1591
- const merged = existing.map((section) => {
1592
- const match = incoming.find((s) => s.id === section.id);
1593
- if (!match) return section;
1594
- return __spreadProps(__spreadValues({}, section), { items: [...section.items, ...match.items] });
1595
- });
1596
- return [...merged, ...newSections];
1597
- };
1598
-
1599
- // src/domain/components/collectionComponent/CollectionComponent.ts
1600
- var DEBOUNCE_TIME = 800;
1601
- var createCollectionComponent = (props, onComponentUpdate, searchFunction) => {
1602
- const { uid, analyticsId, control, margin, tags, url, method, state } = props;
1603
- const update = getInputUpdateFunction(onComponentUpdate);
1604
- let abortController = new AbortController();
1605
- const query = (component2, cursor) => {
1606
- var _a, _b;
1607
- abortController.abort();
1608
- abortController = new AbortController();
1609
- const { signal } = abortController;
1610
- searchFunction({
1611
- searchParam: (_a = component2.state.search) == null ? void 0 : _a.param,
1612
- query: (_b = component2.state.search) == null ? void 0 : _b.query,
1613
- cursor,
1614
- signal,
1615
- filters: component2.state.filters
1616
- }).then((response) => {
1617
- if (!response) {
1618
- return;
1619
- }
1620
- update(component2, (draft) => {
1621
- const newState = applyCollectionResponse(draft.state, response, !!cursor);
1622
- draft.state = __spreadProps(__spreadValues({}, newState), {
1623
- filters: mapFilters(newState.filters),
1624
- search: mapSearch(newState.search)
1625
- });
1626
- draft.status = {
1627
- type: "idle",
1628
- loadMore: newState.nextCursor ? () => query(component2, newState.nextCursor) : void 0
1629
- };
1630
- });
1631
- }).catch(() => {
1632
- if (!signal.aborted) {
1633
- update(component2, (draft) => {
1634
- draft.status = {
1635
- type: "error",
1636
- reason: cursor ? "pagination" : "search",
1637
- retry: () => query(component2, cursor)
1638
- };
1639
- });
1640
- }
1641
- });
1642
- };
1643
- const debouncedQuery = debounce(
1644
- (component2) => query(component2),
1645
- DEBOUNCE_TIME
1646
- );
1647
- const selectFilter = (filterIndex, optionIndex) => {
1648
- var _a;
1649
- const filter = (_a = component.state.filters) == null ? void 0 : _a[filterIndex];
1650
- if (!filter) {
1651
- return;
1652
- }
1653
- const currentValue = filter.options[optionIndex].selected;
1654
- update(component, (draft) => {
1655
- if (!draft.state.filters) {
1656
- return;
1657
- }
1658
- if (filter.multiSelect) {
1659
- draft.state.filters[filterIndex].options[optionIndex].selected = !currentValue;
1660
- } else {
1661
- draft.state.filters[filterIndex].options = draft.state.filters[filterIndex].options.map(
1662
- (option, index) => __spreadProps(__spreadValues({}, option), {
1663
- selected: index === optionIndex ? !currentValue : false
1664
- })
1665
- );
1666
- }
1667
- draft.status = { type: "loading", reason: "search" };
1668
- });
1669
- query(component);
1670
- };
1671
- const mapFilters = (filters) => filters == null ? void 0 : filters.map((filter, i) => {
1672
- var _a;
1673
- return __spreadProps(__spreadValues({}, filter), {
1674
- options: (_a = filter.options) == null ? void 0 : _a.map((option, j) => {
1675
- var _a2;
1676
- return __spreadProps(__spreadValues({}, option), {
1677
- selected: (_a2 = option.selected) != null ? _a2 : false,
1678
- onSelect: () => selectFilter(i, j)
1679
- });
1680
- })
1681
- });
1682
- });
1683
- const mapSearch = (search) => search ? __spreadProps(__spreadValues({}, search), {
1684
- onChange(value) {
1685
- update(component, (draft) => {
1686
- if (draft.state.search) {
1687
- draft.state.search.query = value;
1688
- draft.status = { type: "loading", reason: "search" };
1689
- }
1690
- });
1691
- debouncedQuery(component);
1692
- }
1693
- }) : void 0;
1694
- const component = {
1695
- type: "collection",
1696
- kind: "layout",
1697
- uid,
1698
- analyticsId,
1699
- control,
1700
- margin,
1701
- method,
1702
- url,
1703
- tags,
1704
- status: {
1705
- type: "idle",
1706
- loadMore: state.nextCursor ? () => query(component, state.nextCursor) : void 0
1707
- },
1708
- state: __spreadProps(__spreadValues({}, state), {
1709
- filters: mapFilters(state.filters),
1710
- search: mapSearch(props.search)
1711
- })
1712
- };
1713
- return component;
1714
- };
1715
-
1716
- // src/domain/features/collection/getPerformCollectionQueryFunction.ts
1717
- var getPerformCollectionQueryFunction = (httpClient, url, method, mapState) => {
1718
- return async ({ searchParam, query, cursor, signal, filters = [] }) => {
1719
- const headers = { "Content-Type": "application/json" };
1720
- const filterValues = filters.map(
1721
- (f) => {
1722
- var _a;
1723
- return [
1724
- f.param,
1725
- f.multiSelect ? f.options.filter((option) => option.selected).map((option) => option.value) : (_a = f.options.find((option) => option.selected)) == null ? void 0 : _a.value
1726
- ];
1727
- }
1728
- );
1729
- const response = await (method === "GET" ? httpClient(
1730
- addQueryParameters(url, [
1731
- [searchParam, query != null ? query : void 0],
1732
- ["cursor", cursor],
1733
- ...filterValues
1734
- ]),
1735
- {
1736
- method,
1737
- headers,
1738
- signal
1739
- }
1740
- ) : httpClient(url, {
1741
- method,
1742
- headers,
1743
- signal,
1744
- body: JSON.stringify(__spreadValues(__spreadProps(__spreadValues({}, searchParam && query ? { [searchParam]: query } : {}), {
1745
- cursor
1746
- }), filterValues.reduce((acc, [k, v]) => __spreadProps(__spreadValues({}, acc), { [k]: v }), {})))
1747
- }));
1748
- const results = await parseResponse(response);
1749
- return mapState(results);
1750
- };
1751
- };
1752
- var parseResponse = async (response) => {
1753
- if (response.ok) {
1754
- const body = await response.json().catch(() => null);
1755
- return body;
1756
- }
1757
- throw Error("error response");
1758
- };
1759
- var addQueryParameters = (url, params) => {
1760
- return params.reduce(
1761
- (u, [key, param]) => key && param ? addQueryParameter(u, key, param) : u,
1762
- url
1763
- );
1764
- };
1765
- var addQueryParameter = (url, key, value) => {
1766
- const [urlBase, urlQuery] = url.split("?");
1767
- const urlQueryParams = new URLSearchParams(urlQuery);
1768
- if (isArray(value)) {
1769
- value.forEach((v) => {
1770
- urlQueryParams.append(key, v);
1771
- });
1772
- } else {
1773
- urlQueryParams.append(key, value);
1774
- }
1775
- return `${urlBase}?${urlQueryParams.toString()}`;
1776
- };
1777
-
1778
- // src/domain/mappers/layout/collectionLayoutToComponent.ts
1779
- var collectionLayoutToComponent = (uid, { analyticsId, control, initialState, margin, method, search, tags, url }, mapperProps) => {
1780
- const { httpClient, onComponentUpdate } = mapperProps;
1781
- const mapLayout = (layout, index) => mapLayoutToComponent(`${uid}-collection-response-${index}`, layout, mapperProps, []);
1782
- const mapState = (state) => mapCollectionSpecToDomainState(state, mapperProps, mapLayout);
1783
- const searchFunction = getPerformCollectionQueryFunction(httpClient, url, method, mapState);
1784
- const component = createCollectionComponent(
1785
- {
1786
- uid,
1787
- analyticsId,
1788
- control,
1789
- margin: margin != null ? margin : "md",
1790
- tags,
1791
- url,
1792
- method,
1793
- state: mapState(initialState),
1794
- search: search ? {
1795
- param: search == null ? void 0 : search.param,
1796
- query: "",
1797
- hint: search == null ? void 0 : search.hint
1798
- } : void 0
1799
- },
1800
- onComponentUpdate,
1801
- searchFunction
1802
- );
1803
- return component;
1804
- };
1805
- var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
1806
- var _a, _b, _c;
1807
- return {
1808
- sections: specState.sections.map((section) => {
1809
- return {
1810
- id: section.id,
1811
- title: section.title,
1812
- callToAction: getDomainLayerCallToAction(section.callToAction, mapperProps),
1813
- items: section.items.map((item) => {
1814
- const behavior = getDomainLayerBehavior(
1815
- { behavior: item.primaryBehavior },
1816
- [],
1817
- mapperProps.registerSubmissionBehavior
1818
- );
1819
- return __spreadProps(__spreadValues({}, item), {
1820
- onClick: item.primaryBehavior ? () => {
1821
- void mapperProps.onBehavior(behavior);
1822
- } : void 0,
1823
- callToAction: getDomainLayerCallToAction(item.callToAction, mapperProps),
1824
- inlineAlert: mapInlineAlert(item.inlineAlert)
1825
- });
1826
- })
1827
- };
1828
- }),
1829
- filters: (_a = specState.filters) == null ? void 0 : _a.map((filter) => __spreadProps(__spreadValues({}, filter), {
1830
- options: filter.options.map((option) => {
1831
- var _a2;
1832
- return __spreadProps(__spreadValues({}, option), {
1833
- selected: (_a2 = option.selected) != null ? _a2 : false,
1834
- onSelect: () => {
1835
- }
1836
- // todo: what goes here?
1837
- });
1838
- })
1839
- })),
1840
- beforeSections: (_b = specState.beforeSections) == null ? void 0 : _b.map(mapLayout),
1841
- afterSections: (_c = specState.afterSections) == null ? void 0 : _c.map(mapLayout),
1842
- nextCursor: specState.nextCursor
1843
- };
1844
- };
1845
-
1846
1503
  // src/domain/components/ButtonComponent.ts
1847
1504
  var createButtonComponent = (props) => __spreadValues({
1848
1505
  type: "button",
@@ -2011,6 +1668,41 @@ var createDecisionComponent = (props) => __spreadValues({
2011
1668
  // src/domain/mappers/utils/tags-utils.ts
2012
1669
  var mapTags = ({ tag, tags }) => tags != null ? tags : tag != null ? [tag] : void 0;
2013
1670
 
1671
+ // src/domain/mappers/utils/utils.ts
1672
+ var mapInlineAlert = (alert) => {
1673
+ return alert ? {
1674
+ content: alert.content,
1675
+ context: alert.context ? mapLegacyContext(alert.context) : "neutral"
1676
+ } : void 0;
1677
+ };
1678
+ var mapAdditionalInfo = (info, mapperProps) => {
1679
+ const { onBehavior, trackEvent, registerSubmissionBehavior } = mapperProps;
1680
+ if (info) {
1681
+ const behavior = getDomainLayerBehavior(info, [], registerSubmissionBehavior);
1682
+ const isLink = behavior.type === "link";
1683
+ return {
1684
+ text: info.text,
1685
+ href: isLink ? behavior.url : void 0,
1686
+ hrefWithTracking: getHrefWithTracking({
1687
+ behavior,
1688
+ onBehavior,
1689
+ trackEvent
1690
+ }),
1691
+ accessibilityDescription: info.accessibilityDescription,
1692
+ onClick: behavior.type === "none" ? void 0 : () => {
1693
+ void onBehavior(behavior);
1694
+ }
1695
+ };
1696
+ }
1697
+ return void 0;
1698
+ };
1699
+ var mapSchemaAlert = (alert) => {
1700
+ return alert ? {
1701
+ content: alert.markdown,
1702
+ context: alert.context ? mapLegacyContext(alert.context) : "neutral"
1703
+ } : void 0;
1704
+ };
1705
+
2014
1706
  // src/domain/mappers/layout/decisionLayoutToComponent.ts
2015
1707
  var decisionLayoutToComponent = (uid, {
2016
1708
  analyticsId,
@@ -2486,8 +2178,44 @@ var mapReviewField = (field, mapperProps) => {
2486
2178
  });
2487
2179
  };
2488
2180
 
2181
+ // src/domain/components/utils/debounce.ts
2182
+ var debounce = (callback, waitMs) => {
2183
+ let timeoutId = null;
2184
+ let lastArgs = null;
2185
+ const clearTimer = () => {
2186
+ if (timeoutId !== null) {
2187
+ clearTimeout(timeoutId);
2188
+ timeoutId = null;
2189
+ }
2190
+ lastArgs = null;
2191
+ };
2192
+ const debouncedFn = (...args) => {
2193
+ lastArgs = args;
2194
+ if (timeoutId !== null) {
2195
+ clearTimeout(timeoutId);
2196
+ }
2197
+ timeoutId = setTimeout(() => {
2198
+ callback(...lastArgs);
2199
+ timeoutId = null;
2200
+ lastArgs = null;
2201
+ }, waitMs);
2202
+ };
2203
+ debouncedFn.cancel = () => {
2204
+ if (timeoutId !== null) {
2205
+ clearTimer();
2206
+ }
2207
+ };
2208
+ debouncedFn.flush = () => {
2209
+ if (timeoutId !== null) {
2210
+ callback(...lastArgs);
2211
+ clearTimer();
2212
+ }
2213
+ };
2214
+ return debouncedFn;
2215
+ };
2216
+
2489
2217
  // src/domain/components/searchComponent/SearchComponent.ts
2490
- var DEBOUNCE_TIME2 = 400;
2218
+ var DEBOUNCE_TIME = 400;
2491
2219
  var createSearchComponent = (props, performSearch, onBehavior, onComponentUpdate) => {
2492
2220
  const { uid, analyticsId, control, emptyMessage, initialState, hint, margin, tags, title } = props;
2493
2221
  const update = getInputUpdateFunction(onComponentUpdate);
@@ -2517,7 +2245,7 @@ var createSearchComponent = (props, performSearch, onBehavior, onComponentUpdate
2517
2245
  }
2518
2246
  });
2519
2247
  };
2520
- const debouncedSearch = debounce(search, DEBOUNCE_TIME2);
2248
+ const debouncedSearch = debounce(search, DEBOUNCE_TIME);
2521
2249
  const component = {
2522
2250
  type: "search",
2523
2251
  kind: "layout",
@@ -2579,7 +2307,7 @@ var getPerformSearchFunction = (httpClient, mapLayoutToDomainComponent, defaultC
2579
2307
  if (requestHash !== latestSuccessfulRequestHash) {
2580
2308
  const { method, param, url } = config;
2581
2309
  const headers = { "Content-Type": "application/json" };
2582
- const response = await (method === "GET" ? httpClient(addQueryParameter2(url, param, query), {
2310
+ const response = await (method === "GET" ? httpClient(addQueryParameter(url, param, query), {
2583
2311
  method,
2584
2312
  headers,
2585
2313
  signal
@@ -2589,7 +2317,7 @@ var getPerformSearchFunction = (httpClient, mapLayoutToDomainComponent, defaultC
2589
2317
  signal,
2590
2318
  body: JSON.stringify({ [param]: query })
2591
2319
  }));
2592
- const results = await parseResponse2(response);
2320
+ const results = await parseResponse(response);
2593
2321
  latestSuccessfulRequestHash = requestHash;
2594
2322
  if (results.type === "layout") {
2595
2323
  const mappedLayoutResult = {
@@ -2605,7 +2333,7 @@ var getPerformSearchFunction = (httpClient, mapLayoutToDomainComponent, defaultC
2605
2333
  return latestSuccessfulResults;
2606
2334
  };
2607
2335
  };
2608
- var parseResponse2 = async (response) => {
2336
+ var parseResponse = async (response) => {
2609
2337
  if (response.ok) {
2610
2338
  const body = await response.json().catch(() => null);
2611
2339
  if (isValidResponseBody(body)) {
@@ -2622,7 +2350,7 @@ var parseResponse2 = async (response) => {
2622
2350
  }
2623
2351
  throw Error("error response");
2624
2352
  };
2625
- var addQueryParameter2 = (url, key, value) => {
2353
+ var addQueryParameter = (url, key, value) => {
2626
2354
  const [urlBase, urlQuery] = url.split("?");
2627
2355
  const urlQueryParams = new URLSearchParams(urlQuery);
2628
2356
  urlQueryParams.set(key, value);
@@ -2828,8 +2556,6 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
2828
2556
  return boxLayoutToComponent(uid, layout, mapperProps, schemaComponents);
2829
2557
  case "button":
2830
2558
  return buttonLayoutToComponent(uid, layout, mapperProps);
2831
- case "collection":
2832
- return collectionLayoutToComponent(uid, layout, mapperProps);
2833
2559
  case "columns":
2834
2560
  return columnsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
2835
2561
  case "decision":
@@ -8203,26 +7929,6 @@ var mapBoxControl = ({
8203
7929
  return control;
8204
7930
  };
8205
7931
 
8206
- // src/renderers/mappers/collectionComponentToProps.ts
8207
- var collectionComponentToProps = (component, rendererMapperProps) => {
8208
- var _a, _b, _c;
8209
- return __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags", "url", "method")), rendererMapperProps), {
8210
- status: component.status,
8211
- state: __spreadProps(__spreadValues({}, component.state), {
8212
- filters: (_a = component.state.filters) != null ? _a : [],
8213
- sections: component.state.sections.map((section) => __spreadProps(__spreadValues({}, section), {
8214
- callToAction: mapCallToActionOptional(section.callToAction),
8215
- items: section.items.map((item) => __spreadProps(__spreadValues({}, item), {
8216
- callToAction: mapCallToActionOptional(item.callToAction),
8217
- additionalInfo: mapAdditionalInfo2(item.additionalInfo)
8218
- }))
8219
- })),
8220
- beforeSections: (_b = component.state.beforeSections) == null ? void 0 : _b.map((child) => componentToRendererProps(child, rendererMapperProps)).map(rendererMapperProps.render),
8221
- afterSections: (_c = component.state.afterSections) == null ? void 0 : _c.map((child) => componentToRendererProps(child, rendererMapperProps)).map(rendererMapperProps.render)
8222
- })
8223
- });
8224
- };
8225
-
8226
7932
  // src/renderers/mappers/buttonComponentToProps.ts
8227
7933
  var buttonComponentToProps = (component, rendererMapperProps) => {
8228
7934
  return __spreadValues(__spreadProps(__spreadValues({
@@ -8852,8 +8558,6 @@ var getComponentProps = (component, rendererMapperProps) => {
8852
8558
  return boxComponentToProps(component, rendererMapperProps);
8853
8559
  case "button":
8854
8560
  return buttonComponentToProps(component, rendererMapperProps);
8855
- case "collection":
8856
- return collectionComponentToProps(component, rendererMapperProps);
8857
8561
  case "columns":
8858
8562
  return columnsComponentToProps(component, rendererMapperProps);
8859
8563
  case "container":