@almadar/std 14.29.4 → 14.30.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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "std-multi-party-flow",
3
- "version": "1.0.0",
4
- "description": "std-multi-party-flow — generic N-party transactional state machine (escrow, signing, multi-stakeholder approval). `config.parties` is an array of party definitions; @entity.currentPartyIndex walks through them; PARTY_CONFIRM self-loops, FINALIZE moves to funded, RELEASE/DISPUTE/CANCEL terminate. Topology = loading / awaiting / funded / released / disputed / cancelled / error — the awaiting state owns N via data, not states.",
3
+ "version": "3.0.1",
4
+ "description": "std-multi-party-flow — Escrow.com / DocuSign / Stripe Connect style multi-party transaction. Header + summary (subject/amount/reference) + named parties (avatar/role/actor) + stage progress + your-turn panel + activity feed + dispute/cancel escape hatches. Topology = loading / awaiting / capturing_dispute / capturing_cancel / funded / released / disputed / cancelled / error.",
5
5
  "orbitals": [
6
6
  {
7
7
  "name": "MultiPartyFlowOrbital",
@@ -21,20 +21,16 @@
21
21
  "items": {
22
22
  "type": "object",
23
23
  "properties": {
24
- "actionIcon": {
25
- "name": "actionIcon",
26
- "type": "string"
27
- },
28
- "key": {
29
- "name": "key",
24
+ "actionLabel": {
25
+ "name": "actionLabel",
30
26
  "type": "string"
31
27
  },
32
- "label": {
33
- "name": "label",
28
+ "actionIcon": {
29
+ "name": "actionIcon",
34
30
  "type": "string"
35
31
  },
36
- "actionLabel": {
37
- "name": "actionLabel",
32
+ "title": {
33
+ "name": "title",
38
34
  "type": "string"
39
35
  },
40
36
  "description": {
@@ -45,14 +41,13 @@
45
41
  "name": "icon",
46
42
  "type": "string"
47
43
  },
48
- "status": {
49
- "name": "status",
50
- "type": "string",
51
- "values": [
52
- "waiting",
53
- "ready",
54
- "completed"
55
- ]
44
+ "actor": {
45
+ "name": "actor",
46
+ "type": "string"
47
+ },
48
+ "id": {
49
+ "name": "id",
50
+ "type": "string"
56
51
  }
57
52
  }
58
53
  }
@@ -67,6 +62,46 @@
67
62
  "type": "number",
68
63
  "default": 0.0
69
64
  },
65
+ {
66
+ "name": "currentPartyId",
67
+ "type": "string",
68
+ "default": ""
69
+ },
70
+ {
71
+ "name": "currentPartyTitle",
72
+ "type": "string",
73
+ "default": ""
74
+ },
75
+ {
76
+ "name": "currentPartyActor",
77
+ "type": "string",
78
+ "default": ""
79
+ },
80
+ {
81
+ "name": "currentPartyIcon",
82
+ "type": "string",
83
+ "default": "user"
84
+ },
85
+ {
86
+ "name": "currentActionLabel",
87
+ "type": "string",
88
+ "default": "Confirm"
89
+ },
90
+ {
91
+ "name": "currentActionIcon",
92
+ "type": "string",
93
+ "default": "check"
94
+ },
95
+ {
96
+ "name": "currentActionDescription",
97
+ "type": "string",
98
+ "default": ""
99
+ },
100
+ {
101
+ "name": "currentStepLabel",
102
+ "type": "string",
103
+ "default": "Step 1"
104
+ },
70
105
  {
71
106
  "name": "audit",
72
107
  "type": "array",
@@ -74,25 +109,40 @@
74
109
  "items": {
75
110
  "type": "object",
76
111
  "properties": {
77
- "timestamp": {
78
- "name": "timestamp",
112
+ "status": {
113
+ "name": "status",
114
+ "type": "string",
115
+ "values": [
116
+ "complete",
117
+ "active",
118
+ "pending",
119
+ "error"
120
+ ]
121
+ },
122
+ "title": {
123
+ "name": "title",
79
124
  "type": "string"
80
125
  },
81
126
  "id": {
82
127
  "name": "id",
83
128
  "type": "string"
84
129
  },
85
- "action": {
86
- "name": "action",
130
+ "timestamp": {
131
+ "name": "timestamp",
87
132
  "type": "string"
88
133
  },
89
- "actor": {
90
- "name": "actor",
134
+ "description": {
135
+ "name": "description",
91
136
  "type": "string"
92
137
  }
93
138
  }
94
139
  }
95
140
  },
141
+ {
142
+ "name": "reason",
143
+ "type": "string",
144
+ "default": ""
145
+ },
96
146
  {
97
147
  "name": "disputeReason",
98
148
  "type": "string",
@@ -126,29 +176,35 @@
126
176
  ]
127
177
  },
128
178
  {
129
- "event": "FINALIZE"
179
+ "event": "OPEN_DISPUTE"
130
180
  },
131
181
  {
132
- "event": "RELEASE"
182
+ "event": "CANCEL_TRANSACTION"
133
183
  },
134
184
  {
135
- "event": "OPEN_DISPUTE",
185
+ "event": "SUBMIT_DISPUTE",
136
186
  "payloadSchema": [
137
187
  {
138
- "name": "reason",
139
- "type": "string"
188
+ "name": "data",
189
+ "type": "object"
140
190
  }
141
191
  ]
142
192
  },
143
193
  {
144
- "event": "CANCEL_TRANSACTION",
194
+ "event": "SUBMIT_CANCEL",
145
195
  "payloadSchema": [
146
196
  {
147
- "name": "reason",
148
- "type": "string"
197
+ "name": "data",
198
+ "type": "object"
149
199
  }
150
200
  ]
151
201
  },
202
+ {
203
+ "event": "CANCEL_REASON"
204
+ },
205
+ {
206
+ "event": "RELEASE"
207
+ },
152
208
  {
153
209
  "event": "RESTART"
154
210
  },
@@ -184,6 +240,12 @@
184
240
  {
185
241
  "name": "awaiting"
186
242
  },
243
+ {
244
+ "name": "capturing_dispute"
245
+ },
246
+ {
247
+ "name": "capturing_cancel"
248
+ },
187
249
  {
188
250
  "name": "funded"
189
251
  },
@@ -264,26 +326,34 @@
264
326
  ]
265
327
  },
266
328
  {
267
- "key": "FINALIZE",
268
- "name": "Finalize"
329
+ "key": "OPEN_DISPUTE",
330
+ "name": "Open Dispute"
269
331
  },
270
332
  {
271
- "key": "OPEN_DISPUTE",
272
- "name": "Open Dispute",
333
+ "key": "CANCEL_TRANSACTION",
334
+ "name": "Cancel Transaction"
335
+ },
336
+ {
337
+ "key": "SUBMIT_DISPUTE",
338
+ "name": "Submit Dispute",
273
339
  "payloadSchema": [
274
340
  {
275
- "name": "reason",
276
- "type": "string"
341
+ "name": "data",
342
+ "type": "object"
277
343
  }
278
344
  ]
279
345
  },
280
346
  {
281
- "key": "CANCEL_TRANSACTION",
282
- "name": "Cancel Transaction",
347
+ "key": "CANCEL_REASON",
348
+ "name": "Cancel Reason"
349
+ },
350
+ {
351
+ "key": "SUBMIT_CANCEL",
352
+ "name": "Submit Cancel",
283
353
  "payloadSchema": [
284
354
  {
285
- "name": "reason",
286
- "type": "string"
355
+ "name": "data",
356
+ "type": "object"
287
357
  }
288
358
  ]
289
359
  },
@@ -307,8 +377,8 @@
307
377
  "MultiPartyView",
308
378
  {
309
379
  "emit": {
310
- "success": "FlowLoaded",
311
- "failure": "FlowLoadFailed"
380
+ "failure": "FlowLoadFailed",
381
+ "success": "FlowLoaded"
312
382
  }
313
383
  }
314
384
  ],
@@ -316,8 +386,8 @@
316
386
  "render-ui",
317
387
  "main",
318
388
  {
319
- "type": "loading-state",
320
- "title": "Loading transaction…"
389
+ "title": "Loading transaction…",
390
+ "type": "loading-state"
321
391
  }
322
392
  ]
323
393
  ]
@@ -356,21 +426,16 @@
356
426
  "description",
357
427
  ""
358
428
  ],
359
- "key": [
360
- "object/get",
361
- "@party",
362
- "key"
363
- ],
364
- "icon": [
429
+ "actor": [
365
430
  "object/get",
366
431
  "@party",
367
- "icon",
368
- "user"
432
+ "actor",
433
+ ""
369
434
  ],
370
- "label": [
435
+ "title": [
371
436
  "object/get",
372
437
  "@party",
373
- "label"
438
+ "title"
374
439
  ],
375
440
  "actionLabel": [
376
441
  "object/get",
@@ -378,7 +443,17 @@
378
443
  "actionLabel",
379
444
  "Confirm"
380
445
  ],
381
- "status": "ready",
446
+ "id": [
447
+ "object/get",
448
+ "@party",
449
+ "id"
450
+ ],
451
+ "icon": [
452
+ "object/get",
453
+ "@party",
454
+ "icon",
455
+ "user"
456
+ ],
382
457
  "actionIcon": [
383
458
  "object/get",
384
459
  "@party",
@@ -391,219 +466,412 @@
391
466
  ],
392
467
  [
393
468
  "set",
394
- "@entity.audit",
469
+ "@entity.currentPartyId",
395
470
  [
396
- "array/map",
397
- "@payload.data",
471
+ "object/get",
398
472
  [
399
- "fn",
400
- "row",
401
- {
402
- "action": [
403
- "object/get",
404
- "@row",
405
- "action",
406
- ""
407
- ],
408
- "timestamp": [
409
- "object/get",
410
- "@row",
411
- "createdAt",
412
- ""
413
- ],
414
- "id": [
415
- "object/get",
416
- "@row",
417
- "id",
418
- ""
419
- ],
420
- "actor": [
421
- "object/get",
422
- "@row",
423
- "actor",
424
- "system"
425
- ]
426
- }
427
- ]
473
+ "array/first",
474
+ "@config.parties"
475
+ ],
476
+ "id",
477
+ ""
478
+ ]
479
+ ],
480
+ [
481
+ "set",
482
+ "@entity.currentPartyTitle",
483
+ [
484
+ "object/get",
485
+ [
486
+ "array/first",
487
+ "@config.parties"
488
+ ],
489
+ "title",
490
+ ""
491
+ ]
492
+ ],
493
+ [
494
+ "set",
495
+ "@entity.currentPartyActor",
496
+ [
497
+ "object/get",
498
+ [
499
+ "array/first",
500
+ "@config.parties"
501
+ ],
502
+ "actor",
503
+ ""
504
+ ]
505
+ ],
506
+ [
507
+ "set",
508
+ "@entity.currentPartyIcon",
509
+ [
510
+ "object/get",
511
+ [
512
+ "array/first",
513
+ "@config.parties"
514
+ ],
515
+ "icon",
516
+ "user"
517
+ ]
518
+ ],
519
+ [
520
+ "set",
521
+ "@entity.currentActionLabel",
522
+ [
523
+ "object/get",
524
+ [
525
+ "array/first",
526
+ "@config.parties"
527
+ ],
528
+ "actionLabel",
529
+ "Confirm"
530
+ ]
531
+ ],
532
+ [
533
+ "set",
534
+ "@entity.currentActionIcon",
535
+ [
536
+ "object/get",
537
+ [
538
+ "array/first",
539
+ "@config.parties"
540
+ ],
541
+ "actionIcon",
542
+ "check"
543
+ ]
544
+ ],
545
+ [
546
+ "set",
547
+ "@entity.currentActionDescription",
548
+ [
549
+ "object/get",
550
+ [
551
+ "array/first",
552
+ "@config.parties"
553
+ ],
554
+ "actionDescription",
555
+ ""
556
+ ]
557
+ ],
558
+ [
559
+ "set",
560
+ "@entity.currentStepLabel",
561
+ [
562
+ "object/get",
563
+ [
564
+ "array/first",
565
+ "@config.parties"
566
+ ],
567
+ "stepLabel",
568
+ "Step 1"
569
+ ]
570
+ ],
571
+ [
572
+ "set",
573
+ "@entity.audit",
574
+ [
575
+ {
576
+ "title": "Transaction opened",
577
+ "status": "complete",
578
+ "timestamp": "Just now",
579
+ "description": [
580
+ "str/concat",
581
+ "Reference ",
582
+ "@config.transactionReference"
583
+ ],
584
+ "id": "init"
585
+ }
428
586
  ]
429
587
  ],
430
588
  [
431
589
  "render-ui",
432
590
  "main",
433
591
  {
592
+ "type": "stack",
593
+ "direction": "vertical",
594
+ "gap": "lg",
434
595
  "children": [
435
596
  {
436
- "gap": "sm",
437
597
  "type": "stack",
438
- "direction": "horizontal",
439
- "align": "center",
440
598
  "children": [
441
599
  {
442
- "name": "git-pull-request",
443
- "type": "icon"
600
+ "type": "icon",
601
+ "name": "git-pull-request"
444
602
  },
445
603
  {
446
604
  "content": "@config.title",
447
605
  "variant": "h3",
448
606
  "type": "typography"
607
+ },
608
+ {
609
+ "type": "badge",
610
+ "label": "Active",
611
+ "variant": "primary"
449
612
  }
450
- ]
451
- },
452
- {
453
- "type": "divider"
613
+ ],
614
+ "gap": "sm",
615
+ "align": "center",
616
+ "direction": "horizontal"
454
617
  },
455
618
  {
456
- "gap": "sm",
457
- "type": "data-list",
458
- "entity": "@entity.parties",
459
- "fields": [],
460
- "renderItem": [
461
- "fn",
462
- "party",
619
+ "type": "card",
620
+ "children": [
463
621
  {
464
- "type": "card",
622
+ "type": "stack",
623
+ "gap": "md",
624
+ "direction": "vertical",
465
625
  "children": [
466
626
  {
627
+ "type": "stack",
628
+ "gap": "lg",
467
629
  "children": [
468
630
  {
469
- "name": "@party.icon",
470
- "type": "icon"
631
+ "direction": "vertical",
632
+ "children": [
633
+ {
634
+ "variant": "caption",
635
+ "color": "muted",
636
+ "type": "typography",
637
+ "content": "Amount in escrow"
638
+ },
639
+ {
640
+ "variant": "h1",
641
+ "type": "typography",
642
+ "content": "@config.transactionAmount"
643
+ }
644
+ ],
645
+ "type": "stack",
646
+ "gap": "xs"
471
647
  },
472
648
  {
473
- "type": "stack",
649
+ "gap": "xs",
474
650
  "children": [
475
651
  {
652
+ "variant": "caption",
476
653
  "type": "typography",
477
- "content": "@party.label",
478
- "variant": "h4"
654
+ "color": "muted",
655
+ "content": "Subject"
479
656
  },
480
657
  {
481
658
  "type": "typography",
482
- "color": "muted",
483
- "variant": "caption",
484
- "content": "@party.description"
659
+ "content": "@config.transactionSubject",
660
+ "variant": "h4"
485
661
  }
486
662
  ],
487
- "gap": "xs",
663
+ "type": "stack",
488
664
  "direction": "vertical"
489
665
  },
490
666
  {
491
- "label": "@party.status",
492
- "variant": "primary",
493
- "type": "badge"
494
- },
495
- {
496
- "label": "@party.actionLabel",
497
- "actionPayload": {
498
- "partyKey": "@party.key"
499
- },
500
- "icon": "@party.actionIcon",
501
- "action": "PARTY_CONFIRM",
502
- "variant": "primary",
503
- "type": "button"
504
- }
505
- ],
506
- "gap": "sm",
507
- "align": "center",
508
- "type": "stack",
667
+ "children": [
668
+ {
669
+ "type": "typography",
670
+ "content": "Reference",
671
+ "variant": "caption",
672
+ "color": "muted"
673
+ },
674
+ {
675
+ "content": "@config.transactionReference",
676
+ "type": "typography",
677
+ "variant": "body"
678
+ }
679
+ ],
680
+ "gap": "xs",
681
+ "type": "stack",
682
+ "direction": "vertical"
683
+ }
684
+ ],
685
+ "align": "center",
509
686
  "direction": "horizontal"
510
687
  }
511
688
  ]
512
689
  }
513
690
  ]
514
691
  },
515
- {
516
- "type": "divider"
517
- },
518
692
  {
519
693
  "type": "typography",
520
- "color": "muted",
521
- "variant": "caption",
522
- "content": "Audit Log"
694
+ "variant": "h4",
695
+ "content": "Parties"
523
696
  },
524
697
  {
525
698
  "gap": "sm",
526
- "type": "data-list",
527
- "entity": "@entity.audit",
528
699
  "renderItem": [
529
700
  "fn",
530
- "ev",
701
+ "party",
531
702
  {
703
+ "type": "card",
532
704
  "children": [
533
705
  {
534
- "align": "center",
535
- "gap": "sm",
536
706
  "children": [
537
707
  {
538
- "name": "clock",
539
- "type": "icon"
708
+ "type": "icon",
709
+ "name": "@party.icon",
710
+ "size": "lg"
540
711
  },
541
712
  {
542
- "type": "stack",
543
713
  "direction": "vertical",
544
- "gap": "xs",
545
714
  "children": [
546
715
  {
547
- "variant": "h4",
548
- "type": "typography",
549
- "content": "@ev.action"
716
+ "children": [
717
+ {
718
+ "type": "typography",
719
+ "variant": "h4",
720
+ "content": "@party.title"
721
+ },
722
+ {
723
+ "content": "·",
724
+ "type": "typography",
725
+ "color": "muted"
726
+ },
727
+ {
728
+ "type": "typography",
729
+ "variant": "body",
730
+ "content": "@party.actor"
731
+ }
732
+ ],
733
+ "type": "stack",
734
+ "direction": "horizontal",
735
+ "align": "center",
736
+ "gap": "xs"
550
737
  },
551
738
  {
739
+ "type": "typography",
740
+ "content": "@party.description",
552
741
  "color": "muted",
553
- "variant": "caption",
554
- "content": "@ev.timestamp",
555
- "type": "typography"
742
+ "variant": "caption"
556
743
  }
557
- ]
744
+ ],
745
+ "type": "stack",
746
+ "gap": "xs"
747
+ }
748
+ ],
749
+ "type": "stack",
750
+ "direction": "horizontal",
751
+ "align": "center",
752
+ "gap": "md"
753
+ }
754
+ ]
755
+ }
756
+ ],
757
+ "entity": "@entity.parties",
758
+ "fields": [],
759
+ "type": "data-list"
760
+ },
761
+ {
762
+ "variant": "h4",
763
+ "type": "typography",
764
+ "content": "Progress"
765
+ },
766
+ {
767
+ "type": "wizard-progress",
768
+ "steps": "@entity.parties",
769
+ "currentStep": "@entity.currentPartyIndex"
770
+ },
771
+ {
772
+ "variant": "elevated",
773
+ "children": [
774
+ {
775
+ "direction": "vertical",
776
+ "gap": "md",
777
+ "type": "stack",
778
+ "children": [
779
+ {
780
+ "children": [
781
+ {
782
+ "type": "icon",
783
+ "name": "clock"
558
784
  },
559
785
  {
560
- "type": "badge",
561
- "variant": "primary",
562
- "label": "@ev.actor"
786
+ "color": "muted",
787
+ "variant": "caption",
788
+ "type": "typography",
789
+ "content": "@entity.currentStepLabel"
790
+ },
791
+ {
792
+ "type": "typography",
793
+ "content": "·",
794
+ "color": "muted"
795
+ },
796
+ {
797
+ "variant": "caption",
798
+ "content": "Waiting for",
799
+ "color": "muted",
800
+ "type": "typography"
801
+ },
802
+ {
803
+ "type": "typography",
804
+ "variant": "body",
805
+ "weight": "bold",
806
+ "content": "@entity.currentPartyActor"
563
807
  }
564
808
  ],
809
+ "gap": "sm",
810
+ "align": "center",
565
811
  "direction": "horizontal",
566
812
  "type": "stack"
813
+ },
814
+ {
815
+ "content": "@entity.currentActionDescription",
816
+ "type": "typography",
817
+ "variant": "body"
818
+ },
819
+ {
820
+ "label": "@entity.currentActionLabel",
821
+ "action": "PARTY_CONFIRM",
822
+ "actionPayload": {
823
+ "partyKey": "@entity.currentPartyId"
824
+ },
825
+ "icon": "@entity.currentActionIcon",
826
+ "variant": "primary",
827
+ "type": "button"
567
828
  }
568
- ],
569
- "type": "card"
829
+ ]
570
830
  }
571
831
  ],
572
- "fields": []
832
+ "type": "card"
833
+ },
834
+ {
835
+ "variant": "h4",
836
+ "content": "Activity",
837
+ "type": "typography"
838
+ },
839
+ {
840
+ "fields": [
841
+ "title",
842
+ "description",
843
+ "timestamp",
844
+ "status"
845
+ ],
846
+ "type": "timeline",
847
+ "entity": "@entity.audit"
848
+ },
849
+ {
850
+ "type": "divider"
573
851
  },
574
852
  {
575
853
  "direction": "horizontal",
576
- "type": "stack",
577
- "gap": "sm",
578
- "align": "center",
579
854
  "children": [
580
855
  {
581
856
  "type": "button",
582
- "label": "Mark Funded",
583
- "action": "FINALIZE",
584
- "icon": "lock",
585
- "variant": "success"
586
- },
587
- {
588
- "label": "@config.disputeLabel",
857
+ "icon": "@config.disputeIcon",
589
858
  "variant": "danger",
590
- "type": "button",
591
- "action": "OPEN_DISPUTE",
592
- "icon": "@config.disputeIcon"
859
+ "label": "@config.disputeLabel",
860
+ "action": "OPEN_DISPUTE"
593
861
  },
594
862
  {
595
- "variant": "ghost",
863
+ "icon": "@config.cancelIcon",
596
864
  "label": "@config.cancelLabel",
597
- "action": "CANCEL_TRANSACTION",
598
865
  "type": "button",
599
- "icon": "@config.cancelIcon"
866
+ "variant": "ghost",
867
+ "action": "CANCEL_TRANSACTION"
600
868
  }
601
- ]
869
+ ],
870
+ "type": "stack",
871
+ "gap": "sm",
872
+ "align": "center"
602
873
  }
