<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">define(['jquery','mage/translate','Magento_Customer/js/customer-data','SIS_SubscribeNowPro/js/discount-amount-helper','domReady!'],function($,$t,customerData,discountAmountHelper){'use strict';return{applySubscribeNowDependsOnSimpleSwatch:function(element,options,currentSimpleProductId){let self=this;if(self.isSubscription()===true){if($("#subscribe_this_product").is(':checked')===true){$('.swatch-select').removeClass('error');if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart .primary.tocart').prop('disabled',false);}
self.subscribeThisProductActions(element,options,currentSimpleProductId);}else if($("#subscribe_this_product").is(':checked')===false){self.noSubscriptionActions();};$(document.body).on('change','#no_subscription',function(){$('.swatch-select').removeClass('error');if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart .primary.tocart').prop('disabled',false);}});}},applySubscribeNowDependsOnSimple:function(element,options){let self=this;$(document.body).on('change','#no_subscription',function(){self.noSubscriptionActions();$('.swatch-select').removeClass('error');if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart .primary.tocart').prop('disabled',false);}});$(document.body).on('change','#subscribe_this_product',function(){self.subscribeThisProductActions(element,options,false);});},isSubscription:function(){if($("#subscribe_this_product").length&gt;0){return true;}
return false;},isSubscriptionSelected:function(){if($("#subscribe_this_product").is(':checked')===true){return true;}else if($("#subscribe_this_product").is(':checked')===false){return false;}
return null;},_getCurrentSimpleProductId:function(element){let self=this;if(element===undefined||element.config===undefined){let simpleProductIdBySelectedOption=self._getSimpleProductIdBySelectedOption()
if(simpleProductIdBySelectedOption!==undefined){return simpleProductIdBySelectedOption;}else{return undefined;}}
var allOptions=element.config.options,value=element.value,config;config=_.filter(allOptions,function(option){return option.id===value;});config=_.first(config);let simpleProductId=_.isEmpty(config)?undefined:_.first(config.allowedProducts);if(simpleProductId===undefined){return self._getSimpleProductIdBySelectedOption();}
return simpleProductId;},_getSimpleProductIdBySelectedOption:function(){if($('.product-add-form input[name="selected_configurable_option"]').length&gt;0){return $('.product-add-form input[name="selected_configurable_option"]').val();}
return undefined;},getSimpleProductId:function(element,currentSimpleProductId){let self=this;return(currentSimpleProductId!==false)?currentSimpleProductId:self._getCurrentSimpleProductId(element);},isCustomerLoggedIn:function(){let customerId=false;let getCustomerInfo=function(){let customer=customerData.get('customer');return customer();};let customerInfo=getCustomerInfo();if(customerInfo&amp;&amp;customerInfo.data_id&amp;&amp;customerInfo.customer_id){customerId=customerInfo.customer_id;}
if(customerId===false){return false;}
return true;},getIsSubscribeAllowed:function(element,options,currentSimpleProductId){let self=this;if(options===undefined){return false;}
let simpleProductId=self.getSimpleProductId(element,currentSimpleProductId);let subscriptionProducts=(options.spConfig!==undefined)?options.spConfig.subscriptionProducts:options.jsonConfig.subscriptionProducts;if(simpleProductId!==undefined){let isSubscribeAllowed=false;$.each(subscriptionProducts,function(k,prodId){if(prodId==simpleProductId){isSubscribeAllowed=true;}});if(isSubscribeAllowed===true){return true;}else{return false;}}
return false;},noSubscriptionActions:function(){let self=this;if(self.isSubscription()===true){$(".product-add-form #product-options-wrapper .subscription-not-available-message").remove();if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart').show();$('.page-product-configurable .sticky-product-info').removeAttr("style");if($('.page-product-configurable .sticky-product-info').css('display')=='block'){$(window).scrollTop($(window).scrollTop()+1);$(window).scrollTop($(window).scrollTop()-1);}}}},subscribeThisProductActions:function(element,options,currentSimpleProductId){let self=this;if(self.isSubscription()===true){let simpleProductId=self._getSimpleProductIdBySelectedOption();let defaultSubscriptionConfig=self.getDefaultSubscriptionConfig();let isMessageShouldBeAdded=true;if(defaultSubscriptionConfig!==null&amp;&amp;defaultSubscriptionConfig!==undefined&amp;&amp;defaultSubscriptionConfig.is_subscription_child!==undefined&amp;&amp;defaultSubscriptionConfig.is_subscription_child=="1"&amp;&amp;(simpleProductId==''||simpleProductId===undefined||simpleProductId===null)){isMessageShouldBeAdded=false;}
if(self.getIsSubscribeAllowed(element,options,currentSimpleProductId)===true){$(".product-add-form #product-options-wrapper .subscription-not-available-message").remove();$('.product-add-form .md-subscription-content').show();if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart .primary.tocart').prop('disabled',false)
$('.page-product-configurable .sticky-product-info').removeAttr("style");if($('.page-product-configurable .sticky-product-info').css('display')=='block'){$(window).scrollTop($(window).scrollTop()+1);$(window).scrollTop($(window).scrollTop()-1);}}}else if(isMessageShouldBeAdded===true){$(".product-add-form #product-options-wrapper .subscription-not-available-message").remove();$('.product-add-form .md-subscription-content').hide();if(self.isCustomerLoggedIn()===true){$('.product-add-form .product-options-bottom .box-tocart .primary.tocart').prop('disabled',true);$('.page-product-configurable .sticky-product-info').hide();}
$(".product-add-form #product-options-wrapper").append('&lt;div class="subscription-not-available-message subscription-message"&gt;'
+'&lt;strong&gt;'
+$t('Sorry! This selection is not available on subscription. Please make an alternative selection.')
+'&lt;/strong&gt;'
+'&lt;/div&gt;');}
discountAmountHelper.updateDiscountAmountInfo(options,self.getSimpleProductId(element,currentSimpleProductId));let priceBox=$('.product-info-main .product-info-price .price-box');priceBox.trigger('updatePrice');}},getDefaultSubscriptionConfig:function(){var json=jQuery('#md_subscription_discount_config').val();if(json){return JSON.parse(json);}
return null;}};});</pre></body></html>