@jtl-software/cloud-apps-core 0.17.1 → 0.18.0-beta
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/README.md +12 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#  JTL-Platform
|
|
1
|
+
#  JTL-Platform Apps Core SDK
|
|
2
2
|
|
|
3
3
|
A lightweight, type-safe communication bridge for JTL Platform apps.
|
|
4
4
|
|
|
@@ -16,7 +16,7 @@ yarn add @jtl-software/cloud-apps-core
|
|
|
16
16
|
|
|
17
17
|
## 🔍 Overview
|
|
18
18
|
|
|
19
|
-
The JTL Platform
|
|
19
|
+
The JTL Platform Apps Core SDK provides a robust communication bridge between apps and the JTL Platform host application. It enables:
|
|
20
20
|
|
|
21
21
|
- Bidirectional method calling between apps and host
|
|
22
22
|
- Event-based publish/subscribe communication
|
|
@@ -27,25 +27,25 @@ This package is the foundation for building apps that integrate seamlessly with
|
|
|
27
27
|
|
|
28
28
|
## 🚀 Usage
|
|
29
29
|
|
|
30
|
-
### Creating a
|
|
30
|
+
### Creating a App Bridge
|
|
31
31
|
|
|
32
|
-
To use the
|
|
32
|
+
To use the AppBridge in your React components, you'll need to initialize it and maintain its instance in your component's state. Typically, this is done within a useEffect hook:
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
import {
|
|
35
|
+
import { createAppBridge, AppBridge } from '@jtl-software/cloud-apps-core';
|
|
36
36
|
import { useState, useEffect } from 'react';
|
|
37
37
|
|
|
38
|
-
function
|
|
39
|
-
// Store the
|
|
40
|
-
const [appBridge,
|
|
38
|
+
function YourAppComponent() {
|
|
39
|
+
// Store the AppBridge instance in component state
|
|
40
|
+
const [appBridge, setAppBridge] = useState<AppBridge | undefined>(undefined);
|
|
41
41
|
|
|
42
42
|
useEffect((): void => {
|
|
43
43
|
console.info('Creating bridge...');
|
|
44
|
-
|
|
44
|
+
createAppBridge().then(bridge => {
|
|
45
45
|
console.log('Bridge created!');
|
|
46
46
|
|
|
47
47
|
// Store the bridge instance in state for use throughout your component
|
|
48
|
-
|
|
48
|
+
setAppBridge(bridge);
|
|
49
49
|
});
|
|
50
50
|
}, []);
|
|
51
51
|
|
|
@@ -113,7 +113,7 @@ const orderDetails = await appBridge.callMethod('getOrderDetails', 'ORD-5678');
|
|
|
113
113
|
|
|
114
114
|
## 📚 API Reference
|
|
115
115
|
|
|
116
|
-
###
|
|
116
|
+
### AppBridge
|
|
117
117
|
|
|
118
118
|
The main class that handles communication between the app and host, it provides the following methods.
|
|
119
119
|
|
|
@@ -188,7 +188,7 @@ Calls a method provided by the host environment and returns the result.
|
|
|
188
188
|
|
|
189
189
|
### Factories
|
|
190
190
|
|
|
191
|
-
- `
|
|
191
|
+
- `createAppBridge()`: Creates and initializes a AppBridge instance
|
|
192
192
|
|
|
193
193
|
## 📦 Dependencies
|
|
194
194
|
|