sales-frontend-components 0.0.102 → 0.0.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +32 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +33 -20
- package/dist/index.esm.js.map +1 -1
- package/package.json +12 -12
package/dist/index.cjs.js
CHANGED
|
@@ -4017,21 +4017,28 @@ const createPureWebClientSession = async () => {
|
|
|
4017
4017
|
};
|
|
4018
4018
|
};
|
|
4019
4019
|
const createWebviewClientSession = async () => {
|
|
4020
|
-
|
|
4020
|
+
let appInfo = null;
|
|
4021
|
+
try {
|
|
4022
|
+
appInfo = await salesFrontendBridge.Bridge.native.getAppInfo();
|
|
4023
|
+
} catch (error) {
|
|
4024
|
+
console.warn("[createWebviewClientSession] getAppInfo \uC2E4\uD328, \uCFE0\uD0A4 \uAC12\uC73C\uB85C fallback:", error);
|
|
4025
|
+
}
|
|
4026
|
+
const isLoggedIn = salesFrontendUtils.isFpPlannerApp() ? !!salesFrontendUtils.getCookie("accessToken") : !!(await salesFrontendBridge.Bridge.native.getAccessToken()).accessToken;
|
|
4027
|
+
const formFactor = appInfo?.["X-Channel-FormFactor"]?.toLowerCase() ?? salesFrontendUtils.getCookie("formFactor")?.toLowerCase() ?? getFormFactor();
|
|
4028
|
+
const loginChannel = appInfo?.["X-Channel-LoginChannel"] ?? salesFrontendUtils.getCookie("loginChannel") ?? "DSP";
|
|
4021
4029
|
return {
|
|
4022
4030
|
isInitialized: true,
|
|
4023
4031
|
isLoggedIn,
|
|
4024
4032
|
isWebView: true,
|
|
4025
|
-
acceptLanguage: "ko",
|
|
4026
|
-
formFactor
|
|
4027
|
-
deviceId: salesFrontendUtils.getCookie("deviceId"),
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
loginChannel: salesFrontendUtils.getCookie("loginChannel") ?? "MSP"
|
|
4033
|
+
acceptLanguage: appInfo?.["Accept-Language"] ?? "ko",
|
|
4034
|
+
formFactor,
|
|
4035
|
+
deviceId: appInfo?.["X-Channel-DeviceId"] ?? salesFrontendUtils.getCookie("deviceId"),
|
|
4036
|
+
appVersion: appInfo?.["X-Channel-AppVersion"] ?? salesFrontendUtils.getCookie("appVersion"),
|
|
4037
|
+
loginType: appInfo?.["X-Channel-LoginType"] ?? salesFrontendUtils.getCookie("loginType"),
|
|
4038
|
+
platformName: appInfo?.["X-Channel-PlatformName"] ?? salesFrontendUtils.getCookie("platformName"),
|
|
4039
|
+
platformVersion: appInfo?.["X-Channel-PlatformVersion"] ?? salesFrontendUtils.getCookie("platformVersion"),
|
|
4040
|
+
deviceModel: appInfo?.["X-Channel-DeviceModel"] ?? salesFrontendUtils.getCookie("deviceModel"),
|
|
4041
|
+
loginChannel
|
|
4035
4042
|
};
|
|
4036
4043
|
};
|
|
4037
4044
|
const getLoginUserInfo = async () => {
|
|
@@ -4050,7 +4057,7 @@ const getLoginUserInfo = async () => {
|
|
|
4050
4057
|
};
|
|
4051
4058
|
|
|
4052
4059
|
const useSetupClientSession = () => {
|
|
4053
|
-
const { isInitialized } = salesFrontendStores.useClientSession();
|
|
4060
|
+
const { isInitialized, isLoggedIn } = salesFrontendStores.useClientSession();
|
|
4054
4061
|
const setClientSession = salesFrontendStores.useSetClientSession();
|
|
4055
4062
|
React.useEffect(() => {
|
|
4056
4063
|
if (isInitialized) {
|
|
@@ -4068,19 +4075,25 @@ const useSetupClientSession = () => {
|
|
|
4068
4075
|
setClientSession(await createPureWebClientSession());
|
|
4069
4076
|
}
|
|
4070
4077
|
console.log("[useSetupClientSession] \uAE30\uBCF8 \uC138\uC158 \uC124\uC815 \uC644\uB8CC");
|
|
4071
|
-
if (salesFrontendUtils.getCookie("accessToken")) {
|
|
4072
|
-
console.log("[useSetupClientSession] \uC0AC\uC6A9\uC790 \uD504\uB85C\uD544 \uB85C\uB4DC \uC2DC\uC791...");
|
|
4073
|
-
const userInfo = await getLoginUserInfo();
|
|
4074
|
-
if (userInfo) {
|
|
4075
|
-
setClientSession(userInfo);
|
|
4076
|
-
}
|
|
4077
|
-
}
|
|
4078
4078
|
} catch (error) {
|
|
4079
4079
|
console.error("[useSetupClientSession] \uCD08\uAE30\uD654 \uC2E4\uD328:", error);
|
|
4080
4080
|
}
|
|
4081
4081
|
};
|
|
4082
4082
|
initialize();
|
|
4083
4083
|
}, [isInitialized, setClientSession]);
|
|
4084
|
+
React.useEffect(() => {
|
|
4085
|
+
if (!isInitialized || !isLoggedIn) {
|
|
4086
|
+
return;
|
|
4087
|
+
}
|
|
4088
|
+
const loadUserInfo = async () => {
|
|
4089
|
+
console.log("[useSetupClientSession] \uC0AC\uC6A9\uC790 \uD504\uB85C\uD544 \uB85C\uB4DC \uC2DC\uC791...");
|
|
4090
|
+
const userInfo = await getLoginUserInfo();
|
|
4091
|
+
if (userInfo) {
|
|
4092
|
+
setClientSession(userInfo);
|
|
4093
|
+
}
|
|
4094
|
+
};
|
|
4095
|
+
loadUserInfo();
|
|
4096
|
+
}, [isInitialized, isLoggedIn, setClientSession]);
|
|
4084
4097
|
return isInitialized ?? false;
|
|
4085
4098
|
};
|
|
4086
4099
|
|