@@ -243,6 +243,100 @@ export class CloudAnnouncementsModule implements IUiKitCoreApp {
243
243
...userInteraction ,
244
244
} ;
245
245
246
+ if (
247
+ userInteraction . type === 'blockAction' &&
248
+ userInteraction . container ?. type === 'view' &&
249
+ userInteraction . actionId === 'callout-action' &&
250
+ userInteraction . container ?. id === 'subscription-announcement'
251
+ ) {
252
+ return {
253
+ type : 'modal.open' ,
254
+ triggerId : userInteraction . triggerId ,
255
+ appId : this . appId ,
256
+ view : {
257
+ showIcon : false ,
258
+ id : userInteraction . container . id ,
259
+ title : {
260
+ type : 'plain_text' ,
261
+ text : 'Hello from Cloud' ,
262
+ } ,
263
+ blocks : [
264
+ {
265
+ type : 'image' ,
266
+ title : {
267
+ type : 'plain_text' ,
268
+ text : 'I Need a Marg' ,
269
+ emoji : true ,
270
+ } ,
271
+ imageUrl : 'https://picsum.photos/200/300' ,
272
+ altText : 'marg' ,
273
+ } ,
274
+ {
275
+ type : 'context' ,
276
+ elements : [
277
+ {
278
+ type : 'mrkdwn' ,
279
+ text : '*This* is :smile: markdown' ,
280
+ } ,
281
+ ] ,
282
+ } ,
283
+ ] ,
284
+ appId : this . appId ,
285
+ // export type ButtonElement = Actionable<{
286
+ // type: 'button';
287
+ // text: PlainText;
288
+ // url?: string;
289
+ // value?: string;
290
+ // style?: 'primary' | 'secondary' | 'danger' | 'warning' | 'success';
291
+ // secondary?: boolean;
292
+ // }>;
293
+
294
+ close : {
295
+ appId : this . appId ,
296
+ blockId : userInteraction . container . id ,
297
+ type : 'button' ,
298
+ text : {
299
+ type : 'plain_text' ,
300
+ text : 'Close' ,
301
+ emoji : true ,
302
+ } ,
303
+ actionId : 'close-modal' ,
304
+ url : 'https://rocket.chat' ,
305
+ } ,
306
+ submit : {
307
+ appId : this . appId ,
308
+ blockId : userInteraction . container . id ,
309
+ type : 'button' ,
310
+ text : {
311
+ type : 'plain_text' ,
312
+ text : 'Submit' ,
313
+ emoji : true ,
314
+ } ,
315
+ actionId : 'submit-modal' ,
316
+ url : 'https://rocket.chat' ,
317
+ } ,
318
+ } ,
319
+ } ;
320
+ }
321
+
322
+ if (
323
+ userInteraction . type === 'blockAction' &&
324
+ userInteraction . container ?. type === 'view' &&
325
+ ( userInteraction . actionId === 'submit-modal' || userInteraction . actionId === 'close-modal' )
326
+ ) {
327
+ if ( userInteraction . actionId === 'submit-modal' ) {
328
+ await syncWorkspace ( ) ;
329
+ }
330
+
331
+ return {
332
+ type : 'modal.close' ,
333
+ triggerId : userInteraction . triggerId ,
334
+ appId : this . appId ,
335
+ } ;
336
+ }
337
+
338
+ console . log ( userInteraction ) ;
339
+
246
340
const response = await fetch ( `${ this . getCloudUrl ( ) } /api/v3/comms/workspace/interaction` , {
247
341
method : 'POST' ,
248
342
headers : {
0 commit comments