2026-08-25 06:04:03 +00:00
// Module ID: 4044
// Function ID: 4045
2026-07-29 08:29:29 +00:00
// Name: createFromServer
2026-08-11 06:20:06 +00:00
// Dependencies: [1931, 1924, 2]
2026-07-29 08:29:29 +00:00
// Exports: getPriceFromServer, isNoneSubscription
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 4044 (createFromServer)
2026-08-24 06:08:38 +00:00
import toJSDefault from "toJS" /* 1931 */ ;
import GuildFeatures from "GuildFeatures" /* 1924 */ ;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
toJSDefault ;
2026-07-29 08:29:29 +00:00
( { PremiumSubscriptionSKUs : c0 , PremiumTypes : closure_1 , SubscriptionPlans : obj1 } = GuildFeatures ) ;
let SubscriptionPlanRecord ;
class SubscriptionPlanRecord extends tmp2 {
constructor ( arg0 ) {
tmp = new SubscriptionPlanRecord ( new . target , new . target ) ;
// ThrowIfThisInitialized (0x7c)
( { id : tmp.id , name : tmp.name , interval : tmp.interval , intervalCount : tmp.intervalCount , taxInclusive : tmp.taxInclusive , skuId : tmp.skuId , currency : tmp.currency , price : tmp.price , prices : tmp.prices } = global ) ;
return tmp ;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = SubscriptionPlanRecord . prototype ;
SubscriptionPlanRecord [ "createFromServer" ] = function createFromServer ( prices ) {
2026-08-24 06:08:38 +00:00
closure_0 = prices ;
2026-07-29 08:29:29 +00:00
if ( null != prices . prices ) {
let _Object = Object ;
const keys = Object . keys ( prices . prices ) ;
const reduced = keys . reduce ( ( arg0 , arg1 ) = > {
if ( null == prices . prices ) {
return arg0 ;
} else {
let obj = { countryPrices : null , paymentSourcePrices : null } ;
obj = { countryCode : null , prices : null } ;
obj [ 0 ] = tmp . prices [ arg1 ] . country_prices . country_code ;
prices = tmp3 . country_prices . prices ;
obj [ 1 ] = prices . map ( ( amount ) = > ( { amount : amount.amount , currency : amount.currency , tax : 0 , taxInclusive : tax_inclusive.tax_inclusive } ) ) ;
obj [ 0 ] = obj ;
const _Object = Object ;
const entries = Object . entries ( tmp3 . payment_source_prices ) ;
obj [ 1 ] = entries . reduce ( ( arg0 , arg1 ) = > {
[ tmp , arr ] = arg1 ;
arg0 [ tmp ] = arr . map ( ( amount ) = > ( { amount : amount.amount , currency : amount.currency , tax : 0 , taxInclusive : tax_inclusive.tax_inclusive } ) ) ;
return arg0 ;
} , { } ) ;
arg0 [ arg1 ] = obj ;
return arg0 ;
}
} , { } ) ;
}
( { id , name , interval , interval_count , tax_inclusive , sku_id , currency } = prices ) ;
2026-08-04 21:03:28 +00:00
if ( typeof SubscriptionPlanRecord !== "function" ) {
2026-07-29 08:29:29 +00:00
HermesBuiltin . throwTypeError ( ) ;
}
const tmp5 = new SubscriptionPlanRecord ( "Trying to call a non-function" , tmp , SubscriptionPlanRecord , new . target , id , name , interval , interval_count , tax_inclusive , sku_id , currency ) ;
// ThrowIfThisInitialized (0x7c)
tmp5 . id = id ;
tmp5 . name = name ;
tmp5 . interval = interval ;
tmp5 . intervalCount = interval_count ;
tmp5 . taxInclusive = tax_inclusive ;
tmp5 . skuId = sku_id ;
tmp5 . currency = currency ;
tmp5 . price = prices . price ;
tmp5 . prices = { } ;
return tmp5 ;
} ;
Object . defineProperty ( prototype , "premiumSubscriptionType" , {
get : function premiumSubscriptionType() {
const skuId = this . skuId ;
if ( constants . LEGACY !== skuId ) {
if ( tmp . TIER_2 !== skuId ) {
if ( tmp . TIER_1 === skuId ) {
return closure_1 . TIER_1 ;
} else if ( tmp . TIER_0 === skuId ) {
return closure_1 . TIER_0 ;
} else {
return null ;
}
}
}
return closure_1 . TIER_2 ;
} ,
set : undefined
} ) ;
prototype [ "toServerData" ] = function toServerData() {
const self = this ;
let obj = { } ;
const keys = Object . keys ( this . prices ) ;
const item = keys . forEach ( ( arg0 ) = > {
obj = { country_prices : obj , payment_source_prices : tmp.paymentSourcePrices } ;
obj = { country_code : tmp.countryPrices.countryCode , prices : tmp.countryPrices.prices } ;
obj [ arg0 ] = obj ;
} ) ;
obj = { id : this.id , name : this.name , sku_id : this.skuId , interval : this.interval , interval_count : this.intervalCount , tax_inclusive : this.taxInclusive , currency : this.currency , price : this.price , prices : obj , price_tier : this.price } ;
return obj ;
} ;
const result = require ( "set" ) . fileFinishedImporting ( "records/SubscriptionPlanRecord.tsx" ) ;
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default SubscriptionPlanRecord ;
export const getPriceFromServer = function getPriceFromServer ( amount , taxInclusive ) {
return { amount : amount.amount , currency : amount.currency , tax : 0 , taxInclusive } ;
} ;
2026-07-20 16:05:17 +00:00
export const isNoneSubscription = function isNoneSubscription ( planId ) {
const items = [ , , , ] ;
2026-07-29 08:29:29 +00:00
( { NONE_MONTH : arr [ 0 ] , NONE_3_MONTH : arr [ 1 ] , NONE_6_MONTH : arr [ 2 ] , NONE_YEAR : arr [ 3 ] } = closure_2 ) ;
2026-07-20 16:05:17 +00:00
return items . includes ( planId ) ;
} ;