@ledvance/group-ui-biz-bundle 1.0.46 → 1.0.47

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.
Files changed (37) hide show
  1. package/package.json +1 -1
  2. package/src/modules/biorhythm/BiorhythmActions.ts +5 -13
  3. package/src/modules/biorhythm/BiorhythmBean.ts +6 -6
  4. package/src/modules/biorhythm/BiorhythmPage.tsx +14 -38
  5. package/src/modules/biorhythm/Router.ts +34 -0
  6. package/src/modules/fixedTimeForPlug/Router.ts +25 -0
  7. package/src/modules/fixedTimingForLight/Router.ts +25 -0
  8. package/src/modules/flags/Router.ts +25 -0
  9. package/src/modules/mood/AddMoodPage.tsx +2 -2
  10. package/src/modules/mood_new/AddMoodPage.tsx +197 -0
  11. package/src/modules/mood_new/DynamicMoodEditorPage.tsx +654 -0
  12. package/src/modules/mood_new/Interface.ts +219 -0
  13. package/src/modules/mood_new/MixDynamicMoodEditor.tsx +788 -0
  14. package/src/modules/mood_new/MoodActions.ts +227 -0
  15. package/src/modules/mood_new/MoodInfo.ts +2151 -0
  16. package/src/modules/mood_new/MoodItem.tsx +148 -0
  17. package/src/modules/mood_new/MoodPage.tsx +374 -0
  18. package/src/modules/mood_new/MoodParse.ts +442 -0
  19. package/src/modules/mood_new/RecommendMoodItem.tsx +69 -0
  20. package/src/modules/mood_new/Router.ts +43 -0
  21. package/src/modules/mood_new/StaticMoodEditorPage.tsx +293 -0
  22. package/src/modules/music/Router.ts +16 -0
  23. package/src/modules/randomTimeForPlug/Router.ts +25 -0
  24. package/src/modules/randomTimingForLight/Router.ts +25 -0
  25. package/src/modules/remoteSwitch/Router.ts +16 -0
  26. package/src/modules/select/Router.ts +16 -0
  27. package/src/modules/switchGradient/Router.ts +16 -0
  28. package/src/modules/timeSchedule/Interface.ts +150 -0
  29. package/src/modules/timeSchedule/Router.ts +25 -0
  30. package/src/modules/timeSchedule/TimeScheduleActions.ts +140 -0
  31. package/src/modules/timeSchedule/TimeScheduleDetailPage.tsx +625 -0
  32. package/src/modules/timeSchedule/TimeSchedulePage.tsx +220 -0
  33. package/src/modules/timeSchedule/components/ManuaSettings.tsx +376 -0
  34. package/src/modules/timeSchedule/components/ScheduleCard.tsx +109 -0
  35. package/src/modules/timeSchedule/components/Summary.tsx +124 -0
  36. package/src/modules/timer/Router.ts +16 -0
  37. package/src/navigation/Routers.ts +1 -0
@@ -0,0 +1,140 @@
1
+ import { commonApi } from "@tuya/tuya-panel-api"
2
+ import { IAddSingleTime, IQueryTimerTasks, IModifySingleTimer, IModDeleteTaskByIds, UVCFanMode } from "@ledvance/group-ui-biz-bundle/src/modules/timeSchedule/Interface"
3
+ import { flatMapDeep } from "lodash";
4
+ import I18n from "@ledvance/base/src/i18n";
5
+ import { ColorList } from '@ledvance/base/src/components/StripAdjustView';
6
+ import { parseJSON } from "@tuya/tuya-panel-lamp-sdk/lib/utils";
7
+
8
+ export const defDeviceData = {
9
+ h: 0,
10
+ s: 100,
11
+ v: 100,
12
+ brightness: 100,
13
+ temperature: 0,
14
+ };
15
+
16
+ export const defMixDeviceData = {
17
+ ...defDeviceData,
18
+ colorEnable: true,
19
+ whiteEnable: true,
20
+ };
21
+
22
+ export const defStripDeviceData = {
23
+ ...defDeviceData,
24
+ activeKey: 0,
25
+ colorDiskActiveKey: 0,
26
+ colors: ColorList[0],
27
+ };
28
+
29
+ export const defCeilingLihtDeviceData = {
30
+ ...defMixDeviceData,
31
+ ...defStripDeviceData,
32
+ activeKey: 1
33
+ }
34
+
35
+ export const addTimeSchedule = async (props: IAddSingleTime) => {
36
+ console.log({
37
+ ...props,
38
+ bizType: '1',
39
+ category: 'category'
40
+ }, '< --- schedule --- >')
41
+ try {
42
+ const res = await commonApi.timerApi.addSingleTimer({
43
+ ...props,
44
+ bizType: '1',
45
+ category: 'category'
46
+ })
47
+ if (typeof res === 'number') {
48
+ return {
49
+ success: true
50
+ }
51
+ }
52
+ return {
53
+ success: false
54
+ }
55
+ } catch (err) {
56
+ return {
57
+ success: false
58
+ }
59
+ }
60
+ }
61
+
62
+ export const getTimeSchedule = async (props: IQueryTimerTasks) => {
63
+ try {
64
+ const res = await commonApi.timerApi.queryTimerTasks({
65
+ ...props,
66
+ bizType: '1',
67
+ category: 'category'
68
+ })
69
+ if (res.timers && res.timers.length) {
70
+ return {
71
+ success: true,
72
+ data: flatMapDeep(res.timers).map(time => ({
73
+ ...time,
74
+ dps: parseJSON(time.dps)
75
+ }))
76
+ }
77
+ }
78
+ return {
79
+ success: false
80
+ }
81
+ } catch (err) {
82
+ return {
83
+ success: false
84
+ }
85
+ }
86
+ }
87
+
88
+ export const modifyTimeSchedule = async (props: IModifySingleTimer) => {
89
+ try {
90
+ const status = await commonApi.timerApi.modifySingleTimer({
91
+ ...props,
92
+ bizType: '1',
93
+ })
94
+ return {
95
+ success: status
96
+ }
97
+ } catch (err) {
98
+ return {
99
+ success: false
100
+ }
101
+ }
102
+ }
103
+
104
+ export const modDelTimeSchedule = async (props: IModDeleteTaskByIds) => {
105
+ try {
106
+ const status = await commonApi.timerApi.modDeleteTaskByIds({
107
+ ...props,
108
+ bizType: '1',
109
+ status: 2
110
+ })
111
+ return {
112
+ success: status
113
+ }
114
+ } catch (err) {
115
+ return {
116
+ success: false
117
+ }
118
+ }
119
+ }
120
+
121
+ export const fanModeOption = [
122
+ {
123
+ label: I18n.getLang('ceiling_fan_mode_info_option_1_headline'),
124
+ value: UVCFanMode.Normal,
125
+ },
126
+ {
127
+ label: I18n.getLang('ceiling_fan_mode_info_option_2_headline'),
128
+ value: UVCFanMode.Nature,
129
+ },
130
+ ]
131
+
132
+ export const actionOption = {
133
+ switchLed: I18n.getLang('light_sources_tile_tw_lighting_headline'),
134
+ switchSocket: I18n.getLang('feature_summary_action_component_5'),
135
+ switchSocket1: I18n.getLang('feature_summary_action_component_6'),
136
+ switchSocket2: I18n.getLang('feature_summary_action_component_7'),
137
+ switchSocket3: I18n.getLang('feature_summary_action_component_8'),
138
+ switchSocket4: I18n.getLang('feature_summary_action_component_9'),
139
+ switchFan: I18n.getLang('add_new_dynamic_mood_ceiling_fan_field_headline'),
140
+ }