Skip to content

Commit 2642f64

Browse files
authored
Merge pull request #1402 from inplayer-org/fix/persa-type-and-function-adding
Fix/persa type and function adding
2 parents 211ede2 + 3c1315a commit 2642f64

File tree

4 files changed

+39
-1
lines changed

4 files changed

+39
-1
lines changed

src/analytics/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export enum AnalyticsEvents {
4949
DATEPICKER_CHANGE = 'datepicker_date_change',
5050
DAYPICKER_CHANGE = 'daypicker_date_change',
5151
KEYBOARD_EVENT = 'keyboard_event',
52+
FOCUS_OUT = 'focus_out',
5253
}
5354

5455
export enum AnalyticsComponentType {
@@ -68,6 +69,7 @@ export enum AnalyticsComponentType {
6869
INPUT = 'input',
6970
TEXTAREA = 'textarea',
7071
TAB_NAVIGATION = 'tab_navigation',
72+
RADIO = 'radio',
7173
}
7274

7375
export interface Event {

src/components/Input/Input.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,18 @@ const Input = forwardRef(
124124
type={type}
125125
placeholder={placeholder}
126126
onChange={onInputChange}
127+
onBlur={() => {
128+
if (tag) {
129+
tracker.track({
130+
event: AnalyticsEvents.FOCUS_OUT,
131+
type: AnalyticsComponentType.INPUT,
132+
tag,
133+
pages,
134+
merchantId,
135+
ip,
136+
});
137+
}
138+
}}
127139
onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {
128140
if (e.key === 'Enter') {
129141
if (tag) {
@@ -170,6 +182,18 @@ const Input = forwardRef(
170182
placeholder={placeholder}
171183
onChange={onInputChange}
172184
icon={icon}
185+
onBlur={() => {
186+
if (tag) {
187+
tracker.track({
188+
event: AnalyticsEvents.FOCUS_OUT,
189+
type: AnalyticsComponentType.INPUT,
190+
tag,
191+
pages,
192+
merchantId,
193+
ip,
194+
});
195+
}
196+
}}
173197
onKeyDown={(e: KeyboardEvent<HTMLInputElement>) => {
174198
if (tag) {
175199
if (e.key === 'Enter') {

src/components/Radio/Radio.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Radio = ({
4040
if (tag) {
4141
tracker.track({
4242
event: AnalyticsEvents.RADIOBUTTON_SELECT,
43-
type: AnalyticsComponentType.CHECKBOX,
43+
type: AnalyticsComponentType.RADIO,
4444
tag,
4545
pages,
4646
merchantId,

src/components/TextArea/TextArea.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ const TextArea = ({ tag = '', ...rest }: Props) => (
5050
});
5151
}
5252
}}
53+
onBlur={() => {
54+
if (tag) {
55+
tracker.track({
56+
event: AnalyticsEvents.FOCUS_OUT,
57+
type: AnalyticsComponentType.TEXTAREA,
58+
tag,
59+
pages,
60+
merchantId,
61+
ip,
62+
});
63+
}
64+
}}
5365
{...rest}
5466
/>
5567
)}

0 commit comments

Comments
 (0)