// This script will be like the retailers script in Size Recommendation. // It will hold their configuration const __PRIME_AI__ = {}; (async (sentry) => { try { // We expect these globals to already exist from the // loader file. So let's inherit it. __PRIME_AI__.ENVIRONMENT = window.__PRIME_AI_ENVIRONMENT__; // High-level debugger. __PRIME_AI__.debugMode = true; // A little odd, but widget works uses the literal // string value in the element instead of the over-ride here // LANGUAGES !!!!!! // window.__PRIME_AI_ENVIRONMENT__.LANGUAGE_OVERRIDE = 'zh'; // document.querySelectorAll('[prime-ai-script]').forEach((el) => { // el.setAttribute('language-code', 'fr'); // }); // INSTANT RECOMMENDATION!!!!! // window.__PRIME_AI_ENVIRONMENT__.CTA_INSTANT_RECOMMENDATION = 'true'; // document.querySelectorAll('[prime-ai-script]').forEach((el) => { // el.setAttribute('cta-instant-recommendation', 'true'); // }); // SIZING METRIC!!! // window.__PRIME_AI_ENVIRONMENT__.FINAL_SIZE_METRIC = 'US'; // document.querySelectorAll('[prime-ai-script]').forEach((el) => { // el.setAttribute('final-size-metric', 'US'); // }); // Over-write their PDP Predictor. __PRIME_AI__.OVERRIDE_PREDICTOR = { // garmentType: { // winner: 'Tops', // scores: { // keyWord: 1.0, // levenshtein: 1.0, // }, // }, category: { winner: 'Overall', scores: { keyWord: 1.0, levenshtein: 1.0, }, }, // personType: { // winner: 'Man', // scores: { // keyWord: 1.0, // levenshtein: 1.0, // }, // }, sizingMetric: { winner: 'EU_0', scores: { keyWord: 1.0, levenshtein: 1.0, }, }, }; // Functions - How to get a product id on Viva M. // __PRIME_AI__.getProductId = (isPdpPage) => { // if (!isPdpPage) return 'Not a PDP page'; // // !! Oh god I am going to cry.... // const url = window.location.href; // const lastArg = url.split('/').at(-1); // const productId = lastArg.split('?')[0]; // if (!productId) { // return 'isPdpPage=false'; // } // return productId; // }; // Internal Override settings // YOU CAN OVERRIDE ANY FUNCTION / VALUE HERE, HAVE FUN! // During runtime, you can also use restoreMethod() to unset your // overrides. Downward Cascading functions how fun! __PRIME_AI__.override = {}; // Global scope. window.__PRIME_AI__ = __PRIME_AI__; } catch (error) { console.error('🚩🚩 Size Recommendation 2L - RetailerLogic Error! 🚩🚩'); console.error(error); sentry.captureException(error); } })(window.__PRIME_AI_ENVIRONMENT__.SENTRY);