@memori.ai/memori-react 8.41.1 → 8.41.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/CHANGELOG.md +7 -0
- package/dist/components/Avatar/Avatar.js +5 -10
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/layouts/website-assistant.css +2 -1
- package/dist/types/integration.d.ts +3 -0
- package/dist/types/integration.js +16 -0
- package/dist/types/integration.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/components/Avatar/Avatar.js +5 -10
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/layouts/website-assistant.css +2 -1
- package/esm/types/integration.d.ts +3 -0
- package/esm/types/integration.js +11 -0
- package/esm/types/integration.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +1 -1
- package/src/components/Avatar/Avatar.stories.tsx +45 -28
- package/src/components/Avatar/Avatar.test.tsx +27 -0
- package/src/components/Avatar/Avatar.tsx +8 -12
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +63 -0
- package/src/components/layouts/website-assistant.css +2 -1
- package/src/types/integration.test.ts +32 -0
- package/src/types/integration.ts +31 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [8.41.2](https://github.com/memori-ai/memori-react/compare/v8.41.1...v8.41.2) (2026-06-25)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add avatar-configurator support in Avatar component and related tests ([1575bd8](https://github.com/memori-ai/memori-react/commit/1575bd8c48b6a15f2790e3a0fb64aaca2f991861))
|
|
9
|
+
|
|
3
10
|
## [8.41.1](https://github.com/memori-ai/memori-react/compare/v8.41.0...v8.41.1) (2026-06-25)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -16,6 +16,7 @@ const Edit_1 = tslib_1.__importDefault(require("../icons/Edit"));
|
|
|
16
16
|
const classnames_1 = tslib_1.__importDefault(require("classnames"));
|
|
17
17
|
const AvatarView_1 = tslib_1.__importDefault(require("./AvatarView"));
|
|
18
18
|
const visemeContext_1 = require("../../context/visemeContext");
|
|
19
|
+
const integration_1 = require("../../types/integration");
|
|
19
20
|
const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = false, avatar3dVisible = false, setAvatar3dVisible, hasUserActivatedSpeak = false, isPlayingAudio = false, loading = false, baseUrl, apiUrl, animation, isZoomed = false, chatProps, avatarType = null, enablePositionControls, setEnablePositionControls, isTotem = false, }) => {
|
|
20
21
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
21
22
|
const [isClient, setIsClient] = (0, react_1.useState)(false);
|
|
@@ -38,11 +39,7 @@ const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = fal
|
|
|
38
39
|
return undefined;
|
|
39
40
|
};
|
|
40
41
|
const renderAvatar = () => {
|
|
41
|
-
if (((integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar
|
|
42
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'readyplayerme-full' ||
|
|
43
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customglb' ||
|
|
44
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customrpm') &&
|
|
45
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL) &&
|
|
42
|
+
if ((0, integration_1.is3dAvatarWithUrl)(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar, integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL) &&
|
|
46
43
|
avatarType &&
|
|
47
44
|
avatarType !== 'blob') {
|
|
48
45
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('memori--avatar-wrapper', `memori--avatar-${(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) || 'default'}`, {
|
|
@@ -53,14 +50,12 @@ const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = fal
|
|
|
53
50
|
};
|
|
54
51
|
const renderAvatarContent = () => {
|
|
55
52
|
var _a;
|
|
56
|
-
if (!isClient)
|
|
53
|
+
if (!isClient || !integrationConfig)
|
|
57
54
|
return null;
|
|
58
|
-
if ((
|
|
59
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'readyplayerme-full' ||
|
|
60
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customrpm') {
|
|
55
|
+
if ((0, integration_1.usesRpmAvatarView)(integrationConfig.avatar)) {
|
|
61
56
|
return ((0, jsx_runtime_1.jsx)(ErrorBoundary_1.default, { fallback: (0, jsx_runtime_1.jsx)("div", { className: "memori--blob-container", children: isClient && ((0, jsx_runtime_1.jsx)(Blob_1.default, { speaking: isPlayingAudio, avatar: getAvatarUrl() })) }), children: (0, jsx_runtime_1.jsx)(AvatarView_1.default, { enablePositionControls: enablePositionControls, updateCurrentViseme: updateCurrentViseme, url: integrationConfig.avatarURL, sex: memori.voiceType === 'FEMALE' ? 'FEMALE' : 'MALE', fallbackImg: getAvatarUrl(), headMovement: true, eyeBlink: true, animation: animation, halfBody: integrationConfig.avatar === 'readyplayerme', speaking: isPlayingAudio, loading: loading, style: getAvatarStyle(), stopProcessing: stopProcessing, resetVisemeQueue: resetVisemeQueue, isZoomed: isZoomed, isTotem: isTotem, chatEmission: (_a = chatProps === null || chatProps === void 0 ? void 0 : chatProps.dialogState) === null || _a === void 0 ? void 0 : _a.emission, setEnablePositionControls: setEnablePositionControls }) }));
|
|
62
57
|
}
|
|
63
|
-
if (
|
|
58
|
+
if (integrationConfig.avatar === 'customglb') {
|
|
64
59
|
return ((0, jsx_runtime_1.jsx)(ModelViewer_1.default, { poster: getAvatarUrl() || '', src: integrationConfig.avatarURL, alt: "" }));
|
|
65
60
|
}
|
|
66
61
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":";;;;AAAA,iCAAyD;AAMzD,2FAA2D;AAC3D,oEAAoC;AACpC,+CAAqD;AACrD,gEAAgC;AAChC,8FAA8D;AAC9D,kEAAkC;AAClC,iDAA+C;AAC/C,+DAA+B;AAC/B,iFAAiD;AACjD,iEAAiC;AACjC,oEAA4B;AAC5B,sEAA+C;AAC/C,+DAAwD;
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":";;;;AAAA,iCAAyD;AAMzD,2FAA2D;AAC3D,oEAAoC;AACpC,+CAAqD;AACrD,gEAAgC;AAChC,8FAA8D;AAC9D,kEAAkC;AAClC,iDAA+C;AAC/C,+DAA+B;AAC/B,iFAAiD;AACjD,iEAAiC;AACjC,oEAA4B;AAC5B,sEAA+C;AAC/C,+DAAwD;AACxD,yDAA+E;AAwB/E,MAAM,MAAM,GAAoB,CAAC,EAC/B,MAAM,EACN,WAAW,EACX,iBAAiB,EACjB,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,eAAe,GAAG,KAAK,EACvB,kBAAkB,EAClB,qBAAqB,GAAG,KAAK,EAC7B,cAAc,GAAG,KAAK,EACtB,OAAO,GAAG,KAAK,EACf,OAAO,EACP,MAAM,EACN,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,UAAU,GAAG,IAAI,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,OAAO,GAAG,KAAK,GAChB,EAAE,EAAE;IACH,MAAM,EAAE,CAAC,EAAE,GAAG,IAAA,8BAAc,GAAE,CAAC;IAC/B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBA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IAAI,IACjC,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IACtC,IAAI,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,gBACrC,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa;YACxB,CAAC,CAAC,gBAAgB,WAAW,CAAC,aAAa,uBAAuB;YAClE,CAAC,CAAC,EACN,EAAE,CAAC;QAEH,OAAO,CACL,gCAAK,SAAS,EAAC,qCAAqC,YAClD,8BACE,SAAS,EAAC,6DAA6D,EACvE,IAAI,EAAE,IAAI,YAEV,uBAAC,iBAAO,IAAC,OAAO,EAAE,CAAC,CAAC,yCAAyC,CAAC,YAC5D,iCAAM,SAAS,EAAC,qBAAqB,YACnC,uBAAC,cAAI,KAAG,GACH,GACC,GACR,GACA,CACP,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,6DACG,YAAY,EAAE,EACd,sBAAsB,EAAE,IACxB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,IAAA,YAAI,EAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;IACnD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
|
|
@@ -397,7 +397,8 @@
|
|
|
397
397
|
transform: none !important;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div
|
|
400
|
+
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div,
|
|
401
|
+
.memori-layout-website_assistant.memori--avatar-avatar-configurator .memori--avatar-wrapper > div {
|
|
401
402
|
transform: scale(1.7) translate(0px, 10vh);
|
|
402
403
|
}
|
|
403
404
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type AvatarMode = 'readyplayerme' | 'readyplayerme-full' | 'customglb' | 'customrpm' | 'userAvatar' | 'avatar-configurator';
|
|
2
|
+
export declare const is3dAvatarWithUrl: (avatar: AvatarMode | string | undefined, avatarURL: string | undefined) => boolean;
|
|
3
|
+
export declare const usesRpmAvatarView: (avatar: AvatarMode | string | undefined) => boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.usesRpmAvatarView = exports.is3dAvatarWithUrl = void 0;
|
|
4
|
+
const is3dAvatarWithUrl = (avatar, avatarURL) => !!avatarURL &&
|
|
5
|
+
(avatar === 'readyplayerme' ||
|
|
6
|
+
avatar === 'readyplayerme-full' ||
|
|
7
|
+
avatar === 'customglb' ||
|
|
8
|
+
avatar === 'customrpm' ||
|
|
9
|
+
avatar === 'avatar-configurator');
|
|
10
|
+
exports.is3dAvatarWithUrl = is3dAvatarWithUrl;
|
|
11
|
+
const usesRpmAvatarView = (avatar) => avatar === 'readyplayerme' ||
|
|
12
|
+
avatar === 'readyplayerme-full' ||
|
|
13
|
+
avatar === 'customrpm' ||
|
|
14
|
+
avatar === 'avatar-configurator';
|
|
15
|
+
exports.usesRpmAvatarView = usesRpmAvatarView;
|
|
16
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":";;;AAYO,MAAM,iBAAiB,GAAG,CAC/B,MAAuC,EACvC,SAA6B,EACpB,EAAE,CACX,CAAC,CAAC,SAAS;IACX,CAAC,MAAM,KAAK,eAAe;QACzB,MAAM,KAAK,oBAAoB;QAC/B,MAAM,KAAK,WAAW;QACtB,MAAM,KAAK,WAAW;QACtB,MAAM,KAAK,qBAAqB,CAAC,CAAC;AATzB,QAAA,iBAAiB,qBASQ;AAG/B,MAAM,iBAAiB,GAAG,CAC/B,MAAuC,EAC9B,EAAE,CACX,MAAM,KAAK,eAAe;IAC1B,MAAM,KAAK,oBAAoB;IAC/B,MAAM,KAAK,WAAW;IACtB,MAAM,KAAK,qBAAqB,CAAC;AANtB,QAAA,iBAAiB,qBAMK"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.41.
|
|
1
|
+
export declare const version = "8.41.2";
|
package/dist/version.js
CHANGED
|
@@ -13,6 +13,7 @@ import Edit from '../icons/Edit';
|
|
|
13
13
|
import cx from 'classnames';
|
|
14
14
|
import ContainerAvatarView from './AvatarView';
|
|
15
15
|
import { useViseme } from '../../context/visemeContext';
|
|
16
|
+
import { is3dAvatarWithUrl, usesRpmAvatarView } from '../../types/integration';
|
|
16
17
|
const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = false, avatar3dVisible = false, setAvatar3dVisible, hasUserActivatedSpeak = false, isPlayingAudio = false, loading = false, baseUrl, apiUrl, animation, isZoomed = false, chatProps, avatarType = null, enablePositionControls, setEnablePositionControls, isTotem = false, }) => {
|
|
17
18
|
const { t } = useTranslation();
|
|
18
19
|
const [isClient, setIsClient] = useState(false);
|
|
@@ -35,11 +36,7 @@ const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = fal
|
|
|
35
36
|
return undefined;
|
|
36
37
|
};
|
|
37
38
|
const renderAvatar = () => {
|
|
38
|
-
if ((
|
|
39
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'readyplayerme-full' ||
|
|
40
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customglb' ||
|
|
41
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customrpm') &&
|
|
42
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL) &&
|
|
39
|
+
if (is3dAvatarWithUrl(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar, integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatarURL) &&
|
|
43
40
|
avatarType &&
|
|
44
41
|
avatarType !== 'blob') {
|
|
45
42
|
return (_jsxs(_Fragment, { children: [_jsx("div", { className: cx('memori--avatar-wrapper', `memori--avatar-${(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) || 'default'}`, {
|
|
@@ -50,14 +47,12 @@ const Avatar = ({ memori, integration, integrationConfig, tenant, instruct = fal
|
|
|
50
47
|
};
|
|
51
48
|
const renderAvatarContent = () => {
|
|
52
49
|
var _a;
|
|
53
|
-
if (!isClient)
|
|
50
|
+
if (!isClient || !integrationConfig)
|
|
54
51
|
return null;
|
|
55
|
-
if ((integrationConfig
|
|
56
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'readyplayerme-full' ||
|
|
57
|
-
(integrationConfig === null || integrationConfig === void 0 ? void 0 : integrationConfig.avatar) === 'customrpm') {
|
|
52
|
+
if (usesRpmAvatarView(integrationConfig.avatar)) {
|
|
58
53
|
return (_jsx(ErrorBoundary, { fallback: _jsx("div", { className: "memori--blob-container", children: isClient && (_jsx(Blob, { speaking: isPlayingAudio, avatar: getAvatarUrl() })) }), children: _jsx(ContainerAvatarView, { enablePositionControls: enablePositionControls, updateCurrentViseme: updateCurrentViseme, url: integrationConfig.avatarURL, sex: memori.voiceType === 'FEMALE' ? 'FEMALE' : 'MALE', fallbackImg: getAvatarUrl(), headMovement: true, eyeBlink: true, animation: animation, halfBody: integrationConfig.avatar === 'readyplayerme', speaking: isPlayingAudio, loading: loading, style: getAvatarStyle(), stopProcessing: stopProcessing, resetVisemeQueue: resetVisemeQueue, isZoomed: isZoomed, isTotem: isTotem, chatEmission: (_a = chatProps === null || chatProps === void 0 ? void 0 : chatProps.dialogState) === null || _a === void 0 ? void 0 : _a.emission, setEnablePositionControls: setEnablePositionControls }) }));
|
|
59
54
|
}
|
|
60
|
-
if (
|
|
55
|
+
if (integrationConfig.avatar === 'customglb') {
|
|
61
56
|
return (_jsx(ModelViewer, { poster: getAvatarUrl() || '', src: integrationConfig.avatarURL, alt: "" }));
|
|
62
57
|
}
|
|
63
58
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,mBAAmB,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../src/components/Avatar/Avatar.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,aAAa,MAAM,gCAAgC,CAAC;AAC3D,OAAO,OAAO,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,IAAI,MAAM,cAAc,CAAC;AAChC,OAAO,WAAW,MAAM,qCAAqC,CAAC;AAC9D,OAAO,MAAM,MAAM,cAAc,CAAC;AAClC,OAAO,E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S,EAAC,qBAAqB,YACnC,KAAC,IAAI,KAAG,GACH,GACC,GACR,GACA,CACP,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,8BACG,YAAY,EAAE,EACd,sBAAsB,EAAE,IACxB,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;IACnD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;AACjE,CAAC,CAAC,CAAC"}
|
|
@@ -397,7 +397,8 @@
|
|
|
397
397
|
transform: none !important;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div
|
|
400
|
+
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div,
|
|
401
|
+
.memori-layout-website_assistant.memori--avatar-avatar-configurator .memori--avatar-wrapper > div {
|
|
401
402
|
transform: scale(1.7) translate(0px, 10vh);
|
|
402
403
|
}
|
|
403
404
|
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type AvatarMode = 'readyplayerme' | 'readyplayerme-full' | 'customglb' | 'customrpm' | 'userAvatar' | 'avatar-configurator';
|
|
2
|
+
export declare const is3dAvatarWithUrl: (avatar: AvatarMode | string | undefined, avatarURL: string | undefined) => boolean;
|
|
3
|
+
export declare const usesRpmAvatarView: (avatar: AvatarMode | string | undefined) => boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const is3dAvatarWithUrl = (avatar, avatarURL) => !!avatarURL &&
|
|
2
|
+
(avatar === 'readyplayerme' ||
|
|
3
|
+
avatar === 'readyplayerme-full' ||
|
|
4
|
+
avatar === 'customglb' ||
|
|
5
|
+
avatar === 'customrpm' ||
|
|
6
|
+
avatar === 'avatar-configurator');
|
|
7
|
+
export const usesRpmAvatarView = (avatar) => avatar === 'readyplayerme' ||
|
|
8
|
+
avatar === 'readyplayerme-full' ||
|
|
9
|
+
avatar === 'customrpm' ||
|
|
10
|
+
avatar === 'avatar-configurator';
|
|
11
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../src/types/integration.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAAuC,EACvC,SAA6B,EACpB,EAAE,CACX,CAAC,CAAC,SAAS;IACX,CAAC,MAAM,KAAK,eAAe;QACzB,MAAM,KAAK,oBAAoB;QAC/B,MAAM,KAAK,WAAW;QACtB,MAAM,KAAK,WAAW;QACtB,MAAM,KAAK,qBAAqB,CAAC,CAAC;AAGtC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,MAAuC,EAC9B,EAAE,CACX,MAAM,KAAK,eAAe;IAC1B,MAAM,KAAK,oBAAoB;IAC/B,MAAM,KAAK,WAAW;IACtB,MAAM,KAAK,qBAAqB,CAAC"}
|
package/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "8.41.
|
|
1
|
+
export declare const version = "8.41.2";
|
package/esm/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '8.41.
|
|
1
|
+
export const version = '8.41.2';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import Avatar, { Props } from './Avatar';
|
|
|
6
6
|
|
|
7
7
|
import './Avatar.css';
|
|
8
8
|
import { ArtifactProvider } from '../MemoriArtifactSystem/context/ArtifactContext';
|
|
9
|
+
import { VisemeProvider } from '../../context/visemeContext';
|
|
9
10
|
|
|
10
11
|
const meta: Meta = {
|
|
11
12
|
title: 'Widget/Avatar',
|
|
@@ -33,34 +34,38 @@ const Template: Story<Props> = args => {
|
|
|
33
34
|
|
|
34
35
|
return (
|
|
35
36
|
<I18nWrapper>
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
37
|
+
<VisemeProvider>
|
|
38
|
+
{' '}
|
|
39
|
+
<ArtifactProvider>
|
|
40
|
+
<div
|
|
41
|
+
style={
|
|
42
|
+
args.integrationConfig?.avatar === 'customglb' ||
|
|
43
|
+
args.integrationConfig?.avatar === 'readyplayerme' ||
|
|
44
|
+
args.integrationConfig?.avatar === 'readyplayerme-full' ||
|
|
45
|
+
args.integrationConfig?.avatar === 'avatar-configurator'
|
|
46
|
+
? {}
|
|
47
|
+
: { marginTop: '20vw' }
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
<Avatar
|
|
51
|
+
{...args}
|
|
52
|
+
integrationConfig={
|
|
53
|
+
args.integrationConfig
|
|
54
|
+
? {
|
|
55
|
+
...args.integrationConfig,
|
|
56
|
+
avatarURL:
|
|
57
|
+
args.integrationConfig.avatarURL?.split('#')?.[0] +
|
|
58
|
+
`#${new Date(Date.now()).toISOString()}`,
|
|
59
|
+
}
|
|
60
|
+
: undefined
|
|
61
|
+
}
|
|
62
|
+
avatar3dVisible={avatar3dVisible}
|
|
63
|
+
setAvatar3dVisible={setAvatar3dVisible}
|
|
64
|
+
key={Date.now()}
|
|
65
|
+
/>
|
|
66
|
+
</div>
|
|
67
|
+
</ArtifactProvider>
|
|
68
|
+
</VisemeProvider>
|
|
64
69
|
</I18nWrapper>
|
|
65
70
|
);
|
|
66
71
|
};
|
|
@@ -141,3 +146,15 @@ FullbodyReadyPlayerMeAvatar.args = {
|
|
|
141
146
|
'https://models.readyplayer.me/63b55751f17e295642bf07a2.glb#1669136149862',
|
|
142
147
|
},
|
|
143
148
|
};
|
|
149
|
+
|
|
150
|
+
export const AvatarConfigurator = Template.bind({});
|
|
151
|
+
AvatarConfigurator.args = {
|
|
152
|
+
...FullbodyReadyPlayerMeAvatar.args,
|
|
153
|
+
integrationConfig: {
|
|
154
|
+
...integrationConfig,
|
|
155
|
+
avatar: 'avatar-configurator',
|
|
156
|
+
avatarURL:
|
|
157
|
+
'https://models.readyplayer.me/63b55751f17e295642bf07a2.glb#1669136149862',
|
|
158
|
+
},
|
|
159
|
+
avatarType: 'avatar3d',
|
|
160
|
+
};
|
|
@@ -102,3 +102,30 @@ it('renders Avatar with rpm 3d avatar unchanged', () => {
|
|
|
102
102
|
);
|
|
103
103
|
expect(container).toMatchSnapshot();
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
it('renders Avatar with avatar-configurator like readyplayerme-full', () => {
|
|
107
|
+
const { container } = render(
|
|
108
|
+
<VisemeProvider>
|
|
109
|
+
<Avatar
|
|
110
|
+
memori={memori}
|
|
111
|
+
integration={integration}
|
|
112
|
+
isTotem={false}
|
|
113
|
+
setEnablePositionControls={() => {}}
|
|
114
|
+
integrationConfig={{
|
|
115
|
+
...integrationConfig,
|
|
116
|
+
avatar: 'avatar-configurator',
|
|
117
|
+
avatarURL:
|
|
118
|
+
'https://assets.memori.ai/api/v2/asset/b791f77c-1a94-4272-829e-eca82fcc62b7.glb',
|
|
119
|
+
}}
|
|
120
|
+
tenant={tenant}
|
|
121
|
+
instruct={false}
|
|
122
|
+
avatar3dVisible={true}
|
|
123
|
+
setAvatar3dVisible={() => {}}
|
|
124
|
+
hasUserActivatedSpeak={false}
|
|
125
|
+
isPlayingAudio={false}
|
|
126
|
+
avatarType="avatar3d"
|
|
127
|
+
/>
|
|
128
|
+
</VisemeProvider>
|
|
129
|
+
);
|
|
130
|
+
expect(container).toMatchSnapshot();
|
|
131
|
+
});
|
|
@@ -17,6 +17,7 @@ import Edit from '../icons/Edit';
|
|
|
17
17
|
import cx from 'classnames';
|
|
18
18
|
import ContainerAvatarView from './AvatarView';
|
|
19
19
|
import { useViseme } from '../../context/visemeContext';
|
|
20
|
+
import { is3dAvatarWithUrl, usesRpmAvatarView } from '../../types/integration';
|
|
20
21
|
|
|
21
22
|
export interface Props {
|
|
22
23
|
memori: Memori;
|
|
@@ -90,11 +91,10 @@ const Avatar: React.FC<Props> = ({
|
|
|
90
91
|
|
|
91
92
|
const renderAvatar = () => {
|
|
92
93
|
if (
|
|
93
|
-
(
|
|
94
|
-
integrationConfig?.avatar
|
|
95
|
-
integrationConfig?.
|
|
96
|
-
|
|
97
|
-
integrationConfig?.avatarURL &&
|
|
94
|
+
is3dAvatarWithUrl(
|
|
95
|
+
integrationConfig?.avatar,
|
|
96
|
+
integrationConfig?.avatarURL
|
|
97
|
+
) &&
|
|
98
98
|
avatarType &&
|
|
99
99
|
avatarType !== 'blob'
|
|
100
100
|
) {
|
|
@@ -123,12 +123,8 @@ const Avatar: React.FC<Props> = ({
|
|
|
123
123
|
};
|
|
124
124
|
|
|
125
125
|
const renderAvatarContent = () => {
|
|
126
|
-
if (!isClient) return null;
|
|
127
|
-
if (
|
|
128
|
-
integrationConfig?.avatar === 'readyplayerme' ||
|
|
129
|
-
integrationConfig?.avatar === 'readyplayerme-full' ||
|
|
130
|
-
integrationConfig?.avatar === 'customrpm'
|
|
131
|
-
) {
|
|
126
|
+
if (!isClient || !integrationConfig) return null;
|
|
127
|
+
if (usesRpmAvatarView(integrationConfig.avatar)) {
|
|
132
128
|
return (
|
|
133
129
|
<ErrorBoundary
|
|
134
130
|
fallback={
|
|
@@ -163,7 +159,7 @@ const Avatar: React.FC<Props> = ({
|
|
|
163
159
|
);
|
|
164
160
|
}
|
|
165
161
|
|
|
166
|
-
if (integrationConfig
|
|
162
|
+
if (integrationConfig.avatar === 'customglb') {
|
|
167
163
|
return (
|
|
168
164
|
<ModelViewer
|
|
169
165
|
poster={getAvatarUrl() || ''}
|
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
+
exports[`renders Avatar with avatar-configurator like readyplayerme-full 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="memori--avatar-wrapper memori--avatar-avatar-configurator"
|
|
7
|
+
>
|
|
8
|
+
<div
|
|
9
|
+
class="memori--blob-container"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
class="memori-blob"
|
|
13
|
+
>
|
|
14
|
+
<div
|
|
15
|
+
class="mainDiv"
|
|
16
|
+
/>
|
|
17
|
+
<div
|
|
18
|
+
class="mainDiv"
|
|
19
|
+
/>
|
|
20
|
+
<div
|
|
21
|
+
class="mainDiv"
|
|
22
|
+
/>
|
|
23
|
+
<div
|
|
24
|
+
class="mainDiv"
|
|
25
|
+
/>
|
|
26
|
+
<div
|
|
27
|
+
class="mainDiv"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<div
|
|
33
|
+
class="memori--avatar-toggle"
|
|
34
|
+
>
|
|
35
|
+
<button
|
|
36
|
+
class="memori-button memori-button--ghost memori-button--rounded memori-button--padded memori-button--with-icon"
|
|
37
|
+
>
|
|
38
|
+
<span
|
|
39
|
+
class="memori-button--icon"
|
|
40
|
+
>
|
|
41
|
+
<svg
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
focusable="false"
|
|
44
|
+
role="img"
|
|
45
|
+
viewBox="0 0 1024 1024"
|
|
46
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
47
|
+
>
|
|
48
|
+
<path
|
|
49
|
+
d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"
|
|
50
|
+
/>
|
|
51
|
+
<path
|
|
52
|
+
d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"
|
|
53
|
+
/>
|
|
54
|
+
</svg>
|
|
55
|
+
</span>
|
|
56
|
+
<span
|
|
57
|
+
class="memori--avatar-toggle-text"
|
|
58
|
+
>
|
|
59
|
+
hide
|
|
60
|
+
</span>
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
`;
|
|
65
|
+
|
|
3
66
|
exports[`renders Avatar with blob and avatar in blob unchanged 1`] = `
|
|
4
67
|
<div>
|
|
5
68
|
<div
|
|
@@ -397,7 +397,8 @@
|
|
|
397
397
|
transform: none !important;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div
|
|
400
|
+
.memori-layout-website_assistant.memori--avatar-readyplayerme-full .memori--avatar-wrapper > div,
|
|
401
|
+
.memori-layout-website_assistant.memori--avatar-avatar-configurator .memori--avatar-wrapper > div {
|
|
401
402
|
transform: scale(1.7) translate(0px, 10vh);
|
|
402
403
|
}
|
|
403
404
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
is3dAvatarWithUrl,
|
|
3
|
+
usesRpmAvatarView,
|
|
4
|
+
} from './integration';
|
|
5
|
+
|
|
6
|
+
describe('integration avatar helpers', () => {
|
|
7
|
+
const avatarURL = 'https://example.com/avatar.glb';
|
|
8
|
+
|
|
9
|
+
describe('is3dAvatarWithUrl', () => {
|
|
10
|
+
it('returns true for avatar-configurator with avatarURL', () => {
|
|
11
|
+
expect(is3dAvatarWithUrl('avatar-configurator', avatarURL)).toBe(true);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('returns false for avatar-configurator without avatarURL', () => {
|
|
15
|
+
expect(is3dAvatarWithUrl('avatar-configurator', undefined)).toBe(false);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe('usesRpmAvatarView', () => {
|
|
20
|
+
it('returns true for avatar-configurator', () => {
|
|
21
|
+
expect(usesRpmAvatarView('avatar-configurator')).toBe(true);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('returns true for readyplayerme-full', () => {
|
|
25
|
+
expect(usesRpmAvatarView('readyplayerme-full')).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('returns false for customglb', () => {
|
|
29
|
+
expect(usesRpmAvatarView('customglb')).toBe(false);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Avatar mode stored in integration.customData.avatar.
|
|
3
|
+
* `avatar-configurator` is used in admin/editor UI; at runtime it renders like `readyplayerme-full`.
|
|
4
|
+
*/
|
|
5
|
+
export type AvatarMode =
|
|
6
|
+
| 'readyplayerme'
|
|
7
|
+
| 'readyplayerme-full'
|
|
8
|
+
| 'customglb'
|
|
9
|
+
| 'customrpm'
|
|
10
|
+
| 'userAvatar'
|
|
11
|
+
| 'avatar-configurator';
|
|
12
|
+
|
|
13
|
+
export const is3dAvatarWithUrl = (
|
|
14
|
+
avatar: AvatarMode | string | undefined,
|
|
15
|
+
avatarURL: string | undefined
|
|
16
|
+
): boolean =>
|
|
17
|
+
!!avatarURL &&
|
|
18
|
+
(avatar === 'readyplayerme' ||
|
|
19
|
+
avatar === 'readyplayerme-full' ||
|
|
20
|
+
avatar === 'customglb' ||
|
|
21
|
+
avatar === 'customrpm' ||
|
|
22
|
+
avatar === 'avatar-configurator');
|
|
23
|
+
|
|
24
|
+
/** RPM-based 3D avatar view (ContainerAvatarView), including avatar-configurator exports. */
|
|
25
|
+
export const usesRpmAvatarView = (
|
|
26
|
+
avatar: AvatarMode | string | undefined
|
|
27
|
+
): boolean =>
|
|
28
|
+
avatar === 'readyplayerme' ||
|
|
29
|
+
avatar === 'readyplayerme-full' ||
|
|
30
|
+
avatar === 'customrpm' ||
|
|
31
|
+
avatar === 'avatar-configurator';
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is auto-generated. Do not edit manually.
|
|
2
|
-
export const version = '8.41.
|
|
2
|
+
export const version = '8.41.2';
|