@daeryun/dr_components 1.2.75 → 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.
@@ -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
  // 필요시 에러 처리 로직 추가