106 lines
3.5 KiB
JavaScript
106 lines
3.5 KiB
JavaScript
// export const SHOPTIME_BASE_URL = "https://qt3-aic.lgshopsvc.lgappstv.com/";
|
|
export const SHOPTIME_BASE_URL = ".lgshopsvc.lgappstv.com/";
|
|
|
|
export const URLS = {
|
|
//device controller
|
|
GET_AUTHENTICATION_CODE: "/lgsp/v1/device/auth.lge",
|
|
GET_DEVICE_ADDITION_INFO: "/lgsp/v1/device/info/addition.lge",
|
|
DELETE_DEVICE_ADDITION_INFO: "/lgsp/v1/device/info/addition/delete.lge",
|
|
DELETE_DEVICE_PAIRING: "/lgsp/v1/device/pairing/delete.lge",
|
|
REGISTER_DEVICE_PAIRING: "/lgsp/v1/device/pairing/register.lge",
|
|
REGISTER_DEVICE: "/lgsp/v1/device/register.lge",
|
|
REGISTER_DEVICE_INFO: "/lgsp/v1/device/register/info.lge",
|
|
|
|
//home controller
|
|
GET_HOME_TERMS: "/lgsp/v1/home/terms.lge",
|
|
GET_HOME_MENU: "/lgsp/v1/home/menu.lge",
|
|
GET_HOME_LAYOUT: "/lgsp/v1/home/homeLayout.lge",
|
|
GET_HOME_MAIN_CONTENTS: "/lgsp/v1/home/homeContentsInfo.lge",
|
|
GET_THEME_CURATION_INFO: "/lgsp/v2/home/theme/curations.lge",
|
|
|
|
//brand-controller
|
|
GET_BRAND_LIST: "/lgsp/v1/brand/info.lge",
|
|
GET_BRAND_LAYOUT_INFO: "/lgsp/v1/brand/shelf.lge",
|
|
GET_BRAND_LIVE_CHANNEL_INFO: "/lgsp/v1/brand/live.lge",
|
|
GET_BRAND_TSV_INFO: "/lgsp/v1/brand/tsv.lge",
|
|
GET_BRAND_RECOMMENDED_SHOW_INFO: "/lgsp/v1/brand/recommend.lge",
|
|
GET_BRAND_SERIES_INFO: "/lgsp/v1/brand/series.lge",
|
|
GET_BRAND_CATEGORY_INFO: "/lgsp/v1/brand/category.lge",
|
|
GET_BRAND_BEST_SELLET: "/lgsp/v1/brand/best.lge",
|
|
GET_BRAND_CREATORS_INFO: "/lgsp/v1/brand/creators.lge",
|
|
|
|
//on-sale controller
|
|
GET_ON_SALE_INFO: "/lgsp/v1/onsale/onsale.lge",
|
|
|
|
//product controller
|
|
GET_PRODUCT_BESTSELLER: "/lgsp/v1/product/bestSeller.lge",
|
|
GET_PRODUCT_GROUP: "/lgsp/v1/product/group.lge",
|
|
GET_PRODUCT_OPTION: "/lgsp/v1/product/option.lge",
|
|
//my-page controller
|
|
GET_MY_RECOMMANDED_KEYWORD: "/lgsp/v1/mypage/reckeyword.lge",
|
|
GET_MY_FAQ_INFO: "/lgsp/v1/mypage/support/faq.lge",
|
|
GET_NOTICE: "/lgsp/v1/mypage/support/notice.lge",
|
|
GET_MY_CUSTOMERS: "/lgsp/v1/mypage/customers.lge",
|
|
|
|
//search controller
|
|
GET_SEARCH: "/lgsp/v1/search/list.lge",
|
|
|
|
//main controller
|
|
GET_SUB_CATEGORY: "/lgsp/v1/main/subcategory.lge",
|
|
GET_TOP20_SHOW: "/lgsp/v1/main/top/show.lge",
|
|
GET_PRODUCT_DETAIL: "/lgsp/v1/main/category/product/detail.lge",
|
|
|
|
//event controller
|
|
GET_WELCOME_EVENT_INFO: "/lgsp/v1/event/event.lge",
|
|
};
|
|
const getRicCode = (country, ricCodeSetting) => {
|
|
if (ricCodeSetting !== "system") {
|
|
return ricCodeSetting;
|
|
}
|
|
if (country == "US") {
|
|
return "aic";
|
|
} else if (country == "DE" || country == "GB") {
|
|
return "eic";
|
|
} else if (country == "RU") {
|
|
return "ruc";
|
|
}
|
|
return null;
|
|
};
|
|
export const getUrl = (getState, endStr) => {
|
|
const serverHOST = getState().common.appStatus.serverHOST;
|
|
const { serverType, ricCodeSetting } = getState().localSettings;
|
|
if (!serverHOST) {
|
|
console.error("getUrl: Not supported. Host is missing");
|
|
return "";
|
|
}
|
|
let sdpURL = serverHOST.split(".")[0];
|
|
let countryCode = "",
|
|
ricCode = "";
|
|
if (sdpURL.indexOf("-") > 0) {
|
|
countryCode = sdpURL.split("-")[1];
|
|
} else {
|
|
countryCode = sdpURL;
|
|
}
|
|
ricCode = getRicCode(countryCode, ricCodeSetting);
|
|
if (!ricCode) {
|
|
return "";
|
|
}
|
|
sdpURL = sdpURL.toLowerCase();
|
|
if (serverType !== "system") {
|
|
sdpURL = serverType;
|
|
}
|
|
let newUrl = "";
|
|
if (sdpURL.indexOf("qt2") >= 0) {
|
|
// dev
|
|
newUrl = "https://qt3-" + ricCode + SHOPTIME_BASE_URL;
|
|
//"https://qt3-aic.lgshopsvc.lgappstv.com/";
|
|
} else if (sdpURL.indexOf("qt") >= 0) {
|
|
// Qa - cdn
|
|
newUrl = "https://qt-" + ricCode + SHOPTIME_BASE_URL;
|
|
} else {
|
|
// Prod
|
|
newUrl = "https://" + ricCode + SHOPTIME_BASE_URL;
|
|
}
|
|
return newUrl + endStr;
|
|
};
|