diff --git a/.circleci/config.yml b/.circleci/config.yml
index 62be945b4a..a19535d458 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -150,7 +150,7 @@ jobs:
- restore_cache:
key: *cache_key
- run: yarn install --frozen-lockfile --non-interactive
- - run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH
+ - run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CIRCLE_PR_NUMBER $CIRCLE_SHA1
- store_artifacts:
path: *aio_preview_artifact_path
# The `destination` needs to be kept in synch with the value of
diff --git a/aio/package.json b/aio/package.json
index 74af883b64..1303c3f704 100644
--- a/aio/package.json
+++ b/aio/package.json
@@ -28,6 +28,7 @@
"presetup-local": "yarn presetup",
"setup-local": "yarn aio-use-local && yarn example-use-local",
"postsetup-local": "yarn postsetup",
+ "set-opensearch-url": "node --eval \"const sh = require('shelljs'); sh.set('-e'); sh.sed('-i', /PLACEHOLDER_URL/g, process.argv[1], 'dist/assets/opensearch.xml');\"",
"test-pwa-score-localhost": "concurrently --kill-others --success first \"http-server dist -p 4200 --silent\" \"yarn test-pwa-score http://localhost:4200 90\"",
"test-pwa-score": "node scripts/test-pwa-score",
"example-e2e": "yarn example-check-local && node ./tools/examples/run-example-e2e",
diff --git a/aio/scripts/build-artifacts.sh b/aio/scripts/build-artifacts.sh
index 2104db5908..45684f7cbe 100755
--- a/aio/scripts/build-artifacts.sh
+++ b/aio/scripts/build-artifacts.sh
@@ -6,11 +6,20 @@ source "`dirname $0`/../../scripts/ci/env.sh" print
readonly INPUT_DIR=dist/
readonly OUTPUT_FILE=$PROJECT_ROOT/$1
+readonly PR_NUMBER=$2
+readonly PR_LAST_SHA=$3
+readonly deployedUrl=https://pr${PR_NUMBER}-${PR_LAST_SHA:0:7}.ngbuilds.io/
+
(
cd $PROJECT_ROOT/aio
# Build and store the app
yarn build
+
+ # Set deployedUrl as parameter in the opensearch description
+ # deployedUrl must end with /
+ yarn set-opensearch-url $deployedUrl
+
mkdir -p "`dirname $OUTPUT_FILE`"
tar --create --gzip --directory "$INPUT_DIR" --file "$OUTPUT_FILE" .
)
diff --git a/aio/scripts/deploy-to-firebase.sh b/aio/scripts/deploy-to-firebase.sh
index f72aeb1c16..407dc5732a 100755
--- a/aio/scripts/deploy-to-firebase.sh
+++ b/aio/scripts/deploy-to-firebase.sh
@@ -92,6 +92,10 @@ fi
# Include any mode-specific files
cp -rf src/extra-files/$deployEnv/. dist/
+ # Set deployedUrl as parameter in the opensearch description
+ # deployedUrl must end with /
+ yarn set-opensearch-url $deployedUrl
+
# Check payload size
yarn payload-size
diff --git a/aio/src/app/app.component.ts b/aio/src/app/app.component.ts
index e587d25ad1..a15c4ca3fe 100644
--- a/aio/src/app/app.component.ts
+++ b/aio/src/app/app.component.ts
@@ -384,6 +384,7 @@ export class AppComponent implements OnInit {
hideSearchResults() {
this.showSearchResults = false;
+ this.locationService.setSearch('', {});
}
focusSearchBox() {
diff --git a/aio/src/assets/opensearch.xml b/aio/src/assets/opensearch.xml
new file mode 100644
index 0000000000..b49855b9e0
--- /dev/null
+++ b/aio/src/assets/opensearch.xml
@@ -0,0 +1,9 @@
+
+Angular
+Search Angular
+UTF-8
+images/favicons/favicon-16x16.png
+
+PLACEHOLDER_URL?search={searchTerms}
+
\ No newline at end of file
diff --git a/aio/src/index.html b/aio/src/index.html
index 6f2893ba17..293cbf370f 100644
--- a/aio/src/index.html
+++ b/aio/src/index.html
@@ -7,6 +7,7 @@
+