/* Metro module 7041; source: modules/premium/native/PremiumPlanSelectionActionSheet.tsx; dependencies: [5, 57, 31, 27, 7042, 1949, 5140, 7039, 1880, 661, 1309, 4095, 482, 33, 4501, 697, 4573, 1244, 44, 7046, 1856, 566, 7253, 3802, 5137, 4578, 7254, 7035, 4048, 7062, 7258, 7260, 7027, 7325, 7326, 6771, 6789, 6518, 7294, 4247, 4594, 7295, 4080, 683, 7023, 1581, 4496, 7256, 4223, 4002, 7314, 7315, 7316, 7317, 7318, 7319, 477, 6766, 1948, 6275, 7327, 6515, 5475, 7330, 7333, 1305, 7334, 7335, 2] */ function _fun55868(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#55868, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:6, offset: 0x013b5481, size: 1116 bytes, params: 8, frame: 29 var object2; let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importDefault(57) /* metro dependency 57 */; const env0_5 = importAll(31) /* metro dependency 31 */; let value = require(27) /* metro dependency 27 */; const env0_6 = value.View; const env0_7 = value.ActivityIndicator; const env0_8 = (require(7042) /* metro dependency 7042: NativeCheckoutStore */).useNativeCheckoutStore; const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */; const iapStoreAndroid = importDefault(5140) /* metro dependency 5140: IAPStoreAndroid */; value = require(7039) /* metro dependency 7039: PremiumPlanPurchasedStore */; const env0_11 = value.setInitiatedPurchaseFromNewFlow; const env0_12 = value.setMobileWebRedirectCheckoutStatus; const env0_13 = value.usePremiumPlanPurchasedStore; const env0_14 = value.reset; value = require(1880) /* metro dependency 1880: PremiumConstants */; const env0_15 = value.DISCOUNTS; const env0_16 = value.PremiumTypes; const env0_17 = value.SubscriptionIntervalTypes; const env0_18 = value.SubscriptionPlans; const env0_19 = value.SubscriptionPlanInfo; const env0_20 = value.PremiumSubscriptionSKUs; value = require(661) /* metro dependency 661: Constants */; const env0_21 = value.AnalyticEvents; const env0_22 = value.AnalyticsObjects; const env0_23 = value.AnalyticsObjectTypes; const env0_24 = value.MarketingURLs; const env0_25 = value.HelpdeskArticles; const env0_26 = (require(1309) /* metro dependency 1309: FormConstants */).TitleStyleType; const env0_27 = (require(4095) /* metro dependency 4095: PaymentConstants */).EUR_TO_HRK_CONVERSION_RATE; value = require(482) /* metro dependency 482: Constants */; const env0_28 = value.CurrencyCodes; const env0_29 = value.PaymentGateways; value = require(33) /* metro dependency 33 */; const env0_30 = value.jsx; const env0_31 = value.jsxs; const env0_32 = value.Fragment; value = require(4501) /* metro dependency 4501: createStyles */; const createStyles = value.createStyles; object2 = {}; object2.body = {padding: 16}; object2.headerText = {'paddingTop': 30, 'paddingHorizontal': 20}; object2.contentSelectPlan = {marginBottom: 16}; object2.contentActivated = {'alignItems': 'center', 'paddingTop': 40, 'paddingBottom': 56}; object2.contentActivatedText = {'width': 328, 'marginTop': 16, 'textAlign': 'center'}; object2.formTitle = {'paddingTop': 0, 'paddingLeft': 0}; object2.formSectionBody = {backgroundColor: 'none'}; object2.formSectionBodyWithNoTitle = {marginTop: -24}; object2.planOptionRowContainer = {paddingHorizontal: 10}; object2.planOptionContainer = {'display': 'flex', 'flexDirection': 'row', 'alignItems': 'center'}; object2.planOptionPriceContainer = {'flexGrow': 1, 'flexShrink': 1, 'display': 'flex', 'flexDirection': 'column', 'alignItems': 'flex-end'}; object2.planOptionDiscountContainer = {'display': 'flex', 'flexDirection': 'row', 'flexShrink': 1}; const object3 = {'display': 'flex', 'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'center', 'borderRadius': null, 'backgroundColor': null, 'paddingVertical': 2, 'paddingHorizontal': 8, 'marginRight': 8}; object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg; const GREEN_360 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_360; object3.backgroundColor = GREEN_360; object2.planOptionDiscount = object3; const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object2.planOptionDiscountWhite = {backgroundColor: WHITE}; object2.planOptionDiscountText = {textTransform: 'uppercase'}; object2.blockedPaymentContainer = {marginVertical: 40}; object2.legalDisclaimerText = {marginTop: 16}; const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE; object2.divider = {'height': 1, 'width': '100%', backgroundColor: BORDER_SUBTLE}; object2.offerDividerMargin = {marginBottom: 8}; object2.trialDisclaimer = {marginBottom: 8}; object2.discountDisclaimer = {marginBottom: 20}; object2.loadingIndicator = {marginVertical: 30}; object2.discountSubTextContainer = {alignItems: 'flex-end'}; object2.priceText = {flexShrink: 1}; const env0_33 = Reflect.apply(createStyles, value, [object2]); const closure = function(a0) { var env0_0 = a0; return _fun55905; }; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/premium/native/PremiumPlanSelectionActionSheet.tsx'); exports.default = PremiumPlanSelectionActionSheetWithOrderCTX; exports.getItemsByPremiumTypePredicate = closure; } function getPlanOptions(a0, a1, a2, a3, a4, a5, a6, a7) { // fn#55869, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:6073, offset: 0x013b58dd, size: 130 bytes, params: 9, frame: 13 const env0_0 = a1; const env0_1 = a2; const env0_2 = a3; const env0_3 = a4; const env0_4 = a5; const env0_5 = a6; const env0_6 = a7; const Set = global.Set; const value = a0.map(function(a0) { return a0.premiumTier; }); const value2 = Object.create(Set.prototype, {constructor: {value: Set}}); const set = new Set(value); const result = (set instanceof Object ? set : value2).size > 1; return a0.map(_fun55871); } function Header_55872({premiumType, isPaymentSuccess, selectedPremiumType, trialOffer, discountOffer}) { // fn#55872, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:2196, offset: 0x013b59eb, size: 252 bytes, params: 2, frame: 25 var r6; const styles = useStyles(); if (premiumType != null) { r6 = isPaymentSuccess ? selectedPremiumType : premiumType; (importDefault(44) /* metro dependency 44 */)(r6 != null, 'If isPaymentSuccess is true, a value must be given for selectedPremiumType. Or premiumType must be given.'); return ((Component) => )(importDefault(7046) /* metro dependency 7046: PremiumPlanActionSheetHeader */); } if (isPaymentSuccess) { r6 = isPaymentSuccess ? selectedPremiumType : premiumType; (importDefault(44) /* metro dependency 44 */)(r6 != null, 'If isPaymentSuccess is true, a value must be given for selectedPremiumType. Or premiumType must be given.'); return ((Component) => )(importDefault(7046) /* metro dependency 7046: PremiumPlanActionSheetHeader */); } const Text = (require(4573) /* metro dependency 4573: Text */).Text; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; return ( {intl.string((require(1244) /* metro dependency 1244: indexNative */).t.vLz3Zs)} ); } function PlanOptionBadgeComponent({text, backgroundColorType}) { // fn#55873, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:2708, offset: 0x013b5ae7, size: 178 bytes, params: 2, frame: 20 backgroundColorType = backgroundColorType === undefined ? 'green' : backgroundColorType; const styles = useStyles(); const items2 = [styles.planOptionDiscount]; const value2 = backgroundColorType === 'white'; items2[1] = value2 ? styles.planOptionDiscountWhite : null; const Text = (require(4573) /* metro dependency 4573: Text */).Text; return ( {text} ); } function renderPlanOptionBadge({customBadgeComponent, discount, userLocale, showBogoPromotionBadge, hideDefaultDiscountBadges}) { // fn#55874, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:3004, offset: 0x013b5b99, size: 276 bytes, params: 2, frame: 25 var r2; var r1; var r0; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; var format; var IAybsG; var object; let value = null; if (value != customBadgeComponent) { r0 = customBadgeComponent; } else { if (hideDefaultDiscountBadges) { r1 = value; } else { if (showBogoPromotionBadge) { r2 = ; } else if (value != discount) { format = intl.format; IAybsG = (require(1244) /* metro dependency 1244: indexNative */).t.IAybsG; object = {}; value = require(1856) /* metro dependency 1856: NumberUtils */; object.discount = value.formatPercent(userLocale, discount / 100); value = ; r2 = value; } else { r2 = value; } r1 = r2; } r0 = r1; } return r0; } function PlanOption({premiumItem, selectedProductId, optionNeedsProductNameLabel, customBadgeComponent, trialOffer, discountOffer, discountedPriceString, userIsEligibleForBogoPromotion, selectedPremiumType}) { // fn#55875, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:3345, offset: 0x013b5cad, size: 1890 bytes, params: 2, frame: 47 var sku_id; var r10; var r29; var r27; var r14; var defaultImport; var moduleValue4; const intl = (require(1244) /* metro dependency 1244: indexNative */).intl; var formatToPlainString; var hXcaLT; var object2; userIsEligibleForBogoPromotion = !(userIsEligibleForBogoPromotion === undefined) && userIsEligibleForBogoPromotion; const styles = useStyles(); const locale = LocaleStore.locale; let [property, env0_2] = env0_4(env0_5.useState(0), 2); const fluxModule = require(566) /* metro dependency 566: flux */; const useStateFromStores = fluxModule.useStateFromStores; let object = [IAPStoreAndroid]; const product = Reflect.apply(useStateFromStores, fluxModule, [object, function() { return IAPStoreAndroid.getProduct(premiumItem.productId); }]); const value7 = (require(7253) /* metro dependency 7253: useCheckoutPlanPriceString */).useCheckoutPlanPriceString(premiumItem.productId, product); const value9 = trialOffer != null; if (value9) { sku_id = trialOffer.subscription_trial?.sku_id; defaultImport = importDefault(3802) /* metro dependency 3802: PremiumUtils */; r10 = sku_id === defaultImport.getSkuIdForPremiumType(premiumItem.premiumTier); } else { r10 = value9; } const premiumUtilsModule = require(3802) /* metro dependency 3802: PremiumUtils */; const getTierDisplayNameByPlanId = premiumUtilsModule.getTierDisplayNameByPlanId; let basePlanId = premiumItem.basePlanId; const value11 = Reflect.apply(getTierDisplayNameByPlanId, premiumUtilsModule, [basePlanId]); const intervalString = (importDefault(3802) /* metro dependency 3802: PremiumUtils */).getIntervalString(premiumItem.interval, false); basePlanId = premiumItem.basePlanId; const PREMIUM_YEAR_TIER_2 = SubscriptionPlans.PREMIUM_YEAR_TIER_2; const value13 = basePlanId === PREMIUM_YEAR_TIER_2; let r28 = r10 || discountOffer != null; r28 = !r28 ? userIsEligibleForBogoPromotion && value13 : r28; const r30 = r28 ? null : DISCOUNTS[premiumItem.basePlanId]; const r16 = userIsEligibleForBogoPromotion && premiumItem.basePlanId === SubscriptionPlans.PREMIUM_MONTH_TIER_2; const value16 = premiumItem.productId === selectedProductId; const r24 = product == null ? CurrencyCodes.USD : product.currencyCode.toLowerCase() in CurrencyCodes ? product.currencyCode.toLowerCase() : CurrencyCodes.USD; const property3 = SubscriptionPlanInfo[premiumItem.basePlanId]; if (discountedPriceString != null) { moduleValue4 = require(5137) /* metro dependency 5137: PriceUtils */; r29 = moduleValue4.formatRate(discountedPriceString, property3.interval, property3.intervalCount); } else { r29 = null; } if (r10) { formatToPlainString = intl.formatToPlainString; hXcaLT = (require(1244) /* metro dependency 1244: indexNative */).t.hXcaLT; object = {}; object.price = (require(5137) /* metro dependency 5137: PriceUtils */).formatPrice(0, r24, {'minimumFractionDigits': 0, 'maximumFractionDigits': 0}); r27 = Reflect.apply(formatToPlainString, intl, [hXcaLT, object]); } else { r27 = discountedPriceString ?? (value7 ?? '$...'); } const priceUtilsModule = require(5137) /* metro dependency 5137: PriceUtils */; const value22 = '$...'; const value23 = priceUtilsModule.formatRate(value7 ?? value22, property3.interval, property3.intervalCount); const r8 = property > 0 ? [styles.planOptionPriceContainer, {transform: [{translateY: property / 2}]}] : styles.planOptionPriceContainer; const Text = (require(4573) /* metro dependency 4573: Text */).Text; const value26 = 'interactive-text-default'; const text = {optionNeedsProductNameLabel ? '' + value11 + ' ' + intervalString : intervalString}; const view = {renderPlanOptionBadge({userLocale: locale, discount: r30, hideDefaultDiscountBadges: r28, customBadgeComponent: customBadgeComponent, showBogoPromotionBadge: r16})}{r27}; const r9 = r10 ? {premiumItem.interval === SubscriptionIntervalTypes.YEAR ? intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.ECT4A5, {price: value7 ?? value22}) : intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t.v9QeON, {price: value7 ?? value22})} : null; const viewBinding3Props = {style: styles.discountSubTextContainer, onLayout: onLayout_55877}; if (r29 != null) { if (discountOffer != null) { if (selectedPremiumType == null) { var textProps = {variant: 'text-sm/medium', color: value16 ? 'text-default' : value26}; formatToPlainString = intl.formatToPlainString; property = (require(1244) /* metro dependency 1244: indexNative */).t['02Gmgm']; object2 = {discountedPrice: r29}; r29 = discountOffer.discount?.userUsageLimit ?? 1; object2.numMonths = r29; r14 = {Reflect.apply(formatToPlainString, intl, [property, object2])}; } else { r14 = null; } } else { r14 = null; } } else { r14 = null; } return ( {text} {view} {r9} {r14} {discountedPriceString != null && discountOffer != null && {intl.formatToPlainString((require(1244) /* metro dependency 1244: indexNative */).t['vZk+c/'], {regularPrice: value23, numMonths: discountOffer.discount?.userUsageLimit ?? 1})}} ); } function PremiumPlanSelectionActionSheetCTA({isPaymentSuccess, onClose, ctaText, onStartPayment, shouldUseMobileWebRedirectCheckout, disabled, loading}) { // fn#55878, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:6456, offset: 0x013b645e, size: 307 bytes, params: 2, frame: 19 const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button; var intl; if (isPaymentSuccess) { intl = (require(1244) /* metro dependency 1244: indexNative */).intl; return (