@memori.ai/memori-react 1.1.0 → 1.2.1

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 (57) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/MemoriWidget/MemoriWidget.js +3 -1
  3. package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
  4. package/dist/components/PoweredBy/PoweredBy.d.ts +7 -0
  5. package/dist/components/PoweredBy/PoweredBy.js +9 -0
  6. package/dist/components/PoweredBy/PoweredBy.js.map +1 -0
  7. package/dist/components/PoweredBy/PoweredBy.stories.d.ts +8 -0
  8. package/dist/components/PoweredBy/PoweredBy.stories.js +39 -0
  9. package/dist/components/PoweredBy/PoweredBy.stories.js.map +1 -0
  10. package/dist/components/PoweredBy/PoweredBy.test.d.ts +1 -0
  11. package/dist/components/PoweredBy/PoweredBy.test.js +11 -0
  12. package/dist/components/PoweredBy/PoweredBy.test.js.map +1 -0
  13. package/dist/components/icons/icons.stories.js +1 -1
  14. package/dist/components/icons/icons.stories.js.map +1 -1
  15. package/dist/components/layouts/Default.d.ts +1 -0
  16. package/dist/components/layouts/Default.js +1 -1
  17. package/dist/components/layouts/Default.js.map +1 -1
  18. package/dist/components/ui/definitions.stories.d.ts +5 -0
  19. package/dist/components/ui/definitions.stories.js +67 -0
  20. package/dist/components/ui/definitions.stories.js.map +1 -0
  21. package/esm/components/MemoriWidget/MemoriWidget.js +3 -1
  22. package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
  23. package/esm/components/PoweredBy/PoweredBy.d.ts +7 -0
  24. package/esm/components/PoweredBy/PoweredBy.js +7 -0
  25. package/esm/components/PoweredBy/PoweredBy.js.map +1 -0
  26. package/esm/components/PoweredBy/PoweredBy.stories.d.ts +8 -0
  27. package/esm/components/PoweredBy/PoweredBy.stories.js +35 -0
  28. package/esm/components/PoweredBy/PoweredBy.stories.js.map +1 -0
  29. package/esm/components/PoweredBy/PoweredBy.test.d.ts +1 -0
  30. package/esm/components/PoweredBy/PoweredBy.test.js +8 -0
  31. package/esm/components/PoweredBy/PoweredBy.test.js.map +1 -0
  32. package/esm/components/icons/icons.stories.js +1 -1
  33. package/esm/components/icons/icons.stories.js.map +1 -1
  34. package/esm/components/layouts/Default.d.ts +1 -0
  35. package/esm/components/layouts/Default.js +1 -1
  36. package/esm/components/layouts/Default.js.map +1 -1
  37. package/esm/components/ui/definitions.stories.d.ts +5 -0
  38. package/esm/components/ui/definitions.stories.js +64 -0
  39. package/esm/components/ui/definitions.stories.js.map +1 -0
  40. package/package.json +3 -2
  41. package/src/components/ChatInputs/ChatInputs.css +3 -3
  42. package/src/components/ImageUpload/ImageUpload.css +2 -2
  43. package/src/components/MediaWidget/MediaWidget.css +4 -4
  44. package/src/components/MemoriWidget/MemoriWidget.css +0 -22
  45. package/src/components/MemoriWidget/MemoriWidget.tsx +4 -0
  46. package/src/components/PoweredBy/PoweredBy.css +45 -0
  47. package/src/components/PoweredBy/PoweredBy.stories.tsx +41 -0
  48. package/src/components/PoweredBy/PoweredBy.test.tsx +8 -0
  49. package/src/components/PoweredBy/PoweredBy.tsx +34 -0
  50. package/src/components/PoweredBy/__snapshots__/PoweredBy.test.tsx.snap +25 -0
  51. package/src/components/StartPanel/StartPanel.css +3 -3
  52. package/src/components/icons/icons.stories.tsx +1 -1
  53. package/src/components/layouts/Default.tsx +4 -0
  54. package/src/components/ui/Button.css +0 -10
  55. package/src/components/ui/Checkbox.css +1 -5
  56. package/src/components/ui/definitions.stories.tsx +139 -0
  57. package/src/styles.css +28 -0
