-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplates.ts
More file actions
1343 lines (1320 loc) · 40.1 KB
/
Copy pathtemplates.ts
File metadata and controls
1343 lines (1320 loc) · 40.1 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
import type { SupportedBlock, Template } from '@tightknitai/block-kitchen';
/**
* Demo-specific template gallery. The `block-kitchen` package intentionally
* does **not** ship templates of its own — templates are use-case examples
* (an "Expense approval" is for an approvals product, a "Daily standup" is
* for a team product) and belong in the consuming app's config, not the
* library bundle. This file is the demo's own config; downstream apps are
* expected to define their own set and pass it to `<TemplatePicker>`.
*
* The set is intentionally broad to showcase the platform in the live demo
* — between them the templates exercise every supported block type and a
* wide slice of the element catalog (every select type, all date/time
* pickers, every text-input variant, file input, rich text input, feedback
* / icon buttons, image accessories, overflow menus, button confirm
* dialogs).
*
* Each template's `surface` is the surface its blocks were authored for;
* the runtime validator enforces surface compatibility (e.g. `alert` is
* modal-only, `table` / `markdown` / `carousel` / `context_actions` are
* forbidden on modals, `table` / `markdown` / `context_actions` are
* forbidden on app-home tabs), and the templates here respect those rules.
*/
/**
* Categories used to group templates in the demo's `<TemplatePicker>`.
*/
const TEMPLATE_CATEGORIES = {
engineering: 'Engineering',
approvals: 'Approvals',
team: 'Team',
announcements: 'Announcements',
forms: 'Forms',
scheduling: 'Scheduling',
homeTabs: 'Home tabs'
} as const;
// --- Template 1: Pull request review (message) -----------------------------
const PR_REVIEW_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Pull request ready for review', emoji: true }
},
{
type: 'context',
elements: [
{
type: 'image',
image_url: 'https://placehold.co/24x24/4f46e5/ffffff?text=AK',
alt_text: 'Avatar'
},
{
type: 'mrkdwn',
text: '*Aisha Khan* opened <https://github.com/example/payments/pull/482|#482> in <https://github.com/example/payments|example/payments> · 3 minutes ago'
}
]
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*<https://github.com/example/payments/pull/482|Reconcile webhook retries on idempotency key>* \n_Backports the deterministic retry helper so duplicate `payment.succeeded` events resolve to a single ledger entry. Closes #471._'
},
accessory: {
type: 'image',
image_url: 'https://placehold.co/64x64/0ea5e9/ffffff?text=PR',
alt_text: 'Repository icon'
}
},
{
type: 'rich_text',
elements: [
{
type: 'rich_text_preformatted',
elements: [
{
type: 'text',
text: '- async function handleWebhook(event) {\n- await ledger.insert(event);\n+ async function handleWebhook(event) {\n+ const key = idempotencyKey(event);\n+ await ledger.upsert(key, event);\n+ }'
}
]
}
]
},
{
type: 'table',
column_settings: [{ align: 'left' }, { align: 'right' }, { align: 'right' }, { align: 'center' }],
rows: [
[
{ type: 'raw_text', text: 'File' },
{ type: 'raw_text', text: 'Added' },
{ type: 'raw_text', text: 'Removed' },
{ type: 'raw_text', text: 'CI' }
],
[
{ type: 'raw_text', text: 'src/webhooks/handler.ts' },
{ type: 'raw_text', text: '+42' },
{ type: 'raw_text', text: '−18' },
{ type: 'raw_text', text: '✅' }
],
[
{ type: 'raw_text', text: 'src/lib/idempotency.ts' },
{ type: 'raw_text', text: '+96' },
{ type: 'raw_text', text: '−0' },
{ type: 'raw_text', text: '✅' }
],
[
{ type: 'raw_text', text: 'test/webhooks.test.ts' },
{ type: 'raw_text', text: '+128' },
{ type: 'raw_text', text: '−4' },
{ type: 'raw_text', text: '✅' }
]
]
},
{ type: 'divider' },
{
type: 'actions',
elements: [
{
type: 'users_select',
action_id: 'pr_review_reviewer',
placeholder: { type: 'plain_text', text: 'Pick a reviewer', emoji: true }
},
{
type: 'button',
action_id: 'pr_review_view',
text: { type: 'plain_text', text: 'View pull request', emoji: true },
url: 'https://github.com/example/payments/pull/482',
style: 'primary'
},
{
type: 'overflow',
action_id: 'pr_review_overflow',
options: [
{
text: { type: 'plain_text', text: 'Mute thread', emoji: true },
value: 'mute'
},
{
text: { type: 'plain_text', text: 'Reassign', emoji: true },
value: 'reassign'
},
{
text: { type: 'plain_text', text: 'Copy link', emoji: true },
value: 'copy_link'
}
]
}
]
},
{
type: 'context_actions',
elements: [
{
type: 'feedback_buttons',
action_id: 'pr_review_feedback',
positive_button: {
text: { type: 'plain_text', text: 'Looks good' },
value: 'positive'
},
negative_button: {
text: { type: 'plain_text', text: 'Needs work' },
value: 'negative'
}
},
{
type: 'icon_button',
action_id: 'pr_review_remove',
icon: 'trash',
text: { type: 'plain_text', text: 'Dismiss' }
}
]
}
];
// --- Template 2: Incident report (message) ---------------------------------
const INCIDENT_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'INC-2419 · Checkout latency spike', emoji: true }
},
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: '🔴 *SEV-2* · Investigating · Commander: <@U02INCCMDR> · Started 18 min ago'
}
]
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*Summary*\np95 checkout latency rose from 240ms to 3.1s starting at 14:02 UTC. The spike correlates with the rollout of `payments-svc@v412` to the `us-east-1` cell. Customer-facing impact is limited to the EU and US regions; cart submissions are succeeding after retry.'
}
},
{
type: 'table',
column_settings: [{ align: 'left' }, { align: 'left' }, { align: 'left' }],
rows: [
[
{ type: 'raw_text', text: 'Time (UTC)' },
{ type: 'raw_text', text: 'Event' },
{ type: 'raw_text', text: 'Owner' }
],
[
{ type: 'raw_text', text: '14:02' },
{ type: 'raw_text', text: 'Latency alert fired on /checkout' },
{ type: 'raw_text', text: 'PagerDuty' }
],
[
{ type: 'raw_text', text: '14:06' },
{ type: 'raw_text', text: 'Paged on-call, rolled war room' },
{ type: 'raw_text', text: 'Aisha' }
],
[
{ type: 'raw_text', text: '14:11' },
{ type: 'raw_text', text: 'Identified payments-svc@v412 rollout' },
{ type: 'raw_text', text: 'Marcus' }
],
[
{ type: 'raw_text', text: '14:18' },
{ type: 'raw_text', text: 'Initiated rollback to v411' },
{ type: 'raw_text', text: 'Marcus' }
]
]
},
{ type: 'divider' },
{
type: 'rich_text',
elements: [
{
type: 'rich_text_section',
elements: [{ type: 'text', text: 'Next steps', style: { bold: true } }]
},
{
type: 'rich_text_list',
style: 'bullet',
elements: [
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Watch ' },
{ type: 'text', text: 'rollback', style: { code: true } },
{ type: 'text', text: ' converge across all cells (ETA 15 min).' }
]
},
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Diff the canary metrics for ' },
{ type: 'text', text: 'v411', style: { code: true } },
{ type: 'text', text: ' vs ' },
{ type: 'text', text: 'v412', style: { code: true } },
{ type: 'text', text: ' on the dashboard.' }
]
},
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Open a ' },
{ type: 'text', text: 'post-incident review', style: { italic: true } },
{ type: 'text', text: ' ticket once mitigation is confirmed.' }
]
}
]
}
]
},
{
type: 'actions',
elements: [
{
type: 'button',
action_id: 'incident_acknowledge',
text: { type: 'plain_text', text: 'Acknowledge', emoji: true },
style: 'primary',
confirm: {
title: { type: 'plain_text', text: 'Acknowledge incident?' },
text: {
type: 'plain_text',
text: 'You will be paged for status updates every 15 minutes until mitigation is confirmed.'
},
confirm: { type: 'plain_text', text: 'Acknowledge' },
deny: { type: 'plain_text', text: 'Cancel' }
}
},
{
type: 'datepicker',
action_id: 'incident_eta',
placeholder: { type: 'plain_text', text: 'ETA to mitigation', emoji: true }
},
{
type: 'static_select',
action_id: 'incident_severity',
placeholder: { type: 'plain_text', text: 'Change severity', emoji: true },
initial_option: {
text: { type: 'plain_text', text: 'SEV-2', emoji: true },
value: 'sev2'
},
options: [
{ text: { type: 'plain_text', text: 'SEV-1', emoji: true }, value: 'sev1' },
{ text: { type: 'plain_text', text: 'SEV-2', emoji: true }, value: 'sev2' },
{ text: { type: 'plain_text', text: 'SEV-3', emoji: true }, value: 'sev3' },
{ text: { type: 'plain_text', text: 'SEV-4', emoji: true }, value: 'sev4' }
]
}
]
}
];
// --- Template 3: Expense approval (message) --------------------------------
const EXPENSE_APPROVAL_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Expense report awaiting your approval', emoji: true }
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*Submitted by:* <@U07SAVANNAH>\n*Trip:* Q1 customer offsite — Austin, TX\n*Submitted:* Mar 12, 2026 · Auto-categorized as *Travel & Entertainment*'
},
accessory: {
type: 'image',
image_url: 'https://placehold.co/96x96/16a34a/ffffff?text=Receipt',
alt_text: 'Receipt thumbnail'
}
},
{
type: 'table',
column_settings: [{ align: 'left' }, { align: 'left' }, { align: 'right' }],
rows: [
[
{ type: 'raw_text', text: 'Item' },
{ type: 'raw_text', text: 'Vendor' },
{ type: 'raw_text', text: 'Amount' }
],
[
{ type: 'raw_text', text: 'Flight (SFO→AUS)' },
{ type: 'raw_text', text: 'United' },
{ type: 'raw_text', text: '$418.20' }
],
[
{ type: 'raw_text', text: 'Hotel (3 nights)' },
{ type: 'raw_text', text: 'Marriott' },
{ type: 'raw_text', text: '$612.00' }
],
[
{ type: 'raw_text', text: 'Customer dinner' },
{ type: 'raw_text', text: 'Franklin BBQ' },
{ type: 'raw_text', text: '$184.50' }
],
[
{ type: 'raw_text', text: 'Rideshare (4 trips)' },
{ type: 'raw_text', text: 'Uber' },
{ type: 'raw_text', text: '$87.30' }
]
]
},
{ type: 'divider' },
{
type: 'section',
text: {
type: 'mrkdwn',
text: '*Total:* $1,302.00 USD\n*Policy:* Under T&E cap of $1,500 · <https://example.com/policies/travel|view policy>'
}
},
{
type: 'actions',
elements: [
{
type: 'button',
action_id: 'expense_approve',
text: { type: 'plain_text', text: 'Approve', emoji: true },
style: 'primary',
value: 'approve'
},
{
type: 'button',
action_id: 'expense_reject',
text: { type: 'plain_text', text: 'Reject', emoji: true },
style: 'danger',
value: 'reject',
confirm: {
title: { type: 'plain_text', text: 'Reject this expense?' },
text: {
type: 'plain_text',
text: "The submitter will be notified and asked to revise. You'll be able to leave a comment on the next screen."
},
confirm: { type: 'plain_text', text: 'Reject' },
deny: { type: 'plain_text', text: 'Cancel' },
style: 'danger'
}
},
{
type: 'button',
action_id: 'expense_view_receipts',
text: { type: 'plain_text', text: 'View receipts', emoji: true },
url: 'https://example.com/expenses/EX-9182/receipts'
}
]
}
];
// --- Template 4: Daily standup (message) -----------------------------------
const STANDUP_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Daily standup — Platform team', emoji: true }
},
{
type: 'context',
elements: [
{
type: 'image',
image_url: 'https://placehold.co/24x24/f97316/ffffff?text=JD',
alt_text: 'Avatar'
},
{ type: 'mrkdwn', text: '*Jordan Diaz* · Tuesday, March 17, 2026' }
]
},
{
type: 'rich_text',
elements: [
{
type: 'rich_text_section',
elements: [{ type: 'text', text: 'Yesterday', style: { bold: true } }]
},
{
type: 'rich_text_list',
style: 'bullet',
elements: [
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Shipped the retry helper behind ' },
{ type: 'text', text: 'payments_retry_v2', style: { code: true } },
{ type: 'text', text: ' (10% canary).' }
]
},
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Pair-debugged the flaky integration test with ' },
{ type: 'text', text: '@aisha', style: { bold: true } },
{ type: 'text', text: '.' }
]
}
]
},
{
type: 'rich_text_section',
elements: [{ type: 'text', text: 'Today', style: { bold: true } }]
},
{
type: 'rich_text_list',
style: 'bullet',
elements: [
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Roll out ' },
{ type: 'text', text: 'payments_retry_v2', style: { code: true } },
{ type: 'text', text: ' to 50% if canary metrics stay healthy.' }
]
},
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Write the ' },
{
type: 'link',
url: 'https://example.com/rfcs/idempotency-cache',
text: 'idempotency cache RFC'
},
{ type: 'text', text: '.' }
]
}
]
},
{
type: 'rich_text_section',
elements: [{ type: 'text', text: 'Blockers', style: { bold: true } }]
},
{
type: 'rich_text_list',
style: 'bullet',
elements: [
{
type: 'rich_text_section',
elements: [
{ type: 'text', text: 'Need a review on ' },
{
type: 'link',
url: 'https://github.com/example/payments/pull/482',
text: '#482'
},
{ type: 'text', text: ' before I can roll forward.' }
]
}
]
}
]
},
{ type: 'divider' },
{
type: 'actions',
elements: [
{
type: 'datepicker',
action_id: 'standup_date',
placeholder: { type: 'plain_text', text: 'Pick a date', emoji: true }
},
{
type: 'multi_users_select',
action_id: 'standup_blocked_by',
placeholder: { type: 'plain_text', text: 'Blocked by…', emoji: true }
}
]
},
{
type: 'context_actions',
elements: [
{
type: 'feedback_buttons',
action_id: 'standup_feedback',
positive_button: {
text: { type: 'plain_text', text: '👍' },
value: 'positive'
},
negative_button: {
text: { type: 'plain_text', text: '👎' },
value: 'negative'
}
}
]
}
];
// --- Template 5: Product release (message) ---------------------------------
const PRODUCT_RELEASE_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Acme v2.5 is live 🎉', emoji: true }
},
{
type: 'image',
image_url: 'https://placehold.co/1200x420/6366f1/ffffff?text=Acme+v2.5',
alt_text: 'Acme v2.5 release banner',
title: { type: 'plain_text', text: 'What shipped this month', emoji: true }
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: "The biggest release of the quarter — *bulk edit*, a redesigned inbox, and the new *Insights* panel. Here's the long-form rundown."
}
},
{
type: 'markdown',
text: '## Highlights\n\n- **Bulk edit** — multi-select rows and apply changes inline (Cmd-click to extend).\n- **Inbox 2.0** — threaded conversations, snooze, and saved-views in the sidebar.\n- **Insights** — first-class dashboards for response time, escalations, and CSAT.\n\n## Compatibility\n\n| Surface | Supported | Notes |\n| --- | --- | --- |\n| Web | ✅ | Rolling out over 48h |\n| iOS 17+ | ✅ | App Store update required |\n| Desktop | ✅ | Auto-updates on next restart |\n| Slack app | ✅ | New `/acme inbox` command |\n\nUpgrade is automatic — no migration steps required.'
},
{ type: 'divider' },
{
type: 'carousel',
elements: [
{
type: 'card',
hero_image: {
type: 'image',
image_url: 'https://placehold.co/600x300/4f46e5/ffffff?text=Bulk+edit',
alt_text: 'Bulk edit screenshot'
},
title: { type: 'mrkdwn', text: '*Bulk edit*' },
body: {
type: 'mrkdwn',
text: 'Select dozens of rows and apply changes in one shot. Shift-click to extend a range.'
},
actions: [
{
type: 'button',
action_id: 'release_card_bulk_edit',
text: { type: 'plain_text', text: 'Read the guide', emoji: true },
url: 'https://example.com/docs/bulk-edit'
}
]
},
{
type: 'card',
hero_image: {
type: 'image',
image_url: 'https://placehold.co/600x300/0ea5e9/ffffff?text=Inbox+2.0',
alt_text: 'Inbox 2.0 screenshot'
},
title: { type: 'mrkdwn', text: '*Inbox 2.0*' },
body: {
type: 'mrkdwn',
text: 'Threaded conversations, snooze, and saved-views — all in a redesigned sidebar.'
},
actions: [
{
type: 'button',
action_id: 'release_card_inbox',
text: { type: 'plain_text', text: 'Watch the demo', emoji: true },
url: 'https://example.com/demos/inbox'
}
]
},
{
type: 'card',
hero_image: {
type: 'image',
image_url: 'https://placehold.co/600x300/16a34a/ffffff?text=Insights',
alt_text: 'Insights screenshot'
},
title: { type: 'mrkdwn', text: '*Insights*' },
body: {
type: 'mrkdwn',
text: 'First-class dashboards for response time, escalations, and CSAT — opt in from Settings → Beta.'
},
actions: [
{
type: 'button',
action_id: 'release_card_insights',
text: { type: 'plain_text', text: 'Open Insights', emoji: true },
url: 'https://example.com/insights'
}
]
}
]
},
{
type: 'context',
elements: [{ type: 'mrkdwn', text: '*Acme v2.5* · Released by <@U02PRODUCT> · March 17, 2026' }]
}
];
// --- Template 6: Customer feedback intake (modal) --------------------------
const FEEDBACK_INTAKE_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Send us feedback', emoji: true }
},
{
type: 'alert',
level: 'info',
text: {
type: 'mrkdwn',
text: 'Thanks for taking the time — every field below is optional except *Subject* and *Category*. We read every submission.'
}
},
{ type: 'divider' },
{
type: 'input',
block_id: 'feedback_subject',
label: { type: 'plain_text', text: 'Subject', emoji: true },
element: {
type: 'plain_text_input',
action_id: 'feedback_subject_input',
placeholder: {
type: 'plain_text',
text: 'One sentence on what this is about',
emoji: true
},
max_length: 120
}
},
{
type: 'input',
block_id: 'feedback_category',
label: { type: 'plain_text', text: 'Category', emoji: true },
element: {
type: 'static_select',
action_id: 'feedback_category_select',
placeholder: { type: 'plain_text', text: 'Pick one', emoji: true },
options: [
{ text: { type: 'plain_text', text: 'Bug report', emoji: true }, value: 'bug' },
{
text: { type: 'plain_text', text: 'Feature request', emoji: true },
value: 'feature'
},
{
text: { type: 'plain_text', text: 'Question / how-do-I', emoji: true },
value: 'question'
},
{
text: { type: 'plain_text', text: 'Account / billing', emoji: true },
value: 'billing'
},
{ text: { type: 'plain_text', text: 'Other', emoji: true }, value: 'other' }
]
}
},
{
type: 'input',
block_id: 'feedback_tags',
label: { type: 'plain_text', text: 'Tags', emoji: true },
optional: true,
element: {
type: 'multi_static_select',
action_id: 'feedback_tags_select',
placeholder: { type: 'plain_text', text: 'Pick any that apply', emoji: true },
max_selected_items: 5,
options: [
{ text: { type: 'plain_text', text: 'iOS', emoji: true }, value: 'ios' },
{ text: { type: 'plain_text', text: 'Android', emoji: true }, value: 'android' },
{ text: { type: 'plain_text', text: 'Web', emoji: true }, value: 'web' },
{ text: { type: 'plain_text', text: 'Desktop', emoji: true }, value: 'desktop' },
{ text: { type: 'plain_text', text: 'Slack app', emoji: true }, value: 'slack' },
{ text: { type: 'plain_text', text: 'API', emoji: true }, value: 'api' },
{ text: { type: 'plain_text', text: 'Billing', emoji: true }, value: 'billing' }
]
}
},
{
type: 'input',
block_id: 'feedback_severity',
label: { type: 'plain_text', text: 'How blocking is this?', emoji: true },
element: {
type: 'radio_buttons',
action_id: 'feedback_severity_radio',
options: [
{
text: { type: 'plain_text', text: 'Hard blocker — I cannot work', emoji: true },
value: 'blocker'
},
{
text: { type: 'plain_text', text: 'Annoying but I have a workaround', emoji: true },
value: 'workaround'
},
{
text: { type: 'plain_text', text: 'Nice to have', emoji: true },
value: 'nice_to_have'
}
]
}
},
{
type: 'input',
block_id: 'feedback_areas',
label: { type: 'plain_text', text: 'Affected areas', emoji: true },
optional: true,
element: {
type: 'checkboxes',
action_id: 'feedback_areas_check',
options: [
{ text: { type: 'plain_text', text: 'Inbox', emoji: true }, value: 'inbox' },
{ text: { type: 'plain_text', text: 'Insights', emoji: true }, value: 'insights' },
{ text: { type: 'plain_text', text: 'Bulk edit', emoji: true }, value: 'bulk' },
{ text: { type: 'plain_text', text: 'Notifications', emoji: true }, value: 'notif' }
]
}
},
{
type: 'input',
block_id: 'feedback_description',
label: { type: 'plain_text', text: 'Tell us more', emoji: true },
optional: true,
element: {
type: 'rich_text_input',
action_id: 'feedback_description_rich',
placeholder: {
type: 'plain_text',
text: 'Steps to reproduce, screenshots, or context',
emoji: true
}
}
},
{
type: 'input',
block_id: 'feedback_attachments',
label: { type: 'plain_text', text: 'Screenshots', emoji: true },
optional: true,
element: {
type: 'file_input',
action_id: 'feedback_attachments_file',
max_files: 3
}
},
{
type: 'input',
block_id: 'feedback_contact',
label: { type: 'plain_text', text: 'Best email to reach you', emoji: true },
optional: true,
element: {
type: 'email_text_input',
action_id: 'feedback_contact_email',
placeholder: { type: 'plain_text', text: 'name@example.com', emoji: true }
}
}
];
// --- Template 7: Schedule meeting (modal) ----------------------------------
const SCHEDULE_MEETING_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Schedule a meeting', emoji: true }
},
{
type: 'alert',
level: 'info',
text: {
type: 'mrkdwn',
text: "Attendees will get a calendar invite and a heads-up in the channel you pick. Times are local to each attendee's calendar."
}
},
{
type: 'input',
block_id: 'meeting_title',
label: { type: 'plain_text', text: 'Title', emoji: true },
element: {
type: 'plain_text_input',
action_id: 'meeting_title_input',
placeholder: {
type: 'plain_text',
text: 'Q2 planning sync',
emoji: true
},
max_length: 80
}
},
{
type: 'input',
block_id: 'meeting_attendees',
label: { type: 'plain_text', text: 'Attendees', emoji: true },
element: {
type: 'multi_users_select',
action_id: 'meeting_attendees_select',
placeholder: { type: 'plain_text', text: 'Pick people', emoji: true },
max_selected_items: 12
}
},
{
type: 'input',
block_id: 'meeting_date',
label: { type: 'plain_text', text: 'Date', emoji: true },
element: {
type: 'datepicker',
action_id: 'meeting_date_picker'
}
},
{
type: 'input',
block_id: 'meeting_time',
label: { type: 'plain_text', text: 'Start time', emoji: true },
element: {
type: 'timepicker',
action_id: 'meeting_time_picker'
}
},
{
type: 'input',
block_id: 'meeting_duration',
label: { type: 'plain_text', text: 'Duration (minutes)', emoji: true },
element: {
type: 'number_input',
action_id: 'meeting_duration_input',
is_decimal_allowed: false,
min_value: '15',
max_value: '240',
initial_value: '30'
}
},
{
type: 'input',
block_id: 'meeting_channel',
label: { type: 'plain_text', text: 'Notify channel', emoji: true },
optional: true,
element: {
type: 'channels_select',
action_id: 'meeting_channel_select',
placeholder: { type: 'plain_text', text: 'Optional', emoji: true }
}
},
{
type: 'input',
block_id: 'meeting_link',
label: { type: 'plain_text', text: 'Video link', emoji: true },
optional: true,
element: {
type: 'url_text_input',
action_id: 'meeting_link_input',
placeholder: {
type: 'plain_text',
text: 'https://meet.example.com/...',
emoji: true
}
}
},
{
type: 'input',
block_id: 'meeting_agenda',
label: { type: 'plain_text', text: 'Agenda', emoji: true },
optional: true,
element: {
type: 'rich_text_input',
action_id: 'meeting_agenda_rich',
placeholder: {
type: 'plain_text',
text: 'A few bullets are plenty',
emoji: true
}
}
},
{ type: 'divider' },
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: ':lock: Only the people you invite will see this meeting in their calendar.'
}
]
}
];
// --- Template 8: Confirm destructive action (modal) ------------------------
const CONFIRM_DESTRUCTIVE_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Delete workspace', emoji: true }
},
{
type: 'alert',
level: 'warning',
text: {
type: 'mrkdwn',
text: '*This action is permanent.* Deleting a workspace removes every channel, message, file, and integration. Exports and audit logs are kept for 30 days, then purged.'
}
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: 'You are about to delete *Acme — Marketing*. To confirm, type the workspace name below exactly.'
}
},
{
type: 'input',
block_id: 'confirm_workspace_name',
label: { type: 'plain_text', text: 'Type the workspace name', emoji: true },
element: {
type: 'plain_text_input',
action_id: 'confirm_workspace_name_input',
placeholder: { type: 'plain_text', text: 'Acme — Marketing', emoji: true }
}
},
{
type: 'context',
elements: [
{
type: 'mrkdwn',
text: 'Need an export first? <https://example.com/workspaces/export|Generate a workspace export>.'
}
]
}
];
// --- Template 9: Welcome / onboarding (app_home) ---------------------------
const WELCOME_HOME_BLOCKS: SupportedBlock[] = [
{
type: 'header',
text: { type: 'plain_text', text: 'Welcome to Acme for Slack 👋', emoji: true }
},
{
type: 'image',
image_url: 'https://placehold.co/1200x320/6366f1/ffffff?text=Welcome+to+Acme',
alt_text: 'Welcome hero illustration'
},
{
type: 'section',
text: {
type: 'mrkdwn',
text: "*You're almost set up.* Knock out the three steps below and your team will start getting Acme updates right in Slack."
}
},
{ type: 'divider' },
{
type: 'rich_text',
elements: [
{
type: 'rich_text_section',
elements: [{ type: 'text', text: 'Getting started', style: { bold: true } }]
},
{
type: 'rich_text_list',
style: 'ordered',
elements: [
{
type: 'rich_text_section',