@daffodil/cart 0.60.0 → 0.61.0
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/driver/in-memory/package.json +1 -1
- package/driver/magento/package.json +1 -1
- package/driver/magento/testing/package.json +1 -1
- package/driver/operators/handle-cart-not-found.d.ts +8 -0
- package/driver/operators/public_api.d.ts +1 -0
- package/driver/package.json +1 -1
- package/driver/public_api.d.ts +2 -0
- package/driver/services/public_api.d.ts +1 -0
- package/driver/services/resolve.service.d.ts +25 -0
- package/driver/testing/package.json +1 -1
- package/esm2020/driver/magento/cart.service.mjs +11 -5
- package/esm2020/driver/operators/handle-cart-not-found.mjs +17 -0
- package/esm2020/driver/operators/public_api.mjs +2 -0
- package/esm2020/driver/public_api.mjs +3 -1
- package/esm2020/driver/services/public_api.mjs +2 -0
- package/esm2020/driver/services/resolve.service.mjs +46 -0
- package/esm2020/routing/cart-routing.module.mjs +4 -2
- package/esm2020/routing/guards/public_api.mjs +3 -1
- package/esm2020/routing/guards/resolve-cart/redirect.token.mjs +3 -0
- package/esm2020/routing/guards/resolve-cart/resolve-cart.guard.mjs +58 -0
- package/esm2020/state/effects/cart-item.effects.mjs +15 -7
- package/esm2020/state/effects/cart-resolver.effects.mjs +18 -28
- package/esm2020/state/reducers/cart/cart.reducer.mjs +4 -4
- package/esm2020/state/reducers/cart-billing-address/cart-billing-address.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-coupon/cart-coupon.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-initial-state.mjs +2 -2
- package/esm2020/state/reducers/cart-item/cart-item.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-payment/cart-payment.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-payment-methods/cart-payment-methods.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-resolve/cart-resolve.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-shipping-address/cart-shipping-address.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-shipping-information/cart-shipping-information.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart-shipping-methods/cart-shipping-methods.reducer.mjs +3 -3
- package/esm2020/state/reducers/cart.reducer.mjs +3 -3
- package/esm2020/state/reducers/public_api.mjs +3 -2
- package/fesm2015/daffodil-cart-driver-magento.mjs +10 -4
- package/fesm2015/daffodil-cart-driver-magento.mjs.map +1 -1
- package/fesm2015/daffodil-cart-driver.mjs +61 -2
- package/fesm2015/daffodil-cart-driver.mjs.map +1 -1
- package/fesm2015/daffodil-cart-routing.mjs +55 -1
- package/fesm2015/daffodil-cart-routing.mjs.map +1 -1
- package/fesm2015/daffodil-cart-state.mjs +42 -45
- package/fesm2015/daffodil-cart-state.mjs.map +1 -1
- package/fesm2020/daffodil-cart-driver-magento.mjs +10 -4
- package/fesm2020/daffodil-cart-driver-magento.mjs.map +1 -1
- package/fesm2020/daffodil-cart-driver.mjs +59 -2
- package/fesm2020/daffodil-cart-driver.mjs.map +1 -1
- package/fesm2020/daffodil-cart-routing.mjs +53 -1
- package/fesm2020/daffodil-cart-routing.mjs.map +1 -1
- package/fesm2020/daffodil-cart-state.mjs +42 -45
- package/fesm2020/daffodil-cart-state.mjs.map +1 -1
- package/package.json +1 -1
- package/routing/guards/public_api.d.ts +2 -0
- package/routing/guards/resolve-cart/redirect.token.d.ts +2 -0
- package/routing/guards/resolve-cart/resolve-cart.guard.d.ts +24 -0
- package/routing/package.json +1 -1
- package/state/effects/cart-item.effects.d.ts +9 -7
- package/state/effects/cart-resolver.effects.d.ts +3 -2
- package/state/package.json +1 -1
- package/state/reducers/cart-initial-state.d.ts +1 -1
- package/state/reducers/public_api.d.ts +2 -1
- package/state/testing/package.json +1 -1
- package/testing/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition, DaffQueuedApo
|
|
|
11
11
|
import { DaffCartNotFoundError, DaffUnauthorizedForCartError, DaffCartDriverErrorCodes, DaffProductOutOfStockError, DaffCartInvalidAPIResponseError, DaffCartDriverErrorMap, DaffInvalidCouponCodeError, DaffCartItemDriver, DaffCartDriver, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartShippingAddressDriver, DaffCartShippingMethodsDriver, DaffCartShippingInformationDriver, DaffCartPaymentDriver, DaffCartPaymentMethodsDriver, DaffCartOrderDriver, DaffCartCouponDriver, daffCartDriverProvideFreePaymentMethod } from '@daffodil/cart/driver';
|
|
12
12
|
import { DaffBadInputError } from '@daffodil/driver';
|
|
13
13
|
import { DaffProductNotFoundError } from '@daffodil/product/driver';
|
|
14
|
-
import {
|
|
14
|
+
import { of, throwError, forkJoin } from 'rxjs';
|
|
15
15
|
import { map, switchMap, catchError } from 'rxjs/operators';
|
|
16
16
|
import { CommonModule } from '@angular/common';
|
|
17
17
|
|
|
@@ -1496,12 +1496,14 @@ class DaffMagentoCartService {
|
|
|
1496
1496
|
response: data ? this.cartTransformer.transform(data.cart) : undefined,
|
|
1497
1497
|
errors: errors?.map(e => {
|
|
1498
1498
|
const error = transformMagentoCartGraphQlError(e);
|
|
1499
|
-
if (DAFF_MAGENTO_GET_RECOVERABLE_ERRORS.
|
|
1499
|
+
if (DAFF_MAGENTO_GET_RECOVERABLE_ERRORS.find(klass => error instanceof klass)) {
|
|
1500
1500
|
error.recoverable = true;
|
|
1501
1501
|
}
|
|
1502
1502
|
return error;
|
|
1503
1503
|
}) || [],
|
|
1504
|
-
})))
|
|
1504
|
+
})), switchMap((resp) => resp.errors.reduce((acc, err) => acc && err.recoverable, true)
|
|
1505
|
+
? of(resp)
|
|
1506
|
+
: throwError(() => resp.errors.filter((err) => !err.recoverable)[0])));
|
|
1505
1507
|
}
|
|
1506
1508
|
create() {
|
|
1507
1509
|
return this.mutationQueue.mutate({ mutation: createCart }).pipe(map(result => ({ id: result.data.createEmptyCart })));
|
|
@@ -1519,6 +1521,8 @@ class DaffMagentoCartService {
|
|
|
1519
1521
|
source: guestCart,
|
|
1520
1522
|
destination: customerCart,
|
|
1521
1523
|
},
|
|
1524
|
+
errorPolicy: 'all',
|
|
1525
|
+
fetchPolicy: 'network-only',
|
|
1522
1526
|
}).pipe(map(({ data, errors }) => ({
|
|
1523
1527
|
response: data ? this.cartTransformer.transform(data.mergeCarts) : undefined,
|
|
1524
1528
|
errors: errors?.map(e => {
|
|
@@ -1528,7 +1532,9 @@ class DaffMagentoCartService {
|
|
|
1528
1532
|
}
|
|
1529
1533
|
return error;
|
|
1530
1534
|
}) || [],
|
|
1531
|
-
})))
|
|
1535
|
+
})), switchMap((resp) => resp.errors.reduce((acc, err) => acc && err.recoverable, true)
|
|
1536
|
+
? of(resp)
|
|
1537
|
+
: throwError(() => resp.errors.filter((err) => !err.recoverable)[0])));
|
|
1532
1538
|
}
|
|
1533
1539
|
;
|
|
1534
1540
|
}
|