From 0ad157dae1ddf9ea5fe765dee79d970d05b48b4d Mon Sep 17 00:00:00 2001 From: kailasnadh790 <53608019+kailasnadh790@users.noreply.github.com> Date: Wed, 20 Dec 2023 08:35:41 -0500 Subject: [PATCH 1/3] complete --- cigaradvisor/blocks/contest-form/contest-form.css | 8 ++++++++ cigaradvisor/blocks/contest-form/contest-form.js | 12 ++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 cigaradvisor/blocks/contest-form/contest-form.css create mode 100644 cigaradvisor/blocks/contest-form/contest-form.js diff --git a/cigaradvisor/blocks/contest-form/contest-form.css b/cigaradvisor/blocks/contest-form/contest-form.css new file mode 100644 index 00000000..30c75904 --- /dev/null +++ b/cigaradvisor/blocks/contest-form/contest-form.css @@ -0,0 +1,8 @@ +.section.contest-form-container{ + padding-left: 0; + padding-right: 0; + width: 100%; + margin-left: auto; + margin-right: auto; + max-width: 1080px; +} \ No newline at end of file diff --git a/cigaradvisor/blocks/contest-form/contest-form.js b/cigaradvisor/blocks/contest-form/contest-form.js new file mode 100644 index 00000000..8d460779 --- /dev/null +++ b/cigaradvisor/blocks/contest-form/contest-form.js @@ -0,0 +1,12 @@ +export default async function decorate(block) { + const iframeWrapper = document.createElement('div'); + iframeWrapper.id = 'vsscript_148868_314195'; + block.replaceChildren(iframeWrapper); + const p = document.createElement('p'); + const script = document.createElement('script'); + script.async = true; + script.type = 'text/javascript'; + script.src = 'https://app.viralsweep.com/vsa-widget-bedfd7-148868.js?sid=148868_314195'; + p.appendChild(script); + block.appendChild(p); +} From f5bc4838a1334c64557fcba04f7fd3a61bcd9cda Mon Sep 17 00:00:00 2001 From: kailasnadh790 <53608019+kailasnadh790@users.noreply.github.com> Date: Wed, 20 Dec 2023 09:25:20 -0500 Subject: [PATCH 2/3] Update contest-form.js --- cigaradvisor/blocks/contest-form/contest-form.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cigaradvisor/blocks/contest-form/contest-form.js b/cigaradvisor/blocks/contest-form/contest-form.js index 8d460779..f7ee39a6 100644 --- a/cigaradvisor/blocks/contest-form/contest-form.js +++ b/cigaradvisor/blocks/contest-form/contest-form.js @@ -3,10 +3,13 @@ export default async function decorate(block) { iframeWrapper.id = 'vsscript_148868_314195'; block.replaceChildren(iframeWrapper); const p = document.createElement('p'); - const script = document.createElement('script'); - script.async = true; - script.type = 'text/javascript'; - script.src = 'https://app.viralsweep.com/vsa-widget-bedfd7-148868.js?sid=148868_314195'; - p.appendChild(script); + function loadScript() { + const script = document.createElement('script'); + script.async = true; + script.type = 'text/javascript'; + script.src = 'https://app.viralsweep.com/vsa-widget-bedfd7-148868.js?sid=148868_314195'; + p.appendChild(script); + } block.appendChild(p); + setTimeout(loadScript, 3000); } From 2bce1824a96ac9b7af952653cd6da0f7890b3fa1 Mon Sep 17 00:00:00 2001 From: kailasnadh790 <53608019+kailasnadh790@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:11:41 -0500 Subject: [PATCH 3/3] Update contest-form.js review comments --- cigaradvisor/blocks/contest-form/contest-form.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cigaradvisor/blocks/contest-form/contest-form.js b/cigaradvisor/blocks/contest-form/contest-form.js index f7ee39a6..e2afdf56 100644 --- a/cigaradvisor/blocks/contest-form/contest-form.js +++ b/cigaradvisor/blocks/contest-form/contest-form.js @@ -1,13 +1,16 @@ +import { readBlockConfig } from '../../scripts/aem.js'; + export default async function decorate(block) { + const config = readBlockConfig(block); const iframeWrapper = document.createElement('div'); - iframeWrapper.id = 'vsscript_148868_314195'; + iframeWrapper.id = config.formid; block.replaceChildren(iframeWrapper); const p = document.createElement('p'); function loadScript() { const script = document.createElement('script'); script.async = true; script.type = 'text/javascript'; - script.src = 'https://app.viralsweep.com/vsa-widget-bedfd7-148868.js?sid=148868_314195'; + script.src = config.formurl; p.appendChild(script); } block.appendChild(p);