react-native-qonversion
Version:
Qonversion provides full in-app purchases infrastructure, so you do not need to build your own server for receipt validation. Implement in-app subscriptions, validate user receipts, check subscription status, and provide access to your app features and co
37 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const enums_1 = require("./enums");
class UserProperties {
constructor(properties) {
this.properties = properties;
this.definedProperties = properties.filter(property => property.definedKey !== enums_1.UserPropertyKey.CUSTOM);
this.customProperties = properties.filter(property => property.definedKey === enums_1.UserPropertyKey.CUSTOM);
this.flatPropertiesMap = new Map();
this.flatDefinedPropertiesMap = new Map();
this.flatCustomPropertiesMap = new Map();
properties.forEach(property => {
this.flatPropertiesMap.set(property.key, property.value);
if (property.definedKey == enums_1.UserPropertyKey.CUSTOM) {
this.flatCustomPropertiesMap.set(property.key, property.value);
}
else {
this.flatDefinedPropertiesMap.set(property.definedKey, property.value);
}
});
}
/**
* Searches for a property with the given property {@link key} in all properties list.
*/
getProperty(key) {
return this.properties.find(userProperty => userProperty.key == key);
}
/**
* Searches for a property with the given Qonversion defined property {@link key}
* in defined properties list.
*/
getDefinedProperty(key) {
return this.definedProperties.find(userProperty => userProperty.definedKey == key);
}
}
exports.default = UserProperties;
//# sourceMappingURL=UserProperties.js.map