@deliverart/sdk-js-integration 0.0.0-dev-20260721002647

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 ADDED
@@ -0,0 +1,282 @@
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
+ The ecommerce info payload exposes the cached menu DTO. Item entries include
23
+ `compositions`, the ids of removable base ingredients/components to send as
24
+ writable order item `removals`.
25
+ It also exposes the POS `currency` on both the top-level ecommerce info payload
26
+ and `pointOfSale`, so storefronts can format menu prices, totals, payment
27
+ summaries, and order history without assuming EUR.
28
+
29
+ ### IRI Types
30
+ - `IntegrationIri` - Integration IRI (`/integrations/:id`)
31
+ - `ActivationRequestIri` - Activation request IRI
32
+ - `CancellationRequestIri` - Cancellation request IRI
33
+
34
+ ## Available Requests
35
+
36
+ ### GetIntegrations
37
+ Get list of available integrations.
38
+
39
+ ```typescript
40
+ import { GetIntegrations } from '@deliverart/sdk-js-integration';
41
+
42
+ const integrations = await sdk.call(new GetIntegrations({
43
+ query: {
44
+ company: '/companies/123',
45
+ type: 'DELIVERY'
46
+ }
47
+ }));
48
+ ```
49
+
50
+ ---
51
+
52
+ ### GetIntegrationDetails
53
+ Get detailed information about an integration.
54
+
55
+ ```typescript
56
+ import { GetIntegrationDetails } from '@deliverart/sdk-js-integration';
57
+
58
+ const integration = await sdk.call(new GetIntegrationDetails('integration-123'));
59
+ ```
60
+
61
+ ---
62
+
63
+ ### ActivateIntegration
64
+ Request activation of an integration.
65
+
66
+ ```typescript
67
+ import { ActivateIntegration } from '@deliverart/sdk-js-integration';
68
+
69
+ const activation = await sdk.call(new ActivateIntegration({
70
+ integration: '/integrations/123',
71
+ pointOfSale: '/point_of_sales/456',
72
+ config: {
73
+ apiKey: 'your-api-key',
74
+ // ... integration-specific config
75
+ }
76
+ }));
77
+ ```
78
+
79
+ ---
80
+
81
+ ### CancelIntegration
82
+ Request cancellation of an active integration.
83
+
84
+ ```typescript
85
+ import { CancelIntegration } from '@deliverart/sdk-js-integration';
86
+
87
+ const cancellation = await sdk.call(new CancelIntegration({
88
+ integration: '/integrations/123',
89
+ reason: 'No longer needed'
90
+ }));
91
+ ```
92
+
93
+ ---
94
+
95
+ ### Deliveroo Manual Portal Activation
96
+
97
+ Deliveroo integrations expose `manualActivationCompleted` and `manualActivationCompletedAt` so operator tools can track whether the final manual activation step has been completed in the Deliveroo portal.
98
+
99
+ ```typescript
100
+ import {
101
+ GetIntegrationDeliverooList,
102
+ UpdateIntegrationDeliveroo,
103
+ } from '@deliverart/sdk-js-integration';
104
+
105
+ const pending = await sdk.call(new GetIntegrationDeliverooList({
106
+ query: {
107
+ manualActivationCompleted: false,
108
+ },
109
+ }));
110
+
111
+ await sdk.call(new UpdateIntegrationDeliveroo('deliveroo-integration-id', {
112
+ manualActivationCompleted: true,
113
+ }));
114
+ ```
115
+
116
+ ---
117
+
118
+ ### Elephant Integrations
119
+
120
+ Elephant uses one integration per point of sale and one or more nested Restaurant
121
+ memberships. Create the integration first, then provision each Restaurant with its
122
+ Deliverart sales mode, fallback category, catalog channels, order type, preparation
123
+ time, and acceptance timeout.
124
+
125
+ ```typescript
126
+ import {
127
+ CreateIntegrationElephantRestaurantMapping,
128
+ CreateIntegrationElephant,
129
+ CreateIntegrationElephantRestaurant,
130
+ GetIntegrationElephantOrderReleases,
131
+ GetIntegrationElephantRestaurantCatalogProducts,
132
+ GetIntegrationElephantRestaurantMappings,
133
+ GetIntegrationElephantRestaurants,
134
+ GetIntegrationRequestLogs,
135
+ RefreshIntegrationElephantRestaurantCatalog,
136
+ RetryIntegrationElephantProvisioning,
137
+ UpdateIntegrationElephant,
138
+ UpdateIntegrationElephantRestaurant,
139
+ } from '@deliverart/sdk-js-integration';
140
+
141
+ const integration = await sdk.call(new CreateIntegrationElephant({
142
+ pointOfSale: '/point_of_sales/8a745a0b-a68b-4f98-87ca-74df04a3bfe3',
143
+ credentialMode: 'managed',
144
+ }));
145
+
146
+ const restaurant = await sdk.call(new CreateIntegrationElephantRestaurant(integration.id, {
147
+ name: 'Restaurant Centre',
148
+ platform: 'yengec',
149
+ platformRestaurantId: 'restaurant-123',
150
+ authentication: { apiKey: 'write-only-platform-key' },
151
+ salesMode: '/sales_modes/a1538842-0931-4e23-8aaf-5bda59198581',
152
+ category: '/menu_item_categories/20c71a6a-c924-42e0-9078-e3f672704dbb',
153
+ defaultTaxRate: 10,
154
+ channels: ['application', 'elephant'],
155
+ orderType: 'delivery',
156
+ defaultPreparationTime: 15,
157
+ acceptanceTimeout: 5,
158
+ }));
159
+
160
+ await sdk.call(new UpdateIntegrationElephant(integration.id, {
161
+ defaultRestaurantMembership: `/integrations/elephant/${integration.id}/restaurants/${restaurant.id}`,
162
+ }));
163
+
164
+ await sdk.call(new UpdateIntegrationElephantRestaurant(integration.id, restaurant.id, {
165
+ acceptanceTimeout: 10,
166
+ }));
167
+
168
+ const staleRestaurants = await sdk.call(new GetIntegrationElephantRestaurants(integration.id, {
169
+ query: {
170
+ catalogStatus: 'stale',
171
+ status: ['active', 'paused'],
172
+ 'order[name]': 'asc',
173
+ },
174
+ }));
175
+
176
+ await sdk.call(new RetryIntegrationElephantProvisioning(integration.id));
177
+ await sdk.call(new RefreshIntegrationElephantRestaurantCatalog(integration.id, restaurant.id));
178
+
179
+ const platformProducts = await sdk.call(
180
+ new GetIntegrationElephantRestaurantCatalogProducts(integration.id, restaurant.id, {
181
+ query: { q: 'pizza', page: 1 },
182
+ }),
183
+ );
184
+ const mappings = await sdk.call(
185
+ new GetIntegrationElephantRestaurantMappings(integration.id, restaurant.id, {
186
+ query: { role: 'product', page: 1 },
187
+ }),
188
+ );
189
+
190
+ await sdk.call(new CreateIntegrationElephantRestaurantMapping(integration.id, restaurant.id, {
191
+ role: 'product',
192
+ platformReference: platformProducts.data[0].platformReference!,
193
+ platformGroupReference: null,
194
+ appMenuItemId: 'deliverart-menu-item-id',
195
+ appModifierId: null,
196
+ appVariantId: null,
197
+ appSalesModeId: null,
198
+ }));
199
+
200
+ const releases = await sdk.call(new GetIntegrationElephantOrderReleases(integration.id, {
201
+ query: { status: ['preparing', 'failed'], page: 1 },
202
+ }));
203
+ const requestLogs = await sdk.call(new GetIntegrationRequestLogs(integration.id, {
204
+ query: { outcome: 'server_error', page: 1 },
205
+ }));
206
+ ```
207
+
208
+ Use `credentialMode: 'provided'` only when attaching an existing Elephant Tenant and
209
+ App; `tenantId`, `appId`, and `personalAccessToken` are then all required. Restaurant
210
+ authentication is write-only. Deleting a Restaurant membership starts its asynchronous
211
+ `removing` lifecycle; the Elephant integration itself does not expose a direct DELETE
212
+ operation.
213
+
214
+ The following request classes cover the current API surface:
215
+
216
+ - `GetIntegrationElephantList`, `GetIntegrationElephantDetails`
217
+ - `CreateIntegrationElephant`, `UpdateIntegrationElephant`
218
+ - `GetIntegrationElephantRestaurants`, `GetIntegrationElephantRestaurantDetails`
219
+ - `CreateIntegrationElephantRestaurant`, `UpdateIntegrationElephantRestaurant`
220
+ - `DeleteIntegrationElephantRestaurant`
221
+ - `RetryIntegrationElephantProvisioning`, `TestIntegrationElephantConnection`,
222
+ `ReconcileIntegrationElephant`
223
+ - `RetryIntegrationElephantRestaurantProvisioning`,
224
+ `TestIntegrationElephantRestaurantConnection`,
225
+ `RefreshIntegrationElephantRestaurantCatalog`,
226
+ `PauseIntegrationElephantRestaurant`, `ResumeIntegrationElephantRestaurant`
227
+ - `GetIntegrationElephantRestaurantCatalogProducts`,
228
+ `GetIntegrationElephantRestaurantCatalogOptions`,
229
+ `GetIntegrationElephantRestaurantCatalogVariants`,
230
+ `GetIntegrationElephantRestaurantAppCatalogMirror`
231
+ - `GetIntegrationElephantRestaurantMappings`,
232
+ `CreateIntegrationElephantRestaurantMapping`,
233
+ `DeleteIntegrationElephantRestaurantMapping`
234
+ - `GetIntegrationElephantOrderReleases`, `GetIntegrationElephantOrderReleaseDetails`
235
+ - `GetIntegrationRequestLogs`, `GetIntegrationRequestLogDetails`
236
+
237
+ Catalog, mapping, Restaurant, order-release, and request-log collections are paginated.
238
+ Use their exported query types rather than constructing query strings manually. Request logs
239
+ are the API's sanitized diagnostics model: tokens and payload bodies are deliberately absent.
240
+
241
+ ---
242
+
243
+ ## Complete Usage Example
244
+
245
+ ```typescript
246
+ import { sdk } from './lib/sdk';
247
+ import {
248
+ GetIntegrations,
249
+ ActivateIntegration,
250
+ CancelIntegration
251
+ } from '@deliverart/sdk-js-integration';
252
+
253
+ async function integrationManagement() {
254
+ // Get available delivery integrations
255
+ const integrations = await sdk.call(new GetIntegrations({
256
+ query: {
257
+ type: 'DELIVERY',
258
+ company: '/companies/123'
259
+ }
260
+ }));
261
+
262
+ // Activate delivery partner
263
+ const activation = await sdk.call(new ActivateIntegration({
264
+ integration: integrations.data[0]['@id'],
265
+ pointOfSale: '/point_of_sales/456',
266
+ config: {
267
+ apiKey: process.env.DELIVERY_API_KEY,
268
+ webhookUrl: 'https://myapp.com/webhooks/delivery'
269
+ }
270
+ }));
271
+
272
+ // Cancel integration
273
+ await sdk.call(new CancelIntegration({
274
+ integration: activation.integration,
275
+ reason: 'Switching to different provider'
276
+ }));
277
+ }
278
+ ```
279
+
280
+ ## License
281
+
282
+ MIT