Skip to content

Commit

Permalink
Updated to not use a private variable
Browse files Browse the repository at this point in the history
  • Loading branch information
everyplace committed Jun 10, 2024
1 parent bacf744 commit 380d17c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/content/newsletter-automatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ intervention, if there is an available prompt for the current user.


```javascript
// Example library for storing email signups
import {NewsletterPersistence} from './newsletter-persistence.js';
const newsletterCache = new NewsletterPersistence();

// Sample newsletter configuration created by the publisher
const publisherConfiguration = {
name: 'Subscriber Newsletter',
configurationId: '49c12712-9750-4571-8c67-96722561c13a',
};

(self.SWG = self.SWG || []).push(async (subscriptions) => {
// Configure the events logger
const eventManager = await subscriptions.getEventManager();
Expand All @@ -24,8 +34,8 @@ intervention, if there is an available prompt for the current user.
console.log({availableInterventions});

// Return the prompt, if available, for the current configurationId
const prompt = availableInterventions.find(({intervention}) => {
return intervention.configurationId === configurationId;
const prompt = availableInterventions.find(({configurationId}) => {
return configurationId === publisherConfiguration.configurationId;
});

// Show the prompt, if available
Expand Down

0 comments on commit 380d17c

Please sign in to comment.