@blotoutio/edgetag-sdk-browser 0.37.0 → 0.38.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.js +33 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
get getData () { return getData; },
|
|
10
10
|
get getUserId () { return getUserId; },
|
|
11
11
|
get init () { return init; },
|
|
12
|
+
get isNewUser () { return isNewUser; },
|
|
12
13
|
get keys () { return keys; },
|
|
13
14
|
get tag () { return tag; },
|
|
14
15
|
get user () { return user; }
|
|
@@ -364,7 +365,7 @@
|
|
|
364
365
|
referrer: getReferrer(),
|
|
365
366
|
search: getSearch(),
|
|
366
367
|
locale: getLocale(),
|
|
367
|
-
sdkVersion: "0.
|
|
368
|
+
sdkVersion: "0.38.0" ,
|
|
368
369
|
...(payload || {}),
|
|
369
370
|
};
|
|
370
371
|
let storage = {};
|
|
@@ -954,6 +955,17 @@
|
|
|
954
955
|
processStubs();
|
|
955
956
|
};
|
|
956
957
|
|
|
958
|
+
let initIsNewUser = undefined;
|
|
959
|
+
const handleIsNewUser = () => {
|
|
960
|
+
if (initIsNewUser !== undefined) {
|
|
961
|
+
return initIsNewUser;
|
|
962
|
+
}
|
|
963
|
+
return undefined;
|
|
964
|
+
};
|
|
965
|
+
const setIsNewUSer = (isNewUser) => {
|
|
966
|
+
initIsNewUser = isNewUser;
|
|
967
|
+
};
|
|
968
|
+
|
|
957
969
|
const handleInit = (preferences) => {
|
|
958
970
|
const success = setPreferences(preferences);
|
|
959
971
|
if (!success) {
|
|
@@ -984,7 +996,20 @@
|
|
|
984
996
|
if (result.consent && !consent) {
|
|
985
997
|
saveConsent(result.consent);
|
|
986
998
|
}
|
|
999
|
+
setIsNewUSer(result.isNewUser);
|
|
987
1000
|
handleManifest(result.result, consent || result.consent);
|
|
1001
|
+
try {
|
|
1002
|
+
window.dispatchEvent(new CustomEvent('edgetag-initialized', {
|
|
1003
|
+
detail: {
|
|
1004
|
+
userId: result.userId,
|
|
1005
|
+
isNewUser: result.isNewUser,
|
|
1006
|
+
consent: result.consent,
|
|
1007
|
+
},
|
|
1008
|
+
}));
|
|
1009
|
+
}
|
|
1010
|
+
catch {
|
|
1011
|
+
// do nothing
|
|
1012
|
+
}
|
|
988
1013
|
})
|
|
989
1014
|
.catch(error);
|
|
990
1015
|
};
|
|
@@ -1086,6 +1111,9 @@
|
|
|
1086
1111
|
const getConsent = (callback) => {
|
|
1087
1112
|
handleGetConsent(callback);
|
|
1088
1113
|
};
|
|
1114
|
+
const isNewUser = () => {
|
|
1115
|
+
return handleIsNewUser();
|
|
1116
|
+
};
|
|
1089
1117
|
|
|
1090
1118
|
// TODO https://github.com/blotoutio/solutions/issues/826
|
|
1091
1119
|
|
|
@@ -1125,6 +1153,10 @@
|
|
|
1125
1153
|
getConsent(callback, error) {
|
|
1126
1154
|
getConsent(callback);
|
|
1127
1155
|
}
|
|
1156
|
+
|
|
1157
|
+
isNewUser() {
|
|
1158
|
+
return isNewUser()
|
|
1159
|
+
}
|
|
1128
1160
|
}
|
|
1129
1161
|
|
|
1130
1162
|
var api = new API();
|