insert-affiliate-react-native-sdk 1.0.0 → 1.0.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.
- package/dist/DeepLinkIapProvider.d.ts +22 -0
- package/dist/DeepLinkIapProvider.js +315 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +10 -0
- package/dist/useDeepLinkIapProvider.d.ts +11 -0
- package/dist/useDeepLinkIapProvider.js +18 -0
- package/package.json +12 -8
- package/patches/react-native-iap+12.15.7.patch +18 -0
- package/src/DeepLinkIapProvider.tsx +6 -2
- package/tsconfig.json +8 -7
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Purchase, Subscription } from "react-native-iap";
|
|
3
|
+
type T_DEEPLINK_IAP_PROVIDER = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
iapSkus: string[];
|
|
6
|
+
iapticAppId: string;
|
|
7
|
+
iapticAppName: string;
|
|
8
|
+
iapticAppSecret: string;
|
|
9
|
+
};
|
|
10
|
+
type T_DEEPLINK_IAP_CONTEXT = {
|
|
11
|
+
iapLoading: boolean;
|
|
12
|
+
alreadyPurchased: boolean;
|
|
13
|
+
subscriptions: Subscription[];
|
|
14
|
+
userPurchase: Purchase | null;
|
|
15
|
+
referrerLink: string;
|
|
16
|
+
userId: string;
|
|
17
|
+
isIapticValidated: boolean | undefined;
|
|
18
|
+
handleBuySubscription: (productId: string, offerToken?: string) => void;
|
|
19
|
+
};
|
|
20
|
+
export declare const DeepLinkIapContext: React.Context<T_DEEPLINK_IAP_CONTEXT>;
|
|
21
|
+
declare const _default: (props: T_DEEPLINK_IAP_PROVIDER) => React.JSX.Element;
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.DeepLinkIapContext = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const react_native_iap_1 = require("react-native-iap");
|
|
41
|
+
const internal_1 = require("react-native-iap/src/internal");
|
|
42
|
+
const react_native_branch_1 = __importDefault(require("react-native-branch"));
|
|
43
|
+
const axios_1 = __importDefault(require("axios"));
|
|
44
|
+
const async_storage_1 = __importDefault(require("@react-native-async-storage/async-storage"));
|
|
45
|
+
const ASYNC_KEYS = {
|
|
46
|
+
REFERRER_LINK: "@app_referrer_link",
|
|
47
|
+
USER_PURCHASE: "@app_user_purchase",
|
|
48
|
+
USER_ID: "@app_user_id",
|
|
49
|
+
};
|
|
50
|
+
// STARTING CONTEXT IMPLEMENTATION
|
|
51
|
+
exports.DeepLinkIapContext = (0, react_1.createContext)({
|
|
52
|
+
iapLoading: false,
|
|
53
|
+
alreadyPurchased: false,
|
|
54
|
+
isIapticValidated: undefined,
|
|
55
|
+
subscriptions: [],
|
|
56
|
+
userPurchase: null,
|
|
57
|
+
referrerLink: "",
|
|
58
|
+
userId: "",
|
|
59
|
+
handleBuySubscription: (productId, offerToken) => { },
|
|
60
|
+
});
|
|
61
|
+
const DeepLinkIapProvider = ({ children, iapSkus, iapticAppId, iapticAppName, iapticAppSecret, }) => {
|
|
62
|
+
// LOCAL STATES
|
|
63
|
+
const [iapLoading, setIapLoading] = (0, react_1.useState)(false);
|
|
64
|
+
const [alreadyPurchased, setAlreadyPurchased] = (0, react_1.useState)(false);
|
|
65
|
+
const [isIapticValidated, setIapticValidated] = (0, react_1.useState)(undefined);
|
|
66
|
+
const [userPurchase, setUserPurchase] = (0, react_1.useState)(null);
|
|
67
|
+
const [referrerLink, setReferrerLink] = (0, react_1.useState)("");
|
|
68
|
+
const [userId, setUserId] = (0, react_1.useState)("");
|
|
69
|
+
const { connected, purchaseHistory, getPurchaseHistory, getSubscriptions, subscriptions, finishTransaction, currentPurchase, currentPurchaseError, } = (0, react_native_iap_1.useIAP)();
|
|
70
|
+
// ASYNC FUNCTIONS
|
|
71
|
+
const saveValueInAsync = (key, value) => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
|
+
yield async_storage_1.default.setItem(key, value);
|
|
73
|
+
});
|
|
74
|
+
const getValueFromAsync = (key) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
+
const response = yield async_storage_1.default.getItem(key);
|
|
76
|
+
return response;
|
|
77
|
+
});
|
|
78
|
+
const clearAsyncStorage = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
79
|
+
yield async_storage_1.default.clear();
|
|
80
|
+
});
|
|
81
|
+
// EFFECT TO FETCH USER ID AND REF LINK
|
|
82
|
+
// IF ALREADY EXISTS IN ASYNC STORAGE
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
const fetchAsyncEssentials = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
try {
|
|
86
|
+
const uId = yield getValueFromAsync(ASYNC_KEYS.USER_ID);
|
|
87
|
+
const refLink = yield getValueFromAsync(ASYNC_KEYS.REFERRER_LINK);
|
|
88
|
+
if (uId && refLink) {
|
|
89
|
+
setUserId(uId);
|
|
90
|
+
setReferrerLink(refLink);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
errorLog(`ERROR ~ fetchAsyncEssentials: ${error}`);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
fetchAsyncEssentials();
|
|
98
|
+
}, []);
|
|
99
|
+
// FUNCTION TO SHOW LOG, ERROR and WARN
|
|
100
|
+
const errorLog = (message, type) => {
|
|
101
|
+
switch (type) {
|
|
102
|
+
case "error":
|
|
103
|
+
console.error(`ENCOUNTER ERROR ~ ${message}`);
|
|
104
|
+
break;
|
|
105
|
+
case "warn":
|
|
106
|
+
console.warn(`ENCOUNTER WARNING ~ ${message}`);
|
|
107
|
+
break;
|
|
108
|
+
default:
|
|
109
|
+
console.log(`LOGGING ~ ${message}`);
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
// GENERATING UNIQUE USER ID
|
|
114
|
+
const generateUserID = () => {
|
|
115
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
116
|
+
let uniqueId = "";
|
|
117
|
+
for (let i = 0; i < 6; i++) {
|
|
118
|
+
const randomIndex = Math.floor(Math.random() * characters.length);
|
|
119
|
+
uniqueId += characters[randomIndex];
|
|
120
|
+
}
|
|
121
|
+
return uniqueId;
|
|
122
|
+
};
|
|
123
|
+
// BRANCH IMPLEMENTATION
|
|
124
|
+
(0, react_1.useEffect)(() => {
|
|
125
|
+
const branchSubscription = react_native_branch_1.default.subscribe((_a) => __awaiter(void 0, [_a], void 0, function* ({ error, params }) {
|
|
126
|
+
if (error) {
|
|
127
|
+
errorLog(`branchSubscription: ${JSON.stringify(error)}`, "error");
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
else if (!params) {
|
|
131
|
+
errorLog(`branchSubscription: params does not exits`, "warn");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
else if (!params["+clicked_branch_link"]) {
|
|
135
|
+
errorLog(`branchSubscription: Not a branch link`, "warn");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
if (params["~referring_link"]) {
|
|
140
|
+
setReferrerLink(params["~referring_link"]);
|
|
141
|
+
const userId = generateUserID();
|
|
142
|
+
setUserId(userId);
|
|
143
|
+
yield saveValueInAsync(ASYNC_KEYS.USER_ID, userId);
|
|
144
|
+
yield saveValueInAsync(ASYNC_KEYS.REFERRER_LINK, params["~referring_link"]);
|
|
145
|
+
}
|
|
146
|
+
else
|
|
147
|
+
errorLog(`branchSubscription: Params does't have referring_link`, "warn");
|
|
148
|
+
}
|
|
149
|
+
}));
|
|
150
|
+
return () => {
|
|
151
|
+
if (branchSubscription) {
|
|
152
|
+
branchSubscription();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}, []);
|
|
156
|
+
// IN APP PURCHASE IMPLEMENTATION STARTS
|
|
157
|
+
/**
|
|
158
|
+
* This function is responsisble to
|
|
159
|
+
* fetch the subscriptions
|
|
160
|
+
*/
|
|
161
|
+
const handleGetSubscriptions = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
162
|
+
try {
|
|
163
|
+
yield getSubscriptions({ skus: iapSkus });
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
errorLog(`handleGetSubscriptions: ${error}`, "error");
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* This function is responsible to
|
|
171
|
+
* fetch the purchase history
|
|
172
|
+
*/
|
|
173
|
+
const handleGetPurchaseHistory = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
174
|
+
try {
|
|
175
|
+
yield getPurchaseHistory();
|
|
176
|
+
if (purchaseHistory.length > 0) {
|
|
177
|
+
setAlreadyPurchased(true);
|
|
178
|
+
setUserPurchase(currentPurchase ? currentPurchase : null);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
errorLog(`handleGetPurchaseHistory: ${error}`, "error");
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
// Effect to fetch IAP subscriptions + purchase history
|
|
186
|
+
(0, react_1.useEffect)(() => {
|
|
187
|
+
const fetchIapEssentials = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
188
|
+
try {
|
|
189
|
+
yield handleGetSubscriptions();
|
|
190
|
+
yield handleGetPurchaseHistory();
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
errorLog(`fetchIapEssentials: ${error}`);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
if (connected)
|
|
197
|
+
fetchIapEssentials();
|
|
198
|
+
}, [connected]);
|
|
199
|
+
const handlePurchaseValidation = (jsonIapPurchase) => __awaiter(void 0, void 0, void 0, function* () {
|
|
200
|
+
try {
|
|
201
|
+
if (!userId || !referrerLink) {
|
|
202
|
+
errorLog(`WANR ~ handlePurchaseValidation: No Referrer Link or User ID for validation`);
|
|
203
|
+
yield (0, axios_1.default)({
|
|
204
|
+
url: `https://validator.iaptic.com/v1/validate`,
|
|
205
|
+
method: "POST",
|
|
206
|
+
headers: {
|
|
207
|
+
Authorization: `Basic ${btoa(iapticAppName + ":" + iapticAppSecret)}`,
|
|
208
|
+
},
|
|
209
|
+
data: {
|
|
210
|
+
id: iapticAppId,
|
|
211
|
+
type: "application",
|
|
212
|
+
transaction: {
|
|
213
|
+
id: iapticAppId,
|
|
214
|
+
type: "ios-appstore",
|
|
215
|
+
appStoreReceipt: jsonIapPurchase.transactionReceipt,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
setIapticValidated(true);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
yield (0, axios_1.default)({
|
|
223
|
+
url: `https://validator.iaptic.com/v1/validate`,
|
|
224
|
+
method: "POST",
|
|
225
|
+
headers: {
|
|
226
|
+
Authorization: `Basic ${btoa(iapticAppName + ":" + iapticAppSecret)}`,
|
|
227
|
+
},
|
|
228
|
+
data: {
|
|
229
|
+
id: iapticAppId,
|
|
230
|
+
type: "application",
|
|
231
|
+
transaction: {
|
|
232
|
+
id: iapticAppId,
|
|
233
|
+
type: "ios-appstore",
|
|
234
|
+
appStoreReceipt: jsonIapPurchase.transactionReceipt,
|
|
235
|
+
},
|
|
236
|
+
additionalData: {
|
|
237
|
+
applicationUsername: `${referrerLink}/${userId}`,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
catch (error) {
|
|
244
|
+
errorLog(`handlePurchaseValidation: ${error}`, "error");
|
|
245
|
+
setIapticValidated(false);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
(0, react_1.useEffect)(() => {
|
|
249
|
+
const checkCurrentPurchase = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
250
|
+
try {
|
|
251
|
+
if (currentPurchase === null || currentPurchase === void 0 ? void 0 : currentPurchase.productId) {
|
|
252
|
+
setUserPurchase(currentPurchase);
|
|
253
|
+
yield handlePurchaseValidation(currentPurchase);
|
|
254
|
+
yield finishTransaction({
|
|
255
|
+
purchase: currentPurchase,
|
|
256
|
+
isConsumable: true,
|
|
257
|
+
});
|
|
258
|
+
yield saveValueInAsync(ASYNC_KEYS.USER_PURCHASE, JSON.stringify(currentPurchase));
|
|
259
|
+
setIapLoading(false);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
catch (error) {
|
|
263
|
+
setIapLoading(false);
|
|
264
|
+
errorLog(`checkCurrentPurchase: ${error}`, "error");
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
checkCurrentPurchase();
|
|
268
|
+
}, [currentPurchase, finishTransaction]);
|
|
269
|
+
(0, react_1.useEffect)(() => {
|
|
270
|
+
const checkCurrentPurchaseError = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
271
|
+
if (currentPurchaseError) {
|
|
272
|
+
setIapLoading(false);
|
|
273
|
+
errorLog(`checkCurrentPurchaseError: ${currentPurchaseError.message}`, "error");
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
checkCurrentPurchaseError();
|
|
277
|
+
}, [currentPurchaseError]);
|
|
278
|
+
/**
|
|
279
|
+
* Function is responsible to
|
|
280
|
+
* buy a subscription
|
|
281
|
+
* @param {string} productId
|
|
282
|
+
* @param {string} [offerToken]
|
|
283
|
+
*/
|
|
284
|
+
const handleBuySubscription = (productId, offerToken) => __awaiter(void 0, void 0, void 0, function* () {
|
|
285
|
+
if (internal_1.isPlay && !offerToken) {
|
|
286
|
+
console.warn(`There are no subscription Offers for selected product (Only requiered for Google Play purchases): ${productId}`);
|
|
287
|
+
}
|
|
288
|
+
try {
|
|
289
|
+
setIapLoading(true);
|
|
290
|
+
yield (0, react_native_iap_1.requestSubscription)(Object.assign({ sku: productId }, (offerToken && {
|
|
291
|
+
subscriptionOffers: [{ sku: productId, offerToken }],
|
|
292
|
+
})));
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
setIapLoading(false);
|
|
296
|
+
errorLog(`handleBuySubscription: ${error}`, "error");
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
(0, react_1.useEffect)(() => {
|
|
300
|
+
return () => {
|
|
301
|
+
(0, react_native_iap_1.endConnection)();
|
|
302
|
+
};
|
|
303
|
+
}, []);
|
|
304
|
+
return (react_1.default.createElement(exports.DeepLinkIapContext.Provider, { value: {
|
|
305
|
+
iapLoading,
|
|
306
|
+
alreadyPurchased,
|
|
307
|
+
isIapticValidated,
|
|
308
|
+
subscriptions,
|
|
309
|
+
userPurchase,
|
|
310
|
+
referrerLink,
|
|
311
|
+
userId,
|
|
312
|
+
handleBuySubscription,
|
|
313
|
+
} }, children));
|
|
314
|
+
};
|
|
315
|
+
exports.default = (0, react_native_iap_1.withIAPContext)(DeepLinkIapProvider);
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useDeepLinkIapProvider = exports.DeepLinkIapProvider = void 0;
|
|
7
|
+
const DeepLinkIapProvider_1 = __importDefault(require("./DeepLinkIapProvider"));
|
|
8
|
+
exports.DeepLinkIapProvider = DeepLinkIapProvider_1.default;
|
|
9
|
+
const useDeepLinkIapProvider_1 = __importDefault(require("./useDeepLinkIapProvider"));
|
|
10
|
+
exports.useDeepLinkIapProvider = useDeepLinkIapProvider_1.default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const useDeepLinkIapProvider: () => {
|
|
2
|
+
alreadyPurchased: boolean;
|
|
3
|
+
handleBuySubscription: (productId: string, offerToken?: string) => void;
|
|
4
|
+
iapLoading: boolean;
|
|
5
|
+
referrerLink: string;
|
|
6
|
+
subscriptions: import("react-native-iap").Subscription[];
|
|
7
|
+
userId: string;
|
|
8
|
+
isIapticValidated: boolean | undefined;
|
|
9
|
+
userPurchase: import("react-native-iap").Purchase | null;
|
|
10
|
+
};
|
|
11
|
+
export default useDeepLinkIapProvider;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const react_1 = require("react");
|
|
4
|
+
const DeepLinkIapProvider_1 = require("./DeepLinkIapProvider");
|
|
5
|
+
const useDeepLinkIapProvider = () => {
|
|
6
|
+
const { alreadyPurchased, handleBuySubscription, iapLoading, referrerLink, isIapticValidated, subscriptions, userId, userPurchase, } = (0, react_1.useContext)(DeepLinkIapProvider_1.DeepLinkIapContext);
|
|
7
|
+
return {
|
|
8
|
+
alreadyPurchased,
|
|
9
|
+
handleBuySubscription,
|
|
10
|
+
iapLoading,
|
|
11
|
+
referrerLink,
|
|
12
|
+
subscriptions,
|
|
13
|
+
userId,
|
|
14
|
+
isIapticValidated,
|
|
15
|
+
userPurchase,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
exports.default = useDeepLinkIapProvider;
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "insert-affiliate-react-native-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "A package that will give context having implementation of react-native-branch and react-native-iap and iaptic validate api.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"build": "tsc"
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"postinstall": "patch-package"
|
|
9
10
|
},
|
|
10
11
|
"keywords": [
|
|
11
12
|
"react-native",
|
|
@@ -15,14 +16,17 @@
|
|
|
15
16
|
],
|
|
16
17
|
"author": "Haseeb Ahmed",
|
|
17
18
|
"license": "MIT",
|
|
18
|
-
"
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@jeremybarbet/apple-api-types": "^1.4.1",
|
|
19
21
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
20
|
-
"@types/react": "^18.
|
|
22
|
+
"@types/react": "^18.3.12",
|
|
23
|
+
"@types/react-native": "^0.72.8",
|
|
21
24
|
"axios": "^1.7.7",
|
|
25
|
+
"patch-package": "^8.0.0",
|
|
22
26
|
"react": "^18.3.1",
|
|
23
|
-
"react-native": "^0.
|
|
24
|
-
"react-native-branch": "^6.
|
|
25
|
-
"react-native-iap": "^12.15.
|
|
26
|
-
"typescript": "^5.
|
|
27
|
+
"react-native": "^0.76.1",
|
|
28
|
+
"react-native-branch": "^6.4.0",
|
|
29
|
+
"react-native-iap": "^12.15.7",
|
|
30
|
+
"typescript": "^5.6.3"
|
|
27
31
|
}
|
|
28
32
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
diff --git a/node_modules/react-native-iap/src/types/index.ts b/node_modules/react-native-iap/src/types/index.ts
|
|
2
|
+
index 46f0603..773e4d9 100644
|
|
3
|
+
--- a/node_modules/react-native-iap/src/types/index.ts
|
|
4
|
+
+++ b/node_modules/react-native-iap/src/types/index.ts
|
|
5
|
+
@@ -271,9 +271,9 @@ export type RequestSubscription =
|
|
6
|
+
|
|
7
|
+
declare module 'react-native' {
|
|
8
|
+
interface NativeModulesStatic {
|
|
9
|
+
- RNIapIos: IosModuleProps;
|
|
10
|
+
- RNIapIosSk2: IosModulePropsSk2;
|
|
11
|
+
- RNIapModule: AndroidModuleProps;
|
|
12
|
+
- RNIapAmazonModule: AmazonModuleProps;
|
|
13
|
+
+ // RNIapIos: IosModuleProps;
|
|
14
|
+
+ // RNIapIosSk2: IosModulePropsSk2;
|
|
15
|
+
+ // RNIapModule: AndroidModuleProps;
|
|
16
|
+
+ // RNIapAmazonModule: AmazonModuleProps;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -230,7 +230,9 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
230
230
|
url: `https://validator.iaptic.com/v1/validate`,
|
|
231
231
|
method: "POST",
|
|
232
232
|
headers: {
|
|
233
|
-
Authorization: `Basic ${btoa(
|
|
233
|
+
Authorization: `Basic ${btoa(
|
|
234
|
+
iapticAppName + ":" + iapticAppSecret
|
|
235
|
+
)}`,
|
|
234
236
|
},
|
|
235
237
|
data: {
|
|
236
238
|
id: iapticAppId,
|
|
@@ -248,7 +250,9 @@ const DeepLinkIapProvider: React.FC<T_DEEPLINK_IAP_PROVIDER> = ({
|
|
|
248
250
|
url: `https://validator.iaptic.com/v1/validate`,
|
|
249
251
|
method: "POST",
|
|
250
252
|
headers: {
|
|
251
|
-
Authorization: `Basic ${btoa(
|
|
253
|
+
Authorization: `Basic ${btoa(
|
|
254
|
+
iapticAppName + ":" + iapticAppSecret
|
|
255
|
+
)}`,
|
|
252
256
|
},
|
|
253
257
|
data: {
|
|
254
258
|
id: iapticAppId,
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"
|
|
3
|
+
"outDir": "./dist",
|
|
4
4
|
"module": "commonjs",
|
|
5
|
-
"
|
|
5
|
+
"target": "es6",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"lib": ["dom", "es6", "ES2017"],
|
|
8
|
+
"jsx": "react",
|
|
6
9
|
"declaration": true,
|
|
7
|
-
"declarationDir": "dist",
|
|
8
|
-
"sourceMap": true,
|
|
9
10
|
"strict": true,
|
|
10
11
|
"esModuleInterop": true,
|
|
11
|
-
"
|
|
12
|
-
"lib": ["esnext", "dom"]
|
|
12
|
+
"skipLibCheck": true
|
|
13
13
|
},
|
|
14
|
-
"include": ["src
|
|
14
|
+
"include": ["src"],
|
|
15
|
+
"exclude": ["node_modules", "dist"]
|
|
15
16
|
}
|