x-app-sdk 1.0.1 → 1.0.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 (2) hide show
  1. package/README.md +52 -38
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,50 +1,64 @@
1
- # React + TypeScript + Vite
1
+ # x-app-sdk
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ ## Giới thiệu
4
+ `x-app-sdk` là một thư viện hỗ trợ phát triển ứng dụng với các tính năng tương tác với `superapp` và các thành phần UI cơ bản.
4
5
 
5
- Currently, two official plugins are available:
6
+ ## Cài đặt
7
+ Bạn có thể cài đặt `x-app-sdk` bằng npm:
8
+ ```sh
9
+ npm install x-app-sdk
10
+ ```
11
+ Hoặc sử dụng yarn:
12
+ ```sh
13
+ yarn add x-app-sdk
14
+ ```
6
15
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
16
+ ## Các tính năng chính
17
+ ### 1. SDK tương tác với SuperApp
18
+ #### `requestInfo()`
19
+ Lấy thông tin từ `superapp`.
20
+ ```js
21
+ import { requestInfo } from 'x-app-sdk';
9
22
 
10
- ## Expanding the ESLint configuration
23
+ requestInfo().then(info => {
24
+ console.log('Thông tin ứng dụng:', info);
25
+ }).catch(error => {
26
+ console.error('Lỗi khi lấy thông tin:', error);
27
+ });
28
+ ```
11
29
 
12
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
30
+ #### `openPickerImage()`
31
+ Mở trình chọn ảnh từ `superapp`.
32
+ ```js
33
+ import { openPickerImage } from 'x-app-sdk';
13
34
 
14
- - Configure the top-level `parserOptions` property like this:
35
+ openPickerImage().then(imageData => {
36
+ console.log('Dữ liệu ảnh:', imageData);
37
+ }).catch(error => {
38
+ console.error('Lỗi khi mở trình chọn ảnh:', error);
39
+ });
40
+ ```
15
41
 
42
+ #### `closeApp()`
43
+ Đóng ứng dụng từ `superapp`.
16
44
  ```js
17
- export default tseslint.config({
18
- languageOptions: {
19
- // other options...
20
- parserOptions: {
21
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
22
- tsconfigRootDir: import.meta.dirname,
23
- },
24
- },
25
- })
26
- ```
45
+ import { closeApp } from 'x-app-sdk';
27
46
 
28
- - Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
29
- - Optionally add `...tseslint.configs.stylisticTypeChecked`
30
- - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
47
+ closeApp();
48
+ ```
31
49
 
50
+ ### 2. UI Components
51
+ #### `Button`
52
+ Component nút bấm đơn giản.
32
53
  ```js
33
- // eslint.config.js
34
- import react from 'eslint-plugin-react'
35
-
36
- export default tseslint.config({
37
- // Set the react version
38
- settings: { react: { version: '18.3' } },
39
- plugins: {
40
- // Add the react plugin
41
- react,
42
- },
43
- rules: {
44
- // other rules...
45
- // Enable its recommended rules
46
- ...react.configs.recommended.rules,
47
- ...react.configs['jsx-runtime'].rules,
48
- },
49
- })
54
+ import { Button } from 'x-app-sdk';
55
+
56
+ const App = () => (
57
+ <Button onPress={() => alert('Button clicked!')}>
58
+ Nhấn vào đây
59
+ </Button>
60
+ );
50
61
  ```
62
+
63
+ ## Kết luận
64
+ Thư viện `x-app-sdk` giúp bạn dễ dàng tương tác với `superapp` và cung cấp các thành phần UI cơ bản cho ứng dụng của bạn.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "x-app-sdk",
3
3
  "private": false,
4
- "version": "1.0.1",
4
+ "version": "1.0.2",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"