@rimori/client 1.4.10 → 2.1.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.
Files changed (136) hide show
  1. package/README.md +140 -1171
  2. package/dist/{core/controller → controller}/AIController.d.ts +1 -1
  3. package/dist/{core/controller → controller}/AIController.js +2 -2
  4. package/dist/{plugin/AccomplishmentHandler.d.ts → controller/AccomplishmentController.d.ts} +1 -1
  5. package/dist/{plugin/AccomplishmentHandler.js → controller/AccomplishmentController.js} +1 -1
  6. package/dist/{core/controller → controller}/ExerciseController.d.ts +8 -6
  7. package/dist/{core/controller → controller}/ExerciseController.js +10 -9
  8. package/dist/{core/controller → controller}/ObjectController.d.ts +1 -1
  9. package/dist/{core/controller → controller}/ObjectController.js +1 -1
  10. package/dist/{core/controller → controller}/SettingsController.d.ts +2 -2
  11. package/dist/{core/controller → controller}/SharedContentController.d.ts +1 -1
  12. package/dist/{core/controller → controller}/VoiceController.d.ts +1 -1
  13. package/dist/index.d.ts +14 -8
  14. package/dist/index.js +7 -7
  15. package/dist/plugin/{PluginController.d.ts → CommunicationHandler.d.ts} +4 -7
  16. package/dist/plugin/{PluginController.js → CommunicationHandler.js} +19 -27
  17. package/dist/plugin/RimoriClient.d.ts +67 -68
  18. package/dist/plugin/RimoriClient.js +101 -43
  19. package/dist/worker/WorkerSetup.js +3 -3
  20. package/example/docs/devdocs.md +1 -1
  21. package/package.json +5 -26
  22. package/src/{core/controller → controller}/AIController.ts +3 -3
  23. package/src/{plugin/AccomplishmentHandler.ts → controller/AccomplishmentController.ts} +1 -1
  24. package/src/{core/controller → controller}/ExerciseController.ts +14 -11
  25. package/src/{core/controller → controller}/ObjectController.ts +2 -2
  26. package/src/{core/controller → controller}/SettingsController.ts +2 -2
  27. package/src/{core/controller → controller}/SharedContentController.ts +1 -1
  28. package/src/{core/controller → controller}/VoiceController.ts +2 -2
  29. package/src/fromRimori/readme.md +1 -1
  30. package/src/index.ts +14 -8
  31. package/src/plugin/{PluginController.ts → CommunicationHandler.ts} +24 -36
  32. package/src/plugin/RimoriClient.ts +127 -118
  33. package/src/worker/WorkerSetup.ts +6 -4
  34. package/tsconfig.json +5 -2
  35. package/dist/cli/scripts/release/release-translation-upload.d.ts +0 -6
  36. package/dist/cli/scripts/release/release-translation-upload.js +0 -87
  37. package/dist/components/CRUDModal.d.ts +0 -17
  38. package/dist/components/CRUDModal.js +0 -24
  39. package/dist/components/MarkdownEditor.d.ts +0 -8
  40. package/dist/components/MarkdownEditor.js +0 -48
  41. package/dist/components/Spinner.d.ts +0 -8
  42. package/dist/components/Spinner.js +0 -4
  43. package/dist/components/ai/Assistant.d.ts +0 -9
  44. package/dist/components/ai/Assistant.js +0 -58
  45. package/dist/components/ai/Avatar.d.ts +0 -14
  46. package/dist/components/ai/Avatar.js +0 -59
  47. package/dist/components/ai/EmbeddedAssistent/AudioInputField.d.ts +0 -7
  48. package/dist/components/ai/EmbeddedAssistent/AudioInputField.js +0 -37
  49. package/dist/components/ai/EmbeddedAssistent/CircleAudioAvatar.d.ts +0 -8
  50. package/dist/components/ai/EmbeddedAssistent/CircleAudioAvatar.js +0 -79
  51. package/dist/components/ai/EmbeddedAssistent/TTS/MessageSender.d.ts +0 -19
  52. package/dist/components/ai/EmbeddedAssistent/TTS/MessageSender.js +0 -91
  53. package/dist/components/ai/EmbeddedAssistent/TTS/Player.d.ts +0 -27
  54. package/dist/components/ai/EmbeddedAssistent/TTS/Player.js +0 -185
  55. package/dist/components/ai/EmbeddedAssistent/VoiceRecoder.d.ts +0 -11
  56. package/dist/components/ai/EmbeddedAssistent/VoiceRecoder.js +0 -95
  57. package/dist/components/ai/utils.d.ts +0 -6
  58. package/dist/components/ai/utils.js +0 -13
  59. package/dist/components/audio/Playbutton.d.ts +0 -15
  60. package/dist/components/audio/Playbutton.js +0 -80
  61. package/dist/components/components/ContextMenu.d.ts +0 -10
  62. package/dist/components/components/ContextMenu.js +0 -135
  63. package/dist/components.d.ts +0 -10
  64. package/dist/components.js +0 -11
  65. package/dist/core/controller/EnhancedUserInfo.d.ts +0 -0
  66. package/dist/core/controller/EnhancedUserInfo.js +0 -1
  67. package/dist/core/core.d.ts +0 -14
  68. package/dist/core/core.js +0 -7
  69. package/dist/hooks/I18nHooks.d.ts +0 -11
  70. package/dist/hooks/I18nHooks.js +0 -25
  71. package/dist/hooks/UseChatHook.d.ts +0 -10
  72. package/dist/hooks/UseChatHook.js +0 -29
  73. package/dist/i18n/I18nHooks.d.ts +0 -11
  74. package/dist/i18n/I18nHooks.js +0 -25
  75. package/dist/i18n/Translator.d.ts +0 -43
  76. package/dist/i18n/Translator.js +0 -118
  77. package/dist/i18n/config.d.ts +0 -7
  78. package/dist/i18n/config.js +0 -20
  79. package/dist/i18n/createI18nInstance.d.ts +0 -7
  80. package/dist/i18n/createI18nInstance.js +0 -31
  81. package/dist/i18n/hooks.d.ts +0 -11
  82. package/dist/i18n/hooks.js +0 -25
  83. package/dist/i18n/index.d.ts +0 -4
  84. package/dist/i18n/index.js +0 -4
  85. package/dist/i18n/types.d.ts +0 -7
  86. package/dist/i18n/types.js +0 -1
  87. package/dist/i18n/useRimoriI18n.d.ts +0 -11
  88. package/dist/i18n/useRimoriI18n.js +0 -41
  89. package/dist/plugin/ThemeSetter.d.ts +0 -2
  90. package/dist/plugin/ThemeSetter.js +0 -19
  91. package/dist/plugin/Translator.d.ts +0 -38
  92. package/dist/plugin/Translator.js +0 -101
  93. package/dist/providers/PluginProvider.d.ts +0 -12
  94. package/dist/providers/PluginProvider.js +0 -152
  95. package/dist/style.css +0 -110
  96. package/dist/style.css.map +0 -1
  97. package/dist/utils/Language.d.ts +0 -67
  98. package/dist/utils/Language.js +0 -69
  99. package/dist/utils/LanguageClass.d.ts +0 -36
  100. package/dist/utils/LanguageClass.example.d.ts +0 -0
  101. package/dist/utils/LanguageClass.example.js +0 -1
  102. package/dist/utils/LanguageClass.js +0 -50
  103. package/dist/utils/LanguageClass.test.d.ts +0 -0
  104. package/dist/utils/LanguageClass.test.js +0 -1
  105. package/dist/utils/PluginUtils.d.ts +0 -2
  106. package/dist/utils/PluginUtils.js +0 -23
  107. package/src/components/CRUDModal.tsx +0 -75
  108. package/src/components/MarkdownEditor.tsx +0 -144
  109. package/src/components/Spinner.tsx +0 -29
  110. package/src/components/ai/Assistant.tsx +0 -96
  111. package/src/components/ai/Avatar.tsx +0 -99
  112. package/src/components/ai/EmbeddedAssistent/AudioInputField.tsx +0 -73
  113. package/src/components/ai/EmbeddedAssistent/CircleAudioAvatar.tsx +0 -107
  114. package/src/components/ai/EmbeddedAssistent/TTS/MessageSender.ts +0 -96
  115. package/src/components/ai/EmbeddedAssistent/TTS/Player.ts +0 -197
  116. package/src/components/ai/EmbeddedAssistent/VoiceRecoder.tsx +0 -129
  117. package/src/components/ai/utils.ts +0 -21
  118. package/src/components/audio/Playbutton.tsx +0 -126
  119. package/src/components/components/ContextMenu.tsx +0 -179
  120. package/src/components.ts +0 -11
  121. package/src/core/core.ts +0 -15
  122. package/src/hooks/I18nHooks.ts +0 -33
  123. package/src/hooks/UseChatHook.ts +0 -38
  124. package/src/plugin/ThemeSetter.ts +0 -23
  125. package/src/providers/PluginProvider.tsx +0 -209
  126. package/src/style.scss +0 -136
  127. package/src/utils/PluginUtils.ts +0 -22
  128. /package/dist/{plugin → controller}/AudioController.d.ts +0 -0
  129. /package/dist/{plugin → controller}/AudioController.js +0 -0
  130. /package/dist/{core/controller → controller}/SettingsController.js +0 -0
  131. /package/dist/{core/controller → controller}/SharedContentController.js +0 -0
  132. /package/dist/{plugin → controller}/TranslationController.d.ts +0 -0
  133. /package/dist/{plugin → controller}/TranslationController.js +0 -0
  134. /package/dist/{core/controller → controller}/VoiceController.js +0 -0
  135. /package/src/{plugin → controller}/AudioController.ts +0 -0
  136. /package/src/{plugin → controller}/TranslationController.ts +0 -0
