@asgard-js/react 0.0.2 → 0.0.3-8.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 +523 -4
- package/dist/components/chatbot/chatbot-body/chatbot-body.d.ts.map +1 -0
- package/dist/components/{conversation-message-renderer → chatbot/chatbot-body}/conversation-message-renderer.d.ts +2 -2
- package/dist/components/chatbot/chatbot-body/conversation-message-renderer.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-body/index.d.ts +2 -0
- package/dist/components/chatbot/chatbot-body/index.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-container/chatbot-container.d.ts +10 -0
- package/dist/components/chatbot/chatbot-container/chatbot-container.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-container/chatbot-full-screen-container.d.ts +4 -0
- package/dist/components/chatbot/chatbot-container/chatbot-full-screen-container.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-footer/chatbot-footer.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-footer/index.d.ts +2 -0
- package/dist/components/chatbot/chatbot-footer/index.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts +10 -0
- package/dist/components/chatbot/chatbot-footer/speech-input-button.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-header/chatbot-header.d.ts +12 -0
- package/dist/components/chatbot/chatbot-header/chatbot-header.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot-header/index.d.ts +2 -0
- package/dist/components/chatbot/chatbot-header/index.d.ts.map +1 -0
- package/dist/components/chatbot/chatbot.d.ts +25 -8
- package/dist/components/chatbot/chatbot.d.ts.map +1 -1
- package/dist/components/chatbot/profile-icon.d.ts +5 -1
- package/dist/components/chatbot/profile-icon.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/templates/avatar/avatar.d.ts +5 -1
- package/dist/components/templates/avatar/avatar.d.ts.map +1 -1
- package/dist/components/templates/button-template/button-template.d.ts +2 -2
- package/dist/components/templates/button-template/button-template.d.ts.map +1 -1
- package/dist/components/templates/button-template/card.d.ts +8 -2
- package/dist/components/templates/button-template/card.d.ts.map +1 -1
- package/dist/components/templates/carousel-template/carousel-template.d.ts +2 -2
- package/dist/components/templates/carousel-template/carousel-template.d.ts.map +1 -1
- package/dist/components/templates/chart-template/chart-template.d.ts +9 -0
- package/dist/components/templates/chart-template/chart-template.d.ts.map +1 -0
- package/dist/components/templates/chart-template/index.d.ts +2 -0
- package/dist/components/templates/chart-template/index.d.ts.map +1 -0
- package/dist/components/templates/hint-template/hint-template.d.ts +2 -2
- package/dist/components/templates/hint-template/hint-template.d.ts.map +1 -1
- package/dist/components/templates/image-template/image-template.d.ts +9 -0
- package/dist/components/templates/image-template/image-template.d.ts.map +1 -0
- package/dist/components/templates/image-template/index.d.ts +2 -0
- package/dist/components/templates/image-template/index.d.ts.map +1 -0
- package/dist/components/templates/index.d.ts +2 -1
- package/dist/components/templates/index.d.ts.map +1 -1
- package/dist/components/templates/quick-replies/quick-replies.d.ts.map +1 -1
- package/dist/components/templates/template-box/template-box-content.d.ts.map +1 -1
- package/dist/components/templates/template-box/template-box.d.ts +5 -1
- package/dist/components/templates/template-box/template-box.d.ts.map +1 -1
- package/dist/components/templates/{bot-typing-box → text-template}/bot-typing-box.d.ts +2 -2
- package/dist/components/templates/text-template/bot-typing-box.d.ts.map +1 -0
- package/dist/components/templates/text-template/bot-typing-placeholder.d.ts +8 -0
- package/dist/components/templates/text-template/bot-typing-placeholder.d.ts.map +1 -0
- package/dist/components/templates/text-template/index.d.ts +2 -0
- package/dist/components/templates/text-template/index.d.ts.map +1 -1
- package/dist/components/templates/text-template/text-template.d.ts +2 -2
- package/dist/components/templates/text-template/text-template.d.ts.map +1 -1
- package/dist/components/templates/time/time.d.ts.map +1 -1
- package/dist/context/asgard-app-initialization-context.d.ts +54 -0
- package/dist/context/asgard-app-initialization-context.d.ts.map +1 -0
- package/dist/context/asgard-service-context.d.ts +22 -13
- package/dist/context/asgard-service-context.d.ts.map +1 -1
- package/dist/context/asgard-template-context.d.ts +28 -0
- package/dist/context/asgard-template-context.d.ts.map +1 -0
- package/dist/context/asgard-theme-context.d.ts +127 -0
- package/dist/context/asgard-theme-context.d.ts.map +1 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/use-asgard-service-client.d.ts +1 -1
- package/dist/hooks/use-asgard-service-client.d.ts.map +1 -1
- package/dist/hooks/use-channel.d.ts +15 -10
- package/dist/hooks/use-channel.d.ts.map +1 -1
- package/dist/hooks/use-deep-compare-memo.d.ts +7 -0
- package/dist/hooks/use-deep-compare-memo.d.ts.map +1 -0
- package/dist/hooks/use-is-on-screen-keyboard-open.d.ts +2 -0
- package/dist/hooks/use-is-on-screen-keyboard-open.d.ts.map +1 -0
- package/dist/hooks/use-on-screen-keyboard-scroll-fix.d.ts +2 -0
- package/dist/hooks/use-on-screen-keyboard-scroll-fix.d.ts.map +1 -0
- package/dist/hooks/use-prevent-over-scrolling.d.ts +4 -0
- package/dist/hooks/use-prevent-over-scrolling.d.ts.map +1 -0
- package/dist/hooks/use-react-markdown-renderer.d.ts +11 -0
- package/dist/hooks/use-react-markdown-renderer.d.ts.map +1 -0
- package/dist/hooks/use-resize-observer.d.ts +9 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -0
- package/dist/hooks/use-update-vh.d.ts +4 -0
- package/dist/hooks/use-update-vh.d.ts.map +1 -0
- package/dist/hooks/use-viewport-size.d.ts +6 -0
- package/dist/hooks/use-viewport-size.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +77820 -503
- package/dist/models/bot-provider.d.ts +26 -0
- package/dist/models/bot-provider.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/dist/test-setup.d.ts +2 -0
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/utils/deep-merge.d.ts +3 -0
- package/dist/utils/deep-merge.d.ts.map +1 -0
- package/dist/utils/extractors.d.ts +2 -0
- package/dist/utils/extractors.d.ts.map +1 -0
- package/dist/utils/is.d.ts +8 -0
- package/dist/utils/is.d.ts.map +1 -0
- package/dist/utils/selectors.d.ts +4 -0
- package/dist/utils/selectors.d.ts.map +1 -0
- package/dist/utils/uri-validation.d.ts +20 -0
- package/dist/utils/uri-validation.d.ts.map +1 -0
- package/eslint.config.cjs +12 -0
- package/package.json +39 -3
- 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 +121 -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/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 +145 -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-react-markdown-renderer.tsx +266 -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/dist/components/chatbot/chatbot-body.d.ts.map +0 -1
- package/dist/components/chatbot/chatbot-footer.d.ts.map +0 -1
- package/dist/components/chatbot/chatbot-header.d.ts +0 -8
- package/dist/components/chatbot/chatbot-header.d.ts.map +0 -1
- package/dist/components/conversation-message-renderer/conversation-message-renderer.d.ts.map +0 -1
- package/dist/components/conversation-message-renderer/index.d.ts +0 -2
- package/dist/components/conversation-message-renderer/index.d.ts.map +0 -1
- package/dist/components/templates/bot-typing-box/bot-typing-box.d.ts.map +0 -1
- package/dist/components/templates/bot-typing-box/index.d.ts +0 -2
- package/dist/components/templates/bot-typing-box/index.d.ts.map +0 -1
- package/dist/components/templates/bot-typing-box/resize-observer-box.d.ts +0 -9
- package/dist/components/templates/bot-typing-box/resize-observer-box.d.ts.map +0 -1
- /package/dist/components/chatbot/{chatbot-body.d.ts → chatbot-body/chatbot-body.d.ts} +0 -0
- /package/dist/components/chatbot/{chatbot-footer.d.ts → chatbot-footer/chatbot-footer.d.ts} +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { CSSProperties, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface AsgardThemeContextValue {
|
|
4
|
+
chatbot: Pick<CSSProperties, 'width' | 'height' | 'maxWidth' | 'minWidth' | 'maxHeight' | 'minHeight' | 'backgroundColor' | 'borderColor' | 'borderRadius'> & {
|
|
5
|
+
contentMaxWidth?: CSSProperties['maxWidth'];
|
|
6
|
+
backgroundColor?: CSSProperties['backgroundColor'];
|
|
7
|
+
borderColor?: CSSProperties['borderColor'];
|
|
8
|
+
inactiveColor?: CSSProperties['color'];
|
|
9
|
+
primaryComponent?: {
|
|
10
|
+
mainColor?: CSSProperties['color'];
|
|
11
|
+
secondaryColor?: CSSProperties['color'];
|
|
12
|
+
};
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
header?: Partial<{
|
|
15
|
+
style: CSSProperties;
|
|
16
|
+
title: {
|
|
17
|
+
style: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
actionButton?: {
|
|
20
|
+
style: CSSProperties;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
body?: Partial<{
|
|
24
|
+
style: CSSProperties;
|
|
25
|
+
}>;
|
|
26
|
+
footer?: Partial<{
|
|
27
|
+
style: CSSProperties;
|
|
28
|
+
textArea: {
|
|
29
|
+
style: CSSProperties;
|
|
30
|
+
'::placeholder': CSSProperties;
|
|
31
|
+
};
|
|
32
|
+
submitButton: {
|
|
33
|
+
style: CSSProperties;
|
|
34
|
+
};
|
|
35
|
+
speechInputButton: {
|
|
36
|
+
style: CSSProperties;
|
|
37
|
+
};
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
botMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
41
|
+
userMessage: Pick<CSSProperties, 'color' | 'backgroundColor'>;
|
|
42
|
+
template?: Partial<{
|
|
43
|
+
/**
|
|
44
|
+
* first level for common/shared properties.
|
|
45
|
+
* Check MessageTemplate type for more details (packages/core/src/types/sse-response.ts).
|
|
46
|
+
*/
|
|
47
|
+
quickReplies?: Partial<{
|
|
48
|
+
style: CSSProperties;
|
|
49
|
+
button: {
|
|
50
|
+
style: CSSProperties;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
time?: Partial<{
|
|
54
|
+
style: CSSProperties;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
58
|
+
*/
|
|
59
|
+
TextMessageTemplate: Partial<{
|
|
60
|
+
style: CSSProperties;
|
|
61
|
+
}>;
|
|
62
|
+
/**
|
|
63
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
64
|
+
*/
|
|
65
|
+
HintMessageTemplate: Partial<{
|
|
66
|
+
style: CSSProperties;
|
|
67
|
+
}>;
|
|
68
|
+
/**
|
|
69
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
70
|
+
*/
|
|
71
|
+
ImageMessageTemplate: Partial<{
|
|
72
|
+
style: CSSProperties;
|
|
73
|
+
}>;
|
|
74
|
+
/**
|
|
75
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
76
|
+
*/
|
|
77
|
+
VideoMessageTemplate: Partial<{
|
|
78
|
+
style: CSSProperties;
|
|
79
|
+
}>;
|
|
80
|
+
/**
|
|
81
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
82
|
+
*/
|
|
83
|
+
AudioMessageTemplate: Partial<{
|
|
84
|
+
style: CSSProperties;
|
|
85
|
+
}>;
|
|
86
|
+
/**
|
|
87
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
88
|
+
*/
|
|
89
|
+
LocationMessageTemplate: Partial<{
|
|
90
|
+
style: CSSProperties;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
94
|
+
*/
|
|
95
|
+
ChartMessageTemplate: Partial<{
|
|
96
|
+
style: CSSProperties;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
100
|
+
*/
|
|
101
|
+
ButtonMessageTemplate: Partial<{
|
|
102
|
+
style: CSSProperties;
|
|
103
|
+
button?: {
|
|
104
|
+
style: CSSProperties;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
/**
|
|
108
|
+
* TBD: Fill the necessary properties based on the requirements.
|
|
109
|
+
*/
|
|
110
|
+
CarouselMessageTemplate: Partial<{
|
|
111
|
+
style: CSSProperties;
|
|
112
|
+
card: {
|
|
113
|
+
style: CSSProperties;
|
|
114
|
+
button?: {
|
|
115
|
+
style: CSSProperties;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
}>;
|
|
119
|
+
}>;
|
|
120
|
+
}
|
|
121
|
+
export declare const defaultAsgardThemeContextValue: AsgardThemeContextValue;
|
|
122
|
+
export declare const AsgardThemeContext: import('react').Context<AsgardThemeContextValue>;
|
|
123
|
+
export declare function AsgardThemeContextProvider(props: PropsWithChildren<{
|
|
124
|
+
theme?: Partial<AsgardThemeContextValue>;
|
|
125
|
+
}>): ReactNode;
|
|
126
|
+
export declare function useAsgardThemeContext(): AsgardThemeContextValue;
|
|
127
|
+
//# sourceMappingURL=asgard-theme-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asgard-theme-context.d.ts","sourceRoot":"","sources":["../../src/context/asgard-theme-context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,iBAAiB,EACjB,SAAS,EAIV,MAAM,OAAO,CAAC;AAOf,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,IAAI,CACX,aAAa,EACX,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,WAAW,GACX,WAAW,GACX,iBAAiB,GACjB,aAAa,GACb,cAAc,CACjB,GAAG;QACF,eAAe,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC5C,eAAe,CAAC,EAAE,aAAa,CAAC,iBAAiB,CAAC,CAAC;QACnD,WAAW,CAAC,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;QAC3C,aAAa,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;QACvC,gBAAgB,CAAC,EAAE;YACjB,SAAS,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;YACnC,cAAc,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;SACzC,CAAC;QACF,KAAK,CAAC,EAAE,aAAa,CAAC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0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC"}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export * from './use-asgard-service-client';
|
|
2
2
|
export * from './use-channel';
|
|
3
3
|
export * from './use-debounce';
|
|
4
|
+
export * from './use-viewport-size';
|
|
5
|
+
export * from './use-is-on-screen-keyboard-open';
|
|
6
|
+
export * from './use-on-screen-keyboard-scroll-fix';
|
|
7
|
+
export * from './use-prevent-over-scrolling';
|
|
8
|
+
export * from './use-update-vh';
|
|
9
|
+
export * from './use-resize-observer';
|
|
10
|
+
export * from './use-deep-compare-memo';
|
|
11
|
+
export * from './use-react-markdown-renderer';
|
|
4
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,+BAA+B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-asgard-service-client.d.ts","sourceRoot":"","sources":["../../src/hooks/use-asgard-service-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"use-asgard-service-client.d.ts","sourceRoot":"","sources":["../../src/hooks/use-asgard-service-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAa,MAAM,iBAAiB,CAAC;AAG/E,UAAU,2BAA2B;IACnC,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,GACjC,mBAAmB,GAAG,IAAI,CA0D5B"}
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import { AsgardServiceClient,
|
|
1
|
+
import { AsgardServiceClient, Conversation, ConversationMessage, EventType, FetchSsePayload, SseResponse } from '../../../core/src/index.ts';
|
|
2
2
|
|
|
3
|
-
interface UseChannelProps {
|
|
3
|
+
export interface UseChannelProps {
|
|
4
|
+
defaultIsOpen?: boolean;
|
|
5
|
+
resetPayload?: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>;
|
|
4
6
|
client: AsgardServiceClient | null;
|
|
5
7
|
customChannelId: string;
|
|
8
|
+
customMessageId?: string;
|
|
6
9
|
initMessages?: ConversationMessage[];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
onResetChannelInit?: (event: SseResponse<EventType.INIT>) => void;
|
|
10
|
+
onSseMessage?: (response: SseResponse<EventType>, context: {
|
|
11
|
+
conversation: Conversation | null;
|
|
12
|
+
}) => void;
|
|
11
13
|
}
|
|
12
14
|
export interface UseChannelReturn {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
isResetting: boolean;
|
|
17
|
+
isConnecting: boolean;
|
|
18
|
+
conversation: Conversation | null;
|
|
19
|
+
sendMessage?: (payload: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
|
|
20
|
+
resetChannel?: (payload?: Pick<FetchSsePayload, 'text'> & Partial<Pick<FetchSsePayload, 'payload'>>) => void;
|
|
21
|
+
closeChannel?: () => void;
|
|
16
22
|
}
|
|
17
23
|
export declare function useChannel(props: UseChannelProps): UseChannelReturn;
|
|
18
|
-
export {};
|
|
19
24
|
//# sourceMappingURL=use-channel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-channel.d.ts","sourceRoot":"","sources":["../../src/hooks/use-channel.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,
|
|
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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useDeepCompareMemo: React hook that only recomputes the value when deps deeply change.
|
|
3
|
+
* @param factory - function to create the value
|
|
4
|
+
* @param deps - dependency array (deep compared)
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDeepCompareMemo<T>(factory: () => T, deps: unknown[]): T;
|
|
7
|
+
//# sourceMappingURL=use-deep-compare-memo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deep-compare-memo.d.ts","sourceRoot":"","sources":["../../src/hooks/use-deep-compare-memo.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,CAU1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-on-screen-keyboard-open.d.ts","sourceRoot":"","sources":["../../src/hooks/use-is-on-screen-keyboard-open.ts"],"names":[],"mappings":"AAYA,wBAAgB,yBAAyB,IAAI,OAAO,CA8BnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-on-screen-keyboard-scroll-fix.d.ts","sourceRoot":"","sources":["../../src/hooks/use-on-screen-keyboard-scroll-fix.ts"],"names":[],"mappings":"AAEA,wBAAgB,4BAA4B,IAAI,IAAI,CAYnD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-prevent-over-scrolling.d.ts","sourceRoot":"","sources":["../../src/hooks/use-prevent-over-scrolling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAiB7C,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CA2D5E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface MarkdownRenderResult {
|
|
4
|
+
htmlBlocks: ReactNode;
|
|
5
|
+
lastTypingText: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const MAX_CACHE_SIZE = 100;
|
|
8
|
+
export declare function manageCacheSize(cache: Map<string, ReactNode>): void;
|
|
9
|
+
export declare function useMarkdownRenderer(markdownText: string, delay?: number): MarkdownRenderResult;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=use-react-markdown-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-react-markdown-renderer.d.ts","sourceRoot":"","sources":["../../src/hooks/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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
interface UseResizeObserverProps {
|
|
4
|
+
ref: RefObject<HTMLDivElement>;
|
|
5
|
+
onResize: (width: number, height: number) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useResizeObserver(props: UseResizeObserverProps): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=use-resize-observer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resize-observer.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resize-observer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C,UAAU,sBAAsB;IAC9B,GAAG,EAAE,SAAS,CAAC,cAAc,CAAC,CAAC;IAC/B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,IAAI,CAmBrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-vh.d.ts","sourceRoot":"","sources":["../../src/hooks/use-update-vh.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA2C,MAAM,OAAO,CAAC;AAK3E,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,cAAc,CAAC,GAAG,IAAI,CAwBhE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-viewport-size.d.ts","sourceRoot":"","sources":["../../src/hooks/use-viewport-size.ts"],"names":[],"mappings":"AAKA,KAAK,KAAK,GAAG,MAAM,CAAC;AACpB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAQ5B,wBAAgB,eAAe,IAAI,IAAI,GAAG,SAAS,CAmClD"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,uCAAuC,CAAC;AAC/C,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|