@daeryun/dr_components 0.8.28 → 0.8.30

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.
@@ -19,7 +19,7 @@ import * as gtag from '../../../lib/gtag';
19
19
  // 업무 그룹형
20
20
  // link_url
21
21
  const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = false, objectGroupUiCode }) => {
22
- const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel } = useDaeryuntalk();
22
+ const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel, setMessageObject, setWorkFlowStack } = useDaeryuntalk();
23
23
  const { onClickKakao, onClickTel } = useWorkFlow({ tel: tel });
24
24
  const router = useRouter();
25
25
  const openExternalLink = (url) => {
@@ -76,6 +76,10 @@ const ObjectButton = ({ object, messageNumber, workFlowNumber, isFirstObject = f
76
76
  workFlowNumber: workFlowNumber,
77
77
  objectNumber: (object === null || object === void 0 ? void 0 : object.objectNumber) || ''
78
78
  });
79
+ if (object.objectNumber === ObjectNumber.START_CHAT) {
80
+ setMessageObject(null);
81
+ setWorkFlowStack([]);
82
+ }
79
83
  }
80
84
  // 전화연결
81
85
  else if (actionType === WorkFlowButtonActionType.PHONE_CALL) {
@@ -31,7 +31,8 @@ const ObjectButton = ({
31
31
  isFirstObject: boolean;
32
32
  objectGroupUiCode: string;
33
33
  }) => {
34
- const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel } = useDaeryuntalk();
34
+ const { startWorkFlow, chatInquiryNumber, workFlowStack, workFlowBack, tel, setMessageObject, setWorkFlowStack } =
35
+ useDaeryuntalk();
35
36
  const { onClickKakao, onClickTel } = useWorkFlow({ tel: tel });
36
37
  const router = useRouter();
37
38
 
@@ -94,6 +95,10 @@ const ObjectButton = ({
94
95
  workFlowNumber: workFlowNumber,
95
96
  objectNumber: object?.objectNumber || ''
96
97
  });
98
+ if (object.objectNumber === ObjectNumber.START_CHAT) {
99
+ setMessageObject(null);
100
+ setWorkFlowStack([]);
101
+ }
97
102
  }
98
103
 
99
104
  // 전화연결
@@ -71,6 +71,8 @@ type DaeryuntalkContextType = {
71
71
  sendInquiryJoined: (chatInquiryNumber: string) => void;
72
72
  attendRoomByHistory: (chatInquiryNumber: string) => any;
73
73
  retryInquiryMain: (channelNumber: string) => any;
74
+ setMessageObject: (obj: MessageObject | null) => void;
75
+ setWorkFlowStack: (arr: string[]) => void;
74
76
  };
75
77
  declare const DaeryuntalkContext: React.Context<DaeryuntalkContextType>;
76
78
  type DaeryuntalkProviderProps = {
@@ -53,7 +53,9 @@ const DaeryuntalkContext = createContext({
53
53
  startSelectedChat: () => { },
54
54
  sendInquiryJoined: () => { },
55
55
  attendRoomByHistory: () => { },
56
- retryInquiryMain: () => { }
56
+ retryInquiryMain: () => { },
57
+ setMessageObject: () => { },
58
+ setWorkFlowStack: () => { }
57
59
  });
58
60
  export const DaeryuntalkProvider = ({ children, propsTel }) => {
59
61
  const [inquiryStatus, setInquiryStatus] = useState('');
@@ -145,7 +147,9 @@ export const DaeryuntalkProvider = ({ children, propsTel }) => {
145
147
  startSelectedChat,
146
148
  sendInquiryJoined,
147
149
  attendRoomByHistory,
148
- retryInquiryMain
150
+ retryInquiryMain,
151
+ setMessageObject,
152
+ setWorkFlowStack
149
153
  }}>
150
154
  {children}
151
155
  </DaeryuntalkContext.Provider>);
@@ -76,6 +76,8 @@ type DaeryuntalkContextType = {
76
76
  sendInquiryJoined: (chatInquiryNumber: string) => void;
77
77
  attendRoomByHistory: (chatInquiryNumber: string) => any;
78
78
  retryInquiryMain: (channelNumber: string) => any;
79
+ setMessageObject: (obj: MessageObject | null) => void;
80
+ setWorkFlowStack: (arr: string[]) => void;
79
81
  };
80
82
 
81
83
  // 기본값으로 컨텍스트 생성
@@ -119,7 +121,9 @@ const DaeryuntalkContext = createContext<DaeryuntalkContextType>({
119
121
  startSelectedChat: () => {},
120
122
  sendInquiryJoined: () => {},
121
123
  attendRoomByHistory: () => {},
122
- retryInquiryMain: () => {}
124
+ retryInquiryMain: () => {},
125
+ setMessageObject: () => {},
126
+ setWorkFlowStack: () => {}
123
127
  });
124
128
 
125
129
  // 프로바이더 컴포넌트 생성
@@ -250,7 +254,9 @@ export const DaeryuntalkProvider: React.FC<DaeryuntalkProviderProps> = ({ childr
250
254
  startSelectedChat,
251
255
  sendInquiryJoined,
252
256
  attendRoomByHistory,
253
- retryInquiryMain
257
+ retryInquiryMain,
258
+ setMessageObject,
259
+ setWorkFlowStack
254
260
  }}
255
261
  >
256
262
  {children}
@@ -421,6 +421,9 @@ function retryable(fn_1) {
421
421
  */
422
422
  export function initializeDaeryuntalk(hashValue, onWebSocketConnected, onWebSocketMessage, version) {
423
423
  return __awaiter(this, void 0, void 0, function* () {
424
+ if (typeof window !== 'undefined' && hashValue) {
425
+ localStorage.removeItem('daeryunchatinquirytoken');
426
+ }
424
427
  console.log('[Daeryuntalk 초기화 시작] 전체 흐름 실행', version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`);
425
428
  try {
426
429
  console.log('[Daeryuntalk 초기화] 전체 흐름 시작');
@@ -528,6 +528,10 @@ export async function initializeDaeryuntalk(
528
528
  socket: WebSocket;
529
529
  hashAuth: any;
530
530
  }> {
531
+
532
+ if (typeof window !== 'undefined' && hashValue) {
533
+ localStorage.removeItem('daeryunchatinquirytoken');
534
+ }
531
535
  console.log(
532
536
  '[Daeryuntalk 초기화 시작] 전체 흐름 실행',
533
537
  version ? `버전: ${version}` : `기본 버전: ${DEFAULT_API_VERSION}`