From dd89e7839f62f539bb5dddc70e73a7b65f79c581 Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Wed, 13 Oct 2021 11:51:31 -0400 Subject: [PATCH] Fix DA cards feedback analytics (#978) Only show thumbs up/down feedback buttons on direct answer cards when user provides `businessId` and enables analytics. J=SLAP-1175 TEST=manual Smoke testing to check if feedback buttons only appear on DA cards when expected. --- directanswercards/allfields-standard/template.hbs | 4 +++- directanswercards/card_component.js | 1 + directanswercards/documentsearch-standard/template.hbs | 4 +++- directanswercards/multilang-allfields-standard/template.hbs | 4 +++- global_config.json | 2 +- test-site/config/global_config.json | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/directanswercards/allfields-standard/template.hbs b/directanswercards/allfields-standard/template.hbs index bc3210a53..22986058f 100644 --- a/directanswercards/allfields-standard/template.hbs +++ b/directanswercards/allfields-standard/template.hbs @@ -14,7 +14,9 @@ {{> cta CTA linkTarget=linkTarget}} {{/if}} - {{> footer }} + {{#if feedbackEnabled}} + {{> footer }} + {{/if}} {{#*inline 'icon'}} diff --git a/directanswercards/card_component.js b/directanswercards/card_component.js index 851d27e95..c28b340dc 100644 --- a/directanswercards/card_component.js +++ b/directanswercards/card_component.js @@ -26,6 +26,7 @@ BaseDirectAnswerCard["{{componentName}}"] = class extends ANSWERS.Component { return super.setState({ ...cardData, + feedbackEnabled: ANSWERS.getAnalyticsOptIn(), feedbackSubmitted: data.feedbackSubmitted, isArray: Array.isArray(this.answer.value), cardName: `{{componentName}}`, diff --git a/directanswercards/documentsearch-standard/template.hbs b/directanswercards/documentsearch-standard/template.hbs index 028de17c5..24585baac 100644 --- a/directanswercards/documentsearch-standard/template.hbs +++ b/directanswercards/documentsearch-standard/template.hbs @@ -9,7 +9,9 @@ {{> cta CTA linkTarget=linkTarget}} - {{> footer}} + {{#if feedbackEnabled}} + {{> footer }} + {{/if}} {{#*inline 'title'}} diff --git a/directanswercards/multilang-allfields-standard/template.hbs b/directanswercards/multilang-allfields-standard/template.hbs index 025addb96..475b72481 100644 --- a/directanswercards/multilang-allfields-standard/template.hbs +++ b/directanswercards/multilang-allfields-standard/template.hbs @@ -14,7 +14,9 @@ {{> cta CTA linkTarget=linkTarget}} {{/if}} - {{> footer }} + {{#if feedbackEnabled}} + {{> footer }} + {{/if}} {{#*inline 'icon'}} diff --git a/global_config.json b/global_config.json index 1e20400d6..7a37f27ca 100644 --- a/global_config.json +++ b/global_config.json @@ -1,5 +1,5 @@ { - "sdkVersion": "develop", // The version of the Answers SDK to use + "sdkVersion": "release/v1.11", // The version of the Answers SDK to use // "apiKey": "", // The answers api key found on the experiences page. This will be provided automatically by the Yext CI system // "experienceVersion": "", // the Answers Experience version to use for API requests. This will be provided automatically by the Yext CI system // "businessId": "", // The business ID of the account. This will be provided automatically by the Yext CI system diff --git a/test-site/config/global_config.json b/test-site/config/global_config.json index ee59f998f..91bd5f242 100644 --- a/test-site/config/global_config.json +++ b/test-site/config/global_config.json @@ -1,5 +1,5 @@ { - "sdkVersion": "develop", // The version of the Answers SDK to use + "sdkVersion": "release/v1.11", // The version of the Answers SDK to use "apiKey": "2d8c550071a64ea23e263118a2b0680b", // The answers api key found on the experiences page. This will be provided automatically by the Yext CI system // "experienceVersion": "", // the Answers Experience version to use for API requests. This will be provided automatically by the Yext CI system // "businessId": "", // The business ID of the account. This will be provided automatically by the Yext CI system