@walkspan/chatbot 0.2.0 → 0.2.2

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/dist/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/index.js
@@ -25,7 +35,7 @@ __export(index_exports, {
25
35
  module.exports = __toCommonJS(index_exports);
26
36
 
27
37
  // src/chatbot.jsx
28
- var import_react = require("react");
38
+ var import_react = __toESM(require("react"));
29
39
  var import_fa = require("react-icons/fa");
30
40
  var FloatingChatbot = ({
31
41
  apiUrl,
@@ -89,27 +99,27 @@ var FloatingChatbot = ({
89
99
  setInputMessage("");
90
100
  }
91
101
  };
92
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
102
+ return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, /* @__PURE__ */ import_react.default.createElement(
93
103
  "button",
94
104
  {
95
105
  onClick: () => setOpen(true),
96
106
  className: `fixed z-50 ${positionClasses[position]} w-14 h-14 rounded-full bg-[#f1592a] text-white shadow-lg flex items-center justify-center`
97
107
  },
98
- /* @__PURE__ */ React.createElement(import_fa.FaComments, { size: 22 })
99
- ), open && /* @__PURE__ */ React.createElement(
108
+ /* @__PURE__ */ import_react.default.createElement(import_fa.FaComments, { size: 22 })
109
+ ), open && /* @__PURE__ */ import_react.default.createElement(
100
110
  "div",
101
111
  {
102
112
  className: `fixed z-50 ${positionClasses[position]} w-96 max-w-[90vw] h-[500px] bg-white rounded-xl shadow-xl flex flex-col`
103
113
  },
104
- /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between p-4 border-b bg-[#f1592a] text-white rounded-t-xl" }, /* @__PURE__ */ React.createElement("div", { className: "font-medium" }, title), /* @__PURE__ */ React.createElement("button", { onClick: () => setOpen(false) }, /* @__PURE__ */ React.createElement(import_fa.FaTimes, null))),
105
- /* @__PURE__ */ React.createElement("div", { className: "flex-1 p-4 overflow-y-auto space-y-2" }, messages.map((m) => /* @__PURE__ */ React.createElement(
114
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "flex items-center justify-between p-4 border-b bg-[#f1592a] text-white rounded-t-xl" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "font-medium" }, title), /* @__PURE__ */ import_react.default.createElement("button", { onClick: () => setOpen(false) }, /* @__PURE__ */ import_react.default.createElement(import_fa.FaTimes, null))),
115
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "flex-1 p-4 overflow-y-auto space-y-2" }, messages.map((m) => /* @__PURE__ */ import_react.default.createElement(
106
116
  "div",
107
117
  {
108
118
  key: m.id,
109
119
  className: `max-w-[80%] py-2 px-5 rounded-3xl text-sm ${m.type === "user" ? "ml-auto bg-[#edf0f6] text-black" : "bg-[#f1592a] text-white"}`
110
120
  },
111
121
  m == null ? void 0 : m.message,
112
- m.type !== "user" && m.link && /* @__PURE__ */ React.createElement(
122
+ m.type !== "user" && m.link && /* @__PURE__ */ import_react.default.createElement(
113
123
  "a",
114
124
  {
115
125
  href: m.link,
@@ -119,8 +129,8 @@ var FloatingChatbot = ({
119
129
  },
120
130
  m.link
121
131
  )
122
- )), isLoading && /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 text-gray-400" }, /* @__PURE__ */ React.createElement(import_fa.FaRobot, null), " Typing..."), /* @__PURE__ */ React.createElement("div", { ref: messagesEndRef })),
123
- /* @__PURE__ */ React.createElement("div", { className: "p-3 border-t" }, /* @__PURE__ */ React.createElement("div", { className: "flex gap-2 border rounded-full p-2" }, /* @__PURE__ */ React.createElement(
132
+ )), isLoading && /* @__PURE__ */ import_react.default.createElement("div", { className: "flex items-center gap-2 text-gray-400" }, /* @__PURE__ */ import_react.default.createElement(import_fa.FaRobot, null), " Typing..."), /* @__PURE__ */ import_react.default.createElement("div", { ref: messagesEndRef })),
133
+ /* @__PURE__ */ import_react.default.createElement("div", { className: "p-3 border-t" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "flex gap-2 border rounded-full p-2" }, /* @__PURE__ */ import_react.default.createElement(
124
134
  "input",
125
135
  {
126
136
  value: inputMessage,
@@ -129,13 +139,13 @@ var FloatingChatbot = ({
129
139
  className: "flex-1 outline-none focus:ring-0 text-sm",
130
140
  onKeyDown: (e) => e.key === "Enter" && sendMessage()
131
141
  }
132
- ), /* @__PURE__ */ React.createElement(
142
+ ), /* @__PURE__ */ import_react.default.createElement(
133
143
  "button",
134
144
  {
135
145
  onClick: sendMessage,
136
146
  className: "px-3"
137
147
  },
138
- /* @__PURE__ */ React.createElement(import_fa.FaPaperPlane, { color: "#f1592a" })
148
+ /* @__PURE__ */ import_react.default.createElement(import_fa.FaPaperPlane, { color: "#f1592a" })
139
149
  )))
140
150
  ));
141
151
  };
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/chatbot.jsx
2
- import { useState, useRef, useEffect } from "react";
2
+ import React, { useState, useRef, useEffect } from "react";
3
3
  import { FaPaperPlane, FaRobot, FaComments, FaTimes } from "react-icons/fa";
4
4
  var FloatingChatbot = ({
5
5
  apiUrl,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walkspan/chatbot",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "files": [