@blotoutio/edgetag-sdk-js 0.13.0 → 0.15.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 +8 -2
- package/index.esm.js +8 -2
- package/internal.d.ts +2 -0
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -478,6 +478,8 @@ const handleGetUserId = () => {
|
|
|
478
478
|
if (initUserId) {
|
|
479
479
|
return initUserId;
|
|
480
480
|
}
|
|
481
|
+
// leaving this for backward compatibility as worker was maybe not updated yet
|
|
482
|
+
// reference https://github.com/blotoutio/solutions/issues/1960
|
|
481
483
|
return getCookieValue(cookieKey);
|
|
482
484
|
};
|
|
483
485
|
const setUserId = (userId) => {
|
|
@@ -519,7 +521,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
|
|
|
519
521
|
});
|
|
520
522
|
});
|
|
521
523
|
const getStandardPayload = (payload) => {
|
|
522
|
-
const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.
|
|
524
|
+
const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.15.0" }, (payload || {}));
|
|
523
525
|
let storage = {};
|
|
524
526
|
const session = getData$1('session');
|
|
525
527
|
if (session) {
|
|
@@ -705,7 +707,7 @@ const handleData = (data, providers, options) => {
|
|
|
705
707
|
});
|
|
706
708
|
});
|
|
707
709
|
}
|
|
708
|
-
postRequest(getDataURL(), { data }, options).catch(error);
|
|
710
|
+
postRequest(getDataURL(), { data, providers }, options).catch(error);
|
|
709
711
|
};
|
|
710
712
|
|
|
711
713
|
const saveDataToEdge = (key, value, provider) => {
|
|
@@ -860,6 +862,9 @@ const handleInit = (preferences) => {
|
|
|
860
862
|
log('Initialization failed');
|
|
861
863
|
return;
|
|
862
864
|
}
|
|
865
|
+
if (result.userId) {
|
|
866
|
+
setUserId(result.userId);
|
|
867
|
+
}
|
|
863
868
|
handleManifest(result.result);
|
|
864
869
|
})
|
|
865
870
|
.catch(error);
|
|
@@ -893,6 +898,7 @@ const handleUser = (key, value, providers, options) => {
|
|
|
893
898
|
postRequest(getUserURL(), {
|
|
894
899
|
key,
|
|
895
900
|
value,
|
|
901
|
+
providers,
|
|
896
902
|
}, options).catch(error);
|
|
897
903
|
};
|
|
898
904
|
|
package/index.esm.js
CHANGED
|
@@ -474,6 +474,8 @@ const handleGetUserId = () => {
|
|
|
474
474
|
if (initUserId) {
|
|
475
475
|
return initUserId;
|
|
476
476
|
}
|
|
477
|
+
// leaving this for backward compatibility as worker was maybe not updated yet
|
|
478
|
+
// reference https://github.com/blotoutio/solutions/issues/1960
|
|
477
479
|
return getCookieValue(cookieKey);
|
|
478
480
|
};
|
|
479
481
|
const setUserId = (userId) => {
|
|
@@ -515,7 +517,7 @@ const ajax = (method, url, payload) => __awaiter(void 0, void 0, void 0, functio
|
|
|
515
517
|
});
|
|
516
518
|
});
|
|
517
519
|
const getStandardPayload = (payload) => {
|
|
518
|
-
const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.
|
|
520
|
+
const data = Object.assign({ pageUrl: getPageUrl(), pageTitle: getPageTitle(), userAgent: getUserAgent(), referrer: getReferrer(), search: getSearch(), sdkVersion: "0.15.0" }, (payload || {}));
|
|
519
521
|
let storage = {};
|
|
520
522
|
const session = getData$1('session');
|
|
521
523
|
if (session) {
|
|
@@ -701,7 +703,7 @@ const handleData = (data, providers, options) => {
|
|
|
701
703
|
});
|
|
702
704
|
});
|
|
703
705
|
}
|
|
704
|
-
postRequest(getDataURL(), { data }, options).catch(error);
|
|
706
|
+
postRequest(getDataURL(), { data, providers }, options).catch(error);
|
|
705
707
|
};
|
|
706
708
|
|
|
707
709
|
const saveDataToEdge = (key, value, provider) => {
|
|
@@ -856,6 +858,9 @@ const handleInit = (preferences) => {
|
|
|
856
858
|
log('Initialization failed');
|
|
857
859
|
return;
|
|
858
860
|
}
|
|
861
|
+
if (result.userId) {
|
|
862
|
+
setUserId(result.userId);
|
|
863
|
+
}
|
|
859
864
|
handleManifest(result.result);
|
|
860
865
|
})
|
|
861
866
|
.catch(error);
|
|
@@ -889,6 +894,7 @@ const handleUser = (key, value, providers, options) => {
|
|
|
889
894
|
postRequest(getUserURL(), {
|
|
890
895
|
key,
|
|
891
896
|
value,
|
|
897
|
+
providers,
|
|
892
898
|
}, options).catch(error);
|
|
893
899
|
};
|
|
894
900
|
|
package/internal.d.ts
CHANGED