@ledvance/base 1.1.11 → 1.1.13

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/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "@ledvance/base",
5
5
  "pid": [],
6
6
  "uiid": "",
7
- "version": "1.1.11",
7
+ "version": "1.1.13",
8
8
  "scripts": {},
9
9
  "dependencies": {
10
10
  "@reduxjs/toolkit": "^1.8.6",
@@ -16,7 +16,7 @@ let groupFeatureListener: EmitterSubscription|null
16
16
 
17
17
  interface GroupFeatureEvent {
18
18
  tyGroupId: number
19
- config: any
19
+ config: string
20
20
  }
21
21
 
22
22
  interface DeviceEvent {
@@ -57,7 +57,7 @@ export const addListener = (store) => {
57
57
  uaGroupInfo: {
58
58
  tyGroupId: event.tyGroupId,
59
59
  pId: '',
60
- config: event.config,
60
+ config: JSON.parse(event.config),
61
61
  dps: {}
62
62
  },
63
63
  }
@@ -153,7 +153,7 @@ const composeLayout = (component: React.ComponentType) => {
153
153
  tyGroupId: uaGroupInfo.tyGroupId,
154
154
  dps: {...dps, ...JSON.parse(uaGroupInfo.dps)},
155
155
  pId: uaGroupInfo.pId,
156
- config: uaGroupInfo.config || {},
156
+ config: JSON.parse(uaGroupInfo.config || '{}'),
157
157
  },
158
158
  familyName: uaGroupInfo.familyName,
159
159
  }
@@ -43,7 +43,7 @@ export declare function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Pro
43
43
  */
44
44
  export declare function useGroupConfigFeature<GC, GCPT extends {
45
45
  [K in keyof GC]: GC[K];
46
- }[keyof GC]>(key: keyof GC, extraDps?: any): [GCPT, (value: GCPT) => Promise<Result<any>>];
46
+ }[keyof GC]>(key: keyof GC, extraDps?: any): [GCPT, (value: GCPT, dpValue: any) => Promise<Result<any>>];
47
47
  export declare const ldvModules: import("@reduxjs/toolkit").Reducer<NativeProps, import("@reduxjs/toolkit").AnyAction>;
48
48
  export declare const setNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setGroupNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setDps: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTimeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setEnergieverbrauch: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
49
49
  export { simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useDps, useFamilyName, useTimeSchedule, useEnergieverbrauch, };
@@ -6,7 +6,7 @@ import {DevInfo, DpValue} from 'tuya-panel-kit'
6
6
  import {NativeApi} from '../../api/native'
7
7
  import {useDispatch} from 'react-redux'
8
8
  import {GlobalParams} from '../GlobalParams'
9
- import {camelCase} from 'lodash'
9
+ import {snakeCase} from 'lodash'
10
10
 
11
11
  export interface NativeProps {
12
12
  familyName: string
@@ -222,12 +222,12 @@ export function useGroupConfig<T>(): [T, (dps: any, newConfig: T) => Promise<Res
222
222
  * @param extraDps
223
223
  */
224
224
  export function useGroupConfigFeature<GC, GCPT extends { [K in keyof GC]: GC[K] }[keyof GC]>
225
- (key: keyof GC, extraDps: any = {}): [GCPT, (value: GCPT) => Promise<Result<any>>] {
225
+ (key: keyof GC, extraDps: any = {}): [GCPT, (value: GCPT, dpValue: any) => Promise<Result<any>>] {
226
226
  const [groupConfig, setGroupConfig] = useGroupConfig<GC>()
227
- const setGroupConfigFeature = async (value: GCPT) => {
227
+ const setGroupConfigFeature = async (value: GCPT, dpValue: any) => {
228
228
  return await setGroupConfig(
229
229
  {
230
- [GlobalParams.dpSchemaMap[camelCase(key as string)].dp]: value,
230
+ [GlobalParams.dpSchemaMap[snakeCase(key as string)].dp]: dpValue,
231
231
  ...extraDps,
232
232
  },
233
233
  {