@bigcommerce/checkout-sdk 1.182.1 → 1.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=209)}({0:function(t,e){t.exports=require("tslib")},1:function(t,e){t.exports=require("lodash")},100:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(60);function i(t,e){var n=t.firstName||e.firstName||"",i=t.lastName||e.lastName||"";return{addresses:(t.addresses||[]).map((function(t){return Object(r.a)(t)})),customerId:t.id,isGuest:t.isGuest,storeCredit:t.storeCredit,email:t.email||e.email||"",firstName:n,lastName:i,name:t.fullName||[n,i].join(" "),customerGroupName:t.customerGroup&&t.customerGroup.name}}},101:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(1),o=n(66),a=n(83),u=n(113);n(59);function s(t,e){void 0===e&&(e={});var n,r,s=t.currency.decimalPlaces,c=new a.a(s);return{id:t.orderId,items:Object(o.a)(t.lineItems,t.currency.decimalPlaces,"productId"),orderId:t.orderId,currency:t.currency.code,customerCanBeCreated:t.customerCanBeCreated,payment:p(t.payments,e.payment),subtotal:{amount:t.baseAmount,integerAmount:c.toInteger(t.baseAmount)},coupon:{discountedAmount:Object(i.reduce)(t.coupons,(function(t,e){return t+e.discountedAmount}),0),coupons:t.coupons.map(u.a)},discount:{amount:t.discountAmount,integerAmount:c.toInteger(t.discountAmount)},token:e.orderToken,callbackUrl:e.callbackUrl,discountNotifications:[],giftCertificate:(n=t.payments,r=Object(i.filter)(n,{providerId:"giftcertificate"}),{totalDiscountedAmount:Object(i.reduce)(r,(function(t,e){return e.amount+t}),0),appliedGiftCertificates:Object(i.keyBy)(r.map((function(t){return{code:t.detail.code,discountedAmount:t.amount,remainingBalance:t.detail.remaining,giftCertificate:{balance:t.amount+t.detail.remaining,code:t.detail.code,purchaseDate:""}}})),"code")}),socialData:l(t),status:t.status,hasDigitalItems:t.hasDigitalItems,isDownloadable:t.isDownloadable,isComplete:t.isComplete,shipping:{amount:t.shippingCostTotal,integerAmount:c.toInteger(t.shippingCostTotal),amountBeforeDiscount:t.shippingCostBeforeDiscount,integerAmountBeforeDiscount:c.toInteger(t.shippingCostBeforeDiscount)},storeCredit:{amount:d(t.payments)},taxes:t.taxes,taxTotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},handling:{amount:t.handlingCostTotal,integerAmount:c.toInteger(t.handlingCostTotal)},grandTotal:{amount:t.orderAmount,integerAmount:t.orderAmountAsInteger}}}function c(t){return"PAYMENT_STATUS_"+t}function d(t){var e=Object(i.find)(t,{providerId:"storecredit"});return e?e.amount:0}function p(t,e){void 0===e&&(e={});var n=Object(i.find)(t,m);return n?{id:n.providerId,status:c(n.detail.step),helpText:n.detail.instructions,returnUrl:e.returnUrl}:{}}function m(t){return"giftcertificate"!==t.providerId&&"storecredit"!==t.providerId}function l(t){var e={};return Object(r.__spreadArrays)(t.lineItems.physicalItems,t.lineItems.digitalItems).forEach((function(t){var n;e[t.id]=(n=t,["fb","tw","gp"].reduce((function(t,e){var r=n.socialMedia&&Object(i.find)(n.socialMedia,(function(t){return t.code===e}));return r?(t[e]={name:n.name,description:n.name,image:n.imageUrl,url:r.link,shareText:r.text,sharingLink:r.link,channelName:r.channel,channelCode:r.code},t):t}),{}))})),e}},102:function(t,e,n){"use strict";var r=n(1),i=n(83),o=n(113),a=n(149);var u=n(66);function s(t){var e,n,s=t.cart.currency.decimalPlaces,c=new i.a(s);return{id:t.cart.id,items:Object(u.a)(t.cart.lineItems,s),currency:t.cart.currency.code,coupon:{discountedAmount:Object(r.reduce)(t.cart.coupons,(function(t,e){return t+e.discountedAmount}),0),coupons:t.cart.coupons.map(o.a)},discount:{amount:t.cart.discountAmount,integerAmount:c.toInteger(t.cart.discountAmount)},discountNotifications:(e=t.promotions,n=[],(e||[]).forEach((function(t){(t.banners||[]).forEach((function(t){n.push({placeholders:[],discountType:null,message:"",messageHtml:t.text})}))})),n),giftCertificate:{totalDiscountedAmount:Object(r.reduce)(t.giftCertificates,(function(t,e){return t+e.used}),0),appliedGiftCertificates:Object(r.keyBy)(t.giftCertificates.map(a.a),"code")},shipping:{amount:t.shippingCostTotal,integerAmount:c.toInteger(t.shippingCostTotal),amountBeforeDiscount:t.shippingCostBeforeDiscount,integerAmountBeforeDiscount:c.toInteger(t.shippingCostBeforeDiscount),required:Object(r.some)(t.cart.lineItems.physicalItems,(function(t){return t.isShippingRequired}))},subtotal:{amount:t.subtotal,integerAmount:c.toInteger(t.subtotal)},storeCredit:{amount:t.customer?t.customer.storeCredit:0},taxSubtotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},taxes:t.taxes,taxTotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},handling:{amount:t.handlingCostTotal,integerAmount:c.toInteger(t.handlingCostTotal)},grandTotal:{amount:t.grandTotal,integerAmount:c.toInteger(t.grandTotal)}}}n.d(e,"a",(function(){return s}))},110:function(t,e,n){"use strict";function r(t){return void 0!==t.id}n.d(e,"a",(function(){return r}))},113:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=["per_item_discount","percentage_discount","per_total_discount","shipping_discount","free_shipping"];function i(t){return{code:t.code,discount:t.displayName,discountType:r.indexOf(t.couponType)}}},149:function(t,e,n){"use strict";function r(t){return{code:t.code,discountedAmount:t.used,remainingBalance:t.remaining,giftCertificate:{balance:t.balance,code:t.code,purchaseDate:t.purchaseDate}}}n.d(e,"a",(function(){return r}))},155:function(t,e,n){"use strict";var r=n(0),i=n(1),o=n(69),a=n.n(o);function u(t){return t.hasOwnProperty("cacheKey")}var s=function(){function t(t){this._lastId=0,this._map={maps:[]},this._usedMaps=[],this._options=Object(r.__assign)({maxSize:0,isEqual:a.a,onExpire:i.noop},t)}return t.prototype.getKey=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._resolveMap.apply(this,t),r=n.index,i=n.parentMap,o=n.map;return o&&o.cacheKey?o.usedCount++:o=this._generateMap(i,t.slice(r)),this._removeLeastUsedMap(o),o.cacheKey},t.prototype.getUsedCount=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._resolveMap.apply(this,t).map;return n?n.usedCount:0},t.prototype._resolveMap=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r=0,i=this._map;i.maps.length;){for(var o=!1,a=0;a<i.maps.length;a++){var s=i.maps[a];if(this._options.isEqual(s.value,e[r])){if((t=i.maps).unshift.apply(t,i.maps.splice(a,1)),(0===e.length||r===e.length-1)&&u(s))return{index:r,map:s,parentMap:i};o=!0,i=s,r++;break}}if(!o)break}return{index:r,parentMap:i}},t.prototype._generateMap=function(t,e){var n,r=0,i=t;do{n={maps:[],parentMap:i,usedCount:1,value:e[r]},i.maps.unshift(n),i=n,r++}while(r<e.length);var o=n;return o.cacheKey=""+ ++this._lastId,o},t.prototype._removeLeastUsedMap=function(t){if(this._options.maxSize){var e=this._usedMaps.indexOf(t);if(this._usedMaps.splice(-1===e?0:e,-1===e?0:1,t),!(this._usedMaps.length<=this._options.maxSize)){var n=this._usedMaps.pop();n&&(this._removeMap(n),this._options.onExpire(n.cacheKey))}}},t.prototype._removeMap=function(t){t.parentMap&&(t.parentMap.maps.splice(t.parentMap.maps.indexOf(t),1),function(t){return t.hasOwnProperty("parentMap")}(t.parentMap)||this._removeMap(t.parentMap))},t}();e.a=s},209:function(t,e,n){"use strict";n.r(e);var r=n(60),i=n(102),o=n(113),a=n(149),u=n(100),s=n(80),c=n(66),d=n(101);function p(t,e){var n=t.consignments&&t.consignments[0];return{orderComment:t.customerMessage,shippingOption:n&&n.selectedShippingOption?n.selectedShippingOption.id:void 0,billingAddress:t.billingAddress?Object(r.a)(t.billingAddress):{},shippingAddress:e&&Object(r.a)(e,t.consignments)}}var m=n(82),l=n(0);function f(t){return t.reduce((function(t,e){var n,r;return e.availableShippingOptions&&e.availableShippingOptions.length?r=e.availableShippingOptions:e.selectedShippingOption&&(r=[e.selectedShippingOption]),Object(l.__assign)(Object(l.__assign)({},t),((n={})[e.id]=(r||[]).map((function(t){var n=e.selectedShippingOption&&e.selectedShippingOption.id;return Object(m.a)(t,t.id===n)})),n))}),{})}var g=n(155);n.d(e,"mapToInternalAddress",(function(){return r.a})),n.d(e,"mapToInternalCart",(function(){return i.a})),n.d(e,"mapToInternalCoupon",(function(){return o.a})),n.d(e,"mapToInternalGiftCertificate",(function(){return a.a})),n.d(e,"mapToInternalCustomer",(function(){return u.a})),n.d(e,"mapToInternalLineItem",(function(){return s.a})),n.d(e,"mapToInternalLineItems",(function(){return c.a})),n.d(e,"mapToInternalOrder",(function(){return d.a})),n.d(e,"mapToInternalQuote",(function(){return p})),n.d(e,"mapToInternalShippingOption",(function(){return m.a})),n.d(e,"mapToInternalShippingOptions",(function(){return f})),n.d(e,"CacheKeyResolver",(function(){return g.a}))},59:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i}));var r="PAYMENT_TYPE_HOSTED",i="PAYMENT_TYPE_OFFLINE"},60:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(110);function i(t,e){var n;return Object(r.a)(t)?n=t.id:e&&e.length&&(n=e[0].id),{id:n,firstName:t.firstName,lastName:t.lastName,company:t.company,addressLine1:t.address1,addressLine2:t.address2,city:t.city,province:t.stateOrProvince,provinceCode:t.stateOrProvinceCode,postCode:t.postalCode,country:t.country,countryCode:t.countryCode,phone:t.phone,customFields:t.customFields}}},66:function(t,e,n){"use strict";var r=n(0),i=n(83);var o=n(80);function a(t,e,n){return void 0===n&&(n="id"),Object.keys(t).reduce((function(a,u){return Object(r.__spreadArrays)(a,t[u].map((function(t){return"giftCertificates"===u?function(t,e){var n=new i.a(e);return{id:t.id,imageUrl:"",name:t.name,amount:t.amount,amountAfterDiscount:t.amount,discount:0,integerAmount:n.toInteger(t.amount),integerAmountAfterDiscount:n.toInteger(t.amount),integerUnitPrice:n.toInteger(t.amount),integerUnitPriceAfterDiscount:n.toInteger(t.amount),integerDiscount:0,quantity:1,sender:t.sender,recipient:t.recipient,type:"ItemGiftCertificateEntity",attributes:[],variantId:null}}(t,e):Object(o.a)(t,function(t){switch(t){case"physicalItems":return"ItemPhysicalEntity";case"digitalItems":return"ItemDigitalEntity";case"giftCertificates":return"ItemGiftCertificateEntity";default:return""}}(u),e,n)})))}),[])}n.d(e,"a",(function(){return a}))},69:function(t,e){t.exports=require("shallowequal")},80:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(83);function i(t,e,n,i){void 0===i&&(i="id");var o=new r.a(n);return{id:t[i],imageUrl:t.imageUrl,amount:t.extendedListPrice,amountAfterDiscount:t.extendedSalePrice,discount:t.discountAmount,integerAmount:o.toInteger(t.extendedListPrice),integerAmountAfterDiscount:o.toInteger(t.extendedSalePrice),integerDiscount:o.toInteger(t.discountAmount),integerUnitPrice:o.toInteger(t.listPrice),integerUnitPriceAfterDiscount:o.toInteger(t.salePrice),downloadsPageUrl:t.downloadPageUrl,name:t.name,quantity:t.quantity,brand:t.brand,sku:t.sku,categoryNames:t.categoryNames,variantId:t.variantId,productId:t.productId,attributes:(t.options||[]).map((function(t){return{name:t.name,value:t.value}})),addedByPromotion:t.addedByPromotion,type:e}}},82:function(t,e,n){"use strict";function r(t,e){return{description:t.description,module:t.type,price:t.cost,id:t.id,selected:e,isRecommended:t.isRecommended,imageUrl:t.imageUrl,transitTime:t.transitTime}}n.d(e,"a",(function(){return r}))},83:function(t,e,n){"use strict";var r=function(){function t(t){this._decimalPlaces=t}return t.prototype.toInteger=function(t){return Math.round(t*Math.pow(10,this._decimalPlaces))},t}();e.a=r}});
1
+ module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=210)}({0:function(t,e){t.exports=require("tslib")},1:function(t,e){t.exports=require("lodash")},101:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(61);function i(t,e){var n=t.firstName||e.firstName||"",i=t.lastName||e.lastName||"";return{addresses:(t.addresses||[]).map((function(t){return Object(r.a)(t)})),customerId:t.id,isGuest:t.isGuest,storeCredit:t.storeCredit,email:t.email||e.email||"",firstName:n,lastName:i,name:t.fullName||[n,i].join(" "),customerGroupName:t.customerGroup&&t.customerGroup.name}}},102:function(t,e,n){"use strict";n.d(e,"a",(function(){return s}));var r=n(0),i=n(1),o=n(67),a=n(84),u=n(114);n(60);function s(t,e){void 0===e&&(e={});var n,r,s=t.currency.decimalPlaces,c=new a.a(s);return{id:t.orderId,items:Object(o.a)(t.lineItems,t.currency.decimalPlaces,"productId"),orderId:t.orderId,currency:t.currency.code,customerCanBeCreated:t.customerCanBeCreated,payment:p(t.payments,e.payment),subtotal:{amount:t.baseAmount,integerAmount:c.toInteger(t.baseAmount)},coupon:{discountedAmount:Object(i.reduce)(t.coupons,(function(t,e){return t+e.discountedAmount}),0),coupons:t.coupons.map(u.a)},discount:{amount:t.discountAmount,integerAmount:c.toInteger(t.discountAmount)},token:e.orderToken,callbackUrl:e.callbackUrl,discountNotifications:[],giftCertificate:(n=t.payments,r=Object(i.filter)(n,{providerId:"giftcertificate"}),{totalDiscountedAmount:Object(i.reduce)(r,(function(t,e){return e.amount+t}),0),appliedGiftCertificates:Object(i.keyBy)(r.map((function(t){return{code:t.detail.code,discountedAmount:t.amount,remainingBalance:t.detail.remaining,giftCertificate:{balance:t.amount+t.detail.remaining,code:t.detail.code,purchaseDate:""}}})),"code")}),socialData:l(t),status:t.status,hasDigitalItems:t.hasDigitalItems,isDownloadable:t.isDownloadable,isComplete:t.isComplete,shipping:{amount:t.shippingCostTotal,integerAmount:c.toInteger(t.shippingCostTotal),amountBeforeDiscount:t.shippingCostBeforeDiscount,integerAmountBeforeDiscount:c.toInteger(t.shippingCostBeforeDiscount)},storeCredit:{amount:d(t.payments)},taxes:t.taxes,taxTotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},handling:{amount:t.handlingCostTotal,integerAmount:c.toInteger(t.handlingCostTotal)},grandTotal:{amount:t.orderAmount,integerAmount:t.orderAmountAsInteger}}}function c(t){return"PAYMENT_STATUS_"+t}function d(t){var e=Object(i.find)(t,{providerId:"storecredit"});return e?e.amount:0}function p(t,e){void 0===e&&(e={});var n=Object(i.find)(t,m);return n?{id:n.providerId,status:c(n.detail.step),helpText:n.detail.instructions,returnUrl:e.returnUrl}:{}}function m(t){return"giftcertificate"!==t.providerId&&"storecredit"!==t.providerId}function l(t){var e={};return Object(r.__spreadArrays)(t.lineItems.physicalItems,t.lineItems.digitalItems).forEach((function(t){var n;e[t.id]=(n=t,["fb","tw","gp"].reduce((function(t,e){var r=n.socialMedia&&Object(i.find)(n.socialMedia,(function(t){return t.code===e}));return r?(t[e]={name:n.name,description:n.name,image:n.imageUrl,url:r.link,shareText:r.text,sharingLink:r.link,channelName:r.channel,channelCode:r.code},t):t}),{}))})),e}},103:function(t,e,n){"use strict";var r=n(1),i=n(84),o=n(114),a=n(150);var u=n(67);function s(t){var e,n,s=t.cart.currency.decimalPlaces,c=new i.a(s);return{id:t.cart.id,items:Object(u.a)(t.cart.lineItems,s),currency:t.cart.currency.code,coupon:{discountedAmount:Object(r.reduce)(t.cart.coupons,(function(t,e){return t+e.discountedAmount}),0),coupons:t.cart.coupons.map(o.a)},discount:{amount:t.cart.discountAmount,integerAmount:c.toInteger(t.cart.discountAmount)},discountNotifications:(e=t.promotions,n=[],(e||[]).forEach((function(t){(t.banners||[]).forEach((function(t){n.push({placeholders:[],discountType:null,message:"",messageHtml:t.text})}))})),n),giftCertificate:{totalDiscountedAmount:Object(r.reduce)(t.giftCertificates,(function(t,e){return t+e.used}),0),appliedGiftCertificates:Object(r.keyBy)(t.giftCertificates.map(a.a),"code")},shipping:{amount:t.shippingCostTotal,integerAmount:c.toInteger(t.shippingCostTotal),amountBeforeDiscount:t.shippingCostBeforeDiscount,integerAmountBeforeDiscount:c.toInteger(t.shippingCostBeforeDiscount),required:Object(r.some)(t.cart.lineItems.physicalItems,(function(t){return t.isShippingRequired}))},subtotal:{amount:t.subtotal,integerAmount:c.toInteger(t.subtotal)},storeCredit:{amount:t.customer?t.customer.storeCredit:0},taxSubtotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},taxes:t.taxes,taxTotal:{amount:t.taxTotal,integerAmount:c.toInteger(t.taxTotal)},handling:{amount:t.handlingCostTotal,integerAmount:c.toInteger(t.handlingCostTotal)},grandTotal:{amount:t.grandTotal,integerAmount:c.toInteger(t.grandTotal)}}}n.d(e,"a",(function(){return s}))},111:function(t,e,n){"use strict";function r(t){return void 0!==t.id}n.d(e,"a",(function(){return r}))},114:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=["per_item_discount","percentage_discount","per_total_discount","shipping_discount","free_shipping"];function i(t){return{code:t.code,discount:t.displayName,discountType:r.indexOf(t.couponType)}}},150:function(t,e,n){"use strict";function r(t){return{code:t.code,discountedAmount:t.used,remainingBalance:t.remaining,giftCertificate:{balance:t.balance,code:t.code,purchaseDate:t.purchaseDate}}}n.d(e,"a",(function(){return r}))},156:function(t,e,n){"use strict";var r=n(0),i=n(1),o=n(70),a=n.n(o);function u(t){return t.hasOwnProperty("cacheKey")}var s=function(){function t(t){this._lastId=0,this._map={maps:[]},this._usedMaps=[],this._options=Object(r.__assign)({maxSize:0,isEqual:a.a,onExpire:i.noop},t)}return t.prototype.getKey=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._resolveMap.apply(this,t),r=n.index,i=n.parentMap,o=n.map;return o&&o.cacheKey?o.usedCount++:o=this._generateMap(i,t.slice(r)),this._removeLeastUsedMap(o),o.cacheKey},t.prototype.getUsedCount=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this._resolveMap.apply(this,t).map;return n?n.usedCount:0},t.prototype._resolveMap=function(){for(var t,e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var r=0,i=this._map;i.maps.length;){for(var o=!1,a=0;a<i.maps.length;a++){var s=i.maps[a];if(this._options.isEqual(s.value,e[r])){if((t=i.maps).unshift.apply(t,i.maps.splice(a,1)),(0===e.length||r===e.length-1)&&u(s))return{index:r,map:s,parentMap:i};o=!0,i=s,r++;break}}if(!o)break}return{index:r,parentMap:i}},t.prototype._generateMap=function(t,e){var n,r=0,i=t;do{n={maps:[],parentMap:i,usedCount:1,value:e[r]},i.maps.unshift(n),i=n,r++}while(r<e.length);var o=n;return o.cacheKey=""+ ++this._lastId,o},t.prototype._removeLeastUsedMap=function(t){if(this._options.maxSize){var e=this._usedMaps.indexOf(t);if(this._usedMaps.splice(-1===e?0:e,-1===e?0:1,t),!(this._usedMaps.length<=this._options.maxSize)){var n=this._usedMaps.pop();n&&(this._removeMap(n),this._options.onExpire(n.cacheKey))}}},t.prototype._removeMap=function(t){t.parentMap&&(t.parentMap.maps.splice(t.parentMap.maps.indexOf(t),1),function(t){return t.hasOwnProperty("parentMap")}(t.parentMap)||this._removeMap(t.parentMap))},t}();e.a=s},210:function(t,e,n){"use strict";n.r(e);var r=n(61),i=n(103),o=n(114),a=n(150),u=n(101),s=n(81),c=n(67),d=n(102);function p(t,e){var n=t.consignments&&t.consignments[0];return{orderComment:t.customerMessage,shippingOption:n&&n.selectedShippingOption?n.selectedShippingOption.id:void 0,billingAddress:t.billingAddress?Object(r.a)(t.billingAddress):{},shippingAddress:e&&Object(r.a)(e,t.consignments)}}var m=n(83),l=n(0);function f(t){return t.reduce((function(t,e){var n,r;return e.availableShippingOptions&&e.availableShippingOptions.length?r=e.availableShippingOptions:e.selectedShippingOption&&(r=[e.selectedShippingOption]),Object(l.__assign)(Object(l.__assign)({},t),((n={})[e.id]=(r||[]).map((function(t){var n=e.selectedShippingOption&&e.selectedShippingOption.id;return Object(m.a)(t,t.id===n)})),n))}),{})}var g=n(156);n.d(e,"mapToInternalAddress",(function(){return r.a})),n.d(e,"mapToInternalCart",(function(){return i.a})),n.d(e,"mapToInternalCoupon",(function(){return o.a})),n.d(e,"mapToInternalGiftCertificate",(function(){return a.a})),n.d(e,"mapToInternalCustomer",(function(){return u.a})),n.d(e,"mapToInternalLineItem",(function(){return s.a})),n.d(e,"mapToInternalLineItems",(function(){return c.a})),n.d(e,"mapToInternalOrder",(function(){return d.a})),n.d(e,"mapToInternalQuote",(function(){return p})),n.d(e,"mapToInternalShippingOption",(function(){return m.a})),n.d(e,"mapToInternalShippingOptions",(function(){return f})),n.d(e,"CacheKeyResolver",(function(){return g.a}))},60:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i}));var r="PAYMENT_TYPE_HOSTED",i="PAYMENT_TYPE_OFFLINE"},61:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(111);function i(t,e){var n;return Object(r.a)(t)?n=t.id:e&&e.length&&(n=e[0].id),{id:n,firstName:t.firstName,lastName:t.lastName,company:t.company,addressLine1:t.address1,addressLine2:t.address2,city:t.city,province:t.stateOrProvince,provinceCode:t.stateOrProvinceCode,postCode:t.postalCode,country:t.country,countryCode:t.countryCode,phone:t.phone,customFields:t.customFields}}},67:function(t,e,n){"use strict";var r=n(0),i=n(84);var o=n(81);function a(t,e,n){return void 0===n&&(n="id"),Object.keys(t).reduce((function(a,u){return Object(r.__spreadArrays)(a,t[u].map((function(t){return"giftCertificates"===u?function(t,e){var n=new i.a(e);return{id:t.id,imageUrl:"",name:t.name,amount:t.amount,amountAfterDiscount:t.amount,discount:0,integerAmount:n.toInteger(t.amount),integerAmountAfterDiscount:n.toInteger(t.amount),integerUnitPrice:n.toInteger(t.amount),integerUnitPriceAfterDiscount:n.toInteger(t.amount),integerDiscount:0,quantity:1,sender:t.sender,recipient:t.recipient,type:"ItemGiftCertificateEntity",attributes:[],variantId:null}}(t,e):Object(o.a)(t,function(t){switch(t){case"physicalItems":return"ItemPhysicalEntity";case"digitalItems":return"ItemDigitalEntity";case"giftCertificates":return"ItemGiftCertificateEntity";default:return""}}(u),e,n)})))}),[])}n.d(e,"a",(function(){return a}))},70:function(t,e){t.exports=require("shallowequal")},81:function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r=n(84);function i(t,e,n,i){void 0===i&&(i="id");var o=new r.a(n);return{id:t[i],imageUrl:t.imageUrl,amount:t.extendedListPrice,amountAfterDiscount:t.extendedSalePrice,discount:t.discountAmount,integerAmount:o.toInteger(t.extendedListPrice),integerAmountAfterDiscount:o.toInteger(t.extendedSalePrice),integerDiscount:o.toInteger(t.discountAmount),integerUnitPrice:o.toInteger(t.listPrice),integerUnitPriceAfterDiscount:o.toInteger(t.salePrice),downloadsPageUrl:t.downloadPageUrl,name:t.name,quantity:t.quantity,brand:t.brand,sku:t.sku,categoryNames:t.categoryNames,variantId:t.variantId,productId:t.productId,attributes:(t.options||[]).map((function(t){return{name:t.name,value:t.value}})),addedByPromotion:t.addedByPromotion,type:e}}},83:function(t,e,n){"use strict";function r(t,e){return{description:t.description,module:t.type,price:t.cost,id:t.id,selected:e,isRecommended:t.isRecommended,imageUrl:t.imageUrl,transitTime:t.transitTime}}n.d(e,"a",(function(){return r}))},84:function(t,e,n){"use strict";var r=function(){function t(t){this._decimalPlaces=t}return t.prototype.toInteger=function(t){return Math.round(t*Math.pow(10,this._decimalPlaces))},t}();e.a=r}});
2
2
  //# sourceMappingURL=internal-mappers.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tslib\"","webpack:///external \"lodash\"","webpack:///./src/customer/map-to-internal-customer.ts","webpack:///./src/order/map-to-internal-order.ts","webpack:///./src/cart/map-to-internal-cart.ts","webpack:///./src/promotion/map-to-discount-notifications.ts","webpack:///./src/billing/is-billing-address-like.ts","webpack:///./src/coupon/map-to-internal-coupon.ts","webpack:///./src/coupon/map-to-internal-gift-certificate.ts","webpack:///./src/common/utility/cache-key-maps.ts","webpack:///./src/common/utility/cache-key-resolver.ts","webpack:///./src/quote/map-to-internal-quote.ts","webpack:///./src/shipping/map-to-internal-shipping-options.ts","webpack:///./src/bundles/internal-mappers.ts","webpack:///./src/payment/payment-method-types.ts","webpack:///./src/address/map-to-internal-address.ts","webpack:///./src/cart/map-to-internal-line-items.ts","webpack:///./src/cart/map-gift-certificate-to-internal-line-item.ts","webpack:///external \"shallowequal\"","webpack:///./src/cart/map-to-internal-line-item.ts","webpack:///./src/shipping/map-to-internal-shipping-option.ts","webpack:///./src/common/utility/amount-transformer.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","mapToInternalCustomer","customer","billingAddress","firstName","lastName","addresses","map","address","customerId","id","isGuest","storeCredit","email","fullName","join","customerGroupName","customerGroup","mapToInternalOrder","order","orderMeta","payments","items","decimalPlaces","currency","amountTransformer","orderId","lineItems","code","customerCanBeCreated","payment","mapToInternalOrderPayment","subtotal","amount","baseAmount","integerAmount","toInteger","coupon","discountedAmount","coupons","sum","discount","discountAmount","token","orderToken","callbackUrl","discountNotifications","giftCertificate","providerId","totalDiscountedAmount","item","appliedGiftCertificates","detail","remainingBalance","remaining","balance","purchaseDate","socialData","mapToInternalSocialDataList","status","hasDigitalItems","isDownloadable","isComplete","shipping","shippingCostTotal","amountBeforeDiscount","shippingCostBeforeDiscount","integerAmountBeforeDiscount","mapToStoreCredit","taxes","taxTotal","handling","handlingCostTotal","grandTotal","orderAmount","orderAmountAsInteger","mapToInternalPaymentStatus","isDefaultOrderPayment","step","helpText","instructions","returnUrl","socialDataObject","physicalItems","digitalItems","forEach","lineItem","reduce","socialMedia","description","image","imageUrl","url","link","shareText","text","sharingLink","channelName","channel","channelCode","mapToInternalCart","checkout","promotions","notifications","cart","promotion","banners","banner","push","placeholders","discountType","message","messageHtml","giftCertificates","certificate","used","required","isShippingRequired","taxSubtotal","isBillingAddressLike","couponTypes","mapToInternalCoupon","displayName","indexOf","couponType","mapToInternalGiftCertificate","isTerminalCacheKeyMap","options","_lastId","_map","maps","_usedMaps","this","_options","maxSize","isEqual","onExpire","getKey","result","_resolveMap","args","index","parentMap","cacheKey","usedCount","_generateMap","slice","_removeLeastUsedMap","getUsedCount","length","isMatched","mapIndex","unshift","splice","parent","terminalMap","recentlyUsedMap","pop","_removeMap","isRootCacheKeyMap","mapToInternalQuote","shippingAddress","consignment","consignments","orderComment","customerMessage","shippingOption","selectedShippingOption","undefined","mapToInternalShippingOptions","shippingOptions","availableShippingOptions","option","selectedOptionId","HOSTED","OFFLINE","mapToInternalAddress","addressId","company","addressLine1","address1","addressLine2","address2","city","province","stateOrProvince","provinceCode","stateOrProvinceCode","postCode","postalCode","country","countryCode","phone","customFields","mapToInternalLineItems","itemMap","idKey","keys","amountAfterDiscount","integerAmountAfterDiscount","integerUnitPrice","integerUnitPriceAfterDiscount","integerDiscount","quantity","sender","recipient","type","attributes","variantId","mapGiftCertificateToInternalLineItem","mapToInternalLineItemType","mapToInternalLineItem","extendedListPrice","extendedSalePrice","listPrice","salePrice","downloadsPageUrl","downloadPageUrl","brand","sku","categoryNames","productId","addedByPromotion","mapToInternalShippingOption","isSelected","price","cost","selected","isRecommended","transitTime","_decimalPlaces","Math","round","pow"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CA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,YAAa7J,EAAK6E,SAAW,IAAIxH,KAAI,SAAAqK,GAAU,OAC3CrM,KAAMqM,EAAOrM,KACbU,MAAO2L,EAAO3L,UAElB6O,iBAAkB5K,EAAK4K,iBACvBhB,KAAI,K,gCClCG,SAASiB,EAA4BnD,EAAwBoD,GACxE,MAAO,CACHvI,YAAamF,EAAOnF,YACpB1H,OAAQ6M,EAAOkC,KACfmB,MAAOrD,EAAOsD,KACdxN,GAAIkK,EAAOlK,GACXyN,SAAUH,EACVI,cAAexD,EAAOwD,cACtBzI,SAAUiF,EAAOjF,SACjB0I,YAAazD,EAAOyD,aAd5B,mC,gCCHA,iBACI,WAAoBC,GAAA,KAAAA,iBAKxB,OAHI,YAAAlM,UAAA,SAAUH,GACN,OAAOsM,KAAKC,MAAMvM,EAASsM,KAAKE,IAAI,GAAIrG,KAAKkG,kBAErD,EANA,G","file":"internal-mappers.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 209);\n","module.exports = require(\"tslib\");","module.exports = require(\"lodash\");","import { mapToInternalAddress } from '../address';\nimport { BillingAddress } from '../billing';\n\nimport { Customer } from '.';\nimport InternalCustomer from './internal-customer';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCustomer(customer: Customer, billingAddress: BillingAddress): InternalCustomer {\n const firstName = customer.firstName || billingAddress.firstName || '';\n const lastName = customer.lastName || billingAddress.lastName || '';\n\n return {\n addresses: (customer.addresses || []).map(address => mapToInternalAddress(address)),\n customerId: customer.id,\n isGuest: customer.isGuest,\n storeCredit: customer.storeCredit,\n email: customer.email || billingAddress.email || '',\n firstName,\n lastName,\n name: customer.fullName || [firstName, lastName].join(' '),\n customerGroupName: customer.customerGroup && customer.customerGroup.name,\n };\n}\n","import { filter, find, keyBy, reduce } from 'lodash';\n\nimport { mapToInternalLineItems, LineItem } from '../cart';\nimport { Checkout } from '../checkout';\nimport { AmountTransformer } from '../common/utility';\nimport { mapToInternalCoupon } from '../coupon';\nimport { HOSTED } from '../payment';\n\nimport InternalOrder, { InternalGiftCertificateList, InternalIncompleteOrder, InternalOrderPayment, InternalSocialDataList } from './internal-order';\nimport Order, { GatewayOrderPayment, GiftCertificateOrderPayment, OrderPayment, OrderPayments } from './order';\nimport { OrderMetaState } from './order-state';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalOrder(order: Order, orderMeta: OrderMetaState = {}): InternalOrder {\n const decimalPlaces = order.currency.decimalPlaces;\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: order.orderId,\n items: mapToInternalLineItems(order.lineItems, order.currency.decimalPlaces, 'productId'),\n orderId: order.orderId,\n currency: order.currency.code,\n customerCanBeCreated: order.customerCanBeCreated,\n payment: mapToInternalOrderPayment(order.payments, orderMeta.payment),\n subtotal: {\n amount: order.baseAmount,\n integerAmount: amountTransformer.toInteger(order.baseAmount),\n },\n coupon: {\n discountedAmount: reduce(order.coupons, (sum, coupon) => {\n return sum + coupon.discountedAmount;\n }, 0),\n coupons: order.coupons.map(mapToInternalCoupon),\n },\n discount: {\n amount: order.discountAmount,\n integerAmount: amountTransformer.toInteger(order.discountAmount),\n },\n token: orderMeta.orderToken,\n callbackUrl: orderMeta.callbackUrl,\n discountNotifications: [],\n giftCertificate: mapToGiftCertificates(order.payments),\n socialData: mapToInternalSocialDataList(order),\n status: order.status,\n hasDigitalItems: order.hasDigitalItems,\n isDownloadable: order.isDownloadable,\n isComplete: order.isComplete,\n shipping: {\n amount: order.shippingCostTotal,\n integerAmount: amountTransformer.toInteger(order.shippingCostTotal),\n amountBeforeDiscount: order.shippingCostBeforeDiscount,\n integerAmountBeforeDiscount: amountTransformer.toInteger(order.shippingCostBeforeDiscount),\n },\n storeCredit: {\n amount: mapToStoreCredit(order.payments),\n },\n taxes: order.taxes,\n taxTotal: {\n amount: order.taxTotal,\n integerAmount: amountTransformer.toInteger(order.taxTotal),\n },\n handling: {\n amount: order.handlingCostTotal,\n integerAmount: amountTransformer.toInteger(order.handlingCostTotal),\n },\n grandTotal: {\n amount: order.orderAmount,\n integerAmount: order.orderAmountAsInteger,\n },\n };\n}\n\nexport function mapToInternalIncompleteOrder(checkout: Checkout): InternalIncompleteOrder {\n const payment = find(checkout.payments, { providerType: HOSTED });\n\n return {\n orderId: null,\n isComplete: false,\n payment: !payment ? {} : {\n id: payment.providerId,\n gateway: payment.gatewayId,\n status: mapToInternalPaymentStatus(payment.detail.step),\n },\n };\n}\n\nfunction mapToInternalPaymentStatus(status: string): string {\n return `PAYMENT_STATUS_${status}`;\n}\n\nfunction mapToStoreCredit(payments?: OrderPayments): number {\n const item = find(payments, { providerId: 'storecredit' });\n\n return item ? item.amount : 0;\n}\n\nfunction mapToGiftCertificates(payments?: OrderPayments): InternalGiftCertificateList {\n const items = filter(payments, { providerId: 'giftcertificate' }) as GiftCertificateOrderPayment[];\n\n return {\n totalDiscountedAmount: reduce(items, (sum, item) => item.amount + sum, 0),\n appliedGiftCertificates: keyBy(items.map(item => ({\n code: item.detail.code,\n discountedAmount: item.amount,\n remainingBalance: item.detail.remaining,\n giftCertificate: {\n balance: item.amount + item.detail.remaining,\n code: item.detail.code,\n purchaseDate: '',\n },\n })), 'code'),\n };\n}\n\nfunction mapToInternalOrderPayment(payments?: OrderPayments, payment: InternalOrderPayment = {}): InternalOrderPayment {\n const item = find(payments, isDefaultOrderPayment) as GatewayOrderPayment;\n\n if (!item) {\n return {};\n }\n\n return {\n id: item.providerId,\n status: mapToInternalPaymentStatus(item.detail.step),\n helpText: item.detail.instructions,\n returnUrl: payment.returnUrl,\n };\n}\n\nfunction isDefaultOrderPayment(payment: OrderPayment): payment is GatewayOrderPayment {\n return payment.providerId !== 'giftcertificate' && payment.providerId !== 'storecredit';\n}\n\nfunction mapToInternalSocialDataList(order: Order): { [itemId: string]: InternalSocialDataList } | undefined {\n const socialDataObject: { [itemId: string]: InternalSocialDataList } = {};\n const items = [\n ...order.lineItems.physicalItems,\n ...order.lineItems.digitalItems,\n ];\n\n items.forEach(item => {\n socialDataObject[item.id] = mapToInternalSocialData(item);\n });\n\n return socialDataObject;\n}\n\nfunction mapToInternalSocialData(lineItem: LineItem): InternalSocialDataList {\n const codes = ['fb', 'tw', 'gp'];\n\n return codes.reduce((socialData, code) => {\n const item = lineItem.socialMedia && find(lineItem.socialMedia, item => item.code === code);\n\n if (!item) {\n return socialData;\n }\n\n socialData[code] = {\n name: lineItem.name,\n description: lineItem.name,\n image: lineItem.imageUrl,\n url: item.link,\n shareText: item.text,\n sharingLink: item.link,\n channelName: item.channel,\n channelCode: item.code,\n };\n\n return socialData;\n }, {} as InternalSocialDataList);\n}\n","import { keyBy, reduce, some } from 'lodash';\n\nimport { Checkout } from '../checkout';\nimport { AmountTransformer } from '../common/utility';\nimport { mapToInternalCoupon, mapToInternalGiftCertificate } from '../coupon';\nimport { mapToDiscountNotifications } from '../promotion';\n\nimport InternalCart from './internal-cart';\nimport mapToInternalLineItems from './map-to-internal-line-items';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCart(checkout: Checkout): InternalCart {\n const decimalPlaces = checkout.cart.currency.decimalPlaces;\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: checkout.cart.id,\n items: mapToInternalLineItems(checkout.cart.lineItems, decimalPlaces),\n currency: checkout.cart.currency.code,\n coupon: {\n discountedAmount: reduce(checkout.cart.coupons, (sum, coupon) => {\n return sum + coupon.discountedAmount;\n }, 0),\n coupons: checkout.cart.coupons.map(mapToInternalCoupon),\n },\n discount: {\n amount: checkout.cart.discountAmount,\n integerAmount: amountTransformer.toInteger(checkout.cart.discountAmount),\n },\n discountNotifications: mapToDiscountNotifications(checkout.promotions),\n giftCertificate: {\n totalDiscountedAmount: reduce(checkout.giftCertificates, (sum, certificate) => {\n return sum + certificate.used;\n }, 0),\n appliedGiftCertificates: keyBy(checkout.giftCertificates.map(mapToInternalGiftCertificate), 'code'),\n },\n shipping: {\n amount: checkout.shippingCostTotal,\n integerAmount: amountTransformer.toInteger(checkout.shippingCostTotal),\n amountBeforeDiscount: checkout.shippingCostBeforeDiscount,\n integerAmountBeforeDiscount: amountTransformer.toInteger(checkout.shippingCostBeforeDiscount),\n required: some(checkout.cart.lineItems.physicalItems, lineItem => lineItem.isShippingRequired),\n },\n subtotal: {\n amount: checkout.subtotal,\n integerAmount: amountTransformer.toInteger(checkout.subtotal),\n },\n storeCredit: {\n amount: checkout.customer ? checkout.customer.storeCredit : 0,\n },\n taxSubtotal: {\n amount: checkout.taxTotal,\n integerAmount: amountTransformer.toInteger(checkout.taxTotal),\n },\n taxes: checkout.taxes,\n taxTotal: {\n amount: checkout.taxTotal,\n integerAmount: amountTransformer.toInteger(checkout.taxTotal),\n },\n handling: {\n amount: checkout.handlingCostTotal,\n integerAmount: amountTransformer.toInteger(checkout.handlingCostTotal),\n },\n grandTotal: {\n amount: checkout.grandTotal,\n integerAmount: amountTransformer.toInteger(checkout.grandTotal),\n },\n };\n}\n","import { DiscountNotification } from '../discount';\n\nimport { Promotion } from '.';\n\nexport default function mapToDiscountNotifications(promotions?: Promotion[]): DiscountNotification[] {\n const notifications: DiscountNotification[] = [];\n\n (promotions || []).forEach(promotion => {\n (promotion.banners || []).forEach(banner => {\n notifications.push({\n placeholders: [],\n discountType: null,\n message: '',\n messageHtml: banner.text,\n });\n });\n });\n\n return notifications;\n}\n","import { Address } from '../address';\n\nimport BillingAddress from './billing-address';\n\nexport default function isBillingAddressLike(address: Address): address is BillingAddress {\n const billingAddress = address as BillingAddress;\n\n return typeof billingAddress.id !== 'undefined';\n}\n","import Coupon from './coupon';\nimport InternalCoupon from './internal-coupon';\n\nconst couponTypes = [\n 'per_item_discount',\n 'percentage_discount',\n 'per_total_discount',\n 'shipping_discount',\n 'free_shipping',\n];\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCoupon(coupon: Coupon): InternalCoupon {\n return {\n code: coupon.code,\n discount: coupon.displayName,\n discountType: couponTypes.indexOf(coupon.couponType),\n };\n}\n","import GiftCertificate from './gift-certificate';\nimport InternalGiftCertificate from './internal-gift-certificate';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalGiftCertificate(giftCertificate: GiftCertificate): InternalGiftCertificate {\n return {\n code: giftCertificate.code,\n discountedAmount: giftCertificate.used,\n remainingBalance: giftCertificate.remaining,\n giftCertificate: {\n balance: giftCertificate.balance,\n code: giftCertificate.code,\n purchaseDate: giftCertificate.purchaseDate,\n },\n };\n}\n","export interface RootCacheKeyMap {\n maps: ChildCacheKeyMap[];\n}\n\nexport interface IntermediateCacheKeyMap {\n maps: ChildCacheKeyMap[];\n parentMap: RootCacheKeyMap | IntermediateCacheKeyMap;\n usedCount: number;\n value: any;\n}\n\nexport interface TerminalCacheKeyMap extends IntermediateCacheKeyMap {\n cacheKey: string;\n}\n\nexport type ChildCacheKeyMap = IntermediateCacheKeyMap | TerminalCacheKeyMap;\n\nexport function isTerminalCacheKeyMap(map: ChildCacheKeyMap): map is TerminalCacheKeyMap {\n return map.hasOwnProperty('cacheKey');\n}\n\nexport function isRootCacheKeyMap(map: RootCacheKeyMap | ChildCacheKeyMap): map is RootCacheKeyMap {\n return map.hasOwnProperty('parentMap');\n}\n","import { noop } from 'lodash';\nimport shallowEqual from 'shallowequal';\n\nimport { isRootCacheKeyMap, isTerminalCacheKeyMap, ChildCacheKeyMap, IntermediateCacheKeyMap, RootCacheKeyMap, TerminalCacheKeyMap } from './cache-key-maps';\n\nexport interface CacheKeyResolverOptions {\n maxSize?: number;\n onExpire?(key: string): void;\n isEqual?(valueA: any, valueB: any): boolean;\n}\n\ninterface ResolveResult {\n index: number;\n parentMap: RootCacheKeyMap | IntermediateCacheKeyMap;\n map?: TerminalCacheKeyMap;\n}\n\nexport default class CacheKeyResolver {\n private _lastId = 0;\n private _map: RootCacheKeyMap = { maps: [] };\n private _usedMaps: TerminalCacheKeyMap[] = [];\n private _options: Required<CacheKeyResolverOptions>;\n\n constructor(options?: CacheKeyResolverOptions) {\n this._options = {\n maxSize: 0,\n isEqual: shallowEqual,\n onExpire: noop,\n ...options,\n };\n }\n\n getKey(...args: any[]): string {\n const result = this._resolveMap(...args);\n const { index, parentMap } = result;\n let { map } = result;\n\n if (map && map.cacheKey) {\n map.usedCount++;\n } else {\n map = this._generateMap(parentMap, args.slice(index));\n }\n\n // Keep track of the least used map so we can remove it if the size of\n // the stack exceeds the maximum size.\n this._removeLeastUsedMap(map);\n\n return map.cacheKey;\n }\n\n getUsedCount(...args: any[]): number {\n const { map } = this._resolveMap(...args);\n\n return map ? map.usedCount : 0;\n }\n\n private _resolveMap(...args: any[]): ResolveResult {\n let index = 0;\n let parentMap = this._map;\n\n // Traverse the tree to find the linked list of maps that match the\n // arguments of the call. Each intermediate or terminal map contains a\n // value that could be used to match with the arguments. The last map in\n // the list (the terminal) should contain a cache key. If it can does\n // not exist, we will return a falsy value so that the caller could\n // handle and generate a new cache key.\n while (parentMap.maps.length) {\n let isMatched = false;\n\n for (let mapIndex = 0; mapIndex < parentMap.maps.length; mapIndex++) {\n const map = parentMap.maps[mapIndex];\n\n if (!this._options.isEqual(map.value, args[index])) {\n continue;\n }\n\n // Move the most recently used map to the top of the stack for\n // quicker access\n parentMap.maps.unshift(...parentMap.maps.splice(mapIndex, 1));\n\n if ((args.length === 0 || index === args.length - 1) && isTerminalCacheKeyMap(map)) {\n return { index, map, parentMap };\n }\n\n isMatched = true;\n parentMap = map;\n index++;\n\n break;\n }\n\n if (!isMatched) {\n break;\n }\n }\n\n return { index, parentMap };\n }\n\n private _generateMap(parent: RootCacheKeyMap | IntermediateCacheKeyMap, args: any[]): TerminalCacheKeyMap {\n let index = 0;\n let parentMap = parent;\n let map: IntermediateCacheKeyMap;\n\n do {\n map = {\n maps: [],\n parentMap,\n usedCount: 1,\n value: args[index],\n };\n\n // Continue to build the tree of maps so that it could be resolved\n // next time when the function is called with the same set of\n // arguments.\n parentMap.maps.unshift(map);\n\n parentMap = map;\n index++;\n } while (index < args.length);\n\n const terminalMap = map as TerminalCacheKeyMap;\n\n terminalMap.cacheKey = `${++this._lastId}`;\n\n return terminalMap;\n }\n\n private _removeLeastUsedMap(recentlyUsedMap: TerminalCacheKeyMap): void {\n if (!this._options.maxSize) {\n return;\n }\n\n const index = this._usedMaps.indexOf(recentlyUsedMap);\n\n this._usedMaps.splice(\n index === -1 ? 0 : index,\n index === -1 ? 0 : 1,\n recentlyUsedMap\n );\n\n if (this._usedMaps.length <= this._options.maxSize) {\n return;\n }\n\n const map = this._usedMaps.pop();\n\n if (!map) {\n return;\n }\n\n this._removeMap(map);\n this._options.onExpire(map.cacheKey);\n }\n\n private _removeMap(map: ChildCacheKeyMap): void {\n if (!map.parentMap) {\n return;\n }\n\n map.parentMap.maps.splice(map.parentMap.maps.indexOf(map), 1);\n\n if (isRootCacheKeyMap(map.parentMap)) {\n return;\n }\n\n this._removeMap(map.parentMap);\n }\n}\n","import { mapToInternalAddress, Address, InternalAddress } from '../address';\nimport { Checkout } from '../checkout';\n\nimport InternalQuote from './internal-quote';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalQuote(checkout: Checkout, shippingAddress?: Address): InternalQuote {\n const consignment = checkout.consignments && checkout.consignments[0];\n\n return {\n orderComment: checkout.customerMessage,\n shippingOption: consignment && consignment.selectedShippingOption ? consignment.selectedShippingOption.id : undefined,\n billingAddress: checkout.billingAddress ? mapToInternalAddress(checkout.billingAddress) : {} as InternalAddress,\n shippingAddress: shippingAddress && mapToInternalAddress(shippingAddress, checkout.consignments),\n };\n}\n","import Consignment from './consignment';\nimport { InternalShippingOptionList } from './internal-shipping-option';\nimport mapToInternalShippingOption from './map-to-internal-shipping-option';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalShippingOptions(consignments: Consignment[]): InternalShippingOptionList {\n return consignments.reduce((result, consignment) => {\n let shippingOptions;\n\n if (consignment.availableShippingOptions && consignment.availableShippingOptions.length) {\n shippingOptions = consignment.availableShippingOptions;\n } else if (consignment.selectedShippingOption) {\n shippingOptions = [consignment.selectedShippingOption];\n }\n\n return {\n ...result,\n [consignment.id]: (shippingOptions || []).map(option => {\n const selectedOptionId = consignment.selectedShippingOption && consignment.selectedShippingOption.id;\n\n return mapToInternalShippingOption(\n option,\n option.id === selectedOptionId\n );\n }),\n };\n }, {});\n}\n","/**\n * Please note that these mappers are for internal use only. DO NOT USE. They\n * can be removed or changed at any time.\n */\nexport { mapToInternalAddress } from '../address';\nexport { mapToInternalCart } from '../cart';\nexport { mapToInternalCoupon, mapToInternalGiftCertificate } from '../coupon';\nexport { mapToInternalCustomer } from '../customer';\nexport { mapToInternalLineItem, mapToInternalLineItems } from '../cart';\nexport { mapToInternalOrder } from '../order';\nexport { mapToInternalQuote } from '../quote';\nexport { mapToInternalShippingOption, mapToInternalShippingOptions } from '../shipping';\nexport { CacheKeyResolver } from '../common/utility';\n","export const HOSTED = 'PAYMENT_TYPE_HOSTED';\nexport const OFFLINE = 'PAYMENT_TYPE_OFFLINE';\n","import { isBillingAddressLike, BillingAddress } from '../billing';\nimport { Consignment } from '../shipping';\n\nimport Address from './address';\nimport InternalAddress from './internal-address';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalAddress(\n address: Address | BillingAddress,\n consignments?: Consignment[]\n): InternalAddress<any> {\n let addressId;\n\n if (isBillingAddressLike(address)) {\n addressId = address.id;\n } else if (consignments && consignments.length) {\n addressId = consignments[0].id;\n }\n\n return {\n id: addressId,\n firstName: address.firstName,\n lastName: address.lastName,\n company: address.company,\n addressLine1: address.address1,\n addressLine2: address.address2,\n city: address.city,\n province: address.stateOrProvince,\n provinceCode: address.stateOrProvinceCode,\n postCode: address.postalCode,\n country: address.country,\n countryCode: address.countryCode,\n phone: address.phone,\n customFields: address.customFields,\n };\n}\n","import InternalLineItem from './internal-line-item';\nimport { LineItem } from './line-item';\nimport LineItemMap from './line-item-map';\nimport mapGiftCertificateToInternalLineItem from './map-gift-certificate-to-internal-line-item';\nimport mapToInternalLineItem from './map-to-internal-line-item';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalLineItems(\n itemMap: LineItemMap,\n decimalPlaces: number,\n idKey: keyof LineItem = 'id'\n): InternalLineItem[] {\n return (Object.keys(itemMap) as Array<keyof LineItemMap>)\n .reduce((result, key) => [\n ...result,\n ...(itemMap[key] as LineItem[]).map((item: any) => {\n if (key === 'giftCertificates') {\n return mapGiftCertificateToInternalLineItem(item, decimalPlaces);\n }\n\n return mapToInternalLineItem(\n item,\n mapToInternalLineItemType(key),\n decimalPlaces,\n idKey\n );\n }),\n ], [] as InternalLineItem[]);\n}\n\nfunction mapToInternalLineItemType(type: string): string {\n switch (type) {\n case 'physicalItems':\n return 'ItemPhysicalEntity';\n\n case 'digitalItems':\n return 'ItemDigitalEntity';\n\n case 'giftCertificates':\n return 'ItemGiftCertificateEntity';\n\n default:\n return '';\n }\n}\n","import { AmountTransformer } from '../common/utility';\n\nimport InternalLineItem from './internal-line-item';\nimport { GiftCertificateItem } from './line-item';\n\nexport default function mapGiftCertificateToInternalLineItem(\n item: GiftCertificateItem,\n decimalPlaces: number\n): InternalLineItem {\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: item.id,\n imageUrl: '',\n name: item.name,\n amount: item.amount,\n amountAfterDiscount: item.amount,\n discount: 0,\n integerAmount: amountTransformer.toInteger(item.amount),\n integerAmountAfterDiscount: amountTransformer.toInteger(item.amount),\n integerUnitPrice: amountTransformer.toInteger(item.amount),\n integerUnitPriceAfterDiscount: amountTransformer.toInteger(item.amount),\n integerDiscount: 0,\n quantity: 1,\n sender: item.sender,\n recipient: item.recipient,\n type: 'ItemGiftCertificateEntity',\n attributes: [],\n variantId: null,\n };\n}\n","module.exports = require(\"shallowequal\");","import { AmountTransformer } from '../common/utility';\n\nimport InternalLineItem from './internal-line-item';\nimport { DigitalItem, LineItem } from './line-item';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalLineItem(\n item: LineItem,\n type: string,\n decimalPlaces: number,\n idKey: keyof LineItem = 'id'\n): InternalLineItem {\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: (item[idKey] as string | number),\n imageUrl: item.imageUrl,\n amount: item.extendedListPrice,\n amountAfterDiscount: item.extendedSalePrice,\n discount: item.discountAmount,\n integerAmount: amountTransformer.toInteger(item.extendedListPrice),\n integerAmountAfterDiscount: amountTransformer.toInteger(item.extendedSalePrice),\n integerDiscount: amountTransformer.toInteger(item.discountAmount),\n integerUnitPrice: amountTransformer.toInteger(item.listPrice),\n integerUnitPriceAfterDiscount: amountTransformer.toInteger(item.salePrice),\n downloadsPageUrl: (item as DigitalItem).downloadPageUrl,\n name: item.name,\n quantity: item.quantity,\n brand: item.brand,\n sku: item.sku,\n categoryNames: item.categoryNames,\n variantId: item.variantId,\n productId: item.productId,\n attributes: (item.options || []).map(option => ({\n name: option.name,\n value: option.value,\n })),\n addedByPromotion: item.addedByPromotion,\n type,\n };\n}\n","import InternalShippingOption from './internal-shipping-option';\nimport ShippingOption from './shipping-option';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalShippingOption(option: ShippingOption, isSelected: boolean): InternalShippingOption {\n return {\n description: option.description,\n module: option.type,\n price: option.cost,\n id: option.id,\n selected: isSelected,\n isRecommended: option.isRecommended,\n imageUrl: option.imageUrl,\n transitTime: option.transitTime,\n };\n}\n","export default class AmountTransformer {\n constructor(private _decimalPlaces: number) {}\n\n toInteger(amount: number): number {\n return Math.round(amount * Math.pow(10, this._decimalPlaces));\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"tslib\"","webpack:///external \"lodash\"","webpack:///./src/customer/map-to-internal-customer.ts","webpack:///./src/order/map-to-internal-order.ts","webpack:///./src/cart/map-to-internal-cart.ts","webpack:///./src/promotion/map-to-discount-notifications.ts","webpack:///./src/billing/is-billing-address-like.ts","webpack:///./src/coupon/map-to-internal-coupon.ts","webpack:///./src/coupon/map-to-internal-gift-certificate.ts","webpack:///./src/common/utility/cache-key-maps.ts","webpack:///./src/common/utility/cache-key-resolver.ts","webpack:///./src/quote/map-to-internal-quote.ts","webpack:///./src/shipping/map-to-internal-shipping-options.ts","webpack:///./src/bundles/internal-mappers.ts","webpack:///./src/payment/payment-method-types.ts","webpack:///./src/address/map-to-internal-address.ts","webpack:///./src/cart/map-to-internal-line-items.ts","webpack:///./src/cart/map-gift-certificate-to-internal-line-item.ts","webpack:///external \"shallowequal\"","webpack:///./src/cart/map-to-internal-line-item.ts","webpack:///./src/shipping/map-to-internal-shipping-option.ts","webpack:///./src/common/utility/amount-transformer.ts"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","require","mapToInternalCustomer","customer","billingAddress","firstName","lastName","addresses","map","address","customerId","id","isGuest","storeCredit","email","fullName","join","customerGroupName","customerGroup","mapToInternalOrder","order","orderMeta","payments","items","decimalPlaces","currency","amountTransformer","orderId","lineItems","code","customerCanBeCreated","payment","mapToInternalOrderPayment","subtotal","amount","baseAmount","integerAmount","toInteger","coupon","discountedAmount","coupons","sum","discount","discountAmount","token","orderToken","callbackUrl","discountNotifications","giftCertificate","providerId","totalDiscountedAmount","item","appliedGiftCertificates","detail","remainingBalance","remaining","balance","purchaseDate","socialData","mapToInternalSocialDataList","status","hasDigitalItems","isDownloadable","isComplete","shipping","shippingCostTotal","amountBeforeDiscount","shippingCostBeforeDiscount","integerAmountBeforeDiscount","mapToStoreCredit","taxes","taxTotal","handling","handlingCostTotal","grandTotal","orderAmount","orderAmountAsInteger","mapToInternalPaymentStatus","isDefaultOrderPayment","step","helpText","instructions","returnUrl","socialDataObject","physicalItems","digitalItems","forEach","lineItem","reduce","socialMedia","description","image","imageUrl","url","link","shareText","text","sharingLink","channelName","channel","channelCode","mapToInternalCart","checkout","promotions","notifications","cart","promotion","banners","banner","push","placeholders","discountType","message","messageHtml","giftCertificates","certificate","used","required","isShippingRequired","taxSubtotal","isBillingAddressLike","couponTypes","mapToInternalCoupon","displayName","indexOf","couponType","mapToInternalGiftCertificate","isTerminalCacheKeyMap","options","_lastId","_map","maps","_usedMaps","this","_options","maxSize","isEqual","onExpire","getKey","result","_resolveMap","args","index","parentMap","cacheKey","usedCount","_generateMap","slice","_removeLeastUsedMap","getUsedCount","length","isMatched","mapIndex","unshift","splice","parent","terminalMap","recentlyUsedMap","pop","_removeMap","isRootCacheKeyMap","mapToInternalQuote","shippingAddress","consignment","consignments","orderComment","customerMessage","shippingOption","selectedShippingOption","undefined","mapToInternalShippingOptions","shippingOptions","availableShippingOptions","option","selectedOptionId","HOSTED","OFFLINE","mapToInternalAddress","addressId","company","addressLine1","address1","addressLine2","address2","city","province","stateOrProvince","provinceCode","stateOrProvinceCode","postCode","postalCode","country","countryCode","phone","customFields","mapToInternalLineItems","itemMap","idKey","keys","amountAfterDiscount","integerAmountAfterDiscount","integerUnitPrice","integerUnitPriceAfterDiscount","integerDiscount","quantity","sender","recipient","type","attributes","variantId","mapGiftCertificateToInternalLineItem","mapToInternalLineItemType","mapToInternalLineItem","extendedListPrice","extendedSalePrice","listPrice","salePrice","downloadsPageUrl","downloadPageUrl","brand","sku","categoryNames","productId","addedByPromotion","mapToInternalShippingOption","isSelected","price","cost","selected","isRecommended","transitTime","_decimalPlaces","Math","round","pow"],"mappings":"2BACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QA0Df,OArDAF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA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,EAAwBoD,GACxE,MAAO,CACHvI,YAAamF,EAAOnF,YACpB1H,OAAQ6M,EAAOkC,KACfmB,MAAOrD,EAAOsD,KACdxN,GAAIkK,EAAOlK,GACXyN,SAAUH,EACVI,cAAexD,EAAOwD,cACtBzI,SAAUiF,EAAOjF,SACjB0I,YAAazD,EAAOyD,aAd5B,mC,gCCHA,iBACI,WAAoBC,GAAA,KAAAA,iBAKxB,OAHI,YAAAlM,UAAA,SAAUH,GACN,OAAOsM,KAAKC,MAAMvM,EAASsM,KAAKE,IAAI,GAAIrG,KAAKkG,kBAErD,EANA,G","file":"internal-mappers.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 210);\n","module.exports = require(\"tslib\");","module.exports = require(\"lodash\");","import { mapToInternalAddress } from '../address';\nimport { BillingAddress } from '../billing';\n\nimport { Customer } from '.';\nimport InternalCustomer from './internal-customer';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCustomer(customer: Customer, billingAddress: BillingAddress): InternalCustomer {\n const firstName = customer.firstName || billingAddress.firstName || '';\n const lastName = customer.lastName || billingAddress.lastName || '';\n\n return {\n addresses: (customer.addresses || []).map(address => mapToInternalAddress(address)),\n customerId: customer.id,\n isGuest: customer.isGuest,\n storeCredit: customer.storeCredit,\n email: customer.email || billingAddress.email || '',\n firstName,\n lastName,\n name: customer.fullName || [firstName, lastName].join(' '),\n customerGroupName: customer.customerGroup && customer.customerGroup.name,\n };\n}\n","import { filter, find, keyBy, reduce } from 'lodash';\n\nimport { mapToInternalLineItems, LineItem } from '../cart';\nimport { Checkout } from '../checkout';\nimport { AmountTransformer } from '../common/utility';\nimport { mapToInternalCoupon } from '../coupon';\nimport { HOSTED } from '../payment';\n\nimport InternalOrder, { InternalGiftCertificateList, InternalIncompleteOrder, InternalOrderPayment, InternalSocialDataList } from './internal-order';\nimport Order, { GatewayOrderPayment, GiftCertificateOrderPayment, OrderPayment, OrderPayments } from './order';\nimport { OrderMetaState } from './order-state';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalOrder(order: Order, orderMeta: OrderMetaState = {}): InternalOrder {\n const decimalPlaces = order.currency.decimalPlaces;\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: order.orderId,\n items: mapToInternalLineItems(order.lineItems, order.currency.decimalPlaces, 'productId'),\n orderId: order.orderId,\n currency: order.currency.code,\n customerCanBeCreated: order.customerCanBeCreated,\n payment: mapToInternalOrderPayment(order.payments, orderMeta.payment),\n subtotal: {\n amount: order.baseAmount,\n integerAmount: amountTransformer.toInteger(order.baseAmount),\n },\n coupon: {\n discountedAmount: reduce(order.coupons, (sum, coupon) => {\n return sum + coupon.discountedAmount;\n }, 0),\n coupons: order.coupons.map(mapToInternalCoupon),\n },\n discount: {\n amount: order.discountAmount,\n integerAmount: amountTransformer.toInteger(order.discountAmount),\n },\n token: orderMeta.orderToken,\n callbackUrl: orderMeta.callbackUrl,\n discountNotifications: [],\n giftCertificate: mapToGiftCertificates(order.payments),\n socialData: mapToInternalSocialDataList(order),\n status: order.status,\n hasDigitalItems: order.hasDigitalItems,\n isDownloadable: order.isDownloadable,\n isComplete: order.isComplete,\n shipping: {\n amount: order.shippingCostTotal,\n integerAmount: amountTransformer.toInteger(order.shippingCostTotal),\n amountBeforeDiscount: order.shippingCostBeforeDiscount,\n integerAmountBeforeDiscount: amountTransformer.toInteger(order.shippingCostBeforeDiscount),\n },\n storeCredit: {\n amount: mapToStoreCredit(order.payments),\n },\n taxes: order.taxes,\n taxTotal: {\n amount: order.taxTotal,\n integerAmount: amountTransformer.toInteger(order.taxTotal),\n },\n handling: {\n amount: order.handlingCostTotal,\n integerAmount: amountTransformer.toInteger(order.handlingCostTotal),\n },\n grandTotal: {\n amount: order.orderAmount,\n integerAmount: order.orderAmountAsInteger,\n },\n };\n}\n\nexport function mapToInternalIncompleteOrder(checkout: Checkout): InternalIncompleteOrder {\n const payment = find(checkout.payments, { providerType: HOSTED });\n\n return {\n orderId: null,\n isComplete: false,\n payment: !payment ? {} : {\n id: payment.providerId,\n gateway: payment.gatewayId,\n status: mapToInternalPaymentStatus(payment.detail.step),\n },\n };\n}\n\nfunction mapToInternalPaymentStatus(status: string): string {\n return `PAYMENT_STATUS_${status}`;\n}\n\nfunction mapToStoreCredit(payments?: OrderPayments): number {\n const item = find(payments, { providerId: 'storecredit' });\n\n return item ? item.amount : 0;\n}\n\nfunction mapToGiftCertificates(payments?: OrderPayments): InternalGiftCertificateList {\n const items = filter(payments, { providerId: 'giftcertificate' }) as GiftCertificateOrderPayment[];\n\n return {\n totalDiscountedAmount: reduce(items, (sum, item) => item.amount + sum, 0),\n appliedGiftCertificates: keyBy(items.map(item => ({\n code: item.detail.code,\n discountedAmount: item.amount,\n remainingBalance: item.detail.remaining,\n giftCertificate: {\n balance: item.amount + item.detail.remaining,\n code: item.detail.code,\n purchaseDate: '',\n },\n })), 'code'),\n };\n}\n\nfunction mapToInternalOrderPayment(payments?: OrderPayments, payment: InternalOrderPayment = {}): InternalOrderPayment {\n const item = find(payments, isDefaultOrderPayment) as GatewayOrderPayment;\n\n if (!item) {\n return {};\n }\n\n return {\n id: item.providerId,\n status: mapToInternalPaymentStatus(item.detail.step),\n helpText: item.detail.instructions,\n returnUrl: payment.returnUrl,\n };\n}\n\nfunction isDefaultOrderPayment(payment: OrderPayment): payment is GatewayOrderPayment {\n return payment.providerId !== 'giftcertificate' && payment.providerId !== 'storecredit';\n}\n\nfunction mapToInternalSocialDataList(order: Order): { [itemId: string]: InternalSocialDataList } | undefined {\n const socialDataObject: { [itemId: string]: InternalSocialDataList } = {};\n const items = [\n ...order.lineItems.physicalItems,\n ...order.lineItems.digitalItems,\n ];\n\n items.forEach(item => {\n socialDataObject[item.id] = mapToInternalSocialData(item);\n });\n\n return socialDataObject;\n}\n\nfunction mapToInternalSocialData(lineItem: LineItem): InternalSocialDataList {\n const codes = ['fb', 'tw', 'gp'];\n\n return codes.reduce((socialData, code) => {\n const item = lineItem.socialMedia && find(lineItem.socialMedia, item => item.code === code);\n\n if (!item) {\n return socialData;\n }\n\n socialData[code] = {\n name: lineItem.name,\n description: lineItem.name,\n image: lineItem.imageUrl,\n url: item.link,\n shareText: item.text,\n sharingLink: item.link,\n channelName: item.channel,\n channelCode: item.code,\n };\n\n return socialData;\n }, {} as InternalSocialDataList);\n}\n","import { keyBy, reduce, some } from 'lodash';\n\nimport { Checkout } from '../checkout';\nimport { AmountTransformer } from '../common/utility';\nimport { mapToInternalCoupon, mapToInternalGiftCertificate } from '../coupon';\nimport { mapToDiscountNotifications } from '../promotion';\n\nimport InternalCart from './internal-cart';\nimport mapToInternalLineItems from './map-to-internal-line-items';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCart(checkout: Checkout): InternalCart {\n const decimalPlaces = checkout.cart.currency.decimalPlaces;\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: checkout.cart.id,\n items: mapToInternalLineItems(checkout.cart.lineItems, decimalPlaces),\n currency: checkout.cart.currency.code,\n coupon: {\n discountedAmount: reduce(checkout.cart.coupons, (sum, coupon) => {\n return sum + coupon.discountedAmount;\n }, 0),\n coupons: checkout.cart.coupons.map(mapToInternalCoupon),\n },\n discount: {\n amount: checkout.cart.discountAmount,\n integerAmount: amountTransformer.toInteger(checkout.cart.discountAmount),\n },\n discountNotifications: mapToDiscountNotifications(checkout.promotions),\n giftCertificate: {\n totalDiscountedAmount: reduce(checkout.giftCertificates, (sum, certificate) => {\n return sum + certificate.used;\n }, 0),\n appliedGiftCertificates: keyBy(checkout.giftCertificates.map(mapToInternalGiftCertificate), 'code'),\n },\n shipping: {\n amount: checkout.shippingCostTotal,\n integerAmount: amountTransformer.toInteger(checkout.shippingCostTotal),\n amountBeforeDiscount: checkout.shippingCostBeforeDiscount,\n integerAmountBeforeDiscount: amountTransformer.toInteger(checkout.shippingCostBeforeDiscount),\n required: some(checkout.cart.lineItems.physicalItems, lineItem => lineItem.isShippingRequired),\n },\n subtotal: {\n amount: checkout.subtotal,\n integerAmount: amountTransformer.toInteger(checkout.subtotal),\n },\n storeCredit: {\n amount: checkout.customer ? checkout.customer.storeCredit : 0,\n },\n taxSubtotal: {\n amount: checkout.taxTotal,\n integerAmount: amountTransformer.toInteger(checkout.taxTotal),\n },\n taxes: checkout.taxes,\n taxTotal: {\n amount: checkout.taxTotal,\n integerAmount: amountTransformer.toInteger(checkout.taxTotal),\n },\n handling: {\n amount: checkout.handlingCostTotal,\n integerAmount: amountTransformer.toInteger(checkout.handlingCostTotal),\n },\n grandTotal: {\n amount: checkout.grandTotal,\n integerAmount: amountTransformer.toInteger(checkout.grandTotal),\n },\n };\n}\n","import { DiscountNotification } from '../discount';\n\nimport { Promotion } from '.';\n\nexport default function mapToDiscountNotifications(promotions?: Promotion[]): DiscountNotification[] {\n const notifications: DiscountNotification[] = [];\n\n (promotions || []).forEach(promotion => {\n (promotion.banners || []).forEach(banner => {\n notifications.push({\n placeholders: [],\n discountType: null,\n message: '',\n messageHtml: banner.text,\n });\n });\n });\n\n return notifications;\n}\n","import { Address } from '../address';\n\nimport BillingAddress from './billing-address';\n\nexport default function isBillingAddressLike(address: Address): address is BillingAddress {\n const billingAddress = address as BillingAddress;\n\n return typeof billingAddress.id !== 'undefined';\n}\n","import Coupon from './coupon';\nimport InternalCoupon from './internal-coupon';\n\nconst couponTypes = [\n 'per_item_discount',\n 'percentage_discount',\n 'per_total_discount',\n 'shipping_discount',\n 'free_shipping',\n];\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalCoupon(coupon: Coupon): InternalCoupon {\n return {\n code: coupon.code,\n discount: coupon.displayName,\n discountType: couponTypes.indexOf(coupon.couponType),\n };\n}\n","import GiftCertificate from './gift-certificate';\nimport InternalGiftCertificate from './internal-gift-certificate';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalGiftCertificate(giftCertificate: GiftCertificate): InternalGiftCertificate {\n return {\n code: giftCertificate.code,\n discountedAmount: giftCertificate.used,\n remainingBalance: giftCertificate.remaining,\n giftCertificate: {\n balance: giftCertificate.balance,\n code: giftCertificate.code,\n purchaseDate: giftCertificate.purchaseDate,\n },\n };\n}\n","export interface RootCacheKeyMap {\n maps: ChildCacheKeyMap[];\n}\n\nexport interface IntermediateCacheKeyMap {\n maps: ChildCacheKeyMap[];\n parentMap: RootCacheKeyMap | IntermediateCacheKeyMap;\n usedCount: number;\n value: any;\n}\n\nexport interface TerminalCacheKeyMap extends IntermediateCacheKeyMap {\n cacheKey: string;\n}\n\nexport type ChildCacheKeyMap = IntermediateCacheKeyMap | TerminalCacheKeyMap;\n\nexport function isTerminalCacheKeyMap(map: ChildCacheKeyMap): map is TerminalCacheKeyMap {\n return map.hasOwnProperty('cacheKey');\n}\n\nexport function isRootCacheKeyMap(map: RootCacheKeyMap | ChildCacheKeyMap): map is RootCacheKeyMap {\n return map.hasOwnProperty('parentMap');\n}\n","import { noop } from 'lodash';\nimport shallowEqual from 'shallowequal';\n\nimport { isRootCacheKeyMap, isTerminalCacheKeyMap, ChildCacheKeyMap, IntermediateCacheKeyMap, RootCacheKeyMap, TerminalCacheKeyMap } from './cache-key-maps';\n\nexport interface CacheKeyResolverOptions {\n maxSize?: number;\n onExpire?(key: string): void;\n isEqual?(valueA: any, valueB: any): boolean;\n}\n\ninterface ResolveResult {\n index: number;\n parentMap: RootCacheKeyMap | IntermediateCacheKeyMap;\n map?: TerminalCacheKeyMap;\n}\n\nexport default class CacheKeyResolver {\n private _lastId = 0;\n private _map: RootCacheKeyMap = { maps: [] };\n private _usedMaps: TerminalCacheKeyMap[] = [];\n private _options: Required<CacheKeyResolverOptions>;\n\n constructor(options?: CacheKeyResolverOptions) {\n this._options = {\n maxSize: 0,\n isEqual: shallowEqual,\n onExpire: noop,\n ...options,\n };\n }\n\n getKey(...args: any[]): string {\n const result = this._resolveMap(...args);\n const { index, parentMap } = result;\n let { map } = result;\n\n if (map && map.cacheKey) {\n map.usedCount++;\n } else {\n map = this._generateMap(parentMap, args.slice(index));\n }\n\n // Keep track of the least used map so we can remove it if the size of\n // the stack exceeds the maximum size.\n this._removeLeastUsedMap(map);\n\n return map.cacheKey;\n }\n\n getUsedCount(...args: any[]): number {\n const { map } = this._resolveMap(...args);\n\n return map ? map.usedCount : 0;\n }\n\n private _resolveMap(...args: any[]): ResolveResult {\n let index = 0;\n let parentMap = this._map;\n\n // Traverse the tree to find the linked list of maps that match the\n // arguments of the call. Each intermediate or terminal map contains a\n // value that could be used to match with the arguments. The last map in\n // the list (the terminal) should contain a cache key. If it can does\n // not exist, we will return a falsy value so that the caller could\n // handle and generate a new cache key.\n while (parentMap.maps.length) {\n let isMatched = false;\n\n for (let mapIndex = 0; mapIndex < parentMap.maps.length; mapIndex++) {\n const map = parentMap.maps[mapIndex];\n\n if (!this._options.isEqual(map.value, args[index])) {\n continue;\n }\n\n // Move the most recently used map to the top of the stack for\n // quicker access\n parentMap.maps.unshift(...parentMap.maps.splice(mapIndex, 1));\n\n if ((args.length === 0 || index === args.length - 1) && isTerminalCacheKeyMap(map)) {\n return { index, map, parentMap };\n }\n\n isMatched = true;\n parentMap = map;\n index++;\n\n break;\n }\n\n if (!isMatched) {\n break;\n }\n }\n\n return { index, parentMap };\n }\n\n private _generateMap(parent: RootCacheKeyMap | IntermediateCacheKeyMap, args: any[]): TerminalCacheKeyMap {\n let index = 0;\n let parentMap = parent;\n let map: IntermediateCacheKeyMap;\n\n do {\n map = {\n maps: [],\n parentMap,\n usedCount: 1,\n value: args[index],\n };\n\n // Continue to build the tree of maps so that it could be resolved\n // next time when the function is called with the same set of\n // arguments.\n parentMap.maps.unshift(map);\n\n parentMap = map;\n index++;\n } while (index < args.length);\n\n const terminalMap = map as TerminalCacheKeyMap;\n\n terminalMap.cacheKey = `${++this._lastId}`;\n\n return terminalMap;\n }\n\n private _removeLeastUsedMap(recentlyUsedMap: TerminalCacheKeyMap): void {\n if (!this._options.maxSize) {\n return;\n }\n\n const index = this._usedMaps.indexOf(recentlyUsedMap);\n\n this._usedMaps.splice(\n index === -1 ? 0 : index,\n index === -1 ? 0 : 1,\n recentlyUsedMap\n );\n\n if (this._usedMaps.length <= this._options.maxSize) {\n return;\n }\n\n const map = this._usedMaps.pop();\n\n if (!map) {\n return;\n }\n\n this._removeMap(map);\n this._options.onExpire(map.cacheKey);\n }\n\n private _removeMap(map: ChildCacheKeyMap): void {\n if (!map.parentMap) {\n return;\n }\n\n map.parentMap.maps.splice(map.parentMap.maps.indexOf(map), 1);\n\n if (isRootCacheKeyMap(map.parentMap)) {\n return;\n }\n\n this._removeMap(map.parentMap);\n }\n}\n","import { mapToInternalAddress, Address, InternalAddress } from '../address';\nimport { Checkout } from '../checkout';\n\nimport InternalQuote from './internal-quote';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalQuote(checkout: Checkout, shippingAddress?: Address): InternalQuote {\n const consignment = checkout.consignments && checkout.consignments[0];\n\n return {\n orderComment: checkout.customerMessage,\n shippingOption: consignment && consignment.selectedShippingOption ? consignment.selectedShippingOption.id : undefined,\n billingAddress: checkout.billingAddress ? mapToInternalAddress(checkout.billingAddress) : {} as InternalAddress,\n shippingAddress: shippingAddress && mapToInternalAddress(shippingAddress, checkout.consignments),\n };\n}\n","import Consignment from './consignment';\nimport { InternalShippingOptionList } from './internal-shipping-option';\nimport mapToInternalShippingOption from './map-to-internal-shipping-option';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalShippingOptions(consignments: Consignment[]): InternalShippingOptionList {\n return consignments.reduce((result, consignment) => {\n let shippingOptions;\n\n if (consignment.availableShippingOptions && consignment.availableShippingOptions.length) {\n shippingOptions = consignment.availableShippingOptions;\n } else if (consignment.selectedShippingOption) {\n shippingOptions = [consignment.selectedShippingOption];\n }\n\n return {\n ...result,\n [consignment.id]: (shippingOptions || []).map(option => {\n const selectedOptionId = consignment.selectedShippingOption && consignment.selectedShippingOption.id;\n\n return mapToInternalShippingOption(\n option,\n option.id === selectedOptionId\n );\n }),\n };\n }, {});\n}\n","/**\n * Please note that these mappers are for internal use only. DO NOT USE. They\n * can be removed or changed at any time.\n */\nexport { mapToInternalAddress } from '../address';\nexport { mapToInternalCart } from '../cart';\nexport { mapToInternalCoupon, mapToInternalGiftCertificate } from '../coupon';\nexport { mapToInternalCustomer } from '../customer';\nexport { mapToInternalLineItem, mapToInternalLineItems } from '../cart';\nexport { mapToInternalOrder } from '../order';\nexport { mapToInternalQuote } from '../quote';\nexport { mapToInternalShippingOption, mapToInternalShippingOptions } from '../shipping';\nexport { CacheKeyResolver } from '../common/utility';\n","export const HOSTED = 'PAYMENT_TYPE_HOSTED';\nexport const OFFLINE = 'PAYMENT_TYPE_OFFLINE';\n","import { isBillingAddressLike, BillingAddress } from '../billing';\nimport { Consignment } from '../shipping';\n\nimport Address from './address';\nimport InternalAddress from './internal-address';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalAddress(\n address: Address | BillingAddress,\n consignments?: Consignment[]\n): InternalAddress<any> {\n let addressId;\n\n if (isBillingAddressLike(address)) {\n addressId = address.id;\n } else if (consignments && consignments.length) {\n addressId = consignments[0].id;\n }\n\n return {\n id: addressId,\n firstName: address.firstName,\n lastName: address.lastName,\n company: address.company,\n addressLine1: address.address1,\n addressLine2: address.address2,\n city: address.city,\n province: address.stateOrProvince,\n provinceCode: address.stateOrProvinceCode,\n postCode: address.postalCode,\n country: address.country,\n countryCode: address.countryCode,\n phone: address.phone,\n customFields: address.customFields,\n };\n}\n","import InternalLineItem from './internal-line-item';\nimport { LineItem } from './line-item';\nimport LineItemMap from './line-item-map';\nimport mapGiftCertificateToInternalLineItem from './map-gift-certificate-to-internal-line-item';\nimport mapToInternalLineItem from './map-to-internal-line-item';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalLineItems(\n itemMap: LineItemMap,\n decimalPlaces: number,\n idKey: keyof LineItem = 'id'\n): InternalLineItem[] {\n return (Object.keys(itemMap) as Array<keyof LineItemMap>)\n .reduce((result, key) => [\n ...result,\n ...(itemMap[key] as LineItem[]).map((item: any) => {\n if (key === 'giftCertificates') {\n return mapGiftCertificateToInternalLineItem(item, decimalPlaces);\n }\n\n return mapToInternalLineItem(\n item,\n mapToInternalLineItemType(key),\n decimalPlaces,\n idKey\n );\n }),\n ], [] as InternalLineItem[]);\n}\n\nfunction mapToInternalLineItemType(type: string): string {\n switch (type) {\n case 'physicalItems':\n return 'ItemPhysicalEntity';\n\n case 'digitalItems':\n return 'ItemDigitalEntity';\n\n case 'giftCertificates':\n return 'ItemGiftCertificateEntity';\n\n default:\n return '';\n }\n}\n","import { AmountTransformer } from '../common/utility';\n\nimport InternalLineItem from './internal-line-item';\nimport { GiftCertificateItem } from './line-item';\n\nexport default function mapGiftCertificateToInternalLineItem(\n item: GiftCertificateItem,\n decimalPlaces: number\n): InternalLineItem {\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: item.id,\n imageUrl: '',\n name: item.name,\n amount: item.amount,\n amountAfterDiscount: item.amount,\n discount: 0,\n integerAmount: amountTransformer.toInteger(item.amount),\n integerAmountAfterDiscount: amountTransformer.toInteger(item.amount),\n integerUnitPrice: amountTransformer.toInteger(item.amount),\n integerUnitPriceAfterDiscount: amountTransformer.toInteger(item.amount),\n integerDiscount: 0,\n quantity: 1,\n sender: item.sender,\n recipient: item.recipient,\n type: 'ItemGiftCertificateEntity',\n attributes: [],\n variantId: null,\n };\n}\n","module.exports = require(\"shallowequal\");","import { AmountTransformer } from '../common/utility';\n\nimport InternalLineItem from './internal-line-item';\nimport { DigitalItem, LineItem } from './line-item';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalLineItem(\n item: LineItem,\n type: string,\n decimalPlaces: number,\n idKey: keyof LineItem = 'id'\n): InternalLineItem {\n const amountTransformer = new AmountTransformer(decimalPlaces);\n\n return {\n id: (item[idKey] as string | number),\n imageUrl: item.imageUrl,\n amount: item.extendedListPrice,\n amountAfterDiscount: item.extendedSalePrice,\n discount: item.discountAmount,\n integerAmount: amountTransformer.toInteger(item.extendedListPrice),\n integerAmountAfterDiscount: amountTransformer.toInteger(item.extendedSalePrice),\n integerDiscount: amountTransformer.toInteger(item.discountAmount),\n integerUnitPrice: amountTransformer.toInteger(item.listPrice),\n integerUnitPriceAfterDiscount: amountTransformer.toInteger(item.salePrice),\n downloadsPageUrl: (item as DigitalItem).downloadPageUrl,\n name: item.name,\n quantity: item.quantity,\n brand: item.brand,\n sku: item.sku,\n categoryNames: item.categoryNames,\n variantId: item.variantId,\n productId: item.productId,\n attributes: (item.options || []).map(option => ({\n name: option.name,\n value: option.value,\n })),\n addedByPromotion: item.addedByPromotion,\n type,\n };\n}\n","import InternalShippingOption from './internal-shipping-option';\nimport ShippingOption from './shipping-option';\n\n/**\n * @deprecated This mapper is only for internal use only. It is required during\n * the transition period as we are moving to adopt the new storefront API object\n * schema.\n */\nexport default function mapToInternalShippingOption(option: ShippingOption, isSelected: boolean): InternalShippingOption {\n return {\n description: option.description,\n module: option.type,\n price: option.cost,\n id: option.id,\n selected: isSelected,\n isRecommended: option.isRecommended,\n imageUrl: option.imageUrl,\n transitTime: option.transitTime,\n };\n}\n","export default class AmountTransformer {\n constructor(private _decimalPlaces: number) {}\n\n toInteger(amount: number): number {\n return Math.round(amount * Math.pow(10, this._decimalPlaces));\n }\n}\n"],"sourceRoot":""}