171 lines
9.5 KiB
TypeScript
171 lines
9.5 KiB
TypeScript
/* Metro module 7550; source: modules/premium/native/PremiumAccountCredit.tsx; dependencies: [31, 27, 5181, 661, 33, 4501, 697, 3802, 1244, 2806, 6780, 4573, 566, 22, 2] */
|
|
function _fun60693(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#60693, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7728:6, offset: 0x0170aab0, size: 450 bytes, params: 8, frame: 24
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
importAll(31) /* metro dependency 31 */;
|
|
const env0_3 = (require(27) /* metro dependency 27 */).View;
|
|
const entitlementStore = importDefault(5181) /* metro dependency 5181: EntitlementStore */;
|
|
const env0_5 = (require(661) /* metro dependency 661: Constants */).SubscriptionStatusTypes;
|
|
let value = require(33) /* metro dependency 33 */;
|
|
const env0_6 = value.jsx;
|
|
const env0_7 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object2 = {};
|
|
object2.title = {marginBottom: 12};
|
|
const object4 = {};
|
|
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object4.backgroundColor = BACKGROUND_SURFACE_HIGH;
|
|
object2.creditList = object4;
|
|
object2.creditItem = {'flexDirection': 'row', 'alignItems': 'center', 'padding': 16};
|
|
object2.textContainer = {'marginLeft': 16, 'marginRight': 16, 'flexDirection': 'column', 'flex': 1};
|
|
object2.headerText = {lineHeight: 20};
|
|
object2.subText = {lineHeight: 16};
|
|
object2.timeText = {'lineHeight': 20, 'alignSelf': 'flex-start'};
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
object2.divider = {borderBottomWidth: 1, borderBottomColor: BORDER_SUBTLE};
|
|
object2.creditDescription = {marginTop: 8};
|
|
const env0_8 = Reflect.apply(createStyles, value, [object2]);
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/PremiumAccountCredit.tsx');
|
|
exports.default = _default_60695;
|
|
}
|
|
|
|
function AccountCreditTier({planId, months, currentSubscription, shouldAddDivider, unconsumedFractionalPremiumUnits, hasPremiumGroup}) { // fn#60694, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7728:685, offset: 0x0170ac72, size: 967 bytes, params: 2, frame: 32
|
|
var r18;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var pauseEndsAt;
|
|
var Date;
|
|
var currentPeriodEnd;
|
|
var date;
|
|
const styles = useStyles();
|
|
const premiumUtilsModule = require(3802) /* metro dependency 3802: PremiumUtils */;
|
|
const castPremiumSubscriptionAsSkuId = premiumUtilsModule.castPremiumSubscriptionAsSkuId;
|
|
const defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
|
|
const getSkuIdForPlan = defaultImport.getSkuIdForPlan;
|
|
const value2 = Reflect.apply(castPremiumSubscriptionAsSkuId, premiumUtilsModule, [Reflect.apply(getSkuIdForPlan,
|
|
defaultImport, [planId])]);
|
|
const tierDisplayNameByPlanId = defaultImport.getTierDisplayNameByPlanId(planId);
|
|
if (hasPremiumGroup) {
|
|
r18 = intl.string((importDefault(2806) /* metro dependency 2806: PremiumGroupMessages */)['5asczk']);
|
|
} else if (currentSubscription == null) {
|
|
r18 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.eNXZ5O,
|
|
{planName: tierDisplayNameByPlanId});
|
|
} else if (currentSubscription.planId === planId) {
|
|
if (currentSubscription.status !== SubscriptionStatusTypes.PAUSED) {
|
|
Date = global.Date;
|
|
currentPeriodEnd = currentSubscription.currentPeriodEnd;
|
|
date = new Date();
|
|
} else {
|
|
pauseEndsAt = currentSubscription.pauseEndsAt;
|
|
if (pauseEndsAt != null) {
|
|
Date = global.Date;
|
|
pauseEndsAt = currentSubscription.pauseEndsAt;
|
|
date = new Date();
|
|
} else {
|
|
Date = global.Date;
|
|
currentPeriodEnd = currentSubscription.currentPeriodEnd;
|
|
date = new Date();
|
|
}
|
|
}
|
|
r18 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['5CNRRA'],
|
|
{date: premiumUtilsModule.extendDateWithUnconsumedFractionalPremium(undefined,
|
|
unconsumedFractionalPremiumUnits) ?? 0});
|
|
} else {
|
|
r18 = intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.eNXZ5O,
|
|
{planName: tierDisplayNameByPlanId});
|
|
}
|
|
let r14 = currentSubscription != null && currentSubscription.isPurchasedExternally;
|
|
const items3 = [styles.creditItem];
|
|
items3[1] = shouldAddDivider ? styles.divider : null;
|
|
const GameIcon = importDefault(6780) /* metro dependency 6780: GameIcon */;
|
|
const GameIconSizes = (require(6780) /* metro dependency 6780: GameIcon */).GameIconSizes;
|
|
const SMALL = GameIconSizes.SMALL;
|
|
const items2 = [<GameIcon size={SMALL} skuId={value2} />];
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const format = intl.format;
|
|
const LzobT9 = (require(1244) /* metro dependency 1244: indexNative */).t.LzobT9;
|
|
const text = <Text style={styles.headerText} variant="text-md/semibold" color="mobile-text-heading-primary">{Reflect.apply(format,
|
|
intl, [LzobT9, {planName: tierDisplayNameByPlanId}])}</Text>;
|
|
r14 = !r14 && <Text style={styles.subText} variant="text-xs/medium" color="text-default">{r18}</Text>;
|
|
items2[1] = <View style={styles.textContainer}>{text}{r14}</View>;
|
|
items2[2] = <Text style={styles.timeText} variant="text-md/medium" color="text-default">{intl.format((require(1244) /* metro dependency 1244: indexNative */).t['ess/xl'],
|
|
{count: months})}</Text>;
|
|
return (
|
|
<View style={items3}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function _default_60695({currentSubscription, entitlements, style, creditListContainerStyle, hasPremiumGroup}) { // fn#60695, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7728:1944, offset: 0x0170b039, size: 689 bytes, params: 2, frame: 31
|
|
var defaultImport2;
|
|
var Array;
|
|
var value7;
|
|
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
var string;
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
var items2;
|
|
const styles = useStyles();
|
|
const fluxModule = require(566) /* metro dependency 566: flux */;
|
|
const useStateFromStoresArray = fluxModule.useStateFromStoresArray;
|
|
let object = [EntitlementStore];
|
|
const env0_2 = Reflect.apply(useStateFromStoresArray, fluxModule, [object, function() {
|
|
return EntitlementStore.getUnactivatedFractionalPremiumUnits();
|
|
}]);
|
|
if (entitlements != null) {
|
|
var defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */;
|
|
if (defaultImport.hasAccountCredit(entitlements)) {
|
|
defaultImport2 = importDefault(22) /* metro dependency 22 */;
|
|
Array = global.Array;
|
|
value7 = defaultImport2(Array.from(entitlements)).filter(function({subscriptionPlanId, parentId,
|
|
consumed}) {
|
|
return subscriptionPlanId != null && parentId != null && !consumed;
|
|
}).groupBy(_fun60698).value();
|
|
object = {style: style};
|
|
string = intl.string;
|
|
items2 = [<Text style={styles.title} accessibilityRole="header" variant="eyebrow" color="text-default">{Reflect.apply(string,
|
|
|
|
|
|
intl, [t.YugZY0])}</Text>];
|
|
items2[1] = <View style={[styles.creditList,
|
|
creditListContainerStyle]}>{global.Object.keys(value7).map(_fun60699)}</View>;
|
|
string = intl.string;
|
|
items2[2] = <Text style={styles.creditDescription} variant="text-sm/medium">{Reflect.apply(string, intl,
|
|
[t.kNEjGm])}</Text>;
|
|
items2[3] = currentSubscription != null && currentSubscription.isPurchasedExternally ? <Text style={styles.creditDescription} variant="text-sm/medium">{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.azRP0E)}</Text> : null;
|
|
return (
|
|
<View {...object}>
|
|
{items2}
|
|
</View>
|
|
);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function _fun60698(a0) { // fn#60698, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7728:2308, offset: 0x0170b2fd, size: 11 bytes, params: 2, frame: 1
|
|
return a0.subscriptionPlanId;
|
|
}
|
|
|
|
function _fun60699(a0) { // fn#60699, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7728:2575, offset: 0x0170b308, size: 150 bytes, params: 2, frame: 17
|
|
let Object = global.Object;
|
|
const value2 = Object.keys(env0_3);
|
|
Object = global.Object;
|
|
return (
|
|
<AccountCreditTier
|
|
planId={a0}
|
|
months={env0_3[a0].length}
|
|
currentSubscription={currentSubscription}
|
|
shouldAddDivider={!(a0 === value2[Object.keys(env0_3).length - 1])}
|
|
unconsumedFractionalPremiumUnits={env0_2}
|
|
hasPremiumGroup={hasPremiumGroup}
|
|
key={a0}
|
|
/>
|
|
);
|
|
}
|
|
|