Version Description
- Added required javascript file for push notification support.
Download this release
Release Info
Developer | shubham773 |
Plugin | SendinBlue Subscribe Form And WP SMTP |
Version | 3.1.43 |
Comparing to | |
See all releases |
Code changes from version 3.1.42 to 3.1.43
- inc/SendinblueApiClient.php +1 -1
- readme.txt +4 -1
- scripts/service-worker-prod.php +244 -0
- scripts/service-worker-staging.php +244 -0
- sendinblue.php +44 -2
inc/SendinblueApiClient.php
CHANGED
@@ -14,7 +14,7 @@ class SendinblueApiClient
|
|
14 |
const RESPONSE_CODE_CREATED = 201;
|
15 |
const RESPONSE_CODE_ACCEPTED = 202;
|
16 |
const RESPONSE_CODE_UNAUTHORIZED = 401;
|
17 |
-
const PLUGIN_VERSION = '3.1.
|
18 |
const USER_AGENT = 'sendinblue_plugins/wordpress';
|
19 |
|
20 |
private $apiKey;
|
14 |
const RESPONSE_CODE_CREATED = 201;
|
15 |
const RESPONSE_CODE_ACCEPTED = 202;
|
16 |
const RESPONSE_CODE_UNAUTHORIZED = 401;
|
17 |
+
const PLUGIN_VERSION = '3.1.43';
|
18 |
const USER_AGENT = 'sendinblue_plugins/wordpress';
|
19 |
|
20 |
private $apiKey;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: Email Marketing, Newsletter, Sendinblue, Forms, smtp, marketing automation
|
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
-
Stable tag: 3.1.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -116,6 +116,9 @@ In order to create a signup form, you need to:
|
|
116 |
|
117 |
== Changelog ==
|
118 |
|
|
|
|
|
|
|
119 |
= 3.1.42 =
|
120 |
* Enhanced the plugin to be compatible upto Wordpress version 6.0
|
121 |
|
4 |
Requires at least: 4.4
|
5 |
Tested up to: 6.0
|
6 |
Requires PHP: 5.6
|
7 |
+
Stable tag: 3.1.43
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
116 |
|
117 |
== Changelog ==
|
118 |
|
119 |
+
= 3.1.43 =
|
120 |
+
* Added required javascript file for push notification support.
|
121 |
+
|
122 |
= 3.1.42 =
|
123 |
* Enhanced the plugin to be compatible upto Wordpress version 6.0
|
124 |
|
scripts/service-worker-prod.php
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
function _classCallCheck(t, e) {
|
4 |
+
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
5 |
+
}
|
6 |
+
|
7 |
+
function _defineProperties(t, e) {
|
8 |
+
for (var n = 0; n < e.length; n++) {
|
9 |
+
var i = e[n];
|
10 |
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i)
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
function _createClass(t, e, n) {
|
15 |
+
return e && _defineProperties(t.prototype, e), n && _defineProperties(t, n), Object.defineProperty(t, "prototype", {
|
16 |
+
writable: !1
|
17 |
+
}), t
|
18 |
+
}
|
19 |
+
self.PUSHOWL_SERVICE_WORKER_VERSION = "2.2";
|
20 |
+
var ErrorHelper = function() {
|
21 |
+
var e = "https://sentry.io/api/1891871/store/?sentry_version=7&sentry_key=0df575aa94e3419782416c33a46d9dd7";
|
22 |
+
|
23 |
+
function i(t) {
|
24 |
+
(t = t || {}).poServiceWorkerVersion = self.PUSHOWL_SERVICE_WORKER_VERSION;
|
25 |
+
var e = (new Date).toISOString().split(".")[0];
|
26 |
+
return {
|
27 |
+
event_id: "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
28 |
+
var e = 16 * Math.random() | 0;
|
29 |
+
return ("x" === t ? e : 3 & e | 8).toString(16)
|
30 |
+
}),
|
31 |
+
logger: "cdn-service-worker",
|
32 |
+
platform: "javascript",
|
33 |
+
timestamp: e,
|
34 |
+
extra: t,
|
35 |
+
release: "de87afe"
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function r(t) {
|
40 |
+
return fetch(e, {
|
41 |
+
method: "post",
|
42 |
+
mode: "no-cors",
|
43 |
+
headers: {
|
44 |
+
"Content-Type": "application/json"
|
45 |
+
},
|
46 |
+
body: JSON.stringify(t)
|
47 |
+
})
|
48 |
+
}
|
49 |
+
|
50 |
+
function a(t, e) {
|
51 |
+
(e = e || {}).errorDump = {
|
52 |
+
str: String(t),
|
53 |
+
stack: t && t.stack
|
54 |
+
};
|
55 |
+
var n = i(e);
|
56 |
+
return n.exception = ((t = ((e = t).stack || "").split("\n").map(function(t) {
|
57 |
+
return t.trim()
|
58 |
+
}).filter(function(t) {
|
59 |
+
return t.startsWith("at")
|
60 |
+
}).map(function(t) {
|
61 |
+
var e = "",
|
62 |
+
n = 0,
|
63 |
+
i = 0,
|
64 |
+
r = "",
|
65 |
+
t = t.split(/[ ]+/);
|
66 |
+
return "at" === t[0].trim() && 1 < t.length && (1 < (t = (2 < t.length ? (e = t[1], t[2]) : t[1]).replace("(", "").replace(")", "").split(":")).length && (n = t[t.length - 1], i = t[t.length - 2], r = t.slice(0, t.length - 2).join(":"))), {
|
67 |
+
in_app: !0,
|
68 |
+
function: e,
|
69 |
+
colno: Number(n) || n,
|
70 |
+
lineno: Number(i) || i,
|
71 |
+
filename: r
|
72 |
+
}
|
73 |
+
})).reverse(), {
|
74 |
+
values: [{
|
75 |
+
type: e.name || "Error",
|
76 |
+
value: e.message || String(e),
|
77 |
+
stacktrace: {
|
78 |
+
frames: t
|
79 |
+
}
|
80 |
+
}]
|
81 |
+
}), r(n)
|
82 |
+
}
|
83 |
+
return {
|
84 |
+
log: function(t, e) {
|
85 |
+
return (e = i(e)).message = t, r(e)
|
86 |
+
},
|
87 |
+
logException: a,
|
88 |
+
withErrorReporting: function(t) {
|
89 |
+
return function(e) {
|
90 |
+
if (!e || !e.waitUntil) throw new Error("withErrorReporting should only be used for handlers that receive ExtendableEvent");
|
91 |
+
try {
|
92 |
+
return t(e)
|
93 |
+
} catch (t) {
|
94 |
+
var n = a(t, {
|
95 |
+
eventData: e && e.data && e.data.json()
|
96 |
+
});
|
97 |
+
e.waitUntil(n)
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}();
|
103 |
+
! function() {
|
104 |
+
var e = console,
|
105 |
+
o = new(function() {
|
106 |
+
function e(t) {
|
107 |
+
t = t.maxNetworkRetries;
|
108 |
+
_classCallCheck(this, e), this.maxNetworkRetries = t
|
109 |
+
}
|
110 |
+
return _createClass(e, [{
|
111 |
+
key: "payloadTransformation",
|
112 |
+
value: function(e) {
|
113 |
+
var t = e.title,
|
114 |
+
n = [],
|
115 |
+
i = e.actions;
|
116 |
+
if (i)
|
117 |
+
for (var r = 0; r < i.length; r++) {
|
118 |
+
var a = {
|
119 |
+
action: "action" + r,
|
120 |
+
title: i[r].title
|
121 |
+
};
|
122 |
+
n.push(a)
|
123 |
+
}
|
124 |
+
var o = !("require_interaction" in e) || e.require_interaction,
|
125 |
+
c = {
|
126 |
+
body: e.description || "",
|
127 |
+
tag: e.tag || e.id,
|
128 |
+
actions: n,
|
129 |
+
requireInteraction: o,
|
130 |
+
data: e
|
131 |
+
};
|
132 |
+
return ["icon", "badge", "image"].forEach(function(t) {
|
133 |
+
e[t] && (c[t] = e[t])
|
134 |
+
}), {
|
135 |
+
title: t,
|
136 |
+
config: c
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}, {
|
140 |
+
key: "processPush",
|
141 |
+
value: function(t) {
|
142 |
+
if (this.payload = t.data.json().data, !this.payload || "pushowl" !== this.payload.app) return Promise.resolve();
|
143 |
+
var e = this.payloadTransformation(this.payload),
|
144 |
+
t = e.title,
|
145 |
+
e = e.config,
|
146 |
+
t = this.displayNotification(t, e),
|
147 |
+
e = this.payload.delivery_acknowledgement_url,
|
148 |
+
e = this.update(e);
|
149 |
+
return Promise.all([e, t])
|
150 |
+
}
|
151 |
+
}, {
|
152 |
+
key: "displayNotification",
|
153 |
+
value: function(t, e) {
|
154 |
+
return self.registration.showNotification(t, e)
|
155 |
+
}
|
156 |
+
}, {
|
157 |
+
key: "update",
|
158 |
+
value: function(t) {
|
159 |
+
var r = this,
|
160 |
+
a = 1;
|
161 |
+
return new Promise(function(i, e) {
|
162 |
+
(function n() {
|
163 |
+
fetch(t, {
|
164 |
+
method: "POST",
|
165 |
+
headers: {
|
166 |
+
"Content-Type": "text/plain"
|
167 |
+
}
|
168 |
+
}).then(function(t) {
|
169 |
+
var e = Math.min(8e3, 1e3 * Math.pow(2, a));
|
170 |
+
429 === t.status && a++ <= r.maxNetworkRetries ? setTimeout(n, e) : i(t)
|
171 |
+
}).catch(function(t) {
|
172 |
+
return e(t)
|
173 |
+
})
|
174 |
+
})()
|
175 |
+
})
|
176 |
+
}
|
177 |
+
}, {
|
178 |
+
key: "openLink",
|
179 |
+
value: function(i) {
|
180 |
+
i && clients.matchAll({
|
181 |
+
type: "window"
|
182 |
+
}).then(function(t) {
|
183 |
+
for (var e = 0; e < t.length; e++) {
|
184 |
+
var n = t[e];
|
185 |
+
if (n.url === i && "focus" in n) return n.focus()
|
186 |
+
}
|
187 |
+
if (clients.openWindow) return clients.openWindow(i)
|
188 |
+
})
|
189 |
+
}
|
190 |
+
}], [{
|
191 |
+
key: "version",
|
192 |
+
get: function() {
|
193 |
+
return self.PUSHOWL_SERVICE_WORKER_VERSION
|
194 |
+
}
|
195 |
+
}]), e
|
196 |
+
}())({
|
197 |
+
maxNetworkRetries: 5
|
198 |
+
});
|
199 |
+
self.addEventListener("install", function(t) {
|
200 |
+
t.waitUntil(self.skipWaiting())
|
201 |
+
}), self.addEventListener("activate", function(t) {
|
202 |
+
t.waitUntil(self.clients.claim())
|
203 |
+
}), self.addEventListener("push", ErrorHelper.withErrorReporting(function(t) {
|
204 |
+
if (self.Notification && "granted" === self.Notification.permission) {
|
205 |
+
if (!t.data) throw new Error("Empty event data.");
|
206 |
+
var e = o.processPush(t);
|
207 |
+
t.waitUntil(e)
|
208 |
+
}
|
209 |
+
})), self.addEventListener("notificationclick", function(n) {
|
210 |
+
var i, t, e = n.notification,
|
211 |
+
r = e.data;
|
212 |
+
try {
|
213 |
+
i = r.redirect_url, a = r.click_acknowledgement_url, t = "body", n.action && (n.action.includes("action0") ? (i = r.actions[0].redirect_url, t = "cta1") : n.action.includes("action1") && (i = r.actions[1].redirect_url, t = "cta2"))
|
214 |
+
} catch (t) {
|
215 |
+
ErrorHelper.logException(t, e ? {
|
216 |
+
notification: {
|
217 |
+
title: e.title,
|
218 |
+
data: e.data,
|
219 |
+
actions: e.actions
|
220 |
+
}
|
221 |
+
} : void 0)
|
222 |
+
}
|
223 |
+
e = new Promise(function(t, e) {
|
224 |
+
n.notification.close(), o.openLink(i), t()
|
225 |
+
});
|
226 |
+
a += "&clicked_component=" + t;
|
227 |
+
var a = Promise.all([e, o.update(a)]);
|
228 |
+
n.waitUntil(a)
|
229 |
+
}), self.addEventListener("message", function(t) {
|
230 |
+
var e = o.payloadTransformation(t.data),
|
231 |
+
n = e.title,
|
232 |
+
e = e.config;
|
233 |
+
n && t.waitUntil(o.displayNotification(n, e))
|
234 |
+
}), self.addEventListener("notificationclose", function(i) {
|
235 |
+
i.waitUntil(new Promise(function(t, e) {
|
236 |
+
var n = i.notification.data.close_acknowledgement_url;
|
237 |
+
o.update(n).then(function() {
|
238 |
+
t()
|
239 |
+
}).catch(function() {})
|
240 |
+
}))
|
241 |
+
}), self.addEventListener("error", function(t) {
|
242 |
+
ErrorHelper.logException(t.error), e.error(t.filename, t.lineno, t.colno, t.message)
|
243 |
+
})
|
244 |
+
}();
|
scripts/service-worker-staging.php
ADDED
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"use strict";
|
2 |
+
|
3 |
+
function _classCallCheck(t, e) {
|
4 |
+
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
|
5 |
+
}
|
6 |
+
|
7 |
+
function _defineProperties(t, e) {
|
8 |
+
for (var n = 0; n < e.length; n++) {
|
9 |
+
var i = e[n];
|
10 |
+
i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i)
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
function _createClass(t, e, n) {
|
15 |
+
return e && _defineProperties(t.prototype, e), n && _defineProperties(t, n), Object.defineProperty(t, "prototype", {
|
16 |
+
writable: !1
|
17 |
+
}), t
|
18 |
+
}
|
19 |
+
self.PUSHOWL_SERVICE_WORKER_VERSION = "2.2";
|
20 |
+
var ErrorHelper = function() {
|
21 |
+
var e = "https://sentry.io/api/1891871/store/?sentry_version=7&sentry_key=0df575aa94e3419782416c33a46d9dd7";
|
22 |
+
|
23 |
+
function i(t) {
|
24 |
+
(t = t || {}).poServiceWorkerVersion = self.PUSHOWL_SERVICE_WORKER_VERSION;
|
25 |
+
var e = (new Date).toISOString().split(".")[0];
|
26 |
+
return {
|
27 |
+
event_id: "xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g, function(t) {
|
28 |
+
var e = 16 * Math.random() | 0;
|
29 |
+
return ("x" === t ? e : 3 & e | 8).toString(16)
|
30 |
+
}),
|
31 |
+
logger: "cdn-service-worker",
|
32 |
+
platform: "javascript",
|
33 |
+
timestamp: e,
|
34 |
+
extra: t,
|
35 |
+
release: "abc815b"
|
36 |
+
}
|
37 |
+
}
|
38 |
+
|
39 |
+
function r(t) {
|
40 |
+
return fetch(e, {
|
41 |
+
method: "post",
|
42 |
+
mode: "no-cors",
|
43 |
+
headers: {
|
44 |
+
"Content-Type": "application/json"
|
45 |
+
},
|
46 |
+
body: JSON.stringify(t)
|
47 |
+
})
|
48 |
+
}
|
49 |
+
|
50 |
+
function a(t, e) {
|
51 |
+
(e = e || {}).errorDump = {
|
52 |
+
str: String(t),
|
53 |
+
stack: t && t.stack
|
54 |
+
};
|
55 |
+
var n = i(e);
|
56 |
+
return n.exception = ((t = ((e = t).stack || "").split("\n").map(function(t) {
|
57 |
+
return t.trim()
|
58 |
+
}).filter(function(t) {
|
59 |
+
return t.startsWith("at")
|
60 |
+
}).map(function(t) {
|
61 |
+
var e = "",
|
62 |
+
n = 0,
|
63 |
+
i = 0,
|
64 |
+
r = "",
|
65 |
+
t = t.split(/[ ]+/);
|
66 |
+
return "at" === t[0].trim() && 1 < t.length && (1 < (t = (2 < t.length ? (e = t[1], t[2]) : t[1]).replace("(", "").replace(")", "").split(":")).length && (n = t[t.length - 1], i = t[t.length - 2], r = t.slice(0, t.length - 2).join(":"))), {
|
67 |
+
in_app: !0,
|
68 |
+
function: e,
|
69 |
+
colno: Number(n) || n,
|
70 |
+
lineno: Number(i) || i,
|
71 |
+
filename: r
|
72 |
+
}
|
73 |
+
})).reverse(), {
|
74 |
+
values: [{
|
75 |
+
type: e.name || "Error",
|
76 |
+
value: e.message || String(e),
|
77 |
+
stacktrace: {
|
78 |
+
frames: t
|
79 |
+
}
|
80 |
+
}]
|
81 |
+
}), r(n)
|
82 |
+
}
|
83 |
+
return {
|
84 |
+
log: function(t, e) {
|
85 |
+
return (e = i(e)).message = t, r(e)
|
86 |
+
},
|
87 |
+
logException: a,
|
88 |
+
withErrorReporting: function(t) {
|
89 |
+
return function(e) {
|
90 |
+
if (!e || !e.waitUntil) throw new Error("withErrorReporting should only be used for handlers that receive ExtendableEvent");
|
91 |
+
try {
|
92 |
+
return t(e)
|
93 |
+
} catch (t) {
|
94 |
+
var n = a(t, {
|
95 |
+
eventData: e && e.data && e.data.json()
|
96 |
+
});
|
97 |
+
e.waitUntil(n)
|
98 |
+
}
|
99 |
+
}
|
100 |
+
}
|
101 |
+
}
|
102 |
+
}();
|
103 |
+
! function() {
|
104 |
+
var e = console,
|
105 |
+
o = new(function() {
|
106 |
+
function e(t) {
|
107 |
+
t = t.maxNetworkRetries;
|
108 |
+
_classCallCheck(this, e), this.maxNetworkRetries = t
|
109 |
+
}
|
110 |
+
return _createClass(e, [{
|
111 |
+
key: "payloadTransformation",
|
112 |
+
value: function(e) {
|
113 |
+
var t = e.title,
|
114 |
+
n = [],
|
115 |
+
i = e.actions;
|
116 |
+
if (i)
|
117 |
+
for (var r = 0; r < i.length; r++) {
|
118 |
+
var a = {
|
119 |
+
action: "action" + r,
|
120 |
+
title: i[r].title
|
121 |
+
};
|
122 |
+
n.push(a)
|
123 |
+
}
|
124 |
+
var o = !("require_interaction" in e) || e.require_interaction,
|
125 |
+
c = {
|
126 |
+
body: e.description || "",
|
127 |
+
tag: e.tag || e.id,
|
128 |
+
actions: n,
|
129 |
+
requireInteraction: o,
|
130 |
+
data: e
|
131 |
+
};
|
132 |
+
return ["icon", "badge", "image"].forEach(function(t) {
|
133 |
+
e[t] && (c[t] = e[t])
|
134 |
+
}), {
|
135 |
+
title: t,
|
136 |
+
config: c
|
137 |
+
}
|
138 |
+
}
|
139 |
+
}, {
|
140 |
+
key: "processPush",
|
141 |
+
value: function(t) {
|
142 |
+
if (this.payload = t.data.json().data, !this.payload || "pushowl" !== this.payload.app) return Promise.resolve();
|
143 |
+
var e = this.payloadTransformation(this.payload),
|
144 |
+
t = e.title,
|
145 |
+
e = e.config,
|
146 |
+
t = this.displayNotification(t, e),
|
147 |
+
e = this.payload.delivery_acknowledgement_url,
|
148 |
+
e = this.update(e);
|
149 |
+
return Promise.all([e, t])
|
150 |
+
}
|
151 |
+
}, {
|
152 |
+
key: "displayNotification",
|
153 |
+
value: function(t, e) {
|
154 |
+
return self.registration.showNotification(t, e)
|
155 |
+
}
|
156 |
+
}, {
|
157 |
+
key: "update",
|
158 |
+
value: function(t) {
|
159 |
+
var r = this,
|
160 |
+
a = 1;
|
161 |
+
return new Promise(function(i, e) {
|
162 |
+
(function n() {
|
163 |
+
fetch(t, {
|
164 |
+
method: "POST",
|
165 |
+
headers: {
|
166 |
+
"Content-Type": "text/plain"
|
167 |
+
}
|
168 |
+
}).then(function(t) {
|
169 |
+
var e = Math.min(8e3, 1e3 * Math.pow(2, a));
|
170 |
+
429 === t.status && a++ <= r.maxNetworkRetries ? setTimeout(n, e) : i(t)
|
171 |
+
}).catch(function(t) {
|
172 |
+
return e(t)
|
173 |
+
})
|
174 |
+
})()
|
175 |
+
})
|
176 |
+
}
|
177 |
+
}, {
|
178 |
+
key: "openLink",
|
179 |
+
value: function(i) {
|
180 |
+
i && clients.matchAll({
|
181 |
+
type: "window"
|
182 |
+
}).then(function(t) {
|
183 |
+
for (var e = 0; e < t.length; e++) {
|
184 |
+
var n = t[e];
|
185 |
+
if (n.url === i && "focus" in n) return n.focus()
|
186 |
+
}
|
187 |
+
if (clients.openWindow) return clients.openWindow(i)
|
188 |
+
})
|
189 |
+
}
|
190 |
+
}], [{
|
191 |
+
key: "version",
|
192 |
+
get: function() {
|
193 |
+
return self.PUSHOWL_SERVICE_WORKER_VERSION
|
194 |
+
}
|
195 |
+
}]), e
|
196 |
+
}())({
|
197 |
+
maxNetworkRetries: 5
|
198 |
+
});
|
199 |
+
self.addEventListener("install", function(t) {
|
200 |
+
t.waitUntil(self.skipWaiting())
|
201 |
+
}), self.addEventListener("activate", function(t) {
|
202 |
+
t.waitUntil(self.clients.claim())
|
203 |
+
}), self.addEventListener("push", ErrorHelper.withErrorReporting(function(t) {
|
204 |
+
if (self.Notification && "granted" === self.Notification.permission) {
|
205 |
+
if (!t.data) throw new Error("Empty event data.");
|
206 |
+
var e = o.processPush(t);
|
207 |
+
t.waitUntil(e)
|
208 |
+
}
|
209 |
+
})), self.addEventListener("notificationclick", function(n) {
|
210 |
+
var i, t, e = n.notification,
|
211 |
+
r = e.data;
|
212 |
+
try {
|
213 |
+
i = r.redirect_url, a = r.click_acknowledgement_url, t = "body", n.action && (n.action.includes("action0") ? (i = r.actions[0].redirect_url, t = "cta1") : n.action.includes("action1") && (i = r.actions[1].redirect_url, t = "cta2"))
|
214 |
+
} catch (t) {
|
215 |
+
ErrorHelper.logException(t, e ? {
|
216 |
+
notification: {
|
217 |
+
title: e.title,
|
218 |
+
data: e.data,
|
219 |
+
actions: e.actions
|
220 |
+
}
|
221 |
+
} : void 0)
|
222 |
+
}
|
223 |
+
e = new Promise(function(t, e) {
|
224 |
+
n.notification.close(), o.openLink(i), t()
|
225 |
+
});
|
226 |
+
a += "&clicked_component=" + t;
|
227 |
+
var a = Promise.all([e, o.update(a)]);
|
228 |
+
n.waitUntil(a)
|
229 |
+
}), self.addEventListener("message", function(t) {
|
230 |
+
var e = o.payloadTransformation(t.data),
|
231 |
+
n = e.title,
|
232 |
+
e = e.config;
|
233 |
+
n && t.waitUntil(o.displayNotification(n, e))
|
234 |
+
}), self.addEventListener("notificationclose", function(i) {
|
235 |
+
i.waitUntil(new Promise(function(t, e) {
|
236 |
+
var n = i.notification.data.close_acknowledgement_url;
|
237 |
+
o.update(n).then(function() {
|
238 |
+
t()
|
239 |
+
}).catch(function() {})
|
240 |
+
}))
|
241 |
+
}), self.addEventListener("error", function(t) {
|
242 |
+
ErrorHelper.logException(t.error), e.error(t.filename, t.lineno, t.colno, t.message)
|
243 |
+
})
|
244 |
+
}();
|
sendinblue.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
|
4 |
* Plugin URI: https://www.sendinblue.com/?r=wporg
|
5 |
* Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
|
6 |
-
* Version: 3.1.
|
7 |
* Author: Sendinblue
|
8 |
* Author URI: https://www.sendinblue.com/?r=wporg
|
9 |
* License: GPLv2 or later
|
@@ -268,6 +268,7 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
|
|
268 |
SIB_Forms::modify_datatype();
|
269 |
|
270 |
if ( self::is_api_key_set() ) {
|
|
|
271 |
add_shortcode( 'sibwp_form', array( &$this, 'sibwp_form_shortcode' ) );
|
272 |
// register widget.
|
273 |
add_action( 'widgets_init', array( &$this, 'sib_create_widget' ) );
|
@@ -561,6 +562,47 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
|
|
561 |
return !empty($api_key);
|
562 |
}
|
563 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
564 |
/**
|
565 |
* Install marketing automation script in header
|
566 |
*/
|
@@ -578,7 +620,7 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
|
|
578 |
(function() {
|
579 |
window.sib ={equeue:[],client_key:"'. $ma_key .'"};/* OPTIONAL: email for identify request*/
|
580 |
window.sib.email_id = "'. sanitize_email($ma_email) .'";
|
581 |
-
window.sendinblue = {}; for (var j = [\'track\', \'identify\', \'trackLink\', \'page\'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();})();
|
582 |
</script>';
|
583 |
echo html_entity_decode($output);
|
584 |
}
|
3 |
* Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
|
4 |
* Plugin URI: https://www.sendinblue.com/?r=wporg
|
5 |
* Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
|
6 |
+
* Version: 3.1.43
|
7 |
* Author: Sendinblue
|
8 |
* Author URI: https://www.sendinblue.com/?r=wporg
|
9 |
* License: GPLv2 or later
|
268 |
SIB_Forms::modify_datatype();
|
269 |
|
270 |
if ( self::is_api_key_set() ) {
|
271 |
+
SIB_Manager::install_service_worker_script();
|
272 |
add_shortcode( 'sibwp_form', array( &$this, 'sibwp_form_shortcode' ) );
|
273 |
// register widget.
|
274 |
add_action( 'widgets_init', array( &$this, 'sib_create_widget' ) );
|
562 |
return !empty($api_key);
|
563 |
}
|
564 |
|
565 |
+
/**
|
566 |
+
* Install service-worker script in plugin for push notifications
|
567 |
+
* @return void
|
568 |
+
*/
|
569 |
+
static function install_service_worker_script()
|
570 |
+
{
|
571 |
+
try {
|
572 |
+
$service_worker = __DIR__ . "/js/service-worker.js";
|
573 |
+
if (file_exists($service_worker)){
|
574 |
+
return;
|
575 |
+
}
|
576 |
+
$site_url = get_site_url();
|
577 |
+
$service_worker_file = strpos($site_url, 'staging') !== false
|
578 |
+
? __DIR__ . '/scripts/service-worker-staging.php'
|
579 |
+
: __DIR__ . '/scripts/service-worker-prod.php';
|
580 |
+
$js_content = file_get_contents($service_worker_file);
|
581 |
+
$service_worker_script = fopen($service_worker, "w");
|
582 |
+
fwrite($service_worker_script, $js_content);
|
583 |
+
fclose($service_worker_script);
|
584 |
+
} catch(\Throwable $th){
|
585 |
+
update_option( 'sib_service_worker_install_exception', $th->getMessage());
|
586 |
+
}
|
587 |
+
}
|
588 |
+
|
589 |
+
/**
|
590 |
+
* Uninstall service-worker script from plugin
|
591 |
+
* @return void
|
592 |
+
*/
|
593 |
+
static function uninstall_service_worker_script()
|
594 |
+
{
|
595 |
+
try {
|
596 |
+
$service_worker_file = __DIR__ . "/js/service-worker.js";
|
597 |
+
if (file_exists($service_worker_file)){
|
598 |
+
unlink($service_worker_file);
|
599 |
+
}
|
600 |
+
update_option( 'sib_service_worker_install_exception', '');
|
601 |
+
} catch(\Throwable $th){
|
602 |
+
update_option( 'sib_service_worker_uninstall_exception', $th->getMessage());
|
603 |
+
}
|
604 |
+
}
|
605 |
+
|
606 |
/**
|
607 |
* Install marketing automation script in header
|
608 |
*/
|
620 |
(function() {
|
621 |
window.sib ={equeue:[],client_key:"'. $ma_key .'"};/* OPTIONAL: email for identify request*/
|
622 |
window.sib.email_id = "'. sanitize_email($ma_email) .'";
|
623 |
+
window.sendinblue = {}; for (var j = [\'track\', \'identify\', \'trackLink\', \'page\'], i = 0; i < j.length; i++) { (function(k) { window.sendinblue[k] = function() { var arg = Array.prototype.slice.call(arguments); (window.sib[k] || function() { var t = {}; t[k] = arg; window.sib.equeue.push(t);})(arg[0], arg[1], arg[2]);};})(j[i]);}var n = document.createElement("script"),i = document.getElementsByTagName("script")[0]; n.type = "text/javascript", n.id = "sendinblue-js", n.async = !0, n.src = "https://sibautomation.com/sa.js?plugin=wordpress&key=" + window.sib.client_key, i.parentNode.insertBefore(n, i), window.sendinblue.page();})();
|
624 |
</script>';
|
625 |
echo html_entity_decode($output);
|
626 |
}
|