@zgfe/business-lib 1.2.54-ljy-test.1 → 1.2.54-ljy-test.3
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 -14
- 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(props: 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,8 @@ 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
|
|
17
|
+
function useBizStore(props) {
|
|
18
|
+
var appId = props.appId;
|
|
19
19
|
var _useState = useState([]),
|
|
20
20
|
_useState2 = _slicedToArray(_useState, 2),
|
|
21
21
|
userGroupList = _useState2[0],
|
|
@@ -72,7 +72,7 @@ function useBizStore(_ref) {
|
|
|
72
72
|
ajax(Apis.queryUserGroup, {
|
|
73
73
|
method: 'post',
|
|
74
74
|
data: {
|
|
75
|
-
appId:
|
|
75
|
+
appId: appId,
|
|
76
76
|
platform: 0,
|
|
77
77
|
includeDefault: true,
|
|
78
78
|
includeToday: true
|
|
@@ -83,13 +83,13 @@ function useBizStore(_ref) {
|
|
|
83
83
|
}).finally(function () {
|
|
84
84
|
setGroupLoading(false);
|
|
85
85
|
});
|
|
86
|
-
}, [
|
|
86
|
+
}, [appId]);
|
|
87
87
|
var queryTags = useCallback(function () {
|
|
88
88
|
setTagLoading(true);
|
|
89
89
|
ajax(Apis.queryAllTags, {
|
|
90
90
|
method: 'post',
|
|
91
91
|
data: {
|
|
92
|
-
appId:
|
|
92
|
+
appId: appId,
|
|
93
93
|
platform: 0
|
|
94
94
|
}
|
|
95
95
|
}).then(function (res) {
|
|
@@ -98,13 +98,13 @@ function useBizStore(_ref) {
|
|
|
98
98
|
}).finally(function () {
|
|
99
99
|
setTagLoading(false);
|
|
100
100
|
});
|
|
101
|
-
}, [
|
|
101
|
+
}, [appId]);
|
|
102
102
|
var loadEvents = useCallback(function () {
|
|
103
103
|
setLoadEvent(true);
|
|
104
104
|
ajax('/zg/web/v2/data/queryEventMetasOfGroup', {
|
|
105
105
|
method: 'post',
|
|
106
106
|
data: {
|
|
107
|
-
appId:
|
|
107
|
+
appId: appId,
|
|
108
108
|
platform: 0,
|
|
109
109
|
isAll: true
|
|
110
110
|
}
|
|
@@ -112,33 +112,33 @@ function useBizStore(_ref) {
|
|
|
112
112
|
setEventGroups(res.data);
|
|
113
113
|
setLoadEvent(false);
|
|
114
114
|
});
|
|
115
|
-
}, [
|
|
115
|
+
}, [appId]);
|
|
116
116
|
var loadUserProps = useCallback(function () {
|
|
117
117
|
setLoadUsers(true);
|
|
118
118
|
ajax('/zg/web/v2/appusergroup/getUserPropMeta', {
|
|
119
119
|
method: 'post',
|
|
120
120
|
data: {
|
|
121
|
-
appId:
|
|
121
|
+
appId: appId,
|
|
122
122
|
platform: 0
|
|
123
123
|
}
|
|
124
124
|
}).then(function (res) {
|
|
125
125
|
setUserProps(res.data);
|
|
126
126
|
setLoadUsers(false);
|
|
127
127
|
});
|
|
128
|
-
}, [
|
|
128
|
+
}, [appId]);
|
|
129
129
|
var loadEnvList = useCallback(function () {
|
|
130
130
|
setLoadEnv(true);
|
|
131
131
|
ajax('/zg/web/v2/appusergroup/getEventEnvData', {
|
|
132
132
|
method: 'post',
|
|
133
133
|
data: {
|
|
134
|
-
appId:
|
|
134
|
+
appId: appId,
|
|
135
135
|
platform: 0
|
|
136
136
|
}
|
|
137
137
|
}).then(function (res) {
|
|
138
138
|
setEnvList(res.data.eventEnv);
|
|
139
139
|
setLoadEnv(false);
|
|
140
140
|
});
|
|
141
|
-
}, [
|
|
141
|
+
}, [appId]);
|
|
142
142
|
useEffect(function () {
|
|
143
143
|
if (loadEnv || loadEvent || loadUsers) return;
|
|
144
144
|
setStore(convertAttributeData({
|
|
@@ -152,7 +152,7 @@ function useBizStore(_ref) {
|
|
|
152
152
|
setUseBizStoreLoading(false);
|
|
153
153
|
}, [loadEvent, loadEnv, loadUsers, groupLoading, tagLoading]);
|
|
154
154
|
useEffect(function () {
|
|
155
|
-
if (!
|
|
155
|
+
if (!appId) return;
|
|
156
156
|
setTimer(function (pre) {
|
|
157
157
|
if (pre) {
|
|
158
158
|
clearTimeout(pre);
|
|
@@ -165,9 +165,10 @@ function useBizStore(_ref) {
|
|
|
165
165
|
loadEnvList();
|
|
166
166
|
}, 300);
|
|
167
167
|
});
|
|
168
|
-
}, [
|
|
168
|
+
}, [appId]);
|
|
169
169
|
return _objectSpread({
|
|
170
170
|
useBizStoreLoading: useBizStoreLoading,
|
|
171
|
+
setUseBizStoreLoading: setUseBizStoreLoading,
|
|
171
172
|
groupLoading: groupLoading,
|
|
172
173
|
userGroupList: userGroupList,
|
|
173
174
|
tagList: tagList,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.54-ljy-test.
|
|
3
|
+
"version": "1.2.54-ljy-test.3",
|
|
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": "ecc905332ea21b6c069770ff5a27ae20583c95ca",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|