@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.
- package/.babelrc +12 -0
- package/README.md +10 -12
- package/dist/components/chatbot/chatbot-body/conversation-message-renderer.d.ts +1 -1
- package/dist/components/chatbot/chatbot.d.ts +1 -1
- package/dist/components/templates/button-template/button-template.d.ts +1 -1
- package/dist/components/templates/button-template/card.d.ts +1 -1
- package/dist/components/templates/button-template/card.d.ts.map +1 -1
- package/dist/components/templates/carousel-template/carousel-template.d.ts +1 -1
- package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
- package/dist/components/templates/chart-template/chart-template.d.ts +1 -1
- package/dist/components/templates/chart-template/chart-template.d.ts.map +1 -1
- package/dist/components/templates/hint-template/hint-template.d.ts +1 -1
- package/dist/components/templates/image-template/image-template.d.ts +1 -1
- package/dist/components/templates/image-template/image-template.d.ts.map +1 -1
- package/dist/components/templates/text-template/text-template.d.ts +1 -1
- package/dist/components/templates/text-template/use-react-markdown-renderer.d.ts.map +1 -1
- package/dist/context/asgard-app-initialization-context.d.ts +1 -1
- package/dist/context/asgard-service-context.d.ts +1 -1
- package/dist/context/asgard-template-context.d.ts +3 -3
- package/dist/context/asgard-template-context.d.ts.map +1 -1
- package/dist/hooks/use-asgard-service-client.d.ts +1 -1
- package/dist/hooks/use-channel.d.ts +4 -4
- package/dist/hooks/use-channel.d.ts.map +1 -1
- package/dist/index.js +46361 -9681
- package/dist/models/bot-provider.d.ts +1 -1
- package/dist/utils/deep-merge.d.ts +1 -1
- package/dist/utils/deep-merge.d.ts.map +1 -1
- package/eslint.config.cjs +12 -0
- package/package.json +9 -7
- package/src/components/chatbot/chatbot-body/chatbot-body.module.scss +13 -0
- package/src/components/chatbot/chatbot-body/chatbot-body.tsx +45 -0
- package/src/components/chatbot/chatbot-body/conversation-message-renderer.tsx +55 -0
- package/src/components/chatbot/chatbot-body/index.ts +1 -0
- package/src/components/chatbot/chatbot-container/chatbot-container.module.scss +41 -0
- package/src/components/chatbot/chatbot-container/chatbot-container.tsx +49 -0
- package/src/components/chatbot/chatbot-container/chatbot-full-screen-container.tsx +54 -0
- package/src/components/chatbot/chatbot-footer/chatbot-footer.module.scss +67 -0
- package/src/components/chatbot/chatbot-footer/chatbot-footer.tsx +140 -0
- package/src/components/chatbot/chatbot-footer/index.ts +1 -0
- package/src/components/chatbot/chatbot-footer/speech-input-button.tsx +132 -0
- package/src/components/chatbot/chatbot-header/chatbot-header.module.scss +48 -0
- package/src/components/chatbot/chatbot-header/chatbot-header.tsx +98 -0
- package/src/components/chatbot/chatbot-header/index.ts +1 -0
- package/src/components/chatbot/chatbot.spec.tsx +8 -0
- package/src/components/chatbot/chatbot.tsx +118 -0
- package/src/components/chatbot/profile-icon.tsx +26 -0
- package/src/components/index.ts +2 -0
- package/src/components/templates/avatar/avatar.module.scss +6 -0
- package/src/components/templates/avatar/avatar.tsx +28 -0
- package/src/components/templates/avatar/index.ts +1 -0
- package/src/components/templates/button-template/button-template.module.scss +0 -0
- package/src/components/templates/button-template/button-template.tsx +45 -0
- package/src/components/templates/button-template/card.module.scss +58 -0
- package/src/components/templates/button-template/card.spec.tsx +213 -0
- package/src/components/templates/button-template/card.tsx +123 -0
- package/src/components/templates/button-template/index.ts +1 -0
- package/src/components/templates/carousel-template/carousel-template.module.scss +15 -0
- package/src/components/templates/carousel-template/carousel-template.tsx +49 -0
- package/src/components/templates/carousel-template/index.ts +1 -0
- package/src/components/templates/chart-template/chart-template.module.scss +52 -0
- package/src/components/templates/chart-template/chart-template.tsx +75 -0
- package/src/components/templates/chart-template/index.ts +1 -0
- package/src/components/templates/hint-template/hint-template.module.scss +39 -0
- package/src/components/templates/hint-template/hint-template.tsx +71 -0
- package/src/components/templates/hint-template/index.ts +1 -0
- package/src/components/templates/image-template/image-template.module.scss +67 -0
- package/src/components/templates/image-template/image-template.tsx +58 -0
- package/src/components/templates/image-template/index.ts +1 -0
- package/src/components/templates/index.ts +10 -0
- package/src/components/templates/quick-replies/index.ts +1 -0
- package/src/components/templates/quick-replies/quick-replies.module.scss +16 -0
- package/src/components/templates/quick-replies/quick-replies.tsx +44 -0
- package/src/components/templates/template-box/index.ts +2 -0
- package/src/components/templates/template-box/template-box-content.module.scss +13 -0
- package/src/components/templates/template-box/template-box-content.tsx +30 -0
- package/src/components/templates/template-box/template-box.module.scss +19 -0
- package/src/components/templates/template-box/template-box.tsx +48 -0
- package/src/components/templates/text-template/bot-typing-box.tsx +81 -0
- package/src/components/templates/text-template/bot-typing-placeholder.tsx +28 -0
- package/src/components/templates/text-template/index.ts +3 -0
- package/src/components/templates/text-template/text-template.module.scss +131 -0
- package/src/components/templates/text-template/text-template.tsx +90 -0
- package/src/components/templates/text-template/use-react-markdown-renderer.spec.tsx +758 -0
- package/src/components/templates/text-template/use-react-markdown-renderer.tsx +266 -0
- package/src/components/templates/time/index.ts +1 -0
- package/src/components/templates/time/time.module.scss +6 -0
- package/src/components/templates/time/time.tsx +34 -0
- package/src/context/asgard-app-initialization-context.tsx +154 -0
- package/src/context/asgard-service-context.tsx +139 -0
- package/src/context/asgard-template-context.tsx +83 -0
- package/src/context/asgard-theme-context.tsx +401 -0
- package/src/context/index.ts +4 -0
- package/src/hooks/index.ts +11 -0
- package/src/hooks/use-asgard-service-client.ts +68 -0
- package/src/hooks/use-channel.ts +154 -0
- package/src/hooks/use-debounce.ts +18 -0
- package/src/hooks/use-deep-compare-memo.ts +19 -0
- package/src/hooks/use-is-on-screen-keyboard-open.ts +43 -0
- package/src/hooks/use-on-screen-keyboard-scroll-fix.ts +15 -0
- package/src/hooks/use-prevent-over-scrolling.ts +77 -0
- package/src/hooks/use-resize-observer.tsx +27 -0
- package/src/hooks/use-update-vh.ts +30 -0
- package/src/hooks/use-viewport-size.ts +51 -0
- package/src/icons/add_a_photo.svg +3 -0
- package/src/icons/bot.svg +14 -0
- package/src/icons/close.svg +3 -0
- package/src/icons/distance.svg +3 -0
- package/src/icons/mic.svg +3 -0
- package/src/icons/photo_library.svg +3 -0
- package/src/icons/profile.svg +28 -0
- package/src/icons/refresh.svg +3 -0
- package/src/icons/send.svg +3 -0
- package/src/icons/stop.svg +22 -0
- package/src/icons/volume_up.svg +3 -0
- package/src/index.ts +4 -0
- package/src/models/bot-provider.ts +108 -0
- package/src/styles/_index.scss +1 -0
- package/src/styles/_styles.scss +11 -0
- package/src/styles/colors/_colors.scss +10 -0
- package/src/styles/colors/_index.scss +1 -0
- package/src/styles/colors/_variables.scss +72 -0
- package/src/styles/palette/_index.scss +1 -0
- package/src/styles/palette/_palette.scss +42 -0
- package/src/styles/palette/_variables.scss +40 -0
- package/src/styles/radius/_index.scss +1 -0
- package/src/styles/radius/_radius.scss +8 -0
- package/src/styles/radius/_variables.scss +12 -0
- package/src/styles/spacing/_index.scss +1 -0
- package/src/styles/spacing/_spacing.scss +8 -0
- package/src/styles/spacing/_variables.scss +13 -0
- package/src/styles/utils/_index.scss +1 -0
- package/src/styles/utils/_map.scss +22 -0
- package/src/test-setup.ts +1 -0
- package/src/utils/deep-merge.ts +26 -0
- package/src/utils/extractors.ts +20 -0
- package/src/utils/format-time.ts +8 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/is.ts +72 -0
- package/src/utils/selectors.ts +7 -0
- package/src/utils/uri-validation.spec.ts +208 -0
- package/src/utils/uri-validation.ts +103 -0
- package/tsconfig.json +16 -0
- package/tsconfig.lib.json +63 -0
- package/tsconfig.spec.json +36 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vite.config.ts +63 -0
package/.babelrc
ADDED
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
|
|
495
|
+
Setup your npm registry token for yarn publishing:
|
|
498
496
|
|
|
499
497
|
```sh
|
|
500
498
|
cd ~/
|
|
@@ -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 '
|
|
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 +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,
|
|
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 +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,
|
|
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 +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,
|
|
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 +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,
|
|
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 +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;
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { UseChannelProps, UseChannelReturn } from '../hooks';
|
|
2
2
|
import { ForwardedRef, ReactNode, RefObject } from 'react';
|
|
3
|
-
import { AsgardServiceClient, ClientConfig, ConversationMessage } from '
|
|
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 '
|
|
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'
|
|
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'
|
|
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/
|
|
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,8 +1,8 @@
|
|
|
1
|
-
import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '
|
|
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'
|
|
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'
|
|
20
|
-
resetChannel?: (payload?: Pick<FetchSsePayload, 'text'
|
|
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;
|
|
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"}
|