appmetrica-capacitor7
Version:
Appmetrica capacitor plugin
166 lines • 5.02 kB
JavaScript
export var Gender;
(function (Gender) {
Gender[Gender["MALE"] = 0] = "MALE";
Gender[Gender["FEMALE"] = 1] = "FEMALE";
Gender[Gender["OTHER"] = 2] = "OTHER";
})(Gender || (Gender = {}));
export class UserProfile {
constructor() {
this.updates = [];
}
apply(update) {
this.updates.push(update);
return this;
}
applyFromArray(updatesArray) {
this.updates.push(...updatesArray);
return this;
}
}
export class UserProfileUpdate {
constructor(attributeName, methodName, key, ...values) {
this.attributeName = attributeName;
this.methodName = methodName;
this.key = key;
this.values = values;
}
}
export class BirthDateAttribute {
constructor() {
this.attributeName = 'birthDate';
}
withAge(age) {
return new UserProfileUpdate(this.attributeName, 'withAge', null, age);
}
withBirthDate(yearOrDate, month, day) {
const args = [];
if (typeof yearOrDate !== 'number') {
args.push(yearOrDate.getDate(), yearOrDate.getMonth(), yearOrDate.getFullYear());
}
else {
args.push(yearOrDate);
if (month !== undefined)
args.push(month);
if (day !== undefined)
args.push(day);
}
return new UserProfileUpdate(this.attributeName, 'withBirthDate', null, ...args);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', null);
}
}
export class GenderAttribute {
constructor() {
this.attributeName = 'gender';
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', null, value.toString());
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', null);
}
}
export class NameAttribute {
constructor() {
this.attributeName = 'name';
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', null, value);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', null);
}
}
export class NotificationsEnabledAttribute {
constructor() {
this.attributeName = 'notificationsEnabled';
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', null, value);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', null);
}
}
export class CustomBooleanAttribute {
constructor(key) {
this.attributeName = 'customBoolean';
this.key = key;
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value);
}
withValueIfUndefined(value) {
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key);
}
}
export class CustomCounterAttribute {
constructor(key) {
this.attributeName = 'customCounter';
this.key = key;
}
withDelta(value) {
return new UserProfileUpdate(this.attributeName, 'withDelta', this.key, value);
}
}
export class CustomNumberAttribute {
constructor(key) {
this.attributeName = 'customNumber';
this.key = key;
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value);
}
withValueIfUndefined(value) {
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key);
}
}
export class CustomStringAttribute {
constructor(key) {
this.attributeName = 'customString';
this.key = key;
}
withValue(value) {
return new UserProfileUpdate(this.attributeName, 'withValue', this.key, value);
}
withValueIfUndefined(value) {
return new UserProfileUpdate(this.attributeName, 'withValueIfUndefined', this.key, value);
}
withValueReset() {
return new UserProfileUpdate(this.attributeName, 'withValueReset', this.key);
}
}
export class ProfileAttribute {
static BirthDate() {
return new BirthDateAttribute();
}
static Gender() {
return new GenderAttribute();
}
static Name() {
return new NameAttribute();
}
static NotificationsEnabled() {
return new NotificationsEnabledAttribute();
}
static CustomBool(key) {
return new CustomBooleanAttribute(key);
}
static CustomCounter(key) {
return new CustomCounterAttribute(key);
}
static CustomNumber(key) {
return new CustomNumberAttribute(key);
}
static CustomString(key) {
return new CustomStringAttribute(key);
}
}
//# sourceMappingURL=profile.js.map