Products Dashboard

Dashboard for your products, stock levels and others

json · 1284 lines
1
{
2
  "summary": "Products Dashboard",
3
  "value": {
4
    "grid": [
5
      {
6
        "3": {
7
          "h": 10,
8
          "w": 3,
9
          "x": 0,
10
          "y": 1,
11
          "id": "a",
12
          "max": {
13
            "h": 100,
14
            "w": 3
15
          },
16
          "min": {
17
            "h": 1,
18
            "w": 1
19
          },
20
          "fixed": false,
21
          "draggable": true,
22
          "resizable": true,
23
          "customDragger": false,
24
          "customResizer": false
25
        },
26
        "12": {
27
          "h": 15,
28
          "w": 8,
29
          "x": 0,
30
          "y": 2,
31
          "id": "a",
32
          "max": {
33
            "h": 100,
34
            "w": 12
35
          },
36
          "min": {
37
            "h": 1,
38
            "w": 1
39
          },
40
          "fixed": false,
41
          "draggable": true,
42
          "resizable": true,
43
          "customDragger": false,
44
          "customResizer": false
45
        },
46
        "id": "a",
47
        "data": {
48
          "id": "a",
49
          "card": true,
50
          "type": "tablecomponent",
51
          "actionButtons": [],
52
          "configuration": {
53
            "search": {
54
              "type": "static",
55
              "value": "Disabled",
56
              "fieldType": "select",
57
              "onlyStatic": true,
58
              "optionValuesKey": "tableSearchOptions"
59
            }
60
          },
61
          "componentInput": {
62
            "type": "runnable",
63
            "value": [
64
              {
65
                "id": 1,
66
                "brand": "Apple",
67
                "price": 549,
68
                "stock": 94,
69
                "title": "iPhone 9",
70
                "rating": 4.69,
71
                "category": "smartphones",
72
                "discountPercentage": 12.96
73
              },
74
              {
75
                "id": 2,
76
                "brand": "Apple",
77
                "price": 899,
78
                "stock": 34,
79
                "title": "iPhone X",
80
                "rating": 4.44,
81
                "category": "smartphones",
82
                "discountPercentage": 17.94
83
              },
84
              {
85
                "id": 3,
86
                "brand": "Samsung",
87
                "price": 1249,
88
                "stock": 36,
89
                "title": "Samsung Universe 9",
90
                "rating": 4.09,
91
                "category": "smartphones",
92
                "discountPercentage": 15.46
93
              },
94
              {
95
                "id": 4,
96
                "brand": "OPPO",
97
                "price": 280,
98
                "stock": 123,
99
                "title": "OPPOF19",
100
                "rating": 4.3,
101
                "category": "smartphones",
102
                "discountPercentage": 17.91
103
              },
104
              {
105
                "id": 5,
106
                "brand": "Huawei",
107
                "price": 499,
108
                "stock": 32,
109
                "title": "Huawei P30",
110
                "rating": 4.09,
111
                "category": "smartphones",
112
                "discountPercentage": 10.58
113
              },
114
              {
115
                "id": 6,
116
                "brand": "APPle",
117
                "price": 1749,
118
                "stock": 83,
119
                "title": "MacBook Pro",
120
                "rating": 4.57,
121
                "category": "laptops",
122
                "discountPercentage": 11.02
123
              },
124
              {
125
                "id": 7,
126
                "brand": "Samsung",
127
                "price": 1499,
128
                "stock": 50,
129
                "title": "Samsung Galaxy Book",
130
                "rating": 4.25,
131
                "category": "laptops",
132
                "discountPercentage": 4.15
133
              },
134
              {
135
                "id": 8,
136
                "brand": "Microsoft Surface",
137
                "price": 1499,
138
                "stock": 68,
139
                "title": "Microsoft Surface Laptop 4",
140
                "rating": 4.43,
141
                "category": "laptops",
142
                "discountPercentage": 10.23
143
              },
144
              {
145
                "id": 9,
146
                "brand": "Infinix",
147
                "price": 1099,
148
                "stock": 96,
149
                "title": "Infinix INBOOK",
150
                "rating": 4.54,
151
                "category": "laptops",
152
                "discountPercentage": 11.83
153
              },
154
              {
155
                "id": 10,
156
                "brand": "HP Pavilion",
157
                "price": 1099,
158
                "stock": 89,
159
                "title": "HP Pavilion 15-DK1056WM",
160
                "rating": 4.43,
161
                "category": "laptops",
162
                "discountPercentage": 6.18
163
              },
164
              {
165
                "id": 11,
166
                "brand": "Impression of Acqua Di Gio",
167
                "price": 13,
168
                "stock": 65,
169
                "title": "perfume Oil",
170
                "rating": 4.26,
171
                "category": "fragrances",
172
                "discountPercentage": 8.4
173
              },
174
              {
175
                "id": 12,
176
                "brand": "Royal_Mirage",
177
                "price": 40,
178
                "stock": 52,
179
                "title": "Brown Perfume",
180
                "rating": 4,
181
                "category": "fragrances",
182
                "discountPercentage": 15.66
183
              },
184
              {
185
                "id": 13,
186
                "brand": "Fog Scent Xpressio",
187
                "price": 13,
188
                "stock": 61,
189
                "title": "Fog Scent Xpressio Perfume",
190
                "rating": 4.59,
191
                "category": "fragrances",
192
                "discountPercentage": 8.14
193
              },
194
              {
195
                "id": 14,
196
                "brand": "Al Munakh",
197
                "price": 120,
198
                "stock": 114,
199
                "title": "Non-Alcoholic Concentrated Perfume Oil",
200
                "rating": 4.21,
201
                "category": "fragrances",
202
                "discountPercentage": 15.6
203
              },
204
              {
205
                "id": 15,
206
                "brand": "Lord - Al-Rehab",
207
                "price": 30,
208
                "stock": 105,
209
                "title": "Eau De Perfume Spray",
210
                "rating": 4.7,
211
                "category": "fragrances",
212
                "discountPercentage": 10.99
213
              },
214
              {
215
                "id": 16,
216
                "brand": "L'Oreal Paris",
217
                "price": 19,
218
                "stock": 110,
219
                "title": "Hyaluronic Acid Serum",
220
                "rating": 4.83,
221
                "category": "skincare",
222
                "discountPercentage": 13.31
223
              },
224
              {
225
                "id": 17,
226
                "brand": "Hemani Tea",
227
                "price": 12,
228
                "stock": 78,
229
                "title": "Tree Oil 30ml",
230
                "rating": 4.52,
231
                "category": "skincare",
232
                "discountPercentage": 4.09
233
              },
234
              {
235
                "id": 18,
236
                "brand": "Dermive",
237
                "price": 40,
238
                "stock": 88,
239
                "title": "Oil Free Moisturizer 100ml",
240
                "rating": 4.56,
241
                "category": "skincare",
242
                "discountPercentage": 13.1
243
              },
244
              {
245
                "id": 19,
246
                "brand": "ROREC White Rice",
247
                "price": 46,
248
                "stock": 54,
249
                "title": "Skin Beauty Serum.",
250
                "rating": 4.42,
251
                "category": "skincare",
252
                "discountPercentage": 10.68
253
              },
254
              {
255
                "id": 20,
256
                "brand": "Fair & Clear",
257
                "price": 70,
258
                "stock": 140,
259
                "title": "Freckle Treatment Cream- 15gm",
260
                "rating": 4.06,
261
                "category": "skincare",
262
                "discountPercentage": 16.99
263
              },
264
              {
265
                "id": 21,
266
                "brand": "Saaf & Khaas",
267
                "price": 20,
268
                "stock": 133,
269
                "title": "- Daal Masoor 500 grams",
270
                "rating": 4.44,
271
                "category": "groceries",
272
                "discountPercentage": 4.81
273
              },
274
              {
275
                "id": 22,
276
                "brand": "Bake Parlor Big",
277
                "price": 14,
278
                "stock": 146,
279
                "title": "Elbow Macaroni - 400 gm",
280
                "rating": 4.57,
281
                "category": "groceries",
282
                "discountPercentage": 15.58
283
              },
284
              {
285
                "id": 23,
286
                "brand": "Baking Food Items",
287
                "price": 14,
288
                "stock": 26,
289
                "title": "Orange Essence Food Flavou",
290
                "rating": 4.85,
291
                "category": "groceries",
292
                "discountPercentage": 8.04
293
              },
294
              {
295
                "id": 24,
296
                "brand": "fauji",
297
                "price": 46,
298
                "stock": 113,
299
                "title": "cereals muesli fruit nuts",
300
                "rating": 4.94,
301
                "category": "groceries",
302
                "discountPercentage": 16.8
303
              },
304
              {
305
                "id": 25,
306
                "brand": "Dry Rose",
307
                "price": 70,
308
                "stock": 47,
309
                "title": "Gulab Powder 50 Gram",
310
                "rating": 4.87,
311
                "category": "groceries",
312
                "discountPercentage": 13.58
313
              },
314
              {
315
                "id": 26,
316
                "brand": "Boho Decor",
317
                "price": 41,
318
                "stock": 131,
319
                "title": "Plant Hanger For Home",
320
                "rating": 4.08,
321
                "category": "home-decoration",
322
                "discountPercentage": 17.86
323
              },
324
              {
325
                "id": 27,
326
                "brand": "Flying Wooden",
327
                "price": 51,
328
                "stock": 17,
329
                "title": "Flying Wooden Bird",
330
                "rating": 4.41,
331
                "category": "home-decoration",
332
                "discountPercentage": 15.58
333
              },
334
              {
335
                "id": 28,
336
                "brand": "LED Lights",
337
                "price": 20,
338
                "stock": 54,
339
                "title": "3D Embellishment Art Lamp",
340
                "rating": 4.82,
341
                "category": "home-decoration",
342
                "discountPercentage": 16.49
343
              },
344
              {
345
                "id": 29,
346
                "brand": "luxury palace",
347
                "price": 60,
348
                "stock": 7,
349
                "title": "Handcraft Chinese style",
350
                "rating": 4.44,
351
                "category": "home-decoration",
352
                "discountPercentage": 15.34
353
              },
354
              {
355
                "id": 30,
356
                "brand": "Golden",
357
                "price": 30,
358
                "stock": 54,
359
                "title": "Key Holder",
360
                "rating": 4.92,
361
                "category": "home-decoration",
362
                "discountPercentage": 2.92
363
              }
364
            ],
365
            "fields": {},
366
            "runnable": {
367
              "name": "All Product Data",
368
              "type": "runnableByName",
369
              "inlineScript": {
370
                "path": "/inline-script/Inline Script 0",
371
                "schema": {
372
                  "type": "object",
373
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
374
                  "required": [],
375
                  "properties": {}
376
                },
377
                "content": "export async function main() {\n  const res = await fetch('https://dummyjson.com/products')\n  const json = await res.json()\n  return json.products.map((p: Record<string, any>) => {\n    delete p.images\n    delete p.thumbnail\n    delete p.description\n    return p\n  })\n}\n",
378
                "language": "deno"
379
              }
380
            },
381
            "fieldType": "array",
382
            "connection": {
383
              "path": "result",
384
              "componentId": "c"
385
            },
386
            "subFieldType": "object"
387
          }
388
        }
389
      },
390
      {
391
        "3": {
392
          "h": 1,
393
          "w": 3,
394
          "x": 0,
395
          "y": 0,
396
          "id": "b",
397
          "max": {
398
            "h": 100,
399
            "w": 3
400
          },
401
          "min": {
402
            "h": 1,
403
            "w": 1
404
          },
405
          "fixed": false,
406
          "draggable": true,
407
          "resizable": true,
408
          "customDragger": false,
409
          "customResizer": false
410
        },
411
        "12": {
412
          "h": 2,
413
          "w": 12,
414
          "x": 0,
415
          "y": 0,
416
          "id": "b",
417
          "max": {
418
            "h": 100,
419
            "w": 12
420
          },
421
          "min": {
422
            "h": 1,
423
            "w": 1
424
          },
425
          "fixed": false,
426
          "draggable": true,
427
          "resizable": true,
428
          "customDragger": false,
429
          "customResizer": false
430
        },
431
        "id": "b",
432
        "data": {
433
          "id": "b",
434
          "card": false,
435
          "type": "textcomponent",
436
          "softWrap": true,
437
          "configuration": {
438
            "style": {
439
              "type": "static",
440
              "value": "Title",
441
              "fieldType": "select",
442
              "onlyStatic": true,
443
              "optionValuesKey": "textStyleOptions"
444
            },
445
            "extraStyle": {
446
              "type": "static",
447
              "value": "padding-left:10px;",
448
              "fieldType": "text"
449
            }
450
          },
451
          "componentInput": {
452
            "eval": "Product table",
453
            "type": "template",
454
            "value": "Hello ${ctx.username}",
455
            "fieldType": "template"
456
          },
457
          "verticalAlignment": "center",
458
          "horizontalAlignment": "left"
459
        }
460
      },
461
      {
462
        "3": {
463
          "h": 12,
464
          "w": 3,
465
          "x": 0,
466
          "y": 11,
467
          "id": "d",
468
          "max": {
469
            "h": 100,
470
            "w": 3
471
          },
472
          "min": {
473
            "h": 1,
474
            "w": 1
475
          },
476
          "fixed": false,
477
          "draggable": true,
478
          "resizable": true,
479
          "customDragger": false,
480
          "customResizer": false
481
        },
482
        "12": {
483
          "h": 15,
484
          "w": 4,
485
          "x": 8,
486
          "y": 2,
487
          "id": "d",
488
          "max": {
489
            "h": 100,
490
            "w": 12
491
          },
492
          "min": {
493
            "h": 1,
494
            "w": 1
495
          },
496
          "fixed": false,
497
          "draggable": true,
498
          "resizable": true,
499
          "customDragger": false,
500
          "customResizer": false
501
        },
502
        "id": "d",
503
        "data": {
504
          "id": "d",
505
          "card": false,
506
          "type": "htmlcomponent",
507
          "softWrap": false,
508
          "configuration": {},
509
          "componentInput": {
510
            "eval": "<img\n\tsrc=\"https://images.unsplash.com/photo-1554629947-334ff61d85dc?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=1024&amp;h=1280&amp;q=80\"\n>\n<div class=\"absolute top-4 left-2  text-white\">\n\tHello ${ctx.username}\n</div>\t\t\t\n",
511
            "type": "runnable",
512
            "value": "\n    <p class=\"text-sm text-gray-600 text-center pt-8\">\n      Select a row from the table\n    </p>\n    ",
513
            "fields": {
514
              "id": {
515
                "type": "connected",
516
                "value": null,
517
                "visible": true,
518
                "fieldType": "number",
519
                "connection": {
520
                  "path": "selectedRow.id",
521
                  "componentId": "a"
522
                }
523
              }
524
            },
525
            "runnable": {
526
              "name": "One Product Detail",
527
              "type": "runnableByName",
528
              "inlineScript": {
529
                "path": "/inline-script/Inline Script 0",
530
                "schema": {
531
                  "type": "object",
532
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
533
                  "required": [
534
                    "id"
535
                  ],
536
                  "properties": {
537
                    "id": {
538
                      "type": "number",
539
                      "default": null,
540
                      "description": ""
541
                    }
542
                  }
543
                },
544
                "content": "export async function main(id: number) {\n  if(!id) {\n    return `\n    <p class=\"text-sm text-gray-600 text-center pt-8\">\n      Select a row from the table\n    </p>\n    `\n  }\n  const res = await fetch('https://dummyjson.com/products/' + id)\n  const { brand, title, thumbnail, description } = await res.json()\n  return `\n  <img width=\"363\" height=\"200\" src=\"${thumbnail}\">\n  <p class=\"text-lg font-bold my-1\">\n    ${brand} ${title}\n  </p>\n  <p>\n    ${description}\n  </p>\n  `\n}\n",
545
                "language": "deno"
546
              }
547
            },
548
            "fieldType": "template"
549
          }
550
        }
551
      },
552
      {
553
        "3": {
554
          "h": 8,
555
          "w": 2,
556
          "x": 0,
557
          "y": 23,
558
          "max": {
559
            "h": 100,
560
            "w": 3
561
          },
562
          "min": {
563
            "h": 1,
564
            "w": 1
565
          },
566
          "fixed": false,
567
          "draggable": true,
568
          "resizable": true,
569
          "customDragger": false,
570
          "customResizer": false
571
        },
572
        "12": {
573
          "h": 8,
574
          "w": 6,
575
          "x": 0,
576
          "y": 19,
577
          "id": "e",
578
          "max": {
579
            "h": 100,
580
            "w": 12
581
          },
582
          "min": {
583
            "h": 1,
584
            "w": 1
585
          },
586
          "fixed": false,
587
          "draggable": true,
588
          "resizable": true,
589
          "customDragger": false,
590
          "customResizer": false
591
        },
592
        "id": "e",
593
        "data": {
594
          "id": "e",
595
          "card": true,
596
          "type": "barchartcomponent",
597
          "configuration": {
598
            "line": {
599
              "type": "static",
600
              "value": false,
601
              "fieldType": "boolean",
602
              "onlyStatic": true
603
            },
604
            "theme": {
605
              "type": "static",
606
              "value": "theme1",
607
              "fieldType": "select",
608
              "onlyStatic": true,
609
              "optionValuesKey": "chartThemeOptions"
610
            }
611
          },
612
          "componentInput": {
613
            "type": "runnable",
614
            "value": {
615
              "data": [
616
                5,
617
                5,
618
                5,
619
                5,
620
                5,
621
                5
622
              ],
623
              "labels": [
624
                "smartphones",
625
                "laptops",
626
                "fragrances",
627
                "skincare",
628
                "groceries",
629
                "home-decoration"
630
              ]
631
            },
632
            "fields": {
633
              "data": {
634
                "type": "connected",
635
                "value": null,
636
                "fieldType": "array",
637
                "connection": {
638
                  "path": "result",
639
                  "componentId": "a"
640
                }
641
              }
642
            },
643
            "runnable": {
644
              "name": "Product Category Count",
645
              "type": "runnableByName",
646
              "inlineScript": {
647
                "path": "u/adam/products-app/inline-script/Inline Script 0",
648
                "schema": {
649
                  "type": "object",
650
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
651
                  "required": [
652
                    "data"
653
                  ],
654
                  "properties": {
655
                    "data": {
656
                      "type": "array",
657
                      "items": {
658
                        "type": "string"
659
                      },
660
                      "default": null,
661
                      "properties": {
662
                        "category": {
663
                          "type": "string",
664
                          "description": ""
665
                        }
666
                      },
667
                      "description": ""
668
                    }
669
                  }
670
                },
671
                "content": "export async function main(data: {category: string}[]) {\n  const result: {data: number[], labels: string[]} = {\n    data: [],\n    labels: []\n  }\n  if(!Array.isArray(data)) { return result }\n\n  const count: Record<string, number> = {}\n  data.forEach(({category}) => {\n    if(count[category]) {\n      count[category]++\n    } else {\n      count[category] = 1\n    }\n  })\n  Object.entries(count).forEach(([key, value]) => {\n    result.data.push(value)\n    result.labels.push(key)\n  })\n  return result\n}\n",
672
                "language": "deno"
673
              }
674
            },
675
            "fieldType": "object"
676
          }
677
        }
678
      },
679
      {
680
        "3": {
681
          "h": 8,
682
          "w": 2,
683
          "x": 0,
684
          "y": 31,
685
          "max": {
686
            "h": 100,
687
            "w": 3
688
          },
689
          "min": {
690
            "h": 1,
691
            "w": 1
692
          },
693
          "fixed": false,
694
          "draggable": true,
695
          "resizable": true,
696
          "customDragger": false,
697
          "customResizer": false
698
        },
699
        "12": {
700
          "h": 9,
701
          "w": 6,
702
          "x": 6,
703
          "y": 19,
704
          "id": "f",
705
          "max": {
706
            "h": 100,
707
            "w": 12
708
          },
709
          "min": {
710
            "h": 1,
711
            "w": 1
712
          },
713
          "fixed": false,
714
          "draggable": true,
715
          "resizable": true,
716
          "customDragger": false,
717
          "customResizer": false
718
        },
719
        "id": "f",
720
        "data": {
721
          "id": "f",
722
          "card": true,
723
          "type": "barchartcomponent",
724
          "configuration": {
725
            "line": {
726
              "type": "static",
727
              "value": false,
728
              "fieldType": "boolean",
729
              "onlyStatic": true
730
            },
731
            "theme": {
732
              "type": "static",
733
              "value": "theme1",
734
              "fieldType": "select",
735
              "onlyStatic": true,
736
              "optionValuesKey": "chartThemeOptions"
737
            }
738
          },
739
          "componentInput": {
740
            "type": "runnable",
741
            "value": {
742
              "data": [
743
                3,
744
                2,
745
                1,
746
                1,
747
                1,
748
                1,
749
                1,
750
                1,
751
                1,
752
                1,
753
                1,
754
                1,
755
                1,
756
                1,
757
                1,
758
                1,
759
                1,
760
                1,
761
                1,
762
                1,
763
                1,
764
                1,
765
                1,
766
                1,
767
                1,
768
                1,
769
                1
770
              ],
771
              "labels": [
772
                "apple",
773
                "samsung",
774
                "oppo",
775
                "huawei",
776
                "microsoft surface",
777
                "infinix",
778
                "hp pavilion",
779
                "impression of acqua di gio",
780
                "royal_mirage",
781
                "fog scent xpressio",
782
                "al munakh",
783
                "lord - al-rehab",
784
                "l'oreal paris",
785
                "hemani tea",
786
                "dermive",
787
                "rorec white rice",
788
                "fair & clear",
789
                "saaf & khaas",
790
                "bake parlor big",
791
                "baking food items",
792
                "fauji",
793
                "dry rose",
794
                "boho decor",
795
                "flying wooden",
796
                "led lights",
797
                "luxury palace",
798
                "golden"
799
              ]
800
            },
801
            "fields": {
802
              "data": {
803
                "type": "connected",
804
                "value": null,
805
                "fieldType": "array",
806
                "connection": {
807
                  "path": "result",
808
                  "componentId": "a"
809
                }
810
              }
811
            },
812
            "runnable": {
813
              "name": "Product Brand Count",
814
              "type": "runnableByName",
815
              "inlineScript": {
816
                "path": "u/adam/products-app/inline-script/Inline Script 0",
817
                "schema": {
818
                  "type": "object",
819
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
820
                  "required": [
821
                    "data"
822
                  ],
823
                  "properties": {
824
                    "data": {
825
                      "type": "array",
826
                      "items": {
827
                        "type": "string"
828
                      },
829
                      "default": null,
830
                      "description": ""
831
                    }
832
                  }
833
                },
834
                "content": "export async function main(data: {brand: string}[]) {\n  const result: {data: number[], labels: string[]} = {\n    data: [],\n    labels: []\n  }\n  if(!Array.isArray(data)) { return result }\n\n  const count: Record<string, number> = {}\n  data.forEach(({brand}) => {\n    brand = brand.toLowerCase()\n    if(count[brand]) {\n      count[brand]++\n    } else {\n      count[brand] = 1\n    }\n  })\n  Object.entries(count).forEach(([key, value]) => {\n    result.data.push(value)\n    result.labels.push(key)\n  })\n  return result\n}\n",
835
                "language": "deno"
836
              }
837
            },
838
            "fieldType": "object"
839
          }
840
        }
841
      },
842
      {
843
        "3": {
844
          "h": 1,
845
          "w": 1,
846
          "x": 2,
847
          "y": 23,
848
          "max": {
849
            "h": 100,
850
            "w": 3
851
          },
852
          "min": {
853
            "h": 1,
854
            "w": 1
855
          },
856
          "fixed": false,
857
          "draggable": true,
858
          "resizable": true,
859
          "customDragger": false,
860
          "customResizer": false
861
        },
862
        "12": {
863
          "h": 2,
864
          "w": 6,
865
          "x": 0,
866
          "y": 17,
867
          "id": "h",
868
          "max": {
869
            "h": 100,
870
            "w": 12
871
          },
872
          "min": {
873
            "h": 1,
874
            "w": 1
875
          },
876
          "fixed": false,
877
          "draggable": true,
878
          "resizable": true,
879
          "customDragger": false,
880
          "customResizer": false
881
        },
882
        "id": "h",
883
        "data": {
884
          "id": "h",
885
          "card": false,
886
          "type": "textcomponent",
887
          "softWrap": true,
888
          "configuration": {
889
            "style": {
890
              "type": "static",
891
              "value": "Subtitle",
892
              "fieldType": "select",
893
              "onlyStatic": true,
894
              "optionValuesKey": "textStyleOptions"
895
            },
896
            "copyButton": {
897
              "type": "static",
898
              "value": false,
899
              "fieldType": "boolean",
900
              "onlyStatic": true
901
            },
902
            "extraStyle": {
903
              "type": "static",
904
              "value": "",
905
              "tooltip": "CSS rules like \"color: blue;\"",
906
              "fieldType": "text"
907
            }
908
          },
909
          "componentInput": {
910
            "eval": "Product Count By Categories",
911
            "type": "template",
912
            "value": "Hello ${ctx.username}",
913
            "fieldType": "template"
914
          },
915
          "verticalAlignment": "bottom",
916
          "horizontalAlignment": "left"
917
        }
918
      },
919
      {
920
        "3": {
921
          "h": 1,
922
          "w": 1,
923
          "x": 2,
924
          "y": 24,
925
          "max": {
926
            "h": 100,
927
            "w": 3
928
          },
929
          "min": {
930
            "h": 1,
931
            "w": 1
932
          },
933
          "fixed": false,
934
          "draggable": true,
935
          "resizable": true,
936
          "customDragger": false,
937
          "customResizer": false
938
        },
939
        "12": {
940
          "h": 2,
941
          "w": 6,
942
          "x": 6,
943
          "y": 17,
944
          "id": "i",
945
          "max": {
946
            "h": 100,
947
            "w": 12
948
          },
949
          "min": {
950
            "h": 1,
951
            "w": 1
952
          },
953
          "fixed": false,
954
          "draggable": true,
955
          "resizable": true,
956
          "customDragger": false,
957
          "customResizer": false
958
        },
959
        "id": "i",
960
        "data": {
961
          "id": "i",
962
          "card": false,
963
          "type": "textcomponent",
964
          "softWrap": true,
965
          "configuration": {
966
            "style": {
967
              "type": "static",
968
              "value": "Subtitle",
969
              "fieldType": "select",
970
              "onlyStatic": true,
971
              "optionValuesKey": "textStyleOptions"
972
            },
973
            "copyButton": {
974
              "type": "static",
975
              "value": false,
976
              "fieldType": "boolean",
977
              "onlyStatic": true
978
            },
979
            "extraStyle": {
980
              "type": "static",
981
              "value": "",
982
              "tooltip": "CSS rules like \"color: blue;\"",
983
              "fieldType": "text"
984
            }
985
          },
986
          "componentInput": {
987
            "eval": "Product Count By Brands",
988
            "type": "template",
989
            "value": "Hello ${ctx.username}",
990
            "fieldType": "template"
991
          },
992
          "verticalAlignment": "bottom",
993
          "horizontalAlignment": "left"
994
        }
995
      },
996
      {
997
        "3": {
998
          "h": 1,
999
          "w": 1,
1000
          "x": 2,
1001
          "y": 25,
1002
          "max": {
1003
            "h": 100,
1004
            "w": 3
1005
          },
1006
          "min": {
1007
            "h": 1,
1008
            "w": 1
1009
          },
1010
          "fixed": false,
1011
          "draggable": true,
1012
          "resizable": true,
1013
          "customDragger": false,
1014
          "customResizer": false
1015
        },
1016
        "12": {
1017
          "h": 2,
1018
          "w": 12,
1019
          "x": 0,
1020
          "y": 28,
1021
          "id": "j",
1022
          "max": {
1023
            "h": 100,
1024
            "w": 12
1025
          },
1026
          "min": {
1027
            "h": 1,
1028
            "w": 1
1029
          },
1030
          "fixed": false,
1031
          "draggable": true,
1032
          "resizable": true,
1033
          "customDragger": false,
1034
          "customResizer": false
1035
        },
1036
        "id": "j",
1037
        "data": {
1038
          "id": "j",
1039
          "card": false,
1040
          "type": "textcomponent",
1041
          "softWrap": true,
1042
          "configuration": {
1043
            "style": {
1044
              "type": "static",
1045
              "value": "Subtitle",
1046
              "fieldType": "select",
1047
              "onlyStatic": true,
1048
              "optionValuesKey": "textStyleOptions"
1049
            },
1050
            "copyButton": {
1051
              "type": "static",
1052
              "value": false,
1053
              "fieldType": "boolean",
1054
              "onlyStatic": true
1055
            },
1056
            "extraStyle": {
1057
              "type": "static",
1058
              "value": "",
1059
              "tooltip": "CSS rules like \"color: blue;\"",
1060
              "fieldType": "text"
1061
            }
1062
          },
1063
          "componentInput": {
1064
            "eval": "Stock Worth By Product",
1065
            "type": "runnable",
1066
            "value": "Stock Worth By Product (Total Worth: $765,200)",
1067
            "fields": {
1068
              "data": {
1069
                "type": "connected",
1070
                "value": null,
1071
                "fieldType": "array",
1072
                "connection": {
1073
                  "path": "result",
1074
                  "componentId": "a"
1075
                }
1076
              }
1077
            },
1078
            "runnable": {
1079
              "name": "Stock Worth Title",
1080
              "type": "runnableByName",
1081
              "inlineScript": {
1082
                "path": "u/adam/products-app/inline-script/Inline Script 0",
1083
                "schema": {
1084
                  "type": "object",
1085
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
1086
                  "required": [
1087
                    "data"
1088
                  ],
1089
                  "properties": {
1090
                    "data": {
1091
                      "type": "array",
1092
                      "items": {
1093
                        "type": "string"
1094
                      },
1095
                      "default": null,
1096
                      "description": ""
1097
                    }
1098
                  }
1099
                },
1100
                "content": "export async function main(data: {stock: number, price: number}[]) {\n  const base = 'Stock Worth By Product'\n  if(!Array.isArray(data)) { return base }\n\n  const total = data.map(row => row.stock * row.price).reduce((acc, curr) => acc + curr)\n  const formatter = new Intl.NumberFormat('en-US', {\n    style: 'currency',\n    currency: 'USD',\n    maximumFractionDigits: 0,\n  });\n  return base + ` (Total Worth: ${formatter.format(total)})`\n}\n",
1101
                "language": "deno"
1102
              }
1103
            },
1104
            "fieldType": "template"
1105
          },
1106
          "verticalAlignment": "bottom",
1107
          "horizontalAlignment": "left"
1108
        }
1109
      },
1110
      {
1111
        "3": {
1112
          "h": 8,
1113
          "w": 2,
1114
          "x": 0,
1115
          "y": 47,
1116
          "max": {
1117
            "h": 100,
1118
            "w": 3
1119
          },
1120
          "min": {
1121
            "h": 1,
1122
            "w": 1
1123
          },
1124
          "fixed": false,
1125
          "draggable": true,
1126
          "resizable": true,
1127
          "customDragger": false,
1128
          "customResizer": false
1129
        },
1130
        "12": {
1131
          "h": 16,
1132
          "w": 12,
1133
          "x": 0,
1134
          "y": 30,
1135
          "id": "k",
1136
          "max": {
1137
            "h": 100,
1138
            "w": 12
1139
          },
1140
          "min": {
1141
            "h": 1,
1142
            "w": 1
1143
          },
1144
          "fixed": false,
1145
          "draggable": true,
1146
          "resizable": true,
1147
          "customDragger": false,
1148
          "customResizer": false
1149
        },
1150
        "id": "k",
1151
        "data": {
1152
          "id": "k",
1153
          "card": true,
1154
          "type": "barchartcomponent",
1155
          "configuration": {
1156
            "line": {
1157
              "type": "static",
1158
              "value": false,
1159
              "fieldType": "boolean",
1160
              "onlyStatic": true
1161
            },
1162
            "theme": {
1163
              "type": "static",
1164
              "value": "theme1",
1165
              "fieldType": "select",
1166
              "onlyStatic": true,
1167
              "optionValuesKey": "chartThemeOptions"
1168
            }
1169
          },
1170
          "componentInput": {
1171
            "type": "runnable",
1172
            "value": {
1173
              "data": [
1174
                51606,
1175
                30566,
1176
                44964,
1177
                34440,
1178
                15968,
1179
                145167,
1180
                74950,
1181
                101932,
1182
                105504,
1183
                97811,
1184
                845,
1185
                2080,
1186
                793,
1187
                13680,
1188
                3150,
1189
                2090,
1190
                936,
1191
                3520,
1192
                2484,
1193
                9800,
1194
                2660,
1195
                2044,
1196
                364,
1197
                5198,
1198
                3290,
1199
                5371,
1200
                867,
1201
                1080,
1202
                420,
1203
                1620
1204
              ],
1205
              "labels": [
1206
                "Apple iPhone 9",
1207
                "Apple iPhone X",
1208
                "Samsung Samsung Universe 9",
1209
                "OPPO OPPOF19",
1210
                "Huawei Huawei P30",
1211
                "APPle MacBook Pro",
1212
                "Samsung Samsung Galaxy Book",
1213
                "Microsoft Surface Microsoft Surface Laptop 4",
1214
                "Infinix Infinix INBOOK",
1215
                "HP Pavilion HP Pavilion 15-DK1056WM",
1216
                "Impression of Acqua Di Gio perfume Oil",
1217
                "Royal_Mirage Brown Perfume",
1218
                "Fog Scent Xpressio Fog Scent Xpressio Perfume",
1219
                "Al Munakh Non-Alcoholic Concentrated Perfume Oil",
1220
                "Lord - Al-Rehab Eau De Perfume Spray",
1221
                "L'Oreal Paris Hyaluronic Acid Serum",
1222
                "Hemani Tea Tree Oil 30ml",
1223
                "Dermive Oil Free Moisturizer 100ml",
1224
                "ROREC White Rice Skin Beauty Serum.",
1225
                "Fair & Clear Freckle Treatment Cream- 15gm",
1226
                "Saaf & Khaas - Daal Masoor 500 grams",
1227
                "Bake Parlor Big Elbow Macaroni - 400 gm",
1228
                "Baking Food Items Orange Essence Food Flavou",
1229
                "fauji cereals muesli fruit nuts",
1230
                "Dry Rose Gulab Powder 50 Gram",
1231
                "Boho Decor Plant Hanger For Home",
1232
                "Flying Wooden Flying Wooden Bird",
1233
                "LED Lights 3D Embellishment Art Lamp",
1234
                "luxury palace Handcraft Chinese style",
1235
                "Golden Key Holder"
1236
              ]
1237
            },
1238
            "fields": {
1239
              "data": {
1240
                "type": "connected",
1241
                "value": null,
1242
                "fieldType": "array",
1243
                "connection": {
1244
                  "path": "result",
1245
                  "componentId": "a"
1246
                }
1247
              }
1248
            },
1249
            "runnable": {
1250
              "name": "Product Stock Total Worth",
1251
              "type": "runnableByName",
1252
              "inlineScript": {
1253
                "path": "u/adam/products-app/inline-script/Inline Script 0",
1254
                "schema": {
1255
                  "type": "object",
1256
                  "$schema": "https://json-schema.org/draft/2020-12/schema",
1257
                  "required": [
1258
                    "data"
1259
                  ],
1260
                  "properties": {
1261
                    "data": {
1262
                      "type": "array",
1263
                      "items": {
1264
                        "type": "string"
1265
                      },
1266
                      "default": null,
1267
                      "description": ""
1268
                    }
1269
                  }
1270
                },
1271
                "content": "export async function main(data: {brand: string, title: string, stock: number, price: number}[]) {\n  const result: {data: number[], labels: string[]} = {\n    data: [],\n    labels: []\n  }\n  if(!Array.isArray(data)) { return result }\n\n  const count: Record<string, number> = {}\n  data.forEach(row => {\n    const key = `${row.brand} ${row.title}`\n    const value = row.stock * row.price\n    count[key] = value\n  })\n  Object.entries(count).forEach(([key, value]) => {\n    result.data.push(value)\n    result.labels.push(key)\n  })\n  return result\n}\n",
1272
                "language": "deno"
1273
              }
1274
            },
1275
            "fieldType": "object"
1276
          }
1277
        }
1278
      }
1279
    ],
1280
    "fullscreen": false,
1281
    "hiddenInlineScripts": [],
1282
    "unusedInlineScripts": []
1283
  }
1284
}
Orvanta Hub — community scripts, flows, apps & resource types.