{"app":{"id":4,"summary":"Products Dashboard","versions":[14,15,38],"created_by":"adam186","created_at":"2023-01-13T18:15:53.939Z","votes":0,"approved":true,"apps":[],"app_type":"openapp","external_embed_url":null,"value":{"grid":[{"3":{"h":10,"w":3,"x":0,"y":1,"id":"a","max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":15,"w":8,"x":0,"y":2,"id":"a","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"a","data":{"id":"a","card":true,"type":"tablecomponent","actionButtons":[],"configuration":{"search":{"type":"static","value":"Disabled","fieldType":"select","onlyStatic":true,"optionValuesKey":"tableSearchOptions"}},"componentInput":{"type":"runnable","value":[{"id":1,"brand":"Apple","price":549,"stock":94,"title":"iPhone 9","rating":4.69,"category":"smartphones","discountPercentage":12.96},{"id":2,"brand":"Apple","price":899,"stock":34,"title":"iPhone X","rating":4.44,"category":"smartphones","discountPercentage":17.94},{"id":3,"brand":"Samsung","price":1249,"stock":36,"title":"Samsung Universe 9","rating":4.09,"category":"smartphones","discountPercentage":15.46},{"id":4,"brand":"OPPO","price":280,"stock":123,"title":"OPPOF19","rating":4.3,"category":"smartphones","discountPercentage":17.91},{"id":5,"brand":"Huawei","price":499,"stock":32,"title":"Huawei P30","rating":4.09,"category":"smartphones","discountPercentage":10.58},{"id":6,"brand":"APPle","price":1749,"stock":83,"title":"MacBook Pro","rating":4.57,"category":"laptops","discountPercentage":11.02},{"id":7,"brand":"Samsung","price":1499,"stock":50,"title":"Samsung Galaxy Book","rating":4.25,"category":"laptops","discountPercentage":4.15},{"id":8,"brand":"Microsoft Surface","price":1499,"stock":68,"title":"Microsoft Surface Laptop 4","rating":4.43,"category":"laptops","discountPercentage":10.23},{"id":9,"brand":"Infinix","price":1099,"stock":96,"title":"Infinix INBOOK","rating":4.54,"category":"laptops","discountPercentage":11.83},{"id":10,"brand":"HP Pavilion","price":1099,"stock":89,"title":"HP Pavilion 15-DK1056WM","rating":4.43,"category":"laptops","discountPercentage":6.18},{"id":11,"brand":"Impression of Acqua Di Gio","price":13,"stock":65,"title":"perfume Oil","rating":4.26,"category":"fragrances","discountPercentage":8.4},{"id":12,"brand":"Royal_Mirage","price":40,"stock":52,"title":"Brown Perfume","rating":4,"category":"fragrances","discountPercentage":15.66},{"id":13,"brand":"Fog Scent Xpressio","price":13,"stock":61,"title":"Fog Scent Xpressio Perfume","rating":4.59,"category":"fragrances","discountPercentage":8.14},{"id":14,"brand":"Al Munakh","price":120,"stock":114,"title":"Non-Alcoholic Concentrated Perfume Oil","rating":4.21,"category":"fragrances","discountPercentage":15.6},{"id":15,"brand":"Lord - Al-Rehab","price":30,"stock":105,"title":"Eau De Perfume Spray","rating":4.7,"category":"fragrances","discountPercentage":10.99},{"id":16,"brand":"L'Oreal Paris","price":19,"stock":110,"title":"Hyaluronic Acid Serum","rating":4.83,"category":"skincare","discountPercentage":13.31},{"id":17,"brand":"Hemani Tea","price":12,"stock":78,"title":"Tree Oil 30ml","rating":4.52,"category":"skincare","discountPercentage":4.09},{"id":18,"brand":"Dermive","price":40,"stock":88,"title":"Oil Free Moisturizer 100ml","rating":4.56,"category":"skincare","discountPercentage":13.1},{"id":19,"brand":"ROREC White Rice","price":46,"stock":54,"title":"Skin Beauty Serum.","rating":4.42,"category":"skincare","discountPercentage":10.68},{"id":20,"brand":"Fair & Clear","price":70,"stock":140,"title":"Freckle Treatment Cream- 15gm","rating":4.06,"category":"skincare","discountPercentage":16.99},{"id":21,"brand":"Saaf & Khaas","price":20,"stock":133,"title":"- Daal Masoor 500 grams","rating":4.44,"category":"groceries","discountPercentage":4.81},{"id":22,"brand":"Bake Parlor Big","price":14,"stock":146,"title":"Elbow Macaroni - 400 gm","rating":4.57,"category":"groceries","discountPercentage":15.58},{"id":23,"brand":"Baking Food Items","price":14,"stock":26,"title":"Orange Essence Food Flavou","rating":4.85,"category":"groceries","discountPercentage":8.04},{"id":24,"brand":"fauji","price":46,"stock":113,"title":"cereals muesli fruit nuts","rating":4.94,"category":"groceries","discountPercentage":16.8},{"id":25,"brand":"Dry Rose","price":70,"stock":47,"title":"Gulab Powder 50 Gram","rating":4.87,"category":"groceries","discountPercentage":13.58},{"id":26,"brand":"Boho Decor","price":41,"stock":131,"title":"Plant Hanger For Home","rating":4.08,"category":"home-decoration","discountPercentage":17.86},{"id":27,"brand":"Flying Wooden","price":51,"stock":17,"title":"Flying Wooden Bird","rating":4.41,"category":"home-decoration","discountPercentage":15.58},{"id":28,"brand":"LED Lights","price":20,"stock":54,"title":"3D Embellishment Art Lamp","rating":4.82,"category":"home-decoration","discountPercentage":16.49},{"id":29,"brand":"luxury palace","price":60,"stock":7,"title":"Handcraft Chinese style","rating":4.44,"category":"home-decoration","discountPercentage":15.34},{"id":30,"brand":"Golden","price":30,"stock":54,"title":"Key Holder","rating":4.92,"category":"home-decoration","discountPercentage":2.92}],"fields":{},"runnable":{"name":"All Product Data","type":"runnableByName","inlineScript":{"path":"/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":[],"properties":{}},"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","language":"deno"}},"fieldType":"array","connection":{"path":"result","componentId":"c"},"subFieldType":"object"}}},{"3":{"h":1,"w":3,"x":0,"y":0,"id":"b","max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":2,"w":12,"x":0,"y":0,"id":"b","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"b","data":{"id":"b","card":false,"type":"textcomponent","softWrap":true,"configuration":{"style":{"type":"static","value":"Title","fieldType":"select","onlyStatic":true,"optionValuesKey":"textStyleOptions"},"extraStyle":{"type":"static","value":"padding-left:10px;","fieldType":"text"}},"componentInput":{"eval":"Product table","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"center","horizontalAlignment":"left"}},{"3":{"h":12,"w":3,"x":0,"y":11,"id":"d","max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":15,"w":4,"x":8,"y":2,"id":"d","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"d","data":{"id":"d","card":false,"type":"htmlcomponent","softWrap":false,"configuration":{},"componentInput":{"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","type":"runnable","value":"\n    <p class=\"text-sm text-gray-600 text-center pt-8\">\n      Select a row from the table\n    </p>\n    ","fields":{"id":{"type":"connected","value":null,"visible":true,"fieldType":"number","connection":{"path":"selectedRow.id","componentId":"a"}}},"runnable":{"name":"One Product Detail","type":"runnableByName","inlineScript":{"path":"/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["id"],"properties":{"id":{"type":"number","default":null,"description":""}}},"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","language":"deno"}},"fieldType":"template"}}},{"3":{"h":8,"w":2,"x":0,"y":23,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":8,"w":6,"x":0,"y":19,"id":"e","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"e","data":{"id":"e","card":true,"type":"barchartcomponent","configuration":{"line":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"theme":{"type":"static","value":"theme1","fieldType":"select","onlyStatic":true,"optionValuesKey":"chartThemeOptions"}},"componentInput":{"type":"runnable","value":{"data":[5,5,5,5,5,5],"labels":["smartphones","laptops","fragrances","skincare","groceries","home-decoration"]},"fields":{"data":{"type":"connected","value":null,"fieldType":"array","connection":{"path":"result","componentId":"a"}}},"runnable":{"name":"Product Category Count","type":"runnableByName","inlineScript":{"path":"u/adam/products-app/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["data"],"properties":{"data":{"type":"array","items":{"type":"string"},"default":null,"properties":{"category":{"type":"string","description":""}},"description":""}}},"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","language":"deno"}},"fieldType":"object"}}},{"3":{"h":8,"w":2,"x":0,"y":31,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":9,"w":6,"x":6,"y":19,"id":"f","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"f","data":{"id":"f","card":true,"type":"barchartcomponent","configuration":{"line":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"theme":{"type":"static","value":"theme1","fieldType":"select","onlyStatic":true,"optionValuesKey":"chartThemeOptions"}},"componentInput":{"type":"runnable","value":{"data":[3,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"labels":["apple","samsung","oppo","huawei","microsoft surface","infinix","hp pavilion","impression of acqua di gio","royal_mirage","fog scent xpressio","al munakh","lord - al-rehab","l'oreal paris","hemani tea","dermive","rorec white rice","fair & clear","saaf & khaas","bake parlor big","baking food items","fauji","dry rose","boho decor","flying wooden","led lights","luxury palace","golden"]},"fields":{"data":{"type":"connected","value":null,"fieldType":"array","connection":{"path":"result","componentId":"a"}}},"runnable":{"name":"Product Brand Count","type":"runnableByName","inlineScript":{"path":"u/adam/products-app/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["data"],"properties":{"data":{"type":"array","items":{"type":"string"},"default":null,"description":""}}},"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","language":"deno"}},"fieldType":"object"}}},{"3":{"h":1,"w":1,"x":2,"y":23,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":2,"w":6,"x":0,"y":17,"id":"h","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"h","data":{"id":"h","card":false,"type":"textcomponent","softWrap":true,"configuration":{"style":{"type":"static","value":"Subtitle","fieldType":"select","onlyStatic":true,"optionValuesKey":"textStyleOptions"},"copyButton":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"extraStyle":{"type":"static","value":"","tooltip":"CSS rules like \"color: blue;\"","fieldType":"text"}},"componentInput":{"eval":"Product Count By Categories","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"bottom","horizontalAlignment":"left"}},{"3":{"h":1,"w":1,"x":2,"y":24,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":2,"w":6,"x":6,"y":17,"id":"i","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"i","data":{"id":"i","card":false,"type":"textcomponent","softWrap":true,"configuration":{"style":{"type":"static","value":"Subtitle","fieldType":"select","onlyStatic":true,"optionValuesKey":"textStyleOptions"},"copyButton":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"extraStyle":{"type":"static","value":"","tooltip":"CSS rules like \"color: blue;\"","fieldType":"text"}},"componentInput":{"eval":"Product Count By Brands","type":"template","value":"Hello ${ctx.username}","fieldType":"template"},"verticalAlignment":"bottom","horizontalAlignment":"left"}},{"3":{"h":1,"w":1,"x":2,"y":25,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":2,"w":12,"x":0,"y":28,"id":"j","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"j","data":{"id":"j","card":false,"type":"textcomponent","softWrap":true,"configuration":{"style":{"type":"static","value":"Subtitle","fieldType":"select","onlyStatic":true,"optionValuesKey":"textStyleOptions"},"copyButton":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"extraStyle":{"type":"static","value":"","tooltip":"CSS rules like \"color: blue;\"","fieldType":"text"}},"componentInput":{"eval":"Stock Worth By Product","type":"runnable","value":"Stock Worth By Product (Total Worth: $765,200)","fields":{"data":{"type":"connected","value":null,"fieldType":"array","connection":{"path":"result","componentId":"a"}}},"runnable":{"name":"Stock Worth Title","type":"runnableByName","inlineScript":{"path":"u/adam/products-app/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["data"],"properties":{"data":{"type":"array","items":{"type":"string"},"default":null,"description":""}}},"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","language":"deno"}},"fieldType":"template"},"verticalAlignment":"bottom","horizontalAlignment":"left"}},{"3":{"h":8,"w":2,"x":0,"y":47,"max":{"h":100,"w":3},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"12":{"h":16,"w":12,"x":0,"y":30,"id":"k","max":{"h":100,"w":12},"min":{"h":1,"w":1},"fixed":false,"draggable":true,"resizable":true,"customDragger":false,"customResizer":false},"id":"k","data":{"id":"k","card":true,"type":"barchartcomponent","configuration":{"line":{"type":"static","value":false,"fieldType":"boolean","onlyStatic":true},"theme":{"type":"static","value":"theme1","fieldType":"select","onlyStatic":true,"optionValuesKey":"chartThemeOptions"}},"componentInput":{"type":"runnable","value":{"data":[51606,30566,44964,34440,15968,145167,74950,101932,105504,97811,845,2080,793,13680,3150,2090,936,3520,2484,9800,2660,2044,364,5198,3290,5371,867,1080,420,1620],"labels":["Apple iPhone 9","Apple iPhone X","Samsung Samsung Universe 9","OPPO OPPOF19","Huawei Huawei P30","APPle MacBook Pro","Samsung Samsung Galaxy Book","Microsoft Surface Microsoft Surface Laptop 4","Infinix Infinix INBOOK","HP Pavilion HP Pavilion 15-DK1056WM","Impression of Acqua Di Gio perfume Oil","Royal_Mirage Brown Perfume","Fog Scent Xpressio Fog Scent Xpressio Perfume","Al Munakh Non-Alcoholic Concentrated Perfume Oil","Lord - Al-Rehab Eau De Perfume Spray","L'Oreal Paris Hyaluronic Acid Serum","Hemani Tea Tree Oil 30ml","Dermive Oil Free Moisturizer 100ml","ROREC White Rice Skin Beauty Serum.","Fair & Clear Freckle Treatment Cream- 15gm","Saaf & Khaas - Daal Masoor 500 grams","Bake Parlor Big Elbow Macaroni - 400 gm","Baking Food Items Orange Essence Food Flavou","fauji cereals muesli fruit nuts","Dry Rose Gulab Powder 50 Gram","Boho Decor Plant Hanger For Home","Flying Wooden Flying Wooden Bird","LED Lights 3D Embellishment Art Lamp","luxury palace Handcraft Chinese style","Golden Key Holder"]},"fields":{"data":{"type":"connected","value":null,"fieldType":"array","connection":{"path":"result","componentId":"a"}}},"runnable":{"name":"Product Stock Total Worth","type":"runnableByName","inlineScript":{"path":"u/adam/products-app/inline-script/Inline Script 0","schema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["data"],"properties":{"data":{"type":"array","items":{"type":"string"},"default":null,"description":""}}},"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","language":"deno"}},"fieldType":"object"}}}],"fullscreen":false,"hiddenInlineScripts":[],"unusedInlineScripts":[]},"description":"Dashboard for your products, stock levels and others","vcreated_at":"2023-04-08T10:38:30.997Z","vcreated_by":"rubenfiszel","comments":[]}}