@adapty/capacitor
Version:
Official Adapty SDK for Capacitor
64 lines • 2.35 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { SimpleCoder } from './coder';
import { AdaptySubscriptionPeriodCoder } from './adapty-subscription-period';
import { AdaptySubscriptionOfferCoder } from './adapty-subscription-offer';
export class AdaptySubscriptionDetailsCoder extends SimpleCoder {
constructor() {
super(...arguments);
this.properties = {
subscriptionPeriod: {
key: 'period',
required: true,
type: 'object',
converter: new AdaptySubscriptionPeriodCoder(),
},
localizedSubscriptionPeriod: {
key: 'localized_period',
required: false,
type: 'string',
},
offer: {
key: 'offer',
required: false,
type: 'object',
converter: new AdaptySubscriptionOfferCoder(),
},
ios: {
subscriptionGroupIdentifier: {
key: 'group_identifier',
required: false,
type: 'string',
},
},
android: {
basePlanId: {
key: 'base_plan_id',
required: true,
type: 'string',
},
renewalType: {
key: 'renewal_type',
required: false,
type: 'string',
},
},
};
}
decode(data) {
const baseResult = super.decode(data);
const propToRemove = data.base_plan_id ? 'ios' : 'android';
const _a = baseResult, _b = propToRemove, _ = _a[_b], partialData = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
return partialData;
}
}
//# sourceMappingURL=adapty-subscription-details.js.map