230 lines
11 KiB
TypeScript
230 lines
11 KiB
TypeScript
/* Metro module 3811; source: records/InvoiceRecord.tsx; dependencies: [6, 7, 15, 17, 18, 1886, 3812, 2] */
|
|
function _fun29475(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#29475, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:6, offset: 0x00fc2e62, size: 227 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_3 = importDefault(7) /* metro dependency 7 */;
|
|
const env0_4 = importDefault(15) /* metro dependency 15 */;
|
|
const env0_5 = importDefault(17) /* metro dependency 17 */;
|
|
const env0_6 = importDefault(18) /* metro dependency 18 */;
|
|
let value = importDefault(1886) /* metro dependency 1886: Record */;
|
|
value = _fun29480(value);
|
|
const value2 = _fun29489(value);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('records/InvoiceRecord.tsx');
|
|
exports.default = value2;
|
|
exports.BaseInvoiceRecord = value;
|
|
}
|
|
|
|
function _isNativeReflectConstruct_29477() { // fn#29477, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:279, offset: 0x00fc2fa9, size: 94 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_29477_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun29480(a0) { // fn#29480, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:478, offset: 0x00fc3007, size: 125 bytes, params: 2, frame: 17
|
|
const closure = BaseInvoiceRecord;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'getInvoicePreviewLineItemForSku', value: function(a0) {
|
|
var env0_0 = a0;
|
|
var value = this.invoiceItems.find(_fun29483);
|
|
var value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}}, {key: 'getInvoicePreviewLineItemUnitPriceForSku', value: function(a0) {
|
|
var value = this.getInvoicePreviewLineItemForSku(a0);
|
|
var value2 = null;
|
|
return value2 == value || value2 == value.unitPrice ? value2 : value.unitPrice.amount;
|
|
}}], [{key: 'createInvoiceFromOrder', value: value_29485}]);
|
|
}
|
|
|
|
function _fun29489(a0) { // fn#29489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:1554, offset: 0x00fc32a3, size: 148 bytes, params: 2, frame: 18
|
|
const closure = InvoiceRecord;
|
|
env0_6(closure, a0);
|
|
return env0_3(closure, [{key: 'findInvoiceItemByPlanId', value: function(a0) {
|
|
var env0_0 = a0;
|
|
var value = this.invoiceItems.find(_fun29492);
|
|
var value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}}, {key: 'getDiscountIdIfExists', value: function() {
|
|
var property = this.invoiceItems;
|
|
var value = property.find(_fun29494);
|
|
if (value != null) {
|
|
if (value.discounts.length === 0) {
|
|
return undefined;
|
|
}
|
|
property = value.discounts[0];
|
|
if (property != null) {
|
|
return property.discount_id;
|
|
}
|
|
}
|
|
}}], [{key: 'createInvoiceFromServer', value: value_29495}, {key: 'createFromOTPPreview', value: value_29496}]);
|
|
}
|
|
|
|
function BaseInvoiceRecord({total, subtotal, tax, currency, invoiceItems}) { // fn#29481, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:490, offset: 0x00fc3084, size: 110 bytes, params: 2, frame: 15
|
|
let value = environment.__proto__;
|
|
env1_2(this, BaseInvoiceRecord);
|
|
value = _callSuper_29476(this, BaseInvoiceRecord);
|
|
value.total = total;
|
|
value.subtotal = subtotal;
|
|
value.tax = tax;
|
|
value.currency = currency;
|
|
value.invoiceItems = invoiceItems ?? [];
|
|
return value;
|
|
}
|
|
|
|
function value_29482(a0) { // fn#29482, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:813, offset: 0x00fc30f2, size: 48 bytes, params: 2, frame: 11
|
|
const env0_0 = a0;
|
|
const value = this.invoiceItems.find(_fun29483);
|
|
const value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}
|
|
|
|
function value_29485(a0) { // fn#29485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:1108, offset: 0x00fc3172, size: 168 bytes, params: 2, frame: 14
|
|
const env0_0 = a0;
|
|
const billing_facet = a0.billing_facet;
|
|
let value = null;
|
|
const invoice_preview = value != billing_facet ? billing_facet.invoice_preview : value;
|
|
if (value == invoice_preview) {
|
|
return value;
|
|
}
|
|
value = invoice_preview.line_items.map(function(a0) {
|
|
var value2 = a0.order_line_items.find(_fun29487);
|
|
var value3 = null;
|
|
return value3 == value2 ? value3 : {skuId: value2.sku_id, unitPrice: {amount: a0.unit_price,
|
|
currency: invoice_preview.currency}, quantity: a0.quantity};
|
|
});
|
|
value = value.filter(function(a0) {
|
|
return a0 != null;
|
|
});
|
|
const object2 = {};
|
|
object2.total = invoice_preview.total;
|
|
object2.subtotal = invoice_preview.subtotal;
|
|
object2.tax = invoice_preview.tax;
|
|
object2.currency = invoice_preview.currency;
|
|
object2.invoiceItems = value;
|
|
value = Object.create(BaseInvoiceRecord.prototype, {constructor: {value: BaseInvoiceRecord}});
|
|
const baseInvoiceRecord = new BaseInvoiceRecord(object2);
|
|
return baseInvoiceRecord instanceof Object ? baseInvoiceRecord : value;
|
|
}
|
|
|
|
function InvoiceRecord(a0) { // fn#29490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:1566, offset: 0x00fc3337, size: 153 bytes, params: 2, frame: 17
|
|
let value = environment.__proto__;
|
|
env1_2(this, InvoiceRecord);
|
|
value = _callSuper_29476(this, InvoiceRecord, [a0]);
|
|
value.id = a0.id;
|
|
value.invoiceItems = a0.invoiceItems ?? [];
|
|
value.taxInclusive = a0.taxInclusive;
|
|
value.subscriptionPeriodStart = a0.subscriptionPeriodStart;
|
|
value.subscriptionPeriodEnd = a0.subscriptionPeriodEnd;
|
|
value.status = a0.status;
|
|
value.orbsReward = a0.orbsReward;
|
|
value.checkoutContext = a0.checkoutContext;
|
|
return value;
|
|
}
|
|
|
|
function value_29491(a0) { // fn#29491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2013, offset: 0x00fc33d0, size: 48 bytes, params: 2, frame: 11
|
|
const env0_0 = a0;
|
|
const value = this.invoiceItems.find(_fun29492);
|
|
const value2 = null;
|
|
return value2 != value ? value : value2;
|
|
}
|
|
|
|
function value_29493() { // fn#29493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2146, offset: 0x00fc3416, size: 76 bytes, params: 1, frame: 12
|
|
const value = this.invoiceItems.find(function(a0) {
|
|
return a0.discounts.length > 0;
|
|
});
|
|
if (value != null) {
|
|
var discounts = value.discounts;
|
|
if (discounts.length === 0) {
|
|
return undefined;
|
|
}
|
|
discounts = value.discounts;
|
|
var property = discounts[0];
|
|
if (property != null) {
|
|
return property.discount_id;
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_29495({id, invoice_items, total, subtotal, currency, tax, tax_inclusive, subscription_period_start, subscription_period_end, status, orbs_reward, checkout_context}) { // fn#29495, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2344, offset: 0x00fc3478, size: 275 bytes, params: 2, frame: 18
|
|
const object2 = {};
|
|
object2.id = id;
|
|
object2.invoiceItems = invoice_items?.map((require(3812) /* metro dependency 3812: PremiumSubscriptionInvoiceItem */).createInvoiceItemFromServer);
|
|
object2.total = total;
|
|
object2.subtotal = subtotal;
|
|
object2.currency = currency;
|
|
object2.tax = tax;
|
|
object2.taxInclusive = tax_inclusive;
|
|
let Date = global.Date;
|
|
let date = new Date(subscription_period_start);
|
|
object2.subscriptionPeriodStart = date;
|
|
Date = global.Date;
|
|
object2.subscriptionPeriodEnd = new Date(subscription_period_end);
|
|
object2.status = status;
|
|
object2.orbsReward = orbs_reward;
|
|
object2.checkoutContext = checkout_context;
|
|
date = Object.create(InvoiceRecord.prototype, {constructor: {value: InvoiceRecord}});
|
|
const invoiceRecord = new InvoiceRecord(object2);
|
|
return invoiceRecord instanceof Object ? invoiceRecord : date;
|
|
}
|
|
|
|
function value_29496({invoice_items, amount, subtotal, currency, tax, tax_inclusive, orbs_reward, checkout_context}) { // fn#29496, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2812, offset: 0x00fc358b, size: 251 bytes, params: 2, frame: 18
|
|
const object2 = {id: ''};
|
|
object2.invoiceItems = invoice_items?.map((require(3812) /* metro dependency 3812: PremiumSubscriptionInvoiceItem */).createInvoiceItemFromServer);
|
|
object2.total = amount;
|
|
object2.subtotal = subtotal;
|
|
object2.currency = currency;
|
|
object2.tax = tax;
|
|
object2.taxInclusive = tax_inclusive;
|
|
let Date = global.Date;
|
|
let date = new Date(0);
|
|
object2.subscriptionPeriodStart = date;
|
|
Date = global.Date;
|
|
object2.subscriptionPeriodEnd = new Date(0);
|
|
object2.orbsReward = orbs_reward;
|
|
object2.checkoutContext = checkout_context;
|
|
date = Object.create(InvoiceRecord.prototype, {constructor: {value: InvoiceRecord}});
|
|
const invoiceRecord = new InvoiceRecord(object2);
|
|
return invoiceRecord instanceof Object ? invoiceRecord : date;
|
|
}
|
|
|
|
function _fun29486(a0) { // fn#29486, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:1222, offset: 0x00fc321a, size: 108 bytes, params: 2, frame: 14
|
|
const value2 = a0.order_line_items.find(_fun29487);
|
|
const value3 = null;
|
|
return value3 == value2 ? value3 : {skuId: value2.sku_id, unitPrice: {amount: a0.unit_price,
|
|
currency: invoice_preview.currency}, quantity: a0.quantity};
|
|
}
|
|
|
|
function _fun29492({subscriptionPlanId}) { // fn#29492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2071, offset: 0x00fc3400, size: 22 bytes, params: 2, frame: 2
|
|
return subscriptionPlanId === env0_0;
|
|
}
|
|
|
|
function _fun29487({id}) { // fn#29487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:1257, offset: 0x00fc3286, size: 29 bytes, params: 2, frame: 2
|
|
return id === env0_0.ref_order_line_item_id;
|
|
}
|
|
|