@adapty/capacitor
Version:
Official Adapty SDK for Capacitor
94 lines • 3.42 kB
JavaScript
import { SimpleCoder } from './coder';
import { AdaptyPriceCoder } from './adapty-price';
import { AdaptySubscriptionDetailsCoder } from './adapty-subscription-details';
export class AdaptyPaywallProductCoder extends SimpleCoder {
constructor() {
super(...arguments);
this.properties = {
vendorProductId: {
key: 'vendor_product_id',
required: true,
type: 'string',
},
adaptyId: {
key: 'adapty_product_id',
required: true,
type: 'string',
},
accessLevelId: {
key: 'access_level_id',
required: true,
type: 'string',
},
productType: {
key: 'product_type',
required: true,
type: 'string',
},
paywallProductIndex: {
key: 'paywall_product_index',
required: true,
type: 'number',
},
localizedDescription: {
key: 'localized_description',
required: true,
type: 'string',
},
localizedTitle: { key: 'localized_title', required: true, type: 'string' },
regionCode: { key: 'region_code', required: false, type: 'string' },
variationId: {
key: 'paywall_variation_id',
required: true,
type: 'string',
},
paywallABTestName: {
key: 'paywall_ab_test_name',
required: true,
type: 'string',
},
paywallName: { key: 'paywall_name', required: true, type: 'string' },
price: {
key: 'price',
required: false,
type: 'object',
converter: new AdaptyPriceCoder(),
},
webPurchaseUrl: {
key: 'web_purchase_url',
required: false,
type: 'string',
},
payloadData: { key: 'payload_data', required: false, type: 'string' },
subscription: {
key: 'subscription',
required: false,
type: 'object',
converter: new AdaptySubscriptionDetailsCoder(),
},
ios: {
isFamilyShareable: {
key: 'is_family_shareable',
required: true,
type: 'boolean',
},
},
};
}
getInput(data) {
var _a, _b;
return {
adapty_product_id: data.adapty_product_id,
access_level_id: data.access_level_id,
product_type: data.product_type,
paywall_product_index: data.paywall_product_index,
paywall_ab_test_name: data.paywall_ab_test_name,
payload_data: data.payload_data,
paywall_name: data.paywall_name,
paywall_variation_id: data.paywall_variation_id,
subscription_offer_identifier: (_b = (_a = data.subscription) === null || _a === void 0 ? void 0 : _a.offer) === null || _b === void 0 ? void 0 : _b.offer_identifier,
vendor_product_id: data.vendor_product_id,
};
}
}
//# sourceMappingURL=adapty-paywall-product.js.map