603
- ],
604
- "type": "stack",
605
- "gap": "md",
606
- "direction": "vertical"
874
+ ]
607
875
  }
608
876
  ]
609
877
  ]
@@ -622,9 +890,9 @@
622
890
  "render-ui",
623
891
  "main",
624
892
  {
625
- "title": "Failed to load",
893
+ "message": "@entity.errorMessage",
626
894
  "type": "error-state",
627
- "message": "@entity.errorMessage"
895
+ "title": "Failed to load"
628
896
  }
629
897
  ]
630
898
  ]
@@ -659,8 +927,8 @@
659
927
  "main",
660
928
  {
661
929
  "type": "error-state",
662
- "title": "Save failed",
663
- "message": "@entity.errorMessage"
930
+ "message": "@entity.errorMessage",
931
+ "title": "Save failed"
664
932
  }
665
933
  ]
666
934
  ]
@@ -669,7 +937,54 @@
669
937
  "from": "awaiting",
670
938
  "to": "awaiting",
671
939
  "event": "PARTY_CONFIRM",
940
+ "guard": [
941
+ "not",
942
+ [
943
+ "=",
944
+ [
945
+ "+",
946
+ "@entity.currentPartyIndex",
947
+ 1.0
948
+ ],
949
+ "@entity.totalParties"
950
+ ]
951
+ ],
672
952
  "effects": [
953
+ [
954
+ "set",
955
+ "@entity.audit",
956
+ [
957
+ "array/append",
958
+ "@entity.audit",
959
+ {
960
+ "id": [
961
+ "str/concat",
962
+ "confirm-",
963
+ [
964
+ "object/get",
965
+ "@payload",
966
+ "partyKey",
967
+ ""
968
+ ]
969
+ ],
970
+ "title": [
971
+ "str/concat",
972
+ "@entity.currentPartyTitle",
973
+ " confirmed"
974
+ ],
975
+ "status": "complete",
976
+ "timestamp": [
977
+ "time/now"
978
+ ],
979
+ "description": [
980
+ "str/concat",
981
+ "@entity.currentPartyActor",
982
+ " completed: ",
983
+ "@entity.currentActionLabel"
984
+ ]
985
+ }
986
+ ]
987
+ ],
673
988
  [
674
989
  "set",
675
990
  "@entity.currentPartyIndex",
@@ -681,171 +996,403 @@
681
996
  ],
682
997
  [
683
998
  "set",
684
- "@entity.parties",
999
+ "@entity.currentPartyId",
685
1000
  [
686
- "array/map",
687
- "@config.parties",
1001
+ "object/get",
688
1002
  [
689
- "fn",
690
- "party",
691
- {
692
- "label": [
693
- "object/get",
694
- "@party",
695
- "label"
696
- ],
697
- "description": [
698
- "object/get",
699
- "@party",
700
- "description",
701
- ""
702
- ],
703
- "icon": [
704
- "object/get",
705
- "@party",
706
- "icon",
707
- "user"
708
- ],
709
- "actionLabel": [
710
- "object/get",
711
- "@party",
712
- "actionLabel",
713
- "Confirm"
714
- ],
715
- "actionIcon": [
716
- "object/get",
717
- "@party",
718
- "actionIcon",
719
- "check"
720
- ],
721
- "status": "completed",
722
- "key": [
723
- "object/get",
724
- "@party",
725
- "key"
726
- ]
727
- }
728
- ]
1003
+ "array/nth",
1004
+ "@config.parties",
1005
+ "@entity.currentPartyIndex"
1006
+ ],
1007
+ "id",
1008
+ ""
1009
+ ]
1010
+ ],
1011
+ [
1012
+ "set",
1013
+ "@entity.currentPartyTitle",
1014
+ [
1015
+ "object/get",
1016
+ [
1017
+ "array/nth",
1018
+ "@config.parties",
1019
+ "@entity.currentPartyIndex"
1020
+ ],
1021
+ "title",
1022
+ ""
1023
+ ]
1024
+ ],
1025
+ [
1026
+ "set",
1027
+ "@entity.currentPartyActor",
1028
+ [
1029
+ "object/get",
1030
+ [
1031
+ "array/nth",
1032
+ "@config.parties",
1033
+ "@entity.currentPartyIndex"
1034
+ ],
1035
+ "actor",
1036
+ ""
1037
+ ]
1038
+ ],
1039
+ [
1040
+ "set",
1041
+ "@entity.currentPartyIcon",
1042
+ [
1043
+ "object/get",
1044
+ [
1045
+ "array/nth",
1046
+ "@config.parties",
1047
+ "@entity.currentPartyIndex"
1048
+ ],
1049
+ "icon",
1050
+ "user"
1051
+ ]
1052
+ ],
1053
+ [
1054
+ "set",
1055
+ "@entity.currentActionLabel",
1056
+ [
1057
+ "object/get",
1058
+ [
1059
+ "array/nth",
1060
+ "@config.parties",
1061
+ "@entity.currentPartyIndex"
1062
+ ],
1063
+ "actionLabel",
1064
+ "Confirm"
1065
+ ]
1066
+ ],
1067
+ [
1068
+ "set",
1069
+ "@entity.currentActionIcon",
1070
+ [
1071
+ "object/get",
1072
+ [
1073
+ "array/nth",
1074
+ "@config.parties",
1075
+ "@entity.currentPartyIndex"
1076
+ ],
1077
+ "actionIcon",
1078
+ "check"
1079
+ ]
1080
+ ],
1081
+ [
1082
+ "set",
1083
+ "@entity.currentActionDescription",
1084
+ [
1085
+ "object/get",
1086
+ [
1087
+ "array/nth",
1088
+ "@config.parties",
1089
+ "@entity.currentPartyIndex"
1090
+ ],
1091
+ "actionDescription",
1092
+ ""
1093
+ ]
1094
+ ],
1095
+ [
1096
+ "set",
1097
+ "@entity.currentStepLabel",
1098
+ [
1099
+ "object/get",
1100
+ [
1101
+ "array/nth",
1102
+ "@config.parties",
1103
+ "@entity.currentPartyIndex"
1104
+ ],
1105
+ "stepLabel",
1106
+ "Step"
729
1107
  ]
730
1108
  ],
