mychips-react-sdk
Version:
MyChips Offerwall
31 lines (29 loc) • 977 B
JavaScript
import Consts from '../Consts';
import { version } from '../../package.json';
class UriBuilderService {
buildOfferwallUrl(adunitId, userId, advertisingId, gender, age, totalVirtualCurrency) {
let url = `${Consts.WEB_BASE_URL}?adunit_id=${adunitId}&user_id=${userId}&`;
if (advertisingId) {
url += `gaid=${advertisingId}&`;
}
if (gender) {
url += `gender=${gender}&`;
}
if (age && age > 0) {
url += `age=${age}&`;
}
if (totalVirtualCurrency && totalVirtualCurrency > 0) {
const totalVirtualCurrencyFormatted = totalVirtualCurrency.toFixed(2);
url += `total_virtual_currency=${totalVirtualCurrencyFormatted}&`;
}
// Always add SDK parameter
url += `sdk=react_native&sdk_version=${version}`;
// Remove the trailing '&' if it exists
if (url.endsWith('&')) {
url = url.slice(0, -1);
}
return url;
}
}
export default UriBuilderService;
//# sourceMappingURL=UriBuilderService.js.map