@deliverart/sdk-js-integration 2.25.1 → 2.26.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/README.md +250 -56
- package/dist/index.cjs +2829 -1632
- package/dist/index.d.cts +30106 -2187
- package/dist/index.d.ts +30106 -2187
- package/dist/index.js +2770 -1558
- package/package.json +16 -12
package/README.md
CHANGED
|
@@ -11,12 +11,14 @@ npm install @deliverart/sdk-js-integration @deliverart/sdk-js-core
|
|
|
11
11
|
## Exported Types
|
|
12
12
|
|
|
13
13
|
### Core Types
|
|
14
|
+
|
|
14
15
|
- `Integration` - Integration configuration
|
|
15
16
|
- `ActivatableIntegration` - Integration that can be activated/deactivated
|
|
16
17
|
- `IntegrationActivationRequest` - Request to activate an integration
|
|
17
18
|
- `IntegrationCancellationRequest` - Request to cancel an integration
|
|
18
19
|
|
|
19
20
|
### Integration Types
|
|
21
|
+
|
|
20
22
|
Integration types vary by service (delivery partners, payment gateways, etc.)
|
|
21
23
|
|
|
22
24
|
The ecommerce info payload exposes the cached menu DTO. Item entries include
|
|
@@ -27,6 +29,7 @@ and `pointOfSale`, so storefronts can format menu prices, totals, payment
|
|
|
27
29
|
summaries, and order history without assuming EUR.
|
|
28
30
|
|
|
29
31
|
### IRI Types
|
|
32
|
+
|
|
30
33
|
- `IntegrationIri` - Integration IRI (`/integrations/:id`)
|
|
31
34
|
- `ActivationRequestIri` - Activation request IRI
|
|
32
35
|
- `CancellationRequestIri` - Cancellation request IRI
|
|
@@ -34,60 +37,70 @@ summaries, and order history without assuming EUR.
|
|
|
34
37
|
## Available Requests
|
|
35
38
|
|
|
36
39
|
### GetIntegrations
|
|
40
|
+
|
|
37
41
|
Get list of available integrations.
|
|
38
42
|
|
|
39
43
|
```typescript
|
|
40
|
-
import { GetIntegrations } from '@deliverart/sdk-js-integration'
|
|
41
|
-
|
|
42
|
-
const integrations = await sdk.call(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
44
|
+
import { GetIntegrations } from '@deliverart/sdk-js-integration'
|
|
45
|
+
|
|
46
|
+
const integrations = await sdk.call(
|
|
47
|
+
new GetIntegrations({
|
|
48
|
+
query: {
|
|
49
|
+
company: '/companies/123',
|
|
50
|
+
type: 'DELIVERY',
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
48
54
|
```
|
|
49
55
|
|
|
50
56
|
---
|
|
51
57
|
|
|
52
58
|
### GetIntegrationDetails
|
|
59
|
+
|
|
53
60
|
Get detailed information about an integration.
|
|
54
61
|
|
|
55
62
|
```typescript
|
|
56
|
-
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration'
|
|
63
|
+
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration'
|
|
57
64
|
|
|
58
|
-
const integration = await sdk.call(new GetIntegrationDetails('integration-123'))
|
|
65
|
+
const integration = await sdk.call(new GetIntegrationDetails('integration-123'))
|
|
59
66
|
```
|
|
60
67
|
|
|
61
68
|
---
|
|
62
69
|
|
|
63
70
|
### ActivateIntegration
|
|
71
|
+
|
|
64
72
|
Request activation of an integration.
|
|
65
73
|
|
|
66
74
|
```typescript
|
|
67
|
-
import { ActivateIntegration } from '@deliverart/sdk-js-integration'
|
|
68
|
-
|
|
69
|
-
const activation = await sdk.call(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
75
|
+
import { ActivateIntegration } from '@deliverart/sdk-js-integration'
|
|
76
|
+
|
|
77
|
+
const activation = await sdk.call(
|
|
78
|
+
new ActivateIntegration({
|
|
79
|
+
integration: '/integrations/123',
|
|
80
|
+
pointOfSale: '/point_of_sales/456',
|
|
81
|
+
config: {
|
|
82
|
+
apiKey: 'your-api-key',
|
|
83
|
+
// ... integration-specific config
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
)
|
|
77
87
|
```
|
|
78
88
|
|
|
79
89
|
---
|
|
80
90
|
|
|
81
91
|
### CancelIntegration
|
|
92
|
+
|
|
82
93
|
Request cancellation of an active integration.
|
|
83
94
|
|
|
84
95
|
```typescript
|
|
85
|
-
import { CancelIntegration } from '@deliverart/sdk-js-integration'
|
|
86
|
-
|
|
87
|
-
const cancellation = await sdk.call(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
import { CancelIntegration } from '@deliverart/sdk-js-integration'
|
|
97
|
+
|
|
98
|
+
const cancellation = await sdk.call(
|
|
99
|
+
new CancelIntegration({
|
|
100
|
+
integration: '/integrations/123',
|
|
101
|
+
reason: 'No longer needed',
|
|
102
|
+
}),
|
|
103
|
+
)
|
|
91
104
|
```
|
|
92
105
|
|
|
93
106
|
---
|
|
@@ -100,55 +113,236 @@ Deliveroo integrations expose `manualActivationCompleted` and `manualActivationC
|
|
|
100
113
|
import {
|
|
101
114
|
GetIntegrationDeliverooList,
|
|
102
115
|
UpdateIntegrationDeliveroo,
|
|
103
|
-
} from '@deliverart/sdk-js-integration'
|
|
116
|
+
} from '@deliverart/sdk-js-integration'
|
|
104
117
|
|
|
105
|
-
const pending = await sdk.call(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
118
|
+
const pending = await sdk.call(
|
|
119
|
+
new GetIntegrationDeliverooList({
|
|
120
|
+
query: {
|
|
121
|
+
manualActivationCompleted: false,
|
|
122
|
+
},
|
|
123
|
+
}),
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
await sdk.call(
|
|
127
|
+
new UpdateIntegrationDeliveroo('deliveroo-integration-id', {
|
|
128
|
+
manualActivationCompleted: true,
|
|
129
|
+
}),
|
|
130
|
+
)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### Elephant Integrations
|
|
110
136
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
Elephant uses one integration per point of sale and one or more nested Restaurant
|
|
138
|
+
memberships. Create the integration first, then provision each Restaurant with its
|
|
139
|
+
Deliverart optional sales mode, required fallback category, catalog channels, order
|
|
140
|
+
type, preparation time, and acceptance timeout. Set `salesMode` to `null` to use base
|
|
141
|
+
catalog prices.
|
|
142
|
+
|
|
143
|
+
The activation-request and lead contracts accept `service: 'elephant'` with the same
|
|
144
|
+
`integrationElephantDataSchema` payload. This includes create, detail, update/response,
|
|
145
|
+
lead conversion, and all response schemas used by HUB and Admin.
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import {
|
|
149
|
+
CreateIntegrationElephantRestaurantMapping,
|
|
150
|
+
CreateIntegrationElephant,
|
|
151
|
+
CreateIntegrationElephantRestaurant,
|
|
152
|
+
GetIntegrationElephantCatalogImportProcessDetails,
|
|
153
|
+
GetIntegrationElephantCatalogImportProcesses,
|
|
154
|
+
GetIntegrationElephantOrderReleases,
|
|
155
|
+
GetIntegrationElephantRestaurantCatalogProducts,
|
|
156
|
+
GetIntegrationElephantRestaurantMappings,
|
|
157
|
+
GetIntegrationElephantRestaurants,
|
|
158
|
+
GetIntegrationRequestLogs,
|
|
159
|
+
RefreshIntegrationElephantRestaurantCatalog,
|
|
160
|
+
RetryIntegrationElephantProvisioning,
|
|
161
|
+
StartIntegrationElephantCatalogImport,
|
|
162
|
+
UpdateIntegrationElephant,
|
|
163
|
+
UpdateIntegrationElephantRestaurant,
|
|
164
|
+
} from '@deliverart/sdk-js-integration'
|
|
165
|
+
|
|
166
|
+
const integration = await sdk.call(
|
|
167
|
+
new CreateIntegrationElephant({
|
|
168
|
+
pointOfSale: '/point_of_sales/8a745a0b-a68b-4f98-87ca-74df04a3bfe3',
|
|
169
|
+
credentialMode: 'managed',
|
|
170
|
+
}),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
const restaurant = await sdk.call(
|
|
174
|
+
new CreateIntegrationElephantRestaurant(integration.id, {
|
|
175
|
+
name: 'Restaurant Centre',
|
|
176
|
+
platform: 'migros_yemek',
|
|
177
|
+
platformRestaurantId: 'restaurant-123',
|
|
178
|
+
platformChainId: 'group-456',
|
|
179
|
+
authentication: {
|
|
180
|
+
secret_key: '12345678901234567890123456789012',
|
|
181
|
+
x_api_key: 'write-only-platform-key',
|
|
182
|
+
store_id: 'restaurant-123',
|
|
183
|
+
store_group_id: 'group-456',
|
|
184
|
+
},
|
|
185
|
+
salesMode: null,
|
|
186
|
+
category: '/menu_item_categories/20c71a6a-c924-42e0-9078-e3f672704dbb',
|
|
187
|
+
defaultTaxRate: 10,
|
|
188
|
+
channels: ['application', 'elephant'],
|
|
189
|
+
orderType: 'delivery',
|
|
190
|
+
defaultPreparationTime: 15,
|
|
191
|
+
acceptanceTimeout: 5,
|
|
192
|
+
}),
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
await sdk.call(
|
|
196
|
+
new UpdateIntegrationElephant(integration.id, {
|
|
197
|
+
defaultRestaurantMembership: `/integrations/elephant/${integration.id}/restaurants/${restaurant.id}`,
|
|
198
|
+
}),
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
await sdk.call(
|
|
202
|
+
new UpdateIntegrationElephantRestaurant(integration.id, restaurant.id, {
|
|
203
|
+
acceptanceTimeout: 10,
|
|
204
|
+
}),
|
|
205
|
+
)
|
|
206
|
+
|
|
207
|
+
const staleRestaurants = await sdk.call(
|
|
208
|
+
new GetIntegrationElephantRestaurants(integration.id, {
|
|
209
|
+
query: {
|
|
210
|
+
catalogStatus: 'stale',
|
|
211
|
+
status: ['active', 'paused'],
|
|
212
|
+
'order[name]': 'asc',
|
|
213
|
+
},
|
|
214
|
+
}),
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
await sdk.call(new RetryIntegrationElephantProvisioning(integration.id))
|
|
218
|
+
await sdk.call(new RefreshIntegrationElephantRestaurantCatalog(integration.id, restaurant.id))
|
|
219
|
+
|
|
220
|
+
const catalogImport = await sdk.call(
|
|
221
|
+
new StartIntegrationElephantCatalogImport(integration.id, restaurant.id),
|
|
222
|
+
)
|
|
223
|
+
const catalogImportDetails = await sdk.call(
|
|
224
|
+
new GetIntegrationElephantCatalogImportProcessDetails(
|
|
225
|
+
integration.id,
|
|
226
|
+
restaurant.id,
|
|
227
|
+
catalogImport.id,
|
|
228
|
+
),
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
const platformProducts = await sdk.call(
|
|
232
|
+
new GetIntegrationElephantRestaurantCatalogProducts(integration.id, restaurant.id, {
|
|
233
|
+
query: { q: 'pizza', page: 1 },
|
|
234
|
+
}),
|
|
235
|
+
)
|
|
236
|
+
const mappings = await sdk.call(
|
|
237
|
+
new GetIntegrationElephantRestaurantMappings(integration.id, restaurant.id, {
|
|
238
|
+
query: { role: 'product', page: 1 },
|
|
239
|
+
}),
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
await sdk.call(
|
|
243
|
+
new CreateIntegrationElephantRestaurantMapping(integration.id, restaurant.id, {
|
|
244
|
+
role: 'product',
|
|
245
|
+
platformReference: platformProducts.data[0].platformReference!,
|
|
246
|
+
platformGroupReference: null,
|
|
247
|
+
appMenuItemId: 'deliverart-menu-item-id',
|
|
248
|
+
appModifierId: null,
|
|
249
|
+
appVariantId: null,
|
|
250
|
+
appSalesModeId: null,
|
|
251
|
+
}),
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
const releases = await sdk.call(
|
|
255
|
+
new GetIntegrationElephantOrderReleases(integration.id, {
|
|
256
|
+
query: { status: ['preparing', 'failed'], page: 1 },
|
|
257
|
+
}),
|
|
258
|
+
)
|
|
259
|
+
const requestLogs = await sdk.call(
|
|
260
|
+
new GetIntegrationRequestLogs(integration.id, {
|
|
261
|
+
query: { outcome: 'server_error', page: 1 },
|
|
262
|
+
}),
|
|
263
|
+
)
|
|
114
264
|
```
|
|
115
265
|
|
|
266
|
+
Use `credentialMode: 'provided'` only when attaching an existing Elephant Tenant and
|
|
267
|
+
App; `tenantId`, `appId`, and `personalAccessToken` are then all required. Restaurant
|
|
268
|
+
authentication is write-only. Deleting a Restaurant membership starts its asynchronous
|
|
269
|
+
`removing` lifecycle; the Elephant integration itself does not expose a direct DELETE
|
|
270
|
+
operation.
|
|
271
|
+
|
|
272
|
+
The following request classes cover the current API surface:
|
|
273
|
+
|
|
274
|
+
- `GetIntegrationElephantList`, `GetIntegrationElephantDetails`
|
|
275
|
+
- `CreateIntegrationElephant`, `UpdateIntegrationElephant`
|
|
276
|
+
- `GetIntegrationElephantRestaurants`, `GetIntegrationElephantRestaurantDetails`
|
|
277
|
+
- `CreateIntegrationElephantRestaurant`, `UpdateIntegrationElephantRestaurant`
|
|
278
|
+
- `DeleteIntegrationElephantRestaurant`
|
|
279
|
+
- `RetryIntegrationElephantProvisioning`, `TestIntegrationElephantConnection`,
|
|
280
|
+
`ReconcileIntegrationElephant`
|
|
281
|
+
- `RetryIntegrationElephantRestaurantProvisioning`,
|
|
282
|
+
`TestIntegrationElephantRestaurantConnection`,
|
|
283
|
+
`RefreshIntegrationElephantRestaurantCatalog`,
|
|
284
|
+
`PauseIntegrationElephantRestaurant`, `ResumeIntegrationElephantRestaurant`
|
|
285
|
+
- `GetIntegrationElephantRestaurantCatalogProducts`,
|
|
286
|
+
`GetIntegrationElephantRestaurantCatalogOptions`,
|
|
287
|
+
`GetIntegrationElephantRestaurantCatalogVariants`,
|
|
288
|
+
`GetIntegrationElephantRestaurantAppCatalogMirror`
|
|
289
|
+
- `GetIntegrationElephantRestaurantMappings`,
|
|
290
|
+
`CreateIntegrationElephantRestaurantMapping`,
|
|
291
|
+
`DeleteIntegrationElephantRestaurantMapping`
|
|
292
|
+
- `GetIntegrationElephantCatalogImportProcesses`,
|
|
293
|
+
`StartIntegrationElephantCatalogImport`,
|
|
294
|
+
`GetIntegrationElephantCatalogImportProcessDetails`
|
|
295
|
+
- `GetIntegrationElephantOrderReleases`, `GetIntegrationElephantOrderReleaseDetails`
|
|
296
|
+
- `GetIntegrationRequestLogs`, `GetIntegrationRequestLogDetails`
|
|
297
|
+
|
|
298
|
+
Restaurant, catalog, mapping, order-release, and request-log collections are paginated.
|
|
299
|
+
Catalog-import history is intentionally unpaginated and supports status, step, date, and
|
|
300
|
+
ordering filters; only one pending or running import is allowed per Restaurant membership.
|
|
301
|
+
Use their exported query types rather than constructing query strings manually. Request logs
|
|
302
|
+
are the API's sanitized diagnostics model: tokens and payload bodies are deliberately absent.
|
|
303
|
+
|
|
116
304
|
---
|
|
117
305
|
|
|
118
306
|
## Complete Usage Example
|
|
119
307
|
|
|
120
308
|
```typescript
|
|
121
|
-
import { sdk } from './lib/sdk'
|
|
309
|
+
import { sdk } from './lib/sdk'
|
|
122
310
|
import {
|
|
123
311
|
GetIntegrations,
|
|
124
312
|
ActivateIntegration,
|
|
125
|
-
CancelIntegration
|
|
126
|
-
} from '@deliverart/sdk-js-integration'
|
|
313
|
+
CancelIntegration,
|
|
314
|
+
} from '@deliverart/sdk-js-integration'
|
|
127
315
|
|
|
128
316
|
async function integrationManagement() {
|
|
129
317
|
// Get available delivery integrations
|
|
130
|
-
const integrations = await sdk.call(
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
318
|
+
const integrations = await sdk.call(
|
|
319
|
+
new GetIntegrations({
|
|
320
|
+
query: {
|
|
321
|
+
type: 'DELIVERY',
|
|
322
|
+
company: '/companies/123',
|
|
323
|
+
},
|
|
324
|
+
}),
|
|
325
|
+
)
|
|
136
326
|
|
|
137
327
|
// Activate delivery partner
|
|
138
|
-
const activation = await sdk.call(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
328
|
+
const activation = await sdk.call(
|
|
329
|
+
new ActivateIntegration({
|
|
330
|
+
integration: integrations.data[0]['@id'],
|
|
331
|
+
pointOfSale: '/point_of_sales/456',
|
|
332
|
+
config: {
|
|
333
|
+
apiKey: process.env.DELIVERY_API_KEY,
|
|
334
|
+
webhookUrl: 'https://myapp.com/webhooks/delivery',
|
|
335
|
+
},
|
|
336
|
+
}),
|
|
337
|
+
)
|
|
146
338
|
|
|
147
339
|
// Cancel integration
|
|
148
|
-
await sdk.call(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
340
|
+
await sdk.call(
|
|
341
|
+
new CancelIntegration({
|
|
342
|
+
integration: activation.integration,
|
|
343
|
+
reason: 'Switching to different provider',
|
|
344
|
+
}),
|
|
345
|
+
)
|
|
152
346
|
}
|
|
153
347
|
```
|
|
154
348
|
|