PageSourceSearch

https://onkyo.com/js/ecommerce.js?v=1790239742

js onkyo.com collected 2026-09-24 08:49:14 UTC 18,235 bytes, 2 lines download raw bytes

1var Onkyo="object"==typeof Onkyo?Onkyo:{};Onkyo.ecommerce=function(n){var r={};function c(e){var t;return(r[e]||(t=r[e]={i:e,l:!1,exports:{}},n[e].call(t.exports,t,t.exports,c),t.l=!0,t)).exports}return c.m=n,c.c=r,c.d=function(e,t,n){c.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},c.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.t=function(t,e){if(1&e&&(t=c(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(c.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)c.d(n,r,function(e){return t[e]}.bind(null,r));return n},c.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return c.d(t,"a",t),t},c.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},c.p="",c(c.s=103)}({103:function(e,t,n){"use strict";n.r(t),n.d(t,"refreshProductInfo",function(){return s});var r,c,a,t=n(104),o=n(105),i=n(110),s=(n=window.__onkyo.cmsBaseUrl,c=window.__onkyo.cmsBaseEcommUrl,Onkyo.ecommerceUs=Onkyo.ecommerceUs||{},Onkyo.ecommerceUs.Magento={baseUrl:window.__onkyo.cmsBaseUrl,baseEcommerceUrl:window.__onkyo.cmsBaseEcommUrl},a=window.__onkyo.storeName,r=new t.default(n,"graphql/",c,a),Object(o.loadAndDisplayPricing)(r),Object(i.default)(r),function(){Object(o.processEcommElements)(),Object(o.loadAndDisplayPricing)(r),Object(i.default)(r)})},104:function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n.r(t),n.d(t,"default",function(){return i});function c(e){return 200<=e.status&&e.status<300?Promise.resolve(e):Promise.reject(new Error(e.statusText))}function a(e){return e.json()}n=s,(t=[{key:"addToCart",value:function(e,t){var n=this,e=JSON.stringify(e),r=new URL("".concat(this.fullApiUrl)),e=e.replace(/"([^"]+)":/g,"$1:");return fetch(r,{method:"POST",credentials:"include",headers:[["Content-Type","application/json"],["Store",this.storeName]],body:JSON.stringify({query:'\n          mutation {\n            addSimpleProductsToCart(\n              input: {\n                cart_id: "'.concat(t,'"\n                cart_items: ').concat(e,"\n              }\n            ) {\n              cart {\n                id\n                items {\n                  id\n                  product {\n                    name\n                    sku\n                  }\n                  quantity\n                  prices {\n                    price {\n                      value\n                    }\n                  }\n                }\n              }\n            }\n          }\n        ")})}).then(c).then(a).then(function(e){n.currentCart=e,n.cartData=n.currentCart.data.addProductsToCart.cart}).catch(function(e){return console.warn(e)})}},{key:"getCart",value:function(){var t=this,e=new URL("".concat(this.fullApiUrl));return fetch(e,{method:"POST",credentials:"include",headers:[["Content-Type","application/json"],["Store",this.storeName]],body:JSON.stringify({query:"\n          query PassportCart {\n            passportCart {\n              id\n              items {\n                id\n                product {\n                  name\n                  sku\n                }\n                quantity\n                prices {\n                  price {\n                    value\n                  }\n                }\n              }\n            }\n          }\n        "})}).then(c).then(a).then(function(e){t.currentCart=e,t.cartData=t.currentCart.data.passportCart}).catch(function(e){return console.warn(e)})}},{key:"getProductInfo",value:function(e){var e=JSON.stringify(e),t=new URL("".concat(this.fullApiUrl));return fetch(t,{method:"POST",credentials:"include",headers:[["Content-Type","application/json"],["Store",this.storeName]],body:JSON.stringify({query:"\n          {\n            products(pageSize: 500, filter: {sku: {in: ".concat(e,"}}) {\n              items {\n                name\n                sku\n                stock_status\n                sqty\n                only_x_left_in_stock\n                special_price\n                backorder_status\n                is_pre_order\n                pre_order_label\n                affirm_product_promo_id\n                price_range {\n                  maximum_price {\n                    discount {\n                      amount_off\n                      percent_off\n                    }\n                    regular_price {\n                      value\n                      currency\n                    }\n                    final_price {\n                      value\n                      currency\n                    }\n                  }\n                }\n              }\n            }\n          }\n        ")})}).then(c).then(a).catch(function(e){return console.warn(e)})}}])&&r(n.prototype,t),o&&r(n,o),Object.defineProperty(n,"prototype",{writable:!1});var o,i=s;function s(e,t,n,r){if(!(this instanceof s))throw new TypeError("Cannot call a class as a function");this.baseUrl=e,this.baseApiUri=t,this.baseEcommerceUrl=n,this.cartData=null,this.cartQty=0,this.currentCart=null,this.fullApiUrl="".concat(this.baseEcommerceUrl).concat(this.baseApiUri),this.storeName=r,this.currency="USD"}},105:function(e,t,n){"use strict";n.r(t),n.d(t,"processEcommElements",function(){return s}),n.d(t,"loadAndDisplayPricing",function(){return u});var r,l,d,f,m,p,c,i=n(106),a=n(107),h=n(108),y=n(109),v=[],o=[],s=function(){l=document.querySelectorAll('[data-ecomm-sh
1ow="price"]'),d=document.querySelectorAll('[data-ecomm-show="card_flag"]'),f=document.querySelectorAll('[data-ecomm-show="atc_button"]'),m=document.querySelectorAll('[data-ecomm-show="atc_icons"]'),p=document.querySelectorAll('[data-ecomm-show="oos_form"]'),l.forEach(function(e){var t=e.dataset.ecommSku,n=e.dataset.ecommBundle;""!==t&&o.push(t),n&&"0"!==n&&(t=e.dataset.ecommItems,v.push(t),JSON.parse(t).items.forEach(function(e){o.push(e.item_id)}))});var n=new Set;c=o.filter(function(e){var t=n.has(e);return n.add(e),!t})},_=(s(),function(e,t,n,r){e=e.sku,t={baseEcommerceUrl:t,baseApiUri:n,sku:e,eleId:"out-of-stock-notify-".concat(e),storeName:r};Object(a.default)(t)}),b=function(e,t){var n=!0;return(n=void 0!==e?Object(y.isPurchaseable)(e):n)?(t.removeAttribute("disabled"),t.style.display="block"):t.style.display="none",n},g=function(e,t){var t=t.querySelector("form"),n=!0;return void 0!==e&&(n=Object(y.isOutOfStock)(e)&&!Object(y.isOnBackorder)(e)),t.style.display=n?"block":"none",n},k=function(e,t){var n=!0;return(n=void 0!==e?Object(y.isPurchaseable)(e):n)?t.classList.add("ecommerce-active"):t.classList.remove("ecommerce-active"),n},O=function(e,t,n){var r,c=e,a=Object(i.numberToDollarString)(t),o=Object(i.numberToDollarString)(n);""!==a&&(e=e.dataset.ecommSellsIn||"",r="",r=a!==o?(t=Math.round(Math.abs((t-n)/n*100)),'\n      <span class="product-display-price">\n        <span class="product-original-price">\n          <span class="strikethrough-price">'.concat(o,"</span>\n        </span>\n        ").concat(a,"\n      </span> ").concat(e,'\n      <span class="product-original-price">\n          (').concat(t,"% OFF)\n      </span>\n    ")):'\n      <span class="product-display-price">\n        '.concat(a,"\n      </span> ").concat(e,"\n    "),c.innerHTML=r)},S=function(e){var t=Object(y.showAvailText)(e);document.querySelectorAll('.product-avail-text[data-partnumber="'.concat(e.sku,'"]')).forEach(function(e){e.innerHTML=t})},w=function(e,t,n){t!==n&&(t=Math.round(Math.abs((t-n)/n*100)),e.innerHTML="".concat(t,"% Off"),e.classList.add("card-flag--active"))},E=function(e,r){var t=JSON.parse(e.dataset.ecommItems),c=[];t.items.forEach(function(t){var e,n=r.find(function(e){return e.sku===t.item_id});n&&((e=t).price=n.price_range.maximum_price.final_price.value,c.push(e))}),e.dataset.ecommItems=JSON.stringify({items:c})},u=function(e){var t;0!==c.length&&(r=e).getProductInfo(c).then(function(e){var n,c,a,o,i,s,u;(t=e.data.products.items).forEach(function(t){void 0!==t.price_range.maximum_price.final_price&&l.forEach(function(e){e.dataset.ecommSku===t.sku&&null!==(e=e.closest(".product-card"))&&e.classList.contains("is-refurbished")&&Object(y.isAvailable)(t)&&(e.style.display="block")})}),(n=t).forEach(function(t){void 0!==t.price_range.maximum_price.final_price&&(l.forEach(function(e){e.dataset.ecommSku===t.sku&&(O(e,t.price_range.maximum_price.final_price.value,t.price_range.maximum_price.regular_price.value),Object(y.isAvailable)(t)&&t.affirm_product_promo_id)}),d.forEach(function(e){e.dataset.ecommSku!==t.sku||e.classList.contains("card-flag--overridden")||w(e,t.price_range.maximum_price.final_price.value,t.price_range.maximum_price.regular_price.value)}),f.forEach(function(e){e.dataset.ecommSku===t.sku&&(E(e,n),b(t,e))}),m.forEach(function(e){e.dataset.ecommSku===t.sku&&k(t,e)}),p.forEach(function(e){e.dataset.ecommSku===t.sku&&g(t,e)&&_(t,r.baseEcommerceUrl,r.baseApiUri,r.storeName)}),S(t))}),c=t,v.length&&v.forEach(function(t){u=!(o=a=0);var r=JSON.parse(t);r.items.forEach(function(t,n){r.items[n].foundInMagento=!1,c.forEach(function(e){u&&void 0!==e.price_range.maximum_price.final_price&&t.item_id===e.sku&&(r.items[n].foundInMagento=!0,Object(y.isPurchaseable)(e)?(u=!0,a+=e.price_range.maximum_price.final_price.value*t.quantity,o+=e.price_range.maximum_price.regular_price.value*t.quantity):u=!1)})},r),r.items.find(function(e){return!1===e.foundInMagento})&&(u=!1),i=parseFloat(a),s=parseFloat(o),u&&0!==i&&(l.forEach(function(e){e.dataset.ecommItems===t&&O(e,i,s)}),d.forEach(function(e){e.dataset.ecommItems!==t||e.classList.contains("card-flag--overridden")||w(e,i,s)}),f.forEach(function(e){e.dataset.ecommItems===t&&(E(e,c),b(void 0,e))}),m.forEach(function(e){e.dataset.ecommItems===t&&k(void 0,e)}))}),Object(h.default)()}).catch(function(e){console.warn(e)})}},106:function(e,t,n){"use strict";
1n.r(t),n.d(t,"numberToDollarString",function(){return r}),n.d(t,"dollarsToCents",function(){return c});var r=function(e){e=e.toFixed(2);return"$".concat(function(e){for(var e="".concat(e).split("."),t=e[0],e=1<e.length?".".concat(e[1]):"",n=/(\d+)(\d{3})/;n.test(t);)t=t.replace(n,"$1,$2");return t+e}(e))},c=function(e){e="".concat(e).replace(/[^\d.-]/g,"");return(e=e&&e.includes(".")?e.substring(0,e.indexOf(".")+3):e)?Math.round(100*parseFloat(e)):0}},107:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return r});function c(e){return 200<=e.status&&e.status<300?Promise.resolve(e):Promise.reject(new Error(e.statusText))}function a(e){return e.json()}var o=function(e,t){e.style.display="none",t.style.display="block",t.innerHTML="<p>Thank you! You will be notified via email when this product is in stock.</p>"},i=function(e,t){var n=e.data,r="".concat(e.baseEcommerceUrl).concat(e.baseApiUri),r=new URL("".concat(r));return fetch(r,{method:"POST",credentials:"include",headers:[["Content-Type","application/json"],["Store",e.storeName]],body:JSON.stringify({query:'\n          mutation {\n            createStockAlert(\n              input:{\n                sku: "'.concat(n.sku,'"\n                email: "').concat(n.guest_email,'"\n              }\n            ){\n              status,\n              message\n            }\n          }\n        ')})}).then(c).then(a).then(function(e){}).catch(function(e){return console.warn(e)})};function r(n){var r,c,e=document.querySelectorAll('*[id^="'.concat(n.eleId,'"]'));0<e.length&&(e[0].classList.add("js-oos-form-wrapper--oos"),e[0].classList.add("oos-notify--active"),r=e[0].querySelector(".js-oos-notify-form"),c=e[0].querySelector(".js-oos-notify-msg"),r.addEventListener("submit",function(e){e.preventDefault();var e={data:Object.values(r).reduce(function(e,t){return e[t.name]=t.value,e},{}),baseEcommerceUrl:n.baseEcommerceUrl,baseApiUri:n.baseApiUri,storeName:n.storeName},t=r.querySelector("button");t&&(t.setAttribute("disabled","disabled"),t.innerHTML="(submitting...)"),i(e).then(function(e){o(r,c)})}))}},108:function(e,t,n){"use strict";function r(){document.querySelectorAll(".product-card__pricing-wrapper--placeholder").forEach(function(e){e.classList.remove("product-card__pricing-wrapper--placeholder"),e.classList.remove("effect--shimmer")}),document.querySelectorAll(".product-card__atc-wrapper--placeholder").forEach(function(e){e.classList.remove("product-card__atc-wrapper--placeholder"),e.classList.remove("effect--shimmer")}),document.querySelectorAll(".product-info-pricing--placeholder").forEach(function(e){e.classList.remove("product-info-pricing--placeholder"),e.classList.remove("effect--shimmer")}),document.querySelectorAll(".atc-wrapper--placeholder").forEach(function(e){e.classList.remove("atc-wrapper--placeholder"),e.classList.remove("effect--shimmer")})}n.r(t),n.d(t,"default",function(){return r})},109:function(e,t,n){"use strict";n.r(t),n.d(t,"isAvailable",function(){return r}),n.d(t,"isOnPreorder",function(){return c}),n.d(t,"isOnBackorder",function(){return a}),n.d(t,"isOutOfStock",function(){return o}),n.d(t,"isPurchaseable",function(){return i}),n.d(t,"showAvailText",function(){return s});var r=function(e){return"IN_STOCK"===e.stock_status&&(0===e.is_pre_order||null===e.is_pre_order)&&0<e.sqty},c=function(e){return"IN_STOCK"===e.stock_status&&1===e.is_pre_order&&0<e.sqty},a=function(e){return"IN_STOCK"===e.stock_status&&(0===e.is_pre_order||null===e.is_pre_order)&&e.backorder_status&&e.sqty<=0},o=function(e){return"OUT_OF_STOCK"===e.stock_status},i=function(e){return r(e)||a(e)||c(e)},s=function(e){return c(e)?e.pre_order_label:r(e)&&e.sqty?e.sqty<5?"<em>(Less than 5 in stock)</em>":e.sqty<10?"<em>(Less than 10 in stock)</em>":"":a(e)?"Temporarily Out of Stock. Available for Backorder.":o(e)?"Out of Stock.":""}},110:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return a});function r(e){var t,n,r,c,a=e,o=(e=a.closest(".js-atc-form-wrapper")).querySelector(".js-atc-form-qty").value,i=a.dataset.ecommSku,s=a.dataset.ecommBundle?JSON.parse(a.dataset.ecommItems):"",u=e.querySelector(".js-atc-link"),e=e.querySelector(".js-atc-message"),e=(a.disabled=!0,a.innerHTML="(ADDING TO CART)",e.innerHTML="",e=o,c=[],e={data:{sku:i=i,quantity:parseFloat(o)}},c.push(e),Object(m.default)(i),c);
1void 0!==s&&0!==s.length&&(t=o,n=[],s.items.forEach(function(e){null!==e.omitFromAtc&&1!==e.omitFromAtc&&n.push({data:{sku:e.item_id,quantity:parseFloat(e.quantity*t)}}),Object(m.default)(e.item_id)}),e=n),i=e,r=function(){a.innerHTML="PRODUCT ADDED",a.classList.add("atc-button-success");var e="".concat(l.baseEcommerceUrl,"checkout/cart"),e=Object(f.default)(e);u.querySelector("a").href=e,y.href=e,u.style.display="block",Object(p.trackAddToCart)(a.dataset.ecommItems,o,l.currency)},c=l.cartData.id,l.addToCart(i,c).then(function(e){void 0!==(d=l.currentCart).errors?Array.from(d.errors).forEach(function(e){console.log("error: ".concat(e.message))}):(h=0,l.cartData.items.forEach(function(e){h+=e.quantity}),v(h),r&&r())}).catch(function(e){console.warn(e)})}var l,d,f=n(111),m=n(113),p=n(114),h=0,y=document.getElementById("goto-cart"),v=function(e){var t=document.querySelector(".cart-item-counter");t&&(0<e?(t.innerHTML=e,t.style.display="block"):t.style.display="none")},c=function(t){var n;l.getCart().then(function(e){d=l.currentCart,l.cartData.items.forEach(function(e){h+=e.quantity}),""!==(n="".concat(l.baseEcommerceUrl,"checkout/cart"))&&(n=Object(f.default)(n),y.href=n),v(h),t&&t()}).catch(function(e){console.warn(e)})};function a(e){l=e,c()}document.addEventListener("click",function(e){e.target.matches(".js-atc-button")&&"2.4"===window.__onkyo.magentoVersion&&r(e.target)},{passive:!0})},111:function(e,t,n){"use strict";n.r(t),n.d(t,"default",function(){return r});var c=n(112);function r(e){var t="clickId",n=Object(c.getParameterByName)(t),r=e;return r=void 0!==n?e&&Object(c.updateUrlParameter)(e,t,n):r}},112:function(e,t,n){"use strict";n.r(t),n.d(t,"getParameterByName",function(){return r}),n.d(t,"updateUrlParameter",function(){return c});var r=function(e){return function(e){var t={},n=document.createElement("a");n.href=e;for(var r=n.search.substring(1).split("&"),c=0;c<r.length;c+=1){var a=r[c].split("=");t[a[0]]=decodeURIComponent(a[1])}return t}(window.location.href)[e]},c=function(e,t,n){var r=e.indexOf("#"),c=-1===r?"":e.substr(r),e=-1===r?e:e.substr(0,r),r=new RegExp("([?&])".concat(t,"=.*?(&|$)"),"i"),a=-1!==e.indexOf("?")?"&":"?";return(e=e.match(r)?e.replace(r,"$1".concat(t,"=").concat(n,"$2")):"".concat(e+a+t,"=").concat(n))+c}},113:function(e,t,n){"use strict";function r(e){"undefined"!=typeof fbq&&fbq("track","AddToCart",{content_ids:[e],content_type:"product"})}n.r(t),n.d(t,"default",function(){return r})},114:function(e,t,n){"use strict";n.r(t),n.d(t,"trackAddToCart",function(){return o}),n.d(t,"trackViewItemList",function(){return i}),n.d(t,"trackSelectItem",function(){return s}),n.d(t,"trackViewItem",function(){return u});function r(){window.dataLayer=window.dataLayer||[]}function c(e){var n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"USD",r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null,c=[];return e.items.forEach(function(e){var t;e.currency=n,null!==r&&(t=e.quantity*r,e.quantity=t),c.push(e)}),c}function a(){window.dataLayer.push({ecommerce:null})}var o=function(e,t,n){r(),a();e=JSON.parse(e),e=c(e,n,t);window.dataLayer.push({event:"add_to_cart",ecommerce:{items:e}})},i=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"USD",e=(r(),a(),JSON.parse(e)),t=c(e,t);window.dataLayer.push({event:"view_item_list",ecommerce:{item_list_name:e.item_list_name,items:t}})},s=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"USD",e=(r(),a(),JSON.parse(e)),e=c(e,t);window.dataLayer.push({event:"select_item",ecommerce:{items:e}})},u=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"USD",e=(r(),a(),JSON.parse(e)),e=c(e,t);window.dataLayer.push({event:"view_item",ecommerce:{items:e},currency:t})}}});
2//# sourceMappingURL=maps/ecommerce.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.