@super_studio/ecforce-ai-agent-react 0.6.0-canary.6 → 1.0.0-canary.7

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 (73) hide show
  1. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/defineProperty.mjs +14 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/extends.mjs +13 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectDestructuringEmpty.mjs +7 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectSpread2.mjs +27 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutProperties.mjs +15 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/objectWithoutPropertiesLoose.mjs +13 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPrimitive.mjs +16 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/toPropertyKey.mjs +11 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.103.0/helpers/typeof.mjs +12 -0
  10. package/dist/components/chatbot-frame.d.mts +53 -0
  11. package/dist/components/chatbot-frame.d.mts.map +1 -0
  12. package/dist/components/chatbot-frame.mjs +99 -0
  13. package/dist/components/chatbot-frame.mjs.map +1 -0
  14. package/dist/components/chatbot-sheet.d.mts +15 -0
  15. package/dist/components/chatbot-sheet.d.mts.map +1 -0
  16. package/dist/components/chatbot-sheet.mjs +40 -0
  17. package/dist/components/chatbot-sheet.mjs.map +1 -0
  18. package/dist/components/lottie-ai-icon.mjs +60 -0
  19. package/dist/components/lottie-ai-icon.mjs.map +1 -0
  20. package/dist/components/provider/chatbot-provider.d.mts +48 -0
  21. package/dist/components/provider/chatbot-provider.d.mts.map +1 -0
  22. package/dist/components/provider/chatbot-provider.mjs +46 -0
  23. package/dist/components/provider/chatbot-provider.mjs.map +1 -0
  24. package/dist/components/provider/use-chatbot-frame-handler.d.mts +17 -0
  25. package/dist/components/provider/use-chatbot-frame-handler.d.mts.map +1 -0
  26. package/dist/components/provider/use-chatbot-frame-handler.mjs +93 -0
  27. package/dist/components/provider/use-chatbot-frame-handler.mjs.map +1 -0
  28. package/dist/components/provider/use-chatbot-window-states.mjs +27 -0
  29. package/dist/components/provider/use-chatbot-window-states.mjs.map +1 -0
  30. package/dist/components/sheet.d.mts +18 -0
  31. package/dist/components/sheet.d.mts.map +1 -0
  32. package/dist/components/sheet.mjs +117 -0
  33. package/dist/components/sheet.mjs.map +1 -0
  34. package/dist/components/tooltip.d.mts +38 -0
  35. package/dist/components/tooltip.d.mts.map +1 -0
  36. package/dist/components/tooltip.mjs +36 -0
  37. package/dist/components/tooltip.mjs.map +1 -0
  38. package/dist/index.d.mts +6 -0
  39. package/dist/index.mjs +6 -618
  40. package/dist/lib/constants.mjs +6 -0
  41. package/dist/lib/constants.mjs.map +1 -0
  42. package/package.json +16 -25
  43. package/src/components/chatbot-frame.tsx +2 -0
  44. package/src/components/chatbot-sheet.tsx +2 -0
  45. package/src/components/lottie-ai-icon.tsx +2 -0
  46. package/src/components/provider/chatbot-provider.tsx +2 -0
  47. package/src/components/provider/use-chatbot-frame-handler.tsx +2 -0
  48. package/src/components/provider/use-chatbot-window-states.tsx +2 -0
  49. package/src/components/sheet.tsx +2 -0
  50. package/src/components/tooltip.tsx +2 -0
  51. package/dist/components/chatbot-frame.d.ts +0 -39
  52. package/dist/components/chatbot-frame.d.ts.map +0 -1
  53. package/dist/components/chatbot-sheet.d.ts +0 -8
  54. package/dist/components/chatbot-sheet.d.ts.map +0 -1
  55. package/dist/components/lottie-ai-icon.d.ts +0 -13
  56. package/dist/components/lottie-ai-icon.d.ts.map +0 -1
  57. package/dist/components/provider/chatbot-provider.d.ts +0 -42
  58. package/dist/components/provider/chatbot-provider.d.ts.map +0 -1
  59. package/dist/components/provider/use-chatbot-frame-handler.d.ts +0 -57
  60. package/dist/components/provider/use-chatbot-frame-handler.d.ts.map +0 -1
  61. package/dist/components/provider/use-chatbot-window-states.d.ts +0 -11
  62. package/dist/components/provider/use-chatbot-window-states.d.ts.map +0 -1
  63. package/dist/components/sheet.d.ts +0 -12
  64. package/dist/components/sheet.d.ts.map +0 -1
  65. package/dist/components/tooltip.d.ts +0 -20
  66. package/dist/components/tooltip.d.ts.map +0 -1
  67. package/dist/index.d.ts +0 -6
  68. package/dist/index.d.ts.map +0 -1
  69. package/dist/index.js +0 -619
  70. package/dist/lib/constants.d.ts +0 -2
  71. package/dist/lib/constants.d.ts.map +0 -1
  72. package/dist/styles/chatbot-sheet.css +0 -122
  73. package/dist/styles/preset.css +0 -18
