@miot-rn/car-component 1.0.5 → 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/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/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
|
@@ -14,5 +14,7 @@ export interface UseDualRangeDataProps {
|
|
|
14
14
|
specPowerRangePropertiesCltcFuelEndurance: Spec;
|
|
15
15
|
specPowerRangePropertiesWltcPureEleCruisingEndurance: Spec;
|
|
16
16
|
specPowerRangePropertiesWltcFuelEndurance: Spec;
|
|
17
|
+
specPowerRangePropertiesRemoteEvRange?: Spec;
|
|
18
|
+
specPowerRangePropertiesRemoteFuelRange?: Spec;
|
|
17
19
|
}
|
|
18
|
-
export declare const useDualRangeData: ({ specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specPowerRangePropertiesCltcFuelEndurance, specPowerRangePropertiesWltcPureEleCruisingEndurance, specPowerRangePropertiesWltcFuelEndurance, }: UseDualRangeDataProps) => DualRangeDisplayData;
|
|
20
|
+
export declare const useDualRangeData: ({ specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specPowerRangePropertiesCltcFuelEndurance, specPowerRangePropertiesWltcPureEleCruisingEndurance, specPowerRangePropertiesWltcFuelEndurance, specPowerRangePropertiesRemoteEvRange, specPowerRangePropertiesRemoteFuelRange, }: UseDualRangeDataProps) => DualRangeDisplayData;
|
|
@@ -15,7 +15,9 @@ export const useDualRangeData = ({
|
|
|
15
15
|
specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange,
|
|
16
16
|
specPowerRangePropertiesCltcFuelEndurance,
|
|
17
17
|
specPowerRangePropertiesWltcPureEleCruisingEndurance,
|
|
18
|
-
specPowerRangePropertiesWltcFuelEndurance
|
|
18
|
+
specPowerRangePropertiesWltcFuelEndurance,
|
|
19
|
+
specPowerRangePropertiesRemoteEvRange,
|
|
20
|
+
specPowerRangePropertiesRemoteFuelRange
|
|
19
21
|
}) => {
|
|
20
22
|
const {
|
|
21
23
|
colorToken
|
|
@@ -25,6 +27,8 @@ export const useDualRangeData = ({
|
|
|
25
27
|
const cltcFuelEnduranceValue = useSpecState(specPowerRangePropertiesCltcFuelEndurance);
|
|
26
28
|
const wltcPureEleCruisingEnduranceValue = useSpecState(specPowerRangePropertiesWltcPureEleCruisingEndurance);
|
|
27
29
|
const wltcFuelEnduranceValue = useSpecState(specPowerRangePropertiesWltcFuelEndurance);
|
|
30
|
+
const remoteEvRangeValue = useSpecState(specPowerRangePropertiesRemoteEvRange);
|
|
31
|
+
const remoteFuelRangeValue = useSpecState(specPowerRangePropertiesRemoteFuelRange);
|
|
28
32
|
const distanceUnit = useMemo(() => {
|
|
29
33
|
const text = getLocalI18n('car_distance_value_km');
|
|
30
34
|
if (typeof text === 'string') {
|
|
@@ -43,6 +47,8 @@ export const useDualRangeData = ({
|
|
|
43
47
|
const cltcFuelEndurance = toNumberOrNull(cltcFuelEnduranceValue);
|
|
44
48
|
const wltcPureEleCruisingEndurance = toNumberOrNull(wltcPureEleCruisingEnduranceValue);
|
|
45
49
|
const wltcFuelEndurance = toNumberOrNull(wltcFuelEnduranceValue);
|
|
50
|
+
const remoteEvRange = toNumberOrNull(remoteEvRangeValue);
|
|
51
|
+
const remoteFuelRange = toNumberOrNull(remoteFuelRangeValue);
|
|
46
52
|
if (isNil(dcdType)) {
|
|
47
53
|
return {
|
|
48
54
|
currentElectricRange: null,
|
|
@@ -55,6 +61,19 @@ export const useDualRangeData = ({
|
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
|
|
64
|
+
// 0. RealRange (动态续航) - 混动: 剩余电=remote-ev, 剩余油=remote-fuel
|
|
65
|
+
if (getValueBySpecDescription(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, 'RealRange') === dcdType) {
|
|
66
|
+
return {
|
|
67
|
+
currentElectricRange: remoteEvRange,
|
|
68
|
+
electricRange: specPowerRangePropertiesRemoteEvRange?.prop?.['value-range']?.[1] || 100,
|
|
69
|
+
unit: distanceUnit,
|
|
70
|
+
currentFuelRange: remoteFuelRange,
|
|
71
|
+
fuelRange: specPowerRangePropertiesRemoteFuelRange?.prop?.['value-range']?.[1] || 100,
|
|
72
|
+
electricColor,
|
|
73
|
+
fuelColor
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
58
77
|
// 1. WLTC Range (Extended Range)
|
|
59
78
|
if (getValueBySpecDescription(specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, 'WLTCRange') === dcdType) {
|
|
60
79
|
return {
|
|
@@ -78,6 +97,6 @@ export const useDualRangeData = ({
|
|
|
78
97
|
electricColor,
|
|
79
98
|
fuelColor
|
|
80
99
|
};
|
|
81
|
-
}, [dcdRangeSOCTypeDisplayValue, cltcEstimatedExtendEangeValue, cltcFuelEnduranceValue, wltcPureEleCruisingEnduranceValue, wltcFuelEnduranceValue, specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specPowerRangePropertiesCltcFuelEndurance, specPowerRangePropertiesWltcPureEleCruisingEndurance, specPowerRangePropertiesWltcFuelEndurance, distanceUnit, colorToken]);
|
|
100
|
+
}, [dcdRangeSOCTypeDisplayValue, cltcEstimatedExtendEangeValue, cltcFuelEnduranceValue, wltcPureEleCruisingEnduranceValue, wltcFuelEnduranceValue, remoteEvRangeValue, remoteFuelRangeValue, specPowerBatteryPropertiesDCDRangeSOCTypeDisplay, specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specPowerRangePropertiesCltcFuelEndurance, specPowerRangePropertiesWltcPureEleCruisingEndurance, specPowerRangePropertiesWltcFuelEndurance, specPowerRangePropertiesRemoteEvRange, specPowerRangePropertiesRemoteFuelRange, distanceUnit, colorToken]);
|
|
82
101
|
return useMemo(() => getDualRangeDisplayData(), [getDualRangeDisplayData]);
|
|
83
102
|
};
|
|
@@ -11,6 +11,9 @@ export interface SeatSpecs {
|
|
|
11
11
|
specSeatRow2MiddlePropertiesSeatVentilation?: Spec;
|
|
12
12
|
specSeatRow2RightPropertiesHeating?: Spec;
|
|
13
13
|
specSeatRow2RightPropertiesSeatVentilation?: Spec;
|
|
14
|
+
specSeatRow3LeftPropertiesHeating?: Spec;
|
|
15
|
+
specSeatRow3MiddlePropertiesHeating?: Spec;
|
|
16
|
+
specSeatRow3RightPropertiesHeating?: Spec;
|
|
14
17
|
}
|
|
15
18
|
export interface SeatControlDataProps {
|
|
16
19
|
specs: SeatSpecs;
|
|
@@ -73,6 +76,9 @@ export declare const SEAT_TITLES: {
|
|
|
73
76
|
rearLeft: string | Record<string, string>;
|
|
74
77
|
rearCenter: string | Record<string, string>;
|
|
75
78
|
rearRight: string | Record<string, string>;
|
|
79
|
+
thirdLeft: string | Record<string, string>;
|
|
80
|
+
thirdCenter: string | Record<string, string>;
|
|
81
|
+
thirdRight: string | Record<string, string>;
|
|
76
82
|
};
|
|
77
83
|
export declare const useSeatControlData: ({ specs, disabled, onSeatChange }: SeatControlDataProps) => {
|
|
78
84
|
seatRows: {
|
|
@@ -88,6 +94,9 @@ export declare const useSeatControlData: ({ specs, disabled, onSeatChange }: Sea
|
|
|
88
94
|
rearLeft: string | Record<string, string>;
|
|
89
95
|
rearCenter: string | Record<string, string>;
|
|
90
96
|
rearRight: string | Record<string, string>;
|
|
97
|
+
thirdLeft: string | Record<string, string>;
|
|
98
|
+
thirdCenter: string | Record<string, string>;
|
|
99
|
+
thirdRight: string | Record<string, string>;
|
|
91
100
|
};
|
|
92
101
|
handleSeatChange: ({ propType, spec, previousValue, currentValue }: OnButtonPressParams) => void;
|
|
93
102
|
hasSeats: boolean;
|
|
@@ -87,7 +87,10 @@ export const SEAT_TITLES = {
|
|
|
87
87
|
frontRight: typeof getLocalI18n(SeatI18nKeys.FrontRight) === 'string' ? getLocalI18n(SeatI18nKeys.FrontRight) : '',
|
|
88
88
|
rearLeft: typeof getLocalI18n(SeatI18nKeys.RearLeft) === 'string' ? getLocalI18n(SeatI18nKeys.RearLeft) : '',
|
|
89
89
|
rearCenter: typeof getLocalI18n(SeatI18nKeys.RearCenter) === 'string' ? getLocalI18n(SeatI18nKeys.RearCenter) : '',
|
|
90
|
-
rearRight: typeof getLocalI18n(SeatI18nKeys.RearRight) === 'string' ? getLocalI18n(SeatI18nKeys.RearRight) : ''
|
|
90
|
+
rearRight: typeof getLocalI18n(SeatI18nKeys.RearRight) === 'string' ? getLocalI18n(SeatI18nKeys.RearRight) : '',
|
|
91
|
+
thirdLeft: typeof getLocalI18n(SeatI18nKeys.ThirdLeft) === 'string' ? getLocalI18n(SeatI18nKeys.ThirdLeft) : '',
|
|
92
|
+
thirdCenter: typeof getLocalI18n(SeatI18nKeys.ThirdCenter) === 'string' ? getLocalI18n(SeatI18nKeys.ThirdCenter) : '',
|
|
93
|
+
thirdRight: typeof getLocalI18n(SeatI18nKeys.ThirdRight) === 'string' ? getLocalI18n(SeatI18nKeys.ThirdRight) : ''
|
|
91
94
|
};
|
|
92
95
|
export const useSeatControlData = ({
|
|
93
96
|
specs,
|
|
@@ -107,7 +110,10 @@ export const useSeatControlData = ({
|
|
|
107
110
|
specSeatRow2MiddlePropertiesHeating,
|
|
108
111
|
specSeatRow2MiddlePropertiesSeatVentilation,
|
|
109
112
|
specSeatRow2RightPropertiesHeating,
|
|
110
|
-
specSeatRow2RightPropertiesSeatVentilation
|
|
113
|
+
specSeatRow2RightPropertiesSeatVentilation,
|
|
114
|
+
specSeatRow3LeftPropertiesHeating,
|
|
115
|
+
specSeatRow3MiddlePropertiesHeating,
|
|
116
|
+
specSeatRow3RightPropertiesHeating
|
|
111
117
|
} = specs;
|
|
112
118
|
|
|
113
119
|
// 实时值
|
|
@@ -121,6 +127,9 @@ export const useSeatControlData = ({
|
|
|
121
127
|
const seatRow2MiddleVentilationValue = useSpecState(specSeatRow2MiddlePropertiesSeatVentilation);
|
|
122
128
|
const seatRow2RightHeatingValue = useSpecState(specSeatRow2RightPropertiesHeating);
|
|
123
129
|
const seatRow2RightVentilationValue = useSpecState(specSeatRow2RightPropertiesSeatVentilation);
|
|
130
|
+
const seatRow3LeftHeatingValue = useSpecState(specSeatRow3LeftPropertiesHeating);
|
|
131
|
+
const seatRow3MiddleHeatingValue = useSpecState(specSeatRow3MiddlePropertiesHeating);
|
|
132
|
+
const seatRow3RightHeatingValue = useSpecState(specSeatRow3RightPropertiesHeating);
|
|
124
133
|
const levelIcons = useMemo(() => LEVEL_ICONS(colorToken), [colorToken]);
|
|
125
134
|
const typeConfig = useMemo(() => TYPE_CONFIG(colorToken, levelIcons), [colorToken, levelIcons]);
|
|
126
135
|
|
|
@@ -204,6 +213,24 @@ export const useSeatControlData = ({
|
|
|
204
213
|
heatingValue: Number(seatRow2RightHeatingValue ?? 0),
|
|
205
214
|
ventilationValue: Number(seatRow2RightVentilationValue ?? 0),
|
|
206
215
|
title: SEAT_TITLES.rearRight
|
|
216
|
+
}], [{
|
|
217
|
+
heating: specSeatRow3LeftPropertiesHeating,
|
|
218
|
+
ventilation: undefined,
|
|
219
|
+
heatingValue: Number(seatRow3LeftHeatingValue ?? 0),
|
|
220
|
+
ventilationValue: 0,
|
|
221
|
+
title: SEAT_TITLES.thirdLeft
|
|
222
|
+
}, {
|
|
223
|
+
heating: specSeatRow3MiddlePropertiesHeating,
|
|
224
|
+
ventilation: undefined,
|
|
225
|
+
heatingValue: Number(seatRow3MiddleHeatingValue ?? 0),
|
|
226
|
+
ventilationValue: 0,
|
|
227
|
+
title: SEAT_TITLES.thirdCenter
|
|
228
|
+
}, {
|
|
229
|
+
heating: specSeatRow3RightPropertiesHeating,
|
|
230
|
+
ventilation: undefined,
|
|
231
|
+
heatingValue: Number(seatRow3RightHeatingValue ?? 0),
|
|
232
|
+
ventilationValue: 0,
|
|
233
|
+
title: SEAT_TITLES.thirdRight
|
|
207
234
|
}]];
|
|
208
235
|
return rows.map(row => row.map(({
|
|
209
236
|
heating,
|
|
@@ -221,7 +248,7 @@ export const useSeatControlData = ({
|
|
|
221
248
|
buttons: buildButtons(heating, ventilation, heatingValue, ventilationValue, disabled)
|
|
222
249
|
};
|
|
223
250
|
}).filter(seat => seat !== null)).filter(rowSeats => rowSeats.length > 0);
|
|
224
|
-
}, [buildButtons, specSeatRow1LeftPropertiesHeating, specSeatRow1LeftPropertiesSeatVentilation, specSeatRow1RightPropertiesHeating, specSeatRow1RightPropertiesSeatVentilation, specSeatRow2LeftPropertiesHeating, specSeatRow2LeftPropertiesSeatVentilation, specSeatRow2MiddlePropertiesHeating, specSeatRow2MiddlePropertiesSeatVentilation, specSeatRow2RightPropertiesHeating, specSeatRow2RightPropertiesSeatVentilation, seatRow1LeftHeatingValue, seatRow1LeftVentilationValue, seatRow1RightHeatingValue, seatRow1RightVentilationValue, seatRow2LeftHeatingValue, seatRow2LeftVentilationValue, seatRow2MiddleHeatingValue, seatRow2MiddleVentilationValue, seatRow2RightHeatingValue, seatRow2RightVentilationValue, disabled]);
|
|
251
|
+
}, [buildButtons, specSeatRow1LeftPropertiesHeating, specSeatRow1LeftPropertiesSeatVentilation, specSeatRow1RightPropertiesHeating, specSeatRow1RightPropertiesSeatVentilation, specSeatRow2LeftPropertiesHeating, specSeatRow2LeftPropertiesSeatVentilation, specSeatRow2MiddlePropertiesHeating, specSeatRow2MiddlePropertiesSeatVentilation, specSeatRow2RightPropertiesHeating, specSeatRow2RightPropertiesSeatVentilation, specSeatRow3LeftPropertiesHeating, specSeatRow3MiddlePropertiesHeating, specSeatRow3RightPropertiesHeating, seatRow1LeftHeatingValue, seatRow1LeftVentilationValue, seatRow1RightHeatingValue, seatRow1RightVentilationValue, seatRow2LeftHeatingValue, seatRow2LeftVentilationValue, seatRow2MiddleHeatingValue, seatRow2MiddleVentilationValue, seatRow2RightHeatingValue, seatRow2RightVentilationValue, seatRow3LeftHeatingValue, seatRow3MiddleHeatingValue, seatRow3RightHeatingValue, disabled]);
|
|
225
252
|
const handleSeatChange = useCallback(({
|
|
226
253
|
propType,
|
|
227
254
|
spec,
|
|
@@ -6,6 +6,35 @@ export declare const useSteeringWheelData: ({ specBodySteeringWheelPropertiesSte
|
|
|
6
6
|
steeringWheelTitle: string | Record<string, string>;
|
|
7
7
|
steeringWheelHeatState: any;
|
|
8
8
|
onSteeringWheelHotChange: (val: any) => void;
|
|
9
|
-
steeringWheelOptions:
|
|
9
|
+
steeringWheelOptions: {
|
|
10
|
+
label: any;
|
|
11
|
+
colorType: string | undefined;
|
|
12
|
+
siid: number;
|
|
13
|
+
piid?: number | undefined;
|
|
14
|
+
eiid?: number | undefined;
|
|
15
|
+
aiid?: number | undefined;
|
|
16
|
+
miid?: number | undefined;
|
|
17
|
+
did?: string | undefined;
|
|
18
|
+
value?: unknown;
|
|
19
|
+
in?: unknown[] | undefined;
|
|
20
|
+
out?: unknown[] | undefined;
|
|
21
|
+
description?: string | undefined;
|
|
22
|
+
dataSource?: number | undefined;
|
|
23
|
+
viid?: number | undefined;
|
|
24
|
+
skey?: string | undefined;
|
|
25
|
+
pkey?: string | undefined;
|
|
26
|
+
akey?: string | undefined;
|
|
27
|
+
ekey?: string | undefined;
|
|
28
|
+
service?: unknown;
|
|
29
|
+
prop?: import("../types").SpecPropertyRaw | undefined;
|
|
30
|
+
action?: import("../types").SpecActionRaw | undefined;
|
|
31
|
+
event?: import("../types").SpecEventRaw | undefined;
|
|
32
|
+
source?: unknown;
|
|
33
|
+
sDescription?: string | undefined;
|
|
34
|
+
mkey?: string | undefined;
|
|
35
|
+
mDescription?: string | undefined;
|
|
36
|
+
reiids?: number[] | undefined;
|
|
37
|
+
reIndexs?: number[] | undefined;
|
|
38
|
+
}[];
|
|
10
39
|
};
|
|
11
40
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,5 @@ export { useParkingStatusData, type ParkingStatusInfo, type UseParkingStatusData
|
|
|
20
20
|
export { useSeatControlData, type SeatControlDataProps, SeatSpecs, LEVEL_ICONS, TYPE_CONFIG, SEAT_TITLES, } from './hooks/useSeatControlData';
|
|
21
21
|
export * from './config';
|
|
22
22
|
export * from './modules';
|
|
23
|
+
export * from './track';
|
|
23
24
|
export { isOverseas, isFeatureEnabled, useFeatureEnabled, type FeatureKey } from './utils/featureGate';
|
package/dist/index.js
CHANGED
|
@@ -19,4 +19,5 @@ export { useParkingStatusData } from "./hooks/useParkingStatusData";
|
|
|
19
19
|
export { useSeatControlData, SeatSpecs, LEVEL_ICONS, TYPE_CONFIG, SEAT_TITLES } from "./hooks/useSeatControlData";
|
|
20
20
|
export * from "./config";
|
|
21
21
|
export * from "./modules";
|
|
22
|
+
export * from "./track";
|
|
22
23
|
export { isOverseas, isFeatureEnabled, useFeatureEnabled } from "./utils/featureGate";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { AirConditioningCard } from "../../components/airConditioningCard";
|
|
3
3
|
import { useAirConditionData } from "../../hooks/useAirConditionData";
|
|
4
4
|
import { ConnectStatus } from "../../hooks";
|
|
5
|
+
import { useCardTrack } from '@miot-rn/common-component/dist/service/track';
|
|
6
|
+
import { CAR_CARD, CAR_ITEM } from "../../track/config";
|
|
5
7
|
export const AirconditionModule = ({
|
|
6
8
|
specs,
|
|
7
9
|
connectStatus,
|
|
@@ -15,6 +17,14 @@ export const AirconditionModule = ({
|
|
|
15
17
|
specHVACTemperaturePropertiesHvacTargetTemperature
|
|
16
18
|
} = specs;
|
|
17
19
|
const {
|
|
20
|
+
trackClick,
|
|
21
|
+
trackExpose
|
|
22
|
+
} = useCardTrack({
|
|
23
|
+
cardName: CAR_CARD.AC
|
|
24
|
+
});
|
|
25
|
+
const {
|
|
26
|
+
hvacStatus,
|
|
27
|
+
hvacDefrosterStatus,
|
|
18
28
|
transformHvacStatus,
|
|
19
29
|
transformHvacDefrosterStatus,
|
|
20
30
|
targetTemperature,
|
|
@@ -38,15 +48,63 @@ export const AirconditionModule = ({
|
|
|
38
48
|
specHVACTemperaturePropertiesOutsideTemperature: specHVACTemperaturePropertiesOutsideTemperature,
|
|
39
49
|
specHVACTemperaturePropertiesHvacTargetTemperature: specHVACTemperaturePropertiesHvacTargetTemperature
|
|
40
50
|
});
|
|
51
|
+
|
|
52
|
+
// TEMP_ADJUST 不依赖 spec 值,mount 同步触发
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (specHVACTemperaturePropertiesHvacTargetTemperature) {
|
|
55
|
+
trackExpose(CAR_ITEM.TEMP_ADJUST);
|
|
56
|
+
}
|
|
57
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
// AC/DEFROST 开关 expose 必须等 spec 值就绪后再发,否则 transform 在 undefined 时永远是 false
|
|
61
|
+
const acExposedRef = useRef(false);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (acExposedRef.current) return;
|
|
64
|
+
if (specHVACStatePropertiesHvacStatus && hvacStatus !== undefined) {
|
|
65
|
+
trackExpose(CAR_ITEM.AC_SWITCH, {
|
|
66
|
+
item_content: String(transformHvacStatus)
|
|
67
|
+
});
|
|
68
|
+
acExposedRef.current = true;
|
|
69
|
+
}
|
|
70
|
+
}, [hvacStatus, transformHvacStatus, specHVACStatePropertiesHvacStatus, trackExpose]);
|
|
71
|
+
const defrostExposedRef = useRef(false);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (defrostExposedRef.current) return;
|
|
74
|
+
if (specHVACStatePropertiesHvacDefrosterStatus && hvacDefrosterStatus !== undefined) {
|
|
75
|
+
trackExpose(CAR_ITEM.DEFROST_SWITCH, {
|
|
76
|
+
item_content: String(transformHvacDefrosterStatus)
|
|
77
|
+
});
|
|
78
|
+
defrostExposedRef.current = true;
|
|
79
|
+
}
|
|
80
|
+
}, [hvacDefrosterStatus, transformHvacDefrosterStatus, specHVACStatePropertiesHvacDefrosterStatus, trackExpose]);
|
|
81
|
+
const handleHvacStatusChange = val => {
|
|
82
|
+
trackClick(CAR_ITEM.AC_SWITCH, {
|
|
83
|
+
item_content: String(val)
|
|
84
|
+
});
|
|
85
|
+
onHvacStatusChange(val);
|
|
86
|
+
};
|
|
87
|
+
const handleDefrosterChange = val => {
|
|
88
|
+
trackClick(CAR_ITEM.DEFROST_SWITCH, {
|
|
89
|
+
item_content: String(val)
|
|
90
|
+
});
|
|
91
|
+
onHvacDefrosterChange(val);
|
|
92
|
+
};
|
|
93
|
+
const handleTemperatureChange = val => {
|
|
94
|
+
// 设计表(第 36-40 行):温度调节 +/- 仅定义 item_name,不含 item_content。
|
|
95
|
+
// 若后续需要采集目标温度值,先补设计表再补上报字段。
|
|
96
|
+
trackClick(CAR_ITEM.TEMP_ADJUST);
|
|
97
|
+
onHvacTemperatureChange(val);
|
|
98
|
+
};
|
|
41
99
|
return /*#__PURE__*/React.createElement(AirConditioningCard, {
|
|
42
100
|
showAirc: !!specHVACStatePropertiesHvacStatus,
|
|
43
101
|
showTargetTemperature: !!specHVACTemperaturePropertiesHvacTargetTemperature,
|
|
44
102
|
hvacStatus: transformHvacStatus,
|
|
45
103
|
hvacDefrosterStatus: transformHvacDefrosterStatus,
|
|
46
104
|
targetTemperature: targetTemperature,
|
|
47
|
-
onHvacStatusChange:
|
|
48
|
-
onHvacDefrosterChange:
|
|
49
|
-
onHvacTemperatureChange:
|
|
105
|
+
onHvacStatusChange: handleHvacStatusChange,
|
|
106
|
+
onHvacDefrosterChange: handleDefrosterChange,
|
|
107
|
+
onHvacTemperatureChange: handleTemperatureChange,
|
|
50
108
|
hvacTitle: hvacTitle,
|
|
51
109
|
hvacDefrosterTitle: hvacDefrosterTitle,
|
|
52
110
|
hvacDefrosterSubtitle: airConditionTip,
|
|
@@ -12,6 +12,8 @@ export interface CarInfoSpecs {
|
|
|
12
12
|
specPowerRangePropertiesCltcFuelEndurance?: Spec;
|
|
13
13
|
specPowerRangePropertiesWltcPureEleCruisingEndurance?: Spec;
|
|
14
14
|
specPowerRangePropertiesWltcFuelEndurance?: Spec;
|
|
15
|
+
specPowerRangePropertiesRemoteEvRange?: Spec;
|
|
16
|
+
specPowerRangePropertiesRemoteFuelRange?: Spec;
|
|
15
17
|
specBodyGearPropertiesGearStatus?: Spec;
|
|
16
18
|
specBodyPowerModePropertiesPowerModeState?: Spec;
|
|
17
19
|
specDoorCentralLockPropertiesCentralLockState?: Spec;
|
|
@@ -22,5 +24,5 @@ export interface CarInfoModuleProps {
|
|
|
22
24
|
connectStatus?: ConnectStatusValue;
|
|
23
25
|
containerStyle?: StyleProp<ViewStyle>;
|
|
24
26
|
}
|
|
25
|
-
export declare const CarInfoModule: ({ specs, connectStatus, containerStyle }: CarInfoModuleProps) => React.JSX.Element;
|
|
27
|
+
export declare const CarInfoModule: ({ specs, connectStatus, containerStyle, }: CarInfoModuleProps) => React.JSX.Element;
|
|
26
28
|
export default CarInfoModule;
|
|
@@ -9,8 +9,8 @@ export const CarInfoModule = ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
// 判断 rangeType 类型
|
|
11
11
|
const rangeType = useMemo(() => {
|
|
12
|
-
return specs.specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange || specs.specPowerRangePropertiesWltcFuelEndurance || specs.specPowerRangePropertiesWltcPureEleCruisingEndurance || specs.specPowerRangePropertiesCltcFuelEndurance ? 'dual' : 'single';
|
|
13
|
-
}, [specs.specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specs.specPowerRangePropertiesWltcFuelEndurance, specs.specPowerRangePropertiesWltcPureEleCruisingEndurance, specs.specPowerRangePropertiesCltcFuelEndurance]);
|
|
12
|
+
return specs.specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange || specs.specPowerRangePropertiesWltcFuelEndurance || specs.specPowerRangePropertiesWltcPureEleCruisingEndurance || specs.specPowerRangePropertiesCltcFuelEndurance || specs.specPowerRangePropertiesRemoteEvRange || specs.specPowerRangePropertiesRemoteFuelRange ? 'dual' : 'single';
|
|
13
|
+
}, [specs.specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange, specs.specPowerRangePropertiesWltcFuelEndurance, specs.specPowerRangePropertiesWltcPureEleCruisingEndurance, specs.specPowerRangePropertiesCltcFuelEndurance, specs.specPowerRangePropertiesRemoteEvRange, specs.specPowerRangePropertiesRemoteFuelRange]);
|
|
14
14
|
|
|
15
15
|
// 单续航数据
|
|
16
16
|
const singleRangeData = useSingleRangeData({
|
|
@@ -27,7 +27,9 @@ export const CarInfoModule = ({
|
|
|
27
27
|
specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange: specs.specPowerBatteryLifeEffectivenessPropertiesCltcEstimatedExtendEange,
|
|
28
28
|
specPowerRangePropertiesCltcFuelEndurance: specs.specPowerRangePropertiesCltcFuelEndurance,
|
|
29
29
|
specPowerRangePropertiesWltcPureEleCruisingEndurance: specs.specPowerRangePropertiesWltcPureEleCruisingEndurance,
|
|
30
|
-
specPowerRangePropertiesWltcFuelEndurance: specs.specPowerRangePropertiesWltcFuelEndurance
|
|
30
|
+
specPowerRangePropertiesWltcFuelEndurance: specs.specPowerRangePropertiesWltcFuelEndurance,
|
|
31
|
+
specPowerRangePropertiesRemoteEvRange: specs.specPowerRangePropertiesRemoteEvRange,
|
|
32
|
+
specPowerRangePropertiesRemoteFuelRange: specs.specPowerRangePropertiesRemoteFuelRange
|
|
31
33
|
});
|
|
32
34
|
|
|
33
35
|
// 驻车状态数据
|
|
@@ -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;
|