sales-frontend-components 0.0.100 → 0.0.101
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 +116 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +21 -1
- package/dist/index.esm.js +117 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +15 -13
package/dist/index.d.ts
CHANGED
|
@@ -505,5 +505,25 @@ declare const useRemoteIdentityVerificationPopup: (config: UseRemoteIdentityVeri
|
|
|
505
505
|
isCreatingUrl: boolean;
|
|
506
506
|
};
|
|
507
507
|
|
|
508
|
-
|
|
508
|
+
/**
|
|
509
|
+
* 앱 시작 시 ClientSession을 플랫폼(웹뷰, 순수 웹)에 맞게 자동 설정하는 훅
|
|
510
|
+
*
|
|
511
|
+
* @returns {boolean} 초기화 완료 여부
|
|
512
|
+
*/
|
|
513
|
+
declare const useSetupClientSession: () => boolean;
|
|
514
|
+
|
|
515
|
+
interface ClientSessionProviderProps {
|
|
516
|
+
children: React.ReactNode;
|
|
517
|
+
/**
|
|
518
|
+
* 초기화 중 표시할 로딩 컴포넌트
|
|
519
|
+
*/
|
|
520
|
+
loadingComponent?: React.ReactNode;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* ClientSession 초기화를 담당하는 Provider 컴포넌트
|
|
524
|
+
* 앱의 최상위에서 사용하여 플랫폼별 세션 정보를 자동으로 설정합니다.
|
|
525
|
+
*/
|
|
526
|
+
declare const ClientSessionProvider: ({ children, loadingComponent }: ClientSessionProviderProps) => react_jsx_runtime.JSX.Element;
|
|
527
|
+
|
|
528
|
+
export { Attachment, BankStockSearchModal, CODES, ClientSessionProvider, CustomerSearch, DeaCustomerSearchModal, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobVehicleSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobSearchModal, useJobVehicleSearchModal, useNationalityComponent, useNxlOneModal, useRemoteIdentityVerification, useRemoteIdentityVerificationIframe, useRemoteIdentityVerificationPopup, useSearchAddress, useSearchNationality, useSearchVisa, useSetupClientSession, useVisaComponent };
|
|
509
529
|
export type { AttachedPhoto, AttachmentProps, BankStockSearchModalProps, CodeSet, DownloadProps, NxlOneProps, NxlOneResponse, PaintProps, Pen, RemoteIdentityVerificationSuccess, RivUrlParams, Step, StepIndicatorProps, StepItem, UseRemoteIdentityVerificationProps, VerificationResponse, cameraItemType, cameraOptions };
|
package/dist/index.esm.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useController } from 'react-hook-form';
|
|
3
3
|
import { CheckboxButton, Checkbox, isDate, DatePicker, DateRangePicker, FormCore, Modal, Button, RadioGroup, Radio, FormField, useModalState, ModalUtils, useDropDown, List, ListItem, Table, Select, Accordion, Tab, SegmentGroup, Loading } from 'sales-frontend-design-system';
|
|
4
4
|
import React, { useState, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
5
|
-
import { useSearchAddressQuery, useSearchPostalCodeQuery, useSearchAddressStandardizationQuery, useSearchCommonCodeQuery, useSearchCustomerListQuery, useSearchNationalityQuery, useSearchVisaQuery, getDspCustomerListMethod, useSearchEmployeeProfileQuery, useSearchOccupationDetailQuery, useSearchOccupationQuery, useSearchVehicleQuery, useSearchRiskGradeQuery, useSearchOrganizationQuery, getRemoteIdentityVerificationSystemToken } from 'sales-frontend-api/method';
|
|
5
|
+
import { useSearchAddressQuery, useSearchPostalCodeQuery, useSearchAddressStandardizationQuery, useSearchCommonCodeQuery, useSearchCustomerListQuery, useSearchNationalityQuery, useSearchVisaQuery, getDspCustomerListMethod, useSearchEmployeeProfileQuery, useSearchOccupationDetailQuery, useSearchOccupationQuery, useSearchVehicleQuery, useSearchRiskGradeQuery, useSearchOrganizationQuery, getRemoteIdentityVerificationSystemToken, getUserProfile } from 'sales-frontend-api/method';
|
|
6
6
|
import { IconMainUiSearch, IconGraphicsBankSaneop, IconGraphicsBankKiup, IconGraphicsBankKukmin, IconGraphicsBankSuhyeop, IconGraphicsBankJangGiSinYong, IconGraphicsBankNhNonghyeop, IconGraphicsBankJiyeokNonghyeop, IconGraphicsBankWoori, IconGraphicsBankScJeil, IconGraphicsBankSinhan, IconGraphicsBankHankookCity, IconGraphicsBankDaegu, IconGraphicsBankBusan, IconGraphicsBankGwangju, IconGraphicsBankJeju, IconGraphicsBankJeonbuk, IconGraphicsBankGyeongnam, IconGraphicsBankSaemaulGeumgo, IconGraphicsBankSinhyeop, IconGraphicsBankJeochuk, IconGraphicsBankHsbc, IconGraphicsBankABNAMRO, IconGraphicsBankSanlim, IconGraphicsBankPost, IconGraphicsBankKebHana, IconGraphicsBankKBank, IconGraphicsBankKakaoBank, IconGraphicsBankTossBank, IconGraphicsStockYuantaJeungkwon, IconGraphicsStockKbJeungkwon, IconGraphicsStockMiraeAssetJeungkwon, IconGraphicsStockSamsungJeungkwon, IconGraphicsStockHankookTujajeungkwon, IconGraphicsStockNhWooriTujajeungkwon, IconGraphicsStockGyoboJeungkwon, IconGraphicsStockHiTujajeungkwon, IconGraphicsStockHyundaiChaJeungkwon, IconGraphicsStockKiwoomJeungkwon, IconGraphicsStockSkJeungkwon, IconGraphicsStockDaesinJeungkwon, IconGraphicsStockHanwhaTujajeungkwon, IconGraphicsStockHanaGeumyungTujajeungkwon, IconGraphicsStockSinhanTujajeungkwon, IconGraphicsStockDbGeumyungTujajeungkwon, IconGraphicsStockYujinTujajeungkwon, IconGraphicsStockMeritzJeungkwon, IconGraphicsStockKakaoPayJeungkwon, IconGraphicsStockNhTujajeungkwon, IconGraphicsStockBugukJeungkwon, IconGraphicsStockSinyeongJeungkwon, IconGraphicsStockHochulEopsum, IconGraphicsFeedbackEmpty, IconIllustGrade, IconIllustJob, IconSubUiArrowRight, IconIllustVehicle, IconIllustCamera } from 'sales-frontend-assets';
|
|
7
7
|
import styles from './modal/standard/address-search/select-address.module.scss';
|
|
8
8
|
import styles$1 from './modal/standard/bank-stock-search/bank-stock-search-modal.module.scss';
|
|
9
9
|
import styles$2 from './modal/standard/customer-search/customer-search.module.scss';
|
|
10
10
|
import styles$3 from './modal/standard/nationality-search/select-nationality.module.scss';
|
|
11
|
-
import { isClient, MessageEventManager } from 'sales-frontend-utils';
|
|
11
|
+
import { isClient, MessageEventManager, getCookie, getDeviceModel, getOSVersion, getOSName, getBrowserVersion, getOrCreateDeviceId, isSalesPortal, getFormFactorFromUserAgent, isWebView } from 'sales-frontend-utils';
|
|
12
12
|
import styles$4 from './modal/standard/visa-search/select-visa.module.scss';
|
|
13
13
|
import { useQuery } from '@tanstack/react-query';
|
|
14
14
|
import styles$5 from './modal/pre-standard/dea-customer-search-modal/dea-customer-search-modal.module.scss';
|
|
@@ -19,6 +19,8 @@ import styles$9 from './modal/pre-standard/vehicle-search-modal/vehicle-search-m
|
|
|
19
19
|
import styles$a from './modal/pre-standard/organization-search-modal/organization-search-modal.module.scss';
|
|
20
20
|
import styles$b from './step-indicator/step-indicator.module.scss';
|
|
21
21
|
import styles$c from './camera/camera.module.scss';
|
|
22
|
+
import { useClientSession, useSetClientSession } from 'sales-frontend-stores';
|
|
23
|
+
import { Bridge } from 'sales-frontend-bridge';
|
|
22
24
|
|
|
23
25
|
const FormCheckboxButton = ({
|
|
24
26
|
name,
|
|
@@ -3976,5 +3978,117 @@ const useRemoteIdentityVerificationPopup = (config) => {
|
|
|
3976
3978
|
};
|
|
3977
3979
|
};
|
|
3978
3980
|
|
|
3979
|
-
|
|
3981
|
+
const getFormFactor = () => {
|
|
3982
|
+
const { pathname } = location;
|
|
3983
|
+
if (pathname) {
|
|
3984
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
3985
|
+
if (segments.length >= 2) {
|
|
3986
|
+
const secondSegment = segments[1]?.toLowerCase();
|
|
3987
|
+
if (secondSegment === "mobile") {
|
|
3988
|
+
return "phone";
|
|
3989
|
+
}
|
|
3990
|
+
if (secondSegment === "tablet") {
|
|
3991
|
+
return "tablet";
|
|
3992
|
+
}
|
|
3993
|
+
if (secondSegment === "pc") {
|
|
3994
|
+
return "pc";
|
|
3995
|
+
}
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
return getFormFactorFromUserAgent(navigator.userAgent);
|
|
3999
|
+
};
|
|
4000
|
+
const createPureWebClientSession = async () => {
|
|
4001
|
+
const hasAccessToken = !!getCookie("accessToken");
|
|
4002
|
+
return {
|
|
4003
|
+
isInitialized: true,
|
|
4004
|
+
isLoggedIn: hasAccessToken,
|
|
4005
|
+
isWebView: false,
|
|
4006
|
+
acceptLanguage: navigator.language || "ko",
|
|
4007
|
+
formFactor: getFormFactor(),
|
|
4008
|
+
deviceId: getOrCreateDeviceId(),
|
|
4009
|
+
appVersion: getBrowserVersion(navigator.userAgent),
|
|
4010
|
+
loginType: "web-login",
|
|
4011
|
+
platformName: getOSName(navigator.userAgent),
|
|
4012
|
+
platformVersion: getOSVersion(navigator.userAgent),
|
|
4013
|
+
deviceModel: getDeviceModel(),
|
|
4014
|
+
loginChannel: isSalesPortal() ? "HMP" : "ETC"
|
|
4015
|
+
};
|
|
4016
|
+
};
|
|
4017
|
+
const createWebviewClientSession = async () => {
|
|
4018
|
+
const isLoggedIn = !!(await Bridge.native.getAccessToken()).accessToken;
|
|
4019
|
+
return {
|
|
4020
|
+
isInitialized: true,
|
|
4021
|
+
isLoggedIn,
|
|
4022
|
+
isWebView: true,
|
|
4023
|
+
acceptLanguage: "ko",
|
|
4024
|
+
formFactor: getCookie("formFactor") || getFormFactor(),
|
|
4025
|
+
deviceId: getCookie("deviceId"),
|
|
4026
|
+
//! App
|
|
4027
|
+
appVersion: getCookie("appVersion"),
|
|
4028
|
+
loginType: getCookie("loginType"),
|
|
4029
|
+
platformName: getCookie("platformName"),
|
|
4030
|
+
platformVersion: getCookie("platformVersion"),
|
|
4031
|
+
deviceModel: getCookie("deviceModel"),
|
|
4032
|
+
loginChannel: getCookie("loginChannel") ?? "MSP"
|
|
4033
|
+
};
|
|
4034
|
+
};
|
|
4035
|
+
const getLoginUserInfo = async () => {
|
|
4036
|
+
try {
|
|
4037
|
+
const { isSuccess, data } = await getUserProfile();
|
|
4038
|
+
if (isSuccess && data) {
|
|
4039
|
+
console.log("[useSetupClientSession] \uD504\uB85C\uD544 \uB85C\uB4DC \uC131\uACF5");
|
|
4040
|
+
return data;
|
|
4041
|
+
}
|
|
4042
|
+
console.warn("[getLoginUserInfo] \uD504\uB85C\uD544 \uB85C\uB4DC \uC2E4\uD328: \uC751\uB2F5 \uC5C6\uC74C");
|
|
4043
|
+
return null;
|
|
4044
|
+
} catch (error) {
|
|
4045
|
+
console.error("[getLoginUserInfo] \uD504\uB85C\uD544 \uB85C\uB4DC \uC2E4\uD328:", error);
|
|
4046
|
+
return null;
|
|
4047
|
+
}
|
|
4048
|
+
};
|
|
4049
|
+
|
|
4050
|
+
const useSetupClientSession = () => {
|
|
4051
|
+
const { isInitialized } = useClientSession();
|
|
4052
|
+
const setClientSession = useSetClientSession();
|
|
4053
|
+
useEffect(() => {
|
|
4054
|
+
if (isInitialized) {
|
|
4055
|
+
console.log("[useSetupClientSession] Already initialized");
|
|
4056
|
+
return;
|
|
4057
|
+
}
|
|
4058
|
+
const initialize = async () => {
|
|
4059
|
+
try {
|
|
4060
|
+
console.log("[useSetupClientSession] \uCD08\uAE30\uD654 \uC2DC\uC791...");
|
|
4061
|
+
if (isWebView()) {
|
|
4062
|
+
console.log("[useSetupClientSession] \uC6F9\uBDF0 \uD658\uACBD \uAC10\uC9C0");
|
|
4063
|
+
setClientSession(await createWebviewClientSession());
|
|
4064
|
+
} else {
|
|
4065
|
+
console.log("[useSetupClientSession] \uC21C\uC218 \uC6F9 \uD658\uACBD \uAC10\uC9C0");
|
|
4066
|
+
setClientSession(await createPureWebClientSession());
|
|
4067
|
+
}
|
|
4068
|
+
console.log("[useSetupClientSession] \uAE30\uBCF8 \uC138\uC158 \uC124\uC815 \uC644\uB8CC");
|
|
4069
|
+
if (getCookie("accessToken")) {
|
|
4070
|
+
console.log("[useSetupClientSession] \uC0AC\uC6A9\uC790 \uD504\uB85C\uD544 \uB85C\uB4DC \uC2DC\uC791...");
|
|
4071
|
+
const userInfo = await getLoginUserInfo();
|
|
4072
|
+
if (userInfo) {
|
|
4073
|
+
setClientSession(userInfo);
|
|
4074
|
+
}
|
|
4075
|
+
}
|
|
4076
|
+
} catch (error) {
|
|
4077
|
+
console.error("[useSetupClientSession] \uCD08\uAE30\uD654 \uC2E4\uD328:", error);
|
|
4078
|
+
}
|
|
4079
|
+
};
|
|
4080
|
+
initialize();
|
|
4081
|
+
}, [isInitialized, setClientSession]);
|
|
4082
|
+
return isInitialized ?? false;
|
|
4083
|
+
};
|
|
4084
|
+
|
|
4085
|
+
const ClientSessionProvider = ({ children, loadingComponent = null }) => {
|
|
4086
|
+
const isInitialized = useSetupClientSession();
|
|
4087
|
+
if (!isInitialized) {
|
|
4088
|
+
return /* @__PURE__ */ jsx(Fragment, { children: loadingComponent });
|
|
4089
|
+
}
|
|
4090
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
4091
|
+
};
|
|
4092
|
+
|
|
4093
|
+
export { Attachment, BankStockSearchModal, CODES, ClientSessionProvider, CustomerSearch, DeaCustomerSearchModal, EmployeeSearchModal, FormCheckbox, FormCheckboxButton, FormDatePicker, FormDateRangePicker, FormSearchJobField, FormSegmentGroup, FormSelect, FormTextField, JobVehicleSearchModal, OrganizationSearchModal, StepIndicator, resize, testSignatureBase64Data, useAddressComponent, useBankStockSearch, useCamera, useCanvasPaint, useJobSearchModal, useJobVehicleSearchModal, useNationalityComponent, useNxlOneModal, useRemoteIdentityVerification, useRemoteIdentityVerificationIframe, useRemoteIdentityVerificationPopup, useSearchAddress, useSearchNationality, useSearchVisa, useSetupClientSession, useVisaComponent };
|
|
3980
4094
|
//# sourceMappingURL=index.esm.js.map
|