insert-affiliate-react-native-sdk 1.4.8 → 1.5.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.
@@ -158,7 +158,7 @@ const DeepLinkIapProvider = ({ children, }) => {
158
158
  const isShortCode = (referringLink) => {
159
159
  // Short codes are less than 10 characters
160
160
  const isValidCharacters = /^[a-zA-Z0-9]+$/.test(referringLink);
161
- return isValidCharacters && referringLink.length < 10;
161
+ return isValidCharacters && referringLink.length < 25 && referringLink.length > 3;
162
162
  };
163
163
  function setShortCode(shortCode) {
164
164
  return __awaiter(this, void 0, void 0, function* () {
@@ -394,13 +394,14 @@ const DeepLinkIapProvider = ({ children, }) => {
394
394
  console.error("[Insert Affiliate] Company code is not set. Please initialize the SDK with a valid company code.");
395
395
  return Promise.resolve();
396
396
  }
397
+ console.log("track event called with - companyCode: ", companyCode);
397
398
  if (!referrerLink || !userId) {
398
399
  console.warn('[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.');
399
400
  return Promise.resolve();
400
401
  }
401
402
  const payload = {
402
403
  eventName,
403
- deepLinkParam: `${referrerLink}/${userId}`,
404
+ deepLinkParam: `${referrerLink}-${userId}`,
404
405
  companyId: companyCode,
405
406
  };
406
407
  const response = yield axios_1.default.post('https://api.insertaffiliate.com/v1/trackEvent', payload, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "insert-affiliate-react-native-sdk",
3
- "version": "1.4.8",
3
+ "version": "1.5.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
@@ -131,6 +131,7 @@ React.useEffect(() => {
131
131
 
132
132
 
133
133
  ### Option 2: Iaptic Integration
134
+ #### 1. Code Setup
134
135
  First, complete the [Iaptic account setup](https://www.iaptic.com/signup) and code integration.
135
136
 
136
137
  Then after setting up the in app purchase (IAP) with Iaptic, call Insert Affiliate's ```validatePurchaseWithIapticAPI``` on purchase.
@@ -208,6 +209,18 @@ export default App;
208
209
  - Replace `{{ your_iaptic_public_key }}` with your **Iaptic Public Key**. You can find this [here](https://www.iaptic.com/settings).
209
210
  - Replace `{{ your_company_code }}` with the unique company code associated with your Insert Affiliate account. You can find this code in your dashboard under [Settings](http://app.insertaffiliate.com/settings).
210
211
 
212
+ #### 2. Webhook Setup
213
+ 1. Open the [Insert Affiliate settings](https://app.insertaffiliate.com/settings):
214
+ - Navigate to the Verification Settings section
215
+ - Set the In-App Purchase Verification method to `Iaptic`
216
+ - Copy the `Iaptic Webhook URL` and the `Iaptic Webhook Sandbox URL`- you'll need it in the next step.
217
+ 2. Go to the [Iaptic Settings](https://www.iaptic.com/settings)
218
+ - Paste the copied `Iaptic Webhook URL` into the `Webhook URL` field
219
+ - Paste the copied `Iaptic Webhook Sandbox URL` into the `Sandbox Webhook URL` field
220
+ - Click **Save Settings**.
221
+ 3. Check that you have completed the [Iaptic setup for the App Store Server Notifications](https://www.iaptic.com/documentation/setup/ios-subscription-status-url)
222
+ 4. Check that you have completed the [Iaptic setup for the Google Play Notifications URL](https://www.iaptic.com/documentation/setup/connect-with-google-publisher-api)
223
+
211
224
  ### Option 3: App Store Direct Integration
212
225
 
213
226
  Our direct App Store integration is currently in beta and currently supports subscriptions only. **Consumables and one-off purchases are not yet supported** due to App Store server-to-server notification limitations.
@@ -192,7 +192,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
192
192
  const isShortCode = (referringLink: string): boolean => {
193
193
  // Short codes are less than 10 characters
194
194
  const isValidCharacters = /^[a-zA-Z0-9]+$/.test(referringLink);
195
- return isValidCharacters && referringLink.length < 10;
195
+ return isValidCharacters && referringLink.length < 25 && referringLink.length > 3;
196
196
  };
197
197
 
198
198
  async function setShortCode(shortCode: string): Promise<void> {
@@ -468,6 +468,8 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
468
468
  return Promise.resolve();
469
469
  }
470
470
 
471
+ console.log("track event called with - companyCode: ", companyCode);
472
+
471
473
  if (!referrerLink || !userId) {
472
474
  console.warn(
473
475
  '[Insert Affiliate] No affiliate identifier found. Please set one before tracking events.'
@@ -477,7 +479,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
477
479
 
478
480
  const payload = {
479
481
  eventName,
480
- deepLinkParam: `${referrerLink}/${userId}`,
482
+ deepLinkParam: `${referrerLink}-${userId}`,
481
483
  companyId: companyCode,
482
484
  };
483
485