@garbarino/gb-jscommons
Advanced tools
Comparing version 1.4.2 to 1.4.3
@@ -70,8 +70,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
body: JSON.stringify({ | ||
"registration_token": subscription.endpoint, | ||
"platform": platform || "", | ||
"keys": { | ||
"p256dh": subscription.getKey("p256dh"), | ||
"auth": subscription.getKey("auth") | ||
} | ||
"subscription": subscription, | ||
"platform": platform || "" | ||
}), | ||
@@ -78,0 +74,0 @@ credentials: "same-origin" |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["push-notifications"]=n():(e.gbJsCommons=e.gbJsCommons||{},e.gbJsCommons["push-notifications"]=n())}("undefined"!=typeof self?self:this,function(){return function(e){function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function o(){return"serviceWorker"in navigator&&"PushManager"in window}Object.defineProperty(n,"__esModule",{value:!0}),n.isCompatible=o,n.canAskForPermission=function(){return o()&&"denied"!==Notification.permission},n.subscribeUserToPush=function(){return o()?navigator.serviceWorker.getRegistration().then(function(e){var n={userVisibleOnly:!0,applicationServerKey:r};return e.pushManager.subscribe(n)}).then(function(e){return console.log("Received PushSubscription: ",JSON.stringify(e)),e}):Promise.reject("Push notifications not compatible")},n.getSubscription=function(){return o()?navigator.serviceWorker.getRegistration().then(function(e){return e.pushManager.getSubscription()}):Promise.reject("Push notifications not compatible")},n.sendSubscriptionToBackEnd=function(e,n){return fetch("/normandia/services/push_tokens",{method:"POST",headers:new Headers({"Content-Type":"application/json"}),body:JSON.stringify({registration_token:e.endpoint,platform:n||"",keys:{p256dh:e.getKey("p256dh"),auth:e.getKey("auth")}}),credentials:"same-origin"})};var r=function(e){for(var n=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t="undefined"!=typeof window?window.atob(n):"",o=new Uint8Array(t.length),r=0;r<t.length;++r)o[r]=t.charCodeAt(r);return o}("BJJA1AKetLvKXO2_rRpkS11DTvhkSVncqa9dcFD25wga05vHvZNallCXc0Et-NZcXv2MKRvPEVstbzn6pGlNAxs")}])}); | ||
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports["push-notifications"]=n():(e.gbJsCommons=e.gbJsCommons||{},e.gbJsCommons["push-notifications"]=n())}("undefined"!=typeof self?self:this,function(){return function(e){function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}var t={};return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},n.p="",n(n.s=0)}([function(e,n,t){"use strict";function r(){return"serviceWorker"in navigator&&"PushManager"in window}Object.defineProperty(n,"__esModule",{value:!0}),n.isCompatible=r,n.canAskForPermission=function(){return r()&&"denied"!==Notification.permission},n.subscribeUserToPush=function(){return r()?navigator.serviceWorker.getRegistration().then(function(e){var n={userVisibleOnly:!0,applicationServerKey:o};return e.pushManager.subscribe(n)}).then(function(e){return console.log("Received PushSubscription: ",JSON.stringify(e)),e}):Promise.reject("Push notifications not compatible")},n.getSubscription=function(){return r()?navigator.serviceWorker.getRegistration().then(function(e){return e.pushManager.getSubscription()}):Promise.reject("Push notifications not compatible")},n.sendSubscriptionToBackEnd=function(e,n){return fetch("/normandia/services/push_tokens",{method:"POST",headers:new Headers({"Content-Type":"application/json"}),body:JSON.stringify({subscription:e,platform:n||""}),credentials:"same-origin"})};var o=function(e){for(var n=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),t="undefined"!=typeof window?window.atob(n):"",r=new Uint8Array(t.length),o=0;o<t.length;++o)r[o]=t.charCodeAt(o);return r}("BJJA1AKetLvKXO2_rRpkS11DTvhkSVncqa9dcFD25wga05vHvZNallCXc0Et-NZcXv2MKRvPEVstbzn6pGlNAxs")}])}); |
@@ -49,8 +49,4 @@ const APPLICATIONSERVERKEY = urlB64ToUint8Array('BJJA1AKetLvKXO2_rRpkS11DTvhkSVncqa9dcFD25wga05vHvZNallCXc0Et-NZcXv2MKRvPEVstbzn6pGlNAxs'); | ||
body: JSON.stringify({ | ||
"registration_token": subscription.endpoint, | ||
"platform": platform || "", | ||
"keys": { | ||
"p256dh": subscription.getKey("p256dh"), | ||
"auth": subscription.getKey("auth") | ||
} | ||
"subscription": subscription, | ||
"platform": platform || "" | ||
}), | ||
@@ -57,0 +53,0 @@ credentials: "same-origin" |
{ | ||
"name": "@garbarino/gb-jscommons", | ||
"version": "1.4.2", | ||
"version": "1.4.3", | ||
"description": "A package of common functions used in our JavaScript applications.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
19732
384