@exodus/react-native-webview 11.26.1-exodus.28 → 11.26.1-exodus.29

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 (112) hide show
  1. package/package.json +3 -2
  2. package/.all-contributorsrc +0 -185
  3. package/.circleci/config.yml +0 -66
  4. package/.eslintignore +0 -2
  5. package/.eslintrc.js +0 -94
  6. package/.flowconfig +0 -88
  7. package/.flowconfig.android +0 -88
  8. package/.gitattributes +0 -12
  9. package/.github/CODEOWNERS +0 -1
  10. package/.github/ISSUE_TEMPLATE/bug-report.md +0 -42
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -30
  12. package/.github/workflows/android-ci.yml +0 -35
  13. package/.github/workflows/detox.yml +0 -20
  14. package/.github/workflows/ios-ci.yml +0 -31
  15. package/.github/workflows/scripts/install-vs-features.ps1 +0 -108
  16. package/.github/workflows/stale.yml +0 -17
  17. package/.gitignore +0 -62
  18. package/.prettierrc.js +0 -10
  19. package/.releaserc +0 -15
  20. package/.vscode/settings.json +0 -9
  21. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  22. package/android/.gradle/8.9/checksums/md5-checksums.bin +0 -0
  23. package/android/.gradle/8.9/checksums/sha1-checksums.bin +0 -0
  24. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  25. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  26. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  27. package/android/.gradle/8.9/gc.properties +0 -0
  28. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  29. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  30. package/android/.gradle/vcs-1/gc.properties +0 -0
  31. package/babel.config.js +0 -11
  32. package/bin/setup +0 -26
  33. package/docs/Contributing.md +0 -102
  34. package/docs/Custom-Android.md +0 -222
  35. package/docs/Custom-iOS.md +0 -236
  36. package/docs/Debugging.md +0 -101
  37. package/docs/Getting-Started.md +0 -142
  38. package/docs/Guide.md +0 -613
  39. package/docs/Reference.md +0 -1639
  40. package/example/.gitignore +0 -14
  41. package/example/.watchmanconfig +0 -1
  42. package/example/App.tsx +0 -262
  43. package/example/android/.gradle/7.3.3/checksums/checksums.lock +0 -0
  44. package/example/android/.gradle/7.3.3/checksums/md5-checksums.bin +0 -0
  45. package/example/android/.gradle/7.3.3/checksums/sha1-checksums.bin +0 -0
  46. package/example/android/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock +0 -0
  47. package/example/android/.gradle/7.3.3/dependencies-accessors/gc.properties +0 -0
  48. package/example/android/.gradle/7.3.3/executionHistory/executionHistory.lock +0 -0
  49. package/example/android/.gradle/7.3.3/fileChanges/last-build.bin +0 -0
  50. package/example/android/.gradle/7.3.3/fileHashes/fileHashes.lock +0 -0
  51. package/example/android/.gradle/7.3.3/gc.properties +0 -0
  52. package/example/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  53. package/example/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  54. package/example/android/.gradle/vcs-1/gc.properties +0 -0
  55. package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4.json +0 -14
  56. package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4.log +0 -1
  57. package/example/android/app/build/intermediates/cxx/abi_configuration_1a4zb4f4_key.json +0 -18
  58. package/example/android/app/build/intermediates/cxx/create_cxx_tasks_21_timing.txt +0 -62
  59. package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59.json +0 -11
  60. package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59.log +0 -128
  61. package/example/android/app/build/intermediates/cxx/ndk_locator_record_5i2h5t59_key.json +0 -7
  62. package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q.json +0 -11
  63. package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q.log +0 -72
  64. package/example/android/app/build/intermediates/cxx/ndk_locator_record_6n5y632q_key.json +0 -8
  65. package/example/android/build.gradle +0 -15
  66. package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  67. package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  68. package/example/android/gradle.properties +0 -34
  69. package/example/android/gradlew +0 -234
  70. package/example/android/gradlew.bat +0 -89
  71. package/example/android/settings.gradle +0 -12
  72. package/example/app.json +0 -20
  73. package/example/assets/test.html +0 -9
  74. package/example/babel.config.js +0 -3
  75. package/example/examples/Alerts.tsx +0 -72
  76. package/example/examples/ApplePay.tsx +0 -23
  77. package/example/examples/Background.tsx +0 -54
  78. package/example/examples/Downloads.tsx +0 -57
  79. package/example/examples/Injection.tsx +0 -161
  80. package/example/examples/LocalPageLoad.tsx +0 -16
  81. package/example/examples/Messaging.tsx +0 -63
  82. package/example/examples/NativeWebpage.tsx +0 -22
  83. package/example/examples/Scrolling.tsx +0 -68
  84. package/example/examples/Uploads.tsx +0 -69
  85. package/example/index.js +0 -9
  86. package/example/ios/Podfile +0 -8
  87. package/example/ios/Podfile.lock +0 -445
  88. package/jest-setups/jest.setup.js +0 -8
  89. package/jest.config.js +0 -184
  90. package/lib/WebView.android.d.ts.map +0 -1
  91. package/lib/WebView.d.ts.map +0 -1
  92. package/lib/WebView.ios.d.ts.map +0 -1
  93. package/lib/WebView.styles.d.ts.map +0 -1
  94. package/lib/WebViewNativeComponent.android.d.ts.map +0 -1
  95. package/lib/WebViewNativeComponent.ios.d.ts.map +0 -1
  96. package/lib/WebViewShared.d.ts.map +0 -1
  97. package/lib/WebViewTypes.d.ts.map +0 -1
  98. package/lib/index.d.ts.map +0 -1
  99. package/metro.config.js +0 -57
  100. package/src/WebView.android.tsx +0 -255
  101. package/src/WebView.ios.tsx +0 -227
  102. package/src/WebView.styles.ts +0 -44
  103. package/src/WebView.tsx +0 -18
  104. package/src/WebViewNativeComponent.android.ts +0 -8
  105. package/src/WebViewNativeComponent.ios.ts +0 -8
  106. package/src/WebViewShared.tsx +0 -318
  107. package/src/WebViewTypes.ts +0 -941
  108. package/src/__tests__/WebViewShared-test.js +0 -292
  109. package/src/__tests__/__snapshots__/WebViewShared-test.js.snap +0 -13
  110. package/src/index.ts +0 -4
  111. package/tsconfig.json +0 -24
  112. package/yarn.lock +0 -13397
