react-native-iap 8.5.3 → 8.6.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.
Files changed (77) hide show
  1. package/README.md +4 -20
  2. package/RNIap.podspec +33 -18
  3. package/android/build.gradle +137 -38
  4. package/android/gradle.properties +8 -0
  5. package/ios/RNIapIos-Bridging-Header.h +2 -0
  6. package/ios/RNIapIos.m +13 -0
  7. package/ios/RNIapIos.swift +84 -36
  8. package/ios/{RNIap.xcodeproj → RNIapIos.xcodeproj}/project.pbxproj +29 -116
  9. package/lib/commonjs/__test__/iap.test.js +21 -0
  10. package/lib/commonjs/__test__/iap.test.js.map +1 -0
  11. package/lib/commonjs/hooks/useIAP.js +78 -0
  12. package/lib/commonjs/hooks/useIAP.js.map +1 -0
  13. package/lib/commonjs/hooks/withIAPContext.js +92 -0
  14. package/lib/commonjs/hooks/withIAPContext.js.map +1 -0
  15. package/lib/commonjs/iap.js +577 -0
  16. package/lib/commonjs/iap.js.map +1 -0
  17. package/lib/commonjs/index.js +59 -0
  18. package/lib/commonjs/index.js.map +1 -0
  19. package/lib/commonjs/types/amazon.js +2 -0
  20. package/lib/commonjs/types/amazon.js.map +1 -0
  21. package/lib/commonjs/types/android.js +55 -0
  22. package/lib/commonjs/types/android.js.map +1 -0
  23. package/lib/commonjs/types/apple.js +165 -0
  24. package/lib/commonjs/types/apple.js.map +1 -0
  25. package/lib/commonjs/types/index.js +59 -0
  26. package/lib/commonjs/types/index.js.map +1 -0
  27. package/lib/module/__test__/iap.test.js +17 -0
  28. package/lib/module/__test__/iap.test.js.map +1 -0
  29. package/lib/module/hooks/useIAP.js +68 -0
  30. package/lib/module/hooks/useIAP.js.map +1 -0
  31. package/lib/module/hooks/withIAPContext.js +76 -0
  32. package/lib/module/hooks/withIAPContext.js.map +1 -0
  33. package/lib/module/iap.js +488 -0
  34. package/lib/module/iap.js.map +1 -0
  35. package/lib/module/index.js +6 -0
  36. package/lib/module/index.js.map +1 -0
  37. package/lib/module/types/amazon.js +2 -0
  38. package/lib/module/types/amazon.js.map +1 -0
  39. package/lib/module/types/android.js +44 -0
  40. package/lib/module/types/android.js.map +1 -0
  41. package/lib/module/types/apple.js +153 -0
  42. package/lib/module/types/apple.js.map +1 -0
  43. package/lib/module/types/index.js +48 -0
  44. package/lib/module/types/index.js.map +1 -0
  45. package/lib/typescript/__test__/iap.test.d.ts +1 -0
  46. package/lib/typescript/hooks/useIAP.d.ts +22 -0
  47. package/lib/typescript/hooks/withIAPContext.d.ts +22 -0
  48. package/lib/typescript/iap.d.ts +195 -0
  49. package/lib/typescript/index.d.ts +5 -0
  50. package/lib/typescript/types/amazon.d.ts +23 -0
  51. package/lib/typescript/types/android.d.ts +47 -0
  52. package/lib/typescript/types/apple.d.ts +424 -0
  53. package/lib/typescript/types/index.d.ts +146 -0
  54. package/package.json +80 -47
  55. package/src/__test__/iap.test.ts +20 -0
  56. package/src/hooks/useIAP.ts +130 -0
  57. package/src/hooks/withIAPContext.tsx +160 -0
  58. package/src/iap.ts +686 -0
  59. package/src/index.ts +7 -0
  60. package/src/types/amazon.ts +23 -0
  61. package/src/types/android.ts +51 -0
  62. package/src/types/apple.ts +467 -0
  63. package/src/types/index.ts +185 -0
  64. package/.editorconfig +0 -10
  65. package/.flowconfig +0 -11
  66. package/.monolinterrc +0 -3
  67. package/.prettierignore +0 -6
  68. package/.swiftlint.yml +0 -11
  69. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  70. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  71. package/android/gradlew +0 -160
  72. package/android/gradlew.bat +0 -90
  73. package/babel.config.js +0 -12
  74. package/index.ts +0 -5
  75. package/ios/RNIap.xcodeproj/xcshareddata/xcschemes/RNIap.xcscheme +0 -80
  76. package/jest.config.js +0 -190
  77. package/test/mocks/react-native-modules.js +0 -14
