@sendbird/actionbook-core 0.10.9 → 0.10.10

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.
@@ -19,7 +19,7 @@ type LinkMark = {
19
19
  readonly title?: string;
20
20
  };
21
21
  type Mark = BoldMark | ItalicMark | UnderlineMark | StrikethroughMark | CodeMark | LinkMark;
22
- declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
22
+ declare const RESOURCE_TAG_TYPES: readonly ["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"];
23
23
  type ResourceTagType = (typeof RESOURCE_TAG_TYPES)[number];
24
24
  type TextNode = {
25
25
  readonly type: 'text';
@@ -3,7 +3,7 @@ import { Plugin, Command, EditorState, PluginKey } from 'prosemirror-state';
3
3
  import { InputRule } from 'prosemirror-inputrules';
4
4
  import { EditorView, Decoration, NodeView } from 'prosemirror-view';
5
5
  import React$1, { ReactElement, RefCallback } from 'react';
6
- import { D as DocumentNode, A as AstNode, t as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, v as JSONContent } from '../types-BQ95zx4j.js';
6
+ import { D as DocumentNode, A as AstNode, t as LlmCompletionEndpoint, I as InlineNode, B as BlockNode, v as JSONContent } from '../types-Bu4_nY3M.js';
7
7
 
8
8
  /**
9
9
  * ProseMirror Schema for Actionbook documents.
package/dist/ui/index.js CHANGED
@@ -1251,7 +1251,7 @@ import { EditorView } from "prosemirror-view";
1251
1251
  import { Node as PMNode } from "prosemirror-model";
1252
1252
 
1253
1253
  // src/ast/types.ts
1254
- var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "time_diff", "time_difference"];
1254
+ var RESOURCE_TAG_TYPES = ["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"];
1255
1255
 
1256
1256
  // src/compat/prosemirror.ts
1257
1257
  var MAX_DEPTH = 128;
@@ -1994,7 +1994,7 @@ function listItemWithTaskListItem(node, parent, state, info) {
1994
1994
 
1995
1995
  // src/markdown/plugins/resourceTag.ts
1996
1996
  var RESOURCE_TAG_RE = /\{\{([^:}]+):([^:}]*):([^}]+)\}\}/g;
1997
- var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff"]);
1997
+ var VALID_TYPES = /* @__PURE__ */ new Set(["tool", "manual", "agent_message_template", "handoff", "end_call", "time_diff", "time_difference"]);
1998
1998
  function splitTextWithResourceTags(text2) {
1999
1999
  const results = [];
2000
2000
  let lastIndex = 0;
@@ -2081,7 +2081,8 @@ function convertInline(node, marks = [], depth = 0) {
2081
2081
  case "text":
2082
2082
  return [marks.length > 0 ? { type: "text", text: node.value, marks } : { type: "text", text: node.value }];
2083
2083
  case "strong": {
2084
- const childMarks = [...marks, { type: "bold" }];
2084
+ const alreadyBold = marks.some((m) => m.type === "bold");
2085
+ const childMarks = [...marks, { type: alreadyBold ? "italic" : "bold" }];
2085
2086
  return node.children.flatMap((child) => convertInline(child, childMarks, depth + 1));
2086
2087
  }
2087
2088
  case "emphasis": {
@@ -2477,6 +2478,12 @@ function serializeToMarkdown(doc2) {
2477
2478
  text: textHandler,
2478
2479
  link: linkHandler,
2479
2480
  listItem: listItemHandler,
2481
+ emphasis: ((node, _parent, state, info) => {
2482
+ const exit2 = state.enter("emphasis");
2483
+ const value = state.containerPhrasing(node, { ...info, before: "_", after: "_" });
2484
+ exit2();
2485
+ return `__${value}__`;
2486
+ }),
2480
2487
  ...resourceTagToMarkdown().handlers,
2481
2488
  ...jumpPointToMarkdown().handlers
2482
2489
  },
@@ -3067,6 +3074,8 @@ var ORDERED_LIST_RE = /^(\d+)\.\s$/;
3067
3074
  var JUMP_POINT_RE2 = /\^([\p{L}\p{N}_-]+)\^$/u;
3068
3075
  var BOLD_RE = /(?:^|[^*])\*\*([^*]+)\*\*$/;
3069
3076
  var ITALIC_RE = /(?:^|[^_])__([^_]+)__$/;
3077
+ var BOLD_ITALIC_RE1 = /(?:^|[^_])__\*\*([^*]+)\*\*__$/;
3078
+ var BOLD_ITALIC_RE2 = /(?:^|[^*])\*\*__([^_]+)__\*\*$/;
3070
3079
  var STRIKE_RE = /(?:^|[^~])~~([^~]+)~~$/;
3071
3080
  var CODE_RE = /(?:^|[^`])`([^`]+)`$/;
3072
3081
  function findParentList(state, pos) {
@@ -3165,7 +3174,26 @@ function handleListInputRule(state, start, end, listType, attrs) {
3165
3174
  tr.setSelection(TextSelection.near(tr.doc.resolve(tr.mapping.map(start))));
3166
3175
  return tr;
3167
3176
  }
3168
- function markInputRule(pattern, markType, markerLen) {
3177
+ function dualMarkInputRule(pattern, markTypes, outerMarkerLen, innerMarkerLen) {
3178
+ const totalMarkerLen = (outerMarkerLen + innerMarkerLen) * 2;
3179
+ return new InputRule(pattern, (state, match, start, end) => {
3180
+ const slashState = slashCommandKey.getState(state);
3181
+ if (slashState?.active) return null;
3182
+ const textContent2 = match[1];
3183
+ const fullMatch = match[0];
3184
+ const markedLength = totalMarkerLen + textContent2.length;
3185
+ const prefixLen = fullMatch.length - markedLength;
3186
+ const deleteFrom = start + prefixLen;
3187
+ const tr = state.tr;
3188
+ tr.delete(deleteFrom, end);
3189
+ const marks = markTypes.map((m) => m.create());
3190
+ const textNode = state.schema.text(textContent2, marks);
3191
+ tr.insert(deleteFrom, textNode);
3192
+ for (const m of markTypes) tr.removeStoredMark(m);
3193
+ return tr;
3194
+ });
3195
+ }
3196
+ function markInputRule(pattern, markType, markerLen, skipPrefix) {
3169
3197
  return new InputRule(pattern, (state, match, start, end) => {
3170
3198
  const slashState = slashCommandKey.getState(state);
3171
3199
  if (slashState?.active) return null;
@@ -3174,6 +3202,10 @@ function markInputRule(pattern, markType, markerLen) {
3174
3202
  const markedLength = markerLen * 2 + textContent2.length;
3175
3203
  const prefixLen = fullMatch.length - markedLength;
3176
3204
  const deleteFrom = start + prefixLen;
3205
+ if (skipPrefix && deleteFrom >= skipPrefix.length) {
3206
+ const before = state.doc.textBetween(deleteFrom - skipPrefix.length, deleteFrom);
3207
+ if (before === skipPrefix) return null;
3208
+ }
3177
3209
  const tr = state.tr;
3178
3210
  tr.delete(deleteFrom, end);
3179
3211
  const textNode = state.schema.text(textContent2, [markType.create()]);
@@ -3297,8 +3329,10 @@ function createInputRulesPlugin() {
3297
3329
  return tr;
3298
3330
  })
3299
3331
  );
3300
- rules.push(markInputRule(BOLD_RE, actionbookSchema.marks.bold, 2));
3301
- rules.push(markInputRule(ITALIC_RE, actionbookSchema.marks.italic, 2));
3332
+ rules.push(dualMarkInputRule(BOLD_ITALIC_RE1, [actionbookSchema.marks.bold, actionbookSchema.marks.italic], 2, 2));
3333
+ rules.push(dualMarkInputRule(BOLD_ITALIC_RE2, [actionbookSchema.marks.bold, actionbookSchema.marks.italic], 2, 2));
3334
+ rules.push(markInputRule(BOLD_RE, actionbookSchema.marks.bold, 2, "__"));
3335
+ rules.push(markInputRule(ITALIC_RE, actionbookSchema.marks.italic, 2, "**"));
3302
3336
  rules.push(markInputRule(STRIKE_RE, actionbookSchema.marks.strikethrough, 2));
3303
3337
  rules.push(markInputRule(CODE_RE, actionbookSchema.marks.code, 1));
3304
3338
  return rules;
@@ -5329,7 +5363,7 @@ function parseFragment(markdown) {
5329
5363
  }
5330
5364
 
5331
5365
  // src/jinja/scanner.ts
5332
- var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*([^%]*?)\s*%\}/g;
5366
+ var JINJA_PATTERN = /\{%\s*(if|elif|else|endif)\s*(.*?)\s*%\}/g;
5333
5367
  function scanJinjaBlocks(text2) {
5334
5368
  const blocks = [];
5335
5369
  JINJA_PATTERN.lastIndex = 0;
@@ -5530,7 +5564,7 @@ function tokenize(input) {
5530
5564
  tokens.push({ type: "STRING", value: str });
5531
5565
  continue;
5532
5566
  }
5533
- if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS"].includes(tokens[tokens.length - 1].type))) {
5567
+ if (/[0-9]/.test(input[i]) || input[i] === "-" && i + 1 < input.length && /[0-9]/.test(input[i + 1]) && (tokens.length === 0 || ["AND", "OR", "NOT", "EQ", "NEQ", "LT", "GT", "LTE", "GTE", "LPAREN", "IN", "IS", "COMMA"].includes(tokens[tokens.length - 1].type))) {
5534
5568
  let num = "";
5535
5569
  if (input[i] === "-") {
5536
5570
  num = "-";
@@ -6066,6 +6100,10 @@ function createPlugin() {
6066
6100
  shiftHeld = false;
6067
6101
  return false;
6068
6102
  },
6103
+ blur() {
6104
+ shiftHeld = false;
6105
+ return false;
6106
+ },
6069
6107
  paste(view, event) {
6070
6108
  if (shiftHeld) return false;
6071
6109
  const clipboardData = event.clipboardData;
@@ -7447,7 +7485,7 @@ function JinjaBranchHeader({
7447
7485
  onSelect: onDelete
7448
7486
  });
7449
7487
  }
7450
- const canOpenFooterMenu = editable && isLastBranch && branchType !== "else";
7488
+ const canOpenFooterMenu = editable && isLastBranch && branchType !== "else" && !hasElseBranch;
7451
7489
  const isMenuOpen = (source) => menuSource === source && menuItems.length > 0;
7452
7490
  const [conditionTouched, setConditionTouched] = useState3(false);
7453
7491
  const conditionError = (() => {
@@ -7880,6 +7918,14 @@ function createLinkClickPlugin() {
7880
7918
  if (!href) return false;
7881
7919
  event.preventDefault();
7882
7920
  if (href.startsWith("#")) return true;
7921
+ if (href.startsWith("mailto:") || href.startsWith("tel:")) {
7922
+ window.location.href = href;
7923
+ return true;
7924
+ }
7925
+ if (href.startsWith("www.")) {
7926
+ window.open(`https://${href}`, "_blank", "noopener,noreferrer");
7927
+ return true;
7928
+ }
7883
7929
  window.open(href, "_blank", "noopener,noreferrer");
7884
7930
  return true;
7885
7931
  }
@@ -8521,7 +8567,12 @@ var DragHandleController = class {
8521
8567
  this.dropIndicator.className = "ab-drop-indicator";
8522
8568
  this.dropIndicator.style.display = "none";
8523
8569
  parent.appendChild(this.dropIndicator);
8524
- this.scrollContainer = this.findScrollContainer(this.view.dom);
8570
+ const newScrollContainer = this.findScrollContainer(this.view.dom);
8571
+ if (newScrollContainer !== this.scrollContainer) {
8572
+ this.scrollContainer.removeEventListener("scroll", this.onScroll);
8573
+ this.scrollContainer = newScrollContainer;
8574
+ this.scrollContainer.addEventListener("scroll", this.onScroll, { passive: true });
8575
+ }
8525
8576
  this.tickAutoScroll();
8526
8577
  }
8527
8578
  addGlobalDragListeners(pointerId) {
@@ -9937,7 +9988,7 @@ function SelectionToolbar({ view, state, selectionRect }) {
9937
9988
  TBtn,
9938
9989
  {
9939
9990
  active: isStrike,
9940
- title: "Strikethrough (Cmd+Shift+X)",
9991
+ title: "Strikethrough (Cmd+Shift+S)",
9941
9992
  onMouseDown: () => run(toggleMark2(strikethrough2)),
9942
9993
  style: { textDecoration: "line-through" },
9943
9994
  children: "S"