/* 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] */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */ import LocaleStore from '../../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */ import UseTheme from '../../../hooks/useTheme.tsx'; /* Metro dependency 4048 */ import ActionSheetActionCreators from '../../action_sheet/native/ActionSheetActionCreators.tsx'; /* Metro dependency 4080 */ import UseMountEffect from '../../../hooks/useMountEffect.tsx'; /* Metro dependency 4594 */ import IAPStoreAndroid from '../../../stores/native/IAPStore.android.tsx'; /* Metro dependency 5140 */ import UseInitialValue from '../../../hooks/useInitialValue.tsx'; /* Metro dependency 6518 */ import UseAnalyticsLocations from '../../app_analytics/useAnalyticsLocations.tsx'; /* Metro dependency 6771 */ import AnalyticsLocation from '../../app_analytics/AnalyticsLocation.tsx'; /* Metro dependency 6789 */ import FormSection from '../../../design/void/Form/native/FormSection.tsx'; /* Metro dependency 7330 */ import NativeCheckoutStoreProvider from '../../checkout/native/stores/NativeCheckoutStoreProvider.tsx'; /* Metro dependency 7335 */ 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 FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */ import * as NativeModule from '../../../design/void/native.tsx'; /* Metro dependency 1305 */ import * as FormConstantsModule from '../../../design/void/Form/native/FormConstants.tsx'; /* Metro dependency 1309 */ import * as PremiumUtilsModule from '../../../utils/PremiumUtils.tsx'; /* Metro dependency 3802 */ import * as PaymentConstantsModule from '../../payments/PaymentConstants.tsx'; /* Metro dependency 4095 */ import * as MobileWebRedirectCheckoutUtilsModule from '../../payments/utils/MobileWebRedirectCheckoutUtils.tsx'; /* Metro dependency 4247 */ import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */ import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */ import * as BottomSheetNativeModule from '../../../design/components/Sheet/native/BottomSheet.native.tsx'; /* Metro dependency 6275 */ import * as TextWithIOSLinkWorkaroundModule from '../../a11y/native/TextWithIOSLinkWorkaround.tsx'; /* Metro dependency 6766 */ import * as BlockedPaymentsCountryExperimentModule from '../../billing/experiments/BlockedPaymentsCountryExperiment.tsx'; /* Metro dependency 7035 */ import * as NativeCheckoutStoreModule from '../../checkout/native/NativeCheckoutStore.tsx'; /* Metro dependency 7042 */ import * as UsePremiumTrialOfferNativeModule from '../hooks/usePremiumTrialOffer.native.tsx'; /* Metro dependency 7062 */ import * as UseCheckoutPlanPriceStringModule from './hooks/useCheckoutPlanPriceString.tsx'; /* Metro dependency 7253 */ import * as HandlePremiumPurchaseAndroidModule from './handlePremiumPurchase.android.tsx'; /* Metro dependency 7254 */ import * as UsePremiumDiscountOfferAndroidModule from '../hooks/usePremiumDiscountOffer.android.tsx'; /* Metro dependency 7258 */ import * as PremiumBogoPromotionUtilsCommonModule from '../PremiumBogoPromotionUtilsCommon.tsx'; /* Metro dependency 7260 */ import * as PremiumAnalyticsUtilsModule from './PremiumAnalyticsUtils.tsx'; /* Metro dependency 7294 */ import * as PaymentFlowStartedTriggerPointModule from '../../experiments/trigger_points/PaymentFlowStartedTriggerPoint.tsx'; /* Metro dependency 7295 */ import * as UseDiscountedPremiumProductInfoModule from './hooks/useDiscountedPremiumProductInfo.tsx'; /* Metro dependency 7325 */ import * as UseBottomSheetRefModule from '../../../design/components/Sheet/native/useBottomSheetRef.tsx'; /* Metro dependency 7326 */ import * as ACOMExperimentsModule from '../../billing/native/ACOMExperiments.tsx'; /* Metro dependency 7334 */ 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 let env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let value = ReactNativeModule; const env0_6 = value.View; const env0_7 = value.ActivityIndicator; 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; 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; object = {}; object.body = {padding: 16}; object.headerText = {'paddingTop': 30, 'paddingHorizontal': 20}; object.contentSelectPlan = {marginBottom: 16}; object.contentActivated = {'alignItems': 'center', 'paddingTop': 40, 'paddingBottom': 56}; object.contentActivatedText = {'width': 328, 'marginTop': 16, 'textAlign': 'center'}; object.formTitle = {'paddingTop': 0, 'paddingLeft': 0}; object.formSectionBody = {backgroundColor: 'none'}; object.formSectionBodyWithNoTitle = {marginTop: -24}; object.planOptionRowContainer = {paddingHorizontal: 10}; object.planOptionContainer = {'display': 'flex', 'flexDirection': 'row', 'alignItems': 'center'}; object.planOptionPriceContainer = {'flexGrow': 1, 'flexShrink': 1, 'display': 'flex', 'flexDirection': 'column', 'alignItems': 'flex-end'}; object.planOptionDiscountContainer = {'display': 'flex', 'flexDirection': 'row', 'flexShrink': 1}; const object4 = {'display': 'flex', 'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'center', 'borderRadius': null, 'backgroundColor': null, 'paddingVertical': 2, 'paddingHorizontal': 8, 'marginRight': 8}; object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.lg; const GREEN_360 = (importDefault(697) /* metro dependency 697: native */).unsafe_rawColors.GREEN_360; object4.backgroundColor = GREEN_360; object.planOptionDiscount = object4; const WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE; object.planOptionDiscountWhite = {backgroundColor: WHITE}; object.planOptionDiscountText = {textTransform: 'uppercase'}; object.blockedPaymentContainer = {marginVertical: 40}; object.legalDisclaimerText = {marginTop: 16}; const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE; object.divider = {'height': 1, 'width': '100%', backgroundColor: BORDER_SUBTLE}; object.offerDividerMargin = {marginBottom: 8}; object.trialDisclaimer = {marginBottom: 8}; object.discountDisclaimer = {marginBottom: 20}; object.loadingIndicator = {marginVertical: 30}; object.discountSubTextContainer = {alignItems: 'flex-end'}; object.priceText = {flexShrink: 1}; const env0_33 = Reflect.apply(createStyles, value, [object]); const closure = function(a0) { var env0_0 = a0; return _fun55905; }; (FileImportTrackerModule).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 _fun55871(a0) { // fn#55871, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:6176, offset: 0x013b596a, size: 129 bytes, params: 2, frame: 18 const object = {}; object.name = ( ); object.value = a0.productId; return object; } } 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 = (TextModule).Text; const intl = (IndexNativeModule).intl; return ( {intl.string((IndexNativeModule).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 = (TextModule).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 object2; 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; object2 = {}; value = require(1856) /* metro dependency 1856: NumberUtils */; object2.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 object3; userIsEligibleForBogoPromotion = !(userIsEligibleForBogoPromotion === undefined) && userIsEligibleForBogoPromotion; const styles = useStyles(); const locale = LocaleStore.locale; let [property, env0_2] = Module00057(ReactModule.useState(0), 2); const useStateFromStores = FluxModule.useStateFromStores; let object = [IAPStoreAndroid]; const product = Reflect.apply(useStateFromStores, FluxModule, [object, function() { return IAPStoreAndroid.getProduct(premiumItem.productId); }]); const value7 = (UseCheckoutPlanPriceStringModule).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 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 = (TextModule).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']; object3 = {discountedPrice: r29}; r29 = discountOffer.discount?.userUsageLimit ?? 1; object3.numMonths = r29; r14 = ( {Reflect.apply(formatToPlainString, intl, [property, object3])} ); } 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 PlanOptionOnLayout({nativeEvent}) { // fn#55877, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7219:5460, owner: PlanOption.onLayout, offset: 0x013b6430, size: 46 bytes, params: 2, frame: 11 const height = nativeEvent.layout.height; if (height !== env0_1) { env0_2(height); } } } 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 = (ButtonNativeModule).Button; var intl; if (isPaymentSuccess) { intl = (require(1244) /* metro dependency 1244: indexNative */).intl; return (