@asgard-js/react 0.0.31 → 0.0.32-canary.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 (146) hide show
  1. package/.babelrc +12 -0
  2. package/README.md +10 -12
  3. package/dist/components/chatbot/chatbot-body/conversation-message-renderer.d.ts +1 -1
  4. package/dist/components/chatbot/chatbot.d.ts +1 -1
  5. package/dist/components/templates/button-template/button-template.d.ts +1 -1
  6. package/dist/components/templates/button-template/card.d.ts +1 -1
  7. package/dist/components/templates/button-template/card.d.ts.map +1 -1
  8. package/dist/components/templates/carousel-template/carousel-template.d.ts +1 -1
  9. package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
  10. package/dist/components/templates/chart-template/chart-template.d.ts +1 -1
  11. package/dist/components/templates/chart-template/chart-template.d.ts.map +1 -1
  12. package/dist/components/templates/hint-template/hint-template.d.ts +1 -1
  13. package/dist/components/templates/image-template/image-template.d.ts +1 -1
  14. package/dist/components/templates/image-template/image-template.d.ts.map +1 -1
  15. package/dist/components/templates/text-template/text-template.d.ts +1 -1
  16. package/dist/components/templates/text-template/use-react-markdown-renderer.d.ts.map +1 -1
  17. package/dist/context/asgard-app-initialization-context.d.ts +1 -1
  18. package/dist/context/asgard-service-context.d.ts +1 -1
  19. package/dist/context/asgard-template-context.d.ts +3 -3
  20. package/dist/context/asgard-template-context.d.ts.map +1 -1
  21. package/dist/hooks/use-asgard-service-client.d.ts +1 -1
  22. package/dist/hooks/use-channel.d.ts +4 -4
  23. package/dist/hooks/use-channel.d.ts.map +1 -1
  24. package/dist/index.js +46361 -9681
  25. package/dist/models/bot-provider.d.ts +1 -1
  26. package/dist/utils/deep-merge.d.ts +1 -1
  27. package/dist/utils/deep-merge.d.ts.map +1 -1
  28. package/eslint.config.cjs +12 -0
  29. package/package.json +9 -7
  30. package/src/components/chatbot/chatbot-body/chatbot-body.module.scss +13 -0
  31. package/src/components/chatbot/chatbot-body/chatbot-body.tsx +45 -0
  32. package/src/components/chatbot/chatbot-body/conversation-message-renderer.tsx +55 -0
  33. package/src/components/chatbot/chatbot-body/index.ts +1 -0
  34. package/src/components/chatbot/chatbot-container/chatbot-container.module.scss +41 -0
  35. package/src/components/chatbot/chatbot-container/chatbot-container.tsx +49 -0
  36. package/src/components/chatbot/chatbot-container/chatbot-full-screen-container.tsx +54 -0
  37. package/src/components/chatbot/chatbot-footer/chatbot-footer.module.scss +67 -0
  38. package/src/components/chatbot/chatbot-footer/chatbot-footer.tsx +140 -0
  39. package/src/components/chatbot/chatbot-footer/index.ts +1 -0
  40. package/src/components/chatbot/chatbot-footer/speech-input-button.tsx +132 -0
  41. package/src/components/chatbot/chatbot-header/chatbot-header.module.scss +48 -0
  42. package/src/components/chatbot/chatbot-header/chatbot-header.tsx +98 -0
  43. package/src/components/chatbot/chatbot-header/index.ts +1 -0
  44. package/src/components/chatbot/chatbot.spec.tsx +8 -0
  45. package/src/components/chatbot/chatbot.tsx +118 -0
  46. package/src/components/chatbot/profile-icon.tsx +26 -0
  47. package/src/components/index.ts +2 -0
  48. package/src/components/templates/avatar/avatar.module.scss +6 -0
  49. package/src/components/templates/avatar/avatar.tsx +28 -0
  50. package/src/components/templates/avatar/index.ts +1 -0
  51. package/src/components/templates/button-template/button-template.module.scss +0 -0
  52. package/src/components/templates/button-template/button-template.tsx +45 -0
  53. package/src/components/templates/button-template/card.module.scss +58 -0
  54. package/src/components/templates/button-template/card.spec.tsx +213 -0
  55. package/src/components/templates/button-template/card.tsx +123 -0
  56. package/src/components/templates/button-template/index.ts +1 -0
  57. package/src/components/templates/carousel-template/carousel-template.module.scss +15 -0
  58. package/src/components/templates/carousel-template/carousel-template.tsx +49 -0
  59. package/src/components/templates/carousel-template/index.ts +1 -0
  60. package/src/components/templates/chart-template/chart-template.module.scss +52 -0
  61. package/src/components/templates/chart-template/chart-template.tsx +75 -0
  62. package/src/components/templates/chart-template/index.ts +1 -0
  63. package/src/components/templates/hint-template/hint-template.module.scss +39 -0
  64. package/src/components/templates/hint-template/hint-template.tsx +71 -0
  65. package/src/components/templates/hint-template/index.ts +1 -0
  66. package/src/components/templates/image-template/image-template.module.scss +67 -0
  67. package/src/components/templates/image-template/image-template.tsx +58 -0
  68. package/src/components/templates/image-template/index.ts +1 -0
  69. package/src/components/templates/index.ts +10 -0
  70. package/src/components/templates/quick-replies/index.ts +1 -0
  71. package/src/components/templates/quick-replies/quick-replies.module.scss +16 -0
  72. package/src/components/templates/quick-replies/quick-replies.tsx +44 -0
  73. package/src/components/templates/template-box/index.ts +2 -0
  74. package/src/components/templates/template-box/template-box-content.module.scss +13 -0
  75. package/src/components/templates/template-box/template-box-content.tsx +30 -0
  76. package/src/components/templates/template-box/template-box.module.scss +19 -0
  77. package/src/components/templates/template-box/template-box.tsx +48 -0
  78. package/src/components/templates/text-template/bot-typing-box.tsx +81 -0
  79. package/src/components/templates/text-template/bot-typing-placeholder.tsx +28 -0
  80. package/src/components/templates/text-template/index.ts +3 -0
  81. package/src/components/templates/text-template/text-template.module.scss +131 -0
  82. package/src/components/templates/text-template/text-template.tsx +90 -0
  83. package/src/components/templates/text-template/use-react-markdown-renderer.spec.tsx +758 -0
  84. package/src/components/templates/text-template/use-react-markdown-renderer.tsx +266 -0
  85. package/src/components/templates/time/index.ts +1 -0
  86. package/src/components/templates/time/time.module.scss +6 -0
  87. package/src/components/templates/time/time.tsx +34 -0
  88. package/src/context/asgard-app-initialization-context.tsx +154 -0
  89. package/src/context/asgard-service-context.tsx +139 -0
  90. package/src/context/asgard-template-context.tsx +83 -0
  91. package/src/context/asgard-theme-context.tsx +401 -0
  92. package/src/context/index.ts +4 -0
  93. package/src/hooks/index.ts +11 -0
  94. package/src/hooks/use-asgard-service-client.ts +68 -0
  95. package/src/hooks/use-channel.ts +154 -0
  96. package/src/hooks/use-debounce.ts +18 -0
  97. package/src/hooks/use-deep-compare-memo.ts +19 -0
  98. package/src/hooks/use-is-on-screen-keyboard-open.ts +43 -0
  99. package/src/hooks/use-on-screen-keyboard-scroll-fix.ts +15 -0
  100. package/src/hooks/use-prevent-over-scrolling.ts +77 -0
  101. package/src/hooks/use-resize-observer.tsx +27 -0
  102. package/src/hooks/use-update-vh.ts +30 -0
  103. package/src/hooks/use-viewport-size.ts +51 -0
  104. package/src/icons/add_a_photo.svg +3 -0
  105. package/src/icons/bot.svg +14 -0
  106. package/src/icons/close.svg +3 -0
  107. package/src/icons/distance.svg +3 -0
  108. package/src/icons/mic.svg +3 -0
  109. package/src/icons/photo_library.svg +3 -0
  110. package/src/icons/profile.svg +28 -0
  111. package/src/icons/refresh.svg +3 -0
  112. package/src/icons/send.svg +3 -0
  113. package/src/icons/stop.svg +22 -0
  114. package/src/icons/volume_up.svg +3 -0
  115. package/src/index.ts +4 -0
  116. package/src/models/bot-provider.ts +108 -0
  117. package/src/styles/_index.scss +1 -0
  118. package/src/styles/_styles.scss +11 -0
  119. package/src/styles/colors/_colors.scss +10 -0
  120. package/src/styles/colors/_index.scss +1 -0
  121. package/src/styles/colors/_variables.scss +72 -0
  122. package/src/styles/palette/_index.scss +1 -0
  123. package/src/styles/palette/_palette.scss +42 -0
  124. package/src/styles/palette/_variables.scss +40 -0
  125. package/src/styles/radius/_index.scss +1 -0
  126. package/src/styles/radius/_radius.scss +8 -0
  127. package/src/styles/radius/_variables.scss +12 -0
  128. package/src/styles/spacing/_index.scss +1 -0
  129. package/src/styles/spacing/_spacing.scss +8 -0
  130. package/src/styles/spacing/_variables.scss +13 -0
  131. package/src/styles/utils/_index.scss +1 -0
  132. package/src/styles/utils/_map.scss +22 -0
  133. package/src/test-setup.ts +1 -0
  134. package/src/utils/deep-merge.ts +26 -0
  135. package/src/utils/extractors.ts +20 -0
  136. package/src/utils/format-time.ts +8 -0
  137. package/src/utils/index.ts +1 -0
  138. package/src/utils/is.ts +72 -0
  139. package/src/utils/selectors.ts +7 -0
  140. package/src/utils/uri-validation.spec.ts +208 -0
  141. package/src/utils/uri-validation.ts +103 -0
  142. package/tsconfig.json +16 -0
  143. package/tsconfig.lib.json +63 -0
  144. package/tsconfig.spec.json +36 -0
  145. package/tsconfig.tsbuildinfo +1 -0
  146. package/vite.config.ts +63 -0
