let cu_url = "";
let live24_app;
let timet1;
let timet1_cnt = 0;
let vkds_sttimer = null;
function move_basket_page() {
try {
var sLocation = location;
try {
sLocation = ITEM.setBodyOverFlow(location);
} catch (e) {
PRODUCTSUBMIT.DEBUG.messageOut(e, "PRODUCT_ACTION.move_basket_page");
}
sLocation.href = "/order/basket.html";
} catch (e) {
location.href = "/order/basket.html";
}
}
(function (CAFE24API) {
if (window.l24runplayer) {
return;
}
window.l24runplayer = true;
console.log("LIVE24", "player in script init. v5.2");
let vm = new Vue({
el: "#live24_app",
template:
'
\n' +
"
\n" +
'
\n' +
" \n" +
' \n' +
"
\n" +
" \n" +
"\n" +
'
\n' +
' \n' +
"
\n" +
"
\n" +
"\n" +
"
",
data() {
return {
clp_user_no: "92db6317e192ec8de47dd39c60e523c1",
user_no: "228388",
api_url: "https://live24.app",
src_url: "",
mode: "to_player",
login_info: [],
user_key: "nouser",
userid: "",
tr_no: "",
post_no: "",
sf_no: "",
content_no: "",
type: "",
ui: "",
init_load: false,
privew: "",
test_mode: "",
refferrer: "",
go_page: false,
isstudio: "",
nox: "",
cover: "cover",
runpsLogin: false,
isQa: "",
};
},
watch: {
userid(to) {
if (to) {
console.log("!!! userid", to);
this.set_live24_url(1);
}
},
},
computed: {
live24_url() {
let urls = "";
let base_url = `https://player-v4.live24.app/player/228388`;
if (1 == 1) {
if (this.isQa) {
base_url = `https://player-qa.live24.app/player/228388`;
}
urls =
base_url +
"?key=" +
this.user_key +
"&tr_no=" +
this.tr_no +
"&privew=" +
this.privew +
"&mode=" +
this.test_mode +
"&userid=" +
this.userid +
"&refferrer=" +
this.refferrer +
"&post_no=" +
this.post_no +
"&sf_no=" +
this.sf_no +
"&content_no=" +
this.content_no +
"&ui=" +
this.ui +
"&nox=" +
this.nox +
"&cover=" +
this.cover +
"&type=" +
this.type +
"&isstudio=" +
this.isstudio;
if (this.user_key == "") {
this.user_key = "nouser";
return urls;
} else {
return urls;
}
} else {
urls =
`https://go.live24.app` +
"/shop/go_to_v2/" +
this.clp_user_no +
"/" +
this.tr_no +
"?key=" +
this.user_key +
"&tr_no=" +
this.tr_no +
"&privew=" +
this.privew +
"&mode=" +
this.test_mode +
"&userid=" +
this.userid +
"&refferrer=" +
this.refferrer +
"&post_no=" +
this.post_no +
"&sf_no=" +
this.sf_no +
"&content_no=" +
this.content_no +
"&ui=" +
this.ui +
"&nox=" +
this.nox +
"&cover=" +
this.cover +
"&type=" +
this.type +
"&isstudio=" +
this.isstudio;
if (this.user_key == "") {
this.user_key = "nouser";
return urls;
} else {
return urls;
}
}
},
},
methods: {
active_float_player() {
this.mode = "float_player";
},
go_link(url) {
this.go_page = true;
if (url != this.src_url && url) {
this.src_url = url;
}
},
get_query() {
var url = document.location.href;
var qs = url.substring(url.indexOf("?") + 1).split("&");
for (var i = 0, result = {}; i < qs.length; i++) {
qs[i] = qs[i].split("=");
result[qs[i][0]] = decodeURIComponent(qs[i][1]);
}
return result;
},
set_live24_url(idx) {
$("#live24_ifr").attr("src", this.live24_url);
setTimeout(() => {
this.init_load = true;
}, 300);
},
async c24_login_sync() {
let uids = sessionStorage.getItem("USER_MEMBER_ID");
let ukeys = sessionStorage.getItem("USER_KEY");
if (uids && ukeys) {
this.userid = uids;
this.user_key = ukeys;
this.init_load = true;
this.psLogin(ukeys);
return;
}
if (this.userid) {
this.go_login();
} else {
await CAFE24API.getCustomerInfo((err, res) => {
if (err) {
sessionStorage.removeItem("USER_KEY");
sessionStorage.removeItem("USER_MEMBER_ID");
sessionStorage.removeItem("USER_MEMBER_GROUP_ID");
sessionStorage.removeItem("USER_MEMBER_GROUP_NAME");
this.init_load = true;
} else {
if (res.customer.member_id) {
sessionStorage.setItem("USER_MEMBER_ID", res.customer.member_id);
this.userid = res.customer.member_id;
this.go_login();
}
}
return res;
});
}
},
async go_login() {
this.live24_auth_sync().then(() => {
//로그인 정지 현상 조치
if (!this.init_load && !sessionStorage.getItem("USER_MEMBER_ID")) {
setTimeout(() => {
location.reload();
}, 5000);
}
});
},
async psLogin(userkey) {
/* if(userkey){
if(this.runpsLogin){
return;
}
this.runpsLogin = true;
setTimeout(() => {
document.querySelector("#live24_ifr").contentWindow.postMessage({
action: 'runLogin',
key: userkey
}, "*");
}, 2000);
}*/
},
async live24_auth_sync() {
let ukeys = sessionStorage.getItem("USER_KEY");
if (ukeys) {
vm.user_key = ukeys;
vm.psLogin(ukeys);
return;
}
if (this.userid) {
await $.ajax({
type: "POST",
url: this.api_url + "/cafe24/mall_user_sync",
data: {
mall_id: CAFE24API.MALL_ID,
shop_no: CAFE24API.SHOP_NO,
member_id: this.userid ? this.userid : sessionStorage.getItem("USER_MEMBER_ID"),
},
dataType: "json",
success(res_sub, status) {
if (res_sub.code == 200) {
sessionStorage.setItem("USER_KEY", res_sub.result.user_key);
vm.user_key = res_sub.result.user_key;
vm.psLogin(vm.user_key);
//로그인 되었는데 ID 못받아올때
if (
!sessionStorage.getItem("USER_MEMBER_ID") ||
sessionStorage.getItem("USER_MEMBER_ID") == "null"
) {
setInterval(() => {
if (sessionStorage.getItem("USER_MEMBER_ID")) {
location.reload();
}
}, 500);
}
} else {
}
},
error: function (request, status, error) {
console.log(request.responseText);
},
});
}
}, //
},
async created() {
var ta = this.get_query();
if (ta) {
if (ta.tr_no) {
this.tr_no = ta.tr_no;
}
if (ta.post_no) {
this.post_no = ta.post_no;
}
if (ta.sf_no) {
this.sf_no = ta.sf_no;
}
if (ta.content_no) {
this.content_no = ta.content_no;
}
if (ta.type) {
this.type = ta.type;
}
if (ta.ui) {
this.ui = ta.ui;
}
if (ta.privew) {
this.privew = ta.privew;
}
if (ta.mode) {
this.test_mode = ta.mode;
}
if (ta.refferrer) {
this.refferrer = ta.refferrer;
}
if (ta.isstudio) {
this.isstudio = ta.isstudio;
}
if (ta.nox) {
this.nox = ta.nox;
}
if (ta.cover) {
this.cover = ta.cover;
}
if (ta.dev_test_mode) {
this.api_url = "https://dev.live24.app";
}
if (ta.isQa) {
this.isQa = ta.isQa;
}
if (ta.reset) {
let re_urls =
"/live24_player.html?tr_no=" +
this.tr_no +
"&privew=" +
this.privew +
"&mode=" +
this.mode +
"&refferrer=" +
this.refferrer +
"&content_no=" +
this.content_no +
"&ui=" +
this.ui +
"&cover=" +
this.cover +
"&nox=" +
this.nox +
"&type=" +
this.type;
//console.log('re_urls', re_urls);
top.location.href = re_urls;
return false;
}
}
this.userid = sessionStorage.getItem("USER_MEMBER_ID") || "";
setInterval(() => {
if (sessionStorage.getItem("USER_KEY")) {
this.user_key = sessionStorage.getItem("USER_KEY");
} else {
this.user_key = "nouser";
}
}, 100);
},
async mounted() {
await this.c24_login_sync();
setTimeout(async () => {
await this.c24_login_sync();
setTimeout(async () => {
await this.c24_login_sync();
}, 300);
}, 300);
$("body,html").css("overflow", "hidden");
document.body.style.padding = "0";
document.body.style.margin = "0";
$(document).ready(function () {
$(".autoheight").height($(window).height());
});
$(window).resize(function () {
$(".autoheight").height($(window).height());
});
setTimeout(() => {
try {
document.querySelector("#ch-plugin").remove();
} catch (e) {}
}, 5000);
window.addEventListener("message", function (e) {
if (e.data.action === "go_c24_href") {
vm.go_page = true;
vm.mode = "float_player";
vm.go_link(e.data.go_url);
}
if (e.data.action === "go_c24_href_nch") {
vm.go_page = true;
vm.go_link(e.data.go_url);
}
if (e.data.action === "go_c24_href_top") {
top.location.href = e.data.go_url;
}
if (e.data.action === "to_mode") {
vm.mode = e.data.set_mode;
}
if (e.data.action === "getSessionStorage") {
var value = `${e.data.key}`.split(/, ?/).map((key) => sessionStorage.getItem(key));
document
.querySelector("#live24_ifr")
.contentWindow.postMessage({ type: "sessionStorageData", value: value }, "*");
}
});
},
updated() {
$(".autoheight").height($(window).height());
},
});
})(
CAFE24API.init({
client_id: "QFf0CgssYa4YTLAyyi7hJC", // 사용할 앱의 App Key를 설정해 주세요.
version: "2022-06-01", // 적용할 버전을 설정해 주세요.
})
);