@@ -0,0 +1,45 @@
1
+ .memori--powered-by {
2
+ position: absolute;
3
+ z-index: 1000;
4
+ bottom: 1rem;
5
+ left: 0;
6
+ display: inline-flex;
7
+ flex-wrap: wrap;
8
+ padding: 0.25rem 0.5rem;
9
+ border-radius: 10px;
10
+ background-color: var(--memori-inner-bg, transparent);
11
+ box-shadow: var(--memori-button-box-shadow);
12
+ color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
13
+ font-size: 0.7em;
14
+ }
15
+
16
+ @media (max-width: 768px) {
17
+ .memori--powered-by {
18
+ top: 3.5rem;
19
+ bottom: auto;
20
+ }
21
+ }
22
+
23
+ .memori--powered-by img {
24
+ max-width: 2rem;
25
+ max-height: 2rem;
26
+ margin-right: 0.25rem;
27
+ }
28
+
29
+ .memori--powered-by p {
30
+ margin-top: 0;
31
+ margin-bottom: 0;
32
+ color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
33
+ }
34
+
35
+ .memori--powered-by a {
36
+ color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
37
+ text-decoration: underline;
38
+ }
39
+
40
+ .memori--powered-by a:hover,
41
+ .memori--powered-by a:focus {
42
+ color: var(--memori-text-color, rgba(0, 0, 0, 0.85)) !important;
43
+ opacity: 0.8;
44
+ text-decoration: underline;
45
+ }
@@ -0,0 +1,41 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import PoweredBy, { Props } from './PoweredBy';
3
+
4
+ import './PoweredBy.css';
5
+
6
+ const meta: Meta = {
7
+ title: 'Powered by',
8
+ component: PoweredBy,
9
+ argTypes: {},
10
+ parameters: {
11
+ controls: { expanded: true },
12
+ },
13
+ };
14
+
15
+ export default meta;
16
+
17
+ const Template: Story<Props> = args => <PoweredBy {...args} />;
18
+
19
+ export const Default = Template.bind({});
20
+ Default.args = {
21
+ userLang: 'en',
22
+ };
23
+
24
+ export const MemoryTwin = Template.bind({});
25
+ MemoryTwin.args = {
26
+ tenant: {
27
+ id: 'memorytwin',
28
+ theme: 'memorytwin',
29
+ config: {
30
+ name: 'MemoryTwin',
31
+ showNewUser: true,
32
+ requirePosition: false,
33
+ feedbackURL: '',
34
+ },
35
+ },
36
+ };
37
+
38
+ export const Italian = Template.bind({});
39
+ Italian.args = {
40
+ userLang: 'it',
41
+ };
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { render } from '@testing-library/react';
3
+ import PoweredBy from './PoweredBy';
4
+
5
+ it('renders PoweredBy unchanged', () => {
6
+ const { container } = render(<PoweredBy />);
7
+ expect(container).toMatchSnapshot();
8
+ });
@@ -0,0 +1,34 @@
1
+ import { Tenant } from '@memori.ai/memori-api-client/dist/types';
2
+
3
+ export interface Props {
4
+ tenant?: Tenant;
5
+ userLang?: string;
6
+ }
7
+
8
+ const PoweredBy = ({ tenant, userLang = 'en' }: Props) => {
9
+ const tenantId =
10
+ tenant?.theme === 'memorytwin' ? 'memorytwin' : 'twincreator';
11
+
12
+ return (
13
+ <div className="memori--powered-by">
14
+ <img
15
+ src={`https://app.twincreator.com/images/${tenantId}/logo.png`}
16
+ alt=""
17
+ />
18
+ <p>
19
+ Powered by{' '}
20
+ <a
21
+ href={`https://app.${tenantId}.com/${
22
+ userLang ? userLang.toLowerCase() : ''
23
+ }`}
24
+ target="_blank"
25
+ rel="noopener noreferrer"
26
+ >
27
+ {tenantId === 'memorytwin' ? 'MemoryTwin' : 'TwinCreator'}
28
+ </a>
29
+ </p>
30
+ </div>
31
+ );
32
+ };
33
+
34
+ export default PoweredBy;
@@ -0,0 +1,25 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`renders PoweredBy unchanged 1`] = `
4
+ <div>
5
+ <div
6
+ class="memori--powered-by"
7
+ >
8
+ <img
9
+ alt=""
10
+ src="https://app.twincreator.com/images/twincreator/logo.png"
11
+ />
12
+ <p>
13
+ Powered by
14
+
15
+ <a
16
+ href="https://app.twincreator.com/en"
17
+ rel="noopener noreferrer"
18
+ target="_blank"
19
+ >
20
+ TwinCreator
21
+ </a>
22
+ </p>
23
+ </div>
24
+ </div>
25
+ `;
@@ -7,7 +7,7 @@
7
7
  height: 2rem;
8
8
  align-items: center;
9
9
  justify-content: center;
