react-native-purchases 7.6.0 → 7.15.0-rc.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 RevenueCat, Inc.
3
+ Copyright (c) 2023 RevenueCat
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -16,7 +16,7 @@ Pod::Spec.new do |spec|
16
16
  spec.source_files = "ios/**/*.{h,m,swift}"
17
17
  spec.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
18
18
 
19
- # Ignore the Purchases.framework that would get downloaded by the download script, meant for
19
+ # Ignore the Purchases.framework that would get downloaded by the download script, meant for
20
20
  # developers who don't want to use Cocoapods
21
21
  spec.exclude_files = [
22
22
  "ios/Purchases.framework",
@@ -24,6 +24,6 @@ Pod::Spec.new do |spec|
24
24
  ]
25
25
 
26
26
  spec.dependency "React-Core"
27
- spec.dependency "PurchasesHybridCommon", '8.2.1'
28
- spec.swift_version = '5.0'
27
+ spec.dependency "PurchasesHybridCommon", '8.10.0-beta.8'
28
+ spec.swift_version = '5.7'
29
29
  end
@@ -29,7 +29,7 @@ android {
29
29
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
30
30
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
31
31
  versionCode 1
32
- versionName '7.6.0'
32
+ versionName '7.15.0-rc.1'
33
33
  }
34
34
 
35
35
  buildTypes {
@@ -121,6 +121,6 @@ def kotlin_version = getExtOrDefault('kotlinVersion')
121
121
  dependencies {
122
122
  //noinspection GradleDynamicVersion
123
123
  api 'com.facebook.react:react-native:+'
124
- implementation 'com.revenuecat.purchases:purchases-hybrid-common:8.2.1'
124
+ implementation 'com.revenuecat.purchases:purchases-hybrid-common:8.10.0-beta.8'
125
125
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
126
126
  }
@@ -45,7 +45,7 @@ public class RNPurchasesModule extends ReactContextBaseJavaModule implements Upd
45
45
  private static final String CUSTOMER_INFO_UPDATED = "Purchases-CustomerInfoUpdated";
46
46
  private static final String LOG_HANDLER_EVENT = "Purchases-LogHandlerEvent";
47
47
  public static final String PLATFORM_NAME = "react-native";
48
- public static final String PLUGIN_VERSION = "7.6.0";
48
+ public static final String PLUGIN_VERSION = "7.15.0-rc.1";
49
49
 
50
50
  private final ReactApplicationContext reactContext;
51
51
 
@@ -18,7 +18,9 @@ public class RNPurchasesPackage implements ReactPackage {
18
18
  @NonNull
19
19
  @Override
20
20
  public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
21
- return Arrays.<NativeModule>asList(new RNPurchasesModule(reactContext));
21
+ return Arrays.<NativeModule>asList(
22
+ new RNPurchasesModule(reactContext)
23
+ );
22
24
  }
23
25
 
24
26
  // Deprecated from RN 0.47
package/ios/RNPurchases.m CHANGED
@@ -52,8 +52,8 @@ RCT_EXPORT_METHOD(setupPurchases:(NSString *)apiKey
52
52
  platformFlavor:self.platformFlavor
53
53
  platformFlavorVersion:self.platformFlavorVersion
54
54
  usesStoreKit2IfAvailable:usesStoreKit2IfAvailable
55
- dangerousSettings:nil
56
- shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
55
+ dangerousSettings:nil
56
+ shouldShowInAppMessagesAutomatically:shouldShowInAppMessagesAutomatically
57
57
  verificationMode:entitlementVerificationMode];
58
58
  purchases.delegate = self;
59
59
  }
@@ -472,7 +472,7 @@ readyForPromotedProduct:(RCStoreProduct *)product
472
472
  }
473
473
 
474
474
  - (NSString *)platformFlavorVersion {
475
- return @"7.6.0";
475
+ return @"7.15.0-rc.1";
476
476
  }
477
477
 
478
478
  @end
@@ -10,6 +10,8 @@
10
10
  3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3552B97C252CF5900098008A /* PurchasesPlugin.swift */; };
11
11
  35BFF4DC247DDAD3008B64DA /* PurchasesHybridCommon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */; };
12
12
  35D0736B20AD0F740012EB8C /* Purchases.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 35D0736A20AD0F740012EB8C /* Purchases.framework */; };
13
+ 4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7207292AF30E7E0017395F /* RNPaywallManager.m */; };
14
+ 4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F7D88D32AF9666800855875 /* RNPaywalls.m */; };
13
15
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNPurchases.m */; };
14
16
  /* End PBXBuildFile section */
15
17
 
