220 lines
12 KiB
TypeScript
220 lines
12 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] */
|
|
import PremiumUtils from '../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */
|
|
import EntitlementStore from '../../../stores/game_store/EntitlementStore.tsx'; /* Metro dependency 5181 */
|
|
import GameIcon from '../../game_detection/native/GameIcon.tsx'; /* Metro dependency 6780 */
|
|
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as PremiumUtilsModule from '../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */
|
|
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as GameIconModule from '../../game_detection/native/GameIcon.tsx'; /* Metro dependency 6780 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
ReactModule;
|
|
let value = JsxRuntimeModule;
|
|
const env0_6 = value.jsx;
|
|
const env0_7 = value.jsxs;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
object = {};
|
|
object.title = {marginBottom: 12};
|
|
const object3 = {};
|
|
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.xs;
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object3.backgroundColor = BACKGROUND_SURFACE_HIGH;
|
|
object.creditList = object3;
|
|
object.creditItem = {'flexDirection': 'row', 'alignItems': 'center', 'padding': 16};
|
|
object.textContainer = {'marginLeft': 16, 'marginRight': 16, 'flexDirection': 'column', 'flex': 1};
|
|
object.headerText = {lineHeight: 20};
|
|
object.subText = {lineHeight: 16};
|
|
object.timeText = {'lineHeight': 20, 'alignSelf': 'flex-start'};
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
object.divider = {borderBottomWidth: 1, borderBottomColor: BORDER_SUBTLE};
|
|
object.creditDescription = {marginTop: 8};
|
|
const env0_8 = Reflect.apply(createStyles, value, [object]);
|
|
(FileImportTrackerModule).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 castPremiumSubscriptionAsSkuId = PremiumUtilsModule.castPremiumSubscriptionAsSkuId;
|
|
const defaultImport = 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 GameIconSizes = (GameIconModule).GameIconSizes;
|
|
const SMALL = GameIconSizes.SMALL;
|
|
const items2 = [
|
|
<GameIcon size={SMALL} skuId={value2} />,
|
|
];
|
|
const Text = (TextModule).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 = (TextModule).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 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 _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(ReactNativeModule.View);
|
|
Object = global.Object;
|
|
return (
|
|
<AccountCreditTier
|
|
planId={a0}
|
|
months={ReactNativeModule.View[a0].length}
|
|
currentSubscription={currentSubscription}
|
|
shouldAddDivider={!(a0 === value2[Object.keys(ReactNativeModule.View).length - 1])}
|
|
unconsumedFractionalPremiumUnits={env0_2}
|
|
hasPremiumGroup={hasPremiumGroup}
|
|
key={a0}
|
|
/>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
global.__d(_fun60693, 7550, [31, 27, 5181, 661, 33, 4501, 697, 3802, 1244, 2806, 6780, 4573, 566, 22,
|
|
2]) /* metro module 7550, dependencies: [31, 27, 5181, 661, 33, 4501, 697, 3802, 1244, 2806, 6780, 4573, 566, 22, 2] */;
|