731
1109
  [
732
1110
  "render-ui",
733
1111
  "main",
734
1112
  {
735
- "gap": "md",
736
- "direction": "vertical",
737
1113
  "children": [
738
1114
  {
1115
+ "type": "stack",
739
1116
  "direction": "horizontal",
740
1117
  "align": "center",
1118
+ "gap": "sm",
741
1119
  "children": [
742
1120
  {
743
- "name": "git-pull-request",
744
- "type": "icon"
1121
+ "type": "icon",
1122
+ "name": "git-pull-request"
745
1123
  },
746
1124
  {
1125
+ "variant": "h3",
747
1126
  "type": "typography",
748
- "content": "@config.title",
749
- "variant": "h3"
1127
+ "content": "@config.title"
1128
+ },
1129
+ {
1130
+ "type": "badge",
1131
+ "label": "Active",
1132
+ "variant": "primary"
750
1133
  }
751
- ],
752
- "type": "stack",
753
- "gap": "sm"
754
- },
755
- {
756
- "type": "divider"
1134
+ ]
757
1135
  },
758
1136
  {
759
- "entity": "@entity.parties",
760
- "gap": "sm",
761
- "type": "data-list",
762
- "renderItem": [
763
- "fn",
764
- "party",
1137
+ "children": [
765
1138
  {
1139
+ "direction": "vertical",
1140
+ "gap": "md",
766
1141
  "children": [
767
1142
  {
768
- "gap": "sm",
769
- "direction": "horizontal",
1143
+ "gap": "lg",
770
1144
  "children": [
771
1145
  {
772
- "name": "@party.icon",
773
- "type": "icon"
774
- },
775
- {
776
- "direction": "vertical",
777
- "gap": "xs",
778
1146
  "type": "stack",
1147
+ "direction": "vertical",
779
1148
  "children": [
780
1149
  {
781
- "content": "@party.label",
782
- "type": "typography",
783
- "variant": "h4"
1150
+ "variant": "caption",
1151
+ "color": "muted",
1152
+ "content": "Amount in escrow",
1153
+ "type": "typography"
784
1154
  },
785
1155
  {
786
- "content": "@party.description",
1156
+ "variant": "h1",
787
1157
  "type": "typography",
788
- "color": "muted",
789
- "variant": "caption"
1158
+ "content": "@config.transactionAmount"
790
1159
  }
791
- ]
1160
+ ],
1161
+ "gap": "xs"
792
1162
  },
793
1163
  {
794
- "type": "badge",
795
- "variant": "primary",
796
- "label": "@party.status"
1164
+ "type": "stack",
1165
+ "direction": "vertical",
1166
+ "gap": "xs",
1167
+ "children": [
1168
+ {
1169
+ "color": "muted",
1170
+ "content": "Subject",
1171
+ "variant": "caption",
1172
+ "type": "typography"
1173
+ },
1174
+ {
1175
+ "content": "@config.transactionSubject",
1176
+ "variant": "h4",
1177
+ "type": "typography"
1178
+ }
1179
+ ]
797
1180
  },
798
1181
  {
799
- "type": "button",
800
- "action": "PARTY_CONFIRM",
801
- "icon": "@party.actionIcon",
802
- "label": "@party.actionLabel",
803
- "variant": "primary",
804
- "actionPayload": {
805
- "partyKey": "@party.key"
806
- }
1182
+ "children": [
1183
+ {
1184
+ "content": "Reference",
1185
+ "variant": "caption",
1186
+ "type": "typography",
1187
+ "color": "muted"
1188
+ },
1189
+ {
1190
+ "type": "typography",
1191
+ "content": "@config.transactionReference",
1192
+ "variant": "body"
1193
+ }
1194
+ ],
1195
+ "type": "stack",
1196
+ "gap": "xs",
1197
+ "direction": "vertical"
807
1198
  }
808
1199
  ],
1200
+ "direction": "horizontal",
809
1201
  "align": "center",
810
1202
  "type": "stack"
811
1203
  }
812
1204
  ],
813
- "type": "card"
1205
+ "type": "stack"
814
1206
  }
815
1207
  ],
816
- "fields": []
1208
+ "type": "card"
1209
+ },
1210
+ {
1211
+ "variant": "h4",
1212
+ "type": "typography",
1213
+ "content": "Parties"
817
1214
  },
818
1215
  {
1216
+ "type": "data-list",
1217
+ "entity": "@entity.parties",
1218
+ "renderItem": [
1219
+ "fn",
1220
+ "party",
1221
+ {
1222
+ "type": "card",
1223
+ "children": [
1224
+ {
1225
+ "align": "center",
1226
+ "gap": "md",
1227
+ "type": "stack",
1228
+ "direction": "horizontal",
1229
+ "children": [
1230
+ {
1231
+ "type": "icon",
1232
+ "name": "@party.icon",
1233
+ "size": "lg"
1234
+ },
1235
+ {
1236
+ "direction": "vertical",
1237
+ "gap": "xs",
1238
+ "type": "stack",
1239
+ "children": [
1240
+ {
1241
+ "align": "center",
1242
+ "direction": "horizontal",
1243
+ "type": "stack",
1244
+ "gap": "xs",
1245
+ "children": [
1246
+ {
1247
+ "content": "@party.title",
1248
+ "type": "typography",
1249
+ "variant": "h4"
1250
+ },
1251
+ {
1252
+ "color": "muted",
1253
+ "type": "typography",
1254
+ "content": "·"
1255
+ },
1256
+ {
1257
+ "type": "typography",
1258
+ "content": "@party.actor",
1259
+ "variant": "body"
1260
+ }
1261
+ ]
1262
+ },
1263
+ {
1264
+ "variant": "caption",
1265
+ "content": "@party.description",
1266
+ "type": "typography",
1267
+ "color": "muted"
1268
+ }
1269
+ ]
1270
+ }
1271
+ ]
1272
+ }
1273
+ ]
1274
+ }
1275
+ ],
819
1276
  "gap": "sm",
1277
+ "fields": []
1278
+ },
1279
+ {
1280
+ "content": "Progress",
1281
+ "type": "typography",
1282
+ "variant": "h4"
1283
+ },
1284
+ {
1285
+ "type": "wizard-progress",
1286
+ "currentStep": "@entity.currentPartyIndex",
1287
+ "steps": "@entity.parties"
1288
+ },
1289
+ {
1290
+ "children": [
1291
+ {
1292
+ "type": "stack",
1293
+ "children": [
1294
+ {
1295
+ "type": "stack",
1296
+ "gap": "sm",
1297
+ "align": "center",
1298
+ "direction": "horizontal",
1299
+ "children": [
1300
+ {
1301
+ "type": "icon",
1302
+ "name": "clock"
1303
+ },
1304
+ {
1305
+ "content": "@entity.currentStepLabel",
1306
+ "variant": "caption",
1307
+ "type": "typography",
1308
+ "color": "muted"
1309
+ },
1310
+ {
1311
+ "type": "typography",
1312
+ "color": "muted",
1313
+ "content": "·"
1314
+ },
1315
+ {
1316
+ "color": "muted",
1317
+ "content": "Waiting for",
1318
+ "type": "typography",
1319
+ "variant": "caption"
1320
+ },
1321
+ {
1322
+ "weight": "bold",
1323
+ "content": "@entity.currentPartyActor",
1324
+ "variant": "body",
1325
+ "type": "typography"
1326
+ }
1327
+ ]
1328
+ },
1329
+ {
1330
+ "type": "typography",
1331
+ "content": "@entity.currentActionDescription",
1332
+ "variant": "body"
1333
+ },
1334
+ {
1335
+ "variant": "primary",
1336
+ "action": "PARTY_CONFIRM",
1337
+ "type": "button",
1338
+ "actionPayload": {
1339
+ "partyKey": "@entity.currentPartyId"
1340
+ },
1341
+ "label": "@entity.currentActionLabel",
1342
+ "icon": "@entity.currentActionIcon"
1343
+ }
1344
+ ],
1345
+ "gap": "md",
1346
+ "direction": "vertical"
1347
+ }
1348
+ ],
1349
+ "variant": "elevated",
1350
+ "type": "card"
1351
+ },
1352
+ {
1353
+ "content": "Activity",
1354
+ "variant": "h4",
1355
+ "type": "typography"
1356
+ },
1357
+ {
1358
+ "type": "timeline",
1359
+ "entity": "@entity.audit",
1360
+ "fields": [
1361
+ "title",
1362
+ "description",
1363
+ "timestamp",
1364
+ "status"
1365
+ ]
1366
+ },
1367
+ {
1368
+ "type": "divider"
1369
+ },
1370
+ {
820
1371
  "align": "center",
1372
+ "gap": "sm",
821
1373
  "type": "stack",
822
1374
  "direction": "horizontal",
823
1375
  "children": [
824
1376
  {
825
- "label": "Mark Funded",
826
1377
  "type": "button",
827
- "action": "FINALIZE",
828
- "variant": "success",
829
- "icon": "lock"
830
- },
831
- {
832
- "icon": "@config.disputeIcon",
833
1378
  "label": "@config.disputeLabel",
834
- "variant": "danger",
1379
+ "icon": "@config.disputeIcon",
835
1380
  "action": "OPEN_DISPUTE",
836
- "type": "button"
1381
+ "variant": "danger"
837
1382
  },
838
1383
  {
839
1384
  "icon": "@config.cancelIcon",
840
- "action": "CANCEL_TRANSACTION",
841
1385
  "label": "@config.cancelLabel",
842
- "type": "button",
843
- "variant": "ghost"
1386
+ "variant": "ghost",
1387
+ "action": "CANCEL_TRANSACTION",
1388
+ "type": "button"
844
1389
  }
845
1390
  ]
846
1391
  }
847
1392
  ],
848
- "type": "stack"
1393
+ "type": "stack",
1394
+ "direction": "vertical",
1395
+ "gap": "lg"
849
1396
  }
