Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
322 lines
15 KiB
TypeScript
322 lines
15 KiB
TypeScript
// Module ID: 13856
|
|
// Function ID: 13857
|
|
// Name: EntitlementGiftGroupCard
|
|
// Dependencies: [19, 17, 5015, 502, 11721, 4451, 5759, 1074, 1374, 21, 4788, 576, 4498, 11722, 4784, 1115, 5218, 7503, 9138, 1177, 7449, 11449, 7486, 13526, 13528, 13529, 13527, 13530, 13531, 13532, 13533, 11320, 13534, 13537, 13538, 13857, 504, 11733, 2]
|
|
|
|
// Module 13856 (EntitlementGiftGroupCard)
|
|
import nativeDefault from "native" /* 576 */;
|
|
import util from "util" /* 1115 */;
|
|
import Text_Text from "Text/Text" /* 4784 */;
|
|
import components_Button_Button from "components/Button/Button" /* 5218 */;
|
|
import GameIconDefault from "GameIcon" /* 7449 */;
|
|
import SlayerStorefrontUtils from "SlayerStorefrontUtils" /* 7503 */;
|
|
import SlayerStorefrontItemCardDefault from "SlayerStorefrontItemCard" /* 9138 */;
|
|
import _modDef11320 from "module_11320" /* 11320 */;
|
|
import GiftCodeActionCreatorsDefault from "GiftCodeActionCreators" /* 11722 */;
|
|
import SubscriptionUtils from "SubscriptionUtils" /* 11733 */;
|
|
import _modDef13526 from "module_13526" /* 13526 */;
|
|
import _modDef13527 from "module_13527" /* 13527 */;
|
|
import _modDef13528 from "module_13528" /* 13528 */;
|
|
import _modDef13529 from "module_13529" /* 13529 */;
|
|
import _modDef13530 from "module_13530" /* 13530 */;
|
|
import _modDef13531 from "module_13531" /* 13531 */;
|
|
import _modDef13532 from "module_13532" /* 13532 */;
|
|
import _modDef13533 from "module_13533" /* 13533 */;
|
|
import _modDef13534 from "module_13534" /* 13534 */;
|
|
import _modDef13537 from "module_13537" /* 13537 */;
|
|
import _modDef13538 from "module_13538" /* 13538 */;
|
|
import GiftCodeRowDefault from "GiftCodeRow" /* 13857 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ApplicationStore from "ApplicationStore" /* 5015 */;
|
|
import AuthenticationStore from "AuthenticationStore" /* 502 */;
|
|
import GiftCodeStore from "GiftCodeStore" /* 11721 */;
|
|
import SubscriptionPlanStore from "SubscriptionPlanStore" /* 4451 */;
|
|
import SKUStore from "SKUStore" /* 5759 */;
|
|
import initialize from "initialize" /* 504 */;
|
|
|
|
require = fn;
|
|
get_ActivityIndicator = fn(17);
|
|
({ View: closure_4, ActivityIndicator: hasOwnProperty, TouchableWithoutFeedback: metroRequire } = get_ActivityIndicator);
|
|
const PremiumConstants = fn(1374);
|
|
({ SubscriptionIntervalTypes: closure_11, PremiumSubscriptionSKUs: closure_12, PremiumGiftStyles: map1 } = PremiumConstants);
|
|
const jsxProd = fn(21);
|
|
({ jsx: closure_14, jsxs: closure_15 } = jsxProd);
|
|
const createStyles = fn(4788);
|
|
let obj2 = { giftGroupCard: { overflow: "hidden", marginTop: 8 }, giftGroupCardRefresh: { borderWidth: 1, borderColor: nativeDefault.colors.CARD_BORDER_DEFAULT, borderRadius: nativeDefault.radii.md, backgroundColor: nativeDefault.colors.TABLEROW_BACKGROUND_DEFAULT }, title: null, arrow: null, subtitle: null, titleContainer: null, groupCardHeader: null, groupCardHeaderLegacy: null, rowArrow: null, giftIcon: null, generateGiftRow: null, generateGiftRowLegacy: null, generateGiftRowText: null, generateGiftButton: null, loading: null, generateButtonContainer: null, groupCardHeaderOpen: null, groupCardHeaderOpenRefresh: null, subtitleContainer: null, socialLayerSubtitleContainer: null };
|
|
let obj3 = { borderWidth: 1, borderColor: nativeDefault.colors.CARD_BORDER_DEFAULT, borderRadius: nativeDefault.radii.md, backgroundColor: nativeDefault.colors.TABLEROW_BACKGROUND_DEFAULT };
|
|
obj2.title = { fontSize: 16, lineHeight: 20, fontFamily: fn(1074).Fonts.PRIMARY_SEMIBOLD, color: nativeDefault.colors.MOBILE_TEXT_HEADING_PRIMARY };
|
|
let obj4 = { fontSize: 16, lineHeight: 20, fontFamily: fn(1074).Fonts.PRIMARY_SEMIBOLD, color: nativeDefault.colors.MOBILE_TEXT_HEADING_PRIMARY };
|
|
obj2.arrow = { color: nativeDefault.colors.ICON_SUBTLE };
|
|
obj2.subtitle = { fontSize: 14, lineHeight: 18 };
|
|
obj2.titleContainer = { marginLeft: 8, flex: 1 };
|
|
obj2.groupCardHeader = { flexDirection: "row", alignItems: "center", justifyContent: "space-between", padding: 16 };
|
|
let obj5 = { color: nativeDefault.colors.ICON_SUBTLE };
|
|
obj2.groupCardHeaderLegacy = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH };
|
|
obj2.rowArrow = { height: 8, width: 12, marginRight: 8 };
|
|
let obj6 = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH };
|
|
obj2.giftIcon = { borderRadius: nativeDefault.radii.xs };
|
|
obj2.generateGiftRow = { padding: 8, flexDirection: "row", alignItems: "center", justifyContent: "space-between" };
|
|
const obj7 = { borderRadius: nativeDefault.radii.xs };
|
|
obj2.generateGiftRowLegacy = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH };
|
|
obj2.generateGiftRowText = { flexShrink: 1 };
|
|
obj2.generateGiftButton = { marginLeft: 12 };
|
|
obj2.loading = { marginTop: 8 };
|
|
obj2.generateButtonContainer = { flexGrow: 1, flexShrink: 0 };
|
|
let obj8 = { backgroundColor: nativeDefault.colors.BACKGROUND_SURFACE_HIGH };
|
|
obj2.groupCardHeaderOpen = { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWEST };
|
|
let obj9 = { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWEST };
|
|
obj2.groupCardHeaderOpenRefresh = { backgroundColor: nativeDefault.colors.BACKGROUND_MOD_MUTED };
|
|
obj2.subtitleContainer = { flexDirection: "row", alignItems: "center", gap: 4 };
|
|
obj2.socialLayerSubtitleContainer = { marginTop: 2 };
|
|
let closure_16 = createStyles.createLegacyClassComponentStyles(obj2);
|
|
const Component = noop.Component;
|
|
class EntitlementGiftGroupCard extends Component {
|
|
constructor() {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
closure_0 = applyArgumentsResult;
|
|
applyArgumentsResult._mountedAt = null;
|
|
applyArgumentsResult.state = { isOpen: false };
|
|
applyArgumentsResult.handleToggleOpen = function handleToggleOpen() {
|
|
const props = applyArgumentsResult.props;
|
|
let tmp2 = null != props.loadedAt;
|
|
({ skuId, subscriptionPlanId } = props);
|
|
if (tmp2) {
|
|
tmp2 = null != obj._mountedAt;
|
|
}
|
|
if (!tmp2) {
|
|
tmp2 = !tmp;
|
|
}
|
|
if (!tmp2) {
|
|
const userGiftCodesForSKU = GiftCodeActionCreatorsDefault.fetchUserGiftCodesForSKU(skuId, subscriptionPlanId);
|
|
}
|
|
applyArgumentsResult.setState({ isOpen: !applyArgumentsResult.state.isOpen });
|
|
};
|
|
applyArgumentsResult.handleGenerateGiftCode = function handleGenerateGiftCode() {
|
|
({ skuId, subscriptionPlanId, giftStyle } = applyArgumentsResult.props);
|
|
const giftCode = GiftCodeActionCreatorsDefault.createGiftCode(skuId, subscriptionPlanId, giftStyle);
|
|
};
|
|
return applyArgumentsResult;
|
|
}
|
|
}
|
|
const prototype = EntitlementGiftGroupCard.prototype;
|
|
prototype["componentDidMount"] = function componentDidMount() {
|
|
this._mountedAt = Date.now();
|
|
};
|
|
prototype["renderGenerateGiftCodeRow"] = function renderGenerateGiftCodeRow() {
|
|
const tmp = closure_16(this.context);
|
|
const obj = { style: tmp.generateGiftRow, children: null };
|
|
const obj2 = { variant: "text-xs/medium", color: "text-subtle", style: tmp.generateGiftRowText, children: null };
|
|
const intl = util.intl;
|
|
obj2.children = intl.string(util.t.lELyPj);
|
|
const items = [closure_1_14(Text_Text.Text, obj2), ];
|
|
const obj3 = { style: tmp.generateButtonContainer, children: null };
|
|
const obj4 = { style: tmp.generateGiftButton, children: null };
|
|
const obj5 = { text: null, size: "sm", onPress: null };
|
|
const intl2 = util.intl;
|
|
obj5.text = intl2.string(util.t["w4+/BA"]);
|
|
obj5.onPress = this.handleGenerateGiftCode;
|
|
obj4.children = closure_1_14(components_Button_Button.Button, obj5);
|
|
obj3.children = closure_1_14(React4, obj4);
|
|
items[1] = closure_1_14(React4, obj3);
|
|
obj.children = items;
|
|
return __initData(React4, obj);
|
|
};
|
|
prototype["renderHeader"] = function renderHeader(source, children) {
|
|
const tmp = closure_16(this.context);
|
|
const isOpen = this.state.isOpen;
|
|
({ entitlements, application, sku } = this.props);
|
|
let isGameItemSKUResult = SlayerStorefrontUtils.isGameItemSKU(sku);
|
|
if (isGameItemSKUResult) {
|
|
isGameItemSKUResult = null != application;
|
|
}
|
|
const obj2 = { accessibilityRole: "button", accessibilityState: { expanded: isOpen }, onPress: this.handleToggleOpen, children: null };
|
|
const items = [tmp.groupCardHeader, ];
|
|
let prop = null;
|
|
if (isOpen) {
|
|
prop = tmp.groupCardHeaderOpenRefresh;
|
|
}
|
|
const obj3 = { style: items, children: null };
|
|
items[1] = prop;
|
|
if (isGameItemSKUResult) {
|
|
const obj4 = { sku, size: null, containerStyle: null };
|
|
const tmp14 = SlayerStorefrontItemCardDefault;
|
|
obj4.size = tmp2(1177).getIconSize(tmp2(1177).Icon.Sizes.LARGE);
|
|
obj4.containerStyle = tmp.giftIcon;
|
|
let tmp6Result = tmp6(tmp14, obj4);
|
|
const tmp2Result = tmp2(1177);
|
|
} else {
|
|
tmp6Result = null;
|
|
if (null != source) {
|
|
const obj5 = { resizeMode: "contain", source, disableColor: true, size: tmp2(1177).Icon.Sizes.LARGE, style: tmp.giftIcon };
|
|
tmp6Result = tmp6(tmp2(1177).Icon, obj5);
|
|
}
|
|
}
|
|
const items1 = [tmp6Result, , ];
|
|
const obj6 = { style: tmp.titleContainer, children: null };
|
|
const items2 = [closure_1_14(Text_Text.Text, { variant: "heading-sm/semibold", color: "mobile-text-heading-primary", accessibilityRole: "header", children }), ];
|
|
let socialLayerSubtitleContainer = isGameItemSKUResult;
|
|
if (isGameItemSKUResult) {
|
|
socialLayerSubtitleContainer = tmp.socialLayerSubtitleContainer;
|
|
}
|
|
const obj8 = { style: null, children: null };
|
|
const items3 = [socialLayerSubtitleContainer, tmp.subtitleContainer];
|
|
obj8.style = items3;
|
|
let tmp6Result2 = isGameItemSKUResult;
|
|
if (isGameItemSKUResult) {
|
|
const obj9 = { game: application, size: GameIconDefault.Sizes.SIZE_24, skuId: sku.id };
|
|
tmp6Result2 = tmp6(GameIconDefault, obj9);
|
|
}
|
|
const items4 = [tmp6Result2, ];
|
|
const obj10 = { variant: "text-md/normal", color: "text-subtle", style: tmp.subtitle, children: null };
|
|
const intl = tmp2(1115).intl;
|
|
const format = intl.format;
|
|
const t = tmp2(1115).t;
|
|
if (isGameItemSKUResult) {
|
|
const obj11 = { applicationName: application.name, copies: entitlements.length };
|
|
let formatResult = format(t["6plpZi"], obj11);
|
|
} else {
|
|
const obj12 = { copies: entitlements.length };
|
|
formatResult = format(t.zMcvcA, obj12);
|
|
}
|
|
obj10.children = formatResult;
|
|
items4[1] = closure_1_14(Text_Text.Text, obj10);
|
|
obj8.children = items4;
|
|
items2[1] = __initData(React4, obj8);
|
|
obj6.children = items2;
|
|
items1[1] = __initData(React4, obj6);
|
|
if (isOpen) {
|
|
let ChevronSmallRightIcon = tmp2(11449).ChevronSmallDownIcon;
|
|
} else {
|
|
ChevronSmallRightIcon = tmp2(7486).ChevronSmallRightIcon;
|
|
}
|
|
items1[2] = closure_1_14(ChevronSmallRightIcon, {});
|
|
obj3.children = items1;
|
|
obj2.children = __initData(React4, obj3);
|
|
return closure_1_14(timestampProducer, obj2);
|
|
};
|
|
prototype["getCardHeaderThumbnail"] = function getCardHeaderThumbnail(id, giftStyle) {
|
|
if (constants2.STANDARD_BOX === giftStyle) {
|
|
return _modDef13526;
|
|
} else if (tmp.CAKE === giftStyle) {
|
|
return _modDef13528;
|
|
} else if (tmp.CHEST === giftStyle) {
|
|
return _modDef13529;
|
|
} else if (tmp.COFFEE === giftStyle) {
|
|
return _modDef13527;
|
|
} else if (tmp.SEASONAL_STANDARD_BOX === giftStyle) {
|
|
return _modDef13530;
|
|
} else if (tmp.SEASONAL_CAKE === giftStyle) {
|
|
return _modDef13531;
|
|
} else if (tmp.SEASONAL_CHEST === giftStyle) {
|
|
return _modDef13532;
|
|
} else if (tmp.SEASONAL_COFFEE === giftStyle) {
|
|
return _modDef13533;
|
|
} else if (tmp.NITROWEEN_STANDARD === giftStyle) {
|
|
const obj = { uri: _modDef11320 };
|
|
return obj;
|
|
} else if (TIER_0.TIER_0 === id) {
|
|
return _modDef13534;
|
|
} else if (tmp3.TIER_1 === id) {
|
|
return _modDef13537;
|
|
} else {
|
|
if (tmp3.TIER_2 !== id) {
|
|
if (tmp3.LEGACY !== id) {
|
|
return null;
|
|
}
|
|
}
|
|
return _modDef13538;
|
|
}
|
|
};
|
|
prototype["renderCardHeader"] = function renderCardHeader(sku) {
|
|
const self = this;
|
|
const props = this.props;
|
|
({ application, subscriptionPlan } = props);
|
|
({ id, name } = sku);
|
|
const cardHeaderThumbnail = this.getCardHeaderThumbnail(id, props.giftStyle);
|
|
const values = Object.values(TIER_0);
|
|
if (values.includes(id)) {
|
|
if (null == subscriptionPlan) {
|
|
return null;
|
|
} else {
|
|
const intl = util.intl;
|
|
if (subscriptionPlan.interval === constants.MONTH) {
|
|
let Vd3Iu8 = tmp4(1115).t.rCJvqo;
|
|
} else {
|
|
Vd3Iu8 = tmp4(1115).t.Vd3Iu8;
|
|
}
|
|
const obj = { skuName: sku.name, intervalCount: subscriptionPlan.intervalCount };
|
|
return self.renderHeader(cardHeaderThumbnail, intl.formatToPlainString(Vd3Iu8, obj));
|
|
}
|
|
} else {
|
|
let renderHeaderResult = null;
|
|
if (null != application) {
|
|
let iconSource = application.getIconSource(32);
|
|
if (iconSource == null) {
|
|
iconSource = cardHeaderThumbnail;
|
|
}
|
|
renderHeaderResult = self.renderHeader(iconSource, name);
|
|
}
|
|
return renderHeaderResult;
|
|
}
|
|
};
|
|
prototype["render"] = function render() {
|
|
const self = this;
|
|
let loading = closure_16(this.context);
|
|
const props = this.props;
|
|
({ giftCodes, sku } = props);
|
|
const obj = { style: null, children: null };
|
|
const items = [, ];
|
|
({ giftGroupCard: arr[0], giftGroupCardRefresh: arr[1] } = loading);
|
|
obj.style = items;
|
|
({ entitlements, isFetching } = props);
|
|
const items1 = [this.renderCardHeader(sku), ];
|
|
if (!this.state.isOpen) {
|
|
items1[1] = null;
|
|
obj.children = items1;
|
|
return tmp(tmp2, obj);
|
|
} else {
|
|
if (isFetching) {
|
|
const obj2 = { style: null };
|
|
loading = loading.loading;
|
|
obj2.style = loading;
|
|
let tmpResult = tmp3(closure_5, obj2);
|
|
} else {
|
|
let result = null;
|
|
if (giftCodes.length < entitlements.length) {
|
|
result = self.renderGenerateGiftCodeRow();
|
|
}
|
|
const obj3 = { children: null };
|
|
const items2 = [result, giftCodes.map((giftCode, index) => closure_2_14(GiftCodeRowDefault, { giftCode, sku, isFirst: 0 === index }, giftCode.code))];
|
|
obj3.children = items2;
|
|
tmpResult = tmp(noop.Fragment, obj3);
|
|
}
|
|
const obj4 = { children: tmpResult };
|
|
closure_14(tmp2, obj4);
|
|
}
|
|
};
|
|
EntitlementGiftGroupCard.contextType = fn(4498).ThemeContext;
|
|
let items = [AuthenticationStore, SKUStore, ApplicationStore, GiftCodeStore, SubscriptionPlanStore];
|
|
let obj10 = { backgroundColor: nativeDefault.colors.BACKGROUND_MOD_MUTED };
|
|
const size = fn(2);
|
|
let result = size.fileFinishedImporting("components_native/premium/EntitlementGiftGroupCard.tsx");
|
|
|
|
export default initialize.connectStores(items, (arg0) => {
|
|
({ skuId, subscriptionPlanId, giftStyle: require } = arg0);
|
|
value = SKUStore.get(skuId);
|
|
if (null == value) {
|
|
const _Error = Error;
|
|
const error = new Error("SKU was unavailable while rendering gift.");
|
|
throw error;
|
|
} else {
|
|
const obj2 = { sku: value, isFetching: GiftCodeStore.getUserGiftCodesFetchingForSKUAndPlan(skuId, subscriptionPlanId), loadedAt: GiftCodeStore.getUserGiftCodesLoadedAtForSKUAndPlan(skuId, subscriptionPlanId), application: ApplicationStore.getApplication(value.applicationId), subscriptionPlan: null, giftCodes: null };
|
|
let orFetchSubscriptionPlan = null;
|
|
if (null != subscriptionPlanId) {
|
|
orFetchSubscriptionPlan = SubscriptionUtils.getOrFetchSubscriptionPlan(subscriptionPlanId);
|
|
}
|
|
obj2.subscriptionPlan = orFetchSubscriptionPlan;
|
|
const forGifterSKUAndPlan = GiftCodeStore.getForGifterSKUAndPlan(AuthenticationStore.getId(), skuId, subscriptionPlanId);
|
|
const found = forGifterSKUAndPlan.filter((isClaimed) => !isClaimed.isClaimed);
|
|
obj2.giftCodes = found.filter((giftStyle) => giftStyle.giftStyle === require);
|
|
return obj2;
|
|
}
|
|
})(EntitlementGiftGroupCard);
|