/** * WonderPush Web SDK Plugin: ecommerce * Package: wonderpush-webplugin-ecommerce * Version: 1.0.15 * Description: WonderPush Web SDK plugin for E-commerce lets you integrate your E-commerce website seamlessly with WonderPush. * * Copyright 2025 WonderPush * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ "use strict";function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){function t(t,r){return o.apply(this,arguments)}var o;WonderPush.registerPlugin("ecommerce",{window:(o=function(t,o){window.WonderPush=window.WonderPush||[],o=o||{};function r(){var t=(r=f()).product,r=r.productGroup;t&&s("AddToCart",{object_product:l(t),object_productGroup:r?l(r):void 0,string_url:window.location.href})}function e(){var t=(r=f()).product,r=r.productGroup;t&&s("RemoveFromCart",{object_product:l(t),object_productGroup:r?l(r):void 0,string_url:window.location.href})}function n(){var t,r;!o.thankYouPageUrl||(""+window.location.href).indexOf(o.thankYouPageUrl)<0||(t=(r=f()).product,r=r.productGroup,s("Purchase",t?{object_product:l(t),object_productGroup:r?l(r):void 0,string_url:window.location.href}:void 0))}function i(){function t(t,r){r&&Array.from(document.querySelectorAll(t)).forEach(function(t){t.addEventListener("click",r),y.push({elt:t,handler:r})})}d&&clearInterval(d),y.forEach(function(t){t.elt&&t.handler&&t.elt.removeEventListener("click",t.handler)}),y.splice(),o.addToCartButtonQuerySelector&&t(o.addToCartButtonQuerySelector,r),o.removeFromCartButtonQuerySelector&&t(o.removeFromCartButtonQuerySelector,e),d=setInterval(function(){y.find(function(t){return!t.elt.isConnected})&&i()},1e3)}var c,u,a,d,p=function(t){if(!t)return t;if("string"==typeof t){t=t.replace(/(<([^>]+)>)/gi,"");return 120