@yext/chat-ui-react 0.6.0-alpha.38 → 0.6.0-alpha.38.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/package.json.js +1 -136
- package/lib/commonjs/package.json.js.map +1 -1
- package/lib/commonjs/src/components/ChatInput.js +5 -1
- package/lib/commonjs/src/components/ChatInput.js.map +1 -1
- package/lib/commonjs/src/components/Markdown.js +11 -4
- package/lib/commonjs/src/components/Markdown.js.map +1 -1
- package/lib/commonjs/src/hooks/useReportAnalyticsEvent.d.ts.map +1 -1
- package/lib/commonjs/src/hooks/useReportAnalyticsEvent.js +1 -2
- package/lib/commonjs/src/hooks/useReportAnalyticsEvent.js.map +1 -1
- package/lib/esm/package.json.mjs +2 -119
- package/lib/esm/package.json.mjs.map +1 -1
- package/lib/esm/src/hooks/useReportAnalyticsEvent.d.ts.map +1 -1
- package/lib/esm/src/hooks/useReportAnalyticsEvent.mjs +1 -2
- package/lib/esm/src/hooks/useReportAnalyticsEvent.mjs.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useReportAnalyticsEvent.ts +1 -2
|
@@ -1,141 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var version = "0.6.0-alpha.38.2";
|
|
4
4
|
|
|
5
|
-
var name = "@yext/chat-ui-react";
|
|
6
|
-
var version = "0.6.0-alpha.38";
|
|
7
|
-
var description = "A library of React Components for powering Yext Chat integrations.";
|
|
8
|
-
var author = "clippy@yext.com";
|
|
9
|
-
var main = "./lib/commonjs/src/index.js";
|
|
10
|
-
var module$1 = "./lib/esm/src/index.mjs";
|
|
11
|
-
var types = "./lib/esm/src/index.d.ts";
|
|
12
|
-
var sideEffects = false;
|
|
13
|
-
var exports$1 = {
|
|
14
|
-
".": {
|
|
15
|
-
"import": "./lib/esm/src/index.mjs",
|
|
16
|
-
require: "./lib/commonjs/src/index.js"
|
|
17
|
-
},
|
|
18
|
-
"./bundle.css": "./lib/bundle.css"
|
|
19
|
-
};
|
|
20
|
-
var license = "BSD-3-Clause";
|
|
21
|
-
var files = [
|
|
22
|
-
"lib",
|
|
23
|
-
"src",
|
|
24
|
-
"THIRD-PARTY-NOTICES",
|
|
25
|
-
"LICENSE"
|
|
26
|
-
];
|
|
27
|
-
var keywords = [
|
|
28
|
-
"chat",
|
|
29
|
-
"ai",
|
|
30
|
-
"yext",
|
|
31
|
-
"react",
|
|
32
|
-
"components",
|
|
33
|
-
"tailwindcss"
|
|
34
|
-
];
|
|
35
|
-
var scripts = {
|
|
36
|
-
lint: "prettier --write . && eslint --fix --max-warnings=0 .",
|
|
37
|
-
test: "jest --config=jest.config.json",
|
|
38
|
-
storybook: "storybook dev -p 6006",
|
|
39
|
-
dev: "tsc --watch -p tsconfig.json",
|
|
40
|
-
"generate-docs": "api-extractor run --local --verbose && api-documenter markdown --input-folder temp --output-folder docs && rm -rf temp",
|
|
41
|
-
"generate-notices": "generate-license-file --input package.json --output ./THIRD-PARTY-NOTICES --overwrite",
|
|
42
|
-
postcss: "postcss",
|
|
43
|
-
tailwindcss: "tailwindcss",
|
|
44
|
-
"build:css": "./scoped-bundle.sh",
|
|
45
|
-
"build:js": "rollup --config rollup.config.mjs",
|
|
46
|
-
build: "rm -rf lib/** && npm run build:js && npm run build:css && npm run generate-docs && npm run generate-notices",
|
|
47
|
-
"build-storybook": "storybook build"
|
|
48
|
-
};
|
|
49
|
-
var devDependencies = {
|
|
50
|
-
"@babel/core": "^7.21.8",
|
|
51
|
-
"@babel/preset-env": "^7.21.5",
|
|
52
|
-
"@babel/preset-react": "^7.18.6",
|
|
53
|
-
"@babel/preset-typescript": "^7.21.5",
|
|
54
|
-
"@microsoft/api-documenter": "^7.22.8",
|
|
55
|
-
"@microsoft/api-extractor": "^7.35.1",
|
|
56
|
-
"@rollup/plugin-json": "^6.0.0",
|
|
57
|
-
"@storybook/addon-essentials": "^7.0.18",
|
|
58
|
-
"@storybook/addon-interactions": "^7.0.18",
|
|
59
|
-
"@storybook/addon-links": "^7.0.18",
|
|
60
|
-
"@storybook/blocks": "^7.0.18",
|
|
61
|
-
"@storybook/react": "^7.0.17",
|
|
62
|
-
"@storybook/react-vite": "^7.0.17",
|
|
63
|
-
"@storybook/testing-library": "^0.1.0",
|
|
64
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
65
|
-
"@tailwindcss/typography": "^0.5.9",
|
|
66
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
67
|
-
"@testing-library/react": "^14.0.0",
|
|
68
|
-
"@testing-library/user-event": "^14.4.3",
|
|
69
|
-
"@types/jest": "^29.5.1",
|
|
70
|
-
"@types/react": "^18.2.7",
|
|
71
|
-
"@yext/chat-headless-react": "^0.5.6",
|
|
72
|
-
"@yext/eslint-config": "^1.0.0",
|
|
73
|
-
"babel-jest": "^29.5.0",
|
|
74
|
-
eslint: "^8.39.0",
|
|
75
|
-
"eslint-plugin-storybook": "^0.6.12",
|
|
76
|
-
"generate-license-file": "^2.0.0",
|
|
77
|
-
jest: "^29.5.0",
|
|
78
|
-
"jest-environment-jsdom": "^29.5.0",
|
|
79
|
-
msw: "^1.2.1",
|
|
80
|
-
"msw-storybook-addon": "^1.8.0",
|
|
81
|
-
"postcss-cli": "^10.1.0",
|
|
82
|
-
"postcss-nested": "^6.0.1",
|
|
83
|
-
prettier: "^2.8.8",
|
|
84
|
-
react: "^18.2.0",
|
|
85
|
-
"react-dom": "^18.2.0",
|
|
86
|
-
rollup: "^3.28.1",
|
|
87
|
-
"rollup-plugin-typescript2": "^0.35.0",
|
|
88
|
-
storybook: "^7.0.17",
|
|
89
|
-
tailwindcss: "^3.3.2",
|
|
90
|
-
typescript: "^5.0.4"
|
|
91
|
-
};
|
|
92
|
-
var peerDependencies = {
|
|
93
|
-
"@yext/chat-headless-react": "^0.5.4",
|
|
94
|
-
react: "^16.14 || ^17 || ^18",
|
|
95
|
-
"react-dom": "^16.14 || ^17 || || ^18"
|
|
96
|
-
};
|
|
97
|
-
var dependencies = {
|
|
98
|
-
"react-markdown": "^6.0.3",
|
|
99
|
-
"react-textarea-autosize": "^8.5.3",
|
|
100
|
-
"rehype-raw": "^5.0.0",
|
|
101
|
-
"rehype-sanitize": "^4.0.0",
|
|
102
|
-
"remark-gfm": "^1.0.0",
|
|
103
|
-
"tailwind-merge": "^1.12.0"
|
|
104
|
-
};
|
|
105
|
-
var packageJson = {
|
|
106
|
-
name: name,
|
|
107
|
-
version: version,
|
|
108
|
-
description: description,
|
|
109
|
-
author: author,
|
|
110
|
-
main: main,
|
|
111
|
-
module: module$1,
|
|
112
|
-
types: types,
|
|
113
|
-
sideEffects: sideEffects,
|
|
114
|
-
exports: exports$1,
|
|
115
|
-
license: license,
|
|
116
|
-
files: files,
|
|
117
|
-
keywords: keywords,
|
|
118
|
-
scripts: scripts,
|
|
119
|
-
devDependencies: devDependencies,
|
|
120
|
-
peerDependencies: peerDependencies,
|
|
121
|
-
dependencies: dependencies
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
exports.author = author;
|
|
125
|
-
exports.default = packageJson;
|
|
126
|
-
exports.dependencies = dependencies;
|
|
127
|
-
exports.description = description;
|
|
128
|
-
exports.devDependencies = devDependencies;
|
|
129
|
-
exports.exports = exports$1;
|
|
130
|
-
exports.files = files;
|
|
131
|
-
exports.keywords = keywords;
|
|
132
|
-
exports.license = license;
|
|
133
|
-
exports.main = main;
|
|
134
|
-
exports.module = module$1;
|
|
135
|
-
exports.name = name;
|
|
136
|
-
exports.peerDependencies = peerDependencies;
|
|
137
|
-
exports.scripts = scripts;
|
|
138
|
-
exports.sideEffects = sideEffects;
|
|
139
|
-
exports.types = types;
|
|
140
5
|
exports.version = version;
|
|
141
6
|
//# sourceMappingURL=package.json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -9,6 +9,10 @@ var TextareaAutosize = require('react-textarea-autosize');
|
|
|
9
9
|
var useDefaultHandleApiError = require('../hooks/useDefaultHandleApiError.js');
|
|
10
10
|
var withStylelessCssClasses = require('../utils/withStylelessCssClasses.js');
|
|
11
11
|
|
|
12
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var TextareaAutosize__default = /*#__PURE__*/_interopDefault(TextareaAutosize);
|
|
15
|
+
|
|
12
16
|
const builtInCssClasses = withStylelessCssClasses.withStylelessCssClasses("Input", {
|
|
13
17
|
container: "w-full h-fit flex flex-row relative @container",
|
|
14
18
|
textArea: "w-full p-4 pr-12 border border-slate-300 rounded-3xl resize-none text-[13px] @[480px]:text-base placeholder:text-[13px] placeholder:@[480px]:text-base text-slate-900",
|
|
@@ -49,7 +53,7 @@ function ChatInput({ placeholder = "Type a message...", stream = false, inputAut
|
|
|
49
53
|
const onInputChange = react.useCallback((e) => {
|
|
50
54
|
setInput(e.target.value);
|
|
51
55
|
}, []);
|
|
52
|
-
return (jsxRuntime.jsxs("div", { className: cssClasses.container, children: [jsxRuntime.jsx(
|
|
56
|
+
return (jsxRuntime.jsxs("div", { className: cssClasses.container, children: [jsxRuntime.jsx(TextareaAutosize__default.default, { autoFocus: inputAutoFocus, onKeyDown: handleKeyDown, value: input, onChange: onInputChange, className: cssClasses.textArea, placeholder: placeholder }), jsxRuntime.jsx("button", { "aria-label": "Send Message", disabled: !canSendMessage || input.trim().length === 0, onClick: sendMessage, className: cssClasses.sendButton, children: sendButtonIcon })] }));
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
exports.ChatInput = ChatInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatInput.js","sources":["../../../../src/components/ChatInput.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { useChatActions, useChatState } from \"@yext/chat-headless-react\";\nimport { ArrowIcon } from \"../icons/Arrow\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport TextareaAutosize from \"react-textarea-autosize\";\nimport { useDefaultHandleApiError } from \"../hooks/useDefaultHandleApiError\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\n\n/**\n * The CSS class interface for the {@link ChatInput} component.\n *\n * @public\n */\nexport interface ChatInputCssClasses {\n container?: string;\n textArea?: string;\n sendButton?: string;\n}\n\nconst builtInCssClasses: ChatInputCssClasses = withStylelessCssClasses(\n \"Input\",\n {\n container: \"w-full h-fit flex flex-row relative @container\",\n textArea:\n \"w-full p-4 pr-12 border border-slate-300 rounded-3xl resize-none text-[13px] @[480px]:text-base placeholder:text-[13px] placeholder:@[480px]:text-base text-slate-900\",\n sendButton:\n \"rounded-full p-1.5 w-8 h-8 stroke-2 text-white bg-blue-600 disabled:bg-slate-200 hover:bg-blue-800 active:scale-90 transition-all absolute right-4 bottom-2.5 @[480px]:bottom-3.5\",\n }\n);\n\n/**\n * The props for the {@link ChatInput} component.\n *\n * @public\n */\nexport interface ChatInputProps {\n /**\n * The input's placeholder text when no text has been entered by the user.\n * Defaults to \"Type a message...\".\n */\n placeholder?: string;\n /**\n * Enable streaming behavior by making a request to Chat Streaming API.\n * This feature is experimental, and is subject to change.\n * Defaults to false.\n */\n stream?: boolean;\n /** Enable auto focus for the input box. Defaults to false. */\n inputAutoFocus?: boolean;\n /**\n * A function which is called when an error occurs from Chat API while processing the user's message.\n * By default, the error is logged to the console and an error message is added to state.\n */\n handleError?: (e: unknown) => void;\n /** Custom icon for the send button. */\n sendButtonIcon?: JSX.Element;\n /** CSS classes for customizing the component styling. */\n customCssClasses?: ChatInputCssClasses;\n}\n\n/**\n * A component that allows user to input message and send to Chat API.\n *\n * @remarks\n * Pressing \"Enter\" key will send the current message.\n * To add a newline, press \"Shift\" and \"Enter\".\n *\n * @public\n *\n * @param props - {@link ChatInputProps}\n */\nexport function ChatInput({\n placeholder = \"Type a message...\",\n stream = false,\n inputAutoFocus = false,\n handleError,\n sendButtonIcon = <ArrowIcon />,\n customCssClasses,\n}: ChatInputProps) {\n const chat = useChatActions();\n const [input, setInput] = useState(\"\");\n const canSendMessage = useChatState(\n (state) => state.conversation.canSendMessage\n );\n const defaultHandleApiError = useDefaultHandleApiError();\n\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n\n const sendMessage = useCallback(async () => {\n const res = stream\n ? chat.streamNextMessage(input)\n : chat.getNextMessage(input);\n setInput(\"\");\n res.catch((e) => (handleError ? handleError(e) : defaultHandleApiError(e)));\n }, [chat, input, handleError, defaultHandleApiError, stream]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (!e.shiftKey && e.key === \"Enter\") {\n e.preventDefault();\n if (canSendMessage && input.trim().length !== 0) {\n sendMessage();\n }\n }\n },\n [sendMessage, canSendMessage, input]\n );\n\n const onInputChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n },\n []\n );\n\n return (\n <div className={cssClasses.container}>\n <TextareaAutosize\n autoFocus={inputAutoFocus}\n onKeyDown={handleKeyDown}\n value={input}\n onChange={onInputChange}\n className={cssClasses.textArea}\n placeholder={placeholder}\n />\n <button\n aria-label=\"Send Message\"\n disabled={!canSendMessage || input.trim().length === 0}\n onClick={sendMessage}\n className={cssClasses.sendButton}\n >\n {sendButtonIcon}\n </button>\n </div>\n );\n}\n"],"names":["withStylelessCssClasses","_jsx","ArrowIcon","useChatActions","useState","useChatState","useDefaultHandleApiError","useComposedCssClasses","useCallback","_jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatInput.js","sources":["../../../../src/components/ChatInput.tsx"],"sourcesContent":["import { useCallback, useState } from \"react\";\nimport { useChatActions, useChatState } from \"@yext/chat-headless-react\";\nimport { ArrowIcon } from \"../icons/Arrow\";\nimport { useComposedCssClasses } from \"../hooks\";\nimport TextareaAutosize from \"react-textarea-autosize\";\nimport { useDefaultHandleApiError } from \"../hooks/useDefaultHandleApiError\";\nimport { withStylelessCssClasses } from \"../utils/withStylelessCssClasses\";\n\n/**\n * The CSS class interface for the {@link ChatInput} component.\n *\n * @public\n */\nexport interface ChatInputCssClasses {\n container?: string;\n textArea?: string;\n sendButton?: string;\n}\n\nconst builtInCssClasses: ChatInputCssClasses = withStylelessCssClasses(\n \"Input\",\n {\n container: \"w-full h-fit flex flex-row relative @container\",\n textArea:\n \"w-full p-4 pr-12 border border-slate-300 rounded-3xl resize-none text-[13px] @[480px]:text-base placeholder:text-[13px] placeholder:@[480px]:text-base text-slate-900\",\n sendButton:\n \"rounded-full p-1.5 w-8 h-8 stroke-2 text-white bg-blue-600 disabled:bg-slate-200 hover:bg-blue-800 active:scale-90 transition-all absolute right-4 bottom-2.5 @[480px]:bottom-3.5\",\n }\n);\n\n/**\n * The props for the {@link ChatInput} component.\n *\n * @public\n */\nexport interface ChatInputProps {\n /**\n * The input's placeholder text when no text has been entered by the user.\n * Defaults to \"Type a message...\".\n */\n placeholder?: string;\n /**\n * Enable streaming behavior by making a request to Chat Streaming API.\n * This feature is experimental, and is subject to change.\n * Defaults to false.\n */\n stream?: boolean;\n /** Enable auto focus for the input box. Defaults to false. */\n inputAutoFocus?: boolean;\n /**\n * A function which is called when an error occurs from Chat API while processing the user's message.\n * By default, the error is logged to the console and an error message is added to state.\n */\n handleError?: (e: unknown) => void;\n /** Custom icon for the send button. */\n sendButtonIcon?: JSX.Element;\n /** CSS classes for customizing the component styling. */\n customCssClasses?: ChatInputCssClasses;\n}\n\n/**\n * A component that allows user to input message and send to Chat API.\n *\n * @remarks\n * Pressing \"Enter\" key will send the current message.\n * To add a newline, press \"Shift\" and \"Enter\".\n *\n * @public\n *\n * @param props - {@link ChatInputProps}\n */\nexport function ChatInput({\n placeholder = \"Type a message...\",\n stream = false,\n inputAutoFocus = false,\n handleError,\n sendButtonIcon = <ArrowIcon />,\n customCssClasses,\n}: ChatInputProps) {\n const chat = useChatActions();\n const [input, setInput] = useState(\"\");\n const canSendMessage = useChatState(\n (state) => state.conversation.canSendMessage\n );\n const defaultHandleApiError = useDefaultHandleApiError();\n\n const cssClasses = useComposedCssClasses(builtInCssClasses, customCssClasses);\n\n const sendMessage = useCallback(async () => {\n const res = stream\n ? chat.streamNextMessage(input)\n : chat.getNextMessage(input);\n setInput(\"\");\n res.catch((e) => (handleError ? handleError(e) : defaultHandleApiError(e)));\n }, [chat, input, handleError, defaultHandleApiError, stream]);\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (!e.shiftKey && e.key === \"Enter\") {\n e.preventDefault();\n if (canSendMessage && input.trim().length !== 0) {\n sendMessage();\n }\n }\n },\n [sendMessage, canSendMessage, input]\n );\n\n const onInputChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInput(e.target.value);\n },\n []\n );\n\n return (\n <div className={cssClasses.container}>\n <TextareaAutosize\n autoFocus={inputAutoFocus}\n onKeyDown={handleKeyDown}\n value={input}\n onChange={onInputChange}\n className={cssClasses.textArea}\n placeholder={placeholder}\n />\n <button\n aria-label=\"Send Message\"\n disabled={!canSendMessage || input.trim().length === 0}\n onClick={sendMessage}\n className={cssClasses.sendButton}\n >\n {sendButtonIcon}\n </button>\n </div>\n );\n}\n"],"names":["withStylelessCssClasses","_jsx","ArrowIcon","useChatActions","useState","useChatState","useDefaultHandleApiError","useComposedCssClasses","useCallback","_jsxs","TextareaAutosize"],"mappings":";;;;;;;;;;;;;;;AAmBA,MAAM,iBAAiB,GAAwBA,+CAAuB,CACpE,OAAO,EACP;AACE,IAAA,SAAS,EAAE,gDAAgD;AAC3D,IAAA,QAAQ,EACN,uKAAuK;AACzK,IAAA,UAAU,EACR,mLAAmL;AACtL,CAAA,CACF,CAAC;AAgCF;;;;;;;;;;AAUG;AACG,SAAU,SAAS,CAAC,EACxB,WAAW,GAAG,mBAAmB,EACjC,MAAM,GAAG,KAAK,EACd,cAAc,GAAG,KAAK,EACtB,WAAW,EACX,cAAc,GAAGC,cAAA,CAACC,eAAS,EAAA,EAAA,CAAG,EAC9B,gBAAgB,GACD,EAAA;AACf,IAAA,MAAM,IAAI,GAAGC,gCAAc,EAAE,CAAC;IAC9B,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAGC,cAAQ,CAAC,EAAE,CAAC,CAAC;AACvC,IAAA,MAAM,cAAc,GAAGC,8BAAY,CACjC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY,CAAC,cAAc,CAC7C,CAAC;AACF,IAAA,MAAM,qBAAqB,GAAGC,iDAAwB,EAAE,CAAC;IAEzD,MAAM,UAAU,GAAGC,2CAAqB,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AAE9E,IAAA,MAAM,WAAW,GAAGC,iBAAW,CAAC,YAAW;QACzC,MAAM,GAAG,GAAG,MAAM;AAChB,cAAE,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC;AAC/B,cAAE,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC/B,QAAQ,CAAC,EAAE,CAAC,CAAC;QACb,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9E,KAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,CAAC,CAAC,CAAC;AAE9D,IAAA,MAAM,aAAa,GAAGA,iBAAW,CAC/B,CAAC,CAA2C,KAAI;QAC9C,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE;YACpC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,IAAI,cAAc,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAC/C,gBAAA,WAAW,EAAE,CAAC;AACf,aAAA;AACF,SAAA;KACF,EACD,CAAC,WAAW,EAAE,cAAc,EAAE,KAAK,CAAC,CACrC,CAAC;AAEF,IAAA,MAAM,aAAa,GAAGA,iBAAW,CAC/B,CAAC,CAAyC,KAAI;AAC5C,QAAA,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;KAC1B,EACD,EAAE,CACH,CAAC;AAEF,IAAA,QACEC,eAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,UAAU,CAAC,SAAS,EAClC,QAAA,EAAA,CAAAR,cAAA,CAACS,iCAAgB,EAAA,EACf,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,UAAU,CAAC,QAAQ,EAC9B,WAAW,EAAE,WAAW,EACxB,CAAA,EACFT,cACa,CAAA,QAAA,EAAA,EAAA,YAAA,EAAA,cAAc,EACzB,QAAQ,EAAE,CAAC,cAAc,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EACtD,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,UAAU,CAAC,UAAU,EAE/B,QAAA,EAAA,cAAc,EACR,CAAA,CAAA,EAAA,CACL,EACN;AACJ;;;;"}
|
|
@@ -8,14 +8,21 @@ var rehypeSanitize = require('rehype-sanitize');
|
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var useReportAnalyticsEvent = require('../hooks/useReportAnalyticsEvent.js');
|
|
10
10
|
|
|
11
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var ReactMarkdown__default = /*#__PURE__*/_interopDefault(ReactMarkdown);
|
|
14
|
+
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
15
|
+
var rehypeRaw__default = /*#__PURE__*/_interopDefault(rehypeRaw);
|
|
16
|
+
var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
|
|
17
|
+
|
|
11
18
|
// The Remark and Rehype plugins to use in conjunction with ReactMarkdown.
|
|
12
19
|
const unifiedPlugins = {
|
|
13
20
|
remark: [
|
|
14
|
-
|
|
21
|
+
remarkGfm__default.default, //renders Github-Flavored Markdown
|
|
15
22
|
],
|
|
16
23
|
rehype: [
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
rehypeRaw__default.default,
|
|
25
|
+
rehypeSanitize__default.default, //to sanitize HTML content
|
|
19
26
|
],
|
|
20
27
|
};
|
|
21
28
|
/**
|
|
@@ -45,7 +52,7 @@ function Markdown({ content, responseId, className }) {
|
|
|
45
52
|
},
|
|
46
53
|
};
|
|
47
54
|
}, [reportAnalyticsEvent, responseId]);
|
|
48
|
-
return (jsxRuntime.jsx(
|
|
55
|
+
return (jsxRuntime.jsx(ReactMarkdown__default.default, { className: className, children: content, remarkPlugins: unifiedPlugins.remark, rehypePlugins: unifiedPlugins.rehype, components: components }));
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
exports.Markdown = Markdown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Markdown.js","sources":["../../../../src/components/Markdown.tsx"],"sourcesContent":["import ReactMarkdown, {\n PluggableList,\n ReactMarkdownOptions,\n} from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypeRaw from \"rehype-raw\";\nimport rehypeSanitize from \"rehype-sanitize\";\nimport { useMemo } from \"react\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\n\n// The Remark and Rehype plugins to use in conjunction with ReactMarkdown.\nconst unifiedPlugins: { remark?: PluggableList; rehype: PluggableList } = {\n remark: [\n remarkGfm, //renders Github-Flavored Markdown\n ],\n rehype: [\n rehypeRaw, //to support HTML embedded in markdown\n rehypeSanitize, //to sanitize HTML content\n ],\n};\n\ninterface MarkdownProps {\n /** Stringified markdown. */\n content: string;\n /** The response ID correlates to the current message. */\n responseId?: string;\n /** Classnames for the container. */\n className?: string;\n}\n\n/**\n * Renders Github-Flavored Markdown from the Knowledge Graph. This Markdown can include\n * arbitrary HTML. Any HTML will be sanitized according to Rehype's default Schema.\n *\n * @remarks\n * A link click will send a CHAT_LINK_CLICK analytics event\n *\n * @internal\n */\nexport function Markdown({ content, responseId, className }: MarkdownProps) {\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n\n const components: ReactMarkdownOptions[\"components\"] = useMemo(() => {\n const createClickHandlerFn = (href?: string) => () => {\n reportAnalyticsEvent({\n action: \"CHAT_LINK_CLICK\",\n destinationUrl: href,\n chat: {\n responseId,\n },\n });\n };\n return {\n a: ({ node: _, children, ...props }) => {\n return (\n <a\n {...props}\n onClick={createClickHandlerFn(props.href)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"cursor-pointer\"\n >\n {children}\n </a>\n );\n },\n };\n }, [reportAnalyticsEvent, responseId]);\n\n return (\n <ReactMarkdown\n className={className}\n children={content}\n remarkPlugins={unifiedPlugins.remark}\n rehypePlugins={unifiedPlugins.rehype}\n components={components}\n />\n );\n}\n"],"names":["useReportAnalyticsEvent","useMemo","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Markdown.js","sources":["../../../../src/components/Markdown.tsx"],"sourcesContent":["import ReactMarkdown, {\n PluggableList,\n ReactMarkdownOptions,\n} from \"react-markdown\";\nimport remarkGfm from \"remark-gfm\";\nimport rehypeRaw from \"rehype-raw\";\nimport rehypeSanitize from \"rehype-sanitize\";\nimport { useMemo } from \"react\";\nimport { useReportAnalyticsEvent } from \"../hooks/useReportAnalyticsEvent\";\n\n// The Remark and Rehype plugins to use in conjunction with ReactMarkdown.\nconst unifiedPlugins: { remark?: PluggableList; rehype: PluggableList } = {\n remark: [\n remarkGfm, //renders Github-Flavored Markdown\n ],\n rehype: [\n rehypeRaw, //to support HTML embedded in markdown\n rehypeSanitize, //to sanitize HTML content\n ],\n};\n\ninterface MarkdownProps {\n /** Stringified markdown. */\n content: string;\n /** The response ID correlates to the current message. */\n responseId?: string;\n /** Classnames for the container. */\n className?: string;\n}\n\n/**\n * Renders Github-Flavored Markdown from the Knowledge Graph. This Markdown can include\n * arbitrary HTML. Any HTML will be sanitized according to Rehype's default Schema.\n *\n * @remarks\n * A link click will send a CHAT_LINK_CLICK analytics event\n *\n * @internal\n */\nexport function Markdown({ content, responseId, className }: MarkdownProps) {\n const reportAnalyticsEvent = useReportAnalyticsEvent();\n\n const components: ReactMarkdownOptions[\"components\"] = useMemo(() => {\n const createClickHandlerFn = (href?: string) => () => {\n reportAnalyticsEvent({\n action: \"CHAT_LINK_CLICK\",\n destinationUrl: href,\n chat: {\n responseId,\n },\n });\n };\n return {\n a: ({ node: _, children, ...props }) => {\n return (\n <a\n {...props}\n onClick={createClickHandlerFn(props.href)}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"cursor-pointer\"\n >\n {children}\n </a>\n );\n },\n };\n }, [reportAnalyticsEvent, responseId]);\n\n return (\n <ReactMarkdown\n className={className}\n children={content}\n remarkPlugins={unifiedPlugins.remark}\n rehypePlugins={unifiedPlugins.rehype}\n components={components}\n />\n );\n}\n"],"names":["remarkGfm","rehypeRaw","rehypeSanitize","useReportAnalyticsEvent","useMemo","_jsx","ReactMarkdown"],"mappings":";;;;;;;;;;;;;;;;;AAUA;AACA,MAAM,cAAc,GAAsD;AACxE,IAAA,MAAM,EAAE;AACN,QAAAA,0BAAS;AACV,KAAA;AACD,IAAA,MAAM,EAAE;QACNC,0BAAS;AACT,QAAAC,+BAAc;AACf,KAAA;CACF,CAAC;AAWF;;;;;;;;AAQG;AACG,SAAU,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAiB,EAAA;AACxE,IAAA,MAAM,oBAAoB,GAAGC,+CAAuB,EAAE,CAAC;AAEvD,IAAA,MAAM,UAAU,GAAuCC,aAAO,CAAC,MAAK;QAClE,MAAM,oBAAoB,GAAG,CAAC,IAAa,KAAK,MAAK;AACnD,YAAA,oBAAoB,CAAC;AACnB,gBAAA,MAAM,EAAE,iBAAiB;AACzB,gBAAA,cAAc,EAAE,IAAI;AACpB,gBAAA,IAAI,EAAE;oBACJ,UAAU;AACX,iBAAA;AACF,aAAA,CAAC,CAAC;AACL,SAAC,CAAC;QACF,OAAO;AACL,YAAA,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,KAAI;AACrC,gBAAA,QACEC,cAAA,CAAA,GAAA,EAAA,EAAA,GACM,KAAK,EACT,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,EACzC,MAAM,EAAC,QAAQ,EACf,GAAG,EAAC,qBAAqB,EACzB,SAAS,EAAC,gBAAgB,EAEzB,QAAA,EAAA,QAAQ,EACP,CAAA,EACJ;aACH;SACF,CAAC;AACJ,KAAC,EAAE,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC,CAAC;AAEvC,IAAA,QACEA,cAAA,CAACC,8BAAa,EAAA,EACZ,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,OAAO,EACjB,aAAa,EAAE,cAAc,CAAC,MAAM,EACpC,aAAa,EAAE,cAAc,CAAC,MAAM,EACpC,UAAU,EAAE,UAAU,EAAA,CACtB,EACF;AACJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReportAnalyticsEvent.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"useReportAnalyticsEvent.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAIzE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAMhE"}
|
|
@@ -4,7 +4,6 @@ var chatHeadlessReact = require('@yext/chat-headless-react');
|
|
|
4
4
|
var _package = require('../../package.json.js');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
|
|
7
|
-
const { version } = _package.default;
|
|
8
7
|
/**
|
|
9
8
|
* Returns a function to send requests to Yext Analytics API.
|
|
10
9
|
* The payload will automatically includes chat-ui-react's
|
|
@@ -15,7 +14,7 @@ const { version } = _package.default;
|
|
|
15
14
|
function useReportAnalyticsEvent() {
|
|
16
15
|
const chat = chatHeadlessReact.useChatActions();
|
|
17
16
|
chat.addClientSdk({
|
|
18
|
-
CHAT_UI_REACT: version,
|
|
17
|
+
CHAT_UI_REACT: _package.version,
|
|
19
18
|
});
|
|
20
19
|
return react.useCallback((payload) => chat.report(payload), [chat]);
|
|
21
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReportAnalyticsEvent.js","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"sourcesContent":["import { ChatHeadless, useChatActions } from \"@yext/chat-headless-react\";\nimport
|
|
1
|
+
{"version":3,"file":"useReportAnalyticsEvent.js","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"sourcesContent":["import { ChatHeadless, useChatActions } from \"@yext/chat-headless-react\";\nimport { version } from \"../../package.json\";\nimport { useCallback } from \"react\";\n\n/**\n * Returns a function to send requests to Yext Analytics API.\n * The payload will automatically includes chat-ui-react's\n * package version for \"clientSdk\" field.\n *\n * @internal\n */\nexport function useReportAnalyticsEvent(): ChatHeadless[\"report\"] {\n const chat = useChatActions();\n chat.addClientSdk({\n CHAT_UI_REACT: version,\n });\n return useCallback((payload) => chat.report(payload), [chat]);\n}\n"],"names":["useChatActions","version","useCallback"],"mappings":";;;;;;AAIA;;;;;;AAMG;SACa,uBAAuB,GAAA;AACrC,IAAA,MAAM,IAAI,GAAGA,gCAAc,EAAE,CAAC;IAC9B,IAAI,CAAC,YAAY,CAAC;AAChB,QAAA,aAAa,EAAEC,gBAAO;AACvB,KAAA,CAAC,CAAC;AACH,IAAA,OAAOC,iBAAW,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE;;;;"}
|
package/lib/esm/package.json.mjs
CHANGED
|
@@ -1,121 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
var version = "0.6.0-alpha.38";
|
|
3
|
-
var description = "A library of React Components for powering Yext Chat integrations.";
|
|
4
|
-
var author = "clippy@yext.com";
|
|
5
|
-
var main = "./lib/commonjs/src/index.js";
|
|
6
|
-
var module = "./lib/esm/src/index.mjs";
|
|
7
|
-
var types = "./lib/esm/src/index.d.ts";
|
|
8
|
-
var sideEffects = false;
|
|
9
|
-
var exports = {
|
|
10
|
-
".": {
|
|
11
|
-
"import": "./lib/esm/src/index.mjs",
|
|
12
|
-
require: "./lib/commonjs/src/index.js"
|
|
13
|
-
},
|
|
14
|
-
"./bundle.css": "./lib/bundle.css"
|
|
15
|
-
};
|
|
16
|
-
var license = "BSD-3-Clause";
|
|
17
|
-
var files = [
|
|
18
|
-
"lib",
|
|
19
|
-
"src",
|
|
20
|
-
"THIRD-PARTY-NOTICES",
|
|
21
|
-
"LICENSE"
|
|
22
|
-
];
|
|
23
|
-
var keywords = [
|
|
24
|
-
"chat",
|
|
25
|
-
"ai",
|
|
26
|
-
"yext",
|
|
27
|
-
"react",
|
|
28
|
-
"components",
|
|
29
|
-
"tailwindcss"
|
|
30
|
-
];
|
|
31
|
-
var scripts = {
|
|
32
|
-
lint: "prettier --write . && eslint --fix --max-warnings=0 .",
|
|
33
|
-
test: "jest --config=jest.config.json",
|
|
34
|
-
storybook: "storybook dev -p 6006",
|
|
35
|
-
dev: "tsc --watch -p tsconfig.json",
|
|
36
|
-
"generate-docs": "api-extractor run --local --verbose && api-documenter markdown --input-folder temp --output-folder docs && rm -rf temp",
|
|
37
|
-
"generate-notices": "generate-license-file --input package.json --output ./THIRD-PARTY-NOTICES --overwrite",
|
|
38
|
-
postcss: "postcss",
|
|
39
|
-
tailwindcss: "tailwindcss",
|
|
40
|
-
"build:css": "./scoped-bundle.sh",
|
|
41
|
-
"build:js": "rollup --config rollup.config.mjs",
|
|
42
|
-
build: "rm -rf lib/** && npm run build:js && npm run build:css && npm run generate-docs && npm run generate-notices",
|
|
43
|
-
"build-storybook": "storybook build"
|
|
44
|
-
};
|
|
45
|
-
var devDependencies = {
|
|
46
|
-
"@babel/core": "^7.21.8",
|
|
47
|
-
"@babel/preset-env": "^7.21.5",
|
|
48
|
-
"@babel/preset-react": "^7.18.6",
|
|
49
|
-
"@babel/preset-typescript": "^7.21.5",
|
|
50
|
-
"@microsoft/api-documenter": "^7.22.8",
|
|
51
|
-
"@microsoft/api-extractor": "^7.35.1",
|
|
52
|
-
"@rollup/plugin-json": "^6.0.0",
|
|
53
|
-
"@storybook/addon-essentials": "^7.0.18",
|
|
54
|
-
"@storybook/addon-interactions": "^7.0.18",
|
|
55
|
-
"@storybook/addon-links": "^7.0.18",
|
|
56
|
-
"@storybook/blocks": "^7.0.18",
|
|
57
|
-
"@storybook/react": "^7.0.17",
|
|
58
|
-
"@storybook/react-vite": "^7.0.17",
|
|
59
|
-
"@storybook/testing-library": "^0.1.0",
|
|
60
|
-
"@tailwindcss/container-queries": "^0.1.1",
|
|
61
|
-
"@tailwindcss/typography": "^0.5.9",
|
|
62
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
63
|
-
"@testing-library/react": "^14.0.0",
|
|
64
|
-
"@testing-library/user-event": "^14.4.3",
|
|
65
|
-
"@types/jest": "^29.5.1",
|
|
66
|
-
"@types/react": "^18.2.7",
|
|
67
|
-
"@yext/chat-headless-react": "^0.5.6",
|
|
68
|
-
"@yext/eslint-config": "^1.0.0",
|
|
69
|
-
"babel-jest": "^29.5.0",
|
|
70
|
-
eslint: "^8.39.0",
|
|
71
|
-
"eslint-plugin-storybook": "^0.6.12",
|
|
72
|
-
"generate-license-file": "^2.0.0",
|
|
73
|
-
jest: "^29.5.0",
|
|
74
|
-
"jest-environment-jsdom": "^29.5.0",
|
|
75
|
-
msw: "^1.2.1",
|
|
76
|
-
"msw-storybook-addon": "^1.8.0",
|
|
77
|
-
"postcss-cli": "^10.1.0",
|
|
78
|
-
"postcss-nested": "^6.0.1",
|
|
79
|
-
prettier: "^2.8.8",
|
|
80
|
-
react: "^18.2.0",
|
|
81
|
-
"react-dom": "^18.2.0",
|
|
82
|
-
rollup: "^3.28.1",
|
|
83
|
-
"rollup-plugin-typescript2": "^0.35.0",
|
|
84
|
-
storybook: "^7.0.17",
|
|
85
|
-
tailwindcss: "^3.3.2",
|
|
86
|
-
typescript: "^5.0.4"
|
|
87
|
-
};
|
|
88
|
-
var peerDependencies = {
|
|
89
|
-
"@yext/chat-headless-react": "^0.5.4",
|
|
90
|
-
react: "^16.14 || ^17 || ^18",
|
|
91
|
-
"react-dom": "^16.14 || ^17 || || ^18"
|
|
92
|
-
};
|
|
93
|
-
var dependencies = {
|
|
94
|
-
"react-markdown": "^6.0.3",
|
|
95
|
-
"react-textarea-autosize": "^8.5.3",
|
|
96
|
-
"rehype-raw": "^5.0.0",
|
|
97
|
-
"rehype-sanitize": "^4.0.0",
|
|
98
|
-
"remark-gfm": "^1.0.0",
|
|
99
|
-
"tailwind-merge": "^1.12.0"
|
|
100
|
-
};
|
|
101
|
-
var packageJson = {
|
|
102
|
-
name: name,
|
|
103
|
-
version: version,
|
|
104
|
-
description: description,
|
|
105
|
-
author: author,
|
|
106
|
-
main: main,
|
|
107
|
-
module: module,
|
|
108
|
-
types: types,
|
|
109
|
-
sideEffects: sideEffects,
|
|
110
|
-
exports: exports,
|
|
111
|
-
license: license,
|
|
112
|
-
files: files,
|
|
113
|
-
keywords: keywords,
|
|
114
|
-
scripts: scripts,
|
|
115
|
-
devDependencies: devDependencies,
|
|
116
|
-
peerDependencies: peerDependencies,
|
|
117
|
-
dependencies: dependencies
|
|
118
|
-
};
|
|
1
|
+
var version = "0.6.0-alpha.38.2";
|
|
119
2
|
|
|
120
|
-
export {
|
|
3
|
+
export { version };
|
|
121
4
|
//# sourceMappingURL=package.json.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReportAnalyticsEvent.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"useReportAnalyticsEvent.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAkB,MAAM,2BAA2B,CAAC;AAIzE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,YAAY,CAAC,QAAQ,CAAC,CAMhE"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useChatActions } from '@yext/chat-headless-react';
|
|
2
|
-
import
|
|
2
|
+
import { version } from '../../package.json.mjs';
|
|
3
3
|
import { useCallback } from 'react';
|
|
4
4
|
|
|
5
|
-
const { version } = packageJson;
|
|
6
5
|
/**
|
|
7
6
|
* Returns a function to send requests to Yext Analytics API.
|
|
8
7
|
* The payload will automatically includes chat-ui-react's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReportAnalyticsEvent.mjs","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"sourcesContent":["import { ChatHeadless, useChatActions } from \"@yext/chat-headless-react\";\nimport
|
|
1
|
+
{"version":3,"file":"useReportAnalyticsEvent.mjs","sources":["../../../../src/hooks/useReportAnalyticsEvent.ts"],"sourcesContent":["import { ChatHeadless, useChatActions } from \"@yext/chat-headless-react\";\nimport { version } from \"../../package.json\";\nimport { useCallback } from \"react\";\n\n/**\n * Returns a function to send requests to Yext Analytics API.\n * The payload will automatically includes chat-ui-react's\n * package version for \"clientSdk\" field.\n *\n * @internal\n */\nexport function useReportAnalyticsEvent(): ChatHeadless[\"report\"] {\n const chat = useChatActions();\n chat.addClientSdk({\n CHAT_UI_REACT: version,\n });\n return useCallback((payload) => chat.report(payload), [chat]);\n}\n"],"names":[],"mappings":";;;;AAIA;;;;;;AAMG;SACa,uBAAuB,GAAA;AACrC,IAAA,MAAM,IAAI,GAAG,cAAc,EAAE,CAAC;IAC9B,IAAI,CAAC,YAAY,CAAC;AAChB,QAAA,aAAa,EAAE,OAAO;AACvB,KAAA,CAAC,CAAC;AACH,IAAA,OAAO,WAAW,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ChatHeadless, useChatActions } from "@yext/chat-headless-react";
|
|
2
|
-
import
|
|
2
|
+
import { version } from "../../package.json";
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
const { version } = packageJson;
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* Returns a function to send requests to Yext Analytics API.
|