@memori.ai/memori-react 1.2.0 → 2.0.0
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 +66 -0
- package/README.md +12 -2
- package/dist/components/AgeVerificationModal/AgeVerificationModal.d.ts +7 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js +39 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.test.d.ts +1 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.test.js +27 -0
- package/dist/components/AgeVerificationModal/AgeVerificationModal.test.js.map +1 -0
- package/dist/components/AttachmentLinkModal/AttachmentLinkModal.stories.d.ts +2 -2
- package/dist/components/AttachmentMediaModal/AttachmentMediaModal.stories.d.ts +2 -2
- package/dist/components/Auth/Auth.stories.d.ts +5 -5
- package/dist/components/Avatar/Avatar.js +2 -2
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +5 -5
- package/dist/components/AvatarView/AvatarView.stories.d.ts +10 -10
- package/dist/components/AvatarView/components/fullbodyAvatar.d.ts +2 -1
- package/dist/components/AvatarView/components/fullbodyAvatar.js +6 -3
- package/dist/components/AvatarView/components/fullbodyAvatar.js.map +1 -1
- package/dist/components/AvatarView/components/loader.js +3 -1
- package/dist/components/AvatarView/components/loader.js.map +1 -1
- package/dist/components/AvatarView/index.d.ts +2 -1
- package/dist/components/AvatarView/index.js +2 -2
- package/dist/components/AvatarView/index.js.map +1 -1
- package/dist/components/AvatarView/utils/useMouthSpeaking.js +3 -1
- package/dist/components/AvatarView/utils/useMouthSpeaking.js.map +1 -1
- package/dist/components/Blob/Blob.stories.d.ts +4 -4
- package/dist/components/BlockedMemoriBadge/BlockedMemoriBadge.stories.d.ts +5 -5
- package/dist/components/ChangeMode/ChangeMode.stories.d.ts +3 -3
- package/dist/components/Chat/Chat.stories.d.ts +12 -12
- package/dist/components/ChatBubble/ChatBubble.stories.d.ts +7 -7
- package/dist/components/ChatInputs/ChatInputs.js +2 -1
- package/dist/components/ChatInputs/ChatInputs.js.map +1 -1
- package/dist/components/ChatInputs/ChatInputs.stories.d.ts +9 -9
- package/dist/components/ChatTextArea/ChatTextArea.stories.d.ts +4 -4
- package/dist/components/CustomGLBModelViewer/ModelViewer.stories.d.ts +2 -2
- package/dist/components/DateSelector/DateSelector.d.ts +9 -0
- package/dist/components/DateSelector/DateSelector.js +61 -0
- package/dist/components/DateSelector/DateSelector.js.map +1 -0
- package/dist/components/DateSelector/DateSelector.test.d.ts +1 -0
- package/dist/components/DateSelector/DateSelector.test.js +24 -0
- package/dist/components/DateSelector/DateSelector.test.js.map +1 -0
- package/dist/components/ExportHistoryButton/ExportHistoryButton.stories.d.ts +5 -5
- package/dist/components/FeedbackButtons/FeedbackButtons.stories.d.ts +4 -4
- package/dist/components/Header/Header.d.ts +1 -0
- package/dist/components/Header/Header.js +26 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/Header/Header.stories.d.ts +7 -7
- package/dist/components/ImageUpload/ImageUpload.stories.d.ts +8 -8
- package/dist/components/MediaWidget/LinkItemWidget.d.ts +2 -1
- package/dist/components/MediaWidget/LinkItemWidget.js +10 -2
- package/dist/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/LinkItemWidget.stories.d.ts +2 -2
- package/dist/components/MediaWidget/MediaItemWidget.d.ts +3 -1
- package/dist/components/MediaWidget/MediaItemWidget.js +44 -72
- package/dist/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaItemWidget.stories.d.ts +3 -3
- package/dist/components/MediaWidget/MediaWidget.js +10 -7
- package/dist/components/MediaWidget/MediaWidget.js.map +1 -1
- package/dist/components/MediaWidget/MediaWidget.stories.d.ts +5 -5
- package/dist/components/MemoriWidget/MemoriWidget.d.ts +3 -2
- package/dist/components/MemoriWidget/MemoriWidget.js +92 -25
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.stories.d.ts +8 -8
- package/dist/components/PoweredBy/PoweredBy.stories.d.ts +4 -4
- package/dist/components/SendOnEnterMenu/SendOnEnterMenu.stories.d.ts +3 -3
- package/dist/components/SettingsDrawer/SettingsDrawer.d.ts +13 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.js +27 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.js.map +1 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.test.d.ts +1 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js +27 -0
- package/dist/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -0
- package/dist/components/ShareButton/ShareButton.stories.d.ts +4 -4
- package/dist/components/Snippet/Snippet.stories.d.ts +15 -15
- package/dist/components/StartPanel/StartPanel.d.ts +1 -1
- package/dist/components/StartPanel/StartPanel.js +10 -7
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.stories.d.ts +6 -6
- package/dist/components/StartPanel/StartPanel.test.js +7 -0
- package/dist/components/StartPanel/StartPanel.test.js.map +1 -1
- package/dist/components/UploadMenu/UploadMenu.stories.d.ts +4 -4
- package/dist/components/icons/Refresh.d.ts +5 -0
- package/dist/components/icons/Refresh.js +6 -0
- package/dist/components/icons/Refresh.js.map +1 -0
- package/dist/components/icons/SelectIcon.d.ts +5 -0
- package/dist/components/icons/SelectIcon.js +6 -0
- package/dist/components/icons/SelectIcon.js.map +1 -0
- package/dist/components/icons/icons.stories.d.ts +2 -2
- package/dist/components/layouts/FullPage.d.ts +17 -0
- package/dist/components/layouts/FullPage.js +8 -0
- package/dist/components/layouts/FullPage.js.map +1 -0
- package/dist/components/layouts/FullPage.test.d.ts +1 -0
- package/dist/components/layouts/FullPage.test.js +12 -0
- package/dist/components/layouts/FullPage.test.js.map +1 -0
- package/dist/components/layouts/Totem.d.ts +17 -0
- package/dist/components/layouts/Totem.js +8 -0
- package/dist/components/layouts/Totem.js.map +1 -0
- package/dist/components/layouts/Totem.test.d.ts +1 -0
- package/dist/components/layouts/Totem.test.js +12 -0
- package/dist/components/layouts/Totem.test.js.map +1 -0
- package/dist/components/ui/Button.stories.d.ts +14 -14
- package/dist/components/ui/Card.stories.d.ts +7 -7
- package/dist/components/ui/Checkbox.d.ts +2 -0
- package/dist/components/ui/Checkbox.js +2 -2
- package/dist/components/ui/Checkbox.js.map +1 -1
- package/dist/components/ui/Checkbox.stories.d.ts +5 -5
- package/dist/components/ui/Drawer.stories.d.ts +9 -9
- package/dist/components/ui/Modal.stories.d.ts +9 -9
- package/dist/components/ui/Select.d.ts +15 -0
- package/dist/components/ui/Select.js +17 -0
- package/dist/components/ui/Select.js.map +1 -0
- package/dist/components/ui/Select.test.d.ts +1 -0
- package/dist/components/ui/Select.test.js +47 -0
- package/dist/components/ui/Select.test.js.map +1 -0
- package/dist/components/ui/Spin.stories.d.ts +4 -4
- package/dist/components/ui/Tooltip.stories.d.ts +6 -6
- package/dist/components/ui/definitions.stories.d.ts +2 -3
- package/dist/helpers/configuration.js +2 -0
- package/dist/helpers/configuration.js.map +1 -1
- package/dist/helpers/utils.js +1 -1
- package/dist/helpers/utils.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.stories.d.ts +2 -2
- package/dist/locales/en.json +17 -0
- package/dist/locales/it.json +17 -0
- package/dist/mocks/data.js +5 -2
- package/dist/mocks/data.js.map +1 -1
- package/esm/components/AgeVerificationModal/AgeVerificationModal.d.ts +7 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js +36 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.js.map +1 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.test.d.ts +1 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.test.js +24 -0
- package/esm/components/AgeVerificationModal/AgeVerificationModal.test.js.map +1 -0
- package/esm/components/Avatar/Avatar.js +2 -2
- package/esm/components/Avatar/Avatar.js.map +1 -1
- package/esm/components/AvatarView/components/fullbodyAvatar.d.ts +2 -1
- package/esm/components/AvatarView/components/fullbodyAvatar.js +7 -4
- package/esm/components/AvatarView/components/fullbodyAvatar.js.map +1 -1
- package/esm/components/AvatarView/components/loader.js +2 -1
- package/esm/components/AvatarView/components/loader.js.map +1 -1
- package/esm/components/AvatarView/index.d.ts +2 -1
- package/esm/components/AvatarView/index.js +2 -2
- package/esm/components/AvatarView/index.js.map +1 -1
- package/esm/components/AvatarView/utils/useMouthSpeaking.js +3 -1
- package/esm/components/AvatarView/utils/useMouthSpeaking.js.map +1 -1
- package/esm/components/ChatInputs/ChatInputs.js +2 -1
- package/esm/components/ChatInputs/ChatInputs.js.map +1 -1
- package/esm/components/DateSelector/DateSelector.d.ts +9 -0
- package/esm/components/DateSelector/DateSelector.js +58 -0
- package/esm/components/DateSelector/DateSelector.js.map +1 -0
- package/esm/components/DateSelector/DateSelector.test.d.ts +1 -0
- package/esm/components/DateSelector/DateSelector.test.js +21 -0
- package/esm/components/DateSelector/DateSelector.test.js.map +1 -0
- package/esm/components/Header/Header.d.ts +1 -0
- package/esm/components/Header/Header.js +26 -2
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MediaWidget/LinkItemWidget.d.ts +2 -1
- package/esm/components/MediaWidget/LinkItemWidget.js +10 -2
- package/esm/components/MediaWidget/LinkItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaItemWidget.d.ts +3 -1
- package/esm/components/MediaWidget/MediaItemWidget.js +44 -72
- package/esm/components/MediaWidget/MediaItemWidget.js.map +1 -1
- package/esm/components/MediaWidget/MediaWidget.js +11 -8
- package/esm/components/MediaWidget/MediaWidget.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.d.ts +3 -2
- package/esm/components/MemoriWidget/MemoriWidget.js +92 -25
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/SettingsDrawer/SettingsDrawer.d.ts +13 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.js +24 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.js.map +1 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.test.d.ts +1 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js +24 -0
- package/esm/components/SettingsDrawer/SettingsDrawer.test.js.map +1 -0
- package/esm/components/StartPanel/StartPanel.d.ts +1 -1
- package/esm/components/StartPanel/StartPanel.js +10 -7
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.test.js +7 -0
- package/esm/components/StartPanel/StartPanel.test.js.map +1 -1
- package/esm/components/icons/Refresh.d.ts +5 -0
- package/esm/components/icons/Refresh.js +4 -0
- package/esm/components/icons/Refresh.js.map +1 -0
- package/esm/components/icons/SelectIcon.d.ts +5 -0
- package/esm/components/icons/SelectIcon.js +4 -0
- package/esm/components/icons/SelectIcon.js.map +1 -0
- package/esm/components/layouts/FullPage.d.ts +17 -0
- package/esm/components/layouts/FullPage.js +5 -0
- package/esm/components/layouts/FullPage.js.map +1 -0
- package/esm/components/layouts/FullPage.test.d.ts +1 -0
- package/esm/components/layouts/FullPage.test.js +9 -0
- package/esm/components/layouts/FullPage.test.js.map +1 -0
- package/esm/components/layouts/Totem.d.ts +17 -0
- package/esm/components/layouts/Totem.js +5 -0
- package/esm/components/layouts/Totem.js.map +1 -0
- package/esm/components/layouts/Totem.test.d.ts +1 -0
- package/esm/components/layouts/Totem.test.js +9 -0
- package/esm/components/layouts/Totem.test.js.map +1 -0
- package/esm/components/ui/Checkbox.d.ts +2 -0
- package/esm/components/ui/Checkbox.js +2 -2
- package/esm/components/ui/Checkbox.js.map +1 -1
- package/esm/components/ui/Select.d.ts +15 -0
- package/esm/components/ui/Select.js +14 -0
- package/esm/components/ui/Select.js.map +1 -0
- package/esm/components/ui/Select.test.d.ts +1 -0
- package/esm/components/ui/Select.test.js +44 -0
- package/esm/components/ui/Select.test.js.map +1 -0
- package/esm/helpers/configuration.js +2 -0
- package/esm/helpers/configuration.js.map +1 -1
- package/esm/helpers/utils.js +1 -1
- package/esm/helpers/utils.js.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.js +2 -2
- package/esm/index.js.map +1 -1
- package/esm/locales/en.json +17 -0
- package/esm/locales/it.json +17 -0
- package/esm/mocks/data.js +5 -2
- package/esm/mocks/data.js.map +1 -1
- package/package.json +20 -16
- package/src/components/AgeVerificationModal/AgeVerificationModal.css +63 -0
- package/src/components/AgeVerificationModal/AgeVerificationModal.stories.tsx +41 -0
- package/src/components/AgeVerificationModal/AgeVerificationModal.test.tsx +33 -0
- package/src/components/AgeVerificationModal/AgeVerificationModal.tsx +89 -0
- package/src/components/AgeVerificationModal/__snapshots__/AgeVerificationModal.test.tsx.snap +19 -0
- package/src/components/Avatar/Avatar.stories.tsx +20 -1
- package/src/components/Avatar/Avatar.tsx +2 -1
- package/src/components/Avatar/__snapshots__/Avatar.test.tsx.snap +2 -2
- package/src/components/AvatarView/AvatarView.stories.tsx +31 -0
- package/src/components/AvatarView/components/fullbodyAvatar.tsx +8 -6
- package/src/components/AvatarView/components/loader.tsx +15 -12
- package/src/components/AvatarView/index.tsx +4 -1
- package/src/components/AvatarView/utils/useMouthSpeaking.ts +3 -1
- package/src/components/Chat/__snapshots__/Chat.test.tsx.snap +67 -67
- package/src/components/ChatBubble/ChatBubble.css +1 -2
- package/src/components/ChatBubble/__snapshots__/ChatBubble.test.tsx.snap +4 -4
- package/src/components/ChatInputs/ChatInputs.css +14 -3
- package/src/components/ChatInputs/ChatInputs.tsx +2 -0
- package/src/components/ChatInputs/__snapshots__/ChatInputs.test.tsx.snap +5 -5
- package/src/components/DateSelector/DateSelector.css +135 -0
- package/src/components/DateSelector/DateSelector.stories.tsx +34 -0
- package/src/components/DateSelector/DateSelector.test.tsx +38 -0
- package/src/components/DateSelector/DateSelector.tsx +203 -0
- package/src/components/DateSelector/__snapshots__/DateSelector.test.tsx.snap +14938 -0
- package/src/components/Header/Header.stories.tsx +23 -5
- package/src/components/Header/Header.tsx +47 -1
- package/src/components/MediaWidget/LinkItemWidget.tsx +20 -1
- package/src/components/MediaWidget/MediaItemWidget.css +67 -0
- package/src/components/MediaWidget/MediaItemWidget.tsx +72 -71
- package/src/components/MediaWidget/MediaWidget.css +9 -0
- package/src/components/MediaWidget/MediaWidget.stories.tsx +8 -0
- package/src/components/MediaWidget/MediaWidget.tsx +44 -27
- package/src/components/MediaWidget/__snapshots__/MediaItemWidget.test.tsx.snap +1 -1
- package/src/components/MemoriWidget/MemoriWidget.css +1 -1
- package/src/components/MemoriWidget/MemoriWidget.stories.tsx +12 -0
- package/src/components/MemoriWidget/MemoriWidget.tsx +178 -33
- package/src/components/SettingsDrawer/SettingsDrawer.css +5 -0
- package/src/components/SettingsDrawer/SettingsDrawer.stories.tsx +57 -0
- package/src/components/SettingsDrawer/SettingsDrawer.test.tsx +61 -0
- package/src/components/SettingsDrawer/SettingsDrawer.tsx +108 -0
- package/src/components/SettingsDrawer/__snapshots__/SettingsDrawer.test.tsx.snap +19 -0
- package/src/components/StartPanel/StartPanel.css +8 -2
- package/src/components/StartPanel/StartPanel.stories.tsx +66 -2
- package/src/components/StartPanel/StartPanel.test.tsx +21 -0
- package/src/components/StartPanel/StartPanel.tsx +28 -23
- package/src/components/StartPanel/__snapshots__/StartPanel.test.tsx.snap +420 -67
- package/src/components/icons/Refresh.tsx +30 -0
- package/src/components/icons/SelectIcon.tsx +28 -0
- package/src/components/layouts/FullPage.test.tsx +17 -0
- package/src/components/layouts/{Default.tsx → FullPage.tsx} +2 -2
- package/src/components/layouts/Totem.test.tsx +17 -0
- package/src/components/layouts/Totem.tsx +52 -0
- package/src/components/layouts/__snapshots__/FullPage.test.tsx.snap +391 -0
- package/src/components/layouts/__snapshots__/Totem.test.tsx.snap +422 -0
- package/src/components/layouts/layouts.stories.tsx +155 -0
- package/src/components/layouts/totem.css +148 -0
- package/src/components/ui/Button.css +4 -0
- package/src/components/ui/Checkbox.tsx +6 -0
- package/src/components/ui/Drawer.css +24 -2
- package/src/components/ui/Select.css +135 -0
- package/src/components/ui/Select.stories.tsx +79 -0
- package/src/components/ui/Select.test.tsx +84 -0
- package/src/components/ui/Select.tsx +73 -0
- package/src/components/ui/Spin.css +2 -0
- package/src/components/ui/__snapshots__/Select.test.tsx.snap +278 -0
- package/src/helpers/configuration.ts +4 -2
- package/src/helpers/utils.ts +3 -2
- package/src/index.stories.tsx +41 -1
- package/src/index.tsx +7 -2
- package/src/locales/en.json +17 -0
- package/src/locales/it.json +17 -0
- package/src/mocks/data.ts +5 -2
- package/src/styles.css +24 -2
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useTranslation } from 'react-i18next';
|
|
2
|
+
import message from '../ui/Message';
|
|
3
|
+
import Button from '../ui/Button';
|
|
4
|
+
import Modal from '../ui/Modal';
|
|
5
|
+
import moment from 'moment';
|
|
6
|
+
import DateSelector from '../DateSelector/DateSelector';
|
|
7
|
+
import { useCallback, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
export interface Props {
|
|
10
|
+
visible?: boolean;
|
|
11
|
+
onClose: (birthDate?: string) => void;
|
|
12
|
+
minAge: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const AgeVerificationModal = ({ visible = false, onClose, minAge }: Props) => {
|
|
16
|
+
const { t } = useTranslation();
|
|
17
|
+
|
|
18
|
+
const [birthDate, setBirthDate] = useState<moment.Moment>();
|
|
19
|
+
const [error, setError] = useState<string>();
|
|
20
|
+
|
|
21
|
+
const onSubmit = useCallback(() => {
|
|
22
|
+
if (!birthDate) {
|
|
23
|
+
message.error(t('requiredField'));
|
|
24
|
+
setError(t('requiredField') || 'Required field');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
let age = moment().diff(birthDate, 'years');
|
|
29
|
+
if (age < minAge) {
|
|
30
|
+
message.error(t('underageTwinSession', { age: minAge }));
|
|
31
|
+
setError(
|
|
32
|
+
t('underageTwinSession', { age: minAge }) ||
|
|
33
|
+
`You must be at least ${minAge} years old to interact with this Twin`
|
|
34
|
+
);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
onClose(birthDate.toISOString());
|
|
39
|
+
}, [birthDate, minAge, onClose, t]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Modal
|
|
43
|
+
open={visible}
|
|
44
|
+
title={t('ageVerification')}
|
|
45
|
+
className="age-verification-modal"
|
|
46
|
+
closable
|
|
47
|
+
onClose={() => onClose()}
|
|
48
|
+
>
|
|
49
|
+
<p>{t('ageVerificationText', { minAge })}</p>
|
|
50
|
+
|
|
51
|
+
<form
|
|
52
|
+
className="age-verification-form"
|
|
53
|
+
onSubmit={e => {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
onSubmit();
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
<div className="form-item">
|
|
59
|
+
<fieldset name="birthDate">
|
|
60
|
+
<legend className="sr-only">{t('birthDate')}</legend>
|
|
61
|
+
|
|
62
|
+
<DateSelector
|
|
63
|
+
defaultDate={new Date(Date.now())}
|
|
64
|
+
onChange={date => {
|
|
65
|
+
setBirthDate(date);
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
|
|
69
|
+
<p className="form-item-help">{t('birthDateHelper')}</p>
|
|
70
|
+
|
|
71
|
+
{error && <p className="form-item-error">{error}</p>}
|
|
72
|
+
</fieldset>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="form-item form-submit">
|
|
75
|
+
<Button
|
|
76
|
+
primary
|
|
77
|
+
htmlType="submit"
|
|
78
|
+
className="age-verification-submit"
|
|
79
|
+
disabled={!birthDate}
|
|
80
|
+
>
|
|
81
|
+
{t('confirm')}
|
|
82
|
+
</Button>
|
|
83
|
+
</div>
|
|
84
|
+
</form>
|
|
85
|
+
</Modal>
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export default AgeVerificationModal;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`renders AgeVerificationModal unchanged 1`] = `<div />`;
|
|
4
|
+
|
|
5
|
+
exports[`renders AgeVerificationModal visible unchanged 1`] = `
|
|
6
|
+
<div>
|
|
7
|
+
<div
|
|
8
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
9
|
+
/>
|
|
10
|
+
</div>
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
exports[`renders AgeVerificationModal with minAge unchanged 1`] = `
|
|
14
|
+
<div>
|
|
15
|
+
<div
|
|
16
|
+
style="position: fixed; top: 1px; left: 1px; width: 1px; height: 0px; padding: 0px; margin: -1px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); white-space: nowrap; border-width: 0px; display: none;"
|
|
17
|
+
/>
|
|
18
|
+
</div>
|
|
19
|
+
`;
|
|
@@ -33,7 +33,8 @@ const Template: Story<Props> = args => {
|
|
|
33
33
|
<div
|
|
34
34
|
style={
|
|
35
35
|
args.integrationConfig?.avatar === 'customglb' ||
|
|
36
|
-
args.integrationConfig?.avatar === 'readyplayerme'
|
|
36
|
+
args.integrationConfig?.avatar === 'readyplayerme' ||
|
|
37
|
+
args.integrationConfig?.avatar === 'readyplayerme-full'
|
|
37
38
|
? {}
|
|
38
39
|
: { marginTop: '20vw' }
|
|
39
40
|
}
|
|
@@ -116,3 +117,21 @@ ReadyPlayerMeAvatar.args = {
|
|
|
116
117
|
integration,
|
|
117
118
|
integrationConfig,
|
|
118
119
|
};
|
|
120
|
+
|
|
121
|
+
export const FullbodyReadyPlayerMeAvatar = Template.bind({});
|
|
122
|
+
FullbodyReadyPlayerMeAvatar.args = {
|
|
123
|
+
memori,
|
|
124
|
+
tenant,
|
|
125
|
+
instruct: false,
|
|
126
|
+
avatar3dVisible: true,
|
|
127
|
+
setAvatar3dVisible: () => {},
|
|
128
|
+
hasUserActivatedSpeak: false,
|
|
129
|
+
isPlayingAudio: false,
|
|
130
|
+
integration,
|
|
131
|
+
integrationConfig: {
|
|
132
|
+
...integrationConfig,
|
|
133
|
+
avatar: 'readyplayerme-full',
|
|
134
|
+
avatarURL:
|
|
135
|
+
'https://models.readyplayer.me/63b55751f17e295642bf07a2.glb#1669136149862',
|
|
136
|
+
},
|
|
137
|
+
};
|
|
@@ -108,6 +108,7 @@ const Avatar: React.FC<Props> = ({
|
|
|
108
108
|
>
|
|
109
109
|
<AvatarView
|
|
110
110
|
url={integrationConfig.avatarURL}
|
|
111
|
+
sex={memori.voiceType === 'FEMALE' ? 'FEMALE' : 'MALE'}
|
|
111
112
|
fallbackImg={getResourceUrl({
|
|
112
113
|
type: 'avatar',
|
|
113
114
|
tenantID: tenant?.id,
|
|
@@ -115,7 +116,7 @@ const Avatar: React.FC<Props> = ({
|
|
|
115
116
|
baseURL: baseUrl,
|
|
116
117
|
apiURL: apiUrl,
|
|
117
118
|
})}
|
|
118
|
-
headMovement
|
|
119
|
+
headMovement={integrationConfig.avatar === 'readyplayerme'}
|
|
119
120
|
eyeBlink
|
|
120
121
|
halfBody={integrationConfig.avatar === 'readyplayerme'}
|
|
121
122
|
animation={animation}
|
|
@@ -12,7 +12,7 @@ exports[`renders Avatar with blob and avatar in blob unchanged 1`] = `
|
|
|
12
12
|
<img
|
|
13
13
|
alt=""
|
|
14
14
|
role="presentation"
|
|
15
|
-
src="https://
|
|
15
|
+
src="https://app.twincreator.com/images/twincreator/square_logo.png"
|
|
16
16
|
/>
|
|
17
17
|
</figure>
|
|
18
18
|
<div
|
|
@@ -49,7 +49,7 @@ exports[`renders Avatar with custom glb model unchanged 1`] = `
|
|
|
49
49
|
camera-controls="true"
|
|
50
50
|
disable-zoom="true"
|
|
51
51
|
ios-src=""
|
|
52
|
-
poster="https://
|
|
52
|
+
poster="https://app.twincreator.com/images/twincreator/square_logo.png"
|
|
53
53
|
shadow-intensity="1"
|
|
54
54
|
src="https://assets.memori.ai/api/v2/asset/7383f05a-0788-49b0-b9b9-3bfc402c7ddf.glb#1669136149862"
|
|
55
55
|
/>
|
|
@@ -136,6 +136,7 @@ Speaking.args = {
|
|
|
136
136
|
|
|
137
137
|
export const Fullbody = Template.bind({});
|
|
138
138
|
Fullbody.args = {
|
|
139
|
+
sex: 'MALE',
|
|
139
140
|
eyeBlink: true,
|
|
140
141
|
headMovement: true,
|
|
141
142
|
rotateAvatar: true,
|
|
@@ -148,6 +149,7 @@ Fullbody.args = {
|
|
|
148
149
|
|
|
149
150
|
export const FullbodyAnimatedIdle = Template.bind({});
|
|
150
151
|
FullbodyAnimatedIdle.args = {
|
|
152
|
+
sex: 'MALE',
|
|
151
153
|
eyeBlink: true,
|
|
152
154
|
headMovement: true,
|
|
153
155
|
rotateAvatar: true,
|
|
@@ -161,6 +163,7 @@ FullbodyAnimatedIdle.args = {
|
|
|
161
163
|
|
|
162
164
|
export const FullbodyAnimatedLoading = Template.bind({});
|
|
163
165
|
FullbodyAnimatedLoading.args = {
|
|
166
|
+
sex: 'MALE',
|
|
164
167
|
eyeBlink: true,
|
|
165
168
|
headMovement: true,
|
|
166
169
|
rotateAvatar: true,
|
|
@@ -174,6 +177,7 @@ FullbodyAnimatedLoading.args = {
|
|
|
174
177
|
|
|
175
178
|
export const FullbodyAnimatedSpeaking = Template.bind({});
|
|
176
179
|
FullbodyAnimatedSpeaking.args = {
|
|
180
|
+
sex: 'MALE',
|
|
177
181
|
eyeBlink: true,
|
|
178
182
|
headMovement: true,
|
|
179
183
|
rotateAvatar: true,
|
|
@@ -184,3 +188,30 @@ FullbodyAnimatedSpeaking.args = {
|
|
|
184
188
|
animation: 'Talk 1',
|
|
185
189
|
halfBody: false,
|
|
186
190
|
};
|
|
191
|
+
|
|
192
|
+
export const FullbodyFemale = Template.bind({});
|
|
193
|
+
FullbodyFemale.args = {
|
|
194
|
+
sex: 'FEMALE',
|
|
195
|
+
eyeBlink: true,
|
|
196
|
+
headMovement: true,
|
|
197
|
+
rotateAvatar: true,
|
|
198
|
+
speaking: false,
|
|
199
|
+
url: 'https://assets.memori.ai/api/v2/asset/6af08bf1-f011-40ea-92a2-699b7b53a53c.glb',
|
|
200
|
+
fallbackImg:
|
|
201
|
+
'https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png',
|
|
202
|
+
halfBody: false,
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const FullbodyAnimatedFemale = Template.bind({});
|
|
206
|
+
FullbodyAnimatedFemale.args = {
|
|
207
|
+
sex: 'FEMALE',
|
|
208
|
+
eyeBlink: true,
|
|
209
|
+
headMovement: true,
|
|
210
|
+
rotateAvatar: true,
|
|
211
|
+
speaking: true,
|
|
212
|
+
url: 'https://assets.memori.ai/api/v2/asset/6af08bf1-f011-40ea-92a2-699b7b53a53c.glb',
|
|
213
|
+
fallbackImg:
|
|
214
|
+
'https://assets.memori.ai/api/v2/asset/3049582f-db5f-452c-913d-e4340d4afd0a.png',
|
|
215
|
+
animation: 'Idle',
|
|
216
|
+
halfBody: false,
|
|
217
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { memo, useEffect, useMemo } from 'react';
|
|
2
|
-
import { AnimationMixer, Object3D, Vector3 } from 'three';
|
|
2
|
+
import { AnimationMixer, Object3D, Vector3, Euler } from 'three';
|
|
3
3
|
import { useAnimations, useGLTF } from '@react-three/drei';
|
|
4
4
|
import useEyeBlink from '../utils/useEyeBlink';
|
|
5
5
|
import useHeadMovement from '../utils/useHeadMovement';
|
|
@@ -9,6 +9,7 @@ import { correctMaterials, hideHands, isSkinnedMesh } from '../utils/utils';
|
|
|
9
9
|
|
|
10
10
|
export interface AvatarProps {
|
|
11
11
|
url: string;
|
|
12
|
+
sex: 'MALE' | 'FEMALE';
|
|
12
13
|
eyeBlink?: boolean;
|
|
13
14
|
headMovement?: boolean;
|
|
14
15
|
speaking?: boolean;
|
|
@@ -26,9 +27,11 @@ export interface AvatarProps {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const position = new Vector3(0, -1, 0);
|
|
30
|
+
const rotation = new Euler(0.175, 0, 0);
|
|
29
31
|
|
|
30
32
|
export default function Avatar({
|
|
31
33
|
url,
|
|
34
|
+
sex,
|
|
32
35
|
eyeBlink,
|
|
33
36
|
headMovement,
|
|
34
37
|
speaking,
|
|
@@ -37,7 +40,9 @@ export default function Avatar({
|
|
|
37
40
|
}: AvatarProps) {
|
|
38
41
|
const { scene } = useGLTF(url);
|
|
39
42
|
const { animations } = useGLTF(
|
|
40
|
-
'
|
|
43
|
+
sex === 'MALE'
|
|
44
|
+
? 'https://assets.memori.ai/api/v2/asset/b11eef07-c45b-4959-9d43-be8105365c1f.glb'
|
|
45
|
+
: 'https://assets.memori.ai/api/v2/asset/24dc2bd7-d6b5-4492-ab29-791928b0a669.glb'
|
|
41
46
|
);
|
|
42
47
|
const { nodes, materials } = useGraph(scene);
|
|
43
48
|
|
|
@@ -59,8 +64,6 @@ export default function Avatar({
|
|
|
59
64
|
};
|
|
60
65
|
}, [materials, nodes, url, onLoaded]);
|
|
61
66
|
|
|
62
|
-
// useEffect(() => {
|
|
63
|
-
// console.log('animation', animation, animation && animation in anim.actions);
|
|
64
67
|
try {
|
|
65
68
|
if (animation && animation in anim.actions) {
|
|
66
69
|
Object.keys(anim.actions).forEach(name => {
|
|
@@ -78,10 +81,9 @@ export default function Avatar({
|
|
|
78
81
|
} catch (e) {
|
|
79
82
|
console.log(e);
|
|
80
83
|
}
|
|
81
|
-
// }, [animation]);
|
|
82
84
|
|
|
83
85
|
return (
|
|
84
|
-
<group position={position}>
|
|
86
|
+
<group position={position} rotation={rotation}>
|
|
85
87
|
<primitive object={scene} />
|
|
86
88
|
</group>
|
|
87
89
|
);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Html, useProgress } from '@react-three/drei';
|
|
3
|
+
import Spin from '../../ui/Spin';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
6
|
fallbackImg?: string;
|
|
@@ -9,18 +10,20 @@ const Loader = ({ fallbackImg }: Props) => {
|
|
|
9
10
|
const { progress } = useProgress();
|
|
10
11
|
return (
|
|
11
12
|
<Html center className="avatar-loader">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
<Spin spinning>
|
|
14
|
+
{fallbackImg ? (
|
|
15
|
+
<figure>
|
|
16
|
+
<img
|
|
17
|
+
src={fallbackImg}
|
|
18
|
+
alt={`${Math.round(progress)}% loaded`}
|
|
19
|
+
title={`${Math.round(progress)}% loaded`}
|
|
20
|
+
/>
|
|
21
|
+
<figcaption>{`${Math.round(progress)}%`}</figcaption>
|
|
22
|
+
</figure>
|
|
23
|
+
) : (
|
|
24
|
+
<>{Math.round(progress)} % loaded</>
|
|
25
|
+
)}
|
|
26
|
+
</Spin>
|
|
24
27
|
</Html>
|
|
25
28
|
);
|
|
26
29
|
};
|
|
@@ -9,6 +9,7 @@ import { isAndroid } from '../../helpers/utils';
|
|
|
9
9
|
|
|
10
10
|
export interface Props {
|
|
11
11
|
url: string;
|
|
12
|
+
sex: 'MALE' | 'FEMALE';
|
|
12
13
|
fallbackImg?: string;
|
|
13
14
|
eyeBlink?: boolean;
|
|
14
15
|
headMovement?: boolean;
|
|
@@ -35,6 +36,7 @@ const defaultStylesFullBody = {
|
|
|
35
36
|
|
|
36
37
|
export default function AvatarView({
|
|
37
38
|
url,
|
|
39
|
+
sex,
|
|
38
40
|
fallbackImg,
|
|
39
41
|
style,
|
|
40
42
|
rotateAvatar,
|
|
@@ -57,7 +59,7 @@ export default function AvatarView({
|
|
|
57
59
|
fov: 40,
|
|
58
60
|
position: [0, 0, 0.6],
|
|
59
61
|
}
|
|
60
|
-
: { fov: 40, position: [0, 0, 3] }
|
|
62
|
+
: { fov: 40, position: [0, 0.0000175, 3] }
|
|
61
63
|
}
|
|
62
64
|
>
|
|
63
65
|
<Suspense fallback={fallback || <Loader fallbackImg={fallbackImg} />}>
|
|
@@ -85,6 +87,7 @@ export default function AvatarView({
|
|
|
85
87
|
) : (
|
|
86
88
|
<FullbodyAvatar
|
|
87
89
|
url={url}
|
|
90
|
+
sex={sex}
|
|
88
91
|
eyeBlink={eyeBlink}
|
|
89
92
|
headMovement={headMovement}
|
|
90
93
|
speaking={speaking}
|
|
@@ -26,7 +26,9 @@ export default function useMouthSpeaking(
|
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
if (!speaking) return;
|
|
28
28
|
|
|
29
|
-
mouthMesh = (nodes.Wolf3D_Head ||
|
|
29
|
+
mouthMesh = (nodes.Wolf3D_Head ||
|
|
30
|
+
nodes.Wolf3D_Avatar ||
|
|
31
|
+
nodes.Wolf3D_Avatar001) as SkinnedMesh;
|
|
30
32
|
|
|
31
33
|
if (mouthMesh?.morphTargetDictionary && mouthMesh?.morphTargetInfluences) {
|
|
32
34
|
mouthOpenMorphIndex = mouthMesh.morphTargetDictionary.mouthOpen;
|