@blotoutio/edgetag-sdk-js 0.45.4 → 0.46.0

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.js CHANGED
@@ -10,10 +10,17 @@ var api = /*#__PURE__*/Object.freeze({
10
10
  get init () { return init; },
11
11
  get isNewUser () { return isNewUser; },
12
12
  get keys () { return keys; },
13
+ get setConfig () { return setConfig; },
13
14
  get tag () { return tag; },
14
15
  get user () { return user; }
15
16
  });
16
17
 
18
+ const _config = {};
19
+ const setConfig$1 = (config) => {
20
+ Object.assign(_config, config);
21
+ };
22
+ const getConfig = () => _config;
23
+
17
24
  const getUserAgent = () => {
18
25
  try {
19
26
  const nav = navigator;
@@ -39,10 +46,12 @@ const getReferrer = () => {
39
46
  };
40
47
  const getPageUrl = () => {
41
48
  try {
49
+ // we need to leave this one in for existing Custom pixel customers
42
50
  if (window.edgetagData && window.edgetagData['pageUrl']) {
43
51
  return window.edgetagData['pageUrl'];
44
52
  }
45
- return window.location.href;
53
+ const { pageUrl } = getConfig();
54
+ return pageUrl || window.location.href;
46
55
  }
47
56
  catch {
48
57
  return '';
@@ -364,7 +373,7 @@ const getStandardPayload = (payload) => {
364
373
  referrer: getReferrer(),
365
374
  search: getSearch(),
366
375
  locale: getLocale(),
367
- sdkVersion: "0.45.4" ,
376
+ sdkVersion: "0.46.0" ,
368
377
  ...(payload || {}),
369
378
  };
370
379
  let storage = {};
@@ -1126,6 +1135,10 @@ const handleGetConsent = (callback) => {
1126
1135
  });
1127
1136
  };
1128
1137
 
1138
+ const handleConfig = (config) => {
1139
+ setConfig$1(config);
1140
+ };
1141
+
1129
1142
  const init = (preferences) => {
1130
1143
  handleInit(preferences);
1131
1144
  };
@@ -1156,6 +1169,9 @@ const getConsent = (callback) => {
1156
1169
  const isNewUser = () => {
1157
1170
  return handleIsNewUser();
1158
1171
  };
1172
+ const setConfig = (config) => {
1173
+ return handleConfig(config);
1174
+ };
1159
1175
 
1160
1176
  exports.consent = consent;
1161
1177
  exports.data = data;
@@ -1165,5 +1181,6 @@ exports.getUserId = getUserId;
1165
1181
  exports.init = init;
1166
1182
  exports.isNewUser = isNewUser;
1167
1183
  exports.keys = keys;
1184
+ exports.setConfig = setConfig;
1168
1185
  exports.tag = tag;
1169
1186
  exports.user = user;
package/index.d.ts CHANGED
@@ -10,6 +10,8 @@ export {
10
10
  Data,
11
11
  EventOptions,
12
12
  PersistType,
13
+ ConfigOptions,
14
+ ConsentOptions,
13
15
  } from '@blotoutio/shared/utility-sdk'
14
16
 
15
17
  export type UserKey =
@@ -44,7 +46,7 @@ export declare const tag: (
44
46
  options?: EventOptions
45
47
  ) => void
46
48
 
47
- export declare const consent: (consent: Data) => void
49
+ export declare const consent: (consent: Data, options: ConsentOptions) => void
48
50
 
49
51
  export declare const user: (
50
52
  key: UserKey,
@@ -70,6 +72,8 @@ export declare const getUserId: () => string
70
72
 
71
73
  export declare const isNewUser: () => boolean | undefined
72
74
 
75
+ export declare const setConfig: (config: ConfigOptions) => void
76
+
73
77
  export declare global {
74
78
  interface Window {
75
79
  edgetagData: Record<string, string>
package/index.mjs CHANGED
@@ -8,10 +8,17 @@ var api = /*#__PURE__*/Object.freeze({
8
8
  get init () { return init; },
9
9
  get isNewUser () { return isNewUser; },
10
10
  get keys () { return keys; },
11
+ get setConfig () { return setConfig; },
11
12
  get tag () { return tag; },
12
13
  get user () { return user; }
13
14
  });
14
15
 
16
+ const _config = {};
17
+ const setConfig$1 = (config) => {
18
+ Object.assign(_config, config);
19
+ };
20
+ const getConfig = () => _config;
21
+
15
22
  const getUserAgent = () => {
16
23
  try {
17
24
  const nav = navigator;
@@ -37,10 +44,12 @@ const getReferrer = () => {
37
44
  };
38
45
  const getPageUrl = () => {
39
46
  try {
47
+ // we need to leave this one in for existing Custom pixel customers
40
48
  if (window.edgetagData && window.edgetagData['pageUrl']) {
41
49
  return window.edgetagData['pageUrl'];
42
50
  }
43
- return window.location.href;
51
+ const { pageUrl } = getConfig();
52
+ return pageUrl || window.location.href;
44
53
  }
45
54
  catch {
46
55
  return '';
@@ -362,7 +371,7 @@ const getStandardPayload = (payload) => {
362
371
  referrer: getReferrer(),
363
372
  search: getSearch(),
364
373
  locale: getLocale(),
365
- sdkVersion: "0.45.4" ,
374
+ sdkVersion: "0.46.0" ,
366
375
  ...(payload || {}),
367
376
  };
368
377
  let storage = {};
@@ -1124,6 +1133,10 @@ const handleGetConsent = (callback) => {
1124
1133
  });
1125
1134
  };
1126
1135
 
1136
+ const handleConfig = (config) => {
1137
+ setConfig$1(config);
1138
+ };
1139
+
1127
1140
  const init = (preferences) => {
1128
1141
  handleInit(preferences);
1129
1142
  };
@@ -1154,5 +1167,8 @@ const getConsent = (callback) => {
1154
1167
  const isNewUser = () => {
1155
1168
  return handleIsNewUser();
1156
1169
  };
1170
+ const setConfig = (config) => {
1171
+ return handleConfig(config);
1172
+ };
1157
1173
 
1158
- export { consent, data, getConsent, getData, getUserId, init, isNewUser, keys, tag, user };
1174
+ export { consent, data, getConsent, getData, getUserId, init, isNewUser, keys, setConfig, tag, user };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blotoutio/edgetag-sdk-js",
3
- "version": "0.45.4",
3
+ "version": "0.46.0",
4
4
  "description": "JS SDK for EdgeTag",
5
5
  "author": "Blotout",
6
6
  "license": "MIT",