@daffodil/cart 0.39.11 → 0.39.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/bundles/daffodil-cart-driver-in-memory.umd.js +4 -1
  2. package/bundles/daffodil-cart-driver-in-memory.umd.js.map +1 -1
  3. package/bundles/daffodil-cart-driver-in-memory.umd.min.js +1 -1
  4. package/bundles/daffodil-cart-driver-in-memory.umd.min.js.map +1 -1
  5. package/bundles/daffodil-cart-driver-magento.umd.js +33 -5
  6. package/bundles/daffodil-cart-driver-magento.umd.js.map +1 -1
  7. package/bundles/daffodil-cart-driver-magento.umd.min.js +1 -1
  8. package/bundles/daffodil-cart-driver-magento.umd.min.js.map +1 -1
  9. package/bundles/daffodil-cart-driver-testing.umd.js +4 -1
  10. package/bundles/daffodil-cart-driver-testing.umd.js.map +1 -1
  11. package/bundles/daffodil-cart-driver-testing.umd.min.js +1 -1
  12. package/bundles/daffodil-cart-driver-testing.umd.min.js.map +1 -1
  13. package/bundles/daffodil-cart-driver.umd.js.map +1 -1
  14. package/bundles/daffodil-cart-driver.umd.min.js.map +1 -1
  15. package/bundles/daffodil-cart-state.umd.js +147 -25
  16. package/bundles/daffodil-cart-state.umd.js.map +1 -1
  17. package/bundles/daffodil-cart-state.umd.min.js +1 -1
  18. package/bundles/daffodil-cart-state.umd.min.js.map +1 -1
  19. package/driver/daffodil-cart-driver.metadata.json +1 -1
  20. package/driver/in-memory/daffodil-cart-driver-in-memory.metadata.json +1 -1
  21. package/driver/in-memory/drivers/cart/cart.service.d.ts +3 -2
  22. package/driver/interfaces/cart-service.interface.d.ts +2 -1
  23. package/driver/magento/cart.service.d.ts +2 -1
  24. package/driver/magento/daffodil-cart-driver-magento.metadata.json +1 -1
  25. package/driver/magento/errors/transform.d.ts +13 -1
  26. package/driver/testing/daffodil-cart-driver-testing.metadata.json +1 -1
  27. package/driver/testing/drivers/cart/cart.service.d.ts +2 -1
  28. package/esm2015/driver/in-memory/drivers/cart/cart.service.js +5 -2
  29. package/esm2015/driver/interfaces/cart-service.interface.js +1 -1
  30. package/esm2015/driver/magento/cart.service.js +20 -7
  31. package/esm2015/driver/magento/errors/transform.js +15 -6
  32. package/esm2015/driver/testing/drivers/cart/cart.service.js +5 -2
  33. package/esm2015/state/actions/cart-item.actions.js +30 -1
  34. package/esm2015/state/actions/cart.actions.js +29 -1
  35. package/esm2015/state/effects/cart-item.effects.js +17 -6
  36. package/esm2015/state/effects/cart-resolver.effects.js +23 -10
  37. package/esm2015/state/effects/cart.effects.js +13 -4
  38. package/esm2015/state/reducers/cart/cart.reducer.js +7 -3
  39. package/esm2015/state/reducers/cart-item/cart-item.reducer.js +11 -3
  40. package/esm2015/state/reducers/cart-item-entities/cart-item-entities.reducer.js +4 -1
  41. package/esm2015/state/reducers/errors/error-state-helpers.js +3 -3
  42. package/fesm2015/daffodil-cart-driver-in-memory.js +4 -1
  43. package/fesm2015/daffodil-cart-driver-in-memory.js.map +1 -1
  44. package/fesm2015/daffodil-cart-driver-magento.js +31 -9
  45. package/fesm2015/daffodil-cart-driver-magento.js.map +1 -1
  46. package/fesm2015/daffodil-cart-driver-testing.js +4 -1
  47. package/fesm2015/daffodil-cart-driver-testing.js.map +1 -1
  48. package/fesm2015/daffodil-cart-driver.js.map +1 -1
  49. package/fesm2015/daffodil-cart-state.js +126 -24
  50. package/fesm2015/daffodil-cart-state.js.map +1 -1
  51. package/package.json +5 -5
  52. package/state/actions/cart-item.actions.d.ts +26 -1
  53. package/state/actions/cart.actions.d.ts +31 -5
  54. package/state/daffodil-cart-state.metadata.json +1 -1
  55. package/state/effects/cart-item.effects.d.ts +5 -2
  56. package/state/effects/cart.effects.d.ts +2 -2
  57. package/state/reducers/errors/error-state-helpers.d.ts +1 -1
