@rekayasa/erica-bubble 1.2.0 → 1.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.mjs CHANGED
@@ -7438,7 +7438,7 @@ var K = class extends Error {
7438
7438
  };
7439
7439
  K.prototype.file = "", K.prototype.name = "", K.prototype.reason = "", K.prototype.message = "", K.prototype.stack = "", K.prototype.column = void 0, K.prototype.line = void 0, K.prototype.ancestors = void 0, K.prototype.cause = void 0, K.prototype.fatal = void 0, K.prototype.place = void 0, K.prototype.ruleId = void 0, K.prototype.source = void 0;
7440
7440
  //#endregion
7441
- //#region ../../node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6/node_modules/hast-util-to-jsx-runtime/lib/index.js
7441
+ //#region ../../node_modules/.pnpm/hast-util-to-jsx-runtime@2.3.6_supports-color@8.1.1/node_modules/hast-util-to-jsx-runtime/lib/index.js
7442
7442
  var Xl = /* @__PURE__ */ ae(Vl(), 1), Zl = {}.hasOwnProperty, Ql = /* @__PURE__ */ new Map(), $l = /[A-Z]/g, eu = new Set([
7443
7443
  "table",
7444
7444
  "tbody",
@@ -7838,7 +7838,7 @@ function Q(e, t, n, r) {
7838
7838
  }
7839
7839
  }
7840
7840
  //#endregion
7841
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/content.js
7841
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/initialize/content.js
7842
7842
  var Yu = { tokenize: Xu };
7843
7843
  function Xu(e) {
7844
7844
  let t = e.attempt(this.parser.constructs.contentInitial, r, i), n;
@@ -7869,7 +7869,7 @@ function Xu(e) {
7869
7869
  }
7870
7870
  }
7871
7871
  //#endregion
7872
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/document.js
7872
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/initialize/document.js
7873
7873
  var Zu = { tokenize: $u }, Qu = { tokenize: ed };
7874
7874
  function $u(e) {
7875
7875
  let t = this, n = [], r = 0, i, a, o;
@@ -9315,7 +9315,7 @@ function Rf(e, t, n) {
9315
9315
  }
9316
9316
  }
9317
9317
  //#endregion
9318
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/flow.js
9318
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/initialize/flow.js
9319
9319
  var zf = { tokenize: Bf };
9320
9320
  function Bf(e) {
9321
9321
  let t = this, n = e.attempt(ld, r, e.attempt(this.parser.constructs.flowInitial, i, Q(e, e.attempt(this.parser.constructs.flow, i, e.attempt(Fd, i)), "linePrefix")));
@@ -9336,7 +9336,7 @@ function Bf(e) {
9336
9336
  }
9337
9337
  }
9338
9338
  //#endregion
9339
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/initialize/text.js
9339
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/initialize/text.js
9340
9340
  var Vf = { resolveAll: Gf() }, Hf = Wf("string"), Uf = Wf("text");
9341
9341
  function Wf(e) {
9342
9342
  return {
@@ -9421,7 +9421,7 @@ function Kf(e, t) {
9421
9421
  return e;
9422
9422
  }
9423
9423
  //#endregion
9424
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/constructs.js
9424
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/constructs.js
9425
9425
  var qf = /* @__PURE__ */ re({
9426
9426
  attentionMarkers: () => tp,
9427
9427
  contentInitial: () => Yf,
@@ -9478,7 +9478,7 @@ var qf = /* @__PURE__ */ re({
9478
9478
  96: Dd
9479
9479
  }, ep = { null: [rd, Vf] }, tp = { null: [42, 95] }, np = { null: [] };
9480
9480
  //#endregion
9481
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/create-tokenizer.js
9481
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/create-tokenizer.js
9482
9482
  function rp(e, t, n) {
9483
9483
  let r = {
9484
9484
  _bufferIndex: -1,
@@ -9651,7 +9651,7 @@ function ap(e, t) {
9651
9651
  return r.join("");
9652
9652
  }
9653
9653
  //#endregion
9654
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/parse.js
9654
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/parse.js
9655
9655
  function op(e) {
9656
9656
  let t = {
9657
9657
  constructs: Fu([qf, ...(e || {}).extensions || []]),
@@ -9672,13 +9672,13 @@ function op(e) {
9672
9672
  }
9673
9673
  }
9674
9674
  //#endregion
9675
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/postprocess.js
9675
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/postprocess.js
9676
9676
  function sp(e) {
9677
9677
  for (; !Nd(e););
9678
9678
  return e;
9679
9679
  }
9680
9680
  //#endregion
9681
- //#region ../../node_modules/.pnpm/micromark@4.0.2/node_modules/micromark/lib/preprocess.js
9681
+ //#region ../../node_modules/.pnpm/micromark@4.0.2_supports-color@8.1.1/node_modules/micromark/lib/preprocess.js
9682
9682
  var cp = /[\0\t\n\r]/g;
9683
9683
  function lp() {
9684
9684
  let e = 1, t = "", n = !0, r;
@@ -9723,7 +9723,7 @@ function fp(e, t, n) {
9723
9723
  return ju(n) || e;
9724
9724
  }
9725
9725
  //#endregion
9726
- //#region ../../node_modules/.pnpm/mdast-util-from-markdown@2.0.3/node_modules/mdast-util-from-markdown/lib/index.js
9726
+ //#region ../../node_modules/.pnpm/mdast-util-from-markdown@2.0.3_supports-color@8.1.1/node_modules/mdast-util-from-markdown/lib/index.js
9727
9727
  var pp = {}.hasOwnProperty;
9728
9728
  function mp(e, t, n) {
9729
9729
  return t && typeof t == "object" && (n = t, t = void 0), hp(n)(sp(op(n).document().write(lp()(e, t, !0))));
@@ -10270,7 +10270,7 @@ function yp(e, t) {
10270
10270
  }) + ") is still open");
10271
10271
  }
10272
10272
  //#endregion
10273
- //#region ../../node_modules/.pnpm/remark-parse@11.0.0/node_modules/remark-parse/lib/index.js
10273
+ //#region ../../node_modules/.pnpm/remark-parse@11.0.0_supports-color@8.1.1/node_modules/remark-parse/lib/index.js
10274
10274
  function bp(e) {
10275
10275
  let t = this;
10276
10276
  t.parser = n;
@@ -11694,7 +11694,7 @@ function vh(e) {
11694
11694
  return !!(e && typeof e == "object" && "byteLength" in e && "byteOffset" in e);
11695
11695
  }
11696
11696
  //#endregion
11697
- //#region ../../node_modules/.pnpm/react-markdown@10.1.0_@types+react@18.3.1_react@18.3.1/node_modules/react-markdown/lib/index.js
11697
+ //#region ../../node_modules/.pnpm/react-markdown@10.1.0_@types+react@18.3.1_react@18.3.1_supports-color@8.1.1/node_modules/react-markdown/lib/index.js
11698
11698
  var yh = [], bh = { allowDangerousHtml: !0 }, xh = /^(https?|ircs?|mailto|xmpp)$/i, Sh = [
11699
11699
  {
11700
11700
  from: "astPlugins",
@@ -12019,7 +12019,7 @@ function Yh(e, t) {
12019
12019
  return (e.index === 0 || Ku(n) || Gu(n)) && (!t || n !== 47);
12020
12020
  }
12021
12021
  //#endregion
12022
- //#region ../../node_modules/.pnpm/mdast-util-gfm-footnote@2.1.0/node_modules/mdast-util-gfm-footnote/lib/index.js
12022
+ //#region ../../node_modules/.pnpm/mdast-util-gfm-footnote@2.1.0_supports-color@8.1.1/node_modules/mdast-util-gfm-footnote/lib/index.js
12023
12023
  ag.peek = ig;
12024
12024
  function Xh() {
12025
12025
  this.buffer();
@@ -12113,7 +12113,7 @@ function lg(e, t, n) {
12113
12113
  return (n ? "" : " ") + e;
12114
12114
  }
12115
12115
  //#endregion
12116
- //#region ../../node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.0/node_modules/mdast-util-gfm-strikethrough/lib/index.js
12116
+ //#region ../../node_modules/.pnpm/mdast-util-gfm-strikethrough@2.0.0_supports-color@8.1.1/node_modules/mdast-util-gfm-strikethrough/lib/index.js
12117
12117
  var ug = [
12118
12118
  "autolink",
12119
12119
  "destinationLiteral",
@@ -12744,7 +12744,7 @@ var h_ = {
12744
12744
  thematicBreak: m_
12745
12745
  };
12746
12746
  //#endregion
12747
- //#region ../../node_modules/.pnpm/mdast-util-gfm-table@2.0.0/node_modules/mdast-util-gfm-table/lib/index.js
12747
+ //#region ../../node_modules/.pnpm/mdast-util-gfm-table@2.0.0_supports-color@8.1.1/node_modules/mdast-util-gfm-table/lib/index.js
12748
12748
  function g_() {
12749
12749
  return {
12750
12750
  enter: {
@@ -12877,7 +12877,7 @@ function w_(e) {
12877
12877
  }
12878
12878
  }
12879
12879
  //#endregion
12880
- //#region ../../node_modules/.pnpm/mdast-util-gfm-task-list-item@2.0.0/node_modules/mdast-util-gfm-task-list-item/lib/index.js
12880
+ //#region ../../node_modules/.pnpm/mdast-util-gfm-task-list-item@2.0.0_supports-color@8.1.1/node_modules/mdast-util-gfm-task-list-item/lib/index.js
12881
12881
  function T_() {
12882
12882
  return { exit: {
12883
12883
  taskListCheckValueChecked: D_,
@@ -12932,7 +12932,7 @@ function k_(e, t, n, r) {
12932
12932
  }
12933
12933
  }
12934
12934
  //#endregion
12935
- //#region ../../node_modules/.pnpm/mdast-util-gfm@3.1.0/node_modules/mdast-util-gfm/lib/index.js
12935
+ //#region ../../node_modules/.pnpm/mdast-util-gfm@3.1.0_supports-color@8.1.1/node_modules/mdast-util-gfm/lib/index.js
12936
12936
  function A_() {
12937
12937
  return [
12938
12938
  Ih(),
@@ -13703,7 +13703,7 @@ function Tv(e) {
13703
13703
  ]);
13704
13704
  }
13705
13705
  //#endregion
13706
- //#region ../../node_modules/.pnpm/remark-gfm@4.0.1/node_modules/remark-gfm/lib/index.js
13706
+ //#region ../../node_modules/.pnpm/remark-gfm@4.0.1_supports-color@8.1.1/node_modules/remark-gfm/lib/index.js
13707
13707
  var Ev = {};
13708
13708
  function Dv(e) {
13709
13709
  let t = this, n = e || Ev, r = t.data(), i = r.micromarkExtensions ||= [], a = r.fromMarkdownExtensions ||= [], o = r.toMarkdownExtensions ||= [];
@@ -13893,7 +13893,7 @@ function qv(e, t) {
13893
13893
  return Uv(e, Object.assign({ format: Kv }, t));
13894
13894
  }
13895
13895
  //#endregion
13896
- //#region ../../node_modules/.pnpm/mdast-util-directive@3.1.0/node_modules/mdast-util-directive/lib/index.js
13896
+ //#region ../../node_modules/.pnpm/mdast-util-directive@3.1.0_supports-color@8.1.1/node_modules/mdast-util-directive/lib/index.js
13897
13897
  var Jv = {}.hasOwnProperty, Yv = {}, Xv = /^[^\t\n\r "#'.<=>`}]+$/, Zv = /^[^\t\n\r "'<=>`}]+$/;
13898
13898
  function Qv() {
13899
13899
  return {
@@ -14375,7 +14375,7 @@ function Vy() {
14375
14375
  };
14376
14376
  }
14377
14377
  //#endregion
14378
- //#region ../../node_modules/.pnpm/remark-directive@4.0.0/node_modules/remark-directive/lib/index.js
14378
+ //#region ../../node_modules/.pnpm/remark-directive@4.0.0_supports-color@8.1.1/node_modules/remark-directive/lib/index.js
14379
14379
  function Hy() {
14380
14380
  let e = this.data(), t = e.micromarkExtensions ||= [], n = e.fromMarkdownExtensions ||= [], r = e.toMarkdownExtensions ||= [];
14381
14381
  t.push(Vy()), n.push(Qv()), r.push($v());
@@ -14892,11 +14892,11 @@ function fb({ name: e }) {
14892
14892
  }
14893
14893
  function pb() {
14894
14894
  return b({
14895
- name: "showChart",
14895
+ name: "show_chart",
14896
14896
  parameters: gc,
14897
14897
  render: ({ parameters: e }) => e.compiled_chart?.path ? /* @__PURE__ */ S(Yc, { path: e.compiled_chart.path }) : /* @__PURE__ */ S("div", { children: "No chart path provided" })
14898
14898
  }, []), b({
14899
- name: "showReport",
14899
+ name: "show_report",
14900
14900
  parameters: _c,
14901
14901
  render: ({ parameters: e }) => e.compiled_report?.path ? /* @__PURE__ */ S(Gy, {
14902
14902
  path: e.compiled_report.path,
@@ -15419,7 +15419,7 @@ function kb({ onNewChat: e, onThreadSelect: t }) {
15419
15419
  !c && s.map((e) => {
15420
15420
  let t = Db(e.agent), n = Ob(e.last_run_at ?? e.created_at);
15421
15421
  return /* @__PURE__ */ S("button", {
15422
- onClick: () => d(e.uid),
15422
+ onClick: () => d(e.uid ?? ""),
15423
15423
  className: "erica-thread-item",
15424
15424
  children: /* @__PURE__ */ C("div", {
15425
15425
  className: "erica-thread-item-content",
@@ -15565,53 +15565,53 @@ var Ib = () => (e) => {
15565
15565
  };
15566
15566
  t(e);
15567
15567
  };
15568
- function Rb({ runtimeUrl: e, widgetToken: t }) {
15569
- let [n, r] = u(void 0), [a, s] = u(!0), [l, f] = u(!1), [h, g] = u(0), [_, v] = u(!0), [y, b] = u(!1), w = c(() => {
15568
+ function Rb({ runtimeUrl: e, widgetToken: t, requiresSandbox: n = !1 }) {
15569
+ let [r, a] = u(void 0), [s, l] = u(!0), [f, h] = u(!1), [g, _] = u(0), [v, y] = u(!0), [b, w] = u(!1), T = c(() => {
15570
15570
  let t = new URL(e), n = t.pathname.split("/").filter(Boolean);
15571
15571
  return n.length > 2 && n.pop(), t.pathname = "/" + n.join("/"), t.toString();
15572
15572
  }, [e]);
15573
15573
  c(() => {
15574
- Fe(w, t);
15575
- }, [w, t]);
15576
- let { data: T, isLoading: E } = _n(a, h), { isLoading: D, isSuccess: O } = vn(n || "", l);
15574
+ Fe(T, t);
15575
+ }, [T, t]);
15576
+ let { data: E, isLoading: D } = _n(s, g), { isLoading: O, isSuccess: ee } = vn(r || "", f);
15577
15577
  o(() => {
15578
- O && _ && y && b(!0);
15578
+ ee && v && b && w(!0);
15579
15579
  }, [
15580
- O,
15581
- _,
15582
- y
15580
+ ee,
15581
+ v,
15582
+ b
15583
15583
  ]), o(() => {
15584
- T && (r(T), s(!1), f(!0), v(!0));
15585
- }, [T]), o(() => () => {
15586
- n && _ && mn.deleteSandbox(n).catch(() => {});
15587
- }, [n, _]);
15588
- let ee = i(() => {
15589
- r(void 0), s(!0), f(!1), g((e) => e + 1), v(!0), b(!0);
15590
- }, []), te = i((e) => {
15591
- r(e), s(!1), f(!1), v(!1), b(!0);
15584
+ E && (a(E), l(!1), h(n), y(!0));
15585
+ }, [E, n]), o(() => () => {
15586
+ r && v && mn.deleteSandbox(r).catch(() => {});
15587
+ }, [r, v]);
15588
+ let te = i(() => {
15589
+ a(void 0), l(!0), h(!1), _((e) => e + 1), y(!0), w(!0);
15590
+ }, []), ne = i((e) => {
15591
+ a(e), l(!1), h(!1), y(!1), w(!0);
15592
15592
  }, []);
15593
- function ne({ threadId: e, isLoadingThreadId: t, isLoadingSandbox: n, isSandboxReady: r, isNewThread: a, handleNewChat: o, handleThreadSelect: s }) {
15594
- let c = "Halo! Saya asisten AI SPP, ada yg bisa saya bantu?";
15595
- t ? c = /* @__PURE__ */ S(Eb, { message: "Initializing conversation" }) : a && n ? c = /* @__PURE__ */ S(Eb, { message: "Preparing workspace" }) : a && !r && (c = /* @__PURE__ */ S(Eb, { message: "Setting up environment" }));
15596
- let l = i(() => /* @__PURE__ */ S(kb, {
15597
- onNewChat: o,
15598
- onThreadSelect: s
15599
- }), [o, s]);
15593
+ function k({ threadId: e, isLoadingThreadId: t, isLoadingSandbox: r, isSandboxReady: a, isNewThread: o, handleNewChat: s, handleThreadSelect: c }) {
15594
+ let l = "Halo! Saya asisten AI SPP, ada yg bisa saya bantu?";
15595
+ t ? l = /* @__PURE__ */ S(Eb, { message: "Initializing conversation" }) : n && o && r ? l = /* @__PURE__ */ S(Eb, { message: "Preparing workspace" }) : n && o && !a && (l = /* @__PURE__ */ S(Eb, { message: "Setting up environment" }));
15596
+ let u = i(() => /* @__PURE__ */ S(kb, {
15597
+ onNewChat: s,
15598
+ onThreadSelect: c
15599
+ }), [s, c]);
15600
15600
  return /* @__PURE__ */ C("div", {
15601
15601
  className: "erica-chat-container",
15602
15602
  children: [
15603
15603
  /* @__PURE__ */ S(pb, {}),
15604
15604
  /* @__PURE__ */ S(Mb, {
15605
15605
  message: "Hai! Saya SPP AI, siap membantu Anda!",
15606
- isOpen: y,
15606
+ isOpen: b,
15607
15607
  initialDelay: 1e4
15608
15608
  }),
15609
15609
  /* @__PURE__ */ S(m, {
15610
15610
  welcomeScreen: !0,
15611
- header: l,
15611
+ header: u,
15612
15612
  labels: {
15613
15613
  chatInputPlaceholder: "Ketik pertanyaan Anda di sini...",
15614
- welcomeMessageText: c,
15614
+ welcomeMessageText: l,
15615
15615
  chatDisclaimerText: "AI dapat membuat kesalahan. Harap verifikasi informasi penting."
15616
15616
  },
15617
15617
  threadId: e,
@@ -15642,6 +15642,10 @@ function Rb({ runtimeUrl: e, widgetToken: t }) {
15642
15642
  resource: ({ children: e }) => /* @__PURE__ */ C("span", {
15643
15643
  className: "erica-resource-tag",
15644
15644
  children: ["@", e]
15645
+ }),
15646
+ table: ({ children: e }) => /* @__PURE__ */ S("div", {
15647
+ className: "markdown-table-wrapper",
15648
+ children: /* @__PURE__ */ S("table", { children: e })
15645
15649
  })
15646
15650
  },
15647
15651
  children: e
@@ -15657,16 +15661,22 @@ function Rb({ runtimeUrl: e, widgetToken: t }) {
15657
15661
  Hy,
15658
15662
  Ib
15659
15663
  ],
15660
- components: { tool_call_content: ({ children: e, ...t }) => /* @__PURE__ */ S("div", {
15661
- className: "tool-call-content",
15662
- ...t,
15663
- children: e
15664
- }) },
15664
+ components: {
15665
+ tool_call_content: ({ children: e, ...t }) => /* @__PURE__ */ S("div", {
15666
+ className: "tool-call-content",
15667
+ ...t,
15668
+ children: e
15669
+ }),
15670
+ table: ({ children: e }) => /* @__PURE__ */ S("div", {
15671
+ className: "markdown-table-wrapper",
15672
+ children: /* @__PURE__ */ S("table", { children: e })
15673
+ })
15674
+ },
15665
15675
  children: e
15666
15676
  })
15667
15677
  }
15668
15678
  },
15669
- defaultOpen: y
15679
+ defaultOpen: b
15670
15680
  })
15671
15681
  ]
15672
15682
  });
@@ -15675,19 +15685,19 @@ function Rb({ runtimeUrl: e, widgetToken: t }) {
15675
15685
  runtimeUrl: e,
15676
15686
  headers: { Authorization: `Bearer ${t}` },
15677
15687
  properties: { agent: yn },
15678
- threadId: n,
15688
+ threadId: r,
15679
15689
  enableInspector: !1,
15680
15690
  children: /* @__PURE__ */ S(Cn, {
15681
- threadId: n,
15691
+ threadId: r,
15682
15692
  agentIdentifier: yn,
15683
- children: /* @__PURE__ */ S(ne, {
15684
- threadId: n,
15685
- isLoadingThreadId: E,
15686
- isLoadingSandbox: D,
15687
- isSandboxReady: O,
15688
- isNewThread: _,
15689
- handleNewChat: ee,
15690
- handleThreadSelect: te
15693
+ children: /* @__PURE__ */ S(k, {
15694
+ threadId: r,
15695
+ isLoadingThreadId: D,
15696
+ isLoadingSandbox: O,
15697
+ isSandboxReady: ee,
15698
+ isNewThread: v,
15699
+ handleNewChat: te,
15700
+ handleThreadSelect: ne
15691
15701
  })
15692
15702
  })
15693
15703
  }) });