@adminide-stack/clock-tik-browser 12.0.34 → 12.0.35-alpha.0

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.
Files changed (34) hide show
  1. package/lib/pages/Home/__tests__/calls.test.d.ts +2 -0
  2. package/lib/pages/Home/__tests__/calls.test.d.ts.map +1 -0
  3. package/lib/pages/Home/__tests__/surfaces.test.d.ts +2 -0
  4. package/lib/pages/Home/__tests__/surfaces.test.d.ts.map +1 -0
  5. package/lib/pages/Home/chat/CallsCard.d.ts +22 -0
  6. package/lib/pages/Home/chat/CallsCard.d.ts.map +1 -0
  7. package/lib/pages/Home/chat/CallsCard.js +352 -0
  8. package/lib/pages/Home/chat/CallsCard.js.map +1 -0
  9. package/lib/pages/Home/chat/ChoresChat.d.ts.map +1 -1
  10. package/lib/pages/Home/chat/ChoresChat.js +53 -8
  11. package/lib/pages/Home/chat/ChoresChat.js.map +1 -1
  12. package/lib/pages/Home/chat/ChoresPanel.d.ts.map +1 -1
  13. package/lib/pages/Home/chat/ChoresPanel.js +2 -2
  14. package/lib/pages/Home/chat/ChoresPanel.js.map +1 -1
  15. package/lib/pages/Home/chat/calls.d.ts +124 -0
  16. package/lib/pages/Home/chat/calls.d.ts.map +1 -0
  17. package/lib/pages/Home/chat/calls.js +278 -0
  18. package/lib/pages/Home/chat/calls.js.map +1 -0
  19. package/lib/pages/Home/chat/callsApi.d.ts +10 -0
  20. package/lib/pages/Home/chat/callsApi.d.ts.map +1 -0
  21. package/lib/pages/Home/chat/callsApi.js +31 -0
  22. package/lib/pages/Home/chat/callsApi.js.map +1 -0
  23. package/lib/pages/Home/chat/chatTheme.d.ts.map +1 -1
  24. package/lib/pages/Home/chat/chatTheme.js +311 -1
  25. package/lib/pages/Home/chat/chatTheme.js.map +1 -1
  26. package/lib/pages/Home/chat/surfaces.d.ts +34 -0
  27. package/lib/pages/Home/chat/surfaces.d.ts.map +1 -0
  28. package/lib/pages/Home/chat/surfaces.js +165 -0
  29. package/lib/pages/Home/chat/surfaces.js.map +1 -0
  30. package/lib/pages/Home/chat/useCallLog.d.ts +17 -0
  31. package/lib/pages/Home/chat/useCallLog.d.ts.map +1 -0
  32. package/lib/pages/Home/chat/useCallLog.js +85 -0
  33. package/lib/pages/Home/chat/useCallLog.js.map +1 -0
  34. package/package.json +3 -3
@@ -320,6 +320,314 @@ import {jsx}from'react/jsx-runtime';const CHAT_CSS = `
320
320
  color: hsl(var(--muted-foreground));
321
321
  }
322
322
 
323
+ /* Lucy's calls, under the reply that placed them (CallsCard): each business and how the call is
324
+ going, live with its clock, or how it went; and a link to any other surface a reply names. */
325
+ .cbh-chat .cbh-calls {
326
+ max-width: 536px;
327
+ margin: 0 12px;
328
+ border: 1px solid hsl(var(--border));
329
+ border-radius: 16px;
330
+ background: hsl(var(--card));
331
+ box-shadow: 0 6px 18px -14px rgba(48, 28, 8, 0.4);
332
+ overflow: hidden;
333
+ animation: cbh-chat-rise 0.25s ease-out;
334
+ }
335
+ .cbh-chat .cbh-calls-head {
336
+ display: flex;
337
+ align-items: center;
338
+ gap: 8px;
339
+ padding: 8px 8px 8px 12px;
340
+ border-bottom: 1px solid hsl(var(--border));
341
+ }
342
+ .cbh-chat .cbh-calls-icon {
343
+ flex: none;
344
+ display: inline-flex;
345
+ align-items: center;
346
+ justify-content: center;
347
+ width: 26px;
348
+ height: 26px;
349
+ border-radius: 8px;
350
+ background: linear-gradient(160deg, #fff1e6, #ffe0cc);
351
+ color: #b84100;
352
+ }
353
+ .cbh-chat .cbh-calls-title {
354
+ font-size: 13.5px;
355
+ font-weight: 600;
356
+ }
357
+ .cbh-chat .cbh-calls-count {
358
+ font-size: 12px;
359
+ font-weight: 600;
360
+ color: #b84100;
361
+ white-space: nowrap;
362
+ }
363
+ .cbh-chat .cbh-calls-refresh {
364
+ flex: none;
365
+ display: inline-flex;
366
+ align-items: center;
367
+ justify-content: center;
368
+ width: 30px;
369
+ height: 30px;
370
+ margin-left: auto;
371
+ border: 0;
372
+ border-radius: 8px;
373
+ background: transparent;
374
+ color: hsl(var(--muted-foreground));
375
+ cursor: pointer;
376
+ }
377
+ .cbh-chat .cbh-calls-refresh:hover {
378
+ background: hsl(var(--muted));
379
+ color: hsl(var(--foreground));
380
+ }
381
+ .cbh-chat .cbh-calls-refresh:disabled {
382
+ cursor: default;
383
+ }
384
+ .cbh-chat .cbh-calls-list {
385
+ margin: 0;
386
+ padding: 0;
387
+ list-style: none;
388
+ }
389
+ .cbh-chat .cbh-calls-item {
390
+ padding: 12px 14px;
391
+ }
392
+ .cbh-chat .cbh-calls-item + .cbh-calls-item {
393
+ border-top: 1px solid hsl(var(--border));
394
+ }
395
+ .cbh-chat .cbh-calls-row {
396
+ display: flex;
397
+ flex-wrap: wrap;
398
+ align-items: center;
399
+ gap: 6px 8px;
400
+ }
401
+ .cbh-chat .cbh-calls-name {
402
+ min-width: 0;
403
+ font-size: 14px;
404
+ font-weight: 600;
405
+ overflow-wrap: anywhere;
406
+ }
407
+ .cbh-chat .cbh-calls-chip {
408
+ display: inline-flex;
409
+ align-items: center;
410
+ gap: 6px;
411
+ padding: 2px 9px;
412
+ border-radius: 999px;
413
+ background: hsl(var(--muted));
414
+ color: hsl(var(--muted-foreground));
415
+ font-size: 12px;
416
+ font-weight: 500;
417
+ white-space: nowrap;
418
+ font-variant-numeric: tabular-nums;
419
+ }
420
+ .cbh-chat .cbh-calls-chip[data-tone='live'] {
421
+ background: #fff1e6;
422
+ color: #b84100;
423
+ }
424
+ .cbh-chat .cbh-calls-chip[data-tone='success'] {
425
+ background: #eaf5ea;
426
+ color: #2b7a36;
427
+ }
428
+ .cbh-chat .cbh-calls-chip[data-tone='attention'] {
429
+ background: #fdf3e1;
430
+ color: #8a5a00;
431
+ }
432
+ .cbh-chat .cbh-calls-chip[data-tone='danger'] {
433
+ background: #fdecea;
434
+ color: #b42318;
435
+ }
436
+ .cbh-chat .cbh-calls-dot {
437
+ flex: none;
438
+ width: 7px;
439
+ height: 7px;
440
+ border-radius: 50%;
441
+ background: #ff5a00;
442
+ animation: cbh-chores-pulse 1.8s ease-out infinite;
443
+ }
444
+ .cbh-chat .cbh-calls-line {
445
+ margin: 4px 0 0;
446
+ font-size: 13px;
447
+ line-height: 1.5;
448
+ color: hsl(var(--muted-foreground));
449
+ overflow-wrap: anywhere;
450
+ }
451
+ .cbh-chat .cbh-calls-actions {
452
+ display: flex;
453
+ flex-wrap: wrap;
454
+ gap: 8px;
455
+ margin-top: 10px;
456
+ }
457
+ .cbh-chat .cbh-calls-btn {
458
+ display: inline-flex;
459
+ align-items: center;
460
+ gap: 6px;
461
+ height: 34px;
462
+ padding: 0 14px;
463
+ border: 1px solid hsl(var(--border));
464
+ border-radius: 999px;
465
+ background: hsl(var(--card));
466
+ color: hsl(var(--foreground));
467
+ font: inherit;
468
+ font-size: 13px;
469
+ font-weight: 500;
470
+ text-decoration: none;
471
+ cursor: pointer;
472
+ }
473
+ .cbh-chat .cbh-calls-btn:hover {
474
+ background: hsl(var(--muted));
475
+ }
476
+ .cbh-chat .cbh-calls-btn:disabled {
477
+ opacity: 0.6;
478
+ cursor: default;
479
+ }
480
+ .cbh-chat .cbh-calls-btn-end {
481
+ color: #b42318;
482
+ }
483
+ .cbh-chat .cbh-calls-confirm {
484
+ margin-top: 10px;
485
+ padding: 10px 12px;
486
+ border-radius: 12px;
487
+ background: hsl(var(--muted));
488
+ }
489
+ .cbh-chat .cbh-calls-confirm > p {
490
+ margin: 0;
491
+ font-size: 13.5px;
492
+ font-weight: 500;
493
+ }
494
+ .cbh-chat .cbh-calls-confirm .cbh-calls-actions {
495
+ margin-top: 8px;
496
+ }
497
+ .cbh-chat .cbh-calls-confirm .cbh-calls-btn-end {
498
+ border-color: #b42318;
499
+ background: #b42318;
500
+ color: #fff;
501
+ }
502
+ .cbh-chat .cbh-calls-note {
503
+ display: flex;
504
+ align-items: center;
505
+ gap: 8px;
506
+ margin: 0;
507
+ padding: 12px 14px;
508
+ font-size: 13px;
509
+ color: hsl(var(--muted-foreground));
510
+ }
511
+ .cbh-chat .cbh-calls-item .cbh-calls-note,
512
+ .cbh-chat .cbh-calls-transcript .cbh-calls-note {
513
+ padding: 8px 0 0;
514
+ }
515
+ .cbh-chat .cbh-calls-link {
516
+ padding: 0;
517
+ border: 0;
518
+ background: none;
519
+ color: #b84100;
520
+ font: inherit;
521
+ font-weight: 600;
522
+ cursor: pointer;
523
+ }
524
+ .cbh-chat .cbh-calls-problem {
525
+ margin: 0;
526
+ padding: 0 14px 10px;
527
+ font-size: 12.5px;
528
+ color: #b42318;
529
+ }
530
+ .cbh-chat .cbh-calls-confirm .cbh-calls-problem {
531
+ padding: 8px 0 0;
532
+ }
533
+ .cbh-chat .cbh-calls-more {
534
+ display: inline-flex;
535
+ align-items: center;
536
+ gap: 4px;
537
+ margin-top: 8px;
538
+ padding: 0;
539
+ border: 0;
540
+ background: none;
541
+ color: hsl(var(--muted-foreground));
542
+ font: inherit;
543
+ font-size: 12.5px;
544
+ font-weight: 600;
545
+ cursor: pointer;
546
+ }
547
+ .cbh-chat .cbh-calls-more[aria-expanded='true'] svg {
548
+ transform: rotate(180deg);
549
+ }
550
+ .cbh-chat .cbh-calls-transcript {
551
+ max-height: 280px;
552
+ margin-top: 8px;
553
+ padding: 10px 12px;
554
+ border-radius: 12px;
555
+ background: hsl(var(--muted));
556
+ overflow-y: auto;
557
+ }
558
+ .cbh-chat .cbh-calls-transcript > p {
559
+ margin: 0 0 6px;
560
+ font-size: 13px;
561
+ line-height: 1.5;
562
+ overflow-wrap: anywhere;
563
+ }
564
+ .cbh-chat .cbh-calls-transcript > p b {
565
+ font-weight: 600;
566
+ }
567
+ .cbh-chat .cbh-calls-all {
568
+ display: inline-flex;
569
+ align-items: center;
570
+ gap: 3px;
571
+ margin: 0 14px 12px;
572
+ color: #b84100;
573
+ font-size: 12.5px;
574
+ font-weight: 600;
575
+ text-decoration: none;
576
+ }
577
+ .cbh-chat .cbh-calls-transcript .cbh-calls-all {
578
+ margin: 4px 0 0;
579
+ }
580
+ .cbh-chat .cbh-calls-all:hover {
581
+ text-decoration: underline;
582
+ }
583
+ .cbh-chat .cbh-surface-links {
584
+ display: flex;
585
+ flex-wrap: wrap;
586
+ gap: 8px;
587
+ max-width: 560px;
588
+ padding: 0 12px;
589
+ }
590
+ .cbh-chat .cbh-surface-link {
591
+ display: inline-flex;
592
+ align-items: center;
593
+ gap: 8px;
594
+ max-width: 100%;
595
+ padding: 8px 12px;
596
+ border: 1px solid hsl(var(--border));
597
+ border-radius: 14px;
598
+ background: hsl(var(--card));
599
+ color: hsl(var(--foreground));
600
+ font-size: 13px;
601
+ text-decoration: none;
602
+ }
603
+ .cbh-chat .cbh-surface-link:hover {
604
+ background: hsl(var(--muted));
605
+ }
606
+ .cbh-chat .cbh-surface-link-label {
607
+ min-width: 0;
608
+ overflow: hidden;
609
+ white-space: nowrap;
610
+ text-overflow: ellipsis;
611
+ color: hsl(var(--muted-foreground));
612
+ }
613
+ .cbh-chat .cbh-surface-link-open {
614
+ flex: none;
615
+ display: inline-flex;
616
+ align-items: center;
617
+ gap: 3px;
618
+ color: #b84100;
619
+ font-weight: 600;
620
+ }
621
+ .cbh-chat .cbh-calls-btn:focus-visible,
622
+ .cbh-chat .cbh-calls-refresh:focus-visible,
623
+ .cbh-chat .cbh-calls-more:focus-visible,
624
+ .cbh-chat .cbh-calls-link:focus-visible,
625
+ .cbh-chat .cbh-calls-all:focus-visible,
626
+ .cbh-chat .cbh-surface-link:focus-visible {
627
+ outline: 2px solid hsl(var(--ring));
628
+ outline-offset: 2px;
629
+ }
630
+
323
631
  /* Lucy's chores (ChoresPanel): the header button's count, then the panel - a sheet from the bottom
324
632
  on a phone, a card hanging under its button on a wider screen (the button's place comes in as
325
633
  --cbh-chores-top / --cbh-chores-right). */
@@ -780,7 +1088,9 @@ import {jsx}from'react/jsx-runtime';const CHAT_CSS = `
780
1088
  .cbh-chat .cbh-chores,
781
1089
  .cbh-chat .cbh-chores-scrim,
782
1090
  .cbh-chat .cbh-chores-spin,
783
- .cbh-chat .cbh-chores-pulse {
1091
+ .cbh-chat .cbh-chores-pulse,
1092
+ .cbh-chat .cbh-calls,
1093
+ .cbh-chat .cbh-calls-dot {
784
1094
  animation: none;
785
1095
  }
786
1096
  .cbh-chat .cbh-chat-starter,
@@ -1 +1 @@
1
- {"version":3,"file":"chatTheme.js","sources":["../../../../src/pages/Home/chat/chatTheme.tsx"],"sourcesContent":[null],"names":["_jsx"],"mappings":"oCASA,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4kChB;SAEe,SAAS,GAAA;;SAEdA,GAAA,CAAA,OAAA,EAAA;AACX,IAAC,qBAAA,EAAA,IAAA;;;;;"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Lucy's surface markers: `[[surface:<id>|<what it shows>]]`, where a reply of hers hands the person
3
+ * one of Yantra's surfaces - the calls she placed, a Computer to finish a check on, a list she made.
4
+ * In iMessage the messenger gateway sends each as a link card (messenger-box
5
+ * providers/yantra-surface.ts, the same marker rule). This chat talks to her directly, so the marker
6
+ * reached the page as she wrote it. Each reply is put right before it is drawn (ChoresChat): the
7
+ * markers come out of its words, a phone-calls one becomes the live call card under it (CallsCard),
8
+ * and any other a link to open that surface.
9
+ */
10
+ export interface SurfaceMarker {
11
+ /** The surface, lower case. */
12
+ id: string;
13
+ /** What Lucy said it shows ("Calling plumbers and a cleaner"); may be empty. */
14
+ label: string;
15
+ }
16
+ export interface MarkedReply {
17
+ /** The reply without its markers: the same string when it had none. */
18
+ content: string;
19
+ /** Each surface once, in the order the reply names them. */
20
+ markers: SurfaceMarker[];
21
+ }
22
+ /** The surface of Lucy's phone calls. */
23
+ export declare const PHONE_CALLS_SURFACE = "phone-calls";
24
+ export declare function takeSurfaceMarkers(content: string): MarkedReply;
25
+ export interface SurfaceLink {
26
+ /** The surface's own id, an alias resolved. */
27
+ id: string;
28
+ title: string;
29
+ /** Its host's first label: `<host>.<environment>`. */
30
+ host: string;
31
+ }
32
+ /** The surface a marker names, or null for one this chat does not know. */
33
+ export declare function surfaceLink(id: string): SurfaceLink | null;
34
+ //# sourceMappingURL=surfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/surfaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,aAAa;IAC1B,+BAA+B;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IACxB,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,yCAAyC;AACzC,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAejD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAqB/D;AAqDD,MAAM,WAAW,WAAW;IACxB,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,sDAAsD;IACtD,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,2EAA2E;AAC3E,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAK1D"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Lucy's surface markers: `[[surface:<id>|<what it shows>]]`, where a reply of hers hands the person
3
+ * one of Yantra's surfaces - the calls she placed, a Computer to finish a check on, a list she made.
4
+ * In iMessage the messenger gateway sends each as a link card (messenger-box
5
+ * providers/yantra-surface.ts, the same marker rule). This chat talks to her directly, so the marker
6
+ * reached the page as she wrote it. Each reply is put right before it is drawn (ChoresChat): the
7
+ * markers come out of its words, a phone-calls one becomes the live call card under it (CallsCard),
8
+ * and any other a link to open that surface.
9
+ */
10
+ /** The surface of Lucy's phone calls. */
11
+ const PHONE_CALLS_SURFACE = 'phone-calls';
12
+ /** The gateway's marker rule (SURFACE_DIRECTIVE_RE), with the spaces before it. */
13
+ const MARKER = /[ \t]*\[\[\s*surface\s*:\s*([A-Za-z0-9_-]{1,40})\s*(?:\|\s*([^\]\n]{0,200}?))?\s*\]\]/gi;
14
+ /** Where a marker still streaming in starts (`[[surface:phone-ca` at the end), or -1. */
15
+ function unfinishedMarker(text) {
16
+ const at = text.lastIndexOf('[[');
17
+ if (at < 0) return -1;
18
+ const tail = text.slice(at + 2);
19
+ if (tail.includes('\n') || tail.includes(']]')) return -1;
20
+ const head = tail.trimStart().toLowerCase();
21
+ return head.startsWith('surface') || 'surface'.startsWith(head) ? at : -1;
22
+ }
23
+ function takeSurfaceMarkers(content) {
24
+ const markers = [];
25
+ let found = false;
26
+ let rest = content.replace(MARKER, (_match, id, label) => {
27
+ found = true;
28
+ const surface = id.toLowerCase();
29
+ if (!markers.some(m => m.id === surface)) markers.push({
30
+ id: surface,
31
+ label: (label ?? '').trim()
32
+ });
33
+ return '';
34
+ });
35
+ const open = unfinishedMarker(rest);
36
+ if (open >= 0) {
37
+ rest = rest.slice(0, open);
38
+ found = true;
39
+ }
40
+ if (!found) return {
41
+ content,
42
+ markers
43
+ };
44
+ // No line left blank by a marker, and no run of empty lines where one stood alone.
45
+ const tidy = rest.replace(/^[ \t]+$/gm, '').replace(/\n{3,}/g, '\n\n').trim();
46
+ return {
47
+ content: tidy,
48
+ markers
49
+ };
50
+ }
51
+ /**
52
+ * The surfaces this chat links to, as the gateway names them (its built-in list, with the ids it
53
+ * also takes for them), and the two it finds by their hosts. Any other marker only comes out of
54
+ * the reply: the gateway sends a card for an unknown id only once its host answers, which a page
55
+ * on another site cannot check.
56
+ */
57
+ const KNOWN = {
58
+ 'phone-calls': {
59
+ title: 'Phone Calls'
60
+ },
61
+ computer: {
62
+ title: 'your Computer'
63
+ },
64
+ issues: {
65
+ title: 'Issues',
66
+ aliases: ['issue', 'tickets', 'issue-ticket', 'bugs']
67
+ },
68
+ crm: {
69
+ title: 'CRM',
70
+ aliases: ['deals', 'pipeline', 'contacts']
71
+ },
72
+ calendar: {
73
+ title: 'Calendar',
74
+ aliases: ['schedule']
75
+ },
76
+ workflows: {
77
+ title: 'Workflows',
78
+ slug: 'workflow',
79
+ aliases: ['workflow', 'automations']
80
+ },
81
+ github: {
82
+ title: 'GitHub',
83
+ aliases: ['repos', 'pull-requests']
84
+ },
85
+ inbox: {
86
+ title: 'Inbox',
87
+ aliases: ['email', 'mail']
88
+ },
89
+ expenses: {
90
+ title: 'Expenses',
91
+ aliases: ['expense', 'spend']
92
+ },
93
+ 'cards-wallet': {
94
+ title: 'Cards & Wallet',
95
+ aliases: ['cards', 'card', 'wallet', 'credit-card', 'credit-cards', 'virtual-card', 'ai-cards']
96
+ },
97
+ vault: {
98
+ title: 'Vault',
99
+ aliases: ['passwords', 'logins', 'saved-logins', 'password-manager', 'autofill']
100
+ },
101
+ meetings: {
102
+ title: 'Meetings',
103
+ aliases: ['meeting']
104
+ },
105
+ 'social-events': {
106
+ title: 'Events',
107
+ aliases: ['events', 'live-events', 'concerts']
108
+ },
109
+ travel: {
110
+ title: 'Travel',
111
+ aliases: ['trips', 'flights']
112
+ },
113
+ shopping: {
114
+ title: 'Shopping',
115
+ aliases: ['shop']
116
+ },
117
+ design: {
118
+ title: 'Design'
119
+ },
120
+ canvas: {
121
+ title: 'Canvas'
122
+ },
123
+ templates: {
124
+ title: 'Templates',
125
+ aliases: ['template', 'template-gallery']
126
+ },
127
+ notebooklm: {
128
+ title: 'Study',
129
+ aliases: ['notebook', 'study']
130
+ },
131
+ resume: {
132
+ title: 'Resume'
133
+ },
134
+ salesiq: {
135
+ title: 'SalesIQ'
136
+ },
137
+ dealdesk: {
138
+ title: 'Deal Desk',
139
+ aliases: ['deal-desk']
140
+ },
141
+ timetracker: {
142
+ title: 'Time Tracker',
143
+ aliases: ['time', 'timesheet']
144
+ },
145
+ tasks: {
146
+ title: 'Tasks',
147
+ aliases: ['task', 'my-tasks', 'reminders', 'reminder', 'todo', 'todos', 'status']
148
+ },
149
+ ads: {
150
+ title: 'Ads',
151
+ aliases: ['ad', 'ad-studio', 'advertising', 'ad-creatives']
152
+ }
153
+ };
154
+ const BY_ALIAS = new Map(Object.entries(KNOWN).flatMap(([id, surface]) => [[id, id], ...(surface.aliases ?? []).map(alias => [alias, id])]));
155
+ /** The surface a marker names, or null for one this chat does not know. */
156
+ function surfaceLink(id) {
157
+ const known = BY_ALIAS.get(id.toLowerCase());
158
+ if (!known) return null;
159
+ const surface = KNOWN[known];
160
+ return {
161
+ id: known,
162
+ title: surface.title,
163
+ host: `${surface.slug ?? known}-surface`
164
+ };
165
+ }export{PHONE_CALLS_SURFACE,surfaceLink,takeSurfaceMarkers};//# sourceMappingURL=surfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surfaces.js","sources":["../../../../src/pages/Home/chat/surfaces.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;;;AAQG;AAgBH;AACO,MAAM,mBAAmB,GAAG;AAEnC;AACA,MAAM,MAAM,GAAG,yFAAyF;AAExG;AACA,SAAS,gBAAgB,CAAC,IAAY,EAAA;QAC5B,EAAA,OAAS,CAAA,gBAAa,CAAA;MACxB,EAAA,MAAM,OAAA,EAAA;QAAE,IAAO,GAAA,IAAG,CAAA,KAAA,CAAA,EAAA,GAAA,CAAA,CAAA;MAChB,IAAA,CAAA,QAAO,CAAA,IAAK,CAAA,IAAQ,IAAG,CAAC,QAAE,CAAA,IAAA,CAAA,EAAA,OAAA,EAAA;AAChC,EAAA,MAAI,IAAI,GAAS,IAAA,CAAA,SAAU,EAAA,CAAA,WAAK,EAAS;SAAc,IAAA,CAAA,UAAG,CAAA,SAAA,CAAA,IAAA,SAAA,CAAA,UAAA,CAAA,IAAA,CAAA,GAAA,EAAA,GAAA,EAAA;;AAEnD,SAAK,0BAAkC,EAAA;AAClD,EAAC,MAAA,OAAA,GAAA,EAAA;AAED,EAAM,IAAA,KAAA,GAAA,KAA4B;MACxB,IAA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AE,UAAU;AACzC,GAAA;AACA,EAAA,QAAM,EAAE;IACR,KAAQ,EAAA,UAAS;AACjB,IAAA,OAAQ,EAAA,CAAE;AACV,GAAA;AACA,EAAA,SAAA,EAAS;AACT,IAAA,KAAA,EAAA,WAAmB;AACnB,IAAA,IAAA,EAAM,UAAS;AACf,IAAA,OAAO,EAAE,CAAA,yBAAoB;;AAE7B,EAAA,MAAA,EAAA;IACA,KAAK,EAAE,QAAO;AACd,IAAA,OAAO,EAAA,CAAA,OAAO,EAAK,eAAY;GACjC;AAEF,EAAM,KAAA,EAAA;IAEE,KAAK,EAAE,OAAU;IACjB,iBAAY,EAAO,MAAM;AAC5B,GACJ;AAUD,EAA2E,QAAA,EAAA;AAC3E,IAAM,KAAA,EAAA,UAAqB;IACvB,OAAM,EAAA,CAAA,SAAQ,EAAA,OAAa;AAC3B,GAAA;AAAY,EAAA;AACZ,IAAA,KAAA,kBAAsB;IACtB,OAAO,EAAE,QAAI,QAAY,EAAE,QAAQ,EAAA,eAAuB,cAAS,EAAA,cAAe,EAAE,UAAC;AACzF,GAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,17 @@
1
+ import { type CallRow, type CallsCardPlace } from './calls';
2
+ /** How often the log is read again while a call goes on: the surface's LIVE_REFRESH_MS. */
3
+ export declare const CALLS_REFRESH_MS = 10000;
4
+ export interface CallLogState {
5
+ /** Each card's calls (calls.ts callsByCard). */
6
+ byCard: Map<string, CallRow[]>;
7
+ /** False where no call is kept once it ends. */
8
+ kept: boolean;
9
+ /** When the log was last read; null until a read came back. */
10
+ readAt: number | null;
11
+ /** The last read failed. */
12
+ failed: boolean;
13
+ reading: boolean;
14
+ refresh: () => void;
15
+ }
16
+ export declare function useCallLog(cards: CallsCardPlace[], active: boolean): CallLogState;
17
+ //# sourceMappingURL=useCallLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCallLog.d.ts","sourceRoot":"","sources":["../../../../src/pages/Home/chat/useCallLog.ts"],"names":[],"mappings":"AAOA,OAAO,EAAyC,KAAK,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAGnG,2FAA2F;AAC3F,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC,MAAM,WAAW,YAAY;IACzB,gDAAgD;IAChD,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/B,gDAAgD;IAChD,IAAI,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,4BAA4B;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,YAAY,CAiFjF"}
@@ -0,0 +1,85 @@
1
+ import {useState,useRef,useEffect,useCallback,useMemo}from'react';import {callsByCard,watchCalls}from'./calls.js';import {readCalls}from'./callsApi.js';/**
2
+ * The calls under the chat's call cards, kept current the way the Phone Calls surface keeps its log
3
+ * (its useCallLog): read when a card shows up or its turn ends, again every 10 seconds while a call
4
+ * on one goes on or its turn may still place one, and when the page comes back into view. Nothing
5
+ * is read while no card is in the thread, or while the chat is hidden behind the landing.
6
+ */
7
+ /** How often the log is read again while a call goes on: the surface's LIVE_REFRESH_MS. */
8
+ const CALLS_REFRESH_MS = 10_000;
9
+ function useCallLog(cards, active) {
10
+ const [log, setLog] = useState(null);
11
+ const [readAt, setReadAt] = useState(null);
12
+ const [failed, setFailed] = useState(false);
13
+ const [reading, setReading] = useState(false);
14
+ const inFlight = useRef(false);
15
+ // A read asked for while one was out goes once that one is back, so it sees what changed since.
16
+ const again = useRef(false);
17
+ // Set on every mount: StrictMode mounts twice, and a read that comes back after the first
18
+ // unmount still belongs to the second.
19
+ const mounted = useRef(false);
20
+ useEffect(() => {
21
+ mounted.current = true;
22
+ return () => {
23
+ mounted.current = false;
24
+ };
25
+ }, []);
26
+ const refresh = useCallback(function read() {
27
+ if (inFlight.current) {
28
+ again.current = true;
29
+ return;
30
+ }
31
+ inFlight.current = true;
32
+ again.current = false;
33
+ setReading(true);
34
+ readCalls().then(next => {
35
+ if (!mounted.current) return;
36
+ setLog(next);
37
+ setFailed(false);
38
+ setReadAt(Date.now());
39
+ }).catch(() => {
40
+ if (mounted.current) setFailed(true);
41
+ }).finally(() => {
42
+ inFlight.current = false;
43
+ if (!mounted.current) return;
44
+ setReading(false);
45
+ if (again.current) read();
46
+ });
47
+ }, []);
48
+ const enabled = active && cards.length > 0;
49
+ const byCard = useMemo(() => callsByCard(cards, log?.calls ?? []), [cards, log]);
50
+ const now = Date.now();
51
+ const watching = enabled && watchCalls(cards, byCard, now);
52
+ // A card comes into the thread, its turn ends (its last calls may have gone out after the last
53
+ // read), or the chat is back on screen: read now.
54
+ const cardsKey = cards.map(card => card.openUntil > now ? `${card.message}+` : card.message).join(' ');
55
+ useEffect(() => {
56
+ if (enabled) refresh();
57
+ }, [enabled, cardsKey, refresh]);
58
+ // A call going on, or a turn that may place one: read again every so often, while anyone looks.
59
+ useEffect(() => {
60
+ if (!watching) return undefined;
61
+ const timer = window.setInterval(() => {
62
+ if (document.visibilityState !== 'hidden') refresh();
63
+ }, CALLS_REFRESH_MS);
64
+ return () => window.clearInterval(timer);
65
+ }, [watching, refresh]);
66
+ // Back on the page after a while away: what happened meanwhile.
67
+ useEffect(() => {
68
+ if (!enabled) return undefined;
69
+ const onVisible = () => {
70
+ if (document.visibilityState === 'visible') refresh();
71
+ };
72
+ document.addEventListener('visibilitychange', onVisible);
73
+ return () => document.removeEventListener('visibilitychange', onVisible);
74
+ }, [enabled, refresh]);
75
+ const kept = log?.kept ?? true;
76
+ // The same object until something in it changes: the chat draws every reply's extras from it.
77
+ return useMemo(() => ({
78
+ byCard,
79
+ kept,
80
+ readAt,
81
+ failed,
82
+ reading,
83
+ refresh
84
+ }), [byCard, kept, readAt, failed, reading, refresh]);
85
+ }export{CALLS_REFRESH_MS,useCallLog};//# sourceMappingURL=useCallLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCallLog.js","sources":["../../../../src/pages/Home/chat/useCallLog.ts"],"sourcesContent":[null],"names":[],"mappings":"wJAAA;;;;;AAKG;AAKH;AACO,MAAM,gBAAgB,GAAG;AAehB,SAAA,UAAU,CAAC,KAAuB,EAAE,MAAe,EAAA;QACzD,CAAA,GAAI,EAAA,MAAQ,CAAA,WAAY,CAAA,IAAqB,CAAA;QAC7C,CAAA,MAAO,EAAA,SAAW,CAAA,WAAY,CAAA,IAAoB,CAAA;QAClD,CAAA,MAAO,EAAA,SAAW,CAAA,WAAY,CAAA,KAAM,CAAA;QACpC,CAAA,OAAQ,EAAA,UAAY,CAAA,WAAY,CAAA,KAAM,CAAA;AAC5C,EAAA,MAAA,WAAiB,MAAA,CAAA,KAAO,CAAA;;AAExB,EAAA,MAAA,QAAc,MAAA,CAAA,KAAO,CAAA;;;AAGrB,EAAA,MAAA,UAAgB,MAAA,CAAA,KAAO,CAAA;WACd,CAAA,MAAM;AACX,IAAA,OAAA,CAAA,OAAQ,GAAA,IAAU;AAClB,IAAA,OAAA;AACI,MAAA,OAAA,CAAA,OAAQ,GAAA,KAAU;AACtB,KAAA;KACH,EAAE,CAAE;AAEL,EAAA,MAAA,OAAa,GAAA,WAAc,CAAA,aAAc,GAAA;AACrC,IAAA,IAAA,QAAY,CAAA,OAAQ,EAAA;AAChB,MAAA,KAAA,CAAA,OAAM,GAAA,IAAU;;;AAGpB,IAAA,QAAA,CAAA,OAAS,GAAA,IAAU;AACnB,IAAA,KAAA,CAAA,OAAM,GAAA,KAAU;cACN,CAAA,IAAC,CAAI;AACf,IAAA,SAAA,EAAA,CAAA,IAAW,CAAA,IAAA,IAAA;AACN,MAAA,IAAA,CAAA,OAAK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AAA,MAAU,CAAA,aAAA,CAAA,KAAA,CAAA;KAC1B,CAAA,QAAU,EAAA,SAAU;;WAGZ,CAAA,MAAM;AACX,IAAA,IAAA,CAAA,OAAa,EAAA,OAAA,SAAA;AAAE,IAAA,MAAA,SAAO,SAAS;AAC/B,MAAA,IAAA,SAAW,eAAqB,KAAA,SAAM,EAAA,OAAA,EAAA;AAClC,KAAA;AAA2C,IAAA,QAAA,CAAA,gBAAU,CAAA,kBAAA,EAAA,SAAA,CAAA;WACtD,MAAgB,QAAA,CAAA,mBAAE,CAAA,kBAAA,EAAA,SAAA,CAAA;aACd,EAAA,OAAM,CAAA,CAAA;AACjB,EAAA,MAAI,IAAA,GAAA,GAAU,EAAO,IAAA,IAAG,IAAA;;SAGf,QAAI,OAAE;AACX,IAAA,MAAA;AAAc,IAAA,IAAA;UACR;AACF,IAAA,MAAA;AAA4C,IAAA,OAAA;AAChD,IAAA;AACA,GAAA,CAAA,EAAA,CAAA,MAAA,EAAA,IAAyB,EAAA,MAAA,EAAA,wBAAqB,CAAA,CAAA;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/clock-tik-browser",
3
- "version": "12.0.34",
3
+ "version": "12.0.35-alpha.0",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -31,7 +31,7 @@
31
31
  "openai": "^4.52.0"
32
32
  },
33
33
  "devDependencies": {
34
- "common": "12.0.29"
34
+ "common": "12.0.29-alpha.1"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@common-stack/client-react": "9.2.1-alpha.1",
@@ -72,5 +72,5 @@
72
72
  "typescript": {
73
73
  "definition": "lib/index.d.ts"
74
74
  },
75
- "gitHead": "d31989593147109643e7bb2228e26457eca7b994"
75
+ "gitHead": "04618fabc8d6a6916ada4592da69d417e47b0824"
76
76
  }