@@ -1,2 +1,2 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common/http"),require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@daffodil/cart/driver"),require("@angular/common"),require("angular-in-memory-web-api"),require("@daffodil/cart/testing")):"function"==typeof define&&define.amd?define("@daffodil/cart/driver/in-memory",["exports","@angular/common/http","@angular/core","rxjs","rxjs/operators","@daffodil/cart/driver","@angular/common","angular-in-memory-web-api","@daffodil/cart/testing"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).daffodil=t.daffodil||{},t.daffodil.cart=t.daffodil.cart||{},t.daffodil.cart.driver=t.daffodil.cart.driver||{},t.daffodil.cart.driver["in-memory"]={}),t.ng.common.http,t.ng.core,t.rxjs,t.rxjs.operators,t.daffodil.cart.driver,t.ng.common,t.angularInMemoryWebApi,t.daffodil.cart.testing)}(this,(function(t,e,r,n,o,i,a,s,c){"use strict";var u=function(){function t(t){this.http=t,this.url="/api/cart"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t).pipe(o.catchError((function(t){return n.throwError(new i.DaffCartNotFoundError(t.message))})),o.map((function(t){return t})))},t.prototype.addToCart=function(t,e){return this.http.post(this.url+"/addToCart",{productId:t,qty:e})},t.prototype.clear=function(t){return this.http.post(this.url+"/"+t+"/clear",{})},t.prototype.create=function(){return this.http.post(this.url,{})},t}();u.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new u(r.ɵɵinject(e.HttpClient))},token:u,providedIn:"root"}),u.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[{type:e.HttpClient}]};var p=function(){function t(t){this.http=t,this.url="/api/cart-items"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t+"/")},t.prototype.get=function(t,e){return this.http.get(this.url+"/"+t+"/"+e)},t.prototype.add=function(t,e){return this.http.post(this.url+"/"+t+"/",e)},t.prototype.update=function(t,e,r){return this.http.put(this.url+"/"+t+"/"+e,r)},t.prototype.delete=function(t,e){return this.http.delete(this.url+"/"+t+"/"+e)},t}();p.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new p(r.ɵɵinject(e.HttpClient))},token:p,providedIn:"root"}),p.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:e.HttpClient}]};var d=function(){function t(t){this.http=t,this.url="/api/cart-billing-address"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();d.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new d(r.ɵɵinject(e.HttpClient))},token:d,providedIn:"root"}),d.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],d.ctorParameters=function(){return[{type:e.HttpClient}]};var f=function(){function t(t){this.http=t,this.url="/api/cart-payment"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,{payment:e})},t.prototype.updateWithBilling=function(t,e,r){return this.http.put(this.url+"/"+t,{payment:e,address:r})},t.prototype.remove=function(t){return this.http.delete(this.url+"/"+t)},t}();f.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new f(r.ɵɵinject(e.HttpClient))},token:f,providedIn:"root"}),f.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],f.ctorParameters=function(){return[{type:e.HttpClient}]};var l=function(){function t(t){this.http=t,this.url="/api/cart-payment-methods"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t)},t}();l.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new l(r.ɵɵinject(e.HttpClient))},token:l,providedIn:"root"}),l.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],l.ctorParameters=function(){return[{type:e.HttpClient}]};var h=function(){function t(t){this.http=t,this.url="/api/cart-shipping-address"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();h.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new h(r.ɵɵinject(e.HttpClient))},token:h,providedIn:"root"}),h.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],h.ctorParameters=function(){return[{type:e.HttpClient}]};var y=function(){function t(t){this.http=t,this.url="/api/cart-shipping-information"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t.prototype.delete=function(t){return this.http.delete(this.url+"/"+t)},t}();y.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new y(r.ɵɵinject(e.HttpClient))},token:y,providedIn:"root"}),y.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],y.ctorParameters=function(){return[{type:e.HttpClient}]};var g=function(){function t(t){this.http=t,this.url="/api/cart-shipping-methods"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t)},t}();g.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new g(r.ɵɵinject(e.HttpClient))},token:g,providedIn:"root"}),g.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],g.ctorParameters=function(){return[{type:e.HttpClient}]};var v=function(){function t(t){this.http=t,this.url="/api/cart-order"}return t.prototype.placeOrder=function(t,e){return this.http.post(this.url+"/"+t+"/",{payment:e})},t}();v.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new v(r.ɵɵinject(e.HttpClient))},token:v,providedIn:"root"}),v.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],v.ctorParameters=function(){return[{type:e.HttpClient}]};var m=function(){function t(t){this.http=t,this.url="/api/cart-coupon"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t+"/")},t.prototype.apply=function(t,e){return this.http.post(this.url+"/"+t+"/",e)},t.prototype.remove=function(t,e){return this.http.delete(this.url+"/"+t+"/"+e.code)},t.prototype.removeAll=function(t){return this.http.delete(this.url+"/"+t+"/")},t}();m.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new m(r.ɵɵinject(e.HttpClient))},token:m,providedIn:"root"}),m.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],m.ctorParameters=function(){return[{type:e.HttpClient}]};var I=function(){function t(t){this.http=t,this.url="/api/cart-address"}return t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();I.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new I(r.ɵɵinject(e.HttpClient))},token:I,providedIn:"root"}),I.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],I.ctorParameters=function(){return[{type:e.HttpClient}]};var b=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[{provide:i.DaffCartDriver,useExisting:u},{provide:i.DaffCartAddressDriver,useExisting:I},{provide:i.DaffCartBillingAddressDriver,useExisting:d},{provide:i.DaffCartItemDriver,useExisting:p},{provide:i.DaffCartPaymentDriver,useExisting:f},{provide:i.DaffCartPaymentMethodsDriver,useExisting:l},{provide:i.DaffCartShippingAddressDriver,useExisting:h},{provide:i.DaffCartShippingInformationDriver,useExisting:y},{provide:i.DaffCartShippingMethodsDriver,useExisting:g},{provide:i.DaffCartOrderDriver,useExisting:v},{provide:i.DaffCartCouponDriver,useExisting:m}]}},t}();b.decorators=[{type:r.NgModule,args:[{imports:[a.CommonModule]}]}];var j=new r.InjectionToken("DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK",{factory:function(){return function(t,e){return{}}}}),S=function(){function t(t){this.extraFieldsHook=t}return t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.updateAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.billing_address=r,e.shipping_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();S.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new S(r.ɵɵinject(j))},token:S,providedIn:"root"}),S.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],S.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var C=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getBillingAddress(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateBillingAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getBillingAddress=function(t){return this.getCart(t).billing_address},t.prototype.updateBillingAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.billing_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();C.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new C(r.ɵɵinject(j))},token:C,providedIn:"root"}),C.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],C.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var O=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listCoupons(t),status:s.STATUS.OK}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.applyCoupon(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:r?e.removeCoupon(t,r):e.removeAllCoupons(t),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listCoupons=function(t){return this.getCart(t).coupons},t.prototype.applyCoupon=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.coupons.push(r),Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removeCoupon=function(t,e){var r=this.getCart(t);return r.coupons=r.coupons.filter((function(t){return t.code!==e})),Object.assign(Object.assign({},r),{extra_attributes:this.extraFieldsHook(t,r)})},t.prototype.removeAllCoupons=function(t){var e=this.getCart(t);return e.coupons=[],Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();O.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new O(r.ɵɵinject(j))},token:O,providedIn:"root"}),O.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],O.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};Object.create;function A(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function T(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(A(arguments[e]));return t}Object.create;var x=function(){function t(t,e){this.cartItemFactory=t,this.extraFieldsHook=e}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:r?e.getItem(t,r):e.listItems(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateItem(t,e.getAction(t)),status:s.STATUS.OK}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.addItem(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.deleteItem(t,e.getAction(t)),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.transformItemInput=function(t){return Object.assign(Object.assign(Object.assign({},this.cartItemFactory.create()),t),{product_id:t.productId})},t.prototype.listItems=function(t){return this.getCart(t).items},t.prototype.getItem=function(t,e){return this.getCart(t).items.find((function(t){var r=t.id;return e===r}))},t.prototype.updateItem=function(t,e){var r=this.getCart(t),n=t.collection.findIndex((function(e){return e.id===t.id})),o=t.utils.getJsonBody(t.req),i=r.items.findIndex((function(t){return e===t.id}));return t.collection[n]=Object.assign(Object.assign({},r),{items:r.items.map((function(t,e){return e===i?Object.assign(Object.assign({},r.items[i]),o):t})),extra_attributes:this.extraFieldsHook(t,r)}),t.collection[n]},t.prototype.addItem=function(t){var e=this.getCart(t),r=t.collection.findIndex((function(e){return e.id===t.id})),n=t.utils.getJsonBody(t.req),o=e.items.findIndex((function(t){return t.product_id===n.productId}));if(o>-1){var i=Object.assign(Object.assign({},e.items[o]),{qty:e.items[o].qty+n.qty});t.collection[r]=Object.assign(Object.assign({},e),{items:e.items.map((function(t,e){return e===o?i:t})),extra_attributes:this.extraFieldsHook(t,e)})}else t.collection[r]=Object.assign(Object.assign({},e),{items:T(e.items,[this.transformItemInput(n)]),extra_attributes:this.extraFieldsHook(t,e)});return t.collection[r]},t.prototype.deleteItem=function(t,e){var r=this.getCart(t),n=r.items.findIndex((function(t){var r=t.id;return e===r})),o=t.collection.findIndex((function(e){return e.id===t.id}));return t.collection[o]=Object.assign(Object.assign({},r),{items:r.items.filter((function(t,e){return e!==n})),extra_attributes:this.extraFieldsHook(t,r)}),t.collection[o]},t}();x.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new x(r.ɵɵinject(c.DaffCartItemFactory),r.ɵɵinject(j))},token:x,providedIn:"root"}),x.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],x.ctorParameters=function(){return[{type:c.DaffCartItemFactory},{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var k=function(){function t(){}return t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.placeOrder(t),status:s.STATUS.OK}}))},t.prototype.placeOrder=function(t){return{id:"8235422034",cartId:"89fdsa8sadf",orderId:"8235422034"}},t}();k.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new k},token:k,providedIn:"root"}),k.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}];var D=function(){function t(){}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listPaymentMethods(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listPaymentMethods=function(t){return this.getCart(t).available_payment_methods},t}();D.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new D},token:D,providedIn:"root"}),D.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}];var _=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getPayment(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updatePayment(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.removePayment(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getPayment=function(t){return this.getCart(t).payment},t.prototype.updatePayment=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req),n=r.payment,o=r.address;return e.payment=n,o&&(e.billing_address=o),Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removePayment=function(t){var e=this.getCart(t);return e.payment=null,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();_.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new _(r.ɵɵinject(j))},token:_,providedIn:"root"}),_.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],_.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var M=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getShippingAddress(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateShippingAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getShippingAddress=function(t){return this.getCart(t).shipping_address},t.prototype.updateShippingAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.shipping_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();M.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new M(r.ɵɵinject(j))},token:M,providedIn:"root"}),M.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],M.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var H=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.removeShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getShippingInformation=function(t){return this.getCart(t).shipping_information},t.prototype.updateShippingInformation=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.shipping_information=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removeShippingInformation=function(t){var e=this.getCart(t);return e.shipping_information=null,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();H.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new H(r.ɵɵinject(j))},token:H,providedIn:"root"}),H.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],H.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var B=function(){function t(t){this.shippingMethodFactory=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listShippingMethods(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listShippingMethods=function(t){var e,r=this.getCart(t);return r.shipping_address?0===(null===(e=r.available_shipping_methods)||void 0===e?void 0:e.length)&&(r.available_shipping_methods=this.shippingMethodFactory.createMany(3)):r.available_shipping_methods=[],r.available_shipping_methods},t}();B.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new B(r.ɵɵinject(c.DaffCartShippingRateFactory))},token:B,providedIn:"root"}),B.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],B.ctorParameters=function(){return[{type:c.DaffCartShippingRateFactory}]};var F=function(){function t(t,e){this.cartFactory=t,this.extraFieldsHook=e}return t.prototype.get=function(t){var e=this,r=this.getCart(t);return t.utils.createResponse$((function(){return{body:r?Object.assign(Object.assign({},r),{extra_attributes:e.extraFieldsHook(t,r)}):r,status:r?s.STATUS.OK:s.STATUS.NOT_FOUND}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:"addToCart"===t.id?{}:"clear"===r?e.clear(t):e.create(t),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.clear=function(t){var e=this.getCart(t);return e.items=[],Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.create=function(t){var e=this.cartFactory.create();return t.collection.push(e),{id:e.id}},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t}();F.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new F(r.ɵɵinject(c.DaffCartFactory),r.ɵɵinject(j))},token:F,providedIn:"root"}),F.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],F.ctorParameters=function(){return[{type:c.DaffCartFactory},{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var R=function(){function t(t,e,r,n,o,i,a,s,c,u,p){this.cartService=t,this.cartItemsService=e,this.cartOrderService=r,this.cartCouponService=n,this.cartAddressService=o,this.cartShippingAddressService=i,this.cartBillingAddressService=a,this.cartPaymentMethodsService=s,this.cartShippingMethodsService=c,this.cartPaymentService=u,this.cartShippingInformationService=p,this.carts=[]}return t.prototype.createDb=function(t){if(t){var e=t.utils.getJsonBody(t.req).carts;e&&(this.carts=e)}return{cart:this.carts}},t.prototype.get=function(t){return this.delegateRequest(t)},t.prototype.post=function(t){return this.delegateRequest(t)},t.prototype.put=function(t){return this.delegateRequest(t)},t.prototype.delete=function(t){return this.delegateRequest(t)},t.prototype.delegateRequest=function(t){switch(t.collection=this.carts,t.collectionName){case"cart":return this.cartService[t.method](t);case"cart-items":return this.cartItemsService[t.method](t);case"cart-order":return this.cartOrderService[t.method](t);case"cart-coupon":return this.cartCouponService[t.method](t);case"cart-address":return this.cartAddressService[t.method](t);case"cart-shipping-address":return this.cartShippingAddressService[t.method](t);case"cart-billing-address":return this.cartBillingAddressService[t.method](t);case"cart-payment-methods":return this.cartPaymentMethodsService[t.method](t);case"cart-shipping-methods":return this.cartShippingMethodsService[t.method](t);case"cart-payment":return this.cartPaymentService[t.method](t);case"cart-shipping-information":return this.cartShippingInformationService[t.method](t);default:return t.utils.createResponse$((function(){return{body:{},status:s.STATUS.OK}}))}},t}();R.COLLECTION_NAMES=["cart","cart-items","cart-order","cart-coupon","cart-address","cart-shipping-address","cart-billing-address","cart-payment-methods","cart-shipping-methods","cart-payment","cart-shipping-information"],R.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new R(r.ɵɵinject(F),r.ɵɵinject(x),r.ɵɵinject(k),r.ɵɵinject(O),r.ɵɵinject(S),r.ɵɵinject(M),r.ɵɵinject(C),r.ɵɵinject(D),r.ɵɵinject(B),r.ɵɵinject(_),r.ɵɵinject(H))},token:R,providedIn:"root"}),R.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],R.ctorParameters=function(){return[{type:F},{type:x},{type:k},{type:O},{type:S},{type:M},{type:C},{type:D},{type:B},{type:_},{type:H}]},t.DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK=j,t.DaffCartInMemoryDriverModule=b,t.DaffInMemoryBackendCartAddressService=S,t.DaffInMemoryBackendCartBillingAddressService=C,t.DaffInMemoryBackendCartCouponService=O,t.DaffInMemoryBackendCartItemsService=x,t.DaffInMemoryBackendCartOrderService=k,t.DaffInMemoryBackendCartPaymentMethodsService=D,t.DaffInMemoryBackendCartPaymentService=_,t.DaffInMemoryBackendCartRootService=R,t.DaffInMemoryBackendCartService=F,t.DaffInMemoryBackendCartShippingAddressService=M,t.DaffInMemoryBackendCartShippingInformationService=H,t.DaffInMemoryBackendCartShippingMethodsService=B,t.DaffInMemoryCartBillingAddressService=d,t.DaffInMemoryCartCouponService=m,t.DaffInMemoryCartItemService=p,t.DaffInMemoryCartOrderService=v,t.DaffInMemoryCartPaymentMethodsService=l,t.DaffInMemoryCartPaymentService=f,t.DaffInMemoryCartService=u,t.DaffInMemoryCartShippingAddressService=h,t.DaffInMemoryCartShippingInformationService=y,t.DaffInMemoryCartShippingMethodsService=g,t.ɵa=I,Object.defineProperty(t,"__esModule",{value:!0})}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/common/http"),require("@angular/core"),require("rxjs"),require("rxjs/operators"),require("@daffodil/cart/driver"),require("@angular/common"),require("angular-in-memory-web-api"),require("@daffodil/cart/testing")):"function"==typeof define&&define.amd?define("@daffodil/cart/driver/in-memory",["exports","@angular/common/http","@angular/core","rxjs","rxjs/operators","@daffodil/cart/driver","@angular/common","angular-in-memory-web-api","@daffodil/cart/testing"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).daffodil=t.daffodil||{},t.daffodil.cart=t.daffodil.cart||{},t.daffodil.cart.driver=t.daffodil.cart.driver||{},t.daffodil.cart.driver["in-memory"]={}),t.ng.common.http,t.ng.core,t.rxjs,t.rxjs.operators,t.daffodil.cart.driver,t.ng.common,t.angularInMemoryWebApi,t.daffodil.cart.testing)}(this,(function(t,e,r,n,o,i,a,s,c){"use strict";var u=function(){function t(t){this.http=t,this.url="/api/cart"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t).pipe(o.catchError((function(t){return n.throwError(new i.DaffCartNotFoundError(t.message))})),o.map((function(t){return{response:t,errors:[]}})))},t.prototype.addToCart=function(t,e){return this.http.post(this.url+"/addToCart",{productId:t,qty:e})},t.prototype.clear=function(t){return this.http.post(this.url+"/"+t+"/clear",{})},t.prototype.create=function(){return this.http.post(this.url,{})},t}();u.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new u(r.ɵɵinject(e.HttpClient))},token:u,providedIn:"root"}),u.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],u.ctorParameters=function(){return[{type:e.HttpClient}]};var p=function(){function t(t){this.http=t,this.url="/api/cart-items"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t+"/")},t.prototype.get=function(t,e){return this.http.get(this.url+"/"+t+"/"+e)},t.prototype.add=function(t,e){return this.http.post(this.url+"/"+t+"/",e)},t.prototype.update=function(t,e,r){return this.http.put(this.url+"/"+t+"/"+e,r)},t.prototype.delete=function(t,e){return this.http.delete(this.url+"/"+t+"/"+e)},t}();p.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new p(r.ɵɵinject(e.HttpClient))},token:p,providedIn:"root"}),p.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],p.ctorParameters=function(){return[{type:e.HttpClient}]};var d=function(){function t(t){this.http=t,this.url="/api/cart-billing-address"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();d.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new d(r.ɵɵinject(e.HttpClient))},token:d,providedIn:"root"}),d.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],d.ctorParameters=function(){return[{type:e.HttpClient}]};var f=function(){function t(t){this.http=t,this.url="/api/cart-payment"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,{payment:e})},t.prototype.updateWithBilling=function(t,e,r){return this.http.put(this.url+"/"+t,{payment:e,address:r})},t.prototype.remove=function(t){return this.http.delete(this.url+"/"+t)},t}();f.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new f(r.ɵɵinject(e.HttpClient))},token:f,providedIn:"root"}),f.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],f.ctorParameters=function(){return[{type:e.HttpClient}]};var l=function(){function t(t){this.http=t,this.url="/api/cart-payment-methods"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t)},t}();l.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new l(r.ɵɵinject(e.HttpClient))},token:l,providedIn:"root"}),l.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],l.ctorParameters=function(){return[{type:e.HttpClient}]};var h=function(){function t(t){this.http=t,this.url="/api/cart-shipping-address"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();h.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new h(r.ɵɵinject(e.HttpClient))},token:h,providedIn:"root"}),h.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],h.ctorParameters=function(){return[{type:e.HttpClient}]};var y=function(){function t(t){this.http=t,this.url="/api/cart-shipping-information"}return t.prototype.get=function(t){return this.http.get(this.url+"/"+t)},t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t.prototype.delete=function(t){return this.http.delete(this.url+"/"+t)},t}();y.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new y(r.ɵɵinject(e.HttpClient))},token:y,providedIn:"root"}),y.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],y.ctorParameters=function(){return[{type:e.HttpClient}]};var g=function(){function t(t){this.http=t,this.url="/api/cart-shipping-methods"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t)},t}();g.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new g(r.ɵɵinject(e.HttpClient))},token:g,providedIn:"root"}),g.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],g.ctorParameters=function(){return[{type:e.HttpClient}]};var v=function(){function t(t){this.http=t,this.url="/api/cart-order"}return t.prototype.placeOrder=function(t,e){return this.http.post(this.url+"/"+t+"/",{payment:e})},t}();v.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new v(r.ɵɵinject(e.HttpClient))},token:v,providedIn:"root"}),v.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],v.ctorParameters=function(){return[{type:e.HttpClient}]};var m=function(){function t(t){this.http=t,this.url="/api/cart-coupon"}return t.prototype.list=function(t){return this.http.get(this.url+"/"+t+"/")},t.prototype.apply=function(t,e){return this.http.post(this.url+"/"+t+"/",e)},t.prototype.remove=function(t,e){return this.http.delete(this.url+"/"+t+"/"+e.code)},t.prototype.removeAll=function(t){return this.http.delete(this.url+"/"+t+"/")},t}();m.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new m(r.ɵɵinject(e.HttpClient))},token:m,providedIn:"root"}),m.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],m.ctorParameters=function(){return[{type:e.HttpClient}]};var I=function(){function t(t){this.http=t,this.url="/api/cart-address"}return t.prototype.update=function(t,e){return this.http.put(this.url+"/"+t,e)},t}();I.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new I(r.ɵɵinject(e.HttpClient))},token:I,providedIn:"root"}),I.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],I.ctorParameters=function(){return[{type:e.HttpClient}]};var b=function(){function t(){}return t.forRoot=function(){return{ngModule:t,providers:[{provide:i.DaffCartDriver,useExisting:u},{provide:i.DaffCartAddressDriver,useExisting:I},{provide:i.DaffCartBillingAddressDriver,useExisting:d},{provide:i.DaffCartItemDriver,useExisting:p},{provide:i.DaffCartPaymentDriver,useExisting:f},{provide:i.DaffCartPaymentMethodsDriver,useExisting:l},{provide:i.DaffCartShippingAddressDriver,useExisting:h},{provide:i.DaffCartShippingInformationDriver,useExisting:y},{provide:i.DaffCartShippingMethodsDriver,useExisting:g},{provide:i.DaffCartOrderDriver,useExisting:v},{provide:i.DaffCartCouponDriver,useExisting:m}]}},t}();b.decorators=[{type:r.NgModule,args:[{imports:[a.CommonModule]}]}];var j=new r.InjectionToken("DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK",{factory:function(){return function(t,e){return{}}}}),S=function(){function t(t){this.extraFieldsHook=t}return t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.updateAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.billing_address=r,e.shipping_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();S.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new S(r.ɵɵinject(j))},token:S,providedIn:"root"}),S.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],S.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var C=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getBillingAddress(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateBillingAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getBillingAddress=function(t){return this.getCart(t).billing_address},t.prototype.updateBillingAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.billing_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();C.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new C(r.ɵɵinject(j))},token:C,providedIn:"root"}),C.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],C.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var O=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listCoupons(t),status:s.STATUS.OK}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.applyCoupon(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:r?e.removeCoupon(t,r):e.removeAllCoupons(t),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listCoupons=function(t){return this.getCart(t).coupons},t.prototype.applyCoupon=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.coupons.push(r),Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removeCoupon=function(t,e){var r=this.getCart(t);return r.coupons=r.coupons.filter((function(t){return t.code!==e})),Object.assign(Object.assign({},r),{extra_attributes:this.extraFieldsHook(t,r)})},t.prototype.removeAllCoupons=function(t){var e=this.getCart(t);return e.coupons=[],Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();O.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new O(r.ɵɵinject(j))},token:O,providedIn:"root"}),O.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],O.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};Object.create;function A(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function T(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(A(arguments[e]));return t}Object.create;var x=function(){function t(t,e){this.cartItemFactory=t,this.extraFieldsHook=e}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:r?e.getItem(t,r):e.listItems(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateItem(t,e.getAction(t)),status:s.STATUS.OK}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.addItem(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.deleteItem(t,e.getAction(t)),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.transformItemInput=function(t){return Object.assign(Object.assign(Object.assign({},this.cartItemFactory.create()),t),{product_id:t.productId})},t.prototype.listItems=function(t){return this.getCart(t).items},t.prototype.getItem=function(t,e){return this.getCart(t).items.find((function(t){var r=t.id;return e===r}))},t.prototype.updateItem=function(t,e){var r=this.getCart(t),n=t.collection.findIndex((function(e){return e.id===t.id})),o=t.utils.getJsonBody(t.req),i=r.items.findIndex((function(t){return e===t.id}));return t.collection[n]=Object.assign(Object.assign({},r),{items:r.items.map((function(t,e){return e===i?Object.assign(Object.assign({},r.items[i]),o):t})),extra_attributes:this.extraFieldsHook(t,r)}),t.collection[n]},t.prototype.addItem=function(t){var e=this.getCart(t),r=t.collection.findIndex((function(e){return e.id===t.id})),n=t.utils.getJsonBody(t.req),o=e.items.findIndex((function(t){return t.product_id===n.productId}));if(o>-1){var i=Object.assign(Object.assign({},e.items[o]),{qty:e.items[o].qty+n.qty});t.collection[r]=Object.assign(Object.assign({},e),{items:e.items.map((function(t,e){return e===o?i:t})),extra_attributes:this.extraFieldsHook(t,e)})}else t.collection[r]=Object.assign(Object.assign({},e),{items:T(e.items,[this.transformItemInput(n)]),extra_attributes:this.extraFieldsHook(t,e)});return t.collection[r]},t.prototype.deleteItem=function(t,e){var r=this.getCart(t),n=r.items.findIndex((function(t){var r=t.id;return e===r})),o=t.collection.findIndex((function(e){return e.id===t.id}));return t.collection[o]=Object.assign(Object.assign({},r),{items:r.items.filter((function(t,e){return e!==n})),extra_attributes:this.extraFieldsHook(t,r)}),t.collection[o]},t}();x.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new x(r.ɵɵinject(c.DaffCartItemFactory),r.ɵɵinject(j))},token:x,providedIn:"root"}),x.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],x.ctorParameters=function(){return[{type:c.DaffCartItemFactory},{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var k=function(){function t(){}return t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.placeOrder(t),status:s.STATUS.OK}}))},t.prototype.placeOrder=function(t){return{id:"8235422034",cartId:"89fdsa8sadf",orderId:"8235422034"}},t}();k.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new k},token:k,providedIn:"root"}),k.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}];var D=function(){function t(){}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listPaymentMethods(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listPaymentMethods=function(t){return this.getCart(t).available_payment_methods},t}();D.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new D},token:D,providedIn:"root"}),D.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}];var _=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getPayment(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updatePayment(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.removePayment(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getPayment=function(t){return this.getCart(t).payment},t.prototype.updatePayment=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req),n=r.payment,o=r.address;return e.payment=n,o&&(e.billing_address=o),Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removePayment=function(t){var e=this.getCart(t);return e.payment=null,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();_.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new _(r.ɵɵinject(j))},token:_,providedIn:"root"}),_.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],_.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var M=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getShippingAddress(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateShippingAddress(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getShippingAddress=function(t){return this.getCart(t).shipping_address},t.prototype.updateShippingAddress=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.shipping_address=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();M.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new M(r.ɵɵinject(j))},token:M,providedIn:"root"}),M.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],M.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var H=function(){function t(t){this.extraFieldsHook=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.getShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.put=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.updateShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.delete=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.removeShippingInformation(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.getShippingInformation=function(t){return this.getCart(t).shipping_information},t.prototype.updateShippingInformation=function(t){var e=this.getCart(t),r=t.utils.getJsonBody(t.req);return e.shipping_information=r,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.removeShippingInformation=function(t){var e=this.getCart(t);return e.shipping_information=null,Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t}();H.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new H(r.ɵɵinject(j))},token:H,providedIn:"root"}),H.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],H.ctorParameters=function(){return[{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var B=function(){function t(t){this.shippingMethodFactory=t}return t.prototype.get=function(t){var e=this;return t.utils.createResponse$((function(){return{body:e.listShippingMethods(t),status:s.STATUS.OK}}))},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t.prototype.listShippingMethods=function(t){var e,r=this.getCart(t);return r.shipping_address?0===(null===(e=r.available_shipping_methods)||void 0===e?void 0:e.length)&&(r.available_shipping_methods=this.shippingMethodFactory.createMany(3)):r.available_shipping_methods=[],r.available_shipping_methods},t}();B.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new B(r.ɵɵinject(c.DaffCartShippingRateFactory))},token:B,providedIn:"root"}),B.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],B.ctorParameters=function(){return[{type:c.DaffCartShippingRateFactory}]};var F=function(){function t(t,e){this.cartFactory=t,this.extraFieldsHook=e}return t.prototype.get=function(t){var e=this,r=this.getCart(t);return t.utils.createResponse$((function(){return{body:r?Object.assign(Object.assign({},r),{extra_attributes:e.extraFieldsHook(t,r)}):r,status:r?s.STATUS.OK:s.STATUS.NOT_FOUND}}))},t.prototype.post=function(t){var e=this;return t.utils.createResponse$((function(){var r=e.getAction(t);return{body:"addToCart"===t.id?{}:"clear"===r?e.clear(t):e.create(t),status:s.STATUS.OK}}))},t.prototype.getAction=function(t){return t.url.replace("/"+t.resourceUrl+t.id+"/","")},t.prototype.clear=function(t){var e=this.getCart(t);return e.items=[],Object.assign(Object.assign({},e),{extra_attributes:this.extraFieldsHook(t,e)})},t.prototype.create=function(t){var e=this.cartFactory.create();return t.collection.push(e),{id:e.id}},t.prototype.getCart=function(t){return t.utils.findById(t.collection,t.id)},t}();F.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new F(r.ɵɵinject(c.DaffCartFactory),r.ɵɵinject(j))},token:F,providedIn:"root"}),F.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],F.ctorParameters=function(){return[{type:c.DaffCartFactory},{type:void 0,decorators:[{type:r.Inject,args:[j]}]}]};var R=function(){function t(t,e,r,n,o,i,a,s,c,u,p){this.cartService=t,this.cartItemsService=e,this.cartOrderService=r,this.cartCouponService=n,this.cartAddressService=o,this.cartShippingAddressService=i,this.cartBillingAddressService=a,this.cartPaymentMethodsService=s,this.cartShippingMethodsService=c,this.cartPaymentService=u,this.cartShippingInformationService=p,this.carts=[]}return t.prototype.createDb=function(t){if(t){var e=t.utils.getJsonBody(t.req).carts;e&&(this.carts=e)}return{cart:this.carts}},t.prototype.get=function(t){return this.delegateRequest(t)},t.prototype.post=function(t){return this.delegateRequest(t)},t.prototype.put=function(t){return this.delegateRequest(t)},t.prototype.delete=function(t){return this.delegateRequest(t)},t.prototype.delegateRequest=function(t){switch(t.collection=this.carts,t.collectionName){case"cart":return this.cartService[t.method](t);case"cart-items":return this.cartItemsService[t.method](t);case"cart-order":return this.cartOrderService[t.method](t);case"cart-coupon":return this.cartCouponService[t.method](t);case"cart-address":return this.cartAddressService[t.method](t);case"cart-shipping-address":return this.cartShippingAddressService[t.method](t);case"cart-billing-address":return this.cartBillingAddressService[t.method](t);case"cart-payment-methods":return this.cartPaymentMethodsService[t.method](t);case"cart-shipping-methods":return this.cartShippingMethodsService[t.method](t);case"cart-payment":return this.cartPaymentService[t.method](t);case"cart-shipping-information":return this.cartShippingInformationService[t.method](t);default:return t.utils.createResponse$((function(){return{body:{},status:s.STATUS.OK}}))}},t}();R.COLLECTION_NAMES=["cart","cart-items","cart-order","cart-coupon","cart-address","cart-shipping-address","cart-billing-address","cart-payment-methods","cart-shipping-methods","cart-payment","cart-shipping-information"],R.ɵprov=r.ɵɵdefineInjectable({factory:function(){return new R(r.ɵɵinject(F),r.ɵɵinject(x),r.ɵɵinject(k),r.ɵɵinject(O),r.ɵɵinject(S),r.ɵɵinject(M),r.ɵɵinject(C),r.ɵɵinject(D),r.ɵɵinject(B),r.ɵɵinject(_),r.ɵɵinject(H))},token:R,providedIn:"root"}),R.decorators=[{type:r.Injectable,args:[{providedIn:"root"}]}],R.ctorParameters=function(){return[{type:F},{type:x},{type:k},{type:O},{type:S},{type:M},{type:C},{type:D},{type:B},{type:_},{type:H}]},t.DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK=j,t.DaffCartInMemoryDriverModule=b,t.DaffInMemoryBackendCartAddressService=S,t.DaffInMemoryBackendCartBillingAddressService=C,t.DaffInMemoryBackendCartCouponService=O,t.DaffInMemoryBackendCartItemsService=x,t.DaffInMemoryBackendCartOrderService=k,t.DaffInMemoryBackendCartPaymentMethodsService=D,t.DaffInMemoryBackendCartPaymentService=_,t.DaffInMemoryBackendCartRootService=R,t.DaffInMemoryBackendCartService=F,t.DaffInMemoryBackendCartShippingAddressService=M,t.DaffInMemoryBackendCartShippingInformationService=H,t.DaffInMemoryBackendCartShippingMethodsService=B,t.DaffInMemoryCartBillingAddressService=d,t.DaffInMemoryCartCouponService=m,t.DaffInMemoryCartItemService=p,t.DaffInMemoryCartOrderService=v,t.DaffInMemoryCartPaymentMethodsService=l,t.DaffInMemoryCartPaymentService=f,t.DaffInMemoryCartService=u,t.DaffInMemoryCartShippingAddressService=h,t.DaffInMemoryCartShippingInformationService=y,t.DaffInMemoryCartShippingMethodsService=g,t.ɵa=I,Object.defineProperty(t,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=daffodil-cart-driver-in-memory.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../libs/cart/driver/in-memory/src/drivers/cart/cart.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-item/cart-item.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-order/cart-order.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-coupon/cart-coupon.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-address/cart-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-driver.module.ts","../../../libs/cart/driver/in-memory/src/injection-tokens/extra-attributes-hook.token.ts","../../../libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts","../../../node_modules/tslib/tslib.es6.js","../../../libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart/cart.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-root.service.ts"],"names":["DaffInMemoryCartService","http","this","url","prototype","get","cartId","pipe","catchError","error","throwError","DaffCartNotFoundError","message","map","result","addToCart","productId","qty","post","clear","create","Injectable","args","providedIn","HttpClient","DaffInMemoryCartItemService","list","itemId","add","input","update","item","put","delete","DaffInMemoryCartBillingAddressService","address","DaffInMemoryCartPaymentService","payment","updateWithBilling","remove","DaffInMemoryCartPaymentMethodsService","DaffInMemoryCartShippingAddressService","DaffInMemoryCartShippingInformationService","info","DaffInMemoryCartShippingMethodsService","DaffInMemoryCartOrderService","placeOrder","DaffInMemoryCartCouponService","apply","coupon","code","removeAll","DaffInMemoryCartAddressService","DaffCartInMemoryDriverModule","forRoot","ngModule","providers","provide","DaffCartDriver","useExisting","DaffCartAddressDriver","DaffCartBillingAddressDriver","DaffCartItemDriver","DaffCartPaymentDriver","DaffCartPaymentMethodsDriver","DaffCartShippingAddressDriver","DaffCartShippingInformationDriver","DaffCartShippingMethodsDriver","DaffCartOrderDriver","DaffCartCouponDriver","NgModule","imports","CommonModule","DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK","InjectionToken","factory","reqInfo","cart","DaffInMemoryBackendCartAddressService","extraFieldsHook","_this","utils","createResponse$","body","updateAddress","status","STATUS","OK","getCart","findById","collection","id","getJsonBody","req","billing_address","shipping_address","Object","assign","extra_attributes","Inject","DaffInMemoryBackendCartBillingAddressService","getBillingAddress","updateBillingAddress","DaffInMemoryBackendCartCouponService","listCoupons","applyCoupon","action","getAction","removeCoupon","removeAllCoupons","replace","resourceUrl","coupons","push","couponCode","filter","_a","__read","o","n","m","Symbol","iterator","r","e","i","call","ar","next","done","value","__spread","arguments","length","concat","DaffInMemoryBackendCartItemsService","cartItemFactory","getItem","listItems","updateItem","addItem","deleteItem","transformItemInput","itemInput","product_id","items","find","cartIndex","findIndex","c","itemChanges","itemIndex","index","existingCartItemIndex","updatedCartItem_1","DaffCartItemFactory","DaffInMemoryBackendCartOrderService","orderId","DaffInMemoryBackendCartPaymentMethodsService","listPaymentMethods","available_payment_methods","DaffInMemoryBackendCartPaymentService","getPayment","updatePayment","removePayment","DaffInMemoryBackendCartShippingAddressService","getShippingAddress","updateShippingAddress","DaffInMemoryBackendCartShippingInformationService","getShippingInformation","updateShippingInformation","removeShippingInformation","shipping_information","shippingInformation","DaffInMemoryBackendCartShippingMethodsService","shippingMethodFactory","listShippingMethods","available_shipping_methods","createMany","DaffCartShippingRateFactory","DaffInMemoryBackendCartService","cartFactory","NOT_FOUND","DaffCartFactory","DaffInMemoryBackendCartRootService","cartService","cartItemsService","cartOrderService","cartCouponService","cartAddressService","cartShippingAddressService","cartBillingAddressService","cartPaymentMethodsService","cartShippingMethodsService","cartPaymentService","cartShippingInformationService","carts","createDb","seedData","delegateRequest","collectionName","method","COLLECTION_NAMES"],"mappings":"w8BA6BE,SAAAA,EAAoBC,GAAAC,KAAAD,KAAAA,EAFXC,KAAAC,IAAM,mBAIfH,EAAAI,UAAAC,IAAA,SAAIC,GACF,OAAOJ,KAAKD,KAAKI,IAAiBH,KAAKC,IAAG,IAAIG,GAAUC,KACtDC,EAAAA,YAAW,SAACC,GAAiB,OAAAC,EAAAA,WAAW,IAAIC,EAAAA,sBAAsBF,EAAMG,aACxEC,EAAAA,KAAI,SAAAC,GAAU,OAAAA,OAIlBd,EAAAI,UAAAW,UAAA,SAAUC,EAAmBC,GAC3B,OAAOf,KAAKD,KAAKiB,KAAehB,KAAKC,IAAM,aAAc,CAAEa,UAASA,EAAEC,IAAGA,KAG3EjB,EAAAI,UAAAe,MAAA,SAAMb,GACJ,OAAOJ,KAAKD,KAAKiB,KAA2BhB,KAAKC,IAAG,IAAIG,EAAM,SAAU,KAG1EN,EAAAI,UAAAgB,OAAA,WACE,OAAOlB,KAAKD,KAAKiB,KAA2BhB,KAAKC,IAAK,mJA3BzDkB,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDArBLC,EAAAA,+BC2BP,SAAAC,EAAoBxB,GAAAC,KAAAD,KAAAA,EAFXC,KAAAC,IAAM,yBAIfsB,EAAArB,UAAAsB,KAAA,SAAKpB,GACH,OAAOJ,KAAKD,KAAKI,IAAuBH,KAAKC,IAAG,IAAIG,EAAM,MAG5DmB,EAAArB,UAAAC,IAAA,SAAIC,EAAwBqB,GAC1B,OAAOzB,KAAKD,KAAKI,IAAqBH,KAAKC,IAAG,IAAIG,EAAM,IAAIqB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QAAQ7H,GAExD,IAAK,uBACH,OAAO1E,KAAK8L,0BAA0BpH,EAAQ6H,QAAQ7H,GAExD,IAAK,wBACH,OAAO1E,KAAK+L,2BAA2BrH,EAAQ6H,QAAQ7H,GAEzD,IAAK,eACH,OAAO1E,KAAKgM,mBAAmBtH,EAAQ6H,QAAQ7H,GAEjD,IAAK,4BACH,OAAO1E,KAAKiM,+BAA+BvH,EAAQ6H,QAAQ7H,GAE7D,QACE,OAAOA,EAAQK,MAAMC,iBAAgB,WAAM,MAAA,CACzCC,KAAM,GACNE,OAAQC,EAAAA,OAAOC,cAtGAiG,EAAAkB,iBAAmB,CACxC,OACA,aACA,aACA,cACA,eACA,wBACA,uBACA,uBACA,wBACA,eACA,uSAnBHrL,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAPL6J,SAPA7C,SACAqB,SAFArD,SAFAzB,SAOAuF,SANAjE,SAIA0D,SAIAgB,SAHAb,SAEAO","sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCart } from '@daffodil/cart';\nimport {\n DaffCartServiceInterface,\n DaffCartNotFoundError,\n} from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartService implements DaffCartServiceInterface<DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCart> {\n return this.http.get<DaffCart>(`${this.url}/${cartId}`).pipe(\n catchError((error: Error) => throwError(new DaffCartNotFoundError(error.message))),\n map(result => result),\n );\n }\n\n addToCart(productId: string, qty: number): Observable<DaffCart> {\n return this.http.post<DaffCart>(this.url + '/addToCart', { productId, qty });\n }\n\n clear(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/clear`, {});\n }\n\n create(): Observable<{id: DaffCart['id']}> {\n return this.http.post<{id: DaffCart['id']}>(this.url, {});\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartItem,\n DaffCartItemInput,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartItemServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartItemService implements DaffCartItemServiceInterface<\n DaffCartItem,\n DaffCartItemInput,\n DaffCart\n> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-items';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartItem[]> {\n return this.http.get<DaffCartItem[]>(`${this.url}/${cartId}/`);\n }\n\n get(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<DaffCartItem> {\n return this.http.get<DaffCartItem>(`${this.url}/${cartId}/${itemId}`);\n }\n\n add(cartId: DaffCart['id'], input: DaffCartItemInput): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/`, input);\n }\n\n update(\n cartId: DaffCart['id'],\n itemId: DaffCartItem['id'],\n item: Partial<DaffCartItem>,\n ): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}/${itemId}`, item);\n }\n\n delete(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/${itemId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartBillingAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartBillingAddressService implements DaffCartBillingAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-billing-address';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return this.http.get<DaffCartAddress>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartPaymentServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartPaymentService implements DaffCartPaymentServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-payment';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod> {\n return this.http.get<DaffCartPaymentMethod>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], payment: Partial<DaffCartPaymentMethod>): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, { payment });\n }\n\n updateWithBilling(\n cartId: DaffCart['id'],\n payment: Partial<DaffCartPaymentMethod>,\n address: Partial<DaffCartAddress>,\n ): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, { payment, address });\n }\n\n remove(cartId: DaffCart['id']): Observable<void> {\n return this.http.delete<void>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartPaymentMethodsServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartPaymentMethodsService implements DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-payment-methods';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod[]> {\n return this.http.get<DaffCartPaymentMethod[]>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingAddressService implements DaffCartShippingAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-address';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return this.http.get<DaffCartAddress>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], address: Partial<DaffCartAddress>): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingInformationServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingInformationService implements DaffCartShippingInformationServiceInterface<\n DaffCartShippingRate,\n DaffCart\n> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-information';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartShippingRate> {\n return this.http.get<DaffCartShippingRate>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], info: Partial<DaffCartShippingRate>): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, info);\n }\n\n delete(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingMethodsServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingMethodsService implements DaffCartShippingMethodsServiceInterface<DaffCartShippingRate> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-methods';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartShippingRate[]> {\n return this.http.get<DaffCartShippingRate[]>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\nimport { DaffCartOrderServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartOrderService implements DaffCartOrderServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-order';\n\n constructor(private http: HttpClient) {}\n\n placeOrder(cartId: DaffCart['id'], payment?: DaffCartPaymentMethod): Observable<DaffCartOrderResult> {\n return this.http.post<DaffCartOrderResult>(`${this.url}/${cartId}/`, { payment });\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffCartCouponServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartCouponService implements DaffCartCouponServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-coupon';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartCoupon[]> {\n return this.http.get<DaffCartCoupon[]>(`${this.url}/${cartId}/`);\n }\n\n apply(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/`, coupon);\n }\n\n remove(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/${coupon.code}`);\n }\n\n removeAll(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartAddressService implements DaffCartAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-address';\n\n constructor(private http: HttpClient) {}\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartDriver,\n DaffCartBillingAddressDriver,\n DaffCartItemDriver,\n DaffCartPaymentDriver,\n DaffCartPaymentMethodsDriver,\n DaffCartShippingAddressDriver,\n DaffCartShippingInformationDriver,\n DaffCartShippingMethodsDriver,\n DaffCartOrderDriver,\n DaffCartCouponDriver,\n DaffCartAddressDriver,\n} from '@daffodil/cart/driver';\n\nimport { DaffInMemoryCartAddressService } from './cart-address/cart-address.service';\nimport { DaffInMemoryCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffInMemoryCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffInMemoryCartItemService } from './cart-item/cart-item.service';\nimport { DaffInMemoryCartOrderService } from './cart-order/cart-order.service';\nimport { DaffInMemoryCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffInMemoryCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffInMemoryCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffInMemoryCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffInMemoryCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffInMemoryCartService } from './cart/cart.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCartInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffCartInMemoryDriverModule> {\n return {\n ngModule: DaffCartInMemoryDriverModule,\n providers: [\n {\n provide: DaffCartDriver,\n useExisting: DaffInMemoryCartService,\n },\n {\n provide: DaffCartAddressDriver,\n useExisting: DaffInMemoryCartAddressService,\n },\n {\n provide: DaffCartBillingAddressDriver,\n useExisting: DaffInMemoryCartBillingAddressService,\n },\n {\n provide: DaffCartItemDriver,\n useExisting: DaffInMemoryCartItemService,\n },\n {\n provide: DaffCartPaymentDriver,\n useExisting: DaffInMemoryCartPaymentService,\n },\n {\n provide: DaffCartPaymentMethodsDriver,\n useExisting: DaffInMemoryCartPaymentMethodsService,\n },\n {\n provide: DaffCartShippingAddressDriver,\n useExisting: DaffInMemoryCartShippingAddressService,\n },\n {\n provide: DaffCartShippingInformationDriver,\n useExisting: DaffInMemoryCartShippingInformationService,\n },\n {\n provide: DaffCartShippingMethodsDriver,\n useExisting: DaffInMemoryCartShippingMethodsService,\n },\n {\n provide: DaffCartOrderDriver,\n useExisting: DaffInMemoryCartOrderService,\n },\n {\n provide: DaffCartCouponDriver,\n useExisting: DaffInMemoryCartCouponService,\n },\n ],\n };\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { RequestInfo } from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\n\nexport type DaffCartInMemoryExtraAttributesHook = (reqInfo: RequestInfo, cart: DaffCart) => Record<string, any>;\n\n/**\n * Allows an app dev to generate extra fields in the in-memory backend.\n * This enables the in-memory drivers to return responses similar to what the\n * frontend would expect from the production platform.\n *\n * The value returned by the hook function will be set to the returned cart's `extra_attributes` field\n * for driver calls that return a cart.\n *\n * The following example demonstrates adding the `numberOfCartItems` field to `extra_attributes`:\n * ```ts\n * (reqInfo: RequestInfo, cart: DaffCart) => ({\n * numberOfCartItems: cart.items.length\n * })\n * ```\n *\n * Note that this and any `extra_attributes` features are for advanced users\n * and should be used with care.\n */\nexport const DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK =\n new InjectionToken<DaffCartInMemoryExtraAttributesHook>('DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK', {\n factory: () => (reqInfo, cart) => ({}),\n });\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private updateAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.billing_address = address;\n cart.shipping_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartBillingAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getBillingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateBillingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getBillingAddress(reqInfo): DaffCartAddress {\n return this.getCart(reqInfo).billing_address;\n }\n\n private updateBillingAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.billing_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartCouponService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listCoupons(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.applyCoupon(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (action) {\n body = this.removeCoupon(reqInfo, action);\n } else {\n body = this.removeAllCoupons(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listCoupons(reqInfo): DaffCartCoupon[] {\n return this.getCart(reqInfo).coupons;\n }\n\n private applyCoupon(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const coupon = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.coupons.push(coupon);\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeCoupon(reqInfo: RequestInfo, couponCode: DaffCartCoupon['code']): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.coupons = cart.coupons.filter(({ code }) => code !== couponCode);\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeAllCoupons(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.coupons = [];\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\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 Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartItem,\n DaffCartItemInput,\n} from '@daffodil/cart';\nimport { DaffCartItemFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartItemsService implements DaffInMemoryDataServiceInterface {\n constructor(\n private cartItemFactory: DaffCartItemFactory,\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (action) {\n body = this.getItem(reqInfo, action);\n } else {\n body = this.listItems(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateItem(reqInfo, this.getAction(reqInfo)),\n status: STATUS.OK,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.addItem(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.deleteItem(reqInfo, this.getAction(reqInfo)),\n status: STATUS.OK,\n }));\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private transformItemInput(itemInput: DaffCartItemInput) {\n return {\n ...this.cartItemFactory.create(),\n ...itemInput,\n product_id: itemInput.productId,\n };\n }\n\n private listItems(reqInfo): DaffCartItem[] {\n return this.getCart(reqInfo).items;\n }\n\n private getItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCartItem {\n const cart = this.getCart(reqInfo);\n\n return cart.items.find(({ id }) => itemId === id);\n }\n\n private updateItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCart {\n const cart = this.getCart(reqInfo);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n const itemChanges = reqInfo.utils.getJsonBody(reqInfo.req);\n const itemIndex = cart.items.findIndex((item) => itemId === item.id);\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.map(\n (item, index) => index === itemIndex ? {\n ...cart.items[itemIndex],\n ...itemChanges,\n } : item,\n ),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n\n return reqInfo.collection[cartIndex];\n }\n\n private addItem(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);\n const existingCartItemIndex = cart.items.findIndex(item => item.product_id === itemInput.productId);\n if(existingCartItemIndex > -1) {\n const updatedCartItem = {\n ...cart.items[existingCartItemIndex],\n qty: cart.items[existingCartItemIndex].qty + itemInput.qty,\n };\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.map(\n (item, index) => index === existingCartItemIndex ? updatedCartItem : item,\n ),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n } else {\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: [\n ...cart.items,\n this.transformItemInput(itemInput),\n ],\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n return reqInfo.collection[cartIndex];\n }\n\n private deleteItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCart {\n const cart = this.getCart(reqInfo);\n const itemIndex = cart.items.findIndex(({ id }) => itemId === id);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.filter((item, index) => index !== itemIndex),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n\n return reqInfo.collection[cartIndex];\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCartOrderResult } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartOrderService implements DaffInMemoryDataServiceInterface {\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.placeOrder(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private placeOrder(reqInfo): DaffCartOrderResult {\n return {\n id: '8235422034',\n cartId: '89fdsa8sadf',\n orderId: '8235422034',\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartPaymentMethodsService implements DaffInMemoryDataServiceInterface {\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listPaymentMethods(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listPaymentMethods(reqInfo): DaffCartPaymentMethod[] {\n return this.getCart(reqInfo).available_payment_methods;\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartPaymentService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getPayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updatePayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.removePayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getPayment(reqInfo): DaffCartPaymentMethod {\n return this.getCart(reqInfo).payment;\n }\n\n private updatePayment(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const { payment, address } = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.payment = payment;\n\n if (address) {\n cart.billing_address = address;\n }\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removePayment(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.payment = null;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getShippingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateShippingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getShippingAddress(reqInfo): DaffCartAddress {\n return this.getCart(reqInfo).shipping_address;\n }\n\n private updateShippingAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.shipping_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartShippingInformation,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingInformationService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.removeShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getShippingInformation(reqInfo): DaffCartShippingInformation {\n return this.getCart(reqInfo).shipping_information;\n }\n\n private updateShippingInformation(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const shippingInformation = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.shipping_information = shippingInformation;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeShippingInformation(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.shipping_information = null;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingRateFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingMethodsService implements DaffInMemoryDataServiceInterface {\n constructor(\n private shippingMethodFactory: DaffCartShippingRateFactory,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listShippingMethods(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listShippingMethods(reqInfo): DaffCartShippingRate[] {\n const cart = this.getCart(reqInfo);\n\n if (cart.shipping_address) {\n if (cart.available_shipping_methods?.length === 0) {\n cart.available_shipping_methods = this.shippingMethodFactory.createMany(3);\n }\n } else {\n cart.available_shipping_methods = [];\n }\n\n return cart.available_shipping_methods;\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffCartFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartService implements DaffInMemoryDataServiceInterface {\n constructor(\n private cartFactory: DaffCartFactory,\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n const cart = this.getCart(reqInfo);\n return reqInfo.utils.createResponse$(() => ({\n body: cart ? {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n } : cart,\n status: cart ? STATUS.OK : STATUS.NOT_FOUND,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (reqInfo.id === 'addToCart') {\n // deprecated\n body = {};\n } else if (action === 'clear') {\n body = this.clear(reqInfo);\n } else {\n body = this.create(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private clear(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.items = [];\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private create(reqInfo: RequestInfo): Partial<{id: DaffCart['id']}> {\n const cart = this.cartFactory.create();\n\n reqInfo.collection.push(cart);\n\n return {\n id: cart.id,\n };\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport { DaffInMemoryBackendCartAddressService } from './cart-address/cart-address.service';\nimport { DaffInMemoryBackendCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffInMemoryBackendCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffInMemoryBackendCartItemsService } from './cart-items/cart-items.service';\nimport { DaffInMemoryBackendCartOrderService } from './cart-order/cart-order.service';\nimport { DaffInMemoryBackendCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffInMemoryBackendCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffInMemoryBackendCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffInMemoryBackendCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffInMemoryBackendCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffInMemoryBackendCartService } from './cart/cart.service';\n\n/**\n * The root cart in-memory backend.\n * Creates the database and delegates requests to child backends.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartRootService implements InMemoryDbService, DaffInMemoryDataServiceInterface {\n /**\n * The collections that the root service manages.\n * Useful for a higher-level backend that delegates to this one based on collection name.\n */\n public static readonly COLLECTION_NAMES = [\n 'cart',\n 'cart-items',\n 'cart-order',\n 'cart-coupon',\n 'cart-address',\n 'cart-shipping-address',\n 'cart-billing-address',\n 'cart-payment-methods',\n 'cart-shipping-methods',\n 'cart-payment',\n 'cart-shipping-information',\n ];\n\n /**\n * The collection of carts in the backend.\n */\n public carts: DaffCart[] = [];\n\n constructor(\n private cartService: DaffInMemoryBackendCartService,\n private cartItemsService: DaffInMemoryBackendCartItemsService,\n private cartOrderService: DaffInMemoryBackendCartOrderService,\n private cartCouponService: DaffInMemoryBackendCartCouponService,\n private cartAddressService: DaffInMemoryBackendCartAddressService,\n private cartShippingAddressService: DaffInMemoryBackendCartShippingAddressService,\n private cartBillingAddressService: DaffInMemoryBackendCartBillingAddressService,\n private cartPaymentMethodsService: DaffInMemoryBackendCartPaymentMethodsService,\n private cartShippingMethodsService: DaffInMemoryBackendCartShippingMethodsService,\n private cartPaymentService: DaffInMemoryBackendCartPaymentService,\n private cartShippingInformationService: DaffInMemoryBackendCartShippingInformationService,\n ) {}\n\n createDb(reqInfo: RequestInfo) {\n if (reqInfo) {\n const seedData = reqInfo.utils.getJsonBody(reqInfo.req).carts;\n if (seedData) {\n this.carts = seedData;\n }\n }\n\n return {\n cart: this.carts,\n };\n }\n\n get(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n post(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n put(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n delete(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n private delegateRequest(reqInfo: RequestInfo) {\n reqInfo.collection = this.carts;\n\n switch (reqInfo.collectionName) {\n case 'cart':\n return this.cartService[reqInfo.method](reqInfo);\n\n case 'cart-items':\n return this.cartItemsService[reqInfo.method](reqInfo);\n\n case 'cart-order':\n return this.cartOrderService[reqInfo.method](reqInfo);\n\n case 'cart-coupon':\n return this.cartCouponService[reqInfo.method](reqInfo);\n\n case 'cart-address':\n return this.cartAddressService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-address':\n return this.cartShippingAddressService[reqInfo.method](reqInfo);\n\n case 'cart-billing-address':\n return this.cartBillingAddressService[reqInfo.method](reqInfo);\n\n case 'cart-payment-methods':\n return this.cartPaymentMethodsService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-methods':\n return this.cartShippingMethodsService[reqInfo.method](reqInfo);\n\n case 'cart-payment':\n return this.cartPaymentService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-information':\n return this.cartShippingInformationService[reqInfo.method](reqInfo);\n\n default:\n return reqInfo.utils.createResponse$(() => ({\n body: {},\n status: STATUS.OK,\n }));\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../../../libs/cart/driver/in-memory/src/drivers/cart/cart.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-item/cart-item.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-order/cart-order.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-coupon/cart-coupon.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-address/cart-address.service.ts","../../../libs/cart/driver/in-memory/src/drivers/cart-driver.module.ts","../../../libs/cart/driver/in-memory/src/injection-tokens/extra-attributes-hook.token.ts","../../../libs/cart/driver/in-memory/src/backend/cart-address/cart-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-billing-address/cart-billing-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-coupon/cart-coupon.service.ts","../../../node_modules/tslib/tslib.es6.js","../../../libs/cart/driver/in-memory/src/backend/cart-items/cart-items.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-order/cart-order.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-payment-methods/cart-payment-methods.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-payment/cart-payment.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-address/cart-shipping-address.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-information/cart-shipping-information.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-shipping-methods/cart-shipping-methods.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart/cart.service.ts","../../../libs/cart/driver/in-memory/src/backend/cart-root.service.ts"],"names":["DaffInMemoryCartService","http","this","url","prototype","get","cartId","pipe","catchError","error","throwError","DaffCartNotFoundError","message","map","result","response","errors","addToCart","productId","qty","post","clear","create","Injectable","args","providedIn","HttpClient","DaffInMemoryCartItemService","list","itemId","add","input","update","item","put","delete","DaffInMemoryCartBillingAddressService","address","DaffInMemoryCartPaymentService","payment","updateWithBilling","remove","DaffInMemoryCartPaymentMethodsService","DaffInMemoryCartShippingAddressService","DaffInMemoryCartShippingInformationService","info","DaffInMemoryCartShippingMethodsService","DaffInMemoryCartOrderService","placeOrder","DaffInMemoryCartCouponService","apply","coupon","code","removeAll","DaffInMemoryCartAddressService","DaffCartInMemoryDriverModule","forRoot","ngModule","providers","provide","DaffCartDriver","useExisting","DaffCartAddressDriver","DaffCartBillingAddressDriver","DaffCartItemDriver","DaffCartPaymentDriver","DaffCartPaymentMethodsDriver","DaffCartShippingAddressDriver","DaffCartShippingInformationDriver","DaffCartShippingMethodsDriver","DaffCartOrderDriver","DaffCartCouponDriver","NgModule","imports","CommonModule","DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK","InjectionToken","factory","reqInfo","cart","DaffInMemoryBackendCartAddressService","extraFieldsHook","_this","utils","createResponse$","body","updateAddress","status","STATUS","OK","getCart","findById","collection","id","getJsonBody","req","billing_address","shipping_address","Object","assign","extra_attributes","Inject","DaffInMemoryBackendCartBillingAddressService","getBillingAddress","updateBillingAddress","DaffInMemoryBackendCartCouponService","listCoupons","applyCoupon","action","getAction","removeCoupon","removeAllCoupons","replace","resourceUrl","coupons","push","couponCode","filter","_a","__read","o","n","m","Symbol","iterator","r","e","i","call","ar","next","done","value","__spread","arguments","length","concat","DaffInMemoryBackendCartItemsService","cartItemFactory","getItem","listItems","updateItem","addItem","deleteItem","transformItemInput","itemInput","product_id","items","find","cartIndex","findIndex","c","itemChanges","itemIndex","index","existingCartItemIndex","updatedCartItem_1","DaffCartItemFactory","DaffInMemoryBackendCartOrderService","orderId","DaffInMemoryBackendCartPaymentMethodsService","listPaymentMethods","available_payment_methods","DaffInMemoryBackendCartPaymentService","getPayment","updatePayment","removePayment","DaffInMemoryBackendCartShippingAddressService","getShippingAddress","updateShippingAddress","DaffInMemoryBackendCartShippingInformationService","getShippingInformation","updateShippingInformation","removeShippingInformation","shipping_information","shippingInformation","DaffInMemoryBackendCartShippingMethodsService","shippingMethodFactory","listShippingMethods","available_shipping_methods","createMany","DaffCartShippingRateFactory","DaffInMemoryBackendCartService","cartFactory","NOT_FOUND","DaffCartFactory","DaffInMemoryBackendCartRootService","cartService","cartItemsService","cartOrderService","cartCouponService","cartAddressService","cartShippingAddressService","cartBillingAddressService","cartPaymentMethodsService","cartShippingMethodsService","cartPaymentService","cartShippingInformationService","carts","createDb","seedData","delegateRequest","collectionName","method","COLLECTION_NAMES"],"mappings":"w8BA8BE,SAAAA,EAAoBC,GAAAC,KAAAD,KAAAA,EAFXC,KAAAC,IAAM,mBAIfH,EAAAI,UAAAC,IAAA,SAAIC,GACF,OAAOJ,KAAKD,KAAKI,IAAiBH,KAAKC,IAAG,IAAIG,GAAUC,KACtDC,EAAAA,YAAW,SAACC,GAAiB,OAAAC,EAAAA,WAAW,IAAIC,EAAAA,sBAAsBF,EAAMG,aACxEC,EAAAA,KAAI,SAAAC,GAAU,MAAA,CACZC,SAAUD,EACVE,OAAQ,SAKdhB,EAAAI,UAAAa,UAAA,SAAUC,EAAmBC,GAC3B,OAAOjB,KAAKD,KAAKmB,KAAelB,KAAKC,IAAM,aAAc,CAAEe,UAASA,EAAEC,IAAGA,KAG3EnB,EAAAI,UAAAiB,MAAA,SAAMf,GACJ,OAAOJ,KAAKD,KAAKmB,KAA2BlB,KAAKC,IAAG,IAAIG,EAAM,SAAU,KAG1EN,EAAAI,UAAAkB,OAAA,WACE,OAAOpB,KAAKD,KAAKmB,KAA2BlB,KAAKC,IAAK,mJA9BzDoB,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAtBLC,EAAAA,+BC2BP,SAAAC,EAAoB1B,GAAAC,KAAAD,KAAAA,EAFXC,KAAAC,IAAM,yBAIfwB,EAAAvB,UAAAwB,KAAA,SAAKtB,GACH,OAAOJ,KAAKD,KAAKI,IAAuBH,KAAKC,IAAG,IAAIG,EAAM,MAG5DqB,EAAAvB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D,IAAK,wBACH,OAAO5E,KAAK8L,2BAA2BlH,EAAQ6H,QAAQ7H,GAEzD,IAAK,uBACH,OAAO5E,KAAK+L,0BAA0BnH,EAAQ6H,QAAQ7H,GAExD,IAAK,uBACH,OAAO5E,KAAKgM,0BAA0BpH,EAAQ6H,QAAQ7H,GAExD,IAAK,wBACH,OAAO5E,KAAKiM,2BAA2BrH,EAAQ6H,QAAQ7H,GAEzD,IAAK,eACH,OAAO5E,KAAKkM,mBAAmBtH,EAAQ6H,QAAQ7H,GAEjD,IAAK,4BACH,OAAO5E,KAAKmM,+BAA+BvH,EAAQ6H,QAAQ7H,GAE7D,QACE,OAAOA,EAAQK,MAAMC,iBAAgB,WAAM,MAAA,CACzCC,KAAM,GACNE,OAAQC,EAAAA,OAAOC,cAtGAiG,EAAAkB,iBAAmB,CACxC,OACA,aACA,aACA,cACA,eACA,wBACA,uBACA,uBACA,wBACA,eACA,uSAnBHrL,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,oDAPL6J,SAPA7C,SACAqB,SAFArD,SAFAzB,SAOAuF,SANAjE,SAIA0D,SAIAgB,SAHAb,SAEAO","sourcesContent":["import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport {\n Observable,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n map,\n} from 'rxjs/operators';\n\nimport { DaffCart } from '@daffodil/cart';\nimport {\n DaffCartServiceInterface,\n DaffCartNotFoundError,\n} from '@daffodil/cart/driver';\nimport { DaffDriverResponse } from '@daffodil/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartService implements DaffCartServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffDriverResponse<DaffCart>> {\n return this.http.get<DaffCart>(`${this.url}/${cartId}`).pipe(\n catchError((error: Error) => throwError(new DaffCartNotFoundError(error.message))),\n map(result => ({\n response: result,\n errors: [],\n })),\n );\n }\n\n addToCart(productId: string, qty: number): Observable<DaffCart> {\n return this.http.post<DaffCart>(this.url + '/addToCart', { productId, qty });\n }\n\n clear(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/clear`, {});\n }\n\n create(): Observable<{id: DaffCart['id']}> {\n return this.http.post<{id: DaffCart['id']}>(this.url, {});\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartItem,\n DaffCartItemInput,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartItemServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartItemService implements DaffCartItemServiceInterface<\n DaffCartItem,\n DaffCartItemInput,\n DaffCart\n> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-items';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartItem[]> {\n return this.http.get<DaffCartItem[]>(`${this.url}/${cartId}/`);\n }\n\n get(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<DaffCartItem> {\n return this.http.get<DaffCartItem>(`${this.url}/${cartId}/${itemId}`);\n }\n\n add(cartId: DaffCart['id'], input: DaffCartItemInput): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/`, input);\n }\n\n update(\n cartId: DaffCart['id'],\n itemId: DaffCartItem['id'],\n item: Partial<DaffCartItem>,\n ): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}/${itemId}`, item);\n }\n\n delete(cartId: DaffCart['id'], itemId: DaffCartItem['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/${itemId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartBillingAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartBillingAddressService implements DaffCartBillingAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-billing-address';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return this.http.get<DaffCartAddress>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartPaymentServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartPaymentService implements DaffCartPaymentServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-payment';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod> {\n return this.http.get<DaffCartPaymentMethod>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], payment: Partial<DaffCartPaymentMethod>): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, { payment });\n }\n\n updateWithBilling(\n cartId: DaffCart['id'],\n payment: Partial<DaffCartPaymentMethod>,\n address: Partial<DaffCartAddress>,\n ): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, { payment, address });\n }\n\n remove(cartId: DaffCart['id']): Observable<void> {\n return this.http.delete<void>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartPaymentMethod,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartPaymentMethodsServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartPaymentMethodsService implements DaffCartPaymentMethodsServiceInterface<DaffCartPaymentMethod> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-payment-methods';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartPaymentMethod[]> {\n return this.http.get<DaffCartPaymentMethod[]>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartAddress,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingAddressService implements DaffCartShippingAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-address';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartAddress> {\n return this.http.get<DaffCartAddress>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], address: Partial<DaffCartAddress>): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingInformationServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingInformationService implements DaffCartShippingInformationServiceInterface<\n DaffCartShippingRate,\n DaffCart\n> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-information';\n\n constructor(private http: HttpClient) {}\n\n get(cartId: DaffCart['id']): Observable<DaffCartShippingRate> {\n return this.http.get<DaffCartShippingRate>(`${this.url}/${cartId}`);\n }\n\n update(cartId: DaffCart['id'], info: Partial<DaffCartShippingRate>): Observable<Partial<DaffCart>> {\n return this.http.put<DaffCart>(`${this.url}/${cartId}`, info);\n }\n\n delete(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCartShippingRate,\n DaffCart,\n} from '@daffodil/cart';\nimport { DaffCartShippingMethodsServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartShippingMethodsService implements DaffCartShippingMethodsServiceInterface<DaffCartShippingRate> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-shipping-methods';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartShippingRate[]> {\n return this.http.get<DaffCartShippingRate[]>(`${this.url}/${cartId}`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n DaffCartOrderResult,\n} from '@daffodil/cart';\nimport { DaffCartOrderServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartOrderService implements DaffCartOrderServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-order';\n\n constructor(private http: HttpClient) {}\n\n placeOrder(cartId: DaffCart['id'], payment?: DaffCartPaymentMethod): Observable<DaffCartOrderResult> {\n return this.http.post<DaffCartOrderResult>(`${this.url}/${cartId}/`, { payment });\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffCartCouponServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartCouponService implements DaffCartCouponServiceInterface {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-coupon';\n\n constructor(private http: HttpClient) {}\n\n list(cartId: DaffCart['id']): Observable<DaffCartCoupon[]> {\n return this.http.get<DaffCartCoupon[]>(`${this.url}/${cartId}/`);\n }\n\n apply(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return this.http.post<Partial<DaffCart>>(`${this.url}/${cartId}/`, coupon);\n }\n\n remove(cartId: DaffCart['id'], coupon: DaffCartCoupon): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/${coupon.code}`);\n }\n\n removeAll(cartId: DaffCart['id']): Observable<Partial<DaffCart>> {\n return this.http.delete<Partial<DaffCart>>(`${this.url}/${cartId}/`);\n }\n}\n","import { HttpClient } from '@angular/common/http';\nimport { Injectable } from '@angular/core';\nimport { Observable } from 'rxjs';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffCartAddressServiceInterface } from '@daffodil/cart/driver';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryCartAddressService implements DaffCartAddressServiceInterface<DaffCartAddress, DaffCart> {\n /**\n * The URL with which the driver makes calls to the backend.\n */\n readonly url = '/api/cart-address';\n\n constructor(private http: HttpClient) {}\n\n update(cartId: DaffCart['id'], address: DaffCartAddress): Observable<Partial<DaffCart>> {\n return this.http.put<Partial<DaffCart>>(`${this.url}/${cartId}`, address);\n }\n}\n","import { CommonModule } from '@angular/common';\nimport {\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\n\nimport {\n DaffCartDriver,\n DaffCartBillingAddressDriver,\n DaffCartItemDriver,\n DaffCartPaymentDriver,\n DaffCartPaymentMethodsDriver,\n DaffCartShippingAddressDriver,\n DaffCartShippingInformationDriver,\n DaffCartShippingMethodsDriver,\n DaffCartOrderDriver,\n DaffCartCouponDriver,\n DaffCartAddressDriver,\n} from '@daffodil/cart/driver';\n\nimport { DaffInMemoryCartAddressService } from './cart-address/cart-address.service';\nimport { DaffInMemoryCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffInMemoryCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffInMemoryCartItemService } from './cart-item/cart-item.service';\nimport { DaffInMemoryCartOrderService } from './cart-order/cart-order.service';\nimport { DaffInMemoryCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffInMemoryCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffInMemoryCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffInMemoryCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffInMemoryCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffInMemoryCartService } from './cart/cart.service';\n\n@NgModule({\n imports: [\n CommonModule,\n ],\n})\nexport class DaffCartInMemoryDriverModule {\n static forRoot(): ModuleWithProviders<DaffCartInMemoryDriverModule> {\n return {\n ngModule: DaffCartInMemoryDriverModule,\n providers: [\n {\n provide: DaffCartDriver,\n useExisting: DaffInMemoryCartService,\n },\n {\n provide: DaffCartAddressDriver,\n useExisting: DaffInMemoryCartAddressService,\n },\n {\n provide: DaffCartBillingAddressDriver,\n useExisting: DaffInMemoryCartBillingAddressService,\n },\n {\n provide: DaffCartItemDriver,\n useExisting: DaffInMemoryCartItemService,\n },\n {\n provide: DaffCartPaymentDriver,\n useExisting: DaffInMemoryCartPaymentService,\n },\n {\n provide: DaffCartPaymentMethodsDriver,\n useExisting: DaffInMemoryCartPaymentMethodsService,\n },\n {\n provide: DaffCartShippingAddressDriver,\n useExisting: DaffInMemoryCartShippingAddressService,\n },\n {\n provide: DaffCartShippingInformationDriver,\n useExisting: DaffInMemoryCartShippingInformationService,\n },\n {\n provide: DaffCartShippingMethodsDriver,\n useExisting: DaffInMemoryCartShippingMethodsService,\n },\n {\n provide: DaffCartOrderDriver,\n useExisting: DaffInMemoryCartOrderService,\n },\n {\n provide: DaffCartCouponDriver,\n useExisting: DaffInMemoryCartCouponService,\n },\n ],\n };\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { RequestInfo } from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\n\nexport type DaffCartInMemoryExtraAttributesHook = (reqInfo: RequestInfo, cart: DaffCart) => Record<string, any>;\n\n/**\n * Allows an app dev to generate extra fields in the in-memory backend.\n * This enables the in-memory drivers to return responses similar to what the\n * frontend would expect from the production platform.\n *\n * The value returned by the hook function will be set to the returned cart's `extra_attributes` field\n * for driver calls that return a cart.\n *\n * The following example demonstrates adding the `numberOfCartItems` field to `extra_attributes`:\n * ```ts\n * (reqInfo: RequestInfo, cart: DaffCart) => ({\n * numberOfCartItems: cart.items.length\n * })\n * ```\n *\n * Note that this and any `extra_attributes` features are for advanced users\n * and should be used with care.\n */\nexport const DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK =\n new InjectionToken<DaffCartInMemoryExtraAttributesHook>('DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK', {\n factory: () => (reqInfo, cart) => ({}),\n });\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private updateAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.billing_address = address;\n cart.shipping_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartBillingAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getBillingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateBillingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getBillingAddress(reqInfo): DaffCartAddress {\n return this.getCart(reqInfo).billing_address;\n }\n\n private updateBillingAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.billing_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartCoupon,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartCouponService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listCoupons(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.applyCoupon(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (action) {\n body = this.removeCoupon(reqInfo, action);\n } else {\n body = this.removeAllCoupons(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listCoupons(reqInfo): DaffCartCoupon[] {\n return this.getCart(reqInfo).coupons;\n }\n\n private applyCoupon(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const coupon = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.coupons.push(coupon);\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeCoupon(reqInfo: RequestInfo, couponCode: DaffCartCoupon['code']): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.coupons = cart.coupons.filter(({ code }) => code !== couponCode);\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeAllCoupons(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.coupons = [];\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\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 Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartItem,\n DaffCartItemInput,\n} from '@daffodil/cart';\nimport { DaffCartItemFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartItemsService implements DaffInMemoryDataServiceInterface {\n constructor(\n private cartItemFactory: DaffCartItemFactory,\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (action) {\n body = this.getItem(reqInfo, action);\n } else {\n body = this.listItems(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateItem(reqInfo, this.getAction(reqInfo)),\n status: STATUS.OK,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.addItem(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.deleteItem(reqInfo, this.getAction(reqInfo)),\n status: STATUS.OK,\n }));\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private transformItemInput(itemInput: DaffCartItemInput) {\n return {\n ...this.cartItemFactory.create(),\n ...itemInput,\n product_id: itemInput.productId,\n };\n }\n\n private listItems(reqInfo): DaffCartItem[] {\n return this.getCart(reqInfo).items;\n }\n\n private getItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCartItem {\n const cart = this.getCart(reqInfo);\n\n return cart.items.find(({ id }) => itemId === id);\n }\n\n private updateItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCart {\n const cart = this.getCart(reqInfo);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n const itemChanges = reqInfo.utils.getJsonBody(reqInfo.req);\n const itemIndex = cart.items.findIndex((item) => itemId === item.id);\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.map(\n (item, index) => index === itemIndex ? {\n ...cart.items[itemIndex],\n ...itemChanges,\n } : item,\n ),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n\n return reqInfo.collection[cartIndex];\n }\n\n private addItem(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n const itemInput = reqInfo.utils.getJsonBody(reqInfo.req);\n const existingCartItemIndex = cart.items.findIndex(item => item.product_id === itemInput.productId);\n if(existingCartItemIndex > -1) {\n const updatedCartItem = {\n ...cart.items[existingCartItemIndex],\n qty: cart.items[existingCartItemIndex].qty + itemInput.qty,\n };\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.map(\n (item, index) => index === existingCartItemIndex ? updatedCartItem : item,\n ),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n } else {\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: [\n ...cart.items,\n this.transformItemInput(itemInput),\n ],\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n return reqInfo.collection[cartIndex];\n }\n\n private deleteItem(reqInfo: RequestInfo, itemId: DaffCartItem['id']): DaffCart {\n const cart = this.getCart(reqInfo);\n const itemIndex = cart.items.findIndex(({ id }) => itemId === id);\n const cartIndex = reqInfo.collection.findIndex(c => c.id === reqInfo.id);\n reqInfo.collection[cartIndex] = {\n ...cart,\n items: cart.items.filter((item, index) => index !== itemIndex),\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n\n return reqInfo.collection[cartIndex];\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCartOrderResult } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartOrderService implements DaffInMemoryDataServiceInterface {\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.placeOrder(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private placeOrder(reqInfo): DaffCartOrderResult {\n return {\n id: '8235422034',\n cartId: '89fdsa8sadf',\n orderId: '8235422034',\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartPaymentMethodsService implements DaffInMemoryDataServiceInterface {\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listPaymentMethods(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listPaymentMethods(reqInfo): DaffCartPaymentMethod[] {\n return this.getCart(reqInfo).available_payment_methods;\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartPaymentMethod,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartPaymentService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getPayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updatePayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.removePayment(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getPayment(reqInfo): DaffCartPaymentMethod {\n return this.getCart(reqInfo).payment;\n }\n\n private updatePayment(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const { payment, address } = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.payment = payment;\n\n if (address) {\n cart.billing_address = address;\n }\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removePayment(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.payment = null;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartAddress,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingAddressService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getShippingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateShippingAddress(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getShippingAddress(reqInfo): DaffCartAddress {\n return this.getCart(reqInfo).shipping_address;\n }\n\n private updateShippingAddress(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const address = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.shipping_address = address;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartShippingInformation,\n} from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingInformationService implements DaffInMemoryDataServiceInterface {\n constructor(\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.getShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n put(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.updateShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n delete(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.removeShippingInformation(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private getShippingInformation(reqInfo): DaffCartShippingInformation {\n return this.getCart(reqInfo).shipping_information;\n }\n\n private updateShippingInformation(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n const shippingInformation = reqInfo.utils.getJsonBody(reqInfo.req);\n\n cart.shipping_information = shippingInformation;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private removeShippingInformation(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.shipping_information = null;\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport {\n DaffCart,\n DaffCartShippingRate,\n} from '@daffodil/cart';\nimport { DaffCartShippingRateFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartShippingMethodsService implements DaffInMemoryDataServiceInterface {\n constructor(\n private shippingMethodFactory: DaffCartShippingRateFactory,\n ) {}\n\n get(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => ({\n body: this.listShippingMethods(reqInfo),\n status: STATUS.OK,\n }));\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n\n private listShippingMethods(reqInfo): DaffCartShippingRate[] {\n const cart = this.getCart(reqInfo);\n\n if (cart.shipping_address) {\n if (cart.available_shipping_methods?.length === 0) {\n cart.available_shipping_methods = this.shippingMethodFactory.createMany(3);\n }\n } else {\n cart.available_shipping_methods = [];\n }\n\n return cart.available_shipping_methods;\n }\n}\n","import {\n Injectable,\n Inject,\n} from '@angular/core';\nimport {\n STATUS,\n RequestInfo,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffCartFactory } from '@daffodil/cart/testing';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport {\n DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK,\n DaffCartInMemoryExtraAttributesHook,\n} from '../../injection-tokens/public_api';\n\n/**\n * @inheritdoc\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartService implements DaffInMemoryDataServiceInterface {\n constructor(\n private cartFactory: DaffCartFactory,\n @Inject(DAFF_CART_IN_MEMORY_EXTRA_ATTRIBUTES_HOOK) private extraFieldsHook: DaffCartInMemoryExtraAttributesHook,\n ) {}\n\n get(reqInfo: RequestInfo) {\n const cart = this.getCart(reqInfo);\n return reqInfo.utils.createResponse$(() => ({\n body: cart ? {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n } : cart,\n status: cart ? STATUS.OK : STATUS.NOT_FOUND,\n }));\n }\n\n post(reqInfo: RequestInfo) {\n return reqInfo.utils.createResponse$(() => {\n let body;\n const action = this.getAction(reqInfo);\n\n if (reqInfo.id === 'addToCart') {\n // deprecated\n body = {};\n } else if (action === 'clear') {\n body = this.clear(reqInfo);\n } else {\n body = this.create(reqInfo);\n }\n\n return {\n body,\n status: STATUS.OK,\n };\n });\n }\n\n /**\n * Gets whatever follows the cart ID section of the request URL.\n */\n private getAction(reqInfo: RequestInfo): string {\n return reqInfo.url.replace(`/${reqInfo.resourceUrl}${reqInfo.id}/`, '');\n }\n\n private clear(reqInfo: RequestInfo): DaffCart {\n const cart = this.getCart(reqInfo);\n\n cart.items = [];\n\n return {\n ...cart,\n extra_attributes: this.extraFieldsHook(reqInfo, cart),\n };\n }\n\n private create(reqInfo: RequestInfo): Partial<{id: DaffCart['id']}> {\n const cart = this.cartFactory.create();\n\n reqInfo.collection.push(cart);\n\n return {\n id: cart.id,\n };\n }\n\n private getCart(reqInfo: RequestInfo): DaffCart {\n return reqInfo.utils.findById<DaffCart>(reqInfo.collection, reqInfo.id);\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n InMemoryDbService,\n RequestInfo,\n STATUS,\n} from 'angular-in-memory-web-api';\n\nimport { DaffCart } from '@daffodil/cart';\nimport { DaffInMemoryDataServiceInterface } from '@daffodil/core/testing';\n\nimport { DaffInMemoryBackendCartAddressService } from './cart-address/cart-address.service';\nimport { DaffInMemoryBackendCartBillingAddressService } from './cart-billing-address/cart-billing-address.service';\nimport { DaffInMemoryBackendCartCouponService } from './cart-coupon/cart-coupon.service';\nimport { DaffInMemoryBackendCartItemsService } from './cart-items/cart-items.service';\nimport { DaffInMemoryBackendCartOrderService } from './cart-order/cart-order.service';\nimport { DaffInMemoryBackendCartPaymentMethodsService } from './cart-payment-methods/cart-payment-methods.service';\nimport { DaffInMemoryBackendCartPaymentService } from './cart-payment/cart-payment.service';\nimport { DaffInMemoryBackendCartShippingAddressService } from './cart-shipping-address/cart-shipping-address.service';\nimport { DaffInMemoryBackendCartShippingInformationService } from './cart-shipping-information/cart-shipping-information.service';\nimport { DaffInMemoryBackendCartShippingMethodsService } from './cart-shipping-methods/cart-shipping-methods.service';\nimport { DaffInMemoryBackendCartService } from './cart/cart.service';\n\n/**\n * The root cart in-memory backend.\n * Creates the database and delegates requests to child backends.\n */\n@Injectable({\n providedIn: 'root',\n})\nexport class DaffInMemoryBackendCartRootService implements InMemoryDbService, DaffInMemoryDataServiceInterface {\n /**\n * The collections that the root service manages.\n * Useful for a higher-level backend that delegates to this one based on collection name.\n */\n public static readonly COLLECTION_NAMES = [\n 'cart',\n 'cart-items',\n 'cart-order',\n 'cart-coupon',\n 'cart-address',\n 'cart-shipping-address',\n 'cart-billing-address',\n 'cart-payment-methods',\n 'cart-shipping-methods',\n 'cart-payment',\n 'cart-shipping-information',\n ];\n\n /**\n * The collection of carts in the backend.\n */\n public carts: DaffCart[] = [];\n\n constructor(\n private cartService: DaffInMemoryBackendCartService,\n private cartItemsService: DaffInMemoryBackendCartItemsService,\n private cartOrderService: DaffInMemoryBackendCartOrderService,\n private cartCouponService: DaffInMemoryBackendCartCouponService,\n private cartAddressService: DaffInMemoryBackendCartAddressService,\n private cartShippingAddressService: DaffInMemoryBackendCartShippingAddressService,\n private cartBillingAddressService: DaffInMemoryBackendCartBillingAddressService,\n private cartPaymentMethodsService: DaffInMemoryBackendCartPaymentMethodsService,\n private cartShippingMethodsService: DaffInMemoryBackendCartShippingMethodsService,\n private cartPaymentService: DaffInMemoryBackendCartPaymentService,\n private cartShippingInformationService: DaffInMemoryBackendCartShippingInformationService,\n ) {}\n\n createDb(reqInfo: RequestInfo) {\n if (reqInfo) {\n const seedData = reqInfo.utils.getJsonBody(reqInfo.req).carts;\n if (seedData) {\n this.carts = seedData;\n }\n }\n\n return {\n cart: this.carts,\n };\n }\n\n get(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n post(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n put(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n delete(reqInfo: RequestInfo) {\n return this.delegateRequest(reqInfo);\n }\n\n private delegateRequest(reqInfo: RequestInfo) {\n reqInfo.collection = this.carts;\n\n switch (reqInfo.collectionName) {\n case 'cart':\n return this.cartService[reqInfo.method](reqInfo);\n\n case 'cart-items':\n return this.cartItemsService[reqInfo.method](reqInfo);\n\n case 'cart-order':\n return this.cartOrderService[reqInfo.method](reqInfo);\n\n case 'cart-coupon':\n return this.cartCouponService[reqInfo.method](reqInfo);\n\n case 'cart-address':\n return this.cartAddressService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-address':\n return this.cartShippingAddressService[reqInfo.method](reqInfo);\n\n case 'cart-billing-address':\n return this.cartBillingAddressService[reqInfo.method](reqInfo);\n\n case 'cart-payment-methods':\n return this.cartPaymentMethodsService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-methods':\n return this.cartShippingMethodsService[reqInfo.method](reqInfo);\n\n case 'cart-payment':\n return this.cartPaymentService[reqInfo.method](reqInfo);\n\n case 'cart-shipping-information':\n return this.cartShippingInformationService[reqInfo.method](reqInfo);\n\n default:\n return reqInfo.utils.createResponse$(() => ({\n body: {},\n status: STATUS.OK,\n }));\n }\n }\n}\n"]}