sales-frontend-components 0.0.101 → 0.0.103

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 CHANGED
@@ -4017,13 +4017,13 @@ const createPureWebClientSession = async () => {
4017
4017
  };
4018
4018
  };
4019
4019
  const createWebviewClientSession = async () => {
4020
- const isLoggedIn = !!(await salesFrontendBridge.Bridge.native.getAccessToken()).accessToken;
4020
+ const isLoggedIn = salesFrontendUtils.isFpPlannerApp() ? !!salesFrontendUtils.getCookie("accessToken") : !!(await salesFrontendBridge.Bridge.native.getAccessToken()).accessToken;
4021
4021
  return {
4022
4022
  isInitialized: true,
4023
4023
  isLoggedIn,
4024
4024
  isWebView: true,
4025
4025
  acceptLanguage: "ko",
4026
- formFactor: salesFrontendUtils.getCookie("formFactor") || getFormFactor(),
4026
+ formFactor: salesFrontendUtils.getCookie("formFactor")?.toLowerCase() || getFormFactor(),
4027
4027
  deviceId: salesFrontendUtils.getCookie("deviceId"),
4028
4028
  //! App
4029
4029
  appVersion: salesFrontendUtils.getCookie("appVersion"),
@@ -4050,7 +4050,7 @@ const getLoginUserInfo = async () => {
4050
4050
  };
4051
4051
 
4052
4052
  const useSetupClientSession = () => {
4053
- const { isInitialized } = salesFrontendStores.useClientSession();
4053
+ const { isInitialized, isLoggedIn } = salesFrontendStores.useClientSession();
4054
4054
  const setClientSession = salesFrontendStores.useSetClientSession();
4055
4055
  React.useEffect(() => {
4056
4056
  if (isInitialized) {
@@ -4068,19 +4068,25 @@ const useSetupClientSession = () => {
4068
4068
  setClientSession(await createPureWebClientSession());
4069
4069
  }
4070
4070
  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
4071
  } catch (error) {
4079
4072
  console.error("[useSetupClientSession] \uCD08\uAE30\uD654 \uC2E4\uD328:", error);
4080
4073
  }
4081
4074
  };
4082
4075
  initialize();
4083
4076
  }, [isInitialized, setClientSession]);
4077
+ React.useEffect(() => {
4078
+ if (!isInitialized || !isLoggedIn) {
4079
+ return;
4080
+ }
4081
+ const loadUserInfo = async () => {
4082
+ console.log("[useSetupClientSession] \uC0AC\uC6A9\uC790 \uD504\uB85C\uD544 \uB85C\uB4DC \uC2DC\uC791...");
4083
+ const userInfo = await getLoginUserInfo();
4084
+ if (userInfo) {
4085
+ setClientSession(userInfo);
4086
+ }
4087
+ };
4088
+ loadUserInfo();
4089
+ }, [isInitialized, isLoggedIn, setClientSession]);
4084
4090
  return isInitialized ?? false;
4085
4091
  };
4086
4092