insert-affiliate-react-native-sdk 1.11.1 → 1.11.2
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.
|
@@ -1813,6 +1813,17 @@ const DeepLinkIapProvider = ({ children, }) => {
|
|
|
1813
1813
|
}), []);
|
|
1814
1814
|
const setInsertAffiliateIdentifierChangeCallbackHandler = (0, react_1.useCallback)((callback) => {
|
|
1815
1815
|
insertAffiliateIdentifierChangeCallbackRef.current = callback;
|
|
1816
|
+
// If callback is being set, immediately call it with the current identifier value
|
|
1817
|
+
// This ensures callbacks registered after initialization still receive the current state (including null if expired/not set)
|
|
1818
|
+
if (callback) {
|
|
1819
|
+
returnInsertAffiliateIdentifierImpl().then(identifier => {
|
|
1820
|
+
// Verify callback is still the same (wasn't replaced during async operation)
|
|
1821
|
+
if (insertAffiliateIdentifierChangeCallbackRef.current === callback) {
|
|
1822
|
+
verboseLog(`Calling callback immediately with current identifier: ${identifier}`);
|
|
1823
|
+
callback(identifier);
|
|
1824
|
+
}
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1816
1827
|
}, []);
|
|
1817
1828
|
const handleInsertLinks = (0, react_1.useCallback)((url) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1818
1829
|
return handleInsertLinksImplRef.current(url);
|
|
@@ -64,6 +64,7 @@ const DeepLinkHandler = () => {
|
|
|
64
64
|
|
|
65
65
|
if (insertAffiliateIdentifier) {
|
|
66
66
|
await Purchases.setAttributes({ "insert_affiliate": insertAffiliateIdentifier });
|
|
67
|
+
await Purchases.syncAttributesAndOfferingsIfNeeded();
|
|
67
68
|
}
|
|
68
69
|
} catch (err) {
|
|
69
70
|
console.error('Error setting affiliate identifier:', err);
|
|
@@ -50,6 +50,7 @@ const DeepLinkHandler = () => {
|
|
|
50
50
|
|
|
51
51
|
if (insertAffiliateIdentifier) {
|
|
52
52
|
await Purchases.setAttributes({ "insert_affiliate": insertAffiliateIdentifier });
|
|
53
|
+
await Purchases.syncAttributesAndOfferingsIfNeeded();
|
|
53
54
|
}
|
|
54
55
|
} catch (err) {
|
|
55
56
|
console.error('Error setting affiliate identifier:', err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insert-affiliate-react-native-sdk",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.2",
|
|
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
|
@@ -193,6 +193,7 @@ const App = () => {
|
|
|
193
193
|
setInsertAffiliateIdentifierChangeCallback(async (identifier) => {
|
|
194
194
|
if (identifier) {
|
|
195
195
|
await Purchases.setAttributes({ "insert_affiliate": identifier });
|
|
196
|
+
await Purchases.syncAttributesAndOfferingsIfNeeded();
|
|
196
197
|
}
|
|
197
198
|
});
|
|
198
199
|
|
|
@@ -512,6 +513,7 @@ const App = () => {
|
|
|
512
513
|
setInsertAffiliateIdentifierChangeCallback(async (identifier) => {
|
|
513
514
|
if (identifier) {
|
|
514
515
|
await Purchases.setAttributes({ "insert_affiliate": identifier });
|
|
516
|
+
await Purchases.syncAttributesAndOfferingsIfNeeded();
|
|
515
517
|
}
|
|
516
518
|
});
|
|
517
519
|
|
|
@@ -2127,6 +2127,18 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
2127
2127
|
|
|
2128
2128
|
const setInsertAffiliateIdentifierChangeCallbackHandler = useCallback((callback: InsertAffiliateIdentifierChangeCallback | null): void => {
|
|
2129
2129
|
insertAffiliateIdentifierChangeCallbackRef.current = callback;
|
|
2130
|
+
|
|
2131
|
+
// If callback is being set, immediately call it with the current identifier value
|
|
2132
|
+
// This ensures callbacks registered after initialization still receive the current state (including null if expired/not set)
|
|
2133
|
+
if (callback) {
|
|
2134
|
+
returnInsertAffiliateIdentifierImpl().then(identifier => {
|
|
2135
|
+
// Verify callback is still the same (wasn't replaced during async operation)
|
|
2136
|
+
if (insertAffiliateIdentifierChangeCallbackRef.current === callback) {
|
|
2137
|
+
verboseLog(`Calling callback immediately with current identifier: ${identifier}`);
|
|
2138
|
+
callback(identifier);
|
|
2139
|
+
}
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2130
2142
|
}, []);
|
|
2131
2143
|
|
|
2132
2144
|
const handleInsertLinks = useCallback(async (url: string): Promise<boolean> => {
|