850
1397
  ]
851
1398
  ]
@@ -853,192 +1400,687 @@
853
1400
  {
854
1401
  "from": "awaiting",
855
1402
  "to": "funded",
856
- "event": "FINALIZE",
1403
+ "event": "PARTY_CONFIRM",
1404
+ "guard": [
1405
+ "=",
1406
+ [
1407
+ "+",
1408
+ "@entity.currentPartyIndex",
1409
+ 1.0
1410
+ ],
1411
+ "@entity.totalParties"
1412
+ ],
857
1413
  "effects": [
1414
+ [
1415
+ "set",
1416
+ "@entity.audit",
1417
+ [
1418
+ "array/append",
1419
+ "@entity.audit",
1420
+ {
1421
+ "id": [
1422
+ "str/concat",
1423
+ "confirm-",
1424
+ [
1425
+ "object/get",
1426
+ "@payload",
1427
+ "partyKey",
1428
+ ""
1429
+ ]
1430
+ ],
1431
+ "timestamp": [
1432
+ "time/now"
1433
+ ],
1434
+ "status": "complete",
1435
+ "title": [
1436
+ "str/concat",
1437
+ "@entity.currentPartyTitle",
1438
+ " confirmed"
1439
+ ],
1440
+ "description": [
1441
+ "str/concat",
1442
+ "@entity.currentPartyActor",
1443
+ " completed: ",
1444
+ "@entity.currentActionLabel"
1445
+ ]
1446
+ }
1447
+ ]
1448
+ ],
1449
+ [
1450
+ "set",
1451
+ "@entity.audit",
1452
+ [
1453
+ "array/append",
1454
+ "@entity.audit",
1455
+ {
1456
+ "id": "all-confirmed",
1457
+ "title": "All parties confirmed",
1458
+ "timestamp": [
1459
+ "time/now"
1460
+ ],
1461
+ "status": "complete",
1462
+ "description": [
1463
+ "str/concat",
1464
+ "@config.transactionAmount",
1465
+ " is now funded and ready for release."
1466
+ ]
1467
+ }
1468
+ ]
1469
+ ],
858
1470
  [
859
1471
  "render-ui",
860
1472
  "main",
861
1473
  {
862
1474
  "children": [
863
1475
  {
1476
+ "type": "stack",
1477
+ "align": "center",
1478
+ "direction": "horizontal",
1479
+ "gap": "sm",
864
1480
  "children": [
865
1481
  {
866
1482
  "name": "lock",
867
1483
  "type": "icon"
868
1484
  },
869
1485
  {
870
- "variant": "h3",
871
- "content": "Funded",
872
- "type": "typography"
1486
+ "type": "typography",
1487
+ "content": "@config.title",
1488
+ "variant": "h3"
1489
+ },
1490
+ {
1491
+ "type": "badge",
1492
+ "label": "Funded",
1493
+ "variant": "success"
873
1494
  }
874
- ],
875
- "direction": "horizontal",
876
- "type": "stack",
877
- "gap": "sm",
878
- "align": "center"
1495
+ ]
879
1496
  },
880
1497
  {
881
- "type": "divider"
1498
+ "type": "card",
1499
+ "children": [
1500
+ {
1501
+ "children": [
1502
+ {
1503
+ "gap": "lg",
1504
+ "type": "stack",
1505
+ "align": "center",
1506
+ "children": [
1507
+ {
1508
+ "gap": "xs",
1509
+ "type": "stack",
1510
+ "children": [
1511
+ {
1512
+ "type": "typography",
1513
+ "variant": "caption",
1514
+ "content": "Amount in escrow",
1515
+ "color": "muted"
1516
+ },
1517
+ {
1518
+ "type": "typography",
1519
+ "content": "@config.transactionAmount",
1520
+ "variant": "h1"
1521
+ }
1522
+ ],
1523
+ "direction": "vertical"
1524
+ },
1525
+ {
1526
+ "direction": "vertical",
1527
+ "gap": "xs",
1528
+ "children": [
1529
+ {
1530
+ "type": "typography",
1531
+ "content": "Subject",
1532
+ "variant": "caption",
1533
+ "color": "muted"
1534
+ },
1535
+ {
1536
+ "variant": "h4",
1537
+ "content": "@config.transactionSubject",
1538
+ "type": "typography"
1539
+ }
1540
+ ],
1541
+ "type": "stack"
1542
+ },
1543
+ {
1544
+ "children": [
1545
+ {
1546
+ "type": "typography",
1547
+ "content": "Reference",
1548
+ "variant": "caption",
1549
+ "color": "muted"
1550
+ },
1551
+ {
1552
+ "type": "typography",
1553
+ "content": "@config.transactionReference",
1554
+ "variant": "body"
1555
+ }
1556
+ ],
1557
+ "direction": "vertical",
1558
+ "type": "stack",
1559
+ "gap": "xs"
1560
+ }
1561
+ ],
1562
+ "direction": "horizontal"
1563
+ }
1564
+ ],
1565
+ "type": "stack",
1566
+ "gap": "md",
1567
+ "direction": "vertical"
1568
+ }
1569
+ ]
882
1570
  },
883
1571
  {
884
- "variant": "body",
885
- "content": "All parties have confirmed. Awaiting release.",
886
- "type": "typography"
1572
+ "type": "card",
1573
+ "variant": "elevated",
1574
+ "children": [
1575
+ {
1576
+ "type": "stack",
1577
+ "gap": "md",
1578
+ "align": "center",
1579
+ "direction": "vertical",
1580
+ "children": [
1581
+ {
1582
+ "type": "icon",
1583
+ "name": "check-circle",
1584
+ "size": "lg"
1585
+ },
1586
+ {
1587
+ "type": "typography",
1588
+ "variant": "h2",
1589
+ "align": "center",
1590
+ "content": "All parties confirmed"
1591
+ },
1592
+ {
1593
+ "variant": "body",
1594
+ "color": "muted",
1595
+ "content": "Funds are held in escrow and ready for release to the seller.",
1596
+ "type": "typography",
1597
+ "align": "center"
1598
+ },
1599
+ {
1600
+ "direction": "horizontal",
1601
+ "align": "center",
1602
+ "children": [
1603
+ {
1604
+ "action": "RELEASE",
1605
+ "icon": "@config.releaseIcon",
1606
+ "variant": "success",
1607
+ "type": "button",
1608
+ "label": "@config.releaseLabel"
1609
+ },
1610
+ {
1611
+ "label": "@config.disputeLabel",
1612
+ "type": "button",
1613
+ "action": "OPEN_DISPUTE",
1614
+ "icon": "@config.disputeIcon",
1615
+ "variant": "danger"
1616
+ }
1617
+ ],
1618
+ "type": "stack",
1619
+ "gap": "sm"
1620
+ }
1621
+ ]
1622
+ }
1623
+ ]
887
1624
  },
888
1625
  {
1626
+ "type": "typography",
1627
+ "content": "Activity",
1628
+ "variant": "h4"
1629
+ },
1630
+ {
1631
+ "fields": [
1632
+ "title",
1633
+ "description",
1634
+ "timestamp",
1635
+ "status"
1636
+ ],
1637
+ "type": "timeline",
1638
+ "entity": "@entity.audit"
1639
+ }
1640
+ ],
1641
+ "direction": "vertical",
1642
+ "type": "stack",
1643
+ "gap": "lg"
1644
+ }
1645
+ ]
1646
+ ]
1647
+ },
1648
+ {
1649
+ "from": "awaiting",
1650
+ "to": "capturing_dispute",
1651
+ "event": "OPEN_DISPUTE",
1652
+ "effects": [
1653
+ [
1654
+ "set",
1655
+ "@entity.reason",
1656
+ ""
1657
+ ],
1658
+ [
1659
+ "render-ui",
1660
+ "main",
1661
+ {
1662
+ "type": "stack",
1663
+ "direction": "vertical",
1664
+ "children": [
1665
+ {
1666
+ "direction": "horizontal",
889
1667
  "gap": "sm",
890
- "align": "center",
891
1668
  "type": "stack",
892
- "direction": "horizontal",
1669
+ "align": "center",
893
1670
  "children": [
894
1671
  {
895
- "icon": "@config.releaseIcon",
896
- "variant": "primary",
1672
+ "icon": "arrow-left",
1673
+ "label": "Back",
1674
+ "action": "CANCEL_REASON",
897
1675
  "type": "button",
898
- "action": "RELEASE",
899
- "label": "@config.releaseLabel"
1676
+ "variant": "ghost"
900
1677
  },
901
1678
  {
902
- "label": "@config.disputeLabel",
903
- "action": "OPEN_DISPUTE",
904
- "type": "button",
905
- "variant": "danger",
906
- "icon": "@config.disputeIcon"
1679
+ "type": "icon",
1680
+ "name": "alert-triangle"
1681
+ },
1682
+ {
1683
+ "type": "typography",
1684
+ "content": "Open a dispute",
1685
+ "variant": "h3"
907
1686
  }
908
1687
  ]
1688
+ },
1689
+ {
1690
+ "children": [
1691
+ {
1692
+ "gap": "sm",
1693
+ "children": [
1694
+ {
1695
+ "type": "typography",
1696
+ "variant": "body",
1697
+ "content": "Describe the issue so all parties and the escrow officer can review. Funds will remain in escrow until the dispute is resolved.",
1698
+ "color": "muted"
1699
+ },
1700
+ {
1701
+ "type": "form-section",
1702
+ "fields": "@config.reasonFields",
1703
+ "submitEvent": "SUBMIT_DISPUTE",
1704
+ "mode": "edit",
1705
+ "cancelEvent": "CANCEL_REASON",
1706
+ "submitLabel": "Submit dispute",
1707
+ "entity": "@entity"
1708
+ }
1709
+ ],
1710
+ "direction": "vertical",
1711
+ "type": "stack"
1712
+ }
1713
+ ],
1714
+ "type": "card"
909
1715
  }
910
1716
  ],
1717
+ "gap": "md"
1718
+ }
1719
+ ]
1720
+ ]
1721
+ },
1722
+ {
1723
+ "from": "awaiting",
1724
+ "to": "capturing_cancel",
1725
+ "event": "CANCEL_TRANSACTION",
1726
+ "effects": [
1727
+ [
1728
+ "set",
1729
+ "@entity.reason",
1730
+ ""
1731
+ ],
1732
+ [
1733
+ "render-ui",
1734
+ "main",
1735
+ {
911
1736
  "gap": "md",
912
1737
  "direction": "vertical",
1738
+ "children": [
1739
+ {
1740
+ "gap": "sm",
1741
+ "children": [
1742
+ {
1743
+ "icon": "arrow-left",
1744
+ "type": "button",
1745
+ "variant": "ghost",
1746
+ "label": "Back",
1747
+ "action": "CANCEL_REASON"
1748
+ },
1749
+ {
1750
+ "type": "icon",
1751
+ "name": "x-circle"
1752
+ },
1753
+ {
1754
+ "type": "typography",
1755
+ "variant": "h3",
1756
+ "content": "Cancel transaction"
1757
+ }
1758
+ ],
1759
+ "type": "stack",
1760
+ "direction": "horizontal",
1761
+ "align": "center"
1762
+ },
1763
+ {
1764
+ "type": "card",
1765
+ "children": [
1766
+ {
1767
+ "direction": "vertical",
1768
+ "children": [
1769
+ {
1770
+ "color": "muted",
1771
+ "content": "Tell the other parties why this transaction is being cancelled. Any escrowed funds will be returned to the buyer.",
1772
+ "type": "typography",
1773
+ "variant": "body"
1774
+ },
1775
+ {
1776
+ "entity": "@entity",
1777
+ "mode": "edit",
1778
+ "type": "form-section",
1779
+ "cancelEvent": "CANCEL_REASON",
1780
+ "submitLabel": "Cancel transaction",
1781
+ "fields": "@config.reasonFields",
1782
+ "submitEvent": "SUBMIT_CANCEL"
1783
+ }
1784
+ ],
1785
+ "type": "stack",
1786
+ "gap": "sm"
1787
+ }
1788
+ ]
1789
+ }
1790
+ ],
913
1791
  "type": "stack"
914
1792
  }
915
1793
  ]
916
1794
  ]
917
1795
  },
