| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683 | 1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
1×
86×
86×
86×
1×
86×
86×
1×
4×
3×
3×
1×
8×
8×
30×
5×
10×
8×
1×
8×
8×
8×
2×
6×
6×
6×
6×
6×
6×
6×
1×
16×
16×
16×
30×
16×
16×
16×
16×
2×
14×
2×
2×
2×
1×
1×
13×
3×
1×
1×
3×
3×
2×
1×
3×
3×
2×
2×
3×
1×
1×
1×
22×
1×
21×
1×
10×
1×
53×
36×
17×
17×
1×
16×
16×
16×
2×
1×
11×
11×
11×
11×
11×
11×
2×
4×
4×
2×
4×
1×
4×
4×
4×
1×
4×
1×
4×
1×
4×
1×
4×
1×
4×
1×
4×
4×
1×
4×
1×
4×
3×
4×
1×
1×
4×
4×
4×
4×
4×
4×
1×
1×
3×
3×
4×
4×
4×
4×
1×
30×
1×
10×
10×
10×
2×
8×
8×
8×
8×
7×
8×
6×
2×
2×
1×
8×
8×
1×
7×
7×
7×
7×
1×
6×
5×
6×
1×
6×
1×
6×
1×
6×
1×
6×
1×
6×
4×
2×
2×
1×
6×
6×
1×
5×
5×
5×
1×
4×
2×
2×
2×
1×
5×
25×
5×
1×
4×
4×
2×
2×
2×
1×
5×
5×
5×
5×
3×
2×
2×
1×
15×
15×
15×
16×
16×
16×
16×
1×
1×
| var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
/* istanbul ignore next */
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
/* istanbul ignore next */
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
define(["require", "exports", "@syncfusion/ej2-base", "../base/constant", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, constant_1, ej2_popups_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MUTATING_WEB_MCP_COMMANDS = ['createEvent', 'updateEvent', 'deleteEvent'];
var webMcpTools = [
{
name: 'createEvent',
annotations: { readOnlyHint: false },
description: 'Creates a new Scheduler event.',
inputSchema: {
type: 'object',
properties: {
eventObj: {
type: 'object',
description: 'Scheduler event object.',
properties: {
Subject: {
type: 'string',
description: 'Title of the event'
},
StartTime: {
type: 'string',
description: 'Event start date and time in ISO 8601 format. ' +
'Example: 2026-04-08T09:00:00'
},
EndTime: {
type: 'string',
description: 'Event end date and time in ISO 8601 format. ' +
'Example: 2026-04-08T10:00:00'
},
IsAllDay: {
type: 'boolean',
description: 'Whether the event spans the entire day'
},
Location: {
type: 'string',
description: 'Location of the event'
},
Description: {
type: 'string',
description: 'Detailed description of the event'
}
},
required: ['Subject', 'StartTime', 'EndTime']
}
},
required: ['eventObj']
},
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
}
},
{
name: 'updateEvent',
annotations: { readOnlyHint: false },
description: 'Updates an existing Scheduler event. The event is identified using ' +
'Subject and can be further narrowed down using StartTime and EndTime. ',
inputSchema: {
type: 'object',
properties: {
eventObj: {
type: 'object',
description: 'Scheduler event identification details and updated values.',
properties: {
Subject: {
type: 'string',
description: 'Existing title of the event used to identify it'
},
StartTime: {
type: 'string',
description: 'Existing event start date and time in ISO 8601 format. ' +
'Example: 2026-04-08T09:00:00'
},
EndTime: {
type: 'string',
description: 'Existing event end date and time in ISO 8601 format. ' +
'Example: 2026-04-08T10:00:00'
},
NewSubject: {
type: 'string',
description: 'Updated title of the event'
},
NewStartTime: {
type: 'string',
description: 'Updated event start date and time in ISO 8601 format. ' +
'Example: 2026-04-08T11:00:00'
},
NewEndTime: {
type: 'string',
description: 'Updated event end date and time in ISO 8601 format. ' +
'Example: 2026-04-08T12:00:00'
},
IsAllDay: {
type: 'boolean',
description: 'Updated value indicating whether the event spans the entire day'
},
Location: {
type: 'string',
description: 'Updated location of the event'
},
Description: {
type: 'string',
description: 'Updated description of the event'
}
},
required: ['Subject']
}
},
required: ['eventObj']
},
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
}
},
{
name: 'deleteEvent',
annotations: { readOnlyHint: false },
description: 'Deletes an existing Scheduler event. The event can be identified ' +
'using Subject alone, or along with StartTime or EndTime.',
inputSchema: {
type: 'object',
properties: {
eventObj: {
type: 'object',
description: 'Scheduler event identification details used to locate ' +
'the event to be deleted.',
properties: {
Subject: {
type: 'string',
description: 'Title of the event to delete'
},
StartTime: {
type: 'string',
description: 'Event start date and time in ISO 8601 format. ' +
'Example: 2026-04-08T09:00:00'
},
EndTime: {
type: 'string',
description: 'Event end date and time in ISO 8601 format. ' +
'Example: 2026-04-08T10:00:00'
}
},
required: ['Subject']
}
},
required: ['eventObj']
},
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
}
},
{
name: 'changeView',
annotations: { readOnlyHint: false },
description: 'Changes the current Scheduler view.',
inputSchema: {
type: 'object',
properties: {
view: {
type: 'string',
enum: [
'Day',
'Week',
'WorkWeek',
'Month',
'Agenda',
'MonthAgenda',
'TimelineDay',
'TimelineWeek',
'TimelineWorkWeek',
'TimelineMonth',
'Year',
'TimelineYear'
],
description: 'Scheduler view to switch to'
}
},
required: ['view']
},
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
}
},
{
name: 'navigateDate',
annotations: { readOnlyHint: false },
description: 'Navigates the Scheduler to a specific date.',
inputSchema: {
type: 'object',
properties: {
selectedDate: {
type: 'string',
description: 'Date to navigate to in ISO 8601 format. ' +
'Examples: 2026-04-08 or 2026-04-08T09:00:00'
}
},
required: ['selectedDate']
},
outputSchema: {
type: 'object',
properties: {
success: { type: 'boolean' },
data: { type: 'object' },
message: { type: 'string' }
},
required: ['success', 'data', 'message']
}
}
];
var WebMcpAdapter = (function () {
function WebMcpAdapter(parent) {
this.webMcpAbortController = null;
this.parent = parent;
this.addEventListener();
}
WebMcpAdapter.prototype.addEventListener = function () {
this.parent.on(constant_1.getWebMcpTools, this.getTools, this);
this.parent.on(constant_1.registerWebMcpTools, this.registerTools, this);
};
WebMcpAdapter.prototype.removeEventListener = function () {
if (!this.parent.isDestroyed) {
this.parent.off(constant_1.getWebMcpTools, this.getTools);
this.parent.off(constant_1.registerWebMcpTools, this.registerTools);
}
};
WebMcpAdapter.prototype.getTools = function (args) {
var toolNames = args.toolNames || [];
if (toolNames.length !== 0) {
args.tools = webMcpTools.filter(function (webMcpTool) { return toolNames.indexOf(webMcpTool.name) !== -1; })
.map(function (webMcpTool) { return (__assign({}, webMcpTool)); });
}
else {
args.tools = webMcpTools.map(function (webMcpTool) { return (__assign({}, webMcpTool)); });
}
return args.tools;
};
WebMcpAdapter.prototype.registerTools = function (args) {
var _this = this;
var modelContext = document.modelContext;
if (!modelContext || typeof modelContext.registerTool !== 'function') {
return;
}
this.webMcpAbortController = new AbortController();
var toolPrefix = args.prefix == null ? this.parent.element.id : args.prefix;
var tools = args.tools && args.tools.length && typeof args.tools[0] === 'object'
? args.tools
: this.getTools({ toolNames: args.tools });
tools.forEach(function (tool) {
tool.name = toolPrefix + "_" + tool.name;
tool.execute = tool.execute || (function (toolArgs) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
return [2, this.executeHandler(tool.name, toolArgs)];
}); }); });
modelContext.registerTool(tool, { signal: _this.webMcpAbortController.signal, exposedTo: args.exposedTo });
});
};
WebMcpAdapter.prototype.executeHandler = function (command, args) {
return __awaiter(this, void 0, void 0, function () {
var baseCommand, eventArgs, confirmed;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
baseCommand = command.includes('_') ? command.substring(command.indexOf('_') + 1) : command;
eventArgs = { toolName: command, toolArgs: args };
this.parent.trigger('beforeWebMcpToolExecute', eventArgs);
if (eventArgs.cancel) {
return [2, this.message({
action: command,
cancelled: true,
message: eventArgs.cancellationResponse || "[USER_CANCELLED] Tool \"" + command + "\" was cancelled. This is final. Do NOT retry."
})];
}
if (!(eventArgs.showConfirmationDialog && this.isMutatingCommand(baseCommand))) return [3, 2];
return [4, this.requestConfirmation(this.buildConfirmationMessage(baseCommand, args))];
case 1:
confirmed = _a.sent();
if (!confirmed) {
return [2, this.message({
action: command,
cancelled: true,
message: 'Tool execution cancelled by user'
})];
}
_a.label = 2;
case 2:
switch (baseCommand) {
case 'createEvent':
return [2, this.handleCreateEvent(args)];
case 'updateEvent':
return [2, this.handleUpdateEvent(args)];
case 'deleteEvent':
return [2, this.handleDeleteEvent(args)];
case 'changeView':
return [2, this.handleChangeView(args)];
case 'navigateDate':
return [2, this.handleNavigateDate(args)];
default:
return [2, this.error("Tool \"" + baseCommand + "\" not found.")];
}
return [2];
}
});
});
};
WebMcpAdapter.prototype.destroy = function () {
this.removeEventListener();
if (this.webMcpAbortController) {
this.webMcpAbortController.abort();
this.webMcpAbortController = null;
}
this.parent = null;
};
WebMcpAdapter.prototype.getModuleName = function () {
return 'webMcpAdapter';
};
WebMcpAdapter.prototype.message = function (data) {
return { content: [{ type: 'text', text: JSON.stringify(data) }] };
};
WebMcpAdapter.prototype.error = function (text) {
return { content: [{ type: 'text', text: text }], isError: true };
};
WebMcpAdapter.prototype.isMutatingCommand = function (command) {
return MUTATING_WEB_MCP_COMMANDS.indexOf(command) !== -1;
};
WebMcpAdapter.prototype.formatConfirmationDate = function (value) {
if (value === undefined || value === null || value === '') {
return '';
}
var date = value instanceof Date ? value : new Date(value);
if (isNaN(date.getTime())) {
return String(value);
}
var locale = this.parent.locale || undefined;
try {
return new Intl.DateTimeFormat(locale, {
year: 'numeric',
month: 'short',
day: 'numeric',
hour: 'numeric',
minute: '2-digit'
}).format(date);
}
catch (e) {
return date.toLocaleString(locale) || date.toString();
}
};
WebMcpAdapter.prototype.buildConfirmationMessage = function (command, args) {
var eventObj = args.eventObj;
var start = this.formatConfirmationDate(eventObj.StartTime);
var end = this.formatConfirmationDate(eventObj.EndTime);
var newStart = this.formatConfirmationDate(eventObj.NewStartTime);
var newEnd = this.formatConfirmationDate(eventObj.NewEndTime);
switch (command) {
case 'createEvent':
return "Create event \"" + eventObj.Subject + "\" from " + start + " to " + end + "?";
case 'deleteEvent': {
var message = "Delete event \"" + eventObj.Subject + "\"";
if (start) {
message += " starting at " + start;
}
if (end) {
message += " ending at " + end;
}
return message + "?";
}
case 'updateEvent': {
var changes = [];
if (eventObj.NewSubject) {
changes.push("Title \u2192 \"" + eventObj.NewSubject + "\"");
}
if (newStart) {
changes.push("Start Time \u2192 " + newStart);
}
if (newEnd) {
changes.push("End Time \u2192 " + newEnd);
}
if (eventObj.Location) {
changes.push("Location \u2192 " + eventObj.Location);
}
if (eventObj.Description) {
changes.push('Description updated');
}
if (eventObj.IsAllDay !== undefined) {
changes.push("All Day \u2192 " + eventObj.IsAllDay);
}
var message = "Update event \"" + eventObj.Subject + "\"";
if (start) {
message += " starting at " + start;
}
if (end) {
message += " ending at " + end;
}
if (changes.length > 0) {
message += "<br><br>Changes:<br>" + changes.join('<br>');
}
return message;
}
default:
return "Confirm " + command + "?";
}
};
WebMcpAdapter.prototype.requestConfirmation = function (message) {
var _this = this;
var dialogElement = ej2_base_1.createElement('div');
document.body.appendChild(dialogElement);
var confirmed = false;
return new Promise(function (resolve) {
var dialog = new ej2_popups_1.Dialog({
header: 'Confirm action',
content: message,
isModal: true,
showCloseIcon: true,
closeOnEscape: true,
animationSettings: { effect: 'Zoom' },
enableRtl: _this.parent.enableRtl,
enableHtmlSanitizer: _this.parent.enableHtmlSanitizer,
width: '500px',
cssClass: ("e-webmcp-confirm-dialog " + (_this.parent.cssClass || '')).trim(),
buttons: [
{
click: function () {
confirmed = true;
dialog.hide();
},
buttonModel: {
content: 'OK',
isPrimary: true,
cssClass: ('e-primary e-event-save ' + (_this.parent.cssClass || '')).trim()
}
},
{
click: function () {
confirmed = false;
dialog.hide();
},
buttonModel: {
content: 'Cancel',
cssClass: ('e-event-cancel ' + (_this.parent.cssClass || '')).trim()
}
}
],
close: function () {
Eif (dialog.element && dialog.element.parentElement) {
dialog.element.parentElement.removeChild(dialog.element);
}
resolve(confirmed);
}
});
dialog.appendTo(dialogElement);
});
};
Object.defineProperty(WebMcpAdapter.prototype, "fields", {
get: function () {
return this.parent.eventFields;
},
enumerable: true,
configurable: true
});
WebMcpAdapter.prototype.handleCreateEvent = function (args) {
var _a;
try {
if (!this.parent.eventSettings.allowAdding || this.parent.activeViewOptions.readonly) {
return this.error('Adding events is disabled in this Schedule.');
}
var eventObj = args.eventObj;
var fields = this.fields;
var scheduleEvent = (_a = {},
_a[fields.subject] = eventObj.Subject,
_a[fields.startTime] = new Date(eventObj.StartTime),
_a[fields.endTime] = new Date(eventObj.EndTime),
_a[fields.isAllDay] = eventObj.IsAllDay,
_a[fields.location] = eventObj.Location,
_a[fields.description] = eventObj.Description,
_a[fields.id] = eventObj[fields.id],
_a);
if (ej2_base_1.isNullOrUndefined(scheduleEvent[fields.id])) {
scheduleEvent[fields.id] = this.parent.eventBase.getEventMaxID();
}
this.parent.addEvent(scheduleEvent);
return this.message({
action: 'createEvent',
success: true,
data: {},
message: 'Event created successfully'
});
}
catch (error) {
var errorMessage = error instanceof Error ? error.message : String(error);
return this.error("Failed to create event: " + errorMessage);
}
};
WebMcpAdapter.prototype.handleUpdateEvent = function (args) {
try {
if (!this.parent.eventSettings.allowEditing || this.parent.activeViewOptions.readonly) {
return this.error('Editing events is disabled in this Schedule.');
}
var eventInfo = args.eventObj;
var matchedEvent = this.getMatchedEvent(eventInfo);
var fields = this.fields;
if (!matchedEvent) {
return this.error('No matching event found.');
}
if (eventInfo.NewSubject) {
matchedEvent[fields.subject] = eventInfo.NewSubject;
}
if (eventInfo.NewStartTime) {
matchedEvent[fields.startTime] = new Date(eventInfo.NewStartTime);
}
if (eventInfo.NewEndTime) {
matchedEvent[fields.endTime] = new Date(eventInfo.NewEndTime);
}
if (eventInfo.IsAllDay !== undefined) {
matchedEvent[fields.isAllDay] = eventInfo.IsAllDay;
}
if (eventInfo.Location !== undefined) {
matchedEvent[fields.location] = eventInfo.Location;
}
if (eventInfo.Description !== undefined) {
matchedEvent[fields.description] = eventInfo.Description;
}
this.parent.saveEvent(matchedEvent);
return this.message({
action: 'updateEvent',
success: true,
data: {},
message: 'Event updated successfully'
});
}
catch (error) {
var errorMessage = error instanceof Error ? error.message : String(error);
return this.error("Failed to update event: " + errorMessage);
}
};
WebMcpAdapter.prototype.handleDeleteEvent = function (args) {
try {
if (!this.parent.eventSettings.allowDeleting || this.parent.activeViewOptions.readonly) {
return this.error('Deleting events is disabled in this Schedule.');
}
var eventInfo = args.eventObj;
var matchedEvent = this.getMatchedEvent(eventInfo);
if (!matchedEvent) {
return this.error('No matching event found.');
}
this.parent.deleteEvent(matchedEvent);
return this.message({
action: 'deleteEvent',
success: true,
data: {},
message: 'Event deleted successfully'
});
}
catch (error) {
var errorMessage = error instanceof Error ? error.message : String(error);
return this.error("Failed to delete event: " + errorMessage);
}
};
WebMcpAdapter.prototype.handleChangeView = function (args) {
try {
var availableViews = this.parent.viewCollections.map(function (view) { return view.option; });
if (availableViews.indexOf(args.view) === -1) {
return this.error("View \"" + args.view + "\" is not available. Available views: " + availableViews.join(', '));
}
this.parent.currentView = args.view;
this.parent.dataBind();
return this.message({
action: 'changeView',
success: true,
data: {},
message: 'View changed successfully'
});
}
catch (error) {
var errorMessage = error instanceof Error ? error.message : String(error);
return this.error("Failed to change view: " + errorMessage);
}
};
WebMcpAdapter.prototype.handleNavigateDate = function (args) {
try {
var date = typeof args.selectedDate === 'string' ? new Date(args.selectedDate) : (args.selectedDate || new Date());
this.parent.selectedDate = date;
this.parent.dataBind();
return this.message({
action: 'navigateDate',
success: true,
data: {},
message: 'Date navigation successful'
});
}
catch (error) {
var errorMessage = error instanceof Error ? error.message : String(error);
return this.error("Failed to navigate date: " + errorMessage);
}
};
WebMcpAdapter.prototype.getMatchedEvent = function (eventInfo) {
var events = this.parent.getEvents();
var fields = this.fields;
return events.find(function (event) {
var subjectMatch = event[fields.subject] === eventInfo.Subject;
var startMatch = !eventInfo.StartTime ||
new Date(event[fields.startTime]).getTime() ===
new Date(eventInfo.StartTime).getTime();
var endMatch = !eventInfo.EndTime ||
new Date(event[fields.endTime]).getTime() ===
new Date(eventInfo.EndTime).getTime();
return subjectMatch && startMatch && endMatch;
});
};
return WebMcpAdapter;
}());
exports.WebMcpAdapter = WebMcpAdapter;
});
|