Skip to content

Commit

Permalink
Merge 4320780 into ba45252
Browse files Browse the repository at this point in the history
  • Loading branch information
cea2aj committed Jun 23, 2021
2 parents ba45252 + 4320780 commit 0d2fbdf
Show file tree
Hide file tree
Showing 279 changed files with 4,101 additions and 2,963 deletions.
2 changes: 1 addition & 1 deletion .github/run_browserstack_acceptance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export BROWSERSTACK_BUILD_ID="${GITHUB_BRANCH} - ${GITHUB_RUN_ID}"
COMMIT_MSG_TITLE=$(git log -n 1 --pretty=format:%s)
export BROWSERSTACK_TEST_RUN_NAME=$COMMIT_MSG_TITLE

npm run acceptance -- --browsers browserstack:ie@11.0 browserstack:safari
npm run acceptance -- --browsers browserstack:ie@11.0 browserstack:safari browserstack:firefox
4 changes: 2 additions & 2 deletions .github/workflows/acceptance.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: BrowserStack Acceptance Tests
name: Acceptance Tests

on: push

Expand Down Expand Up @@ -31,4 +31,4 @@ jobs:
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Run Acceptance Tests
run: npm run acceptance -- --browsers chrome:headless firefox:headless
run: npm run acceptance -- --browsers chrome:headless
30 changes: 30 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will run our tests, generate an lcov code coverage file,
# and send that coverage to Coveralls

name: Code Coverage

