@blotoutio/edgetag-sdk-js 0.7.2 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -211,6 +211,43 @@ const getUserAgent = () => {
211
211
  return '';
212
212
  }
213
213
  };
214
+ const getReferrer = () => {
215
+ let referrer = '';
216
+ try {
217
+ const referrerUrl = new URL(document.referrer);
218
+ if (referrerUrl.host !== window.location.host) {
219
+ referrer = referrerUrl.href;
220
+ }
221
+ return referrer;
222
+ }
223
+ catch (error) {
224
+ return referrer;
225
+ }
226
+ };
227
+ const getPageUrl = () => {
228
+ try {
229
+ return window.location.href;
230
+ }
231
+ catch (_a) {
232
+ return '';
233
+ }
234
+ };
235
+ const getSearch = () => {
236
+ try {
237
+ return window.location.search;
238
+ }
239
+ catch (_a) {
240
+ return '';
241
+ }
242
+ };
243
+ const getPageTitle = () => {
244
+ try {
245
+ return document.title;
246
+ }
247
+ catch (_a) {
248
+ return '';
249
+ }
250
+ };
214
251
  const isProviderIncluded = (providers, providerValue) => {
215
252
  return (providerValue || (providers['all'] === true && providerValue === undefined));
216
253
  };
@@ -498,14 +535,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
498
535
  });
499
536
  });
500
537
  const getStandardPayload = (payload) => {
501
- let pageUrl;
502
- try {
503
- pageUrl = window.location.href;
504
- }
505
- catch (_a) {
506
- pageUrl = '';
507
- }
508
- const data = Object.assign({ pageUrl, userAgent: getUserAgent() }, (payload || {}));
538
+ const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch() }, (payload || {}));
509
539
  let storage = {};
510
540
  const session = getData$1('session');
511
541
  if (session) {
package/index.esm.js CHANGED
@@ -189,6 +189,43 @@ const getUserAgent = () => {
189
189
  return '';
190
190
  }
191
191
  };
192
+ const getReferrer = () => {
193
+ let referrer = '';
194
+ try {
195
+ const referrerUrl = new URL(document.referrer);
196
+ if (referrerUrl.host !== window.location.host) {
197
+ referrer = referrerUrl.href;
198
+ }
199
+ return referrer;
200
+ }
201
+ catch (error) {
202
+ return referrer;
203
+ }
204
+ };
205
+ const getPageUrl = () => {
206
+ try {
207
+ return window.location.href;
208
+ }
209
+ catch (_a) {
210
+ return '';
211
+ }
212
+ };
213
+ const getSearch = () => {
214
+ try {
215
+ return window.location.search;
216
+ }
217
+ catch (_a) {
218
+ return '';
219
+ }
220
+ };
221
+ const getPageTitle = () => {
222
+ try {
223
+ return document.title;
224
+ }
225
+ catch (_a) {
226
+ return '';
227
+ }
228
+ };
192
229
  const isProviderIncluded = (providers, providerValue) => {
193
230
  return (providerValue || (providers['all'] === true && providerValue === undefined));
194
231
  };
@@ -476,14 +513,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
476
513
  });
477
514
  });
478
515
  const getStandardPayload = (payload) => {
479
- let pageUrl;
480
- try {
481
- pageUrl = window.location.href;
482
- }
483
- catch (_a) {
484
- pageUrl = '';
485
- }
486
- const data = Object.assign({ pageUrl, userAgent: getUserAgent() }, (payload || {}));
516
+ const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch() }, (payload || {}));
487
517
  let storage = {};
488
518
  const session = getData$1('session');
489
519
  if (session) {
package/internal.d.ts CHANGED
@@ -29,6 +29,9 @@ type DataPayload = {
29
29
 
30
30
  type PostPayload = {
31
31
  pageUrl: string
32
+ pageTitle: string
33
+ referrer: string
34
+ search: string
32
35
  userAgent: string
33
36
  data?: Data
34
37
  storage?: Data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",