@@ -1,292 +0,0 @@
1
- import { Linking } from 'react-native';
2
-
3
- import {
4
- defaultOriginWhitelist,
5
- defaultDeeplinkWhitelist,
6
- createOnShouldStartLoadWithRequest,
7
- } from '../WebViewShared';
8
-
9
- Linking.openURL.mockResolvedValue(undefined);
10
- Linking.canOpenURL.mockResolvedValue(true);
11
-
12
- // The tests that call createOnShouldStartLoadWithRequest will cause a promise
13
- // to get kicked off (by calling the mocked `Linking.canOpenURL`) that the tests
14
- // _need_ to get run to completion _before_ doing any `expect`ing. The reason
15
- // is: once that promise is resolved another function should get run which will
16
- // call `Linking.openURL`, and we want to test that.
17
- //
18
- // Normally we would probably do something like `await
19
- // createShouldStartLoadWithRequest(...)` in the tests, but that doesn't work
20
- // here because the promise that gets kicked off is not returned (because
21
- // non-test code doesn't need to know about it).
22
- //
23
- // The tests thus need a way to "flush any pending promises" (to make sure
24
- // pending promises run to completion) before doing any `expect`ing. `jest`
25
- // doesn't provide a way to do this out of the box, but we can use this function
26
- // to do it.
27
- //
28
- // See this issue for more discussion: https://github.com/facebook/jest/issues/2157
29
- function flushPromises() {
30
- return new Promise(resolve => setImmediate(resolve));
31
- }
32
-
33
-
34
- describe('WebViewShared', () => {
35
- test('exports defaultOriginWhitelist', () => {
36
- expect(defaultOriginWhitelist).toMatchSnapshot();
37
- });
38
-
39
- test('exports defaultDeeplinkWhitelist', () => {
40
- expect(defaultDeeplinkWhitelist).toMatchSnapshot();
41
- });
42
-
43
- describe('createOnShouldStartLoadWithRequest', () => {
44
- const alwaysTrueOnShouldStartLoadWithRequest = (nativeEvent) => {
45
- return true;
46
- };
47
-
48
- const alwaysFalseOnShouldStartLoadWithRequest = (nativeEvent) => {
49
- return false;
50
- };
51
-
52
- const loadRequest = jest.fn();
53
-
54
- test('loadRequest is called without onShouldStartLoadWithRequest override', async () => {
55
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
56
- loadRequest,
57
- defaultOriginWhitelist,
58
- defaultDeeplinkWhitelist,
59
- );
60
-
61
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', lockIdentifier: 1 } });
62
-
63
- await flushPromises();
64
-
65
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
66
- expect(loadRequest).toHaveBeenCalledWith(true, 'https://www.example.com/', 1);
67
- });
68
-
69
- test('Linking.openURL is called without onShouldStartLoadWithRequest override', async () => {
70
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
71
- loadRequest,
72
- defaultOriginWhitelist,
73
- ['invalid:'],
74
- );
75
-
76
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', isTopFrame: true, lockIdentifier: 2 } });
77
-
78
- await flushPromises();
79
-
80
- expect(Linking.openURL).toHaveBeenCalledWith('invalid://example.com/');
81
- expect(loadRequest).toHaveBeenCalledWith(false, 'invalid://example.com/', 2);
82
- });
83
-
84
- test('loadRequest with true onShouldStartLoadWithRequest override is called', async () => {
85
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
86
- loadRequest,
87
- defaultOriginWhitelist,
88
- defaultDeeplinkWhitelist,
89
- alwaysTrueOnShouldStartLoadWithRequest,
90
- );
91
-
92
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
93
-
94
- await flushPromises();
95
-
96
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
97
- expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
98
- });
99
-
100
- test('Linking.openURL with true onShouldStartLoadWithRequest override is called for links not passing the whitelist', async () => {
101
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
102
- loadRequest,
103
- defaultOriginWhitelist,
104
- ['invalid:'],
105
- alwaysTrueOnShouldStartLoadWithRequest,
106
- );
107
-
108
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'invalid://example.com/', isTopFrame: true, lockIdentifier: 1 } });
109
-
110
- await flushPromises();
111
-
112
- expect(Linking.openURL).toHaveBeenLastCalledWith('invalid://example.com/');
113
- // We don't expect the URL to have been loaded in the WebView because it
114
- // is not in the origin whitelist
115
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'invalid://example.com/', 1);
116
- });
117
-
118
- test('Linking.openURL with limited whitelist', async () => {
119
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
120
- loadRequest,
121
- ['https://*'],
122
- ['bitcoin:'],
123
- );
124
-
125
- const good = 'bitcoin:175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W?amount=50&label=Luke-Jr&message=Donation%20for%20project%20xyz'
126
- onShouldStartLoadWithRequest({ nativeEvent: { url: good, isTopFrame: true, lockIdentifier: 1 } });
127
-
128
- await flushPromises();
129
-
130
- expect(Linking.openURL).toHaveBeenCalledWith(good)
131
- });
132
-
133
- test.each([
134
- 'javascript:alert(1)',
135
- 'jAvAsCrIpT:alert(1)',
136
- 'file:///Users/user/Documents/projects/index.html',
137
- 'fIlE:///Users/user/Documents/projects/index.html',
138
- 'http://google.com',
139
- 'hTtP://google.com'
140
- ])('Linking.openURL with default blocklist %s', async (bad) => {
141
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
142
- loadRequest,
143
- ['https://*'],
144
- ['bitcoin:'],
145
- );
146
-
147
- onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
148
-
149
- await flushPromises();
150
-
151
- expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
152
- });
153
-
154
- test.each([
155
- '',
156
- [''],
157
- '*'
158
- ])('Linking.openURL with empty allow list should not allow passing', async (badList) => {
159
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
160
- loadRequest,
161
- [],
162
- [badList],
163
- );
164
- const bad = 'bitcoin:'
165
- onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
166
-
167
- await flushPromises();
168
-
169
- expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
170
- });
171
-
172
- test('Linking.openURL with hardcoded blocklist should take priority over whitelist', async () => {
173
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
174
- loadRequest,
175
- [],
176
- ['javascript:'],
177
- );
178
- const bad = 'javascript:alert(1)'
179
- onShouldStartLoadWithRequest({ nativeEvent: { url: bad, isTopFrame: true, lockIdentifier: 1 } });
180
-
181
- await flushPromises();
182
-
183
- expect(Linking.openURL).not.toHaveBeenCalledWith(bad)
184
- });
185
-
186
- test('loadRequest with false onShouldStartLoadWithRequest override is called', async () => {
187
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
188
- loadRequest,
189
- defaultOriginWhitelist,
190
- defaultDeeplinkWhitelist,
191
- alwaysFalseOnShouldStartLoadWithRequest,
192
- );
193
-
194
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
195
-
196
- await flushPromises();
197
-
198
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
199
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'https://www.example.com/', 1);
200
- });
201
-
202
- test('loadRequest with limited whitelist', async () => {
203
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
204
- loadRequest,
205
- ['https://*'],
206
- ['git+https:', 'fakehttps:'],
207
- );
208
-
209
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
210
-
211
- await flushPromises();
212
-
213
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
214
- expect(loadRequest).toHaveBeenLastCalledWith(true, 'https://www.example.com/', 1);
215
-
216
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'http://insecure.com/', isTopFrame: true, lockIdentifier: 2 } });
217
-
218
- await flushPromises();
219
-
220
- expect(Linking.openURL).not.toHaveBeenLastCalledWith('http://insecure.com/');
221
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'http://insecure.com/', 2);
222
-
223
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'git+https://insecure.com/', isTopFrame: true, lockIdentifier: 3 } });
224
-
225
- await flushPromises();
226
-
227
- expect(Linking.openURL).toHaveBeenLastCalledWith('git+https://insecure.com/');
228
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'git+https://insecure.com/', 3);
229
-
230
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'fakehttps://insecure.com/', isTopFrame: true, lockIdentifier: 4 } });
231
-
232
- await flushPromises();
233
-
234
- expect(Linking.openURL).toHaveBeenLastCalledWith('fakehttps://insecure.com/');
235
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'fakehttps://insecure.com/', 4);
236
- });
237
-
238
- test('loadRequest allows for valid URIs', async () => {
239
- const onShouldStartLoadWithRequest = createOnShouldStartLoadWithRequest(
240
- loadRequest,
241
- ['plus+https://*', 'DOT.https://*', 'dash-https://*', '0invalid://*', '+invalid://*'],
242
- ['0invalid:', '+invalid:', 'fake+plus+https:'],
243
- );
244
-
245
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'plus+https://www.example.com/', isTopFrame: true, lockIdentifier: 1 } });
246
-
247
- await flushPromises();
248
-
249
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
250
- // (new URL('plus+https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
251
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'plus+https://www.example.com/', 1);
252
-
253
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'DOT.https://www.example.com/', isTopFrame: true, lockIdentifier: 2 } });
254
-
255
- await flushPromises();
256
-
257
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
258
- // (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
259
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'DOT.https://www.example.com/', 2);
260
-
261
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'dash-https://www.example.com/', isTopFrame: true, lockIdentifier: 3 } });
262
-
263
- await flushPromises();
264
-
265
- expect(Linking.openURL).toHaveBeenCalledTimes(0);
266
- // (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
267
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'dash-https://www.example.com/', 3);
268
-
269
- onShouldStartLoadWithRequest({ nativeEvent: { url: '0invalid://www.example.com/', isTopFrame: true, lockIdentifier: 4 } });
270
-
271
- await flushPromises();
272
-
273
- expect(Linking.openURL).not.toHaveBeenLastCalledWith('0invalid://www.example.com/');
274
- // (new URL('DOT.https://www.example.com/')).origin is null so it doesn't pass _passesWhitelist
275
- expect(loadRequest).toHaveBeenLastCalledWith(false, '0invalid://www.example.com/', 4);
276
-
277
- onShouldStartLoadWithRequest({ nativeEvent: { url: '+invalid://www.example.com/', isTopFrame: true, lockIdentifier: 5 } });
278
-
279
- await flushPromises();
280
-
281
- expect(Linking.openURL).not.toHaveBeenLastCalledWith('+invalid://www.example.com/');
282
- expect(loadRequest).toHaveBeenLastCalledWith(false, '+invalid://www.example.com/', 5);
283
-
284
- onShouldStartLoadWithRequest({ nativeEvent: { url: 'FAKE+plus+https://www.example.com/', isTopFrame: true, lockIdentifier: 6 } });
285
-
286
- await flushPromises();
287
-
288
- expect(Linking.openURL).toHaveBeenLastCalledWith('FAKE+plus+https://www.example.com/');
289
- expect(loadRequest).toHaveBeenLastCalledWith(false, 'FAKE+plus+https://www.example.com/', 6);
290
- });
291
- });
292
- });
@@ -1,13 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`WebViewShared exports defaultOriginWhitelist 1`] = `
4
- Array [
5
- "https://*",
6
- ]
7
- `;
8
-
9
- exports[`WebViewShared exports defaultDeeplinkWhitelist 1`] = `
10
- Array [
11
- "https:",
12
- ]
13
- `;
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- import WebView from './WebView';
2
-
3
- export { WebView };
4
- export default WebView;
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "include": ["src/*"],
3
- "compilerOptions": {
4
- "baseUrl": "./src/",
5
- "jsx": "react-native",
6
- "module": "esnext",
7
- "moduleResolution": "node",
8
- "target": "es2019",
9
- "declaration": true,
10
- "declarationMap": true,
11
- "outDir": "lib",
12
- "allowSyntheticDefaultImports": true,
13
- "esModuleInterop": true,
14
- "forceConsistentCasingInFileNames": true,
15
- "noFallthroughCasesInSwitch": true,
16
- "noImplicitReturns": true,
17
- "noUnusedLocals": true,
18
- "noUnusedParameters": true,
19
- "pretty": true,
20
- "resolveJsonModule": true,
21
- "skipLibCheck": true,
22
- "strict": true
23
- }
24
- }