119 lines
4.2 KiB
JavaScript
119 lines
4.2 KiB
JavaScript
// Metro module 6347 (f6348).
|
|
import { SubscriptionPlatform } from "./Module6335";
|
|
export const productSk2Map = ({ id, description, displayName, price, currency, displayPrice }) => ({
|
|
title: displayName,
|
|
productId: String(id),
|
|
description,
|
|
type: "iap",
|
|
price: String(price),
|
|
localizedPrice: displayPrice,
|
|
currency
|
|
});
|
|
export const subscriptionSk2Map = ({ id, description, displayName, price, currency, displayPrice, subscription }) => {
|
|
const r18 = {
|
|
platform: SubscriptionPlatform.ios,
|
|
title: displayName,
|
|
productId: String(id),
|
|
description,
|
|
type: "subs",
|
|
price: String(price),
|
|
localizedPrice: displayPrice,
|
|
currency,
|
|
subscriptionPeriodNumberIOS: `${subscription == null ? void 0 : subscription.subscriptionPeriod?.value}`,
|
|
subscriptionPeriodUnitIOS: null,
|
|
introductoryPriceAsAmountIOS: null,
|
|
introductoryPricePaymentModeIOS: null,
|
|
introductoryPriceNumberOfPeriodsIOS: null,
|
|
introductoryPriceSubscriptionPeriodIOS: null
|
|
};
|
|
const r31 = subscription == null;
|
|
let subscriptionPeriodUnitIOS = void 0;
|
|
if (!r31) {
|
|
const subscriptionPeriod = subscription.subscriptionPeriod;
|
|
subscriptionPeriodUnitIOS = subscriptionPeriod == null ? void 0 : subscriptionPeriod.unit.toUpperCase();
|
|
}
|
|
r18.subscriptionPeriodUnitIOS = subscriptionPeriodUnitIOS;
|
|
r18.introductoryPriceAsAmountIOS = subscription == null ? void 0 : subscription.introductoryOffer?.displayPrice;
|
|
const r41 = subscription == null;
|
|
let introductoryPricePaymentModeIOS = void 0;
|
|
if (!r41) {
|
|
const introductoryOffer = subscription.introductoryOffer;
|
|
introductoryPricePaymentModeIOS = introductoryOffer == null ? void 0 : introductoryOffer.paymentMode.toUpperCase();
|
|
}
|
|
r18.introductoryPricePaymentModeIOS = introductoryPricePaymentModeIOS;
|
|
const r47 = subscription == null;
|
|
let introductoryPriceNumberOfPeriodsIOS = void 0;
|
|
if (!r47) {
|
|
const introductoryOffer2 = subscription.introductoryOffer;
|
|
const r50 = introductoryOffer2 == null;
|
|
introductoryPriceNumberOfPeriodsIOS = void 0;
|
|
if (!r50) {
|
|
const period = introductoryOffer2.period;
|
|
const r52 = period == null;
|
|
introductoryPriceNumberOfPeriodsIOS = void 0;
|
|
if (!r52) {
|
|
const value = period.value;
|
|
introductoryPriceNumberOfPeriodsIOS = value == null ? void 0 : value.toString();
|
|
}
|
|
}
|
|
}
|
|
r18.introductoryPriceNumberOfPeriodsIOS = introductoryPriceNumberOfPeriodsIOS;
|
|
const r56 = subscription == null;
|
|
let introductoryPriceSubscriptionPeriodIOS = void 0;
|
|
if (!r56) {
|
|
const introductoryOffer3 = subscription.introductoryOffer;
|
|
introductoryPriceSubscriptionPeriodIOS = introductoryOffer3 == null ? void 0 : introductoryOffer3.period?.unit;
|
|
}
|
|
r18.introductoryPriceSubscriptionPeriodIOS = introductoryPriceSubscriptionPeriodIOS;
|
|
return r18;
|
|
};
|
|
export const transactionSk2ToPurchaseMap = (a0) => {
|
|
let transactionReason;
|
|
const { id, originalPurchaseDate, productID, purchaseDate, purchasedQuantity, originalID } = a0;
|
|
let verificationResult = a0.verificationResult;
|
|
let appAccountToken = a0.appAccountToken;
|
|
const jsonRepresentation = a0.jsonRepresentation;
|
|
try {
|
|
transactionReason = JSON.parse(jsonRepresentation).transactionReason;
|
|
} catch ($e) {
|
|
console.log("AppleSK2.ts react-native-iap: Error parsing jsonRepresentation", $e);
|
|
}
|
|
const r23 = {
|
|
productId: productID,
|
|
transactionId: String(id),
|
|
transactionDate: purchaseDate,
|
|
transactionReceipt: "",
|
|
purchaseToken: "",
|
|
quantityIOS: purchasedQuantity,
|
|
originalTransactionDateIOS: originalPurchaseDate,
|
|
originalTransactionIdentifierIOS: originalID,
|
|
verificationResultIOS: null,
|
|
appAccountToken: null,
|
|
transactionReasonIOS: null
|
|
};
|
|
if (verificationResult == null) {
|
|
verificationResult = "";
|
|
}
|
|
r23.verificationResultIOS = verificationResult;
|
|
if (appAccountToken == null) {
|
|
appAccountToken = "";
|
|
}
|
|
r23.appAccountToken = appAccountToken;
|
|
if (transactionReason == null) {
|
|
transactionReason = "";
|
|
}
|
|
r23.transactionReasonIOS = transactionReason;
|
|
return r23;
|
|
};
|
|
export const offerSk2Map = (a0) => {
|
|
if (a0) {
|
|
return {
|
|
offerID: a0.identifier,
|
|
keyID: a0.keyIdentifier,
|
|
nonce: a0.nonce,
|
|
signature: a0.signature,
|
|
timestamp: a0.timestamp.toString()
|
|
};
|
|
}
|
|
};
|