Wigzo_AutoCode - Version 0.2.0

Version Notes

Wigzo Push is a plugin that allows you to Send and Track Web Push Notification through your Magento Store. It allows you to take Browser Opt in from people visiting your store and then Send and Track browser notifications to bring people back to your store, even when they are not browsing the site. It allows your store to re-engage your most loyal customers with targeted push notifications

Download this release

Release Info

Developer wigzo
Extension Wigzo_AutoCode
Version 0.2.0
Comparing to
See all releases


Code changes from version 0.1.9 to 0.2.0

app/code/local/Wigzo/ServiceWorker/controllers/IndexController.php CHANGED
@@ -18,115 +18,10 @@ class Wigzo_ServiceWorker_IndexController extends Mage_Core_Controller_Front_Act
18
  }
19
 
20
  $serviceWorker = <<<EOL
21
-
22
- var wigzoConf = {
23
- "host": 'https://app.wigzo.com/',
24
- "orgtoken": "$orgId",
25
- }
26
-
27
- var showNotification = function (title, body, data) {
28
- var data = data || {};
29
- var actionData=[];
30
- if(data.hasOwnProperty('actions')){
31
- //var actions= JSON.parse(data.actions);
32
- if(data.actions && data.actions.length!=0){
33
- var count = 0;
34
- data.actions.forEach(function(value,key){
35
- count = count+1;
36
- actionData.push({action : "action".concat(count.toString()), title: value.pushctaText })
37
- })
38
- }
39
- }
40
- var icon = data.icon || wigzoConf.host + "/assets/assets/img/notification_v1.png";
41
- var options = {
42
- body: body,
43
- //tag: "wigzo_2r22dg57q25",
44
- icon: icon,
45
- data: data,
46
- actions: actionData,
47
- };
48
- return self.registration.showNotification(title, options);
49
- }
50
-
51
-
52
- self.addEventListener('install', function(event) {
53
- //Automatically take over the previous worker.
54
- event.waitUntil(self.skipWaiting());
55
- });
56
-
57
- self.addEventListener('activate', function(event) {
58
-
59
- });
60
-
61
- self.addEventListener('push', function(event) {
62
- // Since there is no payload data with the first version
63
- // of push messages, we'll use some static content.
64
- // However you could grab some data from
65
- // an API and use it to populate a notification
66
-
67
- // In Chrome 44+ and other SW browsers, reg ID is part of endpoint, send the whole thing and let the server figure it out.
68
- event.waitUntil(self.registration.pushManager.getSubscription().then(function (registration) {
69
- var registrationId = null;
70
- if ('subscriptionId' in registration) {
71
- registrationId = registration.subscriptionId;
72
- } else {
73
- registrationId = registration.endpoint.split("/").reverse()[0];
74
- }
75
-
76
- return fetch(wigzoConf.host + "push/fetch-notification?orgtoken=" + wigzoConf.orgtoken + "&registrationId=" + registrationId).then(function(response) {
77
- return response.json().then(function(json) {
78
- var promises = [];
79
- for (var i = 0; i < json.notifications.length; i++) {
80
- var notification = json.notifications[i];
81
- promises.push(showNotification(notification.title, notification.body, notification.data));
82
- }
83
- return Promise.all(promises);
84
- });
85
- });
86
-
87
- })
88
- );
89
- });
90
-
91
-
92
- // The user has clicked on the notification ...
93
- self.addEventListener('notificationclick', function(event) {
94
- // Android doesn’t close the notification when you click on it
95
- // See: http://crbug.com/463146
96
-
97
- event.notification.close();
98
- var url = "";
99
- if (event.notification.data && event.notification.data.url) {
100
- url = event.notification.data && wigzoConf.host + event.notification.data.url;
101
- }
102
-
103
- var action = event.notification.data.actions;
104
- if(action.length!=0){
105
- if(event.action == 'action1'){
106
- url = event.notification.data && wigzoConf.host + event.notification.data.actions[0].pushctaUrl
107
- return clients.openWindow(url);
108
- }
109
- else if(event.action == 'action2'){
110
- url = event.notification.data && wigzoConf.host + event.notification.data.actions[1].pushctaUrl
111
- return clients.openWindow(url);
112
- }
113
- }
114
-
115
- // This looks to see if the current is already open and
116
- // focuses if it is
117
- event.waitUntil(clients.matchAll({
118
- type: "window"
119
- }).then(function(clientList) {
120
- for (var i = 0; i < clientList.length; i++) {
121
- var client = clientList[i];
122
- if (client.url == '/' && 'focus' in client)
123
- return client.focus();
124
- }
125
- if (clients.openWindow && url) {
126
- return clients.openWindow(url);
127
- }
128
- }));
129
- });
130
 
