decord/source/modules/billing/native/StorekitIAPQueue.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

210 lines
6.9 KiB
TypeScript

// Module ID: 11139
// Function ID: 11140
// Name: StorekitIAPQueue
// Dependencies: [5, 17, 4821, 7287, 11120, 2]
// Module 11139 (StorekitIAPQueue)
import utils_PriceUtils from "utils/PriceUtils" /* 7287 */;
import asyncGeneratorStep from "asyncGeneratorStep" /* 5 */;
require = fn;
function productSK2ToIAPProduct(subscription) {
let items = [];
if (null != subscription.subscription.promotionalOffers) {
const promotionalOffers = subscription.subscription.promotionalOffers;
items = promotionalOffers.map((identifier) => {
const paymentMode = identifier.paymentMode;
if ("freeTrial" === paymentMode) {
let str2 = "FREETRIAL";
} else if ("payAsYouGo" === paymentMode) {
str2 = "PAYASYOUGO";
} else {
str2 = "PAYUPFRONT";
if ("payUpFront" !== paymentMode) {
str2 = "";
}
}
const obj = { identifier: identifier.id, type: "SUBSCRIPTION", numberOfPeriods: identifier.period.value.toString(), price: identifier.price.toString(), localizedPrice: identifier.displayPrice, paymentMode: str2, subscriptionPeriod: identifier.period.unit.toUpperCase() };
return obj;
});
}
if (null == subscription.subscription.introductoryOffer) {
const _Number = Number;
const price = subscription.price;
const NumberResult = Number(price.toFixed(utils_PriceUtils.CurrencyExponents[subscription.currency.toLowerCase(subscription.currency)]));
const obj3 = { identifier: null, price: null, currencySymbol: null, currencyCode: null, priceString: null, countryCode: "", downloadable: false, description: null, title: null, discounts: null };
const _String = String;
obj3.identifier = String(subscription.id);
obj3.price = NumberResult;
obj3.currencySymbol = subscription.displayPrice.split(/[0-9]/)[0];
obj3.currencyCode = subscription.currency.toLowerCase();
const _String2 = String;
obj3.priceString = String(NumberResult);
({ description: obj2.description, displayName: obj2.title } = subscription);
obj3.discounts = items;
return obj3;
} else {
let introductoryOffer = subscription.subscription.introductoryOffer;
let paymentMode = introductoryOffer.paymentMode;
if ("freeTrial" === paymentMode) {
let str2 = "FREETRIAL";
let obj = { identifier: introductoryOffer.id, type: "SUBSCRIPTION", numberOfPeriods: introductoryOffer.period.value.toString(), price: introductoryOffer.price.toString(), localizedPrice: introductoryOffer.displayPrice, paymentMode: str2, subscriptionPeriod: null };
introductoryOffer = introductoryOffer.period.unit.toUpperCase();
obj.subscriptionPeriod = introductoryOffer;
tmp6(obj);
} else if ("payAsYouGo" !== paymentMode) {
str2 = "PAYUPFRONT";
if ("payUpFront" !== paymentMode) {
str2 = "";
}
}
str2 = "PAYASYOUGO";
}
}
const convertToAlpha2 = fn(4821).convertToAlpha2;
const RNIapIosSk2 = fn(17).NativeModules.RNIapIosSk2;
class StorekitIAPQueueClass {
constructor() {
merged = Object.assign({ _queue: null, _processingQueue: false });
merged[0] = [];
return merged;
}
}
const prototype = StorekitIAPQueueClass.prototype;
prototype["fetchSubscriptions"] = function fetchSubscriptions(arg0) {
const self = this;
closure_0 = arg0;
this.processQueue();
return new Promise((arg0, arg1) => {
closure_0 = arg0;
_self = arg1;
const _queue = _self._queue;
_queue.push(asyncGeneratorStep(async () => {
closure_1 = tmp3;
await items.getItems(closure_0);
if (1 === tmp7) {
c3 = 0;
closure_129_1(closure_2);
c5 = 3;
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
const found = arg1.filter((subscription) => null != subscription.subscription);
closure_128_0 = found.map(productSK2ToIAPProduct);
closure_129_0(closure_128_0);
c3 = 0;
}
return arg1;
}));
});
};
prototype["fetchProducts"] = function fetchProducts(arg0) {
const self = this;
closure_0 = arg0;
this.processQueue();
return new Promise((arg0, arg1) => {
closure_0 = arg0;
_self = arg1;
const _queue = _self._queue;
_queue.push(asyncGeneratorStep(async () => {
const products = skus(tmp3[4]).getProducts({ skus });
await products.then((arr) => {
const found = arr.filter((type) => "iap" === type.type);
return found.map((item) => (function mapToIAPProduct() { ... })(item));
});
if (1 === tmp7) {
c3 = 0;
closure_129_1(closure_2);
c5 = 3;
} else if (arg0 === 1) {
c5 = 3;
throw arg1;
} else if (arg0 !== 2) {
closure_128_0 = arg1;
closure_129_0(closure_128_0);
c3 = 0;
}
return arg1;
}));
});
};
prototype["processQueue"] = function processQueue() {
const self = this;
return (async (arg0, value) => {
if (c5 === 2) {
c5 = 3;
throw new TypeError("Generator functions may not be called on executing generators");
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw value;
} else if (arg0 === 2) {
const obj2 = { value, done: true };
return obj2;
} else {
return { value: "HermesInternal", done: null };
}
} else {
try {
c5 = 2;
if (0 === c4) {
if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c5 = 3;
const obj3 = { value, done: true };
return obj3;
} else {
closure_1 = tmp3;
closure_0 = tmp7;
closure_128_0 = undefined;
if (self._processingQueue) {
c5 = 3;
} else {
self._processingQueue = true;
c3 = 1;
if (self._queue.length <= 0) {
c3 = 0;
closure_129_0._processingQueue = false;
}
}
}
} else if (1 === tmp7) {
c3 = 0;
closure_129_0._processingQueue = false;
throw closure_2;
} else if (arg0 === 1) {
c5 = 3;
throw value;
} else if (arg0 === 2) {
c3 = 0;
closure_129_0._processingQueue = false;
c5 = 3;
const obj = { value, done: true };
return obj;
}
const _queue = closure_129_0._queue;
closure_128_0 = _queue.shift();
c4 = 2;
c5 = 1;
const obj4 = { value: closure_128_0(), done: false };
return obj4;
} catch (tmp24) {
closure_2 = tmp24;
if (tmp4 === c3) {
c5 = tmp2;
throw tmp24;
} else {
c4 = tmp;
}
}
}
})();
};
let merged = Object.assign({ _queue: null, _processingQueue: false });
merged[0] = [];
const size = fn(2);
const result = size.fileFinishedImporting("modules/billing/native/StorekitIAPQueue.tsx");
export default merged;