@instockng/storefront-ui 1.0.113 → 1.0.115

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 (186) hide show
  1. package/dist/components/AssistantDrawer.d.ts.map +1 -1
  2. package/dist/index100.mjs +8 -67
  3. package/dist/index101.mjs +71 -83
  4. package/dist/index102.mjs +3 -28
  5. package/dist/index103.mjs +2 -9
  6. package/dist/index104.mjs +78 -70
  7. package/dist/index105.mjs +53 -3
  8. package/dist/index106.mjs +6 -2
  9. package/dist/index107.mjs +4 -82
  10. package/dist/index108.mjs +176 -51
  11. package/dist/index109.mjs +53 -6
  12. package/dist/index110.mjs +69 -5
  13. package/dist/index111.mjs +37 -179
  14. package/dist/index112.mjs +41 -51
  15. package/dist/index113.mjs +2 -69
  16. package/dist/index115.mjs +1 -1
  17. package/dist/index116.mjs +1 -1
  18. package/dist/index117.mjs +6 -6
  19. package/dist/index118.mjs +4 -4
  20. package/dist/index119.mjs +3 -3
  21. package/dist/index120.mjs +1 -1
  22. package/dist/index121.mjs +1 -1
  23. package/dist/index122.mjs +1 -1
  24. package/dist/index123.mjs +2 -2
  25. package/dist/index124.mjs +2 -2
  26. package/dist/index125.mjs +3 -3
  27. package/dist/index126.mjs +1 -1
  28. package/dist/index127.mjs +3 -3
  29. package/dist/index128.mjs +2 -2
  30. package/dist/index129.mjs +2 -2
  31. package/dist/index130.mjs +1 -1
  32. package/dist/index131.mjs +3 -3
  33. package/dist/index132.mjs +1 -1
  34. package/dist/index133.mjs +1 -1
  35. package/dist/index134.mjs +3 -3
  36. package/dist/index135.mjs +2 -2
  37. package/dist/index136.mjs +4 -4
  38. package/dist/index137.mjs +1 -1
  39. package/dist/index138.mjs +3 -3
  40. package/dist/index139.mjs +4 -4
  41. package/dist/index140.mjs +1 -1
  42. package/dist/index141.mjs +1 -1
  43. package/dist/index142.mjs +1 -1
  44. package/dist/index143.mjs +1 -1
  45. package/dist/index144.mjs +1 -1
  46. package/dist/index145.mjs +1 -1
  47. package/dist/index146.mjs +1 -1
  48. package/dist/index147.mjs +2 -2
  49. package/dist/index148.mjs +3 -3
  50. package/dist/index151.mjs +1 -1
  51. package/dist/index153.mjs +21 -2
  52. package/dist/index154.mjs +56 -2
  53. package/dist/index155.mjs +29 -2
  54. package/dist/index156.mjs +7 -2
  55. package/dist/index157.mjs +50 -16
  56. package/dist/index158.mjs +6 -32
  57. package/dist/index159.mjs +11 -37
  58. package/dist/index160.mjs +7 -18
  59. package/dist/index161.mjs +28 -18
  60. package/dist/index162.mjs +2 -2
  61. package/dist/index163.mjs +70 -20
  62. package/dist/index164.mjs +163 -42
  63. package/dist/index165.mjs +2 -2
  64. package/dist/index166.mjs +2 -30
  65. package/dist/index167.mjs +2 -18
  66. package/dist/index168.mjs +18 -2
  67. package/dist/index169.mjs +32 -2
  68. package/dist/index170.mjs +38 -2
  69. package/dist/index171.mjs +18 -2
  70. package/dist/index172.mjs +13 -67
  71. package/dist/index173.mjs +2 -2
  72. package/dist/index174.mjs +15 -48
  73. package/dist/index175.mjs +46 -2
  74. package/dist/index176.mjs +2 -36
  75. package/dist/index177.mjs +20 -142
  76. package/dist/index178.mjs +18 -2
  77. package/dist/index179.mjs +2 -2
  78. package/dist/index180.mjs +2 -19
  79. package/dist/index182.mjs +2 -2
  80. package/dist/index183.mjs +64 -18
  81. package/dist/index184.mjs +2 -2
  82. package/dist/index185.mjs +53 -2
  83. package/dist/index186.mjs +2 -24
  84. package/dist/index187.mjs +28 -15
  85. package/dist/index188.mjs +152 -2
  86. package/dist/index189.mjs +2 -2
  87. package/dist/index190.mjs +2 -2
  88. package/dist/index191.mjs +10 -14
  89. package/dist/index192.mjs +2 -2
  90. package/dist/index193.mjs +2 -23
  91. package/dist/index194.mjs +26 -2
  92. package/dist/index195.mjs +2 -2
  93. package/dist/index196.mjs +2 -2
  94. package/dist/index197.mjs +17 -16
  95. package/dist/index198.mjs +23 -2
  96. package/dist/index199.mjs +2 -23
  97. package/dist/index200.mjs +2 -2
  98. package/dist/index201.mjs +2 -2
  99. package/dist/index202.mjs +23 -2
  100. package/dist/index203.mjs +2 -2
  101. package/dist/index204.mjs +23 -2
  102. package/dist/index205.mjs +2 -2
  103. package/dist/index206.mjs +2 -2
  104. package/dist/index207.mjs +2 -2
  105. package/dist/index208.mjs +20 -124
  106. package/dist/index209.mjs +2 -2
  107. package/dist/index210.mjs +20 -71
  108. package/dist/index211.mjs +2 -74
  109. package/dist/index212.mjs +2 -21
  110. package/dist/index213.mjs +2 -56
  111. package/dist/index214.mjs +2 -29
  112. package/dist/index215.mjs +2 -7
  113. package/dist/index216.mjs +2 -52
  114. package/dist/index217.mjs +2 -6
  115. package/dist/index218.mjs +2 -12
  116. package/dist/index219.mjs +127 -7
  117. package/dist/index22.mjs +139 -131
  118. package/dist/index220.mjs +2 -28
  119. package/dist/index221.mjs +74 -2
  120. package/dist/index222.mjs +73 -69
  121. package/dist/index223.mjs +2 -167
  122. package/dist/index224.mjs +31 -2
  123. package/dist/index225.mjs +11 -2
  124. package/dist/index226.mjs +4 -2
  125. package/dist/index227.mjs +4 -2
  126. package/dist/index228.mjs +13 -2
  127. package/dist/index229.mjs +7 -2
  128. package/dist/index230.mjs +12 -2
  129. package/dist/index231.mjs +5 -2
  130. package/dist/index232.mjs +33 -244
  131. package/dist/index233.mjs +31 -2
  132. package/dist/index234.mjs +27 -32
  133. package/dist/index235.mjs +59 -63
  134. package/dist/index236.mjs +2 -25
  135. package/dist/index237.mjs +2 -2
  136. package/dist/index238.mjs +2 -2
  137. package/dist/index239.mjs +2 -37
  138. package/dist/index240.mjs +2 -2
  139. package/dist/index242.mjs +2 -2
  140. package/dist/index243.mjs +2 -2
  141. package/dist/index244.mjs +108 -2
  142. package/dist/index246.mjs +2 -2
  143. package/dist/index247.mjs +25 -96
  144. package/dist/index248.mjs +2 -2
  145. package/dist/index250.mjs +244 -2
  146. package/dist/index251.mjs +2 -2
  147. package/dist/index252.mjs +33 -2
  148. package/dist/index253.mjs +65 -2
  149. package/dist/index254.mjs +25 -4
  150. package/dist/index255.mjs +2 -13
  151. package/dist/index256.mjs +2 -7
  152. package/dist/index257.mjs +2 -31
  153. package/dist/index258.mjs +2 -11
  154. package/dist/index259.mjs +2 -4
  155. package/dist/index260.mjs +2 -4
  156. package/dist/index261.mjs +2 -12
  157. package/dist/index262.mjs +2 -5
  158. package/dist/index263.mjs +2 -33
  159. package/dist/index264.mjs +4 -31
  160. package/dist/index265.mjs +2 -28
  161. package/dist/index266.mjs +2 -61
  162. package/dist/index267.mjs +2 -2
  163. package/dist/index271.mjs +2 -2
  164. package/dist/index272.mjs +2 -2
  165. package/dist/index273.mjs +2 -2
  166. package/dist/index274.mjs +2 -91
  167. package/dist/index275.mjs +91 -2
  168. package/dist/index276.mjs +2 -1
  169. package/dist/index277.mjs +2 -3
  170. package/dist/index278.mjs +2 -2
  171. package/dist/index279.mjs +17 -2
  172. package/dist/index280.mjs +11 -15
  173. package/dist/index281.mjs +6 -13
  174. package/dist/index282.mjs +30 -6
  175. package/dist/index283.mjs +2 -30
  176. package/dist/index63.mjs +17 -17
  177. package/dist/index64.mjs +2 -2
  178. package/dist/index85.mjs +1 -1
  179. package/dist/index94.mjs +235 -2
  180. package/dist/index95.mjs +6 -37
  181. package/dist/index96.mjs +130 -39
  182. package/dist/index97.mjs +62 -229
  183. package/dist/index98.mjs +86 -5
  184. package/dist/index99.mjs +26 -131
  185. package/package.json +1 -1
  186. package/src/components/AssistantDrawer.tsx +23 -7
