!function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(o,r,function(e){return t[e]}.bind(null,r));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=7)}([function(t,e,n){"use strict";n.r(e),function(t){n.d(e,"__extends",function(){return r}),n.d(e,"__assign",function(){return i}),n.d(e,"__rest",function(){return s}),n.d(e,"__decorate",function(){return a}),n.d(e,"__param",function(){return u}),n.d(e,"__metadata",function(){return c}),n.d(e,"__awaiter",function(){return l}),n.d(e,"__generator",function(){return d}),n.d(e,"__exportStar",function(){return f}),n.d(e,"__values",function(){return p}),n.d(e,"__read",function(){return h}),n.d(e,"__spread",function(){return y}),n.d(e,"__spreadArrays",function(){return v}),n.d(e,"__await",function(){return g}),n.d(e,"__asyncGenerator",function(){return m}),n.d(e,"__asyncDelegator",function(){return _}),n.d(e,"__asyncValues",function(){return w}),n.d(e,"__makeTemplateObject",function(){return b}),n.d(e,"__importStar",function(){return S}),n.d(e,"__importDefault",function(){return E}); /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n=0;a--)(r=t[a])&&(s=(i<3?r(s):i>3?r(e,n,s):r(e,n))||s);return i>3&&s&&Object.defineProperty(e,n,s),s}function u(t,e){return function(n,o){e(n,o,t)}}function c(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(e,n,o,r){return new(o||(o=t))(function(t,i){function s(t){try{u(r.next(t))}catch(t){i(t)}}function a(t){try{u(r.throw(t))}catch(t){i(t)}}function u(e){e.done?t(e.value):new o(function(t){t(e.value)}).then(s,a)}u((r=r.apply(e,n||[])).next())})}function d(t,e){var n,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===i[0]||2===i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function h(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return s}function y(){for(var t=[],e=0;e1||u(e,n)})})}function u(e,n){try{(o=i[e](n)).value instanceof g?t.resolve(o.value.v).then(c,l):d(s[0][2],o)}catch(t){d(s[0][3],t)}var o}function c(t){u("next",t)}function l(t){u("throw",t)}function d(t,e){t(e),s.shift(),s.length&&u(s[0][0],s[0][1])}}function _(t){var e,n;return e={},o("next"),o("throw",function(t){throw t}),o("return"),e[Symbol.iterator]=function(){return this},e;function o(o,r){e[o]=t[o]?function(e){return(n=!n)?{value:g(t[o](e)),done:"return"===o}:r?r(e):e}:r}}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,o=e[Symbol.asyncIterator];return o?o.call(e):(e=p(e),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(n){return new t(function(r,i){(function(e,n,o,r){t.resolve(r).then(function(t){e({value:t,done:o})},n)})(r,i,(n=e[o](n)).done,n.value)})}}}function b(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function S(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function E(t){return t&&t.__esModule?t:{default:t}}}.call(this,n(2).Promise)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){}return t.prototype.getQueryParams=function(t){var e=t.location.search.substring(1),n={};return e.split("&").forEach(function(t){var e=t.split("="),o=decodeURIComponent(e[0]).toLowerCase(),r=decodeURIComponent(e.length>1?e[1]:"");n[o]=r}),n},t.prototype.isUrlMatchedByRegex=function(t,e){var n=t.location.href;return new RegExp(e).test(n)},t.prototype.isUrlDomainMatchedByRegex=function(t,e){var n=t.location.hostname;return new RegExp(e).test(n)},t.prototype.isQueryParamExists=function(t,e){var n=this.getQueryParams(t);return e.some(function(t){return n[t]})},t}();e.default=new o},function(t,e,n){(function(e,n){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */var o;o=function(){"use strict";function t(t){return"function"==typeof t}var o=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r=0,i=void 0,s=void 0,a=function(t,e){h[r]=t,h[r+1]=e,2===(r+=2)&&(s?s(y):w())},u="undefined"!=typeof window?window:void 0,c=u||{},l=c.MutationObserver||c.WebKitMutationObserver,d="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),f="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var t=setTimeout;return function(){return t(y,1)}}var h=new Array(1e3);function y(){for(var t=0;t1)for(var n=1;n-1},e.prototype.addIntersectionObserver=function(t){""===(null==t?void 0:t.innerHTML)&&t.classList.add(i.EMPTY_PLACEHOLDER_STYLE_RESET_CLASS),this.intersectionObserver.observe(t)},e.prototype.removeIntersectionObserver=function(t){t.classList.remove(i.EMPTY_PLACEHOLDER_STYLE_RESET_CLASS),this.intersectionObserver.unobserve(t)},e}();e.MerchantWidgetsInitializer=c}).call(this,n(2).Promise)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PageMutationObserver=void 0;var o=500;var r=function(){function t(t,e){void 0===t&&(t=window),this.windowElement=t,this.config={attributes:!1,childList:!0,subtree:!0},this.callback=e}return t.prototype.onMutation=function(t){for(var e=!1,n=0;n=e&&(t.apply(void 0,o),n=i)}}(this.onMutation.bind(this))),this._observer):null},enumerable:!1,configurable:!0}),t}();e.PageMutationObserver=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0})},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=function(){function t(){this.loadedResources=new Map}return t.prototype.safeLinkInjection=function(t,e,n){this.loadedResources.get(e)||(this.loadedResources.set(e,!0),this.injectLink(t,e,n))},t.prototype.injectLink=function(t,e,n){var o=t,r=o.createElement("link");r.rel="stylesheet",r.href=e,this.setAttributes(r,n),o.head.appendChild(r)},t.prototype.setAttributes=function(t,e){Object.keys(e).forEach(function(n){t.setAttribute(n,e[n])})},t}();e.default=o},function(t,e,n){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=o.__importDefault(n(1)),i=function(){function e(t,e){this.scriptInjector=t,this.fontInjector=e}return e.prototype.load=function(e,n,r,i,s,a,u,c,l){return o.__awaiter(this,void 0,void 0,function(){var d,f,p,h,y,v,g,m,_,w;return o.__generator(this,function(o){switch(o.label){case 0:if(!i.templateAssetUrl)return console.error("missing templateAssetUrl"),[2];for(this.fontInjector.safeFontInjection(n,i),d=this.getTemplateToOverride(e,r,i.className),f=d||i.templateAssetUrl,p=this.isImportantLoad(i.staticContent),h=this.isModule(i.customizations),y=[],v=0;v0||"yotpoTrackConversionData"in t)},e.prototype.locateAllV2Widgets=function(t){return t.querySelectorAll(".yotpo-main-widget, .bottomLine, .yotpo-pictures-widget, .embedded-widget, .yotpo-pictures-gallery, .yotpo-badge, .QABottomLine, .yotpo-reviews-carousel, .yotpo-slider, .yotpo-visual-carousel, .yotpo-shoppable-gallery, #yotpo-testimonials-custom-tab, .yotpo.testimonials, .yotpo-single-video, .yotpo-shoppers-say, .y-badge")},e.prototype.isStoreIdValid=function(t){return new RegExp("[A-Za-z0-9]{40}").test(t)},e.prototype.getOldScriptSrc=function(t,e){for(var n=t.getElementsByTagName("script"),o=new RegExp("//(staticw2|w2)\\.yotpo\\.com/[A-Za-z0-9]{40}/widget\\.js.*"),r=0;r0&&(this.injectFonts(t,s),this.injectedFonts=this.injectedFonts.concat(s))}},t.prototype.insertFontsFromWidget=function(t,e){var n=this;t.forEach(function(t){if(e.customizations[t]){var o=e.customizations[t].split("|")[0],r=e.customizations[t].split("|")[1],i=e.instanceId;o&&r&&n.fonts.push({family:o,url:r,widgetInstanceId:i})}})},t.prototype.getFontCustomizations=function(e){var n=e.customizations[t.loadFontsCustomizationKey];return"string"!=typeof n?[]:n.split(",").map(function(t){return t.trim()})||[]},t.prototype.isInPreviewMode=function(t){if(t&&t.body&&[t.body.querySelector(".widget-preview"),t.body.querySelector(".widget-wrapper")].some(function(t){return null!==t}))return!0;return!1},t.prototype.injectFonts=function(t,e){o.loadFonts(t,null,e)},t.loadFontsCustomizationKey="load-font-customizations",t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.loadFonts=e.loadFont=e.loadFontStyle=e.isFontInjected=e.yotpoFontClassName=void 0;var o=["fonts.googleapis.com/css","cdn-widgetsrepository.yotpo.com/web-fonts/css","staticw2.yotpo.com/web-fonts/css"];e.yotpoFontClassName="yotpo-font",e.isFontInjected=function(t,n,o){var r;for(var i in void 0===o&&(o=t.getElementsByClassName(e.yotpoFontClassName)),o){var s=null==o?void 0:o[i];if("STYLE"===s.tagName&&(null===(r=s.textContent)||void 0===r?void 0:r.includes(n.url)))return!0;if("LINK"===s.tagName&&s.getAttribute("href")===n.url)return!0}return!1},e.loadFontStyle=function(t,n,o){var r=t.createElement("style");r.innerHTML='\n @font-face {\n font-family: "'+n.family+"\";\n src: url('"+n.url+"');\n font-display: swap;\n }",r.classList.add(e.yotpoFontClassName),o?o.appendChild(r):t.head.appendChild(r)},e.loadFont=function(t,n,r){if(n.url&&(n.url.endsWith(".css")||o.some(function(t){return n.url.includes(t)}))){var i=t.createElement("style");i.classList.add(e.yotpoFontClassName);var s;s="@import url('"+n.url+"');",i.innerHTML=s,t.head.appendChild(i)}else{if(!n.url)return;e.loadFontStyle(t,n,r)}},e.loadFonts=function(t,n,o){o&&o.forEach(function(o){return e.loadFont(t,o,n)})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0).__importDefault(n(1)),r=function(){function t(t){this.YOTPO_DOMAIN="yotpo.com",this.windowElement=t}return t.prototype.shouldLoadWidget=function(t,e){return!this.shouldHideIfUrlMatchQueryParam(t)&&(o.default.isUrlDomainMatchedByRegex(this.windowElement,this.YOTPO_DOMAIN)||this.shouldShowByStaticContent(t)||this.shouldShowIfUrlMatchQueryParam()||e)},t.prototype.shouldShowByStaticContent=function(t){var e;return!(null===(e=null==t?void 0:t.staticContent)||void 0===e?void 0:e.isHidden)},t.prototype.shouldShowIfUrlMatchQueryParam=function(){return o.default.isQueryParamExists(this.windowElement,["oseid"])},t.prototype.shouldHideIfUrlMatchQueryParam=function(t){var e,n;return!(null===(e=null==t?void 0:t.staticContent)||void 0===e||!e.hideIfMatchingQueryParam)&&o.default.isQueryParamExists(this.windowElement,null===(n=null==t?void 0:t.staticContent)||void 0===n?void 0:n.hideIfMatchingQueryParam)},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var o=n(0),r=n(5),i=o.__importDefault(n(4)),s=function(){function t(t,e,n){this.LOADER_URL="https://cdn-widgetsrepository.yotpo.com/v1/loader",this.guid=e,this.yotpoWidgetsContainer=n,this.window=t}return t.prototype.isPreviewMode=function(){return"true"===i.default.get(r.PREVIEW_MODE_KEY)},t.prototype.shouldInjectNewLoaderWithAllWidgets=function(){return this.isPreviewMode()&&this.isFirstLoadWithAllWidgets()},t.prototype.injectLoaderWithAllWidgets=function(){this.allowLoaderToBeLoaded(),this.injectScriptElement(),this.setScriptWithAllWidgetsLoadedFlag()},t.prototype.isFirstLoadWithAllWidgets=function(){return!Boolean(this.getScriptWithAllWidgetsLoadedFlag())},t.prototype.allowLoaderToBeLoaded=function(){this.yotpoWidgetsContainer.guids[this.guid][r.LOADER_SCRIPT_FLAGS.IS_SCRIPTS_LOADED]=!1},t.prototype.injectScriptElement=function(){var t=this.window.document.createElement("script");t.src=this.getLoaderURLWithAllWidgets(),t.async=!0,this.window.document.head.appendChild(t)},t.prototype.getLoaderURLWithAllWidgets=function(){return this.LOADER_URL+"/"+this.guid+"?all=true"},t.prototype.getScriptWithAllWidgetsLoadedFlag=function(){return this.yotpoWidgetsContainer.guids[this.guid][r.LOADER_SCRIPT_FLAGS.IS_SCRIPT_WITH_ALL_WIDGETS_LOADED]},t.prototype.setScriptWithAllWidgetsLoadedFlag=function(){this.yotpoWidgetsContainer.guids[this.guid][r.LOADER_SCRIPT_FLAGS.IS_SCRIPT_WITH_ALL_WIDGETS_LOADED]=!0},t}();e.default=s}]);