@daffodil/cart 0.48.1 → 0.49.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/magento/cart.service.d.ts +2 -1
- package/driver/magento/public_api.d.ts +3 -1
- package/esm2020/driver/magento/cart.service.mjs +2 -2
- package/esm2020/driver/magento/public_api.mjs +4 -2
- package/fesm2015/daffodil-cart-driver-magento.mjs +57 -57
- package/fesm2015/daffodil-cart-driver-magento.mjs.map +1 -1
- package/fesm2020/daffodil-cart-driver-magento.mjs +55 -55
- package/fesm2020/daffodil-cart-driver-magento.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -7,11 +7,11 @@ import * as i1 from 'apollo-angular';
|
|
|
7
7
|
import { gql, Apollo } from 'apollo-angular';
|
|
8
8
|
import * as i5 from '@daffodil/core/graphql';
|
|
9
9
|
import { daffBuildFragmentNameSpread, daffBuildFragmentDefinition, DaffQueuedApollo } from '@daffodil/core/graphql';
|
|
10
|
-
import { forkJoin, throwError } from 'rxjs';
|
|
11
|
-
import { map, switchMap, catchError } from 'rxjs/operators';
|
|
12
10
|
import { DaffCartNotFoundError, DaffUnauthorizedForCartError, DaffCartDriverErrorCodes, DaffCartDriverErrorMap, DaffInvalidCouponCodeError, DaffProductOutOfStockError, DaffCartItemDriver, DaffCartDriver, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartShippingAddressDriver, DaffCartShippingMethodsDriver, DaffCartShippingInformationDriver, DaffCartPaymentDriver, DaffCartPaymentMethodsDriver, DaffCartOrderDriver, DaffCartCouponDriver } from '@daffodil/cart/driver';
|
|
13
11
|
import { daffMagentoTransformGraphQlError, daffTransformMagentoError } from '@daffodil/driver/magento';
|
|
14
12
|
import { DaffBadInputError } from '@daffodil/driver';
|
|
13
|
+
import { forkJoin, throwError } from 'rxjs';
|
|
14
|
+
import { map, switchMap, catchError } from 'rxjs/operators';
|
|
15
15
|
import { CommonModule } from '@angular/common';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -1757,6 +1757,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
1757
1757
|
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1758
1758
|
}] }, { type: DaffMagentoCartPaymentTransformer }]; } });
|
|
1759
1759
|
|
|
1760
|
+
/**
|
|
1761
|
+
* A service for making Magento GraphQL queries for carts.
|
|
1762
|
+
*
|
|
1763
|
+
* @inheritdoc
|
|
1764
|
+
*/
|
|
1765
|
+
class DaffMagentoCartAddressService {
|
|
1766
|
+
constructor(mutationQueue, extraCartFragments, cartTransformer, cartAddressInputTransformer) {
|
|
1767
|
+
this.mutationQueue = mutationQueue;
|
|
1768
|
+
this.extraCartFragments = extraCartFragments;
|
|
1769
|
+
this.cartTransformer = cartTransformer;
|
|
1770
|
+
this.cartAddressInputTransformer = cartAddressInputTransformer;
|
|
1771
|
+
}
|
|
1772
|
+
update(cartId, address) {
|
|
1773
|
+
return address.email ? this.updateAddressWithEmail(cartId, address) : this.updateAddress(cartId, address);
|
|
1774
|
+
}
|
|
1775
|
+
updateAddress(cartId, address) {
|
|
1776
|
+
return this.mutationQueue.mutate({
|
|
1777
|
+
mutation: updateAddress(this.extraCartFragments),
|
|
1778
|
+
variables: {
|
|
1779
|
+
cartId,
|
|
1780
|
+
address: this.cartAddressInputTransformer.transform(address),
|
|
1781
|
+
},
|
|
1782
|
+
fetchPolicy: 'network-only',
|
|
1783
|
+
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setShippingAddressesOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1784
|
+
}
|
|
1785
|
+
updateAddressWithEmail(cartId, address) {
|
|
1786
|
+
return this.mutationQueue.mutate({
|
|
1787
|
+
mutation: updateAddressWithEmail(this.extraCartFragments),
|
|
1788
|
+
variables: {
|
|
1789
|
+
cartId,
|
|
1790
|
+
email: address.email,
|
|
1791
|
+
address: this.cartAddressInputTransformer.transform(address),
|
|
1792
|
+
},
|
|
1793
|
+
fetchPolicy: 'network-only',
|
|
1794
|
+
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setGuestEmailOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
/** @nocollapse */ DaffMagentoCartAddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, deps: [{ token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1798
|
+
/** @nocollapse */ DaffMagentoCartAddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, providedIn: 'root' });
|
|
1799
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, decorators: [{
|
|
1800
|
+
type: Injectable,
|
|
1801
|
+
args: [{
|
|
1802
|
+
providedIn: 'root',
|
|
1803
|
+
}]
|
|
1804
|
+
}], ctorParameters: function () { return [{ type: i5.DaffQueuedApollo, decorators: [{
|
|
1805
|
+
type: Inject,
|
|
1806
|
+
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
1807
|
+
}] }, { type: undefined, decorators: [{
|
|
1808
|
+
type: Inject,
|
|
1809
|
+
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1810
|
+
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartAddressInputTransformer }]; } });
|
|
1811
|
+
|
|
1760
1812
|
/**
|
|
1761
1813
|
* A service for making Magento GraphQL queries for carts.
|
|
1762
1814
|
*
|
|
@@ -1998,58 +2050,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
1998
2050
|
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
1999
2051
|
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartShippingRateTransformer }, { type: DaffMagentoShippingMethodInputTransformer }]; } });
|
|
2000
2052
|
|
|
2001
|
-
/**
|
|
2002
|
-
* A service for making Magento GraphQL queries for carts.
|
|
2003
|
-
*
|
|
2004
|
-
* @inheritdoc
|
|
2005
|
-
*/
|
|
2006
|
-
class DaffMagentoCartAddressService {
|
|
2007
|
-
constructor(mutationQueue, extraCartFragments, cartTransformer, cartAddressInputTransformer) {
|
|
2008
|
-
this.mutationQueue = mutationQueue;
|
|
2009
|
-
this.extraCartFragments = extraCartFragments;
|
|
2010
|
-
this.cartTransformer = cartTransformer;
|
|
2011
|
-
this.cartAddressInputTransformer = cartAddressInputTransformer;
|
|
2012
|
-
}
|
|
2013
|
-
update(cartId, address) {
|
|
2014
|
-
return address.email ? this.updateAddressWithEmail(cartId, address) : this.updateAddress(cartId, address);
|
|
2015
|
-
}
|
|
2016
|
-
updateAddress(cartId, address) {
|
|
2017
|
-
return this.mutationQueue.mutate({
|
|
2018
|
-
mutation: updateAddress(this.extraCartFragments),
|
|
2019
|
-
variables: {
|
|
2020
|
-
cartId,
|
|
2021
|
-
address: this.cartAddressInputTransformer.transform(address),
|
|
2022
|
-
},
|
|
2023
|
-
fetchPolicy: 'network-only',
|
|
2024
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setShippingAddressesOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
2025
|
-
}
|
|
2026
|
-
updateAddressWithEmail(cartId, address) {
|
|
2027
|
-
return this.mutationQueue.mutate({
|
|
2028
|
-
mutation: updateAddressWithEmail(this.extraCartFragments),
|
|
2029
|
-
variables: {
|
|
2030
|
-
cartId,
|
|
2031
|
-
email: address.email,
|
|
2032
|
-
address: this.cartAddressInputTransformer.transform(address),
|
|
2033
|
-
},
|
|
2034
|
-
fetchPolicy: 'network-only',
|
|
2035
|
-
}).pipe(map(resp => this.cartTransformer.transform(resp.data.setGuestEmailOnCart.cart)), catchError(error => throwError(() => transformCartMagentoError(error))));
|
|
2036
|
-
}
|
|
2037
|
-
}
|
|
2038
|
-
/** @nocollapse */ DaffMagentoCartAddressService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, deps: [{ token: DAFF_MAGENTO_CART_MUTATION_QUEUE }, { token: DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS }, { token: DaffMagentoCartTransformer }, { token: DaffMagentoCartAddressInputTransformer }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2039
|
-
/** @nocollapse */ DaffMagentoCartAddressService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, providedIn: 'root' });
|
|
2040
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: DaffMagentoCartAddressService, decorators: [{
|
|
2041
|
-
type: Injectable,
|
|
2042
|
-
args: [{
|
|
2043
|
-
providedIn: 'root',
|
|
2044
|
-
}]
|
|
2045
|
-
}], ctorParameters: function () { return [{ type: i5.DaffQueuedApollo, decorators: [{
|
|
2046
|
-
type: Inject,
|
|
2047
|
-
args: [DAFF_MAGENTO_CART_MUTATION_QUEUE]
|
|
2048
|
-
}] }, { type: undefined, decorators: [{
|
|
2049
|
-
type: Inject,
|
|
2050
|
-
args: [DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS]
|
|
2051
|
-
}] }, { type: DaffMagentoCartTransformer }, { type: DaffMagentoCartAddressInputTransformer }]; } });
|
|
2052
|
-
|
|
2053
2053
|
/**
|
|
2054
2054
|
* Transforms magento carts into an object usable by daffodil.
|
|
2055
2055
|
*/
|
|
@@ -2283,5 +2283,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImpor
|
|
|
2283
2283
|
* Generated bundle index. Do not edit.
|
|
2284
2284
|
*/
|
|
2285
2285
|
|
|
2286
|
-
export { DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS, DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS, DaffCartMagentoDriverModule, DaffMagentoBillingAddressInputTransformer, DaffMagentoBillingAddressTransformer, DaffMagentoCartAddressInputTransformer, DaffMagentoCartAddressTransformer, DaffMagentoCartBillingAddressService, DaffMagentoCartItemService, DaffMagentoCartItemUpdateInputTransformer, DaffMagentoCartPaymentMethodsService, DaffMagentoCartPaymentService, DaffMagentoCartPaymentTransformer, DaffMagentoCartService, DaffMagentoCartShippingAddressService, DaffMagentoCartShippingInformationService, DaffMagentoCartShippingInformationTransformer, DaffMagentoCartShippingMethodsService, DaffMagentoCartShippingRateTransformer, DaffMagentoCartTransformer, DaffMagentoPaymentMethodInputTransformer, DaffMagentoShippingAddressInputTransformer, DaffMagentoShippingAddressTransformer, DaffMagentoShippingMethodInputTransformer, MagentoCartItemTypeEnum, addCartItem, applyCoupon, availablePaymentMethodFragment, availableShippingMethodFragment, cartAddressFragment, cartCouponFragment, cartFragment, cartItemFragment, createCart, daffProvideCartMagentoCartItemTransforms, getBillingAddress, getCart, getSelectedPaymentMethod, getSelectedShippingMethod, getShippingAddress, listCartCoupons, listCartItems, listPaymentMethods, listShippingMethods, magentoMergeCartsMutation, moneyFragment, placeOrder, pricesFragment, removeAllCoupons, removeCartItem, selectedPaymentMethodFragment, selectedShippingMethodFragment, setSelectedPaymentMethod, setSelectedPaymentMethodWithBilling, setSelectedPaymentMethodWithBillingAndEmail, setSelectedShippingMethod, updateAddress, updateAddressWithEmail, updateBillingAddress, updateBillingAddressWithEmail, updateCartItem, updateShippingAddress, updateShippingAddressWithEmail };
|
|
2286
|
+
export { DAFF_CART_MAGENTO_CART_ITEM_TRANSFORMS, DAFF_CART_MAGENTO_EXTRA_CART_FRAGMENTS, DAFF_MAGENTO_GET_RECOVERABLE_ERRORS, DaffCartMagentoDriverModule, DaffMagentoBillingAddressInputTransformer, DaffMagentoBillingAddressTransformer, DaffMagentoCartAddressInputTransformer, DaffMagentoCartAddressService, DaffMagentoCartAddressTransformer, DaffMagentoCartBillingAddressService, DaffMagentoCartItemService, DaffMagentoCartItemUpdateInputTransformer, DaffMagentoCartPaymentMethodsService, DaffMagentoCartPaymentService, DaffMagentoCartPaymentTransformer, DaffMagentoCartService, DaffMagentoCartShippingAddressService, DaffMagentoCartShippingInformationService, DaffMagentoCartShippingInformationTransformer, DaffMagentoCartShippingMethodsService, DaffMagentoCartShippingRateTransformer, DaffMagentoCartTransformer, DaffMagentoPaymentMethodInputTransformer, DaffMagentoShippingAddressInputTransformer, DaffMagentoShippingAddressTransformer, DaffMagentoShippingMethodInputTransformer, MagentoCartItemTypeEnum, addCartItem, applyCoupon, availablePaymentMethodFragment, availableShippingMethodFragment, cartAddressFragment, cartCouponFragment, cartFragment, cartItemFragment, createCart, daffProvideCartMagentoCartItemTransforms, getBillingAddress, getCart, getSelectedPaymentMethod, getSelectedShippingMethod, getShippingAddress, listCartCoupons, listCartItems, listPaymentMethods, listShippingMethods, magentoMergeCartsMutation, moneyFragment, placeOrder, pricesFragment, removeAllCoupons, removeCartItem, selectedPaymentMethodFragment, selectedShippingMethodFragment, setSelectedPaymentMethod, setSelectedPaymentMethodWithBilling, setSelectedPaymentMethodWithBillingAndEmail, setSelectedShippingMethod, transformMagentoCartGraphQlError, updateAddress, updateAddressWithEmail, updateBillingAddress, updateBillingAddressWithEmail, updateCartItem, updateShippingAddress, updateShippingAddressWithEmail };
|
|
2287
2287
|
//# sourceMappingURL=daffodil-cart-driver-magento.mjs.map
|