@bikdotai/bik-component-library 0.0.866 → 0.0.867

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 (137) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +151 -29
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js +2 -0
  6. package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
  7. package/dist/cjs/components/agent-builder/components/ChannelsSection.js +2 -0
  8. package/dist/cjs/components/agent-builder/components/ChannelsSection.js.map +1 -0
  9. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  10. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/MentionEditor.js +2 -2
  14. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/MentionPicker.js +13 -13
  18. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +3 -3
  20. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/constants/channels.js +2 -0
  22. package/dist/cjs/components/agent-builder/constants/channels.js.map +1 -0
  23. package/dist/cjs/components/agent-builder/constants/steps.js +1 -1
  24. package/dist/cjs/components/agent-builder/constants/steps.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  26. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/steps/Step1About.js +1 -1
  28. package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +2 -2
  30. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  32. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  34. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +2 -2
  36. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  38. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  39. package/dist/cjs/icons/Social/Channels/ManifestGlass.js +2 -0
  40. package/dist/cjs/icons/Social/Channels/ManifestGlass.js.map +1 -0
  41. package/dist/cjs/icons/Social/Channels/ShipStation.js +2 -0
  42. package/dist/cjs/icons/Social/Channels/ShipStation.js.map +1 -0
  43. package/dist/cjs/icons/Social/Channels/Skio.js +2 -0
  44. package/dist/cjs/icons/Social/Channels/Skio.js.map +1 -0
  45. package/dist/cjs/icons/index.js +1 -1
  46. package/dist/cjs/index.js +1 -1
  47. package/dist/esm/components/agent-builder/AgentBuilder.js +103 -97
  48. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  49. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +76 -0
  50. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +68 -0
  51. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +224 -59
  52. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  53. package/dist/esm/components/agent-builder/components/ChannelSelectModal.d.ts +26 -0
  54. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js +121 -0
  55. package/dist/esm/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
  56. package/dist/esm/components/agent-builder/components/ChannelsSection.d.ts +10 -0
  57. package/dist/esm/components/agent-builder/components/ChannelsSection.js +183 -0
  58. package/dist/esm/components/agent-builder/components/ChannelsSection.js.map +1 -0
  59. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +135 -132
  60. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  61. package/dist/esm/components/agent-builder/components/GoLiveModal.js +12 -12
  62. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  63. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +2 -0
  64. package/dist/esm/components/agent-builder/components/MentionEditor.js +47 -45
  65. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  66. package/dist/esm/components/agent-builder/components/MentionField.js +52 -51
  67. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  68. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +5 -0
  69. package/dist/esm/components/agent-builder/components/MentionPicker.js +134 -132
  70. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  71. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +2 -0
  72. package/dist/esm/components/agent-builder/components/SelectableListSection.js +48 -46
  73. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  74. package/dist/esm/components/agent-builder/constants/channels.d.ts +56 -0
  75. package/dist/esm/components/agent-builder/constants/channels.js +41 -0
  76. package/dist/esm/components/agent-builder/constants/channels.js.map +1 -0
  77. package/dist/esm/components/agent-builder/constants/steps.d.ts +31 -1
  78. package/dist/esm/components/agent-builder/constants/steps.js +15 -6
  79. package/dist/esm/components/agent-builder/constants/steps.js.map +1 -1
  80. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +13 -1
  81. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +157 -148
  82. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  83. package/dist/esm/components/agent-builder/index.d.ts +5 -2
  84. package/dist/esm/components/agent-builder/steps/Step1About.js +15 -13
  85. package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
  86. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +55 -48
  87. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  88. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +158 -157
  89. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  90. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.d.ts +11 -0
  91. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +127 -23
  92. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  93. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +10 -3
  94. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +31 -23
  95. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  96. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +7 -5
  97. package/dist/esm/components/agent-builder/utils/sourceIcons.js +26 -26
  98. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  99. package/dist/esm/icons/Social/Channels/ManifestGlass.d.ts +6 -0
  100. package/dist/esm/icons/Social/Channels/ManifestGlass.js +252 -0
  101. package/dist/esm/icons/Social/Channels/ManifestGlass.js.map +1 -0
  102. package/dist/esm/icons/Social/Channels/ShipStation.d.ts +6 -0
  103. package/dist/esm/icons/Social/Channels/ShipStation.js +31 -0
  104. package/dist/esm/icons/Social/Channels/ShipStation.js.map +1 -0
  105. package/dist/esm/icons/Social/Channels/Skio.d.ts +6 -0
  106. package/dist/{cjs/assets/icons/Skio.svg.js → esm/icons/Social/Channels/Skio.js} +31 -2
  107. package/dist/esm/icons/Social/Channels/Skio.js.map +1 -0
  108. package/dist/esm/icons/Social/Channels/index.d.ts +3 -0
  109. package/dist/esm/icons/index.d.ts +25 -25
  110. package/dist/esm/icons/index.js +330 -324
  111. package/dist/esm/icons/index.js.map +1 -1
  112. package/dist/esm/index.js +671 -663
  113. package/dist/esm/index.js.map +1 -1
  114. package/package.json +1 -1
  115. package/dist/cjs/assets/icons/BigCommerce.svg.js +0 -2
  116. package/dist/cjs/assets/icons/BigCommerce.svg.js.map +0 -1
  117. package/dist/cjs/assets/icons/Gorgias.svg.js +0 -2
  118. package/dist/cjs/assets/icons/Gorgias.svg.js.map +0 -1
  119. package/dist/cjs/assets/icons/ManifestGlass.svg.js +0 -2
  120. package/dist/cjs/assets/icons/ManifestGlass.svg.js.map +0 -1
  121. package/dist/cjs/assets/icons/ShipStation.svg.js +0 -2
  122. package/dist/cjs/assets/icons/ShipStation.svg.js.map +0 -1
  123. package/dist/cjs/assets/icons/Shopify.svg.js +0 -2
  124. package/dist/cjs/assets/icons/Shopify.svg.js.map +0 -1
  125. package/dist/cjs/assets/icons/Skio.svg.js.map +0 -1
  126. package/dist/esm/assets/icons/BigCommerce.svg.js +0 -6
  127. package/dist/esm/assets/icons/BigCommerce.svg.js.map +0 -1
  128. package/dist/esm/assets/icons/Gorgias.svg.js +0 -6
  129. package/dist/esm/assets/icons/Gorgias.svg.js.map +0 -1
  130. package/dist/esm/assets/icons/ManifestGlass.svg.js +0 -6
  131. package/dist/esm/assets/icons/ManifestGlass.svg.js.map +0 -1
  132. package/dist/esm/assets/icons/ShipStation.svg.js +0 -6
  133. package/dist/esm/assets/icons/ShipStation.svg.js.map +0 -1
  134. package/dist/esm/assets/icons/Shopify.svg.js +0 -6
  135. package/dist/esm/assets/icons/Shopify.svg.js.map +0 -1
  136. package/dist/esm/assets/icons/Skio.svg.js +0 -6
  137. package/dist/esm/assets/icons/Skio.svg.js.map +0 -1
