@daffodil/customer 0.94.1 → 0.95.1
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/fesm2022/daffodil-customer-driver-in-memory.mjs +344 -324
- package/fesm2022/daffodil-customer-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-customer-driver-magento-2.4.7-testing.mjs +116 -0
- package/fesm2022/daffodil-customer-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-driver-magento-2.4.7.mjs +399 -0
- package/fesm2022/daffodil-customer-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-customer-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-customer-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-customer-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-customer-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-customer-driver-testing.mjs +152 -105
- package/fesm2022/daffodil-customer-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-driver.mjs +45 -88
- package/fesm2022/daffodil-customer-driver.mjs.map +1 -1
- package/fesm2022/daffodil-customer-routing.mjs +86 -52
- package/fesm2022/daffodil-customer-routing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-state-testing.mjs +176 -108
- package/fesm2022/daffodil-customer-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer-state.mjs +581 -718
- package/fesm2022/daffodil-customer-state.mjs.map +1 -1
- package/fesm2022/daffodil-customer-testing.mjs +102 -75
- package/fesm2022/daffodil-customer-testing.mjs.map +1 -1
- package/fesm2022/daffodil-customer.mjs +0 -4
- package/package.json +1 -1
- package/types/daffodil-customer-driver-in-memory.d.ts +102 -104
- package/types/daffodil-customer-driver-magento-2.4.7-testing.d.ts +33 -0
- package/types/daffodil-customer-driver-magento-2.4.7.d.ts +193 -0
- package/types/daffodil-customer-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-customer-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-customer-driver-testing.d.ts +38 -37
- package/types/daffodil-customer-driver.d.ts +76 -90
- package/types/daffodil-customer-routing.d.ts +18 -22
- package/types/daffodil-customer-state-testing.d.ts +43 -43
- package/types/daffodil-customer-state.d.ts +240 -264
- package/types/daffodil-customer-testing.d.ts +27 -31
- package/types/daffodil-customer.d.ts +33 -37
- package/fesm2022/daffodil-customer-driver-magento-testing.mjs +0 -75
- package/fesm2022/daffodil-customer-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-customer-driver-magento.mjs +0 -448
- package/fesm2022/daffodil-customer-driver-magento.mjs.map +0 -1
- package/fesm2022/daffodil-customer.mjs.map +0 -1
- package/types/daffodil-customer-driver-magento-testing.d.ts +0 -37
- package/types/daffodil-customer-driver-magento.d.ts +0 -205
|
@@ -1,448 +0,0 @@
|
|
|
1
|
-
import * as i1 from 'apollo-angular';
|
|
2
|
-
import { gql } from 'apollo-angular';
|
|
3
|
-
import { CombinedGraphQLErrors } from '@apollo/client';
|
|
4
|
-
import { DaffCustomerDriverErrorCodes, DaffCustomerDriverErrorMap, DaffCustomerInvalidAPIResponseError, DaffCustomerAddressNotFoundError, provideDaffCustomerDriver, provideDaffCustomerAddressDriver } from '@daffodil/customer/driver';
|
|
5
|
-
import { daffTransformMagentoError } from '@daffodil/driver/magento';
|
|
6
|
-
import * as i0 from '@angular/core';
|
|
7
|
-
import { Injectable, NgModule } from '@angular/core';
|
|
8
|
-
import { throwError } from 'rxjs';
|
|
9
|
-
import { map, catchError, switchMap } from 'rxjs/operators';
|
|
10
|
-
import { CommonModule } from '@angular/common';
|
|
11
|
-
import * as i2 from '@daffodil/core/graphql';
|
|
12
|
-
|
|
13
|
-
const magentoCustomerInputTransform = (customer) => ({
|
|
14
|
-
firstname: customer.firstName,
|
|
15
|
-
lastname: customer.lastName,
|
|
16
|
-
is_subscribed: customer.isSubscribed,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const magentoCustomerAddressInputTransform = (address) => ({
|
|
20
|
-
city: address.city,
|
|
21
|
-
country_code: address.country,
|
|
22
|
-
country_id: address.country,
|
|
23
|
-
default_billing: address.defaultBilling,
|
|
24
|
-
default_shipping: address.defaultShipping,
|
|
25
|
-
firstname: address.firstname,
|
|
26
|
-
lastname: address.lastname,
|
|
27
|
-
middlename: address.middlename,
|
|
28
|
-
postcode: address.postcode,
|
|
29
|
-
prefix: address.prefix,
|
|
30
|
-
region: {
|
|
31
|
-
region_id: Number(address.region),
|
|
32
|
-
},
|
|
33
|
-
street: [
|
|
34
|
-
address.street,
|
|
35
|
-
...(address.street2 ? [address.street2] : []),
|
|
36
|
-
],
|
|
37
|
-
suffix: address.suffix,
|
|
38
|
-
telephone: address.telephone,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
const magentoCustomerAddressTransform = (address) => ({
|
|
42
|
-
id: address.id ? String(address.id) : null,
|
|
43
|
-
street: address.street[0],
|
|
44
|
-
street2: address.street[1],
|
|
45
|
-
city: address.city,
|
|
46
|
-
region: String(address.region.region_id),
|
|
47
|
-
region_code: address.region.region_code,
|
|
48
|
-
country: address.country_code,
|
|
49
|
-
country_id: address.country_code,
|
|
50
|
-
postcode: address.postcode,
|
|
51
|
-
firstname: address.firstname,
|
|
52
|
-
lastname: address.lastname,
|
|
53
|
-
telephone: address.telephone,
|
|
54
|
-
email: address.email,
|
|
55
|
-
defaultBilling: address.default_billing,
|
|
56
|
-
defaultShipping: address.default_shipping,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
const magentoCustomerTransform = (customer) => ({
|
|
60
|
-
id: customer.email,
|
|
61
|
-
email: customer.email,
|
|
62
|
-
firstName: customer.firstname,
|
|
63
|
-
lastName: customer.lastname,
|
|
64
|
-
isSubscribed: customer.is_subscribed,
|
|
65
|
-
addresses: customer.addresses.map(magentoCustomerAddressTransform),
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
var MagentoCustomerGender;
|
|
69
|
-
(function (MagentoCustomerGender) {
|
|
70
|
-
MagentoCustomerGender[MagentoCustomerGender["MALE"] = 1] = "MALE";
|
|
71
|
-
MagentoCustomerGender[MagentoCustomerGender["FEMALE"] = 2] = "FEMALE";
|
|
72
|
-
})(MagentoCustomerGender || (MagentoCustomerGender = {}));
|
|
73
|
-
|
|
74
|
-
const magentoCustomerAddressFragment = gql `
|
|
75
|
-
fragment magentoCustomerAddress on CustomerAddress {
|
|
76
|
-
id
|
|
77
|
-
city
|
|
78
|
-
country_code
|
|
79
|
-
firstname
|
|
80
|
-
lastname
|
|
81
|
-
postcode
|
|
82
|
-
region {
|
|
83
|
-
region_code
|
|
84
|
-
region_id
|
|
85
|
-
}
|
|
86
|
-
street
|
|
87
|
-
telephone
|
|
88
|
-
company
|
|
89
|
-
default_billing
|
|
90
|
-
default_shipping
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
const magentoCustomerFragment = gql `
|
|
95
|
-
fragment magentoCustomer on Customer {
|
|
96
|
-
email
|
|
97
|
-
firstname
|
|
98
|
-
lastname
|
|
99
|
-
is_subscribed
|
|
100
|
-
addresses {
|
|
101
|
-
...magentoCustomerAddress
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
${magentoCustomerAddressFragment}
|
|
105
|
-
`;
|
|
106
|
-
|
|
107
|
-
const MAGENTO_GET_CUSTOMER_QUERY_NAME = 'MagentoGetCustomer';
|
|
108
|
-
const getCustomer = gql `
|
|
109
|
-
query ${MAGENTO_GET_CUSTOMER_QUERY_NAME} {
|
|
110
|
-
customer {
|
|
111
|
-
...magentoCustomer
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
${magentoCustomerFragment}
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
const MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME = 'MagentoGetCustomerAddresses';
|
|
118
|
-
const getCustomerAddresses = gql `
|
|
119
|
-
query ${MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME} {
|
|
120
|
-
customer {
|
|
121
|
-
addresses {
|
|
122
|
-
...magentoCustomerAddress
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
${magentoCustomerAddressFragment}
|
|
127
|
-
`;
|
|
128
|
-
|
|
129
|
-
const createCustomerAddress = gql `
|
|
130
|
-
mutation MagentoCreateCustomerAddress($input: CustomerAddressInput!) {
|
|
131
|
-
createCustomerAddress(input: $input) {
|
|
132
|
-
...magentoCustomerAddress
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
${magentoCustomerAddressFragment}
|
|
136
|
-
`;
|
|
137
|
-
|
|
138
|
-
const updateCustomerAddress = gql `
|
|
139
|
-
mutation MagentoUpdateCustomerAddress($id: Int!, $input: CustomerAddressInput!) {
|
|
140
|
-
updateCustomerAddress(id: $id, input: $input) {
|
|
141
|
-
...magentoCustomerAddress
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
${magentoCustomerAddressFragment}
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
const deleteCustomerAddress = gql `
|
|
148
|
-
mutation MagentoDeleteCustomerAddress($id: Int!) {
|
|
149
|
-
deleteCustomerAddress(id: $id)
|
|
150
|
-
}
|
|
151
|
-
`;
|
|
152
|
-
|
|
153
|
-
const MAGENTO_UPDATE_CUSTOMER_QUERY_NAME = 'MagentoUpdateCustomer';
|
|
154
|
-
const updateCustomer = gql `
|
|
155
|
-
mutation ${MAGENTO_UPDATE_CUSTOMER_QUERY_NAME}($customer: CustomerUpdateInput!) {
|
|
156
|
-
updateCustomerV2(input: $customer) {
|
|
157
|
-
customer {
|
|
158
|
-
...magentoCustomer
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
${magentoCustomerFragment}
|
|
163
|
-
`;
|
|
164
|
-
|
|
165
|
-
const MAGENTO_UPDATE_EMAIL_QUERY_NAME = 'MagentoUpdateEmail';
|
|
166
|
-
const updateEmail = gql `
|
|
167
|
-
mutation ${MAGENTO_UPDATE_EMAIL_QUERY_NAME}($email: String!, $password: String!) {
|
|
168
|
-
updateCustomerEmail(email: $email, password: $password) {
|
|
169
|
-
customer {
|
|
170
|
-
...magentoCustomer
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
${magentoCustomerFragment}
|
|
175
|
-
`;
|
|
176
|
-
|
|
177
|
-
const MAGENTO_CHANGE_PASSWORD_QUERY_NAME = 'MagentoChangePassword';
|
|
178
|
-
const changePassword = gql `
|
|
179
|
-
mutation ${MAGENTO_CHANGE_PASSWORD_QUERY_NAME}($old: String!, $new: String!) {
|
|
180
|
-
changeCustomerPassword(
|
|
181
|
-
currentPassword: $old
|
|
182
|
-
newPassword: $new
|
|
183
|
-
) {
|
|
184
|
-
email
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
`;
|
|
188
|
-
|
|
189
|
-
const DaffCustomerMagentoErrorMessageRegexMap = {
|
|
190
|
-
[DaffCustomerDriverErrorCodes.DEFAULT_SHIPPING_ADDRESS_DELETION]: /is set as default shipping address and can not be deleted/,
|
|
191
|
-
[DaffCustomerDriverErrorCodes.DEFAULT_BILLING_ADDRESS_DELETION]: /is set as default billing address and can not be deleted/,
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Transforms a single GraphQL error.
|
|
196
|
-
* Optionally accepts a request payload which can be used in certain cases
|
|
197
|
-
* to add supplemental info to the error.
|
|
198
|
-
*/
|
|
199
|
-
function transformMagentoCartGraphQlError(error, requestPayload) {
|
|
200
|
-
// TODO: readdress this when we move to eslint
|
|
201
|
-
// eslint-disable-next-line
|
|
202
|
-
for (const code in DaffCustomerMagentoErrorMessageRegexMap) {
|
|
203
|
-
const matchIndex = error.message.search(DaffCustomerMagentoErrorMessageRegexMap[code]);
|
|
204
|
-
if (matchIndex > -1 && DaffCustomerDriverErrorMap[code]) {
|
|
205
|
-
const errObj = new DaffCustomerDriverErrorMap[code](error.message);
|
|
206
|
-
return errObj;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return daffTransformMagentoError(error, {});
|
|
210
|
-
}
|
|
211
|
-
function transformMagentoReviewsError(error, requestPayload) {
|
|
212
|
-
if (CombinedGraphQLErrors.is(error)) {
|
|
213
|
-
return transformMagentoCartGraphQlError(error.errors[0], requestPayload);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
return daffTransformMagentoError(error, {}) || new DaffCustomerInvalidAPIResponseError(error.message);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const validateGetCustomerResponse = (response) => {
|
|
221
|
-
if (response.data.customer?.email) {
|
|
222
|
-
return response;
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
throw new DaffCustomerInvalidAPIResponseError('Get customer response does not contain a valid customer.');
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
const validateChangeEmailResponse = (response) => {
|
|
230
|
-
if (response.data.updateCustomerEmail.customer?.email) {
|
|
231
|
-
return response;
|
|
232
|
-
}
|
|
233
|
-
else {
|
|
234
|
-
throw new DaffCustomerInvalidAPIResponseError('Update email response does not contain a valid customer.');
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const validateChangePasswordResponse = (response) => {
|
|
239
|
-
if (response.data.changeCustomerPassword?.email) {
|
|
240
|
-
return response;
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
throw new DaffCustomerInvalidAPIResponseError('Change password response does not contain a valid customer.');
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
const validateGetCustomerAddressesResponse = (response) => {
|
|
248
|
-
if (response.data.customer?.addresses) {
|
|
249
|
-
return response;
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
throw new DaffCustomerInvalidAPIResponseError('Get customer address response does not contain addresses.');
|
|
253
|
-
}
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
const validateCreateCustomerAddressResponse = (response) => {
|
|
257
|
-
if (response.data.createCustomerAddress?.id) {
|
|
258
|
-
return response;
|
|
259
|
-
}
|
|
260
|
-
else {
|
|
261
|
-
throw new DaffCustomerInvalidAPIResponseError('Create customer address response does not contain an address.');
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const validateUpdateCustomerAddressResponse = (response) => {
|
|
266
|
-
if (response.data.updateCustomerAddress?.id) {
|
|
267
|
-
return response;
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
throw new DaffCustomerInvalidAPIResponseError('Update customer address response does not contain an address.');
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
const validateDeleteCustomerAddressResponse = (response) => {
|
|
275
|
-
if (response.data.deleteCustomerAddress) {
|
|
276
|
-
return response;
|
|
277
|
-
}
|
|
278
|
-
else {
|
|
279
|
-
throw new DaffCustomerInvalidAPIResponseError('Delete customer address did not complete successfully.');
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
const validateUpdateCustomerResponse = (response) => {
|
|
284
|
-
if (response.data.updateCustomerV2.customer?.email) {
|
|
285
|
-
return response;
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
throw new DaffCustomerInvalidAPIResponseError('Update customer response does not contain a valid customer.');
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* A service for making Magento GraphQL queries for customers.
|
|
294
|
-
*
|
|
295
|
-
* @inheritdoc
|
|
296
|
-
*/
|
|
297
|
-
class DaffCustomerMagentoService {
|
|
298
|
-
constructor(apollo) {
|
|
299
|
-
this.apollo = apollo;
|
|
300
|
-
}
|
|
301
|
-
changeEmail(email, password) {
|
|
302
|
-
return this.apollo.mutate({
|
|
303
|
-
mutation: updateEmail,
|
|
304
|
-
variables: {
|
|
305
|
-
email,
|
|
306
|
-
password,
|
|
307
|
-
},
|
|
308
|
-
}).pipe(map(validateChangeEmailResponse), map(result => magentoCustomerTransform(result.data.updateCustomerEmail.customer)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
309
|
-
}
|
|
310
|
-
changePassword(oldPassword, newPassword) {
|
|
311
|
-
return this.apollo.mutate({
|
|
312
|
-
mutation: changePassword,
|
|
313
|
-
variables: {
|
|
314
|
-
old: oldPassword,
|
|
315
|
-
new: newPassword,
|
|
316
|
-
},
|
|
317
|
-
}).pipe(map(validateChangePasswordResponse), map(() => undefined), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
318
|
-
}
|
|
319
|
-
get() {
|
|
320
|
-
return this.apollo.query({
|
|
321
|
-
query: getCustomer,
|
|
322
|
-
}).pipe(map(validateGetCustomerResponse), map(result => magentoCustomerTransform(result.data.customer)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
323
|
-
}
|
|
324
|
-
update(customer) {
|
|
325
|
-
return this.apollo.mutate({
|
|
326
|
-
mutation: updateCustomer,
|
|
327
|
-
variables: {
|
|
328
|
-
customer: magentoCustomerInputTransform(customer),
|
|
329
|
-
},
|
|
330
|
-
}).pipe(map(validateUpdateCustomerResponse), map(result => magentoCustomerTransform(result.data.updateCustomerV2.customer)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
331
|
-
}
|
|
332
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoService, deps: [{ token: i1.Apollo }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
333
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoService, providedIn: 'root' }); }
|
|
334
|
-
}
|
|
335
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoService, decorators: [{
|
|
336
|
-
type: Injectable,
|
|
337
|
-
args: [{
|
|
338
|
-
providedIn: 'root',
|
|
339
|
-
}]
|
|
340
|
-
}], ctorParameters: () => [{ type: i1.Apollo }] });
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* A service for making Magento GraphQL queries for customers.
|
|
344
|
-
*
|
|
345
|
-
* @inheritdoc
|
|
346
|
-
*/
|
|
347
|
-
class DaffCustomerMagentoAddressService {
|
|
348
|
-
constructor(apollo, mutationQueue) {
|
|
349
|
-
this.apollo = apollo;
|
|
350
|
-
this.mutationQueue = mutationQueue;
|
|
351
|
-
}
|
|
352
|
-
add(address) {
|
|
353
|
-
return this.mutationQueue.mutate({
|
|
354
|
-
mutation: createCustomerAddress,
|
|
355
|
-
variables: {
|
|
356
|
-
input: magentoCustomerAddressInputTransform(address),
|
|
357
|
-
},
|
|
358
|
-
refetchQueries: [{
|
|
359
|
-
query: getCustomerAddresses,
|
|
360
|
-
}],
|
|
361
|
-
onQueryUpdated: () => true,
|
|
362
|
-
}).pipe(map(validateCreateCustomerAddressResponse),
|
|
363
|
-
// magento doesn't return address collection so make an additional request >:(
|
|
364
|
-
switchMap(() => this.listAddresses()), map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
365
|
-
}
|
|
366
|
-
delete(addressId) {
|
|
367
|
-
return this.mutationQueue.mutate({
|
|
368
|
-
mutation: deleteCustomerAddress,
|
|
369
|
-
variables: {
|
|
370
|
-
id: Number(addressId),
|
|
371
|
-
},
|
|
372
|
-
refetchQueries: [{
|
|
373
|
-
query: getCustomerAddresses,
|
|
374
|
-
}],
|
|
375
|
-
onQueryUpdated: (query) => true,
|
|
376
|
-
}).pipe(map(validateDeleteCustomerAddressResponse),
|
|
377
|
-
// magento doesn't return address collection so make an additional request >:(
|
|
378
|
-
switchMap(() => this.listAddresses()), map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
379
|
-
}
|
|
380
|
-
list() {
|
|
381
|
-
return this.listAddresses().pipe(map((response) => response.data.customer.addresses.map(magentoCustomerAddressTransform)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
382
|
-
}
|
|
383
|
-
get(addressId) {
|
|
384
|
-
return this.listAddresses().pipe(map(({ data }) => {
|
|
385
|
-
const address = data.customer.addresses.find(({ id }) => String(id) === addressId);
|
|
386
|
-
if (!address) {
|
|
387
|
-
throw new DaffCustomerAddressNotFoundError(`Could not find an address with ID: ${addressId}`);
|
|
388
|
-
}
|
|
389
|
-
return address;
|
|
390
|
-
}), map(address => magentoCustomerAddressTransform(address)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
391
|
-
}
|
|
392
|
-
update(address) {
|
|
393
|
-
return this.mutationQueue.mutate({
|
|
394
|
-
mutation: updateCustomerAddress,
|
|
395
|
-
variables: {
|
|
396
|
-
id: Number(address.id),
|
|
397
|
-
input: magentoCustomerAddressInputTransform(address),
|
|
398
|
-
},
|
|
399
|
-
refetchQueries: [{
|
|
400
|
-
query: getCustomerAddresses,
|
|
401
|
-
}],
|
|
402
|
-
onQueryUpdated: (query) => true,
|
|
403
|
-
}).pipe(map(validateUpdateCustomerAddressResponse), switchMap(() => this.listAddresses()), map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
404
|
-
}
|
|
405
|
-
listAddresses() {
|
|
406
|
-
return this.apollo.query({
|
|
407
|
-
query: getCustomerAddresses,
|
|
408
|
-
}).pipe(map(validateGetCustomerAddressesResponse), catchError(err => throwError(() => transformMagentoReviewsError(err))));
|
|
409
|
-
}
|
|
410
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoAddressService, deps: [{ token: i1.Apollo }, { token: i2.DaffQueuedApollo }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
411
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoAddressService, providedIn: 'root' }); }
|
|
412
|
-
}
|
|
413
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoAddressService, decorators: [{
|
|
414
|
-
type: Injectable,
|
|
415
|
-
args: [{
|
|
416
|
-
providedIn: 'root',
|
|
417
|
-
}]
|
|
418
|
-
}], ctorParameters: () => [{ type: i1.Apollo }, { type: i2.DaffQueuedApollo }] });
|
|
419
|
-
|
|
420
|
-
class DaffCustomerMagentoDriverModule {
|
|
421
|
-
static forRoot() {
|
|
422
|
-
return {
|
|
423
|
-
ngModule: DaffCustomerMagentoDriverModule,
|
|
424
|
-
providers: [
|
|
425
|
-
provideDaffCustomerDriver(DaffCustomerMagentoService),
|
|
426
|
-
provideDaffCustomerAddressDriver(DaffCustomerMagentoAddressService),
|
|
427
|
-
],
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoDriverModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
431
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoDriverModule, imports: [CommonModule] }); }
|
|
432
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoDriverModule, imports: [CommonModule] }); }
|
|
433
|
-
}
|
|
434
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: DaffCustomerMagentoDriverModule, decorators: [{
|
|
435
|
-
type: NgModule,
|
|
436
|
-
args: [{
|
|
437
|
-
imports: [
|
|
438
|
-
CommonModule,
|
|
439
|
-
],
|
|
440
|
-
}]
|
|
441
|
-
}] });
|
|
442
|
-
|
|
443
|
-
/**
|
|
444
|
-
* Generated bundle index. Do not edit.
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
export { DaffCustomerMagentoDriverModule, DaffCustomerMagentoService, MAGENTO_CHANGE_PASSWORD_QUERY_NAME, MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME, MAGENTO_GET_CUSTOMER_QUERY_NAME, MAGENTO_UPDATE_CUSTOMER_QUERY_NAME, MAGENTO_UPDATE_EMAIL_QUERY_NAME, MagentoCustomerGender, changePassword, createCustomerAddress, deleteCustomerAddress, getCustomer, getCustomerAddresses, magentoCustomerAddressFragment, magentoCustomerAddressInputTransform, magentoCustomerAddressTransform, magentoCustomerFragment, magentoCustomerInputTransform, magentoCustomerTransform, transformMagentoReviewsError, updateCustomer, updateCustomerAddress, updateEmail, validateChangeEmailResponse, validateChangePasswordResponse, validateCreateCustomerAddressResponse, validateDeleteCustomerAddressResponse, validateGetCustomerAddressesResponse, validateGetCustomerResponse, validateUpdateCustomerAddressResponse, validateUpdateCustomerResponse };
|
|
448
|
-
//# sourceMappingURL=daffodil-customer-driver-magento.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer-driver-magento.mjs","sources":["../../../libs/customer/driver/magento/src/transforms/requests/customer-input.ts","../../../libs/customer/driver/magento/src/transforms/requests/address-input.ts","../../../libs/customer/driver/magento/src/transforms/responses/customer-address.ts","../../../libs/customer/driver/magento/src/transforms/responses/customer.ts","../../../libs/customer/driver/magento/src/models/gender.enum.ts","../../../libs/customer/driver/magento/src/queries/fragments/customer-address.ts","../../../libs/customer/driver/magento/src/queries/fragments/customer.ts","../../../libs/customer/driver/magento/src/queries/get-customer.ts","../../../libs/customer/driver/magento/src/queries/get-customer-addresses.ts","../../../libs/customer/driver/magento/src/queries/create-customer-address.ts","../../../libs/customer/driver/magento/src/queries/update-customer-address.ts","../../../libs/customer/driver/magento/src/queries/delete-customer-address.ts","../../../libs/customer/driver/magento/src/queries/update-customer.ts","../../../libs/customer/driver/magento/src/queries/update-email.ts","../../../libs/customer/driver/magento/src/queries/change-password.ts","../../../libs/customer/driver/magento/src/errors/map.ts","../../../libs/customer/driver/magento/src/errors/transform.ts","../../../libs/customer/driver/magento/src/validators/get-customer.ts","../../../libs/customer/driver/magento/src/validators/change-email.ts","../../../libs/customer/driver/magento/src/validators/change-password.ts","../../../libs/customer/driver/magento/src/validators/get-customer-addresses.ts","../../../libs/customer/driver/magento/src/validators/create-customer-address.ts","../../../libs/customer/driver/magento/src/validators/update-customer-address.ts","../../../libs/customer/driver/magento/src/validators/delete-customer-address.ts","../../../libs/customer/driver/magento/src/validators/update-customer.ts","../../../libs/customer/driver/magento/src/customer.service.ts","../../../libs/customer/driver/magento/src/address.service.ts","../../../libs/customer/driver/magento/src/customer-driver.module.ts","../../../libs/customer/driver/magento/src/daffodil-customer-driver-magento.ts"],"sourcesContent":["import { DaffCustomer } from '@daffodil/customer';\n\nimport { MagentoCustomerInput } from '../../models/public_api';\n\nexport const magentoCustomerInputTransform = (customer: Partial<DaffCustomer>): MagentoCustomerInput => ({\n firstname: customer.firstName,\n lastname: customer.lastName,\n is_subscribed: customer.isSubscribed,\n});\n","import { DaffCustomerAddress } from '@daffodil/customer';\n\nimport { MagentoCustomerAddressInput } from '../../models/public_api';\n\nexport const magentoCustomerAddressInputTransform = (address: Partial<DaffCustomerAddress>): MagentoCustomerAddressInput => ({\n city: address.city,\n country_code: address.country,\n country_id: address.country,\n default_billing: address.defaultBilling,\n default_shipping: address.defaultShipping,\n firstname: address.firstname,\n lastname: address.lastname,\n middlename: address.middlename,\n postcode: address.postcode,\n prefix: address.prefix,\n region: {\n region_id: Number(address.region),\n },\n street: [\n address.street,\n ...(address.street2 ? [address.street2] : []),\n ],\n suffix: address.suffix,\n telephone: address.telephone,\n});\n","import { DaffCustomerAddress } from '@daffodil/customer';\n\nimport { MagentoCustomerAddress } from '../../models/public_api';\n\nexport const magentoCustomerAddressTransform = (address: MagentoCustomerAddress): DaffCustomerAddress => ({\n id: address.id ? String(address.id) : null,\n street: address.street[0],\n street2: address.street[1],\n city: address.city,\n region: String(address.region.region_id),\n region_code: address.region.region_code,\n country: address.country_code,\n country_id: address.country_code,\n postcode: address.postcode,\n firstname: address.firstname,\n lastname: address.lastname,\n telephone: address.telephone,\n email: address.email,\n defaultBilling: address.default_billing,\n defaultShipping: address.default_shipping,\n});\n","import { DaffCustomer } from '@daffodil/customer';\n\nimport { magentoCustomerAddressTransform } from './customer-address';\nimport { MagentoCustomer } from '../../models/public_api';\n\nexport const magentoCustomerTransform = (customer: MagentoCustomer): DaffCustomer => ({\n id: customer.email,\n email: customer.email,\n firstName: customer.firstname,\n lastName: customer.lastname,\n isSubscribed: customer.is_subscribed,\n addresses: customer.addresses.map(magentoCustomerAddressTransform),\n});\n","export enum MagentoCustomerGender {\n MALE = 1,\n FEMALE = 2\n}\n","import { gql } from 'apollo-angular';\n\nexport const magentoCustomerAddressFragment = gql`\n fragment magentoCustomerAddress on CustomerAddress {\n id\n city\n country_code\n firstname\n lastname\n postcode\n region {\n region_code\n region_id\n }\n street\n telephone\n company\n default_billing\n default_shipping\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './customer-address';\n\nexport const magentoCustomerFragment = gql`\n fragment magentoCustomer on Customer {\n email\n firstname\n lastname\n is_subscribed\n addresses {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_QUERY_NAME = 'MagentoGetCustomer';\n\nexport const getCustomer = gql`\n query ${MAGENTO_GET_CUSTOMER_QUERY_NAME} {\n customer {\n ...magentoCustomer\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME = 'MagentoGetCustomerAddresses';\n\nexport const getCustomerAddresses = gql`\n query ${MAGENTO_GET_CUSTOMER_ADDRESSES_QUERY_NAME} {\n customer {\n addresses {\n ...magentoCustomerAddress\n }\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const createCustomerAddress = gql`\n mutation MagentoCreateCustomerAddress($input: CustomerAddressInput!) {\n createCustomerAddress(input: $input) {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerAddressFragment } from './fragments/public_api';\n\nexport const updateCustomerAddress = gql`\n mutation MagentoUpdateCustomerAddress($id: Int!, $input: CustomerAddressInput!) {\n updateCustomerAddress(id: $id, input: $input) {\n ...magentoCustomerAddress\n }\n }\n ${magentoCustomerAddressFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nexport const deleteCustomerAddress = gql`\n mutation MagentoDeleteCustomerAddress($id: Int!) {\n deleteCustomerAddress(id: $id)\n }\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_UPDATE_CUSTOMER_QUERY_NAME = 'MagentoUpdateCustomer';\n\nexport const updateCustomer = gql`\n mutation ${MAGENTO_UPDATE_CUSTOMER_QUERY_NAME}($customer: CustomerUpdateInput!) {\n updateCustomerV2(input: $customer) {\n customer {\n ...magentoCustomer\n }\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nimport { magentoCustomerFragment } from './fragments/public_api';\n\nexport const MAGENTO_UPDATE_EMAIL_QUERY_NAME = 'MagentoUpdateEmail';\n\nexport const updateEmail = gql`\n mutation ${MAGENTO_UPDATE_EMAIL_QUERY_NAME}($email: String!, $password: String!) {\n updateCustomerEmail(email: $email, password: $password) {\n customer {\n ...magentoCustomer\n }\n }\n }\n ${magentoCustomerFragment}\n`;\n","import { gql } from 'apollo-angular';\n\nexport const MAGENTO_CHANGE_PASSWORD_QUERY_NAME = 'MagentoChangePassword';\n\nexport const changePassword = gql`\n mutation ${MAGENTO_CHANGE_PASSWORD_QUERY_NAME}($old: String!, $new: String!) {\n changeCustomerPassword(\n currentPassword: $old\n newPassword: $new\n ) {\n email\n }\n }\n`;\n","import { DaffCustomerDriverErrorCodes } from '@daffodil/customer/driver';\n\nexport const DaffCustomerMagentoErrorMessageRegexMap = {\n [DaffCustomerDriverErrorCodes.DEFAULT_SHIPPING_ADDRESS_DELETION]: /is set as default shipping address and can not be deleted/,\n [DaffCustomerDriverErrorCodes.DEFAULT_BILLING_ADDRESS_DELETION]: /is set as default billing address and can not be deleted/,\n};\n","import { CombinedGraphQLErrors } from '@apollo/client';\nimport { GraphQLFormattedError } from 'graphql';\n\nimport { DaffError } from '@daffodil/core';\nimport {\n DaffCustomerDriverErrorMap,\n DaffCustomerInvalidAPIResponseError,\n} from '@daffodil/customer/driver';\nimport { daffTransformMagentoError } from '@daffodil/driver/magento';\n\nimport { DaffCustomerMagentoErrorMessageRegexMap } from './map';\n\n/**\n * Transforms a single GraphQL error.\n * Optionally accepts a request payload which can be used in certain cases\n * to add supplemental info to the error.\n */\nexport function transformMagentoCartGraphQlError(error: GraphQLFormattedError, requestPayload?: unknown): DaffError {\n // TODO: readdress this when we move to eslint\n // eslint-disable-next-line\n for (const code in DaffCustomerMagentoErrorMessageRegexMap) {\n const matchIndex = error.message.search(DaffCustomerMagentoErrorMessageRegexMap[code]);\n\n if (matchIndex > -1 && DaffCustomerDriverErrorMap[code]) {\n const errObj = new DaffCustomerDriverErrorMap[code](error.message);\n\n return errObj;\n }\n }\n\n return daffTransformMagentoError(error, {});\n}\n\nexport function transformMagentoReviewsError(error: any, requestPayload?: unknown) {\n if (CombinedGraphQLErrors.is(error)) {\n return transformMagentoCartGraphQlError(error.errors[0], requestPayload);\n } else {\n return daffTransformMagentoError(error, {}) || new DaffCustomerInvalidAPIResponseError(error.message);\n }\n}\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoGetCustomerResponse } from '../models/public_api';\n\nexport const validateGetCustomerResponse = (response: Apollo.QueryResult<MagentoGetCustomerResponse>) => {\n if (response.data.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoChangeEmailResponse } from '../models/public_api';\n\nexport const validateChangeEmailResponse = (response: Apollo.QueryResult<MagentoChangeEmailResponse>) => {\n if (response.data.updateCustomerEmail.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update email response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoChangePasswordResponse } from '../models/public_api';\n\nexport const validateChangePasswordResponse = (response: Apollo.QueryResult<MagentoChangePasswordResponse>) => {\n if (response.data.changeCustomerPassword?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Change password response does not contain a valid customer.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoGetCustomerAddressesResponse } from '../models/public_api';\n\nexport const validateGetCustomerAddressesResponse = (response: Apollo.QueryResult<MagentoGetCustomerAddressesResponse>) => {\n if (response.data.customer?.addresses) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Get customer address response does not contain addresses.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoCreateCustomerAddressResponse } from '../models/public_api';\n\nexport const validateCreateCustomerAddressResponse = (response: Apollo.QueryResult<MagentoCreateCustomerAddressResponse>) => {\n if (response.data.createCustomerAddress?.id) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Create customer address response does not contain an address.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoUpdateCustomerAddressResponse } from '../models/public_api';\n\nexport const validateUpdateCustomerAddressResponse = (response: Apollo.QueryResult<MagentoUpdateCustomerAddressResponse>) => {\n if (response.data.updateCustomerAddress?.id) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update customer address response does not contain an address.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoDeleteCustomerAddressResponse } from '../models/public_api';\n\nexport const validateDeleteCustomerAddressResponse = (response: Apollo.QueryResult<MagentoDeleteCustomerAddressResponse>) => {\n if (response.data.deleteCustomerAddress) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Delete customer address did not complete successfully.');\n }\n};\n","import { Apollo } from 'apollo-angular';\n\nimport { DaffCustomerInvalidAPIResponseError } from '@daffodil/customer/driver';\n\nimport { MagentoUpdateCustomerResponse } from '../models/public_api';\n\nexport const validateUpdateCustomerResponse = (response: Apollo.QueryResult<MagentoUpdateCustomerResponse>) => {\n if (response.data.updateCustomerV2.customer?.email) {\n return response;\n } else {\n throw new DaffCustomerInvalidAPIResponseError('Update customer response does not contain a valid customer.');\n }\n};\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n} from 'rxjs/operators';\n\nimport { DaffCustomer } from '@daffodil/customer';\nimport { DaffCustomerDriverInterface } from '@daffodil/customer/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport {\n MagentoChangeEmailResponse,\n MagentoChangePasswordResponse,\n MagentoGetCustomerResponse,\n MagentoUpdateCustomerResponse,\n} from './models/public_api';\nimport {\n changePassword,\n getCustomer,\n updateCustomer,\n updateEmail,\n} from './queries/public_api';\nimport {\n magentoCustomerInputTransform,\n magentoCustomerTransform,\n} from './transforms/public_api';\nimport { validateChangeEmailResponse } from './validators/change-email';\nimport { validateChangePasswordResponse } from './validators/change-password';\nimport { validateGetCustomerResponse } from './validators/public_api';\nimport { validateUpdateCustomerResponse } from './validators/update-customer';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerMagentoService implements DaffCustomerDriverInterface {\n constructor(\n private apollo: Apollo,\n ) {}\n\n changeEmail(email: string, password: string): Observable<DaffCustomer> {\n return this.apollo.mutate<MagentoChangeEmailResponse>({\n mutation: updateEmail,\n variables: {\n email,\n password,\n },\n }).pipe(\n map(validateChangeEmailResponse),\n map(result => magentoCustomerTransform(result.data.updateCustomerEmail.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n changePassword(oldPassword: string, newPassword: string): Observable<void> {\n return this.apollo.mutate<MagentoChangePasswordResponse>({\n mutation: changePassword,\n variables: {\n old: oldPassword,\n new: newPassword,\n },\n }).pipe(\n map(validateChangePasswordResponse),\n map(() => undefined),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n get(): Observable<DaffCustomer> {\n return this.apollo.query<MagentoGetCustomerResponse>({\n query: getCustomer,\n }).pipe(\n map(validateGetCustomerResponse),\n map(result => magentoCustomerTransform(result.data.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n update(customer: Partial<DaffCustomer>): Observable<DaffCustomer> {\n return this.apollo.mutate<MagentoUpdateCustomerResponse>({\n mutation: updateCustomer,\n variables: {\n customer: magentoCustomerInputTransform(customer),\n },\n }).pipe(\n map(validateUpdateCustomerResponse),\n map(result => magentoCustomerTransform(result.data.updateCustomerV2.customer)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n}\n","import { Injectable } from '@angular/core';\nimport { Apollo } from 'apollo-angular';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n map,\n catchError,\n switchMap,\n} from 'rxjs/operators';\n\nimport { DaffIdentifiable } from '@daffodil/core';\nimport { DaffQueuedApollo } from '@daffodil/core/graphql';\nimport { DaffCustomerAddress } from '@daffodil/customer';\nimport {\n DaffCustomerAddressDriverInterface,\n DaffCustomerAddressNotFoundError,\n} from '@daffodil/customer/driver';\n\nimport { transformMagentoReviewsError } from './errors/transform';\nimport {\n MagentoCreateCustomerAddressResponse,\n MagentoDeleteCustomerAddressResponse,\n MagentoGetCustomerAddressesResponse,\n MagentoUpdateCustomerAddressResponse,\n} from './models/public_api';\nimport {\n createCustomerAddress,\n deleteCustomerAddress,\n getCustomerAddresses,\n updateCustomerAddress,\n} from './queries/public_api';\nimport {\n magentoCustomerAddressInputTransform,\n magentoCustomerAddressTransform,\n} from './transforms/public_api';\nimport {\n validateCreateCustomerAddressResponse,\n validateDeleteCustomerAddressResponse,\n validateGetCustomerAddressesResponse,\n validateUpdateCustomerAddressResponse,\n} from './validators/public_api';\n\n/**\n * A service for making Magento GraphQL queries for customers.\n *\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCustomerMagentoAddressService implements DaffCustomerAddressDriverInterface {\n constructor(\n private apollo: Apollo,\n private mutationQueue: DaffQueuedApollo,\n ) {}\n\n add(address: DaffCustomerAddress): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoCreateCustomerAddressResponse>({\n mutation: createCustomerAddress,\n variables: {\n input: magentoCustomerAddressInputTransform(address),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: () => true,\n }).pipe(\n map(validateCreateCustomerAddressResponse),\n // magento doesn't return address collection so make an additional request >:(\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n delete(addressId: DaffCustomerAddress['id']): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoDeleteCustomerAddressResponse>({\n mutation: deleteCustomerAddress,\n variables: {\n id: Number(addressId),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: (query) => true,\n }).pipe(\n map(validateDeleteCustomerAddressResponse),\n // magento doesn't return address collection so make an additional request >:(\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n list(): Observable<DaffCustomerAddress[]> {\n return this.listAddresses().pipe(\n map((response) => response.data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n get(addressId: DaffCustomerAddress['id']): Observable<DaffCustomerAddress> {\n return this.listAddresses().pipe(\n map(({ data }) => {\n const address = data.customer.addresses.find(({ id }) => String(id) === addressId);\n if (!address) {\n throw new DaffCustomerAddressNotFoundError(`Could not find an address with ID: ${addressId}`);\n }\n return address;\n }),\n map(address => magentoCustomerAddressTransform(address)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n update(address: Partial<DaffCustomerAddress> & DaffIdentifiable): Observable<DaffCustomerAddress[]> {\n return this.mutationQueue.mutate<MagentoUpdateCustomerAddressResponse>({\n mutation: updateCustomerAddress,\n variables: {\n id: Number(address.id),\n input: magentoCustomerAddressInputTransform(address),\n },\n refetchQueries: [{\n query: getCustomerAddresses,\n }],\n onQueryUpdated: (query) => true,\n }).pipe(\n map(validateUpdateCustomerAddressResponse),\n switchMap(() => this.listAddresses()),\n map(({ data }) => data.customer.addresses.map(magentoCustomerAddressTransform)),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n\n protected listAddresses(): Observable<Apollo.QueryResult<MagentoGetCustomerAddressesResponse>> {\n return this.apollo.query<MagentoGetCustomerAddressesResponse>({\n query: getCustomerAddresses,\n }).pipe(\n map(validateGetCustomerAddressesResponse),\n catchError(err => throwError(() => transformMagentoReviewsError(err))),\n );\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n provideDaffCustomerAddressDriver,\n provideDaffCustomerDriver,\n} from '@daffodil/customer/driver';\n\nimport { DaffCustomerMagentoAddressService } from './address.service';\nimport { DaffCustomerMagentoService } from './customer.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCustomerMagentoDriverModule {\n static forRoot(): ModuleWithProviders<DaffCustomerMagentoDriverModule> {\n return {\n ngModule: DaffCustomerMagentoDriverModule,\n providers: [\n provideDaffCustomerDriver(DaffCustomerMagentoService),\n provideDaffCustomerAddressDriver(DaffCustomerMagentoAddressService),\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;MAIa,6BAA6B,GAAG,CAAC,QAA+B,MAA4B;IACvG,SAAS,EAAE,QAAQ,CAAC,SAAS;IAC7B,QAAQ,EAAE,QAAQ,CAAC,QAAQ;IAC3B,aAAa,EAAE,QAAQ,CAAC,YAAY;AACrC,CAAA;;MCJY,oCAAoC,GAAG,CAAC,OAAqC,MAAmC;IAC3H,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,YAAY,EAAE,OAAO,CAAC,OAAO;IAC7B,UAAU,EAAE,OAAO,CAAC,OAAO;IAC3B,eAAe,EAAE,OAAO,CAAC,cAAc;IACvC,gBAAgB,EAAE,OAAO,CAAC,eAAe;IACzC,SAAS,EAAE,OAAO,CAAC,SAAS;IAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ;IAC1B,UAAU,EAAE,OA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wBACP,YAAY;AACb,qBAAA;AACF,iBAAA;;;AClBD;;AAEG;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-customer.mjs","sources":["../../../libs/customer/src/daffodil-customer.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;AAEG"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { DaffModelFactory } from '@daffodil/core/testing';
|
|
2
|
-
import { MagentoCustomerAddress, MagentoCustomer } from '@daffodil/customer/driver/magento';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
|
|
5
|
-
declare class MockMagentoCustomerAddress implements MagentoCustomerAddress {
|
|
6
|
-
__typename: string;
|
|
7
|
-
id: number;
|
|
8
|
-
region: {
|
|
9
|
-
__typename: string;
|
|
10
|
-
region_code: string;
|
|
11
|
-
region_id: number;
|
|
12
|
-
};
|
|
13
|
-
country_code: string;
|
|
14
|
-
street: string[];
|
|
15
|
-
company: string;
|
|
16
|
-
telephone: string;
|
|
17
|
-
postcode: string;
|
|
18
|
-
city: string;
|
|
19
|
-
firstname: string;
|
|
20
|
-
lastname: string;
|
|
21
|
-
email: string;
|
|
22
|
-
default_billing: boolean;
|
|
23
|
-
default_shipping: boolean;
|
|
24
|
-
}
|
|
25
|
-
declare class MagentoCustomerAddressFactory extends DaffModelFactory<MagentoCustomerAddress> {
|
|
26
|
-
constructor();
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MagentoCustomerAddressFactory, never>;
|
|
28
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MagentoCustomerAddressFactory>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare class MagentoCustomerFactory extends DaffModelFactory<MagentoCustomer> {
|
|
32
|
-
constructor(addressFactory: MagentoCustomerAddressFactory);
|
|
33
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MagentoCustomerFactory, never>;
|
|
34
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<MagentoCustomerFactory>;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { MagentoCustomerAddressFactory, MagentoCustomerFactory, MockMagentoCustomerAddress };
|