insert-affiliate-react-native-sdk 1.4.7 → 1.4.8

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,6 +390,10 @@ 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
+ }
393
397
  if (!referrerLink || !userId) {
394
398
  console.warn('[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.');
395
399
  return Promise.resolve();
@@ -397,6 +401,7 @@ const DeepLinkIapProvider = ({ children, }) => {
397
401
  const payload = {
398
402
  eventName,
399
403
  deepLinkParam: `${referrerLink}/${userId}`,
404
+ companyId: companyCode,
400
405
  };
401
406
  const response = yield axios_1.default.post('https://api.insertaffiliate.com/v1/trackEvent', payload, {
402
407
  headers: { 'Content-Type': 'application/json' },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insert-affiliate-react-native-sdk",
3
- "version": "1.4.7",
3
+ "version": "1.4.8",
4
4
  "description": "A package for connecting with the Insert Affiliate Platform to add app based affiliate marketing.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -463,6 +463,11 @@ 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
+
466
471
  if (!referrerLink || !userId) {
467
472
  console.warn(
468
473
  '[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.'
@@ -473,6 +478,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
473
478
  const payload = {
474
479
  eventName,
475
480
  deepLinkParam: `${referrerLink}/${userId}`,
481
+ companyId: companyCode,
476
482
  };
477
483
 
478
484
  const response = await axios.post(