easy-email-pro-theme 1.59.4 → 1.59.5
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/lib/index.js +216 -67
- package/lib/style.css +73 -0
- package/lib/typings/components/AIAgent/App.d.ts +12 -1
- package/lib/typings/components/AIAgent/keyboard.d.ts +11 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -40918,6 +40918,13 @@ const StandaloneElementSaveButtonPortal = (props) => {
|
|
|
40918
40918
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null);
|
|
40919
40919
|
};
|
|
40920
40920
|
const styles$2 = "";
|
|
40921
|
+
function isImeComposing(event) {
|
|
40922
|
+
var _a;
|
|
40923
|
+
return Boolean(((_a = event.nativeEvent) == null ? void 0 : _a.isComposing) || event.keyCode === 229);
|
|
40924
|
+
}
|
|
40925
|
+
function shouldSubmitOnEnter(event) {
|
|
40926
|
+
return event.key === "Enter" && !event.shiftKey && !isImeComposing(event);
|
|
40927
|
+
}
|
|
40921
40928
|
function copyImageUrl(attachment) {
|
|
40922
40929
|
return __async(this, null, function* () {
|
|
40923
40930
|
const value = attachment.url || attachment.dataUrl;
|
|
@@ -41115,6 +41122,10 @@ function quickActionLabel(action2) {
|
|
|
41115
41122
|
function quickActionPrompt(action2) {
|
|
41116
41123
|
return typeof action2 === "string" ? action2 : action2.prompt;
|
|
41117
41124
|
}
|
|
41125
|
+
function quickActionTitle(action2) {
|
|
41126
|
+
const prompt = quickActionPrompt(action2).trim();
|
|
41127
|
+
return prompt || quickActionLabel(action2);
|
|
41128
|
+
}
|
|
41118
41129
|
function fileToAttachment(file) {
|
|
41119
41130
|
return new Promise((resolve, reject) => {
|
|
41120
41131
|
const reader = new FileReader();
|
|
@@ -41197,6 +41208,7 @@ function EasyEmailProAiAgent({
|
|
|
41197
41208
|
activity,
|
|
41198
41209
|
disabled = false,
|
|
41199
41210
|
sendDisabled = false,
|
|
41211
|
+
selectedElement,
|
|
41200
41212
|
quickActions = getDefaultQuickActions(),
|
|
41201
41213
|
pendingAction,
|
|
41202
41214
|
pendingDecision,
|
|
@@ -41209,7 +41221,7 @@ function EasyEmailProAiAgent({
|
|
|
41209
41221
|
onQuickAction,
|
|
41210
41222
|
onClearHistory
|
|
41211
41223
|
}) {
|
|
41212
|
-
var _a;
|
|
41224
|
+
var _a, _b, _c;
|
|
41213
41225
|
assertAiAgentFeatureEnabled();
|
|
41214
41226
|
const [draft, setDraft] = useState("");
|
|
41215
41227
|
const [attachments, setAttachments] = useState([]);
|
|
@@ -41228,10 +41240,18 @@ function EasyEmailProAiAgent({
|
|
|
41228
41240
|
const activityState = status === "running" || /applying|updating|generating|connecting|sending|uploading|reading|analyzing|preparing|processing|正在|读取|分析|准备|处理中|更新中|生成中|上传中/i.test(activity || "") ? "working" : /not applied|failed|error|失败|未应用/i.test(activity || "") ? "warning" : /updated|applied|generated|ready|完成|已更新|已应用|已生成/i.test(activity || "") ? "success" : "idle";
|
|
41229
41241
|
const visibleActivity = activityState === "success" ? "" : activity;
|
|
41230
41242
|
const lastSuccessfulAssistantMessageId = activityState === "success" ? (_a = [...messages].reverse().find((message) => message.role === "assistant" && message.status !== "error")) == null ? void 0 : _a.id : null;
|
|
41243
|
+
const selectedElementMeta = selectedElement ? [
|
|
41244
|
+
selectedElement.type,
|
|
41245
|
+
((_b = selectedElement.path) == null ? void 0 : _b.length) ? `path: ${selectedElement.path.join(".")}` : null,
|
|
41246
|
+
selectedElement.width || selectedElement.height ? `${t("Size")}: ${selectedElement.width || "-"} x ${selectedElement.height || "-"}` : null,
|
|
41247
|
+
selectedElement.imageSrc ? `${t("URL")}: ${selectedElement.imageSrc}` : null,
|
|
41248
|
+
selectedElement.id ? `id: ${selectedElement.id}` : null,
|
|
41249
|
+
selectedElement.uid ? `uid: ${selectedElement.uid}` : null
|
|
41250
|
+
].filter(Boolean).join(" · ") : "";
|
|
41231
41251
|
function scrollThreadToBottom() {
|
|
41232
41252
|
const scroll2 = () => {
|
|
41233
|
-
var _a2,
|
|
41234
|
-
const container2 = (
|
|
41253
|
+
var _a2, _b2;
|
|
41254
|
+
const container2 = (_b2 = (_a2 = scrollbarsRef.current) == null ? void 0 : _a2.osInstance()) == null ? void 0 : _b2.getElements().viewport;
|
|
41235
41255
|
if (!container2)
|
|
41236
41256
|
return;
|
|
41237
41257
|
container2.scrollTop = container2.scrollHeight;
|
|
@@ -41315,6 +41335,22 @@ function EasyEmailProAiAgent({
|
|
|
41315
41335
|
yield onSend == null ? void 0 : onSend(prompt, readyAttachments);
|
|
41316
41336
|
});
|
|
41317
41337
|
}
|
|
41338
|
+
function submitDecisionDraft(pendingDecision2) {
|
|
41339
|
+
const value = decisionDraft.trim();
|
|
41340
|
+
if (!value)
|
|
41341
|
+
return;
|
|
41342
|
+
const choice = {
|
|
41343
|
+
id: "custom",
|
|
41344
|
+
label: value,
|
|
41345
|
+
prompt: value
|
|
41346
|
+
};
|
|
41347
|
+
void (onChooseDecision == null ? void 0 : onChooseDecision(choice, {
|
|
41348
|
+
decisionId: pendingDecision2.id,
|
|
41349
|
+
choiceId: "custom",
|
|
41350
|
+
label: value,
|
|
41351
|
+
customText: value
|
|
41352
|
+
}));
|
|
41353
|
+
}
|
|
41318
41354
|
function uploadImageFiles(files) {
|
|
41319
41355
|
return __async(this, null, function* () {
|
|
41320
41356
|
if (!files.length || disabled || uploading)
|
|
@@ -41380,7 +41416,7 @@ function EasyEmailProAiAgent({
|
|
|
41380
41416
|
className: "eep-ai-agent__body-scrollbar"
|
|
41381
41417
|
},
|
|
41382
41418
|
/* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__body" }, /* @__PURE__ */ React__default.createElement("section", { className: "eep-ai-agent__thread", "aria-label": t("AI conversation") }, messages.map((message) => {
|
|
41383
|
-
var _a2,
|
|
41419
|
+
var _a2, _b2;
|
|
41384
41420
|
return /* @__PURE__ */ React__default.createElement("article", { className: classNames("eep-ai-agent__message", `is-${message.role}`), key: message.id }, ((_a2 = message.attachments) == null ? void 0 : _a2.length) ? /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__attachments", "aria-label": t("Attachments") }, message.attachments.map((attachment) => /* @__PURE__ */ React__default.createElement(
|
|
41385
41421
|
"button",
|
|
41386
41422
|
{
|
|
@@ -41412,7 +41448,7 @@ function EasyEmailProAiAgent({
|
|
|
41412
41448
|
},
|
|
41413
41449
|
copiedAttachmentId === attachment.id ? t("Copied") : "⧉"
|
|
41414
41450
|
)
|
|
41415
|
-
))) : null, /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__bubble" }, message.content), ((
|
|
41451
|
+
))) : null, /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__bubble" }, message.content), ((_b2 = message.sources) == null ? void 0 : _b2.length) ? /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__sources", "aria-label": t("Sources") }, message.sources.slice(0, 3).map((source) => /* @__PURE__ */ React__default.createElement(
|
|
41416
41452
|
"a",
|
|
41417
41453
|
{
|
|
41418
41454
|
href: source.url,
|
|
@@ -41484,39 +41520,51 @@ function EasyEmailProAiAgent({
|
|
|
41484
41520
|
/* @__PURE__ */ React__default.createElement("span", null, /* @__PURE__ */ React__default.createElement("strong", null, choice.label), choice.description ? /* @__PURE__ */ React__default.createElement("small", null, choice.description) : null)
|
|
41485
41521
|
))),
|
|
41486
41522
|
pendingDecision.allowCustom ? /* @__PURE__ */ React__default.createElement(
|
|
41487
|
-
"
|
|
41523
|
+
"div",
|
|
41488
41524
|
{
|
|
41489
|
-
className: "eep-ai-agent__decision-custom"
|
|
41490
|
-
onSubmit: (event) => {
|
|
41491
|
-
event.preventDefault();
|
|
41492
|
-
const value = decisionDraft.trim();
|
|
41493
|
-
if (!value)
|
|
41494
|
-
return;
|
|
41495
|
-
const choice = {
|
|
41496
|
-
id: "custom",
|
|
41497
|
-
label: value,
|
|
41498
|
-
prompt: value
|
|
41499
|
-
};
|
|
41500
|
-
void (onChooseDecision == null ? void 0 : onChooseDecision(choice, {
|
|
41501
|
-
decisionId: pendingDecision.id,
|
|
41502
|
-
choiceId: "custom",
|
|
41503
|
-
label: value,
|
|
41504
|
-
customText: value
|
|
41505
|
-
}));
|
|
41506
|
-
}
|
|
41525
|
+
className: "eep-ai-agent__decision-custom"
|
|
41507
41526
|
},
|
|
41508
41527
|
/* @__PURE__ */ React__default.createElement(
|
|
41509
41528
|
"input",
|
|
41510
41529
|
{
|
|
41511
41530
|
value: decisionDraft,
|
|
41512
41531
|
onChange: (event) => setDecisionDraft(event.target.value),
|
|
41532
|
+
onKeyDown: (event) => {
|
|
41533
|
+
if (!shouldSubmitOnEnter(event))
|
|
41534
|
+
return;
|
|
41535
|
+
event.preventDefault();
|
|
41536
|
+
submitDecisionDraft(pendingDecision);
|
|
41537
|
+
},
|
|
41513
41538
|
placeholder: t("Or describe what you want...")
|
|
41514
41539
|
}
|
|
41515
41540
|
),
|
|
41516
|
-
/* @__PURE__ */ React__default.createElement(
|
|
41541
|
+
/* @__PURE__ */ React__default.createElement(
|
|
41542
|
+
"button",
|
|
41543
|
+
{
|
|
41544
|
+
type: "button",
|
|
41545
|
+
disabled: !decisionDraft.trim(),
|
|
41546
|
+
onClick: () => submitDecisionDraft(pendingDecision)
|
|
41547
|
+
},
|
|
41548
|
+
t("Send")
|
|
41549
|
+
)
|
|
41517
41550
|
) : null
|
|
41518
41551
|
)) : null))
|
|
41519
|
-
), /* @__PURE__ */ React__default.createElement("footer", { className: "eep-ai-agent__composer-wrap" },
|
|
41552
|
+
), /* @__PURE__ */ React__default.createElement("footer", { className: "eep-ai-agent__composer-wrap" }, selectedElement ? /* @__PURE__ */ React__default.createElement(
|
|
41553
|
+
"div",
|
|
41554
|
+
{
|
|
41555
|
+
className: "eep-ai-agent__selection",
|
|
41556
|
+
"aria-label": `${t("Selected")} ${t("Element")}`
|
|
41557
|
+
},
|
|
41558
|
+
selectedElement.imageSrc ? /* @__PURE__ */ React__default.createElement(
|
|
41559
|
+
"img",
|
|
41560
|
+
{
|
|
41561
|
+
className: "eep-ai-agent__selection-preview",
|
|
41562
|
+
src: selectedElement.imageSrc,
|
|
41563
|
+
alt: selectedElement.label
|
|
41564
|
+
}
|
|
41565
|
+
) : /* @__PURE__ */ React__default.createElement("span", { className: "eep-ai-agent__selection-icon", "aria-hidden": "true" }, ((_c = selectedElement.label) == null ? void 0 : _c.slice(0, 1)) || "-"),
|
|
41566
|
+
/* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__selection-content" }, /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__selection-title" }, /* @__PURE__ */ React__default.createElement("span", null, t("Selected")), /* @__PURE__ */ React__default.createElement("strong", null, selectedElement.label || "-")), /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__selection-meta", title: selectedElementMeta }, selectedElementMeta))
|
|
41567
|
+
) : null, visibleActivity || uploadError || attachments.length || pendingAction ? /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__composer-meta" }, attachments.length ? /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__pending-attachments", "aria-label": t("Pending images") }, attachments.map((attachment) => /* @__PURE__ */ React__default.createElement(
|
|
41520
41568
|
"button",
|
|
41521
41569
|
{
|
|
41522
41570
|
className: "eep-ai-agent__pending-attachment",
|
|
@@ -41582,30 +41630,46 @@ function EasyEmailProAiAgent({
|
|
|
41582
41630
|
"aria-label": t("Quick actions")
|
|
41583
41631
|
},
|
|
41584
41632
|
quickActionsExpanded && hasMenuQuickActions ? /* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__quick-actions-menu" }, menuQuickActions.map((action2, index2) => /* @__PURE__ */ React__default.createElement(
|
|
41585
|
-
|
|
41633
|
+
Tooltip,
|
|
41586
41634
|
{
|
|
41587
|
-
|
|
41635
|
+
content: quickActionTitle(action2),
|
|
41588
41636
|
key: `${quickActionLabel(action2)}-${index2}`,
|
|
41589
|
-
|
|
41590
|
-
disabled: disabled || sendDisabled || uploading,
|
|
41591
|
-
onClick: () => {
|
|
41592
|
-
void runQuickAction(action2);
|
|
41593
|
-
}
|
|
41637
|
+
position: "right"
|
|
41594
41638
|
},
|
|
41595
|
-
|
|
41639
|
+
/* @__PURE__ */ React__default.createElement(
|
|
41640
|
+
"button",
|
|
41641
|
+
{
|
|
41642
|
+
className: "eep-ai-agent__quick-action-menu-item",
|
|
41643
|
+
type: "button",
|
|
41644
|
+
"aria-label": `${quickActionLabel(action2)}: ${quickActionTitle(action2)}`,
|
|
41645
|
+
disabled: disabled || sendDisabled || uploading,
|
|
41646
|
+
onClick: () => {
|
|
41647
|
+
void runQuickAction(action2);
|
|
41648
|
+
}
|
|
41649
|
+
},
|
|
41650
|
+
quickActionLabel(action2)
|
|
41651
|
+
)
|
|
41596
41652
|
))) : null,
|
|
41597
41653
|
/* @__PURE__ */ React__default.createElement("div", { className: "eep-ai-agent__quick-actions-bar" }, visibleQuickActions.map((action2, index2) => /* @__PURE__ */ React__default.createElement(
|
|
41598
|
-
|
|
41654
|
+
Tooltip,
|
|
41599
41655
|
{
|
|
41600
|
-
|
|
41656
|
+
content: quickActionTitle(action2),
|
|
41601
41657
|
key: `${quickActionLabel(action2)}-${index2}`,
|
|
41602
|
-
|
|
41603
|
-
disabled: disabled || sendDisabled || uploading,
|
|
41604
|
-
onClick: () => {
|
|
41605
|
-
void runQuickAction(action2);
|
|
41606
|
-
}
|
|
41658
|
+
position: "top"
|
|
41607
41659
|
},
|
|
41608
|
-
|
|
41660
|
+
/* @__PURE__ */ React__default.createElement(
|
|
41661
|
+
"button",
|
|
41662
|
+
{
|
|
41663
|
+
className: "eep-ai-agent__quick-action-pill",
|
|
41664
|
+
type: "button",
|
|
41665
|
+
"aria-label": `${quickActionLabel(action2)}: ${quickActionTitle(action2)}`,
|
|
41666
|
+
disabled: disabled || sendDisabled || uploading,
|
|
41667
|
+
onClick: () => {
|
|
41668
|
+
void runQuickAction(action2);
|
|
41669
|
+
}
|
|
41670
|
+
},
|
|
41671
|
+
quickActionLabel(action2)
|
|
41672
|
+
)
|
|
41609
41673
|
)), hasMenuQuickActions ? /* @__PURE__ */ React__default.createElement(
|
|
41610
41674
|
"button",
|
|
41611
41675
|
{
|
|
@@ -41628,10 +41692,10 @@ function EasyEmailProAiAgent({
|
|
|
41628
41692
|
rows: 1,
|
|
41629
41693
|
onChange: (event) => setDraft(event.target.value),
|
|
41630
41694
|
onKeyDown: (event) => {
|
|
41631
|
-
if (
|
|
41632
|
-
|
|
41633
|
-
|
|
41634
|
-
|
|
41695
|
+
if (!shouldSubmitOnEnter(event))
|
|
41696
|
+
return;
|
|
41697
|
+
event.preventDefault();
|
|
41698
|
+
submit();
|
|
41635
41699
|
}
|
|
41636
41700
|
}
|
|
41637
41701
|
)), /* @__PURE__ */ React__default.createElement(
|
|
@@ -41779,6 +41843,47 @@ function mapGeneratedImageAttachment(attachment) {
|
|
|
41779
41843
|
function isRemoteImageUrl(url) {
|
|
41780
41844
|
return Boolean(url && !url.startsWith("data:"));
|
|
41781
41845
|
}
|
|
41846
|
+
function isRecord(value) {
|
|
41847
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
41848
|
+
}
|
|
41849
|
+
function targetMatchesRecord(target, record) {
|
|
41850
|
+
if (!target)
|
|
41851
|
+
return false;
|
|
41852
|
+
if ("id" in target)
|
|
41853
|
+
return record.id === target.id;
|
|
41854
|
+
if ("uid" in target)
|
|
41855
|
+
return record.uid === target.uid;
|
|
41856
|
+
return false;
|
|
41857
|
+
}
|
|
41858
|
+
function replaceTargetAttributeInTemplate(template, target, key2, value) {
|
|
41859
|
+
let replaced = false;
|
|
41860
|
+
const visit = (node) => {
|
|
41861
|
+
if (Array.isArray(node))
|
|
41862
|
+
return node.map(visit);
|
|
41863
|
+
if (!isRecord(node))
|
|
41864
|
+
return node;
|
|
41865
|
+
let next = node;
|
|
41866
|
+
if (targetMatchesRecord(target, node)) {
|
|
41867
|
+
const attributes = isRecord(node.attributes) ? node.attributes : {};
|
|
41868
|
+
next = __spreadProps(__spreadValues({}, node), {
|
|
41869
|
+
attributes: __spreadProps(__spreadValues({}, attributes), {
|
|
41870
|
+
[key2]: value
|
|
41871
|
+
})
|
|
41872
|
+
});
|
|
41873
|
+
replaced = true;
|
|
41874
|
+
}
|
|
41875
|
+
let changed = next !== node;
|
|
41876
|
+
const entries = Object.entries(next).map(([entryKey, entryValue]) => {
|
|
41877
|
+
const nextValue = visit(entryValue);
|
|
41878
|
+
if (nextValue !== entryValue)
|
|
41879
|
+
changed = true;
|
|
41880
|
+
return [entryKey, nextValue];
|
|
41881
|
+
});
|
|
41882
|
+
return changed ? Object.fromEntries(entries) : node;
|
|
41883
|
+
};
|
|
41884
|
+
const nextTemplate = visit(template);
|
|
41885
|
+
return replaced ? nextTemplate : null;
|
|
41886
|
+
}
|
|
41782
41887
|
function imageResultText(payload) {
|
|
41783
41888
|
const lines = [payload.summary || t("Generated image.")];
|
|
41784
41889
|
if (payload.revisedPrompt) {
|
|
@@ -42178,28 +42283,44 @@ ${errors.join("\n")}` : toolCallsText(__spreadProps(__spreadValues({}, payload),
|
|
|
42178
42283
|
activeRun,
|
|
42179
42284
|
target,
|
|
42180
42285
|
payload.confidence
|
|
42181
|
-
) && optionsRef.current.onApplyToolCalls) {
|
|
42182
|
-
|
|
42183
|
-
activeRun,
|
|
42184
|
-
|
|
42185
|
-
|
|
42186
|
-
|
|
42187
|
-
|
|
42188
|
-
|
|
42286
|
+
) && (optionsRef.current.onApplyTemplate || optionsRef.current.onApplyToolCalls)) {
|
|
42287
|
+
const attributeKey = imageTargetAttributeKey(
|
|
42288
|
+
activeRun.editorImages,
|
|
42289
|
+
target
|
|
42290
|
+
);
|
|
42291
|
+
const nextTemplate = optionsRef.current.onApplyTemplate && replaceTargetAttributeInTemplate(
|
|
42292
|
+
optionsRef.current.getTemplate(),
|
|
42293
|
+
target,
|
|
42294
|
+
attributeKey,
|
|
42295
|
+
generatedImageUrl
|
|
42296
|
+
);
|
|
42297
|
+
if (nextTemplate) {
|
|
42298
|
+
applyTemplateChange(
|
|
42299
|
+
activeRun,
|
|
42300
|
+
nextTemplate,
|
|
42301
|
+
payload.summary || t("Updated the selected image.")
|
|
42302
|
+
);
|
|
42303
|
+
refreshActiveRunTemplateKey(activeRun);
|
|
42304
|
+
} else if (optionsRef.current.onApplyToolCalls) {
|
|
42305
|
+
void applyToolCalls(
|
|
42306
|
+
activeRun,
|
|
42189
42307
|
{
|
|
42190
|
-
|
|
42191
|
-
|
|
42192
|
-
|
|
42193
|
-
|
|
42194
|
-
|
|
42195
|
-
|
|
42196
|
-
|
|
42197
|
-
|
|
42198
|
-
|
|
42199
|
-
|
|
42200
|
-
|
|
42201
|
-
|
|
42202
|
-
|
|
42308
|
+
summary: payload.summary || t("Updated the selected image."),
|
|
42309
|
+
toolCalls: []
|
|
42310
|
+
},
|
|
42311
|
+
[
|
|
42312
|
+
{
|
|
42313
|
+
name: "update_attribute",
|
|
42314
|
+
target,
|
|
42315
|
+
key: attributeKey,
|
|
42316
|
+
value: generatedImageUrl
|
|
42317
|
+
}
|
|
42318
|
+
]
|
|
42319
|
+
).then((applied) => {
|
|
42320
|
+
if (applied)
|
|
42321
|
+
refreshActiveRunTemplateKey(activeRun);
|
|
42322
|
+
});
|
|
42323
|
+
}
|
|
42203
42324
|
updateMessage(activeRun.assistantMessageId, {
|
|
42204
42325
|
content: imageResultText(payload),
|
|
42205
42326
|
attachments: payload.images.map(mapGeneratedImageAttachment),
|
|
@@ -42601,6 +42722,26 @@ function imageAssetTitle(node, source) {
|
|
|
42601
42722
|
}
|
|
42602
42723
|
return t("Image");
|
|
42603
42724
|
}
|
|
42725
|
+
function selectedElementSummary(node, path2) {
|
|
42726
|
+
if (!node)
|
|
42727
|
+
return null;
|
|
42728
|
+
const type = typeof node.type === "string" ? node.type : void 0;
|
|
42729
|
+
const isImageBlock = type ? IMAGE_BLOCK_TYPES.has(type) : false;
|
|
42730
|
+
const hasBackgroundImage = supportsBackgroundImage(node);
|
|
42731
|
+
const source = isImageBlock ? "image" : "background";
|
|
42732
|
+
const dimensions = getImageDimensions(node);
|
|
42733
|
+
const imageSrc = isImageBlock ? getImageSrc(node) : hasBackgroundImage ? getBackgroundImageSrc(node) : void 0;
|
|
42734
|
+
return {
|
|
42735
|
+
label: isImageBlock || hasBackgroundImage ? imageAssetTitle(node, source) : typeof node.title === "string" && node.title.trim() ? node.title : type || t("Element"),
|
|
42736
|
+
type,
|
|
42737
|
+
id: typeof node.id === "string" ? node.id : void 0,
|
|
42738
|
+
uid: typeof node.uid === "string" ? node.uid : void 0,
|
|
42739
|
+
path: path2,
|
|
42740
|
+
imageSrc,
|
|
42741
|
+
width: dimensions.width,
|
|
42742
|
+
height: dimensions.height
|
|
42743
|
+
};
|
|
42744
|
+
}
|
|
42604
42745
|
function selectedDescendants(editor, selectedNodePath) {
|
|
42605
42746
|
if (!selectedNodePath)
|
|
42606
42747
|
return [];
|
|
@@ -42650,6 +42791,13 @@ function AiAgentPanel({
|
|
|
42650
42791
|
useEffect(() => {
|
|
42651
42792
|
selectedRef.current = { selectedNode, selectedNodePath };
|
|
42652
42793
|
}, [selectedNode, selectedNodePath]);
|
|
42794
|
+
const selectedElement = useMemo(
|
|
42795
|
+
() => selectedElementSummary(
|
|
42796
|
+
selectedNode,
|
|
42797
|
+
selectedNodePath || void 0
|
|
42798
|
+
),
|
|
42799
|
+
[selectedNode, selectedNodePath]
|
|
42800
|
+
);
|
|
42653
42801
|
const uploadAttachment = useCallback(
|
|
42654
42802
|
(file) => __async(this, null, function* () {
|
|
42655
42803
|
const uploadHandler = uploadOverride || editorUpload;
|
|
@@ -42777,6 +42925,7 @@ function AiAgentPanel({
|
|
|
42777
42925
|
messages: session.messages,
|
|
42778
42926
|
status: session.status,
|
|
42779
42927
|
activity: session.activity,
|
|
42928
|
+
selectedElement,
|
|
42780
42929
|
disabled,
|
|
42781
42930
|
sendDisabled: disabled || session.status === "running",
|
|
42782
42931
|
quickActions,
|
package/lib/style.css
CHANGED
|
@@ -1922,6 +1922,79 @@ THEMES:
|
|
|
1922
1922
|
padding: 18px 12px 12px;
|
|
1923
1923
|
}
|
|
1924
1924
|
|
|
1925
|
+
.eep-ai-agent__selection {
|
|
1926
|
+
min-width: 0;
|
|
1927
|
+
display: grid;
|
|
1928
|
+
grid-template-columns: 40px minmax(0, 1fr);
|
|
1929
|
+
gap: 10px;
|
|
1930
|
+
align-items: center;
|
|
1931
|
+
margin-bottom: 10px;
|
|
1932
|
+
padding: 8px 10px;
|
|
1933
|
+
border: 1px solid var(--eep-ai-line);
|
|
1934
|
+
border-radius: 8px;
|
|
1935
|
+
background: rgba(255, 255, 255, 0.72);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
.eep-ai-agent__selection-preview,
|
|
1939
|
+
.eep-ai-agent__selection-icon {
|
|
1940
|
+
width: 40px;
|
|
1941
|
+
height: 40px;
|
|
1942
|
+
border-radius: 6px;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
.eep-ai-agent__selection-preview {
|
|
1946
|
+
display: block;
|
|
1947
|
+
object-fit: cover;
|
|
1948
|
+
background: var(--eep-ai-surface-muted);
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
.eep-ai-agent__selection-icon {
|
|
1952
|
+
display: inline-flex;
|
|
1953
|
+
align-items: center;
|
|
1954
|
+
justify-content: center;
|
|
1955
|
+
color: var(--eep-ai-primary-text);
|
|
1956
|
+
background: var(--eep-ai-primary-light);
|
|
1957
|
+
font-size: 15px;
|
|
1958
|
+
font-weight: 600;
|
|
1959
|
+
text-transform: uppercase;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
.eep-ai-agent__selection-content {
|
|
1963
|
+
min-width: 0;
|
|
1964
|
+
display: grid;
|
|
1965
|
+
gap: 2px;
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
.eep-ai-agent__selection-title {
|
|
1969
|
+
min-width: 0;
|
|
1970
|
+
display: flex;
|
|
1971
|
+
gap: 6px;
|
|
1972
|
+
align-items: baseline;
|
|
1973
|
+
color: var(--eep-ai-muted);
|
|
1974
|
+
font-size: 12px;
|
|
1975
|
+
line-height: 18px;
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.eep-ai-agent__selection-title strong {
|
|
1979
|
+
min-width: 0;
|
|
1980
|
+
color: var(--eep-ai-text);
|
|
1981
|
+
font-size: 13px;
|
|
1982
|
+
font-weight: 600;
|
|
1983
|
+
overflow: hidden;
|
|
1984
|
+
text-overflow: ellipsis;
|
|
1985
|
+
white-space: nowrap;
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
.eep-ai-agent__selection-meta {
|
|
1989
|
+
min-width: 0;
|
|
1990
|
+
color: var(--eep-ai-muted);
|
|
1991
|
+
font-size: 11px;
|
|
1992
|
+
line-height: 16px;
|
|
1993
|
+
overflow: hidden;
|
|
1994
|
+
text-overflow: ellipsis;
|
|
1995
|
+
white-space: nowrap;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1925
1998
|
.eep-ai-agent__thread {
|
|
1926
1999
|
display: grid;
|
|
1927
2000
|
gap: 18px;
|
|
@@ -29,6 +29,16 @@ export type AiAgentAttachment = {
|
|
|
29
29
|
dataUrl?: string;
|
|
30
30
|
size?: number;
|
|
31
31
|
};
|
|
32
|
+
export type AiAgentSelectedElement = {
|
|
33
|
+
label: string;
|
|
34
|
+
type?: string;
|
|
35
|
+
id?: string;
|
|
36
|
+
uid?: string;
|
|
37
|
+
path?: number[];
|
|
38
|
+
imageSrc?: string;
|
|
39
|
+
width?: number;
|
|
40
|
+
height?: number;
|
|
41
|
+
};
|
|
32
42
|
export type AiQuickAction = string | {
|
|
33
43
|
label: string;
|
|
34
44
|
prompt: string;
|
|
@@ -43,6 +53,7 @@ export type EasyEmailProAiAgentProps = {
|
|
|
43
53
|
activity?: string;
|
|
44
54
|
disabled?: boolean;
|
|
45
55
|
sendDisabled?: boolean;
|
|
56
|
+
selectedElement?: AiAgentSelectedElement | null;
|
|
46
57
|
quickActions?: AiQuickAction[];
|
|
47
58
|
pendingAction?: {
|
|
48
59
|
label: string;
|
|
@@ -62,4 +73,4 @@ export type EasyEmailProAiAgentProps = {
|
|
|
62
73
|
onClearHistory?: () => void | Promise<void>;
|
|
63
74
|
onClose?: () => void;
|
|
64
75
|
};
|
|
65
|
-
export declare function EasyEmailProAiAgent({ className, messages, activity, disabled, sendDisabled, quickActions, pendingAction, pendingDecision, placeholder, onSend, onUpload, onChooseDecision, onCancelDecision, onRestoreSnapshot, onQuickAction, onClearHistory, }: EasyEmailProAiAgentProps): React.JSX.Element;
|
|
76
|
+
export declare function EasyEmailProAiAgent({ className, messages, activity, disabled, sendDisabled, selectedElement, quickActions, pendingAction, pendingDecision, placeholder, onSend, onUpload, onChooseDecision, onCancelDecision, onRestoreSnapshot, onQuickAction, onClearHistory, }: EasyEmailProAiAgentProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type KeyboardLikeEvent = {
|
|
2
|
+
key?: string;
|
|
3
|
+
shiftKey?: boolean;
|
|
4
|
+
keyCode?: number;
|
|
5
|
+
nativeEvent?: {
|
|
6
|
+
isComposing?: boolean;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function isImeComposing(event: KeyboardLikeEvent): boolean;
|
|
10
|
+
export declare function shouldSubmitOnEnter(event: KeyboardLikeEvent): boolean;
|
|
11
|
+
export {};
|