package/.babelrc ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "presets": [
3
+ [
4
+ "@nx/react/babel",
5
+ {
6
+ "runtime": "automatic",
7
+ "useBuiltIns": "usage"
8
+ }
9
+ ]
10
+ ],
11
+ "plugins": []
12
+ }
package/README.md CHANGED
@@ -94,6 +94,7 @@ export default App;
94
94
  **Important**: The `endpoint` configuration option is deprecated. Use `botProviderEndpoint` instead for simplified configuration.
95
95
 
96
96
  ### Before (Deprecated)
97
+
97
98
  ```javascript
98
99
  config: {
99
100
  apiKey: 'your-api-key',
@@ -103,15 +104,17 @@ config: {
103
104
  ```
104
105
 
105
106
  ### After (Recommended)
107
+
106
108
  ```javascript
107
109
  config: {
108
- apiKey: 'your-api-key',
110
+ apiKey: 'your-api-key',
109
111
  botProviderEndpoint: 'https://api.asgard-ai.com/ns/{namespace}/bot-provider/{botProviderId}',
110
112
  // SSE endpoint is automatically derived as: botProviderEndpoint + '/message/sse'
111
113
  }
112
114
  ```
113
115
 
114
116
  **Benefits:**
117
+
115
118
  - Simplified configuration with single endpoint
