@playpilot/tpi 8.39.0-beta.2 → 8.39.0-beta.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/package.json
CHANGED
package/src/lib/injection.ts
CHANGED
|
@@ -38,6 +38,7 @@ export function injectLinksInDocument(elements: HTMLElement[], injections: LinkI
|
|
|
38
38
|
injectionIndex++
|
|
39
39
|
|
|
40
40
|
if (injection.type === 'participant' && !injection.manual && !doesParticipantMeetThreshold(mergedInjections, injection.participant_details!)) {
|
|
41
|
+
injection.participant_details.popularity = injection.popularity
|
|
41
42
|
failedMessages[injection.key] = 'Participant does not meet popularity threshold.'
|
|
42
43
|
continue
|
|
43
44
|
}
|
|
@@ -495,7 +496,7 @@ export function doesParticipantMeetThreshold(injections: LinkInjection[], partic
|
|
|
495
496
|
if (useArticleAverage) {
|
|
496
497
|
const averagePopularity = injections
|
|
497
498
|
.filter(i => i.type === 'participant')
|
|
498
|
-
.reduce((total, { participant_details }, _, { length }) => total + (participant_details
|
|
499
|
+
.reduce((total, { participant_details }, _, { length }) => total + (participant_details!.popularity || 0) / length, 0)
|
|
499
500
|
|
|
500
501
|
return participant.popularity >= averagePopularity * (threshold / 100)
|
|
501
502
|
}
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
'API Config': Object.entries(window.PlayPilotLinkInjections.config || {}).map(([label, data]) => ({ label, data })),
|
|
48
48
|
[`Succesful injections (${succesfulInjections.length})`]: succesfulInjections.map(injection => ({ label: injection.title, data: injection.sentence })),
|
|
49
49
|
[`Failed injections (${failedInjections.length})`]: failedInjections.map(injection => ({ label: injection.title, data: `Reason: ${injection.failed_message} | Sentence: ${injection.sentence}` })),
|
|
50
|
-
[`Participant popularity (${participantsInjections.length})`]: participantsInjections.map(injection => ({ label: injection.participant_details!.name, data: injection.participant_details!.popularity || 'Not set' })),
|
|
50
|
+
[`Participant popularity (${participantsInjections.length})`]: participantsInjections.map(injection => ({ label: injection.participant_details!.name, data: injection.popularity || injection.participant_details!.popularity || 'Not set' })),
|
|
51
51
|
[`Fetched ads (${data.ads?.length || 0})`]: data.ads?.map(ad => ({ label: ad.campaign_name, data: ad })),
|
|
52
52
|
[`Tracking events (${data.tracked_events?.length || 0})`]: data.tracked_events?.map(event => ({ label: event.event, data: event.payload })),
|
|
53
53
|
[`Visible pixels (${visiblePixels.length})`]: visiblePixels.map((pixel, index) => ({ label: index + 1, data: pixel.src })),
|