@zgfe/business-lib 1.2.57 → 1.2.58-ljy.0
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/es/hooks/useBizStore.d.ts +2 -4
- package/es/hooks/useBizStore.js +15 -16
- package/package.json +2 -2
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { UserTagsSelectorTypes } from '../userTagsSelector/types';
|
|
2
2
|
import { UserGroupTypes } from '../userGroup/types';
|
|
3
|
-
|
|
4
|
-
declare function useBizStore({ currentApp }: {
|
|
5
|
-
currentApp: AppInfoProps;
|
|
6
|
-
}): {
|
|
3
|
+
declare function useBizStore(appId: any): {
|
|
7
4
|
eventGroupList?: import("../attributeSelector/types").EventGroup[] | undefined;
|
|
8
5
|
userPropList?: import("../attributeSelector/types").UserProp[] | undefined;
|
|
9
6
|
envPropList?: import("../attributeSelector/types").EnvProp[] | undefined;
|
|
10
7
|
eventNameMap?: Record<string, import("../attributeSelector/types").AnalysisEvent> | undefined;
|
|
11
8
|
eventIdMap?: Record<number, import("../attributeSelector/types").AnalysisEvent> | undefined;
|
|
12
9
|
useBizStoreLoading: boolean;
|
|
10
|
+
setUseBizStoreLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
13
11
|
groupLoading: boolean;
|
|
14
12
|
userGroupList: UserGroupTypes.Group[];
|
|
15
13
|
tagList: UserTagsSelectorTypes.Tag[];
|
package/es/hooks/useBizStore.js
CHANGED
|
@@ -14,8 +14,7 @@ import { useEffect, useState, useCallback } from 'react';
|
|
|
14
14
|
import { ajax } from '../utils';
|
|
15
15
|
import Apis from '../constants/apis';
|
|
16
16
|
import convertAttributeData from '../attributeSelector/util';
|
|
17
|
-
function useBizStore(
|
|
18
|
-
var currentApp = _ref.currentApp;
|
|
17
|
+
function useBizStore(appId) {
|
|
19
18
|
var _useState = useState([]),
|
|
20
19
|
_useState2 = _slicedToArray(_useState, 2),
|
|
21
20
|
userGroupList = _useState2[0],
|
|
@@ -63,7 +62,7 @@ function useBizStore(_ref) {
|
|
|
63
62
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
64
63
|
store = _useState24[0],
|
|
65
64
|
setStore = _useState24[1];
|
|
66
|
-
var _useState25 = useState(
|
|
65
|
+
var _useState25 = useState(true),
|
|
67
66
|
_useState26 = _slicedToArray(_useState25, 2),
|
|
68
67
|
useBizStoreLoading = _useState26[0],
|
|
69
68
|
setUseBizStoreLoading = _useState26[1];
|
|
@@ -72,7 +71,7 @@ function useBizStore(_ref) {
|
|
|
72
71
|
ajax(Apis.queryUserGroup, {
|
|
73
72
|
method: 'post',
|
|
74
73
|
data: {
|
|
75
|
-
appId:
|
|
74
|
+
appId: appId,
|
|
76
75
|
platform: 0,
|
|
77
76
|
includeDefault: true,
|
|
78
77
|
includeToday: true
|
|
@@ -83,13 +82,13 @@ function useBizStore(_ref) {
|
|
|
83
82
|
}).finally(function () {
|
|
84
83
|
setGroupLoading(false);
|
|
85
84
|
});
|
|
86
|
-
}, [
|
|
85
|
+
}, [appId]);
|
|
87
86
|
var queryTags = useCallback(function () {
|
|
88
87
|
setTagLoading(true);
|
|
89
88
|
ajax(Apis.queryAllTags, {
|
|
90
89
|
method: 'post',
|
|
91
90
|
data: {
|
|
92
|
-
appId:
|
|
91
|
+
appId: appId,
|
|
93
92
|
platform: 0
|
|
94
93
|
}
|
|
95
94
|
}).then(function (res) {
|
|
@@ -98,13 +97,13 @@ function useBizStore(_ref) {
|
|
|
98
97
|
}).finally(function () {
|
|
99
98
|
setTagLoading(false);
|
|
100
99
|
});
|
|
101
|
-
}, [
|
|
100
|
+
}, [appId]);
|
|
102
101
|
var loadEvents = useCallback(function () {
|
|
103
102
|
setLoadEvent(true);
|
|
104
103
|
ajax('/zg/web/v2/data/queryEventMetasOfGroup', {
|
|
105
104
|
method: 'post',
|
|
106
105
|
data: {
|
|
107
|
-
appId:
|
|
106
|
+
appId: appId,
|
|
108
107
|
platform: 0,
|
|
109
108
|
isAll: true
|
|
110
109
|
}
|
|
@@ -112,33 +111,33 @@ function useBizStore(_ref) {
|
|
|
112
111
|
setEventGroups(res.data);
|
|
113
112
|
setLoadEvent(false);
|
|
114
113
|
});
|
|
115
|
-
}, [
|
|
114
|
+
}, [appId]);
|
|
116
115
|
var loadUserProps = useCallback(function () {
|
|
117
116
|
setLoadUsers(true);
|
|
118
117
|
ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
|
|
119
118
|
method: 'post',
|
|
120
119
|
data: {
|
|
121
|
-
appId:
|
|
120
|
+
appId: appId,
|
|
122
121
|
platform: 0
|
|
123
122
|
}
|
|
124
123
|
}).then(function (res) {
|
|
125
124
|
setUserProps(res.data);
|
|
126
125
|
setLoadUsers(false);
|
|
127
126
|
});
|
|
128
|
-
}, [
|
|
127
|
+
}, [appId]);
|
|
129
128
|
var loadEnvList = useCallback(function () {
|
|
130
129
|
setLoadEnv(true);
|
|
131
130
|
ajax('/zg/web/v2/appusergroup/getEventEnvData', {
|
|
132
131
|
method: 'post',
|
|
133
132
|
data: {
|
|
134
|
-
appId:
|
|
133
|
+
appId: appId,
|
|
135
134
|
platform: 0
|
|
136
135
|
}
|
|
137
136
|
}).then(function (res) {
|
|
138
137
|
setEnvList(res.data.eventEnv);
|
|
139
138
|
setLoadEnv(false);
|
|
140
139
|
});
|
|
141
|
-
}, [
|
|
140
|
+
}, [appId]);
|
|
142
141
|
useEffect(function () {
|
|
143
142
|
if (loadEnv || loadEvent || loadUsers) return;
|
|
144
143
|
setStore(convertAttributeData({
|
|
@@ -152,13 +151,12 @@ function useBizStore(_ref) {
|
|
|
152
151
|
setUseBizStoreLoading(false);
|
|
153
152
|
}, [loadEvent, loadEnv, loadUsers, groupLoading, tagLoading]);
|
|
154
153
|
useEffect(function () {
|
|
155
|
-
if (!
|
|
154
|
+
if (!appId) return;
|
|
156
155
|
setTimer(function (pre) {
|
|
157
156
|
if (pre) {
|
|
158
157
|
clearTimeout(pre);
|
|
159
158
|
}
|
|
160
159
|
return setTimeout(function () {
|
|
161
|
-
setUseBizStoreLoading(true);
|
|
162
160
|
queryGroups();
|
|
163
161
|
queryTags();
|
|
164
162
|
loadUserProps();
|
|
@@ -166,9 +164,10 @@ function useBizStore(_ref) {
|
|
|
166
164
|
loadEnvList();
|
|
167
165
|
}, 300);
|
|
168
166
|
});
|
|
169
|
-
}, [
|
|
167
|
+
}, [appId]);
|
|
170
168
|
return _objectSpread({
|
|
171
169
|
useBizStoreLoading: useBizStoreLoading,
|
|
170
|
+
setUseBizStoreLoading: setUseBizStoreLoading,
|
|
172
171
|
groupLoading: groupLoading,
|
|
173
172
|
userGroupList: userGroupList,
|
|
174
173
|
tagList: tagList,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.58-ljy.0",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "9e631587e01af190d42323d48d2158f04149afca",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|