package/dist/index.mjs CHANGED
@@ -1,619 +1,7 @@
1
- "use client";
2
- var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
8
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
- var __spreadValues = (a, b) => {
10
- for (var prop in b || (b = {}))
11
- if (__hasOwnProp.call(b, prop))
12
- __defNormalProp(a, prop, b[prop]);
13
- if (__getOwnPropSymbols)
14
- for (var prop of __getOwnPropSymbols(b)) {
15
- if (__propIsEnum.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- }
18
- return a;
19
- };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
- var __objRest = (source, exclude) => {
22
- var target = {};
23
- for (var prop in source)
24
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
25
- target[prop] = source[prop];
26
- if (source != null && __getOwnPropSymbols)
27
- for (var prop of __getOwnPropSymbols(source)) {
28
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
29
- target[prop] = source[prop];
30
- }
31
- return target;
32
- };
1
+ import { ChatbotProvider, useChatbot } from "./components/provider/chatbot-provider.mjs";
2
+ import { ChatbotFrame, useSession } from "./components/chatbot-frame.mjs";
3
+ import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/sheet.mjs";
4
+ import { Tooltip } from "./components/tooltip.mjs";
5
+ import { ChatbotSheet } from "./components/chatbot-sheet.mjs";
33
6
 
34
- // src/components/provider/chatbot-provider.tsx
35
- import React3 from "react";
36
-
37
- // src/components/provider/use-chatbot-frame-handler.tsx
38
- import React from "react";
39
- function useChatbotFrameHandler({
40
- setOpen,
41
- setIsExpanded,
42
- setIsFullScreen
43
- }) {
44
- const [iframeEl, setIframeEl] = React.useState(
45
- null
46
- );
47
- const [isReady, setIsReady] = React.useState(false);
48
- const [isInitialized, setIsInitialized] = React.useState(false);
49
- const postMessage = React.useCallback(
50
- (message) => {
51
- if (iframeEl == null ? void 0 : iframeEl.contentWindow) {
52
- if (process.env.NODE_ENV === "development") {
53
- console.log("sending message to iframe", message);
54
- }
55
- iframeEl.contentWindow.postMessage(message, "*");
56
- }
57
- },
58
- [iframeEl]
59
- );
60
- const init = React.useCallback(
61
- (props) => {
62
- postMessage(__spreadValues({
63
- type: "init"
64
- }, props));
65
- },
66
- [postMessage]
67
- );
68
- const setMcps = React.useCallback(
69
- (mcps) => {
70
- postMessage({ type: "mcps", mcps });
71
- },
72
- [postMessage]
73
- );
74
- const setAppName = React.useCallback(
75
- (appName) => {
76
- postMessage({ type: "appName", appName });
77
- },
78
- [postMessage]
79
- );
80
- const setSessionToken = React.useCallback(
81
- (sessionToken) => {
82
- postMessage({ type: "sessionToken", sessionToken });
83
- },
84
- [postMessage]
85
- );
86
- React.useEffect(() => {
87
- const iframe = iframeEl;
88
- if (!iframe) {
89
- return;
90
- }
91
- const handleMessage = (event) => {
92
- var _a;
93
- if (process.env.NODE_ENV === "development") {
94
- console.log("iframe message", event.data);
95
- }
96
- switch ((_a = event.data) == null ? void 0 : _a.type) {
97
- case "CHATBOT_READY":
98
- setIsReady(true);
99
- break;
100
- case "CHATBOT_INITIALIZED":
101
- setIsInitialized(true);
102
- break;
103
- case "CLOSE_CHATBOT":
104
- setOpen(false);
105
- break;
106
- case "EXPAND_CHATBOT":
107
- setIsExpanded(true);
108
- break;
109
- case "SHRINK_CHATBOT":
110
- setIsExpanded(false);
111
- break;
112
- case "FULLSCREEN_CHATBOT":
113
- setIsFullScreen(true);
114
- break;
115
- case "EXIT_FULLSCREEN_CHATBOT":
116
- setIsFullScreen(false);
117
- break;
118
- case "RELOAD_CHATBOT":
119
- iframe.src = iframe.src;
120
- break;
121
- }
122
- };
123
- const handleIframeLoad = () => {
124
- window.addEventListener("message", handleMessage);
125
- };
126
- iframe.addEventListener("load", handleIframeLoad);
127
- return () => {
128
- window.removeEventListener("message", handleMessage);
129
- iframe.removeEventListener("load", handleIframeLoad);
130
- };
131
- }, [iframeEl]);
132
- return {
133
- init,
134
- setMcps,
135
- setAppName,
136
- setSessionToken,
137
- setIframeEl,
138
- isReady,
139
- isInitialized
140
- };
141
- }
142
-
143
- // src/components/provider/use-chatbot-window-states.tsx
144
- import React2 from "react";
145
- function useChatbotWindowStates() {
146
- const [hasOpened, setHasOpened] = React2.useState(false);
147
- const [open, setOpen] = React2.useState(false);
148
- const [isExpanded, setIsExpanded] = React2.useState(false);
149
- const [isFullScreen, setIsFullScreen] = React2.useState(false);
150
- React2.useEffect(() => {
151
- if (open) {
152
- setHasOpened(true);
153
- }
154
- }, [open]);
155
- return {
156
- hasOpened,
157
- open,
158
- isExpanded,
159
- isFullScreen,
160
- setOpen,
161
- setIsExpanded,
162
- setIsFullScreen
163
- };
164
- }
165
-
166
- // src/components/provider/chatbot-provider.tsx
167
- import { jsx } from "react/jsx-runtime";
168
- var ChatbotContext = React3.createContext(
169
- void 0
170
- );
171
- function useChatbot() {
172
- const context = React3.useContext(ChatbotContext);
173
- if (!context) {
174
- throw new Error("useChatbot must be used within a ChatbotProvider");
175
- }
176
- return context;
177
- }
178
- function ChatbotProvider({ children }) {
179
- const {
180
- hasOpened,
181
- open,
182
- isExpanded,
183
- isFullScreen,
184
- setOpen,
185
- setIsExpanded,
186
- setIsFullScreen
187
- } = useChatbotWindowStates();
188
- const {
189
- setMcps,
190
- setAppName,
191
- setSessionToken,
192
- init,
193
- isReady,
194
- isInitialized,
195
- setIframeEl
196
- } = useChatbotFrameHandler({
197
- setOpen,
198
- setIsExpanded,
199
- setIsFullScreen
200
- });
201
- const value = {
202
- hasOpened,
203
- open,
204
- setOpen,
205
- isExpanded,
206
- setIsExpanded,
207
- isFullScreen,
208
- setIsFullScreen,
209
- setSessionToken,
210
- init,
211
- setMcps,
212
- setAppName,
213
- isReady,
214
- isInitialized,
215
- setIframeEl
216
- };
217
- return /* @__PURE__ */ jsx(ChatbotContext.Provider, { value, children });
218
- }
219
-
220
- // src/components/chatbot-frame.tsx
221
- import React4 from "react";
222
-
223
- // src/lib/constants.ts
224
- var PROD_CHATBOT_URL = "https://agent.ec-force.com";
225
-
226
- // src/components/chatbot-frame.tsx
227
- import { jsx as jsx2 } from "react/jsx-runtime";
228
- function ChatbotFrame({
229
- appName,
230
- initialConfig,
231
- getSession,
232
- enabled = true,
233
- url,
234
- className
235
- }) {
236
- var _a;
237
- const baseUrl = (_a = url != null ? url : process.env.CHATBOT_URL) != null ? _a : PROD_CHATBOT_URL;
238
- const { setIframeEl } = useChatbot();
239
- const { init, setMcps, setAppName, setSessionToken, isReady } = useChatbot();
240
- const sentInitRef = React4.useRef(false);
241
- const [currentMcps, setCurrentMcps] = React4.useState();
242
- const [currentAppName, setCurrentAppName] = React4.useState();
243
- const [currentSessionToken, setCurrentSessionToken] = React4.useState();
244
- const sessionToken = useSession({ getSession });
245
- const shouldInit = enabled && isReady && // getSessionが定義されていれば、currentSessionが設定されるまで待つ
246
- !!(sessionToken || getSession === void 0);
247
- React4.useEffect(() => {
248
- if (shouldInit && !sentInitRef.current) {
249
- init({
250
- appName,
251
- sessionToken
252
- });
253
- sentInitRef.current = true;
254
- setCurrentAppName(appName);
255
- setCurrentSessionToken(sessionToken);
256
- }
257
- }, [enabled, init, appName, isReady, sessionToken]);
258
- React4.useEffect(() => {
259
- if (sentInitRef.current && appName && currentAppName !== appName) {
260
- setCurrentAppName(appName);
261
- setAppName(appName);
262
- }
263
- }, [appName]);
264
- React4.useEffect(() => {
265
- if (sentInitRef.current && sessionToken && currentSessionToken !== sessionToken) {
266
- setCurrentSessionToken(sessionToken);
267
- setSessionToken(sessionToken);
268
- }
269
- }, [sessionToken]);
270
- return /* @__PURE__ */ jsx2(
271
- "iframe",
272
- {
273
- ref: setIframeEl,
274
- src: buildIframeUrl({
275
- baseUrl,
276
- initialConfig
277
- }),
278
- className,
279
- allow: "clipboard-write",
280
- style: {
281
- width: "100%",
282
- height: "100%"
283
- }
284
- }
285
- );
286
- }
287
- function buildIframeUrl({
288
- baseUrl,
289
- initialConfig
290
- }) {
291
- const url = new URL(`/embed`, baseUrl);
292
- if (initialConfig) {
293
- url.searchParams.set("initialConfig", JSON.stringify(initialConfig));
294
- }
295
- return url.toString();
296
- }
297
- function useSession({ getSession }) {
298
- const { setSessionToken } = useChatbot();
299
- const [session, setSession] = React4.useState();
300
- const isFetchingSessionRef = React4.useRef(false);
301
- React4.useEffect(() => {
302
- if (!getSession) return;
303
- let intervalId;
304
- const fetchSession = async () => {
305
- if (isFetchingSessionRef.current) return;
306
- try {
307
- isFetchingSessionRef.current = true;
308
- const session2 = await getSession();
309
- setSession(session2);
310
- setSessionToken(session2.token);
311
- } catch (error) {
312
- console.error("Failed to get session:", error);
313
- } finally {
314
- isFetchingSessionRef.current = false;
315
- }
316
- };
317
- fetchSession();
318
- intervalId = setInterval(fetchSession, 15 * 60 * 1e3);
319
- return () => {
320
- if (intervalId) {
321
- clearInterval(intervalId);
322
- }
323
- };
324
- }, [getSession, setSessionToken]);
325
- return session == null ? void 0 : session.token;
326
- }
327
-
328
- // src/components/chatbot-sheet.tsx
329
- import "react";
330
-
331
- // src/components/lottie-ai-icon.tsx
332
- import * as React5 from "react";
333
- import { jsx as jsx3 } from "react/jsx-runtime";
334
- function LottieAiIcon({
335
- src,
336
- width = 18,
337
- height = 18,
338
- loop = true,
339
- autoplay = false,
340
- hover = false,
341
- fallback
342
- }) {
343
- const containerRef = React5.useRef(null);
344
- const [ready, setReady] = React5.useState(false);
345
- React5.useEffect(() => {
346
- if (typeof window === "undefined") return;
347
- const existing = document.querySelector("script[data-dotlottie-player]");
348
- if (!existing) {
349
- const scriptEl = document.createElement("script");
350
- scriptEl.type = "module";
351
- scriptEl.async = true;
352
- scriptEl.src = "https://unpkg.com/@dotlottie/player-component@latest/dist/dotlottie-player.js";
353
- scriptEl.setAttribute("data-dotlottie-player", "true");
354
- scriptEl.onload = () => setReady(true);
355
- scriptEl.onerror = () => setReady(false);
356
- document.head.appendChild(scriptEl);
357
- } else {
358
- setReady(true);
359
- }
360
- }, []);
361
- React5.useEffect(() => {
362
- if (!ready || !containerRef.current) return;
363
- const container = containerRef.current;
364
- container.innerHTML = "";
365
- const player = document.createElement("dotlottie-player");
366
- player.setAttribute("src", src);
367
- player.setAttribute("style", `width:${width}px;height:${height}px`);
368
- if (loop) player.setAttribute("loop", "");
369
- if (autoplay) player.setAttribute("autoplay", "");
370
- if (hover) player.setAttribute("hover", "");
371
- container.appendChild(player);
372
- return () => {
373
- container.innerHTML = "";
374
- };
375
- }, [ready, src, width, height, loop, autoplay, hover]);
376
- return /* @__PURE__ */ jsx3("div", { ref: containerRef, "aria-hidden": "true", children: !ready && (fallback != null ? fallback : /* @__PURE__ */ jsx3(
377
- "svg",
378
- {
379
- width,
380
- height,
381
- viewBox: "0 0 24 24",
382
- fill: "currentColor"
383
- }
384
- )) });
385
- }
386
-
387
- // src/components/sheet.tsx
388
- import * as SheetPrimitive from "@radix-ui/react-dialog";
389
- import * as React6 from "react";
390
- import { jsx as jsx4 } from "react/jsx-runtime";
391
- function Sheet(_a) {
392
- var props = __objRest(_a, []);
393
- const { open, setOpen } = useChatbot();
394
- return /* @__PURE__ */ jsx4(
395
- SheetPrimitive.Root,
396
- __spreadValues({
397
- "data-slot": "sheet",
398
- modal: false,
399
- open,
400
- onOpenChange: setOpen
401
- }, props)
402
- );
403
- }
404
- var SheetTrigger = React6.forwardRef((_a, ref) => {
405
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
406
- return /* @__PURE__ */ jsx4(
407
- SheetPrimitive.Trigger,
408
- __spreadValues({
409
- ref,
410
- "data-slot": "sheet-trigger",
411
- className: `chatbot-trigger ${className || ""}`
412
- }, props)
413
- );
414
- });
415
- SheetTrigger.displayName = SheetPrimitive.Trigger.displayName;
416
- var SheetClose = React6.forwardRef((_a, ref) => {
417
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
418
- return /* @__PURE__ */ jsx4(
419
- SheetPrimitive.Close,
420
- __spreadValues({
421
- ref,
422
- "data-slot": "sheet-close",
423
- className: `chatbot-sheet-close ${className || ""}`
424
- }, props)
425
- );
426
- });
427
- SheetClose.displayName = SheetPrimitive.Close.displayName;
428
- function SheetPortal(_a) {
429
- var props = __objRest(_a, []);
430
- return /* @__PURE__ */ jsx4(SheetPrimitive.Portal, __spreadValues({ "data-slot": "sheet-portal" }, props));
431
- }
432
- var SheetContent = React6.forwardRef((_a, ref) => {
433
- var _b = _a, { className, children, style } = _b, props = __objRest(_b, ["className", "children", "style"]);
434
- const { isExpanded, isFullScreen, open, hasOpened } = useChatbot();
435
- const width = isFullScreen ? "100%" : isExpanded ? "848px" : "400px";
436
- const translateX = open ? "0" : "100%";
437
- const contentStyle = __spreadValues({
438
- "--sheet-width": width,
439
- transform: `translateX(${translateX})`
440
- }, style);
441
- const classNames = [
442
- "chatbot-sheet-content",
443
- isExpanded && !isFullScreen ? "chatbot-sheet-expanded" : "",
444
- isFullScreen ? "chatbot-sheet-fullscreen" : "",
445
- className || ""
446
- ].filter(Boolean).join(" ");
447
- return /* @__PURE__ */ jsx4(SheetPortal, { forceMount: hasOpened || void 0, children: /* @__PURE__ */ jsx4(
448
- SheetPrimitive.Content,
449
- __spreadProps(__spreadValues({
450
- ref,
451
- "data-slot": "sheet-content",
452
- forceMount: hasOpened || void 0,
453
- onInteractOutside: (e) => e.preventDefault(),
454
- className: classNames,
455
- style: contentStyle
456
- }, props), {
457
- children
458
- })
459
- ) });
460
- });
461
- SheetContent.displayName = SheetPrimitive.Content.displayName;
462
- var SheetHeader = React6.forwardRef((_a, ref) => {
463
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
464
- return /* @__PURE__ */ jsx4(
465
- "div",
466
- __spreadValues({
467
- ref,
468
- "data-slot": "sheet-header",
469
- className: `chatbot-sheet-header ${className || ""}`
470
- }, props)
471
- );
472
- });
473
- SheetHeader.displayName = "SheetHeader";
474
- var SheetFooter = React6.forwardRef((_a, ref) => {
475
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
476
- return /* @__PURE__ */ jsx4(
477
- "div",
478
- __spreadValues({
479
- ref,
480
- "data-slot": "sheet-footer",
481
- className: `chatbot-sheet-footer ${className || ""}`
482
- }, props)
483
- );
484
- });
485
- SheetFooter.displayName = "SheetFooter";
486
- var SheetTitle = React6.forwardRef((_a, ref) => {
487
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
488
- return /* @__PURE__ */ jsx4(
489
- SheetPrimitive.Title,
490
- __spreadValues({
491
- ref,
492
- "data-slot": "sheet-title",
493
- className: `chatbot-sheet-title ${className || ""}`
494
- }, props)
495
- );
496
- });
497
- SheetTitle.displayName = SheetPrimitive.Title.displayName;
498
- var SheetDescription = React6.forwardRef((_a, ref) => {
499
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
500
- return /* @__PURE__ */ jsx4(
501
- SheetPrimitive.Description,
502
- __spreadValues({
503
- ref,
504
- "data-slot": "sheet-description",
505
- className: `chatbot-sheet-description ${className || ""}`
506
- }, props)
507
- );
508
- });
509
- SheetDescription.displayName = SheetPrimitive.Description.displayName;
510
-
511
- // src/components/tooltip.tsx
512
- import {
513
- Arrow,
514
- Content as Content2,
515
- Portal as Portal2,
516
- Provider,
517
- Root as Root2,
518
- Trigger as Trigger2
519
- } from "@radix-ui/react-tooltip";
520
- import { jsx as jsx5, jsxs } from "react/jsx-runtime";
521
- function Tooltip({
522
- content,
523
- trigger,
524
- side,
525
- align,
526
- disabled,
527
- delayDuration,
528
- skipDelayDuration,
529
- className,
530
- open,
531
- alignOffset,
532
- sideOffset,
533
- arrowClassName,
534
- keepTooltipOpen
535
- }) {
536
- return /* @__PURE__ */ jsx5(
537
- Provider,
538
- {
539
- delayDuration: delayDuration != null ? delayDuration : 200,
540
- skipDelayDuration: skipDelayDuration != null ? skipDelayDuration : 200,
541
- children: /* @__PURE__ */ jsxs(Root2, { open: disabled ? false : open, children: [
542
- /* @__PURE__ */ jsx5(
543
- Trigger2,
544
- {
545
- onClick: keepTooltipOpen ? (event) => {
546
- event.preventDefault();
547
- } : void 0,
548
- asChild: true,
549
- children: trigger
550
- }
551
- ),
552
- /* @__PURE__ */ jsx5(Portal2, { children: /* @__PURE__ */ jsxs(
553
- Content2,
554
- {
555
- className: `tooltip-content ${className || ""}`,
556
- side,
557
- align,
558
- alignOffset,
559
- sideOffset,
560
- onPointerDownOutside: keepTooltipOpen ? (event) => {
561
- event.preventDefault();
562
- } : void 0,
563
- children: [
564
- /* @__PURE__ */ jsx5(Arrow, { className: arrowClassName }),
565
- content
566
- ]
567
- }
568
- ) })
569
- ] })
570
- }
571
- );
572
- }
573
-
574
- // src/components/chatbot-sheet.tsx
575
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
576
- function ChatbotSheet(_a) {
577
- var _b = _a, { sheetStyle } = _b, props = __objRest(_b, ["sheetStyle"]);
578
- return /* @__PURE__ */ jsxs2(Sheet, { children: [
579
- /* @__PURE__ */ jsx6(
580
- Tooltip,
581
- {
582
- side: "top",
583
- align: "end",
584
- content: "AI\u306B\u8CEA\u554F\u3057\u3066\u307F\u307E\u3057\u3087\u3046",
585
- trigger: /* @__PURE__ */ jsx6(SheetTrigger, { children: /* @__PURE__ */ jsx6(
586
- LottieAiIcon,
587
- {
588
- src: `${PROD_CHATBOT_URL}/animations/ai-icon.v1.lottie`,
589
- width: 24,
590
- height: 24,
591
- autoplay: true,
592
- loop: true
593
- }
594
- ) })
595
- }
596
- ),
597
- /* @__PURE__ */ jsxs2(SheetContent, { style: sheetStyle, children: [
598
- /* @__PURE__ */ jsx6(SheetTitle, { children: "AI\u306B\u8CEA\u554F\u3057\u3066\u307F\u307E\u3057\u3087\u3046" }),
599
- /* @__PURE__ */ jsx6(SheetDescription, { children: "AI\u306B\u8CEA\u554F\u3057\u3066\u307F\u307E\u3057\u3087\u3046" }),
600
- /* @__PURE__ */ jsx6(ChatbotFrame, __spreadValues({}, props))
601
- ] })
602
- ] });
603
- }
604
- export {
605
- ChatbotFrame,
606
- ChatbotProvider,
607
- ChatbotSheet,
608
- Sheet,
609
- SheetClose,
610
- SheetContent,
611
- SheetDescription,
612
- SheetFooter,
613
- SheetHeader,
614
- SheetTitle,
615
- SheetTrigger,
616
- Tooltip,
617
- useChatbot,
618
- useSession
619
- };
7
+ export { ChatbotFrame, ChatbotProvider, ChatbotSheet, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Tooltip, useChatbot, useSession };
@@ -0,0 +1,6 @@
1
+ //#region src/lib/constants.ts
2
+ const PROD_CHATBOT_URL = "https://agent.ec-force.com";
3
+
4
+ //#endregion
5
+ export { PROD_CHATBOT_URL };
6
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.mjs","names":[],"sources":["../../src/lib/constants.ts"],"sourcesContent":["export const PROD_CHATBOT_URL = \"https://agent.ec-force.com\";\n"],"mappings":";AAAA,MAAa,mBAAmB"}
package/package.json CHANGED
@@ -1,24 +1,19 @@
1
1
  {
2
2
  "name": "@super_studio/ecforce-ai-agent-react",
3
- "version": "0.6.0-canary.6",
4
- "main": "dist/index.js",
5
- "module": "dist/index.mjs",
6
- "types": "dist/index.d.ts",
3
+ "version": "1.0.0-canary.7",
4
+ "main": "./dist/index.mjs",
5
+ "module": "./dist/index.mjs",
6
+ "types": "./dist/index.d.mts",
7
7
  "sideEffects": false,
8
8
  "files": [
9
9
  "dist",
10
- "src/**/*.ts",
11
- "src/**/*.tsx",
12
- "src/**/*.css"
10
+ "src"
13
11
  ],
14
12
  "exports": {
15
- ".": {
16
- "import": "./dist/index.mjs",
17
- "require": "./dist/index.js",
18
- "default": "./dist/index.js"
19
- },
20
- "./preset.css": "./dist/styles/preset.css",
21
- "./chatbot-sheet.css": "./dist/styles/chatbot-sheet.css"
13
+ ".": "./dist/index.mjs",
14
+ "./package.json": "./package.json",
15
+ "./chatbot-sheet.css": "./src/styles/chatbot-sheet.css",
16
+ "./preset.css": "./src/styles/preset.css"
22
17
  },
23
18
  "publishConfig": {
24
19
  "access": "public"
@@ -32,18 +27,14 @@
32
27
  "react-dom": ">=16"
33
28
  },
34
29
  "devDependencies": {
35
- "@types/node": "^20",
36
- "@types/react": "^19",
37
- "@types/react-dom": "^19",
38
- "npm-run-all": "4.1.5",
39
- "react": "19.1.0",
40
- "react-dom": "19.1.0",
41
- "tsup": "8.5.0"
30
+ "@types/node": "22.14.0",
31
+ "@types/react": "19.2.7",
32
+ "@types/react-dom": "19.2.3",
33
+ "react": "19.2.3",
34
+ "react-dom": "19.2.3"
42
35
  },
43
36
  "scripts": {
44
- "dev": "npm-run-all --parallel dev:main dev:types",
45
- "dev:main": "tsup --watch",
46
- "dev:types": "tsc -p tsconfig.build.json --watch",
47
- "build": "tsup && tsc -p tsconfig.build.json"
37
+ "dev": "tsdown --watch",
38
+ "build": "tsdown"
48
39
  }
49
40
  }
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React from "react";
2
4
  import { PROD_CHATBOT_URL } from "../lib/constants";
3
5
  import { useChatbot } from "./provider/chatbot-provider";