@moonpay/platform-sdk-core 1.29.0 → 1.30.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/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -8
- package/dist/index.d.ts +52 -8
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1736,13 +1736,20 @@ function buildFrameUrl(path, query = {}, options = {}) {
|
|
|
1736
1736
|
return url.href;
|
|
1737
1737
|
}
|
|
1738
1738
|
function themeParams(theme) {
|
|
1739
|
-
|
|
1739
|
+
const params = {};
|
|
1740
|
+
if (theme?.appearance) params.theme = theme.appearance;
|
|
1741
|
+
if (theme?.brandColor) params.brandColor = theme.brandColor;
|
|
1742
|
+
if (theme?.customTheme) params.customTheme = JSON.stringify(theme.customTheme);
|
|
1743
|
+
return params;
|
|
1740
1744
|
}
|
|
1741
1745
|
function applyThemeParam(url, theme) {
|
|
1742
|
-
|
|
1746
|
+
const params = Object.entries(themeParams(theme));
|
|
1747
|
+
if (params.length === 0) return url;
|
|
1743
1748
|
const parsed = new URL(url);
|
|
1744
|
-
|
|
1745
|
-
parsed.searchParams.
|
|
1749
|
+
for (const [key, value] of params) {
|
|
1750
|
+
if (!parsed.searchParams.has(key)) {
|
|
1751
|
+
parsed.searchParams.set(key, value);
|
|
1752
|
+
}
|
|
1746
1753
|
}
|
|
1747
1754
|
return parsed.href;
|
|
1748
1755
|
}
|