@daeryun/dr_components 1.2.74 → 1.2.76

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.
@@ -148,8 +148,7 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
148
148
  iconClassName: `w-[26px] h-[30.87px] max-lg:w-[22px] max-lg:h-[26.12px] max-sm:w-[19.16px] max-sm:h-[22.75px] `
149
149
  }
150
150
  ];
151
- const snsLoginClick = (snsLoginProvider) => {
152
- console.log('loginClick [snsLoginProvider]: ', snsLoginProvider);
151
+ const snsLoginClickGAEvent = (snsLoginProvider) => {
153
152
  gtag.event({
154
153
  action: 'sns_login_click',
155
154
  category: 'login',
@@ -182,7 +181,7 @@ const LoginContainer = ({ layoutClassName = ' relative h-[100vh] max-h-[1200px]
182
181
  ' max-lg:mt-[168px] ' +
183
182
  ' max-sm:mt-[80px] '}>
184
183
  {loginProvider.map((item, index) => {
185
- return (<button aria-label={`${item.identityProvider} 로그인 버튼`} key={index} type="button" onClick={() => { handleLoginClick(item.identityProvider); snsLoginClick(item.identityProvider); }} className={' relative flex h-[72px] w-[540px] items-center ' +
184
+ return (<button aria-label={`${item.identityProvider} 로그인 버튼`} key={index} type="button" onClick={() => { handleLoginClick(item.identityProvider); snsLoginClickGAEvent(item.identityProvider); }} className={' relative flex h-[72px] w-[540px] items-center ' +
186
185
  ' body_large2 justify-center rounded-[36px] ' +
187
186
  ' max-lg:body_large2_tb max-lg:h-[64px] max-lg:w-[500px] ' +
188
187
  ' max-sm:body_large2_mo max-sm:h-[48px] max-sm:w-[320px] ' +
@@ -179,9 +179,7 @@ const LoginContainer = ({
179
179
  }
180
180
  ];
181
181
 
182
- const snsLoginClick = (snsLoginProvider: 'kakao' | 'google' | 'naver' | 'apple') => {
183
- console.log('loginClick [snsLoginProvider]: ', snsLoginProvider);
184
-
182
+ const snsLoginClickGAEvent = (snsLoginProvider: 'kakao' | 'google' | 'naver' | 'apple') => {
185
183
  gtag.event({
186
184
  action: 'sns_login_click',
187
185
  category: 'login',
@@ -233,7 +231,7 @@ const LoginContainer = ({
233
231
  aria-label={`${item.identityProvider} 로그인 버튼`}
234
232
  key={index}
235
233
  type="button"
236
- onClick={() => {handleLoginClick(item.identityProvider); snsLoginClick(item.identityProvider); }}
234
+ onClick={() => {handleLoginClick(item.identityProvider); snsLoginClickGAEvent(item.identityProvider); }}
237
235
  className={
238
236
  ' relative flex h-[72px] w-[540px] items-center ' +
239
237
  ' body_large2 justify-center rounded-[36px] ' +
@@ -11,9 +11,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  import React, { useEffect, useRef, useState } from 'react';
12
12
  import Image from 'next/image';
13
13
  import { useMutation } from '@tanstack/react-query';
14
- import { getCookie } from '../../../lib';
14
+ import { getCookie, setCookie } from '../../../lib';
15
15
  import ConfirmModal from './LoginComp/Modal/ConfirmModal';
16
16
  import Loader from '../../../components/Loader/Loader';
17
+ import * as gtag from '../../../lib/gtag';
17
18
  const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
18
19
  const [tooltipStyle, setTooltipStyle] = useState({});
19
20
  const buttonRef = useRef(null);
@@ -191,6 +192,14 @@ const StepTwo = () => {
191
192
  { code: 'CT0029', code_name: '디지털포렌식' },
192
193
  { code: 'CT0030', code_name: '경호' }
193
194
  ];
195
+ const signUpGAEvent = (userId) => {
196
+ gtag.event({
197
+ action: 'sign_up_ga_event',
198
+ category: 'sign_up',
199
+ label: `회원가입 완료 - ${userId}`,
200
+ value: '1'
201
+ });
202
+ };
194
203
  // API 호출 함수
195
204
  const fetchFieldData = (centerCode) => __awaiter(void 0, void 0, void 0, function* () {
196
205
  try {
@@ -212,6 +221,20 @@ const StepTwo = () => {
212
221
  const redirect = decodeURIComponent(getCookie('redirect')) || '/';
213
222
  window.location.href = redirect;
214
223
  };
224
+ const appendUuidToRedirect = (redirect, uuid) => {
225
+ if (!uuid)
226
+ return redirect;
227
+ try {
228
+ const url = new URL(redirect, window.location.origin);
229
+ if (url.origin !== window.location.origin)
230
+ return redirect; // 외부 도메인 차단
231
+ url.searchParams.set('uuid', uuid);
232
+ return url.pathname + url.search; // 해시 등 필요하면 추가
233
+ }
234
+ catch (_a) {
235
+ return redirect;
236
+ }
237
+ };
215
238
  const doneMutation = useMutation({
216
239
  mutationFn: (bodyData) => __awaiter(void 0, void 0, void 0, function* () {
217
240
  const marketingResponse = yield fetch(`/api/lawfirm/app/user/agree`, {
@@ -246,10 +269,16 @@ const StepTwo = () => {
246
269
  user: yield userResponse.json()
247
270
  };
248
271
  }),
249
- onSuccess: () => {
272
+ onSuccess: (data) => {
273
+ var _a, _b;
274
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
275
+ const newRedirect = appendUuidToRedirect(redirect, (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.uuid);
276
+ setCookie({ key: 'redirect', value: newRedirect });
250
277
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
251
278
  setIsModal(true);
252
279
  sessionStorage.removeItem('login');
280
+ // ga trigger
281
+ signUpGAEvent((_b = data === null || data === void 0 ? void 0 : data.user) === null || _b === void 0 ? void 0 : _b.uuid);
253
282
  },
254
283
  onError: error => {
255
284
  console.error('Skip API 호출 실패:', error);
@@ -3,9 +3,10 @@
3
3
  import React, { useEffect, useRef, useState } from 'react';
4
4
  import Image from 'next/image';
5
5
  import { useMutation } from '@tanstack/react-query';
6
- import { getCookie } from '../../../lib';
6
+ import { getCookie, setCookie } from '../../../lib';
7
7
  import ConfirmModal from './LoginComp/Modal/ConfirmModal';
8
8
  import Loader from '../../../components/Loader/Loader';
9
+ import * as gtag from '../../../lib/gtag';
9
10
 
10
11
  const Box = ({
11
12
  type_idx,
@@ -245,6 +246,15 @@ const StepTwo = () => {
245
246
  { code: 'CT0030', code_name: '경호' }
246
247
  ];
247
248
 
249
+ const signUpGAEvent = (userId: string) => {
250
+ gtag.event({
251
+ action: 'sign_up_ga_event',
252
+ category: 'sign_up',
253
+ label: `회원가입 완료 - ${userId}`,
254
+ value: '1'
255
+ });
256
+ };
257
+
248
258
  // API 호출 함수
249
259
  const fetchFieldData = async (centerCode: string) => {
250
260
  try {
@@ -270,6 +280,18 @@ const StepTwo = () => {
270
280
  window.location.href = redirect;
271
281
  };
272
282
 
283
+ const appendUuidToRedirect = (redirect: string, uuid?: string) => {
284
+ if (!uuid) return redirect;
285
+ try {
286
+ const url = new URL(redirect, window.location.origin);
287
+ if (url.origin !== window.location.origin) return redirect; // 외부 도메인 차단
288
+ url.searchParams.set('uuid', uuid);
289
+ return url.pathname + url.search; // 해시 등 필요하면 추가
290
+ } catch {
291
+ return redirect;
292
+ }
293
+ };
294
+
273
295
  const doneMutation = useMutation({
274
296
  mutationFn: async (bodyData: {
275
297
  name: string;
@@ -314,12 +336,21 @@ const StepTwo = () => {
314
336
  user: await userResponse.json()
315
337
  };
316
338
  },
317
- onSuccess: () => {
339
+ onSuccess: (data) => {
340
+ const redirect = decodeURIComponent(getCookie('redirect')) || '/';
341
+ const newRedirect = appendUuidToRedirect(redirect, data?.user?.uuid);
342
+ setCookie({ key: 'redirect', value: newRedirect });
343
+
318
344
  setModalObj({ title: '회원가입이 완료되었습니다.', subTitle: '' });
319
345
  setIsModal(true);
320
346
 
321
347
  sessionStorage.removeItem('login');
348
+
349
+ // ga trigger
350
+ signUpGAEvent(data?.user?.uuid);
322
351
  },
352
+
353
+
323
354
  onError: error => {
324
355
  console.error('Skip API 호출 실패:', error);
325
356
  // 필요시 에러 처리 로직 추가