@sleeperhq/mini-core 1.8.6 → 1.9.0
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/mini_packages.json +2 -2
- package/package.json +3 -3
- package/src/dev_server/index.tsx +4 -20
- package/src/plugins/send_events.mjs +44 -0
- package/src/styles/theme.ts +5 -5
package/mini_packages.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"@react-navigation/native": "6.1.3",
|
|
18
18
|
"@react-navigation/stack": "6.3.12",
|
|
19
19
|
"@shopify/flash-list": "1.4.1",
|
|
20
|
-
"@sleeperhq/mini-core": "1.8.
|
|
20
|
+
"@sleeperhq/mini-core": "1.8.7",
|
|
21
21
|
"amazon-cognito-identity-js": "6.3.2",
|
|
22
22
|
"crypto-js": "3.3.0",
|
|
23
23
|
"decimal.js-light": "2.5.1",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"path": "0.12.7",
|
|
28
28
|
"react": "18.2.0",
|
|
29
29
|
"react-freeze": "1.0.3",
|
|
30
|
-
"react-native": "0.72.
|
|
30
|
+
"react-native": "0.72.14",
|
|
31
31
|
"react-native-action-sheet": "2.2.0",
|
|
32
32
|
"react-native-animatable": "1.3.3",
|
|
33
33
|
"react-native-branch": "5.4.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleeperhq/mini-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "Core library frameworks for developing Sleeper Mini Apps.",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"react": "18.2.0",
|
|
58
|
-
"react-native": "0.72.
|
|
58
|
+
"react-native": "0.72.14",
|
|
59
59
|
"react-native-svg": "13.7.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@babel/preset-typescript": "7.21.4",
|
|
64
64
|
"@react-native-community/eslint-config": "^2.0.0",
|
|
65
65
|
"@types/react": "18.2.31",
|
|
66
|
-
"@types/react-native": "0.72.
|
|
66
|
+
"@types/react-native": "0.72.8",
|
|
67
67
|
"@typescript-eslint/eslint-plugin": "^5.31.0",
|
|
68
68
|
"@typescript-eslint/parser": "^5.31.0",
|
|
69
69
|
"babel-jest": "^26.6.3",
|
package/src/dev_server/index.tsx
CHANGED
|
@@ -202,26 +202,10 @@ const DevServer = props => {
|
|
|
202
202
|
localAddress: ipAddress,
|
|
203
203
|
reuseAddress: true,
|
|
204
204
|
}, () => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
_entitlements: config.entitlements,
|
|
210
|
-
_headerOptions: config.headerOptions,
|
|
211
|
-
};
|
|
212
|
-
const json = JSON.stringify(message);
|
|
213
|
-
console.log('[Sleeper] Send IP address: ', ipAddress, config.name);
|
|
214
|
-
try {
|
|
215
|
-
connection.current?.write(json + '\n', "utf8", (error) => {
|
|
216
|
-
if (error) {
|
|
217
|
-
return stopSocket();
|
|
218
|
-
}
|
|
219
|
-
console.log('[Sleeper] Connected to the Sleeper App.');
|
|
220
|
-
_onConnected(true);
|
|
221
|
-
});
|
|
222
|
-
} catch (e) {
|
|
223
|
-
return stopSocket();
|
|
224
|
-
}
|
|
205
|
+
console.log('[Sleeper] Connected to the Sleeper App.');
|
|
206
|
+
// When we establish a connection, request context
|
|
207
|
+
sendContextRequest(connection.current, "");
|
|
208
|
+
_onConnected(true);
|
|
225
209
|
});
|
|
226
210
|
|
|
227
211
|
connection.current.on('data', (data, ...args) => {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Socket } from 'net';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
const appJsonFilename = 'app.json';
|
|
5
|
+
const packagerConnectPort = 9092;
|
|
6
|
+
|
|
7
|
+
const packagerConnect = async (rootPath) => {
|
|
8
|
+
const appJsonPath = path.join(rootPath, appJsonFilename);
|
|
9
|
+
// const appConfig = await import(appJsonPath);
|
|
10
|
+
const { default: appConfig } = await import(appJsonPath, { assert: { type: "json" } });
|
|
11
|
+
|
|
12
|
+
if (!appConfig.remoteIP) {
|
|
13
|
+
throw new Error(appJsonFilename + ' is missing remoteIP field');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const client = new Socket();
|
|
17
|
+
client.connect(packagerConnectPort, appConfig.remoteIP, () => {
|
|
18
|
+
console.log('Connected to Sleeper App at ', appConfig.remoteIP);
|
|
19
|
+
|
|
20
|
+
client.setEncoding('utf8');
|
|
21
|
+
const json = JSON.stringify({
|
|
22
|
+
_webpack: 'packager_connect',
|
|
23
|
+
_name: appConfig.name ?? '',
|
|
24
|
+
_entitlements: appConfig.entitlements,
|
|
25
|
+
_headerOptions: appConfig.headerOptions,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
client.write(json, (err) => {
|
|
29
|
+
if (err) {
|
|
30
|
+
console.log('Error sending message to Sleeper App:', err);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
client.on('error', () => {
|
|
35
|
+
client.destroy();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return () => {
|
|
40
|
+
client.destroy();
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export default packagerConnect;
|
package/src/styles/theme.ts
CHANGED
|
@@ -11,11 +11,11 @@ const Theme = {
|
|
|
11
11
|
secondaryText: '#a3bbd3', // gray300
|
|
12
12
|
|
|
13
13
|
gray100: '#eef2f7',
|
|
14
|
-
gray200: '#
|
|
15
|
-
gray300: '#
|
|
16
|
-
gray400: '#
|
|
17
|
-
gray500: '#
|
|
18
|
-
gray600: '#
|
|
14
|
+
gray200: '#D8DEED',
|
|
15
|
+
gray300: '#A3B1D3',
|
|
16
|
+
gray400: '#60648C',
|
|
17
|
+
gray500: '#414566',
|
|
18
|
+
gray600: '#343855',
|
|
19
19
|
|
|
20
20
|
aqua: '#00baff',
|
|
21
21
|
blue: '#046ae0',
|