@plusscommunities/pluss-core-aws 2.0.7-beta.3 → 2.0.7-beta.5
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.
|
@@ -155,6 +155,8 @@ const getEventMatches = async (users, audienceTypeSelection) => {
|
|
|
155
155
|
* @param {string} audienceType - The type of audience to retrieve.
|
|
156
156
|
* @param {string | Array} audienceTypeSelection - The selection criteria for the audience.
|
|
157
157
|
* @param {boolean} [preview=true] - Indicates whether to retrieve a preview of the users in the audience.
|
|
158
|
+
* @param {boolean} [includeType=true] - Indicates whether to include the user type in the preview.
|
|
159
|
+
* @param {boolean} [includeSite=true] - Indicates whether to include the site in the preview.
|
|
158
160
|
* @returns {Array} - The audience that matches the specified criteria.
|
|
159
161
|
*/
|
|
160
162
|
module.exports = async (
|
|
@@ -171,44 +173,57 @@ module.exports = async (
|
|
|
171
173
|
_.filter(userData, (u) => !u.Deleted),
|
|
172
174
|
(u) => {
|
|
173
175
|
return preview
|
|
174
|
-
? userToUserPreview(u,
|
|
176
|
+
? userToUserPreview(u, true, true)
|
|
175
177
|
: { id: u.Id || u.userId, ...u };
|
|
176
178
|
}
|
|
177
179
|
);
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
180
|
+
result = users;
|
|
181
|
+
if (audienceType) {
|
|
182
|
+
switch (audienceType) {
|
|
183
|
+
case "All":
|
|
184
|
+
break;
|
|
185
|
+
case "Custom":
|
|
186
|
+
const categoryMatches = await getCategoryMatches(
|
|
187
|
+
users,
|
|
188
|
+
audienceTypeSelection,
|
|
189
|
+
site
|
|
190
|
+
);
|
|
191
|
+
const typeMatches = getTypeMatches(users, audienceTypeSelection);
|
|
192
|
+
const tagMatches = await getTagMatches(
|
|
193
|
+
users,
|
|
194
|
+
audienceTypeSelection,
|
|
195
|
+
site
|
|
196
|
+
);
|
|
197
|
+
const eventMatches = await getEventMatches(
|
|
198
|
+
users,
|
|
199
|
+
audienceTypeSelection
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
// console.log("categoryMatches", categoryMatches);
|
|
203
|
+
// console.log("typeMatches", typeMatches);
|
|
204
|
+
// console.log("tagMatches", tagMatches);
|
|
205
|
+
result = _.unionBy(
|
|
206
|
+
categoryMatches,
|
|
207
|
+
typeMatches,
|
|
208
|
+
tagMatches,
|
|
209
|
+
eventMatches,
|
|
210
|
+
"id"
|
|
211
|
+
);
|
|
212
|
+
break;
|
|
213
|
+
case "EventAudience":
|
|
214
|
+
result = await getEventMatches(users, audienceTypeSelection);
|
|
215
|
+
break;
|
|
216
|
+
case "Category":
|
|
217
|
+
result = await getCategoryMatches(users, audienceTypeSelection, site);
|
|
218
|
+
break;
|
|
219
|
+
case "UserType":
|
|
220
|
+
result = getTypeMatches(users, audienceTypeSelection);
|
|
221
|
+
break;
|
|
222
|
+
default:
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
213
225
|
}
|
|
226
|
+
return result.map((user) => {
|
|
227
|
+
return userToUserPreview(user, includeType, includeSite);
|
|
228
|
+
});
|
|
214
229
|
};
|
|
@@ -20,7 +20,14 @@ module.exports = async (site, permissions) => {
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
log("getUsersByPermission", "audienceMatches", audienceMatches, logId);
|
|
23
|
-
const audience = await getAudience(
|
|
23
|
+
const audience = await getAudience(
|
|
24
|
+
site,
|
|
25
|
+
"Custom",
|
|
26
|
+
audienceMatches,
|
|
27
|
+
true,
|
|
28
|
+
false,
|
|
29
|
+
false
|
|
30
|
+
);
|
|
24
31
|
log("getUsersByPermission", "audienceLength", audience.length, logId);
|
|
25
32
|
|
|
26
33
|
return audience;
|
package/package.json
CHANGED