package/jest.config.js DELETED
@@ -1,190 +0,0 @@
1
- // For a detailed explanation regarding each configuration property, visit:
2
- // https://jestjs.io/docs/en/configuration.html
3
-
4
- module.exports = {
5
- // All imported modules in your tests should be mocked automatically
6
- // automock: false,
7
-
8
- // Stop running tests after `n` failures
9
- // bail: 0,
10
-
11
- // The directory where Jest should store its cached dependency information
12
- // cacheDirectory: "/private/var/folders/7j/chyhjjfx5vv8r5g_7nk_hrtm0000gp/T/jest_dy",
13
-
14
- // Automatically clear mock calls and instances between every test
15
- clearMocks: true,
16
-
17
- // Indicates whether the coverage information should be collected while executing the test
18
- // collectCoverage: false,
19
-
20
- // An array of glob patterns indicating a set of files for which coverage information should be collected
21
- // collectCoverageFrom: undefined,
22
-
23
- // The directory where Jest should output its coverage files
24
- coverageDirectory: 'coverage',
25
-
26
- // An array of regexp pattern strings used to skip coverage collection
27
- // coveragePathIgnorePatterns: [
28
- // "/node_modules/"
29
- // ],
30
-
31
- // Indicates which provider should be used to instrument code for coverage
32
- // coverageProvider: "babel",
33
-
34
- // A list of reporter names that Jest uses when writing coverage reports
35
- // coverageReporters: [
36
- // "json",
37
- // "text",
38
- // "lcov",
39
- // "clover"
40
- // ],
41
-
42
- // An object that configures minimum threshold enforcement for coverage results
43
- // coverageThreshold: undefined,
44
-
45
- // A path to a custom dependency extractor
46
- // dependencyExtractor: undefined,
47
-
48
- // Make calling deprecated APIs throw helpful error messages
49
- // errorOnDeprecated: false,
50
-
51
- // Force coverage collection from ignored files using an array of glob patterns
52
- // forceCoverageMatch: [],
53
-
54
- // A path to a module which exports an async function that is triggered once before all test suites
55
- // globalSetup: undefined,
56
-
57
- // A path to a module which exports an async function that is triggered once after all test suites
58
- // globalTeardown: undefined,
59
-
60
- // A set of global variables that need to be available in all test environments
61
- // globals: {},
62
-
63
- // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
64
- // maxWorkers: "50%",
65
-
66
- // An array of directory names to be searched recursively up from the requiring module's location
67
- moduleDirectories: ['node_modules', 'src'],
68
-
69
- // An array of file extensions your modules use
70
- // moduleFileExtensions: [
71
- // "js",
72
- // "json",
73
- // "jsx",
74
- // "ts",
75
- // "tsx",
76
- // "node"
77
- // ],
78
-
79
- // A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
80
- // moduleNameMapper: {},
81
-
82
- // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
83
- modulePathIgnorePatterns: ['IapExample'],
84
-
85
- // Activates notifications for test results
86
- // notify: false,
87
-
88
- // An enum that specifies notification mode. Requires { notify: true }
89
- // notifyMode: "failure-change",
90
-
91
- // A preset that is used as a base for Jest's configuration
92
- preset: 'react-native',
93
-
94
- // Run tests from one or more projects
95
- // projects: undefined,
96
-
97
- // Use this configuration option to add custom reporters to Jest
98
- // reporters: undefined,
99
-
100
- // Automatically reset mock state between every test
101
- // resetMocks: false,
102
-
103
- // Reset the module registry before running each individual test
104
- // resetModules: false,
105
-
106
- // A path to a custom resolver
107
- // resolver: undefined,
108
-
109
- // Automatically restore mock state between every test
110
- // restoreMocks: false,
111
-
112
- // The root directory that Jest should scan for tests and modules within
113
- // rootDir: undefined,
114
-
115
- // A list of paths to directories that Jest should use to search for files in
116
- // roots: [
117
- // "<rootDir>"
118
- // ],
119
-
120
- // Allows you to use a custom runner instead of Jest's default test runner
121
- // runner: "jest-runner",
122
-
123
- // The paths to modules that run some code to configure or set up the testing environment before each test
124
- setupFiles: ['<rootDir>/test/mocks/react-native-modules.js'],
125
-
126
- // A list of paths to modules that run some code to configure or set up the testing framework before each test
127
- setupFilesAfterEnv: ['@testing-library/jest-native/extend-expect'],
128
-
129
- // The number of seconds after which a test is considered as slow and reported as such in the results.
130
- // slowTestThreshold: 5,
131
-
132
- // A list of paths to snapshot serializer modules Jest should use for snapshot testing
133
- // snapshotSerializers: [],
134
-
135
- // The test environment that will be used for testing
136
- // testEnvironment: "node",
137
-
138
- // Options that will be passed to the testEnvironment
139
- // testEnvironmentOptions: {},
140
-
141
- // Adds a location field to test results
142
- // testLocationInResults: false,
143
-
144
- // The glob patterns Jest uses to detect test files
145
- // testMatch: [
146
- // "**/__tests__/**/*.[jt]s?(x)",
147
- // "**/?(*.)+(spec|test).[tj]s?(x)"
148
- // ],
149
-
150
- // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
151
- // testPathIgnorePatterns: [
152
- // "/node_modules/"
153
- // ],
154
-
155
- // The regexp pattern or array of patterns that Jest uses to detect test files
156
- // testRegex: [],
157
-
158
- // This option allows the use of a custom results processor
159
- // testResultsProcessor: undefined,
160
-
161
- // This option allows use of a custom test runner
162
- // testRunner: "jasmine2",
163
-
164
- // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
165
- // testURL: "http://localhost",
166
-
167
- // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
168
- // timers: "real",
169
-
170
- // A map from regular expressions to paths to transformers
171
- transform: {
172
- '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
173
- '\\.(ts|tsx)$': 'ts-jest',
174
- },
175
-
176
- // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
177
- transformIgnorePatterns: ['node_modules/(?!@react-native|react-native)'],
178
-
179
- // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
180
- // unmockedModulePathPatterns: undefined,
181
-
182
- // Indicates whether each individual test should be reported during the run
183
- // verbose: undefined,
184
-
185
- // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
186
- // watchPathIgnorePatterns: [],
187
-
188
- // Whether to use watchman for file crawling
189
- // watchman: true,
190
- };
@@ -1,14 +0,0 @@
1
- import {NativeModules, Platform} from 'react-native';
2
- NativeModules.RNIapModule = {
3
- ...NativeModules.RNIapModule,
4
- initConnection: jest.fn(() => Promise.resolve(true)),
5
- endConnection: jest.fn(),
6
- getInstallSource: jest.fn(),
7
- };
8
-
9
- NativeModules.RNIapAmazonModule = {
10
- ...NativeModules.RNIapAmazonModule,
11
- initConnection: jest.fn(() => Promise.resolve(true)),
12
- endConnection: jest.fn(),
13
- getInstallSource: jest.fn(),
14
- };