@asgard-js/react 0.0.43 → 0.0.44-canary.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.
Files changed (136) hide show
  1. package/dist/components/chatbot/chatbot.d.ts +1 -1
  2. package/dist/components/chatbot/chatbot.d.ts.map +1 -1
  3. package/dist/context/asgard-service-context.d.ts +1 -1
  4. package/dist/context/asgard-service-context.d.ts.map +1 -1
  5. package/dist/hooks/use-channel.d.ts +1 -1
  6. package/dist/hooks/use-channel.d.ts.map +1 -1
  7. package/dist/index.js +20457 -20222
  8. package/package.json +4 -4
  9. package/.babelrc +0 -12
  10. package/eslint.config.cjs +0 -12
  11. package/src/components/.DS_Store +0 -0
  12. package/src/components/chatbot/api-key-input/api-key-input.module.scss +0 -156
  13. package/src/components/chatbot/api-key-input/api-key-input.tsx +0 -111
  14. package/src/components/chatbot/api-key-input/index.ts +0 -1
  15. package/src/components/chatbot/chatbot-body/chatbot-body.module.scss +0 -13
  16. package/src/components/chatbot/chatbot-body/chatbot-body.tsx +0 -45
  17. package/src/components/chatbot/chatbot-body/conversation-message-renderer.tsx +0 -55
  18. package/src/components/chatbot/chatbot-body/index.ts +0 -1
  19. package/src/components/chatbot/chatbot-container/chatbot-container.module.scss +0 -41
  20. package/src/components/chatbot/chatbot-container/chatbot-container.tsx +0 -49
  21. package/src/components/chatbot/chatbot-container/chatbot-full-screen-container.tsx +0 -54
  22. package/src/components/chatbot/chatbot-footer/chatbot-footer.module.scss +0 -67
  23. package/src/components/chatbot/chatbot-footer/chatbot-footer.tsx +0 -140
  24. package/src/components/chatbot/chatbot-footer/index.ts +0 -1
  25. package/src/components/chatbot/chatbot-footer/speech-input-button.tsx +0 -132
  26. package/src/components/chatbot/chatbot-header/chatbot-header.module.scss +0 -48
  27. package/src/components/chatbot/chatbot-header/chatbot-header.tsx +0 -98
  28. package/src/components/chatbot/chatbot-header/index.ts +0 -1
  29. package/src/components/chatbot/chatbot.module.scss +0 -24
  30. package/src/components/chatbot/chatbot.spec.tsx +0 -8
  31. package/src/components/chatbot/chatbot.tsx +0 -227
  32. package/src/components/chatbot/profile-icon.tsx +0 -26
  33. package/src/components/index.ts +0 -2
  34. package/src/components/templates/avatar/avatar.module.scss +0 -6
  35. package/src/components/templates/avatar/avatar.tsx +0 -28
  36. package/src/components/templates/avatar/index.ts +0 -1
  37. package/src/components/templates/button-template/button-template.module.scss +0 -0
  38. package/src/components/templates/button-template/button-template.tsx +0 -45
  39. package/src/components/templates/button-template/card.module.scss +0 -58
  40. package/src/components/templates/button-template/card.spec.tsx +0 -213
  41. package/src/components/templates/button-template/card.tsx +0 -123
  42. package/src/components/templates/button-template/index.ts +0 -1
  43. package/src/components/templates/carousel-template/carousel-template.module.scss +0 -15
  44. package/src/components/templates/carousel-template/carousel-template.tsx +0 -49
  45. package/src/components/templates/carousel-template/index.ts +0 -1
  46. package/src/components/templates/chart-template/chart-template.module.scss +0 -52
  47. package/src/components/templates/chart-template/chart-template.tsx +0 -75
  48. package/src/components/templates/chart-template/index.ts +0 -1
  49. package/src/components/templates/hint-template/hint-template.module.scss +0 -43
  50. package/src/components/templates/hint-template/hint-template.tsx +0 -76
  51. package/src/components/templates/hint-template/index.ts +0 -1
  52. package/src/components/templates/image-template/image-template.module.scss +0 -67
  53. package/src/components/templates/image-template/image-template.tsx +0 -58
  54. package/src/components/templates/image-template/index.ts +0 -1
  55. package/src/components/templates/index.ts +0 -10
  56. package/src/components/templates/quick-replies/index.ts +0 -1
  57. package/src/components/templates/quick-replies/quick-replies.module.scss +0 -16
  58. package/src/components/templates/quick-replies/quick-replies.tsx +0 -47
  59. package/src/components/templates/template-box/index.ts +0 -2
  60. package/src/components/templates/template-box/template-box-content.module.scss +0 -13
  61. package/src/components/templates/template-box/template-box-content.tsx +0 -30
  62. package/src/components/templates/template-box/template-box.module.scss +0 -19
  63. package/src/components/templates/template-box/template-box.tsx +0 -48
  64. package/src/components/templates/text-template/bot-typing-box.tsx +0 -81
  65. package/src/components/templates/text-template/bot-typing-placeholder.tsx +0 -28
  66. package/src/components/templates/text-template/index.ts +0 -3
  67. package/src/components/templates/text-template/text-template.module.scss +0 -131
  68. package/src/components/templates/text-template/text-template.tsx +0 -94
  69. package/src/components/templates/text-template/use-react-markdown-renderer.spec.tsx +0 -758
  70. package/src/components/templates/time/index.ts +0 -1
  71. package/src/components/templates/time/time.module.scss +0 -6
  72. package/src/components/templates/time/time.tsx +0 -34
  73. package/src/context/asgard-app-initialization-context.tsx +0 -154
  74. package/src/context/asgard-service-context.tsx +0 -148
  75. package/src/context/asgard-template-context.tsx +0 -83
  76. package/src/context/asgard-theme-context.tsx +0 -553
  77. package/src/context/index.ts +0 -4
  78. package/src/hooks/index.ts +0 -11
  79. package/src/hooks/use-asgard-service-client.ts +0 -68
  80. package/src/hooks/use-channel.ts +0 -160
  81. package/src/hooks/use-debounce.ts +0 -18
  82. package/src/hooks/use-deep-compare-memo.ts +0 -19
  83. package/src/hooks/use-is-on-screen-keyboard-open.ts +0 -43
  84. package/src/hooks/use-on-screen-keyboard-scroll-fix.ts +0 -17
  85. package/src/hooks/use-prevent-over-scrolling.ts +0 -77
  86. package/src/hooks/use-react-markdown-renderer.tsx +0 -278
  87. package/src/hooks/use-resize-observer.tsx +0 -27
  88. package/src/hooks/use-update-vh.ts +0 -30
  89. package/src/hooks/use-viewport-size.ts +0 -51
  90. package/src/icons/add_a_photo.svg +0 -3
  91. package/src/icons/bot.svg +0 -14
  92. package/src/icons/close.svg +0 -3
  93. package/src/icons/distance.svg +0 -3
  94. package/src/icons/eye-off.svg +0 -4
  95. package/src/icons/eye.svg +0 -4
  96. package/src/icons/mic.svg +0 -3
  97. package/src/icons/photo_library.svg +0 -3
  98. package/src/icons/profile.svg +0 -28
  99. package/src/icons/refresh.svg +0 -3
  100. package/src/icons/send.svg +0 -3
  101. package/src/icons/stop.svg +0 -22
  102. package/src/icons/volume_up.svg +0 -3
  103. package/src/index.ts +0 -4
  104. package/src/models/bot-provider.ts +0 -108
  105. package/src/styles/_index.scss +0 -1
  106. package/src/styles/_styles.scss +0 -11
  107. package/src/styles/colors/_colors.scss +0 -10
  108. package/src/styles/colors/_index.scss +0 -1
  109. package/src/styles/colors/_variables.scss +0 -72
  110. package/src/styles/palette/_index.scss +0 -1
  111. package/src/styles/palette/_palette.scss +0 -42
  112. package/src/styles/palette/_variables.scss +0 -40
  113. package/src/styles/radius/_index.scss +0 -1
  114. package/src/styles/radius/_radius.scss +0 -8
  115. package/src/styles/radius/_variables.scss +0 -12
  116. package/src/styles/spacing/_index.scss +0 -1
  117. package/src/styles/spacing/_spacing.scss +0 -8
  118. package/src/styles/spacing/_variables.scss +0 -13
  119. package/src/styles/utils/_index.scss +0 -1
  120. package/src/styles/utils/_map.scss +0 -22
  121. package/src/test-setup.ts +0 -1
  122. package/src/utils/color-utils.ts +0 -52
  123. package/src/utils/deep-merge.ts +0 -26
  124. package/src/utils/extractors.ts +0 -20
  125. package/src/utils/format-time.ts +0 -8
  126. package/src/utils/index.ts +0 -1
  127. package/src/utils/is.ts +0 -72
  128. package/src/utils/selectors.ts +0 -7
  129. package/src/utils/uri-validation.spec.ts +0 -208
  130. package/src/utils/uri-validation.ts +0 -103
  131. package/tsconfig.json +0 -16
  132. package/tsconfig.lib.json +0 -63
  133. package/tsconfig.spec.json +0 -36
  134. package/tsconfig.tsbuildinfo +0 -1
  135. package/vite.config.ts +0 -63
  136. /package/dist/{style.css → index.css} +0 -0
