{"version":3,"sources":["webpack:///1.bundle.js","webpack:///./views/views/Xb/WorkWithUs/JobListingsSubView.js","webpack:///./views/views/Basket/BasketView.js","webpack:///./views/views/Partner/PartnerListingView.js","webpack:///./views/views/Partner/PartnerView.js","webpack:///./views/views/Xb/About/AboutUsView.js","webpack:///./views/views/Xb/Borrower/LandingView.js","webpack:///./views/views/Xb/Borrower/PostUpdateView.js","webpack:///./views/views/Xb/Build/AppShowView.js","webpack:///./views/views/Xb/Build/DashboardView.js","webpack:///./views/views/Xb/Home/HomeView.js","webpack:///./views/views/Xb/OneclickMessaging/OneclickMessagingView.js","webpack:///./views/views/Xb/Redeem/RedeemView.js","webpack:///./views/views/Xb/WorkWithUs/CareersView.js","webpack:///./views/views/Xb/WorkWithUs/ReviewersView.js","webpack:///./models/Basket.js","webpack:///./views/views/Xb/OneclickMessaging/OneClickUtils.js"],"names":["webpackJsonp","516","module","exports","__webpack_require__","$","__WEBPACK_AMD_DEFINE_RESULT__","define","require","showJobs","json","departments","each","index","department","name","splice","push","jobs","length","div","append","job","absolute_url","title","location","getJobs","ajax","url","type","dataType","success","result","error","init","call","525","tombstone","e","afterNudgeShown","suggestedDonation","wwwApp","subViews","on","kv","processExperimentViews","showNudge","nudgeToShow","queryParams","donation","forcedNudge","uri","queryParam","colorbox","href","ajaxUrl","xhrError","nudgeErrorTpl","onComplete","doShowNudgeOnLoad","basketState","basket","state","numeral","loans_total","value","donation_total","buildBasketItemRewardContent","rewardCreditsInfo","lineItems","loanId","content","sponsor_name","item","amount","formatted_amount","isMobile","promo","rewardCreditApplied","isQualifying","promoId","message","format","sponsor","setDafEligibilityNotice","lineItem","$loanTR","$dafCreditArea","viewData","latestBasketStateComplete","hasDafCode","loan","display_details","daf_eligible","html","click","showDafIneligibleWhyLightbox","handleDafIneligibleBasketContinueLightboxCheckoutAnywayClick","submit","close","handleDafIneligibleBasketContinueLightboxCancelClick","markRewardLoan","$rowEl","$rewardCreditCol","handleRewardCreditAppliedMessageClick","show","hide","loanHasRewardCreditsApplied","loanRewardCredits","i","isApplied","isArray","canLoanBeDedicated","loans","dedication","totalPromoGiftRedemptions","rewardCredits","unMarkRewardLoan","populateDonationTotalInput","nudgeFallback","val","getDonationTotal","updateDonationBasketTotals","kivaCreditAvailableString","rewardCreditDivTotal","orderTotal","getOrderTotal","donationTotal","grandTotal","getGrandTotal","kivaCreditApplied","getKivaCreditApplied","kivaCreditApplicable","getKivaCreditApplicable","kivaCreditAvailable","kivaCredit","kivaCreditRemaining","$kivaCreditUsedValue","$kivaCreditDiv","$kivaCreditRemainingValue","$kivaCreditRemainingDiv","forceDeposit","rewardCredit","hypotheticalTotalRewardCreditApplied","setAmount","$orderTotal","$grandTotal","setDonationAmount","updateBasketComplete","$basketTable","execute","getBasketCount","qty","parseInt","unitPrice","giftRedemptionsApplied","promoGiftRedemptionsApplied","teamId","rowEl","data","is","doNavigaton","routeId","oldId","rid","routeMap","isActive","animate","scrollTop","$main","height","$el","css","navigate","jqXhr","console","log","done","event","preventDefault","currentTarget","rustbucketbox","undefined","handleDonateRemainingCreditClick","remaining","text","total","saveDonation","handleDonationEditClick","handleUpsellMsgClick","handleMyBasketFormSubmit","isNumeric","tipMsg","handleIndiaLoanNoticeClick","handleTosCheckboxClick","$myButton","target","handleAddOnePrintKivaCardClick","attr","myJQModalClose","addOnePrintKivaCard","handleTeamSelectChange","assignLoanToTeam","handleGiftValueChange","$selectEl","updateGifts","closest","handleLoanValueChange","updateLoan","handleRemoveGiftClick","removeGifts","handleRemoveGiftRedemptionClick","$document","off","handleRemoveLoanClick","removeLoan","handleBasketStateUpdate","handleDocumentReady","handleBeforeUnload","status","nodeName","toLowerCase","getAmount","getDonationAmount","formatDonationFallback","redirectToFallback","load","conf","get","initializeBasketRouter","Router","Backbone","extend","routes","history","start","pushState","hashChange","router","Basket","hasNonDafLoans","_","getAjaxUrl","hasDonation","getPurchaseTotal","blur","proxy","handleEditDedicationClick","handleCancelDedicationClick","qtip","showMCHelpTip","promo_tip_title","promo_tip_content","window","basketTotals","hasClass","527","__WEBPACK_AMD_DEFINE_ARRAY__","kvLegacy","View","el","events","initHelpTips","mcHelpTip","sfHelpTip","handleInputChange","form","initialize","this","528","530","startVideo","$playerIframe","startValue","stopVideo","videoUrl","self","531","initSlideshow","slickOpts","slide","slidesToShow","slidesToScroll","mobileFirst","dots","arrows","prevArrow","nextArrow","slick","precheck_exp_version","kvTrack","isReady","trackEvent","532","change","loaded","parent","files","reader","FileReader","readAsDataURL","onload","533","modifyApp","id","appId","methodName","app_id","deleteAppLink","deleteAppLightbox","closeLightBoxButton","deleteAppButton","publishAppButton","unpublishAppButton","foundation","initEnableDisable","initShowHideSecret","resetTokensButton","disableAppButton","revealSecretLink","hideSecretLink","534","535","initLazySlideshow","autoplay","autoplaySpeed","swipe","convertLazyImageToInterchange","$image","lazyData","trim","removeAttr","setupLazyImageSlideShow","$hpSlideshow","$lazyImages","lazyImageCount","hp","currentSlide","eq","fireHomepageInitTracking","category_rows_exp_version","538","OneClickUtils","options","543","codeRedeemed","codeAmount","hasError","addClass","onClickRedemptionHelpLink","onSubmitRedemptionCode","document","hasRedemptions","giftCardValue","giftCardValueMessage","isNumber","parseFloat","toFixed","code","errmsg","tipmsg","empty","isFloat","n","isInteger","544","JobListingsSubView","545","recordRTPApplyClicks","eventLabel","774","handleUpdateLoanSuccess","bounceUrl","err_code","jumpToLogin","newAmount","new_amount","loan_id","remove","publish","basketStateComplete","basketError","updateLoanBadResults","handleUpdateLoanError","handleAssignLoanToTeamSuccess","assignLoanToTeamBadResults","handleAssignLoanToTeamError","handleSaveDonationSuccess","saveDonationBadResults","handleUpdateGiftsSuccess","giftIds","gift_ids","new_data","updateGiftsBadResults","handleAddOnePrintKivaCardSuccess","results","reload","handleBasketAjaxAlways","handleBasketAjaxFail","donationPercentage","checkoutFeePercentage","prototype","args","context","fail","always","stateObj","trigger","totals","gifts_total","Math","max","min","totalRewardCredits","totalGiftRedemptions","getCreditTotal","count","team_id","new_value","crumb_string","cookie","replace","crumb","giftIDs","newValues","gift_amount","gifts_per_recipient","delivery_type","scheduled_recipient_delivery_date","recipient_name","recipient_email","sender_name","gift_message","agree_terms","isAjax","showTipmsg","entrep_name","confirm","String","indexOf","802","_typeof","Symbol","iterator","obj","constructor","reversalSuccess","reversalFailed","reverseDonation","Xb_Oneclick_DonateRemainingCredit","fund_account_id","donation_amount"],"mappings":"AAAAA,cAAc,IAERC,IACA,SAAUC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GAAI,GAAIC,OCN7C,MAAAC,WAAiBC,GAKhB,QAASC,GAASC,GACjB,GAAIA,EAAKC,YAAa,CACrB,GAAIA,GAAcD,EAAKC,WAGvBN,GAAEO,KAAKD,EAAa,SAASE,EAAOC,GACnC,GAAwB,oEAApBA,EAAWC,KAGd,MAFAJ,GAAYK,OAAOH,EAAO,GAC1BF,EAAYM,KAAKH,IACV,IAITT,EAAEO,KAAKD,EAAa,SAASE,EAAOC,GACnC,GAAIA,EAAWI,KAAKC,OAAQ,CAC3B,GAAIC,GAAMf,EAAE,uBAAuBgB,OAAO,mCAAqCP,EAAWC,KAAO,cACjGV,GAAEO,KAAKE,EAAWI,KAAM,SAASL,EAAOS,GACvCF,EAAIC,OAAO,gFAAkFC,EAAIC,aAAe,KAAOD,EAAIE,MAAQ,uCAAyCF,EAAIG,SAASV,KAAO,sBAOrM,QAASW,KACRrB,EAAEsB,MACDC,IAAK,gEACHC,KAAM,MACNC,SAAU,OACVC,QAAS,SAAUC,GACpBvB,EAASuB,IAERC,MAAO,eAlCX,GAAI5B,GAAIG,EAAQ,EAuChB,QACC0B,KAAM,WACLR,OA5CH,gCDwD6BS,KAAKhC,EAASC,EAAoB,KAIzDgC,IACA,SAAUlC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GAAI,GAAIC,EEhEX,KAA2B+B,UAAU,+DAAkE,MAAMC,QAG/I,MAAA/B,WAAiBC,GA4BhB,QAAS+B,GAAgBC,GACxBC,OAAOC,SAASC,GAAG,4BAA6B,WA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,QACI0B,KAAM,WAEE7B,EAAE,aAAac,QAAUd,EAAE,qBAAqBc,QAChDd,EAAE,qBAAqB0F,MAAMiW,MA9C7C,gChBw9D6B7Z,KAAKhC,EAASC,EAAoB","file":"1.bundle.js","sourcesContent":["webpackJsonp([1],{\n\n/***/ 516:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\tfunction showJobs(json) {\n\t\tif (json.departments) {\n\t\t\tvar departments = json.departments;\n\n\t\t\t// move general job department to last in department list\n\t\t\t$.each(departments, function (index, department) {\n\t\t\t\tif (department.name === 'Don\\'t see a position for you, but still interested in our work?') {\n\t\t\t\t\tdepartments.splice(index, 1);\n\t\t\t\t\tdepartments.push(department);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t$.each(departments, function (index, department) {\n\t\t\t\tif (department.jobs.length) {\n\t\t\t\t\tvar div = $('#jobs-listing .list').append('

' + department.name + '

');\n\t\t\t\t\t$.each(department.jobs, function (index, job) {\n\t\t\t\t\t\tdiv.append('
' + job.title + '
' + job.location.name + '
');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction getJobs() {\n\t\t$.ajax({\n\t\t\turl: 'https://api.greenhouse.io/v1/boards/kivaorg/embed/departments',\n\t\t\ttype: 'GET',\n\t\t\tdataType: 'json',\n\t\t\tsuccess: function success(result) {\n\t\t\t\tshowJobs(result);\n\t\t\t},\n\t\t\terror: function error() {}\n\t\t});\n\t}\n\n\treturn {\n\t\tinit: function init() {\n\t\t\tgetJobs();\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 525:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n/*tombstone inserted 2018-08-08*/try {\n\t/*global tombstone*/tombstone('/sites/www_kiva/client/src/views/views/Basket/BasketView.js');\n} catch (e) {}\n/* jshint ignore: start */\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\t// @todo make sure to look for calls to kv.basketUi in other areas of the codebase\n\n\t// @todo @refactor check on all the event.targets, make sure they point to the right element (ie. should it be event.srcElement or one of the others???)\n\t/*global SimpleHistory, myJQModalClose */\n\n\tvar uri = __webpack_require__(52);\n\tvar kv = __webpack_require__(28);\n\tvar $ = __webpack_require__(210);\n\tvar numeral = __webpack_require__(73);\n\tvar Basket = __webpack_require__(774);\n\n\tvar viewData, nudgeFallback, router, basket, routeMap, $main, nudgeCancelTimer, nudgeErrorTpl, $kivaCreditDiv, $kivaCreditUsedValue, $kivaCreditRemainingDiv, $kivaCreditRemainingValue, $orderTotal, $grandTotal;\n\n\t// @todo put here to temporarily mock out functions that we don't need\n\tkv.processExperimentViews = function () {};\n\n\t/**\n * @todo add test\n *\n * @param {Number} suggestedDonation\n */\n\tfunction afterNudgeShown(suggestedDonation) {\n\t\twwwApp.subViews.on('ready:Basket_NudgeSubView', function () {\n\t\t\t//\t\t\t@todo - work around the direct reference to \"basket\" and \"suggestedDonation\"\n\t\t\t//\t\t\tkv.Basket_NudgeSubView.init(basket, suggestedDonation);\n\n\t\t\t// the subview contains event triggers we need to fire.\n\t\t\t// they won't be in the dom when the first processing takes place.\n\t\t\t// so we need to do them here.\n\t\t\t// @todo - with the new wwwApp setup, we might be able to move this elsewhere\n\t\t\tkv.processExperimentViews();\n\t\t});\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param {Number} suggestedDonation\n * @param {Boolean} nudgeToShow\n */\n\tfunction showNudge(suggestedDonation, nudgeToShow) {\n\t\tvar queryParams = {\n\t\t\tdonation: suggestedDonation\n\t\t},\n\t\t forcedNudge = nudgeToShow || uri().queryParam('kexp_force_nudge');\n\n\t\tif (forcedNudge) {\n\t\t\tqueryParams['kexp_force_nudge'] = forcedNudge;\n\t\t}\n\n\t\t$.colorbox({\n\t\t\thref: wwwApp.ajaxUrl('theNudge', queryParams),\n\t\t\txhrError: nudgeErrorTpl,\n\t\t\tonComplete: function onComplete() {\n\t\t\t\tafterNudgeShown(suggestedDonation);\n\t\t\t}\n\n\t\t});\n\t}\n\n\t/**\n * @todo - add test\n *\n * @private\n * @return {Boolean}\n */\n\tfunction doShowNudgeOnLoad() {\n\t\tvar basketState = basket.state();\n\n\t\treturn numeral(basketState.loans_total).value() > 0 && numeral(basketState.donation_total).value() === 0;\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param rewardCreditsInfo\n * @param lineItems\n * @param loanId\n * @return {*}\n */\n\tfunction buildBasketItemRewardContent(rewardCreditsInfo, lineItems, loanId) {\n\t\tvar content, sponsor_name, item, amount, sponsor_title, formatted_amount, isMobile, promo;\n\n\t\tamount = 0;\n\t\tfor (item in lineItems) {\n\t\t\tif (loanId == lineItems[item].loanId) {\n\t\t\t\tamount = lineItems[item].rewardCreditApplied;\n\t\t\t}\n\t\t}\n\n\t\tpromo = rewardCreditsInfo.isQualifying == 1 ? rewardCreditsInfo.promoId : 'ineligible';\n\n\t\tif (rewardCreditsInfo.isQualifying === 0) {\n\t\t\tcontent = '
Ineligible for bonus redemption
';\n\t\t\tcontent += '
' + rewardCreditsInfo.message + '
';\n\t\t} else if (amount === 0) {\n\t\t\tcontent = '';\n\t\t} else if (rewardCreditsInfo.isQualifying == 1) {\n\t\t\tisMobile = wwwApp.isMobile();\n\n\t\t\tformatted_amount = numeral(amount).format('$0,0');\n\n\t\t\tcontent = '
' + formatted_amount + ' bonus applied
';\n\t\t\tcontent += 'Sponsored by: ';\n\t\t\tif (!isMobile) {\n\t\t\t\tcontent += '';\n\t\t\t}\n\n\t\t\tsponsor_name = rewardCreditsInfo.sponsor;\n\t\t\tcontent += sponsor_name;\n\n\t\t\tif (sponsor_title) {\n\t\t\t\tcontent += '
' + sponsor_title;\n\t\t\t}\n\n\t\t\tif (!isMobile) {\n\t\t\t\tcontent += '
';\n\t\t\t}\n\t\t} else {\n\t\t\tthrow 'Error: Rewards credit status unknown';\n\t\t}\n\n\t\treturn content;\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param lineItem\n * @param $loanTR\n */\n\tfunction setDafEligibilityNotice(lineItem, $loanTR) {\n\t\tvar $dafCreditArea = $('.dafCredit', $loanTR);\n\n\t\tif (viewData.latestBasketStateComplete.hasDafCode) {\n\t\t\tif (loan.display_details.daf_eligible === false) {\n\t\t\t\t$dafCreditArea.html('This loan is not eligible for this promotion. Why?');\n\t\t\t} else {\n\t\t\t\t$dafCreditArea.html('');\n\t\t\t}\n\t\t} else {\n\t\t\t$dafCreditArea.html('');\n\t\t}\n\n\t\tif ($dafCreditArea.html() !== '') {\n\t\t\t$('.daf_warning_why', $dafCreditArea).click(showDafIneligibleWhyLightbox);\n\t\t}\n\t}\n\n\tfunction showDafIneligibleWhyLightbox() {\n\t\t$.colorbox({\n\t\t\thref: wwwApp.ajaxUrl('callLoanDafIneligibleWhySubView')\n\t\t});\n\t}\n\n\tfunction handleDafIneligibleBasketContinueLightboxCheckoutAnywayClick() {\n\t\t$('#my-basket-form').submit();\n\t\t$.colorbox.close();\n\t}\n\n\tfunction handleDafIneligibleBasketContinueLightboxCancelClick() {\n\t\t$.colorbox.close();\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param {jQuery} $rowEl\n * @param {jQuery} $rewardCreditCol\n * @param {Array} rewardCreditsInfo\n * @param {Object} lineItems\n * @param {Number} loanId\n */\n\tfunction markRewardLoan($rowEl, $rewardCreditCol, rewardCreditsInfo, lineItems, loanId) {\n\t\tif (rewardCreditsInfo.length < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar content = buildBasketItemRewardContent(rewardCreditsInfo[0], lineItems, loanId);\n\n\t\t$rewardCreditCol.html(content);\n\t\tif (content !== '') {\n\t\t\t$('.basketItemRewardCreditAppliedMessage', $rewardCreditCol).click(handleRewardCreditAppliedMessageClick);\n\t\t\t$rewardCreditCol.show();\n\t\t} else {\n\t\t\t$rewardCreditCol.hide();\n\t\t}\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param {Object} loanRewardCredits\n * @return {Boolean}\n */\n\tfunction loanHasRewardCreditsApplied(loanRewardCredits) {\n\t\tvar i,\n\t\t isApplied = false;\n\n\t\tif ($.isArray(loanRewardCredits)) {\n\t\t\tfor (i = 0; i < loanRewardCredits.length; i++) {\n\t\t\t\tif (loanRewardCredits[i].amount > 0) {\n\t\t\t\t\tisApplied = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn isApplied;\n\t}\n\n\t/**\n * @todo - add test\n *\n * Duplicate code exists on the server, Basket_BasketView::setLoanDisplaySettings.\n *\n * @param loanId\n * @return {Boolean}\n */\n\tfunction canLoanBeDedicated(loanId) {\n\t\tvar lineItems = basket.state().lineItems;\n\n\t\tif (!(viewData.loans || viewData.loans[loanId])) {\n\t\t\tthrow 'Data error';\n\t\t}\n\n\t\treturn !(viewData.loans[loanId].dedication || lineItems.totalPromoGiftRedemptions || loanHasRewardCreditsApplied(basket.state().rewardCredits[loanId]));\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param $rowEl\n * @param $rewardCreditCol\n */\n\tfunction unMarkRewardLoan($rowEl, $rewardCreditCol) {\n\t\t$rewardCreditCol.html('').hide();\n\t}\n\n\t/**\n * @todo\n *\n *\n */\n\tfunction populateDonationTotalInput() {\n\t\tif (nudgeFallback) {\n\t\t\t$('#donation_total').val(numeral($('#donation_edit_ab_amount').val()).value());\n\t\t} else {\n\t\t\t$('#donation_total').val(basket.getDonationTotal());\n\t\t}\n\t}\n\n\tfunction updateDonationBasketTotals() {\n\t\tvar kivaCreditAvailableString,\n\t\t rewardCreditDivTotal,\n\t\t basketState = basket.state(),\n\t\t orderTotal = basket.getOrderTotal(),\n\t\t donationTotal = basket.getDonationTotal(),\n\t\t grandTotal = basket.getGrandTotal(),\n\t\t kivaCreditApplied = basket.getKivaCreditApplied(),\n\t\t kivaCreditApplicable = basket.getKivaCreditApplicable(),\n\t\t kivaCreditAvailable = basketState.lineItems.kivaCredit,\n\t\t kivaCreditRemaining = kivaCreditAvailable - kivaCreditApplied,\n\t\t rewardCredits = basketState.rewardCredits;\n\n\t\tif (kivaCreditApplicable > 0) {\n\n\t\t\tkivaCreditAvailableString = '(' + numeral(kivaCreditApplicable).format('$0,0.00') + ')';\n\t\t\t$kivaCreditUsedValue.html(kivaCreditAvailableString);\n\t\t\t$kivaCreditDiv.show();\n\t\t} else {\n\t\t\t$kivaCreditDiv.hide();\n\t\t}\n\n\t\tif (kivaCreditRemaining > 0) {\n\t\t\t$kivaCreditRemainingValue.html(numeral(kivaCreditRemaining).format('$0,0.00'));\n\t\t\t$kivaCreditRemainingDiv.show();\n\t\t} else {\n\t\t\t$kivaCreditRemainingDiv.hide();\n\t\t}\n\n\t\t// only suggest they donate remaining credit if they are using credit for this transaction\n\t\tif (basket.forceDeposit) {\n\t\t\t$('#donateRemainingCredit').hide();\n\t\t} else {\n\t\t\t$('#donateRemainingCredit').show();\n\t\t}\n\n\t\trewardCreditDivTotal = 0;\n\t\tfor (var rewardCredit in rewardCredits) {\n\t\t\tfor (var item in rewardCredits[rewardCredit]) {\n\t\t\t\trewardCreditDivTotal += rewardCredits[rewardCredit][item].amount;\n\t\t\t}\n\t\t}\n\n\t\tif (rewardCreditDivTotal === 0) {\n\t\t\trewardCreditDivTotal = basketState.hypotheticalTotalRewardCreditApplied;\n\t\t}\n\n\t\tif (rewardCreditDivTotal === 0) {\n\t\t\t$('.rewardCreditDiv').hide();\n\t\t} else {\n\t\t\t$('.rewardCreditDiv .value').html('(' + numeral(rewardCreditDivTotal).format('$0,0.00') + ')');\n\t\t\t$('.rewardCreditDiv').show();\n\t\t}\n\n\t\tsetAmount($orderTotal, orderTotal);\n\t\tsetAmount($grandTotal, grandTotal);\n\n\t\t// @todo legacy code, we should only need one of these...\n\t\t$('#donation_total').val(donationTotal); // for sending to the server\n\t\tsetDonationAmount(donationTotal); // for displaying to the user\n\t}\n\n\tfunction updateBasketComplete() {\n\t\tvar lineItems,\n\t\t lineItem,\n\t\t i,\n\t\t rewardCredits,\n\t\t $loanTR,\n\t\t $basketTable,\n\t\t basketState = basket.state();\n\n\t\tif (!basketState) {\n\t\t\treturn;\n\t\t}\n\n\t\twwwApp.execute('updateBasketCount', basket.getBasketCount());\n\n\t\t//\tHandle the line items\n\t\tlineItems = basketState.lineItems.lineItems;\n\t\tfor (i = 0; i < lineItems.length; i++) {\n\t\t\tlineItem = lineItems[i];\n\n\t\t\t// The first type of which is the loans\n\t\t\tif (lineItem.type == 'loan') {\n\t\t\t\t$loanTR = $('#loan_row' + lineItem.loanId);\n\n\t\t\t\tif (lineItem.qty <= 0) {\n\t\t\t\t\t$loanTR.hide();\n\t\t\t\t}\n\t\t\t\tsetDafEligibilityNotice(lineItem, $loanTR);\n\n\t\t\t\t$('select.amountSelect', $loanTR).val(parseInt(numeral(lineItem.unitPrice + lineItem.giftRedemptionsApplied + lineItem.promoGiftRedemptionsApplied + lineItem.rewardCreditApplied).value(), 10));\n\t\t\t\t$('select.teamSelect', $loanTR).val(parseInt(lineItem.teamId, 10) || 'NULL');\n\t\t\t}\n\t\t}\n\n\t\trewardCredits = basketState.rewardCredits;\n\t\t$('.basketItemRowLoan').each(function (index, rowEl) {\n\t\t\tvar $rowEl = $(rowEl),\n\t\t\t $rewardCreditCol = $('.rewardCreditCol', $rowEl),\n\t\t\t loanId = $rowEl.data('kv-loan-id');\n\n\t\t\tif (canLoanBeDedicated(loanId)) {\n\t\t\t\t$('a.dedicateLoan', $rowEl).show();\n\t\t\t} else {\n\t\t\t\t$('a.dedicateLoan', $rowEl).hide();\n\t\t\t}\n\n\t\t\tif (rewardCredits[loanId]) {\n\t\t\t\tmarkRewardLoan($rowEl, $rewardCreditCol, rewardCredits[loanId], lineItems, loanId);\n\t\t\t} else {\n\t\t\t\tunMarkRewardLoan($rowEl, $rewardCreditCol);\n\t\t\t}\n\t\t});\n\n\t\tupdateDonationBasketTotals();\n\n\t\t$basketTable = $('#my_basket_table');\n\t\tif ($basketTable.is(':hidden')) {\n\t\t\t$basketTable.show();\n\t\t}\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param loanId\n * @param settings\n */\n\tfunction updateRouteMap(loanId, settings) {\n\t\trouteMap[loanId] = routeMap[loanId] || {};\n\t\t$.extend(routeMap[loanId], settings);\n\t}\n\n\t/**\n * @todo - add test\n *\n * @param routeId\n */\n\tfunction doNavigaton(routeId) {\n\t\tvar oldId;\n\n\t\tfor (var rid in routeMap) {\n\t\t\tif (routeMap[rid].isActive) {\n\t\t\t\toldId = rid;\n\t\t\t\trouteMap[rid].isActive = false;\n\t\t\t}\n\t\t}\n\n\t\trouteMap[routeId].isActive = true;\n\n\t\t$('html, body').animate({ scrollTop: 0 });\n\t\t$main.height(routeMap[routeId].height);\n\n\t\tif (oldId) {\n\t\t\trouteMap[oldId].$el.css('display', 'none');\n\t\t}\n\n\t\trouteMap[routeId].$el.css('display', 'block');\n\t}\n\n\t/**\n *\n * @param {Number|String} routeId\n */\n\tfunction navigate(routeId) {\n\n\t\t// Prevent extra work\n\t\tif (routeMap[routeId] && routeMap[routeId].isActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!routeMap[routeId].jqXhr) {\n\t\t\tconsole.log('The dedication form for has not been loaded.');\n\t\t}\n\n\t\trouteMap[routeId].jqXhr.done(function () {\n\t\t\tdoNavigaton(routeId);\n\t\t});\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleRewardCreditAppliedMessageClick(event) {\n\t\tevent.preventDefault();\n\n\t\t// Use currentTarget in case the user clicks on a nested element inside of the anchor element.\n\t\tvar promo = $(event.currentTarget).data('kv-promo');\n\n\t\tkv.rustbucketbox(wwwApp.ajaxUrl('BasketViewLoansRewardSubView/' + promo), undefined, 400, undefined, undefined, undefined);\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleDonateRemainingCreditClick(event) {\n\t\tevent.preventDefault();\n\t\tvar remaining = numeral($kivaCreditRemainingValue.text()).value();\n\t\tvar total = remaining + basket.getDonationTotal();\n\n\t\tbasket.saveDonation(total).done(function () {\n\t\t\t$('#donation_edit_ab_amount').animate({ 'background-color': '#ffee90' }, 100, 'swing', function () {\n\t\t\t\t$('#donation_edit_ab_amount').animate({ 'background-color': '#fff' }, 1500);\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleDonationEditClick(event) {\n\t\t// TODO: Track the click, wether the lightbox actually shows or not\n\n\t\tevent.preventDefault();\n\t\tshowNudge(basket.getDonationTotal());\n\t}\n\n\t/**\n *\n * @context Basket\n * @param {jQuery.Event} event\n */\n\tfunction handleUpsellMsgClick(event) {\n\t\tevent.preventDefault();\n\t\tkv.rustbucketbox($('.cardTosDialog').html(), undefined, 550, 415, undefined, undefined);\n\t}\n\n\t/**\n *\n * @context {Basket}\n * @param {jQuery.Event} event\n */\n\tfunction handleMyBasketFormSubmit(event) {\n\t\tif (nudgeFallback && !$.isNumeric(numeral($('#donation_edit_ab_amount').val()).value())) {\n\t\t\tevent.preventDefault();\n\t\t\tkv.tipMsg('Donation amount is invalid.', 'warning');\n\t\t} else {\n\t\t\tpopulateDonationTotalInput();\n\t\t}\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleIndiaLoanNoticeClick(event) {\n\t\tevent.preventDefault();\n\t\tkv.rustbucketbox('#indiaLoanNoticeLightbox', undefined, '70%');\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleTosCheckboxClick(event) {\n\t\tvar $myButton = $('#jqmWrapper .addOnePrintKivaCardOk');\n\n\t\tif ($(event.target).is(':checked')) {\n\t\t\t$myButton.show();\n\t\t} else {\n\t\t\t$myButton.hide();\n\t\t}\n\t}\n\n\t/**\n * @param {jQuery.Event} event\n */\n\tfunction handleAddOnePrintKivaCardClick(event) {\n\t\tevent.preventDefault();\n\n\t\tif ($('#jqmWrapper .tosAgreeCheckbox').attr('checked')) {\n\t\t\tmyJQModalClose();\n\t\t\tbasket.addOnePrintKivaCard();\n\t\t}\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleTeamSelectChange(event) {\n\t\tbasket.assignLoanToTeam($(event.target).data('kv-loan-id'));\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleGiftValueChange(event) {\n\t\tvar $selectEl = $(event.target);\n\n\t\tbasket.updateGifts($selectEl.closest('tr').data('kv-gift-ids'), { amount: $selectEl.val() });\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleLoanValueChange(event) {\n\t\tbasket.updateLoan($(event.target).closest('tr').data('kv-loan-id'));\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleRemoveGiftClick(event) {\n\t\tevent.preventDefault();\n\n\t\tvar $rowEl = $(event.target).closest('tr');\n\n\t\tbasket.removeGifts($rowEl.data('kv-gift-ids'));\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleRemoveGiftRedemptionClick(event) {\n\t\tif (viewData.latestBasketStateComplete.hasDafCode) {\n\t\t\tevent.preventDefault();\n\n\t\t\twwwApp.$document.off('click', '.dafRemoveGiftCheckLightboxCancel').on('click', '.dafRemoveGiftCheckLightboxCancel', function () {\n\t\t\t\tmyJQModalClose();\n\t\t\t});\n\n\t\t\tkv.rustbucketbox(wwwApp.ajaxUrl('callBasketDafRemoveGiftCheckSubView'));\n\t\t}\n\t}\n\n\t/**\n *\n * @param {jQuery.Event} event\n */\n\tfunction handleRemoveLoanClick(event) {\n\t\tevent.preventDefault();\n\t\tbasket.removeLoan($(event.target).closest('tr').data('kv-loan-id'));\n\t}\n\n\tfunction handleBasketStateUpdate() {\n\t\tupdateBasketComplete();\n\t}\n\n\tfunction handleDocumentReady() {\n\t\tif (doShowNudgeOnLoad()) {\n\t\t\tshowNudge(basket.getDonationTotal());\n\t\t}\n\t}\n\n\t/**\n *\n * @return {String|undefined}\n */\n\tfunction handleBeforeUnload() {\n\t\tif (basket.status == 'processing') {\n\t\t\treturn 'We have not finished processing your most recent request. Are you sure you want to leave this page?';\n\t\t}\n\t}\n\n\tfunction setAmount($el, val) {\n\t\tif ($el[0].nodeName.toLowerCase() == 'input') {\n\t\t\treturn $($el).val(numeral(val).format('$0,0.00'));\n\t\t} else {\n\t\t\treturn $($el).html(numeral(val).format('$0,0.00'));\n\t\t}\n\t}\n\n\tfunction getAmount($el) {\n\t\treturn numeral($($el).val()).value();\n\t}\n\n\tfunction setDonationAmount(val) {\n\t\treturn setAmount('#donation_edit_ab_amount', val);\n\t}\n\n\tfunction getDonationAmount() {\n\t\treturn getAmount('#donation_edit_ab_amount');\n\t}\n\n\tfunction formatDonationFallback() {\n\t\treturn setDonationAmount(getDonationAmount());\n\t}\n\n\tfunction redirectToFallback() {\n\t\tkv.load(wwwApp.conf.get('rootHttp') + 'basket?nudgeFallback=1');\n\t}\n\n\tfunction initializeBasketRouter() {\n\t\tvar Router = Backbone.Router.extend({\n\t\t\troutes: {\n\t\t\t\t'basket': function basket() {\n\t\t\t\t\tnavigate('basket');\n\t\t\t\t},\n\t\t\t\t'basket/dedicate/:loanId': function basketDedicateLoanId(loanId) {\n\t\t\t\t\tnavigate(loanId);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tBackbone.history.start({ pushState: true, hashChange: false });\n\t\trouter = new Router();\n\t}\n\n\tfunction init(data) {\n\t\tviewData = data;\n\t\t$main = $('#main');\n\t\t$kivaCreditDiv = $('#kivaCreditDiv');\n\t\t$kivaCreditUsedValue = $('#kivaCreditUsedValue', $kivaCreditDiv);\n\t\t$kivaCreditRemainingDiv = $('#kivaCreditRemainingDiv');\n\t\t$kivaCreditRemainingValue = $('#kivaCreditRemainingValue', $kivaCreditRemainingDiv);\n\t\t$orderTotal = $('#orderTotal');\n\t\t$grandTotal = $('#grandTotal');\n\t\tnudgeErrorTpl = '
We encountered an error.

If you are not redirected shortly, please click here to edit your donation amount.

';\n\t\tbasket = new kv.Basket(viewData);\n\t\tnudgeFallback = !!viewData.nudgeFallback;\n\t\trouteMap = {};\n\n\t\tvar totals;\n\n\t\tif (viewData.latestBasketStateComplete && viewData.latestBasketStateComplete.hasDafCode && viewData.latestBasketStateComplete.hasNonDafLoans) {\n\t\t\t$('#basketContinue').click(function (event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif (basket && basket._ && basket._.state && basket._.state.hasNonDafLoans) {\n\t\t\t\t\t$('#basketContinue').colorbox({\n\t\t\t\t\t\thref: kv.getAjaxUrl('dafIneligibleBasketContinueLightbox'),\n\t\t\t\t\t\tonComplete: function onComplete() {\n\t\t\t\t\t\t\t$('#dafIneligibleBasketContinueLightboxCheckoutAnyway').click(handleDafIneligibleBasketContinueLightboxCheckoutAnywayClick);\n\t\t\t\t\t\t\t$('#dafIneligibleBasketContinueLightboxCancel').click(handleDafIneligibleBasketContinueLightboxCancelClick);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t$('#my-basket-form').submit();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// we have basket state and line items\n\t\t// the basket has a donation\n\t\t// a SINGLE donation\n\t\t// and other purchase totals==0\n\t\t// ie - this basket has only a single donation and nothing else (likely came from support us?)\n\t\t// no nudge in this case, just redirect to the fallback\n\t\tif (basket.state() && basket.state().lineItems && basket.state().hasDonation && basket.state().lineItems.lineItems.length <= 1 && basket.getPurchaseTotal() === 0 && !nudgeFallback) {\n\t\t\tredirectToFallback();\n\t\t}\n\n\t\tinitializeBasketRouter();\n\n\t\tif (nudgeFallback) {\n\t\t\t$('#donation_edit_ab_amount').blur(function () {\n\t\t\t\tformatDonationFallback();\n\t\t\t});\n\n\t\t\t// also do this once to initialize it to a money value\n\t\t\tformatDonationFallback();\n\t\t}\n\n\t\t$('.updateButton').click(function () {\n\t\t\t$('#updateFlag').val(true);\n\t\t});\n\n\t\t$('#donateRemainingCreditAction').click(handleDonateRemainingCreditClick);\n\t\t$('#donation_edit_link').click(handleDonationEditClick);\n\t\t$('#giftUpsell').click(handleUpsellMsgClick);\n\n\t\t$('#my-basket-form').submit($.proxy(handleMyBasketFormSubmit));\n\n\t\t$('div.indiaLoanNotice a.more').click(handleIndiaLoanNoticeClick);\n\n\t\twwwApp.$document.on('click', 'input.tosAgreeCheckbox', handleTosCheckboxClick);\n\t\twwwApp.$document.on('click', '.addOnePrintKivaCardOk', handleAddOnePrintKivaCardClick);\n\n\t\twwwApp.on('update.basketState', handleBasketStateUpdate);\n\n\t\t$main.on('change', 'tr.basketItemRowGift .amountSelect', handleGiftValueChange).on('change', 'tr.basketItemRowLoan .teamSelect', handleTeamSelectChange).on('change', 'tr.basketItemRowLoan .amountSelect', handleLoanValueChange).on('click', 'a.removeGift', handleRemoveGiftClick).on('click', 'a.removeLoan', handleRemoveLoanClick).on('click', 'a.removeGiftRedemption', handleRemoveGiftRedemptionClick).on('click', 'a.dedicateLoan, a.editDedicationLink', handleEditDedicationClick).on('click', '.dedicateLoanForm .cancelButton', handleCancelDedicationClick);\n\n\t\t//\t\t\t@todo update to use qtip\n\t\t$('a.helpTip.mcHelpTip').qtip(wwwApp.showMCHelpTip());\n\t\t$('a.helpTip.promoHelpTip').qtip({\n\t\t\tcontent: {\n\t\t\t\ttitle: viewData.promo_tip_title,\n\t\t\t\ttext: viewData.promo_tip_content\n\t\t\t}\n\t\t});\n\n\t\t$(handleDocumentReady);\n\t\t$(window).on('beforeunload', handleBeforeUnload);\n\n\t\t$('#next_step').val('reviewBasket');\n\n\t\t// for all events in the donation nudge project\n\t\tif (!basket.state()) {\n\t\t\treturn;\n\t\t}\n\n\t\ttotals = basket.state().basketTotals;\n\n\t\t$('#giftCodeHelp').click(function (event) {\n\t\t\tevent.preventDefault();\n\t\t\tif ($('body').hasClass('wwwmobile')) {\n\t\t\t\tkv.rustbucketbox($('.giftCodeHelpContent').html(), undefined, 210);\n\t\t\t} else {\n\t\t\t\tkv.rustbucketbox($('.giftCodeHelpContent').html(), undefined, 600);\n\t\t\t}\n\t\t});\n\n\t\tupdateBasketComplete();\n\t}\n\n\treturn {\n\t\tinit: init,\n\t\tpopulateDonationTotalInput: populateDonationTotalInput,\n\t\tupdateBasketComplete: updateBasketComplete,\n\t\tloanHasRewardCreditsApplied: loanHasRewardCreditsApplied,\n\t\tcanLoanBeDedicated: canLoanBeDedicated,\n\t\tunMarkRewardLoan: unMarkRewardLoan,\n\t\tgetAmount: getAmount,\n\t\tsetAmount: setAmount,\n\t\tgetDonationAmount: getDonationAmount,\n\t\tsetDonationAmount: setDonationAmount,\n\t\tshowNudge: showNudge\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 527:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(210), __webpack_require__(212), __webpack_require__(20)], __WEBPACK_AMD_DEFINE_RESULT__ = (function ($, kvLegacy, Backbone) {\n\t'use strict';\n\n\treturn Backbone.View.extend({\n\n\t\tel: '.main',\n\n\t\tevents: {\n\t\t\t'change .partnerListingForm select': 'handleInputChange',\n\t\t\t'change .partnerListingForm input': 'handleInputChange'\n\t\t},\n\n\t\tinitHelpTips: function initHelpTips() {\n\t\t\twwwApp.mcHelpTip('a.helpTipNoUnderline.mcHelpTip, a.helpTip.mcHelpTip');\n\t\t\twwwApp.sfHelpTip('a.helpTiphelpTipNoUnderline.sfHelpTip, a.helpTip.sfHelpTip');\n\t\t},\n\n\t\thandleInputChange: function handleInputChange(event) {\n\t\t\tevent.target.form.submit();\n\t\t},\n\n\t\tinitialize: function initialize() {\n\t\t\tthis.initHelpTips();\n\t\t}\n\t});\n}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n\n/***/ 528:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_RESULT__;\n\n/* global google */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(210),\n\t kvLegacy = __webpack_require__(212),\n\t Backbone = __webpack_require__(20);\n\n\treturn Backbone.View.extend({\n\n\t\tinitHelpTips: function initHelpTips() {\n\t\t\twwwApp.mcHelpTip('a.helpTip.mcHelpTip');\n\t\t\twwwApp.sfHelpTip('a.helpTip.sfHelpTip');\n\n\t\t\t// These used to be in lightboxes bc of the amount of text they have\n\t\t\t// Ideally, the text should be shortened and a \"more\" link should be provided.\n\t\t\twwwApp.sfHelpTip('a.helpTip.sfHelpTip_old');\n\t\t},\n\n\t\tinitialize: function initialize() {\n\t\t\tthis.initHelpTips();\n\t\t}\n\n\t});\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n\n/***/ 530:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar Backbone = __webpack_require__(122);\n\n\treturn Backbone.View.extend({\n\n\t\tstartVideo: function startVideo() {\n\t\t\tthis.$playerIframe.attr('src', this.startValue);\n\t\t},\n\n\t\tstopVideo: function stopVideo() {\n\t\t\tthis.$playerIframe.attr('src', this.videoUrl);\n\t\t},\n\n\t\tinitialize: function initialize() {\n\t\t\tvar self = this;\n\n\t\t\tthis.$playerIframe = this.$('#video-player');\n\t\t\tthis.videoUrl = this.$playerIframe.attr('src');\n\t\t\tthis.startValue = this.videoUrl + '&autoplay=1';\n\n\t\t\twwwApp.$document.on('opened.fndtn.reveal', '[data-reveal]', function () {\n\t\t\t\tself.startVideo();\n\t\t\t}).on('closed.fndtn.reveal', '[data-reveal]', function () {\n\t\t\t\tself.stopVideo();\n\t\t\t});\n\t\t}\n\t});\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n\n/***/ 531:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\treturn {\n\t\tinitSlideshow: function initSlideshow() {\n\t\t\tif ($('.bl-slideshow-wrapper').length) {\n\t\t\t\tvar slickOpts = {\n\t\t\t\t\tslide: '.bl-slide',\n\t\t\t\t\tslidesToShow: 1,\n\t\t\t\t\tslidesToScroll: 1,\n\t\t\t\t\tmobileFirst: true,\n\t\t\t\t\tdots: true,\n\t\t\t\t\tarrows: true,\n\t\t\t\t\tprevArrow: $('.bl-prev-arrow'),\n\t\t\t\t\tnextArrow: $('.bl-next-arrow')\n\t\t\t\t};\n\t\t\t\t// Init the slick\n\t\t\t\t$('.bl-slideshow-wrapper').slick(slickOpts);\n\t\t\t}\n\t\t},\n\n\t\tinit: function init(data) {\n\t\t\tif (data && data.precheck_exp_version) {\n\t\t\t\twwwApp.kvTrack.isReady.done(function () {\n\t\t\t\t\twwwApp.kvTrack.trackEvent('Borrow', 'EXP-GROW-84-May2020', data.precheck_exp_version, undefined, true);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.initSlideshow();\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 532:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\treturn {\n\t\tinit: function init() {\n\t\t\t$('#image_preview_input_file').change(function () {\n\t\t\t\tfunction loaded(e) {\n\t\t\t\t\t$('.image_preview').attr('src', e.target.result);\n\t\t\t\t\t$('.image_preview').parent().show();\n\t\t\t\t}\n\n\t\t\t\tif (this.files && this.files[0]) {\n\t\t\t\t\tvar reader = new FileReader();\n\t\t\t\t\treader.readAsDataURL(this.files[0]);\n\t\t\t\t\treader.onload = loaded;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 533:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\treturn {\n\t\tmodifyApp: function modifyApp(id, appId, methodName) {\n\t\t\twindow.location.href = '/build/apps/modify?id=' + id + '&app_id=' + appId + '&method_name=' + methodName;\n\t\t},\n\n\t\tinit: function init(viewData) {\n\t\t\tvar self = this;\n\t\t\tvar id = viewData.id;\n\t\t\tvar appId = viewData.app_id;\n\t\t\tvar deleteAppLink = $('[data-reveal-id=' + id + ']');\n\t\t\tvar deleteAppLightbox = $('.decision-point-lightbox#' + id);\n\t\t\tvar closeLightBoxButton = $('.lightbox-content a.alternative-option');\n\t\t\tvar deleteAppButton = $('.lightbox-content a.main-option');\n\t\t\tvar publishAppButton = $('.button.publish');\n\t\t\tvar unpublishAppButton = $('.button.unpublish');\n\n\t\t\tdeleteAppLink.click(function () {\n\t\t\t\tvar deleteAppLightbox = $('.decision-point-lightbox#' + id);\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'open');\n\t\t\t});\n\n\t\t\tcloseLightBoxButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t});\n\n\t\t\tdeleteAppButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'delete');\n\t\t\t});\n\n\t\t\tpublishAppButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'publish');\n\t\t\t});\n\n\t\t\tunpublishAppButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'unpublish');\n\t\t\t});\n\n\t\t\tthis.initEnableDisable(id, appId, deleteAppLightbox);\n\t\t\tthis.initShowHideSecret();\n\t\t},\n\n\t\t// Splitin these up to keep jshint happy\n\t\tinitEnableDisable: function initEnableDisable(id, appId, deleteAppLightbox) {\n\t\t\tvar self = this;\n\t\t\tvar resetTokensButton = $('.button.reset-tokens');\n\t\t\tvar disableAppButton = $('.button.disable');\n\t\t\tvar enableAppButton = $('.button.enable');\n\t\t\tenableAppButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'enable');\n\t\t\t});\n\n\t\t\tdisableAppButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'disable');\n\t\t\t});\n\n\t\t\tresetTokensButton.click(function () {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'resetSecrets');\n\t\t\t});\n\t\t},\n\n\t\tinitShowHideSecret: function initShowHideSecret() {\n\t\t\tvar revealSecretLink = $('.reveal-secret');\n\t\t\tvar hideSecretLink = $('.hide-secret');\n\n\t\t\trevealSecretLink.click(function () {\n\t\t\t\thideSecretLink.parent().show();\n\t\t\t\trevealSecretLink.parent().hide();\n\t\t\t});\n\n\t\t\thideSecretLink.click(function () {\n\t\t\t\trevealSecretLink.parent().show();\n\t\t\t\thideSecretLink.parent().hide();\n\t\t\t});\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 534:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\treturn {\n\t\tinit: function init() {\n\t\t\t$('.app-preview').on('click', function () {\n\t\t\t\tvar id = $(this).attr('id');\n\t\t\t\twindow.location.href = '/build/apps/' + id;\n\t\t\t});\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 535:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n/* globals jQuery, kv, wwwApp, ga, snowplow, foundation */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\treturn {\n\t\tinitLazySlideshow: function initLazySlideshow() {\n\t\t\tif ($('#hp-slideshow2').length) {\n\t\t\t\tvar slickOpts = {\n\t\t\t\t\tslidesToShow: 1,\n\t\t\t\t\tslidesToScroll: 1,\n\t\t\t\t\tmobileFirst: true,\n\t\t\t\t\tdots: false,\n\t\t\t\t\tarrows: false,\n\t\t\t\t\tautoplay: true,\n\t\t\t\t\tautoplaySpeed: 5000,\n\t\t\t\t\tswipe: false\n\t\t\t\t};\n\t\t\t\t// Init the slick\n\t\t\t\t$('#hp-slideshow2').slick(slickOpts);\n\t\t\t}\n\t\t},\n\n\t\tconvertLazyImageToInterchange: function convertLazyImageToInterchange($image) {\n\t\t\t// get the data-lazy attr\n\t\t\tvar lazyData = $image.attr('data-lazy');\n\t\t\t// convert it to data-interchange if it exists\n\t\t\tif (lazyData !== undefined) {\n\t\t\t\t$image.attr('data-interchange', lazyData.trim());\n\t\t\t\t$image.removeAttr('data-lazy');\n\t\t\t\t// reflow this new interchange image\n\t\t\t\t$image.foundation('interchange', 'reflow');\n\t\t\t}\n\t\t},\n\n\t\tsetupLazyImageSlideShow: function setupLazyImageSlideShow() {\n\t\t\tvar $hpSlideshow = $('#hp-slideshow2'),\n\t\t\t $lazyImages = $('img[data-lazy]'),\n\t\t\t lazyImageCount = $lazyImages.length // Setup count of lazy slides\n\t\t\t,\n\t\t\t hp = this;\n\n\t\t\t// init slideshow\n\t\t\tthis.initLazySlideshow();\n\n\t\t\t// initialize on beforeChange using slide index to address queue\n\t\t\t$hpSlideshow.on('beforeChange', function (event, slick, currentSlide) {\n\t\t\t\t// operate on lazy image in queue converting lazy to interchange and calling reflow\n\t\t\t\tif (lazyImageCount > 1) {\n\t\t\t\t\thp.convertLazyImageToInterchange($lazyImages.eq(currentSlide));\n\t\t\t\t\tlazyImageCount--;\n\t\t\t\t} else if (lazyImageCount === 1) {\n\t\t\t\t\thp.convertLazyImageToInterchange($lazyImages.eq(currentSlide));\n\t\t\t\t\tlazyImageCount--;\n\t\t\t\t\t// slick duplicates the last image appending it to the beginning of the list\n\t\t\t\t\t// so we have to convert it to interchange too as it wasn't converted when initialized\n\t\t\t\t\t$('.slick-initialized img[data-lazy]').each(function (i, item) {\n\t\t\t\t\t\thp.convertLazyImageToInterchange($(item));\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Turn off the change behavior when all lazy-data has been converted\n\t\t\t\t\t$hpSlideshow.off('beforeChange');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tfireHomepageInitTracking: function fireHomepageInitTracking(viewData) {\n\t\t\twwwApp.kvTrack.isReady.done(function () {\n\t\t\t\tif (viewData.category_rows_exp_version) {\n\t\t\t\t\twwwApp.kvTrack.trackEvent('Home', 'EXP-CategoryRows', viewData.category_rows_exp_version, null, true);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tinit: function init(viewData) {\n\n\t\t\tthis.setupLazyImageSlideShow();\n\n\t\t\tthis.fireHomepageInitTracking(viewData);\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 538:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n 'use strict';\n\n var OneClickUtils = __webpack_require__(802);\n\n return {\n init: function init(options) {\n OneClickUtils.init();\n }\n };\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n\n/***/ 543:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n/* globals jQuery, kv, wwwApp */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\tvar _ = __webpack_require__(11);\n\n\treturn {\n\t\tcodeRedeemed: false,\n\t\tcodeAmount: 0,\n\t\thasError: false,\n\n\t\tinit: function init(viewData) {\n\t\t\tvar self = this;\n\n\t\t\t// apply white to Kiva Card CMS help headers\n\t\t\t$('.giftCodeHelpContent h1, .giftCodeHelpContent h2').addClass('white');\n\n\t\t\t$('.helplink').on('click', function () {\n\t\t\t\tself.onClickRedemptionHelpLink(viewData);\n\t\t\t});\n\n\t\t\t$('#addGiftRedemptionForm').on('submit', function () {\n\t\t\t\tself.onSubmitRedemptionCode();\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t// show modal light-box\n\t\t\t$('#redeem-details').foundation('reveal', 'open');\n\n\t\t\t// event listener: display message upon modal light-box and close only if code not applied\n\t\t\t$(document).on('close.fndtn.reveal', '[data-reveal]', function () {\n\n\t\t\t\t// only show tip message if an error has occurred or if there are no codes in the basket\n\t\t\t\tif (self.hasError === false || viewData.hasRedemptions === false) {\n\t\t\t\t\tif (self.codeRedeemed === true) {\n\n\t\t\t\t\t\t// validate the gift card value is a number (float or integer)\n\t\t\t\t\t\tvar giftCardValue = self.codeAmount;\n\t\t\t\t\t\tvar giftCardValueMessage = '';\n\n\t\t\t\t\t\tif (_.isNumber(giftCardValue)) {\n\t\t\t\t\t\t\tgiftCardValueMessage = '$' + parseFloat(giftCardValue).toFixed(2);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tkv.tipMsg('Your ' + giftCardValueMessage + ' Kiva Card will be applied at checkout automatically. Just choose someone to support from the categories below, head to checkout and we\\'ll do the rest!', 'info');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tkv.tipMsg('Your Kiva Card wasn\\'t applied, but don\\'t worry, you\\'ll have another chance to enter it at checkout.', 'info');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tonClickRedemptionHelpLink: function onClickRedemptionHelpLink(viewData) {\n\t\t\t$('.helplink').hide();\n\t\t\t$('.giftCodeHelpContent').show();\n\t\t},\n\n\t\tonSubmitRedemptionCode: function onSubmitRedemptionCode() {\n\t\t\tvar self = this;\n\t\t\tvar errorColor = '#d8d8d8';\n\n\t\t\treturn $.ajax({\n\t\t\t\turl: wwwApp.ajaxUrl('addOneGiftRedemption'),\n\t\t\t\ttype: 'POST',\n\t\t\t\tdataType: 'json',\n\t\t\t\tdata: { code: $('#code').val() },\n\t\t\t\tsuccess: function success(result) {\n\t\t\t\t\tif (!result) {\n\t\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t\t$('#ajaxstatus').html('There was an error. Please try again.').css('color', errorColor);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.success) {\n\t\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t\t$('#ajaxstatus').html(result.errmsg).css('color', errorColor);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// set code values for tip message\n\t\t\t\t\tif (result.errmsg === null) {\n\t\t\t\t\t\tself.codeRedeemed = true;\n\t\t\t\t\t\tself.codeAmount = result.tipmsg;\n\t\t\t\t\t}\n\n\t\t\t\t\t// clear / hide any messages\n\t\t\t\t\t$('#ajaxstatus').empty();\n\t\t\t\t\t$('#cardDiv, .helplink, .giftCodeHelpContent').hide();\n\n\t\t\t\t\t// close modal light-box\n\t\t\t\t\t$('#redeem-details').foundation('reveal', 'close');\n\t\t\t\t},\n\t\t\t\terror: function error() {\n\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t$('#ajaxstatus').html('There was an error. Please try again.').css('color', errorColor);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tisFloat: function isFloat(n) {\n\t\t\t/*jslint bitwise: true */\n\t\t\treturn n === +n && n !== (n | 0);\n\t\t},\n\n\t\tisInteger: function isInteger(n) {\n\t\t\t/*jslint bitwise: true */\n\t\t\treturn n === +n && n === (n | 0);\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 544:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_RESULT__;\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar JobListingsSubView = __webpack_require__(516);\n\n\treturn {\n\t\tinit: function init() {\n\t\t\tJobListingsSubView.init();\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }),\n\n/***/ 545:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n/* globals jQuery, kv, wwwApp */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(0);\n\n\tfunction recordRTPApplyClicks(eventLabel) {\n\t\twwwApp.kvTrack.trackEvent('workWithUs', 'RTP Apply Click', eventLabel, undefined, true);\n\t}\n\n\treturn {\n\t\tinit: function init() {\n\t\t\t$('.rtp-editing a.read-more').click(function () {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-editing div.read-more, .rtp-editing .photo, .rtp-editing div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\t$('.rtp-editing .row:last-of-type').addClass('hide-for-small-only');\n\t\t\t\trecordRTPApplyClicks('editing-program-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-trans a.read-more').click(function () {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-trans div.read-more, .rtp-trans .photo, .rtp-trans div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\t$('.rtp-trans .row:last-of-type').addClass('hide-for-small-only');\n\t\t\t\trecordRTPApplyClicks('translation-program-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-lead a.read-more').click(function () {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-lead div.read-more, .rtp-lead .photo, .rtp-lead div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\trecordRTPApplyClicks('team-leader-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-steps a.view-all-steps').click(function () {\n\t\t\t\t$('.rtp-steps a.view-all-steps').hide();\n\t\t\t\t$('.rtp-steps .steps').show();\n\t\t\t\t$('.rtp-steps .row.divider').hide();\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-editing .ready-to-apply a').click(function () {\n\t\t\t\trecordRTPApplyClicks('editing-program-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-trans .ready-to-apply a').click(function () {\n\t\t\t\trecordRTPApplyClicks('translation-program-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-lead .ready-to-apply a').click(function () {\n\t\t\t\trecordRTPApplyClicks('team-leader-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-apply-now a.button').click(function () {\n\t\t\t\trecordRTPApplyClicks('bottom-cta-apply');\n\t\t\t});\n\t\t}\n\t};\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 774:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\n/*tombstone inserted 2018-08-08*/try {\n\t/*global tombstone*/tombstone('/sites/www_kiva/client/src/models/Basket.js');\n} catch (e) {}\n/*jshint maxdepth: 5, maxstatements: 30*/\n\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n\t'use strict';\n\n\tvar $ = __webpack_require__(210),\n\t uri = __webpack_require__(52),\n\t numeral = __webpack_require__(73);\n\n\t// @todo the idea here is to get these messages into one spot and eventually make organize them\n\tvar basketError = {\n\t\tsaveDonationBadResults: 'There was an error updating the donation amount. Please try again.',\n\t\tupdateLoanBadResults: 'There was a problem updating your loan, please refresh the page and try again (2)',\n\t\tupdateGiftsBadResults: 'There was a problem updating your kiva card purchase, please refresh the page and try again',\n\t\tassignLoanToTeamBadResults: 'There was an error applying the loan to the specified team. Please try again.'\n\t};\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleUpdateLoanSuccess(result) {\n\t\tif (result.bounceUrl) {\n\t\t\turi(result.bounceUrl).load();\n\t\t}\n\n\t\tif (result.err_code && result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tvar newAmount = parseInt(result.new_amount, 10);\n\n\t\t// @todo this should go into the kv.basketUi::updateBasketComplete routine\n\t\tif (typeof newAmount == 'number') {\n\t\t\tif (newAmount === 0) {\n\t\t\t\t$('#loan_row' + result.loan_id).hide().remove();\n\t\t\t\tkv.publish('basket:removeLoan');\n\t\t\t} else {\n\t\t\t\t$('#loan' + result.loan_id).val(newAmount);\n\t\t\t}\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.updateLoanBadResults, 'error');\n\t\t}\n\t}\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleUpdateLoanError(result) {\n\t\t$('#loading_loan' + result.loan_id).hide();\n\t}\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleAssignLoanToTeamSuccess(result) {\n\t\tif (result.err_code && result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.assignLoanToTeamBadResults, 'error');\n\t\t}\n\t}\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleAssignLoanToTeamError(result) {\n\t\t$('#loading_team' + result.loan_id).hide();\n\t}\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleSaveDonationSuccess(result) {\n\t\tif (result) {\n\t\t\tif (result.success && result.basketStateComplete) {\n\t\t\t\tthis.state(result.basketStateComplete);\n\t\t\t} else if (!result.success && result.tipmsg) {\n\t\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t\t} else {\n\t\t\t\twwwApp.tipMsg(basketError.saveDonationBadResults, 'error');\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n *\n * @param {Object} result\n */\n\tfunction handleUpdateGiftsSuccess(result) {\n\t\tvar i, giftIds, $rowEl;\n\n\t\tif (result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\t// @todo this should go into basketUi::updateBasketComplete routine, however, that will require adding giftIds to the gift lineItems, or at least somewhere inside of the basketState object\n\t\t\tif ($.isArray(result.gift_ids) && result.new_data) {\n\t\t\t\tif (!parseInt(result.new_data.amount, 10)) {\n\t\t\t\t\tgiftIds = result.gift_ids;\n\n\t\t\t\t\tfor (i = 0; i < giftIds.length; i++) {\n\t\t\t\t\t\t$rowEl = $('#gift_row_' + giftIds[i]);\n\n\t\t\t\t\t\t// @todo cleanup\n\t\t\t\t\t\t// Each basket gift row can contain multiple gifts. So how do you know the id of the row?\n\t\t\t\t\t\t// What we do is loop over each gift id until we find a matching basket gift row.\n\t\t\t\t\t\tif ($rowEl.length) {\n\t\t\t\t\t\t\t$rowEl.remove();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.tipmsg) {\n\t\t\t\t\t\twwwApp.tipMsg(result.tipmsg);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.updateGiftsBadResults, 'error');\n\t\t}\n\t}\n\n\t/**\n *\n * @param {Object} results\n */\n\tfunction handleAddOnePrintKivaCardSuccess(results) {\n\t\tif (results.success) {\n\t\t\turi().reload();\n\t\t} else {\n\t\t\twwwApp.tipMsg(results.tipmsg, 'error');\n\t\t}\n\t}\n\n\t/**\n *\n * @context {Basket}\n */\n\tfunction handleBasketAjaxAlways() {\n\t\tthis.status = 'ready';\n\t}\n\n\t/**\n *\n * @context {Basket}\n */\n\tfunction handleBasketAjaxFail() {\n\t\tthis.state(this.state());\n\t\twwwApp.tipMsg('Error communicating with the server. It might have been caused by unusually high traffic on the Kiva Web site, spotty internet connection, or by a technical failure. Please try again.', 'error');\n\t}\n\n\t/**\n *\n * @param {Object} data\n * @constructor\n */\n\tfunction Basket(data) {\n\t\tthis._ = { state: data.latestBasketStateComplete };\n\t\tthis.status = 'ready';\n\t\tthis.loans = data.loans;\n\t\tthis.donationPercentage = data.checkoutFeePercentage === undefined ? 15 : data.checkoutFeePercentage;\n\t\tthis.forceDeposit = data.forceDeposit;\n\t}\n\n\t/**\n * All basket ajax requests should go through here.\n *\n * @param args\n * @return {jQuery.jqXhr}\n */\n\tBasket.prototype.ajax = function (args) {\n\t\tthis.status = 'processing';\n\n\t\tif (args) {\n\t\t\targs.type = 'post';\n\t\t\targs.dataType = 'json';\n\t\t\targs.context = this;\n\t\t}\n\n\t\treturn $.ajax(args).fail($.proxy(handleBasketAjaxFail, this)).always($.proxy(handleBasketAjaxAlways, this));\n\t};\n\n\t/**\n *\n * @todo add timestamp check before saving\n * @return {Object}\n */\n\tBasket.prototype.state = function (stateObj) {\n\t\tif (stateObj) {\n\t\t\tthis._.state = stateObj;\n\t\t\twwwApp.trigger('update.basketState', stateObj);\n\t\t}\n\n\t\treturn this._.state;\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getDonationTotal = function () {\n\t\tvar basketState = this.state();\n\n\t\tif (basketState.hasDonation && basketState.basketTotals && basketState.basketTotals.donation_total) {\n\t\t\treturn numeral(basketState.basketTotals.donation_total).value();\n\t\t}\n\n\t\treturn this.getPurchaseTotal() * (this.donationPercentage / 100);\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getPurchaseTotal = function () {\n\t\tvar totals = this.state().basketTotals;\n\n\t\treturn numeral(totals.gifts_total).value() + numeral(totals.loans_total).value();\n\t};\n\n\t/**\n * Very similar to getKivaCreditApplied(), only this does NOT take \"forceDeposit\" into consideration\n *\n * @return {Number}\n */\n\tBasket.prototype.getKivaCreditApplicable = function () {\n\t\tvar lineItems = this.state().lineItems;\n\n\t\treturn Math.max(0, Math.min(lineItems.kivaCredit, this.getOrderTotal() - (lineItems.totalRewardCredits + lineItems.totalGiftRedemptions + lineItems.totalPromoGiftRedemptions)));\n\t};\n\n\t/**\n * @todo @uglymunky Really confusing how we calculate this, it should be calculated on the server.\n * @return {Number}\n */\n\tBasket.prototype.getKivaCreditApplied = function () {\n\t\treturn this.forceDeposit ? 0 : this.getKivaCreditApplicable();\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getCreditTotal = function () {\n\t\tvar lineItems = this.state().lineItems;\n\n\t\treturn lineItems.totalGiftRedemptions + lineItems.totalPromoGiftRedemptions + this.getKivaCreditApplied() + lineItems.totalRewardCredits + (lineItems.kivaCredit < 0 ? lineItems.kivaCredit : 0);\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getBasketCount = function () {\n\t\tvar i,\n\t\t count = 0,\n\t\t lineItems = this.state().lineItems.lineItems;\n\n\t\tfor (i = 0; i < lineItems.length; i++) {\n\t\t\tif (lineItems[i].type != 'donation') {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getOrderTotal = function () {\n\t\treturn this.getPurchaseTotal() + this.getDonationTotal();\n\t};\n\n\t/**\n *\n * @return {Number}\n */\n\tBasket.prototype.getGrandTotal = function () {\n\t\treturn Math.max(0, this.getPurchaseTotal() + this.getDonationTotal() - this.getCreditTotal());\n\t};\n\n\t/**\n *\n * @param {Number|String} newAmount\n * @return {jQuery.jqXhr}\n */\n\tBasket.prototype.saveDonation = function (newAmount) {\n\t\tif (!newAmount || newAmount < 0 || newAmount == '$0.00') {\n\t\t\tnewAmount = 0;\n\t\t}\n\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketSaveDonation'),\n\t\t\tdata: { new_amount: newAmount },\n\t\t\tsuccess: handleSaveDonationSuccess\n\t\t});\n\t};\n\n\t/**\n *\n * @param {Number} loan_id\n * @return {jQuery.jqXhr}\n */\n\tBasket.prototype.assignLoanToTeam = function (loan_id) {\n\t\tvar team_id = $('#loan_team' + loan_id).val();\n\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketAssignLoanToTeam'),\n\t\t\tdata: { loan_id: loan_id, team_id: team_id },\n\t\t\tsuccess: handleAssignLoanToTeamSuccess,\n\t\t\terror: handleAssignLoanToTeamError\n\t\t});\n\t};\n\n\t/**\n *\n * @param loan_id\n * @param new_value\n * @return {jQuery.jqXhr}\n */\n\tBasket.prototype.updateLoan = function (loan_id, new_value) {\n\t\tif (new_value === undefined || new_value === null) {\n\n\t\t\t// fallback\n\t\t\tnew_value = $('#loan' + loan_id).val();\n\n\t\t\tif (new_value === undefined || new_value === null) {\n\t\t\t\twwwApp.tipMsg('There was a problem updating your loan, please refresh the page and try again. (1)', 'error');\n\t\t\t\treturn this.ajax();\n\t\t\t}\n\t\t}\n\t\tvar crumb_string = wwwApp.cookie.get('kvis').replace('crumb=', '');\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketUpdateLoan'),\n\t\t\tdata: { loan_id: loan_id, new_amount: new_value, crumb: crumb_string },\n\t\t\tsuccess: handleUpdateLoanSuccess,\n\t\t\terror: handleUpdateLoanError\n\t\t});\n\t};\n\n\t/**\n *\n * @param {String} giftIDs A space separated string of ids\n * @param {Object} newValues Can be a new amount or an object of new values\n * @returns {jQuery.jqXhr}\n */\n\tBasket.prototype.updateGifts = function (giftIDs, newValues) {\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketUpdateGift'),\n\t\t\tdata: $.extend(newValues, { gift_ids: giftIDs }),\n\t\t\tsuccess: handleUpdateGiftsSuccess\n\t\t});\n\t};\n\n\t/**\n *\n * @return {jQuery.jqXhr}\n */\n\tBasket.prototype.addOnePrintKivaCard = function () {\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketAddGift'),\n\t\t\tdata: {\n\t\t\t\tgift_amount: '25' // 25_hard_coded\n\t\t\t\t, gifts_per_recipient: '1',\n\t\t\t\tdelivery_type: 'print',\n\t\t\t\tscheduled_recipient_delivery_date: '11/07/2011',\n\t\t\t\trecipient_name: '',\n\t\t\t\trecipient_email: '',\n\t\t\t\tsender_name: '',\n\t\t\t\tgift_message: '',\n\t\t\t\tagree_terms: 'on',\n\t\t\t\tsubmit: 'print',\n\t\t\t\tisAjax: true,\n\t\t\t\tshowTipmsg: true\n\t\t\t},\n\t\t\tsuccess: handleAddOnePrintKivaCardSuccess\n\t\t});\n\t};\n\n\t/**\n *\n * @param {Number} loanId\n * @return {*}\n */\n\tBasket.prototype.removeLoan = function (loanId) {\n\t\tvar self = this,\n\t\t entrep_name = this.loans[loanId].entrep_name;\n\n\t\twwwApp.confirm('Are you sure you want to remove your loan to ' + entrep_name + '?').done(function (result) {\n\t\t\tif (result) {\n\t\t\t\tself.updateLoan(loanId, 0);\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n *\n * @param {String} giftIds Can be one gift id or an array of gift ids\n */\n\tBasket.prototype.removeGifts = function (giftIds) {\n\t\tvar self = this,\n\t\t message = String(giftIds).indexOf(' ') == -1 ? 'Are you sure you want to remove this gift?' : 'Are you sure you want to remove these gifts?';\n\n\t\twwwApp.confirm(message).done(function (result) {\n\t\t\tif (result) {\n\t\t\t\tself.updateGifts(giftIds, { amount: 0 });\n\t\t\t}\n\t\t});\n\t};\n\n\treturn Basket;\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n\n/***/ 802:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {var __WEBPACK_AMD_DEFINE_RESULT__;\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n/* global Xb_Oneclick_DonateRemainingCredit */\n!(__WEBPACK_AMD_DEFINE_RESULT__ = (function (require) {\n 'use strict';\n\n var $ = __webpack_require__(0);\n\n // Update the text of the lightbox upon success\n function reversalSuccess(result) {\n if (result.success === true) {\n $('.donationText').hide();\n $('.donationReversed').show();\n } else {\n $('.donationText').hide();\n $('.donationReversalFailed').show();\n }\n }\n\n // Update the text of the lightbox upon failure\n function reversalFailed() {\n $('.donationText').hide();\n $('.donationReversalFailed').show();\n }\n\n function reverseDonation(e) {\n e.preventDefault();\n // Do ajax callback to actually reverse the donation\n if ((typeof Xb_Oneclick_DonateRemainingCredit === 'undefined' ? 'undefined' : _typeof(Xb_Oneclick_DonateRemainingCredit)) === 'object') {\n $.ajax({\n url: wwwApp.ajaxUrl('reverseDonation'),\n type: 'POST',\n dataType: 'json',\n data: {\n fund_account_id: Xb_Oneclick_DonateRemainingCredit.fund_account_id,\n amount: Xb_Oneclick_DonateRemainingCredit.donation_amount\n },\n success: reversalSuccess,\n error: reversalFailed\n });\n } else {\n reversalFailed();\n }\n }\n\n return {\n init: function init() {\n // activate removal link only if in proper context\n if ($('#oneclick').length && $('a.reverseDonation').length) {\n $('a.reverseDonation').click(reverseDonation);\n }\n }\n };\n}).call(exports, __webpack_require__, exports, module),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// 1.bundle.js","define(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\tfunction showJobs(json) {\n\t\tif (json.departments) {\n\t\t\tvar departments = json.departments;\n\n\t\t\t// move general job department to last in department list\n\t\t\t$.each(departments, function(index, department) {\n\t\t\t\tif (department.name === 'Don\\'t see a position for you, but still interested in our work?') {\n\t\t\t\t\tdepartments.splice(index, 1);\n\t\t\t\t\tdepartments.push(department);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t$.each(departments, function(index, department) {\n\t\t\t\tif (department.jobs.length) {\n\t\t\t\t\tvar div = $('#jobs-listing .list').append('

' + department.name + '

');\n\t\t\t\t\t$.each(department.jobs, function(index, job) {\n\t\t\t\t\t\tdiv.append('
' + job.title + '
' + job.location.name + '
');\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tfunction getJobs() {\n\t\t$.ajax({\n\t\t\turl: 'https://api.greenhouse.io/v1/boards/kivaorg/embed/departments'\n\t\t\t, type: 'GET'\n\t\t\t, dataType: 'json'\n\t\t\t, success: function (result) {\n\t\t\t\tshowJobs(result);\n\t\t\t}\n\t\t\t, error: function () {\n\t\t\t}\n\t\t});\n\t}\n\n\treturn {\n\t\tinit: function () {\n\t\t\tgetJobs();\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/WorkWithUs/JobListingsSubView.js","/*tombstone inserted 2018-08-08*/ try { /*global tombstone*/ tombstone('/sites/www_kiva/client/src/views/views/Basket/BasketView.js'); } catch(e) {}\n/* jshint ignore: start */\n\ndefine(function (require) {\n\t'use strict';\n\n\t// @todo make sure to look for calls to kv.basketUi in other areas of the codebase\n\n\t// @todo @refactor check on all the event.targets, make sure they point to the right element (ie. should it be event.srcElement or one of the others???)\n\t/*global SimpleHistory, myJQModalClose */\n\n\tvar uri = require('simpleUri');\n\tvar kv = require('kv');\n\tvar $ = require('kvjQuery');\n\tvar numeral = require('numeral');\n\tvar Basket = require('models/Basket');\n\n\n\tvar viewData, nudgeFallback, router, basket, routeMap, $main, nudgeCancelTimer, nudgeErrorTpl, $kivaCreditDiv\n\t, $kivaCreditUsedValue, $kivaCreditRemainingDiv, $kivaCreditRemainingValue, $orderTotal, $grandTotal;\n\n\n\t// @todo put here to temporarily mock out functions that we don't need\n\tkv.processExperimentViews = function () {};\n\n\n\t/**\n\t * @todo add test\n\t *\n\t * @param {Number} suggestedDonation\n\t */\n\tfunction afterNudgeShown(suggestedDonation) {\n\t\twwwApp.subViews.on('ready:Basket_NudgeSubView', function () {\n//\t\t\t@todo - work around the direct reference to \"basket\" and \"suggestedDonation\"\n//\t\t\tkv.Basket_NudgeSubView.init(basket, suggestedDonation);\n\n\t\t\t// the subview contains event triggers we need to fire.\n\t\t\t// they won't be in the dom when the first processing takes place.\n\t\t\t// so we need to do them here.\n\t\t\t// @todo - with the new wwwApp setup, we might be able to move this elsewhere\n\t\t\tkv.processExperimentViews();\n\t\t});\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param {Number} suggestedDonation\n\t * @param {Boolean} nudgeToShow\n\t */\n\tfunction showNudge(suggestedDonation, nudgeToShow) {\n\t\tvar queryParams = {\n\t\t\tdonation: suggestedDonation\n\t\t}\n\t\t, forcedNudge = nudgeToShow || uri().queryParam('kexp_force_nudge');\n\n\t\tif (forcedNudge) {\n\t\t\tqueryParams['kexp_force_nudge'] = forcedNudge\n\t\t}\n\n\t\t$.colorbox({\n\t\t\thref: wwwApp.ajaxUrl('theNudge', queryParams)\n\t\t\t, xhrError: nudgeErrorTpl\n\t\t\t, onComplete: function () {\n\t\t\t\tafterNudgeShown(suggestedDonation);\n\t\t\t}\n\n\t\t});\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @private\n\t * @return {Boolean}\n\t */\n\tfunction doShowNudgeOnLoad() {\n\t\tvar basketState = basket.state();\n\n\t\treturn numeral(basketState.loans_total).value() > 0\n\t\t\t&& numeral(basketState.donation_total).value() === 0;\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param rewardCreditsInfo\n\t * @param lineItems\n\t * @param loanId\n\t * @return {*}\n\t */\n\tfunction buildBasketItemRewardContent(rewardCreditsInfo, lineItems, loanId) {\n\t\tvar content, sponsor_name, item, amount, sponsor_title, formatted_amount, isMobile, promo;\n\n\t\tamount = 0;\n\t\tfor(item in lineItems){\n\t\t\tif(loanId == lineItems[item].loanId){\n\t\t\t\tamount = lineItems[item].rewardCreditApplied;\n\t\t\t}\n\t\t}\n\n\t\tpromo = rewardCreditsInfo.isQualifying == 1\n\t\t\t? rewardCreditsInfo.promoId\n\t\t\t: 'ineligible';\n\n\t\tif(rewardCreditsInfo.isQualifying === 0){\n\t\t\tcontent = '
Ineligible for bonus redemption
';\n\t\t\tcontent += '
' + rewardCreditsInfo.message +'
';\n\t\t} else if(amount === 0){\n\t\t\tcontent = '';\n\t\t} else if (rewardCreditsInfo.isQualifying == 1){\n\t\t\tisMobile = wwwApp.isMobile();\n\n\t\t\tformatted_amount = numeral(amount).format('$0,0');\n\n\t\t\tcontent = '
' + formatted_amount + ' bonus applied
';\n\t\t\tcontent += 'Sponsored by: ';\n\t\t\tif (!isMobile) {\n\t\t\t\tcontent += '';\n\t\t\t}\n\n\t\t\tsponsor_name = rewardCreditsInfo.sponsor;\n\t\t\tcontent += sponsor_name;\n\n\t\t\tif (sponsor_title) {\n\t\t\t\tcontent += '
' + sponsor_title;\n\t\t\t}\n\n\t\t\tif (!isMobile) {\n\t\t\t\tcontent += '
';\n\t\t\t}\n\t\t} else {\n\t\t\tthrow 'Error: Rewards credit status unknown';\n\t\t}\n\n\t\treturn content;\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param lineItem\n\t * @param $loanTR\n\t */\n\tfunction setDafEligibilityNotice(lineItem, $loanTR){\n\t\tvar $dafCreditArea = $('.dafCredit', $loanTR);\n\n\t\tif (viewData.latestBasketStateComplete.hasDafCode) {\n\t\t\tif (loan.display_details.daf_eligible === false) {\n\t\t\t\t$dafCreditArea.html('This loan is not eligible for this promotion. Why?');\n\t\t\t} else {\n\t\t\t\t$dafCreditArea.html('');\n\t\t\t}\n\t\t} else {\n\t\t\t$dafCreditArea.html('');\n\t\t}\n\n\t\tif($dafCreditArea.html() !== ''){\n\t\t\t$('.daf_warning_why', $dafCreditArea).click(showDafIneligibleWhyLightbox);\n\t\t}\n\t}\n\n\n\n\tfunction showDafIneligibleWhyLightbox(){\n\t\t$.colorbox({\n\t\t\thref: wwwApp.ajaxUrl('callLoanDafIneligibleWhySubView')\n\t\t});\n\t}\n\n\n\n\tfunction handleDafIneligibleBasketContinueLightboxCheckoutAnywayClick(){\n\t\t$('#my-basket-form').submit();\n\t\t$.colorbox.close();\n\t}\n\n\n\n\tfunction handleDafIneligibleBasketContinueLightboxCancelClick(){\n\t\t$.colorbox.close();\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param {jQuery} $rowEl\n\t * @param {jQuery} $rewardCreditCol\n\t * @param {Array} rewardCreditsInfo\n\t * @param {Object} lineItems\n\t * @param {Number} loanId\n\t */\n\tfunction markRewardLoan($rowEl, $rewardCreditCol, rewardCreditsInfo, lineItems, loanId) {\n\t\tif(rewardCreditsInfo.length < 1 ){\n\t\t\treturn;\n\t\t}\n\n\t\tvar content = buildBasketItemRewardContent(rewardCreditsInfo[0], lineItems, loanId);\n\n\t\t$rewardCreditCol.html(content);\n\t\tif(content !== ''){\n\t\t\t$('.basketItemRewardCreditAppliedMessage', $rewardCreditCol).click(handleRewardCreditAppliedMessageClick);\n\t\t\t$rewardCreditCol.show();\n\t\t} else{\n\t\t\t$rewardCreditCol.hide();\n\t\t}\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param {Object} loanRewardCredits\n\t * @return {Boolean}\n\t */\n\tfunction loanHasRewardCreditsApplied(loanRewardCredits) {\n\t\tvar i\n\t\t, isApplied = false;\n\n\t\tif ($.isArray(loanRewardCredits)) {\n\t\t\tfor (i = 0; i < loanRewardCredits.length; i++) {\n\t\t\t\tif (loanRewardCredits[i].amount > 0) {\n\t\t\t\t\tisApplied = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn isApplied;\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * Duplicate code exists on the server, Basket_BasketView::setLoanDisplaySettings.\n\t *\n\t * @param loanId\n\t * @return {Boolean}\n\t */\n\tfunction canLoanBeDedicated(loanId) {\n\t\tvar lineItems = basket.state().lineItems;\n\n\t\tif (! (viewData.loans || viewData.loans[loanId])) {\n\t\t\tthrow 'Data error';\n\t\t}\n\n\t\treturn ! (viewData.loans[loanId].dedication || lineItems.totalPromoGiftRedemptions || loanHasRewardCreditsApplied(basket.state().rewardCredits[loanId]));\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param $rowEl\n\t * @param $rewardCreditCol\n\t */\n\tfunction unMarkRewardLoan($rowEl, $rewardCreditCol) {\n\t\t$rewardCreditCol.html('').hide();\n\t}\n\n\n\t/**\n\t * @todo\n\t *\n\t *\n\t */\n\tfunction populateDonationTotalInput() {\n\t\tif(nudgeFallback) {\n\t\t\t$('#donation_total').val(numeral($('#donation_edit_ab_amount').val()).value() );\n\t\t} else {\n\t\t\t$('#donation_total').val(basket.getDonationTotal());\n\t\t}\n\t}\n\n\n\tfunction updateDonationBasketTotals() {\n\t\tvar kivaCreditAvailableString, rewardCreditDivTotal\n\t\t, basketState = basket.state()\n\t\t, orderTotal = basket.getOrderTotal()\n\t\t, donationTotal = basket.getDonationTotal()\n\t\t, grandTotal = basket.getGrandTotal()\n\t\t, kivaCreditApplied = basket.getKivaCreditApplied()\n\t\t, kivaCreditApplicable = basket.getKivaCreditApplicable()\n\t\t, kivaCreditAvailable = basketState.lineItems.kivaCredit\n\t\t, kivaCreditRemaining = kivaCreditAvailable - kivaCreditApplied\n\t\t, rewardCredits = basketState.rewardCredits;\n\n\t\tif (kivaCreditApplicable > 0) {\n\n\t\t\tkivaCreditAvailableString = '(' + numeral(kivaCreditApplicable).format('$0,0.00') + ')';\n\t\t\t$kivaCreditUsedValue.html(kivaCreditAvailableString);\n\t\t\t$kivaCreditDiv.show();\n\n\t\t} else {\n\t\t\t$kivaCreditDiv.hide();\n\t\t}\n\n\t\tif (kivaCreditRemaining > 0) {\n\t\t\t$kivaCreditRemainingValue.html(numeral(kivaCreditRemaining).format('$0,0.00'));\n\t\t\t$kivaCreditRemainingDiv.show();\n\t\t} else {\n\t\t\t$kivaCreditRemainingDiv.hide();\n\t\t}\n\n\t\t// only suggest they donate remaining credit if they are using credit for this transaction\n\t\tif(basket.forceDeposit){\n\t\t\t$('#donateRemainingCredit').hide();\n\t\t} else{\n\t\t\t$('#donateRemainingCredit').show();\n\t\t}\n\n\t\trewardCreditDivTotal = 0;\n\t\tfor (var rewardCredit in rewardCredits) {\n\t\t\tfor (var item in rewardCredits[rewardCredit]) {\n\t\t\t\trewardCreditDivTotal += rewardCredits[rewardCredit][item].amount;\n\t\t\t}\n\t\t}\n\n\t\tif(rewardCreditDivTotal === 0){\n\t\t\trewardCreditDivTotal = basketState.hypotheticalTotalRewardCreditApplied;\n\t\t}\n\n\t\tif(rewardCreditDivTotal === 0){\n\t\t\t$('.rewardCreditDiv').hide();\n\t\t} else{\n\t\t\t$('.rewardCreditDiv .value').html('(' + numeral(rewardCreditDivTotal).format('$0,0.00') + ')');\n\t\t\t$('.rewardCreditDiv').show();\n\t\t}\n\n\t\tsetAmount($orderTotal, orderTotal);\n\t\tsetAmount($grandTotal, grandTotal);\n\n\t\t// @todo legacy code, we should only need one of these...\n\t\t$('#donation_total').val(donationTotal); // for sending to the server\n\t\tsetDonationAmount(donationTotal); // for displaying to the user\n\t}\n\n\n\tfunction updateBasketComplete() {\n\t\tvar lineItems, lineItem, i, rewardCredits, $loanTR, $basketTable\n\t\t, basketState = basket.state();\n\n\t\tif (! basketState) {\n\t\t\treturn;\n\t\t}\n\n\t\twwwApp.execute('updateBasketCount', basket.getBasketCount());\n\n\t\t//\tHandle the line items\n\t\tlineItems = basketState.lineItems.lineItems;\n\t\tfor(i = 0; i < lineItems.length; i++){\n\t\t\tlineItem = lineItems[i];\n\n\t\t\t// The first type of which is the loans\n\t\t\tif(lineItem.type == 'loan') {\n\t\t\t\t$loanTR = $('#loan_row' + lineItem.loanId);\n\n\t\t\t\tif (lineItem.qty <= 0) {\n\t\t\t\t\t$loanTR.hide();\n\t\t\t\t}\n\t\t\t\tsetDafEligibilityNotice(lineItem, $loanTR);\n\n\t\t\t\t$('select.amountSelect', $loanTR).val(parseInt(numeral(lineItem.unitPrice + lineItem.giftRedemptionsApplied + lineItem.promoGiftRedemptionsApplied + lineItem.rewardCreditApplied).value(), 10));\n\t\t\t\t$('select.teamSelect', $loanTR).val(parseInt(lineItem.teamId, 10) || 'NULL');\n\t\t\t}\n\t\t}\n\n\t\trewardCredits = basketState.rewardCredits;\n\t\t$('.basketItemRowLoan').each(function (index, rowEl) {\n\t\t\tvar $rowEl = $(rowEl)\n\t\t\t\t, $rewardCreditCol = $('.rewardCreditCol', $rowEl)\n\t\t\t\t, loanId = $rowEl.data('kv-loan-id');\n\n\t\t\tif (canLoanBeDedicated(loanId)) {\n\t\t\t\t$('a.dedicateLoan', $rowEl).show();\n\t\t\t} else {\n\t\t\t\t$('a.dedicateLoan', $rowEl).hide();\n\t\t\t}\n\n\t\t\tif (rewardCredits[loanId]) {\n\t\t\t\tmarkRewardLoan($rowEl, $rewardCreditCol, rewardCredits[loanId], lineItems, loanId);\n\t\t\t} else {\n\t\t\t\tunMarkRewardLoan($rowEl, $rewardCreditCol);\n\t\t\t}\n\t\t});\n\n\t\tupdateDonationBasketTotals();\n\n\t\t$basketTable = $('#my_basket_table');\n\t\tif ($basketTable.is(':hidden')) {\n\t\t\t$basketTable.show();\n\t\t}\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param loanId\n\t * @param settings\n\t */\n\tfunction updateRouteMap(loanId, settings) {\n\t\trouteMap[loanId] = routeMap[loanId] || {};\n\t\t$.extend(routeMap[loanId], settings);\n\t}\n\n\n\t/**\n\t * @todo - add test\n\t *\n\t * @param routeId\n\t */\n\tfunction doNavigaton(routeId) {\n\t\tvar oldId;\n\n\t\tfor (var rid in routeMap) {\n\t\t\tif (routeMap[rid].isActive) {\n\t\t\t\toldId = rid;\n\t\t\t\trouteMap[rid].isActive = false;\n\t\t\t}\n\t\t}\n\n\t\trouteMap[routeId].isActive = true;\n\n\t\t$('html, body').animate({scrollTop: 0});\n\t\t$main.height(routeMap[routeId].height);\n\n\t\tif (oldId) {\n\t\t\trouteMap[oldId].$el.css('display', 'none');\n\t\t}\n\n\t\trouteMap[routeId].$el.css('display', 'block');\n\t}\n\n\n\t/**\n\t *\n\t * @param {Number|String} routeId\n\t */\n\tfunction navigate(routeId) {\n\n\t\t// Prevent extra work\n\t\tif (routeMap[routeId] && routeMap[routeId].isActive) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!routeMap[routeId].jqXhr) {\n\t\t\tconsole.log('The dedication form for has not been loaded.');\n\t\t}\n\n\t\trouteMap[routeId].jqXhr.done(function () {\n\t\t\tdoNavigaton(routeId);\n\t\t});\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleRewardCreditAppliedMessageClick(event) {\n\t\tevent.preventDefault();\n\n\t\t// Use currentTarget in case the user clicks on a nested element inside of the anchor element.\n\t\tvar promo = $(event.currentTarget).data('kv-promo');\n\n\t\tkv.rustbucketbox(wwwApp.ajaxUrl('BasketViewLoansRewardSubView/' + promo), undefined, 400, undefined, undefined, undefined);\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleDonateRemainingCreditClick(event) {\n\t\tevent.preventDefault();\n\t\tvar remaining = numeral($kivaCreditRemainingValue.text()).value();\n\t\tvar total = remaining+basket.getDonationTotal();\n\n\n\t\tbasket.saveDonation(total).done(function (){\n\t\t\t$('#donation_edit_ab_amount').animate({'background-color': '#ffee90'},100,'swing',function(){\n\t\t\t\t$('#donation_edit_ab_amount').animate({'background-color': '#fff'},1500);\n\t\t\t});\n\t\t});\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleDonationEditClick(event) {\n\t\t// TODO: Track the click, wether the lightbox actually shows or not\n\n\t\tevent.preventDefault();\n\t\tshowNudge(basket.getDonationTotal());\n\t}\n\n\n\t/**\n\t *\n\t * @context Basket\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleUpsellMsgClick(event) {\n\t\tevent.preventDefault();\n\t\tkv.rustbucketbox($('.cardTosDialog').html(), undefined, 550, 415, undefined, undefined);\n\n\t}\n\n\n\t/**\n\t *\n\t * @context {Basket}\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleMyBasketFormSubmit(event) {\n\t\tif (nudgeFallback && !$.isNumeric(numeral($('#donation_edit_ab_amount').val()).value())) {\n\t\t\tevent.preventDefault();\n\t\t\tkv.tipMsg('Donation amount is invalid.', 'warning');\n\t\t} else {\n\t\t\tpopulateDonationTotalInput();\n\t\t}\n\n\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleIndiaLoanNoticeClick(event) {\n\t\tevent.preventDefault();\n\t\tkv.rustbucketbox('#indiaLoanNoticeLightbox', undefined, '70%');\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleTosCheckboxClick(event) {\n\t\tvar $myButton = $('#jqmWrapper .addOnePrintKivaCardOk');\n\n\t\tif ($(event.target).is(':checked')) {\n\t\t\t$myButton.show();\n\t\t} else {\n\t\t\t$myButton.hide();\n\t\t}\n\t}\n\n\n\t/**\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleAddOnePrintKivaCardClick(event) {\n\t\tevent.preventDefault();\n\n\t\tif ($('#jqmWrapper .tosAgreeCheckbox').attr('checked')) {\n\t\t\tmyJQModalClose();\n\t\t\tbasket.addOnePrintKivaCard();\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleTeamSelectChange(event) {\n\t\tbasket.assignLoanToTeam($(event.target).data('kv-loan-id'));\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleGiftValueChange(event) {\n\t\tvar $selectEl = $(event.target);\n\n\t\tbasket.updateGifts($selectEl.closest('tr').data('kv-gift-ids'), {amount: $selectEl.val()});\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleLoanValueChange(event) {\n\t\tbasket.updateLoan($(event.target).closest('tr').data('kv-loan-id'));\n\t}\n\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleRemoveGiftClick(event) {\n\t\tevent.preventDefault();\n\n\t\tvar $rowEl = $(event.target).closest('tr');\n\n\t\tbasket.removeGifts($rowEl.data('kv-gift-ids'));\n\t}\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleRemoveGiftRedemptionClick(event){\n\t\tif(viewData.latestBasketStateComplete.hasDafCode){\n\t\t\tevent.preventDefault();\n\n\t\t\twwwApp.$document.off('click', '.dafRemoveGiftCheckLightboxCancel').on('click', '.dafRemoveGiftCheckLightboxCancel', function () {\n\t\t\t\tmyJQModalClose();\n\t\t\t});\n\n\t\t\tkv.rustbucketbox(wwwApp.ajaxUrl('callBasketDafRemoveGiftCheckSubView'));\n\t\t}\n\t}\n\n\t/**\n\t *\n\t * @param {jQuery.Event} event\n\t */\n\tfunction handleRemoveLoanClick(event) {\n\t\tevent.preventDefault();\n\t\tbasket.removeLoan($(event.target).closest('tr').data('kv-loan-id'));\n\t}\n\n\n\n\tfunction handleBasketStateUpdate() {\n\t\tupdateBasketComplete();\n\t}\n\n\tfunction handleDocumentReady() {\n\t\tif (doShowNudgeOnLoad()){\n\t\t\tshowNudge(basket.getDonationTotal());\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @return {String|undefined}\n\t */\n\tfunction handleBeforeUnload() {\n\t\tif (basket.status == 'processing') {\n\t\t\treturn 'We have not finished processing your most recent request. Are you sure you want to leave this page?';\n\t\t}\n\t}\n\n\n\tfunction setAmount($el, val) {\n\t\tif ($el[0].nodeName.toLowerCase() == 'input') {\n\t\t\treturn $($el).val(numeral(val).format('$0,0.00'));\n\t\t} else {\n\t\t\treturn $($el).html(numeral(val).format('$0,0.00'));\n\t\t}\n\n\t}\n\n\n\tfunction getAmount($el) {\n\t\treturn numeral($($el).val()).value();\n\t}\n\n\n\tfunction setDonationAmount(val) {\n\t\treturn setAmount('#donation_edit_ab_amount', val);\n\t}\n\n\n\tfunction getDonationAmount() {\n\t\treturn getAmount('#donation_edit_ab_amount');\n\t}\n\n\n\tfunction formatDonationFallback(){\n\t\treturn setDonationAmount(getDonationAmount());\n\t}\n\n\n\tfunction redirectToFallback(){\n\t\tkv.load(wwwApp.conf.get('rootHttp') + 'basket?nudgeFallback=1');\n\t}\n\n\n\tfunction initializeBasketRouter() {\n\t\tvar Router = Backbone.Router.extend({\n\t\t\troutes: {\n\t\t\t\t'basket': function () {\n\t\t\t\t\tnavigate('basket');\n\t\t\t\t}\n\t\t\t\t, 'basket/dedicate/:loanId': function (loanId) {\n\t\t\t\t\tnavigate(loanId);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tBackbone.history.start({pushState: true, hashChange: false});\n\t\trouter = new Router();\n\t}\n\n\n\tfunction init(data) {\n\t\tviewData = data;\n\t\t$main = $('#main');\n\t\t$kivaCreditDiv = $('#kivaCreditDiv');\n\t\t$kivaCreditUsedValue = $('#kivaCreditUsedValue', $kivaCreditDiv);\n\t\t$kivaCreditRemainingDiv = $('#kivaCreditRemainingDiv');\n\t\t$kivaCreditRemainingValue = $('#kivaCreditRemainingValue', $kivaCreditRemainingDiv);\n\t\t$orderTotal = $('#orderTotal');\n\t\t$grandTotal = $('#grandTotal');\n\t\tnudgeErrorTpl = '
We encountered an error.

If you are not redirected shortly, please click here to edit your donation amount.

';\n\t\tbasket = new kv.Basket(viewData);\n\t\tnudgeFallback = !!viewData.nudgeFallback;\n\t\trouteMap = {};\n\n\t\tvar totals;\n\n\t\tif(viewData.latestBasketStateComplete && viewData.latestBasketStateComplete.hasDafCode && viewData.latestBasketStateComplete.hasNonDafLoans){\n\t\t\t$('#basketContinue').click(function (event) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif(basket && basket._ && basket._.state && basket._.state.hasNonDafLoans){\n\t\t\t\t\t$('#basketContinue').colorbox({\n\t\t\t\t\t\thref: kv.getAjaxUrl('dafIneligibleBasketContinueLightbox')\n\t\t\t\t\t\t, onComplete: function () {\n\t\t\t\t\t\t\t$('#dafIneligibleBasketContinueLightboxCheckoutAnyway').click(handleDafIneligibleBasketContinueLightboxCheckoutAnywayClick);\n\t\t\t\t\t\t\t$('#dafIneligibleBasketContinueLightboxCancel').click(handleDafIneligibleBasketContinueLightboxCancelClick);\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t$('#my-basket-form').submit();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// we have basket state and line items\n\t\t// the basket has a donation\n\t\t// a SINGLE donation\n\t\t// and other purchase totals==0\n\t\t// ie - this basket has only a single donation and nothing else (likely came from support us?)\n\t\t// no nudge in this case, just redirect to the fallback\n\t\tif(basket.state() && basket.state().lineItems && basket.state().hasDonation && basket.state().lineItems.lineItems.length<=1 && basket.getPurchaseTotal()===0 && !nudgeFallback){\n\t\t\tredirectToFallback();\n\t\t}\n\n\t\tinitializeBasketRouter();\n\n\t\tif(nudgeFallback){\n\t\t\t$('#donation_edit_ab_amount').blur(function (){\n\t\t\t\tformatDonationFallback();\n\t\t\t});\n\n\t\t\t// also do this once to initialize it to a money value\n\t\t\tformatDonationFallback();\n\t\t}\n\n\t\t$('.updateButton').click(function (){\n\t\t\t$('#updateFlag').val(true);\n\t\t});\n\n\t\t$('#donateRemainingCreditAction').click(handleDonateRemainingCreditClick);\n\t\t$('#donation_edit_link').click(handleDonationEditClick);\n\t\t$('#giftUpsell').click(handleUpsellMsgClick);\n\n\n\t\t$('#my-basket-form').submit($.proxy(handleMyBasketFormSubmit));\n\n\t\t$('div.indiaLoanNotice a.more').click(handleIndiaLoanNoticeClick);\n\n\t\twwwApp.$document.on('click', 'input.tosAgreeCheckbox', handleTosCheckboxClick);\n\t\twwwApp.$document.on('click', '.addOnePrintKivaCardOk', handleAddOnePrintKivaCardClick);\n\n\t\twwwApp.on('update.basketState', handleBasketStateUpdate);\n\n\t\t$main.on('change', 'tr.basketItemRowGift .amountSelect', handleGiftValueChange)\n\t\t\t.on('change', 'tr.basketItemRowLoan .teamSelect', handleTeamSelectChange)\n\t\t\t.on('change', 'tr.basketItemRowLoan .amountSelect', handleLoanValueChange)\n\t\t\t.on('click', 'a.removeGift', handleRemoveGiftClick)\n\t\t\t.on('click', 'a.removeLoan', handleRemoveLoanClick)\n\t\t\t.on('click', 'a.removeGiftRedemption', handleRemoveGiftRedemptionClick)\n\t\t\t.on('click', 'a.dedicateLoan, a.editDedicationLink', handleEditDedicationClick)\n\t\t\t.on('click', '.dedicateLoanForm .cancelButton', handleCancelDedicationClick);\n\n//\t\t\t@todo update to use qtip\n\t\t$('a.helpTip.mcHelpTip').qtip(wwwApp.showMCHelpTip());\n\t\t$('a.helpTip.promoHelpTip').qtip({\n\t\t\tcontent: {\n\t\t\t\ttitle: viewData.promo_tip_title\n\t\t\t\t, text: viewData.promo_tip_content\n\t\t\t}\n\t\t});\n\n\t\t$(handleDocumentReady);\n\t\t$(window).on('beforeunload', handleBeforeUnload);\n\n\t\t$('#next_step').val('reviewBasket');\n\n\n\t\t// for all events in the donation nudge project\n\t\tif (! basket.state()) {\n\t\t\treturn;\n\t\t}\n\n\t\ttotals = basket.state().basketTotals;\n\n\t\t$('#giftCodeHelp').click(function(event){\n\t\t\tevent.preventDefault();\n\t\t\tif ( $('body').hasClass('wwwmobile')) {\n\t\t\t\tkv.rustbucketbox($('.giftCodeHelpContent').html(), undefined, 210);\n\t\t\t} else {\n\t\t\t\tkv.rustbucketbox($('.giftCodeHelpContent').html(), undefined, 600);\n\t\t\t}\n\t\t});\n\n\t\tupdateBasketComplete();\n\t}\n\n\n\treturn {\n\t\tinit: init\n\t\t, populateDonationTotalInput: populateDonationTotalInput\n\t\t, updateBasketComplete: updateBasketComplete\n\t\t, loanHasRewardCreditsApplied: loanHasRewardCreditsApplied\n\t\t, canLoanBeDedicated: canLoanBeDedicated\n\t\t, unMarkRewardLoan: unMarkRewardLoan\n\t\t, getAmount: getAmount\n\t\t, setAmount: setAmount\n\t\t, getDonationAmount: getDonationAmount\n\t\t, setDonationAmount: setDonationAmount\n\t\t, showNudge: showNudge\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Basket/BasketView.js","define(['kvjQuery', 'kvLegacy', 'backbone'], function ($, kvLegacy, Backbone) {\n\t'use strict';\n\n\treturn Backbone.View.extend({\n\n\t\tel: '.main'\n\n\t\t, events: {\n\t\t\t'change .partnerListingForm select': 'handleInputChange'\n\t\t\t, 'change .partnerListingForm input': 'handleInputChange'\n\t\t}\n\n\n\t\t, initHelpTips: function () {\n\t\t\twwwApp.mcHelpTip('a.helpTipNoUnderline.mcHelpTip, a.helpTip.mcHelpTip');\n\t\t\twwwApp.sfHelpTip('a.helpTiphelpTipNoUnderline.sfHelpTip, a.helpTip.sfHelpTip');\n\t\t}\n\n\n\t\t, handleInputChange: function (event) {\n\t\t\tevent.target.form.submit();\n\t\t}\n\n\n\t\t, initialize: function () {\n\t\t\tthis.initHelpTips();\n\t\t}\n\t});\n});\n\n\n// WEBPACK FOOTER //\n// ./views/views/Partner/PartnerListingView.js","/* global google */\ndefine(function (require) {\n\t'use strict';\n\n\n\tvar $ = require('kvjQuery')\n\t, kvLegacy = require('kvLegacy')\n\t, Backbone = require('backbone');\n\t\n\treturn Backbone.View.extend({\n\n\t\tinitHelpTips: function () {\n\t\t\twwwApp.mcHelpTip('a.helpTip.mcHelpTip');\n\t\t\twwwApp.sfHelpTip('a.helpTip.sfHelpTip');\n\n\t\t\t// These used to be in lightboxes bc of the amount of text they have\n\t\t\t// Ideally, the text should be shortened and a \"more\" link should be provided.\n\t\t\twwwApp.sfHelpTip('a.helpTip.sfHelpTip_old');\n\t\t}\n\n\t\t, initialize: function () {\n\t\t\tthis.initHelpTips();\n\t\t}\n\n\t});\n});\n\n\n// WEBPACK FOOTER //\n// ./views/views/Partner/PartnerView.js","define(function (require) {\n\t'use strict';\n\n\tvar Backbone = require('kvBackbone');\n\n\n\treturn Backbone.View.extend({\n\n\t\tstartVideo : function () {\n\t\t\tthis.$playerIframe.attr('src', this.startValue);\n\t\t}\n\n\t\t, stopVideo : function () {\n\t\t\tthis.$playerIframe.attr('src', this.videoUrl);\n\t\t}\n\n\t\t, initialize : function () {\n\t\t\tvar self = this;\n\n\t\t\tthis.$playerIframe = this.$('#video-player');\n\t\t\tthis.videoUrl = this.$playerIframe.attr('src');\n\t\t\tthis.startValue = this.videoUrl + '&autoplay=1';\n\n\t\t\twwwApp.$document\n\t\t\t\t.on('opened.fndtn.reveal', '[data-reveal]', function () {\n\t\t\t\t\tself.startVideo();\n\t\t\t\t})\n\t\t\t\t.on('closed.fndtn.reveal', '[data-reveal]', function () {\n\t\t\t\t\tself.stopVideo();\n\t\t\t\t});\n\t\t}\n\t});\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/About/AboutUsView.js","define(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\treturn {\n\t\tinitSlideshow: function () {\n\t\t\tif ($('.bl-slideshow-wrapper').length) {\n\t\t\t\tvar slickOpts = {\n\t\t\t\t\tslide: '.bl-slide',\n\t\t\t\t\tslidesToShow: 1,\n\t\t\t\t\tslidesToScroll: 1,\n\t\t\t\t\tmobileFirst: true,\n\t\t\t\t\tdots: true,\n\t\t\t\t\tarrows: true,\n\t\t\t\t\tprevArrow: $('.bl-prev-arrow'),\n\t\t\t\t\tnextArrow: $('.bl-next-arrow')\n\t\t\t\t};\n\t\t\t\t// Init the slick\n\t\t\t\t$('.bl-slideshow-wrapper').slick(slickOpts);\n\t\t\t}\n\t\t},\n\n\t\tinit: function (data) {\n\t\t\tif (data && data.precheck_exp_version) {\n\t\t\t\twwwApp.kvTrack.isReady.done(function(){\n\t\t\t\t\twwwApp.kvTrack.trackEvent('Borrow', 'EXP-GROW-84-May2020', data.precheck_exp_version, undefined, true);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.initSlideshow();\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Borrower/LandingView.js","define(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\treturn {\n\t\tinit: function () {\n\t\t\t$('#image_preview_input_file').change(function(){\n\t\t\t\tfunction loaded(e) {\n\t\t\t\t\t$('.image_preview').attr('src', e.target.result);\n\t\t\t\t\t$('.image_preview').parent().show();\n\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (this.files && this.files[0]) {\n\t\t\t\t\tvar reader = new FileReader();\n\t\t\t\t\treader.readAsDataURL(this.files[0]);\n\t\t\t\t\treader.onload = loaded;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Borrower/PostUpdateView.js","define(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\treturn {\n\t\tmodifyApp: function(id, appId, methodName) {\n\t\t\twindow.location.href = '/build/apps/modify?id=' + id + '&app_id=' + appId + '&method_name=' + methodName;\n\t\t},\n\n\t\tinit: function (viewData) {\n\t\t\tvar self = this;\n\t\t\tvar id = viewData.id;\n\t\t\tvar appId = viewData.app_id;\n\t\t\tvar deleteAppLink = $('[data-reveal-id=' + id + ']');\n\t\t\tvar deleteAppLightbox = $('.decision-point-lightbox#' + id);\n\t\t\tvar closeLightBoxButton = $('.lightbox-content a.alternative-option');\n\t\t\tvar deleteAppButton = $('.lightbox-content a.main-option');\n\t\t\tvar publishAppButton = $('.button.publish');\n\t\t\tvar unpublishAppButton = $('.button.unpublish');\n\n\t\t\tdeleteAppLink.click( function() {\n\t\t\t\tvar deleteAppLightbox = $('.decision-point-lightbox#' + id);\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'open');\n\t\t\t});\n\n\t\t\tcloseLightBoxButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t});\n\n\t\t\tdeleteAppButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'delete');\n\t\t\t});\n\n\t\t\tpublishAppButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'publish');\n\t\t\t});\n\n\t\t\tunpublishAppButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'unpublish');\n\t\t\t});\n\n\t\t\tthis.initEnableDisable(id, appId, deleteAppLightbox);\n\t\t\tthis.initShowHideSecret();\n\t\t},\n\n\t\t// Splitin these up to keep jshint happy\n\t\tinitEnableDisable: function(id, appId, deleteAppLightbox) {\n\t\t\tvar self = this;\n\t\t\tvar resetTokensButton = $('.button.reset-tokens');\n\t\t\tvar disableAppButton = $('.button.disable');\n\t\t\tvar enableAppButton = $('.button.enable');\n\t\t\tenableAppButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'enable');\n\t\t\t});\n\n\t\t\tdisableAppButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'disable');\n\t\t\t});\n\n\t\t\tresetTokensButton.click( function() {\n\t\t\t\tdeleteAppLightbox.foundation('reveal', 'close');\n\t\t\t\tself.modifyApp(id, appId, 'resetSecrets');\n\t\t\t});\n\t\t},\n\n\t\tinitShowHideSecret: function() {\n\t\t\tvar revealSecretLink = $('.reveal-secret');\n\t\t\tvar hideSecretLink = $('.hide-secret');\n\n\t\t\trevealSecretLink.click( function() {\n\t\t\t\thideSecretLink.parent().show();\n\t\t\t\trevealSecretLink.parent().hide();\n\t\t\t});\n\n\t\t\thideSecretLink.click( function() {\n\t\t\t\trevealSecretLink.parent().show();\n\t\t\t\thideSecretLink.parent().hide();\n\t\t\t});\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Build/AppShowView.js","define(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\treturn {\n\t\tinit: function () {\n\t\t\t$('.app-preview').on('click', function() {\n\t\t\t\tvar id = $(this).attr('id');\n\t\t\t\twindow.location.href = '/build/apps/' + id;\n\t\t\t});\n\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Build/DashboardView.js","/* globals jQuery, kv, wwwApp, ga, snowplow, foundation */\ndefine(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\treturn {\n\t\tinitLazySlideshow: function () {\n\t\t\tif ($('#hp-slideshow2').length) {\n\t\t\t\tvar slickOpts = {\n\t\t\t\t\tslidesToShow: 1,\n\t\t\t\t\tslidesToScroll: 1,\n\t\t\t\t\tmobileFirst: true,\n\t\t\t\t\tdots: false,\n\t\t\t\t\tarrows: false,\n\t\t\t\t\tautoplay: true,\n\t\t\t\t\tautoplaySpeed: 5000,\n\t\t\t\t\tswipe: false\n\t\t\t\t};\n\t\t\t\t// Init the slick\n\t\t\t\t$('#hp-slideshow2').slick(slickOpts);\n\t\t\t}\n\t\t},\n\n\t\tconvertLazyImageToInterchange: function($image) {\n\t\t\t// get the data-lazy attr\n\t\t\tvar lazyData = $image.attr('data-lazy');\n\t\t\t// convert it to data-interchange if it exists\n\t\t\tif (lazyData !== undefined) {\n\t\t\t\t$image.attr('data-interchange', lazyData.trim());\n\t\t\t\t$image.removeAttr('data-lazy');\n\t\t\t\t// reflow this new interchange image\n\t\t\t\t$image.foundation('interchange', 'reflow');\n\t\t\t}\n\t\t},\n\n\t\tsetupLazyImageSlideShow: function() {\n\t\t\tvar $hpSlideshow = $('#hp-slideshow2')\n\t\t\t\t, $lazyImages = $('img[data-lazy]')\n\t\t\t\t, lazyImageCount = $lazyImages.length // Setup count of lazy slides\n\t\t\t\t, hp = this;\n\n\t\t\t// init slideshow\n\t\t\tthis.initLazySlideshow();\n\n\t\t\t// initialize on beforeChange using slide index to address queue\n\t\t\t$hpSlideshow.on('beforeChange', function(event, slick, currentSlide){\n\t\t\t\t// operate on lazy image in queue converting lazy to interchange and calling reflow\n\t\t\t\tif (lazyImageCount > 1) {\n\t\t\t\t\thp.convertLazyImageToInterchange($lazyImages.eq(currentSlide));\n\t\t\t\t\tlazyImageCount--;\n\t\t\t\t} else if (lazyImageCount === 1) {\n\t\t\t\t\thp.convertLazyImageToInterchange($lazyImages.eq(currentSlide));\n\t\t\t\t\tlazyImageCount--;\n\t\t\t\t\t// slick duplicates the last image appending it to the beginning of the list\n\t\t\t\t\t// so we have to convert it to interchange too as it wasn't converted when initialized\n\t\t\t\t\t$('.slick-initialized img[data-lazy]').each(function(i, item) {\n\t\t\t\t\t\thp.convertLazyImageToInterchange($(item));\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\t// Turn off the change behavior when all lazy-data has been converted\n\t\t\t\t\t$hpSlideshow.off('beforeChange');\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tfireHomepageInitTracking: function(viewData) {\n\t\t\twwwApp.kvTrack.isReady.done(function() {\n\t\t\t\tif (viewData.category_rows_exp_version) {\n\t\t\t\t\twwwApp.kvTrack.trackEvent('Home', 'EXP-CategoryRows', viewData.category_rows_exp_version, null, true);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tinit: function (viewData) {\n\n\t\t\tthis.setupLazyImageSlideShow();\n\n\t\t\tthis.fireHomepageInitTracking(viewData);\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Home/HomeView.js","define(function (require) {\n 'use strict';\n\n var OneClickUtils = require('./OneClickUtils.js');\n\n return {\n init: function (options) {\n OneClickUtils.init();\n },\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/OneclickMessaging/OneclickMessagingView.js","/* globals jQuery, kv, wwwApp */\ndefine(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\tvar _ = require('underscore');\n\n\treturn {\n\t\tcodeRedeemed: false,\n\t\tcodeAmount: 0,\n\t\thasError: false,\n\n\t\tinit: function(viewData) {\n\t\t\tvar self = this;\n\n\t\t\t// apply white to Kiva Card CMS help headers\n\t\t\t$('.giftCodeHelpContent h1, .giftCodeHelpContent h2').addClass('white');\n\n\t\t\t$('.helplink').on('click', function() {\n\t\t\t\tself.onClickRedemptionHelpLink(viewData);\n\t\t\t});\n\n\t\t\t$('#addGiftRedemptionForm').on('submit', function() {\n\t\t\t\tself.onSubmitRedemptionCode();\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t// show modal light-box\n\t\t\t$('#redeem-details').foundation('reveal', 'open');\n\n\t\t\t// event listener: display message upon modal light-box and close only if code not applied\n\t\t\t$(document).on('close.fndtn.reveal', '[data-reveal]', function () {\n\n\t\t\t\t// only show tip message if an error has occurred or if there are no codes in the basket\n\t\t\t\tif (self.hasError === false || viewData.hasRedemptions === false) {\n\t\t\t\t\tif (self.codeRedeemed === true) {\n\n\t\t\t\t\t\t// validate the gift card value is a number (float or integer)\n\t\t\t\t\t\tvar giftCardValue = self.codeAmount;\n\t\t\t\t\t\tvar giftCardValueMessage = '';\n\n\t\t\t\t\t\tif (_.isNumber(giftCardValue)) {\n\t\t\t\t\t\t\tgiftCardValueMessage = '$' + parseFloat(giftCardValue).toFixed(2);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tkv.tipMsg('Your ' + giftCardValueMessage + ' Kiva Card will be applied at checkout automatically. Just choose someone to support from the categories below, head to checkout and we\\'ll do the rest!', 'info');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tkv.tipMsg('Your Kiva Card wasn\\'t applied, but don\\'t worry, you\\'ll have another chance to enter it at checkout.', 'info');\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tonClickRedemptionHelpLink: function(viewData) {\n\t\t\t$('.helplink').hide();\n\t\t\t$('.giftCodeHelpContent').show();\n\t\t},\n\n\t\tonSubmitRedemptionCode: function() {\n\t\t\tvar self = this;\n\t\t\tvar errorColor = '#d8d8d8';\n\n\t\t\treturn $.ajax({\n\t\t\t\turl: wwwApp.ajaxUrl('addOneGiftRedemption')\n\t\t\t\t, type: 'POST'\n\t\t\t\t, dataType: 'json'\n\t\t\t\t, data: {code: $('#code').val()}\n\t\t\t\t, success: function (result) {\n\t\t\t\t\tif (!result) {\n\t\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t\t$('#ajaxstatus').html('There was an error. Please try again.').css('color', errorColor);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!result.success) {\n\t\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t\t$('#ajaxstatus').html(result.errmsg).css('color', errorColor);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// set code values for tip message\n\t\t\t\t\tif (result.errmsg === null) {\n\t\t\t\t\t\tself.codeRedeemed = true;\n\t\t\t\t\t\tself.codeAmount = result.tipmsg;\n\t\t\t\t\t}\n\n\t\t\t\t\t// clear / hide any messages\n\t\t\t\t\t$('#ajaxstatus').empty();\n\t\t\t\t\t$('#cardDiv, .helplink, .giftCodeHelpContent').hide();\n\n\t\t\t\t\t// close modal light-box\n\t\t\t\t\t$('#redeem-details').foundation('reveal', 'close');\n\t\t\t\t}\n\t\t\t\t, error: function () {\n\t\t\t\t\tself.hasError = true;\n\t\t\t\t\t$('#ajaxstatus').html('There was an error. Please try again.').css('color', errorColor);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\tisFloat: function(n) {\n\t\t\t/*jslint bitwise: true */\n\t\t\treturn n === +n && n !== (n|0);\n\t\t},\n\n\t\tisInteger: function(n) {\n\t\t\t/*jslint bitwise: true */\n\t\t\treturn n === +n && n === (n|0);\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/Redeem/RedeemView.js","define(function (require) {\n\t'use strict';\n\n\tvar JobListingsSubView = require('views/Xb/WorkWithUs/JobListingsSubView');\n\n\treturn {\n\t\tinit: function() {\n\t\t\tJobListingsSubView.init();\n\t\t}\n\t};\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/WorkWithUs/CareersView.js","/* globals jQuery, kv, wwwApp */\ndefine(function (require) {\n\t'use strict';\n\n\tvar $ = require('jquery');\n\n\tfunction recordRTPApplyClicks(eventLabel) {\n\t\twwwApp.kvTrack.trackEvent('workWithUs', 'RTP Apply Click', eventLabel, undefined, true);\n\t}\n\n\treturn {\n\t\tinit: function() {\n\t\t\t$('.rtp-editing a.read-more').click(function() {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-editing div.read-more, .rtp-editing .photo, .rtp-editing div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\t$('.rtp-editing .row:last-of-type').addClass('hide-for-small-only');\n\t\t\t\trecordRTPApplyClicks('editing-program-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-trans a.read-more').click(function() {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-trans div.read-more, .rtp-trans .photo, .rtp-trans div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\t$('.rtp-trans .row:last-of-type').addClass('hide-for-small-only');\n\t\t\t\trecordRTPApplyClicks('translation-program-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-lead a.read-more').click(function() {\n\t\t\t\t$(this).hide();\n\t\t\t\t$('.rtp-lead div.read-more, .rtp-lead .photo, .rtp-lead div.show-for-small-only.small-12.columns .photo').show();\n\t\t\t\trecordRTPApplyClicks('team-leader-read-more');\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-steps a.view-all-steps').click(function() {\n\t\t\t\t$('.rtp-steps a.view-all-steps').hide();\n\t\t\t\t$('.rtp-steps .steps').show();\n\t\t\t\t$('.rtp-steps .row.divider').hide();\n\t\t\t\treturn false;\n\t\t\t});\n\n\t\t\t$('.rtp-editing .ready-to-apply a').click(function() {\n\t\t\t\trecordRTPApplyClicks('editing-program-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-trans .ready-to-apply a').click(function() {\n\t\t\t\trecordRTPApplyClicks('translation-program-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-lead .ready-to-apply a').click(function() {\n\t\t\t\trecordRTPApplyClicks('team-leader-apply');\n\t\t\t});\n\n\t\t\t$('.rtp-apply-now a.button').click(function() {\n\t\t\t\trecordRTPApplyClicks('bottom-cta-apply');\n\t\t\t});\n\t\t}\n\t};\n});\n\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/WorkWithUs/ReviewersView.js","/*tombstone inserted 2018-08-08*/ try { /*global tombstone*/ tombstone('/sites/www_kiva/client/src/models/Basket.js'); } catch(e) {}\n/*jshint maxdepth: 5, maxstatements: 30*/\n\ndefine(function (require) {\n\t'use strict';\n\n\n\tvar $ = require('kvjQuery')\n\t, uri = require('simpleUri')\n\t, numeral = require('numeral');\n\n\n\t// @todo the idea here is to get these messages into one spot and eventually make organize them\n\tvar basketError = {\n\t\tsaveDonationBadResults: 'There was an error updating the donation amount. Please try again.'\n\t\t, updateLoanBadResults: 'There was a problem updating your loan, please refresh the page and try again (2)'\n\t\t, updateGiftsBadResults: 'There was a problem updating your kiva card purchase, please refresh the page and try again'\n\t\t, assignLoanToTeamBadResults: 'There was an error applying the loan to the specified team. Please try again.'\n\t};\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleUpdateLoanSuccess(result) {\n\t\tif (result.bounceUrl) {\n\t\t\turi(result.bounceUrl).load();\n\t\t}\n\n\t\tif (result.err_code && result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tvar newAmount = parseInt(result.new_amount, 10);\n\n\t\t// @todo this should go into the kv.basketUi::updateBasketComplete routine\n\t\tif (typeof newAmount == 'number') {\n\t\t\tif (newAmount === 0) {\n\t\t\t\t$('#loan_row' + result.loan_id).hide().remove();\n\t\t\t\tkv.publish('basket:removeLoan');\n\t\t\t} else {\n\t\t\t\t$('#loan' + result.loan_id).val(newAmount);\n\t\t\t}\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.updateLoanBadResults, 'error');\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleUpdateLoanError(result) {\n\t\t$('#loading_loan' + result.loan_id).hide();\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleAssignLoanToTeamSuccess(result) {\n\t\tif (result.err_code && result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.assignLoanToTeamBadResults, 'error');\n\t\t}\n\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleAssignLoanToTeamError(result) {\n\t\t$('#loading_team' + result.loan_id).hide();\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleSaveDonationSuccess(result) {\n\t\tif (result) {\n\t\t\tif (result.success && result.basketStateComplete) {\n\t\t\t\tthis.state(result.basketStateComplete);\n\t\t\t} else if (!result.success && result.tipmsg) {\n\t\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t\t} else {\n\t\t\t\twwwApp.tipMsg(basketError.saveDonationBadResults, 'error');\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} result\n\t */\n\tfunction handleUpdateGiftsSuccess(result) {\n\t\tvar i, giftIds, $rowEl;\n\n\t\tif (result.err_code == -100) {\n\t\t\tkv.jumpToLogin();\n\t\t}\n\n\t\tif (result.success && result.basketStateComplete) {\n\t\t\t// @todo this should go into basketUi::updateBasketComplete routine, however, that will require adding giftIds to the gift lineItems, or at least somewhere inside of the basketState object\n\t\t\tif ($.isArray(result.gift_ids) && result.new_data) {\n\t\t\t\tif (! parseInt(result.new_data.amount, 10)) {\n\t\t\t\t\tgiftIds = result.gift_ids;\n\n\t\t\t\t\tfor(i = 0; i < giftIds.length; i++) {\n\t\t\t\t\t\t$rowEl = $('#gift_row_' + giftIds[i]);\n\n\t\t\t\t\t\t// @todo cleanup\n\t\t\t\t\t\t// Each basket gift row can contain multiple gifts. So how do you know the id of the row?\n\t\t\t\t\t\t// What we do is loop over each gift id until we find a matching basket gift row.\n\t\t\t\t\t\tif ($rowEl.length) {\n\t\t\t\t\t\t\t$rowEl.remove();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (result.tipmsg) {\n\t\t\t\t\t\twwwApp.tipMsg(result.tipmsg);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.state(result.basketStateComplete);\n\t\t} else if (!result.success && result.tipmsg) {\n\t\t\twwwApp.tipMsg(result.tipmsg, 'error');\n\t\t} else {\n\t\t\twwwApp.tipMsg(basketError.updateGiftsBadResults, 'error');\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} results\n\t */\n\tfunction handleAddOnePrintKivaCardSuccess(results) {\n\t\tif (results.success) {\n\t\t\turi().reload();\n\t\t} else {\n\t\t\twwwApp.tipMsg(results.tipmsg, 'error');\n\t\t}\n\t}\n\n\n\t/**\n\t *\n\t * @context {Basket}\n\t */\n\tfunction handleBasketAjaxAlways() {\n\t\tthis.status = 'ready';\n\t}\n\n\n\t/**\n\t *\n\t * @context {Basket}\n\t */\n\tfunction handleBasketAjaxFail() {\n\t\tthis.state(this.state());\n\t\twwwApp.tipMsg('Error communicating with the server. It might have been caused by unusually high traffic on the Kiva Web site, spotty internet connection, or by a technical failure. Please try again.', 'error');\n\t}\n\n\n\t/**\n\t *\n\t * @param {Object} data\n\t * @constructor\n\t */\n\tfunction Basket(data) {\n\t\tthis._ = {state: data.latestBasketStateComplete};\n\t\tthis.status = 'ready';\n\t\tthis.loans = data.loans;\n\t\tthis.donationPercentage = data.checkoutFeePercentage === undefined ? 15 : data.checkoutFeePercentage;\n\t\tthis.forceDeposit = data.forceDeposit;\n\t}\n\n\n\t/**\n\t * All basket ajax requests should go through here.\n\t *\n\t * @param args\n\t * @return {jQuery.jqXhr}\n\t */\n\tBasket.prototype.ajax = function (args) {\n\t\tthis.status = 'processing';\n\n\t\tif (args) {\n\t\t\targs.type = 'post';\n\t\t\targs.dataType = 'json';\n\t\t\targs.context = this;\n\t\t}\n\n\t\treturn $.ajax(args)\n\t\t\t.fail($.proxy(handleBasketAjaxFail, this))\n\t\t\t.always($.proxy(handleBasketAjaxAlways, this));\n\t};\n\n\n\t/**\n\t *\n\t * @todo add timestamp check before saving\n\t * @return {Object}\n\t */\n\tBasket.prototype.state = function (stateObj) {\n\t\tif (stateObj) {\n\t\t\tthis._.state = stateObj;\n\t\t\twwwApp.trigger('update.basketState', stateObj);\n\t\t}\n\n\t\treturn this._.state;\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getDonationTotal = function () {\n\t\tvar basketState = this.state();\n\n\t\tif(basketState.hasDonation && basketState.basketTotals && basketState.basketTotals.donation_total){\n\t\t\treturn(numeral(basketState.basketTotals.donation_total).value());\n\t\t}\n\n\t\treturn this.getPurchaseTotal() * (this.donationPercentage / 100);\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getPurchaseTotal = function () {\n\t\tvar totals = this.state().basketTotals;\n\n\t\treturn numeral(totals.gifts_total).value() + numeral(totals.loans_total).value();\n\t};\n\n\n\t/**\n\t * Very similar to getKivaCreditApplied(), only this does NOT take \"forceDeposit\" into consideration\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getKivaCreditApplicable = function () {\n\t\tvar lineItems = this.state().lineItems;\n\n\t\treturn Math.max(0, Math.min(lineItems.kivaCredit, this.getOrderTotal() - (lineItems.totalRewardCredits + lineItems.totalGiftRedemptions + lineItems.totalPromoGiftRedemptions)));\n\t};\n\n\n\t/**\n\t * @todo @uglymunky Really confusing how we calculate this, it should be calculated on the server.\n\t * @return {Number}\n\t */\n\tBasket.prototype.getKivaCreditApplied = function () {\n\t\treturn this.forceDeposit\n\t\t\t? 0\n\t\t\t: this.getKivaCreditApplicable();\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getCreditTotal = function () {\n\t\tvar lineItems = this.state().lineItems;\n\n\t\treturn lineItems.totalGiftRedemptions + lineItems.totalPromoGiftRedemptions + this.getKivaCreditApplied() + lineItems.totalRewardCredits + (lineItems.kivaCredit < 0 ? lineItems.kivaCredit : 0);\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getBasketCount = function () {\n\t\tvar i\n\t\t\t, count = 0\n\t\t\t, lineItems = this.state().lineItems.lineItems;\n\n\t\tfor (i = 0; i < lineItems.length; i++) {\n\t\t\tif (lineItems[i].type != 'donation') {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\n\t\treturn count;\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getOrderTotal = function () {\n\t\treturn this.getPurchaseTotal() + this.getDonationTotal();\n\t};\n\n\n\t/**\n\t *\n\t * @return {Number}\n\t */\n\tBasket.prototype.getGrandTotal = function () {\n\t\treturn Math.max(0, this.getPurchaseTotal() + this.getDonationTotal() - this.getCreditTotal());\n\t};\n\n\n\t/**\n\t *\n\t * @param {Number|String} newAmount\n\t * @return {jQuery.jqXhr}\n\t */\n\tBasket.prototype.saveDonation = function (newAmount) {\n\t\tif (!newAmount || newAmount < 0 || newAmount == '$0.00') {\n\t\t\tnewAmount = 0;\n\t\t}\n\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketSaveDonation')\n\t\t\t, data: {new_amount: newAmount}\n\t\t\t, success: handleSaveDonationSuccess\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @param {Number} loan_id\n\t * @return {jQuery.jqXhr}\n\t */\n\tBasket.prototype.assignLoanToTeam = function(loan_id) {\n\t\tvar team_id = $('#loan_team' + loan_id).val();\n\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketAssignLoanToTeam')\n\t\t\t, data:{loan_id: loan_id, team_id: team_id}\n\t\t\t, success: handleAssignLoanToTeamSuccess\n\t\t\t, error: handleAssignLoanToTeamError\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @param loan_id\n\t * @param new_value\n\t * @return {jQuery.jqXhr}\n\t */\n\tBasket.prototype.updateLoan = function(loan_id, new_value) {\n\t\tif (new_value === undefined || new_value === null) {\n\n\t\t\t// fallback\n\t\t\tnew_value = $('#loan' + loan_id).val();\n\n\t\t\tif (new_value === undefined || new_value === null) {\n\t\t\t\twwwApp.tipMsg('There was a problem updating your loan, please refresh the page and try again. (1)', 'error');\n\t\t\t\treturn this.ajax();\n\t\t\t}\n\t\t}\n\t\tvar crumb_string = wwwApp.cookie.get('kvis').replace('crumb=','');\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketUpdateLoan')\n\t\t\t, data: {loan_id: loan_id, new_amount: new_value, crumb: crumb_string}\n\t\t\t, success: handleUpdateLoanSuccess\n\t\t\t, error: handleUpdateLoanError\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @param {String} giftIDs A space separated string of ids\n\t * @param {Object} newValues Can be a new amount or an object of new values\n\t * @returns {jQuery.jqXhr}\n\t */\n\tBasket.prototype.updateGifts = function (giftIDs, newValues) {\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketUpdateGift')\n\t\t\t, data: $.extend(newValues, {gift_ids: giftIDs})\n\t\t\t, success: handleUpdateGiftsSuccess\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @return {jQuery.jqXhr}\n\t */\n\tBasket.prototype.addOnePrintKivaCard = function () {\n\t\treturn this.ajax({\n\t\t\turl: wwwApp.ajaxUrl('basketAddGift')\n\t\t\t, data: {\n\t\t\t\tgift_amount: '25' // 25_hard_coded\n\t\t\t\t, gifts_per_recipient: '1'\n\t\t\t\t, delivery_type: 'print'\n\t\t\t\t, scheduled_recipient_delivery_date: '11/07/2011'\n\t\t\t\t, recipient_name: ''\n\t\t\t\t, recipient_email: ''\n\t\t\t\t, sender_name: ''\n\t\t\t\t, gift_message: ''\n\t\t\t\t, agree_terms: 'on'\n\t\t\t\t, submit: 'print'\n\t\t\t\t, isAjax: true\n\t\t\t\t, showTipmsg: true\n\t\t\t}\n\t\t\t, success: handleAddOnePrintKivaCardSuccess\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @param {Number} loanId\n\t * @return {*}\n\t */\n\tBasket.prototype.removeLoan = function (loanId) {\n\t\tvar self = this\n\t\t, entrep_name = this.loans[loanId].entrep_name;\n\t\t\n\t\t\n\t\twwwApp.confirm('Are you sure you want to remove your loan to ' + entrep_name + '?').done(function (result) {\n\t\t\tif (result) {\n\t\t\t\tself.updateLoan(loanId, 0);\n\t\t\t}\n\t\t});\n\t};\n\n\n\t/**\n\t *\n\t * @param {String} giftIds Can be one gift id or an array of gift ids\n\t */\n\tBasket.prototype.removeGifts = function(giftIds) {\n\t\tvar self = this\n\t\t, message = String(giftIds).indexOf(' ') == -1\n\t\t\t? 'Are you sure you want to remove this gift?'\n\t\t\t: 'Are you sure you want to remove these gifts?';\n\n\t\twwwApp.confirm(message).done(function (result) {\n\t\t\tif (result) {\n\t\t\t\tself.updateGifts(giftIds, {amount: 0});\n\t\t\t}\n\t\t});\n\t};\n\n\n\treturn Basket;\n});\n\n\n\n// WEBPACK FOOTER //\n// ./models/Basket.js","/* global Xb_Oneclick_DonateRemainingCredit */\ndefine(function (require) {\n 'use strict';\n\n var $ = require('jquery');\n\n // Update the text of the lightbox upon success\n function reversalSuccess(result) {\n if (result.success === true) {\n $('.donationText').hide();\n $('.donationReversed').show();\n } else {\n $('.donationText').hide();\n $('.donationReversalFailed').show();\n }\n }\n\n // Update the text of the lightbox upon failure\n function reversalFailed() {\n $('.donationText').hide();\n $('.donationReversalFailed').show();\n }\n\n function reverseDonation(e) {\n e.preventDefault();\n // Do ajax callback to actually reverse the donation\n if (typeof Xb_Oneclick_DonateRemainingCredit === 'object') {\n $.ajax({\n url: wwwApp.ajaxUrl('reverseDonation')\n , type: 'POST'\n , dataType: 'json'\n , data: {\n fund_account_id: Xb_Oneclick_DonateRemainingCredit.fund_account_id\n , amount: Xb_Oneclick_DonateRemainingCredit.donation_amount\n }\n , success: reversalSuccess\n , error: reversalFailed\n });\n } else {\n reversalFailed();\n }\n }\n\n return {\n init: function () {\n // activate removal link only if in proper context\n if ($('#oneclick').length && $('a.reverseDonation').length) {\n $('a.reverseDonation').click(reverseDonation);\n }\n }\n };\n});\n\n\n\n// WEBPACK FOOTER //\n// ./views/views/Xb/OneclickMessaging/OneClickUtils.js"],"sourceRoot":""}