From 38233b6dbd22eb0bb872e6db7f84b24a001054f4 Mon Sep 17 00:00:00 2001 From: Oliver Shi Date: Tue, 8 Feb 2022 13:30:36 -0500 Subject: [PATCH 01/17] update testcafe to 1.18.3 from 1.17.1 (#1045) J=NONE --- package-lock.json | 606 +++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 515 insertions(+), 93 deletions(-) diff --git a/package-lock.json b/package-lock.json index 34ce9f004..c33087177 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "answers-hitchhiker-theme", - "version": "1.27.0", + "version": "1.28.0", "devDependencies": { "@axe-core/puppeteer": "^4.3.1", "@babel/core": "^7.9.6", @@ -34,7 +34,7 @@ "puppeteer": "^10.2.0", "serve": "^11.3.2", "simple-git": "^2.24.0", - "testcafe": "^1.17.1", + "testcafe": "^1.18.3", "testcafe-browser-provider-browserstack": "^1.13.1", "underscore.string": "^3.3.5", "urijs": "1.18.12", @@ -6111,6 +6111,12 @@ "node": ">=0.4.0" } }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=", + "dev": true + }, "node_modules/buffer-fill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", @@ -7396,6 +7402,15 @@ "safer-buffer": "^2.1.0" } }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -7529,6 +7544,12 @@ "stackframe": "^0.3.1" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -8277,6 +8298,12 @@ "node": ">= 0.6" } }, + "node_modules/fp-ts": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.8.tgz", + "integrity": "sha512-WQT6rP6Jt3TxMdQB3IKzvfZKLuldumntgumLhIUhvPrukTHdWNI4JgEHY04Bd0LIOR9IQRpB+7RuxgUU0Vhmcg==", + "dev": true + }, "node_modules/fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -9204,6 +9231,27 @@ "loose-envify": "^1.0.0" } }, + "node_modules/io-ts": { + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.16.tgz", + "integrity": "sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.5.0" + } + }, + "node_modules/io-ts-types": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/io-ts-types/-/io-ts-types-0.5.16.tgz", + "integrity": "sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.0.0", + "io-ts": "^2.0.0", + "monocle-ts": "^2.0.0", + "newtype-ts": "^0.3.2" + } + }, "node_modules/ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -9545,6 +9593,16 @@ "node": ">=0.10.0" } }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dev": true, + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -10627,6 +10685,37 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "dev": true, + "dependencies": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=4", + "npm": ">=1.4.28" + } + }, + "node_modules/jsonwebtoken/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -10642,6 +10731,27 @@ "verror": "1.10.0" } }, + "node_modules/jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "dependencies": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "dependencies": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -10829,6 +10939,48 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=", + "dev": true + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=", + "dev": true + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=", + "dev": true + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=", + "dev": true + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=", + "dev": true + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=", + "dev": true + }, "node_modules/lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -11232,6 +11384,15 @@ "integrity": "sha512-KhKZRH21/+ihNRWrmdNFOyBptFi7nAWZFeFsRRpXkzgk/Yublb4fxyP0jU6EY1VDxUL/VUPdCmm/wAnpbfXdfw==", "dev": true }, + "node_modules/monocle-ts": { + "version": "2.3.12", + "resolved": "https://registry.npmjs.org/monocle-ts/-/monocle-ts-2.3.12.tgz", + "integrity": "sha512-mf753m69aRNApcL2KCKfLRwfWbraeqQfRRgm3a8D+5lvkhCcMtVp8/vnM04Cmhsd6YXJeInMeQFFETrd7jWYww==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.5.0" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -11251,9 +11412,9 @@ } }, "node_modules/nanoid": { - "version": "3.1.20", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", - "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "dev": true, "bin": { "nanoid": "bin/nanoid.cjs" @@ -11305,6 +11466,16 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "node_modules/newtype-ts": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/newtype-ts/-/newtype-ts-0.3.5.tgz", + "integrity": "sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==", + "dev": true, + "peerDependencies": { + "fp-ts": "^2.0.0", + "monocle-ts": "^2.0.0" + } + }, "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -14071,9 +14242,9 @@ } }, "node_modules/testcafe": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.17.1.tgz", - "integrity": "sha512-G+IqL28PE9wzNKcLjLCjX3z3/KXpzNs0FNC63Y7dXcXx23qlx+yz+Abyh91CIzeiwtXDZX+xMXDYYLtPQLfhlQ==", + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.3.tgz", + "integrity": "sha512-cBWPBmY20xI9iWQzS9s2t3oIYhXl5gJzM6CTQjLXt5CMAEvWThsOzLWWnNoA2nk4CLBexZ0S5SkrYOk/SGVSaw==", "dev": true, "dependencies": { "@babel/core": "^7.12.1", @@ -14101,7 +14272,7 @@ "bowser": "^2.8.1", "callsite": "^1.0.0", "callsite-record": "^4.0.0", - "chai": "^4.1.2", + "chai": "4.3.4", "chalk": "^2.3.0", "chrome-remote-interface": "^0.30.0", "coffeescript": "^2.3.1", @@ -14134,7 +14305,7 @@ "moment": "^2.10.3", "moment-duration-format-commonjs": "^1.0.0", "mustache": "^2.1.2", - "nanoid": "^1.0.1", + "nanoid": "^3.1.31", "os-family": "^1.0.0", "parse5": "^1.5.0", "pify": "^2.3.0", @@ -14151,14 +14322,15 @@ "semver": "^5.6.0", "source-map-support": "^0.5.16", "strip-bom": "^2.0.0", - "testcafe-browser-tools": "2.0.16", - "testcafe-hammerhead": "24.5.7", + "testcafe-browser-tools": "2.0.22", + "testcafe-hammerhead": "24.5.13", "testcafe-legacy-api": "5.1.2", + "testcafe-reporter-dashboard": "0.2.5", "testcafe-reporter-json": "^2.1.0", "testcafe-reporter-list": "^2.1.0", "testcafe-reporter-minimal": "^2.1.0", "testcafe-reporter-spec": "^2.1.1", - "testcafe-reporter-xunit": "^2.1.0", + "testcafe-reporter-xunit": "^2.2.1", "time-limit-promise": "^1.0.2", "tmp": "0.0.28", "tree-kill": "^1.2.2", @@ -14214,9 +14386,9 @@ } }, "node_modules/testcafe-browser-tools": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/testcafe-browser-tools/-/testcafe-browser-tools-2.0.16.tgz", - "integrity": "sha512-JljbS0FboABksIMEH1L7P4ZdI82AQ8saWb/7WsxkDCOtDuHID5ZSEb/w9tqLN1+4BQaCgS5veN3lWUnfb0saEA==", + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/testcafe-browser-tools/-/testcafe-browser-tools-2.0.22.tgz", + "integrity": "sha512-ABzKV3h+yrbxC0WfqqCjWP+/XFBH66VY8Nuz3IqDu4/9mbrn2sJpcEdcoxLVRVkIxcLUgCejF38Rorumh9iHvw==", "dev": true, "dependencies": { "array-find": "^1.0.0", @@ -14224,12 +14396,13 @@ "dedent": "^0.7.0", "del": "^5.1.0", "execa": "^3.3.0", + "fs-extra": "^10.0.0", "graceful-fs": "^4.1.11", "linux-platform-info": "^0.0.3", "lodash": "^4.17.15", "mkdirp": "^0.5.1", "mustache": "^2.1.2", - "nanoid": "^2.1.3", + "nanoid": "^3.1.31", "os-family": "^1.0.0", "pify": "^2.3.0", "pinkie": "^2.0.1", @@ -14254,23 +14427,6 @@ "node": ">= 8" } }, - "node_modules/testcafe-browser-tools/node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, "node_modules/testcafe-browser-tools/node_modules/dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -14317,6 +14473,20 @@ "node": "^8.12.0 || >=9.7.0" } }, + "node_modules/testcafe-browser-tools/node_modules/fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, "node_modules/testcafe-browser-tools/node_modules/get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -14362,11 +14532,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/testcafe-browser-tools/node_modules/nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==", - "dev": true + "node_modules/testcafe-browser-tools/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } }, "node_modules/testcafe-browser-tools/node_modules/npm-run-path": { "version": "4.0.1", @@ -14431,10 +14607,19 @@ "node": ">=8" } }, + "node_modules/testcafe-browser-tools/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/testcafe-hammerhead": { - "version": "24.5.7", - "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.7.tgz", - "integrity": "sha512-4pY6GQQaCZAlOolWB2vaYZ/MIpgtmOrZeh4BVbENkbh6DDiPeOxvC0K6yZS5JfINRau5S9mzuNkm2FS7G0urSA==", + "version": "24.5.13", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.13.tgz", + "integrity": "sha512-81P9to2pXBCOy+jnyEaPcjrfKk3wOv7JmZSX3KQp0MxF12X9u6Tg0JEeTMYvnEfCeNhLRYDipAZvI+t9nfx0KA==", "dev": true, "dependencies": { "acorn-hammerhead": "0.5.0", @@ -14612,6 +14797,43 @@ "node": ">=0.10.0" } }, + "node_modules/testcafe-reporter-dashboard": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/testcafe-reporter-dashboard/-/testcafe-reporter-dashboard-0.2.5.tgz", + "integrity": "sha512-vbK8XrpbcFAEgnfWJOfqAnlmj/wt5pXXER/OSYI9RzSw+uwu8voLWbKcUAcnjltk0AM4c0wvI0DhjKmops2y2Q==", + "dev": true, + "dependencies": { + "es6-promise": "^4.2.8", + "fp-ts": "^2.9.5", + "io-ts": "^2.2.14", + "io-ts-types": "^0.5.15", + "isomorphic-fetch": "^3.0.0", + "jsonwebtoken": "^8.5.1", + "monocle-ts": "^2.3.5", + "newtype-ts": "^0.3.4", + "semver": "^5.6.0", + "uuid": "3.3.3" + } + }, + "node_modules/testcafe-reporter-dashboard/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/testcafe-reporter-dashboard/node_modules/uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", + "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", + "dev": true, + "bin": { + "uuid": "bin/uuid" + } + }, "node_modules/testcafe-reporter-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/testcafe-reporter-json/-/testcafe-reporter-json-2.2.0.tgz", @@ -14640,9 +14862,9 @@ "dev": true }, "node_modules/testcafe-reporter-xunit": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/testcafe-reporter-xunit/-/testcafe-reporter-xunit-2.1.0.tgz", - "integrity": "sha1-5tZsVyzhWvJmcGrw/WELKoQd1EM=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/testcafe-reporter-xunit/-/testcafe-reporter-xunit-2.2.1.tgz", + "integrity": "sha512-ge1msi8RyNVyK0QrsmC79zedV7jHasKpBPeOUZd/ORpbYLeYDnprjIeOuIukw0knnTieeYsOK29/ZD+UI7/tdw==", "dev": true }, "node_modules/testcafe/node_modules/@babel/code-frame": { @@ -16165,12 +16387,6 @@ "node": ">=8" } }, - "node_modules/testcafe/node_modules/nanoid": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", - "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==", - "dev": true - }, "node_modules/testcafe/node_modules/node-releases": { "version": "1.1.73", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz", @@ -16966,6 +17182,12 @@ "iconv-lite": "0.4.24" } }, + "node_modules/whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==", + "dev": true + }, "node_modules/whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", @@ -22224,6 +22446,12 @@ "integrity": "sha1-kbx0sR6kBbyRa8aqkI+q+ltKrEs=", "dev": true }, + "buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha1-+OcRMvf/5uAaXJaXpMbz5I1cyBk=", + "dev": true + }, "buffer-fill": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", @@ -23283,6 +23511,15 @@ "safer-buffer": "^2.1.0" } }, + "ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.0.1" + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", @@ -23399,6 +23636,12 @@ "stackframe": "^0.3.1" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", + "dev": true + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -24024,6 +24267,12 @@ "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", "dev": true }, + "fp-ts": { + "version": "2.11.8", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.8.tgz", + "integrity": "sha512-WQT6rP6Jt3TxMdQB3IKzvfZKLuldumntgumLhIUhvPrukTHdWNI4JgEHY04Bd0LIOR9IQRpB+7RuxgUU0Vhmcg==", + "dev": true + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -24742,6 +24991,20 @@ "loose-envify": "^1.0.0" } }, + "io-ts": { + "version": "2.2.16", + "resolved": "https://registry.npmjs.org/io-ts/-/io-ts-2.2.16.tgz", + "integrity": "sha512-y5TTSa6VP6le0hhmIyN0dqEXkrZeJLeC5KApJq6VLci3UEKF80lZ+KuoUs02RhBxNWlrqSNxzfI7otLX1Euv8Q==", + "dev": true, + "requires": {} + }, + "io-ts-types": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/io-ts-types/-/io-ts-types-0.5.16.tgz", + "integrity": "sha512-h9noYVfY9rlbmKI902SJdnV/06jgiT2chxG6lYDxaYNp88HscPi+SBCtmcU+m0E7WT5QSwt7sIMj93+qu0FEwQ==", + "dev": true, + "requires": {} + }, "ip": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", @@ -25002,6 +25265,16 @@ "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, + "isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dev": true, + "requires": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -25882,6 +26155,32 @@ "graceful-fs": "^4.1.6" } }, + "jsonwebtoken": { + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", + "integrity": "sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w==", + "dev": true, + "requires": { + "jws": "^3.2.2", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, "jsprim": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", @@ -25894,6 +26193,27 @@ "verror": "1.10.0" } }, + "jwa": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-1.4.1.tgz", + "integrity": "sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==", + "dev": true, + "requires": { + "buffer-equal-constant-time": "1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "jws": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz", + "integrity": "sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==", + "dev": true, + "requires": { + "jwa": "^1.4.1", + "safe-buffer": "^5.0.1" + } + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -26059,6 +26379,48 @@ "integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=", "dev": true }, + "lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha1-YLuYqHy5I8aMoeUTJUgzFISfVT8=", + "dev": true + }, + "lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha1-bC4XHbKiV82WgC/UOwGyDV9YcPY=", + "dev": true + }, + "lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha1-YZwK89A/iwTDH1iChAt3sRzWg0M=", + "dev": true + }, + "lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha1-POdoEMWSjQM1IwGsKHMX8RwLH/w=", + "dev": true + }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, + "lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha1-1SfftUVuynzJu5XV2ur4i6VKVFE=", + "dev": true + }, + "lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha1-DdOXEhPHxW34gJd9UEyI+0cal6w=", + "dev": true + }, "lodash.sortby": { "version": "4.7.0", "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", @@ -26382,6 +26744,13 @@ "integrity": "sha512-KhKZRH21/+ihNRWrmdNFOyBptFi7nAWZFeFsRRpXkzgk/Yublb4fxyP0jU6EY1VDxUL/VUPdCmm/wAnpbfXdfw==", "dev": true }, + "monocle-ts": { + "version": "2.3.12", + "resolved": "https://registry.npmjs.org/monocle-ts/-/monocle-ts-2.3.12.tgz", + "integrity": "sha512-mf753m69aRNApcL2KCKfLRwfWbraeqQfRRgm3a8D+5lvkhCcMtVp8/vnM04Cmhsd6YXJeInMeQFFETrd7jWYww==", + "dev": true, + "requires": {} + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -26395,9 +26764,9 @@ "dev": true }, "nanoid": { - "version": "3.1.20", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", - "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", + "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", "dev": true }, "nanomatch": { @@ -26437,6 +26806,13 @@ "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, + "newtype-ts": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/newtype-ts/-/newtype-ts-0.3.5.tgz", + "integrity": "sha512-v83UEQMlVR75yf1OUdoSFssjitxzjZlqBAjiGQ4WJaML8Jdc68LJ+BaSAXUmKY4bNzp7hygkKLYTsDi14PxI2g==", + "dev": true, + "requires": {} + }, "nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", @@ -28656,9 +29032,9 @@ } }, "testcafe": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.17.1.tgz", - "integrity": "sha512-G+IqL28PE9wzNKcLjLCjX3z3/KXpzNs0FNC63Y7dXcXx23qlx+yz+Abyh91CIzeiwtXDZX+xMXDYYLtPQLfhlQ==", + "version": "1.18.3", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.3.tgz", + "integrity": "sha512-cBWPBmY20xI9iWQzS9s2t3oIYhXl5gJzM6CTQjLXt5CMAEvWThsOzLWWnNoA2nk4CLBexZ0S5SkrYOk/SGVSaw==", "dev": true, "requires": { "@babel/core": "^7.12.1", @@ -28686,7 +29062,7 @@ "bowser": "^2.8.1", "callsite": "^1.0.0", "callsite-record": "^4.0.0", - "chai": "^4.1.2", + "chai": "4.3.4", "chalk": "^2.3.0", "chrome-remote-interface": "^0.30.0", "coffeescript": "^2.3.1", @@ -28719,7 +29095,7 @@ "moment": "^2.10.3", "moment-duration-format-commonjs": "^1.0.0", "mustache": "^2.1.2", - "nanoid": "^1.0.1", + "nanoid": "^3.1.31", "os-family": "^1.0.0", "parse5": "^1.5.0", "pify": "^2.3.0", @@ -28736,14 +29112,15 @@ "semver": "^5.6.0", "source-map-support": "^0.5.16", "strip-bom": "^2.0.0", - "testcafe-browser-tools": "2.0.16", - "testcafe-hammerhead": "24.5.7", + "testcafe-browser-tools": "2.0.22", + "testcafe-hammerhead": "24.5.13", "testcafe-legacy-api": "5.1.2", + "testcafe-reporter-dashboard": "0.2.5", "testcafe-reporter-json": "^2.1.0", "testcafe-reporter-list": "^2.1.0", "testcafe-reporter-minimal": "^2.1.0", "testcafe-reporter-spec": "^2.1.1", - "testcafe-reporter-xunit": "^2.1.0", + "testcafe-reporter-xunit": "^2.2.1", "time-limit-promise": "^1.0.2", "tmp": "0.0.28", "tree-kill": "^1.2.2", @@ -29823,12 +30200,6 @@ "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", "dev": true }, - "nanoid": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-1.3.4.tgz", - "integrity": "sha512-4ug4BsuHxiVHoRUe1ud6rUFT3WUMmjXt1W0quL0CviZQANdan7D8kqN5/maw53hmAApY/jfzMRkC57BNNs60ZQ==", - "dev": true - }, "node-releases": { "version": "1.1.73", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.73.tgz", @@ -29978,9 +30349,9 @@ } }, "testcafe-browser-tools": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/testcafe-browser-tools/-/testcafe-browser-tools-2.0.16.tgz", - "integrity": "sha512-JljbS0FboABksIMEH1L7P4ZdI82AQ8saWb/7WsxkDCOtDuHID5ZSEb/w9tqLN1+4BQaCgS5veN3lWUnfb0saEA==", + "version": "2.0.22", + "resolved": "https://registry.npmjs.org/testcafe-browser-tools/-/testcafe-browser-tools-2.0.22.tgz", + "integrity": "sha512-ABzKV3h+yrbxC0WfqqCjWP+/XFBH66VY8Nuz3IqDu4/9mbrn2sJpcEdcoxLVRVkIxcLUgCejF38Rorumh9iHvw==", "dev": true, "requires": { "array-find": "^1.0.0", @@ -29988,12 +30359,13 @@ "dedent": "^0.7.0", "del": "^5.1.0", "execa": "^3.3.0", + "fs-extra": "^10.0.0", "graceful-fs": "^4.1.11", "linux-platform-info": "^0.0.3", "lodash": "^4.17.15", "mkdirp": "^0.5.1", "mustache": "^2.1.2", - "nanoid": "^2.1.3", + "nanoid": "^3.1.31", "os-family": "^1.0.0", "pify": "^2.3.0", "pinkie": "^2.0.1", @@ -30012,15 +30384,6 @@ "which": "^2.0.1" } }, - "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, "dedent": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/dedent/-/dedent-0.7.0.tgz", @@ -30061,6 +30424,17 @@ "strip-final-newline": "^2.0.0" } }, + "fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, "get-stream": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", @@ -30088,11 +30462,15 @@ "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, - "nanoid": { - "version": "2.1.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", - "integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==", - "dev": true + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } }, "npm-run-path": { "version": "4.0.1", @@ -30138,13 +30516,19 @@ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true } } }, "testcafe-hammerhead": { - "version": "24.5.7", - "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.7.tgz", - "integrity": "sha512-4pY6GQQaCZAlOolWB2vaYZ/MIpgtmOrZeh4BVbENkbh6DDiPeOxvC0K6yZS5JfINRau5S9mzuNkm2FS7G0urSA==", + "version": "24.5.13", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.13.tgz", + "integrity": "sha512-81P9to2pXBCOy+jnyEaPcjrfKk3wOv7JmZSX3KQp0MxF12X9u6Tg0JEeTMYvnEfCeNhLRYDipAZvI+t9nfx0KA==", "dev": true, "requires": { "acorn-hammerhead": "0.5.0", @@ -30308,6 +30692,38 @@ } } }, + "testcafe-reporter-dashboard": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/testcafe-reporter-dashboard/-/testcafe-reporter-dashboard-0.2.5.tgz", + "integrity": "sha512-vbK8XrpbcFAEgnfWJOfqAnlmj/wt5pXXER/OSYI9RzSw+uwu8voLWbKcUAcnjltk0AM4c0wvI0DhjKmops2y2Q==", + "dev": true, + "requires": { + "es6-promise": "^4.2.8", + "fp-ts": "^2.9.5", + "io-ts": "^2.2.14", + "io-ts-types": "^0.5.15", + "isomorphic-fetch": "^3.0.0", + "jsonwebtoken": "^8.5.1", + "monocle-ts": "^2.3.5", + "newtype-ts": "^0.3.4", + "semver": "^5.6.0", + "uuid": "3.3.3" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "uuid": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", + "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==", + "dev": true + } + } + }, "testcafe-reporter-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/testcafe-reporter-json/-/testcafe-reporter-json-2.2.0.tgz", @@ -30333,9 +30749,9 @@ "dev": true }, "testcafe-reporter-xunit": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/testcafe-reporter-xunit/-/testcafe-reporter-xunit-2.1.0.tgz", - "integrity": "sha1-5tZsVyzhWvJmcGrw/WELKoQd1EM=", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/testcafe-reporter-xunit/-/testcafe-reporter-xunit-2.2.1.tgz", + "integrity": "sha512-ge1msi8RyNVyK0QrsmC79zedV7jHasKpBPeOUZd/ORpbYLeYDnprjIeOuIukw0knnTieeYsOK29/ZD+UI7/tdw==", "dev": true }, "throat": { @@ -30871,6 +31287,12 @@ "iconv-lite": "0.4.24" } }, + "whatwg-fetch": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz", + "integrity": "sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA==", + "dev": true + }, "whatwg-mimetype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz", diff --git a/package.json b/package.json index 8cb71fd1e..91eab9266 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "puppeteer": "^10.2.0", "serve": "^11.3.2", "simple-git": "^2.24.0", - "testcafe": "^1.17.1", + "testcafe": "^1.18.3", "testcafe-browser-provider-browserstack": "^1.13.1", "underscore.string": "^3.3.5", "urijs": "1.18.12", From f433f17f5d9d32bd7eb7b96eb48c433019ec9b02 Mon Sep 17 00:00:00 2001 From: Oliver Shi Date: Wed, 16 Feb 2022 10:19:19 -0500 Subject: [PATCH 02/17] remove shallowMergeConfig (#1046) restricting the contents of shallowMergeConfig to valid json objects makes it more difficult for people to override component templates. notably it does not work with stringifyPartial, which uses backtiks, while JSON only supports double quote strings. J=SLAP-1891 TEST=manual,auto rebuilt test site updated test fixtures --- hbshelpers/shallowMergeConfig.js | 17 -------------- .../common-partials/script/appliedfilters.hbs | 20 ++++++----------- .../common-partials/script/directanswer.hbs | 13 ++++------- .../common-partials/script/filterbox.hbs | 20 ++++++----------- .../common-partials/script/locationbias.hbs | 22 +++++++------------ .../common-partials/script/qasubmission.hbs | 13 ++++------- .../common-partials/script/sortoptions.hbs | 20 ++++++----------- .../common-partials/script/spellcheck.hbs | 13 ++++------- .../script/verticalresultscount.hbs | 13 ++++------- .../script/filteroptions.hbs | 13 ++++------- tests/hbshelpers/shallowMergeConfig.js | 21 ------------------ .../script/fixtures/appliedfilters.hbs.js | 7 ++++-- .../script/fixtures/directanswer.hbs.js | 6 +++-- .../script/fixtures/filterbox.hbs.js | 7 ++++-- .../script/fixtures/locationbias.hbs.js | 8 +++++-- .../script/fixtures/qasubmission.hbs.js | 6 +++-- .../script/fixtures/sortoptions.hbs.js | 7 ++++-- .../script/fixtures/spellcheck.hbs.js | 6 +++-- .../fixtures/verticalresultscount.hbs.js | 6 +++-- 19 files changed, 86 insertions(+), 152 deletions(-) delete mode 100644 hbshelpers/shallowMergeConfig.js delete mode 100644 tests/hbshelpers/shallowMergeConfig.js diff --git a/hbshelpers/shallowMergeConfig.js b/hbshelpers/shallowMergeConfig.js deleted file mode 100644 index df7aee02c..000000000 --- a/hbshelpers/shallowMergeConfig.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This helper merges JSON objects into a single config. - * - * @param {import('handlebars').HelperOptions} options - * @returns {string} The JSON formatted combined config. - */ -module.exports = function shallowMergeConfig(options) { - const parsedData = JSON.parse(options.fn(this)); - let stringFormat; - if (Array.isArray(parsedData)) { - stringFormat = JSON.stringify(Object.assign({}, ...parsedData)); - } - else { - stringFormat = JSON.stringify(Object.assign({}, parsedData)); - } - return stringFormat -} \ No newline at end of file diff --git a/templates/common-partials/script/appliedfilters.hbs b/templates/common-partials/script/appliedfilters.hbs index ad02e179a..536358a67 100644 --- a/templates/common-partials/script/appliedfilters.hbs +++ b/templates/common-partials/script/appliedfilters.hbs @@ -1,13 +1,7 @@ -ANSWERS.addComponent('AppliedFilters', - {{#shallowMergeConfig}}[ - { - "container": "#js-answersAppliedFilters" - {{#if verticalKey}} - , - "verticalKey": "{{{verticalKey}}}" - {{/if}} - }, - {{{json componentSettings.AppliedFilters}}} -] -{{/shallowMergeConfig}} -); \ No newline at end of file +ANSWERS.addComponent('AppliedFilters', { + container: "#js-answersAppliedFilters", + {{#if verticalKey}} + verticalKey: "{{{verticalKey}}}", + {{/if}} + ...{{{json componentSettings.AppliedFilters}}} +}); \ No newline at end of file diff --git a/templates/common-partials/script/directanswer.hbs b/templates/common-partials/script/directanswer.hbs index 7d383bd9a..f62b6d3f4 100644 --- a/templates/common-partials/script/directanswer.hbs +++ b/templates/common-partials/script/directanswer.hbs @@ -1,9 +1,4 @@ -ANSWERS.addComponent("DirectAnswer", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersDirectAnswer" - }, - {{{json componentSettings.DirectAnswer}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent("DirectAnswer", { + container: "#js-answersDirectAnswer", + ...{{{json componentSettings.DirectAnswer}}} +}); diff --git a/templates/common-partials/script/filterbox.hbs b/templates/common-partials/script/filterbox.hbs index deed31847..e36311e1b 100644 --- a/templates/common-partials/script/filterbox.hbs +++ b/templates/common-partials/script/filterbox.hbs @@ -1,13 +1,7 @@ -ANSWERS.addComponent("FilterBox", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersFilterBox" - {{#if verticalKey}} - , - "verticalKey": "{{{verticalKey}}}" - {{/if}} - }, - {{{json componentSettings.FilterBox}}} -] -{{/shallowMergeConfig}} -); \ No newline at end of file +ANSWERS.addComponent("FilterBox", { + container: "#js-answersFilterBox", + {{#if verticalKey}} + verticalKey: "{{{verticalKey}}}", + {{/if}} + ...{{{json componentSettings.FilterBox}}} +}); \ No newline at end of file diff --git a/templates/common-partials/script/locationbias.hbs b/templates/common-partials/script/locationbias.hbs index e2dc4ee49..44b5960b7 100644 --- a/templates/common-partials/script/locationbias.hbs +++ b/templates/common-partials/script/locationbias.hbs @@ -1,14 +1,8 @@ -ANSWERS.addComponent("LocationBias", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersLocationBias{{#if modifier}}--{{modifier}}{{/if}}", - "updateLocationEl": "#js-answersLocationBias{{#if modifier}}--{{modifier}}{{/if}} .js-locationBias-update-location" - {{#if verticalKey}} - , - "verticalKey": "{{{verticalKey}}}" - {{/if}} - }, - {{{json componentSettings.LocationBias}}} -] -{{/shallowMergeConfig}} -); \ No newline at end of file +ANSWERS.addComponent("LocationBias", { + container: "#js-answersLocationBias{{#if modifier}}--{{modifier}}{{/if}}", + updateLocationEl: "#js-answersLocationBias{{#if modifier}}--{{modifier}}{{/if}} .js-locationBias-update-location", + {{#if verticalKey}} + verticalKey: "{{{verticalKey}}}", + {{/if}} + ...{{{json componentSettings.LocationBias}}} +}); \ No newline at end of file diff --git a/templates/common-partials/script/qasubmission.hbs b/templates/common-partials/script/qasubmission.hbs index 380cfe45b..30f313952 100644 --- a/templates/common-partials/script/qasubmission.hbs +++ b/templates/common-partials/script/qasubmission.hbs @@ -1,10 +1,5 @@ -ANSWERS.addComponent("QASubmission", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersQASubmission" - }, - {{{json componentSettings.QASubmission}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent("QASubmission", { + container: "#js-answersQASubmission", + ...{{{json componentSettings.QASubmission}}} +}); diff --git a/templates/common-partials/script/sortoptions.hbs b/templates/common-partials/script/sortoptions.hbs index 9bf70a8c5..0f3382927 100644 --- a/templates/common-partials/script/sortoptions.hbs +++ b/templates/common-partials/script/sortoptions.hbs @@ -1,13 +1,7 @@ -ANSWERS.addComponent("SortOptions", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersSortOptions" - {{#if verticalKey}} - , - "verticalKey": "{{{verticalKey}}}" - {{/if}} - }, - {{{json componentSettings.SortOptions}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent("SortOptions", { + container: "#js-answersSortOptions", + {{#if verticalKey}} + verticalKey: "{{{verticalKey}}}", + {{/if}} + ...{{{json componentSettings.SortOptions}}} +}); diff --git a/templates/common-partials/script/spellcheck.hbs b/templates/common-partials/script/spellcheck.hbs index 7e35121c3..e85942080 100644 --- a/templates/common-partials/script/spellcheck.hbs +++ b/templates/common-partials/script/spellcheck.hbs @@ -1,10 +1,5 @@ -ANSWERS.addComponent("SpellCheck", -{{#shallowMergeConfig}}[ - { - "container": "#js-answersSpellCheck" - }, - {{{json componentSettings.SpellCheck}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent("SpellCheck", { + container: "#js-answersSpellCheck", + ...{{{json componentSettings.SpellCheck}}} +}); diff --git a/templates/common-partials/script/verticalresultscount.hbs b/templates/common-partials/script/verticalresultscount.hbs index e9e64fbce..c0c8a9c03 100644 --- a/templates/common-partials/script/verticalresultscount.hbs +++ b/templates/common-partials/script/verticalresultscount.hbs @@ -1,9 +1,4 @@ -ANSWERS.addComponent('VerticalResultsCount', -{{#shallowMergeConfig}}[ - { - "container": "#js-answersVerticalResultsCount" - }, - {{{json componentSettings.VerticalResultsCount}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent('VerticalResultsCount', { + container: "#js-answersVerticalResultsCount", + ...{{{json componentSettings.VerticalResultsCount}}} +}); diff --git a/templates/vertical-standard/script/filteroptions.hbs b/templates/vertical-standard/script/filteroptions.hbs index a61cec62c..4435f0a77 100644 --- a/templates/vertical-standard/script/filteroptions.hbs +++ b/templates/vertical-standard/script/filteroptions.hbs @@ -1,9 +1,4 @@ -ANSWERS.addComponent("FilterOptions", -{{#shallowMergeConfig}}[ - { - "container": "#standard-filteroptions-container" - }, - {{{json componentSettings.FilterOptions}}} -] -{{/shallowMergeConfig}} -); +ANSWERS.addComponent("FilterOptions", { + container: "#standard-filteroptions-container", + ...{{{json componentSettings.FilterOptions}}} +}); diff --git a/tests/hbshelpers/shallowMergeConfig.js b/tests/hbshelpers/shallowMergeConfig.js deleted file mode 100644 index afaa08019..000000000 --- a/tests/hbshelpers/shallowMergeConfig.js +++ /dev/null @@ -1,21 +0,0 @@ -const hbs = require('handlebars'); -import shallowMergeConfig from '../../hbshelpers/shallowMergeConfig'; - -hbs.registerHelper('shallowMergeConfig', shallowMergeConfig); - -it('performs a shallowMergeConfig', () => { - const context = hbs.compile('{{#shallowMergeConfig}}[{"a": "7"}, {"a": 2}, {"b": 3}, {"c": 4}]{{/shallowMergeConfig}}'); - expect(context()).toEqual(JSON.stringify({"a":2,"b":3,"c":4})); -}); - -it('performs shallowMergeConfig on 1 element', () => { - const template = hbs.compile('{{#shallowMergeConfig}}{"a": "7"}{{/shallowMergeConfig}}'); - expect(template()).toEqual(JSON.stringify({"a": "7"})); -}); - - -it('performs shallowMergeConfig on 0 elements', () => { - const template = hbs.compile('{{#shallowMergeConfig}}{}{{/shallowMergeConfig}}'); - expect(template()).toEqual(JSON.stringify({})); -}); - \ No newline at end of file diff --git a/tests/templates/script/fixtures/appliedfilters.hbs.js b/tests/templates/script/fixtures/appliedfilters.hbs.js index 0481920ab..172d5ffcd 100644 --- a/tests/templates/script/fixtures/appliedfilters.hbs.js +++ b/tests/templates/script/fixtures/appliedfilters.hbs.js @@ -1,2 +1,5 @@ -ANSWERS.addComponent('AppliedFilters', - {"container":"#js-answersAppliedFilters","verticalKey":"testKey","a":"testAF"}); \ No newline at end of file +ANSWERS.addComponent('AppliedFilters', { + container: "#js-answersAppliedFilters", + verticalKey: "testKey", + ...{"a":"testAF"} +}); \ No newline at end of file diff --git a/tests/templates/script/fixtures/directanswer.hbs.js b/tests/templates/script/fixtures/directanswer.hbs.js index 26566ae1a..f70636ae9 100644 --- a/tests/templates/script/fixtures/directanswer.hbs.js +++ b/tests/templates/script/fixtures/directanswer.hbs.js @@ -1,2 +1,4 @@ -ANSWERS.addComponent("DirectAnswer", -{"container":"#js-answersDirectAnswer"}); +ANSWERS.addComponent("DirectAnswer", { + container: "#js-answersDirectAnswer", + ...{} +}); diff --git a/tests/templates/script/fixtures/filterbox.hbs.js b/tests/templates/script/fixtures/filterbox.hbs.js index 3f1148b41..7b1990abc 100644 --- a/tests/templates/script/fixtures/filterbox.hbs.js +++ b/tests/templates/script/fixtures/filterbox.hbs.js @@ -1,2 +1,5 @@ -ANSWERS.addComponent("FilterBox", -{"container":"#js-answersFilterBox","verticalKey":"testKey","a":"testFB"}); \ No newline at end of file +ANSWERS.addComponent("FilterBox", { + container: "#js-answersFilterBox", + verticalKey: "testKey", + ...{"a":"testFB"} +}); \ No newline at end of file diff --git a/tests/templates/script/fixtures/locationbias.hbs.js b/tests/templates/script/fixtures/locationbias.hbs.js index b3a3385f0..f185e9c6e 100644 --- a/tests/templates/script/fixtures/locationbias.hbs.js +++ b/tests/templates/script/fixtures/locationbias.hbs.js @@ -1,2 +1,6 @@ -ANSWERS.addComponent("LocationBias", -{"container":"#js-answersLocationBias","updateLocationEl":"#js-answersLocationBias .js-locationBias-update-location","verticalKey":"testKey","a":"testLB"}); \ No newline at end of file +ANSWERS.addComponent("LocationBias", { + container: "#js-answersLocationBias", + updateLocationEl: "#js-answersLocationBias .js-locationBias-update-location", + verticalKey: "testKey", + ...{"a":"testLB"} +}); \ No newline at end of file diff --git a/tests/templates/script/fixtures/qasubmission.hbs.js b/tests/templates/script/fixtures/qasubmission.hbs.js index b0d3c1b2d..e262d3bad 100644 --- a/tests/templates/script/fixtures/qasubmission.hbs.js +++ b/tests/templates/script/fixtures/qasubmission.hbs.js @@ -1,3 +1,5 @@ -ANSWERS.addComponent("QASubmission", -{"container":"#js-answersQASubmission","a":"testQAS"}); +ANSWERS.addComponent("QASubmission", { + container: "#js-answersQASubmission", + ...{"a":"testQAS"} +}); diff --git a/tests/templates/script/fixtures/sortoptions.hbs.js b/tests/templates/script/fixtures/sortoptions.hbs.js index c710cb3f5..73a92df7d 100644 --- a/tests/templates/script/fixtures/sortoptions.hbs.js +++ b/tests/templates/script/fixtures/sortoptions.hbs.js @@ -1,2 +1,5 @@ -ANSWERS.addComponent("SortOptions", -{"container":"#js-answersSortOptions","verticalKey":"testKey","a":"testSO"}); +ANSWERS.addComponent("SortOptions", { + container: "#js-answersSortOptions", + verticalKey: "testKey", + ...{"a":"testSO"} +}); diff --git a/tests/templates/script/fixtures/spellcheck.hbs.js b/tests/templates/script/fixtures/spellcheck.hbs.js index e03aa4741..01211c8d3 100644 --- a/tests/templates/script/fixtures/spellcheck.hbs.js +++ b/tests/templates/script/fixtures/spellcheck.hbs.js @@ -1,3 +1,5 @@ -ANSWERS.addComponent("SpellCheck", -{"container":"#js-answersSpellCheck","a":"testSC"}); +ANSWERS.addComponent("SpellCheck", { + container: "#js-answersSpellCheck", + ...{"a":"testSC"} +}); diff --git a/tests/templates/script/fixtures/verticalresultscount.hbs.js b/tests/templates/script/fixtures/verticalresultscount.hbs.js index 098e0a146..f14a5d662 100644 --- a/tests/templates/script/fixtures/verticalresultscount.hbs.js +++ b/tests/templates/script/fixtures/verticalresultscount.hbs.js @@ -1,2 +1,4 @@ -ANSWERS.addComponent('VerticalResultsCount', -{"container":"#js-answersVerticalResultsCount","a":"testVRC"}); +ANSWERS.addComponent('VerticalResultsCount', { + container: "#js-answersVerticalResultsCount", + ...{"a":"testVRC"} +}); From ea97ee56ca4b1861132e9c04ed87c7888d77753f Mon Sep 17 00:00:00 2001 From: cea2aj <42848445+cea2aj@users.noreply.github.com> Date: Mon, 7 Mar 2022 10:37:17 -0500 Subject: [PATCH 03/17] Make default vertical-grid universalLimit 3 (#1048) Make default vertical-grid universalLimit 3 J=SLAP-1924 TEST=visual Run a test site setup and build and confirm that the number of results changed from 4 to 3 --- templates/vertical-grid/page-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vertical-grid/page-config.json b/templates/vertical-grid/page-config.json index b311b8dad..c6e2d7c73 100644 --- a/templates/vertical-grid/page-config.json +++ b/templates/vertical-grid/page-config.json @@ -66,7 +66,7 @@ "": { // The vertical key from your search configuration // "label": "", // The name of the vertical in the section header and the navigation bar // "verticalLimit": 15, // The result count limit for vertical search - "universalLimit": 4, // The result count limit for universal search + "universalLimit": 3, // The result count limit for universal search "cardType": "product-prominentimage", // The name of the card to use - e.g. accordion, location, customcard // "icon": "star", // The icon to use on the card for this vertical "universalSectionTemplate": "grid-three-columns" From 75c6731893ca9e70ee002e0cf9240a4381ed6355 Mon Sep 17 00:00:00 2001 From: Oliver Shi Date: Thu, 17 Mar 2022 20:23:31 -0400 Subject: [PATCH 04/17] pass Client-SDK HTTP header (#1056) This will only work when pointed to the next version of the SDK. J=SLAP-1949 TEST=manual,auto see that the test-site specifies the theme's version in the header create a fresh jambo site using the hitchhiker theme, see the header passed as expected --- hooks/templatedataformatter.js | 5 +- package-lock.json | 84 +++++++++---------- package.json | 2 +- script/core.hbs | 5 ++ test-site/config/global_config.json | 4 +- tests/acceptance/constants.js | 8 +- tests/acceptance/searchrequestlogger.js | 44 ++++++++-- .../suites/client-sdk-http-header.js | 56 +++++++++++++ 8 files changed, 149 insertions(+), 59 deletions(-) create mode 100644 tests/acceptance/suites/client-sdk-http-header.js diff --git a/hooks/templatedataformatter.js b/hooks/templatedataformatter.js index 3324b6a8a..d33584e7f 100644 --- a/hooks/templatedataformatter.js +++ b/hooks/templatedataformatter.js @@ -1,4 +1,5 @@ const getCleanedJamboInjectedData = require('../static/webpack/getCleanedJamboInjectedData'); +const packageJson = require('../package.json'); /** * Formats the data sent to the handlebars templates during Jambo builds. @@ -25,7 +26,8 @@ module.exports = function (pageMetadata, siteLevelAttributes, pageNameToConfig) params: currentLocaleConfig.params || {}, relativePath, env: { - JAMBO_INJECTED_DATA: env.JAMBO_INJECTED_DATA + JAMBO_INJECTED_DATA: env.JAMBO_INJECTED_DATA, + packageJsonVersion: packageJson.version } }; if (globalConfig.useJWT) { @@ -73,6 +75,7 @@ function getCleanedTemplateData(templateData) { apiKey: undefined }, env: { + ...templateData.env, JAMBO_INJECTED_DATA: getCleanedJamboInjectedData(jamboInjectedData) } } diff --git a/package-lock.json b/package-lock.json index a04a44700..d50ee06c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "puppeteer": "^10.2.0", "serve": "^11.3.2", "simple-git": "^2.24.0", - "testcafe": "^1.18.3", + "testcafe": "^1.18.4", "testcafe-browser-provider-browserstack": "^1.13.1", "underscore.string": "^3.3.5", "urijs": "1.18.12", @@ -11007,9 +11007,9 @@ } }, "node_modules/log-update-async-hook": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.2.tgz", - "integrity": "sha512-HQwkKFTZeUOrDi1Duf2CSUa/pSpcaCHKLdx3D/Z16DsipzByOBffcg5y0JZA1q0n80dYgLXe2hFM9JGNgBsTDw==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.6.tgz", + "integrity": "sha512-UIFPlCpCxrSVL38TXzk34JhhDnvvhsjzuyqooCYy9TtTaVdBLNsuJiTWX9unO/wzBF7RwY1WTCmEmBSI3iPDCA==", "dev": true, "dependencies": { "ansi-escapes": "^2.0.0", @@ -14242,9 +14242,9 @@ } }, "node_modules/testcafe": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.3.tgz", - "integrity": "sha512-cBWPBmY20xI9iWQzS9s2t3oIYhXl5gJzM6CTQjLXt5CMAEvWThsOzLWWnNoA2nk4CLBexZ0S5SkrYOk/SGVSaw==", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.4.tgz", + "integrity": "sha512-i/fDhEXtQjQeva4JGLAJpo5J8uEY75ojb3T6Vp8zja3ffvXPwEm2evbfsaGbvGBdPChV+7BFsA0+5js5I81nOQ==", "dev": true, "dependencies": { "@babel/core": "^7.12.1", @@ -14299,7 +14299,7 @@ "is-stream": "^2.0.0", "json5": "^2.1.0", "lodash": "^4.17.13", - "log-update-async-hook": "^2.0.2", + "log-update-async-hook": "^2.0.4", "make-dir": "^3.0.0", "mime-db": "^1.41.0", "moment": "^2.10.3", @@ -14323,7 +14323,7 @@ "source-map-support": "^0.5.16", "strip-bom": "^2.0.0", "testcafe-browser-tools": "2.0.22", - "testcafe-hammerhead": "24.5.13", + "testcafe-hammerhead": "24.5.14", "testcafe-legacy-api": "5.1.2", "testcafe-reporter-dashboard": "0.2.5", "testcafe-reporter-json": "^2.1.0", @@ -14617,9 +14617,9 @@ } }, "node_modules/testcafe-hammerhead": { - "version": "24.5.13", - "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.13.tgz", - "integrity": "sha512-81P9to2pXBCOy+jnyEaPcjrfKk3wOv7JmZSX3KQp0MxF12X9u6Tg0JEeTMYvnEfCeNhLRYDipAZvI+t9nfx0KA==", + "version": "24.5.14", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.14.tgz", + "integrity": "sha512-0j9HQOOj+O8OzaLUS3Jr9mDxYUu/1PQgadFPVN9ApM7PyM4Yxj5/S0t4RJAulhpK13j9H9kD08TdfGB9H8U5BQ==", "dev": true, "dependencies": { "acorn-hammerhead": "0.5.0", @@ -14644,7 +14644,7 @@ "pinkie": "2.0.4", "read-file-relative": "^1.2.0", "semver": "5.5.0", - "tough-cookie": "2.3.3", + "tough-cookie": "4.0.0", "tunnel-agent": "0.6.0", "webauth": "^1.1.0" }, @@ -14700,12 +14700,6 @@ "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=", "dev": true }, - "node_modules/testcafe-hammerhead/node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, "node_modules/testcafe-hammerhead/node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -14740,15 +14734,17 @@ } }, "node_modules/testcafe-hammerhead/node_modules/tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", "dev": true, "dependencies": { - "punycode": "^1.4.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" }, "engines": { - "node": ">=0.8" + "node": ">=6" } }, "node_modules/testcafe-legacy-api": { @@ -26447,9 +26443,9 @@ } }, "log-update-async-hook": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.2.tgz", - "integrity": "sha512-HQwkKFTZeUOrDi1Duf2CSUa/pSpcaCHKLdx3D/Z16DsipzByOBffcg5y0JZA1q0n80dYgLXe2hFM9JGNgBsTDw==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.6.tgz", + "integrity": "sha512-UIFPlCpCxrSVL38TXzk34JhhDnvvhsjzuyqooCYy9TtTaVdBLNsuJiTWX9unO/wzBF7RwY1WTCmEmBSI3iPDCA==", "dev": true, "requires": { "ansi-escapes": "^2.0.0", @@ -29032,9 +29028,9 @@ } }, "testcafe": { - "version": "1.18.3", - "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.3.tgz", - "integrity": "sha512-cBWPBmY20xI9iWQzS9s2t3oIYhXl5gJzM6CTQjLXt5CMAEvWThsOzLWWnNoA2nk4CLBexZ0S5SkrYOk/SGVSaw==", + "version": "1.18.4", + "resolved": "https://registry.npmjs.org/testcafe/-/testcafe-1.18.4.tgz", + "integrity": "sha512-i/fDhEXtQjQeva4JGLAJpo5J8uEY75ojb3T6Vp8zja3ffvXPwEm2evbfsaGbvGBdPChV+7BFsA0+5js5I81nOQ==", "dev": true, "requires": { "@babel/core": "^7.12.1", @@ -29089,7 +29085,7 @@ "is-stream": "^2.0.0", "json5": "^2.1.0", "lodash": "^4.17.13", - "log-update-async-hook": "^2.0.2", + "log-update-async-hook": "^2.0.4", "make-dir": "^3.0.0", "mime-db": "^1.41.0", "moment": "^2.10.3", @@ -29113,7 +29109,7 @@ "source-map-support": "^0.5.16", "strip-bom": "^2.0.0", "testcafe-browser-tools": "2.0.22", - "testcafe-hammerhead": "24.5.13", + "testcafe-hammerhead": "24.5.14", "testcafe-legacy-api": "5.1.2", "testcafe-reporter-dashboard": "0.2.5", "testcafe-reporter-json": "^2.1.0", @@ -30526,9 +30522,9 @@ } }, "testcafe-hammerhead": { - "version": "24.5.13", - "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.13.tgz", - "integrity": "sha512-81P9to2pXBCOy+jnyEaPcjrfKk3wOv7JmZSX3KQp0MxF12X9u6Tg0JEeTMYvnEfCeNhLRYDipAZvI+t9nfx0KA==", + "version": "24.5.14", + "resolved": "https://registry.npmjs.org/testcafe-hammerhead/-/testcafe-hammerhead-24.5.14.tgz", + "integrity": "sha512-0j9HQOOj+O8OzaLUS3Jr9mDxYUu/1PQgadFPVN9ApM7PyM4Yxj5/S0t4RJAulhpK13j9H9kD08TdfGB9H8U5BQ==", "dev": true, "requires": { "acorn-hammerhead": "0.5.0", @@ -30553,7 +30549,7 @@ "pinkie": "2.0.4", "read-file-relative": "^1.2.0", "semver": "5.5.0", - "tough-cookie": "2.3.3", + "tough-cookie": "4.0.0", "tunnel-agent": "0.6.0", "webauth": "^1.1.0" }, @@ -30600,12 +30596,6 @@ "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=", "dev": true }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -30637,12 +30627,14 @@ } }, "tough-cookie": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.3.tgz", - "integrity": "sha1-C2GKVWW23qkL80JdBNVe3EdadWE=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.0.0.tgz", + "integrity": "sha512-tHdtEpQCMrc1YLrMaqXXcj6AxhYi/xgit6mZu1+EDWUn+qhUf8wMQoFIy9NXuq23zAwtcB0t/MjACGR18pcRbg==", "dev": true, "requires": { - "punycode": "^1.4.1" + "psl": "^1.1.33", + "punycode": "^2.1.1", + "universalify": "^0.1.2" } } } diff --git a/package.json b/package.json index 40576b7cc..c5c0a0c76 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "puppeteer": "^10.2.0", "serve": "^11.3.2", "simple-git": "^2.24.0", - "testcafe": "^1.18.3", + "testcafe": "^1.18.4", "testcafe-browser-provider-browserstack": "^1.13.1", "underscore.string": "^3.3.5", "urijs": "1.18.12", diff --git a/script/core.hbs b/script/core.hbs index 03cbeac98..b6ce3594a 100644 --- a/script/core.hbs +++ b/script/core.hbs @@ -18,6 +18,11 @@ {{#with env.JAMBO_INJECTED_DATA}} {{#if businessId}}businessId: "{{businessId}}",{{/if}} {{/with}} + additionalHttpHeaders: { + 'Client-SDK': { + ANSWERS_THEME: '{{{ env.packageJsonVersion }}}' + } + } }; const userConfig = { {{#with (deepMerge global_config (lookup verticalsToConfig verticalKey) pageSettings) }} diff --git a/test-site/config/global_config.json b/test-site/config/global_config.json index 5d9b812f7..071d83e33 100644 --- a/test-site/config/global_config.json +++ b/test-site/config/global_config.json @@ -1,10 +1,10 @@ { - "sdkVersion": "1.12", // The version of the Answers SDK to use + "sdkVersion": "develop", // The version of the Answers SDK to use // "token": "", // The auth token to access Answers experience. "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 // "environment": "production", // The environment to run on for this Answers Experience. (i.e. 'production' or 'sandbox') - // "businessId": "", // The business ID of the account. This will be provided automatically by the Yext CI system + "businessId": "3350634", // 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 and the token must be specified through the runtime config. "sessionTrackingEnabled": true, // Whether or not session tracking is enabled for all pages diff --git a/tests/acceptance/constants.js b/tests/acceptance/constants.js index 349a1d0a1..732dd952c 100644 --- a/tests/acceptance/constants.js +++ b/tests/acceptance/constants.js @@ -1,3 +1,5 @@ -module.exports.PORT=9999; -module.exports.VERTICAL_SEARCH_URL_REGEX=/v2\/accounts\/me\/answers\/vertical\/query/; -module.exports.UNIVERSAL_SEARCH_URL_REGEX=/v2\/accounts\/me\/answers\/query/; +exports.PORT=9999; +exports.VERTICAL_SEARCH_URL_REGEX=/v2\/accounts\/me\/answers\/vertical\/query/; +exports.UNIVERSAL_SEARCH_URL_REGEX=/v2\/accounts\/me\/answers\/query/; +exports.UNIVERSAL_AUTOCOMPLETE_URL_REGEX=/v2\/accounts\/me\/answers\/autocomplete/; +exports.VERTICAL_AUTOCOMPLETE_URL_REGEX=/v2\/accounts\/me\/answers\/vertical\/autocomplete/; diff --git a/tests/acceptance/searchrequestlogger.js b/tests/acceptance/searchrequestlogger.js index f02ddb43d..357fd429d 100644 --- a/tests/acceptance/searchrequestlogger.js +++ b/tests/acceptance/searchrequestlogger.js @@ -1,10 +1,14 @@ -import { VERTICAL_SEARCH_URL_REGEX, UNIVERSAL_SEARCH_URL_REGEX } from './constants'; +import { VERTICAL_SEARCH_URL_REGEX, UNIVERSAL_SEARCH_URL_REGEX, VERTICAL_AUTOCOMPLETE_URL_REGEX, UNIVERSAL_AUTOCOMPLETE_URL_REGEX } from './constants'; import { RequestLogger } from 'testcafe'; +const LOGGER_OPTIONS = { + logRequestHeaders: true +} + /** * Handles request logger creation and request/response data received during test execution. */ -class SearchRequestLogger { +export class SearchRequestLogger { /** * Create a RequestLogger that tracks vertical query requests to given test. @@ -13,8 +17,9 @@ class SearchRequestLogger { */ createVerticalSearchLogger() { this._queryRequestLogger = RequestLogger({ - url: VERTICAL_SEARCH_URL_REGEX - }); + url: VERTICAL_SEARCH_URL_REGEX, + method: 'get' + }, LOGGER_OPTIONS); return this._queryRequestLogger; } @@ -25,8 +30,35 @@ class SearchRequestLogger { */ createUniversalSearchLogger() { this._queryRequestLogger = RequestLogger({ - url: UNIVERSAL_SEARCH_URL_REGEX - }); + url: UNIVERSAL_SEARCH_URL_REGEX, + method: 'get' + }, LOGGER_OPTIONS); + return this._queryRequestLogger; + } + + /** + * Create a RequestLogger that tracks vertical query requests to given test. + * + * @returns {import('testcafe').RequestLogger} + */ + createVerticalAutocompleteLogger() { + this._queryRequestLogger = RequestLogger({ + url: VERTICAL_AUTOCOMPLETE_URL_REGEX, + method: 'get' + }, LOGGER_OPTIONS); + return this._queryRequestLogger; + } + + /** + * Create a RequestLogger that tracks universal query requests to given test. + * + * @returns {import('testcafe').RequestLogger} + */ + createUniversalAutocompleteLogger() { + this._queryRequestLogger = RequestLogger({ + url: UNIVERSAL_AUTOCOMPLETE_URL_REGEX, + method: 'get' + }, LOGGER_OPTIONS); return this._queryRequestLogger; } diff --git a/tests/acceptance/suites/client-sdk-http-header.js b/tests/acceptance/suites/client-sdk-http-header.js new file mode 100644 index 000000000..321429f29 --- /dev/null +++ b/tests/acceptance/suites/client-sdk-http-header.js @@ -0,0 +1,56 @@ +import { + PORT, + UNIVERSAL_AUTOCOMPLETE_URL_REGEX, + UNIVERSAL_SEARCH_URL_REGEX, + VERTICAL_SEARCH_URL_REGEX, + VERTICAL_AUTOCOMPLETE_URL_REGEX +} from '../constants'; +import { SearchRequestLogger } from '../searchrequestlogger'; +import { registerIE11NoCacheHook } from '../../test-utils/testcafe'; +import packageJson from '../../../package.json'; + +const verticalSearchLogger = (new SearchRequestLogger()).createVerticalSearchLogger(); +const verticalAutocompleteLogger = (new SearchRequestLogger()).createVerticalAutocompleteLogger(); + +fixture`Client-SDK header works on vertical searches/autocomplete` + .page(`http://localhost:${PORT}/people`) + .requestHooks(verticalSearchLogger, verticalAutocompleteLogger) + .beforeEach(async t => { + await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); + await registerIE11NoCacheHook(t, VERTICAL_AUTOCOMPLETE_URL_REGEX); + await t.resizeWindow(1600, 900); + }) + +test('the Client-SDK header is sent correctly on vertical search/autocomplete requests', async t => { + await t.expect(verticalAutocompleteLogger.requests.length).eql(1); + await t.expect(verticalSearchLogger.requests.length).eql(1); + await t + .expect(verticalAutocompleteLogger.requests[0].request.headers['client-sdk']) + .contains(`ANSWERS_THEME=${packageJson.version}`); + await t + .expect(verticalSearchLogger.requests[0].request.headers['client-sdk']) + .contains(`ANSWERS_THEME=${packageJson.version}`); +}); + +const universalSearchLogger = (new SearchRequestLogger()).createUniversalSearchLogger(); +const universalAutocompleteLogger = (new SearchRequestLogger()).createUniversalAutocompleteLogger(); + +fixture`Client-SDK header works on universal searches/autocomplete` + .page(`http://localhost:${PORT}`) + .requestHooks(universalSearchLogger, universalAutocompleteLogger) + .beforeEach(async t => { + await registerIE11NoCacheHook(t, UNIVERSAL_SEARCH_URL_REGEX); + await registerIE11NoCacheHook(t, UNIVERSAL_AUTOCOMPLETE_URL_REGEX); + await t.resizeWindow(1600, 900); + }) + +test('the Client-SDK header is sent correctly on universal search/autocomplete requests', async t => { + await t.expect(universalSearchLogger.requests.length).eql(1); + await t.expect(universalAutocompleteLogger.requests.length).eql(1); + await t + .expect(universalAutocompleteLogger.requests[0].request.headers['client-sdk']) + .contains(`ANSWERS_THEME=${packageJson.version}`); + await t + .expect(universalSearchLogger.requests[0].request.headers['client-sdk']) + .contains(`ANSWERS_THEME=${packageJson.version}`); +}); \ No newline at end of file From 66fc0803cab165faa3a7d07fabbda2c6b0da2443 Mon Sep 17 00:00:00 2001 From: Yen Truong <36055303+yen-tt@users.noreply.github.com> Date: Thu, 31 Mar 2022 10:37:53 -0400 Subject: [PATCH 05/17] add support for custom prompts based on parent window's page path (#1040) this pr add support for custom prompts in autocomplete based on parent window's page path Add new runtime config listener for key 'customPrompts' that will call autocomplete `setCustomPrompts` function when trigger. In parent's page, `window.AnswersExperienceFrame.runtimeConfig.set(..)` should be use to configure the custom prompts for specific page path. J=SLAP-1803 TEST=manual set customPrompts in searchbar configuration in index config, see that it appears in the dropdown. setup two pages (/promo-search and /random-page) that loads an iframe for universal search page. in /promo-search page, set runtime config for custom prompts. See that search bar in /promo-search have custom prompts. See that /random-page have no custom prompts and work as usual. confirmed customPrompts appear when using sdk asset from develop branch after the sdk pr is merged in. NOTE: this pr requires [SDK changes](https://github.com/yext/answers-search-ui/pull/1655) to work. Confirmed with product that this feature doesn't have to be in theme 1.28, will merge when the next SDK version is release. --- layouts/html.hbs | 4 ++-- static/js/answers-experience.js | 4 +++- .../custom-autocomplete-prompts.js | 11 +++++++++++ test-site/config/index.json | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 static/js/runtime-config-listeners/custom-autocomplete-prompts.js diff --git a/layouts/html.hbs b/layouts/html.hbs index 93aa9e4a3..56d870766 100644 --- a/layouts/html.hbs +++ b/layouts/html.hbs @@ -146,8 +146,8 @@ } else if (window.isOverlay) { window.Overlay.onMessage(message); } else if (message.eventType && message.eventType === 'click') { - ANSWERS.components._activeComponents - .filter(component => component.name === 'SearchBar.autocomplete') + ANSWERS.components + .getActiveComponents('AutoComplete') .forEach(autocompleteComponent => autocompleteComponent.close()); } } diff --git a/static/js/answers-experience.js b/static/js/answers-experience.js index 9e4450cce..5f3a3d747 100644 --- a/static/js/answers-experience.js +++ b/static/js/answers-experience.js @@ -3,6 +3,7 @@ import analyticsListener from './runtime-config-listeners/analytics'; import sessionTrackingListener from './runtime-config-listeners/session-tracking'; import querySourceListener from './runtime-config-listeners/query-source'; import visitorListener from './runtime-config-listeners/visitor'; +import customPromptsListener from './runtime-config-listeners/custom-autocomplete-prompts'; /** * @typedef {import('./runtime-config.js').RuntimeConfigListener} RuntimeConfigListener @@ -16,7 +17,8 @@ export default class AnswersExperience { analyticsListener, sessionTrackingListener, querySourceListener, - visitorListener + visitorListener, + customPromptsListener ]; this._registerRuntimeConfigListeners(); diff --git a/static/js/runtime-config-listeners/custom-autocomplete-prompts.js b/static/js/runtime-config-listeners/custom-autocomplete-prompts.js new file mode 100644 index 000000000..074f82ca9 --- /dev/null +++ b/static/js/runtime-config-listeners/custom-autocomplete-prompts.js @@ -0,0 +1,11 @@ +/** + * @type {import('../runtime-config.js').RuntimeConfigListener} + */ + export default { + key: 'customPrompts', + callback: value => { + ANSWERS.components.getActiveComponents('AutoComplete') + .filter(c => c.name === 'SearchBar.autocomplete') + .forEach(autocompleteComponent => autocompleteComponent.setCustomPrompts(value)); + } +} \ No newline at end of file diff --git a/test-site/config/index.json b/test-site/config/index.json index 078bf263f..ae7acb9ae 100644 --- a/test-site/config/index.json +++ b/test-site/config/index.json @@ -31,6 +31,9 @@ "enabled": false // "customMicIconUrl": "", // Optional, display a custom microphone icon // "customListeningIconUrl": "" // Optional, displays a custom while voice search is active + }, + "autocomplete": { + "customPrompts": ["This is a custom prompt"] } } }, From 962e44a43c1574c8251cc5c7565e17d843c6d038 Mon Sep 17 00:00:00 2001 From: Yen Truong <36055303+yen-tt@users.noreply.github.com> Date: Tue, 5 Apr 2022 14:39:12 -0400 Subject: [PATCH 06/17] Filter component and footer collision on Desktop View (#806) Update template layouts to have filter with relative position - Previously, filter in resultsWrapper has position as absolute, which remove the component the normal flow of the document. This caused overlap issue with any component placed towards the bottom of the document. - Revised layout of vertical-grid and vertical-standard template to organize resultsWrapper into two section (sidebar and mainContent). Placed filter component on sidebar div and answersResults component on maincontent div. Updated scss files to center results on the page. - For mobile view (when collapsibleFilters setup is used), to maintain the same UX as before, the FiltersWrapper div must be moved from the sidebar div to maincontent div right under ResultsHeader div. To do so, onCreate function for FiltersLink component will move FiltersWrapper element to maincontent div if the viewport pixel is less than `$breakpoint-expanded-filters`. a media query listener is also added on `$breakpoint-expanded-filters` to make sure FiltersWrapper element is in the correct div column when the page viewport changes. - `cssBreakpointExpandedFilters: $breakpoint-expanded-filters;` is exported to use in media query listener - [MediaQueryListener.addListener()](https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList/addListener) is deprecated. If possible, MDN recommend to use .addEventListener instead J=SLAP-1221 TEST=manual Launched test site and smoke test filters on /people page in collapsible and non-collapsible mode (desktop/mobile view) and in vertical-grid and vertical-standard layout in chrome, safari, firefox, and IE. See that filters and footer no longer overlap --- static/js/collapsible-filters/interactions.js | 52 +++++++++++++++++++ static/scss/answers/_default.scss | 5 ++ .../scss/answers/templates/vertical-grid.scss | 9 +++- .../answers/templates/vertical-standard.scss | 9 +++- .../collapsible-filters/script/filterlink.js | 3 ++ templates/vertical-grid/page.html.hbs | 39 ++++++++------ .../collapsible-filters/script/filterlink.js | 3 ++ templates/vertical-standard/page.html.hbs | 39 ++++++++------ test-site/pages-patches/faqs.html.hbs.patch | 20 +++---- .../healthcare_professionals.html.hbs.patch | 34 ++++++------ test-site/pages-patches/people.html.hbs.patch | 48 +++++++++-------- 11 files changed, 174 insertions(+), 87 deletions(-) diff --git a/static/js/collapsible-filters/interactions.js b/static/js/collapsible-filters/interactions.js index 8dd4d2976..de81c161b 100644 --- a/static/js/collapsible-filters/interactions.js +++ b/static/js/collapsible-filters/interactions.js @@ -1,6 +1,7 @@ import QueryTriggers from '../constants/query-triggers'; import StorageKeys from '../constants/storage-keys'; import SearchStates from '../constants/search-states'; +import ScssVariables from '../../scss/answers/_default.scss'; /** * Interactions manages page interactions for collapsible filters. @@ -240,4 +241,55 @@ export default class Interactions { yxtFooter.classList.add(this.templateName); } } + + /** + * Use media query with $breakpoint-expanded-filters to determines if the + * page is in collapsible filters view. + * + * @returns {boolean} whether the viewport is in collapsible filters view + */ + isCollapsibleFiltersView() { + const mediaQuery = window.matchMedia(`(min-width: ${ScssVariables.cssBreakpointExpandedFilters})`); + return !mediaQuery.matches; + } + + /** + * Add a media query event listener when there's a width view port change + * relative to $breakpoint-expanded-filters. + * + * @param {Function} handleViewportChange callback function to invoke when there's a media query event + */ + addExpandedFiltersListener(handleViewportChange) { + const mediaQuery = window.matchMedia(`(min-width: ${ScssVariables.cssBreakpointExpandedFilters})`); + if ('addEventListener' in mediaQuery) { + mediaQuery.addEventListener('change', e => handleViewportChange(e.matches)); + } else if ('addListener' in mediaQuery) { + mediaQuery.addListener(e => handleViewportChange(e.matches)); + } + } + + /** + * Update FiltersWrapper HTML element's location when switching between expanded + * and collapsible filters view in page templates that follows the sidebar and + * mainContent div structure (e.g. VerticalStandard and VerticalGrid). + */ + setupResposiveFiltersLayout() { + const moveFiltersWrapper = containerClassName => { + const containerEl = document.getElementsByClassName(containerClassName)?.[0]; + const filtersWrapperEl = document.getElementsByClassName('js-answersFiltersWrapper')?.[0]; + if (containerEl && filtersWrapperEl) { + containerEl.appendChild(filtersWrapperEl); + } + } + if (this.isCollapsibleFiltersView()) { + moveFiltersWrapper('js-answersMainContent'); + } + this.addExpandedFiltersListener(isExpanded => { + if (isExpanded) { + moveFiltersWrapper('js-answersSidebar'); + } else { + moveFiltersWrapper('js-answersMainContent'); + } + }); + } } diff --git a/static/scss/answers/_default.scss b/static/scss/answers/_default.scss index 4f7272950..706dc8f16 100644 --- a/static/scss/answers/_default.scss +++ b/static/scss/answers/_default.scss @@ -72,3 +72,8 @@ @import "../page.scss"; @import "../header.scss"; @import "../footer.scss"; + +// Use to set up media query listener on $breakpoint-expanded-filters +:export { + cssBreakpointExpandedFilters: $breakpoint-expanded-filters; +} diff --git a/static/scss/answers/templates/vertical-grid.scss b/static/scss/answers/templates/vertical-grid.scss index e0f688f90..f98a1107d 100644 --- a/static/scss/answers/templates/vertical-grid.scss +++ b/static/scss/answers/templates/vertical-grid.scss @@ -62,7 +62,7 @@ display: flex; flex-grow: 1; padding-top: calc(var(--yxt-base-spacing) * 1.5); - flex-direction: column; + flex-direction: row; @include bplte(xs) { @@ -74,6 +74,12 @@ } } + &-mainContent { + flex-direction: column; + flex-grow: 1; + width: 100%; + } + &-filtersWrapper { margin-bottom: 20px; @@ -128,7 +134,6 @@ } @media (min-width: #{$breakpoint-expanded-filters}) { - position: absolute; margin-left: calc(-200px - 24px); margin-right: 24px; margin-bottom: 0; diff --git a/static/scss/answers/templates/vertical-standard.scss b/static/scss/answers/templates/vertical-standard.scss index 32536edf3..cea60933f 100644 --- a/static/scss/answers/templates/vertical-standard.scss +++ b/static/scss/answers/templates/vertical-standard.scss @@ -9,7 +9,7 @@ display: flex; flex-grow: 1; padding-top: calc(var(--yxt-base-spacing) * 1.5); - flex-direction: column; + flex-direction: row; @include bplte(xs) { @@ -21,6 +21,12 @@ } } + &-mainContent { + flex-direction: column; + flex-grow: 1; + width: 100%; + } + &-filtersWrapper { margin-bottom: 20px; @@ -75,7 +81,6 @@ } @media (min-width: #{$breakpoint-expanded-filters}) { - position: absolute; margin-left: calc(-200px - 24px); margin-right: 24px; margin-bottom: 0; diff --git a/templates/vertical-grid/collapsible-filters/script/filterlink.js b/templates/vertical-grid/collapsible-filters/script/filterlink.js index f04667012..0859913f8 100644 --- a/templates/vertical-grid/collapsible-filters/script/filterlink.js +++ b/templates/vertical-grid/collapsible-filters/script/filterlink.js @@ -11,5 +11,8 @@ ANSWERS.addComponent('FilterLink', { CollapsibleFilters.Helpers.clearSearch(); collapsibleFiltersInteractions.focusSearchBar(); }, + onCreate: () => { + collapsibleFiltersInteractions.setupResposiveFiltersLayout(); + }, ...{{{ json componentSettings.FilterLink }}} }); \ No newline at end of file diff --git a/templates/vertical-grid/page.html.hbs b/templates/vertical-grid/page.html.hbs index 1362ae503..b50e47cf4 100644 --- a/templates/vertical-grid/page.html.hbs +++ b/templates/vertical-grid/page.html.hbs @@ -26,24 +26,29 @@ The overlay partial should only be added to ONE page of your site, e.g. if you uncomment the partial for this page, you should not use it on any other page. --> {{!-- {{> layouts/overlay-suggestions }} --}} -
- {{> templates/vertical-grid/markup/spellcheck }} -
- {{> templates/vertical-grid/markup/verticalresultscount }} - {{> templates/vertical-grid/markup/appliedfilters }} - {{!-- {{> templates/vertical-grid/collapsible-filters/markup/filterlink }} --}} - {{!-- {{> templates/vertical-grid/collapsible-filters/markup/viewresultsbutton }} --}} +
+
+ + {{!--
--}} + {{!-- {{> templates/vertical-grid/markup/sortoptions }} --}} + {{!-- {{> templates/vertical-grid/markup/filterbox }} --}} + {{!-- {{> templates/vertical-grid/markup/facets }} --}} + {{!--
--}}
- - {{!--
--}} - {{!-- {{> templates/vertical-grid/markup/sortoptions }} --}} - {{!-- {{> templates/vertical-grid/markup/filterbox }} --}} - {{!-- {{> templates/vertical-grid/markup/facets }} --}} - {{!--
--}} -
- {{> templates/vertical-grid/markup/verticalresults }} - {{> templates/vertical-grid/markup/pagination }} - {{!-- {{> templates/vertical-grid/markup/qasubmission }} --}} +
+ {{> templates/vertical-grid/markup/spellcheck }} +
+ {{> templates/vertical-grid/markup/verticalresultscount }} + {{> templates/vertical-grid/markup/appliedfilters }} + {{!-- {{> templates/vertical-grid/collapsible-filters/markup/filterlink }} --}} + {{!-- {{> templates/vertical-grid/collapsible-filters/markup/viewresultsbutton }} --}} +
+ +
+ {{> templates/vertical-grid/markup/verticalresults }} + {{> templates/vertical-grid/markup/pagination }} + {{!-- {{> templates/vertical-grid/markup/qasubmission }} --}} +