Update Service Worker with a problem related with the scope is now fixed.
Auto import the default service worker code.
Now you don't need to copy the code inside the pwaServiceWorker.js and put it manually in the new service worker. You just have to create the new resource that will have the code you need and append "self.importScripts('/<your_module>/pwaServiceWorker.js');"
This way you will keep the code generate in the default service worker and your new code as well.
For the purposes of just adding the import push woosh service worker in the new service worker resource and doing the mentioned self.importScripts, you can leave everything as is in the sample and it will work just fine.
And don't forget that in order to configure this for your own Firebase and PushWoosh accounts you need to:
- Change the values of the site properties ApiAccessToken and ApplicationCode
- Go to the extensibility configurations and in the PWA Manifest change the gcm_sender_id for the one that you have in your Firebase
- In the InitPushWoosh script replace the applicationCode by the one you have been assigned by PushWoosh
- In that same script, replace in the navigator.serviceWorker.register and in the serviceWorkerUrl the name of this eSpace by your own.
Also, don't forget to clear the cache if you were already using this sample.
Thank you,
Ricardo
Fixed Service Worker bug.
This sample uses the pwaServiceWorker created by the platform and appends in the beginning the import needed by pushwoosh.
At the moment the only option is to copy the code inside that pwaServiceWorker.js and put it manually as a resource (pwaServiceWorkerNew.js) in your module appending the "importScripts('https://cdn.pushwoosh.com/webpush/v3/pushwoosh-service-worker.js' + self.location.search)" in the beginning.
That way when initializing push woosh the default service worker (pwaServiceWorker) created by the Platform will be updated with this new one.
I will try to find a more definitive and scalable solution but for now this is the way to do it.