diff --git a/assets/js/wcs-att-single-add-to-cart.js b/assets/js/wcs-att-single-add-to-cart.js index 89b70e4..d05c1c9 100644 --- a/assets/js/wcs-att-single-add-to-cart.js +++ b/assets/js/wcs-att-single-add-to-cart.js @@ -222,7 +222,8 @@ var View = Backbone.View.extend( { $el_content: false, - product: false, + + product: false, block_params: { message: null, @@ -235,7 +236,7 @@ }, events: { - 'click .wcsatt-add-to-subscription-action': 'action_link_clicked' + 'click .wcsatt-add-to-subscription-action-input': 'action_link_clicked' }, // 'Add to subscription' link 'click' event handler. diff --git a/assets/js/wcs-att-single-add-to-cart.min.js b/assets/js/wcs-att-single-add-to-cart.min.js index 6b1dc84..4488899 100644 --- a/assets/js/wcs-att-single-add-to-cart.min.js +++ b/assets/js/wcs-att-single-add-to-cart.min.js @@ -1 +1 @@ -!function(t){if("undefined"==typeof wcsatt_single_product_params)return!1;var e=function(t){return new(Backbone.Model.extend({get_active_scheme_key:function(){return this.get("active_scheme_key")},get_last_active_scheme_key:function(){return this.previous("active_scheme_key")},get_active_scheme_period:function(){return this.get_scheme_prop(this.get_active_scheme_key(),"period")},get_last_active_scheme_period:function(){return this.get_scheme_prop(this.get_last_active_scheme_key(),"period")},set_active_scheme:function(t){this.set({active_scheme_key:"0"!==t&&t})},set_schemes:function(t){this.set({schemes:t})},is_active_scheme_prorated:function(){return this.get_scheme_prop(this.get_active_scheme_key(),"is_prorated")},was_last_active_scheme_prorated:function(){return this.get_scheme_prop(this.get_last_active_scheme_key(),"is_prorated")},get_scheme_prop:function(t,e){var i=this.get("schemes");return void 0===i[t]||void 0===i[t][e]?null:i[t][e]},initialize:function(){var t={schemes:{},active_scheme_key:""};this.set(t)}}))(t)},i=function(e){return new(Backbone.View.extend({$el_options:!1,events:{"change .wcsatt-options-wrapper input":"active_scheme_changed",show_variation:"variation_found",reset_data:"reset_schemes"},active_scheme_changed:function(t){this.model.set_active_scheme(t.currentTarget.value)},variation_found:function(){this.initialize({$el_options:this.$el.find(".wcsatt-options-wrapper")})},reset_schemes:function(){this.model.set_schemes({}),this.model.set_active_scheme(!1)},find_schemes:function(){var e={};return this.$el_options.find(".subscription-option input").each(function(){var i=t(this).data("custom_data");e[i.subscription_scheme.key]=i.subscription_scheme}),e},initialize:function(t){this.$el_options=t.$el_options,this.model.set_schemes(this.find_schemes());var e=this.$el_options.find('input[value="'+this.model.get_active_scheme_key()+'"]');e.length>0?e.prop("checked",!0):this.$el_options.find("input:checked").change()}}))(e)},s=function(e){return new(Backbone.Model.extend({product:!1,xhr:!1,cached_responses:{},set_period:function(t){this.set({period:t})},get_period:function(){return this.get("period")},get_matching_subscriptions_html:function(){var e=this,i=this.product.schemes_model.get_active_scheme_key();if(this.xhr&&this.xhr.abort(),i=!1===i?"0":i,void 0!==this.cached_responses[i])e.set({html:this.cached_responses[i]}),e.trigger("matching_subscriptions_loaded");else{var s={action:"wcsatt_load_subscriptions_matching_product",product_id:this.product.get_product_id(),subscription_scheme:i};this.xhr=t.post(wcsatt_single_product_params.wc_ajax_url.toString().replace("%%endpoint%%",s.action),s,function(t){"success"===t.result?(e.set({html:t.html}),e.cached_responses[s.subscription_scheme]=t.html):(e.set({html:!1}),e.attributes.period=!1),e.trigger("matching_subscriptions_loaded")})}},active_scheme_changed:function(){this.xhr&&this.xhr.abort()},initialize:function(t){this.product=t.product;var e={period:!1,html:!1};this.set(e),this.listenTo(this.product.schemes_model,"change:active_scheme_key",this.active_scheme_changed),this.on("change:period",this.get_matching_subscriptions_html)}}))(e)},c=function(t){return new(Backbone.View.extend({$el_content:!1,product:!1,block_params:{message:null,fadeIn:0,fadeOut:0,overlayCSS:{background:"rgba( 255, 255, 255, 0 )",opacity:1}},events:{"click .wcsatt-add-to-subscription-action":"action_link_clicked"},action_link_clicked:function(){var t=this.model,e=this,i=!1;if(this.matching_subscriptions_visible()?i=this.toggle():this.model.get_period()===this.product.schemes_model.get_active_scheme_period()?i=this.toggle():(i=!0,this.$el.block(this.block_params),setTimeout(function(){t.set_period(e.product.schemes_model.get_active_scheme_period())},200)),!i)return!1},active_scheme_changed:function(){var t=this;!1===this.product.schemes_model.get_active_scheme_key()||this.product.schemes_model.is_active_scheme_prorated()?this.$el.slideUp(200):(t.$el.hasClass("open")&&t.model.get_period()!==t.product.schemes_model.get_active_scheme_period()&&(t.$el.block(t.block_params),(!1===t.product.schemes_model.get_last_active_scheme_key()||this.product.schemes_model.was_last_active_scheme_prorated())&&t.toggle(!0),setTimeout(function(){t.model.set_period(t.product.schemes_model.get_active_scheme_period())},250)),setTimeout(function(){t.$el.slideDown(200)},50))},add_to_subscription_button_clicked:function(t){var e=t.data.view.product.$form.find(".single_add_to_cart_button");if(e.hasClass("disabled"))return e.click(),!1},toggle:function(t){var e=this,i=(t=void 0!==t&&t)?0:200;return!0!==e.$el.data("animating")&&(e.$el.hasClass("closed")?(setTimeout(function(){e.$el_content.slideDown({duration:i,queue:!1,always:function(){e.$el.data("animating",!1)}})},10),e.$el.removeClass("closed").addClass("open"),e.$el.data("animating",!0)):(setTimeout(function(){e.$el_content.slideUp({duration:i,queue:!1,always:function(){e.$el.data("animating",!1)}})},10),e.$el.removeClass("open").addClass("closed"),e.$el.data("animating",!0)),!0)},matching_subscriptions_visible:function(){return this.$el_content.is(":visible")},matching_subscriptions_loaded:function(){this.render()},render:function(){var t=this.model.get("html");this.$el.unblock(),!1===t?(window.alert(wcsatt_single_product_params.i18n_subs_load_error),this.matching_subscriptions_visible()&&this.toggle()):(this.$el_content.html(t),this.matching_subscriptions_visible()||this.toggle())},initialize:function(t){this.product=t.product,this.$el_content=t.$el_content,this.listenTo(this.model,"matching_subscriptions_loaded",this.matching_subscriptions_loaded),this.listenTo(this.product.schemes_model,"change:active_scheme_key",this.active_scheme_changed),this.$el_content.on("click",".wcsatt-add-to-subscription-button",{view:this},this.add_to_subscription_button_clicked)}}))(t)},o=function(t){this.$form=t,this.schemes_model=!1,this.schemes_view=!1,this.matching_subscriptions_model=!1,this.matching_subscriptions_view=!1,this.initialize=function(){this.schemes_model=new e({product:this}),this.matching_subscriptions_model=new s({product:this}),this.schemes_view=new i({model:this.schemes_model,el:t,$el_options:t.find(".wcsatt-options-wrapper")}),this.matching_subscriptions_view=new c({product:this,model:this.matching_subscriptions_model,el:t.find(".wcsatt-add-to-subscription-wrapper"),$el_content:t.find(".wcsatt-add-to-subscription-options")})},this.get_product_id=function(){return t.find(".wcsatt-add-to-subscription-wrapper").data("product_id")}},n=function(e){var i=this;this.initialize_ui=function(){var t=e.$bundle_data.find(".wcsatt-options-wrapper");t.length>0&&(!1!==e.$addons_totals?e.$addons_totals.after(t):e.$bundle_price.after(t))},this.initialize_schemes=function(){e.satt_schemes=[],e.$bundle_wrap.find(".wcsatt-options-product .subscription-option").each(function(){var i=t(this),s=i.find("input").data("custom_data");e.satt_schemes.push({el:i,data:s,price_html:i.find(".subscription-price").html(),details_html:i.find(".subscription-details").prop("outerHTML")})})},this.integrate=function(){i.initialize_ui(),i.initialize_schemes(),e.$bundle_data.on("woocommerce-product-bundle-updated-totals",i.update_subscription_totals),e.$bundle_data.on("woocommerce-product-bundle-validation-status-changed",i.update_subscription_totals)},this.update_subscription_totals=function(e,s){s.satt_schemes.length>0&&t.each(s.satt_schemes,function(e,c){var o=s.get_price_html(),n=t(o).html();if(1===s.satt_schemes.length&&0===s.$bundle_wrap.find(".wcsatt-options-product .one-time-option").length)s.$bundle_price.find(".price").html(n+c.details_html);else{var a=c.el.find(".subscription-price");if(!0===c.data.overrides_price){var _=t.extend(!0,{},s.price_data);"inherit"===c.data.subscription_scheme.pricing_mode&&c.data.subscription_scheme.discount>0?(t.each(s.bundled_items,function(t,e){var i=e.bundled_item_id;c.data.discount_from_regular?_.prices[i]=_.regular_prices[i]*(1-c.data.subscription_scheme.discount/100):_.prices[i]=_.prices[i]*(1-c.data.subscription_scheme.discount/100),_.addons_prices[i]=_.addons_prices[i]*(1-c.data.subscription_scheme.discount/100)}),_.base_price=_.base_price*(1-c.data.subscription_scheme.discount/100)):"override"===c.data.subscription_scheme.pricing_mode&&(_.base_regular_price=Number(c.data.subscription_scheme.regular_price),_.base_price=Number(c.data.subscription_scheme.price)),_=s.calculate_subtotals(!1,_),_=s.calculate_totals(_),o=s.get_price_html(_),n=t(o).html()+" "}else n="";s.passes_validation()?a.html(n+c.details_html).find("span.total").remove():a.html(c.price_html),a.trigger("wcsatt-updated-bundle-price",[o,c,s,i])}})},this.integrate()},a=function(e){var i=this;this.initialize_ui=function(){var t=e.$composite_data.find(".wcsatt-options-wrapper");t.length>0&&(!1!==e.composite_price_view.$addons_totals?e.composite_price_view.$addons_totals.after(t):e.$composite_price.after(t))},this.initialize_schemes=function(){e.satt_schemes=[],e.$composite_data.find(".wcsatt-options-product .subscription-option").each(function(){var i=t(this),s=i.find("input").data("custom_data");e.satt_schemes.push({el:i,data:s,price_html:i.find(".subscription-price").html(),details_html:i.find(".subscription-details").prop("outerHTML")})})},this.integrate=function(){i.initialize_schemes(),e.actions.add_action("initialize_composite",function(){i.initialize_ui(),e.satt_schemes.length>0&&(e.satt_schemes.length>1||e.$composite_data.find(".composite_wrap .wcsatt-options-product .one-time-option").length>0?(e.actions.add_action("composite_totals_changed",i.update_subscription_totals,101,i),e.actions.add_action("composite_validation_status_changed",i.update_subscription_totals,101,i)):e.filters.add_filter("composite_price_html",i.filter_price_html,10,i))},51,this)},this.filter_price_html=function(i,s,c){var o=e.satt_schemes[0].details_html;return i=t(i).append(o).prop("outerHTML")},this.update_subscription_totals=function(){e.satt_schemes.length>0&&t.each(e.satt_schemes,function(s,c){var o=e.composite_price_view.get_price_html(),n="",a=c.el.find(".subscription-price");if(!0===c.data.overrides_price){var _=t.extend(!0,{},e.data_model.price_data);"inherit"===c.data.subscription_scheme.pricing_mode&&c.data.subscription_scheme.discount>0?(t.each(e.get_components(),function(t,e){var i=e.component_id;c.data.discount_from_regular?_.prices[i]=_.regular_prices[i]*(1-c.data.subscription_scheme.discount/100):_.prices[i]=_.prices[i]*(1-c.data.subscription_scheme.discount/100),_.addons_prices[i]=_.addons_prices[i]*(1-c.data.subscription_scheme.discount/100)}),_.base_price=_.base_price*(1-c.data.subscription_scheme.discount/100)):"override"===c.data.subscription_scheme.pricing_mode&&(_.base_regular_price=Number(c.data.subscription_scheme.regular_price),_.base_price=Number(c.data.subscription_scheme.price)),_=e.data_model.calculate_subtotals(!1,_);var r=e.data_model.calculate_totals(_);_.totals=r,o=e.composite_price_view.get_price_html(_),n=t(o).html()+" "}"pass"===e.api.get_composite_validation_status()?a.html(n+c.details_html).find("span.total").remove():a.html(c.price_html),a.trigger("wcsatt-updated-composite-price",[o,c,e,i])})},this.integrate()};t(".product form.cart").each(function(){var e=t(this),i=new o(e);i.initialize(),e.data.satt_script=i}),t(".bundle_form .bundle_data").each(function(){t(this).on("woocommerce-product-bundle-initializing",function(t,e){e.is_composited()||new n(e)})}),t(".composite_form .composite_data").each(function(){t(this).on("wc-composite-initializing",function(t,e){new a(e)})})}(jQuery); \ No newline at end of file +!function(t){if("undefined"==typeof wcsatt_single_product_params)return!1;var e=function(t){return new(Backbone.Model.extend({get_active_scheme_key:function(){return this.get("active_scheme_key")},get_last_active_scheme_key:function(){return this.previous("active_scheme_key")},get_active_scheme_period:function(){return this.get_scheme_prop(this.get_active_scheme_key(),"period")},get_last_active_scheme_period:function(){return this.get_scheme_prop(this.get_last_active_scheme_key(),"period")},set_active_scheme:function(t){this.set({active_scheme_key:"0"!==t&&t})},set_schemes:function(t){this.set({schemes:t})},is_active_scheme_prorated:function(){return this.get_scheme_prop(this.get_active_scheme_key(),"is_prorated")},was_last_active_scheme_prorated:function(){return this.get_scheme_prop(this.get_last_active_scheme_key(),"is_prorated")},get_scheme_prop:function(t,e){var i=this.get("schemes");return void 0===i[t]||void 0===i[t][e]?null:i[t][e]},initialize:function(){var t={schemes:{},active_scheme_key:""};this.set(t)}}))(t)},i=function(e){return new(Backbone.View.extend({$el_options:!1,events:{"change .wcsatt-options-wrapper input":"active_scheme_changed",show_variation:"variation_found",reset_data:"reset_schemes"},active_scheme_changed:function(t){this.model.set_active_scheme(t.currentTarget.value)},variation_found:function(){this.initialize({$el_options:this.$el.find(".wcsatt-options-wrapper")})},reset_schemes:function(){this.model.set_schemes({}),this.model.set_active_scheme(!1)},find_schemes:function(){var e={};return this.$el_options.find(".subscription-option input").each(function(){var i=t(this).data("custom_data");e[i.subscription_scheme.key]=i.subscription_scheme}),e},initialize:function(t){this.$el_options=t.$el_options,this.model.set_schemes(this.find_schemes());var e=this.$el_options.find('input[value="'+this.model.get_active_scheme_key()+'"]');e.length>0?e.prop("checked",!0):this.$el_options.find("input:checked").change()}}))(e)},s=function(e){return new(Backbone.Model.extend({product:!1,xhr:!1,cached_responses:{},set_period:function(t){this.set({period:t})},get_period:function(){return this.get("period")},get_matching_subscriptions_html:function(){var e=this,i=this.product.schemes_model.get_active_scheme_key();if(this.xhr&&this.xhr.abort(),i=!1===i?"0":i,void 0!==this.cached_responses[i])e.set({html:this.cached_responses[i]}),e.trigger("matching_subscriptions_loaded");else{var s={action:"wcsatt_load_subscriptions_matching_product",product_id:this.product.get_product_id(),subscription_scheme:i};this.xhr=t.post(wcsatt_single_product_params.wc_ajax_url.toString().replace("%%endpoint%%",s.action),s,function(t){"success"===t.result?(e.set({html:t.html}),e.cached_responses[s.subscription_scheme]=t.html):(e.set({html:!1}),e.attributes.period=!1),e.trigger("matching_subscriptions_loaded")})}},active_scheme_changed:function(){this.xhr&&this.xhr.abort()},initialize:function(t){this.product=t.product;var e={period:!1,html:!1};this.set(e),this.listenTo(this.product.schemes_model,"change:active_scheme_key",this.active_scheme_changed),this.on("change:period",this.get_matching_subscriptions_html)}}))(e)},c=function(t){return new(Backbone.View.extend({$el_content:!1,product:!1,block_params:{message:null,fadeIn:0,fadeOut:0,overlayCSS:{background:"rgba( 255, 255, 255, 0 )",opacity:1}},events:{"click .wcsatt-add-to-subscription-action-input":"action_link_clicked"},action_link_clicked:function(){var t=this.model,e=this,i=!1;if(this.matching_subscriptions_visible()?i=this.toggle():this.model.get_period()===this.product.schemes_model.get_active_scheme_period()?i=this.toggle():(i=!0,this.$el.block(this.block_params),setTimeout(function(){t.set_period(e.product.schemes_model.get_active_scheme_period())},200)),!i)return!1},active_scheme_changed:function(){var t=this;!1===this.product.schemes_model.get_active_scheme_key()||this.product.schemes_model.is_active_scheme_prorated()?this.$el.slideUp(200):(t.$el.hasClass("open")&&t.model.get_period()!==t.product.schemes_model.get_active_scheme_period()&&(t.$el.block(t.block_params),(!1===t.product.schemes_model.get_last_active_scheme_key()||this.product.schemes_model.was_last_active_scheme_prorated())&&t.toggle(!0),setTimeout(function(){t.model.set_period(t.product.schemes_model.get_active_scheme_period())},250)),setTimeout(function(){t.$el.slideDown(200)},50))},add_to_subscription_button_clicked:function(t){var e=t.data.view.product.$form.find(".single_add_to_cart_button");if(e.hasClass("disabled"))return e.click(),!1},toggle:function(t){var e=this,i=(t=void 0!==t&&t)?0:200;return!0!==e.$el.data("animating")&&(e.$el.hasClass("closed")?(setTimeout(function(){e.$el_content.slideDown({duration:i,queue:!1,always:function(){e.$el.data("animating",!1)}})},10),e.$el.removeClass("closed").addClass("open"),e.$el.data("animating",!0)):(setTimeout(function(){e.$el_content.slideUp({duration:i,queue:!1,always:function(){e.$el.data("animating",!1)}})},10),e.$el.removeClass("open").addClass("closed"),e.$el.data("animating",!0)),!0)},matching_subscriptions_visible:function(){return this.$el_content.is(":visible")},matching_subscriptions_loaded:function(){this.render()},render:function(){var t=this.model.get("html");this.$el.unblock(),!1===t?(window.alert(wcsatt_single_product_params.i18n_subs_load_error),this.matching_subscriptions_visible()&&this.toggle()):(this.$el_content.html(t),this.matching_subscriptions_visible()||this.toggle())},initialize:function(t){this.product=t.product,this.$el_content=t.$el_content,this.listenTo(this.model,"matching_subscriptions_loaded",this.matching_subscriptions_loaded),this.listenTo(this.product.schemes_model,"change:active_scheme_key",this.active_scheme_changed),this.$el_content.on("click",".wcsatt-add-to-subscription-button",{view:this},this.add_to_subscription_button_clicked)}}))(t)},o=function(t){this.$form=t,this.schemes_model=!1,this.schemes_view=!1,this.matching_subscriptions_model=!1,this.matching_subscriptions_view=!1,this.initialize=function(){this.schemes_model=new e({product:this}),this.matching_subscriptions_model=new s({product:this}),this.schemes_view=new i({model:this.schemes_model,el:t,$el_options:t.find(".wcsatt-options-wrapper")}),this.matching_subscriptions_view=new c({product:this,model:this.matching_subscriptions_model,el:t.find(".wcsatt-add-to-subscription-wrapper"),$el_content:t.find(".wcsatt-add-to-subscription-options")})},this.get_product_id=function(){return t.find(".wcsatt-add-to-subscription-wrapper").data("product_id")}},n=function(e){var i=this;this.initialize_ui=function(){var t=e.$bundle_data.find(".wcsatt-options-wrapper");t.length>0&&(!1!==e.$addons_totals?e.$addons_totals.after(t):e.$bundle_price.after(t))},this.initialize_schemes=function(){e.satt_schemes=[],e.$bundle_wrap.find(".wcsatt-options-product .subscription-option").each(function(){var i=t(this),s=i.find("input").data("custom_data");e.satt_schemes.push({el:i,data:s,price_html:i.find(".subscription-price").html(),details_html:i.find(".subscription-details").prop("outerHTML")})})},this.integrate=function(){i.initialize_ui(),i.initialize_schemes(),e.$bundle_data.on("woocommerce-product-bundle-updated-totals",i.update_subscription_totals),e.$bundle_data.on("woocommerce-product-bundle-validation-status-changed",i.update_subscription_totals)},this.update_subscription_totals=function(e,s){s.satt_schemes.length>0&&t.each(s.satt_schemes,function(e,c){var o=s.get_price_html(),n=t(o).html();if(1===s.satt_schemes.length&&0===s.$bundle_wrap.find(".wcsatt-options-product .one-time-option").length)s.$bundle_price.find(".price").html(n+c.details_html);else{var a=c.el.find(".subscription-price");if(!0===c.data.overrides_price){var _=t.extend(!0,{},s.price_data);"inherit"===c.data.subscription_scheme.pricing_mode&&c.data.subscription_scheme.discount>0?(t.each(s.bundled_items,function(t,e){var i=e.bundled_item_id;c.data.discount_from_regular?_.prices[i]=_.regular_prices[i]*(1-c.data.subscription_scheme.discount/100):_.prices[i]=_.prices[i]*(1-c.data.subscription_scheme.discount/100),_.addons_prices[i]=_.addons_prices[i]*(1-c.data.subscription_scheme.discount/100)}),_.base_price=_.base_price*(1-c.data.subscription_scheme.discount/100)):"override"===c.data.subscription_scheme.pricing_mode&&(_.base_regular_price=Number(c.data.subscription_scheme.regular_price),_.base_price=Number(c.data.subscription_scheme.price)),_=s.calculate_subtotals(!1,_),_=s.calculate_totals(_),o=s.get_price_html(_),n=t(o).html()+" "}else n="";s.passes_validation()?a.html(n+c.details_html).find("span.total").remove():a.html(c.price_html),a.trigger("wcsatt-updated-bundle-price",[o,c,s,i])}})},this.integrate()},a=function(e){var i=this;this.initialize_ui=function(){var t=e.$composite_data.find(".wcsatt-options-wrapper");t.length>0&&(!1!==e.composite_price_view.$addons_totals?e.composite_price_view.$addons_totals.after(t):e.$composite_price.after(t))},this.initialize_schemes=function(){e.satt_schemes=[],e.$composite_data.find(".wcsatt-options-product .subscription-option").each(function(){var i=t(this),s=i.find("input").data("custom_data");e.satt_schemes.push({el:i,data:s,price_html:i.find(".subscription-price").html(),details_html:i.find(".subscription-details").prop("outerHTML")})})},this.integrate=function(){i.initialize_schemes(),e.actions.add_action("initialize_composite",function(){i.initialize_ui(),e.satt_schemes.length>0&&(e.satt_schemes.length>1||e.$composite_data.find(".composite_wrap .wcsatt-options-product .one-time-option").length>0?(e.actions.add_action("composite_totals_changed",i.update_subscription_totals,101,i),e.actions.add_action("composite_validation_status_changed",i.update_subscription_totals,101,i)):e.filters.add_filter("composite_price_html",i.filter_price_html,10,i))},51,this)},this.filter_price_html=function(i,s,c){var o=e.satt_schemes[0].details_html;return i=t(i).append(o).prop("outerHTML")},this.update_subscription_totals=function(){e.satt_schemes.length>0&&t.each(e.satt_schemes,function(s,c){var o=e.composite_price_view.get_price_html(),n="",a=c.el.find(".subscription-price");if(!0===c.data.overrides_price){var _=t.extend(!0,{},e.data_model.price_data);"inherit"===c.data.subscription_scheme.pricing_mode&&c.data.subscription_scheme.discount>0?(t.each(e.get_components(),function(t,e){var i=e.component_id;c.data.discount_from_regular?_.prices[i]=_.regular_prices[i]*(1-c.data.subscription_scheme.discount/100):_.prices[i]=_.prices[i]*(1-c.data.subscription_scheme.discount/100),_.addons_prices[i]=_.addons_prices[i]*(1-c.data.subscription_scheme.discount/100)}),_.base_price=_.base_price*(1-c.data.subscription_scheme.discount/100)):"override"===c.data.subscription_scheme.pricing_mode&&(_.base_regular_price=Number(c.data.subscription_scheme.regular_price),_.base_price=Number(c.data.subscription_scheme.price)),_=e.data_model.calculate_subtotals(!1,_);var r=e.data_model.calculate_totals(_);_.totals=r,o=e.composite_price_view.get_price_html(_),n=t(o).html()+" "}"pass"===e.api.get_composite_validation_status()?a.html(n+c.details_html).find("span.total").remove():a.html(c.price_html),a.trigger("wcsatt-updated-composite-price",[o,c,e,i])})},this.integrate()};t(".product form.cart").each(function(){var e=t(this),i=new o(e);i.initialize(),e.data.satt_script=i}),t(".bundle_form .bundle_data").each(function(){t(this).on("woocommerce-product-bundle-initializing",function(t,e){e.is_composited()||new n(e)})}),t(".composite_form .composite_data").each(function(){t(this).on("wc-composite-initializing",function(t,e){new a(e)})})}(jQuery); \ No newline at end of file