@daeryun/dr_components 0.8.23 → 0.8.24

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.
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import React, { useState } from 'react';
10
+ import React, { useEffect, useState } from 'react';
11
11
  import ChatWrapper from './ChatWrapper';
12
12
  import Input1 from '../_ui/inputs/Input1';
13
13
  import { useDaeryuntalk } from '../DaeryuntalkContext';
@@ -22,6 +22,15 @@ const ChatPrivacyAuth = ({ message, isOperator }) => {
22
22
  cell_phone_number: ''
23
23
  });
24
24
  const [isModify, setIsModify] = useState(false);
25
+ useEffect(() => {
26
+ var _a, _b, _c, _d;
27
+ if (formData) {
28
+ setAuthObject({
29
+ name: (_b = (_a = formData.inputs.find(item => (item === null || item === void 0 ? void 0 : item.bindingKey) === 'name')) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '',
30
+ cell_phone_number: (_d = (_c = formData.inputs.find(item => (item === null || item === void 0 ? void 0 : item.bindingKey) === 'cell_phone_number')) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : ''
31
+ });
32
+ }
33
+ }, [formData]);
25
34
  const handleInput = (e) => {
26
35
  const { name, value } = e.currentTarget;
27
36
  setAuthObject(prev => {
@@ -45,10 +54,10 @@ const ChatPrivacyAuth = ({ message, isOperator }) => {
45
54
  }
46
55
  const renderSetAuth = () => (<div className="flex flex-col gap-[16px]">
47
56
  {formData.inputs.map((item, index) => {
48
- var _a, _b;
57
+ var _a, _b, _c;
49
58
  return (<div className="flex flex-col gap-[8px]" key={index}>
50
59
  <p className="text-[14px] font-[700] leading-[100%] tracking-[-4%]">{item.label}</p>
51
- <Input1 onChange={handleInput} value={(_a = authObject[item.bindingKey]) !== null && _a !== void 0 ? _a : ''} type={item.type} name={item.bindingKey || ''} readOnly={isModify ? false : ((_b = item.readOnly) !== null && _b !== void 0 ? _b : false)}/>
60
+ <Input1 onChange={handleInput} value={(_b = authObject[(_a = item.bindingKey) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : ''} type={item.type} name={item.bindingKey || ''} readOnly={isModify ? false : ((_c = item.readOnly) !== null && _c !== void 0 ? _c : false)}/>
52
61
  </div>);
53
62
  })}
54
63
  <Button1 type="button" onClick={update}>
@@ -1,4 +1,4 @@
1
- import React, { FormEvent, useState } from 'react';
1
+ import React, { FormEvent, useEffect, useState } from 'react';
2
2
  import ChatWrapper from './ChatWrapper';
3
3
  import { Form, Message } from '../_types/message';
4
4
  import Input1 from '../_ui/inputs/Input1';
@@ -14,13 +14,26 @@ interface props {
14
14
  const ChatPrivacyAuth = ({ message, isOperator }: props) => {
15
15
  const { chatUserUpdate, chatInquiryNumber } = useDaeryuntalk();
16
16
  const formData: Form | null = message?.form ?? null;
17
- const [authObject, setAuthObject] = useState({
17
+ const [authObject, setAuthObject] = useState<{
18
+ name?: string;
19
+ cell_phone_number?: string;
20
+ [key: string]: string | undefined;
21
+ }>({
18
22
  name: '',
19
23
  cell_phone_number: ''
20
24
  });
21
25
 
22
26
  const [isModify, setIsModify] = useState<boolean>(false);
23
27
 
28
+ useEffect(() => {
29
+ if (formData) {
30
+ setAuthObject({
31
+ name: formData.inputs.find(item => item?.bindingKey === 'name')?.value ?? '',
32
+ cell_phone_number: formData.inputs.find(item => item?.bindingKey === 'cell_phone_number')?.value ?? ''
33
+ });
34
+ }
35
+ }, [formData]);
36
+
24
37
  const handleInput = (e: FormEvent<HTMLInputElement>) => {
25
38
  const { name, value } = e.currentTarget;
26
39
  setAuthObject(prev => {
@@ -56,7 +69,7 @@ const ChatPrivacyAuth = ({ message, isOperator }: props) => {
56
69
  <p className="text-[14px] font-[700] leading-[100%] tracking-[-4%]">{item.label}</p>
57
70
  <Input1
58
71
  onChange={handleInput}
59
- value={authObject[item.bindingKey as keyof typeof authObject] ?? ''}
72
+ value={authObject[item.bindingKey ?? ''] ?? ''}
60
73
  type={item.type}
61
74
  name={item.bindingKey || ''}
62
75
  readOnly={isModify ? false : (item.readOnly ?? false)}
@@ -3,7 +3,7 @@ import Image from 'next/image';
3
3
  const WorkFlowImg = ({ message }) => {
4
4
  const workFlowItem = message.workFlow;
5
5
  return (<div className={`h-auto overflow-hidden rounded-[10px]`}>
6
- <Image src={(workFlowItem === null || workFlowItem === void 0 ? void 0 : workFlowItem.imageUrl) || ''} alt={''} width={300} height={300} className={`h-full w-full`}/>
6
+ <Image src={(workFlowItem === null || workFlowItem === void 0 ? void 0 : workFlowItem.imageUrl) || ''} alt={''} width={1000} height={300} className={`h-full w-full object-cover`} unoptimized={true}/>
7
7
  </div>);
8
8
  };
9
9
  export default WorkFlowImg;
@@ -8,7 +8,14 @@ const WorkFlowImg = ({ message }: props) => {
8
8
  const workFlowItem = message.workFlow;
9
9
  return (
10
10
  <div className={`h-auto overflow-hidden rounded-[10px]`}>
11
- <Image src={workFlowItem?.imageUrl || ''} alt={''} width={300} height={300} className={`h-full w-full`} />
11
+ <Image
12
+ src={workFlowItem?.imageUrl || ''}
13
+ alt={''}
14
+ width={1000}
15
+ height={300}
16
+ className={`h-full w-full object-cover`}
17
+ unoptimized={true}
18
+ />
12
19
  </div>
13
20
  );
14
21
  };
@@ -41,7 +41,6 @@ export interface FormInput {
41
41
  // options?: Array<{ value: string; label: string }>;
42
42
  }
43
43
 
44
- // todo 폼 정의
45
44
  export interface Form {
46
45
  type: string;
47
46
  inputs: FormInput[];