@@ -31,6 +33,10 @@
31
33
  3552B97C252CF5900098008A /* PurchasesPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PurchasesPlugin.swift; sourceTree = "<group>"; };
32
34
  35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = PurchasesHybridCommon.framework; sourceTree = "<group>"; };
33
35
  35D0736A20AD0F740012EB8C /* Purchases.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Purchases.framework; sourceTree = SOURCE_ROOT; };
36
+ 4F7207282AF30E7E0017395F /* RNPaywallManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNPaywallManager.h; sourceTree = "<group>"; };
37
+ 4F7207292AF30E7E0017395F /* RNPaywallManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNPaywallManager.m; sourceTree = "<group>"; };
38
+ 4F7D88D32AF9666800855875 /* RNPaywalls.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPaywalls.m; sourceTree = "<group>"; };
39
+ 4F7D88D42AF9666800855875 /* RNPaywalls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPaywalls.h; sourceTree = "<group>"; };
34
40
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNPurchases.h; sourceTree = "<group>"; };
35
41
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNPurchases.m; sourceTree = "<group>"; };
36
42
  /* End PBXFileReference section */
@@ -71,6 +77,10 @@
71
77
  35BFF4DB247DDAD3008B64DA /* PurchasesHybridCommon.framework */,
72
78
  B3E7B5881CC2AC0600A0062D /* RNPurchases.h */,
73
79
  B3E7B5891CC2AC0600A0062D /* RNPurchases.m */,
80
+ 4F7207282AF30E7E0017395F /* RNPaywallManager.h */,
81
+ 4F7207292AF30E7E0017395F /* RNPaywallManager.m */,
82
+ 4F7D88D42AF9666800855875 /* RNPaywalls.h */,
83
+ 4F7D88D32AF9666800855875 /* RNPaywalls.m */,
74
84
  134814211AA4EA7D00B7C361 /* Products */,
75
85
  35493AC8202D4BCD004DFA39 /* Frameworks */,
76
86
  3552B97B252CF5900098008A /* RNPurchases-Bridging-Header.h */,
@@ -136,8 +146,10 @@
136
146
  isa = PBXSourcesBuildPhase;
137
147
  buildActionMask = 2147483647;
138
148
  files = (
149
+ 4F7D88D52AF9666800855875 /* RNPaywalls.m in Sources */,
139
150
  B3E7B58A1CC2AC0600A0062D /* RNPurchases.m in Sources */,
140
151
  3552B97D252CF5900098008A /* PurchasesPlugin.swift in Sources */,
152
+ 4F72072A2AF30E7E0017395F /* RNPaywallManager.m in Sources */,
141
153
  );
142
154
  runOnlyForDeploymentPostprocessing = 0;
143
155
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-purchases",
3
3
  "title": "React Native Purchases",
4
- "version": "7.6.0",
4
+ "version": "7.15.0-rc.1",
5
5
  "description": "React Native in-app purchases and subscriptions made easy. Supports iOS and Android. ",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,17 +24,26 @@
24
24
  "!**/.idea",
25
25
  "!**/*.iml",
26
26
  "!**/.DS_Store",
27
- "!**/.gitignore"
27
+ "!**/.gitignore",
28
+ "!react-native-purchases-ui",
29
+ "!scripts/docs/index.html",
30
+ "!scripts/setupJest.js"
28
31
  ],
29
32
  "scripts": {
30
33
  "build": "tsc",
31
34
  "build-watch": "tsc --watch",
32
35
  "test": "jest",
36
+ "typecheck": "tsc --noEmit",
33
37
  "tslint": "tslint -c tslint.json 'src/*.ts'",
34
38
  "prepare": "tsc",
35
- "example": "yarn --cwd examples/purchaseTesterTypescript",
36
- "bootstrap": "yarn && yarn example && yarn example pods"
39
+ "example": "yarn workspace purchasetester",
40
+ "ui": "yarn workspace react-native-purchases-ui",
41
+ "bootstrap": "yarn && yarn example pods"
37
42
  },
43
+ "workspaces": [
44
+ "examples/purchaseTesterTypescript",
45
+ "react-native-purchases-ui"
46
+ ],
38
47
  "repository": {
39
48
  "type": "git",
40
49
  "url": "git+https://github.com/revenuecat/react-native-purchases.git",
@@ -76,7 +85,7 @@
76
85
  "preset": "react-native",
77
86
  "modulePathIgnorePatterns": [
78
87
  "<rootDir>/examples/purchaseTesterTypescript/node_modules",
79
- "<rootDir>/lib/"
88
+ "<rootDir>/dir/"
80
89
  ],
81
90
  "moduleFileExtensions": [
82
91
  "js"
@@ -95,6 +104,6 @@
95
104
  ]
96
105
  },
