@optifye/dashboard-core 4.3.4 → 4.3.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/dist/index.js +153 -38
- package/dist/index.mjs +153 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25086,17 +25086,49 @@ var AIAgentView = () => {
|
|
|
25086
25086
|
chartElements.push(chartElement);
|
|
25087
25087
|
} else {
|
|
25088
25088
|
console.warn(`[DEBUG] Chart element was null for type: ${chartType}`);
|
|
25089
|
+
console.warn(`[DEBUG] Args were:`, args);
|
|
25090
|
+
chartElements.push(
|
|
25091
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25092
|
+
"div",
|
|
25093
|
+
{
|
|
25094
|
+
className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
|
|
25095
|
+
children: [
|
|
25096
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Chart Rendering Error:" }),
|
|
25097
|
+
" Failed to render ",
|
|
25098
|
+
chartType,
|
|
25099
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
25100
|
+
/* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
|
|
25101
|
+
"Check console for details. Args: ",
|
|
25102
|
+
JSON.stringify(args, null, 2)
|
|
25103
|
+
] })
|
|
25104
|
+
]
|
|
25105
|
+
},
|
|
25106
|
+
`error-${startIndex}`
|
|
25107
|
+
)
|
|
25108
|
+
);
|
|
25089
25109
|
}
|
|
25090
25110
|
} catch (error) {
|
|
25091
25111
|
console.error(`Failed to parse chart ${chartType}:`, error);
|
|
25112
|
+
console.error(`Args string was:`, argsString);
|
|
25092
25113
|
chartElements.push(
|
|
25093
25114
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
25094
25115
|
"div",
|
|
25095
25116
|
{
|
|
25096
|
-
className: "text-red-500 text-sm",
|
|
25117
|
+
className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
|
|
25097
25118
|
children: [
|
|
25098
|
-
"
|
|
25099
|
-
|
|
25119
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { children: "Chart Parsing Error:" }),
|
|
25120
|
+
" Failed to parse ",
|
|
25121
|
+
chartType,
|
|
25122
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
25123
|
+
/* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
|
|
25124
|
+
"Error: ",
|
|
25125
|
+
error instanceof Error ? error.message : String(error)
|
|
25126
|
+
] }),
|
|
25127
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
25128
|
+
/* @__PURE__ */ jsxRuntime.jsxs("small", { children: [
|
|
25129
|
+
"Original: ",
|
|
25130
|
+
match[0]
|
|
25131
|
+
] })
|
|
25100
25132
|
]
|
|
25101
25133
|
},
|
|
25102
25134
|
`error-${startIndex}`
|
|
@@ -25127,43 +25159,126 @@ var AIAgentView = () => {
|
|
|
25127
25159
|
return chartElements;
|
|
25128
25160
|
};
|
|
25129
25161
|
const parseChartArguments = (argsString) => {
|
|
25130
|
-
const args = {};
|
|
25131
25162
|
console.log("[DEBUG] Parsing chart arguments:", argsString);
|
|
25132
|
-
const
|
|
25133
|
-
|
|
25134
|
-
|
|
25135
|
-
|
|
25136
|
-
|
|
25137
|
-
|
|
25138
|
-
|
|
25139
|
-
|
|
25140
|
-
|
|
25141
|
-
|
|
25142
|
-
|
|
25143
|
-
|
|
25144
|
-
|
|
25145
|
-
|
|
25146
|
-
|
|
25147
|
-
|
|
25148
|
-
|
|
25149
|
-
|
|
25150
|
-
|
|
25151
|
-
|
|
25152
|
-
|
|
25153
|
-
|
|
25154
|
-
|
|
25155
|
-
|
|
25156
|
-
|
|
25157
|
-
|
|
25158
|
-
|
|
25159
|
-
|
|
25160
|
-
|
|
25161
|
-
|
|
25162
|
-
|
|
25163
|
+
const extractParameters = (str) => {
|
|
25164
|
+
const params = {};
|
|
25165
|
+
let currentPos = 0;
|
|
25166
|
+
while (currentPos < str.length) {
|
|
25167
|
+
while (currentPos < str.length && /\s|,/.test(str[currentPos])) {
|
|
25168
|
+
currentPos++;
|
|
25169
|
+
}
|
|
25170
|
+
if (currentPos >= str.length) break;
|
|
25171
|
+
const paramMatch = str.substring(currentPos).match(/^(\w+)\s*=/);
|
|
25172
|
+
if (!paramMatch) {
|
|
25173
|
+
console.warn("[DEBUG] No parameter name found at position", currentPos);
|
|
25174
|
+
break;
|
|
25175
|
+
}
|
|
25176
|
+
const paramName = paramMatch[1];
|
|
25177
|
+
currentPos += paramMatch[0].length;
|
|
25178
|
+
while (currentPos < str.length && /\s/.test(str[currentPos])) {
|
|
25179
|
+
currentPos++;
|
|
25180
|
+
}
|
|
25181
|
+
if (currentPos >= str.length) break;
|
|
25182
|
+
let value;
|
|
25183
|
+
let valueEnd;
|
|
25184
|
+
if (str[currentPos] === "[") {
|
|
25185
|
+
let bracketCount = 0;
|
|
25186
|
+
let arrayStart = currentPos;
|
|
25187
|
+
valueEnd = str.length;
|
|
25188
|
+
for (let i = currentPos; i < str.length; i++) {
|
|
25189
|
+
if (str[i] === "[") bracketCount++;
|
|
25190
|
+
else if (str[i] === "]") bracketCount--;
|
|
25191
|
+
if (bracketCount === 0) {
|
|
25192
|
+
valueEnd = i + 1;
|
|
25193
|
+
break;
|
|
25194
|
+
}
|
|
25195
|
+
}
|
|
25196
|
+
if (bracketCount !== 0) {
|
|
25197
|
+
console.error("[DEBUG] Unmatched brackets in array value");
|
|
25198
|
+
break;
|
|
25199
|
+
}
|
|
25200
|
+
const arrayStr = str.substring(arrayStart, valueEnd);
|
|
25201
|
+
console.log(`[DEBUG] Found array parameter: ${paramName} = ${arrayStr}`);
|
|
25202
|
+
try {
|
|
25203
|
+
value = JSON.parse(arrayStr);
|
|
25204
|
+
console.log(`[DEBUG] Successfully parsed array ${paramName}:`, value);
|
|
25205
|
+
} catch (e) {
|
|
25206
|
+
console.error(`[DEBUG] Failed to parse array ${paramName}:`, e);
|
|
25207
|
+
console.error(`Array value that failed:`, arrayStr);
|
|
25208
|
+
value = arrayStr;
|
|
25209
|
+
}
|
|
25210
|
+
} else if (str[currentPos] === "{") {
|
|
25211
|
+
let braceCount = 0;
|
|
25212
|
+
let objectStart = currentPos;
|
|
25213
|
+
valueEnd = str.length;
|
|
25214
|
+
for (let i = currentPos; i < str.length; i++) {
|
|
25215
|
+
if (str[i] === "{") braceCount++;
|
|
25216
|
+
else if (str[i] === "}") braceCount--;
|
|
25217
|
+
if (braceCount === 0) {
|
|
25218
|
+
valueEnd = i + 1;
|
|
25219
|
+
break;
|
|
25220
|
+
}
|
|
25221
|
+
}
|
|
25222
|
+
if (braceCount !== 0) {
|
|
25223
|
+
console.error("[DEBUG] Unmatched braces in object value");
|
|
25224
|
+
break;
|
|
25225
|
+
}
|
|
25226
|
+
const objectStr = str.substring(objectStart, valueEnd);
|
|
25227
|
+
console.log(`[DEBUG] Found object parameter: ${paramName} = ${objectStr}`);
|
|
25228
|
+
try {
|
|
25229
|
+
value = JSON.parse(objectStr);
|
|
25230
|
+
console.log(`[DEBUG] Successfully parsed object ${paramName}:`, value);
|
|
25231
|
+
} catch (e) {
|
|
25232
|
+
console.error(`[DEBUG] Failed to parse object ${paramName}:`, e);
|
|
25233
|
+
console.error(`Object value that failed:`, objectStr);
|
|
25234
|
+
value = objectStr;
|
|
25235
|
+
}
|
|
25236
|
+
} else if (str[currentPos] === '"') {
|
|
25237
|
+
let stringStart = currentPos + 1;
|
|
25238
|
+
let stringEnd = stringStart;
|
|
25239
|
+
while (stringEnd < str.length) {
|
|
25240
|
+
if (str[stringEnd] === '"' && str[stringEnd - 1] !== "\\") {
|
|
25241
|
+
break;
|
|
25242
|
+
}
|
|
25243
|
+
stringEnd++;
|
|
25244
|
+
}
|
|
25245
|
+
if (stringEnd >= str.length) {
|
|
25246
|
+
console.error("[DEBUG] Unterminated string value");
|
|
25247
|
+
valueEnd = str.length;
|
|
25248
|
+
break;
|
|
25249
|
+
}
|
|
25250
|
+
value = str.substring(stringStart, stringEnd);
|
|
25251
|
+
valueEnd = stringEnd + 1;
|
|
25252
|
+
console.log(`[DEBUG] Found string parameter: ${paramName} = "${value}"`);
|
|
25253
|
+
} else {
|
|
25254
|
+
let valueStart = currentPos;
|
|
25255
|
+
let valueEndPos = valueStart;
|
|
25256
|
+
while (valueEndPos < str.length && str[valueEndPos] !== ",") {
|
|
25257
|
+
valueEndPos++;
|
|
25258
|
+
}
|
|
25259
|
+
const rawValue = str.substring(valueStart, valueEndPos).trim();
|
|
25260
|
+
valueEnd = valueEndPos;
|
|
25261
|
+
if (rawValue === "true" || rawValue === "True") {
|
|
25262
|
+
value = true;
|
|
25263
|
+
} else if (rawValue === "false" || rawValue === "False") {
|
|
25264
|
+
value = false;
|
|
25265
|
+
} else if (rawValue === "null" || rawValue === "None") {
|
|
25266
|
+
value = null;
|
|
25267
|
+
} else if (!isNaN(Number(rawValue)) && rawValue !== "") {
|
|
25268
|
+
value = Number(rawValue);
|
|
25269
|
+
} else {
|
|
25270
|
+
value = rawValue;
|
|
25271
|
+
}
|
|
25272
|
+
console.log(`[DEBUG] Found unquoted parameter: ${paramName} = ${rawValue} (parsed as ${typeof value})`);
|
|
25273
|
+
}
|
|
25274
|
+
params[paramName] = value;
|
|
25275
|
+
currentPos = valueEnd;
|
|
25163
25276
|
}
|
|
25164
|
-
|
|
25165
|
-
|
|
25166
|
-
|
|
25277
|
+
return params;
|
|
25278
|
+
};
|
|
25279
|
+
const result = extractParameters(argsString);
|
|
25280
|
+
console.log("[DEBUG] Final parsed arguments:", result);
|
|
25281
|
+
return result;
|
|
25167
25282
|
};
|
|
25168
25283
|
const renderChart = (chartType, args, key) => {
|
|
25169
25284
|
console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
|
package/dist/index.mjs
CHANGED
|
@@ -25057,17 +25057,49 @@ var AIAgentView = () => {
|
|
|
25057
25057
|
chartElements.push(chartElement);
|
|
25058
25058
|
} else {
|
|
25059
25059
|
console.warn(`[DEBUG] Chart element was null for type: ${chartType}`);
|
|
25060
|
+
console.warn(`[DEBUG] Args were:`, args);
|
|
25061
|
+
chartElements.push(
|
|
25062
|
+
/* @__PURE__ */ jsxs(
|
|
25063
|
+
"div",
|
|
25064
|
+
{
|
|
25065
|
+
className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
|
|
25066
|
+
children: [
|
|
25067
|
+
/* @__PURE__ */ jsx("strong", { children: "Chart Rendering Error:" }),
|
|
25068
|
+
" Failed to render ",
|
|
25069
|
+
chartType,
|
|
25070
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
25071
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
25072
|
+
"Check console for details. Args: ",
|
|
25073
|
+
JSON.stringify(args, null, 2)
|
|
25074
|
+
] })
|
|
25075
|
+
]
|
|
25076
|
+
},
|
|
25077
|
+
`error-${startIndex}`
|
|
25078
|
+
)
|
|
25079
|
+
);
|
|
25060
25080
|
}
|
|
25061
25081
|
} catch (error) {
|
|
25062
25082
|
console.error(`Failed to parse chart ${chartType}:`, error);
|
|
25083
|
+
console.error(`Args string was:`, argsString);
|
|
25063
25084
|
chartElements.push(
|
|
25064
25085
|
/* @__PURE__ */ jsxs(
|
|
25065
25086
|
"div",
|
|
25066
25087
|
{
|
|
25067
|
-
className: "text-red-500 text-sm",
|
|
25088
|
+
className: "text-red-500 text-sm border border-red-300 bg-red-50 p-3 rounded",
|
|
25068
25089
|
children: [
|
|
25069
|
-
"
|
|
25070
|
-
|
|
25090
|
+
/* @__PURE__ */ jsx("strong", { children: "Chart Parsing Error:" }),
|
|
25091
|
+
" Failed to parse ",
|
|
25092
|
+
chartType,
|
|
25093
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
25094
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
25095
|
+
"Error: ",
|
|
25096
|
+
error instanceof Error ? error.message : String(error)
|
|
25097
|
+
] }),
|
|
25098
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
25099
|
+
/* @__PURE__ */ jsxs("small", { children: [
|
|
25100
|
+
"Original: ",
|
|
25101
|
+
match[0]
|
|
25102
|
+
] })
|
|
25071
25103
|
]
|
|
25072
25104
|
},
|
|
25073
25105
|
`error-${startIndex}`
|
|
@@ -25098,43 +25130,126 @@ var AIAgentView = () => {
|
|
|
25098
25130
|
return chartElements;
|
|
25099
25131
|
};
|
|
25100
25132
|
const parseChartArguments = (argsString) => {
|
|
25101
|
-
const args = {};
|
|
25102
25133
|
console.log("[DEBUG] Parsing chart arguments:", argsString);
|
|
25103
|
-
const
|
|
25104
|
-
|
|
25105
|
-
|
|
25106
|
-
|
|
25107
|
-
|
|
25108
|
-
|
|
25109
|
-
|
|
25110
|
-
|
|
25111
|
-
|
|
25112
|
-
|
|
25113
|
-
|
|
25114
|
-
|
|
25115
|
-
|
|
25116
|
-
|
|
25117
|
-
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25122
|
-
|
|
25123
|
-
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
+
const extractParameters = (str) => {
|
|
25135
|
+
const params = {};
|
|
25136
|
+
let currentPos = 0;
|
|
25137
|
+
while (currentPos < str.length) {
|
|
25138
|
+
while (currentPos < str.length && /\s|,/.test(str[currentPos])) {
|
|
25139
|
+
currentPos++;
|
|
25140
|
+
}
|
|
25141
|
+
if (currentPos >= str.length) break;
|
|
25142
|
+
const paramMatch = str.substring(currentPos).match(/^(\w+)\s*=/);
|
|
25143
|
+
if (!paramMatch) {
|
|
25144
|
+
console.warn("[DEBUG] No parameter name found at position", currentPos);
|
|
25145
|
+
break;
|
|
25146
|
+
}
|
|
25147
|
+
const paramName = paramMatch[1];
|
|
25148
|
+
currentPos += paramMatch[0].length;
|
|
25149
|
+
while (currentPos < str.length && /\s/.test(str[currentPos])) {
|
|
25150
|
+
currentPos++;
|
|
25151
|
+
}
|
|
25152
|
+
if (currentPos >= str.length) break;
|
|
25153
|
+
let value;
|
|
25154
|
+
let valueEnd;
|
|
25155
|
+
if (str[currentPos] === "[") {
|
|
25156
|
+
let bracketCount = 0;
|
|
25157
|
+
let arrayStart = currentPos;
|
|
25158
|
+
valueEnd = str.length;
|
|
25159
|
+
for (let i = currentPos; i < str.length; i++) {
|
|
25160
|
+
if (str[i] === "[") bracketCount++;
|
|
25161
|
+
else if (str[i] === "]") bracketCount--;
|
|
25162
|
+
if (bracketCount === 0) {
|
|
25163
|
+
valueEnd = i + 1;
|
|
25164
|
+
break;
|
|
25165
|
+
}
|
|
25166
|
+
}
|
|
25167
|
+
if (bracketCount !== 0) {
|
|
25168
|
+
console.error("[DEBUG] Unmatched brackets in array value");
|
|
25169
|
+
break;
|
|
25170
|
+
}
|
|
25171
|
+
const arrayStr = str.substring(arrayStart, valueEnd);
|
|
25172
|
+
console.log(`[DEBUG] Found array parameter: ${paramName} = ${arrayStr}`);
|
|
25173
|
+
try {
|
|
25174
|
+
value = JSON.parse(arrayStr);
|
|
25175
|
+
console.log(`[DEBUG] Successfully parsed array ${paramName}:`, value);
|
|
25176
|
+
} catch (e) {
|
|
25177
|
+
console.error(`[DEBUG] Failed to parse array ${paramName}:`, e);
|
|
25178
|
+
console.error(`Array value that failed:`, arrayStr);
|
|
25179
|
+
value = arrayStr;
|
|
25180
|
+
}
|
|
25181
|
+
} else if (str[currentPos] === "{") {
|
|
25182
|
+
let braceCount = 0;
|
|
25183
|
+
let objectStart = currentPos;
|
|
25184
|
+
valueEnd = str.length;
|
|
25185
|
+
for (let i = currentPos; i < str.length; i++) {
|
|
25186
|
+
if (str[i] === "{") braceCount++;
|
|
25187
|
+
else if (str[i] === "}") braceCount--;
|
|
25188
|
+
if (braceCount === 0) {
|
|
25189
|
+
valueEnd = i + 1;
|
|
25190
|
+
break;
|
|
25191
|
+
}
|
|
25192
|
+
}
|
|
25193
|
+
if (braceCount !== 0) {
|
|
25194
|
+
console.error("[DEBUG] Unmatched braces in object value");
|
|
25195
|
+
break;
|
|
25196
|
+
}
|
|
25197
|
+
const objectStr = str.substring(objectStart, valueEnd);
|
|
25198
|
+
console.log(`[DEBUG] Found object parameter: ${paramName} = ${objectStr}`);
|
|
25199
|
+
try {
|
|
25200
|
+
value = JSON.parse(objectStr);
|
|
25201
|
+
console.log(`[DEBUG] Successfully parsed object ${paramName}:`, value);
|
|
25202
|
+
} catch (e) {
|
|
25203
|
+
console.error(`[DEBUG] Failed to parse object ${paramName}:`, e);
|
|
25204
|
+
console.error(`Object value that failed:`, objectStr);
|
|
25205
|
+
value = objectStr;
|
|
25206
|
+
}
|
|
25207
|
+
} else if (str[currentPos] === '"') {
|
|
25208
|
+
let stringStart = currentPos + 1;
|
|
25209
|
+
let stringEnd = stringStart;
|
|
25210
|
+
while (stringEnd < str.length) {
|
|
25211
|
+
if (str[stringEnd] === '"' && str[stringEnd - 1] !== "\\") {
|
|
25212
|
+
break;
|
|
25213
|
+
}
|
|
25214
|
+
stringEnd++;
|
|
25215
|
+
}
|
|
25216
|
+
if (stringEnd >= str.length) {
|
|
25217
|
+
console.error("[DEBUG] Unterminated string value");
|
|
25218
|
+
valueEnd = str.length;
|
|
25219
|
+
break;
|
|
25220
|
+
}
|
|
25221
|
+
value = str.substring(stringStart, stringEnd);
|
|
25222
|
+
valueEnd = stringEnd + 1;
|
|
25223
|
+
console.log(`[DEBUG] Found string parameter: ${paramName} = "${value}"`);
|
|
25224
|
+
} else {
|
|
25225
|
+
let valueStart = currentPos;
|
|
25226
|
+
let valueEndPos = valueStart;
|
|
25227
|
+
while (valueEndPos < str.length && str[valueEndPos] !== ",") {
|
|
25228
|
+
valueEndPos++;
|
|
25229
|
+
}
|
|
25230
|
+
const rawValue = str.substring(valueStart, valueEndPos).trim();
|
|
25231
|
+
valueEnd = valueEndPos;
|
|
25232
|
+
if (rawValue === "true" || rawValue === "True") {
|
|
25233
|
+
value = true;
|
|
25234
|
+
} else if (rawValue === "false" || rawValue === "False") {
|
|
25235
|
+
value = false;
|
|
25236
|
+
} else if (rawValue === "null" || rawValue === "None") {
|
|
25237
|
+
value = null;
|
|
25238
|
+
} else if (!isNaN(Number(rawValue)) && rawValue !== "") {
|
|
25239
|
+
value = Number(rawValue);
|
|
25240
|
+
} else {
|
|
25241
|
+
value = rawValue;
|
|
25242
|
+
}
|
|
25243
|
+
console.log(`[DEBUG] Found unquoted parameter: ${paramName} = ${rawValue} (parsed as ${typeof value})`);
|
|
25244
|
+
}
|
|
25245
|
+
params[paramName] = value;
|
|
25246
|
+
currentPos = valueEnd;
|
|
25134
25247
|
}
|
|
25135
|
-
|
|
25136
|
-
|
|
25137
|
-
|
|
25248
|
+
return params;
|
|
25249
|
+
};
|
|
25250
|
+
const result = extractParameters(argsString);
|
|
25251
|
+
console.log("[DEBUG] Final parsed arguments:", result);
|
|
25252
|
+
return result;
|
|
25138
25253
|
};
|
|
25139
25254
|
const renderChart = (chartType, args, key) => {
|
|
25140
25255
|
console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
|