@daffodil/cart 0.39.11 → 0.39.12
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/bundles/daffodil-cart-driver-in-memory.umd.js +4 -1
- package/bundles/daffodil-cart-driver-in-memory.umd.js.map +1 -1
- package/bundles/daffodil-cart-driver-in-memory.umd.min.js +1 -1
- package/bundles/daffodil-cart-driver-in-memory.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-driver-magento.umd.js +33 -5
- package/bundles/daffodil-cart-driver-magento.umd.js.map +1 -1
- package/bundles/daffodil-cart-driver-magento.umd.min.js +1 -1
- package/bundles/daffodil-cart-driver-magento.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-driver-testing.umd.js +4 -1
- package/bundles/daffodil-cart-driver-testing.umd.js.map +1 -1
- package/bundles/daffodil-cart-driver-testing.umd.min.js +1 -1
- package/bundles/daffodil-cart-driver-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-driver.umd.js.map +1 -1
- package/bundles/daffodil-cart-driver.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-state.umd.js +147 -25
- package/bundles/daffodil-cart-state.umd.js.map +1 -1
- package/bundles/daffodil-cart-state.umd.min.js +1 -1
- package/bundles/daffodil-cart-state.umd.min.js.map +1 -1
- package/driver/daffodil-cart-driver.metadata.json +1 -1
- package/driver/in-memory/daffodil-cart-driver-in-memory.metadata.json +1 -1
- package/driver/in-memory/drivers/cart/cart.service.d.ts +3 -2
- package/driver/interfaces/cart-service.interface.d.ts +2 -1
- package/driver/magento/cart.service.d.ts +2 -1
- package/driver/magento/daffodil-cart-driver-magento.metadata.json +1 -1
- package/driver/magento/errors/transform.d.ts +13 -1
- package/driver/testing/daffodil-cart-driver-testing.metadata.json +1 -1
- package/driver/testing/drivers/cart/cart.service.d.ts +2 -1
- package/esm2015/driver/in-memory/drivers/cart/cart.service.js +5 -2
- package/esm2015/driver/interfaces/cart-service.interface.js +1 -1
- package/esm2015/driver/magento/cart.service.js +20 -7
- package/esm2015/driver/magento/errors/transform.js +15 -6
- package/esm2015/driver/testing/drivers/cart/cart.service.js +5 -2
- package/esm2015/state/actions/cart-item.actions.js +30 -1
- package/esm2015/state/actions/cart.actions.js +29 -1
- package/esm2015/state/effects/cart-item.effects.js +17 -6
- package/esm2015/state/effects/cart-resolver.effects.js +23 -10
- package/esm2015/state/effects/cart.effects.js +13 -4
- package/esm2015/state/reducers/cart/cart.reducer.js +7 -3
- package/esm2015/state/reducers/cart-item/cart-item.reducer.js +11 -3
- package/esm2015/state/reducers/cart-item-entities/cart-item-entities.reducer.js +4 -1
- package/esm2015/state/reducers/errors/error-state-helpers.js +3 -3
- package/fesm2015/daffodil-cart-driver-in-memory.js +4 -1
- package/fesm2015/daffodil-cart-driver-in-memory.js.map +1 -1
- package/fesm2015/daffodil-cart-driver-magento.js +31 -9
- package/fesm2015/daffodil-cart-driver-magento.js.map +1 -1
- package/fesm2015/daffodil-cart-driver-testing.js +4 -1
- package/fesm2015/daffodil-cart-driver-testing.js.map +1 -1
- package/fesm2015/daffodil-cart-driver.js.map +1 -1
- package/fesm2015/daffodil-cart-state.js +126 -24
- package/fesm2015/daffodil-cart-state.js.map +1 -1
- package/package.json +5 -5
- package/state/actions/cart-item.actions.d.ts +26 -1
- package/state/actions/cart.actions.d.ts +31 -5
- package/state/daffodil-cart-state.metadata.json +1 -1
- package/state/effects/cart-item.effects.d.ts +5 -2
- package/state/effects/cart.effects.d.ts +2 -2
- package/state/reducers/errors/error-state-helpers.d.ts +1 -1
|
@@ -13,7 +13,10 @@ class DaffTestingCartService {
|
|
|
13
13
|
this.cartFactory = cartFactory;
|
|
14
14
|
}
|
|
15
15
|
get(id) {
|
|
16
|
-
return of(
|
|
16
|
+
return of({
|
|
17
|
+
response: this.cartFactory.create(),
|
|
18
|
+
errors: [],
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
addToCart(productId, qty) {
|
|
19
22
|
return of(this.cartFactory.create());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-cart-driver-testing.js","sources":["../../../libs/cart/driver/testing/src/drivers/cart/cart.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-item/cart-item.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-address/cart-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-order/cart-order.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-coupon/cart-coupon.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-driver.module.ts","../../../libs/cart/driver/testing/src/daffodil-cart-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffCartServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartFactory } from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartService implements DaffCartServiceInterface {\n constructor(\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(id: DaffCart['id']): Observable<DaffCart> {\n return of(this.cartFactory.create());\n }\n\n addToCart(productId: string, qty: number): Observable<DaffCart> {\n return of(this.cartFactory.create());\n }\n\n clear(id: DaffCart['id']): Observable<DaffCart> {\n return of(this.cartFactory.create());\n }\n\n create() {\n return of({\n id: this.cartFactory.create().id,\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartItem,\n DaffCartItemInput,\n} from '@daffodil/cart';\nimport { DaffCartItemServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartItemFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartItemService implements DaffCartItemServiceInterface {\n constructor(\n private cartItemFactory: DaffCartItemFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartItem[]> {\n return of(this.cartItemFactory.createMany(3));\n }\n\n get(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<DaffCartItem> {\n return of(this.cartItemFactory.create());\n }\n\n add(cartId: DaffCart['id'], input: DaffCartItemInput): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n update(\n cartId: DaffCart['id'],\n itemId: DaffCartItem['id'],\n item: Partial<DaffCartItem>,\n ): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n delete(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartAddressService implements DaffCartAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartBillingAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartBillingAddressService implements DaffCartBillingAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return of(this.addressFactory.create());\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartPaymentServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartPaymentFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartPaymentService implements DaffCartPaymentServiceInterface {\n constructor(\n private paymentFactory: DaffCartPaymentFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod> {\n return of(this.paymentFactory.create());\n }\n\n update(cartId: DaffCart['id'], payment: Partial<DaffCartPaymentMethod>): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n updateWithBilling(\n cartId: DaffCart['id'],\n payment: Partial<DaffCartPaymentMethod>,\n address: Partial<DaffCartAddress>,\n ): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n remove(cartId: DaffCart['id']): Observable<void> {\n return of(undefined);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffCartPaymentMethodsServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartPaymentFactory } from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartPaymentMethodsService implements DaffCartPaymentMethodsServiceInterface {\n constructor(\n private paymentFactory: DaffCartPaymentFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod[]> {\n return of(this.paymentFactory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartShippingAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingAddressService implements DaffCartShippingAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return of(this.addressFactory.create());\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingInformationServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartShippingRateFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingInformationService implements DaffCartShippingInformationServiceInterface {\n constructor(\n private shippingInfoFactory: DaffCartShippingRateFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartShippingRate> {\n return of(this.shippingInfoFactory.create());\n }\n\n update(cartId: DaffCart['id'], info: Partial<DaffCartShippingRate>): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n delete(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingMethodsServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartShippingRateFactory } from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingMethodsService implements DaffCartShippingMethodsServiceInterface {\n constructor(\n private shippingInfoFactory: DaffCartShippingRateFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartShippingRate[]> {\n return of(this.shippingInfoFactory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\nimport { DaffCartOrderServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartOrderService implements DaffCartOrderServiceInterface {\n placeOrder(cartId: DaffCart['id'], payment?: DaffCartPaymentMethod): Observable<DaffCartOrderResult> {\n return of({\n id: faker.datatype.uuid(),\n orderId: faker.datatype.uuid(),\n cartId,\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffCartCouponServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartCouponFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartCouponService implements DaffCartCouponServiceInterface {\n constructor(\n private couponFactory: DaffCartCouponFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartCoupon[]> {\n return of(this.couponFactory.createMany(3));\n }\n\n apply(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n remove(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n removeAll(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartDriver,\n DaffCartAddressDriver,\n DaffCartBillingAddressDriver,\n DaffCartShippingAddressDriver,\n DaffCartCouponDriver,\n DaffCartOrderDriver,\n DaffCartPaymentDriver,\n DaffCartShippingInformationDriver,\n DaffCartShippingMethodsDriver,\n DaffCartPaymentMethodsDriver,\n DaffCartItemDriver,\n} from '@daffodil/cart/driver';\n\nimport { DaffTestingCartAddressService } from './cart-address/cart-address.service';\nimport { DaffTestingCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffTestingCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffTestingCartItemService } from './cart-item/cart-item.service';\nimport { DaffTestingCartOrderService } from './cart-order/cart-order.service';\nimport { DaffTestingCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffTestingCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffTestingCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffTestingCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffTestingCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffTestingCartService } from './cart/cart.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffTestingCartDriverModule {\n static forRoot(): ModuleWithProviders<DaffTestingCartDriverModule> {\n return {\n ngModule: DaffTestingCartDriverModule,\n providers: [\n {\n provide: DaffCartDriver,\n useExisting: DaffTestingCartService,\n },\n {\n provide: DaffCartItemDriver,\n useExisting: DaffTestingCartItemService,\n },\n {\n provide: DaffCartAddressDriver,\n useExisting: DaffTestingCartAddressService,\n },\n {\n provide: DaffCartBillingAddressDriver,\n useExisting: DaffTestingCartBillingAddressService,\n },\n {\n provide: DaffCartShippingAddressDriver,\n useExisting: DaffTestingCartShippingAddressService,\n },\n {\n provide: DaffCartCouponDriver,\n useExisting: DaffTestingCartCouponService,\n },\n {\n provide: DaffCartOrderDriver,\n useExisting: DaffTestingCartOrderService,\n },\n {\n provide: DaffCartPaymentDriver,\n useExisting: DaffTestingCartPaymentService,\n },\n {\n provide: DaffCartShippingInformationDriver,\n useExisting: DaffTestingCartShippingInformationService,\n },\n {\n provide: DaffCartShippingMethodsDriver,\n useExisting: DaffTestingCartShippingMethodsService,\n },\n {\n provide: DaffCartPaymentMethodsDriver,\n useExisting: DaffTestingCartPaymentMethodsService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype"],"mappings":";;;;;;;AAUA;;;MAMa,sBAAsB;IACjC,YACU,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;KAClC;IAEJ,GAAG,CAAC,EAAkB;QACpB,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;KACtC;IAED,SAAS,CAAC,SAAiB,EAAE,GAAW;QACtC,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;KACtC;IAED,KAAK,CAAC,EAAkB;QACtB,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;KACtC;I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2B;YACrC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,cAAc;oBACvB,WAAW,EAAE,sBAAsB;iBACpC;gBACD;oBACE,OAAO,EAAE,kBAAkB;oBAC3B,WAAW,EAAE,0BAA0B;iBACxC;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,WAAW,EAAE,6BAA6B;iBAC3C;gBACD;oBACE,OAAO,EAAE,4BAA4B;oBACrC,WAAW,EAAE,oCAAoC;iBAClD;gBACD;oBACE,OAAO,EAAE,6BAA6B;oBACtC,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,OAAO,EAAE,oBAAoB;oBAC7B,WAAW,EAAE,4BAA4B;iBAC1C;gBACD;oBACE,OAAO,EAAE,mBAAmB;oBAC5B,WAAW,EAAE,2BAA2B;iBACzC;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,WAAW,EAAE,6BAA6B;iBAC3C;gBACD;oBACE,OAAO,EAAE,iCAAiC;oBAC1C,WAAW,EAAE,yCAAyC;iBACvD;gBACD;oBACE,OAAO,EAAE,6BAA6B;oBACtC,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,OAAO,EAAE,4BAA4B;oBACrC,WAAW,EAAE,oCAAoC;iBAClD;aACF;SACF,CAAC;KACH;;;YAxDF,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;ACpCD;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-cart-driver-testing.js","sources":["../../../libs/cart/driver/testing/src/drivers/cart/cart.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-item/cart-item.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-address/cart-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-order/cart-order.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-coupon/cart-coupon.service.ts","../../../libs/cart/driver/testing/src/drivers/cart-driver.module.ts","../../../libs/cart/driver/testing/src/daffodil-cart-driver-testing.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffCartServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartFactory } from '@daffodil/cart/testing';\nimport { DaffDriverResponse } from '@daffodil/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartService implements DaffCartServiceInterface {\n constructor(\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(id: DaffCart['id']): Observable<DaffDriverResponse<DaffCart>> {\n return of({\n response: this.cartFactory.create(),\n errors: [],\n });\n }\n\n addToCart(productId: string, qty: number): Observable<DaffCart> {\n return of(this.cartFactory.create());\n }\n\n clear(id: DaffCart['id']): Observable<DaffCart> {\n return of(this.cartFactory.create());\n }\n\n create() {\n return of({\n id: this.cartFactory.create().id,\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartItem,\n DaffCartItemInput,\n} from '@daffodil/cart';\nimport { DaffCartItemServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartItemFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartItemService implements DaffCartItemServiceInterface {\n constructor(\n private cartItemFactory: DaffCartItemFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartItem[]> {\n return of(this.cartItemFactory.createMany(3));\n }\n\n get(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<DaffCartItem> {\n return of(this.cartItemFactory.create());\n }\n\n add(cartId: DaffCart['id'], input: DaffCartItemInput): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n update(\n cartId: DaffCart['id'],\n itemId: DaffCartItem['id'],\n item: Partial<DaffCartItem>,\n ): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n delete(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartAddressService implements DaffCartAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartBillingAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartBillingAddressService implements DaffCartBillingAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return of(this.addressFactory.create());\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartPaymentServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartPaymentFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartPaymentService implements DaffCartPaymentServiceInterface {\n constructor(\n private paymentFactory: DaffCartPaymentFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod> {\n return of(this.paymentFactory.create());\n }\n\n update(cartId: DaffCart['id'], payment: Partial<DaffCartPaymentMethod>): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n updateWithBilling(\n cartId: DaffCart['id'],\n payment: Partial<DaffCartPaymentMethod>,\n address: Partial<DaffCartAddress>,\n ): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n remove(cartId: DaffCart['id']): Observable<void> {\n return of(undefined);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffCartPaymentMethodsServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartPaymentFactory } from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartPaymentMethodsService implements DaffCartPaymentMethodsServiceInterface {\n constructor(\n private paymentFactory: DaffCartPaymentFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod[]> {\n return of(this.paymentFactory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartShippingAddressServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartAddressFactory,\n DaffCartFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingAddressService implements DaffCartShippingAddressServiceInterface {\n constructor(\n private addressFactory: DaffCartAddressFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return of(this.addressFactory.create());\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingInformationServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartShippingRateFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingInformationService implements DaffCartShippingInformationServiceInterface {\n constructor(\n private shippingInfoFactory: DaffCartShippingRateFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartShippingRate> {\n return of(this.shippingInfoFactory.create());\n }\n\n update(cartId: DaffCart['id'], info: Partial<DaffCartShippingRate>): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n delete(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingMethodsServiceInterface } from '@daffodil/cart/driver';\nimport { DaffCartShippingRateFactory } from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartShippingMethodsService implements DaffCartShippingMethodsServiceInterface {\n constructor(\n private shippingInfoFactory: DaffCartShippingRateFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartShippingRate[]> {\n return of(this.shippingInfoFactory.createMany(3));\n }\n}\n","import { Injectable } from '@angular/core';\nimport * as faker from '@faker-js/faker/locale/en_US';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\nimport { DaffCartOrderServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartOrderService implements DaffCartOrderServiceInterface {\n placeOrder(cartId: DaffCart['id'], payment?: DaffCartPaymentMethod): Observable<DaffCartOrderResult> {\n return of({\n id: faker.datatype.uuid(),\n orderId: faker.datatype.uuid(),\n cartId,\n });\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n Observable,\n of,\n} from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffCartCouponServiceInterface } from '@daffodil/cart/driver';\nimport {\n DaffCartFactory,\n DaffCartCouponFactory,\n} from '@daffodil/cart/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffTestingCartCouponService implements DaffCartCouponServiceInterface {\n constructor(\n private couponFactory: DaffCartCouponFactory,\n private cartFactory: DaffCartFactory,\n ) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartCoupon[]> {\n return of(this.couponFactory.createMany(3));\n }\n\n apply(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n remove(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n\n removeAll(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return of(this.cartFactory.create());\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartDriver,\n DaffCartAddressDriver,\n DaffCartBillingAddressDriver,\n DaffCartShippingAddressDriver,\n DaffCartCouponDriver,\n DaffCartOrderDriver,\n DaffCartPaymentDriver,\n DaffCartShippingInformationDriver,\n DaffCartShippingMethodsDriver,\n DaffCartPaymentMethodsDriver,\n DaffCartItemDriver,\n} from '@daffodil/cart/driver';\n\nimport { DaffTestingCartAddressService } from './cart-address/cart-address.service';\nimport { DaffTestingCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffTestingCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffTestingCartItemService } from './cart-item/cart-item.service';\nimport { DaffTestingCartOrderService } from './cart-order/cart-order.service';\nimport { DaffTestingCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffTestingCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffTestingCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffTestingCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffTestingCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffTestingCartService } from './cart/cart.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffTestingCartDriverModule {\n static forRoot(): ModuleWithProviders<DaffTestingCartDriverModule> {\n return {\n ngModule: DaffTestingCartDriverModule,\n providers: [\n {\n provide: DaffCartDriver,\n useExisting: DaffTestingCartService,\n },\n {\n provide: DaffCartItemDriver,\n useExisting: DaffTestingCartItemService,\n },\n {\n provide: DaffCartAddressDriver,\n useExisting: DaffTestingCartAddressService,\n },\n {\n provide: DaffCartBillingAddressDriver,\n useExisting: DaffTestingCartBillingAddressService,\n },\n {\n provide: DaffCartShippingAddressDriver,\n useExisting: DaffTestingCartShippingAddressService,\n },\n {\n provide: DaffCartCouponDriver,\n useExisting: DaffTestingCartCouponService,\n },\n {\n provide: DaffCartOrderDriver,\n useExisting: DaffTestingCartOrderService,\n },\n {\n provide: DaffCartPaymentDriver,\n useExisting: DaffTestingCartPaymentService,\n },\n {\n provide: DaffCartShippingInformationDriver,\n useExisting: DaffTestingCartShippingInformationService,\n },\n {\n provide: DaffCartShippingMethodsDriver,\n useExisting: DaffTestingCartShippingMethodsService,\n },\n {\n provide: DaffCartPaymentMethodsDriver,\n useExisting: DaffTestingCartPaymentMethodsService,\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["faker.datatype"],"mappings":";;;;;;;AAWA;;;MAMa,sBAAsB;IACjC,YACU,WAA4B;QAA5B,gBAAW,GAAX,WAAW,CAAiB;KAClC;IAEJ,GAAG,CAAC,EAAkB;QACpB,OAAO,EAAE,CAAC;YACR,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,EAAE;SACX,CAAC,CAAC;KACJ;IAED,SAAS,CAAC,SAAiB,EAAE,GAAW;QACtC,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;KACtC;IAED,KAAK,CAAC,EAAkB;QACtB,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC;KACtC;IAED,MAAM;QACJ,OAAO,EAAE,CAAC;YACR,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE;SACjC,CAAC,CAAC;KACJ;;;;YA3BF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;YARQ,eAAe;;;ACSxB;;;MAMa,0BAA0B;IACrC,YACU,eAAoC,EACpC,WAA4B;QAD5B,oBAAe,G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AAW,EAAE,oCAAoC;iBAClD;gBACD;oBACE,OAAO,EAAE,6BAA6B;oBACtC,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,OAAO,EAAE,oBAAoB;oBAC7B,WAAW,EAAE,4BAA4B;iBAC1C;gBACD;oBACE,OAAO,EAAE,mBAAmB;oBAC5B,WAAW,EAAE,2BAA2B;iBACzC;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,WAAW,EAAE,6BAA6B;iBAC3C;gBACD;oBACE,OAAO,EAAE,iCAAiC;oBAC1C,WAAW,EAAE,yCAAyC;iBACvD;gBACD;oBACE,OAAO,EAAE,6BAA6B;oBACtC,WAAW,EAAE,qCAAqC;iBACnD;gBACD;oBACE,OAAO,EAAE,4BAA4B;oBACrC,WAAW,EAAE,oCAAoC;iBAClD;aACF;SACF,CAAC;KACH;;;YAxDF,QAAQ,SAAC;gBACR,OAAO,EAAE;oBACP,YAAY;iBACb;aACF;;;ACpCD;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-cart-driver.js","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';\n\n/**\n * The interface responsible for managing a customer's cart.\n */\nexport interface DaffCartServiceInterface<T extends DaffCart = DaffCart> {\n\t/**\n\t * Retrieve a cart\n\t */\n get(id: T['id']): Observable<T>;\n\n /**\n * Creates a cart.\n */\n create(): Observable<{id: T['id']}>;\n\n\t/**\n\t * @deprecated\n\t * Prefer DaffCartItemServiceInterface.add\n\t *\n\t * Add an item to the cart.\n\t */\n\taddToCart(productId: string, qty: number): Observable<T>;\n\n\t/**\n\t * Remove all items from a cart.\n\t */\n\tclear(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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Retrieve the billing address of a cart\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the billing address of a cart\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartBillingAddressDriver = new InjectionToken<\n\tDaffCartBillingAddressServiceInterface\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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Update the billing and shipping address of a cart\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartAddressDriver = new InjectionToken<\n\tDaffCartAddressServiceInterface\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\t/**\n\t * Apply a coupon to the cart and return a partial of the cart.\n\t */\n\tapply(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n\t/**\n\t * List coupon codes applied to a cart.\n\t */\n\tlist(cartId: T['id']): Observable<V[]>;\n\n\t/**\n\t * Remove a coupon from the cart and return a partial of the cart.\n\t */\n\tremove(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n\t/**\n\t * Remove all coupons from the cart and return a partial of the cart.\n\t */\n\tremoveAll(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\tT extends DaffCartItem = DaffCartItem,\n\tU extends DaffCartItemInput = DaffCartItemInput,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * List all of the available items of a cart\n\t */\n\tlist(cartId: V['id']): Observable<T[]>;\n\n\t/**\n\t * Get a specific cart item of a cart.\n\t */\n\tget(cartId: V['id'], item_id: DaffCartItem['id']): Observable<T>;\n\n\t/**\n\t * Add something to a cart.\n\t */\n\tadd(id: V['id'], product: U): Observable<Partial<V>>;\n\n\t/**\n\t * Update an existing item in a cart\n\t */\n\tupdate(\n\t\tcartId: V['id'],\n\t\titemId: T['id'],\n\t\tchanges: Partial<T>,\n\t): Observable<Partial<V>>;\n\n\t/**\n\t * Remove an item from a cart.\n\t */\n\tdelete(cartId: V['id'], itemId: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartItemDriver = new InjectionToken<\n\tDaffCartItemServiceInterface\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\t/**\n\t * List the available payment methods of a cart.\n\t */\n\tlist(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartPaymentMethodsDriver = new InjectionToken<\n\tDaffCartPaymentMethodsServiceInterface\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\t/**\n\t * Get the currently applied payment method of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the payment method applied to a cart.\n\t */\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\tupdateWithBilling(cartId: V['id'], payment: Partial<T>, address: Partial<R>): Observable<Partial<V>>;\n\n\t/**\n\t * Remove the payment method applied to a cart.\n\t */\n\tremove(cartId: V['id']): Observable<void>;\n}\n\nexport const DaffCartPaymentDriver = new InjectionToken<\n\tDaffCartPaymentServiceInterface\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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Retrieve the shipping address of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the shipping address of a cart.\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingAddressDriver = new InjectionToken<\n\tDaffCartShippingAddressServiceInterface\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\t/**\n\t * Get the currently selected shipping method of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the currently selected shipping method of a cart.\n\t */\n\tupdate(cartId: V['id'], shippingInfo: Partial<T>): Observable<Partial<V>>;\n\n\t/**\n\t * Remove the currently selected shipping method from a cart.\n\t */\n\tdelete(cartId: V['id'], id?: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingInformationDriver = new InjectionToken<\n\tDaffCartShippingInformationServiceInterface\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\tT extends DaffCartShippingRate = DaffCartShippingRate\n> {\n\t/**\n\t * List the available shipping methods for a cart.\n\t */\n\tlist(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartShippingMethodsDriver = new InjectionToken<\n\tDaffCartShippingMethodsServiceInterface\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\t/**\n\t * Place an order and return the order ID.\n\t */\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\tpublic readonly code: string = DaffCartDriverErrorCodes.CART_NOT_FOUND;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_COUNTRY;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_COUPON_CODE;\n\n\tconstructor(message?: string, public coupon?: DaffCartCoupon['code']) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_EMAIL;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_REGION;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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":";;;MAiCa,cAAc,GAAG,IAAI,cAAc,CAC9C,gBAAgB;;MCRL,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,C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AC1E,CAAC,wBAAwB,CAAC,eAAe,GAAG,uBAAuB;IACnE,CAAC,wBAAwB,CAAC,aAAa,GAAG,qBAAqB;IAC/D,CAAC,wBAAwB,CAAC,cAAc,GAAG,sBAAsB;IACjE,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,+BAA+B;IAChF,CAAC,wBAAwB,CAAC,sBAAsB,GAAG,gCAAgC;IACnF,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,8BAA8B;;;ACzBjF;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-cart-driver.js","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\t/**\n\t * Retrieve a cart\n\t */\n get(id: T['id']): Observable<DaffDriverResponse<T>>;\n\n /**\n * Creates a cart.\n */\n create(): Observable<{id: T['id']}>;\n\n\t/**\n\t * @deprecated\n\t * Prefer DaffCartItemServiceInterface.add\n\t *\n\t * Add an item to the cart.\n\t */\n\taddToCart(productId: string, qty: number): Observable<T>;\n\n\t/**\n\t * Remove all items from a cart.\n\t */\n\tclear(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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Retrieve the billing address of a cart\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the billing address of a cart\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartBillingAddressDriver = new InjectionToken<\n\tDaffCartBillingAddressServiceInterface\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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Update the billing and shipping address of a cart\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartAddressDriver = new InjectionToken<\n\tDaffCartAddressServiceInterface\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\t/**\n\t * Apply a coupon to the cart and return a partial of the cart.\n\t */\n\tapply(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n\t/**\n\t * List coupon codes applied to a cart.\n\t */\n\tlist(cartId: T['id']): Observable<V[]>;\n\n\t/**\n\t * Remove a coupon from the cart and return a partial of the cart.\n\t */\n\tremove(cartId: T['id'], coupon: V): Observable<Partial<T>>;\n\n\t/**\n\t * Remove all coupons from the cart and return a partial of the cart.\n\t */\n\tremoveAll(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\tT extends DaffCartItem = DaffCartItem,\n\tU extends DaffCartItemInput = DaffCartItemInput,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * List all of the available items of a cart\n\t */\n\tlist(cartId: V['id']): Observable<T[]>;\n\n\t/**\n\t * Get a specific cart item of a cart.\n\t */\n\tget(cartId: V['id'], item_id: DaffCartItem['id']): Observable<T>;\n\n\t/**\n\t * Add something to a cart.\n\t */\n\tadd(id: V['id'], product: U): Observable<Partial<V>>;\n\n\t/**\n\t * Update an existing item in a cart\n\t */\n\tupdate(\n\t\tcartId: V['id'],\n\t\titemId: T['id'],\n\t\tchanges: Partial<T>,\n\t): Observable<Partial<V>>;\n\n\t/**\n\t * Remove an item from a cart.\n\t */\n\tdelete(cartId: V['id'], itemId: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartItemDriver = new InjectionToken<\n\tDaffCartItemServiceInterface\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\t/**\n\t * List the available payment methods of a cart.\n\t */\n\tlist(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartPaymentMethodsDriver = new InjectionToken<\n\tDaffCartPaymentMethodsServiceInterface\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\t/**\n\t * Get the currently applied payment method of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the payment method applied to a cart.\n\t */\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\tupdateWithBilling(cartId: V['id'], payment: Partial<T>, address: Partial<R>): Observable<Partial<V>>;\n\n\t/**\n\t * Remove the payment method applied to a cart.\n\t */\n\tremove(cartId: V['id']): Observable<void>;\n}\n\nexport const DaffCartPaymentDriver = new InjectionToken<\n\tDaffCartPaymentServiceInterface\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\tT extends DaffCartAddress = DaffCartAddress,\n\tV extends DaffCart = DaffCart\n> {\n\t/**\n\t * Retrieve the shipping address of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the shipping address of a cart.\n\t */\n\tupdate(cartId: V['id'], address: Partial<T>): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingAddressDriver = new InjectionToken<\n\tDaffCartShippingAddressServiceInterface\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\t/**\n\t * Get the currently selected shipping method of a cart.\n\t */\n\tget(cartId: V['id']): Observable<T>;\n\n\t/**\n\t * Update the currently selected shipping method of a cart.\n\t */\n\tupdate(cartId: V['id'], shippingInfo: Partial<T>): Observable<Partial<V>>;\n\n\t/**\n\t * Remove the currently selected shipping method from a cart.\n\t */\n\tdelete(cartId: V['id'], id?: T['id']): Observable<Partial<V>>;\n}\n\nexport const DaffCartShippingInformationDriver = new InjectionToken<\n\tDaffCartShippingInformationServiceInterface\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\tT extends DaffCartShippingRate = DaffCartShippingRate\n> {\n\t/**\n\t * List the available shipping methods for a cart.\n\t */\n\tlist(cartId: DaffCart['id']): Observable<T[]>;\n}\n\nexport const DaffCartShippingMethodsDriver = new InjectionToken<\n\tDaffCartShippingMethodsServiceInterface\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\t/**\n\t * Place an order and return the order ID.\n\t */\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\tpublic readonly code: string = DaffCartDriverErrorCodes.CART_NOT_FOUND;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_COUNTRY;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_COUPON_CODE;\n\n\tconstructor(message?: string, public coupon?: DaffCartCoupon['code']) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_EMAIL;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.INVALID_REGION;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.ITEM_EXCEEDS_MAX_QTY;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.PRODUCT_NOT_FOUND;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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\tpublic readonly code: string = DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK;\n\n\tconstructor(message?: string) {\n\t super(message);\n\t}\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,m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GAAG,8BAA8B;;;ACzBjF;;;;;;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { createFeatureSelector, createSelector, defaultMemoize,
|
|
1
|
+
import { createFeatureSelector, createSelector, defaultMemoize, select, Store, combineReducers, StoreModule } from '@ngrx/store';
|
|
2
2
|
import { createEntityAdapter } from '@ngrx/entity';
|
|
3
3
|
import { daffComposeReducers } from '@daffodil/core/state';
|
|
4
|
+
import { DaffCartDriverErrorCodes, DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartCouponDriver, DaffCartItemDriver, DaffCartOrderDriver, DaffCartPaymentMethodsDriver, DaffCartPaymentDriver, DaffCartNotFoundError, DaffCartDriver, DaffCartShippingAddressDriver, DaffCartShippingInformationDriver, DaffCartShippingMethodsDriver } from '@daffodil/cart/driver';
|
|
4
5
|
import { InjectionToken, Injectable, Inject, inject, NgModule, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
|
|
5
|
-
import { DaffCartItemInputType, DaffCartTotalTypeEnum, DAFF_CART_ERROR_MATCHER, DaffCartStorageService,
|
|
6
|
+
import { DaffCartItemInputType, DaffCartTotalTypeEnum, DAFF_CART_ERROR_MATCHER, DaffCartStorageService, DaffCartNotFoundOrCreatedResolutionError, DaffCartResolutionError, DaffCartStorageResolutionError, DaffCartServerSideResolutionError, DaffCartPaymentMethodIdMap } from '@daffodil/cart';
|
|
6
7
|
import { daffAdd, DaffStorageServiceError, DaffInheritableError, DaffServerSideStorageError } from '@daffodil/core';
|
|
7
8
|
import { daffComparePersonalAddresses } from '@daffodil/geography';
|
|
8
9
|
import { ofType, Actions, Effect, EffectsModule } from '@ngrx/effects';
|
|
9
10
|
import { __decorate, __metadata } from 'tslib';
|
|
10
|
-
import { of, EMPTY } from 'rxjs';
|
|
11
|
-
import { switchMap, map, catchError, mergeMap, debounceTime, mapTo, tap, switchMapTo } from 'rxjs/operators';
|
|
12
|
-
import { DaffCartAddressDriver, DaffCartBillingAddressDriver, DaffCartCouponDriver, DaffCartItemDriver, DaffCartOrderDriver, DaffCartPaymentMethodsDriver, DaffCartPaymentDriver, DaffCartNotFoundError, DaffCartDriver, DaffCartShippingAddressDriver, DaffCartShippingInformationDriver, DaffCartShippingMethodsDriver } from '@daffodil/cart/driver';
|
|
11
|
+
import { of, combineLatest, EMPTY } from 'rxjs';
|
|
12
|
+
import { switchMap, map, catchError, mergeMap, debounceTime, mapTo, take, tap, switchMapTo } from 'rxjs/operators';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* An enum for the cart action types.
|
|
@@ -19,6 +19,7 @@ var DaffCartActionTypes;
|
|
|
19
19
|
DaffCartActionTypes["CartStorageFailureAction"] = "[DaffCart] Cart Storage Failure Action";
|
|
20
20
|
DaffCartActionTypes["CartLoadAction"] = "[DaffCart] Cart Load Action";
|
|
21
21
|
DaffCartActionTypes["CartLoadSuccessAction"] = "[DaffCart] Cart Load Success Action";
|
|
22
|
+
DaffCartActionTypes["CartLoadPartialSuccessAction"] = "[DaffCart] Cart Load Partial Success Action";
|
|
22
23
|
DaffCartActionTypes["CartLoadFailureAction"] = "[DaffCart] Cart Load Failure Action";
|
|
23
24
|
DaffCartActionTypes["CartCreateAction"] = "[DaffCart] Cart Create Action";
|
|
24
25
|
DaffCartActionTypes["CartCreateSuccessAction"] = "[DaffCart] Cart Create Success Action";
|
|
@@ -31,6 +32,7 @@ var DaffCartActionTypes;
|
|
|
31
32
|
DaffCartActionTypes["CartClearFailureAction"] = "[DaffCart] Cart Reset Failure Action";
|
|
32
33
|
DaffCartActionTypes["ResolveCartAction"] = "[DaffCart] Resolve Cart Action";
|
|
33
34
|
DaffCartActionTypes["ResolveCartSuccessAction"] = "[DaffCart] Resolve Cart Success Action";
|
|
35
|
+
DaffCartActionTypes["ResolveCartPartialSuccessAction"] = "[DaffCart] Resolve Cart Partial Success Action";
|
|
34
36
|
DaffCartActionTypes["ResolveCartServerSideAction"] = "[DaffCart] Resolve Cart Server Side Action";
|
|
35
37
|
DaffCartActionTypes["ResolveCartFailureAction"] = "[DaffCart] Resolve Cart Failure Action";
|
|
36
38
|
})(DaffCartActionTypes || (DaffCartActionTypes = {}));
|
|
@@ -60,6 +62,19 @@ class DaffCartLoadSuccess {
|
|
|
60
62
|
this.type = DaffCartActionTypes.CartLoadSuccessAction;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* An action that indicates a user's cart is loaded but recoverable errors occurred.
|
|
67
|
+
* There should be enough data to render the cart
|
|
68
|
+
* but the user should probably be shown error messages as well.
|
|
69
|
+
* A common example is some cart items being out of stock.
|
|
70
|
+
*/
|
|
71
|
+
class DaffCartLoadPartialSuccess {
|
|
72
|
+
constructor(payload, errors) {
|
|
73
|
+
this.payload = payload;
|
|
74
|
+
this.errors = errors;
|
|
75
|
+
this.type = DaffCartActionTypes.CartLoadPartialSuccessAction;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
63
78
|
/**
|
|
64
79
|
* Indicates the failed load of the cart.
|
|
65
80
|
*/
|
|
@@ -160,6 +175,19 @@ class DaffResolveCartSuccess {
|
|
|
160
175
|
this.type = DaffCartActionTypes.ResolveCartSuccessAction;
|
|
161
176
|
}
|
|
162
177
|
}
|
|
178
|
+
/**
|
|
179
|
+
* An action that indicates a user's cart is resolved but recoverable errors occurred.
|
|
180
|
+
* There should be enough data to render the cart
|
|
181
|
+
* but the user should probably be shown error messages as well.
|
|
182
|
+
* A common example is some cart items being out of stock.
|
|
183
|
+
*/
|
|
184
|
+
class DaffResolveCartPartialSuccess {
|
|
185
|
+
constructor(payload, errors) {
|
|
186
|
+
this.payload = payload;
|
|
187
|
+
this.errors = errors;
|
|
188
|
+
this.type = DaffCartActionTypes.ResolveCartPartialSuccessAction;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
163
191
|
/**
|
|
164
192
|
* An action that indicates that a cart failed to resolve.
|
|
165
193
|
*/
|
|
@@ -200,6 +228,9 @@ var DaffCartItemActionTypes;
|
|
|
200
228
|
DaffCartItemActionTypes["CartItemDeleteAction"] = "[DaffCart] Cart Item Remove Action";
|
|
201
229
|
DaffCartItemActionTypes["CartItemDeleteSuccessAction"] = "[DaffCart] Cart Item Remove Success Action";
|
|
202
230
|
DaffCartItemActionTypes["CartItemDeleteFailureAction"] = "[DaffCart] Cart Item Remove Failure Action";
|
|
231
|
+
DaffCartItemActionTypes["CartItemDeleteOutOfStockAction"] = "[DaffCart] Cart Item Delete Out Of Stock Action";
|
|
232
|
+
DaffCartItemActionTypes["CartItemDeleteOutOfStockSuccessAction"] = "[DaffCart] Cart Item Delete Out Of Stock Success Action";
|
|
233
|
+
DaffCartItemActionTypes["CartItemDeleteOutOfStockFailureAction"] = "[DaffCart] Cart Item Delete Out Of Stock Failure Action";
|
|
203
234
|
DaffCartItemActionTypes["CartItemStateResetAction"] = "[DaffCart] Cart Item State Reset Action";
|
|
204
235
|
})(DaffCartItemActionTypes || (DaffCartItemActionTypes = {}));
|
|
205
236
|
/**
|
|
@@ -341,6 +372,32 @@ class DaffCartItemDeleteFailure {
|
|
|
341
372
|
this.type = DaffCartItemActionTypes.CartItemDeleteFailureAction;
|
|
342
373
|
}
|
|
343
374
|
}
|
|
375
|
+
/**
|
|
376
|
+
* Triggers the deletion of all out of stock cart items.
|
|
377
|
+
*/
|
|
378
|
+
class DaffCartItemDeleteOutOfStock {
|
|
379
|
+
constructor() {
|
|
380
|
+
this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockAction;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Indicates the successful deletion of all out of stock cart items.
|
|
385
|
+
*/
|
|
386
|
+
class DaffCartItemDeleteOutOfStockSuccess {
|
|
387
|
+
constructor(payload) {
|
|
388
|
+
this.payload = payload;
|
|
389
|
+
this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Indicates the failed deletion of all out of stock cart items.
|
|
394
|
+
*/
|
|
395
|
+
class DaffCartItemDeleteOutOfStockFailure {
|
|
396
|
+
constructor(payload) {
|
|
397
|
+
this.payload = payload;
|
|
398
|
+
this.type = DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
344
401
|
/**
|
|
345
402
|
* Resets cart item "new" or "updated" states to default.
|
|
346
403
|
*/
|
|
@@ -1033,8 +1090,11 @@ function daffCartItemEntitiesReducer(state = daffCartItemEntitiesAdapter().getIn
|
|
|
1033
1090
|
case DaffCartItemActionTypes.CartItemUpdateFailureAction:
|
|
1034
1091
|
return adapter.upsertOne(Object.assign(Object.assign({}, state.entities[action.itemId]), { daffState: DaffCartItemStateEnum.Error, errors: ((_b = (_a = state.entities[action.itemId]) === null || _a === void 0 ? void 0 : _a.errors) === null || _b === void 0 ? void 0 : _b.concat(action.payload)) || [action.payload] }), state);
|
|
1035
1092
|
case DaffCartItemActionTypes.CartItemDeleteSuccessAction:
|
|
1093
|
+
case DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
|
|
1036
1094
|
case DaffCartActionTypes.CartLoadSuccessAction:
|
|
1037
1095
|
case DaffCartActionTypes.ResolveCartSuccessAction:
|
|
1096
|
+
case DaffCartActionTypes.CartLoadPartialSuccessAction:
|
|
1097
|
+
case DaffCartActionTypes.ResolveCartPartialSuccessAction:
|
|
1038
1098
|
case DaffCartActionTypes.CartClearSuccessAction:
|
|
1039
1099
|
return adapter.setAll(action.payload.items.map(item => (Object.assign(Object.assign({}, item), { daffState: getDaffState(state.entities[item.id]) || DaffCartItemStateEnum.Default }))), state);
|
|
1040
1100
|
case DaffCartItemActionTypes.CartItemStateResetAction:
|
|
@@ -1161,8 +1221,8 @@ const initialState = Object.freeze({
|
|
|
1161
1221
|
resolved: DaffCartResolveState.Default,
|
|
1162
1222
|
});
|
|
1163
1223
|
|
|
1164
|
-
const initializeErrorAdder = (errorSpace) => (errors,
|
|
1165
|
-
errors: Object.assign(Object.assign({}, errors), { [errorSpace]: errors[errorSpace].concat(
|
|
1224
|
+
const initializeErrorAdder = (errorSpace) => (errors, ...errorsToAdd) => ({
|
|
1225
|
+
errors: Object.assign(Object.assign({}, errors), { [errorSpace]: errors[errorSpace].concat(errorsToAdd) }),
|
|
1166
1226
|
});
|
|
1167
1227
|
const initializeErrorResetter = (errorSpace) => (errors) => ({
|
|
1168
1228
|
errors: Object.assign(Object.assign({}, errors), { [errorSpace]: [] }),
|
|
@@ -1233,6 +1293,10 @@ function cartItemReducer(state = initialState, action) {
|
|
|
1233
1293
|
case DaffCartItemActionTypes.CartItemListAction:
|
|
1234
1294
|
case DaffCartItemActionTypes.CartItemLoadAction:
|
|
1235
1295
|
return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Resolving" /* Resolving */));
|
|
1296
|
+
case DaffCartItemActionTypes.CartItemUpdateAction:
|
|
1297
|
+
case DaffCartItemActionTypes.CartItemDeleteAction:
|
|
1298
|
+
case DaffCartItemActionTypes.CartItemDeleteOutOfStockAction:
|
|
1299
|
+
return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Mutating" /* Mutating */));
|
|
1236
1300
|
case DaffCartItemActionTypes.CartItemAddAction:
|
|
1237
1301
|
return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Adding" /* Adding */));
|
|
1238
1302
|
case DaffCartItemActionTypes.CartItemListSuccessAction:
|
|
@@ -1245,14 +1309,17 @@ function cartItemReducer(state = initialState, action) {
|
|
|
1245
1309
|
case DaffCartItemActionTypes.CartItemAddSuccessAction:
|
|
1246
1310
|
case DaffCartItemActionTypes.CartItemDeleteSuccessAction:
|
|
1247
1311
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$2(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$2(state.loading, "Stable" /* Complete */));
|
|
1312
|
+
case DaffCartItemActionTypes.CartItemDeleteOutOfStockSuccessAction:
|
|
1313
|
+
return Object.assign(Object.assign(Object.assign({}, state), { errors: Object.assign(Object.assign({}, state.errors), { [DaffCartOperationType.Item]: [],
|
|
1314
|
+
// out of stock errors can be in the main cart, remove them here
|
|
1315
|
+
[DaffCartOperationType.Cart]: state.errors[DaffCartOperationType.Cart].filter(({ code }) => code !== DaffCartDriverErrorCodes.PRODUCT_OUT_OF_STOCK) }), cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$2(state.loading, "Stable" /* Complete */));
|
|
1248
1316
|
case DaffCartItemActionTypes.CartItemListFailureAction:
|
|
1249
1317
|
case DaffCartItemActionTypes.CartItemLoadFailureAction:
|
|
1250
1318
|
case DaffCartItemActionTypes.CartItemUpdateFailureAction:
|
|
1251
1319
|
case DaffCartItemActionTypes.CartItemAddFailureAction:
|
|
1252
1320
|
case DaffCartItemActionTypes.CartItemDeleteFailureAction:
|
|
1321
|
+
case DaffCartItemActionTypes.CartItemDeleteOutOfStockFailureAction:
|
|
1253
1322
|
return Object.assign(Object.assign(Object.assign({}, state), addError$2(state.errors, action.payload)), setLoading$2(state.loading, "Stable" /* Complete */));
|
|
1254
|
-
case DaffCartItemActionTypes.CartItemUpdateFailureAction:
|
|
1255
|
-
return Object.assign(Object.assign({}, state), setLoading$2(state.loading, "Stable" /* Complete */));
|
|
1256
1323
|
default:
|
|
1257
1324
|
return state;
|
|
1258
1325
|
}
|
|
@@ -1412,14 +1479,18 @@ function cartReducer(state = initialState, action) {
|
|
|
1412
1479
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), setLoading$8(state.loading, "Stable" /* Complete */));
|
|
1413
1480
|
case DaffCartActionTypes.CartCreateSuccessAction:
|
|
1414
1481
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, state), resetErrors$8(state.errors)), { cart: Object.assign(Object.assign({}, initialState.cart), action.payload) }), setLoading$8(state.loading, "Stable" /* Complete */));
|
|
1415
|
-
case DaffCartActionTypes.CartLoadFailureAction:
|
|
1416
1482
|
case DaffCartActionTypes.CartClearFailureAction:
|
|
1417
1483
|
case DaffCartActionTypes.AddToCartFailureAction:
|
|
1418
1484
|
case DaffCartActionTypes.CartCreateFailureAction:
|
|
1419
1485
|
case DaffCartActionTypes.CartStorageFailureAction:
|
|
1420
|
-
case DaffCartActionTypes.ResolveCartFailureAction:
|
|
1421
1486
|
case DaffCartActionTypes.ResolveCartServerSideAction:
|
|
1422
1487
|
return Object.assign(Object.assign(Object.assign({}, state), addError$8(state.errors, action.payload)), setLoading$8(state.loading, "Stable" /* Complete */));
|
|
1488
|
+
case DaffCartActionTypes.CartLoadFailureAction:
|
|
1489
|
+
case DaffCartActionTypes.ResolveCartFailureAction:
|
|
1490
|
+
return Object.assign(Object.assign(Object.assign({}, state), addError$8(state.errors, ...action.payload)), setLoading$8(state.loading, "Stable" /* Stable */));
|
|
1491
|
+
case DaffCartActionTypes.ResolveCartPartialSuccessAction:
|
|
1492
|
+
case DaffCartActionTypes.CartLoadPartialSuccessAction:
|
|
1493
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, state), { cart: Object.assign(Object.assign({}, state.cart), action.payload) }), addError$8(state.errors, ...action.errors)), setLoading$8(state.loading, "Stable" /* Stable */));
|
|
1423
1494
|
default:
|
|
1424
1495
|
return state;
|
|
1425
1496
|
}
|
|
@@ -1946,12 +2017,13 @@ __decorate([
|
|
|
1946
2017
|
], DaffCartCouponEffects.prototype, "removeAll$", void 0);
|
|
1947
2018
|
|
|
1948
2019
|
class DaffCartItemEffects {
|
|
1949
|
-
constructor(actions$, errorMatcher, driver, storage, cartItemStateDebounceTime) {
|
|
2020
|
+
constructor(actions$, errorMatcher, driver, storage, cartItemStateDebounceTime, store) {
|
|
1950
2021
|
this.actions$ = actions$;
|
|
1951
2022
|
this.errorMatcher = errorMatcher;
|
|
1952
2023
|
this.driver = driver;
|
|
1953
2024
|
this.storage = storage;
|
|
1954
2025
|
this.cartItemStateDebounceTime = cartItemStateDebounceTime;
|
|
2026
|
+
this.store = store;
|
|
1955
2027
|
this.list$ = this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemListAction), switchMap((action) => this.driver.list(this.storage.getCartId()).pipe(map((resp) => new DaffCartItemListSuccess(resp)), catchError(error => of(new DaffCartItemListFailure(this.errorMatcher(error)))))));
|
|
1956
2028
|
this.get$ = this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemLoadAction), switchMap((action) => this.driver.get(this.storage.getCartId(), action.itemId).pipe(map((resp) => new DaffCartItemLoadSuccess(resp)), catchError(error => of(new DaffCartItemLoadFailure(this.errorMatcher(error), action.itemId))))));
|
|
1957
2029
|
this.add$ = this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemAddAction), switchMap((action) => this.driver.add(this.storage.getCartId(), action.input).pipe(map((resp) => new DaffCartItemAddSuccess(resp)), catchError(error => of(new DaffCartItemAddFailure(this.errorMatcher(error)))))));
|
|
@@ -1962,6 +2034,9 @@ class DaffCartItemEffects {
|
|
|
1962
2034
|
// these actions will cause the cart item state reset
|
|
1963
2035
|
DaffCartItemActionTypes.CartItemAddSuccessAction, DaffCartItemActionTypes.CartItemUpdateSuccessAction), mapTo(new DaffCartItemStateReset()));
|
|
1964
2036
|
this.delete$ = this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemDeleteAction), mergeMap((action) => this.driver.delete(this.storage.getCartId(), action.itemId).pipe(map((resp) => new DaffCartItemDeleteSuccess(resp)), catchError(error => of(new DaffCartItemDeleteFailure(this.errorMatcher(error), action.itemId))))));
|
|
2037
|
+
this.removeOutOfStock$ = this.actions$.pipe(ofType(DaffCartItemActionTypes.CartItemDeleteOutOfStockAction), switchMap((action) => this.store.pipe(select(getDaffCartSelectors().selectOutOfStockCartItems), take(1))), switchMap(items => items.length > 0
|
|
2038
|
+
? combineLatest(items.map(item => this.driver.delete(this.storage.getCartId(), item.id))).pipe(map(partialCarts => Object.assign({}, ...partialCarts)))
|
|
2039
|
+
: this.store.pipe(select(getDaffCartSelectors().selectCartValue), take(1))), map(cart => new DaffCartItemDeleteOutOfStockSuccess(cart)), catchError(error => of(new DaffCartItemDeleteOutOfStockFailure(this.errorMatcher(error)))));
|
|
1965
2040
|
}
|
|
1966
2041
|
}
|
|
1967
2042
|
DaffCartItemEffects.decorators = [
|
|
@@ -1973,7 +2048,8 @@ DaffCartItemEffects.ctorParameters = () => [
|
|
|
1973
2048
|
{ type: undefined, decorators: [{ type: Inject, args: [DAFF_CART_ERROR_MATCHER,] }] },
|
|
1974
2049
|
{ type: undefined, decorators: [{ type: Inject, args: [DaffCartItemDriver,] }] },
|
|
1975
2050
|
{ type: DaffCartStorageService },
|
|
1976
|
-
{ type: Number, decorators: [{ type: Inject, args: [DaffCartItemStateDebounceTime,] }] }
|
|
2051
|
+
{ type: Number, decorators: [{ type: Inject, args: [DaffCartItemStateDebounceTime,] }] },
|
|
2052
|
+
{ type: Store }
|
|
1977
2053
|
];
|
|
1978
2054
|
__decorate([
|
|
1979
2055
|
Effect(),
|
|
@@ -1999,6 +2075,10 @@ __decorate([
|
|
|
1999
2075
|
Effect(),
|
|
2000
2076
|
__metadata("design:type", Object)
|
|
2001
2077
|
], DaffCartItemEffects.prototype, "delete$", void 0);
|
|
2078
|
+
__decorate([
|
|
2079
|
+
Effect(),
|
|
2080
|
+
__metadata("design:type", Object)
|
|
2081
|
+
], DaffCartItemEffects.prototype, "removeOutOfStock$", void 0);
|
|
2002
2082
|
|
|
2003
2083
|
class DaffCartOrderEffects {
|
|
2004
2084
|
constructor(actions$, errorMatcher, driver, storage) {
|
|
@@ -2107,19 +2187,32 @@ class DaffCartResolverEffects {
|
|
|
2107
2187
|
this.errorMatcher = errorMatcher;
|
|
2108
2188
|
this.cartStorage = cartStorage;
|
|
2109
2189
|
this.driver = driver;
|
|
2110
|
-
this.onResolveCart = () => this.actions$.pipe(ofType(DaffCartActionTypes.ResolveCartAction), switchMap(() => of(null).pipe(map(() => this.cartStorage.getCartId()), switchMap(cartId => cartId ? of({ id: cartId }) : this.driver.create()), switchMap(({ id }) => this.driver.get(id)),
|
|
2190
|
+
this.onResolveCart = () => this.actions$.pipe(ofType(DaffCartActionTypes.ResolveCartAction), switchMap(() => of(null).pipe(map(() => this.cartStorage.getCartId()), switchMap(cartId => cartId ? of({ id: cartId }) : this.driver.create()), switchMap(({ id }) => this.driver.get(id)), switchMap(({ response, errors }) => {
|
|
2191
|
+
if (errors.length === 0) {
|
|
2192
|
+
return of(new DaffResolveCartSuccess(response));
|
|
2193
|
+
}
|
|
2194
|
+
const hasOnlyRecoverableErrors = errors.reduce((acc, error) => acc && error.recoverable, true);
|
|
2195
|
+
if (hasOnlyRecoverableErrors) {
|
|
2196
|
+
return of(new DaffResolveCartPartialSuccess(response, errors.map(error => this.errorMatcher(error))));
|
|
2197
|
+
}
|
|
2198
|
+
if (errors.filter(error => error instanceof DaffCartNotFoundError).length > 0) {
|
|
2199
|
+
return this.driver.create().pipe(switchMap(({ id }) => this.driver.get(id)), map(resp => new DaffResolveCartSuccess(resp.response)), catchError((innerError) => of(new DaffResolveCartFailure([this.errorMatcher(new DaffCartNotFoundOrCreatedResolutionError(innerError.message))]))));
|
|
2200
|
+
}
|
|
2201
|
+
// there are no special case errors, DaffResolveCartFailure will suffice
|
|
2202
|
+
// just map the errors
|
|
2203
|
+
return of(new DaffResolveCartFailure(errors.map(error => this.errorMatcher(
|
|
2204
|
+
// I wish there was a better way to check this
|
|
2205
|
+
error instanceof DaffInheritableError || !!error.code
|
|
2206
|
+
? error
|
|
2207
|
+
: new DaffCartResolutionError(error.message)))));
|
|
2208
|
+
}), catchError((error) => {
|
|
2111
2209
|
switch (true) {
|
|
2112
2210
|
case error instanceof DaffServerSideStorageError:
|
|
2113
2211
|
return of(new DaffResolveCartServerSide(this.errorMatcher(new DaffCartServerSideResolutionError(error.message))));
|
|
2114
2212
|
case error instanceof DaffStorageServiceError:
|
|
2115
|
-
return of(new DaffResolveCartFailure(this.errorMatcher(new DaffCartStorageResolutionError(error.message))));
|
|
2116
|
-
case error instanceof DaffCartNotFoundError:
|
|
2117
|
-
return this.driver.create().pipe(switchMap(({ id }) => this.driver.get(id)), map(resp => new DaffResolveCartSuccess(resp)), catchError((innerError) => of(new DaffResolveCartFailure(this.errorMatcher(new DaffCartNotFoundOrCreatedResolutionError(innerError.message))))));
|
|
2118
|
-
// I wish there was a better way to check this
|
|
2119
|
-
case error instanceof DaffInheritableError || !!error.code:
|
|
2120
|
-
return of(new DaffResolveCartFailure(this.errorMatcher(error)));
|
|
2213
|
+
return of(new DaffResolveCartFailure([this.errorMatcher(new DaffCartStorageResolutionError(error.message))]));
|
|
2121
2214
|
default:
|
|
2122
|
-
return of(new DaffResolveCartFailure(this.errorMatcher(new DaffCartResolutionError(error.message))));
|
|
2215
|
+
return of(new DaffResolveCartFailure([this.errorMatcher(new DaffCartResolutionError(error.message))]));
|
|
2123
2216
|
}
|
|
2124
2217
|
}))));
|
|
2125
2218
|
}
|
|
@@ -2239,9 +2332,18 @@ class DaffCartEffects {
|
|
|
2239
2332
|
this.storeId$ = this.actions$.pipe(ofType(DaffCartActionTypes.CartCreateSuccessAction, DaffCartActionTypes.ResolveCartSuccessAction), switchMap((action) => of(null).pipe(tap(() => {
|
|
2240
2333
|
this.storage.setCartId(action.payload.id);
|
|
2241
2334
|
}), switchMapTo(EMPTY), catchError(error => of(new DaffCartStorageFailure(this.errorMatcher(error)))))));
|
|
2242
|
-
this.get$ = this.actions$.pipe(ofType(DaffCartActionTypes.CartLoadAction), switchMap((action) => of(null).pipe(map(() => this.storage.getCartId()), switchMap(cartId => this.driver.get(cartId)), map((
|
|
2335
|
+
this.get$ = this.actions$.pipe(ofType(DaffCartActionTypes.CartLoadAction), switchMap((action) => of(null).pipe(map(() => this.storage.getCartId()), switchMap(cartId => this.driver.get(cartId)), map(({ response, errors }) => {
|
|
2336
|
+
if (errors.length === 0) {
|
|
2337
|
+
return new DaffCartLoadSuccess(response);
|
|
2338
|
+
}
|
|
2339
|
+
const hasOnlyRecoverableErrors = errors.reduce((acc, error) => acc && error.recoverable, true);
|
|
2340
|
+
if (hasOnlyRecoverableErrors) {
|
|
2341
|
+
return new DaffCartLoadPartialSuccess(response, errors.map(error => this.errorMatcher(error)));
|
|
2342
|
+
}
|
|
2343
|
+
return new DaffCartLoadFailure(errors.map(error => this.errorMatcher(error)));
|
|
2344
|
+
}), catchError(error => of(error instanceof DaffStorageServiceError
|
|
2243
2345
|
? new DaffCartStorageFailure(this.errorMatcher(error))
|
|
2244
|
-
: new DaffCartLoadFailure(this.errorMatcher(error)))))));
|
|
2346
|
+
: new DaffCartLoadFailure([this.errorMatcher(error)]))))));
|
|
2245
2347
|
this.addToCart$ = this.actions$.pipe(ofType(DaffCartActionTypes.AddToCartAction), switchMap((action) => this.driver.addToCart(action.payload.productId, action.payload.qty).pipe(map((resp) => new DaffAddToCartSuccess(resp)), catchError(error => of(new DaffAddToCartFailure(this.errorMatcher(error)))))));
|
|
2246
2348
|
this.clear$ = this.actions$.pipe(ofType(DaffCartActionTypes.CartClearAction), switchMap((action) => of(null).pipe(map(() => this.storage.getCartId()), switchMap(cartId => this.driver.clear(cartId)), map((resp) => new DaffCartClearSuccess(resp)), catchError(error => of(error instanceof DaffStorageServiceError
|
|
2247
2349
|
? new DaffCartStorageFailure(this.errorMatcher(error))
|
|
@@ -2478,5 +2580,5 @@ DaffCartFacade.ctorParameters = () => [
|
|
|
2478
2580
|
* Generated bundle index. Do not edit.
|
|
2479
2581
|
*/
|
|
2480
2582
|
|
|
2481
|
-
export { DAFF_CART_EXTRA_REDUCERS, DAFF_CART_STORE_FEATURE_KEY, DaffAddToCart, DaffAddToCartFailure, DaffAddToCartSuccess, DaffCartActionTypes, DaffCartAddressActionTypes, DaffCartAddressUpdate, DaffCartAddressUpdateFailure, DaffCartAddressUpdateSuccess, DaffCartBillingAddressActionTypes, DaffCartBillingAddressLoad, DaffCartBillingAddressLoadFailure, DaffCartBillingAddressLoadSuccess, DaffCartBillingAddressUpdate, DaffCartBillingAddressUpdateFailure, DaffCartBillingAddressUpdateSuccess, DaffCartClear, DaffCartClearFailure, DaffCartClearSuccess, DaffCartCouponActionTypes, DaffCartCouponApply, DaffCartCouponApplyFailure, DaffCartCouponApplySuccess, DaffCartCouponClearErrors, DaffCartCouponList, DaffCartCouponListFailure, DaffCartCouponListSuccess, DaffCartCouponRemove, DaffCartCouponRemoveAll, DaffCartCouponRemoveAllFailure, DaffCartCouponRemoveAllSuccess, DaffCartCouponRemoveFailure, DaffCartCouponRemoveSuccess, DaffCartCreate, DaffCartCreateFailure, DaffCartCreateSuccess, DaffCartFacade, DaffCartItemActionTypes, DaffCartItemAdd, DaffCartItemAddFailure, DaffCartItemAddSuccess, DaffCartItemDelete, DaffCartItemDeleteFailure, DaffCartItemDeleteSuccess, DaffCartItemList, DaffCartItemListFailure, DaffCartItemListSuccess, DaffCartItemLoad, DaffCartItemLoadFailure, DaffCartItemLoadSuccess, DaffCartItemStateDebounceTime, DaffCartItemStateEnum, DaffCartItemStateReset, DaffCartItemUpdate, DaffCartItemUpdateFailure, DaffCartItemUpdateSuccess, DaffCartLoad, DaffCartLoadFailure, DaffCartLoadSuccess, DaffCartOperationType, DaffCartOrderActionTypes, DaffCartPaymentActionTypes, DaffCartPaymentLoad, DaffCartPaymentLoadFailure, DaffCartPaymentLoadSuccess, DaffCartPaymentMethodAdd, DaffCartPaymentMethodsActionTypes, DaffCartPaymentMethodsLoad, DaffCartPaymentMethodsLoadFailure, DaffCartPaymentMethodsLoadSuccess, DaffCartPaymentRemove, DaffCartPaymentRemoveFailure, DaffCartPaymentRemoveSuccess, DaffCartPaymentUpdate, DaffCartPaymentUpdateFailure, DaffCartPaymentUpdateSuccess, DaffCartPaymentUpdateWithBilling, DaffCartPaymentUpdateWithBillingFailure, DaffCartPaymentUpdateWithBillingSuccess, DaffCartPlaceOrder, DaffCartPlaceOrderFailure, DaffCartPlaceOrderSuccess, DaffCartResolveState, DaffCartShippingAddressActionTypes, DaffCartShippingAddressLoad, DaffCartShippingAddressLoadFailure, DaffCartShippingAddressLoadSuccess, DaffCartShippingAddressUpdate, DaffCartShippingAddressUpdateFailure, DaffCartShippingAddressUpdateSuccess, DaffCartShippingInformationActionTypes, DaffCartShippingInformationDelete, DaffCartShippingInformationDeleteFailure, DaffCartShippingInformationDeleteSuccess, DaffCartShippingInformationLoad, DaffCartShippingInformationLoadFailure, DaffCartShippingInformationLoadSuccess, DaffCartShippingInformationUpdate, DaffCartShippingInformationUpdateFailure, DaffCartShippingInformationUpdateSuccess, DaffCartShippingMethodsActionTypes, DaffCartShippingMethodsLoad, DaffCartShippingMethodsLoadFailure, DaffCartShippingMethodsLoadSuccess, DaffCartStateModule, DaffCartStorageFailure, DaffResolveCart, DaffResolveCartFailure, DaffResolveCartServerSide, DaffResolveCartSuccess, daffCartOrderInitialState, daffCartOrderReducer, daffCartProvideExtraReducers, daffCartReducer, daffCartReducers, getDaffCartSelectors, initialState, initializeLoadingSetter, ɵ0$5 as ɵ0, ɵ1$3 as ɵ1, cartReducer as ɵa, cartItemReducer as ɵb, cartBillingAddressReducer as ɵc, cartShippingAddressReducer as ɵd, cartShippingMethodsReducer as ɵe, cartShippingInformationReducer as ɵf, cartPaymentReducer as ɵg, cartPaymentMethodsReducer as ɵh, cartCouponReducer as ɵi, cartResolveReducer as ɵj, daffCartItemEntitiesReducer as ɵk, DAFF_CART_REDUCERS as ɵl, DaffCartEffects as ɵm, DaffCartItemEffects as ɵn, DaffCartBillingAddressEffects as ɵo, DaffCartShippingAddressEffects as ɵp, DaffCartAddressEffects as ɵq, DaffCartShippingInformationEffects as ɵr, DaffCartShippingMethodsEffects as ɵs, DaffCartPaymentEffects as ɵt, DaffCartPaymentMethodsEffects as ɵu, DaffCartOrderEffects as ɵv, DaffCartCouponEffects as ɵw, DaffCartResolverEffects as ɵx };
|
|
2583
|
+
export { DAFF_CART_EXTRA_REDUCERS, DAFF_CART_STORE_FEATURE_KEY, DaffAddToCart, DaffAddToCartFailure, DaffAddToCartSuccess, DaffCartActionTypes, DaffCartAddressActionTypes, DaffCartAddressUpdate, DaffCartAddressUpdateFailure, DaffCartAddressUpdateSuccess, DaffCartBillingAddressActionTypes, DaffCartBillingAddressLoad, DaffCartBillingAddressLoadFailure, DaffCartBillingAddressLoadSuccess, DaffCartBillingAddressUpdate, DaffCartBillingAddressUpdateFailure, DaffCartBillingAddressUpdateSuccess, DaffCartClear, DaffCartClearFailure, DaffCartClearSuccess, DaffCartCouponActionTypes, DaffCartCouponApply, DaffCartCouponApplyFailure, DaffCartCouponApplySuccess, DaffCartCouponClearErrors, DaffCartCouponList, DaffCartCouponListFailure, DaffCartCouponListSuccess, DaffCartCouponRemove, DaffCartCouponRemoveAll, DaffCartCouponRemoveAllFailure, DaffCartCouponRemoveAllSuccess, DaffCartCouponRemoveFailure, DaffCartCouponRemoveSuccess, DaffCartCreate, DaffCartCreateFailure, DaffCartCreateSuccess, DaffCartFacade, DaffCartItemActionTypes, DaffCartItemAdd, DaffCartItemAddFailure, DaffCartItemAddSuccess, DaffCartItemDelete, DaffCartItemDeleteFailure, DaffCartItemDeleteOutOfStock, DaffCartItemDeleteOutOfStockFailure, DaffCartItemDeleteOutOfStockSuccess, DaffCartItemDeleteSuccess, DaffCartItemList, DaffCartItemListFailure, DaffCartItemListSuccess, DaffCartItemLoad, DaffCartItemLoadFailure, DaffCartItemLoadSuccess, DaffCartItemStateDebounceTime, DaffCartItemStateEnum, DaffCartItemStateReset, DaffCartItemUpdate, DaffCartItemUpdateFailure, DaffCartItemUpdateSuccess, DaffCartLoad, DaffCartLoadFailure, DaffCartLoadPartialSuccess, DaffCartLoadSuccess, DaffCartOperationType, DaffCartOrderActionTypes, DaffCartPaymentActionTypes, DaffCartPaymentLoad, DaffCartPaymentLoadFailure, DaffCartPaymentLoadSuccess, DaffCartPaymentMethodAdd, DaffCartPaymentMethodsActionTypes, DaffCartPaymentMethodsLoad, DaffCartPaymentMethodsLoadFailure, DaffCartPaymentMethodsLoadSuccess, DaffCartPaymentRemove, DaffCartPaymentRemoveFailure, DaffCartPaymentRemoveSuccess, DaffCartPaymentUpdate, DaffCartPaymentUpdateFailure, DaffCartPaymentUpdateSuccess, DaffCartPaymentUpdateWithBilling, DaffCartPaymentUpdateWithBillingFailure, DaffCartPaymentUpdateWithBillingSuccess, DaffCartPlaceOrder, DaffCartPlaceOrderFailure, DaffCartPlaceOrderSuccess, DaffCartResolveState, DaffCartShippingAddressActionTypes, DaffCartShippingAddressLoad, DaffCartShippingAddressLoadFailure, DaffCartShippingAddressLoadSuccess, DaffCartShippingAddressUpdate, DaffCartShippingAddressUpdateFailure, DaffCartShippingAddressUpdateSuccess, DaffCartShippingInformationActionTypes, DaffCartShippingInformationDelete, DaffCartShippingInformationDeleteFailure, DaffCartShippingInformationDeleteSuccess, DaffCartShippingInformationLoad, DaffCartShippingInformationLoadFailure, DaffCartShippingInformationLoadSuccess, DaffCartShippingInformationUpdate, DaffCartShippingInformationUpdateFailure, DaffCartShippingInformationUpdateSuccess, DaffCartShippingMethodsActionTypes, DaffCartShippingMethodsLoad, DaffCartShippingMethodsLoadFailure, DaffCartShippingMethodsLoadSuccess, DaffCartStateModule, DaffCartStorageFailure, DaffResolveCart, DaffResolveCartFailure, DaffResolveCartPartialSuccess, DaffResolveCartServerSide, DaffResolveCartSuccess, daffCartOrderInitialState, daffCartOrderReducer, daffCartProvideExtraReducers, daffCartReducer, daffCartReducers, getDaffCartSelectors, initialState, initializeLoadingSetter, ɵ0$5 as ɵ0, ɵ1$3 as ɵ1, cartReducer as ɵa, cartItemReducer as ɵb, cartBillingAddressReducer as ɵc, cartShippingAddressReducer as ɵd, cartShippingMethodsReducer as ɵe, cartShippingInformationReducer as ɵf, cartPaymentReducer as ɵg, cartPaymentMethodsReducer as ɵh, cartCouponReducer as ɵi, cartResolveReducer as ɵj, daffCartItemEntitiesReducer as ɵk, DAFF_CART_REDUCERS as ɵl, DaffCartEffects as ɵm, DaffCartItemEffects as ɵn, DaffCartBillingAddressEffects as ɵo, DaffCartShippingAddressEffects as ɵp, DaffCartAddressEffects as ɵq, DaffCartShippingInformationEffects as ɵr, DaffCartShippingMethodsEffects as ɵs, DaffCartPaymentEffects as ɵt, DaffCartPaymentMethodsEffects as ɵu, DaffCartOrderEffects as ɵv, DaffCartCouponEffects as ɵw, DaffCartResolverEffects as ɵx };
|
|
2482
2584
|
//# sourceMappingURL=daffodil-cart-state.js.map
|