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["webpack://recentlyviewed/./src/classes/ObserverModel.ts","webpack://recentlyviewed/./src/components/CustomerMainComponent.tsx","webpack://recentlyviewed/external var \"React\"","webpack://recentlyviewed/external var \"ReactDOM\"","webpack://recentlyviewed/webpack/bootstrap","webpack://recentlyviewed/./src/mainCustomer.tsx"],"sourcesContent":["import { CustomerMainComponent } from \"../components/CustomerMainComponent\";\r\n\r\nexport class ObserverModel {\r\n\r\n\r\n id: number = 0;\r\n context: any | undefined;\r\n\r\n public update(suppliedContext) {\r\n this.context = suppliedContext;\r\n (window as any).CustomerMainComponent.receiveNotification_SfCustomer(suppliedContext)\r\n } \r\n\r\n subscription(suppliedContext) {\r\n return new Promise<any>(\r\n function (resolve, reject) {\r\n if (suppliedContext !== undefined) {\r\n\r\n resolve(suppliedContext); // fulfilled\r\n } else {\r\n var reason = new Error('error occured');\r\n reject(reason); // reject\r\n }\r\n\r\n }\r\n );\r\n }\r\n notifyThePromise(suppliedContext) {\r\n if (suppliedContext !== null) {\r\n this.subscription(suppliedContext)\r\n .then(function (result) {\r\n // yay, you got a new phone\r\n console.log(result);\r\n //this.context = result;\r\n // output: { brand: 'Samsung', color: 'black' }\r\n //CustomerMainComponent.receiveNotification(result);\r\n })\r\n .catch(function (error) {\r\n // oops, mom don't buy it\r\n console.log(error.message);\r\n // output: 'mom is not happy'\r\n });\r\n }\r\n\r\n }\r\n}","import * as React from 'react';\r\n\r\nimport { SfCustomerMyAccountModel } from \"../classes/SfCustomer\";\r\nimport { ObserverModel } from '../classes/ObserverModel';\r\nimport {DeptDealsNewsFeedRawData} from '../classes/DeptDealsNewsFeedRawData'\r\nexport class CustomerMainComponent extends React.Component<any, any>{\r\n\r\n constructor(props: any) {\r\n super(props);\r\n this.state = {\r\n value: null,\r\n isLoggedIn: false,\r\n sfCustomer: null,\r\n stateObserver: ObserverModel,\r\n contextState: null,\r\n detpDeals: null,\r\n recommendedProducts: null\r\n };\r\n }\r\n\r\n private static readonly SfCustomerCheckLoginURL = \"webservicesCORE1/SfCustomer/CheckLogin\";\r\n private static readonly GetDeptDealsNewsFeedURL = \"webservicesCORE1/marketing/GetDeptDealsNewsFeed\";\r\n private static readonly RecommendedProductsUrl = \"webservicesCORE1/Product/GetRecommended\";\r\n render() {\r\n return <div className=\"home__row\">\r\n {this.getCustomerGreetingContents()}\r\n {this.getDealsOfTheWeek()}\r\n </div>\r\n }\r\n\r\n getCustomerGreetingContents() {\r\n let contents = this.state.isLoggedIn ?\r\n CustomerMainComponent.renderContents(this.state.sfCustomer, this.state.recommendedProducts, this.state.stateObserver, this.state.contextState) : \"\";\r\n return contents;\r\n }\r\n\r\n\r\n\r\n getDealsOfTheWeek() {\r\n let contents = this.state.detpDeals !== null ?\r\n CustomerMainComponent.renderDealsOfTheWeekContents(this.state.detpDeals) : <></>;\r\n return contents;\r\n }\r\n\r\n\r\n\r\n private static renderDealsOfTheWeekContents(deptDealsArray: DeptDealsNewsFeedRawData[]) {\r\n /*<img className=\"deals-card__image\" src={\"imgs/sale-banners/salebanner-\" + deptDeal.DeptID + \".jpg\"} />*/ /*ID-3555*/\r\n return <div className=\"home-card home-card--deals\">\r\n <div className=\"home-card__header\">\r\n <h1>{(window as any).stringResourcesHomepage.dealsOfTheWeek}</h1>\r\n </div> \r\n <div className=\"home-card__body\">\r\n <div className=\"product-slider-controls\" id=\"deals-slider-controls\">\r\n <a className=\"product-slider-control product-slider-control--prev\">\r\n <svg version=\"1.1\" id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" xlinkHref=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n width=\"10px\" height=\"7.1px\" viewBox=\"0 0 10 7.1\" xmlSpace=\"preserve\">\r\n <g id=\"Layer_1\">\r\n\t <polygon className=\"st0\" points=\"10,0 10,0 5,4 0,0 0,3 5,7.1 5,7.1 10,3\"/>\r\n </g> \r\n </svg>\r\n </a>\r\n <a className=\"product-slider-control product-slider-control--next\">\r\n <svg version=\"1.1\" id=\"Layer_2\" xmlns=\"http://www.w3.org/2000/svg\" xlinkHref=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\r\n width=\"10px\" height=\"7.1px\" viewBox=\"0 0 10 7.1\" xmlSpace=\"preserve\">\r\n <g id=\"Layer_1\">\r\n <polygon className=\"st0\" points=\"10,0 10,0 5,4 0,0 0,3 5,7.1 5,7.1 10,3\" />\r\n </g>\r\n </svg>\r\n </a>\r\n </div>\r\n <div className=\"product-slider product-slider--large product-slider--deals\">\r\n {deptDealsArray.map(deptDeal =>\r\n <div key={deptDeal.NEWSFEED_ID} className=\"product-slider__slide\"> \r\n <a href={deptDeal.URL} className=\"deals-card\">\r\n <img className=\"deals-card__image\" src={deptDeal.IMAGE_URL} alt={deptDeal.IMAGE_ALT_TAG} />\r\n <h3 className=\"deals-card__text\">\r\n {deptDeal.TITLE}\r\n <span>{deptDeal.TEASER}</span>\r\n </h3>\r\n </a>\r\n </div>\r\n )} \r\n </div>\r\n <div className=\"product-slider__loader\">\r\n <div className=\"lds-ring\"><div></div><div></div><div></div><div></div></div>\r\n </div>\r\n </div>\r\n </div>\r\n }\r\n\r\n receiveNotification_SfCustomer(context: SfCustomerMyAccountModel | any) {\r\n\r\n if (context !== undefined && context.LoggedIn && context.CustomerID !== undefined && context.CustomerID > 0) {\r\n if (this.state.sfCustomer == null ||\r\n (!this.state.sfCustomer.LoggedIn || this.state.sfCustomer.CustomerID !== context.CustomerID)) {\r\n this.initDealsSlider(context.LoggedIn);\r\n this.getRecommendedProducts();\r\n this.setState({\r\n isLoggedIn: true,\r\n sfCustomer: context\r\n });\r\n \r\n }\r\n \r\n } else {\r\n this.setState({\r\n isLoggedIn: false,\r\n sfCustomer: context\r\n });\r\n //(window as any).dealsSliderLoggedOut();\r\n this.initDealsSlider(false);\r\n }\r\n\r\n }\r\n\r\n //This one is for testing only\r\n //receiveNotification_NEW(context) {\r\n // //this.setState((state) => {\r\n // // // Important: read `state` instead of `this.state` when updating.\r\n // // return { count: state.count + 1 }\r\n // //});\r\n\r\n // if (context instanceof SfCustomerMyAccountModel) {\r\n // this.setState({\r\n // sfCustomer: context as SfCustomerMyAccountModel\r\n // });\r\n // } else {\r\n // this.setState({\r\n // contextState: context\r\n // });\r\n // }\r\n // console.log(\"CustomerMainComponent receiveNotification_NEW: \" + context);\r\n\r\n// {\r\n//stateContext !== undefined &&\r\n// <h3>{stateContext} </h3>\r\n//}\r\n\r\n //}\r\n\r\n private static renderContents(sfCustomer: SfCustomerMyAccountModel, recommendedProducts: any[], stObserver: ObserverModel | undefined, stateContext: string | undefined) {\r\n var recommendedProdsRendered: JSX.Element[] | null = null;\r\n if (recommendedProducts != null) {\r\n recommendedProdsRendered = recommendedProducts.map((product) => {\r\n return <a key={\"recA_\" + product.PRODUCT_ID} href={GetBaseUrl() + \"product/detail/\" + product.PRODUCT_ID + \"/\" + product.URL_NAME} >\r\n <img key={\"recImg_\" + product.PRODUCT_ID} src={product.STANDARD_IMAGE} alt={product.SEO_IMAGE_ALT_TAG} />\r\n </a>\r\n });\r\n }\r\n return <div className=\"home-card home-card--greeting\">\r\n <div className=\"user-greeting\">\r\n <div className=\"user-greeting__intro\">\r\n <div className=\"user-greeting__image\"> \r\n\r\n <img src=\"webcontent/icons/user-placeholder.jpg\" />\r\n\r\n </div>\r\n <div className=\"user-greeting__hello\">\r\n {/* var greetingTranslation is supplied from the string resource on the Home.cshtml page */}\r\n <h3>{(window as any).greetingTranslation}, <span>{sfCustomer.CustomerName} {sfCustomer.CustomerLastName}</span></h3>\r\n { sfCustomer.CUSTOMER_SINCE_YEAR > 0 &&\r\n <p>{(window as any).stringResourcesHomepage.customerSince} {sfCustomer.CUSTOMER_SINCE_YEAR}</p>\r\n }\r\n </div>\r\n </div>\r\n <a href=\"m/orders\" className=\"user-greeting__recent-orders\">{(window as any).stringResourcesHomepage.seeYourRecentOrders} »</a>\r\n {recommendedProducts != null && <div className=\"user-greeting__recommended\">\r\n <h3>{(window as any).stringResourcesHomepage.recommendedForYou}</h3>\r\n <div className=\"user-greeting__recommended-items\">\r\n {recommendedProdsRendered}\r\n </div>\r\n </div>}\r\n </div>\r\n </div>\r\n }\r\n\r\n componentDidMount() {\r\n //setTimeout(() => {\r\n // this.getGetDeptDealsNewsFeedData();\r\n //}, 3000);\r\n this.getGetDeptDealsNewsFeedData();\r\n //this.checkIfLoggedIn();\r\n this.initObserverAndSubscribeToSfCustomerSubject();\r\n }\r\n checkIfLoggedInHeaderApp() {\r\n setTimeout(() => {\r\n try {\r\n (window as any).angularHeaderSubscribeToSfCustCheckLogin.zone.run(() => {\r\n (window as any).angularHeaderSubscribeToSfCustCheckLogin\r\n .componentFn(null)\r\n .subscribe(result => {\r\n if (result !== undefined && result.LoggedIn && result.CustomerID !== undefined && result.CustomerID > 0) {\r\n this.setState({\r\n isLoggedIn: true,\r\n sfCustomer: result,\r\n }, function () { }); \r\n (window as any).dealsSliderLoggedIn();\r\n } else { \r\n console.log(\"NOT logged in\"); \r\n this.setState({\r\n isLoggedIn: false,\r\n sfCustomer: result,\r\n }, function () { });\r\n (window as any).dealsSliderLoggedOut(); \r\n }\r\n console.log(result);\r\n })\r\n });\r\n } catch (error) {\r\n console.error(error);\r\n }\r\n\r\n }, 750);\r\n }\r\n\r\n checkIfLoggedIn() {\r\n\r\n return fetch(GetBaseUrl() + CustomerMainComponent.SfCustomerCheckLoginURL, {\r\n method: \"POST\", // *GET, POST, PUT, DELETE, etc.\r\n mode: \"cors\", // no-cors, cors, *same-origin\r\n cache: \"no-cache\", // *default, no-cache, reload, force-cache, only-if-cached\r\n credentials: \"same-origin\", // include, *same-origin, omit\r\n headers: {\r\n \"Content-Type\": \"application/json\",\r\n // \"Content-Type\": \"application/x-www-form-urlencoded\",\r\n }\r\n })\r\n .then((response) => response.json())\r\n .then((result) => {\r\n \r\n if (result !== undefined && result.LoggedIn && result.CustomerID !== undefined && result.CustomerID > 0) {\r\n this.initDealsSlider(result.LoggedIn);\r\n this.getRecommendedProducts();\r\n //(window as any).dealsSliderLoggedIn();\r\n this.setState({\r\n isLoggedIn: true,\r\n sfCustomer: result,\r\n },\r\n function () {\r\n\r\n });\r\n //console.log(\"user is logged in\");\r\n \r\n } else {\r\n //console.log(\"NOT logged in\");\r\n //(window as any).dealsSliderLoggedOut();\r\n this.initDealsSlider(false);\r\n this.setState({\r\n isLoggedIn: false,\r\n sfCustomer: result,\r\n },\r\n function () {\r\n\r\n });\r\n }\r\n\r\n })\r\n .catch((error) => {\r\n console.error(error);\r\n });\r\n }\r\n\r\n _sliderStatus: number = 0;//0 not set; 1 set to LoggedOut; 2 set to LoggedIn;\r\n initDealsSlider(loggedIn: boolean | undefined) {\r\n if (this._deptDealFinishedLoading) {\r\n if (loggedIn === undefined || loggedIn === null) {\r\n loggedIn = this.state.isLoggedIn;\r\n }\r\n if (!loggedIn && this._sliderStatus !== 1) {\r\n this._sliderStatus = 1;\r\n setTimeout(() => {\r\n if ((window as any).dealsSliderLoggedOut) {\r\n (window as any).dealsSliderLoggedOut();\r\n }\r\n }, 150);\r\n } else if (loggedIn && this._sliderStatus !== 2) {\r\n this._sliderStatus = 2;\r\n setTimeout(() => {\r\n if ((window as any).dealsSliderLoggedOut) {\r\n (window as any).dealsSliderLoggedIn();\r\n }\r\n }, 150);\r\n }\r\n\r\n }\r\n \r\n\r\n }\r\n\r\n _deptDealFinishedLoading: boolean = false;\r\n getGetDeptDealsNewsFeedData() {\r\n this._deptDealFinishedLoading = true;\r\n this.initDealsSlider(undefined);\r\n this.setState({\r\n\r\n detpDeals: (window as any).dealsJson,\r\n },\r\n function () {\r\n\r\n });\r\n\r\n }\r\n\r\n private recommendedFinished: boolean = false;\r\n getRecommendedProducts(data = {}) {\r\n // Default options are marked with *\r\n if (typeof data === \"undefined\") {\r\n data = {};\r\n }\r\n return fetch(GetBaseUrl() + CustomerMainComponent.RecommendedProductsUrl,\r\n {\r\n method: 'POST', // *GET, POST, PUT, DELETE, etc.\r\n mode: 'same-origin', // no-cors, cors, *same-origin\r\n cache: 'default', // *default, no-cache, reload, force-cache, only-if-cached\r\n credentials: 'same-origin', // include, *same-origin, omit\r\n headers: {\r\n 'Content-Type': 'application/json',\r\n // 'Content-Type': 'application/x-www-form-urlencoded',\r\n },\r\n redirect: 'follow', // manual, *follow, error\r\n referrer: 'client', // no-referrer, *client\r\n body: JSON.stringify(data), // body data type must match \"Content-Type\" header\r\n }).then(response => response.json()).then(result => {\r\n this.recommendedFinished = true;\r\n this.setState({\r\n recommendedProducts: result\r\n });\r\n }).catch(err => console.log(err));\r\n }\r\n\r\n localObserver: ObserverModel;\r\n initObserverAndSubscribeToSfCustomerSubject() {\r\n this.localObserver = new ObserverModel();\r\n this.localObserver.id = 28;\r\n //this.localObserver.update = this.receiveNotification_NEW;\r\n this.setState({\r\n stateObserver: this.localObserver\r\n },\r\n function () {\r\n\r\n })\r\n try {\r\n if ((window as any).$SfCustomerSubject !== undefined) {\r\n var customSubj = (window as any).$SfCustomerSubject\r\n customSubj.addObserver(this.localObserver);\r\n }\r\n } catch (exception) {\r\n //TODO: log exception in the logger\r\n console.log(exception);\r\n }\r\n\r\n\r\n }\r\n}\r\n\r\nvar _baseURL = null;\r\nfunction GetBaseUrl() {\r\n\r\n if (_baseURL == null) {\r\n _baseURL = document.getElementsByTagName('base')[0].href;\r\n }\r\n return _baseURL;\r\n}\r\n","module.exports = React;","module.exports = ReactDOM;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import * as React from \"react\";\r\nimport * as ReactDOM from \"react-dom\";\r\nimport { CustomerMainComponent } from \"./components/CustomerMainComponent\";\r\n\r\n\r\n/*The CustomerMainComponent reference pointer is accessible from the windwow object via window.CustomerMainComponent\r\n or (window as any).CustomerMainComponentCustomerMainComponent in .tsx \r\n Please refer the following example: https://brettdewoody.com/accessing-component-methods-and-state-from-outside-react/\r\n */\r\n\r\n\r\n////old method\r\n//const mainCustomerRectApp = ReactDOM.render(\r\n// <CustomerMainComponent />,\r\n// document.getElementById(\"divCustomerReactApp\")\r\n//);\r\n\r\n//(window as any).$mainCustomerRectApp = mainCustomerRectApp;\r\n\r\n//new method\r\n\r\nfunction render() {\r\n ReactDOM.render(<CustomerMainComponent\r\n ref={(CustomerMainComponent) => { (window as any).CustomerMainComponent = CustomerMainComponent }} />,\r\n document.getElementById(\"divCustomerReactApp\"));\r\n}\r\n\r\nif (document.readyState !== 'loading') {\r\n render();\r\n} else {\r\n document.addEventListener('DOMContentLoaded', render);\r\n}"],"names":["id","update","suppliedContext","this","context","window","CustomerMainComponent","receiveNotification_SfCustomer","subscription","Promise","resolve","reject","undefined","Error","notifyThePromise","then","result","console","log","catch","error","message","ObserverModel","props","_sliderStatus","_deptDealFinishedLoading","recommendedFinished","state","value","isLoggedIn","sfCustomer","stateObserver","contextState","detpDeals","recommendedProducts","render","className","getCustomerGreetingContents","getDealsOfTheWeek","renderContents","renderDealsOfTheWeekContents","deptDealsArray","stringResourcesHomepage","dealsOfTheWeek","version","xmlns","xlinkHref","x","y","width","height","viewBox","xmlSpace","points","map","deptDeal","key","NEWSFEED_ID","href","URL","src","IMAGE_URL","alt","IMAGE_ALT_TAG","TITLE","TEASER","LoggedIn","CustomerID","initDealsSlider","getRecommendedProducts","setState","stObserver","stateContext","recommendedProdsRendered","product","PRODUCT_ID","GetBaseUrl","URL_NAME","STANDARD_IMAGE","SEO_IMAGE_ALT_TAG","greetingTranslation","CustomerName","CustomerLastName","CUSTOMER_SINCE_YEAR","customerSince","seeYourRecentOrders","recommendedForYou","componentDidMount","getGetDeptDealsNewsFeedData","initObserverAndSubscribeToSfCustomerSubject","checkIfLoggedInHeaderApp","setTimeout","angularHeaderSubscribeToSfCustCheckLogin","zone","run","componentFn","subscribe","dealsSliderLoggedIn","dealsSliderLoggedOut","checkIfLoggedIn","fetch","SfCustomerCheckLoginURL","method","mode","cache","credentials","headers","response","json","loggedIn","dealsJson","data","RecommendedProductsUrl","redirect","referrer","body","JSON","stringify","err","localObserver","$SfCustomerSubject","addObserver","exception","GetDeptDealsNewsFeedURL","React","Component","_baseURL","document","getElementsByTagName","module","exports","ReactDOM","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","call","ref","getElementById","readyState","addEventListener"],"sourceRoot":""}