// Module ID: 6679 // Function ID: 51467 // Name: _createForOfIteratorHelperLoose // Dependencies: [] // Exports: createReferralTrial, createReferralTrials, fetchReferralEligibleUsers, fetchReferralsRemaining, resolveReferralTrialOffer // Module 6679 (_createForOfIteratorHelperLoose) function _createForOfIteratorHelperLoose(@@iterator) { let arg1 = Symbol_iterator; @@iterator = "undefined" !== typeof Symbol; if (Symbol_iterator) { const _Symbol = Symbol; @@iterator = Symbol_iterator[Symbol.iterator]; } if (!Symbol_iterator) { @@iterator = Symbol_iterator[Symbol.iterator]; } if (Symbol_iterator) { const iter = Symbol_iterator.call(Symbol_iterator); const next = iter.next; return next.bind(iter); } else { const _Array = Array; let tmp = Symbol_iterator; if (!Array.isArray(Symbol_iterator)) { let tmp2; if (Symbol_iterator) { if ("string" === typeof Symbol_iterator) { tmp2 = _arrayLikeToArray(Symbol_iterator, undefined); } else { const toString = {}.toString; const substr = toString.call(Symbol_iterator).slice(8, -1); let name = substr; if (tmp3) { name = Symbol_iterator.constructor.name; } if ("Map" !== name) { if ("Set" !== name) { if ("Arguments" === name) { let arr = _arrayLikeToArray(Symbol_iterator, undefined); } else { const obj = /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/; } } tmp2 = arr; } const _Array2 = Array; arr = Array.from(Symbol_iterator); const callResult = toString.call(Symbol_iterator); const tmp3 = "Object" === substr && Symbol_iterator.constructor; } } 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) { arg1 = tmp; } let closure_1 = 0; return () => { if (closure_1 >= tmp.length) { let obj = { done: true }; } else { obj = { done: false }; closure_1 = tmp3 + 1; obj.value = tmp[+closure_1]; } 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; } async function _fetchReferralEligibleUsers(index, searchQuery, arg2, arg3) { let obj = { index, searchQuery }; const json = JSON.stringify(obj); if (store.has(json)) { return store.get(json); } else { const HTTP = callback(closure_2[6]).HTTP; obj = { url: constants.GET_REFERRAL_ELIGIBLE_USERS }; obj = { index }; let num2 = 10; if (null != arg2) { num2 = arg2; } obj.limit = num2; obj.search_query = searchQuery; obj.body = obj; obj.oldFormErrors = true; obj.rejectWithError = false; const body = yield HTTP.post(obj).body; const users = body.users; const obj1 = { users: users.map((arg0) => new closure_6(arg0)), nextIndex: body.next_index }; const result = store.set(json, obj1); return obj1; } } async function _createReferralTrials(arg0, arg1) { const items = []; const map = new Map(); let obj = map; const tmp2 = callback3(arg0); const iter = tmp2(); let iter2 = iter; if (!iter.done) { const value = iter2.value; const HTTP = callback(closure_2[6]).HTTP; obj = { CONVERSATIONS: null, replace: null, push: null, url: closure_9.CREATE_REFERRAL(value) }; while (true) { let body = yield tmp6(obj).body; let tmp9 = body; let tmp10 = null; if (null != body) { tmp10 = body; } if (null != tmp10) { let tmp12 = items; let tmp13 = tmp10; let arr = items.push(tmp11); } let tmp15 = map; let tmp16 = value; let tmp17 = constants; let result = obj.set(value, constants.SUCCESS); while (true) { let tmp19 = tmp2; let iter3 = tmp2(); iter2 = iter3; if (!iter3.done) { break; } else { break label0; } } } } callback2(closure_2[7]).dispatch({ type: "CREATE_REFERRALS_SUCCESS", userTrialOffers: items }); return map; } async function _createReferralTrial(value, arg1) { const HTTP = callback(closure_2[6]).HTTP; let obj = { CONVERSATIONS: null, replace: null, push: null, url: closure_9.CREATE_REFERRAL(value) }; const body = yield HTTP.post(obj).body; let tmp = null; if (null != body) { tmp = body; } obj = { type: "BILLING_CREATE_REFERRAL_SUCCESS", userTrialOffer: tmp }; callback2(closure_2[7]).dispatch(obj); obj = { userTrialOffer: tmp }; return obj; } async function _resolveReferralTrialOffer(arg0, arg1) { const HTTP = callback(closure_2[6]).HTTP; let obj = { CONVERSATIONS: null, replace: null, push: null, url: closure_9.REFERRAL_OFFER_ID_RESOLVE(arg0) }; const body = yield HTTP.get(obj).body; let tmp = null; if (null != body) { tmp = body; } obj = { type: "BILLING_REFERRAL_RESOLVE_SUCCESS", userTrialOffer: tmp }; callback2(closure_2[7]).dispatch(obj); obj = { userTrialOffer: tmp }; return obj; } let closure_3 = importDefault(dependencyMap[0]); let closure_4 = importDefault(dependencyMap[1]); let closure_5 = importDefault(dependencyMap[2]); let closure_6 = importDefault(dependencyMap[3]); let closure_7 = importDefault(dependencyMap[4]); ({ AbortCodes: closure_8, Endpoints: closure_9 } = arg1(dependencyMap[5])); const obj = { SUCCESS: 1, [1]: "SUCCESS", FAIL: 2, [2]: "FAIL" }; let tmp3 = () => { class EligibleUserCache { constructor() { tmp = closure_4(this, EligibleUserCache); map = new Map(); this.cache = map; this.expiration = Date.now() + 600000; return; } } const arg1 = EligibleUserCache; let obj = { key: "set", value(arg0, arg1) { const cache = this.cache; const result = cache.set(arg0, arg1); } }; const items = [obj, , , ]; obj = { key: "get", value(arg0) { this._checkExpiration(); const cache = this.cache; return cache.get(arg0); } }; items[1] = obj; obj = { key: "has", value(arg0) { this._checkExpiration(); const cache = this.cache; return cache.has(arg0); } }; items[2] = obj; items[3] = { key: "_checkExpiration", value() { if (this.expiration < Date.now()) { const cache = this.cache; cache.clear(); } } }; return callback2(EligibleUserCache, items); }(); tmp3 = new tmp3(); const tmp2 = arg1(dependencyMap[5]); const result = arg1(dependencyMap[10]).fileFinishedImporting("modules/premium/ReferralTrialActionCreators.tsx"); export const ReferralOfferStatus = { REDEEMED: 1, [1]: "REDEEMED", PENDING: 2, [2]: "PENDING", CONVERTED: 3, [3]: "CONVERTED" }; export const CreateReferralStatus = obj; export const fetchReferralEligibleUsers = function fetchReferralEligibleUsers(arg0, arg1, arg2) { return _fetchReferralEligibleUsers(...arguments); }; export const fetchReferralsRemaining = function fetchReferralsRemaining() { let obj = importDefault(dependencyMap[7]); obj.dispatch({ type: "BILLING_REFERRALS_REMAINING_FETCH_START" }); const HTTP = arg1(dependencyMap[6]).HTTP; obj = { CONVERSATIONS: null, replace: null, push: null, url: constants.GET_REFERRALS_REMAINING }; const value = HTTP.get(obj); return value.then((body) => { const map = new Map(); if (null != body.body) { if (null != body.body.recipient_status) { for (const key10015 in arg0.body.recipient_status) { let tmp7 = key10015; let result = map.set(key10015, arg0.body.recipient_status[key10015]); } } } const obj = { type: "BILLING_REFERRALS_REMAINING_FETCH_SUCCESS" }; let num = 0; if (null != body.body) { num = 0; if (null != body.body.referrals_remaining) { num = body.body.referrals_remaining; } } obj.referrals_remaining = num; if (null != body.body) { if (null != body.body.sent_user_ids) { const sent_user_ids = body.body.sent_user_ids; } obj.sent_user_ids = []; body = body.body; let refresh_at; if (null != body) { refresh_at = body.refresh_at; } let tmp2 = null; if (null != refresh_at) { tmp2 = refresh_at; } obj.refresh_at = tmp2; obj.recipient_status = map; const body2 = body.body; let has_eligible_friends; if (null != body2) { has_eligible_friends = body2.has_eligible_friends; } obj.has_eligible_friends = null != has_eligible_friends && has_eligible_friends; const body3 = body.body; let reminder_state_id; if (null != body3) { reminder_state_id = body3.reminder_state_id; } let tmp5 = null; if (null != reminder_state_id) { tmp5 = reminder_state_id; } obj.reminder_state_id = tmp5; obj2.dispatch(obj); } }, (status) => { status = undefined; if (null != status) { status = status.status; } if (404 !== status) { let obj = callback(closure_2[7]); obj = { type: "BILLING_REFERRALS_REMAINING_FETCH_FAIL" }; obj.dispatch(obj); } }); }; export const createReferralTrials = function createReferralTrials(arg0) { return _createReferralTrials(...arguments); }; export const createReferralTrial = function createReferralTrial() { return _createReferralTrial(...arguments); }; export const resolveReferralTrialOffer = function resolveReferralTrialOffer(content) { return _resolveReferralTrialOffer(...arguments); };