97
106
  "dependencies": {
98
- "@revenuecat/purchases-typescript-internal": "8.2.1"
107
+ "@revenuecat/purchases-typescript-internal": "8.10.0-beta.8"
99
108
  }
100
109
  }
@@ -1,9 +0,0 @@
1
- <!-- This file is used to redirect visitors to the latest version of the docs -->
2
- <!DOCTYPE html>
3
- <html>
4
- <head>
5
- <meta http-equiv="refresh" content="0; url=https://revenuecat.github.io/react-native-purchases-docs/7.6.0/" />
6
- </head>
7
- <body>
8
- </body>
9
- </html>
@@ -1,787 +0,0 @@
1
- const {NativeModules} = require("react-native");
2
-
3
- global.customerInfoStub = {
4
- activeSubscriptions: ["annual_freetrial"],
5
- allExpirationDates: {
6
- onetime_purchase: null,
7
- consumable: null,
8
- annual_freetrial: "2019-01-23T22:34:21Z",
9
- onemonth_freetrial: "2019-01-19T01:41:06Z"
10
- },
11
- allPurchaseDates: {
12
- onetime_purchase: "2018-01-23T22:34:21Z",
13
- consumable: "2018-01-23T22:34:21Z",
14
- annual_freetrial: "2018-01-23T22:34:21Z",
15
- onemonth_freetrial: "2018-01-19T01:41:06Z"
16
- },
17
- allPurchasedProductIdentifiers: [
18
- "onetime_purchase",
19
- "consumable",
20
- "annual_freetrial",
21
- "onemonth_freetrial"
22
- ],
23
- entitlements: {
24
- active: {
25
- pro_cat: {
26
- billingIssueDetectedAt: null,
27
- expirationDate: null,
28
- identifier: "pro_cat",
29
- isActive: true,
30
- isSandbox: true,
31
- latestPurchaseDate: "2019-07-26T22:11:41.000Z",
32
- originalPurchaseDate: "2019-12-02T21:31:19.000Z",
33
- periodType: "NORMAL",
34
- productIdentifier: "consumable",
35
- store: "PLAY_STORE",
36
- unsubscribeDetectedAt: null,
37
- willRenew: true
38
- }
39
- },
40
- all: {
41
- pro_cat: {
42
- billingIssueDetectedAt: null,
43
- expirationDate: null,
44
- identifier: "pro_cat",
45
- isActive: true,
46
- isSandbox: true,
47
- latestPurchaseDate: "2019-07-26T22:11:41.000Z",
48
- originalPurchaseDate: "2019-12-02T21:31:19.000Z",
49
- periodType: "NORMAL",
50
- productIdentifier: "consumable",
51
- store: "PLAY_STORE",
52
- unsubscribeDetectedAt: null,
53
- willRenew: true
54
- }
55
- }
56
- },
57
- firstSeen: "2019-10-31T23:02:07.000Z",
58
- latestExpirationDate: "2019-01-23T22:34:21Z",
59
- originalAppUserId: "9AE22FE1-D0A3-4341-85B6-D1D6C24C404A",
60
- originalApplicationVersion: null,
61
- requestDate: "2019-12-03T00:47:58.000Z",
62
- managementURL: "https://url.com"
63
- };
64
-
65
- global.offeringsStub = {
66
- current: {
67
- weekly: {
68
- offeringIdentifier: 'default',
69
- product: {
70
- introPrice: null,
71
- description: 'Product with intro price',
72
- currencyCode: 'USD',
73
- priceString: '$9.99',
74
- price: 9.99,
75
- title: 'Introductory Price (PurchasesSample)',
76
- identifier: 'introductory_price'
77
- },
78
- packageType: 'WEEKLY',
79
- identifier: '$rc_weekly'
80
- },
81
- monthly: null,
82
- twoMonth: {
83
- offeringIdentifier: 'default',
84
- product: {
85
- introPrice: {
86
- periodNumberOfUnits: 16,
87
- periodUnit: 'DAY',
88
- cycles: 1,
89
- period: 'P2W2D',
90
- priceString: '$0.00',
91
- price: 0
92
- },
93
- description: 'The best service, annually.',
94
- currencyCode: 'USD',
95
- priceString: '$19.99',
96
- price: 19.99,
97
- title: 'Annual Free Trial (PurchasesSample)',
98
- identifier: 'annual_freetrial',
99
- subscriptionPeriod: "P1Y"
100
- },
101
- packageType: 'TWO_MONTH',
102
- identifier: '$rc_two_month'
103
- },
104
- threeMonth: {
105
- offeringIdentifier: 'default',
106
- product: {
107
- introPrice: {
108
- periodNumberOfUnits: 16,
109
- periodUnit: 'DAY',
110
- cycles: 1,
111
- period: 'P2W2D',
112
- priceString: '$0.00',
113
- price: 0
114
- },
115
- description: 'The best service, annually.',
116
- currencyCode: 'USD',
117
- priceString: '$19.99',
118
- price: 19.99,
119
- title: 'Annual Free Trial (PurchasesSample)',
120
- identifier: 'annual_freetrial',
121
- subscriptionPeriod: "P1Y"
122
- },
123
- packageType: 'THREE_MONTH',
124
- identifier: '$rc_three_month'
125
- },
126
- sixMonth: {
127
- offeringIdentifier: 'default',
128
- product: {
129
- introPrice: {
130
- periodNumberOfUnits: 16,
131
- periodUnit: 'DAY',
132
- cycles: 1,
133
- period: 'P2W2D',
134
- priceString: '$0.00',
135
- price: 0
136
- },
137
- description: 'The best service, annually.',
138
- currencyCode: 'USD',
139
- priceString: '$19.99',
140
- price: 19.99,
141
- title: 'Annual Free Trial (PurchasesSample)',
142
- identifier: 'annual_freetrial',
143
- subscriptionPeriod: "P1Y"
144
- },
145
- packageType: 'SIX_MONTH',
146
- identifier: '$rc_six_month'
147
- },
148
- annual: {
149
- offeringIdentifier: 'default',
150
- product: {
151
- introPrice: {
152
- periodNumberOfUnits: 16,
153
- periodUnit: 'DAY',
154
- cycles: 1,
155
- period: 'P2W2D',
156
- priceString: '$0.00',
157
- price: 0
158
- },
159
- description: 'The best service, annually.',
160
- currencyCode: 'USD',
161
- priceString: '$19.99',
162
- price: 19.99,
163
- title: 'Annual Free Trial (PurchasesSample)',
164
- identifier: 'annual_freetrial',
165
- subscriptionPeriod: "P1Y"
166
- },
167
- packageType: 'ANNUAL',
168
- identifier: '$rc_annual'
169
- },
170
- lifetime: {
171
- offeringIdentifier: 'default',
172
- product: {
173
- introPrice: null,
174
- description: 'you can eat it many times',
175
- currencyCode: 'USD',
176
- priceString: '$4.99',
177
- price: 4.99,
178
- title: 'Consumable (PurchasesSample)',
179
- identifier: 'consumable',
180
- subscriptionPeriod: null
181
- },
182
- packageType: 'LIFETIME',
183
- identifier: '$rc_lifetime'
184
- },
185
- availablePackages: [
186
- {
187
- offeringIdentifier: 'default',
188
- product: {
189
- introPrice: {
190
- periodNumberOfUnits: 16,
191
- periodUnit: 'DAY',
192
- cycles: 1,
193
- period: 'P2W2D',
194
- priceString: '$0.00',
195
- price: 0
196
- },
197
- description: 'The best service, annually.',
198
- currencyCode: 'USD',
199
- priceString: '$19.99',
200
- price: 19.99,
201
- title: 'Annual Free Trial (PurchasesSample)',
202
- identifier: 'annual_freetrial',
203
- subscriptionPeriod: "P1Y"
204
- },
205
- packageType: 'ANNUAL',
206
- identifier: '$rc_annual'
207
- },
208
- {
209
- offeringIdentifier: 'default',
210
- product: {
211
- introPrice: {
212
- periodNumberOfUnits: 16,
213
- periodUnit: 'DAY',
214
- cycles: 1,
215
- period: 'P2W2D',
216
- priceString: '$0.00',
217
- price: 0
218
- },
219
- description: 'The best service, annually.',
220
- currencyCode: 'USD',
221
- priceString: '$19.99',
222
- price: 19.99,
223
- title: 'Annual Free Trial (PurchasesSample)',
224
- identifier: 'annual_freetrial',
225
- subscriptionPeriod: "P1Y"
226
- },
227
- packageType: 'SIX_MONTH',
228
- identifier: '$rc_six_month'
229
- },
230
- {
231
- offeringIdentifier: 'default',
232
- product: {
233
- introPrice: {
234
- periodNumberOfUnits: 16,
235
- periodUnit: 'DAY',
236
- cycles: 1,
237
- period: 'P2W2D',
238
- priceString: '$0.00',
239
- price: 0
240
- },
241
- description: 'The best service, annually.',
242
- currencyCode: 'USD',
243
- priceString: '$19.99',
244
- price: 19.99,
245
- title: 'Annual Free Trial (PurchasesSample)',
246
- identifier: 'annual_freetrial',
247
- subscriptionPeriod: "P1Y"
248
- },
249
- packageType: 'THREE_MONTH',
250
- identifier: '$rc_three_month'
251
- },
252
- {
253
- offeringIdentifier: 'default',
254
- product: {
255
- introPrice: {
256
- periodNumberOfUnits: 16,
257
- periodUnit: 'DAY',
258
- cycles: 1,
259
- period: 'P2W2D',
260
- priceString: '$0.00',
261
- price: 0
262
- },
263
- description: 'The best service, annually.',
264
- currencyCode: 'USD',
265
- priceString: '$19.99',
266
- price: 19.99,
267
- title: 'Annual Free Trial (PurchasesSample)',
268
- identifier: 'annual_freetrial',
269
- subscriptionPeriod: "P1Y"
270
- },
271
- packageType: 'TWO_MONTH',
272
- identifier: '$rc_two_month'
273
- },
274
- {
275
- offeringIdentifier: 'default',
276
- product: {
277
- introPrice: {
278
- periodNumberOfUnits: 7,
279
- periodUnit: 'DAY',
280
- cycles: 3,
281
- period: 'P1W',
282
- priceString: '$4.99',
283
- price: 4.99
284
- },
285
- description: 'Product with intro price',
286
- currencyCode: 'USD',
287
- priceString: '$9.99',
288
- price: 9.99,
289
- title: 'Introductory Price (PurchasesSample)',
290
- identifier: 'introductory_price',
291
- subscriptionPeriod: "P1M"
292
- },
293
- packageType: 'WEEKLY',
294
- identifier: '$rc_weekly'
295
- },
296
- {
297
- offeringIdentifier: 'default',
298
- product: {
299
- introPrice: null,
300
- description: 'you can eat it many times',
301
- currencyCode: 'USD',
302
- priceString: '$4.99',
303
- price: 4.99,
304
- title: 'Consumable (PurchasesSample)',
305
- identifier: 'consumable'
306
- },
307
- packageType: 'LIFETIME',
308
- identifier: '$rc_lifetime'
309
- },
310
- {
311
- offeringIdentifier: 'default',
312
- product: {
313
- introPrice: {
314
- periodNumberOfUnits: 16,
315
- periodUnit: 'DAY',
316
- cycles: 1,
317
- period: 'P2W2D',
318
- priceString: '$0.00',
319
- price: 0
320
- },
321
- description: 'The best service, annually.',
322
- currencyCode: 'USD',
323
- priceString: '$19.99',
324
- price: 19.99,
325
- title: 'Annual Free Trial (PurchasesSample)',
326
- identifier: 'annual_freetrial',
327
- subscriptionPeriod: "P1Y"
328
- },
329
- packageType: 'CUSTOM',
330
- identifier: 'Custom'
331
- }
332
- ],
333
- metadata: {
334
- "int": 5,
335
- "double": 5.5,
336
- "boolean": true,
337
- "string": "five",
338
- "array": ["five"],
339
- "dictionary": {
340
- "string": "five"
341
- }
342
- },
343
- serverDescription: 'Default Offering',
344
- identifier: 'default'
345
- },
346
- all: {
347
- test: {
348
- weekly: null,
349
- monthly: {
350
- offeringIdentifier: 'test',
351
- product: {
352
- introPrice: {
353
- periodNumberOfUnits: 7,
354
- periodUnit: 'DAY',
355
- cycles: 3,
356
- period: 'P1W',
357
- priceString: '$4.99',
358
- price: 4.99
359
- },
360
- description: 'Product with intro price',
361
- currencyCode: 'USD',
362
- priceString: '$9.99',
363
- price: 9.99,
364
- title: 'Introductory Price (PurchasesSample)',
365
- identifier: 'introductory_price',
366
- subscriptionPeriod: "P1M"
367
- },
368
- packageType: 'MONTHLY',
369
- identifier: '$rc_monthly'
370
- },
371
- twoMonth: null,
372
- threeMonth: null,
373
- sixMonth: null,
374
- annual: null,
375
- lifetime: null,
376
- availablePackages: [
377
- {
378
- offeringIdentifier: 'test',
379
- product: {
380
- introPrice: {
381
- periodNumberOfUnits: 7,
382
- periodUnit: 'DAY',
383
- cycles: 3,
384
- period: 'P1W',
385
- priceString: '$4.99',
386
- price: 4.99
387
- },
388
- description: 'Product with intro price',
389
- currencyCode: 'USD',
390
- priceString: '$9.99',
391
- price: 9.99,
392
- title: 'Introductory Price (PurchasesSample)',
393
- identifier: 'introductory_price',
394
- subscriptionPeriod: "P1M"
395
- },
396
- packageType: 'MONTHLY',
397
- identifier: '$rc_monthly'
398
- }
399
- ],
400
- serverDescription: 'Testing an offering',
401
- identifier: 'test'
402
- },
403
- 'default': {
404
- weekly: {
405
- offeringIdentifier: 'default',
406
- product: {
407
- introPrice: {
408
- periodNumberOfUnits: 7,
409
- periodUnit: 'DAY',
410
- cycles: 3,
411
- period: 'P1W',
412
- priceString: '$4.99',
413
- price: 4.99
414
- },
415
- description: 'Product with intro price',
416
- currencyCode: 'USD',
417
- priceString: '$9.99',
418
- price: 9.99,
419
- title: 'Introductory Price (PurchasesSample)',
420
- identifier: 'introductory_price',
421
- subscriptionPeriod: "P1M"
422
- },
423
- packageType: 'WEEKLY',
424
- identifier: '$rc_weekly'
425
- },
426
- monthly: null,
427
- twoMonth: {
428
- offeringIdentifier: 'default',
429
- product: {
430
- introPrice: {
431
- periodNumberOfUnits: 16,
432
- periodUnit: 'DAY',
433
- cycles: 1,
434
- period: 'P2W2D',
435
- priceString: '$0.00',
436
- price: 0
437
- },
438
- description: 'The best service, annually.',
439
- currencyCode: 'USD',
440
- priceString: '$19.99',
441
- price: 19.99,
442
- title: 'Annual Free Trial (PurchasesSample)',
443
- identifier: 'annual_freetrial',
444
- subscriptionPeriod: "P1Y"
445
- },
446
- packageType: 'TWO_MONTH',
447
- identifier: '$rc_two_month'
448
- },
449
- threeMonth: {
450
- offeringIdentifier: 'default',
451
- product: {
452
- introPrice: {
453
- periodNumberOfUnits: 16,
454
- periodUnit: 'DAY',
455
- cycles: 1,
456
- period: 'P2W2D',
457
- priceString: '$0.00',
458
- price: 0
459
- },
460
- description: 'The best service, annually.',
461
- currencyCode: 'USD',
462
- priceString: '$19.99',
463
- price: 19.99,
464
- title: 'Annual Free Trial (PurchasesSample)',
465
- identifier: 'annual_freetrial',
466
- subscriptionPeriod: "P1Y"
467
- },
468
- packageType: 'THREE_MONTH',
469
- identifier: '$rc_three_month'
470
- },
471
- sixMonth: {
472
- offeringIdentifier: 'default',
473
- product: {
474
- introPrice: {
475
- periodNumberOfUnits: 16,
476
- periodUnit: 'DAY',
477
- cycles: 1,
478
- period: 'P2W2D',
479
- priceString: '$0.00',
480
- price: 0
481
- },
482
- description: 'The best service, annually.',
483
- currencyCode: 'USD',
484
- priceString: '$19.99',
485
- price: 19.99,
486
- title: 'Annual Free Trial (PurchasesSample)',
487
- identifier: 'annual_freetrial',
488
- subscriptionPeriod: "P1Y"
489
- },
490
- packageType: 'SIX_MONTH',
491
- identifier: '$rc_six_month'
492
- },
493
- annual: {
494
- offeringIdentifier: 'default',
495
- product: {
496
- introPrice: {
497
- periodNumberOfUnits: 16,
498
- periodUnit: 'DAY',
499
- cycles: 1,
500
- period: 'P2W2D',
501
- priceString: '$0.00',
502
- price: 0
503
- },
504
- description: 'The best service, annually.',
505
- currencyCode: 'USD',
506
- priceString: '$19.99',
507
- price: 19.99,
508
- title: 'Annual Free Trial (PurchasesSample)',
509
- identifier: 'annual_freetrial',
510
- subscriptionPeriod: "P1Y"
511
- },
512
- packageType: 'ANNUAL',
513
- identifier: '$rc_annual'
514
- },
515
- lifetime: {
516
- offeringIdentifier: 'default',
517
- product: {
518
- introPrice: null,
519
- description: 'you can eat it many times',
520
- currencyCode: 'USD',
521
- priceString: '$4.99',
522
- price: 4.99,
523
- title: 'Consumable (PurchasesSample)',
524
- identifier: 'consumable',
525
- subscriptionPeriod: null
526
- },
527
- packageType: 'LIFETIME',
528
- identifier: '$rc_lifetime'
529
- },
530
- availablePackages: [
531
- {
532
- offeringIdentifier: 'default',
533
- product: {
534
- introPrice: {
535
- periodNumberOfUnits: 16,
536
- periodUnit: 'DAY',
537
- cycles: 1,
538
- period: 'P2W2D',
539
- priceString: '$0.00',
540
- price: 0
541
- },
542
- description: 'The best service, annually.',
543
- currencyCode: 'USD',
544
- priceString: '$19.99',
545
- price: 19.99,
546
- title: 'Annual Free Trial (PurchasesSample)',
547
- identifier: 'annual_freetrial',
548
- subscriptionPeriod: "P1Y"
549
- },
550
- packageType: 'ANNUAL',
551
- identifier: '$rc_annual'
552
- },
553
- {
554
- offeringIdentifier: 'default',
555
- product: {
556
- introPrice: {
557
- periodNumberOfUnits: 16,
558
- periodUnit: 'DAY',
559
- cycles: 1,
560
- period: 'P2W2D',
561
- priceString: '$0.00',
562
- price: 0
563
- },
564
- description: 'The best service, annually.',
565
- currencyCode: 'USD',
566
- priceString: '$19.99',
567
- price: 19.99,
568
- title: 'Annual Free Trial (PurchasesSample)',
569
- identifier: 'annual_freetrial',
570
- subscriptionPeriod: "P1Y"
571
- },
572
- packageType: 'SIX_MONTH',
573
- identifier: '$rc_six_month'
574
- },
575
- {
576
- offeringIdentifier: 'default',
577
- product: {
578
- introPrice: {
579
- periodNumberOfUnits: 16,
580
- periodUnit: 'DAY',
581
- cycles: 1,
582
- period: 'P2W2D',
583
- priceString: '$0.00',
584
- price: 0
585
- },
586
- description: 'The best service, annually.',
587
- currencyCode: 'USD',
588
- priceString: '$19.99',
589
- price: 19.99,
590
- title: 'Annual Free Trial (PurchasesSample)',
591
- identifier: 'annual_freetrial',
592
- subscriptionPeriod: "P1Y"
593
- },
594
- packageType: 'THREE_MONTH',
595
- identifier: '$rc_three_month'
596
- },
597
- {
598
- offeringIdentifier: 'default',
599
- product: {
600
- introPrice: {
601
- periodNumberOfUnits: 16,
602
- periodUnit: 'DAY',
603
- cycles: 1,
604
- period: 'P2W2D',
605
- priceString: '$0.00',
606
- price: 0
607
- },
608
- description: 'The best service, annually.',
609
- currencyCode: 'USD',
610
- priceString: '$19.99',
611
- price: 19.99,
612
- title: 'Annual Free Trial (PurchasesSample)',
613
- identifier: 'annual_freetrial',
614
- subscriptionPeriod: "P1Y"
615
- },
616
- packageType: 'TWO_MONTH',
617
- identifier: '$rc_two_month'
618
- },
619
- {
620
- offeringIdentifier: 'default',
621
- product: {
622
- introPrice: {
623
- periodNumberOfUnits: 7,
624
- periodUnit: 'DAY',
625
- cycles: 3,
626
- period: 'P1W',
627
- priceString: '$4.99',
628
- price: 4.99
629
- },
630
- description: 'Product with intro price',
631
- currencyCode: 'USD',
632
- priceString: '$9.99',
633
- price: 9.99,
634
- title: 'Introductory Price (PurchasesSample)',
635
- identifier: 'introductory_price',
636
- subscriptionPeriod: "P1M"
637
- },
638
- packageType: 'WEEKLY',
639
- identifier: '$rc_weekly'
640
- },
641
- {
642
- offeringIdentifier: 'default',
643
- product: {
644
- introPrice: null,
645
- description: 'you can eat it many times',
646
- currencyCode: 'USD',
647
- priceString: '$4.99',
648
- price: 4.99,
649
- title: 'Consumable (PurchasesSample)',
650
- identifier: 'consumable',
651
- subscriptionPeriod: null
652
- },
653
- packageType: 'LIFETIME',
654
- identifier: '$rc_lifetime'
655
- },
656
- {
657
- offeringIdentifier: 'default',
658
- product: {
659
- introPrice: {
660
- periodNumberOfUnits: 16,
661
- periodUnit: 'DAY',
662
- cycles: 1,
663
- period: 'P2W2D',
664
- priceString: '$0.00',
665
- price: 0
666
- },
667
- description: 'The best service, annually.',
668
- currencyCode: 'USD',
669
- priceString: '$19.99',
670
- price: 19.99,
671
- title: 'Annual Free Trial (PurchasesSample)',
672
- identifier: 'annual_freetrial',
673
- subscriptionPeriod: "P1Y"
674
- },
675
- packageType: 'CUSTOM',
676
- identifier: 'Custom'
677
- }
678
- ],
679
- serverDescription: 'Default Offering',
680
- identifier: 'default'
681
- }
682
- }
683
- };
684
-
685
- global.productStub = {
686
- currencyCode: "USD",
687
- introPrice: null,
688
- discounts: null,
689
- priceString: "$0.99",
690
- price: 0.99,
691
- description: "The best service.",
692
- title: "One Month Free Trial",
693
- identifier: "onemonth_freetrial",
694
- productCategory: "SUBSCRIPTION",
695
- };
696
-
697
- global.productsStub = [
698
- productStub
699
- ];
700
-
701
- global.packagestub = {
702
- offeringIdentifier: "default",
703
- product: productStub,
704
- packageType: "MONTHLY",
705
- identifier: "$rc_monthly"
706
- };
707
-
708
- global.discountStub = {
709
- identifier: "promo_cat",
710
- price: 0.49000000953674316,
711
- priceString: "$0.49",
712
- cycles: 1,
713
- period: "P1M",
714
- periodUnit: "MONTH",
715
- periodNumberOfUnits: 1,
716
- };
717
-
718
- global.promotionalOfferStub = {
719
- identifier: "promo_cat",
720
- keyIdentifier: "keyID",
721
- nonce: "nonce",
722
- signature: "signature",
723
- timestamp: 123,
724
- };
725
-
726
- global.entitlementInfoStub = {
727
- identifier: "entitlement_id",
728
- isActive: true,
729
- willRenew: true,
730
- periodType: "",
731
- latestPurchaseDate: "",
732
- originalPurchaseDate: "",
733
- expirationDate: "",
734
- store: "APP_STORE",
735
- productIdentifier: "product_id",
736
- isSandbox: false,
737
- unsubscribeDetectedAt: null,
738
- billingIssueDetectedAt: null
739
- };
740
-
741
- NativeModules.RNPurchases = {
742
- setupPurchases: jest.fn(),
743
- setAllowSharingStoreAccount: jest.fn(),
744
- addAttributionData: jest.fn(),
745
- getOfferings: jest.fn(),
746
- getProductInfo: jest.fn(),
747
- makePurchase: jest.fn(),
748
- restorePurchases: jest.fn(),
749
- getAppUserID: jest.fn(),
750
- setDebugLogsEnabled: jest.fn(),
751
- setLogLevel: jest.fn(),
752
- setLogHandler: jest.fn(),
753
- getCustomerInfo: jest.fn(),
754
- logIn: jest.fn(),
755
- logOut: jest.fn(),
756
- syncPurchases: jest.fn(),
757
- syncObserverModeAmazonPurchase: jest.fn(),
758
- setFinishTransactions: jest.fn(),
759
- purchaseProduct: jest.fn(),
760
- purchasePackage: jest.fn(),
761
- purchaseSubscriptionOption: jest.fn(),
762
- isAnonymous: jest.fn(),
763
- makeDeferredPurchase: jest.fn(),
764
- checkTrialOrIntroductoryPriceEligibility: jest.fn(),
765
- purchaseDiscountedPackage: jest.fn(),
766
- purchaseDiscountedProduct: jest.fn(),
767
- getPromotionalOffer: jest.fn(),
768
- invalidateCustomerInfoCache: jest.fn(),
769
- setAttributes: jest.fn(),
770
- setEmail: jest.fn(),
771
- setPhoneNumber: jest.fn(),
772
- setDisplayName: jest.fn(),
773
- setPushToken: jest.fn(),
774
- setCleverTapID: jest.fn(),
775
- setMixpanelDistinctID: jest.fn(),
776
- setFirebaseAppInstanceID: jest.fn(),
777
- canMakePayments: jest.fn(),
778
- beginRefundRequestForActiveEntitlement: jest.fn(),
779
- beginRefundRequestForEntitlementId: jest.fn(),
780
- beginRefundRequestForProductId: jest.fn(),
781
- showInAppMessages: jest.fn(),
782
- isConfigured: jest.fn()
783
- };
784
-
785
- jest.mock(
786
- 'react-native/Libraries/EventEmitter/NativeEventEmitter',
787
- );