diff --git a/package-lock.json b/package-lock.json index 694fecda8c..61c1879292 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5472,9 +5472,9 @@ "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==" }, "node_modules/@types/uuid": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", - "integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", "dev": true }, "node_modules/@types/ws": { @@ -27858,7 +27858,7 @@ "qs": "^6.11.2", "tar": "^6.2.0", "tslib": "^2.6.2", - "uuid": "^8.3.2", + "uuid": "^10.0.0", "zip-a-folder": "3.1.7" }, "bin": { @@ -27872,7 +27872,7 @@ "@types/inquirer": "^7.3.1", "@types/localtunnel": "^2.0.1", "@types/tar": "^6.1.11", - "@types/uuid": "^8.3.0", + "@types/uuid": "^10.0.0", "globby": "^11.0.3" }, "engines": { @@ -27893,8 +27893,13 @@ } }, "packages/botonic-cli/node_modules/uuid": { - "version": "8.3.2", - "license": "MIT", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -28081,16 +28086,22 @@ "@botonic/core": "^0.30.0", "axios": "^1.7.2", "jsrsasign": "^10.9.0", - "uuid": "^8.3.2" + "uuid": "^10.0.0" }, "devDependencies": { "@types/jsrsasign": "^10.5.12", + "@types/uuid": "^10.0.0", "core-js": "^3.35.1" } }, "packages/botonic-plugin-dialogflow/node_modules/uuid": { - "version": "8.3.2", - "license": "MIT", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -28133,16 +28144,19 @@ "dependencies": { "@botonic/react": "^0.30.0", "axios": "^1.7.2", - "uuid": "^9.0.1" + "uuid": "^10.0.0" + }, + "devDependencies": { + "@types/uuid": "^10.0.0" }, "engines": { "node": ">=20.0.0" } }, "packages/botonic-plugin-flow-builder/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", "funding": [ "https://github.com/sponsors/broofa", "https://github.com/sponsors/ctavan" @@ -28278,7 +28292,7 @@ "react-textarea-autosize": "^8.5.3", "styled-components": "^5.3.0", "ua-parser-js": "^1.0.39", - "uuid": "^8.3.2" + "uuid": "^10.0.0" }, "devDependencies": { "@babel/plugin-transform-runtime": "^7.23.9", @@ -28289,6 +28303,7 @@ "@types/parse5": "^7.0.0", "@types/react": "^16.14.56", "@types/styled-components": "^5.1.34", + "@types/uuid": "^10.0.0", "babel-plugin-add-module-exports": "^1.0.4", "copyfiles": "^2.4.1", "identity-obj-proxy": "^3.0.0", @@ -28337,8 +28352,13 @@ } }, "packages/botonic-react/node_modules/uuid": { - "version": "8.3.2", - "license": "MIT", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } diff --git a/packages/botonic-cli/package.json b/packages/botonic-cli/package.json index 9d37ffaaaa..710a16b0ef 100644 --- a/packages/botonic-cli/package.json +++ b/packages/botonic-cli/package.json @@ -38,7 +38,7 @@ "qs": "^6.11.2", "tar": "^6.2.0", "tslib": "^2.6.2", - "uuid": "^8.3.2", + "uuid": "^10.0.0", "zip-a-folder": "3.1.7" }, "devDependencies": { @@ -49,7 +49,7 @@ "@types/inquirer": "^7.3.1", "@types/localtunnel": "^2.0.1", "@types/tar": "^6.1.11", - "@types/uuid": "^8.3.0", + "@types/uuid": "^10.0.0", "globby": "^11.0.3" }, "engines": { diff --git a/packages/botonic-cli/src/analytics/credentials-handler.ts b/packages/botonic-cli/src/analytics/credentials-handler.ts index 379c4cec04..9b107717a5 100644 --- a/packages/botonic-cli/src/analytics/credentials-handler.ts +++ b/packages/botonic-cli/src/analytics/credentials-handler.ts @@ -1,5 +1,5 @@ import { join, resolve } from 'path' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { BOT_CREDS_FILENAME, @@ -36,7 +36,7 @@ export class CredentialsHandler { } generateId(): string { - return uuidv4() + return uuidv7() } createDirIfNotExists(): void { diff --git a/packages/botonic-plugin-dialogflow/package.json b/packages/botonic-plugin-dialogflow/package.json index 98834ed0e7..71ecb6a51e 100644 --- a/packages/botonic-plugin-dialogflow/package.json +++ b/packages/botonic-plugin-dialogflow/package.json @@ -19,10 +19,11 @@ "@botonic/core": "^0.30.0", "axios": "^1.7.2", "jsrsasign": "^10.9.0", - "uuid": "^8.3.2" + "uuid": "^10.0.0" }, "devDependencies": { "@types/jsrsasign": "^10.5.12", + "@types/uuid": "^10.0.0", "core-js": "^3.35.1" }, "keywords": [ diff --git a/packages/botonic-plugin-dialogflow/src/index.ts b/packages/botonic-plugin-dialogflow/src/index.ts index f1f273ae12..65bb0c0469 100644 --- a/packages/botonic-plugin-dialogflow/src/index.ts +++ b/packages/botonic-plugin-dialogflow/src/index.ts @@ -1,7 +1,7 @@ import type { Plugin, PluginPreRequest } from '@botonic/core' import axios, { AxiosResponse } from 'axios' import jsrsasign from 'jsrsasign' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { Credentials, Options } from './types' @@ -12,7 +12,7 @@ export default class BotonicPluginDialogflow implements Plugin { defaultQueryData: Options['queryData'] constructor(options: Options) { const { credentials, queryData } = options - this.sessionId = uuidv4() + this.sessionId = uuidv7() this.creds = credentials this.defaultQueryData = queryData || {} } diff --git a/packages/botonic-plugin-flow-builder/package.json b/packages/botonic-plugin-flow-builder/package.json index 27654f3b19..20f897f3be 100644 --- a/packages/botonic-plugin-flow-builder/package.json +++ b/packages/botonic-plugin-flow-builder/package.json @@ -16,7 +16,7 @@ "dependencies": { "@botonic/react": "^0.30.0", "axios": "^1.7.2", - "uuid": "^9.0.1" + "uuid": "^10.0.0" }, "repository": { "type": "git", @@ -45,5 +45,8 @@ "eslintConfig": { "extends": "../.eslintrc.js", "root": true + }, + "devDependencies": { + "@types/uuid": "^10.0.0" } } diff --git a/packages/botonic-plugin-flow-builder/src/index.ts b/packages/botonic-plugin-flow-builder/src/index.ts index ad5360ea80..744851a0f0 100644 --- a/packages/botonic-plugin-flow-builder/src/index.ts +++ b/packages/botonic-plugin-flow-builder/src/index.ts @@ -1,6 +1,6 @@ import { Plugin, PluginPreRequest, Session } from '@botonic/core' import { ActionRequest } from '@botonic/react' -import { v4 as uuid } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { FlowBuilderApi } from './api' import { @@ -144,7 +144,7 @@ export default class BotonicPluginFlowBuilder implements Plugin { async getStartContents(locale: string): Promise { const resolvedLocale = this.cmsApi.getResolvedLocale(locale) const startNode = this.cmsApi.getStartNode() - this.currentRequest.session.flow_thread_id = uuid() + this.currentRequest.session.flow_thread_id = uuidv7() return await this.getContentsByNode(startNode, resolvedLocale) } diff --git a/packages/botonic-plugin-flow-builder/src/tracking.ts b/packages/botonic-plugin-flow-builder/src/tracking.ts index a977ab21e0..71f2237663 100644 --- a/packages/botonic-plugin-flow-builder/src/tracking.ts +++ b/packages/botonic-plugin-flow-builder/src/tracking.ts @@ -1,5 +1,5 @@ import { ActionRequest } from '@botonic/react' -import { v4 as uuid } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { FlowContent } from './content-fields' import { HtNodeWithContent } from './content-fields/hubtype-fields' @@ -60,7 +60,7 @@ function getContentEventArgs( isMeaningful: boolean } ) { - const flowThreadId = request.session.flow_thread_id ?? uuid() + const flowThreadId = request.session.flow_thread_id ?? uuidv7() request.session.flow_thread_id = flowThreadId return { diff --git a/packages/botonic-react/jest.config.js b/packages/botonic-react/jest.config.js index e3b0b5d623..a5bc4758bd 100644 --- a/packages/botonic-react/jest.config.js +++ b/packages/botonic-react/jest.config.js @@ -13,7 +13,7 @@ module.exports = { ], collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}', '!/node_modules/'], transformIgnorePatterns: [ - 'node_modules/(?!@botonic|axios|react-children-utilities|uuid|parse5).+\\.(js|jsx|tsx)$', + 'node_modules/(?!@botonic|axios|react-children-utilities|parse5).+\\.(js|jsx|tsx)$', ], moduleFileExtensions: ['js', 'jsx', 'json', 'ts', 'tsx'], snapshotSerializers: [], diff --git a/packages/botonic-react/package.json b/packages/botonic-react/package.json index 78bd5a5fde..e7d7be03ea 100644 --- a/packages/botonic-react/package.json +++ b/packages/botonic-react/package.json @@ -32,7 +32,7 @@ "react-textarea-autosize": "^8.5.3", "styled-components": "^5.3.0", "ua-parser-js": "^1.0.39", - "uuid": "^8.3.2" + "uuid": "^10.0.0" }, "devDependencies": { "@babel/plugin-transform-runtime": "^7.23.9", @@ -43,6 +43,7 @@ "@types/parse5": "^7.0.0", "@types/react": "^16.14.56", "@types/styled-components": "^5.1.34", + "@types/uuid": "^10.0.0", "babel-plugin-add-module-exports": "^1.0.4", "copyfiles": "^2.4.1", "identity-obj-proxy": "^3.0.0", diff --git a/packages/botonic-react/src/components/message/index.jsx b/packages/botonic-react/src/components/message/index.jsx index ffd269219c..656743bea0 100644 --- a/packages/botonic-react/src/components/message/index.jsx +++ b/packages/botonic-react/src/components/message/index.jsx @@ -1,6 +1,6 @@ import { INPUT, isBrowser } from '@botonic/core' import React, { useContext, useEffect, useState } from 'react' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { COLORS, WEBCHAT } from '../../constants' import { RequestContext, WebchatContext } from '../../contexts' @@ -49,7 +49,7 @@ export const Message = props => { const { webchatState, addMessage, updateReplies, getThemeProperty } = useContext(WebchatContext) const [state, setState] = useState({ - id: props.id || uuidv4(), + id: props.id || uuidv7(), }) const [disabled, setDisabled] = useState(false) diff --git a/packages/botonic-react/src/components/message/message-feedback.tsx b/packages/botonic-react/src/components/message/message-feedback.tsx index 9b2ebef09c..33c312265a 100644 --- a/packages/botonic-react/src/components/message/message-feedback.tsx +++ b/packages/botonic-react/src/components/message/message-feedback.tsx @@ -1,5 +1,5 @@ import React, { useContext, useEffect, useState } from 'react' -import { v4 as uuid } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import ThumbsDown from '../../assets/thumbs-down.svg' import ThumbsUp from '../../assets/thumbs-up.svg' @@ -70,7 +70,7 @@ export const MessageFeedback = ({ knowledgebaseInferenceId: inferenceId, feedbackBotInteractionId: botInteractionId, feedbackTargetId: messageId, - feedbackGroupId: uuid(), + feedbackGroupId: uuidv7(), possibleOptions: [FeedbackOption.ThumbsDown, FeedbackOption.ThumbsUp], possibleValues: [0, 1], option: isUseful ? FeedbackOption.ThumbsUp : FeedbackOption.ThumbsDown, diff --git a/packages/botonic-react/src/util/webchat.js b/packages/botonic-react/src/util/webchat.js index 0a40492171..80b483aab4 100644 --- a/packages/botonic-react/src/util/webchat.js +++ b/packages/botonic-react/src/util/webchat.js @@ -1,6 +1,6 @@ import merge from 'lodash.merge' import UAParser from 'ua-parser-js' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { WEBCHAT } from '../constants' import { getProperty } from './objects' @@ -31,7 +31,7 @@ export const createUser = () => { let name = `${ua.os.name} ${ua.browser.name}` if (ua.device && ua.device.type) name = `${ua.device.type} ${name}` return { - id: uuidv4(), + id: uuidv7(), name, } } diff --git a/packages/botonic-react/src/webchat/input-panel/index.tsx b/packages/botonic-react/src/webchat/input-panel/index.tsx index 70dde0a718..e6f00c782c 100644 --- a/packages/botonic-react/src/webchat/input-panel/index.tsx +++ b/packages/botonic-react/src/webchat/input-panel/index.tsx @@ -1,6 +1,6 @@ import { INPUT } from '@botonic/core' import React, { useContext } from 'react' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { WEBCHAT } from '../../constants' import { WebchatContext } from '../../contexts' @@ -62,7 +62,7 @@ export const InputPanel = ({ const sendChatEvent = async chatEvent => { const chatEventInput = { - id: uuidv4(), + id: uuidv7(), type: INPUT.CHAT_EVENT, data: chatEvent, } diff --git a/packages/botonic-react/src/webchat/webchat.jsx b/packages/botonic-react/src/webchat/webchat.jsx index 48dc7d2fa7..1ed5add6e1 100644 --- a/packages/botonic-react/src/webchat/webchat.jsx +++ b/packages/botonic-react/src/webchat/webchat.jsx @@ -13,7 +13,7 @@ import React, { useState, } from 'react' import styled, { StyleSheetManager } from 'styled-components' -import { v4 as uuidv4 } from 'uuid' +import { v7 as uuidv7 } from 'uuid' import { Audio, Document, Image, Text, Video } from '../components' import { Handoff } from '../components/handoff' @@ -468,7 +468,7 @@ export const Webchat = forwardRef((props, ref) => { if (!input || Object.keys(input).length == 0) return 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) if (isText(input) && checkBlockInput(input)) return - if (!input.id) input.id = uuidv4() + if (!input.id) input.id = uuidv7() const messageComponent = messageComponentFromInput(input) if (messageComponent) addMessageComponent(messageComponent) if (isMedia(input)) input.data = await readDataURL(input.data)