918
1796
  {
919
- "from": "awaiting",
1797
+ "from": "capturing_dispute",
920
1798
  "to": "disputed",
921
- "event": "OPEN_DISPUTE",
1799
+ "event": "SUBMIT_DISPUTE",
922
1800
  "effects": [
923
1801
  [
924
1802
  "set",
925
1803
  "@entity.disputeReason",
926
- "@payload.reason"
1804
+ [
1805
+ "object/get",
1806
+ "@payload.data",
1807
+ "reason",
1808
+ ""
1809
+ ]
1810
+ ],
1811
+ [
1812
+ "set",
1813
+ "@entity.audit",
1814
+ [
1815
+ "array/append",
1816
+ "@entity.audit",
1817
+ {
1818
+ "status": "error",
1819
+ "title": "Dispute opened",
1820
+ "id": "dispute-opened",
1821
+ "timestamp": [
1822
+ "time/now"
1823
+ ],
1824
+ "description": "@entity.disputeReason"
1825
+ }
1826
+ ]
927
1827
  ],
928
1828
  [
929
1829
  "render-ui",
930
1830
  "main",
931
1831
  {
1832
+ "gap": "lg",
932
1833
  "children": [
933
1834
  {
934
1835
  "align": "center",
1836
+ "direction": "horizontal",
1837
+ "gap": "sm",
935
1838
  "children": [
936
1839
  {
937
1840
  "type": "icon",
938
1841
  "name": "alert-triangle"
939
1842
  },
940
1843
  {
941
- "content": "Disputed",
1844
+ "content": "@config.title",
1845
+ "variant": "h3",
1846
+ "type": "typography"
1847
+ },
1848
+ {
1849
+ "variant": "danger",
1850
+ "label": "Disputed",
1851
+ "type": "badge"
1852
+ }
1853
+ ],
1854
+ "type": "stack"
1855
+ },
1856
+ {
1857
+ "type": "card",
1858
+ "children": [
1859
+ {
1860
+ "gap": "sm",
1861
+ "direction": "vertical",
1862
+ "children": [
1863
+ {
1864
+ "content": "Reason for dispute",
1865
+ "color": "muted",
1866
+ "variant": "caption",
1867
+ "type": "typography"
1868
+ },
1869
+ {
1870
+ "variant": "body",
1871
+ "type": "typography",
1872
+ "content": "@entity.disputeReason"
1873
+ },
1874
+ {
1875
+ "type": "divider"
1876
+ },
1877
+ {
1878
+ "type": "typography",
1879
+ "variant": "caption",
1880
+ "content": "An escrow officer will contact all parties within one business day. Funds remain held until resolution.",
1881
+ "color": "muted"
1882
+ }
1883
+ ],
1884
+ "type": "stack"
1885
+ }
1886
+ ]
1887
+ },
1888
+ {
1889
+ "variant": "h4",
1890
+ "type": "typography",
1891
+ "content": "Activity"
1892
+ },
1893
+ {
1894
+ "type": "timeline",
1895
+ "entity": "@entity.audit",
1896
+ "fields": [
1897
+ "title",
1898
+ "description",
1899
+ "timestamp",
1900
+ "status"
1901
+ ]
1902
+ },
1903
+ {
1904
+ "type": "button",
1905
+ "variant": "secondary",
1906
+ "label": "Start a new transaction",
1907
+ "action": "RESTART",
1908
+ "icon": "rotate-ccw"
1909
+ }
1910
+ ],
1911
+ "type": "stack",
1912
+ "direction": "vertical"
1913
+ }
1914
+ ]
1915
+ ]
1916
+ },
1917
+ {
1918
+ "from": "capturing_dispute",
1919
+ "to": "loading",
1920
+ "event": "CANCEL_REASON",
1921
+ "effects": [
1922
+ [
1923
+ "fetch",
1924
+ "MultiPartyView",
1925
+ {
1926
+ "emit": {
1927
+ "success": "FlowLoaded",
1928
+ "failure": "FlowLoadFailed"
1929
+ }
1930
+ }
1931
+ ],
1932
+ [
1933
+ "render-ui",
1934
+ "main",
1935
+ {
1936
+ "title": "Returning…",
1937
+ "type": "loading-state"
1938
+ }
1939
+ ]
1940
+ ]
1941
+ },
1942
+ {
1943
+ "from": "capturing_cancel",
1944
+ "to": "cancelled",
1945
+ "event": "SUBMIT_CANCEL",
1946
+ "effects": [
1947
+ [
1948
+ "set",
1949
+ "@entity.cancelReason",
1950
+ [
1951
+ "object/get",
1952
+ "@payload.data",
1953
+ "reason",
1954
+ ""
1955
+ ]
1956
+ ],
1957
+ [
1958
+ "set",
1959
+ "@entity.audit",
1960
+ [
1961
+ "array/append",
1962
+ "@entity.audit",
1963
+ {
1964
+ "timestamp": [
1965
+ "time/now"
1966
+ ],
1967
+ "title": "Transaction cancelled",
1968
+ "description": "@entity.cancelReason",
1969
+ "status": "error",
1970
+ "id": "cancelled"
1971
+ }
1972
+ ]
1973
+ ],
1974
+ [
1975
+ "render-ui",
1976
+ "main",
1977
+ {
1978
+ "direction": "vertical",
1979
+ "type": "stack",
1980
+ "children": [
1981
+ {
1982
+ "align": "center",
1983
+ "direction": "horizontal",
1984
+ "children": [
1985
+ {
1986
+ "type": "icon",
1987
+ "name": "x-circle"
1988
+ },
1989
+ {
942
1990
  "type": "typography",
1991
+ "content": "@config.title",
943
1992
  "variant": "h3"
1993
+ },
1994
+ {
1995
+ "type": "badge",
1996
+ "label": "Cancelled",
1997
+ "variant": "warning"
944
1998
  }
945
1999
  ],
946
- "gap": "sm",
947
2000
  "type": "stack",
948
- "direction": "horizontal"
949
- },
950
- {
951
- "type": "divider"
2001
+ "gap": "sm"
952
2002
  },
953
2003
  {
954
2004
  "type": "card",
955
2005
  "children": [
956
2006
  {
957
- "direction": "vertical",
2007
+ "gap": "sm",
958
2008
  "children": [
959
2009
  {
960
- "type": "typography",
961
- "content": "Reason",
2010
+ "content": "Reason for cancellation",
962
2011
  "color": "muted",
963
- "variant": "caption"
2012
+ "variant": "caption",
2013
+ "type": "typography"
964
2014
  },
965
2015
  {
966
2016
  "type": "typography",
967
- "content": "@entity.disputeReason",
968
- "variant": "body"
2017
+ "variant": "body",
2018
+ "content": "@entity.cancelReason"
2019
+ },
2020
+ {
2021
+ "type": "divider"
2022
+ },
2023
+ {
2024
+ "color": "muted",
2025
+ "variant": "caption",
2026
+ "content": "Any escrowed funds have been returned to the buyer.",
2027
+ "type": "typography"
969
2028
  }
970
2029
  ],
971
- "gap": "sm",
2030
+ "direction": "vertical",
972
2031
  "type": "stack"
973
2032
  }
974
2033
  ]
975
2034
  },
2035
+ {
2036
+ "content": "Activity",
2037
+ "type": "typography",
2038
+ "variant": "h4"
2039
+ },
2040
+ {
2041
+ "entity": "@entity.audit",
2042
+ "fields": [
2043
+ "title",
2044
+ "description",
2045
+ "timestamp",
2046
+ "status"
2047
+ ],
2048
+ "type": "timeline"
2049
+ },
976
2050
  {
977
2051
  "icon": "rotate-ccw",
978
- "label": "Restart",
979
- "action": "RESTART",
980
2052
  "type": "button",
981
- "variant": "secondary"
2053
+ "label": "Start a new transaction",
2054
+ "variant": "secondary",
2055
+ "action": "RESTART"
982
2056
  }
983
2057
  ],
984
- "direction": "vertical",
985
- "type": "stack",
986
- "gap": "md"
2058
+ "gap": "lg"
987
2059
  }
988
2060
  ]
989
2061
  ]
990
2062
  },
991
2063
  {
992
- "from": "awaiting",
993
- "to": "cancelled",
994
- "event": "CANCEL_TRANSACTION",
2064
+ "from": "capturing_cancel",
2065
+ "to": "loading",
2066
+ "event": "CANCEL_REASON",
995
2067
  "effects": [
996
2068
  [
997
- "set",
998
- "@entity.cancelReason",
999
- "@payload.reason"
2069
+ "fetch",
2070
+ "MultiPartyView",
2071
+ {
2072
+ "emit": {
2073
+ "failure": "FlowLoadFailed",
2074
+ "success": "FlowLoaded"
2075
+ }
2076
+ }
1000
2077
  ],
1001
2078
  [
1002
2079
  "render-ui",
1003
2080
  "main",
1004
2081
  {
1005
- "direction": "vertical",
1006
- "gap": "md",
1007
- "type": "stack",
1008
- "children": [
1009
- {
1010
- "type": "stack",
1011
- "direction": "horizontal",
1012
- "gap": "sm",
1013
- "align": "center",
1014
- "children": [
1015
- {
1016
- "type": "icon",
1017
- "name": "x-circle"
1018
- },
1019
- {
1020
- "content": "Cancelled",
1021
- "variant": "h3",
1022
- "type": "typography"
1023
- }
1024
- ]
1025
- },
1026
- {
1027
- "type": "divider"
1028
- },
1029
- {
1030
- "content": "Transaction cancelled.",
1031
- "type": "typography",
1032
- "variant": "body"
1033
- },
1034
- {
1035
- "icon": "rotate-ccw",
1036
- "label": "Restart",
1037
- "type": "button",
1038
- "action": "RESTART",
1039
- "variant": "secondary"
1040
- }
1041
- ]
2082
+ "title": "Returning…",
2083
+ "type": "loading-state"
1042
2084
  }
1043
2085
  ]
1044
2086
  ]
@@ -1048,120 +2090,191 @@
1048
2090
  "to": "released",
1049
2091
  "event": "RELEASE",
1050
2092
  "effects": [
2093
+ [
2094
+ "set",
2095
+ "@entity.audit",
2096
+ [
2097
+ "array/append",
2098
+ "@entity.audit",
2099
+ {
2100
+ "description": [
2101
+ "str/concat",
2102
+ "@config.transactionAmount",
2103
+ " released to the seller. Transaction complete."
2104
+ ],
2105
+ "timestamp": [
2106
+ "time/now"
2107
+ ],
2108
+ "id": "released",
2109
+ "status": "complete",
2110
+ "title": "Funds released"
2111
+ }
2112
+ ]
2113
+ ],
1051
2114
  [
1052
2115
  "render-ui",
1053
2116
  "main",
1054
2117
  {
2118
+ "type": "stack",
2119
+ "direction": "vertical",
2120
+ "gap": "lg",
1055
2121
  "children": [
1056
2122
  {
2123
+ "type": "stack",
1057
2124
  "align": "center",
1058
2125
  "children": [
1059
2126
  {
1060
- "name": "check-circle",
1061
- "type": "icon"
2127
+ "type": "icon",
2128
+ "name": "check-circle"
1062
2129
  },
1063
2130
  {
2131
+ "content": "@config.title",
1064
2132
  "variant": "h3",
1065
- "content": "Released",
1066
2133
  "type": "typography"
2134
+ },
2135
+ {
2136
+ "type": "badge",
2137
+ "label": "Completed",
2138
+ "variant": "success"
1067
2139
  }
1068
2140
  ],
1069
- "type": "stack",
1070
- "gap": "sm",
1071
- "direction": "horizontal"
2141
+ "direction": "horizontal",
2142
+ "gap": "sm"
1072
2143
  },
1073
2144
  {
1074
- "type": "divider"
2145
+ "children": [
2146
+ {
2147
+ "gap": "md",
2148
+ "children": [
2149
+ {
2150
+ "name": "check-circle",
2151
+ "size": "lg",
2152
+ "type": "icon"
2153
+ },
2154
+ {
2155
+ "align": "center",
2156
+ "content": "Transaction complete",
2157
+ "variant": "h2",
2158
+ "type": "typography"
2159
+ },
2160
+ {
2161
+ "type": "typography",
2162
+ "content": "@config.transactionAmount",
2163
+ "variant": "h1",
2164
+ "align": "center"
2165
+ },
2166
+ {
2167
+ "type": "typography",
2168
+ "content": "Funds have been released to the seller.",
2169
+ "variant": "body",
2170
+ "align": "center",
2171
+ "color": "muted"
2172
+ }
2173
+ ],
2174
+ "direction": "vertical",
2175
+ "type": "stack",
2176
+ "align": "center"
2177
+ }
2178
+ ],
2179
+ "type": "card"
1075
2180
  },
1076
2181
  {
1077
2182
  "type": "typography",
1078
- "variant": "body",
1079
- "content": "Funds released. Transaction complete."
2183
+ "content": "Activity",
2184
+ "variant": "h4"
1080
2185
  },
1081
2186
  {
1082
- "type": "button",
1083
- "label": "Restart",
1084
- "action": "RESTART",
2187
+ "fields": [
2188
+ "title",
2189
+ "description",
2190
+ "timestamp",
2191
+ "status"
2192
+ ],
2193
+ "entity": "@entity.audit",
2194
+ "type": "timeline"
2195
+ },
2196
+ {
2197
+ "icon": "rotate-ccw",
1085
2198
  "variant": "secondary",
1086
- "icon": "rotate-ccw"
2199
+ "action": "RESTART",
2200
+ "type": "button",
2201
+ "label": "Start a new transaction"
1087
2202
  }
1088
- ],
1089
- "gap": "md",
1090
- "type": "stack",
1091
- "direction": "vertical"
2203
+ ]
1092
2204
  }
1093
2205
  ]
1094
2206
  ]
1095
2207
  },
1096
2208
  {
1097
2209
  "from": "funded",
1098
- "to": "disputed",
2210
+ "to": "capturing_dispute",
1099
2211
  "event": "OPEN_DISPUTE",
1100
2212
  "effects": [
1101
2213
  [
1102
2214
  "set",
1103
- "@entity.disputeReason",
1104
- "@payload.reason"
2215
+ "@entity.reason",
2216
+ ""
1105
2217
  ],
1106
2218
  [
1107
2219
  "render-ui",
1108
2220
  "main",
1109
2221
  {
2222
+ "direction": "vertical",
1110
2223
  "children": [
1111
2224
  {
1112
2225
  "direction": "horizontal",
1113
2226
  "align": "center",
1114
- "type": "stack",
1115
- "gap": "sm",
1116
2227
  "children": [
1117
2228
  {
1118
- "name": "alert-triangle",
1119
- "type": "icon"
2229
+ "label": "Back",
2230
+ "icon": "arrow-left",
2231
+ "type": "button",
2232
+ "variant": "ghost",
2233
+ "action": "CANCEL_REASON"
2234
+ },
2235
+ {
2236
+ "type": "icon",
2237
+ "name": "alert-triangle"
1120
2238
  },
1121
2239
  {
1122
- "content": "Disputed",
1123
2240
  "type": "typography",
1124
- "variant": "h3"
2241
+ "variant": "h3",
2242
+ "content": "Open a dispute"
1125
2243
  }
1126
- ]
1127
- },
1128
- {
1129
- "type": "divider"
2244
+ ],
2245
+ "type": "stack",
2246
+ "gap": "sm"
1130
2247
  },
1131
2248
  {
1132
- "type": "card",
1133
2249
  "children": [
1134
2250
  {
1135
- "type": "stack",
1136
2251
  "direction": "vertical",
1137
2252
  "gap": "sm",
2253
+ "type": "stack",
1138
2254
  "children": [
1139
2255
  {
2256
+ "variant": "body",
2257
+ "content": "Describe the issue so all parties and the escrow officer can review. Funds will remain in escrow until the dispute is resolved.",
1140
2258
  "color": "muted",
1141
- "content": "Reason",
1142
- "type": "typography",
1143
- "variant": "caption"
2259
+ "type": "typography"
1144
2260
  },
1145
2261
  {
1146
- "content": "@entity.disputeReason",
1147
- "variant": "body",
1148
- "type": "typography"
2262
+ "cancelEvent": "CANCEL_REASON",
2263
+ "type": "form-section",
2264
+ "submitLabel": "Submit dispute",
2265
+ "fields": "@config.reasonFields",
2266
+ "mode": "edit",
2267
+ "entity": "@entity",
2268
+ "submitEvent": "SUBMIT_DISPUTE"
1149
2269
  }
1150
2270
  ]
1151
2271
  }
1152
- ]
1153
- },
1154
- {
1155
- "icon": "rotate-ccw",
1156
- "label": "Restart",
1157
- "type": "button",
1158
- "variant": "secondary",
1159
- "action": "RESTART"
2272
+ ],
2273
+ "type": "card"
1160
2274
  }
1161
2275
  ],
1162
2276
  "type": "stack",
1163
- "gap": "md",
1164
- "direction": "vertical"
2277
+ "gap": "md"
1165
2278
  }
1166
2279
  ]
1167
2280
  ]
@@ -1172,16 +2285,21 @@
1172
2285
  "event": "RESTART",
1173
2286
  "effects": [
1174
2287
  [
1175
- "set",
1176
- "@entity.currentPartyIndex",
1177
- 0.0
2288
+ "fetch",
2289
+ "MultiPartyView",
2290
+ {
2291
+ "emit": {
2292
+ "failure": "FlowLoadFailed",
2293
+ "success": "FlowLoaded"
2294
+ }
2295
+ }
1178
2296
  ],
1179
2297
  [
1180
2298
  "render-ui",
1181
2299
  "main",
1182
2300
  {
1183
- "type": "loading-state",
1184
- "title": "Restarting…"
2301
+ "title": "Starting new transaction…",
2302
+ "type": "loading-state"
1185
2303
  }
1186
2304
  ]
1187
2305
  ]
@@ -1192,16 +2310,21 @@
1192
2310
  "event": "RESTART",
1193
2311
  "effects": [
1194
2312
  [
1195
- "set",
1196
- "@entity.currentPartyIndex",
1197
- 0.0
2313
+ "fetch",
2314
+ "MultiPartyView",
2315
+ {
2316
+ "emit": {
2317
+ "success": "FlowLoaded",
2318
+ "failure": "FlowLoadFailed"
2319
+ }
2320
+ }
1198
2321
  ],
1199
2322
  [
1200
2323
  "render-ui",
1201
2324
  "main",
1202
2325
  {
1203
- "title": "Restarting…",
1204
- "type": "loading-state"
2326
+ "type": "loading-state",
2327
+ "title": "Starting new transaction…"
1205
2328
  }
1206
2329
  ]
1207
2330
  ]
@@ -1212,16 +2335,21 @@
1212
2335
  "event": "RESTART",
1213
2336
  "effects": [
1214
2337
  [
1215
- "set",
1216
- "@entity.currentPartyIndex",
1217
- 0.0
2338
+ "fetch",
2339
+ "MultiPartyView",
2340
+ {
2341
+ "emit": {
2342
+ "failure": "FlowLoadFailed",
2343
+ "success": "FlowLoaded"
2344
+ }
2345
+ }
1218
2346
  ],
1219
2347
  [
1220
2348
  "render-ui",
1221
2349
  "main",
1222
2350
  {
1223
- "title": "Restarting…",
1224
- "type": "loading-state"
2351
+ "type": "loading-state",
2352
+ "title": "Starting new transaction…"
1225
2353
  }
1226
2354
  ]
1227
2355
  ]
@@ -1231,6 +2359,16 @@
1231
2359
  "to": "loading",
1232
2360
  "event": "INIT",
1233
2361
  "effects": [
2362
+ [
2363
+ "fetch",
2364
+ "MultiPartyView",
2365
+ {
2366
+ "emit": {
2367
+ "failure": "FlowLoadFailed",
2368
+ "success": "FlowLoaded"
2369
+ }
2370
+ }
2371
+ ],
1234
2372
  [
1235
2373
  "render-ui",
1236
2374
  "main",
@@ -1246,52 +2384,76 @@
1246
2384
  "config": {
1247
2385
  "disputeLabel": {
1248
2386
  "type": "string",
1249
- "default": "Open Dispute"
2387
+ "default": "Open dispute"
1250
2388
  },
1251
- "cancelLabel": {
2389
+ "releaseLabel": {
2390
+ "type": "string",
2391
+ "default": "Release funds"
2392
+ },
2393
+ "transactionAmount": {
2394
+ "type": "string",
2395
+ "default": "$28,500"
2396
+ },
2397
+ "transactionSubject": {
2398
+ "type": "string",
2399
+ "default": "Sale of 2024 Honda CR-V"
2400
+ },
2401
+ "cancelIcon": {
2402
+ "type": "string",
2403
+ "default": "x"
2404
+ },
2405
+ "reasonFields": {
2406
+ "type": "[string]",
2407
+ "default": [
2408
+ "reason"
2409
+ ]
2410
+ },
2411
+ "releaseIcon": {
1252
2412
  "type": "string",
1253
- "default": "Cancel Transaction"
2413
+ "default": "unlock"
1254
2414
  },
1255
2415
  "parties": {
1256
2416
  "type": "[object]",
1257
2417
  "default": [
1258
2418
  {
2419
+ "actionDescription": "Authorize $28,500 to be held in escrow until delivery is confirmed.",
2420
+ "description": "Funds the transaction and confirms receipt of the vehicle.",
1259
2421
  "icon": "user",
1260
- "description": "Initiates transaction",
1261
- "actionLabel": "Confirm",
1262
- "actionIcon": "check",
1263
- "key": "buyer",
1264
- "label": "Buyer"
2422
+ "id": "buyer",
2423
+ "actionLabel": "Confirm payment",
2424
+ "actor": "Alice Chen",
2425
+ "actionIcon": "credit-card",
2426
+ "stepLabel": "Step 1 of 2",
2427
+ "title": "Buyer"
1265
2428
  },
1266
2429
  {
1267
- "description": "Fulfills transaction",
1268
- "key": "seller",
1269
- "label": "Seller",
2430
+ "title": "Seller",
1270
2431
  "icon": "user-check",
1271
- "actionLabel": "Confirm",
1272
- "actionIcon": "check"
2432
+ "id": "seller",
2433
+ "actor": "Bob's Auto Sales LLC",
2434
+ "actionDescription": "Mark the vehicle as shipped. Funds will release after the buyer confirms receipt.",
2435
+ "stepLabel": "Step 2 of 2",
2436
+ "actionLabel": "Confirm shipment",
2437
+ "description": "Ships the vehicle and uploads delivery proof.",
2438
+ "actionIcon": "package"
1273
2439
  }
1274
2440
  ]
1275
2441
  },
1276
- "cancelIcon": {
1277
- "type": "string",
1278
- "default": "x"
1279
- },
1280
- "disputeIcon": {
2442
+ "transactionReference": {
1281
2443
  "type": "string",
1282
- "default": "alert-triangle"
2444
+ "default": "TXN-A8B2C-2024-001"
1283
2445
  },
1284
- "releaseLabel": {
2446
+ "title": {
1285
2447
  "type": "string",
1286
- "default": "Release Escrow"
2448
+ "default": "Escrow transaction"
1287
2449
  },
1288
- "title": {
2450
+ "disputeIcon": {
1289
2451
  "type": "string",
1290
- "default": "Multi-Party Transaction"
2452
+ "default": "alert-triangle"
1291
2453
  },
1292
- "releaseIcon": {
2454
+ "cancelLabel": {
1293
2455
  "type": "string",
1294
- "default": "unlock"
2456
+ "default": "Cancel transaction"
1295
2457
  }
1296
2458
  },
1297
2459
  "scope": "instance"