From 7e0068621b2b2b4cb1308312fdf27a0ded719b68 Mon Sep 17 00:00:00 2001 From: Ryan Pope Date: Tue, 2 Jul 2024 13:43:16 -0400 Subject: [PATCH] chat-core-aws-connect: implement library (#36) Implements chat-core-aws-connect, to be used by chat-headless when an agent handoff session is initiated. TEST=manual Added browser tests, ensured all functionality works as expected. Added comprehensive Jest tests, saw them pass. --- README.md | 2 + package-lock.json | 214 +++ packages/chat-core-aws-connect/LICENSE | 33 + packages/chat-core-aws-connect/README.md | 39 + .../chat-core-aws-connect/THIRD-PARTY-NOTICES | 410 +++++ .../chat-core-aws-connect/api-extractor.json | 427 +++++ .../chat-core-aws-connect/babel.config.js | 3 + ...onnect.awsconnecteventdata.absolutetime.md | 13 + ...s-connect.awsconnecteventdata.contactid.md | 13 + ...aws-connect.awsconnecteventdata.content.md | 13 + ...connect.awsconnecteventdata.contenttype.md | 13 + ...connect.awsconnecteventdata.displayname.md | 13 + ...core-aws-connect.awsconnecteventdata.id.md | 13 + ...at-core-aws-connect.awsconnecteventdata.md | 28 + ...nnect.awsconnecteventdata.participantid.md | 13 + ...ect.awsconnecteventdata.participantrole.md | 13 + ...re-aws-connect.awsconnecteventdata.type.md | 13 + ...ore-aws-connect.chatcoreawsconnect.emit.md | 25 + ...s-connect.chatcoreawsconnect.getsession.md | 21 + ...ore-aws-connect.chatcoreawsconnect.init.md | 24 + ...hat-core-aws-connect.chatcoreawsconnect.md | 24 + ...-core-aws-connect.chatcoreawsconnect.on.md | 25 + ...nnect.chatcoreawsconnect.processmessage.md | 24 + ...t.chatcoreawsconnectconfig.loggerconfig.md | 13 + ...re-aws-connect.chatcoreawsconnectconfig.md | 20 + .../chat-core-aws-connect.eventcallback.md | 15 + .../docs/chat-core-aws-connect.eventmap.md | 19 + .../docs/chat-core-aws-connect.logger.md | 19 + ...s-connect.loggerconfig.customizedlogger.md | 13 + ...hat-core-aws-connect.loggerconfig.level.md | 13 + .../chat-core-aws-connect.loggerconfig.md | 21 + .../docs/chat-core-aws-connect.loglevel.md | 18 + .../docs/chat-core-aws-connect.md | 30 + ...e-aws-connect.providechatcoreawsconnect.md | 24 + packages/chat-core-aws-connect/docs/index.md | 12 + .../etc/chat-core-aws-connect.api.md | 70 + .../chat-core-aws-connect/jest.config.json | 13 + packages/chat-core-aws-connect/package.json | 73 + .../src/CoreAwsConnectProvider.ts | 15 + packages/chat-core-aws-connect/src/index.ts | 2 + .../src/infra/ChatCoreAwsConnectImpl.ts | 131 ++ .../src/models/AwsConnectEvent.ts | 52 + .../src/models/ChatCoreAwsConnect.ts | 53 + .../src/models/ChatCoreAwsConnectConfig.ts | 13 + .../src/models/EventCallback.ts | 21 + .../src/models/LoggerConfig.ts | 64 + .../src/models/connect.d.ts | 10 + .../chat-core-aws-connect/src/models/index.ts | 5 + .../test-browser-esm/README.md | 16 + .../test-browser-esm/index.html | 17 + .../test-browser-esm/package-lock.json | 1499 +++++++++++++++++ .../test-browser-esm/package.json | 24 + .../test-browser-esm/rollup.config.js | 27 + .../test-browser-esm/sample.env | 2 + .../test-browser-esm/src/script.js | 59 + .../tests/ChatCoreAwsConnect.test.ts | 349 ++++ .../chat-core-aws-connect/tests/jest-setup.js | 8 + .../chat-core-aws-connect/tsconfig.cjs.json | 8 + .../chat-core-aws-connect/tsconfig.esm.json | 8 + packages/chat-core-aws-connect/tsconfig.json | 15 + 60 files changed, 4187 insertions(+) create mode 100644 packages/chat-core-aws-connect/LICENSE create mode 100644 packages/chat-core-aws-connect/README.md create mode 100644 packages/chat-core-aws-connect/THIRD-PARTY-NOTICES create mode 100644 packages/chat-core-aws-connect/api-extractor.json create mode 100644 packages/chat-core-aws-connect/babel.config.js create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.absolutetime.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contactid.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.content.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contenttype.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.displayname.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.id.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantid.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantrole.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.type.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.emit.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.getsession.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.init.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.on.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.processmessage.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventcallback.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventmap.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.logger.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.customizedlogger.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.level.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.loglevel.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.md create mode 100644 packages/chat-core-aws-connect/docs/chat-core-aws-connect.providechatcoreawsconnect.md create mode 100644 packages/chat-core-aws-connect/docs/index.md create mode 100644 packages/chat-core-aws-connect/etc/chat-core-aws-connect.api.md create mode 100644 packages/chat-core-aws-connect/jest.config.json create mode 100644 packages/chat-core-aws-connect/package.json create mode 100644 packages/chat-core-aws-connect/src/CoreAwsConnectProvider.ts create mode 100644 packages/chat-core-aws-connect/src/index.ts create mode 100644 packages/chat-core-aws-connect/src/infra/ChatCoreAwsConnectImpl.ts create mode 100644 packages/chat-core-aws-connect/src/models/AwsConnectEvent.ts create mode 100644 packages/chat-core-aws-connect/src/models/ChatCoreAwsConnect.ts create mode 100644 packages/chat-core-aws-connect/src/models/ChatCoreAwsConnectConfig.ts create mode 100644 packages/chat-core-aws-connect/src/models/EventCallback.ts create mode 100644 packages/chat-core-aws-connect/src/models/LoggerConfig.ts create mode 100644 packages/chat-core-aws-connect/src/models/connect.d.ts create mode 100644 packages/chat-core-aws-connect/src/models/index.ts create mode 100644 packages/chat-core-aws-connect/test-browser-esm/README.md create mode 100644 packages/chat-core-aws-connect/test-browser-esm/index.html create mode 100644 packages/chat-core-aws-connect/test-browser-esm/package-lock.json create mode 100644 packages/chat-core-aws-connect/test-browser-esm/package.json create mode 100644 packages/chat-core-aws-connect/test-browser-esm/rollup.config.js create mode 100644 packages/chat-core-aws-connect/test-browser-esm/sample.env create mode 100644 packages/chat-core-aws-connect/test-browser-esm/src/script.js create mode 100644 packages/chat-core-aws-connect/tests/ChatCoreAwsConnect.test.ts create mode 100644 packages/chat-core-aws-connect/tests/jest-setup.js create mode 100644 packages/chat-core-aws-connect/tsconfig.cjs.json create mode 100644 packages/chat-core-aws-connect/tsconfig.esm.json create mode 100644 packages/chat-core-aws-connect/tsconfig.json diff --git a/README.md b/README.md index e820460..8cf86c2 100644 --- a/README.md +++ b/README.md @@ -10,4 +10,6 @@ This monorepo includes the following packages/apps: - `@yext/chat-core`: a networking library for interacting with the Yext Chat API. Visit [README.md](./packages/chat-core/README.md) for more details. +- `@yext/chat-core-aws-connect`: a library used for integrating Yext Chat with the Amazon Connect agent platform. Visit [README.md](./packages/chat-core-aws-connect/README.md) for more details. + Each package/app is 100% [TypeScript](https://www.typescriptlang.org/). diff --git a/package-lock.json b/package-lock.json index f715b2b..1b68b15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3504,6 +3504,10 @@ "resolved": "packages/chat-core", "link": true }, + "node_modules/@yext/chat-core-aws-connect": { + "resolved": "packages/chat-core-aws-connect", + "link": true + }, "node_modules/@yext/eslint-config": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@yext/eslint-config/-/eslint-config-1.0.0.tgz", @@ -3616,6 +3620,23 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/amazon-connect-chatjs": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/amazon-connect-chatjs/-/amazon-connect-chatjs-2.3.0.tgz", + "integrity": "sha512-PXPMPIWaJDH5x5t0roh5u+uLBqh6NfeIvg1KSC5b/fofmrQIKIGZCFbs8hJmzSYcLELbPbPj2vBtVb3l4AaiHA==", + "dependencies": { + "detect-browser": "5.3.0", + "sprintf-js": "^1.1.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/amazon-connect-chatjs/node_modules/sprintf-js": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", + "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==" + }, "node_modules/ansi-colors": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", @@ -4682,6 +4703,11 @@ "node": ">=0.4.0" } }, + "node_modules/detect-browser": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/detect-browser/-/detect-browser-5.3.0.tgz", + "integrity": "sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==" + }, "node_modules/detect-newline": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", @@ -4755,6 +4781,18 @@ "node": ">=12" } }, + "node_modules/dotenv": { + "version": "16.4.5", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", + "integrity": "sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.380", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.380.tgz", @@ -10234,6 +10272,182 @@ "typescript": "^5.0.4" } }, + "packages/chat-core-aws-connect": { + "name": "@yext/chat-core-aws-connect", + "version": "0.1.0", + "license": "BSD-3-Clause", + "dependencies": { + "amazon-connect-chatjs": "^2.3.0", + "cross-fetch": "^3.1.5" + }, + "devDependencies": { + "@babel/preset-env": "^7.21.5", + "@babel/preset-typescript": "^7.21.5", + "@microsoft/api-documenter": "^7.22.4", + "@microsoft/api-extractor": "^7.34.8", + "@types/jest": "^29.5.1", + "@types/node-fetch": "^2.6.4", + "@yext/chat-core": "^0.8.1", + "@yext/eslint-config": "^1.0.0", + "babel-jest": "^29.5.0", + "dotenv": "^16.4.5", + "eslint": "^8.39.0", + "generate-license-file": "^1.0.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "prettier": "^2.8.8", + "rollup": "^3.29.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "^5.0.4" + }, + "peerDependencies": { + "@yext/chat-core": "^0.8.2" + } + }, + "packages/chat-core-aws-connect/node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "packages/chat-core-aws-connect/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "packages/chat-core-aws-connect/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "packages/chat-core-aws-connect/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "packages/chat-core-aws-connect/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "packages/chat-core-aws-connect/node_modules/generate-license-file": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/generate-license-file/-/generate-license-file-1.3.0.tgz", + "integrity": "sha512-UH5zYE5aeEcVcqAzSJdjB4oHkRSX/EkQgHg6tuvo3poxs56KwIC0oGZf4dD6YvsDvFbhAhsa1g6lE9tiUC12Ig==", + "dev": true, + "dependencies": { + "arg": "^4.1.3", + "cli-spinners": "^2.6.0", + "enquirer": "^2.3.6", + "eslint-config-prettier": "^8.3.0", + "esm": "^3.2.25", + "glob": "^7.1.7", + "inquirer": "^7.3.3", + "license-checker": "^25.0.1", + "ora": "^4.1.1" + }, + "bin": { + "generate-license-file": "bin/generate-license-file" + } + }, + "packages/chat-core-aws-connect/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "packages/chat-core-aws-connect/node_modules/log-symbols": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-3.0.0.tgz", + "integrity": "sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==", + "dev": true, + "dependencies": { + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=8" + } + }, + "packages/chat-core-aws-connect/node_modules/log-symbols/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "packages/chat-core-aws-connect/node_modules/log-symbols/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "packages/chat-core-aws-connect/node_modules/log-symbols/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "packages/chat-core-aws-connect/node_modules/ora": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-4.1.1.tgz", + "integrity": "sha512-sjYP8QyVWBpBZWD6Vr1M/KwknSw6kJOz41tvGMlwWeClHBtYKTbHMki1PsLZnxKpXMPbTKv9b3pjQu3REib96A==", + "dev": true, + "dependencies": { + "chalk": "^3.0.0", + "cli-cursor": "^3.1.0", + "cli-spinners": "^2.2.0", + "is-interactive": "^1.0.0", + "log-symbols": "^3.0.0", + "mute-stream": "0.0.8", + "strip-ansi": "^6.0.0", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "packages/chat-core/node_modules/arg": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", diff --git a/packages/chat-core-aws-connect/LICENSE b/packages/chat-core-aws-connect/LICENSE new file mode 100644 index 0000000..b85203b --- /dev/null +++ b/packages/chat-core-aws-connect/LICENSE @@ -0,0 +1,33 @@ +Contains information from the language-subtag-registry JSON Database (https://github.com/mattcg/language-subtag-registry/tree/master/data/json) which is made available under the ODC Attribution License (https://github.com/mattcg/language-subtag-registry/blob/master/LICENSE.md). + +The files listed in this repository are licensed under the below license. All other features and products are subject to separate agreements and certain functionality requires paid subscriptions to Yext products. + +BSD 3-Clause License + +Copyright (c) 2023, Yext +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/packages/chat-core-aws-connect/README.md b/packages/chat-core-aws-connect/README.md new file mode 100644 index 0000000..51a9268 --- /dev/null +++ b/packages/chat-core-aws-connect/README.md @@ -0,0 +1,39 @@ +# chat-core-aws-connect + +a library used for integrating Yext Chat with the Amazon Connect agent platform. + +- Works in both the **browser** and **Node.js** +- 100% **TypeScript**, with detailed request and response models +- Compatible with both **CommonJS** and **ES6** imports + +## Usage + +```typescript +import { provideChatCoreAwsConnect } from "@yext/chat-core-aws-connect"; +import { Message, MessageResponse } from "@yext/chat-core"; + +// create a new instance of ChatCoreAwsConnect +const chatCoreAwsConnect = provideChatCoreAwsConnect(); + +// with some response from the Chat API containing handoff credentials... +const chatApiResponse: MessageResponse; + +// initiate a connection to Amazon Connect using the credentials +await chatCoreAwsConnect.init(chatApiResponse); + +// create a message payload +const messages: Message[] = [ + { + source: "USER", + text: "Could I get some assistance?", + timestamp: "2023-05-15T17:33:38.373Z", + }, +]; + +// send it to Connect! +await chatCoreAwsConnect.processMessage({ messages }); +``` + +## Documentation + +See **[our documentation](./docs/chat-core-aws-connect.md)** for a more details on supported API calls and interfaces. diff --git a/packages/chat-core-aws-connect/THIRD-PARTY-NOTICES b/packages/chat-core-aws-connect/THIRD-PARTY-NOTICES new file mode 100644 index 0000000..76befee --- /dev/null +++ b/packages/chat-core-aws-connect/THIRD-PARTY-NOTICES @@ -0,0 +1,410 @@ +The following NPM package may be included in this product: + + - @yext/chat-core@0.8.2 + +This package contains the following license and notice below: + +Contains information from the language-subtag-registry JSON Database (https://github.com/mattcg/language-subtag-registry/tree/master/data/json) which is made available under the ODC Attribution License (https://github.com/mattcg/language-subtag-registry/blob/master/LICENSE.md). + +The files listed in this repository are licensed under the below license. All other features and products are subject to separate agreements and certain functionality requires paid subscriptions to Yext products. + +BSD 3-Clause License + +Copyright (c) 2023, Yext +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----------- + +The following NPM package may be included in this product: + + - amazon-connect-chatjs@2.3.0 + +This package contains the following license and notice below: + +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +----------- + +The following NPM package may be included in this product: + + - cross-fetch@3.1.8 + +This package contains the following license and notice below: + +The MIT License (MIT) + +Copyright (c) 2017 Leonardo Quixadá + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----------- + +The following NPM package may be included in this product: + + - detect-browser@5.3.0 + +This package contains the following license and notice below: + +The MIT License (MIT) + +Copyright (c) 2019 Damon Oehlman + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----------- + +The following NPM package may be included in this product: + + - node-fetch@2.7.0 + +This package contains the following license and notice below: + +The MIT License (MIT) + +Copyright (c) 2016 David Frank + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +----------- + +The following NPM package may be included in this product: + + - sprintf-js@1.1.3 + +This package contains the following license and notice below: + +Copyright (c) 2007-present, Alexandru Mărășteanu +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of this software nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----------- + +The following NPM package may be included in this product: + + - tr46@0.0.3 + +This package contains the following license and notice below: + +(MIT) + +----------- + +The following NPM package may be included in this product: + + - webidl-conversions@3.0.1 + +This package contains the following license and notice below: + +# The BSD 2-Clause License + +Copyright (c) 2014, Domenic Denicola +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +----------- + +The following NPM package may be included in this product: + + - whatwg-url@5.0.0 + +This package contains the following license and notice below: + +The MIT License (MIT) + +Copyright (c) 2015–2016 Sebastian Mayr + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +----------- + +This file was generated with generate-license-file! https://www.npmjs.com/package/generate-license-file diff --git a/packages/chat-core-aws-connect/api-extractor.json b/packages/chat-core-aws-connect/api-extractor.json new file mode 100644 index 0000000..efd219e --- /dev/null +++ b/packages/chat-core-aws-connect/api-extractor.json @@ -0,0 +1,427 @@ +/** + * Config file for API Extractor. For more info, please visit: https://api-extractor.com + */ +{ + "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json", + + /** + * Optionally specifies another JSON config file that this file extends from. This provides a way for + * standard settings to be shared across multiple projects. + * + * If the path starts with "./" or "../", the path is resolved relative to the folder of the file that contains + * the "extends" field. Otherwise, the first path segment is interpreted as an NPM package name, and will be + * resolved using NodeJS require(). + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "extends": "./shared/api-extractor-base.json" + // "extends": "my-package/include/api-extractor-base.json" + + /** + * Determines the "" token that can be used with other config file settings. The project folder + * typically contains the tsconfig.json and package.json config files, but the path is user-defined. + * + * The path is resolved relative to the folder of the config file that contains the setting. + * + * The default value for "projectFolder" is the token "", which means the folder is determined by traversing + * parent folders, starting from the folder containing api-extractor.json, and stopping at the first folder + * that contains a tsconfig.json file. If a tsconfig.json file cannot be found in this way, then an error + * will be reported. + * + * SUPPORTED TOKENS: + * DEFAULT VALUE: "" + */ + // "projectFolder": "..", + + /** + * (REQUIRED) Specifies the .d.ts file to be used as the starting point for analysis. API Extractor + * analyzes the symbols exported by this module. + * + * The file extension must be ".d.ts" and not ".ts". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + */ + "mainEntryPointFilePath": "/dist/esm/index.d.ts", + + /** + * A list of NPM package names whose exports should be treated as part of this package. + * + * For example, suppose that Webpack is used to generate a distributed bundle for the project "library1", + * and another NPM package "library2" is embedded in this bundle. Some types from library2 may become part + * of the exported API for library1, but by default API Extractor would generate a .d.ts rollup that explicitly + * imports library2. To avoid this, we can specify: + * + * "bundledPackages": [ "library2" ], + * + * This would direct API Extractor to embed those types directly in the .d.ts rollup, as if they had been + * local files for library1. + */ + "bundledPackages": [], + + /** + * Specifies what type of newlines API Extractor should use when writing output files. By default, the output files + * will be written with Windows-style newlines. To use POSIX-style newlines, specify "lf" instead. + * To use the OS's default newline kind, specify "os". + * + * DEFAULT VALUE: "crlf" + */ + // "newlineKind": "crlf", + + /** + * Set to true when invoking API Extractor's test harness. When `testMode` is true, the `toolVersion` field in the + * .api.json file is assigned an empty string to prevent spurious diffs in output files tracked for tests. + * + * DEFAULT VALUE: "false" + */ + // "testMode": false, + + /** + * Specifies how API Extractor sorts members of an enum when generating the .api.json file. By default, the output + * files will be sorted alphabetically, which is "by-name". To keep the ordering in the source code, specify + * "preserve". + * + * DEFAULT VALUE: "by-name" + */ + // "enumMemberOrder": "by-name", + + /** + * Determines how the TypeScript compiler engine will be invoked by API Extractor. + */ + "compiler": { + /** + * Specifies the path to the tsconfig.json file to be used by API Extractor when analyzing the project. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * Note: This setting will be ignored if "overrideTsconfig" is used. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/tsconfig.json" + */ + "tsconfigFilePath": "/tsconfig.esm.json" + /** + * Provides a compiler configuration that will be used instead of reading the tsconfig.json file from disk. + * The object must conform to the TypeScript tsconfig schema: + * + * http://json.schemastore.org/tsconfig + * + * If omitted, then the tsconfig.json file will be read from the "projectFolder". + * + * DEFAULT VALUE: no overrideTsconfig section + */ + // "overrideTsconfig": { + // . . . + // } + /** + * This option causes the compiler to be invoked with the --skipLibCheck option. This option is not recommended + * and may cause API Extractor to produce incomplete or incorrect declarations, but it may be required when + * dependencies contain declarations that are incompatible with the TypeScript engine that API Extractor uses + * for its analysis. Where possible, the underlying issue should be fixed rather than relying on skipLibCheck. + * + * DEFAULT VALUE: false + */ + // "skipLibCheck": true, + }, + + /** + * Configures how the API report file (*.api.md) will be generated. + */ + "apiReport": { + /** + * (REQUIRED) Whether to generate an API report. + */ + "enabled": true + + /** + * The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce + * a full file path. + * + * The file extension should be ".api.md", and the string should not contain a path separator such as "\" or "/". + * + * SUPPORTED TOKENS: , + * DEFAULT VALUE: ".api.md" + */ + // "reportFileName": ".api.md", + + /** + * Specifies the folder where the API report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * The API report file is normally tracked by Git. Changes to it can be used to trigger a branch policy, + * e.g. for an API review. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportFolder": "/temp/", + + /** + * Specifies the folder where the temporary report file is written. The file name portion is determined by + * the "reportFileName" setting. + * + * After the temporary file is written to disk, it is compared with the file in the "reportFolder". + * If they are different, a production build will fail. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/" + */ + // "reportTempFolder": "/temp/", + + /** + * Whether "forgotten exports" should be included in the API report file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false + }, + + /** + * Configures how the doc model file (*.api.json) will be generated. + */ + "docModel": { + /** + * (REQUIRED) Whether to generate a doc model file. + */ + "enabled": true + + /** + * The output path for the doc model file. The file extension should be ".api.json". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/temp/.api.json" + */ + // "apiJsonFilePath": "/temp/.api.json", + + /** + * Whether "forgotten exports" should be included in the doc model file. Forgotten exports are declarations + * flagged with `ae-forgotten-export` warnings. See https://api-extractor.com/pages/messages/ae-forgotten-export/ to + * learn more. + * + * DEFAULT VALUE: "false" + */ + // "includeForgottenExports": false, + + /** + * The base URL where the project's source code can be viewed on a website such as GitHub or + * Azure DevOps. This URL path corresponds to the `` path on disk. + * + * This URL is concatenated with the file paths serialized to the doc model to produce URL file paths to individual API items. + * For example, if the `projectFolderUrl` is "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor" and an API + * item's file path is "api/ExtractorConfig.ts", the full URL file path would be + * "https://github.com/microsoft/rushstack/tree/main/apps/api-extractor/api/ExtractorConfig.js". + * + * Can be omitted if you don't need source code links in your API documentation reference. + * + * SUPPORTED TOKENS: none + * DEFAULT VALUE: "" + */ + // "projectFolderUrl": "http://github.com/path/to/your/projectFolder" + }, + + /** + * Configures how the .d.ts rollup file will be generated. + */ + "dtsRollup": { + /** + * (REQUIRED) Whether to generate the .d.ts rollup file. + */ + "enabled": true, + + /** + * Specifies the output path for a .d.ts rollup file to be generated without any trimming. + * This file will include all declarations that are exported by the main entry point. + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "/dist/.d.ts" + */ + "untrimmedFilePath": "", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for an "alpha" release. + * This file will include only declarations that are marked as "@public", "@beta", or "@alpha". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "alphaTrimmedFilePath": "/dist/-alpha.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "beta" release. + * This file will include only declarations that are marked as "@public" or "@beta". + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "betaTrimmedFilePath": "/dist/-beta.d.ts", + + /** + * Specifies the output path for a .d.ts rollup file to be generated with trimming for a "public" release. + * This file will include only declarations that are marked as "@public". + * + * If the path is an empty string, then this file will not be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + "publicTrimmedFilePath": "/dist/bundle.d.ts" + + /** + * When a declaration is trimmed, by default it will be replaced by a code comment such as + * "Excluded from this release type: exampleMember". Set "omitTrimmingComments" to true to remove the + * declaration completely. + * + * DEFAULT VALUE: false + */ + // "omitTrimmingComments": true + }, + + /** + * Configures how the tsdoc-metadata.json file will be generated. + */ + "tsdocMetadata": { + /** + * Whether to generate the tsdoc-metadata.json file. + * + * DEFAULT VALUE: true + */ + "enabled": true + /** + * Specifies where the TSDoc metadata file should be written. + * + * The path is resolved relative to the folder of the config file that contains the setting; to change this, + * prepend a folder token such as "". + * + * The default value is "", which causes the path to be automatically inferred from the "tsdocMetadata", + * "typings" or "main" fields of the project's package.json. If none of these fields are set, the lookup + * falls back to "tsdoc-metadata.json" in the package folder. + * + * SUPPORTED TOKENS: , , + * DEFAULT VALUE: "" + */ + // "tsdocMetadataFilePath": "/dist/tsdoc-metadata.json" + }, + + /** + * Configures how API Extractor reports error and warning messages produced during analysis. + * + * There are three sources of messages: compiler messages, API Extractor messages, and TSDoc messages. + */ + "messages": { + /** + * Configures handling of diagnostic messages reported by the TypeScript compiler engine while analyzing + * the input .d.ts files. + * + * TypeScript message identifiers start with "TS" followed by an integer. For example: "TS2551" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "compilerMessageReporting": { + /** + * Configures the default routing for messages that don't match an explicit rule in this table. + */ + "default": { + /** + * Specifies whether the message should be written to the the tool's output log. Note that + * the "addToApiReportFile" property may supersede this option. + * + * Possible values: "error", "warning", "none" + * + * Errors cause the build to fail and return a nonzero exit code. Warnings cause a production build fail + * and return a nonzero exit code. For a non-production build (e.g. when "api-extractor run" includes + * the "--local" option), the warning is displayed but the build will not fail. + * + * DEFAULT VALUE: "warning" + */ + "logLevel": "error" + + /** + * When addToApiReportFile is true: If API Extractor is configured to write an API report file (.api.md), + * then the message will be written inside that file; otherwise, the message is instead logged according to + * the "logLevel" option. + * + * DEFAULT VALUE: false + */ + // "addToApiReportFile": false + } + + // "TS2551": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by API Extractor during its analysis. + * + * API Extractor message identifiers start with "ae-". For example: "ae-extra-release-tag" + * + * DEFAULT VALUE: See api-extractor-defaults.json for the complete table of extractorMessageReporting mappings + */ + "extractorMessageReporting": { + "default": { + "logLevel": "error" + // "addToApiReportFile": false + } + + // "ae-extra-release-tag": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + }, + + /** + * Configures handling of messages reported by the TSDoc parser when analyzing code comments. + * + * TSDoc message identifiers start with "tsdoc-". For example: "tsdoc-link-tag-unescaped-text" + * + * DEFAULT VALUE: A single "default" entry with logLevel=warning. + */ + "tsdocMessageReporting": { + "default": { + "logLevel": "error" + // "addToApiReportFile": false + } + + // "tsdoc-link-tag-unescaped-text": { + // "logLevel": "warning", + // "addToApiReportFile": true + // }, + // + // . . . + } + } +} diff --git a/packages/chat-core-aws-connect/babel.config.js b/packages/chat-core-aws-connect/babel.config.js new file mode 100644 index 0000000..fb11988 --- /dev/null +++ b/packages/chat-core-aws-connect/babel.config.js @@ -0,0 +1,3 @@ +module.exports = { + presets: ["@babel/preset-env", "@babel/preset-typescript"], +}; diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.absolutetime.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.absolutetime.md new file mode 100644 index 0000000..a47abfd --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.absolutetime.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [AbsoluteTime](./chat-core-aws-connect.awsconnecteventdata.absolutetime.md) + +## AwsConnectEventData.AbsoluteTime property + +The time at which the event occurred. + +**Signature:** + +```typescript +AbsoluteTime: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contactid.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contactid.md new file mode 100644 index 0000000..f6b5a85 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contactid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [ContactId](./chat-core-aws-connect.awsconnecteventdata.contactid.md) + +## AwsConnectEventData.ContactId property + +The ID of the AWS Connect contact associated with the event. + +**Signature:** + +```typescript +ContactId: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.content.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.content.md new file mode 100644 index 0000000..dc84d5c --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.content.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [Content](./chat-core-aws-connect.awsconnecteventdata.content.md) + +## AwsConnectEventData.Content property + +The content of the event. + +**Signature:** + +```typescript +Content: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contenttype.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contenttype.md new file mode 100644 index 0000000..444a3e8 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.contenttype.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [ContentType](./chat-core-aws-connect.awsconnecteventdata.contenttype.md) + +## AwsConnectEventData.ContentType property + +The type of content in the event. + +**Signature:** + +```typescript +ContentType: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.displayname.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.displayname.md new file mode 100644 index 0000000..0a0b737 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.displayname.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [DisplayName](./chat-core-aws-connect.awsconnecteventdata.displayname.md) + +## AwsConnectEventData.DisplayName property + +The display name of the participant associated with the event. + +**Signature:** + +```typescript +DisplayName: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.id.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.id.md new file mode 100644 index 0000000..82cae68 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.id.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [Id](./chat-core-aws-connect.awsconnecteventdata.id.md) + +## AwsConnectEventData.Id property + +The ID of the event. + +**Signature:** + +```typescript +Id: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.md new file mode 100644 index 0000000..028fa92 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.md @@ -0,0 +1,28 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) + +## AwsConnectEventData interface + +Data associated with an AWS Connect event. + +**Signature:** + +```typescript +export interface AwsConnectEventData +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [AbsoluteTime](./chat-core-aws-connect.awsconnecteventdata.absolutetime.md) | | string | The time at which the event occurred. | +| [ContactId](./chat-core-aws-connect.awsconnecteventdata.contactid.md) | | string | The ID of the AWS Connect contact associated with the event. | +| [Content](./chat-core-aws-connect.awsconnecteventdata.content.md) | | string | The content of the event. | +| [ContentType](./chat-core-aws-connect.awsconnecteventdata.contenttype.md) | | string | The type of content in the event. | +| [DisplayName](./chat-core-aws-connect.awsconnecteventdata.displayname.md) | | string | The display name of the participant associated with the event. | +| [Id](./chat-core-aws-connect.awsconnecteventdata.id.md) | | string | The ID of the event. | +| [ParticipantId](./chat-core-aws-connect.awsconnecteventdata.participantid.md) | | string | The ID of the participant associated with the event. | +| [ParticipantRole](./chat-core-aws-connect.awsconnecteventdata.participantrole.md) | | string | The role of the participant associated with the event. | +| [Type](./chat-core-aws-connect.awsconnecteventdata.type.md) | | string | The type of the event. | + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantid.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantid.md new file mode 100644 index 0000000..d694b4c --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantid.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [ParticipantId](./chat-core-aws-connect.awsconnecteventdata.participantid.md) + +## AwsConnectEventData.ParticipantId property + +The ID of the participant associated with the event. + +**Signature:** + +```typescript +ParticipantId: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantrole.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantrole.md new file mode 100644 index 0000000..8f9f6d8 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.participantrole.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [ParticipantRole](./chat-core-aws-connect.awsconnecteventdata.participantrole.md) + +## AwsConnectEventData.ParticipantRole property + +The role of the participant associated with the event. + +**Signature:** + +```typescript +ParticipantRole: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.type.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.type.md new file mode 100644 index 0000000..5178644 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.awsconnecteventdata.type.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) > [Type](./chat-core-aws-connect.awsconnecteventdata.type.md) + +## AwsConnectEventData.Type property + +The type of the event. + +**Signature:** + +```typescript +Type: string; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.emit.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.emit.md new file mode 100644 index 0000000..bc2c8dc --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.emit.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) > [emit](./chat-core-aws-connect.chatcoreawsconnect.emit.md) + +## ChatCoreAwsConnect.emit() method + +Emit an event into the AWS Connect chat session. Supported events are: - `typing`: The customer is typing. + +**Signature:** + +```typescript +emit(eventName: T, data: EventMap[T]): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| eventName | T | The name of the event to emit. | +| data | [EventMap](./chat-core-aws-connect.eventmap.md)\[T\] | The data to be sent with the event. | + +**Returns:** + +void + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.getsession.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.getsession.md new file mode 100644 index 0000000..9367a9c --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.getsession.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) > [getSession](./chat-core-aws-connect.chatcoreawsconnect.getsession.md) + +## ChatCoreAwsConnect.getSession() method + +Get the current AWS Connect chat session. + +**Signature:** + +```typescript +getSession(): connect.ActiveChatSession | undefined; +``` +**Returns:** + +connect.ActiveChatSession \| undefined + +## Remarks + +If the session is not initialized, this method will return `undefined`. + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.init.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.init.md new file mode 100644 index 0000000..3bed370 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.init.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) > [init](./chat-core-aws-connect.chatcoreawsconnect.init.md) + +## ChatCoreAwsConnect.init() method + +Initialize the AWS Connect chat session using the credentials from the Chat API. + +**Signature:** + +```typescript +init(messageResponse: MessageResponse): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| messageResponse | MessageResponse | The response returned from a successful call to the Chat API. | + +**Returns:** + +Promise<void> + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.md new file mode 100644 index 0000000..6eebfd9 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) + +## ChatCoreAwsConnect interface + +Provides methods for interacting with Chat's AWS Connect integration. + +**Signature:** + +```typescript +export interface ChatCoreAwsConnect +``` + +## Methods + +| Method | Description | +| --- | --- | +| [emit(eventName, data)](./chat-core-aws-connect.chatcoreawsconnect.emit.md) | Emit an event into the AWS Connect chat session. Supported events are: - typing: The customer is typing. | +| [getSession()](./chat-core-aws-connect.chatcoreawsconnect.getsession.md) | Get the current AWS Connect chat session. | +| [init(messageResponse)](./chat-core-aws-connect.chatcoreawsconnect.init.md) | Initialize the AWS Connect chat session using the credentials from the Chat API. | +| [on(eventName, cb)](./chat-core-aws-connect.chatcoreawsconnect.on.md) | Register a callback for an event triggered within the AWS Connect chat session. Supported events are: - message: A new message has been received. - typing: The agent is typing. - close: The chat session has been closed. | +| [processMessage(request)](./chat-core-aws-connect.chatcoreawsconnect.processmessage.md) | Process a message sent by the user. | + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.on.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.on.md new file mode 100644 index 0000000..539f469 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.on.md @@ -0,0 +1,25 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) > [on](./chat-core-aws-connect.chatcoreawsconnect.on.md) + +## ChatCoreAwsConnect.on() method + +Register a callback for an event triggered within the AWS Connect chat session. Supported events are: - `message`: A new message has been received. - `typing`: The agent is typing. - `close`: The chat session has been closed. + +**Signature:** + +```typescript +on(eventName: T, cb: EventCallback): void; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| eventName | T | The name of the event to listen for. | +| cb | [EventCallback](./chat-core-aws-connect.eventcallback.md)<T> | The callback to be executed when the event is triggered. | + +**Returns:** + +void + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.processmessage.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.processmessage.md new file mode 100644 index 0000000..c8ca306 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnect.processmessage.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) > [processMessage](./chat-core-aws-connect.chatcoreawsconnect.processmessage.md) + +## ChatCoreAwsConnect.processMessage() method + +Process a message sent by the user. + +**Signature:** + +```typescript +processMessage(request: MessageRequest): Promise; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| request | MessageRequest | The message sent by the user, in the Chat API format. | + +**Returns:** + +Promise<void> + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md new file mode 100644 index 0000000..5596e82 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnectConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.md) > [loggerConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md) + +## ChatCoreAwsConnectConfig.loggerConfig property + +Configuration for the internal logger of the AWS Connect Chat session. + +**Signature:** + +```typescript +loggerConfig: LoggerConfig; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.md new file mode 100644 index 0000000..2bbd3d6 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.chatcoreawsconnectconfig.md @@ -0,0 +1,20 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [ChatCoreAwsConnectConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.md) + +## ChatCoreAwsConnectConfig interface + +Configuration for this instance of the [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md). + +**Signature:** + +```typescript +export interface ChatCoreAwsConnectConfig +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [loggerConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.loggerconfig.md) | | [LoggerConfig](./chat-core-aws-connect.loggerconfig.md) | Configuration for the internal logger of the AWS Connect Chat session. | + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventcallback.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventcallback.md new file mode 100644 index 0000000..a47d11b --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventcallback.md @@ -0,0 +1,15 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [EventCallback](./chat-core-aws-connect.eventcallback.md) + +## EventCallback type + +A generic event callback, to be used when defining listeners for a [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md). + +**Signature:** + +```typescript +export type EventCallback = (arg: EventMap[T]) => void; +``` +**References:** [EventMap](./chat-core-aws-connect.eventmap.md) + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventmap.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventmap.md new file mode 100644 index 0000000..7e8befd --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.eventmap.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [EventMap](./chat-core-aws-connect.eventmap.md) + +## EventMap type + +A map of events that can be emitted or listened for within a [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) to their associated data types. + +**Signature:** + +```typescript +export type EventMap = { + message: string; + typing: boolean; + close: AwsConnectEventData; +}; +``` +**References:** [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.logger.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.logger.md new file mode 100644 index 0000000..94aaabb --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.logger.md @@ -0,0 +1,19 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [Logger](./chat-core-aws-connect.logger.md) + +## Logger type + +The logger interface for the AWS Connect Chat session. + +**Signature:** + +```typescript +export type Logger = { + debug?: (log: string) => void; + info?: (log: string) => void; + warn?: (log: string) => void; + error?: (log: string) => void; + advancedLog?: (log: string) => void; +}; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.customizedlogger.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.customizedlogger.md new file mode 100644 index 0000000..4f5cb73 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.customizedlogger.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [LoggerConfig](./chat-core-aws-connect.loggerconfig.md) > [customizedLogger](./chat-core-aws-connect.loggerconfig.customizedlogger.md) + +## LoggerConfig.customizedLogger property + +The custom logger to use. If provided, the default logger will be disabled. + +**Signature:** + +```typescript +customizedLogger?: Logger; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.level.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.level.md new file mode 100644 index 0000000..66386ae --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.level.md @@ -0,0 +1,13 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [LoggerConfig](./chat-core-aws-connect.loggerconfig.md) > [level](./chat-core-aws-connect.loggerconfig.level.md) + +## LoggerConfig.level property + +The log level for the logger. Can be one of DEBUG, INFO, WARN, ERROR, ADVANCED\_LOG. Default is ERROR. + +**Signature:** + +```typescript +level: LogLevel; +``` diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.md new file mode 100644 index 0000000..f14fdd8 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loggerconfig.md @@ -0,0 +1,21 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [LoggerConfig](./chat-core-aws-connect.loggerconfig.md) + +## LoggerConfig interface + +Configuration for the internal logger of the AWS Connect Chat session. + +**Signature:** + +```typescript +export interface LoggerConfig +``` + +## Properties + +| Property | Modifiers | Type | Description | +| --- | --- | --- | --- | +| [customizedLogger?](./chat-core-aws-connect.loggerconfig.customizedlogger.md) | | [Logger](./chat-core-aws-connect.logger.md) | _(Optional)_ The custom logger to use. If provided, the default logger will be disabled. | +| [level](./chat-core-aws-connect.loggerconfig.level.md) | | [LogLevel](./chat-core-aws-connect.loglevel.md) | The log level for the logger. Can be one of DEBUG, INFO, WARN, ERROR, ADVANCED\_LOG. Default is ERROR. | + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loglevel.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loglevel.md new file mode 100644 index 0000000..f1142b5 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.loglevel.md @@ -0,0 +1,18 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [LogLevel](./chat-core-aws-connect.loglevel.md) + +## LogLevel type + +The log level for the logger. + +**Signature:** + +```typescript +export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "ADVANCED_LOG"; +``` + +## Remarks + +Only DEBUG, INFO, WARN, ERROR, ADVANCED\_LOG are supported. Setting only applies while the AWS Connect chat session is active. + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.md new file mode 100644 index 0000000..b69f991 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.md @@ -0,0 +1,30 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) + +## chat-core-aws-connect package + +## Functions + +| Function | Description | +| --- | --- | +| [provideChatCoreAwsConnect(config)](./chat-core-aws-connect.providechatcoreawsconnect.md) | Provider for the ChatCore integration with AWS Connect. | + +## Interfaces + +| Interface | Description | +| --- | --- | +| [AwsConnectEventData](./chat-core-aws-connect.awsconnecteventdata.md) | Data associated with an AWS Connect event. | +| [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) | Provides methods for interacting with Chat's AWS Connect integration. | +| [ChatCoreAwsConnectConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.md) | Configuration for this instance of the [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md). | +| [LoggerConfig](./chat-core-aws-connect.loggerconfig.md) | Configuration for the internal logger of the AWS Connect Chat session. | + +## Type Aliases + +| Type Alias | Description | +| --- | --- | +| [EventCallback](./chat-core-aws-connect.eventcallback.md) | A generic event callback, to be used when defining listeners for a [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md). | +| [EventMap](./chat-core-aws-connect.eventmap.md) | A map of events that can be emitted or listened for within a [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) to their associated data types. | +| [Logger](./chat-core-aws-connect.logger.md) | The logger interface for the AWS Connect Chat session. | +| [LogLevel](./chat-core-aws-connect.loglevel.md) | The log level for the logger. | + diff --git a/packages/chat-core-aws-connect/docs/chat-core-aws-connect.providechatcoreawsconnect.md b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.providechatcoreawsconnect.md new file mode 100644 index 0000000..8b62ba5 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/chat-core-aws-connect.providechatcoreawsconnect.md @@ -0,0 +1,24 @@ + + +[Home](./index.md) > [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) > [provideChatCoreAwsConnect](./chat-core-aws-connect.providechatcoreawsconnect.md) + +## provideChatCoreAwsConnect() function + +Provider for the ChatCore integration with AWS Connect. + +**Signature:** + +```typescript +export declare function provideChatCoreAwsConnect(config?: ChatCoreAwsConnectConfig): ChatCoreAwsConnect; +``` + +## Parameters + +| Parameter | Type | Description | +| --- | --- | --- | +| config | [ChatCoreAwsConnectConfig](./chat-core-aws-connect.chatcoreawsconnectconfig.md) | _(Optional)_ Configuration for the returned instance of the [ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md). | + +**Returns:** + +[ChatCoreAwsConnect](./chat-core-aws-connect.chatcoreawsconnect.md) + diff --git a/packages/chat-core-aws-connect/docs/index.md b/packages/chat-core-aws-connect/docs/index.md new file mode 100644 index 0000000..89e2fa5 --- /dev/null +++ b/packages/chat-core-aws-connect/docs/index.md @@ -0,0 +1,12 @@ + + +[Home](./index.md) + +## API Reference + +## Packages + +| Package | Description | +| --- | --- | +| [@yext/chat-core-aws-connect](./chat-core-aws-connect.md) | | + diff --git a/packages/chat-core-aws-connect/etc/chat-core-aws-connect.api.md b/packages/chat-core-aws-connect/etc/chat-core-aws-connect.api.md new file mode 100644 index 0000000..f566fbe --- /dev/null +++ b/packages/chat-core-aws-connect/etc/chat-core-aws-connect.api.md @@ -0,0 +1,70 @@ +## API Report File for "@yext/chat-core-aws-connect" + +> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). + +```ts + +import { MessageRequest } from '@yext/chat-core'; +import { MessageResponse } from '@yext/chat-core'; + +// @public +export interface AwsConnectEventData { + AbsoluteTime: string; + ContactId: string; + Content: string; + ContentType: string; + DisplayName: string; + Id: string; + ParticipantId: string; + ParticipantRole: string; + Type: string; +} + +// @public +export interface ChatCoreAwsConnect { + emit(eventName: T, data: EventMap[T]): void; + getSession(): connect.ActiveChatSession | undefined; + init(messageResponse: MessageResponse): Promise; + on(eventName: T, cb: EventCallback): void; + processMessage(request: MessageRequest): Promise; +} + +// @public +export interface ChatCoreAwsConnectConfig { + loggerConfig: LoggerConfig; +} + +// @public +export type EventCallback = (arg: EventMap[T]) => void; + +// @public +export type EventMap = { + message: string; + typing: boolean; + close: AwsConnectEventData; +}; + +// @public +export type Logger = { + debug?: (log: string) => void; + info?: (log: string) => void; + warn?: (log: string) => void; + error?: (log: string) => void; + advancedLog?: (log: string) => void; +}; + +// @public +export interface LoggerConfig { + customizedLogger?: Logger; + level: LogLevel; +} + +// @public +export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "ADVANCED_LOG"; + +// @public +export function provideChatCoreAwsConnect(config?: ChatCoreAwsConnectConfig): ChatCoreAwsConnect; + +// (No @packageDocumentation comment for this package) + +``` diff --git a/packages/chat-core-aws-connect/jest.config.json b/packages/chat-core-aws-connect/jest.config.json new file mode 100644 index 0000000..8ba4fe1 --- /dev/null +++ b/packages/chat-core-aws-connect/jest.config.json @@ -0,0 +1,13 @@ +{ + "bail": 0, + "collectCoverage": true, + "collectCoverageFrom": ["src/**", "!src/models/**/*.ts"], + "verbose": true, + "moduleFileExtensions": ["js", "ts"], + "moduleDirectories": ["node_modules", ""], + "testEnvironment": "jsdom", + "testPathIgnorePatterns": ["./tests/mocks/*", "./tests/jest-setup.js"], + "resetMocks": true, + "testMatch": ["/tests/**/*.[jt]s"], + "setupFiles": ["/tests/jest-setup.js"] +} diff --git a/packages/chat-core-aws-connect/package.json b/packages/chat-core-aws-connect/package.json new file mode 100644 index 0000000..ea9eae6 --- /dev/null +++ b/packages/chat-core-aws-connect/package.json @@ -0,0 +1,73 @@ +{ + "name": "@yext/chat-core-aws-connect", + "version": "0.1.0-alpha", + "description": "Typescript Networking Library for the Yext Chat API Integration with Amazon Connect", + "main": "./dist/commonjs/index.js", + "module": "./dist/esm/index.mjs", + "types": "./dist/esm/index.d.ts", + "sideEffects": false, + "keywords": [ + "networking", + "chat api", + "chat", + "browser", + "nodejs", + "typescript", + "commonjs", + "es6", + "yext" + ], + "files": [ + "dist", + "src", + "THIRD-PARTY-NOTICES", + "LICENSE" + ], + "scripts": { + "test": "jest --config=jest.config.json", + "lint": "prettier --write . && eslint --fix --max-warnings=0 .", + "tsc": "tsc -p tsconfig.json", + "dev": "npm run tsc -- --watch", + "generate-notices": "../../generate-notices.sh", + "generate-docs": "api-extractor run --local --verbose && api-documenter markdown --input-folder temp --output-folder docs && rm -rf temp", + "build:js": "rollup --config ../../rollup.config.mjs", + "build": "rm -rf dist/** && npm run build:js && npm run generate-docs && npm run generate-notices" + }, + "repository": { + "type": "git", + "url": "https://github.com/yext/chat-core.git" + }, + "author": "clippy@yext.com", + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/yext/chat-core/issues" + }, + "homepage": "https://github.com/yext/chat-core#readme", + "dependencies": { + "amazon-connect-chatjs": "^2.3.0", + "cross-fetch": "^3.1.5" + }, + "devDependencies": { + "@babel/preset-env": "^7.21.5", + "@babel/preset-typescript": "^7.21.5", + "@microsoft/api-documenter": "^7.22.4", + "@microsoft/api-extractor": "^7.34.8", + "@types/jest": "^29.5.1", + "@types/node-fetch": "^2.6.4", + "@yext/chat-core": "^0.8.1", + "@yext/eslint-config": "^1.0.0", + "babel-jest": "^29.5.0", + "eslint": "^8.39.0", + "generate-license-file": "^1.0.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "prettier": "^2.8.8", + "rollup": "^3.29.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "^5.0.4", + "dotenv": "^16.4.5" + }, + "peerDependencies": { + "@yext/chat-core": "^0.8.2" + } +} diff --git a/packages/chat-core-aws-connect/src/CoreAwsConnectProvider.ts b/packages/chat-core-aws-connect/src/CoreAwsConnectProvider.ts new file mode 100644 index 0000000..bfc8672 --- /dev/null +++ b/packages/chat-core-aws-connect/src/CoreAwsConnectProvider.ts @@ -0,0 +1,15 @@ +import { ChatCoreAwsConnectImpl } from "./infra/ChatCoreAwsConnectImpl"; +import { ChatCoreAwsConnect, ChatCoreAwsConnectConfig } from "./models"; + +/** + * Provider for the ChatCore integration with AWS Connect. + * + * @param config - Configuration for the returned instance of the {@link ChatCoreAwsConnect}. + * + * @public + */ +export function provideChatCoreAwsConnect( + config?: ChatCoreAwsConnectConfig +): ChatCoreAwsConnect { + return new ChatCoreAwsConnectImpl(config); +} diff --git a/packages/chat-core-aws-connect/src/index.ts b/packages/chat-core-aws-connect/src/index.ts new file mode 100644 index 0000000..067aea6 --- /dev/null +++ b/packages/chat-core-aws-connect/src/index.ts @@ -0,0 +1,2 @@ +export { provideChatCoreAwsConnect } from "./CoreAwsConnectProvider"; +export * from "./models"; diff --git a/packages/chat-core-aws-connect/src/infra/ChatCoreAwsConnectImpl.ts b/packages/chat-core-aws-connect/src/infra/ChatCoreAwsConnectImpl.ts new file mode 100644 index 0000000..7853500 --- /dev/null +++ b/packages/chat-core-aws-connect/src/infra/ChatCoreAwsConnectImpl.ts @@ -0,0 +1,131 @@ +import { ChatCoreAwsConnect } from "../models/ChatCoreAwsConnect"; +import { MessageRequest, MessageResponse } from "@yext/chat-core"; +import { AwsConnectEvent } from "../models/AwsConnectEvent"; +import { EventMap, EventCallback } from "../models/EventCallback"; +import { LoggerConfig } from "../models/LoggerConfig"; +import { ChatCoreAwsConnectConfig } from "../models/ChatCoreAwsConnectConfig"; +import "amazon-connect-chatjs"; + +/** + * The primary class for the chat-core integration with AWS Connect. + * + * @internal + */ +export class ChatCoreAwsConnectImpl implements ChatCoreAwsConnect { + private session?: connect.ActiveChatSession; + private eventListeners: { [T in keyof EventMap]?: EventCallback[] } = {}; + private loggerConfig: LoggerConfig = { + level: "ERROR", + }; + + constructor(config?: ChatCoreAwsConnectConfig) { + if (!config) { + return; + } + + if (config.loggerConfig) { + this.loggerConfig = config.loggerConfig; + } + } + + async init(messageRsp: MessageResponse): Promise { + if (this.session) { + console.warn("Chat session already initialized"); + return; + } + + const connectionCreds = + messageRsp.integrationDetails?.awsConnectHandoff?.credentials; + if (!connectionCreds) { + throw new Error( + "Integration credentials not specified. Cannot initialize chat session." + ); + } + + connect.ChatSession.setGlobalConfig({ + loggerConfig: { + level: connect.LogLevel[this.loggerConfig.level], + useDefaultLogger: this.loggerConfig.customizedLogger ? false : true, + customizedLogger: this.loggerConfig.customizedLogger, + }, + region: messageRsp.integrationDetails?.awsConnectHandoff?.region, + }); + + this.session = connect.ChatSession.create({ + chatDetails: connectionCreds, + type: "CUSTOMER", + }); + + const { connectCalled, connectSuccess } = await this.session.connect({}); + if (!connectCalled || !connectSuccess) { + throw new Error("Failed to connect to chat session"); + } + + this.setupEventListeners(); + this.session.sendMessage({ + contentType: "text/plain", + message: messageRsp.notes.conversationSummary, + }); + } + + private setupEventListeners() { + this.session?.onMessage((event: AwsConnectEvent) => { + switch (event.data.ContentType) { + case "text/plain": + if ( + event.data.ParticipantRole === "AGENT" || + event.data.ParticipantRole === "SYSTEM" + ) { + this.eventListeners["message"]?.forEach((cb) => + cb(event.data.Content) + ); + this.eventListeners["typing"]?.forEach((cb) => cb(false)); + } + break; + } + }); + + this.session?.onTyping((_: AwsConnectEvent) => { + this.eventListeners["typing"]?.forEach((cb) => cb(true)); + + // after 5s, turn off typing indicator + setTimeout(() => { + this.eventListeners["typing"]?.forEach((cb) => cb(false)); + }, 5000); + }); + + this.session?.onEnded((event: AwsConnectEvent) => { + this.eventListeners["close"]?.forEach((cb) => cb(event.data)); + }); + } + + on(eventName: T, cb: EventCallback): void { + if (!this.eventListeners[eventName]) { + this.eventListeners[eventName] = []; + } + this.eventListeners[eventName]?.push(cb); + } + + emit(eventName: T, eventValue: EventMap[T]): void { + switch (eventName) { + case "typing": + if (eventValue === true) { + this.session?.sendEvent({ + contentType: "application/vnd.amazonaws.connect.event.typing", + }); + } + break; + } + } + + async processMessage(request: MessageRequest): Promise { + await this.session?.sendMessage({ + contentType: "text/plain", + message: request.messages.at(-1)?.text, + }); + } + + getSession(): connect.ActiveChatSession | undefined { + return this.session; + } +} diff --git a/packages/chat-core-aws-connect/src/models/AwsConnectEvent.ts b/packages/chat-core-aws-connect/src/models/AwsConnectEvent.ts new file mode 100644 index 0000000..942edef --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/AwsConnectEvent.ts @@ -0,0 +1,52 @@ +/** + * An event returned by an AWS Connect callback. + * + * @internal + */ +export interface AwsConnectEvent { + data: AwsConnectEventData; +} + +/** + * Data associated with an AWS Connect event. + * + * @public + */ +export interface AwsConnectEventData { + /** + * The time at which the event occurred. + */ + AbsoluteTime: string; + /** + * The ID of the AWS Connect contact associated with the event. + */ + ContactId: string; + /** + * The content of the event. + */ + Content: string; + /** + * The type of content in the event. + */ + ContentType: string; + /** + * The display name of the participant associated with the event. + */ + DisplayName: string; + /** + * The ID of the event. + */ + Id: string; + /** + * The ID of the participant associated with the event. + */ + ParticipantId: string; + /** + * The role of the participant associated with the event. + */ + ParticipantRole: string; + /** + * The type of the event. + */ + Type: string; +} diff --git a/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnect.ts b/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnect.ts new file mode 100644 index 0000000..b8c8bed --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnect.ts @@ -0,0 +1,53 @@ +import { MessageRequest, MessageResponse } from "@yext/chat-core"; +import { EventCallback, EventMap } from "./EventCallback"; + +/** + * Provides methods for interacting with Chat's AWS Connect integration. + * + * @public + */ +export interface ChatCoreAwsConnect { + /** + * Initialize the AWS Connect chat session using the credentials from the Chat API. + * + * @param messageResponse - The response returned from a successful call to the Chat API. + */ + init(messageResponse: MessageResponse): Promise; + + /** + * Register a callback for an event triggered within the AWS Connect chat session. + * Supported events are: + * - `message`: A new message has been received. + * - `typing`: The agent is typing. + * - `close`: The chat session has been closed. + * + * @param eventName - The name of the event to listen for. + * @param cb - The callback to be executed when the event is triggered. + */ + on(eventName: T, cb: EventCallback): void; + + /** + * Emit an event into the AWS Connect chat session. + * Supported events are: + * - `typing`: The customer is typing. + * + * @param eventName - The name of the event to emit. + * @param data - The data to be sent with the event. + */ + emit(eventName: T, data: EventMap[T]): void; + + /** + * Process a message sent by the user. + * + * @param request - The message sent by the user, in the Chat API format. + */ + processMessage(request: MessageRequest): Promise; + + /** + * Get the current AWS Connect chat session. + * + * @remarks + * If the session is not initialized, this method will return `undefined`. + */ + getSession(): connect.ActiveChatSession | undefined; +} diff --git a/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnectConfig.ts b/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnectConfig.ts new file mode 100644 index 0000000..396ba01 --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/ChatCoreAwsConnectConfig.ts @@ -0,0 +1,13 @@ +import { LoggerConfig } from "./LoggerConfig"; + +/** + * Configuration for this instance of the {@link ChatCoreAwsConnect}. + * + * @public + */ +export interface ChatCoreAwsConnectConfig { + /** + * Configuration for the internal logger of the AWS Connect Chat session. + */ + loggerConfig: LoggerConfig; +} diff --git a/packages/chat-core-aws-connect/src/models/EventCallback.ts b/packages/chat-core-aws-connect/src/models/EventCallback.ts new file mode 100644 index 0000000..a82ca01 --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/EventCallback.ts @@ -0,0 +1,21 @@ +import { AwsConnectEventData } from "./AwsConnectEvent"; + +/** + * A generic event callback, to be used when defining listeners for a {@link ChatCoreAwsConnect}. + * + * @public + */ +export type EventCallback = ( + arg: EventMap[T] +) => void; + +/** + * A map of events that can be emitted or listened for within a {@link ChatCoreAwsConnect} to their associated data types. + * + * @public + */ +export type EventMap = { + message: string; + typing: boolean; + close: AwsConnectEventData; +}; diff --git a/packages/chat-core-aws-connect/src/models/LoggerConfig.ts b/packages/chat-core-aws-connect/src/models/LoggerConfig.ts new file mode 100644 index 0000000..816b3fc --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/LoggerConfig.ts @@ -0,0 +1,64 @@ +/** + * Configuration for the internal logger of the AWS Connect Chat session. + * + * @public + */ +export interface LoggerConfig { + /** + * The log level for the logger. Can be one of DEBUG, INFO, WARN, ERROR, ADVANCED_LOG. Default is ERROR. + */ + level: LogLevel; + /** + * The custom logger to use. If provided, the default logger will be disabled. + */ + customizedLogger?: Logger; +} + +/** + * The log level for the logger. + * + * @remarks + * Only DEBUG, INFO, WARN, ERROR, ADVANCED_LOG are supported. + * Setting only applies while the AWS Connect chat session is active. + * + * @public + */ +export type LogLevel = "DEBUG" | "INFO" | "WARN" | "ERROR" | "ADVANCED_LOG"; + +/** + * The logger interface for the AWS Connect Chat session. + * + * @public + */ +export type Logger = { + /** + * Handler for log messages output at the `DEBUG` level. + * + * @param log - The incoming log message. + */ + debug?: (log: string) => void; + /** + * Handler for log messages output at the `INFO` level. + * + * @param log - The incoming log message. + */ + info?: (log: string) => void; + /** + * Handler for log messages output at the `WARN` level. + * + * @param log - The incoming log message. + */ + warn?: (log: string) => void; + /** + * Handler for log messages output at the `ERROR` level. + * + * @param log - The incoming log message. + */ + error?: (log: string) => void; + /** + * Handler for log messages output at the `ADVANCED_LOG` level. + * + * @param log - The incoming log message. + */ + advancedLog?: (log: string) => void; +}; diff --git a/packages/chat-core-aws-connect/src/models/connect.d.ts b/packages/chat-core-aws-connect/src/models/connect.d.ts new file mode 100644 index 0000000..d066e4c --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/connect.d.ts @@ -0,0 +1,10 @@ +import { ChatSession as AwsChatSession } from "amazon-connect-chatjs"; + +declare global { + namespace connect { + const ChatSession: typeof AwsChatSession; + const LogLevel: typeof AwsChatSession.LogLevel; + export type ActiveChatSession = ReturnType; + export type Logger = typeof AwsChatSession.Logger; + } +} \ No newline at end of file diff --git a/packages/chat-core-aws-connect/src/models/index.ts b/packages/chat-core-aws-connect/src/models/index.ts new file mode 100644 index 0000000..57f47c5 --- /dev/null +++ b/packages/chat-core-aws-connect/src/models/index.ts @@ -0,0 +1,5 @@ +export { ChatCoreAwsConnect } from "./ChatCoreAwsConnect"; +export { LoggerConfig, LogLevel, Logger } from "./LoggerConfig"; +export { EventMap, EventCallback } from "./EventCallback"; +export { ChatCoreAwsConnectConfig } from "./ChatCoreAwsConnectConfig"; +export { AwsConnectEventData } from "./AwsConnectEvent"; diff --git a/packages/chat-core-aws-connect/test-browser-esm/README.md b/packages/chat-core-aws-connect/test-browser-esm/README.md new file mode 100644 index 0000000..0c0cfb3 --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/README.md @@ -0,0 +1,16 @@ +## test-browser-esm + +This package contains setup to test browser and esm compatibility of chat-core. + +To test, make sure you have the following: + +- a .env file setup following the .sample.env file. +- a build for @yext/chat-core (run `npm run build` in the **root directory**) + +Then, run the following command to test: + +```bash +cd test-browser-esm && npm i && npm run build && npm run test +``` + +This will serve the index.html page on http://localhost:5050. Opening that up should show a button to trigger send a request with empty message array to chat API on domain "liveapi-dev.yext.com" using ChatCore and display the response (e.g. initial message) below. diff --git a/packages/chat-core-aws-connect/test-browser-esm/index.html b/packages/chat-core-aws-connect/test-browser-esm/index.html new file mode 100644 index 0000000..c94fe89 --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/index.html @@ -0,0 +1,17 @@ + + + + + Chat Core Test Site + + + + +

+
    + + diff --git a/packages/chat-core-aws-connect/test-browser-esm/package-lock.json b/packages/chat-core-aws-connect/test-browser-esm/package-lock.json new file mode 100644 index 0000000..d43e14a --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/package-lock.json @@ -0,0 +1,1499 @@ +{ + "name": "chat-core-test-browser", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "chat-core-test-browser", + "version": "0.1.0", + "dependencies": { + "@yext/chat-core": "^0.8.1", + "@yext/chat-core-aws-connect": "file:..", + "dotenv": "^16.0.3" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^24.1.0", + "@rollup/plugin-node-resolve": "^15.0.2", + "@rollup/plugin-replace": "^5.0.2", + "rollup": "^3.21.4", + "serve": "^14.2.0" + } + }, + "..": { + "version": "0.1.0", + "license": "BSD-3-Clause", + "dependencies": { + "amazon-connect-chatjs": "^2.3.0", + "cross-fetch": "^3.1.5", + "dotenv": "^16.4.5" + }, + "devDependencies": { + "@babel/preset-env": "^7.21.5", + "@babel/preset-typescript": "^7.21.5", + "@microsoft/api-documenter": "^7.22.4", + "@microsoft/api-extractor": "^7.34.8", + "@types/jest": "^29.5.1", + "@types/node-fetch": "^2.6.4", + "@yext/eslint-config": "^1.0.0", + "babel-jest": "^29.5.0", + "eslint": "^8.39.0", + "generate-license-file": "^1.0.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "prettier": "^2.8.8", + "rollup": "^3.29.0", + "rollup-plugin-typescript2": "^0.35.0", + "typescript": "^5.0.4" + }, + "peerDependencies": { + "@yext/chat-core": "^0.8.1" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "24.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.1.0.tgz", + "integrity": "sha512-eSL45hjhCWI0jCCXcNtLVqM5N1JlBGvlFfY0m6oOYnLCJ6N0qEXoZql4sY2MOUArzhH4SA/qBpTxvvZp2Sc+DQ==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "glob": "^8.0.3", + "is-reference": "1.2.1", + "magic-string": "^0.27.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-node-resolve": { + "version": "15.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.0.2.tgz", + "integrity": "sha512-Y35fRGUjC3FaurG722uhUuG8YHOJRJQbI6/CkbRkdPotSpDj9NtIN85z1zrcyDcCQIW4qp5mgG72U+gJ0TAFEg==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-builtin-module": "^3.2.1", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-replace": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-replace/-/plugin-replace-5.0.2.tgz", + "integrity": "sha512-M9YXNekv/C/iHHK+cvORzfRYfPbq0RDD8r0G+bMiTXjNGKulPnCT9O3Ss46WfhI6ZOCgApOP7xAdmCQJ+U2LAA==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "magic-string": "^0.27.0" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", + "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", + "dev": true, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@types/estree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", + "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==", + "dev": true + }, + "node_modules/@types/resolve": { + "version": "1.20.2", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz", + "integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==", + "dev": true + }, + "node_modules/@yext/chat-core": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@yext/chat-core/-/chat-core-0.8.1.tgz", + "integrity": "sha512-0+g1l9vrVFw+ix4rjlKU3pJo1uXYRyQjCZGZPKX3suHOXa5Bd9VxKbFJBfgSdHi9KHyhtkB5ZuDfj/zJwd6a0Q==", + "dependencies": { + "cross-fetch": "^3.1.5" + } + }, + "node_modules/@yext/chat-core-aws-connect": { + "resolved": "..", + "link": true + }, + "node_modules/@zeit/schemas": { + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.29.0.tgz", + "integrity": "sha512-g5QiLIfbg3pLuYUJPlisNKY+epQJTcMDsOnVNkscrDP1oi7vmJnzOANYJI/1pZcVJ6umUkBv3aFtlg1UvUHGzA==", + "dev": true + }, + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dev": true, + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ansi-align": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", + "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==", + "dev": true, + "dependencies": { + "string-width": "^4.1.0" + } + }, + "node_modules/ansi-align/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/ansi-align/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-align/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/arch": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", + "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/boxen": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-7.0.0.tgz", + "integrity": "sha512-j//dBVuyacJbvW+tvZ9HuH03fZ46QcaKvvhZickZqtB271DxJ7SNRSNxrV/dZX0085m7hISRZWbzWlJvx/rHSg==", + "dev": true, + "dependencies": { + "ansi-align": "^3.0.1", + "camelcase": "^7.0.0", + "chalk": "^5.0.1", + "cli-boxes": "^3.0.0", + "string-width": "^5.1.2", + "type-fest": "^2.13.0", + "widest-line": "^4.0.1", + "wrap-ansi": "^8.0.1" + }, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/boxen/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/builtin-modules": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.3.0.tgz", + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==", + "dev": true, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/camelcase": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-7.0.1.tgz", + "integrity": "sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==", + "dev": true, + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk-template": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", + "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/chalk-template?sponsor=1" + } + }, + "node_modules/cli-boxes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz", + "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/clipboardy": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/clipboardy/-/clipboardy-3.0.0.tgz", + "integrity": "sha512-Su+uU5sr1jkUy1sGRpLKjKrvEOVXgSgiSInwa/qeID6aJ07yh+5NWc3h2QfjHjBnfX4LhtFcuAWKUsJ3r+fjbg==", + "dev": true, + "dependencies": { + "arch": "^2.2.0", + "execa": "^5.1.1", + "is-wsl": "^2.2.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, + "node_modules/compressible": { + "version": "2.0.18", + "resolved": "https://registry.npmjs.org/compressible/-/compressible-2.0.18.tgz", + "integrity": "sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==", + "dev": true, + "dependencies": { + "mime-db": ">= 1.43.0 < 2" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/compression": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/compression/-/compression-1.7.4.tgz", + "integrity": "sha512-jaSIDzP9pZVS4ZfQ+TzvtiWhdpFhE2RDHz8QJkpX9SIpLq88VueF5jJw6t+6CUQcAoA6t+x89MLrWAqpfDE8iQ==", + "dev": true, + "dependencies": { + "accepts": "~1.3.5", + "bytes": "3.0.0", + "compressible": "~2.0.16", + "debug": "2.6.9", + "on-headers": "~1.0.2", + "safe-buffer": "5.1.2", + "vary": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/compression/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/content-disposition": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", + "integrity": "sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cross-fetch": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.8.tgz", + "integrity": "sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dotenv": { + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz", + "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==", + "engines": { + "node": ">=12" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "dev": true + }, + "node_modules/execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-url-parser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", + "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", + "dev": true, + "dependencies": { + "punycode": "^1.3.2" + } + }, + "node_modules/fast-url-parser/node_modules/punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", + "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true, + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/is-builtin-module": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-3.2.1.tgz", + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dev": true, + "dependencies": { + "builtin-modules": "^3.3.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", + "dev": true, + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==", + "dev": true + }, + "node_modules/is-port-reachable": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-port-reachable/-/is-port-reachable-4.0.0.tgz", + "integrity": "sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig==", + "dev": true, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "dev": true, + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-wsl": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", + "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", + "dev": true, + "dependencies": { + "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "node_modules/magic-string": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.27.0.tgz", + "integrity": "sha512-8UnnX2PeRAPZuN12svgR9j7M1uWMovg/CEnIwIG0LFkXSJJe4PdfUGiTGl8V9bsBHFUtfVINcSyYxd7q+kx9fA==", + "dev": true, + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.4.13" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/on-headers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz", + "integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==", + "dev": true + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-to-regexp": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-2.2.1.tgz", + "integrity": "sha512-gu9bD6Ta5bwGrrU8muHzVOBFFREpp2iRkVfhBJahwJ6p6Xw20SjT0MxLnwkjOibQmGSYhiUnf2FLe7k+jcFmGQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/punycode": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", + "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/range-parser": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz", + "integrity": "sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "dependencies": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "bin": { + "rc": "cli.js" + } + }, + "node_modules/registry-auth-token": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", + "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "dev": true, + "dependencies": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha512-ZbgR5aZEdf4UKZVBPYIgaglBmSF2Hi94s2PcIHhRGFjKYu+chjJdYfHn4rt3hB6eCKLJ8giVIIfgMa1ehDfZKA==", + "dev": true, + "dependencies": { + "rc": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.2", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz", + "integrity": "sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==", + "dev": true, + "dependencies": { + "is-core-module": "^2.11.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "3.21.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-3.21.4.tgz", + "integrity": "sha512-N5LxpvDolOm9ueiCp4NfB80omMDqb45ShtsQw2+OT3f11uJ197dv703NZvznYHP6RWR85wfxanXurXKG3ux2GQ==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=14.18.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/serve": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/serve/-/serve-14.2.0.tgz", + "integrity": "sha512-+HOw/XK1bW8tw5iBilBz/mJLWRzM8XM6MPxL4J/dKzdxq1vfdEWSwhaR7/yS8EJp5wzvP92p1qirysJvnEtjXg==", + "dev": true, + "dependencies": { + "@zeit/schemas": "2.29.0", + "ajv": "8.11.0", + "arg": "5.0.2", + "boxen": "7.0.0", + "chalk": "5.0.1", + "chalk-template": "0.4.0", + "clipboardy": "3.0.0", + "compression": "1.7.4", + "is-port-reachable": "4.0.0", + "serve-handler": "6.1.5", + "update-check": "1.5.4" + }, + "bin": { + "serve": "build/main.js" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/serve-handler": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/serve-handler/-/serve-handler-6.1.5.tgz", + "integrity": "sha512-ijPFle6Hwe8zfmBxJdE+5fta53fdIY0lHISJvuikXB3VYFafRjMRpOffSPvCYsbKyBA7pvy9oYr/BT1O3EArlg==", + "dev": true, + "dependencies": { + "bytes": "3.0.0", + "content-disposition": "0.5.2", + "fast-url-parser": "1.1.3", + "mime-types": "2.1.18", + "minimatch": "3.1.2", + "path-is-inside": "1.0.2", + "path-to-regexp": "2.2.1", + "range-parser": "1.2.0" + } + }, + "node_modules/serve-handler/node_modules/mime-db": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", + "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve-handler/node_modules/mime-types": { + "version": "2.1.18", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", + "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "dev": true, + "dependencies": { + "mime-db": "~1.33.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/serve/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/serve/node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true + }, + "node_modules/serve/node_modules/chalk": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.0.1.tgz", + "integrity": "sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==", + "dev": true, + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/serve/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/strip-ansi": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.0.1.tgz", + "integrity": "sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" + }, + "node_modules/type-fest": { + "version": "2.19.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz", + "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==", + "dev": true, + "engines": { + "node": ">=12.20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/update-check": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/update-check/-/update-check-1.5.4.tgz", + "integrity": "sha512-5YHsflzHP4t1G+8WGPlvKbJEbAJGCgw+Em+dGR1KmBUbr1J36SJBqlHLjR7oob7sco5hWHGQVcr9B2poIVDDTQ==", + "dev": true, + "dependencies": { + "registry-auth-token": "3.3.2", + "registry-url": "3.1.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/widest-line": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-4.0.1.tgz", + "integrity": "sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==", + "dev": true, + "dependencies": { + "string-width": "^5.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + } +} diff --git a/packages/chat-core-aws-connect/test-browser-esm/package.json b/packages/chat-core-aws-connect/test-browser-esm/package.json new file mode 100644 index 0000000..0aed9e3 --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/package.json @@ -0,0 +1,24 @@ +{ + "name": "chat-core-test-browser", + "version": "0.1.0", + "description": "test browser and esm compatibiliy of the chat-core", + "private": "true", + "type": "module", + "devDependencies": { + "@rollup/plugin-commonjs": "^24.1.0", + "@rollup/plugin-node-resolve": "^15.0.2", + "@rollup/plugin-replace": "^5.0.2", + "rollup": "^3.21.4", + "serve": "^14.2.0" + }, + "dependencies": { + "@yext/chat-core": "^0.8.2", + "@yext/chat-core-aws-connect": "file:..", + "dotenv": "^16.0.3" + }, + "scripts": { + "build": "rm -rf dist/** && rollup -c", + "test": "serve -p 5050" + }, + "author": "clippy@yext.com" +} diff --git a/packages/chat-core-aws-connect/test-browser-esm/rollup.config.js b/packages/chat-core-aws-connect/test-browser-esm/rollup.config.js new file mode 100644 index 0000000..e976c74 --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/rollup.config.js @@ -0,0 +1,27 @@ +import resolve from "@rollup/plugin-node-resolve"; +import commonjs from "@rollup/plugin-commonjs"; +import replace from "@rollup/plugin-replace"; +import dotenv from "dotenv"; +dotenv.config(); + +export default { + input: "src/script.js", + output: { + file: "dist/bundle.js", + format: "es", + }, + plugins: [ + replace({ + //inject env values + "process.env.TEST_BOT_API_KEY": JSON.stringify( + process.env.TEST_BOT_API_KEY + ), + "process.env.TEST_BOT_ID": JSON.stringify(process.env.TEST_BOT_ID), + }), + resolve({ + //resolve paths + browser: true, + }), + commonjs(), //resolve internal cjs deps + ], +}; diff --git a/packages/chat-core-aws-connect/test-browser-esm/sample.env b/packages/chat-core-aws-connect/test-browser-esm/sample.env new file mode 100644 index 0000000..98c4b20 --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/sample.env @@ -0,0 +1,2 @@ +TEST_BOT_ID= +TEST_BOT_API_KEY= \ No newline at end of file diff --git a/packages/chat-core-aws-connect/test-browser-esm/src/script.js b/packages/chat-core-aws-connect/test-browser-esm/src/script.js new file mode 100644 index 0000000..f9df42d --- /dev/null +++ b/packages/chat-core-aws-connect/test-browser-esm/src/script.js @@ -0,0 +1,59 @@ +import { provideChatCore } from "@yext/chat-core"; +import { provideChatCoreAwsConnect } from "@yext/chat-core-aws-connect"; + +let chatCore = provideChatCore({ + // will be replace with actual env value during rollup build process + apiKey: process.env.TEST_BOT_API_KEY || "API_KEY_PLACEHOLDER", + botId: process.env.TEST_BOT_ID, + endpoints: { + chat: `https://liveapi-dev.yext.com/v2/accounts/me/chat/${process.env.TEST_BOT_ID}/message`, + chatStream: `https://liveapi-dev.yext.com/v2/accounts/me/chat/${process.env.TEST_BOT_ID}/message/streaming`, + }, +}); + +let coreAws = provideChatCoreAwsConnect(); +const msgInput = document.getElementById("messageInput"); +window.getNextMessage = async () => { + const req = { + messages: [ + { + timestamp: "2023-05-17T19:21:21.915Z", + source: "USER", + text: msgInput.value, + }, + ], + }; + + const msgs = document.getElementById("messages"); + if (coreAws.getSession()) { + await coreAws.processMessage(req); + const li = document.createElement("li"); + li.textContent = "USER: " + msgInput.value; + msgs.appendChild(li); + } else { + const data = await chatCore.getNextMessage(req); + const el = document.getElementById("chatresult"); + el.textContent = JSON.stringify(data, null, 2); + + if (data?.integrationDetails?.awsConnectHandoff?.credentials) { + coreAws = provideChatCoreAwsConnect(); + coreAws.on("message", (message) => { + const li = document.createElement("li"); + li.textContent = "CONNECT: " + message; + msgs.appendChild(li); + }); + + coreAws.on("close", (_) => { + const li = document.createElement("li"); + li.textContent = "DISCONNECT"; + msgs.appendChild(li); + }); + + msgInput.addEventListener("keypress", async () => { + coreAws.emit("typing"); + }); + + await coreAws.init(data); + } + } +}; diff --git a/packages/chat-core-aws-connect/tests/ChatCoreAwsConnect.test.ts b/packages/chat-core-aws-connect/tests/ChatCoreAwsConnect.test.ts new file mode 100644 index 0000000..af4a98d --- /dev/null +++ b/packages/chat-core-aws-connect/tests/ChatCoreAwsConnect.test.ts @@ -0,0 +1,349 @@ +import { provideChatCoreAwsConnect } from "../src/CoreAwsConnectProvider"; +import { MessageResponse } from "@yext/chat-core"; +import { LoggerConfig } from "../src/models/LoggerConfig"; +import { + AwsConnectEvent, + AwsConnectEventData, +} from "../src/models/AwsConnectEvent"; +import "amazon-connect-chatjs"; + +const createSpy = jest.fn().mockReturnValue(mockChatSession()); +const globalConfigSpy = jest.fn(); +let sess: connect.ActiveChatSession; + +beforeAll(() => { + global.window.connect = { + ...global.window.connect, + ChatSession: { + ...global.window.connect.ChatSession, + create: createSpy, + setGlobalConfig: globalConfigSpy, + }, + }; +}); + +beforeEach(() => { + jest.useFakeTimers(); + sess = mockChatSession(); + createSpy.mockReturnValue(sess); +}); + +afterEach(() => { + jest.clearAllMocks(); +}); + +function mockChatSession(): connect.ActiveChatSession { + return { + onMessage(_: (event: DeepPartial) => void) { + return null; + }, + onEnded(_: (event: DeepPartial) => void) { + return null; + }, + onTyping(_: (event: DeepPartial) => void) { + return null; + }, + sendEvent() { + return null; + }, + sendMessage() { + return null; + }, + connect() { + return { connectCalled: true, connectSuccess: true }; + }, + } as unknown as connect.ActiveChatSession; +} + +function mockMessageResponse(): MessageResponse { + return { + notes: { + conversationSummary: "conversationSummary", + }, + message: { + source: "BOT", + text: "text", + }, + integrationDetails: { + awsConnectHandoff: { + credentials: { + contactId: "contactId", + participantId: "participantId", + participantToken: "participantToken", + }, + region: "us-east-1", + }, + }, + }; +} + +it("returns an error when failing to connect to chat session", async () => { + sess.connect = () => { + return { connectCalled: true, connectSuccess: false }; + }; + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await expect( + chatCoreAwsConnect.init(mockMessageResponse()) + ).rejects.toThrowError("Failed to connect to chat session"); +}); + +it("returns no error when successfully connecting to chat session", async () => { + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await expect( + chatCoreAwsConnect.init(mockMessageResponse()) + ).resolves.toBeUndefined(); +}); + +it("sends conversation summary message on chat session initialization", async () => { + const sendMessageSpy = jest.spyOn(sess, "sendMessage"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + expect(sendMessageSpy).toBeCalledWith({ + contentType: "text/plain", + message: "conversationSummary", + }); +}); + +it("emits typing event", async () => { + const sendEventSpy = jest.spyOn(sess, "sendEvent"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + chatCoreAwsConnect.emit("typing", true); + + expect(sendEventSpy).toBeCalledWith({ + contentType: "application/vnd.amazonaws.connect.event.typing", + }); + + sendEventSpy.mockClear(); + chatCoreAwsConnect.emit("typing", false); + + expect(sendEventSpy).not.toBeCalled(); +}); + +it("sends message on processMessage", async () => { + const sendMessageSpy = jest.spyOn(sess, "sendMessage"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const msg = "hello world!"; + await chatCoreAwsConnect.processMessage({ + messages: [ + { + source: "USER", + text: msg, + }, + ], + }); + + expect(sendMessageSpy).toBeCalledWith({ + contentType: "text/plain", + message: msg, + }); +}); + +it("logs warning when session already exists", async () => { + const consoleWarnSpy = jest.spyOn(console, "warn"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + await chatCoreAwsConnect.init(mockMessageResponse()); + + expect(consoleWarnSpy).toBeCalledWith("Chat session already initialized"); +}); + +it("returns error when integration credentials are not specified", async () => { + const messageResponse = mockMessageResponse(); + delete messageResponse.integrationDetails; + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await expect(chatCoreAwsConnect.init(messageResponse)).rejects.toThrowError( + "Integration credentials not specified. Cannot initialize chat session." + ); +}); + +it("returns session on getSession", async () => { + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + expect(chatCoreAwsConnect.getSession()).toBe(sess); +}); + +it("uses logger config when provided", async () => { + const loggerConfig: LoggerConfig = { + level: "DEBUG", + customizedLogger: { + debug: jest.fn(), + }, + }; + + const chatCoreAwsConnect = provideChatCoreAwsConnect({ loggerConfig }); + await chatCoreAwsConnect.init(mockMessageResponse()); + + expect(globalConfigSpy).toBeCalledWith({ + loggerConfig: { + level: connect.LogLevel.DEBUG, + useDefaultLogger: false, + customizedLogger: loggerConfig.customizedLogger, + }, + region: "us-east-1", + }); +}); + +type DeepPartial = { + [P in keyof T]?: T[P] extends object ? DeepPartial : T[P]; +}; +type AwsEventCallback = (event: DeepPartial) => void; + +it("triggers message event callbacks", async () => { + const onMessageSpy = jest.spyOn(sess, "onMessage"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const msgText = "hello world!"; + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("message", (event: string) => { + expect(event).toBe(msgText); + dummyFn(); + }); + expect(onMessageSpy).toBeCalled(); + + // get the parameter passed to the onMessage callback + const onMessageFn = onMessageSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate a message event + onMessageFn({ + data: { + ContentType: "text/plain", + ParticipantRole: "AGENT", + Content: msgText, + }, + }); + + expect(dummyFn).toBeCalled(); +}); + +it("triggers close event callbacks", async () => { + const onEndedSpy = jest.spyOn(sess, "onEnded"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const endEvent: DeepPartial = { + data: { ContentType: "text/plain", ParticipantRole: "AGENT", Type: "END" }, + }; + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("close", (event: AwsConnectEventData) => { + expect(event).toStrictEqual(endEvent.data); + dummyFn(); + }); + expect(onEndedSpy).toBeCalled(); + + // get the parameter passed to the onEnded callback + const onEndedFn = onEndedSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate an ended event + onEndedFn({ ...endEvent }); + + expect(dummyFn).toBeCalled(); +}); + +it("triggers typing event callbacks", async () => { + const onTypingSpy = jest.spyOn(sess, "onTyping"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("typing", (event: boolean) => { + expect(event).toBe(true); + dummyFn(); + }); + expect(onTypingSpy).toBeCalled(); + + // get the parameter passed to the onTyping callback + const onTypingFn = onTypingSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate a typing event + onTypingFn({ data: { ParticipantRole: "AGENT", Type: "TYPING" } }); + + expect(dummyFn).toBeCalled(); +}); + +it("sets a timeout to turn off typing indicator", async () => { + jest.useFakeTimers(); + const onTypingSpy = jest.spyOn(sess, "onTyping"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("typing", dummyFn); + + // get the parameter passed to the onTyping callback + const onTypingFn = onTypingSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate a typing event + onTypingFn({ data: { ParticipantRole: "AGENT", Type: "TYPING" } }); + + expect(dummyFn).toBeCalledTimes(1); + + // advance time by 5s + jest.advanceTimersByTime(5000); + + expect(dummyFn).toBeCalledTimes(2); +}); + +it("ignores non-agent messages", async () => { + const onMessageSpy = jest.spyOn(sess, "onMessage"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("message", dummyFn); + + // get the parameter passed to the onMessage callback + const onMessageFn = onMessageSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate a message event + onMessageFn({ + data: { + ContentType: "text/plain", + ParticipantRole: "CUSTOMER", + Content: "hello world!", + }, + }); + + expect(dummyFn).not.toBeCalled(); +}); + +it("ignores messages with non-text content type", async () => { + const onMessageSpy = jest.spyOn(sess, "onMessage"); + + const chatCoreAwsConnect = provideChatCoreAwsConnect(); + await chatCoreAwsConnect.init(mockMessageResponse()); + + const dummyFn = jest.fn(); + chatCoreAwsConnect.on("message", dummyFn); + + // get the parameter passed to the onMessage callback + const onMessageFn = onMessageSpy.mock.calls[0][0] as AwsEventCallback; + + // simulate a message event + onMessageFn({ + data: { + ContentType: "application/json", + ParticipantRole: "AGENT", + Content: "hello world!", + }, + }); + + expect(dummyFn).not.toBeCalled(); +}); diff --git a/packages/chat-core-aws-connect/tests/jest-setup.js b/packages/chat-core-aws-connect/tests/jest-setup.js new file mode 100644 index 0000000..737a39b --- /dev/null +++ b/packages/chat-core-aws-connect/tests/jest-setup.js @@ -0,0 +1,8 @@ +import { TextDecoder, TextEncoder } from "util"; + +/** + * jest's jsdom doesn't have the following properties defined in global for the DOM. + * polyfill it with functions from NodeJS + */ +global.TextDecoder = TextDecoder; +global.TextEncoder = TextEncoder; diff --git a/packages/chat-core-aws-connect/tsconfig.cjs.json b/packages/chat-core-aws-connect/tsconfig.cjs.json new file mode 100644 index 0000000..136d9de --- /dev/null +++ b/packages/chat-core-aws-connect/tsconfig.cjs.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "target": "ESNext", + "module": "commonjs", + "outDir": "dist/commonjs" + } +} diff --git a/packages/chat-core-aws-connect/tsconfig.esm.json b/packages/chat-core-aws-connect/tsconfig.esm.json new file mode 100644 index 0000000..76c2936 --- /dev/null +++ b/packages/chat-core-aws-connect/tsconfig.esm.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "target": "ESNext", + "module": "ESNext", + "outDir": "dist/esm" + } +} diff --git a/packages/chat-core-aws-connect/tsconfig.json b/packages/chat-core-aws-connect/tsconfig.json new file mode 100644 index 0000000..5f1d6a3 --- /dev/null +++ b/packages/chat-core-aws-connect/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "target": "ESNext", + "moduleResolution": "node", + "forceConsistentCasingInFileNames": true, + "declaration": true, + "declarationMap": false, + "sourceMap": true, + "resolveJsonModule": true + }, + "include": ["./src/**/*"] +}