@memori.ai/memori-react 7.4.0 → 7.4.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 +14 -0
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.d.ts +1 -2
- package/dist/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/StartPanel/StartPanel.js +2 -2
- package/dist/components/StartPanel/StartPanel.js.map +1 -1
- package/dist/helpers/error.js +16 -0
- package/dist/helpers/error.js.map +1 -1
- package/dist/helpers/statistics.d.ts +1 -12
- package/dist/helpers/statistics.js +1 -165
- package/dist/helpers/statistics.js.map +1 -1
- package/dist/locales/en.json +32 -16
- package/dist/locales/it.json +18 -2
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.d.ts +1 -2
- package/esm/components/CompletionProviderStatus/CompletionProviderStatus.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/StartPanel/StartPanel.js +2 -2
- package/esm/components/StartPanel/StartPanel.js.map +1 -1
- package/esm/helpers/error.js +16 -0
- package/esm/helpers/error.js.map +1 -1
- package/esm/helpers/statistics.d.ts +1 -12
- package/esm/helpers/statistics.js +0 -156
- package/esm/helpers/statistics.js.map +1 -1
- package/esm/locales/en.json +32 -16
- package/esm/locales/it.json +18 -2
- package/package.json +2 -2
- package/src/components/CompletionProviderStatus/CompletionProviderStatus.tsx +1 -2
- package/src/components/MemoriWidget/MemoriWidget.tsx +0 -1
- package/src/components/StartPanel/StartPanel.test.tsx +6 -1
- package/src/components/StartPanel/StartPanel.tsx +1 -1
- package/src/helpers/error.ts +17 -0
- package/src/helpers/statistics.ts +1 -195
- package/src/locales/en.json +33 -16
- package/src/locales/it.json +19 -2
- package/src/helpers/statistics.test.ts +0 -213
package/src/locales/it.json
CHANGED
|
@@ -295,6 +295,7 @@
|
|
|
295
295
|
"MEMORI_NO_PASSWORD_WHEN_PUBLIC": "Memori: password non richiesta su Memori pubblico",
|
|
296
296
|
"MEMORI_DEEP_THOUGHT_REQUIRES_COMPLETIONS": "Pensiero Profondo richiede l'abilitazione delle completions",
|
|
297
297
|
"MEMORI_BOARD_OF_EXPERTS_REQUIRES_COMPLETIONS": "Il gruppo di esperti richiede l'abilitazione delle completions",
|
|
298
|
+
"MEMORI_INVALID_COMPLETION_CONFIG": "Memori: configurazione completions non valida",
|
|
298
299
|
|
|
299
300
|
"MEMORI_TRANSFER_MISSING_DESTINATION_USER": "Trasferimento: utente di destinazione mancante",
|
|
300
301
|
"MEMORI_TRANSFER_INVALID_DESTINATION_USER_ID": "Trasferimento: ID utente di destinazione non valido",
|
|
@@ -425,7 +426,23 @@
|
|
|
425
426
|
|
|
426
427
|
"BADGE_NOT_FOUND": "Badge non trovato",
|
|
427
428
|
|
|
428
|
-
"OUTCOME_NO_DCM_CONFIGURED": "
|
|
429
|
-
"OUTCOME_USER_BADGES_DISABLED": "
|
|
429
|
+
"OUTCOME_NO_DCM_CONFIGURED": "Outcome: nessun DCM configurato",
|
|
430
|
+
"OUTCOME_USER_BADGES_DISABLED": "Outcome: badge utente disabilitati",
|
|
431
|
+
|
|
432
|
+
"COMPLETION_CONFIG_MISSING_NAME": "Configurazione completions: nome mancante",
|
|
433
|
+
"COMPLETION_CONFIG_MISSING_PROVIDER": "Configurazione completions: provider mancante",
|
|
434
|
+
"COMPLETION_CONFIG_MISSING_ENDPOINT": "Configurazione completions: endpoint mancante",
|
|
435
|
+
"COMPLETION_CONFIG_MISSING_API_KEY": "Configurazione completions: API key mancante",
|
|
436
|
+
"COMPLETION_CONFIG_MISSING_MODEL": "Configurazione completions: modello mancante",
|
|
437
|
+
"COMPLETION_CONFIG_NO_PURPOSE_SPECIFIED": "Configurazione completions: almeno un tipo di completions deve essere specificato",
|
|
438
|
+
"COMPLETION_CONFIG_INVALID_PURPOSE": "Configurazione completions: tipo di completions non valido",
|
|
439
|
+
"COMPLETION_CONFIG_INVALID_ENDPOINT": "Configurazione completions: endpoint non valido",
|
|
440
|
+
"COMPLETION_CONFIG_INCONSISTENT_ENDPOINT": "Configurazione completions: endpoint incoerente",
|
|
441
|
+
"COMPLETION_CONFIG_INVALID_PROVIDER": "Configurazione completions: provider non valido",
|
|
442
|
+
"COMPLETION_CONFIG_NOT_FOUND": "Configurazione completions: non trovata",
|
|
443
|
+
"COMPLETION_CONFIG_NOT_ACCESSIBLE": "Configurazione completions: non accessibile",
|
|
444
|
+
"COMPLETION_CONFIG_NAME_RESERVED": "Configurazione completions: nome riservato",
|
|
445
|
+
"COMPLETION_CONFIG_NAME_ALREADY_EXISTS": "Configurazione completions: nome già esistente",
|
|
446
|
+
"COMPLETION_CONFIG_VISIBILITY_CHANGE_NOT_ALLOWED": "Configurazione completions: cambiamento visibilità non consentito"
|
|
430
447
|
}
|
|
431
448
|
}
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { EventLog, Stats } from '@memori.ai/memori-api-client/dist/types';
|
|
2
|
-
import {
|
|
3
|
-
getBadge,
|
|
4
|
-
getNextBadge,
|
|
5
|
-
getPointsForBadge,
|
|
6
|
-
getPointsFromStats,
|
|
7
|
-
getGamificationLevel,
|
|
8
|
-
eventLogGroupUsersByDate,
|
|
9
|
-
getGamificationLevelByStats,
|
|
10
|
-
} from './statistics';
|
|
11
|
-
|
|
12
|
-
export const stats: Stats = {
|
|
13
|
-
totalReceivers: 2,
|
|
14
|
-
receiversWithMemories: 1,
|
|
15
|
-
totalMemories: 50,
|
|
16
|
-
publicMemories: 30,
|
|
17
|
-
memoriesWithMedia: 25,
|
|
18
|
-
totalQuestions: 35,
|
|
19
|
-
publicQuestions: 30,
|
|
20
|
-
questionsWithMoreThanOneAnswer: 20,
|
|
21
|
-
totalStories: 15,
|
|
22
|
-
publicStories: 10,
|
|
23
|
-
storiesWithDate: 5,
|
|
24
|
-
storiesWithPlace: 3,
|
|
25
|
-
storiesWithDateAndPlace: 2,
|
|
26
|
-
unansweredQuestions: 10,
|
|
27
|
-
successfulCorrelations: 5,
|
|
28
|
-
failedCorrelations: 1,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const eventLogs: EventLog[] = [
|
|
32
|
-
{
|
|
33
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e82',
|
|
34
|
-
eventType: 'MemoriOpened',
|
|
35
|
-
ipAddress: '::ffff:10.11.12.14',
|
|
36
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
37
|
-
timestamp: '2022-04-15T15:00:27.534191',
|
|
38
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e83',
|
|
42
|
-
eventType: 'MemoriOpened',
|
|
43
|
-
ipAddress: '::ffff:10.11.12.13',
|
|
44
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
45
|
-
timestamp: '2022-04-15T15:00:27.534191',
|
|
46
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e84',
|
|
50
|
-
eventType: 'MemoriClosed',
|
|
51
|
-
ipAddress: '::ffff:10.11.12.13',
|
|
52
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
53
|
-
timestamp: '2022-04-15T15:10:27.534191',
|
|
54
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e85',
|
|
58
|
-
eventType: 'MemoriOpened',
|
|
59
|
-
ipAddress: '::ffff:10.11.12.13',
|
|
60
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
61
|
-
timestamp: '2022-04-15T15:15:27.534191',
|
|
62
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e86',
|
|
66
|
-
eventType: 'MemoriClosed',
|
|
67
|
-
ipAddress: '::ffff:10.11.12.13',
|
|
68
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
69
|
-
timestamp: '2022-04-15T15:20:27.534191',
|
|
70
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
eventLogID: '28c9f4c8-d7d5-44c4-9f79-418944b03e88',
|
|
74
|
-
eventType: 'MemoriClosed',
|
|
75
|
-
ipAddress: undefined,
|
|
76
|
-
memoriID: '1afe57c6-1b69-4a61-96ea-52bf7b8d158e',
|
|
77
|
-
timestamp: '2022-04-15T15:28:27.534191',
|
|
78
|
-
userAgent: 'RestSharp/106.13.0.0',
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
|
|
82
|
-
describe('getBadge', () => {
|
|
83
|
-
it('should return 🆕 badge for 0 points', () => {
|
|
84
|
-
expect(getBadge(0)).toBe('🆕');
|
|
85
|
-
});
|
|
86
|
-
it('should return 🐹 for 10 points', () => {
|
|
87
|
-
expect(getBadge(10)).toBe('🐹');
|
|
88
|
-
});
|
|
89
|
-
it('should return 🥇 for 99 points', () => {
|
|
90
|
-
expect(getBadge(99)).toBe('🥇');
|
|
91
|
-
});
|
|
92
|
-
it('should return 🥇 for 99.9 points with round', () => {
|
|
93
|
-
expect(getBadge(99.9)).toBe('🥇');
|
|
94
|
-
});
|
|
95
|
-
it('should return 🔥 for 100 points', () => {
|
|
96
|
-
expect(getBadge(100)).toBe('🔥');
|
|
97
|
-
});
|
|
98
|
-
it('should return 🔥 for 101 points', () => {
|
|
99
|
-
expect(getBadge(101)).toBe('🔥');
|
|
100
|
-
});
|
|
101
|
-
it('should return 🌎 for 150 points', () => {
|
|
102
|
-
expect(getBadge(150)).toBe('🌍');
|
|
103
|
-
});
|
|
104
|
-
it('should return 🧠 for 1000 points', () => {
|
|
105
|
-
expect(getBadge(1000)).toBe('🧠');
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe('getNextBadge', () => {
|
|
110
|
-
it('should return { points: 10, badge: "🐹" } for 🆕 badge', () => {
|
|
111
|
-
expect(getNextBadge('🆕')).toEqual({ points: 10, badge: '🐹' });
|
|
112
|
-
});
|
|
113
|
-
it('should return { points: 150, badge: "🌍" } for 👾', () => {
|
|
114
|
-
expect(getNextBadge('👾')).toEqual({ points: 150, badge: '🌍' });
|
|
115
|
-
});
|
|
116
|
-
it('should return { points: 600, badge: "🧠" } for ❤', () => {
|
|
117
|
-
expect(getNextBadge('❤️')).toEqual({ points: 600, badge: '🧠' });
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe('getPointsForBadge', () => {
|
|
122
|
-
it('should return 0 for "new" badge', () => {
|
|
123
|
-
expect(getPointsForBadge('🆕')).toBe(0);
|
|
124
|
-
});
|
|
125
|
-
it('should return 10 for 🐹', () => {
|
|
126
|
-
expect(getPointsForBadge('🐹')).toBe(10);
|
|
127
|
-
});
|
|
128
|
-
it('should return 150 for 🌎', () => {
|
|
129
|
-
expect(getPointsForBadge('🌍')).toBe(150);
|
|
130
|
-
});
|
|
131
|
-
it('should return 600 for 🧠', () => {
|
|
132
|
-
expect(getPointsForBadge('🧠')).toBe(600);
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe('getPointsFromStats', () => {
|
|
137
|
-
it('should return 0 for no stats', () => {
|
|
138
|
-
expect(getPointsFromStats({} as Stats)).toBe(0);
|
|
139
|
-
});
|
|
140
|
-
it('should return x for stats', () => {
|
|
141
|
-
expect(getPointsFromStats(stats)).toBe(68);
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
describe('getGamificationLevel', () => {
|
|
146
|
-
it('should return correct level for 0 points', () => {
|
|
147
|
-
expect(getGamificationLevel(0)).toEqual({
|
|
148
|
-
points: 0,
|
|
149
|
-
badge: '🆕',
|
|
150
|
-
pointsForCurrentBadge: 0,
|
|
151
|
-
nextBadge: { points: 10, badge: '🐹' },
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
it('should return correct level with 68 points', () => {
|
|
155
|
-
expect(getGamificationLevel(68.34)).toEqual({
|
|
156
|
-
points: 68,
|
|
157
|
-
badge: '🏅',
|
|
158
|
-
pointsForCurrentBadge: 60,
|
|
159
|
-
nextBadge: { points: 70, badge: '🥉' },
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
it('should return correct level with 100 points', () => {
|
|
163
|
-
expect(getGamificationLevel(100)).toEqual({
|
|
164
|
-
points: 100,
|
|
165
|
-
badge: '🔥',
|
|
166
|
-
pointsForCurrentBadge: 100,
|
|
167
|
-
nextBadge: { points: 110, badge: '🎓' },
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
it('should return correct level with 68 points and correct float round', () => {
|
|
171
|
-
expect(getGamificationLevel(67.84)).toEqual({
|
|
172
|
-
points: 68,
|
|
173
|
-
badge: '🏅',
|
|
174
|
-
pointsForCurrentBadge: 60,
|
|
175
|
-
nextBadge: { points: 70, badge: '🥉' },
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
it('should return correct level with 99.9 points', () => {
|
|
179
|
-
expect(getGamificationLevel(99.9)).toEqual({
|
|
180
|
-
points: 100,
|
|
181
|
-
badge: '🔥',
|
|
182
|
-
pointsForCurrentBadge: 100,
|
|
183
|
-
nextBadge: { points: 110, badge: '🎓' },
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
it('should return correct level with overflow 9999 points', () => {
|
|
187
|
-
expect(getGamificationLevel(9999)).toEqual({
|
|
188
|
-
points: 9999,
|
|
189
|
-
badge: '🧠',
|
|
190
|
-
pointsForCurrentBadge: 600,
|
|
191
|
-
nextBadge: undefined,
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
describe('getGamificationLevelByStats', () => {
|
|
197
|
-
it('should return correct level for no stats', () => {
|
|
198
|
-
expect(getGamificationLevelByStats({} as Stats)).toEqual({
|
|
199
|
-
points: 0,
|
|
200
|
-
badge: '🆕',
|
|
201
|
-
pointsForCurrentBadge: 0,
|
|
202
|
-
nextBadge: { points: 10, badge: '🐹' },
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
it('should return correct level for stats', () => {
|
|
206
|
-
expect(getGamificationLevelByStats(stats)).toEqual({
|
|
207
|
-
points: 68,
|
|
208
|
-
badge: '🏅',
|
|
209
|
-
pointsForCurrentBadge: 60,
|
|
210
|
-
nextBadge: { points: 70, badge: '🥉' },
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
});
|