@eohjsc/react-native-smart-city 0.3.93 → 0.3.95

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 (48) hide show
  1. package/package.json +1 -1
  2. package/src/commons/ActionGroup/OnOffTemplate/index.js +20 -17
  3. package/src/commons/ActionGroup/__test__/OnOffButtonTemplate.test.js +1 -1
  4. package/src/commons/ActionGroup/__test__/OnOffTemplate.test.js +5 -24
  5. package/src/commons/SubUnit/OneTap/ItemOneTap.js +83 -85
  6. package/src/commons/SubUnit/OneTap/__test__/SubUnitAutomate.test.js +68 -24
  7. package/src/commons/SubUnit/OneTap/index.js +21 -1
  8. package/src/configs/API.js +1 -0
  9. package/src/screens/ActivityLog/__test__/index.test.js +60 -2
  10. package/src/screens/ActivityLog/hooks/__test__/index.test.js +5 -0
  11. package/src/screens/ActivityLog/hooks/index.js +11 -0
  12. package/src/screens/AddLocationMaps/index.js +1 -1
  13. package/src/screens/AddNewGateway/ConnectingDevice.js +7 -0
  14. package/src/screens/AddNewGateway/ConnectingWifiDevice.js +6 -4
  15. package/src/screens/AddNewGateway/ConnectingWifiGuide.js +0 -1
  16. package/src/screens/AddNewGateway/RenameNewDevices.js +2 -2
  17. package/src/screens/AddNewGateway/ScanWifiDeviceQR.js +1 -6
  18. package/src/screens/AddNewGateway/SelectDeviceType.js +67 -9
  19. package/src/screens/AddNewGateway/ShareWifiPassword.js +20 -3
  20. package/src/screens/AddNewGateway/__test__/ConnectingZigbeeDevice.test.js +35 -0
  21. package/src/screens/AddNewGateway/__test__/ScanWifiDeviceQR.test.js +0 -10
  22. package/src/screens/AddNewGateway/__test__/SelectDeviceType.test.js +183 -29
  23. package/src/screens/AllGateway/GatewayInfo/index.js +3 -3
  24. package/src/screens/Automate/AddNewAction/SetupConfigCondition.js +0 -1
  25. package/src/screens/Automate/MultiUnits.js +32 -18
  26. package/src/screens/Automate/ScriptDetail/__test__/index.test.js +36 -2
  27. package/src/screens/Automate/ScriptDetail/index.js +17 -3
  28. package/src/screens/Automate/Styles/MultiUnitsStyles.js +1 -1
  29. package/src/screens/Automate/__test__/MultiUnits.test.js +125 -8
  30. package/src/screens/Automate/__test__/index.test.js +95 -11
  31. package/src/screens/Automate/index.js +62 -38
  32. package/src/screens/Device/hooks/__test__/useEvaluateValue.test.js +24 -1
  33. package/src/screens/Sharing/InfoMemberUnit.js +2 -2
  34. package/src/screens/Sharing/MemberList.js +28 -7
  35. package/src/screens/Sharing/__test__/InfoMemberUnit.test.js +32 -18
  36. package/src/screens/Sharing/__test__/MemberList.test.js +37 -4
  37. package/src/screens/SubUnit/AddSubUnit.js +1 -1
  38. package/src/screens/SubUnit/__test__/AddSubUnit.test.js +16 -3
  39. package/src/screens/Unit/AddMenu.js +42 -19
  40. package/src/screens/Unit/__test__/AddMenu.test.js +68 -15
  41. package/src/screens/Unit/components/AutomateScript/index.js +1 -1
  42. package/src/utils/I18n/translations/en.js +1409 -0
  43. package/src/utils/I18n/translations/vi.js +1414 -0
  44. package/src/utils/I18n/translations.ts +2 -2
  45. package/src/utils/Permission/backend.js +7 -0
  46. package/src/screens/Sharing/__test__/MemberList2.test.js +0 -74
  47. package/src/utils/I18n/translations/en.json +0 -1142
  48. package/src/utils/I18n/translations/vi.json +0 -1139
@@ -1,7 +1,7 @@
1
1
  import MessageFormat from '@messageformat/core';
2
2
 
3
- import en from './translations/en.json';
4
- import vi from './translations/vi.json';
3
+ import en from './translations/en.js';
4
+ import vi from './translations/vi.js';
5
5
 
6
6
  export type TranslationString = keyof typeof en;
7
7
  export type Language = 'en' | 'vi';
@@ -0,0 +1,7 @@
1
+ import { useSCContextSelector } from '../../context';
2
+
3
+ export const useBackendPermission = () => {
4
+ return useSCContextSelector(
5
+ (state) => state?.auth?.account?.user?.permissions
6
+ );
7
+ };
@@ -1,74 +0,0 @@
1
- import React from 'react';
2
- import { create, act } from 'react-test-renderer';
3
-
4
- import MemberList from '../MemberList';
5
- import { AlertAction } from '../../../commons';
6
- import { SCProvider } from '../../../context';
7
- import { mockSCStore } from '../../../context/mockStore';
8
- import { TouchableOpacity } from 'react-native';
9
- import Routes from '../../../utils/Route';
10
- import { useNavigation } from '@react-navigation/native';
11
- import MockAdapter from 'axios-mock-adapter';
12
- import api from '../../../utils/Apis/axios';
13
-
14
- jest.mock('../../../hooks/Common', () => {
15
- return {
16
- useIsOwnerOfUnit: () => ({ isOwner: false }),
17
- };
18
- });
19
-
20
- const wrapComponent = (route, state) => (
21
- <SCProvider initState={mockSCStore({})}>
22
- <MemberList route={route} />
23
- </SCProvider>
24
- );
25
-
26
- new MockAdapter(api.axiosInstance);
27
-
28
- describe('test MemberList', () => {
29
- let route;
30
- let localState = {
31
- auth: {
32
- account: {
33
- user: {
34
- id: 2,
35
- },
36
- },
37
- },
38
- };
39
- const mockedNavigate = useNavigation().navigate;
40
-
41
- beforeEach(() => {
42
- route = {
43
- params: {
44
- unitId: 1,
45
- unit: {
46
- id: 1,
47
- user_id: 2,
48
- name: '',
49
- },
50
- },
51
- };
52
- mockedNavigate.mockReset();
53
- });
54
-
55
- it('AlertAction rightButtonClick', async () => {
56
- let tree;
57
- await act(async () => {
58
- tree = await create(wrapComponent(route, localState));
59
- });
60
- const instance = tree.root;
61
- const alertAction = instance.findByType(AlertAction);
62
- await act(async () => {
63
- alertAction.props.rightButtonClick();
64
- });
65
- const MemberListButtons = instance.findAllByType(TouchableOpacity);
66
- await act(async () => {
67
- await MemberListButtons[1].props.onPress();
68
- });
69
- expect(mockedNavigate).not.toBeCalledWith(Routes.AddMemberStack, {
70
- screen: Routes.SharingSelectPermission,
71
- params: { unit: { id: 1 } },
72
- });
73
- });
74
- });