{"action":"created","comment":{"url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/comments/235882763","pull_request_review_id":177852174,"id":235882763,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNTg4Mjc2Mw==","diff_hunk":"@@ -1,228 +1,597 @@\n var $reportHolder = $('.reports-holder');\n-var source = $('#template-table-entries').html();\n-var jobEntriesTemplate = Handlebars.compile(source);\n var widgetId = Fliplet.Widget.getDefaultId();\n+var appId = Fliplet.Env.get('appId');\n var data = Fliplet.Widget.getData(widgetId) || {};\n var limit = 20;\n-var offset = 0;\n+var notificationsOffsetDate;\n+var pushNotificationsOffset = 0;\n+var allNotifications = [];\n+var uiNotification;\n+var uiPushNotification;\n+var assetRoot = $('#container').data('asset') || '';\n \n-$reportHolder.on('click', '[data-load-more]', function (event) {\n-  event.preventDefault();\n-  $(this).remove();\n-  refreshReports(true);\n-});\n+function hideSavedMessage() {\n+  setTimeout(function() {\n+    $('.settings-saved-app-msg').fadeOut(function() {\n+      Fliplet.Widget.autosize();\n+    });\n+  }, 5000);\n+}\n+\n+function getMockNotifications() {\n+  return new Promise(function (resolve) {\n+    setTimeout(function () {\n+      var data = [\n+        {\n+          createdAt: '2018-11-07 16:23:57.89+00',\n+          orderAt: '2018-11-08 16:23:57.89+00',\n+          data: {\n+            title: 'Bibendum Condimentum Fringilla',\n+            message: 'Sed posuere consectetur est at lobortis. Maecenas faucibus mollis interdum.'\n+          },\n+          status: 'draft',\n+          deletedAt: null\n+        },\n+        {\n+          createdAt: '2018-11-05 16:23:57.89+00',\n+          orderAt: '2018-11-06 16:23:57.89+00',\n+          data: {\n+            title: 'Quam Pharetra',\n+            message: 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.'\n+          },\n+          pushNotificationPayload: {\n+            title: 'Quam Pharetra',\n+            message: 'Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.'\n+          },\n+          status: 'published',\n+          deletedAt: null\n+        },\n+        {\n+          createdAt: '2018-11-01 16:23:57.89+00',\n+          orderAt: '2018-11-02 16:23:57.89+00',\n+          data: {\n+            title: 'Dolor Fermentum',\n+            message: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras justo odio, dapibus ac facilisis in, egestas eget quam.'\n+          },\n+          status: 'draft',\n+          deletedAt: '2018-11-03 16:23:57.89+00'\n+        }\n+      ];\n+      resolve(data);\n+    }, 1000);\n+  });\n+}\n \n-function refreshReports(append) {\n+function getMockPushNotifications() {\n+  return new Promise(function (resolve) {\n+    setTimeout(function () {\n+      var data = {\"logs\":[{\"id\":3419,\"type\":\"job\",\"data\":{\"result\":[{\"job\":\"2305\",\"result\":[{\"method\":\"gcm\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":7,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":16,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"}],\"success\":30}]}],\"payload\":{\"body\":\"Maecenas sed diam eget risus varius blandit sit amet non magna.\",\"title\":\"Purus Fringilla\"},\"settings\":{\"apn\":true,\"gcm\":true,\"wns\":true,\"apnKeyId\":\"A\",\"apnTopic\":\"com.mock\",\"apnTeamId\":\"A\",\"apnAuthKey\":\"-\",\"configured\":true,\"popupTitle\":\"App updates and notifications\",\"gcmSenderId\":\"9\",\"wnsClientId\":\"ms-app://s-1\",\"gcmServerKey\":\"g\",\"popupMessage\":\"You will receive notifications when app updates are available.\\nPlease tap on Allow Notifications below to receive notifications on the updates.\",\"gcmPackageName\":\"com.mock\",\"wnsClientSecret\":\"w\",\"showOnceOnPortal\":false,\"showAutomatically\":false}},\"requestId\":null,\"createdAt\":\"2017-12-19T17:10:10.006Z\",\"updatedAt\":\"2017-12-19T17:10:15.417Z\",\"userId\":null,\"appId\":21,\"dataSourceEntryId\":null,\"dataSourceId\":null},{\"id\":3418,\"type\":\"job\",\"data\":{\"result\":[{\"job\":\"2162\",\"result\":[{\"method\":\"gcm\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":3,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":14,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"}],\"success\":25}]}],\"payload\":{\"body\":\"Maecenas sed diam eget risus varius blandit sit amet non magna.\",\"title\":\"Purus Fringilla\"},\"settings\":{\"apn\":true,\"gcm\":true,\"wns\":true,\"apnKeyId\":\"A\",\"apnTopic\":\"com.mock\",\"apnTeamId\":\"A\",\"apnAuthKey\":\"-\",\"configured\":true,\"popupTitle\":\"App updates and notifications\",\"gcmSenderId\":\"9\",\"wnsClientId\":\"ms-app://s-1\",\"gcmServerKey\":\"g\",\"popupMessage\":\"You will receive notifications when app updates are available.\\nPlease tap on Allow Notifications below to receive notifications on the updates.\",\"gcmPackageName\":\"com.mock\",\"wnsClientSecret\":\"w\",\"showOnceOnPortal\":false,\"showAutomatically\":false}},\"requestId\":null,\"createdAt\":\"2017-12-19T11:04:25.638Z\",\"updatedAt\":\"2017-12-19T11:04:26.795Z\",\"userId\":null,\"appId\":21,\"dataSourceEntryId\":null,\"dataSourceId\":null},{\"id\":3417,\"type\":\"job\",\"data\":{\"jobs\":[\"2152\",\"2153\",\"2154\",\"2155\",\"2156\",\"2157\",\"2158\",\"2159\",\"2160\",\"2161\"],\"result\":[{\"job\":\"2152\",\"result\":[{\"method\":\"gcm\",\"failure\":2,\"message\":[{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":8,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":3,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":37}]},{\"job\":\"2153\",\"result\":[{\"method\":\"gcm\",\"failure\":4,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}}],\"success\":46}]},{\"job\":\"2154\",\"result\":[{\"method\":\"gcm\",\"failure\":4,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":1,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":45}]},{\"job\":\"2155\",\"result\":[{\"method\":\"gcm\",\"failure\":4,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":2,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":44}]},{\"job\":\"2156\",\"result\":[{\"method\":\"gcm\",\"failure\":5,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":3,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":42}]},{\"job\":\"2158\",\"result\":[{\"method\":\"gcm\",\"failure\":6,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}}],\"success\":44}]},{\"job\":\"2157\",\"result\":[{\"method\":\"gcm\",\"failure\":6,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"MismatchSenderId\",\"regId\":\"r\"}],\"success\":0,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}}],\"success\":44}]},{\"job\":\"2159\",\"result\":[{\"method\":\"gcm\",\"failure\":4,\"message\":[{\"error\":\"MismatchSenderId\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":3,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":3,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":40}]},{\"job\":\"2160\",\"result\":[{\"method\":\"gcm\",\"failure\":5,\"message\":[{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":4,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":2,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":39}]},{\"job\":\"2161\",\"result\":[{\"method\":\"gcm\",\"failure\":2,\"message\":[{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":\"NotRegistered\",\"regId\":\"r\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":5,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":3,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"Unregistered\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"Unregistered\",\"regId\":\"9\"}],\"success\":40}]}],\"payload\":{\"body\":\"See you on eleven for some festive cheer.\",\"badge\":1,\"title\":\"Christmas drinks are served!\"},\"settings\":{\"apn\":true,\"gcm\":true,\"wns\":false,\"apnKeyId\":\"A\",\"apnTopic\":\"com.mock\",\"apnTeamId\":\"A\",\"apnAuthKey\":\"-\",\"configured\":true,\"gcmSenderId\":\"9\",\"wnsClientId\":\"\",\"gcmServerKey\":\"g\",\"gcmPackageName\":\"com.mock\",\"wnsClientSecret\":\"w\",\"showOnceOnPortal\":false,\"showAutomatically\":true},\"subscriptionsCount\":500},\"requestId\":null,\"createdAt\":\"2017-12-14T17:47:24.409Z\",\"updatedAt\":\"2017-12-14T17:47:30.270Z\",\"userId\":null,\"appId\":21,\"dataSourceEntryId\":null,\"dataSourceId\":null},{\"id\":3416,\"type\":\"job\",\"data\":{\"result\":[{\"job\":\"2151\",\"result\":[{\"method\":\"gcm\",\"failure\":0,\"message\":[{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"},{\"error\":null,\"regId\":\"r\",\"messageId\":\"0:1\"}],\"success\":2,\"multicastId\":[0]},{\"method\":\"apn\",\"failure\":11,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"}],\"success\":26}]}],\"payload\":{\"body\":\"Maecenas sed diam eget risus varius blandit sit amet non magna.\",\"title\":\"Purus Fringilla\"},\"settings\":{\"apn\":true,\"gcm\":true,\"wns\":true,\"apnKeyId\":\"A\",\"apnTopic\":\"com.mock\",\"apnTeamId\":\"A\",\"apnAuthKey\":\"-\",\"configured\":true,\"popupTitle\":\"App updates and notifications\",\"gcmSenderId\":\"9\",\"wnsClientId\":\"ms-app://s-1\",\"gcmServerKey\":\"g\",\"popupMessage\":\"You will receive notifications when app updates are available.\\nPlease tap on Allow Notifications below to receive notifications on the updates.\",\"gcmPackageName\":\"com.mock\",\"wnsClientSecret\":\"w\",\"showOnceOnPortal\":false,\"showAutomatically\":false}},\"requestId\":null,\"createdAt\":\"2017-12-14T16:10:44.035Z\",\"updatedAt\":\"2017-12-14T16:10:45.623Z\",\"userId\":null,\"appId\":21,\"dataSourceEntryId\":null,\"dataSourceId\":null},{\"id\":3415,\"type\":\"job\",\"data\":{\"result\":[{\"job\":\"2150\",\"result\":[{\"method\":\"apn\",\"failure\":15,\"message\":[{\"error\":null,\"regId\":{\"device\":\"d\"}},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"},{\"error\":\"DeviceTokenNotForTopic\",\"regId\":\"9\"}],\"success\":25}]}],\"payload\":{\"body\":\"Maecenas sed diam eget risus varius blandit sit amet non magna.\",\"title\":\"Purus Fringilla\"},\"settings\":{\"apn\":true,\"gcm\":true,\"wns\":true,\"apnKeyId\":\"A\",\"apnTopic\":\"com.mock\",\"apnTeamId\":\"A\",\"apnAuthKey\":\"-\",\"configured\":true,\"popupTitle\":\"App updates and notifications\",\"gcmSenderId\":\"9\",\"wnsClientId\":\"ms-app://s-1\",\"gcmServerKey\":\"g\",\"popupMessage\":\"You will receive notifications when app updates are available.\\nPlease tap on Allow Notifications below to receive notifications on the updates.\",\"gcmPackageName\":\"com.mock\",\"wnsClientSecret\":\"w\",\"showOnceOnPortal\":false,\"showAutomatically\":false}},\"requestId\":null,\"createdAt\":\"2017-12-14T10:52:41.269Z\",\"updatedAt\":\"2017-12-14T10:52:42.685Z\",\"userId\":null,\"appId\":21,\"dataSourceEntryId\":null,\"dataSourceId\":null}],\"query\":{\"where\":{\"type\":\"job\",\"appId\":[21,22]},\"order\":[[\"createdAt\",\"DESC\"]],\"limit\":5,\"offset\":0,\"raw\":true}};\n+      resolve(data.logs);\n+    }, 1000);\n+  });\n+}\n+\n+function processNotifications(notifications) {\n+  _.forEach(notifications, function (n) {\n+    n.isDeleted = !!n.deletedAt;\n+    n.status = !!n.deletedAt ? 'deleted' : n.status;\n+    n.statusText = n.status.charAt(0).toUpperCase() + n.status.slice(1);\n+  });\n+}\n \n-  if (!append) {\n-    $reportHolder.html('');\n-    $('#report .spinner-holder').addClass('animated');\n-    $('.reports-holder').addClass('hidden');\n-    $('.no-data').removeClass('show');\n+function getNotifications() {\n+  if (Fliplet.Env.get('development')) {\n+    return getMockNotifications();\n   }\n \n-  Fliplet.Widget.autosize();\n+  var where = {};\n+  if (notificationsOffsetDate) {\n+    where = { createdAt: { $lt: notificationsOffsetDate } };\n+  }\n+\n+  return Fliplet.API.request({\n+    method: 'POST',\n+    url: 'v1/apps/' + appId + '/notifications',\n+    data: {\n+      where: where,\n+      order: 'createdAt',\n+      direction: 'DESC',\n+      limit: limit,\n+      includeDeleted: true\n+    }\n+  }).then(function (results) {\n+    return results.notifications || [];\n+  });\n+}\n \n+function getPushNotifications() {\n   var appPages;\n   var reportData = {\n     jobs: []\n   };\n \n-  Fliplet.Pages.get().then(function(pages) {\n+  return Fliplet.Pages.get().then(function(pages) {\n     appPages = pages;\n-    return Promise.resolve();\n   }).then(function() {\n-    Fliplet.App.Logs.get({\n+    if (Fliplet.Env.get('development')) {\n+      return getMockPushNotifications();\n+    }\n+\n+    return Fliplet.App.Logs.get({\n       where: {\n         type: 'job'\n       },\n       order: [\n         ['createdAt', 'DESC']\n       ],\n       limit: limit,\n-      offset: offset\n-    }).then(function(logs) {\n-      offset += limit;\n-\n-      if (!logs.length && append) {\n-        return;\n+      offset: pushNotificationsOffset\n+    });\n+  }).then(function(logs) {\n+    logs.forEach(function(log) {\n+      var logData = {\n+        createdAt: '',\n+        title: '',\n+        message: '',\n+        recipientsCount: 0,\n+        deliveredCount: 0,\n+        deliveryPerct: 0,\n+        sentGoogle: 0,\n+        sentApple: 0,\n+        sentWindows: 0,\n+        batchesCount: log.data.jobs && log.data.jobs.length,\n+        batchesSent: log.data.jobs && log.data.jobs.length // this get updated further down\n+      };\n+\n+      var apnSuccess = 0;\n+      var gcmSuccess = 0;\n+      var wnsSuccess = 0;\n+\n+      logData.createdAt = moment(log.createdAt).format('MMM Do YYYY, HH:mm');\n+      logData.title = log.data.payload && log.data.payload.title;\n+      logData.message = log.data.payload && log.data.payload.body;\n+\n+      if (Array.isArray(log.data.result)) {\n+        logData.batchesSent = log.data.result.length;\n+\n+        log.data.result.forEach(function(job) {\n+          if (Array.isArray(job.result)) {\n+            job.result.forEach(function (result) {\n+              switch (result.method) {\n+                case 'apn':\n+                  apnSuccess += result.success;\n+                  logData.sentApple += result.success + result.failure;\n+                  break;\n+                case 'gcm':\n+                  gcmSuccess += result.success;\n+                  logData.sentGoogle += result.success + result.failure;\n+                  break;\n+                case 'wns':\n+                  wnsSuccess += result.success;\n+                  logData.sentWindows += result.success + result.failure;\n+                  break;\n+              }\n+            });\n+          }\n+        });\n       }\n \n-      logs.forEach(function(log) {\n-        var logData = {\n-          createdAt: '',\n-          title: '',\n-          message: '',\n-          recipientsCount: 0,\n-          deliveredCount: 0,\n-          deliveryPerct: 0,\n-          sentGoogle: 0,\n-          sentApple: 0,\n-          sentWindows: 0,\n-          batchesCount: log.data.jobs && log.data.jobs.length,\n-          batchesSent: log.data.jobs && log.data.jobs.length // this get updated further down\n-        };\n-\n-        var apnSuccess = 0;\n-        var gcmSuccess = 0;\n-        var wnsSuccess = 0;\n-\n-        function processJobResult(result) {\n-          switch (result.method) {\n-            case 'apn':\n-              apnSuccess += result.success;\n-              logData.sentApple += result.success + result.failure;\n-              break;\n-            case 'gcm':\n-              gcmSuccess += result.success;\n-              logData.sentGoogle += result.success + result.failure;\n-              break;\n-            case 'wns':\n-              wnsSuccess += result.success;\n-              logData.sentWindows += result.success + result.failure;\n-              break;\n-          }\n-        }\n+      logData.recipientsCount = log.data.subscriptionsCount;\n+      logData.deliveredCount = apnSuccess + gcmSuccess + wnsSuccess;\n+      logData.deliveryPerct = (Math.round(((logData.deliveredCount / logData.recipientsCount) * 100) * 10) / 10) || 0;\n \n-        logData.createdAt = moment(log.createdAt).format('MMM Do YYYY, HH:mm');\n-        logData.title = log.data.payload && log.data.payload.title;\n-        logData.message = log.data.payload && log.data.payload.body;\n-        \n-        if (Array.isArray(log.data.result)) {\n-          logData.batchesSent = log.data.result.length;\n-\n-          log.data.result.forEach(function(job) {\n-            if (Array.isArray(job.result)) {\n-              job.result.forEach(processJobResult);\n-            }\n-          });\n+      if (log.data.payload.custom && log.data.payload.custom.data) {\n+        var selectedScreen = _.find(appPages, function(page) {\n+          return page.id === parseInt(log.data.payload.custom.data.page, 10);\n+        });\n+        if (selectedScreen) {\n+          logData.screenName = selectedScreen.title;\n         }\n \n-        logData.recipientsCount = log.data.subscriptionsCount;\n-        logData.deliveredCount = apnSuccess + gcmSuccess + wnsSuccess;\n-        logData.deliveryPerct = (Math.round(((logData.deliveredCount / logData.recipientsCount) * 100) * 10) / 10) || 0;\n+        reportData.jobs.push(logData);\n+      }\n+\n+      reportData.jobs.push(logData);\n+    });\n \n-        if (log.data.payload.custom && log.data.payload.custom.data) {\n-          var selectedScreen = _.find(appPages, function(page) {\n-            return page.id === parseInt(log.data.payload.custom.data.page, 10);\n-          });\n-          if (selectedScreen) {\n-            logData.screenName = selectedScreen.title;\n+    return Promise.resolve({\n+      reportData: reportData,\n+      logs: logs\n+    });\n+  });\n+}\n+\n+function initializeHandlebars() {\n+  Handlebars.registerHelper('asset', function (path) {\n+    if (assetRoot.indexOf('?_=') > -1) {\n+      return assetRoot.substring(0, assetRoot.indexOf('?_=')) + path + assetRoot.substr(assetRoot.indexOf('?_='));\n+    }\n+\n+    return assetRoot + path;\n+  });\n+  Handlebars.registerPartial('notificationEntries', Fliplet.Widget.Templates['templates.notificationEntries']());\n+  Handlebars.registerPartial('pushNotificationEntries', Fliplet.Widget.Templates['templates.pushNotificationEntries']());\n+}\n+\n+function attachObservers() {\n+  // Fired from Fliplet Studio when the external save button is clicked\n+  Fliplet.Widget.onSaveRequest(function() {\n+    if (!$('#settings-tab.active').length) {\n+      return;\n+    }\n+\n+    $('#configuration').submit();\n+  });\n+\n+  Fliplet.Hooks.on('notificationSent', function (notification, isUpdate) {\n+    if (isUpdate) {\n+      updateNotifications(notification);\n+      return;\n+    }\n+\n+    renderNotifications({\n+      notifications: [notification],\n+      mode: 'prepend'\n+    });\n+  });\n+\n+  $(window).on('resize', Fliplet.Widget.autosize);\n+\n+  $(document).on('click', '[data-action=\"new-notification\"]', function (e) {\n+    e.preventDefault();\n+    setupNewNotificationForm();\n+    $(this).parents('.tab-pane').attr('data-mode', 'new');\n+    $('#notification-form .notification-send').html('Review &amp; send notification');\n+    Fliplet.Widget.autosize();\n+  });\n+\n+  $reportHolder.on('click', '.reports-holder [data-load-more]', function (event) {\n+    event.preventDefault();\n+    $(this).remove();\n+    loadPushNotifications(true);\n+  });\n+\n+  $(document).on('click', '#notifications-tab tr[data-id] a[data-action]', function (event) {\n+    event.preventDefault();\n+    var action = $(this).data('action');\n+    switch (action) {\n+      case 'delete':\n+        var id = $(this).parents('tr[data-id]').data('id');\n+        deleteNotification(id).then(function (deleted) {\n+          if (!deleted) {\n+            return;\n           }\n \n-          reportData.jobs.push(logData);\n-        }\n+          var notification = _.find(allNotifications, { id: id });\n+          notification.deletedAt = moment().toISOString();\n+          updateNotifications([notification]);\n+        });\n+        break;\n+      case 'edit':\n+        openNotification($(this).parents('tr[data-id]').data('id'));\n+        break;\n+    }\n+  });\n \n-        reportData.jobs.push(logData);\n-      });\n-      var compiledEntries;\n-\n-      if (reportData.jobs.length) {\n-        compiledEntries = jobEntriesTemplate(reportData);\n-        $reportHolder.append(compiledEntries);\n-        $('#report .spinner-holder').removeClass('animated');\n-        $('.reports-holder').removeClass('hidden');\n-        $('[data-toggle=\"tooltip\"]').tooltip();\n+  $(document).on('click', '[data-load-more]', function (e) {\n+    e.preventDefault();\n+\n+    var $button = $(this);\n+    var tab = $button.parents('.tab-pane').prop('id');\n+    var origText = $button.text();\n+    var load = Promise.resolve();\n+    $button.text('Loading...').addClass('disabled');\n+\n+    switch (tab) {\n+      case 'notifications-tab':\n+        load = loadNotifications(true);\n+        break;\n+      case 'push-notifications-tab':\n+        load = loadPushNotifications(true);\n+        break;\n+    }\n+\n+    load.then(function () {\n+      $button.removeClass('disabled').text(origText);\n+    });\n+  });\n+\n+  $('#configuration').on('submit', function(event) {\n+    event.preventDefault();\n+    if ($(this).prop('disabled')) {\n+      return;\n+    }\n+\n+    data.showAutomatically = $('[name=\"showAutomatically\"]').is(':checked');\n+    data.showOnceOnPortal = $('[name=\"showOnceOnPortal\"]').is(':checked');\n+    data.popupTitle = $('[name=\"popup_title\"]').val();\n+    data.popupMessage = $('[name=\"popup_message\"]').val();\n+\n+    Fliplet.Widget.save(data).then(function() {\n+      $('.settings-saved-app-msg').fadeIn();\n+      Fliplet.Widget.autosize();\n+      hideSavedMessage();\n+    });\n+  });\n+\n+  $(document).on('click', '.nav-tabs a[data-toggle=\"tab\"]', function(event) {\n+    var href = $(this).attr('href');\n+    var saveButtonLabel = 'Save';\n+\n+    event.preventDefault();\n+\n+    $(this).tab('show');\n+    if ($(href).attr('data-mode') === 'new') {\n+      $(href).attr('data-mode', 'list');\n+    }\n+\n+    Fliplet.Widget.autosize();\n+\n+    switch (href) {\n+      case '#notifications-tab':\n+        saveButtonLabel = '';\n+        loadNotifications();\n+        break;\n+      case '#push-notifications-tab':\n+        saveButtonLabel = '';\n+        loadPushNotifications();\n+        break;\n+      case '#settings-tab':\n+        break;\n+    }\n+\n+    Fliplet.Studio.emit('widget-save-label-update', {\n+      text: saveButtonLabel\n+    });\n+  });\n+\n+  $(document).on('click', '.more-details a', function(e) {\n+    e.preventDefault();\n+    var _this = $(this);\n+    var placeHodlerEl = '<div class=\"report-placeholder-element\"></div>';\n+\n+    if (!$(this).parents('.report-wrapper').hasClass('show-more')) {\n+      $('.reports-holder').append(placeHodlerEl);\n+      Fliplet.Widget.autosize();\n+    }\n+\n+    setTimeout(function() {\n+      $('.report-placeholder-element').remove();\n+      _this.parents('.report-wrapper').toggleClass('show-more');\n+\n+      if (_this.parents('.report-wrapper').hasClass('show-more')) {\n+        _this.text('See less details');\n       } else {\n-        $('#report .spinner-holder').removeClass('animated');\n-        $('.no-data').addClass('show');\n+        _this.text('See more details');\n       }\n+    }, 0);\n \n+    // Wait for CSS animation to finish before running\n+    setTimeout(function() {\n       Fliplet.Widget.autosize();\n+    }, 500);\n+  });\n+}\n \n-      if (logs.length === limit) {\n-        $reportHolder.append('<a href=\"#\" data-load-more>Load more</a>');\n-      }\n-    });\n+function setupNewNotificationForm() {\n+  if ($('.tab-pane.active [data-view=\"new\"]').html().trim() !== '') {\n+    return;\n+  }\n+\n+  var tab = $('.tab-pane.active').prop('id');\n+  switch (tab) {\n+    case 'notifications-tab':\n+      $('#notifications-tab [data-view=\"new\"]').html(Fliplet.Widget.Templates['templates.newNotification']());\n+      uiNotification = new UINotification();\n+      break;\n+    case 'push-notifications-tab':\n+      $('#push-notifications-tab [data-view=\"new\"]').html(Fliplet.Widget.Templates['templates.newPushNotification']());\n+      uiPushNotification = new UIPushNotification();\n+      break;\n+  }\n+}\n+\n+function readNotification(id) {\n+  // @TODO Find notification from allNotifications as Promise\n+  return Promise.resolve(_.find(allNotifications, { id: id }));\n+}\n+\n+function openNotification(id) {\n+  setupNewNotificationForm();\n+  // @TODO Load form fields\n+  readNotification(id).then(function(notification) {\n+    if (!notification) {\n+      return;\n+    }\n+\n+    uiNotification.loadNotificationForm(notification);\n+    $('#notifications-tab').attr('data-mode', 'new');\n   });\n }\n \n-/**\n- * Method used to hide the save message\n- */\n-function hideSavedMessage() {\n-  setTimeout(function() {\n-    $('.settings-saved-app-msg').fadeOut(function() {\n-      Fliplet.Widget.autosize();\n+function deleteNotification(id) {\n+  return Fliplet.Modal.confirm({\n+    size: 'medium',\n+    title: 'Delete notification',\n+    message: 'Are you sure you want to delete this notification?',\n+    buttons: {\n+      confirm: {\n+        label: 'Delete notification',\n+        className: 'btn-danger'\n+      }\n+    }\n+  }).then(function (confirmed) {\n+    if (!confirmed) {\n+      return Promise.resolve(false);\n+    }\n+\n+    var notifications = Fliplet.Notifications.init();\n+    return notifications.remove(id).then(function () {\n+      return Promise.resolve(true);\n     });\n-  }, 5000);\n+  });\n }\n \n-$( window ).resize(function() {\n-  Fliplet.Widget.autosize();\n-});\n-\n-$('.app-name').html(Fliplet.Env.get('appName'));\n-new UINotification();\n-Fliplet.Widget.autosize();\n-\n-$('.nav-tabs').on('click', 'a[data-toggle=\"tab\"]', function(event) {\n-  event.preventDefault();\n-  var href = $(this).attr('href');\n-  var saveButtonLabel = 'Save';\n-  $('#configuration').attr('disabled', (href === '#notification-send-tab'));\n-  $(this).tab('show');\n-  if (href === '#notification-send-tab' || href === '#report') {\n-    saveButtonLabel = '';\n+function renderNotifications(options) {\n+  options = options || {};\n+  if (!$('#notifications-tab.active[data-mode=\"list\"]').length) {\n+    return;\n   }\n-  Fliplet.Studio.emit('widget-save-label-update', {\n-    text: saveButtonLabel\n-  });\n \n-  Fliplet.Widget.autosize();\n-});\n+  var notifications = options.notifications || [];\n+  if (!Array.isArray(notifications)) {\n+    notifications = [notifications];\n+  }\n \n-$('a#note-reports').on('shown.bs.tab', function(event) {\n-  event.preventDefault();\n-  refreshReports();\n-});\n+  processNotifications(notifications);\n \n-$('#show_link_provider').on('change', function() {\n-  var value = $('#show_link_provider:checked').val();\n+  var src = ['append', 'prepend', 'return'].indexOf(options.mode) > -1\n+    ? Fliplet.Widget.Templates['templates.notificationEntries']()\n+    : Fliplet.Widget.Templates['templates.notifications']();\n+  var tpl = Handlebars.compile(src);\n+  var html = tpl(notifications);\n \n-  if (value === 'on') {\n-    $('.link-provider-holder').removeClass('hidden');\n-  } else {\n-    $('.link-provider-holder').addClass('hidden');\n+  if (options.mode === 'return') {\n+    return html;\n   }\n \n-  Fliplet.Widget.autosize();\n-});\n+  if (notifications.length) {\n+    allNotifications = _.uniqBy(_.concat(allNotifications, notifications), 'id');\n+    notificationsOffsetDate = _.min(_.map(allNotifications, 'createdAt'));\n+  }\n+\n+  $('#notifications-tab [data-view=\"list\"]').removeClass('loading');\n+  if (!notifications.length) {\n+    if (options.mode === 'append') {\n+      $('#notifications-tab').find('[data-load-more]').remove();\n+      Fliplet.Widget.autosize();\n+      return;\n+    }\n \n-// Fired from Fliplet Studio when the external save button is clicked\n-Fliplet.Widget.onSaveRequest(function() {\n-  $('form').submit();\n-});\n+    if (options.mode !== 'prepend') {\n+      $('#notifications-tab [data-view=\"list\"]').html(Fliplet.Widget.Templates['templates.noNotifications']());\n+        Fliplet.Widget.autosize();\n+      return;\n+    }\n+  }\n \n-$('#configuration').on('submit', function(event) {\n-  event.preventDefault();\n-  if ($(this).attr('disabled')) {\n-    return;\n+  var $html = $(html);\n+  $html.find('[data-toggle=\"tooltip\"]').tooltip();\n+\n+  switch (options.mode) {\n+    case 'append':\n+      $('#notifications-tab [data-view=\"list\"] tbody').append($html);\n+      break;\n+    case 'prepend':\n+      $('#notifications-tab [data-view=\"list\"] tbody').prepend($html);\n+      break;\n+    case 'html':\n+    default:\n+      $('#notifications-tab [data-view=\"list\"]').html($html);\n+      break;\n   }\n \n-  data.showAutomatically = $('[name=\"showAutomatically\"]').is(':checked');\n-  data.showOnceOnPortal = $('[name=\"showOnceOnPortal\"]').is(':checked');\n-  data.popupTitle = $('[name=\"popup_title\"]').val();\n-  data.popupMessage = $('[name=\"popup_message\"]').val();\n+  Fliplet.Widget.autosize();\n+}\n \n-  Fliplet.Widget.save(data).then(function() {\n-    $('.settings-saved-app-msg').fadeIn();\n-    Fliplet.Widget.autosize();\n-    hideSavedMessage();\n-  });\n-});\n+function updateNotifications(notifications) {\n+  notifications = notifications || [];\n+  if (!Array.isArray(notifications)) {\n+    notifications = [notifications];\n+  }\n \n-Fliplet.Widget.autosize();\n+  var updates = [];\n \n-Fliplet.App.get()\n-  .then(function (app) {\n-    if (!app || !app.icon) {\n+  processNotifications(notifications);\n+  _.forEach(notifications, function (n) {\n+    var i = _.findIndex(allNotifications, { id: n.id });\n+    if (i < 0) {\n       return;\n     }\n \n-    $('<img>')\n-      .on('load', function () {\n-        $('.app-icon-preview').attr('src', app.icon);\n+    allNotifications[i] = n;\n+    updates.push({\n+      id: n.id,\n+      html: renderNotifications({\n+        notifications: n,\n+        mode: 'return'\n       })\n-      .attr('src', app.icon);\n-  });\n\\ No newline at end of file\n+    });\n+  });\n+\n+  _.forEach(updates, function (u) {\n+    $('#notifications-tab tr[data-id=\"' + u.id + '\"]').replaceWith(u.html).find('[data-toggle=\"tooltip\"]').tooltip();\n+  });\n+}\n+\n+function loadNotifications(append) {\n+  if (!append && !$('#notifications-tab [data-view=\"list\"]').hasClass('loading')) {\n+    return Promise.resolve();\n+  }\n+\n+  return getNotifications()\n+    .then(function (notifications) {\n+      renderNotifications({\n+        notifications: notifications,\n+        mode: append ? 'append' : 'replace'\n+      });\n+    });\n+}\n+\n+function loadPushNotifications(append) {\n+  if (!append && !$('#push-notifications-tab [data-view=\"list\"]').hasClass('loading')) {\n+    return Promise.resolve();\n+  }\n+\n+  return getPushNotifications()\n+    .then(function(results) {\n+      if (!$('#push-notifications-tab.active[data-mode=\"list\"]').length) {\n+        return [];\n+      }\n+\n+      results = results || {};\n+      var reportData = results.reportData;\n+      var logs = results.logs;\n+      var src = append\n+        ? Fliplet.Widget.Templates['templates.pushNotificationEntries']()\n+        : Fliplet.Widget.Templates['templates.pushNotifications']();\n+      var tpl = Handlebars.compile(src);\n+\n+      pushNotificationsOffset += logs.length;\n+\n+      $('#push-notifications-tab [data-view=\"list\"]').removeClass('loading');\n+      if (!reportData.jobs.length) {\n+        if (append) {\n+          $('#push-notifications-tab').find('[data-load-more]').remove();\n+          Fliplet.Widget.autosize();\n+          return;\n+        }\n+\n+        $('#push-notifications-tab [data-view=\"list\"]').html(Fliplet.Widget.Templates['templates.noPushNotifications']());\n+        Fliplet.Widget.autosize();\n+        return;\n+      }\n+\n+      var $html = $(tpl(reportData));\n+      $html.find('[data-toggle=\"tooltip\"]').tooltip();\n+      if (append) {\n+        $('#push-notifications-tab [data-view=\"list\"] .reports-holder').append($html);\n+      } else {\n+        $('#push-notifications-tab [data-view=\"list\"]').html($html);\n+      }\n+    })\n+    .then(function () {\n+      Fliplet.Widget.autosize();\n+    });\n+}\n+\n+function init() {\n+  loadNotifications();\n+  // loadPushNotifications();\n+}\n+\n+initializeHandlebars();","path":"js/interface.js","position":760,"original_position":760,"commit_id":"66ee93e5a06089a48989f622169fe22852a9352e","original_commit_id":"66ee93e5a06089a48989f622169fe22852a9352e","user":{"login":"squallstar","id":574210,"node_id":"MDQ6VXNlcjU3NDIxMA==","avatar_url":"https://avatars0.githubusercontent.com/u/574210?v=4","gravatar_id":"","url":"https://api.github.com/users/squallstar","html_url":"https://github.com/squallstar","followers_url":"https://api.github.com/users/squallstar/followers","following_url":"https://api.github.com/users/squallstar/following{/other_user}","gists_url":"https://api.github.com/users/squallstar/gists{/gist_id}","starred_url":"https://api.github.com/users/squallstar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squallstar/subscriptions","organizations_url":"https://api.github.com/users/squallstar/orgs","repos_url":"https://api.github.com/users/squallstar/repos","events_url":"https://api.github.com/users/squallstar/events{/privacy}","received_events_url":"https://api.github.com/users/squallstar/received_events","type":"User","site_admin":false},"body":"should these wait for `Fliplet()`?","created_at":"2018-11-23T09:31:06Z","updated_at":"2018-11-23T09:31:31Z","html_url":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63#discussion_r235882763","pull_request_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/comments/235882763"},"html":{"href":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63#discussion_r235882763"},"pull_request":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63"}}},"pull_request":{"url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63","id":233114575,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMzMTE0NTc1","html_url":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63","diff_url":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63.diff","patch_url":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63.patch","issue_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/63","number":63,"state":"open","locked":false,"title":"New notifications UI","user":{"login":"tonytlwu","id":290733,"node_id":"MDQ6VXNlcjI5MDczMw==","avatar_url":"https://avatars1.githubusercontent.com/u/290733?v=4","gravatar_id":"","url":"https://api.github.com/users/tonytlwu","html_url":"https://github.com/tonytlwu","followers_url":"https://api.github.com/users/tonytlwu/followers","following_url":"https://api.github.com/users/tonytlwu/following{/other_user}","gists_url":"https://api.github.com/users/tonytlwu/gists{/gist_id}","starred_url":"https://api.github.com/users/tonytlwu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonytlwu/subscriptions","organizations_url":"https://api.github.com/users/tonytlwu/orgs","repos_url":"https://api.github.com/users/tonytlwu/repos","events_url":"https://api.github.com/users/tonytlwu/events{/privacy}","received_events_url":"https://api.github.com/users/tonytlwu/received_events","type":"User","site_admin":false},"body":"**Notifications list**\r\n\r\n![image](https://user-images.githubusercontent.com/290733/48930412-509e8b80-ef2b-11e8-89cc-769378a7f23b.png)\r\n\r\n**Notification form**\r\n\r\n![image](https://user-images.githubusercontent.com/290733/48930428-6ca22d00-ef2b-11e8-9b1d-88f948a09229.png)\r\n","created_at":"2018-11-23T06:24:18Z","updated_at":"2018-11-23T09:31:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e6cc62c5d57f44119a3bd5ed1f85d9ad8df1492d","assignee":null,"assignees":[],"requested_reviewers":[{"login":"hcarneiro","id":7046481,"node_id":"MDQ6VXNlcjcwNDY0ODE=","avatar_url":"https://avatars1.githubusercontent.com/u/7046481?v=4","gravatar_id":"","url":"https://api.github.com/users/hcarneiro","html_url":"https://github.com/hcarneiro","followers_url":"https://api.github.com/users/hcarneiro/followers","following_url":"https://api.github.com/users/hcarneiro/following{/other_user}","gists_url":"https://api.github.com/users/hcarneiro/gists{/gist_id}","starred_url":"https://api.github.com/users/hcarneiro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hcarneiro/subscriptions","organizations_url":"https://api.github.com/users/hcarneiro/orgs","repos_url":"https://api.github.com/users/hcarneiro/repos","events_url":"https://api.github.com/users/hcarneiro/events{/privacy}","received_events_url":"https://api.github.com/users/hcarneiro/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63/commits","review_comments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63/comments","review_comment_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/63/comments","statuses_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/statuses/66ee93e5a06089a48989f622169fe22852a9352e","head":{"label":"Fliplet:feat/new-notification-ui","ref":"feat/new-notification-ui","sha":"66ee93e5a06089a48989f622169fe22852a9352e","user":{"login":"Fliplet","id":5980762,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5ODA3NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5980762?v=4","gravatar_id":"","url":"https://api.github.com/users/Fliplet","html_url":"https://github.com/Fliplet","followers_url":"https://api.github.com/users/Fliplet/followers","following_url":"https://api.github.com/users/Fliplet/following{/other_user}","gists_url":"https://api.github.com/users/Fliplet/gists{/gist_id}","starred_url":"https://api.github.com/users/Fliplet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fliplet/subscriptions","organizations_url":"https://api.github.com/users/Fliplet/orgs","repos_url":"https://api.github.com/users/Fliplet/repos","events_url":"https://api.github.com/users/Fliplet/events{/privacy}","received_events_url":"https://api.github.com/users/Fliplet/received_events","type":"Organization","site_admin":false},"repo":{"id":73722105,"node_id":"MDEwOlJlcG9zaXRvcnk3MzcyMjEwNQ==","name":"fliplet-widget-push-notifications","full_name":"Fliplet/fliplet-widget-push-notifications","private":false,"owner":{"login":"Fliplet","id":5980762,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5ODA3NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5980762?v=4","gravatar_id":"","url":"https://api.github.com/users/Fliplet","html_url":"https://github.com/Fliplet","followers_url":"https://api.github.com/users/Fliplet/followers","following_url":"https://api.github.com/users/Fliplet/following{/other_user}","gists_url":"https://api.github.com/users/Fliplet/gists{/gist_id}","starred_url":"https://api.github.com/users/Fliplet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fliplet/subscriptions","organizations_url":"https://api.github.com/users/Fliplet/orgs","repos_url":"https://api.github.com/users/Fliplet/repos","events_url":"https://api.github.com/users/Fliplet/events{/privacy}","received_events_url":"https://api.github.com/users/Fliplet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Fliplet/fliplet-widget-push-notifications","description":null,"fork":false,"url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications","forks_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/forks","keys_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/teams","hooks_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/hooks","issue_events_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/events{/number}","events_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/events","assignees_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/assignees{/user}","branches_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/branches{/branch}","tags_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/tags","blobs_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/refs{/sha}","trees_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/statuses/{sha}","languages_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/languages","stargazers_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/stargazers","contributors_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/contributors","subscribers_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/subscribers","subscription_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/subscription","commits_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/commits{/sha}","git_commits_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/commits{/sha}","comments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/comments{/number}","issue_comment_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/comments{/number}","contents_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/contents/{+path}","compare_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/merges","archive_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/downloads","issues_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues{/number}","pulls_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls{/number}","milestones_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/milestones{/number}","notifications_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/labels{/name}","releases_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/releases{/id}","deployments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/deployments","created_at":"2016-11-14T16:01:34Z","updated_at":"2018-11-15T11:26:35Z","pushed_at":"2018-11-23T06:57:36Z","git_url":"git://github.com/Fliplet/fliplet-widget-push-notifications.git","ssh_url":"git@github.com:Fliplet/fliplet-widget-push-notifications.git","clone_url":"https://github.com/Fliplet/fliplet-widget-push-notifications.git","svn_url":"https://github.com/Fliplet/fliplet-widget-push-notifications","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Fliplet:master","ref":"master","sha":"8a7ae28ff759a86e37489b3b2566913d89930e7b","user":{"login":"Fliplet","id":5980762,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5ODA3NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5980762?v=4","gravatar_id":"","url":"https://api.github.com/users/Fliplet","html_url":"https://github.com/Fliplet","followers_url":"https://api.github.com/users/Fliplet/followers","following_url":"https://api.github.com/users/Fliplet/following{/other_user}","gists_url":"https://api.github.com/users/Fliplet/gists{/gist_id}","starred_url":"https://api.github.com/users/Fliplet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fliplet/subscriptions","organizations_url":"https://api.github.com/users/Fliplet/orgs","repos_url":"https://api.github.com/users/Fliplet/repos","events_url":"https://api.github.com/users/Fliplet/events{/privacy}","received_events_url":"https://api.github.com/users/Fliplet/received_events","type":"Organization","site_admin":false},"repo":{"id":73722105,"node_id":"MDEwOlJlcG9zaXRvcnk3MzcyMjEwNQ==","name":"fliplet-widget-push-notifications","full_name":"Fliplet/fliplet-widget-push-notifications","private":false,"owner":{"login":"Fliplet","id":5980762,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU5ODA3NjI=","avatar_url":"https://avatars0.githubusercontent.com/u/5980762?v=4","gravatar_id":"","url":"https://api.github.com/users/Fliplet","html_url":"https://github.com/Fliplet","followers_url":"https://api.github.com/users/Fliplet/followers","following_url":"https://api.github.com/users/Fliplet/following{/other_user}","gists_url":"https://api.github.com/users/Fliplet/gists{/gist_id}","starred_url":"https://api.github.com/users/Fliplet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fliplet/subscriptions","organizations_url":"https://api.github.com/users/Fliplet/orgs","repos_url":"https://api.github.com/users/Fliplet/repos","events_url":"https://api.github.com/users/Fliplet/events{/privacy}","received_events_url":"https://api.github.com/users/Fliplet/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/Fliplet/fliplet-widget-push-notifications","description":null,"fork":false,"url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications","forks_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/forks","keys_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/teams","hooks_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/hooks","issue_events_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/events{/number}","events_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/events","assignees_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/assignees{/user}","branches_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/branches{/branch}","tags_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/tags","blobs_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/refs{/sha}","trees_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/statuses/{sha}","languages_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/languages","stargazers_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/stargazers","contributors_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/contributors","subscribers_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/subscribers","subscription_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/subscription","commits_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/commits{/sha}","git_commits_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/git/commits{/sha}","comments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/comments{/number}","issue_comment_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/comments{/number}","contents_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/contents/{+path}","compare_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/merges","archive_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/downloads","issues_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues{/number}","pulls_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls{/number}","milestones_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/milestones{/number}","notifications_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/labels{/name}","releases_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/releases{/id}","deployments_url":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/deployments","created_at":"2016-11-14T16:01:34Z","updated_at":"2018-11-15T11:26:35Z","pushed_at":"2018-11-23T06:57:36Z","git_url":"git://github.com/Fliplet/fliplet-widget-push-notifications.git","ssh_url":"git@github.com:Fliplet/fliplet-widget-push-notifications.git","clone_url":"https://github.com/Fliplet/fliplet-widget-push-notifications.git","svn_url":"https://github.com/Fliplet/fliplet-widget-push-notifications","homepage":null,"size":308,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63"},"html":{"href":"https://github.com/Fliplet/fliplet-widget-push-notifications/pull/63"},"issue":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/63"},"comments":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/issues/63/comments"},"review_comments":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63/comments"},"review_comment":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/pulls/63/commits"},"statuses":{"href":"https://api.github.com/repos/Fliplet/fliplet-widget-push-notifications/statuses/66ee93e5a06089a48989f622169fe22852a9352e"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"squallstar"}}