2026-07-25 08:10:48 +00:00
// Module ID: 6509
2026-07-27 11:26:19 +00:00
// Function ID: 58169
2026-07-20 16:05:17 +00:00
// Name: _createForOfIteratorHelperLoose
2026-07-25 08:10:48 +00:00
// Dependencies: [5, 1316, 6208, 6207, 1852, 653, 4156, 3977, 507, 477, 675, 1360, 1334, 21, 1336, 6209, 2]
2026-07-20 16:05:17 +00:00
// Exports: claimOutboundPromotion, getClaimedEndedOutboundPromotions, getClaimedOutboundPromotionCodeMap, getOutboundPromotionRedemptionUrl, getPromotionImageURL, shouldShowOutboundPromotionNotice
2026-07-25 08:10:48 +00:00
// Module 6509 (_createForOfIteratorHelperLoose)
2026-07-23 10:11:24 +00:00
import closure_3 from "ME" ;
import _isNativeReflectConstruct from "_isNativeReflectConstruct" ;
import closure_5 from "_isNativeReflectConstruct" ;
import closure_6 from "_isNativeReflectConstruct" ;
import { PromotionFlags } from "GuildFeatures" ;
import ME from "ME" ;
import { ActivityPlatform } from "items3" ;
let closure_10 ;
let closure_8 ;
let closure_9 ;
const require = arg1 ;
function _createForOfIteratorHelperLoose ( iterable ) {
let closure_0 = iterable ;
iterable = "undefined" !== typeof Symbol ;
if ( iterable ) {
2026-07-20 16:05:17 +00:00
const _Symbol = Symbol ;
2026-07-23 10:11:24 +00:00
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( ! iterable ) {
iterable = iterable [ Symbol . iterator ] ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
if ( iterable ) {
const iter = iterable . call ( iterable ) ;
2026-07-20 16:05:17 +00:00
const next = iter . next ;
return next . bind ( iter ) ;
} else {
const _Array = Array ;
2026-07-23 10:11:24 +00:00
let tmp = iterable ;
if ( ! Array . isArray ( iterable ) ) {
2026-07-20 16:05:17 +00:00
let tmp2 ;
2026-07-23 10:11:24 +00:00
if ( iterable ) {
if ( "string" === typeof iterable ) {
tmp2 = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
const toString = { } . toString ;
2026-07-23 10:11:24 +00:00
const substr = toString . call ( iterable ) . slice ( 8 , - 1 ) ;
2026-07-20 16:05:17 +00:00
let name = substr ;
if ( tmp3 ) {
2026-07-23 10:11:24 +00:00
name = iterable . constructor . name ;
2026-07-20 16:05:17 +00:00
}
if ( "Map" !== name ) {
if ( "Set" !== name ) {
if ( "Arguments" === name ) {
2026-07-23 10:11:24 +00:00
let arr = _arrayLikeToArray ( iterable , undefined ) ;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
let obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/ ;
2026-07-20 16:05:17 +00:00
}
}
tmp2 = arr ;
}
const _Array2 = Array ;
2026-07-23 10:11:24 +00:00
arr = Array . from ( iterable ) ;
const callResult = toString . call ( iterable ) ;
tmp3 = "Object" === substr && iterable . constructor ;
2026-07-20 16:05:17 +00:00
}
}
tmp = tmp2 ;
if ( ! tmp2 ) {
const _TypeError = TypeError ;
const typeError = new TypeError ( "Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method." ) ;
throw typeError ;
}
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
closure_0 = tmp ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
let c1 = 0 ;
2026-07-20 16:05:17 +00:00
return ( ) = > {
2026-07-23 10:11:24 +00:00
if ( closure_1 >= length . length ) {
2026-07-20 16:05:17 +00:00
let obj = { done : true } ;
} else {
obj = { done : false } ;
closure_1 = tmp3 + 1 ;
2026-07-23 10:11:24 +00:00
obj . value = length [ + closure_1 ] ;
2026-07-20 16:05:17 +00:00
}
return obj ;
} ;
}
}
function _arrayLikeToArray ( arg0 , arg1 ) {
let length ;
if ( tmp ) {
length = arg0 . length ;
}
const ArrayResult = Array ( length ) ;
for ( let num = 0 ; num < length ; num = num + 1 ) {
ArrayResult [ num ] = arg0 [ num ] ;
}
return ArrayResult ;
}
function claimedOutboundPromotionCodeFromServer ( code ) {
return { code : code.code , userId : code.user_id , claimedAt : code.claimed_at , promotion : closure_5.createFromServer ( code . promotion ) } ;
}
async function _claimOutboundPromotion ( arg0 , arg1 ) {
2026-07-23 10:11:24 +00:00
let iter = ( function * ( arg0 ) {
2026-07-20 16:05:17 +00:00
let analyticsLocations ;
let partnerId ;
let promotionId ;
let promotionTitle ;
( { promotionId , promotionTitle , partnerId , analyticsLocations } = arg0 ) ;
yield undefined ;
2026-07-23 10:11:24 +00:00
const HTTP = outer2_0 ( outer2_2 [ 8 ] ) . HTTP ;
let obj = { url : outer2_9.CLAIM_OUTBOUND_PROMOTION_CODE ( promotionId ) , rejectWithError : outer2_0 ( outer2_2 [ 8 ] ) . rejectWithMigratedError ( ) } ;
2026-07-20 16:05:17 +00:00
const tmp2 = yield HTTP . post ( obj ) ;
2026-07-23 10:11:24 +00:00
const obj2 = outer2_0 ( outer2_2 [ 8 ] ) ;
const obj3 = outer2_0 ( outer2_2 [ 9 ] ) ;
const tmp4 = outer2_0 ( outer2_2 [ 9 ] ) . isIOS ( ) ? outer2_10.IOS : outer2_10.ANDROID ;
2026-07-20 16:05:17 +00:00
obj = { platform : tmp4 , status : tmp2.status , location_stack : analyticsLocations , promotion_id : promotionId } ;
let tmp5 = null ;
if ( null != promotionTitle ) {
tmp5 = promotionTitle ;
}
obj . name = tmp5 ;
let tmp6 = null ;
if ( null != partnerId ) {
tmp6 = partnerId ;
}
obj . partner = tmp6 ;
2026-07-23 10:11:24 +00:00
outer2_1 ( outer2_2 [ 10 ] ) . track ( outer2_8 . OUTBOUND_PROMOTION_CLAIMED , obj ) ;
return outer2_13 ( tmp2 . body ) ;
} ) ( ) ;
iter . next ( ) ;
return iter ;
2026-07-20 16:05:17 +00:00
}
function getNextUnseenOutboundPromotionId() {
const outboundPromotions = closure_6 . outboundPromotions ;
2026-07-23 10:11:24 +00:00
const _require = closure_6 . consumedInboundPromotionId ;
2026-07-20 16:05:17 +00:00
const found = outboundPromotions . filter ( ( id ) = > {
let tmp = id . id !== callback ;
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = ! callback ( outer1_2 [ 11 ] ) . hasFlag ( id . flags , outer1_7 . SUPPRESS_NOTIFICATION ) ;
const obj = callback ( outer1_2 [ 11 ] ) ;
2026-07-20 16:05:17 +00:00
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = ! outer1_16 ( id ) ;
2026-07-20 16:05:17 +00:00
}
return tmp ;
} ) ;
const userContent = settings . settings . userContent ;
let prop ;
if ( null != userContent ) {
2026-07-23 10:11:24 +00:00
const tmp4 = userContent . recurringDismissibleContentStates [ _require ( undefined , 1334 ) . DismissibleContent . THIRD_PARTY_OUTBOUND_PROMO_NAGBAR ] ;
if ( null != tmp4 ) {
2026-07-20 16:05:17 +00:00
prop = tmp4 . lastDismissedObjectId ;
}
}
let found1 = found ;
if ( null != prop ) {
2026-07-23 10:11:24 +00:00
found1 = found . filter ( ( id ) = > 1 === prop ( outer1_2 [ 13 ] ) . compare ( id . id , prop ) ) ;
2026-07-20 16:05:17 +00:00
}
let id = null ;
if ( 0 !== found1 . length ) {
id = found1 . sort ( ( startDate , startDate2 ) = > {
const date = new Date ( startDate . startDate ) ;
let num = 1 ;
if ( date < date1 ) {
num = - 1 ;
}
return num ;
} ) [ 0 ] . id ;
}
return id ;
}
function isLogitechPromotion ( promotion ) {
2026-07-25 08:10:48 +00:00
return promotion . partnerId === require ( 6209 ) /* CountryListMode */ . LOGITECH_PARTNER_ID ;
2026-07-20 16:05:17 +00:00
}
function shouldShowOutboundPromotionOnPlatform ( promotion ) {
2026-07-23 10:11:24 +00:00
let tmp = ! require ( 477 ) /* set */ . isIOS ( ) ;
2026-07-20 16:05:17 +00:00
if ( ! tmp ) {
tmp = ! promotion . hasFlag ( PromotionFlags . IS_BLOCKED_IOS ) ;
}
return tmp ;
}
function isRecurringPromotion ( promotionType ) {
2026-07-25 08:10:48 +00:00
return promotionType . promotionType === require ( 6209 ) /* CountryListMode */ . PromotionTypes . THIRD_PARTY_OUTBOUND_RECURRING ;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
( { AnalyticEvents : closure_8 , Endpoints : closure_9 , Platforms : closure_10 } = ME ) ;
const result = require ( "_isNativeReflectConstruct" ) . fileFinishedImporting ( "modules/premium/promotions/PromotionUtils.tsx" ) ;
2026-07-20 16:05:17 +00:00
export const getPromotionImageURL = function getPromotionImageURL ( id , arg1 ) {
let str = "logo-light" ;
if ( obj . isThemeDark ( arg1 ) ) {
str = "logo-dark" ;
}
if ( null != CDN_HOST ) {
const _HermesInternal2 = HermesInternal ;
let combined = "https://" + CDN_HOST + "/promotions/" + id + "/" + str + "?size=256" ;
} else {
const _location = location ;
const _window = window ;
const _HermesInternal = HermesInternal ;
combined = "" + location . protocol + window . GLOBAL_ENV . API_ENDPOINT + "/promotions/" + id + "/" + str + "?size=256" ;
}
return combined ;
} ;
export { claimedOutboundPromotionCodeFromServer } ;
export const claimOutboundPromotion = function claimOutboundPromotion ( arg0 ) {
return _claimOutboundPromotion ( . . . arguments ) ;
} ;
export const getOutboundPromotionRedemptionUrl = function getOutboundPromotionRedemptionUrl ( code , outboundPromotion ) {
if ( null != outboundPromotion . outboundRedemptionUrlFormat ) {
if ( "" !== outboundPromotion . outboundRedemptionUrlFormat ) {
const _encodeURIComponent = encodeURIComponent ;
let str2 = outboundPromotion . outboundRedemptionUrlFormat . replace ( "{code}" , encodeURIComponent ( code ) ) ;
const str3 = outboundPromotion . outboundRedemptionUrlFormat ;
}
return str2 ;
}
const outboundRedemptionPageLink = outboundPromotion . outboundRedemptionPageLink ;
str2 = "" ;
if ( null != outboundRedemptionPageLink ) {
str2 = outboundRedemptionPageLink ;
}
} ;
export { getNextUnseenOutboundPromotionId } ;
export const shouldShowOutboundPromotionNotice = function shouldShowOutboundPromotionNotice() {
const tmp = getNextUnseenOutboundPromotionId ( ) ;
let tmp2 = null != tmp ;
if ( tmp2 ) {
2026-07-23 10:11:24 +00:00
let obj = require ( 1336 ) /* addVersionedDismissedContent */ ;
2026-07-20 16:05:17 +00:00
obj = { cooldownDurationMs : 259200000 } ;
2026-07-23 10:11:24 +00:00
tmp2 = ! obj . isTimeRecurringSnowflakeBoundDismissibleContentDismissed ( require ( 1334 ) /* DismissibleContent */ . DismissibleContent . THIRD_PARTY_OUTBOUND_PROMO_NAGBAR , tmp , obj ) ;
2026-07-20 16:05:17 +00:00
}
return tmp2 ;
} ;
export { isLogitechPromotion } ;
export { shouldShowOutboundPromotionOnPlatform } ;
export const getClaimedOutboundPromotionCodeMap = function getClaimedOutboundPromotionCodeMap ( stateFromStores2 ) {
let done ;
const obj = { } ;
const tmp = _createForOfIteratorHelperLoose ( stateFromStores2 ) ;
let iter = tmp ( ) ;
if ( ! iter . done ) {
do {
let value = iter . value ;
obj [ value . promotion . id ] = value . code ;
let iter2 = tmp ( ) ;
iter = iter2 ;
done = iter2 . done ;
} while ( ! done ) ;
}
return obj ;
} ;
export const getClaimedEndedOutboundPromotions = function getClaimedEndedOutboundPromotions ( arr , arr2 ) {
2026-07-23 10:11:24 +00:00
const set = new Set ( arr2 . map ( ( id ) = > id . id ) ) ;
2026-07-20 16:05:17 +00:00
return arr . filter ( ( promotion ) = > {
promotion = promotion . promotion ;
let tmp = ! set . has ( promotion . id ) ;
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = ! outer1_18 ( promotion ) ;
2026-07-20 16:05:17 +00:00
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = ! outer1_16 ( promotion ) ;
2026-07-20 16:05:17 +00:00
}
if ( tmp ) {
2026-07-23 10:11:24 +00:00
tmp = outer1_17 ( promotion ) ;
2026-07-20 16:05:17 +00:00
}
return tmp ;
} ) ;
} ;
export { isRecurringPromotion } ;