Skip to content

Commit

Permalink
New embed page (#1910)
Browse files Browse the repository at this point in the history
* Initial commit of embed page

* Refactor code

* Move to v4/embedconfig

* Prefer webChatLegacyEmbedURL

* Add SRI note

* Rename to Aries

* Build embed URL

* Clean up

* Add subresource integrity

* Typo

* Add telemetry

* Typo

* Remove index.html

* Clean up

* Moving to production URLs

* Blob URL update

* Set do not publish flag

* Add language

* Add @babel/runtime

* Update URL

* Add locale utility

* Update Azure locale pattern

* Embedding servicing plan

* Use relative path for API

* Add test

* Add local coverage

* Add test

* Add tests

* Default to Node test environment

* Add tests

* Add test

* Prefer beforeEach to clean up

* Add test

* Add test

* Add test

* Add subresource integrity

* Add test

* Add test

* Expect return value

* Add test

* Add 2-letter ISO code

* Add test

* Test DOM

* Fix SRI

* Add test

* Add redirect tests

* Add test for Bing speech token

* Add more spectrum

* Add test

* Remove dead code

* Add test

* Add test

* Point to production CDN

* Add README.md

* Update packages/embed/servicingPlan.json

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/servicingPlan.json

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/servicingPlan.json

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/servicingPlan.json

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/src/index.js

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/src/index.js

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/src/index.js

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/src/setups/version3.spec.js

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Update packages/embed/src/index.js

Co-Authored-By: compulim <compulim@users.noreply.github.com>

* Prefer try-catch over then-catch

* Add boolean attribute

* Add viewport

* Use document fragment

* Send user ID and username to legacy

* Fix tests after boolean attribute
  • Loading branch information
compulim committed Apr 24, 2019
1 parent b836b6e commit 7136e6b
Show file tree
Hide file tree
Showing 37 changed files with 10,075 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/embed/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-transform-runtime"
],
"presets": [
["@babel/preset-env", {
"targets": {
"ie": "11"
},
"modules": "commonjs"
}]
]
}
4 changes: 4 additions & 0 deletions packages/embed/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/coverage
/dist
/lib
/node_modules
28 changes: 28 additions & 0 deletions packages/embed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# botframework-webchat-embed

This package is the embed page hosting at https://webchat.botframework.com/.

For transparency and completeness, we are maintaining the code here. This code is coupled to our servers. In order to host this page, you will need to decouple it or provide the same set of REST APIs.

## Build

1. `npm install`
1. `npm run prepublishOnly`
1. Publishes the build artifact at `/dist/index.html`, to our internal repository
1. Verifies the file size, it should be less than 30 KB

## Updating servicing plan

`servicingPlan.json` is the deployment plan. It provides details about where to locate assets, how to set up, and when to deprecate our older bits.

When modifying the servicing plan to point to newer assets, make sure it is pointing to immutable copies on CDN. For example, assets with hashed filenames. Since we are using subresource integrity, this will make sure servicing plan and assets can be invalidated on CDN cache asynchronously.

### Generating hash for subresource integrity

For traceability of deployment, we are using [subresource integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).

To generate SHA384 for a specific asset from an URL, run the following command in [Ubuntu](https://www.microsoft.com/en-us/p/ubuntu/9nblggh4msv6).

```sh
curl https://cdn.botframework.com/botframework-webchat/4.3.0/webchat.js | openssl dgst -sha384 -binary | openssl base64 -A
```
Loading

0 comments on commit 7136e6b

Please sign in to comment.