@botonic/react 0.30.3-alpha.0 → 0.30.3
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/cjs/components/message/index.js +1 -1
- package/lib/cjs/components/message/message-feedback.js +1 -1
- package/lib/cjs/components/message/message-feedback.js.map +1 -1
- package/lib/cjs/util/webchat.js +1 -1
- package/lib/cjs/webchat/input-panel/index.js +1 -1
- package/lib/cjs/webchat/webchat.js +1 -1
- package/lib/esm/components/message/index.js +2 -2
- package/lib/esm/components/message/message-feedback.js +2 -2
- package/lib/esm/components/message/message-feedback.js.map +1 -1
- package/lib/esm/util/webchat.js +2 -2
- package/lib/esm/webchat/input-panel/index.js +2 -2
- package/lib/esm/webchat/webchat.js +2 -2
- package/package.json +3 -2
- package/src/components/message/index.jsx +2 -2
- package/src/components/message/message-feedback.tsx +2 -2
- package/src/util/webchat.js +2 -2
- package/src/webchat/input-panel/index.tsx +2 -2
- package/src/webchat/webchat.jsx +2 -2
|
@@ -28,7 +28,7 @@ const Message = props => {
|
|
|
28
28
|
const markdown = props.markdown;
|
|
29
29
|
const { webchatState, addMessage, updateReplies, getThemeProperty } = (0, react_1.useContext)(contexts_1.WebchatContext);
|
|
30
30
|
const [state, setState] = (0, react_1.useState)({
|
|
31
|
-
id: props.id || (0, uuid_1.
|
|
31
|
+
id: props.id || (0, uuid_1.v7)(),
|
|
32
32
|
});
|
|
33
33
|
const [disabled, setDisabled] = (0, react_1.useState)(false);
|
|
34
34
|
children = buttons_disabler_1.ButtonsDisabler.updateChildrenButtons(children, {
|
|
@@ -46,7 +46,7 @@ const MessageFeedback = ({ botInteractionId, inferenceId, messageId, }) => {
|
|
|
46
46
|
knowledgebaseInferenceId: inferenceId,
|
|
47
47
|
feedbackBotInteractionId: botInteractionId,
|
|
48
48
|
feedbackTargetId: messageId,
|
|
49
|
-
feedbackGroupId: (0, uuid_1.
|
|
49
|
+
feedbackGroupId: (0, uuid_1.v7)(),
|
|
50
50
|
possibleOptions: [tracking_1.FeedbackOption.ThumbsDown, tracking_1.FeedbackOption.ThumbsUp],
|
|
51
51
|
possibleValues: [0, 1],
|
|
52
52
|
option: isUseful ? tracking_1.FeedbackOption.ThumbsUp : tracking_1.FeedbackOption.ThumbsDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-feedback.js","sourceRoot":"","sources":["../../../../src/components/message/message-feedback.tsx"],"names":[],"mappings":";;;;;AAAA,iCAA8D;AAC9D,+
|
|
1
|
+
{"version":3,"file":"message-feedback.js","sourceRoot":"","sources":["../../../../src/components/message/message-feedback.tsx"],"names":[],"mappings":";;;;;AAAA,iCAA8D;AAC9D,+BAAmC;AAEnC,2FAAqD;AACrD,uFAAiD;AACjD,6CAA+C;AAE/C,qCAAyC;AACzC,qDAAoE;AACpE,qCAAmE;AAa5D,MAAM,eAAe,GAAG,CAAC,EAC9B,gBAAgB,EAChB,WAAW,EACX,SAAS,GACG,EAAE,EAAE;IAChB,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,IAAA,kBAAU,EAAC,yBAAc,CAAC,CAAA;IAE9E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAe;QACrD,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;KAChB,CAAC,CAAA;IAEF,MAAM,qBAAqB,GAAG,CAAC,eAAwB,EAAE,EAAE;QACzD,MAAM,OAAO,GAAG,YAAY,CAAC,YAAY,CAAC,IAAI,CAC5C,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,KAAK,SAAS,CACpC,CAAA;QACD,MAAM,UAAU,mCACX,OAAO,KACV,eAAe,GAChB,CAAA;QACD,aAAa,CAAC,UAAU,CAAC,CAAA;IAC3B,CAAC,CAAA;IAED,IAAA,i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AE,IAAI,CAAC,CAAA;IACpE,CAAC,CAAA,CAAA;IAED,OAAO,CACL,wBAAC,iCAAwB,eACvB,uBAAC,uBAAc,kBACb,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,gBAEhC,gCAAK,GAAG,EAAE,IAAA,mBAAY,EAAC,uBAAQ,CAAC,GAAI,IACrB,EACjB,uBAAC,uBAAc,kBACb,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,gBAEjC,gCAAK,GAAG,EAAE,IAAA,mBAAY,EAAC,yBAAU,CAAC,GAAI,IACvB,IACQ,CAC5B,CAAA;AACH,CAAC,CAAA;AApFY,QAAA,eAAe,mBAoF3B"}
|
package/lib/cjs/util/webchat.js
CHANGED
|
@@ -35,7 +35,7 @@ const InputPanel = ({ persistentMenu, enableEmojiPicker, enableAttachments, hand
|
|
|
35
35
|
});
|
|
36
36
|
const sendChatEvent = (chatEvent) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
37
|
const chatEventInput = {
|
|
38
|
-
id: (0, uuid_1.
|
|
38
|
+
id: (0, uuid_1.v7)(),
|
|
39
39
|
type: core_1.INPUT.CHAT_EVENT,
|
|
40
40
|
data: chatEvent,
|
|
41
41
|
};
|
|
@@ -332,7 +332,7 @@ exports.Webchat = (0, react_1.forwardRef)((props, ref) => {
|
|
|
332
332
|
if ((0, message_utils_1.isText)(input) && checkBlockInput(input))
|
|
333
333
|
return;
|
|
334
334
|
if (!input.id)
|
|
335
|
-
input.id = (0, uuid_1.
|
|
335
|
+
input.id = (0, uuid_1.v7)();
|
|
336
336
|
const messageComponent = messageComponentFromInput(input);
|
|
337
337
|
if (messageComponent)
|
|
338
338
|
addMessageComponent(messageComponent);
|
|
@@ -2,7 +2,7 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { INPUT, isBrowser } from '@botonic/core';
|
|
4
4
|
import React, { useContext, useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
6
6
|
import { COLORS, WEBCHAT } from '../../constants';
|
|
7
7
|
import { RequestContext, WebchatContext } from '../../contexts';
|
|
8
8
|
import { SENDERS } from '../../index-types';
|
|
@@ -25,7 +25,7 @@ export const Message = props => {
|
|
|
25
25
|
const markdown = props.markdown;
|
|
26
26
|
const { webchatState, addMessage, updateReplies, getThemeProperty } = useContext(WebchatContext);
|
|
27
27
|
const [state, setState] = useState({
|
|
28
|
-
id: props.id ||
|
|
28
|
+
id: props.id || uuidv7(),
|
|
29
29
|
});
|
|
30
30
|
const [disabled, setDisabled] = useState(false);
|
|
31
31
|
children = ButtonsDisabler.updateChildrenButtons(children, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter } from "tslib";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useContext, useEffect, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
5
5
|
import ThumbsDown from '../../assets/thumbs-down.svg';
|
|
6
6
|
import ThumbsUp from '../../assets/thumbs-up.svg';
|
|
7
7
|
import { WebchatContext } from '../../contexts';
|
|
@@ -43,7 +43,7 @@ export const MessageFeedback = ({ botInteractionId, inferenceId, messageId, }) =
|
|
|
43
43
|
knowledgebaseInferenceId: inferenceId,
|
|
44
44
|
feedbackBotInteractionId: botInteractionId,
|
|
45
45
|
feedbackTargetId: messageId,
|
|
46
|
-
feedbackGroupId:
|
|
46
|
+
feedbackGroupId: uuidv7(),
|
|
47
47
|
possibleOptions: [FeedbackOption.ThumbsDown, FeedbackOption.ThumbsUp],
|
|
48
48
|
possibleValues: [0, 1],
|
|
49
49
|
option: isUseful ? FeedbackOption.ThumbsUp : FeedbackOption.ThumbsDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-feedback.js","sourceRoot":"","sources":["../../../../src/components/message/message-feedback.tsx"],"names":[],"mappings":";;AAAA,OAAc,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"message-feedback.js","sourceRoot":"","sources":["../../../../src/components/message/message-feedback.tsx"],"names":[],"mappings":";;AAAA,OAAc,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC9D,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,UAAU,MAAM,8BAA8B,CAAA;AACrD,OAAO,QAAQ,MAAM,4BAA4B,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACpE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAanE,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,gBAAgB,EAChB,WAAW,EACX,SAAS,GACG,EAAE,EAAE;IAChB,MAAM,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,cAAc,CAAC,CAAA;IAE9E,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAC9C,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAe;QACrD,QAAQ,EAAE,KAAK;QACf,QAAQ,EAAE,KAAK;KAChB,CAA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,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU;YACtE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACxB,CAAA;QAED,MAAM,OAAO,GAAG;YACd,OAAO,oBACF,YAAY,CAAC,OAAO,CACxB;SAC0B,CAAA;QAE7B,MAAM,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAA;IACpE,CAAC,CAAA,CAAA;IAED,OAAO,CACL,MAAC,wBAAwB,eACvB,KAAC,cAAc,kBACb,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,gBAEhC,cAAK,GAAG,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAI,IACrB,EACjB,KAAC,cAAc,kBACb,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,gBAEjC,cAAK,GAAG,EAAE,YAAY,CAAC,UAAU,CAAC,GAAI,IACvB,IACQ,CAC5B,CAAA;AACH,CAAC,CAAA"}
|
package/lib/esm/util/webchat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import merge from 'lodash.merge';
|
|
2
2
|
import UAParser from 'ua-parser-js';
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
4
4
|
import { WEBCHAT } from '../constants';
|
|
5
5
|
import { getProperty } from './objects';
|
|
6
6
|
/**
|
|
@@ -29,7 +29,7 @@ export const createUser = () => {
|
|
|
29
29
|
if (ua.device && ua.device.type)
|
|
30
30
|
name = `${ua.device.type} ${name}`;
|
|
31
31
|
return {
|
|
32
|
-
id:
|
|
32
|
+
id: uuidv7(),
|
|
33
33
|
name,
|
|
34
34
|
};
|
|
35
35
|
};
|
|
@@ -2,7 +2,7 @@ import { __awaiter } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { INPUT } from '@botonic/core';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
6
6
|
import { WEBCHAT } from '../../constants';
|
|
7
7
|
import { WebchatContext } from '../../contexts';
|
|
8
8
|
import { getFullMimeWhitelist } from '../../message-utils';
|
|
@@ -32,7 +32,7 @@ export const InputPanel = ({ persistentMenu, enableEmojiPicker, enableAttachment
|
|
|
32
32
|
});
|
|
33
33
|
const sendChatEvent = (chatEvent) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
34
|
const chatEventInput = {
|
|
35
|
-
id:
|
|
35
|
+
id: uuidv7(),
|
|
36
36
|
type: INPUT.CHAT_EVENT,
|
|
37
37
|
data: chatEvent,
|
|
38
38
|
};
|
|
@@ -4,7 +4,7 @@ import { BotonicAction, INPUT, isMobile, params2queryString, } from '@botonic/co
|
|
|
4
4
|
import merge from 'lodash.merge';
|
|
5
5
|
import React, { forwardRef, useEffect, useImperativeHandle, useRef, useState, } from 'react';
|
|
6
6
|
import styled, { StyleSheetManager } from 'styled-components';
|
|
7
|
-
import {
|
|
7
|
+
import { v7 as uuidv7 } from 'uuid';
|
|
8
8
|
import { Audio, Document, Image, Text, Video } from '../components';
|
|
9
9
|
import { Handoff } from '../components/handoff';
|
|
10
10
|
import { normalizeWebchatSettings } from '../components/webchat-settings';
|
|
@@ -329,7 +329,7 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
329
329
|
if (isText(input) && checkBlockInput(input))
|
|
330
330
|
return;
|
|
331
331
|
if (!input.id)
|
|
332
|
-
input.id =
|
|
332
|
+
input.id = uuidv7();
|
|
333
333
|
const messageComponent = messageComponentFromInput(input);
|
|
334
334
|
if (messageComponent)
|
|
335
335
|
addMessageComponent(messageComponent);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botonic/react",
|
|
3
|
-
"version": "0.30.3
|
|
3
|
+
"version": "0.30.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Build Chatbots using React",
|
|
6
6
|
"main": "./lib/cjs",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"react-textarea-autosize": "^8.5.3",
|
|
33
33
|
"styled-components": "^5.3.0",
|
|
34
34
|
"ua-parser-js": "^1.0.39",
|
|
35
|
-
"uuid": "^
|
|
35
|
+
"uuid": "^10.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@babel/plugin-transform-runtime": "^7.23.9",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"@types/parse5": "^7.0.0",
|
|
44
44
|
"@types/react": "^16.14.56",
|
|
45
45
|
"@types/styled-components": "^5.1.34",
|
|
46
|
+
"@types/uuid": "^10.0.0",
|
|
46
47
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
47
48
|
"copyfiles": "^2.4.1",
|
|
48
49
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INPUT, isBrowser } from '@botonic/core'
|
|
2
2
|
import React, { useContext, useEffect, useState } from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuidv7 } from 'uuid'
|
|
4
4
|
|
|
5
5
|
import { COLORS, WEBCHAT } from '../../constants'
|
|
6
6
|
import { RequestContext, WebchatContext } from '../../contexts'
|
|
@@ -49,7 +49,7 @@ export const Message = props => {
|
|
|
49
49
|
const { webchatState, addMessage, updateReplies, getThemeProperty } =
|
|
50
50
|
useContext(WebchatContext)
|
|
51
51
|
const [state, setState] = useState({
|
|
52
|
-
id: props.id ||
|
|
52
|
+
id: props.id || uuidv7(),
|
|
53
53
|
})
|
|
54
54
|
|
|
55
55
|
const [disabled, setDisabled] = useState(false)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { v7 as uuidv7 } from 'uuid'
|
|
3
3
|
|
|
4
4
|
import ThumbsDown from '../../assets/thumbs-down.svg'
|
|
5
5
|
import ThumbsUp from '../../assets/thumbs-up.svg'
|
|
@@ -70,7 +70,7 @@ export const MessageFeedback = ({
|
|
|
70
70
|
knowledgebaseInferenceId: inferenceId,
|
|
71
71
|
feedbackBotInteractionId: botInteractionId,
|
|
72
72
|
feedbackTargetId: messageId,
|
|
73
|
-
feedbackGroupId:
|
|
73
|
+
feedbackGroupId: uuidv7(),
|
|
74
74
|
possibleOptions: [FeedbackOption.ThumbsDown, FeedbackOption.ThumbsUp],
|
|
75
75
|
possibleValues: [0, 1],
|
|
76
76
|
option: isUseful ? FeedbackOption.ThumbsUp : FeedbackOption.ThumbsDown,
|
package/src/util/webchat.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import merge from 'lodash.merge'
|
|
2
2
|
import UAParser from 'ua-parser-js'
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuidv7 } from 'uuid'
|
|
4
4
|
|
|
5
5
|
import { WEBCHAT } from '../constants'
|
|
6
6
|
import { getProperty } from './objects'
|
|
@@ -31,7 +31,7 @@ export const createUser = () => {
|
|
|
31
31
|
let name = `${ua.os.name} ${ua.browser.name}`
|
|
32
32
|
if (ua.device && ua.device.type) name = `${ua.device.type} ${name}`
|
|
33
33
|
return {
|
|
34
|
-
id:
|
|
34
|
+
id: uuidv7(),
|
|
35
35
|
name,
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { INPUT } from '@botonic/core'
|
|
2
2
|
import React, { useContext } from 'react'
|
|
3
|
-
import {
|
|
3
|
+
import { v7 as uuidv7 } from 'uuid'
|
|
4
4
|
|
|
5
5
|
import { WEBCHAT } from '../../constants'
|
|
6
6
|
import { WebchatContext } from '../../contexts'
|
|
@@ -62,7 +62,7 @@ export const InputPanel = ({
|
|
|
62
62
|
|
|
63
63
|
const sendChatEvent = async chatEvent => {
|
|
64
64
|
const chatEventInput = {
|
|
65
|
-
id:
|
|
65
|
+
id: uuidv7(),
|
|
66
66
|
type: INPUT.CHAT_EVENT,
|
|
67
67
|
data: chatEvent,
|
|
68
68
|
}
|
package/src/webchat/webchat.jsx
CHANGED
|
@@ -13,7 +13,7 @@ import React, {
|
|
|
13
13
|
useState,
|
|
14
14
|
} from 'react'
|
|
15
15
|
import styled, { StyleSheetManager } from 'styled-components'
|
|
16
|
-
import {
|
|
16
|
+
import { v7 as uuidv7 } from 'uuid'
|
|
17
17
|
|
|
18
18
|
import { Audio, Document, Image, Text, Video } from '../components'
|
|
19
19
|
import { Handoff } from '../components/handoff'
|
|
@@ -468,7 +468,7 @@ export const Webchat = forwardRef((props, ref) => {
|
|
|
468
468
|
if (!input || Object.keys(input).length == 0) return
|
|
469
469
|
if (isText(input) && (!input.data || !input.data.trim())) return // in case trim() doesn't work in a browser we can use !/\S/.test(input.data)
|
|
470
470
|
if (isText(input) && checkBlockInput(input)) return
|
|
471
|
-
if (!input.id) input.id =
|
|
471
|
+
if (!input.id) input.id = uuidv7()
|
|
472
472
|
const messageComponent = messageComponentFromInput(input)
|
|
473
473
|
if (messageComponent) addMessageComponent(messageComponent)
|
|
474
474
|
if (isMedia(input)) input.data = await readDataURL(input.data)
|