Skip to content

Commit dfd4e37

Browse files
committed
chore: ai wire in from live preview for disabled dialogs
1 parent bba514e commit dfd4e37

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/LiveDevelopment/LivePreviewEdit.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ define(function (require, exports, module) {
3131
const ProjectManager = require("project/ProjectManager");
3232
const FileSystem = require("filesystem/FileSystem");
3333
const PathUtils = require("thirdparty/path-utils/path-utils");
34+
const ProDialogs = require("services/pro-dialogs");
35+
36+
const KernalModeTrust = window.KernalModeTrust;
37+
if(!KernalModeTrust){
38+
// integrated extensions will have access to kernal mode, but not external extensions
39+
throw new Error("profile menu should have access to KernalModeTrust. Cannot boot without trust ring");
40+
}
3441

3542
/**
3643
* This function syncs text content changes between the original source code
@@ -591,9 +598,17 @@ define(function (require, exports, module) {
591598
return AIData;
592599
}
593600

594-
function _editWithAI(message) {
601+
async function _editWithAI(message) {
595602
const AIData = _getRequiredDataForAI(message);
596-
// write the AI implementation here...@abose
603+
const aiEntitlement = await KernalModeTrust.EntitlementsManager.getAIEntitlement();
604+
if (!aiEntitlement.activated) {
605+
// Ai is not activated for user(not logged in/no ai plan/disabled by system admin)
606+
// the showAIUpsellDialog will show an appropriate message for each case.
607+
ProDialogs.showAIUpsellDialog(aiEntitlement);
608+
return;
609+
}
610+
// todo @abose ai wire in
611+
console.log(AIData);
597612
}
598613

599614
/**

0 commit comments

Comments
 (0)