@kirz/react-native-toolkit
Version:
Toolkit to speed up React Native development
38 lines (37 loc) • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformProduct = transformProduct;
var _reactNative = require("react-native");
var _types = require("../../types");
function transformProduct(product, consumable) {
if (_reactNative.Platform.OS === 'ios') {
const data = product;
return new _types.Product({
productId: data.productId,
title: data.title,
description: data.description,
price: parseFloat(data.price),
localizedPrice: data.localizedPrice,
currency: data.currency,
consumable,
originalData: data
});
}
if (_reactNative.Platform.OS === 'android') {
const data = product;
return new _types.Product({
productId: data.productId,
title: data.title,
description: data.description,
originalData: data,
price: parseFloat(data.oneTimePurchaseOfferDetails.priceAmountMicros) / 1e6,
localizedPrice: data.oneTimePurchaseOfferDetails.formattedPrice,
currency: data.oneTimePurchaseOfferDetails.priceCurrencyCode,
consumable
});
}
throw new Error(`Platform not supported: ${_reactNative.Platform.OS}`);
}
//# sourceMappingURL=transformProduct.js.map