@asgard-js/react 0.0.13 → 0.0.15
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { AsgardServiceClient, Conversation, ConversationMessage, FetchSsePayload
|
|
|
2
2
|
|
|
3
3
|
interface UseChannelProps {
|
|
4
4
|
defaultIsOpen?: boolean;
|
|
5
|
+
resetPayload?: Pick<FetchSsePayload, 'text' | 'payload'>;
|
|
5
6
|
client: AsgardServiceClient | null;
|
|
6
7
|
customChannelId: string;
|
|
7
8
|
customMessageId?: string;
|
|
@@ -13,7 +14,7 @@ export interface UseChannelReturn {
|
|
|
13
14
|
isConnecting: boolean;
|
|
14
15
|
conversation: Conversation | null;
|
|
15
16
|
sendMessage?: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
16
|
-
resetChannel?: () => void;
|
|
17
|
+
resetChannel?: (payload: Pick<FetchSsePayload, 'text' | 'payload'>) => void;
|
|
17
18
|
closeChannel?: () => void;
|
|
18
19
|
}
|
|
19
20
|
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,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAGzB,UAAU,eAAe;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,EAAE,mBAA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IAAI,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAC5E,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,CA8GnE"}
|
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,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -74,67 +74,72 @@ function T7(e) {
|
|
|
74
74
|
const {
|
|
75
75
|
client: t,
|
|
76
76
|
defaultIsOpen: n,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
resetPayload: i,
|
|
78
|
+
customChannelId: r,
|
|
79
|
+
customMessageId: o,
|
|
80
|
+
initMessages: s
|
|
80
81
|
} = e;
|
|
81
82
|
if (!t)
|
|
82
83
|
throw new Error("Client instance is required");
|
|
83
|
-
if (!
|
|
84
|
+
if (!r)
|
|
84
85
|
throw new Error("Custom channel id is required");
|
|
85
|
-
const [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
{
|
|
103
|
-
onSseCompleted() {
|
|
104
|
-
f(!1);
|
|
86
|
+
const [a, u] = Cn(null), [l, c] = Cn(n ?? !0), [f, d] = Cn(!1), [h, p] = Cn(!1), [g, m] = Cn(null), y = xt(
|
|
87
|
+
async (_) => {
|
|
88
|
+
const v = new k7({
|
|
89
|
+
messages: new Map(
|
|
90
|
+
s == null ? void 0 : s.map((w) => [w.messageId, w])
|
|
91
|
+
)
|
|
92
|
+
});
|
|
93
|
+
d(!0), p(!0), m(v);
|
|
94
|
+
const E = await A7.reset(
|
|
95
|
+
{
|
|
96
|
+
client: t,
|
|
97
|
+
customChannelId: r,
|
|
98
|
+
customMessageId: o,
|
|
99
|
+
conversation: v,
|
|
100
|
+
statesObserver: (w) => {
|
|
101
|
+
p(w.isConnecting), m(w.conversation);
|
|
102
|
+
}
|
|
105
103
|
},
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
_,
|
|
105
|
+
{
|
|
106
|
+
onSseCompleted() {
|
|
107
|
+
d(!1);
|
|
108
|
+
},
|
|
109
|
+
onSseError() {
|
|
110
|
+
d(!1);
|
|
111
|
+
}
|
|
108
112
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
);
|
|
114
|
+
c(!0), u(E);
|
|
115
|
+
},
|
|
116
|
+
[t, r, o, s]
|
|
117
|
+
), b = xt(() => {
|
|
118
|
+
u((_) => (_ == null || _.close(), null)), c(!1), d(!1), p(!1), m(null);
|
|
119
|
+
}, []), x = xt(
|
|
120
|
+
(_) => a == null ? void 0 : a.sendMessage(_),
|
|
121
|
+
[a]
|
|
117
122
|
);
|
|
118
123
|
return Nt(() => {
|
|
119
|
-
!
|
|
120
|
-
}, [
|
|
124
|
+
!a && l && y(i);
|
|
125
|
+
}, [a, l, y, i]), Nt(() => () => b(), [b]), jt(
|
|
121
126
|
() => ({
|
|
122
|
-
isOpen:
|
|
123
|
-
isResetting:
|
|
124
|
-
isConnecting:
|
|
125
|
-
conversation:
|
|
126
|
-
sendMessage:
|
|
127
|
-
resetChannel:
|
|
128
|
-
closeChannel:
|
|
127
|
+
isOpen: l,
|
|
128
|
+
isResetting: f,
|
|
129
|
+
isConnecting: h,
|
|
130
|
+
conversation: g,
|
|
131
|
+
sendMessage: x,
|
|
132
|
+
resetChannel: y,
|
|
133
|
+
closeChannel: b
|
|
129
134
|
}),
|
|
130
135
|
[
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
l,
|
|
137
|
+
f,
|
|
138
|
+
h,
|
|
139
|
+
g,
|
|
140
|
+
x,
|
|
141
|
+
y,
|
|
142
|
+
b
|
|
138
143
|
]
|
|
139
144
|
);
|
|
140
145
|
}
|
|
@@ -43449,8 +43454,29 @@ function Kxe(e) {
|
|
|
43449
43454
|
) });
|
|
43450
43455
|
}
|
|
43451
43456
|
export {
|
|
43457
|
+
aF as AsgardServiceContext,
|
|
43458
|
+
Yz as AsgardServiceContextProvider,
|
|
43459
|
+
uF as AsgardTemplateContext,
|
|
43460
|
+
Xz as AsgardTemplateContextProvider,
|
|
43461
|
+
jM as AsgardThemeContext,
|
|
43462
|
+
$7 as AsgardThemeContextProvider,
|
|
43463
|
+
dF as BotTypingBox,
|
|
43464
|
+
EB as BotTypingPlaceholder,
|
|
43465
|
+
wB as ButtonTemplate,
|
|
43466
|
+
AB as CarouselTemplate,
|
|
43467
|
+
Lbe as ChartTemplate,
|
|
43452
43468
|
Kxe as Chatbot,
|
|
43469
|
+
WA as HintTemplate,
|
|
43470
|
+
Wbe as ImageTemplate,
|
|
43471
|
+
dB as QuickReplies,
|
|
43472
|
+
Ia as TemplateBox,
|
|
43473
|
+
Yl as TemplateBoxContent,
|
|
43474
|
+
jA as TextTemplate,
|
|
43475
|
+
UM as defaultAsgardThemeContextValue,
|
|
43476
|
+
Ii as useAsgardContext,
|
|
43453
43477
|
C7 as useAsgardServiceClient,
|
|
43478
|
+
Zz as useAsgardTemplateContext,
|
|
43479
|
+
au as useAsgardThemeContext,
|
|
43454
43480
|
T7 as useChannel,
|
|
43455
43481
|
R7 as useDebounce,
|
|
43456
43482
|
O7 as useIsOnScreenKeyboardOpen,
|