1623d41a38d4c49affa924b688a4250e7b32cd659b73131faf19e6120325801d

Source Code:

(function(g){var h=window.AmazonUIPageJS||window.P,m=h._namespace||h.attributeErrors,b=m?m("MonthlyPaymentsDetailPageAssets",""):h;b.guardFatal?b.guardFatal(g)(b,window):b.execute(function(){g(b,window)})})(function(g,h,m){g.when("A").register("monthly-payments-equal-pay-common",function(b){var f=b.$,a={TWISTER_DEBOUNCE_DURATION:300,counter:{checkboxShown:"salmon-mp-ep-dp-checkbox-shown",checkboxHiddenHtmlUnrecognized:"salmon-mp-ep-dp-checkbox-hidden-html-unrecognized",checkboxHiddenMissingPaymentOfferInfo:"sal-mp-ep-dp-checkbox-hidden-missing-paymentOfferInfo",
checkboxHiddenOneClickDetected:"salmon-mp-ep-dp-checkbox-hidden-one-click-detected",checkboxHiddenMissingAddToCartButton:"salmon-mp-ep-dp-checkbox-hidden-missing-add-to-cart-button",checkboxHiddenMissingBuyNowButton:"salmon-mp-ep-dp-checkbox-hidden-missing-buy-now-button",checkboxHiddenInstallmentsDetected:"salmon-mp-ep-dp-checkbox-hidden-installments-detected",checkboxChecked:"salmon-mp-ep-dp-checkbox-checked",checkboxUnchecked:"salmon-mp-ep-dp-checkbox-unchecked",checkboxCheckedAddToCartClicked:"salmon-mp-ep-dp-checkbox-checked-addtocart-clicked",
checkboxCheckedBuynowClicked:"salmon-mp-ep-dp-checkbox-checked-buynow-clicked",checkboxUncheckedAddToCartClicked:"salmon-mp-ep-dp-checkbox-unchecked-addtocart-clicked",checkboxUncheckedBuynowClicked:"salmon-mp-ep-dp-checkbox-unchecked-buynow-clicked",messageAddToCartClicked:"salmon-mp-ep-dp-message-addtocart-clicked",messageBuynowClicked:"salmon-mp-ep-dp-message-buynow-clicked",messageShown:"salmon-mp-ep-dp-message-shown",continueButtonClicked:"salmon-mp-ep-dp-continue-button-clicked",tncOpened:"salmon-mp-ep-dp-tnc-opened",
tncCheckboxChecked:"salmon-mp-ep-dp-tnc-checkbox-checked",tncCheckboxUnchecked:"salmon-mp-ep-dp-tnc-checkbox-unchecked",tncNoThankYouOrExit:"salmon-mp-ep-dp-tnc-no-thank-you-or-exit",featureNotPresent:"salmon-mp-ep-dp-feature-not-present"},reftag:{failedDataInputs:"DATA_INPUTS_NOT_FOUND:",missingPaymentOfferInfo:"MISSING_PAYMENT_OFFER_INFO:",oneClickDetected:"ONE_CLICK_DETECTED:",htmlUnrecognized:"HTML_UNRECOGNIZED:",missingAddToCartButton:"MISSING_ADD_TO_CART_BUTTON:",missingBuyNowButton:"MISSING_BUY_NOW_BUTTON:",
installmentsDetected:"INSTALLMENTS_DETECTED:"},selector:{addToCartButton:"#add-to-cart-button",buyNowButton:"#buy-now-button",oneClickButton:"#one-click-submit-btn",addToCartFormDesktop:"div#qualifiedBuybox form#addToCart, div#newAccordionRow form#addToCart",addToCartFormMobile:"div#mobile_qualifiedBuybox_feature_div form#addToCart",buyNowForm:"form#buyNowCheckout",mobileWebBuyNowForm:"form#buyNow",atcPaymentOfferInfo:"#atcPaymentOfferInfo",bnPaymentOfferInfo:"#bnPaymentOfferInfo",mpEpBuyboxFinancingCheckbox:".mp-ep-buybox-financing-checkbox",
monthlyPaymentsFeature:"#monthlyPayments_feature_div",installmentsMobileFeature:"#mobileapp_installmentPaymentAccordionRow",atcDeclarative:"div#mobileapp_qualifiedBuybox_feature_div #atc-declarative",tabletActDeclarative:'.a-declarative[data-action\x3d"add-to-cart"]:has([id\x3d"buybox.addToCart"])',buyBoxAtcData:"#buybox-atc-data",bnSpanFirstChild:"#buyNow \x3e :first",mpPaymentOfferInfo:"#mp-ep-payment-offer-info",mpEpPriceIntegerValue:"#mp-ep-plcc-tnc-price-integ-value",mpEpPriceDecimalValue:"#mp-ep-plcc-tnc-price-decimal-value",
mpEpPriceDollarIcon:"#mp-ep-plcc-price-dollar-icon"},id:{bnSpan:"buyNow",buyBoxAtcData:"buybox-atc-data",atcPaymentOfferInfo:"atcPaymentOfferInfo",atcDeclarative:"atc-declarative",bnPaymentOfferInfo:"bnPaymentOfferInfo",asin:"input#ASIN"},isFeaturePresent:function(){return!(!f(a.selector.monthlyPaymentsFeature).length||!f(a.selector.mpPaymentOfferInfo).length)},logCounter:function(a){h.ue&&h.ue.count&&h.ue.count(a,1)},logRefTag:function(a){f.get("/gp/product/ajax-handlers/reftag.html/ref\x3d"+("MONTHLY_PAYMENTS_"+
a+h.location.href))},urlParam:function(a){try{return(new RegExp("[?\x26]"+a+"\x3d([^\x26#]*)")).exec(h.location.href)[1]||0}catch(c){return 0}},isCheckboxSelected:function(a){return!!(a&&a.isChecked&&a.isChecked())},updateStateFromCheckbox:function(b,c){a.isCheckboxSelected(b)?c.check():c.uncheck()},isPaymentOfferInfoPresent:function(a){return!!a},logger:{fatal:function(a,c){g.logError(c,a,"FATAL")},error:function(a,c){g.logError(c,a,"ERROR")},warn:function(a,c){g.logError(c,a,"WARN")}},getPaymentOfferInfo:function(){var b=
f(a.selector.mpPaymentOfferInfo).attr("data-executioninfo");if(b)b=JSON.parse(b);else var b=f(a.selector.mpPaymentOfferInfo).attr("data-cardType"),c=f(a.selector.mpPaymentOfferInfo).attr("data-offerType"),b={cardType:b,offerType:c};return b}};return a});g.when("A","a-button","a-checkbox","a-modal","monthly-payments-equal-pay-common").execute("mp-ep-tnc",function(b,f,a,g,c){var h=b.$,n,d=!1,k=a(".mp-ep-buybox-financing-checkbox input[type\x3d'checkbox']"),e=a(".mp-ep-terms-and-conditions-checkbox input[type\x3d'checkbox']"),
p=f(".mp-ep-terms-and-conditions-confirm-button");b.declarative("acceptTermsAndConditionsConfirmButton","click",function(){d=!0;c.updateStateFromCheckbox(e,k);n.hide();c.logCounter(c.counter.continueButtonClicked)});b.declarative("acceptTermsAndConditionsCancelButton","click",function(){d=!1;n.hide()});b.declarative("selectMonthlyPaymentsEqualPayCheckbox","click",function(){k&&c.updateStateFromCheckbox(k,e)});b.declarative("selectEqualPayTermsAndConditionsCheckbox","click",function(){e.isChecked()?
c.logCounter(c.counter.tncCheckboxChecked):c.logCounter(c.counter.tncCheckboxUnchecked)});var q=b.debounce(function(){k=a(".mp-ep-buybox-financing-checkbox input[type\x3d'checkbox']");e=a(".mp-ep-terms-and-conditions-checkbox input[type\x3d'checkbox']");p=f(".mp-ep-terms-and-conditions-confirm-button");k.enable(!0);b.on("a:popover:beforeHide:mp-ep-terms-and-conditions-content",function(){d||c.logCounter(c.counter.tncNoThankYouOrExit)});b.on("a:popover:afterShow:mp-ep-terms-and-conditions-content",
function(){n||(n=g.get(h("#mp-ep-terms-and-conditions-popover")));e.isEmpty()&&(e=a(".mp-ep-terms-and-conditions-checkbox input[type\x3d'checkbox']"));p.isEmpty()&&(p=f(".mp-ep-terms-and-conditions-confirm-button"));c.logCounter(c.counter.tncOpened)})},c.TWISTER_DEBOUNCE_DURATION);q();b.on("a:pageUpdate",q)});g.when("A","a-checkbox","monthly-payments-equal-pay-common","a-modal").execute(function(b,f,a){function g(){if(d(a.selector.mpEpPriceIntegerValue).length&&d(a.selector.mpEpPriceDecimalValue).length&&
d(a.selector.mpEpPriceDollarIcon).length){var b=p.split(".");2===b.length&&b[0]&&b[1]&&(d(a.selector.mpEpPriceDollarIcon).text("$"),d(a.selector.mpEpPriceIntegerValue).text(b[0]),d(a.selector.mpEpPriceDecimalValue).text(b[1]))}}function c(b,c){var e="",f=d(a.selector.addToCartFormDesktop);b&&(b.cartType=c||"ADD_TO_CART",e=JSON.stringify(b));if(d(a.selector.tabletActDeclarative).length&&h(a.selector.tabletActDeclarative,e))return!0;if(1===f.length)return b=d(a.selector.atcPaymentOfferInfo),b.length?
b.val(e):d("\x3cinput\x3e").attr({type:"hidden",name:"paymentOfferInfo",value:e,id:a.id.atcPaymentOfferInfo}).appendTo(f),!0;a.logger.error("PLCC SALMON ERROR: Multile ATC form found in DPX for ASIN: "+d(a.id.asin).value)}function h(a,b){var c=!1;(a=d(a).data())&&d.each(a,function(a,d){if(d&&d.inputs)return d.inputs.paymentOfferInfo=b,c=!0,!1});return c}function n(){if(d(a.selector.mpEpBuyboxFinancingCheckbox).length)if(e)if(r)a.logRefTag(a.reftag.oneClickDetected),a.logCounter(a.counter.checkboxHiddenOneClickDetected);
else if(d(a.selector.installmentsMobileFeature).length)a.logRefTag(a.reftag.installmentsDetected),a.logCounter(a.counter.checkboxHiddenInstallmentsDetected);else if(t){if(c())return a.logCounter(a.counter.checkboxShown),!1;a.logRefTag(a.reftag.failedDataInputs);a.logCounter(a.counter.checkboxHiddenHtmlUnrecognized)}else a.logRefTag(a.reftag.missingAddToCartButton),a.logCounter(a.counter.checkboxHiddenMissingAddToCartButton);else a.logRefTag(a.reftag.missingPaymentOfferInfo),a.logCounter(a.counter.checkboxHiddenMissingPaymentOfferInfo);
else if(a.isPaymentOfferInfoPresent(e))return a.logCounter(a.counter.messageShown),!1;return!0}var d=b.$;if(a.isFeaturePresent()){var k=!1,e=a.getPaymentOfferInfo(),p=d(a.selector.mpPaymentOfferInfo).attr("data-productPrice"),q=d("span#mp-ep-plcc-header-msg"),l=f(a.selector.mpEpBuyboxFinancingCheckbox),m=d(a.selector.monthlyPaymentsFeature),t=!!d(a.selector.addToCartButton).length,r=!!d(a.selector.oneClickButton).length;b.declarative("selectMonthlyPaymentsEqualPayCheckbox","change",function(){a.isCheckboxSelected(l)?
(k=!0,c(e),a.logCounter(a.counter.checkboxChecked)):(k=!1,c(),a.logCounter(a.counter.checkboxUnchecked))});var u=b.debounce(function(){a.isFeaturePresent()?(e=a.getPaymentOfferInfo(),p=d(a.selector.mpPaymentOfferInfo).attr("data-productPrice"),q=d("span#mp-ep-plcc-header-msg"),l=f(a.selector.mpEpBuyboxFinancingCheckbox),m=d(a.selector.monthlyPaymentsFeature),t=!!d(a.selector.addToCartButton).length,r=!!d(a.selector.oneClickButton).length,g(),b.capabilities.isAmazonApp&&(q.removeClass("a-size-large"),
q.addClass("a-size-medium")),e&&(e.mpDebug="1"===a.urlParam("mpDebug")?"1":"0"),n()?m.hide():(l.enable(!0),k&&(l.check(),c(e),a.logCounter(a.counter.checkboxChecked))),!d(a.selector.mpEpBuyboxFinancingCheckbox).length&&a.isPaymentOfferInfoPresent(e)&&c(e),d(a.selector.addToCartButton).click(b.debounce(function(){d(a.selector.mpEpBuyboxFinancingCheckbox).length?a.isCheckboxSelected(l)?(c(e,"ADD_TO_CART"),a.logCounter(a.counter.checkboxCheckedAddToCartClicked)):a.logCounter(a.counter.checkboxUncheckedAddToCartClicked):
(c(e,"ADD_TO_CART"),a.logCounter(a.counter.messageAddToCartClicked))},4E3,!0)),d(a.selector.buyNowButton).bind("click.financialOptionsCheckout",b.debounce(function(){d(a.selector.mpEpBuyboxFinancingCheckbox).length?a.isCheckboxSelected(l)?a.logCounter(a.counter.checkboxCheckedBuynowClicked):a.logCounter(a.counter.checkboxUncheckedBuynowClicked):a.logCounter(a.counter.messageBuynowClicked)},4E3,!0)),d(a.selector.buyNowButton).bind("click.financialOptionsCheckout",function(){a.isCheckboxSelected(l)?
c(e,"BUY_NOW"):d(a.selector.mpEpBuyboxFinancingCheckbox).length||c(e,"BUY_NOW")})):a.logCounter(a.featureNotPresent)},a.TWISTER_DEBOUNCE_DURATION);u();b.on("a:pageUpdate",u)}else a.logCounter(a.featureNotPresent)});g.when("A").register("monthly-payments-bottomSheetBackgroundScroller",function(b){b=b.$;var f=b("#a-page"),a=b("body");return{disablePageScrolling:function(){var b=a.scrollTop();f.css({position:"fixed",top:"-"+b+"px"})},enablePageScrolling:function(){var b=Math.abs(f.position().top);f.css({position:"",
top:""});a.scrollTop(b)}}})});