@automattic/agenttic-client 0.1.13 → 0.1.15
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/README.md +78 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/types/index.d.ts +55 -0
- package/dist/client/types/index.d.ts.map +1 -1
- package/dist/index.d.ts +5 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1189 -1591
- package/dist/message-actions/index.d.ts +0 -2
- package/dist/message-actions/index.d.ts.map +1 -1
- package/dist/message-actions/useMessageActions.d.ts.map +1 -1
- package/dist/mocks/MockSalesGraph.d.ts.map +1 -1
- package/dist/mocks.js +672 -50
- package/dist/react/agentManager.d.ts +1 -0
- package/dist/react/agentManager.d.ts.map +1 -1
- package/dist/react/useAgentChat.d.ts +0 -18
- package/dist/react/useAgentChat.d.ts.map +1 -1
- package/dist/react/useClientTools.d.ts +65 -3
- package/dist/react/useClientTools.d.ts.map +1 -1
- package/dist/utils/wordpressAbilities.d.ts +37 -0
- package/dist/utils/wordpressAbilities.d.ts.map +1 -0
- package/package.json +6 -11
- package/dist/BarChart-Cid6YH81.js +0 -801
- package/dist/BarChart.css +0 -1
- package/dist/markdown-extensions/charts/BarChart.d.ts +0 -16
- package/dist/markdown-extensions/charts/BarChart.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/BaseChart.d.ts +0 -36
- package/dist/markdown-extensions/charts/BaseChart.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/ChartBlock.d.ts +0 -34
- package/dist/markdown-extensions/charts/ChartBlock.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/ChartError.d.ts +0 -17
- package/dist/markdown-extensions/charts/ChartError.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/ChartErrorBoundary.d.ts +0 -30
- package/dist/markdown-extensions/charts/ChartErrorBoundary.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/LineChart.d.ts +0 -14
- package/dist/markdown-extensions/charts/LineChart.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/index.d.ts +0 -294
- package/dist/markdown-extensions/charts/index.d.ts.map +0 -1
- package/dist/markdown-extensions/charts/utils/chartUtils.d.ts +0 -56
- package/dist/markdown-extensions/charts/utils/chartUtils.d.ts.map +0 -1
- package/dist/markdown-extensions/index.d.ts +0 -34
- package/dist/markdown-extensions/index.d.ts.map +0 -1
- package/dist/markdown-extensions/types.d.ts +0 -52
- package/dist/markdown-extensions/types.d.ts.map +0 -1
- package/dist/message-actions/factories.d.ts +0 -16
- package/dist/message-actions/factories.d.ts.map +0 -1
- package/dist/utils/createMessageRenderer.d.ts +0 -25
- package/dist/utils/createMessageRenderer.d.ts.map +0 -1
- package/dist/utils/markdownParser.d.ts +0 -25
- package/dist/utils/markdownParser.d.ts.map +0 -1
package/dist/mocks.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import "@wordpress/i18n";
|
|
4
|
-
import "@automattic/charts";
|
|
5
|
-
const b = () => ({
|
|
1
|
+
import Te from "react";
|
|
2
|
+
const gr = () => ({
|
|
6
3
|
selectedBlockClientId: "qwu2",
|
|
7
4
|
currentPageContent: [
|
|
8
5
|
{
|
|
@@ -198,7 +195,7 @@ const b = () => ({
|
|
|
198
195
|
]
|
|
199
196
|
}
|
|
200
197
|
]
|
|
201
|
-
}),
|
|
198
|
+
}), mr = (_) => ({
|
|
202
199
|
getAvailableTools: async () => [
|
|
203
200
|
{
|
|
204
201
|
id: "display_graph",
|
|
@@ -238,30 +235,30 @@ const b = () => ({
|
|
|
238
235
|
}
|
|
239
236
|
}
|
|
240
237
|
],
|
|
241
|
-
executeTool: async (
|
|
242
|
-
switch (console.log(`Executing tool: ${
|
|
243
|
-
args:
|
|
244
|
-
messageId:
|
|
245
|
-
toolCallId:
|
|
246
|
-
}),
|
|
238
|
+
executeTool: async (g, m, h, R) => {
|
|
239
|
+
switch (console.log(`Executing tool: ${g}`, {
|
|
240
|
+
args: m,
|
|
241
|
+
messageId: h,
|
|
242
|
+
toolCallId: R
|
|
243
|
+
}), g) {
|
|
247
244
|
case "display_graph":
|
|
248
|
-
if (!
|
|
245
|
+
if (!m.title || !m.data)
|
|
249
246
|
return {
|
|
250
247
|
result: "Error: Title and data are required for graph display",
|
|
251
248
|
returnToAgent: !0
|
|
252
249
|
};
|
|
253
|
-
const { MockSalesGraph:
|
|
254
|
-
return
|
|
250
|
+
const { MockSalesGraph: c } = await Promise.resolve().then(() => pr);
|
|
251
|
+
return _({
|
|
255
252
|
id: crypto.randomUUID(),
|
|
256
253
|
role: "agent",
|
|
257
254
|
content: [
|
|
258
255
|
{
|
|
259
256
|
type: "component",
|
|
260
|
-
component:
|
|
257
|
+
component: c,
|
|
261
258
|
componentProps: {
|
|
262
|
-
title:
|
|
263
|
-
data:
|
|
264
|
-
timeframe:
|
|
259
|
+
title: m.title,
|
|
260
|
+
data: m.data,
|
|
261
|
+
timeframe: m.timeframe
|
|
265
262
|
}
|
|
266
263
|
}
|
|
267
264
|
],
|
|
@@ -269,43 +266,668 @@ const b = () => ({
|
|
|
269
266
|
archived: !1,
|
|
270
267
|
showIcon: !0
|
|
271
268
|
}), {
|
|
272
|
-
result: `Graph displayed: ${
|
|
269
|
+
result: `Graph displayed: ${m.title} with ${m.data.length} data points`,
|
|
273
270
|
returnToAgent: !1
|
|
274
271
|
};
|
|
275
272
|
}
|
|
276
273
|
}
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
274
|
+
});
|
|
275
|
+
var H = { exports: {} }, F = {};
|
|
276
|
+
/**
|
|
277
|
+
* @license React
|
|
278
|
+
* react-jsx-runtime.production.min.js
|
|
279
|
+
*
|
|
280
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
281
|
+
*
|
|
282
|
+
* This source code is licensed under the MIT license found in the
|
|
283
|
+
* LICENSE file in the root directory of this source tree.
|
|
284
|
+
*/
|
|
285
|
+
var ke;
|
|
286
|
+
function cr() {
|
|
287
|
+
if (ke) return F;
|
|
288
|
+
ke = 1;
|
|
289
|
+
var _ = Te, g = Symbol.for("react.element"), m = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, R = _.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, c = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
290
|
+
function k(C, f, P) {
|
|
291
|
+
var b, E = {}, T = null, V = null;
|
|
292
|
+
P !== void 0 && (T = "" + P), f.key !== void 0 && (T = "" + f.key), f.ref !== void 0 && (V = f.ref);
|
|
293
|
+
for (b in f) h.call(f, b) && !c.hasOwnProperty(b) && (E[b] = f[b]);
|
|
294
|
+
if (C && C.defaultProps) for (b in f = C.defaultProps, f) E[b] === void 0 && (E[b] = f[b]);
|
|
295
|
+
return { $$typeof: g, type: C, key: T, ref: V, props: E, _owner: R.current };
|
|
296
|
+
}
|
|
297
|
+
return F.Fragment = m, F.jsx = k, F.jsxs = k, F;
|
|
298
|
+
}
|
|
299
|
+
var $ = {};
|
|
300
|
+
/**
|
|
301
|
+
* @license React
|
|
302
|
+
* react-jsx-runtime.development.js
|
|
303
|
+
*
|
|
304
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
305
|
+
*
|
|
306
|
+
* This source code is licensed under the MIT license found in the
|
|
307
|
+
* LICENSE file in the root directory of this source tree.
|
|
308
|
+
*/
|
|
309
|
+
var Ce;
|
|
310
|
+
function fr() {
|
|
311
|
+
return Ce || (Ce = 1, process.env.NODE_ENV !== "production" && function() {
|
|
312
|
+
var _ = Te, g = Symbol.for("react.element"), m = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), c = Symbol.for("react.profiler"), k = Symbol.for("react.provider"), C = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), V = Symbol.for("react.offscreen"), Q = Symbol.iterator, Se = "@@iterator";
|
|
313
|
+
function Oe(e) {
|
|
314
|
+
if (e === null || typeof e != "object")
|
|
315
|
+
return null;
|
|
316
|
+
var r = Q && e[Q] || e[Se];
|
|
317
|
+
return typeof r == "function" ? r : null;
|
|
318
|
+
}
|
|
319
|
+
var j = _.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
320
|
+
function d(e) {
|
|
321
|
+
{
|
|
322
|
+
for (var r = arguments.length, t = new Array(r > 1 ? r - 1 : 0), n = 1; n < r; n++)
|
|
323
|
+
t[n - 1] = arguments[n];
|
|
324
|
+
Pe("error", e, t);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function Pe(e, r, t) {
|
|
328
|
+
{
|
|
329
|
+
var n = j.ReactDebugCurrentFrame, o = n.getStackAddendum();
|
|
330
|
+
o !== "" && (r += "%s", t = t.concat([o]));
|
|
331
|
+
var s = t.map(function(i) {
|
|
332
|
+
return String(i);
|
|
333
|
+
});
|
|
334
|
+
s.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, s);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
var je = !1, xe = !1, Ie = !1, De = !1, Ae = !1, Z;
|
|
338
|
+
Z = Symbol.for("react.module.reference");
|
|
339
|
+
function Fe(e) {
|
|
340
|
+
return !!(typeof e == "string" || typeof e == "function" || e === h || e === c || Ae || e === R || e === P || e === b || De || e === V || je || xe || Ie || typeof e == "object" && e !== null && (e.$$typeof === T || e.$$typeof === E || e.$$typeof === k || e.$$typeof === C || e.$$typeof === f || // This needs to include all possible module reference object
|
|
341
|
+
// types supported by any Flight configuration anywhere since
|
|
342
|
+
// we don't know which Flight build this will end up being used
|
|
343
|
+
// with.
|
|
344
|
+
e.$$typeof === Z || e.getModuleId !== void 0));
|
|
345
|
+
}
|
|
346
|
+
function $e(e, r, t) {
|
|
347
|
+
var n = e.displayName;
|
|
348
|
+
if (n)
|
|
349
|
+
return n;
|
|
350
|
+
var o = r.displayName || r.name || "";
|
|
351
|
+
return o !== "" ? t + "(" + o + ")" : t;
|
|
352
|
+
}
|
|
353
|
+
function ee(e) {
|
|
354
|
+
return e.displayName || "Context";
|
|
355
|
+
}
|
|
356
|
+
function w(e) {
|
|
357
|
+
if (e == null)
|
|
358
|
+
return null;
|
|
359
|
+
if (typeof e.tag == "number" && d("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
360
|
+
return e.displayName || e.name || null;
|
|
361
|
+
if (typeof e == "string")
|
|
362
|
+
return e;
|
|
363
|
+
switch (e) {
|
|
364
|
+
case h:
|
|
365
|
+
return "Fragment";
|
|
366
|
+
case m:
|
|
367
|
+
return "Portal";
|
|
368
|
+
case c:
|
|
369
|
+
return "Profiler";
|
|
370
|
+
case R:
|
|
371
|
+
return "StrictMode";
|
|
372
|
+
case P:
|
|
373
|
+
return "Suspense";
|
|
374
|
+
case b:
|
|
375
|
+
return "SuspenseList";
|
|
376
|
+
}
|
|
377
|
+
if (typeof e == "object")
|
|
378
|
+
switch (e.$$typeof) {
|
|
379
|
+
case C:
|
|
380
|
+
var r = e;
|
|
381
|
+
return ee(r) + ".Consumer";
|
|
382
|
+
case k:
|
|
383
|
+
var t = e;
|
|
384
|
+
return ee(t._context) + ".Provider";
|
|
385
|
+
case f:
|
|
386
|
+
return $e(e, e.render, "ForwardRef");
|
|
387
|
+
case E:
|
|
388
|
+
var n = e.displayName || null;
|
|
389
|
+
return n !== null ? n : w(e.type) || "Memo";
|
|
390
|
+
case T: {
|
|
391
|
+
var o = e, s = o._payload, i = o._init;
|
|
392
|
+
try {
|
|
393
|
+
return w(i(s));
|
|
394
|
+
} catch {
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return null;
|
|
400
|
+
}
|
|
401
|
+
var S = Object.assign, D = 0, re, te, ne, ae, ie, oe, se;
|
|
402
|
+
function le() {
|
|
403
|
+
}
|
|
404
|
+
le.__reactDisabledLog = !0;
|
|
405
|
+
function Be() {
|
|
406
|
+
{
|
|
407
|
+
if (D === 0) {
|
|
408
|
+
re = console.log, te = console.info, ne = console.warn, ae = console.error, ie = console.group, oe = console.groupCollapsed, se = console.groupEnd;
|
|
409
|
+
var e = {
|
|
410
|
+
configurable: !0,
|
|
411
|
+
enumerable: !0,
|
|
412
|
+
value: le,
|
|
413
|
+
writable: !0
|
|
414
|
+
};
|
|
415
|
+
Object.defineProperties(console, {
|
|
416
|
+
info: e,
|
|
417
|
+
log: e,
|
|
418
|
+
warn: e,
|
|
419
|
+
error: e,
|
|
420
|
+
group: e,
|
|
421
|
+
groupCollapsed: e,
|
|
422
|
+
groupEnd: e
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
D++;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
function Ve() {
|
|
429
|
+
{
|
|
430
|
+
if (D--, D === 0) {
|
|
431
|
+
var e = {
|
|
432
|
+
configurable: !0,
|
|
433
|
+
enumerable: !0,
|
|
434
|
+
writable: !0
|
|
435
|
+
};
|
|
436
|
+
Object.defineProperties(console, {
|
|
437
|
+
log: S({}, e, {
|
|
438
|
+
value: re
|
|
439
|
+
}),
|
|
440
|
+
info: S({}, e, {
|
|
441
|
+
value: te
|
|
442
|
+
}),
|
|
443
|
+
warn: S({}, e, {
|
|
444
|
+
value: ne
|
|
445
|
+
}),
|
|
446
|
+
error: S({}, e, {
|
|
447
|
+
value: ae
|
|
448
|
+
}),
|
|
449
|
+
group: S({}, e, {
|
|
450
|
+
value: ie
|
|
451
|
+
}),
|
|
452
|
+
groupCollapsed: S({}, e, {
|
|
453
|
+
value: oe
|
|
454
|
+
}),
|
|
455
|
+
groupEnd: S({}, e, {
|
|
456
|
+
value: se
|
|
457
|
+
})
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
D < 0 && d("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
var N = j.ReactCurrentDispatcher, U;
|
|
464
|
+
function M(e, r, t) {
|
|
465
|
+
{
|
|
466
|
+
if (U === void 0)
|
|
467
|
+
try {
|
|
468
|
+
throw Error();
|
|
469
|
+
} catch (o) {
|
|
470
|
+
var n = o.stack.trim().match(/\n( *(at )?)/);
|
|
471
|
+
U = n && n[1] || "";
|
|
472
|
+
}
|
|
473
|
+
return `
|
|
474
|
+
` + U + e;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
var q = !1, W;
|
|
295
478
|
{
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
479
|
+
var Me = typeof WeakMap == "function" ? WeakMap : Map;
|
|
480
|
+
W = new Me();
|
|
481
|
+
}
|
|
482
|
+
function ue(e, r) {
|
|
483
|
+
if (!e || q)
|
|
484
|
+
return "";
|
|
485
|
+
{
|
|
486
|
+
var t = W.get(e);
|
|
487
|
+
if (t !== void 0)
|
|
488
|
+
return t;
|
|
489
|
+
}
|
|
490
|
+
var n;
|
|
491
|
+
q = !0;
|
|
492
|
+
var o = Error.prepareStackTrace;
|
|
493
|
+
Error.prepareStackTrace = void 0;
|
|
494
|
+
var s;
|
|
495
|
+
s = N.current, N.current = null, Be();
|
|
496
|
+
try {
|
|
497
|
+
if (r) {
|
|
498
|
+
var i = function() {
|
|
499
|
+
throw Error();
|
|
500
|
+
};
|
|
501
|
+
if (Object.defineProperty(i.prototype, "props", {
|
|
502
|
+
set: function() {
|
|
503
|
+
throw Error();
|
|
504
|
+
}
|
|
505
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
506
|
+
try {
|
|
507
|
+
Reflect.construct(i, []);
|
|
508
|
+
} catch (v) {
|
|
509
|
+
n = v;
|
|
510
|
+
}
|
|
511
|
+
Reflect.construct(e, [], i);
|
|
512
|
+
} else {
|
|
513
|
+
try {
|
|
514
|
+
i.call();
|
|
515
|
+
} catch (v) {
|
|
516
|
+
n = v;
|
|
517
|
+
}
|
|
518
|
+
e.call(i.prototype);
|
|
519
|
+
}
|
|
520
|
+
} else {
|
|
521
|
+
try {
|
|
522
|
+
throw Error();
|
|
523
|
+
} catch (v) {
|
|
524
|
+
n = v;
|
|
525
|
+
}
|
|
526
|
+
e();
|
|
527
|
+
}
|
|
528
|
+
} catch (v) {
|
|
529
|
+
if (v && n && typeof v.stack == "string") {
|
|
530
|
+
for (var a = v.stack.split(`
|
|
531
|
+
`), p = n.stack.split(`
|
|
532
|
+
`), l = a.length - 1, u = p.length - 1; l >= 1 && u >= 0 && a[l] !== p[u]; )
|
|
533
|
+
u--;
|
|
534
|
+
for (; l >= 1 && u >= 0; l--, u--)
|
|
535
|
+
if (a[l] !== p[u]) {
|
|
536
|
+
if (l !== 1 || u !== 1)
|
|
537
|
+
do
|
|
538
|
+
if (l--, u--, u < 0 || a[l] !== p[u]) {
|
|
539
|
+
var y = `
|
|
540
|
+
` + a[l].replace(" at new ", " at ");
|
|
541
|
+
return e.displayName && y.includes("<anonymous>") && (y = y.replace("<anonymous>", e.displayName)), typeof e == "function" && W.set(e, y), y;
|
|
542
|
+
}
|
|
543
|
+
while (l >= 1 && u >= 0);
|
|
544
|
+
break;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
} finally {
|
|
548
|
+
q = !1, N.current = s, Ve(), Error.prepareStackTrace = o;
|
|
549
|
+
}
|
|
550
|
+
var I = e ? e.displayName || e.name : "", O = I ? M(I) : "";
|
|
551
|
+
return typeof e == "function" && W.set(e, O), O;
|
|
552
|
+
}
|
|
553
|
+
function We(e, r, t) {
|
|
554
|
+
return ue(e, !1);
|
|
555
|
+
}
|
|
556
|
+
function Ye(e) {
|
|
557
|
+
var r = e.prototype;
|
|
558
|
+
return !!(r && r.isReactComponent);
|
|
559
|
+
}
|
|
560
|
+
function Y(e, r, t) {
|
|
561
|
+
if (e == null)
|
|
562
|
+
return "";
|
|
563
|
+
if (typeof e == "function")
|
|
564
|
+
return ue(e, Ye(e));
|
|
565
|
+
if (typeof e == "string")
|
|
566
|
+
return M(e);
|
|
567
|
+
switch (e) {
|
|
568
|
+
case P:
|
|
569
|
+
return M("Suspense");
|
|
570
|
+
case b:
|
|
571
|
+
return M("SuspenseList");
|
|
572
|
+
}
|
|
573
|
+
if (typeof e == "object")
|
|
574
|
+
switch (e.$$typeof) {
|
|
575
|
+
case f:
|
|
576
|
+
return We(e.render);
|
|
577
|
+
case E:
|
|
578
|
+
return Y(e.type, r, t);
|
|
579
|
+
case T: {
|
|
580
|
+
var n = e, o = n._payload, s = n._init;
|
|
581
|
+
try {
|
|
582
|
+
return Y(s(o), r, t);
|
|
583
|
+
} catch {
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return "";
|
|
588
|
+
}
|
|
589
|
+
var A = Object.prototype.hasOwnProperty, ce = {}, fe = j.ReactDebugCurrentFrame;
|
|
590
|
+
function L(e) {
|
|
591
|
+
if (e) {
|
|
592
|
+
var r = e._owner, t = Y(e.type, e._source, r ? r.type : null);
|
|
593
|
+
fe.setExtraStackFrame(t);
|
|
594
|
+
} else
|
|
595
|
+
fe.setExtraStackFrame(null);
|
|
596
|
+
}
|
|
597
|
+
function Le(e, r, t, n, o) {
|
|
598
|
+
{
|
|
599
|
+
var s = Function.call.bind(A);
|
|
600
|
+
for (var i in e)
|
|
601
|
+
if (s(e, i)) {
|
|
602
|
+
var a = void 0;
|
|
603
|
+
try {
|
|
604
|
+
if (typeof e[i] != "function") {
|
|
605
|
+
var p = Error((n || "React class") + ": " + t + " type `" + i + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[i] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
606
|
+
throw p.name = "Invariant Violation", p;
|
|
607
|
+
}
|
|
608
|
+
a = e[i](r, i, n, t, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
609
|
+
} catch (l) {
|
|
610
|
+
a = l;
|
|
611
|
+
}
|
|
612
|
+
a && !(a instanceof Error) && (L(o), d("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", n || "React class", t, i, typeof a), L(null)), a instanceof Error && !(a.message in ce) && (ce[a.message] = !0, L(o), d("Failed %s type: %s", t, a.message), L(null));
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
var Ne = Array.isArray;
|
|
617
|
+
function G(e) {
|
|
618
|
+
return Ne(e);
|
|
619
|
+
}
|
|
620
|
+
function Ue(e) {
|
|
621
|
+
{
|
|
622
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, t = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
623
|
+
return t;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function qe(e) {
|
|
627
|
+
try {
|
|
628
|
+
return de(e), !1;
|
|
629
|
+
} catch {
|
|
630
|
+
return !0;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function de(e) {
|
|
634
|
+
return "" + e;
|
|
635
|
+
}
|
|
636
|
+
function pe(e) {
|
|
637
|
+
if (qe(e))
|
|
638
|
+
return d("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ue(e)), de(e);
|
|
639
|
+
}
|
|
640
|
+
var ve = j.ReactCurrentOwner, Ge = {
|
|
641
|
+
key: !0,
|
|
642
|
+
ref: !0,
|
|
643
|
+
__self: !0,
|
|
644
|
+
__source: !0
|
|
645
|
+
}, ge, me;
|
|
646
|
+
function Je(e) {
|
|
647
|
+
if (A.call(e, "ref")) {
|
|
648
|
+
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
649
|
+
if (r && r.isReactWarning)
|
|
650
|
+
return !1;
|
|
651
|
+
}
|
|
652
|
+
return e.ref !== void 0;
|
|
653
|
+
}
|
|
654
|
+
function ze(e) {
|
|
655
|
+
if (A.call(e, "key")) {
|
|
656
|
+
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
657
|
+
if (r && r.isReactWarning)
|
|
658
|
+
return !1;
|
|
659
|
+
}
|
|
660
|
+
return e.key !== void 0;
|
|
661
|
+
}
|
|
662
|
+
function Ke(e, r) {
|
|
663
|
+
typeof e.ref == "string" && ve.current;
|
|
664
|
+
}
|
|
665
|
+
function Xe(e, r) {
|
|
666
|
+
{
|
|
667
|
+
var t = function() {
|
|
668
|
+
ge || (ge = !0, d("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
669
|
+
};
|
|
670
|
+
t.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
671
|
+
get: t,
|
|
672
|
+
configurable: !0
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
function He(e, r) {
|
|
677
|
+
{
|
|
678
|
+
var t = function() {
|
|
679
|
+
me || (me = !0, d("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
680
|
+
};
|
|
681
|
+
t.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
682
|
+
get: t,
|
|
683
|
+
configurable: !0
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
var Qe = function(e, r, t, n, o, s, i) {
|
|
688
|
+
var a = {
|
|
689
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
690
|
+
$$typeof: g,
|
|
691
|
+
// Built-in properties that belong on the element
|
|
692
|
+
type: e,
|
|
693
|
+
key: r,
|
|
694
|
+
ref: t,
|
|
695
|
+
props: i,
|
|
696
|
+
// Record the component responsible for creating this element.
|
|
697
|
+
_owner: s
|
|
698
|
+
};
|
|
699
|
+
return a._store = {}, Object.defineProperty(a._store, "validated", {
|
|
700
|
+
configurable: !1,
|
|
701
|
+
enumerable: !1,
|
|
702
|
+
writable: !0,
|
|
703
|
+
value: !1
|
|
704
|
+
}), Object.defineProperty(a, "_self", {
|
|
705
|
+
configurable: !1,
|
|
706
|
+
enumerable: !1,
|
|
707
|
+
writable: !1,
|
|
708
|
+
value: n
|
|
709
|
+
}), Object.defineProperty(a, "_source", {
|
|
710
|
+
configurable: !1,
|
|
711
|
+
enumerable: !1,
|
|
712
|
+
writable: !1,
|
|
713
|
+
value: o
|
|
714
|
+
}), Object.freeze && (Object.freeze(a.props), Object.freeze(a)), a;
|
|
715
|
+
};
|
|
716
|
+
function Ze(e, r, t, n, o) {
|
|
717
|
+
{
|
|
718
|
+
var s, i = {}, a = null, p = null;
|
|
719
|
+
t !== void 0 && (pe(t), a = "" + t), ze(r) && (pe(r.key), a = "" + r.key), Je(r) && (p = r.ref, Ke(r, o));
|
|
720
|
+
for (s in r)
|
|
721
|
+
A.call(r, s) && !Ge.hasOwnProperty(s) && (i[s] = r[s]);
|
|
722
|
+
if (e && e.defaultProps) {
|
|
723
|
+
var l = e.defaultProps;
|
|
724
|
+
for (s in l)
|
|
725
|
+
i[s] === void 0 && (i[s] = l[s]);
|
|
726
|
+
}
|
|
727
|
+
if (a || p) {
|
|
728
|
+
var u = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
729
|
+
a && Xe(i, u), p && He(i, u);
|
|
730
|
+
}
|
|
731
|
+
return Qe(e, a, p, o, n, ve.current, i);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
var J = j.ReactCurrentOwner, be = j.ReactDebugCurrentFrame;
|
|
735
|
+
function x(e) {
|
|
736
|
+
if (e) {
|
|
737
|
+
var r = e._owner, t = Y(e.type, e._source, r ? r.type : null);
|
|
738
|
+
be.setExtraStackFrame(t);
|
|
739
|
+
} else
|
|
740
|
+
be.setExtraStackFrame(null);
|
|
741
|
+
}
|
|
742
|
+
var z;
|
|
743
|
+
z = !1;
|
|
744
|
+
function K(e) {
|
|
745
|
+
return typeof e == "object" && e !== null && e.$$typeof === g;
|
|
746
|
+
}
|
|
747
|
+
function ye() {
|
|
748
|
+
{
|
|
749
|
+
if (J.current) {
|
|
750
|
+
var e = w(J.current.type);
|
|
751
|
+
if (e)
|
|
752
|
+
return `
|
|
753
|
+
|
|
754
|
+
Check the render method of \`` + e + "`.";
|
|
755
|
+
}
|
|
756
|
+
return "";
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
function er(e) {
|
|
760
|
+
return "";
|
|
761
|
+
}
|
|
762
|
+
var he = {};
|
|
763
|
+
function rr(e) {
|
|
764
|
+
{
|
|
765
|
+
var r = ye();
|
|
766
|
+
if (!r) {
|
|
767
|
+
var t = typeof e == "string" ? e : e.displayName || e.name;
|
|
768
|
+
t && (r = `
|
|
769
|
+
|
|
770
|
+
Check the top-level render call using <` + t + ">.");
|
|
771
|
+
}
|
|
772
|
+
return r;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
function _e(e, r) {
|
|
776
|
+
{
|
|
777
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
778
|
+
return;
|
|
779
|
+
e._store.validated = !0;
|
|
780
|
+
var t = rr(r);
|
|
781
|
+
if (he[t])
|
|
782
|
+
return;
|
|
783
|
+
he[t] = !0;
|
|
784
|
+
var n = "";
|
|
785
|
+
e && e._owner && e._owner !== J.current && (n = " It was passed a child from " + w(e._owner.type) + "."), x(e), d('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), x(null);
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
function Ee(e, r) {
|
|
789
|
+
{
|
|
790
|
+
if (typeof e != "object")
|
|
791
|
+
return;
|
|
792
|
+
if (G(e))
|
|
793
|
+
for (var t = 0; t < e.length; t++) {
|
|
794
|
+
var n = e[t];
|
|
795
|
+
K(n) && _e(n, r);
|
|
796
|
+
}
|
|
797
|
+
else if (K(e))
|
|
798
|
+
e._store && (e._store.validated = !0);
|
|
799
|
+
else if (e) {
|
|
800
|
+
var o = Oe(e);
|
|
801
|
+
if (typeof o == "function" && o !== e.entries)
|
|
802
|
+
for (var s = o.call(e), i; !(i = s.next()).done; )
|
|
803
|
+
K(i.value) && _e(i.value, r);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
function tr(e) {
|
|
808
|
+
{
|
|
809
|
+
var r = e.type;
|
|
810
|
+
if (r == null || typeof r == "string")
|
|
811
|
+
return;
|
|
812
|
+
var t;
|
|
813
|
+
if (typeof r == "function")
|
|
814
|
+
t = r.propTypes;
|
|
815
|
+
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
|
|
816
|
+
// Inner props are checked in the reconciler.
|
|
817
|
+
r.$$typeof === E))
|
|
818
|
+
t = r.propTypes;
|
|
819
|
+
else
|
|
820
|
+
return;
|
|
821
|
+
if (t) {
|
|
822
|
+
var n = w(r);
|
|
823
|
+
Le(t, e.props, "prop", n, e);
|
|
824
|
+
} else if (r.PropTypes !== void 0 && !z) {
|
|
825
|
+
z = !0;
|
|
826
|
+
var o = w(r);
|
|
827
|
+
d("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", o || "Unknown");
|
|
828
|
+
}
|
|
829
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && d("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
function nr(e) {
|
|
833
|
+
{
|
|
834
|
+
for (var r = Object.keys(e.props), t = 0; t < r.length; t++) {
|
|
835
|
+
var n = r[t];
|
|
836
|
+
if (n !== "children" && n !== "key") {
|
|
837
|
+
x(e), d("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", n), x(null);
|
|
838
|
+
break;
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
e.ref !== null && (x(e), d("Invalid attribute `ref` supplied to `React.Fragment`."), x(null));
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
var Re = {};
|
|
845
|
+
function we(e, r, t, n, o, s) {
|
|
846
|
+
{
|
|
847
|
+
var i = Fe(e);
|
|
848
|
+
if (!i) {
|
|
849
|
+
var a = "";
|
|
850
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
851
|
+
var p = er();
|
|
852
|
+
p ? a += p : a += ye();
|
|
853
|
+
var l;
|
|
854
|
+
e === null ? l = "null" : G(e) ? l = "array" : e !== void 0 && e.$$typeof === g ? (l = "<" + (w(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : l = typeof e, d("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", l, a);
|
|
855
|
+
}
|
|
856
|
+
var u = Ze(e, r, t, o, s);
|
|
857
|
+
if (u == null)
|
|
858
|
+
return u;
|
|
859
|
+
if (i) {
|
|
860
|
+
var y = r.children;
|
|
861
|
+
if (y !== void 0)
|
|
862
|
+
if (n)
|
|
863
|
+
if (G(y)) {
|
|
864
|
+
for (var I = 0; I < y.length; I++)
|
|
865
|
+
Ee(y[I], e);
|
|
866
|
+
Object.freeze && Object.freeze(y);
|
|
867
|
+
} else
|
|
868
|
+
d("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
869
|
+
else
|
|
870
|
+
Ee(y, e);
|
|
871
|
+
}
|
|
872
|
+
if (A.call(r, "key")) {
|
|
873
|
+
var O = w(e), v = Object.keys(r).filter(function(ur) {
|
|
874
|
+
return ur !== "key";
|
|
875
|
+
}), X = v.length > 0 ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
876
|
+
if (!Re[O + X]) {
|
|
877
|
+
var lr = v.length > 0 ? "{" + v.join(": ..., ") + ": ...}" : "{}";
|
|
878
|
+
d(`A props object containing a "key" prop is being spread into JSX:
|
|
879
|
+
let props = %s;
|
|
880
|
+
<%s {...props} />
|
|
881
|
+
React keys must be passed directly to JSX without using spread:
|
|
882
|
+
let props = %s;
|
|
883
|
+
<%s key={someKey} {...props} />`, X, O, lr, O), Re[O + X] = !0;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return e === h ? nr(u) : tr(u), u;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function ar(e, r, t) {
|
|
890
|
+
return we(e, r, t, !0);
|
|
891
|
+
}
|
|
892
|
+
function ir(e, r, t) {
|
|
893
|
+
return we(e, r, t, !1);
|
|
894
|
+
}
|
|
895
|
+
var or = ir, sr = ar;
|
|
896
|
+
$.Fragment = h, $.jsx = or, $.jsxs = sr;
|
|
897
|
+
}()), $;
|
|
898
|
+
}
|
|
899
|
+
process.env.NODE_ENV === "production" ? H.exports = cr() : H.exports = fr();
|
|
900
|
+
var B = H.exports;
|
|
901
|
+
const dr = ({
|
|
902
|
+
title: _,
|
|
903
|
+
data: g,
|
|
904
|
+
timeframe: m
|
|
905
|
+
}) => {
|
|
906
|
+
g.map((c) => ({
|
|
907
|
+
label: c.product,
|
|
908
|
+
value: c.sales
|
|
909
|
+
}));
|
|
910
|
+
const h = g.reduce((c, k) => c + k.sales, 0), R = Math.round(h / g.length);
|
|
911
|
+
return /* @__PURE__ */ B.jsxs("div", { style: { padding: "20px", background: "#f5f5f5", borderRadius: "8px" }, children: [
|
|
912
|
+
/* @__PURE__ */ B.jsx("h3", { children: _ }),
|
|
913
|
+
/* @__PURE__ */ B.jsxs("p", { children: [
|
|
914
|
+
"Total: $",
|
|
915
|
+
h.toLocaleString(),
|
|
916
|
+
" | Avg: $",
|
|
917
|
+
R.toLocaleString()
|
|
918
|
+
] }),
|
|
919
|
+
/* @__PURE__ */ B.jsx("ul", { style: { listStyle: "none", padding: 0 }, children: g.map((c) => /* @__PURE__ */ B.jsxs("li", { children: [
|
|
920
|
+
c.product,
|
|
921
|
+
": $",
|
|
922
|
+
c.sales.toLocaleString()
|
|
923
|
+
] }, c.product)) })
|
|
924
|
+
] });
|
|
925
|
+
}, pr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
304
926
|
__proto__: null,
|
|
305
|
-
MockSalesGraph:
|
|
927
|
+
MockSalesGraph: dr
|
|
306
928
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
307
929
|
export {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
930
|
+
dr as MockSalesGraph,
|
|
931
|
+
gr as getClientContext,
|
|
932
|
+
mr as getClientTools
|
|
311
933
|
};
|