insert-affiliate-react-native-sdk 1.2.0 → 1.2.1
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/dist/DeepLinkIapProvider.js +15 -20
- package/package.json +1 -1
- package/readme.md +1 -1
- package/src/DeepLinkIapProvider.tsx +8 -3
|
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) ||
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
35
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -106,7 +96,7 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
106
96
|
});
|
|
107
97
|
fetchAsyncEssentials();
|
|
108
98
|
}, []);
|
|
109
|
-
function
|
|
99
|
+
function generateThenSetUserID() {
|
|
110
100
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
101
|
let userId = yield getValueFromAsync(ASYNC_KEYS.USER_ID);
|
|
112
102
|
if (!userId) {
|
|
@@ -163,7 +153,7 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
163
153
|
};
|
|
164
154
|
function setShortCode(shortCode) {
|
|
165
155
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
|
-
|
|
156
|
+
generateThenSetUserID();
|
|
167
157
|
// Validate it is a short code
|
|
168
158
|
const capitalisedShortCode = shortCode.toUpperCase();
|
|
169
159
|
isShortCode(capitalisedShortCode);
|
|
@@ -184,7 +174,12 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
184
174
|
// MARK: Insert Affiliate Identifier
|
|
185
175
|
const setInsertAffiliateIdentifier = (referringLink, completion) => __awaiter(void 0, void 0, void 0, function* () {
|
|
186
176
|
try {
|
|
187
|
-
|
|
177
|
+
try {
|
|
178
|
+
generateThenSetUserID();
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
console.error("[Insert Affiliate] Error setting user ID:", error);
|
|
182
|
+
}
|
|
188
183
|
if (!referringLink) {
|
|
189
184
|
console.warn("[Insert Affiliate] Referring link is invalid.");
|
|
190
185
|
storeInsertAffiliateIdentifier({ link: referringLink });
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -34,7 +34,7 @@ Follow the steps below to install the SDK.
|
|
|
34
34
|
|
|
35
35
|
#### Step 1: Initialisation in `App.tsx`
|
|
36
36
|
|
|
37
|
-
First, wrap your with our provider and call the `
|
|
37
|
+
First, wrap your with our provider and call the `initialize` method early in your app's lifecycle:
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
40
|
const Child = () => {
|
|
@@ -120,7 +120,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
120
120
|
fetchAsyncEssentials();
|
|
121
121
|
}, []);
|
|
122
122
|
|
|
123
|
-
async function
|
|
123
|
+
async function generateThenSetUserID() {
|
|
124
124
|
let userId = await getValueFromAsync(ASYNC_KEYS.USER_ID);
|
|
125
125
|
if (!userId) {
|
|
126
126
|
userId = generateUserID();
|
|
@@ -184,7 +184,7 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
184
184
|
};
|
|
185
185
|
|
|
186
186
|
async function setShortCode(shortCode: string): Promise<void> {
|
|
187
|
-
|
|
187
|
+
generateThenSetUserID();
|
|
188
188
|
|
|
189
189
|
// Validate it is a short code
|
|
190
190
|
const capitalisedShortCode = shortCode.toUpperCase();
|
|
@@ -211,7 +211,12 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
211
211
|
completion: (shortLink: string | null) => void
|
|
212
212
|
) => {
|
|
213
213
|
try {
|
|
214
|
-
|
|
214
|
+
try {
|
|
215
|
+
generateThenSetUserID();
|
|
216
|
+
} catch (error) {
|
|
217
|
+
console.error("[Insert Affiliate] Error setting user ID:", error);
|
|
218
|
+
}
|
|
219
|
+
|
|
215
220
|
|
|
216
221
|
if (!referringLink) {
|
|
217
222
|
console.warn("[Insert Affiliate] Referring link is invalid.");
|