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rE,OAAQS,GAAK,EAC9C2D,EAASC,MAAM5D,GAAG8D,SAAW,EAI/BT,EAAOU,cAAcJ,EAASC,OAAOF,MAAK,WACxCL,EAAOC,SAAS,CACdJ,YAAaS,EAASC,MACtBT,aAAa,GAEjB,GACF,IAAGa,OAAM,SAAUC,GACjB,IAAOC,MAAMD,EACf,GACF,GACF,GACC,CACDnE,IAAK,gBACLyB,MAAO,SAAuB4C,GAC5B,OAAO,EAAAZ,EAAUa,SAASC,yBAAyBX,MAAK,SAAUY,GAChEH,EAASI,SAAQ,SAAUf,GACzB,IAAIY,EAAWE,EAAWE,MAAK,SAAUC,GACvC,OAAOA,EAAWC,SAASF,MAAK,SAAUG,GACxC,OAAOA,EAAIR,SAASS,SAASpB,EAAQqB,UACvC,GACF,IACK,IAAWC,oBAAoBV,KAClCZ,EAAQuB,WAAaX,EAASY,GAElC,GACF,GACF,GACC,CACDlF,IAAK,SACLyB,MAAO,WACL,OAAsC,IAAlCY,KAAKc,MAAMC,YAAY3D,OAClB,KAEW,gBAAoB,MAAO,KAAmB,gBAAoB,IAAS,CAC7F0F,MAAO9C,KAAKc,MAAME,cACH,gBAAoB,IAAc,CACjDV,SAAUN,KAAKY,MAAMN,SACrByC,eAAe,EACfC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,EAChBnC,YAAaf,KAAKc,MAAMC,YACxBoC,OAAQ,IAAmBC,eAAe,KAAgBC,iCAE9D,IAEJ,CA/E0C,CA+ExC,aACFhD,EAAuBiD,UAAY,CACjChD,SAAU,YAEZD,EAAuBkD,aAAe,CACpCjD,SAAU,KAAsBC,OAElC,IAAIZ,GAA0C6D,K","sources":["webpack://oticon_us/../../wdh-feature/wdh-feature-b2b-us/src/js/recently-viewed-products-spot.js"],"sourcesContent":["function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport PropTypes from 'prop-types';\nimport { WDHComponent } from '../../../../wdh-foundation/wdh';\nimport ProductTable from './components/product-table';\nimport ConfigurationManager from './infrastructure/configuration-manager';\nimport { TranslationKeys, ProductTableConstants, EventTypes } from './infrastructure/const';\nimport TranslationManager from './infrastructure/translation-manager';\nimport Spinner from './components/spinner';\nimport Logger from '../../../../wdh-foundation/wdh-logger/wdh-logger';\nimport ProductsUtils from './utilities/products-utils';\nimport HttpClient from '../../../../wdh-feature/wdh-feature-b2b-us/src/js/infrastructure/http-client';\nimport ApiClient from './infrastructure/api/api-client';\nimport CheckUtils from \"./utilities/check-utils\";\nvar EventBus = window.DGS.Event.getInstance();\n\n/**\n * Component showing last 5 viewed products\n * @memberOf module:wdh-feature-b2b\n */\nvar WDHFeatureB2BRecentlyViewedProductsSpot = /*#__PURE__*/function (_WDHComponent) {\n function WDHFeatureB2BRecentlyViewedProductsSpot() {\n var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'wdh-feature-b2b-recentlyviewedproductsspot';\n _classCallCheck(this, WDHFeatureB2BRecentlyViewedProductsSpot);\n return _callSuper(this, WDHFeatureB2BRecentlyViewedProductsSpot, [className]);\n }\n _inherits(WDHFeatureB2BRecentlyViewedProductsSpot, _WDHComponent);\n return _createClass(WDHFeatureB2BRecentlyViewedProductsSpot, [{\n key: \"init\",\n value: function init(component) {\n var _this = this;\n // Check that shop initialization has executed\n if (!ConfigurationManager.validateConfigurationLoaded(this.constructor.name)) {\n // if not, we can wait for the shop init event.\n EventBus.on(EventTypes.SHOP_INIT_READY, function () {\n if (!ConfigurationManager.validateConfigurationLoaded(_this.constructor.name)) {\n return;\n }\n ReactDOM.render(/*#__PURE__*/React.createElement(RecentlyViewedProducts, {\n className: _this.className,\n listType: ProductTableConstants.GRID\n }), component.querySelector('.component-content'));\n });\n return;\n }\n ReactDOM.render(/*#__PURE__*/React.createElement(RecentlyViewedProducts, {\n className: this.className,\n listType: ProductTableConstants.GRID\n }), component.querySelector('.component-content'));\n }\n }]);\n}(WDHComponent);\nexport default WDHFeatureB2BRecentlyViewedProductsSpot;\n\n/**\n * @param props\n * @memberof module:wdh-feature-b2b\n * @example\n * \n * @private\n */\nvar RecentlyViewedProducts = /*#__PURE__*/function (_React$Component) {\n function RecentlyViewedProducts(props) {\n var _this2;\n _classCallCheck(this, RecentlyViewedProducts);\n _this2 = _callSuper(this, RecentlyViewedProducts, [props]);\n /**\n * productList: Products to show in the product list component\n * hideSpinner: Flag control the visiblity of the spinner\n * @private\n * @type {Object}\n */\n _this2.state = {\n productList: [],\n hideSpinner: true\n };\n _this2.httpClient = new HttpClient();\n return _this2;\n }\n _inherits(RecentlyViewedProducts, _React$Component);\n return _createClass(RecentlyViewedProducts, [{\n key: \"componentWillMount\",\n value: function componentWillMount() {\n var _this3 = this;\n this.setState({\n hideSpinner: false\n }, function () {\n ApiClient.product.recentlyViewed().then(function (response) {\n response.items = ProductsUtils.fillMissingImages(response.items);\n for (var i = 0; i < response.items.length; i += 1) {\n response.items[i].quantity = 0;\n }\n\n // set categoryIds to expected values\n _this3.setCategoryId(response.items).then(function () {\n _this3.setState({\n productList: response.items,\n hideSpinner: true\n });\n });\n }).catch(function (err) {\n Logger.error(err);\n });\n });\n }\n }, {\n key: \"setCategoryId\",\n value: function setCategoryId(products) {\n return ApiClient.category.getBulkOrderCategories().then(function (categories) {\n products.forEach(function (product) {\n var category = categories.find(function (myCategory) {\n return myCategory.children.find(function (cat) {\n return cat.products.includes(product.productId);\n });\n });\n if (!CheckUtils.isNullOrEmptyObject(category)) {\n product.categoryId = category.id;\n }\n });\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n if (this.state.productList.length === 0) {\n return null;\n }\n return /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(Spinner, {\n show: !this.state.hideSpinner\n }), /*#__PURE__*/React.createElement(ProductTable, {\n listType: this.props.listType,\n canChangeView: false,\n canAddToCart: false,\n showSearchLabel: false,\n showPagination: false,\n productList: this.state.productList,\n header: TranslationManager.getTranslation(TranslationKeys.RECENTLYVIEWEDPRODUCTS_HEADER)\n }));\n }\n }]);\n}(React.Component);\nRecentlyViewedProducts.propTypes = {\n listType: PropTypes.string\n};\nRecentlyViewedProducts.defaultProps = {\n listType: ProductTableConstants.GRID\n};\nnew WDHFeatureB2BRecentlyViewedProductsSpot().run();"],"names":["_typeof","o","Symbol","iterator","constructor","prototype","_classCallCheck","a","n","TypeError","_defineProperties","e","r","t","length","enumerable","configurable","writable","Object","defineProperty","_toPropertyKey","key","_createClass","i","toPrimitive","call","String","Number","_toPrimitive","_callSuper","_getPrototypeOf","ReferenceError","_assertThisInitialized","_possibleConstructorReturn","_isNativeReflectConstruct","Reflect","construct","apply","Boolean","valueOf","setPrototypeOf","getPrototypeOf","bind","__proto__","_inherits","create","value","_setPrototypeOf","EventBus","window","DGS","Event","getInstance","WDHFeatureB2BRecentlyViewedProductsSpot","_WDHComponent","className","arguments","undefined","this","component","_this","validateConfigurationLoaded","name","RecentlyViewedProducts","listType","GRID","querySelector","on","SHOP_INIT_READY","_React$Component","props","_this2","state","productList","hideSpinner","httpClient","_this3","setState","A","product","recentlyViewed","then","response","items","fillMissingImages","quantity","setCategoryId","catch","err","error","products","category","getBulkOrderCategories","categories","forEach","find","myCategory","children","cat","includes","productId","isNullOrEmptyObject","categoryId","id","show","canChangeView","canAddToCart","showSearchLabel","showPagination","header","getTranslation","RECENTLYVIEWEDPRODUCTS_HEADER","propTypes","defaultProps","run"],"sourceRoot":""}