insert-affiliate-react-native-sdk 1.4.7 → 1.4.9
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.
|
@@ -390,13 +390,19 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
390
390
|
// MARK: Track Event
|
|
391
391
|
const trackEvent = (eventName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
392
392
|
try {
|
|
393
|
+
if (!companyCode || (companyCode.trim() === '' && companyCode !== null)) {
|
|
394
|
+
console.error("[Insert Affiliate] Company code is not set. Please initialize the SDK with a valid company code.");
|
|
395
|
+
return Promise.resolve();
|
|
396
|
+
}
|
|
397
|
+
console.log("track event called with - companyCode: ", companyCode);
|
|
393
398
|
if (!referrerLink || !userId) {
|
|
394
399
|
console.warn('[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.');
|
|
395
400
|
return Promise.resolve();
|
|
396
401
|
}
|
|
397
402
|
const payload = {
|
|
398
403
|
eventName,
|
|
399
|
-
deepLinkParam: `${referrerLink}
|
|
404
|
+
deepLinkParam: `${referrerLink}-${userId}`,
|
|
405
|
+
companyId: companyCode,
|
|
400
406
|
};
|
|
401
407
|
const response = yield axios_1.default.post('https://api.insertaffiliate.com/v1/trackEvent', payload, {
|
|
402
408
|
headers: { 'Content-Type': 'application/json' },
|
package/package.json
CHANGED
|
@@ -463,6 +463,13 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
463
463
|
// MARK: Track Event
|
|
464
464
|
const trackEvent = async (eventName: string): Promise<void> => {
|
|
465
465
|
try {
|
|
466
|
+
if (!companyCode || (companyCode.trim() === '' && companyCode !== null)) {
|
|
467
|
+
console.error("[Insert Affiliate] Company code is not set. Please initialize the SDK with a valid company code.");
|
|
468
|
+
return Promise.resolve();
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
console.log("track event called with - companyCode: ", companyCode);
|
|
472
|
+
|
|
466
473
|
if (!referrerLink || !userId) {
|
|
467
474
|
console.warn(
|
|
468
475
|
'[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.'
|
|
@@ -472,7 +479,8 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
472
479
|
|
|
473
480
|
const payload = {
|
|
474
481
|
eventName,
|
|
475
|
-
deepLinkParam: `${referrerLink}
|
|
482
|
+
deepLinkParam: `${referrerLink}-${userId}`,
|
|
483
|
+
companyId: companyCode,
|
|
476
484
|
};
|
|
477
485
|
|
|
478
486
|
const response = await axios.post(
|