131
  EOL;
132
 
18
  }
19
 
20
  $serviceWorker = <<<EOL
21
+ d = new Date();
22
+ var cache_key = d.getDate() + "-" + d.getMonth() + "-" + d.getFullYear() + "-" + d.getHours ()
23
+ var swUrl = 'https://app.wigzo.com/wigzo_sw.js';
24
+ importScripts(swUrl + "?orgtoken=$orgId&cache_key="+cache_key);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  EOL;
27
 
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wigzo_AutoCode</name>
4
- <version>0.1.9</version>
5
  <stability>stable</stability>
6
  <license>GNU</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
10
  <description>Wigzo Push is a plugin that allows you to Send and Track Web Push Notification through your Magento Store. It allows you to take Browser Opt in from people visiting your store and then Send and Track browser notifications to bring people back to your store, even when they are not browsing the site. It allows your store to re-engage your most loyal customers with targeted push notifications</description>
11
  <notes>Wigzo Push is a plugin that allows you to Send and Track Web Push Notification through your Magento Store. It allows you to take Browser Opt in from people visiting your store and then Send and Track browser notifications to bring people back to your store, even when they are not browsing the site. It allows your store to re-engage your most loyal customers with targeted push notifications</notes>
12
  <authors><author><name>wigzo</name><user>wigzo</user><email>info@wigo.com</email></author><author><name>shamail</name><user>shamail</user><email>shamail@wigzo.com</email></author></authors>
13
- <date>2017-05-08</date>
14
- <time>10:52:02</time>
15
- <contents><target name="magelocal"><dir name="Wigzo"><dir name="AutoCode"><dir name="Block"><dir name="Adminhtml"><file name="Autocodebackend.php" hash="da50f2305de5c4e7163f7dfb7459be32"/></dir><file name="Index.php" hash="88b27827847cb37a5ab250ad7b0b6fd5"/><file name=".DS_Store" hash="b0fd28d4d518e950dd364c245b6cc36c"/></dir><dir name="CodeBlock"><file name="Myblock.php" hash="3c5f3ef2956dfa70e7f1fa96fdc20322"/></dir><dir name="Helper"><file name="Data.php" hash="43aff13a0e71fd995800fa1f9178c659"/></dir><dir name="Model"><file name="Observer.php" hash="ff8c027877d2e4457f9275b8dd78fe52"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AutocodebackendController.php" hash="5a0d87a3ce03fe5875da16540453ce0d"/></dir><file name="IndexController.php" hash="75f185ff119fa5c6ed7c67dfe2a090c7"/><file name=".DS_Store" hash="b0fd28d4d518e950dd364c245b6cc36c"/></dir><dir name="etc"><file name="config.xml" hash="29003cefdb50cce1fcfe18a6c0b51ac9"/><file name="system.xml" hash="92e358822c1457b0c170b8f61837d413"/></dir><file name=".DS_Store" hash="e1cd85e1ad3e575f3343c82cbc563116"/></dir><dir name="ServiceWorker"><dir name="Helper"><file name="Data.php" hash="43aff13a0e71fd995800fa1f9178c659"/></dir><dir name="controllers"><file name="IndexController.php" hash="4f3519caf41cd23c1dda6068f5960992"/></dir><dir name="etc"><file name="config.xml" hash="7ff3615eb92a706dc4b2b19c9a1ccced"/></dir></dir><file name=".DS_Store" hash="d20f5483213a4800451c37408874a2dd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="autocode.xml" hash="2aa2dbb52397cc65a59ac67e4e3afd66"/></dir><dir name="template"><dir name="autocode"><file name="autocodebackend.phtml" hash="8f97de1bbc67ca5f11b5b172ef5b5342"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="scriptblock.xml" hash="51512b2845d56dafa3028e8892702a76"/></dir><dir name="template"><dir name="scriptblock"><file name="foot.phtml" hash="2ded2491adf32d8157b8c6d5ec0b7726"/><file name="head.phtml" hash="0b9fa65fbf65b7efbf6fba7eda02ab3f"/><file name="index.phtml" hash="da91307168404679f859274c2bb878b9"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wigzo_AutoCode.xml" hash="fba2c2a20f4dad9b72a67f8876465906"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.4.0</min><max>5.9.0</max></php></required></dependencies>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Wigzo_AutoCode</name>
4
+ <version>0.2.0</version>
5
  <stability>stable</stability>
