(()=>{ const { EventManager } = ShopbySkin; EventManager.on('PAGE_LOAD_COMPLETED', (commonData) => { if ( ShopbySkin.utils.isSignIn() ) { ShopbySkin.actions.productRecentActions().getProfileRecentProducts() EventManager.on('QUERY_PROFILE_RECENT_PRODUCTS', (data) => { if ( !ShopbySkin.utils.isSignIn() || '93747' == commonData?.profile?.memberGradeNo ) { if ( data?.[0] ) { data.forEach((v)=>{ let hasTheIcon = false; for ( const icon of ( v.stickerInfos || [] ) ) { if ( icon?.label?.includes('점주전용') ) { hasTheIcon = true; break; } } if ( hasTheIcon ) { const itemDom = document.querySelector(`recent-product .recent-product-item-wrap[data-product-no="${v.productNo}"]`); itemDom.querySelector('.recent-product-item__info-price').innerHTML = `
매장 사업자 전용 상품
`; itemDom.href = `javascript:alertTheProduct();`; itemDom.querySelectorAll('a').forEach((v)=>{ v.href = `javascript:alertTheProduct();`; }); itemDom.querySelector('[shopby-action="OPEN_PRODUCT_OPTION_MODAL"]')?.remove(); } }); } } if ( data?.[0]?.imageUrlInfo?.[0]?.url ) { document.querySelector('#kmRecentThumb').src = data?.[0]?.imageUrlInfo?.[0]?.url; } }); } else { const noArr = JSON.parse( localStorage.getItem('guestRecentProducts') ); if ( noArr && noArr?.length > 0 ) { const nos = encodeURIComponent( noArr.join(',') ); fetch('https://shop-api.e-ncp.com/guest/recent-products?mallProductNos=' + nos, { "headers" : { "version" : "1.0", "clientid" : commonData.clientId, "platform" : "MOBILE_WEB", }, }) .then((res)=>res.json()) .then((data)=>{ if ( data?.[0] ) { data.forEach((v)=>{ let hasTheIcon = false; if ( v?.stickerInfos?.[0] ) { for ( const icon of ( v.stickerInfos || [] ) ) { if ( icon?.label?.includes('점주전용') ) { hasTheIcon = true; break; } } } if ( hasTheIcon ) { const itemDom = document.querySelector(`recent-product .recent-product-item-wrap[data-product-no="${v.productNo}"]`); itemDom.querySelector('.recent-product-item__info-price').innerHTML = `매장 사업자 전용 상품
`; itemDom.href = `javascript:alertTheProduct();`; itemDom.querySelectorAll('a').forEach((v)=>{ v.href = `javascript:alertTheProduct();`; }); itemDom.querySelector('[shopby-action="OPEN_PRODUCT_OPTION_MODAL"]')?.remove(); } }); } if ( data?.[0]?.imageUrlInfo?.[0]?.url ) { document.querySelector('#kmRecentThumb').src = data?.[0]?.imageUrlInfo?.[0]?.url; } }); } } }); })();