@deliverart/sdk-js-integration
v2.23.13
Published
Deliverart JavaScript SDK for Integration Management
Readme
@deliverart/sdk-js-integration
Integration management package for the DeliverArt JavaScript SDK.
Installation
npm install @deliverart/sdk-js-integration @deliverart/sdk-js-coreExported Types
Core Types
Integration- Integration configurationActivatableIntegration- Integration that can be activated/deactivatedIntegrationActivationRequest- Request to activate an integrationIntegrationCancellationRequest- Request to cancel an integration
Integration Types
Integration types vary by service (delivery partners, payment gateways, etc.)
The ecommerce info payload exposes the cached menu DTO. Item entries include
compositions, the ids of removable base ingredients/components to send as
writable order item removals.
IRI Types
IntegrationIri- Integration IRI (/integrations/:id)ActivationRequestIri- Activation request IRICancellationRequestIri- Cancellation request IRI
Available Requests
GetIntegrations
Get list of available integrations.
import { GetIntegrations } from '@deliverart/sdk-js-integration';
const integrations = await sdk.call(new GetIntegrations({
query: {
company: '/companies/123',
type: 'DELIVERY'
}
}));GetIntegrationDetails
Get detailed information about an integration.
import { GetIntegrationDetails } from '@deliverart/sdk-js-integration';
const integration = await sdk.call(new GetIntegrationDetails('integration-123'));ActivateIntegration
Request activation of an integration.
import { ActivateIntegration } from '@deliverart/sdk-js-integration';
const activation = await sdk.call(new ActivateIntegration({
integration: '/integrations/123',
pointOfSale: '/point_of_sales/456',
config: {
apiKey: 'your-api-key',
// ... integration-specific config
}
}));CancelIntegration
Request cancellation of an active integration.
import { CancelIntegration } from '@deliverart/sdk-js-integration';
const cancellation = await sdk.call(new CancelIntegration({
integration: '/integrations/123',
reason: 'No longer needed'
}));Deliveroo Manual Portal Activation
Deliveroo integrations expose manualActivationCompleted and manualActivationCompletedAt so operator tools can track whether the final manual activation step has been completed in the Deliveroo portal.
import {
GetIntegrationDeliverooList,
UpdateIntegrationDeliveroo,
} from '@deliverart/sdk-js-integration';
const pending = await sdk.call(new GetIntegrationDeliverooList({
query: {
manualActivationCompleted: false,
},
}));
await sdk.call(new UpdateIntegrationDeliveroo('deliveroo-integration-id', {
manualActivationCompleted: true,
}));Complete Usage Example
import { sdk } from './lib/sdk';
import {
GetIntegrations,
ActivateIntegration,
CancelIntegration
} from '@deliverart/sdk-js-integration';
async function integrationManagement() {
// Get available delivery integrations
const integrations = await sdk.call(new GetIntegrations({
query: {
type: 'DELIVERY',
company: '/companies/123'
}
}));
// Activate delivery partner
const activation = await sdk.call(new ActivateIntegration({
integration: integrations.data[0]['@id'],
pointOfSale: '/point_of_sales/456',
config: {
apiKey: process.env.DELIVERY_API_KEY,
webhookUrl: 'https://myapp.com/webhooks/delivery'
}
}));
// Cancel integration
await sdk.call(new CancelIntegration({
integration: activation.integration,
reason: 'Switching to different provider'
}));
}License
MIT