6
  <license>GNU</license>
7
  <channel>community</channel>
10
  <description>Wigzo Push is a plugin that allows you to Send and Track Web Push Notification through your Magento Store. It allows you to take Browser Opt in from people visiting your store and then Send and Track browser notifications to bring people back to your store, even when they are not browsing the site. It allows your store to re-engage your most loyal customers with targeted push notifications</description>
11
  <notes>Wigzo Push is a plugin that allows you to Send and Track Web Push Notification through your Magento Store. It allows you to take Browser Opt in from people visiting your store and then Send and Track browser notifications to bring people back to your store, even when they are not browsing the site. It allows your store to re-engage your most loyal customers with targeted push notifications</notes>
12
  <authors><author><name>wigzo</name><user>wigzo</user><email>info@wigo.com</email></author><author><name>shamail</name><user>shamail</user><email>shamail@wigzo.com</email></author></authors>
13
+ <date>2017-05-12</date>
14
+ <time>13:30:44</time>
15
+ <contents><target name="magelocal"><dir name="Wigzo"><dir name="AutoCode"><dir name="Block"><dir name="Adminhtml"><file name="Autocodebackend.php" hash="da50f2305de5c4e7163f7dfb7459be32"/></dir><file name="Index.php" hash="88b27827847cb37a5ab250ad7b0b6fd5"/><file name=".DS_Store" hash="b0fd28d4d518e950dd364c245b6cc36c"/></dir><dir name="CodeBlock"><file name="Myblock.php" hash="3c5f3ef2956dfa70e7f1fa96fdc20322"/></dir><dir name="Helper"><file name="Data.php" hash="43aff13a0e71fd995800fa1f9178c659"/></dir><dir name="Model"><file name="Observer.php" hash="ff8c027877d2e4457f9275b8dd78fe52"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AutocodebackendController.php" hash="5a0d87a3ce03fe5875da16540453ce0d"/></dir><file name="IndexController.php" hash="75f185ff119fa5c6ed7c67dfe2a090c7"/><file name=".DS_Store" hash="b0fd28d4d518e950dd364c245b6cc36c"/></dir><dir name="etc"><file name="config.xml" hash="29003cefdb50cce1fcfe18a6c0b51ac9"/><file name="system.xml" hash="92e358822c1457b0c170b8f61837d413"/></dir><file name=".DS_Store" hash="e1cd85e1ad3e575f3343c82cbc563116"/></dir><dir name="ServiceWorker"><dir name="Helper"><file name="Data.php" hash="43aff13a0e71fd995800fa1f9178c659"/></dir><dir name="controllers"><file name="IndexController.php" hash="a3627ab1f94a5bfe1a8b9cc172867df2"/></dir><dir name="etc"><file name="config.xml" hash="7ff3615eb92a706dc4b2b19c9a1ccced"/></dir></dir><file name=".DS_Store" hash="d20f5483213a4800451c37408874a2dd"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="autocode.xml" hash="2aa2dbb52397cc65a59ac67e4e3afd66"/></dir><dir name="template"><dir name="autocode"><file name="autocodebackend.phtml" hash="8f97de1bbc67ca5f11b5b172ef5b5342"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="scriptblock.xml" hash="51512b2845d56dafa3028e8892702a76"/></dir><dir name="template"><dir name="scriptblock"><file name="foot.phtml" hash="2ded2491adf32d8157b8c6d5ec0b7726"/><file name="head.phtml" hash="0b9fa65fbf65b7efbf6fba7eda02ab3f"/><file name="index.phtml" hash="da91307168404679f859274c2bb878b9"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wigzo_AutoCode.xml" hash="fba2c2a20f4dad9b72a67f8876465906"/></dir></target></contents>
16
  <compatible/>
17
  <dependencies><required><php><min>5.4.0</min><max>5.9.0</max></php></required></dependencies>
18
  </package>