@miot-rn/car-component 1.0.4 → 1.0.6
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.
- package/dist/assets/i18n/ar.json +33 -0
- package/dist/assets/i18n/bo.json +33 -0
- package/dist/assets/i18n/cs.json +33 -0
- package/dist/assets/i18n/de.json +33 -0
- package/dist/assets/i18n/el.json +33 -0
- package/dist/assets/i18n/en.json +33 -0
- package/dist/assets/i18n/es.json +33 -0
- package/dist/assets/i18n/es_us.json +33 -0
- package/dist/assets/i18n/fi.json +33 -0
- package/dist/assets/i18n/fr.json +33 -0
- package/dist/assets/i18n/he.json +33 -0
- package/dist/assets/i18n/hu.json +33 -0
- package/dist/assets/i18n/id.json +33 -0
- package/dist/assets/i18n/it.json +33 -0
- package/dist/assets/i18n/ja.json +33 -0
- package/dist/assets/i18n/ko.json +33 -0
- package/dist/assets/i18n/nb.json +33 -0
- package/dist/assets/i18n/nl.json +33 -0
- package/dist/assets/i18n/pl.json +33 -0
- package/dist/assets/i18n/pt.json +33 -0
- package/dist/assets/i18n/pt_pt.json +33 -0
- package/dist/assets/i18n/ro.json +33 -0
- package/dist/assets/i18n/ru.json +33 -0
- package/dist/assets/i18n/sk.json +33 -0
- package/dist/assets/i18n/sv.json +33 -0
- package/dist/assets/i18n/th.json +33 -0
- package/dist/assets/i18n/tr.json +33 -0
- package/dist/assets/i18n/uk.json +33 -0
- package/dist/assets/i18n/vi.json +33 -0
- package/dist/assets/i18n/zh.json +33 -0
- package/dist/assets/i18n/zh_hk.json +33 -0
- package/dist/assets/i18n/zh_tw.json +33 -0
- package/dist/components/carInfoHeader/dualRangeIndicator.js +12 -7
- package/dist/components/carInfoHeader/index.d.ts +1 -0
- package/dist/components/carInfoHeader/index.js +1 -0
- package/dist/components/carInfoHeader/singleRangeIndicator.d.ts +2 -1
- package/dist/components/carInfoHeader/singleRangeIndicator.js +2 -2
- package/dist/components/otherSettingCard/index.js +59 -3
- package/dist/config/seatI18nKeys.d.ts +3 -0
- package/dist/config/seatI18nKeys.js +4 -1
- package/dist/hooks/useDualRangeData.d.ts +3 -1
- package/dist/hooks/useDualRangeData.js +21 -2
- package/dist/hooks/useSeatControlData.d.ts +9 -0
- package/dist/hooks/useSeatControlData.js +30 -3
- package/dist/hooks/useSingleRangeData.d.ts +1 -0
- package/dist/hooks/useSingleRangeData.js +11 -4
- package/dist/hooks/useSteeringWheelData.d.ts +30 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/modules/airconditionModule/index.js +62 -4
- package/dist/modules/carInfoModule/index.d.ts +3 -1
- package/dist/modules/carInfoModule/index.js +5 -3
- package/dist/modules/seatModule/index.js +153 -2
- package/dist/modules/steeringWheelModule/index.js +34 -2
- package/dist/resources/i18n.d.ts +100 -772
- package/dist/resources/i18n.js +39 -55
- package/dist/spec/index.d.ts +11 -273
- package/dist/spec/index.js +64 -469
- package/dist/track/config.d.ts +33 -0
- package/dist/track/config.js +52 -0
- package/dist/track/index.d.ts +1 -0
- package/dist/track/index.js +7 -0
- package/package.json +4 -3
- package/dist/assets/i18n/ar.d.ts +0 -55
- package/dist/assets/i18n/ar.js +0 -55
- package/dist/assets/i18n/bo.d.ts +0 -55
- package/dist/assets/i18n/bo.js +0 -55
- package/dist/assets/i18n/cs.d.ts +0 -55
- package/dist/assets/i18n/cs.js +0 -55
- package/dist/assets/i18n/de.d.ts +0 -55
- package/dist/assets/i18n/de.js +0 -55
- package/dist/assets/i18n/el.d.ts +0 -55
- package/dist/assets/i18n/el.js +0 -55
- package/dist/assets/i18n/en.d.ts +0 -55
- package/dist/assets/i18n/en.js +0 -55
- package/dist/assets/i18n/es.d.ts +0 -55
- package/dist/assets/i18n/es.js +0 -55
- package/dist/assets/i18n/es_us.d.ts +0 -55
- package/dist/assets/i18n/es_us.js +0 -55
- package/dist/assets/i18n/fi.d.ts +0 -55
- package/dist/assets/i18n/fi.js +0 -55
- package/dist/assets/i18n/fr.d.ts +0 -55
- package/dist/assets/i18n/fr.js +0 -55
- package/dist/assets/i18n/he.d.ts +0 -55
- package/dist/assets/i18n/he.js +0 -55
- package/dist/assets/i18n/hu.d.ts +0 -55
- package/dist/assets/i18n/hu.js +0 -55
- package/dist/assets/i18n/id.d.ts +0 -55
- package/dist/assets/i18n/id.js +0 -55
- package/dist/assets/i18n/it.d.ts +0 -55
- package/dist/assets/i18n/it.js +0 -55
- package/dist/assets/i18n/ja.d.ts +0 -55
- package/dist/assets/i18n/ja.js +0 -55
- package/dist/assets/i18n/ko.d.ts +0 -55
- package/dist/assets/i18n/ko.js +0 -55
- package/dist/assets/i18n/nb.d.ts +0 -55
- package/dist/assets/i18n/nb.js +0 -55
- package/dist/assets/i18n/nl.d.ts +0 -55
- package/dist/assets/i18n/nl.js +0 -55
- package/dist/assets/i18n/pl.d.ts +0 -55
- package/dist/assets/i18n/pl.js +0 -55
- package/dist/assets/i18n/pt.d.ts +0 -55
- package/dist/assets/i18n/pt.js +0 -55
- package/dist/assets/i18n/pt_pt.d.ts +0 -55
- package/dist/assets/i18n/pt_pt.js +0 -55
- package/dist/assets/i18n/ro.d.ts +0 -55
- package/dist/assets/i18n/ro.js +0 -55
- package/dist/assets/i18n/ru.d.ts +0 -55
- package/dist/assets/i18n/ru.js +0 -55
- package/dist/assets/i18n/sk.d.ts +0 -55
- package/dist/assets/i18n/sk.js +0 -55
- package/dist/assets/i18n/sv.d.ts +0 -55
- package/dist/assets/i18n/sv.js +0 -55
- package/dist/assets/i18n/th.d.ts +0 -55
- package/dist/assets/i18n/th.js +0 -55
- package/dist/assets/i18n/tr.d.ts +0 -55
- package/dist/assets/i18n/tr.js +0 -55
- package/dist/assets/i18n/uk.d.ts +0 -55
- package/dist/assets/i18n/uk.js +0 -55
- package/dist/assets/i18n/vi.d.ts +0 -55
- package/dist/assets/i18n/vi.js +0 -55
- package/dist/assets/i18n/zh.d.ts +0 -55
- package/dist/assets/i18n/zh.js +0 -55
- package/dist/assets/i18n/zh_hk.d.ts +0 -55
- package/dist/assets/i18n/zh_hk.js +0 -55
- package/dist/assets/i18n/zh_tw.d.ts +0 -55
- package/dist/assets/i18n/zh_tw.js +0 -55
|
@@ -1,13 +1,73 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect, useRef } from 'react';
|
|
3
3
|
import { SeatControlGroup } from "../../components/seatControlGroup";
|
|
4
4
|
import { useSeatControlData } from "../../hooks";
|
|
5
|
+
import { useCardTrack } from '@miot-rn/common-component/dist/service/track';
|
|
6
|
+
import { reportTrack } from '@miot-rn/common-component/dist/service/track';
|
|
7
|
+
import { useSpecState } from '@miot-rn/common-component/dist/store/useGlobalSpecManager';
|
|
8
|
+
import { CAR_CARD, CAR_ITEM } from "../../track/config";
|
|
9
|
+
|
|
10
|
+
// 车插件埋点设计表定义的座椅 card_name(sheet 第 63/66/72 行)。
|
|
11
|
+
const SEAT_CARD_MAP = {
|
|
12
|
+
Row1Left: 'driver_seat',
|
|
13
|
+
Row1Right: 'passenger_seat',
|
|
14
|
+
Row2Left: 'rear_left_seat',
|
|
15
|
+
Row2Middle: 'rear_middle_seat',
|
|
16
|
+
Row2Right: 'rear_right_seat',
|
|
17
|
+
ThirdRowLeft: 'third_left_seat',
|
|
18
|
+
ThirdRowMiddle: 'third_middle_seat',
|
|
19
|
+
ThirdRowRight: 'third_right_seat'
|
|
20
|
+
};
|
|
21
|
+
const GEAR_LEVEL_MAP = {
|
|
22
|
+
0: 'off',
|
|
23
|
+
1: 'level_1',
|
|
24
|
+
2: 'level_2',
|
|
25
|
+
3: 'level_3'
|
|
26
|
+
};
|
|
27
|
+
const toGearLabel = v => GEAR_LEVEL_MAP[Number(v)] || String(v);
|
|
28
|
+
|
|
29
|
+
// 座椅埋点矩阵:cardName 通过 SEAT_CARD_MAP 从 heating spec.sDescription 兜底获取,
|
|
30
|
+
// 与 onSeatChange 里的取值路径保持一致,避免 expose / click 上 card_name 口径不一致。
|
|
31
|
+
// 第三排(ThirdRow*)仅加热无通风,ventilationKey 为 undefined。
|
|
32
|
+
const SEAT_SPEC_MATRIX = [{
|
|
33
|
+
heatingKey: 'specSeatRow1LeftPropertiesHeating',
|
|
34
|
+
ventilationKey: 'specSeatRow1LeftPropertiesSeatVentilation',
|
|
35
|
+
cardName: SEAT_CARD_MAP.Row1Left
|
|
36
|
+
}, {
|
|
37
|
+
heatingKey: 'specSeatRow1RightPropertiesHeating',
|
|
38
|
+
ventilationKey: 'specSeatRow1RightPropertiesSeatVentilation',
|
|
39
|
+
cardName: SEAT_CARD_MAP.Row1Right
|
|
40
|
+
}, {
|
|
41
|
+
heatingKey: 'specSeatRow2LeftPropertiesHeating',
|
|
42
|
+
ventilationKey: 'specSeatRow2LeftPropertiesSeatVentilation',
|
|
43
|
+
cardName: SEAT_CARD_MAP.Row2Left
|
|
44
|
+
}, {
|
|
45
|
+
heatingKey: 'specSeatRow2MiddlePropertiesHeating',
|
|
46
|
+
ventilationKey: 'specSeatRow2MiddlePropertiesSeatVentilation',
|
|
47
|
+
cardName: SEAT_CARD_MAP.Row2Middle
|
|
48
|
+
}, {
|
|
49
|
+
heatingKey: 'specSeatRow2RightPropertiesHeating',
|
|
50
|
+
ventilationKey: 'specSeatRow2RightPropertiesSeatVentilation',
|
|
51
|
+
cardName: SEAT_CARD_MAP.Row2Right
|
|
52
|
+
}, {
|
|
53
|
+
heatingKey: 'specSeatRow3LeftPropertiesHeating',
|
|
54
|
+
cardName: SEAT_CARD_MAP.ThirdRowLeft
|
|
55
|
+
}, {
|
|
56
|
+
heatingKey: 'specSeatRow3MiddlePropertiesHeating',
|
|
57
|
+
cardName: SEAT_CARD_MAP.ThirdRowMiddle
|
|
58
|
+
}, {
|
|
59
|
+
heatingKey: 'specSeatRow3RightPropertiesHeating',
|
|
60
|
+
cardName: SEAT_CARD_MAP.ThirdRowRight
|
|
61
|
+
}];
|
|
5
62
|
export const SeatModule = ({
|
|
6
63
|
specs,
|
|
7
64
|
disabled = false,
|
|
8
65
|
onSeatChange,
|
|
9
66
|
style
|
|
10
67
|
}) => {
|
|
68
|
+
useCardTrack({
|
|
69
|
+
cardName: CAR_CARD.SEAT_ALL
|
|
70
|
+
});
|
|
11
71
|
const {
|
|
12
72
|
seatRows,
|
|
13
73
|
seatTitles,
|
|
@@ -18,6 +78,77 @@ export const SeatModule = ({
|
|
|
18
78
|
disabled,
|
|
19
79
|
onSeatChange
|
|
20
80
|
});
|
|
81
|
+
|
|
82
|
+
// 加热/通风按钮的当前档位:仅用于给 expose 补 item_content,与 onSeatChange 中 GEAR_LEVEL_MAP 保持一致。
|
|
83
|
+
// 顺序与 SEAT_SPEC_MATRIX 一一对应;第三排无通风,对应位置为 undefined。
|
|
84
|
+
const row1LeftHeatingValue = useSpecState(specs.specSeatRow1LeftPropertiesHeating);
|
|
85
|
+
const row1LeftVentValue = useSpecState(specs.specSeatRow1LeftPropertiesSeatVentilation);
|
|
86
|
+
const row1RightHeatingValue = useSpecState(specs.specSeatRow1RightPropertiesHeating);
|
|
87
|
+
const row1RightVentValue = useSpecState(specs.specSeatRow1RightPropertiesSeatVentilation);
|
|
88
|
+
const row2LeftHeatingValue = useSpecState(specs.specSeatRow2LeftPropertiesHeating);
|
|
89
|
+
const row2LeftVentValue = useSpecState(specs.specSeatRow2LeftPropertiesSeatVentilation);
|
|
90
|
+
const row2MiddleHeatingValue = useSpecState(specs.specSeatRow2MiddlePropertiesHeating);
|
|
91
|
+
const row2MiddleVentValue = useSpecState(specs.specSeatRow2MiddlePropertiesSeatVentilation);
|
|
92
|
+
const row2RightHeatingValue = useSpecState(specs.specSeatRow2RightPropertiesHeating);
|
|
93
|
+
const row2RightVentValue = useSpecState(specs.specSeatRow2RightPropertiesSeatVentilation);
|
|
94
|
+
const row3LeftHeatingValue = useSpecState(specs.specSeatRow3LeftPropertiesHeating);
|
|
95
|
+
const row3MiddleHeatingValue = useSpecState(specs.specSeatRow3MiddlePropertiesHeating);
|
|
96
|
+
const row3RightHeatingValue = useSpecState(specs.specSeatRow3RightPropertiesHeating);
|
|
97
|
+
const heatingValues = [row1LeftHeatingValue, row1RightHeatingValue, row2LeftHeatingValue, row2MiddleHeatingValue, row2RightHeatingValue, row3LeftHeatingValue, row3MiddleHeatingValue, row3RightHeatingValue];
|
|
98
|
+
const ventilationValues = [row1LeftVentValue, row1RightVentValue, row2LeftVentValue, row2MiddleVentValue, row2RightVentValue, undefined, undefined, undefined];
|
|
99
|
+
|
|
100
|
+
// 各座椅卡片 + 加热/通风按钮曝光。
|
|
101
|
+
// 按钮 expose 需带 item_content=当前档位(off/level_1..3),必须等 spec 值就绪;用 ref set 防重复上报。
|
|
102
|
+
const exposedKeysRef = useRef(new Set());
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
SEAT_SPEC_MATRIX.forEach(({
|
|
105
|
+
heatingKey,
|
|
106
|
+
ventilationKey,
|
|
107
|
+
cardName
|
|
108
|
+
}, idx) => {
|
|
109
|
+
const heatingSpec = specs[heatingKey];
|
|
110
|
+
const ventilationSpec = ventilationKey ? specs[ventilationKey] : undefined;
|
|
111
|
+
if (!heatingSpec && !ventilationSpec) return;
|
|
112
|
+
const cardKey = `card:${cardName}`;
|
|
113
|
+
if (!exposedKeysRef.current.has(cardKey)) {
|
|
114
|
+
reportTrack(['expose'], {
|
|
115
|
+
item_type: 'card',
|
|
116
|
+
card_name: cardName
|
|
117
|
+
});
|
|
118
|
+
exposedKeysRef.current.add(cardKey);
|
|
119
|
+
}
|
|
120
|
+
if (heatingSpec) {
|
|
121
|
+
const value = heatingValues[idx];
|
|
122
|
+
if (value !== undefined) {
|
|
123
|
+
const key = `btn:${cardName}:${CAR_ITEM.SEAT_HEATING}`;
|
|
124
|
+
if (!exposedKeysRef.current.has(key)) {
|
|
125
|
+
reportTrack(['expose'], {
|
|
126
|
+
item_type: 'button',
|
|
127
|
+
card_name: cardName,
|
|
128
|
+
item_name: CAR_ITEM.SEAT_HEATING,
|
|
129
|
+
item_content: toGearLabel(value)
|
|
130
|
+
});
|
|
131
|
+
exposedKeysRef.current.add(key);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (ventilationSpec) {
|
|
136
|
+
const value = ventilationValues[idx];
|
|
137
|
+
if (value !== undefined) {
|
|
138
|
+
const key = `btn:${cardName}:${CAR_ITEM.SEAT_VENTILATION}`;
|
|
139
|
+
if (!exposedKeysRef.current.has(key)) {
|
|
140
|
+
reportTrack(['expose'], {
|
|
141
|
+
item_type: 'button',
|
|
142
|
+
card_name: cardName,
|
|
143
|
+
item_name: CAR_ITEM.SEAT_VENTILATION,
|
|
144
|
+
item_content: toGearLabel(value)
|
|
145
|
+
});
|
|
146
|
+
exposedKeysRef.current.add(key);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}, [specs, heatingValues, ventilationValues]);
|
|
21
152
|
if (!hasSeats) {
|
|
22
153
|
return null;
|
|
23
154
|
}
|
|
@@ -25,7 +156,27 @@ export const SeatModule = ({
|
|
|
25
156
|
seatRows: seatRows,
|
|
26
157
|
title: seatTitles.groupTitle,
|
|
27
158
|
onSeatChange: params => {
|
|
28
|
-
//
|
|
159
|
+
// 埋点:从 spec.sDescription 提取座椅位置
|
|
160
|
+
const seatCardName = SEAT_CARD_MAP[params.spec?.sDescription] || 'unknown_seat';
|
|
161
|
+
const itemName = params.propType === 'heating' ? 'seat_heating' : 'seat_ventilation';
|
|
162
|
+
const itemContent = GEAR_LEVEL_MAP[Number(params.currentValue)] || String(params.currentValue);
|
|
163
|
+
// 1. 整体座椅卡片级 click
|
|
164
|
+
reportTrack(['click'], {
|
|
165
|
+
item_type: 'card',
|
|
166
|
+
card_name: CAR_CARD.SEAT_ALL
|
|
167
|
+
});
|
|
168
|
+
// 2. 具体座椅卡片级 click
|
|
169
|
+
reportTrack(['click'], {
|
|
170
|
+
item_type: 'card',
|
|
171
|
+
card_name: seatCardName
|
|
172
|
+
});
|
|
173
|
+
// 3. 元素级 click
|
|
174
|
+
reportTrack(['click'], {
|
|
175
|
+
item_type: 'button',
|
|
176
|
+
card_name: seatCardName,
|
|
177
|
+
item_name: itemName,
|
|
178
|
+
item_content: itemContent
|
|
179
|
+
});
|
|
29
180
|
handleSeatChangeFromHook({
|
|
30
181
|
propType: params.propType,
|
|
31
182
|
spec: params.spec,
|
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import { SteeringWheelHotCard } from "../../components/steeringWheelHotCard";
|
|
3
3
|
import { useSteeringWheelData } from "../../hooks/useSteeringWheelData";
|
|
4
4
|
import { ConnectStatus } from "../../hooks";
|
|
5
|
+
import { useCardTrack } from '@miot-rn/common-component/dist/service/track';
|
|
6
|
+
import { CAR_CARD } from "../../track/config";
|
|
7
|
+
/**
|
|
8
|
+
* 档位埋点标签:按 spec 档位值映射为 off / level_1 / level_2 / level_3。
|
|
9
|
+
* 不能依赖 description(spec value-list 为 "Level1"/"Level2",无空格,replace(/\s/) 会得到 level1 缺下划线)。
|
|
10
|
+
*/
|
|
11
|
+
const getGearTrackLabel = value => {
|
|
12
|
+
const n = Number(value);
|
|
13
|
+
if (!Number.isFinite(n) || n <= 0) return 'off';
|
|
14
|
+
return `level_${n}`;
|
|
15
|
+
};
|
|
5
16
|
export const SteeringWheelModule = ({
|
|
6
17
|
specs,
|
|
7
18
|
connectStatus,
|
|
@@ -10,6 +21,12 @@ export const SteeringWheelModule = ({
|
|
|
10
21
|
const {
|
|
11
22
|
specBodySteeringWheelPropertiesSteeringWheelHeating
|
|
12
23
|
} = specs;
|
|
24
|
+
const {
|
|
25
|
+
trackClick,
|
|
26
|
+
trackExpose
|
|
27
|
+
} = useCardTrack({
|
|
28
|
+
cardName: CAR_CARD.STEERING_WHEEL
|
|
29
|
+
});
|
|
13
30
|
const {
|
|
14
31
|
steeringWheelTitle,
|
|
15
32
|
steeringWheelHeatState,
|
|
@@ -18,6 +35,21 @@ export const SteeringWheelModule = ({
|
|
|
18
35
|
} = useSteeringWheelData({
|
|
19
36
|
specBodySteeringWheelPropertiesSteeringWheelHeating: specBodySteeringWheelPropertiesSteeringWheelHeating
|
|
20
37
|
});
|
|
38
|
+
|
|
39
|
+
// 每个档位按钮的曝光(off / level_1 / level_2 / level_3)
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (!specBodySteeringWheelPropertiesSteeringWheelHeating) return;
|
|
42
|
+
(steeringWheelOptions || []).forEach(option => {
|
|
43
|
+
const level = getGearTrackLabel(option?.value);
|
|
44
|
+
trackExpose(level);
|
|
45
|
+
});
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [specBodySteeringWheelPropertiesSteeringWheelHeating]);
|
|
48
|
+
const handleChange = val => {
|
|
49
|
+
const level = getGearTrackLabel(val);
|
|
50
|
+
trackClick(level);
|
|
51
|
+
onSteeringWheelHotChange(val);
|
|
52
|
+
};
|
|
21
53
|
return /*#__PURE__*/React.createElement(SteeringWheelHotCard, {
|
|
22
54
|
steeringWheelTitle: steeringWheelTitle,
|
|
23
55
|
disabled: connectStatus !== ConnectStatus.CONNECTED || isCarRunning,
|
|
@@ -25,7 +57,7 @@ export const SteeringWheelModule = ({
|
|
|
25
57
|
// @ts-ignore
|
|
26
58
|
,
|
|
27
59
|
options: steeringWheelOptions,
|
|
28
|
-
onChange:
|
|
60
|
+
onChange: handleChange
|
|
29
61
|
});
|
|
30
62
|
};
|
|
31
63
|
export default SteeringWheelModule;
|