@deliverart/sdk-js-integration 2.1.50 → 2.1.51
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 +128 -0
- package/package.json +6 -6
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# @deliverart/sdk-js-integration
|
|
2
|
+
|
|
3
|
+
Integration management package for the DeliverArt JavaScript SDK.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @deliverart/sdk-js-integration @deliverart/sdk-js-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exported Types
|
|
12
|
+
|
|
13
|
+
### Core Types
|
|
14
|
+
- `Integration` - Integration configuration
|
|
15
|
+
- `ActivatableIntegration` - Integration that can be activated/deactivated
|
|
16
|
+
- `IntegrationActivationRequest` - Request to activate an integration
|
|
17
|
+
- `IntegrationCancellationRequest` - Request to cancel an integration
|
|
18
|
+
|
|
19
|
+
### Integration Types
|
|
20
|
+
Integration types vary by service (delivery partners, payment gateways, etc.)
|
|
21
|
+
|
|
22
|
+
### IRI Types
|
|
23
|
+
- `IntegrationIri` - Integration IRI (`/integrations/:id`)
|
|
24
|
+
- `ActivationRequestIri` - Activation request IRI
|
|
25
|
+
- `CancellationRequestIri` - Cancellation request IRI
|
|
26
|
+
|
|
27
|
+
## Available Requests
|
|
28
|
+
|
|
29
|
+
### GetIntegrations
|
|
30
|
+
Get list of available integrations.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { GetIntegrations } from '@deliverart/sdk-js-integration';
|
|
34
|
+
|
|
35
|
+
const integrations = await sdk.call(new GetIntegrations({
|
|
36
|
+
query: {
|
|
37
|
+
company: '/companies/123',
|
|
38
|
+
type: 'DELIVERY'
|
|
39
|
+
}
|
|
40
|
+
}));
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### GetIntegrationDetails
|
|
46
|
+
Get detailed information about an integration.
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration';
|
|
50
|
+
|
|
51
|
+
const integration = await sdk.call(new GetIntegrationDetails('integration-123'));
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### ActivateIntegration
|
|
57
|
+
Request activation of an integration.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { ActivateIntegration } from '@deliverart/sdk-js-integration';
|
|
61
|
+
|
|
62
|
+
const activation = await sdk.call(new ActivateIntegration({
|
|
63
|
+
integration: '/integrations/123',
|
|
64
|
+
pointOfSale: '/point_of_sales/456',
|
|
65
|
+
config: {
|
|
66
|
+
apiKey: 'your-api-key',
|
|
67
|
+
// ... integration-specific config
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### CancelIntegration
|
|
75
|
+
Request cancellation of an active integration.
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { CancelIntegration } from '@deliverart/sdk-js-integration';
|
|
79
|
+
|
|
80
|
+
const cancellation = await sdk.call(new CancelIntegration({
|
|
81
|
+
integration: '/integrations/123',
|
|
82
|
+
reason: 'No longer needed'
|
|
83
|
+
}));
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Complete Usage Example
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
import { sdk } from './lib/sdk';
|
|
92
|
+
import {
|
|
93
|
+
GetIntegrations,
|
|
94
|
+
ActivateIntegration,
|
|
95
|
+
CancelIntegration
|
|
96
|
+
} from '@deliverart/sdk-js-integration';
|
|
97
|
+
|
|
98
|
+
async function integrationManagement() {
|
|
99
|
+
// Get available delivery integrations
|
|
100
|
+
const integrations = await sdk.call(new GetIntegrations({
|
|
101
|
+
query: {
|
|
102
|
+
type: 'DELIVERY',
|
|
103
|
+
company: '/companies/123'
|
|
104
|
+
}
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
// Activate delivery partner
|
|
108
|
+
const activation = await sdk.call(new ActivateIntegration({
|
|
109
|
+
integration: integrations.data[0]['@id'],
|
|
110
|
+
pointOfSale: '/point_of_sales/456',
|
|
111
|
+
config: {
|
|
112
|
+
apiKey: process.env.DELIVERY_API_KEY,
|
|
113
|
+
webhookUrl: 'https://myapp.com/webhooks/delivery'
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
// Cancel integration
|
|
118
|
+
await sdk.call(new CancelIntegration({
|
|
119
|
+
integration: activation.integration,
|
|
120
|
+
reason: 'Switching to different provider'
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
|
128
|
+
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deliverart/sdk-js-integration",
|
|
3
3
|
"description": "Deliverart JavaScript SDK for Integration Management",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.51",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"dist"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@deliverart/sdk-js-
|
|
22
|
-
"@deliverart/sdk-js-
|
|
23
|
-
"@deliverart/sdk-js-image": "2.1.
|
|
24
|
-
"@deliverart/sdk-js-
|
|
25
|
-
"@deliverart/sdk-js-
|
|
21
|
+
"@deliverart/sdk-js-core": "2.1.51",
|
|
22
|
+
"@deliverart/sdk-js-global-types": "2.1.51",
|
|
23
|
+
"@deliverart/sdk-js-image": "2.1.51",
|
|
24
|
+
"@deliverart/sdk-js-point-of-sale": "2.1.51",
|
|
25
|
+
"@deliverart/sdk-js-sales-mode": "2.1.51"
|
|
26
26
|
},
|
|
27
27
|
"publishConfig": {
|
|
28
28
|
"access": "public"
|