Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.25.0 #979

Merged
merged 27 commits into from
Oct 13, 2021
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
35bfa38
Merge master (v1.24.0) into develop (#953)
cea2aj Sep 14, 2021
b80ba4c
Fix google maps InvalidValueError in theme (#955)
yen-tt Sep 16, 2021
299baa2
avoid results render on locator map view (#954)
yen-tt Sep 17, 2021
351737c
remove unused file (#956)
yen-tt Sep 20, 2021
d4c6755
Distance formatter to include locale with region (#957)
yen-tt Sep 23, 2021
80cc081
Automate PR from master to develp (#959)
yen-tt Sep 24, 2021
51fefaf
Merge branch 'master' into develop
oshi97 Sep 28, 2021
b98b549
dont hide ANSWERS.onReady errors (#964)
oshi97 Oct 4, 2021
092a19f
Update vertical-grid config (#965)
nmanu1 Oct 4, 2021
350ca68
add apiKey validation when using injected data and useJWT=false (#962)
oshi97 Oct 4, 2021
4eda44d
Comment out vertical icons (#967)
cea2aj Oct 7, 2021
306e3ab
add sorting facets by optionsOrder (#968)
oshi97 Oct 8, 2021
d9bf111
Add visitor support (#970)
nmanu1 Oct 11, 2021
c288da5
handle different optionsFieldType (#971)
oshi97 Oct 11, 2021
d3d591b
Add generic thumbs up/down (#973)
nmanu1 Oct 12, 2021
9780194
support sorting facets using optionsOrderList (#972)
oshi97 Oct 12, 2021
0e63ede
remove optionsFieldType (#974)
oshi97 Oct 12, 2021
c96c5f1
Use color-text-primary for card body text (#966)
cea2aj Oct 12, 2021
646c166
Fix feedback analytics (#975)
nmanu1 Oct 12, 2021
373774d
Revert "Add visitor support (#970)"
tmeyer2115 Oct 13, 2021
c4df598
Merge pull request #977 from yext/revert-970-dev/visitor-support
tmeyer2115 Oct 13, 2021
f7a18e6
Update version to v1.25.
tmeyer2115 Oct 13, 2021
63c1833
Revert "Fix feedback analytics (#975)"
nmanu1 Oct 13, 2021
de779cd
Revert "Add generic thumbs up/down (#973)"
nmanu1 Oct 13, 2021
dd89e78
Fix DA cards feedback analytics (#978)
nmanu1 Oct 13, 2021
0e31bd3
Revert 'Fix google maps InvalidValueError in theme' (#981)
cea2aj Oct 13, 2021
6bd66b8
Update to Jambo v1.12.1 and SDK v1.11 (#980)
cea2aj Oct 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/sync_develop_and_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: create PR from main to develop

on:
push:
branches: [main, master]

permissions:
contents: read
pull-requests: write

jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: extract package version
id: vars
run: |
PACKAGE_VERSION="v$(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')"
echo ::set-output name=tag::${PACKAGE_VERSION}
- uses: repo-sync/pull-request@v2
with:
source_branch: "${{ github.event.repository.default_branch }}"
destination_branch: "develop"
pr_title: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
pr_body: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
github_token: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion directanswercards/allfields-standard/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
{{> cta CTA linkTarget=linkTarget}}
</div>
{{/if}}
{{> footer }}
{{#if feedbackEnabled}}
{{> footer }}
{{/if}}
</div>

{{#*inline 'icon'}}
Expand Down
1 change: 1 addition & 0 deletions directanswercards/card_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}}`,
Expand Down
4 changes: 3 additions & 1 deletion directanswercards/documentsearch-standard/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
{{> cta CTA linkTarget=linkTarget}}
</div>
</div>
{{> footer}}
{{#if feedbackEnabled}}
{{> footer }}
{{/if}}
</div>

{{#*inline 'title'}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
{{> cta CTA linkTarget=linkTarget}}
</div>
{{/if}}
{{> footer }}
{{#if feedbackEnabled}}
{{> footer }}
{{/if}}
</div>

{{#*inline 'icon'}}
Expand Down
2 changes: 1 addition & 1 deletion global_config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdkVersion": "1.10", // The version of the Answers SDK to use
"sdkVersion": "release/v1.11", // The version of the Answers SDK to use
// "apiKey": "<REPLACE ME>", // The answers api key found on the experiences page. This will be provided automatically by the Yext CI system
// "experienceVersion": "<REPLACE ME>", // the Answers Experience version to use for API requests. This will be provided automatically by the Yext CI system
// "businessId": "<REPLACE ME>", // The business ID of the account. This will be provided automatically by the Yext CI system
Expand Down
46 changes: 42 additions & 4 deletions hooks/templatedatavalidator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const path = require('path');
const { parseJamboConfig } = require('../commands/helpers/utils/jamboconfigutils');
const { error } = require('../commands/helpers/utils/logger');
const { error, warn } = require('../commands/helpers/utils/logger');

/**
* Validates the template data and partials used during jambo build.
Expand All @@ -13,8 +13,9 @@ const { error } = require('../commands/helpers/utils/logger');
*/
module.exports = function (pageData, partials) {
const jamboConfig = parseJamboConfig();
const { JAMBO_INJECTED_DATA } = pageData.env;
const validatorResults = [
isGlobalConfigValid(pageData.global_config),
isGlobalConfigValid(pageData.global_config, JAMBO_INJECTED_DATA),
isPageVerticalConfigValid(pageData, jamboConfig, partials)
];
const isValid = validatorResults.every(result => result);
Expand All @@ -25,13 +26,50 @@ module.exports = function (pageData, partials) {
* Validates global config for the page template
*
* @param {Object} globalConfig
* @param {Object} JAMBO_INJECTED_DATA
* @returns {boolean}
*/
function isGlobalConfigValid(globalConfig) {
if (!globalConfig.experienceKey) {
function isGlobalConfigValid(globalConfig, JAMBO_INJECTED_DATA) {
const { experienceKey } = globalConfig;
if (!experienceKey) {
error('Missing Info: no experienceKey found.');
return false;
}
if (globalConfig.useJWT || globalConfig.apiKey) {
return true;
}

const injectedDataForExperience = JAMBO_INJECTED_DATA.answers.experiences[experienceKey];
if (!injectedDataForExperience) {
error(`No JAMBO_INJECTED_DATA found for experience key: "${experienceKey}"`);
error(`Found JAMBO_INJECTED_DATA: "${JSON.stringify(JAMBO_INJECTED_DATA, null, 2)}.`);
return false;
}

const productionApiKey = injectedDataForExperience.configByLabel.PRODUCTION.apiKey;
const deprecatedApiKey = injectedDataForExperience.apiKey;
if (!productionApiKey) {
if (!deprecatedApiKey) {
error(`No injected production api key found for experience key: "${experienceKey}"`);
} else {
warn('No injected production api key found, using the default apiKey instead.');
}
}

const stagingApiKey = injectedDataForExperience.configByLabel.STAGING.apiKey;
if (!stagingApiKey) {
if (!deprecatedApiKey) {
error(`No injected staging api key found for experience key: "${experienceKey}"`);
} else {
warn('No injected staging api key found, using the default apiKey instead.');
}
}

if ((!productionApiKey || !stagingApiKey) && !deprecatedApiKey) {
error(`JAMBO_INJECTED_DATA is missing an api key.`);
error(`Found JAMBO_INJECTED_DATA: "${JSON.stringify(JAMBO_INJECTED_DATA, null, 2)}.`);
return false;
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "answers-hitchhiker-theme",
"version": "1.24.1",
"version": "1.25.0",
"description": "A starter answers theme for hitchhikers",
"scripts": {
"test": "cross-env NODE_ICU_DATA=node_modules/full-icu jest --verbose",
Expand Down
1 change: 1 addition & 0 deletions script/core.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
});
}
}).catch(err => {
console.error(err);
window.AnswersExperience.AnswersInitializedPromise.reject('Answers failed to initialized.');
});
{{> script/after-init}}
Expand Down
18 changes: 11 additions & 7 deletions static/js/formatters-internal.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,19 @@ export function toLocalizedDistance(profile, key = 'd_distance', displayUnits) {
return this.toMiles(profile, undefined, undefined, locale);
}

export function _getLocaleWithDashes(locale) {
return locale && locale.replace(/_/g, '-');
}

export function _getDocumentLocale() {
return document.documentElement.lang.replace('_', '-');
return _getLocaleWithDashes(document.documentElement.lang);
}

export function toKilometers(profile, key = 'd_distance', displayUnits = 'km', locale) {
if (!profile[key]) {
return '';
}
locale = locale || _getDocumentLocale()
locale = _getLocaleWithDashes(locale) || _getDocumentLocale();
const distanceInKilometers = profile[key] / 1000; // Convert meters to kilometers
return new Intl.NumberFormat(locale,
{ style: 'decimal', maximumFractionDigits: 1, minimumFractionDigits: 1})
Expand All @@ -101,7 +105,7 @@ export function toMiles(profile, key = 'd_distance', displayUnits = 'mi', locale
if (!profile[key]) {
return '';
}
locale = locale || _getDocumentLocale()
locale = _getLocaleWithDashes(locale) || _getDocumentLocale();
const distanceInMiles = profile[key] / 1609.344; // Convert meters to miles
return new Intl.NumberFormat(locale,
{ style: 'decimal', maximumFractionDigits: 1, minimumFractionDigits: 1 })
Expand Down Expand Up @@ -234,7 +238,7 @@ export function snakeToTitle(snake) {
* @returns {string} The pretty printed value.
*/
export function prettyPrintObject(obj, locale) {
locale = locale || _getDocumentLocale();
locale = _getLocaleWithDashes(locale) || _getDocumentLocale();

switch (typeof obj) {
case 'string':
Expand Down Expand Up @@ -459,7 +463,7 @@ export function openStatus(profile, key = 'hours', isTwentyFourHourClock, locale
}

const hoursLocalizer = new HoursStringsLocalizer(
locale || _getDocumentLocale(), isTwentyFourHourClock);
_getLocaleWithDashes(locale) || _getDocumentLocale(), isTwentyFourHourClock);
return new OpenStatusMessageFactory(hoursLocalizer)
.create(hours.openStatus);
}
Expand Down Expand Up @@ -501,7 +505,7 @@ export function hoursList(profile, opts = {}, key = 'hours', locale) {
};

const hoursLocalizer = new HoursStringsLocalizer(
locale || _getDocumentLocale(), opts.isTwentyFourHourClock);
_getLocaleWithDashes(locale) || _getDocumentLocale(), opts.isTwentyFourHourClock);
return new HoursTableBuilder(hoursLocalizer).build(hours, standardizedOpts);
}

Expand All @@ -515,7 +519,7 @@ export { generateCTAFieldTypeLink };
* returns the price value without formatting
*/
export function price(fieldValue = {}, locale) {
const localeForFormatting = locale || _getDocumentLocale() || 'en';
const localeForFormatting = _getLocaleWithDashes(locale) || _getDocumentLocale() || 'en';
const price = fieldValue.value && parseFloat(fieldValue.value);
const currencyCode = fieldValue.currencyCode && fieldValue.currencyCode.split('-')[0];
if (!price || isNaN(price) || !currencyCode) {
Expand Down
89 changes: 0 additions & 89 deletions static/js/theme-map/Util/GeoSearchFormBinder.js

This file was deleted.

Loading