Skip to content

Commit

Permalink
v1.27.0
Browse files Browse the repository at this point in the history
### Features
- Consumer Authentication support was added for the Sandbox environment. (#996)
- The existing `image` formatter was updated to support photos sent from the Streams API. (#998)
- Support for Direct Answers on Vertical was added to the `vertical-standard` template. It is commented out by default. (#994)

### Changes
- To better support Consumer Authentication, the `AnswersExperience.init()` method can be called on `Document` load. (#995)
- The default `universalLimit` for all Vertical page configs was updated to 4. (#1010, #1021)

### Bugfixes
- Ensured that in all page templates, the `SpellCheck` appears above the `ResultsCount`. (#1011, #1017)
- In the `highlightedField` formatter, any HTML tag that appears in the text, that is not `<mark>` or `</mark>`, is now escaped. (#1012)
- Font pre-loads on Multi-lang sites now work correctly. (#1018)
- A new CSS variable was added: `--yxt-filter-options-option-label-line-height`. This variable, when kept in proper proportion to `--yxt-filters-and-sorts-font-size`, will ensure the scroll bar does not erroneously appear for filter options. (#1015, #1019)
  • Loading branch information
tmeyer2115 committed Jan 11, 2022
1 parent 5a153fe commit 7f9eeac
Show file tree
Hide file tree
Showing 52 changed files with 821 additions and 852 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/version-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Update package version for release & hotfix branches

on:
push:
branches: [release/*, hotfix/*]

permissions:
contents: write
pull-requests: write

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: update package version
id: vars
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
PACKAGE_VERSION="${GITHUB_REF##*/}"
echo ::set-output name=branch::${BRANCH_NAME}
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
then
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+$ ]]
then
PACKAGE_VERSION="${PACKAGE_VERSION}.0"
fi
echo ::set-output name=version::${PACKAGE_VERSION}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
if npm version ${PACKAGE_VERSION} | tee >( grep -q 'npm ERR! Version not changed' )
then
echo "Package version is already in sync with branch name."
echo ::set-output name=should_create_pr::0
exit 0
fi
echo ::set-output name=should_create_pr::1
git push -u origin HEAD:"dev/update-version-${PACKAGE_VERSION}"
else
echo "Branch name ${BRANCH_NAME} does not have the correct format with package version."
exit 1
fi
- name: create version update pr
if: steps.vars.outputs.should_create_pr == 1
uses: repo-sync/pull-request@v2
with:
source_branch: "dev/update-version-${{ steps.vars.outputs.version }}"
destination_branch: "${{ steps.vars.outputs.branch }}"
pr_title: "Update Package Version to ${{ steps.vars.outputs.version }}"
pr_body: "*An automated PR which updates the version number in package.json and package-lock.json files*"
github_token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions directanswercards/card_component.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ BaseDirectAnswerCard["{{componentName}}"] = class extends ANSWERS.Component {
setState(data) {
let cardData = this.dataForRender(this.type, this.answer, this.relatedItem, this.snippet);
this.validateDataForRender(cardData);

return super.setState({
...cardData,
searcher: data.searcher,
feedbackEnabled: ANSWERS.getAnalyticsOptIn(),
feedbackSubmitted: data.feedbackSubmitted,
isArray: Array.isArray(this.answer.value),
Expand Down Expand Up @@ -97,7 +97,7 @@ BaseDirectAnswerCard["{{componentName}}"] = class extends ANSWERS.Component {
.addOptions({
directAnswer: true,
verticalKey: this.verticalConfigId,
searcher: 'UNIVERSAL',
searcher: this.getState('searcher'),
entityId: this.associatedEntityId
});

Expand All @@ -120,7 +120,7 @@ BaseDirectAnswerCard["{{componentName}}"] = class extends ANSWERS.Component {
*/
addDefaultEventOptions(eventOptions = {}) {
return Object.assign({}, {
searcher: "UNIVERSAL",
searcher: this.getState('searcher'),
verticalConfigId: this.verticalConfigId,
entityId: this.associatedEntityId,
...eventOptions
Expand All @@ -144,7 +144,7 @@ BaseDirectAnswerCard["{{componentName}}"] = class extends ANSWERS.Component {
verticalKey: this.verticalConfigId,
directAnswer: true,
fieldName: this.answer.fieldApiName,
searcher: 'UNIVERSAL',
searcher: this.getState('searcher'),
entityId: this.associatedEntityId,
url: event.target.href
};
Expand Down
1 change: 1 addition & 0 deletions global_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// "token": "<REPLACE ME>", // The auth token to access Answers experience.
// "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
// "environment": "production", // The environment to run on for this Answers Experience. (i.e. 'production' or 'sandbox')
// "businessId": "<REPLACE ME>", // The business ID of the account. This will be provided automatically by the Yext CI system
// "initializeManually": true, // If true, the experience must be started by calling AnswersExperience.init() or AnswersExperienceFrame.init() for iframe integrations.
// "useJWT": true, // Whether or not to enable JWT. If true, the apiKey will be hidden from the build output and the token must be specified through manual initialization.
Expand Down
27 changes: 27 additions & 0 deletions hbshelpers/getDefaultUniversalLimit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* Generates a default result limit for each vertical on the universal page. The
* default is taken from the vertical's `universalLimit`, specified in the related
* page's VTC. If there is no such `universalLimit`, the back-end default of 10 will
* be used.
*
* @param {Object} pageConfigs - The configurations for each page.
* @returns {Object} The partial of the search configuration related to universal limits.
*/
module.exports = function getDefaultUniversalLimit(pageConfigs) {
const universalLimit = Object.entries(pageConfigs)
.filter(([pageName, _]) => pageName != 'index')
.reduce((limit, [_, pageConfig]) => {
const verticalKey = pageConfig.verticalKey;
const hasUniversalLimit =
pageConfig.verticalsToConfig &&
pageConfig.verticalsToConfig[verticalKey] &&
pageConfig.verticalsToConfig[verticalKey].universalLimit;
if (hasUniversalLimit) {
limit[verticalKey] = pageConfig.verticalsToConfig[verticalKey].universalLimit;
}

return limit;
}, {});

return { universalLimit };
}
15 changes: 15 additions & 0 deletions hbshelpers/wrapJsPartial.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* This is a block helper for injecting inline JS using handlebars.
*
* First, it wraps the statement in an iife to prevent namespacing issues.
*
* Then, it adds an extra new line to the end of the iife.
* This is necesssary because handlebars removes the first new line it sees after a partial invocation,
* which can result in certain js parsing issues, for example if the last line of the partial is a
* single line js comment, the line immediately after the partial will be included in the comment.
*
* @param {import('handlebars').HelperOptions} opts
*/
module.exports = function wrapJsPartial(opts) {
return `(() => { \n${opts.fn()}\n })()\n`;
}
11 changes: 9 additions & 2 deletions layouts/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
if (window.name == 'overlay') {
window.isOverlay = true;
}
{{> script/translations}}
{{#wrapJsPartial}}
{{> script/translations}}
{{/wrapJsPartial}}
{{/babel}}
</script>
{{> layouts/headincludes }}
Expand Down Expand Up @@ -72,10 +74,15 @@
<script>
{{#babel}}
document.addEventListener('DOMContentLoaded', () => {
{{> script/on-document-load}}
{{#if global_config.initializeManually}}
new HitchhikerJS.ManualInitializer(initAnswers).setup();
{{#wrapJsPartial}}
{{> script/on-document-load}}
{{/wrapJsPartial}}
{{else}}
{{#wrapJsPartial}}
{{> script/on-document-load}}
{{/wrapJsPartial}}
initAnswers();
{{/if}}
});
Expand Down
8 changes: 4 additions & 4 deletions layouts/preload-fonts.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Preload the SourceSans fonts used by default in the Theme -->
<link rel="preload" as="font" href="{{relativePath}}/static/assets/fonts/source-sans-pro-v14-latin-300.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/static/assets/fonts/source-sans-pro-v14-latin-600.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/static/assets/fonts/source-sans-pro-v14-latin-700.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/static/assets/fonts/source-sans-pro-v14-latin-regular.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/source-sans-pro-v14-latin-300.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/source-sans-pro-v14-latin-600.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/source-sans-pro-v14-latin-700.woff" type="font/woff" crossorigin="anonymous">
<link rel="preload" as="font" href="{{relativePath}}/source-sans-pro-v14-latin-regular.woff" type="font/woff" crossorigin="anonymous">
Loading

0 comments on commit 7f9eeac

Please sign in to comment.