@upeex/ads-sdk 1.1.12 → 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/README.md +6 -17
- package/dist/AdBanner.d.ts +4 -1
- package/dist/core.d.ts +2 -2
- package/dist/index.js +15 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
|
+
# SDK-apps-React-native
|
|
2
|
+
SDK para aplicaçõe React Native rodarem anúncios:
|
|
1
3
|
|
|
2
|
-
|
|
4
|
+
# Comando para inciar
|
|
5
|
+
npm i @upeex/ads-sdk
|
|
3
6
|
|
|
4
|
-
###
|
|
5
|
-
|
|
6
|
-
function App() {
|
|
7
|
-
return (
|
|
8
|
-
<View>
|
|
9
|
-
{/* ... */}
|
|
10
|
-
<AdBanner client="SEU_CLIENTE" slot="SEU_SLOT" />
|
|
11
|
-
</View>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
### Funções
|
|
7
|
+
### Como importar
|
|
17
8
|
|
|
18
9
|
```js
|
|
19
10
|
import AdBanner from '@upeex/ads-sdk';
|
|
@@ -22,6 +13,4 @@ import AdBanner from '@upeex/ads-sdk';
|
|
|
22
13
|
<AdBanner
|
|
23
14
|
client="SEU_CLIENTE"
|
|
24
15
|
slot="SEU_SLOT"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
/
|
package/dist/AdBanner.d.ts
CHANGED
|
@@ -3,8 +3,11 @@ type Props = {
|
|
|
3
3
|
slot: string;
|
|
4
4
|
baseUrl?: string;
|
|
5
5
|
theme?: 'light' | 'dark';
|
|
6
|
+
typeAds?: 'banner' | 'popup';
|
|
7
|
+
typeads?: string;
|
|
6
8
|
style?: object;
|
|
7
9
|
debug?: boolean;
|
|
8
10
|
};
|
|
9
|
-
export default function AdBanner({ client, slot, baseUrl, theme,
|
|
11
|
+
export default function AdBanner({ client, slot, baseUrl, theme, typeAds, typeads, // Receive alias
|
|
12
|
+
style, debug, }: Props): any;
|
|
10
13
|
export {};
|
package/dist/core.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ type LoadAdParams = {
|
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
client: string;
|
|
4
4
|
slot: string;
|
|
5
|
-
|
|
5
|
+
typeAds?: string;
|
|
6
6
|
debug?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare function fetchAd({ baseUrl, client, slot,
|
|
8
|
+
export declare function fetchAd({ baseUrl, client, slot, debug, typeAds, }: LoadAdParams): Promise<any>;
|
|
9
9
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ async function getSignals() {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
async function fetchAd({ baseUrl, client, slot,
|
|
42
|
+
async function fetchAd({ baseUrl, client, slot, debug = false, typeAds, }) {
|
|
43
43
|
const log = (...args) => {
|
|
44
44
|
if (debug)
|
|
45
45
|
console.log('[UPEEX ADS]', ...args);
|
|
@@ -53,7 +53,7 @@ async function fetchAd({ baseUrl, client, slot, display = 'BANNER', debug = fals
|
|
|
53
53
|
body: JSON.stringify({
|
|
54
54
|
client,
|
|
55
55
|
slot,
|
|
56
|
-
|
|
56
|
+
typeAds,
|
|
57
57
|
...signals,
|
|
58
58
|
}),
|
|
59
59
|
});
|
|
@@ -79,7 +79,8 @@ async function fetchAd({ baseUrl, client, slot, display = 'BANNER', debug = fals
|
|
|
79
79
|
return ad;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
function AdBanner({ client, slot, baseUrl = 'https://app.upeex.com.br/ad', theme = 'light',
|
|
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');
|