package/dist/index219.mjs CHANGED
@@ -1,10 +1,130 @@
1
1
  'use client';
2
- import o from "./index255.mjs";
3
- import * as t from "./index256.mjs";
4
- const m = {
5
- ...t,
6
- ...o
7
- };
2
+ import { __module as b } from "./index263.mjs";
3
+ import S from "./index264.mjs";
4
+ var _;
5
+ function $() {
6
+ return _ ? b.exports : (_ = 1, (() => {
7
+ var O = { 154: (t, m, n) => {
8
+ var i = n(781), u = ["write", "end", "destroy"], f = ["resume", "pause"], l = ["data", "close"], c = Array.prototype.slice;
9
+ t.exports = s;
10
+ function r(o, a) {
11
+ if (o.forEach)
12
+ return o.forEach(a);
13
+ for (var e = 0; e < o.length; e++)
14
+ a(o[e], e);
15
+ }
16
+ function s(o, a) {
17
+ var e = new i(), d = !1;
18
+ return r(u, x), r(f, z), r(l, E), a.on("end", F), o.on("drain", function() {
19
+ e.emit("drain");
20
+ }), o.on("error", w), a.on("error", w), e.writable = o.writable, e.readable = a.readable, e;
21
+ function x(p) {
22
+ e[p] = h;
23
+ function h() {
24
+ return o[p].apply(o, arguments);
25
+ }
26
+ }
27
+ function z(p) {
28
+ e[p] = h;
29
+ function h() {
30
+ e.emit(p);
31
+ var y = a[p];
32
+ if (y)
33
+ return y.apply(a, arguments);
34
+ a.emit(p);
35
+ }
36
+ }
37
+ function E(p) {
38
+ a.on(p, h);
39
+ function h() {
40
+ var y = c.call(arguments);
41
+ y.unshift(p), e.emit.apply(e, y);
42
+ }
43
+ }
44
+ function F() {
45
+ if (!d) {
46
+ d = !0;
47
+ var p = c.call(arguments);
48
+ p.unshift("end"), e.emit.apply(e, p);
49
+ }
50
+ }
51
+ function w(p) {
52
+ e.emit("error", p);
53
+ }
54
+ }
55
+ }, 349: (t, m, n) => {
56
+ const i = n(147), u = n(781), f = n(796), l = n(154), c = n(530), r = (s) => Object.assign({ level: 9 }, s);
57
+ t.exports = (s, o) => s ? c(f.gzip)(s, r(o)).then((a) => a.length).catch((a) => 0) : Promise.resolve(0), t.exports.sync = (s, o) => f.gzipSync(s, r(o)).length, t.exports.stream = (s) => {
58
+ const o = new u.PassThrough(), a = new u.PassThrough(), e = l(o, a);
59
+ let d = 0;
60
+ const x = f.createGzip(r(s)).on("data", (z) => {
61
+ d += z.length;
62
+ }).on("error", () => {
63
+ e.gzipSize = 0;
64
+ }).on("end", () => {
65
+ e.gzipSize = d, e.emit("gzip-size", d), a.end();
66
+ });
67
+ return o.pipe(x), o.pipe(a, { end: !1 }), e;
68
+ }, t.exports.file = (s, o) => new Promise((a, e) => {
69
+ const d = i.createReadStream(s);
70
+ d.on("error", e);
71
+ const x = d.pipe(t.exports.stream(o));
72
+ x.on("error", e), x.on("gzip-size", a);
73
+ }), t.exports.fileSync = (s, o) => t.exports.sync(i.readFileSync(s), o);
74
+ }, 530: (t) => {
75
+ const m = (n, i) => function(...u) {
76
+ const f = i.promiseModule;
77
+ return new f((l, c) => {
78
+ i.multiArgs ? u.push((...r) => {
79
+ i.errorFirst ? r[0] ? c(r) : (r.shift(), l(r)) : l(r);
80
+ }) : i.errorFirst ? u.push((r, s) => {
81
+ r ? c(r) : l(s);
82
+ }) : u.push(l), n.apply(this, u);
83
+ });
84
+ };
85
+ t.exports = (n, i) => {
86
+ i = Object.assign({ exclude: [/.+(Sync|Stream)$/], errorFirst: !0, promiseModule: Promise }, i);
87
+ const u = typeof n;
88
+ if (!(n !== null && (u === "object" || u === "function")))
89
+ throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${n === null ? "null" : u}\``);
90
+ const f = (c) => {
91
+ const r = (s) => typeof s == "string" ? c === s : s.test(c);
92
+ return i.include ? i.include.some(r) : !i.exclude.some(r);
93
+ };
94
+ let l;
95
+ u === "function" ? l = function(...c) {
96
+ return i.excludeMain ? n(...c) : m(n, i).apply(this, c);
97
+ } : l = Object.create(Object.getPrototypeOf(n));
98
+ for (const c in n) {
99
+ const r = n[c];
100
+ l[c] = typeof r == "function" && f(c) ? m(r, i) : r;
101
+ }
102
+ return l;
103
+ };
104
+ }, 147: (t) => {
105
+ t.exports = S;
106
+ }, 781: (t) => {
107
+ t.exports = S;
108
+ }, 796: (t) => {
109
+ t.exports = S;
110
+ } }, v = {};
111
+ function g(t) {
112
+ var m = v[t];
113
+ if (m !== void 0)
114
+ return m.exports;
115
+ var n = v[t] = { exports: {} }, i = !0;
116
+ try {
117
+ O[t](n, n.exports, g), i = !1;
118
+ } finally {
119
+ i && delete v[t];
120
+ }
121
+ return n.exports;
122
+ }
123
+ typeof g < "u" && (g.ab = __dirname + "/");
124
+ var j = g(349);
125
+ b.exports = j;
126
+ })(), b.exports);
127
+ }
8
128
  export {
9
- m as default
129
+ $ as __require
10
130
  };
