@wise/dynamic-flow-client 5.29.0-experimental-f7c2300 → 5.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.css +0 -24
- package/build/main.js +167 -299
- package/build/main.mjs +167 -299
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/domain/components/collectionComponent/CollectionComponent.d.ts +5 -5
- package/build/types/domain/components/collectionComponent/CollectionComponent.d.ts.map +1 -1
- package/build/types/domain/components/collectionComponent/types.d.ts +14 -42
- package/build/types/domain/components/collectionComponent/types.d.ts.map +1 -1
- package/build/types/domain/features/collection/getPerformCollectionQuery.d.ts +2 -2
- package/build/types/domain/features/collection/getPerformCollectionQuery.d.ts.map +1 -1
- package/build/types/domain/mappers/layout/collectionLayoutToComponent.d.ts +3 -3
- package/build/types/domain/mappers/layout/collectionLayoutToComponent.d.ts.map +1 -1
- package/build/types/renderers/mappers/collectionComponentToProps.d.ts.map +1 -1
- package/package.json +3 -3
- package/build/types/domain/components/collectionComponent/CollectionState.d.ts +0 -19
- package/build/types/domain/components/collectionComponent/CollectionState.d.ts.map +0 -1
- package/build/types/domain/components/collectionComponent/mergeSections.d.ts +0 -3
- package/build/types/domain/components/collectionComponent/mergeSections.d.ts.map +0 -1
package/build/main.mjs
CHANGED
|
@@ -830,7 +830,6 @@ function findRendererPropsByType(root, type, predicate = () => true) {
|
|
|
830
830
|
}
|
|
831
831
|
var isType = (node, type) => node.type === type;
|
|
832
832
|
var getChildren = (node) => {
|
|
833
|
-
var _a;
|
|
834
833
|
switch (node.type) {
|
|
835
834
|
case "root":
|
|
836
835
|
case "box":
|
|
@@ -852,16 +851,9 @@ var getChildren = (node) => {
|
|
|
852
851
|
return node.childrenProps ? [node.childrenProps] : [];
|
|
853
852
|
case "tabs":
|
|
854
853
|
return node.tabs.flatMap((c) => c.childrenProps);
|
|
855
|
-
case "collection": {
|
|
856
|
-
const { beforeSectionsProps, afterSectionsProps, sections, search } = node.state;
|
|
857
|
-
return [
|
|
858
|
-
...beforeSectionsProps,
|
|
859
|
-
...afterSectionsProps,
|
|
860
|
-
...[...sections, ...(_a = search == null ? void 0 : search.initialSections) != null ? _a : []].filter((section) => section.type === "layout").flatMap((section) => section.childrenProps)
|
|
861
|
-
];
|
|
862
|
-
}
|
|
863
854
|
case "alert":
|
|
864
855
|
case "button":
|
|
856
|
+
case "collection":
|
|
865
857
|
case "input-checkbox":
|
|
866
858
|
case "input-date":
|
|
867
859
|
case "decision":
|
|
@@ -1690,121 +1682,89 @@ function mergeArrays(valueA, valueB) {
|
|
|
1690
1682
|
);
|
|
1691
1683
|
}
|
|
1692
1684
|
|
|
1693
|
-
// src/domain/components/collectionComponent/
|
|
1694
|
-
var mergeSections = (existing, incoming) => {
|
|
1695
|
-
const knownIds = new Set(existing.map((section) => section.id));
|
|
1696
|
-
const newSections = incoming.filter((section) => !knownIds.has(section.id));
|
|
1697
|
-
const merged = existing.map((section) => {
|
|
1698
|
-
var _a, _b, _c, _d;
|
|
1699
|
-
const match = incoming.find((s) => s.id === section.id);
|
|
1700
|
-
if (!match) return section;
|
|
1701
|
-
if (section.type !== match.type) return section;
|
|
1702
|
-
const baseProps = {
|
|
1703
|
-
type: section.type,
|
|
1704
|
-
id: match.id,
|
|
1705
|
-
title: (_a = match.title) != null ? _a : section.title,
|
|
1706
|
-
callToAction: (_b = match.callToAction) != null ? _b : section.callToAction,
|
|
1707
|
-
help: (_c = match.help) != null ? _c : section.help,
|
|
1708
|
-
inlineAlert: (_d = match.inlineAlert) != null ? _d : section.inlineAlert
|
|
1709
|
-
};
|
|
1710
|
-
if (section.type === "layout" && match.type === "layout") {
|
|
1711
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
1712
|
-
type: "layout",
|
|
1713
|
-
components: [...section.components, ...match.components]
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
if (section.type === "items" && match.type === "items") {
|
|
1717
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
1718
|
-
type: "items",
|
|
1719
|
-
items: [...section.items, ...match.items]
|
|
1720
|
-
});
|
|
1721
|
-
}
|
|
1722
|
-
return section;
|
|
1723
|
-
});
|
|
1724
|
-
return [...merged, ...newSections];
|
|
1725
|
-
};
|
|
1726
|
-
|
|
1727
|
-
// src/domain/components/collectionComponent/CollectionState.ts
|
|
1685
|
+
// src/domain/components/collectionComponent/CollectionComponent.ts
|
|
1728
1686
|
var DEBOUNCE_TIME = 800;
|
|
1729
|
-
var
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
searchQuery,
|
|
1733
|
-
onComponentUpdate,
|
|
1734
|
-
queryFunction,
|
|
1735
|
-
trackEvent
|
|
1736
|
-
}) => {
|
|
1737
|
-
const _a = initialState, { search, filters } = _a, response = __objRest(_a, ["search", "filters"]);
|
|
1687
|
+
var createCollectionComponent = (props, onComponentUpdate, queryFunction, trackEvent) => {
|
|
1688
|
+
const { uid, analyticsId, control, margin, tags, state } = props;
|
|
1689
|
+
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1738
1690
|
let abortController = new AbortController();
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
};
|
|
1743
|
-
const getIdleStatus = (nextCursor) => ({
|
|
1744
|
-
type: "idle",
|
|
1745
|
-
loadMore: nextCursor ? () => query("pagination") : void 0
|
|
1746
|
-
});
|
|
1747
|
-
const query = (mode) => {
|
|
1748
|
-
var _a2, _b;
|
|
1691
|
+
const trackCollectionEvent = (source, status) => trackEvent(getEventName(source, status), component.state.analytics);
|
|
1692
|
+
const query = (mode, source) => {
|
|
1693
|
+
var _a, _b;
|
|
1749
1694
|
abortController.abort();
|
|
1750
1695
|
abortController = new AbortController();
|
|
1751
1696
|
const { signal } = abortController;
|
|
1752
|
-
|
|
1697
|
+
trackCollectionEvent(source != null ? source : mode, "Triggered");
|
|
1753
1698
|
queryFunction({
|
|
1754
|
-
searchParam: (
|
|
1755
|
-
query: (_b = state.search) == null ? void 0 : _b.query,
|
|
1756
|
-
cursor: mode === "pagination" ? state.nextCursor : void 0,
|
|
1699
|
+
searchParam: (_a = component.state.search) == null ? void 0 : _a.param,
|
|
1700
|
+
query: (_b = component.state.search) == null ? void 0 : _b.query,
|
|
1701
|
+
cursor: mode === "pagination" ? component.state.nextCursor : void 0,
|
|
1757
1702
|
signal,
|
|
1758
|
-
filters: state.filters
|
|
1759
|
-
}).then((
|
|
1760
|
-
if (!
|
|
1703
|
+
filters: component.state.filters
|
|
1704
|
+
}).then((response) => {
|
|
1705
|
+
if (!response) {
|
|
1761
1706
|
return;
|
|
1762
1707
|
}
|
|
1763
|
-
update((draft) =>
|
|
1764
|
-
|
|
1708
|
+
update(component, (draft) => {
|
|
1709
|
+
draft.state = mergeState(mode, component.state, response);
|
|
1710
|
+
draft.status = {
|
|
1711
|
+
type: "idle",
|
|
1712
|
+
loadMore: response.nextCursor ? paginate : void 0
|
|
1713
|
+
};
|
|
1714
|
+
});
|
|
1715
|
+
trackCollectionEvent(source != null ? source : mode, "Succeeded");
|
|
1765
1716
|
}).catch(() => {
|
|
1766
1717
|
if (!signal.aborted) {
|
|
1767
1718
|
const retry = () => {
|
|
1768
|
-
update((draft) => {
|
|
1719
|
+
update(component, (draft) => {
|
|
1769
1720
|
draft.status = { type: "loading", reason: mode };
|
|
1770
1721
|
});
|
|
1771
|
-
query(mode);
|
|
1722
|
+
query(mode, source);
|
|
1772
1723
|
};
|
|
1773
|
-
update((draft) => {
|
|
1774
|
-
if (mode === "search"
|
|
1775
|
-
draft.sections = [];
|
|
1724
|
+
update(component, (draft) => {
|
|
1725
|
+
if (mode === "search") {
|
|
1726
|
+
draft.state.sections = [];
|
|
1776
1727
|
}
|
|
1777
1728
|
draft.status = { type: "error", reason: mode, retry };
|
|
1778
1729
|
});
|
|
1779
|
-
|
|
1730
|
+
trackCollectionEvent(source != null ? source : mode, "Failed");
|
|
1780
1731
|
}
|
|
1781
1732
|
});
|
|
1782
1733
|
};
|
|
1783
1734
|
const debouncedQuery = debounce(query, DEBOUNCE_TIME);
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1735
|
+
const search = () => {
|
|
1736
|
+
abortController.abort();
|
|
1737
|
+
debouncedQuery("search");
|
|
1738
|
+
};
|
|
1739
|
+
const filter = () => {
|
|
1740
|
+
debouncedQuery("search", "filter");
|
|
1741
|
+
debouncedQuery.flush();
|
|
1742
|
+
};
|
|
1743
|
+
const paginate = () => query("pagination");
|
|
1744
|
+
const mergeState = (mode, original, incoming) => {
|
|
1745
|
+
var _a, _b;
|
|
1746
|
+
return {
|
|
1747
|
+
sections: mode === "pagination" ? mergeSections(original.sections, incoming.sections) : incoming.sections,
|
|
1748
|
+
nextCursor: incoming.nextCursor,
|
|
1749
|
+
filters: incoming.filters ? mapFilters(incoming.filters) : original.filters,
|
|
1750
|
+
search: incoming.search ? mapSearch(incoming.search) : original.search,
|
|
1751
|
+
beforeSections: (_a = incoming.beforeSections) != null ? _a : original.beforeSections,
|
|
1752
|
+
afterSections: (_b = incoming.afterSections) != null ? _b : original.afterSections,
|
|
1753
|
+
analytics: mode === "pagination" ? recursiveMerge(original.analytics, incoming.analytics) : incoming.analytics
|
|
1754
|
+
};
|
|
1794
1755
|
};
|
|
1795
1756
|
const selectFilter = (filterIndex, optionIndex) => {
|
|
1796
|
-
var
|
|
1797
|
-
const selected = (
|
|
1757
|
+
var _a;
|
|
1758
|
+
const selected = (_a = component.state.filters) == null ? void 0 : _a[filterIndex];
|
|
1798
1759
|
if (!selected) {
|
|
1799
1760
|
return;
|
|
1800
1761
|
}
|
|
1801
1762
|
const currentValue = selected.options[optionIndex].selected;
|
|
1802
|
-
update((draft) => {
|
|
1803
|
-
|
|
1804
|
-
const draftFilter = (_a3 = draft.filters) == null ? void 0 : _a3[filterIndex];
|
|
1805
|
-
if (!draftFilter) {
|
|
1763
|
+
update(component, (draft) => {
|
|
1764
|
+
if (!draft.state.filters) {
|
|
1806
1765
|
return;
|
|
1807
1766
|
}
|
|
1767
|
+
const draftFilter = draft.state.filters[filterIndex];
|
|
1808
1768
|
if (selected.multiSelect) {
|
|
1809
1769
|
draftFilter.options[optionIndex].selected = !currentValue;
|
|
1810
1770
|
} else {
|
|
@@ -1812,86 +1772,35 @@ var createCollectionState = ({
|
|
|
1812
1772
|
draftOption.selected = index === optionIndex ? !currentValue : false;
|
|
1813
1773
|
});
|
|
1814
1774
|
}
|
|
1815
|
-
draft.status = { type: "loading", reason: "
|
|
1775
|
+
draft.status = { type: "loading", reason: "search" };
|
|
1816
1776
|
});
|
|
1817
|
-
|
|
1818
|
-
debouncedQuery.flush();
|
|
1819
|
-
};
|
|
1820
|
-
const changeQuery = (value) => {
|
|
1821
|
-
update((draft) => {
|
|
1822
|
-
if (draft.search) {
|
|
1823
|
-
draft.search.query = value;
|
|
1824
|
-
draft.status = { type: "loading", reason: "search" };
|
|
1825
|
-
}
|
|
1826
|
-
});
|
|
1827
|
-
abortController.abort();
|
|
1828
|
-
debouncedQuery("search");
|
|
1777
|
+
filter();
|
|
1829
1778
|
};
|
|
1830
|
-
const mapFilters = (
|
|
1831
|
-
var
|
|
1779
|
+
const mapFilters = (filters) => filters == null ? void 0 : filters.map((f, filterIndex) => {
|
|
1780
|
+
var _a;
|
|
1832
1781
|
return __spreadProps(__spreadValues({}, f), {
|
|
1833
|
-
options: (
|
|
1834
|
-
var
|
|
1782
|
+
options: (_a = f.options) == null ? void 0 : _a.map((option, optionIndex) => {
|
|
1783
|
+
var _a2;
|
|
1835
1784
|
return __spreadProps(__spreadValues({}, option), {
|
|
1836
|
-
selected: (
|
|
1785
|
+
selected: (_a2 = option.selected) != null ? _a2 : false,
|
|
1837
1786
|
onSelect: () => selectFilter(filterIndex, optionIndex)
|
|
1838
1787
|
});
|
|
1839
1788
|
})
|
|
1840
1789
|
});
|
|
1841
1790
|
});
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
id: forkedId,
|
|
1852
|
-
initialState: state,
|
|
1853
|
-
searchQuery: (_b = (_a2 = state.search) == null ? void 0 : _a2.query) != null ? _b : "",
|
|
1854
|
-
onComponentUpdate,
|
|
1855
|
-
queryFunction,
|
|
1856
|
-
trackEvent
|
|
1791
|
+
const mapSearch = (searchConfig) => searchConfig ? __spreadProps(__spreadValues({
|
|
1792
|
+
query: ""
|
|
1793
|
+
}, searchConfig), {
|
|
1794
|
+
onChange(value) {
|
|
1795
|
+
update(component, (draft) => {
|
|
1796
|
+
if (draft.state.search) {
|
|
1797
|
+
draft.state.search.query = value;
|
|
1798
|
+
draft.status = { type: "loading", reason: "search" };
|
|
1799
|
+
}
|
|
1857
1800
|
});
|
|
1858
|
-
|
|
1859
|
-
cancel() {
|
|
1860
|
-
debouncedQuery.cancel();
|
|
1861
|
-
abortController.abort();
|
|
1862
|
-
},
|
|
1863
|
-
getChildren() {
|
|
1864
|
-
var _a2, _b, _c, _d;
|
|
1865
|
-
return [
|
|
1866
|
-
...(_a2 = state.beforeSections) != null ? _a2 : [],
|
|
1867
|
-
...getSectionsChildren(state.sections),
|
|
1868
|
-
...getSectionsChildren((_c = (_b = state.search) == null ? void 0 : _b.initialSections) != null ? _c : []),
|
|
1869
|
-
...(_d = state.afterSections) != null ? _d : []
|
|
1870
|
-
];
|
|
1871
|
-
}
|
|
1872
|
-
});
|
|
1873
|
-
return state;
|
|
1874
|
-
};
|
|
1875
|
-
var getSectionsChildren = (sections) => sections.filter((section) => section.type === "layout").flatMap((section) => section.components);
|
|
1876
|
-
var getEventName = (mode, state) => {
|
|
1877
|
-
const getMode = () => {
|
|
1878
|
-
switch (mode) {
|
|
1879
|
-
case "pagination":
|
|
1880
|
-
return "Pagination";
|
|
1881
|
-
case "search":
|
|
1882
|
-
return "Search";
|
|
1883
|
-
case "filter":
|
|
1884
|
-
return "Filter";
|
|
1801
|
+
search();
|
|
1885
1802
|
}
|
|
1886
|
-
};
|
|
1887
|
-
return `Collection ${getMode()} ${state}`;
|
|
1888
|
-
};
|
|
1889
|
-
|
|
1890
|
-
// src/domain/components/collectionComponent/CollectionComponent.ts
|
|
1891
|
-
var createCollectionComponent = (props, onComponentUpdate, queryFunction, trackEvent) => {
|
|
1892
|
-
const { uid, analyticsId, control, margin, tags, state } = props;
|
|
1893
|
-
const update = getInputUpdateFunction(onComponentUpdate);
|
|
1894
|
-
let forkCount = 0;
|
|
1803
|
+
}) : void 0;
|
|
1895
1804
|
const component = {
|
|
1896
1805
|
type: "collection",
|
|
1897
1806
|
kind: "layout",
|
|
@@ -1900,38 +1809,21 @@ var createCollectionComponent = (props, onComponentUpdate, queryFunction, trackE
|
|
|
1900
1809
|
control,
|
|
1901
1810
|
margin,
|
|
1902
1811
|
tags,
|
|
1903
|
-
stack: [
|
|
1904
|
-
createCollectionState({
|
|
1905
|
-
id: `${uid}-state-0`,
|
|
1906
|
-
initialState: state,
|
|
1907
|
-
searchQuery: "",
|
|
1908
|
-
onComponentUpdate,
|
|
1909
|
-
queryFunction,
|
|
1910
|
-
trackEvent
|
|
1911
|
-
})
|
|
1912
|
-
],
|
|
1913
|
-
fork() {
|
|
1914
|
-
const { stack } = component;
|
|
1915
|
-
forkCount += 1;
|
|
1916
|
-
const forkedState = stack[stack.length - 1].fork(`${uid}-state-${forkCount}`);
|
|
1917
|
-
update(component, (draft) => {
|
|
1918
|
-
draft.stack = [...draft.stack, forkedState];
|
|
1919
|
-
});
|
|
1920
|
-
},
|
|
1921
|
-
pop() {
|
|
1922
|
-
const [rootState, ...forkedStates] = component.stack;
|
|
1923
|
-
const poppedState = forkedStates.at(-1);
|
|
1924
|
-
if (!poppedState) {
|
|
1925
|
-
return;
|
|
1926
|
-
}
|
|
1927
|
-
poppedState.cancel();
|
|
1928
|
-
update(component, (draft) => {
|
|
1929
|
-
draft.stack = [rootState, ...forkedStates.slice(0, -1)];
|
|
1930
|
-
});
|
|
1931
|
-
},
|
|
1932
1812
|
getChildren() {
|
|
1933
|
-
|
|
1813
|
+
var _a, _b, _c, _d;
|
|
1814
|
+
return [
|
|
1815
|
+
...(_b = (_a = component.state) == null ? void 0 : _a.beforeSections) != null ? _b : [],
|
|
1816
|
+
...(_d = (_c = component.state) == null ? void 0 : _c.afterSections) != null ? _d : []
|
|
1817
|
+
];
|
|
1818
|
+
},
|
|
1819
|
+
status: {
|
|
1820
|
+
type: "idle",
|
|
1821
|
+
loadMore: state.nextCursor ? () => query("pagination") : void 0
|
|
1934
1822
|
},
|
|
1823
|
+
state: __spreadProps(__spreadValues({}, state), {
|
|
1824
|
+
filters: mapFilters(state.filters),
|
|
1825
|
+
search: mapSearch(props.search)
|
|
1826
|
+
}),
|
|
1935
1827
|
start() {
|
|
1936
1828
|
component.getChildren().forEach((child) => child.start());
|
|
1937
1829
|
},
|
|
@@ -1941,6 +1833,37 @@ var createCollectionComponent = (props, onComponentUpdate, queryFunction, trackE
|
|
|
1941
1833
|
};
|
|
1942
1834
|
return component;
|
|
1943
1835
|
};
|
|
1836
|
+
var mergeSections = (existing, incoming) => {
|
|
1837
|
+
const knownIds = new Set(existing.map((section) => section.id));
|
|
1838
|
+
const newSections = incoming.filter((section) => !knownIds.has(section.id));
|
|
1839
|
+
const merged = existing.map((section) => {
|
|
1840
|
+
var _a, _b, _c, _d;
|
|
1841
|
+
const match = incoming.find((s) => s.id === section.id);
|
|
1842
|
+
if (!match) return section;
|
|
1843
|
+
return {
|
|
1844
|
+
id: match.id,
|
|
1845
|
+
title: (_a = match.title) != null ? _a : section.title,
|
|
1846
|
+
callToAction: (_b = match.callToAction) != null ? _b : section.callToAction,
|
|
1847
|
+
help: (_c = match.help) != null ? _c : section.help,
|
|
1848
|
+
inlineAlert: (_d = match.inlineAlert) != null ? _d : section.inlineAlert,
|
|
1849
|
+
items: [...section.items, ...match.items]
|
|
1850
|
+
};
|
|
1851
|
+
});
|
|
1852
|
+
return [...merged, ...newSections];
|
|
1853
|
+
};
|
|
1854
|
+
var getEventName = (mode, state) => {
|
|
1855
|
+
const getMode = () => {
|
|
1856
|
+
switch (mode) {
|
|
1857
|
+
case "pagination":
|
|
1858
|
+
return "Pagination";
|
|
1859
|
+
case "search":
|
|
1860
|
+
return "Search";
|
|
1861
|
+
case "filter":
|
|
1862
|
+
return "Filter";
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
return `Collection ${getMode()} ${state}`;
|
|
1866
|
+
};
|
|
1944
1867
|
|
|
1945
1868
|
// src/domain/features/collection/getPerformCollectionQuery.ts
|
|
1946
1869
|
var getPerformCollectionQuery = (httpClient, baseRequest, mapState) => {
|
|
@@ -2033,19 +1956,9 @@ var hashRequest = ({
|
|
|
2033
1956
|
}) => JSON.stringify({ query, cursor, filters: getFilterValues(filters != null ? filters : []) });
|
|
2034
1957
|
|
|
2035
1958
|
// src/domain/mappers/layout/collectionLayoutToComponent.ts
|
|
2036
|
-
var collectionLayoutToComponent = (uid, { analyticsId, control, initialState, margin, search, tags, baseRequest }, mapperProps
|
|
2037
|
-
var _a;
|
|
1959
|
+
var collectionLayoutToComponent = (uid, { analyticsId, control, initialState, margin, search, tags, baseRequest }, mapperProps) => {
|
|
2038
1960
|
const { httpClient, onComponentUpdate, trackEvent } = mapperProps;
|
|
2039
|
-
|
|
2040
|
-
const mapLayout = (layout) => {
|
|
2041
|
-
layoutIndex += 1;
|
|
2042
|
-
return mapLayoutToComponent(
|
|
2043
|
-
`${uid}-collection-response-${layoutIndex}`,
|
|
2044
|
-
layout,
|
|
2045
|
-
mapperProps,
|
|
2046
|
-
schemaComponents
|
|
2047
|
-
);
|
|
2048
|
-
};
|
|
1961
|
+
const mapLayout = (layout, index) => mapLayoutToComponent(`${uid}-collection-response-${index}`, layout, mapperProps, []);
|
|
2049
1962
|
const mapState = (state) => mapCollectionSpecToDomainState(state, mapperProps, mapLayout);
|
|
2050
1963
|
const queryFunction = getPerformCollectionQuery(httpClient, baseRequest, mapState);
|
|
2051
1964
|
const component = createCollectionComponent(
|
|
@@ -2055,9 +1968,8 @@ var collectionLayoutToComponent = (uid, { analyticsId, control, initialState, ma
|
|
|
2055
1968
|
control,
|
|
2056
1969
|
margin: margin != null ? margin : "md",
|
|
2057
1970
|
tags,
|
|
2058
|
-
state: mapState(
|
|
2059
|
-
|
|
2060
|
-
}))
|
|
1971
|
+
state: mapState(initialState),
|
|
1972
|
+
search
|
|
2061
1973
|
},
|
|
2062
1974
|
onComponentUpdate,
|
|
2063
1975
|
queryFunction,
|
|
@@ -2067,7 +1979,6 @@ var collectionLayoutToComponent = (uid, { analyticsId, control, initialState, ma
|
|
|
2067
1979
|
};
|
|
2068
1980
|
var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
2069
1981
|
const {
|
|
2070
|
-
search,
|
|
2071
1982
|
sections,
|
|
2072
1983
|
filters,
|
|
2073
1984
|
beforeSections,
|
|
@@ -2076,8 +1987,29 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
2076
1987
|
analytics = {}
|
|
2077
1988
|
} = specState;
|
|
2078
1989
|
return {
|
|
2079
|
-
|
|
2080
|
-
|
|
1990
|
+
sections: sections.map((section) => {
|
|
1991
|
+
var _a;
|
|
1992
|
+
return __spreadProps(__spreadValues({}, section), {
|
|
1993
|
+
callToAction: getDomainLayerCallToAction(section.callToAction, mapperProps),
|
|
1994
|
+
help: (_a = section.help) == null ? void 0 : _a.markdown,
|
|
1995
|
+
inlineAlert: mapInlineAlert(section.inlineAlert),
|
|
1996
|
+
items: section.items.map((item) => {
|
|
1997
|
+
const behavior = getDomainLayerBehavior(
|
|
1998
|
+
{ behavior: item.primaryBehavior },
|
|
1999
|
+
[],
|
|
2000
|
+
mapperProps.registerSubmissionBehavior
|
|
2001
|
+
);
|
|
2002
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
2003
|
+
id: item.entityId,
|
|
2004
|
+
onClick: item.primaryBehavior ? () => {
|
|
2005
|
+
void mapperProps.onBehavior(behavior);
|
|
2006
|
+
} : void 0,
|
|
2007
|
+
callToAction: getDomainLayerCallToAction(item.callToAction, mapperProps),
|
|
2008
|
+
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
2009
|
+
});
|
|
2010
|
+
})
|
|
2011
|
+
});
|
|
2012
|
+
}),
|
|
2081
2013
|
filters: filters == null ? void 0 : filters.map(mapFilter),
|
|
2082
2014
|
beforeSections: beforeSections == null ? void 0 : beforeSections.map(mapLayout),
|
|
2083
2015
|
afterSections: afterSections == null ? void 0 : afterSections.map(mapLayout),
|
|
@@ -2085,49 +2017,6 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
2085
2017
|
analytics
|
|
2086
2018
|
};
|
|
2087
2019
|
};
|
|
2088
|
-
var mapSearch = (search, mapperProps, mapLayout) => {
|
|
2089
|
-
var _a, _b, _c;
|
|
2090
|
-
return search ? __spreadProps(__spreadValues({}, search), {
|
|
2091
|
-
help: (_a = search.help) == null ? void 0 : _a.markdown,
|
|
2092
|
-
hints: (_b = search.hints) != null ? _b : search.hint ? [search.hint] : void 0,
|
|
2093
|
-
initialSections: (_c = search.initialSections) == null ? void 0 : _c.map(
|
|
2094
|
-
(section) => mapSection(section, mapperProps, mapLayout)
|
|
2095
|
-
)
|
|
2096
|
-
}) : void 0;
|
|
2097
|
-
};
|
|
2098
|
-
var mapSection = (section, mapperProps, mapLayout) => {
|
|
2099
|
-
var _a;
|
|
2100
|
-
const baseProps = __spreadProps(__spreadValues({}, section), {
|
|
2101
|
-
callToAction: getDomainLayerCallToAction(section.callToAction, mapperProps),
|
|
2102
|
-
help: (_a = section.help) == null ? void 0 : _a.markdown,
|
|
2103
|
-
inlineAlert: mapInlineAlert(section.inlineAlert)
|
|
2104
|
-
});
|
|
2105
|
-
if (section.type === "layout") {
|
|
2106
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2107
|
-
type: "layout",
|
|
2108
|
-
components: section.components.map(mapLayout)
|
|
2109
|
-
});
|
|
2110
|
-
}
|
|
2111
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
2112
|
-
type: "items",
|
|
2113
|
-
items: section.items.map((item) => mapResultItem(item, mapperProps))
|
|
2114
|
-
});
|
|
2115
|
-
};
|
|
2116
|
-
var mapResultItem = (item, mapperProps) => {
|
|
2117
|
-
const behavior = getDomainLayerBehavior(
|
|
2118
|
-
{ behavior: item.primaryBehavior },
|
|
2119
|
-
[],
|
|
2120
|
-
mapperProps.registerSubmissionBehavior
|
|
2121
|
-
);
|
|
2122
|
-
return __spreadProps(__spreadValues({}, item), {
|
|
2123
|
-
id: item.entityId,
|
|
2124
|
-
onClick: item.primaryBehavior ? () => {
|
|
2125
|
-
void mapperProps.onBehavior(behavior);
|
|
2126
|
-
} : void 0,
|
|
2127
|
-
callToAction: getDomainLayerCallToAction(item.callToAction, mapperProps),
|
|
2128
|
-
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
2129
|
-
});
|
|
2130
|
-
};
|
|
2131
2020
|
var mapFilter = (filter) => {
|
|
2132
2021
|
const anySelected = filter.options.some((option) => option.selected);
|
|
2133
2022
|
return __spreadProps(__spreadValues({}, filter), {
|
|
@@ -3392,7 +3281,7 @@ var mapLayoutToComponent = (uid, layout, mapperProps, schemaComponents) => {
|
|
|
3392
3281
|
case "button":
|
|
3393
3282
|
return buttonLayoutToComponent(uid, layout, mapperProps);
|
|
3394
3283
|
case "collection":
|
|
3395
|
-
return collectionLayoutToComponent(uid, layout, mapperProps
|
|
3284
|
+
return collectionLayoutToComponent(uid, layout, mapperProps);
|
|
3396
3285
|
case "columns":
|
|
3397
3286
|
return columnsLayoutToComponent(uid, layout, mapperProps, schemaComponents);
|
|
3398
3287
|
case "decision":
|
|
@@ -9053,52 +8942,31 @@ var mapBoxControl = ({
|
|
|
9053
8942
|
|
|
9054
8943
|
// src/renderers/mappers/collectionComponentToProps.ts
|
|
9055
8944
|
var collectionComponentToProps = (component, rendererMapperProps) => {
|
|
9056
|
-
const { stack } = component;
|
|
9057
|
-
return __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags", "fork", "pop")), rendererMapperProps), {
|
|
9058
|
-
state: mapCollectionState(stack[stack.length - 1], rendererMapperProps),
|
|
9059
|
-
depth: stack.length - 1
|
|
9060
|
-
});
|
|
9061
|
-
};
|
|
9062
|
-
var mapCollectionState = (state, rendererMapperProps) => {
|
|
9063
8945
|
var _a, _b, _c, _d, _e;
|
|
9064
8946
|
const { render } = rendererMapperProps;
|
|
9065
|
-
const
|
|
9066
|
-
|
|
9067
|
-
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9075
|
-
|
|
9076
|
-
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
);
|
|
9089
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
9090
|
-
type: "layout",
|
|
9091
|
-
childrenProps,
|
|
9092
|
-
children: childrenProps.map(rendererMapperProps.render)
|
|
9093
|
-
});
|
|
9094
|
-
}
|
|
9095
|
-
return __spreadProps(__spreadValues({}, baseProps), {
|
|
9096
|
-
type: "items",
|
|
9097
|
-
items: section.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
9098
|
-
callToAction: mapCallToActionOptional(item.callToAction),
|
|
9099
|
-
additionalInfo: mapAdditionalInfo2(item.additionalInfo),
|
|
9100
|
-
disabled: rendererMapperProps.stepLoadingState !== "idle" || item.disabled
|
|
9101
|
-
}))
|
|
8947
|
+
const beforeSectionsProps = (_b = (_a = component.state.beforeSections) == null ? void 0 : _a.map(
|
|
8948
|
+
(child) => componentToRendererProps(child, rendererMapperProps)
|
|
8949
|
+
)) != null ? _b : [];
|
|
8950
|
+
const afterSectionsProps = (_d = (_c = component.state.afterSections) == null ? void 0 : _c.map(
|
|
8951
|
+
(child) => componentToRendererProps(child, rendererMapperProps)
|
|
8952
|
+
)) != null ? _d : [];
|
|
8953
|
+
return __spreadProps(__spreadValues(__spreadValues({}, pick(component, "uid", "analyticsId", "type", "control", "margin", "tags")), rendererMapperProps), {
|
|
8954
|
+
status: component.status,
|
|
8955
|
+
state: __spreadProps(__spreadValues({}, component.state), {
|
|
8956
|
+
filters: (_e = component.state.filters) != null ? _e : [],
|
|
8957
|
+
sections: component.state.sections.map((section) => __spreadProps(__spreadValues({}, section), {
|
|
8958
|
+
callToAction: mapCallToActionOptional(section.callToAction),
|
|
8959
|
+
items: section.items.map((item) => __spreadProps(__spreadValues({}, item), {
|
|
8960
|
+
callToAction: mapCallToActionOptional(item.callToAction),
|
|
8961
|
+
additionalInfo: mapAdditionalInfo2(item.additionalInfo),
|
|
8962
|
+
disabled: rendererMapperProps.stepLoadingState !== "idle" || item.disabled
|
|
8963
|
+
}))
|
|
8964
|
+
})),
|
|
8965
|
+
beforeSectionsProps,
|
|
8966
|
+
beforeSections: beforeSectionsProps.map(render),
|
|
8967
|
+
afterSectionsProps,
|
|
8968
|
+
afterSections: afterSectionsProps.map(render)
|
|
8969
|
+
})
|
|
9102
8970
|
});
|
|
9103
8971
|
};
|
|
9104
8972
|
|