@wise/dynamic-flow-client 5.22.1 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/main.js +68 -48
- package/build/main.mjs +68 -48
- package/build/tsconfig.types.tsbuildinfo +1 -1
- package/build/types/domain/components/collectionComponent/CollectionComponent.d.ts.map +1 -1
- package/build/types/domain/components/collectionComponent/types.d.ts +2 -0
- package/build/types/domain/components/collectionComponent/types.d.ts.map +1 -1
- package/build/types/domain/mappers/layout/collectionLayoutToComponent.d.ts.map +1 -1
- package/build/types/domain/mappers/utils/utils.d.ts.map +1 -1
- package/build/types/domain/types.d.ts +1 -0
- package/build/types/domain/types.d.ts.map +1 -1
- package/package.json +4 -4
package/build/main.js
CHANGED
|
@@ -1545,11 +1545,36 @@ var boxLayoutToComponent = (uid, { border = false, components, control, margin,
|
|
|
1545
1545
|
)
|
|
1546
1546
|
});
|
|
1547
1547
|
|
|
1548
|
+
// src/domain/mappers/utils/image.ts
|
|
1549
|
+
var mapSpecImage = (image) => {
|
|
1550
|
+
var _a, _b, _c;
|
|
1551
|
+
return image ? {
|
|
1552
|
+
uri: (_b = (_a = image.uri) != null ? _a : image.url) != null ? _b : "",
|
|
1553
|
+
accessibilityDescription: (_c = image.accessibilityDescription) != null ? _c : image.text
|
|
1554
|
+
} : void 0;
|
|
1555
|
+
};
|
|
1556
|
+
|
|
1557
|
+
// src/domain/mappers/utils/media-utils.ts
|
|
1558
|
+
var getDomainLayerMedia = ({ icon, image, media }) => {
|
|
1559
|
+
if (media) {
|
|
1560
|
+
return media;
|
|
1561
|
+
}
|
|
1562
|
+
if (icon || image) {
|
|
1563
|
+
return {
|
|
1564
|
+
type: "legacy",
|
|
1565
|
+
icon,
|
|
1566
|
+
image: mapSpecImage(image)
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
return void 0;
|
|
1570
|
+
};
|
|
1571
|
+
|
|
1548
1572
|
// src/domain/mappers/utils/utils.ts
|
|
1549
1573
|
var mapInlineAlert = (alert) => {
|
|
1550
1574
|
return alert ? {
|
|
1551
1575
|
content: alert.content,
|
|
1552
|
-
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
1576
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral",
|
|
1577
|
+
media: getDomainLayerMedia({ media: alert.media })
|
|
1553
1578
|
} : void 0;
|
|
1554
1579
|
};
|
|
1555
1580
|
var mapAdditionalInfo = (info, mapperProps) => {
|
|
@@ -1576,7 +1601,8 @@ var mapAdditionalInfo = (info, mapperProps) => {
|
|
|
1576
1601
|
var mapSchemaAlert = (alert) => {
|
|
1577
1602
|
return alert ? {
|
|
1578
1603
|
content: alert.markdown,
|
|
1579
|
-
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
1604
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral",
|
|
1605
|
+
media: getDomainLayerMedia({ media: alert.media })
|
|
1580
1606
|
} : void 0;
|
|
1581
1607
|
};
|
|
1582
1608
|
|
|
@@ -1654,13 +1680,17 @@ var createCollectionComponent = (props, onComponentUpdate, queryFunction) => {
|
|
|
1654
1680
|
});
|
|
1655
1681
|
}).catch(() => {
|
|
1656
1682
|
if (!signal.aborted) {
|
|
1683
|
+
const retry = () => {
|
|
1684
|
+
update(component, (draft) => {
|
|
1685
|
+
draft.status = { type: "loading", reason: mode };
|
|
1686
|
+
});
|
|
1687
|
+
query(mode);
|
|
1688
|
+
};
|
|
1657
1689
|
update(component, (draft) => {
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
};
|
|
1663
|
-
draft.status = { type: "error", reason: mode, retry: () => query(mode) };
|
|
1690
|
+
if (mode === "search") {
|
|
1691
|
+
draft.state.sections = [];
|
|
1692
|
+
}
|
|
1693
|
+
draft.status = { type: "error", reason: mode, retry };
|
|
1664
1694
|
});
|
|
1665
1695
|
}
|
|
1666
1696
|
});
|
|
@@ -1746,9 +1776,17 @@ var mergeSections = (existing, incoming) => {
|
|
|
1746
1776
|
const knownIds = new Set(existing.map((section) => section.id));
|
|
1747
1777
|
const newSections = incoming.filter((section) => !knownIds.has(section.id));
|
|
1748
1778
|
const merged = existing.map((section) => {
|
|
1779
|
+
var _a, _b, _c, _d;
|
|
1749
1780
|
const match = incoming.find((s) => s.id === section.id);
|
|
1750
1781
|
if (!match) return section;
|
|
1751
|
-
return
|
|
1782
|
+
return {
|
|
1783
|
+
id: match.id,
|
|
1784
|
+
title: (_a = match.title) != null ? _a : section.title,
|
|
1785
|
+
callToAction: (_b = match.callToAction) != null ? _b : section.callToAction,
|
|
1786
|
+
help: (_c = match.help) != null ? _c : section.help,
|
|
1787
|
+
inlineAlert: (_d = match.inlineAlert) != null ? _d : section.inlineAlert,
|
|
1788
|
+
items: [...section.items, ...match.items]
|
|
1789
|
+
};
|
|
1752
1790
|
});
|
|
1753
1791
|
return [...merged, ...newSections];
|
|
1754
1792
|
};
|
|
@@ -1868,10 +1906,11 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
1868
1906
|
var _a, _b, _c;
|
|
1869
1907
|
return {
|
|
1870
1908
|
sections: specState.sections.map((section) => {
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
title: section.title,
|
|
1909
|
+
var _a2;
|
|
1910
|
+
return __spreadProps(__spreadValues({}, section), {
|
|
1874
1911
|
callToAction: getDomainLayerCallToAction(section.callToAction, mapperProps),
|
|
1912
|
+
help: (_a2 = section.help) == null ? void 0 : _a2.markdown,
|
|
1913
|
+
inlineAlert: mapInlineAlert(section.inlineAlert),
|
|
1875
1914
|
items: section.items.map((item) => {
|
|
1876
1915
|
const behavior = getDomainLayerBehavior(
|
|
1877
1916
|
{ behavior: item.primaryBehavior },
|
|
@@ -1887,24 +1926,29 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
1887
1926
|
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
1888
1927
|
});
|
|
1889
1928
|
})
|
|
1890
|
-
};
|
|
1929
|
+
});
|
|
1891
1930
|
}),
|
|
1892
|
-
filters: (_a = specState.filters) == null ? void 0 : _a.map(
|
|
1893
|
-
options: filter.options.map((option) => {
|
|
1894
|
-
var _a2;
|
|
1895
|
-
return __spreadProps(__spreadValues({}, option), {
|
|
1896
|
-
selected: (_a2 = option.selected) != null ? _a2 : false,
|
|
1897
|
-
onSelect: () => {
|
|
1898
|
-
}
|
|
1899
|
-
// noop - this gets added during mapping
|
|
1900
|
-
});
|
|
1901
|
-
})
|
|
1902
|
-
})),
|
|
1931
|
+
filters: (_a = specState.filters) == null ? void 0 : _a.map(mapFilter),
|
|
1903
1932
|
beforeSections: (_b = specState.beforeSections) == null ? void 0 : _b.map(mapLayout),
|
|
1904
1933
|
afterSections: (_c = specState.afterSections) == null ? void 0 : _c.map(mapLayout),
|
|
1905
1934
|
nextCursor: specState.nextCursor
|
|
1906
1935
|
};
|
|
1907
1936
|
};
|
|
1937
|
+
var mapFilter = (filter) => {
|
|
1938
|
+
const anySelected = filter.options.some((option) => option.selected);
|
|
1939
|
+
return __spreadProps(__spreadValues({}, filter), {
|
|
1940
|
+
options: filter.options.map((option, index) => {
|
|
1941
|
+
var _a;
|
|
1942
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
1943
|
+
// if a single select with no selection, we should default to selecting the first item
|
|
1944
|
+
selected: filter.multiSelect || anySelected ? (_a = option.selected) != null ? _a : false : index === 0,
|
|
1945
|
+
onSelect: () => {
|
|
1946
|
+
}
|
|
1947
|
+
// noop - this gets added during mapping in the component itself
|
|
1948
|
+
});
|
|
1949
|
+
})
|
|
1950
|
+
});
|
|
1951
|
+
};
|
|
1908
1952
|
|
|
1909
1953
|
// src/domain/components/ButtonComponent.ts
|
|
1910
1954
|
var createButtonComponent = (props) => __spreadValues({
|
|
@@ -1912,30 +1956,6 @@ var createButtonComponent = (props) => __spreadValues({
|
|
|
1912
1956
|
kind: "layout"
|
|
1913
1957
|
}, props);
|
|
1914
1958
|
|
|
1915
|
-
// src/domain/mappers/utils/image.ts
|
|
1916
|
-
var mapSpecImage = (image) => {
|
|
1917
|
-
var _a, _b, _c;
|
|
1918
|
-
return image ? {
|
|
1919
|
-
uri: (_b = (_a = image.uri) != null ? _a : image.url) != null ? _b : "",
|
|
1920
|
-
accessibilityDescription: (_c = image.accessibilityDescription) != null ? _c : image.text
|
|
1921
|
-
} : void 0;
|
|
1922
|
-
};
|
|
1923
|
-
|
|
1924
|
-
// src/domain/mappers/utils/media-utils.ts
|
|
1925
|
-
var getDomainLayerMedia = ({ icon, image, media }) => {
|
|
1926
|
-
if (media) {
|
|
1927
|
-
return media;
|
|
1928
|
-
}
|
|
1929
|
-
if (icon || image) {
|
|
1930
|
-
return {
|
|
1931
|
-
type: "legacy",
|
|
1932
|
-
icon,
|
|
1933
|
-
image: mapSpecImage(image)
|
|
1934
|
-
};
|
|
1935
|
-
}
|
|
1936
|
-
return void 0;
|
|
1937
|
-
};
|
|
1938
|
-
|
|
1939
1959
|
// src/domain/mappers/layout/buttonLayoutToComponent.ts
|
|
1940
1960
|
var buttonLayoutToComponent = (uid, button, mapperProps) => {
|
|
1941
1961
|
if (!button.behavior && !button.action && mapperProps.features.isEnabled("strictButtonOperations")) {
|
package/build/main.mjs
CHANGED
|
@@ -1514,11 +1514,36 @@ var boxLayoutToComponent = (uid, { border = false, components, control, margin,
|
|
|
1514
1514
|
)
|
|
1515
1515
|
});
|
|
1516
1516
|
|
|
1517
|
+
// src/domain/mappers/utils/image.ts
|
|
1518
|
+
var mapSpecImage = (image) => {
|
|
1519
|
+
var _a, _b, _c;
|
|
1520
|
+
return image ? {
|
|
1521
|
+
uri: (_b = (_a = image.uri) != null ? _a : image.url) != null ? _b : "",
|
|
1522
|
+
accessibilityDescription: (_c = image.accessibilityDescription) != null ? _c : image.text
|
|
1523
|
+
} : void 0;
|
|
1524
|
+
};
|
|
1525
|
+
|
|
1526
|
+
// src/domain/mappers/utils/media-utils.ts
|
|
1527
|
+
var getDomainLayerMedia = ({ icon, image, media }) => {
|
|
1528
|
+
if (media) {
|
|
1529
|
+
return media;
|
|
1530
|
+
}
|
|
1531
|
+
if (icon || image) {
|
|
1532
|
+
return {
|
|
1533
|
+
type: "legacy",
|
|
1534
|
+
icon,
|
|
1535
|
+
image: mapSpecImage(image)
|
|
1536
|
+
};
|
|
1537
|
+
}
|
|
1538
|
+
return void 0;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1517
1541
|
// src/domain/mappers/utils/utils.ts
|
|
1518
1542
|
var mapInlineAlert = (alert) => {
|
|
1519
1543
|
return alert ? {
|
|
1520
1544
|
content: alert.content,
|
|
1521
|
-
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
1545
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral",
|
|
1546
|
+
media: getDomainLayerMedia({ media: alert.media })
|
|
1522
1547
|
} : void 0;
|
|
1523
1548
|
};
|
|
1524
1549
|
var mapAdditionalInfo = (info, mapperProps) => {
|
|
@@ -1545,7 +1570,8 @@ var mapAdditionalInfo = (info, mapperProps) => {
|
|
|
1545
1570
|
var mapSchemaAlert = (alert) => {
|
|
1546
1571
|
return alert ? {
|
|
1547
1572
|
content: alert.markdown,
|
|
1548
|
-
context: alert.context ? mapLegacyContext(alert.context) : "neutral"
|
|
1573
|
+
context: alert.context ? mapLegacyContext(alert.context) : "neutral",
|
|
1574
|
+
media: getDomainLayerMedia({ media: alert.media })
|
|
1549
1575
|
} : void 0;
|
|
1550
1576
|
};
|
|
1551
1577
|
|
|
@@ -1623,13 +1649,17 @@ var createCollectionComponent = (props, onComponentUpdate, queryFunction) => {
|
|
|
1623
1649
|
});
|
|
1624
1650
|
}).catch(() => {
|
|
1625
1651
|
if (!signal.aborted) {
|
|
1652
|
+
const retry = () => {
|
|
1653
|
+
update(component, (draft) => {
|
|
1654
|
+
draft.status = { type: "loading", reason: mode };
|
|
1655
|
+
});
|
|
1656
|
+
query(mode);
|
|
1657
|
+
};
|
|
1626
1658
|
update(component, (draft) => {
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
};
|
|
1632
|
-
draft.status = { type: "error", reason: mode, retry: () => query(mode) };
|
|
1659
|
+
if (mode === "search") {
|
|
1660
|
+
draft.state.sections = [];
|
|
1661
|
+
}
|
|
1662
|
+
draft.status = { type: "error", reason: mode, retry };
|
|
1633
1663
|
});
|
|
1634
1664
|
}
|
|
1635
1665
|
});
|
|
@@ -1715,9 +1745,17 @@ var mergeSections = (existing, incoming) => {
|
|
|
1715
1745
|
const knownIds = new Set(existing.map((section) => section.id));
|
|
1716
1746
|
const newSections = incoming.filter((section) => !knownIds.has(section.id));
|
|
1717
1747
|
const merged = existing.map((section) => {
|
|
1748
|
+
var _a, _b, _c, _d;
|
|
1718
1749
|
const match = incoming.find((s) => s.id === section.id);
|
|
1719
1750
|
if (!match) return section;
|
|
1720
|
-
return
|
|
1751
|
+
return {
|
|
1752
|
+
id: match.id,
|
|
1753
|
+
title: (_a = match.title) != null ? _a : section.title,
|
|
1754
|
+
callToAction: (_b = match.callToAction) != null ? _b : section.callToAction,
|
|
1755
|
+
help: (_c = match.help) != null ? _c : section.help,
|
|
1756
|
+
inlineAlert: (_d = match.inlineAlert) != null ? _d : section.inlineAlert,
|
|
1757
|
+
items: [...section.items, ...match.items]
|
|
1758
|
+
};
|
|
1721
1759
|
});
|
|
1722
1760
|
return [...merged, ...newSections];
|
|
1723
1761
|
};
|
|
@@ -1837,10 +1875,11 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
1837
1875
|
var _a, _b, _c;
|
|
1838
1876
|
return {
|
|
1839
1877
|
sections: specState.sections.map((section) => {
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
title: section.title,
|
|
1878
|
+
var _a2;
|
|
1879
|
+
return __spreadProps(__spreadValues({}, section), {
|
|
1843
1880
|
callToAction: getDomainLayerCallToAction(section.callToAction, mapperProps),
|
|
1881
|
+
help: (_a2 = section.help) == null ? void 0 : _a2.markdown,
|
|
1882
|
+
inlineAlert: mapInlineAlert(section.inlineAlert),
|
|
1844
1883
|
items: section.items.map((item) => {
|
|
1845
1884
|
const behavior = getDomainLayerBehavior(
|
|
1846
1885
|
{ behavior: item.primaryBehavior },
|
|
@@ -1856,24 +1895,29 @@ var mapCollectionSpecToDomainState = (specState, mapperProps, mapLayout) => {
|
|
|
1856
1895
|
inlineAlert: mapInlineAlert(item.inlineAlert)
|
|
1857
1896
|
});
|
|
1858
1897
|
})
|
|
1859
|
-
};
|
|
1898
|
+
});
|
|
1860
1899
|
}),
|
|
1861
|
-
filters: (_a = specState.filters) == null ? void 0 : _a.map(
|
|
1862
|
-
options: filter.options.map((option) => {
|
|
1863
|
-
var _a2;
|
|
1864
|
-
return __spreadProps(__spreadValues({}, option), {
|
|
1865
|
-
selected: (_a2 = option.selected) != null ? _a2 : false,
|
|
1866
|
-
onSelect: () => {
|
|
1867
|
-
}
|
|
1868
|
-
// noop - this gets added during mapping
|
|
1869
|
-
});
|
|
1870
|
-
})
|
|
1871
|
-
})),
|
|
1900
|
+
filters: (_a = specState.filters) == null ? void 0 : _a.map(mapFilter),
|
|
1872
1901
|
beforeSections: (_b = specState.beforeSections) == null ? void 0 : _b.map(mapLayout),
|
|
1873
1902
|
afterSections: (_c = specState.afterSections) == null ? void 0 : _c.map(mapLayout),
|
|
1874
1903
|
nextCursor: specState.nextCursor
|
|
1875
1904
|
};
|
|
1876
1905
|
};
|
|
1906
|
+
var mapFilter = (filter) => {
|
|
1907
|
+
const anySelected = filter.options.some((option) => option.selected);
|
|
1908
|
+
return __spreadProps(__spreadValues({}, filter), {
|
|
1909
|
+
options: filter.options.map((option, index) => {
|
|
1910
|
+
var _a;
|
|
1911
|
+
return __spreadProps(__spreadValues({}, option), {
|
|
1912
|
+
// if a single select with no selection, we should default to selecting the first item
|
|
1913
|
+
selected: filter.multiSelect || anySelected ? (_a = option.selected) != null ? _a : false : index === 0,
|
|
1914
|
+
onSelect: () => {
|
|
1915
|
+
}
|
|
1916
|
+
// noop - this gets added during mapping in the component itself
|
|
1917
|
+
});
|
|
1918
|
+
})
|
|
1919
|
+
});
|
|
1920
|
+
};
|
|
1877
1921
|
|
|
1878
1922
|
// src/domain/components/ButtonComponent.ts
|
|
1879
1923
|
var createButtonComponent = (props) => __spreadValues({
|
|
@@ -1881,30 +1925,6 @@ var createButtonComponent = (props) => __spreadValues({
|
|
|
1881
1925
|
kind: "layout"
|
|
1882
1926
|
}, props);
|
|
1883
1927
|
|
|
1884
|
-
// src/domain/mappers/utils/image.ts
|
|
1885
|
-
var mapSpecImage = (image) => {
|
|
1886
|
-
var _a, _b, _c;
|
|
1887
|
-
return image ? {
|
|
1888
|
-
uri: (_b = (_a = image.uri) != null ? _a : image.url) != null ? _b : "",
|
|
1889
|
-
accessibilityDescription: (_c = image.accessibilityDescription) != null ? _c : image.text
|
|
1890
|
-
} : void 0;
|
|
1891
|
-
};
|
|
1892
|
-
|
|
1893
|
-
// src/domain/mappers/utils/media-utils.ts
|
|
1894
|
-
var getDomainLayerMedia = ({ icon, image, media }) => {
|
|
1895
|
-
if (media) {
|
|
1896
|
-
return media;
|
|
1897
|
-
}
|
|
1898
|
-
if (icon || image) {
|
|
1899
|
-
return {
|
|
1900
|
-
type: "legacy",
|
|
1901
|
-
icon,
|
|
1902
|
-
image: mapSpecImage(image)
|
|
1903
|
-
};
|
|
1904
|
-
}
|
|
1905
|
-
return void 0;
|
|
1906
|
-
};
|
|
1907
|
-
|
|
1908
1928
|
// src/domain/mappers/layout/buttonLayoutToComponent.ts
|
|
1909
1929
|
var buttonLayoutToComponent = (uid, button, mapperProps) => {
|
|
1910
1930
|
if (!button.behavior && !button.action && mapperProps.features.isEnabled("strictButtonOperations")) {
|