package/dist/index22.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { jsxs as l, jsx as r } from "react/jsx-runtime";
3
- import { useState as m, useRef as b, useCallback as B, useEffect as v } from "react";
2
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
3
+ import { useState as g, useRef as x, useCallback as O, useEffect as S } from "react";
4
4
  import { createPortal as Z } from "react-dom";
5
5
  import { Sparkles as Q, X as ee, MessageCircle as te, Loader2 as re, Send as se } from "lucide-react";
6
6
  import { cn as k, formatCurrency as ne, WHATSAPP_HELP_LINK as ae } from "./index30.mjs";
@@ -8,167 +8,165 @@ import { useHideBodyOverflow as oe } from "./index53.mjs";
8
8
  function le(a) {
9
9
  return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>").replace(/\*(.+?)\*/g, "<em>$1</em>").replace(/\n/g, "<br />");
10
10
  }
11
- function ce(a) {
12
- return a.replace(/\s*PRODUCTS:[\w\-,]*\s*/g, "").replace(/\s*CONTACT_SUPPORT\s*/gi, "");
11
+ function ie(a) {
12
+ return a.replace(/\s*PRODUCTS:[\w\-,]*\s*/g, "").replace(/\s*CONTACT_SUPPORT\s*/gi, "").replace(/\s*SUGGESTIONS:[^\n]*\s*/g, "");
13
13
  }
14
- function ge({
14
+ function he({
15
15
  isOpen: a,
16
- onClose: x,
17
- apiUrl: P,
18
- brandSlug: R,
19
- productSlug: j,
20
- initialQuestion: y,
21
- assistantName: I = "AI Assistant",
22
- className: K,
23
- disablePortal: O = !1
16
+ onClose: y,
17
+ apiUrl: R,
18
+ brandSlug: j,
19
+ productSlug: I,
20
+ initialQuestion: w,
21
+ assistantName: L = "AI Assistant",
22
+ className: z,
23
+ disablePortal: B = !1
24
24
  }) {
25
- const [u, d] = m([]), [w, S] = m(""), [f, L] = m(!1), [_, h] = m(null), [$, M] = m(!1), [V, W] = m(!1), D = b(null), H = b(null), A = b(!1), J = b([]);
26
- J.current = u, oe(a);
27
- const U = B((e, c) => {
25
+ const [d, u] = g([]), [N, A] = g(""), [m, _] = g(!1), [$, h] = g(null), [M, W] = g(!1), [K, D] = g(!1), H = x(null), U = x(null), E = x(!1), J = x([]);
26
+ J.current = d, oe(a);
27
+ const q = O((e, l) => {
28
28
  if (e === "token")
29
- d((s) => {
30
- const i = [...s], t = i[i.length - 1];
31
- if ((t == null ? void 0 : t.role) === "assistant") {
32
- const n = t.content + c, o = ce(n);
33
- i[i.length - 1] = { ...t, content: o };
29
+ u((s) => {
30
+ const o = [...s], r = o[o.length - 1];
31
+ if ((r == null ? void 0 : r.role) === "assistant") {
32
+ const n = r.content + l, i = ie(n);
33
+ o[o.length - 1] = { ...r, content: i };
34
34
  }
35
- return i;
35
+ return o;
36
36
  });
37
37
  else if (e === "done")
38
38
  try {
39
- const s = JSON.parse(c);
40
- d((i) => {
41
- var o;
42
- const t = [...i], n = t[t.length - 1];
43
- return (n == null ? void 0 : n.role) === "assistant" && (t[t.length - 1] = {
39
+ const s = JSON.parse(l);
40
+ u((o) => {
41
+ var i, f;
42
+ const r = [...o], n = r[r.length - 1];
43
+ return (n == null ? void 0 : n.role) === "assistant" && (r[r.length - 1] = {
44
44
  ...n,
45
45
  content: s.answer || n.content,
46
- products: ((o = s.products) == null ? void 0 : o.length) > 0 ? s.products : void 0,
47
- whatsapp: s.whatsapp || !1
48
- }), t;
46
+ products: ((i = s.products) == null ? void 0 : i.length) > 0 ? s.products : void 0,
47
+ whatsapp: s.whatsapp || !1,
48
+ suggestions: ((f = s.suggestions) == null ? void 0 : f.length) > 0 ? s.suggestions : void 0
49
+ }), r;
49
50
  });
50
51
  } catch {
51
52
  }
52
53
  else if (e === "error")
53
54
  try {
54
- const s = JSON.parse(c);
55
+ const s = JSON.parse(l);
55
56
  h(s.message || "An error occurred");
56
57
  } catch {
57
58
  h("An error occurred");
58
59
  }
59
- }, []), N = b(null), q = B(
60
+ }, []), v = x(null), T = O(
60
61
  async (e) => {
61
- var i;
62
+ var o;
62
63
  if (!e.trim()) return;
63
64
  h(null);
64
- const c = { role: "user", content: e }, s = J.current.slice(-20).map((t) => ({
65
- role: t.role,
66
- content: t.content
65
+ const l = { role: "user", content: e }, s = J.current.slice(-20).map((r) => ({
66
+ role: r.role,
67
+ content: r.content
67
68
  }));
68
- d((t) => [...t, c]), S(""), L(!0), d((t) => [...t, { role: "assistant", content: "" }]);
69
+ u((r) => [...r, l]), A(""), _(!0), u((r) => [...r, { role: "assistant", content: "" }]);
69
70
  try {
70
- const t = await fetch(`${P}/v1/assistant/ask`, {
71
+ const r = await fetch(`${R}/v1/assistant/ask`, {
71
72
  method: "POST",
72
73
  headers: { "Content-Type": "application/json" },
73
74
  body: JSON.stringify({
74
75
  question: e,
75
- brandSlug: R,
76
- productSlug: j,
76
+ brandSlug: j,
77
+ productSlug: I,
77
78
  history: s
78
79
  })
79
80
  });
80
- if (!t.ok) {
81
- const g = await t.json().catch(() => ({}));
81
+ if (!r.ok) {
82
+ const p = await r.json().catch(() => ({}));
82
83
  throw new Error(
83
- ((i = g == null ? void 0 : g.error) == null ? void 0 : i.message) || `Request failed (${t.status})`
84
+ ((o = p == null ? void 0 : p.error) == null ? void 0 : o.message) || `Request failed (${r.status})`
84
85
  );
85
86
  }
86
- if (!t.body) throw new Error("No response body");
87
- const n = t.body.getReader(), o = new TextDecoder();
88
- let E = "", T = "";
87
+ if (!r.body) throw new Error("No response body");
88
+ const n = r.body.getReader(), i = new TextDecoder();
89
+ let f = "", C = "";
89
90
  for (; ; ) {
90
- const { done: g, value: G } = await n.read();
91
- if (g) break;
92
- E += o.decode(G, { stream: !0 });
93
- const z = E.split(`
91
+ const { done: p, value: X } = await n.read();
92
+ if (p) break;
93
+ f += i.decode(X, { stream: !0 });
94
+ const G = f.split(`
94
95
  `);
95
- E = z.pop() || "";
96
- for (const p of z) {
97
- if (p.trim() === "") {
98
- T = "";
99
- continue;
96
+ f = G.pop() || "";
97
+ for (const b of G)
98
+ if (b.trim() !== "") {
99
+ if (b.trimStart().startsWith("event:"))
100
+ C = b.trimStart().slice(6).trim();
101
+ else if (b.trimStart().startsWith("data:") && C) {
102
+ const P = b.trimStart().slice(5), Y = P.startsWith(" ") ? P.slice(1) : P;
103
+ q(C, Y);
104
+ }
100
105
  }
101
- if (p.trimStart().startsWith("event:"))
102
- T = p.trimStart().slice(6).trim();
103
- else if (p.trimStart().startsWith("data:")) {
104
- const C = p.trimStart().slice(5), Y = C.startsWith(" ") ? C.slice(1) : C;
105
- U(T || "token", Y);
106
- }
107
- }
108
106
  }
109
- } catch (t) {
110
- h(t.message || "Something went wrong"), d((n) => {
111
- const o = n[n.length - 1];
112
- return (o == null ? void 0 : o.role) === "assistant" && !o.content ? n.slice(0, -1) : n;
107
+ } catch (r) {
108
+ h(r.message || "Something went wrong"), u((n) => {
109
+ const i = n[n.length - 1];
110
+ return (i == null ? void 0 : i.role) === "assistant" && !i.content ? n.slice(0, -1) : n;
113
111
  });
114
112
  } finally {
115
- L(!1);
113
+ _(!1);
116
114
  }
117
115
  },
118
- [P, R, j, U]
116
+ [R, j, I, q]
119
117
  );
120
- N.current = q, v(() => {
118
+ v.current = T, S(() => {
121
119
  if (a)
122
- W(!0), requestAnimationFrame(() => {
120
+ D(!0), requestAnimationFrame(() => {
123
121
  requestAnimationFrame(() => {
124
- M(!0);
122
+ W(!0);
125
123
  });
126
124
  });
127
125
  else {
128
- M(!1);
126
+ W(!1);
129
127
  const e = setTimeout(() => {
130
- W(!1), d([]), S(""), h(null), A.current = !1;
128
+ D(!1), u([]), A(""), h(null), E.current = !1;
131
129
  }, 300);
132
130
  return () => clearTimeout(e);
133
131
  }
134
- }, [a]), v(() => {
135
- a && y && !A.current && (A.current = !0, y.trim() ? setTimeout(() => {
132
+ }, [a]), S(() => {
133
+ a && w && !E.current && (E.current = !0, w.trim() ? setTimeout(() => {
136
134
  var e;
137
- return (e = N.current) == null ? void 0 : e.call(N, y);
135
+ return (e = v.current) == null ? void 0 : e.call(v, w);
138
136
  }, 100) : setTimeout(() => {
139
137
  var e;
140
- return (e = H.current) == null ? void 0 : e.focus();
138
+ return (e = U.current) == null ? void 0 : e.focus();
141
139
  }, 350));
142
- }, [a, y]), v(() => {
140
+ }, [a, w]), S(() => {
143
141
  var e;
144
- (e = D.current) == null || e.scrollIntoView({ behavior: "smooth" });
145
- }, [u]), v(() => {
146
- const e = (c) => {
147
- c.key === "Escape" && a && x();
142
+ (e = H.current) == null || e.scrollIntoView({ behavior: "smooth" });
143
+ }, [d]), S(() => {
144
+ const e = (l) => {
145
+ l.key === "Escape" && a && y();
148
146
  };
149
147
  if (a)
150
148
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
151
- }, [a, x]);
152
- const X = (e) => {
153
- e.preventDefault(), w.trim() && q(w.trim());
149
+ }, [a, y]);
150
+ const V = (e) => {
151
+ e.preventDefault(), N.trim() && T(N.trim());
154
152
  };
155
- if (!V) return null;
156
- const F = /* @__PURE__ */ l(
153
+ if (!K) return null;
154
+ const F = /* @__PURE__ */ c(
157
155
  "div",
158
156
  {
159
157
  className: k(
160
158
  "fixed inset-0 z-50 transition-opacity duration-300",
161
- $ ? "opacity-100" : "opacity-0"
159
+ M ? "opacity-100" : "opacity-0"
162
160
  ),
163
161
  children: [
164
- /* @__PURE__ */ r(
162
+ /* @__PURE__ */ t(
165
163
  "div",
166
164
  {
167
165
  className: "absolute inset-0 bg-black/40 backdrop-blur-sm",
168
- onClick: x
166
+ onClick: y
169
167
  }
170
168
  ),
171
- /* @__PURE__ */ l(
169
+ /* @__PURE__ */ c(
172
170
  "div",
173
171
  {
174
172
  className: k(
@@ -178,57 +176,57 @@ function ge({
178
176
  // Desktop: left side drawer
179
177
  "sm:inset-y-0 sm:left-0 sm:right-auto sm:w-[420px] sm:max-w-full sm:rounded-t-none sm:rounded-r-2xl",
180
178
  // Animation
181
- $ ? "translate-y-0 sm:translate-x-0" : "translate-y-full sm:translate-y-0 sm:-translate-x-full",
182
- K
179
+ M ? "translate-y-0 sm:translate-x-0" : "translate-y-full sm:translate-y-0 sm:-translate-x-full",
180
+ z
183
181
  ),
184
182
  children: [
185
- /* @__PURE__ */ l("div", { className: "flex items-center justify-between border-b border-gray-200 px-4 py-3 flex-shrink-0", children: [
186
- /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
187
- /* @__PURE__ */ r(Q, { className: "h-5 w-5 text-orange-500" }),
188
- /* @__PURE__ */ r("span", { className: "font-semibold text-gray-900", children: I }),
189
- /* @__PURE__ */ r("span", { className: "text-xs text-gray-400 bg-gray-100 rounded px-1.5 py-0.5", children: "beta" })
183
+ /* @__PURE__ */ c("div", { className: "flex items-center justify-between border-b border-gray-200 px-4 py-3 flex-shrink-0", children: [
184
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: [
185
+ /* @__PURE__ */ t(Q, { className: "h-5 w-5 text-orange-500" }),
186
+ /* @__PURE__ */ t("span", { className: "font-semibold text-gray-900", children: L }),
187
+ /* @__PURE__ */ t("span", { className: "text-xs text-gray-400 bg-gray-100 rounded px-1.5 py-0.5", children: "beta" })
190
188
  ] }),
191
- /* @__PURE__ */ r(
189
+ /* @__PURE__ */ t(
192
190
  "button",
193
191
  {
194
192
  type: "button",
195
- onClick: x,
193
+ onClick: y,
196
194
  className: "p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-lg transition-colors",
197
195
  "aria-label": "Close",
198
- children: /* @__PURE__ */ r(ee, { className: "h-5 w-5" })
196
+ children: /* @__PURE__ */ t(ee, { className: "h-5 w-5" })
199
197
  }
200
198
  )
201
199
  ] }),
202
- /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 min-h-0", children: [
203
- u.length === 0 && !f && /* @__PURE__ */ r("div", { className: "text-center text-gray-400 text-sm py-8", children: "Ask me anything about our products!" }),
204
- u.map((e, c) => /* @__PURE__ */ r("div", { children: e.role === "user" ? /* @__PURE__ */ r("div", { className: "flex justify-end", children: /* @__PURE__ */ r("div", { className: "bg-gray-800 text-white rounded-2xl rounded-br-sm px-4 py-2 max-w-[80%] text-sm", children: e.content }) }) : /* @__PURE__ */ l("div", { className: "space-y-3", children: [
205
- /* @__PURE__ */ l("div", { className: "text-sm text-gray-800 leading-relaxed", children: [
206
- /* @__PURE__ */ r("span", { dangerouslySetInnerHTML: { __html: le(e.content) } }),
207
- f && c === u.length - 1 && /* @__PURE__ */ r("span", { className: "inline-block w-1.5 h-4 bg-gray-400 animate-pulse ml-0.5 align-text-bottom" })
200
+ /* @__PURE__ */ c("div", { className: "flex-1 overflow-y-auto p-4 space-y-4 min-h-0", children: [
201
+ d.length === 0 && !m && /* @__PURE__ */ t("div", { className: "text-center text-gray-400 text-sm py-8", children: "Ask me anything about our products!" }),
202
+ d.map((e, l) => /* @__PURE__ */ t("div", { children: e.role === "user" ? /* @__PURE__ */ t("div", { className: "flex justify-end", children: /* @__PURE__ */ t("div", { className: "bg-gray-800 text-white rounded-2xl rounded-br-sm px-4 py-2 max-w-[80%] text-sm", children: e.content }) }) : /* @__PURE__ */ c("div", { className: "space-y-3", children: [
203
+ /* @__PURE__ */ c("div", { className: "text-sm text-gray-800 leading-relaxed", children: [
204
+ /* @__PURE__ */ t("span", { dangerouslySetInnerHTML: { __html: le(e.content) } }),
205
+ m && l === d.length - 1 && /* @__PURE__ */ t("span", { className: "inline-block w-1.5 h-4 bg-gray-400 animate-pulse ml-0.5 align-text-bottom" })
208
206
  ] }),
209
- e.products && e.products.length > 0 && /* @__PURE__ */ r("div", { className: "space-y-2", children: e.products.map((s) => /* @__PURE__ */ l(
207
+ e.products && e.products.length > 0 && /* @__PURE__ */ t("div", { className: "space-y-2", children: e.products.map((s) => /* @__PURE__ */ c(
210
208
  "a",
211
209
  {
212
210
  href: `/product/${s.slug}`,
213
211
  className: "flex items-center gap-3 w-full rounded-xl border border-gray-200 p-2 hover:bg-gray-50 transition-colors text-left no-underline",
214
212
  children: [
215
- s.thumbnailUrl ? /* @__PURE__ */ r(
213
+ s.thumbnailUrl ? /* @__PURE__ */ t(
216
214
  "img",
217
215
  {
218
216
  src: s.thumbnailUrl,
219
217
  alt: s.name,
220
218
  className: "h-16 w-16 rounded-lg object-cover flex-shrink-0"
221
219
  }
222
- ) : /* @__PURE__ */ r("div", { className: "h-16 w-16 rounded-lg bg-gray-100 flex-shrink-0" }),
223
- /* @__PURE__ */ l("div", { className: "min-w-0", children: [
224
- /* @__PURE__ */ r("p", { className: "text-sm font-medium text-gray-900 line-clamp-2", children: s.name }),
225
- /* @__PURE__ */ r("p", { className: "text-sm font-semibold text-blue-600", children: ne(s.price) })
220
+ ) : /* @__PURE__ */ t("div", { className: "h-16 w-16 rounded-lg bg-gray-100 flex-shrink-0" }),
221
+ /* @__PURE__ */ c("div", { className: "min-w-0", children: [
222
+ /* @__PURE__ */ t("p", { className: "text-sm font-medium text-gray-900 line-clamp-2", children: s.name }),
223
+ /* @__PURE__ */ t("p", { className: "text-sm font-semibold text-blue-600", children: ne(s.price) })
226
224
  ] })
227
225
  ]
228
226
  },
229
227
  s.slug
230
228
  )) }),
231
- e.whatsapp && /* @__PURE__ */ l(
229
+ e.whatsapp && /* @__PURE__ */ c(
232
230
  "a",
233
231
  {
234
232
  href: ae,
@@ -236,25 +234,35 @@ function ge({
236
234
  rel: "noopener noreferrer",
237
235
  className: "inline-flex items-center gap-2 rounded-full bg-green-500 px-4 py-2 text-sm font-medium text-white hover:bg-green-600 transition-colors no-underline",
238
236
  children: [
239
- /* @__PURE__ */ r(te, { className: "h-4 w-4" }),
237
+ /* @__PURE__ */ t(te, { className: "h-4 w-4" }),
240
238
  "Chat on WhatsApp"
241
239
  ]
242
240
  }
243
- )
244
- ] }) }, c)),
245
- _ && /* @__PURE__ */ r("div", { className: "rounded-lg bg-red-50 border border-red-200 p-3 text-sm text-red-700", children: _ }),
246
- /* @__PURE__ */ r("div", { ref: D })
241
+ ),
242
+ e.suggestions && e.suggestions.length > 0 && !m && l === d.length - 1 && /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: e.suggestions.map((s, o) => /* @__PURE__ */ t(
243
+ "button",
244
+ {
245
+ type: "button",
246
+ onClick: () => T(s),
247
+ className: "rounded-full border border-gray-200 bg-gray-50 px-3 py-1.5 text-xs text-gray-700 hover:bg-gray-100 hover:border-gray-300 transition-colors text-left",
248
+ children: s
249
+ },
250
+ o
251
+ )) })
252
+ ] }) }, l)),
253
+ $ && /* @__PURE__ */ t("div", { className: "rounded-lg bg-red-50 border border-red-200 p-3 text-sm text-red-700", children: $ }),
254
+ /* @__PURE__ */ t("div", { ref: H })
247
255
  ] }),
248
- /* @__PURE__ */ r("div", { className: "border-t border-gray-200 p-3 flex-shrink-0", children: /* @__PURE__ */ l("form", { onSubmit: X, className: "flex items-center gap-2", children: [
249
- /* @__PURE__ */ r(
256
+ /* @__PURE__ */ t("div", { className: "border-t border-gray-200 p-3 flex-shrink-0", children: /* @__PURE__ */ c("form", { onSubmit: V, className: "flex items-center gap-2", children: [
257
+ /* @__PURE__ */ t(
250
258
  "input",
251
259
  {
252
- ref: H,
260
+ ref: U,
253
261
  type: "text",
254
- value: w,
255
- onChange: (e) => S(e.target.value),
256
- placeholder: `Ask ${I} a question`,
257
- disabled: f,
262
+ value: N,
263
+ onChange: (e) => A(e.target.value),
264
+ placeholder: `Ask ${L} a question`,
265
+ disabled: m,
258
266
  className: k(
259
267
  "flex-1 rounded-full border border-gray-300 px-4 py-2.5 text-sm",
260
268
  "focus:border-blue-400 focus:outline-none focus:ring-2 focus:ring-blue-400/30",
@@ -262,18 +270,18 @@ function ge({
262
270
  )
263
271
  }
264
272
  ),
265
- /* @__PURE__ */ r(
273
+ /* @__PURE__ */ t(
266
274
  "button",
267
275
  {
268
276
  type: "submit",
269
- disabled: !w.trim() || f,
277
+ disabled: !N.trim() || m,
270
278
  className: k(
271
279
  "flex h-10 w-10 items-center justify-center rounded-full",
272
280
  "bg-gray-800 text-white",
273
281
  "hover:bg-gray-700 transition-colors",
274
282
  "disabled:opacity-40 disabled:cursor-not-allowed"
275
283
  ),
276
- children: f ? /* @__PURE__ */ r(re, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ r(se, { className: "h-4 w-4" })
284
+ children: m ? /* @__PURE__ */ t(re, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ t(se, { className: "h-4 w-4" })
277
285
  }
278
286
  )
279
287
  ] }) })
@@ -283,8 +291,8 @@ function ge({
283
291
  ]
284
292
  }
285
293
  );
286
- return O ? F : Z(F, document.body);
294
+ return B ? F : Z(F, document.body);
287
295
  }
288
296
  export {
289
- ge as AssistantDrawer
297
+ he as AssistantDrawer
290
298
  };
package/dist/index220.mjs CHANGED
@@ -1,31 +1,5 @@
1
1
  'use client';
2
- import n from "./index97.mjs";
3
- const a = n.toObjectSet([
4
- "age",
5
- "authorization",
6
- "content-length",
7
- "content-type",
8
- "etag",
9
- "expires",
10
- "from",
11
- "host",
12
- "if-modified-since",
13
- "if-unmodified-since",
14
- "last-modified",
15
- "location",
16
- "max-forwards",
17
- "proxy-authorization",
18
- "referer",
19
- "retry-after",
20
- "user-agent"
21
- ]), u = (s) => {
22
- const t = {};
23
- let e, r, i;
24
- return s && s.split(`
25
- `).forEach(function(o) {
26
- i = o.indexOf(":"), e = o.substring(0, i).trim().toLowerCase(), r = o.substring(i + 1).trim(), !(!e || t[e] && a[e]) && (e === "set-cookie" ? t[e] ? t[e].push(r) : t[e] = [r] : t[e] = t[e] ? t[e] + ", " + r : r);
27
- }), t;
28
- };
2
+ var e = { exports: {} };
29
3
  export {
30
- u as default
4
+ e as __module
31
5
  };