mychips-react-sdk
Version:
MyChips Offerwall
38 lines (35 loc) • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _Consts = _interopRequireDefault(require("../Consts"));
var _package = require("../../package.json");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
class UriBuilderService {
buildOfferwallUrl(adunitId, userId, advertisingId, gender, age, totalVirtualCurrency) {
let url = `${_Consts.default.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=${_package.version}`;
// Remove the trailing '&' if it exists
if (url.endsWith('&')) {
url = url.slice(0, -1);
}
return url;
}
}
var _default = exports.default = UriBuilderService;
//# sourceMappingURL=UriBuilderService.js.map