@daffodil/cart 0.42.2 → 0.43.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/driver/errors/product-not-found.d.ts +2 -0
- package/esm2020/driver/errors/product-not-found.mjs +3 -1
- package/esm2020/driver/magento/cart-address.service.mjs +3 -1
- package/esm2020/driver/magento/cart-billing-address.service.mjs +4 -1
- package/esm2020/driver/magento/cart-coupon.service.mjs +4 -1
- package/esm2020/driver/magento/cart-item.service.mjs +5 -1
- package/esm2020/driver/magento/cart-order.service.mjs +2 -1
- package/esm2020/driver/magento/cart-payment-methods.service.mjs +2 -1
- package/esm2020/driver/magento/cart-payment.service.mjs +6 -1
- package/esm2020/driver/magento/cart-shipping-address.service.mjs +4 -1
- package/esm2020/driver/magento/cart-shipping-information.service.mjs +3 -1
- package/esm2020/driver/magento/cart-shipping-methods.service.mjs +2 -1
- package/esm2020/driver/magento/cart.service.mjs +2 -1
- package/esm2020/driver/magento/transforms/inputs/cart-address.service.mjs +6 -2
- package/fesm2015/daffodil-cart-driver-magento.mjs +31 -1
- package/fesm2015/daffodil-cart-driver-magento.mjs.map +1 -1
- package/fesm2015/daffodil-cart-driver.mjs +2 -0
- package/fesm2015/daffodil-cart-driver.mjs.map +1 -1
- package/fesm2020/daffodil-cart-driver-magento.mjs +31 -1
- package/fesm2020/daffodil-cart-driver-magento.mjs.map +1 -1
- package/fesm2020/daffodil-cart-driver.mjs +2 -0
- package/fesm2020/daffodil-cart-driver.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -133,6 +133,8 @@ class DaffCartItemExceedsMaxQtyError extends DaffInheritableError {
|
|
|
133
133
|
/**
|
|
134
134
|
* An error thrown when an add to cart request is sent
|
|
135
135
|
* for a product that cannot be found.
|
|
136
|
+
*
|
|
137
|
+
* @deprecated Use the `DaffProductNotFoundError` from `@daffodil/product/driver` instead.
|
|
136
138
|
*/
|
|
137
139
|
class DaffProductNotFoundError extends DaffInheritableError {
|
|
138
140
|
constructor(message) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-cart-driver.mjs","sources":["../../../libs/cart/driver/src/interfaces/cart-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-billing-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-coupon-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-item-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-payment-methods-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-payment-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-information-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-methods-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-order-service.interface.ts","../../../libs/cart/driver/src/interfaces/public_api.ts","../../../libs/cart/driver/src/errors/codes.enum.ts","../../../libs/cart/driver/src/errors/cart-not-found.ts","../../../libs/cart/driver/src/errors/expired-payment-token.ts","../../../libs/cart/driver/src/errors/invalid-api-response.ts","../../../libs/cart/driver/src/errors/invalid-country.ts","../../../libs/cart/driver/src/errors/invalid-coupon-code.ts","../../../libs/cart/driver/src/errors/invalid-email.ts","../../../libs/cart/driver/src/errors/invalid-region.ts","../../../libs/cart/driver/src/errors/item-exceeds-max-qty.ts","../../../libs/cart/driver/src/errors/product-not-found.ts","../../../libs/cart/driver/src/errors/product-out-of-stock.ts","../../../libs/cart/driver/src/errors/map.ts","../../../libs/cart/driver/src/daffodil-cart-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffDriverResponse } from '@daffodil/driver';\n\n/**\n * The interface responsible for managing a customer's cart.\n */\nexport interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {\n /**\n * Retrieve a cart\n */\n get(id: T['id']): Observable<DaffDriverResponse<T>>;\n\n /**\n * Creates a cart.\n */\n create(): Observable<{id: T['id']}>;\n\n /**\n * @deprecated\n * Prefer DaffCartItemServiceInterface.add\n *\n * Add an item to the cart.\n */\n addToCart(productId: string, qty: number): Observable<T>;\n\n /**\n * Remove all items from a cart.\n */\n clear(id: T['id']): Observable<Partial<T>>;\n}\n\nexport const DaffCartDriver = new InjectionToken<DaffCartServiceInterface>(\n 'DaffCartDriver',\n);\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the billing address of a cart.\n */\nexport interface DaffCartBillingAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Retrieve the billing address of a cart\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the billing address of a cart\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartBillingAddressDriver = new InjectionToken<\nDaffCartBillingAddressServiceInterface\n>('DaffCartBillingAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the address of a cart.\n */\nexport interface DaffCartAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Update the billing and shipping address of a cart\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartAddressDriver = new InjectionToken<\nDaffCartAddressServiceInterface\n>('DaffCartAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for applying a coupon to a cart.\n */\nexport interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart, V extends DaffCartCoupon = DaffCartCoupon> {\n /**\n * Apply a coupon to the cart and return a partial of the cart.\n */\n apply(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n /**\n * List coupon codes applied to a cart.\n */\n list(cartId: T['id']): Observable<V[]>;\n\n /**\n * Remove a coupon from the cart and return a partial of the cart.\n */\n remove(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n /**\n * Remove all coupons from the cart and return a partial of the cart.\n */\n removeAll(cartId: T['id']): Observable<Partial<T>>;\n}\n\nexport const DaffCartCouponDriver = new InjectionToken<DaffCartCouponServiceInterface>(\n 'DaffCartCouponDriver',\n);\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartItem,\n DaffCartItemInput,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the items of a cart.\n */\nexport interface DaffCartItemServiceInterface<\n T extends DaffCartItem = DaffCartItem,\n U extends DaffCartItemInput = DaffCartItemInput,\n V extends DaffCart = DaffCart\n> {\n /**\n * List all of the available items of a cart\n */\n list(cartId: V['id']): Observable<T[]>;\n\n /**\n * Get a specific cart item of a cart.\n */\n get(cartId: V['id'], item_id: DaffCartItem['id']): Observable<T>;\n\n /**\n * Add something to a cart.\n */\n add(id: V['id'], product: U): Observable<Partial<V>>;\n\n /**\n * Update an existing item in a cart\n */\n update(\n cartId: V['id'],\n itemId: T['id'],\n changes: Partial<T>,\n ): Observable<Partial<V>>;\n\n /**\n * Remove an item from a cart.\n */\n delete(cartId: V['id'], itemId: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartItemDriver = new InjectionToken<\nDaffCartItemServiceInterface\n>('DaffCartItemDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for retrieving the available payment methods of a cart.\n */\nexport interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymentMethod = DaffCartPaymentMethod> {\n /**\n * List the available payment methods of a cart.\n */\n list(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartPaymentMethodsDriver = new InjectionToken<\nDaffCartPaymentMethodsServiceInterface\n>('DaffCartPaymentMethodsDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the selected payment method of a cart.\n */\nexport interface DaffCartPaymentServiceInterface<\n T extends DaffCartPaymentMethod = DaffCartPaymentMethod,\n V extends DaffCart = DaffCart,\n R extends DaffCartAddress = DaffCartAddress\n> {\n /**\n * Get the currently applied payment method of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the payment method applied to a cart.\n */\n update(cartId: V['id'], payment: Partial<T>): Observable<Partial<V>>;\n\n /**\n * Update the billing address and payment method applied to a cart.\n */\n updateWithBilling(cartId: V['id'], payment: Partial<T>, address: Partial<R>): Observable<Partial<V>>;\n\n /**\n * Remove the payment method applied to a cart.\n */\n remove(cartId: V['id']): Observable<void>;\n}\n\nexport const DaffCartPaymentDriver = new InjectionToken<\nDaffCartPaymentServiceInterface\n>('DaffCartPaymentDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the shipping address of a cart.\n */\nexport interface DaffCartShippingAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Retrieve the shipping address of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the shipping address of a cart.\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingAddressDriver = new InjectionToken<\nDaffCartShippingAddressServiceInterface\n>('DaffCartShippingAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for mediating the interaction of the shipping\n * information of a cart with a given platform.\n */\nexport interface DaffCartShippingInformationServiceInterface<\n T extends DaffCartShippingRate = DaffCartShippingRate,\n V extends DaffCart = DaffCart\n>{\n /**\n * Get the currently selected shipping method of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the currently selected shipping method of a cart.\n */\n update(cartId: V['id'], shippingInfo: Partial<T>): Observable<Partial<V>>;\n\n /**\n * Remove the currently selected shipping method from a cart.\n */\n delete(cartId: V['id'], id?: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingInformationDriver = new InjectionToken<\nDaffCartShippingInformationServiceInterface\n>('DaffCartShippingInformationDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for retrieving the available shipping methods of a cart.\n */\nexport interface DaffCartShippingMethodsServiceInterface<\n T extends DaffCartShippingRate = DaffCartShippingRate\n> {\n /**\n * List the available shipping methods for a cart.\n */\n list(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartShippingMethodsDriver = new InjectionToken<\nDaffCartShippingMethodsServiceInterface\n>('DaffCartShippingMethodsDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for placing an order for the customer's cart.\n */\nexport interface DaffCartOrderServiceInterface<\n T extends DaffCart = DaffCart,\n V extends DaffCartPaymentMethod = DaffCartPaymentMethod,\n R extends DaffCartOrderResult = DaffCartOrderResult\n> {\n /**\n * Place an order and return the order ID.\n */\n placeOrder(id: T['id'], payment?: V): Observable<R>;\n}\n\nexport const DaffCartOrderDriver = new InjectionToken<DaffCartOrderServiceInterface>(\n 'DaffCartOrderDriver',\n);\n","// Drivers\nexport {\n DaffCartServiceInterface,\n DaffCartDriver,\n} from './cart-service.interface';\nexport {\n DaffCartBillingAddressServiceInterface,\n DaffCartBillingAddressDriver,\n} from './cart-billing-address-service.interface';\nexport {\n DaffCartAddressServiceInterface,\n DaffCartAddressDriver,\n} from './cart-address-service.interface';\nexport {\n DaffCartCouponServiceInterface,\n DaffCartCouponDriver,\n} from './cart-coupon-service.interface';\nexport {\n DaffCartItemServiceInterface,\n DaffCartItemDriver,\n} from './cart-item-service.interface';\nexport {\n DaffCartPaymentMethodsServiceInterface,\n DaffCartPaymentMethodsDriver,\n} from './cart-payment-methods-service.interface';\nexport {\n DaffCartPaymentServiceInterface,\n DaffCartPaymentDriver,\n} from './cart-payment-service.interface';\nexport {\n DaffCartShippingAddressServiceInterface,\n DaffCartShippingAddressDriver,\n} from './cart-shipping-address-service.interface';\nexport {\n DaffCartShippingInformationServiceInterface,\n DaffCartShippingInformationDriver,\n} from './cart-shipping-information-service.interface';\nexport {\n DaffCartShippingMethodsServiceInterface,\n DaffCartShippingMethodsDriver,\n} from './cart-shipping-methods-service.interface';\nexport {\n DaffCartOrderServiceInterface,\n DaffCartOrderDriver,\n} from './cart-order-service.interface';\n","export enum DaffCartDriverErrorCodes {\n CART_NOT_FOUND = 'DAFF_CART_NOT_FOUND',\n PRODUCT_NOT_FOUND = 'DAFF_PRODUCT_NOT_FOUND',\n PRODUCT_OUT_OF_STOCK = 'DAFF_PRODUCT_OUT_OF_STOCK',\n INVALID_COUPON_CODE = 'DAFF_INVALID_COUPON_CODE',\n INVALID_COUNTRY = 'DAFF_INVALID_COUNTRY',\n INVALID_EMAIL = 'DAFF_INVALID_EMAIL',\n INVALID_REGION = 'DAFF_INVALID_REGION',\n INVALID_API_RESPONSE = 'DAFF_INVALID_API_RESPONSE',\n EXPIRED_PAYMENT_METHOD = 'DAFF_EXPIRED_PAYMENT_METHOD',\n ITEM_EXCEEDS_MAX_QTY = 'ITEM_EXCEEDS_MAX_QTY'\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart driver call is sent with a cart identifier\n * that cannot be found by the platform.\n */\nexport class DaffCartNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.CART_NOT_FOUND;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the payment token used for the payment method update has expired.\n * This happens when the a place order request happens too long after payment update.\n * The payment must be updated again before an order can be placed.\n */\nexport class DaffCartExpiredPaymentTokenError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.EXPIRED_PAYMENT_METHOD;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the platform's API response is missing required information\n * or malformed in an unrecoverable way.\n */\nexport class DaffCartInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_API_RESPONSE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified country is invalid for the specified address\n * or missing where it is required.\n */\nexport class DaffInvalidCountryError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_COUNTRY;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffCartCoupon } from '@daffodil/cart';\nimport {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified coupon code cannot be applied to the cart.\n * Either the coupon code does not exist or the required conditions are not met.\n */\nexport class DaffInvalidCouponCodeError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_COUPON_CODE;\n\n constructor(message?: string, public coupon?: DaffCartCoupon['code']) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the email is not in the correct format.\n */\nexport class DaffInvalidEmailError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_EMAIL;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified region is invalid for the specified address\n * or missing where it is required.\n */\nexport class DaffInvalidRegionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_REGION;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart item's requested quantity\n * exceeds the maximum allowed by the platform.\n */\nexport class DaffCartItemExceedsMaxQtyError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when an add to cart request is sent\n * for a product that cannot be found.\n */\nexport class DaffProductNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart item's requested quantity\n * exceeds the amount currently in stock.\n */\nexport class DaffProductOutOfStockError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffCartNotFoundError } from './cart-not-found';\nimport { DaffCartDriverErrorCodes } from './codes.enum';\nimport { DaffCartExpiredPaymentTokenError } from './expired-payment-token';\nimport { DaffCartInvalidAPIResponseError } from './invalid-api-response';\nimport { DaffInvalidCountryError } from './invalid-country';\nimport { DaffInvalidCouponCodeError } from './invalid-coupon-code';\nimport { DaffInvalidEmailError } from './invalid-email';\nimport { DaffInvalidRegionError } from './invalid-region';\nimport { DaffCartItemExceedsMaxQtyError } from './item-exceeds-max-qty';\nimport { DaffProductNotFoundError } from './product-not-found';\nimport { DaffProductOutOfStockError } from './product-out-of-stock';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffCartDriverErrorMap = {\n [DaffCartDriverErrorCodes.CART_NOT_FOUND]: DaffCartNotFoundError,\n [DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,\n [DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK]: DaffProductOutOfStockError,\n [DaffCartDriverErrorCodes.INVALID_COUPON_CODE]: DaffInvalidCouponCodeError,\n [DaffCartDriverErrorCodes.INVALID_COUNTRY]: DaffInvalidCountryError,\n [DaffCartDriverErrorCodes.INVALID_EMAIL]: DaffInvalidEmailError,\n [DaffCartDriverErrorCodes.INVALID_REGION]: DaffInvalidRegionError,\n [DaffCartDriverErrorCodes.INVALID_API_RESPONSE]: DaffCartInvalidAPIResponseError,\n [DaffCartDriverErrorCodes.EXPIRED_PAYMENT_METHOD]: DaffCartExpiredPaymentTokenError,\n [DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY]: DaffCartItemExceedsMaxQtyError,\n};\n","/**\n * Generated bundle index. Do not edit.\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AoB,GAAG,0BAA0B;AAC3E,IAAA,CAAC,wBAAwB,CAAC,mBAAmB,GAAG,0BAA0B;AAC1E,IAAA,CAAC,wBAAwB,CAAC,eAAe,GAAG,uBAAuB;AACnE,IAAA,CAAC,wBAAwB,CAAC,aAAa,GAAG,qBAAqB;AAC/D,IAAA,CAAC,wBAAwB,CAAC,cAAc,GAAG,sBAAsB;AACjE,IAAA,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,+BAA+B;AAChF,IAAA,CAAC,wBAAwB,CAAC,sBAAsB,GAAG,gCAAgC;AACnF,IAAA,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,8BAA8B;;;ACzBjF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-cart-driver.mjs","sources":["../../../libs/cart/driver/src/interfaces/cart-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-billing-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-coupon-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-item-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-payment-methods-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-payment-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-address-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-information-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-shipping-methods-service.interface.ts","../../../libs/cart/driver/src/interfaces/cart-order-service.interface.ts","../../../libs/cart/driver/src/interfaces/public_api.ts","../../../libs/cart/driver/src/errors/codes.enum.ts","../../../libs/cart/driver/src/errors/cart-not-found.ts","../../../libs/cart/driver/src/errors/expired-payment-token.ts","../../../libs/cart/driver/src/errors/invalid-api-response.ts","../../../libs/cart/driver/src/errors/invalid-country.ts","../../../libs/cart/driver/src/errors/invalid-coupon-code.ts","../../../libs/cart/driver/src/errors/invalid-email.ts","../../../libs/cart/driver/src/errors/invalid-region.ts","../../../libs/cart/driver/src/errors/item-exceeds-max-qty.ts","../../../libs/cart/driver/src/errors/product-not-found.ts","../../../libs/cart/driver/src/errors/product-out-of-stock.ts","../../../libs/cart/driver/src/errors/map.ts","../../../libs/cart/driver/src/daffodil-cart-driver.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffDriverResponse } from '@daffodil/driver';\n\n/**\n * The interface responsible for managing a customer's cart.\n */\nexport interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {\n /**\n * Retrieve a cart\n */\n get(id: T['id']): Observable<DaffDriverResponse<T>>;\n\n /**\n * Creates a cart.\n */\n create(): Observable<{id: T['id']}>;\n\n /**\n * @deprecated\n * Prefer DaffCartItemServiceInterface.add\n *\n * Add an item to the cart.\n */\n addToCart(productId: string, qty: number): Observable<T>;\n\n /**\n * Remove all items from a cart.\n */\n clear(id: T['id']): Observable<Partial<T>>;\n}\n\nexport const DaffCartDriver = new InjectionToken<DaffCartServiceInterface>(\n 'DaffCartDriver',\n);\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the billing address of a cart.\n */\nexport interface DaffCartBillingAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Retrieve the billing address of a cart\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the billing address of a cart\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartBillingAddressDriver = new InjectionToken<\nDaffCartBillingAddressServiceInterface\n>('DaffCartBillingAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the address of a cart.\n */\nexport interface DaffCartAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Update the billing and shipping address of a cart\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartAddressDriver = new InjectionToken<\nDaffCartAddressServiceInterface\n>('DaffCartAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for applying a coupon to a cart.\n */\nexport interface DaffCartCouponServiceInterface<T extends DaffCart = DaffCart, V extends DaffCartCoupon = DaffCartCoupon> {\n /**\n * Apply a coupon to the cart and return a partial of the cart.\n */\n apply(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n /**\n * List coupon codes applied to a cart.\n */\n list(cartId: T['id']): Observable<V[]>;\n\n /**\n * Remove a coupon from the cart and return a partial of the cart.\n */\n remove(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n /**\n * Remove all coupons from the cart and return a partial of the cart.\n */\n removeAll(cartId: T['id']): Observable<Partial<T>>;\n}\n\nexport const DaffCartCouponDriver = new InjectionToken<DaffCartCouponServiceInterface>(\n 'DaffCartCouponDriver',\n);\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartItem,\n DaffCartItemInput,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the items of a cart.\n */\nexport interface DaffCartItemServiceInterface<\n T extends DaffCartItem = DaffCartItem,\n U extends DaffCartItemInput = DaffCartItemInput,\n V extends DaffCart = DaffCart\n> {\n /**\n * List all of the available items of a cart\n */\n list(cartId: V['id']): Observable<T[]>;\n\n /**\n * Get a specific cart item of a cart.\n */\n get(cartId: V['id'], item_id: DaffCartItem['id']): Observable<T>;\n\n /**\n * Add something to a cart.\n */\n add(id: V['id'], product: U): Observable<Partial<V>>;\n\n /**\n * Update an existing item in a cart\n */\n update(\n cartId: V['id'],\n itemId: T['id'],\n changes: Partial<T>,\n ): Observable<Partial<V>>;\n\n /**\n * Remove an item from a cart.\n */\n delete(cartId: V['id'], itemId: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartItemDriver = new InjectionToken<\nDaffCartItemServiceInterface\n>('DaffCartItemDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for retrieving the available payment methods of a cart.\n */\nexport interface DaffCartPaymentMethodsServiceInterface<T extends DaffCartPaymentMethod = DaffCartPaymentMethod> {\n /**\n * List the available payment methods of a cart.\n */\n list(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartPaymentMethodsDriver = new InjectionToken<\nDaffCartPaymentMethodsServiceInterface\n>('DaffCartPaymentMethodsDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the selected payment method of a cart.\n */\nexport interface DaffCartPaymentServiceInterface<\n T extends DaffCartPaymentMethod = DaffCartPaymentMethod,\n V extends DaffCart = DaffCart,\n R extends DaffCartAddress = DaffCartAddress\n> {\n /**\n * Get the currently applied payment method of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the payment method applied to a cart.\n */\n update(cartId: V['id'], payment: Partial<T>): Observable<Partial<V>>;\n\n /**\n * Update the billing address and payment method applied to a cart.\n */\n updateWithBilling(cartId: V['id'], payment: Partial<T>, address: Partial<R>): Observable<Partial<V>>;\n\n /**\n * Remove the payment method applied to a cart.\n */\n remove(cartId: V['id']): Observable<void>;\n}\n\nexport const DaffCartPaymentDriver = new InjectionToken<\nDaffCartPaymentServiceInterface\n>('DaffCartPaymentDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for managing the shipping address of a cart.\n */\nexport interface DaffCartShippingAddressServiceInterface<\n T extends DaffCartAddress = DaffCartAddress,\n V extends DaffCart = DaffCart\n> {\n /**\n * Retrieve the shipping address of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the shipping address of a cart.\n */\n update(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingAddressDriver = new InjectionToken<\nDaffCartShippingAddressServiceInterface\n>('DaffCartShippingAddressDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for mediating the interaction of the shipping\n * information of a cart with a given platform.\n */\nexport interface DaffCartShippingInformationServiceInterface<\n T extends DaffCartShippingRate = DaffCartShippingRate,\n V extends DaffCart = DaffCart\n>{\n /**\n * Get the currently selected shipping method of a cart.\n */\n get(cartId: V['id']): Observable<T>;\n\n /**\n * Update the currently selected shipping method of a cart.\n */\n update(cartId: V['id'], shippingInfo: Partial<T>): Observable<Partial<V>>;\n\n /**\n * Remove the currently selected shipping method from a cart.\n */\n delete(cartId: V['id'], id?: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingInformationDriver = new InjectionToken<\nDaffCartShippingInformationServiceInterface\n>('DaffCartShippingInformationDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for retrieving the available shipping methods of a cart.\n */\nexport interface DaffCartShippingMethodsServiceInterface<\n T extends DaffCartShippingRate = DaffCartShippingRate\n> {\n /**\n * List the available shipping methods for a cart.\n */\n list(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartShippingMethodsDriver = new InjectionToken<\nDaffCartShippingMethodsServiceInterface\n>('DaffCartShippingMethodsDriver');\n","import { InjectionToken } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\n\n/**\n * The interface responsible for placing an order for the customer's cart.\n */\nexport interface DaffCartOrderServiceInterface<\n T extends DaffCart = DaffCart,\n V extends DaffCartPaymentMethod = DaffCartPaymentMethod,\n R extends DaffCartOrderResult = DaffCartOrderResult\n> {\n /**\n * Place an order and return the order ID.\n */\n placeOrder(id: T['id'], payment?: V): Observable<R>;\n}\n\nexport const DaffCartOrderDriver = new InjectionToken<DaffCartOrderServiceInterface>(\n 'DaffCartOrderDriver',\n);\n","// Drivers\nexport {\n DaffCartServiceInterface,\n DaffCartDriver,\n} from './cart-service.interface';\nexport {\n DaffCartBillingAddressServiceInterface,\n DaffCartBillingAddressDriver,\n} from './cart-billing-address-service.interface';\nexport {\n DaffCartAddressServiceInterface,\n DaffCartAddressDriver,\n} from './cart-address-service.interface';\nexport {\n DaffCartCouponServiceInterface,\n DaffCartCouponDriver,\n} from './cart-coupon-service.interface';\nexport {\n DaffCartItemServiceInterface,\n DaffCartItemDriver,\n} from './cart-item-service.interface';\nexport {\n DaffCartPaymentMethodsServiceInterface,\n DaffCartPaymentMethodsDriver,\n} from './cart-payment-methods-service.interface';\nexport {\n DaffCartPaymentServiceInterface,\n DaffCartPaymentDriver,\n} from './cart-payment-service.interface';\nexport {\n DaffCartShippingAddressServiceInterface,\n DaffCartShippingAddressDriver,\n} from './cart-shipping-address-service.interface';\nexport {\n DaffCartShippingInformationServiceInterface,\n DaffCartShippingInformationDriver,\n} from './cart-shipping-information-service.interface';\nexport {\n DaffCartShippingMethodsServiceInterface,\n DaffCartShippingMethodsDriver,\n} from './cart-shipping-methods-service.interface';\nexport {\n DaffCartOrderServiceInterface,\n DaffCartOrderDriver,\n} from './cart-order-service.interface';\n","export enum DaffCartDriverErrorCodes {\n CART_NOT_FOUND = 'DAFF_CART_NOT_FOUND',\n PRODUCT_NOT_FOUND = 'DAFF_PRODUCT_NOT_FOUND',\n PRODUCT_OUT_OF_STOCK = 'DAFF_PRODUCT_OUT_OF_STOCK',\n INVALID_COUPON_CODE = 'DAFF_INVALID_COUPON_CODE',\n INVALID_COUNTRY = 'DAFF_INVALID_COUNTRY',\n INVALID_EMAIL = 'DAFF_INVALID_EMAIL',\n INVALID_REGION = 'DAFF_INVALID_REGION',\n INVALID_API_RESPONSE = 'DAFF_INVALID_API_RESPONSE',\n EXPIRED_PAYMENT_METHOD = 'DAFF_EXPIRED_PAYMENT_METHOD',\n ITEM_EXCEEDS_MAX_QTY = 'ITEM_EXCEEDS_MAX_QTY'\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart driver call is sent with a cart identifier\n * that cannot be found by the platform.\n */\nexport class DaffCartNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.CART_NOT_FOUND;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the payment token used for the payment method update has expired.\n * This happens when the a place order request happens too long after payment update.\n * The payment must be updated again before an order can be placed.\n */\nexport class DaffCartExpiredPaymentTokenError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.EXPIRED_PAYMENT_METHOD;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the platform's API response is missing required information\n * or malformed in an unrecoverable way.\n */\nexport class DaffCartInvalidAPIResponseError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_API_RESPONSE;\n\n constructor(public message: string) {\n super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified country is invalid for the specified address\n * or missing where it is required.\n */\nexport class DaffInvalidCountryError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_COUNTRY;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffCartCoupon } from '@daffodil/cart';\nimport {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified coupon code cannot be applied to the cart.\n * Either the coupon code does not exist or the required conditions are not met.\n */\nexport class DaffInvalidCouponCodeError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_COUPON_CODE;\n\n constructor(message?: string, public coupon?: DaffCartCoupon['code']) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the email is not in the correct format.\n */\nexport class DaffInvalidEmailError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_EMAIL;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when the specified region is invalid for the specified address\n * or missing where it is required.\n */\nexport class DaffInvalidRegionError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.INVALID_REGION;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart item's requested quantity\n * exceeds the maximum allowed by the platform.\n */\nexport class DaffCartItemExceedsMaxQtyError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when an add to cart request is sent\n * for a product that cannot be found.\n *\n * @deprecated Use the `DaffProductNotFoundError` from `@daffodil/product/driver` instead.\n */\nexport class DaffProductNotFoundError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import {\n DaffError,\n DaffInheritableError,\n} from '@daffodil/core';\n\nimport { DaffCartDriverErrorCodes } from './codes.enum';\n\n/**\n * An error thrown when a cart item's requested quantity\n * exceeds the amount currently in stock.\n */\nexport class DaffProductOutOfStockError extends DaffInheritableError implements DaffError {\n public readonly code: string = DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK;\n\n constructor(message?: string) {\n\t super(message);\n }\n}\n","import { DaffCartNotFoundError } from './cart-not-found';\nimport { DaffCartDriverErrorCodes } from './codes.enum';\nimport { DaffCartExpiredPaymentTokenError } from './expired-payment-token';\nimport { DaffCartInvalidAPIResponseError } from './invalid-api-response';\nimport { DaffInvalidCountryError } from './invalid-country';\nimport { DaffInvalidCouponCodeError } from './invalid-coupon-code';\nimport { DaffInvalidEmailError } from './invalid-email';\nimport { DaffInvalidRegionError } from './invalid-region';\nimport { DaffCartItemExceedsMaxQtyError } from './item-exceeds-max-qty';\nimport { DaffProductNotFoundError } from './product-not-found';\nimport { DaffProductOutOfStockError } from './product-out-of-stock';\n\n/**\n * A mapping from error codes to error class constructors.\n */\nexport const DaffCartDriverErrorMap = {\n [DaffCartDriverErrorCodes.CART_NOT_FOUND]: DaffCartNotFoundError,\n [DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND]: DaffProductNotFoundError,\n [DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK]: DaffProductOutOfStockError,\n [DaffCartDriverErrorCodes.INVALID_COUPON_CODE]: DaffInvalidCouponCodeError,\n [DaffCartDriverErrorCodes.INVALID_COUNTRY]: DaffInvalidCountryError,\n [DaffCartDriverErrorCodes.INVALID_EMAIL]: DaffInvalidEmailError,\n [DaffCartDriverErrorCodes.INVALID_REGION]: DaffInvalidRegionError,\n [DaffCartDriverErrorCodes.INVALID_API_RESPONSE]: DaffCartInvalidAPIResponseError,\n [DaffCartDriverErrorCodes.EXPIRED_PAYMENT_METHOD]: DaffCartExpiredPaymentTokenError,\n [DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY]: DaffCartItemExceedsMaxQtyError,\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;MAkCa,cAAc,GAAG,IAAI,cAAc,CAC9C,gBAAgB;;MCTL,4BAA4B,GAAG,IAAI,cAAc,CAE5D,8BAA8B;;MCPnB,qBAAqB,GAAG,IAAI,cAAc,CAErD,uBAAuB;;MCUZ,oBAAoB,GAAG,IAAI,cAAc,CACpD,sBAAsB;;MCaX,kBAAkB,GAAG,IAAI,cAAc,CAElD,oBAAoB;;MC/BT,4BAA4B,GAAG,IAAI,cAAc,CAE5D,8BAA8B;;MCkBnB,qBAAqB,GAAG,IAAI,cAAc,CAErD,uBAAuB;;MCdZ,6BAA6B,GAAG,IAAI,cAAc,CAE7D,+BAA+B;;MCIpB,iCAAiC,GAAG,IAAI,cAAc,CAEjE,mCAAmC;;MCdxB,6BAA6B,GAAG,IAAI,cAAc,CAE7D,+BAA+B;;MCCpB,mBAAmB,GAAG,IAAI,cAAc,CACnD,qBAAqB;;ACxBvB;;ICAY,yBAWX;AAXD,CAAA,UAAY,wBAAwB,EAAA;AAClC,IAAA,wBAAA,CAAA,gBAAA,CAAA,GAAA,qBAAsC,CAAA;AACtC,IAAA,wBAAA,CAAA,mBAAA,CAAA,GAAA,wBAA4C,CAAA;AAC5C,IAAA,wBAAA,CAAA,sBAAA,C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AI,GAAW,wBAAwB,CAAC,iBAAiB,CAAC;KAIzE;AACF;;ACZD;;;AAGG;AACG,MAAO,0BAA2B,SAAQ,oBAAoB,CAAA;AAGlE,IAAA,WAAA,CAAY,OAAgB,EAAA;QAC3B,KAAK,CAAC,OAAO,CAAC,CAAC;AAHA,QAAA,IAAA,CAAA,IAAI,GAAW,wBAAwB,CAAC,oBAAoB,CAAC;KAI5E;AACF;;ACLD;;AAEG;AACU,MAAA,sBAAsB,GAAG;AACpC,IAAA,CAAC,wBAAwB,CAAC,cAAc,GAAG,qBAAqB;AAChE,IAAA,CAAC,wBAAwB,CAAC,iBAAiB,GAAG,wBAAwB;AACtE,IAAA,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,0BAA0B;AAC3E,IAAA,CAAC,wBAAwB,CAAC,mBAAmB,GAAG,0BAA0B;AAC1E,IAAA,CAAC,wBAAwB,CAAC,eAAe,GAAG,uBAAuB;AACnE,IAAA,CAAC,wBAAwB,CAAC,aAAa,GAAG,qBAAqB;AAC/D,IAAA,CAAC,wBAAwB,CAAC,cAAc,GAAG,sBAAsB;AACjE,IAAA,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,+BAA+B;AAChF,IAAA,CAAC,wBAAwB,CAAC,sBAAsB,GAAG,gCAAgC;AACnF,IAAA,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,8BAA8B;;;ACzBjF;;AAEG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daffodil/cart",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.43.1",
|
|
4
4
|
"description": "Interfaces built for daffodil/state",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@angular/common": "^13.0.0",
|
|
17
17
|
"@angular/core": "^13.0.0",
|
|
18
|
-
"@daffodil/core": "0.
|
|
19
|
-
"@daffodil/product": "0.
|
|
20
|
-
"@daffodil/geography": "0.
|
|
18
|
+
"@daffodil/core": "0.43.1",
|
|
19
|
+
"@daffodil/product": "0.43.1",
|
|
20
|
+
"@daffodil/geography": "0.43.1",
|
|
21
21
|
"@ngrx/effects": "^13.0.0",
|
|
22
22
|
"@ngrx/entity": "^13.0.0",
|
|
23
23
|
"@ngrx/store": "^13.0.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"angular-in-memory-web-api": "^0.13.0",
|
|
29
29
|
"apollo-angular": "^3.0.1",
|
|
30
30
|
"@apollo/client": "^3.0.0",
|
|
31
|
-
"@daffodil/driver": "0.
|
|
31
|
+
"@daffodil/driver": "0.43.1"
|
|
32
32
|
},
|
|
33
33
|
"module": "fesm2015/daffodil-cart.mjs",
|
|
34
34
|
"es2020": "fesm2020/daffodil-cart.mjs",
|