🚀 DAY 4 OF LAUNCH WEEK: Introducing GitHub Actions Scanning Support.Learn more →
Socket
Book a DemoInstallSign in
Socket

@deliverart/sdk-js-customer

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deliverart/sdk-js-customer

Deliverart JavaScript SDK for Customer and CustomerAddress Management

latest
npmnpm
Version
2.1.57
Version published
Weekly downloads
579
5.85%
Maintainers
1
Weekly downloads
 
Created
Source

@deliverart/sdk-js-customer

Customer and business profile management package for the DeliverArt JavaScript SDK.

Installation

npm install @deliverart/sdk-js-customer @deliverart/sdk-js-core

Exported Types

Core Types

  • Customer - Customer basic information
  • CustomerDetails - Extended customer with relations
  • CustomerAddress - Customer delivery address
  • CustomerBusinessProfile - Business profile for B2B customers

IRI Types

  • CustomerIri - Customer IRI (/customers/:id)
  • CustomerAddressIri - Customer address IRI (/customer_addresses/:id)
  • CustomerBusinessProfileIri - Business profile IRI (/customer_business_profiles/:id)

Available Requests

Customer Management

CreateCustomer

import { CreateCustomer } from '@deliverart/sdk-js-customer';

const customer = await sdk.call(new CreateCustomer({
  firstName: 'John',
  lastName: 'Doe',
  email: 'john@example.com',
  phoneNumber: '+39123456789',
  company: '/companies/123' // Optional
}));

Input Parameters:

  • firstName: string (required) - First name
  • lastName: string (required) - Last name
  • email: string (required) - Email address
  • phoneNumber: string (required) - Phone number
  • company?: string (optional) - Company IRI

GetCustomers

import { GetCustomers } from '@deliverart/sdk-js-customer';

const customers = await sdk.call(new GetCustomers({
  query: {
    email: 'john@example.com',
    phoneNumber: '+39123456789',
    page: 1
  }
}));

Query Parameters:

  • firstName?: string - Filter by first name
  • lastName?: string - Filter by last name
  • email?: string - Filter by email
  • phoneNumber?: string - Filter by phone number
  • company?: string - Filter by company IRI
  • page?: number - Page number

GetCustomerDetails

import { GetCustomerDetails } from '@deliverart/sdk-js-customer';

const customer = await sdk.call(new GetCustomerDetails('customer-123'));

UpdateCustomer

import { UpdateCustomer } from '@deliverart/sdk-js-customer';

const updated = await sdk.call(new UpdateCustomer('customer-123', {
  firstName: 'Jane'
}));

DeleteCustomer

import { DeleteCustomer } from '@deliverart/sdk-js-customer';

await sdk.call(new DeleteCustomer('customer-123'));

Customer Addresses

CreateCustomerAddress

import { CreateCustomerAddress } from '@deliverart/sdk-js-customer';

const address = await sdk.call(new CreateCustomerAddress({
  customer: '/customers/123',
  street: 'Via Roma 1',
  city: 'Milano',
  postalCode: '20100',
  country: 'IT',
  location: {
    latitude: 45.464664,
    longitude: 9.188540
  }
}));

Input Parameters:

  • customer: string (required) - Customer IRI
  • street: string (required) - Street address
  • city: string (required) - City
  • postalCode: string (required) - Postal code
  • country: string (required) - Country code (ISO 3166-1 alpha-2)
  • state?: string (optional) - State/region
  • province?: string (optional) - Province
  • location?: { latitude: number, longitude: number } (optional) - GPS coordinates

GetCustomerAddresses

import { GetCustomerAddresses } from '@deliverart/sdk-js-customer';

const addresses = await sdk.call(new GetCustomerAddresses({
  query: {
    customer: '/customers/123'
  }
}));

UpdateCustomerAddress

import { UpdateCustomerAddress } from '@deliverart/sdk-js-customer';

const updated = await sdk.call(new UpdateCustomerAddress('address-123', {
  street: 'Via Nuova 10'
}));

DeleteCustomerAddress

import { DeleteCustomerAddress } from '@deliverart/sdk-js-customer';

await sdk.call(new DeleteCustomerAddress('address-123'));

Business Profiles (B2B)

CreateCustomerBusinessProfile

import { CreateCustomerBusinessProfile } from '@deliverart/sdk-js-customer';

const profile = await sdk.call(new CreateCustomerBusinessProfile({
  customer: '/customers/123',
  businessName: 'Acme Inc',
  vat: 'IT12345678901',
  taxCode: 'ACME123',
  billingAddress: {
    street: 'Via Business 1',
    city: 'Milano',
    postalCode: '20100',
    country: 'IT'
  },
  billingData: {
    email: 'billing@acme.com',
    pec: 'acme@pec.it'
  }
}));

Input Parameters:

  • customer: string (required) - Customer IRI
  • businessName: string (required) - Business name
  • vat: string (required) - VAT number
  • taxCode?: string (optional) - Tax code
  • billingAddress: Address (required) - Billing address
  • billingData: BillingData (required) - Billing contact information

GetCustomerBusinessProfiles

import { GetCustomerBusinessProfiles } from '@deliverart/sdk-js-customer';

const profiles = await sdk.call(new GetCustomerBusinessProfiles({
  query: {
    customer: '/customers/123'
  }
}));

UpdateCustomerBusinessProfile

import { UpdateCustomerBusinessProfile } from '@deliverart/sdk-js-customer';

const updated = await sdk.call(new UpdateCustomerBusinessProfile('profile-123', {
  businessName: 'Acme Corporation'
}));

DeleteCustomerBusinessProfile

import { DeleteCustomerBusinessProfile } from '@deliverart/sdk-js-customer';

await sdk.call(new DeleteCustomerBusinessProfile('profile-123'));

Complete Usage Example

import { sdk } from './lib/sdk';
import {
  CreateCustomer,
  CreateCustomerAddress,
  CreateCustomerBusinessProfile,
  GetCustomers
} from '@deliverart/sdk-js-customer';

async function customerWorkflow() {
  // Create customer
  const customer = await sdk.call(new CreateCustomer({
    firstName: 'John',
    lastName: 'Doe',
    email: 'john@example.com',
    phoneNumber: '+39123456789',
    company: '/companies/123'
  }));

  // Add delivery address
  const address = await sdk.call(new CreateCustomerAddress({
    customer: `/customers/${customer.id}`,
    street: 'Via Roma 1',
    city: 'Milano',
    postalCode: '20100',
    country: 'IT',
    location: {
      latitude: 45.464664,
      longitude: 9.188540
    }
  }));

  // Add business profile (for B2B)
  const businessProfile = await sdk.call(new CreateCustomerBusinessProfile({
    customer: `/customers/${customer.id}`,
    businessName: 'Acme Inc',
    vat: 'IT12345678901',
    billingAddress: {
      street: 'Via Business 1',
      city: 'Milano',
      postalCode: '20100',
      country: 'IT'
    },
    billingData: {
      email: 'billing@acme.com',
      pec: 'acme@pec.it'
    }
  }));

  // Search customers
  const customers = await sdk.call(new GetCustomers({
    query: {
      email: 'john@example.com'
    }
  }));

  console.log(`Found ${customers.pagination.totalItems} customers`);
}

License

MIT

FAQs

Package last updated on 23 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts