-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-handoff.html
More file actions
1091 lines (983 loc) · 33.7 KB
/
test-handoff.html
File metadata and controls
1091 lines (983 loc) · 33.7 KB
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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noindex, nofollow">
<title>VCC Handoff Test — PlausibleBA</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--ink: #0f0f0f;
--ink-2: #3a3a3a;
--ink-3: #6b6b6b;
--ink-4: #a0a0a0;
--surface: #ffffff;
--surface-2: #f7f6f3;
--surface-3: #eeede9;
--border: #e2e1dc;
--border-strong: #c8c7c0;
--radius: 8px;
--radius-lg: 12px;
--green: #1D9E75;
--green-light: #E1F5EE;
--green-text: #085041;
--red: #dc2626;
--red-light: #fef2f2;
--amber: #d97706;
--amber-light: #fffbeb;
--blue: #378ADD;
--blue-light: #E6F1FB;
--blue-text: #0C447C;
--purple: #7F77DD;
--purple-light: #F0EEFB;
--purple-text: #3D3580;
}
body {
font-family: 'DM Sans', -apple-system, sans-serif;
background: var(--surface-2);
color: var(--ink);
min-height: 100vh;
}
/* ── NAV ── */
.test-nav {
position: sticky; top: 0; z-index: 100;
background: rgba(247,246,243,0.92);
backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border);
padding: 0 2rem;
display: flex; align-items: center; justify-content: space-between;
height: 52px;
}
.test-nav-brand { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); text-decoration: none; }
.test-nav-right { display: flex; align-items: center; gap: 16px; }
.test-nav-right a { font-size: 12px; color: var(--ink-3); text-decoration: none; }
.test-nav-right a:hover { color: var(--ink); }
/* ── LAYOUT ── */
.page-content {
max-width: 800px;
margin: 0 auto;
padding: 2.5rem 1.5rem 4rem;
}
/* ── HEADER ── */
.page-header {
text-align: center;
margin-bottom: 3rem;
}
.test-badge {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 11px;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--amber);
background: var(--amber-light);
border: 1px solid #fde68a;
padding: 4px 12px;
border-radius: 20px;
margin-bottom: 1.25rem;
}
h1 {
font-size: 2rem;
font-weight: 300;
margin-bottom: 0.5rem;
line-height: 1.2;
}
h1 strong { font-weight: 600; }
.page-subtitle {
font-size: 14px;
color: var(--ink-3);
max-width: 560px;
margin: 0 auto;
line-height: 1.6;
}
/* ── SECTION HEADERS ── */
.section-label {
font-size: 11px;
font-weight: 600;
letter-spacing: 0.08em;
text-transform: uppercase;
color: var(--ink-4);
margin-bottom: 1rem;
}
/* ── FLOW DIAGRAM ── */
.flow-container {
margin-bottom: 3rem;
}
.flow-steps {
display: flex;
flex-direction: column;
gap: 0;
}
.flow-step {
display: flex;
gap: 20px;
position: relative;
}
.flow-rail {
display: flex;
flex-direction: column;
align-items: center;
width: 40px;
flex-shrink: 0;
}
.flow-dot {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 16px;
flex-shrink: 0;
position: relative;
z-index: 2;
}
.flow-dot.website { background: var(--blue-light); }
.flow-dot.transition { background: var(--purple-light); }
.flow-dot.vcc { background: var(--green-light); }
.flow-line {
width: 2px;
flex: 1;
min-height: 16px;
}
.flow-line.website { background: linear-gradient(to bottom, #b8d8f5, #b8d8f5); }
.flow-line.transition { background: linear-gradient(to bottom, #b8d8f5, #c5c1f0); }
.flow-line.vcc { background: linear-gradient(to bottom, #c5c1f0, #a8e6cf); }
.flow-line.vcc-cont { background: linear-gradient(to bottom, #a8e6cf, #a8e6cf); }
.flow-body {
flex: 1;
padding-bottom: 24px;
}
.flow-title {
font-size: 15px;
font-weight: 600;
color: var(--ink);
margin-bottom: 4px;
margin-top: 8px;
}
.flow-desc {
font-size: 13px;
color: var(--ink-3);
line-height: 1.6;
}
.flow-detail {
margin-top: 10px;
padding: 12px 16px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
font-size: 12px;
color: var(--ink-2);
line-height: 1.6;
}
.flow-detail code {
font-family: 'DM Mono', monospace;
font-size: 11px;
background: var(--surface-3);
padding: 1px 5px;
border-radius: 4px;
}
.flow-location {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 10px;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
padding: 2px 8px;
border-radius: 4px;
margin-bottom: 4px;
}
.flow-location.website { background: var(--blue-light); color: var(--blue-text); }
.flow-location.vcc { background: var(--green-light); color: var(--green-text); }
.flow-location.api { background: var(--purple-light); color: var(--purple-text); }
.flow-branch {
margin-top: 12px;
display: flex;
gap: 12px;
}
.flow-branch-option {
flex: 1;
padding: 12px;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--surface);
}
.flow-branch-option h4 {
font-size: 12px;
font-weight: 600;
margin-bottom: 4px;
}
.flow-branch-option p {
font-size: 11px;
color: var(--ink-3);
line-height: 1.5;
}
.flow-branch-label {
font-size: 10px;
font-weight: 600;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--ink-4);
margin-bottom: 8px;
}
/* ── CARDS ── */
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
padding: 2rem;
margin-bottom: 1.5rem;
}
.card h2 {
font-size: 14px;
font-weight: 600;
margin-bottom: 1.25rem;
display: flex;
align-items: center;
gap: 8px;
}
.step-num {
display: inline-flex;
align-items: center;
justify-content: center;
width: 22px;
height: 22px;
border-radius: 50%;
background: var(--ink);
color: #fff;
font-size: 11px;
font-weight: 600;
}
/* ── FORMS ── */
.field-row {
display: flex;
gap: 12px;
margin-bottom: 12px;
}
.field-row .field { flex: 1; }
label {
display: block;
font-size: 12px;
font-weight: 500;
color: var(--ink-3);
margin-bottom: 4px;
}
input[type="text"], input[type="email"], select, textarea {
width: 100%;
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 8px 12px;
font-family: inherit;
font-size: 13px;
color: var(--ink);
background: var(--surface);
transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: var(--ink-4);
}
textarea { resize: vertical; min-height: 60px; }
/* ── BUTTONS ── */
.btn-primary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
font-family: inherit;
font-size: 14px;
font-weight: 600;
background: var(--ink);
color: #fff;
border: none;
padding: 10px 24px;
border-radius: var(--radius);
cursor: pointer;
transition: opacity 0.15s;
width: 100%;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-secondary {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 6px;
font-family: inherit;
font-size: 12px;
font-weight: 500;
background: none;
color: var(--ink-3);
border: 1px solid var(--border);
padding: 6px 14px;
border-radius: var(--radius);
cursor: pointer;
transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--ink-4); color: var(--ink); }
.actions { display: flex; gap: 10px; margin-top: 16px; }
/* ── LOG ── */
.log {
font-family: 'DM Mono', monospace;
font-size: 12px;
background: #1a1a1a;
color: #a8e6a0;
border-radius: var(--radius);
padding: 16px;
max-height: 300px;
overflow-y: auto;
white-space: pre-wrap;
word-break: break-all;
}
.log .error { color: #fca5a5; }
.log .info { color: #93c5fd; }
.log .success { color: #86efac; }
.log .dim { color: #666; }
/* ── OVERRIDES ── */
.override-row {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.override-row label {
font-size: 11px;
color: var(--ink-4);
margin-bottom: 4px;
}
/* ── EDGE CASES TABLE ── */
.edge-cases {
width: 100%;
border-collapse: collapse;
font-size: 12px;
}
.edge-cases th {
text-align: left;
font-weight: 600;
color: var(--ink-2);
padding: 8px 12px;
border-bottom: 2px solid var(--border);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.edge-cases td {
padding: 10px 12px;
border-bottom: 1px solid var(--border);
vertical-align: top;
color: var(--ink-2);
line-height: 1.5;
}
.edge-cases tr:last-child td { border-bottom: none; }
.edge-cases .scenario { font-weight: 500; color: var(--ink); }
.pill {
display: inline-flex;
align-items: center;
font-size: 10px;
font-weight: 600;
padding: 2px 8px;
border-radius: 10px;
white-space: nowrap;
}
.pill.graceful { background: var(--green-light); color: var(--green-text); }
.pill.silent { background: var(--blue-light); color: var(--blue-text); }
.pill.fallback { background: var(--amber-light); color: var(--amber); }
</style>
</head>
<body>
<!-- Nav -->
<nav class="test-nav">
<a class="test-nav-brand" href="/"><img src="/logo-icon.svg" alt="PlausibleBA" width="35" height="30" style="margin-right:8px;vertical-align:middle;"><span>PlausibleBA</span></a>
<div class="test-nav-right">
<a href="/canvas">Canvas</a>
<a href="#flow">UX Flow</a>
<a href="#test">Test Harness</a>
<a href="#edge-cases">Edge Cases</a>
</div>
</nav>
<div class="nav-mobile" id="nav-mobile">
<a href="/">Home</a>
<a href="/skills">Skills</a>
<a href="/methodology">Methodology</a>
<a href="/install">Install</a>
<a href="/canvas">Canvas</a>
<a href="/vcc">VCC</a>
<a href="/case-study">Case study</a>
<a href="/about">About</a>
<a href="/contact">Contact</a>
<a href="/canvas" class="nav-cta-mobile">Try it free →</a>
</div>
<script>
var btn = document.getElementById('nav-hamburger');
var menu = document.getElementById('nav-mobile');
if (btn && menu) {
btn.addEventListener('click', function() {
btn.classList.toggle('open');
menu.classList.toggle('open');
});
}
</script>
<div class="page-content">
<!-- Header -->
<div class="page-header">
<div class="test-badge">⚠ Internal test page — not indexed</div>
<h1>Canvas → VCC <strong>Handoff</strong></h1>
<p class="page-subtitle">
The complete user experience from generating an operating model on Canvas
through to landing inside VCC with it loaded as a project.
</p>
</div>
<!-- ═══ SECTION: UX FLOW ═══ -->
<div class="flow-container" id="flow">
<div class="section-label">User journey</div>
<div class="flow-steps">
<!-- Step 1: Canvas intake -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot website">📝</div>
<div class="flow-line website"></div>
</div>
<div class="flow-body">
<div class="flow-location website">plausibleba.com/canvas</div>
<div class="flow-title">User arrives at Canvas</div>
<div class="flow-desc">
They land on the Canvas intake page. They can paste meeting notes, upload a transcript
(Word, PDF, Excel), or click "Load the PortfolioProp demo" to try it with sample data.
They enter their name and email to pass the email gate.
</div>
</div>
</div>
<!-- Step 2: Generation -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot website">⚡</div>
<div class="flow-line website"></div>
</div>
<div class="flow-body">
<div class="flow-location website">plausibleba.com/canvas</div>
<div class="flow-title">AI generates the operating model</div>
<div class="flow-desc">
The LLM pipeline builds a BIZBOK-grounded operating model: capability map,
concept model, value streams, and metrics. The model renders as an interactive
preview with tabs for each element type. Users can explore, browse tabs.
</div>
<div class="flow-detail">
Rate limit: 3 free generations per email. After 3, they see
"You've used all 3 free generations. Open in VCC for unlimited access."
</div>
</div>
</div>
<!-- Step 3: CTA -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot website">👉</div>
<div class="flow-line transition"></div>
</div>
<div class="flow-body">
<div class="flow-location website">plausibleba.com/canvas</div>
<div class="flow-title">User clicks "Open in VCC →"</div>
<div class="flow-desc">
Below the rendered model, a CTA banner reads:
<em>"Turn this into an interactive workshopping canvas."</em>
The user clicks "Open in VCC →". The button shows "Preparing…"
for about a second.
</div>
<div class="flow-detail">
Behind the scenes: the full bundle JSON is POSTed to <code>/api/claim-bundle</code>
along with the user's email, first and last name (captured during the email gate).
The API stores it in Vercel KV with a 24-hour TTL and returns a claim token
like <code>bndl_a8f3x9k2m7pq</code>.
</div>
</div>
</div>
<!-- Step 4: Redirect -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot transition">🚀</div>
<div class="flow-line vcc"></div>
</div>
<div class="flow-body">
<div class="flow-location api">Redirect</div>
<div class="flow-title">Redirect to VCC with claim token</div>
<div class="flow-desc">
The browser redirects to VCC with the claim token and pre-fill data in the URL.
</div>
<div class="flow-detail">
URL: <code>https://app.plausibleba.com/?claim=bndl_xxx&email=...&firstName=...&lastName=...</code><br><br>
On arrival, VCC's <code>extractClaimFromURL()</code> runs immediately:
stashes the token in <code>sessionStorage</code> (so it survives the auth redirect),
saves the pre-fill data, and cleans the URL via <code>history.replaceState</code>.
</div>
</div>
</div>
<!-- Step 5: Auth (branching) -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot vcc">🔒</div>
<div class="flow-line vcc-cont"></div>
</div>
<div class="flow-body">
<div class="flow-location vcc">VCC App</div>
<div class="flow-title">Authentication</div>
<div class="flow-desc">
What happens next depends on whether the user already has a VCC session.
</div>
<div class="flow-branch">
<div class="flow-branch-option">
<div class="flow-branch-label">Path A — New user</div>
<h4>Login page with context</h4>
<p>
They see the VCC login page, but it's customised for the handoff:<br><br>
• Green banner: "Your operating model is ready to import"<br>
• Subtitle: "Sign in to open your operating model"<br>
• Email field pre-filled from the Canvas session<br>
• Button reads "Sign in & import model"<br><br>
They sign in with Google or request a magic link. After auth completes,
the flow continues automatically.
</p>
</div>
<div class="flow-branch-option">
<div class="flow-branch-label">Path B — Existing session</div>
<h4>Skips login entirely</h4>
<p>
If the user is already signed in to VCC (e.g. in another tab, or a
persistent session), the login page never appears. The claim consumer
fires immediately after auth state is confirmed.
</p>
</div>
</div>
</div>
</div>
<!-- Step 6: Import -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot vcc">📦</div>
<div class="flow-line vcc-cont"></div>
</div>
<div class="flow-body">
<div class="flow-location vcc">VCC App</div>
<div class="flow-title">Bundle auto-imports</div>
<div class="flow-desc">
A spinner screen appears: "Importing your operating model… This will
only take a moment." Behind the scenes:
</div>
<div class="flow-detail">
1. Read claim token from <code>sessionStorage</code><br>
2. Fetch bundle from <code>plausibleba.com/api/claim-bundle?token=bndl_xxx</code><br>
3. Token is consumed (one-time use — deleted on retrieval)<br>
4. Bundle is normalised (PlausibleBA format → VCC internal scaffold)<br>
5. Scaffold loaded into the canvas store<br>
6. <code>autoSaveToProject()</code> creates a Supabase project automatically
</div>
</div>
</div>
<!-- Step 7: Landing -->
<div class="flow-step">
<div class="flow-rail">
<div class="flow-dot vcc">✔️</div>
<div class="flow-line" style="background:transparent;"></div>
</div>
<div class="flow-body">
<div class="flow-location vcc">VCC App</div>
<div class="flow-title">User lands on Network view</div>
<div class="flow-desc">
The spinner clears and the user is looking at their operating model inside VCC —
the Network view showing value streams, capabilities, and concepts.
A project has been created automatically in their account.
They can now navigate to Stream, Capabilities, Concepts, Friction, and start workshopping.
</div>
<div class="flow-detail">
<strong>What the user never had to do:</strong> download a JSON file, find an import button,
navigate to the right screen, or re-enter any information. The bundle survived the
entire auth flow without them touching it.
</div>
</div>
</div>
</div>
</div>
<!-- ═══ SECTION: EDGE CASES ═══ -->
<div id="edge-cases" style="margin-bottom: 3rem;">
<div class="section-label">Edge cases & failure modes</div>
<div class="card" style="padding: 0; overflow: hidden;">
<table class="edge-cases">
<thead>
<tr>
<th style="width:30%">Scenario</th>
<th style="width:15%">Handling</th>
<th>What the user sees</th>
</tr>
</thead>
<tbody>
<tr>
<td class="scenario">Token expired (24h+)</td>
<td><span class="pill silent">Silent</span></td>
<td>Normal login/project list. No error. They can go back to Canvas and click "Open in VCC" again, or use Import Bundle.</td>
</tr>
<tr>
<td class="scenario">Token already claimed</td>
<td><span class="pill silent">Silent</span></td>
<td>Same as expired — claim API returns 404, consumer clears state, user sees normal VCC.</td>
</tr>
<tr>
<td class="scenario">Claim API unreachable</td>
<td><span class="pill graceful">Graceful</span></td>
<td>Console logs error. User lands on normal project list. No visible error — they can still import manually.</td>
</tr>
<tr>
<td class="scenario">Bookmarked claim URL</td>
<td><span class="pill silent">Silent</span></td>
<td>Token consumed on first visit. Bookmark loads normal VCC with no claim params.</td>
</tr>
<tr>
<td class="scenario">Unrecognised bundle format</td>
<td><span class="pill graceful">Graceful</span></td>
<td>Console warning. Import skipped silently. User sees project list.</td>
</tr>
<tr>
<td class="scenario">User clicks "Open in VCC" with no bundle</td>
<td><span class="pill fallback">Fallback</span></td>
<td>Alert: "No bundle to open. Generate or upload a model first."</td>
</tr>
<tr>
<td class="scenario">Claim API POST fails (Canvas side)</td>
<td><span class="pill fallback">Fallback</span></td>
<td>Alert: "Could not connect to VCC. You can download the bundle and import it manually." Button resets.</td>
</tr>
<tr>
<td class="scenario">Local dev mode (no Supabase)</td>
<td><span class="pill silent">Silent</span></td>
<td>Claim consumer skipped entirely (<code>isLocalMode</code> guard). Normal local VCC experience.</td>
</tr>
<tr>
<td class="scenario">User closes tab mid-auth</td>
<td><span class="pill graceful">Graceful</span></td>
<td>Token stays in <code>sessionStorage</code> (tab-scoped). If they re-open VCC from the magic link email, <code>sessionStorage</code> is empty — normal login. They can re-click "Open in VCC" from Canvas.</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- ═══ SECTION: TEST HARNESS ═══ -->
<div id="test">
<div class="section-label">Test harness</div>
<!-- Configure -->
<div class="card">
<h2><span class="step-num">1</span> Configure test data</h2>
<div class="field-row">
<div class="field">
<label>First name</label>
<input type="text" id="firstName" value="Terry" />
</div>
<div class="field">
<label>Last name</label>
<input type="text" id="lastName" value="Roach" />
</div>
</div>
<div class="field-row">
<div class="field">
<label>Email</label>
<input type="email" id="email" value="terry.roach@mac.com" />
</div>
</div>
<div class="field-row">
<div class="field">
<label>Bundle source</label>
<select id="bundleSource">
<option value="mock">Mock bundle (small, fast)</option>
<option value="demo-portfolioprop">Demo: PortfolioProp (from GitHub)</option>
<option value="custom">Custom JSON (paste below)</option>
</select>
</div>
</div>
<div id="custom-json-area" style="display:none; margin-top:8px;">
<label>Paste bundle JSON</label>
<textarea id="customJson" rows="4" placeholder='{"name":"My Model","elements":{...}}'></textarea>
</div>
<div class="override-row">
<label>VCC target URL (override for local dev)</label>
<input type="text" id="vccUrl" placeholder="https://app.plausibleba.com (default)" />
</div>
</div>
<!-- Run -->
<div class="card">
<h2><span class="step-num">2</span> Run handoff test</h2>
<div class="actions" style="margin-top:0">
<button class="btn-primary" id="run-test-btn" onclick="runTest()">
Claim bundle & redirect to VCC →
</button>
</div>
<div class="actions">
<button class="btn-secondary" onclick="testApiOnly()">
Test claim API only (no redirect)
</button>
<button class="btn-secondary" onclick="testRoundtrip()">
Test full roundtrip (store & retrieve)
</button>
</div>
</div>
<!-- Log -->
<div class="card">
<h2><span class="step-num">3</span> Test log</h2>
<div class="log" id="log"><span class="dim">Ready. Click a test button above to begin.</span></div>
</div>
</div>
</div>
<script>
// ── Bundle source toggle ──
document.getElementById('bundleSource').addEventListener('change', (e) => {
document.getElementById('custom-json-area').style.display =
e.target.value === 'custom' ? 'block' : 'none';
});
// ── Logging ──
const logEl = document.getElementById('log');
let logStarted = false;
function log(msg, cls = '') {
if (!logStarted) {
logEl.innerHTML = '';
logStarted = true;
}
const ts = new Date().toLocaleTimeString('en-US', { hour12: false, hour: '2-digit', minute: '2-digit', second: '2-digit' });
const line = document.createElement('div');
line.className = cls;
line.textContent = `[${ts}] ${msg}`;
logEl.appendChild(line);
logEl.scrollTop = logEl.scrollHeight;
}
// ── Mock bundle ──
function getMockBundle() {
return {
meta: {
bundleVersion: "1.0.0",
scaffoldId: "test_handoff_" + Date.now(),
generatedAt: new Date().toISOString(),
source: "handoff-test"
},
scaffoldId: "test_handoff_" + Date.now(),
name: "Test Handoff Model",
description: "A minimal operating model for testing the Canvas-to-VCC handoff flow.",
elements: {
capabilities: {
"cap_area_ops": {
id: "cap_area_ops", elementType: "Capability", name: "Operations",
level: 1, parentId: null, type: "Execution"
},
"cap_order_mgmt": {
id: "cap_order_mgmt", elementType: "Capability", name: "Order Management",
level: 2, parentId: "cap_area_ops"
},
"cap_order_capture": {
id: "cap_order_capture", elementType: "Capability", name: "Order Capture",
level: 3, parentId: "cap_order_mgmt"
},
"cap_order_fulfil": {
id: "cap_order_fulfil", elementType: "Capability", name: "Order Fulfilment",
level: 3, parentId: "cap_order_mgmt"
}
},
concepts: {
"obj_customer": {
id: "obj_customer", elementType: "BusinessObject", name: "Customer",
type: "Party", definition: "A person or organisation that purchases goods.",
lifecycleStates: ["Prospect", "Active", "Churned"],
relatedObjects: []
},
"obj_order": {
id: "obj_order", elementType: "BusinessObject", name: "Order",
type: "Record", definition: "A request to purchase goods or services.",
lifecycleStates: ["Draft", "Submitted", "Fulfilled", "Cancelled"],
relatedObjects: [{ objectId: "obj_customer", relationship: "association", label: "placed by" }]
}
},
valueStreams: {
"vs_order_to_cash": {
id: "vs_order_to_cash", elementType: "ValueStream", name: "Order to Cash",
description: "From order placement to payment receipt",
trigger: "Customer places order",
recipient: "Finance",
valueObject: "obj_order",
stageIds: ["stg_capture", "stg_fulfil", "stg_invoice"]
}
},
valueStreamStages: {
"stg_capture": {
id: "stg_capture", elementType: "ValueStreamStage", name: "Capture Order",
capabilities: ["cap_order_capture"], objects: ["obj_customer", "obj_order"],
entryCriteria: "Customer submits order", exitCriteria: "Order validated",
valueObjectState: "Submitted"
},
"stg_fulfil": {
id: "stg_fulfil", elementType: "ValueStreamStage", name: "Fulfil Order",
capabilities: ["cap_order_fulfil"], objects: ["obj_order"],
entryCriteria: "Order validated", exitCriteria: "Goods shipped",
valueObjectState: "Fulfilled"
},
"stg_invoice": {
id: "stg_invoice", elementType: "ValueStreamStage", name: "Invoice & Collect",
capabilities: [], objects: ["obj_order"],
entryCriteria: "Goods shipped", exitCriteria: "Payment received",
valueObjectState: "Closed"
}
},
metrics: {
"met_cycle_time": {
id: "met_cycle_time", elementType: "Metric", name: "Order Cycle Time",
unit: "days", direction: "down"
}
},
controls: {},
constraints: {},
roles: {},
outcomes: {}
}
};
}
// ── Get bundle based on selection ──
async function getBundle() {
const source = document.getElementById('bundleSource').value;
if (source === 'mock') {
return getMockBundle();
}
if (source === 'demo-portfolioprop') {
log('Fetching PortfolioProp demo bundle from GitHub...', 'info');
const res = await fetch('https://raw.githubusercontent.com/plausibleba/ba-skills/main/examples/portfolioprop_ba-skills-bundle_v1.json');
if (!res.ok) throw new Error('Failed to fetch demo bundle');
return await res.json();
}
if (source === 'custom') {
const raw = document.getElementById('customJson').value.trim();
if (!raw) throw new Error('Please paste a JSON bundle');
return JSON.parse(raw);
}
throw new Error('Unknown bundle source');
}
// ── Get VCC URL ──
function getVccUrl() {
const override = document.getElementById('vccUrl').value.trim();
return override || 'https://app.plausibleba.com';
}
// ── Test: Full flow (claim + redirect) ──
async function runTest() {
const btn = document.getElementById('run-test-btn');
btn.disabled = true;
btn.textContent = 'Claiming bundle\u2026';
try {
const bundle = await getBundle();
const email = document.getElementById('email').value;
const firstName = document.getElementById('firstName').value;
const lastName = document.getElementById('lastName').value;
log('Bundle loaded: ' + (bundle.name || 'unnamed') + ' (' + JSON.stringify(bundle).length + ' bytes)');
log('Posting to /api/claim-bundle...', 'info');
const res = await fetch('/api/claim-bundle', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ bundle, email, firstName, lastName }),
});
if (!res.ok) {
const err = await res.text();
throw new Error('API returned ' + res.status + ': ' + err);
}
const { token } = await res.json();
log('Claim token: ' + token, 'success');
const vccUrl = getVccUrl();
const params = new URLSearchParams({ claim: token });
if (email) params.set('email', email);
if (firstName) params.set('firstName', firstName);
if (lastName) params.set('lastName', lastName);
const redirectUrl = vccUrl + '?' + params.toString();
log('Redirecting to: ' + redirectUrl, 'info');
log('--- Redirect in 2 seconds (check log above) ---', 'success');
setTimeout(() => {
window.location.href = redirectUrl;
}, 2000);
} catch (err) {
log('ERROR: ' + err.message, 'error');
btn.disabled = false;
btn.textContent = 'Claim bundle & redirect to VCC \u2192';
}
}
// ── Test: API only (no redirect) ──
async function testApiOnly() {
try {
const bundle = await getBundle();
const email = document.getElementById('email').value;
const firstName = document.getElementById('firstName').value;
const lastName = document.getElementById('lastName').value;
log('--- API-only test ---', 'info');
log('Bundle: ' + (bundle.name || 'unnamed') + ' (' + JSON.stringify(bundle).length + ' bytes)');