@botonic/react 0.22.0-alpha.2 → 0.22.0-beta.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/lib/cjs/components/index-types.d.ts +174 -0
- package/lib/cjs/components/index-types.js +17 -0
- package/lib/cjs/components/index-types.js.map +1 -0
- package/lib/cjs/components/index.d.ts +22 -20
- package/lib/cjs/components/index.js +4 -1
- package/lib/cjs/components/index.js.map +1 -1
- package/lib/cjs/components/multichannel/index-types.d.ts +45 -0
- package/lib/cjs/components/multichannel/index-types.js +3 -0
- package/lib/cjs/components/multichannel/index-types.js.map +1 -0
- package/lib/cjs/components/multichannel/index.d.ts +8 -3
- package/lib/cjs/components/multichannel/index.js +2 -0
- package/lib/cjs/components/multichannel/index.js.map +1 -1
- package/lib/cjs/contexts.d.ts +2 -3
- package/lib/cjs/contexts.js +3 -4
- package/lib/cjs/contexts.js.map +1 -1
- package/lib/cjs/index-types.d.ts +94 -0
- package/lib/cjs/index-types.js +12 -0
- package/lib/cjs/index-types.js.map +1 -0
- package/lib/cjs/index.d.ts +8 -10
- package/lib/cjs/index.js +5 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/webchat/index-types.d.ts +55 -0
- package/lib/cjs/webchat/index-types.js +3 -0
- package/lib/cjs/webchat/index-types.js.map +1 -0
- package/lib/cjs/webchat/index.d.ts +4 -6
- package/lib/cjs/webchat/index.js +3 -3
- package/lib/cjs/webchat/index.js.map +1 -1
- package/lib/esm/components/carousel.d.ts +2 -1
- package/lib/esm/components/index-types.d.ts +174 -0
- package/lib/esm/components/index-types.js +16 -0
- package/lib/esm/components/index-types.js.map +1 -0
- package/lib/esm/components/index.d.ts +22 -19
- package/lib/esm/components/index.js +2 -0
- package/lib/esm/components/index.js.map +1 -1
- package/lib/esm/components/multichannel/index-types.d.ts +45 -0
- package/lib/esm/components/multichannel/index-types.js +2 -0
- package/lib/esm/components/multichannel/index-types.js.map +1 -0
- package/lib/esm/components/multichannel/index.d.ts +8 -3
- package/lib/esm/components/multichannel/index.js +1 -0
- package/lib/esm/components/multichannel/index.js.map +1 -1
- package/lib/esm/contexts.d.ts +2 -3
- package/lib/esm/contexts.js +3 -3
- package/lib/esm/contexts.js.map +1 -1
- package/lib/esm/index-types.d.ts +94 -0
- package/lib/esm/index-types.js +9 -0
- package/lib/esm/index-types.js.map +1 -0
- package/lib/esm/index.d.ts +8 -9
- package/lib/esm/index.js +4 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/message-utils.d.ts +2 -1
- package/lib/esm/node-app.d.ts +3 -3
- package/lib/esm/react-bot.d.ts +2 -1
- package/lib/esm/webchat/index-types.d.ts +55 -0
- package/lib/esm/webchat/index-types.js +2 -0
- package/lib/esm/webchat/index-types.js.map +1 -0
- package/lib/esm/webchat/index.d.ts +4 -6
- package/lib/esm/webchat/index.js +2 -3
- package/lib/esm/webchat/index.js.map +1 -1
- package/lib/esm/webchat-app.d.ts +4 -3
- package/package.json +1 -1
- package/src/components/{index.d.ts → index-types.ts} +22 -43
- package/src/components/{index.js → index.ts} +2 -0
- package/src/components/multichannel/{index.d.ts → index-types.ts} +1 -10
- package/src/components/multichannel/{index.js → index.ts} +2 -0
- package/src/contexts.jsx +3 -3
- package/src/index-types.ts +186 -0
- package/src/{index.js → index.ts} +4 -3
- package/src/webchat/{index.d.ts → index-types.ts} +5 -10
- package/src/webchat/{index.js → index.ts} +3 -3
- package/src/index.d.ts +0 -238
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export { Webchat } from "./webchat";
|
|
6
|
-
export { WebchatDev } from "./webchat-dev";
|
|
1
|
+
export { Webchat } from './webchat';
|
|
2
|
+
export { WebchatDev } from './webchat-dev';
|
|
3
|
+
export declare function getBotonicApp(): any;
|
|
4
|
+
export * from './index-types';
|
package/lib/cjs/webchat/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getBotonicApp = exports.WebchatDev = exports.Webchat = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// @ts-nocheck
|
|
4
6
|
var webchat_1 = require("./webchat");
|
|
5
7
|
Object.defineProperty(exports, "Webchat", { enumerable: true, get: function () { return webchat_1.Webchat; } });
|
|
6
8
|
var webchat_dev_1 = require("./webchat-dev");
|
|
7
9
|
Object.defineProperty(exports, "WebchatDev", { enumerable: true, get: function () { return webchat_dev_1.WebchatDev; } });
|
|
8
|
-
/**
|
|
9
|
-
* @returns {WebChatApp}
|
|
10
|
-
*/
|
|
11
10
|
function getBotonicApp() {
|
|
12
11
|
// Botonic is exported from your bot
|
|
13
12
|
// eslint-disable-next-line no-undef
|
|
14
13
|
return Botonic;
|
|
15
14
|
}
|
|
16
15
|
exports.getBotonicApp = getBotonicApp;
|
|
16
|
+
tslib_1.__exportStar(require("./index-types"), exports);
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["webchat/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["webchat/index.ts"],"names":[],"mappings":";;;;AAAA,cAAc;AACd,qCAAmC;AAA1B,kGAAA,OAAO,OAAA;AAChB,6CAA0C;AAAjC,yGAAA,UAAU,OAAA;AAEnB,SAAgB,aAAa;IAC3B,oCAAoC;IACpC,oCAAoC;IACpC,OAAO,OAAO,CAAA;AAChB,CAAC;AAJD,sCAIC;AAED,wDAA6B"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CoverComponentProps } from '../webchat/index-types';
|
|
3
|
+
export type MessageType = 'audio' | 'buttonmessage' | 'carousel' | 'custom' | 'document' | 'image' | 'location' | 'text' | 'video';
|
|
4
|
+
export interface MessageProps {
|
|
5
|
+
blob?: boolean;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
delay?: number;
|
|
8
|
+
enabletimestamps?: boolean;
|
|
9
|
+
from?: 'user' | 'bot';
|
|
10
|
+
json?: Record<string, unknown>;
|
|
11
|
+
style?: Record<string, unknown>;
|
|
12
|
+
type?: MessageType;
|
|
13
|
+
typing?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface TextProps extends MessageProps {
|
|
16
|
+
markdown?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface Webview {
|
|
19
|
+
name: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ButtonProps {
|
|
22
|
+
params?: any;
|
|
23
|
+
path?: string;
|
|
24
|
+
payload?: string;
|
|
25
|
+
target?: string;
|
|
26
|
+
url?: string;
|
|
27
|
+
webview?: Webview;
|
|
28
|
+
onClick?: () => void;
|
|
29
|
+
autodisable?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
disabledstyle?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ReplyProps {
|
|
34
|
+
path?: string;
|
|
35
|
+
payload?: string;
|
|
36
|
+
children: string;
|
|
37
|
+
}
|
|
38
|
+
export interface PicProps {
|
|
39
|
+
src: string;
|
|
40
|
+
}
|
|
41
|
+
export type ImageProps = PicProps;
|
|
42
|
+
export interface TitleProps {
|
|
43
|
+
children: React.ReactNode;
|
|
44
|
+
style: string;
|
|
45
|
+
}
|
|
46
|
+
export type SubtitleProps = TitleProps;
|
|
47
|
+
export type CustomProp = {
|
|
48
|
+
custom?: React.ComponentType;
|
|
49
|
+
};
|
|
50
|
+
export type EnableProp = {
|
|
51
|
+
enable?: boolean;
|
|
52
|
+
};
|
|
53
|
+
export type ImageProp = {
|
|
54
|
+
image?: string;
|
|
55
|
+
};
|
|
56
|
+
export type PersistentMenuCloseOption = {
|
|
57
|
+
closeLabel: string;
|
|
58
|
+
};
|
|
59
|
+
export type PersistentMenuOption = {
|
|
60
|
+
label: string;
|
|
61
|
+
} & ButtonProps;
|
|
62
|
+
export type StyleProp = {
|
|
63
|
+
style?: any;
|
|
64
|
+
};
|
|
65
|
+
export type PersistentMenuTheme = (PersistentMenuCloseOption | PersistentMenuOption)[];
|
|
66
|
+
export interface PersistentMenuProps {
|
|
67
|
+
onClick: () => void;
|
|
68
|
+
options: any;
|
|
69
|
+
}
|
|
70
|
+
export type BlockInputOption = {
|
|
71
|
+
preprocess?: (message: string) => string;
|
|
72
|
+
match: RegExp[];
|
|
73
|
+
message: string;
|
|
74
|
+
};
|
|
75
|
+
export interface BlobProps {
|
|
76
|
+
blobTick?: boolean;
|
|
77
|
+
blobTickStyle?: any;
|
|
78
|
+
blobWidth?: string;
|
|
79
|
+
imageStyle?: any;
|
|
80
|
+
}
|
|
81
|
+
export interface ScrollbarProps {
|
|
82
|
+
autoHide?: boolean;
|
|
83
|
+
thumb?: {
|
|
84
|
+
bgcolor?: string;
|
|
85
|
+
border?: string;
|
|
86
|
+
color?: string;
|
|
87
|
+
opacity?: string;
|
|
88
|
+
};
|
|
89
|
+
track?: {
|
|
90
|
+
bgcolor?: string;
|
|
91
|
+
border?: string;
|
|
92
|
+
color?: string;
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export interface ThemeProps extends StyleProp {
|
|
96
|
+
mobileBreakpoint?: number;
|
|
97
|
+
mobileStyle?: any;
|
|
98
|
+
webview?: StyleProp & {
|
|
99
|
+
header?: StyleProp;
|
|
100
|
+
};
|
|
101
|
+
animations?: EnableProp;
|
|
102
|
+
intro?: StyleProp & ImageProp & CustomProp;
|
|
103
|
+
brand?: {
|
|
104
|
+
color?: string;
|
|
105
|
+
} & ImageProp;
|
|
106
|
+
header?: {
|
|
107
|
+
title?: string;
|
|
108
|
+
subtitle?: string;
|
|
109
|
+
} & ImageProp & StyleProp & CustomProp;
|
|
110
|
+
message?: {
|
|
111
|
+
bot?: BlobProps & ImageProp & StyleProp;
|
|
112
|
+
user?: BlobProps & StyleProp;
|
|
113
|
+
customTypes?: React.ComponentType[];
|
|
114
|
+
} & StyleProp & {
|
|
115
|
+
timestamps?: {
|
|
116
|
+
enable?: boolean;
|
|
117
|
+
format(): string;
|
|
118
|
+
} & StyleProp;
|
|
119
|
+
};
|
|
120
|
+
button?: {
|
|
121
|
+
autodisable?: boolean;
|
|
122
|
+
disabledstyle?: any;
|
|
123
|
+
hoverBackground?: string;
|
|
124
|
+
hoverTextColor?: string;
|
|
125
|
+
messageType?: 'text' | 'payload';
|
|
126
|
+
} & StyleProp & CustomProp;
|
|
127
|
+
replies?: {
|
|
128
|
+
align?: 'left' | 'center' | 'right';
|
|
129
|
+
wrap?: 'wrap' | 'nowrap';
|
|
130
|
+
};
|
|
131
|
+
carousel?: {
|
|
132
|
+
arrow?: {
|
|
133
|
+
left: CustomProp;
|
|
134
|
+
right: CustomProp;
|
|
135
|
+
};
|
|
136
|
+
enableArrows?: boolean;
|
|
137
|
+
};
|
|
138
|
+
reply?: StyleProp & CustomProp;
|
|
139
|
+
triggerButton?: ImageProp & StyleProp & CustomProp;
|
|
140
|
+
markdownStyle?: string;
|
|
141
|
+
scrollbar?: ScrollbarProps & EnableProp;
|
|
142
|
+
userInput?: {
|
|
143
|
+
attachments?: EnableProp & CustomProp;
|
|
144
|
+
blockInputs?: BlockInputOption[];
|
|
145
|
+
box?: {
|
|
146
|
+
placeholder: string;
|
|
147
|
+
} & StyleProp;
|
|
148
|
+
emojiPicker?: EnableProp & CustomProp;
|
|
149
|
+
menu?: {
|
|
150
|
+
darkBackground?: boolean;
|
|
151
|
+
} & {
|
|
152
|
+
custom?: React.ComponentType<PersistentMenuProps>;
|
|
153
|
+
};
|
|
154
|
+
menuButton?: CustomProp;
|
|
155
|
+
persistentMenu?: PersistentMenuTheme;
|
|
156
|
+
sendButton?: EnableProp & CustomProp;
|
|
157
|
+
} & EnableProp & StyleProp;
|
|
158
|
+
}
|
|
159
|
+
export interface CoverComponentOptions {
|
|
160
|
+
component: React.ComponentType<CoverComponentProps>;
|
|
161
|
+
props?: any;
|
|
162
|
+
}
|
|
163
|
+
export interface WebchatSettingsProps {
|
|
164
|
+
blockInputs?: BlockInputOption[];
|
|
165
|
+
enableAnimations?: boolean;
|
|
166
|
+
enableAttachments?: boolean;
|
|
167
|
+
enableEmojiPicker?: boolean;
|
|
168
|
+
enableUserInput?: boolean;
|
|
169
|
+
persistentMenu?: PersistentMenuTheme;
|
|
170
|
+
theme?: ThemeProps;
|
|
171
|
+
}
|
|
172
|
+
export type WrappedComponent<Props> = React.FunctionComponent<Props> & {
|
|
173
|
+
customTypeName: string;
|
|
174
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
// TODO: Reuse types to be typed in respective functions
|
|
3
|
+
// export class ErrorBoundary<Props> extends React.Component<Props> {
|
|
4
|
+
// componentDidCatch(error: Error, errorInfo: ErrorInfo): void
|
|
5
|
+
// }
|
|
6
|
+
// export function createErrorBoundary<Props>(_?: {
|
|
7
|
+
// errorComponent: React.ComponentType
|
|
8
|
+
// }): ErrorBoundary<Props>
|
|
9
|
+
// export function customMessage<Props>(_: {
|
|
10
|
+
// name: string
|
|
11
|
+
// component: React.ComponentType<Props>
|
|
12
|
+
// defaultProps?: Record<string, unknown>
|
|
13
|
+
// errorBoundary?: ErrorBoundary<Props>
|
|
14
|
+
// }): WrappedComponent<Props>
|
|
15
|
+
// export function getDisplayName(component: React.ComponentType): string
|
|
16
|
+
//# sourceMappingURL=index-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.js","sourceRoot":"src/","sources":["components/index-types.ts"],"names":[],"mappings":";AA8LA,wDAAwD;AACxD,qEAAqE;AACrE,gEAAgE;AAChE,IAAI;AAEJ,mDAAmD;AACnD,wCAAwC;AACxC,2BAA2B;AAE3B,4CAA4C;AAC5C,iBAAiB;AACjB,0CAA0C;AAC1C,2CAA2C;AAC3C,yCAAyC;AACzC,8BAA8B;AAE9B,yEAAyE"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
export { Audio } from
|
|
2
|
-
export { Button } from
|
|
3
|
-
export { Carousel } from
|
|
4
|
-
export { customMessage } from
|
|
5
|
-
export { Document } from
|
|
6
|
-
export { Element } from
|
|
7
|
-
export { Image } from
|
|
8
|
-
export
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
1
|
+
export { Audio } from './audio';
|
|
2
|
+
export { Button } from './button';
|
|
3
|
+
export { Carousel } from './carousel';
|
|
4
|
+
export { customMessage } from './custom-message';
|
|
5
|
+
export { Document } from './document';
|
|
6
|
+
export { Element } from './element';
|
|
7
|
+
export { Image } from './image';
|
|
8
|
+
export * from './index-types';
|
|
9
|
+
export { Location } from './location';
|
|
10
|
+
export { Message } from './message';
|
|
11
|
+
export { MessageTemplate } from './message-template';
|
|
12
|
+
export * from './multichannel';
|
|
13
|
+
export { Pic } from './pic';
|
|
14
|
+
export { Raw } from './raw';
|
|
15
|
+
export { Reply } from './reply';
|
|
16
|
+
export { ShareButton } from './share-button';
|
|
17
|
+
export { Subtitle } from './subtitle';
|
|
18
|
+
export { Text } from './text';
|
|
19
|
+
export { Title } from './title';
|
|
20
|
+
export { Video } from './video';
|
|
21
|
+
export { WebchatSettings } from './webchat-settings';
|
|
22
|
+
export { WhatsappTemplate } from './whatsapp-template';
|
|
@@ -5,7 +5,9 @@ export { customMessage } from './custom-message';
|
|
|
5
5
|
export { Document } from './document';
|
|
6
6
|
export { Element } from './element';
|
|
7
7
|
export { Image } from './image';
|
|
8
|
+
export * from './index-types';
|
|
8
9
|
export { Location } from './location';
|
|
10
|
+
export { Message } from './message';
|
|
9
11
|
export { MessageTemplate } from './message-template';
|
|
10
12
|
export * from './multichannel';
|
|
11
13
|
export { Pic } from './pic';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["components/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type IndexMode = 'number' | 'letter' | undefined;
|
|
2
|
+
export interface MultichannelViewOptions {
|
|
3
|
+
boldIndex?: boolean;
|
|
4
|
+
indexSeparator?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MultichannelContextType extends MultichannelViewOptions {
|
|
7
|
+
currentIndex: number | string;
|
|
8
|
+
/** @see same field at MultichannelProps */
|
|
9
|
+
messageSeparator?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MultichannelTextProps extends MultichannelViewOptions {
|
|
12
|
+
index?: string;
|
|
13
|
+
indexMode?: IndexMode;
|
|
14
|
+
/** Defaults to no separator between lines*/
|
|
15
|
+
newline?: string;
|
|
16
|
+
buttonsAsText?: boolean;
|
|
17
|
+
buttonsTextSeparator?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface MultichannelCarouselProps extends MultichannelViewOptions {
|
|
20
|
+
enableURL?: boolean;
|
|
21
|
+
indexMode?: IndexMode;
|
|
22
|
+
showTitle?: boolean;
|
|
23
|
+
showSubtitle?: boolean;
|
|
24
|
+
buttonsAsText?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface MultichannelButtonProps {
|
|
27
|
+
newline?: string;
|
|
28
|
+
path?: string;
|
|
29
|
+
payload?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
webview?: string;
|
|
32
|
+
asText?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface MultichannelProps extends MultichannelViewOptions {
|
|
35
|
+
firstIndex?: number | string;
|
|
36
|
+
carousel?: MultichannelCarouselProps;
|
|
37
|
+
text?: MultichannelTextProps;
|
|
38
|
+
/**
|
|
39
|
+
* If undefined, each component will be served in a different botonic message
|
|
40
|
+
* '' will concatenate in the same line
|
|
41
|
+
* '\n' will split in different lines
|
|
42
|
+
* '\n\n' will separate with an empty line
|
|
43
|
+
**/
|
|
44
|
+
messageSeparator?: string;
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.js","sourceRoot":"src/","sources":["components/multichannel/index-types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { Multichannel } from './multichannel';
|
|
2
|
-
import { MultichannelText } from './multichannel-text';
|
|
3
2
|
import { MultichannelButton } from './multichannel-button';
|
|
4
|
-
import { MultichannelReply } from './multichannel-reply';
|
|
5
3
|
import { MultichannelCarousel } from './multichannel-carousel';
|
|
6
|
-
|
|
4
|
+
import { MultichannelReply } from './multichannel-reply';
|
|
5
|
+
import { MultichannelText } from './multichannel-text';
|
|
6
|
+
export { Multichannel };
|
|
7
|
+
export { MultichannelText };
|
|
8
|
+
export { MultichannelButton };
|
|
9
|
+
export { MultichannelReply };
|
|
10
|
+
export { MultichannelCarousel };
|
|
11
|
+
export * from './index-types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["components/multichannel/index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["components/multichannel/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAEtD,OAAO,EAAE,YAAY,EAAE,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,CAAA;AAC3B,OAAO,EAAE,kBAAkB,EAAE,CAAA;AAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,CAAA;AAE/B,cAAc,eAAe,CAAA"}
|
package/lib/esm/contexts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const RequestContext:
|
|
1
|
+
export const RequestContext: import("react").Context<{
|
|
2
2
|
getString: () => "";
|
|
3
3
|
setLocale: () => "";
|
|
4
4
|
session: {};
|
|
@@ -7,7 +7,7 @@ export const RequestContext: React.Context<{
|
|
|
7
7
|
defaultDelay: number;
|
|
8
8
|
defaultTyping: number;
|
|
9
9
|
}>;
|
|
10
|
-
export const WebchatContext:
|
|
10
|
+
export const WebchatContext: import("react").Context<{
|
|
11
11
|
sendText: (text: any) => void;
|
|
12
12
|
sendAttachment: (attachment: any) => void;
|
|
13
13
|
sendPayload: (payload: any) => void;
|
|
@@ -66,4 +66,3 @@ export const WebchatContext: React.Context<{
|
|
|
66
66
|
updateWebchatDevSettings: (settings: any) => {};
|
|
67
67
|
updateUser: (user: any) => void;
|
|
68
68
|
}>;
|
|
69
|
-
import React from 'react';
|
package/lib/esm/contexts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createContext } from 'react';
|
|
2
2
|
import { webchatInitialState } from './webchat/hooks';
|
|
3
|
-
export const RequestContext =
|
|
3
|
+
export const RequestContext = createContext({
|
|
4
4
|
getString: () => '',
|
|
5
5
|
setLocale: () => '',
|
|
6
6
|
session: {},
|
|
@@ -9,7 +9,7 @@ export const RequestContext = React.createContext({
|
|
|
9
9
|
defaultDelay: 0,
|
|
10
10
|
defaultTyping: 0,
|
|
11
11
|
});
|
|
12
|
-
export const WebchatContext =
|
|
12
|
+
export const WebchatContext = createContext({
|
|
13
13
|
sendText: text => { },
|
|
14
14
|
sendAttachment: attachment => { },
|
|
15
15
|
sendPayload: payload => { },
|
package/lib/esm/contexts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contexts.js","sourceRoot":"src/","sources":["contexts.jsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"contexts.js","sourceRoot":"src/","sources":["contexts.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;IACnB,SAAS,EAAE,GAAG,EAAE,CAAC,EAAE;IACnB,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;CACjB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC1C,QAAQ,EAAE,IAAI,CAAC,EAAE,GAAE,CAAC;IACpB,cAAc,EAAE,UAAU,CAAC,EAAE,GAAE,CAAC;IAChC,WAAW,EAAE,OAAO,CAAC,EAAE,GAAE,CAAC;IAC1B,SAAS,EAAE,KAAK,CAAC,EAAE,GAAE,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC,EAAE,GAAE,CAAC;IACzB,WAAW,EAAE,gBAAgB,CAAC,EAAE,GAAE,CAAC;IACnC,UAAU,EAAE,OAAO,CAAC,EAAE,GAAE,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC,EAAE,GAAE,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC,EAAE,GAAE,CAAC;IAC5B,iBAAiB,EAAE,KAAK,CAAC,EAAE,GAAE,CAAC;IAC9B,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;IACvB,gBAAgB,EAAE,QAAQ,CAAC,EAAE,CAAC,SAAS;IACvC,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,KAAK,EAAE,EAAE;IACT,YAAY,EAAE,mBAAmB;IACjC,wBAAwB,EAAE,QAAQ,CAAC,EAAE;QACnC,OAAO,EAAE,CAAA;IACX,CAAC;IACD,UAAU,EAAE,IAAI,CAAC,EAAE,GAAE,CAAC;CACvB,CAAC,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as core from '@botonic/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ButtonProps, ReplyProps, ThemeProps, WebchatSettingsProps, Webview } from './components/index-types';
|
|
4
|
+
import { WebchatState } from './webchat';
|
|
5
|
+
/**
|
|
6
|
+
* See @botonic/core's Response for the description of the Response's semantics*/
|
|
7
|
+
export interface BotResponse extends core.BotRequest {
|
|
8
|
+
response: [React.ReactNode];
|
|
9
|
+
}
|
|
10
|
+
export interface Route extends core.Route {
|
|
11
|
+
action?: React.ComponentType<any>;
|
|
12
|
+
retryAction?: React.ComponentType<any>;
|
|
13
|
+
}
|
|
14
|
+
export type Routes = core.Routes<Route>;
|
|
15
|
+
export interface ActionRequest {
|
|
16
|
+
defaultDelay: number;
|
|
17
|
+
defaultTyping: number;
|
|
18
|
+
input: core.Input;
|
|
19
|
+
lastRoutePath: string;
|
|
20
|
+
params: {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
plugins: {
|
|
24
|
+
[id: string]: core.Plugin;
|
|
25
|
+
};
|
|
26
|
+
session: core.Session;
|
|
27
|
+
}
|
|
28
|
+
export interface RequestContextInterface extends ActionRequest {
|
|
29
|
+
getString: (stringId: string) => string;
|
|
30
|
+
setLocale: (locale: string) => string;
|
|
31
|
+
}
|
|
32
|
+
export interface CustomMessageType {
|
|
33
|
+
customTypeName: string;
|
|
34
|
+
}
|
|
35
|
+
export interface WebchatAppArgs {
|
|
36
|
+
appId?: string;
|
|
37
|
+
visibility?: () => boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface WebchatMessage {
|
|
40
|
+
ack: 0 | 1;
|
|
41
|
+
buttons: ButtonProps[];
|
|
42
|
+
data: any;
|
|
43
|
+
delay: number;
|
|
44
|
+
display: boolean;
|
|
45
|
+
from: 'user' | 'bot';
|
|
46
|
+
id: string;
|
|
47
|
+
markdown: boolean;
|
|
48
|
+
replies: ReplyProps[];
|
|
49
|
+
timestamp: string;
|
|
50
|
+
type: core.InputType;
|
|
51
|
+
typing: number;
|
|
52
|
+
}
|
|
53
|
+
export interface OnUserInputArgs {
|
|
54
|
+
input: core.Input;
|
|
55
|
+
lastRoutePath?: string;
|
|
56
|
+
session?: core.Session;
|
|
57
|
+
user: core.SessionUser;
|
|
58
|
+
}
|
|
59
|
+
export interface OnStateChangeArgs {
|
|
60
|
+
messagesJSON: WebchatMessage[];
|
|
61
|
+
user: core.SessionUser;
|
|
62
|
+
}
|
|
63
|
+
export interface MessageInfo {
|
|
64
|
+
data: any | 'typing_on';
|
|
65
|
+
id: string;
|
|
66
|
+
type: 'update_webchat_settings' | 'sender_action';
|
|
67
|
+
}
|
|
68
|
+
export interface Event {
|
|
69
|
+
action?: 'update_message_info';
|
|
70
|
+
isError?: boolean;
|
|
71
|
+
message?: MessageInfo;
|
|
72
|
+
}
|
|
73
|
+
export interface WebchatContextProps {
|
|
74
|
+
sendText: (text: string, payload?: string) => void;
|
|
75
|
+
sendAttachment: (attachment: File) => void;
|
|
76
|
+
sendPayload: (payload: string) => void;
|
|
77
|
+
sendInput: (input: core.Input) => void;
|
|
78
|
+
openWebview: (webviewComponent: Webview) => void;
|
|
79
|
+
addMessage: (message: WebchatMessage) => void;
|
|
80
|
+
updateMessage: (message: WebchatMessage) => void;
|
|
81
|
+
updateReplies: (replies: boolean) => void;
|
|
82
|
+
updateLatestInput: (input: core.Input) => void;
|
|
83
|
+
closeWebview: () => void;
|
|
84
|
+
toggleWebchat: () => void;
|
|
85
|
+
getThemeProperty: (property: string, defaultValue?: string) => any;
|
|
86
|
+
resolveCase: () => void;
|
|
87
|
+
theme: ThemeProps;
|
|
88
|
+
webchatState: WebchatState;
|
|
89
|
+
updateWebchatDevSettings: (settings: WebchatSettingsProps) => void;
|
|
90
|
+
updateUser: (user: Partial<core.SessionUser>) => void;
|
|
91
|
+
}
|
|
92
|
+
export * from './components';
|
|
93
|
+
export * from './util';
|
|
94
|
+
export * from './webchat';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// export class DevApp extends WebchatApp {
|
|
2
|
+
// constructor(args: WebchatAppArgs)
|
|
3
|
+
// onUserInput(args: OnUserInputArgs): Promise<void>
|
|
4
|
+
// render(dest: HTMLElement, optionsAtRuntime: WebchatAppArgs): void
|
|
5
|
+
// }
|
|
6
|
+
export * from './components';
|
|
7
|
+
export * from './util';
|
|
8
|
+
export * from './webchat';
|
|
9
|
+
//# sourceMappingURL=index-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.js","sourceRoot":"src/","sources":["index-types.ts"],"names":[],"mappings":"AAiLA,2CAA2C;AAC3C,sCAAsC;AACtC,sDAAsD;AACtD,sEAAsE;AACtE,IAAI;AAEJ,cAAc,cAAc,CAAA;AAC5B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export { msgsToBotonic, msgToBotonic } from "./msg-to-botonic";
|
|
1
|
+
export { BotonicInputTester, BotonicOutputTester } from './botonic-tester';
|
|
2
|
+
export { RequestContext, WebchatContext } from './contexts';
|
|
3
|
+
export { DevApp } from './dev-app';
|
|
4
|
+
export * from './index-types';
|
|
5
|
+
export { msgsToBotonic, msgToBotonic } from './msg-to-botonic';
|
|
6
|
+
export { NodeApp } from './node-app';
|
|
7
|
+
export { WebchatApp } from './webchat-app';
|
|
8
|
+
export { WebviewApp } from './webview-app';
|
package/lib/esm/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { BotonicInputTester, BotonicOutputTester } from './botonic-tester';
|
|
2
|
-
export * from './components'
|
|
2
|
+
// export * from './components'
|
|
3
3
|
export { RequestContext, WebchatContext } from './contexts';
|
|
4
4
|
export { DevApp } from './dev-app';
|
|
5
|
+
export * from './index-types';
|
|
5
6
|
export { msgsToBotonic, msgToBotonic } from './msg-to-botonic';
|
|
6
7
|
export { NodeApp } from './node-app';
|
|
7
|
-
export { staticAsset } from './util/environment'
|
|
8
|
-
export { getBotonicApp, Webchat } from './webchat/index
|
|
8
|
+
// export { staticAsset } from './util/environment'
|
|
9
|
+
// export { getBotonicApp, Webchat } from './webchat/index'
|
|
9
10
|
export { WebchatApp } from './webchat-app';
|
|
10
11
|
export { WebviewApp } from './webview-app';
|
|
11
12
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC1E,+BAA+B;AAC/B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,mDAAmD;AACnD,2DAA2D;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -10,9 +10,10 @@ export function isContact(msg: any): boolean;
|
|
|
10
10
|
export function isCarousel(msg: any): boolean;
|
|
11
11
|
export function isCustom(msg: any): boolean;
|
|
12
12
|
export function isButtonMessage(msg: any): boolean;
|
|
13
|
-
export const INPUT_MEDIA_TYPES:
|
|
13
|
+
export const INPUT_MEDIA_TYPES: INPUT[];
|
|
14
14
|
export function isMedia(message: any): boolean;
|
|
15
15
|
export function readDataURL(file: any): Promise<any>;
|
|
16
16
|
export function isAllowedSize(fileSize: any): boolean;
|
|
17
17
|
export function getMediaType(fileType: any): string;
|
|
18
18
|
export function getFullMimeWhitelist(): string[];
|
|
19
|
+
import { INPUT } from '@botonic/core';
|
package/lib/esm/node-app.d.ts
CHANGED
|
@@ -2,10 +2,10 @@ export class NodeApp {
|
|
|
2
2
|
constructor(options: any);
|
|
3
3
|
bot: ReactBot;
|
|
4
4
|
renderNode(args: any): Promise<string>;
|
|
5
|
-
input(args: any):
|
|
5
|
+
input(args: any): Promise<import("@botonic/core").BotResponse>;
|
|
6
6
|
getConfig(): {
|
|
7
|
-
id:
|
|
8
|
-
name:
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
9
|
config: any;
|
|
10
10
|
}[];
|
|
11
11
|
}
|
package/lib/esm/react-bot.d.ts
CHANGED