116
119
  - Reduced chance of configuration errors
117
120
  - Automatic endpoint derivation
@@ -229,13 +232,13 @@ export interface AsgardThemeContextValue {
229
232
  HintMessageTemplate: Partial<{ style: CSSProperties }>;
230
233
  ImageMessageTemplate: Partial<{ style: CSSProperties }>;
231
234
  ChartMessageTemplate: Partial<{ style: CSSProperties }>;
232
- ButtonMessageTemplate: Partial<{
235
+ ButtonMessageTemplate: Partial<{
233
236
  style: CSSProperties;
234
237
  button?: {
235
238
  style: CSSProperties;
236
239
  };
237
240
  }>;
238
- CarouselMessageTemplate: Partial<{
241
+ CarouselMessageTemplate: Partial<{
239
242
  style: CSSProperties;
240
243
  card: {
241
244
  style: CSSProperties;
@@ -396,29 +399,22 @@ The React package includes comprehensive tests using Vitest and React Testing Li
396
399
 
397
400
  ```sh
398
401
  # Run tests once
399
- npm test
400
- # or
401
402
  yarn test:react
402
403
 
403
404
  # Run tests in watch mode
404
- npm run test:watch
405
- # or
406
405
  yarn test:react:watch
407
406
 
408
407
  # Run tests with UI
409
- npm run test:ui
410
- # or
411
408
  yarn test:react:ui
412
409
 
413
410
  # Run tests with coverage
414
- npm run test:coverage
415
- # or
416
411
  yarn test:react:coverage
417
412
  ```
418
413
 
419
414
  ### Test Structure
420
415
 
421
416
  Tests are located alongside source files with `.spec.tsx` extensions:
417
+
422
418
  - `src/components/chatbot/chatbot.spec.tsx` - React component tests
423
419
  - Test environment: jsdom with React Testing Library
424
420
  - Setup file: `src/test-setup.ts` (includes jest-dom)
@@ -427,6 +423,7 @@ Tests are located alongside source files with `.spec.tsx` extensions:
427
423
  ### Writing Tests
428
424
 
429
425
  The package uses Vitest for testing with the following setup:
426
+
430
427
  - TypeScript support
431
428
  - jsdom environment for DOM APIs
432
429
  - React Testing Library for component testing
@@ -435,6 +432,7 @@ The package uses Vitest for testing with the following setup:
435
432
  - Coverage reporting with v8 provider
436
433
 
437
434
  Example test structure:
435
+
438
436
  ```javascript
439
437
  import { describe, it, expect } from 'vitest';
440
438
  import { render } from '@testing-library/react';
@@ -494,7 +492,7 @@ yarn watch:react
494
492
  yarn serve:react-demo
495
493
  ```
496
494
 
497
- Setup your npm release token:
495
+ Setup your npm registry token for yarn publishing:
498
496
 
499
497
  ```sh
500
498
  cd ~/
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '@asgard-js/core';
1
+ import { ConversationMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface ConversationMessageRendererProps {
@@ -1,6 +1,6 @@
1
1
  import { AsgardServiceContextValue, AsgardTemplateContextValue, AsgardServiceContextProviderProps } from '../../context';
2
2
  import { AsgardThemeContextValue } from '../../context/asgard-theme-context';
3
- import { ClientConfig, ConversationMessage } from '@asgard-js/core';
3
+ import { ClientConfig, ConversationMessage } from '../../../../core/src/index.ts';
4
4
  import { ReactNode, CSSProperties } from 'react';
5
5
 
6
6
  interface ChatbotProps extends AsgardTemplateContextValue {
@@ -1,5 +1,5 @@
1
1
  import { ReactNode } from 'react';
2
- import { ConversationBotMessage } from '@asgard-js/core';
2
+ import { ConversationBotMessage } from '../../../../../core/src/index.ts';
3
3
 
4
4
  interface ButtonTemplateProps {
5
5
  message: ConversationBotMessage;
@@ -1,4 +1,4 @@
1
- import { ButtonMessageTemplate, CarouselMessageTemplate } from '@asgard-js/core';
1
+ import { ButtonMessageTemplate, CarouselMessageTemplate } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
3
 
4
4
  interface CardProps {
@@ -1 +1 @@
1
- {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAGT,aAAa,EACd,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAMzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,MAAM,CAAC,EAAE;YACP,KAAK,CAAC,EAAE,aAAa,CAAC;SACvB,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CA2FhD"}
1
+ {"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/button-template/card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EAGT,aAAa,EACd,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAMzB,UAAU,SAAS;IACjB,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7E,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,aAAa,CAAC;QACtB,MAAM,CAAC,EAAE;YACP,KAAK,CAAC,EAAE,aAAa,CAAC;SACvB,CAAC;KACH,CAAC;CACH;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CA8FhD"}
@@ -1,4 +1,4 @@
1
- import { ConversationBotMessage } from '@asgard-js/core';
1
+ import { ConversationBotMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface CarouselTemplateProps {
@@ -1 +1 @@
1
- {"version":3,"file":"carousel-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/carousel-template/carousel-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAEL,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAKzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CA8BxE"}
1
+ {"version":3,"file":"carousel-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/carousel-template/carousel-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,OAAO,EAEL,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAKzB,UAAU,qBAAqB;IAC7B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,SAAS,CA8BxE"}
@@ -1,4 +1,4 @@
1
- import { ConversationBotMessage } from '@asgard-js/core';
1
+ import { ConversationBotMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface ChartTemplateProps {
@@ -1 +1 @@
1
- {"version":3,"file":"chart-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/chart-template/chart-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AASzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA2DlE"}
1
+ {"version":3,"file":"chart-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/chart-template/chart-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoC,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAE,sBAAsB,EAAwB,MAAM,iBAAiB,CAAC;AAQ/E,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA2DlE"}
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '@asgard-js/core';
1
+ import { ConversationMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface HintTemplateProps {
@@ -1,4 +1,4 @@
1
- import { ConversationBotMessage } from '@asgard-js/core';
1
+ import { ConversationBotMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface ImageTemplateProps {
@@ -1 +1 @@
1
- {"version":3,"file":"image-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/image-template/image-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAMzD,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA2ClE"}
1
+ {"version":3,"file":"image-template.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/image-template/image-template.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,OAAO,CAAC;AAI5C,OAAO,EAAE,sBAAsB,EAAwB,MAAM,iBAAiB,CAAC;AAK/E,UAAU,kBAAkB;IAC1B,OAAO,EAAE,sBAAsB,CAAC;CACjC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,SAAS,CA4ClE"}
@@ -1,4 +1,4 @@
1
- import { ConversationMessage } from '@asgard-js/core';
1
+ import { ConversationMessage } from '../../../../../core/src/index.ts';
2
2
  import { ReactNode } from 'react';
3
3
 
4
4
  interface TextTemplateProps {
@@ -1 +1 @@
1
- {"version":3,"file":"use-react-markdown-renderer.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/use-react-markdown-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AAMf,OAAO,0BAA0B,CAAC;AAKlC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAQD,eAAO,MAAM,cAAc,MAAM,CAAC;AAGlC,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAQnE;AAuHD,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,KAAK,SAAM,GACV,oBAAoB,CAqGtB"}
1
+ {"version":3,"file":"use-react-markdown-renderer.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/text-template/use-react-markdown-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAMV,MAAM,OAAO,CAAC;AAMf,OAAO,0BAA0B,CAAC;AAKlC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,SAAS,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAQD,eAAO,MAAM,cAAc,MAAM,CAAC;AAGlC,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAQnE;AAyHD,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,KAAK,SAAM,GACV,oBAAoB,CAqGtB"}
@@ -1,4 +1,4 @@
1
- import { ClientConfig } from '@asgard-js/core';
1
+ import { ClientConfig } from '../../../core/src/index.ts';
2
2
  import { default as React, PropsWithChildren, ReactNode } from 'react';
3
3
 
4
4
  type AsyncInitializers = {
@@ -1,6 +1,6 @@
1
1
  import { UseChannelProps, UseChannelReturn } from '../hooks';
2
2
  import { ForwardedRef, ReactNode, RefObject } from 'react';
3
- import { AsgardServiceClient, ClientConfig, ConversationMessage } from '@asgard-js/core';
3
+ import { AsgardServiceClient, ClientConfig, ConversationMessage } from '../../../core/src/index.ts';
4
4
 
5
5
  export interface AsgardServiceContextValue {
6
6
  avatar?: string;
@@ -1,4 +1,4 @@
1
- import { ConversationErrorMessage, FetchSsePayload } from '@asgard-js/core';
1
+ import { ConversationErrorMessage, FetchSsePayload } from '../../../core/src/index.ts';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
3
 
4
4
  export interface AsgardTemplateContextValue {
@@ -6,7 +6,7 @@ export interface AsgardTemplateContextValue {
6
6
  errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
7
7
  onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
8
8
  sse: {
9
- sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
9
+ sendMessage: (payload: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
10
10
  };
11
11
  }) => void;
12
12
  defaultLinkTarget?: '_blank' | '_self' | '_parent' | '_top';
@@ -17,7 +17,7 @@ interface AsgardTemplateContextProviderProps extends PropsWithChildren {
17
17
  errorMessageRenderer?: (message: ConversationErrorMessage) => ReactNode;
18
18
  onTemplateBtnClick?: (payload: Record<string, unknown>, { sse, }: {
19
19
  sse: {
20
- sendMessage: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
20
+ sendMessage: (payload: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
21
21
  };
22
22
  }) => void;
23
23
  defaultLinkTarget?: '_blank' | '_self' | '_parent' | '_top';
@@ -1 +1 @@
1
- {"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CAC7D;AAED,eAAO,MAAM,qBAAqB,qDAKhC,CAAC;AAEH,UAAU,kCAAmC,SAAQ,iBAAiB;IACpE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAC/C,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CAC7D;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,SAAS,CAcX;AAED,wBAAgB,wBAAwB,IAAI,0BAA0B,CAErE"}
1
+ {"version":3,"file":"asgard-template-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-template-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EAGV,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,KAC/E,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CAC7D;AAED,eAAO,MAAM,qBAAqB,qDAKhC,CAAC;AAEH,UAAU,kCAAmC,SAAQ,iBAAiB;IACpE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,SAAS,CAAC;IACxE,kBAAkB,CAAC,EAAE,CACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,EACE,GAAG,GACJ,EAAE;QACD,GAAG,EAAE;YACH,WAAW,EAAE,CACX,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,KAC/E,IAAI,CAAC;SACX,CAAC;KACH,KACE,IAAI,CAAC;IACV,iBAAiB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CAC7D;AAED,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,kCAAkC,GACxC,SAAS,CAwBX;AAED,wBAAgB,wBAAwB,IAAI,0BAA0B,CAErE"}
@@ -1,4 +1,4 @@
1
- import { ClientConfig, AsgardServiceClient } from '@asgard-js/core';
1
+ import { ClientConfig, AsgardServiceClient } from '../../../core/src/index.ts';
2
2
 
3
3
  interface UseAsgardServiceClientProps {
4
4
  config: ClientConfig;
@@ -1,8 +1,8 @@
1
- import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '@asgard-js/core';
1
+ import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '../../../core/src/index.ts';
2
2
 
3
3
  export interface UseChannelProps {
4
4
  defaultIsOpen?: boolean;
5
- resetPayload?: Pick<FetchSsePayload, 'text' | 'payload'>;
5
+ resetPayload?: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>;
6
6
  client: AsgardServiceClient | null;
7
7
  customChannelId: string;
8
8
  customMessageId?: string;
@@ -16,8 +16,8 @@ export interface UseChannelReturn {
16
16
  isResetting: boolean;
17
17
  isConnecting: boolean;
18
18
  conversation: Conversation | null;
19
- sendMessage?: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
20
- resetChannel?: (payload?: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
19
+ sendMessage?: (payload: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
20
+ resetChannel?: (payload?: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
21
21
  closeChannel?: () => void;
22
22
  }
23
23
  export declare function useChannel(props: UseChannelProps): UseChannelReturn;
@@ -1 +1 @@
1
- {"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,CACb,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,EAChC,OAAO,EAAE;QACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;KACnC,KACE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC3E,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC7E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAoHnE"}
1
+ {"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAGnB,YAAY,EACZ,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;IACzF,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,YAAY,CAAC,EAAE,CACb,QAAQ,EAAE,WAAW,CAAC,SAAS,CAAC,EAChC,OAAO,EAAE;QACP,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;KACnC,KACE,IAAI,CAAC;CACX;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI,CAAC;IAC3G,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7G,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAoHnE"}