@deliverart/sdk-js-customer 2.1.49 → 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.
Files changed (2) hide show
  1. package/README.md +278 -0
  2. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,278 @@
1
+ # @deliverart/sdk-js-customer
2
+
3
+ Customer and business profile management package for the DeliverArt JavaScript SDK.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @deliverart/sdk-js-customer @deliverart/sdk-js-core
9
+ ```
10
+
11
+ ## Exported Types
12
+
13
+ ### Core Types
14
+ - `Customer` - Customer basic information
15
+ - `CustomerDetails` - Extended customer with relations
16
+ - `CustomerAddress` - Customer delivery address
17
+ - `CustomerBusinessProfile` - Business profile for B2B customers
18
+
19
+ ### IRI Types
20
+ - `CustomerIri` - Customer IRI (`/customers/:id`)
21
+ - `CustomerAddressIri` - Customer address IRI (`/customer_addresses/:id`)
22
+ - `CustomerBusinessProfileIri` - Business profile IRI (`/customer_business_profiles/:id`)
23
+
24
+ ## Available Requests
25
+
26
+ ### Customer Management
27
+
28
+ #### CreateCustomer
29
+ ```typescript
30
+ import { CreateCustomer } from '@deliverart/sdk-js-customer';
31
+
32
+ const customer = await sdk.call(new CreateCustomer({
33
+ firstName: 'John',
34
+ lastName: 'Doe',
35
+ email: 'john@example.com',
36
+ phoneNumber: '+39123456789',
37
+ company: '/companies/123' // Optional
38
+ }));
39
+ ```
40
+
41
+ **Input Parameters:**
42
+ - `firstName: string` (required) - First name
43
+ - `lastName: string` (required) - Last name
44
+ - `email: string` (required) - Email address
45
+ - `phoneNumber: string` (required) - Phone number
46
+ - `company?: string` (optional) - Company IRI
47
+
48
+ #### GetCustomers
49
+ ```typescript
50
+ import { GetCustomers } from '@deliverart/sdk-js-customer';
51
+
52
+ const customers = await sdk.call(new GetCustomers({
53
+ query: {
54
+ email: 'john@example.com',
55
+ phoneNumber: '+39123456789',
56
+ page: 1
57
+ }
58
+ }));
59
+ ```
60
+
61
+ **Query Parameters:**
62
+ - `firstName?: string` - Filter by first name
63
+ - `lastName?: string` - Filter by last name
64
+ - `email?: string` - Filter by email
65
+ - `phoneNumber?: string` - Filter by phone number
66
+ - `company?: string` - Filter by company IRI
67
+ - `page?: number` - Page number
68
+
69
+ #### GetCustomerDetails
70
+ ```typescript
71
+ import { GetCustomerDetails } from '@deliverart/sdk-js-customer';
72
+
73
+ const customer = await sdk.call(new GetCustomerDetails('customer-123'));
74
+ ```
75
+
76
+ #### UpdateCustomer
77
+ ```typescript
78
+ import { UpdateCustomer } from '@deliverart/sdk-js-customer';
79
+
80
+ const updated = await sdk.call(new UpdateCustomer('customer-123', {
81
+ firstName: 'Jane'
82
+ }));
83
+ ```
84
+
85
+ #### DeleteCustomer
86
+ ```typescript
87
+ import { DeleteCustomer } from '@deliverart/sdk-js-customer';
88
+
89
+ await sdk.call(new DeleteCustomer('customer-123'));
90
+ ```
91
+
92
+ ---
93
+
94
+ ### Customer Addresses
95
+
96
+ #### CreateCustomerAddress
97
+ ```typescript
98
+ import { CreateCustomerAddress } from '@deliverart/sdk-js-customer';
99
+
100
+ const address = await sdk.call(new CreateCustomerAddress({
101
+ customer: '/customers/123',
102
+ street: 'Via Roma 1',
103
+ city: 'Milano',
104
+ postalCode: '20100',
105
+ country: 'IT',
106
+ location: {
107
+ latitude: 45.464664,
108
+ longitude: 9.188540
109
+ }
110
+ }));
111
+ ```
112
+
113
+ **Input Parameters:**
114
+ - `customer: string` (required) - Customer IRI
115
+ - `street: string` (required) - Street address
116
+ - `city: string` (required) - City
117
+ - `postalCode: string` (required) - Postal code
118
+ - `country: string` (required) - Country code (ISO 3166-1 alpha-2)
119
+ - `state?: string` (optional) - State/region
120
+ - `province?: string` (optional) - Province
121
+ - `location?: { latitude: number, longitude: number }` (optional) - GPS coordinates
122
+
123
+ #### GetCustomerAddresses
124
+ ```typescript
125
+ import { GetCustomerAddresses } from '@deliverart/sdk-js-customer';
126
+
127
+ const addresses = await sdk.call(new GetCustomerAddresses({
128
+ query: {
129
+ customer: '/customers/123'
130
+ }
131
+ }));
132
+ ```
133
+
134
+ #### UpdateCustomerAddress
135
+ ```typescript
136
+ import { UpdateCustomerAddress } from '@deliverart/sdk-js-customer';
137
+
138
+ const updated = await sdk.call(new UpdateCustomerAddress('address-123', {
139
+ street: 'Via Nuova 10'
140
+ }));
141
+ ```
142
+
143
+ #### DeleteCustomerAddress
144
+ ```typescript
145
+ import { DeleteCustomerAddress } from '@deliverart/sdk-js-customer';
146
+
147
+ await sdk.call(new DeleteCustomerAddress('address-123'));
148
+ ```
149
+
150
+ ---
151
+
152
+ ### Business Profiles (B2B)
153
+
154
+ #### CreateCustomerBusinessProfile
155
+ ```typescript
156
+ import { CreateCustomerBusinessProfile } from '@deliverart/sdk-js-customer';
157
+
158
+ const profile = await sdk.call(new CreateCustomerBusinessProfile({
159
+ customer: '/customers/123',
160
+ businessName: 'Acme Inc',
161
+ vat: 'IT12345678901',
162
+ taxCode: 'ACME123',
163
+ billingAddress: {
164
+ street: 'Via Business 1',
165
+ city: 'Milano',
166
+ postalCode: '20100',
167
+ country: 'IT'
168
+ },
169
+ billingData: {
170
+ email: 'billing@acme.com',
171
+ pec: 'acme@pec.it'
172
+ }
173
+ }));
174
+ ```
175
+
176
+ **Input Parameters:**
177
+ - `customer: string` (required) - Customer IRI
178
+ - `businessName: string` (required) - Business name
179
+ - `vat: string` (required) - VAT number
180
+ - `taxCode?: string` (optional) - Tax code
181
+ - `billingAddress: Address` (required) - Billing address
182
+ - `billingData: BillingData` (required) - Billing contact information
183
+
184
+ #### GetCustomerBusinessProfiles
185
+ ```typescript
186
+ import { GetCustomerBusinessProfiles } from '@deliverart/sdk-js-customer';
187
+
188
+ const profiles = await sdk.call(new GetCustomerBusinessProfiles({
189
+ query: {
190
+ customer: '/customers/123'
191
+ }
192
+ }));
193
+ ```
194
+
195
+ #### UpdateCustomerBusinessProfile
196
+ ```typescript
197
+ import { UpdateCustomerBusinessProfile } from '@deliverart/sdk-js-customer';
198
+
199
+ const updated = await sdk.call(new UpdateCustomerBusinessProfile('profile-123', {
200
+ businessName: 'Acme Corporation'
201
+ }));
202
+ ```
203
+
204
+ #### DeleteCustomerBusinessProfile
205
+ ```typescript
206
+ import { DeleteCustomerBusinessProfile } from '@deliverart/sdk-js-customer';
207
+
208
+ await sdk.call(new DeleteCustomerBusinessProfile('profile-123'));
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Complete Usage Example
214
+
215
+ ```typescript
216
+ import { sdk } from './lib/sdk';
217
+ import {
218
+ CreateCustomer,
219
+ CreateCustomerAddress,
220
+ CreateCustomerBusinessProfile,
221
+ GetCustomers
222
+ } from '@deliverart/sdk-js-customer';
223
+
224
+ async function customerWorkflow() {
225
+ // Create customer
226
+ const customer = await sdk.call(new CreateCustomer({
227
+ firstName: 'John',
228
+ lastName: 'Doe',
229
+ email: 'john@example.com',
230
+ phoneNumber: '+39123456789',
231
+ company: '/companies/123'
232
+ }));
233
+
234
+ // Add delivery address
235
+ const address = await sdk.call(new CreateCustomerAddress({
236
+ customer: `/customers/${customer.id}`,
237
+ street: 'Via Roma 1',
238
+ city: 'Milano',
239
+ postalCode: '20100',
240
+ country: 'IT',
241
+ location: {
242
+ latitude: 45.464664,
243
+ longitude: 9.188540
244
+ }
245
+ }));
246
+
247
+ // Add business profile (for B2B)
248
+ const businessProfile = await sdk.call(new CreateCustomerBusinessProfile({
249
+ customer: `/customers/${customer.id}`,
250
+ businessName: 'Acme Inc',
251
+ vat: 'IT12345678901',
252
+ billingAddress: {
253
+ street: 'Via Business 1',
254
+ city: 'Milano',
255
+ postalCode: '20100',
256
+ country: 'IT'
257
+ },
258
+ billingData: {
259
+ email: 'billing@acme.com',
260
+ pec: 'acme@pec.it'
261
+ }
262
+ }));
263
+
264
+ // Search customers
265
+ const customers = await sdk.call(new GetCustomers({
266
+ query: {
267
+ email: 'john@example.com'
268
+ }
269
+ }));
270
+
271
+ console.log(`Found ${customers.pagination.totalItems} customers`);
272
+ }
273
+ ```
274
+
275
+ ## License
276
+
277
+ MIT
278
+
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@deliverart/sdk-js-customer",
3
3
  "description": "Deliverart JavaScript SDK for Customer and CustomerAddress Management",
4
- "version": "2.1.49",
4
+ "version": "2.1.51",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -18,10 +18,10 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@deliverart/sdk-js-core": "2.1.49",
22
- "@deliverart/sdk-js-point-of-sale": "2.1.49",
23
- "@deliverart/sdk-js-global-types": "2.1.49",
24
- "@deliverart/sdk-js-user": "2.1.49"
21
+ "@deliverart/sdk-js-global-types": "2.1.51",
22
+ "@deliverart/sdk-js-point-of-sale": "2.1.51",
23
+ "@deliverart/sdk-js-core": "2.1.51",
24
+ "@deliverart/sdk-js-user": "2.1.51"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"