@upeex/ads-sdk 1.1.13 → 1.1.14
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/AdBanner.d.ts +3 -1
- package/dist/index.js +13 -2
- package/package.json +1 -1
package/dist/AdBanner.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ type Props = {
|
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
theme?: 'light' | 'dark';
|
|
6
6
|
typeAds?: 'banner' | 'popup';
|
|
7
|
+
typeads?: string;
|
|
7
8
|
style?: object;
|
|
8
9
|
debug?: boolean;
|
|
9
10
|
};
|
|
10
|
-
export default function AdBanner({ client, slot, baseUrl, theme, typeAds,
|
|
11
|
+
export default function AdBanner({ client, slot, baseUrl, theme, typeAds, typeads, // Receive alias
|
|
12
|
+
style, debug, }: Props): any;
|
|
11
13
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -79,7 +79,8 @@ async function fetchAd({ baseUrl, client, slot, debug = false, typeAds, }) {
|
|
|
79
79
|
return ad;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme = 'light', typeAds,
|
|
82
|
+
function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme = 'light', typeAds, typeads, // Receive alias
|
|
83
|
+
style = {}, debug = false, }) {
|
|
83
84
|
const [ad, setAd] = useState(null);
|
|
84
85
|
const [error, setError] = useState(null);
|
|
85
86
|
const log = (...args) => {
|
|
@@ -89,9 +90,19 @@ function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme
|
|
|
89
90
|
useEffect(() => {
|
|
90
91
|
let refreshTimer;
|
|
91
92
|
const load = async () => {
|
|
93
|
+
var _a;
|
|
92
94
|
try {
|
|
93
95
|
log('Buscando anúncio', { client, slot });
|
|
94
|
-
|
|
96
|
+
// Normalize typeAds: prefer typeAds, fallback to typeads, default undefined.
|
|
97
|
+
// Ensure lowercase for backend compatibility (POPUP -> popup)
|
|
98
|
+
const effectiveTypeAds = (_a = (typeAds || typeads)) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
|
99
|
+
const data = await fetchAd({
|
|
100
|
+
baseUrl,
|
|
101
|
+
client,
|
|
102
|
+
slot,
|
|
103
|
+
debug,
|
|
104
|
+
typeAds: effectiveTypeAds,
|
|
105
|
+
});
|
|
95
106
|
log('Resposta do servidor', data);
|
|
96
107
|
if (!data || !data.image) {
|
|
97
108
|
setError('Nenhum anúncio disponível');
|