@blotoutio/edgetag-sdk-browser 0.45.4 → 0.46.1

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.
Files changed (2) hide show
  1. package/index.js +25 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -11,10 +11,17 @@
11
11
  get init () { return init; },
12
12
  get isNewUser () { return isNewUser; },
13
13
  get keys () { return keys; },
14
+ get setConfig () { return setConfig; },
14
15
  get tag () { return tag; },
15
16
  get user () { return user; }
16
17
  });
17
18
 
19
+ const _config = {};
20
+ const setConfig$1 = (config) => {
21
+ Object.assign(_config, config);
22
+ };
23
+ const getConfig = () => _config;
24
+
18
25
  const getUserAgent = () => {
19
26
  try {
20
27
  const nav = navigator;
@@ -40,10 +47,12 @@
40
47
  };
41
48
  const getPageUrl = () => {
42
49
  try {
50
+ // we need to leave this one in for existing Custom pixel customers
43
51
  if (window.edgetagData && window.edgetagData['pageUrl']) {
44
52
  return window.edgetagData['pageUrl'];
45
53
  }
46
- return window.location.href;
54
+ const { pageUrl } = getConfig();
55
+ return pageUrl || window.location.href;
47
56
  }
48
57
  catch {
49
58
  return '';
@@ -365,7 +374,7 @@
365
374
  referrer: getReferrer(),
366
375
  search: getSearch(),
367
376
  locale: getLocale(),
368
- sdkVersion: "0.45.4" ,
377
+ sdkVersion: "0.46.1" ,
369
378
  ...(payload || {}),
370
379
  };
371
380
  let storage = {};
@@ -858,16 +867,17 @@
858
867
  if (!value) {
859
868
  return;
860
869
  }
870
+ let updatedValue = value;
861
871
  if (typeof value !== 'string') {
862
872
  try {
863
- value = JSON.stringify(value);
873
+ updatedValue = JSON.stringify(value);
864
874
  }
865
875
  catch {
866
876
  log('Error stringify value.');
867
877
  return;
868
878
  }
869
879
  }
870
- handleData({ [`${provider}::${key}`]: value });
880
+ handleData({ [`${provider}::${key}`]: updatedValue });
871
881
  };
872
882
  const handleCaptureQuery = (provider, key, persistType, map) => {
873
883
  try {
@@ -1127,6 +1137,10 @@
1127
1137
  });
1128
1138
  };
1129
1139
 
1140
+ const handleConfig = (config) => {
1141
+ setConfig$1(config);
1142
+ };
1143
+
1130
1144
  const init = (preferences) => {
1131
1145
  handleInit(preferences);
1132
1146
  };
@@ -1157,6 +1171,9 @@
1157
1171
  const isNewUser = () => {
1158
1172
  return handleIsNewUser();
1159
1173
  };
1174
+ const setConfig = (config) => {
1175
+ return handleConfig(config);
1176
+ };
1160
1177
 
1161
1178
  // TODO https://github.com/blotoutio/solutions/issues/826
1162
1179
 
@@ -1200,6 +1217,10 @@
1200
1217
  isNewUser() {
1201
1218
  return isNewUser()
1202
1219
  }
1220
+
1221
+ setConfig(config) {
1222
+ return setConfig()
1223
+ }
1203
1224
  }
1204
1225
 
1205
1226
  var api = new API();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-browser",
3
- "version": "0.45.4",
3
+ "version": "0.46.1",
4
4
  "description": "Browser SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",