@@ -1,131 +0,0 @@
1
- .text {
2
- display: inline-block;
3
- padding: 8px 12px;
4
- border-radius: 8px;
5
- color: white;
6
- word-break: break-all;
7
-
8
- > span {
9
- word-break: break-all;
10
- }
11
-
12
- .md_container {
13
- display: inline-block;
14
- width: 100%;
15
-
16
- p {
17
- margin: 0;
18
- }
19
- }
20
- }
21
-
22
- .text--user {
23
- max-width: 75%;
24
- background: #4767eb;
25
- border-top-right-radius: 0;
26
- }
27
-
28
- .text--bot {
29
- max-width: 70%;
30
- background: #585858;
31
- border-top-left-radius: 0;
32
- }
33
-
34
- .content {
35
- display: flex;
36
- flex-direction: column;
37
- gap: 8px;
38
- }
39
-
40
- .typing-indicator {
41
- display: inline-flex;
42
- align-items: flex-end;
43
- justify-content: center;
44
-
45
- .dot {
46
- width: 2px;
47
- height: 2px;
48
- margin: 0 2px;
49
- background-color: white;
50
- border-radius: 50%;
51
-
52
- animation: blink 1.4s infinite ease-in-out both;
53
-
54
- &:nth-child(1) {
55
- animation-delay: 0s;
56
- }
57
- &:nth-child(2) {
58
- animation-delay: 0.2s;
59
- }
60
- &:nth-child(3) {
61
- animation-delay: 0.4s;
62
- }
63
- }
64
- }
65
-
66
- .table_container {
67
- overflow-x: scroll;
68
-
69
- table {
70
- width: 100%;
71
- border-collapse: collapse;
72
- border-spacing: 0;
73
- min-width: 600px;
74
- font-size: 14px;
75
- background-color: #1f1f1f;
76
- color: rgba(255, 255, 255, 0.85);
77
- border: 1px solid #333;
78
- border-radius: 4px;
79
- overflow: hidden;
80
-
81
- thead {
82
- position: sticky;
83
- top: 0;
84
- z-index: 1;
85
- background-color: #141414;
86
- }
87
-
88
- th,
89
- td {
90
- padding: 12px 16px;
91
- border-bottom: 1px solid #333;
92
- text-align: left;
93
- white-space: nowrap;
94
- transition: background-color 0.3s, color 0.3s;
95
- }
96
-
97
- th {
98
- font-weight: 600;
99
- color: rgba(255, 255, 255, 0.95);
100
- }
101
-
102
- tbody tr:nth-child(odd) {
103
- background-color: #1c1c1c;
104
- }
105
-
106
- tbody tr:nth-child(even) {
107
- background-color: #111;
108
- }
109
-
110
- tbody tr:hover td {
111
- background-color: #262626;
112
- }
113
-
114
- tbody tr:last-child td {
115
- border-bottom: none;
116
- }
117
- }
118
- }
119
-
120
- @keyframes blink {
121
- 0%,
122
- 80%,
123
- 100% {
124
- opacity: 0.2;
125
- transform: translateY(0);
126
- }
127
- 40% {
128
- opacity: 1;
129
- transform: translateY(-5px);
130
- }
131
- }
@@ -1,94 +0,0 @@
1
- import { CSSProperties, ReactNode, useMemo } from 'react';
2
- import clsx from 'clsx';
3
- import { ConversationBotMessage, ConversationMessage } from '@asgard-js/core';
4
- import { TemplateBox, TemplateBoxContent } from '../template-box';
5
- import classes from './text-template.module.scss';
6
- import { Avatar } from '../avatar';
7
- import { Time } from '../time';
8
- import { useAsgardContext } from '../../../context/asgard-service-context';
9
- import { useAsgardThemeContext } from '../../../context/asgard-theme-context';
10
- import { useMarkdownRenderer } from '../../../hooks/use-react-markdown-renderer';
11
-
12
- interface TextTemplateProps {
13
- message: ConversationMessage;
14
- }
15
-
16
- export function TextTemplate(props: TextTemplateProps): ReactNode {
17
- const { message } = props;
18
-
19
- const { avatar } = useAsgardContext();
20
-
21
- const theme = useAsgardThemeContext();
22
- const { botMessage } = theme;
23
-
24
- const { htmlBlocks, lastTypingText } = useMarkdownRenderer(
25
- (message as ConversationBotMessage)?.message?.text || '',
26
- 20
27
- );
28
-
29
- const rootStyle = theme?.template?.TextMessageTemplate?.style;
30
-
31
- const styles = useMemo<CSSProperties>(() => {
32
- switch (message.type) {
33
- case 'user':
34
- return {
35
- color: theme?.userMessage?.color,
36
- backgroundColor: theme?.userMessage?.backgroundColor,
37
- };
38
- case 'bot':
39
- return {
40
- color: theme?.botMessage?.color,
41
- backgroundColor: theme?.botMessage?.backgroundColor,
42
- };
43
- default:
44
- return {
45
- color: theme?.chatbot?.primaryComponent?.secondaryColor || theme?.template?.TextMessageTemplate?.style?.color,
46
- backgroundColor: botMessage?.unsentBackgroundColor,
47
- };
48
- }
49
- }, [message, theme, botMessage]);
50
-
51
- if (message.type === 'error') return null;
52
-
53
- if (message.type === 'user') {
54
- return (
55
- <TemplateBox
56
- className="asgard-text-template asgard-text-template--user"
57
- type="user"
58
- direction="horizontal"
59
- style={rootStyle}
60
- >
61
- <div
62
- className={clsx(classes.text, classes['text--user'])}
63
- style={styles}
64
- >
65
- {message.text}
66
- </div>
67
- <Time time={message.time} />
68
- </TemplateBox>
69
- );
70
- }
71
-
72
- return (
73
- <TemplateBox
74
- className="asgard-text-template asgard-text-template--bot"
75
- type="bot"
76
- direction="horizontal"
77
- style={rootStyle}
78
- >
79
- <Avatar avatar={avatar} />
80
- <TemplateBoxContent
81
- time={message.time}
82
- quickReplies={message.message.template?.quickReplies}
83
- >
84
- <div
85
- className={clsx(classes.text, classes['text--bot'])}
86
- style={styles}
87
- >
88
- {htmlBlocks}
89
- {lastTypingText ?? ''}
90
- </div>
91
- </TemplateBoxContent>
92
- </TemplateBox>
93
- );
94
- }