@moxtradeveloper/react-native-moxo-module 10.1.4 ā 10.11.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/LICENSE +1 -1
- package/README.md +10 -31
- package/android/build.gradle +3 -3
- package/package.json +15 -7
- package/react-native-moxo-module.podspec +5 -3
- package/scripts/bootstrap.js +29 -0
- package/scripts/download-mepsdk.js +120 -0
- package/ios/MoxoModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
+
Moxo is an AI workflow automation platform for business operations.
|
|
2
|
+
|
|
1
3
|

|
|
2
4
|
|
|
3
5
|
[ [Introduce](#introduce) • [Preparation](#preparation) • [Installation](#installation) • [Initialization](#initialization) • [Sample Code](#sample-code) • [API Doc](#api-doc)]
|
|
4
6
|
|
|
5
7
|
## Introduce
|
|
6
8
|
|
|
7
|
-
**react-native-moxo-module** is a [moxo sdk](https://www.moxo.com/platform/sdks) react-native wrapper. Provide Moxo
|
|
9
|
+
**react-native-moxo-module** is a [moxo sdk](https://www.moxo.com/platform/sdks) react-native wrapper. Provide Moxo capabilities to your mobile app built on [React Native](https://reactnative.dev/)
|
|
8
10
|
|
|
9
11
|
### Supported Platforms
|
|
10
12
|
|
|
11
|
-
* iOS
|
|
12
|
-
* Android
|
|
13
|
+
* iOS 15.0+
|
|
14
|
+
* Android 7+
|
|
13
15
|
|
|
14
16
|
## Preparation
|
|
15
17
|
|
|
16
18
|
Below sdk or tools are required before start to use react-native-moxo-module.
|
|
17
19
|
|
|
18
|
-
* Node.js
|
|
20
|
+
* Node.js v22 LTS and Later
|
|
19
21
|
* Watchman
|
|
20
22
|
|
|
21
23
|
### Android
|
|
22
24
|
|
|
23
25
|
* Android Studio
|
|
24
|
-
* Android SDK
|
|
26
|
+
* Android SDK API 24+ (Android 7.0)
|
|
25
27
|
|
|
26
28
|
### iOS
|
|
27
29
|
|
|
28
|
-
* Xcode
|
|
29
|
-
* Cocoapod v1.
|
|
30
|
+
* Xcode v26+
|
|
31
|
+
* Cocoapod v1.16.2+
|
|
30
32
|
|
|
31
33
|
For more react-native set up details, please ref to [react native official site](https://reactnative.dev/docs/environment-setup)
|
|
32
34
|
|
|
@@ -36,26 +38,6 @@ For more react-native set up details, please ref to [react native official site]
|
|
|
36
38
|
npm install @moxtradeveloper/react-native-moxo-module
|
|
37
39
|
```
|
|
38
40
|
|
|
39
|
-
### iOS Specific Steps
|
|
40
|
-
|
|
41
|
-
* Add moxo cocoapod repo as source into Podfile under your iOS project.
|
|
42
|
-
* Change pod deployment platform to iOS 13
|
|
43
|
-
|
|
44
|
-
Sample:
|
|
45
|
-
|
|
46
|
-
```ruby
|
|
47
|
-
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
48
|
-
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
|
49
|
-
#Add moxo source here
|
|
50
|
-
source 'https://maven.moxtra.com/repo/moxtra-specs.git'
|
|
51
|
-
|
|
52
|
-
#Change platform version if is not iOS 13
|
|
53
|
-
platform :ios, '13.0'
|
|
54
|
-
install! 'cocoapods', :deterministic_uuids => false
|
|
55
|
-
|
|
56
|
-
# Rest of the file.....
|
|
57
|
-
```
|
|
58
|
-
|
|
59
41
|
## Initialization
|
|
60
42
|
|
|
61
43
|
### Login
|
|
@@ -183,10 +165,8 @@ To do more, you can invoke function openChat(chat_id) to open target chat direct
|
|
|
183
165
|
}
|
|
184
166
|
},
|
|
185
167
|
"id": "359",
|
|
186
|
-
"moxtra": "",
|
|
187
168
|
"category": "message",
|
|
188
|
-
"board_id": "CBPErkesrtOeFfURA6gusJAD"
|
|
189
|
-
"moxtra": ""
|
|
169
|
+
"board_id": "CBPErkesrtOeFfURA6gusJAD"
|
|
190
170
|
}
|
|
191
171
|
```
|
|
192
172
|
|
|
@@ -203,7 +183,6 @@ To do more, you can invoke function openChat(chat_id) to open target chat direct
|
|
|
203
183
|
"feed_sequence": "3234",
|
|
204
184
|
"action_loc_key": "BCA",
|
|
205
185
|
"board_feed_unread_count": "3",
|
|
206
|
-
"moxtra": "",
|
|
207
186
|
"user_id": "CUxceIGfpXcHBna163lfFMD0",
|
|
208
187
|
"arg1": "rm1 Zhang",
|
|
209
188
|
"arg2": "1",
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ buildscript {
|
|
|
6
6
|
google()
|
|
7
7
|
mavenCentral()
|
|
8
8
|
maven() {
|
|
9
|
-
url "https://
|
|
9
|
+
url "https://mxrepo.moxo.com/repository/customer-maven-releases/"
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -23,7 +23,7 @@ rootProject.allprojects {
|
|
|
23
23
|
mavenCentral()
|
|
24
24
|
jcenter()
|
|
25
25
|
maven() {
|
|
26
|
-
url "https://
|
|
26
|
+
url "https://mxrepo.moxo.com/repository/customer-maven-releases/"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -156,7 +156,7 @@ dependencies {
|
|
|
156
156
|
//noinspection GradleDynamicVersion
|
|
157
157
|
implementation "com.facebook.react:react-native:+"
|
|
158
158
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
159
|
-
implementation "com.moxtra:mep-sdk:10.1
|
|
159
|
+
implementation "com.moxtra:mep-sdk:10.11.1"
|
|
160
160
|
// From node_modules
|
|
161
161
|
}
|
|
162
162
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxtradeveloper/react-native-moxo-module",
|
|
3
|
-
"version": "10.
|
|
4
|
-
"description": "Plugin for adding
|
|
3
|
+
"version": "10.11.2",
|
|
4
|
+
"description": "Plugin for adding Moxo services to React Native Apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
7
7
|
"types": "lib/typescript/index.d.ts",
|
|
@@ -13,9 +13,11 @@
|
|
|
13
13
|
"android",
|
|
14
14
|
"ios",
|
|
15
15
|
"cpp",
|
|
16
|
+
"scripts",
|
|
16
17
|
"*.podspec",
|
|
17
18
|
"!lib/typescript/example",
|
|
18
19
|
"!ios/build",
|
|
20
|
+
"!ios/Frameworks",
|
|
19
21
|
"!android/build",
|
|
20
22
|
"!android/gradle",
|
|
21
23
|
"!android/gradlew",
|
|
@@ -27,16 +29,16 @@
|
|
|
27
29
|
"!**/.*"
|
|
28
30
|
],
|
|
29
31
|
"scripts": {
|
|
32
|
+
"postinstall": "node scripts/download-mepsdk.js",
|
|
30
33
|
"test": "jest",
|
|
31
34
|
"typescript": "tsc --noEmit",
|
|
32
35
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
33
36
|
"example": "yarn --cwd example",
|
|
34
37
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
35
38
|
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
36
|
-
"doc":"typedoc ./src/index.tsx --skipErrorChecking"
|
|
39
|
+
"doc": "typedoc ./src/index.tsx --skipErrorChecking"
|
|
37
40
|
},
|
|
38
41
|
"keywords": [
|
|
39
|
-
"moxtra",
|
|
40
42
|
"moxo",
|
|
41
43
|
"mep",
|
|
42
44
|
"chat",
|
|
@@ -46,12 +48,12 @@
|
|
|
46
48
|
"ios",
|
|
47
49
|
"android"
|
|
48
50
|
],
|
|
49
|
-
"author": "
|
|
51
|
+
"author": "Moxo Inc.",
|
|
50
52
|
"license": "ISC",
|
|
51
53
|
"bugs": {
|
|
52
|
-
"url": "https://www.
|
|
54
|
+
"url": "https://www.moxo.com"
|
|
53
55
|
},
|
|
54
|
-
"homepage": "https://www.
|
|
56
|
+
"homepage": "https://www.moxo.com",
|
|
55
57
|
"publishConfig": {
|
|
56
58
|
"registry": "https://registry.npmjs.org/"
|
|
57
59
|
},
|
|
@@ -158,5 +160,11 @@
|
|
|
158
160
|
}
|
|
159
161
|
]
|
|
160
162
|
]
|
|
163
|
+
},
|
|
164
|
+
"moxoSdk": {
|
|
165
|
+
"ios": {
|
|
166
|
+
"version": "10.11.1",
|
|
167
|
+
"downloadUrl": "https://mxrepo.moxo.com/repository/customer-raw-releases/mepsdk/dynamic/Dynamic_MEPSDK_iOS_v${version}.zip"
|
|
168
|
+
}
|
|
161
169
|
}
|
|
162
170
|
}
|
|
@@ -11,13 +11,15 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios => "
|
|
15
|
-
s.source = { :git => "https://github.com/
|
|
14
|
+
s.platforms = { :ios => "15.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/Moxtra/react-native-moxo-module.git", :tag => "#{s.version}" }
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
17
|
s.public_header_files = 'ios/*.h'
|
|
18
18
|
s.swift_version = '5.0'
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
# MEPSDK is embedded directly - downloaded via npm postinstall
|
|
22
|
+
s.vendored_frameworks = 'ios/Frameworks/MEPSDK.xcframework'
|
|
21
23
|
|
|
22
24
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
25
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const child_process = require('child_process');
|
|
4
|
+
|
|
5
|
+
const root = path.resolve(__dirname, '..');
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const options = {
|
|
8
|
+
cwd: process.cwd(),
|
|
9
|
+
env: process.env,
|
|
10
|
+
stdio: 'inherit',
|
|
11
|
+
encoding: 'utf-8',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
if (os.type() === 'Windows_NT') {
|
|
15
|
+
options.shell = true;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let result;
|
|
19
|
+
|
|
20
|
+
if (process.cwd() !== root || args.length) {
|
|
21
|
+
// We're not in the root of the project, or additional arguments were passed
|
|
22
|
+
// In this case, forward the command to `yarn`
|
|
23
|
+
result = child_process.spawnSync('yarn', args, options);
|
|
24
|
+
} else {
|
|
25
|
+
// If `yarn` is run without arguments, perform bootstrap
|
|
26
|
+
result = child_process.spawnSync('yarn', ['bootstrap'], options);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
process.exitCode = result.status;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Downloads MEPSDK.xcframework from CDN
|
|
5
|
+
* This script runs automatically after npm install
|
|
6
|
+
*
|
|
7
|
+
* Configuration is read from package.json -> moxoSdk.ios
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const https = require('https');
|
|
11
|
+
const http = require('http');
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execSync } = require('child_process');
|
|
15
|
+
|
|
16
|
+
// Read configuration from package.json
|
|
17
|
+
const packageJson = require('../package.json');
|
|
18
|
+
const sdkConfig = packageJson.moxoSdk?.ios || {};
|
|
19
|
+
|
|
20
|
+
const MEPSDK_VERSION = sdkConfig.version || '10.6.1';
|
|
21
|
+
const MEPSDK_DOWNLOAD_URL = (sdkConfig.downloadUrl || '').replace(
|
|
22
|
+
'${version}',
|
|
23
|
+
MEPSDK_VERSION
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const FRAMEWORK_DIR = path.join(__dirname, '..', 'ios', 'Frameworks');
|
|
27
|
+
const FRAMEWORK_PATH = path.join(FRAMEWORK_DIR, 'MEPSDKDylib.xcframework');
|
|
28
|
+
const ZIP_PATH = path.join(FRAMEWORK_DIR, 'MEPSDKDylib.xcframework.zip');
|
|
29
|
+
|
|
30
|
+
function downloadFile(url, dest) {
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const protocol = url.startsWith('https') ? https : http;
|
|
33
|
+
const file = fs.createWriteStream(dest);
|
|
34
|
+
|
|
35
|
+
console.log(`Downloading from: ${url}`);
|
|
36
|
+
|
|
37
|
+
const request = protocol.get(url, (response) => {
|
|
38
|
+
// Handle redirects
|
|
39
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
40
|
+
file.close();
|
|
41
|
+
fs.unlinkSync(dest);
|
|
42
|
+
return downloadFile(response.headers.location, dest)
|
|
43
|
+
.then(resolve)
|
|
44
|
+
.catch(reject);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (response.statusCode !== 200) {
|
|
48
|
+
file.close();
|
|
49
|
+
fs.unlinkSync(dest);
|
|
50
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
response.pipe(file);
|
|
55
|
+
|
|
56
|
+
file.on('finish', () => {
|
|
57
|
+
file.close();
|
|
58
|
+
resolve();
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
request.on('error', (err) => {
|
|
63
|
+
fs.unlink(dest, () => {});
|
|
64
|
+
reject(err);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
file.on('error', (err) => {
|
|
68
|
+
fs.unlink(dest, () => {});
|
|
69
|
+
reject(err);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function main() {
|
|
75
|
+
// Validate configuration
|
|
76
|
+
if (!MEPSDK_DOWNLOAD_URL) {
|
|
77
|
+
console.error(
|
|
78
|
+
'ā Error: moxoSdk.ios.downloadUrl is not configured in package.json'
|
|
79
|
+
);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Skip if framework already exists
|
|
84
|
+
if (fs.existsSync(FRAMEWORK_PATH)) {
|
|
85
|
+
console.log('MEPSDKDylib.xcframework already exists, skipping download.');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
console.log(`\nš¦ Downloading MEPSDKDylib ${MEPSDK_VERSION}...\n`);
|
|
90
|
+
|
|
91
|
+
// Create Frameworks directory
|
|
92
|
+
if (!fs.existsSync(FRAMEWORK_DIR)) {
|
|
93
|
+
fs.mkdirSync(FRAMEWORK_DIR, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
try {
|
|
97
|
+
// Download the zip file
|
|
98
|
+
await downloadFile(MEPSDK_DOWNLOAD_URL, ZIP_PATH);
|
|
99
|
+
console.log('Download complete. Extracting...');
|
|
100
|
+
|
|
101
|
+
// Extract the zip file
|
|
102
|
+
execSync(`unzip -o "${ZIP_PATH}" -d "${FRAMEWORK_DIR}"`, {
|
|
103
|
+
stdio: 'inherit',
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Clean up zip file
|
|
107
|
+
fs.unlinkSync(ZIP_PATH);
|
|
108
|
+
|
|
109
|
+
console.log('\nā
MEPSDKDylib.xcframework installed successfully!\n');
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.error('\nā Failed to download MEPSDKDylib:', error.message);
|
|
112
|
+
console.error(
|
|
113
|
+
'\nPlease ensure the CDN URL is correct or manually download the framework.'
|
|
114
|
+
);
|
|
115
|
+
console.error(`Expected location: ${FRAMEWORK_PATH}\n`);
|
|
116
|
+
process.exit(1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
main();
|