@sendbird/actionbook-core 0.9.3 → 0.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -7
- package/dist/index.js.map +1 -1
- package/dist/ui/index.d.ts +5 -1
- package/dist/ui/index.js +1045 -193
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4612,6 +4612,17 @@ function findDuplicateJumpPoints(doc2) {
|
|
|
4612
4612
|
|
|
4613
4613
|
// src/tree/documentTree.ts
|
|
4614
4614
|
var MAX_DEPTH6 = 128;
|
|
4615
|
+
var END_ACTION_RESOURCE_IDS = /* @__PURE__ */ new Set([
|
|
4616
|
+
"close-happy-tiger"
|
|
4617
|
+
// PredefinedToolKey.CloseConversation
|
|
4618
|
+
]);
|
|
4619
|
+
var END_ACTION_TEXTS = /* @__PURE__ */ new Set([
|
|
4620
|
+
"end conversation",
|
|
4621
|
+
"end_conversation"
|
|
4622
|
+
]);
|
|
4623
|
+
function isEndActionTag(tagType, resourceId, text2) {
|
|
4624
|
+
return tagType === "handoff" || END_ACTION_RESOURCE_IDS.has(resourceId) || END_ACTION_TEXTS.has(text2.toLowerCase());
|
|
4625
|
+
}
|
|
4615
4626
|
function extractInlineItems(content, blockIndex) {
|
|
4616
4627
|
const items = [];
|
|
4617
4628
|
for (const node of content) {
|
|
@@ -4623,10 +4634,10 @@ function extractInlineItems(content, blockIndex) {
|
|
|
4623
4634
|
children: []
|
|
4624
4635
|
});
|
|
4625
4636
|
} else if (node.type === "resourceTag") {
|
|
4626
|
-
const
|
|
4637
|
+
const endAction = isEndActionTag(node.tagType, node.resourceId, node.text);
|
|
4627
4638
|
items.push({
|
|
4628
|
-
type:
|
|
4629
|
-
label:
|
|
4639
|
+
type: endAction ? "endAction" : "resourceTag",
|
|
4640
|
+
label: endAction ? `End ${node.text}` : node.text,
|
|
4630
4641
|
blockIndex,
|
|
4631
4642
|
children: [],
|
|
4632
4643
|
meta: { tagType: node.tagType, resourceId: node.resourceId }
|
|
@@ -4660,14 +4671,15 @@ function extractBlockItems(blocks, startIndex, depth) {
|
|
|
4660
4671
|
break;
|
|
4661
4672
|
}
|
|
4662
4673
|
case "jinjaIfBlock": {
|
|
4663
|
-
const branches = block.branches.map((branch) => {
|
|
4674
|
+
const branches = block.branches.map((branch, branchIdx) => {
|
|
4664
4675
|
const branchLabel = branch.branchType === "else" ? "ELSE" : `${branch.branchType.toUpperCase()} ${branch.condition || ""}`.trim();
|
|
4665
4676
|
const branchChildren = extractBlockItems(branch.content, blockIndex, depth + 1);
|
|
4666
4677
|
return {
|
|
4667
4678
|
type: "jinjaBranch",
|
|
4668
4679
|
label: branchLabel,
|
|
4669
4680
|
blockIndex,
|
|
4670
|
-
children: branchChildren
|
|
4681
|
+
children: branchChildren,
|
|
4682
|
+
meta: { branchIndex: branchIdx }
|
|
4671
4683
|
};
|
|
4672
4684
|
});
|
|
4673
4685
|
items.push({
|
|
@@ -4715,11 +4727,12 @@ function buildDocumentTree(doc2) {
|
|
|
4715
4727
|
const hasStructuredJinja = items.some((n) => n.type === "jinjaIf");
|
|
4716
4728
|
if (!hasStructuredJinja) {
|
|
4717
4729
|
for (const s of structures) {
|
|
4718
|
-
const branches = s.branches.map((b) => ({
|
|
4730
|
+
const branches = s.branches.map((b, branchIdx) => ({
|
|
4719
4731
|
type: "jinjaBranch",
|
|
4720
4732
|
label: b.type === "else" ? "ELSE" : `${b.type.toUpperCase()} ${b.condition || ""}`.trim(),
|
|
4721
4733
|
blockIndex: b.tagBlockIndex,
|
|
4722
|
-
children: []
|
|
4734
|
+
children: [],
|
|
4735
|
+
meta: { branchIndex: branchIdx }
|
|
4723
4736
|
}));
|
|
4724
4737
|
const jinjaNode = {
|
|
4725
4738
|
type: "jinjaIf",
|