insert-affiliate-react-native-sdk 1.13.0 → 1.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.
@@ -17,6 +17,7 @@ declare const useDeepLinkIapProvider: () => {
17
17
  setInsertAffiliateIdentifierChangeCallback: (callback: import("./DeepLinkIapProvider").InsertAffiliateIdentifierChangeCallback | null) => void;
18
18
  handleInsertLinks: (url: string) => Promise<boolean>;
19
19
  initialize: (code: string | null, verboseLogging?: boolean, insertLinksEnabled?: boolean, insertLinksClipboardEnabled?: boolean, affiliateAttributionActiveTime?: number, preventAffiliateTransfer?: boolean) => Promise<void>;
20
+ setLogger: (logger: import("./DeepLinkIapProvider").InsertAffiliateLogger) => void;
20
21
  isInitialized: boolean;
21
22
  OfferCode: string | null;
22
23
  };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const react_1 = require("react");
4
4
  const DeepLinkIapProvider_1 = require("./DeepLinkIapProvider");
5
5
  const useDeepLinkIapProvider = () => {
6
- const { referrerLink, userId, validatePurchaseWithIapticAPI, storeExpectedStoreTransaction, returnUserAccountTokenAndStoreExpectedTransaction, returnInsertAffiliateIdentifier, isAffiliateAttributionValid, getAffiliateStoredDate, getAffiliateExpiryTimestamp, trackEvent, setShortCode, getAffiliateDetails, setInsertAffiliateIdentifier, setInsertAffiliateIdentifierChangeCallback, handleInsertLinks, initialize, isInitialized, OfferCode, } = (0, react_1.useContext)(DeepLinkIapProvider_1.DeepLinkIapContext);
6
+ const { referrerLink, userId, validatePurchaseWithIapticAPI, storeExpectedStoreTransaction, returnUserAccountTokenAndStoreExpectedTransaction, returnInsertAffiliateIdentifier, isAffiliateAttributionValid, getAffiliateStoredDate, getAffiliateExpiryTimestamp, trackEvent, setShortCode, getAffiliateDetails, setInsertAffiliateIdentifier, setInsertAffiliateIdentifierChangeCallback, handleInsertLinks, initialize, setLogger, isInitialized, OfferCode, } = (0, react_1.useContext)(DeepLinkIapProvider_1.DeepLinkIapContext);
7
7
  return {
8
8
  referrerLink,
9
9
  userId,
@@ -21,6 +21,7 @@ const useDeepLinkIapProvider = () => {
21
21
  setInsertAffiliateIdentifierChangeCallback,
22
22
  handleInsertLinks,
23
23
  initialize,
24
+ setLogger,
24
25
  isInitialized,
25
26
  OfferCode,
26
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insert-affiliate-react-native-sdk",
3
- "version": "1.13.0",
3
+ "version": "1.15.0",
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",
package/readme.md CHANGED
@@ -1011,6 +1011,45 @@ const rawIdentifier = await returnInsertAffiliateIdentifier(true);
1011
1011
 
1012
1012
  </details>
1013
1013
 
1014
+ <details>
1015
+ <summary><h3>Custom Logger</h3></summary>
1016
+
1017
+ By default, the SDK logs to the console. If you use a centralized logging service (e.g., Datadog, Sentry, Bugsnag), you can inject your own logger so all SDK logs flow through your system.
1018
+
1019
+ **Set a Custom Logger:**
1020
+
1021
+ ```javascript
1022
+ import { useDeepLinkIapProvider } from 'insert-affiliate-react-native-sdk';
1023
+ import type { InsertAffiliateLogger } from 'insert-affiliate-react-native-sdk';
1024
+
1025
+ const { setLogger, initialize } = useDeepLinkIapProvider();
1026
+
1027
+ // Call setLogger before initialize
1028
+ setLogger({
1029
+ debug: (message, ...args) => MyLogger.debug(message, ...args),
1030
+ info: (message, ...args) => MyLogger.info(message, ...args),
1031
+ warn: (message, ...args) => MyLogger.warn(message, ...args),
1032
+ error: (message, ...args) => MyLogger.error(message, ...args),
1033
+ });
1034
+
1035
+ initialize('YOUR_COMPANY_CODE', true);
1036
+ ```
1037
+
1038
+ **Logger Interface:**
1039
+
1040
+ ```typescript
1041
+ type InsertAffiliateLogger = {
1042
+ debug: (message: string, ...args: any[]) => void;
1043
+ info: (message: string, ...args: any[]) => void;
1044
+ warn: (message: string, ...args: any[]) => void;
1045
+ error: (message: string, ...args: any[]) => void;
1046
+ };
1047
+ ```
1048
+
1049
+ If `setLogger` is not called, the SDK uses the default console-based logger with `[Insert Affiliate]` prefixed messages.
1050
+
1051
+ </details>
1052
+
1014
1053
  ### Prevent Affiliate Transfer
1015
1054
 
1016
1055
  By default, clicking a new affiliate link will overwrite any existing attribution. Enable `preventAffiliateTransfer` to lock the first affiliate: