@daffodil/cart 0.39.8 → 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-testing.umd.js +12 -2
- package/bundles/daffodil-cart-driver-magento-testing.umd.js.map +1 -1
- package/bundles/daffodil-cart-driver-magento-testing.umd.min.js +2 -2
- package/bundles/daffodil-cart-driver-magento-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-driver-magento.umd.js +119 -39
- 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 +6 -3
- 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-routing.umd.js +43 -0
- package/bundles/daffodil-cart-routing.umd.js.map +1 -1
- package/bundles/daffodil-cart-routing.umd.min.js +1 -1
- package/bundles/daffodil-cart-routing.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-state-testing.umd.js +13 -2
- package/bundles/daffodil-cart-state-testing.umd.js.map +1 -1
- package/bundles/daffodil-cart-state-testing.umd.min.js +2 -2
- package/bundles/daffodil-cart-state-testing.umd.min.js.map +1 -1
- package/bundles/daffodil-cart-state.umd.js +169 -28
- 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/bundles/daffodil-cart-testing.umd.js +3 -3
- package/bundles/daffodil-cart-testing.umd.js.map +1 -1
- package/bundles/daffodil-cart-testing.umd.min.js +2 -2
- package/bundles/daffodil-cart-testing.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-item.service.d.ts +3 -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/magento/injection-tokens/public_api.d.ts +1 -0
- package/driver/magento/injection-tokens/transforms/cart-item/token.d.ts +22 -0
- package/driver/magento/interfaces/cart-item-transform.type.d.ts +3 -0
- package/driver/magento/interfaces/public_api.d.ts +1 -0
- package/driver/magento/public_api.d.ts +1 -0
- package/driver/magento/testing/daffodil-cart-driver-magento-testing.metadata.json +1 -1
- package/driver/magento/testing/factories/public_api.d.ts +10 -10
- package/driver/magento/transforms/outputs/cart-coupon-response.service.d.ts +3 -0
- package/driver/magento/transforms/outputs/cart-item/cart-item-transformer.d.ts +7 -4
- package/driver/magento/transforms/outputs/cart.service.d.ts +3 -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-item.service.js +11 -8
- package/esm2015/driver/magento/cart.service.js +20 -7
- package/esm2015/driver/magento/errors/map.js +2 -2
- package/esm2015/driver/magento/errors/transform.js +15 -6
- package/esm2015/driver/magento/injection-tokens/public_api.js +2 -1
- package/esm2015/driver/magento/injection-tokens/transforms/cart-item/token.js +27 -0
- package/esm2015/driver/magento/interfaces/cart-item-transform.type.js +2 -0
- package/esm2015/driver/magento/interfaces/public_api.js +2 -0
- package/esm2015/driver/magento/public_api.js +2 -1
- package/esm2015/driver/magento/testing/factories/cart-address-input.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-address.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-coupon.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-item/bundle-cart-item.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-item/cart-item.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-item/configurable-cart-item.factory.js +1 -1
- package/esm2015/driver/magento/testing/factories/cart-payment-method.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart-shipping-method.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/cart.factory.js +2 -2
- package/esm2015/driver/magento/testing/factories/public_api.js +11 -11
- package/esm2015/driver/magento/transforms/outputs/cart-coupon-response.service.js +15 -5
- package/esm2015/driver/magento/transforms/outputs/cart-item/bundle-cart-item-transformer.js +2 -2
- package/esm2015/driver/magento/transforms/outputs/cart-item/cart-item-transformer.js +9 -6
- package/esm2015/driver/magento/transforms/outputs/cart-item/configurable-cart-item-transformer.js +2 -2
- package/esm2015/driver/magento/transforms/outputs/cart-item/simple-cart-item-transformer.js +3 -3
- package/esm2015/driver/magento/transforms/outputs/cart.service.js +12 -7
- package/esm2015/driver/testing/drivers/cart/cart.service.js +5 -2
- package/esm2015/driver/testing/drivers/cart-order/cart-order.service.js +2 -2
- package/esm2015/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.js +6 -0
- package/esm2015/routing/guards/in-stock-items/in-stock-items.guard.js +43 -0
- package/esm2015/routing/guards/public_api.js +3 -1
- 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 +24 -8
- package/esm2015/state/effects/cart.effects.js +13 -4
- package/esm2015/state/facades/cart/cart-facade.interface.js +1 -1
- package/esm2015/state/facades/cart/cart.facade.js +10 -2
- package/esm2015/state/models/stateful-cart-item.js +1 -1
- package/esm2015/state/reducers/cart/cart.reducer.js +7 -4
- package/esm2015/state/reducers/cart-item/cart-item.reducer.js +11 -1
- package/esm2015/state/reducers/cart-item-entities/cart-item-entities.reducer.js +11 -7
- package/esm2015/state/reducers/errors/error-state-helpers.js +3 -3
- package/esm2015/state/selectors/cart-item-entities/cart-item-entities.selectors.js +7 -1
- package/esm2015/state/testing/factories/stateful-cart-item.factory.js +2 -1
- package/esm2015/state/testing/factories/stateful-composite-cart-item.factory.js +5 -1
- package/esm2015/state/testing/factories/stateful-configurable-cart-item.factory.js +5 -1
- package/esm2015/state/testing/mock-cart-facade.js +7 -1
- package/esm2015/testing/factories/cart-address.factory.js +2 -2
- package/esm2015/testing/factories/cart-coupon.factory.js +2 -2
- package/esm2015/testing/factories/cart-item/cart-item.factory.js +3 -3
- package/esm2015/testing/factories/cart-item/composite-cart-item.factory.js +2 -2
- package/esm2015/testing/factories/cart-item/configurable-cart-item.factory.js +1 -1
- package/esm2015/testing/factories/cart-shipping-rate.factory.js +2 -2
- package/esm2015/testing/factories/cart.factory.js +2 -2
- 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-testing.js +2 -2
- package/fesm2015/daffodil-cart-driver-magento-testing.js.map +1 -1
- package/fesm2015/daffodil-cart-driver-magento.js +108 -44
- package/fesm2015/daffodil-cart-driver-magento.js.map +1 -1
- package/fesm2015/daffodil-cart-driver-testing.js +5 -2
- package/fesm2015/daffodil-cart-driver-testing.js.map +1 -1
- package/fesm2015/daffodil-cart-driver.js.map +1 -1
- package/fesm2015/daffodil-cart-routing.js +40 -1
- package/fesm2015/daffodil-cart-routing.js.map +1 -1
- package/fesm2015/daffodil-cart-state-testing.js +15 -0
- package/fesm2015/daffodil-cart-state-testing.js.map +1 -1
- package/fesm2015/daffodil-cart-state.js +149 -28
- package/fesm2015/daffodil-cart-state.js.map +1 -1
- package/fesm2015/daffodil-cart-testing.js +2 -2
- package/fesm2015/daffodil-cart-testing.js.map +1 -1
- package/package.json +6 -6
- package/routing/daffodil-cart-routing.metadata.json +1 -1
- package/routing/guards/in-stock-items/in-stock-items-guard-redirect.token.d.ts +5 -0
- package/routing/guards/in-stock-items/in-stock-items.guard.d.ts +17 -0
- package/routing/guards/public_api.d.ts +2 -0
- 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/facades/cart/cart-facade.interface.d.ts +19 -0
- package/state/facades/cart/cart.facade.d.ts +5 -0
- package/state/models/stateful-cart-item.d.ts +5 -0
- package/state/reducers/errors/error-state-helpers.d.ts +1 -1
- package/state/selectors/cart-item-entities/cart-item-entities.selectors.d.ts +13 -0
- package/state/testing/daffodil-cart-state-testing.metadata.json +1 -1
- package/state/testing/factories/stateful-cart-item.factory.d.ts +1 -0
- package/state/testing/factories/stateful-composite-cart-item.factory.d.ts +1 -0
- package/state/testing/factories/stateful-configurable-cart-item.factory.d.ts +1 -0
- package/state/testing/mock-cart-facade.d.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../libs/cart/driver/src/errors/codes.enum.ts","../../../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","../../../node_modules/tslib/tslib.es6.js","../../../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"],"names":["DaffCartDriverErrorCodes","DaffCartDriver","InjectionToken","DaffCartBillingAddressDriver","DaffCartAddressDriver","DaffCartCouponDriver","DaffCartItemDriver","DaffCartPaymentMethodsDriver","DaffCartPaymentDriver","DaffCartShippingAddressDriver","DaffCartShippingInformationDriver","DaffCartShippingMethodsDriver","DaffCartOrderDriver","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","DaffCartNotFoundError","message","_this","_super","code","CART_NOT_FOUND","DaffInheritableError","DaffCartExpiredPaymentTokenError","EXPIRED_PAYMENT_METHOD","DaffCartInvalidAPIResponseError","INVALID_API_RESPONSE","DaffInvalidCountryError","INVALID_COUNTRY","DaffInvalidCouponCodeError","coupon","INVALID_COUPON_CODE","DaffInvalidEmailError","INVALID_EMAIL","DaffInvalidRegionError","INVALID_REGION","DaffCartItemExceedsMaxQtyError","ITEM_EXCEEDS_MAX_QTY","DaffProductNotFoundError","PRODUCT_NOT_FOUND","DaffProductOutOfStockError","PRODUCT_OUT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AAAK,KAAMI,IAAQJ,YAHAK,EAAAE,KAAenC,EAAAA,yBAAyBoD,8BADL5B,EAAA2B,EAAAjB,MAAAG,EAAAA,oCCGnD,SAAAgB,EAAYrB,GAAZ,IAAAC,EACEC,EAAAX,KAAAK,KAAMI,IAAQJ,YAHAK,EAAAE,KAAenC,EAAAA,yBAAyBsD,2BADX9B,EAAA6B,EAAAnB,MAAAG,EAAAA,oCCG7C,SAAAkB,EAAYvB,GAAZ,IAAAC,EACEC,EAAAX,KAAAK,KAAMI,IAAQJ,YAHAK,EAAAE,KAAenC,EAAAA,yBAAyBwD,8BADThC,EAAA+B,EAAArB,MAAAG,EAAAA,sBCInCoB,IAAsBC,EAAA,IAChC1D,EAAAA,yBAAyBoC,gBAAiBL,EAC3C2B,EAAC1D,EAAAA,yBAAyBsD,mBAAoBD,EAC9CK,EAAC1D,EAAAA,yBAAyBwD,sBAAuBD,EACjDG,EAAC1D,EAAAA,yBAAyB8C,qBAAsBF,EAChDc,EAAC1D,EAAAA,yBAAyB2C,iBAAkBD,EAC5CgB,EAAC1D,EAAAA,yBAAyBgD,eAAgBD,EAC1CW,EAAC1D,EAAAA,yBAAyBkD,gBAAiBD,EAC3CS,EAAC1D,EAAAA,yBAAyByC,sBAAuBD,EACjDkB,EAAC1D,EAAAA,yBAAyBuC,wBAAyBD,EACnDoB,EAAC1D,EAAAA,yBAAyBoD,sBAAuBD","sourcesContent":["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 { 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","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\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"]}
|
|
1
|
+
{"version":3,"sources":["../../../libs/cart/driver/src/errors/codes.enum.ts","../../../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","../../../node_modules/tslib/tslib.es6.js","../../../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"],"names":["DaffCartDriverErrorCodes","DaffCartDriver","InjectionToken","DaffCartBillingAddressDriver","DaffCartAddressDriver","DaffCartCouponDriver","DaffCartItemDriver","DaffCartPaymentMethodsDriver","DaffCartPaymentDriver","DaffCartShippingAddressDriver","DaffCartShippingInformationDriver","DaffCartShippingMethodsDriver","DaffCartOrderDriver","extendStatics","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","__extends","TypeError","String","__","this","constructor","create","DaffCartNotFoundError","message","_this","_super","code","CART_NOT_FOUND","DaffInheritableError","DaffCartExpiredPaymentTokenError","EXPIRED_PAYMENT_METHOD","DaffCartInvalidAPIResponseError","INVALID_API_RESPONSE","DaffInvalidCountryError","INVALID_COUNTRY","DaffInvalidCouponCodeError","coupon","INVALID_COUPON_CODE","DaffInvalidEmailError","INVALID_EMAIL","DaffInvalidRegionError","INVALID_REGION","DaffCartItemExceedsMaxQtyError","ITEM_EXCEEDS_MAX_QTY","DaffProductNotFoundError","PRODUCT_NOT_FOUND","DaffProductOutOfStockError","PRODUCT_OUT_OF_STOCK","DaffCartDriverErrorMap","_a"],"mappings":"mcAAYA,ECkCCC,EAAiB,IAAIC,EAAAA,eAChC,kBCTWC,EAA+B,IAAID,EAAAA,eAE9C,gCCPWE,EAAwB,IAAIF,EAAAA,eAEvC,yBCUWG,EAAuB,IAAIH,EAAAA,eACtC,wBCaWI,EAAqB,IAAIJ,EAAAA,eAEpC,sBC/BWK,EAA+B,IAAIL,EAAAA,eAE9C,gCCkBWM,EAAwB,IAAIN,EAAAA,eAEvC,yBCdWO,EAAgC,IAAIP,EAAAA,eAE/C,iCCIWQ,EAAoC,IAAIR,EAAAA,eAEnD,qCCdWS,EAAgC,IAAIT,EAAAA,eAE/C,iCCCWU,EAAsB,IAAIV,EAAAA,eACrC,wBXxBUF,EAAAA,EAAAA,2BAAAA,EAAAA,yBAAwB,KAClC,eAAA,sBACAA,EAAA,kBAAA,yBACAA,EAAA,qBAAA,4BACAA,EAAA,oBAAA,2BACAA,EAAA,gBAAA,uBACAA,EAAA,cAAA,qBACAA,EAAA,eAAA,sBACAA,EAAA,qBAAA,4BACAA,EAAA,uBAAA,8BACAA,EAAA,qBAAA;;;;;;;;;;;;;;;AYMF,IAAI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AAiBD,EAC3CS,EAAC1D,EAAAA,yBAAyByC,sBAAuBD,EACjDkB,EAAC1D,EAAAA,yBAAyBuC,wBAAyBD,EACnDoB,EAAC1D,EAAAA,yBAAyBoD,sBAAuBD","sourcesContent":["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 { 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","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\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"]}
|
|
@@ -142,6 +142,47 @@
|
|
|
142
142
|
{ type: String, decorators: [{ type: i0.Inject, args: [DaffCartItemsGuardRedirectUrl,] }] }
|
|
143
143
|
]; };
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* The path to which the user should be redirected if the cart has no items when {@link DaffCartInStockItemsGuard} is invoked.
|
|
147
|
+
*/
|
|
148
|
+
var DaffCartInStockItemsGuardRedirectUrl = new i0.InjectionToken('DaffCartInStockItemsGuardRedirectUrl');
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A routing guard that will ensure that the cart has only in-stock items before allowing activation of a route.
|
|
152
|
+
* If the cart has any out of stock items in it, then `canActivate` will emit `false` and redirect to a specific path.
|
|
153
|
+
* The url is `/` by default but can be overridden with the {@link DaffCartInStockItemsGuardRedirectUrl} injection token.
|
|
154
|
+
* The guard will not wait until the cart has been resolved before performing the check and emitting.
|
|
155
|
+
* Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.
|
|
156
|
+
*/
|
|
157
|
+
var DaffCartInStockItemsGuard = /** @class */ (function () {
|
|
158
|
+
function DaffCartInStockItemsGuard(facade, router, redirectUrl) {
|
|
159
|
+
this.facade = facade;
|
|
160
|
+
this.router = router;
|
|
161
|
+
this.redirectUrl = redirectUrl;
|
|
162
|
+
}
|
|
163
|
+
DaffCartInStockItemsGuard.prototype.canActivate = function () {
|
|
164
|
+
var _this = this;
|
|
165
|
+
return this.facade.hasOutOfStockItems$.pipe(operators.map(function (hasOutOfStockItems) { return !hasOutOfStockItems; }), operators.take(1), operators.tap(function (hasNoOutOfStockItems) {
|
|
166
|
+
if (!hasNoOutOfStockItems) {
|
|
167
|
+
_this.router.navigateByUrl(_this.redirectUrl);
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
};
|
|
171
|
+
return DaffCartInStockItemsGuard;
|
|
172
|
+
}());
|
|
173
|
+
/** @nocollapse */ DaffCartInStockItemsGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function DaffCartInStockItemsGuard_Factory() { return new DaffCartInStockItemsGuard(i0.ɵɵinject(i1.DaffCartFacade), i0.ɵɵinject(i2.Router), i0.ɵɵinject(DaffCartInStockItemsGuardRedirectUrl)); }, token: DaffCartInStockItemsGuard, providedIn: "root" });
|
|
174
|
+
DaffCartInStockItemsGuard.decorators = [
|
|
175
|
+
{ type: i0.Injectable, args: [{
|
|
176
|
+
providedIn: 'root',
|
|
177
|
+
},] }
|
|
178
|
+
];
|
|
179
|
+
/** @nocollapse */
|
|
180
|
+
DaffCartInStockItemsGuard.ctorParameters = function () { return [
|
|
181
|
+
{ type: i1.DaffCartFacade },
|
|
182
|
+
{ type: i2.Router },
|
|
183
|
+
{ type: String, decorators: [{ type: i0.Inject, args: [DaffCartInStockItemsGuardRedirectUrl,] }] }
|
|
184
|
+
]; };
|
|
185
|
+
|
|
145
186
|
var DaffCartPaymentMethodGuardRedirectUrl = new i0.InjectionToken('DaffCartPaymentMethodGuardRedirectUrl');
|
|
146
187
|
|
|
147
188
|
/**
|
|
@@ -407,6 +448,8 @@
|
|
|
407
448
|
exports.DAFF_CART_ROUTING_CONFIG = DAFF_CART_ROUTING_CONFIG;
|
|
408
449
|
exports.DaffBillingAddressGuard = DaffBillingAddressGuard;
|
|
409
450
|
exports.DaffCartBillingAddressGuardRedirectUrl = DaffCartBillingAddressGuardRedirectUrl;
|
|
451
|
+
exports.DaffCartInStockItemsGuard = DaffCartInStockItemsGuard;
|
|
452
|
+
exports.DaffCartInStockItemsGuardRedirectUrl = DaffCartInStockItemsGuardRedirectUrl;
|
|
410
453
|
exports.DaffCartItemsGuard = DaffCartItemsGuard;
|
|
411
454
|
exports.DaffCartItemsGuardRedirectUrl = DaffCartItemsGuardRedirectUrl;
|
|
412
455
|
exports.DaffCartOrderResultGuardRedirectUrl = DaffCartOrderResultGuardRedirectUrl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"daffodil-cart-routing.umd.js","sources":["../../../libs/cart/routing/src/guards/billing-address/billing-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/billing-address/billing-address.guard.ts","../../../libs/cart/routing/src/config/resolution/config.ts","../../../libs/cart/routing/src/config/config.ts","../../../libs/cart/routing/src/guards/resolved-cart/resolved-cart.guard.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items.guard.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method.guard.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address.guard.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method.guard.ts","../../../libs/cart/routing/src/guards/order-result/order-result-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/order-result/order-result.guard.ts","../../../libs/cart/routing/src/resolvers/tokens/cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/cart-resolver.service.ts","../../../libs/cart/routing/src/resolvers/tokens/empty-cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/empty-cart-resolver.service.ts","../../../libs/cart/routing/src/cart-routing.module.ts","../../../libs/cart/routing/src/daffodil-cart-routing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffCartBillingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartBillingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartBillingAddressGuardRedirectUrl } from './billing-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the billing address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartBillingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBillingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartBillingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasBillingAddress$.pipe(\n take(1),\n tap(hasBillingAddress => {\n if (!hasBillingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","/**\n * An object that describes the resolution configuration of the cart state package.\n */\nexport interface DaffCartRoutingResolutionConfiguration {\n\t/**\n\t * When Daffodil fails to resolve a cart, you should navigate your users to\n\t * a page that is outside the scope of resolution. The `failedResolutionPath` allows you\n\t * to control where to navigate your users to when resolution fails.\n\t */\n\tfailedResolutionPath: string;\n};\n\n/**\n * The default values of the resolution slice of the cart state configuration.\n */\nexport const daffCartRoutingResolutionConfigurationDefault: DaffCartRoutingResolutionConfiguration = {\n failedResolutionPath: null,\n};\n","import { InjectionToken } from '@angular/core';\n\nimport {\n DaffCartRoutingResolutionConfiguration,\n daffCartRoutingResolutionConfigurationDefault,\n} from './resolution/config';\n\n/**\n * An object that describes the configuration of the`@daffodil/cart/state` package.\n */\nexport interface DaffCartRoutingConfiguration {\n\tresolution: DaffCartRoutingResolutionConfiguration;\n}\n\n/**\n * The default values of the `@daffodil/cart/state` state configuration.\n */\nexport const daffCartRoutingConfigurationDefault: DaffCartRoutingConfiguration = {\n resolution: {\n ...daffCartRoutingResolutionConfigurationDefault,\n },\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/cart/state` package.\n */\nexport const DAFF_CART_ROUTING_CONFIG = new InjectionToken<\n\tDaffCartRoutingConfiguration\n>('DAFF_CART_ROUTING_CONFIG', {\n providedIn: 'root',\n factory: () => daffCartRoutingConfigurationDefault,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n UrlTree,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n filter,\n take,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartFacade,\n DaffCartResolveState,\n} from '@daffodil/cart/state';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n} from '../../config/config';\n\n/**\n * A routing guard that will optionally redirect to a given url if the cart is not properly resolved.\n * It will initiate cart resolution.\n * The url has no default and the guard will not redirect if no value is specified.\n * Specify a redirect path with the {@link DaffResolvedCartGuardRedirectUrl} injection token.\n * The guard will wait until the cart has been resolved before performing the check and emitting.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffResolvedCartGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DAFF_CART_ROUTING_CONFIG) private config: DaffCartRoutingConfiguration,\n ) {}\n\n canActivate(): Observable<boolean | UrlTree> {\n return this.facade.resolved$.pipe(\n filter(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.Failed,\n ),\n map(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide,\n ),\n take(1),\n map(success =>\n !success && this.config.resolution.failedResolutionPath\n ?\tthis.router.parseUrl(\n this.config.resolution.failedResolutionPath,\n )\n : success,\n ),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartItemsGuard} is invoked.\n */\nexport const DaffCartItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartItemsGuardRedirectUrl } from './cart-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart is not empty before allowing activation of a route.\n * If the cart has items in it, then `canActivate` will emit true. If not, it will emit false and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.isCartEmpty$.pipe(\n map(isCartEmpty => !isCartEmpty),\n take(1),\n tap(hasNonEmptyCart => {\n if (!hasNonEmptyCart) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartPaymentMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartPaymentMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartPaymentMethodGuardRedirectUrl } from './payment-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the payment method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartPaymentMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffPaymentMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartPaymentMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasPaymentMethod$.pipe(\n take(1),\n tap(hasPaymentMethod => {\n if (!hasPaymentMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingAddressGuardRedirectUrl } from './shipping-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingAddress$.pipe(\n take(1),\n tap(hasShippingAddress => {\n if (!hasShippingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingMethodGuardRedirectUrl } from './shipping-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingMethod$.pipe(\n take(1),\n tap(hasShippingMethod => {\n if (!hasShippingMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartOrderResultGuardRedirectUrl = new InjectionToken<string>('DaffCartOrderResultGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartOrderResultGuardRedirectUrl } from './order-result-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the cart order result is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartOrderResultGuardRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffOrderResultGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartOrderResultGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOrderResult$.pipe(\n tap(hasOrderResult => {\n if (!hasOrderResult) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartResolverRedirectUrl = new InjectionToken<string>('DaffCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport {\n Store,\n ActionsSubject,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n map,\n filter,\n take,\n} from 'rxjs/operators';\n\nimport {\n DaffCartStateRootSlice,\n DaffResolveCart,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolverRedirectUrl } from './tokens/cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartResolver implements Resolve<Observable<Action>> {\n constructor(\n private store: Store<DaffCartStateRootSlice>,\n private dispatcher: ActionsSubject,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n this.store.dispatch(new DaffResolveCart());\n\n return this.dispatcher.pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction\n || action.type === DaffCartActionTypes.CartLoadFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartCreateFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartStorageFailureAction),\n map((action) => {\n if(action.type !== DaffCartActionTypes.CartLoadSuccessAction) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n take(1),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffEmptyCartResolverRedirectUrl = new InjectionToken<string>('DaffEmptyCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport { Action } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartLoadSuccess,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolver } from './cart-resolver.service';\nimport { DaffEmptyCartResolverRedirectUrl } from './tokens/empty-cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n * This resolver also redirects to a different url when the cart is empty after successfully loading.\n * This url is also `/` by default, but can be overridden with the DaffEmptyCartResolverRedirectUrl\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffEmptyCartResolver implements Resolve<Observable<Action>> {\n constructor(\n\t\tprivate cartResolver: DaffCartResolver,\n\t\tprivate router: Router,\n\t\t@Inject(DaffEmptyCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n return this.cartResolver.resolve().pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction),\n map((action: DaffCartLoadSuccess) => {\n if(!action.payload || action.payload.items.length === 0) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n );\n }\n}\n","import {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n daffCartRoutingConfigurationDefault,\n} from './config/config';\nimport {\n DaffCartBillingAddressGuardRedirectUrl,\n DaffCartShippingAddressGuardRedirectUrl,\n DaffCartShippingMethodGuardRedirectUrl,\n DaffCartPaymentMethodGuardRedirectUrl,\n DaffCartOrderResultGuardRedirectUrl,\n DaffCartItemsGuardRedirectUrl,\n} from './guards/public_api';\nimport {\n DaffEmptyCartResolverRedirectUrl,\n DaffCartResolverRedirectUrl,\n} from './resolvers/public_api';\n\n@NgModule({\n providers: [\n { provide: DaffCartBillingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartItemsGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartPaymentMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartOrderResultGuardRedirectUrl, useValue: '/' },\n { provide: DaffEmptyCartResolverRedirectUrl, useValue: '/' },\n { provide: DaffCartResolverRedirectUrl, useValue: '/' },\n ],\n})\nexport class DaffCartRoutingModule {\n static forRoot(config: DaffCartRoutingConfiguration = <any>{}): ModuleWithProviders<DaffCartRoutingModule> {\n return {\n ngModule: DaffCartRoutingModule,\n providers: [\n {\n provide: DAFF_CART_ROUTING_CONFIG,\n useValue: {\n ...daffCartRoutingConfigurationDefault,\n ...config,\n },\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["InjectionToken","take","tap","Injectable","DaffCartFacade","Router","Inject","filter","DaffCartResolveState","map","DaffResolveCart","DaffCartActionTypes","Store","ActionsSubject","NgModule"],"mappings":";;;;;;QAEa,sCAAsC,GAAG,IAAIA,iBAAc,CAAS,wCAAwC;;ICgBzH;;;;;;;QAUE,iCACQ,MAAsB,EACtB,MAAc,EACkC,WAAmB;YAFnE,WAAM,GAAN,MAAM,CAAgB;YACtB,WAAM,GAAN,MAAM,CAAQ;YACkC,gBAAW,GAAX,WAAW,CAAQ;SACvE;QAEJ,6CAAW,GAAX;YAAA,iBASC;YARC,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CACxCC,cAAI,CAAC,CAAC,CAAC,EACPC,aAAG,CAAC,UAAA,iBAAiB;gBACnB,IAAI,CAAC,iBAAiB,EAAE;oBACtB,KAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAI,CAAC,WAAW,CAAC,CAAC;iBAC7C;aACF,CAAC,CACH,CAAC;SACH;;;;;gBAnBFC,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gBAZQC,iBAAc;gBARrBC,SAAM;6CAyBLC,SAAM,SAAC,sCAAsC;;;ICrB/C,CAAC;IAEF;;;IAGO,IAAM,6CAA6C,GAA2C;QACnG,oBAAoB,EAAE,IAAI;KAC3B;;ICHD;;;IAGO,IAAM,mCAAmC,GAAiC;QAC/E,UAAU,oBACL,6CAA6C,CACjD;KACF,CAAC;IAEF;;;;QAIa,wBAAwB,GAAG,IAAIN,iBAAc,CAExD,0BAA0B,EAAE;QAC5B,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,cAAM,OAAA,mCAAmC,GAAA;KACnD;;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AAqB;gBAC/B,SAAS,EAAE;oBACT;wBACE,OAAO,EAAE,wBAAwB;wBACjC,QAAQ,kCACH,mCAAmC,GACnC,MAAM,CACV;qBACF;iBACF;aACF,CAAC;SACH;;;;gBA1BFQ,WAAQ,SAAC;oBACR,SAAS,EAAE;wBACT,EAAE,OAAO,EAAE,sCAAsC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBAClE,EAAE,OAAO,EAAE,6BAA6B,EAAE,QAAQ,EAAE,GAAG,EAAE;wBACzD,EAAE,OAAO,EAAE,uCAAuC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBACnE,EAAE,OAAO,EAAE,sCAAsC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBAClE,EAAE,OAAO,EAAE,qCAAqC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBACjE,EAAE,OAAO,EAAE,mCAAmC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBAC/D,EAAE,OAAO,EAAE,gCAAgC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBAC5D,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,GAAG,EAAE;qBACxD;iBACF;;;IClCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"daffodil-cart-routing.umd.js","sources":["../../../libs/cart/routing/src/guards/billing-address/billing-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/billing-address/billing-address.guard.ts","../../../libs/cart/routing/src/config/resolution/config.ts","../../../libs/cart/routing/src/config/config.ts","../../../libs/cart/routing/src/guards/resolved-cart/resolved-cart.guard.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items.guard.ts","../../../libs/cart/routing/src/guards/in-stock-items/in-stock-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/in-stock-items/in-stock-items.guard.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method.guard.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address.guard.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method.guard.ts","../../../libs/cart/routing/src/guards/order-result/order-result-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/order-result/order-result.guard.ts","../../../libs/cart/routing/src/resolvers/tokens/cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/cart-resolver.service.ts","../../../libs/cart/routing/src/resolvers/tokens/empty-cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/empty-cart-resolver.service.ts","../../../libs/cart/routing/src/cart-routing.module.ts","../../../libs/cart/routing/src/daffodil-cart-routing.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffCartBillingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartBillingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartBillingAddressGuardRedirectUrl } from './billing-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the billing address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartBillingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBillingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartBillingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasBillingAddress$.pipe(\n take(1),\n tap(hasBillingAddress => {\n if (!hasBillingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","/**\n * An object that describes the resolution configuration of the cart state package.\n */\nexport interface DaffCartRoutingResolutionConfiguration {\n\t/**\n\t * When Daffodil fails to resolve a cart, you should navigate your users to\n\t * a page that is outside the scope of resolution. The `failedResolutionPath` allows you\n\t * to control where to navigate your users to when resolution fails.\n\t */\n\tfailedResolutionPath: string;\n};\n\n/**\n * The default values of the resolution slice of the cart state configuration.\n */\nexport const daffCartRoutingResolutionConfigurationDefault: DaffCartRoutingResolutionConfiguration = {\n failedResolutionPath: null,\n};\n","import { InjectionToken } from '@angular/core';\n\nimport {\n DaffCartRoutingResolutionConfiguration,\n daffCartRoutingResolutionConfigurationDefault,\n} from './resolution/config';\n\n/**\n * An object that describes the configuration of the`@daffodil/cart/state` package.\n */\nexport interface DaffCartRoutingConfiguration {\n\tresolution: DaffCartRoutingResolutionConfiguration;\n}\n\n/**\n * The default values of the `@daffodil/cart/state` state configuration.\n */\nexport const daffCartRoutingConfigurationDefault: DaffCartRoutingConfiguration = {\n resolution: {\n ...daffCartRoutingResolutionConfigurationDefault,\n },\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/cart/state` package.\n */\nexport const DAFF_CART_ROUTING_CONFIG = new InjectionToken<\n\tDaffCartRoutingConfiguration\n>('DAFF_CART_ROUTING_CONFIG', {\n providedIn: 'root',\n factory: () => daffCartRoutingConfigurationDefault,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n UrlTree,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n filter,\n take,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartFacade,\n DaffCartResolveState,\n} from '@daffodil/cart/state';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n} from '../../config/config';\n\n/**\n * A routing guard that will optionally redirect to a given url if the cart is not properly resolved.\n * It will initiate cart resolution.\n * The url has no default and the guard will not redirect if no value is specified.\n * Specify a redirect path with the {@link DaffResolvedCartGuardRedirectUrl} injection token.\n * The guard will wait until the cart has been resolved before performing the check and emitting.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffResolvedCartGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DAFF_CART_ROUTING_CONFIG) private config: DaffCartRoutingConfiguration,\n ) {}\n\n canActivate(): Observable<boolean | UrlTree> {\n return this.facade.resolved$.pipe(\n filter(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.Failed,\n ),\n map(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide,\n ),\n take(1),\n map(success =>\n !success && this.config.resolution.failedResolutionPath\n ?\tthis.router.parseUrl(\n this.config.resolution.failedResolutionPath,\n )\n : success,\n ),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartItemsGuard} is invoked.\n */\nexport const DaffCartItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartItemsGuardRedirectUrl } from './cart-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart is not empty before allowing activation of a route.\n * If the cart has items in it, then `canActivate` will emit true. If not, it will emit false and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.isCartEmpty$.pipe(\n map(isCartEmpty => !isCartEmpty),\n take(1),\n tap(hasNonEmptyCart => {\n if (!hasNonEmptyCart) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartInStockItemsGuard} is invoked.\n */\nexport const DaffCartInStockItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartInStockItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartInStockItemsGuardRedirectUrl } from './in-stock-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart has only in-stock items before allowing activation of a route.\n * If the cart has any out of stock items in it, then `canActivate` will emit `false` and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartInStockItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartInStockItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartInStockItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOutOfStockItems$.pipe(\n map(hasOutOfStockItems => !hasOutOfStockItems),\n take(1),\n tap(hasNoOutOfStockItems => {\n if (!hasNoOutOfStockItems) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartPaymentMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartPaymentMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartPaymentMethodGuardRedirectUrl } from './payment-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the payment method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartPaymentMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffPaymentMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartPaymentMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasPaymentMethod$.pipe(\n take(1),\n tap(hasPaymentMethod => {\n if (!hasPaymentMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingAddressGuardRedirectUrl } from './shipping-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingAddress$.pipe(\n take(1),\n tap(hasShippingAddress => {\n if (!hasShippingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingMethodGuardRedirectUrl } from './shipping-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingMethod$.pipe(\n take(1),\n tap(hasShippingMethod => {\n if (!hasShippingMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartOrderResultGuardRedirectUrl = new InjectionToken<string>('DaffCartOrderResultGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartOrderResultGuardRedirectUrl } from './order-result-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the cart order result is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartOrderResultGuardRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffOrderResultGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartOrderResultGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOrderResult$.pipe(\n tap(hasOrderResult => {\n if (!hasOrderResult) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartResolverRedirectUrl = new InjectionToken<string>('DaffCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport {\n Store,\n ActionsSubject,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n map,\n filter,\n take,\n} from 'rxjs/operators';\n\nimport {\n DaffCartStateRootSlice,\n DaffResolveCart,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolverRedirectUrl } from './tokens/cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartResolver implements Resolve<Observable<Action>> {\n constructor(\n private store: Store<DaffCartStateRootSlice>,\n private dispatcher: ActionsSubject,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n this.store.dispatch(new DaffResolveCart());\n\n return this.dispatcher.pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction\n || action.type === DaffCartActionTypes.CartLoadFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartCreateFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartStorageFailureAction),\n map((action) => {\n if(action.type !== DaffCartActionTypes.CartLoadSuccessAction) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n take(1),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffEmptyCartResolverRedirectUrl = new InjectionToken<string>('DaffEmptyCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport { Action } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartLoadSuccess,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolver } from './cart-resolver.service';\nimport { DaffEmptyCartResolverRedirectUrl } from './tokens/empty-cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n * This resolver also redirects to a different url when the cart is empty after successfully loading.\n * This url is also `/` by default, but can be overridden with the DaffEmptyCartResolverRedirectUrl\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffEmptyCartResolver implements Resolve<Observable<Action>> {\n constructor(\n\t\tprivate cartResolver: DaffCartResolver,\n\t\tprivate router: Router,\n\t\t@Inject(DaffEmptyCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n return this.cartResolver.resolve().pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction),\n map((action: DaffCartLoadSuccess) => {\n if(!action.payload || action.payload.items.length === 0) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n );\n }\n}\n","import {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n daffCartRoutingConfigurationDefault,\n} from './config/config';\nimport {\n DaffCartBillingAddressGuardRedirectUrl,\n DaffCartShippingAddressGuardRedirectUrl,\n DaffCartShippingMethodGuardRedirectUrl,\n DaffCartPaymentMethodGuardRedirectUrl,\n DaffCartOrderResultGuardRedirectUrl,\n DaffCartItemsGuardRedirectUrl,\n} from './guards/public_api';\nimport {\n DaffEmptyCartResolverRedirectUrl,\n DaffCartResolverRedirectUrl,\n} from './resolvers/public_api';\n\n@NgModule({\n providers: [\n { provide: DaffCartBillingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartItemsGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartPaymentMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartOrderResultGuardRedirectUrl, useValue: '/' },\n { provide: DaffEmptyCartResolverRedirectUrl, useValue: '/' },\n { provide: DaffCartResolverRedirectUrl, useValue: '/' },\n ],\n})\nexport class DaffCartRoutingModule {\n static forRoot(config: DaffCartRoutingConfiguration = <any>{}): ModuleWithProviders<DaffCartRoutingModule> {\n return {\n ngModule: DaffCartRoutingModule,\n providers: [\n {\n provide: DAFF_CART_ROUTING_CONFIG,\n useValue: {\n ...daffCartRoutingConfigurationDefault,\n ...config,\n },\n },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["InjectionToken","take","tap","Injectable","DaffCartFacade","Router","Inject","filter","DaffCartResolveState","map","DaffResolveCart","DaffCartActionTypes","Store","ActionsSubject","NgModule"],"mappings":";;;;;;QAEa,sCAAsC,GAAG,IAAIA,iBAAc,CAAS,wCAAwC;;ICgBzH;;;;;;;QAUE,iCACQ,MAAsB,EACtB,MAAc,EACkC,WAAmB;YAFnE,WAAM,GAAN,MAAM,CAAgB;YACtB,WAAM,GAAN,MAAM,CAAQ;YACkC,gBAAW,GAAX,WAAW,CAAQ;SACvE;QAEJ,6CAAW,GAAX;YAAA,iBASC;YARC,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CACxCC,cAAI,CAAC,CAAC,CAAC,EACPC,aAAG,CAAC,UAAA,iBAAiB;gBACnB,IAAI,CAAC,iBAAiB,EAAE;oBACtB,KAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAI,CAAC,WAAW,CAAC,CAAC;iBAC7C;aACF,CAAC,CACH,CAAC;SACH;;;;;gBAnBFC,aAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;gBAZQC,iBAAc;gBARrBC,SAAM;6CAyBLC,SAAM,SAAC,sCAAsC;;;ICrB/C,CAAC;IAEF;;;IAGO,IAAM,6CAA6C,GAA2C;QACnG,oBAAoB,EAAE,IAAI;KAC3B;;ICHD;;;IAGO,IAAM,mCAAmC,GAAiC;QAC/E,UAAU,oBACL,6CAA6C,CACjD;KACF,CAAC;IAEF;;;;QAIa,wBAAwB,GAAG,IAAIN,iBAAc,CAExD,0BAA0B,EAAE;QAC5B,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,cAAM,OAAA,mCAAmC,GAAA;KACnD;;ICLD;;;;;;;;QAWE,+BACQ,MAAsB,EACtB,MAAc,EACoB,MAAoC;YAFtE,WAAM,GAAN,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CAAgC,EAAE,QAAQ,EAAE,GAAG,EAAE;wBAC5D,EAAE,OAAO,EAAE,2BAA2B,EAAE,QAAQ,EAAE,GAAG,EAAE;qBACxD;iBACF;;;IClCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/router"),require("rxjs/operators"),require("@daffodil/cart/state"),require("@ngrx/store")):"function"==typeof define&&define.amd?define("@daffodil/cart/routing",["exports","@angular/core","@angular/router","rxjs/operators","@daffodil/cart/state","@ngrx/store"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).daffodil=e.daffodil||{},e.daffodil.cart=e.daffodil.cart||{},e.daffodil.cart.routing={}),e.ng.core,e.ng.router,e.rxjs.operators,e.daffodil.cart.state,e.i1$1)}(this,(function(e,t,r,a,n,o){"use strict";var i=new t.InjectionToken("DaffCartBillingAddressGuardRedirectUrl"),c=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasBillingAddress$.pipe(a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();c.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new c(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(i))},token:c,providedIn:"root"}),c.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],c.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[i]}]}]};var f={resolution:Object.assign({},{failedResolutionPath:null})},d=new t.InjectionToken("DAFF_CART_ROUTING_CONFIG",{providedIn:"root",factory:function(){return f}}),u=function(){function e(e,t,r){this.facade=e,this.router=t,this.config=r}return e.prototype.canActivate=function(){var e=this;return this.facade.resolved$.pipe(a.filter((function(e){return e===n.DaffCartResolveState.Succeeded||e===n.DaffCartResolveState.ServerSide||e===n.DaffCartResolveState.Failed})),a.map((function(e){return e===n.DaffCartResolveState.Succeeded||e===n.DaffCartResolveState.ServerSide})),a.take(1),a.map((function(t){return!t&&e.config.resolution.failedResolutionPath?e.router.parseUrl(e.config.resolution.failedResolutionPath):t})))},e}();u.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new u(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(d))},token:u,providedIn:"root"}),u.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:void 0,decorators:[{type:t.Inject,args:[d]}]}]};var s=new t.InjectionToken("DaffCartItemsGuardRedirectUrl"),p=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.isCartEmpty$.pipe(a.map((function(e){return!e})),a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();p.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new p(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(s))},token:p,providedIn:"root"}),p.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[s]}]}]};var l=new t.InjectionToken("
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/router"),require("rxjs/operators"),require("@daffodil/cart/state"),require("@ngrx/store")):"function"==typeof define&&define.amd?define("@daffodil/cart/routing",["exports","@angular/core","@angular/router","rxjs/operators","@daffodil/cart/state","@ngrx/store"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).daffodil=e.daffodil||{},e.daffodil.cart=e.daffodil.cart||{},e.daffodil.cart.routing={}),e.ng.core,e.ng.router,e.rxjs.operators,e.daffodil.cart.state,e.i1$1)}(this,(function(e,t,r,a,n,o){"use strict";var i=new t.InjectionToken("DaffCartBillingAddressGuardRedirectUrl"),c=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasBillingAddress$.pipe(a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();c.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new c(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(i))},token:c,providedIn:"root"}),c.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],c.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[i]}]}]};var f={resolution:Object.assign({},{failedResolutionPath:null})},d=new t.InjectionToken("DAFF_CART_ROUTING_CONFIG",{providedIn:"root",factory:function(){return f}}),u=function(){function e(e,t,r){this.facade=e,this.router=t,this.config=r}return e.prototype.canActivate=function(){var e=this;return this.facade.resolved$.pipe(a.filter((function(e){return e===n.DaffCartResolveState.Succeeded||e===n.DaffCartResolveState.ServerSide||e===n.DaffCartResolveState.Failed})),a.map((function(e){return e===n.DaffCartResolveState.Succeeded||e===n.DaffCartResolveState.ServerSide})),a.take(1),a.map((function(t){return!t&&e.config.resolution.failedResolutionPath?e.router.parseUrl(e.config.resolution.failedResolutionPath):t})))},e}();u.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new u(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(d))},token:u,providedIn:"root"}),u.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:void 0,decorators:[{type:t.Inject,args:[d]}]}]};var s=new t.InjectionToken("DaffCartItemsGuardRedirectUrl"),p=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.isCartEmpty$.pipe(a.map((function(e){return!e})),a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();p.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new p(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(s))},token:p,providedIn:"root"}),p.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[s]}]}]};var l=new t.InjectionToken("DaffCartInStockItemsGuardRedirectUrl"),y=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasOutOfStockItems$.pipe(a.map((function(e){return!e})),a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();y.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new y(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(l))},token:y,providedIn:"root"}),y.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],y.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[l]}]}]};var v=new t.InjectionToken("DaffCartPaymentMethodGuardRedirectUrl"),h=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasPaymentMethod$.pipe(a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();h.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new h(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(v))},token:h,providedIn:"root"}),h.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],h.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[v]}]}]};var j=new t.InjectionToken("DaffCartShippingAddressGuardRedirectUrl"),I=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasShippingAddress$.pipe(a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();I.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new I(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(j))},token:I,providedIn:"root"}),I.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],I.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[j]}]}]};var g=new t.InjectionToken("DaffCartShippingMethodGuardRedirectUrl"),R=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasShippingMethod$.pipe(a.take(1),a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();R.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new R(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(g))},token:R,providedIn:"root"}),R.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],R.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[g]}]}]};var C=new t.InjectionToken("DaffCartOrderResultGuardRedirectUrl"),D=function(){function e(e,t,r){this.facade=e,this.router=t,this.redirectUrl=r}return e.prototype.canActivate=function(){var e=this;return this.facade.hasOrderResult$.pipe(a.tap((function(t){t||e.router.navigateByUrl(e.redirectUrl)})))},e}();D.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new D(t.ɵɵinject(n.DaffCartFacade),t.ɵɵinject(r.Router),t.ɵɵinject(C))},token:D,providedIn:"root"}),D.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],D.ctorParameters=function(){return[{type:n.DaffCartFacade},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[C]}]}]};var U=new t.InjectionToken("DaffCartResolverRedirectUrl"),S=function(){function e(e,t,r,a){this.store=e,this.dispatcher=t,this.router=r,this.redirectUrl=a}return e.prototype.resolve=function(){var e=this;return this.store.dispatch(new n.DaffResolveCart),this.dispatcher.pipe(a.filter((function(e){return e.type===n.DaffCartActionTypes.CartLoadSuccessAction||e.type===n.DaffCartActionTypes.CartLoadFailureAction||e.type===n.DaffCartActionTypes.CartCreateFailureAction||e.type===n.DaffCartActionTypes.CartStorageFailureAction})),a.map((function(t){return t.type!==n.DaffCartActionTypes.CartLoadSuccessAction&&e.router.navigateByUrl(e.redirectUrl),t})),a.take(1))},e}();S.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new S(t.ɵɵinject(o.Store),t.ɵɵinject(o.ActionsSubject),t.ɵɵinject(r.Router),t.ɵɵinject(U))},token:S,providedIn:"root"}),S.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],S.ctorParameters=function(){return[{type:o.Store},{type:o.ActionsSubject},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[U]}]}]};var m=new t.InjectionToken("DaffEmptyCartResolverRedirectUrl"),A=function(){function e(e,t,r){this.cartResolver=e,this.router=t,this.redirectUrl=r}return e.prototype.resolve=function(){var e=this;return this.cartResolver.resolve().pipe(a.filter((function(e){return e.type===n.DaffCartActionTypes.CartLoadSuccessAction})),a.map((function(t){return t.payload&&0!==t.payload.items.length||e.router.navigateByUrl(e.redirectUrl),t})))},e}();A.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new A(t.ɵɵinject(S),t.ɵɵinject(r.Router),t.ɵɵinject(m))},token:A,providedIn:"root"}),A.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],A.ctorParameters=function(){return[{type:S},{type:r.Router},{type:String,decorators:[{type:t.Inject,args:[m]}]}]};var k=function(){function e(){}return e.forRoot=function(t){return void 0===t&&(t={}),{ngModule:e,providers:[{provide:d,useValue:Object.assign(Object.assign({},f),t)}]}},e}();k.decorators=[{type:t.NgModule,args:[{providers:[{provide:i,useValue:"/"},{provide:s,useValue:"/"},{provide:j,useValue:"/"},{provide:g,useValue:"/"},{provide:v,useValue:"/"},{provide:C,useValue:"/"},{provide:m,useValue:"/"},{provide:U,useValue:"/"}]}]}],e.DAFF_CART_ROUTING_CONFIG=d,e.DaffBillingAddressGuard=c,e.DaffCartBillingAddressGuardRedirectUrl=i,e.DaffCartInStockItemsGuard=y,e.DaffCartInStockItemsGuardRedirectUrl=l,e.DaffCartItemsGuard=p,e.DaffCartItemsGuardRedirectUrl=s,e.DaffCartOrderResultGuardRedirectUrl=C,e.DaffCartPaymentMethodGuardRedirectUrl=v,e.DaffCartResolver=S,e.DaffCartResolverRedirectUrl=U,e.DaffCartRoutingModule=k,e.DaffCartShippingAddressGuardRedirectUrl=j,e.DaffCartShippingMethodGuardRedirectUrl=g,e.DaffEmptyCartResolver=A,e.DaffEmptyCartResolverRedirectUrl=m,e.DaffOrderResultGuard=D,e.DaffPaymentMethodGuard=h,e.DaffResolvedCartGuard=u,e.DaffShippingAddressGuard=I,e.DaffShippingMethodGuard=R,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=daffodil-cart-routing.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../libs/cart/routing/src/guards/billing-address/billing-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/billing-address/billing-address.guard.ts","../../../libs/cart/routing/src/config/resolution/config.ts","../../../libs/cart/routing/src/config/config.ts","../../../libs/cart/routing/src/guards/resolved-cart/resolved-cart.guard.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items.guard.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method.guard.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address.guard.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method.guard.ts","../../../libs/cart/routing/src/guards/order-result/order-result-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/order-result/order-result.guard.ts","../../../libs/cart/routing/src/resolvers/tokens/cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/cart-resolver.service.ts","../../../libs/cart/routing/src/resolvers/tokens/empty-cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/empty-cart-resolver.service.ts","../../../libs/cart/routing/src/cart-routing.module.ts"],"names":["DaffCartBillingAddressGuardRedirectUrl","InjectionToken","DaffBillingAddressGuard","facade","router","redirectUrl","this","prototype","canActivate","_this","hasBillingAddress$","pipe","take","tap","hasBillingAddress","navigateByUrl","Injectable","args","providedIn","DaffCartFacade","Router","Inject","daffCartRoutingConfigurationDefault","resolution","Object","assign","failedResolutionPath","DAFF_CART_ROUTING_CONFIG","factory","DaffResolvedCartGuard","config","resolved$","filter","resolvedState","DaffCartResolveState","Succeeded","ServerSide","Failed","map","success","parseUrl","DaffCartItemsGuardRedirectUrl","DaffCartItemsGuard","isCartEmpty$","isCartEmpty","hasNonEmptyCart","DaffCartPaymentMethodGuardRedirectUrl","DaffPaymentMethodGuard","hasPaymentMethod$","hasPaymentMethod","DaffCartShippingAddressGuardRedirectUrl","DaffShippingAddressGuard","hasShippingAddress$","hasShippingAddress","DaffCartShippingMethodGuardRedirectUrl","DaffShippingMethodGuard","hasShippingMethod$","hasShippingMethod","DaffCartOrderResultGuardRedirectUrl","DaffOrderResultGuard","hasOrderResult$","hasOrderResult","DaffCartResolverRedirectUrl","DaffCartResolver","store","dispatcher","resolve","dispatch","DaffResolveCart","action","type","DaffCartActionTypes","CartLoadSuccessAction","CartLoadFailureAction","CartCreateFailureAction","CartStorageFailureAction","Store","ActionsSubject","DaffEmptyCartResolverRedirectUrl","DaffEmptyCartResolver","cartResolver","payload","items","length","DaffCartRoutingModule","forRoot","ngModule","providers","provide","useValue","NgModule"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AAA,EAAA,IACN,CACLwD,SAAUF,EACVG,UAAW,CACT,CACEC,QAAS7D,EACT8D,SAAQjE,OAAAC,OAAAD,OAAAC,OAAA,GACHH,GACAQ,gCArBd4D,EAAAA,SAAQzE,KAAA,CAAC,CACRsE,UAAW,CACT,CAAEC,QAASxF,EAAwCyF,SAAU,KAC7D,CAAED,QAAS/C,EAA+BgD,SAAU,KACpD,CAAED,QAAStC,EAAyCuC,SAAU,KAC9D,CAAED,QAASlC,EAAwCmC,SAAU,KAC7D,CAAED,QAAS1C,EAAuC2C,SAAU,KAC5D,CAAED,QAAS9B,EAAqC+B,SAAU,KAC1D,CAAED,QAASV,EAAkCW,SAAU,KACvD,CAAED,QAAS1B,EAA6B2B,SAAU","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffCartBillingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartBillingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartBillingAddressGuardRedirectUrl } from './billing-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the billing address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartBillingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBillingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartBillingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasBillingAddress$.pipe(\n take(1),\n tap(hasBillingAddress => {\n if (!hasBillingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","/**\n * An object that describes the resolution configuration of the cart state package.\n */\nexport interface DaffCartRoutingResolutionConfiguration {\n\t/**\n\t * When Daffodil fails to resolve a cart, you should navigate your users to\n\t * a page that is outside the scope of resolution. The `failedResolutionPath` allows you\n\t * to control where to navigate your users to when resolution fails.\n\t */\n\tfailedResolutionPath: string;\n};\n\n/**\n * The default values of the resolution slice of the cart state configuration.\n */\nexport const daffCartRoutingResolutionConfigurationDefault: DaffCartRoutingResolutionConfiguration = {\n failedResolutionPath: null,\n};\n","import { InjectionToken } from '@angular/core';\n\nimport {\n DaffCartRoutingResolutionConfiguration,\n daffCartRoutingResolutionConfigurationDefault,\n} from './resolution/config';\n\n/**\n * An object that describes the configuration of the`@daffodil/cart/state` package.\n */\nexport interface DaffCartRoutingConfiguration {\n\tresolution: DaffCartRoutingResolutionConfiguration;\n}\n\n/**\n * The default values of the `@daffodil/cart/state` state configuration.\n */\nexport const daffCartRoutingConfigurationDefault: DaffCartRoutingConfiguration = {\n resolution: {\n ...daffCartRoutingResolutionConfigurationDefault,\n },\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/cart/state` package.\n */\nexport const DAFF_CART_ROUTING_CONFIG = new InjectionToken<\n\tDaffCartRoutingConfiguration\n>('DAFF_CART_ROUTING_CONFIG', {\n providedIn: 'root',\n factory: () => daffCartRoutingConfigurationDefault,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n UrlTree,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n filter,\n take,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartFacade,\n DaffCartResolveState,\n} from '@daffodil/cart/state';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n} from '../../config/config';\n\n/**\n * A routing guard that will optionally redirect to a given url if the cart is not properly resolved.\n * It will initiate cart resolution.\n * The url has no default and the guard will not redirect if no value is specified.\n * Specify a redirect path with the {@link DaffResolvedCartGuardRedirectUrl} injection token.\n * The guard will wait until the cart has been resolved before performing the check and emitting.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffResolvedCartGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DAFF_CART_ROUTING_CONFIG) private config: DaffCartRoutingConfiguration,\n ) {}\n\n canActivate(): Observable<boolean | UrlTree> {\n return this.facade.resolved$.pipe(\n filter(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.Failed,\n ),\n map(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide,\n ),\n take(1),\n map(success =>\n !success && this.config.resolution.failedResolutionPath\n ?\tthis.router.parseUrl(\n this.config.resolution.failedResolutionPath,\n )\n : success,\n ),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartItemsGuard} is invoked.\n */\nexport const DaffCartItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartItemsGuardRedirectUrl } from './cart-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart is not empty before allowing activation of a route.\n * If the cart has items in it, then `canActivate` will emit true. If not, it will emit false and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.isCartEmpty$.pipe(\n map(isCartEmpty => !isCartEmpty),\n take(1),\n tap(hasNonEmptyCart => {\n if (!hasNonEmptyCart) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartPaymentMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartPaymentMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartPaymentMethodGuardRedirectUrl } from './payment-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the payment method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartPaymentMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffPaymentMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartPaymentMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasPaymentMethod$.pipe(\n take(1),\n tap(hasPaymentMethod => {\n if (!hasPaymentMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingAddressGuardRedirectUrl } from './shipping-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingAddress$.pipe(\n take(1),\n tap(hasShippingAddress => {\n if (!hasShippingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingMethodGuardRedirectUrl } from './shipping-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingMethod$.pipe(\n take(1),\n tap(hasShippingMethod => {\n if (!hasShippingMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartOrderResultGuardRedirectUrl = new InjectionToken<string>('DaffCartOrderResultGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartOrderResultGuardRedirectUrl } from './order-result-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the cart order result is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartOrderResultGuardRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffOrderResultGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartOrderResultGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOrderResult$.pipe(\n tap(hasOrderResult => {\n if (!hasOrderResult) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartResolverRedirectUrl = new InjectionToken<string>('DaffCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport {\n Store,\n ActionsSubject,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n map,\n filter,\n take,\n} from 'rxjs/operators';\n\nimport {\n DaffCartStateRootSlice,\n DaffResolveCart,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolverRedirectUrl } from './tokens/cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartResolver implements Resolve<Observable<Action>> {\n constructor(\n private store: Store<DaffCartStateRootSlice>,\n private dispatcher: ActionsSubject,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n this.store.dispatch(new DaffResolveCart());\n\n return this.dispatcher.pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction\n || action.type === DaffCartActionTypes.CartLoadFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartCreateFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartStorageFailureAction),\n map((action) => {\n if(action.type !== DaffCartActionTypes.CartLoadSuccessAction) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n take(1),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffEmptyCartResolverRedirectUrl = new InjectionToken<string>('DaffEmptyCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport { Action } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartLoadSuccess,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolver } from './cart-resolver.service';\nimport { DaffEmptyCartResolverRedirectUrl } from './tokens/empty-cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n * This resolver also redirects to a different url when the cart is empty after successfully loading.\n * This url is also `/` by default, but can be overridden with the DaffEmptyCartResolverRedirectUrl\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffEmptyCartResolver implements Resolve<Observable<Action>> {\n constructor(\n\t\tprivate cartResolver: DaffCartResolver,\n\t\tprivate router: Router,\n\t\t@Inject(DaffEmptyCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n return this.cartResolver.resolve().pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction),\n map((action: DaffCartLoadSuccess) => {\n if(!action.payload || action.payload.items.length === 0) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n );\n }\n}\n","import {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n daffCartRoutingConfigurationDefault,\n} from './config/config';\nimport {\n DaffCartBillingAddressGuardRedirectUrl,\n DaffCartShippingAddressGuardRedirectUrl,\n DaffCartShippingMethodGuardRedirectUrl,\n DaffCartPaymentMethodGuardRedirectUrl,\n DaffCartOrderResultGuardRedirectUrl,\n DaffCartItemsGuardRedirectUrl,\n} from './guards/public_api';\nimport {\n DaffEmptyCartResolverRedirectUrl,\n DaffCartResolverRedirectUrl,\n} from './resolvers/public_api';\n\n@NgModule({\n providers: [\n { provide: DaffCartBillingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartItemsGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartPaymentMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartOrderResultGuardRedirectUrl, useValue: '/' },\n { provide: DaffEmptyCartResolverRedirectUrl, useValue: '/' },\n { provide: DaffCartResolverRedirectUrl, useValue: '/' },\n ],\n})\nexport class DaffCartRoutingModule {\n static forRoot(config: DaffCartRoutingConfiguration = <any>{}): ModuleWithProviders<DaffCartRoutingModule> {\n return {\n ngModule: DaffCartRoutingModule,\n providers: [\n {\n provide: DAFF_CART_ROUTING_CONFIG,\n useValue: {\n ...daffCartRoutingConfigurationDefault,\n ...config,\n },\n },\n ],\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../libs/cart/routing/src/guards/billing-address/billing-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/billing-address/billing-address.guard.ts","../../../libs/cart/routing/src/config/resolution/config.ts","../../../libs/cart/routing/src/config/config.ts","../../../libs/cart/routing/src/guards/resolved-cart/resolved-cart.guard.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/cart-items/cart-items.guard.ts","../../../libs/cart/routing/src/guards/in-stock-items/in-stock-items-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/in-stock-items/in-stock-items.guard.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/payment-method/payment-method.guard.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-address/shipping-address.guard.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/shipping-method/shipping-method.guard.ts","../../../libs/cart/routing/src/guards/order-result/order-result-guard-redirect.token.ts","../../../libs/cart/routing/src/guards/order-result/order-result.guard.ts","../../../libs/cart/routing/src/resolvers/tokens/cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/cart-resolver.service.ts","../../../libs/cart/routing/src/resolvers/tokens/empty-cart-resolver-redirect.token.ts","../../../libs/cart/routing/src/resolvers/empty-cart-resolver.service.ts","../../../libs/cart/routing/src/cart-routing.module.ts"],"names":["DaffCartBillingAddressGuardRedirectUrl","InjectionToken","DaffBillingAddressGuard","facade","router","redirectUrl","this","prototype","canActivate","_this","hasBillingAddress$","pipe","take","tap","hasBillingAddress","navigateByUrl","Injectable","args","providedIn","DaffCartFacade","Router","Inject","daffCartRoutingConfigurationDefault","resolution","Object","assign","failedResolutionPath","DAFF_CART_ROUTING_CONFIG","factory","DaffResolvedCartGuard","config","resolved$","filter","resolvedState","DaffCartResolveState","Succeeded","ServerSide","Failed","map","success","parseUrl","DaffCartItemsGuardRedirectUrl","DaffCartItemsGuard","isCartEmpty$","isCartEmpty","hasNonEmptyCart","DaffCartInStockItemsGuardRedirectUrl","DaffCartInStockItemsGuard","hasOutOfStockItems$","hasOutOfStockItems","hasNoOutOfStockItems","DaffCartPaymentMethodGuardRedirectUrl","DaffPaymentMethodGuard","hasPaymentMethod$","hasPaymentMethod","DaffCartShippingAddressGuardRedirectUrl","DaffShippingAddressGuard","hasShippingAddress$","hasShippingAddress","DaffCartShippingMethodGuardRedirectUrl","DaffShippingMethodGuard","hasShippingMethod$","hasShippingMethod","DaffCartOrderResultGuardRedirectUrl","DaffOrderResultGuard","hasOrderResult$","hasOrderResult","DaffCartResolverRedirectUrl","DaffCartResolver","store","dispatcher","resolve","dispatch","DaffResolveCart","action","type","DaffCartActionTypes","CartLoadSuccessAction","CartLoadFailureAction","CartCreateFailureAction","CartStorageFailureAction","Store","ActionsSubject","DaffEmptyCartResolverRedirectUrl","DaffEmptyCartResolver","cartResolver","payload","items","length","DaffCartRoutingModule","forRoot","ngModule","providers","provide","useValue","NgModule"],"mappings":"qoBAEaA,EAAyC,IAAIC,EAAAA,eAAuB,uDC0B/E,SAAAC,EACQC,EACAC,EACgDC,GAFhDC,KAAAH,OAAAA,EACAG,KAAAF,OAAAA,EACgDE,KAAAD,YAAAA,SAGxDH,EAAAK,UAAAC,YAAA,WAAA,IAAAC,EAAAH,KACE,OAAOA,KAAKH,OAAOO,mBAAmBC,KACpCC,EAAAA,KAAK,GACLC,EAAAA,KAAI,SAAAC,GACGA,GACHL,EAAKL,OAAOW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E1BqE,6KAjBd1D,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAVLkD,SAdPhD,EAAAA,uCA8BCC,EAAAA,OAAMJ,KAAA,CAACkE,yBCDV,SAAAM,YACSA,EAAAC,QAAP,SAAe5D,GACb,YADa,IAAAA,IAAAA,EAAA,IACN,CACL6D,SAAUF,EACVG,UAAW,CACT,CACEC,QAASlE,EACTmE,SAAQtE,OAAAC,OAAAD,OAAAC,OAAA,GACHH,GACAQ,gCArBdiE,EAAAA,SAAQ9E,KAAA,CAAC,CACR2E,UAAW,CACT,CAAEC,QAAS7F,EAAwC8F,SAAU,KAC7D,CAAED,QAASpD,EAA+BqD,SAAU,KACpD,CAAED,QAAStC,EAAyCuC,SAAU,KAC9D,CAAED,QAASlC,EAAwCmC,SAAU,KAC7D,CAAED,QAAS1C,EAAuC2C,SAAU,KAC5D,CAAED,QAAS9B,EAAqC+B,SAAU,KAC1D,CAAED,QAASV,EAAkCW,SAAU,KACvD,CAAED,QAAS1B,EAA6B2B,SAAU","sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const DaffCartBillingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartBillingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartBillingAddressGuardRedirectUrl } from './billing-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the billing address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartBillingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffBillingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartBillingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasBillingAddress$.pipe(\n take(1),\n tap(hasBillingAddress => {\n if (!hasBillingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","/**\n * An object that describes the resolution configuration of the cart state package.\n */\nexport interface DaffCartRoutingResolutionConfiguration {\n\t/**\n\t * When Daffodil fails to resolve a cart, you should navigate your users to\n\t * a page that is outside the scope of resolution. The `failedResolutionPath` allows you\n\t * to control where to navigate your users to when resolution fails.\n\t */\n\tfailedResolutionPath: string;\n};\n\n/**\n * The default values of the resolution slice of the cart state configuration.\n */\nexport const daffCartRoutingResolutionConfigurationDefault: DaffCartRoutingResolutionConfiguration = {\n failedResolutionPath: null,\n};\n","import { InjectionToken } from '@angular/core';\n\nimport {\n DaffCartRoutingResolutionConfiguration,\n daffCartRoutingResolutionConfigurationDefault,\n} from './resolution/config';\n\n/**\n * An object that describes the configuration of the`@daffodil/cart/state` package.\n */\nexport interface DaffCartRoutingConfiguration {\n\tresolution: DaffCartRoutingResolutionConfiguration;\n}\n\n/**\n * The default values of the `@daffodil/cart/state` state configuration.\n */\nexport const daffCartRoutingConfigurationDefault: DaffCartRoutingConfiguration = {\n resolution: {\n ...daffCartRoutingResolutionConfigurationDefault,\n },\n};\n\n/**\n * The token holding the runtime configuration for the behavior of the\n * `@daffodil/cart/state` package.\n */\nexport const DAFF_CART_ROUTING_CONFIG = new InjectionToken<\n\tDaffCartRoutingConfiguration\n>('DAFF_CART_ROUTING_CONFIG', {\n providedIn: 'root',\n factory: () => daffCartRoutingConfigurationDefault,\n});\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n UrlTree,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n filter,\n take,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartFacade,\n DaffCartResolveState,\n} from '@daffodil/cart/state';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n} from '../../config/config';\n\n/**\n * A routing guard that will optionally redirect to a given url if the cart is not properly resolved.\n * It will initiate cart resolution.\n * The url has no default and the guard will not redirect if no value is specified.\n * Specify a redirect path with the {@link DaffResolvedCartGuardRedirectUrl} injection token.\n * The guard will wait until the cart has been resolved before performing the check and emitting.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffResolvedCartGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DAFF_CART_ROUTING_CONFIG) private config: DaffCartRoutingConfiguration,\n ) {}\n\n canActivate(): Observable<boolean | UrlTree> {\n return this.facade.resolved$.pipe(\n filter(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.Failed,\n ),\n map(\n resolvedState =>\n resolvedState === DaffCartResolveState.Succeeded ||\n\t\t\t\t\tresolvedState === DaffCartResolveState.ServerSide,\n ),\n take(1),\n map(success =>\n !success && this.config.resolution.failedResolutionPath\n ?\tthis.router.parseUrl(\n this.config.resolution.failedResolutionPath,\n )\n : success,\n ),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartItemsGuard} is invoked.\n */\nexport const DaffCartItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartItemsGuardRedirectUrl } from './cart-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart is not empty before allowing activation of a route.\n * If the cart has items in it, then `canActivate` will emit true. If not, it will emit false and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.isCartEmpty$.pipe(\n map(isCartEmpty => !isCartEmpty),\n take(1),\n tap(hasNonEmptyCart => {\n if (!hasNonEmptyCart) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\n/**\n * The path to which the user should be redirected if the cart has no items when {@link DaffCartInStockItemsGuard} is invoked.\n */\nexport const DaffCartInStockItemsGuardRedirectUrl = new InjectionToken<string>('DaffCartInStockItemsGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartInStockItemsGuardRedirectUrl } from './in-stock-items-guard-redirect.token';\n\n/**\n * A routing guard that will ensure that the cart has only in-stock items before allowing activation of a route.\n * If the cart has any out of stock items in it, then `canActivate` will emit `false` and redirect to a specific path.\n * The url is `/` by default but can be overridden with the {@link DaffCartInStockItemsGuardRedirectUrl} injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartInStockItemsGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartInStockItemsGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOutOfStockItems$.pipe(\n map(hasOutOfStockItems => !hasOutOfStockItems),\n take(1),\n tap(hasNoOutOfStockItems => {\n if (!hasNoOutOfStockItems) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartPaymentMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartPaymentMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartPaymentMethodGuardRedirectUrl } from './payment-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the payment method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartPaymentMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffPaymentMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartPaymentMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasPaymentMethod$.pipe(\n take(1),\n tap(hasPaymentMethod => {\n if (!hasPaymentMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingAddressGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingAddressGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingAddressGuardRedirectUrl } from './shipping-address-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping address on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingAddressGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingAddressGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingAddressGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingAddress$.pipe(\n take(1),\n tap(hasShippingAddress => {\n if (!hasShippingAddress) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartShippingMethodGuardRedirectUrl = new InjectionToken<string>('DaffCartShippingMethodGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport { Observable } from 'rxjs';\nimport {\n tap,\n take,\n} from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartShippingMethodGuardRedirectUrl } from './shipping-method-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the shipping method on the cart is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartShippingMethodGuardRedirectUrl injection token.\n * The guard will not wait until the cart has been resolved before performing the check and emitting.\n * Ensure that the cart is resolved prior to running this guard with the {@link DaffResolvedCartGuard}.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffShippingMethodGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartShippingMethodGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasShippingMethod$.pipe(\n take(1),\n tap(hasShippingMethod => {\n if (!hasShippingMethod) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartOrderResultGuardRedirectUrl = new InjectionToken<string>('DaffCartOrderResultGuardRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n CanActivate,\n Router,\n} from '@angular/router';\nimport {\n Observable,\n of,\n} from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\nimport { DaffCartFacade } from '@daffodil/cart/state';\n\nimport { DaffCartOrderResultGuardRedirectUrl } from './order-result-guard-redirect.token';\n\n/**\n * A routing guard that will redirect to a given url if the cart order result is not defined.\n * The url is `/` by default, but can be overridden with the DaffCartOrderResultGuardRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffOrderResultGuard implements CanActivate {\n constructor(\n\t\tprivate facade: DaffCartFacade,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartOrderResultGuardRedirectUrl) private redirectUrl: string,\n ) {}\n\n canActivate(): Observable<boolean> {\n return this.facade.hasOrderResult$.pipe(\n tap(hasOrderResult => {\n if (!hasOrderResult) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n }),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffCartResolverRedirectUrl = new InjectionToken<string>('DaffCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport {\n Store,\n ActionsSubject,\n Action,\n} from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n map,\n filter,\n take,\n} from 'rxjs/operators';\n\nimport {\n DaffCartStateRootSlice,\n DaffResolveCart,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolverRedirectUrl } from './tokens/cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffCartResolver implements Resolve<Observable<Action>> {\n constructor(\n private store: Store<DaffCartStateRootSlice>,\n private dispatcher: ActionsSubject,\n\t\tprivate router: Router,\n\t\t@Inject(DaffCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n this.store.dispatch(new DaffResolveCart());\n\n return this.dispatcher.pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction\n || action.type === DaffCartActionTypes.CartLoadFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartCreateFailureAction\n\t\t\t\t|| action.type === DaffCartActionTypes.CartStorageFailureAction),\n map((action) => {\n if(action.type !== DaffCartActionTypes.CartLoadSuccessAction) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n take(1),\n );\n }\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const DaffEmptyCartResolverRedirectUrl = new InjectionToken<string>('DaffEmptyCartResolverRedirectUrl');\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n Resolve,\n Router,\n} from '@angular/router';\nimport { Action } from '@ngrx/store';\nimport { Observable } from 'rxjs';\nimport {\n filter,\n map,\n} from 'rxjs/operators';\n\nimport {\n DaffCartLoadSuccess,\n DaffCartActionTypes,\n} from '@daffodil/cart/state';\n\nimport { DaffCartResolver } from './cart-resolver.service';\nimport { DaffEmptyCartResolverRedirectUrl } from './tokens/empty-cart-resolver-redirect.token';\n\n/**\n * Resolves the cart before navigation. Redirects to a given url when a failure occurs during Cart Load.\n * This url is `/` by default but can be overridden with the DaffCartResolverRedirectUrl injection token.\n * This resolver also redirects to a different url when the cart is empty after successfully loading.\n * This url is also `/` by default, but can be overridden with the DaffEmptyCartResolverRedirectUrl\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffEmptyCartResolver implements Resolve<Observable<Action>> {\n constructor(\n\t\tprivate cartResolver: DaffCartResolver,\n\t\tprivate router: Router,\n\t\t@Inject(DaffEmptyCartResolverRedirectUrl) private redirectUrl: string,\n ) {}\n\n resolve(): Observable<Action> {\n return this.cartResolver.resolve().pipe(\n filter(action => action.type === DaffCartActionTypes.CartLoadSuccessAction),\n map((action: DaffCartLoadSuccess) => {\n if(!action.payload || action.payload.items.length === 0) {\n this.router.navigateByUrl(this.redirectUrl);\n }\n return action;\n }),\n );\n }\n}\n","import {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartRoutingConfiguration,\n DAFF_CART_ROUTING_CONFIG,\n daffCartRoutingConfigurationDefault,\n} from './config/config';\nimport {\n DaffCartBillingAddressGuardRedirectUrl,\n DaffCartShippingAddressGuardRedirectUrl,\n DaffCartShippingMethodGuardRedirectUrl,\n DaffCartPaymentMethodGuardRedirectUrl,\n DaffCartOrderResultGuardRedirectUrl,\n DaffCartItemsGuardRedirectUrl,\n} from './guards/public_api';\nimport {\n DaffEmptyCartResolverRedirectUrl,\n DaffCartResolverRedirectUrl,\n} from './resolvers/public_api';\n\n@NgModule({\n providers: [\n { provide: DaffCartBillingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartItemsGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingAddressGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartShippingMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartPaymentMethodGuardRedirectUrl, useValue: '/' },\n { provide: DaffCartOrderResultGuardRedirectUrl, useValue: '/' },\n { provide: DaffEmptyCartResolverRedirectUrl, useValue: '/' },\n { provide: DaffCartResolverRedirectUrl, useValue: '/' },\n ],\n})\nexport class DaffCartRoutingModule {\n static forRoot(config: DaffCartRoutingConfiguration = <any>{}): ModuleWithProviders<DaffCartRoutingModule> {\n return {\n ngModule: DaffCartRoutingModule,\n providers: [\n {\n provide: DAFF_CART_ROUTING_CONFIG,\n useValue: {\n ...daffCartRoutingConfigurationDefault,\n ...config,\n },\n },\n ],\n };\n }\n}\n"]}
|