@@ -1,209 +0,0 @@
1
- import React, { createContext, useContext, ReactNode, useEffect, useState } from 'react';
2
- import { PluginController } from '../plugin/PluginController';
3
- import { RimoriClient } from '../plugin/RimoriClient';
4
- import { EventBusHandler } from '../fromRimori/EventBus';
5
- import ContextMenu from '../components/components/ContextMenu';
6
- import { StandaloneClient } from '../plugin/StandaloneClient';
7
-
8
- interface PluginProviderProps {
9
- children: ReactNode;
10
- pluginId: string;
11
- settings?: {
12
- disableContextMenu?: boolean;
13
- };
14
- }
15
-
16
- const PluginContext = createContext<RimoriClient | null>(null);
17
-
18
- export const PluginProvider: React.FC<PluginProviderProps> = ({ children, pluginId, settings }) => {
19
- const [plugin, setPlugin] = useState<RimoriClient | null>(null);
20
- const [standaloneClient, setStandaloneClient] = useState<StandaloneClient | boolean>(false);
21
- const [applicationMode, setApplicationMode] = useState<string | null>(null);
22
- const [theme, setTheme] = useState<string | null>(null);
23
-
24
- const isSidebar = applicationMode === 'sidebar';
25
- const isSettings = applicationMode === 'settings';
26
-
27
- useEffect(() => {
28
- initEventBus(pluginId);
29
-
30
- // Check if we're in an iframe context - if not, we're standalone
31
- const standaloneDetected = window === window.parent;
32
-
33
- if (standaloneDetected && !standaloneClient) {
34
- StandaloneClient.getInstance().then((client) => {
35
- client.needsLogin().then((needLogin) => setStandaloneClient(needLogin ? client : true));
36
- });
37
- }
38
-
39
- if ((!standaloneDetected && !plugin) || (standaloneDetected && standaloneClient === true)) {
40
- PluginController.getInstance(pluginId, standaloneDetected).then((client) => {
41
- setPlugin(client);
42
- // Get applicationMode and theme from MessageChannel query params
43
- if (!standaloneDetected) {
44
- const mode = client.getQueryParam('applicationMode');
45
- const themeParam = client.getQueryParam('rm_theme');
46
- setApplicationMode(mode);
47
- setTheme(themeParam);
48
- }
49
- });
50
- }
51
- }, [pluginId, standaloneClient]);
52
-
53
- //route change
54
- useEffect(() => {
55
- if (!plugin) return;
56
-
57
- //sidebar pages should not report url changes
58
- if (isSidebar) return;
59
-
60
- let lastHash = window.location.hash;
61
- const emitUrlChange = (url: string) => plugin.event.emit('session.triggerUrlChange', { url });
62
-
63
- const interval = setInterval(() => {
64
- if (lastHash === window.location.hash) return;
65
- lastHash = window.location.hash;
66
- // console.log('url changed:', lastHash);
67
- emitUrlChange(lastHash);
68
- }, 1000);
69
-
70
- emitUrlChange(lastHash);
71
- return () => clearInterval(interval);
72
- }, [plugin]);
73
-
74
- //detect page height change
75
- useEffect(() => {
76
- const body = document.body;
77
- const handleResize = () => plugin?.event.emit('session.triggerHeightChange', body.clientHeight);
78
- body.addEventListener('resize', handleResize);
79
- handleResize();
80
- return () => body.removeEventListener('resize', handleResize);
81
- }, [plugin]);
82
-
83
- if (standaloneClient instanceof StandaloneClient) {
84
- return (
85
- <StandaloneAuth
86
- onLogin={async (email, password) => {
87
- if (await standaloneClient.login(email, password)) setStandaloneClient(true);
88
- }}
89
- />
90
- );
91
- }
92
-
93
- if (!plugin) {
94
- return '';
95
- }
96
-
97
- return (
98
- <PluginContext.Provider value={plugin}>
99
- {!settings?.disableContextMenu && !isSidebar && !isSettings && <ContextMenu client={plugin} />}
100
- {children}
101
- </PluginContext.Provider>
102
- );
103
- };
104
-
105
- export const useRimori = () => {
106
- const context = useContext(PluginContext);
107
- if (context === null) {
108
- throw new Error('useRimori must be used within an PluginProvider');
109
- }
110
- return context;
111
- };
112
-
113
- function getUrlParam(name: string) {
114
- // First try to get from URL hash query params (for compatibility)
115
- const hashParts = window.location.hash.split('?');
116
- if (hashParts.length > 1) {
117
- const hashParams = new URLSearchParams(hashParts[1]);
118
- const hashValue = hashParams.get(name);
119
- if (hashValue) return hashValue;
120
- }
121
-
122
- // Fallback to regular URL search params
123
- const url = new URL(window.location.href);
124
- return url.searchParams.get(name);
125
- }
126
-
127
- function initEventBus(pluginId: string) {
128
- // For now, use URL fallback for EventBus naming - this will be updated once MessageChannel is ready
129
- const isSidebar = getUrlParam('applicationMode') === 'sidebar';
130
- EventBusHandler.getInstance('Plugin EventBus ' + pluginId + ' ' + (isSidebar ? 'sidebar' : 'main'));
131
- }
132
-
133
- function StandaloneAuth({ onLogin }: { onLogin: (user: string, password: string) => void }) {
134
- const [user, setUser] = useState('');
135
- const [password, setPassword] = useState('');
136
- return (
137
- <div
138
- style={{
139
- position: 'fixed',
140
- inset: 0,
141
- display: 'flex',
142
- alignItems: 'center',
143
- justifyContent: 'center',
144
- backgroundColor: 'rgba(0, 0, 0, 0.5)',
145
- }}
146
- >
147
- <div
148
- style={{
149
- backgroundColor: '#343534',
150
- padding: '1rem',
151
- borderRadius: '0.5rem',
152
- width: '500px',
153
- flexDirection: 'column',
154
- display: 'flex',
155
- alignItems: 'center',
156
- justifyContent: 'center',
157
- }}
158
- >
159
- <p style={{ fontSize: '2rem', fontWeight: 'bold', marginBottom: '1rem', textAlign: 'center' }}>Rimori Login</p>
160
- <p style={{ marginBottom: '1rem', textAlign: 'center' }}>
161
- Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the
162
- same it will operate in the Rimori platform.
163
- </p>
164
- {/* email and password input */}
165
- <input
166
- style={{
167
- marginBottom: '1rem',
168
- width: '100%',
169
- padding: '0.5rem',
170
- borderRadius: '0.5rem',
171
- border: 'none',
172
- backgroundColor: '#444444',
173
- }}
174
- type="email"
175
- placeholder="Email"
176
- onChange={(e) => setUser(e.target.value)}
177
- />
178
- <input
179
- style={{
180
- marginBottom: '1rem',
181
- width: '100%',
182
- padding: '0.5rem',
183
- borderRadius: '0.5rem',
184
- border: 'none',
185
- backgroundColor: '#444444',
186
- }}
187
- type="password"
188
- placeholder="Password"
189
- onChange={(e) => setPassword(e.target.value)}
190
- />
191
- <button
192
- style={{
193
- marginBottom: '1rem',
194
- width: '100%',
195
- padding: '0.5rem',
196
- borderRadius: '0.5rem',
197
- border: 'none',
198
- backgroundColor: '#928358',
199
- }}
200
- onClick={() => {
201
- onLogin(user, password);
202
- }}
203
- >
204
- Login
205
- </button>
206
- </div>
207
- </div>
208
- );
209
- }
package/src/style.scss DELETED
@@ -1,136 +0,0 @@
1
- dialog::backdrop {
2
- backdrop-filter: blur(2px);
3
- // background: rgb(255, 255, 255, 0.5);
4
- }
5
-
6
- .dark * dialog::backdrop {
7
- background: transparent;
8
- }
9
-
10
- .tiptap {
11
- padding-top: 5px;
12
- padding-left: 7px;
13
- /* min-height: 300px; */
14
-
15
- &:focus-visible {
16
- outline: none;
17
- }
18
-
19
- h1,
20
- h2,
21
- h3,
22
- h4,
23
- h5,
24
- h6 {
25
- @apply font-bold;
26
- margin-bottom: 1rem;
27
- }
28
-
29
- h1 {
30
- @apply text-4xl;
31
- }
32
-
33
- h2 {
34
- @apply text-3xl;
35
- }
36
-
37
- h3 {
38
- @apply text-2xl;
39
- }
40
-
41
- h4 {
42
- @apply text-xl;
43
- }
44
-
45
- h5 {
46
- @apply text-lg;
47
- }
48
-
49
- h6 {
50
- @apply text-base;
51
- }
52
-
53
- p {
54
- @apply mb-4;
55
- }
56
-
57
- a {
58
- @apply text-blue-600 hover:text-blue-800;
59
- text-decoration: none;
60
- }
61
-
62
- a:hover {
63
- @apply underline;
64
- }
65
-
66
- ul {
67
- @apply list-disc pl-8;
68
-
69
- li > p {
70
- @apply mb-1;
71
- }
72
- }
73
-
74
- ol {
75
- @apply list-decimal pl-7;
76
-
77
- li > p {
78
- @apply mb-1;
79
- }
80
- }
81
-
82
- blockquote {
83
- @apply border-l-4 pl-4 italic text-gray-600 my-4;
84
- border-color: #ccc;
85
- }
86
-
87
- code {
88
- font-family: monospace;
89
- }
90
-
91
- pre {
92
- @apply bg-gray-800 text-gray-500 p-4 rounded-lg overflow-x-auto;
93
- font-family: monospace;
94
- white-space: pre-wrap;
95
- word-wrap: break-word;
96
- }
97
-
98
- img {
99
- @apply max-w-full h-auto rounded-lg my-4;
100
- }
101
-
102
- table {
103
- @apply table-auto w-full border-collapse mb-4;
104
- }
105
-
106
- th,
107
- td {
108
- @apply border px-4 py-2 text-left;
109
- }
110
-
111
- th {
112
- @apply bg-gray-500 font-semibold;
113
- }
114
-
115
- tr:nth-child(even) {
116
- @apply bg-gray-400;
117
- }
118
-
119
- @media (max-width: 768px) {
120
- h1 {
121
- @apply text-3xl;
122
- }
123
-
124
- h2 {
125
- @apply text-2xl;
126
- }
127
-
128
- p {
129
- @apply text-base;
130
- }
131
-
132
- img {
133
- @apply max-w-full;
134
- }
135
- }
136
- }
@@ -1,22 +0,0 @@
1
- export function isFullscreen() {
2
- return !!document.fullscreenElement;
3
- }
4
-
5
- export function triggerFullscreen(onStateChange: (isFullscreen: boolean) => void, selector?: string) {
6
- document.addEventListener('fullscreenchange', () => {
7
- onStateChange(isFullscreen());
8
- });
9
- try {
10
- const ref = document.querySelector(selector || '#root')!;
11
- if (!isFullscreen()) {
12
- // @ts-ignore
13
- ref.requestFullscreen() || ref.webkitRequestFullscreen();
14
- } else {
15
- // @ts-ignore
16
- document.exitFullscreen() || document.webkitExitFullscreen();
17
- }
18
- } catch (error: any) {
19
- console.error('Failed to enter fullscreen', error.message);
20
- }
21
- onStateChange(isFullscreen());
22
- }
File without changes
File without changes