@@ -1,92 +1,95 @@
1
- import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
- import { useState as i, useCallback as t } from "react";
3
- import { COLORS as ce } from "../../constants/Theme.js";
4
- import { BuilderRoot as de, Main as ue, Rail as fe, Content as ge, ContentCard as me, StepScroll as he } from "./AgentBuilder.styled.js";
5
- import { AgentBuilderFooter as ve } from "./components/AgentBuilderFooter.js";
6
- import { AgentBuilderTopBar as pe } from "./components/AgentBuilderTopBar.js";
7
- import { DiscardModal as Se } from "./components/DiscardModal.js";
8
- import { GoLiveModal as be } from "./components/GoLiveModal.js";
9
- import { StepRail as Ce } from "./components/StepRail.js";
10
- import { UndoToast as Ae } from "./components/UndoToast.js";
11
- import { AgentBuilderProvider as Le, useAgentBuilderContext as De } from "./context/AgentBuilderContext.js";
12
- import { Step1About as ye } from "./steps/Step1About.js";
13
- import { Step2WhenItStepsIn as Te } from "./steps/Step2WhenItStepsIn.js";
14
- import { Step3HowItResponds as Be } from "./steps/Step3HowItResponds.js";
15
- import { Step4HandoverRules as we } from "./steps/Step4HandoverRules.js";
16
- import { Spinner as Ge } from "../spinner/Spinner.js";
17
- const Ie = () => {
18
- const { activeStep: d } = De();
1
+ import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
+ import { useState as s, useCallback as t } from "react";
3
+ import { COLORS as ge } from "../../constants/Theme.js";
4
+ import { BuilderRoot as fe, Main as he, Rail as me, Content as ve, ContentCard as pe, StepScroll as Se } from "./AgentBuilder.styled.js";
5
+ import { AgentBuilderFooter as be } from "./components/AgentBuilderFooter.js";
6
+ import { AgentBuilderTopBar as Ce } from "./components/AgentBuilderTopBar.js";
7
+ import { DiscardModal as Ae } from "./components/DiscardModal.js";
8
+ import { GoLiveModal as Le } from "./components/GoLiveModal.js";
9
+ import { StepRail as De } from "./components/StepRail.js";
10
+ import { UndoToast as ye } from "./components/UndoToast.js";
11
+ import { AgentBuilderProvider as Te, useAgentBuilderContext as Be } from "./context/AgentBuilderContext.js";
12
+ import { Step1About as we } from "./steps/Step1About.js";
13
+ import { Step2WhenItStepsIn as Ge } from "./steps/Step2WhenItStepsIn.js";
14
+ import { Step3HowItResponds as Ie } from "./steps/Step3HowItResponds.js";
15
+ import { Step4HandoverRules as Pe } from "./steps/Step4HandoverRules.js";
16
+ import { Spinner as Me } from "../spinner/Spinner.js";
17
+ const ke = () => {
18
+ const { activeStep: d } = Be();
19
19
  switch (d) {
20
20
  case "about":
21
- return /* @__PURE__ */ o(ye, {});
21
+ return /* @__PURE__ */ o(we, {});
22
22
  case "trigger":
23
- return /* @__PURE__ */ o(Te, {});
23
+ return /* @__PURE__ */ o(Ge, {});
24
24
  case "response":
25
- return /* @__PURE__ */ o(Be, {});
25
+ return /* @__PURE__ */ o(Ie, {});
26
26
  case "handover":
27
- return /* @__PURE__ */ o(we, {});
27
+ return /* @__PURE__ */ o(Pe, {});
28
28
  default:
29
29
  return null;
30
30
  }
31
- }, Pe = (d) => {
31
+ }, Re = (d) => {
32
32
  const {
33
33
  config: P,
34
34
  onChange: v,
35
35
  onStepChange: u,
36
36
  onDiscard: p,
37
- onSaveDraft: s,
37
+ onSaveDraft: i,
38
38
  onPublish: S,
39
- onBack: f,
40
- onTestAgent: g,
41
- onGoToDashboard: m,
39
+ onBack: g,
40
+ onTestAgent: f,
41
+ onGoToDashboard: h,
42
42
  onCreateSubAgent: r,
43
43
  onFetchSubAgent: M,
44
44
  onUpdateSubAgent: k,
45
45
  onImproveSubAgent: R,
46
46
  onImproveToolInstructions: x,
47
47
  onConnectIntegration: j,
48
- ...H
48
+ onManageChannels: H,
49
+ onSmartAgentHandover: F,
50
+ ...N
49
51
  } = d, {
50
52
  value: l,
51
- activeStep: F,
52
- availableTools: N,
53
- availableSubAgents: O,
54
- availableIntents: U = [],
55
- availableModels: z = [],
56
- configToolTemplates: E,
57
- integrationStatus: W,
58
- variablesData: $,
59
- validation: q,
60
- applicationType: J,
61
- charLimits: K,
53
+ activeStep: O,
54
+ availableTools: U,
55
+ availableSubAgents: z,
56
+ availableIntents: E = [],
57
+ availableModels: W = [],
58
+ configToolTemplates: $,
59
+ integrationStatus: q,
60
+ variablesData: J,
61
+ validation: K,
62
+ applicationType: Q,
63
+ availableChannels: V,
64
+ charLimits: X,
62
65
  isSaving: b,
63
66
  isPublishing: C,
64
- isLoading: Q,
65
- footerHint: V = "Changes don’t affect customers until you go live",
66
- disableStepNavigation: X,
67
+ isLoading: Y,
68
+ footerHint: Z = "Changes don’t affect customers until you go live",
69
+ disableStepNavigation: _,
67
70
  debugLog: A
68
- } = P, [L, a] = i(null), [D, y] = i(!1), [Y, T] = i(!1), [Z, c] = i(!1), [B, w] = i(!1), n = t(
69
- (e, ...le) => {
70
- A && console.log(`[AgentBuilder] ${e}`, ...le);
71
+ } = P, [L, a] = s(null), [D, y] = s(!1), [ee, T] = s(!1), [ne, c] = s(!1), [B, w] = s(!1), n = t(
72
+ (e, ...ue) => {
73
+ A && console.log(`[AgentBuilder] ${e}`, ...ue);
71
74
  },
72
75
  [A]
73
- ), _ = t(
76
+ ), oe = t(
74
77
  (e) => {
75
78
  n("onChange", e), v(e);
76
79
  },
77
80
  [n, v]
78
- ), ee = t(
81
+ ), te = t(
79
82
  (e) => {
80
83
  n("onStepChange", e), u?.(e);
81
84
  },
82
85
  [n, u]
83
- ), ne = t(() => (n("onSaveDraft"), s()), [n, s]), oe = t(() => (n("onPublish"), S()), [n, S]), te = t(() => {
86
+ ), ae = t(() => (n("onSaveDraft"), i()), [n, i]), se = t(() => (n("onPublish"), S()), [n, S]), ie = t(() => {
84
87
  n("onBack"), c(!0);
85
- }, [n]), ae = t(() => {
88
+ }, [n]), re = t(() => {
86
89
  n("onDiscardAndLeave"), c(!1), p();
87
90
  }, [n, p]), G = t(async () => {
88
91
  n("onSaveDraftAndLeave");
89
- const e = s();
92
+ const e = i();
90
93
  if (c(!1), e && typeof e.then == "function") {
91
94
  w(!0);
92
95
  try {
@@ -95,10 +98,10 @@ const Ie = () => {
95
98
  w(!1);
96
99
  }
97
100
  }
98
- f?.();
99
- }, [n, s, f]), ie = t(async () => {
101
+ g?.();
102
+ }, [n, i, g]), le = t(async () => {
100
103
  n("onTestAgent");
101
- const e = g?.();
104
+ const e = f?.();
102
105
  if (e && typeof e.then == "function") {
103
106
  T(!0);
104
107
  try {
@@ -107,14 +110,14 @@ const Ie = () => {
107
110
  T(!1);
108
111
  }
109
112
  }
110
- }, [n, g]), I = t(() => {
111
- n("onGoToDashboard"), m?.();
112
- }, [n, m]), se = t(
113
+ }, [n, f]), I = t(() => {
114
+ n("onGoToDashboard"), h?.();
115
+ }, [n, h]), ce = t(
113
116
  (e) => (n("onCreateSubAgent", e), r ? r(e) : Promise.reject(new Error("onCreateSubAgent not provided"))),
114
117
  [n, r]
115
- ), re = async () => {
118
+ ), de = async () => {
116
119
  n("onGoLiveConfirm");
117
- const e = oe();
120
+ const e = se();
118
121
  if (e && typeof e.then == "function") {
119
122
  a(null), y(!0);
120
123
  try {
@@ -126,43 +129,46 @@ const Ie = () => {
126
129
  a("success");
127
130
  };
128
131
  return /* @__PURE__ */ o(
129
- Le,
132
+ Te,
130
133
  {
131
134
  value: l,
132
- onChange: _,
133
- activeStep: F,
134
- onStepChange: u ? ee : void 0,
135
- availableTools: N,
136
- availableSubAgents: O,
137
- availableIntents: U,
138
- availableModels: z,
139
- configToolTemplates: E,
140
- integrationStatus: W,
135
+ onChange: oe,
136
+ activeStep: O,
137
+ onStepChange: u ? te : void 0,
138
+ availableTools: U,
139
+ availableSubAgents: z,
140
+ availableIntents: E,
141
+ availableModels: W,
142
+ configToolTemplates: $,
143
+ integrationStatus: q,
141
144
  onConnectIntegration: j,
142
- variablesData: $,
143
- validation: q,
144
- applicationType: J,
145
- charLimits: K,
146
- disableStepNavigation: X,
147
- onCreateSubAgent: r ? se : void 0,
145
+ variablesData: J,
146
+ validation: K,
147
+ applicationType: Q,
148
+ availableChannels: V,
149
+ onManageChannels: H,
150
+ onSmartAgentHandover: F,
151
+ charLimits: X,
152
+ disableStepNavigation: _,
153
+ onCreateSubAgent: r ? ce : void 0,
148
154
  onFetchSubAgent: M,
149
155
  onUpdateSubAgent: k,
150
156
  onImproveSubAgent: R,
151
157
  onImproveToolInstructions: x,
152
- children: /* @__PURE__ */ h(de, { "data-test": H["data-test"] ?? "agent-builder", children: [
158
+ children: /* @__PURE__ */ m(fe, { "data-test": N["data-test"] ?? "agent-builder", children: [
153
159
  /* @__PURE__ */ o(
154
- pe,
160
+ Ce,
155
161
  {
156
162
  name: l.name,
157
163
  status: l.status,
158
- onBack: f ? te : void 0,
164
+ onBack: g ? ie : void 0,
159
165
  onSaveDraft: G,
160
166
  isSaving: b || B
161
167
  }
162
168
  ),
163
- /* @__PURE__ */ h(ue, { children: [
164
- /* @__PURE__ */ o(fe, { children: /* @__PURE__ */ o(Ce, {}) }),
165
- /* @__PURE__ */ o(ge, { children: Q ? /* @__PURE__ */ o(
169
+ /* @__PURE__ */ m(he, { children: [
170
+ /* @__PURE__ */ o(me, { children: /* @__PURE__ */ o(De, {}) }),
171
+ /* @__PURE__ */ o(ve, { children: Y ? /* @__PURE__ */ o(
166
172
  "div",
167
173
  {
168
174
  style: {
@@ -171,16 +177,16 @@ const Ie = () => {
171
177
  justifyContent: "center",
172
178
  height: "100%"
173
179
  },
174
- children: /* @__PURE__ */ o(Ge, { size: "large", color: ce.stroke.brand })
180
+ children: /* @__PURE__ */ o(Me, { size: "large", color: ge.stroke.brand })
175
181
  }
176
- ) : /* @__PURE__ */ h(me, { children: [
177
- /* @__PURE__ */ o(he, { children: /* @__PURE__ */ o(Ie, {}) }),
182
+ ) : /* @__PURE__ */ m(pe, { children: [
183
+ /* @__PURE__ */ o(Se, { children: /* @__PURE__ */ o(ke, {}) }),
178
184
  /* @__PURE__ */ o(
179
- ve,
185
+ be,
180
186
  {
181
- footerHint: V,
182
- onTestAgent: g ? ie : void 0,
183
- isTesting: Y,
187
+ footerHint: Z,
188
+ onTestAgent: f ? le : void 0,
189
+ isTesting: ee,
184
190
  onGoLive: () => {
185
191
  n("onGoLive"), a("confirm");
186
192
  },
@@ -190,39 +196,39 @@ const Ie = () => {
190
196
  ] }) })
191
197
  ] }),
192
198
  /* @__PURE__ */ o(
193
- be,
199
+ Le,
194
200
  {
195
201
  mode: L,
196
202
  onClose: () => {
197
203
  const e = L === "success";
198
204
  a(null), e && I();
199
205
  },
200
- onConfirm: re,
206
+ onConfirm: de,
201
207
  onSaveDraft: () => {
202
- a(null), ne();
208
+ a(null), ae();
203
209
  },
204
- onGoToDashboard: m ? I : void 0,
210
+ onGoToDashboard: h ? I : void 0,
205
211
  isPublishing: C || D
206
212
  }
207
213
  ),
208
214
  /* @__PURE__ */ o(
209
- Se,
215
+ Ae,
210
216
  {
211
- open: Z,
217
+ open: ne,
212
218
  onClose: () => c(!1),
213
- onDiscard: ae,
219
+ onDiscard: re,
214
220
  onSaveDraft: G,
215
221
  disableSaveDraft: !l.name.trim(),
216
222
  isSaving: b || B
217
223
  }
218
224
  ),
219
- /* @__PURE__ */ o(Ae, {})
225
+ /* @__PURE__ */ o(ye, {})
220
226
  ] })
221
227
  }
222
228
  );
223
229
  };
224
- Pe.displayName = "AgentBuilder";
230
+ Re.displayName = "AgentBuilder";
225
231
  export {
226
- Pe as AgentBuilder
232
+ Re as AgentBuilder
227
233
  };
228
234
  //# sourceMappingURL=AgentBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvariablesData,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\t// Closed up front for the same reason as go-live: the caller's saving dialog\n\t\t// would otherwise stack a second overlay on top of this one.\n\t\tsetShowLeaveConfirm(false);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\t// Close before handing the screen to the caller's in-flight dialog: two\n\t\t\t// modals at once means two stacked overlays and this one's cross showing\n\t\t\t// through. The footer's Go live button keeps spinning via `isPublishing`,\n\t\t\t// so a caller with no dialog of its own still shows progress.\n\t\t\tsetModalMode(null);\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","variablesData","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B;AACC,aAAO;AAAA,EAAA;AAEV,GAiBaC,KAA4C,CAACC,MAAU;AACnE,QAAM;AAAA,IACL,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,2BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACAhB,GACE;AAAA,IACL,OAAAiB;AAAA,IACA,YAAAxB;AAAA,IACA,gBAAAyB;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC,IAAmB,CAAA;AAAA,IACnB,iBAAAC,IAAkB,CAAA;AAAA,IAClB,qBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,YAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IAC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CAAA,CAAY,GACd;AAAA,YACA,gBAAAwE;AAAA,cAACY;AAAA,cAAA;AAAA,gBACA,YAAA7C;AAAA,gBACA,aAAavB,IAAcmD,KAAkB;AAAA,gBAC7C,WAAWpB;AAAA,gBACX,UAAU,MAAM;AACf,kBAAAM,EAAU,UAAU,GACpBV,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAM3C;AAAA,YACN,SAAS,MAAM;AACd,oBAAM4C,IAAa5C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACb2C,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA5B,EAAa,IAAI,GACjBkB,GAAA;AAAA,YACD;AAAA,YACA,iBAAiB5C,IAAkBmD,IAAsB;AAAA,YACzD,cAAc/B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACxC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUW,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAjF,GAAa,cAAc;"}
1
+ {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tonConnectIntegration,\n\t\tonManageChannels,\n\t\tonSmartAgentHandover,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvariablesData,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tavailableChannels,\n\t\tcharLimits,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// True while onTestAgent's async work (e.g. save-as-draft before the test\n\t// modal opens) is in flight — loads + disables the Test agent button.\n\tconst [testingLocal, setTestingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\t// Closed up front for the same reason as go-live: the caller's saving dialog\n\t\t// would otherwise stack a second overlay on top of this one.\n\t\tsetShowLeaveConfirm(false);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(async () => {\n\t\tlogAction('onTestAgent');\n\t\tconst result = onTestAgent?.();\n\t\t// A new agent saves as draft before the test modal opens — that's slow, so\n\t\t// disable + load the button until it settles (prevents double-triggering).\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetTestingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetTestingLocal(false);\n\t\t\t}\n\t\t}\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\t// Close before handing the screen to the caller's in-flight dialog: two\n\t\t\t// modals at once means two stacked overlays and this one's cross showing\n\t\t\t// through. The footer's Go live button keeps spinning via `isPublishing`,\n\t\t\t// so a caller with no dialog of its own still shows progress.\n\t\t\tsetModalMode(null);\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tavailableChannels={availableChannels}\n\t\t\tonManageChannels={onManageChannels}\n\t\t\tonSmartAgentHandover={onSmartAgentHandover}\n\t\t\tcharLimits={charLimits}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tisTesting={testingLocal}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tdisableSaveDraft={!value.name.trim()}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","onConnectIntegration","onManageChannels","onSmartAgentHandover","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","variablesData","validation","applicationType","availableChannels","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","testingLocal","setTestingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B;AACC,aAAO;AAAA,EAAA;AAEV,GAiBaC,KAA4C,CAACC,MAAU;AACnE,QAAM;AAAA,IACL,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC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AA;AAAA,QAG/B,gBAAA2B;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACzC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUY,KAAYe;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEApF,GAAa,cAAc;"}
@@ -1,4 +1,5 @@
1
1
  import { AgentConfig, AgentHandoverConfig, AgentToolDoc, IntentOption, ModelOption, StepKey, StepValidation, SubAgentRef, Trigger } from '@bikdotai/bik-models/ai-agents';
2
+ import { Channels } from '@bikdotai/bik-models/campaigns/models/Channel';
2
3
  import { ApplicationType } from '@bikdotai/bik-models/growth';
3
4
  import { VariableListInterfaceV3 } from '../variable-picker-v3/model';
4
5
  import { AgentCharLimits } from './constants/charLimits';
@@ -32,6 +33,12 @@ export type AgentValue = AgentConfig & {
32
33
  * meaningful for entry agents (sub-agents don't trigger).
33
34
  */
34
35
  authentication?: Authentication;
36
+ /**
37
+ * Channels (and the specific accounts within each) this agent is activated on
38
+ * — Step 1's "Channels to activate it on" section. Empty / omitted means the
39
+ * agent runs on nothing yet.
40
+ */
41
+ channels?: AgentChannelSelection[];
35
42
  };
36
43
  /** Per-agent customer verification config (see {@link AgentValue.authentication}). */
37
44
  export interface Authentication {
@@ -40,6 +47,53 @@ export interface Authentication {
40
47
  /** ONE method per agent; default "email_otp". */
41
48
  type: 'email_otp' | 'phone_otp';
42
49
  }
50
+ /**
51
+ * Which surface an account belongs to.
52
+ *
53
+ * These are the shared `Channels` members from bik-models — NOT a re-spelled
54
+ * copy — narrowed to the three the builder actually supports. TypeScript treats
55
+ * each enum member as its own type, so this stays in lockstep with the platform
56
+ * enum while making `Channels.SMS` (and friends) a compile error here.
57
+ *
58
+ * Supporting another channel is two edits: add its member below, then add its
59
+ * entry to `CHANNEL_PRESENTATION` — which is typed
60
+ * `Record<AgentChannelType, …>`, so the compiler will insist on it.
61
+ */
62
+ export type AgentChannelType = Channels.WHATSAPP | Channels.EMAIL | Channels.INSTAGRAM;
63
+ /** Whether the store's connection to an account is currently healthy. */
64
+ export type AgentChannelStatus = 'connected' | 'disconnected';
65
+ /**
66
+ * One connected account within a channel. The two ids are deliberately
67
+ * separate: `channelName` is the merchant-facing handle (a WhatsApp number, an
68
+ * inbox address, an Instagram username) and is ALL that's ever rendered, while
69
+ * `channelId` is the backend's opaque id and is ALL that's ever persisted.
70
+ * Never show `channelId`; never persist `channelName`.
71
+ */
72
+ export interface AgentChannelAccount {
73
+ /** Backend id. Persisted in {@link AgentChannelSelection.channelIds}. */
74
+ channelId: string;
75
+ /** Merchant-facing handle shown on the chip / row. */
76
+ channelName: string;
77
+ /**
78
+ * Connection health. `'disconnected'` flags the account (negative chip +
79
+ * a row-level alert) so the merchant can go reconnect it. Defaults to
80
+ * `'connected'` when omitted.
81
+ */
82
+ status?: AgentChannelStatus;
83
+ }
84
+ /** A channel the store has, plus every account connected under it. */
85
+ export interface AgentChannel {
86
+ type: AgentChannelType;
87
+ /** Overrides the built-in label for `type`. Required for unknown types. */
88
+ label?: string;
89
+ accounts: AgentChannelAccount[];
90
+ }
91
+ /** The agent's activation on one channel (see {@link AgentValue.channels}). */
92
+ export interface AgentChannelSelection {
93
+ type: AgentChannelType;
94
+ /** Backend {@link AgentChannelAccount.channelId}s — never display names. */
95
+ channelIds: string[];
96
+ }
43
97
  /**
44
98
  * The picker reads `AgentToolDoc`'s fields. `auth_required` is a backend-derived
45
99
  * (read-only) flag — true when the tool touches customer-private data (order
@@ -202,6 +256,7 @@ export interface SubAgentDraft {
202
256
  /** "Rest API" tools configured for this sub-agent (bespoke drawer). */
203
257
  restApiTools?: RestApiToolConfig[];
204
258
  }
259
+ export { Channels } from '@bikdotai/bik-models/campaigns/models/Channel';
205
260
  export type { AgentConfig, AgentToolDoc, AgentStatus, StepKey, StepValidation, TriggerMode, Trigger, HandoverMethod, AgentHandoverConfig, SubAgentRef, IntentOption, ModelOption, } from '@bikdotai/bik-models/ai-agents';
206
261
  /**
207
262
  * All non-function (data / reference / flag) props, grouped into one object.
@@ -242,6 +297,13 @@ export interface AgentBuilderConfig {
242
297
  variablesData?: VariableListInterfaceV3[];
243
298
  /** Host application context the merchant runs in (e.g. ApplicationType.MANIFEST). */
244
299
  applicationType?: ApplicationType;
300
+ /**
301
+ * The store's connected channels + accounts, for Step 1's "Channels to
302
+ * activate it on" section. Omit (or pass empty) to hide the section entirely.
303
+ * The library owns the label / glyph / tint for the known channel types and
304
+ * renders unknown ones from `label`.
305
+ */
306
+ availableChannels?: AgentChannel[];
245
307
  /** Optional consumer-supplied validity; merged over the builder's derived validity. */
246
308
  validation?: Partial<StepValidation>;
247
309
  /**
@@ -331,6 +393,20 @@ export interface AgentBuilderProps {
331
393
  * `integrationStatus` so the source unblocks.
332
394
  */
333
395
  onConnectIntegration?: (source: ToolSource) => void;
396
+ /**
397
+ * Open the consumer's channel-management screen — the "Channel management"
398
+ * link in the account picker's footer. Always called with the channel the
399
+ * merchant opened the picker for, so the consumer can deep-link straight to
400
+ * it. Omit to hide the link.
401
+ */
402
+ onManageChannels?: (type: AgentChannelType) => void;
403
+ /**
404
+ * Open the consumer's smart-agent-handover settings — the link inside Step 4's
405
+ * "Use default settings" card, which is where those defaults are actually
406
+ * defined. BIK only (see {@link AgentBuilderConfig.applicationType}); omit to
407
+ * render the card's subtitle as plain text with no link.
408
+ */
409
+ onSmartAgentHandover?: () => void;
334
410
  /** Test id applied to the builder root for e2e/component tests. */
335
411
  'data-test'?: string;
336
412
  }
@@ -1,3 +1,4 @@
1
+ import { default as React } from 'react';
1
2
  export declare const BuilderRoot: import('styled-components').StyledComponent<"div", any, {
2
3
  className: "bik-builder-root";
3
4
  }, "className">;
@@ -169,3 +170,70 @@ export declare const ModalActions: import('styled-components').StyledComponent<"
169
170
  export declare const FieldActionRow: import('styled-components').StyledComponent<"div", any, {
170
171
  className: "bik-field-action-row";
171
172
  }, "className">;
173
+ export declare const ChannelsSectionRoot: import('styled-components').StyledComponent<"div", any, {
174
+ className: "bik-channels-section";
175
+ }, "className">;
176
+ /** "Channel management" / "Smart agent handover" — a text link, not a Button. */
177
+ export declare const ChannelsLink: import('styled-components').StyledComponent<"button", any, {
178
+ className: "bik-channels-link";
179
+ }, "className">;
180
+ /** One channel's card. */
181
+ export declare const ChannelCard: import('styled-components').StyledComponent<"div", any, {
182
+ className: "bik-channel-card";
183
+ }, "className">;
184
+ export declare const ChannelRow: import('styled-components').StyledComponent<"div", any, {
185
+ className: "bik-channel-row";
186
+ }, "className">;
187
+ export declare const ChannelRowMain: import('styled-components').StyledComponent<"div", any, {
188
+ className: "bik-channel-row-main";
189
+ }, "className">;
190
+ /** Label + glyph. Fixed-width so every card's chips start on the same column. */
191
+ export declare const ChannelIdentity: import('styled-components').StyledComponent<"div", any, {
192
+ className: "bik-channel-identity";
193
+ }, "className">;
194
+ /** Tinted 24×24 square holding the 16px brand glyph. */
195
+ export declare const ChannelGlyph: import('styled-components').StyledComponent<"div", any, {
196
+ className: "bik-channel-glyph";
197
+ } & {
198
+ tint: string;
199
+ }, "className">;
200
+ /** The account chips. Wraps rather than overflowing when a store has many. */
201
+ export declare const ChannelChips: import('styled-components').StyledComponent<"div", any, {
202
+ className: "bik-channel-chips";
203
+ }, "className">;
204
+ /**
205
+ * Hover target for a chip's tooltip.
206
+ *
207
+ * Tippy attaches a ref to its child to use as the trigger, but `Tag` is a plain
208
+ * function component with no `forwardRef` — so wrapping a Tag directly gives
209
+ * Tippy no DOM node and the tooltip silently never opens. This span is the node
210
+ * it can hold on to. (`IconButton` wraps its disabled tooltip the same way.)
211
+ */
212
+ export declare const ChipTooltipTarget: import('styled-components').StyledComponent<"span", any, {
213
+ className: "bik-chip-tooltip-target";
214
+ }, "className">;
215
+ /** Scrollable account list inside the picker modal. */
216
+ export declare const ChannelPickerList: import('styled-components').StyledComponent<"div", any, {
217
+ className: "bik-channel-picker-list";
218
+ }, "className">;
219
+ export declare const ChannelPickerRow: import('styled-components').StyledComponent<"div", any, {
220
+ className: "bik-channel-picker-row";
221
+ }, "className">;
222
+ /**
223
+ * Glyph + account name inside a picker row. Figma wraps these in their own
224
+ * `px-4` group, so the checkbox sits 12px from the glyph but the glyph sits 8px
225
+ * from the label.
226
+ */
227
+ export declare const ChannelPickerAccount: import('styled-components').StyledComponent<"div", any, {
228
+ className: "bik-channel-picker-account";
229
+ }, "className">;
230
+ export declare const ChannelPickerBody: import('styled-components').StyledComponent<"div", any, {
231
+ className: "bik-channel-picker-body";
232
+ }, "className">;
233
+ /**
234
+ * Figma reserves a 24×24 slot for a checkbox (an 18px box inset by 3px), but the
235
+ * library's CheckBox renders the bare 18px box. Without this the checkbox column
236
+ * — and everything after it — sits 3px tight against the design. Passed as
237
+ * CheckBox's `style`, which lands on its container.
238
+ */
239
+ export declare const CHECKBOX_SLOT: React.CSSProperties;