From 380d17c0e817b8eacaf29f2b952512e2a950f22b Mon Sep 17 00:00:00 2001 From: Erin Sparling Date: Mon, 10 Jun 2024 14:35:06 +0000 Subject: [PATCH] Updated to not use a private variable --- app/content/newsletter-automatic.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/content/newsletter-automatic.md b/app/content/newsletter-automatic.md index 88f7c27..9e3d464 100644 --- a/app/content/newsletter-automatic.md +++ b/app/content/newsletter-automatic.md @@ -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(); @@ -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