on:
push:
branches-ignore: dev/*
pull_request:

jobs:
Coveralls:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npx jest tests/static/ --coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Answers Hitchhiker Theme

<div>
<a href='https://coveralls.io/github/yext/answers-hitchhiker-theme?branch=master'>
<img src='https://coveralls.io/repos/github/yext/answers-hitchhiker-theme/badge.svg?branch=master' alt='Coverage Status' />
</a>
</div>

A [Jambo](https://github.com/yext/jambo) theme for building Answers experiences.

Additonal resources for integrating Answers can be found at https://hitchhikers.yext.com/.
Expand Down
8 changes: 5 additions & 3 deletions cards/event-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class event_standardCardComponent extends BaseCard['event-standard'] {
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.name, // The header text of the card
url: profile.website, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
titleEventOptions: this.addDefaultEventOptions(),
date: Formatter.bigDate(profile),
subtitle: Formatter.dateRange(profile),
Expand All @@ -32,7 +34,7 @@ class event_standardCardComponent extends BaseCard['event-standard'] {
label: 'RSVP', // The CTA's label
iconName: 'calendar', // The icon to use for the CTA
url: profile.ticketUrl || profile.website, // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
target: linkTarget, // Where the new URL will be opened
eventType: 'RSVP', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand All @@ -42,7 +44,7 @@ class event_standardCardComponent extends BaseCard['event-standard'] {
label: 'Directions',
iconName: 'directions',
url: Formatter.getDirectionsUrl(profile),
target: '_top',
target: linkTarget,
eventType: 'DRIVING_DIRECTIONS',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '',
Expand Down
8 changes: 5 additions & 3 deletions cards/faq-accordion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] {
* @param {Object} profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.question || profile.name, // The header text of the card
// subtitle: '', // The sub-header text of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", "_top") : null, // The text in the body of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card
// If the card's details are longer than a certain character count, you can truncate the
// text. A toggle will be supplied that can show or hide the truncated text.
// showMoreDetails: {
Expand All @@ -29,7 +31,7 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] {
label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label
// iconName: '', // The icon to use for the CTA
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened. To open in a new tab use '_blank'
target: linkTarget, // Where the new URL will be opened. To open in a new tab use '_blank'
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
// Event options for the analytics event fired when this CTA is clicked.
eventOptions: this.addDefaultEventOptions({ /* Add additional options here */ }),
Expand All @@ -40,7 +42,7 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] {
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null,
// iconName: '',
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA),
target: '_top',
target: linkTarget,
eventType: 'CTA_CLICK',
eventOptions: this.addDefaultEventOptions({ /* Add additional options here */ }),
// ariaLabel: '',
Expand Down
8 changes: 5 additions & 3 deletions cards/financial-professional-location/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ class financial_professional_locationCardComponent extends BaseCard['financial-p
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
showOrdinal: true, // Show the map pin number on the card. Only supported for universal search
title: profile.name, // The header text of the card
// subtitle: '', // The sub-header text of the card
url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
titleEventOptions: this.addDefaultEventOptions(),
address: Formatter.address(profile), // The address for the card
details: profile.description, // The text in the body of the card
Expand All @@ -48,7 +50,7 @@ class financial_professional_locationCardComponent extends BaseCard['financial-p
label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label
iconName: 'chevron', // The icon to use for the CTA
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
target: linkTarget, // Where the new URL will be opened
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand All @@ -58,7 +60,7 @@ class financial_professional_locationCardComponent extends BaseCard['financial-p
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null,
iconName: 'chevron',
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA),
target: '_top',
target: linkTarget,
eventType: 'CTA_CLICK',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: ''
Expand Down
2 changes: 1 addition & 1 deletion cards/financial-professional-location/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
href="tel:{{card.phone}}"
data-eventtype="TAP_TO_CALL"
data-eventoptions='{{json card.phoneEventOptions}}'
target="_top">
target={{#if card.target}}"{{card.target}}"{{else}}"_top"{{/if}}>
{{card.phone}}
</a>
</div>
Expand Down
6 changes: 4 additions & 2 deletions cards/job-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class job_standardCardComponent extends BaseCard['job-standard'] {
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.name, // The header text of the card
url: profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
// image: '', // The URL of the image to display on the card
// tagLabel: '', // The label of the displayed image
titleEventOptions: this.addDefaultEventOptions(),
Expand All @@ -33,7 +35,7 @@ class job_standardCardComponent extends BaseCard['job-standard'] {
label: 'Apply Now', // The CTA's label
iconName: 'briefcase', // The icon to use for the CTA
url: profile.applicationUrl || profile.landingPageUrl, // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
target: linkTarget, // Where the new URL will be opened
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand Down
4 changes: 3 additions & 1 deletion cards/link-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class link_standardCardComponent extends BaseCard['link-standard'] {
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.htmlTitle, // The header text of the card
url: profile.link, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
titleEventOptions: this.addDefaultEventOptions(),
// subtitle: '', // The sub-header text of the card
// If the card's details are longer than a certain character count, you can truncate the
Expand Down
8 changes: 5 additions & 3 deletions cards/location-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@ class location_standardCardComponent extends BaseCard['location-standard'] {
* @param {Object} profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.name, // The header text of the card
url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
titleEventOptions: this.addDefaultEventOptions(), // The event options for title click analytics
// subtitle: '', // The sub-header text of the card
hours: Formatter.openStatus(profile),
Expand All @@ -38,7 +40,7 @@ class location_standardCardComponent extends BaseCard['location-standard'] {
label: 'Call', // The label of the CTA
iconName: 'phone', // The icon to use for the CTA
url: Formatter.phoneLink(profile), // The URL a user will be directed to when clicking
target: '_top', // If the URL will be opened in a new tab, etc.
target: linkTarget, // If the URL will be opened in a new tab, etc.
eventType: 'TAP_TO_CALL', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(), // The analytics event options for CTA clicks
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand All @@ -47,7 +49,7 @@ class location_standardCardComponent extends BaseCard['location-standard'] {
label: 'Get Directions',
iconName: 'directions',
url: Formatter.getDirectionsUrl(profile),
target: '_top',
target: linkTarget,
eventType: 'DRIVING_DIRECTIONS',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '',
Expand Down
2 changes: 1 addition & 1 deletion cards/location-standard/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<a class="HitchhikerLocationStandard-phone--mobile js-Hitchhiker-phone" href="tel:{{card.phone}}"
data-eventtype="TAP_TO_CALL"
data-eventoptions='{{json card.phoneEventOptions}}'
target="_top">
target={{#if card.target}}"{{card.target}}"{{else}}"_top"{{/if}}>
{{card.phone}}
</a>
</div>
Expand Down
10 changes: 6 additions & 4 deletions cards/menuitem-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class menuitem_standardCardComponent extends BaseCard['menuitem-standard'] {
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.name, // The header text of the card
url: profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
image: Formatter.image(profile.c_photo).url, // The URL of the image to display on the card
altText: Formatter.image(profile.c_photo).alternateText, // The alternate text for the image
// tagLabel: '', // The label of the displayed image
Expand All @@ -37,8 +39,8 @@ class menuitem_standardCardComponent extends BaseCard['menuitem-standard'] {
CTA1: {
label: 'Order Now', // The CTA's label
iconName: 'chevron', // The icon to use for the CTA
url: profile.orderUrl, // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
url: profile.orderUrl && profile.orderUrl.url, // The URL a user will be directed to when clicking
target: linkTarget, // Where the new URL will be opened
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand All @@ -48,7 +50,7 @@ class menuitem_standardCardComponent extends BaseCard['menuitem-standard'] {
label: 'View Menu',
iconName: 'magnifying_glass',
url: profile.landingPageUrl,
target: '_top',
target: linkTarget,
eventType: 'CTA_CLICK',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '',
Expand Down
8 changes: 5 additions & 3 deletions cards/multilang-event-standard/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class multilang_event_standardCardComponent extends BaseCard['multilang-event-st
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.name, // The header text of the card
url: profile.website, // If the card title is a clickable link, set URL here
target: '_top', // If the title's URL should open in a new tab, etc.
target: linkTarget, // If the title's URL should open in a new tab, etc.
titleEventOptions: this.addDefaultEventOptions(),
date: Formatter.bigDate(profile),
subtitle: Formatter.dateRange(profile),
Expand All @@ -32,7 +34,7 @@ class multilang_event_standardCardComponent extends BaseCard['multilang-event-st
label: {{ translateJS phrase='RSVP' context='RSVP is a verb' }}, // The CTA's label
iconName: 'calendar', // The icon to use for the CTA
url: profile.ticketUrl || profile.website, // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened
target: linkTarget, // Where the new URL will be opened
eventType: 'RSVP', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
Expand All @@ -42,7 +44,7 @@ class multilang_event_standardCardComponent extends BaseCard['multilang-event-st
label: {{ translateJS phrase='Directions' }},
iconName: 'directions',
url: Formatter.getDirectionsUrl(profile),
target: '_top',
target: linkTarget,
eventType: 'DRIVING_DIRECTIONS',
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '',
Expand Down
8 changes: 5 additions & 3 deletions cards/multilang-faq-accordion/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor
* @param {Object} profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';

return {
title: profile.question || profile.name, // The header text of the card
// subtitle: '', // The sub-header text of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", "_top") : null, // The text in the body of the card
details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", linkTarget) : null, // The text in the body of the card
// If the card's details are longer than a certain character count, you can truncate the
// text. A toggle will be supplied that can show or hide the truncated text.
// showMoreDetails: {
Expand All @@ -29,7 +31,7 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor
label: profile.c_primaryCTA ? profile.c_primaryCTA.label : null, // The CTA's label
// iconName: '', // The icon to use for the CTA
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
target: '_top', // Where the new URL will be opened. To open in a new tab use '_blank'
target: linkTarget, // Where the new URL will be opened. To open in a new tab use '_blank'
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
// Event options for the analytics event fired when this CTA is clicked.
eventOptions: this.addDefaultEventOptions({ /* Add additional options here */ }),
Expand All @@ -40,7 +42,7 @@ class multilang_faq_accordionCardComponent extends BaseCard['multilang-faq-accor
label: profile.c_secondaryCTA ? profile.c_secondaryCTA.label : null,
// iconName: '',
url: Formatter.generateCTAFieldTypeLink(profile.c_secondaryCTA),
target: '_top',
target: linkTarget,
eventType: 'CTA_CLICK',
eventOptions: this.addDefaultEventOptions({ /* Add additional options here */ }),
// ariaLabel: '',
Expand Down
Loading

0 comments on commit 0d2fbdf

Please sign in to comment.