10
- border: 1.5px solid var(--ant-primary-color);
10
+ border: 1.5px solid var(--memori-primary);
11
11
  border-radius: 50%;
12
12
  background: #fff;
13
13
  box-shadow: 0 0 5px 6px rgba(255, 255, 255, 0.5);
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  .memori--start-panel .memori--start-panel-title {
32
- color: var(--memori-text-color, var(--ant-primary-color)) !important;
32
+ color: var(--memori-text-color, var(--memori-primary)) !important;
33
33
  }
34
34
 
35
35
  .memori--start-panel .memori--start-panel-description {
@@ -132,7 +132,7 @@
132
132
  height: 2rem;
133
133
  align-items: center;
134
134
  justify-content: center;
135
- border: 1.5px solid var(--ant-primary-color);
135
+ border: 1.5px solid var(--memori-primary);
136
136
  border-radius: 50%;
137
137
  background: #fff;
138
138
  box-shadow: 0 0 5px 6px rgba(255, 255, 255, 0.5);
@@ -48,7 +48,7 @@ const IconsShowcase = (iconProps: IconProps) => {
48
48
  };
49
49
 
50
50
  const meta: Meta = {
51
- title: 'Icons',
51
+ title: 'Definitions/Icons',
52
52
  component: IconsShowcase,
53
53
  argTypes: {
54
54
  children: {
@@ -9,6 +9,7 @@ export interface Props {
9
9
  integrationStyle?: JSX.Element | null;
10
10
  integrationBackground?: JSX.Element | null;
11
11
  changeMode?: JSX.Element | null;
12
+ poweredBy?: JSX.Element | null;
12
13
  sessionId?: string;
13
14
  hasUserActivatedSpeak?: boolean;
14
15
  showInstruct?: boolean;
@@ -27,6 +28,7 @@ const Default: React.FC<Props> = ({
27
28
  hasUserActivatedSpeak,
28
29
  showInstruct = false,
29
30
  loading = false,
31
+ poweredBy,
30
32
  }) => (
31
33
  <>
32
34
  {integrationStyle}
@@ -44,6 +46,8 @@ const Default: React.FC<Props> = ({
44
46
  <div className="memori--grid-column memori--grid-column-right">
45
47
  {sessionId && hasUserActivatedSpeak ? chat : startPanel}
46
48
  </div>
49
+
50
+ {poweredBy}
47
51
  </div>
48
52
  </Spin>
49
53
  </>
@@ -1,13 +1,3 @@
1
- :root,
2
- #root {
3
- --memori-primary: rgb(102, 103, 171);
4
- --memori-primary-text: #fff;
5
- --memori-button-radius: 5px;
6
- --memori-button-padding: 0.5rem 1.5rem;
7
- --memori-button-border-color: #d9d9d9;
8
- --memori-button-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02);
9
- }
10
-
11
1
  .memori-button {
12
2
  display: inline-flex;
13
3
  align-items: center;
@@ -1,8 +1,4 @@
1
- :root,
2
- #root {
3
- --memori-primary: rgb(102, 103, 171);
4
- --memori-primary-text: #fff;
5
- }
1
+
6
2
 
7
3
  .memori-checkbox {
8
4
  display: inline-flex;
@@ -0,0 +1,139 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+ import '../../styles.css';
4
+
5
+ const ColorDisplay = ({ color }: { color: string }) => (
6
+ <div
7
+ style={{
8
+ marginTop: '1rem',
9
+ }}
10
+ >
11
+ <dt style={{ minWidth: 250, fontSize: '12px', marginBottom: '0.5rem' }}>
12
+ --{color}
13
+ </dt>
14
+ <dd>
15
+ <div
16
+ className={`color-${color}`}
17
+ style={{
18
+ width: '100px',
19
+ height: '100px',
20
+ boxShadow: '0 0 0.5rem rgba(0, 0, 0, 0.1)',
21
+ borderRadius: '10px',
22
+ background: `var(--${color})`,
23
+ }}
24
+ title={color}
25
+ />
26
+ </dd>
27
+ </div>
28
+ );
29
+
30
+ const colors = [
31
+ 'memori-primary',
32
+ 'memori-primary-text',
33
+ 'memori-inner-bg',
34
+ 'memori-chat-bubble-bg',
35
+ 'memori-text-color',
36
+ 'memori-button-bg',
37
+ 'memori-button-text',
38
+ 'memori-button-border-color',
39
+ ];
40
+
41
+ const variables = [
42
+ 'memori-inner-content-pad',
43
+ 'memori-button-padding',
44
+ 'memori-drawer--width',
45
+ 'memori-drawer--width--md',
46
+ 'memori-drawer--width--lg',
47
+ 'memori-modal--width',
48
+ 'memori-modal--width--md',
49
+ ];
50
+
51
+ const Definitions = () => (
52
+ <div>
53
+ <h2>Colors</h2>
54
+ <dl>
55
+ {colors.map(color => (
56
+ <ColorDisplay key={color} color={color} />
57
+ ))}
58
+ </dl>
59
+ <h2>Others</h2>
60
+ <dl>
61
+ <div
62
+ style={{
63
+ marginTop: '1rem',
64
+ }}
65
+ >
66
+ <dt style={{ minWidth: 250, fontSize: '12px', marginBottom: '0.5rem' }}>
67
+ <p>--memori-button-box-shadow +</p>
68
+ <p>--memori-button-radius</p>
69
+ </dt>
70
+ <dd>
71
+ <div
72
+ style={{
73
+ boxShadow: 'var(--memori-button-box-shadow)',
74
+ border: '1px solid #f3f3f3',
75
+ width: '100px',
76
+ height: '100px',
77
+ borderRadius: 'var(--memori-button-radius)',
78
+ }}
79
+ />
80
+ </dd>
81
+ </div>
82
+ <div
83
+ style={{
84
+ marginTop: '1rem',
85
+ }}
86
+ >
87
+ <dt style={{ minWidth: 250, fontSize: '12px', marginBottom: '0.5rem' }}>
88
+ --memori-blur-background
89
+ </dt>
90
+ <dd>
91
+ <div
92
+ style={{
93
+ backgroundColor: '#eee',
94
+ backgroundPosition: 'center center',
95
+ backgroundRepeat: 'no-repeat',
96
+ backgroundSize: 'cover',
97
+ backgroundImage:
98
+ 'url(https://app.twincreator.com/images/twincreator/og-image.png)',
99
+ filter: 'blur(var(--memori-blur-background, 0))',
100
+ width: '200px',
101
+ height: '100px',
102
+ borderRadius: '10px',
103
+ }}
104
+ />
105
+ </dd>
106
+ </div>
107
+ </dl>
108
+ <ul
109
+ style={{
110
+ padding: 0,
111
+ margin: 0,
112
+ listStyle: 'none',
113
+ }}
114
+ >
115
+ {variables.map(v => (
116
+ <li
117
+ key={v}
118
+ style={{
119
+ marginTop: '1rem',
120
+ }}
121
+ >
122
+ <p
123
+ style={{ minWidth: 250, fontSize: '12px', marginBottom: '0.5rem' }}
124
+ >
125
+ --{v}
126
+ </p>
127
+ </li>
128
+ ))}
129
+ </ul>
130
+ </div>
131
+ );
132
+
133
+ export default {
134
+ title: 'Definitions/CSS Variables',
135
+ component: Definitions,
136
+ } as ComponentMeta<typeof Definitions>;
137
+
138
+ const Template: ComponentStory<typeof Definitions> = () => <Definitions />;
139
+ export const Default = Template.bind({});
package/src/styles.css CHANGED
@@ -31,5 +31,33 @@
31
31
  @import url('./components/Snippet/Snippet.css');
32
32
  @import url('./components/StartPanel/StartPanel.css');
33
33
  @import url('./components/UploadMenu/UploadMenu.css');
34
+ @import url('./components/PoweredBy/PoweredBy.css');
34
35
 
35
36
  @import url('https://fonts.bunny.net/css?family=exo-2:200,400,700');
37
+
38
+ memori-client,
39
+ memori-client #root,
40
+ body.sb-show-main #root,
41
+ .memori-widget {
42
+ font-family: 'Exo 2', sans-serif;
43
+ font-size: 16px;
44
+
45
+ --memori-primary: rgb(102, 103, 171);
46
+ --memori-primary-text: #fff;
47
+ --memori-inner-content-pad: 1rem;
48
+ --memori-inner-bg: transparent;
49
+ --memori-chat-bubble-bg: #ffffff60;
50
+ --memori-text-color: #000;
51
+ --memori-button-bg: #fff;
52
+ --memori-button-text: #000;
53
+ --memori-button-padding: 0.5rem 1.5rem;
54
+ --memori-button-border-color: #d9d9d9;
55
+ --memori-button-radius: 5px;
56
+ --memori-button-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02);
57
+ --memori-blur-background: 0px;
58
+ --memori-drawer--width: 100%;
59
+ --memori-drawer--width--md: 80%;
60
+ --memori-drawer--width--lg: 60%;
61
+ --memori-modal--width: 100%;
62
+ --memori-modal--width--md: 80%;
63
+ }