UNPKG

@adapty/capacitor

Version:
50 lines 1.81 kB
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 { AdaptySubscriptionOfferIdCoder } from './adapty-subscription-offer-identifier'; import { ArrayCoder } from './array'; import { AdaptyDiscountPhaseCoder } from './adapty-discount-phase'; export class AdaptySubscriptionOfferCoder extends SimpleCoder { constructor() { super(...arguments); this.properties = { identifier: { key: 'offer_identifier', required: true, type: 'object', converter: new AdaptySubscriptionOfferIdCoder(), }, phases: { key: 'phases', required: true, type: 'array', converter: new ArrayCoder(AdaptyDiscountPhaseCoder), }, android: { offerTags: { key: 'offer_tags', required: false, type: 'array', }, }, }; } decode(data) { const baseResult = super.decode(data); if (!data.offer_tags) { const { android } = baseResult, partialData = __rest(baseResult, ["android"]); return partialData; } return baseResult; } } //# sourceMappingURL=adapty-subscription-offer.js.map