/* Metro module 3811; source: records/InvoiceRecord.tsx; dependencies: [6, 7, 15, 17, 18, 1886, 3812, 2] */ import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */ import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */ import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */ import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */ import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */ import Record from '../lib/Record.tsx'; /* Metro dependency 1886 */ import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 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}); let value = Record; value = _fun29480(value); const value2 = _fun29489(value); (FileImportTrackerModule).fileFinishedImporting('records/InvoiceRecord.tsx'); exports.default = value2; exports.BaseInvoiceRecord = value; function _callSuper_29476(a0, a1, a2) { // fn#29476, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:148, offset: 0x00fc2f45, size: 100 bytes, params: 4, frame: 20 var r0; var Reflect; let value = a2; const value3 = Module00017(a1); if (_isNativeReflectConstruct_29477()) { Reflect = global.Reflect; value = Reflect.construct(value3, value || [], Module00017(a0).constructor); r0 = value; } else { value = value3.apply(a0, value); r0 = value; } return PossibleConstructorReturn(a0, r0); } 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 BaseInvoiceRecord2 = BaseInvoiceRecord; Inherits(BaseInvoiceRecord2, a0); return CreateClass(BaseInvoiceRecord2, [{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 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 _fun29483({skuId}) { // fn#29483, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:871, offset: 0x00fc3122, size: 21 bytes, params: 2, frame: 2 return skuId === env0_0; } } 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 object = {}; object.total = invoice_preview.total; object.subtotal = invoice_preview.subtotal; object.tax = invoice_preview.tax; object.currency = invoice_preview.currency; object.invoiceItems = value; value = Object.create(BaseInvoiceRecord.prototype, {constructor: {value: BaseInvoiceRecord}}); const baseInvoiceRecord = new BaseInvoiceRecord(object); return baseInvoiceRecord instanceof Object ? baseInvoiceRecord : value; 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 _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; } } } } 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 InvoiceRecord2 = InvoiceRecord; Inherits(InvoiceRecord2, a0); return CreateClass(InvoiceRecord2, [{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 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 _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 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 object = {}; object.id = id; object.invoiceItems = invoice_items?.map((require(3812) /* metro dependency 3812: PremiumSubscriptionInvoiceItem */).createInvoiceItemFromServer); object.total = total; object.subtotal = subtotal; object.currency = currency; object.tax = tax; object.taxInclusive = tax_inclusive; let Date = global.Date; let date = new Date(subscription_period_start); object.subscriptionPeriodStart = date; Date = global.Date; object.subscriptionPeriodEnd = new Date(subscription_period_end); object.status = status; object.orbsReward = orbs_reward; object.checkoutContext = checkout_context; date = Object.create(InvoiceRecord.prototype, {constructor: {value: InvoiceRecord}}); const invoiceRecord = new InvoiceRecord(object); 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 object = {id: ''}; object.invoiceItems = invoice_items?.map((require(3812) /* metro dependency 3812: PremiumSubscriptionInvoiceItem */).createInvoiceItemFromServer); object.total = amount; object.subtotal = subtotal; object.currency = currency; object.tax = tax; object.taxInclusive = tax_inclusive; let Date = global.Date; let date = new Date(0); object.subscriptionPeriodStart = date; Date = global.Date; object.subscriptionPeriodEnd = new Date(0); object.orbsReward = orbs_reward; object.checkoutContext = checkout_context; date = Object.create(InvoiceRecord.prototype, {constructor: {value: InvoiceRecord}}); const invoiceRecord = new InvoiceRecord(object); return invoiceRecord instanceof Object ? invoiceRecord : date; } } } function _fun29494({discounts}) { // fn#29494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:3938:2187, offset: 0x00fc3462, size: 22 bytes, params: 2, frame: 2 return discounts.length > 0; } global.__d(_fun29475, 3811, [6, 7, 15, 17, 18, 1886, 3812, 2]) /* metro module 3811, dependencies: [6, 7, 15, 17, 18, 1886, 3812, 2] */;